Annotation of pkgsrc/doc/pkgsrc.html, revision 1.45
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.20 ben 4: "HTML Tidy for NetBSD (vers 1st August 2004), see www.w3.org" />
1.1 grant 5: <meta http-equiv="Content-Type" content=
6: "text/html; charset=us-ascii" />
7:
8: <title>The pkgsrc guide</title>
9: <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
10: <meta name="generator" content=
1.23 wiz 11: "DocBook XSL Stylesheets VX.X.X" />
1.1 grant 12: <meta name="description" content=
13: "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
14: </head>
15:
16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
17: alink="#0000FF">
18: <div class="book" lang="en" xml:lang="en">
19: <div class="titlepage">
20: <div>
21: <div>
1.30 wiz 22: <h1 class="title"><a name="the-pkgsrc-guide" id=
23: "the-pkgsrc-guide"></a>The pkgsrc guide</h1>
1.1 grant 24: </div>
25:
26: <div>
1.2 hubertf 27: <h2 class="subtitle">Documentation on the NetBSD packages
1.1 grant 28: system</h2>
29: </div>
30:
31: <div>
32: <div class="authorgroup">
33: <div class="author">
34: <h3 class="author"><span class=
35: "firstname">Alistair</span> <span class=
36: "surname">Crooks</span></h3>
37:
38: <div class="affiliation">
39: <div class="address">
1.14 xtraeme 40: <p><code class="email"><<a href=
41: "mailto:agc@NetBSD.org">agc@NetBSD.org</a>></code></p>
1.1 grant 42: </div>
43: </div>
44: </div>
45:
46: <div class="author">
47: <h3 class="author"><span class=
48: "firstname">Hubert</span> <span class=
49: "surname">Feyrer</span></h3>
50:
51: <div class="affiliation">
52: <div class="address">
1.14 xtraeme 53: <p><code class="email"><<a href=
54: "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>></code></p>
1.1 grant 55: </div>
56: </div>
57: </div>
1.2 hubertf 58:
1.3 hubertf 59: <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1 grant 60: </div>
61: </div>
62:
63: <div>
64: <p class="copyright">Copyright © 1994-2004 The
65: NetBSD Foundation, Inc</p>
66: </div>
67:
1.23 wiz 68: <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.39 dillo 69: <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.9
70: 2005/06/08 13:59:30 dillo Exp $</p>
1.1 grant 71: </div>
72:
73: <div>
74: <div class="abstract">
75: <p class="title"><b>Abstract</b></p>
76:
77: <p>Information about using the NetBSD package system
78: (pkgsrc) from both a user view for installing packages
79: as well as from a pkgsrc developers' view for creating
80: new packages.</p>
81: </div>
82: </div>
83: </div>
84: <hr />
85: </div>
86:
87: <div class="toc">
88: <p><b>Table of Contents</b></p>
89:
90: <dl>
91: <dt><span class="chapter"><a href="#introduction">1.
92: Introduction</a></span></dt>
93:
94: <dd>
95: <dl>
1.30 wiz 96: <dt><span class="sect1"><a href=
97: "#introduction-section">1.1.
1.1 grant 98: Introduction</a></span></dt>
99:
100: <dt><span class="sect1"><a href="#overview">1.2.
101: Overview</a></span></dt>
102:
103: <dt><span class="sect1"><a href="#terminology">1.3.
104: Terminology</a></span></dt>
105:
106: <dt><span class="sect1"><a href="#typography">1.4.
107: Typography</a></span></dt>
108: </dl>
109: </dd>
110:
1.45 ! wiz 111: <dt><span class="part"><a href="#users-guide">1. The pkgsrc
1.1 grant 112: user's guide</a></span></dt>
113:
114: <dd>
115: <dl>
116: <dt><span class="chapter"><a href="#getting">2. Where
117: to get pkgsrc</a></span></dt>
118:
119: <dd>
120: <dl>
1.30 wiz 121: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1 grant 122: As tar file</a></span></dt>
123:
1.30 wiz 124: <dt><span class="sect1"><a href="#via-sup">2.2. Via
125: SUP</a></span></dt>
1.1 grant 126:
1.30 wiz 127: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
128: CVS</a></span></dt>
1.1 grant 129: </dl>
130: </dd>
131:
132: <dt><span class="chapter"><a href="#platforms">3. Using
133: pkgsrc on systems other than NetBSD</a></span></dt>
134:
135: <dd>
136: <dl>
1.30 wiz 137: <dt><span class="sect1"><a href=
138: "#bootstrapping-pkgsrc">3.1. Bootstrapping
139: pkgsrc</a></span></dt>
1.1 grant 140:
1.30 wiz 141: <dt><span class="sect1"><a href=
142: "#platform-specific-notes">3.2. Platform specific
143: notes</a></span></dt>
1.1 grant 144:
145: <dd>
146: <dl>
147: <dt><span class="sect2"><a href=
1.30 wiz 148: "#darwin">3.2.1. Darwin (Mac OS
1.1 grant 149: X)</a></span></dt>
150:
151: <dt><span class="sect2"><a href=
1.30 wiz 152: "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1 grant 153:
154: <dt><span class="sect2"><a href=
1.30 wiz 155: "#interix">3.2.3. Interix</a></span></dt>
1.1 grant 156:
1.30 wiz 157: <dt><span class="sect2"><a href="#irix">3.2.4.
158: IRIX</a></span></dt>
1.1 grant 159:
1.30 wiz 160: <dt><span class="sect2"><a href="#linux">3.2.5.
161: Linux</a></span></dt>
1.1 grant 162:
163: <dt><span class="sect2"><a href=
1.30 wiz 164: "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22 tv 165:
166: <dt><span class="sect2"><a href=
1.30 wiz 167: "#solaris">3.2.7. Solaris</a></span></dt>
1.1 grant 168: </dl>
169: </dd>
170: </dl>
171: </dd>
172:
173: <dt><span class="chapter"><a href="#using">4. Using
174: pkgsrc</a></span></dt>
175:
176: <dd>
177: <dl>
178: <dt><span class="sect1"><a href=
179: "#getting-started">4.1. Working with binary
180: packages</a></span></dt>
181:
182: <dd>
183: <dl>
184: <dt><span class="sect2"><a href=
1.30 wiz 185: "#where-to-get-binary-packages">4.1.1. Where to
186: get binary packages</a></span></dt>
1.1 grant 187:
188: <dt><span class="sect2"><a href=
1.30 wiz 189: "#how-to-use-binary-packages">4.1.2. How to use
190: binary packages</a></span></dt>
1.1 grant 191:
192: <dt><span class="sect2"><a href=
1.30 wiz 193: "#a-word-of-warning">4.1.3. A word of
1.1 grant 194: warning</a></span></dt>
195: </dl>
196: </dd>
197:
1.30 wiz 198: <dt><span class="sect1"><a href=
199: "#building-packages-from-source">4.2. Building
200: packages from source</a></span></dt>
1.1 grant 201:
202: <dd>
203: <dl>
204: <dt><span class="sect2"><a href=
1.30 wiz 205: "#requirements">4.2.1.
1.1 grant 206: Requirements</a></span></dt>
207:
208: <dt><span class="sect2"><a href=
1.30 wiz 209: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 210: distfiles</a></span></dt>
211:
212: <dt><span class="sect2"><a href=
1.30 wiz 213: "#how-to-build-and-install">4.2.3. How to build
214: and install</a></span></dt>
1.1 grant 215:
216: <dt><span class="sect2"><a href=
1.30 wiz 217: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 218: compiler</a></span></dt>
219: </dl>
220: </dd>
221: </dl>
222: </dd>
223:
1.38 dillo 224: <dt><span class="chapter"><a href="#configuring">5.
225: Configuring pkgsrc</a></span></dt>
226:
227: <dd>
228: <dl>
229: <dt><span class="sect1"><a href=
1.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.30 wiz 288: sandbox for chroot'ed 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.45 ! wiz 387: <dt><span class="part"><a href="#developers-guide">2. 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.38 dillo 506: "#manpage-compression">10.5.
1.1 grant 507: Manpage-compression</a></span></dt>
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.38 dillo 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.35 jmmv 614: software were configuration files
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.1 grant 671: </dl>
672: </dd>
673:
1.38 dillo 674: <dt><span class="chapter"><a href="#build">14. The
1.1 grant 675: build process</a></span></dt>
676:
677: <dd>
678: <dl>
679: <dt><span class="sect1"><a href=
1.38 dillo 680: "#build.prefix">14.1. Program
1.1 grant 681: location</a></span></dt>
682:
1.30 wiz 683: <dt><span class="sect1"><a href=
1.38 dillo 684: "#main-targets">14.2. Main targets</a></span></dt>
1.1 grant 685:
686: <dt><span class="sect1"><a href=
1.38 dillo 687: "#build.helpful-targets">14.3. Other helpful
1.1 grant 688: targets</a></span></dt>
689: </dl>
690: </dd>
691:
1.38 dillo 692: <dt><span class="chapter"><a href="#fixes">15. Notes on
1.1 grant 693: fixes for packages</a></span></dt>
694:
695: <dd>
696: <dl>
1.30 wiz 697: <dt><span class="sect1"><a href=
1.38 dillo 698: "#general-operation">15.1. General
1.30 wiz 699: operation</a></span></dt>
1.1 grant 700:
701: <dd>
702: <dl>
703: <dt><span class="sect2"><a href=
1.38 dillo 704: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 705: pull in variables from
706: /etc/mk.conf</a></span></dt>
1.1 grant 707:
708: <dt><span class="sect2"><a href=
1.38 dillo 709: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 710: to install documentation</a></span></dt>
711:
712: <dt><span class="sect2"><a href=
1.38 dillo 713: "#restricted-packages">15.1.3. Restricted
1.1 grant 714: packages</a></span></dt>
715:
716: <dt><span class="sect2"><a href=
1.38 dillo 717: "#dependencies">15.1.4. Handling
1.1 grant 718: dependencies</a></span></dt>
719:
720: <dt><span class="sect2"><a href=
1.38 dillo 721: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 722: other packages</a></span></dt>
723:
724: <dt><span class="sect2"><a href=
1.38 dillo 725: "#not-building-packages">15.1.6. Packages that
1.30 wiz 726: cannot or should not be built</a></span></dt>
1.1 grant 727:
728: <dt><span class="sect2"><a href=
1.38 dillo 729: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 730: should not be deleted, once
731: installed</a></span></dt>
1.1 grant 732:
733: <dt><span class="sect2"><a href=
1.38 dillo 734: "#security-handling">15.1.8. Handling packages
1.1 grant 735: with security problems</a></span></dt>
736:
737: <dt><span class="sect2"><a href=
1.38 dillo 738: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 739: bugs</a></span></dt>
740:
741: <dt><span class="sect2"><a href=
1.38 dillo 742: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 743: incrementing versions when fixing an existing
1.1 grant 744: package</a></span></dt>
745:
746: <dt><span class="sect2"><a href=
1.38 dillo 747: "#portability-of-packages">15.1.11. Portability
1.30 wiz 748: of packages</a></span></dt>
1.1 grant 749: </dl>
750: </dd>
751:
1.30 wiz 752: <dt><span class="sect1"><a href=
1.38 dillo 753: "#downloading-issues">15.2. Possible downloading
1.30 wiz 754: issues</a></span></dt>
1.1 grant 755:
756: <dd>
757: <dl>
758: <dt><span class="sect2"><a href=
1.38 dillo 759: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 760: distfiles aren't available for plain
1.1 grant 761: downloading</a></span></dt>
762:
763: <dt><span class="sect2"><a href=
1.38 dillo 764: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 765: handle modified distfiles with the 'old'
766: name</a></span></dt>
1.1 grant 767: </dl>
768: </dd>
769:
1.30 wiz 770: <dt><span class="sect1"><a href=
1.38 dillo 771: "#configuration-gotchas">15.3. Configuration
1.30 wiz 772: gotchas</a></span></dt>
1.1 grant 773:
774: <dd>
775: <dl>
776: <dt><span class="sect2"><a href=
1.38 dillo 777: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 778: libtool</a></span></dt>
779:
780: <dt><span class="sect2"><a href=
1.38 dillo 781: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 782: packages that already support
783: libtool</a></span></dt>
784:
785: <dt><span class="sect2"><a href=
1.38 dillo 786: "#autoconf-automake">15.3.3. GNU
1.1 grant 787: Autoconf/Automake</a></span></dt>
788: </dl>
789: </dd>
790:
1.30 wiz 791: <dt><span class="sect1"><a href=
1.38 dillo 792: "#building-considerations">15.4. Building
1.30 wiz 793: considerations</a></span></dt>
1.1 grant 794:
795: <dd>
796: <dl>
797: <dt><span class="sect2"><a href=
1.38 dillo 798: "#cpp-defines">15.4.1. CPP
1.1 grant 799: defines</a></span></dt>
800: </dl>
801: </dd>
802:
1.30 wiz 803: <dt><span class="sect1"><a href=
1.38 dillo 804: "#package-specific-actions">15.5. Package specific
1.30 wiz 805: actions</a></span></dt>
1.1 grant 806:
807: <dd>
808: <dl>
809: <dt><span class="sect2"><a href=
1.38 dillo 810: "#user-interaction">15.5.1. User
1.2 hubertf 811: interaction</a></span></dt>
1.1 grant 812:
813: <dt><span class="sect2"><a href=
1.38 dillo 814: "#handling-licenses">15.5.2. Handling
1.1 grant 815: licenses</a></span></dt>
816:
817: <dt><span class="sect2"><a href=
1.38 dillo 818: "#installing-score-files">15.5.3. Installing
1.30 wiz 819: score files</a></span></dt>
1.1 grant 820:
821: <dt><span class="sect2"><a href=
1.38 dillo 822: "#perl-scripts">15.5.4. Packages containing
1.30 wiz 823: perl scripts</a></span></dt>
1.1 grant 824:
825: <dt><span class="sect2"><a href=
1.38 dillo 826: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 827: hardcoded paths to other
828: interpreters</a></span></dt>
1.1 grant 829:
830: <dt><span class="sect2"><a href=
1.38 dillo 831: "#perl-modules">15.5.6. Packages installing
1.30 wiz 832: perl modules</a></span></dt>
1.1 grant 833:
834: <dt><span class="sect2"><a href=
1.38 dillo 835: "#faq.info-files">15.5.7. Packages installing
1.1 grant 836: info files</a></span></dt>
837:
838: <dt><span class="sect2"><a href=
1.38 dillo 839: "#gconf2-data-files">15.5.8. Packages
1.30 wiz 840: installing GConf2 data files</a></span></dt>
1.1 grant 841:
842: <dt><span class="sect2"><a href=
1.38 dillo 843: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 844: installing scrollkeeper data
845: files</a></span></dt>
1.1 grant 846:
847: <dt><span class="sect2"><a href=
1.38 dillo 848: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 849: fonts</a></span></dt>
850:
851: <dt><span class="sect2"><a href=
1.38 dillo 852: "#gtk2-modules">15.5.11. Packages installing
1.30 wiz 853: GTK2 modules</a></span></dt>
1.1 grant 854:
855: <dt><span class="sect2"><a href=
1.38 dillo 856: "#sgml-xml-data">15.5.12. Packages installing
1.30 wiz 857: SGML or XML data</a></span></dt>
1.1 grant 858:
859: <dt><span class="sect2"><a href=
1.38 dillo 860: "#mime-database">15.5.13. Packages installing
1.1 grant 861: extensions to the MIME database</a></span></dt>
862:
863: <dt><span class="sect2"><a href=
1.38 dillo 864: "#intltool">15.5.14. Packages using
1.1 grant 865: intltool</a></span></dt>
1.18 xtraeme 866:
867: <dt><span class="sect2"><a href=
1.38 dillo 868: "#startup-scripts">15.5.15. Packages installing
1.18 xtraeme 869: startup scripts</a></span></dt>
1.1 grant 870: </dl>
871: </dd>
872:
1.30 wiz 873: <dt><span class="sect1"><a href=
1.38 dillo 874: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 875: author</a></span></dt>
1.1 grant 876: </dl>
877: </dd>
878:
1.38 dillo 879: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 880: Debugging</a></span></dt>
881:
1.38 dillo 882: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 883: Submitting and Committing</a></span></dt>
884:
885: <dd>
886: <dl>
1.30 wiz 887: <dt><span class="sect1"><a href=
1.38 dillo 888: "#submitting-your-package">17.1. Submitting your
1.30 wiz 889: packages</a></span></dt>
1.1 grant 890:
1.30 wiz 891: <dt><span class="sect1"><a href=
1.41 wiz 892: "#general-notes-for-changes">17.2. General notes
893: when adding, updating, or removing
894: packages</a></span></dt>
895:
896: <dt><span class="sect1"><a href=
897: "#committing-importing">17.3. Committing: Importing
1.30 wiz 898: a package into CVS</a></span></dt>
1.1 grant 899:
1.30 wiz 900: <dt><span class="sect1"><a href=
1.41 wiz 901: "#updating-package">17.4. Updating a package to a
1.30 wiz 902: newer version</a></span></dt>
1.1 grant 903:
1.30 wiz 904: <dt><span class="sect1"><a href=
1.41 wiz 905: "#moving-package">17.5. Moving a package in
1.30 wiz 906: pkgsrc</a></span></dt>
1.1 grant 907: </dl>
908: </dd>
909: </dl>
910: </dd>
911:
1.45 ! wiz 912: <dt><span class="appendix"><a href="#examples">1. A simple
1.1 grant 913: example package: bison</a></span></dt>
914:
915: <dd>
916: <dl>
1.45 ! wiz 917: <dt><span class="sect1"><a href="#example-files">1.1.
1.1 grant 918: files</a></span></dt>
919:
920: <dd>
921: <dl>
1.30 wiz 922: <dt><span class="sect2"><a href=
1.45 ! wiz 923: "#example-Makefile">1.1.1. Makefile</a></span></dt>
1.1 grant 924:
1.30 wiz 925: <dt><span class="sect2"><a href=
1.45 ! wiz 926: "#example-descr">1.1.2. DESCR</a></span></dt>
1.1 grant 927:
1.30 wiz 928: <dt><span class="sect2"><a href=
1.45 ! wiz 929: "#example-plist">1.1.3. PLIST</a></span></dt>
1.1 grant 930:
1.30 wiz 931: <dt><span class="sect2"><a href=
1.45 ! wiz 932: "#checking-package-with-pkglint">1.1.4. Checking a
1.30 wiz 933: package with <span><strong class=
1.14 xtraeme 934: "command">pkglint</strong></span></a></span></dt>
1.1 grant 935: </dl>
936: </dd>
937:
1.45 ! wiz 938: <dt><span class="sect1"><a href="#steps-for-b-i-p">1.2.
1.30 wiz 939: Steps for building, installing,
940: packaging</a></span></dt>
1.1 grant 941: </dl>
942: </dd>
943:
1.45 ! wiz 944: <dt><span class="appendix"><a href="#logs">2. Build
1.1 grant 945: logs</a></span></dt>
946:
947: <dd>
948: <dl>
1.45 ! wiz 949: <dt><span class="sect1"><a href="#logs.building">2.1.
1.1 grant 950: Building figlet</a></span></dt>
951:
1.45 ! wiz 952: <dt><span class="sect1"><a href="#logs.package">2.2.
1.1 grant 953: Packaging figlet</a></span></dt>
954: </dl>
955: </dd>
956:
1.45 ! wiz 957: <dt><span class="appendix"><a href="#ftp-layout">3. Layout
1.1 grant 958: of the FTP server's package archive</a></span></dt>
1.2 hubertf 959:
1.45 ! wiz 960: <dt><span class="appendix"><a href="#editing">4. Editing
1.2 hubertf 961: guidelines for the pkgsrc guide</a></span></dt>
962:
963: <dd>
964: <dl>
1.45 ! wiz 965: <dt><span class="sect1"><a href="#targets">4.1.
1.2 hubertf 966: Targets</a></span></dt>
967:
1.45 ! wiz 968: <dt><span class="sect1"><a href="#procedure">4.2.
1.2 hubertf 969: Procedure</a></span></dt>
970: </dl>
971: </dd>
1.1 grant 972: </dl>
973: </div>
974:
975: <div class="chapter" lang="en" xml:lang="en">
976: <div class="titlepage">
977: <div>
978: <div>
979: <h2 class="title"><a name="introduction" id=
980: "introduction"></a>Chapter 1. Introduction</h2>
981: </div>
982: </div>
983: </div>
984:
985: <div class="toc">
986: <p><b>Table of Contents</b></p>
987:
988: <dl>
1.30 wiz 989: <dt><span class="sect1"><a href=
990: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 991:
992: <dt><span class="sect1"><a href="#overview">1.2.
993: Overview</a></span></dt>
994:
995: <dt><span class="sect1"><a href="#terminology">1.3.
996: Terminology</a></span></dt>
997:
998: <dt><span class="sect1"><a href="#typography">1.4.
999: Typography</a></span></dt>
1000: </dl>
1001: </div>
1002:
1003: <div class="sect1" lang="en" xml:lang="en">
1004: <div class="titlepage">
1005: <div>
1006: <div>
1007: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1008: "introduction-section" id=
1009: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 1010: </div>
1011: </div>
1012: </div>
1013:
1014: <p>There is a lot of software freely available for Unix
1015: based systems, which usually runs on NetBSD and other
1016: Unix-flavoured systems, too, sometimes with some
1017: modifications. The NetBSD Packages Collection (pkgsrc)
1018: incorporates any such changes necessary to make that
1019: software run, and makes the installation (and
1020: de-installation) of the software package easy by means of a
1021: single command.</p>
1022:
1023: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 1024: the <span><strong class="command">pkg_*</strong></span>
1025: tools so that installation and de-installation, printing of
1026: an inventory of all installed packages and retrieval of
1027: one-line comments or more verbose descriptions are all
1028: simple.</p>
1.1 grant 1029:
1030: <p>pkgsrc currently contains several thousand packages,
1031: including:</p>
1032:
1033: <div class="itemizedlist">
1034: <ul type="disc">
1035: <li>
1036: <p><a xmlns=
1037: "http://www.w3.org/TR/xhtml1/transitional" href=
1038: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45 ! wiz 1039: target="_top"><code xmlns="" class=
! 1040: "filename">www/apache</code></a> - The Apache web
1.20 ben 1041: server</p>
1.1 grant 1042: </li>
1043:
1044: <li>
1045: <p><a xmlns=
1046: "http://www.w3.org/TR/xhtml1/transitional" href=
1047: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 ! wiz 1048: target="_top"><code xmlns="" class=
! 1049: "filename">www/mozilla</code></a> - The Mozilla web
1.20 ben 1050: browser</p>
1.1 grant 1051: </li>
1052:
1053: <li>
1054: <p><a xmlns=
1055: "http://www.w3.org/TR/xhtml1/transitional" href=
1056: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45 ! wiz 1057: target="_top"><code xmlns="" class=
! 1058: "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20 ben 1059: Desktop Environment</p>
1.1 grant 1060: </li>
1061:
1062: <li>
1063: <p><a xmlns=
1064: "http://www.w3.org/TR/xhtml1/transitional" href=
1065: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45 ! wiz 1066: target="_top"><code xmlns="" class=
! 1067: "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20 ben 1068: Environment</p>
1.1 grant 1069: </li>
1070: </ul>
1071: </div>
1072:
1073: <p>...just to name a few.</p>
1074:
1075: <p>pkgsrc has built-in support for handling varying
1076: dependencies, such as pthreads and X11, and extended
1077: features such as IPv6 support on a range of platforms.</p>
1078:
1079: <p>pkgsrc was derived from FreeBSD's ports system, and
1080: initially developed for NetBSD only. Since then, pkgsrc has
1081: grown a lot, and now supports the following platforms:</p>
1082:
1083: <div class="itemizedlist">
1084: <ul type="disc">
1085: <li>
1086: <p><a href="http://developer.apple.com/darwin/"
1087: target="_top">Darwin</a> (<a href=
1088: "http://www.apple.com/macosx/" target="_top">Mac OS
1089: X</a>)</p>
1090: </li>
1091:
1092: <li>
1.3 hubertf 1093: <p><a href="http://www.DragonFlyBSD.org/" target=
1094: "_top">DragonFlyBSD</a></p>
1095: </li>
1096:
1097: <li>
1.1 grant 1098: <p><a href="http://www.FreeBSD.org/" target=
1099: "_top">FreeBSD</a></p>
1100: </li>
1101:
1102: <li>
1.3 hubertf 1103: <p>Microsoft Windows, via <a href=
1104: "http://www.microsoft.com/windows/sfu/" target=
1105: "_top">Interix</a></p>
1.1 grant 1106: </li>
1107:
1108: <li>
1109: <p><a href="http://www.sgi.com/software/irix6.5/"
1110: target="_top">IRIX</a></p>
1111: </li>
1112:
1113: <li>
1114: <p><a href="http://www.linux.org/" target=
1115: "_top">Linux</a></p>
1116: </li>
1117:
1118: <li>
1119: <p><a href="http://www.NetBSD.org/" target=
1120: "_top">NetBSD</a> (of course)</p>
1121: </li>
1122:
1123: <li>
1.17 sketch 1124: <p><a href="http://h30097.www3.hp.com/" target=
1125: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1126: </li>
1127:
1128: <li>
1.1 grant 1129: <p><a href="http://www.openbsd.org/" target=
1130: "_top">OpenBSD</a></p>
1131: </li>
1132:
1133: <li>
1134: <p><a href="http://www.sun.com/solaris/" target=
1135: "_top">Solaris</a></p>
1136: </li>
1137: </ul>
1138: </div>
1139: </div>
1140:
1141: <div class="sect1" lang="en" xml:lang="en">
1142: <div class="titlepage">
1143: <div>
1144: <div>
1145: <h2 class="title" style="clear: both"><a name=
1146: "overview" id="overview"></a>1.2. Overview</h2>
1147: </div>
1148: </div>
1149: </div>
1150:
1151: <p>This document is divided into two parts. The first,
1152: <a href="#users-guide" title=
1.45 ! wiz 1153: "Part 1. The pkgsrc user's guide">The pkgsrc
1.2 hubertf 1154: user's guide</a>, describes how one can use one of the
1155: packages in the Package Collection, either by installing a
1156: precompiled binary package, or by building one's own copy
1157: using the NetBSD package system. The second part, <a href=
1.1 grant 1158: "#developers-guide" title=
1.45 ! wiz 1159: "Part 2. The pkgsrc developer's guide">The pkgsrc
! 1160: developer's guide</a>, explains how to prepare a package so
! 1161: it can be easily built by other NetBSD users without
! 1162: knowing about the package's building details.</p>
1.1 grant 1163:
1164: <p>This document is available in various formats:</p>
1165:
1166: <div class="itemizedlist">
1167: <ul type="disc">
1168: <li>
1169: <p><a href="index.html" target="_top">HTML</a></p>
1170: </li>
1171:
1172: <li>
1173: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1174: </li>
1175:
1176: <li>
1177: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1178: </li>
1179:
1180: <li>
1181: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1182: </li>
1183: </ul>
1184: </div>
1185: </div>
1186:
1187: <div class="sect1" lang="en" xml:lang="en">
1188: <div class="titlepage">
1189: <div>
1190: <div>
1191: <h2 class="title" style="clear: both"><a name=
1192: "terminology" id=
1193: "terminology"></a>1.3. Terminology</h2>
1194: </div>
1195: </div>
1196: </div>
1197:
1198: <p>There has been a lot of talk about “<span class=
1199: "quote">ports</span>”, “<span class=
1200: "quote">packages</span>”, etc. so far. Here is a
1201: description of all the terminology used within this
1202: document.</p>
1203:
1204: <div class="variablelist">
1205: <dl>
1206: <dt><span class="term">Package</span></dt>
1207:
1208: <dd>
1209: <p>A set of files and building instructions that
1210: describe what's necessary to build a certain piece of
1211: software using pkgsrc. Packages are traditionally
1.45 ! wiz 1212: stored under <code xmlns=
! 1213: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1214: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1215: </dd>
1216:
1217: <dt><span class="term">The NetBSD package
1218: system</span></dt>
1219:
1220: <dd>
1221: <p>This is the former name of “<span class=
1222: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1223: NetBSD operating system and can be bootstrapped to
1224: run on non-NetBSD operating systems as well. It
1225: handles building (compiling), installing, and
1226: removing of packages.</p>
1.1 grant 1227: </dd>
1228:
1229: <dt><span class="term">Distfile</span></dt>
1230:
1231: <dd>
1232: <p>This term describes the file or files that are
1233: provided by the author of the piece of software to
1234: distribute his work. All the changes necessary to
1235: build on NetBSD are reflected in the corresponding
1236: package. Usually the distfile is in the form of a
1237: compressed tar-archive, but other types are possible,
1.45 ! wiz 1238: too. Distfiles are usually stored below <code xmlns=
! 1239: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1240: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1241: </dd>
1242:
1243: <dt><span class="term">Port</span></dt>
1244:
1245: <dd>
1246: <p>This is the term used by FreeBSD and OpenBSD
1247: people for what we call a package. In NetBSD
1248: terminology, “<span class=
1249: "quote">port</span>” refers to a different
1250: architecture.</p>
1251: </dd>
1252:
1253: <dt><span class="term">Precompiled/binary
1254: package</span></dt>
1255:
1256: <dd>
1257: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1258: distfile and stuffed together in a single
1.45 ! wiz 1259: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 1260: class="filename">.tgz</code> file so it can be
1.14 xtraeme 1261: installed on machines of the same machine
1262: architecture without the need to recompile. Packages
1.45 ! wiz 1263: are usually generated in <code xmlns=
! 1264: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1265: "filename">/usr/pkgsrc/packages</code>; there is also
1266: an archive on <a href=
1.1 grant 1267: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1268: "_top">ftp.NetBSD.org</a>.</p>
1269:
1270: <p>Sometimes, this is referred to by the term
1271: “<span class="quote">package</span>” too,
1272: especially in the context of precompiled
1273: packages.</p>
1274: </dd>
1275:
1276: <dt><span class="term">Program</span></dt>
1277:
1278: <dd>
1279: <p>The piece of software to be installed which will
1280: be constructed from all the files in the Distfile by
1281: the actions defined in the corresponding package.</p>
1282: </dd>
1283: </dl>
1284: </div>
1285: </div>
1286:
1287: <div class="sect1" lang="en" xml:lang="en">
1288: <div class="titlepage">
1289: <div>
1290: <div>
1291: <h2 class="title" style="clear: both"><a name=
1292: "typography" id=
1293: "typography"></a>1.4. Typography</h2>
1294: </div>
1295: </div>
1296: </div>
1297:
1298: <p>When giving examples for commands, shell prompts are
1299: used to show if the command should/can be issued as root,
1300: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1301: privileges are sufficient. We use a <code class=
1302: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1303: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1304: assuming they use the C-shell or tcsh.</p>
1.1 grant 1305: </div>
1306: </div>
1307:
1308: <div class="part" lang="en" xml:lang="en">
1309: <div class="titlepage">
1310: <div>
1311: <div>
1312: <h1 class="title"><a name="users-guide" id=
1.45 ! wiz 1313: "users-guide"></a>Part 1. The pkgsrc user's
! 1314: guide</h1>
1.1 grant 1315: </div>
1316: </div>
1317: </div>
1318:
1319: <div class="toc">
1320: <p><b>Table of Contents</b></p>
1321:
1322: <dl>
1323: <dt><span class="chapter"><a href="#getting">2. Where to
1324: get pkgsrc</a></span></dt>
1325:
1326: <dd>
1327: <dl>
1.30 wiz 1328: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1329: As tar file</a></span></dt>
1.1 grant 1330:
1.30 wiz 1331: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1332: SUP</a></span></dt>
1333:
1.30 wiz 1334: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1335: CVS</a></span></dt>
1336: </dl>
1337: </dd>
1338:
1339: <dt><span class="chapter"><a href="#platforms">3. Using
1340: pkgsrc on systems other than NetBSD</a></span></dt>
1341:
1342: <dd>
1343: <dl>
1.30 wiz 1344: <dt><span class="sect1"><a href=
1345: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1346: pkgsrc</a></span></dt>
1.1 grant 1347:
1.30 wiz 1348: <dt><span class="sect1"><a href=
1349: "#platform-specific-notes">3.2. Platform specific
1350: notes</a></span></dt>
1.1 grant 1351:
1352: <dd>
1353: <dl>
1.30 wiz 1354: <dt><span class="sect2"><a href="#darwin">3.2.1.
1355: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1356:
1.30 wiz 1357: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1358: FreeBSD</a></span></dt>
1.22 tv 1359:
1.30 wiz 1360: <dt><span class="sect2"><a href="#interix">3.2.3.
1361: Interix</a></span></dt>
1.1 grant 1362:
1.30 wiz 1363: <dt><span class="sect2"><a href="#irix">3.2.4.
1364: IRIX</a></span></dt>
1.1 grant 1365:
1.30 wiz 1366: <dt><span class="sect2"><a href="#linux">3.2.5.
1367: Linux</a></span></dt>
1.1 grant 1368:
1.30 wiz 1369: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1370: OpenBSD</a></span></dt>
1.1 grant 1371:
1.30 wiz 1372: <dt><span class="sect2"><a href="#solaris">3.2.7.
1373: Solaris</a></span></dt>
1.1 grant 1374: </dl>
1375: </dd>
1376: </dl>
1377: </dd>
1378:
1379: <dt><span class="chapter"><a href="#using">4. Using
1380: pkgsrc</a></span></dt>
1381:
1382: <dd>
1383: <dl>
1384: <dt><span class="sect1"><a href=
1385: "#getting-started">4.1. Working with binary
1386: packages</a></span></dt>
1387:
1388: <dd>
1389: <dl>
1390: <dt><span class="sect2"><a href=
1.30 wiz 1391: "#where-to-get-binary-packages">4.1.1. Where to
1392: get binary packages</a></span></dt>
1.1 grant 1393:
1394: <dt><span class="sect2"><a href=
1.30 wiz 1395: "#how-to-use-binary-packages">4.1.2. How to use
1396: binary packages</a></span></dt>
1.1 grant 1397:
1398: <dt><span class="sect2"><a href=
1.30 wiz 1399: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1400: warning</a></span></dt>
1401: </dl>
1402: </dd>
1403:
1.30 wiz 1404: <dt><span class="sect1"><a href=
1405: "#building-packages-from-source">4.2. Building
1406: packages from source</a></span></dt>
1.1 grant 1407:
1408: <dd>
1409: <dl>
1410: <dt><span class="sect2"><a href=
1.30 wiz 1411: "#requirements">4.2.1.
1412: Requirements</a></span></dt>
1.1 grant 1413:
1414: <dt><span class="sect2"><a href=
1.30 wiz 1415: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1416: distfiles</a></span></dt>
1417:
1418: <dt><span class="sect2"><a href=
1.30 wiz 1419: "#how-to-build-and-install">4.2.3. How to build
1420: and install</a></span></dt>
1.1 grant 1421:
1422: <dt><span class="sect2"><a href=
1.30 wiz 1423: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1424: compiler</a></span></dt>
1425: </dl>
1426: </dd>
1427: </dl>
1428: </dd>
1429:
1.38 dillo 1430: <dt><span class="chapter"><a href="#configuring">5.
1431: Configuring pkgsrc</a></span></dt>
1432:
1433: <dd>
1434: <dl>
1435: <dt><span class="sect1"><a href=
1.45 ! wiz 1436: "#general-configuration">5.1. General
! 1437: configuration</a></span></dt>
! 1438:
! 1439: <dt><span class="sect1"><a href=
! 1440: "#variables-affecting-build">5.2. Variables affecting
! 1441: the build process</a></span></dt>
! 1442:
! 1443: <dt><span class="sect1"><a href=
! 1444: "#developer-advanced-settings">5.3.
! 1445: Developer/advanced settings</a></span></dt>
! 1446:
! 1447: <dt><span class="sect1"><a href=
! 1448: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 1449: Options</a></span></dt>
1.38 dillo 1450: </dl>
1451: </dd>
1452:
1453: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 1454: binary packages</a></span></dt>
1455:
1456: <dd>
1457: <dl>
1.30 wiz 1458: <dt><span class="sect1"><a href=
1.38 dillo 1459: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 1460: single binary package</a></span></dt>
1.1 grant 1461:
1.30 wiz 1462: <dt><span class="sect1"><a href=
1.38 dillo 1463: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 1464: Settings for creation of binary
1465: packages</a></span></dt>
1466:
1.38 dillo 1467: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 1468: Doing a bulk build of all packages</a></span></dt>
1469:
1470: <dd>
1471: <dl>
1472: <dt><span class="sect2"><a href=
1.38 dillo 1473: "#binary.configuration">6.3.1.
1.1 grant 1474: Configuration</a></span></dt>
1475:
1476: <dt><span class="sect2"><a href=
1.38 dillo 1477: "#other-environmental-considerations">6.3.2.
1.30 wiz 1478: Other environmental
1.1 grant 1479: considerations</a></span></dt>
1480:
1481: <dt><span class="sect2"><a href=
1.38 dillo 1482: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 1483:
1484: <dt><span class="sect2"><a href=
1.38 dillo 1485: "#what-it-does">6.3.4. What it
1.30 wiz 1486: does</a></span></dt>
1.1 grant 1487:
1488: <dt><span class="sect2"><a href=
1.38 dillo 1489: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 1490: requirements</a></span></dt>
1491:
1492: <dt><span class="sect2"><a href=
1.38 dillo 1493: "#setting-up-a-sandbox">6.3.6. Setting up a
1.30 wiz 1494: sandbox for chroot'ed builds</a></span></dt>
1.1 grant 1495:
1496: <dt><span class="sect2"><a href=
1.38 dillo 1497: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 1498: partial set of packages</a></span></dt>
1.13 hubertf 1499:
1500: <dt><span class="sect2"><a href=
1.38 dillo 1501: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 1502: build</a></span></dt>
1.1 grant 1503: </dl>
1504: </dd>
1505:
1.30 wiz 1506: <dt><span class="sect1"><a href=
1.38 dillo 1507: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 1508: packages collection</a></span></dt>
1.1 grant 1509:
1510: <dd>
1511: <dl>
1512: <dt><span class="sect2"><a href=
1.38 dillo 1513: "#cdpack-example">6.4.1. Example of
1.1 grant 1514: cdpack</a></span></dt>
1515: </dl>
1516: </dd>
1517: </dl>
1518: </dd>
1519:
1.38 dillo 1520: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 1521: Asked Questions</a></span></dt>
1522:
1523: <dd>
1524: <dl>
1.30 wiz 1525: <dt><span class="sect1"><a href=
1.38 dillo 1526: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 1527: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1528:
1.38 dillo 1529: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 1530: Where's the pkgviews documentation?</a></span></dt>
1531:
1.38 dillo 1532: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 1533: Utilities for package management
1534: (pkgtools)</a></span></dt>
1535:
1.30 wiz 1536: <dt><span class="sect1"><a href=
1.38 dillo 1537: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 1538: non-root</a></span></dt>
1.1 grant 1539:
1.30 wiz 1540: <dt><span class="sect1"><a href=
1.38 dillo 1541: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 1542: fetching distfiles?</a></span></dt>
1.14 xtraeme 1543:
1.30 wiz 1544: <dt><span class="sect1"><a href=
1.38 dillo 1545: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 1546: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1547:
1.30 wiz 1548: <dt><span class="sect1"><a href=
1.38 dillo 1549: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 1550: from pkgsrc?</a></span></dt>
1.1 grant 1551:
1.30 wiz 1552: <dt><span class="sect1"><a href=
1.38 dillo 1553: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 1554: behind a firewall</a></span></dt>
1.1 grant 1555:
1.38 dillo 1556: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30 wiz 1557: How do I tell <span><strong class="command">make
1.14 xtraeme 1558: fetch</strong></span> to do passive
1.1 grant 1559: FTP?</a></span></dt>
1560:
1.30 wiz 1561: <dt><span class="sect1"><a href=
1.38 dillo 1562: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 1563: distfiles at once</a></span></dt>
1.1 grant 1564:
1.30 wiz 1565: <dt><span class="sect1"><a href=
1.38 dillo 1566: "#tmac.andoc-missing">7.11. What does
1.30 wiz 1567: “<span class="quote">Don't know how to make
1568: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1569: mean?</a></span></dt>
1.13 hubertf 1570:
1.30 wiz 1571: <dt><span class="sect1"><a href=
1.38 dillo 1572: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 1573: “<span class="quote">Could not find
1.14 xtraeme 1574: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1575:
1.30 wiz 1576: <dt><span class="sect1"><a href=
1.38 dillo 1577: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 1578: pkgsrc</a></span></dt>
1.1 grant 1579:
1.38 dillo 1580: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 1581: do I change the location of configuration
1582: files?</a></span></dt>
1.1 grant 1583:
1584: <dt><span class="sect1"><a href=
1.38 dillo 1585: "#audit-packages">7.15. Automated security
1.1 grant 1586: checks</a></span></dt>
1587: </dl>
1588: </dd>
1589: </dl>
1590: </div>
1591:
1592: <div class="chapter" lang="en" xml:lang="en">
1593: <div class="titlepage">
1594: <div>
1595: <div>
1596: <h2 class="title"><a name="getting" id=
1597: "getting"></a>Chapter 2. Where to get
1598: pkgsrc</h2>
1599: </div>
1600: </div>
1601: </div>
1602:
1603: <div class="toc">
1604: <p><b>Table of Contents</b></p>
1605:
1606: <dl>
1.30 wiz 1607: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1608: tar file</a></span></dt>
1609:
1.30 wiz 1610: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1611: SUP</a></span></dt>
1612:
1.30 wiz 1613: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1614: CVS</a></span></dt>
1615: </dl>
1616: </div>
1617:
1618: <p>There are three ways to get pkgsrc. Either as a tar
1619: file, via SUP, or via CVS. All three ways are described
1620: here.</p>
1621:
1622: <div class="sect1" lang="en" xml:lang="en">
1623: <div class="titlepage">
1624: <div>
1625: <div>
1626: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1627: "as-tar-file" id="as-tar-file"></a>2.1. As tar
1.1 grant 1628: file</h2>
1629: </div>
1630: </div>
1631: </div>
1632:
1633: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1634: file from <a href=
1.11 ben 1635: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1636: target="_top">ftp.NetBSD.org</a> and unpack it into
1.45 ! wiz 1637: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 1638: class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1639: </div>
1640:
1641: <div class="sect1" lang="en" xml:lang="en">
1642: <div class="titlepage">
1643: <div>
1644: <div>
1645: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1646: "via-sup" id="via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1647: </div>
1648: </div>
1649: </div>
1650:
1651: <p>As an alternative to the tar file, you can get pkgsrc
1652: via the Software Update Protocol, SUP. To do so, make
1653: sure your supfile has a line</p>
1654: <pre class="programlisting">
1655: release=pkgsrc
1656: </pre>
1657:
1.45 ! wiz 1658: <p>in it, see the examples in <code xmlns=
! 1659: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1660: "filename">/usr/share/examples/supfiles</code>, and that
1.45 ! wiz 1661: the <code xmlns=
! 1662: "http://www.w3.org/TR/xhtml1/transitional" class=
! 1663: "filename">/usr/pkgsrc</code> directory exists. Then,
! 1664: simply run <span><strong class="command">sup -v
! 1665: <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1666: </div>
1667:
1668: <div class="sect1" lang="en" xml:lang="en">
1669: <div class="titlepage">
1670: <div>
1671: <div>
1672: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1673: "via-cvs" id="via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1674: </div>
1675: </div>
1676: </div>
1677:
1678: <p>To get pkgsrc via CVS, make sure you have
1679: “<span class="quote">cvs</span>” installed.
1.27 rillig 1680: To do an initial (full) checkout of pkgsrc, do the
1681: following steps:</p>
1.1 grant 1682: <pre class="screen">
1.14 xtraeme 1683: <code class="prompt">%</code> <strong class=
1684: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1685: <code class="prompt">%</code> <strong class=
1686: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1687: <code class="prompt">%</code> <strong class=
1688: "userinput"><code>cd /usr</code></strong>
1689: <code class="prompt">%</code> <strong class=
1690: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1691: </pre>
1692:
1.45 ! wiz 1693: <p>This will create the <code xmlns=
! 1694: "http://www.w3.org/TR/xhtml1/transitional" class=
! 1695: "filename">pkgsrc</code> directory in your <code xmlns=
! 1696: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1697: "filename">/usr</code>, and all the package source will
1.45 ! wiz 1698: be stored under <code xmlns=
! 1699: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1700: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1701: initial checkout, make sure you have <code class=
1702: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1703: <pre class="screen">
1.14 xtraeme 1704: <code class="prompt">%</code> <strong class=
1705: "userinput"><code>cd /usr/pkgsrc</code></strong>
1706: <code class="prompt">%</code> <strong class=
1707: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1708: </pre>
1709:
1710: <p>Please also note that it is possible to have multiple
1711: copies of the pkgsrc hierarchy in use at any one time -
1712: all work is done relatively within the pkgsrc tree.</p>
1713: </div>
1714: </div>
1715:
1716: <div class="chapter" lang="en" xml:lang="en">
1717: <div class="titlepage">
1718: <div>
1719: <div>
1720: <h2 class="title"><a name="platforms" id=
1721: "platforms"></a>Chapter 3. Using pkgsrc on
1722: systems other than NetBSD</h2>
1723: </div>
1724: </div>
1725: </div>
1726:
1727: <div class="toc">
1728: <p><b>Table of Contents</b></p>
1729:
1730: <dl>
1.30 wiz 1731: <dt><span class="sect1"><a href=
1732: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1733: pkgsrc</a></span></dt>
1.1 grant 1734:
1.30 wiz 1735: <dt><span class="sect1"><a href=
1736: "#platform-specific-notes">3.2. Platform specific
1737: notes</a></span></dt>
1.1 grant 1738:
1739: <dd>
1740: <dl>
1.30 wiz 1741: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1742: Darwin (Mac OS X)</a></span></dt>
1743:
1.30 wiz 1744: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1745: FreeBSD</a></span></dt>
1746:
1.30 wiz 1747: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1748: Interix</a></span></dt>
1749:
1.30 wiz 1750: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1751: IRIX</a></span></dt>
1752:
1.30 wiz 1753: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1754: Linux</a></span></dt>
1755:
1.30 wiz 1756: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1757: OpenBSD</a></span></dt>
1758:
1.30 wiz 1759: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1760: Solaris</a></span></dt>
1761: </dl>
1762: </dd>
1763: </dl>
1764: </div>
1765:
1766: <div class="sect1" lang="en" xml:lang="en">
1767: <div class="titlepage">
1768: <div>
1769: <div>
1770: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1771: "bootstrapping-pkgsrc" id=
1772: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
1773: pkgsrc</h2>
1.1 grant 1774: </div>
1775: </div>
1776: </div>
1777:
1.27 rillig 1778: <p>For operating systems other than NetBSD, we provide a
1.1 grant 1779: bootstrap kit to build the required tools to use pkgsrc
1780: on your platform. Besides support for native NetBSD,
1781: pkgsrc and the bootstrap kit have support for the
1782: following operating systems:</p>
1783:
1784: <div class="itemizedlist">
1785: <ul type="disc">
1786: <li>
1787: <p>Darwin (Mac OS X)</p>
1788: </li>
1789:
1790: <li>
1.16 grant 1791: <p>DragonFlyBSD</p>
1792: </li>
1793:
1794: <li>
1.1 grant 1795: <p>FreeBSD</p>
1796: </li>
1797:
1798: <li>
1799: <p>Interix (Windows 2000, XP, 2003)</p>
1800: </li>
1801:
1802: <li>
1803: <p>IRIX</p>
1804: </li>
1805:
1806: <li>
1807: <p>Linux</p>
1808: </li>
1809:
1810: <li>
1811: <p>OpenBSD</p>
1812: </li>
1813:
1814: <li>
1815: <p>Solaris</p>
1816: </li>
1.16 grant 1817:
1818: <li>
1819: <p>Tru64 (Digital UNIX/OSF1)</p>
1820: </li>
1.1 grant 1821: </ul>
1822: </div>
1823:
1824: <p>Support for other platforms is under development.</p>
1825:
1826: <p>Installing the bootstrap kit should be as simple
1827: as:</p>
1828: <pre class="screen">
1.14 xtraeme 1829: <code class="prompt">#</code> <strong class=
1830: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1831: <code class="prompt">#</code> <strong class=
1832: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1833: <code class="prompt">#</code> <strong class=
1834: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1835: </pre>
1836:
1837: <p>See <a href="#getting" title=
1838: "Chapter 2. Where to get pkgsrc">Chapter 2,
1839: <i>Where to get pkgsrc</i></a> for other ways to get
1.14 xtraeme 1840: pkgsrc before bootstrapping. The given
1841: <span><strong class="command">bootstrap</strong></span>
1.45 ! wiz 1842: command will use the defaults of <code xmlns=
! 1843: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1844: "filename">/usr/pkg</code> for the <span class=
1845: "emphasis"><em>prefix</em></span> where programs will be
1.45 ! wiz 1846: installed in, and <code xmlns=
! 1847: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1848: "filename">/var/db/pkg</code> for the package database
1.27 rillig 1849: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 1850: However, these can also be set using command-line
1.27 rillig 1851: arguments.</p>
1.1 grant 1852:
1853: <p>Binary packages for the pkgsrc tools and an initial
1854: set of packages is available for supported platforms. An
1855: up-to-date list of these can be found on <a href=
1856: "http://www.pkgsrc.org/" target=
1857: "_top">www.pkgsrc.org</a>.</p>
1858: </div>
1859:
1860: <div class="sect1" lang="en" xml:lang="en">
1861: <div class="titlepage">
1862: <div>
1863: <div>
1864: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1865: "platform-specific-notes" id=
1866: "platform-specific-notes"></a>3.2. Platform
1.1 grant 1867: specific notes</h2>
1868: </div>
1869: </div>
1870: </div>
1871:
1872: <p>Here are some platform-specific notes you should be
1873: aware of.</p>
1874:
1875: <div class="sect2" lang="en" xml:lang="en">
1876: <div class="titlepage">
1877: <div>
1878: <div>
1.30 wiz 1879: <h3 class="title"><a name="darwin" id=
1880: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 1881: </div>
1882: </div>
1883: </div>
1884:
1885: <p>Darwin 5.x and 6.x are supported. There are two
1886: methods of using pkgsrc on Mac OS X, by using a
1887: <a href="#platform.osx-image" title=
1888: "3.2.1.1. Using a disk image">disk image</a>, or a
1889: <a href="#platform.osx-ufs" title=
1890: "3.2.1.2. Using a UFS partition">UFS
1891: partition</a>.</p>
1892:
1893: <p>Before you start, you will need to download and
1894: install the Mac OS X Developer Tools from Apple's
1895: Developer Connection. See <a href=
1896: "http://developer.apple.com/macosx/" target=
1897: "_top">http://developer.apple.com/macosx/</a> for
1898: details. Also, make sure you install X11 for Mac OS X
1899: and the X11 SDK from <a href=
1900: "http://www.apple.com/macosx/x11/download/" target=
1901: "_top">http://www.apple.com/macosx/x11/download/</a> if
1902: you intend to build packages that use the X11 Window
1903: System.</p>
1904:
1905: <p>If you already have a UFS partition, or have a spare
1906: partition that you can format as UFS, it is recommended
1907: to use that instead of the disk image. It'll be
1908: somewhat faster and will mount automatically at boot
1909: time, where you must manually mount a disk image.</p>
1910:
1911: <div class="note" style=
1912: "margin-left: 0.5in; margin-right: 0.5in;">
1913: <h3 class="title">Note</h3>
1914:
1915: <p>You cannot use a HFS+ file system for pkgsrc,
1916: because pkgsrc currently requires the filesystem to
1917: be case-sensitive, and HFS+ is not.</p>
1918: </div>
1919:
1920: <div class="sect3" lang="en" xml:lang="en">
1921: <div class="titlepage">
1922: <div>
1923: <div>
1924: <h4 class="title"><a name="platform.osx-image"
1925: id="platform.osx-image"></a>3.2.1.1. Using
1926: a disk image</h4>
1927: </div>
1928: </div>
1929: </div>
1930:
1931: <p>Create the disk image:</p>
1932: <pre class="screen">
1.14 xtraeme 1933: <code class="prompt">#</code> <strong class=
1934: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1935: <code class="prompt">#</code> <strong class=
1936: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
1937: <code class="prompt">#</code> <strong class=
1938: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
1939: <code class="prompt">#</code> <strong class=
1940: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 1941: </pre>
1942:
1943: <p>That's it!</p>
1944: </div>
1945:
1946: <div class="sect3" lang="en" xml:lang="en">
1947: <div class="titlepage">
1948: <div>
1949: <div>
1950: <h4 class="title"><a name="platform.osx-ufs"
1951: id="platform.osx-ufs"></a>3.2.1.2. Using a
1952: UFS partition</h4>
1953: </div>
1954: </div>
1955: </div>
1956:
1.45 ! wiz 1957: <p>By default, <code xmlns=
! 1958: "http://www.w3.org/TR/xhtml1/transitional" class=
! 1959: "filename">/usr</code> will be on your root file
! 1960: system, normally HFS+. It is possible to use the
! 1961: default <span class="emphasis"><em>prefix</em></span>
! 1962: of <code xmlns=
! 1963: "http://www.w3.org/TR/xhtml1/transitional" class=
! 1964: "filename">/usr/pkg</code> by symlinking <code xmlns=
! 1965: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1966: "filename">/usr/pkg</code> to a directory on a UFS
1967: file system. Obviously, another symlink is required
1968: if you want to place the package database directory
1969: outside the <span class=
1970: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 1971: <pre class="screen">
1.14 xtraeme 1972: <code class="prompt">#</code> <strong class=
1.22 tv 1973: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1 grant 1974: </pre>
1975:
1976: <p>If you created your partitions at the time of
1977: installing Mac OS X and formatted the target
1978: partition as UFS, it should automatically mount on
1.45 ! wiz 1979: <code xmlns=
! 1980: "http://www.w3.org/TR/xhtml1/transitional" class=
! 1981: "filename">/Volumes/<volume name></code> when
! 1982: the machine boots. If you are (re)formatting a
! 1983: partition as UFS, you need to ensure that the
! 1984: partition map correctly reflects “<span class=
! 1985: "quote">Apple_UFS</span>” and not
! 1986: “<span class=
1.1 grant 1987: "quote">Apple_HFS</span>”.</p>
1988:
1989: <p>The problem is that none of the disk tools will
1990: let you touch a disk that is booted from. You can
1991: unmount the partition, but even if you newfs it, the
1992: partition type will be incorrect and the automounter
1993: won't mount it. It can be mounted manually, but it
1994: won't appear in Finder.</p>
1995:
1996: <p>You'll need to boot off of the OS X Installation
1997: (User) CD. When the Installation program starts, go
1998: up to the menu and select Disk Utility. Now, you will
1999: be able to select the partition you want to be UFS,
2000: and Format it Apple UFS. Quit the Disk Utility, quit
2001: the installer which will reboot your machine. The new
2002: UFS file system will appear in Finder.</p>
2003:
2004: <p>Be aware that the permissions on the new file
2005: system will be writable by root only.</p>
2006:
2007: <p>This note is as of 10.2 (Jaguar) and applies to
2008: earlier versions. Hopefully Apple will fix Disk
2009: Utility in 10.3 (Panther).</p>
2010: </div>
2011: </div>
2012:
2013: <div class="sect2" lang="en" xml:lang="en">
2014: <div class="titlepage">
2015: <div>
2016: <div>
1.30 wiz 2017: <h3 class="title"><a name="freebsd" id=
2018: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 2019: </div>
2020: </div>
2021: </div>
2022:
2023: <p>FreeBSD 4.7 and 5.0 have been tested and are
2024: supported, other versions may work.</p>
2025:
2026: <p>Care should be taken so that the tools that this kit
2027: installs do not conflict with the FreeBSD userland
2028: tools. There are several steps:</p>
2029:
2030: <div class="orderedlist">
2031: <ol type="1">
2032: <li>
2033: <p>FreeBSD stores its ports pkg database in
1.45 ! wiz 2034: <code xmlns=
! 2035: "http://www.w3.org/TR/xhtml1/transitional" class=
! 2036: "filename">/var/db/pkg</code>. It is therefore
! 2037: recommended that you choose a different location
! 2038: (e.g. <code xmlns=
! 2039: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2040: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2041: --pkgdbdir option to the bootstrap script.</p>
2042: </li>
2043:
2044: <li>
2045: <p>If you do not intend to use the FreeBSD ports
2046: tools, it's probably a good idea to move them out
2047: of the way to avoid confusion, e.g.</p>
2048: <pre class="screen">
1.14 xtraeme 2049: <code class="prompt">#</code> <strong class=
2050: "userinput"><code>cd /usr/sbin</code></strong>
2051: <code class="prompt">#</code> <strong class=
2052: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2053: <code class="prompt">#</code> <strong class=
2054: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2055: <code class="prompt">#</code> <strong class=
2056: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2057: <code class="prompt">#</code> <strong class=
2058: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2059: </pre>
2060: </li>
2061:
2062: <li>
1.45 ! wiz 2063: <p>An example <code xmlns=
! 2064: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2065: "filename">/etc/mk.conf</code> file will be
1.45 ! wiz 2066: placed in <code xmlns=
! 2067: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2068: "filename">/etc/mk.conf.example</code> file when
2069: you use the bootstrap script.</p>
1.1 grant 2070: </li>
2071: </ol>
2072: </div>
2073: </div>
2074:
2075: <div class="sect2" lang="en" xml:lang="en">
2076: <div class="titlepage">
2077: <div>
2078: <div>
1.30 wiz 2079: <h3 class="title"><a name="interix" id=
2080: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2081: </div>
2082: </div>
2083: </div>
2084:
2085: <p>Interix is a POSIX compatible subsystem for the
2086: Windows NT kernel, providing a Unix-like environment
2087: with a tighter kernel integration than available with
2088: Cygwin. It is part of the Windows Services for Unix
2089: package, available for free for any licensed copy of
1.22 tv 2090: Windows 2000, XP (not including XP Home), or 2003. SFU
2091: can be downloaded from <a href=
2092: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2093: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2094:
2095: <p>Services for Unix 3.5, current as of this writing,
2096: has been tested. 3.0 or 3.1 may work, but are not
2097: officially supported. (The main difference in 3.0/3.1
2098: is lack of pthreads.)</p>
2099:
2100: <div class="sect3" lang="en" xml:lang="en">
2101: <div class="titlepage">
2102: <div>
2103: <div>
2104: <h4 class="title"><a name=
2105: "platform.interix-sfu-install" id=
2106: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2107: installing Interix/SFU</h4>
1.1 grant 2108: </div>
2109: </div>
2110: </div>
2111:
2112: <p>At an absolute minimum, the following packages
2113: must be installed from the Windows Services for Unix
2114: 3.5 distribution in order to use pkgsrc:</p>
2115:
2116: <div class="itemizedlist">
2117: <ul type="disc">
2118: <li>
2119: <p>Utilities -> Base Utilities</p>
2120: </li>
2121:
2122: <li>
2123: <p>Interix GNU Components -> (all)</p>
2124: </li>
2125:
2126: <li>
2127: <p>Remote Connectivity</p>
2128: </li>
2129:
2130: <li>
2131: <p>Interix SDK</p>
2132: </li>
2133: </ul>
2134: </div>
2135:
2136: <p>When using pkgsrc on Interix, DO NOT install the
2137: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2138: without shared module support, installed to
2139: /usr/local, and will only cause confusion. Instead,
2140: install Perl 5.8 from pkgsrc (or from a binary
2141: package).</p>
2142:
2143: <p>The Remote Connectivity subcomponent "Windows
2144: Remote Shell Service" does not need to be installed,
2145: but Remote Connectivity itself should be installed in
2146: order to have a working inetd.</p>
2147:
2148: <p>Finally, during installation you may be asked
2149: whether to enable setuid behavior for Interix
2150: programs, and whether to make pathnames default to
2151: case-sensitive. Setuid should be enabled, and
2152: case-sensitivity MUST be enabled. (Without
2153: case-sensitivity, a large number of packages
2154: including perl will not build.)</p>
2155: </div>
2156:
2157: <div class="sect3" lang="en" xml:lang="en">
2158: <div class="titlepage">
2159: <div>
2160: <div>
2161: <h4 class="title"><a name=
2162: "platform.interix-sfu-postinstall" id=
2163: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2164: to do if Interix/SFU is already installed</h4>
2165: </div>
2166: </div>
2167: </div>
2168:
2169: <p>If SFU is already installed and you wish to alter
2170: these settings to work with pkgsrc, note the
2171: following things.</p>
2172:
2173: <div class="itemizedlist">
2174: <ul type="disc">
2175: <li>
2176: <p>To uninstall UNIX Perl, use Add/Remove
2177: Programs, select Microsoft Windows Services for
2178: UNIX, then click Change. In the installer,
2179: choose Add or Remove, then uncheck
2180: Utilities->UNIX Perl.</p>
2181: </li>
2182:
2183: <li>
2184: <p>To enable case-sensitivity for the
2185: filesystem, run REGEDIT.EXE, and change the
2186: following registry key:</p>
2187:
2188: <p>
2189: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2190: Manager\kernel</p>
2191:
2192: <p>Set the DWORD value "obcaseinsensitive" to
2193: 0; then reboot.</p>
2194: </li>
2195:
2196: <li>
2197: <p>To enable setuid binaries (optional), run
2198: REGEDIT.EXE, and change the following registry
2199: key:</p>
2200:
2201: <p>
2202: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2203: for UNIX</p>
2204:
2205: <p>Set the DWORD value "EnableSetuidBinaries"
2206: to 1; then reboot.</p>
2207: </li>
2208: </ul>
2209: </div>
2210: </div>
2211:
2212: <div class="sect3" lang="en" xml:lang="en">
2213: <div class="titlepage">
2214: <div>
2215: <div>
2216: <h4 class="title"><a name=
2217: "platform.interix-notes" id=
2218: "platform.interix-notes"></a>3.2.3.3. Important
2219: notes for using pkgsrc</h4>
2220: </div>
2221: </div>
2222: </div>
2223:
2224: <p>The package imanager (either the pkgsrc "su" user,
2225: or the user running "pkg_add") must be a member of
2226: the local Administrators group. Such a user must also
2227: be used to run the bootstrap. This is slightly
2228: relaxed from the normal pkgsrc requirement of
2229: "root".</p>
2230:
2231: <p>The package manager should use a umask of 002.
2232: "make install" will automatically complain if this is
2233: not the case. This ensures that directories written
2234: in /var/db/pkg are Administrators-group
2235: writeable.</p>
2236:
2237: <p>The popular Interix binary packages from
2238: http://www.interopsystems.com/ use an older version
2239: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2240: used in conjunction with pkgsrc. If you choose to use
2241: them at the same time as the pkgsrc packages, ensure
2242: that you use the proper pkg_* tools for each type of
2243: binary package.</p>
1.22 tv 2244:
2245: <p>The TERM setting used for DOS-type console windows
2246: (including those invoked by the csh and ksh startup
2247: shortcuts) is "interix". Most systems don't have a
2248: termcap/terminfo entry for it, but the following
2249: .termcap entry provides adequate emulation in most
2250: cases:</p>
2251: <pre class="programlisting">
2252: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
2253: </pre>
1.1 grant 2254: </div>
2255: </div>
2256:
2257: <div class="sect2" lang="en" xml:lang="en">
2258: <div class="titlepage">
2259: <div>
2260: <div>
1.30 wiz 2261: <h3 class="title"><a name="irix" id=
2262: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2263: </div>
2264: </div>
2265: </div>
2266:
2267: <p>You will need a working C compiler, either gcc or
2268: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2269: the <code class="varname">CC</code> environment
2270: variable according to your preference. If you do not
2271: have a license for the MIPSpro compiler suite, you can
1.1 grant 2272: download a gcc tardist file from <a href=
2273: "http://freeware.sgi.com/" target=
2274: "_top">http://freeware.sgi.com/</a>.</p>
2275:
2276: <p>Please note that you will need IRIX 6.5.17 or
2277: higher, as this is the earliest version of IRIX
1.24 wiz 2278: providing support for <a href=
2279: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2280: <span class="citerefentry"><span class=
2281: "refentrytitle">if_indextoname</span>(3)</span></a>,
2282: <a href=
2283: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2284: <span class="citerefentry"><span class=
2285: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2286: etc.</p>
1.1 grant 2287:
1.27 rillig 2288: <p>At this point in time, pkgsrc only supports one ABI
2289: at a time. That is, you can not switch between the old
2290: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2291: you start out using "abi=n32", that's what all your
2292: packages will be built with.</p>
1.1 grant 2293:
2294: <p>Therefore, please make sure that you have no
1.14 xtraeme 2295: conflicting <code class="varname">CFLAGS</code> in your
1.45 ! wiz 2296: environment or the <code xmlns=
! 2297: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2298: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2299: that you do not try to link n32 object files with lib64
1.45 ! wiz 2300: or vice versa. Check your <code xmlns=
! 2301: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2302: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2303:
2304: <p>If you have the actual pkgsrc tree mounted via NFS
2305: from a different host, please make sure to set
1.14 xtraeme 2306: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2307: directory, as it appears that IRIX linker occasionally
2308: runs into issues when trying to link over a network
2309: mounted filesystem.</p>
2310:
2311: <p>The bootstrapping process should set all the right
2312: options for programs such as imake(1), but you may want
2313: to set some options depending on your local setup.
1.45 ! wiz 2314: Please see <code xmlns=
! 2315: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2316: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2317: course, your compiler's man pages for details.</p>
1.22 tv 2318:
2319: <p>If you are using SGI's MIPSPro compiler, please
2320: set</p>
2321: <pre class="programlisting">
2322: PKGSRC_COMPILER=mipspro
2323: </pre>
2324:
1.45 ! wiz 2325: <p>in <code xmlns=
! 2326: "http://www.w3.org/TR/xhtml1/transitional" class=
! 2327: "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
! 2328: assume you are using gcc and may end up passing invalid
! 2329: flags to the compiler. Note that bootstrap should
! 2330: create an appropriate <code xmlns=
! 2331: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2332: "filename">mk.conf.example</code> by default.</p>
2333:
2334: <p>If you have both the MIPSPro compiler chain
2335: installed as well as gcc, but want to make sure that
2336: MIPRPro is used, please set your <code class=
2337: "varname">PATH</code> to <span class=
2338: "emphasis"><em>not</em></span> include the location of
1.45 ! wiz 2339: gcc (often <code xmlns=
! 2340: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2341: "filename">/usr/freeware/bin</code>), and (important)
2342: pass the '--preserve-path' flag.</p>
1.1 grant 2343: </div>
2344:
2345: <div class="sect2" lang="en" xml:lang="en">
2346: <div class="titlepage">
2347: <div>
2348: <div>
1.30 wiz 2349: <h3 class="title"><a name="linux" id=
2350: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2351: </div>
2352: </div>
2353: </div>
2354:
2355: <p>Some versions of Linux (for example Debian
2356: GNU/Linux) need either libtermcap or libcurses
2357: (libncurses). Installing the distributions
2358: libncurses-dev package (or equivalent) should fix the
2359: problem.</p>
2360:
2361: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2362: and icc (Intel C++ Compiler). gcc is the default. icc
2363: 8.0 and 8.1 on i386 have been tested.</p>
2364:
2365: <p>To bootstrap using icc, assuming the default icc
2366: installation directory:</p>
2367: <pre class="programlisting">
2368: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2369: ac_cv___attribute__=yes ./bootstrap
2370: </pre>
2371:
2372: <div class="note" style=
2373: "margin-left: 0.5in; margin-right: 0.5in;">
2374: <h3 class="title">Note</h3>
2375:
2376: <p>icc 8.1 needs the `-i-static' argument instead of
2377: -static-libcxa.</p>
2378: </div>
2379:
2380: <p>icc supports __attribute__, but the GNU configure
2381: test uses a nested function, which icc does not
2382: support. #undef'ing __attribute__ has the unfortunate
2383: side-effect of breaking many of the Linux header files,
2384: which cannot be compiled properly without
2385: __attribute__. The test must be overridden so that
2386: __attribute__ is assumed supported by the compiler.</p>
2387:
2388: <p>After bootstrapping, you should set <code class=
1.45 ! wiz 2389: "varname">PKGSRC_COMPILER</code> in <code xmlns=
! 2390: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2391: "filename">/etc/mk.conf</code>:</p>
2392: <pre class="programlisting">
2393: PKGSRC_COMPILER=icc
2394: </pre>
2395:
2396: <p>The default installation directory for icc is
1.45 ! wiz 2397: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 2398: class="filename">/opt/intel_cc_80</code>, which is also
! 2399: the pkgsrc default. If you have installed it into a
! 2400: different directory, set <code class=
! 2401: "varname">ICCBASE</code> in <code xmlns=
! 2402: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2403: "filename">/etc/mk.conf</code>:</p>
2404: <pre class="programlisting">
2405: ICCBASE=/opt/icc
2406: </pre>
2407:
2408: <p>pkgsrc uses the static linking method of the runtime
2409: libraries provided by icc, so binaries can be run on
2410: other systems which do not have the shared libraries
2411: installed.</p>
2412:
2413: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2414: the <a href=
2415: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2416: <span class="citerefentry"><span class=
2417: "refentrytitle">ld</span>(1)</span></a> command run
2418: when linking a C++ shared library and records it,
2419: throwing away the -Bstatic and -Bdynamic options
2420: interspersed between the libraries. This means that
2421: libtool-linked C++ shared libraries will have a runtime
2422: dependency on the icc libraries until this is fixed in
2423: libtool.</p>
1.22 tv 2424: </div>
2425:
2426: <div class="sect2" lang="en" xml:lang="en">
2427: <div class="titlepage">
2428: <div>
2429: <div>
1.30 wiz 2430: <h3 class="title"><a name="openbsd" id=
2431: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2432: </div>
2433: </div>
2434: </div>
2435:
2436: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2437:
2438: <p>Care should be taken so that the tools that this kit
2439: installs do not conflict with the OpenBSD userland
2440: tools. There are several steps:</p>
2441:
2442: <div class="orderedlist">
2443: <ol type="1">
2444: <li>
2445: <p>OpenBSD stores its ports pkg database in
1.45 ! wiz 2446: <code xmlns=
! 2447: "http://www.w3.org/TR/xhtml1/transitional" class=
! 2448: "filename">/var/db/pkg</code>. It is therefore
! 2449: recommended that you choose a different location
! 2450: (e.g. <code xmlns=
! 2451: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2452: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2453: --pkgdbdir option to the bootstrap script.</p>
2454: </li>
2455:
2456: <li>
2457: <p>If you do not intend to use the OpenBSD ports
2458: tools, it's probably a good idea to move them out
2459: of the way to avoid confusion, e.g.</p>
2460: <pre class="screen">
1.14 xtraeme 2461: <code class="prompt">#</code> <strong class=
2462: "userinput"><code>cd /usr/sbin</code></strong>
2463: <code class="prompt">#</code> <strong class=
2464: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2465: <code class="prompt">#</code> <strong class=
2466: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2467: <code class="prompt">#</code> <strong class=
2468: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2469: <code class="prompt">#</code> <strong class=
2470: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2471: </pre>
2472: </li>
2473:
2474: <li>
1.45 ! wiz 2475: <p>An example <code xmlns=
! 2476: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2477: "filename">/etc/mk.conf</code> file will be
1.45 ! wiz 2478: placed in <code xmlns=
! 2479: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2480: "filename">/etc/mk.conf.example</code> file when
2481: you use the bootstrap script. OpenBSD's make
1.45 ! wiz 2482: program uses <code xmlns=
! 2483: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2484: "filename">/etc/mk.conf</code> as well. You can
1.1 grant 2485: work around this by enclosing all the pkgsrc
2486: specific parts of the file with:</p>
2487: <pre class="programlisting">
2488: .ifdef BSD_PKG_MK
1.11 ben 2489: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1 grant 2490: .else
2491: # OpenBSD stuff
2492: .endif
2493: </pre>
2494: </li>
2495: </ol>
2496: </div>
2497: </div>
2498:
2499: <div class="sect2" lang="en" xml:lang="en">
2500: <div class="titlepage">
2501: <div>
2502: <div>
1.30 wiz 2503: <h3 class="title"><a name="solaris" id=
2504: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2505: </div>
2506: </div>
2507: </div>
2508:
2509: <p>Solaris 2.6 through 9 are supported on both x86 and
2510: sparc. You will need a working C compiler. Both gcc
2511: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2512:
2513: <p>The following packages are required on Solaris 8 for
2514: the bootstrap process and to build packages.</p>
2515:
2516: <div class="itemizedlist">
2517: <ul type="disc">
2518: <li>
2519: <p>SUNWsprot</p>
2520: </li>
2521:
2522: <li>
2523: <p>SUNWarc</p>
2524: </li>
2525:
2526: <li>
2527: <p>SUNWbtool</p>
2528: </li>
2529:
2530: <li>
2531: <p>SUNWtoo</p>
2532: </li>
2533:
2534: <li>
2535: <p>SUNWlibm</p>
2536: </li>
2537: </ul>
2538: </div>
2539:
2540: <p>Please note the use of GNU binutils on Solaris is
2541: <span class="emphasis"><em>not</em></span>
2542: supported.</p>
2543:
2544: <div class="sect3" lang="en" xml:lang="en">
2545: <div class="titlepage">
2546: <div>
2547: <div>
1.30 wiz 2548: <h4 class="title"><a name="solaris-gcc-note"
2549: id="solaris-gcc-note"></a>3.2.7.1. If you
2550: are using gcc</h4>
1.1 grant 2551: </div>
2552: </div>
2553: </div>
2554:
2555: <p>It makes life much simpler if you only use the
2556: same gcc consistently for building all packages.</p>
2557:
2558: <p>It is recommended that an external gcc be used
2559: only for bootstrapping, then either build gcc from
2560: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2561: href=
2562: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45 ! wiz 2563: target="_top"><code xmlns="" class=
! 2564: "filename">lang/gcc</code></a> or install a binary
! 2565: gcc package, then remove gcc used during
1.20 ben 2566: bootstrapping.</p>
1.1 grant 2567:
2568: <p>Binary packages of gcc can be found through
2569: <a href=
2570: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2571: target=
2572: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2573: </div>
2574:
2575: <div class="sect3" lang="en" xml:lang="en">
2576: <div class="titlepage">
2577: <div>
2578: <div>
1.30 wiz 2579: <h4 class="title"><a name=
2580: "solaris-sun-workshop-note" id=
2581: "solaris-sun-workshop-note"></a>3.2.7.2. If
2582: you are using Sun WorkShop</h4>
1.1 grant 2583: </div>
2584: </div>
2585: </div>
2586:
2587: <p>You will need at least the following packages
2588: installed (from WorkShop 5.0)</p>
2589:
2590: <div class="itemizedlist">
2591: <ul type="disc">
2592: <li>
2593: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2594: </li>
2595:
2596: <li>
2597: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2598: </li>
2599:
2600: <li>
2601: <p>SPROild - Sun WorkShop Incremental
2602: Linker</p>
2603: </li>
2604:
2605: <li>
2606: <p>SPROlang - Sun WorkShop Compilers common
2607: components</p>
2608: </li>
2609: </ul>
2610: </div>
2611:
1.14 xtraeme 2612: <p>You should set <code class="varname">CC</code>,
2613: <code class="varname">CXX</code> and optionally,
1.45 ! wiz 2614: <code class="varname">CPP</code> in <code xmlns=
! 2615: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2616: "filename">/etc/mk.conf</code>, eg.</p>
1.1 grant 2617: <pre class="programlisting">
1.27 rillig 2618: CC= cc
1.1 grant 2619: CXX= CC
2620: CPP= /usr/ccs/lib/cpp
2621: </pre>
2622:
2623: <p>You may also want to build 64-bit binaries,
2624: eg.</p>
2625: <pre class="programlisting">
2626: CFLAGS= -xtarget=ultra -xarch=v9
2627: </pre>
2628:
2629: <p>Whichever compiler you use, please ensure the
2630: compiler tools and your $prefix are in your
1.14 xtraeme 2631: <code class="varname">PATH</code>. This includes
1.45 ! wiz 2632: <code xmlns=
! 2633: "http://www.w3.org/TR/xhtml1/transitional" class=
! 2634: "filename">/usr/ccs/{bin,lib}</code> and eg.
! 2635: <code xmlns=
! 2636: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2637: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2638: </div>
2639: </div>
2640: </div>
2641: </div>
2642:
2643: <div class="chapter" lang="en" xml:lang="en">
2644: <div class="titlepage">
2645: <div>
2646: <div>
2647: <h2 class="title"><a name="using" id=
2648: "using"></a>Chapter 4. Using pkgsrc</h2>
2649: </div>
2650: </div>
2651: </div>
2652:
2653: <div class="toc">
2654: <p><b>Table of Contents</b></p>
2655:
2656: <dl>
2657: <dt><span class="sect1"><a href="#getting-started">4.1.
2658: Working with binary packages</a></span></dt>
2659:
2660: <dd>
2661: <dl>
1.30 wiz 2662: <dt><span class="sect2"><a href=
2663: "#where-to-get-binary-packages">4.1.1. Where to get
2664: binary packages</a></span></dt>
1.1 grant 2665:
1.30 wiz 2666: <dt><span class="sect2"><a href=
2667: "#how-to-use-binary-packages">4.1.2. How to use
2668: binary packages</a></span></dt>
1.1 grant 2669:
1.30 wiz 2670: <dt><span class="sect2"><a href=
2671: "#a-word-of-warning">4.1.3. A word of
2672: warning</a></span></dt>
1.1 grant 2673: </dl>
2674: </dd>
2675:
1.30 wiz 2676: <dt><span class="sect1"><a href=
2677: "#building-packages-from-source">4.2. Building packages
2678: from source</a></span></dt>
1.1 grant 2679:
2680: <dd>
2681: <dl>
1.30 wiz 2682: <dt><span class="sect2"><a href=
2683: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 2684:
1.30 wiz 2685: <dt><span class="sect2"><a href=
2686: "#fetching-distfiles">4.2.2. Fetching
2687: distfiles</a></span></dt>
1.1 grant 2688:
1.30 wiz 2689: <dt><span class="sect2"><a href=
2690: "#how-to-build-and-install">4.2.3. How to build and
2691: install</a></span></dt>
1.1 grant 2692:
1.30 wiz 2693: <dt><span class="sect2"><a href=
2694: "#selecting-the-compiler">4.2.4. Selecting the
2695: compiler</a></span></dt>
1.1 grant 2696: </dl>
2697: </dd>
2698: </dl>
2699: </div>
2700:
2701: <div class="sect1" lang="en" xml:lang="en">
2702: <div class="titlepage">
2703: <div>
2704: <div>
2705: <h2 class="title" style="clear: both"><a name=
2706: "getting-started" id=
2707: "getting-started"></a>4.1. Working with binary
2708: packages</h2>
2709: </div>
2710: </div>
2711: </div>
2712:
2713: <p>This section describes how to find, retrieve and
2714: install a precompiled binary package that someone else
2715: already prepared for your type of machine.</p>
2716:
2717: <div class="sect2" lang="en" xml:lang="en">
2718: <div class="titlepage">
2719: <div>
2720: <div>
1.30 wiz 2721: <h3 class="title"><a name=
2722: "where-to-get-binary-packages" id=
2723: "where-to-get-binary-packages"></a>4.1.1. Where
2724: to get binary packages</h3>
1.1 grant 2725: </div>
2726: </div>
2727: </div>
2728:
2729: <p>Precompiled packages are stored on ftp.NetBSD.org
1.45 ! wiz 2730: and its mirrors in the directory <code xmlns=
! 2731: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2732: "filename">/pub/NetBSD/packages/<OSVERSION>/<ARCH>/</code>
2733: for anonymous FTP access. <code class=
2734: "varname">OSVERSION</code> is the NetBSD version
2735: (<span><strong class="command">uname
2736: -r</strong></span>), <code class="varname">ARCH</code>
2737: is the architecture (<span><strong class=
2738: "command">uname -p</strong></span>). In that directory,
2739: there is a subdirectory for each category plus a
1.45 ! wiz 2740: subdirectory <code xmlns=
! 2741: "http://www.w3.org/TR/xhtml1/transitional" class=
! 2742: "filename">All</code> which includes the actual
! 2743: binaries in <code xmlns=
! 2744: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2745: "filename">.tgz</code> files. The category
2746: subdirectories use symbolic links to those files (this
1.45 ! wiz 2747: is the same directory layout as in <code xmlns=
! 2748: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2749: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2750:
2751: <p>This same directory layout applies for CDROM
2752: distributions, only that the directory may be rooted
1.45 ! wiz 2753: somewhere else, probably somewhere below <code xmlns=
! 2754: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2755: "filename">/cdrom</code>. Please consult your CDROMs
1.1 grant 2756: documentation for the exact location.</p>
2757: </div>
2758:
2759: <div class="sect2" lang="en" xml:lang="en">
2760: <div class="titlepage">
2761: <div>
2762: <div>
1.30 wiz 2763: <h3 class="title"><a name=
2764: "how-to-use-binary-packages" id=
2765: "how-to-use-binary-packages"></a>4.1.2. How
2766: to use binary packages</h3>
1.1 grant 2767: </div>
2768: </div>
2769: </div>
2770:
2771: <p>If you have the files on a CDROM or downloaded them
1.23 wiz 2772: to your hard disk, you can install them with the
1.27 rillig 2773: following command (be sure to <span><strong class=
1.14 xtraeme 2774: "command">su</strong></span> to root first):</p>
1.1 grant 2775: <pre class="screen">
1.14 xtraeme 2776: <code class="prompt">#</code> <strong class=
2777: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 2778: </pre>
2779:
2780: <p>If you have FTP access and you don't want to
2781: download the packages via FTP prior to installation,
1.14 xtraeme 2782: you can do this automatically by giving
2783: <span><strong class="command">pkg_add</strong></span>
2784: an FTP URL:</p>
1.1 grant 2785: <pre class="screen">
1.14 xtraeme 2786: <code class="prompt">#</code> <strong class=
1.27 rillig 2787: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 2788: </pre>
2789:
1.27 rillig 2790: <p>Note that any prerequisite packages needed to run
2791: the package in question will be installed, too,
1.1 grant 2792: assuming they are present where you install from.</p>
2793:
1.23 wiz 2794: <p>To save some typing, you can set the <code class=
2795: "varname">PKG_PATH</code> environment variable to a
2796: semicolon separated list of paths (including remote
2797: URLs); trailing slashes are not allowed.</p>
2798:
1.45 ! wiz 2799: <p>Additionally to the <code xmlns=
! 2800: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 2801: "filename">All</code> directory there exists a
1.45 ! wiz 2802: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 2803: class="filename">vulnerable</code> directory to which
! 2804: binary packages with known vulnerabilities are moved,
! 2805: since removing them could cause missing dependencies.
! 2806: To use these packages, add the <code xmlns=
! 2807: "http://www.w3.org/TR/xhtml1/transitional" class=
! 2808: "filename">vulnerable</code> directory to your
! 2809: <code class="varname">PKG_PATH</code>. However, you
! 2810: should run <a xmlns=
1.23 wiz 2811: "http://www.w3.org/TR/xhtml1/transitional" href=
2812: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 ! wiz 2813: target="_top"><code xmlns="" class=
! 2814: "filename">security/audit-packages</code></a>
! 2815: regularly, and especially after installing new
! 2816: packages, and verify that the vulnerabilities are
! 2817: acceptable for your configuration. An example
! 2818: <code class="varname">PKG_PATH</code> would be:
! 2819: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 2820: class=
1.27 rillig 2821: "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 2822: Please note that semicolon (';') is a shell
2823: meta-character, so you'll probably have to quote
2824: it.</p>
2825:
1.1 grant 2826: <p>After you've installed packages, be sure to have
1.45 ! wiz 2827: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 2828: class="filename">/usr/pkg/bin</code> and <code xmlns=
! 2829: "http://www.w3.org/TR/xhtml1/transitional" class=
! 2830: "filename">/usr/pkg/sbin</code> in your <code class=
! 2831: "varname">PATH</code> so you can actually start the
! 2832: just installed program.</p>
1.1 grant 2833: </div>
2834:
2835: <div class="sect2" lang="en" xml:lang="en">
2836: <div class="titlepage">
2837: <div>
2838: <div>
1.30 wiz 2839: <h3 class="title"><a name="a-word-of-warning" id=
2840: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 2841: warning</h3>
2842: </div>
2843: </div>
2844: </div>
2845:
2846: <p>Please pay very careful attention to the warnings
2847: expressed in the <a href=
2848: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2849: <span class="citerefentry"><span class=
2850: "refentrytitle">pkg_add</span>(1)</span></a> manual
2851: page about the inherent dangers of installing binary
2852: packages which you did not create yourself, and the
2853: security holes that can be introduced onto your system
2854: by indiscriminate adding of such files.</p>
2855: </div>
2856: </div>
2857:
2858: <div class="sect1" lang="en" xml:lang="en">
2859: <div class="titlepage">
2860: <div>
2861: <div>
2862: <h2 class="title" style="clear: both"><a name=
1.30 wiz 2863: "building-packages-from-source" id=
2864: "building-packages-from-source"></a>4.2. Building
1.1 grant 2865: packages from source</h2>
2866: </div>
2867: </div>
2868: </div>
2869:
2870: <p>This assumes that the package is already in pkgsrc. If
2871: it is not, see <a href="#developers-guide" title=
1.45 ! wiz 2872: "Part 2. The pkgsrc developer's guide">Part 2,
1.27 rillig 2873: “The pkgsrc developer's guide”</a> for
2874: instructions how to create your own packages.</p>
1.1 grant 2875:
2876: <div class="sect2" lang="en" xml:lang="en">
2877: <div class="titlepage">
2878: <div>
2879: <div>
1.30 wiz 2880: <h3 class="title"><a name="requirements" id=
2881: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 2882: </div>
2883: </div>
2884: </div>
2885:
2886: <p>To build packages from source on a NetBSD system the
2887: “<span class="quote">comp</span>” and the
2888: “<span class="quote">text</span>”
2889: distribution sets must be installed. If you want to
2890: build X11 related packages the “<span class=
2891: "quote">xbase</span>” and “<span class=
2892: "quote">xcomp</span>” distribution sets are
2893: required, too.</p>
2894: </div>
2895:
2896: <div class="sect2" lang="en" xml:lang="en">
2897: <div class="titlepage">
2898: <div>
2899: <div>
1.30 wiz 2900: <h3 class="title"><a name="fetching-distfiles"
2901: id="fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 2902: distfiles</h3>
2903: </div>
2904: </div>
2905: </div>
2906:
1.27 rillig 2907: <p>The first step for building a package is downloading
2908: the distfiles (i.e. the unmodified source). If they
2909: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 2910: automatically.</p>
2911:
2912: <p>You can overwrite some of the major distribution
2913: sites to fit to sites that are close to your own. Have
1.45 ! wiz 2914: a look at <code xmlns=
! 2915: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2916: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 2917: some examples — in particular, look for the
1.14 xtraeme 2918: <code class="varname">MASTER_SORT</code>, <code class=
2919: "varname">MASTER_SORT_REGEX</code> and <code class=
2920: "varname">INET_COUNTRY</code> definitions. This may
2921: save some of your bandwidth and time.</p>
1.1 grant 2922:
2923: <p>You can change these settings either in your shell's
2924: environment, or, if you want to keep the settings, by
1.45 ! wiz 2925: editing the <code xmlns=
! 2926: "http://www.w3.org/TR/xhtml1/transitional" class=
! 2927: "filename">/etc/mk.conf</code> file, and adding the
! 2928: definitions there.</p>
1.1 grant 2929:
2930: <p>If you don't have a permanent Internet connection
2931: and you want to know which files to download,
1.14 xtraeme 2932: <span><strong class="command">make
2933: fetch-list</strong></span> will tell you what you'll
1.45 ! wiz 2934: need. Put these distfiles into <code xmlns=
! 2935: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2936: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 2937: </div>
2938:
2939: <div class="sect2" lang="en" xml:lang="en">
2940: <div class="titlepage">
2941: <div>
2942: <div>
1.30 wiz 2943: <h3 class="title"><a name=
2944: "how-to-build-and-install" id=
2945: "how-to-build-and-install"></a>4.2.3. How to
2946: build and install</h3>
1.1 grant 2947: </div>
2948: </div>
2949: </div>
2950:
2951: <p>Assuming that the distfile has been fetched (see
2952: previous section), become root and change into the
1.14 xtraeme 2953: relevant directory and running <span><strong class=
2954: "command">make</strong></span>. For example, type</p>
1.1 grant 2955: <pre class="screen">
1.14 xtraeme 2956: <code class="prompt">%</code> <strong class=
2957: "userinput"><code>cd misc/figlet</code></strong>
2958: <code class="prompt">%</code> <strong class=
2959: "userinput"><code>make</code></strong>
1.1 grant 2960: </pre>
2961:
2962: <p>at the shell prompt to build the various components
2963: of the package, and</p>
2964: <pre class="screen">
1.14 xtraeme 2965: <code class="prompt">#</code> <strong class=
2966: "userinput"><code>make install</code></strong>
1.1 grant 2967: </pre>
2968:
2969: <p>to install the various components into the correct
2970: places on your system. Installing the package on your
2971: system requires you to be root. However, pkgsrc has a
2972: <span class="emphasis"><em>just-in-time-su</em></span>
2973: feature, which allows you to only become root for the
2974: actual installation step</p>
2975:
2976: <p>Taking the figlet utility as an example, we can
2977: install it on our system by building as shown in
2978: <a href="#logs" title=
1.45 ! wiz 2979: "Appendix 2. Build logs">Appendix 2, <i>Build
1.1 grant 2980: logs</i></a>.</p>
2981:
2982: <p>The program is installed under the default root of
1.45 ! wiz 2983: the packages tree - <code xmlns=
! 2984: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2985: "filename">/usr/pkg</code>. Should this not conform to
2986: your tastes, set the <code class=
2987: "varname">LOCALBASE</code> variable in your
1.1 grant 2988: environment, and it will use that value as the root of
1.45 ! wiz 2989: your packages tree. So, to use <code xmlns=
! 2990: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2991: "filename">/usr/local</code>, set <code class=
2992: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 2993: environment. Please note that you should use a
2994: directory which is dedicated to packages and not shared
1.14 xtraeme 2995: with other programs (ie, do not try and use
2996: <code class="varname">LOCALBASE=/usr</code>). Also, you
2997: should not try to add any of your own files or
1.45 ! wiz 2998: directories (such as <code xmlns=
! 2999: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3000: "filename">src/</code>, <code xmlns=
! 3001: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3002: "filename">obj/</code>, or <code xmlns=
! 3003: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3004: "filename">pkgsrc/</code>) below the <code class=
3005: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 3006: possible conflicts between programs and other files
3007: installed by the package system and whatever else may
3008: have been installed there.</p>
3009:
1.45 ! wiz 3010: <p>Some packages look in <code xmlns=
! 3011: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3012: "filename">/etc/mk.conf</code> to alter some
1.1 grant 3013: configuration options at build time. Have a look at
1.45 ! wiz 3014: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 3015: class="filename">pkgsrc/mk/defaults/mk.conf</code> to
! 3016: get an overview of what will be set there by default.
1.14 xtraeme 3017: Environment variables such as <code class=
1.45 ! wiz 3018: "varname">LOCALBASE</code> can be set in <code xmlns=
! 3019: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3020: "filename">/etc/mk.conf</code> to save having to
3021: remember to set them each time you want to use
3022: pkgsrc.</p>
1.1 grant 3023:
3024: <p>Occasionally, people want to “<span class=
3025: "quote">look under the covers</span>” to see what
3026: is going on when a package is building or being
3027: installed. This may be for debugging purposes, or out
3028: of simple curiosity. A number of utility values have
3029: been added to help with this.</p>
3030:
3031: <div class="orderedlist">
3032: <ol type="1">
3033: <li>
3034: <p>If you invoke the <a href=
3035: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3036: <span class="citerefentry"><span class=
3037: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 3038: with <code class=
3039: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
3040: amount of information will be displayed. For
3041: example,</p>
1.1 grant 3042: <pre class="screen">
1.14 xtraeme 3043: <strong class=
3044: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 3045: </pre>
3046:
3047: <p>will show all the commands that are invoked,
3048: up to and including the “<span class=
3049: "quote">patch</span>” stage.</p>
3050: </li>
3051:
3052: <li>
3053: <p>If you want to know the value of a certain
1.22 tv 3054: <a href=
3055: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3056: <span class="citerefentry"><span class=
3057: "refentrytitle">make</span>(1)</span></a>
3058: definition, then the <code class=
1.14 xtraeme 3059: "varname">VARNAME</code> definition should be
3060: used, in conjunction with the show-var target.
3061: e.g. to show the expansion of the <a href=
1.1 grant 3062: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3063: <span class="citerefentry"><span class=
3064: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 3065: variable <code class=
1.22 tv 3066: "varname">LOCALBASE</code>:</p>
1.1 grant 3067: <pre class="screen">
1.14 xtraeme 3068: <code class="prompt">%</code> <strong class=
3069: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 3070: /usr/pkg
1.14 xtraeme 3071: <code class="prompt">%</code>
1.1 grant 3072:
3073: </pre>
3074: </li>
3075: </ol>
3076: </div>
3077:
3078: <p>If you want to install a binary package that you've
3079: either created yourself (see next section), that you
3080: put into pkgsrc/packages manually or that is located on
1.8 wiz 3081: a remote FTP server, you can use the "bin-install"
1.1 grant 3082: target. This target will install a binary package - if
3083: available - via <a href=
3084: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3085: <span class="citerefentry"><span class=
3086: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 3087: <span><strong class="command">make
3088: package</strong></span>. The list of remote FTP sites
3089: searched is kept in the variable <code class=
3090: "varname">BINPKG_SITES</code>, which defaults to
3091: ftp.NetBSD.org. Any flags that should be added to
3092: <a href=
1.1 grant 3093: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3094: <span class="citerefentry"><span class=
3095: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 3096: into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45 ! wiz 3097: See <code xmlns=
! 3098: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3099: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
3100: details.</p>
1.1 grant 3101:
3102: <p>A final word of warning: If you setup a system that
1.14 xtraeme 3103: has a non-standard setting for <code class=
3104: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 3105: any packages are installed, as you can not use several
3106: directories for the same purpose. Doing so will result
3107: in pkgsrc not being able to properly detect your
3108: installed packages, and fail miserably. Note also that
3109: precompiled binary packages are usually built with the
1.14 xtraeme 3110: default <code class="varname">LOCALBASE</code> of
1.45 ! wiz 3111: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 3112: class="filename">/usr/pkg</code>, and that you should
! 3113: <span class="emphasis"><em>not</em></span> install any
! 3114: if you use a non-standard <code class=
1.14 xtraeme 3115: "varname">LOCALBASE</code>.</p>
1.1 grant 3116: </div>
3117:
3118: <div class="sect2" lang="en" xml:lang="en">
3119: <div class="titlepage">
3120: <div>
3121: <div>
1.30 wiz 3122: <h3 class="title"><a name=
3123: "selecting-the-compiler" id=
3124: "selecting-the-compiler"></a>4.2.4. Selecting
3125: the compiler</h3>
1.1 grant 3126: </div>
3127: </div>
3128: </div>
3129:
3130: <p>By default, pkgsrc will use GCC to build packages.
3131: This may be overridden by setting the following
3132: variables in /etc/mk.conf:</p>
3133:
3134: <div class="variablelist">
3135: <dl>
1.14 xtraeme 3136: <dt><span class="term"><code class=
3137: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3138:
3139: <dd>
3140: <p>This is a list of values specifying the chain
3141: of compilers to invoke when building packages.
3142: Valid values are:</p>
3143:
3144: <div class="itemizedlist">
3145: <ul type="disc">
3146: <li>
1.14 xtraeme 3147: <p><code class="varname">distcc</code>:
1.1 grant 3148: distributed C/C++ (chainable)</p>
3149: </li>
3150:
3151: <li>
1.14 xtraeme 3152: <p><code class="varname">ccache</code>:
1.1 grant 3153: compiler cache (chainable)</p>
3154: </li>
3155:
3156: <li>
1.14 xtraeme 3157: <p><code class="varname">gcc</code>: GNU
3158: C/C++ Compiler</p>
1.1 grant 3159: </li>
3160:
3161: <li>
1.14 xtraeme 3162: <p><code class="varname">mipspro</code>:
1.1 grant 3163: Silicon Graphics, Inc. MIPSpro
3164: (n32/n64)</p>
3165: </li>
3166:
3167: <li>
1.14 xtraeme 3168: <p><code class="varname">mipspro</code>:
1.1 grant 3169: Silicon Graphics, Inc. MIPSpro (o32)</p>
3170: </li>
3171:
3172: <li>
1.14 xtraeme 3173: <p><code class="varname">sunpro</code>:
1.1 grant 3174: Microsystems, Inc. WorkShip/Forte/Sun ONE
3175: Studio</p>
3176: </li>
3177: </ul>
3178: </div>
3179:
3180: <p>The default is “<span class=
1.14 xtraeme 3181: "quote"><code class=
3182: "varname">gcc</code></span>”. You can use
3183: <code class="varname">ccache</code> and/or
3184: <code class="varname">distcc</code> with an
3185: appropriate <code class=
3186: "varname">PKGSRC_COMPILER</code> setting, e.g.
3187: “<span class="quote"><code class=
3188: "varname">ccache gcc</code></span>”. This
1.1 grant 3189: variable should always be terminated with a value
3190: for a real compiler.</p>
3191: </dd>
3192:
1.14 xtraeme 3193: <dt><span class="term"><code class=
3194: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3195:
3196: <dd>
3197: <p>This specifies the minimum version of GCC to
3198: use when building packages. If the system GCC
3199: doesn't satisfy this requirement, then pkgsrc
3200: will build and install one of the GCC packages to
3201: use instead.</p>
3202: </dd>
3203: </dl>
3204: </div>
3205: </div>
3206: </div>
3207: </div>
3208:
3209: <div class="chapter" lang="en" xml:lang="en">
3210: <div class="titlepage">
3211: <div>
3212: <div>
1.38 dillo 3213: <h2 class="title"><a name="configuring" id=
3214: "configuring"></a>Chapter 5. Configuring
3215: pkgsrc</h2>
3216: </div>
3217: </div>
3218: </div>
3219:
3220: <div class="toc">
3221: <p><b>Table of Contents</b></p>
3222:
3223: <dl>
3224: <dt><span class="sect1"><a href=
1.45 ! wiz 3225: "#general-configuration">5.1. General
! 3226: configuration</a></span></dt>
! 3227:
! 3228: <dt><span class="sect1"><a href=
! 3229: "#variables-affecting-build">5.2. Variables affecting
! 3230: the build process</a></span></dt>
! 3231:
! 3232: <dt><span class="sect1"><a href=
! 3233: "#developer-advanced-settings">5.3. Developer/advanced
! 3234: settings</a></span></dt>
! 3235:
! 3236: <dt><span class="sect1"><a href=
! 3237: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 3238: Options</a></span></dt>
1.38 dillo 3239: </dl>
3240: </div>
3241:
3242: <div class="sect1" lang="en" xml:lang="en">
3243: <div class="titlepage">
3244: <div>
3245: <div>
3246: <h2 class="title" style="clear: both"><a name=
1.45 ! wiz 3247: "general-configuration" id=
! 3248: "general-configuration"></a>5.1. General
! 3249: configuration</h2>
! 3250: </div>
! 3251: </div>
! 3252: </div>
! 3253:
! 3254: <p>In this section you can find some variables that apply
! 3255: all pkgsrc packages. The preferred method of setting them
! 3256: is by setting them in <code xmlns=
! 3257: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3258: "filename">/etc/mk.conf</code>.</p>
! 3259:
! 3260: <div class="itemizedlist">
! 3261: <ul type="disc">
! 3262: <li>
! 3263: <p><code class="varname">LOCALBASE</code>: Where
! 3264: packages will be installed. The default is
! 3265: <code xmlns=
! 3266: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3267: "filename">/usr/pkg</code>. Do not mix binary
! 3268: packages with different <code class=
! 3269: "varname">LOCALBASE</code>s!</p>
! 3270: </li>
! 3271:
! 3272: <li>
! 3273: <p><code class="varname">CROSSBASE</code>: Where
! 3274: “<span class="quote">cross</span>”
! 3275: category packages will be installed. The default is
! 3276: <code xmlns=
! 3277: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3278: "filename">${LOCALBASE}/cross</code>.</p>
! 3279: </li>
! 3280:
! 3281: <li>
! 3282: <p><code class="varname">X11BASE</code>: Where X11
! 3283: is installed on the system. The default is
! 3284: <code xmlns=
! 3285: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3286: "filename">/usr/X11R6</code>.</p>
! 3287: </li>
! 3288:
! 3289: <li>
! 3290: <p><code class="varname">DISTDIR</code>: Where to
! 3291: store the downloaded copies of the original source
! 3292: distributions used for building pkgsrc packages.
! 3293: The default is <code xmlns=
! 3294: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3295: "filename">${PKGSRCDIR}/distfiles</code>.</p>
! 3296: </li>
! 3297:
! 3298: <li>
! 3299: <p><code class=
! 3300: "varname">MASTER_SITE_OVERRIDE</code>: If set,
! 3301: override the packages' <code class=
! 3302: "varname">MASTER_SITES</code> with this value.</p>
! 3303: </li>
! 3304:
! 3305: <li>
! 3306: <p><code class="varname">MASTER_SITE_BACKUP</code>:
! 3307: Backup location(s) for distribution files and patch
! 3308: files if not found locally or in <code xmlns=
! 3309: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3310: "filename">${MASTER_SITES}</code> or <code xmlns=
! 3311: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3312: "filename">${PATCH_SITES}</code> respectively. The
! 3313: defaults are <code xmlns=
! 3314: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3315: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
! 3316: and <code xmlns=
! 3317: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3318: "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
! 3319: </li>
! 3320:
! 3321: <li>
! 3322: <p><code class="varname">BINPKG_SITES</code>: List
! 3323: of sites carrying binary pkgs.</p>
! 3324: </li>
! 3325: </ul>
! 3326: </div>
! 3327: </div>
! 3328:
! 3329: <div class="sect1" lang="en" xml:lang="en">
! 3330: <div class="titlepage">
! 3331: <div>
! 3332: <div>
! 3333: <h2 class="title" style="clear: both"><a name=
! 3334: "variables-affecting-build" id=
! 3335: "variables-affecting-build"></a>5.2. Variables
! 3336: affecting the build process</h2>
! 3337: </div>
! 3338: </div>
! 3339: </div>
! 3340:
! 3341: <p>XXX</p>
! 3342:
! 3343: <div class="itemizedlist">
! 3344: <ul type="disc">
! 3345: <li>
! 3346: <p><code class="varname">PACKAGES</code>: The top
! 3347: level directory for the binary packages. The
! 3348: default is <code xmlns=
! 3349: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3350: "filename">${PKGSRCDIR}/packages</code>.</p>
! 3351: </li>
! 3352:
! 3353: <li>
! 3354: <p><code class="varname">WRKOBJDIR</code>: The top
! 3355: level directory where, if defined, the separate
! 3356: working directories will get created, and
! 3357: symbolically linked to from <code xmlns=
! 3358: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3359: "filename">${WRKDIR}</code> (see below). This is
! 3360: useful for building packages on several
! 3361: architectures, then <code xmlns=
! 3362: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3363: "filename">${PKGSRCDIR}</code> can be NFS-mounted
! 3364: while <code xmlns=
! 3365: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3366: "filename">${WRKOBJDIR}</code> is local to every
! 3367: architecture. (It should be noted that <code class=
! 3368: "varname">PKGSRCDIR</code> should not be set by the
! 3369: user — it is an internal definition which
! 3370: refers to the root of the pkgsrc tree. It is
! 3371: possible to have many pkgsrc tree instances.)</p>
! 3372: </li>
! 3373:
! 3374: <li>
! 3375: <p><code class="varname">LOCALPATCHES</code>:
! 3376: Directory for local patches that aren't part of
! 3377: pkgsrc. See <a href="#components.patches" title=
! 3378: "8.3. patches/*">Section 8.3,
! 3379: “patches/*”</a> for more information.
! 3380: <em class="replaceable"><code>rel</code></em> and
! 3381: <em class="replaceable"><code>arch</code></em> are
! 3382: replaced with OS release (“<span class=
! 3383: "quote">2.0</span>”, etc.) and architecture
! 3384: (“<span class="quote">mipsel</span>”,
! 3385: etc.).</p>
! 3386: </li>
! 3387:
! 3388: <li>
! 3389: <p><code class="varname">PKGMAKECONF</code>:
! 3390: Location of the <code xmlns=
! 3391: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3392: "filename">mk.conf</code> file used by a package's
! 3393: BSD-style Makefile. If this is not set,
! 3394: <code class="varname">MAKECONF</code> is set to
! 3395: <code xmlns=
! 3396: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3397: "filename">/dev/null</code> to avoid picking up
! 3398: settings used by builds in <code xmlns=
! 3399: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3400: "filename">/usr/src</code>.</p>
! 3401: </li>
! 3402: </ul>
! 3403: </div>
! 3404: </div>
! 3405:
! 3406: <div class="sect1" lang="en" xml:lang="en">
! 3407: <div class="titlepage">
! 3408: <div>
! 3409: <div>
! 3410: <h2 class="title" style="clear: both"><a name=
! 3411: "developer-advanced-settings" id=
! 3412: "developer-advanced-settings"></a>5.3. Developer/advanced
! 3413: settings</h2>
! 3414: </div>
! 3415: </div>
! 3416: </div>
! 3417:
! 3418: <p>XXX</p>
! 3419:
! 3420: <div class="itemizedlist">
! 3421: <ul type="disc">
! 3422: <li>
! 3423: <p><code class="varname">PKG_DEVELOPER</code>: Run
! 3424: some sanity checks that package developers
! 3425: want:</p>
! 3426:
! 3427: <div class="itemizedlist">
! 3428: <ul type="circle">
! 3429: <li>
! 3430: <p>make sure patches apply with zero fuzz</p>
! 3431: </li>
! 3432:
! 3433: <li>
! 3434: <p>run check-shlibs to see that all binaries
! 3435: will find their shared libs.</p>
! 3436: </li>
! 3437: </ul>
! 3438: </div>
! 3439: </li>
! 3440:
! 3441: <li>
! 3442: <p><code class="varname">PKG_DEBUG_LEVEL</code>:
! 3443: The level of debugging output which is displayed
! 3444: whilst making and installing the package. The
! 3445: default value for this is 0, which will not display
! 3446: the commands as they are executed (normal, default,
! 3447: quiet operation); the value 1 will display all
! 3448: shell commands before their invocation, and the
! 3449: value 2 will display both the shell commands before
! 3450: their invocation, and their actual execution
! 3451: progress with <span><strong class="command">set
! 3452: -x</strong></span> will be displayed.</p>
! 3453: </li>
! 3454: </ul>
! 3455: </div>
! 3456: </div>
! 3457:
! 3458: <div class="sect1" lang="en" xml:lang="en">
! 3459: <div class="titlepage">
! 3460: <div>
! 3461: <div>
! 3462: <h2 class="title" style="clear: both"><a name=
! 3463: "selecting-build-options" id=
! 3464: "selecting-build-options"></a>5.4. Selecting
! 3465: Build Options</h2>
1.38 dillo 3466: </div>
3467: </div>
3468: </div>
3469:
3470: <p>Some packages have build time options, usually to
3471: select between different dependencies, enable optional
3472: support for big dependencies or enable experimental
3473: features.</p>
3474:
3475: <p>To see which options, if any, a package supports, and
3476: which options are mutually exclusive, run
3477: <span><strong class="command">make
3478: show-options</strong></span>, for example:</p>
3479: <pre class="programlisting">
1.44 gdt 3480: The following options are supported by this package:
3481: ssl Enable SSL support.
3482: Exactly one of the following gecko options is required:
3483: firefox Use firefox as gecko rendering engine.
3484: mozilla Use mozilla as gecko rendering engine.
3485: At most one of the following database options may be selected:
3486: mysql Enable support for MySQL database.
3487: pgsql Enable support for PostgreSQL database.
1.38 dillo 3488:
1.44 gdt 3489: These options are enabled by default: firefox
3490: These options are currently enabled: mozilla ssl
3491:
1.38 dillo 3492: </pre>
3493:
1.45 ! wiz 3494: <p>The following variables can be defined in <code xmlns=
! 3495: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3496: "filename">/etc/mk.conf</code> to select which options to
3497: enable for a package: <code class=
3498: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
3499: to select or disable options for all packages that
3500: support them, and <code class=
3501: "varname">PKG_OPTIONS.<em class=
3502: "replaceable"><code>pkgbase</code></em></code>, which can
3503: be used to select or disable options specifically for
3504: package <em class=
3505: "replaceable"><code>pkgbase</code></em>. Options listed
3506: in these variables are selected, options preceded by
3507: “<span class="quote">-</span>” are
3508: disabled.</p>
3509:
1.39 dillo 3510: <p>The following settings are consulted in the order
3511: given, and the last setting that selects or disables an
3512: option is used:</p>
1.38 dillo 3513:
3514: <div class="orderedlist">
3515: <ol type="1">
3516: <li>
3517: <p>the default options as suggested by the package
3518: maintainer</p>
3519: </li>
3520:
3521: <li>
3522: <p>the options implied by the settings of legacy
3523: variables (see below)</p>
3524: </li>
3525:
3526: <li>
3527: <p><code class=
3528: "varname">PKG_DEFAULT_OPTIONS</code></p>
3529: </li>
3530:
3531: <li>
3532: <p><code class="varname">PKG_OPTIONS.<em class=
3533: "replaceable"><code>pkgbase</code></em></code></p>
3534: </li>
3535: </ol>
3536: </div>
3537:
3538: <p>For groups of mutually exclusive options, the last
3539: option selected is used, all others are automatically
3540: disabled. If an option of the group is explicitly
3541: disabled, the previously selected option, if any, is
3542: used. It is an error if no option from a required group
3543: of options is selected, and building the package will
3544: fail.</p>
3545:
3546: <p>Before the options framework was introduced, build
3547: options were selected by setting a variable in
1.45 ! wiz 3548: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 3549: class="filename">/etc/mk.conf</code> for each option. To
! 3550: ease transition to the options framework for the user,
! 3551: these legacy variables are converted to the appropriate
! 3552: options setting automatically. A warning is issued to
! 3553: prompt the user to update <code xmlns=
! 3554: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3555: "filename">/etc/mk.conf</code> to use the options
3556: framework directly. Support for these legacy variables
3557: will be removed eventually.</p>
3558: </div>
3559: </div>
3560:
3561: <div class="chapter" lang="en" xml:lang="en">
3562: <div class="titlepage">
3563: <div>
3564: <div>
1.1 grant 3565: <h2 class="title"><a name="binary" id=
1.38 dillo 3566: "binary"></a>Chapter 6. Creating binary
1.1 grant 3567: packages</h2>
3568: </div>
3569: </div>
3570: </div>
3571:
3572: <div class="toc">
3573: <p><b>Table of Contents</b></p>
3574:
3575: <dl>
1.30 wiz 3576: <dt><span class="sect1"><a href=
1.38 dillo 3577: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 3578: single binary package</a></span></dt>
1.1 grant 3579:
1.30 wiz 3580: <dt><span class="sect1"><a href=
1.38 dillo 3581: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 3582: Settings for creation of binary
3583: packages</a></span></dt>
3584:
1.38 dillo 3585: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 3586: a bulk build of all packages</a></span></dt>
3587:
3588: <dd>
3589: <dl>
3590: <dt><span class="sect2"><a href=
1.38 dillo 3591: "#binary.configuration">6.3.1.
1.1 grant 3592: Configuration</a></span></dt>
3593:
1.30 wiz 3594: <dt><span class="sect2"><a href=
1.38 dillo 3595: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 3596: environmental considerations</a></span></dt>
1.1 grant 3597:
1.38 dillo 3598: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 3599: Operation</a></span></dt>
3600:
1.30 wiz 3601: <dt><span class="sect2"><a href=
1.38 dillo 3602: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 3603:
1.30 wiz 3604: <dt><span class="sect2"><a href=
1.38 dillo 3605: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 3606: requirements</a></span></dt>
1.1 grant 3607:
1.30 wiz 3608: <dt><span class="sect2"><a href=
1.38 dillo 3609: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.30 wiz 3610: for chroot'ed builds</a></span></dt>
1.1 grant 3611:
1.30 wiz 3612: <dt><span class="sect2"><a href=
1.38 dillo 3613: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 3614: set of packages</a></span></dt>
1.13 hubertf 3615:
3616: <dt><span class="sect2"><a href=
1.38 dillo 3617: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 3618: build</a></span></dt>
1.1 grant 3619: </dl>
3620: </dd>
3621:
1.38 dillo 3622: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 3623: Creating a multiple CD-ROM packages
3624: collection</a></span></dt>
3625:
3626: <dd>
3627: <dl>
1.30 wiz 3628: <dt><span class="sect2"><a href=
1.38 dillo 3629: "#cdpack-example">6.4.1. Example of
1.30 wiz 3630: cdpack</a></span></dt>
1.1 grant 3631: </dl>
3632: </dd>
3633: </dl>
3634: </div>
3635:
3636: <div class="sect1" lang="en" xml:lang="en">
3637: <div class="titlepage">
3638: <div>
3639: <div>
3640: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3641: "building-a-single-binary-package" id=
1.38 dillo 3642: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 3643: a single binary package</h2>
1.1 grant 3644: </div>
3645: </div>
3646: </div>
3647:
3648: <p>Once you have built and installed a package, you can
3649: create a <span class="emphasis"><em>binary
3650: package</em></span> which can be installed on another
3651: system with <a href=
3652: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3653: <span class="citerefentry"><span class=
3654: "refentrytitle">pkg_add</span>(1)</span></a> This saves
3655: having to build the same package on a group of hosts and
3656: wasting CPU time. It also provides a simple means for
3657: others to install your package, should you distribute
3658: it.</p>
3659:
3660: <p>To create a binary package, change into the
1.14 xtraeme 3661: appropriate directory in pkgsrc, and run
3662: <span><strong class="command">make
3663: package</strong></span>:</p>
1.1 grant 3664: <pre class="screen">
1.14 xtraeme 3665: <code class="prompt">#</code> <strong class=
3666: "userinput"><code>cd misc/figlet</code></strong>
3667: <code class="prompt">#</code> <strong class=
3668: "userinput"><code>make package</code></strong>
1.1 grant 3669: </pre>
3670:
3671: <p>This will build and install your package (if not
3672: already done), and then build a binary package from what
1.14 xtraeme 3673: was installed. You can then use the <span><strong class=
3674: "command">pkg_*</strong></span> tools to manipulate it.
1.45 ! wiz 3675: Binary packages are created by default in <code xmlns=
! 3676: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3677: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 3678: gzipped tar file. See <a href="#logs.package" title=
1.45 ! wiz 3679: "2.2. Packaging figlet">Section 2.2,
1.1 grant 3680: “Packaging figlet”</a> for a continuation of
3681: the above <a xmlns=
3682: "http://www.w3.org/TR/xhtml1/transitional" href=
3683: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45 ! wiz 3684: target="_top"><code xmlns="" class=
! 3685: "filename">misc/figlet</code></a> example.</p>
1.1 grant 3686:
3687: <p>See <a href="#submit" title=
1.38 dillo 3688: "Chapter 17. Submitting and Committing">Chapter
3689: 17, <i>Submitting and Committing</i></a> for information
1.1 grant 3690: on how to submit such a binary package.</p>
3691: </div>
3692:
3693: <div class="sect1" lang="en" xml:lang="en">
3694: <div class="titlepage">
3695: <div>
3696: <div>
3697: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3698: "settings-for-creationg-of-binary-packages" id=
1.38 dillo 3699: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 3700: for creation of binary packages</h2>
3701: </div>
3702: </div>
3703: </div>
3704:
3705: <p>See <a href="#build.helpful-targets" title=
1.38 dillo 3706: "14.3. Other helpful targets">Section 14.3,
1.1 grant 3707: “Other helpful targets”</a>.</p>
3708: </div>
3709:
3710: <div class="sect1" lang="en" xml:lang="en">
3711: <div class="titlepage">
3712: <div>
3713: <div>
3714: <h2 class="title" style="clear: both"><a name=
1.38 dillo 3715: "bulkbuild" id="bulkbuild"></a>6.3. Doing a
1.1 grant 3716: bulk build of all packages</h2>
3717: </div>
3718: </div>
3719: </div>
3720:
3721: <p>If you want to get a full set of precompiled binary
3722: packages, this section describes how to get them. Beware
3723: that the bulk build will remove all currently installed
1.23 wiz 3724: packages from your system! Having an FTP server
3725: configured either on the machine doing the bulk builds or
3726: on a nearby NFS server can help to make the packages
3727: available to everyone. See <a href=
1.1 grant 3728: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
3729: <span class="citerefentry"><span class=
3730: "refentrytitle">ftpd</span>(8)</span></a> for more
3731: information. If you use a remote NFS server's storage, be
3732: sure to not actually compile on NFS storage, as this
3733: slows things down a lot.</p>
3734:
3735: <div class="sect2" lang="en" xml:lang="en">
3736: <div class="titlepage">
3737: <div>
3738: <div>
3739: <h3 class="title"><a name="binary.configuration"
3740: id=
1.38 dillo 3741: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 3742: </div>
3743: </div>
3744: </div>
3745:
3746: <div class="sect3" lang="en" xml:lang="en">
3747: <div class="titlepage">
3748: <div>
3749: <div>
3750: <h4 class="title"><a name="binary.mk.conf" id=
1.38 dillo 3751: "binary.mk.conf"></a>6.3.1.1. /etc/mk.conf</h4>
1.1 grant 3752: </div>
3753: </div>
3754: </div>
3755:
1.45 ! wiz 3756: <p>You may want to set variables in <code xmlns=
! 3757: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3758: "filename">/etc/mk.conf</code>. Look at <code xmlns=
! 3759: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3760: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 3761: details of the default settings. You will want to
1.14 xtraeme 3762: ensure that <code class=
3763: "varname">ACCEPTABLE_LICENSES</code> meet your local
3764: policy. As used in this example, <code class=
3765: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 3766: "emphasis"><em>all</em></span> licenses.</p>
3767: <pre class="programlisting">
3768: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
3769: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
3770: BSDSRCDIR= /usr/src
3771: BSDXSRCDIR= /usr/xsrc # for x11/xservers
3772: OBJHOSTNAME?= yes # use work.`hostname`
3773: FAILOVER_FETCH= yes # insist on the correct checksum
3774: PKG_DEVELOPER?= yes
3775: _ACCEPTABLE= yes
3776: </pre>
3777: </div>
3778:
3779: <div class="sect3" lang="en" xml:lang="en">
3780: <div class="titlepage">
3781: <div>
3782: <div>
1.30 wiz 3783: <h4 class="title"><a name="build.conf" id=
1.45 ! wiz 3784: "build.conf"></a>6.3.1.2. <code xmlns=
! 3785: "http://www.w3.org/TR/xhtml1/transitional"
! 3786: class="filename">build.conf</code></h4>
1.1 grant 3787: </div>
3788: </div>
3789: </div>
3790:
1.45 ! wiz 3791: <p>In <code xmlns=
! 3792: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3793: "filename">pkgsrc/mk/bulk</code>, copy <code xmlns=
! 3794: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3795: "filename">build.conf-example</code> to <code xmlns=
! 3796: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3797: "filename">build.conf</code> and edit it, following
! 3798: the comments in that file. This is the config file
! 3799: that determines where log files are generated after
! 3800: the build, where to mail the build report to, where
! 3801: your pkgsrc tree is located and the user to which
! 3802: user to <a href=
1.1 grant 3803: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
3804: <span class="citerefentry"><span class=
1.23 wiz 3805: "refentrytitle">su</span>(8)</span></a> to do a
1.14 xtraeme 3806: <span><strong class="command">cvs
3807: update</strong></span>.</p>
1.1 grant 3808: </div>
3809:
3810: <div class="sect3" lang="en" xml:lang="en">
3811: <div class="titlepage">
3812: <div>
3813: <div>
1.30 wiz 3814: <h4 class="title"><a name="pre-build.local" id=
1.45 ! wiz 3815: "pre-build.local"></a>6.3.1.3. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 3816: class="filename">pre-build.local</code></h4>
1.1 grant 3817: </div>
3818: </div>
3819: </div>
3820:
3821: <p>It is possible to configure the bulk build to
3822: perform certain site specific tasks at the end of the
1.45 ! wiz 3823: pre-build stage. If the file <code xmlns=
! 3824: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3825: "filename">pre-build.local</code> exists in
1.45 ! wiz 3826: <code xmlns=
! 3827: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3828: "filename">/usr/pkgsrc/mk/bulk</code>, it will be
! 3829: executed (as a <a href=
1.24 wiz 3830: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
3831: <span class="citerefentry"><span class=
3832: "refentrytitle">sh</span>(1)</span></a> script) at
3833: the end of the usual pre-build stage. An example use
1.45 ! wiz 3834: of <code xmlns=
! 3835: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3836: "filename">pre-build.local</code> is to have the
! 3837: line:</p>
1.1 grant 3838: <pre class="screen">
1.14 xtraeme 3839: <code class="prompt">#</code> <strong class=
3840: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 3841: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 3842: </pre>
3843:
3844: <p>to prevent the system from trying to build a
3845: particular package which requires nearly 3 GB of disk
3846: space.</p>
3847: </div>
3848: </div>
3849:
3850: <div class="sect2" lang="en" xml:lang="en">
3851: <div class="titlepage">
3852: <div>
3853: <div>
1.30 wiz 3854: <h3 class="title"><a name=
3855: "other-environmental-considerations" id=
1.38 dillo 3856: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 3857: environmental considerations</h3>
1.1 grant 3858: </div>
3859: </div>
3860: </div>
3861:
1.45 ! wiz 3862: <p>As <code xmlns=
! 3863: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3864: "filename">/usr/pkg</code> will be completely deleted
! 3865: at the start of bulk builds, make sure your login shell
! 3866: is placed somewhere else. Either drop it into
! 3867: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 3868: class="filename">/usr/local/bin</code> (and adjust your
! 3869: login shell in the passwd file), or (re-)install it via
1.14 xtraeme 3870: <a href=
1.1 grant 3871: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3872: <span class="citerefentry"><span class=
3873: "refentrytitle">pkg_add</span>(1)</span></a> from
1.45 ! wiz 3874: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 3875: class="filename">/etc/rc.local</code>, so you can login
! 3876: after a reboot (remember that your current process
! 3877: won't die if the package is removed, you just can't
! 3878: start any new instances of the shell any more). Also,
! 3879: if you use NetBSD earlier than 1.5, or you still want
! 3880: to use the pkgsrc version of ssh for some reason, be
! 3881: sure to install ssh before starting it from
! 3882: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 3883: class="filename">rc.local</code>:</p>
1.1 grant 3884: <pre class="programlisting">
3885: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
3886: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
3887: /usr/pkg/etc/rc.d/sshd
3888: fi
3889: </pre>
3890:
3891: <p>Not doing so will result in you being not able to
3892: log in via ssh after the bulk build is finished or if
3893: the machine gets rebooted or crashes. You have been
3894: warned! :)</p>
3895: </div>
3896:
3897: <div class="sect2" lang="en" xml:lang="en">
3898: <div class="titlepage">
3899: <div>
3900: <div>
1.30 wiz 3901: <h3 class="title"><a name="operation" id=
1.38 dillo 3902: "operation"></a>6.3.3. Operation</h3>
1.1 grant 3903: </div>
3904: </div>
3905: </div>
3906:
3907: <p>Make sure you don't need any of the packages still
3908: installed.</p>
3909:
3910: <div class="warning" style=
3911: "margin-left: 0.5in; margin-right: 0.5in;">
3912: <h3 class="title">Warning</h3>
3913:
3914: <p>During the bulk build, <span class=
3915: "emphasis"><em>all packages will be
3916: removed!</em></span></p>
3917: </div>
3918:
3919: <p>Be sure to remove all other things that might
3920: interfere with builds, like some libs installed in
1.45 ! wiz 3921: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 3922: class="filename">/usr/local</code>, etc. then become
! 3923: root and type:</p>
1.1 grant 3924: <pre class="screen">
1.14 xtraeme 3925: <code class="prompt">#</code> <strong class=
3926: "userinput"><code>cd /usr/pkgsrc</code></strong>
3927: <code class="prompt">#</code> <strong class=
3928: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 3929: </pre>
3930:
3931: <p>If for some reason your last build didn't complete
3932: (power failure, system panic, ...), you can continue it
3933: by running:</p>
3934: <pre class="screen">
1.14 xtraeme 3935: <code class="prompt">#</code> <strong class=
3936: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 3937: </pre>
3938:
3939: <p>At the end of the bulk build, you will get a summary
3940: via mail, and find build logs in the directory
1.14 xtraeme 3941: specified by <code class="varname">FTP</code> in the
1.45 ! wiz 3942: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 3943: class="filename">build.conf</code> file.</p>
1.1 grant 3944: </div>
3945:
3946: <div class="sect2" lang="en" xml:lang="en">
3947: <div class="titlepage">
3948: <div>
3949: <div>
1.30 wiz 3950: <h3 class="title"><a name="what-it-does" id=
1.38 dillo 3951: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 3952: </div>
3953: </div>
3954: </div>
3955:
3956: <p>The bulk builds consist of three steps:</p>
3957:
3958: <div class="variablelist">
3959: <dl>
3960: <dt><span class="term">1. pre-build</span></dt>
3961:
3962: <dd>
3963: <p>The script updates your pkgsrc tree via
3964: (anon)cvs, then cleans out any broken distfiles,
3965: and removes all packages installed.</p>
3966: </dd>
3967:
3968: <dt><span class="term">2. the bulk
3969: build</span></dt>
3970:
3971: <dd>
3972: <p>This is basically “<span class=
3973: "quote">make bulk-package</span>” with an
3974: optimised order in which packages will be built.
3975: Packages that don't require other packages will
3976: be built first, and packages with many
3977: dependencies will be built later.</p>
3978: </dd>
3979:
3980: <dt><span class="term">3. post-build</span></dt>
3981:
3982: <dd>
3983: <p>Generates a report that's placed in the
1.45 ! wiz 3984: directory specified in the <code xmlns=
! 3985: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3986: "filename">build.conf</code> file named
1.45 ! wiz 3987: <code xmlns=
! 3988: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3989: "filename">broken.html</code>, a short version of
! 3990: that report will also be mailed to the build's
! 3991: admin.</p>
1.1 grant 3992: </dd>
3993: </dl>
3994: </div>
3995:
3996: <p>During the build, a list of broken packages will be
1.45 ! wiz 3997: compiled in <code xmlns=
! 3998: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3999: "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
! 4000: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4001: "filename">.../.broken.${MACHINE}</code> if
4002: <code class="varname">OBJMACHINE</code> is set),
4003: individual build logs of broken builds can be found in
4004: the package's directory. These files are used by the
4005: bulk-targets to mark broken builds to not waste time
4006: trying to rebuild them, and they can be used to debug
4007: these broken package builds later.</p>
1.1 grant 4008: </div>
4009:
4010: <div class="sect2" lang="en" xml:lang="en">
4011: <div class="titlepage">
4012: <div>
4013: <div>
1.30 wiz 4014: <h3 class="title"><a name=
4015: "disk-space-requirements" id=
1.38 dillo 4016: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 4017: space requirements</h3>
1.1 grant 4018: </div>
4019: </div>
4020: </div>
4021:
4022: <p>Currently, roughly the following requirements are
4023: valid for NetBSD 2.0/i386:</p>
4024:
4025: <div class="itemizedlist">
4026: <ul type="disc">
4027: <li>
4028: <p>10 GB - distfiles (NFS ok)</p>
4029: </li>
4030:
4031: <li>
4032: <p>8 GB - full set of all binaries (NFS ok)</p>
4033: </li>
4034:
4035: <li>
4036: <p>5 GB - temp space for compiling (local disk
4037: recommended)</p>
4038: </li>
4039: </ul>
4040: </div>
4041:
4042: <p>Note that all pkgs will be de-installed as soon as
4043: they are turned into a binary package, and that sources
4044: are removed, so there is no excessively huge demand to
4045: disk space. Afterwards, if the package is needed again,
4046: it will be installed via <a href=
4047: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4048: <span class="citerefentry"><span class=
4049: "refentrytitle">pkg_add</span>(1)</span></a> instead of
4050: building again, so there are no cycles wasted by
4051: recompiling.</p>
4052: </div>
4053:
4054: <div class="sect2" lang="en" xml:lang="en">
4055: <div class="titlepage">
4056: <div>
4057: <div>
1.30 wiz 4058: <h3 class="title"><a name="setting-up-a-sandbox"
1.38 dillo 4059: id="setting-up-a-sandbox"></a>6.3.6. Setting
1.30 wiz 4060: up a sandbox for chroot'ed builds</h3>
1.1 grant 4061: </div>
4062: </div>
4063: </div>
4064:
1.12 agc 4065: <p>If you don't want all the packages nuked from a
4066: machine (rendering it useless for anything but pkg
1.23 wiz 4067: compiling), there is the possibility of doing the
4068: package bulk build inside a chroot environment.</p>
1.12 agc 4069:
4070: <p>The first step is to set up a chroot sandbox, e.g.
1.45 ! wiz 4071: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 4072: class="filename">/usr/sandbox</code>. This can be done
! 4073: by using null mounts, or manually.</p>
1.12 agc 4074:
1.45 ! wiz 4075: <p>There is a shell script called <code xmlns=
! 4076: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4077: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
4078: set up the sandbox environment using null mounts. It
1.45 ! wiz 4079: will also create a script called <code xmlns=
! 4080: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4081: "filename">sandbox</code> in the root of the sandbox
1.12 agc 4082: environment, which will allow the null mounts to be
1.14 xtraeme 4083: activated using the <span><strong class=
4084: "command">sandbox mount</strong></span> command and
4085: deactivated using the <span><strong class=
4086: "command">sandbox umount</strong></span> command.</p>
1.12 agc 4087:
4088: <p>To set up a sandbox environment by hand, after
4089: extracting all the sets from a NetBSD installation or
1.14 xtraeme 4090: doing a <span><strong class="command">make distribution
1.45 ! wiz 4091: DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
! 4092: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4093: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 4094: items are present and properly configured:</p>
1.1 grant 4095:
4096: <div class="procedure">
4097: <ol type="1">
4098: <li>
4099: <p>Kernel</p>
4100: <pre class="screen">
1.14 xtraeme 4101: <code class="prompt">#</code> <strong class=
4102: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 4103: </pre>
4104: </li>
4105:
4106: <li>
1.45 ! wiz 4107: <p><code xmlns=
! 4108: "http://www.w3.org/TR/xhtml1/transitional" class=
! 4109: "filename">/dev/*</code></p>
1.1 grant 4110: <pre class="screen">
1.14 xtraeme 4111: <code class="prompt">#</code> <strong class=
4112: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 4113: </pre>
4114: </li>
4115:
4116: <li>
1.45 ! wiz 4117: <p><code xmlns=
! 4118: "http://www.w3.org/TR/xhtml1/transitional" class=
! 4119: "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1 grant 4120: "http://www.w3.org/TR/xhtml1/transitional" href=
4121: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 ! wiz 4122: target="_top"><code xmlns="" class=
! 4123: "filename">security/smtpd</code></a> and
! 4124: mail):</p>
1.1 grant 4125: <pre class="screen">
1.14 xtraeme 4126: <code class="prompt">#</code> <strong class=
4127: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 4128: </pre>
4129: </li>
4130:
4131: <li>
4132: <p>Working(!) mail config (hostname,
4133: sendmail.cf):</p>
4134: <pre class="screen">
1.14 xtraeme 4135: <code class="prompt">#</code> <strong class=
4136: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 4137: </pre>
4138: </li>
4139:
4140: <li>
1.45 ! wiz 4141: <p><code xmlns=
! 4142: "http://www.w3.org/TR/xhtml1/transitional" class=
! 4143: "filename">/etc/localtime</code> (for <a xmlns=
1.1 grant 4144: "http://www.w3.org/TR/xhtml1/transitional" href=
4145: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 ! wiz 4146: target="_top"><code xmlns="" class=
! 4147: "filename">security/smtpd</code></a>):</p>
1.1 grant 4148: <pre class="screen">
1.14 xtraeme 4149: <code class="prompt">#</code> <strong class=
4150: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 4151: </pre>
4152: </li>
4153:
4154: <li>
1.45 ! wiz 4155: <p><code xmlns=
! 4156: "http://www.w3.org/TR/xhtml1/transitional" class=
! 4157: "filename">/usr/src</code> (system sources, for
! 4158: <a xmlns=
1.1 grant 4159: "http://www.w3.org/TR/xhtml1/transitional" href=
4160: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45 ! wiz 4161: target="_top"><code xmlns="" class=
! 4162: "filename">sysutils/aperture</code></a>,
! 4163: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 4164: href=
1.20 ben 4165: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45 ! wiz 4166: target="_top"><code xmlns="" class=
! 4167: "filename">net/ppp-mppe</code></a>):</p>
1.1 grant 4168: <pre class="screen">
1.14 xtraeme 4169: <code class="prompt">#</code> <strong class=
4170: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
4171: <code class="prompt">#</code> <strong class=
1.23 wiz 4172: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 4173: </pre>
4174: </li>
4175:
4176: <li>
1.45 ! wiz 4177: <p>Create <code xmlns=
! 4178: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4179: "filename">/var/db/pkg</code> (not part of
4180: default install):</p>
1.1 grant 4181: <pre class="screen">
1.14 xtraeme 4182: <code class="prompt">#</code> <strong class=
4183: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 4184: </pre>
4185: </li>
4186:
4187: <li>
1.45 ! wiz 4188: <p>Create <code xmlns=
! 4189: "http://www.w3.org/TR/xhtml1/transitional" class=
! 4190: "filename">/usr/pkg</code> (not part of default
! 4191: install):</p>
1.1 grant 4192: <pre class="screen">
1.14 xtraeme 4193: <code class="prompt">#</code> <strong class=
4194: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 4195: </pre>
4196: </li>
4197:
4198: <li>
1.45 ! wiz 4199: <p>Checkout pkgsrc via cvs into <code xmlns=
! 4200: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4201: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 4202: <pre class="screen">
1.14 xtraeme 4203: <code class="prompt">#</code> <strong class=
4204: "userinput"><code>cd /usr/sandbox/usr</code></strong>
4205: <code class="prompt">#</code> <strong class=
4206: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 4207: </pre>
4208:
4209: <p>Do not mount/link this to the copy of your
4210: pkgsrc tree you do development in, as this will
4211: likely cause problems!</p>
4212: </li>
4213:
4214: <li>
1.45 ! wiz 4215: <p>Make <code xmlns=
! 4216: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4217: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45 ! wiz 4218: and <code xmlns=
! 4219: "http://www.w3.org/TR/xhtml1/transitional" class=
! 4220: "filename">.../distfiles</code> point somewhere
! 4221: appropriate. NFS- and/or nullfs-mounts may come
! 4222: in handy!</p>
1.1 grant 4223: </li>
4224:
4225: <li>
1.45 ! wiz 4226: <p>Edit <code xmlns=
! 4227: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4228: "filename">/etc/mk.conf</code>, see <a href=
4229: "#binary.mk.conf" title=
1.38 dillo 4230: "6.3.1.1. /etc/mk.conf">Section 6.3.1.1,
1.1 grant 4231: “/etc/mk.conf”</a>.</p>
4232: </li>
4233:
4234: <li>
1.45 ! wiz 4235: <p>Adjust <code xmlns=
! 4236: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4237: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 4238: needs.</p>
4239: </li>
4240:
4241: <li>
1.14 xtraeme 4242: <p>If you have set <code class=
1.45 ! wiz 4243: "varname">CVS_USER</code> in <code xmlns=
! 4244: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4245: "filename">build.conf</code>, make sure that
4246: account exists and can do a <span><strong class=
4247: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 4248: properly!</p>
4249: </li>
4250: </ol>
4251: </div>
4252:
4253: <p>When the chroot sandbox is setup, you can start the
4254: build with the following steps:</p>
4255: <pre class="screen">
1.14 xtraeme 4256: <code class="prompt">#</code> <strong class=
4257: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4258: <code class="prompt">#</code> <strong class=
4259: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 4260: </pre>
4261:
4262: <p>This will just jump inside the sandbox and start
4263: building. At the end of the build, mail will be sent
4264: with the results of the build. Created binary pkgs will
1.45 ! wiz 4265: be in <code xmlns=
! 4266: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4267: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 4268: (wherever that points/mounts to/from).</p>
4269: </div>
4270:
4271: <div class="sect2" lang="en" xml:lang="en">
4272: <div class="titlepage">
4273: <div>
4274: <div>
1.30 wiz 4275: <h3 class="title"><a name=
4276: "building-a-partial-set" id=
1.38 dillo 4277: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 4278: a partial set of packages</h3>
1.1 grant 4279: </div>
4280: </div>
4281: </div>
4282:
4283: <p>In addition to building a complete set of all
1.45 ! wiz 4284: packages in pkgsrc, the <code xmlns=
! 4285: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4286: "filename">pkgsrc/mk/bulk/build</code> script may be
4287: used to build a subset of the packages contained in
4288: pkgsrc. By setting defining <code class=
1.45 ! wiz 4289: "varname">SPECIFIC_PKGS</code> in <code xmlns=
! 4290: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4291: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 4292:
4293: <div class="itemizedlist">
4294: <ul type="disc">
4295: <li>
4296: <p>SITE_SPECIFIC_PKGS</p>
4297: </li>
4298:
4299: <li>
4300: <p>HOST_SPECIFIC_PKGS</p>
4301: </li>
4302:
4303: <li>
4304: <p>GROUP_SPECIFIC_PKGS</p>
4305: </li>
4306:
4307: <li>
4308: <p>USER_SPECIFIC_PKGS</p>
4309: </li>
4310: </ul>
4311: </div>
4312:
4313: <p>will define the set of packages which should be
4314: built. The bulk build code will also include any
4315: packages which are needed as dependencies for the
4316: explicitly listed packages.</p>
4317:
4318: <p>One use of this is to do a bulk build with
1.14 xtraeme 4319: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 4320: sandbox periodically to have a complete set of the
4321: binary packages needed for your site available without
4322: the overhead of building extra packages that are not
4323: needed.</p>
4324: </div>
1.13 hubertf 4325:
4326: <div class="sect2" lang="en" xml:lang="en">
4327: <div class="titlepage">
4328: <div>
4329: <div>
4330: <h3 class="title"><a name="bulk-upload" id=
1.38 dillo 4331: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 4332: of a bulk build</h3>
4333: </div>
4334: </div>
4335: </div>
4336:
4337: <p>This section describes how pkgsrc developers can
4338: upload binary pkgs built by bulk builds to
4339: ftp.NetBSD.org.</p>
4340:
1.17 sketch 4341: <p>If you would like to automatically create checksum
4342: files for the binary packages you intend to upload,
4343: remember to set <code class="varname">MKSUMS=yes</code>
1.45 ! wiz 4344: in your <code xmlns=
! 4345: "http://www.w3.org/TR/xhtml1/transitional" class=
1.17 sketch 4346: "filename">mk/bulk/build.conf</code>.</p>
4347:
4348: <p>If you would like to PGP sign the checksum files
4349: (highly recommended!), remember to set <code class=
4350: "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45 ! wiz 4351: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 4352: class="filename">mk/bulk/build.conf</code>. This will
! 4353: prompt you for your GPG password to sign the files
1.17 sketch 4354: before uploading everything.</p>
4355:
4356: <p>Then, make sure that you have <code class=
1.14 xtraeme 4357: "varname">RSYNC_DST</code> set properly in your
1.45 ! wiz 4358: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 4359: class="filename">mk/bulk/build.conf</code> file, i.e.
! 4360: adjust it to something like one of the following:</p>
1.13 hubertf 4361: <pre class="screen">
4362: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4363: </pre>
4364:
1.23 wiz 4365: <p>Please use appropviate values for "pkgsrc-200xQy",
1.13 hubertf 4366: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 4367: ftp.NetBSD.org is different from <code class=
4368: "varname">CVS_USER</code>, write your login directly
4369: into the variable, e.g. my local account is "feyrer",
4370: but for my login "hubertf", I use:</p>
1.13 hubertf 4371: <pre class="screen">
4372: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4373: </pre>
4374:
1.45 ! wiz 4375: <p>A separate <code xmlns=
! 4376: "http://www.w3.org/TR/xhtml1/transitional" class=
! 4377: "filename">upload</code> directory is used here to
! 4378: allow "closing" the directory during upload. To do so,
! 4379: run the following command on ftp.NetBSD.org next:</p>
1.13 hubertf 4380: <pre class="screen">
1.14 xtraeme 4381: nbftp% <strong class=
4382: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 4383: </pre>
4384:
1.45 ! wiz 4385: <p>Please note that <code xmlns=
! 4386: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4387: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 4388: appropriate for packages for the NetBSD operating
4389: system. Binary packages for other operating systems
1.45 ! wiz 4390: should go into <code xmlns=
! 4391: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4392: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 4393:
4394: <p>Before uploading the binary pkgs, ssh authentication
1.23 wiz 4395: needs to be set up. This example shows how to setup
1.13 hubertf 4396: temporary keys for the root account <span class=
4397: "emphasis"><em>inside the sandbox</em></span> (assuming
4398: that no keys should be present there usually):</p>
4399: <pre class="screen">
1.14 xtraeme 4400: <code class="prompt">#</code> <strong class=
4401: "userinput"><code>chroot /usr/sandbox</code></strong>
4402: chroot-<code class="prompt">#</code> <strong class=
4403: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
4404: chroot-<code class="prompt">#</code> <strong class=
4405: "userinput"><code>ssh-keygen -t dsa</code></strong>
4406: chroot-<code class="prompt">#</code> <strong class=
4407: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 4408: </pre>
4409:
1.45 ! wiz 4410: <p>Now take the output of <code xmlns=
! 4411: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4412: "filename">id-dsa.pub</code> and append it to your
1.45 ! wiz 4413: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 4414: class="filename">~/.ssh/authorized_keys</code> file on
! 4415: ftp.NetBSD.org. You can remove the key after the upload
! 4416: is done!</p>
1.13 hubertf 4417:
4418: <p>Next, test if your ssh connection really works:</p>
4419: <pre class="screen">
1.14 xtraeme 4420: chroot-<code class="prompt">#</code> <strong class=
4421: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 4422: </pre>
4423:
4424: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
4425:
4426: <p>Now after all this works, you can exit the sandbox
4427: and start the upload:</p>
4428: <pre class="screen">
1.14 xtraeme 4429: chroot-<code class="prompt">#</code> <strong class=
4430: "userinput"><code>exit</code></strong>
4431: <code class="prompt">#</code> <strong class=
4432: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4433: <code class="prompt">#</code> <strong class=
4434: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 4435: </pre>
4436:
4437: <p>The upload process may take quite some time. Use
1.24 wiz 4438: <a href=
4439: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
4440: <span class="citerefentry"><span class=
4441: "refentrytitle">ls</span>(1)</span></a> or <a href=
4442: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
4443: <span class="citerefentry"><span class=
4444: "refentrytitle">du</span>(1)</span></a> on the FTP
4445: server to monitor progress of the upload. The upload
4446: script will take care of not uploading restricted
4447: packages and putting vulnerable packages into the
1.45 ! wiz 4448: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 4449: class="filename">vulnerable</code> subdirectory.</p>
1.13 hubertf 4450:
4451: <p>After the upload has ended, first thing is to revoke
4452: ssh access:</p>
4453: <pre class="screen">
1.14 xtraeme 4454: nbftp% <strong class=
4455: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 4456: Gdd:x!
4457: </pre>
4458:
4459: <p>Use whatever is needed to remove the key you've
4460: entered before! Last, move the uploaded packages out of
1.45 ! wiz 4461: the <code xmlns=
! 4462: "http://www.w3.org/TR/xhtml1/transitional" class=
! 4463: "filename">upload</code> directory to have them
! 4464: accessible to everyone:</p>
1.13 hubertf 4465: <pre class="screen">
1.14 xtraeme 4466: nbftp% <strong class=
4467: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
4468: nbftp% <strong class=
4469: "userinput"><code>mv upload/* .</code></strong>
4470: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
4471: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 4472: </pre>
4473: </div>
1.1 grant 4474: </div>
4475:
4476: <div class="sect1" lang="en" xml:lang="en">
4477: <div class="titlepage">
4478: <div>
4479: <div>
4480: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4481: "creating-cdroms" id=
1.38 dillo 4482: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 4483: CD-ROM packages collection</h2>
1.1 grant 4484: </div>
4485: </div>
4486: </div>
4487:
4488: <p>After your pkgsrc bulk-build has completed, you may
4489: wish to create a CD-ROM set of the resulting binary
4490: packages to assist in installing packages on other
4491: machines. The <a xmlns=
4492: "http://www.w3.org/TR/xhtml1/transitional" href=
4493: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45 ! wiz 4494: target="_top"><code xmlns="" class=
! 4495: "filename">pkgtools/cdpack</code></a> package provides a
1.20 ben 4496: simple tool for creating the ISO 9660 images.
4497: <span><strong class="command">cdpack</strong></span>
4498: arranges the packages on the CD-ROMs in a way that keeps
4499: all the dependencies for given package on the same CD as
4500: that package.</p>
1.1 grant 4501:
4502: <div class="sect2" lang="en" xml:lang="en">
4503: <div class="titlepage">
4504: <div>
4505: <div>
1.30 wiz 4506: <h3 class="title"><a name="cdpack-example" id=
1.38 dillo 4507: "cdpack-example"></a>6.4.1. Example of
1.1 grant 4508: cdpack</h3>
4509: </div>
4510: </div>
4511: </div>
4512:
4513: <p>Complete documentation for cdpack is found in the
4514: cdpack(1) manpage. The following short example assumes
1.45 ! wiz 4515: that the binary packages are left in <code xmlns=
! 4516: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4517: "filename">/usr/pkgsrc/packages/All</code> and that
1.45 ! wiz 4518: sufficient disk space exists in <code xmlns=
! 4519: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4520: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 4521: <pre class="screen">
1.14 xtraeme 4522: <code class="prompt">#</code> <strong class=
4523: "userinput"><code>mkdir /u2/images</code></strong>
4524: <code class="prompt">#</code> <strong class=
4525: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
4526: <code class="prompt">#</code> <strong class=
4527: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4528: </pre>
4529:
4530: <p>If you wish to include a common set of files
1.45 ! wiz 4531: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 4532: class="filename">COPYRIGHT</code>, <code xmlns=
! 4533: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4534: "filename">README</code>, etc.) on each CD in the
1.1 grant 4535: collection, then you need to create a directory which
4536: contains these files. e.g.</p>
4537: <pre class="screen">
1.14 xtraeme 4538: <code class="prompt">#</code> <strong class=
4539: "userinput"><code>mkdir /tmp/common</code></strong>
4540: <code class="prompt">#</code> <strong class=
4541: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
4542: <code class="prompt">#</code> <strong class=
4543: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
4544: <code class="prompt">#</code> <strong class=
4545: "userinput"><code>mkdir /tmp/common/bin</code></strong>
4546: <code class="prompt">#</code> <strong class=
4547: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
4548: <code class="prompt">#</code> <strong class=
4549: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
4550: <code class="prompt">#</code> <strong class=
4551: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 4552: </pre>
4553:
4554: <p>Now create the images:</p>
4555: <pre class="screen">
1.14 xtraeme 4556: <code class="prompt">#</code> <strong class=
4557: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4558: </pre>
4559:
1.45 ! wiz 4560: <p>Each image will contain <code xmlns=
! 4561: "http://www.w3.org/TR/xhtml1/transitional" class=
! 4562: "filename">README</code>, <code xmlns=
! 4563: "http://www.w3.org/TR/xhtml1/transitional" class=
! 4564: "filename">COPYING</code>, and <code xmlns=
! 4565: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4566: "filename">bin/myscript</code> in their root
1.1 grant 4567: directories.</p>
4568: </div>
4569: </div>
4570: </div>
4571:
4572: <div class="chapter" lang="en" xml:lang="en">
4573: <div class="titlepage">
4574: <div>
4575: <div>
4576: <h2 class="title"><a name="faq" id=
1.38 dillo 4577: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 4578: Questions</h2>
4579: </div>
4580: </div>
4581: </div>
4582:
4583: <div class="toc">
4584: <p><b>Table of Contents</b></p>
4585:
4586: <dl>
1.30 wiz 4587: <dt><span class="sect1"><a href=
1.38 dillo 4588: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 4589: lists for pkg-related discussion?</a></span></dt>
1.1 grant 4590:
1.38 dillo 4591: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 4592: Where's the pkgviews documentation?</a></span></dt>
4593:
1.38 dillo 4594: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 4595: Utilities for package management
4596: (pkgtools)</a></span></dt>
4597:
1.38 dillo 4598: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 4599: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 4600:
1.30 wiz 4601: <dt><span class="sect1"><a href=
1.38 dillo 4602: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 4603: fetching distfiles?</a></span></dt>
1.14 xtraeme 4604:
1.30 wiz 4605: <dt><span class="sect1"><a href=
1.38 dillo 4606: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 4607: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 4608:
1.30 wiz 4609: <dt><span class="sect1"><a href=
1.38 dillo 4610: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 4611: from pkgsrc?</a></span></dt>
1.1 grant 4612:
1.30 wiz 4613: <dt><span class="sect1"><a href=
1.38 dillo 4614: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 4615: behind a firewall</a></span></dt>
1.1 grant 4616:
1.38 dillo 4617: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 4618: do I tell <span><strong class="command">make
4619: fetch</strong></span> to do passive
4620: FTP?</a></span></dt>
1.1 grant 4621:
1.30 wiz 4622: <dt><span class="sect1"><a href=
1.38 dillo 4623: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 4624: distfiles at once</a></span></dt>
1.1 grant 4625:
1.30 wiz 4626: <dt><span class="sect1"><a href=
1.38 dillo 4627: "#tmac.andoc-missing">7.11. What does
1.30 wiz 4628: “<span class="quote">Don't know how to make
1.14 xtraeme 4629: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 4630: mean?</a></span></dt>
4631:
1.30 wiz 4632: <dt><span class="sect1"><a href=
1.38 dillo 4633: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 4634: “<span class="quote">Could not find
1.14 xtraeme 4635: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 4636:
1.30 wiz 4637: <dt><span class="sect1"><a href=
1.38 dillo 4638: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 4639: pkgsrc</a></span></dt>
1.1 grant 4640:
1.38 dillo 4641: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 4642: do I change the location of configuration
4643: files?</a></span></dt>
1.1 grant 4644:
1.38 dillo 4645: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 4646: Automated security checks</a></span></dt>
4647: </dl>
4648: </div>
4649:
4650: <p>This section contains hints, tips & tricks on
4651: special things in pkgsrc that we didn't find a better place
4652: for in the previous chapters, and it contains items for
4653: both pkgsrc users and developers.</p>
4654:
4655: <div class="sect1" lang="en" xml:lang="en">
4656: <div class="titlepage">
4657: <div>
4658: <div>
4659: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4660: "mailing-list-pointers" id=
1.38 dillo 4661: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 4662: mailing lists for pkg-related discussion?</h2>
1.1 grant 4663: </div>
4664: </div>
4665: </div>
4666:
1.18 xtraeme 4667: <p>The following mailing lists may be of interest to
4668: pkgsrc users:</p>
4669:
4670: <div class="itemizedlist">
4671: <ul type="disc">
4672: <li>
4673: <p><a href=
4674: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34 wiz 4675: target="_top">pkgsrc-bugs</a>: A list where problem
4676: reports related to pkgsrc are sent and
4677: discussed.</p>
1.18 xtraeme 4678: </li>
4679:
4680: <li>
4681: <p><a href=
4682: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 4683: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 4684: results of pkgsrc bulk builds are sent and
1.34 wiz 4685: discussed.</p>
1.18 xtraeme 4686: </li>
4687:
4688: <li>
4689: <p><a href=
4690: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34 wiz 4691: target="_top">pkgsrc-changes</a>: A list where all
4692: commit messages to pkgsrc are sent.</p>
1.18 xtraeme 4693: </li>
4694:
4695: <li>
4696: <p><a href=
4697: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34 wiz 4698: target="_top">tech-pkg</a>: A general discussion
4699: list for all things related to pkgsrc.</p>
1.18 xtraeme 4700: </li>
4701: </ul>
4702: </div>
4703:
4704: <p>To subscribe, do:</p>
1.1 grant 4705: <pre class="programlisting">
1.18 xtraeme 4706: <code class="prompt">%</code> echo subscribe <em class=
4707: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 4708: </pre>
4709:
1.18 xtraeme 4710: <p>Archives for all these mailing lists are available
4711: from <a href="http://mail-index.NetBSD.org/" target=
4712: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 4713: </div>
4714:
4715: <div class="sect1" lang="en" xml:lang="en">
4716: <div class="titlepage">
4717: <div>
4718: <div>
4719: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4720: "pkgviews-docs" id=
1.38 dillo 4721: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 4722: documentation?</h2>
1.1 grant 4723: </div>
4724: </div>
4725: </div>
4726:
4727: <p>Pkgviews is tightly integrated with buildlink. You can
1.45 ! wiz 4728: find a pkgviews User's guide in <code xmlns=
! 4729: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4730: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 4731: </div>
4732:
4733: <div class="sect1" lang="en" xml:lang="en">
4734: <div class="titlepage">
4735: <div>
4736: <div>
4737: <h2 class="title" style="clear: both"><a name=
1.5 hubertf 4738: "faq-pkgtools" id=
1.38 dillo 4739: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 4740: management (pkgtools)</h2>
1.1 grant 4741: </div>
4742: </div>
4743: </div>
4744:
1.45 ! wiz 4745: <p>The <code xmlns=
! 4746: "http://www.w3.org/TR/xhtml1/transitional" class=
! 4747: "filename">pkgsrc/pkgtools</code> directory pkgtools
! 4748: contains a number of useful utilities for both users and
! 4749: developers of pkgsrc. This section attempts only to make
! 4750: the reader aware of the utilities and when they might be
! 4751: useful, and not to duplicate the documentation that comes
! 4752: with each package.</p>
1.1 grant 4753:
4754: <p>Utilities used by pkgsrc (automatically installed when
4755: needed):</p>
4756:
4757: <div class="itemizedlist">
4758: <ul type="disc">
4759: <li>
4760: <p><a xmlns=
4761: "http://www.w3.org/TR/xhtml1/transitional" href=
4762: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45 ! wiz 4763: target="_top"><code xmlns="" class=
! 4764: "filename">pkgtools/x11-links</code></a>: Symlinks
1.34 wiz 4765: for use by buildlink.</p>
1.1 grant 4766: </li>
4767: </ul>
4768: </div>
4769:
4770: <p>OS tool augmentation (automatically installed when
4771: needed):</p>
4772:
4773: <div class="itemizedlist">
4774: <ul type="disc">
4775: <li>
4776: <p><a xmlns=
4777: "http://www.w3.org/TR/xhtml1/transitional" href=
4778: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 ! wiz 4779: target="_top"><code xmlns="" class=
! 4780: "filename">pkgtools/digest</code></a>: Calculates
1.34 wiz 4781: various kinds of checksums (including SHA1).</p>
1.1 grant 4782: </li>
4783:
4784: <li>
4785: <p><a xmlns=
4786: "http://www.w3.org/TR/xhtml1/transitional" href=
4787: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45 ! wiz 4788: target="_top"><code xmlns="" class=
! 4789: "filename">pkgtools/libnbcompat</code></a>:
1.34 wiz 4790: Compatibility library for pkgsrc tools.</p>
1.1 grant 4791: </li>
4792:
4793: <li>
4794: <p><a xmlns=
4795: "http://www.w3.org/TR/xhtml1/transitional" href=
4796: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45 ! wiz 4797: target="_top"><code xmlns="" class=
! 4798: "filename">pkgtools/mtree</code></a>: Installed on
1.34 wiz 4799: non-BSD systems due to lack of native mtree.</p>
1.1 grant 4800: </li>
4801:
4802: <li>
4803: <p><a xmlns=
4804: "http://www.w3.org/TR/xhtml1/transitional" href=
4805: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 ! wiz 4806: target="_top"><code xmlns="" class=
! 4807: "filename">pkgtools/pkg_install</code></a>:
! 4808: Up-to-date replacement for <code xmlns=
! 4809: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 4810: "filename">/usr/sbin/pkg_install</code>, or for use
4811: on operating systems where pkg_install is not
4812: present.</p>
1.1 grant 4813: </li>
4814: </ul>
4815: </div>
4816:
4817: <p>Utilities used by pkgsrc (not automatically
4818: installed):</p>
4819:
4820: <div class="itemizedlist">
4821: <ul type="disc">
4822: <li>
4823: <p><a xmlns=
4824: "http://www.w3.org/TR/xhtml1/transitional" href=
4825: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45 ! wiz 4826: target="_top"><code xmlns="" class=
! 4827: "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20 ben 4828: binary package from an already-installed package.
1.34 wiz 4829: Used by <span><strong class="command">make
4830: replace</strong></span> to save the old
4831: package.</p>
1.1 grant 4832: </li>
4833:
4834: <li>
4835: <p><a xmlns=
4836: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 4837: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45 ! wiz 4838: target="_top"><code xmlns="" class=
! 4839: "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20 ben 4840: functionality to pkgsrc, allowing it to fetch
4841: distfiles from multiple locations. It currently
4842: supports the following methods: multiple CD-ROMs
4843: and network FTP/HTTP connections.</p>
1.5 hubertf 4844: </li>
4845:
4846: <li>
4847: <p><a xmlns=
4848: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4849: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 ! wiz 4850: target="_top"><code xmlns="" class=
! 4851: "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34 wiz 4852: packages someplace else (enabled by default).</p>
1.1 grant 4853: </li>
1.5 hubertf 4854:
4855: <li>
4856: <p><a xmlns=
4857: "http://www.w3.org/TR/xhtml1/transitional" href=
4858: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 ! wiz 4859: target="_top"><code xmlns="" class=
! 4860: "filename">devel/cpuflags</code></a>: Determine the
1.34 wiz 4861: best compiler flags to optimise code for your
1.20 ben 4862: current CPU and compiler.</p>
1.5 hubertf 4863: </li>
1.1 grant 4864: </ul>
4865: </div>
4866:
4867: <p>Utilities for keeping track of installed packages,
4868: being up to date, etc:</p>
4869:
4870: <div class="itemizedlist">
4871: <ul type="disc">
4872: <li>
4873: <p><a xmlns=
4874: "http://www.w3.org/TR/xhtml1/transitional" href=
4875: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45 ! wiz 4876: target="_top"><code xmlns="" class=
! 4877: "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27 rillig 4878: packages whose installed versions do not match the
1.34 wiz 4879: latest pkgsrc entries.</p>
1.1 grant 4880: </li>
4881:
4882: <li>
4883: <p><a xmlns=
4884: "http://www.w3.org/TR/xhtml1/transitional" href=
4885: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 ! wiz 4886: target="_top"><code xmlns="" class=
! 4887: "filename">pkgtools/pkgdep</code></a>: Makes
1.20 ben 4888: dependency graphs of packages, to aid in choosing a
1.34 wiz 4889: strategy for updating.</p>
1.1 grant 4890: </li>
4891:
4892: <li>
4893: <p><a xmlns=
4894: "http://www.w3.org/TR/xhtml1/transitional" href=
4895: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45 ! wiz 4896: target="_top"><code xmlns="" class=
! 4897: "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27 rillig 4898: graphs from the output of <a xmlns=
4899: "http://www.w3.org/TR/xhtml1/transitional" href=
4900: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 ! wiz 4901: target="_top"><code xmlns="" class=
! 4902: "filename">pkgtools/pkgdep</code></a> (uses
1.34 wiz 4903: graphviz).</p>
1.1 grant 4904: </li>
4905:
4906: <li>
4907: <p><a xmlns=
4908: "http://www.w3.org/TR/xhtml1/transitional" href=
4909: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 ! wiz 4910: target="_top"><code xmlns="" class=
! 4911: "filename">pkgtools/pkglint</code></a>: The
1.27 rillig 4912: pkglint(1) program checks a pkgsrc entry for
4913: errors, lintpkgsrc(1) does various checks on the
4914: complete pkgsrc system.</p>
1.1 grant 4915: </li>
4916:
4917: <li>
4918: <p><a xmlns=
4919: "http://www.w3.org/TR/xhtml1/transitional" href=
4920: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45 ! wiz 4921: target="_top"><code xmlns="" class=
! 4922: "filename">pkgtools/pkgsurvey</code></a>: Report
! 4923: what packages you have installed.</p>
1.1 grant 4924: </li>
4925: </ul>
4926: </div>
4927:
4928: <p>Utilities for people maintaining or creating
4929: individual packages:</p>
4930:
4931: <div class="itemizedlist">
4932: <ul type="disc">
4933: <li>
4934: <p><a xmlns=
4935: "http://www.w3.org/TR/xhtml1/transitional" href=
4936: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 ! wiz 4937: target="_top"><code xmlns="" class=
! 4938: "filename">pkgtools/pkgdiff</code></a>: Automate
1.20 ben 4939: making and maintaining patches for a package
1.34 wiz 4940: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 4941: </li>
4942:
4943: <li>
4944: <p><a xmlns=
4945: "http://www.w3.org/TR/xhtml1/transitional" href=
4946: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45 ! wiz 4947: target="_top"><code xmlns="" class=
! 4948: "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20 ben 4949: "http://www.w3.org/TR/xhtml1/transitional" href=
4950: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 ! wiz 4951: target="_top"><code xmlns="" class=
! 4952: "filename">pkgtools/url2pkg</code></a>: Aids in
1.34 wiz 4953: converting to pkgsrc.</p>
1.1 grant 4954: </li>
4955:
4956: <li>
4957: <p><a xmlns=
4958: "http://www.w3.org/TR/xhtml1/transitional" href=
4959: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45 ! wiz 4960: target="_top"><code xmlns="" class=
! 4961: "filename">pkgtools/gensolpkg</code></a>: Convert
1.34 wiz 4962: pkgsrc to a Solaris package.</p>
1.1 grant 4963: </li>
4964: </ul>
4965: </div>
4966:
4967: <p>Utilities for people maintaining pkgsrc (or more
4968: obscure pkg utilities)</p>
4969:
4970: <div class="itemizedlist">
4971: <ul type="disc">
4972: <li>
4973: <p><a xmlns=
4974: "http://www.w3.org/TR/xhtml1/transitional" href=
4975: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.45 ! wiz 4976: target="_top"><code xmlns="" class=
! 4977: "filename">pkgtools/pkgconflict</code></a>: Find
1.20 ben 4978: packages that conflict but aren't marked as
1.34 wiz 4979: such.</p>
1.1 grant 4980: </li>
4981:
4982: <li>
4983: <p><a xmlns=
4984: "http://www.w3.org/TR/xhtml1/transitional" href=
4985: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45 ! wiz 4986: target="_top"><code xmlns="" class=
! 4987: "filename">pkgtools/pkg_comp</code></a>: Build
1.34 wiz 4988: packages in a chrooted area.</p>
1.1 grant 4989: </li>
4990:
4991: <li>
4992: <p><a xmlns=
4993: "http://www.w3.org/TR/xhtml1/transitional" href=
4994: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45 ! wiz 4995: target="_top"><code xmlns="" class=
! 4996: "filename">pkgtools/libkver</code></a>: Spoof
! 4997: kernel version for chrooted cross builds.</p>
1.1 grant 4998: </li>
4999: </ul>
5000: </div>
5001: </div>
5002:
5003: <div class="sect1" lang="en" xml:lang="en">
5004: <div class="titlepage">
5005: <div>
5006: <div>
5007: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5008: "non-root-pkgsrc" id=
1.38 dillo 5009: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 5010: as non-root</h2>
1.1 grant 5011: </div>
5012: </div>
5013: </div>
5014:
5015: <p>If you want to use pkgsrc as non-root user, you can
5016: set some variables to make pkgsrc work under these
1.33 jmmv 5017: conditions. At the very least, you need to set
5018: <code class="varname">UNPRIVILEGED</code> to
5019: “<span class="quote">yes</span>”; this will
5020: turn on unprivileged mode and set multiple related
5021: variables to allow installation of packages as
5022: non-root.</p>
5023:
5024: <p>In case the defaults are not enough, you may want to
5025: tune some other variables used. For example, if the
5026: automatic user/group detection leads to incorrect values
5027: (or not the ones you would like to use), you can change
5028: them by setting <code class=
5029: "varname">UNPRIVILEGED_USER</code> and <code class=
5030: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
5031:
5032: <p>As regards bootstrapping, please note that the
5033: <span><strong class="command">bootstrap</strong></span>
5034: script will ease non-root configuration when given the
5035: “<span class=
5036: "quote">--ignore-user-check</span>” flag, as it
5037: will choose and use multiple default directories under
1.45 ! wiz 5038: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 5039: class="filename">~/pkg</code> as the installation
1.33 jmmv 5040: targets. These directories can be overriden by the
5041: “<span class="quote">--prefix</span>” flag
5042: provided by the script, as well as some others that allow
5043: finer tuning of the tree layout.</p>
1.14 xtraeme 5044: </div>
5045:
5046: <div class="sect1" lang="en" xml:lang="en">
5047: <div class="titlepage">
5048: <div>
5049: <div>
5050: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5051: "resume-transfers" id=
1.38 dillo 5052: "resume-transfers"></a>7.5. How to resume
1.30 wiz 5053: transfers when fetching distfiles?</h2>
1.14 xtraeme 5054: </div>
5055: </div>
5056: </div>
5057:
1.15 xtraeme 5058: <p>By default resuming transfers in pkgsrc is disabled,
5059: but you can enable this feature by adding the option
5060: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45 ! wiz 5061: into <code xmlns=
! 5062: "http://www.w3.org/TR/xhtml1/transitional" class=
! 5063: "filename">/etc/mk.conf</code>. If, during a fetch step,
! 5064: an incomplete distfile is found, pkgsrc will try to
! 5065: resume it.</p>
1.15 xtraeme 5066:
5067: <p>You can also use a different program than the default
1.24 wiz 5068: <a href=
5069: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5070: <span class="citerefentry"><span class=
5071: "refentrytitle">ftp</span>(1)</span></a> by changing the
5072: <code class="varname">FETCH_CMD</code> variable. Don't
5073: forget to set <code class=
5074: "varname">FETCH_RESUME_ARGS</code> and <code class=
5075: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
5076: default values.</p>
1.14 xtraeme 5077:
1.45 ! wiz 5078: <p>For example, if you want to use <code xmlns=
! 5079: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5080: "filename">wget</code> to resume downloads, you'll have
5081: to use something like:</p>
5082: <pre class="programlisting">
1.34 wiz 5083: FETCH_CMD=wget
5084: FETCH_BEFORE_ARGS=--passive-ftp
5085: FETCH_RESUME_ARGS=-c
5086: FETCH_OUTPUT_ARGS=-O
1.14 xtraeme 5087: </pre>
1.1 grant 5088: </div>
5089:
5090: <div class="sect1" lang="en" xml:lang="en">
5091: <div class="titlepage">
5092: <div>
5093: <div>
5094: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5095: "XFree86-from-pkgsrc" id=
1.38 dillo 5096: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 5097: install/use XFree86 from pkgsrc?</h2>
5098: </div>
5099: </div>
5100: </div>
5101:
5102: <p>If you want to use XFree86 from pkgsrc instead of your
1.45 ! wiz 5103: system's own X11 (<code xmlns=
! 5104: "http://www.w3.org/TR/xhtml1/transitional" class=
! 5105: "filename">/usr/X11R6</code>, <code xmlns=
! 5106: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5107: "filename">/usr/openwin</code>, ...), you will have to
1.45 ! wiz 5108: add the following line into <code xmlns=
! 5109: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5110: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5111: <pre class="programlisting">
1.34 wiz 5112: X11_TYPE=XFree86
1.1 grant 5113: </pre>
5114: </div>
5115:
5116: <div class="sect1" lang="en" xml:lang="en">
5117: <div class="titlepage">
5118: <div>
5119: <div>
5120: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5121: "x.org-from-pkgsrc" id=
1.38 dillo 5122: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 5123: install/use X.org from pkgsrc?</h2>
5124: </div>
5125: </div>
5126: </div>
5127:
5128: <p>If you want to use X.org from pkgsrc instead of your
1.45 ! wiz 5129: system's own X11 (<code xmlns=
! 5130: "http://www.w3.org/TR/xhtml1/transitional" class=
! 5131: "filename">/usr/X11R6</code>, <code xmlns=
! 5132: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5133: "filename">/usr/openwin</code>, ...) you will have to add
1.45 ! wiz 5134: the following line into <code xmlns=
! 5135: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5136: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5137: <pre class="programlisting">
1.34 wiz 5138: X11_TYPE=xorg
1.1 grant 5139: </pre>
5140: </div>
5141:
5142: <div class="sect1" lang="en" xml:lang="en">
5143: <div class="titlepage">
5144: <div>
5145: <div>
5146: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5147: "fetch-behind-firewall" id=
1.38 dillo 5148: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 5149: files from behind a firewall</h2>
1.1 grant 5150: </div>
5151: </div>
5152: </div>
5153:
5154: <p>If you are sitting behind a firewall which does not
5155: allow direct connections to Internet hosts (i.e.
5156: non-NAT), you may specify the relevant proxy hosts. This
5157: is done using an environment variable in the form of a
5158: URL e.g. in Amdahl, the machine “<span class=
5159: "quote">orpheus.amdahl.com</span>” is one of the
5160: firewalls, and it uses port 80 as the proxy port number.
5161: So the proxy environment variables are:</p>
5162: <pre class="programlisting">
1.34 wiz 5163: ftp_proxy=ftp://orpheus.amdahl.com:80/
1.1 grant 5164: http_proxy=http://orpheus.amdahl.com:80/
5165: </pre>
5166: </div>
5167:
5168: <div class="sect1" lang="en" xml:lang="en">
5169: <div class="titlepage">
5170: <div>
5171: <div>
5172: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5173: "passive-ftp" id="passive-ftp"></a>7.9. How do
1.30 wiz 5174: I tell <span><strong class="command">make
1.14 xtraeme 5175: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 5176: </div>
5177: </div>
5178: </div>
5179:
5180: <p>This depends on which utility is used to retrieve
1.45 ! wiz 5181: distfiles. From <code xmlns=
! 5182: "http://www.w3.org/TR/xhtml1/transitional" class=
! 5183: "filename">bsd.pkg.mk</code>, <code class=
! 5184: "varname">FETCH_CMD</code> is assigned the first
! 5185: available command from the following list:</p>
1.34 wiz 5186:
5187: <div class="itemizedlist">
5188: <ul type="disc">
5189: <li>
1.45 ! wiz 5190: <p><code xmlns=
! 5191: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5192: "filename">${LOCALBASE}/bin/ftp</code></p>
5193: </li>
5194:
5195: <li>
1.45 ! wiz 5196: <p><code xmlns=
! 5197: "http://www.w3.org/TR/xhtml1/transitional" class=
! 5198: "filename">/usr/bin/ftp</code></p>
1.34 wiz 5199: </li>
5200: </ul>
5201: </div>
1.1 grant 5202:
5203: <p>On a default NetBSD installation, this will be
1.45 ! wiz 5204: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 5205: class="filename">/usr/bin/ftp</code>, which automatically
! 5206: tries passive connections first, and falls back to active
! 5207: connections if the server refuses to do passive. For the
! 5208: other tools, add the following to your <code xmlns=
! 5209: "http://www.w3.org/TR/xhtml1/transitional" class=
! 5210: "filename">/etc/mk.conf</code> file: <code class=
! 5211: "varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 5212:
1.45 ! wiz 5213: <p>Having that option present will prevent <code xmlns=
! 5214: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5215: "filename">/usr/bin/ftp</code> from falling back to
5216: active transfers.</p>
1.1 grant 5217: </div>
5218:
5219: <div class="sect1" lang="en" xml:lang="en">
5220: <div class="titlepage">
5221: <div>
5222: <div>
5223: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5224: "fetching-all-distfiles" id=
1.38 dillo 5225: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 5226: fetch all distfiles at once</h2>
5227: </div>
5228: </div>
5229: </div>
5230:
5231: <p>You would like to download all the distfiles in a
5232: single batch from work or university, where you can't run
1.14 xtraeme 5233: a <span><strong class="command">make
5234: fetch</strong></span>. There is an archive of distfiles
5235: on <a href=
1.1 grant 5236: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
5237: target="_top">ftp.NetBSD.org</a>, but downloading the
5238: entire directory may not be appropriate.</p>
5239:
1.14 xtraeme 5240: <p>The answer here is to do a <span><strong class=
1.45 ! wiz 5241: "command">make fetch-list</strong></span> in <code xmlns=
! 5242: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5243: "filename">/usr/pkgsrc</code> or one of it's
1.1 grant 5244: subdirectories, carry the resulting list to your machine
1.23 wiz 5245: at work/school and use it there. If you don't have a
1.24 wiz 5246: NetBSD-compatible <a href=
5247: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5248: <span class="citerefentry"><span class=
5249: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
5250: at work, don't forget to set <code class=
5251: "varname">FETCH_CMD</code> to something that fetches a
5252: URL:</p>
1.1 grant 5253:
5254: <p>At home:</p>
5255: <pre class="screen">
1.14 xtraeme 5256: <code class="prompt">%</code> <strong class=
5257: "userinput"><code>cd /usr/pkgsrc</code></strong>
5258: <code class="prompt">%</code> <strong class=
5259: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
5260: <code class="prompt">%</code> <strong class=
5261: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 5262: </pre>
5263:
5264: <p>At work:</p>
5265: <pre class="screen">
1.14 xtraeme 5266: <code class="prompt">%</code> <strong class=
5267: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 5268: </pre>
5269:
1.45 ! wiz 5270: <p>then tar up <code xmlns=
! 5271: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5272: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 5273:
5274: <p>If you have a machine running NetBSD, and you want to
5275: get <span class="emphasis"><em>all</em></span> distfiles
5276: (even ones that aren't for your machine architecture),
5277: you can do so by using the above-mentioned
1.14 xtraeme 5278: <span><strong class="command">make
5279: fetch-list</strong></span> approach, or fetch the
5280: distfiles directly by running:</p>
1.1 grant 5281: <pre class="screen">
1.14 xtraeme 5282: <code class="prompt">%</code> <strong class=
5283: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 5284: </pre>
5285:
1.14 xtraeme 5286: <p>If you even decide to ignore <code class=
5287: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
5288: can get everything by running:</p>
1.1 grant 5289: <pre class="screen">
1.14 xtraeme 5290: <code class="prompt">%</code> <strong class=
5291: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 5292: </pre>
5293: </div>
5294:
5295: <div class="sect1" lang="en" xml:lang="en">
5296: <div class="titlepage">
5297: <div>
5298: <div>
5299: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5300: "tmac.andoc-missing" id=
1.38 dillo 5301: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 5302: “<span class="quote">Don't know how to make
5303: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
5304: </div>
5305: </div>
5306: </div>
5307:
5308: <p>When compiling the <a xmlns=
5309: "http://www.w3.org/TR/xhtml1/transitional" href=
5310: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 ! wiz 5311: target="_top"><code xmlns="" class=
! 5312: "filename">pkgtools/pkg_install</code></a> package, you
! 5313: get the error from make that it doesn't know how to make
! 5314: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 5315: class="filename">/usr/share/tmac/tmac.andoc</code>? This
! 5316: indicates that you don't have installed the
1.23 wiz 5317: “<span class="quote">text</span>” set (nroff,
5318: ...) from the NetBSD base distribution on your machine.
5319: It is recommended to do that to format manpages.</p>
1.1 grant 5320:
5321: <p>In the case of the <a xmlns=
5322: "http://www.w3.org/TR/xhtml1/transitional" href=
5323: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 ! wiz 5324: target="_top"><code xmlns="" class=
! 5325: "filename">pkgtools/pkg_install</code></a> package, you
! 5326: can get away with setting <code class=
1.20 ben 5327: "varname">NOMAN=YES</code> either in the environment or
1.45 ! wiz 5328: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 5329: class="filename">/etc/mk.conf</code>.</p>
1.1 grant 5330: </div>
5331:
5332: <div class="sect1" lang="en" xml:lang="en">
5333: <div class="titlepage">
5334: <div>
5335: <div>
5336: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5337: "bsd.own.mk-missing" id=
1.38 dillo 5338: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 5339: “<span class="quote">Could not find
5340: bsd.own.mk</span>” mean?</h2>
5341: </div>
5342: </div>
5343: </div>
5344:
1.45 ! wiz 5345: <p>You didn't install the compiler set, <code xmlns=
! 5346: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5347: "filename">comp.tgz</code>, when you installed your
5348: NetBSD machine. Please get it and install it, by
1.45 ! wiz 5349: extracting it in <code xmlns=
! 5350: "http://www.w3.org/TR/xhtml1/transitional" class=
! 5351: "filename">/</code>:</p>
1.1 grant 5352: <pre class="screen">
1.14 xtraeme 5353: <code class="prompt">#</code> <strong class=
5354: "userinput"><code>cd /</code></strong>
5355: <code class="prompt">#</code> <strong class=
5356: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 5357: </pre>
5358:
1.45 ! wiz 5359: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 5360: class="filename">comp.tgz</code> is part of every NetBSD
! 5361: release. Get the one that corresponds to your release
! 5362: (determine via <span><strong class="command">uname
! 5363: -r</strong></span>).</p>
1.1 grant 5364: </div>
5365:
5366: <div class="sect1" lang="en" xml:lang="en">
5367: <div class="titlepage">
5368: <div>
5369: <div>
5370: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5371: "using-sudo-with-pkgsrc" id=
1.38 dillo 5372: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 5373: 'sudo' with pkgsrc</h2>
5374: </div>
5375: </div>
5376: </div>
5377:
5378: <p>When installing packages as non-root user and using
1.24 wiz 5379: the just-in-time <a href=
5380: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
5381: <span class="citerefentry"><span class=
5382: "refentrytitle">su</span>(1)</span></a> feature of
5383: pkgsrc, it can become annoying to type in the root
5384: password for each required package installed. To avoid
5385: this, the sudo package can be used, which does password
5386: caching over a limited time. To use it, install sudo
5387: (either as binary package or from <a xmlns=
5388: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5389: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45 ! wiz 5390: target="_top"><code xmlns="" class=
! 5391: "filename">security/sudo</code></a>) and then put the
! 5392: following into your <code xmlns=
! 5393: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 5394: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5395: <pre class="programlisting">
1.34 wiz 5396: .if exists(${LOCALBASE}/bin/sudo)
5397: SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
5398: .endif
1.1 grant 5399: </pre>
5400: </div>
5401:
5402: <div class="sect1" lang="en" xml:lang="en">
5403: <div class="titlepage">
5404: <div>
5405: <div>
5406: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5407: "faq.conf" id="faq.conf"></a>7.14. How do I
1.35 jmmv 5408: change the location of configuration files?</h2>
1.1 grant 5409: </div>
5410: </div>
5411: </div>
5412:
1.35 jmmv 5413: <p>As the system administrator, you can choose where
5414: configuration files are installed. The default settings
1.45 ! wiz 5415: make all these files go into <code xmlns=
! 5416: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 5417: "filename">${PREFIX}/etc</code> or some of its
5418: subdirectories; this may be suboptimal depending on your
5419: expectations (e.g., a read-only, NFS-exported
5420: <code class="varname">PREFIX</code> with a need of
5421: per-machine configuration of the provided packages).</p>
5422:
5423: <p>In order to change the defaults, you can modify the
5424: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45 ! wiz 5425: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 5426: class="filename">/etc/mk.conf</code>) to point to your
! 5427: preferred configuration directory; some common examples
! 5428: include <code xmlns=
! 5429: "http://www.w3.org/TR/xhtml1/transitional" class=
! 5430: "filename">/etc</code> or <code xmlns=
! 5431: "http://www.w3.org/TR/xhtml1/transitional" class=
! 5432: "filename">/etc/pkg</code>.</p>
1.35 jmmv 5433:
5434: <p>Furthermore, you can change this value on a
5435: per-package basis by setting the <code class=
5436: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
5437: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
5438: value usually matches the name of the package you would
5439: like to modify, that is, the contents of <code class=
5440: "varname">PKGBASE</code>.</p>
1.1 grant 5441:
1.35 jmmv 5442: <p>Note that, after changing these settings, you must
5443: rebuild and reinstall any affected packages.</p>
1.1 grant 5444: </div>
5445:
5446: <div class="sect1" lang="en" xml:lang="en">
5447: <div class="titlepage">
5448: <div>
5449: <div>
5450: <h2 class="title" style="clear: both"><a name=
5451: "audit-packages" id=
1.38 dillo 5452: "audit-packages"></a>7.15. Automated security
1.1 grant 5453: checks</h2>
5454: </div>
5455: </div>
5456: </div>
5457:
5458: <p>Please be aware that there can often be bugs in
5459: third-party software, and some of these bugs can leave a
5460: machine vulnerable to exploitation by attackers. In an
5461: effort to lessen the exposure, the NetBSD packages team
5462: maintains a database of known-exploits to packages which
5463: have at one time been included in pkgsrc. The database
5464: can be downloaded automatically, and a security audit of
5465: all packages installed on a system can take place. To do
5466: this, install the <a xmlns=
5467: "http://www.w3.org/TR/xhtml1/transitional" href=
5468: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 ! wiz 5469: target="_top"><code xmlns="" class=
! 5470: "filename">security/audit-packages</code></a> package. It
1.20 ben 5471: has two components:</p>
1.1 grant 5472:
5473: <div class="orderedlist">
5474: <ol type="1">
5475: <li>
1.34 wiz 5476: <p><span><strong class=
5477: "command">download-vulnerability-list</strong></span>,
1.1 grant 5478: an easy way to download a list of the security
5479: vulnerabilities information. This list is kept up
5480: to date by the NetBSD security officer and the
5481: NetBSD packages team, and is distributed from the
5482: NetBSD ftp server:</p>
5483:
5484: <p><a href=
5485: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 5486: target=
5487: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 5488: </li>
5489:
5490: <li>
1.34 wiz 5491: <p><span><strong class=
5492: "command">audit-packages</strong></span>, an easy
5493: way to audit the current machine, checking each
1.1 grant 5494: vulnerability which is known. If a vulnerable
5495: package is installed, it will be shown by output to
5496: stdout, including a description of the type of
5497: vulnerability, and a URL containing more
5498: information.</p>
5499: </li>
5500: </ol>
5501: </div>
5502:
1.23 wiz 5503: <p>Use of the <a xmlns=
5504: "http://www.w3.org/TR/xhtml1/transitional" href=
5505: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 ! wiz 5506: target="_top"><code xmlns="" class=
! 5507: "filename">security/audit-packages</code></a> package is
1.23 wiz 5508: strongly recommended! After “<span class=
5509: "quote">audit-packages</span>” is installed, please
5510: read the package's message, which you can get by running
5511: <strong class="userinput"><code>pkg_info -D
5512: audit-package</code></strong>.</p>
1.1 grant 5513: </div>
5514: </div>
5515: </div>
5516:
5517: <div class="part" lang="en" xml:lang="en">
5518: <div class="titlepage">
5519: <div>
5520: <div>
5521: <h1 class="title"><a name="developers-guide" id=
1.45 ! wiz 5522: "developers-guide"></a>Part 2. The pkgsrc
! 5523: developer's guide</h1>
1.1 grant 5524: </div>
5525: </div>
5526: </div>
5527:
5528: <div class="toc">
5529: <p><b>Table of Contents</b></p>
5530:
5531: <dl>
1.38 dillo 5532: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 5533: Package components - files, directories and
5534: contents</a></span></dt>
5535:
5536: <dd>
5537: <dl>
5538: <dt><span class="sect1"><a href=
1.45 ! wiz 5539: "#components.Makefile">8.1. <code xmlns=
! 5540: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5541: "filename">Makefile</code></a></span></dt>
5542:
5543: <dt><span class="sect1"><a href=
1.45 ! wiz 5544: "#components.distinfo">8.2. <code xmlns=
! 5545: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5546: "filename">distinfo</code></a></span></dt>
5547:
5548: <dt><span class="sect1"><a href=
1.38 dillo 5549: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 5550:
1.30 wiz 5551: <dt><span class="sect1"><a href=
1.38 dillo 5552: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 5553: files</a></span></dt>
1.27 rillig 5554:
5555: <dt><span class="sect1"><a href=
1.38 dillo 5556: "#components.optional">8.5. Optional
1.27 rillig 5557: files</a></span></dt>
5558:
1.38 dillo 5559: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 ! wiz 5560: <code xmlns=
! 5561: "http://www.w3.org/TR/xhtml1/transitional" class=
! 5562: "filename">work*</code></a></span></dt>
1.27 rillig 5563:
1.38 dillo 5564: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 ! wiz 5565: <code xmlns=
! 5566: "http://www.w3.org/TR/xhtml1/transitional" class=
! 5567: "filename">files/*</code></a></span></dt>
1.27 rillig 5568: </dl>
5569: </dd>
5570:
1.38 dillo 5571: <dt><span class="chapter"><a href="#makefile">9.
1.45 ! wiz 5572: Programming in <code xmlns=
! 5573: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5574: "filename">Makefile</code>s</a></span></dt>
5575:
5576: <dd>
5577: <dl>
5578: <dt><span class="sect1"><a href=
1.45 ! wiz 5579: "#makefile.variables">9.1. <code xmlns=
! 5580: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5581: "filename">Makefile</code> variables</a></span></dt>
5582:
1.27 rillig 5583: <dd>
5584: <dl>
5585: <dt><span class="sect2"><a href=
1.38 dillo 5586: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 5587: conventions</a></span></dt>
5588: </dl>
5589: </dd>
5590:
1.38 dillo 5591: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 5592: Code snippets</a></span></dt>
5593:
5594: <dd>
5595: <dl>
5596: <dt><span class="sect2"><a href=
1.38 dillo 5597: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 5598: list</a></span></dt>
5599:
5600: <dt><span class="sect2"><a href=
1.38 dillo 5601: "#converting-internal-to-external">9.2.2.
1.30 wiz 5602: Converting an internal list into an external
5603: list</a></span></dt>
1.25 rillig 5604:
5605: <dt><span class="sect2"><a href=
1.38 dillo 5606: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 5607: variables to a shell command</a></span></dt>
1.27 rillig 5608:
5609: <dt><span class="sect2"><a href=
1.38 dillo 5610: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 5611: guideline</a></span></dt>
5612:
5613: <dt><span class="sect2"><a href=
1.38 dillo 5614: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 5615: a bug in BSD Make</a></span></dt>
1.25 rillig 5616: </dl>
5617: </dd>
5618: </dl>
5619: </dd>
5620:
1.38 dillo 5621: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 5622: issues</a></span></dt>
5623:
5624: <dd>
5625: <dl>
1.38 dillo 5626: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 5627: ID</a></span></dt>
5628:
1.30 wiz 5629: <dt><span class="sect1"><a href=
1.38 dillo 5630: "#automatic-plist-generation">10.2. Semi-automatic
1.45 ! wiz 5631: <code xmlns=
! 5632: "http://www.w3.org/TR/xhtml1/transitional" class=
! 5633: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 5634:
1.38 dillo 5635: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 5636: Tweaking output of <span><strong class="command">make
5637: print-PLIST</strong></span></a></span></dt>
1.1 grant 5638:
1.38 dillo 5639: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 5640: Variable substitution in PLIST</a></span></dt>
5641:
1.30 wiz 5642: <dt><span class="sect1"><a href=
1.38 dillo 5643: "#manpage-compression">10.5.
1.1 grant 5644: Manpage-compression</a></span></dt>
5645:
1.30 wiz 5646: <dt><span class="sect1"><a href=
1.38 dillo 5647: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 5648: <code class=
1.14 xtraeme 5649: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5650:
1.30 wiz 5651: <dt><span class="sect1"><a href=
1.38 dillo 5652: "#platform-specific-plist">10.7. Platform specific
5653: and differing PLISTs</a></span></dt>
1.1 grant 5654:
5655: <dt><span class="sect1"><a href=
1.38 dillo 5656: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 5657: packages</a></span></dt>
5658: </dl>
5659: </dd>
5660:
1.38 dillo 5661: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 5662: Buildlink methodology</a></span></dt>
5663:
5664: <dd>
5665: <dl>
1.30 wiz 5666: <dt><span class="sect1"><a href=
1.38 dillo 5667: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 5668: to use buildlink3</a></span></dt>
1.1 grant 5669:
1.30 wiz 5670: <dt><span class="sect1"><a href=
1.45 ! wiz 5671: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
! 5672: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5673: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 5674:
5675: <dd>
5676: <dl>
5677: <dt><span class="sect2"><a href=
1.38 dillo 5678: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 5679: buildlink3.mk file</a></span></dt>
1.1 grant 5680:
5681: <dt><span class="sect2"><a href=
1.38 dillo 5682: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 5683: <code class=
5684: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
1.45 ! wiz 5685: <code>pkg</code></em></code> in <code xmlns=
! 5686: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5687: "filename">buildlink3.mk</code>
1.1 grant 5688: files</a></span></dt>
5689: </dl>
5690: </dd>
5691:
1.30 wiz 5692: <dt><span class="sect1"><a href=
1.45 ! wiz 5693: "#writing-builtin.mk">11.3. Writing <code xmlns=
! 5694: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5695: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 5696:
5697: <dd>
5698: <dl>
5699: <dt><span class="sect2"><a href=
1.38 dillo 5700: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 ! wiz 5701: <code xmlns=
! 5702: "http://www.w3.org/TR/xhtml1/transitional" class=
! 5703: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 5704:
5705: <dt><span class="sect2"><a href=
1.38 dillo 5706: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 5707: preferences for native or pkgsrc
5708: software</a></span></dt>
1.1 grant 5709: </dl>
5710: </dd>
5711: </dl>
5712: </dd>
5713:
1.38 dillo 5714: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 5715: pkginstall framework</a></span></dt>
5716:
5717: <dd>
5718: <dl>
5719: <dt><span class="sect1"><a href=
1.38 dillo 5720: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 5721: directories outside the installation
5722: prefix</a></span></dt>
5723:
5724: <dd>
5725: <dl>
5726: <dt><span class="sect2"><a href=
1.38 dillo 5727: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 5728: manipulation</a></span></dt>
5729:
5730: <dt><span class="sect2"><a href=
1.38 dillo 5731: "#files-outside-prefix">12.1.2. File
1.35 jmmv 5732: manipulation</a></span></dt>
5733: </dl>
5734: </dd>
5735:
1.38 dillo 5736: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 5737: Configuration files</a></span></dt>
5738:
5739: <dd>
5740: <dl>
5741: <dt><span class="sect2"><a href=
1.38 dillo 5742: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 5743: "varname">PKG_SYSCONFDIR</code> is
5744: set</a></span></dt>
5745:
5746: <dt><span class="sect2"><a href=
1.38 dillo 5747: "#conf-files-configure">12.2.2. Telling the
1.35 jmmv 5748: software were configuration files
5749: are</a></span></dt>
5750:
5751: <dt><span class="sect2"><a href=
1.38 dillo 5752: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 5753: installations</a></span></dt>
5754:
5755: <dt><span class="sect2"><a href=
1.38 dillo 5756: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 5757: of configuration files</a></span></dt>
5758: </dl>
5759: </dd>
5760:
1.38 dillo 5761: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 5762: System startup scripts</a></span></dt>
5763:
5764: <dd>
5765: <dl>
5766: <dt><span class="sect2"><a href=
1.38 dillo 5767: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 5768: of system startup scripts</a></span></dt>
5769: </dl>
5770: </dd>
5771:
5772: <dt><span class="sect1"><a href=
1.38 dillo 5773: "#users-and-groups">12.4. System users and
1.35 jmmv 5774: groups</a></span></dt>
5775:
1.38 dillo 5776: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 5777: System shells</a></span></dt>
5778:
5779: <dd>
5780: <dl>
5781: <dt><span class="sect2"><a href=
1.38 dillo 5782: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 5783: configuration files</a></span></dt>
5784: </dl>
5785: </dd>
5786: </dl>
5787: </dd>
5788:
1.38 dillo 5789: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 5790: handling</a></span></dt>
5791:
5792: <dd>
5793: <dl>
1.30 wiz 5794: <dt><span class="sect1"><a href=
1.38 dillo 5795: "#global-default-options">13.1. Global default
1.30 wiz 5796: options</a></span></dt>
1.1 grant 5797:
1.30 wiz 5798: <dt><span class="sect1"><a href=
1.38 dillo 5799: "#converting-to-options">13.2. Converting packages to
1.45 ! wiz 5800: use <code xmlns=
! 5801: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5802: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 5803: </dl>
5804: </dd>
5805:
1.38 dillo 5806: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 5807: process</a></span></dt>
5808:
5809: <dd>
5810: <dl>
1.38 dillo 5811: <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1 grant 5812: Program location</a></span></dt>
5813:
1.38 dillo 5814: <dt><span class="sect1"><a href="#main-targets">14.2.
1.1 grant 5815: Main targets</a></span></dt>
5816:
5817: <dt><span class="sect1"><a href=
1.38 dillo 5818: "#build.helpful-targets">14.3. Other helpful
1.1 grant 5819: targets</a></span></dt>
5820: </dl>
5821: </dd>
5822:
1.38 dillo 5823: <dt><span class="chapter"><a href="#fixes">15. Notes on
1.1 grant 5824: fixes for packages</a></span></dt>
5825:
5826: <dd>
5827: <dl>
1.30 wiz 5828: <dt><span class="sect1"><a href=
1.38 dillo 5829: "#general-operation">15.1. General
1.30 wiz 5830: operation</a></span></dt>
1.1 grant 5831:
5832: <dd>
5833: <dl>
5834: <dt><span class="sect2"><a href=
1.38 dillo 5835: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 5836: pull in variables from
5837: /etc/mk.conf</a></span></dt>
1.1 grant 5838:
5839: <dt><span class="sect2"><a href=
1.38 dillo 5840: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 5841: to install documentation</a></span></dt>
5842:
5843: <dt><span class="sect2"><a href=
1.38 dillo 5844: "#restricted-packages">15.1.3. Restricted
1.1 grant 5845: packages</a></span></dt>
5846:
5847: <dt><span class="sect2"><a href=
1.38 dillo 5848: "#dependencies">15.1.4. Handling
1.1 grant 5849: dependencies</a></span></dt>
5850:
5851: <dt><span class="sect2"><a href=
1.38 dillo 5852: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 5853: other packages</a></span></dt>
5854:
5855: <dt><span class="sect2"><a href=
1.38 dillo 5856: "#not-building-packages">15.1.6. Packages that
1.30 wiz 5857: cannot or should not be built</a></span></dt>
1.1 grant 5858:
5859: <dt><span class="sect2"><a href=
1.38 dillo 5860: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 5861: should not be deleted, once
5862: installed</a></span></dt>
1.1 grant 5863:
5864: <dt><span class="sect2"><a href=
1.38 dillo 5865: "#security-handling">15.1.8. Handling packages
1.1 grant 5866: with security problems</a></span></dt>
5867:
5868: <dt><span class="sect2"><a href=
1.38 dillo 5869: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 5870: bugs</a></span></dt>
5871:
5872: <dt><span class="sect2"><a href=
1.38 dillo 5873: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 5874: incrementing versions when fixing an existing
1.1 grant 5875: package</a></span></dt>
5876:
5877: <dt><span class="sect2"><a href=
1.38 dillo 5878: "#portability-of-packages">15.1.11. Portability
1.30 wiz 5879: of packages</a></span></dt>
1.1 grant 5880: </dl>
5881: </dd>
5882:
1.30 wiz 5883: <dt><span class="sect1"><a href=
1.38 dillo 5884: "#downloading-issues">15.2. Possible downloading
1.30 wiz 5885: issues</a></span></dt>
1.1 grant 5886:
5887: <dd>
5888: <dl>
5889: <dt><span class="sect2"><a href=
1.38 dillo 5890: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 5891: distfiles aren't available for plain
1.1 grant 5892: downloading</a></span></dt>
5893:
5894: <dt><span class="sect2"><a href=
1.38 dillo 5895: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 5896: handle modified distfiles with the 'old'
5897: name</a></span></dt>
1.1 grant 5898: </dl>
5899: </dd>
5900:
1.30 wiz 5901: <dt><span class="sect1"><a href=
1.38 dillo 5902: "#configuration-gotchas">15.3. Configuration
1.30 wiz 5903: gotchas</a></span></dt>
1.1 grant 5904:
5905: <dd>
5906: <dl>
5907: <dt><span class="sect2"><a href=
1.38 dillo 5908: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 5909: libtool</a></span></dt>
5910:
5911: <dt><span class="sect2"><a href=
1.38 dillo 5912: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 5913: packages that already support
5914: libtool</a></span></dt>
5915:
5916: <dt><span class="sect2"><a href=
1.38 dillo 5917: "#autoconf-automake">15.3.3. GNU
1.1 grant 5918: Autoconf/Automake</a></span></dt>
5919: </dl>
5920: </dd>
5921:
1.30 wiz 5922: <dt><span class="sect1"><a href=
1.38 dillo 5923: "#building-considerations">15.4. Building
1.30 wiz 5924: considerations</a></span></dt>
1.1 grant 5925:
5926: <dd>
5927: <dl>
5928: <dt><span class="sect2"><a href=
1.38 dillo 5929: "#cpp-defines">15.4.1. CPP
1.30 wiz 5930: defines</a></span></dt>
1.1 grant 5931: </dl>
5932: </dd>
5933:
1.30 wiz 5934: <dt><span class="sect1"><a href=
1.38 dillo 5935: "#package-specific-actions">15.5. Package specific
1.30 wiz 5936: actions</a></span></dt>
1.1 grant 5937:
5938: <dd>
5939: <dl>
5940: <dt><span class="sect2"><a href=
1.38 dillo 5941: "#user-interaction">15.5.1. User
1.2 hubertf 5942: interaction</a></span></dt>
1.1 grant 5943:
5944: <dt><span class="sect2"><a href=
1.38 dillo 5945: "#handling-licenses">15.5.2. Handling
1.1 grant 5946: licenses</a></span></dt>
5947:
5948: <dt><span class="sect2"><a href=
1.38 dillo 5949: "#installing-score-files">15.5.3. Installing
1.30 wiz 5950: score files</a></span></dt>
1.1 grant 5951:
5952: <dt><span class="sect2"><a href=
1.38 dillo 5953: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 5954: scripts</a></span></dt>
5955:
5956: <dt><span class="sect2"><a href=
1.38 dillo 5957: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 5958: hardcoded paths to other
5959: interpreters</a></span></dt>
1.1 grant 5960:
5961: <dt><span class="sect2"><a href=
1.38 dillo 5962: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 5963: modules</a></span></dt>
5964:
5965: <dt><span class="sect2"><a href=
1.38 dillo 5966: "#faq.info-files">15.5.7. Packages installing
1.1 grant 5967: info files</a></span></dt>
5968:
5969: <dt><span class="sect2"><a href=
1.38 dillo 5970: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 5971: GConf2 data files</a></span></dt>
1.1 grant 5972:
5973: <dt><span class="sect2"><a href=
1.38 dillo 5974: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 5975: installing scrollkeeper data
5976: files</a></span></dt>
1.1 grant 5977:
5978: <dt><span class="sect2"><a href=
1.38 dillo 5979: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 5980: fonts</a></span></dt>
5981:
5982: <dt><span class="sect2"><a href=
1.38 dillo 5983: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 5984: modules</a></span></dt>
5985:
5986: <dt><span class="sect2"><a href=
1.38 dillo 5987: "#sgml-xml-data">15.5.12. Packages installing
1.30 wiz 5988: SGML or XML data</a></span></dt>
1.1 grant 5989:
5990: <dt><span class="sect2"><a href=
1.38 dillo 5991: "#mime-database">15.5.13. Packages installing
1.1 grant 5992: extensions to the MIME database</a></span></dt>
5993:
5994: <dt><span class="sect2"><a href=
1.38 dillo 5995: "#intltool">15.5.14. Packages using
1.1 grant 5996: intltool</a></span></dt>
1.18 xtraeme 5997:
5998: <dt><span class="sect2"><a href=
1.38 dillo 5999: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 6000: startup scripts</a></span></dt>
1.1 grant 6001: </dl>
6002: </dd>
6003:
1.30 wiz 6004: <dt><span class="sect1"><a href=
1.38 dillo 6005: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 6006: author</a></span></dt>
1.1 grant 6007: </dl>
6008: </dd>
6009:
1.38 dillo 6010: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 6011: Debugging</a></span></dt>
6012:
1.38 dillo 6013: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 6014: Submitting and Committing</a></span></dt>
6015:
6016: <dd>
6017: <dl>
1.30 wiz 6018: <dt><span class="sect1"><a href=
1.38 dillo 6019: "#submitting-your-package">17.1. Submitting your
1.30 wiz 6020: packages</a></span></dt>
1.1 grant 6021:
1.30 wiz 6022: <dt><span class="sect1"><a href=
1.41 wiz 6023: "#general-notes-for-changes">17.2. General notes when
6024: adding, updating, or removing
6025: packages</a></span></dt>
6026:
6027: <dt><span class="sect1"><a href=
6028: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 6029: package into CVS</a></span></dt>
1.1 grant 6030:
1.30 wiz 6031: <dt><span class="sect1"><a href=
1.41 wiz 6032: "#updating-package">17.4. Updating a package to a
1.30 wiz 6033: newer version</a></span></dt>
1.1 grant 6034:
1.30 wiz 6035: <dt><span class="sect1"><a href=
1.41 wiz 6036: "#moving-package">17.5. Moving a package in
1.30 wiz 6037: pkgsrc</a></span></dt>
1.1 grant 6038: </dl>
6039: </dd>
6040: </dl>
6041: </div>
6042:
6043: <div class="chapter" lang="en" xml:lang="en">
6044: <div class="titlepage">
6045: <div>
6046: <div>
1.27 rillig 6047: <h2 class="title"><a name="components" id=
1.38 dillo 6048: "components"></a>Chapter 8. Package
1.27 rillig 6049: components - files, directories and contents</h2>
1.25 rillig 6050: </div>
6051: </div>
6052: </div>
6053:
6054: <div class="toc">
6055: <p><b>Table of Contents</b></p>
6056:
6057: <dl>
6058: <dt><span class="sect1"><a href=
1.45 ! wiz 6059: "#components.Makefile">8.1. <code xmlns=
! 6060: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6061: "filename">Makefile</code></a></span></dt>
6062:
6063: <dt><span class="sect1"><a href=
1.45 ! wiz 6064: "#components.distinfo">8.2. <code xmlns=
! 6065: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6066: "filename">distinfo</code></a></span></dt>
6067:
6068: <dt><span class="sect1"><a href=
1.38 dillo 6069: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 6070:
1.30 wiz 6071: <dt><span class="sect1"><a href=
1.38 dillo 6072: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6073: files</a></span></dt>
1.25 rillig 6074:
1.27 rillig 6075: <dt><span class="sect1"><a href=
1.38 dillo 6076: "#components.optional">8.5. Optional
1.27 rillig 6077: files</a></span></dt>
1.25 rillig 6078:
1.38 dillo 6079: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 ! wiz 6080: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 6081: class="filename">work*</code></a></span></dt>
1.25 rillig 6082:
1.38 dillo 6083: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 ! wiz 6084: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 6085: class="filename">files/*</code></a></span></dt>
1.25 rillig 6086: </dl>
6087: </div>
6088:
1.27 rillig 6089: <p>Whenever you're preparing a package, there are a number
6090: of files involved which are described in the following
6091: sections.</p>
1.25 rillig 6092:
6093: <div class="sect1" lang="en" xml:lang="en">
6094: <div class="titlepage">
6095: <div>
6096: <div>
6097: <h2 class="title" style="clear: both"><a name=
1.27 rillig 6098: "components.Makefile" id=
1.45 ! wiz 6099: "components.Makefile"></a>8.1. <code xmlns=
! 6100: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6101: "filename">Makefile</code></h2>
1.25 rillig 6102: </div>
6103: </div>
6104: </div>
6105:
1.27 rillig 6106: <p>Building, installation and creation of a binary
1.45 ! wiz 6107: package are all controlled by the package's <code xmlns=
! 6108: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6109: "filename">Makefile</code>. The <code xmlns=
! 6110: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6111: "filename">Makefile</code> describes various things about
6112: a package, for example from where to get it, how to
6113: configure, build, and install it.</p>
6114:
1.45 ! wiz 6115: <p>A package <code xmlns=
! 6116: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6117: "filename">Makefile</code> contains several sections that
! 6118: describe the package.</p>
1.25 rillig 6119:
1.27 rillig 6120: <p>In the first section there are the following
6121: variables, which should appear exactly in the order given
6122: here.</p>
1.25 rillig 6123:
6124: <div class="itemizedlist">
6125: <ul type="disc">
6126: <li>
1.27 rillig 6127: <p><code class="varname">DISTNAME</code> is the
6128: basename of the distribution file to be downloaded
6129: from the package's website.</p>
6130: </li>
6131:
6132: <li>
6133: <p><code class="varname">PKGNAME</code> is the name
6134: of the package, as used by pkgsrc. You only need to
6135: provide it if it differs from DISTNAME. Usually it
6136: is the directory name together with the version
6137: number. It must match the regular expression
6138: <code class=
6139: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
6140: that is, it starts with a letter or digit, and
6141: contains only letters, digits, dashes, underscores,
6142: dots and plus signs.</p>
1.25 rillig 6143: </li>
6144:
6145: <li>
1.27 rillig 6146: <p><code class="varname">CATEGORIES</code> is a
6147: list of categories which the package fits in. You
6148: can choose any of the top-level directories of
6149: pkgsrc for it.</p>
1.45 ! wiz 6150:
! 6151: <p>Currently the following values are available for
! 6152: <code class="varname">CATEGORIES</code>. If more
! 6153: than one is used, they need to be separated by
! 6154: spaces:</p>
! 6155: <pre class="programlisting">
! 6156: archivers cross geography meta-pkgs security
! 6157: audio databases graphics misc shells
! 6158: benchmarks devel ham multimedia sysutils
! 6159: biology editors inputmethod net textproc
! 6160: cad emulators lang news time
! 6161: chat finance mail parallel wm
! 6162: comms fonts math pkgtools www
! 6163: converters games mbone print x11
! 6164: </pre>
1.25 rillig 6165: </li>
6166:
6167: <li>
1.27 rillig 6168: <p><code class="varname">MASTER_SITES</code> is a
6169: list of URLs where the distribution files can be
6170: downloaded. Each URL must end with a slash.</p>
1.45 ! wiz 6171:
! 6172: <p>The <code class="varname">MASTER_SITES</code>
! 6173: may make use of the following predefined sites:</p>
! 6174: <pre class="programlisting">
! 6175: ${MASTER_SITE_APACHE}
! 6176: ${MASTER_SITE_BACKUP}
! 6177: ${MASTER_SITE_CYGWIN}
! 6178: ${MASTER_SITE_DEBIAN}
! 6179: ${MASTER_SITE_FREEBSD}
! 6180: ${MASTER_SITE_FREEBSD_LOCAL}
! 6181: ${MASTER_SITE_GNOME}
! 6182: ${MASTER_SITE_GNU}
! 6183: ${MASTER_SITE_GNUSTEP}
! 6184: ${MASTER_SITE_IFARCHIVE}
! 6185: ${MASTER_SITE_MOZILLA}
! 6186: ${MASTER_SITE_OPENOFFICE}
! 6187: ${MASTER_SITE_PERL_CPAN}
! 6188: ${MASTER_SITE_R_CRAN}
! 6189: ${MASTER_SITE_SOURCEFORGE}
! 6190: ${MASTER_SITE_SUNSITE}
! 6191: ${MASTER_SITE_SUSE}
! 6192: ${MASTER_SITE_TEX_CTAN}
! 6193: ${MASTER_SITE_XCONTRIB}
! 6194: ${MASTER_SITE_XEMACS}
! 6195:
! 6196: </pre>
! 6197:
! 6198: <p>If one of these predefined sites is chosen, you
! 6199: may want to specify a subdirectory of that site.
! 6200: Since these macros may expand to more than one
! 6201: actual site, you <span class=
! 6202: "emphasis"><em>must</em></span> use the following
! 6203: construct to specify a subdirectory:</p>
! 6204: <pre class="programlisting">
! 6205: ${MASTER_SITE_GNU:=subdirectory/name/}
! 6206: ${MASTER_SITE_SOURCEFORGE:=project_name/}
! 6207: </pre>
! 6208:
! 6209: <p>Note the trailing slash after the subdirectory
! 6210: name.</p>
! 6211:
! 6212: <p>If the package has multiple <code class=
! 6213: "varname">DISTFILES</code> or multiple <code class=
! 6214: "varname">PATCHFILES</code> from different sites,
! 6215: set <code class="varname">SITES_foo</code> to a
! 6216: list of URI's where file “<span class=
! 6217: "quote">foo</span>” may be found.
! 6218: “<span class="quote">foo</span>”
! 6219: includes the suffix, e.g.</p>
! 6220: <pre class="programlisting">
! 6221: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
! 6222: DISTFILES+= foo-file.tar.gz
! 6223: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
! 6224: http://www.somewhereelse.com/mirror/somehow/
! 6225: </pre>
! 6226: </li>
! 6227:
! 6228: <li>
! 6229: <p><code class="varname">DISTFILES</code>: Name(s)
! 6230: of archive file(s) containing distribution. The
! 6231: default is <code xmlns=
! 6232: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6233: "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
! 6234: Should only be set if you have more than one
! 6235: distfile.</p>
! 6236:
! 6237: <p>Note that the normal default setting of
! 6238: <code class="varname">DISTFILES</code> must be made
! 6239: explicit if you want to add to it (rather than
! 6240: replace it), as you usually would.</p>
! 6241: </li>
! 6242:
! 6243: <li>
! 6244: <p><code class="varname">EXTRACT_SUFX</code>:
! 6245: Suffix of the distribution file, will be appended
! 6246: to <code class="varname">DISTNAME</code>. Defaults
! 6247: to <code xmlns=
! 6248: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6249: "filename">.tar.gz</code>.</p>
! 6250: </li>
! 6251: </ul>
! 6252: </div>
! 6253:
! 6254: <p>The second section contains information about
! 6255: separately downloaded patches, if any.</p>
! 6256:
! 6257: <div class="itemizedlist">
! 6258: <ul type="disc">
! 6259: <li>
! 6260: <p><code class="varname">PATCHFILES</code> Name(s)
! 6261: of additional files that contain distribution
! 6262: patches. There is no default. pkgsrc will look for
! 6263: them at <code class="varname">PATCH_SITES</code>.
! 6264: They will automatically be uncompressed before
! 6265: patching if the names end with <code xmlns=
! 6266: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6267: "filename">.gz</code> or <code xmlns=
! 6268: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6269: "filename">.Z</code>.</p>
! 6270: </li>
! 6271:
! 6272: <li>
! 6273: <p><code class="varname">PATCH_SITES</code>:
! 6274: Primary location(s) for distribution patch files
! 6275: (see <code class="varname">PATCHFILES</code> below)
! 6276: if not found locally.</p>
1.25 rillig 6277: </li>
6278: </ul>
6279: </div>
6280:
1.45 ! wiz 6281: <p>The third section contains the following
1.27 rillig 6282: variables.</p>
1.25 rillig 6283:
1.27 rillig 6284: <div class="itemizedlist">
6285: <ul type="disc">
6286: <li>
6287: <p><code class="varname">MAINTAINER</code> is the
1.45 ! wiz 6288: email address of the contact person for this
! 6289: package. The person who feels responsible for this
! 6290: package, and who is most likely to look at problems
! 6291: or questions regarding this package which have been
! 6292: reported with <a href=
! 6293: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
! 6294: <span class="citerefentry"><span class=
! 6295: "refentrytitle">send-pr</span>(1)</span></a>. The
! 6296: right person to contact before making major changes
! 6297: to the package. When packaging a new program, set
! 6298: <code class="varname">MAINTAINER</code> to
! 6299: yourself. If you really can't maintain the package
! 6300: for future updates, set it to <code class=
! 6301: "email"><<a href=
! 6302: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.27 rillig 6303: </li>
1.25 rillig 6304:
1.27 rillig 6305: <li>
6306: <p><code class="varname">HOMEPAGE</code> is a URL
6307: where users can find more information about the
1.23 wiz 6308: package.</p>
6309: </li>
1.1 grant 6310:
1.23 wiz 6311: <li>
6312: <p><code class="varname">COMMENT</code> is a
1.45 ! wiz 6313: one-line description of the package (should not
! 6314: include the package name).</p>
1.23 wiz 6315: </li>
6316: </ul>
6317: </div>
1.1 grant 6318:
1.45 ! wiz 6319: <p>Other variables that affect the build:</p>
1.1 grant 6320:
1.45 ! wiz 6321: <div class="itemizedlist">
! 6322: <ul type="disc">
! 6323: <li>
! 6324: <p><code class="varname">WRKSRC</code>: The
! 6325: subdirectory of <code xmlns=
! 6326: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6327: "filename">${WRKDIR}</code> to which the
! 6328: distribution actually unpacks. The default is
! 6329: <code xmlns=
! 6330: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6331: "filename">${WRKDIR}/${DISTNAME}</code>. The value
! 6332: of <code class="varname">WRKSRC</code> should be
! 6333: set explicitly if the package does not follow
! 6334: standard conventions and include the package's name
! 6335: as a subdirectory.</p>
! 6336: </li>
! 6337: </ul>
1.1 grant 6338: </div>
6339:
6340: <p>Please pay attention to the following gotchas:</p>
6341:
6342: <div class="itemizedlist">
6343: <ul type="disc">
6344: <li>
1.14 xtraeme 6345: <p>Add <code class="varname">MANCOMPRESSED</code>
6346: if manpages are installed in compressed form by the
1.45 ! wiz 6347: package; see comment in <code xmlns=
! 6348: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6349: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 6350: </li>
6351:
6352: <li>
1.45 ! wiz 6353: <p>Replace <code xmlns=
! 6354: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6355: "filename">/usr/local</code> with
! 6356: “<span class="quote">${PREFIX}</span>”
! 6357: in all files (see patches, below).</p>
1.1 grant 6358: </li>
6359:
6360: <li>
6361: <p>If the package installs any info files, see
6362: <a href="#faq.info-files" title=
1.45 ! wiz 6363: "15.5.7. Packages installing info files">Section 15.5.7,
! 6364: “Packages installing info
1.1 grant 6365: files”</a>.</p>
6366: </li>
6367: </ul>
6368: </div>
6369: </div>
6370:
6371: <div class="sect1" lang="en" xml:lang="en">
6372: <div class="titlepage">
6373: <div>
6374: <div>
6375: <h2 class="title" style="clear: both"><a name=
6376: "components.distinfo" id=
1.45 ! wiz 6377: "components.distinfo"></a>8.2. <code xmlns=
! 6378: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6379: "filename">distinfo</code></h2>
1.1 grant 6380: </div>
6381: </div>
6382: </div>
6383:
6384: <p>Most important, the mandatory message digest, or
6385: checksum, of all the distfiles needed for the package to
6386: compile, confirming they match the original file
6387: distributed by the author. This ensures that the distfile
6388: retrieved from the Internet has not been corrupted during
6389: transfer or altered by a malign force to introduce a
1.14 xtraeme 6390: security hole. It is generated using the
6391: <span><strong class="command">make
6392: makesum</strong></span> command. The digest algorithm
6393: used was, at one stage, md5, but that was felt lacking
6394: compared to sha1, and so sha1 is now the default
1.1 grant 6395: algorithm. The distfile size is also generated and stored
6396: in new distinfo files. The <a xmlns=
6397: "http://www.w3.org/TR/xhtml1/transitional" href=
6398: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 ! wiz 6399: target="_top"><code xmlns="" class=
! 6400: "filename">pkgtools/digest</code></a> utility calculates
1.20 ben 6401: all of the digests in the distinfo file, and it provides
6402: various different algorithms. At the current time, the
6403: algorithms provided are: <span class=
6404: "emphasis"><em>md5</em></span>, <span class=
6405: "emphasis"><em>rmd160</em></span>, <span class=
6406: "emphasis"><em>sha1</em></span>, <span class=
6407: "emphasis"><em>sha256</em></span>, <span class=
6408: "emphasis"><em>sha384</em></span> and <span class=
6409: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 6410:
6411: <p>Some packages have different sets of distfiles on a
6412: per architecture basis, for example <a xmlns=
6413: "http://www.w3.org/TR/xhtml1/transitional" href=
6414: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45 ! wiz 6415: target="_top"><code xmlns="" class=
! 6416: "filename">www/navigator</code></a>). These are kept in
! 6417: the same distinfo file and care should be taken when
1.20 ben 6418: upgrading such a package to ensure distfile information
6419: is not lost.</p>
1.1 grant 6420:
6421: <p>The message digest/checksum for all the official
1.45 ! wiz 6422: patches found in the <code xmlns=
! 6423: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6424: "filename">patches/</code> directory (see <a href=
6425: "#components.patches" title=
1.38 dillo 6426: "8.3. patches/*">Section 8.3,
1.1 grant 6427: “patches/*”</a>) for the package is also
1.45 ! wiz 6428: stored in the <code xmlns=
! 6429: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6430: "filename">distinfo</code> file. This is a message
! 6431: digest/checksum of all lines in the patch file except the
! 6432: NetBSD RCS Id. This file is generated by invoking
! 6433: <span><strong class="command">make
1.14 xtraeme 6434: makepatchsum</strong></span> (or <span><strong class=
6435: "command">make mps</strong></span> if you're in a
6436: hurry).</p>
1.1 grant 6437: </div>
6438:
6439: <div class="sect1" lang="en" xml:lang="en">
6440: <div class="titlepage">
6441: <div>
6442: <div>
6443: <h2 class="title" style="clear: both"><a name=
6444: "components.patches" id=
1.38 dillo 6445: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 6446: </div>
6447: </div>
6448: </div>
6449:
6450: <p>This directory contains files that are used by the
6451: <a href=
6452: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
6453: <span class="citerefentry"><span class=
6454: "refentrytitle">patch</span>(1)</span></a> command to
6455: modify the sources as distributed in the distribution
6456: file into a form that will compile and run perfectly on
6457: NetBSD. The files are applied successively in alphabetic
6458: order (as returned by a shell “<span class=
6459: "quote">patches/patch-*</span>” glob expansion), so
1.45 ! wiz 6460: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 6461: class="filename">patch-aa</code> is applied before
! 6462: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 6463: class="filename">patch-ab</code>, etc.</p>
! 6464:
! 6465: <p>The <code xmlns=
! 6466: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6467: "filename">patch-*</code> files should be in
! 6468: <span><strong class="command">diff -bu</strong></span>
! 6469: format, and apply without a fuzz to avoid problems. (To
! 6470: force patches to apply with fuzz you can set <code class=
1.14 xtraeme 6471: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 6472: not put changes for more than one file into a single
6473: patch-file, as this will make future modifications more
6474: difficult.</p>
6475:
6476: <p>Similar, a file should be patched at most once, not
6477: several times by several different patches. If a file
6478: needs several patches, they should be combined into one
6479: file.</p>
6480:
6481: <p>One important thing to mention is to pay attention
6482: that no RCS IDs get stored in the patch files, as these
6483: will cause problems when later checked into the NetBSD
1.14 xtraeme 6484: CVS tree. Use the <span><strong class=
6485: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 6486: "http://www.w3.org/TR/xhtml1/transitional" href=
6487: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 ! wiz 6488: target="_top"><code xmlns="" class=
! 6489: "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20 ben 6490: these problems.</p>
1.1 grant 6491:
6492: <p>For even more automation, we recommend using
1.14 xtraeme 6493: <span><strong class="command">mkpatches</strong></span>
6494: from the same package to make a whole set of patches. You
6495: just have to backup files before you edit them to
1.45 ! wiz 6496: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 6497: class="filename">filename.orig</code>, e.g. with
1.14 xtraeme 6498: <span><strong class="command">cp -p filename
6499: filename.orig</strong></span> or, easier, by using
6500: <span><strong class="command">pkgvi</strong></span> again
6501: from the same package. If you upgrade a package this way,
6502: you can easily compare the new set of patches with the
6503: previously existing one with <span><strong class=
6504: "command">patchdiff</strong></span>.</p>
1.1 grant 6505:
6506: <p>When you have finished a package, remember to generate
6507: the checksums for the patch files by using the
1.14 xtraeme 6508: <span><strong class="command">make
6509: makepatchsum</strong></span> command, see <a href=
6510: "#components.distinfo" title=
1.38 dillo 6511: "8.2. distinfo">Section 8.2,
1.45 ! wiz 6512: “<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 6513: class="filename">distinfo</code>”</a>.</p>
1.1 grant 6514:
6515: <p>Patch files that are distributed by the author or
1.14 xtraeme 6516: other maintainers can be listed in <code class=
6517: "varname">$PATCHFILES</code>.</p>
1.1 grant 6518:
6519: <p>If it is desired to store any patches that should not
6520: be committed into pkgsrc, they can be kept outside the
1.45 ! wiz 6521: pkgsrc tree in the <code xmlns=
! 6522: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6523: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 6524: tree there is expected to have the same
6525: “<span class="quote">category/package</span>”
6526: structure as pkgsrc, and patches are expected to be
1.45 ! wiz 6527: stored inside these dirs (also known as <code xmlns=
! 6528: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6529: "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
1.45 ! wiz 6530: you want to keep a private patch for <code xmlns=
! 6531: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6532: "filename">pkgsrc/graphics/png</code>, keep it in
1.45 ! wiz 6533: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 6534: class=
1.14 xtraeme 6535: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
6536: files in the named directory are expected to be patch
1.1 grant 6537: files, and <span class="emphasis"><em>they are applied
6538: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 6539: </div>
6540:
6541: <div class="sect1" lang="en" xml:lang="en">
6542: <div class="titlepage">
6543: <div>
6544: <div>
6545: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6546: "other-mandatory-files" id=
1.38 dillo 6547: "other-mandatory-files"></a>8.4. Other
1.27 rillig 6548: mandatory files</h2>
6549: </div>
6550: </div>
6551: </div>
6552:
6553: <div class="variablelist">
6554: <dl>
1.45 ! wiz 6555: <dt><span class="term"><code xmlns=
! 6556: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6557: "filename">DESCR</code></span></dt>
6558:
6559: <dd>
6560: <p>A multi-line description of the piece of
6561: software. This should include any credits where
6562: they are due. Please bear in mind that others do
6563: not share your sense of humour (or spelling
6564: idiosyncrasies), and that others will read
6565: everything that you write here.</p>
6566: </dd>
6567:
1.45 ! wiz 6568: <dt><span class="term"><code xmlns=
! 6569: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6570: "filename">PLIST</code></span></dt>
6571:
6572: <dd>
6573: <p>This file governs the files that are installed
6574: on your system: all the binaries, manual pages,
6575: etc. There are other directives which may be
6576: entered in this file, to control the creation and
6577: deletion of directories, and the location of
6578: inserted files. See <a href="#plist" title=
1.38 dillo 6579: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 6580: <i>PLIST issues</i></a> for more information.</p>
6581: </dd>
6582: </dl>
6583: </div>
6584: </div>
6585:
6586: <div class="sect1" lang="en" xml:lang="en">
6587: <div class="titlepage">
6588: <div>
6589: <div>
6590: <h2 class="title" style="clear: both"><a name=
6591: "components.optional" id=
1.38 dillo 6592: "components.optional"></a>8.5. Optional
1.27 rillig 6593: files</h2>
6594: </div>
6595: </div>
6596: </div>
6597:
6598: <div class="variablelist">
6599: <dl>
1.45 ! wiz 6600: <dt><span class="term"><code xmlns=
! 6601: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6602: "filename">INSTALL</code></span></dt>
6603:
6604: <dd>
6605: <p>This shell script is invoked twice by <a href=
6606: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6607: <span class="citerefentry"><span class=
6608: "refentrytitle">pkg_add</span>(1)</span></a>. First
6609: time after package extraction and before files are
6610: moved in place, the second time after the files to
6611: install are moved in place. This can be used to do
6612: any custom procedures not possible with @exec
1.45 ! wiz 6613: commands in <code xmlns=
! 6614: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6615: "filename">PLIST</code>. See <a href=
1.27 rillig 6616: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6617: <span class="citerefentry"><span class=
6618: "refentrytitle">pkg_add</span>(1)</span></a> and
6619: <a href=
6620: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6621: <span class="citerefentry"><span class=
6622: "refentrytitle">pkg_create</span>(1)</span></a> for
6623: more information.</p>
6624: </dd>
6625:
1.45 ! wiz 6626: <dt><span class="term"><code xmlns=
! 6627: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6628: "filename">DEINSTALL</code></span></dt>
6629:
6630: <dd>
6631: <p>This script is executed before and after any
6632: files are removed. It is this script's
6633: responsibility to clean up any additional messy
6634: details around the package's installation, since
6635: all pkg_delete knows is how to delete the files
6636: created in the original distribution. See <a href=
6637: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
6638: <span class="citerefentry"><span class=
6639: "refentrytitle">pkg_delete</span>(1)</span></a> and
6640: <a href=
6641: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6642: <span class="citerefentry"><span class=
6643: "refentrytitle">pkg_create</span>(1)</span></a> for
6644: more information.</p>
6645: </dd>
6646:
1.45 ! wiz 6647: <dt><span class="term"><code xmlns=
! 6648: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6649: "filename">MESSAGE</code></span></dt>
6650:
6651: <dd>
6652: <p>Display this file after installation of the
6653: package. Useful for things like legal notices on
6654: almost-free software and hints for updating config
6655: files after installing modules for apache, PHP etc.
6656: Please note that you can modify variables in it
6657: easily by using <code class=
6658: "varname">MESSAGE_SUBST</code> in the package's
1.45 ! wiz 6659: <code xmlns=
! 6660: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6661: "filename">Makefile</code>:</p>
1.27 rillig 6662: <pre class="programlisting">
6663: MESSAGE_SUBST+= SOMEVAR="somevalue"
6664: </pre>
6665:
6666: <p>replaces "${SOMEVAR}" with “<span class=
1.45 ! wiz 6667: "quote">somevalue</span>” in <code xmlns=
! 6668: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6669: "filename">MESSAGE</code>.</p>
6670: </dd>
6671: </dl>
6672: </div>
6673: </div>
6674:
6675: <div class="sect1" lang="en" xml:lang="en">
6676: <div class="titlepage">
6677: <div>
6678: <div>
6679: <h2 class="title" style="clear: both"><a name=
1.45 ! wiz 6680: "work-dir" id="work-dir"></a>8.6. <code xmlns=
! 6681: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6682: "filename">work*</code></h2>
6683: </div>
6684: </div>
6685: </div>
6686:
6687: <p>When you type <span><strong class=
6688: "command">make</strong></span> the distribution files are
1.45 ! wiz 6689: unpacked into the directory denoted by <code class=
! 6690: "varname">WRKDIR</code>. It can be removed by running
! 6691: <span><strong class="command">make clean</strong></span>.
! 6692: Besides the sources, this directory is also used to keep
! 6693: various timestamp files. The directory gets <span class=
! 6694: "emphasis"><em>removed completely</em></span> on clean.
! 6695: The default is <code xmlns=
! 6696: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6697: "filename">${.CURDIR}/work</code> or <code xmlns=
! 6698: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6699: "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
! 6700: <code class="varname">OBJMACHINE</code> is set.</p>
1.27 rillig 6701:
6702: <p>If a package doesn't create a subdirectory for itself
6703: (like GNU software does, for instance), but extracts
6704: itself in the current directory, you should set
6705: <code class="varname">WRKSRC</code> accordingly, e.g.
6706: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
6707: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.45 ! wiz 6708: target="_top"><code xmlns="" class=
! 6709: "filename">editors/sam</code></a> again, but the quick
1.27 rillig 6710: answer is:</p>
6711: <pre class="programlisting">
6712: WRKSRC= ${WRKDIR}
6713: </pre>
6714:
1.45 ! wiz 6715: <p>If a package doesn't create a subdir with the name of
! 6716: <code class="varname">DISTNAME</code> but some different
! 6717: name, set <code class="varname">WRKSRC</code> to point to
! 6718: the proper name in <code xmlns=
! 6719: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6720: "filename">${WRKDIR}</code>. See <a xmlns=
! 6721: "http://www.w3.org/TR/xhtml1/transitional" href=
1.27 rillig 6722: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.45 ! wiz 6723: target="_top"><code xmlns="" class=
! 6724: "filename">lang/tcl</code></a> and <a xmlns=
1.27 rillig 6725: "http://www.w3.org/TR/xhtml1/transitional" href=
6726: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
1.45 ! wiz 6727: target="_top"><code xmlns="" class=
! 6728: "filename">x11/tk</code></a> for examples, and here is
1.27 rillig 6729: another one:</p>
6730: <pre class="programlisting">
6731: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
6732: </pre>
6733:
6734: <p>The name of the working directory created by pkgsrc is
1.45 ! wiz 6735: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 6736: class="filename">work</code> by default. If the same
! 6737: pkgsrc tree should be used on several different
1.27 rillig 6738: platforms, the variable <code class=
6739: "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
6740: attach the platform to the directory name, e.g.
1.45 ! wiz 6741: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 6742: class="filename">work.i386</code> or <code xmlns=
! 6743: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6744: "filename">work.sparc</code>.</p>
6745: </div>
6746:
6747: <div class="sect1" lang="en" xml:lang="en">
6748: <div class="titlepage">
6749: <div>
6750: <div>
6751: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6752: "files-dir" id=
1.45 ! wiz 6753: "files-dir"></a>8.7. <code xmlns=
! 6754: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6755: "filename">files/*</code></h2>
6756: </div>
6757: </div>
6758: </div>
6759:
6760: <p>If you have any files that you wish to be placed in
6761: the package prior to configuration or building, you could
6762: place these files here and use a “<span class=
6763: "quote">${CP}</span>” command in the
6764: “<span class="quote">pre-configure</span>”
6765: target to achieve this. Alternatively, you could simply
1.45 ! wiz 6766: diff the file against <code xmlns=
! 6767: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6768: "filename">/dev/null</code> and use the patch mechanism
6769: to manage the creation of this file.</p>
6770: </div>
6771: </div>
6772:
6773: <div class="chapter" lang="en" xml:lang="en">
6774: <div class="titlepage">
6775: <div>
6776: <div>
6777: <h2 class="title"><a name="makefile" id=
1.38 dillo 6778: "makefile"></a>Chapter 9. Programming in
1.45 ! wiz 6779: <code xmlns=
! 6780: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6781: "filename">Makefile</code>s</h2>
1.27 rillig 6782: </div>
6783: </div>
6784: </div>
6785:
6786: <div class="toc">
6787: <p><b>Table of Contents</b></p>
6788:
6789: <dl>
6790: <dt><span class="sect1"><a href=
1.45 ! wiz 6791: "#makefile.variables">9.1. <code xmlns=
! 6792: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6793: "filename">Makefile</code> variables</a></span></dt>
6794:
6795: <dd>
6796: <dl>
6797: <dt><span class="sect2"><a href=
1.38 dillo 6798: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 6799: conventions</a></span></dt>
6800: </dl>
6801: </dd>
6802:
1.38 dillo 6803: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 6804: Code snippets</a></span></dt>
6805:
6806: <dd>
6807: <dl>
1.30 wiz 6808: <dt><span class="sect2"><a href=
1.38 dillo 6809: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 6810: list</a></span></dt>
1.27 rillig 6811:
1.30 wiz 6812: <dt><span class="sect2"><a href=
1.38 dillo 6813: "#converting-internal-to-external">9.2.2.
1.27 rillig 6814: Converting an internal list into an external
6815: list</a></span></dt>
6816:
1.30 wiz 6817: <dt><span class="sect2"><a href=
1.38 dillo 6818: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 6819: variables to a shell command</a></span></dt>
1.27 rillig 6820:
1.30 wiz 6821: <dt><span class="sect2"><a href=
1.38 dillo 6822: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 6823: guideline</a></span></dt>
1.27 rillig 6824:
1.30 wiz 6825: <dt><span class="sect2"><a href=
1.38 dillo 6826: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 6827: bug in BSD Make</a></span></dt>
1.27 rillig 6828: </dl>
6829: </dd>
6830: </dl>
6831: </div>
6832:
1.45 ! wiz 6833: <p>Pkgsrc consists of many <code xmlns=
! 6834: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6835: "filename">Makefile</code> fragments, each of which forms a
6836: well-defined part of the pkgsrc system. Using the <a href=
6837: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6838: <span class="citerefentry"><span class=
6839: "refentrytitle">make</span>(1)</span></a> system as a
6840: programming language for a big system like pkgsrc requires
6841: some discipline to keep the code correct and
6842: understandable.</p>
6843:
1.45 ! wiz 6844: <p>The basic ingredients for <code xmlns=
! 6845: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6846: "filename">Makefile</code> programming are variables (which
6847: are actually macros) and shell commands. Among these shell
6848: commands may even be more complex ones like <a href=
6849: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
6850: <span class="citerefentry"><span class=
6851: "refentrytitle">awk</span>(1)</span></a> programs. To make
6852: sure that every shell command runs as intended it is
6853: necessary to quote all variables correctly when they are
6854: used.</p>
6855:
6856: <p>This chapter describes some patterns, that appear quite
1.45 ! wiz 6857: often in <code xmlns=
! 6858: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6859: "filename">Makefile</code>s, including the pitfalls that
! 6860: come along with them.</p>
1.27 rillig 6861:
6862: <div class="sect1" lang="en" xml:lang="en">
6863: <div class="titlepage">
6864: <div>
6865: <div>
6866: <h2 class="title" style="clear: both"><a name=
6867: "makefile.variables" id=
1.45 ! wiz 6868: "makefile.variables"></a>9.1. <code xmlns=
! 6869: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6870: "filename">Makefile</code> variables</h2>
6871: </div>
6872: </div>
6873: </div>
6874:
1.45 ! wiz 6875: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 6876: class="filename">Makefile</code> variables contain
! 6877: strings that can be processed using the five operators
! 6878: ``='', ``+='', ``?='', ``:='', and ``!='', which are
! 6879: described in the <a href=
1.27 rillig 6880: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6881: <span class="citerefentry"><span class=
6882: "refentrytitle">make</span>(1)</span></a> man page.</p>
6883:
1.45 ! wiz 6884: <p>When a variable's value is parsed from a <code xmlns=
! 6885: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6886: "filename">Makefile</code>, the hash character ``#'' and
6887: the backslash character ``\'' are handled specially. If a
6888: backslash is followed by a newline, any whitespace
6889: immediately in front of the backslash, the backslash, the
6890: newline, and any whitespace immediately behind the
6891: newline are replaced with a single space. A backspace
6892: character and an immediately following hash character are
6893: replaced with a single hash character. Otherwise the
6894: backslash is passed as is. In a variable assignment, any
6895: hash character that is not preceded by a backslash starts
6896: a comment that continues upto the end of the logical
6897: line.</p>
6898:
6899: <p><span class="emphasis"><em>Note:</em></span> Because
6900: of this parsing algorithm the only way to create a
6901: variable consisting of a single backslash is using the
6902: ``!='' operator, for example: <code class=
6903: "varname">BACKSLASH!=echo "\\"</code>.</p>
6904:
6905: <p>So far for defining variables. The other thing you can
6906: do with variables is evaluating them. A variable is
6907: evaluated when it is part of the right side of the ``:=''
6908: or the ``!='' operator, or directly before executing a
6909: shell command which the variable is part of. In all other
6910: cases <a href=
6911: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6912: <span class="citerefentry"><span class=
6913: "refentrytitle">make</span>(1)</span></a> performs lazy
6914: evaluation, that is, variables are not evaluated until
6915: there's no other way. The ``modifiers'' mentioned in the
6916: man page also evaluate the variable.</p>
6917:
6918: <p>Some of the modifiers split the string into words and
6919: then operate on the words, others operate on the string
6920: as a whole. When a string is splitted into words, it is
6921: splitted as you would expect it from <a href=
6922: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
6923: <span class="citerefentry"><span class=
6924: "refentrytitle">sh</span>(1)</span></a>.</p>
6925:
6926: <p>No rule without exception—the
6927: <span><strong class="command">.for</strong></span> loop
6928: does not follow the shell quoting rules but splits at
6929: sequences of whitespace.</p>
6930:
6931: <p>There are several types of variables that should be
6932: handled differently. Strings and two types of lists.</p>
6933:
6934: <div class="itemizedlist">
6935: <ul type="disc">
6936: <li>
6937: <p><span class="emphasis"><em>Strings</em></span>
6938: can contain arbitrary characters. Nevertheless you
6939: should restrict yourself to only using printable
6940: characters. Examples are <code class=
6941: "varname">PREFIX</code> and <code class=
6942: "varname">COMMENT</code>.</p>
6943: </li>
6944:
6945: <li>
6946: <p><span class="emphasis"><em>Internal
6947: lists</em></span> are lists that are never exported
6948: to any shell command. Their elements are separated
6949: by whitespace. Therefore the elements themselves
6950: cannot have embedded whitespace. Any other
6951: characters are allowed. Internal lists can be used
6952: in <span><strong class=
6953: "command">.for</strong></span> loops. Examples are
6954: <code class="varname">DEPENDS</code> and
6955: <code class="varname">BUILD_DEPENDS</code>.</p>
6956: </li>
6957:
6958: <li>
6959: <p><span class="emphasis"><em>External
6960: lists</em></span> are lists that may be exported to
6961: a shell command. Their elements can contain any
6962: characters, including whitespace. That's why they
6963: cannot be used in <span><strong class=
6964: "command">.for</strong></span> loops. Examples are
6965: <code class="varname">DISTFILES</code> and
6966: <code class="varname">MASTER_SITES</code>.</p>
6967: </li>
6968: </ul>
6969: </div>
6970:
6971: <div class="sect2" lang="en" xml:lang="en">
6972: <div class="titlepage">
6973: <div>
6974: <div>
6975: <h3 class="title"><a name=
6976: "makefile.variables.names" id=
1.38 dillo 6977: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 6978: conventions</h3>
6979: </div>
6980: </div>
6981: </div>
6982:
6983: <div class="itemizedlist">
6984: <ul type="disc">
6985: <li>
6986: <p>All variable names starting with an underscore
6987: are reserved for use by the pkgsrc
6988: infrastructure. They shall not be used by package
1.45 ! wiz 6989: <code xmlns=
! 6990: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6991: "filename">Makefile</code>s.</p>
1.27 rillig 6992: </li>
6993:
6994: <li>
6995: <p>In <span><strong class=
6996: "command">.for</strong></span> loops you should
6997: use lowercase variable names for the iteration
6998: variables.</p>
6999: </li>
7000:
7001: <li>
7002: <p>All list variables should have a ``plural''
7003: name, e.g. <code class=
7004: "varname">PKG_OPTIONS</code> or <code class=
7005: "varname">DISTFILES</code>.</p>
7006: </li>
7007: </ul>
7008: </div>
7009: </div>
7010: </div>
7011:
7012: <div class="sect1" lang="en" xml:lang="en">
7013: <div class="titlepage">
7014: <div>
7015: <div>
7016: <h2 class="title" style="clear: both"><a name=
7017: "makefile.code" id=
1.38 dillo 7018: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 7019: </div>
7020: </div>
7021: </div>
7022:
7023: <p>This section presents you with some code snippets you
7024: should use in your own code. If you don't find anything
7025: appropriate here, you should test your code and add it
7026: here.</p>
7027:
7028: <div class="sect2" lang="en" xml:lang="en">
7029: <div class="titlepage">
7030: <div>
7031: <div>
1.30 wiz 7032: <h3 class="title"><a name="adding-to-list" id=
1.38 dillo 7033: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 7034: a list</h3>
1.27 rillig 7035: </div>
7036: </div>
7037: </div>
7038: <pre class="programlisting">
7039: STRING= foo * bar `date`
7040: INT_LIST= # empty
7041: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
7042: EXT_LIST= # empty
7043: ANOTHER_EXT_LIST= a=b c=d
7044:
7045: INT_LIST+= ${STRING} # 1
7046: INT_LIST+= ${ANOTHER_INT_LIST} # 2
7047: EXT_LIST+= ${STRING:Q} # 3
7048: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
7049:
7050: </pre>
7051:
7052: <p>When you add a string to an external list (example
7053: 3), it must be quoted. In all other cases, you must not
7054: add a quoting level. You must not merge internal and
7055: external lists, unless you are sure that all entries
7056: are correctly interpreted in both lists.</p>
7057: </div>
7058:
7059: <div class="sect2" lang="en" xml:lang="en">
7060: <div class="titlepage">
7061: <div>
7062: <div>
1.30 wiz 7063: <h3 class="title"><a name=
7064: "converting-internal-to-external" id=
1.38 dillo 7065: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 7066: an internal list into an external list</h3>
1.27 rillig 7067: </div>
7068: </div>
7069: </div>
7070: <pre class="programlisting">
7071: EXT_LIST= # empty
7072: .for i in ${INT_LIST}
7073: EXT_LIST+= ${i:Q}""
7074: .endfor
7075:
7076: </pre>
7077:
7078: <p>This code converts the internal list <code class=
7079: "varname">INT_LIST</code> into the external list
7080: <code class="varname">EXT_LIST</code>. As the elements
7081: of an internal list are unquoted they must be quoted
7082: here. The reason for appending <code class=
7083: "varname">""</code> is explained below.</p>
7084: </div>
1.1 grant 7085:
1.27 rillig 7086: <div class="sect2" lang="en" xml:lang="en">
7087: <div class="titlepage">
1.1 grant 7088: <div>
1.27 rillig 7089: <div>
1.30 wiz 7090: <h3 class="title"><a name=
7091: "passing-variable-to-shell" id=
1.38 dillo 7092: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 7093: variables to a shell command</h3>
1.27 rillig 7094: </div>
1.1 grant 7095: </div>
7096: </div>
1.27 rillig 7097: <pre class="programlisting">
7098: STRING= foo bar < > * `date` $$HOME ' "
7099: EXT_LIST= string=${STRING:Q} x=second\ item
7100:
7101: all:
7102: echo ${STRING} # 1
7103: echo "${STRING}" # 2
7104: echo "${STRING:Q}" # 3
7105: echo ${STRING:Q} # 4
7106: echo x${STRING:Q} | sed 1s,.,, # 5
7107: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
7108:
7109: </pre>
7110:
7111: <p>Example 1 leads to a syntax error in the shell, as
7112: the characters are just copied.</p>
7113:
7114: <p>Example 2 leads to a syntax error too, and if you
7115: leave out the last " character from <code class=
7116: "varname">${STRING}</code>, <a href=
7117: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
7118: <span class="citerefentry"><span class=
7119: "refentrytitle">date</span>(1)</span></a> will be
7120: executed. The <code class="varname">$HOME</code> shell
7121: variable would be evaluated, too.</p>
7122:
7123: <p>Example 3 outputs each space character preceded by a
7124: backslash (or not), depending on the implementation of
7125: the <a href=
7126: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7127: <span class="citerefentry"><span class=
7128: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 7129:
1.27 rillig 7130: <p>Example 4 handles correctly every string that does
7131: not start with a dash. In that case, the result depends
7132: on the implementation of the <a href=
7133: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7134: <span class="citerefentry"><span class=
7135: "refentrytitle">echo</span>(1)</span></a> command. As
7136: long as you can guarantee that your input does not
7137: start with a dash this form is appropriate.</p>
1.1 grant 7138:
1.27 rillig 7139: <p>Example 5 handles even the case of a leading dash
7140: correctly.</p>
1.1 grant 7141:
1.27 rillig 7142: <p>The <code class="varname">EXT_LIST</code> does not
7143: need to be quoted because the quoting has already be
7144: done when adding elements to the list.</p>
1.1 grant 7145:
1.27 rillig 7146: <p>As internal lists shall not be passed to the shell,
7147: there is no example for it.</p>
1.1 grant 7148: </div>
7149:
1.27 rillig 7150: <div class="sect2" lang="en" xml:lang="en">
7151: <div class="titlepage">
1.1 grant 7152: <div>
1.27 rillig 7153: <div>
1.30 wiz 7154: <h3 class="title"><a name="quoting-guideline" id=
1.38 dillo 7155: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 7156: guideline</h3>
7157: </div>
1.1 grant 7158: </div>
7159: </div>
7160:
1.27 rillig 7161: <p>There are many possible sources of wrongly quoted
7162: variables. This section lists some of the commonly
7163: known ones.</p>
1.1 grant 7164:
1.27 rillig 7165: <div class="itemizedlist">
7166: <ul type="disc">
7167: <li>
7168: <p>Whenever you use the value of a list, think
7169: about what happens to leading or trailing
7170: whitespace. If the list is a well-formed shell
7171: expression you can apply the <code class=
7172: "varname">:M*</code> modifier to strip leading
7173: and trailing whitespace from each word. The
7174: <code class="varname">:M</code> operator first
7175: splits its argument according to the rules of the
7176: shell, and then creates a new list consisting of
7177: all words that match the shell glob expression
7178: <code class="varname">*</code>, that is: all. One
7179: class of situations where this is needed is when
7180: adding a variable like <code class=
7181: "varname">CPPFLAGS</code> to <code class=
7182: "varname">CONFIGURE_ARGS</code>. If the configure
7183: script invokes other configure scripts it strips
7184: the leading and trailing whitespace from the
7185: variable and then passes it to the other
7186: configure scripts. But these configure scripts
7187: expect the (child) <code class=
7188: "varname">CPPFLAGS</code> variable to be the same
7189: as the parent <code class=
7190: "varname">CPPFLAGS</code>. That's why we better
7191: pass the <code class="varname">CPPFLAGS</code>
7192: value properly trimmed. And here is how we do
7193: it:</p>
7194: <pre class="programlisting">
7195: CPPFLAGS= # empty
7196: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
7197: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 grant 7198:
1.27 rillig 7199: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 grant 7200:
1.27 rillig 7201: all:
7202: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
7203: echo x${CONFIGURE_ARGS}x # properly trimmed
7204:
7205: </pre>
7206: </li>
1.1 grant 7207:
1.27 rillig 7208: <li>
7209: <p>The example above contains one bug: The
7210: <code class="varname">${PREFIX}</code> is a
7211: properly quoted shell expression, but there is
7212: the C compiler after it, which also expects a
7213: properly quoted string (this time in C syntax).
7214: The version above is therefore only correct if
7215: <code class="varname">${PREFIX}</code> does not
7216: have embedded backslashes or double quotes. If
7217: you want to allow these, you have to add another
7218: layer of quoting to each variable that is used as
7219: a C string literal. You cannot use the
7220: <code class="varname">:Q</code> operator for it,
7221: as this operator only works for the shell.</p>
7222: </li>
1.1 grant 7223:
1.27 rillig 7224: <li>
7225: <p>Whenever a variable can be empty the
7226: <code class="varname">:Q</code> operator can have
7227: surprising results. Here are two completely
7228: different cases which can be solved with the same
7229: trick.</p>
7230: <pre class="programlisting">
7231: EMPTY= # empty
7232: empty_test:
7233: for i in a ${EMPTY:Q} c; do \
7234: echo "$$i"; \
7235: done
7236:
7237: for_test:
7238: .for i in a:\ a:\test.txt
7239: echo ${i:Q}
7240: echo "foo"
7241: .endfor
7242:
1.1 grant 7243: </pre>
7244:
1.27 rillig 7245: <p>The first example will only print two of the
7246: three lines we might have expected. This is
7247: because <code class="varname">${EMPTY:Q}</code>
7248: expands to the empty string, which the shell
7249: cannot see. The workaround is to write
7250: <code class="varname">${EMPTY:Q}""</code>. This
7251: pattern can be often found as <code class=
7252: "varname">${TEST} -z ${VAR:Q}</code> or as
7253: <code class="varname">${TEST} -f
7254: ${FNAME:Q}</code> (both of these are wrong).</p>
7255:
7256: <p>The second example will only print three lines
7257: instead of four. The first line looks like
7258: <code class="varname">a:\ echo foo</code>. This
7259: is because the backslash of the value
7260: <code class="varname">a:\</code> is interpreted
7261: as a line-continuation by <a href=
7262: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7263: <span class="citerefentry"><span class=
7264: "refentrytitle">make</span>(1)</span></a>, which
7265: makes the second line the arguments of the
7266: <a href=
7267: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7268: <span class="citerefentry"><span class=
7269: "refentrytitle">echo</span>(1)</span></a> command
7270: from the first line. To avoid this, write
7271: <code class="varname">${i:Q}""</code>.</p>
7272: </li>
7273: </ul>
7274: </div>
1.1 grant 7275: </div>
7276:
1.27 rillig 7277: <div class="sect2" lang="en" xml:lang="en">
7278: <div class="titlepage">
1.1 grant 7279: <div>
1.27 rillig 7280: <div>
1.30 wiz 7281: <h3 class="title"><a name=
7282: "bsd-make-bug-workaround" id=
1.38 dillo 7283: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 7284: for a bug in BSD Make</h3>
1.27 rillig 7285: </div>
1.1 grant 7286: </div>
7287: </div>
7288:
1.27 rillig 7289: <p>The pkgsrc bmake program does not handle the
7290: following assignment correctly. In case <code class=
7291: "varname">_othervar_</code> contains a ``-'' character,
7292: one of the closing braces is included in <code class=
7293: "varname">${VAR}</code> after this code executes.</p>
7294: <pre class="programlisting">
7295: VAR:= ${VAR:N${_othervar_:C/-//}}
7296:
1.1 grant 7297: </pre>
7298:
1.27 rillig 7299: <p>For a more complex code snippet and a workaround,
7300: see the package <a xmlns=
7301: "http://www.w3.org/TR/xhtml1/transitional" href=
7302: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45 ! wiz 7303: target="_top"><code xmlns="" class=
! 7304: "filename">regress/make-quoting</code></a>, testcase
1.27 rillig 7305: <code class="varname">bug1</code>.</p>
1.1 grant 7306: </div>
7307: </div>
7308: </div>
7309:
7310: <div class="chapter" lang="en" xml:lang="en">
7311: <div class="titlepage">
7312: <div>
7313: <div>
7314: <h2 class="title"><a name="plist" id=
1.38 dillo 7315: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 7316: </div>
7317: </div>
7318: </div>
7319:
7320: <div class="toc">
7321: <p><b>Table of Contents</b></p>
7322:
7323: <dl>
1.38 dillo 7324: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 7325: ID</a></span></dt>
7326:
1.30 wiz 7327: <dt><span class="sect1"><a href=
1.38 dillo 7328: "#automatic-plist-generation">10.2. Semi-automatic
1.45 ! wiz 7329: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 7330: class="filename">PLIST</code>
1.14 xtraeme 7331: generation</a></span></dt>
1.1 grant 7332:
1.38 dillo 7333: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 7334: Tweaking output of <span><strong class="command">make
7335: print-PLIST</strong></span></a></span></dt>
1.1 grant 7336:
1.38 dillo 7337: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 7338: Variable substitution in PLIST</a></span></dt>
7339:
1.30 wiz 7340: <dt><span class="sect1"><a href=
1.38 dillo 7341: "#manpage-compression">10.5.
1.1 grant 7342: Manpage-compression</a></span></dt>
7343:
1.38 dillo 7344: <dt><span class="sect1"><a href=
7345: "#using-PLIST_SRC">10.6. Changing PLIST source with
7346: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 7347:
1.30 wiz 7348: <dt><span class="sect1"><a href=
1.38 dillo 7349: "#platform-specific-plist">10.7. Platform specific and
1.30 wiz 7350: differing PLISTs</a></span></dt>
1.1 grant 7351:
1.38 dillo 7352: <dt><span class="sect1"><a href=
7353: "#faq.common-dirs">10.8. Sharing directories between
7354: packages</a></span></dt>
1.1 grant 7355: </dl>
7356: </div>
7357:
1.45 ! wiz 7358: <p>The <code xmlns=
! 7359: "http://www.w3.org/TR/xhtml1/transitional" class=
! 7360: "filename">PLIST</code> file contains a package's
! 7361: “<span class="quote">packing list</span>”, i.e.
! 7362: a list of files that belong to the package (relative to the
! 7363: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 7364: class="filename">${PREFIX}</code> directory it's been
! 7365: installed in) plus some additional statements - see the
! 7366: <a href=
1.1 grant 7367: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7368: <span class="citerefentry"><span class=
7369: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
7370: a full list. This chapter addresses some issues that need
1.45 ! wiz 7371: attention when dealing with the <code xmlns=
! 7372: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7373: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 7374:
7375: <div class="sect1" lang="en" xml:lang="en">
7376: <div class="titlepage">
7377: <div>
7378: <div>
7379: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7380: "rcs-id" id="rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 7381: </div>
7382: </div>
7383: </div>
7384:
7385: <p>Be sure to add a RCS ID line as the first thing in any
1.45 ! wiz 7386: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 7387: class="filename">PLIST</code> file you write:</p>
1.1 grant 7388: <pre class="programlisting">
1.17 sketch 7389: @comment $NetBSD$
1.1 grant 7390: </pre>
7391: </div>
7392:
7393: <div class="sect1" lang="en" xml:lang="en">
7394: <div class="titlepage">
7395: <div>
7396: <div>
7397: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7398: "automatic-plist-generation" id=
1.38 dillo 7399: "automatic-plist-generation"></a>10.2. Semi-automatic
1.45 ! wiz 7400: <code xmlns=
! 7401: "http://www.w3.org/TR/xhtml1/transitional" class=
! 7402: "filename">PLIST</code> generation</h2>
1.1 grant 7403: </div>
7404: </div>
7405: </div>
7406:
1.14 xtraeme 7407: <p>You can use the <span><strong class="command">make
7408: print-PLIST</strong></span> command to output a PLIST
7409: that matches any new files since the package was
7410: extracted. See <a href="#build.helpful-targets" title=
1.38 dillo 7411: "14.3. Other helpful targets">Section 14.3,
1.1 grant 7412: “Other helpful targets”</a> for more
7413: information on this target.</p>
7414: </div>
7415:
7416: <div class="sect1" lang="en" xml:lang="en">
7417: <div class="titlepage">
7418: <div>
7419: <div>
7420: <h2 class="title" style="clear: both"><a name=
7421: "print-PLIST" id=
1.38 dillo 7422: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 7423: <span><strong class="command">make
7424: print-PLIST</strong></span></h2>
1.1 grant 7425: </div>
7426: </div>
7427: </div>
7428:
7429: <p>If you have used any of the *-dirs packages, as
7430: explained in <a href="#faq.common-dirs" title=
1.38 dillo 7431: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 7432: “Sharing directories between packages”</a>,
1.14 xtraeme 7433: you may have noticed that <span><strong class=
7434: "command">make print-PLIST</strong></span> outputs a set
7435: of <code class="varname">@comment</code>s instead of real
7436: <code class="varname">@dirrm</code> lines. You can also
7437: do this for specific directories and files, so that the
7438: results of that command are very close to reality. This
7439: helps <span class="emphasis"><em>a lot</em></span> during
7440: the update of packages.</p>
7441:
7442: <p>The <code class="varname">PRINT_PLIST_AWK</code>
7443: variable takes a set of AWK patterns and actions that are
7444: used to filter the output of print-PLIST. You can
7445: <span class="emphasis"><em>append</em></span> any chunk
7446: of AWK scripting you like to it, but be careful with
1.1 grant 7447: quoting.</p>
7448:
1.45 ! wiz 7449: <p>For example, to get all files inside the <code xmlns=
! 7450: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7451: "filename">libdata/foo</code> directory removed from the
1.1 grant 7452: resulting PLIST:</p>
7453: <pre class="programlisting">
7454: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
7455:
7456: </pre>
7457:
1.14 xtraeme 7458: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 7459: lines referring to a specific (shared) directory
1.14 xtraeme 7460: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 7461: <pre class="programlisting">
7462: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
7463:
7464: </pre>
7465: </div>
7466:
7467: <div class="sect1" lang="en" xml:lang="en">
7468: <div class="titlepage">
7469: <div>
7470: <div>
7471: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7472: "plist.misc" id=
7473: "plist.misc"></a>10.4. Variable substitution
7474: in PLIST</h2>
1.1 grant 7475: </div>
7476: </div>
7477: </div>
7478:
7479: <p>A number of variables are substituted automatically in
7480: PLISTs when a package is installed on a system. This
7481: includes the following variables:</p>
7482:
7483: <div class="variablelist">
7484: <dl>
1.14 xtraeme 7485: <dt><span class="term"><code class=
7486: "varname">${MACHINE_ARCH}</code>, <code class=
7487: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 7488:
7489: <dd>
7490: <p>Some packages like emacs and perl embed
7491: information about which architecture they were
7492: built on into the pathnames where they install
7493: their file. To handle this case, PLIST will be
7494: preprocessed before actually used, and the symbol
1.14 xtraeme 7495: “<span class="quote"><code class=
7496: "varname">${MACHINE_ARCH}</code></span>” will
7497: be replaced by what <span><strong class=
7498: "command">uname -p</strong></span> gives. The same
7499: is done if the string <code class=
7500: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
7501: PLIST somewhere - use this on packages that have
7502: GNU autoconf created configure scripts.</p>
1.1 grant 7503:
7504: <div class="note" style=
7505: "margin-left: 0.5in; margin-right: 0.5in;">
7506: <h3 class="title">Legacy note</h3>
7507:
7508: <p>There used to be a symbol “<span class=
1.14 xtraeme 7509: "quote"><code class=
7510: "varname">$ARCH</code></span>” that was
7511: replaced by the output of <span><strong class=
7512: "command">uname -m</strong></span>, but that's no
1.1 grant 7513: longer supported and has been removed.</p>
7514: </div>
7515: </dd>
7516:
1.14 xtraeme 7517: <dt><span class="term"><code class=
7518: "varname">${OPSYS}</code>, <code class=
7519: "varname">${LOWER_OPSYS}</code>, <code class=
7520: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 7521:
7522: <dd>
7523: <p>Some packages want to embed the OS name and
7524: version into some paths. To do this, use these
1.45 ! wiz 7525: variables in the <code xmlns=
! 7526: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7527: "filename">PLIST</code>:</p>
1.1 grant 7528:
7529: <div class="itemizedlist">
7530: <ul type="disc">
7531: <li>
1.14 xtraeme 7532: <p><code class="varname">${OPSYS}</code> -
7533: output of “<span class=
7534: "quote"><span><strong class="command">uname
7535: -s</strong></span></span>”</p>
1.1 grant 7536: </li>
7537:
7538: <li>
1.14 xtraeme 7539: <p><code class=
7540: "varname">${LOWER_OPSYS}</code> - lowercase
7541: common name (eg. “<span class=
7542: "quote">solaris</span>”)</p>
1.1 grant 7543: </li>
7544:
7545: <li>
1.14 xtraeme 7546: <p><code class="varname">${OS_VERSION}</code>
7547: - “<span class=
7548: "quote"><span><strong class="command">uname
7549: -r</strong></span></span>”</p>
1.1 grant 7550: </li>
7551: </ul>
7552: </div>
7553: </dd>
7554:
1.14 xtraeme 7555: <dt><span class="term"><code class=
7556: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 7557:
7558: <dd>
7559: <p>Packages that install locale files should list
7560: them in the PLIST as “<span class=
7561: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
7562: instead of “<span class=
7563: "quote">share/locale/de/LC_MESSAGES/...</span>”.
7564: This properly handles the fact that different
7565: operating systems expect locale files to be either
1.45 ! wiz 7566: in <code xmlns=
! 7567: "http://www.w3.org/TR/xhtml1/transitional" class=
! 7568: "filename">share</code> or <code xmlns=
! 7569: "http://www.w3.org/TR/xhtml1/transitional" class=
! 7570: "filename">lib</code> by default.</p>
1.1 grant 7571: </dd>
7572: </dl>
7573: </div>
7574:
7575: <p>For a complete list of values which are replaced by
1.45 ! wiz 7576: default, please look in <code xmlns=
! 7577: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7578: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 7579: "emphasis"><em>PLIST_SUBST</em></span>).</p>
7580:
7581: <p>If you want to change other variables not listed
7582: above, you can add variables and their expansions to this
1.14 xtraeme 7583: variable in the following way, similar to <code class=
7584: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 7585: "#components.optional" title=
1.38 dillo 7586: "8.5. Optional files">Section 8.5,
1.1 grant 7587: “Optional files”</a>):</p>
7588: <pre class="programlisting">
7589: PLIST_SUBST+= SOMEVAR="somevalue"
7590: </pre>
7591:
7592: <p>This replaces all occurrences of “<span class=
7593: "quote">${SOMEVAR}</span>” in the PLIST with
7594: “<span class="quote">somevalue</span>”.</p>
7595: </div>
7596:
7597: <div class="sect1" lang="en" xml:lang="en">
7598: <div class="titlepage">
7599: <div>
7600: <div>
7601: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7602: "manpage-compression" id=
1.38 dillo 7603: "manpage-compression"></a>10.5. Manpage-compression</h2>
1.1 grant 7604: </div>
7605: </div>
7606: </div>
7607:
7608: <p>Manpages should be installed in compressed form if
1.45 ! wiz 7609: <code class="varname">MANZ</code> is set (in <code xmlns=
! 7610: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7611: "filename">bsd.own.mk</code>), and uncompressed
1.45 ! wiz 7612: otherwise. To handle this in the <code xmlns=
! 7613: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7614: "filename">PLIST</code> file, the suffix
7615: “<span class="quote">.gz</span>” is
7616: appended/removed automatically for manpages according to
7617: <code class="varname">MANZ</code> and <code class=
7618: "varname">MANCOMPRESSED</code> being set or not, see
1.45 ! wiz 7619: above for details. This modification of the <code xmlns=
! 7620: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7621: "filename">PLIST</code> file is done on a copy of it, not
1.45 ! wiz 7622: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 7623: class="filename">PLIST</code> itself.</p>
1.1 grant 7624: </div>
7625:
7626: <div class="sect1" lang="en" xml:lang="en">
7627: <div class="titlepage">
7628: <div>
7629: <div>
7630: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7631: "using-PLIST_SRC" id=
1.38 dillo 7632: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 7633: source with <code class=
1.14 xtraeme 7634: "varname">PLIST_SRC</code></h2>
1.1 grant 7635: </div>
7636: </div>
7637: </div>
7638:
1.14 xtraeme 7639: <p>To use one or more files as source for the
1.45 ! wiz 7640: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 7641: class="filename">PLIST</code> used in generating the
! 7642: binary package, set the variable <code class=
1.14 xtraeme 7643: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 7644: The files are later concatenated using <a href=
7645: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
7646: <span class="citerefentry"><span class=
7647: "refentrytitle">cat</span>(1)</span></a>, and order of
7648: things is important.</p>
1.1 grant 7649: </div>
7650:
7651: <div class="sect1" lang="en" xml:lang="en">
7652: <div class="titlepage">
7653: <div>
7654: <div>
7655: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7656: "platform-specific-plist" id=
1.38 dillo 7657: "platform-specific-plist"></a>10.7. Platform
1.1 grant 7658: specific and differing PLISTs</h2>
7659: </div>
7660: </div>
7661: </div>
7662:
7663: <p>Some packages decide to install a different set of
7664: files based on the operating system being used. These
7665: differences can be automatically handled by using the
7666: following files:</p>
7667:
7668: <div class="itemizedlist">
7669: <ul type="disc">
7670: <li>
1.45 ! wiz 7671: <p><code xmlns=
! 7672: "http://www.w3.org/TR/xhtml1/transitional" class=
! 7673: "filename">PLIST.common</code></p>
1.1 grant 7674: </li>
7675:
7676: <li>
1.45 ! wiz 7677: <p><code xmlns=
! 7678: "http://www.w3.org/TR/xhtml1/transitional" class=
! 7679: "filename">PLIST.${OPSYS}</code></p>
1.1 grant 7680: </li>
7681:
7682: <li>
1.45 ! wiz 7683: <p><code xmlns=
! 7684: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 7685: "filename">PLIST.${MACHINE_ARCH}</code></p>
7686: </li>
7687:
7688: <li>
1.45 ! wiz 7689: <p><code xmlns=
! 7690: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 7691: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
7692: </li>
7693:
7694: <li>
1.45 ! wiz 7695: <p><code xmlns=
! 7696: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7697: "filename">PLIST.common_end</code></p>
1.1 grant 7698: </li>
7699: </ul>
7700: </div>
7701: </div>
7702:
7703: <div class="sect1" lang="en" xml:lang="en">
7704: <div class="titlepage">
7705: <div>
7706: <div>
7707: <h2 class="title" style="clear: both"><a name=
7708: "faq.common-dirs" id=
1.38 dillo 7709: "faq.common-dirs"></a>10.8. Sharing
7710: directories between packages</h2>
1.1 grant 7711: </div>
7712: </div>
7713: </div>
7714:
7715: <p>A “<span class="quote">shared
7716: directory</span>” is a directory where multiple
7717: (and unrelated) packages install files. These directories
7718: are problematic because you have to add special tricks in
7719: the PLIST to conditionally remove them, or have some
7720: centralized package handle them.</p>
7721:
7722: <p>Within pkgsrc, you'll find both approaches. If a
7723: directory is shared by a few unrelated packages, it's
7724: often not worth to add an extra package to remove it.
7725: Therefore, one simply does:</p>
7726: <pre class="programlisting">
7727: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
7728:
7729: </pre>
7730:
7731: <p>in the PLISTs of all affected packages, instead of the
7732: regular "@dirrm" line.</p>
7733:
7734: <p>However, if the directory is shared across many
7735: packages, two different solutions are available:</p>
7736:
7737: <div class="orderedlist">
7738: <ol type="1">
7739: <li>
7740: <p>If the packages have a common dependency, the
7741: directory can be removed in that. For example, see
7742: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
7743: href=
7744: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45 ! wiz 7745: target="_top"><code xmlns="" class=
! 7746: "filename">textproc/scrollkeeper</code></a>, which
! 7747: removes the shared directory <code xmlns=
! 7748: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 7749: "filename">share/omf</code>.</p>
1.1 grant 7750: </li>
7751:
7752: <li>
7753: <p>If the packages using the directory are not
7754: related at all (they have no common dependencies),
7755: a *-dirs package is used.</p>
7756: </li>
7757: </ol>
7758: </div>
7759:
7760: <p>From now on, we'll discuss the second solution. To get
7761: an idea of the *-dirs packages available, issue:</p>
7762: <pre class="programlisting">
1.14 xtraeme 7763: <code class="prompt">%</code> cd .../pkgsrc
7764: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 7765:
7766: </pre>
7767:
7768: <p>Their use from other packages is very simple. The
1.14 xtraeme 7769: <code class="varname">USE_DIRS</code> variable takes a
7770: list of package names (without the “<span class=
1.1 grant 7771: "quote">-dirs</span>” part) together with the
7772: required version number (always pick the latest one when
1.34 wiz 7773: writing new packages).</p>
1.1 grant 7774:
7775: <p>For example, if a package installs files under
1.45 ! wiz 7776: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 7777: class="filename">share/applications</code>, it should
! 7778: have the following line in it:</p>
1.1 grant 7779: <pre class="programlisting">
7780: USE_DIRS+= xdg-1.1
7781:
7782: </pre>
7783:
1.14 xtraeme 7784: <p>After regenerating the PLIST using
7785: <span><strong class="command">make
7786: print-PLIST</strong></span>, you should get the right
7787: (commented out) lines.</p>
1.1 grant 7788:
1.45 ! wiz 7789: <p>Note that, even if your package is using <code xmlns=
! 7790: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7791: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 7792: *-x11-dirs packages. Just specify the name without that
1.45 ! wiz 7793: part and pkgsrc (in particular, <code xmlns=
! 7794: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7795: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 7796: </div>
7797: </div>
7798:
7799: <div class="chapter" lang="en" xml:lang="en">
7800: <div class="titlepage">
7801: <div>
7802: <div>
7803: <h2 class="title"><a name="buildlink" id=
1.38 dillo 7804: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 7805: methodology</h2>
7806: </div>
7807: </div>
7808: </div>
7809:
7810: <div class="toc">
7811: <p><b>Table of Contents</b></p>
7812:
7813: <dl>
1.30 wiz 7814: <dt><span class="sect1"><a href=
1.38 dillo 7815: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 7816: to use buildlink3</a></span></dt>
1.1 grant 7817:
1.30 wiz 7818: <dt><span class="sect1"><a href=
1.45 ! wiz 7819: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
! 7820: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 7821: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 7822:
7823: <dd>
7824: <dl>
1.25 rillig 7825: <dt><span class="sect2"><a href=
1.38 dillo 7826: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 7827: buildlink3.mk file</a></span></dt>
1.1 grant 7828:
1.25 rillig 7829: <dt><span class="sect2"><a href=
1.38 dillo 7830: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 7831: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 7832: "replaceable"><code>pkg</code></em></code> in
1.45 ! wiz 7833: <code xmlns=
! 7834: "http://www.w3.org/TR/xhtml1/transitional" class=
! 7835: "filename">buildlink3.mk</code>
1.1 grant 7836: files</a></span></dt>
7837: </dl>
7838: </dd>
7839:
1.30 wiz 7840: <dt><span class="sect1"><a href=
1.45 ! wiz 7841: "#writing-builtin.mk">11.3. Writing <code xmlns=
! 7842: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 7843: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 7844:
7845: <dd>
7846: <dl>
1.25 rillig 7847: <dt><span class="sect2"><a href=
1.38 dillo 7848: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 ! wiz 7849: <code xmlns=
! 7850: "http://www.w3.org/TR/xhtml1/transitional" class=
! 7851: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 7852:
1.25 rillig 7853: <dt><span class="sect2"><a href=
1.38 dillo 7854: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 7855: preferences for native or pkgsrc
7856: software</a></span></dt>
1.1 grant 7857: </dl>
7858: </dd>
7859: </dl>
7860: </div>
7861:
7862: <p>Buildlink is a framework in pkgsrc that controls what
7863: headers and libraries are seen by a package's configure and
7864: build processes. This is implemented in a two step
7865: process:</p>
7866:
7867: <div class="orderedlist">
7868: <ol type="1">
7869: <li>
7870: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 7871: into <code class="varname">BUILDLINK_DIR</code>,
7872: which by default is a subdirectory of <code class=
7873: "varname">WRKDIR</code>.</p>
1.1 grant 7874: </li>
7875:
7876: <li>
7877: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 7878: the normal compiler tools that translate <code class=
7879: "option">-I${LOCALBASE}/include</code> and
7880: <code class="option">-L${LOCALBASE}/lib</code> into
7881: references to <code class=
7882: "varname">BUILDLINK_DIR</code>. The wrapper scripts
7883: also make native compiler on some operating systems
7884: look like GCC, so that packages that expect GCC won't
7885: require modifications to build with those native
7886: compilers.</p>
1.1 grant 7887: </li>
7888: </ol>
7889: </div>
7890:
7891: <p>This normalizes the environment in which a package is
7892: built so that the package may be built consistently despite
7893: what other software may be installed. Please note that the
1.45 ! wiz 7894: normal system header and library paths, e.g. <code xmlns=
! 7895: "http://www.w3.org/TR/xhtml1/transitional" class=
! 7896: "filename">/usr/include</code>, <code xmlns=
! 7897: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7898: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 7899: buildlink3 is designed to insulate the package build from
7900: non-system-supplied software.</p>
7901:
7902: <div class="sect1" lang="en" xml:lang="en">
7903: <div class="titlepage">
7904: <div>
7905: <div>
7906: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7907: "converting-to-buildlink3" id=
1.38 dillo 7908: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 7909: packages to use buildlink3</h2>
1.1 grant 7910: </div>
7911: </div>
7912: </div>
7913:
7914: <p>The process of converting packages to use the
7915: buildlink3 framework (“<span class=
7916: "quote">bl3ifying</span>”) is fairly
7917: straightforward. The things to keep in mind are:</p>
7918:
7919: <div class="orderedlist">
7920: <ol type="1">
7921: <li>
7922: <p>Ensure that the build always calls the wrapper
7923: scripts instead of the actual toolchain. Some
7924: packages are tricky, and the only way to know for
1.45 ! wiz 7925: sure is the check <code xmlns=
! 7926: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7927: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 7928: wrappers are being invoked.</p>
7929: </li>
7930:
7931: <li>
1.14 xtraeme 7932: <p>Don't override <code class=
7933: "varname">PREFIX</code> from within the package
7934: Makefile, e.g. Java VMs, standalone shells, etc.,
1.45 ! wiz 7935: because the code to symlink files into <code xmlns=
! 7936: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7937: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 7938: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 7939: <em class=
7940: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 7941: </li>
7942:
7943: <li>
7944: <p>Remember that <span class=
1.45 ! wiz 7945: "emphasis"><em>only</em></span> the <code xmlns=
! 7946: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7947: "filename">buildlink3.mk</code> files that you list
1.1 grant 7948: in a package's Makefile are added as dependencies
7949: for that package.</p>
7950: </li>
7951: </ol>
7952: </div>
7953:
7954: <p>If a dependency on a particular package is required
7955: for its libraries and headers, then we replace:</p>
7956: <pre class="programlisting">
1.27 rillig 7957: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 7958: </pre>
7959:
7960: <p>with</p>
7961: <pre class="programlisting">
7962: .include "../../category/foo/buildlink3.mk"
7963: </pre>
7964:
1.45 ! wiz 7965: <p>There are several <code xmlns=
! 7966: "http://www.w3.org/TR/xhtml1/transitional" class=
! 7967: "filename">buildlink3.mk</code> files in <code xmlns=
! 7968: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7969: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 7970: issues:</p>
7971:
7972: <div class="itemizedlist">
7973: <ul type="disc">
7974: <li>
1.45 ! wiz 7975: <p><code xmlns=
! 7976: "http://www.w3.org/TR/xhtml1/transitional" class=
! 7977: "filename">bdb.buildlink3.mk</code> chooses either
! 7978: the native or a pkgsrc Berkeley DB implementation
! 7979: based on the values of <code class=
1.14 xtraeme 7980: "varname">BDB_ACCEPTED</code> and <code class=
7981: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 7982: </li>
7983:
7984: <li>
1.45 ! wiz 7985: <p><code xmlns=
! 7986: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7987: "filename">curses.buildlink3.mk</code> If the
7988: system comes with neither Curses nor NCurses, this
7989: will take care to install the <a xmlns=
7990: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 7991: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45 ! wiz 7992: target="_top"><code xmlns="" class=
! 7993: "filename">devel/ncurses</code></a> package.</p>
1.1 grant 7994: </li>
7995:
7996: <li>
1.45 ! wiz 7997: <p><code xmlns=
! 7998: "http://www.w3.org/TR/xhtml1/transitional" class=
! 7999: "filename">krb5.buildlink3.mk</code> uses the value
! 8000: of <code class="varname">KRB5_ACCEPTED</code> to
! 8001: choose between adding a dependency on Heimdal or
! 8002: MIT-krb5 for packages that require a Kerberos 5
1.1 grant 8003: implementation.</p>
8004: </li>
8005:
8006: <li>
1.45 ! wiz 8007: <p><code xmlns=
! 8008: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8009: "filename">motif.buildlink3.mk</code> checks for a
8010: system-provided Motif installation or adds a
8011: dependency on <a xmlns=
1.1 grant 8012: "http://www.w3.org/TR/xhtml1/transitional" href=
8013: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45 ! wiz 8014: target="_top"><code xmlns="" class=
! 8015: "filename">x11/lesstif</code></a> or <a xmlns=
1.20 ben 8016: "http://www.w3.org/TR/xhtml1/transitional" href=
8017: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45 ! wiz 8018: target="_top"><code xmlns="" class=
! 8019: "filename">x11/openmotif</code></a>;</p>
1.1 grant 8020: </li>
8021:
8022: <li>
1.45 ! wiz 8023: <p><code xmlns=
! 8024: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8025: "filename">ossaudio.buildlink3.mk</code> defines
8026: several variables that may be used by packages that
8027: use the Open Sound System (OSS) API;</p>
1.1 grant 8028: </li>
8029:
8030: <li>
1.45 ! wiz 8031: <p><code xmlns=
! 8032: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8033: "filename">pgsql.buildlink3.mk</code> will accept
8034: either Postgres 7.3 or 7.4, whichever is found
8035: installed. See the file for more information.</p>
1.1 grant 8036: </li>
8037:
8038: <li>
1.45 ! wiz 8039: <p><code xmlns=
! 8040: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8041: "filename">pthread.buildlink3.mk</code> uses the
8042: value of <code class="varname">PTHREAD_OPTS</code>
8043: and checks for native pthreads or adds a dependency
8044: on <a xmlns=
1.1 grant 8045: "http://www.w3.org/TR/xhtml1/transitional" href=
8046: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45 ! wiz 8047: target="_top"><code xmlns="" class=
! 8048: "filename">devel/pth</code></a> as needed;</p>
1.1 grant 8049: </li>
8050:
8051: <li>
1.45 ! wiz 8052: <p><code xmlns=
! 8053: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8054: "filename">xaw.buildlink3.mk</code> uses the value
! 8055: of <code class="varname">XAW_TYPE</code> to choose
! 8056: a particular Athena widgets library.</p>
1.1 grant 8057: </li>
8058: </ul>
8059: </div>
8060:
1.45 ! wiz 8061: <p>The comments in those <code xmlns=
! 8062: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8063: "filename">buildlink3.mk</code> files provide a more
1.1 grant 8064: complete description of how to use them properly.</p>
8065: </div>
8066:
8067: <div class="sect1" lang="en" xml:lang="en">
8068: <div class="titlepage">
8069: <div>
8070: <div>
8071: <h2 class="title" style="clear: both"><a name=
1.30 wiz 8072: "creating-buildlink3.mk" id=
1.38 dillo 8073: "creating-buildlink3.mk"></a>11.2. Writing
1.45 ! wiz 8074: <code xmlns=
! 8075: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8076: "filename">buildlink3.mk</code> files</h2>
1.1 grant 8077: </div>
8078: </div>
8079: </div>
8080:
1.45 ! wiz 8081: <p>A package's <code xmlns=
! 8082: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8083: "filename">buildlink3.mk</code> file is included by
8084: Makefiles to indicate the need to compile and link
8085: against header files and libraries provided by the
1.45 ! wiz 8086: package. A <code xmlns=
! 8087: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8088: "filename">buildlink3.mk</code> file should always
! 8089: provide enough information to add the correct type of
! 8090: dependency relationship and include any other
! 8091: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 8092: class="filename">buildlink3.mk</code> files that it needs
! 8093: to find headers and libraries that it needs in turn.</p>
1.1 grant 8094:
1.45 ! wiz 8095: <p>To generate an initial <code xmlns=
! 8096: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8097: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 8098: Rene Hexel's <a xmlns=
8099: "http://www.w3.org/TR/xhtml1/transitional" href=
8100: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45 ! wiz 8101: target="_top"><code xmlns="" class=
! 8102: "filename">pkgtools/createbuildlink</code></a> package is
1.20 ben 8103: highly recommended. For most packages, the following
8104: command will generate a good starting point for
1.45 ! wiz 8105: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 8106: class="filename">buildlink3.mk</code> files:</p>
1.1 grant 8107: <pre class="screen">
1.14 xtraeme 8108: <code class="prompt">%</code> <strong class=
8109: "userinput"><code>cd pkgsrc/<em class=
8110: "replaceable"><code>category</code></em>/<em class=
8111: "replaceable"><code>pkgdir</code></em>
8112: <code class=
8113: "prompt">%</code> createbuildlink -3 >buildlink3.mk</code></strong>
1.1 grant 8114: </pre>
8115:
8116: <div class="sect2" lang="en" xml:lang="en">
8117: <div class="titlepage">
8118: <div>
8119: <div>
1.30 wiz 8120: <h3 class="title"><a name="anatomy-of-bl3" id=
1.38 dillo 8121: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 8122: buildlink3.mk file</h3>
1.1 grant 8123: </div>
8124: </div>
8125: </div>
8126:
1.45 ! wiz 8127: <p>The following real-life example <code xmlns=
! 8128: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8129: "filename">buildlink3.mk</code> is taken from
1.45 ! wiz 8130: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 8131: class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 8132: <pre class="programlisting">
1.17 sketch 8133: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 8134:
8135: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
8136: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
8137:
8138: .if !empty(BUILDLINK_DEPTH:M+)
8139: BUILDLINK_DEPENDS+= tiff
8140: .endif
8141:
8142: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
8143: BUILDLINK_PACKAGES+= tiff
8144:
8145: .if !empty(TIFF_BUILDLINK3_MK:M+)
8146: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
8147: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
8148: .endif # TIFF_BUILDLINK3_MK
8149:
8150: .include "../../devel/zlib/buildlink3.mk"
8151: .include "../../graphics/jpeg/buildlink3.mk"
8152:
8153: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
8154: </pre>
8155:
1.14 xtraeme 8156: <p>The header and footer manipulate <code class=
8157: "varname">BUILDLINK_DEPTH</code>, which is common
1.45 ! wiz 8158: across all <code xmlns=
! 8159: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8160: "filename">buildlink3.mk</code> files and is used to
! 8161: track at what depth we are including <code xmlns=
! 8162: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8163: "filename">buildlink3.mk</code> files.</p>
1.1 grant 8164:
8165: <p>The first section controls if the dependency on
1.14 xtraeme 8166: <em class="replaceable"><code>pkg</code></em> is added.
8167: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 8168: global list of packages for which dependencies are
8169: added by buildlink3.</p>
8170:
8171: <p>The second section advises pkgsrc that the
1.45 ! wiz 8172: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 8173: class="filename">buildlink3.mk</code> file for
1.14 xtraeme 8174: <em class="replaceable"><code>pkg</code></em> has been
8175: included at some point. <code class=
8176: "varname">BUILDLINK_PACKAGES</code> is the global list
1.45 ! wiz 8177: of packages for which <code xmlns=
! 8178: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8179: "filename">buildlink3.mk</code> files have been
8180: included. It must <span class=
8181: "emphasis"><em>always</em></span> be appended to within
1.45 ! wiz 8182: a <code xmlns=
! 8183: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8184: "filename">buildlink3.mk</code> file.</p>
1.1 grant 8185:
8186: <p>The third section is protected from multiple
1.14 xtraeme 8187: inclusion and controls how the dependency on <em class=
8188: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 8189: important variables are set in the section:</p>
8190:
8191: <div class="itemizedlist">
8192: <ul type="disc">
8193: <li>
1.14 xtraeme 8194: <p><code class=
8195: "varname">BUILDLINK_DEPENDS.<em class=
8196: "replaceable"><code>pkg</code></em></code> is the
8197: actual dependency recorded in the installed
8198: package; this should always be set using
8199: <span><strong class="command">+=</strong></span>
8200: to ensure that we're appending to any
8201: pre-existing list of values. This variable should
8202: be set to the first version of the package that
8203: had the last change in the major number of a
8204: shared library or that had a major API
8205: change.</p>
1.1 grant 8206: </li>
8207:
8208: <li>
1.14 xtraeme 8209: <p><code class=
8210: "varname">BUILDLINK_PKGSRCDIR.<em class=
8211: "replaceable"><code>pkg</code></em></code> is the
8212: location of the <em class=
8213: "replaceable"><code>pkg</code></em> pkgsrc
1.1 grant 8214: directory;</p>
8215: </li>
8216:
8217: <li>
1.14 xtraeme 8218: <p><code class=
8219: "varname">BUILDLINK_DEPMETHOD.<em class=
8220: "replaceable"><code>pkg</code></em></code> (not
8221: shown above) controls whether we use <code class=
8222: "varname">BUILD_DEPENDS</code> or <code class=
8223: "varname">DEPENDS</code> to add the dependency on
8224: <em class="replaceable"><code>pkg</code></em>.
8225: The build dependency is selected by setting
8226: <code class=
8227: "varname">BUILDLINK_DEPMETHOD.<em class=
8228: "replaceable"><code>pkg</code></em></code> to
1.1 grant 8229: “<span class="quote">build</span>”.
8230: By default, the full dependency is used.</p>
8231: </li>
8232:
8233: <li>
1.14 xtraeme 8234: <p><code class=
8235: "varname">BUILDLINK_INCDIRS.<em class=
8236: "replaceable"><code>pkg</code></em></code> and
8237: <code class=
8238: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
8239: <code>pkg</code></em></code> (not shown above)
1.45 ! wiz 8240: are lists of subdirectories of <code xmlns=
! 8241: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8242: "filename">${BUILDLINK_PREFIX.<em class=
8243: "replaceable"><code>pkg</code></em>}</code> to
8244: add to the header and library search paths. These
1.1 grant 8245: default to “<span class=
8246: "quote">include</span>” and
8247: “<span class="quote">lib</span>”
8248: respectively.</p>
8249: </li>
8250:
8251: <li>
1.14 xtraeme 8252: <p><code class=
8253: "varname">BUILDLINK_CPPFLAGS.<em class=
8254: "replaceable"><code>pkg</code></em></code> (not
8255: shown above) is the list of preprocessor flags to
8256: add to <code class="varname">CPPFLAGS</code>,
8257: which are passed on to the configure and build
8258: phases. The “<span class=
8259: "quote">-I</span>” option should be avoided
8260: and instead be handled using <code class=
8261: "varname">BUILDLINK_INCDIRS.<em class=
8262: "replaceable"><code>pkg</code></em></code> as
8263: above.</p>
1.1 grant 8264: </li>
8265: </ul>
8266: </div>
8267:
8268: <p>The following variables are all optionally defined
8269: within this second section (protected against multiple
8270: inclusion) and control which package files are
1.45 ! wiz 8271: symlinked into <code xmlns=
! 8272: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8273: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 8274: are transformed during the symlinking:</p>
8275:
8276: <div class="itemizedlist">
8277: <ul type="disc">
8278: <li>
1.14 xtraeme 8279: <p><code class=
8280: "varname">BUILDLINK_FILES.<em class=
8281: "replaceable"><code>pkg</code></em></code> (not
8282: shown above) is a shell glob pattern relative to
1.45 ! wiz 8283: <code xmlns=
! 8284: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8285: "filename">${BUILDLINK_PREFIX.<em class=
8286: "replaceable"><code>pkg</code></em>}</code> to be
1.45 ! wiz 8287: symlinked into <code xmlns=
! 8288: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8289: "filename">${BUILDLINK_DIR}</code>, e.g.
1.45 ! wiz 8290: <code xmlns=
! 8291: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8292: "filename">include/*.h</code>.</p>
1.1 grant 8293: </li>
8294:
8295: <li>
1.14 xtraeme 8296: <p><code class=
8297: "varname">BUILDLINK_FILES_CMD.<em class=
8298: "replaceable"><code>pkg</code></em></code> (not
8299: shown above) is a shell pipeline that outputs to
1.45 ! wiz 8300: stdout a list of files relative to <code xmlns=
! 8301: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8302: "filename">${BUILDLINK_PREFIX.<em class=
8303: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 8304: resulting files are to be symlinked into
1.45 ! wiz 8305: <code xmlns=
! 8306: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8307: "filename">${BUILDLINK_DIR}</code>. By default,
! 8308: this takes the <code xmlns=
! 8309: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8310: "filename">+CONTENTS</code> of a <em class=
8311: "replaceable"><code>pkg</code></em> and filters
8312: it through <code class=
8313: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
8314: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 8315: </li>
8316:
8317: <li>
1.14 xtraeme 8318: <p><code class=
8319: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8320: "replaceable"><code>pkg</code></em></code> (not
8321: shown above) is a filter command that filters
1.45 ! wiz 8322: <code xmlns=
! 8323: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8324: "filename">+CONTENTS</code> input into a list of
! 8325: files relative to <code xmlns=
! 8326: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8327: "filename">${BUILDLINK_PREFIX.<em class=
8328: "replaceable"><code>pkg</code></em>}</code> on
8329: stdout. By default for overwrite packages,
8330: <code class=
8331: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8332: "replaceable"><code>pkg</code></em></code>
1.45 ! wiz 8333: outputs the contents of the <code xmlns=
! 8334: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8335: "filename">include</code> and <code xmlns=
! 8336: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8337: "filename">lib</code> directories in the package
1.45 ! wiz 8338: <code xmlns=
! 8339: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8340: "filename">+CONTENTS</code>, and for pkgviews
! 8341: packages, it outputs any libtool archives in
! 8342: <code xmlns=
! 8343: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8344: "filename">lib</code> directories.</p>
1.1 grant 8345: </li>
8346:
8347: <li>
1.14 xtraeme 8348: <p><code class=
8349: "varname">BUILDLINK_TRANSFORM.<em class=
8350: "replaceable"><code>pkg</code></em></code> (not
8351: shown above) is a list of sed arguments used to
1.1 grant 8352: transform the name of the source filename into a
1.14 xtraeme 8353: destination filename, e.g. <span><strong class=
1.1 grant 8354: "command">-e
1.14 xtraeme 8355: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 8356: </li>
8357: </ul>
8358: </div>
8359:
1.45 ! wiz 8360: <p>The last section includes any <code xmlns=
! 8361: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8362: "filename">buildlink3.mk</code> needed for <em class=
8363: "replaceable"><code>pkg</code></em>'s library
1.45 ! wiz 8364: dependencies. Including these <code xmlns=
! 8365: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8366: "filename">buildlink3.mk</code> files means that the
8367: headers and libraries for these dependencies are also
1.45 ! wiz 8368: symlinked into <code xmlns=
! 8369: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8370: "filename">${BUILDLINK_DIR}</code> whenever the
8371: <em class="replaceable"><code>pkg</code></em>
1.45 ! wiz 8372: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 8373: class="filename">buildlink3.mk</code> file is
1.14 xtraeme 8374: included.</p>
1.1 grant 8375: </div>
8376:
8377: <div class="sect2" lang="en" xml:lang="en">
8378: <div class="titlepage">
8379: <div>
8380: <div>
1.30 wiz 8381: <h3 class="title"><a name=
8382: "updating-buildlink-depends" id=
1.38 dillo 8383: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 8384: <code class=
8385: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
1.45 ! wiz 8386: <code>pkg</code></em></code> in <code xmlns=
! 8387: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8388: "filename">buildlink3.mk</code> files</h3>
1.1 grant 8389: </div>
8390: </div>
8391: </div>
8392:
8393: <p>There are two situations that require increasing the
1.14 xtraeme 8394: dependency listed in <code class=
8395: "varname">BUILDLINK_DEPENDS.<em class=
8396: "replaceable"><code>pkg</code></em></code> after a
8397: package update:</p>
1.1 grant 8398:
8399: <div class="orderedlist">
8400: <ol type="1">
8401: <li>
8402: <p>if the sonames (major number of the library
8403: version) of any installed shared libraries
8404: change;</p>
8405: </li>
8406:
8407: <li>
8408: <p>if the API or interface to the header files
8409: change.</p>
8410: </li>
8411: </ol>
8412: </div>
8413:
1.14 xtraeme 8414: <p>In these cases, <code class=
8415: "varname">BUILDLINK_DEPENDS.<em class=
8416: "replaceable"><code>pkg</code></em></code> should be
8417: adjusted to require at least the new package version.
8418: In some cases, the packages that depend on this new
8419: version may need their <code class=
8420: "varname">PKGREVISION</code>s increased and, if they
1.45 ! wiz 8421: have <code xmlns=
! 8422: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8423: "filename">buildlink3.mk</code> files, their
! 8424: <code class="varname">BUILDLINK_DEPENDS.<em class=
! 8425: "replaceable"><code>pkg</code></em></code> adjusted,
! 8426: too. This is needed so that binary packages made using
! 8427: it will require the correct package dependency and not
! 8428: settle for an older one which will not contain the
! 8429: necessary shared libraries.</p>
1.1 grant 8430:
8431: <p>Please take careful consideration before adjusting
1.14 xtraeme 8432: <code class="varname">BUILDLINK_DEPENDS.<em class=
8433: "replaceable"><code>pkg</code></em></code> as we don't
8434: want to cause unneeded package deletions and rebuilds.
8435: In many cases, new versions of packages work just fine
8436: with older dependencies. See <a href="#dependencies"
1.38 dillo 8437: title="15.1.4. Handling dependencies">Section
8438: 15.1.4, “Handling dependencies”</a> for
1.36 wiz 8439: more information about dependencies on other packages,
1.25 rillig 8440: including the <code class=
8441: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
8442: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 8443: </div>
8444: </div>
8445:
8446: <div class="sect1" lang="en" xml:lang="en">
8447: <div class="titlepage">
8448: <div>
8449: <div>
8450: <h2 class="title" style="clear: both"><a name=
1.30 wiz 8451: "writing-builtin.mk" id=
1.38 dillo 8452: "writing-builtin.mk"></a>11.3. Writing
1.45 ! wiz 8453: <code xmlns=
! 8454: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8455: "filename">builtin.mk</code> files</h2>
1.1 grant 8456: </div>
8457: </div>
8458: </div>
8459:
8460: <p>Some packages in pkgsrc install headers and libraries
8461: that coincide with headers and libraries present in the
1.45 ! wiz 8462: base system. Aside from a <code xmlns=
! 8463: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8464: "filename">buildlink3.mk</code> file, these packages
1.45 ! wiz 8465: should also include a <code xmlns=
! 8466: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8467: "filename">builtin.mk</code> file that includes the
8468: necessary checks to decide whether using the built-in
8469: software or the pkgsrc software is appropriate.</p>
1.1 grant 8470:
8471: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 8472: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 8473:
8474: <div class="orderedlist">
8475: <ol type="1">
8476: <li>
1.14 xtraeme 8477: <p>It should set <code class=
8478: "varname">USE_BUILTIN.<em class=
8479: "replaceable"><code>pkg</code></em></code> to
8480: either “<span class="quote">yes</span>”
8481: or “<span class="quote">no</span>”
8482: after it is included.</p>
1.1 grant 8483: </li>
8484:
8485: <li>
8486: <p>It should <span class=
8487: "emphasis"><em>not</em></span> override any
1.14 xtraeme 8488: <code class="varname">USE_BUILTIN.<em class=
8489: "replaceable"><code>pkg</code></em></code> which is
1.45 ! wiz 8490: already set before the <code xmlns=
! 8491: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8492: "filename">builtin.mk</code> file is included.</p>
1.1 grant 8493: </li>
8494:
8495: <li>
8496: <p>It should be written to allow multiple
8497: inclusion. This is <span class=
8498: "emphasis"><em>very</em></span> important and takes
1.45 ! wiz 8499: careful attention to <code xmlns=
! 8500: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8501: "filename">Makefile</code> coding.</p>
1.1 grant 8502: </li>
8503: </ol>
8504: </div>
8505:
8506: <div class="sect2" lang="en" xml:lang="en">
8507: <div class="titlepage">
8508: <div>
8509: <div>
1.30 wiz 8510: <h3 class="title"><a name="anatomy-of-builtin.mk"
8511: id=
1.38 dillo 8512: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.45 ! wiz 8513: of a <code xmlns=
! 8514: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8515: "filename">builtin.mk</code> file</h3>
1.1 grant 8516: </div>
8517: </div>
8518: </div>
8519:
8520: <p>The following is the recommended template for
8521: builtin.mk files:</p>
8522: <pre class="programlisting">
8523: .if !defined(IS_BUILTIN.foo)
8524: #
8525: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
8526: # genuinely exists in the system or not.
8527: #
8528: IS_BUILTIN.foo?= no
8529:
8530: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
8531: # version can be determined.
8532: #
8533: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
8534: BUILTIN_PKG.foo?= foo-1.0
8535: . endif
8536: .endif # IS_BUILTIN.foo
8537:
8538: .if !defined(USE_BUILTIN.foo)
8539: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
8540: . if defined(BUILTIN_PKG.foo)
8541: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
8542: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
8543: USE_BUILTIN.foo!= \
8544: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
8545: ${ECHO} "yes"; \
8546: else \
8547: ${ECHO} "no"; \
8548: fi
8549: . endif
8550: . endfor
8551: . endif
8552: .endif # USE_BUILTIN.foo
8553:
8554: CHECK_BUILTIN.foo?= no
8555: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
8556: #
8557: # Here we place code that depends on whether USE_BUILTIN.foo is set to
8558: # "yes" or "no".
8559: #
8560: .endif # CHECK_BUILTIN.foo
8561:
8562: </pre>
8563:
1.14 xtraeme 8564: <p>The first section sets <code class=
8565: "varname">IS_BUILTIN.<em class=
8566: "replaceable"><code>pkg</code></em></code> depending on
8567: if <em class="replaceable"><code>pkg</code></em> really
8568: exists in the base system. This should not be a base
8569: system software with similar functionality to
8570: <em class="replaceable"><code>pkg</code></em>; it
8571: should only be “<span class=
8572: "quote">yes</span>” if the actual package is
8573: included as part of the base system. This variable is
1.45 ! wiz 8574: only used internally within the <code xmlns=
! 8575: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8576: "filename">builtin.mk</code> file.</p>
8577:
8578: <p>The second section sets <code class=
8579: "varname">BUILTIN_PKG.<em class=
8580: "replaceable"><code>pkg</code></em></code> to the
8581: version of <em class=
8582: "replaceable"><code>pkg</code></em> in the base system
8583: if it exists (if <code class=
8584: "varname">IS_BUILTIN.<em class=
8585: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8586: “<span class="quote">yes</span>”). This
1.14 xtraeme 8587: variable is only used internally within the
1.45 ! wiz 8588: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 8589: class="filename">builtin.mk</code> file.</p>
1.1 grant 8590:
1.14 xtraeme 8591: <p>The third section sets <code class=
8592: "varname">USE_BUILTIN.<em class=
8593: "replaceable"><code>pkg</code></em></code> and is
8594: <span class="emphasis"><em>required</em></span> in all
1.45 ! wiz 8595: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 8596: class="filename">builtin.mk</code> files. The code in
! 8597: this section must make the determination whether the
! 8598: built-in software is adequate to satisfy the
! 8599: dependencies listed in <code class=
1.14 xtraeme 8600: "varname">BUILDLINK_DEPENDS.<em class=
8601: "replaceable"><code>pkg</code></em></code>. This is
8602: typically done by comparing <code class=
8603: "varname">BUILTIN_PKG.<em class=
8604: "replaceable"><code>pkg</code></em></code> against each
8605: of the dependencies in <code class=
8606: "varname">BUILDLINK_DEPENDS.<em class=
8607: "replaceable"><code>pkg</code></em></code>.
8608: <code class="varname">USE_BUILTIN.<em class=
8609: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 8610: "emphasis"><em>must</em></span> be set to the correct
1.45 ! wiz 8611: value by the end of the <code xmlns=
! 8612: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8613: "filename">builtin.mk</code> file. Note that
8614: <code class="varname">USE_BUILTIN.<em class=
8615: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 8616: “<span class="quote">yes</span>” even if
1.14 xtraeme 8617: <code class="varname">IS_BUILTIN.<em class=
8618: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8619: “<span class="quote">no</span>” because we
8620: may make the determination that the built-in version of
8621: the software is similar enough to be used as a
8622: replacement.</p>
8623:
1.14 xtraeme 8624: <p>The last section is guarded by <code class=
8625: "varname">CHECK_BUILTIN.<em class=
8626: "replaceable"><code>pkg</code></em></code>, and
8627: includes code that uses the value of <code class=
8628: "varname">USE_BUILTIN.<em class=
8629: "replaceable"><code>pkg</code></em></code> set in the
8630: previous section. This typically includes, e.g., adding
1.1 grant 8631: additional dependency restrictions and listing
1.45 ! wiz 8632: additional files to symlink into <code xmlns=
! 8633: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8634: "filename">${BUILDLINK_DIR}</code> (via <code class=
8635: "varname">BUILDLINK_FILES.<em class=
8636: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 8637: </div>
8638:
8639: <div class="sect2" lang="en" xml:lang="en">
8640: <div class="titlepage">
8641: <div>
8642: <div>
1.30 wiz 8643: <h3 class="title"><a name=
8644: "native-or-pkgsrc-preference" id=
1.38 dillo 8645: "native-or-pkgsrc-preference"></a>11.3.2. Global
1.30 wiz 8646: preferences for native or pkgsrc software</h3>
1.1 grant 8647: </div>
8648: </div>
8649: </div>
8650:
8651: <p>When building packages, it's possible to choose
8652: whether to set a global preference for using either the
8653: built-in (native) version or the pkgsrc version of
8654: software to satisfy a dependency. This is controlled by
1.14 xtraeme 8655: setting <code class="varname">PREFER_PKGSRC</code> and
8656: <code class="varname">PREFER_NATIVE</code>. These
8657: variables take values of either “<span class=
1.1 grant 8658: "quote">yes</span>”, “<span class=
8659: "quote">no</span>”, or a list of packages.
1.14 xtraeme 8660: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
8661: to use the pkgsrc versions of software, while
8662: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
8663: to use the built-in versions. Preferences are
8664: determined by the most specific instance of the package
8665: in either <code class="varname">PREFER_PKGSRC</code> or
8666: <code class="varname">PREFER_NATIVE</code>. If a
8667: package is specified in neither or in both variables,
8668: then <code class="varname">PREFER_PKGSRC</code> has
8669: precedence over <code class=
8670: "varname">PREFER_NATIVE</code>. For example, to require
8671: using pkgsrc versions of software for all but the most
8672: basic bits on a NetBSD system, you can set:</p>
1.1 grant 8673: <pre class="programlisting">
8674: PREFER_PKGSRC= yes
8675: PREFER_NATIVE= getopt skey tcp_wrappers
8676:
8677: </pre>
8678:
8679: <p>A package <span class=
1.45 ! wiz 8680: "emphasis"><em>must</em></span> have a <code xmlns=
! 8681: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8682: "filename">builtin.mk</code> file to be listed in
8683: <code class="varname">PREFER_NATIVE</code>, otherwise
8684: it is simply ignored in that list.</p>
1.1 grant 8685: </div>
8686: </div>
8687: </div>
8688:
8689: <div class="chapter" lang="en" xml:lang="en">
8690: <div class="titlepage">
8691: <div>
8692: <div>
1.35 jmmv 8693: <h2 class="title"><a name="pkginstall" id=
1.38 dillo 8694: "pkginstall"></a>Chapter 12. The pkginstall
1.35 jmmv 8695: framework</h2>
1.1 grant 8696: </div>
8697: </div>
8698: </div>
8699:
8700: <div class="toc">
8701: <p><b>Table of Contents</b></p>
8702:
8703: <dl>
1.30 wiz 8704: <dt><span class="sect1"><a href=
1.38 dillo 8705: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 8706: directories outside the installation
8707: prefix</a></span></dt>
8708:
8709: <dd>
8710: <dl>
8711: <dt><span class="sect2"><a href=
1.38 dillo 8712: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 8713: manipulation</a></span></dt>
8714:
8715: <dt><span class="sect2"><a href=
1.38 dillo 8716: "#files-outside-prefix">12.1.2. File
1.35 jmmv 8717: manipulation</a></span></dt>
8718: </dl>
8719: </dd>
8720:
1.38 dillo 8721: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 8722: Configuration files</a></span></dt>
8723:
8724: <dd>
8725: <dl>
8726: <dt><span class="sect2"><a href=
1.38 dillo 8727: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 8728: "varname">PKG_SYSCONFDIR</code> is
8729: set</a></span></dt>
8730:
8731: <dt><span class="sect2"><a href=
1.38 dillo 8732: "#conf-files-configure">12.2.2. Telling the
1.35 jmmv 8733: software were configuration files
8734: are</a></span></dt>
8735:
8736: <dt><span class="sect2"><a href=
1.38 dillo 8737: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 8738: installations</a></span></dt>
8739:
8740: <dt><span class="sect2"><a href=
1.38 dillo 8741: "#conf-files-disable">12.2.4. Disabling handling of
1.35 jmmv 8742: configuration files</a></span></dt>
8743: </dl>
8744: </dd>
8745:
1.38 dillo 8746: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 8747: System startup scripts</a></span></dt>
8748:
8749: <dd>
8750: <dl>
8751: <dt><span class="sect2"><a href=
1.38 dillo 8752: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 8753: of system startup scripts</a></span></dt>
8754: </dl>
8755: </dd>
1.1 grant 8756:
1.30 wiz 8757: <dt><span class="sect1"><a href=
1.38 dillo 8758: "#users-and-groups">12.4. System users and
1.35 jmmv 8759: groups</a></span></dt>
8760:
1.38 dillo 8761: <dt><span class="sect1"><a href="#shells">12.5. System
1.35 jmmv 8762: shells</a></span></dt>
8763:
8764: <dd>
8765: <dl>
8766: <dt><span class="sect2"><a href=
1.38 dillo 8767: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 8768: configuration files</a></span></dt>
8769: </dl>
8770: </dd>
1.1 grant 8771: </dl>
8772: </div>
8773:
1.35 jmmv 8774: <p>This chapter describes the framework known as
8775: <code class="literal">pkginstall</code>, whose key features
8776: are:</p>
8777:
8778: <div class="itemizedlist">
8779: <ul type="disc">
8780: <li>
8781: <p>Generic installation and manipulation of
8782: directories and files outside the pkgsrc-handled
8783: tree, <code class="varname">LOCALBASE</code>.</p>
8784: </li>
8785:
8786: <li>
8787: <p>Automatic handling of configuration files during
8788: installation, provided that packages are correctly
8789: designed.</p>
8790: </li>
8791:
8792: <li>
8793: <p>Generation and installation of system startup
8794: scripts.</p>
8795: </li>
8796:
8797: <li>
8798: <p>Registration of system users and groups.</p>
8799: </li>
8800:
8801: <li>
8802: <p>Registration of system shells.</p>
8803: </li>
8804: </ul>
8805: </div>
8806:
8807: <p>The following sections inspect each of the above points
8808: in detail. Note that, in order to use any of the described
8809: functionalities, you must add the following to your
1.45 ! wiz 8810: package's <code xmlns=
! 8811: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8812: "filename">Makefile</code>:</p>
1.35 jmmv 8813: <pre class="programlisting">
8814: USE_PKGINSTALL=YES
8815: </pre>
8816:
8817: <p>You may be thinking that many of the things described
8818: here could be easily done with simple code in the package's
8819: post-installation target (<code class=
8820: "literal">post-install</code>). <span class=
8821: "emphasis"><em>This is incorrect</em></span>, as the code
8822: in them is only executed when building from source.
8823: Machines using binary packages could not benefit from it at
8824: all (as the code itself could be unavailable). Therefore,
8825: the only way to achieve any of the items described above is
8826: by means of the installation scripts, which are
8827: automatically generated by pkginstall.</p>
1.1 grant 8828:
8829: <div class="sect1" lang="en" xml:lang="en">
8830: <div class="titlepage">
8831: <div>
8832: <div>
8833: <h2 class="title" style="clear: both"><a name=
1.35 jmmv 8834: "files-and-dirs-outside-prefix" id=
1.38 dillo 8835: "files-and-dirs-outside-prefix"></a>12.1. Files and
1.35 jmmv 8836: directories outside the installation prefix</h2>
1.1 grant 8837: </div>
8838: </div>
8839: </div>
8840:
1.45 ! wiz 8841: <p>As you already know, the <code xmlns=
! 8842: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 8843: "filename">PLIST</code> file holds a list of files and
8844: directories that belong to a package. The names used in
1.45 ! wiz 8845: it are relative to the installation prefix (<code xmlns=
! 8846: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 8847: "filename">${PREFIX}</code>), which means that it cannot
8848: register files outside this directory (absolute path
8849: names are not allowed). Despite this restriction, some
8850: packages need to install files outside this location;
1.45 ! wiz 8851: e.g., under <code xmlns=
! 8852: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8853: "filename">${VARBASE}</code> or <code xmlns=
! 8854: "http://www.w3.org/TR/xhtml1/transitional" class=
! 8855: "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35 jmmv 8856:
8857: <p>The only way to achieve this is to create such files
8858: during installation time by using the installation
8859: scripts. These scripts can run arbitrary commands, so
8860: they have the potential to create and manage files
8861: anywhere in the filesystem. Here is where pkginstall
8862: comes into play: it provides generic scripts to abstract
8863: the manipulation of such files and directories based on
1.45 ! wiz 8864: variables set in the package's <code xmlns=
! 8865: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 8866: "filename">Makefile</code>. The rest of this section
8867: describes which these variables are.</p>
1.1 grant 8868:
1.35 jmmv 8869: <div class="sect2" lang="en" xml:lang="en">
8870: <div class="titlepage">
1.1 grant 8871: <div>
1.35 jmmv 8872: <div>
8873: <h3 class="title"><a name="dirs-outside-prefix"
1.38 dillo 8874: id="dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 8875: manipulation</h3>
8876: </div>
1.1 grant 8877: </div>
8878: </div>
8879:
1.35 jmmv 8880: <p>The following variables can be set to request the
8881: creation of directories anywhere in the filesystem:</p>
1.27 rillig 8882:
1.35 jmmv 8883: <div class="itemizedlist">
8884: <ul type="disc">
8885: <li>
8886: <p><code class="varname">MAKE_DIRS</code> and
8887: <code class="varname">OWN_DIRS</code> contain a
8888: list of directories that should be created and
8889: should attempt to be destroyed by the
8890: installation scripts. The difference between the
8891: two is that the latter prompts the administrator
8892: to remove any directories that may be left after
8893: deinstallation (because they were not empty),
8894: while the former does not.</p>
8895: </li>
1.1 grant 8896:
1.35 jmmv 8897: <li>
8898: <p><code class="varname">MAKE_DIRS_PERMS</code>
8899: and <code class="varname">OWN_DIRS_PERMS</code>
8900: contain a list of tuples describing which
8901: directories should be created and should attempt
8902: to be destroyed by the installation scripts. Each
8903: tuple holds the following values, separated by
8904: spaces: the directory name, its owner, its group
8905: and its numerical mode. For example:</p>
8906: <pre class="programlisting">
8907: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
8908: </pre>
1.1 grant 8909:
1.35 jmmv 8910: <p>The difference between the two is exactly the
8911: same as their non-<code class=
8912: "varname">PERMS</code> counterparts.</p>
8913: </li>
8914: </ul>
8915: </div>
8916: </div>
8917:
8918: <div class="sect2" lang="en" xml:lang="en">
8919: <div class="titlepage">
8920: <div>
8921: <div>
8922: <h3 class="title"><a name="files-outside-prefix"
1.38 dillo 8923: id="files-outside-prefix"></a>12.1.2. File
1.35 jmmv 8924: manipulation</h3>
8925: </div>
8926: </div>
8927: </div>
8928:
8929: <p>Creating non-empty files outside the installation
1.45 ! wiz 8930: prefix is tricky because the <code xmlns=
! 8931: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 8932: "filename">PLIST</code> forces all files to be inside
8933: it. To overcome this problem, the only solution is to
8934: extract the file in the known place (i.e., inside the
8935: installation prefix) and copy it to the appropriate
8936: location during installation (done by the installation
8937: scripts generated by pkginstall). We will call the
8938: former the <span class="emphasis"><em>master
8939: file</em></span> in the following paragraphs, which
8940: describe the variables that can be used to
8941: automatically and consistently handle files outside the
8942: installation prefix:</p>
8943:
8944: <div class="itemizedlist">
8945: <ul type="disc">
8946: <li>
8947: <p><code class="varname">CONF_FILES</code> and
8948: <code class="varname">SUPPORT_FILES</code> are
8949: pairs of master and target files. During
8950: installation time, the master file is copied to
8951: the target one if and only if the latter does not
8952: exist. Upon deinstallation, the target file is
8953: removed provided that it was not modified by the
8954: installation.</p>
8955:
8956: <p>The difference between the two is that the
8957: latter prompts the administrator to remove any
8958: files that may be left after deinstallation
8959: (because they were not empty), while the former
8960: does not.</p>
8961: </li>
8962:
8963: <li>
8964: <p><code class="varname">CONF_FILES_PERMS</code>
8965: and <code class=
8966: "varname">SUPPORT_FILES_PERMS</code> contain
8967: tuples describing master files as well as their
8968: target locations. For each of them, it also
8969: specifies their owner, their group and their
8970: numeric permissions, in this order. For
8971: example:</p>
8972: <pre class="programlisting">
8973: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
8974: </pre>
8975:
8976: <p>The difference between the two is exactly the
8977: same as their non-<code class=
8978: "varname">PERMS</code> counterparts.</p>
8979: </li>
8980: </ul>
8981: </div>
8982: </div>
8983: </div>
8984:
8985: <div class="sect1" lang="en" xml:lang="en">
8986: <div class="titlepage">
8987: <div>
8988: <div>
8989: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8990: "conf-files" id="conf-files"></a>12.2.
1.35 jmmv 8991: Configuration files</h2>
8992: </div>
8993: </div>
8994: </div>
8995:
8996: <p>Configuration files are special in the sense that they
8997: are installed in their own specific directory,
8998: <code class="varname">PKG_SYSCONFDIR</code>, and need
8999: special treatment during installation (most of which is
9000: automated by pkginstall). The main concept you must bear
1.36 wiz 9001: in mind is that files marked as configuration files are
1.35 jmmv 9002: automatically copied to the right place (somewhere inside
9003: <code class="varname">PKG_SYSCONFDIR</code>) during
9004: installation <span class="emphasis"><em>if and only
9005: if</em></span> they didn't exist before. Similarly, they
9006: will not be removed if they have local modifications.
1.36 wiz 9007: This ensures that administrators never lose any custom
1.35 jmmv 9008: changes they may have made.</p>
9009:
9010: <div class="sect2" lang="en" xml:lang="en">
9011: <div class="titlepage">
9012: <div>
9013: <div>
9014: <h3 class="title"><a name="conf-files-sysconfdir"
1.38 dillo 9015: id="conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 9016: <code class="varname">PKG_SYSCONFDIR</code> is
9017: set</h3>
9018: </div>
9019: </div>
9020: </div>
9021:
9022: <p>As said before, the <code class=
9023: "varname">PKG_SYSCONFDIR</code> variable specifies
9024: where configuration files shall be installed. Its
9025: contents are set based upon the following
9026: variables:</p>
9027:
9028: <div class="itemizedlist">
9029: <ul type="disc">
9030: <li>
9031: <p><code class="varname">PKG_SYSCONFBASE</code>:
9032: The configuration's root directory. Defaults to
1.45 ! wiz 9033: <code xmlns=
! 9034: "http://www.w3.org/TR/xhtml1/transitional" class=
! 9035: "filename">${PREFIX}/etc</code> although it may
! 9036: be overridden by the user to point to his
! 9037: preferred location (e.g., <code xmlns=
! 9038: "http://www.w3.org/TR/xhtml1/transitional" class=
! 9039: "filename">/etc</code>, <code xmlns=
! 9040: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9041: "filename">/etc/pkg</code>, etc.). Packages must
9042: not use it directly.</p>
9043: </li>
9044:
9045: <li>
9046: <p><code class=
9047: "varname">PKG_SYSCONFSUBDIR</code>: A
9048: subdirectory of <code class=
9049: "varname">PKG_SYSCONFBASE</code> under which the
9050: configuration files for the package being built
9051: shall be installed. The definition of this
9052: variable only makes sense in the package's
1.45 ! wiz 9053: <code xmlns=
! 9054: "http://www.w3.org/TR/xhtml1/transitional" class=
! 9055: "filename">Makefile</code> (i.e., it is not user
! 9056: customizable).</p>
1.35 jmmv 9057:
9058: <p>As an example, consider the Apache package,
9059: <a xmlns=
9060: "http://www.w3.org/TR/xhtml1/transitional" href=
9061: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45 ! wiz 9062: target="_top"><code xmlns="" class=
! 9063: "filename">www/apache2</code></a>, which places
! 9064: its configuration files under the <code xmlns=
! 9065: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9066: "filename">httpd/</code> subdirectory of
9067: <code class="varname">PKG_SYSCONFBASE</code>.
9068: This should be set in the package Makefile.</p>
9069: </li>
9070:
9071: <li>
9072: <p><code class="varname">PKG_SYSCONFVAR</code>:
9073: Specifies the name of the variable that holds
9074: this package's configuration directory (if
9075: different from <code class=
9076: "varname">PKG_SYSCONFBASE</code>). It defaults to
9077: <code class="varname">PKGBASE</code>'s value, and
9078: is always prefixed with <code class=
9079: "literal">PKG_SYSCONFDIR</code>.</p>
9080: </li>
9081:
9082: <li>
9083: <p><code class=
9084: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
9085: Holds the directory where the configuration files
9086: for the package identified by <code class=
9087: "varname">PKG_SYSCONFVAR</code>'s shall be
9088: placed.</p>
9089: </li>
9090: </ul>
9091: </div>
9092:
9093: <p>Based on the above variables, pkginstall determines
9094: the value of <code class=
9095: "varname">PKG_SYSCONFDIR</code>, which is the
9096: <span class="emphasis"><em>only</em></span> variable
9097: that can be used within a package to refer to its
9098: configuration directory. The algorithm used to set its
9099: value is basically the following:</p>
9100:
9101: <div class="orderedlist">
9102: <ol type="1">
9103: <li>
9104: <p>If <code class=
9105: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9106: is set, its value is used.</p>
9107: </li>
9108:
9109: <li>
9110: <p>If the previous variable is not defined but
9111: <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45 ! wiz 9112: set in the package's <code xmlns=
! 9113: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9114: "filename">Makefile</code>, the resulting value
1.45 ! wiz 9115: is <code xmlns=
! 9116: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9117: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
9118: </li>
9119:
9120: <li>
1.45 ! wiz 9121: <p>Otherwise, it is set to <code xmlns=
! 9122: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9123: "filename">${PKG_SYSCONFBASE}</code>.</p>
9124: </li>
9125: </ol>
9126: </div>
9127:
1.45 ! wiz 9128: <p>It is worth mentioning that <code xmlns=
! 9129: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9130: "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45 ! wiz 9131: added to <code xmlns=
! 9132: "http://www.w3.org/TR/xhtml1/transitional" class=
! 9133: "filename">OWN_DIRS</code>. See <a href=
! 9134: "#dirs-outside-prefix" title=
1.38 dillo 9135: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 9136: “Directory manipulation”</a> what this
9137: means.</p>
9138: </div>
9139:
9140: <div class="sect2" lang="en" xml:lang="en">
9141: <div class="titlepage">
9142: <div>
9143: <div>
9144: <h3 class="title"><a name="conf-files-configure"
1.38 dillo 9145: id="conf-files-configure"></a>12.2.2. Telling the
1.35 jmmv 9146: software were configuration files are</h3>
9147: </div>
9148: </div>
9149: </div>
9150:
9151: <p>Given that pkgsrc (and users!) expect configuration
9152: files to be in a known place, you need to teach each
1.36 wiz 9153: package where it shall install its files. In some cases
1.35 jmmv 9154: you will have to patch the package Makefiles to achieve
9155: it. If you are lucky, though, it may be as easy as
9156: passing an extra flag to the configuration script; this
9157: is the case of GNU Autoconf generated files:</p>
9158: <pre class="programlisting">
9159: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
9160: </pre>
9161:
9162: <p>Note that this specifies where the package has to
9163: <span class="emphasis"><em>look for</em></span> its
9164: configuration files, not where they will be originally
9165: installed (although the difference is never explicit,
9166: unfortunately).</p>
9167: </div>
9168:
9169: <div class="sect2" lang="en" xml:lang="en">
9170: <div class="titlepage">
9171: <div>
9172: <div>
9173: <h3 class="title"><a name="conf-files-patching"
1.38 dillo 9174: id="conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 9175: installations</h3>
9176: </div>
9177: </div>
9178: </div>
9179:
9180: <p>As said before, pkginstall automatically handles
9181: configuration files. This means that <span class=
9182: "strong"><strong>the packages themselves must not touch
1.45 ! wiz 9183: the contents of <code xmlns=
! 9184: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9185: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 9186: directly</strong></span>. Bad news is that many
9187: software installation scripts will, out of the box,
9188: mess with the contents of that directory. So what is
9189: the correct procedure to fix this issue?</p>
1.35 jmmv 9190:
9191: <p>You must teach the package (usually by manually
9192: patching it) to install any configuration files under
1.45 ! wiz 9193: the examples hierarchy, <code xmlns=
! 9194: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9195: "filename">share/examples/${PKGBASE}/</code>. This way,
1.45 ! wiz 9196: the <code xmlns=
! 9197: "http://www.w3.org/TR/xhtml1/transitional" class=
! 9198: "filename">PLIST</code> registers them and the
! 9199: administrator always has the original copies
1.35 jmmv 9200: available.</p>
9201:
9202: <p>Once the required configuration files are in place
9203: (i.e., under the examples hierarchy), the pkginstall
9204: framework can use them as master copies during the
1.45 ! wiz 9205: package installation to update what is in <code xmlns=
! 9206: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9207: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
9208: the variables <code class="varname">CONF_FILES</code>
9209: and <code class="varname">CONF_FILES_PERMS</code> are
9210: used. Check out <a href="#files-outside-prefix" title=
1.38 dillo 9211: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 9212: “File manipulation”</a> for information
9213: about their syntax and their purpose. Here is an
9214: example, taken from the <a xmlns=
9215: "http://www.w3.org/TR/xhtml1/transitional" href=
9216: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45 ! wiz 9217: target="_top"><code xmlns="" class=
! 9218: "filename">mail/mutt</code></a> package:</p>
1.35 jmmv 9219: <pre class="programlisting">
9220: EGDIR= ${PREFIX}/share/doc/mutt/samples
9221: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
9222: </pre>
9223:
9224: <p>Note that the <code class="varname">EGDIR</code>
9225: variable is specific to that package and has no meaning
9226: outside it.</p>
9227: </div>
9228:
9229: <div class="sect2" lang="en" xml:lang="en">
9230: <div class="titlepage">
9231: <div>
9232: <div>
9233: <h3 class="title"><a name="conf-files-disable"
1.38 dillo 9234: id="conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 9235: handling of configuration files</h3>
9236: </div>
9237: </div>
9238: </div>
9239:
9240: <p>The automatic copying of config files can be toggled
9241: by setting the environment variable <code class=
9242: "varname">PKG_CONFIG</code> prior to package
9243: installation.</p>
9244: </div>
9245: </div>
9246:
9247: <div class="sect1" lang="en" xml:lang="en">
9248: <div class="titlepage">
9249: <div>
9250: <div>
9251: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9252: "rcd-scripts" id="rcd-scripts"></a>12.3. System
1.35 jmmv 9253: startup scripts</h2>
9254: </div>
9255: </div>
9256: </div>
9257:
9258: <p>System startup scripts are special files because they
9259: must be installed in a place known by the underlying OS,
9260: usually outside the installation prefix. Therefore, the
9261: same rules described in <a href=
9262: "#files-and-dirs-outside-prefix" title=
1.38 dillo 9263: "12.1. Files and directories outside the installation prefix">
9264: Section 12.1, “Files and directories outside the
1.35 jmmv 9265: installation prefix”</a> apply, and the same
9266: solutions can be used. However, pkginstall provides a
1.36 wiz 9267: special mechanism to handle these files.</p>
1.35 jmmv 9268:
9269: <p>In order to provide system startup scripts, the
9270: package has to:</p>
9271:
9272: <div class="orderedlist">
9273: <ol type="1">
9274: <li>
1.45 ! wiz 9275: <p>Store the script inside <code xmlns=
! 9276: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9277: "filename">${FILESDIR}</code>, with the
9278: <code class="literal">.sh</code> suffix appended.
9279: Considering the <a xmlns=
9280: "http://www.w3.org/TR/xhtml1/transitional" href=
9281: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45 ! wiz 9282: target="_top"><code xmlns="" class=
! 9283: "filename">print/cups</code></a> package as an
! 9284: example, it has a <code xmlns=
! 9285: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9286: "filename">cupsd.sh</code> in its files
9287: directory.</p>
9288: </li>
9289:
9290: <li>
9291: <p>Tell pkginstall to handle it, appending the name
9292: of the script, without its extension, to the
9293: <code class="varname">RCD_SCRIPTS</code> variable.
9294: Continuing the previous example:</p>
9295: <pre class="programlisting">
9296: RCD_SCRIPTS+= cupsd
9297: </pre>
9298: </li>
9299: </ol>
9300: </div>
9301:
9302: <p>Once this is done, pkginstall will do the following
9303: steps for each script in an automated fashion:</p>
9304:
9305: <div class="orderedlist">
9306: <ol type="1">
9307: <li>
9308: <p>Process the file found in the files directory
9309: applying all the substitutions described in the
1.45 ! wiz 9310: <code xmlns=
! 9311: "http://www.w3.org/TR/xhtml1/transitional" class=
! 9312: "filename">FILES_SUBST</code> variable.</p>
1.35 jmmv 9313: </li>
9314:
9315: <li>
9316: <p>Copy the script from the files directory to the
1.45 ! wiz 9317: examples hierarchy, <code xmlns=
! 9318: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9319: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 9320: Note that this master file must be explicitly
1.45 ! wiz 9321: registered in the <code xmlns=
! 9322: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9323: "filename">PLIST</code>.</p>
9324: </li>
9325:
9326: <li>
9327: <p>Add code to the installation scripts to copy the
9328: startup script from the examples hierarchy into the
9329: system-wide startup scripts directory.</p>
9330: </li>
9331: </ol>
9332: </div>
9333:
9334: <div class="sect2" lang="en" xml:lang="en">
9335: <div class="titlepage">
9336: <div>
9337: <div>
9338: <h3 class="title"><a name="rcd-scripts-disable"
1.38 dillo 9339: id="rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 9340: handling of system startup scripts</h3>
9341: </div>
9342: </div>
9343: </div>
9344:
9345: <p>The automatic copying of config files can be toggled
9346: by setting the environment variable <code class=
9347: "varname">PKG_RCD_SCRIPTS</code> prior to package
9348: installation. Note that the scripts will be always
1.45 ! wiz 9349: copied inside the examples hierarchy, <code xmlns=
! 9350: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9351: "filename">${PREFIX}/share/examples/rc.d/</code>, no
9352: matter what the value of this variable is.</p>
9353: </div>
9354: </div>
9355:
9356: <div class="sect1" lang="en" xml:lang="en">
9357: <div class="titlepage">
9358: <div>
9359: <div>
9360: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9361: "users-and-groups" id="users-and-groups"></a>12.4.
1.35 jmmv 9362: System users and groups</h2>
9363: </div>
9364: </div>
9365: </div>
9366:
9367: <p>If a package needs to create special users and/or
9368: groups during installation, it can do so by using the
9369: pkginstall framework.</p>
9370:
9371: <p>Users can be created by adding entries to the
9372: <code class="varname">PKG_USERS</code> variable. Each
1.45 ! wiz 9373: entry has the following syntax, which mimics <code xmlns=
! 9374: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9375: "filename">/etc/passwd</code>:</p>
9376: <pre class="programlisting">
9377: user:group[:[userid][:[descr][:[home][:shell]]]]
9378: </pre>
9379:
9380: <p>Only the user and group are required; everything else
9381: is optional, but the colons must be in the right places
9382: when specifying optional bits. By default, a new user
1.45 ! wiz 9383: will have home directory <code xmlns=
! 9384: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9385: "filename">/nonexistent</code>, and login shell
1.45 ! wiz 9386: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 9387: class="filename">/sbin/nologin</code> unless they are
! 9388: specified as part of the user element. Note that if the
! 9389: description contains spaces, then spaces should be double
! 9390: backslash-escaped, as in:</p>
1.35 jmmv 9391: <pre class="programlisting">
9392: foo:foogrp::The\\ Foomister
9393: </pre>
9394:
9395: <p>Similarly, groups can be created using the
9396: <code class="varname">PKG_GROUPS</code> variable, whose
9397: syntax is:</p>
9398: <pre class="programlisting">
9399: group[:groupid]
9400: </pre>
9401:
9402: <p>As before, only the group name is required; the
9403: numeric identifier is optional.</p>
9404: </div>
9405:
9406: <div class="sect1" lang="en" xml:lang="en">
9407: <div class="titlepage">
9408: <div>
9409: <div>
9410: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9411: "shells" id="shells"></a>12.5. System shells</h2>
1.35 jmmv 9412: </div>
9413: </div>
9414: </div>
9415:
9416: <p>Packages that install system shells should register
1.45 ! wiz 9417: them in the shell database, <code xmlns=
! 9418: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9419: "filename">/etc/shells</code>, to make things easier to
9420: the administrator. This must be done from the
9421: installation scripts to keep binary packages working on
9422: any system. pkginstall provides an easy way to accomplish
9423: this task.</p>
9424:
9425: <p>When a package provides a shell interpreter, it has to
9426: set the <code class="varname">PKG_SHELL</code> variable
9427: to its absolute file name. This will add some hooks to
9428: the installation scripts to handle it. Consider the
9429: following example, taken from <a xmlns=
9430: "http://www.w3.org/TR/xhtml1/transitional" href=
9431: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45 ! wiz 9432: target="_top"><code xmlns="" class=
! 9433: "filename">shells/zsh</code></a>:</p>
1.35 jmmv 9434: <pre class="programlisting">
9435: USE_PKGINSTALL= YES
9436: PKG_SHELL= ${PREFIX}/bin/zsh
9437: </pre>
9438:
9439: <div class="sect2" lang="en" xml:lang="en">
9440: <div class="titlepage">
9441: <div>
9442: <div>
9443: <h3 class="title"><a name="shells-disable" id=
1.38 dillo 9444: "shells-disable"></a>12.5.1. Disabling handling
1.35 jmmv 9445: of configuration files</h3>
9446: </div>
9447: </div>
9448: </div>
9449:
9450: <p>The automatic registration of shell interpreters can
9451: be disabled by the administrator by setting the
1.45 ! wiz 9452: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 9453: class="filename">PKG_REGISTER_SHELLS</code> environment
! 9454: variable to <code class="literal">NO</code>.</p>
1.35 jmmv 9455: </div>
9456: </div>
9457: </div>
9458:
9459: <div class="chapter" lang="en" xml:lang="en">
9460: <div class="titlepage">
9461: <div>
9462: <div>
9463: <h2 class="title"><a name="options" id=
1.38 dillo 9464: "options"></a>Chapter 13. Options
1.35 jmmv 9465: handling</h2>
9466: </div>
9467: </div>
9468: </div>
9469:
9470: <div class="toc">
9471: <p><b>Table of Contents</b></p>
9472:
9473: <dl>
9474: <dt><span class="sect1"><a href=
1.38 dillo 9475: "#global-default-options">13.1. Global default
1.35 jmmv 9476: options</a></span></dt>
9477:
9478: <dt><span class="sect1"><a href=
1.38 dillo 9479: "#converting-to-options">13.2. Converting packages to
1.45 ! wiz 9480: use <code xmlns=
! 9481: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9482: "filename">bsd.options.mk</code></a></span></dt>
9483: </dl>
9484: </div>
9485:
9486: <p>Many packages have the ability to be built to support
1.45 ! wiz 9487: different sets of features. <code xmlns=
! 9488: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9489: "filename">bsd.options.mk</code> is a framework in pkgsrc
9490: that provides generic handling of those options that
9491: determine different ways in which the packages can be
9492: built. It's possible for the user to specify exactly which
9493: sets of options will be built into a package or to allow a
9494: set of global default options apply.</p>
9495:
9496: <div class="sect1" lang="en" xml:lang="en">
9497: <div class="titlepage">
9498: <div>
9499: <div>
9500: <h2 class="title" style="clear: both"><a name=
9501: "global-default-options" id=
1.38 dillo 9502: "global-default-options"></a>13.1. Global
1.35 jmmv 9503: default options</h2>
9504: </div>
9505: </div>
9506: </div>
9507:
9508: <p>Global default options are listed in <code class=
9509: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
9510: the options that should be built into every package if
9511: that option is supported. This variable should be set in
1.45 ! wiz 9512: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 9513: class="filename">/etc/mk.conf</code>.</p>
1.35 jmmv 9514: </div>
9515:
9516: <div class="sect1" lang="en" xml:lang="en">
9517: <div class="titlepage">
9518: <div>
9519: <div>
9520: <h2 class="title" style="clear: both"><a name=
9521: "converting-to-options" id=
1.38 dillo 9522: "converting-to-options"></a>13.2. Converting
1.45 ! wiz 9523: packages to use <code xmlns=
! 9524: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9525: "filename">bsd.options.mk</code></h2>
9526: </div>
9527: </div>
9528: </div>
9529:
1.45 ! wiz 9530: <p>The following example shows how <code xmlns=
! 9531: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9532: "filename">bsd.options.mk</code> should be used by the
9533: hypothetical ``wibble'' package, either in the package
1.45 ! wiz 9534: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 9535: class="filename">Makefile</code>, or in a file, e.g.
! 9536: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 9537: class="filename">options.mk</code>, that is included by
! 9538: the main package <code xmlns=
! 9539: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9540: "filename">Makefile</code>.</p>
9541: <pre class="programlisting">
1.37 dillo 9542: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
9543: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
9544: PKG_OPTIONAL_GROUPS= database
9545: PKG_GROUP.database= mysql pgsql
9546: PKG_SUGGESTED_OPTIONS= wibble-foo
9547: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
9548: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
9549:
9550: .include "../../mk/bsd.prefs.mk"
9551:
9552: # this package was previously named wibble2
9553: .if defined(PKG_OPTIONS.wibble2)
9554: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
1.40 dillo 9555: PKG_OPTIONS_DEPRECATED_WARNINGS+="Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
1.37 dillo 9556: .endif
1.35 jmmv 9557:
9558: .include "../../mk/bsd.options.mk"
9559:
9560: # Package-specific option-handling
9561:
9562: ###
1.37 dillo 9563: ### FOO support
9564: ###
9565: .if !empty(PKG_OPTIONS:Mwibble-foo)
9566: CONFIGURE_ARGS+= --enable-foo
9567: .endif
9568:
9569: ###
1.35 jmmv 9570: ### LDAP support
9571: ###
9572: .if !empty(PKG_OPTIONS:Mldap)
9573: . include "../../databases/openldap/buildlink3.mk"
1.37 dillo 9574: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
1.35 jmmv 9575: .endif
1.1 grant 9576:
9577: ###
1.37 dillo 9578: ### database support
1.1 grant 9579: ###
1.37 dillo 9580: .if !empty(PKG_OPTIONS:Mmysql)
9581: . include "../../mk/mysql.buildlink3.mk"
9582: .endif
9583: .if !empty(PKG_OPTIONS:Mpgsql)
9584: . include "../../mk/pgsql.buildlink3.mk"
1.1 grant 9585: .endif
9586: </pre>
9587:
1.28 rillig 9588: <p>The first section contains the information about which
9589: build options are supported by the package, and any
1.1 grant 9590: default options settings if needed.</p>
9591:
9592: <div class="orderedlist">
9593: <ol type="1">
9594: <li>
1.14 xtraeme 9595: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 9596: the name of the <a href=
1.1 grant 9597: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9598: <span class="citerefentry"><span class=
1.27 rillig 9599: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 9600: that the user can set to override the default
9601: options. It should be set to “<span class=
9602: "quote">PKG_OPTIONS.<em class=
1.38 dillo 9603: "replaceable"><code>pkgbase</code></em></span>”.</p>
1.1 grant 9604: </li>
9605:
9606: <li>
1.14 xtraeme 9607: <p><code class=
9608: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 9609: build options supported by the package.</p>
9610: </li>
9611:
9612: <li>
9613: <p><code class=
9614: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
9615: list of names of groups of mutually exclusive
9616: options. The options in each group are listed in
9617: <code class="varname">PKG_OPTIONS_GROUP.<em class=
9618: "replaceable"><code>groupname</code></em></code>.
9619: The most specific setting of any option from the
9620: group takes precedence over all other options in
9621: the group. Options from the groups will be
9622: automatically added to <code class=
9623: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
9624: </li>
9625:
9626: <li>
9627: <p><code class=
9628: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
9629: like <code class=
9630: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
9631: building the packages will fail if no option from
9632: the group is selected.</p>
1.1 grant 9633: </li>
9634:
9635: <li>
1.27 rillig 9636: <p><code class=
1.44 gdt 9637: "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
9638: list of names of sets of options. At least one
9639: option from each set must be selected. The options
9640: in each set are listed in <code class=
9641: "varname">PKG_OPTIONS_SET.<em class=
9642: "replaceable"><code>setname</code></em></code>.
9643: Options from the sets will be automatically added
9644: to <code class=
9645: "varname">PKG_SUPPORTED_OPTIONS</code>. Building
9646: the package will fail if no option from the set is
9647: selected.</p>
9648: </li>
9649:
9650: <li>
9651: <p><code class=
1.27 rillig 9652: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
9653: build options which are enabled by default.</p>
9654: </li>
9655:
9656: <li>
1.37 dillo 9657: <p><code class=
9658: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
9659: of “<span class="quote"><em class=
9660: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable">
9661: <code>option</code></em></span>” pairs that
1.45 ! wiz 9662: map legacy <code xmlns=
! 9663: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9664: "filename">/etc/mk.conf</code> variables to their
9665: option counterparts. Pairs should be added with
9666: “<span class="quote">+=</span>” to keep
9667: the listing of global legacy variables. A warning
9668: will be issued if the user uses a legacy
9669: variable.</p>
9670: </li>
1.1 grant 9671:
1.37 dillo 9672: <li>
9673: <p><code class=
9674: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
9675: of “<span class="quote"><em class=
9676: "replaceable"><code>old-option</code></em>:<em class="replaceable">
9677: <code>new-option</code></em></span>” pairs
9678: that map options that have been renamed to their
9679: new counterparts. Pairs should be added with
9680: “<span class="quote">+=</span>” to keep
9681: the listing of global legacy options. A warning
9682: will be issued if the user uses a legacy
9683: option.</p>
9684: </li>
1.1 grant 9685:
1.37 dillo 9686: <li>
9687: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
9688: is a list of options implied by deprecated
9689: variables used. This can be used for cases that
9690: neither <code class=
9691: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
9692: <code class=
9693: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
9694: handle, e. g. when <code class=
9695: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 9696: </li>
9697:
9698: <li>
1.37 dillo 9699: <p><code class=
9700: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
9701: a list of warnings about deprecated variables or
9702: options used, and what to use instead.</p>
1.1 grant 9703: </li>
1.28 rillig 9704: </ol>
1.1 grant 9705: </div>
9706:
1.37 dillo 9707: <p>A package should never modify <code class=
9708: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
9709: named in <code class="varname">PKG_OPTIONS_VAR</code>.
9710: These are strictly user-settable. To suggest a default
9711: set of options, use <code class=
9712: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
9713:
1.42 dillo 9714: <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45 ! wiz 9715: defined before including <code xmlns=
! 9716: "http://www.w3.org/TR/xhtml1/transitional" class=
1.42 dillo 9717: "filename">bsd.options.mk</code>. If none of <code class=
1.37 dillo 9718: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
9719: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
9720: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.42 dillo 9721: are defined (as can happen with platform specific options
9722: if none of them is supported on the current platform),
9723: <code class="varname">PKG_OPTIONS</code> is set to the
9724: empty list and the package is otherwise treated as not
9725: using the options framework.</p>
1.37 dillo 9726:
1.45 ! wiz 9727: <p>After the inclusion of <code xmlns=
! 9728: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9729: "filename">bsd.options.mk</code>, the variable
1.28 rillig 9730: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 9731: list of selected build options, properly filtered to
1.28 rillig 9732: remove unsupported and duplicate options.</p>
9733:
1.1 grant 9734: <p>The remaining sections contain the logic that is
1.37 dillo 9735: specific to each option. The correct way to check for an
9736: option is to check whether it is listed in <code class=
9737: "varname">PKG_OPTIONS</code>:</p>
9738: <pre class="programlisting">
9739: .if !empty(PKG_OPTIONS:M<em class=
9740: "replaceable"><code>option</code></em>)
9741: </pre>
9742:
9743: <p>If another package already has an option with the same
9744: meaning, use the same name. For options applicable to
9745: multiple packages (like enabling support for a library),
9746: use short option names (like the name of the library).
9747: For options specific to this package, prefix the name
9748: with <code class="varname"><em class=
9749: "replaceable"><code>pkgname</code></em>-</code>. Document
1.45 ! wiz 9750: the option and its meaning in <code xmlns=
! 9751: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9752: "filename">mk/defaults/options.description</code>.</p>
1.1 grant 9753: </div>
9754: </div>
9755:
9756: <div class="chapter" lang="en" xml:lang="en">
9757: <div class="titlepage">
9758: <div>
9759: <div>
9760: <h2 class="title"><a name="build" id=
1.38 dillo 9761: "build"></a>Chapter 14. The build
1.1 grant 9762: process</h2>
9763: </div>
9764: </div>
9765: </div>
9766:
9767: <div class="toc">
9768: <p><b>Table of Contents</b></p>
9769:
9770: <dl>
1.38 dillo 9771: <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1 grant 9772: Program location</a></span></dt>
9773:
1.38 dillo 9774: <dt><span class="sect1"><a href="#main-targets">14.2.
1.30 wiz 9775: Main targets</a></span></dt>
1.1 grant 9776:
9777: <dt><span class="sect1"><a href=
1.38 dillo 9778: "#build.helpful-targets">14.3. Other helpful
1.1 grant 9779: targets</a></span></dt>
9780: </dl>
9781: </div>
9782:
9783: <p>The basic steps for building a program are always the
9784: same. First the program's source (<span class=
9785: "emphasis"><em>distfile</em></span>) must be brought to the
9786: local system and then extracted. After any patches to
9787: compile properly on NetBSD are applied, the software can be
9788: configured, then built (usually by compiling), and finally
9789: the generated binaries, etc. can be put into place on the
9790: system. These are exactly the steps performed by the NetBSD
9791: package system, which is implemented as a series of targets
1.45 ! wiz 9792: in a central Makefile, <code xmlns=
! 9793: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9794: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 9795:
9796: <div class="sect1" lang="en" xml:lang="en">
9797: <div class="titlepage">
9798: <div>
9799: <div>
9800: <h2 class="title" style="clear: both"><a name=
9801: "build.prefix" id=
1.38 dillo 9802: "build.prefix"></a>14.1. Program location</h2>
1.1 grant 9803: </div>
9804: </div>
9805: </div>
9806:
9807: <p>Before outlining the process performed by the NetBSD
9808: package system in the next section, here's a brief
9809: discussion on where programs are installed, and which
9810: variables influence this.</p>
9811:
1.14 xtraeme 9812: <p>The automatic variable <code class=
9813: "varname">PREFIX</code> indicates where all files of the
9814: final program shall be installed. It is usually set to
1.45 ! wiz 9815: <code class="varname">LOCALBASE</code> (<code xmlns=
! 9816: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9817: "filename">/usr/pkg</code>), or <code class=
9818: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 9819: “<span class="quote">cross</span>” category.
1.14 xtraeme 9820: The value of <code class="varname">PREFIX</code> needs to
9821: be put into the various places in the program's source
9822: where paths to these files are encoded. See <a href=
1.1 grant 9823: "#components.patches" title=
1.38 dillo 9824: "8.3. patches/*">Section 8.3,
1.1 grant 9825: “patches/*”</a> and <a href="#fixes.libtool"
9826: title=
1.38 dillo 9827: "15.3.1. Shared libraries - libtool">Section 15.3.1,
1.1 grant 9828: “Shared libraries - libtool”</a> for more
9829: details.</p>
9830:
9831: <p>When choosing which of these variables to use, follow
9832: the following rules:</p>
9833:
9834: <div class="itemizedlist">
9835: <ul type="disc">
9836: <li>
1.14 xtraeme 9837: <p><code class="varname">PREFIX</code> always
9838: points to the location where the current pkg will
9839: be installed. When referring to a pkg's own
1.1 grant 9840: installation path, use “<span class=
9841: "quote">${PREFIX}</span>”.</p>
9842: </li>
9843:
9844: <li>
1.14 xtraeme 9845: <p><code class="varname">LOCALBASE</code> is where
9846: all non-X11 pkgs are installed. If you need to
1.1 grant 9847: construct a -I or -L argument to the compiler to
9848: find includes and libraries installed by another
9849: non-X11 pkg, use “<span class=
9850: "quote">${LOCALBASE}</span>”.</p>
9851: </li>
9852:
9853: <li>
1.14 xtraeme 9854: <p><code class="varname">X11BASE</code> is where
9855: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 9856: installed. When looking for <span class=
9857: "emphasis"><em>standard</em></span> X11 includes
9858: (not those installed by a pkg), use
9859: “<span class=
9860: "quote">${X11BASE}</span>”.</p>
9861: </li>
9862:
9863: <li>
9864: <p>X11 based are special in that they may be
1.14 xtraeme 9865: installed in either <code class=
9866: "varname">X11BASE</code> or <code class=
9867: "varname">LOCALBASE</code>.</p>
1.1 grant 9868:
9869: <p>Usually, X11 packages should be installed under
1.14 xtraeme 9870: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 9871: possible. Note that you will need to include
1.45 ! wiz 9872: <code xmlns=
! 9873: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 9874: "filename">../../mk/x11.buildlink3.mk</code> in
9875: them to request the presence of X11 and to get the
9876: right compilation flags.</p>
1.1 grant 9877:
9878: <p>Even though, there are some packages that cannot
1.14 xtraeme 9879: be installed under <code class=
9880: "varname">LOCALBASE</code>: those that come with
1.1 grant 9881: app-defaults files. These packages are special and
1.14 xtraeme 9882: they must be placed under <code class=
9883: "varname">X11BASE</code>. To accomplish this, set
9884: either <code class="varname">USE_X11BASE</code> or
9885: <code class="varname">USE_IMAKE</code> in your
1.1 grant 9886: package.</p>
9887:
1.34 wiz 9888: <p>Some notes: If you need to find includes or
1.14 xtraeme 9889: libraries installed by a pkg that has <code class=
9890: "varname">USE_IMAKE</code> or <code class=
9891: "varname">USE_X11BASE</code> in its pkg
1.45 ! wiz 9892: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 9893: class="filename">Makefile</code>, you need to look
! 9894: in <span class="emphasis"><em>both</em></span>
! 9895: <code xmlns=
! 9896: "http://www.w3.org/TR/xhtml1/transitional" class=
! 9897: "filename">${X11BASE}</code> and <code xmlns=
! 9898: "http://www.w3.org/TR/xhtml1/transitional" class=
! 9899: "filename">${LOCALBASE}</code>. To force
! 9900: installation of all X11 packages in <code class=
! 9901: "varname">LOCALBASE</code>, the <a xmlns=
! 9902: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 9903: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 ! wiz 9904: target="_top"><code xmlns="" class=
! 9905: "filename">pkgtools/xpkgwedge</code></a> package is
1.34 wiz 9906: enabled by default.</p>
1.1 grant 9907: </li>
9908:
9909: <li>
1.14 xtraeme 9910: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 9911: used to refer to the installed location of an X11
1.14 xtraeme 9912: package. <code class="varname">X11PREFIX</code>
9913: will be set to <code class="varname">X11BASE</code>
9914: if xpkgwedge is not installed, and to <code class=
9915: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 9916: installed.</p>
9917: </li>
9918:
9919: <li>
9920: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 9921: have some packages installed in <code class=
9922: "varname">X11BASE</code> and some in <code class=
9923: "varname">LOCALBASE</code>. To determine the prefix
9924: of an installed package, the <code class=
9925: "varname">EVAL_PREFIX</code> definition can be
9926: used. It takes pairs in the format
9927: “<span class=
1.1 grant 9928: "quote">DIRNAME=<package></span>”, and
1.24 wiz 9929: the <a href=
9930: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9931: <span class="citerefentry"><span class=
9932: "refentrytitle">make</span>(1)</span></a> variable
9933: <code class="varname">DIRNAME</code> will be set to
9934: the prefix of the installed package
9935: <package>, or “<span class=
1.1 grant 9936: "quote">${X11PREFIX}</span>” if the package
9937: is not installed.</p>
9938:
9939: <p>This is best illustrated by example.</p>
9940:
1.45 ! wiz 9941: <p>The following lines are taken from <code xmlns=
! 9942: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9943: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 9944: <pre class="programlisting">
1.14 xtraeme 9945: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 9946: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
9947: --with-gtk-prefix="${GTKDIR}" \
9948: --enable-multibyte
9949: </pre>
9950:
9951: <p>Specific defaults can be defined for the
1.14 xtraeme 9952: packages evaluated using <code class=
9953: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 9954: of the form:</p>
9955: <pre class="programlisting">
9956: GTKDIR_DEFAULT= ${LOCALBASE}
9957: </pre>
9958:
1.14 xtraeme 9959: <p>where <code class="varname">GTKDIR</code>
1.1 grant 9960: corresponds to the first definition in the
1.14 xtraeme 9961: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 9962: </li>
9963:
9964: <li>
1.45 ! wiz 9965: <p>Within <code xmlns=
! 9966: "http://www.w3.org/TR/xhtml1/transitional" class=
! 9967: "filename">${PREFIX}</code>, packages should
! 9968: install files according to <a href=
1.24 wiz 9969: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
9970: <span class="citerefentry"><span class=
9971: "refentrytitle">hier</span>(7)</span></a>, with the
1.45 ! wiz 9972: exception that manual pages go into <code xmlns=
! 9973: "http://www.w3.org/TR/xhtml1/transitional" class=
! 9974: "filename">${PREFIX}/man</code>, not <code xmlns=
! 9975: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9976: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 9977: </li>
9978: </ul>
9979: </div>
9980: </div>
9981:
9982: <div class="sect1" lang="en" xml:lang="en">
9983: <div class="titlepage">
9984: <div>
9985: <div>
9986: <h2 class="title" style="clear: both"><a name=
1.30 wiz 9987: "main-targets" id=
1.38 dillo 9988: "main-targets"></a>14.2. Main targets</h2>
1.1 grant 9989: </div>
9990: </div>
9991: </div>
9992:
9993: <p>The main targets used during the build process defined
1.45 ! wiz 9994: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 9995: class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 9996:
9997: <div class="variablelist">
9998: <dl>
9999: <dt><span class="term">fetch</span></dt>
10000:
10001: <dd>
10002: <p>This will check if the file(s) given in the
1.14 xtraeme 10003: variables <code class="varname">DISTFILES</code>
10004: and <code class="varname">PATCHFILES</code> (as
10005: defined in the package's Makefile) are present on
1.45 ! wiz 10006: the local system in <code xmlns=
! 10007: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10008: "filename">/usr/pkgsrc/distfiles</code>. If they
10009: are not present, an attempt will be made to fetch
10010: them using commands of the form:</p>
1.1 grant 10011: <pre class="programlisting">
10012: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
10013: </pre>
10014:
10015: <p>where ${site} varies through several
1.14 xtraeme 10016: possibilities in turn: first, <code class=
10017: "varname">MASTER_SITE_OVERRIDE</code> is tried,
10018: then the sites specified in either <code class=
10019: "varname">SITES_file</code> if defined, else
10020: <code class="varname">MASTER_SITES</code> or
10021: <code class="varname">PATCH_SITES</code>, as
10022: applies, then finally the value of <code class=
10023: "varname">MASTER_SITE_BACKUP</code>. The order of
10024: all except the first can be optionally sorted by
10025: the user, via setting either <code class=
10026: "varname">MASTER_SORT_AWK</code> or <code class=
10027: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 10028: </dd>
10029:
10030: <dt><span class="term">checksum</span></dt>
10031:
10032: <dd>
10033: <p>After the distfile(s) are fetched, their
10034: checksum is generated and compared with the
10035: checksums stored in the distinfo file. If the
10036: checksums don't match, the build is aborted. This
10037: is to ensure the same distfile is used for
10038: building, and that the distfile wasn't changed,
10039: e.g. by some malign force, deliberately changed
10040: distfiles on the master distribution site or
10041: network lossage.</p>
10042: </dd>
10043:
10044: <dt><span class="term">extract</span></dt>
10045:
10046: <dd>
10047: <p>When the distfiles are present on the local
10048: system, they need to be extracted, as they are
10049: usually in the form of some compressed archive
1.45 ! wiz 10050: format, most commonly <code xmlns=
! 10051: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10052: "filename">.tar.gz</code>.</p>
1.1 grant 10053:
10054: <p>If only some of the distfiles need to be
10055: uncompressed, the files to be uncompressed should
1.14 xtraeme 10056: be put into <code class=
10057: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 10058:
1.45 ! wiz 10059: <p>If the distfiles are not in <code xmlns=
! 10060: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10061: "filename">.tar.gz</code> format, they can be
10062: extracted by setting either <code class=
10063: "varname">EXTRACT_SUFX</code>, or <code class=
10064: "varname">EXTRACT_CMD</code>, <code class=
10065: "varname">EXTRACT_BEFORE_ARGS</code> and
10066: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
10067: the former case, pkgsrc knows how to extract a
1.45 ! wiz 10068: number of suffixes (<code xmlns=
! 10069: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10070: "filename">.tar.gz</code>, <code xmlns=
! 10071: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10072: "filename">.tgz</code>, <code xmlns=
! 10073: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10074: "filename">.tar.gz2</code>, <code xmlns=
! 10075: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10076: "filename">.tbz</code>, <code xmlns=
! 10077: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10078: "filename">.tar.Z</code>, <code xmlns=
! 10079: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10080: "filename">.tar</code>, <code xmlns=
! 10081: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10082: "filename">.shar.gz</code>, <code xmlns=
! 10083: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10084: "filename">.shar.bz2</code>, <code xmlns=
! 10085: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10086: "filename">.shar.Z</code>, <code xmlns=
! 10087: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10088: "filename">.shar</code>, <code xmlns=
! 10089: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10090: "filename">.Z</code>, <code xmlns=
! 10091: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10092: "filename">.bz2</code> and <code xmlns=
! 10093: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10094: "filename">.gz</code>; see the definition of the
10095: various <code class="varname">DECOMPRESS_CMD</code>
1.45 ! wiz 10096: variables <code xmlns=
! 10097: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10098: "filename">bsd.pkg.mk</code> for a complete list).
! 10099: Here's an example on how to use the other variables
! 10100: for a program that comes with a compressed shell
! 10101: archive whose name ends in <code xmlns=
! 10102: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10103: "filename">.msg.gz</code>:</p>
1.1 grant 10104: <pre class="programlisting">
10105: EXTRACT_SUFX= .msg.gz
10106: EXTRACT_CMD= zcat
10107: EXTRACT_BEFORE_ARGS=
10108: EXTRACT_AFTER_ARGS= |sh
10109: </pre>
10110: </dd>
10111:
10112: <dt><span class="term">patch</span></dt>
10113:
10114: <dd>
10115: <p>After extraction, all the patches named by the
1.14 xtraeme 10116: <code class="varname">PATCHFILES</code>, those
10117: present in the patches subdirectory of the package
10118: as well as in $LOCALPATCHES/$PKGPATH (e.g.
1.45 ! wiz 10119: <code xmlns=
! 10120: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10121: "filename">/usr/local/patches/graphics/png</code>)
1.45 ! wiz 10122: are applied. Patchfiles ending in <code xmlns=
! 10123: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10124: "filename">.Z</code> or <code xmlns=
! 10125: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10126: "filename">.gz</code> are uncompressed before they
1.45 ! wiz 10127: are applied, files ending in <code xmlns=
! 10128: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10129: "filename">.orig</code> or <code xmlns=
! 10130: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10131: "filename">.rej</code> are ignored. Any special
1.24 wiz 10132: options to <a href=
10133: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10134: <span class="citerefentry"><span class=
10135: "refentrytitle">patch</span>(1)</span></a> can be
10136: handed in <code class=
1.14 xtraeme 10137: "varname">PATCH_DIST_ARGS</code>. See <a href=
10138: "#components.patches" title=
1.38 dillo 10139: "8.3. patches/*">Section 8.3,
1.1 grant 10140: “patches/*”</a> for more details.</p>
10141:
1.24 wiz 10142: <p>By default <a href=
10143: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10144: <span class="citerefentry"><span class=
10145: "refentrytitle">patch</span>(1)</span></a> is given
10146: special args to make it fail if the patches apply
10147: with some lines of fuzz. Please fix (regen) the
10148: patches so that they apply cleanly. The rationale
10149: behind this is that patches that don't apply
10150: cleanly may end up being applied in the wrong
10151: place, and cause severe harm there.</p>
1.1 grant 10152: </dd>
10153:
10154: <dt><span class="term">configure</span></dt>
10155:
10156: <dd>
10157: <p>Most pieces of software need information on the
10158: header files, system calls, and library routines
10159: which are available in NetBSD. This is the process
10160: known as configuration, and is usually automated.
10161: In most cases, a script is supplied with the
10162: source, and its invocation results in generation of
10163: header files, Makefiles, etc.</p>
10164:
10165: <p>If the program's distfile contains its own
10166: configure script, this can be invoked by setting
1.14 xtraeme 10167: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 10168: configure script is a GNU autoconf script,
1.14 xtraeme 10169: <code class="varname">GNU_CONFIGURE</code> should
10170: be specified instead. In either case, any arguments
10171: to the configure script can be specified in the
10172: <code class="varname">CONFIGURE_ARGS</code>
10173: variable, and the configure script's name can be
10174: set in <code class=
10175: "varname">CONFIGURE_SCRIPT</code> if it differs
10176: from the default “<span class=
1.1 grant 10177: "quote">configure</span>”. Here's an example
10178: from the <a xmlns=
10179: "http://www.w3.org/TR/xhtml1/transitional" href=
10180: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.45 ! wiz 10181: target="_top"><code xmlns="" class=
! 10182: "filename">sysutils/top</code></a> package:</p>
1.1 grant 10183: <pre class="programlisting">
10184: HAS_CONFIGURE= yes
10185: CONFIGURE_SCRIPT= Configure
10186: CONFIGURE_ARGS+= netbsd13
10187: </pre>
10188:
10189: <p>If the program uses an Imakefile for
10190: configuration, the appropriate steps can be invoked
1.14 xtraeme 10191: by setting <code class="varname">USE_IMAKE</code>
10192: to “<span class="quote">YES</span>”.
10193: (If you only want the package installed in
10194: <code class="varname">$X11PREFIX</code> but xmkmf
10195: not being run, set <code class=
10196: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 10197: </dd>
10198:
10199: <dt><span class="term">build</span></dt>
10200:
10201: <dd>
10202: <p>Once configuration has taken place, the software
1.14 xtraeme 10203: will be built by invoking <code class=
10204: "varname">$MAKE_PROGRAM</code> on <code class=
10205: "varname">$MAKEFILE</code> with <code class=
10206: "varname">$BUILD_TARGET</code> as the target to
10207: build. The default <code class=
10208: "varname">MAKE_PROGRAM</code> is
10209: “<span class="quote">gmake</span>” if
1.29 rillig 10210: <code class="varname">USE_TOOLS</code> contains
10211: “<span class="quote">gmake</span>”,
1.1 grant 10212: “<span class="quote">make</span>”
1.14 xtraeme 10213: otherwise. <code class="varname">MAKEFILE</code> is
10214: set to “<span class=
1.1 grant 10215: "quote">Makefile</span>” by default, and
1.14 xtraeme 10216: <code class="varname">BUILD_TARGET</code> defaults
10217: to “<span class="quote">all</span>”.
10218: Any of these variables can be set in the package's
1.1 grant 10219: Makefile to change the default build process.</p>
10220: </dd>
10221:
10222: <dt><span class="term">install</span></dt>
10223:
10224: <dd>
10225: <p>Once the build stage has completed, the final
10226: step is to install the software in public
10227: directories, so users can access the programs and
1.14 xtraeme 10228: files. As in the build-target, <code class=
10229: "varname">$MAKE_PROGRAM</code> is invoked on
10230: <code class="varname">$MAKEFILE</code> here, but
10231: with the <code class=
10232: "varname">$INSTALL_TARGET</code> instead, the
10233: latter defaulting to “<span class=
10234: "quote">install</span>” (plus
10235: “<span class=
10236: "quote">install.man</span>”, if <code class=
10237: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 10238: </dd>
10239: </dl>
10240: </div>
10241:
10242: <p>If no target is specified, the default is
10243: “<span class="quote">build</span>”. If a
10244: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 10245: e.g. <span><strong class="command">make
10246: build</strong></span> will also perform the equivalent
10247: of:</p>
1.1 grant 10248: <pre class="programlisting">
10249: make fetch
10250: make checksum
10251: make extract
10252: make patch
10253: make configure
10254: make build
10255: </pre>
10256: </div>
10257:
10258: <div class="sect1" lang="en" xml:lang="en">
10259: <div class="titlepage">
10260: <div>
10261: <div>
10262: <h2 class="title" style="clear: both"><a name=
10263: "build.helpful-targets" id=
1.38 dillo 10264: "build.helpful-targets"></a>14.3. Other
1.1 grant 10265: helpful targets</h2>
10266: </div>
10267: </div>
10268: </div>
10269:
10270: <div class="variablelist">
10271: <dl>
10272: <dt><span class="term">pre/post-*</span></dt>
10273:
10274: <dd>
10275: <p>For any of the main targets described in the
10276: previous section, two auxiliary targets exist with
10277: “<span class="quote">pre-</span>” and
10278: “<span class="quote">post-</span>” used
10279: as a prefix for the main target's name. These
10280: targets are invoked before and after the main
10281: target is called, allowing extra configuration or
10282: installation steps be performed from a package's
10283: Makefile, for example, which a program's configure
10284: script or install target omitted.</p>
10285: </dd>
10286:
10287: <dt><span class="term">do-*</span></dt>
10288:
10289: <dd>
10290: <p>Should one of the main targets do the wrong
10291: thing, and should there be no variable to fix this,
10292: you can redefine it with the do-* target. (Note
10293: that redefining the target itself instead of the
10294: do-* target is a bad idea, as the pre-* and post-*
10295: targets won't be called anymore, etc.) You will not
10296: usually need to do this.</p>
10297: </dd>
10298:
10299: <dt><span class="term">reinstall</span></dt>
10300:
10301: <dd>
1.14 xtraeme 10302: <p>If you did a <span><strong class="command">make
10303: install</strong></span> and you noticed some file
10304: was not installed properly, you can repeat the
1.1 grant 10305: installation with this target, which will ignore
10306: the “<span class="quote">already
10307: installed</span>” flag.</p>
10308: </dd>
10309:
10310: <dt><span class="term">deinstall</span></dt>
10311:
10312: <dd>
1.24 wiz 10313: <p>This target does a <a href=
10314: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10315: <span class="citerefentry"><span class=
10316: "refentrytitle">pkg_delete</span>(1)</span></a> in
10317: the current directory, effectively de-installing
10318: the package. The following variables can be used to
10319: tune the behaviour:</p>
1.1 grant 10320:
10321: <div class="variablelist">
10322: <dl>
1.14 xtraeme 10323: <dt><span class="term"><code class=
10324: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 10325:
10326: <dd>
10327: <p>Add a "-v" to the <a href=
10328: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10329: <span class="citerefentry"><span class=
10330: "refentrytitle">pkg_delete</span>(1)</span></a>
10331: command.</p>
10332: </dd>
10333:
1.14 xtraeme 10334: <dt><span class="term"><code class=
10335: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 10336:
10337: <dd>
10338: <p>Remove all packages that require (depend
10339: on) the given package. This can be used to
10340: remove any packages that may have been pulled
10341: in by a given package, e.g. if
1.14 xtraeme 10342: <span><strong class="command">make deinstall
10343: DEINSTALLDEPENDS=1</strong></span> is done in
1.45 ! wiz 10344: <code xmlns=
! 10345: "http://www.w3.org/TR/xhtml1/transitional"
! 10346: class="filename">pkgsrc/x11/kde</code>, this
! 10347: is likely to remove whole KDE. Works by
1.1 grant 10348: adding “<span class=
10349: "quote">-R</span>” to the <a href=
10350: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10351: <span class="citerefentry"><span class=
10352: "refentrytitle">pkg_delete</span>(1)</span></a>
10353: command line.</p>
10354: </dd>
10355: </dl>
10356: </div>
10357: </dd>
10358:
10359: <dt><span class="term">update</span></dt>
10360:
10361: <dd>
10362: <p>This target causes the current package to be
10363: updated to the latest version. The package and all
10364: depending packages first get de-installed, then
10365: current versions of the corresponding packages get
10366: compiled and installed. This is similar to manually
10367: noting which packages are currently installed, then
1.14 xtraeme 10368: performing a series of <span><strong class=
10369: "command">make deinstall</strong></span> and
10370: <span><strong class="command">make
10371: install</strong></span> (or whatever <code class=
10372: "varname">UPDATE_TARGET</code> is set to) for these
10373: packages.</p>
1.1 grant 10374:
10375: <p>You can use the “<span class=
10376: "quote">update</span>” target to resume
1.14 xtraeme 10377: package updating in case a previous
10378: <span><strong class="command">make
10379: update</strong></span> was interrupted for some
10380: reason. However, in this case, make sure you don't
10381: call <span><strong class="command">make
10382: clean</strong></span> or otherwise remove the list
10383: of dependent packages in <code class=
10384: "varname">WRKDIR</code>. Otherwise you lose the
1.1 grant 10385: ability to automatically update the current package
10386: along with the dependent packages you have
10387: installed.</p>
10388:
1.14 xtraeme 10389: <p>Resuming an interrupted <span><strong class=
10390: "command">make update</strong></span> will only
10391: work as long as the package tree remains unchanged.
10392: If the source code for one of the packages to be
10393: updated has been changed, resuming
10394: <span><strong class="command">make
10395: update</strong></span> will most certainly
10396: fail!</p>
1.1 grant 10397:
10398: <p>The following variables can be used either on
1.45 ! wiz 10399: the command line or in <code xmlns=
! 10400: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10401: "filename">/etc/mk.conf</code> to alter the
10402: behaviour of <span><strong class="command">make
10403: update</strong></span>:</p>
1.1 grant 10404:
10405: <div class="variablelist">
10406: <dl>
1.14 xtraeme 10407: <dt><span class="term"><code class=
10408: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 10409:
10410: <dd>
10411: <p>Install target to recursively use for the
10412: updated package and the dependent packages.
1.14 xtraeme 10413: Defaults to <code class=
10414: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 10415: “<span class=
10416: "quote">install</span>” otherwise for
1.14 xtraeme 10417: <span><strong class="command">make
10418: update</strong></span>. e.g.
10419: <span><strong class="command">make update
10420: UPDATE_TARGET=package</strong></span></p>
1.1 grant 10421: </dd>
10422:
1.14 xtraeme 10423: <dt><span class="term"><code class=
10424: "varname">NOCLEAN</code></span></dt>
1.1 grant 10425:
10426: <dd>
10427: <p>Don't clean up after updating. Useful if
10428: you want to leave the work sources of the
10429: updated packages around for inspection or
10430: other purposes. Be sure you eventually clean
10431: up the source tree (see the
10432: “<span class=
10433: "quote">clean-update</span>” target
10434: below) or you may run into troubles with old
10435: source code still lying around on your next
1.14 xtraeme 10436: <span><strong class=
10437: "command">make</strong></span> or
10438: <span><strong class="command">make
10439: update</strong></span>.</p>
1.1 grant 10440: </dd>
10441:
1.14 xtraeme 10442: <dt><span class="term"><code class=
10443: "varname">REINSTALL</code></span></dt>
1.1 grant 10444:
10445: <dd>
10446: <p>Deinstall each package before installing
1.14 xtraeme 10447: (making <code class=
10448: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 10449: necessary if the “<span class=
10450: "quote">clean-update</span>” target
10451: (see below) was called after interrupting a
1.14 xtraeme 10452: running <span><strong class="command">make
10453: update</strong></span>.</p>
1.1 grant 10454: </dd>
10455:
1.14 xtraeme 10456: <dt><span class="term"><code class=
10457: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 10458:
10459: <dd>
10460: <p>Allows you to disable recursion and
10461: hardcode the target for packages. The default
10462: is “<span class=
10463: "quote">update</span>” for the update
10464: target, facilitating a recursive update of
1.14 xtraeme 10465: prerequisite packages. Only set <code class=
10466: "varname">DEPENDS_TARGET</code> if you want
10467: to disable recursive updates. Use
10468: <code class="varname">UPDATE_TARGET</code>
10469: instead to just set a specific target for
10470: each package to be installed during
10471: <span><strong class="command">make
10472: update</strong></span> (see above).</p>
1.1 grant 10473: </dd>
10474: </dl>
10475: </div>
10476: </dd>
10477:
10478: <dt><span class="term">clean-update</span></dt>
10479:
10480: <dd>
10481: <p>Clean the source tree for all packages that
1.14 xtraeme 10482: would get updated if <span><strong class=
10483: "command">make update</strong></span> was called
10484: from the current directory. This target should not
10485: be used if the current package (or any of its
10486: depending packages) have already been de-installed
10487: (e.g., after calling <span><strong class=
10488: "command">make update</strong></span>) or you may
10489: lose some packages you intended to update. As a
10490: rule of thumb: only use this target <span class=
10491: "emphasis"><em>before</em></span> the first time
10492: you run <span><strong class="command">make
10493: update</strong></span> and only if you have a dirty
10494: package tree (e.g., if you used <code class=
10495: "varname">NOCLEAN</code>).</p>
1.1 grant 10496:
10497: <p>If you unsure about whether your tree is clean
1.14 xtraeme 10498: you can either perform a <span><strong class=
10499: "command">make clean</strong></span> at the top of
10500: the tree, or use the following sequence of commands
1.1 grant 10501: from the directory of the package you want to
10502: update (<span class=
10503: "emphasis"><em>before</em></span> running
1.14 xtraeme 10504: <span><strong class="command">make
10505: update</strong></span> for the first time,
10506: otherwise you lose all the packages you wanted to
10507: update!):</p>
1.1 grant 10508: <pre class="screen">
1.14 xtraeme 10509: <code class="prompt">#</code> <strong class=
10510: "userinput"><code>make clean-update</code></strong>
10511: <code class="prompt">#</code> <strong class=
10512: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
10513: <code class="prompt">#</code> <strong class=
10514: "userinput"><code>make update</code></strong>
1.1 grant 10515: </pre>
10516:
10517: <p>The following variables can be used either on
1.45 ! wiz 10518: the command line or in <code xmlns=
! 10519: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10520: "filename">/etc/mk.conf</code> to alter the
10521: behaviour of <span><strong class="command">make
10522: clean-update</strong></span>:</p>
1.1 grant 10523:
10524: <div class="variablelist">
10525: <dl>
1.14 xtraeme 10526: <dt><span class="term"><code class=
10527: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 10528:
10529: <dd>
1.14 xtraeme 10530: <p>After <span><strong class="command">make
10531: clean</strong></span>, do not reconstruct the
10532: list of directories to update for this
10533: package. Only use this if
10534: <span><strong class="command">make
10535: update</strong></span> successfully installed
10536: all packages you wanted to update. Normally,
10537: this is done automatically on
10538: <span><strong class="command">make
10539: update</strong></span>, but may have been
10540: suppressed by the <code class=
10541: "varname">NOCLEAN</code> variable (see
1.1 grant 10542: above).</p>
10543: </dd>
10544: </dl>
10545: </div>
10546: </dd>
10547:
10548: <dt><span class="term">info</span></dt>
10549:
10550: <dd>
10551: <p>This target invokes <a href=
10552: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
10553: <span class="citerefentry"><span class=
10554: "refentrytitle">pkg_info</span>(1)</span></a> for
10555: the current package. You can use this to check
10556: which version of a package is installed.</p>
10557: </dd>
10558:
10559: <dt><span class="term">readme</span></dt>
10560:
10561: <dd>
1.45 ! wiz 10562: <p>This target generates a <code xmlns=
! 10563: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10564: "filename">README.html</code> file, which can be
1.1 grant 10565: viewed using a browser such as <a xmlns=
10566: "http://www.w3.org/TR/xhtml1/transitional" href=
10567: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 ! wiz 10568: target="_top"><code xmlns="" class=
! 10569: "filename">www/mozilla</code></a> or <a xmlns=
1.20 ben 10570: "http://www.w3.org/TR/xhtml1/transitional" href=
10571: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45 ! wiz 10572: target="_top"><code xmlns="" class=
! 10573: "filename">www/links</code></a>. The generated
! 10574: files contain references to any packages which are
! 10575: in the <code class="varname">PACKAGES</code>
! 10576: directory on the local host. The generated files
! 10577: can be made to refer to URLs based on <code class=
1.20 ben 10578: "varname">FTP_PKG_URL_HOST</code> and <code class=
10579: "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45 ! wiz 10580: wanted to generate <code xmlns=
! 10581: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 10582: "filename">README.html</code> files which pointed
10583: to binary packages on the local machine, in the
1.45 ! wiz 10584: directory <code xmlns=
! 10585: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 10586: "filename">/usr/packages</code>, set <code class=
10587: "varname">FTP_PKG_URL_HOST=file://localhost</code>
10588: and <code class=
10589: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
10590: <code class="varname">${PACKAGES}</code> directory
10591: and its subdirectories will be searched for all the
10592: binary packages.</p>
1.1 grant 10593: </dd>
10594:
10595: <dt><span class="term">readme-all</span></dt>
10596:
10597: <dd>
1.45 ! wiz 10598: <p>Use this target to create a file <code xmlns=
! 10599: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10600: "filename">README-all.html</code> which contains a
1.1 grant 10601: list of all packages currently available in the
10602: NetBSD Packages Collection, together with the
10603: category they belong to and a short description.
1.45 ! wiz 10604: This file is compiled from the <code xmlns=
! 10605: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10606: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 10607: sure to run this <span class=
1.14 xtraeme 10608: "emphasis"><em>after</em></span> a
10609: <span><strong class="command">make
10610: readme</strong></span>.</p>
1.1 grant 10611: </dd>
10612:
10613: <dt><span class="term">cdrom-readme</span></dt>
10614:
10615: <dd>
10616: <p>This is very much the same as the
10617: “<span class="quote">readme</span>”
10618: target (see above), but is to be used when
10619: generating a pkgsrc tree to be written to a CD-ROM.
1.45 ! wiz 10620: This target also produces <code xmlns=
! 10621: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10622: "filename">README.html</code> files, and can be
10623: made to refer to URLs based on <code class=
10624: "varname">CDROM_PKG_URL_HOST</code> and
10625: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 10626: </dd>
10627:
10628: <dt><span class="term">show-distfiles</span></dt>
10629:
10630: <dd>
10631: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 10632: are needed to build the package. (<code class=
10633: "varname">DISTFILES</code> and <code class=
1.45 ! wiz 10634: "varname">PATCHFILES</code>, but not <code xmlns=
! 10635: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10636: "filename">patches/*</code>)</p>
1.1 grant 10637: </dd>
10638:
10639: <dt><span class="term">show-downlevel</span></dt>
10640:
10641: <dd>
10642: <p>This target shows nothing if the package is not
10643: installed. If a version of this package is
10644: installed, but is not the version provided in this
10645: version of pkgsrc, then a warning message is
10646: displayed. This target can be used to show which of
10647: your installed packages are downlevel, and so the
10648: old versions can be deleted, and the current ones
10649: added.</p>
10650: </dd>
10651:
10652: <dt><span class="term">show-pkgsrc-dir</span></dt>
10653:
10654: <dd>
10655: <p>This target shows the directory in the pkgsrc
10656: hierarchy from which the package can be built and
10657: installed. This may not be the same directory as
10658: the one from which the package was installed. This
10659: target is intended to be used by people who may
10660: wish to upgrade many packages on a single host, and
10661: can be invoked from the top-level pkgsrc Makefile
10662: by using the “<span class=
10663: "quote">show-host-specific-pkgs</span>”
10664: target.</p>
10665: </dd>
10666:
10667: <dt><span class=
10668: "term">show-installed-depends</span></dt>
10669:
10670: <dd>
10671: <p>This target shows which installed packages match
1.14 xtraeme 10672: the current package's <code class=
10673: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 10674: dependencies are causing build problems.</p>
10675: </dd>
10676:
10677: <dt><span class="term">check-shlibs</span></dt>
10678:
10679: <dd>
10680: <p>After a package is installed, check all its
10681: binaries and (on ELF platforms) shared libraries to
10682: see if they find the shared libs they need. Run by
1.14 xtraeme 10683: default if <code class=
10684: "varname">PKG_DEVELOPER</code> is set in
1.45 ! wiz 10685: <code xmlns=
! 10686: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10687: "filename">/etc/mk.conf</code>.</p>
1.1 grant 10688: </dd>
10689:
10690: <dt><span class="term">print-PLIST</span></dt>
10691:
10692: <dd>
10693: <p>After a “<span class="quote">make
10694: install</span>” from a new or upgraded pkg,
10695: this prints out an attempt to generate a new
1.45 ! wiz 10696: <code xmlns=
! 10697: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10698: "filename">PLIST</code> from a <span><strong class=
! 10699: "command">find -newer
1.14 xtraeme 10700: work/.extract_done</strong></span>. An attempt is
10701: made to care for shared libs etc., but it is
1.1 grant 10702: <span class="emphasis"><em>strongly</em></span>
10703: recommended to review the result before putting it
1.45 ! wiz 10704: into <code xmlns=
! 10705: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10706: "filename">PLIST</code>. On upgrades, it's useful
! 10707: to diff the output of this command against an
! 10708: already existing <code xmlns=
! 10709: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10710: "filename">PLIST</code> file.</p>
1.1 grant 10711:
1.24 wiz 10712: <p>If the package installs files via <a href=
10713: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
10714: <span class="citerefentry"><span class=
10715: "refentrytitle">tar</span>(1)</span></a> or other
10716: methods that don't update file access times, be
10717: sure to add these files manually to your
1.45 ! wiz 10718: <code xmlns=
! 10719: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10720: "filename">PLIST</code>, as the “<span class=
! 10721: "quote">find -newer</span>” command used by
! 10722: this target won't catch them!</p>
1.1 grant 10723:
10724: <p>See <a href="#print-PLIST" title=
1.38 dillo 10725: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 10726: “Tweaking output of <span><strong class=
10727: "command">make
10728: print-PLIST</strong></span>”</a> for more
10729: information on this target.</p>
1.1 grant 10730: </dd>
10731:
10732: <dt><span class="term">bulk-package</span></dt>
10733:
10734: <dd>
10735: <p>Used to do bulk builds. If an appropriate binary
10736: package already exists, no action is taken. If not,
10737: this target will compile, install and package it
1.14 xtraeme 10738: (and it's depends, if <code class=
10739: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 10740: <a href="#binary.configuration" title=
1.38 dillo 10741: "6.3.1. Configuration">Section 6.3.1,
1.1 grant 10742: “Configuration”</a>. After creating the
10743: binary package, the sources, the just-installed
10744: package and it's required packages are removed,
10745: preserving free disk space.</p>
10746:
10747: <p><span class="emphasis"><em>Beware that this
10748: target may deinstall all packages installed on a
10749: system!</em></span></p>
10750: </dd>
10751:
10752: <dt><span class="term">bulk-install</span></dt>
10753:
10754: <dd>
10755: <p>Used during bulk-installs to install required
10756: packages. If an upto-date binary package is
10757: available, it will be installed via <a href=
10758: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
10759: <span class="citerefentry"><span class=
10760: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 10761: not, <span><strong class="command">make
10762: bulk-package</strong></span> will be executed, but
10763: the installed binary not be removed.</p>
1.1 grant 10764:
10765: <p>A binary package is considered
10766: “<span class="quote">upto-date</span>”
10767: to be installed via <a href=
10768: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
10769: <span class="citerefentry"><span class=
10770: "refentrytitle">pkg_add</span>(1)</span></a>
10771: if:</p>
10772:
10773: <div class="itemizedlist">
10774: <ul type="disc">
10775: <li>
1.45 ! wiz 10776: <p>None of the package's files (<code xmlns=
! 10777: "http://www.w3.org/TR/xhtml1/transitional"
! 10778: class="filename">Makefile</code>, ...) were
1.14 xtraeme 10779: modified since it was built.</p>
1.1 grant 10780: </li>
10781:
10782: <li>
10783: <p>None of the package's required (binary)
10784: packages were modified since it was
10785: built.</p>
10786: </li>
10787: </ul>
10788: </div>
10789:
10790: <p><span class="emphasis"><em>Beware that this
10791: target may deinstall all packages installed on a
10792: system!</em></span></p>
10793: </dd>
10794: </dl>
10795: </div>
10796: </div>
10797: </div>
10798:
10799: <div class="chapter" lang="en" xml:lang="en">
10800: <div class="titlepage">
10801: <div>
10802: <div>
10803: <h2 class="title"><a name="fixes" id=
1.38 dillo 10804: "fixes"></a>Chapter 15. Notes on fixes for
1.1 grant 10805: packages</h2>
10806: </div>
10807: </div>
10808: </div>
10809:
10810: <div class="toc">
10811: <p><b>Table of Contents</b></p>
10812:
10813: <dl>
1.30 wiz 10814: <dt><span class="sect1"><a href=
1.38 dillo 10815: "#general-operation">15.1. General
1.30 wiz 10816: operation</a></span></dt>
1.1 grant 10817:
10818: <dd>
10819: <dl>
10820: <dt><span class="sect2"><a href=
1.38 dillo 10821: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 10822: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 10823:
10824: <dt><span class="sect2"><a href=
1.38 dillo 10825: "#where-to-install-documentation">15.1.2. Where to
1.31 wiz 10826: install documentation</a></span></dt>
10827:
10828: <dt><span class="sect2"><a href=
1.38 dillo 10829: "#restricted-packages">15.1.3. Restricted
1.1 grant 10830: packages</a></span></dt>
10831:
10832: <dt><span class="sect2"><a href=
1.38 dillo 10833: "#dependencies">15.1.4. Handling
1.1 grant 10834: dependencies</a></span></dt>
10835:
10836: <dt><span class="sect2"><a href=
1.38 dillo 10837: "#conflicts">15.1.5. Handling conflicts with other
1.1 grant 10838: packages</a></span></dt>
10839:
10840: <dt><span class="sect2"><a href=
1.38 dillo 10841: "#not-building-packages">15.1.6. Packages that
1.30 wiz 10842: cannot or should not be built</a></span></dt>
1.1 grant 10843:
10844: <dt><span class="sect2"><a href=
1.38 dillo 10845: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 10846: should not be deleted, once
10847: installed</a></span></dt>
1.1 grant 10848:
10849: <dt><span class="sect2"><a href=
1.38 dillo 10850: "#security-handling">15.1.8. Handling packages with
1.1 grant 10851: security problems</a></span></dt>
10852:
10853: <dt><span class="sect2"><a href=
1.38 dillo 10854: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 10855: bugs</a></span></dt>
10856:
10857: <dt><span class="sect2"><a href=
1.38 dillo 10858: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 10859: incrementing versions when fixing an existing
1.1 grant 10860: package</a></span></dt>
10861:
10862: <dt><span class="sect2"><a href=
1.38 dillo 10863: "#portability-of-packages">15.1.11. Portability of
1.1 grant 10864: packages</a></span></dt>
10865: </dl>
10866: </dd>
10867:
1.30 wiz 10868: <dt><span class="sect1"><a href=
1.38 dillo 10869: "#downloading-issues">15.2. Possible downloading
1.30 wiz 10870: issues</a></span></dt>
1.1 grant 10871:
10872: <dd>
10873: <dl>
10874: <dt><span class="sect2"><a href=
1.38 dillo 10875: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 10876: distfiles aren't available for plain
1.1 grant 10877: downloading</a></span></dt>
10878:
10879: <dt><span class="sect2"><a href=
1.38 dillo 10880: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 10881: handle modified distfiles with the 'old'
10882: name</a></span></dt>
1.1 grant 10883: </dl>
10884: </dd>
10885:
1.30 wiz 10886: <dt><span class="sect1"><a href=
1.38 dillo 10887: "#configuration-gotchas">15.3. Configuration
1.30 wiz 10888: gotchas</a></span></dt>
1.1 grant 10889:
10890: <dd>
10891: <dl>
10892: <dt><span class="sect2"><a href=
1.38 dillo 10893: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 10894: libtool</a></span></dt>
10895:
10896: <dt><span class="sect2"><a href=
1.38 dillo 10897: "#using-libtool">15.3.2. Using libtool on GNU
1.30 wiz 10898: packages that already support
10899: libtool</a></span></dt>
1.1 grant 10900:
10901: <dt><span class="sect2"><a href=
1.38 dillo 10902: "#autoconf-automake">15.3.3. GNU
1.1 grant 10903: Autoconf/Automake</a></span></dt>
10904: </dl>
10905: </dd>
10906:
1.30 wiz 10907: <dt><span class="sect1"><a href=
1.38 dillo 10908: "#building-considerations">15.4. Building
1.30 wiz 10909: considerations</a></span></dt>
1.1 grant 10910:
10911: <dd>
10912: <dl>
10913: <dt><span class="sect2"><a href=
1.38 dillo 10914: "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.1 grant 10915: </dl>
10916: </dd>
10917:
1.30 wiz 10918: <dt><span class="sect1"><a href=
1.38 dillo 10919: "#package-specific-actions">15.5. Package specific
1.30 wiz 10920: actions</a></span></dt>
1.1 grant 10921:
10922: <dd>
10923: <dl>
10924: <dt><span class="sect2"><a href=
1.38 dillo 10925: "#user-interaction">15.5.1. User
1.2 hubertf 10926: interaction</a></span></dt>
1.1 grant 10927:
10928: <dt><span class="sect2"><a href=
1.38 dillo 10929: "#handling-licenses">15.5.2. Handling
1.1 grant 10930: licenses</a></span></dt>
10931:
10932: <dt><span class="sect2"><a href=
1.38 dillo 10933: "#installing-score-files">15.5.3. Installing score
1.1 grant 10934: files</a></span></dt>
10935:
10936: <dt><span class="sect2"><a href=
1.38 dillo 10937: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 10938: scripts</a></span></dt>
10939:
10940: <dt><span class="sect2"><a href=
1.38 dillo 10941: "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30 wiz 10942: paths to other interpreters</a></span></dt>
1.1 grant 10943:
10944: <dt><span class="sect2"><a href=
1.38 dillo 10945: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 10946: modules</a></span></dt>
10947:
10948: <dt><span class="sect2"><a href=
1.38 dillo 10949: "#faq.info-files">15.5.7. Packages installing info
1.1 grant 10950: files</a></span></dt>
10951:
10952: <dt><span class="sect2"><a href=
1.38 dillo 10953: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 10954: GConf2 data files</a></span></dt>
1.1 grant 10955:
10956: <dt><span class="sect2"><a href=
1.38 dillo 10957: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 10958: installing scrollkeeper data files</a></span></dt>
1.1 grant 10959:
10960: <dt><span class="sect2"><a href=
1.38 dillo 10961: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 10962: fonts</a></span></dt>
10963:
10964: <dt><span class="sect2"><a href=
1.38 dillo 10965: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 10966: modules</a></span></dt>
10967:
10968: <dt><span class="sect2"><a href=
1.38 dillo 10969: "#sgml-xml-data">15.5.12. Packages installing SGML
1.30 wiz 10970: or XML data</a></span></dt>
1.1 grant 10971:
10972: <dt><span class="sect2"><a href=
1.38 dillo 10973: "#mime-database">15.5.13. Packages installing
1.1 grant 10974: extensions to the MIME database</a></span></dt>
10975:
10976: <dt><span class="sect2"><a href=
1.38 dillo 10977: "#intltool">15.5.14. Packages using
1.1 grant 10978: intltool</a></span></dt>
1.18 xtraeme 10979:
10980: <dt><span class="sect2"><a href=
1.38 dillo 10981: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 10982: startup scripts</a></span></dt>
1.1 grant 10983: </dl>
10984: </dd>
10985:
1.30 wiz 10986: <dt><span class="sect1"><a href=
1.38 dillo 10987: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 10988: author</a></span></dt>
1.1 grant 10989: </dl>
10990: </div>
10991:
10992: <div class="sect1" lang="en" xml:lang="en">
10993: <div class="titlepage">
10994: <div>
10995: <div>
10996: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10997: "general-operation" id=
1.38 dillo 10998: "general-operation"></a>15.1. General
1.1 grant 10999: operation</h2>
11000: </div>
11001: </div>
11002: </div>
11003:
11004: <div class="sect2" lang="en" xml:lang="en">
11005: <div class="titlepage">
11006: <div>
11007: <div>
1.30 wiz 11008: <h3 class="title"><a name=
11009: "pulling-vars-from-etc-mk.conf" id=
1.38 dillo 11010: "pulling-vars-from-etc-mk.conf"></a>15.1.1. How
1.30 wiz 11011: to pull in variables from /etc/mk.conf</h3>
1.1 grant 11012: </div>
11013: </div>
11014: </div>
11015:
11016: <p>The problem with package-defined variables that can
1.14 xtraeme 11017: be overridden via <code class="varname">MAKECONF</code>
1.45 ! wiz 11018: or <code xmlns=
! 11019: "http://www.w3.org/TR/xhtml1/transitional" class=
! 11020: "filename">/etc/mk.conf</code> is that <a href=
1.1 grant 11021: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
11022: <span class="citerefentry"><span class=
11023: "refentrytitle">make</span>(1)</span></a> expands a
11024: variable as it is used, but evaluates preprocessor like
11025: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 11026: So, to use any variable (which may be set in
1.45 ! wiz 11027: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 11028: class="filename">/etc/mk.conf</code>) in one of the
! 11029: .if* statements, the file <code xmlns=
! 11030: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11031: "filename">/etc/mk.conf</code> must be included before
1.1 grant 11032: that .if* statement.</p>
11033:
11034: <p>Rather than have a number of ad-hoc ways of
1.45 ! wiz 11035: including <code xmlns=
! 11036: "http://www.w3.org/TR/xhtml1/transitional" class=
! 11037: "filename">/etc/mk.conf</code>, should it exist, or
! 11038: <code class="varname">MAKECONF</code>, should it exist,
! 11039: include the <code xmlns=
! 11040: "http://www.w3.org/TR/xhtml1/transitional" class=
! 11041: "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
! 11042: package Makefile before any preprocessor-like .if,
! 11043: .ifdef, or .ifndef statements:</p>
1.1 grant 11044: <pre class="programlisting">
11045: .include "../../mk/bsd.prefs.mk"
11046:
11047: .if defined(USE_MENUS)
11048: ...
11049: .endif
11050: </pre>
11051:
1.14 xtraeme 11052: <p>If you wish to set the <code class=
1.45 ! wiz 11053: "varname">CFLAGS</code> variable in <code xmlns=
! 11054: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11055: "filename">/etc/mk.conf</code> please make sure to
1.1 grant 11056: use:</p>
11057: <pre class="programlisting">
11058: CFLAGS+= -your -flags
11059: </pre>
11060:
1.14 xtraeme 11061: <p>Using <code class="varname">CFLAGS=</code> (i.e.
11062: without the “<span class="quote">+</span>”)
11063: may lead to problems with packages that need to add
11064: their own flags. Also, you may want to take a look at
11065: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 11066: href=
11067: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 ! wiz 11068: target="_top"><code xmlns="" class=
! 11069: "filename">devel/cpuflags</code></a> package if you're
1.20 ben 11070: interested in optimization for the current CPU.</p>
1.1 grant 11071: </div>
11072:
11073: <div class="sect2" lang="en" xml:lang="en">
11074: <div class="titlepage">
11075: <div>
11076: <div>
1.31 wiz 11077: <h3 class="title"><a name=
11078: "where-to-install-documentation" id=
1.38 dillo 11079: "where-to-install-documentation"></a>15.1.2. Where
1.31 wiz 11080: to install documentation</h3>
11081: </div>
11082: </div>
11083: </div>
11084:
1.45 ! wiz 11085: <p>Documentation should be installed into <code xmlns=
! 11086: "http://www.w3.org/TR/xhtml1/transitional" class=
1.31 wiz 11087: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45 ! wiz 11088: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 11089: class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
! 11090: (the latter includes the version number of the
! 11091: package).</p>
1.31 wiz 11092: </div>
11093:
11094: <div class="sect2" lang="en" xml:lang="en">
11095: <div class="titlepage">
11096: <div>
11097: <div>
1.30 wiz 11098: <h3 class="title"><a name="restricted-packages"
11099: id=
1.38 dillo 11100: "restricted-packages"></a>15.1.3. Restricted
1.1 grant 11101: packages</h3>
11102: </div>
11103: </div>
11104: </div>
11105:
11106: <p>Some licenses restrict how software may be
11107: re-distributed. In order to satisfy these restrictions,
11108: the package system defines five make variables that can
11109: be set to note these restrictions:</p>
11110:
11111: <div class="itemizedlist">
11112: <ul type="disc">
11113: <li>
1.14 xtraeme 11114: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 11115:
11116: <p>This variable should be set whenever a
11117: restriction exists (regardless of its kind). Set
11118: this variable to a string containing the reason
11119: for the restriction.</p>
11120: </li>
11121:
11122: <li>
1.14 xtraeme 11123: <p><code class=
11124: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 11125:
11126: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 11127: variable to <code class=
11128: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11129: package may not be included on a CD-ROM.</p>
11130: </li>
11131:
11132: <li>
1.14 xtraeme 11133: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 11134:
11135: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 11136: Set this variable to <code class=
11137: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11138: package may not not be made available on the
11139: Internet.</p>
11140: </li>
11141:
11142: <li>
1.14 xtraeme 11143: <p><code class=
11144: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 11145:
11146: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 11147: this variable to <code class=
11148: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11149: of the source code or other distfile(s) is not
11150: allowed on CD-ROMs.</p>
11151: </li>
11152:
11153: <li>
1.14 xtraeme 11154: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 11155:
11156: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 11157: variable to <code class=
11158: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11159: of the source code or other distfile(s) via the
11160: Internet is not allowed.</p>
11161: </li>
11162: </ul>
11163: </div>
11164:
1.14 xtraeme 11165: <p>Please note that the use of <code class=
11166: "varname">NO_PACKAGE</code>, <code class=
11167: "varname">IGNORE</code>, <code class=
11168: "varname">NO_CDROM</code>, or other generic make
1.1 grant 11169: variables to denote restrictions is deprecated, because
11170: they unconditionally prevent users from generating
11171: binary packages!</p>
11172: </div>
11173:
11174: <div class="sect2" lang="en" xml:lang="en">
11175: <div class="titlepage">
11176: <div>
11177: <div>
11178: <h3 class="title"><a name="dependencies" id=
1.38 dillo 11179: "dependencies"></a>15.1.4. Handling
1.1 grant 11180: dependencies</h3>
11181: </div>
11182: </div>
11183: </div>
11184:
11185: <p>Your package may depend on some other package being
11186: present - and there are various ways of expressing this
1.14 xtraeme 11187: dependency. pkgsrc supports the <code class=
11188: "varname">BUILD_DEPENDS</code> and <code class=
11189: "varname">DEPENDS</code> definitions, as well as
1.45 ! wiz 11190: dependencies via <code xmlns=
! 11191: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11192: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 11193: way to handle dependencies, and which uses the
11194: variables named above. See <a href="#buildlink" title=
1.38 dillo 11195: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 11196: <i>Buildlink methodology</i></a> for more
11197: information.</p>
11198:
11199: <p>The basic difference between the two variables is as
1.14 xtraeme 11200: follows: The <code class="varname">DEPENDS</code>
1.1 grant 11201: definition registers that pre-requisite in the binary
11202: package so it will be pulled in when the binary package
1.14 xtraeme 11203: is later installed, whilst the <code class=
11204: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 11205: marking a dependency that is only needed for building
11206: the package.</p>
11207:
11208: <p>This means that if you only need a package present
11209: whilst you are building, it should be noted as a
1.14 xtraeme 11210: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 11211:
1.14 xtraeme 11212: <p>The format for a <code class=
11213: "varname">BUILD_DEPENDS</code> and a <code class=
11214: "varname">DEPENDS</code> definition is:</p>
1.1 grant 11215: <pre class="programlisting">
11216: <pre-req-package-name>:../../<category>/<pre-req-package>
11217: </pre>
11218:
11219: <p>Please note that the “<span class=
11220: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 11221: any of the wildcard version numbers recognized by
1.1 grant 11222: <a href=
11223: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11224: <span class="citerefentry"><span class=
11225: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
11226:
11227: <div class="orderedlist">
11228: <ol type="1">
11229: <li>
11230: <p>If your package needs another package's
11231: binaries or libraries to build or run, and if
1.45 ! wiz 11232: that package has a <code xmlns=
! 11233: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11234: "filename">buildlink3.mk</code> file available,
11235: use it:</p>
1.1 grant 11236: <pre class="programlisting">
11237: .include "../../graphics/jpeg/buildlink3.mk"
11238:
11239: </pre>
11240: </li>
11241:
11242: <li>
11243: <p>If your package needs to use another package
1.45 ! wiz 11244: to build itself and there is no <code xmlns=
! 11245: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11246: "filename">buildlink3.mk</code> file available,
11247: use the <code class=
11248: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 11249: <pre class="programlisting">
11250: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
11251: </pre>
11252: </li>
11253:
11254: <li>
11255: <p>If your package needs a library with which to
1.45 ! wiz 11256: link and again there is no <code xmlns=
! 11257: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11258: "filename">buildlink3.mk</code> file available,
11259: this is specified using the <code class=
11260: "varname">DEPENDS</code> definition. An example
11261: of this is the <a xmlns=
1.1 grant 11262: "http://www.w3.org/TR/xhtml1/transitional" href=
11263: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 ! wiz 11264: target="_top"><code xmlns="" class=
! 11265: "filename">print/lyx</code></a> package, which
! 11266: uses the xpm library, version 3.4j to build:</p>
1.1 grant 11267: <pre class="programlisting">
11268: DEPENDS+= xpm-3.4j:../../graphics/xpm
11269: </pre>
11270:
11271: <p>You can also use wildcards in package
11272: dependences:</p>
11273: <pre class="programlisting">
11274: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
11275: </pre>
11276:
11277: <p>Note that such wildcard dependencies are
11278: retained when creating binary packages. The
11279: dependency is checked when installing the binary
11280: package and any package which matches the pattern
11281: will be used. Wildcard dependencies should be
11282: used with care.</p>
11283:
11284: <p>The “<span class=
11285: "quote">-[0-9]*</span>” should be used
11286: instead of “<span class=
11287: "quote">-*</span>” to avoid potentially
11288: ambiguous matches such as “<span class=
11289: "quote">tk-postgresql</span>” matching a
11290: “<span class="quote">tk-*</span>”
1.14 xtraeme 11291: <code class="varname">DEPENDS</code>.</p>
1.1 grant 11292:
11293: <p>Wildcards can also be used to specify that a
11294: package will only build against a certain minimum
11295: version of a pre-requisite:</p>
11296: <pre class="programlisting">
11297: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
11298: </pre>
11299:
11300: <p>This means that the package will build against
11301: version 3.5.4 of the tiff library or newer. Such
11302: a dependency may be warranted if, for example,
11303: the API of the library has changed with version
11304: 3.5.4 and a package would not compile against an
11305: earlier version of tiff.</p>
11306:
11307: <p>Please note that such dependencies should only
11308: be updated if a package requires a newer
11309: pre-requisite, but not to denote recommendations
11310: such as security updates or ABI changes that do
11311: not prevent a package from building correctly.
11312: Such recommendations can be expressed using
1.14 xtraeme 11313: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 11314: <pre class="programlisting">
11315: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
11316: </pre>
11317:
1.14 xtraeme 11318: <p>In addition to the above <code class=
11319: "varname">DEPENDS</code> line, this denotes that
1.1 grant 11320: while a package will build against
11321: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 11322: recommended. <code class=
11323: "varname">RECOMMENDED</code> entries will be
11324: turned into dependencies unless explicitly
11325: ignored (in which case a warning will be
1.36 wiz 11326: printed).</p>
11327:
11328: <p>To ignore these dependency recommendations and
11329: just use the required <code class=
11330: "varname">DEPENDS</code>, set <code class=
11331: "varname">IGNORE_RECOMMENDED=YES</code>. This may
11332: make it easier and faster to update packages
11333: built using pkgsrc, since older compatible
11334: dependencies can continue to be used. This is
11335: useful for people who watch their rebuilds very
11336: carefully; it is not very good as a
11337: general-purpose hammer. If you use it, you need
11338: to be mindful of possible ABI changes, including
11339: those from the underlying OS.</p>
11340:
11341: <p>Packages that are built with recommendations
11342: ignored may not be uploaded to ftp.NetBSD.org by
11343: developers and should not be used across
11344: different systems that may have different
11345: versions of binary packages installed.</p>
1.1 grant 11346:
11347: <p>For security fixes, please update the package
11348: vulnerabilities file as well as setting
1.14 xtraeme 11349: <code class="varname">RECOMMENDED</code>, see
1.1 grant 11350: <a href="#security-handling" title=
1.38 dillo 11351: "15.1.8. Handling packages with security problems">
11352: Section 15.1.8, “Handling packages with
1.1 grant 11353: security problems”</a> for more
11354: information.</p>
11355: </li>
11356:
11357: <li>
11358: <p>If your package needs some executable to be
1.17 sketch 11359: able to run correctly and if there's no
1.45 ! wiz 11360: <code xmlns=
! 11361: "http://www.w3.org/TR/xhtml1/transitional" class=
! 11362: "filename">buildlink3.mk</code> file, this is
! 11363: specified using the <code class=
1.14 xtraeme 11364: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 11365: "http://www.w3.org/TR/xhtml1/transitional" href=
11366: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 ! wiz 11367: target="_top"><code xmlns="" class=
! 11368: "filename">print/lyx</code></a> package needs to
! 11369: be able to execute the latex binary from the
! 11370: teTeX package when it runs, and that is
! 11371: specified:</p>
1.1 grant 11372: <pre class="programlisting">
11373: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
11374: </pre>
11375:
11376: <p>The comment about wildcard dependencies from
11377: previous paragraph applies here, too.</p>
11378: </li>
11379: </ol>
11380: </div>
11381:
11382: <p>If your package needs files from another package to
11383: build, see the first part of the “<span class=
11384: "quote">do-configure</span>” target <a xmlns=
11385: "http://www.w3.org/TR/xhtml1/transitional" href=
11386: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45 ! wiz 11387: target="_top"><code xmlns="" class=
! 11388: "filename">print/ghostscript5</code></a> package (it
1.20 ben 11389: relies on the jpeg sources being present in source form
11390: during the build):</p>
1.1 grant 11391: <pre class="programlisting">
11392: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
11393: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
11394: fi
11395: </pre>
11396:
11397: <p>If you build any other packages that way, please
11398: make sure the working files are deleted too when this
11399: package's working files are cleaned up. The easiest way
11400: to do so is by adding a pre-clean target:</p>
11401: <pre class="programlisting">
11402: pre-clean:
11403: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
11404: </pre>
11405:
1.14 xtraeme 11406: <p>Please also note the <code class=
11407: "varname">BUILD_USES_MSGFMT</code> and <code class=
11408: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
11409: which are provided as convenience definitions. The
1.24 wiz 11410: former works out whether <a href=
11411: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
11412: <span class="citerefentry"><span class=
11413: "refentrytitle">msgfmt</span>(1)</span></a> is part of
11414: the base system, and, if it isn't, installs the
11415: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11416: href=
1.1 grant 11417: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45 ! wiz 11418: target="_top"><code xmlns="" class=
! 11419: "filename">devel/gettext</code></a> package. The latter
1.20 ben 11420: adds a build dependency on either an installed version
11421: of an older gettext package, or if it isn't, installs
11422: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11423: href=
11424: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45 ! wiz 11425: target="_top"><code xmlns="" class=
! 11426: "filename">devel/gettext-m4</code></a> package.</p>
1.1 grant 11427: </div>
11428:
11429: <div class="sect2" lang="en" xml:lang="en">
11430: <div class="titlepage">
11431: <div>
11432: <div>
1.30 wiz 11433: <h3 class="title"><a name="conflicts" id=
1.38 dillo 11434: "conflicts"></a>15.1.5. Handling conflicts
1.1 grant 11435: with other packages</h3>
11436: </div>
11437: </div>
11438: </div>
11439:
11440: <p>Your package may conflict with other packages a user
11441: might already have installed on his system, e.g. if
11442: your package installs the same set of files like
11443: another package in our pkgsrc tree.</p>
11444:
1.14 xtraeme 11445: <p>In this case you can set <code class=
11446: "varname">CONFLICTS</code> to a space separated list of
1.1 grant 11447: packages (including version string) your package
11448: conflicts with.</p>
11449:
11450: <p>For example <a xmlns=
11451: "http://www.w3.org/TR/xhtml1/transitional" href=
11452: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45 ! wiz 11453: target="_top"><code xmlns="" class=
! 11454: "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20 ben 11455: "http://www.w3.org/TR/xhtml1/transitional" href=
11456: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45 ! wiz 11457: target="_top"><code xmlns="" class=
! 11458: "filename">x11/Xaw-Xpm</code></a> install provide the
! 11459: same shared library, thus you set in <code xmlns=
! 11460: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11461: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 11462: <pre class="programlisting">
11463: CONFLICTS= Xaw-Xpm-[0-9]*
11464: </pre>
11465:
1.45 ! wiz 11466: <p>and in <code xmlns=
! 11467: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11468: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 11469: <pre class="programlisting">
11470: CONFLICTS= Xaw3d-[0-9]*
11471: </pre>
11472:
11473: <p>Packages will automatically conflict with other
11474: packages with the name prefix and a different version
11475: string. “<span class=
11476: "quote">Xaw3d-1.5</span>” e.g. will automatically
11477: conflict with the older version “<span class=
11478: "quote">Xaw3d-1.3</span>”.</p>
11479: </div>
11480:
11481: <div class="sect2" lang="en" xml:lang="en">
11482: <div class="titlepage">
11483: <div>
11484: <div>
1.30 wiz 11485: <h3 class="title"><a name="not-building-packages"
11486: id=
1.38 dillo 11487: "not-building-packages"></a>15.1.6. Packages
1.30 wiz 11488: that cannot or should not be built</h3>
1.1 grant 11489: </div>
11490: </div>
11491: </div>
11492:
11493: <p>There are several reasons why a package might be
11494: instructed to not build under certain circumstances. If
11495: the package builds and runs on most platforms, the
1.14 xtraeme 11496: exceptions should be noted with <code class=
11497: "varname">NOT_FOR_PLATFORM</code>. If the package
11498: builds and runs on a small handful of platforms, set
11499: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45 ! wiz 11500: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
! 11501: <code class="varname">NOT_FOR_PLATFORM</code> are OS
! 11502: triples (OS-version-platform) that can use glob-style
! 11503: wildcards.</p>
! 11504:
! 11505: <p>If the package should be skipped (for example,
! 11506: because it provides functionality already provided by
! 11507: the system), set <code class=
1.14 xtraeme 11508: "varname">PKG_SKIP_REASON</code> to a descriptive
11509: message. If the package should fail because some
11510: preconditions are not met, set <code class=
11511: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 11512: message.</p>
11513: </div>
11514:
11515: <div class="sect2" lang="en" xml:lang="en">
11516: <div class="titlepage">
11517: <div>
11518: <div>
1.30 wiz 11519: <h3 class="title"><a name="undeletable-packages"
11520: id=
1.38 dillo 11521: "undeletable-packages"></a>15.1.7. Packages
1.30 wiz 11522: which should not be deleted, once installed</h3>
1.1 grant 11523: </div>
11524: </div>
11525: </div>
11526:
11527: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 11528: has been installed, the <code class=
11529: "varname">PKG_PRESERVE</code> definition should be set
11530: in the package Makefile. This will be carried into any
1.1 grant 11531: binary package that is made from this pkgsrc entry. A
11532: “<span class="quote">preserved</span>”
11533: package will not be deleted using <a href=
11534: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11535: <span class="citerefentry"><span class=
11536: "refentrytitle">pkg_delete</span>(1)</span></a> unless
11537: the “<span class="quote">-f</span>” option
11538: is used.</p>
11539: </div>
11540:
11541: <div class="sect2" lang="en" xml:lang="en">
11542: <div class="titlepage">
11543: <div>
11544: <div>
11545: <h3 class="title"><a name="security-handling" id=
1.38 dillo 11546: "security-handling"></a>15.1.8. Handling
1.1 grant 11547: packages with security problems</h3>
11548: </div>
11549: </div>
11550: </div>
11551:
11552: <p>When a vulnerability is found, this should be noted
1.45 ! wiz 11553: in <code xmlns=
! 11554: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11555: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43 wiz 11556: and after committing that file, use
11557: <span><strong class="command">make
11558: upload</strong></span> in the same directory to update
11559: the file on ftp.NetBSD.org.</p>
11560:
11561: <p>After fixing the vulnerability by a patch, its
11562: <code class="varname">PKGREVISION</code> should be
11563: increased (this is of course not necessary if the
11564: problem is fixed by using a newer release of the
1.45 ! wiz 11565: software). In addition, if a <code xmlns=
! 11566: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11567: "filename">buildlink3.mk</code> file exists for an
1.43 wiz 11568: affected package, a corresponding <code class=
1.14 xtraeme 11569: "varname">BUILDLINK_RECOMMENDED.<em class=
11570: "replaceable"><code>pkg</code></em></code> entry should
1.43 wiz 11571: be added or updated in it.</p>
1.1 grant 11572:
11573: <p>Also, if the fix should be applied to the stable
11574: pkgsrc branch, be sure to submit a pullup request!</p>
1.43 wiz 11575:
11576: <p>Binary packages already on ftp.NetBSD.org will be
11577: handled semi-automatically by a weekly cron job.</p>
1.1 grant 11578: </div>
11579:
11580: <div class="sect2" lang="en" xml:lang="en">
11581: <div class="titlepage">
11582: <div>
11583: <div>
1.30 wiz 11584: <h3 class="title"><a name="compiler-bugs" id=
1.38 dillo 11585: "compiler-bugs"></a>15.1.9. How to handle
1.1 grant 11586: compiler bugs</h3>
11587: </div>
11588: </div>
11589: </div>
11590:
11591: <p>Some source files trigger bugs in the compiler,
11592: based on combinations of compiler version and
11593: architecture and almost always relation to optimisation
11594: being enabled. Common symptoms are gcc internal errors
11595: or never finishing compiling a file.</p>
11596:
11597: <p>Typically a workaround involves testing the
1.14 xtraeme 11598: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 11599: version, disabling optimisation for that
1.14 xtraeme 11600: file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45 ! wiz 11601: combination, and documenting it in <code xmlns=
! 11602: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11603: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 11604: number of examples!</p>
11605: </div>
11606:
11607: <div class="sect2" lang="en" xml:lang="en">
11608: <div class="titlepage">
11609: <div>
11610: <div>
1.30 wiz 11611: <h3 class="title"><a name="bumping-pkgrevision"
1.38 dillo 11612: id="bumping-pkgrevision"></a>15.1.10. How to
1.30 wiz 11613: handle incrementing versions when fixing an
11614: existing package</h3>
1.1 grant 11615: </div>
11616: </div>
11617: </div>
11618:
11619: <p>When making fixes to an existing package it can be
1.14 xtraeme 11620: useful to change the version number in <code class=
11621: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 11622: future versions by the original author, a
11623: “<span class="quote">nb1</span>”,
11624: “<span class="quote">nb2</span>”, ...
11625: suffix can be used on package versions by setting
1.14 xtraeme 11626: <code class="varname">PKGREVISION=1</code> (2, ...).
11627: The “<span class="quote">nb</span>” is
11628: treated like a “<span class=
11629: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 11630: <pre class="programlisting">
11631: DISTNAME= foo-17.42
11632: PKGREVISION= 9
11633: </pre>
11634:
1.14 xtraeme 11635: <p>will result in a <code class=
11636: "varname">PKGNAME</code> of “<span class=
1.1 grant 11637: "quote">foo-17.42nb9</span>”.</p>
11638:
11639: <p>When a new release of the package is released, the
1.14 xtraeme 11640: <code class="varname">PKGREVISION</code> should be
11641: removed. e.g. on a new minor release of the above
11642: package, things should be like:</p>
1.1 grant 11643: <pre class="programlisting">
11644: DISTNAME= foo-17.43
11645: </pre>
11646: </div>
11647:
11648: <div class="sect2" lang="en" xml:lang="en">
11649: <div class="titlepage">
11650: <div>
11651: <div>
1.30 wiz 11652: <h3 class="title"><a name=
11653: "portability-of-packages" id=
1.38 dillo 11654: "portability-of-packages"></a>15.1.11. Portability
1.30 wiz 11655: of packages</h3>
1.1 grant 11656: </div>
11657: </div>
11658: </div>
11659:
11660: <p>One appealing feature of pkgsrc is that it runs on
11661: many different platforms. As a result, it is important
11662: to ensure, where possible, that packages in pkgsrc are
11663: portable. There are some particular details you should
11664: pay attention to while working on pkgsrc.</p>
11665:
11666: <div class="sect3" lang="en" xml:lang="en">
11667: <div class="titlepage">
11668: <div>
11669: <div>
1.30 wiz 11670: <h4 class="title"><a name="install-scripts" id=
1.38 dillo 11671: "install-scripts"></a>15.1.11.1. ${INSTALL},
1.1 grant 11672: ${INSTALL_DATA_DIR}, ...</h4>
11673: </div>
11674: </div>
11675: </div>
11676:
1.14 xtraeme 11677: <p>The BSD-compatible <span><strong class=
11678: "command">install</strong></span> supplied with some
1.1 grant 11679: operating systems will not perform more than one
11680: operation at a time. As such, you should call
11681: “<span class="quote">${INSTALL}</span>”,
11682: etc. like this:</p>
11683: <pre class="programlisting">
11684: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
11685: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
11686: </pre>
11687: </div>
11688: </div>
11689: </div>
11690:
11691: <div class="sect1" lang="en" xml:lang="en">
11692: <div class="titlepage">
11693: <div>
11694: <div>
11695: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11696: "downloading-issues" id=
1.38 dillo 11697: "downloading-issues"></a>15.2. Possible
1.1 grant 11698: downloading issues</h2>
11699: </div>
11700: </div>
11701: </div>
11702:
11703: <div class="sect2" lang="en" xml:lang="en">
11704: <div class="titlepage">
11705: <div>
11706: <div>
1.30 wiz 11707: <h3 class="title"><a name="no-plain-download" id=
1.38 dillo 11708: "no-plain-download"></a>15.2.1. Packages
1.30 wiz 11709: whose distfiles aren't available for plain
1.1 grant 11710: downloading</h3>
11711: </div>
11712: </div>
11713: </div>
11714:
11715: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 11716: set <code class="varname">DYNAMIC_MASTER_SITES</code>
11717: and a <span><strong class="command">make
1.45 ! wiz 11718: fetch</strong></span> will call <code xmlns=
! 11719: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11720: "filename">files/getsite.sh</code> with the name of
11721: each file to download as an argument, expecting it to
11722: output the URL of the directory from which to download
11723: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11724: href=
1.1 grant 11725: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45 ! wiz 11726: target="_top"><code xmlns="" class=
! 11727: "filename">graphics/ns-cult3d</code></a> is an example
! 11728: of this usage.</p>
1.1 grant 11729:
11730: <p>If the download can't be automated, because the user
11731: must submit personal information to apply for a
11732: password, or must pay for the source, or whatever, you
1.14 xtraeme 11733: can set <code class="varname">_FETCH_MESSAGE</code> to
11734: a macro which displays a message explaining the
11735: situation. <code class="varname">_FETCH_MESSAGE</code>
11736: must be executable shell commands, not just a message.
11737: (Generally, it executes <code class=
11738: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 11739: following packages use this: <a xmlns=
11740: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 11741: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45 ! wiz 11742: target="_top"><code xmlns="" class=
! 11743: "filename">cad/simian</code></a>, <a xmlns=
1.20 ben 11744: "http://www.w3.org/TR/xhtml1/transitional" href=
11745: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45 ! wiz 11746: target="_top"><code xmlns="" class=
! 11747: "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20 ben 11748: "http://www.w3.org/TR/xhtml1/transitional" href=
11749: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45 ! wiz 11750: target="_top"><code xmlns="" class=
! 11751: "filename">emulators/vmware-module</code></a>,
! 11752: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 11753: href=
1.20 ben 11754: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45 ! wiz 11755: target="_top"><code xmlns="" class=
! 11756: "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20 ben 11757: "http://www.w3.org/TR/xhtml1/transitional" href=
1.43 wiz 11758: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45 ! wiz 11759: target="_top"><code xmlns="" class=
! 11760: "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43 wiz 11761: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 11762: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45 ! wiz 11763: target="_top"><code xmlns="" class=
! 11764: "filename">sysutils/storage-manager</code></a>,
! 11765: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 11766: href=
1.20 ben 11767: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45 ! wiz 11768: target="_top"><code xmlns="" class=
! 11769: "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20 ben 11770: "http://www.w3.org/TR/xhtml1/transitional" href=
11771: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45 ! wiz 11772: target="_top"><code xmlns="" class=
! 11773: "filename">www/openacs</code></a>. Try to be consistent
1.20 ben 11774: with them.</p>
1.1 grant 11775: </div>
11776:
11777: <div class="sect2" lang="en" xml:lang="en">
11778: <div class="titlepage">
11779: <div>
11780: <div>
1.30 wiz 11781: <h3 class="title"><a name=
11782: "modified-distfiles-same-name" id=
1.38 dillo 11783: "modified-distfiles-same-name"></a>15.2.2. How
1.30 wiz 11784: to handle modified distfiles with the 'old'
11785: name</h3>
1.1 grant 11786: </div>
11787: </div>
11788: </div>
11789:
11790: <p>Sometimes authors of a software package make some
11791: modifications after the software was released, and they
11792: put up a new distfile without changing the package's
11793: version number. If a package is already in pkgsrc at
1.32 wiz 11794: that time, the checksum will no longer match. The
11795: contents of the new distfile should be compared against
11796: the old one before changing anything, to make sure the
11797: distfile was really updated on purpose, and that no
11798: trojan horse or so crept in. Then, the correct way to
11799: work around this is to set <code class=
11800: "varname">DIST_SUBDIR</code> to a unique directory
11801: name, usually based on <code class=
11802: "varname">PKGNAME_NOREV</code>. In case this happens
11803: more often, <code class="varname">PKGNAME</code> can be
1.45 ! wiz 11804: used (thus including the <code xmlns=
! 11805: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 11806: "filename">nbX</code> suffix) or a date stamp can be
11807: appended, like <code class=
11808: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45 ! wiz 11809: forget regenerating the <code xmlns=
! 11810: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 11811: "filename">distinfo</code> file after that, since it
11812: contains the <code class="varname">DIST_SUBDIR</code>
11813: path in the filenames. Furthermore, a mail to the
11814: package's authors seems appropriate telling them that
11815: changing distfiles after releases without changing the
11816: file names is not good practice.</p>
1.1 grant 11817: </div>
11818: </div>
11819:
11820: <div class="sect1" lang="en" xml:lang="en">
11821: <div class="titlepage">
11822: <div>
11823: <div>
11824: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11825: "configuration-gotchas" id=
1.38 dillo 11826: "configuration-gotchas"></a>15.3. Configuration
1.1 grant 11827: gotchas</h2>
11828: </div>
11829: </div>
11830: </div>
11831:
11832: <div class="sect2" lang="en" xml:lang="en">
11833: <div class="titlepage">
11834: <div>
11835: <div>
11836: <h3 class="title"><a name="fixes.libtool" id=
1.38 dillo 11837: "fixes.libtool"></a>15.3.1. Shared libraries
1.1 grant 11838: - libtool</h3>
11839: </div>
11840: </div>
11841: </div>
11842:
11843: <p>pkgsrc supports many different machines, with
11844: different object formats like a.out and ELF, and
11845: varying abilities to do shared library and dynamic
11846: loading at all. To accompany this, varying commands and
11847: options have to be passed to the compiler, linker, etc.
11848: to get the Right Thing, which can be pretty annoying
11849: especially if you don't have all the machines at your
11850: hand to test things. The <a xmlns=
11851: "http://www.w3.org/TR/xhtml1/transitional" href=
11852: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45 ! wiz 11853: target="_top"><code xmlns="" class=
! 11854: "filename">devel/libtool</code></a> pkg can help here,
! 11855: as it just “<span class=
! 11856: "quote">knows</span>” how to build both static
! 11857: and dynamic libraries from a set of source files, thus
! 11858: being platform independent.</p>
1.1 grant 11859:
11860: <p>Here's how to use libtool in a pkg in seven simple
11861: steps:</p>
11862:
11863: <div class="orderedlist">
11864: <ol type="1">
11865: <li>
1.14 xtraeme 11866: <p>Add <code class=
11867: "varname">USE_LIBTOOL=yes</code> to the package
11868: Makefile.</p>
1.1 grant 11869: </li>
11870:
11871: <li>
11872: <p>For library objects, use “<span class=
11873: "quote">${LIBTOOL} --mode=compile
11874: ${CC}</span>” in place of
11875: “<span class="quote">${CC}</span>”.
11876: You could even add it to the definition of
1.14 xtraeme 11877: <code class="varname">CC</code>, if only
11878: libraries are being built in a given Makefile.
11879: This one command will build both PIC and non-PIC
11880: library objects, so you need not have separate
11881: shared and non-shared library rules.</p>
1.1 grant 11882: </li>
11883:
11884: <li>
11885: <p>For the linking of the library, remove any
11886: “<span class="quote">ar</span>”,
11887: “<span class="quote">ranlib</span>”,
11888: and “<span class="quote">ld
11889: -Bshareable</span>” commands, and instead
11890: use:</p>
11891: <pre class="programlisting">
11892: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
11893: </pre>
11894:
11895: <p>Note that the library is changed to have a
1.45 ! wiz 11896: <code xmlns=
! 11897: "http://www.w3.org/TR/xhtml1/transitional" class=
! 11898: "filename">.la</code> extension, and the objects
! 11899: are changed to have a <code xmlns=
! 11900: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11901: "filename">.lo</code> extension. Change
11902: <code class="varname">OBJS</code> as necessary.
11903: This automatically creates all of the
1.45 ! wiz 11904: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 11905: class="filename">.a</code>, <code xmlns=
! 11906: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11907: "filename">.so.major.minor</code>, and ELF
11908: symlinks (if necessary) in the build directory.
11909: Be sure to include “<span class=
1.1 grant 11910: "quote">-version-info</span>”, especially
11911: when major and minor are zero, as libtool will
11912: otherwise strip off the shared library
11913: version.</p>
11914:
11915: <p>From the libtool manual:</p>
11916: <pre class="programlisting">
11917: So, libtool library versions are described by three integers:
11918:
11919: CURRENT
11920: The most recent interface number that this library implements.
11921:
11922: REVISION
11923: The implementation number of the CURRENT interface.
11924:
11925: AGE
11926: The difference between the newest and oldest interfaces that this
11927: library implements. In other words, the library implements all the
11928: interface numbers in the range from number `CURRENT - AGE' to
11929: `CURRENT'.
11930:
11931: If two libraries have identical CURRENT and AGE numbers, then the
11932: dynamic linker chooses the library with the greater REVISION number.
11933: </pre>
11934:
11935: <p>The “<span class=
11936: "quote">-release</span>” option will
11937: produce different results for a.out and ELF
11938: (excluding symlinks) in only one case. An ELF
11939: library of the form “<span class=
11940: "quote">libfoo-release.so.<span class=
11941: "emphasis"><em>x</em></span>.<span class=
11942: "emphasis"><em>y</em></span></span>” will
11943: have a symlink of “<span class=
11944: "quote">libfoo.so.<span class=
11945: "emphasis"><em>x</em></span>.<span class=
11946: "emphasis"><em>y</em></span></span>” on an
11947: a.out platform. This is handled
11948: automatically.</p>
11949:
11950: <p>The “<span class="quote">-rpath
11951: argument</span>” is the install directory
11952: of the library being built.</p>
11953:
1.45 ! wiz 11954: <p>In the <code xmlns=
! 11955: "http://www.w3.org/TR/xhtml1/transitional" class=
! 11956: "filename">PLIST</code>, include only the
! 11957: <code xmlns=
! 11958: "http://www.w3.org/TR/xhtml1/transitional" class=
1.19 hubertf 11959: "filename">.la</code> file, the other files will
11960: be added automatically.</p>
1.1 grant 11961: </li>
11962:
11963: <li>
1.45 ! wiz 11964: <p>When linking shared object (<code xmlns=
! 11965: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11966: "filename">.so</code>) files, i.e. files that are
1.24 wiz 11967: loaded via <a href=
11968: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
11969: <span class="citerefentry"><span class=
11970: "refentrytitle">dlopen</span>(3)</span></a>, NOT
11971: shared libraries, use “<span class=
11972: "quote">-module -avoid-version</span>” to
11973: prevent them getting version tacked on.</p>
1.1 grant 11974:
1.45 ! wiz 11975: <p>The <code xmlns=
! 11976: "http://www.w3.org/TR/xhtml1/transitional" class=
! 11977: "filename">PLIST</code> file gets the
! 11978: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 11979: class="filename">foo.so</code> entry.</p>
1.1 grant 11980: </li>
11981:
11982: <li>
11983: <p>When linking programs that depend on these
11984: libraries <span class=
11985: "emphasis"><em>before</em></span> they are
11986: installed, preface the <a href=
11987: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
11988: <span class="citerefentry"><span class=
11989: "refentrytitle">cc</span>(1)</span></a> or
11990: <a href=
11991: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
11992: <span class="citerefentry"><span class=
11993: "refentrytitle">ld</span>(1)</span></a> line with
11994: “<span class="quote">${LIBTOOL}
11995: --mode=link</span>”, and it will find the
11996: correct libraries (static or shared), but please
11997: be aware that libtool will not allow you to
11998: specify a relative path in -L (such as
11999: “<span class=
12000: "quote">-L../somelib</span>”), because it
12001: expects you to change that argument to be the
1.45 ! wiz 12002: <code xmlns=
! 12003: "http://www.w3.org/TR/xhtml1/transitional" class=
! 12004: "filename">.la</code> file. e.g.</p>
1.1 grant 12005: <pre class="programlisting">
12006: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
12007: </pre>
12008:
12009: <p>should be changed to:</p>
12010: <pre class="programlisting">
1.14 xtraeme 12011: ${LIBTOOL} --mode=link ${CC} -o <em class=
12012: "replaceable"><code>someprog</code></em> <em class=
12013: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 12014: </pre>
12015:
12016: <p>and it will do the right thing with the
12017: libraries.</p>
12018: </li>
12019:
12020: <li>
12021: <p>When installing libraries, preface the
12022: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
12023: <span class="citerefentry"><span class=
12024: "refentrytitle">install</span>(1)</span></a> or
12025: <a href=
12026: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
12027: <span class="citerefentry"><span class=
12028: "refentrytitle">cp</span>(1)</span></a> command
12029: with “<span class="quote">${LIBTOOL}
12030: --mode=install</span>”, and change the
1.45 ! wiz 12031: library name to <code xmlns=
! 12032: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12033: "filename">.la</code>. e.g.</p>
1.1 grant 12034: <pre class="programlisting">
12035: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
12036: </pre>
12037:
1.45 ! wiz 12038: <p>This will install the static <code xmlns=
! 12039: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12040: "filename">.a</code>, shared library, any needed
1.1 grant 12041: symlinks, and run <a href=
12042: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
12043: <span class="citerefentry"><span class=
12044: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
12045: </li>
12046:
12047: <li>
1.45 ! wiz 12048: <p>In your <code xmlns=
! 12049: "http://www.w3.org/TR/xhtml1/transitional" class=
! 12050: "filename">PLIST</code>, include only the
! 12051: <code xmlns=
! 12052: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 12053: "filename">.la</code> file (this is a change from
12054: previous behaviour).</p>
1.1 grant 12055: </li>
12056: </ol>
12057: </div>
12058: </div>
12059:
12060: <div class="sect2" lang="en" xml:lang="en">
12061: <div class="titlepage">
12062: <div>
12063: <div>
1.30 wiz 12064: <h3 class="title"><a name="using-libtool" id=
1.38 dillo 12065: "using-libtool"></a>15.3.2. Using libtool on
1.30 wiz 12066: GNU packages that already support libtool</h3>
1.1 grant 12067: </div>
12068: </div>
12069: </div>
12070:
1.14 xtraeme 12071: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
12072: the package Makefile. This will override the package's
12073: own libtool in most cases. For older libtool using
1.1 grant 12074: packages, libtool is made by ltconfig script during the
12075: do-configure step; you can check the libtool script
1.14 xtraeme 12076: location by doing <span><strong class="command">make
12077: configure; find work*/ -name
12078: libtool</strong></span>.</p>
12079:
12080: <p><code class="varname">LIBTOOL_OVERRIDE</code>
12081: specifies which libtool scripts, relative to
12082: <code class="varname">WRKSRC</code>, to override. By
12083: default, it is set to “<span class=
12084: "quote">libtool */libtool */*/libtool</span>”. If
12085: this does not match the location of the package's
12086: libtool script(s), set it as appropriate.</p>
1.13 hubertf 12087:
1.45 ! wiz 12088: <p>If you do not need <code xmlns=
! 12089: "http://www.w3.org/TR/xhtml1/transitional" class=
! 12090: "filename">*.a</code> static libraries built and
! 12091: installed, then use <code class=
! 12092: "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1 grant 12093:
12094: <p>If your package makes use of the platform
12095: independent library for loading dynamic shared objects,
12096: that comes with libtool (libltdl), you should include
1.22 tv 12097: devel/libltdl/buildlink3.mk.</p>
1.1 grant 12098:
12099: <p>Some packages use libtool incorrectly so that the
12100: package may not work or build in some circumstances.
12101: Some of the more common errors are:</p>
12102:
12103: <div class="itemizedlist">
12104: <ul type="disc">
12105: <li>
12106: <p>The inclusion of a shared object (-module) as
12107: a dependent library in an executable or library.
12108: This in itself isn't a problem if one of two
12109: things has been done:</p>
12110:
12111: <div class="orderedlist">
12112: <ol type="1">
12113: <li>
12114: <p>The shared object is named correctly,
1.45 ! wiz 12115: i.e. <code xmlns=
! 12116: "http://www.w3.org/TR/xhtml1/transitional"
! 12117: class="filename">libfoo.la</code>, not
! 12118: <code xmlns=
! 12119: "http://www.w3.org/TR/xhtml1/transitional"
! 12120: class="filename">foo.la</code></p>
1.1 grant 12121: </li>
12122:
12123: <li>
12124: <p>The -dlopen option is used when linking
12125: an executable.</p>
12126: </li>
12127: </ol>
12128: </div>
12129: </li>
12130:
12131: <li>
12132: <p>The use of libltdl without the correct calls
12133: to initialisation routines. The function
12134: lt_dlinit() should be called and the macro
1.14 xtraeme 12135: <code class=
12136: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 12137: included in executables.</p>
12138: </li>
12139: </ul>
12140: </div>
12141: </div>
12142:
12143: <div class="sect2" lang="en" xml:lang="en">
12144: <div class="titlepage">
12145: <div>
12146: <div>
1.30 wiz 12147: <h3 class="title"><a name="autoconf-automake" id=
1.38 dillo 12148: "autoconf-automake"></a>15.3.3. GNU
1.1 grant 12149: Autoconf/Automake</h3>
12150: </div>
12151: </div>
12152: </div>
12153:
12154: <p>If a package needs GNU autoconf or automake to be
12155: executed to regenerate the configure script and
12156: Makefile.in makefile templates, then they should be
1.35 jmmv 12157: executed in a pre-configure target.</p>
1.1 grant 12158:
12159: <p>For packages that need only autoconf:</p>
12160: <pre class="programlisting">
1.35 jmmv 12161: AUTOCONF_REQD= 2.50 # if default version is not good enough
12162: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
1.1 grant 12163: ...
12164:
12165: pre-configure:
1.35 jmmv 12166: cd ${WRKSRC}; autoconf
1.1 grant 12167:
12168: ...
12169: </pre>
12170:
12171: <p>and for packages that need automake and
12172: autoconf:</p>
12173: <pre class="programlisting">
1.35 jmmv 12174: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
1.36 wiz 12175: USE_TOOLS+= automake # use "automake14" for automake-1.4
1.1 grant 12176: ...
12177:
12178: pre-configure:
12179: cd ${WRKSRC}; \
1.35 jmmv 12180: aclocal; autoheader; \
12181: automake -a --foreign -i; autoconf
1.1 grant 12182:
12183: ...
12184: </pre>
12185:
12186: <p>Packages which use GNU Automake will almost
1.35 jmmv 12187: certainly require GNU Make.</p>
1.1 grant 12188:
12189: <p>There are times when the configure process makes
12190: additional changes to the generated files, which then
12191: causes the build process to try to re-execute the
12192: automake sequence. This is prevented by touching
12193: various files in the configure stage. If this causes
1.14 xtraeme 12194: problems with your package you can set <code class=
12195: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 12196: Makefile.</p>
12197: </div>
12198: </div>
12199:
12200: <div class="sect1" lang="en" xml:lang="en">
12201: <div class="titlepage">
12202: <div>
12203: <div>
12204: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12205: "building-considerations" id=
1.38 dillo 12206: "building-considerations"></a>15.4. Building
1.1 grant 12207: considerations</h2>
12208: </div>
12209: </div>
12210: </div>
12211:
12212: <div class="sect2" lang="en" xml:lang="en">
12213: <div class="titlepage">
12214: <div>
12215: <div>
1.30 wiz 12216: <h3 class="title"><a name="cpp-defines" id=
1.38 dillo 12217: "cpp-defines"></a>15.4.1. CPP defines</h3>
1.1 grant 12218: </div>
12219: </div>
12220: </div>
12221:
12222: <p>To port an application to NetBSD, it's usually
12223: necessary for the compiler to be able to judge the
12224: system on which it's compiling, and we use definitions
12225: so that the C pre-processor can do this.</p>
12226:
12227: <p>To test whether you are working on a 4.4 BSD-derived
12228: system, you should use the BSD definition, which is
1.45 ! wiz 12229: defined in <code xmlns=
! 12230: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12231: "filename"><sys/param.h></code> on said
1.1 grant 12232: systems.</p>
12233: <pre class="programlisting">
12234: #include <sys/param.h>
12235: </pre>
12236:
12237: <p>and then you can surround the BSD-specific parts of
12238: your package's C/C++ code using this conditional:</p>
12239: <pre class="programlisting">
12240: #if (defined(BSD) && BSD >= 199306)
12241: ...
12242: #endif
12243: </pre>
12244:
12245: <p>Please use the “<span class=
12246: "quote">__NetBSD__</span>” definition sparingly -
12247: it should only apply to features of NetBSD that are not
12248: present in other 4.4-lite derived BSDs.</p>
12249: </div>
12250: </div>
12251:
12252: <div class="sect1" lang="en" xml:lang="en">
12253: <div class="titlepage">
12254: <div>
12255: <div>
12256: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12257: "package-specific-actions" id=
1.38 dillo 12258: "package-specific-actions"></a>15.5. Package
1.1 grant 12259: specific actions</h2>
12260: </div>
12261: </div>
12262: </div>
12263:
12264: <div class="sect2" lang="en" xml:lang="en">
12265: <div class="titlepage">
12266: <div>
12267: <div>
1.30 wiz 12268: <h3 class="title"><a name="user-interaction" id=
1.38 dillo 12269: "user-interaction"></a>15.5.1. User
1.2 hubertf 12270: interaction</h3>
1.1 grant 12271: </div>
12272: </div>
12273: </div>
12274:
12275: <p>Occasionally, packages require interaction from the
12276: user, and this can be in a number of ways:</p>
12277:
12278: <div class="itemizedlist">
12279: <ul type="disc">
12280: <li>
12281: <p>help in fetching the distfiles</p>
12282: </li>
12283:
12284: <li>
12285: <p>help to configure the package before it is
12286: built</p>
12287: </li>
12288:
12289: <li>
12290: <p>help during the build process</p>
12291: </li>
12292:
12293: <li>
12294: <p>help during the installation of a package</p>
12295: </li>
12296: </ul>
12297: </div>
12298:
1.14 xtraeme 12299: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 12300: definition is provided to notify the pkgsrc mechanism
12301: of an interactive stage which will be needed, and this
1.45 ! wiz 12302: should be set in the package's <code xmlns=
! 12303: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12304: "filename">Makefile</code>. e.g.</p>
1.1 grant 12305: <pre class="programlisting">
12306: INTERACTIVE_STAGE= build
12307: </pre>
12308:
12309: <p>Multiple interactive stages can be specified:</p>
12310: <pre class="programlisting">
12311: INTERACTIVE_STAGE= configure install
12312: </pre>
12313: </div>
12314:
12315: <div class="sect2" lang="en" xml:lang="en">
12316: <div class="titlepage">
12317: <div>
12318: <div>
1.30 wiz 12319: <h3 class="title"><a name="handling-licenses" id=
1.38 dillo 12320: "handling-licenses"></a>15.5.2. Handling
1.1 grant 12321: licenses</h3>
12322: </div>
12323: </div>
12324: </div>
12325:
1.44 gdt 12326: <p>A package may be covered by a license which the user
12327: has or has not agreed to accept. For these cases,
12328: pkgsrc contains a mechanism to note that a package is
12329: covered by a particular license, and the package cannot
12330: be built unless the user has accepted the license.
12331: (Installation of binary packages are not currently
12332: subject to this mechanism.) Packages with licenses that
12333: are either Open Source according to the Open Source
12334: Initiative or Free according to the Free Software
12335: Foundation will not be marked with a license tag.
12336: Packages with licenses that have not been determined to
12337: meet either definition will be marked with a license
12338: tag referring to the license. This will prevent
12339: building unless pkgsrc is informed that the license is
12340: acceptable, and enables displaying the license.</p>
12341:
12342: <p>The license tag mechanism is intended to address
12343: copyright-related issues surrounding building,
12344: installing and using a package, and not to address
12345: redistribution issues (see <code class=
12346: "varname">RESTRICTED</code> and <code class=
12347: "varname">NO_SRC_ON_FTP</code>, etc.). However, the
12348: above definition of licenses for which tags are not
12349: needed implies that packages with redistribution
12350: restrictions should have tags.</p>
12351:
12352: <p>Denoting that a package is covered by a particular
1.45 ! wiz 12353: license is done by placing the license in <code xmlns=
! 12354: "http://www.w3.org/TR/xhtml1/transitional" class=
1.44 gdt 12355: "filename">pkgsrc/licenses</code> and setting the
12356: <code class="varname">LICENSE</code> variable to a
12357: string identifying the license, e.g. in <a xmlns=
1.14 xtraeme 12358: "http://www.w3.org/TR/xhtml1/transitional" href=
1.44 gdt 12359: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45 ! wiz 12360: target="_top"><code xmlns="" class=
! 12361: "filename">graphics/xv</code></a>:</p>
1.1 grant 12362: <pre class="programlisting">
1.44 gdt 12363: LICENSE= xv-license
1.1 grant 12364: </pre>
12365:
12366: <p>When trying to build, the user will get a notice
1.44 gdt 12367: that the package is covered by a license which has not
12368: been accepted:</p>
1.1 grant 12369: <pre class="programlisting">
1.14 xtraeme 12370: <code class="prompt">%</code> <strong class=
12371: "userinput"><code>make</code></strong>
1.44 gdt 12372: ===> xv-3.10anb9 has an unacceptable license: xv-license.
1.1 grant 12373: ===> To view the license, enter "/usr/bin/make show-license".
1.44 gdt 12374: ===> To indicate acceptance, add this line to your /etc/mk.conf:
12375: ===> ACCEPTABLE_LICENSES+=xv-license
1.1 grant 12376: *** Error code 1
12377: </pre>
12378:
1.14 xtraeme 12379: <p>The license can be viewed with <span><strong class=
12380: "command">make show-license</strong></span>, and if it
12381: is considered appropriate, the line printed above can
1.45 ! wiz 12382: be added to <code xmlns=
! 12383: "http://www.w3.org/TR/xhtml1/transitional" class=
! 12384: "filename">/etc/mk.conf</code> to indicate acceptance
! 12385: of the particular license:</p>
1.1 grant 12386: <pre class="programlisting">
1.44 gdt 12387: ACCEPTABLE_LICENSES+=xv-license
1.1 grant 12388: </pre>
12389:
12390: <p>When adding a package with a new license, the
1.45 ! wiz 12391: license text should be added to <code xmlns=
! 12392: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12393: "filename">pkgsrc/licenses</code> for displaying. A
12394: list of known licenses can be seen in this directory as
12395: well as by looking at the list of (commented out)
12396: <code class="varname">ACCEPTABLE_LICENSES</code>
1.45 ! wiz 12397: variable settings in <code xmlns=
! 12398: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12399: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 12400:
1.44 gdt 12401: <p>The use of <code class=
12402: "varname">LICENSE=shareware</code>, <code class=
12403: "varname">LICENSE=no-commercial-use</code>, and similar
12404: language is deprecated because it does not crisply
12405: refer to a particular license text. Another problem
12406: with such usage is that it does not enable a user to
12407: denote acceptance of the license for a single package
12408: without accepting the same license text for another
12409: package. In particular, this can be inappropriate when
12410: e.g. one accepts a particular license to indicate to
12411: pkgsrc that a fee has been paid.</p>
1.1 grant 12412: </div>
12413:
12414: <div class="sect2" lang="en" xml:lang="en">
12415: <div class="titlepage">
12416: <div>
12417: <div>
1.30 wiz 12418: <h3 class="title"><a name=
12419: "installing-score-files" id=
1.38 dillo 12420: "installing-score-files"></a>15.5.3. Installing
1.30 wiz 12421: score files</h3>
1.1 grant 12422: </div>
12423: </div>
12424: </div>
12425:
12426: <p>Certain packages, most of them in the games
12427: category, install a score file that allows all users on
12428: the system to record their highscores. In order for
12429: this to work, the binaries need to be installed setgid
12430: and the score files owned by the appropriate group
12431: and/or owner (traditionally the "games" user/group).
12432: The following variables, documented in more detail in
1.45 ! wiz 12433: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 12434: class="filename">mk/defaults/mk.conf</code>, control
! 12435: this behaviour: <code class=
1.14 xtraeme 12436: "varname">SETGIDGAME</code>, <code class=
12437: "varname">GAMEDATAMODE</code>, <code class=
12438: "varname">GAMEGRP</code>, <code class=
12439: "varname">GAMEMODE</code>, <code class=
12440: "varname">GAMEOWN</code>.</p>
1.1 grant 12441:
12442: <p>Note that per default, setgid installation of games
1.14 xtraeme 12443: is disabled; setting <code class=
12444: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 12445: variables accordingly.</p>
12446:
12447: <p>A package should therefor never hard code file
1.14 xtraeme 12448: ownership or access permissions but rely on
12449: <code class="varname">INSTALL_GAME</code> and
12450: <code class="varname">INSTALL_GAME_DATA</code> to set
12451: these correctly.</p>
1.1 grant 12452: </div>
12453:
12454: <div class="sect2" lang="en" xml:lang="en">
12455: <div class="titlepage">
12456: <div>
12457: <div>
1.30 wiz 12458: <h3 class="title"><a name="perl-scripts" id=
1.38 dillo 12459: "perl-scripts"></a>15.5.4. Packages
1.30 wiz 12460: containing perl scripts</h3>
1.1 grant 12461: </div>
12462: </div>
12463: </div>
12464:
12465: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 12466: set <code class="varname">REPLACE_PERL</code> to ensure
12467: that the proper interpreter path is set. <code class=
12468: "varname">REPLACE_PERL</code> should contain a list of
12469: scripts, relative to <code class=
12470: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 12471: </div>
12472:
12473: <div class="sect2" lang="en" xml:lang="en">
12474: <div class="titlepage">
12475: <div>
12476: <div>
1.30 wiz 12477: <h3 class="title"><a name="hardcoded-paths" id=
1.38 dillo 12478: "hardcoded-paths"></a>15.5.5. Packages with
1.1 grant 12479: hardcoded paths to other interpreters</h3>
12480: </div>
12481: </div>
12482: </div>
12483:
12484: <p>Your package may also contain scripts with hardcoded
12485: paths to other interpreters besides (or as well as)
12486: perl. To correct the full pathname to the script
12487: interpreter, you need to set the following definitions
1.45 ! wiz 12488: in your <code xmlns=
! 12489: "http://www.w3.org/TR/xhtml1/transitional" class=
! 12490: "filename">Makefile</code> (we shall use
! 12491: <span><strong class="command">tclsh</strong></span> in
! 12492: this example):</p>
1.1 grant 12493: <pre class="programlisting">
12494: REPLACE_INTERPRETER+= tcl
12495: _REPLACE.tcl.old= .*/bin/tclsh
12496: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
12497: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
12498: relative to ${WRKSRC}, just as in REPLACE_PERL
12499: </pre>
12500: </div>
12501:
12502: <div class="sect2" lang="en" xml:lang="en">
12503: <div class="titlepage">
12504: <div>
12505: <div>
1.30 wiz 12506: <h3 class="title"><a name="perl-modules" id=
1.38 dillo 12507: "perl-modules"></a>15.5.6. Packages
1.30 wiz 12508: installing perl modules</h3>
1.1 grant 12509: </div>
12510: </div>
12511: </div>
12512:
12513: <p>Makefiles of packages providing perl5 modules should
1.45 ! wiz 12514: include the Makefile fragment <code xmlns=
! 12515: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12516: "filename">../../lang/perl5/module.mk</code>. It
12517: provides a <span><strong class=
12518: "command">do-configure</strong></span> target for the
12519: standard perl configuration for such modules as well as
12520: various hooks to tune this configuration. See comments
12521: in this file for details.</p>
1.1 grant 12522:
12523: <p>Perl5 modules will install into different places
12524: depending on the version of perl used during the build
12525: process. To address this, pkgsrc will append lines to
1.45 ! wiz 12526: the <code xmlns=
! 12527: "http://www.w3.org/TR/xhtml1/transitional" class=
! 12528: "filename">PLIST</code> corresponding to the files
! 12529: listed in the installed <code xmlns=
! 12530: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12531: "filename">.packlist</code> file generated by most
12532: perl5 modules. This is invoked by defining <code class=
12533: "varname">PERL5_PACKLIST</code> to a space-separated
12534: list of paths to packlist files, e.g.:</p>
1.1 grant 12535: <pre class="programlisting">
12536: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
12537: </pre>
12538:
1.14 xtraeme 12539: <p>The variables <code class=
12540: "varname">PERL5_SITELIB</code>, <code class=
12541: "varname">PERL5_SITEARCH</code>, and <code class=
12542: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 12543: locations in which perl5 modules may be installed, and
12544: may be used by perl5 packages that don't have a
12545: packlist. These three variables are also substituted
1.45 ! wiz 12546: for in the <code xmlns=
! 12547: "http://www.w3.org/TR/xhtml1/transitional" class=
! 12548: "filename">PLIST</code>.</p>
1.1 grant 12549: </div>
12550:
12551: <div class="sect2" lang="en" xml:lang="en">
12552: <div class="titlepage">
12553: <div>
12554: <div>
12555: <h3 class="title"><a name="faq.info-files" id=
1.38 dillo 12556: "faq.info-files"></a>15.5.7. Packages
1.1 grant 12557: installing info files</h3>
12558: </div>
12559: </div>
12560: </div>
12561:
12562: <p>Some packages install info files or use the
12563: “<span class="quote">makeinfo</span>” or
12564: “<span class="quote">install-info</span>”
12565: commands. Each of the info files:</p>
12566:
12567: <div class="itemizedlist">
12568: <ul type="disc">
12569: <li>
12570: <p>is considered to be installed in the directory
1.45 ! wiz 12571: <code xmlns=
! 12572: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12573: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 12574: </li>
12575:
12576: <li>
12577: <p>is registered in the Info directory file
1.45 ! wiz 12578: <code xmlns=
! 12579: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12580: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 12581: </li>
12582:
12583: <li>
12584: <p>and must be listed as a filename in the
1.14 xtraeme 12585: <code class="varname">INFO_FILES</code> variable
12586: in the package Makefile.</p>
1.1 grant 12587: </li>
12588: </ul>
12589: </div>
12590:
1.14 xtraeme 12591: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 12592: “<span class="quote">info</span>” and can
1.45 ! wiz 12593: be overridden in the package Makefile. <code xmlns=
! 12594: "http://www.w3.org/TR/xhtml1/transitional" class=
! 12595: "filename">INSTALL</code> and <code xmlns=
! 12596: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12597: "filename">DEINSTALL</code> scripts will be generated
12598: to handle registration of the info files in the Info
1.1 grant 12599: directory file. The “<span class=
12600: "quote">install-info</span>” command used for the
12601: info files registration is either provided by the
12602: system, or by a special purpose package automatically
12603: added as dependency if needed.</p>
12604:
12605: <p>A package which needs the “<span class=
12606: "quote">makeinfo</span>” command at build time
1.14 xtraeme 12607: must define the variable <code class=
12608: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 12609: minimum version of the “<span class=
12610: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 12611: should be noted with the <code class=
12612: "varname">TEXINFO_REQD</code> variable in the package
1.45 ! wiz 12613: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 12614: class="filename">Makefile</code>. By default, a minimum
! 12615: version of 3.12 is required. If the system does not
! 12616: provide a <span><strong class=
1.14 xtraeme 12617: "command">makeinfo</strong></span> command or if it
12618: does not match the required minimum, a build dependency
12619: on the <a xmlns=
12620: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 12621: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45 ! wiz 12622: target="_top"><code xmlns="" class=
! 12623: "filename">devel/gtexinfo</code></a> package will be
1.20 ben 12624: added automatically.</p>
1.1 grant 12625:
12626: <p>The build and installation process of the software
12627: provided by the package should not use the
1.14 xtraeme 12628: <span><strong class=
12629: "command">install-info</strong></span> command as the
12630: registration of info files is the task of the package
1.45 ! wiz 12631: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 12632: class="filename">INSTALL</code> script, and it must use
! 12633: the appropriate <span><strong class=
1.14 xtraeme 12634: "command">makeinfo</strong></span> command.</p>
1.1 grant 12635:
12636: <p>To achieve this goal the pkgsrc infrastructure
1.14 xtraeme 12637: creates overriding scripts for the <span><strong class=
12638: "command">install-info</strong></span> and
12639: <span><strong class="command">makeinfo</strong></span>
12640: commands in a directory listed early in <code class=
12641: "varname">PATH</code>.</p>
1.1 grant 12642:
1.14 xtraeme 12643: <p>The script overriding <span><strong class=
12644: "command">install-info</strong></span> has no effect
12645: except the logging of a message. The script overriding
12646: <span><strong class="command">makeinfo</strong></span>
12647: logs a message and according to the value of
12648: <code class="varname">USE_MAKEINFO</code> and
12649: <code class="varname">TEXINFO_REQD</code> either run
12650: the appropriate <span><strong class=
12651: "command">makeinfo</strong></span> command or exit on
12652: error.</p>
1.1 grant 12653: </div>
12654:
12655: <div class="sect2" lang="en" xml:lang="en">
12656: <div class="titlepage">
12657: <div>
12658: <div>
1.30 wiz 12659: <h3 class="title"><a name="gconf2-data-files" id=
1.38 dillo 12660: "gconf2-data-files"></a>15.5.8. Packages
1.30 wiz 12661: installing GConf2 data files</h3>
1.1 grant 12662: </div>
12663: </div>
12664: </div>
12665:
1.45 ! wiz 12666: <p>If a package installs <code xmlns=
! 12667: "http://www.w3.org/TR/xhtml1/transitional" class=
! 12668: "filename">.schemas</code> or <code xmlns=
! 12669: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12670: "filename">.entries</code> files, used by GConf2, you
1.1 grant 12671: need to take some extra steps to make sure they get
12672: registered in the database:</p>
12673:
12674: <div class="orderedlist">
12675: <ol type="1">
12676: <li>
1.45 ! wiz 12677: <p>Include <code xmlns=
! 12678: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12679: "filename">../../devel/GConf2/schemas.mk</code>
1.45 ! wiz 12680: instead of its <code xmlns=
! 12681: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12682: "filename">buildlink3.mk</code> file. This takes
1.1 grant 12683: care of rebuilding the GConf2 database at
12684: installation and deinstallation time, and tells
12685: the package where to install GConf2 data files
12686: using some standard configure arguments. It also
12687: disallows any access to the database directly
12688: from the package.</p>
12689: </li>
12690:
12691: <li>
12692: <p>Ensure that the package installs its
1.45 ! wiz 12693: <code xmlns=
! 12694: "http://www.w3.org/TR/xhtml1/transitional" class=
! 12695: "filename">.schemas</code> files under
! 12696: <code xmlns=
! 12697: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12698: "filename">${PREFIX}/share/gconf/schemas</code>.
1.45 ! wiz 12699: If they get installed under <code xmlns=
! 12700: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12701: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 12702: manually patch the package.</p>
12703: </li>
12704:
12705: <li>
12706: <p>Check the PLIST and remove any entries under
12707: the etc/gconf directory, as they will be handled
12708: automatically. See <a href="#faq.conf" title=
1.38 dillo 12709: "7.14. How do I change the location of configuration files?">
12710: Section 7.14, “How do I change the
1.35 jmmv 12711: location of configuration files?”</a> for
12712: more information.</p>
1.1 grant 12713: </li>
12714:
12715: <li>
1.14 xtraeme 12716: <p>Define the <code class=
12717: "varname">GCONF2_SCHEMAS</code> variable in your
1.45 ! wiz 12718: <code xmlns=
! 12719: "http://www.w3.org/TR/xhtml1/transitional" class=
! 12720: "filename">Makefile</code> with a list of all
! 12721: <code xmlns=
! 12722: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12723: "filename">.schemas</code> files installed by the
12724: package, if any. Names must not contain any
12725: directories in them.</p>
1.1 grant 12726: </li>
12727:
12728: <li>
1.14 xtraeme 12729: <p>Define the <code class=
12730: "varname">GCONF2_ENTRIES</code> variable in your
1.45 ! wiz 12731: <code xmlns=
! 12732: "http://www.w3.org/TR/xhtml1/transitional" class=
! 12733: "filename">Makefile</code> with a list of all
! 12734: <code xmlns=
! 12735: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12736: "filename">.entries</code> files installed by the
12737: package, if any. Names must not contain any
12738: directories in them.</p>
1.1 grant 12739: </li>
12740: </ol>
12741: </div>
12742: </div>
12743:
12744: <div class="sect2" lang="en" xml:lang="en">
12745: <div class="titlepage">
12746: <div>
12747: <div>
1.30 wiz 12748: <h3 class="title"><a name=
12749: "scrollkeeper-data-files" id=
1.38 dillo 12750: "scrollkeeper-data-files"></a>15.5.9. Packages
1.30 wiz 12751: installing scrollkeeper data files</h3>
1.1 grant 12752: </div>
12753: </div>
12754: </div>
12755:
1.45 ! wiz 12756: <p>If a package installs <code xmlns=
! 12757: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12758: "filename">.omf</code> files, used by scrollkeeper, you
12759: need to take some extra steps to make sure they get
12760: registered in the database:</p>
1.1 grant 12761:
12762: <div class="orderedlist">
12763: <ol type="1">
12764: <li>
1.45 ! wiz 12765: <p>Include <code xmlns=
! 12766: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12767: "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45 ! wiz 12768: instead of its <code xmlns=
! 12769: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12770: "filename">buildlink3.mk</code> file. This takes
1.1 grant 12771: care of rebuilding the scrollkeeper database at
12772: installation and deinstallation time, and
12773: disallows any access to it directly from the
12774: package.</p>
12775: </li>
12776:
12777: <li>
12778: <p>Check the PLIST and remove any entries under
1.45 ! wiz 12779: the <code xmlns=
! 12780: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12781: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 12782: as they will be handled automatically.</p>
12783: </li>
12784:
12785: <li>
1.45 ! wiz 12786: <p>Remove the <code xmlns=
! 12787: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12788: "filename">share/omf</code> directory from the
12789: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 12790: </li>
12791: </ol>
12792: </div>
12793: </div>
12794:
12795: <div class="sect2" lang="en" xml:lang="en">
12796: <div class="titlepage">
12797: <div>
12798: <div>
1.30 wiz 12799: <h3 class="title"><a name="x11-fonts" id=
1.38 dillo 12800: "x11-fonts"></a>15.5.10. Packages installing
1.1 grant 12801: X11 fonts</h3>
12802: </div>
12803: </div>
12804: </div>
12805:
12806: <p>If a package installs font files, you will need to
12807: rebuild the fonts database in the directory where they
12808: get installed at installation and deinstallation time.
1.45 ! wiz 12809: This can be automatically done by using <code xmlns=
! 12810: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12811: "filename">mk/fonts.mk</code>, which you need to
1.45 ! wiz 12812: include in your <code xmlns=
! 12813: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12814: "filename">Makefile</code>.</p>
1.1 grant 12815:
12816: <p>When the file is included, you can list the
1.14 xtraeme 12817: directories where fonts are installed in the
12818: <code class="varname">FONTS_<em class=
12819: "replaceable"><code>type</code></em>_DIRS</code>
12820: variables, where <em class=
12821: "replaceable"><code>type</code></em> can be one of
12822: “<span class="quote">TTF</span>”,
1.1 grant 12823: “<span class="quote">TYPE1</span>” or
12824: “<span class="quote">X11</span>”. Also make
1.45 ! wiz 12825: sure that the database file <code xmlns=
! 12826: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12827: "filename">fonts.dir</code> is not listed in the
1.1 grant 12828: PLIST.</p>
12829:
12830: <p>Note that you should not create new directories for
12831: fonts; instead use the standard ones to avoid that the
12832: user needs to manually configure his X server to find
12833: them.</p>
12834: </div>
12835:
12836: <div class="sect2" lang="en" xml:lang="en">
12837: <div class="titlepage">
12838: <div>
12839: <div>
1.30 wiz 12840: <h3 class="title"><a name="gtk2-modules" id=
1.38 dillo 12841: "gtk2-modules"></a>15.5.11. Packages
1.30 wiz 12842: installing GTK2 modules</h3>
1.1 grant 12843: </div>
12844: </div>
12845: </div>
12846:
12847: <p>If a package installs gtk2 immodules or loaders, you
12848: need to take some extra steps to get them registered in
12849: the GTK2 database properly:</p>
12850:
12851: <div class="orderedlist">
12852: <ol type="1">
12853: <li>
1.45 ! wiz 12854: <p>Include <code xmlns=
! 12855: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12856: "filename">../../x11/gtk2/modules.mk</code>
1.45 ! wiz 12857: instead of its <code xmlns=
! 12858: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12859: "filename">buildlink3.mk</code> file. This takes
12860: care of rebuilding the database at installation
12861: and deinstallation time.</p>
1.1 grant 12862: </li>
12863:
12864: <li>
1.14 xtraeme 12865: <p>Set <code class=
12866: "varname">GTK2_IMMODULES=YES</code> if your
12867: package installs GTK2 immodules.</p>
1.1 grant 12868: </li>
12869:
12870: <li>
1.14 xtraeme 12871: <p>Set <code class=
12872: "varname">GTK2_LOADERS=YES</code> if your package
12873: installs GTK2 loaders.</p>
1.1 grant 12874: </li>
12875:
12876: <li>
12877: <p>Patch the package to not touch any of the gtk2
12878: databases directly. These are:</p>
12879:
12880: <div class="itemizedlist">
12881: <ul type="disc">
12882: <li>
1.45 ! wiz 12883: <p><code xmlns=
! 12884: "http://www.w3.org/TR/xhtml1/transitional"
! 12885: class=
1.14 xtraeme 12886: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 12887: </li>
12888:
12889: <li>
1.45 ! wiz 12890: <p><code xmlns=
! 12891: "http://www.w3.org/TR/xhtml1/transitional"
! 12892: class=
1.14 xtraeme 12893: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 12894: </li>
12895: </ul>
12896: </div>
12897: </li>
12898:
12899: <li>
12900: <p>Check the PLIST and remove any entries under
1.45 ! wiz 12901: the <code xmlns=
! 12902: "http://www.w3.org/TR/xhtml1/transitional" class=
! 12903: "filename">libdata/gtk-2.0</code> directory, as
! 12904: they will be handled automatically.</p>
1.1 grant 12905: </li>
12906: </ol>
12907: </div>
12908: </div>
12909:
12910: <div class="sect2" lang="en" xml:lang="en">
12911: <div class="titlepage">
12912: <div>
12913: <div>
1.30 wiz 12914: <h3 class="title"><a name="sgml-xml-data" id=
1.38 dillo 12915: "sgml-xml-data"></a>15.5.12. Packages
1.30 wiz 12916: installing SGML or XML data</h3>
1.1 grant 12917: </div>
12918: </div>
12919: </div>
12920:
12921: <p>If a package installs SGML or XML data files that
12922: need to be registered in system-wide catalogs (like
12923: DTDs, sub-catalogs, etc.), you need to take some extra
12924: steps:</p>
12925:
12926: <div class="orderedlist">
12927: <ol type="1">
12928: <li>
1.45 ! wiz 12929: <p>Include <code xmlns=
! 12930: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12931: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45 ! wiz 12932: in your <code xmlns=
! 12933: "http://www.w3.org/TR/xhtml1/transitional" class=
! 12934: "filename">Makefile</code>, which takes care of
! 12935: registering those files in system-wide catalogs
! 12936: at installation and deinstallation time.</p>
1.1 grant 12937: </li>
12938:
12939: <li>
1.14 xtraeme 12940: <p>Set <code class="varname">SGML_CATALOGS</code>
12941: to the full path of any SGML catalogs installed
12942: by the package.</p>
1.1 grant 12943: </li>
12944:
12945: <li>
1.14 xtraeme 12946: <p>Set <code class="varname">XML_CATALOGS</code>
12947: to the full path of any XML catalogs installed by
1.1 grant 12948: the package.</p>
12949: </li>
12950:
12951: <li>
1.14 xtraeme 12952: <p>Set <code class="varname">SGML_ENTRIES</code>
12953: to individual entries to be added to the SGML
1.1 grant 12954: catalog. These come in groups of three strings;
12955: see xmlcatmgr(1) for more information
12956: (specifically, arguments recognized by the 'add'
12957: action). Note that you will normally not use this
12958: variable.</p>
12959: </li>
12960:
12961: <li>
1.14 xtraeme 12962: <p>Set <code class="varname">XML_ENTRIES</code>
12963: to individual entries to be added to the XML
1.1 grant 12964: catalog. These come in groups of three strings;
12965: see xmlcatmgr(1) for more information
12966: (specifically, arguments recognized by the 'add'
12967: action). Note that you will normally not use this
12968: variable.</p>
12969: </li>
12970: </ol>
12971: </div>
12972: </div>
12973:
12974: <div class="sect2" lang="en" xml:lang="en">
12975: <div class="titlepage">
12976: <div>
12977: <div>
1.30 wiz 12978: <h3 class="title"><a name="mime-database" id=
1.38 dillo 12979: "mime-database"></a>15.5.13. Packages
1.30 wiz 12980: installing extensions to the MIME database</h3>
1.1 grant 12981: </div>
12982: </div>
12983: </div>
12984:
12985: <p>If a package provides extensions to the MIME
1.45 ! wiz 12986: database by installing <code xmlns=
! 12987: "http://www.w3.org/TR/xhtml1/transitional" class=
! 12988: "filename">.xml</code> files inside <code xmlns=
! 12989: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12990: "filename">${PREFIX}/share/mime/packages</code>, you
12991: need to take some extra steps to ensure that the
12992: database is kept consistent with respect to these new
12993: files:</p>
1.1 grant 12994:
12995: <div class="orderedlist">
12996: <ol type="1">
12997: <li>
1.45 ! wiz 12998: <p>Include <code xmlns=
! 12999: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13000: "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45 ! wiz 13001: (avoid using the <code xmlns=
! 13002: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13003: "filename">buildlink3.mk</code> file from this
13004: same directory, which is reserved for inclusion
1.45 ! wiz 13005: from other <code xmlns=
! 13006: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13007: "filename">buildlink3.mk</code> files). It takes
13008: care of rebuilding the MIME database at
13009: installation and deinstallation time, and
13010: disallows any access to it directly from the
1.1 grant 13011: package.</p>
13012: </li>
13013:
13014: <li>
13015: <p>Check the PLIST and remove any entries under
1.45 ! wiz 13016: the <code xmlns=
! 13017: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13018: "filename">share/mime</code> directory,
! 13019: <span class="emphasis"><em>except</em></span> for
! 13020: files saved under <code xmlns=
! 13021: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13022: "filename">share/mime/packages</code>. The former
1.1 grant 13023: are handled automatically by the
13024: update-mime-database program, but the later are
13025: package-dependent and must be removed by the
13026: package that installed them in the first
13027: place.</p>
13028: </li>
13029:
13030: <li>
1.45 ! wiz 13031: <p>Remove any <code xmlns=
! 13032: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13033: "filename">share/mime/*</code> directories from
13034: the PLIST. They will be handled by the
1.1 grant 13035: shared-mime-info package.</p>
13036: </li>
13037: </ol>
13038: </div>
13039: </div>
13040:
13041: <div class="sect2" lang="en" xml:lang="en">
13042: <div class="titlepage">
13043: <div>
13044: <div>
1.30 wiz 13045: <h3 class="title"><a name="intltool" id=
1.38 dillo 13046: "intltool"></a>15.5.14. Packages using
1.1 grant 13047: intltool</h3>
13048: </div>
13049: </div>
13050: </div>
13051:
13052: <p>If a package uses intltool during its build, include
1.45 ! wiz 13053: the <code xmlns=
! 13054: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13055: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 13056: file, which forces it to use the intltool package
13057: provided by pkgsrc, instead of the one bundled with the
13058: distribution file.</p>
13059:
13060: <p>This tracks intltool's build-time dependencies and
13061: uses the latest available version; this way, the
13062: package benefits of any bug fixes that may have
13063: appeared since it was released.</p>
13064: </div>
1.18 xtraeme 13065:
13066: <div class="sect2" lang="en" xml:lang="en">
13067: <div class="titlepage">
13068: <div>
13069: <div>
1.30 wiz 13070: <h3 class="title"><a name="startup-scripts" id=
1.38 dillo 13071: "startup-scripts"></a>15.5.15. Packages
1.30 wiz 13072: installing startup scripts</h3>
1.18 xtraeme 13073: </div>
13074: </div>
13075: </div>
13076:
13077: <p>If a package contains a rc.d script, it won't be
13078: copied into the startup directory by default, but you
13079: can enable it, by adding the option <code class=
1.45 ! wiz 13080: "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
! 13081: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 13082: "filename">/etc/mk.conf</code>. This option will copy
1.45 ! wiz 13083: the scripts into <code xmlns=
! 13084: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 13085: "filename">/etc/rc.d</code> when a package is
13086: installed, and it will automatically remove the scripts
13087: when the package is deinstalled.</p>
13088: </div>
1.1 grant 13089: </div>
13090:
13091: <div class="sect1" lang="en" xml:lang="en">
13092: <div class="titlepage">
13093: <div>
13094: <div>
13095: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13096: "feedback-to-author" id=
1.38 dillo 13097: "feedback-to-author"></a>15.6. Feedback to the
1.30 wiz 13098: author</h2>
1.1 grant 13099: </div>
13100: </div>
13101: </div>
13102:
13103: <p>If you have found any bugs in the package you make
13104: available, if you had to do special steps to make it run
13105: under NetBSD or if you enhanced the software in various
13106: other ways, be sure to report these changes back to the
13107: original author of the program! With that kind of
13108: support, the next release of the program can incorporate
13109: these fixes, and people not using the NetBSD packages
13110: system can win from your efforts.</p>
13111:
13112: <p>Support the idea of free software!</p>
13113: </div>
13114: </div>
13115:
13116: <div class="chapter" lang="en" xml:lang="en">
13117: <div class="titlepage">
13118: <div>
13119: <div>
13120: <h2 class="title"><a name="debug" id=
1.38 dillo 13121: "debug"></a>Chapter 16. Debugging</h2>
1.1 grant 13122: </div>
13123: </div>
13124: </div>
13125:
13126: <p>To check out all the gotchas when building a package,
13127: here are the steps that I do in order to get a package
13128: working. Please note this is basically the same as what was
13129: explained in the previous sections, only with some
13130: debugging aids.</p>
13131:
13132: <div class="itemizedlist">
13133: <ul type="disc">
13134: <li>
1.14 xtraeme 13135: <p>Be sure to set <code class=
1.45 ! wiz 13136: "varname">PKG_DEVELOPER=1</code> in <code xmlns=
! 13137: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13138: "filename">/etc/mk.conf</code></p>
1.1 grant 13139: </li>
13140:
13141: <li>
13142: <p>Install <a xmlns=
13143: "http://www.w3.org/TR/xhtml1/transitional" href=
13144: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 ! wiz 13145: target="_top"><code xmlns="" class=
! 13146: "filename">pkgtools/url2pkg</code></a>, create a
1.20 ben 13147: directory for a new package, change into it, then run
13148: <span><strong class=
13149: "command">url2pkg</strong></span>:</p>
1.1 grant 13150: <pre class="screen">
1.14 xtraeme 13151: <code class="prompt">%</code> <strong class=
13152: "userinput"><code>mkdir /usr/pkgsrc/<em class=
13153: "replaceable"><code>category</code></em>/<em class=
13154: "replaceable"><code>examplepkg</code></em></code></strong>
13155: <code class="prompt">%</code> <strong class=
13156: "userinput"><code>cd /usr/pkgsrc/<em class=
13157: "replaceable"><code>category</code></em>/<em class=
13158: "replaceable"><code>examplepkg</code></em></code></strong>
13159: <code class="prompt">%</code> <strong class=
13160: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 13161: </pre>
13162: </li>
13163:
13164: <li>
1.45 ! wiz 13165: <p>Edit the <code xmlns=
! 13166: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13167: "filename">Makefile</code> as requested.</p>
1.1 grant 13168: </li>
13169:
13170: <li>
1.45 ! wiz 13171: <p>Fill in the <code xmlns=
! 13172: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13173: "filename">DESCR</code> file</p>
1.1 grant 13174: </li>
13175:
13176: <li>
1.14 xtraeme 13177: <p>Run <span><strong class="command">make
13178: configure</strong></span></p>
1.1 grant 13179: </li>
13180:
13181: <li>
13182: <p>Add any dependencies glimpsed from documentation
1.45 ! wiz 13183: and the configure step to the package's <code xmlns=
! 13184: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13185: "filename">Makefile</code>.</p>
1.1 grant 13186: </li>
13187:
13188: <li>
13189: <p>Make the package compile, doing multiple rounds
13190: of</p>
13191: <pre class="screen">
1.14 xtraeme 13192: <code class="prompt">%</code> <strong class=
13193: "userinput"><code>make</code></strong>
13194: <code class="prompt">%</code> <strong class=
13195: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
13196: <code class="prompt">%</code> <strong class=
13197: "userinput"><code>mkpatches</code></strong>
13198: <code class="prompt">%</code> <strong class=
13199: "userinput"><code>patchdiff</code></strong>
13200: <code class="prompt">%</code> <strong class=
13201: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
13202: <code class="prompt">%</code> <strong class=
13203: "userinput"><code>make mps</code></strong>
13204: <code class="prompt">%</code> <strong class=
13205: "userinput"><code>make clean</code></strong>
1.1 grant 13206: </pre>
13207:
13208: <p>Doing as non-root user will ensure that no files
13209: are modified that shouldn't be, especially during the
1.14 xtraeme 13210: build phase. <span><strong class=
13211: "command">mkpatches</strong></span>,
13212: <span><strong class=
13213: "command">patchdiff</strong></span> and
13214: <span><strong class="command">pkgvi</strong></span>
13215: are from the <a xmlns=
1.1 grant 13216: "http://www.w3.org/TR/xhtml1/transitional" href=
13217: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 ! wiz 13218: target="_top"><code xmlns="" class=
! 13219: "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1 grant 13220: </li>
13221:
13222: <li>
1.45 ! wiz 13223: <p>Look at the <code xmlns=
! 13224: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13225: "filename">Makefile</code>, fix if necessary; see
13226: <a href="#components.Makefile" title=
1.38 dillo 13227: "8.1. Makefile">Section 8.1,
1.45 ! wiz 13228: “<code xmlns=
! 13229: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13230: "filename">Makefile</code>”</a>.</p>
1.1 grant 13231: </li>
13232:
13233: <li>
1.45 ! wiz 13234: <p>Generate a <code xmlns=
! 13235: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13236: "filename">PLIST</code>:</p>
1.1 grant 13237: <pre class="screen">
1.14 xtraeme 13238: <code class="prompt">#</code> <strong class=
13239: "userinput"><code>make install</code></strong>
13240: <code class="prompt">#</code> <strong class=
13241: "userinput"><code>make print-PLIST >PLIST</code></strong>
13242: <code class="prompt">#</code> <strong class=
13243: "userinput"><code>make deinstall</code></strong>
13244: <code class="prompt">#</code> <strong class=
13245: "userinput"><code>make install</code></strong>
13246: <code class="prompt">#</code> <strong class=
13247: "userinput"><code>make deinstall</code></strong>
1.1 grant 13248: </pre>
13249:
1.45 ! wiz 13250: <p>You usually need to be <code xmlns=
! 13251: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13252: "username">root</code> to do this. Look if there are
1.1 grant 13253: any files left:</p>
13254: <pre class="screen">
1.14 xtraeme 13255: <code class="prompt">#</code> <strong class=
13256: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 13257: </pre>
13258:
13259: <p>If this reveals any files that are missing in
1.45 ! wiz 13260: <code xmlns=
! 13261: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13262: "filename">PLIST</code>, add them.</p>
1.1 grant 13263: </li>
13264:
13265: <li>
1.45 ! wiz 13266: <p>Now that the <code xmlns=
! 13267: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13268: "filename">PLIST</code> is OK, install the package
! 13269: again and make a binary package:</p>
1.1 grant 13270: <pre class="screen">
1.14 xtraeme 13271: <code class="prompt">#</code> <strong class=
13272: "userinput"><code>make reinstall</code></strong>
13273: <code class="prompt">#</code> <strong class=
13274: "userinput"><code>make package</code></strong>
1.1 grant 13275: </pre>
13276: </li>
13277:
13278: <li>
13279: <p>Delete the installed package:</p>
13280: <pre class="screen">
1.14 xtraeme 13281: <code class="prompt">#</code> <strong class=
13282: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 13283: </pre>
13284: </li>
13285:
13286: <li>
1.14 xtraeme 13287: <p>Repeat the above <span><strong class=
13288: "command">make print-PLIST</strong></span> command,
13289: which shouldn't find anything now:</p>
1.1 grant 13290: <pre class="screen">
1.14 xtraeme 13291: <code class="prompt">#</code> <strong class=
13292: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 13293: </pre>
13294: </li>
13295:
13296: <li>
13297: <p>Reinstall the binary package:</p>
13298: <pre class="screen">
1.14 xtraeme 13299: <code class="prompt">#</code> <strong class=
13300: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 13301: </pre>
13302: </li>
13303:
13304: <li>
13305: <p>Play with it. Make sure everything works.</p>
13306: </li>
13307:
13308: <li>
1.14 xtraeme 13309: <p>Run <span><strong class=
13310: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 13311: "http://www.w3.org/TR/xhtml1/transitional" href=
13312: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 ! wiz 13313: target="_top"><code xmlns="" class=
! 13314: "filename">pkgtools/pkglint</code></a>, and fix the
1.20 ben 13315: problems it reports:</p>
1.1 grant 13316: <pre class="screen">
1.14 xtraeme 13317: <code class="prompt">#</code> <strong class=
13318: "userinput"><code>pkglint</code></strong>
1.1 grant 13319: </pre>
13320: </li>
13321:
13322: <li>
13323: <p>Submit (or commit, if you have cvs access); see
13324: <a href="#submit" title=
1.38 dillo 13325: "Chapter 17. Submitting and Committing">Chapter 17,
1.1 grant 13326: <i>Submitting and Committing</i></a>.</p>
13327: </li>
13328: </ul>
13329: </div>
13330: </div>
13331:
13332: <div class="chapter" lang="en" xml:lang="en">
13333: <div class="titlepage">
13334: <div>
13335: <div>
13336: <h2 class="title"><a name="submit" id=
1.38 dillo 13337: "submit"></a>Chapter 17. Submitting and
1.1 grant 13338: Committing</h2>
13339: </div>
13340: </div>
13341: </div>
13342:
13343: <div class="toc">
13344: <p><b>Table of Contents</b></p>
13345:
13346: <dl>
1.30 wiz 13347: <dt><span class="sect1"><a href=
1.38 dillo 13348: "#submitting-your-package">17.1. Submitting your
1.30 wiz 13349: packages</a></span></dt>
1.1 grant 13350:
1.30 wiz 13351: <dt><span class="sect1"><a href=
1.41 wiz 13352: "#general-notes-for-changes">17.2. General notes when
13353: adding, updating, or removing packages</a></span></dt>
13354:
13355: <dt><span class="sect1"><a href=
13356: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 13357: package into CVS</a></span></dt>
1.1 grant 13358:
1.30 wiz 13359: <dt><span class="sect1"><a href=
1.41 wiz 13360: "#updating-package">17.4. Updating a package to a newer
1.30 wiz 13361: version</a></span></dt>
1.1 grant 13362:
1.41 wiz 13363: <dt><span class="sect1"><a href="#moving-package">17.5.
1.2 hubertf 13364: Moving a package in pkgsrc</a></span></dt>
1.1 grant 13365: </dl>
13366: </div>
13367:
13368: <div class="sect1" lang="en" xml:lang="en">
13369: <div class="titlepage">
13370: <div>
13371: <div>
13372: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13373: "submitting-your-package" id=
1.38 dillo 13374: "submitting-your-package"></a>17.1. Submitting
1.30 wiz 13375: your packages</h2>
1.1 grant 13376: </div>
13377: </div>
13378: </div>
13379:
13380: <p>You have to separate between binary and
13381: “<span class="quote">normal</span>” (source)
13382: packages here:</p>
13383:
13384: <div class="itemizedlist">
13385: <ul type="disc">
13386: <li>
13387: <p>precompiled binary packages</p>
13388:
13389: <p>Our policy is that we accept binaries only from
13390: pkgsrc developers to guarantee that the packages
13391: don't contain any trojan horses etc. This is not to
1.13 hubertf 13392: annoy anyone but rather to protect our users!
1.1 grant 13393: You're still free to put up your home-made binary
1.13 hubertf 13394: packages and tell the world where to get them.
13395: NetBSD developers doing bulk builds and wanting to
13396: upload them please see <a href="#bulk-upload"
1.38 dillo 13397: title="6.3.8. Uploading results of a bulk build">
13398: Section 6.3.8, “Uploading results of a
1.13 hubertf 13399: bulk build”</a>.</p>
1.1 grant 13400: </li>
13401:
13402: <li>
13403: <p>packages</p>
13404:
13405: <p>First, check that your package is complete,
13406: compiles and runs well; see <a href="#debug" title=
1.38 dillo 13407: "Chapter 16. Debugging">Chapter 16,
1.1 grant 13408: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 13409: Next, generate an uuencoded gzipped <a href=
13410: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
13411: <span class="citerefentry"><span class=
13412: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 13413: preferably with all files in a single directory.
1.14 xtraeme 13414: Finally, <span><strong class=
13415: "command">send-pr</strong></span> with category
1.1 grant 13416: “<span class="quote">pkg</span>”, a
13417: synopsis which includes the package name and
13418: version number, a short description of your package
13419: (contents of the COMMENT variable or DESCR file are
13420: OK) and attach the archive to your PR.</p>
13421:
13422: <p>If you want to submit several packages, please
13423: send a separate PR for each one, it's easier for us
13424: to track things that way.</p>
13425:
13426: <p>Alternatively, you can also import new packages
13427: into pkgsrc-wip (“<span class="quote">pkgsrc
13428: work-in-progress</span>”); see the homepage
13429: at <a href="http://pkgsrc-wip.sourceforge.net/"
13430: target=
13431: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
13432: details.</p>
13433: </li>
13434: </ul>
13435: </div>
13436: </div>
13437:
13438: <div class="sect1" lang="en" xml:lang="en">
13439: <div class="titlepage">
13440: <div>
13441: <div>
13442: <h2 class="title" style="clear: both"><a name=
1.41 wiz 13443: "general-notes-for-changes" id=
13444: "general-notes-for-changes"></a>17.2. General
13445: notes when adding, updating, or removing
13446: packages</h2>
13447: </div>
13448: </div>
13449: </div>
13450:
13451: <p>Please note all package additions, updates, moves, and
1.45 ! wiz 13452: removals in <code xmlns=
! 13453: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13454: "filename">pkgsrc/doc/CHANGES</code>. It's very important
13455: to keep this file up to date and conforming to the
13456: existing format, because it will be used by scripts to
13457: automatically update pages on <a href=
13458: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45 ! wiz 13459: and other sites. Additionally, check the <code xmlns=
! 13460: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13461: "filename">pkgsrc/doc/TODO</code> file and remove the
13462: entry for the package you updated or removed, in case it
13463: was mentioned there.</p>
13464:
13465: <p>There is a make target that helps in creating proper
1.45 ! wiz 13466: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 13467: class="filename">CHANGES</code> entries:
1.41 wiz 13468: <span><strong class="command">make
13469: changes-entry</strong></span>. It uses the optional
13470: <code class="varname">CTYPE</code> and <code class=
13471: "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45 ! wiz 13472: usage is to first make sure that your <code xmlns=
! 13473: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13474: "filename">CHANGES</code> file is up-to-date (to avoid
13475: having to resolve conflicts later-on) and then to
13476: <span><strong class="command">cd</strong></span> to the
13477: package directory. For package updates,
13478: <span><strong class="command">make
13479: changes-entry</strong></span> is enough. For new
13480: packages, or package moves or removals, set the
13481: <code class="varname">CTYPE</code> variable on the
13482: command line to "Added", "Moved", or "Removed". You can
13483: set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45 ! wiz 13484: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 13485: class="filename">/etc/mk.conf</code> if your local login
! 13486: name is not the same as your NetBSD login name. Don't
! 13487: forget to commit the changes to <code xmlns=
! 13488: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13489: "filename">pkgsrc/doc/CHANGES</code>!</p>
13490: </div>
13491:
13492: <div class="sect1" lang="en" xml:lang="en">
13493: <div class="titlepage">
13494: <div>
13495: <div>
13496: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13497: "committing-importing" id=
1.41 wiz 13498: "committing-importing"></a>17.3. Committing:
1.30 wiz 13499: Importing a package into CVS</h2>
1.1 grant 13500: </div>
13501: </div>
13502: </div>
13503:
13504: <p>This section is only of interest for pkgsrc developers
13505: with write access to the pkgsrc repository. Please
13506: remember that cvs imports files relative to the current
13507: working directory, and that the pathname that you give
1.14 xtraeme 13508: the <span><strong class="command">cvs
13509: import</strong></span> command is so that it knows where
13510: to place the files in the repository. Newly created
13511: packages should be imported with a vendor tag of
13512: “<span class="quote">TNF</span>” and a
13513: release tag of “<span class=
13514: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 13515: <pre class="programlisting">
13516: % cd .../pkgsrc/category/pkgname
13517: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
13518: </pre>
13519:
13520: <p>Remember to move the directory from which you imported
13521: out of the way, or cvs will complain the next time you
13522: “<span class="quote">cvs update</span>” your
13523: source tree. Also don't forget to add the new package to
1.45 ! wiz 13524: the category's <code xmlns=
! 13525: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13526: "filename">Makefile</code>.</p>
1.1 grant 13527:
13528: <p>The commit message of the initial import should
1.45 ! wiz 13529: include part of the <code xmlns=
! 13530: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13531: "filename">DESCR</code> file, so people reading the
! 13532: mailing lists know what the package is/does.</p>
1.1 grant 13533:
13534: <p>For new packages, “<span class="quote">cvs
13535: import</span>” is preferred to “<span class=
13536: "quote">cvs add</span>” because the former gets
13537: everything with a single command, and provides a
13538: consistent tag.</p>
13539: </div>
13540:
13541: <div class="sect1" lang="en" xml:lang="en">
13542: <div class="titlepage">
13543: <div>
13544: <div>
13545: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13546: "updating-package" id=
1.41 wiz 13547: "updating-package"></a>17.4. Updating a
1.30 wiz 13548: package to a newer version</h2>
1.1 grant 13549: </div>
13550: </div>
13551: </div>
13552:
13553: <p>Please always put a concise, appropriate and relevant
13554: summary of the changes between old and new versions into
13555: the commit log when updating a package. There are various
13556: reasons for this:</p>
13557:
13558: <div class="itemizedlist">
13559: <ul type="disc">
13560: <li>
13561: <p>A URL is volatile, and can change over time. It
13562: may go away completely or its information may be
13563: overwritten by newer information.</p>
13564: </li>
13565:
13566: <li>
13567: <p>Having the change information between old and
13568: new versions in our CVS repository is very useful
13569: for people who use either cvs or anoncvs.</p>
13570: </li>
13571:
13572: <li>
13573: <p>Having the change information between old and
13574: new versions in our CVS repository is very useful
13575: for people who read the pkgsrc-changes mailing
13576: list, so that they can make tactical decisions
13577: about when to upgrade the package.</p>
13578: </li>
13579: </ul>
13580: </div>
13581:
1.18 xtraeme 13582: <p>Please also recognize that, just because a new version
1.1 grant 13583: of a package has been released, it should not
13584: automatically be upgraded in the CVS repository. We
13585: prefer to be conservative in the packages that are
13586: included in pkgsrc - development or beta packages are not
13587: really the best thing for most places in which pkgsrc is
13588: used. Please use your judgement about what should go into
13589: pkgsrc, and bear in mind that stability is to be
13590: preferred above new and possibly untested features.</p>
13591: </div>
13592:
13593: <div class="sect1" lang="en" xml:lang="en">
13594: <div class="titlepage">
13595: <div>
13596: <div>
13597: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13598: "moving-package" id=
1.41 wiz 13599: "moving-package"></a>17.5. Moving a package in
1.30 wiz 13600: pkgsrc</h2>
1.1 grant 13601: </div>
13602: </div>
13603: </div>
13604:
13605: <div class="orderedlist">
13606: <ol type="1">
13607: <li>
13608: <p>Make a copy of the directory somewhere else.</p>
13609: </li>
13610:
13611: <li>
13612: <p>Remove all CVS dirs.</p>
13613:
13614: <p>Alternatively to the first two steps you can
13615: also do:</p>
13616: <pre class="screen">
1.14 xtraeme 13617: <code class="prompt">%</code> <strong class=
13618: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 13619: </pre>
13620:
13621: <p>and use that for further work.</p>
13622: </li>
13623:
13624: <li>
1.14 xtraeme 13625: <p>Fix <code class="varname">CATEGORIES</code> and
13626: any <code class="varname">DEPENDS</code> paths that
13627: just did “<span class=
1.1 grant 13628: "quote">../package</span>” instead of
13629: “<span class=
13630: "quote">../../category/package</span>”.</p>
13631: </li>
13632:
13633: <li>
1.14 xtraeme 13634: <p><span><strong class="command">cvs
13635: import</strong></span> the modified package in the
13636: new place.</p>
1.1 grant 13637: </li>
13638:
13639: <li>
13640: <p>Check if any package depends on it:</p>
13641: <pre class="screen">
1.14 xtraeme 13642: <code class="prompt">%</code> <strong class=
13643: "userinput"><code>cd /usr/pkgsrc</code></strong>
13644: <code class="prompt">%</code> <strong class=
13645: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 13646: </pre>
13647: </li>
13648:
13649: <li>
13650: <p>Fix paths in packages from step 5 to point to
13651: new location.</p>
13652: </li>
13653:
13654: <li>
1.14 xtraeme 13655: <p><span><strong class="command">cvs rm
13656: (-f)</strong></span> the package at the old
13657: location.</p>
1.1 grant 13658: </li>
13659:
13660: <li>
1.45 ! wiz 13661: <p>Remove from <code xmlns=
! 13662: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13663: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 13664: </li>
13665:
13666: <li>
1.45 ! wiz 13667: <p>Add to <code xmlns=
! 13668: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13669: "filename">newcategory/Makefile</code>.</p>
1.1 grant 13670: </li>
13671:
13672: <li>
13673: <p>Commit the changed and removed files:</p>
13674: <pre class="screen">
1.14 xtraeme 13675: <code class="prompt">%</code> <strong class=
13676: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 13677: </pre>
13678:
13679: <p>(and any packages from step 5, of course).</p>
13680: </li>
13681: </ol>
13682: </div>
13683: </div>
13684: </div>
13685: </div>
13686:
13687: <div class="appendix" lang="en" xml:lang="en">
13688: <div class="titlepage">
13689: <div>
13690: <div>
13691: <h2 class="title"><a name="examples" id=
1.45 ! wiz 13692: "examples"></a>Appendix 1. A simple example
1.1 grant 13693: package: bison</h2>
13694: </div>
13695: </div>
13696: </div>
13697:
13698: <div class="toc">
13699: <p><b>Table of Contents</b></p>
13700:
13701: <dl>
1.45 ! wiz 13702: <dt><span class="sect1"><a href="#example-files">1.1.
1.1 grant 13703: files</a></span></dt>
13704:
13705: <dd>
13706: <dl>
1.30 wiz 13707: <dt><span class="sect2"><a href=
1.45 ! wiz 13708: "#example-Makefile">1.1.1. Makefile</a></span></dt>
1.1 grant 13709:
1.30 wiz 13710: <dt><span class="sect2"><a href=
1.45 ! wiz 13711: "#example-descr">1.1.2. DESCR</a></span></dt>
1.1 grant 13712:
1.30 wiz 13713: <dt><span class="sect2"><a href=
1.45 ! wiz 13714: "#example-plist">1.1.3. PLIST</a></span></dt>
1.1 grant 13715:
1.30 wiz 13716: <dt><span class="sect2"><a href=
1.45 ! wiz 13717: "#checking-package-with-pkglint">1.1.4. Checking a
1.30 wiz 13718: package with <span><strong class=
1.14 xtraeme 13719: "command">pkglint</strong></span></a></span></dt>
1.1 grant 13720: </dl>
13721: </dd>
13722:
1.45 ! wiz 13723: <dt><span class="sect1"><a href="#steps-for-b-i-p">1.2.
1.30 wiz 13724: Steps for building, installing, packaging</a></span></dt>
1.1 grant 13725: </dl>
13726: </div>
13727:
13728: <p>We checked to find a piece of software that wasn't in the
13729: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 13730: would want to have <span><strong class=
13731: "command">bison</strong></span> when Berkeley
13732: <span><strong class="command">yacc</strong></span> is already
13733: present in the tree is beyond us, but it's useful for the
13734: purposes of this exercise.</p>
1.1 grant 13735:
13736: <div class="sect1" lang="en" xml:lang="en">
13737: <div class="titlepage">
13738: <div>
13739: <div>
13740: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13741: "example-files" id=
1.45 ! wiz 13742: "example-files"></a>1.1. files</h2>
1.1 grant 13743: </div>
13744: </div>
13745: </div>
13746:
13747: <div class="sect2" lang="en" xml:lang="en">
13748: <div class="titlepage">
13749: <div>
13750: <div>
1.30 wiz 13751: <h3 class="title"><a name="example-Makefile" id=
1.45 ! wiz 13752: "example-Makefile"></a>1.1.1. Makefile</h3>
1.1 grant 13753: </div>
13754: </div>
13755: </div>
13756: <pre class="programlisting">
1.17 sketch 13757: # $NetBSD$
1.1 grant 13758: #
13759:
13760: DISTNAME= bison-1.25
13761: CATEGORIES= devel
13762: MASTER_SITES= ${MASTER_SITE_GNU}
13763:
13764: MAINTAINER= thorpej@NetBSD.org
13765: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
13766: COMMENT= GNU yacc clone
13767:
13768: GNU_CONFIGURE= yes
13769: INFO_FILES= bison.info
13770:
13771: .include "../../mk/bsd.pkg.mk"
13772: </pre>
13773: </div>
13774:
13775: <div class="sect2" lang="en" xml:lang="en">
13776: <div class="titlepage">
13777: <div>
13778: <div>
1.30 wiz 13779: <h3 class="title"><a name="example-descr" id=
1.45 ! wiz 13780: "example-descr"></a>1.1.2. DESCR</h3>
1.1 grant 13781: </div>
13782: </div>
13783: </div>
13784: <pre class="programlisting">
13785: GNU version of yacc. Can make re-entrant parsers, and numerous other
13786: improvements. Why you would want this when Berkeley <a href=
13787: "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
13788: of the NetBSD source tree is beyond me.
13789: </pre>
13790: </div>
13791:
13792: <div class="sect2" lang="en" xml:lang="en">
13793: <div class="titlepage">
13794: <div>
13795: <div>
1.30 wiz 13796: <h3 class="title"><a name="example-plist" id=
1.45 ! wiz 13797: "example-plist"></a>1.1.3. PLIST</h3>
1.1 grant 13798: </div>
13799: </div>
13800: </div>
13801: <pre class="programlisting">
1.17 sketch 13802: @comment $NetBSD$
1.1 grant 13803: bin/bison
13804: man/man1/bison.1.gz
13805: share/bison.simple
13806: share/bison.hairy
13807: </pre>
13808: </div>
13809:
13810: <div class="sect2" lang="en" xml:lang="en">
13811: <div class="titlepage">
13812: <div>
13813: <div>
1.30 wiz 13814: <h3 class="title"><a name=
13815: "checking-package-with-pkglint" id=
1.45 ! wiz 13816: "checking-package-with-pkglint"></a>1.1.4. Checking
1.30 wiz 13817: a package with <span><strong class=
1.14 xtraeme 13818: "command">pkglint</strong></span></h3>
1.1 grant 13819: </div>
13820: </div>
13821: </div>
13822:
13823: <p>The NetBSD package system comes with <a xmlns=
13824: "http://www.w3.org/TR/xhtml1/transitional" href=
13825: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 ! wiz 13826: target="_top"><code xmlns="" class=
! 13827: "filename">pkgtools/pkglint</code></a> which helps to
! 13828: check the contents of these files. After installation it
! 13829: is quite easy to use, just change to the directory of the
1.20 ben 13830: package you wish to examine and execute
13831: <span><strong class=
13832: "command">pkglint</strong></span>:</p>
1.1 grant 13833: <pre class="screen">
1.14 xtraeme 13834: <code class="prompt">$</code> <strong class=
13835: "userinput"><code>pkglint</code></strong>
1.1 grant 13836: looks fine.
13837: </pre>
13838:
13839: <p>Depending on the supplied command line arguments (see
13840: pkglint(1)) more verbose checks will be performed. Use
1.14 xtraeme 13841: e.g. <span><strong class="command">pkglint
13842: -v</strong></span> for a very verbose check.</p>
1.1 grant 13843: </div>
13844: </div>
13845:
13846: <div class="sect1" lang="en" xml:lang="en">
13847: <div class="titlepage">
13848: <div>
13849: <div>
13850: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13851: "steps-for-b-i-p" id=
1.45 ! wiz 13852: "steps-for-b-i-p"></a>1.2. Steps for building,
1.30 wiz 13853: installing, packaging</h2>
1.1 grant 13854: </div>
13855: </div>
13856: </div>
13857:
13858: <p>Create the directory where the package lives, plus any
13859: auxiliary directories:</p>
13860: <pre class="screen">
1.14 xtraeme 13861: <code class="prompt">#</code> <strong class=
13862: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
13863: <code class="prompt">#</code> <strong class=
13864: "userinput"><code>mkdir bison</code></strong>
13865: <code class="prompt">#</code> <strong class=
13866: "userinput"><code>cd bison</code></strong>
13867: <code class="prompt">#</code> <strong class=
13868: "userinput"><code>mkdir patches</code></strong>
1.1 grant 13869: </pre>
13870:
1.45 ! wiz 13871: <p>Create <code xmlns=
! 13872: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13873: "filename">Makefile</code>, <code xmlns=
! 13874: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13875: "filename">DESCR</code> and <code xmlns=
! 13876: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13877: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 13878: "Chapter 8. Package components - files, directories and contents">
13879: Chapter 8, <i>Package components - files, directories and
1.1 grant 13880: contents</i></a>) then continue with fetching the
13881: distfile:</p>
13882: <pre class="screen">
1.14 xtraeme 13883: <code class="prompt">#</code> <strong class=
13884: "userinput"><code>make fetch</code></strong>
1.1 grant 13885: >> bison-1.25.tar.gz doesn't seem to exist on this system.
13886: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
13887: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
13888: ftp: Error retrieving file: 500 Internal error
13889:
13890: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
13891: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
13892: ftp: Error retrieving file: 500 Internal error
13893:
13894: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
13895: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
13896: Successfully retrieved file.
13897: </pre>
13898:
1.45 ! wiz 13899: <p>Generate the checksum of the distfile into <code xmlns=
! 13900: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13901: "filename">distinfo</code>:</p>
1.1 grant 13902: <pre class="screen">
1.14 xtraeme 13903: <code class="prompt">#</code> <strong class=
13904: "userinput"><code>make makesum</code></strong>
1.1 grant 13905: </pre>
13906:
13907: <p>Now compile:</p>
13908: <pre class="screen">
1.14 xtraeme 13909: <code class="prompt">#</code> <strong class=
13910: "userinput"><code>make</code></strong>
1.1 grant 13911: >> Checksum OK for bison-1.25.tar.gz.
13912: ===> Extracting for bison-1.25
13913: ===> Patching for bison-1.25
13914: ===> Ignoring empty patch directory
13915: ===> Configuring for bison-1.25
13916: creating cache ./config.cache
13917: checking for gcc... cc
13918: checking whether we are using GNU C... yes
13919: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
13920: checking how to run the C preprocessor... cc -E
13921: checking for minix/config.h... no
13922: checking for POSIXized ISC... no
13923: checking whether cross-compiling... no
13924: checking for ANSI C header files... yes
13925: checking for string.h... yes
13926: checking for stdlib.h... yes
13927: checking for memory.h... yes
13928: checking for working const... yes
13929: checking for working alloca.h... no
13930: checking for alloca... yes
13931: checking for strerror... yes
13932: updating cache ./config.cache
13933: creating ./config.status
13934: creating Makefile
13935: ===> Building for bison-1.25
13936: 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
13937: 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
13938: 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
13939: 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
13940: 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
13941: 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
13942: 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
13943: 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
13944: 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
13945: 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
13946: 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
13947: 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
13948: 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
13949: 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
13950: 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
13951: 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
13952: 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
13953: 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
13954: 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
13955: 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
13956: 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
13957: 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
13958: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
13959: rm -f bison.s1
13960: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
13961: </pre>
13962:
13963: <p>Everything seems OK, so install the files:</p>
13964: <pre class="screen">
1.14 xtraeme 13965: <code class="prompt">#</code> <strong class=
13966: "userinput"><code>make install</code></strong>
1.1 grant 13967: >> Checksum OK for bison-1.25.tar.gz.
13968: ===> Installing for bison-1.25
13969: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
13970: rm -f /usr/pkg/bin/bison
13971: cd /usr/pkg/share; rm -f bison.simple bison.hairy
13972: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
13973: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
13974: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
13975: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
13976: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
13977: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
13978: ===> Registering installation for bison-1.25
13979: </pre>
13980:
13981: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 13982: remove it with <span><strong class="command">pkg_delete
13983: bison</strong></span>. Should you decide that you want a
13984: binary package, do this now:</p>
1.1 grant 13985: <pre class="screen">
1.14 xtraeme 13986: <code class="prompt">#</code> <strong class=
13987: "userinput"><code>make package</code></strong>
1.1 grant 13988: >> Checksum OK for bison-1.25.tar.gz.
13989: ===> Building package for bison-1.25
13990: Creating package bison-1.25.tgz
13991: Registering depends:.
13992: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
13993: </pre>
13994:
13995: <p>Now that you don't need the source and object files any
13996: more, clean up:</p>
13997: <pre class="screen">
1.14 xtraeme 13998: <code class="prompt">#</code> <strong class=
13999: "userinput"><code>make clean</code></strong>
1.1 grant 14000: ===> Cleaning for bison-1.25
14001: </pre>
14002: </div>
14003: </div>
14004:
14005: <div class="appendix" lang="en" xml:lang="en">
14006: <div class="titlepage">
14007: <div>
14008: <div>
14009: <h2 class="title"><a name="logs" id=
1.45 ! wiz 14010: "logs"></a>Appendix 2. Build logs</h2>
1.1 grant 14011: </div>
14012: </div>
14013: </div>
14014:
14015: <div class="toc">
14016: <p><b>Table of Contents</b></p>
14017:
14018: <dl>
1.45 ! wiz 14019: <dt><span class="sect1"><a href="#logs.building">2.1.
1.1 grant 14020: Building figlet</a></span></dt>
14021:
1.45 ! wiz 14022: <dt><span class="sect1"><a href="#logs.package">2.2.
1.1 grant 14023: Packaging figlet</a></span></dt>
14024: </dl>
14025: </div>
14026:
14027: <div class="sect1" lang="en" xml:lang="en">
14028: <div class="titlepage">
14029: <div>
14030: <div>
14031: <h2 class="title" style="clear: both"><a name=
14032: "logs.building" id=
1.45 ! wiz 14033: "logs.building"></a>2.1. Building figlet</h2>
1.1 grant 14034: </div>
14035: </div>
14036: </div>
14037: <pre class="screen">
1.14 xtraeme 14038: <code class="prompt">#</code> <strong class=
14039: "userinput"><code>make</code></strong>
1.1 grant 14040: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14041: => figlet221.tar.gz doesn't seem to exist on this system.
14042: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
14043: => [172219 bytes]
14044: Connected to ftp.plig.net.
14045: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
14046: 331 Guest login ok, send your complete e-mail address as password.
14047: 230-You are user #5 of 500 simultaneous users allowed.
14048: 230-
14049: 230- ___ _ _ _
14050: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
14051: 230- | _| _| . |_| . | | | . |_| . | _| . |
14052: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
14053: 230- |_| |_| |___| |___|
14054: 230-
14055: 230-** Welcome to ftp.plig.org **
14056: 230-
14057: 230-Please note that all transfers from this FTP site are logged. If you
14058: 230-do not like this, please disconnect now.
14059: 230-
14060: 230-This arhive is available via
14061: 230-
14062: 230-HTTP: http://ftp.plig.org/
14063: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
14064: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
14065: 230-
14066: 230-Please email comments, bug reports and requests for packages to be
14067: 230-mirrored to ftp-admin@plig.org.
14068: 230-
14069: 230-
14070: 230 Logged in anonymously.
14071: Remote system type is UNIX.
14072: Using binary mode to transfer files.
14073: 200 Type okay.
14074: 250 "/pub" is new cwd.
14075: 250-"/pub/figlet" is new cwd.
14076: 250-
14077: 250-Welcome to the figlet archive at ftp.figlet.org
14078: 250-
14079: 250- ftp://ftp.figlet.org/pub/figlet/
14080: 250-
14081: 250-The official FIGlet web page is:
14082: 250- http://www.figlet.org/
14083: 250-
14084: 250-If you have questions, please mailto:info@figlet.org. If you want to
14085: 250-contribute a font or something else, you can email us.
14086: 250
14087: 250 "/pub/figlet/program" is new cwd.
14088: 250 "/pub/figlet/program/unix" is new cwd.
14089: local: figlet221.tar.gz remote: figlet221.tar.gz
14090: 502 Unimplemented command.
14091: 227 Entering Passive Mode (195,40,6,41,246,104)
14092: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
14093: 38% |************** | 65800 64.16 KB/s 00:01 ETA
14094: 226 Transfer completed.
14095: 172219 bytes received in 00:02 (75.99 KB/s)
14096: 221 Goodbye.
14097: => Checksum OK for figlet221.tar.gz.
14098: ===> Extracting for figlet-2.2.1nb2
14099: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
14100: ===> Patching for figlet-2.2.1nb2
14101: ===> Applying pkgsrc patches for figlet-2.2.1nb2
14102: ===> Overriding tools for figlet-2.2.1nb2
14103: ===> Creating toolchain wrappers for figlet-2.2.1nb2
14104: ===> Configuring for figlet-2.2.1nb2
14105: ===> Building for figlet-2.2.1nb2
14106: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
14107: chmod a+x figlet
14108: gcc -O2 -o chkfont chkfont.c
14109: => Unwrapping files-to-be-installed.
1.14 xtraeme 14110: <code class="prompt">#</code>
14111: <code class="prompt">#</code> <strong class=
14112: "userinput"><code>make install</code></strong>
1.1 grant 14113: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14114: ===> Installing for figlet-2.2.1nb2
14115: install -d -o root -g wheel -m 755 /usr/pkg/bin
14116: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
14117: mkdir -p /usr/pkg/share/figlet
14118: cp figlet /usr/pkg/bin
14119: cp chkfont /usr/pkg/bin
14120: chmod 555 figlist showfigfonts
14121: cp figlist /usr/pkg/bin
14122: cp showfigfonts /usr/pkg/bin
14123: cp fonts/*.flf /usr/pkg/share/figlet
14124: cp fonts/*.flc /usr/pkg/share/figlet
14125: cp figlet.6 /usr/pkg/man/man6
14126: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 14127: <code class="prompt">#</code>
1.1 grant 14128: </pre>
14129: </div>
14130:
14131: <div class="sect1" lang="en" xml:lang="en">
14132: <div class="titlepage">
14133: <div>
14134: <div>
14135: <h2 class="title" style="clear: both"><a name=
14136: "logs.package" id=
1.45 ! wiz 14137: "logs.package"></a>2.2. Packaging figlet</h2>
1.1 grant 14138: </div>
14139: </div>
14140: </div>
14141: <pre class="screen">
1.14 xtraeme 14142: <code class="prompt">#</code> <strong class=
14143: "userinput"><code>make package</code></strong>
1.1 grant 14144: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14145: ===> Packaging figlet-2.2.1nb2
14146: ===> Building binary package for figlet-2.2.1nb2
14147: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
14148: Using SrcDir value of /usr/pkg
14149: Registering depends:.
1.14 xtraeme 14150: <code class="prompt">#</code>
1.1 grant 14151: </pre>
14152: </div>
14153: </div>
14154:
14155: <div class="appendix" lang="en" xml:lang="en">
14156: <div class="titlepage">
14157: <div>
14158: <div>
14159: <h2 class="title"><a name="ftp-layout" id=
1.45 ! wiz 14160: "ftp-layout"></a>Appendix 3. Layout of the
1.1 grant 14161: FTP server's package archive</h2>
14162: </div>
14163: </div>
14164: </div>
14165:
14166: <p>Layout for precompiled binary packages on
14167: ftp.NetBSD.org:</p>
14168: <pre class="programlisting">
14169: /pub/NetBSD/packages/
14170: distfiles/
14171:
14172: # Unpacked pkgsrc trees
14173: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
14174: pkgsrc-2003Q4 -> N/A
14175: pkgsrc-2004Q1/pkgsrc
14176:
14177: # pkgsrc archives
14178: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
14179: pkgsrc-2003Q4.tar.gz -> N/A
14180: pkgsrc-2004Q1.tar.gz -> N/A
14181:
14182: # Per pkgsrc-release/OS-release/arch package archives
14183: pkgsrc-2003Q4/
14184: NetBSD-1.6.2/
14185: i386/
14186: All/
14187: archivers/
14188: foo -> ../All/foo
14189: ...
14190: pkgsrc-2004Q1/
14191: NetBSD-1.6.2/
14192: i386/
14193: All/
14194: ...
14195: NetBSD-2.0/
14196: i386/
14197: All/
14198: ...
14199: SunOS-5.9/
14200: sparc/
14201: All/
14202: ...
14203: x86/
14204: All/
14205: ...
14206:
14207: # Per os-release package archive convenience links
14208: NetBSD-1.6.2 -> 1.6.2
14209: 1.6.2/
14210: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
14211: m68k/
14212: All/
14213: archivers/
14214: foo -> ../All/foo
14215: ...
14216: amiga -> m68k
14217: atari -> m68k
14218: ...
14219:
14220: 2.0 -> NetBSD-2.0 # backward compat, historic
14221: NetBSD-2.0/
14222: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
14223: SunOS-5.9/
14224: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
14225: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
14226:
14227: </pre>
14228:
14229: <p>To create:</p>
14230:
14231: <div class="orderedlist">
14232: <ol type="1">
14233: <li>
14234: <p>Run bulk build, see <a href="#bulkbuild" title=
1.38 dillo 14235: "6.3. Doing a bulk build of all packages">Section
14236: 6.3, “Doing a bulk build of all
1.1 grant 14237: packages”</a></p>
14238: </li>
14239:
14240: <li>
14241: <p>Upload /usr/pkgsrc/packages to</p>
14242: <pre class="programlisting">
14243: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13 hubertf 14244: pkgsrc-2004Q4/\ # pkgsrc-branch
1.1 grant 14245: `uname -s`-`uname -r`/ # OS & version
14246: `uname -p` # architecture
14247:
14248: </pre>
14249: </li>
14250:
14251: <li>
1.14 xtraeme 14252: <p>If necessary, create a symlink <span><strong class=
14253: "command">ln -s `uname -m` `uname -p`</strong></span>
14254: (amiga -> m68k, ...)</p>
1.1 grant 14255: </li>
14256: </ol>
14257: </div>
14258: </div>
1.2 hubertf 14259:
14260: <div class="appendix" lang="en" xml:lang="en">
14261: <div class="titlepage">
14262: <div>
14263: <div>
14264: <h2 class="title"><a name="editing" id=
1.45 ! wiz 14265: "editing"></a>Appendix 4. Editing guidelines
1.2 hubertf 14266: for the pkgsrc guide</h2>
14267: </div>
14268: </div>
14269: </div>
14270:
14271: <div class="toc">
14272: <p><b>Table of Contents</b></p>
14273:
14274: <dl>
1.45 ! wiz 14275: <dt><span class="sect1"><a href="#targets">4.1.
1.2 hubertf 14276: Targets</a></span></dt>
14277:
1.45 ! wiz 14278: <dt><span class="sect1"><a href="#procedure">4.2.
1.2 hubertf 14279: Procedure</a></span></dt>
14280: </dl>
14281: </div>
14282:
14283: <p>This section contains information on editing the pkgsrc
14284: guide itself.</p>
14285:
14286: <div class="sect1" lang="en" xml:lang="en">
14287: <div class="titlepage">
14288: <div>
14289: <div>
14290: <h2 class="title" style="clear: both"><a name=
1.45 ! wiz 14291: "targets" id="targets"></a>4.1. Targets</h2>
1.2 hubertf 14292: </div>
14293: </div>
14294: </div>
14295:
1.45 ! wiz 14296: <p>The pkgsrc guide's source code is stored in <code xmlns=
! 14297: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14298: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 14299: are created from it:</p>
14300:
14301: <div class="itemizedlist">
14302: <ul type="disc">
14303: <li>
1.45 ! wiz 14304: <p><code xmlns=
! 14305: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 14306: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 14307: </li>
14308:
14309: <li>
1.45 ! wiz 14310: <p><code xmlns=
! 14311: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14312: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 14313: </li>
14314:
14315: <li>
1.45 ! wiz 14316: <p><code xmlns=
! 14317: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14318: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 14319: the documentation on the NetBSD website will be built
14320: from pkgsrc and kept up to date on the web server
14321: itself. This means you <span class=
14322: "emphasis"><em>must</em></span> make sure that your
14323: changes haven't broken the build!</p>
14324: </li>
1.6 hubertf 14325:
14326: <li>
1.45 ! wiz 14327: <p><code xmlns=
! 14328: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14329: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 14330: PDF version of the pkgsrc guide.</p>
14331: </li>
14332:
14333: <li>
1.45 ! wiz 14334: <p><code xmlns=
! 14335: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14336: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 14337: PostScript version of the pkgsrc guide.</p>
14338: </li>
1.2 hubertf 14339: </ul>
14340: </div>
14341: </div>
14342:
14343: <div class="sect1" lang="en" xml:lang="en">
14344: <div class="titlepage">
14345: <div>
14346: <div>
14347: <h2 class="title" style="clear: both"><a name=
1.30 wiz 14348: "procedure" id=
1.45 ! wiz 14349: "procedure"></a>4.2. Procedure</h2>
1.2 hubertf 14350: </div>
14351: </div>
14352: </div>
14353:
14354: <p>The procedure to edit the pkgsrc guide is:</p>
14355:
14356: <div class="itemizedlist">
14357: <ul type="disc">
14358: <li>
1.6 hubertf 14359: <p>Make sure you have the packages needed to
14360: re-generate the pkgsrc guide (and other XML-based
14361: NetBSD documentation) installed. These are
1.11 ben 14362: “<span class="quote">netbsd-doc</span>”
1.6 hubertf 14363: for creating the ASCII- and HTML-version, and
14364: “<span class=
1.11 ben 14365: "quote">netbsd-doc-print</span>”for the
1.6 hubertf 14366: PostScript- and PDF version. You will need both
14367: packages installed, to make sure documentation is
14368: consistent across all formats. The packages can be
1.45 ! wiz 14369: found in <code xmlns=
! 14370: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14371: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45 ! wiz 14372: <code xmlns=
! 14373: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14374: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 14375: </li>
14376:
14377: <li>
1.45 ! wiz 14378: <p>Edit the XML file(s) in <code xmlns=
! 14379: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14380: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 14381: </li>
14382:
14383: <li>
1.14 xtraeme 14384: <p>Run <span><strong class="command">make extract
14385: && make do-lint</strong></span> in
1.45 ! wiz 14386: <code xmlns=
! 14387: "http://www.w3.org/TR/xhtml1/transitional" class=
! 14388: "filename">pkgsrc/doc/guide</code> to check the XML
! 14389: syntax, and fix it if needed.</p>
1.4 hubertf 14390: </li>
14391:
14392: <li>
1.14 xtraeme 14393: <p>Run <span><strong class=
1.45 ! wiz 14394: "command">make</strong></span> in <code xmlns=
! 14395: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14396: "filename">pkgsrc/doc/guide</code> to build the HTML
14397: and ASCII version.</p>
1.2 hubertf 14398: </li>
14399:
14400: <li>
1.14 xtraeme 14401: <p>If all is well, run <span><strong class=
14402: "command">make install-doc</strong></span> to put the
1.45 ! wiz 14403: generated files into <code xmlns=
! 14404: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14405: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 14406: </li>
14407:
14408: <li>
1.14 xtraeme 14409: <p><span><strong class="command">cvs commit
14410: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 14411: </li>
14412:
14413: <li>
1.14 xtraeme 14414: <p><span><strong class="command">cvs commit -m
14415: re-generate
14416: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 14417: </li>
1.4 hubertf 14418:
14419: <li>
14420: <p>Until the webserver on www.NetBSD.org is really
14421: updated automatically to pick up changes to the
1.14 xtraeme 14422: pkgsrc guide automatically, also run
1.18 xtraeme 14423: <span><strong class="command">make install-htdocs
1.14 xtraeme 14424: HTDOCSDIR=../../../htdocs</strong></span> (or
14425: similar, adjust <code class=
14426: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 14427: </li>
14428:
14429: <li>
1.14 xtraeme 14430: <p><span><strong class="command">cvs commit
14431: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 14432: </li>
1.2 hubertf 14433: </ul>
14434: </div>
14435: </div>
14436: </div>
1.1 grant 14437: </div>
14438: </body>
14439: </html>
CVSweb <webmaster@jp.NetBSD.org>