Annotation of pkgsrc/doc/pkgsrc.html, revision 1.57
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.57 ! minskim 4: "HTML Tidy for NetBSD (vers 1 September 2005), see www.w3.org" />
1.1 grant 5: <meta http-equiv="Content-Type" content=
6: "text/html; charset=us-ascii" />
7:
8: <title>The pkgsrc guide</title>
9: <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
10: <meta name="generator" content=
1.23 wiz 11: "DocBook XSL Stylesheets VX.X.X" />
1.1 grant 12: <meta name="description" content=
13: "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
14: </head>
15:
16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
17: alink="#0000FF">
1.57 ! minskim 18: <div class="book" lang="en">
1.1 grant 19: <div class="titlepage">
20: <div>
21: <div>
1.57 ! minskim 22: <h1 class="title"><a name="the-pkgsrc-guide"></a>The
! 23: pkgsrc guide</h1>
1.1 grant 24: </div>
25:
26: <div>
1.2 hubertf 27: <h2 class="subtitle">Documentation on the NetBSD packages
1.1 grant 28: system</h2>
29: </div>
30:
31: <div>
32: <div class="authorgroup">
33: <div class="author">
34: <h3 class="author"><span class=
35: "firstname">Alistair</span> <span class=
36: "surname">Crooks</span></h3>
37:
38: <div class="affiliation">
39: <div class="address">
1.14 xtraeme 40: <p><code class="email"><<a href=
41: "mailto:agc@NetBSD.org">agc@NetBSD.org</a>></code></p>
1.1 grant 42: </div>
43: </div>
44: </div>
45:
46: <div class="author">
47: <h3 class="author"><span class=
48: "firstname">Hubert</span> <span class=
49: "surname">Feyrer</span></h3>
50:
51: <div class="affiliation">
52: <div class="address">
1.14 xtraeme 53: <p><code class="email"><<a href=
54: "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>></code></p>
1.1 grant 55: </div>
56: </div>
57: </div>
1.2 hubertf 58:
1.3 hubertf 59: <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1 grant 60: </div>
61: </div>
62:
63: <div>
1.48 dillo 64: <p class="copyright">Copyright © 1994-2005 The
1.1 grant 65: NetBSD Foundation, Inc</p>
66: </div>
67:
1.23 wiz 68: <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.48 dillo 69: <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.10
70: 2005/10/05 13:59:56 dillo Exp $</p>
1.1 grant 71: </div>
72:
73: <div>
74: <div class="abstract">
75: <p class="title"><b>Abstract</b></p>
76:
77: <p>Information about using the NetBSD package system
78: (pkgsrc) from both a user view for installing packages
79: as well as from a pkgsrc developers' view for creating
80: new packages.</p>
81: </div>
82: </div>
83: </div>
84: <hr />
85: </div>
86:
87: <div class="toc">
88: <p><b>Table of Contents</b></p>
89:
90: <dl>
1.51 rillig 91: <dt><span class="chapter"><a href="#introduction">1. What
92: is pkgsrc?</a></span></dt>
1.1 grant 93:
94: <dd>
95: <dl>
1.30 wiz 96: <dt><span class="sect1"><a href=
97: "#introduction-section">1.1.
1.1 grant 98: Introduction</a></span></dt>
99:
100: <dt><span class="sect1"><a href="#overview">1.2.
101: Overview</a></span></dt>
102:
103: <dt><span class="sect1"><a href="#terminology">1.3.
104: Terminology</a></span></dt>
105:
106: <dt><span class="sect1"><a href="#typography">1.4.
107: Typography</a></span></dt>
108: </dl>
109: </dd>
110:
1.46 gdt 111: <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1 grant 112: user's guide</a></span></dt>
113:
114: <dd>
115: <dl>
116: <dt><span class="chapter"><a href="#getting">2. Where
117: to get pkgsrc</a></span></dt>
118:
119: <dd>
120: <dl>
1.30 wiz 121: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1 grant 122: As tar file</a></span></dt>
123:
1.30 wiz 124: <dt><span class="sect1"><a href="#via-sup">2.2. Via
125: SUP</a></span></dt>
1.1 grant 126:
1.30 wiz 127: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
128: CVS</a></span></dt>
1.1 grant 129: </dl>
130: </dd>
131:
132: <dt><span class="chapter"><a href="#platforms">3. Using
133: pkgsrc on systems other than NetBSD</a></span></dt>
134:
135: <dd>
136: <dl>
1.30 wiz 137: <dt><span class="sect1"><a href=
138: "#bootstrapping-pkgsrc">3.1. Bootstrapping
139: pkgsrc</a></span></dt>
1.1 grant 140:
1.30 wiz 141: <dt><span class="sect1"><a href=
1.47 reed 142: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 143: notes</a></span></dt>
1.1 grant 144:
145: <dd>
146: <dl>
147: <dt><span class="sect2"><a href=
1.30 wiz 148: "#darwin">3.2.1. Darwin (Mac OS
1.1 grant 149: X)</a></span></dt>
150:
151: <dt><span class="sect2"><a href=
1.30 wiz 152: "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1 grant 153:
154: <dt><span class="sect2"><a href=
1.30 wiz 155: "#interix">3.2.3. Interix</a></span></dt>
1.1 grant 156:
1.30 wiz 157: <dt><span class="sect2"><a href="#irix">3.2.4.
158: IRIX</a></span></dt>
1.1 grant 159:
1.30 wiz 160: <dt><span class="sect2"><a href="#linux">3.2.5.
161: Linux</a></span></dt>
1.1 grant 162:
163: <dt><span class="sect2"><a href=
1.30 wiz 164: "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22 tv 165:
166: <dt><span class="sect2"><a href=
1.30 wiz 167: "#solaris">3.2.7. Solaris</a></span></dt>
1.1 grant 168: </dl>
169: </dd>
170: </dl>
171: </dd>
172:
173: <dt><span class="chapter"><a href="#using">4. Using
174: pkgsrc</a></span></dt>
175:
176: <dd>
177: <dl>
178: <dt><span class="sect1"><a href=
179: "#getting-started">4.1. Working with binary
180: packages</a></span></dt>
181:
182: <dd>
183: <dl>
184: <dt><span class="sect2"><a href=
1.30 wiz 185: "#where-to-get-binary-packages">4.1.1. Where to
186: get binary packages</a></span></dt>
1.1 grant 187:
188: <dt><span class="sect2"><a href=
1.30 wiz 189: "#how-to-use-binary-packages">4.1.2. How to use
190: binary packages</a></span></dt>
1.1 grant 191:
192: <dt><span class="sect2"><a href=
1.30 wiz 193: "#a-word-of-warning">4.1.3. A word of
1.1 grant 194: warning</a></span></dt>
195: </dl>
196: </dd>
197:
1.30 wiz 198: <dt><span class="sect1"><a href=
199: "#building-packages-from-source">4.2. Building
200: packages from source</a></span></dt>
1.1 grant 201:
202: <dd>
203: <dl>
204: <dt><span class="sect2"><a href=
1.30 wiz 205: "#requirements">4.2.1.
1.1 grant 206: Requirements</a></span></dt>
207:
208: <dt><span class="sect2"><a href=
1.30 wiz 209: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 210: distfiles</a></span></dt>
211:
212: <dt><span class="sect2"><a href=
1.30 wiz 213: "#how-to-build-and-install">4.2.3. How to build
214: and install</a></span></dt>
1.1 grant 215:
216: <dt><span class="sect2"><a href=
1.30 wiz 217: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 218: compiler</a></span></dt>
219: </dl>
220: </dd>
221: </dl>
222: </dd>
223:
1.38 dillo 224: <dt><span class="chapter"><a href="#configuring">5.
225: Configuring pkgsrc</a></span></dt>
226:
227: <dd>
228: <dl>
229: <dt><span class="sect1"><a href=
1.45 wiz 230: "#general-configuration">5.1. General
231: configuration</a></span></dt>
232:
233: <dt><span class="sect1"><a href=
234: "#variables-affecting-build">5.2. Variables
235: affecting the build process</a></span></dt>
236:
237: <dt><span class="sect1"><a href=
238: "#developer-advanced-settings">5.3.
239: Developer/advanced settings</a></span></dt>
240:
241: <dt><span class="sect1"><a href=
242: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 243: Options</a></span></dt>
1.38 dillo 244: </dl>
245: </dd>
246:
247: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 248: binary packages</a></span></dt>
249:
250: <dd>
251: <dl>
1.30 wiz 252: <dt><span class="sect1"><a href=
1.38 dillo 253: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 254: single binary package</a></span></dt>
1.1 grant 255:
1.30 wiz 256: <dt><span class="sect1"><a href=
1.38 dillo 257: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 258: Settings for creation of binary
259: packages</a></span></dt>
260:
1.38 dillo 261: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 262: Doing a bulk build of all packages</a></span></dt>
263:
264: <dd>
265: <dl>
266: <dt><span class="sect2"><a href=
1.38 dillo 267: "#binary.configuration">6.3.1.
1.1 grant 268: Configuration</a></span></dt>
269:
270: <dt><span class="sect2"><a href=
1.38 dillo 271: "#other-environmental-considerations">6.3.2.
1.30 wiz 272: Other environmental
1.1 grant 273: considerations</a></span></dt>
274:
275: <dt><span class="sect2"><a href=
1.38 dillo 276: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 277:
278: <dt><span class="sect2"><a href=
1.38 dillo 279: "#what-it-does">6.3.4. What it
1.1 grant 280: does</a></span></dt>
281:
282: <dt><span class="sect2"><a href=
1.38 dillo 283: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 284: requirements</a></span></dt>
285:
286: <dt><span class="sect2"><a href=
1.38 dillo 287: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 288: sandbox for chrooted builds</a></span></dt>
1.1 grant 289:
290: <dt><span class="sect2"><a href=
1.38 dillo 291: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 292: partial set of packages</a></span></dt>
1.13 hubertf 293:
294: <dt><span class="sect2"><a href=
1.38 dillo 295: "#bulk-upload">6.3.8. Uploading results of a
1.13 hubertf 296: bulk build</a></span></dt>
1.1 grant 297: </dl>
298: </dd>
299:
1.30 wiz 300: <dt><span class="sect1"><a href=
1.38 dillo 301: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 302: packages collection</a></span></dt>
1.1 grant 303:
304: <dd>
305: <dl>
306: <dt><span class="sect2"><a href=
1.38 dillo 307: "#cdpack-example">6.4.1. Example of
1.1 grant 308: cdpack</a></span></dt>
309: </dl>
310: </dd>
311: </dl>
312: </dd>
313:
1.38 dillo 314: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 315: Asked Questions</a></span></dt>
316:
317: <dd>
318: <dl>
1.30 wiz 319: <dt><span class="sect1"><a href=
1.38 dillo 320: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 321: lists for pkg-related discussion?</a></span></dt>
1.1 grant 322:
1.30 wiz 323: <dt><span class="sect1"><a href=
1.38 dillo 324: "#pkgviews-docs">7.2. Where's the pkgviews
1.30 wiz 325: documentation?</a></span></dt>
1.1 grant 326:
1.5 hubertf 327: <dt><span class="sect1"><a href=
1.38 dillo 328: "#faq-pkgtools">7.3. Utilities for package
1.5 hubertf 329: management (pkgtools)</a></span></dt>
1.1 grant 330:
1.30 wiz 331: <dt><span class="sect1"><a href=
1.38 dillo 332: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 333: non-root</a></span></dt>
334:
335: <dt><span class="sect1"><a href=
1.38 dillo 336: "#resume-transfers">7.5. How to resume transfers
1.30 wiz 337: when fetching distfiles?</a></span></dt>
338:
339: <dt><span class="sect1"><a href=
1.38 dillo 340: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 341: XFree86 from pkgsrc?</a></span></dt>
342:
343: <dt><span class="sect1"><a href=
1.38 dillo 344: "#x.org-from-pkgsrc">7.7. How can I install/use
1.30 wiz 345: X.org from pkgsrc?</a></span></dt>
1.1 grant 346:
1.30 wiz 347: <dt><span class="sect1"><a href=
1.38 dillo 348: "#fetch-behind-firewall">7.8. How to fetch files
1.30 wiz 349: from behind a firewall</a></span></dt>
1.1 grant 350:
1.38 dillo 351: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.14 xtraeme 352: How do I tell <span><strong class="command">make
353: fetch</strong></span> to do passive
1.1 grant 354: FTP?</a></span></dt>
355:
1.30 wiz 356: <dt><span class="sect1"><a href=
1.38 dillo 357: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 358: distfiles at once</a></span></dt>
1.1 grant 359:
1.30 wiz 360: <dt><span class="sect1"><a href=
1.38 dillo 361: "#tmac.andoc-missing">7.11. What does
1.30 wiz 362: “<span class="quote">Don't know how to make
363: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 364: mean?</a></span></dt>
1.13 hubertf 365:
1.30 wiz 366: <dt><span class="sect1"><a href=
1.38 dillo 367: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 368: “<span class="quote">Could not find
1.14 xtraeme 369: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 370:
1.30 wiz 371: <dt><span class="sect1"><a href=
1.38 dillo 372: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 373: pkgsrc</a></span></dt>
1.1 grant 374:
1.38 dillo 375: <dt><span class="sect1"><a href="#faq.conf">7.14.
1.35 jmmv 376: How do I change the location of configuration
377: files?</a></span></dt>
1.1 grant 378:
379: <dt><span class="sect1"><a href=
1.38 dillo 380: "#audit-packages">7.15. Automated security
1.1 grant 381: checks</a></span></dt>
382: </dl>
383: </dd>
384: </dl>
385: </dd>
386:
1.46 gdt 387: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 388: pkgsrc developer's guide</a></span></dt>
389:
390: <dd>
391: <dl>
1.38 dillo 392: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 393: Package components - files, directories and
394: contents</a></span></dt>
395:
396: <dd>
397: <dl>
398: <dt><span class="sect1"><a href=
1.45 wiz 399: "#components.Makefile">8.1. <code xmlns=
400: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 401: "filename">Makefile</code></a></span></dt>
402:
403: <dt><span class="sect1"><a href=
1.45 wiz 404: "#components.distinfo">8.2. <code xmlns=
405: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 406: "filename">distinfo</code></a></span></dt>
407:
408: <dt><span class="sect1"><a href=
1.38 dillo 409: "#components.patches">8.3.
1.27 rillig 410: patches/*</a></span></dt>
411:
1.30 wiz 412: <dt><span class="sect1"><a href=
1.38 dillo 413: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 414: files</a></span></dt>
1.27 rillig 415:
416: <dt><span class="sect1"><a href=
1.38 dillo 417: "#components.optional">8.5. Optional
1.27 rillig 418: files</a></span></dt>
419:
1.38 dillo 420: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 421: <code xmlns=
422: "http://www.w3.org/TR/xhtml1/transitional" class=
423: "filename">work*</code></a></span></dt>
1.27 rillig 424:
1.38 dillo 425: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 426: <code xmlns=
427: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 428: "filename">files/*</code></a></span></dt>
429: </dl>
430: </dd>
431:
1.38 dillo 432: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 433: Programming in <code xmlns=
434: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 435: "filename">Makefile</code>s</a></span></dt>
436:
437: <dd>
438: <dl>
439: <dt><span class="sect1"><a href=
1.45 wiz 440: "#makefile.variables">9.1. <code xmlns=
441: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 442: "filename">Makefile</code>
443: variables</a></span></dt>
444:
1.27 rillig 445: <dd>
446: <dl>
447: <dt><span class="sect2"><a href=
1.38 dillo 448: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 449: conventions</a></span></dt>
450: </dl>
451: </dd>
452:
1.25 rillig 453: <dt><span class="sect1"><a href=
1.38 dillo 454: "#makefile.code">9.2. Code snippets</a></span></dt>
1.25 rillig 455:
456: <dd>
457: <dl>
458: <dt><span class="sect2"><a href=
1.38 dillo 459: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 460: list</a></span></dt>
461:
462: <dt><span class="sect2"><a href=
1.38 dillo 463: "#converting-internal-to-external">9.2.2.
1.30 wiz 464: Converting an internal list into an external
465: list</a></span></dt>
1.25 rillig 466:
467: <dt><span class="sect2"><a href=
1.38 dillo 468: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 469: variables to a shell command</a></span></dt>
1.27 rillig 470:
471: <dt><span class="sect2"><a href=
1.38 dillo 472: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 473: guideline</a></span></dt>
474:
475: <dt><span class="sect2"><a href=
1.38 dillo 476: "#bsd-make-bug-workaround">9.2.5. Workaround
1.30 wiz 477: for a bug in BSD Make</a></span></dt>
1.25 rillig 478: </dl>
479: </dd>
480: </dl>
481: </dd>
482:
1.38 dillo 483: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 484: issues</a></span></dt>
485:
486: <dd>
487: <dl>
1.38 dillo 488: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.30 wiz 489: ID</a></span></dt>
1.1 grant 490:
1.30 wiz 491: <dt><span class="sect1"><a href=
1.38 dillo 492: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 493: <code xmlns=
494: "http://www.w3.org/TR/xhtml1/transitional" class=
495: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 496:
1.38 dillo 497: <dt><span class="sect1"><a href=
498: "#print-PLIST">10.3. Tweaking output of
499: <span><strong class="command">make
1.14 xtraeme 500: print-PLIST</strong></span></a></span></dt>
1.1 grant 501:
1.38 dillo 502: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 503: Variable substitution in PLIST</a></span></dt>
504:
1.30 wiz 505: <dt><span class="sect1"><a href=
1.48 dillo 506: "#manpage-compression">10.5. Man page
507: compression</a></span></dt>
1.1 grant 508:
1.30 wiz 509: <dt><span class="sect1"><a href=
1.38 dillo 510: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 511: <code class=
1.14 xtraeme 512: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 513:
1.30 wiz 514: <dt><span class="sect1"><a href=
1.47 reed 515: "#platform-specific-plist">10.7. Platform-specific
1.30 wiz 516: and differing PLISTs</a></span></dt>
1.1 grant 517:
518: <dt><span class="sect1"><a href=
1.38 dillo 519: "#faq.common-dirs">10.8. Sharing directories
520: between packages</a></span></dt>
1.1 grant 521: </dl>
522: </dd>
523:
1.38 dillo 524: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 525: Buildlink methodology</a></span></dt>
526:
527: <dd>
528: <dl>
1.30 wiz 529: <dt><span class="sect1"><a href=
1.38 dillo 530: "#converting-to-buildlink3">11.1. Converting
1.30 wiz 531: packages to use buildlink3</a></span></dt>
1.1 grant 532:
1.30 wiz 533: <dt><span class="sect1"><a href=
1.38 dillo 534: "#creating-buildlink3.mk">11.2. Writing
1.45 wiz 535: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
536: class="filename">buildlink3.mk</code>
1.14 xtraeme 537: files</a></span></dt>
1.1 grant 538:
539: <dd>
540: <dl>
541: <dt><span class="sect2"><a href=
1.38 dillo 542: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 543: buildlink3.mk file</a></span></dt>
1.1 grant 544:
545: <dt><span class="sect2"><a href=
1.38 dillo 546: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 547: <code class=
1.14 xtraeme 548: "varname">BUILDLINK_DEPENDS.<em class=
549: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 550: <code xmlns=
551: "http://www.w3.org/TR/xhtml1/transitional"
552: class="filename">buildlink3.mk</code>
1.1 grant 553: files</a></span></dt>
554: </dl>
555: </dd>
556:
1.30 wiz 557: <dt><span class="sect1"><a href=
1.45 wiz 558: "#writing-builtin.mk">11.3. Writing <code xmlns=
559: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 560: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 561:
562: <dd>
563: <dl>
564: <dt><span class="sect2"><a href=
1.38 dillo 565: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 566: <code xmlns=
567: "http://www.w3.org/TR/xhtml1/transitional"
568: class="filename">builtin.mk</code>
1.1 grant 569: file</a></span></dt>
570:
571: <dt><span class="sect2"><a href=
1.38 dillo 572: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 573: preferences for native or pkgsrc
574: software</a></span></dt>
1.1 grant 575: </dl>
576: </dd>
577: </dl>
578: </dd>
579:
1.38 dillo 580: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 581: pkginstall framework</a></span></dt>
582:
583: <dd>
584: <dl>
585: <dt><span class="sect1"><a href=
1.38 dillo 586: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 587: directories outside the installation
588: prefix</a></span></dt>
589:
590: <dd>
591: <dl>
592: <dt><span class="sect2"><a href=
1.38 dillo 593: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 594: manipulation</a></span></dt>
595:
596: <dt><span class="sect2"><a href=
1.38 dillo 597: "#files-outside-prefix">12.1.2. File
1.35 jmmv 598: manipulation</a></span></dt>
599: </dl>
600: </dd>
601:
1.38 dillo 602: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 603: Configuration files</a></span></dt>
604:
605: <dd>
606: <dl>
607: <dt><span class="sect2"><a href=
1.38 dillo 608: "#conf-files-sysconfdir">12.2.1. How
1.35 jmmv 609: <code class="varname">PKG_SYSCONFDIR</code> is
610: set</a></span></dt>
611:
612: <dt><span class="sect2"><a href=
1.38 dillo 613: "#conf-files-configure">12.2.2. Telling the
1.47 reed 614: software where configuration files
1.35 jmmv 615: are</a></span></dt>
616:
617: <dt><span class="sect2"><a href=
1.38 dillo 618: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 619: installations</a></span></dt>
620:
621: <dt><span class="sect2"><a href=
1.38 dillo 622: "#conf-files-disable">12.2.4. Disabling
1.35 jmmv 623: handling of configuration files</a></span></dt>
624: </dl>
625: </dd>
626:
627: <dt><span class="sect1"><a href=
1.38 dillo 628: "#rcd-scripts">12.3. System startup
1.35 jmmv 629: scripts</a></span></dt>
630:
631: <dd>
632: <dl>
633: <dt><span class="sect2"><a href=
1.38 dillo 634: "#rcd-scripts-disable">12.3.1. Disabling
1.35 jmmv 635: handling of system startup
636: scripts</a></span></dt>
637: </dl>
638: </dd>
639:
640: <dt><span class="sect1"><a href=
1.38 dillo 641: "#users-and-groups">12.4. System users and
1.35 jmmv 642: groups</a></span></dt>
643:
1.38 dillo 644: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 645: System shells</a></span></dt>
646:
647: <dd>
648: <dl>
649: <dt><span class="sect2"><a href=
1.38 dillo 650: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 651: configuration files</a></span></dt>
652: </dl>
653: </dd>
654: </dl>
655: </dd>
656:
1.38 dillo 657: <dt><span class="chapter"><a href="#options">13.
1.1 grant 658: Options handling</a></span></dt>
659:
660: <dd>
661: <dl>
1.30 wiz 662: <dt><span class="sect1"><a href=
1.38 dillo 663: "#global-default-options">13.1. Global default
1.30 wiz 664: options</a></span></dt>
1.1 grant 665:
1.30 wiz 666: <dt><span class="sect1"><a href=
1.38 dillo 667: "#converting-to-options">13.2. Converting packages
1.45 wiz 668: to use <code xmlns=
669: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 670: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 671:
672: <dt><span class="sect1"><a href=
673: "#option-names">13.3. Option Names</a></span></dt>
1.1 grant 674: </dl>
675: </dd>
676:
1.38 dillo 677: <dt><span class="chapter"><a href="#build">14. The
1.1 grant 678: build process</a></span></dt>
679:
680: <dd>
681: <dl>
682: <dt><span class="sect1"><a href=
1.56 rillig 683: "#build.intro">14.1. Introduction</a></span></dt>
684:
685: <dt><span class="sect1"><a href=
686: "#build.prefix">14.2. Program
1.1 grant 687: location</a></span></dt>
688:
1.30 wiz 689: <dt><span class="sect1"><a href=
1.56 rillig 690: "#build.builddirs">14.3. Directories used during
691: the build process</a></span></dt>
692:
693: <dt><span class="sect1"><a href=
694: "#build.running">14.4. Running a
695: phase</a></span></dt>
696:
697: <dt><span class="sect1"><a href=
698: "#build.fetch">14.5. The <span class=
699: "emphasis"><em>fetch</em></span>
700: phase</a></span></dt>
701:
702: <dt><span class="sect1"><a href=
703: "#build.checksum">14.6. The <span class=
704: "emphasis"><em>checksum</em></span>
705: phase</a></span></dt>
706:
707: <dt><span class="sect1"><a href=
708: "#build.extract">14.7. The <span class=
709: "emphasis"><em>extract</em></span>
710: phase</a></span></dt>
711:
712: <dt><span class="sect1"><a href=
713: "#build.patch">14.8. The <span class=
714: "emphasis"><em>patch</em></span>
715: phase</a></span></dt>
716:
717: <dt><span class="sect1"><a href=
718: "#build.tools">14.9. The <span class=
719: "emphasis"><em>tools</em></span>
720: phase</a></span></dt>
721:
722: <dt><span class="sect1"><a href=
723: "#build.wrapper">14.10. The <span class=
724: "emphasis"><em>wrapper</em></span>
725: phase</a></span></dt>
726:
727: <dt><span class="sect1"><a href=
728: "#build.configure">14.11. The <span class=
729: "emphasis"><em>configure</em></span>
730: phase</a></span></dt>
731:
732: <dt><span class="sect1"><a href=
733: "#build.build">14.12. The <span class=
734: "emphasis"><em>build</em></span>
735: phase</a></span></dt>
736:
737: <dt><span class="sect1"><a href=
738: "#build.test">14.13. The <span class=
739: "emphasis"><em>test</em></span>
740: phase</a></span></dt>
741:
742: <dt><span class="sect1"><a href=
743: "#build.install">14.14. The <span class=
744: "emphasis"><em>install</em></span>
745: phase</a></span></dt>
1.1 grant 746:
747: <dt><span class="sect1"><a href=
1.56 rillig 748: "#build.package">14.15. The <span class=
749: "emphasis"><em>package</em></span>
750: phase</a></span></dt>
751:
752: <dt><span class="sect1"><a href=
753: "#build.helpful-targets">14.16. Other helpful
1.1 grant 754: targets</a></span></dt>
755: </dl>
756: </dd>
757:
1.55 rillig 758: <dt><span class="chapter"><a href="#fixes">15. Making
759: your package work</a></span></dt>
1.1 grant 760:
761: <dd>
762: <dl>
1.30 wiz 763: <dt><span class="sect1"><a href=
1.38 dillo 764: "#general-operation">15.1. General
1.30 wiz 765: operation</a></span></dt>
1.1 grant 766:
767: <dd>
768: <dl>
769: <dt><span class="sect2"><a href=
1.38 dillo 770: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 771: pull in variables from
772: /etc/mk.conf</a></span></dt>
1.1 grant 773:
774: <dt><span class="sect2"><a href=
1.38 dillo 775: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 776: to install documentation</a></span></dt>
777:
778: <dt><span class="sect2"><a href=
1.38 dillo 779: "#restricted-packages">15.1.3. Restricted
1.1 grant 780: packages</a></span></dt>
781:
782: <dt><span class="sect2"><a href=
1.38 dillo 783: "#dependencies">15.1.4. Handling
1.1 grant 784: dependencies</a></span></dt>
785:
786: <dt><span class="sect2"><a href=
1.38 dillo 787: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 788: other packages</a></span></dt>
789:
790: <dt><span class="sect2"><a href=
1.38 dillo 791: "#not-building-packages">15.1.6. Packages that
1.30 wiz 792: cannot or should not be built</a></span></dt>
1.1 grant 793:
794: <dt><span class="sect2"><a href=
1.38 dillo 795: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 796: should not be deleted, once
797: installed</a></span></dt>
1.1 grant 798:
799: <dt><span class="sect2"><a href=
1.38 dillo 800: "#security-handling">15.1.8. Handling packages
1.1 grant 801: with security problems</a></span></dt>
802:
803: <dt><span class="sect2"><a href=
1.38 dillo 804: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 805: bugs</a></span></dt>
806:
807: <dt><span class="sect2"><a href=
1.38 dillo 808: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 809: incrementing versions when fixing an existing
1.1 grant 810: package</a></span></dt>
811:
812: <dt><span class="sect2"><a href=
1.38 dillo 813: "#portability-of-packages">15.1.11. Portability
1.30 wiz 814: of packages</a></span></dt>
1.1 grant 815: </dl>
816: </dd>
817:
1.30 wiz 818: <dt><span class="sect1"><a href=
1.38 dillo 819: "#downloading-issues">15.2. Possible downloading
1.30 wiz 820: issues</a></span></dt>
1.1 grant 821:
822: <dd>
823: <dl>
824: <dt><span class="sect2"><a href=
1.38 dillo 825: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 826: distfiles aren't available for plain
1.1 grant 827: downloading</a></span></dt>
828:
829: <dt><span class="sect2"><a href=
1.38 dillo 830: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 831: handle modified distfiles with the 'old'
832: name</a></span></dt>
1.1 grant 833: </dl>
834: </dd>
835:
1.30 wiz 836: <dt><span class="sect1"><a href=
1.38 dillo 837: "#configuration-gotchas">15.3. Configuration
1.30 wiz 838: gotchas</a></span></dt>
1.1 grant 839:
840: <dd>
841: <dl>
842: <dt><span class="sect2"><a href=
1.38 dillo 843: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 844: libtool</a></span></dt>
845:
846: <dt><span class="sect2"><a href=
1.38 dillo 847: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 848: packages that already support
849: libtool</a></span></dt>
850:
851: <dt><span class="sect2"><a href=
1.38 dillo 852: "#autoconf-automake">15.3.3. GNU
1.1 grant 853: Autoconf/Automake</a></span></dt>
854: </dl>
855: </dd>
856:
1.30 wiz 857: <dt><span class="sect1"><a href=
1.55 rillig 858: "#fixes-build">15.4. Building the
859: package</a></span></dt>
1.1 grant 860:
861: <dd>
862: <dl>
863: <dt><span class="sect2"><a href=
1.38 dillo 864: "#cpp-defines">15.4.1. CPP
1.1 grant 865: defines</a></span></dt>
1.51 rillig 866:
867: <dt><span class="sect2"><a href=
868: "#cpp-list">15.4.2. Getting a list of CPP
869: defines</a></span></dt>
1.1 grant 870: </dl>
871: </dd>
872:
1.30 wiz 873: <dt><span class="sect1"><a href=
1.38 dillo 874: "#package-specific-actions">15.5. Package specific
1.30 wiz 875: actions</a></span></dt>
1.1 grant 876:
877: <dd>
878: <dl>
879: <dt><span class="sect2"><a href=
1.38 dillo 880: "#user-interaction">15.5.1. User
1.2 hubertf 881: interaction</a></span></dt>
1.1 grant 882:
883: <dt><span class="sect2"><a href=
1.38 dillo 884: "#handling-licenses">15.5.2. Handling
1.1 grant 885: licenses</a></span></dt>
886:
887: <dt><span class="sect2"><a href=
1.38 dillo 888: "#installing-score-files">15.5.3. Installing
1.30 wiz 889: score files</a></span></dt>
1.1 grant 890:
891: <dt><span class="sect2"><a href=
1.38 dillo 892: "#perl-scripts">15.5.4. Packages containing
1.30 wiz 893: perl scripts</a></span></dt>
1.1 grant 894:
895: <dt><span class="sect2"><a href=
1.38 dillo 896: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 897: hardcoded paths to other
898: interpreters</a></span></dt>
1.1 grant 899:
900: <dt><span class="sect2"><a href=
1.38 dillo 901: "#perl-modules">15.5.6. Packages installing
1.30 wiz 902: perl modules</a></span></dt>
1.1 grant 903:
904: <dt><span class="sect2"><a href=
1.38 dillo 905: "#faq.info-files">15.5.7. Packages installing
1.1 grant 906: info files</a></span></dt>
907:
908: <dt><span class="sect2"><a href=
1.57 ! minskim 909: "#manpages">15.5.8. Packages installing man
! 910: pages</a></span></dt>
! 911:
! 912: <dt><span class="sect2"><a href=
! 913: "#gconf2-data-files">15.5.9. Packages
1.30 wiz 914: installing GConf2 data files</a></span></dt>
1.1 grant 915:
916: <dt><span class="sect2"><a href=
1.57 ! minskim 917: "#scrollkeeper-data-files">15.5.10. Packages
1.30 wiz 918: installing scrollkeeper data
919: files</a></span></dt>
1.1 grant 920:
921: <dt><span class="sect2"><a href=
1.57 ! minskim 922: "#x11-fonts">15.5.11. Packages installing X11
1.1 grant 923: fonts</a></span></dt>
924:
925: <dt><span class="sect2"><a href=
1.57 ! minskim 926: "#gtk2-modules">15.5.12. Packages installing
1.30 wiz 927: GTK2 modules</a></span></dt>
1.1 grant 928:
929: <dt><span class="sect2"><a href=
1.57 ! minskim 930: "#sgml-xml-data">15.5.13. Packages installing
1.30 wiz 931: SGML or XML data</a></span></dt>
1.1 grant 932:
933: <dt><span class="sect2"><a href=
1.57 ! minskim 934: "#mime-database">15.5.14. Packages installing
1.1 grant 935: extensions to the MIME database</a></span></dt>
936:
937: <dt><span class="sect2"><a href=
1.57 ! minskim 938: "#intltool">15.5.15. Packages using
1.1 grant 939: intltool</a></span></dt>
1.18 xtraeme 940:
941: <dt><span class="sect2"><a href=
1.57 ! minskim 942: "#startup-scripts">15.5.16. Packages installing
1.18 xtraeme 943: startup scripts</a></span></dt>
1.57 ! minskim 944:
! 945: <dt><span class="sect2"><a href=
! 946: "#tex-packages">15.5.17. Packages installing
! 947: TeX modules</a></span></dt>
1.1 grant 948: </dl>
949: </dd>
950:
1.30 wiz 951: <dt><span class="sect1"><a href=
1.38 dillo 952: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 953: author</a></span></dt>
1.1 grant 954: </dl>
955: </dd>
956:
1.38 dillo 957: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 958: Debugging</a></span></dt>
959:
1.38 dillo 960: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 961: Submitting and Committing</a></span></dt>
962:
963: <dd>
964: <dl>
1.30 wiz 965: <dt><span class="sect1"><a href=
1.38 dillo 966: "#submitting-your-package">17.1. Submitting your
1.30 wiz 967: packages</a></span></dt>
1.1 grant 968:
1.30 wiz 969: <dt><span class="sect1"><a href=
1.41 wiz 970: "#general-notes-for-changes">17.2. General notes
971: when adding, updating, or removing
972: packages</a></span></dt>
973:
974: <dt><span class="sect1"><a href=
975: "#committing-importing">17.3. Committing: Importing
1.30 wiz 976: a package into CVS</a></span></dt>
1.1 grant 977:
1.30 wiz 978: <dt><span class="sect1"><a href=
1.41 wiz 979: "#updating-package">17.4. Updating a package to a
1.30 wiz 980: newer version</a></span></dt>
1.1 grant 981:
1.30 wiz 982: <dt><span class="sect1"><a href=
1.41 wiz 983: "#moving-package">17.5. Moving a package in
1.30 wiz 984: pkgsrc</a></span></dt>
1.1 grant 985: </dl>
986: </dd>
987: </dl>
988: </dd>
989:
1.46 gdt 990: <dt><span class="appendix"><a href="#examples">A. A simple
1.1 grant 991: example package: bison</a></span></dt>
992:
993: <dd>
994: <dl>
1.46 gdt 995: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 996: files</a></span></dt>
997:
998: <dd>
999: <dl>
1.30 wiz 1000: <dt><span class="sect2"><a href=
1.46 gdt 1001: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 1002:
1.30 wiz 1003: <dt><span class="sect2"><a href=
1.46 gdt 1004: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 1005:
1.30 wiz 1006: <dt><span class="sect2"><a href=
1.46 gdt 1007: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 1008:
1.30 wiz 1009: <dt><span class="sect2"><a href=
1.46 gdt 1010: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 1011: package with <span><strong class=
1.14 xtraeme 1012: "command">pkglint</strong></span></a></span></dt>
1.1 grant 1013: </dl>
1014: </dd>
1015:
1.46 gdt 1016: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 1017: Steps for building, installing,
1018: packaging</a></span></dt>
1.1 grant 1019: </dl>
1020: </dd>
1021:
1.46 gdt 1022: <dt><span class="appendix"><a href="#logs">B. Build
1.1 grant 1023: logs</a></span></dt>
1024:
1025: <dd>
1026: <dl>
1.46 gdt 1027: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 1028: Building figlet</a></span></dt>
1029:
1.46 gdt 1030: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 1031: Packaging figlet</a></span></dt>
1032: </dl>
1033: </dd>
1034:
1.46 gdt 1035: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1 grant 1036: of the FTP server's package archive</a></span></dt>
1.2 hubertf 1037:
1.46 gdt 1038: <dt><span class="appendix"><a href="#editing">D. Editing
1.2 hubertf 1039: guidelines for the pkgsrc guide</a></span></dt>
1040:
1041: <dd>
1042: <dl>
1.46 gdt 1043: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 1044: Targets</a></span></dt>
1045:
1.46 gdt 1046: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 1047: Procedure</a></span></dt>
1048: </dl>
1049: </dd>
1.1 grant 1050: </dl>
1051: </div>
1052:
1.57 ! minskim 1053: <div class="chapter" lang="en">
1.1 grant 1054: <div class="titlepage">
1055: <div>
1056: <div>
1.57 ! minskim 1057: <h2 class="title"><a name=
1.51 rillig 1058: "introduction"></a>Chapter 1. What is
1059: pkgsrc?</h2>
1.1 grant 1060: </div>
1061: </div>
1062: </div>
1063:
1064: <div class="toc">
1065: <p><b>Table of Contents</b></p>
1066:
1067: <dl>
1.30 wiz 1068: <dt><span class="sect1"><a href=
1069: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 1070:
1071: <dt><span class="sect1"><a href="#overview">1.2.
1072: Overview</a></span></dt>
1073:
1074: <dt><span class="sect1"><a href="#terminology">1.3.
1075: Terminology</a></span></dt>
1076:
1077: <dt><span class="sect1"><a href="#typography">1.4.
1078: Typography</a></span></dt>
1079: </dl>
1080: </div>
1081:
1.57 ! minskim 1082: <div class="sect1" lang="en">
1.1 grant 1083: <div class="titlepage">
1084: <div>
1085: <div>
1086: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1087: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 1088: </div>
1089: </div>
1090: </div>
1091:
1.47 reed 1092: <p>There is a lot of software freely available for
1093: Unix-based systems, which usually runs on NetBSD and other
1.1 grant 1094: Unix-flavoured systems, too, sometimes with some
1095: modifications. The NetBSD Packages Collection (pkgsrc)
1096: incorporates any such changes necessary to make that
1097: software run, and makes the installation (and
1098: de-installation) of the software package easy by means of a
1099: single command.</p>
1100:
1101: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 1102: the <span><strong class="command">pkg_*</strong></span>
1103: tools so that installation and de-installation, printing of
1104: an inventory of all installed packages and retrieval of
1105: one-line comments or more verbose descriptions are all
1106: simple.</p>
1.1 grant 1107:
1108: <p>pkgsrc currently contains several thousand packages,
1109: including:</p>
1110:
1111: <div class="itemizedlist">
1112: <ul type="disc">
1113: <li>
1114: <p><a xmlns=
1115: "http://www.w3.org/TR/xhtml1/transitional" href=
1116: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45 wiz 1117: target="_top"><code xmlns="" class=
1118: "filename">www/apache</code></a> - The Apache web
1.20 ben 1119: server</p>
1.1 grant 1120: </li>
1121:
1122: <li>
1123: <p><a xmlns=
1124: "http://www.w3.org/TR/xhtml1/transitional" href=
1125: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 1126: target="_top"><code xmlns="" class=
1127: "filename">www/mozilla</code></a> - The Mozilla web
1.20 ben 1128: browser</p>
1.1 grant 1129: </li>
1130:
1131: <li>
1132: <p><a xmlns=
1133: "http://www.w3.org/TR/xhtml1/transitional" href=
1134: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45 wiz 1135: target="_top"><code xmlns="" class=
1136: "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20 ben 1137: Desktop Environment</p>
1.1 grant 1138: </li>
1139:
1140: <li>
1141: <p><a xmlns=
1142: "http://www.w3.org/TR/xhtml1/transitional" href=
1143: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45 wiz 1144: target="_top"><code xmlns="" class=
1145: "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20 ben 1146: Environment</p>
1.1 grant 1147: </li>
1148: </ul>
1149: </div>
1150:
1151: <p>...just to name a few.</p>
1152:
1153: <p>pkgsrc has built-in support for handling varying
1154: dependencies, such as pthreads and X11, and extended
1155: features such as IPv6 support on a range of platforms.</p>
1156:
1157: <p>pkgsrc was derived from FreeBSD's ports system, and
1158: initially developed for NetBSD only. Since then, pkgsrc has
1159: grown a lot, and now supports the following platforms:</p>
1160:
1161: <div class="itemizedlist">
1162: <ul type="disc">
1163: <li>
1164: <p><a href="http://developer.apple.com/darwin/"
1165: target="_top">Darwin</a> (<a href=
1166: "http://www.apple.com/macosx/" target="_top">Mac OS
1167: X</a>)</p>
1168: </li>
1169:
1170: <li>
1.3 hubertf 1171: <p><a href="http://www.DragonFlyBSD.org/" target=
1172: "_top">DragonFlyBSD</a></p>
1173: </li>
1174:
1175: <li>
1.1 grant 1176: <p><a href="http://www.FreeBSD.org/" target=
1177: "_top">FreeBSD</a></p>
1178: </li>
1179:
1180: <li>
1.3 hubertf 1181: <p>Microsoft Windows, via <a href=
1182: "http://www.microsoft.com/windows/sfu/" target=
1183: "_top">Interix</a></p>
1.1 grant 1184: </li>
1185:
1186: <li>
1187: <p><a href="http://www.sgi.com/software/irix6.5/"
1188: target="_top">IRIX</a></p>
1189: </li>
1190:
1191: <li>
1192: <p><a href="http://www.linux.org/" target=
1193: "_top">Linux</a></p>
1194: </li>
1195:
1196: <li>
1197: <p><a href="http://www.NetBSD.org/" target=
1198: "_top">NetBSD</a> (of course)</p>
1199: </li>
1200:
1201: <li>
1.17 sketch 1202: <p><a href="http://h30097.www3.hp.com/" target=
1203: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1204: </li>
1205:
1206: <li>
1.1 grant 1207: <p><a href="http://www.openbsd.org/" target=
1208: "_top">OpenBSD</a></p>
1209: </li>
1210:
1211: <li>
1212: <p><a href="http://www.sun.com/solaris/" target=
1213: "_top">Solaris</a></p>
1214: </li>
1215: </ul>
1216: </div>
1217: </div>
1218:
1.57 ! minskim 1219: <div class="sect1" lang="en">
1.1 grant 1220: <div class="titlepage">
1221: <div>
1222: <div>
1223: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 1224: "overview"></a>1.2. Overview</h2>
1.1 grant 1225: </div>
1226: </div>
1227: </div>
1228:
1229: <p>This document is divided into two parts. The first,
1230: <a href="#users-guide" title=
1.46 gdt 1231: "Part I. The pkgsrc user's guide">The pkgsrc
1.2 hubertf 1232: user's guide</a>, describes how one can use one of the
1233: packages in the Package Collection, either by installing a
1234: precompiled binary package, or by building one's own copy
1235: using the NetBSD package system. The second part, <a href=
1.1 grant 1236: "#developers-guide" title=
1.46 gdt 1237: "Part II. The pkgsrc developer's guide">The
1238: pkgsrc developer's guide</a>, explains how to prepare a
1239: package so it can be easily built by other NetBSD users
1240: without knowing about the package's building details.</p>
1.1 grant 1241:
1242: <p>This document is available in various formats:</p>
1243:
1244: <div class="itemizedlist">
1245: <ul type="disc">
1246: <li>
1247: <p><a href="index.html" target="_top">HTML</a></p>
1248: </li>
1249:
1250: <li>
1251: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1252: </li>
1253:
1254: <li>
1255: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1256: </li>
1257:
1258: <li>
1259: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1260: </li>
1261: </ul>
1262: </div>
1263: </div>
1264:
1.57 ! minskim 1265: <div class="sect1" lang="en">
1.1 grant 1266: <div class="titlepage">
1267: <div>
1268: <div>
1269: <h2 class="title" style="clear: both"><a name=
1270: "terminology"></a>1.3. Terminology</h2>
1271: </div>
1272: </div>
1273: </div>
1274:
1275: <p>There has been a lot of talk about “<span class=
1276: "quote">ports</span>”, “<span class=
1277: "quote">packages</span>”, etc. so far. Here is a
1278: description of all the terminology used within this
1279: document.</p>
1280:
1281: <div class="variablelist">
1282: <dl>
1283: <dt><span class="term">Package</span></dt>
1284:
1285: <dd>
1286: <p>A set of files and building instructions that
1287: describe what's necessary to build a certain piece of
1288: software using pkgsrc. Packages are traditionally
1.45 wiz 1289: stored under <code xmlns=
1290: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1291: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1292: </dd>
1293:
1294: <dt><span class="term">The NetBSD package
1295: system</span></dt>
1296:
1297: <dd>
1298: <p>This is the former name of “<span class=
1299: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1300: NetBSD operating system and can be bootstrapped to
1301: run on non-NetBSD operating systems as well. It
1302: handles building (compiling), installing, and
1303: removing of packages.</p>
1.1 grant 1304: </dd>
1305:
1306: <dt><span class="term">Distfile</span></dt>
1307:
1308: <dd>
1309: <p>This term describes the file or files that are
1310: provided by the author of the piece of software to
1311: distribute his work. All the changes necessary to
1312: build on NetBSD are reflected in the corresponding
1313: package. Usually the distfile is in the form of a
1314: compressed tar-archive, but other types are possible,
1.45 wiz 1315: too. Distfiles are usually stored below <code xmlns=
1316: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1317: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1318: </dd>
1319:
1320: <dt><span class="term">Port</span></dt>
1321:
1322: <dd>
1323: <p>This is the term used by FreeBSD and OpenBSD
1324: people for what we call a package. In NetBSD
1325: terminology, “<span class=
1326: "quote">port</span>” refers to a different
1327: architecture.</p>
1328: </dd>
1329:
1330: <dt><span class="term">Precompiled/binary
1331: package</span></dt>
1332:
1333: <dd>
1334: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1335: distfile and stuffed together in a single
1.45 wiz 1336: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1337: class="filename">.tgz</code> file so it can be
1.14 xtraeme 1338: installed on machines of the same machine
1339: architecture without the need to recompile. Packages
1.45 wiz 1340: are usually generated in <code xmlns=
1341: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1342: "filename">/usr/pkgsrc/packages</code>; there is also
1343: an archive on <a href=
1.1 grant 1344: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1345: "_top">ftp.NetBSD.org</a>.</p>
1346:
1347: <p>Sometimes, this is referred to by the term
1348: “<span class="quote">package</span>” too,
1349: especially in the context of precompiled
1350: packages.</p>
1351: </dd>
1352:
1353: <dt><span class="term">Program</span></dt>
1354:
1355: <dd>
1356: <p>The piece of software to be installed which will
1.47 reed 1357: be constructed from all the files in the distfile by
1.1 grant 1358: the actions defined in the corresponding package.</p>
1359: </dd>
1360: </dl>
1361: </div>
1362: </div>
1363:
1.57 ! minskim 1364: <div class="sect1" lang="en">
1.1 grant 1365: <div class="titlepage">
1366: <div>
1367: <div>
1368: <h2 class="title" style="clear: both"><a name=
1369: "typography"></a>1.4. Typography</h2>
1370: </div>
1371: </div>
1372: </div>
1373:
1374: <p>When giving examples for commands, shell prompts are
1375: used to show if the command should/can be issued as root,
1376: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1377: privileges are sufficient. We use a <code class=
1378: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1379: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1380: assuming they use the C-shell or tcsh.</p>
1.1 grant 1381: </div>
1382: </div>
1383:
1.57 ! minskim 1384: <div class="part" lang="en">
1.1 grant 1385: <div class="titlepage">
1386: <div>
1387: <div>
1.57 ! minskim 1388: <h1 class="title"><a name=
1.48 dillo 1389: "users-guide"></a>Part I. The pkgsrc user's
1390: guide</h1>
1.1 grant 1391: </div>
1392: </div>
1393: </div>
1394:
1395: <div class="toc">
1396: <p><b>Table of Contents</b></p>
1397:
1398: <dl>
1399: <dt><span class="chapter"><a href="#getting">2. Where to
1400: get pkgsrc</a></span></dt>
1401:
1402: <dd>
1403: <dl>
1.30 wiz 1404: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1405: As tar file</a></span></dt>
1.1 grant 1406:
1.30 wiz 1407: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1408: SUP</a></span></dt>
1409:
1.30 wiz 1410: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1411: CVS</a></span></dt>
1412: </dl>
1413: </dd>
1414:
1415: <dt><span class="chapter"><a href="#platforms">3. Using
1416: pkgsrc on systems other than NetBSD</a></span></dt>
1417:
1418: <dd>
1419: <dl>
1.30 wiz 1420: <dt><span class="sect1"><a href=
1421: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1422: pkgsrc</a></span></dt>
1.1 grant 1423:
1.30 wiz 1424: <dt><span class="sect1"><a href=
1.47 reed 1425: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1426: notes</a></span></dt>
1.1 grant 1427:
1428: <dd>
1429: <dl>
1.30 wiz 1430: <dt><span class="sect2"><a href="#darwin">3.2.1.
1431: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1432:
1.30 wiz 1433: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1434: FreeBSD</a></span></dt>
1.22 tv 1435:
1.30 wiz 1436: <dt><span class="sect2"><a href="#interix">3.2.3.
1437: Interix</a></span></dt>
1.1 grant 1438:
1.30 wiz 1439: <dt><span class="sect2"><a href="#irix">3.2.4.
1440: IRIX</a></span></dt>
1.1 grant 1441:
1.30 wiz 1442: <dt><span class="sect2"><a href="#linux">3.2.5.
1443: Linux</a></span></dt>
1.1 grant 1444:
1.30 wiz 1445: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1446: OpenBSD</a></span></dt>
1.1 grant 1447:
1.30 wiz 1448: <dt><span class="sect2"><a href="#solaris">3.2.7.
1449: Solaris</a></span></dt>
1.1 grant 1450: </dl>
1451: </dd>
1452: </dl>
1453: </dd>
1454:
1455: <dt><span class="chapter"><a href="#using">4. Using
1456: pkgsrc</a></span></dt>
1457:
1458: <dd>
1459: <dl>
1460: <dt><span class="sect1"><a href=
1461: "#getting-started">4.1. Working with binary
1462: packages</a></span></dt>
1463:
1464: <dd>
1465: <dl>
1466: <dt><span class="sect2"><a href=
1.30 wiz 1467: "#where-to-get-binary-packages">4.1.1. Where to
1468: get binary packages</a></span></dt>
1.1 grant 1469:
1470: <dt><span class="sect2"><a href=
1.30 wiz 1471: "#how-to-use-binary-packages">4.1.2. How to use
1472: binary packages</a></span></dt>
1.1 grant 1473:
1474: <dt><span class="sect2"><a href=
1.30 wiz 1475: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1476: warning</a></span></dt>
1477: </dl>
1478: </dd>
1479:
1.30 wiz 1480: <dt><span class="sect1"><a href=
1481: "#building-packages-from-source">4.2. Building
1482: packages from source</a></span></dt>
1.1 grant 1483:
1484: <dd>
1485: <dl>
1486: <dt><span class="sect2"><a href=
1.30 wiz 1487: "#requirements">4.2.1.
1488: Requirements</a></span></dt>
1.1 grant 1489:
1490: <dt><span class="sect2"><a href=
1.30 wiz 1491: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1492: distfiles</a></span></dt>
1493:
1494: <dt><span class="sect2"><a href=
1.30 wiz 1495: "#how-to-build-and-install">4.2.3. How to build
1496: and install</a></span></dt>
1.1 grant 1497:
1498: <dt><span class="sect2"><a href=
1.30 wiz 1499: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1500: compiler</a></span></dt>
1501: </dl>
1502: </dd>
1503: </dl>
1504: </dd>
1505:
1.38 dillo 1506: <dt><span class="chapter"><a href="#configuring">5.
1507: Configuring pkgsrc</a></span></dt>
1508:
1509: <dd>
1510: <dl>
1511: <dt><span class="sect1"><a href=
1.45 wiz 1512: "#general-configuration">5.1. General
1513: configuration</a></span></dt>
1514:
1515: <dt><span class="sect1"><a href=
1516: "#variables-affecting-build">5.2. Variables affecting
1517: the build process</a></span></dt>
1518:
1519: <dt><span class="sect1"><a href=
1520: "#developer-advanced-settings">5.3.
1521: Developer/advanced settings</a></span></dt>
1522:
1523: <dt><span class="sect1"><a href=
1524: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 1525: Options</a></span></dt>
1.38 dillo 1526: </dl>
1527: </dd>
1528:
1529: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 1530: binary packages</a></span></dt>
1531:
1532: <dd>
1533: <dl>
1.30 wiz 1534: <dt><span class="sect1"><a href=
1.38 dillo 1535: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 1536: single binary package</a></span></dt>
1.1 grant 1537:
1.30 wiz 1538: <dt><span class="sect1"><a href=
1.38 dillo 1539: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 1540: Settings for creation of binary
1541: packages</a></span></dt>
1542:
1.38 dillo 1543: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 1544: Doing a bulk build of all packages</a></span></dt>
1545:
1546: <dd>
1547: <dl>
1548: <dt><span class="sect2"><a href=
1.38 dillo 1549: "#binary.configuration">6.3.1.
1.1 grant 1550: Configuration</a></span></dt>
1551:
1552: <dt><span class="sect2"><a href=
1.38 dillo 1553: "#other-environmental-considerations">6.3.2.
1.30 wiz 1554: Other environmental
1.1 grant 1555: considerations</a></span></dt>
1556:
1557: <dt><span class="sect2"><a href=
1.38 dillo 1558: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 1559:
1560: <dt><span class="sect2"><a href=
1.38 dillo 1561: "#what-it-does">6.3.4. What it
1.30 wiz 1562: does</a></span></dt>
1.1 grant 1563:
1564: <dt><span class="sect2"><a href=
1.38 dillo 1565: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 1566: requirements</a></span></dt>
1567:
1568: <dt><span class="sect2"><a href=
1.38 dillo 1569: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 1570: sandbox for chrooted builds</a></span></dt>
1.1 grant 1571:
1572: <dt><span class="sect2"><a href=
1.38 dillo 1573: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 1574: partial set of packages</a></span></dt>
1.13 hubertf 1575:
1576: <dt><span class="sect2"><a href=
1.38 dillo 1577: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 1578: build</a></span></dt>
1.1 grant 1579: </dl>
1580: </dd>
1581:
1.30 wiz 1582: <dt><span class="sect1"><a href=
1.38 dillo 1583: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 1584: packages collection</a></span></dt>
1.1 grant 1585:
1586: <dd>
1587: <dl>
1588: <dt><span class="sect2"><a href=
1.38 dillo 1589: "#cdpack-example">6.4.1. Example of
1.1 grant 1590: cdpack</a></span></dt>
1591: </dl>
1592: </dd>
1593: </dl>
1594: </dd>
1595:
1.38 dillo 1596: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 1597: Asked Questions</a></span></dt>
1598:
1599: <dd>
1600: <dl>
1.30 wiz 1601: <dt><span class="sect1"><a href=
1.38 dillo 1602: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 1603: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1604:
1.38 dillo 1605: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 1606: Where's the pkgviews documentation?</a></span></dt>
1607:
1.38 dillo 1608: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 1609: Utilities for package management
1610: (pkgtools)</a></span></dt>
1611:
1.30 wiz 1612: <dt><span class="sect1"><a href=
1.38 dillo 1613: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 1614: non-root</a></span></dt>
1.1 grant 1615:
1.30 wiz 1616: <dt><span class="sect1"><a href=
1.38 dillo 1617: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 1618: fetching distfiles?</a></span></dt>
1.14 xtraeme 1619:
1.30 wiz 1620: <dt><span class="sect1"><a href=
1.38 dillo 1621: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 1622: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1623:
1.30 wiz 1624: <dt><span class="sect1"><a href=
1.38 dillo 1625: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 1626: from pkgsrc?</a></span></dt>
1.1 grant 1627:
1.30 wiz 1628: <dt><span class="sect1"><a href=
1.38 dillo 1629: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 1630: behind a firewall</a></span></dt>
1.1 grant 1631:
1.38 dillo 1632: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30 wiz 1633: How do I tell <span><strong class="command">make
1.14 xtraeme 1634: fetch</strong></span> to do passive
1.1 grant 1635: FTP?</a></span></dt>
1636:
1.30 wiz 1637: <dt><span class="sect1"><a href=
1.38 dillo 1638: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 1639: distfiles at once</a></span></dt>
1.1 grant 1640:
1.30 wiz 1641: <dt><span class="sect1"><a href=
1.38 dillo 1642: "#tmac.andoc-missing">7.11. What does
1.30 wiz 1643: “<span class="quote">Don't know how to make
1644: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1645: mean?</a></span></dt>
1.13 hubertf 1646:
1.30 wiz 1647: <dt><span class="sect1"><a href=
1.38 dillo 1648: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 1649: “<span class="quote">Could not find
1.14 xtraeme 1650: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1651:
1.30 wiz 1652: <dt><span class="sect1"><a href=
1.38 dillo 1653: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 1654: pkgsrc</a></span></dt>
1.1 grant 1655:
1.38 dillo 1656: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 1657: do I change the location of configuration
1658: files?</a></span></dt>
1.1 grant 1659:
1660: <dt><span class="sect1"><a href=
1.38 dillo 1661: "#audit-packages">7.15. Automated security
1.1 grant 1662: checks</a></span></dt>
1663: </dl>
1664: </dd>
1665: </dl>
1666: </div>
1667:
1.57 ! minskim 1668: <div class="chapter" lang="en">
1.1 grant 1669: <div class="titlepage">
1670: <div>
1671: <div>
1.57 ! minskim 1672: <h2 class="title"><a name=
1.1 grant 1673: "getting"></a>Chapter 2. Where to get
1674: pkgsrc</h2>
1675: </div>
1676: </div>
1677: </div>
1678:
1679: <div class="toc">
1680: <p><b>Table of Contents</b></p>
1681:
1682: <dl>
1.30 wiz 1683: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1684: tar file</a></span></dt>
1685:
1.30 wiz 1686: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1687: SUP</a></span></dt>
1688:
1.30 wiz 1689: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1690: CVS</a></span></dt>
1691: </dl>
1692: </div>
1693:
1694: <p>There are three ways to get pkgsrc. Either as a tar
1695: file, via SUP, or via CVS. All three ways are described
1696: here.</p>
1697:
1.57 ! minskim 1698: <div class="sect1" lang="en">
1.1 grant 1699: <div class="titlepage">
1700: <div>
1701: <div>
1702: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 1703: "as-tar-file"></a>2.1. As tar file</h2>
1.1 grant 1704: </div>
1705: </div>
1706: </div>
1707:
1708: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1709: file from <a href=
1.11 ben 1710: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1711: target="_top">ftp.NetBSD.org</a> and unpack it into
1.45 wiz 1712: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1713: class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1714: </div>
1715:
1.57 ! minskim 1716: <div class="sect1" lang="en">
1.1 grant 1717: <div class="titlepage">
1718: <div>
1719: <div>
1720: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 1721: "via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1722: </div>
1723: </div>
1724: </div>
1725:
1726: <p>As an alternative to the tar file, you can get pkgsrc
1727: via the Software Update Protocol, SUP. To do so, make
1728: sure your supfile has a line</p>
1729: <pre class="programlisting">
1.51 rillig 1730: release=pkgsrc
1.1 grant 1731: </pre>
1732:
1.45 wiz 1733: <p>in it, see the examples in <code xmlns=
1734: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1735: "filename">/usr/share/examples/supfiles</code>, and that
1.45 wiz 1736: the <code xmlns=
1737: "http://www.w3.org/TR/xhtml1/transitional" class=
1738: "filename">/usr/pkgsrc</code> directory exists. Then,
1739: simply run <span><strong class="command">sup -v
1740: <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1741: </div>
1742:
1.57 ! minskim 1743: <div class="sect1" lang="en">
1.1 grant 1744: <div class="titlepage">
1745: <div>
1746: <div>
1747: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 1748: "via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1749: </div>
1750: </div>
1751: </div>
1752:
1753: <p>To get pkgsrc via CVS, make sure you have
1754: “<span class="quote">cvs</span>” installed.
1.27 rillig 1755: To do an initial (full) checkout of pkgsrc, do the
1756: following steps:</p>
1.1 grant 1757: <pre class="screen">
1.14 xtraeme 1758: <code class="prompt">%</code> <strong class=
1759: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1760: <code class="prompt">%</code> <strong class=
1761: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1762: <code class="prompt">%</code> <strong class=
1763: "userinput"><code>cd /usr</code></strong>
1764: <code class="prompt">%</code> <strong class=
1765: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1766: </pre>
1767:
1.45 wiz 1768: <p>This will create the <code xmlns=
1769: "http://www.w3.org/TR/xhtml1/transitional" class=
1770: "filename">pkgsrc</code> directory in your <code xmlns=
1771: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1772: "filename">/usr</code>, and all the package source will
1.45 wiz 1773: be stored under <code xmlns=
1774: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1775: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1776: initial checkout, make sure you have <code class=
1777: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1778: <pre class="screen">
1.14 xtraeme 1779: <code class="prompt">%</code> <strong class=
1780: "userinput"><code>cd /usr/pkgsrc</code></strong>
1781: <code class="prompt">%</code> <strong class=
1782: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1783: </pre>
1784:
1785: <p>Please also note that it is possible to have multiple
1786: copies of the pkgsrc hierarchy in use at any one time -
1787: all work is done relatively within the pkgsrc tree.</p>
1788: </div>
1789: </div>
1790:
1.57 ! minskim 1791: <div class="chapter" lang="en">
1.1 grant 1792: <div class="titlepage">
1793: <div>
1794: <div>
1.57 ! minskim 1795: <h2 class="title"><a name=
1.1 grant 1796: "platforms"></a>Chapter 3. Using pkgsrc on
1797: systems other than NetBSD</h2>
1798: </div>
1799: </div>
1800: </div>
1801:
1802: <div class="toc">
1803: <p><b>Table of Contents</b></p>
1804:
1805: <dl>
1.30 wiz 1806: <dt><span class="sect1"><a href=
1807: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1808: pkgsrc</a></span></dt>
1.1 grant 1809:
1.30 wiz 1810: <dt><span class="sect1"><a href=
1.47 reed 1811: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1812: notes</a></span></dt>
1.1 grant 1813:
1814: <dd>
1815: <dl>
1.30 wiz 1816: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1817: Darwin (Mac OS X)</a></span></dt>
1818:
1.30 wiz 1819: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1820: FreeBSD</a></span></dt>
1821:
1.30 wiz 1822: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1823: Interix</a></span></dt>
1824:
1.30 wiz 1825: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1826: IRIX</a></span></dt>
1827:
1.30 wiz 1828: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1829: Linux</a></span></dt>
1830:
1.30 wiz 1831: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1832: OpenBSD</a></span></dt>
1833:
1.30 wiz 1834: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1835: Solaris</a></span></dt>
1836: </dl>
1837: </dd>
1838: </dl>
1839: </div>
1840:
1.57 ! minskim 1841: <div class="sect1" lang="en">
1.1 grant 1842: <div class="titlepage">
1843: <div>
1844: <div>
1845: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1846: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
1847: pkgsrc</h2>
1.1 grant 1848: </div>
1849: </div>
1850: </div>
1851:
1.27 rillig 1852: <p>For operating systems other than NetBSD, we provide a
1.1 grant 1853: bootstrap kit to build the required tools to use pkgsrc
1854: on your platform. Besides support for native NetBSD,
1855: pkgsrc and the bootstrap kit have support for the
1856: following operating systems:</p>
1857:
1858: <div class="itemizedlist">
1859: <ul type="disc">
1860: <li>
1861: <p>Darwin (Mac OS X)</p>
1862: </li>
1863:
1864: <li>
1.16 grant 1865: <p>DragonFlyBSD</p>
1866: </li>
1867:
1868: <li>
1.1 grant 1869: <p>FreeBSD</p>
1870: </li>
1871:
1872: <li>
1873: <p>Interix (Windows 2000, XP, 2003)</p>
1874: </li>
1875:
1876: <li>
1877: <p>IRIX</p>
1878: </li>
1879:
1880: <li>
1881: <p>Linux</p>
1882: </li>
1883:
1884: <li>
1885: <p>OpenBSD</p>
1886: </li>
1887:
1888: <li>
1889: <p>Solaris</p>
1890: </li>
1.16 grant 1891:
1892: <li>
1893: <p>Tru64 (Digital UNIX/OSF1)</p>
1894: </li>
1.1 grant 1895: </ul>
1896: </div>
1897:
1898: <p>Support for other platforms is under development.</p>
1899:
1900: <p>Installing the bootstrap kit should be as simple
1901: as:</p>
1902: <pre class="screen">
1.14 xtraeme 1903: <code class="prompt">#</code> <strong class=
1904: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1905: <code class="prompt">#</code> <strong class=
1906: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1907: <code class="prompt">#</code> <strong class=
1908: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1909: </pre>
1910:
1911: <p>See <a href="#getting" title=
1.57 ! minskim 1912: "Chapter 2. Where to get pkgsrc">Chapter 2,
1.1 grant 1913: <i>Where to get pkgsrc</i></a> for other ways to get
1.14 xtraeme 1914: pkgsrc before bootstrapping. The given
1915: <span><strong class="command">bootstrap</strong></span>
1.45 wiz 1916: command will use the defaults of <code xmlns=
1917: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1918: "filename">/usr/pkg</code> for the <span class=
1919: "emphasis"><em>prefix</em></span> where programs will be
1.45 wiz 1920: installed in, and <code xmlns=
1921: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1922: "filename">/var/db/pkg</code> for the package database
1.27 rillig 1923: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 1924: However, these can also be set using command-line
1.27 rillig 1925: arguments.</p>
1.1 grant 1926:
1927: <p>Binary packages for the pkgsrc tools and an initial
1928: set of packages is available for supported platforms. An
1929: up-to-date list of these can be found on <a href=
1930: "http://www.pkgsrc.org/" target=
1931: "_top">www.pkgsrc.org</a>.</p>
1.47 reed 1932:
1933: <div class="note" style=
1934: "margin-left: 0.5in; margin-right: 0.5in;">
1935: <h3 class="title">Note</h3>
1936:
1937: <p>The bootstrap installs a <span><strong class=
1938: "command">bmake</strong></span> tool. Use this
1939: <span><strong class="command">bmake</strong></span>
1940: when building via pkgsrc. For examples in this guide,
1941: use <span><strong class="command">bmake</strong></span>
1942: instead of “<span class=
1943: "quote">make</span>”.</p>
1944: </div>
1.1 grant 1945: </div>
1946:
1.57 ! minskim 1947: <div class="sect1" lang="en">
1.1 grant 1948: <div class="titlepage">
1949: <div>
1950: <div>
1951: <h2 class="title" style="clear: both"><a name=
1.47 reed 1952: "platform-specific-notes"></a>3.2. Platform-specific
1953: notes</h2>
1.1 grant 1954: </div>
1955: </div>
1956: </div>
1957:
1958: <p>Here are some platform-specific notes you should be
1959: aware of.</p>
1960:
1.57 ! minskim 1961: <div class="sect2" lang="en">
1.1 grant 1962: <div class="titlepage">
1963: <div>
1964: <div>
1.57 ! minskim 1965: <h3 class="title"><a name=
1.30 wiz 1966: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 1967: </div>
1968: </div>
1969: </div>
1970:
1971: <p>Darwin 5.x and 6.x are supported. There are two
1972: methods of using pkgsrc on Mac OS X, by using a
1973: <a href="#platform.osx-image" title=
1974: "3.2.1.1. Using a disk image">disk image</a>, or a
1975: <a href="#platform.osx-ufs" title=
1976: "3.2.1.2. Using a UFS partition">UFS
1977: partition</a>.</p>
1978:
1979: <p>Before you start, you will need to download and
1980: install the Mac OS X Developer Tools from Apple's
1981: Developer Connection. See <a href=
1982: "http://developer.apple.com/macosx/" target=
1983: "_top">http://developer.apple.com/macosx/</a> for
1984: details. Also, make sure you install X11 for Mac OS X
1985: and the X11 SDK from <a href=
1986: "http://www.apple.com/macosx/x11/download/" target=
1987: "_top">http://www.apple.com/macosx/x11/download/</a> if
1988: you intend to build packages that use the X11 Window
1989: System.</p>
1990:
1991: <p>If you already have a UFS partition, or have a spare
1992: partition that you can format as UFS, it is recommended
1993: to use that instead of the disk image. It'll be
1994: somewhat faster and will mount automatically at boot
1995: time, where you must manually mount a disk image.</p>
1996:
1997: <div class="note" style=
1998: "margin-left: 0.5in; margin-right: 0.5in;">
1999: <h3 class="title">Note</h3>
2000:
2001: <p>You cannot use a HFS+ file system for pkgsrc,
1.47 reed 2002: because pkgsrc currently requires the file system to
1.1 grant 2003: be case-sensitive, and HFS+ is not.</p>
2004: </div>
2005:
1.57 ! minskim 2006: <div class="sect3" lang="en">
1.1 grant 2007: <div class="titlepage">
2008: <div>
2009: <div>
1.57 ! minskim 2010: <h4 class="title"><a name=
! 2011: "platform.osx-image"></a>3.2.1.1. Using a
! 2012: disk image</h4>
1.1 grant 2013: </div>
2014: </div>
2015: </div>
2016:
2017: <p>Create the disk image:</p>
2018: <pre class="screen">
1.14 xtraeme 2019: <code class="prompt">#</code> <strong class=
2020: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
2021: <code class="prompt">#</code> <strong class=
2022: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
2023: <code class="prompt">#</code> <strong class=
2024: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
2025: <code class="prompt">#</code> <strong class=
2026: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 2027: </pre>
2028:
2029: <p>That's it!</p>
2030: </div>
2031:
1.57 ! minskim 2032: <div class="sect3" lang="en">
1.1 grant 2033: <div class="titlepage">
2034: <div>
2035: <div>
1.57 ! minskim 2036: <h4 class="title"><a name=
! 2037: "platform.osx-ufs"></a>3.2.1.2. Using a
1.1 grant 2038: UFS partition</h4>
2039: </div>
2040: </div>
2041: </div>
2042:
1.45 wiz 2043: <p>By default, <code xmlns=
2044: "http://www.w3.org/TR/xhtml1/transitional" class=
2045: "filename">/usr</code> will be on your root file
2046: system, normally HFS+. It is possible to use the
2047: default <span class="emphasis"><em>prefix</em></span>
2048: of <code xmlns=
2049: "http://www.w3.org/TR/xhtml1/transitional" class=
2050: "filename">/usr/pkg</code> by symlinking <code xmlns=
2051: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2052: "filename">/usr/pkg</code> to a directory on a UFS
2053: file system. Obviously, another symlink is required
2054: if you want to place the package database directory
2055: outside the <span class=
2056: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 2057: <pre class="screen">
1.14 xtraeme 2058: <code class="prompt">#</code> <strong class=
1.22 tv 2059: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1 grant 2060: </pre>
2061:
2062: <p>If you created your partitions at the time of
2063: installing Mac OS X and formatted the target
2064: partition as UFS, it should automatically mount on
1.45 wiz 2065: <code xmlns=
2066: "http://www.w3.org/TR/xhtml1/transitional" class=
2067: "filename">/Volumes/<volume name></code> when
2068: the machine boots. If you are (re)formatting a
2069: partition as UFS, you need to ensure that the
2070: partition map correctly reflects “<span class=
2071: "quote">Apple_UFS</span>” and not
2072: “<span class=
1.1 grant 2073: "quote">Apple_HFS</span>”.</p>
2074:
2075: <p>The problem is that none of the disk tools will
2076: let you touch a disk that is booted from. You can
2077: unmount the partition, but even if you newfs it, the
2078: partition type will be incorrect and the automounter
2079: won't mount it. It can be mounted manually, but it
2080: won't appear in Finder.</p>
2081:
2082: <p>You'll need to boot off of the OS X Installation
2083: (User) CD. When the Installation program starts, go
2084: up to the menu and select Disk Utility. Now, you will
2085: be able to select the partition you want to be UFS,
2086: and Format it Apple UFS. Quit the Disk Utility, quit
2087: the installer which will reboot your machine. The new
2088: UFS file system will appear in Finder.</p>
2089:
2090: <p>Be aware that the permissions on the new file
2091: system will be writable by root only.</p>
2092:
2093: <p>This note is as of 10.2 (Jaguar) and applies to
2094: earlier versions. Hopefully Apple will fix Disk
2095: Utility in 10.3 (Panther).</p>
2096: </div>
2097: </div>
2098:
1.57 ! minskim 2099: <div class="sect2" lang="en">
1.1 grant 2100: <div class="titlepage">
2101: <div>
2102: <div>
1.57 ! minskim 2103: <h3 class="title"><a name=
1.30 wiz 2104: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 2105: </div>
2106: </div>
2107: </div>
2108:
2109: <p>FreeBSD 4.7 and 5.0 have been tested and are
2110: supported, other versions may work.</p>
2111:
2112: <p>Care should be taken so that the tools that this kit
2113: installs do not conflict with the FreeBSD userland
2114: tools. There are several steps:</p>
2115:
2116: <div class="orderedlist">
2117: <ol type="1">
2118: <li>
2119: <p>FreeBSD stores its ports pkg database in
1.45 wiz 2120: <code xmlns=
2121: "http://www.w3.org/TR/xhtml1/transitional" class=
2122: "filename">/var/db/pkg</code>. It is therefore
2123: recommended that you choose a different location
2124: (e.g. <code xmlns=
2125: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2126: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2127: --pkgdbdir option to the bootstrap script.</p>
2128: </li>
2129:
2130: <li>
2131: <p>If you do not intend to use the FreeBSD ports
2132: tools, it's probably a good idea to move them out
2133: of the way to avoid confusion, e.g.</p>
2134: <pre class="screen">
1.14 xtraeme 2135: <code class="prompt">#</code> <strong class=
2136: "userinput"><code>cd /usr/sbin</code></strong>
2137: <code class="prompt">#</code> <strong class=
2138: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2139: <code class="prompt">#</code> <strong class=
2140: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2141: <code class="prompt">#</code> <strong class=
2142: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2143: <code class="prompt">#</code> <strong class=
2144: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2145: </pre>
2146: </li>
2147:
2148: <li>
1.45 wiz 2149: <p>An example <code xmlns=
2150: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2151: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2152: placed in <code xmlns=
2153: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2154: "filename">/etc/mk.conf.example</code> file when
2155: you use the bootstrap script.</p>
1.1 grant 2156: </li>
2157: </ol>
2158: </div>
2159: </div>
2160:
1.57 ! minskim 2161: <div class="sect2" lang="en">
1.1 grant 2162: <div class="titlepage">
2163: <div>
2164: <div>
1.57 ! minskim 2165: <h3 class="title"><a name=
1.30 wiz 2166: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2167: </div>
2168: </div>
2169: </div>
2170:
1.47 reed 2171: <p>Interix is a POSIX-compatible subsystem for the
1.1 grant 2172: Windows NT kernel, providing a Unix-like environment
2173: with a tighter kernel integration than available with
2174: Cygwin. It is part of the Windows Services for Unix
2175: package, available for free for any licensed copy of
1.22 tv 2176: Windows 2000, XP (not including XP Home), or 2003. SFU
2177: can be downloaded from <a href=
2178: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2179: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2180:
2181: <p>Services for Unix 3.5, current as of this writing,
2182: has been tested. 3.0 or 3.1 may work, but are not
2183: officially supported. (The main difference in 3.0/3.1
2184: is lack of pthreads.)</p>
2185:
1.57 ! minskim 2186: <div class="sect3" lang="en">
1.1 grant 2187: <div class="titlepage">
2188: <div>
2189: <div>
2190: <h4 class="title"><a name=
2191: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2192: installing Interix/SFU</h4>
1.1 grant 2193: </div>
2194: </div>
2195: </div>
2196:
2197: <p>At an absolute minimum, the following packages
2198: must be installed from the Windows Services for Unix
2199: 3.5 distribution in order to use pkgsrc:</p>
2200:
2201: <div class="itemizedlist">
2202: <ul type="disc">
2203: <li>
2204: <p>Utilities -> Base Utilities</p>
2205: </li>
2206:
2207: <li>
2208: <p>Interix GNU Components -> (all)</p>
2209: </li>
2210:
2211: <li>
2212: <p>Remote Connectivity</p>
2213: </li>
2214:
2215: <li>
2216: <p>Interix SDK</p>
2217: </li>
2218: </ul>
2219: </div>
2220:
2221: <p>When using pkgsrc on Interix, DO NOT install the
2222: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2223: without shared module support, installed to
2224: /usr/local, and will only cause confusion. Instead,
2225: install Perl 5.8 from pkgsrc (or from a binary
2226: package).</p>
2227:
2228: <p>The Remote Connectivity subcomponent "Windows
2229: Remote Shell Service" does not need to be installed,
2230: but Remote Connectivity itself should be installed in
2231: order to have a working inetd.</p>
2232:
1.52 tv 2233: <p>During installation you may be asked whether to
2234: enable setuid behavior for Interix programs, and
2235: whether to make pathnames default to case-sensitive.
2236: Setuid should be enabled, and case-sensitivity MUST
2237: be enabled. (Without case-sensitivity, a large number
2238: of packages including perl will not build.)</p>
2239:
2240: <p>NOTE: Newer Windows service packs change the way
2241: binary execution works (via the Data Execution
2242: Prevention feature). In order to use pkgsrc and other
2243: gcc-compiled binaries reliably, a hotfix containing
2244: POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
2245: (899522 or newer) must be installed. Hotfixes are
2246: available from Microsoft through a support contract;
2247: however, a NetBSD developer has made most Interix
2248: hotfixes available for personal use from <a href=
2249: "http://www.duh.org/interix/hotfixes.php" target=
2250: "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1 grant 2251: </div>
2252:
1.57 ! minskim 2253: <div class="sect3" lang="en">
1.1 grant 2254: <div class="titlepage">
2255: <div>
2256: <div>
2257: <h4 class="title"><a name=
2258: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2259: to do if Interix/SFU is already installed</h4>
2260: </div>
2261: </div>
2262: </div>
2263:
2264: <p>If SFU is already installed and you wish to alter
2265: these settings to work with pkgsrc, note the
2266: following things.</p>
2267:
2268: <div class="itemizedlist">
2269: <ul type="disc">
2270: <li>
2271: <p>To uninstall UNIX Perl, use Add/Remove
2272: Programs, select Microsoft Windows Services for
2273: UNIX, then click Change. In the installer,
2274: choose Add or Remove, then uncheck
2275: Utilities->UNIX Perl.</p>
2276: </li>
2277:
2278: <li>
1.47 reed 2279: <p>To enable case-sensitivity for the file
2280: system, run REGEDIT.EXE, and change the
1.1 grant 2281: following registry key:</p>
2282:
2283: <p>
2284: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2285: Manager\kernel</p>
2286:
2287: <p>Set the DWORD value "obcaseinsensitive" to
2288: 0; then reboot.</p>
2289: </li>
2290:
2291: <li>
2292: <p>To enable setuid binaries (optional), run
2293: REGEDIT.EXE, and change the following registry
2294: key:</p>
2295:
2296: <p>
2297: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2298: for UNIX</p>
2299:
2300: <p>Set the DWORD value "EnableSetuidBinaries"
2301: to 1; then reboot.</p>
2302: </li>
2303: </ul>
2304: </div>
2305: </div>
2306:
1.57 ! minskim 2307: <div class="sect3" lang="en">
1.1 grant 2308: <div class="titlepage">
2309: <div>
2310: <div>
2311: <h4 class="title"><a name=
2312: "platform.interix-notes"></a>3.2.3.3. Important
2313: notes for using pkgsrc</h4>
2314: </div>
2315: </div>
2316: </div>
2317:
1.52 tv 2318: <p>The package manager (either the pkgsrc "su" user,
1.1 grant 2319: or the user running "pkg_add") must be a member of
2320: the local Administrators group. Such a user must also
2321: be used to run the bootstrap. This is slightly
2322: relaxed from the normal pkgsrc requirement of
2323: "root".</p>
2324:
2325: <p>The package manager should use a umask of 002.
2326: "make install" will automatically complain if this is
2327: not the case. This ensures that directories written
2328: in /var/db/pkg are Administrators-group
2329: writeable.</p>
2330:
2331: <p>The popular Interix binary packages from
2332: http://www.interopsystems.com/ use an older version
2333: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2334: used in conjunction with pkgsrc. If you choose to use
2335: them at the same time as the pkgsrc packages, ensure
2336: that you use the proper pkg_* tools for each type of
2337: binary package.</p>
1.22 tv 2338:
2339: <p>The TERM setting used for DOS-type console windows
2340: (including those invoked by the csh and ksh startup
2341: shortcuts) is "interix". Most systems don't have a
2342: termcap/terminfo entry for it, but the following
2343: .termcap entry provides adequate emulation in most
2344: cases:</p>
2345: <pre class="programlisting">
1.51 rillig 2346: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22 tv 2347: </pre>
1.1 grant 2348: </div>
1.52 tv 2349:
1.57 ! minskim 2350: <div class="sect3" lang="en">
1.52 tv 2351: <div class="titlepage">
2352: <div>
2353: <div>
2354: <h4 class="title"><a name=
2355: "platform.interix-limits"></a>3.2.3.4. Limitations
2356: of the Interix platform</h4>
2357: </div>
2358: </div>
2359: </div>
2360:
2361: <p>Though Interix suffices as a familiar and flexible
2362: substitute for a full Unix-like platform, it has some
2363: drawbacks that should be noted for those desiring to
2364: make the most of Interix.</p>
2365:
2366: <div class="itemizedlist">
2367: <ul type="disc">
2368: <li>
1.54 tv 2369: <p><span class=
1.57 ! minskim 2370: "strong"><strong>X11:</strong></span></p>
1.52 tv 2371:
2372: <p>Interix comes with the standard set of X11R6
1.57 ! minskim 2373: client libraries, and can run X11 based
1.52 tv 2374: applications, but it does <span class=
2375: "emphasis"><em>not</em></span> come with an X
2376: server. Some options are <a href=
2377: "http://www.starnet.com/products/xwin32/"
2378: target="_top">StarNet X-Win32</a>, <a href=
2379: "http://connectivity.hummingbird.com/products/nc/exceed/"
1.57 ! minskim 2380: target="_top">Hummingbird Exceed</a> (available
! 2381: in a trimmed version for Interix from Interop
! 2382: Systems as the <a href=
! 2383: "http://www.interopsystems.com/InteropXserver.htm"
! 2384: target="_top">Interop X Server</a>), and the
! 2385: free X11 server included with <a href=
1.52 tv 2386: "http://x.cygwin.com/" target=
2387: "_top">Cygwin</a>.</p>
2388:
2389: <p>Also, StarNet Communications has graciously
2390: provided a free version of their X-Win32
2391: product that accepts connections only from
2392: localhost: <a href=
2393: "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
2394: target="_top">X-Win32 LX</a>, recommended by
2395: the maintainer of Interix pkgsrc support.</p>
2396: </li>
2397:
2398: <li>
1.57 ! minskim 2399: <p><span class="strong"><strong>X11
1.54 tv 2400: acceleration:</strong></span></p>
1.52 tv 2401:
2402: <p>Because Interix runs in a completely
2403: different NT subsystem from Win32 applications,
2404: it does not currently support various X11
2405: protocol extensions for acceleration (such as
2406: MIT-SHM or DGA). Most interactive applications
2407: to a local X server will run reasonably fast,
2408: but full motion video and other graphics
2409: intensive applications may require a
2410: faster-than-expected CPU.</p>
2411: </li>
2412:
2413: <li>
1.54 tv 2414: <p><span class=
2415: "strong"><strong>Audio:</strong></span></p>
1.52 tv 2416:
2417: <p>Interix has no native support for audio
1.53 tv 2418: output. For audio support, pkgsrc uses the
2419: <span><strong class=
1.52 tv 2420: "command">esound</strong></span> client/server
2421: audio system on Interix. Unlike on most
2422: platforms, the <a xmlns=
2423: "http://www.w3.org/TR/xhtml1/transitional"
2424: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
2425: target="_top"><code xmlns="" class=
2426: "filename">audio/esound</code></a> package does
2427: <span class="emphasis"><em>not</em></span>
2428: contain the <span><strong class=
1.53 tv 2429: "command">esd</strong></span> server component.
2430: To output audio via an Interix host, the
2431: <a xmlns=
1.52 tv 2432: "http://www.w3.org/TR/xhtml1/transitional"
2433: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
2434: target="_top"><code xmlns="" class=
2435: "filename">emulators/cygwin_esound</code></a>
2436: package must also be installed.</p>
2437: </li>
2438:
2439: <li>
1.54 tv 2440: <p><span class="strong"><strong>CD/DVDs, USB,
2441: and SCSI:</strong></span></p>
1.52 tv 2442:
2443: <p>Direct device access is not currently
2444: supported in Interix, so it is not currently
2445: possible to access CD/DVD drives, USB devices,
2446: or SCSI devices through non-filesystem means.
2447: Among other things, this makes it impossible to
2448: use Interix directly for CD/DVD burning.</p>
2449: </li>
2450:
2451: <li>
1.54 tv 2452: <p><span class="strong"><strong>Tape
2453: drives:</strong></span></p>
1.52 tv 2454:
2455: <p>Due to the same limitations as for CD-ROMs
2456: and SCSI devices, tape drives are also not
2457: directly accessible in Interix. However,
2458: support is in work to make tape drive access
2459: possible by using Cygwin as a bridge (similarly
2460: to audio bridged via Cygwin's esound
2461: server).</p>
2462: </li>
2463: </ul>
2464: </div>
2465: </div>
2466:
1.57 ! minskim 2467: <div class="sect3" lang="en">
1.52 tv 2468: <div class="titlepage">
2469: <div>
2470: <div>
2471: <h4 class="title"><a name=
2472: "platform.interix-knownissues"></a>3.2.3.5. Known
2473: issues for pkgsrc on Interix</h4>
2474: </div>
2475: </div>
2476: </div>
2477:
2478: <p>It is not necessary, in general, to have a "root"
2479: user on the Windows system; any member of the local
2480: Administrators group will suffice. However, some
2481: packages currently assume that the user named "root"
2482: is the privileged user. To accommodate these, you may
2483: create such a user; make sure it is in the local
2484: group Administrators (or your language
2485: equivalent).</p>
2486:
2487: <p>"pkg_add" creates directories of mode 0755, not
2488: 0775, in $PKG_DBDIR. For the time being, install
2489: packages as the local Administrator (or your language
2490: equivalent), or run the following command after
2491: installing a package to work around the issue:</p>
2492: <pre class="screen">
2493: <code class="prompt">#</code> <strong class=
2494: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
2495: </pre>
2496: </div>
1.1 grant 2497: </div>
2498:
1.57 ! minskim 2499: <div class="sect2" lang="en">
1.1 grant 2500: <div class="titlepage">
2501: <div>
2502: <div>
1.57 ! minskim 2503: <h3 class="title"><a name=
1.30 wiz 2504: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2505: </div>
2506: </div>
2507: </div>
2508:
2509: <p>You will need a working C compiler, either gcc or
2510: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2511: the <code class="varname">CC</code> environment
2512: variable according to your preference. If you do not
2513: have a license for the MIPSpro compiler suite, you can
1.1 grant 2514: download a gcc tardist file from <a href=
2515: "http://freeware.sgi.com/" target=
2516: "_top">http://freeware.sgi.com/</a>.</p>
2517:
2518: <p>Please note that you will need IRIX 6.5.17 or
2519: higher, as this is the earliest version of IRIX
1.24 wiz 2520: providing support for <a href=
2521: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2522: <span class="citerefentry"><span class=
2523: "refentrytitle">if_indextoname</span>(3)</span></a>,
2524: <a href=
2525: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2526: <span class="citerefentry"><span class=
2527: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2528: etc.</p>
1.1 grant 2529:
1.27 rillig 2530: <p>At this point in time, pkgsrc only supports one ABI
2531: at a time. That is, you can not switch between the old
2532: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2533: you start out using "abi=n32", that's what all your
2534: packages will be built with.</p>
1.1 grant 2535:
2536: <p>Therefore, please make sure that you have no
1.14 xtraeme 2537: conflicting <code class="varname">CFLAGS</code> in your
1.45 wiz 2538: environment or the <code xmlns=
2539: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2540: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2541: that you do not try to link n32 object files with lib64
1.45 wiz 2542: or vice versa. Check your <code xmlns=
2543: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2544: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2545:
2546: <p>If you have the actual pkgsrc tree mounted via NFS
2547: from a different host, please make sure to set
1.14 xtraeme 2548: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2549: directory, as it appears that IRIX linker occasionally
1.47 reed 2550: runs into issues when trying to link over a
2551: network-mounted file system.</p>
1.1 grant 2552:
2553: <p>The bootstrapping process should set all the right
2554: options for programs such as imake(1), but you may want
2555: to set some options depending on your local setup.
1.45 wiz 2556: Please see <code xmlns=
2557: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2558: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2559: course, your compiler's man pages for details.</p>
1.22 tv 2560:
2561: <p>If you are using SGI's MIPSPro compiler, please
2562: set</p>
2563: <pre class="programlisting">
1.51 rillig 2564: PKGSRC_COMPILER= mipspro
1.22 tv 2565: </pre>
2566:
1.45 wiz 2567: <p>in <code xmlns=
2568: "http://www.w3.org/TR/xhtml1/transitional" class=
2569: "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
2570: assume you are using gcc and may end up passing invalid
2571: flags to the compiler. Note that bootstrap should
2572: create an appropriate <code xmlns=
2573: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2574: "filename">mk.conf.example</code> by default.</p>
2575:
2576: <p>If you have both the MIPSPro compiler chain
2577: installed as well as gcc, but want to make sure that
2578: MIPRPro is used, please set your <code class=
2579: "varname">PATH</code> to <span class=
2580: "emphasis"><em>not</em></span> include the location of
1.45 wiz 2581: gcc (often <code xmlns=
2582: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2583: "filename">/usr/freeware/bin</code>), and (important)
2584: pass the '--preserve-path' flag.</p>
1.1 grant 2585: </div>
2586:
1.57 ! minskim 2587: <div class="sect2" lang="en">
1.1 grant 2588: <div class="titlepage">
2589: <div>
2590: <div>
1.57 ! minskim 2591: <h3 class="title"><a name=
1.30 wiz 2592: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2593: </div>
2594: </div>
2595: </div>
2596:
2597: <p>Some versions of Linux (for example Debian
2598: GNU/Linux) need either libtermcap or libcurses
2599: (libncurses). Installing the distributions
2600: libncurses-dev package (or equivalent) should fix the
2601: problem.</p>
2602:
2603: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2604: and icc (Intel C++ Compiler). gcc is the default. icc
2605: 8.0 and 8.1 on i386 have been tested.</p>
2606:
2607: <p>To bootstrap using icc, assuming the default icc
2608: installation directory:</p>
2609: <pre class="programlisting">
1.51 rillig 2610: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2611: ac_cv___attribute__=yes ./bootstrap
1.22 tv 2612: </pre>
2613:
2614: <div class="note" style=
2615: "margin-left: 0.5in; margin-right: 0.5in;">
2616: <h3 class="title">Note</h3>
2617:
2618: <p>icc 8.1 needs the `-i-static' argument instead of
2619: -static-libcxa.</p>
2620: </div>
2621:
2622: <p>icc supports __attribute__, but the GNU configure
2623: test uses a nested function, which icc does not
2624: support. #undef'ing __attribute__ has the unfortunate
2625: side-effect of breaking many of the Linux header files,
2626: which cannot be compiled properly without
2627: __attribute__. The test must be overridden so that
2628: __attribute__ is assumed supported by the compiler.</p>
2629:
2630: <p>After bootstrapping, you should set <code class=
1.45 wiz 2631: "varname">PKGSRC_COMPILER</code> in <code xmlns=
2632: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2633: "filename">/etc/mk.conf</code>:</p>
2634: <pre class="programlisting">
1.51 rillig 2635: PKGSRC_COMPILER= icc
1.22 tv 2636: </pre>
2637:
2638: <p>The default installation directory for icc is
1.45 wiz 2639: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2640: class="filename">/opt/intel_cc_80</code>, which is also
2641: the pkgsrc default. If you have installed it into a
2642: different directory, set <code class=
2643: "varname">ICCBASE</code> in <code xmlns=
2644: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2645: "filename">/etc/mk.conf</code>:</p>
2646: <pre class="programlisting">
1.51 rillig 2647: ICCBASE= /opt/icc
1.22 tv 2648: </pre>
2649:
2650: <p>pkgsrc uses the static linking method of the runtime
2651: libraries provided by icc, so binaries can be run on
2652: other systems which do not have the shared libraries
2653: installed.</p>
2654:
2655: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2656: the <a href=
2657: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2658: <span class="citerefentry"><span class=
2659: "refentrytitle">ld</span>(1)</span></a> command run
2660: when linking a C++ shared library and records it,
2661: throwing away the -Bstatic and -Bdynamic options
2662: interspersed between the libraries. This means that
2663: libtool-linked C++ shared libraries will have a runtime
2664: dependency on the icc libraries until this is fixed in
2665: libtool.</p>
1.22 tv 2666: </div>
2667:
1.57 ! minskim 2668: <div class="sect2" lang="en">
1.22 tv 2669: <div class="titlepage">
2670: <div>
2671: <div>
1.57 ! minskim 2672: <h3 class="title"><a name=
1.30 wiz 2673: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2674: </div>
2675: </div>
2676: </div>
2677:
2678: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2679:
2680: <p>Care should be taken so that the tools that this kit
2681: installs do not conflict with the OpenBSD userland
2682: tools. There are several steps:</p>
2683:
2684: <div class="orderedlist">
2685: <ol type="1">
2686: <li>
2687: <p>OpenBSD stores its ports pkg database in
1.45 wiz 2688: <code xmlns=
2689: "http://www.w3.org/TR/xhtml1/transitional" class=
2690: "filename">/var/db/pkg</code>. It is therefore
2691: recommended that you choose a different location
2692: (e.g. <code xmlns=
2693: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2694: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2695: --pkgdbdir option to the bootstrap script.</p>
2696: </li>
2697:
2698: <li>
2699: <p>If you do not intend to use the OpenBSD ports
2700: tools, it's probably a good idea to move them out
2701: of the way to avoid confusion, e.g.</p>
2702: <pre class="screen">
1.14 xtraeme 2703: <code class="prompt">#</code> <strong class=
2704: "userinput"><code>cd /usr/sbin</code></strong>
2705: <code class="prompt">#</code> <strong class=
2706: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2707: <code class="prompt">#</code> <strong class=
2708: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2709: <code class="prompt">#</code> <strong class=
2710: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2711: <code class="prompt">#</code> <strong class=
2712: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2713: </pre>
2714: </li>
2715:
2716: <li>
1.45 wiz 2717: <p>An example <code xmlns=
2718: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2719: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2720: placed in <code xmlns=
2721: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2722: "filename">/etc/mk.conf.example</code> file when
2723: you use the bootstrap script. OpenBSD's make
1.45 wiz 2724: program uses <code xmlns=
2725: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2726: "filename">/etc/mk.conf</code> as well. You can
1.47 reed 2727: work around this by enclosing all the
2728: pkgsrc-specific parts of the file with:</p>
1.1 grant 2729: <pre class="programlisting">
1.51 rillig 2730: .ifdef BSD_PKG_MK
2731: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
2732: .else
2733: # OpenBSD stuff
2734: .endif
1.1 grant 2735: </pre>
2736: </li>
2737: </ol>
2738: </div>
2739: </div>
2740:
1.57 ! minskim 2741: <div class="sect2" lang="en">
1.1 grant 2742: <div class="titlepage">
2743: <div>
2744: <div>
1.57 ! minskim 2745: <h3 class="title"><a name=
1.30 wiz 2746: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2747: </div>
2748: </div>
2749: </div>
2750:
2751: <p>Solaris 2.6 through 9 are supported on both x86 and
2752: sparc. You will need a working C compiler. Both gcc
2753: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2754:
2755: <p>The following packages are required on Solaris 8 for
2756: the bootstrap process and to build packages.</p>
2757:
2758: <div class="itemizedlist">
2759: <ul type="disc">
2760: <li>
2761: <p>SUNWsprot</p>
2762: </li>
2763:
2764: <li>
2765: <p>SUNWarc</p>
2766: </li>
2767:
2768: <li>
2769: <p>SUNWbtool</p>
2770: </li>
2771:
2772: <li>
2773: <p>SUNWtoo</p>
2774: </li>
2775:
2776: <li>
2777: <p>SUNWlibm</p>
2778: </li>
2779: </ul>
2780: </div>
2781:
2782: <p>Please note the use of GNU binutils on Solaris is
2783: <span class="emphasis"><em>not</em></span>
2784: supported.</p>
2785:
1.57 ! minskim 2786: <div class="sect3" lang="en">
1.1 grant 2787: <div class="titlepage">
2788: <div>
2789: <div>
1.57 ! minskim 2790: <h4 class="title"><a name=
! 2791: "solaris-gcc-note"></a>3.2.7.1. If you are
! 2792: using gcc</h4>
1.1 grant 2793: </div>
2794: </div>
2795: </div>
2796:
2797: <p>It makes life much simpler if you only use the
2798: same gcc consistently for building all packages.</p>
2799:
2800: <p>It is recommended that an external gcc be used
2801: only for bootstrapping, then either build gcc from
2802: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2803: href=
2804: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45 wiz 2805: target="_top"><code xmlns="" class=
2806: "filename">lang/gcc</code></a> or install a binary
2807: gcc package, then remove gcc used during
1.20 ben 2808: bootstrapping.</p>
1.1 grant 2809:
2810: <p>Binary packages of gcc can be found through
2811: <a href=
2812: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2813: target=
2814: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2815: </div>
2816:
1.57 ! minskim 2817: <div class="sect3" lang="en">
1.1 grant 2818: <div class="titlepage">
2819: <div>
2820: <div>
1.30 wiz 2821: <h4 class="title"><a name=
2822: "solaris-sun-workshop-note"></a>3.2.7.2. If
2823: you are using Sun WorkShop</h4>
1.1 grant 2824: </div>
2825: </div>
2826: </div>
2827:
2828: <p>You will need at least the following packages
2829: installed (from WorkShop 5.0)</p>
2830:
2831: <div class="itemizedlist">
2832: <ul type="disc">
2833: <li>
2834: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2835: </li>
2836:
2837: <li>
2838: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2839: </li>
2840:
2841: <li>
2842: <p>SPROild - Sun WorkShop Incremental
2843: Linker</p>
2844: </li>
2845:
2846: <li>
2847: <p>SPROlang - Sun WorkShop Compilers common
2848: components</p>
2849: </li>
2850: </ul>
2851: </div>
2852:
1.14 xtraeme 2853: <p>You should set <code class="varname">CC</code>,
2854: <code class="varname">CXX</code> and optionally,
1.45 wiz 2855: <code class="varname">CPP</code> in <code xmlns=
2856: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2857: "filename">/etc/mk.conf</code>, e.g.:</p>
1.1 grant 2858: <pre class="programlisting">
1.51 rillig 2859: CC= cc
2860: CXX= CC
2861: CPP= /usr/ccs/lib/cpp
1.1 grant 2862: </pre>
2863:
2864: <p>You may also want to build 64-bit binaries,
1.47 reed 2865: e.g.:</p>
1.1 grant 2866: <pre class="programlisting">
1.51 rillig 2867: CFLAGS= -xtarget=ultra -xarch=v9
1.1 grant 2868: </pre>
2869:
2870: <p>Whichever compiler you use, please ensure the
2871: compiler tools and your $prefix are in your
1.14 xtraeme 2872: <code class="varname">PATH</code>. This includes
1.45 wiz 2873: <code xmlns=
2874: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2875: "filename">/usr/ccs/{bin,lib}</code> and e.g.
1.45 wiz 2876: <code xmlns=
2877: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2878: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2879: </div>
2880: </div>
2881: </div>
2882: </div>
2883:
1.57 ! minskim 2884: <div class="chapter" lang="en">
1.1 grant 2885: <div class="titlepage">
2886: <div>
2887: <div>
1.57 ! minskim 2888: <h2 class="title"><a name=
1.1 grant 2889: "using"></a>Chapter 4. Using pkgsrc</h2>
2890: </div>
2891: </div>
2892: </div>
2893:
2894: <div class="toc">
2895: <p><b>Table of Contents</b></p>
2896:
2897: <dl>
2898: <dt><span class="sect1"><a href="#getting-started">4.1.
2899: Working with binary packages</a></span></dt>
2900:
2901: <dd>
2902: <dl>
1.30 wiz 2903: <dt><span class="sect2"><a href=
2904: "#where-to-get-binary-packages">4.1.1. Where to get
2905: binary packages</a></span></dt>
1.1 grant 2906:
1.30 wiz 2907: <dt><span class="sect2"><a href=
2908: "#how-to-use-binary-packages">4.1.2. How to use
2909: binary packages</a></span></dt>
1.1 grant 2910:
1.30 wiz 2911: <dt><span class="sect2"><a href=
2912: "#a-word-of-warning">4.1.3. A word of
2913: warning</a></span></dt>
1.1 grant 2914: </dl>
2915: </dd>
2916:
1.30 wiz 2917: <dt><span class="sect1"><a href=
2918: "#building-packages-from-source">4.2. Building packages
2919: from source</a></span></dt>
1.1 grant 2920:
2921: <dd>
2922: <dl>
1.30 wiz 2923: <dt><span class="sect2"><a href=
2924: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 2925:
1.30 wiz 2926: <dt><span class="sect2"><a href=
2927: "#fetching-distfiles">4.2.2. Fetching
2928: distfiles</a></span></dt>
1.1 grant 2929:
1.30 wiz 2930: <dt><span class="sect2"><a href=
2931: "#how-to-build-and-install">4.2.3. How to build and
2932: install</a></span></dt>
1.1 grant 2933:
1.30 wiz 2934: <dt><span class="sect2"><a href=
2935: "#selecting-the-compiler">4.2.4. Selecting the
2936: compiler</a></span></dt>
1.1 grant 2937: </dl>
2938: </dd>
2939: </dl>
2940: </div>
2941:
1.57 ! minskim 2942: <div class="sect1" lang="en">
1.1 grant 2943: <div class="titlepage">
2944: <div>
2945: <div>
2946: <h2 class="title" style="clear: both"><a name=
2947: "getting-started"></a>4.1. Working with binary
2948: packages</h2>
2949: </div>
2950: </div>
2951: </div>
2952:
2953: <p>This section describes how to find, retrieve and
2954: install a precompiled binary package that someone else
2955: already prepared for your type of machine.</p>
2956:
1.57 ! minskim 2957: <div class="sect2" lang="en">
1.1 grant 2958: <div class="titlepage">
2959: <div>
2960: <div>
1.30 wiz 2961: <h3 class="title"><a name=
2962: "where-to-get-binary-packages"></a>4.1.1. Where
2963: to get binary packages</h3>
1.1 grant 2964: </div>
2965: </div>
2966: </div>
2967:
2968: <p>Precompiled packages are stored on ftp.NetBSD.org
1.45 wiz 2969: and its mirrors in the directory <code xmlns=
2970: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2971: "filename">/pub/NetBSD/packages/<OSVERSION>/<ARCH>/</code>
2972: for anonymous FTP access. <code class=
2973: "varname">OSVERSION</code> is the NetBSD version
2974: (<span><strong class="command">uname
2975: -r</strong></span>), <code class="varname">ARCH</code>
2976: is the architecture (<span><strong class=
2977: "command">uname -p</strong></span>). In that directory,
2978: there is a subdirectory for each category plus a
1.45 wiz 2979: subdirectory <code xmlns=
2980: "http://www.w3.org/TR/xhtml1/transitional" class=
2981: "filename">All</code> which includes the actual
2982: binaries in <code xmlns=
2983: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2984: "filename">.tgz</code> files. The category
2985: subdirectories use symbolic links to those files (this
1.45 wiz 2986: is the same directory layout as in <code xmlns=
2987: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2988: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2989:
1.47 reed 2990: <p>This same directory layout applies for CD-ROM
1.1 grant 2991: distributions, only that the directory may be rooted
1.45 wiz 2992: somewhere else, probably somewhere below <code xmlns=
2993: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2994: "filename">/cdrom</code>. Please consult your CD-ROMs
1.1 grant 2995: documentation for the exact location.</p>
2996: </div>
2997:
1.57 ! minskim 2998: <div class="sect2" lang="en">
1.1 grant 2999: <div class="titlepage">
3000: <div>
3001: <div>
1.30 wiz 3002: <h3 class="title"><a name=
3003: "how-to-use-binary-packages"></a>4.1.2. How
3004: to use binary packages</h3>
1.1 grant 3005: </div>
3006: </div>
3007: </div>
3008:
1.47 reed 3009: <p>If you have the files on a CD-ROM or downloaded them
1.23 wiz 3010: to your hard disk, you can install them with the
1.27 rillig 3011: following command (be sure to <span><strong class=
1.14 xtraeme 3012: "command">su</strong></span> to root first):</p>
1.1 grant 3013: <pre class="screen">
1.14 xtraeme 3014: <code class="prompt">#</code> <strong class=
3015: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 3016: </pre>
3017:
3018: <p>If you have FTP access and you don't want to
3019: download the packages via FTP prior to installation,
1.14 xtraeme 3020: you can do this automatically by giving
3021: <span><strong class="command">pkg_add</strong></span>
3022: an FTP URL:</p>
1.1 grant 3023: <pre class="screen">
1.14 xtraeme 3024: <code class="prompt">#</code> <strong class=
1.27 rillig 3025: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 3026: </pre>
3027:
1.27 rillig 3028: <p>Note that any prerequisite packages needed to run
3029: the package in question will be installed, too,
1.1 grant 3030: assuming they are present where you install from.</p>
3031:
1.23 wiz 3032: <p>To save some typing, you can set the <code class=
3033: "varname">PKG_PATH</code> environment variable to a
1.47 reed 3034: semicolon-separated list of paths (including remote
1.23 wiz 3035: URLs); trailing slashes are not allowed.</p>
3036:
1.45 wiz 3037: <p>Additionally to the <code xmlns=
3038: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 3039: "filename">All</code> directory there exists a
1.45 wiz 3040: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3041: class="filename">vulnerable</code> directory to which
3042: binary packages with known vulnerabilities are moved,
3043: since removing them could cause missing dependencies.
3044: To use these packages, add the <code xmlns=
3045: "http://www.w3.org/TR/xhtml1/transitional" class=
3046: "filename">vulnerable</code> directory to your
3047: <code class="varname">PKG_PATH</code>. However, you
3048: should run <a xmlns=
1.23 wiz 3049: "http://www.w3.org/TR/xhtml1/transitional" href=
3050: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 3051: target="_top"><code xmlns="" class=
3052: "filename">security/audit-packages</code></a>
1.47 reed 3053: regularly, especially after installing new packages,
3054: and verify that the vulnerabilities are acceptable for
3055: your configuration. An example <code class=
3056: "varname">PKG_PATH</code> would be: <code xmlns=
3057: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 3058: "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 3059: Please note that semicolon (';') is a shell
3060: meta-character, so you'll probably have to quote
3061: it.</p>
3062:
1.1 grant 3063: <p>After you've installed packages, be sure to have
1.45 wiz 3064: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3065: class="filename">/usr/pkg/bin</code> and <code xmlns=
3066: "http://www.w3.org/TR/xhtml1/transitional" class=
3067: "filename">/usr/pkg/sbin</code> in your <code class=
3068: "varname">PATH</code> so you can actually start the
3069: just installed program.</p>
1.1 grant 3070: </div>
3071:
1.57 ! minskim 3072: <div class="sect2" lang="en">
1.1 grant 3073: <div class="titlepage">
3074: <div>
3075: <div>
1.57 ! minskim 3076: <h3 class="title"><a name=
1.30 wiz 3077: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 3078: warning</h3>
3079: </div>
3080: </div>
3081: </div>
3082:
3083: <p>Please pay very careful attention to the warnings
3084: expressed in the <a href=
3085: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3086: <span class="citerefentry"><span class=
3087: "refentrytitle">pkg_add</span>(1)</span></a> manual
3088: page about the inherent dangers of installing binary
3089: packages which you did not create yourself, and the
3090: security holes that can be introduced onto your system
3091: by indiscriminate adding of such files.</p>
3092: </div>
3093: </div>
3094:
1.57 ! minskim 3095: <div class="sect1" lang="en">
1.1 grant 3096: <div class="titlepage">
3097: <div>
3098: <div>
3099: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3100: "building-packages-from-source"></a>4.2. Building
1.1 grant 3101: packages from source</h2>
3102: </div>
3103: </div>
3104: </div>
3105:
3106: <p>This assumes that the package is already in pkgsrc. If
3107: it is not, see <a href="#developers-guide" title=
1.46 gdt 3108: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 3109: “The pkgsrc developer's guide”</a> for
3110: instructions how to create your own packages.</p>
1.1 grant 3111:
1.57 ! minskim 3112: <div class="sect2" lang="en">
1.1 grant 3113: <div class="titlepage">
3114: <div>
3115: <div>
1.57 ! minskim 3116: <h3 class="title"><a name=
1.30 wiz 3117: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 3118: </div>
3119: </div>
3120: </div>
3121:
3122: <p>To build packages from source on a NetBSD system the
3123: “<span class="quote">comp</span>” and the
3124: “<span class="quote">text</span>”
3125: distribution sets must be installed. If you want to
1.47 reed 3126: build X11-related packages the “<span class=
1.1 grant 3127: "quote">xbase</span>” and “<span class=
3128: "quote">xcomp</span>” distribution sets are
3129: required, too.</p>
3130: </div>
3131:
1.57 ! minskim 3132: <div class="sect2" lang="en">
1.1 grant 3133: <div class="titlepage">
3134: <div>
3135: <div>
1.57 ! minskim 3136: <h3 class="title"><a name=
! 3137: "fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 3138: distfiles</h3>
3139: </div>
3140: </div>
3141: </div>
3142:
1.27 rillig 3143: <p>The first step for building a package is downloading
3144: the distfiles (i.e. the unmodified source). If they
3145: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 3146: automatically.</p>
3147:
3148: <p>You can overwrite some of the major distribution
3149: sites to fit to sites that are close to your own. Have
1.45 wiz 3150: a look at <code xmlns=
3151: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3152: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 3153: some examples — in particular, look for the
1.14 xtraeme 3154: <code class="varname">MASTER_SORT</code>, <code class=
3155: "varname">MASTER_SORT_REGEX</code> and <code class=
3156: "varname">INET_COUNTRY</code> definitions. This may
3157: save some of your bandwidth and time.</p>
1.1 grant 3158:
3159: <p>You can change these settings either in your shell's
3160: environment, or, if you want to keep the settings, by
1.45 wiz 3161: editing the <code xmlns=
3162: "http://www.w3.org/TR/xhtml1/transitional" class=
3163: "filename">/etc/mk.conf</code> file, and adding the
3164: definitions there.</p>
1.1 grant 3165:
3166: <p>If you don't have a permanent Internet connection
3167: and you want to know which files to download,
1.14 xtraeme 3168: <span><strong class="command">make
3169: fetch-list</strong></span> will tell you what you'll
1.45 wiz 3170: need. Put these distfiles into <code xmlns=
3171: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3172: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 3173: </div>
3174:
1.57 ! minskim 3175: <div class="sect2" lang="en">
1.1 grant 3176: <div class="titlepage">
3177: <div>
3178: <div>
1.30 wiz 3179: <h3 class="title"><a name=
3180: "how-to-build-and-install"></a>4.2.3. How to
3181: build and install</h3>
1.1 grant 3182: </div>
3183: </div>
3184: </div>
3185:
3186: <p>Assuming that the distfile has been fetched (see
3187: previous section), become root and change into the
1.47 reed 3188: relevant directory and run <span><strong class=
3189: "command">make</strong></span>.</p>
3190:
3191: <div class="note" style=
3192: "margin-left: 0.5in; margin-right: 0.5in;">
3193: <h3 class="title">Note</h3>
3194:
3195: <p>If using bootstrap or pkgsrc on a non-NetBSD
3196: system, use the pkgsrc <span><strong class=
3197: "command">bmake</strong></span> command instead of
3198: “<span class="quote">make</span>” in the
3199: examples in this guide.</p>
3200: </div>
3201:
3202: <p>For example, type</p>
1.1 grant 3203: <pre class="screen">
1.14 xtraeme 3204: <code class="prompt">%</code> <strong class=
3205: "userinput"><code>cd misc/figlet</code></strong>
3206: <code class="prompt">%</code> <strong class=
3207: "userinput"><code>make</code></strong>
1.1 grant 3208: </pre>
3209:
3210: <p>at the shell prompt to build the various components
3211: of the package, and</p>
3212: <pre class="screen">
1.14 xtraeme 3213: <code class="prompt">#</code> <strong class=
3214: "userinput"><code>make install</code></strong>
1.1 grant 3215: </pre>
3216:
3217: <p>to install the various components into the correct
3218: places on your system. Installing the package on your
3219: system requires you to be root. However, pkgsrc has a
3220: <span class="emphasis"><em>just-in-time-su</em></span>
3221: feature, which allows you to only become root for the
3222: actual installation step</p>
3223:
3224: <p>Taking the figlet utility as an example, we can
3225: install it on our system by building as shown in
3226: <a href="#logs" title=
1.57 ! minskim 3227: "Appendix B. Build logs">Appendix B,
! 3228: <i>Build logs</i></a>.</p>
1.1 grant 3229:
3230: <p>The program is installed under the default root of
1.45 wiz 3231: the packages tree - <code xmlns=
3232: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3233: "filename">/usr/pkg</code>. Should this not conform to
3234: your tastes, set the <code class=
3235: "varname">LOCALBASE</code> variable in your
1.1 grant 3236: environment, and it will use that value as the root of
1.45 wiz 3237: your packages tree. So, to use <code xmlns=
3238: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3239: "filename">/usr/local</code>, set <code class=
3240: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 3241: environment. Please note that you should use a
3242: directory which is dedicated to packages and not shared
1.47 reed 3243: with other programs (i.e., do not try and use
1.14 xtraeme 3244: <code class="varname">LOCALBASE=/usr</code>). Also, you
3245: should not try to add any of your own files or
1.45 wiz 3246: directories (such as <code xmlns=
3247: "http://www.w3.org/TR/xhtml1/transitional" class=
3248: "filename">src/</code>, <code xmlns=
3249: "http://www.w3.org/TR/xhtml1/transitional" class=
3250: "filename">obj/</code>, or <code xmlns=
3251: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3252: "filename">pkgsrc/</code>) below the <code class=
3253: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 3254: possible conflicts between programs and other files
3255: installed by the package system and whatever else may
3256: have been installed there.</p>
3257:
1.45 wiz 3258: <p>Some packages look in <code xmlns=
3259: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3260: "filename">/etc/mk.conf</code> to alter some
1.1 grant 3261: configuration options at build time. Have a look at
1.45 wiz 3262: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3263: class="filename">pkgsrc/mk/defaults/mk.conf</code> to
3264: get an overview of what will be set there by default.
1.14 xtraeme 3265: Environment variables such as <code class=
1.45 wiz 3266: "varname">LOCALBASE</code> can be set in <code xmlns=
3267: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3268: "filename">/etc/mk.conf</code> to save having to
3269: remember to set them each time you want to use
3270: pkgsrc.</p>
1.1 grant 3271:
3272: <p>Occasionally, people want to “<span class=
3273: "quote">look under the covers</span>” to see what
3274: is going on when a package is building or being
3275: installed. This may be for debugging purposes, or out
3276: of simple curiosity. A number of utility values have
3277: been added to help with this.</p>
3278:
3279: <div class="orderedlist">
3280: <ol type="1">
3281: <li>
3282: <p>If you invoke the <a href=
3283: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3284: <span class="citerefentry"><span class=
3285: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 3286: with <code class=
3287: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
3288: amount of information will be displayed. For
3289: example,</p>
1.1 grant 3290: <pre class="screen">
1.14 xtraeme 3291: <strong class=
3292: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 3293: </pre>
3294:
3295: <p>will show all the commands that are invoked,
3296: up to and including the “<span class=
3297: "quote">patch</span>” stage.</p>
3298: </li>
3299:
3300: <li>
3301: <p>If you want to know the value of a certain
1.22 tv 3302: <a href=
3303: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3304: <span class="citerefentry"><span class=
3305: "refentrytitle">make</span>(1)</span></a>
3306: definition, then the <code class=
1.14 xtraeme 3307: "varname">VARNAME</code> definition should be
3308: used, in conjunction with the show-var target.
3309: e.g. to show the expansion of the <a href=
1.1 grant 3310: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3311: <span class="citerefentry"><span class=
3312: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 3313: variable <code class=
1.22 tv 3314: "varname">LOCALBASE</code>:</p>
1.1 grant 3315: <pre class="screen">
1.14 xtraeme 3316: <code class="prompt">%</code> <strong class=
3317: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 3318: /usr/pkg
1.14 xtraeme 3319: <code class="prompt">%</code>
1.1 grant 3320:
3321: </pre>
3322: </li>
3323: </ol>
3324: </div>
3325:
3326: <p>If you want to install a binary package that you've
3327: either created yourself (see next section), that you
3328: put into pkgsrc/packages manually or that is located on
1.8 wiz 3329: a remote FTP server, you can use the "bin-install"
1.1 grant 3330: target. This target will install a binary package - if
3331: available - via <a href=
3332: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3333: <span class="citerefentry"><span class=
3334: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 3335: <span><strong class="command">make
3336: package</strong></span>. The list of remote FTP sites
3337: searched is kept in the variable <code class=
3338: "varname">BINPKG_SITES</code>, which defaults to
3339: ftp.NetBSD.org. Any flags that should be added to
3340: <a href=
1.1 grant 3341: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3342: <span class="citerefentry"><span class=
3343: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 3344: into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45 wiz 3345: See <code xmlns=
3346: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3347: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
3348: details.</p>
1.1 grant 3349:
1.47 reed 3350: <p>A final word of warning: If you set up a system that
1.14 xtraeme 3351: has a non-standard setting for <code class=
3352: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 3353: any packages are installed, as you can not use several
3354: directories for the same purpose. Doing so will result
3355: in pkgsrc not being able to properly detect your
3356: installed packages, and fail miserably. Note also that
3357: precompiled binary packages are usually built with the
1.14 xtraeme 3358: default <code class="varname">LOCALBASE</code> of
1.45 wiz 3359: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3360: class="filename">/usr/pkg</code>, and that you should
3361: <span class="emphasis"><em>not</em></span> install any
3362: if you use a non-standard <code class=
1.14 xtraeme 3363: "varname">LOCALBASE</code>.</p>
1.1 grant 3364: </div>
3365:
1.57 ! minskim 3366: <div class="sect2" lang="en">
1.1 grant 3367: <div class="titlepage">
3368: <div>
3369: <div>
1.30 wiz 3370: <h3 class="title"><a name=
3371: "selecting-the-compiler"></a>4.2.4. Selecting
3372: the compiler</h3>
1.1 grant 3373: </div>
3374: </div>
3375: </div>
3376:
3377: <p>By default, pkgsrc will use GCC to build packages.
3378: This may be overridden by setting the following
3379: variables in /etc/mk.conf:</p>
3380:
3381: <div class="variablelist">
3382: <dl>
1.14 xtraeme 3383: <dt><span class="term"><code class=
3384: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3385:
3386: <dd>
3387: <p>This is a list of values specifying the chain
3388: of compilers to invoke when building packages.
3389: Valid values are:</p>
3390:
3391: <div class="itemizedlist">
3392: <ul type="disc">
3393: <li>
1.14 xtraeme 3394: <p><code class="varname">distcc</code>:
1.1 grant 3395: distributed C/C++ (chainable)</p>
3396: </li>
3397:
3398: <li>
1.14 xtraeme 3399: <p><code class="varname">ccache</code>:
1.1 grant 3400: compiler cache (chainable)</p>
3401: </li>
3402:
3403: <li>
1.14 xtraeme 3404: <p><code class="varname">gcc</code>: GNU
3405: C/C++ Compiler</p>
1.1 grant 3406: </li>
3407:
3408: <li>
1.14 xtraeme 3409: <p><code class="varname">mipspro</code>:
1.1 grant 3410: Silicon Graphics, Inc. MIPSpro
3411: (n32/n64)</p>
3412: </li>
3413:
3414: <li>
1.14 xtraeme 3415: <p><code class="varname">mipspro</code>:
1.1 grant 3416: Silicon Graphics, Inc. MIPSpro (o32)</p>
3417: </li>
3418:
3419: <li>
1.14 xtraeme 3420: <p><code class="varname">sunpro</code>:
1.1 grant 3421: Microsystems, Inc. WorkShip/Forte/Sun ONE
3422: Studio</p>
3423: </li>
3424: </ul>
3425: </div>
3426:
3427: <p>The default is “<span class=
1.14 xtraeme 3428: "quote"><code class=
3429: "varname">gcc</code></span>”. You can use
3430: <code class="varname">ccache</code> and/or
3431: <code class="varname">distcc</code> with an
3432: appropriate <code class=
3433: "varname">PKGSRC_COMPILER</code> setting, e.g.
3434: “<span class="quote"><code class=
3435: "varname">ccache gcc</code></span>”. This
1.1 grant 3436: variable should always be terminated with a value
3437: for a real compiler.</p>
3438: </dd>
3439:
1.14 xtraeme 3440: <dt><span class="term"><code class=
3441: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3442:
3443: <dd>
3444: <p>This specifies the minimum version of GCC to
3445: use when building packages. If the system GCC
3446: doesn't satisfy this requirement, then pkgsrc
3447: will build and install one of the GCC packages to
3448: use instead.</p>
3449: </dd>
3450: </dl>
3451: </div>
3452: </div>
3453: </div>
3454: </div>
3455:
1.57 ! minskim 3456: <div class="chapter" lang="en">
1.1 grant 3457: <div class="titlepage">
3458: <div>
3459: <div>
1.57 ! minskim 3460: <h2 class="title"><a name=
1.38 dillo 3461: "configuring"></a>Chapter 5. Configuring
3462: pkgsrc</h2>
3463: </div>
3464: </div>
3465: </div>
3466:
3467: <div class="toc">
3468: <p><b>Table of Contents</b></p>
3469:
3470: <dl>
3471: <dt><span class="sect1"><a href=
1.45 wiz 3472: "#general-configuration">5.1. General
3473: configuration</a></span></dt>
3474:
3475: <dt><span class="sect1"><a href=
3476: "#variables-affecting-build">5.2. Variables affecting
3477: the build process</a></span></dt>
3478:
3479: <dt><span class="sect1"><a href=
3480: "#developer-advanced-settings">5.3. Developer/advanced
3481: settings</a></span></dt>
3482:
3483: <dt><span class="sect1"><a href=
3484: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 3485: Options</a></span></dt>
1.38 dillo 3486: </dl>
3487: </div>
3488:
1.57 ! minskim 3489: <div class="sect1" lang="en">
1.38 dillo 3490: <div class="titlepage">
3491: <div>
3492: <div>
3493: <h2 class="title" style="clear: both"><a name=
1.45 wiz 3494: "general-configuration"></a>5.1. General
3495: configuration</h2>
3496: </div>
3497: </div>
3498: </div>
3499:
1.47 reed 3500: <p>In this section, you can find some variables that
3501: apply to all pkgsrc packages. The preferred method of
3502: setting these variables is by setting them in
3503: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3504: class="filename">/etc/mk.conf</code>.</p>
1.45 wiz 3505:
3506: <div class="itemizedlist">
3507: <ul type="disc">
3508: <li>
3509: <p><code class="varname">LOCALBASE</code>: Where
3510: packages will be installed. The default is
3511: <code xmlns=
3512: "http://www.w3.org/TR/xhtml1/transitional" class=
3513: "filename">/usr/pkg</code>. Do not mix binary
3514: packages with different <code class=
3515: "varname">LOCALBASE</code>s!</p>
3516: </li>
3517:
3518: <li>
3519: <p><code class="varname">CROSSBASE</code>: Where
3520: “<span class="quote">cross</span>”
3521: category packages will be installed. The default is
3522: <code xmlns=
3523: "http://www.w3.org/TR/xhtml1/transitional" class=
3524: "filename">${LOCALBASE}/cross</code>.</p>
3525: </li>
3526:
3527: <li>
3528: <p><code class="varname">X11BASE</code>: Where X11
3529: is installed on the system. The default is
3530: <code xmlns=
3531: "http://www.w3.org/TR/xhtml1/transitional" class=
3532: "filename">/usr/X11R6</code>.</p>
3533: </li>
3534:
3535: <li>
3536: <p><code class="varname">DISTDIR</code>: Where to
3537: store the downloaded copies of the original source
3538: distributions used for building pkgsrc packages.
3539: The default is <code xmlns=
3540: "http://www.w3.org/TR/xhtml1/transitional" class=
3541: "filename">${PKGSRCDIR}/distfiles</code>.</p>
3542: </li>
3543:
3544: <li>
3545: <p><code class=
3546: "varname">MASTER_SITE_OVERRIDE</code>: If set,
3547: override the packages' <code class=
3548: "varname">MASTER_SITES</code> with this value.</p>
3549: </li>
3550:
3551: <li>
3552: <p><code class="varname">MASTER_SITE_BACKUP</code>:
3553: Backup location(s) for distribution files and patch
3554: files if not found locally or in <code xmlns=
3555: "http://www.w3.org/TR/xhtml1/transitional" class=
3556: "filename">${MASTER_SITES}</code> or <code xmlns=
3557: "http://www.w3.org/TR/xhtml1/transitional" class=
3558: "filename">${PATCH_SITES}</code> respectively. The
3559: defaults are <code xmlns=
3560: "http://www.w3.org/TR/xhtml1/transitional" class=
3561: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
3562: and <code xmlns=
3563: "http://www.w3.org/TR/xhtml1/transitional" class=
3564: "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
3565: </li>
3566:
3567: <li>
3568: <p><code class="varname">BINPKG_SITES</code>: List
3569: of sites carrying binary pkgs.</p>
3570: </li>
3571: </ul>
3572: </div>
3573: </div>
3574:
1.57 ! minskim 3575: <div class="sect1" lang="en">
1.45 wiz 3576: <div class="titlepage">
3577: <div>
3578: <div>
3579: <h2 class="title" style="clear: both"><a name=
3580: "variables-affecting-build"></a>5.2. Variables
3581: affecting the build process</h2>
3582: </div>
3583: </div>
3584: </div>
3585:
3586: <p>XXX</p>
3587:
3588: <div class="itemizedlist">
3589: <ul type="disc">
3590: <li>
3591: <p><code class="varname">PACKAGES</code>: The top
3592: level directory for the binary packages. The
3593: default is <code xmlns=
3594: "http://www.w3.org/TR/xhtml1/transitional" class=
3595: "filename">${PKGSRCDIR}/packages</code>.</p>
3596: </li>
3597:
3598: <li>
3599: <p><code class="varname">WRKOBJDIR</code>: The top
3600: level directory where, if defined, the separate
3601: working directories will get created, and
3602: symbolically linked to from <code xmlns=
3603: "http://www.w3.org/TR/xhtml1/transitional" class=
3604: "filename">${WRKDIR}</code> (see below). This is
3605: useful for building packages on several
3606: architectures, then <code xmlns=
3607: "http://www.w3.org/TR/xhtml1/transitional" class=
3608: "filename">${PKGSRCDIR}</code> can be NFS-mounted
3609: while <code xmlns=
3610: "http://www.w3.org/TR/xhtml1/transitional" class=
3611: "filename">${WRKOBJDIR}</code> is local to every
3612: architecture. (It should be noted that <code class=
3613: "varname">PKGSRCDIR</code> should not be set by the
3614: user — it is an internal definition which
3615: refers to the root of the pkgsrc tree. It is
3616: possible to have many pkgsrc tree instances.)</p>
3617: </li>
3618:
3619: <li>
3620: <p><code class="varname">LOCALPATCHES</code>:
3621: Directory for local patches that aren't part of
3622: pkgsrc. See <a href="#components.patches" title=
3623: "8.3. patches/*">Section 8.3,
3624: “patches/*”</a> for more information.
3625: <em class="replaceable"><code>rel</code></em> and
3626: <em class="replaceable"><code>arch</code></em> are
3627: replaced with OS release (“<span class=
3628: "quote">2.0</span>”, etc.) and architecture
3629: (“<span class="quote">mipsel</span>”,
3630: etc.).</p>
3631: </li>
3632:
3633: <li>
3634: <p><code class="varname">PKGMAKECONF</code>:
3635: Location of the <code xmlns=
3636: "http://www.w3.org/TR/xhtml1/transitional" class=
3637: "filename">mk.conf</code> file used by a package's
3638: BSD-style Makefile. If this is not set,
3639: <code class="varname">MAKECONF</code> is set to
3640: <code xmlns=
3641: "http://www.w3.org/TR/xhtml1/transitional" class=
3642: "filename">/dev/null</code> to avoid picking up
3643: settings used by builds in <code xmlns=
3644: "http://www.w3.org/TR/xhtml1/transitional" class=
3645: "filename">/usr/src</code>.</p>
3646: </li>
3647: </ul>
3648: </div>
3649: </div>
3650:
1.57 ! minskim 3651: <div class="sect1" lang="en">
1.45 wiz 3652: <div class="titlepage">
3653: <div>
3654: <div>
3655: <h2 class="title" style="clear: both"><a name=
3656: "developer-advanced-settings"></a>5.3. Developer/advanced
3657: settings</h2>
3658: </div>
3659: </div>
3660: </div>
3661:
3662: <p>XXX</p>
3663:
3664: <div class="itemizedlist">
3665: <ul type="disc">
3666: <li>
3667: <p><code class="varname">PKG_DEVELOPER</code>: Run
3668: some sanity checks that package developers
3669: want:</p>
3670:
3671: <div class="itemizedlist">
3672: <ul type="circle">
3673: <li>
3674: <p>make sure patches apply with zero fuzz</p>
3675: </li>
3676:
3677: <li>
3678: <p>run check-shlibs to see that all binaries
3679: will find their shared libs.</p>
3680: </li>
3681: </ul>
3682: </div>
3683: </li>
3684:
3685: <li>
3686: <p><code class="varname">PKG_DEBUG_LEVEL</code>:
3687: The level of debugging output which is displayed
3688: whilst making and installing the package. The
3689: default value for this is 0, which will not display
3690: the commands as they are executed (normal, default,
3691: quiet operation); the value 1 will display all
3692: shell commands before their invocation, and the
3693: value 2 will display both the shell commands before
3694: their invocation, and their actual execution
3695: progress with <span><strong class="command">set
3696: -x</strong></span> will be displayed.</p>
3697: </li>
3698: </ul>
3699: </div>
3700: </div>
3701:
1.57 ! minskim 3702: <div class="sect1" lang="en">
1.45 wiz 3703: <div class="titlepage">
3704: <div>
3705: <div>
3706: <h2 class="title" style="clear: both"><a name=
3707: "selecting-build-options"></a>5.4. Selecting
3708: Build Options</h2>
1.38 dillo 3709: </div>
3710: </div>
3711: </div>
3712:
3713: <p>Some packages have build time options, usually to
3714: select between different dependencies, enable optional
3715: support for big dependencies or enable experimental
3716: features.</p>
3717:
3718: <p>To see which options, if any, a package supports, and
3719: which options are mutually exclusive, run
3720: <span><strong class="command">make
3721: show-options</strong></span>, for example:</p>
3722: <pre class="programlisting">
1.51 rillig 3723: The following options are supported by this package:
3724: ssl Enable SSL support.
3725: Exactly one of the following gecko options is required:
3726: firefox Use firefox as gecko rendering engine.
3727: mozilla Use mozilla as gecko rendering engine.
3728: At most one of the following database options may be selected:
3729: mysql Enable support for MySQL database.
3730: pgsql Enable support for PostgreSQL database.
3731:
3732: These options are enabled by default: firefox
3733: These options are currently enabled: mozilla ssl
1.38 dillo 3734: </pre>
3735:
1.45 wiz 3736: <p>The following variables can be defined in <code xmlns=
3737: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3738: "filename">/etc/mk.conf</code> to select which options to
3739: enable for a package: <code class=
3740: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
3741: to select or disable options for all packages that
3742: support them, and <code class=
3743: "varname">PKG_OPTIONS.<em class=
3744: "replaceable"><code>pkgbase</code></em></code>, which can
3745: be used to select or disable options specifically for
3746: package <em class=
3747: "replaceable"><code>pkgbase</code></em>. Options listed
3748: in these variables are selected, options preceded by
3749: “<span class="quote">-</span>” are
3750: disabled.</p>
3751:
1.39 dillo 3752: <p>The following settings are consulted in the order
3753: given, and the last setting that selects or disables an
3754: option is used:</p>
1.38 dillo 3755:
3756: <div class="orderedlist">
3757: <ol type="1">
3758: <li>
3759: <p>the default options as suggested by the package
3760: maintainer</p>
3761: </li>
3762:
3763: <li>
3764: <p>the options implied by the settings of legacy
3765: variables (see below)</p>
3766: </li>
3767:
3768: <li>
3769: <p><code class=
3770: "varname">PKG_DEFAULT_OPTIONS</code></p>
3771: </li>
3772:
3773: <li>
3774: <p><code class="varname">PKG_OPTIONS.<em class=
3775: "replaceable"><code>pkgbase</code></em></code></p>
3776: </li>
3777: </ol>
3778: </div>
3779:
3780: <p>For groups of mutually exclusive options, the last
3781: option selected is used, all others are automatically
3782: disabled. If an option of the group is explicitly
3783: disabled, the previously selected option, if any, is
3784: used. It is an error if no option from a required group
3785: of options is selected, and building the package will
3786: fail.</p>
3787:
3788: <p>Before the options framework was introduced, build
3789: options were selected by setting a variable in
1.45 wiz 3790: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3791: class="filename">/etc/mk.conf</code> for each option. To
3792: ease transition to the options framework for the user,
3793: these legacy variables are converted to the appropriate
3794: options setting automatically. A warning is issued to
3795: prompt the user to update <code xmlns=
3796: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3797: "filename">/etc/mk.conf</code> to use the options
3798: framework directly. Support for these legacy variables
3799: will be removed eventually.</p>
3800: </div>
3801: </div>
3802:
1.57 ! minskim 3803: <div class="chapter" lang="en">
1.38 dillo 3804: <div class="titlepage">
3805: <div>
3806: <div>
1.57 ! minskim 3807: <h2 class="title"><a name=
1.38 dillo 3808: "binary"></a>Chapter 6. Creating binary
1.1 grant 3809: packages</h2>
3810: </div>
3811: </div>
3812: </div>
3813:
3814: <div class="toc">
3815: <p><b>Table of Contents</b></p>
3816:
3817: <dl>
1.30 wiz 3818: <dt><span class="sect1"><a href=
1.38 dillo 3819: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 3820: single binary package</a></span></dt>
1.1 grant 3821:
1.30 wiz 3822: <dt><span class="sect1"><a href=
1.38 dillo 3823: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 3824: Settings for creation of binary
3825: packages</a></span></dt>
3826:
1.38 dillo 3827: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 3828: a bulk build of all packages</a></span></dt>
3829:
3830: <dd>
3831: <dl>
3832: <dt><span class="sect2"><a href=
1.38 dillo 3833: "#binary.configuration">6.3.1.
1.1 grant 3834: Configuration</a></span></dt>
3835:
1.30 wiz 3836: <dt><span class="sect2"><a href=
1.38 dillo 3837: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 3838: environmental considerations</a></span></dt>
1.1 grant 3839:
1.38 dillo 3840: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 3841: Operation</a></span></dt>
3842:
1.30 wiz 3843: <dt><span class="sect2"><a href=
1.38 dillo 3844: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 3845:
1.30 wiz 3846: <dt><span class="sect2"><a href=
1.38 dillo 3847: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 3848: requirements</a></span></dt>
1.1 grant 3849:
1.30 wiz 3850: <dt><span class="sect2"><a href=
1.38 dillo 3851: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47 reed 3852: for chrooted builds</a></span></dt>
1.1 grant 3853:
1.30 wiz 3854: <dt><span class="sect2"><a href=
1.38 dillo 3855: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 3856: set of packages</a></span></dt>
1.13 hubertf 3857:
3858: <dt><span class="sect2"><a href=
1.38 dillo 3859: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 3860: build</a></span></dt>
1.1 grant 3861: </dl>
3862: </dd>
3863:
1.38 dillo 3864: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 3865: Creating a multiple CD-ROM packages
3866: collection</a></span></dt>
3867:
3868: <dd>
3869: <dl>
1.30 wiz 3870: <dt><span class="sect2"><a href=
1.38 dillo 3871: "#cdpack-example">6.4.1. Example of
1.30 wiz 3872: cdpack</a></span></dt>
1.1 grant 3873: </dl>
3874: </dd>
3875: </dl>
3876: </div>
3877:
1.57 ! minskim 3878: <div class="sect1" lang="en">
1.1 grant 3879: <div class="titlepage">
3880: <div>
3881: <div>
3882: <h2 class="title" style="clear: both"><a name=
1.38 dillo 3883: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 3884: a single binary package</h2>
1.1 grant 3885: </div>
3886: </div>
3887: </div>
3888:
3889: <p>Once you have built and installed a package, you can
3890: create a <span class="emphasis"><em>binary
3891: package</em></span> which can be installed on another
3892: system with <a href=
3893: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3894: <span class="citerefentry"><span class=
1.47 reed 3895: "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1 grant 3896: having to build the same package on a group of hosts and
3897: wasting CPU time. It also provides a simple means for
3898: others to install your package, should you distribute
3899: it.</p>
3900:
3901: <p>To create a binary package, change into the
1.14 xtraeme 3902: appropriate directory in pkgsrc, and run
3903: <span><strong class="command">make
3904: package</strong></span>:</p>
1.1 grant 3905: <pre class="screen">
1.14 xtraeme 3906: <code class="prompt">#</code> <strong class=
3907: "userinput"><code>cd misc/figlet</code></strong>
3908: <code class="prompt">#</code> <strong class=
3909: "userinput"><code>make package</code></strong>
1.1 grant 3910: </pre>
3911:
3912: <p>This will build and install your package (if not
3913: already done), and then build a binary package from what
1.14 xtraeme 3914: was installed. You can then use the <span><strong class=
3915: "command">pkg_*</strong></span> tools to manipulate it.
1.45 wiz 3916: Binary packages are created by default in <code xmlns=
3917: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3918: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 3919: gzipped tar file. See <a href="#logs.package" title=
1.57 ! minskim 3920: "B.2. Packaging figlet">Section B.2,
1.1 grant 3921: “Packaging figlet”</a> for a continuation of
3922: the above <a xmlns=
3923: "http://www.w3.org/TR/xhtml1/transitional" href=
3924: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45 wiz 3925: target="_top"><code xmlns="" class=
3926: "filename">misc/figlet</code></a> example.</p>
1.1 grant 3927:
3928: <p>See <a href="#submit" title=
1.57 ! minskim 3929: "Chapter 17. Submitting and Committing">Chapter 17,
! 3930: <i>Submitting and Committing</i></a> for information on
! 3931: how to submit such a binary package.</p>
1.1 grant 3932: </div>
3933:
1.57 ! minskim 3934: <div class="sect1" lang="en">
1.1 grant 3935: <div class="titlepage">
3936: <div>
3937: <div>
3938: <h2 class="title" style="clear: both"><a name=
1.38 dillo 3939: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 3940: for creation of binary packages</h2>
3941: </div>
3942: </div>
3943: </div>
3944:
3945: <p>See <a href="#build.helpful-targets" title=
1.56 rillig 3946: "14.16. Other helpful targets">Section 14.16,
1.1 grant 3947: “Other helpful targets”</a>.</p>
3948: </div>
3949:
1.57 ! minskim 3950: <div class="sect1" lang="en">
1.1 grant 3951: <div class="titlepage">
3952: <div>
3953: <div>
3954: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 3955: "bulkbuild"></a>6.3. Doing a bulk build of all
! 3956: packages</h2>
1.1 grant 3957: </div>
3958: </div>
3959: </div>
3960:
3961: <p>If you want to get a full set of precompiled binary
3962: packages, this section describes how to get them. Beware
3963: that the bulk build will remove all currently installed
1.23 wiz 3964: packages from your system! Having an FTP server
3965: configured either on the machine doing the bulk builds or
3966: on a nearby NFS server can help to make the packages
3967: available to everyone. See <a href=
1.1 grant 3968: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
3969: <span class="citerefentry"><span class=
3970: "refentrytitle">ftpd</span>(8)</span></a> for more
3971: information. If you use a remote NFS server's storage, be
3972: sure to not actually compile on NFS storage, as this
3973: slows things down a lot.</p>
3974:
1.57 ! minskim 3975: <div class="sect2" lang="en">
1.1 grant 3976: <div class="titlepage">
3977: <div>
3978: <div>
1.57 ! minskim 3979: <h3 class="title"><a name=
1.38 dillo 3980: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 3981: </div>
3982: </div>
3983: </div>
3984:
1.57 ! minskim 3985: <div class="sect3" lang="en">
1.1 grant 3986: <div class="titlepage">
3987: <div>
3988: <div>
1.57 ! minskim 3989: <h4 class="title"><a name=
1.38 dillo 3990: "binary.mk.conf"></a>6.3.1.1. /etc/mk.conf</h4>
1.1 grant 3991: </div>
3992: </div>
3993: </div>
3994:
1.45 wiz 3995: <p>You may want to set variables in <code xmlns=
3996: "http://www.w3.org/TR/xhtml1/transitional" class=
3997: "filename">/etc/mk.conf</code>. Look at <code xmlns=
3998: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3999: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 4000: details of the default settings. You will want to
1.14 xtraeme 4001: ensure that <code class=
4002: "varname">ACCEPTABLE_LICENSES</code> meet your local
4003: policy. As used in this example, <code class=
4004: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 4005: "emphasis"><em>all</em></span> licenses.</p>
4006: <pre class="programlisting">
1.51 rillig 4007: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
4008: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
4009: BSDSRCDIR= /usr/src
4010: BSDXSRCDIR= /usr/xsrc # for x11/xservers
4011: OBJHOSTNAME?= yes # use work.`hostname`
4012: FAILOVER_FETCH= yes # insist on the correct checksum
4013: PKG_DEVELOPER?= yes
4014: _ACCEPTABLE= yes
1.1 grant 4015: </pre>
4016: </div>
4017:
1.57 ! minskim 4018: <div class="sect3" lang="en">
1.1 grant 4019: <div class="titlepage">
4020: <div>
4021: <div>
1.57 ! minskim 4022: <h4 class="title"><a name=
1.45 wiz 4023: "build.conf"></a>6.3.1.2. <code xmlns=
4024: "http://www.w3.org/TR/xhtml1/transitional"
4025: class="filename">build.conf</code></h4>
1.1 grant 4026: </div>
4027: </div>
4028: </div>
4029:
1.45 wiz 4030: <p>In <code xmlns=
4031: "http://www.w3.org/TR/xhtml1/transitional" class=
4032: "filename">pkgsrc/mk/bulk</code>, copy <code xmlns=
4033: "http://www.w3.org/TR/xhtml1/transitional" class=
4034: "filename">build.conf-example</code> to <code xmlns=
4035: "http://www.w3.org/TR/xhtml1/transitional" class=
4036: "filename">build.conf</code> and edit it, following
4037: the comments in that file. This is the config file
4038: that determines where log files are generated after
4039: the build, where to mail the build report to, where
4040: your pkgsrc tree is located and the user to which
4041: user to <a href=
1.1 grant 4042: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
4043: <span class="citerefentry"><span class=
1.23 wiz 4044: "refentrytitle">su</span>(8)</span></a> to do a
1.14 xtraeme 4045: <span><strong class="command">cvs
4046: update</strong></span>.</p>
1.1 grant 4047: </div>
4048:
1.57 ! minskim 4049: <div class="sect3" lang="en">
1.1 grant 4050: <div class="titlepage">
4051: <div>
4052: <div>
1.57 ! minskim 4053: <h4 class="title"><a name=
1.45 wiz 4054: "pre-build.local"></a>6.3.1.3. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4055: class="filename">pre-build.local</code></h4>
1.1 grant 4056: </div>
4057: </div>
4058: </div>
4059:
4060: <p>It is possible to configure the bulk build to
1.47 reed 4061: perform certain site-specific tasks at the end of the
1.45 wiz 4062: pre-build stage. If the file <code xmlns=
4063: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4064: "filename">pre-build.local</code> exists in
1.45 wiz 4065: <code xmlns=
4066: "http://www.w3.org/TR/xhtml1/transitional" class=
4067: "filename">/usr/pkgsrc/mk/bulk</code>, it will be
4068: executed (as a <a href=
1.24 wiz 4069: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
4070: <span class="citerefentry"><span class=
4071: "refentrytitle">sh</span>(1)</span></a> script) at
4072: the end of the usual pre-build stage. An example use
1.45 wiz 4073: of <code xmlns=
4074: "http://www.w3.org/TR/xhtml1/transitional" class=
4075: "filename">pre-build.local</code> is to have the
4076: line:</p>
1.1 grant 4077: <pre class="screen">
1.14 xtraeme 4078: <code class="prompt">#</code> <strong class=
4079: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 4080: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 4081: </pre>
4082:
4083: <p>to prevent the system from trying to build a
4084: particular package which requires nearly 3 GB of disk
4085: space.</p>
4086: </div>
4087: </div>
4088:
1.57 ! minskim 4089: <div class="sect2" lang="en">
1.1 grant 4090: <div class="titlepage">
4091: <div>
4092: <div>
1.30 wiz 4093: <h3 class="title"><a name=
1.38 dillo 4094: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 4095: environmental considerations</h3>
1.1 grant 4096: </div>
4097: </div>
4098: </div>
4099:
1.45 wiz 4100: <p>As <code xmlns=
4101: "http://www.w3.org/TR/xhtml1/transitional" class=
4102: "filename">/usr/pkg</code> will be completely deleted
4103: at the start of bulk builds, make sure your login shell
4104: is placed somewhere else. Either drop it into
4105: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4106: class="filename">/usr/local/bin</code> (and adjust your
4107: login shell in the passwd file), or (re-)install it via
1.14 xtraeme 4108: <a href=
1.1 grant 4109: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4110: <span class="citerefentry"><span class=
4111: "refentrytitle">pkg_add</span>(1)</span></a> from
1.45 wiz 4112: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4113: class="filename">/etc/rc.local</code>, so you can login
4114: after a reboot (remember that your current process
4115: won't die if the package is removed, you just can't
4116: start any new instances of the shell any more). Also,
4117: if you use NetBSD earlier than 1.5, or you still want
4118: to use the pkgsrc version of ssh for some reason, be
4119: sure to install ssh before starting it from
4120: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4121: class="filename">rc.local</code>:</p>
1.1 grant 4122: <pre class="programlisting">
1.51 rillig 4123: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
4124: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
4125: /usr/pkg/etc/rc.d/sshd
4126: fi
1.1 grant 4127: </pre>
4128:
4129: <p>Not doing so will result in you being not able to
4130: log in via ssh after the bulk build is finished or if
4131: the machine gets rebooted or crashes. You have been
4132: warned! :)</p>
4133: </div>
4134:
1.57 ! minskim 4135: <div class="sect2" lang="en">
1.1 grant 4136: <div class="titlepage">
4137: <div>
4138: <div>
1.57 ! minskim 4139: <h3 class="title"><a name=
1.38 dillo 4140: "operation"></a>6.3.3. Operation</h3>
1.1 grant 4141: </div>
4142: </div>
4143: </div>
4144:
4145: <p>Make sure you don't need any of the packages still
4146: installed.</p>
4147:
4148: <div class="warning" style=
4149: "margin-left: 0.5in; margin-right: 0.5in;">
4150: <h3 class="title">Warning</h3>
4151:
4152: <p>During the bulk build, <span class=
4153: "emphasis"><em>all packages will be
4154: removed!</em></span></p>
4155: </div>
4156:
4157: <p>Be sure to remove all other things that might
4158: interfere with builds, like some libs installed in
1.45 wiz 4159: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4160: class="filename">/usr/local</code>, etc. then become
4161: root and type:</p>
1.1 grant 4162: <pre class="screen">
1.14 xtraeme 4163: <code class="prompt">#</code> <strong class=
4164: "userinput"><code>cd /usr/pkgsrc</code></strong>
4165: <code class="prompt">#</code> <strong class=
4166: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 4167: </pre>
4168:
4169: <p>If for some reason your last build didn't complete
4170: (power failure, system panic, ...), you can continue it
4171: by running:</p>
4172: <pre class="screen">
1.14 xtraeme 4173: <code class="prompt">#</code> <strong class=
4174: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 4175: </pre>
4176:
4177: <p>At the end of the bulk build, you will get a summary
4178: via mail, and find build logs in the directory
1.14 xtraeme 4179: specified by <code class="varname">FTP</code> in the
1.45 wiz 4180: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4181: class="filename">build.conf</code> file.</p>
1.1 grant 4182: </div>
4183:
1.57 ! minskim 4184: <div class="sect2" lang="en">
1.1 grant 4185: <div class="titlepage">
4186: <div>
4187: <div>
1.57 ! minskim 4188: <h3 class="title"><a name=
1.38 dillo 4189: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 4190: </div>
4191: </div>
4192: </div>
4193:
4194: <p>The bulk builds consist of three steps:</p>
4195:
4196: <div class="variablelist">
4197: <dl>
4198: <dt><span class="term">1. pre-build</span></dt>
4199:
4200: <dd>
4201: <p>The script updates your pkgsrc tree via
4202: (anon)cvs, then cleans out any broken distfiles,
4203: and removes all packages installed.</p>
4204: </dd>
4205:
4206: <dt><span class="term">2. the bulk
4207: build</span></dt>
4208:
4209: <dd>
4210: <p>This is basically “<span class=
4211: "quote">make bulk-package</span>” with an
4212: optimised order in which packages will be built.
4213: Packages that don't require other packages will
4214: be built first, and packages with many
4215: dependencies will be built later.</p>
4216: </dd>
4217:
4218: <dt><span class="term">3. post-build</span></dt>
4219:
4220: <dd>
4221: <p>Generates a report that's placed in the
1.45 wiz 4222: directory specified in the <code xmlns=
4223: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4224: "filename">build.conf</code> file named
1.45 wiz 4225: <code xmlns=
4226: "http://www.w3.org/TR/xhtml1/transitional" class=
4227: "filename">broken.html</code>, a short version of
4228: that report will also be mailed to the build's
4229: admin.</p>
1.1 grant 4230: </dd>
4231: </dl>
4232: </div>
4233:
4234: <p>During the build, a list of broken packages will be
1.45 wiz 4235: compiled in <code xmlns=
4236: "http://www.w3.org/TR/xhtml1/transitional" class=
4237: "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
4238: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4239: "filename">.../.broken.${MACHINE}</code> if
4240: <code class="varname">OBJMACHINE</code> is set),
4241: individual build logs of broken builds can be found in
4242: the package's directory. These files are used by the
4243: bulk-targets to mark broken builds to not waste time
4244: trying to rebuild them, and they can be used to debug
4245: these broken package builds later.</p>
1.1 grant 4246: </div>
4247:
1.57 ! minskim 4248: <div class="sect2" lang="en">
1.1 grant 4249: <div class="titlepage">
4250: <div>
4251: <div>
1.30 wiz 4252: <h3 class="title"><a name=
1.38 dillo 4253: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 4254: space requirements</h3>
1.1 grant 4255: </div>
4256: </div>
4257: </div>
4258:
4259: <p>Currently, roughly the following requirements are
4260: valid for NetBSD 2.0/i386:</p>
4261:
4262: <div class="itemizedlist">
4263: <ul type="disc">
4264: <li>
4265: <p>10 GB - distfiles (NFS ok)</p>
4266: </li>
4267:
4268: <li>
4269: <p>8 GB - full set of all binaries (NFS ok)</p>
4270: </li>
4271:
4272: <li>
4273: <p>5 GB - temp space for compiling (local disk
4274: recommended)</p>
4275: </li>
4276: </ul>
4277: </div>
4278:
4279: <p>Note that all pkgs will be de-installed as soon as
4280: they are turned into a binary package, and that sources
4281: are removed, so there is no excessively huge demand to
4282: disk space. Afterwards, if the package is needed again,
4283: it will be installed via <a href=
4284: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4285: <span class="citerefentry"><span class=
4286: "refentrytitle">pkg_add</span>(1)</span></a> instead of
4287: building again, so there are no cycles wasted by
4288: recompiling.</p>
4289: </div>
4290:
1.57 ! minskim 4291: <div class="sect2" lang="en">
1.1 grant 4292: <div class="titlepage">
4293: <div>
4294: <div>
1.57 ! minskim 4295: <h3 class="title"><a name=
! 4296: "setting-up-a-sandbox"></a>6.3.6. Setting up
! 4297: a sandbox for chrooted builds</h3>
1.1 grant 4298: </div>
4299: </div>
4300: </div>
4301:
1.12 agc 4302: <p>If you don't want all the packages nuked from a
4303: machine (rendering it useless for anything but pkg
1.23 wiz 4304: compiling), there is the possibility of doing the
4305: package bulk build inside a chroot environment.</p>
1.12 agc 4306:
4307: <p>The first step is to set up a chroot sandbox, e.g.
1.45 wiz 4308: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4309: class="filename">/usr/sandbox</code>. This can be done
4310: by using null mounts, or manually.</p>
1.12 agc 4311:
1.45 wiz 4312: <p>There is a shell script called <code xmlns=
4313: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4314: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
4315: set up the sandbox environment using null mounts. It
1.45 wiz 4316: will also create a script called <code xmlns=
4317: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4318: "filename">sandbox</code> in the root of the sandbox
1.12 agc 4319: environment, which will allow the null mounts to be
1.14 xtraeme 4320: activated using the <span><strong class=
4321: "command">sandbox mount</strong></span> command and
4322: deactivated using the <span><strong class=
4323: "command">sandbox umount</strong></span> command.</p>
1.12 agc 4324:
4325: <p>To set up a sandbox environment by hand, after
4326: extracting all the sets from a NetBSD installation or
1.14 xtraeme 4327: doing a <span><strong class="command">make distribution
1.45 wiz 4328: DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
4329: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4330: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 4331: items are present and properly configured:</p>
1.1 grant 4332:
4333: <div class="procedure">
4334: <ol type="1">
4335: <li>
4336: <p>Kernel</p>
4337: <pre class="screen">
1.14 xtraeme 4338: <code class="prompt">#</code> <strong class=
4339: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 4340: </pre>
4341: </li>
4342:
4343: <li>
1.45 wiz 4344: <p><code xmlns=
4345: "http://www.w3.org/TR/xhtml1/transitional" class=
4346: "filename">/dev/*</code></p>
1.1 grant 4347: <pre class="screen">
1.14 xtraeme 4348: <code class="prompt">#</code> <strong class=
4349: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 4350: </pre>
4351: </li>
4352:
4353: <li>
1.45 wiz 4354: <p><code xmlns=
4355: "http://www.w3.org/TR/xhtml1/transitional" class=
4356: "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1 grant 4357: "http://www.w3.org/TR/xhtml1/transitional" href=
4358: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4359: target="_top"><code xmlns="" class=
4360: "filename">security/smtpd</code></a> and
4361: mail):</p>
1.1 grant 4362: <pre class="screen">
1.14 xtraeme 4363: <code class="prompt">#</code> <strong class=
4364: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 4365: </pre>
4366: </li>
4367:
4368: <li>
4369: <p>Working(!) mail config (hostname,
4370: sendmail.cf):</p>
4371: <pre class="screen">
1.14 xtraeme 4372: <code class="prompt">#</code> <strong class=
4373: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 4374: </pre>
4375: </li>
4376:
4377: <li>
1.45 wiz 4378: <p><code xmlns=
4379: "http://www.w3.org/TR/xhtml1/transitional" class=
4380: "filename">/etc/localtime</code> (for <a xmlns=
1.1 grant 4381: "http://www.w3.org/TR/xhtml1/transitional" href=
4382: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4383: target="_top"><code xmlns="" class=
4384: "filename">security/smtpd</code></a>):</p>
1.1 grant 4385: <pre class="screen">
1.14 xtraeme 4386: <code class="prompt">#</code> <strong class=
4387: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 4388: </pre>
4389: </li>
4390:
4391: <li>
1.45 wiz 4392: <p><code xmlns=
4393: "http://www.w3.org/TR/xhtml1/transitional" class=
4394: "filename">/usr/src</code> (system sources, for
4395: <a xmlns=
1.1 grant 4396: "http://www.w3.org/TR/xhtml1/transitional" href=
4397: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45 wiz 4398: target="_top"><code xmlns="" class=
4399: "filename">sysutils/aperture</code></a>,
4400: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
4401: href=
1.20 ben 4402: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45 wiz 4403: target="_top"><code xmlns="" class=
4404: "filename">net/ppp-mppe</code></a>):</p>
1.1 grant 4405: <pre class="screen">
1.14 xtraeme 4406: <code class="prompt">#</code> <strong class=
4407: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
4408: <code class="prompt">#</code> <strong class=
1.23 wiz 4409: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 4410: </pre>
4411: </li>
4412:
4413: <li>
1.45 wiz 4414: <p>Create <code xmlns=
4415: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4416: "filename">/var/db/pkg</code> (not part of
4417: default install):</p>
1.1 grant 4418: <pre class="screen">
1.14 xtraeme 4419: <code class="prompt">#</code> <strong class=
4420: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 4421: </pre>
4422: </li>
4423:
4424: <li>
1.45 wiz 4425: <p>Create <code xmlns=
4426: "http://www.w3.org/TR/xhtml1/transitional" class=
4427: "filename">/usr/pkg</code> (not part of default
4428: install):</p>
1.1 grant 4429: <pre class="screen">
1.14 xtraeme 4430: <code class="prompt">#</code> <strong class=
4431: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 4432: </pre>
4433: </li>
4434:
4435: <li>
1.45 wiz 4436: <p>Checkout pkgsrc via cvs into <code xmlns=
4437: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4438: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 4439: <pre class="screen">
1.14 xtraeme 4440: <code class="prompt">#</code> <strong class=
4441: "userinput"><code>cd /usr/sandbox/usr</code></strong>
4442: <code class="prompt">#</code> <strong class=
4443: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 4444: </pre>
4445:
4446: <p>Do not mount/link this to the copy of your
4447: pkgsrc tree you do development in, as this will
4448: likely cause problems!</p>
4449: </li>
4450:
4451: <li>
1.45 wiz 4452: <p>Make <code xmlns=
4453: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4454: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45 wiz 4455: and <code xmlns=
4456: "http://www.w3.org/TR/xhtml1/transitional" class=
4457: "filename">.../distfiles</code> point somewhere
4458: appropriate. NFS- and/or nullfs-mounts may come
4459: in handy!</p>
1.1 grant 4460: </li>
4461:
4462: <li>
1.45 wiz 4463: <p>Edit <code xmlns=
4464: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4465: "filename">/etc/mk.conf</code>, see <a href=
4466: "#binary.mk.conf" title=
1.38 dillo 4467: "6.3.1.1. /etc/mk.conf">Section 6.3.1.1,
1.1 grant 4468: “/etc/mk.conf”</a>.</p>
4469: </li>
4470:
4471: <li>
1.45 wiz 4472: <p>Adjust <code xmlns=
4473: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4474: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 4475: needs.</p>
4476: </li>
4477:
4478: <li>
1.14 xtraeme 4479: <p>If you have set <code class=
1.45 wiz 4480: "varname">CVS_USER</code> in <code xmlns=
4481: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4482: "filename">build.conf</code>, make sure that
4483: account exists and can do a <span><strong class=
4484: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 4485: properly!</p>
4486: </li>
4487: </ol>
4488: </div>
4489:
1.47 reed 4490: <p>When the chroot sandbox is set up, you can start the
1.1 grant 4491: build with the following steps:</p>
4492: <pre class="screen">
1.14 xtraeme 4493: <code class="prompt">#</code> <strong class=
4494: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4495: <code class="prompt">#</code> <strong class=
4496: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 4497: </pre>
4498:
4499: <p>This will just jump inside the sandbox and start
4500: building. At the end of the build, mail will be sent
4501: with the results of the build. Created binary pkgs will
1.45 wiz 4502: be in <code xmlns=
4503: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4504: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 4505: (wherever that points/mounts to/from).</p>
4506: </div>
4507:
1.57 ! minskim 4508: <div class="sect2" lang="en">
1.1 grant 4509: <div class="titlepage">
4510: <div>
4511: <div>
1.30 wiz 4512: <h3 class="title"><a name=
1.38 dillo 4513: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 4514: a partial set of packages</h3>
1.1 grant 4515: </div>
4516: </div>
4517: </div>
4518:
4519: <p>In addition to building a complete set of all
1.45 wiz 4520: packages in pkgsrc, the <code xmlns=
4521: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4522: "filename">pkgsrc/mk/bulk/build</code> script may be
4523: used to build a subset of the packages contained in
1.47 reed 4524: pkgsrc. By setting <code class=
1.45 wiz 4525: "varname">SPECIFIC_PKGS</code> in <code xmlns=
4526: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4527: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 4528:
4529: <div class="itemizedlist">
4530: <ul type="disc">
4531: <li>
4532: <p>SITE_SPECIFIC_PKGS</p>
4533: </li>
4534:
4535: <li>
4536: <p>HOST_SPECIFIC_PKGS</p>
4537: </li>
4538:
4539: <li>
4540: <p>GROUP_SPECIFIC_PKGS</p>
4541: </li>
4542:
4543: <li>
4544: <p>USER_SPECIFIC_PKGS</p>
4545: </li>
4546: </ul>
4547: </div>
4548:
4549: <p>will define the set of packages which should be
4550: built. The bulk build code will also include any
4551: packages which are needed as dependencies for the
4552: explicitly listed packages.</p>
4553:
4554: <p>One use of this is to do a bulk build with
1.14 xtraeme 4555: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 4556: sandbox periodically to have a complete set of the
4557: binary packages needed for your site available without
4558: the overhead of building extra packages that are not
4559: needed.</p>
4560: </div>
1.13 hubertf 4561:
1.57 ! minskim 4562: <div class="sect2" lang="en">
1.13 hubertf 4563: <div class="titlepage">
4564: <div>
4565: <div>
1.57 ! minskim 4566: <h3 class="title"><a name=
1.38 dillo 4567: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 4568: of a bulk build</h3>
4569: </div>
4570: </div>
4571: </div>
4572:
4573: <p>This section describes how pkgsrc developers can
4574: upload binary pkgs built by bulk builds to
4575: ftp.NetBSD.org.</p>
4576:
1.17 sketch 4577: <p>If you would like to automatically create checksum
4578: files for the binary packages you intend to upload,
4579: remember to set <code class="varname">MKSUMS=yes</code>
1.45 wiz 4580: in your <code xmlns=
4581: "http://www.w3.org/TR/xhtml1/transitional" class=
1.17 sketch 4582: "filename">mk/bulk/build.conf</code>.</p>
4583:
4584: <p>If you would like to PGP sign the checksum files
4585: (highly recommended!), remember to set <code class=
4586: "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45 wiz 4587: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4588: class="filename">mk/bulk/build.conf</code>. This will
4589: prompt you for your GPG password to sign the files
1.17 sketch 4590: before uploading everything.</p>
4591:
4592: <p>Then, make sure that you have <code class=
1.14 xtraeme 4593: "varname">RSYNC_DST</code> set properly in your
1.45 wiz 4594: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4595: class="filename">mk/bulk/build.conf</code> file, i.e.
4596: adjust it to something like one of the following:</p>
1.13 hubertf 4597: <pre class="screen">
4598: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4599: </pre>
4600:
1.47 reed 4601: <p>Please use appropriate values for "pkgsrc-200xQy",
1.13 hubertf 4602: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 4603: ftp.NetBSD.org is different from <code class=
4604: "varname">CVS_USER</code>, write your login directly
4605: into the variable, e.g. my local account is "feyrer",
4606: but for my login "hubertf", I use:</p>
1.13 hubertf 4607: <pre class="screen">
4608: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4609: </pre>
4610:
1.45 wiz 4611: <p>A separate <code xmlns=
4612: "http://www.w3.org/TR/xhtml1/transitional" class=
4613: "filename">upload</code> directory is used here to
4614: allow "closing" the directory during upload. To do so,
4615: run the following command on ftp.NetBSD.org next:</p>
1.13 hubertf 4616: <pre class="screen">
1.14 xtraeme 4617: nbftp% <strong class=
4618: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 4619: </pre>
4620:
1.45 wiz 4621: <p>Please note that <code xmlns=
4622: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4623: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 4624: appropriate for packages for the NetBSD operating
4625: system. Binary packages for other operating systems
1.45 wiz 4626: should go into <code xmlns=
4627: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4628: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 4629:
4630: <p>Before uploading the binary pkgs, ssh authentication
1.47 reed 4631: needs to be set up. This example shows how to set up
1.13 hubertf 4632: temporary keys for the root account <span class=
4633: "emphasis"><em>inside the sandbox</em></span> (assuming
4634: that no keys should be present there usually):</p>
4635: <pre class="screen">
1.14 xtraeme 4636: <code class="prompt">#</code> <strong class=
4637: "userinput"><code>chroot /usr/sandbox</code></strong>
4638: chroot-<code class="prompt">#</code> <strong class=
4639: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
4640: chroot-<code class="prompt">#</code> <strong class=
4641: "userinput"><code>ssh-keygen -t dsa</code></strong>
4642: chroot-<code class="prompt">#</code> <strong class=
4643: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 4644: </pre>
4645:
1.45 wiz 4646: <p>Now take the output of <code xmlns=
4647: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4648: "filename">id-dsa.pub</code> and append it to your
1.45 wiz 4649: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4650: class="filename">~/.ssh/authorized_keys</code> file on
4651: ftp.NetBSD.org. You can remove the key after the upload
4652: is done!</p>
1.13 hubertf 4653:
4654: <p>Next, test if your ssh connection really works:</p>
4655: <pre class="screen">
1.14 xtraeme 4656: chroot-<code class="prompt">#</code> <strong class=
4657: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 4658: </pre>
4659:
4660: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
4661:
4662: <p>Now after all this works, you can exit the sandbox
4663: and start the upload:</p>
4664: <pre class="screen">
1.14 xtraeme 4665: chroot-<code class="prompt">#</code> <strong class=
4666: "userinput"><code>exit</code></strong>
4667: <code class="prompt">#</code> <strong class=
4668: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4669: <code class="prompt">#</code> <strong class=
4670: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 4671: </pre>
4672:
4673: <p>The upload process may take quite some time. Use
1.24 wiz 4674: <a href=
4675: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
4676: <span class="citerefentry"><span class=
4677: "refentrytitle">ls</span>(1)</span></a> or <a href=
4678: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
4679: <span class="citerefentry"><span class=
4680: "refentrytitle">du</span>(1)</span></a> on the FTP
4681: server to monitor progress of the upload. The upload
4682: script will take care of not uploading restricted
4683: packages and putting vulnerable packages into the
1.45 wiz 4684: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4685: class="filename">vulnerable</code> subdirectory.</p>
1.13 hubertf 4686:
4687: <p>After the upload has ended, first thing is to revoke
4688: ssh access:</p>
4689: <pre class="screen">
1.14 xtraeme 4690: nbftp% <strong class=
4691: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 4692: Gdd:x!
4693: </pre>
4694:
4695: <p>Use whatever is needed to remove the key you've
4696: entered before! Last, move the uploaded packages out of
1.45 wiz 4697: the <code xmlns=
4698: "http://www.w3.org/TR/xhtml1/transitional" class=
4699: "filename">upload</code> directory to have them
4700: accessible to everyone:</p>
1.13 hubertf 4701: <pre class="screen">
1.14 xtraeme 4702: nbftp% <strong class=
4703: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
4704: nbftp% <strong class=
4705: "userinput"><code>mv upload/* .</code></strong>
4706: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
4707: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 4708: </pre>
4709: </div>
1.1 grant 4710: </div>
4711:
1.57 ! minskim 4712: <div class="sect1" lang="en">
1.1 grant 4713: <div class="titlepage">
4714: <div>
4715: <div>
4716: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4717: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 4718: CD-ROM packages collection</h2>
1.1 grant 4719: </div>
4720: </div>
4721: </div>
4722:
4723: <p>After your pkgsrc bulk-build has completed, you may
4724: wish to create a CD-ROM set of the resulting binary
4725: packages to assist in installing packages on other
4726: machines. The <a xmlns=
4727: "http://www.w3.org/TR/xhtml1/transitional" href=
4728: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45 wiz 4729: target="_top"><code xmlns="" class=
4730: "filename">pkgtools/cdpack</code></a> package provides a
1.20 ben 4731: simple tool for creating the ISO 9660 images.
4732: <span><strong class="command">cdpack</strong></span>
4733: arranges the packages on the CD-ROMs in a way that keeps
1.47 reed 4734: all the dependencies for a given package on the same CD
4735: as that package.</p>
1.1 grant 4736:
1.57 ! minskim 4737: <div class="sect2" lang="en">
1.1 grant 4738: <div class="titlepage">
4739: <div>
4740: <div>
1.57 ! minskim 4741: <h3 class="title"><a name=
1.38 dillo 4742: "cdpack-example"></a>6.4.1. Example of
1.1 grant 4743: cdpack</h3>
4744: </div>
4745: </div>
4746: </div>
4747:
4748: <p>Complete documentation for cdpack is found in the
1.47 reed 4749: cdpack(1) man page. The following short example assumes
1.45 wiz 4750: that the binary packages are left in <code xmlns=
4751: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4752: "filename">/usr/pkgsrc/packages/All</code> and that
1.45 wiz 4753: sufficient disk space exists in <code xmlns=
4754: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4755: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 4756: <pre class="screen">
1.14 xtraeme 4757: <code class="prompt">#</code> <strong class=
4758: "userinput"><code>mkdir /u2/images</code></strong>
4759: <code class="prompt">#</code> <strong class=
4760: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
4761: <code class="prompt">#</code> <strong class=
4762: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4763: </pre>
4764:
4765: <p>If you wish to include a common set of files
1.45 wiz 4766: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4767: class="filename">COPYRIGHT</code>, <code xmlns=
4768: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4769: "filename">README</code>, etc.) on each CD in the
1.1 grant 4770: collection, then you need to create a directory which
4771: contains these files. e.g.</p>
4772: <pre class="screen">
1.14 xtraeme 4773: <code class="prompt">#</code> <strong class=
4774: "userinput"><code>mkdir /tmp/common</code></strong>
4775: <code class="prompt">#</code> <strong class=
4776: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
4777: <code class="prompt">#</code> <strong class=
4778: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
4779: <code class="prompt">#</code> <strong class=
4780: "userinput"><code>mkdir /tmp/common/bin</code></strong>
4781: <code class="prompt">#</code> <strong class=
4782: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
4783: <code class="prompt">#</code> <strong class=
4784: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
4785: <code class="prompt">#</code> <strong class=
4786: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 4787: </pre>
4788:
4789: <p>Now create the images:</p>
4790: <pre class="screen">
1.14 xtraeme 4791: <code class="prompt">#</code> <strong class=
4792: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4793: </pre>
4794:
1.45 wiz 4795: <p>Each image will contain <code xmlns=
4796: "http://www.w3.org/TR/xhtml1/transitional" class=
4797: "filename">README</code>, <code xmlns=
4798: "http://www.w3.org/TR/xhtml1/transitional" class=
4799: "filename">COPYING</code>, and <code xmlns=
4800: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4801: "filename">bin/myscript</code> in their root
1.1 grant 4802: directories.</p>
4803: </div>
4804: </div>
4805: </div>
4806:
1.57 ! minskim 4807: <div class="chapter" lang="en">
1.1 grant 4808: <div class="titlepage">
4809: <div>
4810: <div>
1.57 ! minskim 4811: <h2 class="title"><a name=
1.38 dillo 4812: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 4813: Questions</h2>
4814: </div>
4815: </div>
4816: </div>
4817:
4818: <div class="toc">
4819: <p><b>Table of Contents</b></p>
4820:
4821: <dl>
1.30 wiz 4822: <dt><span class="sect1"><a href=
1.38 dillo 4823: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 4824: lists for pkg-related discussion?</a></span></dt>
1.1 grant 4825:
1.38 dillo 4826: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 4827: Where's the pkgviews documentation?</a></span></dt>
4828:
1.38 dillo 4829: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 4830: Utilities for package management
4831: (pkgtools)</a></span></dt>
4832:
1.38 dillo 4833: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 4834: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 4835:
1.30 wiz 4836: <dt><span class="sect1"><a href=
1.38 dillo 4837: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 4838: fetching distfiles?</a></span></dt>
1.14 xtraeme 4839:
1.30 wiz 4840: <dt><span class="sect1"><a href=
1.38 dillo 4841: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 4842: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 4843:
1.30 wiz 4844: <dt><span class="sect1"><a href=
1.38 dillo 4845: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 4846: from pkgsrc?</a></span></dt>
1.1 grant 4847:
1.30 wiz 4848: <dt><span class="sect1"><a href=
1.38 dillo 4849: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 4850: behind a firewall</a></span></dt>
1.1 grant 4851:
1.38 dillo 4852: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 4853: do I tell <span><strong class="command">make
4854: fetch</strong></span> to do passive
4855: FTP?</a></span></dt>
1.1 grant 4856:
1.30 wiz 4857: <dt><span class="sect1"><a href=
1.38 dillo 4858: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 4859: distfiles at once</a></span></dt>
1.1 grant 4860:
1.30 wiz 4861: <dt><span class="sect1"><a href=
1.38 dillo 4862: "#tmac.andoc-missing">7.11. What does
1.30 wiz 4863: “<span class="quote">Don't know how to make
1.14 xtraeme 4864: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 4865: mean?</a></span></dt>
4866:
1.30 wiz 4867: <dt><span class="sect1"><a href=
1.38 dillo 4868: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 4869: “<span class="quote">Could not find
1.14 xtraeme 4870: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 4871:
1.30 wiz 4872: <dt><span class="sect1"><a href=
1.38 dillo 4873: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 4874: pkgsrc</a></span></dt>
1.1 grant 4875:
1.38 dillo 4876: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 4877: do I change the location of configuration
4878: files?</a></span></dt>
1.1 grant 4879:
1.38 dillo 4880: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 4881: Automated security checks</a></span></dt>
4882: </dl>
4883: </div>
4884:
4885: <p>This section contains hints, tips & tricks on
4886: special things in pkgsrc that we didn't find a better place
4887: for in the previous chapters, and it contains items for
4888: both pkgsrc users and developers.</p>
4889:
1.57 ! minskim 4890: <div class="sect1" lang="en">
1.1 grant 4891: <div class="titlepage">
4892: <div>
4893: <div>
4894: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4895: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 4896: mailing lists for pkg-related discussion?</h2>
1.1 grant 4897: </div>
4898: </div>
4899: </div>
4900:
1.18 xtraeme 4901: <p>The following mailing lists may be of interest to
4902: pkgsrc users:</p>
4903:
4904: <div class="itemizedlist">
4905: <ul type="disc">
4906: <li>
4907: <p><a href=
4908: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34 wiz 4909: target="_top">pkgsrc-bugs</a>: A list where problem
4910: reports related to pkgsrc are sent and
4911: discussed.</p>
1.18 xtraeme 4912: </li>
4913:
4914: <li>
4915: <p><a href=
4916: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 4917: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 4918: results of pkgsrc bulk builds are sent and
1.34 wiz 4919: discussed.</p>
1.18 xtraeme 4920: </li>
4921:
4922: <li>
4923: <p><a href=
4924: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34 wiz 4925: target="_top">pkgsrc-changes</a>: A list where all
4926: commit messages to pkgsrc are sent.</p>
1.18 xtraeme 4927: </li>
4928:
4929: <li>
4930: <p><a href=
4931: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34 wiz 4932: target="_top">tech-pkg</a>: A general discussion
4933: list for all things related to pkgsrc.</p>
1.18 xtraeme 4934: </li>
4935: </ul>
4936: </div>
4937:
4938: <p>To subscribe, do:</p>
1.1 grant 4939: <pre class="programlisting">
1.51 rillig 4940: <code class="prompt">%</code> echo subscribe <em class=
1.18 xtraeme 4941: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 4942: </pre>
4943:
1.18 xtraeme 4944: <p>Archives for all these mailing lists are available
4945: from <a href="http://mail-index.NetBSD.org/" target=
4946: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 4947: </div>
4948:
1.57 ! minskim 4949: <div class="sect1" lang="en">
1.1 grant 4950: <div class="titlepage">
4951: <div>
4952: <div>
4953: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4954: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 4955: documentation?</h2>
1.1 grant 4956: </div>
4957: </div>
4958: </div>
4959:
4960: <p>Pkgviews is tightly integrated with buildlink. You can
1.45 wiz 4961: find a pkgviews User's guide in <code xmlns=
4962: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4963: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 4964: </div>
4965:
1.57 ! minskim 4966: <div class="sect1" lang="en">
1.1 grant 4967: <div class="titlepage">
4968: <div>
4969: <div>
4970: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4971: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 4972: management (pkgtools)</h2>
1.1 grant 4973: </div>
4974: </div>
4975: </div>
4976:
1.45 wiz 4977: <p>The <code xmlns=
4978: "http://www.w3.org/TR/xhtml1/transitional" class=
4979: "filename">pkgsrc/pkgtools</code> directory pkgtools
4980: contains a number of useful utilities for both users and
4981: developers of pkgsrc. This section attempts only to make
4982: the reader aware of the utilities and when they might be
4983: useful, and not to duplicate the documentation that comes
4984: with each package.</p>
1.1 grant 4985:
4986: <p>Utilities used by pkgsrc (automatically installed when
4987: needed):</p>
4988:
4989: <div class="itemizedlist">
4990: <ul type="disc">
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/x11-links/README.html"
1.45 wiz 4995: target="_top"><code xmlns="" class=
4996: "filename">pkgtools/x11-links</code></a>: Symlinks
1.34 wiz 4997: for use by buildlink.</p>
1.1 grant 4998: </li>
4999: </ul>
5000: </div>
5001:
5002: <p>OS tool augmentation (automatically installed when
5003: needed):</p>
5004:
5005: <div class="itemizedlist">
5006: <ul type="disc">
5007: <li>
5008: <p><a xmlns=
5009: "http://www.w3.org/TR/xhtml1/transitional" href=
5010: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 wiz 5011: target="_top"><code xmlns="" class=
5012: "filename">pkgtools/digest</code></a>: Calculates
1.34 wiz 5013: various kinds of checksums (including SHA1).</p>
1.1 grant 5014: </li>
5015:
5016: <li>
5017: <p><a xmlns=
5018: "http://www.w3.org/TR/xhtml1/transitional" href=
5019: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45 wiz 5020: target="_top"><code xmlns="" class=
5021: "filename">pkgtools/libnbcompat</code></a>:
1.34 wiz 5022: Compatibility library for pkgsrc tools.</p>
1.1 grant 5023: </li>
5024:
5025: <li>
5026: <p><a xmlns=
5027: "http://www.w3.org/TR/xhtml1/transitional" href=
5028: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45 wiz 5029: target="_top"><code xmlns="" class=
5030: "filename">pkgtools/mtree</code></a>: Installed on
1.34 wiz 5031: non-BSD systems due to lack of native mtree.</p>
1.1 grant 5032: </li>
5033:
5034: <li>
5035: <p><a xmlns=
5036: "http://www.w3.org/TR/xhtml1/transitional" href=
5037: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5038: target="_top"><code xmlns="" class=
5039: "filename">pkgtools/pkg_install</code></a>:
5040: Up-to-date replacement for <code xmlns=
5041: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5042: "filename">/usr/sbin/pkg_install</code>, or for use
5043: on operating systems where pkg_install is not
5044: present.</p>
1.1 grant 5045: </li>
5046: </ul>
5047: </div>
5048:
5049: <p>Utilities used by pkgsrc (not automatically
5050: installed):</p>
5051:
5052: <div class="itemizedlist">
5053: <ul type="disc">
5054: <li>
5055: <p><a xmlns=
5056: "http://www.w3.org/TR/xhtml1/transitional" href=
5057: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45 wiz 5058: target="_top"><code xmlns="" class=
5059: "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20 ben 5060: binary package from an already-installed package.
1.34 wiz 5061: Used by <span><strong class="command">make
5062: replace</strong></span> to save the old
5063: package.</p>
1.1 grant 5064: </li>
5065:
5066: <li>
5067: <p><a xmlns=
5068: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 5069: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45 wiz 5070: target="_top"><code xmlns="" class=
5071: "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20 ben 5072: functionality to pkgsrc, allowing it to fetch
5073: distfiles from multiple locations. It currently
5074: supports the following methods: multiple CD-ROMs
5075: and network FTP/HTTP connections.</p>
1.5 hubertf 5076: </li>
5077:
5078: <li>
5079: <p><a xmlns=
5080: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5081: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 5082: target="_top"><code xmlns="" class=
5083: "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34 wiz 5084: packages someplace else (enabled by default).</p>
1.1 grant 5085: </li>
1.5 hubertf 5086:
5087: <li>
5088: <p><a xmlns=
5089: "http://www.w3.org/TR/xhtml1/transitional" href=
5090: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 5091: target="_top"><code xmlns="" class=
5092: "filename">devel/cpuflags</code></a>: Determine the
1.34 wiz 5093: best compiler flags to optimise code for your
1.20 ben 5094: current CPU and compiler.</p>
1.5 hubertf 5095: </li>
1.1 grant 5096: </ul>
5097: </div>
5098:
5099: <p>Utilities for keeping track of installed packages,
5100: being up to date, etc:</p>
5101:
5102: <div class="itemizedlist">
5103: <ul type="disc">
5104: <li>
5105: <p><a xmlns=
5106: "http://www.w3.org/TR/xhtml1/transitional" href=
5107: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45 wiz 5108: target="_top"><code xmlns="" class=
5109: "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27 rillig 5110: packages whose installed versions do not match the
1.34 wiz 5111: latest pkgsrc entries.</p>
1.1 grant 5112: </li>
5113:
5114: <li>
5115: <p><a xmlns=
5116: "http://www.w3.org/TR/xhtml1/transitional" href=
5117: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5118: target="_top"><code xmlns="" class=
5119: "filename">pkgtools/pkgdep</code></a>: Makes
1.20 ben 5120: dependency graphs of packages, to aid in choosing a
1.34 wiz 5121: strategy for updating.</p>
1.1 grant 5122: </li>
5123:
5124: <li>
5125: <p><a xmlns=
5126: "http://www.w3.org/TR/xhtml1/transitional" href=
5127: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45 wiz 5128: target="_top"><code xmlns="" class=
5129: "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27 rillig 5130: graphs from the output of <a xmlns=
5131: "http://www.w3.org/TR/xhtml1/transitional" href=
5132: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5133: target="_top"><code xmlns="" class=
5134: "filename">pkgtools/pkgdep</code></a> (uses
1.34 wiz 5135: graphviz).</p>
1.1 grant 5136: </li>
5137:
5138: <li>
5139: <p><a xmlns=
5140: "http://www.w3.org/TR/xhtml1/transitional" href=
5141: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 5142: target="_top"><code xmlns="" class=
5143: "filename">pkgtools/pkglint</code></a>: The
1.27 rillig 5144: pkglint(1) program checks a pkgsrc entry for
5145: errors, lintpkgsrc(1) does various checks on the
5146: complete pkgsrc system.</p>
1.1 grant 5147: </li>
5148:
5149: <li>
5150: <p><a xmlns=
5151: "http://www.w3.org/TR/xhtml1/transitional" href=
5152: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45 wiz 5153: target="_top"><code xmlns="" class=
5154: "filename">pkgtools/pkgsurvey</code></a>: Report
5155: what packages you have installed.</p>
1.1 grant 5156: </li>
5157: </ul>
5158: </div>
5159:
5160: <p>Utilities for people maintaining or creating
5161: individual packages:</p>
5162:
5163: <div class="itemizedlist">
5164: <ul type="disc">
5165: <li>
5166: <p><a xmlns=
5167: "http://www.w3.org/TR/xhtml1/transitional" href=
5168: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 5169: target="_top"><code xmlns="" class=
5170: "filename">pkgtools/pkgdiff</code></a>: Automate
1.20 ben 5171: making and maintaining patches for a package
1.34 wiz 5172: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 5173: </li>
5174:
5175: <li>
5176: <p><a xmlns=
5177: "http://www.w3.org/TR/xhtml1/transitional" href=
5178: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45 wiz 5179: target="_top"><code xmlns="" class=
5180: "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20 ben 5181: "http://www.w3.org/TR/xhtml1/transitional" href=
5182: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 5183: target="_top"><code xmlns="" class=
5184: "filename">pkgtools/url2pkg</code></a>: Aids in
1.34 wiz 5185: converting to pkgsrc.</p>
1.1 grant 5186: </li>
5187:
5188: <li>
5189: <p><a xmlns=
5190: "http://www.w3.org/TR/xhtml1/transitional" href=
5191: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45 wiz 5192: target="_top"><code xmlns="" class=
5193: "filename">pkgtools/gensolpkg</code></a>: Convert
1.34 wiz 5194: pkgsrc to a Solaris package.</p>
1.1 grant 5195: </li>
5196: </ul>
5197: </div>
5198:
1.47 reed 5199: <p>Utilities for people maintaining pkgsrc (or: more
1.1 grant 5200: obscure pkg utilities)</p>
5201:
5202: <div class="itemizedlist">
5203: <ul type="disc">
5204: <li>
5205: <p><a xmlns=
5206: "http://www.w3.org/TR/xhtml1/transitional" href=
5207: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45 wiz 5208: target="_top"><code xmlns="" class=
5209: "filename">pkgtools/pkg_comp</code></a>: Build
1.34 wiz 5210: packages in a chrooted area.</p>
1.1 grant 5211: </li>
5212:
5213: <li>
5214: <p><a xmlns=
5215: "http://www.w3.org/TR/xhtml1/transitional" href=
5216: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45 wiz 5217: target="_top"><code xmlns="" class=
5218: "filename">pkgtools/libkver</code></a>: Spoof
5219: kernel version for chrooted cross builds.</p>
1.1 grant 5220: </li>
5221: </ul>
5222: </div>
5223: </div>
5224:
1.57 ! minskim 5225: <div class="sect1" lang="en">
1.1 grant 5226: <div class="titlepage">
5227: <div>
5228: <div>
5229: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5230: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 5231: as non-root</h2>
1.1 grant 5232: </div>
5233: </div>
5234: </div>
5235:
5236: <p>If you want to use pkgsrc as non-root user, you can
5237: set some variables to make pkgsrc work under these
1.33 jmmv 5238: conditions. At the very least, you need to set
5239: <code class="varname">UNPRIVILEGED</code> to
5240: “<span class="quote">yes</span>”; this will
5241: turn on unprivileged mode and set multiple related
5242: variables to allow installation of packages as
5243: non-root.</p>
5244:
5245: <p>In case the defaults are not enough, you may want to
5246: tune some other variables used. For example, if the
5247: automatic user/group detection leads to incorrect values
5248: (or not the ones you would like to use), you can change
5249: them by setting <code class=
5250: "varname">UNPRIVILEGED_USER</code> and <code class=
5251: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
5252:
5253: <p>As regards bootstrapping, please note that the
5254: <span><strong class="command">bootstrap</strong></span>
5255: script will ease non-root configuration when given the
5256: “<span class=
5257: "quote">--ignore-user-check</span>” flag, as it
5258: will choose and use multiple default directories under
1.45 wiz 5259: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5260: class="filename">~/pkg</code> as the installation
1.33 jmmv 5261: targets. These directories can be overriden by the
5262: “<span class="quote">--prefix</span>” flag
5263: provided by the script, as well as some others that allow
5264: finer tuning of the tree layout.</p>
1.14 xtraeme 5265: </div>
5266:
1.57 ! minskim 5267: <div class="sect1" lang="en">
1.14 xtraeme 5268: <div class="titlepage">
5269: <div>
5270: <div>
5271: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5272: "resume-transfers"></a>7.5. How to resume
1.30 wiz 5273: transfers when fetching distfiles?</h2>
1.14 xtraeme 5274: </div>
5275: </div>
5276: </div>
5277:
1.47 reed 5278: <p>By default, resuming transfers in pkgsrc is disabled,
1.15 xtraeme 5279: but you can enable this feature by adding the option
5280: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45 wiz 5281: into <code xmlns=
5282: "http://www.w3.org/TR/xhtml1/transitional" class=
5283: "filename">/etc/mk.conf</code>. If, during a fetch step,
5284: an incomplete distfile is found, pkgsrc will try to
5285: resume it.</p>
1.15 xtraeme 5286:
5287: <p>You can also use a different program than the default
1.24 wiz 5288: <a href=
5289: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5290: <span class="citerefentry"><span class=
5291: "refentrytitle">ftp</span>(1)</span></a> by changing the
5292: <code class="varname">FETCH_CMD</code> variable. Don't
5293: forget to set <code class=
5294: "varname">FETCH_RESUME_ARGS</code> and <code class=
5295: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
5296: default values.</p>
1.14 xtraeme 5297:
1.45 wiz 5298: <p>For example, if you want to use <code xmlns=
5299: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5300: "filename">wget</code> to resume downloads, you'll have
5301: to use something like:</p>
5302: <pre class="programlisting">
1.51 rillig 5303: FETCH_CMD= wget
5304: FETCH_BEFORE_ARGS= --passive-ftp
5305: FETCH_RESUME_ARGS= -c
5306: FETCH_OUTPUT_ARGS= -O
1.14 xtraeme 5307: </pre>
1.1 grant 5308: </div>
5309:
1.57 ! minskim 5310: <div class="sect1" lang="en">
1.1 grant 5311: <div class="titlepage">
5312: <div>
5313: <div>
5314: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5315: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 5316: install/use XFree86 from pkgsrc?</h2>
5317: </div>
5318: </div>
5319: </div>
5320:
5321: <p>If you want to use XFree86 from pkgsrc instead of your
1.45 wiz 5322: system's own X11 (<code xmlns=
5323: "http://www.w3.org/TR/xhtml1/transitional" class=
5324: "filename">/usr/X11R6</code>, <code xmlns=
5325: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5326: "filename">/usr/openwin</code>, ...), you will have to
1.45 wiz 5327: add the following line into <code xmlns=
5328: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5329: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5330: <pre class="programlisting">
1.51 rillig 5331: X11_TYPE=XFree86
1.1 grant 5332: </pre>
5333: </div>
5334:
1.57 ! minskim 5335: <div class="sect1" lang="en">
1.1 grant 5336: <div class="titlepage">
5337: <div>
5338: <div>
5339: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5340: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 5341: install/use X.org from pkgsrc?</h2>
5342: </div>
5343: </div>
5344: </div>
5345:
5346: <p>If you want to use X.org from pkgsrc instead of your
1.45 wiz 5347: system's own X11 (<code xmlns=
5348: "http://www.w3.org/TR/xhtml1/transitional" class=
5349: "filename">/usr/X11R6</code>, <code xmlns=
5350: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5351: "filename">/usr/openwin</code>, ...) you will have to add
1.45 wiz 5352: the following line into <code xmlns=
5353: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5354: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5355: <pre class="programlisting">
1.51 rillig 5356: X11_TYPE=xorg
1.1 grant 5357: </pre>
5358: </div>
5359:
1.57 ! minskim 5360: <div class="sect1" lang="en">
1.1 grant 5361: <div class="titlepage">
5362: <div>
5363: <div>
5364: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5365: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 5366: files from behind a firewall</h2>
1.1 grant 5367: </div>
5368: </div>
5369: </div>
5370:
5371: <p>If you are sitting behind a firewall which does not
5372: allow direct connections to Internet hosts (i.e.
5373: non-NAT), you may specify the relevant proxy hosts. This
5374: is done using an environment variable in the form of a
1.47 reed 5375: URL, e.g. in Amdahl, the machine “<span class=
1.1 grant 5376: "quote">orpheus.amdahl.com</span>” is one of the
5377: firewalls, and it uses port 80 as the proxy port number.
5378: So the proxy environment variables are:</p>
5379: <pre class="programlisting">
1.51 rillig 5380: ftp_proxy=ftp://orpheus.amdahl.com:80/
5381: http_proxy=http://orpheus.amdahl.com:80/
1.1 grant 5382: </pre>
5383: </div>
5384:
1.57 ! minskim 5385: <div class="sect1" lang="en">
1.1 grant 5386: <div class="titlepage">
5387: <div>
5388: <div>
5389: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 5390: "passive-ftp"></a>7.9. How do I tell
! 5391: <span><strong class="command">make
1.14 xtraeme 5392: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 5393: </div>
5394: </div>
5395: </div>
5396:
5397: <p>This depends on which utility is used to retrieve
1.45 wiz 5398: distfiles. From <code xmlns=
5399: "http://www.w3.org/TR/xhtml1/transitional" class=
5400: "filename">bsd.pkg.mk</code>, <code class=
5401: "varname">FETCH_CMD</code> is assigned the first
5402: available command from the following list:</p>
1.34 wiz 5403:
5404: <div class="itemizedlist">
5405: <ul type="disc">
5406: <li>
1.45 wiz 5407: <p><code xmlns=
5408: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5409: "filename">${LOCALBASE}/bin/ftp</code></p>
5410: </li>
5411:
5412: <li>
1.45 wiz 5413: <p><code xmlns=
5414: "http://www.w3.org/TR/xhtml1/transitional" class=
5415: "filename">/usr/bin/ftp</code></p>
1.34 wiz 5416: </li>
5417: </ul>
5418: </div>
1.1 grant 5419:
5420: <p>On a default NetBSD installation, this will be
1.45 wiz 5421: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5422: class="filename">/usr/bin/ftp</code>, which automatically
5423: tries passive connections first, and falls back to active
5424: connections if the server refuses to do passive. For the
5425: other tools, add the following to your <code xmlns=
5426: "http://www.w3.org/TR/xhtml1/transitional" class=
5427: "filename">/etc/mk.conf</code> file: <code class=
5428: "varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 5429:
1.45 wiz 5430: <p>Having that option present will prevent <code xmlns=
5431: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5432: "filename">/usr/bin/ftp</code> from falling back to
5433: active transfers.</p>
1.1 grant 5434: </div>
5435:
1.57 ! minskim 5436: <div class="sect1" lang="en">
1.1 grant 5437: <div class="titlepage">
5438: <div>
5439: <div>
5440: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5441: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 5442: fetch all distfiles at once</h2>
5443: </div>
5444: </div>
5445: </div>
5446:
5447: <p>You would like to download all the distfiles in a
5448: single batch from work or university, where you can't run
1.14 xtraeme 5449: a <span><strong class="command">make
5450: fetch</strong></span>. There is an archive of distfiles
5451: on <a href=
1.1 grant 5452: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
5453: target="_top">ftp.NetBSD.org</a>, but downloading the
5454: entire directory may not be appropriate.</p>
5455:
1.14 xtraeme 5456: <p>The answer here is to do a <span><strong class=
1.45 wiz 5457: "command">make fetch-list</strong></span> in <code xmlns=
5458: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 5459: "filename">/usr/pkgsrc</code> or one of its
1.1 grant 5460: subdirectories, carry the resulting list to your machine
1.23 wiz 5461: at work/school and use it there. If you don't have a
1.24 wiz 5462: NetBSD-compatible <a href=
5463: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5464: <span class="citerefentry"><span class=
5465: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
5466: at work, don't forget to set <code class=
5467: "varname">FETCH_CMD</code> to something that fetches a
5468: URL:</p>
1.1 grant 5469:
5470: <p>At home:</p>
5471: <pre class="screen">
1.14 xtraeme 5472: <code class="prompt">%</code> <strong class=
5473: "userinput"><code>cd /usr/pkgsrc</code></strong>
5474: <code class="prompt">%</code> <strong class=
5475: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
5476: <code class="prompt">%</code> <strong class=
5477: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 5478: </pre>
5479:
5480: <p>At work:</p>
5481: <pre class="screen">
1.14 xtraeme 5482: <code class="prompt">%</code> <strong class=
5483: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 5484: </pre>
5485:
1.45 wiz 5486: <p>then tar up <code xmlns=
5487: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5488: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 5489:
5490: <p>If you have a machine running NetBSD, and you want to
5491: get <span class="emphasis"><em>all</em></span> distfiles
5492: (even ones that aren't for your machine architecture),
5493: you can do so by using the above-mentioned
1.14 xtraeme 5494: <span><strong class="command">make
5495: fetch-list</strong></span> approach, or fetch the
5496: distfiles directly by running:</p>
1.1 grant 5497: <pre class="screen">
1.14 xtraeme 5498: <code class="prompt">%</code> <strong class=
5499: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 5500: </pre>
5501:
1.14 xtraeme 5502: <p>If you even decide to ignore <code class=
5503: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
5504: can get everything by running:</p>
1.1 grant 5505: <pre class="screen">
1.14 xtraeme 5506: <code class="prompt">%</code> <strong class=
5507: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 5508: </pre>
5509: </div>
5510:
1.57 ! minskim 5511: <div class="sect1" lang="en">
1.1 grant 5512: <div class="titlepage">
5513: <div>
5514: <div>
5515: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5516: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 5517: “<span class="quote">Don't know how to make
5518: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
5519: </div>
5520: </div>
5521: </div>
5522:
5523: <p>When compiling the <a xmlns=
5524: "http://www.w3.org/TR/xhtml1/transitional" href=
5525: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5526: target="_top"><code xmlns="" class=
5527: "filename">pkgtools/pkg_install</code></a> package, you
5528: get the error from make that it doesn't know how to make
5529: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5530: class="filename">/usr/share/tmac/tmac.andoc</code>? This
5531: indicates that you don't have installed the
1.23 wiz 5532: “<span class="quote">text</span>” set (nroff,
5533: ...) from the NetBSD base distribution on your machine.
1.47 reed 5534: It is recommended to do that to format man pages.</p>
1.1 grant 5535:
5536: <p>In the case of the <a xmlns=
5537: "http://www.w3.org/TR/xhtml1/transitional" href=
5538: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5539: target="_top"><code xmlns="" class=
5540: "filename">pkgtools/pkg_install</code></a> package, you
5541: can get away with setting <code class=
1.20 ben 5542: "varname">NOMAN=YES</code> either in the environment or
1.45 wiz 5543: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5544: class="filename">/etc/mk.conf</code>.</p>
1.1 grant 5545: </div>
5546:
1.57 ! minskim 5547: <div class="sect1" lang="en">
1.1 grant 5548: <div class="titlepage">
5549: <div>
5550: <div>
5551: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5552: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 5553: “<span class="quote">Could not find
5554: bsd.own.mk</span>” mean?</h2>
5555: </div>
5556: </div>
5557: </div>
5558:
1.45 wiz 5559: <p>You didn't install the compiler set, <code xmlns=
5560: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5561: "filename">comp.tgz</code>, when you installed your
1.47 reed 5562: NetBSD machine. Please get and install it, by extracting
5563: it in <code xmlns=
1.45 wiz 5564: "http://www.w3.org/TR/xhtml1/transitional" class=
5565: "filename">/</code>:</p>
1.1 grant 5566: <pre class="screen">
1.14 xtraeme 5567: <code class="prompt">#</code> <strong class=
5568: "userinput"><code>cd /</code></strong>
5569: <code class="prompt">#</code> <strong class=
5570: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 5571: </pre>
5572:
1.45 wiz 5573: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5574: class="filename">comp.tgz</code> is part of every NetBSD
5575: release. Get the one that corresponds to your release
5576: (determine via <span><strong class="command">uname
5577: -r</strong></span>).</p>
1.1 grant 5578: </div>
5579:
1.57 ! minskim 5580: <div class="sect1" lang="en">
1.1 grant 5581: <div class="titlepage">
5582: <div>
5583: <div>
5584: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5585: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 5586: 'sudo' with pkgsrc</h2>
5587: </div>
5588: </div>
5589: </div>
5590:
5591: <p>When installing packages as non-root user and using
1.24 wiz 5592: the just-in-time <a href=
5593: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
5594: <span class="citerefentry"><span class=
5595: "refentrytitle">su</span>(1)</span></a> feature of
5596: pkgsrc, it can become annoying to type in the root
5597: password for each required package installed. To avoid
5598: this, the sudo package can be used, which does password
5599: caching over a limited time. To use it, install sudo
5600: (either as binary package or from <a xmlns=
5601: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5602: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45 wiz 5603: target="_top"><code xmlns="" class=
5604: "filename">security/sudo</code></a>) and then put the
5605: following into your <code xmlns=
5606: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 5607: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5608: <pre class="programlisting">
1.51 rillig 5609: .if exists(${LOCALBASE}/bin/sudo)
5610: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
5611: .endif
1.1 grant 5612: </pre>
5613: </div>
5614:
1.57 ! minskim 5615: <div class="sect1" lang="en">
1.1 grant 5616: <div class="titlepage">
5617: <div>
5618: <div>
5619: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 5620: "faq.conf"></a>7.14. How do I change the
! 5621: location of configuration files?</h2>
1.1 grant 5622: </div>
5623: </div>
5624: </div>
5625:
1.35 jmmv 5626: <p>As the system administrator, you can choose where
5627: configuration files are installed. The default settings
1.45 wiz 5628: make all these files go into <code xmlns=
5629: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 5630: "filename">${PREFIX}/etc</code> or some of its
5631: subdirectories; this may be suboptimal depending on your
5632: expectations (e.g., a read-only, NFS-exported
5633: <code class="varname">PREFIX</code> with a need of
5634: per-machine configuration of the provided packages).</p>
5635:
5636: <p>In order to change the defaults, you can modify the
5637: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45 wiz 5638: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5639: class="filename">/etc/mk.conf</code>) to point to your
5640: preferred configuration directory; some common examples
5641: include <code xmlns=
5642: "http://www.w3.org/TR/xhtml1/transitional" class=
5643: "filename">/etc</code> or <code xmlns=
5644: "http://www.w3.org/TR/xhtml1/transitional" class=
5645: "filename">/etc/pkg</code>.</p>
1.35 jmmv 5646:
5647: <p>Furthermore, you can change this value on a
5648: per-package basis by setting the <code class=
5649: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
5650: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
5651: value usually matches the name of the package you would
5652: like to modify, that is, the contents of <code class=
5653: "varname">PKGBASE</code>.</p>
1.1 grant 5654:
1.47 reed 5655: <p>Note that after changing these settings, you must
1.35 jmmv 5656: rebuild and reinstall any affected packages.</p>
1.1 grant 5657: </div>
5658:
1.57 ! minskim 5659: <div class="sect1" lang="en">
1.1 grant 5660: <div class="titlepage">
5661: <div>
5662: <div>
5663: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5664: "audit-packages"></a>7.15. Automated security
1.1 grant 5665: checks</h2>
5666: </div>
5667: </div>
5668: </div>
5669:
5670: <p>Please be aware that there can often be bugs in
5671: third-party software, and some of these bugs can leave a
5672: machine vulnerable to exploitation by attackers. In an
5673: effort to lessen the exposure, the NetBSD packages team
5674: maintains a database of known-exploits to packages which
5675: have at one time been included in pkgsrc. The database
5676: can be downloaded automatically, and a security audit of
5677: all packages installed on a system can take place. To do
5678: this, install the <a xmlns=
5679: "http://www.w3.org/TR/xhtml1/transitional" href=
5680: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5681: target="_top"><code xmlns="" class=
5682: "filename">security/audit-packages</code></a> package. It
1.20 ben 5683: has two components:</p>
1.1 grant 5684:
5685: <div class="orderedlist">
5686: <ol type="1">
5687: <li>
1.34 wiz 5688: <p><span><strong class=
5689: "command">download-vulnerability-list</strong></span>,
1.1 grant 5690: an easy way to download a list of the security
5691: vulnerabilities information. This list is kept up
5692: to date by the NetBSD security officer and the
5693: NetBSD packages team, and is distributed from the
5694: NetBSD ftp server:</p>
5695:
5696: <p><a href=
5697: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 5698: target=
5699: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 5700: </li>
5701:
5702: <li>
1.34 wiz 5703: <p><span><strong class=
5704: "command">audit-packages</strong></span>, an easy
5705: way to audit the current machine, checking each
1.1 grant 5706: vulnerability which is known. If a vulnerable
5707: package is installed, it will be shown by output to
5708: stdout, including a description of the type of
5709: vulnerability, and a URL containing more
5710: information.</p>
5711: </li>
5712: </ol>
5713: </div>
5714:
1.23 wiz 5715: <p>Use of the <a xmlns=
5716: "http://www.w3.org/TR/xhtml1/transitional" href=
5717: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5718: target="_top"><code xmlns="" class=
5719: "filename">security/audit-packages</code></a> package is
1.23 wiz 5720: strongly recommended! After “<span class=
5721: "quote">audit-packages</span>” is installed, please
5722: read the package's message, which you can get by running
5723: <strong class="userinput"><code>pkg_info -D
5724: audit-package</code></strong>.</p>
1.1 grant 5725: </div>
5726: </div>
5727: </div>
5728:
1.57 ! minskim 5729: <div class="part" lang="en">
1.1 grant 5730: <div class="titlepage">
5731: <div>
5732: <div>
1.57 ! minskim 5733: <h1 class="title"><a name=
1.48 dillo 5734: "developers-guide"></a>Part II. The pkgsrc
5735: developer's guide</h1>
1.1 grant 5736: </div>
5737: </div>
5738: </div>
5739:
5740: <div class="toc">
5741: <p><b>Table of Contents</b></p>
5742:
5743: <dl>
1.38 dillo 5744: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 5745: Package components - files, directories and
5746: contents</a></span></dt>
5747:
5748: <dd>
5749: <dl>
5750: <dt><span class="sect1"><a href=
1.45 wiz 5751: "#components.Makefile">8.1. <code xmlns=
5752: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5753: "filename">Makefile</code></a></span></dt>
5754:
5755: <dt><span class="sect1"><a href=
1.45 wiz 5756: "#components.distinfo">8.2. <code xmlns=
5757: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5758: "filename">distinfo</code></a></span></dt>
5759:
5760: <dt><span class="sect1"><a href=
1.38 dillo 5761: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 5762:
1.30 wiz 5763: <dt><span class="sect1"><a href=
1.38 dillo 5764: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 5765: files</a></span></dt>
1.27 rillig 5766:
5767: <dt><span class="sect1"><a href=
1.38 dillo 5768: "#components.optional">8.5. Optional
1.27 rillig 5769: files</a></span></dt>
5770:
1.38 dillo 5771: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 5772: <code xmlns=
5773: "http://www.w3.org/TR/xhtml1/transitional" class=
5774: "filename">work*</code></a></span></dt>
1.27 rillig 5775:
1.38 dillo 5776: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 5777: <code xmlns=
5778: "http://www.w3.org/TR/xhtml1/transitional" class=
5779: "filename">files/*</code></a></span></dt>
1.27 rillig 5780: </dl>
5781: </dd>
5782:
1.38 dillo 5783: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 5784: Programming in <code xmlns=
5785: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5786: "filename">Makefile</code>s</a></span></dt>
5787:
5788: <dd>
5789: <dl>
5790: <dt><span class="sect1"><a href=
1.45 wiz 5791: "#makefile.variables">9.1. <code xmlns=
5792: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5793: "filename">Makefile</code> variables</a></span></dt>
5794:
1.27 rillig 5795: <dd>
5796: <dl>
5797: <dt><span class="sect2"><a href=
1.38 dillo 5798: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 5799: conventions</a></span></dt>
5800: </dl>
5801: </dd>
5802:
1.38 dillo 5803: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 5804: Code snippets</a></span></dt>
5805:
5806: <dd>
5807: <dl>
5808: <dt><span class="sect2"><a href=
1.38 dillo 5809: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 5810: list</a></span></dt>
5811:
5812: <dt><span class="sect2"><a href=
1.38 dillo 5813: "#converting-internal-to-external">9.2.2.
1.30 wiz 5814: Converting an internal list into an external
5815: list</a></span></dt>
1.25 rillig 5816:
5817: <dt><span class="sect2"><a href=
1.38 dillo 5818: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 5819: variables to a shell command</a></span></dt>
1.27 rillig 5820:
5821: <dt><span class="sect2"><a href=
1.38 dillo 5822: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 5823: guideline</a></span></dt>
5824:
5825: <dt><span class="sect2"><a href=
1.38 dillo 5826: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 5827: a bug in BSD Make</a></span></dt>
1.25 rillig 5828: </dl>
5829: </dd>
5830: </dl>
5831: </dd>
5832:
1.38 dillo 5833: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 5834: issues</a></span></dt>
5835:
5836: <dd>
5837: <dl>
1.38 dillo 5838: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 5839: ID</a></span></dt>
5840:
1.30 wiz 5841: <dt><span class="sect1"><a href=
1.38 dillo 5842: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 5843: <code xmlns=
5844: "http://www.w3.org/TR/xhtml1/transitional" class=
5845: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 5846:
1.38 dillo 5847: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 5848: Tweaking output of <span><strong class="command">make
5849: print-PLIST</strong></span></a></span></dt>
1.1 grant 5850:
1.38 dillo 5851: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 5852: Variable substitution in PLIST</a></span></dt>
5853:
1.30 wiz 5854: <dt><span class="sect1"><a href=
1.48 dillo 5855: "#manpage-compression">10.5. Man page
5856: compression</a></span></dt>
1.1 grant 5857:
1.30 wiz 5858: <dt><span class="sect1"><a href=
1.38 dillo 5859: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 5860: <code class=
1.14 xtraeme 5861: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5862:
1.30 wiz 5863: <dt><span class="sect1"><a href=
1.47 reed 5864: "#platform-specific-plist">10.7. Platform-specific
1.38 dillo 5865: and differing PLISTs</a></span></dt>
1.1 grant 5866:
5867: <dt><span class="sect1"><a href=
1.38 dillo 5868: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 5869: packages</a></span></dt>
5870: </dl>
5871: </dd>
5872:
1.38 dillo 5873: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 5874: Buildlink methodology</a></span></dt>
5875:
5876: <dd>
5877: <dl>
1.30 wiz 5878: <dt><span class="sect1"><a href=
1.38 dillo 5879: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 5880: to use buildlink3</a></span></dt>
1.1 grant 5881:
1.30 wiz 5882: <dt><span class="sect1"><a href=
1.45 wiz 5883: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
5884: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5885: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 5886:
5887: <dd>
5888: <dl>
5889: <dt><span class="sect2"><a href=
1.38 dillo 5890: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 5891: buildlink3.mk file</a></span></dt>
1.1 grant 5892:
5893: <dt><span class="sect2"><a href=
1.38 dillo 5894: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 5895: <code class=
1.57 ! minskim 5896: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
! 5897: in <code xmlns=
1.45 wiz 5898: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5899: "filename">buildlink3.mk</code>
1.1 grant 5900: files</a></span></dt>
5901: </dl>
5902: </dd>
5903:
1.30 wiz 5904: <dt><span class="sect1"><a href=
1.45 wiz 5905: "#writing-builtin.mk">11.3. Writing <code xmlns=
5906: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5907: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 5908:
5909: <dd>
5910: <dl>
5911: <dt><span class="sect2"><a href=
1.38 dillo 5912: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 5913: <code xmlns=
5914: "http://www.w3.org/TR/xhtml1/transitional" class=
5915: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 5916:
5917: <dt><span class="sect2"><a href=
1.38 dillo 5918: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 5919: preferences for native or pkgsrc
5920: software</a></span></dt>
1.1 grant 5921: </dl>
5922: </dd>
5923: </dl>
5924: </dd>
5925:
1.38 dillo 5926: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 5927: pkginstall framework</a></span></dt>
5928:
5929: <dd>
5930: <dl>
5931: <dt><span class="sect1"><a href=
1.38 dillo 5932: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 5933: directories outside the installation
5934: prefix</a></span></dt>
5935:
5936: <dd>
5937: <dl>
5938: <dt><span class="sect2"><a href=
1.38 dillo 5939: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 5940: manipulation</a></span></dt>
5941:
5942: <dt><span class="sect2"><a href=
1.38 dillo 5943: "#files-outside-prefix">12.1.2. File
1.35 jmmv 5944: manipulation</a></span></dt>
5945: </dl>
5946: </dd>
5947:
1.38 dillo 5948: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 5949: Configuration files</a></span></dt>
5950:
5951: <dd>
5952: <dl>
5953: <dt><span class="sect2"><a href=
1.38 dillo 5954: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 5955: "varname">PKG_SYSCONFDIR</code> is
5956: set</a></span></dt>
5957:
5958: <dt><span class="sect2"><a href=
1.38 dillo 5959: "#conf-files-configure">12.2.2. Telling the
1.47 reed 5960: software where configuration files
1.35 jmmv 5961: are</a></span></dt>
5962:
5963: <dt><span class="sect2"><a href=
1.38 dillo 5964: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 5965: installations</a></span></dt>
5966:
5967: <dt><span class="sect2"><a href=
1.38 dillo 5968: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 5969: of configuration files</a></span></dt>
5970: </dl>
5971: </dd>
5972:
1.38 dillo 5973: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 5974: System startup scripts</a></span></dt>
5975:
5976: <dd>
5977: <dl>
5978: <dt><span class="sect2"><a href=
1.38 dillo 5979: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 5980: of system startup scripts</a></span></dt>
5981: </dl>
5982: </dd>
5983:
5984: <dt><span class="sect1"><a href=
1.38 dillo 5985: "#users-and-groups">12.4. System users and
1.35 jmmv 5986: groups</a></span></dt>
5987:
1.38 dillo 5988: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 5989: System shells</a></span></dt>
5990:
5991: <dd>
5992: <dl>
5993: <dt><span class="sect2"><a href=
1.38 dillo 5994: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 5995: configuration files</a></span></dt>
5996: </dl>
5997: </dd>
5998: </dl>
5999: </dd>
6000:
1.38 dillo 6001: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 6002: handling</a></span></dt>
6003:
6004: <dd>
6005: <dl>
1.30 wiz 6006: <dt><span class="sect1"><a href=
1.38 dillo 6007: "#global-default-options">13.1. Global default
1.30 wiz 6008: options</a></span></dt>
1.1 grant 6009:
1.30 wiz 6010: <dt><span class="sect1"><a href=
1.38 dillo 6011: "#converting-to-options">13.2. Converting packages to
1.45 wiz 6012: use <code xmlns=
6013: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6014: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 6015:
6016: <dt><span class="sect1"><a href="#option-names">13.3.
6017: Option Names</a></span></dt>
1.1 grant 6018: </dl>
6019: </dd>
6020:
1.38 dillo 6021: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 6022: process</a></span></dt>
6023:
6024: <dd>
6025: <dl>
1.56 rillig 6026: <dt><span class="sect1"><a href="#build.intro">14.1.
6027: Introduction</a></span></dt>
6028:
6029: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 6030: Program location</a></span></dt>
6031:
1.56 rillig 6032: <dt><span class="sect1"><a href=
6033: "#build.builddirs">14.3. Directories used during the
6034: build process</a></span></dt>
1.1 grant 6035:
6036: <dt><span class="sect1"><a href=
1.56 rillig 6037: "#build.running">14.4. Running a
6038: phase</a></span></dt>
6039:
6040: <dt><span class="sect1"><a href="#build.fetch">14.5.
6041: The <span class="emphasis"><em>fetch</em></span>
6042: phase</a></span></dt>
6043:
6044: <dt><span class="sect1"><a href=
6045: "#build.checksum">14.6. The <span class=
6046: "emphasis"><em>checksum</em></span>
6047: phase</a></span></dt>
6048:
6049: <dt><span class="sect1"><a href=
6050: "#build.extract">14.7. The <span class=
6051: "emphasis"><em>extract</em></span>
6052: phase</a></span></dt>
6053:
6054: <dt><span class="sect1"><a href="#build.patch">14.8.
6055: The <span class="emphasis"><em>patch</em></span>
6056: phase</a></span></dt>
6057:
6058: <dt><span class="sect1"><a href="#build.tools">14.9.
6059: The <span class="emphasis"><em>tools</em></span>
6060: phase</a></span></dt>
6061:
6062: <dt><span class="sect1"><a href=
6063: "#build.wrapper">14.10. The <span class=
6064: "emphasis"><em>wrapper</em></span>
6065: phase</a></span></dt>
6066:
6067: <dt><span class="sect1"><a href=
6068: "#build.configure">14.11. The <span class=
6069: "emphasis"><em>configure</em></span>
6070: phase</a></span></dt>
6071:
6072: <dt><span class="sect1"><a href="#build.build">14.12.
6073: The <span class="emphasis"><em>build</em></span>
6074: phase</a></span></dt>
6075:
6076: <dt><span class="sect1"><a href="#build.test">14.13.
6077: The <span class="emphasis"><em>test</em></span>
6078: phase</a></span></dt>
6079:
6080: <dt><span class="sect1"><a href=
6081: "#build.install">14.14. The <span class=
6082: "emphasis"><em>install</em></span>
6083: phase</a></span></dt>
6084:
6085: <dt><span class="sect1"><a href=
6086: "#build.package">14.15. The <span class=
6087: "emphasis"><em>package</em></span>
6088: phase</a></span></dt>
6089:
6090: <dt><span class="sect1"><a href=
6091: "#build.helpful-targets">14.16. Other helpful
1.1 grant 6092: targets</a></span></dt>
6093: </dl>
6094: </dd>
6095:
1.55 rillig 6096: <dt><span class="chapter"><a href="#fixes">15. Making
6097: your package work</a></span></dt>
1.1 grant 6098:
6099: <dd>
6100: <dl>
1.30 wiz 6101: <dt><span class="sect1"><a href=
1.38 dillo 6102: "#general-operation">15.1. General
1.30 wiz 6103: operation</a></span></dt>
1.1 grant 6104:
6105: <dd>
6106: <dl>
6107: <dt><span class="sect2"><a href=
1.38 dillo 6108: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 6109: pull in variables from
6110: /etc/mk.conf</a></span></dt>
1.1 grant 6111:
6112: <dt><span class="sect2"><a href=
1.38 dillo 6113: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 6114: to install documentation</a></span></dt>
6115:
6116: <dt><span class="sect2"><a href=
1.38 dillo 6117: "#restricted-packages">15.1.3. Restricted
1.1 grant 6118: packages</a></span></dt>
6119:
6120: <dt><span class="sect2"><a href=
1.38 dillo 6121: "#dependencies">15.1.4. Handling
1.1 grant 6122: dependencies</a></span></dt>
6123:
6124: <dt><span class="sect2"><a href=
1.38 dillo 6125: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 6126: other packages</a></span></dt>
6127:
6128: <dt><span class="sect2"><a href=
1.38 dillo 6129: "#not-building-packages">15.1.6. Packages that
1.30 wiz 6130: cannot or should not be built</a></span></dt>
1.1 grant 6131:
6132: <dt><span class="sect2"><a href=
1.38 dillo 6133: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 6134: should not be deleted, once
6135: installed</a></span></dt>
1.1 grant 6136:
6137: <dt><span class="sect2"><a href=
1.38 dillo 6138: "#security-handling">15.1.8. Handling packages
1.1 grant 6139: with security problems</a></span></dt>
6140:
6141: <dt><span class="sect2"><a href=
1.38 dillo 6142: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 6143: bugs</a></span></dt>
6144:
6145: <dt><span class="sect2"><a href=
1.38 dillo 6146: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 6147: incrementing versions when fixing an existing
1.1 grant 6148: package</a></span></dt>
6149:
6150: <dt><span class="sect2"><a href=
1.38 dillo 6151: "#portability-of-packages">15.1.11. Portability
1.30 wiz 6152: of packages</a></span></dt>
1.1 grant 6153: </dl>
6154: </dd>
6155:
1.30 wiz 6156: <dt><span class="sect1"><a href=
1.38 dillo 6157: "#downloading-issues">15.2. Possible downloading
1.30 wiz 6158: issues</a></span></dt>
1.1 grant 6159:
6160: <dd>
6161: <dl>
6162: <dt><span class="sect2"><a href=
1.38 dillo 6163: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 6164: distfiles aren't available for plain
1.1 grant 6165: downloading</a></span></dt>
6166:
6167: <dt><span class="sect2"><a href=
1.38 dillo 6168: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 6169: handle modified distfiles with the 'old'
6170: name</a></span></dt>
1.1 grant 6171: </dl>
6172: </dd>
6173:
1.30 wiz 6174: <dt><span class="sect1"><a href=
1.38 dillo 6175: "#configuration-gotchas">15.3. Configuration
1.30 wiz 6176: gotchas</a></span></dt>
1.1 grant 6177:
6178: <dd>
6179: <dl>
6180: <dt><span class="sect2"><a href=
1.38 dillo 6181: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 6182: libtool</a></span></dt>
6183:
6184: <dt><span class="sect2"><a href=
1.38 dillo 6185: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 6186: packages that already support
6187: libtool</a></span></dt>
6188:
6189: <dt><span class="sect2"><a href=
1.38 dillo 6190: "#autoconf-automake">15.3.3. GNU
1.1 grant 6191: Autoconf/Automake</a></span></dt>
6192: </dl>
6193: </dd>
6194:
1.55 rillig 6195: <dt><span class="sect1"><a href="#fixes-build">15.4.
6196: Building the package</a></span></dt>
1.1 grant 6197:
6198: <dd>
6199: <dl>
6200: <dt><span class="sect2"><a href=
1.38 dillo 6201: "#cpp-defines">15.4.1. CPP
1.30 wiz 6202: defines</a></span></dt>
1.51 rillig 6203:
6204: <dt><span class="sect2"><a href=
6205: "#cpp-list">15.4.2. Getting a list of CPP
6206: defines</a></span></dt>
1.1 grant 6207: </dl>
6208: </dd>
6209:
1.30 wiz 6210: <dt><span class="sect1"><a href=
1.38 dillo 6211: "#package-specific-actions">15.5. Package specific
1.30 wiz 6212: actions</a></span></dt>
1.1 grant 6213:
6214: <dd>
6215: <dl>
6216: <dt><span class="sect2"><a href=
1.38 dillo 6217: "#user-interaction">15.5.1. User
1.2 hubertf 6218: interaction</a></span></dt>
1.1 grant 6219:
6220: <dt><span class="sect2"><a href=
1.38 dillo 6221: "#handling-licenses">15.5.2. Handling
1.1 grant 6222: licenses</a></span></dt>
6223:
6224: <dt><span class="sect2"><a href=
1.38 dillo 6225: "#installing-score-files">15.5.3. Installing
1.30 wiz 6226: score files</a></span></dt>
1.1 grant 6227:
6228: <dt><span class="sect2"><a href=
1.38 dillo 6229: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 6230: scripts</a></span></dt>
6231:
6232: <dt><span class="sect2"><a href=
1.38 dillo 6233: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 6234: hardcoded paths to other
6235: interpreters</a></span></dt>
1.1 grant 6236:
6237: <dt><span class="sect2"><a href=
1.38 dillo 6238: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 6239: modules</a></span></dt>
6240:
6241: <dt><span class="sect2"><a href=
1.38 dillo 6242: "#faq.info-files">15.5.7. Packages installing
1.1 grant 6243: info files</a></span></dt>
6244:
6245: <dt><span class="sect2"><a href=
1.57 ! minskim 6246: "#manpages">15.5.8. Packages installing man
! 6247: pages</a></span></dt>
! 6248:
! 6249: <dt><span class="sect2"><a href=
! 6250: "#gconf2-data-files">15.5.9. Packages installing
1.30 wiz 6251: GConf2 data files</a></span></dt>
1.1 grant 6252:
6253: <dt><span class="sect2"><a href=
1.57 ! minskim 6254: "#scrollkeeper-data-files">15.5.10. Packages
1.30 wiz 6255: installing scrollkeeper data
6256: files</a></span></dt>
1.1 grant 6257:
6258: <dt><span class="sect2"><a href=
1.57 ! minskim 6259: "#x11-fonts">15.5.11. Packages installing X11
1.1 grant 6260: fonts</a></span></dt>
6261:
6262: <dt><span class="sect2"><a href=
1.57 ! minskim 6263: "#gtk2-modules">15.5.12. Packages installing GTK2
1.1 grant 6264: modules</a></span></dt>
6265:
6266: <dt><span class="sect2"><a href=
1.57 ! minskim 6267: "#sgml-xml-data">15.5.13. Packages installing
1.30 wiz 6268: SGML or XML data</a></span></dt>
1.1 grant 6269:
6270: <dt><span class="sect2"><a href=
1.57 ! minskim 6271: "#mime-database">15.5.14. Packages installing
1.1 grant 6272: extensions to the MIME database</a></span></dt>
6273:
6274: <dt><span class="sect2"><a href=
1.57 ! minskim 6275: "#intltool">15.5.15. Packages using
1.1 grant 6276: intltool</a></span></dt>
1.18 xtraeme 6277:
6278: <dt><span class="sect2"><a href=
1.57 ! minskim 6279: "#startup-scripts">15.5.16. Packages installing
1.30 wiz 6280: startup scripts</a></span></dt>
1.57 ! minskim 6281:
! 6282: <dt><span class="sect2"><a href=
! 6283: "#tex-packages">15.5.17. Packages installing TeX
! 6284: modules</a></span></dt>
1.1 grant 6285: </dl>
6286: </dd>
6287:
1.30 wiz 6288: <dt><span class="sect1"><a href=
1.38 dillo 6289: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 6290: author</a></span></dt>
1.1 grant 6291: </dl>
6292: </dd>
6293:
1.38 dillo 6294: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 6295: Debugging</a></span></dt>
6296:
1.38 dillo 6297: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 6298: Submitting and Committing</a></span></dt>
6299:
6300: <dd>
6301: <dl>
1.30 wiz 6302: <dt><span class="sect1"><a href=
1.38 dillo 6303: "#submitting-your-package">17.1. Submitting your
1.30 wiz 6304: packages</a></span></dt>
1.1 grant 6305:
1.30 wiz 6306: <dt><span class="sect1"><a href=
1.41 wiz 6307: "#general-notes-for-changes">17.2. General notes when
6308: adding, updating, or removing
6309: packages</a></span></dt>
6310:
6311: <dt><span class="sect1"><a href=
6312: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 6313: package into CVS</a></span></dt>
1.1 grant 6314:
1.30 wiz 6315: <dt><span class="sect1"><a href=
1.41 wiz 6316: "#updating-package">17.4. Updating a package to a
1.30 wiz 6317: newer version</a></span></dt>
1.1 grant 6318:
1.30 wiz 6319: <dt><span class="sect1"><a href=
1.41 wiz 6320: "#moving-package">17.5. Moving a package in
1.30 wiz 6321: pkgsrc</a></span></dt>
1.1 grant 6322: </dl>
6323: </dd>
6324: </dl>
6325: </div>
6326:
1.57 ! minskim 6327: <div class="chapter" lang="en">
1.1 grant 6328: <div class="titlepage">
6329: <div>
6330: <div>
1.57 ! minskim 6331: <h2 class="title"><a name=
1.38 dillo 6332: "components"></a>Chapter 8. Package
1.27 rillig 6333: components - files, directories and contents</h2>
1.25 rillig 6334: </div>
6335: </div>
6336: </div>
6337:
6338: <div class="toc">
6339: <p><b>Table of Contents</b></p>
6340:
6341: <dl>
6342: <dt><span class="sect1"><a href=
1.45 wiz 6343: "#components.Makefile">8.1. <code xmlns=
6344: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6345: "filename">Makefile</code></a></span></dt>
6346:
6347: <dt><span class="sect1"><a href=
1.45 wiz 6348: "#components.distinfo">8.2. <code xmlns=
6349: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6350: "filename">distinfo</code></a></span></dt>
6351:
6352: <dt><span class="sect1"><a href=
1.38 dillo 6353: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 6354:
1.30 wiz 6355: <dt><span class="sect1"><a href=
1.38 dillo 6356: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6357: files</a></span></dt>
1.25 rillig 6358:
1.27 rillig 6359: <dt><span class="sect1"><a href=
1.38 dillo 6360: "#components.optional">8.5. Optional
1.27 rillig 6361: files</a></span></dt>
1.25 rillig 6362:
1.38 dillo 6363: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6364: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6365: class="filename">work*</code></a></span></dt>
1.25 rillig 6366:
1.38 dillo 6367: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6368: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6369: class="filename">files/*</code></a></span></dt>
1.25 rillig 6370: </dl>
6371: </div>
6372:
1.27 rillig 6373: <p>Whenever you're preparing a package, there are a number
6374: of files involved which are described in the following
6375: sections.</p>
1.25 rillig 6376:
1.57 ! minskim 6377: <div class="sect1" lang="en">
1.25 rillig 6378: <div class="titlepage">
6379: <div>
6380: <div>
6381: <h2 class="title" style="clear: both"><a name=
1.45 wiz 6382: "components.Makefile"></a>8.1. <code xmlns=
6383: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6384: "filename">Makefile</code></h2>
1.25 rillig 6385: </div>
6386: </div>
6387: </div>
6388:
1.27 rillig 6389: <p>Building, installation and creation of a binary
1.45 wiz 6390: package are all controlled by the package's <code xmlns=
6391: "http://www.w3.org/TR/xhtml1/transitional" class=
6392: "filename">Makefile</code>. The <code xmlns=
6393: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6394: "filename">Makefile</code> describes various things about
6395: a package, for example from where to get it, how to
6396: configure, build, and install it.</p>
6397:
1.45 wiz 6398: <p>A package <code xmlns=
6399: "http://www.w3.org/TR/xhtml1/transitional" class=
6400: "filename">Makefile</code> contains several sections that
6401: describe the package.</p>
1.25 rillig 6402:
1.27 rillig 6403: <p>In the first section there are the following
6404: variables, which should appear exactly in the order given
6405: here.</p>
1.25 rillig 6406:
6407: <div class="itemizedlist">
6408: <ul type="disc">
6409: <li>
1.27 rillig 6410: <p><code class="varname">DISTNAME</code> is the
6411: basename of the distribution file to be downloaded
6412: from the package's website.</p>
6413: </li>
6414:
6415: <li>
6416: <p><code class="varname">PKGNAME</code> is the name
6417: of the package, as used by pkgsrc. You only need to
1.50 rillig 6418: provide it if it differs from <code class=
6419: "varname">DISTNAME</code>. Usually it is the
6420: directory name together with the version number. It
6421: must match the regular expression <code class=
1.27 rillig 6422: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
6423: that is, it starts with a letter or digit, and
6424: contains only letters, digits, dashes, underscores,
6425: dots and plus signs.</p>
1.25 rillig 6426: </li>
6427:
6428: <li>
1.27 rillig 6429: <p><code class="varname">CATEGORIES</code> is a
6430: list of categories which the package fits in. You
6431: can choose any of the top-level directories of
6432: pkgsrc for it.</p>
1.45 wiz 6433:
6434: <p>Currently the following values are available for
6435: <code class="varname">CATEGORIES</code>. If more
6436: than one is used, they need to be separated by
6437: spaces:</p>
6438: <pre class="programlisting">
1.51 rillig 6439: archivers cross geography meta-pkgs security
6440: audio databases graphics misc shells
6441: benchmarks devel ham multimedia sysutils
6442: biology editors inputmethod net textproc
6443: cad emulators lang news time
6444: chat finance mail parallel wm
6445: comms fonts math pkgtools www
6446: converters games mbone print x11
1.45 wiz 6447: </pre>
1.25 rillig 6448: </li>
6449:
6450: <li>
1.27 rillig 6451: <p><code class="varname">MASTER_SITES</code> is a
6452: list of URLs where the distribution files can be
6453: downloaded. Each URL must end with a slash.</p>
1.45 wiz 6454:
6455: <p>The <code class="varname">MASTER_SITES</code>
6456: may make use of the following predefined sites:</p>
6457: <pre class="programlisting">
1.51 rillig 6458: ${MASTER_SITE_APACHE}
6459: ${MASTER_SITE_BACKUP}
6460: ${MASTER_SITE_CYGWIN}
6461: ${MASTER_SITE_DEBIAN}
6462: ${MASTER_SITE_FREEBSD}
6463: ${MASTER_SITE_FREEBSD_LOCAL}
6464: ${MASTER_SITE_GNOME}
6465: ${MASTER_SITE_GNU}
6466: ${MASTER_SITE_GNUSTEP}
6467: ${MASTER_SITE_IFARCHIVE}
6468: ${MASTER_SITE_MOZILLA}
6469: ${MASTER_SITE_OPENOFFICE}
6470: ${MASTER_SITE_PERL_CPAN}
6471: ${MASTER_SITE_R_CRAN}
6472: ${MASTER_SITE_SOURCEFORGE}
6473: ${MASTER_SITE_SUNSITE}
6474: ${MASTER_SITE_SUSE}
6475: ${MASTER_SITE_TEX_CTAN}
6476: ${MASTER_SITE_XCONTRIB}
6477: ${MASTER_SITE_XEMACS}
1.45 wiz 6478: </pre>
6479:
6480: <p>If one of these predefined sites is chosen, you
6481: may want to specify a subdirectory of that site.
6482: Since these macros may expand to more than one
6483: actual site, you <span class=
6484: "emphasis"><em>must</em></span> use the following
6485: construct to specify a subdirectory:</p>
6486: <pre class="programlisting">
1.51 rillig 6487: ${MASTER_SITE_GNU:=subdirectory/name/}
6488: ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45 wiz 6489: </pre>
6490:
6491: <p>Note the trailing slash after the subdirectory
6492: name.</p>
6493:
6494: <p>If the package has multiple <code class=
6495: "varname">DISTFILES</code> or multiple <code class=
6496: "varname">PATCHFILES</code> from different sites,
6497: set <code class="varname">SITES_foo</code> to a
1.47 reed 6498: list of URIs where file “<span class=
1.45 wiz 6499: "quote">foo</span>” may be found.
6500: “<span class="quote">foo</span>”
1.47 reed 6501: includes the suffix, e.g.:</p>
1.45 wiz 6502: <pre class="programlisting">
1.51 rillig 6503: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
6504: DISTFILES+= foo-file.tar.gz
6505: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
6506: http://www.somewhereelse.com/mirror/somehow/
1.45 wiz 6507: </pre>
6508: </li>
6509:
6510: <li>
6511: <p><code class="varname">DISTFILES</code>: Name(s)
6512: of archive file(s) containing distribution. The
6513: default is <code xmlns=
6514: "http://www.w3.org/TR/xhtml1/transitional" class=
6515: "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
6516: Should only be set if you have more than one
6517: distfile.</p>
6518:
6519: <p>Note that the normal default setting of
6520: <code class="varname">DISTFILES</code> must be made
6521: explicit if you want to add to it (rather than
6522: replace it), as you usually would.</p>
6523: </li>
6524:
6525: <li>
6526: <p><code class="varname">EXTRACT_SUFX</code>:
6527: Suffix of the distribution file, will be appended
6528: to <code class="varname">DISTNAME</code>. Defaults
6529: to <code xmlns=
6530: "http://www.w3.org/TR/xhtml1/transitional" class=
6531: "filename">.tar.gz</code>.</p>
6532: </li>
6533: </ul>
6534: </div>
6535:
6536: <p>The second section contains information about
6537: separately downloaded patches, if any.</p>
6538:
6539: <div class="itemizedlist">
6540: <ul type="disc">
6541: <li>
1.47 reed 6542: <p><code class="varname">PATCHFILES:</code> Name(s)
1.45 wiz 6543: of additional files that contain distribution
6544: patches. There is no default. pkgsrc will look for
6545: them at <code class="varname">PATCH_SITES</code>.
6546: They will automatically be uncompressed before
6547: patching if the names end with <code xmlns=
6548: "http://www.w3.org/TR/xhtml1/transitional" class=
6549: "filename">.gz</code> or <code xmlns=
6550: "http://www.w3.org/TR/xhtml1/transitional" class=
6551: "filename">.Z</code>.</p>
6552: </li>
6553:
6554: <li>
6555: <p><code class="varname">PATCH_SITES</code>:
6556: Primary location(s) for distribution patch files
6557: (see <code class="varname">PATCHFILES</code> below)
6558: if not found locally.</p>
1.25 rillig 6559: </li>
6560: </ul>
6561: </div>
6562:
1.45 wiz 6563: <p>The third section contains the following
1.27 rillig 6564: variables.</p>
1.25 rillig 6565:
1.27 rillig 6566: <div class="itemizedlist">
6567: <ul type="disc">
6568: <li>
6569: <p><code class="varname">MAINTAINER</code> is the
1.50 rillig 6570: email address of the person who feels responsible
6571: for this package, and who is most likely to look at
6572: problems or questions regarding this package which
6573: have been reported with <a href=
1.45 wiz 6574: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
6575: <span class="citerefentry"><span class=
1.50 rillig 6576: "refentrytitle">send-pr</span>(1)</span></a>. Other
6577: developers should contact the <code class=
6578: "varname">MAINTAINER</code> before making major
6579: changes to the package. When packaging a new
6580: program, set <code class=
6581: "varname">MAINTAINER</code> to yourself. If you
6582: really can't maintain the package for future
6583: updates, set it to <code class="email"><<a href=
1.45 wiz 6584: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.27 rillig 6585: </li>
1.25 rillig 6586:
1.27 rillig 6587: <li>
6588: <p><code class="varname">HOMEPAGE</code> is a URL
6589: where users can find more information about the
1.23 wiz 6590: package.</p>
6591: </li>
1.1 grant 6592:
1.23 wiz 6593: <li>
6594: <p><code class="varname">COMMENT</code> is a
1.45 wiz 6595: one-line description of the package (should not
6596: include the package name).</p>
1.23 wiz 6597: </li>
6598: </ul>
6599: </div>
1.1 grant 6600:
1.45 wiz 6601: <p>Other variables that affect the build:</p>
1.1 grant 6602:
1.45 wiz 6603: <div class="itemizedlist">
6604: <ul type="disc">
6605: <li>
6606: <p><code class="varname">WRKSRC</code>: The
1.50 rillig 6607: directory where the interesting distribution files
6608: of the package are found. The default is
6609: <code xmlns=
6610: "http://www.w3.org/TR/xhtml1/transitional" class=
6611: "filename">${WRKDIR}/${DISTNAME}</code>, which
6612: works for most packages.</p>
6613:
6614: <p>If a package doesn't create a subdirectory for
6615: itself (most GNU software does, for instance), but
6616: extracts itself in the current directory, you
6617: should set <code class="varname">WRKSRC=
6618: ${WRKDIR}</code>.</p>
6619:
6620: <p>If a package doesn't create a subdirectory with
6621: the name of <code class="varname">DISTNAME</code>
6622: but some different name, set <code class=
6623: "varname">WRKSRC</code> to point to the proper name
6624: in <code xmlns=
6625: "http://www.w3.org/TR/xhtml1/transitional" class=
6626: "filename">${WRKDIR}</code>, for example
6627: <code class="varname">WRKSRC=
6628: ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
6629: "http://www.w3.org/TR/xhtml1/transitional" href=
6630: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
6631: target="_top"><code xmlns="" class=
6632: "filename">lang/tcl</code></a> and <a xmlns=
6633: "http://www.w3.org/TR/xhtml1/transitional" href=
6634: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
6635: target="_top"><code xmlns="" class=
6636: "filename">x11/tk</code></a> for other
6637: examples.</p>
6638:
6639: <p>The name of the working directory created by
6640: pkgsrc is taken from the <code class=
6641: "varname">WRKDIR_BASENAME</code> variable. By
6642: default, its value is <code xmlns=
6643: "http://www.w3.org/TR/xhtml1/transitional" class=
6644: "filename">work</code>. If you want to use the same
6645: pkgsrc tree for building different kinds of binary
6646: packages, you can change the variable according to
6647: your needs. Two other variables handle common cases
6648: of setting <code class=
6649: "varname">WRKDIR_BASENAME</code> individually. If
6650: <code class="varname">OBJHOSTNAME</code> is defined
6651: in <code xmlns=
1.45 wiz 6652: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6653: "filename">/etc/mk.conf</code>, the first component
6654: of the host's name is attached to the directory
6655: name. If <code class="varname">OBJMACHINE</code> is
6656: defined, the platform name is attached, which might
6657: look like <code xmlns=
6658: "http://www.w3.org/TR/xhtml1/transitional" class=
6659: "filename">work.i386</code> or <code xmlns=
1.45 wiz 6660: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6661: "filename">work.sparc</code>.</p>
1.45 wiz 6662: </li>
6663: </ul>
1.1 grant 6664: </div>
6665:
6666: <p>Please pay attention to the following gotchas:</p>
6667:
6668: <div class="itemizedlist">
6669: <ul type="disc">
6670: <li>
1.14 xtraeme 6671: <p>Add <code class="varname">MANCOMPRESSED</code>
1.47 reed 6672: if man pages are installed in compressed form by
6673: the package; see comment in <code xmlns=
1.45 wiz 6674: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6675: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 6676: </li>
6677:
6678: <li>
1.45 wiz 6679: <p>Replace <code xmlns=
6680: "http://www.w3.org/TR/xhtml1/transitional" class=
6681: "filename">/usr/local</code> with
6682: “<span class="quote">${PREFIX}</span>”
6683: in all files (see patches, below).</p>
1.1 grant 6684: </li>
6685:
6686: <li>
6687: <p>If the package installs any info files, see
6688: <a href="#faq.info-files" title=
1.45 wiz 6689: "15.5.7. Packages installing info files">Section 15.5.7,
6690: “Packages installing info
1.1 grant 6691: files”</a>.</p>
6692: </li>
6693: </ul>
6694: </div>
6695: </div>
6696:
1.57 ! minskim 6697: <div class="sect1" lang="en">
1.1 grant 6698: <div class="titlepage">
6699: <div>
6700: <div>
6701: <h2 class="title" style="clear: both"><a name=
1.45 wiz 6702: "components.distinfo"></a>8.2. <code xmlns=
6703: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6704: "filename">distinfo</code></h2>
1.1 grant 6705: </div>
6706: </div>
6707: </div>
6708:
1.50 rillig 6709: <p>The <code xmlns=
6710: "http://www.w3.org/TR/xhtml1/transitional" class=
6711: "filename">distinfo</code> file contains the message
6712: digest, or checksum, of each distfile needed for the
6713: package. This ensures that the distfiles retrieved from
6714: the Internet have not been corrupted during transfer or
6715: altered by a malign force to introduce a security hole.
6716: Due to recent rumor about weaknesses of digest
6717: algorithms, all distfiles are protected using both SHA1
6718: and RMD160 message digests, as well as the file size.</p>
6719:
6720: <p>The <code xmlns=
6721: "http://www.w3.org/TR/xhtml1/transitional" class=
6722: "filename">distinfo</code> file also contains the
6723: checksums for all the patches found in the <code xmlns=
6724: "http://www.w3.org/TR/xhtml1/transitional" class=
6725: "filename">patches</code> directory (see <a href=
6726: "#components.patches" title=
6727: "8.3. patches/*">Section 8.3,
6728: “patches/*”</a>).</p>
6729:
6730: <p>To regenerate the <code xmlns=
6731: "http://www.w3.org/TR/xhtml1/transitional" class=
6732: "filename">distinfo</code> file, use the
1.14 xtraeme 6733: <span><strong class="command">make
1.50 rillig 6734: makedistinfo</strong></span> or <span><strong class=
6735: "command">make mdi</strong></span> command.</p>
1.1 grant 6736:
1.50 rillig 6737: <p>Some packages have different sets of distfiles
6738: depending on the platform, for example <a xmlns=
1.1 grant 6739: "http://www.w3.org/TR/xhtml1/transitional" href=
6740: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45 wiz 6741: target="_top"><code xmlns="" class=
6742: "filename">www/navigator</code></a>). These are kept in
1.50 rillig 6743: the same <code xmlns=
1.45 wiz 6744: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6745: "filename">distinfo</code> file and care should be taken
6746: when upgrading such a package to ensure distfile
6747: information is not lost.</p>
1.1 grant 6748: </div>
6749:
1.57 ! minskim 6750: <div class="sect1" lang="en">
1.1 grant 6751: <div class="titlepage">
6752: <div>
6753: <div>
6754: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6755: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 6756: </div>
6757: </div>
6758: </div>
6759:
6760: <p>This directory contains files that are used by the
6761: <a href=
6762: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
6763: <span class="citerefentry"><span class=
6764: "refentrytitle">patch</span>(1)</span></a> command to
6765: modify the sources as distributed in the distribution
6766: file into a form that will compile and run perfectly on
6767: NetBSD. The files are applied successively in alphabetic
6768: order (as returned by a shell “<span class=
6769: "quote">patches/patch-*</span>” glob expansion), so
1.45 wiz 6770: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6771: class="filename">patch-aa</code> is applied before
6772: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6773: class="filename">patch-ab</code>, etc.</p>
6774:
6775: <p>The <code xmlns=
6776: "http://www.w3.org/TR/xhtml1/transitional" class=
6777: "filename">patch-*</code> files should be in
6778: <span><strong class="command">diff -bu</strong></span>
6779: format, and apply without a fuzz to avoid problems. (To
6780: force patches to apply with fuzz you can set <code class=
1.14 xtraeme 6781: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 6782: not put changes for more than one file into a single
1.47 reed 6783: patch file, as this will make future modifications more
1.1 grant 6784: difficult.</p>
6785:
6786: <p>Similar, a file should be patched at most once, not
6787: several times by several different patches. If a file
6788: needs several patches, they should be combined into one
6789: file.</p>
6790:
6791: <p>One important thing to mention is to pay attention
6792: that no RCS IDs get stored in the patch files, as these
6793: will cause problems when later checked into the NetBSD
1.14 xtraeme 6794: CVS tree. Use the <span><strong class=
6795: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 6796: "http://www.w3.org/TR/xhtml1/transitional" href=
6797: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 6798: target="_top"><code xmlns="" class=
6799: "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20 ben 6800: these problems.</p>
1.1 grant 6801:
6802: <p>For even more automation, we recommend using
1.14 xtraeme 6803: <span><strong class="command">mkpatches</strong></span>
6804: from the same package to make a whole set of patches. You
6805: just have to backup files before you edit them to
1.45 wiz 6806: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6807: class="filename">filename.orig</code>, e.g. with
1.14 xtraeme 6808: <span><strong class="command">cp -p filename
6809: filename.orig</strong></span> or, easier, by using
6810: <span><strong class="command">pkgvi</strong></span> again
6811: from the same package. If you upgrade a package this way,
6812: you can easily compare the new set of patches with the
6813: previously existing one with <span><strong class=
6814: "command">patchdiff</strong></span>.</p>
1.1 grant 6815:
6816: <p>When you have finished a package, remember to generate
6817: the checksums for the patch files by using the
1.14 xtraeme 6818: <span><strong class="command">make
6819: makepatchsum</strong></span> command, see <a href=
6820: "#components.distinfo" title=
1.38 dillo 6821: "8.2. distinfo">Section 8.2,
1.45 wiz 6822: “<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6823: class="filename">distinfo</code>”</a>.</p>
1.1 grant 6824:
1.46 gdt 6825: <p>When adding a patch that corrects a problem in the
6826: distfile (rather than e.g. enforcing pkgsrc's view of
6827: where man pages should go), send the patch as a bug
6828: report to the maintainer. This benefits non-pkgsrc users
6829: of the package, and usually enables removing the patch in
6830: future version.</p>
6831:
1.1 grant 6832: <p>Patch files that are distributed by the author or
1.14 xtraeme 6833: other maintainers can be listed in <code class=
6834: "varname">$PATCHFILES</code>.</p>
1.1 grant 6835:
6836: <p>If it is desired to store any patches that should not
6837: be committed into pkgsrc, they can be kept outside the
1.45 wiz 6838: pkgsrc tree in the <code xmlns=
6839: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6840: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 6841: tree there is expected to have the same
6842: “<span class="quote">category/package</span>”
6843: structure as pkgsrc, and patches are expected to be
1.45 wiz 6844: stored inside these dirs (also known as <code xmlns=
6845: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 6846: "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
6847: if you want to keep a private patch for <code xmlns=
1.45 wiz 6848: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6849: "filename">pkgsrc/graphics/png</code>, keep it in
1.45 wiz 6850: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6851: class=
1.14 xtraeme 6852: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
6853: files in the named directory are expected to be patch
1.1 grant 6854: files, and <span class="emphasis"><em>they are applied
6855: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 6856: </div>
6857:
1.57 ! minskim 6858: <div class="sect1" lang="en">
1.27 rillig 6859: <div class="titlepage">
6860: <div>
6861: <div>
6862: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6863: "other-mandatory-files"></a>8.4. Other
1.27 rillig 6864: mandatory files</h2>
6865: </div>
6866: </div>
6867: </div>
6868:
6869: <div class="variablelist">
6870: <dl>
1.45 wiz 6871: <dt><span class="term"><code xmlns=
6872: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6873: "filename">DESCR</code></span></dt>
6874:
6875: <dd>
6876: <p>A multi-line description of the piece of
6877: software. This should include any credits where
6878: they are due. Please bear in mind that others do
6879: not share your sense of humour (or spelling
6880: idiosyncrasies), and that others will read
6881: everything that you write here.</p>
6882: </dd>
6883:
1.45 wiz 6884: <dt><span class="term"><code xmlns=
6885: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6886: "filename">PLIST</code></span></dt>
6887:
6888: <dd>
6889: <p>This file governs the files that are installed
6890: on your system: all the binaries, manual pages,
6891: etc. There are other directives which may be
6892: entered in this file, to control the creation and
6893: deletion of directories, and the location of
6894: inserted files. See <a href="#plist" title=
1.38 dillo 6895: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 6896: <i>PLIST issues</i></a> for more information.</p>
6897: </dd>
6898: </dl>
6899: </div>
6900: </div>
6901:
1.57 ! minskim 6902: <div class="sect1" lang="en">
1.27 rillig 6903: <div class="titlepage">
6904: <div>
6905: <div>
6906: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6907: "components.optional"></a>8.5. Optional
1.27 rillig 6908: files</h2>
6909: </div>
6910: </div>
6911: </div>
6912:
6913: <div class="variablelist">
6914: <dl>
1.45 wiz 6915: <dt><span class="term"><code xmlns=
6916: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6917: "filename">INSTALL</code></span></dt>
6918:
6919: <dd>
6920: <p>This shell script is invoked twice by <a href=
6921: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6922: <span class="citerefentry"><span class=
6923: "refentrytitle">pkg_add</span>(1)</span></a>. First
6924: time after package extraction and before files are
6925: moved in place, the second time after the files to
6926: install are moved in place. This can be used to do
6927: any custom procedures not possible with @exec
1.45 wiz 6928: commands in <code xmlns=
6929: "http://www.w3.org/TR/xhtml1/transitional" class=
6930: "filename">PLIST</code>. See <a href=
1.27 rillig 6931: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6932: <span class="citerefentry"><span class=
6933: "refentrytitle">pkg_add</span>(1)</span></a> and
6934: <a href=
6935: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6936: <span class="citerefentry"><span class=
6937: "refentrytitle">pkg_create</span>(1)</span></a> for
6938: more information.</p>
6939: </dd>
6940:
1.45 wiz 6941: <dt><span class="term"><code xmlns=
6942: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6943: "filename">DEINSTALL</code></span></dt>
6944:
6945: <dd>
6946: <p>This script is executed before and after any
6947: files are removed. It is this script's
6948: responsibility to clean up any additional messy
6949: details around the package's installation, since
6950: all pkg_delete knows is how to delete the files
6951: created in the original distribution. See <a href=
6952: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
6953: <span class="citerefentry"><span class=
6954: "refentrytitle">pkg_delete</span>(1)</span></a> and
6955: <a href=
6956: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6957: <span class="citerefentry"><span class=
6958: "refentrytitle">pkg_create</span>(1)</span></a> for
6959: more information.</p>
6960: </dd>
6961:
1.45 wiz 6962: <dt><span class="term"><code xmlns=
6963: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6964: "filename">MESSAGE</code></span></dt>
6965:
6966: <dd>
1.50 rillig 6967: <p>This file is displayed after installation of the
1.27 rillig 6968: package. Useful for things like legal notices on
6969: almost-free software and hints for updating config
6970: files after installing modules for apache, PHP etc.
6971: Please note that you can modify variables in it
6972: easily by using <code class=
6973: "varname">MESSAGE_SUBST</code> in the package's
1.45 wiz 6974: <code xmlns=
6975: "http://www.w3.org/TR/xhtml1/transitional" class=
6976: "filename">Makefile</code>:</p>
1.27 rillig 6977: <pre class="programlisting">
1.51 rillig 6978: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.27 rillig 6979: </pre>
6980:
6981: <p>replaces "${SOMEVAR}" with “<span class=
1.45 wiz 6982: "quote">somevalue</span>” in <code xmlns=
6983: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6984: "filename">MESSAGE</code>.</p>
6985: </dd>
6986: </dl>
6987: </div>
6988: </div>
6989:
1.57 ! minskim 6990: <div class="sect1" lang="en">
1.27 rillig 6991: <div class="titlepage">
6992: <div>
6993: <div>
6994: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 6995: "work-dir"></a>8.6. <code xmlns=
1.45 wiz 6996: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6997: "filename">work*</code></h2>
6998: </div>
6999: </div>
7000: </div>
7001:
7002: <p>When you type <span><strong class=
1.47 reed 7003: "command">make</strong></span>, the distribution files
7004: are unpacked into the directory denoted by <code class=
1.45 wiz 7005: "varname">WRKDIR</code>. It can be removed by running
7006: <span><strong class="command">make clean</strong></span>.
7007: Besides the sources, this directory is also used to keep
7008: various timestamp files. The directory gets <span class=
7009: "emphasis"><em>removed completely</em></span> on clean.
7010: The default is <code xmlns=
7011: "http://www.w3.org/TR/xhtml1/transitional" class=
7012: "filename">${.CURDIR}/work</code> or <code xmlns=
7013: "http://www.w3.org/TR/xhtml1/transitional" class=
7014: "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
7015: <code class="varname">OBJMACHINE</code> is set.</p>
1.27 rillig 7016: </div>
7017:
1.57 ! minskim 7018: <div class="sect1" lang="en">
1.27 rillig 7019: <div class="titlepage">
7020: <div>
7021: <div>
7022: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7023: "files-dir"></a>8.7. <code xmlns=
7024: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7025: "filename">files/*</code></h2>
7026: </div>
7027: </div>
7028: </div>
7029:
7030: <p>If you have any files that you wish to be placed in
7031: the package prior to configuration or building, you could
7032: place these files here and use a “<span class=
7033: "quote">${CP}</span>” command in the
7034: “<span class="quote">pre-configure</span>”
7035: target to achieve this. Alternatively, you could simply
1.45 wiz 7036: diff the file against <code xmlns=
7037: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7038: "filename">/dev/null</code> and use the patch mechanism
7039: to manage the creation of this file.</p>
7040: </div>
7041: </div>
7042:
1.57 ! minskim 7043: <div class="chapter" lang="en">
1.27 rillig 7044: <div class="titlepage">
7045: <div>
7046: <div>
1.57 ! minskim 7047: <h2 class="title"><a name=
1.38 dillo 7048: "makefile"></a>Chapter 9. Programming in
1.45 wiz 7049: <code xmlns=
7050: "http://www.w3.org/TR/xhtml1/transitional" class=
7051: "filename">Makefile</code>s</h2>
1.27 rillig 7052: </div>
7053: </div>
7054: </div>
7055:
7056: <div class="toc">
7057: <p><b>Table of Contents</b></p>
7058:
7059: <dl>
7060: <dt><span class="sect1"><a href=
1.45 wiz 7061: "#makefile.variables">9.1. <code xmlns=
7062: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7063: "filename">Makefile</code> variables</a></span></dt>
7064:
7065: <dd>
7066: <dl>
7067: <dt><span class="sect2"><a href=
1.38 dillo 7068: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 7069: conventions</a></span></dt>
7070: </dl>
7071: </dd>
7072:
1.38 dillo 7073: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 7074: Code snippets</a></span></dt>
7075:
7076: <dd>
7077: <dl>
1.30 wiz 7078: <dt><span class="sect2"><a href=
1.38 dillo 7079: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 7080: list</a></span></dt>
1.27 rillig 7081:
1.30 wiz 7082: <dt><span class="sect2"><a href=
1.38 dillo 7083: "#converting-internal-to-external">9.2.2.
1.27 rillig 7084: Converting an internal list into an external
7085: list</a></span></dt>
7086:
1.30 wiz 7087: <dt><span class="sect2"><a href=
1.38 dillo 7088: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 7089: variables to a shell command</a></span></dt>
1.27 rillig 7090:
1.30 wiz 7091: <dt><span class="sect2"><a href=
1.38 dillo 7092: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 7093: guideline</a></span></dt>
1.27 rillig 7094:
1.30 wiz 7095: <dt><span class="sect2"><a href=
1.38 dillo 7096: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 7097: bug in BSD Make</a></span></dt>
1.27 rillig 7098: </dl>
7099: </dd>
7100: </dl>
7101: </div>
7102:
1.45 wiz 7103: <p>Pkgsrc consists of many <code xmlns=
7104: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7105: "filename">Makefile</code> fragments, each of which forms a
7106: well-defined part of the pkgsrc system. Using the <a href=
7107: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7108: <span class="citerefentry"><span class=
7109: "refentrytitle">make</span>(1)</span></a> system as a
7110: programming language for a big system like pkgsrc requires
7111: some discipline to keep the code correct and
7112: understandable.</p>
7113:
1.45 wiz 7114: <p>The basic ingredients for <code xmlns=
7115: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7116: "filename">Makefile</code> programming are variables (which
7117: are actually macros) and shell commands. Among these shell
7118: commands may even be more complex ones like <a href=
7119: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
7120: <span class="citerefentry"><span class=
7121: "refentrytitle">awk</span>(1)</span></a> programs. To make
7122: sure that every shell command runs as intended it is
7123: necessary to quote all variables correctly when they are
7124: used.</p>
7125:
7126: <p>This chapter describes some patterns, that appear quite
1.45 wiz 7127: often in <code xmlns=
7128: "http://www.w3.org/TR/xhtml1/transitional" class=
7129: "filename">Makefile</code>s, including the pitfalls that
7130: come along with them.</p>
1.27 rillig 7131:
1.57 ! minskim 7132: <div class="sect1" lang="en">
1.27 rillig 7133: <div class="titlepage">
7134: <div>
7135: <div>
7136: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7137: "makefile.variables"></a>9.1. <code xmlns=
7138: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7139: "filename">Makefile</code> variables</h2>
7140: </div>
7141: </div>
7142: </div>
7143:
1.45 wiz 7144: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7145: class="filename">Makefile</code> variables contain
7146: strings that can be processed using the five operators
7147: ``='', ``+='', ``?='', ``:='', and ``!='', which are
7148: described in the <a href=
1.27 rillig 7149: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7150: <span class="citerefentry"><span class=
7151: "refentrytitle">make</span>(1)</span></a> man page.</p>
7152:
1.45 wiz 7153: <p>When a variable's value is parsed from a <code xmlns=
7154: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7155: "filename">Makefile</code>, the hash character ``#'' and
7156: the backslash character ``\'' are handled specially. If a
7157: backslash is followed by a newline, any whitespace
7158: immediately in front of the backslash, the backslash, the
7159: newline, and any whitespace immediately behind the
7160: newline are replaced with a single space. A backspace
7161: character and an immediately following hash character are
1.47 reed 7162: replaced with a single hash character. Otherwise, the
1.27 rillig 7163: backslash is passed as is. In a variable assignment, any
7164: hash character that is not preceded by a backslash starts
7165: a comment that continues upto the end of the logical
7166: line.</p>
7167:
7168: <p><span class="emphasis"><em>Note:</em></span> Because
7169: of this parsing algorithm the only way to create a
7170: variable consisting of a single backslash is using the
7171: ``!='' operator, for example: <code class=
7172: "varname">BACKSLASH!=echo "\\"</code>.</p>
7173:
7174: <p>So far for defining variables. The other thing you can
7175: do with variables is evaluating them. A variable is
7176: evaluated when it is part of the right side of the ``:=''
7177: or the ``!='' operator, or directly before executing a
7178: shell command which the variable is part of. In all other
1.47 reed 7179: cases, <a href=
1.27 rillig 7180: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7181: <span class="citerefentry"><span class=
7182: "refentrytitle">make</span>(1)</span></a> performs lazy
7183: evaluation, that is, variables are not evaluated until
7184: there's no other way. The ``modifiers'' mentioned in the
7185: man page also evaluate the variable.</p>
7186:
7187: <p>Some of the modifiers split the string into words and
7188: then operate on the words, others operate on the string
1.47 reed 7189: as a whole. When a string is split into words, it is
7190: split as you would expect it from <a href=
1.27 rillig 7191: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
7192: <span class="citerefentry"><span class=
7193: "refentrytitle">sh</span>(1)</span></a>.</p>
7194:
7195: <p>No rule without exception—the
7196: <span><strong class="command">.for</strong></span> loop
7197: does not follow the shell quoting rules but splits at
7198: sequences of whitespace.</p>
7199:
7200: <p>There are several types of variables that should be
7201: handled differently. Strings and two types of lists.</p>
7202:
7203: <div class="itemizedlist">
7204: <ul type="disc">
7205: <li>
7206: <p><span class="emphasis"><em>Strings</em></span>
1.47 reed 7207: can contain arbitrary characters. Nevertheless, you
1.27 rillig 7208: should restrict yourself to only using printable
7209: characters. Examples are <code class=
7210: "varname">PREFIX</code> and <code class=
7211: "varname">COMMENT</code>.</p>
7212: </li>
7213:
7214: <li>
7215: <p><span class="emphasis"><em>Internal
7216: lists</em></span> are lists that are never exported
7217: to any shell command. Their elements are separated
1.47 reed 7218: by whitespace. Therefore, the elements themselves
1.27 rillig 7219: cannot have embedded whitespace. Any other
7220: characters are allowed. Internal lists can be used
7221: in <span><strong class=
7222: "command">.for</strong></span> loops. Examples are
7223: <code class="varname">DEPENDS</code> and
7224: <code class="varname">BUILD_DEPENDS</code>.</p>
7225: </li>
7226:
7227: <li>
7228: <p><span class="emphasis"><em>External
7229: lists</em></span> are lists that may be exported to
7230: a shell command. Their elements can contain any
7231: characters, including whitespace. That's why they
7232: cannot be used in <span><strong class=
7233: "command">.for</strong></span> loops. Examples are
7234: <code class="varname">DISTFILES</code> and
7235: <code class="varname">MASTER_SITES</code>.</p>
7236: </li>
7237: </ul>
7238: </div>
7239:
1.57 ! minskim 7240: <div class="sect2" lang="en">
1.27 rillig 7241: <div class="titlepage">
7242: <div>
7243: <div>
7244: <h3 class="title"><a name=
1.38 dillo 7245: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 7246: conventions</h3>
7247: </div>
7248: </div>
7249: </div>
7250:
7251: <div class="itemizedlist">
7252: <ul type="disc">
7253: <li>
7254: <p>All variable names starting with an underscore
7255: are reserved for use by the pkgsrc
7256: infrastructure. They shall not be used by package
1.45 wiz 7257: <code xmlns=
7258: "http://www.w3.org/TR/xhtml1/transitional" class=
7259: "filename">Makefile</code>s.</p>
1.27 rillig 7260: </li>
7261:
7262: <li>
7263: <p>In <span><strong class=
7264: "command">.for</strong></span> loops you should
7265: use lowercase variable names for the iteration
7266: variables.</p>
7267: </li>
7268:
7269: <li>
7270: <p>All list variables should have a ``plural''
7271: name, e.g. <code class=
7272: "varname">PKG_OPTIONS</code> or <code class=
7273: "varname">DISTFILES</code>.</p>
7274: </li>
7275: </ul>
7276: </div>
7277: </div>
7278: </div>
7279:
1.57 ! minskim 7280: <div class="sect1" lang="en">
1.27 rillig 7281: <div class="titlepage">
7282: <div>
7283: <div>
7284: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7285: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 7286: </div>
7287: </div>
7288: </div>
7289:
7290: <p>This section presents you with some code snippets you
7291: should use in your own code. If you don't find anything
7292: appropriate here, you should test your code and add it
7293: here.</p>
7294:
1.57 ! minskim 7295: <div class="sect2" lang="en">
1.27 rillig 7296: <div class="titlepage">
7297: <div>
7298: <div>
1.57 ! minskim 7299: <h3 class="title"><a name=
1.38 dillo 7300: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 7301: a list</h3>
1.27 rillig 7302: </div>
7303: </div>
7304: </div>
7305: <pre class="programlisting">
1.51 rillig 7306: STRING= foo * bar `date`
7307: INT_LIST= # empty
7308: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
7309: EXT_LIST= # empty
7310: ANOTHER_EXT_LIST= a=b c=d
7311:
7312: INT_LIST+= ${STRING} # 1
7313: INT_LIST+= ${ANOTHER_INT_LIST} # 2
7314: EXT_LIST+= ${STRING:Q} # 3
7315: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
1.27 rillig 7316: </pre>
7317:
7318: <p>When you add a string to an external list (example
7319: 3), it must be quoted. In all other cases, you must not
7320: add a quoting level. You must not merge internal and
7321: external lists, unless you are sure that all entries
7322: are correctly interpreted in both lists.</p>
7323: </div>
7324:
1.57 ! minskim 7325: <div class="sect2" lang="en">
1.27 rillig 7326: <div class="titlepage">
7327: <div>
7328: <div>
1.30 wiz 7329: <h3 class="title"><a name=
1.38 dillo 7330: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 7331: an internal list into an external list</h3>
1.27 rillig 7332: </div>
7333: </div>
7334: </div>
7335: <pre class="programlisting">
1.51 rillig 7336: EXT_LIST= # empty
7337: .for i in ${INT_LIST}
7338: EXT_LIST+= ${i:Q}""
7339: .endfor
1.27 rillig 7340: </pre>
7341:
7342: <p>This code converts the internal list <code class=
7343: "varname">INT_LIST</code> into the external list
7344: <code class="varname">EXT_LIST</code>. As the elements
7345: of an internal list are unquoted they must be quoted
7346: here. The reason for appending <code class=
7347: "varname">""</code> is explained below.</p>
7348: </div>
1.1 grant 7349:
1.57 ! minskim 7350: <div class="sect2" lang="en">
1.27 rillig 7351: <div class="titlepage">
1.1 grant 7352: <div>
1.27 rillig 7353: <div>
1.30 wiz 7354: <h3 class="title"><a name=
1.38 dillo 7355: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 7356: variables to a shell command</h3>
1.27 rillig 7357: </div>
1.1 grant 7358: </div>
7359: </div>
1.27 rillig 7360: <pre class="programlisting">
1.51 rillig 7361: STRING= foo bar < > * `date` $$HOME ' "
7362: EXT_LIST= string=${STRING:Q} x=second\ item
1.27 rillig 7363:
1.51 rillig 7364: all:
7365: echo ${STRING} # 1
7366: echo "${STRING}" # 2
7367: echo "${STRING:Q}" # 3
7368: echo ${STRING:Q} # 4
7369: echo x${STRING:Q} | sed 1s,.,, # 5
7370: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27 rillig 7371: </pre>
7372:
7373: <p>Example 1 leads to a syntax error in the shell, as
7374: the characters are just copied.</p>
7375:
7376: <p>Example 2 leads to a syntax error too, and if you
7377: leave out the last " character from <code class=
7378: "varname">${STRING}</code>, <a href=
7379: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
7380: <span class="citerefentry"><span class=
7381: "refentrytitle">date</span>(1)</span></a> will be
7382: executed. The <code class="varname">$HOME</code> shell
7383: variable would be evaluated, too.</p>
7384:
7385: <p>Example 3 outputs each space character preceded by a
7386: backslash (or not), depending on the implementation of
7387: the <a href=
7388: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7389: <span class="citerefentry"><span class=
7390: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 7391:
1.27 rillig 7392: <p>Example 4 handles correctly every string that does
7393: not start with a dash. In that case, the result depends
7394: on the implementation of the <a href=
7395: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7396: <span class="citerefentry"><span class=
7397: "refentrytitle">echo</span>(1)</span></a> command. As
7398: long as you can guarantee that your input does not
1.47 reed 7399: start with a dash, this form is appropriate.</p>
1.1 grant 7400:
1.27 rillig 7401: <p>Example 5 handles even the case of a leading dash
7402: correctly.</p>
1.1 grant 7403:
1.27 rillig 7404: <p>The <code class="varname">EXT_LIST</code> does not
1.47 reed 7405: need to be quoted because the quoting has already been
1.27 rillig 7406: done when adding elements to the list.</p>
1.1 grant 7407:
1.27 rillig 7408: <p>As internal lists shall not be passed to the shell,
7409: there is no example for it.</p>
1.1 grant 7410: </div>
7411:
1.57 ! minskim 7412: <div class="sect2" lang="en">
1.27 rillig 7413: <div class="titlepage">
1.1 grant 7414: <div>
1.27 rillig 7415: <div>
1.57 ! minskim 7416: <h3 class="title"><a name=
1.38 dillo 7417: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 7418: guideline</h3>
7419: </div>
1.1 grant 7420: </div>
7421: </div>
7422:
1.27 rillig 7423: <p>There are many possible sources of wrongly quoted
7424: variables. This section lists some of the commonly
7425: known ones.</p>
1.1 grant 7426:
1.27 rillig 7427: <div class="itemizedlist">
7428: <ul type="disc">
7429: <li>
7430: <p>Whenever you use the value of a list, think
7431: about what happens to leading or trailing
7432: whitespace. If the list is a well-formed shell
1.47 reed 7433: expression, you can apply the <code class=
1.27 rillig 7434: "varname">:M*</code> modifier to strip leading
7435: and trailing whitespace from each word. The
7436: <code class="varname">:M</code> operator first
7437: splits its argument according to the rules of the
7438: shell, and then creates a new list consisting of
7439: all words that match the shell glob expression
7440: <code class="varname">*</code>, that is: all. One
7441: class of situations where this is needed is when
7442: adding a variable like <code class=
7443: "varname">CPPFLAGS</code> to <code class=
7444: "varname">CONFIGURE_ARGS</code>. If the configure
1.47 reed 7445: script invokes other configure scripts, it strips
1.27 rillig 7446: the leading and trailing whitespace from the
7447: variable and then passes it to the other
7448: configure scripts. But these configure scripts
7449: expect the (child) <code class=
7450: "varname">CPPFLAGS</code> variable to be the same
7451: as the parent <code class=
7452: "varname">CPPFLAGS</code>. That's why we better
7453: pass the <code class="varname">CPPFLAGS</code>
7454: value properly trimmed. And here is how we do
7455: it:</p>
7456: <pre class="programlisting">
1.51 rillig 7457: CPPFLAGS= # empty
7458: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
7459: CPPFLAGS+= ${MY_CPPFLAGS}
7460:
7461: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
7462:
7463: all:
7464: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
7465: echo x${CONFIGURE_ARGS}x # properly trimmed
1.27 rillig 7466: </pre>
7467: </li>
1.1 grant 7468:
1.27 rillig 7469: <li>
7470: <p>The example above contains one bug: The
7471: <code class="varname">${PREFIX}</code> is a
7472: properly quoted shell expression, but there is
7473: the C compiler after it, which also expects a
7474: properly quoted string (this time in C syntax).
7475: The version above is therefore only correct if
7476: <code class="varname">${PREFIX}</code> does not
7477: have embedded backslashes or double quotes. If
7478: you want to allow these, you have to add another
7479: layer of quoting to each variable that is used as
7480: a C string literal. You cannot use the
7481: <code class="varname">:Q</code> operator for it,
7482: as this operator only works for the shell.</p>
7483: </li>
1.1 grant 7484:
1.27 rillig 7485: <li>
1.47 reed 7486: <p>Whenever a variable can be empty, the
1.27 rillig 7487: <code class="varname">:Q</code> operator can have
7488: surprising results. Here are two completely
7489: different cases which can be solved with the same
7490: trick.</p>
7491: <pre class="programlisting">
1.51 rillig 7492: EMPTY= # empty
7493: empty_test:
7494: for i in a ${EMPTY:Q} c; do \
7495: echo "$$i"; \
7496: done
7497:
7498: for_test:
7499: .for i in a:\ a:\test.txt
7500: echo ${i:Q}
7501: echo "foo"
7502: .endfor
1.1 grant 7503: </pre>
7504:
1.27 rillig 7505: <p>The first example will only print two of the
7506: three lines we might have expected. This is
7507: because <code class="varname">${EMPTY:Q}</code>
7508: expands to the empty string, which the shell
7509: cannot see. The workaround is to write
7510: <code class="varname">${EMPTY:Q}""</code>. This
7511: pattern can be often found as <code class=
7512: "varname">${TEST} -z ${VAR:Q}</code> or as
7513: <code class="varname">${TEST} -f
7514: ${FNAME:Q}</code> (both of these are wrong).</p>
7515:
7516: <p>The second example will only print three lines
7517: instead of four. The first line looks like
7518: <code class="varname">a:\ echo foo</code>. This
7519: is because the backslash of the value
7520: <code class="varname">a:\</code> is interpreted
7521: as a line-continuation by <a href=
7522: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7523: <span class="citerefentry"><span class=
7524: "refentrytitle">make</span>(1)</span></a>, which
7525: makes the second line the arguments of the
7526: <a href=
7527: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7528: <span class="citerefentry"><span class=
7529: "refentrytitle">echo</span>(1)</span></a> command
7530: from the first line. To avoid this, write
7531: <code class="varname">${i:Q}""</code>.</p>
7532: </li>
7533: </ul>
7534: </div>
1.1 grant 7535: </div>
7536:
1.57 ! minskim 7537: <div class="sect2" lang="en">
1.27 rillig 7538: <div class="titlepage">
1.1 grant 7539: <div>
1.27 rillig 7540: <div>
1.30 wiz 7541: <h3 class="title"><a name=
1.38 dillo 7542: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 7543: for a bug in BSD Make</h3>
1.27 rillig 7544: </div>
1.1 grant 7545: </div>
7546: </div>
7547:
1.27 rillig 7548: <p>The pkgsrc bmake program does not handle the
7549: following assignment correctly. In case <code class=
7550: "varname">_othervar_</code> contains a ``-'' character,
7551: one of the closing braces is included in <code class=
7552: "varname">${VAR}</code> after this code executes.</p>
7553: <pre class="programlisting">
1.51 rillig 7554: VAR:= ${VAR:N${_othervar_:C/-//}}
1.1 grant 7555: </pre>
7556:
1.27 rillig 7557: <p>For a more complex code snippet and a workaround,
7558: see the package <a xmlns=
7559: "http://www.w3.org/TR/xhtml1/transitional" href=
7560: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45 wiz 7561: target="_top"><code xmlns="" class=
7562: "filename">regress/make-quoting</code></a>, testcase
1.27 rillig 7563: <code class="varname">bug1</code>.</p>
1.1 grant 7564: </div>
7565: </div>
7566: </div>
7567:
1.57 ! minskim 7568: <div class="chapter" lang="en">
1.1 grant 7569: <div class="titlepage">
7570: <div>
7571: <div>
1.57 ! minskim 7572: <h2 class="title"><a name=
1.38 dillo 7573: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 7574: </div>
7575: </div>
7576: </div>
7577:
7578: <div class="toc">
7579: <p><b>Table of Contents</b></p>
7580:
7581: <dl>
1.38 dillo 7582: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 7583: ID</a></span></dt>
7584:
1.30 wiz 7585: <dt><span class="sect1"><a href=
1.38 dillo 7586: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 7587: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7588: class="filename">PLIST</code>
1.14 xtraeme 7589: generation</a></span></dt>
1.1 grant 7590:
1.38 dillo 7591: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 7592: Tweaking output of <span><strong class="command">make
7593: print-PLIST</strong></span></a></span></dt>
1.1 grant 7594:
1.38 dillo 7595: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 7596: Variable substitution in PLIST</a></span></dt>
7597:
1.30 wiz 7598: <dt><span class="sect1"><a href=
1.48 dillo 7599: "#manpage-compression">10.5. Man page
7600: compression</a></span></dt>
1.1 grant 7601:
1.38 dillo 7602: <dt><span class="sect1"><a href=
7603: "#using-PLIST_SRC">10.6. Changing PLIST source with
7604: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 7605:
1.30 wiz 7606: <dt><span class="sect1"><a href=
1.47 reed 7607: "#platform-specific-plist">10.7. Platform-specific and
1.30 wiz 7608: differing PLISTs</a></span></dt>
1.1 grant 7609:
1.38 dillo 7610: <dt><span class="sect1"><a href=
7611: "#faq.common-dirs">10.8. Sharing directories between
7612: packages</a></span></dt>
1.1 grant 7613: </dl>
7614: </div>
7615:
1.45 wiz 7616: <p>The <code xmlns=
7617: "http://www.w3.org/TR/xhtml1/transitional" class=
7618: "filename">PLIST</code> file contains a package's
7619: “<span class="quote">packing list</span>”, i.e.
7620: a list of files that belong to the package (relative to the
7621: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7622: class="filename">${PREFIX}</code> directory it's been
7623: installed in) plus some additional statements - see the
7624: <a href=
1.1 grant 7625: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7626: <span class="citerefentry"><span class=
1.47 reed 7627: "refentrytitle">pkg_create</span>(1)</span></a> man page
7628: for a full list. This chapter addresses some issues that
7629: need attention when dealing with the <code xmlns=
1.45 wiz 7630: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7631: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 7632:
1.57 ! minskim 7633: <div class="sect1" lang="en">
1.1 grant 7634: <div class="titlepage">
7635: <div>
7636: <div>
7637: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 7638: "rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 7639: </div>
7640: </div>
7641: </div>
7642:
7643: <p>Be sure to add a RCS ID line as the first thing in any
1.45 wiz 7644: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7645: class="filename">PLIST</code> file you write:</p>
1.1 grant 7646: <pre class="programlisting">
1.51 rillig 7647: @comment $NetBSD$
1.1 grant 7648: </pre>
7649: </div>
7650:
1.57 ! minskim 7651: <div class="sect1" lang="en">
1.1 grant 7652: <div class="titlepage">
7653: <div>
7654: <div>
7655: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7656: "automatic-plist-generation"></a>10.2. Semi-automatic
1.45 wiz 7657: <code xmlns=
7658: "http://www.w3.org/TR/xhtml1/transitional" class=
7659: "filename">PLIST</code> generation</h2>
1.1 grant 7660: </div>
7661: </div>
7662: </div>
7663:
1.14 xtraeme 7664: <p>You can use the <span><strong class="command">make
7665: print-PLIST</strong></span> command to output a PLIST
7666: that matches any new files since the package was
7667: extracted. See <a href="#build.helpful-targets" title=
1.56 rillig 7668: "14.16. Other helpful targets">Section 14.16,
1.1 grant 7669: “Other helpful targets”</a> for more
7670: information on this target.</p>
7671: </div>
7672:
1.57 ! minskim 7673: <div class="sect1" lang="en">
1.1 grant 7674: <div class="titlepage">
7675: <div>
7676: <div>
7677: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7678: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 7679: <span><strong class="command">make
7680: print-PLIST</strong></span></h2>
1.1 grant 7681: </div>
7682: </div>
7683: </div>
7684:
7685: <p>If you have used any of the *-dirs packages, as
7686: explained in <a href="#faq.common-dirs" title=
1.38 dillo 7687: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 7688: “Sharing directories between packages”</a>,
1.14 xtraeme 7689: you may have noticed that <span><strong class=
7690: "command">make print-PLIST</strong></span> outputs a set
7691: of <code class="varname">@comment</code>s instead of real
7692: <code class="varname">@dirrm</code> lines. You can also
7693: do this for specific directories and files, so that the
7694: results of that command are very close to reality. This
7695: helps <span class="emphasis"><em>a lot</em></span> during
7696: the update of packages.</p>
7697:
7698: <p>The <code class="varname">PRINT_PLIST_AWK</code>
7699: variable takes a set of AWK patterns and actions that are
7700: used to filter the output of print-PLIST. You can
7701: <span class="emphasis"><em>append</em></span> any chunk
7702: of AWK scripting you like to it, but be careful with
1.1 grant 7703: quoting.</p>
7704:
1.45 wiz 7705: <p>For example, to get all files inside the <code xmlns=
7706: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7707: "filename">libdata/foo</code> directory removed from the
1.1 grant 7708: resulting PLIST:</p>
7709: <pre class="programlisting">
1.51 rillig 7710: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 grant 7711: </pre>
7712:
1.14 xtraeme 7713: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 7714: lines referring to a specific (shared) directory
1.14 xtraeme 7715: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 7716: <pre class="programlisting">
1.51 rillig 7717: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1 grant 7718: </pre>
7719: </div>
7720:
1.57 ! minskim 7721: <div class="sect1" lang="en">
1.1 grant 7722: <div class="titlepage">
7723: <div>
7724: <div>
7725: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7726: "plist.misc"></a>10.4. Variable substitution
7727: in PLIST</h2>
1.1 grant 7728: </div>
7729: </div>
7730: </div>
7731:
7732: <p>A number of variables are substituted automatically in
7733: PLISTs when a package is installed on a system. This
7734: includes the following variables:</p>
7735:
7736: <div class="variablelist">
7737: <dl>
1.14 xtraeme 7738: <dt><span class="term"><code class=
7739: "varname">${MACHINE_ARCH}</code>, <code class=
7740: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 7741:
7742: <dd>
7743: <p>Some packages like emacs and perl embed
7744: information about which architecture they were
7745: built on into the pathnames where they install
1.47 reed 7746: their files. To handle this case, PLIST will be
1.1 grant 7747: preprocessed before actually used, and the symbol
1.14 xtraeme 7748: “<span class="quote"><code class=
7749: "varname">${MACHINE_ARCH}</code></span>” will
7750: be replaced by what <span><strong class=
7751: "command">uname -p</strong></span> gives. The same
7752: is done if the string <code class=
7753: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
7754: PLIST somewhere - use this on packages that have
1.47 reed 7755: GNU autoconf-created configure scripts.</p>
1.1 grant 7756:
7757: <div class="note" style=
7758: "margin-left: 0.5in; margin-right: 0.5in;">
7759: <h3 class="title">Legacy note</h3>
7760:
7761: <p>There used to be a symbol “<span class=
1.14 xtraeme 7762: "quote"><code class=
7763: "varname">$ARCH</code></span>” that was
7764: replaced by the output of <span><strong class=
7765: "command">uname -m</strong></span>, but that's no
1.1 grant 7766: longer supported and has been removed.</p>
7767: </div>
7768: </dd>
7769:
1.14 xtraeme 7770: <dt><span class="term"><code class=
7771: "varname">${OPSYS}</code>, <code class=
7772: "varname">${LOWER_OPSYS}</code>, <code class=
7773: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 7774:
7775: <dd>
7776: <p>Some packages want to embed the OS name and
7777: version into some paths. To do this, use these
1.45 wiz 7778: variables in the <code xmlns=
7779: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7780: "filename">PLIST</code>:</p>
1.1 grant 7781:
7782: <div class="itemizedlist">
7783: <ul type="disc">
7784: <li>
1.14 xtraeme 7785: <p><code class="varname">${OPSYS}</code> -
7786: output of “<span class=
7787: "quote"><span><strong class="command">uname
7788: -s</strong></span></span>”</p>
1.1 grant 7789: </li>
7790:
7791: <li>
1.14 xtraeme 7792: <p><code class=
7793: "varname">${LOWER_OPSYS}</code> - lowercase
7794: common name (eg. “<span class=
7795: "quote">solaris</span>”)</p>
1.1 grant 7796: </li>
7797:
7798: <li>
1.14 xtraeme 7799: <p><code class="varname">${OS_VERSION}</code>
7800: - “<span class=
7801: "quote"><span><strong class="command">uname
7802: -r</strong></span></span>”</p>
1.1 grant 7803: </li>
7804: </ul>
7805: </div>
7806: </dd>
7807:
1.14 xtraeme 7808: <dt><span class="term"><code class=
7809: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 7810:
7811: <dd>
7812: <p>Packages that install locale files should list
7813: them in the PLIST as “<span class=
7814: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
7815: instead of “<span class=
7816: "quote">share/locale/de/LC_MESSAGES/...</span>”.
7817: This properly handles the fact that different
7818: operating systems expect locale files to be either
1.45 wiz 7819: in <code xmlns=
7820: "http://www.w3.org/TR/xhtml1/transitional" class=
7821: "filename">share</code> or <code xmlns=
7822: "http://www.w3.org/TR/xhtml1/transitional" class=
7823: "filename">lib</code> by default.</p>
1.1 grant 7824: </dd>
7825: </dl>
7826: </div>
7827:
7828: <p>For a complete list of values which are replaced by
1.45 wiz 7829: default, please look in <code xmlns=
7830: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7831: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 7832: "emphasis"><em>PLIST_SUBST</em></span>).</p>
7833:
7834: <p>If you want to change other variables not listed
7835: above, you can add variables and their expansions to this
1.14 xtraeme 7836: variable in the following way, similar to <code class=
7837: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 7838: "#components.optional" title=
1.38 dillo 7839: "8.5. Optional files">Section 8.5,
1.1 grant 7840: “Optional files”</a>):</p>
7841: <pre class="programlisting">
1.51 rillig 7842: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 grant 7843: </pre>
7844:
7845: <p>This replaces all occurrences of “<span class=
7846: "quote">${SOMEVAR}</span>” in the PLIST with
7847: “<span class="quote">somevalue</span>”.</p>
7848: </div>
7849:
1.57 ! minskim 7850: <div class="sect1" lang="en">
1.1 grant 7851: <div class="titlepage">
7852: <div>
7853: <div>
7854: <h2 class="title" style="clear: both"><a name=
1.48 dillo 7855: "manpage-compression"></a>10.5. Man page
7856: compression</h2>
1.1 grant 7857: </div>
7858: </div>
7859: </div>
7860:
1.47 reed 7861: <p>Man pages should be installed in compressed form if
1.45 wiz 7862: <code class="varname">MANZ</code> is set (in <code xmlns=
7863: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7864: "filename">bsd.own.mk</code>), and uncompressed
1.45 wiz 7865: otherwise. To handle this in the <code xmlns=
7866: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7867: "filename">PLIST</code> file, the suffix
7868: “<span class="quote">.gz</span>” is
1.47 reed 7869: appended/removed automatically for man pages according to
1.14 xtraeme 7870: <code class="varname">MANZ</code> and <code class=
7871: "varname">MANCOMPRESSED</code> being set or not, see
1.45 wiz 7872: above for details. This modification of the <code xmlns=
7873: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7874: "filename">PLIST</code> file is done on a copy of it, not
1.45 wiz 7875: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7876: class="filename">PLIST</code> itself.</p>
1.1 grant 7877: </div>
7878:
1.57 ! minskim 7879: <div class="sect1" lang="en">
1.1 grant 7880: <div class="titlepage">
7881: <div>
7882: <div>
7883: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7884: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 7885: source with <code class=
1.14 xtraeme 7886: "varname">PLIST_SRC</code></h2>
1.1 grant 7887: </div>
7888: </div>
7889: </div>
7890:
1.14 xtraeme 7891: <p>To use one or more files as source for the
1.45 wiz 7892: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7893: class="filename">PLIST</code> used in generating the
7894: binary package, set the variable <code class=
1.14 xtraeme 7895: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 7896: The files are later concatenated using <a href=
7897: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
7898: <span class="citerefentry"><span class=
7899: "refentrytitle">cat</span>(1)</span></a>, and order of
7900: things is important.</p>
1.1 grant 7901: </div>
7902:
1.57 ! minskim 7903: <div class="sect1" lang="en">
1.1 grant 7904: <div class="titlepage">
7905: <div>
7906: <div>
7907: <h2 class="title" style="clear: both"><a name=
1.47 reed 7908: "platform-specific-plist"></a>10.7. Platform-specific
7909: and differing PLISTs</h2>
1.1 grant 7910: </div>
7911: </div>
7912: </div>
7913:
7914: <p>Some packages decide to install a different set of
7915: files based on the operating system being used. These
7916: differences can be automatically handled by using the
7917: following files:</p>
7918:
7919: <div class="itemizedlist">
7920: <ul type="disc">
7921: <li>
1.45 wiz 7922: <p><code xmlns=
7923: "http://www.w3.org/TR/xhtml1/transitional" class=
7924: "filename">PLIST.common</code></p>
1.1 grant 7925: </li>
7926:
7927: <li>
1.45 wiz 7928: <p><code xmlns=
7929: "http://www.w3.org/TR/xhtml1/transitional" class=
7930: "filename">PLIST.${OPSYS}</code></p>
1.1 grant 7931: </li>
7932:
7933: <li>
1.45 wiz 7934: <p><code xmlns=
7935: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 7936: "filename">PLIST.${MACHINE_ARCH}</code></p>
7937: </li>
7938:
7939: <li>
1.45 wiz 7940: <p><code xmlns=
7941: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 7942: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
7943: </li>
7944:
7945: <li>
1.45 wiz 7946: <p><code xmlns=
7947: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7948: "filename">PLIST.common_end</code></p>
1.1 grant 7949: </li>
7950: </ul>
7951: </div>
7952: </div>
7953:
1.57 ! minskim 7954: <div class="sect1" lang="en">
1.1 grant 7955: <div class="titlepage">
7956: <div>
7957: <div>
7958: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7959: "faq.common-dirs"></a>10.8. Sharing
7960: directories between packages</h2>
1.1 grant 7961: </div>
7962: </div>
7963: </div>
7964:
7965: <p>A “<span class="quote">shared
7966: directory</span>” is a directory where multiple
7967: (and unrelated) packages install files. These directories
7968: are problematic because you have to add special tricks in
7969: the PLIST to conditionally remove them, or have some
7970: centralized package handle them.</p>
7971:
7972: <p>Within pkgsrc, you'll find both approaches. If a
7973: directory is shared by a few unrelated packages, it's
7974: often not worth to add an extra package to remove it.
7975: Therefore, one simply does:</p>
7976: <pre class="programlisting">
1.51 rillig 7977: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
1.1 grant 7978: </pre>
7979:
7980: <p>in the PLISTs of all affected packages, instead of the
7981: regular "@dirrm" line.</p>
7982:
7983: <p>However, if the directory is shared across many
7984: packages, two different solutions are available:</p>
7985:
7986: <div class="orderedlist">
7987: <ol type="1">
7988: <li>
7989: <p>If the packages have a common dependency, the
7990: directory can be removed in that. For example, see
7991: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
7992: href=
7993: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45 wiz 7994: target="_top"><code xmlns="" class=
7995: "filename">textproc/scrollkeeper</code></a>, which
7996: removes the shared directory <code xmlns=
7997: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 7998: "filename">share/omf</code>.</p>
1.1 grant 7999: </li>
8000:
8001: <li>
8002: <p>If the packages using the directory are not
8003: related at all (they have no common dependencies),
8004: a *-dirs package is used.</p>
8005: </li>
8006: </ol>
8007: </div>
8008:
8009: <p>From now on, we'll discuss the second solution. To get
8010: an idea of the *-dirs packages available, issue:</p>
8011: <pre class="programlisting">
1.51 rillig 8012: <code class="prompt">%</code> cd .../pkgsrc
8013: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 8014: </pre>
8015:
8016: <p>Their use from other packages is very simple. The
1.14 xtraeme 8017: <code class="varname">USE_DIRS</code> variable takes a
8018: list of package names (without the “<span class=
1.1 grant 8019: "quote">-dirs</span>” part) together with the
8020: required version number (always pick the latest one when
1.34 wiz 8021: writing new packages).</p>
1.1 grant 8022:
8023: <p>For example, if a package installs files under
1.45 wiz 8024: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8025: class="filename">share/applications</code>, it should
8026: have the following line in it:</p>
1.1 grant 8027: <pre class="programlisting">
1.51 rillig 8028: USE_DIRS+= xdg-1.1
1.1 grant 8029: </pre>
8030:
1.14 xtraeme 8031: <p>After regenerating the PLIST using
8032: <span><strong class="command">make
8033: print-PLIST</strong></span>, you should get the right
8034: (commented out) lines.</p>
1.1 grant 8035:
1.47 reed 8036: <p>Note that even if your package is using <code xmlns=
1.45 wiz 8037: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8038: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 8039: *-x11-dirs packages. Just specify the name without that
1.45 wiz 8040: part and pkgsrc (in particular, <code xmlns=
8041: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8042: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 8043: </div>
8044: </div>
8045:
1.57 ! minskim 8046: <div class="chapter" lang="en">
1.1 grant 8047: <div class="titlepage">
8048: <div>
8049: <div>
1.57 ! minskim 8050: <h2 class="title"><a name=
1.38 dillo 8051: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 8052: methodology</h2>
8053: </div>
8054: </div>
8055: </div>
8056:
8057: <div class="toc">
8058: <p><b>Table of Contents</b></p>
8059:
8060: <dl>
1.30 wiz 8061: <dt><span class="sect1"><a href=
1.38 dillo 8062: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 8063: to use buildlink3</a></span></dt>
1.1 grant 8064:
1.30 wiz 8065: <dt><span class="sect1"><a href=
1.45 wiz 8066: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
8067: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8068: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 8069:
8070: <dd>
8071: <dl>
1.25 rillig 8072: <dt><span class="sect2"><a href=
1.38 dillo 8073: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 8074: buildlink3.mk file</a></span></dt>
1.1 grant 8075:
1.25 rillig 8076: <dt><span class="sect2"><a href=
1.38 dillo 8077: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 8078: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 8079: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 8080: <code xmlns=
8081: "http://www.w3.org/TR/xhtml1/transitional" class=
8082: "filename">buildlink3.mk</code>
1.1 grant 8083: files</a></span></dt>
8084: </dl>
8085: </dd>
8086:
1.30 wiz 8087: <dt><span class="sect1"><a href=
1.45 wiz 8088: "#writing-builtin.mk">11.3. Writing <code xmlns=
8089: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8090: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 8091:
8092: <dd>
8093: <dl>
1.25 rillig 8094: <dt><span class="sect2"><a href=
1.38 dillo 8095: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 8096: <code xmlns=
8097: "http://www.w3.org/TR/xhtml1/transitional" class=
8098: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 8099:
1.25 rillig 8100: <dt><span class="sect2"><a href=
1.38 dillo 8101: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 8102: preferences for native or pkgsrc
8103: software</a></span></dt>
1.1 grant 8104: </dl>
8105: </dd>
8106: </dl>
8107: </div>
8108:
8109: <p>Buildlink is a framework in pkgsrc that controls what
8110: headers and libraries are seen by a package's configure and
8111: build processes. This is implemented in a two step
8112: process:</p>
8113:
8114: <div class="orderedlist">
8115: <ol type="1">
8116: <li>
8117: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 8118: into <code class="varname">BUILDLINK_DIR</code>,
8119: which by default is a subdirectory of <code class=
8120: "varname">WRKDIR</code>.</p>
1.1 grant 8121: </li>
8122:
8123: <li>
8124: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 8125: the normal compiler tools that translate <code class=
8126: "option">-I${LOCALBASE}/include</code> and
8127: <code class="option">-L${LOCALBASE}/lib</code> into
8128: references to <code class=
8129: "varname">BUILDLINK_DIR</code>. The wrapper scripts
8130: also make native compiler on some operating systems
8131: look like GCC, so that packages that expect GCC won't
8132: require modifications to build with those native
8133: compilers.</p>
1.1 grant 8134: </li>
8135: </ol>
8136: </div>
8137:
8138: <p>This normalizes the environment in which a package is
8139: built so that the package may be built consistently despite
8140: what other software may be installed. Please note that the
1.45 wiz 8141: normal system header and library paths, e.g. <code xmlns=
8142: "http://www.w3.org/TR/xhtml1/transitional" class=
8143: "filename">/usr/include</code>, <code xmlns=
8144: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8145: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 8146: buildlink3 is designed to insulate the package build from
8147: non-system-supplied software.</p>
8148:
1.57 ! minskim 8149: <div class="sect1" lang="en">
1.1 grant 8150: <div class="titlepage">
8151: <div>
8152: <div>
8153: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8154: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 8155: packages to use buildlink3</h2>
1.1 grant 8156: </div>
8157: </div>
8158: </div>
8159:
8160: <p>The process of converting packages to use the
8161: buildlink3 framework (“<span class=
8162: "quote">bl3ifying</span>”) is fairly
8163: straightforward. The things to keep in mind are:</p>
8164:
8165: <div class="orderedlist">
8166: <ol type="1">
8167: <li>
8168: <p>Ensure that the build always calls the wrapper
8169: scripts instead of the actual toolchain. Some
8170: packages are tricky, and the only way to know for
1.45 wiz 8171: sure is the check <code xmlns=
8172: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8173: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 8174: wrappers are being invoked.</p>
8175: </li>
8176:
8177: <li>
1.14 xtraeme 8178: <p>Don't override <code class=
8179: "varname">PREFIX</code> from within the package
8180: Makefile, e.g. Java VMs, standalone shells, etc.,
1.45 wiz 8181: because the code to symlink files into <code xmlns=
8182: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8183: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 8184: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 8185: <em class=
8186: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 8187: </li>
8188:
8189: <li>
8190: <p>Remember that <span class=
1.45 wiz 8191: "emphasis"><em>only</em></span> the <code xmlns=
8192: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8193: "filename">buildlink3.mk</code> files that you list
1.1 grant 8194: in a package's Makefile are added as dependencies
8195: for that package.</p>
8196: </li>
8197: </ol>
8198: </div>
8199:
8200: <p>If a dependency on a particular package is required
8201: for its libraries and headers, then we replace:</p>
8202: <pre class="programlisting">
1.51 rillig 8203: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 8204: </pre>
8205:
8206: <p>with</p>
8207: <pre class="programlisting">
1.51 rillig 8208: .include "../../category/foo/buildlink3.mk"
1.1 grant 8209: </pre>
8210:
1.47 reed 8211: <p>The buildlink3.mk files usually define the required
8212: dependencies. If you need a newer version of the
8213: dependency when using buildlink3.mk files, then you can
8214: define it in your Makefile; for example:</p>
8215: <pre class="programlisting">
1.51 rillig 8216: BUILDLINK_DEPENDS.foo+= foo>=1.1.0
8217: .include "../../category/foo/buildlink3.mk"
1.47 reed 8218: </pre>
8219:
1.45 wiz 8220: <p>There are several <code xmlns=
8221: "http://www.w3.org/TR/xhtml1/transitional" class=
8222: "filename">buildlink3.mk</code> files in <code xmlns=
8223: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8224: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 8225: issues:</p>
8226:
8227: <div class="itemizedlist">
8228: <ul type="disc">
8229: <li>
1.45 wiz 8230: <p><code xmlns=
8231: "http://www.w3.org/TR/xhtml1/transitional" class=
8232: "filename">bdb.buildlink3.mk</code> chooses either
8233: the native or a pkgsrc Berkeley DB implementation
8234: based on the values of <code class=
1.14 xtraeme 8235: "varname">BDB_ACCEPTED</code> and <code class=
8236: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 8237: </li>
8238:
8239: <li>
1.45 wiz 8240: <p><code xmlns=
8241: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 8242: "filename">curses.buildlink3.mk</code>: If the
1.14 xtraeme 8243: system comes with neither Curses nor NCurses, this
8244: will take care to install the <a xmlns=
8245: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 8246: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45 wiz 8247: target="_top"><code xmlns="" class=
8248: "filename">devel/ncurses</code></a> package.</p>
1.1 grant 8249: </li>
8250:
8251: <li>
1.45 wiz 8252: <p><code xmlns=
8253: "http://www.w3.org/TR/xhtml1/transitional" class=
8254: "filename">krb5.buildlink3.mk</code> uses the value
8255: of <code class="varname">KRB5_ACCEPTED</code> to
8256: choose between adding a dependency on Heimdal or
8257: MIT-krb5 for packages that require a Kerberos 5
1.1 grant 8258: implementation.</p>
8259: </li>
8260:
8261: <li>
1.45 wiz 8262: <p><code xmlns=
8263: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8264: "filename">motif.buildlink3.mk</code> checks for a
8265: system-provided Motif installation or adds a
8266: dependency on <a xmlns=
1.1 grant 8267: "http://www.w3.org/TR/xhtml1/transitional" href=
8268: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45 wiz 8269: target="_top"><code xmlns="" class=
8270: "filename">x11/lesstif</code></a> or <a xmlns=
1.20 ben 8271: "http://www.w3.org/TR/xhtml1/transitional" href=
8272: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45 wiz 8273: target="_top"><code xmlns="" class=
1.47 reed 8274: "filename">x11/openmotif</code></a>.</p>
1.1 grant 8275: </li>
8276:
8277: <li>
1.45 wiz 8278: <p><code xmlns=
8279: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8280: "filename">ossaudio.buildlink3.mk</code> defines
8281: several variables that may be used by packages that
1.47 reed 8282: use the Open Sound System (OSS) API.</p>
1.1 grant 8283: </li>
8284:
8285: <li>
1.45 wiz 8286: <p><code xmlns=
8287: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8288: "filename">pgsql.buildlink3.mk</code> will accept
8289: either Postgres 7.3 or 7.4, whichever is found
8290: installed. See the file for more information.</p>
1.1 grant 8291: </li>
8292:
8293: <li>
1.45 wiz 8294: <p><code xmlns=
8295: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8296: "filename">pthread.buildlink3.mk</code> uses the
8297: value of <code class="varname">PTHREAD_OPTS</code>
8298: and checks for native pthreads or adds a dependency
8299: on <a xmlns=
1.1 grant 8300: "http://www.w3.org/TR/xhtml1/transitional" href=
8301: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45 wiz 8302: target="_top"><code xmlns="" class=
1.47 reed 8303: "filename">devel/pth</code></a> as needed.</p>
1.1 grant 8304: </li>
8305:
8306: <li>
1.45 wiz 8307: <p><code xmlns=
8308: "http://www.w3.org/TR/xhtml1/transitional" class=
8309: "filename">xaw.buildlink3.mk</code> uses the value
8310: of <code class="varname">XAW_TYPE</code> to choose
8311: a particular Athena widgets library.</p>
1.1 grant 8312: </li>
8313: </ul>
8314: </div>
8315:
1.45 wiz 8316: <p>The comments in those <code xmlns=
8317: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8318: "filename">buildlink3.mk</code> files provide a more
1.1 grant 8319: complete description of how to use them properly.</p>
8320: </div>
8321:
1.57 ! minskim 8322: <div class="sect1" lang="en">
1.1 grant 8323: <div class="titlepage">
8324: <div>
8325: <div>
8326: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8327: "creating-buildlink3.mk"></a>11.2. Writing
1.45 wiz 8328: <code xmlns=
8329: "http://www.w3.org/TR/xhtml1/transitional" class=
8330: "filename">buildlink3.mk</code> files</h2>
1.1 grant 8331: </div>
8332: </div>
8333: </div>
8334:
1.45 wiz 8335: <p>A package's <code xmlns=
8336: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8337: "filename">buildlink3.mk</code> file is included by
8338: Makefiles to indicate the need to compile and link
8339: against header files and libraries provided by the
1.45 wiz 8340: package. A <code xmlns=
8341: "http://www.w3.org/TR/xhtml1/transitional" class=
8342: "filename">buildlink3.mk</code> file should always
8343: provide enough information to add the correct type of
8344: dependency relationship and include any other
8345: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8346: class="filename">buildlink3.mk</code> files that it needs
8347: to find headers and libraries that it needs in turn.</p>
1.1 grant 8348:
1.45 wiz 8349: <p>To generate an initial <code xmlns=
8350: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8351: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 8352: Rene Hexel's <a xmlns=
8353: "http://www.w3.org/TR/xhtml1/transitional" href=
8354: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45 wiz 8355: target="_top"><code xmlns="" class=
8356: "filename">pkgtools/createbuildlink</code></a> package is
1.20 ben 8357: highly recommended. For most packages, the following
8358: command will generate a good starting point for
1.45 wiz 8359: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8360: class="filename">buildlink3.mk</code> files:</p>
1.1 grant 8361: <pre class="screen">
1.14 xtraeme 8362: <code class="prompt">%</code> <strong class=
8363: "userinput"><code>cd pkgsrc/<em class=
8364: "replaceable"><code>category</code></em>/<em class=
8365: "replaceable"><code>pkgdir</code></em>
8366: <code class=
1.49 rillig 8367: "prompt">%</code> createbuildlink >buildlink3.mk</code></strong>
1.1 grant 8368: </pre>
8369:
1.57 ! minskim 8370: <div class="sect2" lang="en">
1.1 grant 8371: <div class="titlepage">
8372: <div>
8373: <div>
1.57 ! minskim 8374: <h3 class="title"><a name=
! 8375: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 8376: buildlink3.mk file</h3>
1.1 grant 8377: </div>
8378: </div>
8379: </div>
8380:
1.45 wiz 8381: <p>The following real-life example <code xmlns=
8382: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8383: "filename">buildlink3.mk</code> is taken from
1.45 wiz 8384: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8385: class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 8386: <pre class="programlisting">
1.51 rillig 8387: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 8388:
1.51 rillig 8389: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
8390: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
1.1 grant 8391:
1.51 rillig 8392: .if !empty(BUILDLINK_DEPTH:M+)
8393: BUILDLINK_DEPENDS+= tiff
8394: .endif
1.1 grant 8395:
1.51 rillig 8396: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
8397: BUILDLINK_PACKAGES+= tiff
1.1 grant 8398:
1.51 rillig 8399: .if !empty(TIFF_BUILDLINK3_MK:M+)
8400: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
8401: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
8402: .endif # TIFF_BUILDLINK3_MK
1.1 grant 8403:
1.51 rillig 8404: .include "../../devel/zlib/buildlink3.mk"
8405: .include "../../graphics/jpeg/buildlink3.mk"
1.1 grant 8406:
1.51 rillig 8407: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
1.1 grant 8408: </pre>
8409:
1.14 xtraeme 8410: <p>The header and footer manipulate <code class=
8411: "varname">BUILDLINK_DEPTH</code>, which is common
1.45 wiz 8412: across all <code xmlns=
8413: "http://www.w3.org/TR/xhtml1/transitional" class=
8414: "filename">buildlink3.mk</code> files and is used to
8415: track at what depth we are including <code xmlns=
8416: "http://www.w3.org/TR/xhtml1/transitional" class=
8417: "filename">buildlink3.mk</code> files.</p>
1.1 grant 8418:
8419: <p>The first section controls if the dependency on
1.14 xtraeme 8420: <em class="replaceable"><code>pkg</code></em> is added.
8421: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 8422: global list of packages for which dependencies are
8423: added by buildlink3.</p>
8424:
8425: <p>The second section advises pkgsrc that the
1.45 wiz 8426: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8427: class="filename">buildlink3.mk</code> file for
1.14 xtraeme 8428: <em class="replaceable"><code>pkg</code></em> has been
8429: included at some point. <code class=
8430: "varname">BUILDLINK_PACKAGES</code> is the global list
1.45 wiz 8431: of packages for which <code xmlns=
8432: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8433: "filename">buildlink3.mk</code> files have been
8434: included. It must <span class=
8435: "emphasis"><em>always</em></span> be appended to within
1.45 wiz 8436: a <code xmlns=
8437: "http://www.w3.org/TR/xhtml1/transitional" class=
8438: "filename">buildlink3.mk</code> file.</p>
1.1 grant 8439:
8440: <p>The third section is protected from multiple
1.14 xtraeme 8441: inclusion and controls how the dependency on <em class=
8442: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 8443: important variables are set in the section:</p>
8444:
8445: <div class="itemizedlist">
8446: <ul type="disc">
8447: <li>
1.14 xtraeme 8448: <p><code class=
8449: "varname">BUILDLINK_DEPENDS.<em class=
8450: "replaceable"><code>pkg</code></em></code> is the
8451: actual dependency recorded in the installed
8452: package; this should always be set using
8453: <span><strong class="command">+=</strong></span>
8454: to ensure that we're appending to any
8455: pre-existing list of values. This variable should
8456: be set to the first version of the package that
8457: had the last change in the major number of a
8458: shared library or that had a major API
8459: change.</p>
1.1 grant 8460: </li>
8461:
8462: <li>
1.14 xtraeme 8463: <p><code class=
8464: "varname">BUILDLINK_PKGSRCDIR.<em class=
8465: "replaceable"><code>pkg</code></em></code> is the
8466: location of the <em class=
8467: "replaceable"><code>pkg</code></em> pkgsrc
1.47 reed 8468: directory.</p>
1.1 grant 8469: </li>
8470:
8471: <li>
1.14 xtraeme 8472: <p><code class=
8473: "varname">BUILDLINK_DEPMETHOD.<em class=
8474: "replaceable"><code>pkg</code></em></code> (not
8475: shown above) controls whether we use <code class=
8476: "varname">BUILD_DEPENDS</code> or <code class=
8477: "varname">DEPENDS</code> to add the dependency on
8478: <em class="replaceable"><code>pkg</code></em>.
8479: The build dependency is selected by setting
8480: <code class=
8481: "varname">BUILDLINK_DEPMETHOD.<em class=
8482: "replaceable"><code>pkg</code></em></code> to
1.1 grant 8483: “<span class="quote">build</span>”.
8484: By default, the full dependency is used.</p>
8485: </li>
8486:
8487: <li>
1.14 xtraeme 8488: <p><code class=
8489: "varname">BUILDLINK_INCDIRS.<em class=
8490: "replaceable"><code>pkg</code></em></code> and
8491: <code class=
1.57 ! minskim 8492: "varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
! 8493: (not shown above) are lists of subdirectories of
! 8494: <code xmlns=
1.45 wiz 8495: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8496: "filename">${BUILDLINK_PREFIX.<em class=
8497: "replaceable"><code>pkg</code></em>}</code> to
8498: add to the header and library search paths. These
1.1 grant 8499: default to “<span class=
8500: "quote">include</span>” and
8501: “<span class="quote">lib</span>”
8502: respectively.</p>
8503: </li>
8504:
8505: <li>
1.14 xtraeme 8506: <p><code class=
8507: "varname">BUILDLINK_CPPFLAGS.<em class=
8508: "replaceable"><code>pkg</code></em></code> (not
8509: shown above) is the list of preprocessor flags to
8510: add to <code class="varname">CPPFLAGS</code>,
8511: which are passed on to the configure and build
8512: phases. The “<span class=
8513: "quote">-I</span>” option should be avoided
8514: and instead be handled using <code class=
8515: "varname">BUILDLINK_INCDIRS.<em class=
8516: "replaceable"><code>pkg</code></em></code> as
8517: above.</p>
1.1 grant 8518: </li>
8519: </ul>
8520: </div>
8521:
8522: <p>The following variables are all optionally defined
8523: within this second section (protected against multiple
8524: inclusion) and control which package files are
1.45 wiz 8525: symlinked into <code xmlns=
8526: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8527: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 8528: are transformed during the symlinking:</p>
8529:
8530: <div class="itemizedlist">
8531: <ul type="disc">
8532: <li>
1.14 xtraeme 8533: <p><code class=
8534: "varname">BUILDLINK_FILES.<em class=
8535: "replaceable"><code>pkg</code></em></code> (not
8536: shown above) is a shell glob pattern relative to
1.45 wiz 8537: <code xmlns=
8538: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8539: "filename">${BUILDLINK_PREFIX.<em class=
8540: "replaceable"><code>pkg</code></em>}</code> to be
1.45 wiz 8541: symlinked into <code xmlns=
8542: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8543: "filename">${BUILDLINK_DIR}</code>, e.g.
1.45 wiz 8544: <code xmlns=
8545: "http://www.w3.org/TR/xhtml1/transitional" class=
8546: "filename">include/*.h</code>.</p>
1.1 grant 8547: </li>
8548:
8549: <li>
1.14 xtraeme 8550: <p><code class=
8551: "varname">BUILDLINK_FILES_CMD.<em class=
8552: "replaceable"><code>pkg</code></em></code> (not
8553: shown above) is a shell pipeline that outputs to
1.45 wiz 8554: stdout a list of files relative to <code xmlns=
8555: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8556: "filename">${BUILDLINK_PREFIX.<em class=
8557: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 8558: resulting files are to be symlinked into
1.45 wiz 8559: <code xmlns=
8560: "http://www.w3.org/TR/xhtml1/transitional" class=
8561: "filename">${BUILDLINK_DIR}</code>. By default,
8562: this takes the <code xmlns=
8563: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8564: "filename">+CONTENTS</code> of a <em class=
8565: "replaceable"><code>pkg</code></em> and filters
8566: it through <code class=
8567: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
8568: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 8569: </li>
8570:
8571: <li>
1.14 xtraeme 8572: <p><code class=
8573: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8574: "replaceable"><code>pkg</code></em></code> (not
8575: shown above) is a filter command that filters
1.45 wiz 8576: <code xmlns=
8577: "http://www.w3.org/TR/xhtml1/transitional" class=
8578: "filename">+CONTENTS</code> input into a list of
8579: files relative to <code xmlns=
8580: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8581: "filename">${BUILDLINK_PREFIX.<em class=
8582: "replaceable"><code>pkg</code></em>}</code> on
8583: stdout. By default for overwrite packages,
8584: <code class=
8585: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8586: "replaceable"><code>pkg</code></em></code>
1.45 wiz 8587: outputs the contents of the <code xmlns=
8588: "http://www.w3.org/TR/xhtml1/transitional" class=
8589: "filename">include</code> and <code xmlns=
8590: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8591: "filename">lib</code> directories in the package
1.45 wiz 8592: <code xmlns=
8593: "http://www.w3.org/TR/xhtml1/transitional" class=
8594: "filename">+CONTENTS</code>, and for pkgviews
8595: packages, it outputs any libtool archives in
8596: <code xmlns=
8597: "http://www.w3.org/TR/xhtml1/transitional" class=
8598: "filename">lib</code> directories.</p>
1.1 grant 8599: </li>
8600:
8601: <li>
1.14 xtraeme 8602: <p><code class=
8603: "varname">BUILDLINK_TRANSFORM.<em class=
8604: "replaceable"><code>pkg</code></em></code> (not
8605: shown above) is a list of sed arguments used to
1.1 grant 8606: transform the name of the source filename into a
1.14 xtraeme 8607: destination filename, e.g. <span><strong class=
1.1 grant 8608: "command">-e
1.14 xtraeme 8609: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 8610: </li>
8611: </ul>
8612: </div>
8613:
1.45 wiz 8614: <p>The last section includes any <code xmlns=
8615: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8616: "filename">buildlink3.mk</code> needed for <em class=
8617: "replaceable"><code>pkg</code></em>'s library
1.45 wiz 8618: dependencies. Including these <code xmlns=
8619: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8620: "filename">buildlink3.mk</code> files means that the
8621: headers and libraries for these dependencies are also
1.45 wiz 8622: symlinked into <code xmlns=
8623: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8624: "filename">${BUILDLINK_DIR}</code> whenever the
8625: <em class="replaceable"><code>pkg</code></em>
1.45 wiz 8626: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8627: class="filename">buildlink3.mk</code> file is
1.14 xtraeme 8628: included.</p>
1.1 grant 8629: </div>
8630:
1.57 ! minskim 8631: <div class="sect2" lang="en">
1.1 grant 8632: <div class="titlepage">
8633: <div>
8634: <div>
1.30 wiz 8635: <h3 class="title"><a name=
1.57 ! minskim 8636: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 8637: <code class=
1.57 ! minskim 8638: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
! 8639: in <code xmlns=
1.45 wiz 8640: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8641: "filename">buildlink3.mk</code> files</h3>
1.1 grant 8642: </div>
8643: </div>
8644: </div>
8645:
8646: <p>There are two situations that require increasing the
1.14 xtraeme 8647: dependency listed in <code class=
8648: "varname">BUILDLINK_DEPENDS.<em class=
8649: "replaceable"><code>pkg</code></em></code> after a
8650: package update:</p>
1.1 grant 8651:
8652: <div class="orderedlist">
8653: <ol type="1">
8654: <li>
8655: <p>if the sonames (major number of the library
8656: version) of any installed shared libraries
1.47 reed 8657: change.</p>
1.1 grant 8658: </li>
8659:
8660: <li>
8661: <p>if the API or interface to the header files
8662: change.</p>
8663: </li>
8664: </ol>
8665: </div>
8666:
1.14 xtraeme 8667: <p>In these cases, <code class=
8668: "varname">BUILDLINK_DEPENDS.<em class=
8669: "replaceable"><code>pkg</code></em></code> should be
8670: adjusted to require at least the new package version.
8671: In some cases, the packages that depend on this new
8672: version may need their <code class=
8673: "varname">PKGREVISION</code>s increased and, if they
1.45 wiz 8674: have <code xmlns=
8675: "http://www.w3.org/TR/xhtml1/transitional" class=
8676: "filename">buildlink3.mk</code> files, their
8677: <code class="varname">BUILDLINK_DEPENDS.<em class=
8678: "replaceable"><code>pkg</code></em></code> adjusted,
8679: too. This is needed so that binary packages made using
8680: it will require the correct package dependency and not
8681: settle for an older one which will not contain the
8682: necessary shared libraries.</p>
1.1 grant 8683:
8684: <p>Please take careful consideration before adjusting
1.14 xtraeme 8685: <code class="varname">BUILDLINK_DEPENDS.<em class=
8686: "replaceable"><code>pkg</code></em></code> as we don't
8687: want to cause unneeded package deletions and rebuilds.
8688: In many cases, new versions of packages work just fine
8689: with older dependencies. See <a href="#dependencies"
1.57 ! minskim 8690: title=
! 8691: "15.1.4. Handling dependencies">Section 15.1.4,
! 8692: “Handling dependencies”</a> for more
! 8693: information about dependencies on other packages,
1.25 rillig 8694: including the <code class=
8695: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
8696: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 8697: </div>
8698: </div>
8699:
1.57 ! minskim 8700: <div class="sect1" lang="en">
1.1 grant 8701: <div class="titlepage">
8702: <div>
8703: <div>
8704: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8705: "writing-builtin.mk"></a>11.3. Writing
1.45 wiz 8706: <code xmlns=
8707: "http://www.w3.org/TR/xhtml1/transitional" class=
8708: "filename">builtin.mk</code> files</h2>
1.1 grant 8709: </div>
8710: </div>
8711: </div>
8712:
8713: <p>Some packages in pkgsrc install headers and libraries
8714: that coincide with headers and libraries present in the
1.45 wiz 8715: base system. Aside from a <code xmlns=
8716: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8717: "filename">buildlink3.mk</code> file, these packages
1.45 wiz 8718: should also include a <code xmlns=
8719: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8720: "filename">builtin.mk</code> file that includes the
8721: necessary checks to decide whether using the built-in
8722: software or the pkgsrc software is appropriate.</p>
1.1 grant 8723:
8724: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 8725: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 8726:
8727: <div class="orderedlist">
8728: <ol type="1">
8729: <li>
1.14 xtraeme 8730: <p>It should set <code class=
8731: "varname">USE_BUILTIN.<em class=
8732: "replaceable"><code>pkg</code></em></code> to
8733: either “<span class="quote">yes</span>”
8734: or “<span class="quote">no</span>”
8735: after it is included.</p>
1.1 grant 8736: </li>
8737:
8738: <li>
8739: <p>It should <span class=
8740: "emphasis"><em>not</em></span> override any
1.14 xtraeme 8741: <code class="varname">USE_BUILTIN.<em class=
8742: "replaceable"><code>pkg</code></em></code> which is
1.45 wiz 8743: already set before the <code xmlns=
8744: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8745: "filename">builtin.mk</code> file is included.</p>
1.1 grant 8746: </li>
8747:
8748: <li>
8749: <p>It should be written to allow multiple
8750: inclusion. This is <span class=
8751: "emphasis"><em>very</em></span> important and takes
1.45 wiz 8752: careful attention to <code xmlns=
8753: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8754: "filename">Makefile</code> coding.</p>
1.1 grant 8755: </li>
8756: </ol>
8757: </div>
8758:
1.57 ! minskim 8759: <div class="sect2" lang="en">
1.1 grant 8760: <div class="titlepage">
8761: <div>
8762: <div>
1.57 ! minskim 8763: <h3 class="title"><a name=
1.38 dillo 8764: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.45 wiz 8765: of a <code xmlns=
8766: "http://www.w3.org/TR/xhtml1/transitional" class=
8767: "filename">builtin.mk</code> file</h3>
1.1 grant 8768: </div>
8769: </div>
8770: </div>
8771:
8772: <p>The following is the recommended template for
8773: builtin.mk files:</p>
8774: <pre class="programlisting">
1.51 rillig 8775: .if !defined(IS_BUILTIN.foo)
8776: #
8777: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
8778: # genuinely exists in the system or not.
8779: #
8780: IS_BUILTIN.foo?= no
8781:
8782: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
8783: # version can be determined.
8784: #
8785: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
8786: BUILTIN_PKG.foo?= foo-1.0
8787: . endif
8788: .endif # IS_BUILTIN.foo
8789:
8790: .if !defined(USE_BUILTIN.foo)
8791: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
8792: . if defined(BUILTIN_PKG.foo)
8793: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
8794: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
8795: USE_BUILTIN.foo!= \
8796: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
8797: ${ECHO} "yes"; \
8798: else \
8799: ${ECHO} "no"; \
8800: fi
8801: . endif
8802: . endfor
8803: . endif
8804: .endif # USE_BUILTIN.foo
8805:
8806: CHECK_BUILTIN.foo?= no
8807: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
8808: #
8809: # Here we place code that depends on whether USE_BUILTIN.foo is set to
8810: # "yes" or "no".
8811: #
8812: .endif # CHECK_BUILTIN.foo
1.1 grant 8813: </pre>
8814:
1.14 xtraeme 8815: <p>The first section sets <code class=
8816: "varname">IS_BUILTIN.<em class=
8817: "replaceable"><code>pkg</code></em></code> depending on
8818: if <em class="replaceable"><code>pkg</code></em> really
8819: exists in the base system. This should not be a base
8820: system software with similar functionality to
8821: <em class="replaceable"><code>pkg</code></em>; it
8822: should only be “<span class=
8823: "quote">yes</span>” if the actual package is
8824: included as part of the base system. This variable is
1.45 wiz 8825: only used internally within the <code xmlns=
8826: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8827: "filename">builtin.mk</code> file.</p>
8828:
8829: <p>The second section sets <code class=
8830: "varname">BUILTIN_PKG.<em class=
8831: "replaceable"><code>pkg</code></em></code> to the
8832: version of <em class=
8833: "replaceable"><code>pkg</code></em> in the base system
8834: if it exists (if <code class=
8835: "varname">IS_BUILTIN.<em class=
8836: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8837: “<span class="quote">yes</span>”). This
1.14 xtraeme 8838: variable is only used internally within the
1.45 wiz 8839: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8840: class="filename">builtin.mk</code> file.</p>
1.1 grant 8841:
1.14 xtraeme 8842: <p>The third section sets <code class=
8843: "varname">USE_BUILTIN.<em class=
8844: "replaceable"><code>pkg</code></em></code> and is
8845: <span class="emphasis"><em>required</em></span> in all
1.45 wiz 8846: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8847: class="filename">builtin.mk</code> files. The code in
8848: this section must make the determination whether the
8849: built-in software is adequate to satisfy the
8850: dependencies listed in <code class=
1.14 xtraeme 8851: "varname">BUILDLINK_DEPENDS.<em class=
8852: "replaceable"><code>pkg</code></em></code>. This is
8853: typically done by comparing <code class=
8854: "varname">BUILTIN_PKG.<em class=
8855: "replaceable"><code>pkg</code></em></code> against each
8856: of the dependencies in <code class=
8857: "varname">BUILDLINK_DEPENDS.<em class=
8858: "replaceable"><code>pkg</code></em></code>.
8859: <code class="varname">USE_BUILTIN.<em class=
8860: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 8861: "emphasis"><em>must</em></span> be set to the correct
1.45 wiz 8862: value by the end of the <code xmlns=
8863: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8864: "filename">builtin.mk</code> file. Note that
8865: <code class="varname">USE_BUILTIN.<em class=
8866: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 8867: “<span class="quote">yes</span>” even if
1.14 xtraeme 8868: <code class="varname">IS_BUILTIN.<em class=
8869: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8870: “<span class="quote">no</span>” because we
8871: may make the determination that the built-in version of
8872: the software is similar enough to be used as a
8873: replacement.</p>
8874:
1.14 xtraeme 8875: <p>The last section is guarded by <code class=
8876: "varname">CHECK_BUILTIN.<em class=
8877: "replaceable"><code>pkg</code></em></code>, and
8878: includes code that uses the value of <code class=
8879: "varname">USE_BUILTIN.<em class=
8880: "replaceable"><code>pkg</code></em></code> set in the
8881: previous section. This typically includes, e.g., adding
1.1 grant 8882: additional dependency restrictions and listing
1.45 wiz 8883: additional files to symlink into <code xmlns=
8884: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8885: "filename">${BUILDLINK_DIR}</code> (via <code class=
8886: "varname">BUILDLINK_FILES.<em class=
8887: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 8888: </div>
8889:
1.57 ! minskim 8890: <div class="sect2" lang="en">
1.1 grant 8891: <div class="titlepage">
8892: <div>
8893: <div>
1.30 wiz 8894: <h3 class="title"><a name=
1.38 dillo 8895: "native-or-pkgsrc-preference"></a>11.3.2. Global
1.30 wiz 8896: preferences for native or pkgsrc software</h3>
1.1 grant 8897: </div>
8898: </div>
8899: </div>
8900:
8901: <p>When building packages, it's possible to choose
8902: whether to set a global preference for using either the
8903: built-in (native) version or the pkgsrc version of
8904: software to satisfy a dependency. This is controlled by
1.14 xtraeme 8905: setting <code class="varname">PREFER_PKGSRC</code> and
8906: <code class="varname">PREFER_NATIVE</code>. These
8907: variables take values of either “<span class=
1.1 grant 8908: "quote">yes</span>”, “<span class=
8909: "quote">no</span>”, or a list of packages.
1.14 xtraeme 8910: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
8911: to use the pkgsrc versions of software, while
8912: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
8913: to use the built-in versions. Preferences are
8914: determined by the most specific instance of the package
8915: in either <code class="varname">PREFER_PKGSRC</code> or
8916: <code class="varname">PREFER_NATIVE</code>. If a
8917: package is specified in neither or in both variables,
8918: then <code class="varname">PREFER_PKGSRC</code> has
8919: precedence over <code class=
8920: "varname">PREFER_NATIVE</code>. For example, to require
8921: using pkgsrc versions of software for all but the most
8922: basic bits on a NetBSD system, you can set:</p>
1.1 grant 8923: <pre class="programlisting">
1.51 rillig 8924: PREFER_PKGSRC= yes
8925: PREFER_NATIVE= getopt skey tcp_wrappers
1.1 grant 8926: </pre>
8927:
8928: <p>A package <span class=
1.45 wiz 8929: "emphasis"><em>must</em></span> have a <code xmlns=
8930: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8931: "filename">builtin.mk</code> file to be listed in
8932: <code class="varname">PREFER_NATIVE</code>, otherwise
8933: it is simply ignored in that list.</p>
1.1 grant 8934: </div>
8935: </div>
8936: </div>
8937:
1.57 ! minskim 8938: <div class="chapter" lang="en">
1.1 grant 8939: <div class="titlepage">
8940: <div>
8941: <div>
1.57 ! minskim 8942: <h2 class="title"><a name=
1.38 dillo 8943: "pkginstall"></a>Chapter 12. The pkginstall
1.35 jmmv 8944: framework</h2>
1.1 grant 8945: </div>
8946: </div>
8947: </div>
8948:
8949: <div class="toc">
8950: <p><b>Table of Contents</b></p>
8951:
8952: <dl>
1.30 wiz 8953: <dt><span class="sect1"><a href=
1.38 dillo 8954: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 8955: directories outside the installation
8956: prefix</a></span></dt>
8957:
8958: <dd>
8959: <dl>
8960: <dt><span class="sect2"><a href=
1.38 dillo 8961: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 8962: manipulation</a></span></dt>
8963:
8964: <dt><span class="sect2"><a href=
1.38 dillo 8965: "#files-outside-prefix">12.1.2. File
1.35 jmmv 8966: manipulation</a></span></dt>
8967: </dl>
8968: </dd>
8969:
1.38 dillo 8970: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 8971: Configuration files</a></span></dt>
8972:
8973: <dd>
8974: <dl>
8975: <dt><span class="sect2"><a href=
1.38 dillo 8976: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 8977: "varname">PKG_SYSCONFDIR</code> is
8978: set</a></span></dt>
8979:
8980: <dt><span class="sect2"><a href=
1.38 dillo 8981: "#conf-files-configure">12.2.2. Telling the
1.47 reed 8982: software where configuration files
1.35 jmmv 8983: are</a></span></dt>
8984:
8985: <dt><span class="sect2"><a href=
1.38 dillo 8986: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 8987: installations</a></span></dt>
8988:
8989: <dt><span class="sect2"><a href=
1.38 dillo 8990: "#conf-files-disable">12.2.4. Disabling handling of
1.35 jmmv 8991: configuration files</a></span></dt>
8992: </dl>
8993: </dd>
8994:
1.38 dillo 8995: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 8996: System startup scripts</a></span></dt>
8997:
8998: <dd>
8999: <dl>
9000: <dt><span class="sect2"><a href=
1.38 dillo 9001: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 9002: of system startup scripts</a></span></dt>
9003: </dl>
9004: </dd>
1.1 grant 9005:
1.30 wiz 9006: <dt><span class="sect1"><a href=
1.38 dillo 9007: "#users-and-groups">12.4. System users and
1.35 jmmv 9008: groups</a></span></dt>
9009:
1.38 dillo 9010: <dt><span class="sect1"><a href="#shells">12.5. System
1.35 jmmv 9011: shells</a></span></dt>
9012:
9013: <dd>
9014: <dl>
9015: <dt><span class="sect2"><a href=
1.38 dillo 9016: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 9017: configuration files</a></span></dt>
9018: </dl>
9019: </dd>
1.1 grant 9020: </dl>
9021: </div>
9022:
1.35 jmmv 9023: <p>This chapter describes the framework known as
9024: <code class="literal">pkginstall</code>, whose key features
9025: are:</p>
9026:
9027: <div class="itemizedlist">
9028: <ul type="disc">
9029: <li>
9030: <p>Generic installation and manipulation of
9031: directories and files outside the pkgsrc-handled
9032: tree, <code class="varname">LOCALBASE</code>.</p>
9033: </li>
9034:
9035: <li>
9036: <p>Automatic handling of configuration files during
9037: installation, provided that packages are correctly
9038: designed.</p>
9039: </li>
9040:
9041: <li>
9042: <p>Generation and installation of system startup
9043: scripts.</p>
9044: </li>
9045:
9046: <li>
9047: <p>Registration of system users and groups.</p>
9048: </li>
9049:
9050: <li>
9051: <p>Registration of system shells.</p>
9052: </li>
9053: </ul>
9054: </div>
9055:
9056: <p>The following sections inspect each of the above points
1.47 reed 9057: in detail. Note that in order to use any of the described
1.35 jmmv 9058: functionalities, you must add the following to your
1.45 wiz 9059: package's <code xmlns=
9060: "http://www.w3.org/TR/xhtml1/transitional" class=
9061: "filename">Makefile</code>:</p>
1.35 jmmv 9062: <pre class="programlisting">
1.51 rillig 9063: USE_PKGINSTALL= YES
1.35 jmmv 9064: </pre>
9065:
9066: <p>You may be thinking that many of the things described
9067: here could be easily done with simple code in the package's
9068: post-installation target (<code class=
9069: "literal">post-install</code>). <span class=
9070: "emphasis"><em>This is incorrect</em></span>, as the code
9071: in them is only executed when building from source.
9072: Machines using binary packages could not benefit from it at
9073: all (as the code itself could be unavailable). Therefore,
9074: the only way to achieve any of the items described above is
9075: by means of the installation scripts, which are
9076: automatically generated by pkginstall.</p>
1.1 grant 9077:
1.57 ! minskim 9078: <div class="sect1" lang="en">
1.1 grant 9079: <div class="titlepage">
9080: <div>
9081: <div>
9082: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 9083: "files-and-dirs-outside-prefix"></a>12.1. Files
! 9084: and directories outside the installation
! 9085: prefix</h2>
1.1 grant 9086: </div>
9087: </div>
9088: </div>
9089:
1.45 wiz 9090: <p>As you already know, the <code xmlns=
9091: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9092: "filename">PLIST</code> file holds a list of files and
9093: directories that belong to a package. The names used in
1.45 wiz 9094: it are relative to the installation prefix (<code xmlns=
9095: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9096: "filename">${PREFIX}</code>), which means that it cannot
9097: register files outside this directory (absolute path
9098: names are not allowed). Despite this restriction, some
9099: packages need to install files outside this location;
1.45 wiz 9100: e.g., under <code xmlns=
9101: "http://www.w3.org/TR/xhtml1/transitional" class=
9102: "filename">${VARBASE}</code> or <code xmlns=
9103: "http://www.w3.org/TR/xhtml1/transitional" class=
9104: "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35 jmmv 9105:
9106: <p>The only way to achieve this is to create such files
9107: during installation time by using the installation
9108: scripts. These scripts can run arbitrary commands, so
9109: they have the potential to create and manage files
1.47 reed 9110: anywhere in the file system. Here is where pkginstall
1.35 jmmv 9111: comes into play: it provides generic scripts to abstract
9112: the manipulation of such files and directories based on
1.45 wiz 9113: variables set in the package's <code xmlns=
9114: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9115: "filename">Makefile</code>. The rest of this section
1.47 reed 9116: describes these variables.</p>
1.1 grant 9117:
1.57 ! minskim 9118: <div class="sect2" lang="en">
1.35 jmmv 9119: <div class="titlepage">
1.1 grant 9120: <div>
1.35 jmmv 9121: <div>
1.57 ! minskim 9122: <h3 class="title"><a name=
! 9123: "dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 9124: manipulation</h3>
9125: </div>
1.1 grant 9126: </div>
9127: </div>
9128:
1.35 jmmv 9129: <p>The following variables can be set to request the
1.47 reed 9130: creation of directories anywhere in the file
9131: system:</p>
1.27 rillig 9132:
1.35 jmmv 9133: <div class="itemizedlist">
9134: <ul type="disc">
9135: <li>
9136: <p><code class="varname">MAKE_DIRS</code> and
9137: <code class="varname">OWN_DIRS</code> contain a
9138: list of directories that should be created and
9139: should attempt to be destroyed by the
9140: installation scripts. The difference between the
9141: two is that the latter prompts the administrator
9142: to remove any directories that may be left after
9143: deinstallation (because they were not empty),
9144: while the former does not.</p>
9145: </li>
1.1 grant 9146:
1.35 jmmv 9147: <li>
9148: <p><code class="varname">MAKE_DIRS_PERMS</code>
9149: and <code class="varname">OWN_DIRS_PERMS</code>
9150: contain a list of tuples describing which
9151: directories should be created and should attempt
9152: to be destroyed by the installation scripts. Each
9153: tuple holds the following values, separated by
9154: spaces: the directory name, its owner, its group
9155: and its numerical mode. For example:</p>
9156: <pre class="programlisting">
1.51 rillig 9157: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9158: </pre>
1.1 grant 9159:
1.35 jmmv 9160: <p>The difference between the two is exactly the
9161: same as their non-<code class=
9162: "varname">PERMS</code> counterparts.</p>
9163: </li>
9164: </ul>
9165: </div>
9166: </div>
9167:
1.57 ! minskim 9168: <div class="sect2" lang="en">
1.35 jmmv 9169: <div class="titlepage">
9170: <div>
9171: <div>
1.57 ! minskim 9172: <h3 class="title"><a name=
! 9173: "files-outside-prefix"></a>12.1.2. File
1.35 jmmv 9174: manipulation</h3>
9175: </div>
9176: </div>
9177: </div>
9178:
9179: <p>Creating non-empty files outside the installation
1.45 wiz 9180: prefix is tricky because the <code xmlns=
9181: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9182: "filename">PLIST</code> forces all files to be inside
9183: it. To overcome this problem, the only solution is to
9184: extract the file in the known place (i.e., inside the
9185: installation prefix) and copy it to the appropriate
9186: location during installation (done by the installation
9187: scripts generated by pkginstall). We will call the
9188: former the <span class="emphasis"><em>master
9189: file</em></span> in the following paragraphs, which
9190: describe the variables that can be used to
9191: automatically and consistently handle files outside the
9192: installation prefix:</p>
9193:
9194: <div class="itemizedlist">
9195: <ul type="disc">
9196: <li>
9197: <p><code class="varname">CONF_FILES</code> and
9198: <code class="varname">SUPPORT_FILES</code> are
9199: pairs of master and target files. During
9200: installation time, the master file is copied to
9201: the target one if and only if the latter does not
9202: exist. Upon deinstallation, the target file is
9203: removed provided that it was not modified by the
9204: installation.</p>
9205:
9206: <p>The difference between the two is that the
9207: latter prompts the administrator to remove any
9208: files that may be left after deinstallation
9209: (because they were not empty), while the former
9210: does not.</p>
9211: </li>
9212:
9213: <li>
9214: <p><code class="varname">CONF_FILES_PERMS</code>
9215: and <code class=
9216: "varname">SUPPORT_FILES_PERMS</code> contain
9217: tuples describing master files as well as their
9218: target locations. For each of them, it also
9219: specifies their owner, their group and their
9220: numeric permissions, in this order. For
9221: example:</p>
9222: <pre class="programlisting">
1.51 rillig 9223: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9224: </pre>
9225:
9226: <p>The difference between the two is exactly the
9227: same as their non-<code class=
9228: "varname">PERMS</code> counterparts.</p>
9229: </li>
9230: </ul>
9231: </div>
9232: </div>
9233: </div>
9234:
1.57 ! minskim 9235: <div class="sect1" lang="en">
1.35 jmmv 9236: <div class="titlepage">
9237: <div>
9238: <div>
9239: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 9240: "conf-files"></a>12.2. Configuration
! 9241: files</h2>
1.35 jmmv 9242: </div>
9243: </div>
9244: </div>
9245:
9246: <p>Configuration files are special in the sense that they
9247: are installed in their own specific directory,
9248: <code class="varname">PKG_SYSCONFDIR</code>, and need
9249: special treatment during installation (most of which is
9250: automated by pkginstall). The main concept you must bear
1.36 wiz 9251: in mind is that files marked as configuration files are
1.35 jmmv 9252: automatically copied to the right place (somewhere inside
9253: <code class="varname">PKG_SYSCONFDIR</code>) during
9254: installation <span class="emphasis"><em>if and only
9255: if</em></span> they didn't exist before. Similarly, they
9256: will not be removed if they have local modifications.
1.36 wiz 9257: This ensures that administrators never lose any custom
1.35 jmmv 9258: changes they may have made.</p>
9259:
1.57 ! minskim 9260: <div class="sect2" lang="en">
1.35 jmmv 9261: <div class="titlepage">
9262: <div>
9263: <div>
1.57 ! minskim 9264: <h3 class="title"><a name=
! 9265: "conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 9266: <code class="varname">PKG_SYSCONFDIR</code> is
9267: set</h3>
9268: </div>
9269: </div>
9270: </div>
9271:
9272: <p>As said before, the <code class=
9273: "varname">PKG_SYSCONFDIR</code> variable specifies
9274: where configuration files shall be installed. Its
9275: contents are set based upon the following
9276: variables:</p>
9277:
9278: <div class="itemizedlist">
9279: <ul type="disc">
9280: <li>
9281: <p><code class="varname">PKG_SYSCONFBASE</code>:
9282: The configuration's root directory. Defaults to
1.45 wiz 9283: <code xmlns=
9284: "http://www.w3.org/TR/xhtml1/transitional" class=
9285: "filename">${PREFIX}/etc</code> although it may
9286: be overridden by the user to point to his
9287: preferred location (e.g., <code xmlns=
9288: "http://www.w3.org/TR/xhtml1/transitional" class=
9289: "filename">/etc</code>, <code xmlns=
9290: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9291: "filename">/etc/pkg</code>, etc.). Packages must
9292: not use it directly.</p>
9293: </li>
9294:
9295: <li>
9296: <p><code class=
9297: "varname">PKG_SYSCONFSUBDIR</code>: A
9298: subdirectory of <code class=
9299: "varname">PKG_SYSCONFBASE</code> under which the
9300: configuration files for the package being built
9301: shall be installed. The definition of this
9302: variable only makes sense in the package's
1.45 wiz 9303: <code xmlns=
9304: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 9305: "filename">Makefile</code> (i.e., it is not
9306: user-customizable).</p>
1.35 jmmv 9307:
9308: <p>As an example, consider the Apache package,
9309: <a xmlns=
9310: "http://www.w3.org/TR/xhtml1/transitional" href=
9311: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45 wiz 9312: target="_top"><code xmlns="" class=
9313: "filename">www/apache2</code></a>, which places
9314: its configuration files under the <code xmlns=
9315: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9316: "filename">httpd/</code> subdirectory of
9317: <code class="varname">PKG_SYSCONFBASE</code>.
9318: This should be set in the package Makefile.</p>
9319: </li>
9320:
9321: <li>
9322: <p><code class="varname">PKG_SYSCONFVAR</code>:
9323: Specifies the name of the variable that holds
9324: this package's configuration directory (if
9325: different from <code class=
9326: "varname">PKG_SYSCONFBASE</code>). It defaults to
9327: <code class="varname">PKGBASE</code>'s value, and
9328: is always prefixed with <code class=
9329: "literal">PKG_SYSCONFDIR</code>.</p>
9330: </li>
9331:
9332: <li>
9333: <p><code class=
9334: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
9335: Holds the directory where the configuration files
9336: for the package identified by <code class=
9337: "varname">PKG_SYSCONFVAR</code>'s shall be
9338: placed.</p>
9339: </li>
9340: </ul>
9341: </div>
9342:
9343: <p>Based on the above variables, pkginstall determines
9344: the value of <code class=
9345: "varname">PKG_SYSCONFDIR</code>, which is the
9346: <span class="emphasis"><em>only</em></span> variable
9347: that can be used within a package to refer to its
9348: configuration directory. The algorithm used to set its
9349: value is basically the following:</p>
9350:
9351: <div class="orderedlist">
9352: <ol type="1">
9353: <li>
9354: <p>If <code class=
9355: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9356: is set, its value is used.</p>
9357: </li>
9358:
9359: <li>
9360: <p>If the previous variable is not defined but
9361: <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45 wiz 9362: set in the package's <code xmlns=
9363: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9364: "filename">Makefile</code>, the resulting value
1.45 wiz 9365: is <code xmlns=
9366: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9367: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
9368: </li>
9369:
9370: <li>
1.45 wiz 9371: <p>Otherwise, it is set to <code xmlns=
9372: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9373: "filename">${PKG_SYSCONFBASE}</code>.</p>
9374: </li>
9375: </ol>
9376: </div>
9377:
1.45 wiz 9378: <p>It is worth mentioning that <code xmlns=
9379: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9380: "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45 wiz 9381: added to <code xmlns=
9382: "http://www.w3.org/TR/xhtml1/transitional" class=
9383: "filename">OWN_DIRS</code>. See <a href=
9384: "#dirs-outside-prefix" title=
1.57 ! minskim 9385: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 9386: “Directory manipulation”</a> what this
9387: means.</p>
9388: </div>
9389:
1.57 ! minskim 9390: <div class="sect2" lang="en">
1.35 jmmv 9391: <div class="titlepage">
9392: <div>
9393: <div>
1.57 ! minskim 9394: <h3 class="title"><a name=
! 9395: "conf-files-configure"></a>12.2.2. Telling
! 9396: the software where configuration files are</h3>
1.35 jmmv 9397: </div>
9398: </div>
9399: </div>
9400:
9401: <p>Given that pkgsrc (and users!) expect configuration
9402: files to be in a known place, you need to teach each
1.36 wiz 9403: package where it shall install its files. In some cases
1.35 jmmv 9404: you will have to patch the package Makefiles to achieve
9405: it. If you are lucky, though, it may be as easy as
9406: passing an extra flag to the configuration script; this
1.47 reed 9407: is the case of GNU Autoconf- generated files:</p>
1.35 jmmv 9408: <pre class="programlisting">
1.51 rillig 9409: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35 jmmv 9410: </pre>
9411:
9412: <p>Note that this specifies where the package has to
9413: <span class="emphasis"><em>look for</em></span> its
9414: configuration files, not where they will be originally
9415: installed (although the difference is never explicit,
9416: unfortunately).</p>
9417: </div>
9418:
1.57 ! minskim 9419: <div class="sect2" lang="en">
1.35 jmmv 9420: <div class="titlepage">
9421: <div>
9422: <div>
1.57 ! minskim 9423: <h3 class="title"><a name=
! 9424: "conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 9425: installations</h3>
9426: </div>
9427: </div>
9428: </div>
9429:
9430: <p>As said before, pkginstall automatically handles
9431: configuration files. This means that <span class=
9432: "strong"><strong>the packages themselves must not touch
1.45 wiz 9433: the contents of <code xmlns=
9434: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9435: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 9436: directly</strong></span>. Bad news is that many
9437: software installation scripts will, out of the box,
9438: mess with the contents of that directory. So what is
9439: the correct procedure to fix this issue?</p>
1.35 jmmv 9440:
9441: <p>You must teach the package (usually by manually
9442: patching it) to install any configuration files under
1.45 wiz 9443: the examples hierarchy, <code xmlns=
9444: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9445: "filename">share/examples/${PKGBASE}/</code>. This way,
1.45 wiz 9446: the <code xmlns=
9447: "http://www.w3.org/TR/xhtml1/transitional" class=
9448: "filename">PLIST</code> registers them and the
9449: administrator always has the original copies
1.35 jmmv 9450: available.</p>
9451:
9452: <p>Once the required configuration files are in place
9453: (i.e., under the examples hierarchy), the pkginstall
9454: framework can use them as master copies during the
1.45 wiz 9455: package installation to update what is in <code xmlns=
9456: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9457: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
9458: the variables <code class="varname">CONF_FILES</code>
9459: and <code class="varname">CONF_FILES_PERMS</code> are
9460: used. Check out <a href="#files-outside-prefix" title=
1.57 ! minskim 9461: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 9462: “File manipulation”</a> for information
9463: about their syntax and their purpose. Here is an
9464: example, taken from the <a xmlns=
9465: "http://www.w3.org/TR/xhtml1/transitional" href=
9466: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45 wiz 9467: target="_top"><code xmlns="" class=
9468: "filename">mail/mutt</code></a> package:</p>
1.35 jmmv 9469: <pre class="programlisting">
1.51 rillig 9470: EGDIR= ${PREFIX}/share/doc/mutt/samples
9471: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35 jmmv 9472: </pre>
9473:
9474: <p>Note that the <code class="varname">EGDIR</code>
9475: variable is specific to that package and has no meaning
9476: outside it.</p>
9477: </div>
9478:
1.57 ! minskim 9479: <div class="sect2" lang="en">
1.35 jmmv 9480: <div class="titlepage">
9481: <div>
9482: <div>
1.57 ! minskim 9483: <h3 class="title"><a name=
! 9484: "conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 9485: handling of configuration files</h3>
9486: </div>
9487: </div>
9488: </div>
9489:
9490: <p>The automatic copying of config files can be toggled
9491: by setting the environment variable <code class=
9492: "varname">PKG_CONFIG</code> prior to package
9493: installation.</p>
9494: </div>
9495: </div>
9496:
1.57 ! minskim 9497: <div class="sect1" lang="en">
1.35 jmmv 9498: <div class="titlepage">
9499: <div>
9500: <div>
9501: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 9502: "rcd-scripts"></a>12.3. System startup
! 9503: scripts</h2>
1.35 jmmv 9504: </div>
9505: </div>
9506: </div>
9507:
9508: <p>System startup scripts are special files because they
9509: must be installed in a place known by the underlying OS,
9510: usually outside the installation prefix. Therefore, the
9511: same rules described in <a href=
9512: "#files-and-dirs-outside-prefix" title=
1.38 dillo 9513: "12.1. Files and directories outside the installation prefix">
1.57 ! minskim 9514: Section 12.1, “Files and directories outside
! 9515: the installation prefix”</a> apply, and the same
1.35 jmmv 9516: solutions can be used. However, pkginstall provides a
1.36 wiz 9517: special mechanism to handle these files.</p>
1.35 jmmv 9518:
9519: <p>In order to provide system startup scripts, the
9520: package has to:</p>
9521:
9522: <div class="orderedlist">
9523: <ol type="1">
9524: <li>
1.45 wiz 9525: <p>Store the script inside <code xmlns=
9526: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9527: "filename">${FILESDIR}</code>, with the
9528: <code class="literal">.sh</code> suffix appended.
9529: Considering the <a xmlns=
9530: "http://www.w3.org/TR/xhtml1/transitional" href=
9531: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45 wiz 9532: target="_top"><code xmlns="" class=
9533: "filename">print/cups</code></a> package as an
9534: example, it has a <code xmlns=
9535: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9536: "filename">cupsd.sh</code> in its files
9537: directory.</p>
9538: </li>
9539:
9540: <li>
9541: <p>Tell pkginstall to handle it, appending the name
9542: of the script, without its extension, to the
9543: <code class="varname">RCD_SCRIPTS</code> variable.
9544: Continuing the previous example:</p>
9545: <pre class="programlisting">
1.51 rillig 9546: RCD_SCRIPTS+= cupsd
1.35 jmmv 9547: </pre>
9548: </li>
9549: </ol>
9550: </div>
9551:
9552: <p>Once this is done, pkginstall will do the following
9553: steps for each script in an automated fashion:</p>
9554:
9555: <div class="orderedlist">
9556: <ol type="1">
9557: <li>
9558: <p>Process the file found in the files directory
9559: applying all the substitutions described in the
1.45 wiz 9560: <code xmlns=
9561: "http://www.w3.org/TR/xhtml1/transitional" class=
9562: "filename">FILES_SUBST</code> variable.</p>
1.35 jmmv 9563: </li>
9564:
9565: <li>
9566: <p>Copy the script from the files directory to the
1.45 wiz 9567: examples hierarchy, <code xmlns=
9568: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9569: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 9570: Note that this master file must be explicitly
1.45 wiz 9571: registered in the <code xmlns=
9572: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9573: "filename">PLIST</code>.</p>
9574: </li>
9575:
9576: <li>
9577: <p>Add code to the installation scripts to copy the
9578: startup script from the examples hierarchy into the
9579: system-wide startup scripts directory.</p>
9580: </li>
9581: </ol>
9582: </div>
9583:
1.57 ! minskim 9584: <div class="sect2" lang="en">
1.35 jmmv 9585: <div class="titlepage">
9586: <div>
9587: <div>
1.57 ! minskim 9588: <h3 class="title"><a name=
! 9589: "rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 9590: handling of system startup scripts</h3>
9591: </div>
9592: </div>
9593: </div>
9594:
9595: <p>The automatic copying of config files can be toggled
9596: by setting the environment variable <code class=
9597: "varname">PKG_RCD_SCRIPTS</code> prior to package
9598: installation. Note that the scripts will be always
1.45 wiz 9599: copied inside the examples hierarchy, <code xmlns=
9600: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9601: "filename">${PREFIX}/share/examples/rc.d/</code>, no
9602: matter what the value of this variable is.</p>
9603: </div>
9604: </div>
9605:
1.57 ! minskim 9606: <div class="sect1" lang="en">
1.35 jmmv 9607: <div class="titlepage">
9608: <div>
9609: <div>
9610: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 9611: "users-and-groups"></a>12.4. System users and
! 9612: groups</h2>
1.35 jmmv 9613: </div>
9614: </div>
9615: </div>
9616:
9617: <p>If a package needs to create special users and/or
9618: groups during installation, it can do so by using the
9619: pkginstall framework.</p>
9620:
9621: <p>Users can be created by adding entries to the
9622: <code class="varname">PKG_USERS</code> variable. Each
1.45 wiz 9623: entry has the following syntax, which mimics <code xmlns=
9624: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9625: "filename">/etc/passwd</code>:</p>
9626: <pre class="programlisting">
1.51 rillig 9627: user:group[:[userid][:[descr][:[home][:shell]]]]
1.35 jmmv 9628: </pre>
9629:
9630: <p>Only the user and group are required; everything else
9631: is optional, but the colons must be in the right places
9632: when specifying optional bits. By default, a new user
1.45 wiz 9633: will have home directory <code xmlns=
9634: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9635: "filename">/nonexistent</code>, and login shell
1.45 wiz 9636: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9637: class="filename">/sbin/nologin</code> unless they are
9638: specified as part of the user element. Note that if the
1.51 rillig 9639: description contains spaces, then spaces should be
1.45 wiz 9640: backslash-escaped, as in:</p>
1.35 jmmv 9641: <pre class="programlisting">
1.51 rillig 9642: foo:foogrp::The\ Foomister
1.35 jmmv 9643: </pre>
9644:
9645: <p>Similarly, groups can be created using the
9646: <code class="varname">PKG_GROUPS</code> variable, whose
9647: syntax is:</p>
9648: <pre class="programlisting">
1.51 rillig 9649: group[:groupid]
1.35 jmmv 9650: </pre>
9651:
9652: <p>As before, only the group name is required; the
9653: numeric identifier is optional.</p>
9654: </div>
9655:
1.57 ! minskim 9656: <div class="sect1" lang="en">
1.35 jmmv 9657: <div class="titlepage">
9658: <div>
9659: <div>
9660: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 9661: "shells"></a>12.5. System shells</h2>
1.35 jmmv 9662: </div>
9663: </div>
9664: </div>
9665:
9666: <p>Packages that install system shells should register
1.45 wiz 9667: them in the shell database, <code xmlns=
9668: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9669: "filename">/etc/shells</code>, to make things easier to
9670: the administrator. This must be done from the
9671: installation scripts to keep binary packages working on
9672: any system. pkginstall provides an easy way to accomplish
9673: this task.</p>
9674:
9675: <p>When a package provides a shell interpreter, it has to
9676: set the <code class="varname">PKG_SHELL</code> variable
9677: to its absolute file name. This will add some hooks to
9678: the installation scripts to handle it. Consider the
9679: following example, taken from <a xmlns=
9680: "http://www.w3.org/TR/xhtml1/transitional" href=
9681: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45 wiz 9682: target="_top"><code xmlns="" class=
9683: "filename">shells/zsh</code></a>:</p>
1.35 jmmv 9684: <pre class="programlisting">
1.51 rillig 9685: USE_PKGINSTALL= YES
9686: PKG_SHELL= ${PREFIX}/bin/zsh
1.35 jmmv 9687: </pre>
9688:
1.57 ! minskim 9689: <div class="sect2" lang="en">
1.35 jmmv 9690: <div class="titlepage">
9691: <div>
9692: <div>
1.57 ! minskim 9693: <h3 class="title"><a name=
! 9694: "shells-disable"></a>12.5.1. Disabling
! 9695: handling of configuration files</h3>
1.35 jmmv 9696: </div>
9697: </div>
9698: </div>
9699:
9700: <p>The automatic registration of shell interpreters can
9701: be disabled by the administrator by setting the
1.45 wiz 9702: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9703: class="filename">PKG_REGISTER_SHELLS</code> environment
9704: variable to <code class="literal">NO</code>.</p>
1.35 jmmv 9705: </div>
9706: </div>
9707: </div>
9708:
1.57 ! minskim 9709: <div class="chapter" lang="en">
1.35 jmmv 9710: <div class="titlepage">
9711: <div>
9712: <div>
1.57 ! minskim 9713: <h2 class="title"><a name=
1.38 dillo 9714: "options"></a>Chapter 13. Options
1.35 jmmv 9715: handling</h2>
9716: </div>
9717: </div>
9718: </div>
9719:
9720: <div class="toc">
9721: <p><b>Table of Contents</b></p>
9722:
9723: <dl>
9724: <dt><span class="sect1"><a href=
1.38 dillo 9725: "#global-default-options">13.1. Global default
1.35 jmmv 9726: options</a></span></dt>
9727:
9728: <dt><span class="sect1"><a href=
1.38 dillo 9729: "#converting-to-options">13.2. Converting packages to
1.45 wiz 9730: use <code xmlns=
9731: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9732: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 9733:
9734: <dt><span class="sect1"><a href="#option-names">13.3.
9735: Option Names</a></span></dt>
1.35 jmmv 9736: </dl>
9737: </div>
9738:
9739: <p>Many packages have the ability to be built to support
1.45 wiz 9740: different sets of features. <code xmlns=
9741: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9742: "filename">bsd.options.mk</code> is a framework in pkgsrc
9743: that provides generic handling of those options that
9744: determine different ways in which the packages can be
9745: built. It's possible for the user to specify exactly which
9746: sets of options will be built into a package or to allow a
9747: set of global default options apply.</p>
9748:
1.57 ! minskim 9749: <div class="sect1" lang="en">
1.35 jmmv 9750: <div class="titlepage">
9751: <div>
9752: <div>
9753: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9754: "global-default-options"></a>13.1. Global
1.35 jmmv 9755: default options</h2>
9756: </div>
9757: </div>
9758: </div>
9759:
9760: <p>Global default options are listed in <code class=
9761: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
9762: the options that should be built into every package if
9763: that option is supported. This variable should be set in
1.45 wiz 9764: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9765: class="filename">/etc/mk.conf</code>.</p>
1.35 jmmv 9766: </div>
9767:
1.57 ! minskim 9768: <div class="sect1" lang="en">
1.35 jmmv 9769: <div class="titlepage">
9770: <div>
9771: <div>
9772: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9773: "converting-to-options"></a>13.2. Converting
1.45 wiz 9774: packages to use <code xmlns=
9775: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9776: "filename">bsd.options.mk</code></h2>
9777: </div>
9778: </div>
9779: </div>
9780:
1.45 wiz 9781: <p>The following example shows how <code xmlns=
9782: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9783: "filename">bsd.options.mk</code> should be used by the
9784: hypothetical ``wibble'' package, either in the package
1.45 wiz 9785: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9786: class="filename">Makefile</code>, or in a file, e.g.
9787: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9788: class="filename">options.mk</code>, that is included by
9789: the main package <code xmlns=
9790: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9791: "filename">Makefile</code>.</p>
9792: <pre class="programlisting">
1.51 rillig 9793: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
9794: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
9795: PKG_OPTIONS_OPTIONAL_GROUPS= database
9796: PKG_OPTIONS_GROUP.database= mysql pgsql
9797: PKG_SUGGESTED_OPTIONS= wibble-foo
9798: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
9799: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
9800:
9801: .include "../../mk/bsd.prefs.mk"
9802:
9803: # this package was previously named wibble2
9804: .if defined(PKG_OPTIONS.wibble2)
9805: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
9806: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
9807: "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
9808: .endif
9809:
9810: .include "../../mk/bsd.options.mk"
9811:
9812: # Package-specific option-handling
9813:
9814: ###
9815: ### FOO support
9816: ###
9817: .if !empty(PKG_OPTIONS:Mwibble-foo)
9818: CONFIGURE_ARGS+= --enable-foo
9819: .endif
9820:
9821: ###
9822: ### LDAP support
9823: ###
9824: .if !empty(PKG_OPTIONS:Mldap)
9825: . include "../../databases/openldap/buildlink3.mk"
9826: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
9827: .endif
9828:
9829: ###
9830: ### database support
9831: ###
9832: .if !empty(PKG_OPTIONS:Mmysql)
9833: . include "../../mk/mysql.buildlink3.mk"
9834: .endif
9835: .if !empty(PKG_OPTIONS:Mpgsql)
9836: . include "../../mk/pgsql.buildlink3.mk"
9837: .endif
1.1 grant 9838: </pre>
9839:
1.28 rillig 9840: <p>The first section contains the information about which
9841: build options are supported by the package, and any
1.1 grant 9842: default options settings if needed.</p>
9843:
9844: <div class="orderedlist">
9845: <ol type="1">
9846: <li>
1.14 xtraeme 9847: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 9848: the name of the <a href=
1.1 grant 9849: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9850: <span class="citerefentry"><span class=
1.27 rillig 9851: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 9852: that the user can set to override the default
1.57 ! minskim 9853: options. It should be set to PKG_OPTIONS.<em class=
! 9854: "replaceable"><code>pkgbase</code></em>.</p>
1.1 grant 9855: </li>
9856:
9857: <li>
1.14 xtraeme 9858: <p><code class=
9859: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 9860: build options supported by the package.</p>
9861: </li>
9862:
9863: <li>
9864: <p><code class=
9865: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
9866: list of names of groups of mutually exclusive
9867: options. The options in each group are listed in
9868: <code class="varname">PKG_OPTIONS_GROUP.<em class=
9869: "replaceable"><code>groupname</code></em></code>.
9870: The most specific setting of any option from the
9871: group takes precedence over all other options in
9872: the group. Options from the groups will be
9873: automatically added to <code class=
9874: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
9875: </li>
9876:
9877: <li>
9878: <p><code class=
9879: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
9880: like <code class=
9881: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
9882: building the packages will fail if no option from
9883: the group is selected.</p>
1.1 grant 9884: </li>
9885:
9886: <li>
1.27 rillig 9887: <p><code class=
1.44 gdt 9888: "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
9889: list of names of sets of options. At least one
9890: option from each set must be selected. The options
9891: in each set are listed in <code class=
9892: "varname">PKG_OPTIONS_SET.<em class=
9893: "replaceable"><code>setname</code></em></code>.
9894: Options from the sets will be automatically added
9895: to <code class=
9896: "varname">PKG_SUPPORTED_OPTIONS</code>. Building
9897: the package will fail if no option from the set is
9898: selected.</p>
9899: </li>
9900:
9901: <li>
9902: <p><code class=
1.27 rillig 9903: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
9904: build options which are enabled by default.</p>
9905: </li>
9906:
9907: <li>
1.37 dillo 9908: <p><code class=
9909: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
9910: of “<span class="quote"><em class=
1.57 ! minskim 9911: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>”
! 9912: pairs that map legacy <code xmlns=
1.45 wiz 9913: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9914: "filename">/etc/mk.conf</code> variables to their
9915: option counterparts. Pairs should be added with
9916: “<span class="quote">+=</span>” to keep
9917: the listing of global legacy variables. A warning
9918: will be issued if the user uses a legacy
9919: variable.</p>
9920: </li>
1.1 grant 9921:
1.37 dillo 9922: <li>
9923: <p><code class=
9924: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
9925: of “<span class="quote"><em class=
1.57 ! minskim 9926: "replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>”
! 9927: pairs that map options that have been renamed to
! 9928: their new counterparts. Pairs should be added with
1.37 dillo 9929: “<span class="quote">+=</span>” to keep
9930: the listing of global legacy options. A warning
9931: will be issued if the user uses a legacy
9932: option.</p>
9933: </li>
1.1 grant 9934:
1.37 dillo 9935: <li>
9936: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
9937: is a list of options implied by deprecated
9938: variables used. This can be used for cases that
9939: neither <code class=
9940: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
9941: <code class=
9942: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
9943: handle, e. g. when <code class=
9944: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 9945: </li>
9946:
9947: <li>
1.37 dillo 9948: <p><code class=
9949: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
9950: a list of warnings about deprecated variables or
9951: options used, and what to use instead.</p>
1.1 grant 9952: </li>
1.28 rillig 9953: </ol>
1.1 grant 9954: </div>
9955:
1.37 dillo 9956: <p>A package should never modify <code class=
9957: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
9958: named in <code class="varname">PKG_OPTIONS_VAR</code>.
9959: These are strictly user-settable. To suggest a default
9960: set of options, use <code class=
9961: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
9962:
1.42 dillo 9963: <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45 wiz 9964: defined before including <code xmlns=
9965: "http://www.w3.org/TR/xhtml1/transitional" class=
1.42 dillo 9966: "filename">bsd.options.mk</code>. If none of <code class=
1.37 dillo 9967: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
9968: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
9969: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47 reed 9970: are defined (as can happen with platform-specific options
1.42 dillo 9971: if none of them is supported on the current platform),
9972: <code class="varname">PKG_OPTIONS</code> is set to the
9973: empty list and the package is otherwise treated as not
9974: using the options framework.</p>
1.37 dillo 9975:
1.45 wiz 9976: <p>After the inclusion of <code xmlns=
9977: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9978: "filename">bsd.options.mk</code>, the variable
1.28 rillig 9979: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 9980: list of selected build options, properly filtered to
1.28 rillig 9981: remove unsupported and duplicate options.</p>
9982:
1.1 grant 9983: <p>The remaining sections contain the logic that is
1.37 dillo 9984: specific to each option. The correct way to check for an
9985: option is to check whether it is listed in <code class=
9986: "varname">PKG_OPTIONS</code>:</p>
9987: <pre class="programlisting">
1.51 rillig 9988: .if !empty(PKG_OPTIONS:M<em class=
1.37 dillo 9989: "replaceable"><code>option</code></em>)
9990: </pre>
1.48 dillo 9991: </div>
1.37 dillo 9992:
1.57 ! minskim 9993: <div class="sect1" lang="en">
1.48 dillo 9994: <div class="titlepage">
9995: <div>
9996: <div>
9997: <h2 class="title" style="clear: both"><a name=
9998: "option-names"></a>13.3. Option Names</h2>
9999: </div>
10000: </div>
10001: </div>
10002:
10003: <p>Options that enable similar features in different
10004: packages (like optional support for a library) should use
10005: a common name in all packages that support it (like the
10006: name of the library). If another package already has an
10007: option with the same meaning, use the same name.</p>
10008:
10009: <p>Options that enable features specific to one package,
10010: where it's unlikely that another (unrelated) package has
10011: the same (or a similar) optional feature, should use a
10012: name prefixed with <code class="varname"><em class=
10013: "replaceable"><code>pkgname</code></em>-</code>.</p>
10014:
10015: <p>If a group of related packages share an optional
10016: feature specific to that group, prefix it with the name
10017: of the “<span class="quote">main</span>”
10018: package (e. g. <code class=
10019: "varname">djbware-errno-hack</code>).</p>
10020:
10021: <p>For new options, add a line to <code xmlns=
10022: "http://www.w3.org/TR/xhtml1/transitional" class=
10023: "filename">mk/defaults/options.description</code>. Lines
10024: have two fields, separated by tab. The first field is the
10025: option name, the second its description. The description
10026: should be a whole sentence (starting with an uppercase
10027: letter and ending with a period) that describes what
10028: enabling the option does. E. g. “<span class=
10029: "quote">Enable ispell support.</span>” The file is
10030: sorted by option names.</p>
1.1 grant 10031: </div>
10032: </div>
10033:
1.57 ! minskim 10034: <div class="chapter" lang="en">
1.1 grant 10035: <div class="titlepage">
10036: <div>
10037: <div>
1.57 ! minskim 10038: <h2 class="title"><a name=
1.38 dillo 10039: "build"></a>Chapter 14. The build
1.1 grant 10040: process</h2>
10041: </div>
10042: </div>
10043: </div>
10044:
10045: <div class="toc">
10046: <p><b>Table of Contents</b></p>
10047:
10048: <dl>
1.56 rillig 10049: <dt><span class="sect1"><a href="#build.intro">14.1.
10050: Introduction</a></span></dt>
10051:
10052: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 10053: Program location</a></span></dt>
10054:
1.56 rillig 10055: <dt><span class="sect1"><a href=
10056: "#build.builddirs">14.3. Directories used during the
10057: build process</a></span></dt>
10058:
10059: <dt><span class="sect1"><a href="#build.running">14.4.
10060: Running a phase</a></span></dt>
10061:
10062: <dt><span class="sect1"><a href="#build.fetch">14.5.
10063: The <span class="emphasis"><em>fetch</em></span>
10064: phase</a></span></dt>
10065:
10066: <dt><span class="sect1"><a href="#build.checksum">14.6.
10067: The <span class="emphasis"><em>checksum</em></span>
10068: phase</a></span></dt>
10069:
10070: <dt><span class="sect1"><a href="#build.extract">14.7.
10071: The <span class="emphasis"><em>extract</em></span>
10072: phase</a></span></dt>
10073:
10074: <dt><span class="sect1"><a href="#build.patch">14.8.
10075: The <span class="emphasis"><em>patch</em></span>
10076: phase</a></span></dt>
10077:
10078: <dt><span class="sect1"><a href="#build.tools">14.9.
10079: The <span class="emphasis"><em>tools</em></span>
10080: phase</a></span></dt>
10081:
10082: <dt><span class="sect1"><a href="#build.wrapper">14.10.
10083: The <span class="emphasis"><em>wrapper</em></span>
10084: phase</a></span></dt>
1.1 grant 10085:
10086: <dt><span class="sect1"><a href=
1.56 rillig 10087: "#build.configure">14.11. The <span class=
10088: "emphasis"><em>configure</em></span>
10089: phase</a></span></dt>
10090:
10091: <dt><span class="sect1"><a href="#build.build">14.12.
10092: The <span class="emphasis"><em>build</em></span>
10093: phase</a></span></dt>
10094:
10095: <dt><span class="sect1"><a href="#build.test">14.13.
10096: The <span class="emphasis"><em>test</em></span>
10097: phase</a></span></dt>
10098:
10099: <dt><span class="sect1"><a href="#build.install">14.14.
10100: The <span class="emphasis"><em>install</em></span>
10101: phase</a></span></dt>
10102:
10103: <dt><span class="sect1"><a href="#build.package">14.15.
10104: The <span class="emphasis"><em>package</em></span>
10105: phase</a></span></dt>
10106:
10107: <dt><span class="sect1"><a href=
10108: "#build.helpful-targets">14.16. Other helpful
1.1 grant 10109: targets</a></span></dt>
10110: </dl>
10111: </div>
10112:
1.57 ! minskim 10113: <div class="sect1" lang="en">
1.56 rillig 10114: <div class="titlepage">
10115: <div>
10116: <div>
10117: <h2 class="title" style="clear: both"><a name=
10118: "build.intro"></a>14.1. Introduction</h2>
10119: </div>
10120: </div>
10121: </div>
10122:
10123: <p>This chapter gives a detailed description on how a
10124: package is built. Building a package is separated into
10125: different <span class="emphasis"><em>phases</em></span>
10126: (for example <code class="varname">fetch</code>,
10127: <code class="varname">build</code>, <code class=
10128: "varname">install</code>), all of which are described in
10129: the following sections. Each phase is splitted into
10130: so-called <span class="emphasis"><em>stages</em></span>,
10131: which take the name of the containing stage, prefixed by
10132: one of <code class="varname">pre-</code>, <code class=
10133: "varname">do-</code> or <code class=
10134: "varname">post-</code>. (Examples are <code class=
10135: "varname">pre-configure</code>, <code class=
10136: "varname">post-build</code>.) Most of the actual work is
10137: done in the <code class="varname">do-*</code> stages.</p>
10138:
10139: <p>The basic steps for building a program are always the
10140: same. First the program's source (<span class=
10141: "emphasis"><em>distfile</em></span>) must be brought to
10142: the local system and then extracted. After any patches to
10143: compile properly on NetBSD are applied, the software can
10144: be configured, then built (usually by compiling), and
10145: finally the generated binaries, etc. can be put into
10146: place on the system. These are exactly the steps
10147: performed by the NetBSD package system, which is
10148: implemented as a series of targets in a central Makefile,
10149: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10150: class="filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
10151: </div>
1.1 grant 10152:
1.57 ! minskim 10153: <div class="sect1" lang="en">
1.1 grant 10154: <div class="titlepage">
10155: <div>
10156: <div>
10157: <h2 class="title" style="clear: both"><a name=
1.56 rillig 10158: "build.prefix"></a>14.2. Program location</h2>
1.1 grant 10159: </div>
10160: </div>
10161: </div>
10162:
10163: <p>Before outlining the process performed by the NetBSD
10164: package system in the next section, here's a brief
10165: discussion on where programs are installed, and which
10166: variables influence this.</p>
10167:
1.14 xtraeme 10168: <p>The automatic variable <code class=
10169: "varname">PREFIX</code> indicates where all files of the
10170: final program shall be installed. It is usually set to
1.45 wiz 10171: <code class="varname">LOCALBASE</code> (<code xmlns=
10172: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10173: "filename">/usr/pkg</code>), or <code class=
10174: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 10175: “<span class="quote">cross</span>” category.
1.14 xtraeme 10176: The value of <code class="varname">PREFIX</code> needs to
10177: be put into the various places in the program's source
10178: where paths to these files are encoded. See <a href=
1.1 grant 10179: "#components.patches" title=
1.38 dillo 10180: "8.3. patches/*">Section 8.3,
1.1 grant 10181: “patches/*”</a> and <a href="#fixes.libtool"
10182: title=
1.38 dillo 10183: "15.3.1. Shared libraries - libtool">Section 15.3.1,
1.1 grant 10184: “Shared libraries - libtool”</a> for more
10185: details.</p>
10186:
10187: <p>When choosing which of these variables to use, follow
10188: the following rules:</p>
10189:
10190: <div class="itemizedlist">
10191: <ul type="disc">
10192: <li>
1.14 xtraeme 10193: <p><code class="varname">PREFIX</code> always
10194: points to the location where the current pkg will
10195: be installed. When referring to a pkg's own
1.1 grant 10196: installation path, use “<span class=
10197: "quote">${PREFIX}</span>”.</p>
10198: </li>
10199:
10200: <li>
1.14 xtraeme 10201: <p><code class="varname">LOCALBASE</code> is where
10202: all non-X11 pkgs are installed. If you need to
1.1 grant 10203: construct a -I or -L argument to the compiler to
10204: find includes and libraries installed by another
10205: non-X11 pkg, use “<span class=
10206: "quote">${LOCALBASE}</span>”.</p>
10207: </li>
10208:
10209: <li>
1.14 xtraeme 10210: <p><code class="varname">X11BASE</code> is where
10211: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 10212: installed. When looking for <span class=
10213: "emphasis"><em>standard</em></span> X11 includes
10214: (not those installed by a pkg), use
10215: “<span class=
10216: "quote">${X11BASE}</span>”.</p>
10217: </li>
10218:
10219: <li>
1.47 reed 10220: <p>X11-based packages are special in that they may
10221: be installed in either <code class=
1.14 xtraeme 10222: "varname">X11BASE</code> or <code class=
10223: "varname">LOCALBASE</code>.</p>
1.1 grant 10224:
10225: <p>Usually, X11 packages should be installed under
1.14 xtraeme 10226: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 10227: possible. Note that you will need to include
1.45 wiz 10228: <code xmlns=
10229: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 10230: "filename">../../mk/x11.buildlink3.mk</code> in
10231: them to request the presence of X11 and to get the
10232: right compilation flags.</p>
1.1 grant 10233:
10234: <p>Even though, there are some packages that cannot
1.14 xtraeme 10235: be installed under <code class=
10236: "varname">LOCALBASE</code>: those that come with
1.1 grant 10237: app-defaults files. These packages are special and
1.14 xtraeme 10238: they must be placed under <code class=
10239: "varname">X11BASE</code>. To accomplish this, set
10240: either <code class="varname">USE_X11BASE</code> or
10241: <code class="varname">USE_IMAKE</code> in your
1.1 grant 10242: package.</p>
10243:
1.34 wiz 10244: <p>Some notes: If you need to find includes or
1.14 xtraeme 10245: libraries installed by a pkg that has <code class=
10246: "varname">USE_IMAKE</code> or <code class=
10247: "varname">USE_X11BASE</code> in its pkg
1.45 wiz 10248: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10249: class="filename">Makefile</code>, you need to look
10250: in <span class="emphasis"><em>both</em></span>
10251: <code xmlns=
10252: "http://www.w3.org/TR/xhtml1/transitional" class=
10253: "filename">${X11BASE}</code> and <code xmlns=
10254: "http://www.w3.org/TR/xhtml1/transitional" class=
10255: "filename">${LOCALBASE}</code>. To force
10256: installation of all X11 packages in <code class=
10257: "varname">LOCALBASE</code>, the <a xmlns=
10258: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10259: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 10260: target="_top"><code xmlns="" class=
10261: "filename">pkgtools/xpkgwedge</code></a> package is
1.34 wiz 10262: enabled by default.</p>
1.1 grant 10263: </li>
10264:
10265: <li>
1.14 xtraeme 10266: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 10267: used to refer to the installed location of an X11
1.14 xtraeme 10268: package. <code class="varname">X11PREFIX</code>
10269: will be set to <code class="varname">X11BASE</code>
10270: if xpkgwedge is not installed, and to <code class=
10271: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 10272: installed.</p>
10273: </li>
10274:
10275: <li>
10276: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 10277: have some packages installed in <code class=
10278: "varname">X11BASE</code> and some in <code class=
10279: "varname">LOCALBASE</code>. To determine the prefix
10280: of an installed package, the <code class=
10281: "varname">EVAL_PREFIX</code> definition can be
10282: used. It takes pairs in the format
10283: “<span class=
1.1 grant 10284: "quote">DIRNAME=<package></span>”, and
1.24 wiz 10285: the <a href=
10286: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10287: <span class="citerefentry"><span class=
10288: "refentrytitle">make</span>(1)</span></a> variable
10289: <code class="varname">DIRNAME</code> will be set to
10290: the prefix of the installed package
10291: <package>, or “<span class=
1.1 grant 10292: "quote">${X11PREFIX}</span>” if the package
10293: is not installed.</p>
10294:
10295: <p>This is best illustrated by example.</p>
10296:
1.45 wiz 10297: <p>The following lines are taken from <code xmlns=
10298: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10299: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 10300: <pre class="programlisting">
1.51 rillig 10301: EVAL_PREFIX+= GTKDIR=gtk+
10302: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
10303: --with-gtk-prefix="${GTKDIR}" \
10304: --enable-multibyte
1.1 grant 10305: </pre>
10306:
10307: <p>Specific defaults can be defined for the
1.14 xtraeme 10308: packages evaluated using <code class=
10309: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 10310: of the form:</p>
10311: <pre class="programlisting">
1.51 rillig 10312: GTKDIR_DEFAULT= ${LOCALBASE}
1.1 grant 10313: </pre>
10314:
1.14 xtraeme 10315: <p>where <code class="varname">GTKDIR</code>
1.1 grant 10316: corresponds to the first definition in the
1.14 xtraeme 10317: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 10318: </li>
10319:
10320: <li>
1.45 wiz 10321: <p>Within <code xmlns=
10322: "http://www.w3.org/TR/xhtml1/transitional" class=
10323: "filename">${PREFIX}</code>, packages should
10324: install files according to <a href=
1.24 wiz 10325: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
10326: <span class="citerefentry"><span class=
10327: "refentrytitle">hier</span>(7)</span></a>, with the
1.45 wiz 10328: exception that manual pages go into <code xmlns=
10329: "http://www.w3.org/TR/xhtml1/transitional" class=
10330: "filename">${PREFIX}/man</code>, not <code xmlns=
10331: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10332: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 10333: </li>
10334: </ul>
10335: </div>
10336: </div>
10337:
1.57 ! minskim 10338: <div class="sect1" lang="en">
1.1 grant 10339: <div class="titlepage">
10340: <div>
10341: <div>
10342: <h2 class="title" style="clear: both"><a name=
1.56 rillig 10343: "build.builddirs"></a>14.3. Directories used
10344: during the build process</h2>
1.1 grant 10345: </div>
10346: </div>
10347: </div>
10348:
1.56 rillig 10349: <p>When building a package, a number of directories is
10350: used to store source files, temporary files,
10351: pkgsrc-internal files, and so on. These directories are
10352: explained here.</p>
10353:
10354: <p>Some of the directory variables contain relative
10355: pathnames. There are two common base directories for
10356: these relative directories: <code class=
10357: "varname">PKGSRCDIR/PKGPATH</code> is used for
10358: directories that are pkgsrc-specific. <code class=
10359: "varname">WRKSRC</code> is used for directories inside
10360: the package itself. The permissions after each variable
10361: indicate whether the variable may be changed by the
10362: package Makefile.</p>
1.1 grant 10363:
10364: <div class="variablelist">
10365: <dl>
1.56 rillig 10366: <dt><span class="term"><code class=
10367: "varname">PKGSRCDIR</code> (read-only)</span></dt>
10368:
10369: <dd>
10370: <p>This is an absolute pathname that points to the
10371: pkgsrc root directory. Generally, you don't need
10372: it.</p>
10373: </dd>
10374:
10375: <dt><span class="term"><code class=
10376: "varname">PKGPATH</code> (read-only)</span></dt>
1.1 grant 10377:
10378: <dd>
1.56 rillig 10379: <p>This is a pathname relative to <code class=
10380: "varname">PKGSRCDIR</code> that points to the
10381: current package.</p>
10382: </dd>
10383:
10384: <dt><span class="term"><code class=
10385: "varname">WRKDIR</code> (read-only)</span></dt>
10386:
10387: <dd>
10388: <p>This is an absolute pathname pointing to the
1.57 ! minskim 10389: directory where all work takes place. The distfiles
! 10390: are extraced to this directory. It also contains
! 10391: temporary directories and log files used by the
! 10392: various pkgsrc frameworks, like <span class=
! 10393: "emphasis"><em>buildlink</em></span> or the
! 10394: <span class=
1.56 rillig 10395: "emphasis"><em>wrappers</em></span>.</p>
10396: </dd>
10397:
10398: <dt><span class="term"><code class=
10399: "varname">WRKSRC</code> (read-write)</span></dt>
10400:
10401: <dd>
10402: <p>This is an absolute pathname pointing to the
10403: directory where the distfiles are extracted. It is
10404: usually a direct subdirectory of <code class=
10405: "varname">WRKDIR</code>, and often it's the only
10406: directory entry that isn't hidden.</p>
10407: </dd>
10408: </dl>
10409: </div>
10410: </div>
10411:
1.57 ! minskim 10412: <div class="sect1" lang="en">
1.56 rillig 10413: <div class="titlepage">
10414: <div>
10415: <div>
10416: <h2 class="title" style="clear: both"><a name=
10417: "build.running"></a>14.4. Running a phase</h2>
10418: </div>
10419: </div>
10420: </div>
10421:
10422: <p>You can run a particular phase by typing
10423: <span><strong class="command">make phase</strong></span>,
10424: where <span class="emphasis"><em>phase</em></span> is the
10425: name of the phase. This will automatically run all phases
10426: that are required for this phase. The default phase is
10427: <code class="varname">build</code>, that is, when you run
10428: <span><strong class="command">make</strong></span>
10429: without parameters in a package directory, the package
10430: will be built, but not installed.</p>
10431: </div>
10432:
1.57 ! minskim 10433: <div class="sect1" lang="en">
1.56 rillig 10434: <div class="titlepage">
10435: <div>
10436: <div>
10437: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 10438: "build.fetch"></a>14.5. The <span class=
! 10439: "emphasis"><em>fetch</em></span> phase</h2>
1.56 rillig 10440: </div>
10441: </div>
10442: </div>
10443:
10444: <p>This will check if the file(s) given in the variables
10445: <code class="varname">DISTFILES</code> and <code class=
10446: "varname">PATCHFILES</code> (as defined in the package's
10447: Makefile) are present on the local system in <code xmlns=
10448: "http://www.w3.org/TR/xhtml1/transitional" class=
10449: "filename">/usr/pkgsrc/distfiles</code>. If they are not
10450: present, an attempt will be made to fetch them using
10451: commands of the form:</p>
10452: <pre class="programlisting">
1.51 rillig 10453: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 grant 10454: </pre>
10455:
1.56 rillig 10456: <p>where ${site} varies through several possibilities in
10457: turn: first, <code class=
10458: "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
10459: sites specified in either <code class=
10460: "varname">SITES_file</code> if defined, else <code class=
10461: "varname">MASTER_SITES</code> or <code class=
10462: "varname">PATCH_SITES</code>, as applies, then finally
10463: the value of <code class=
10464: "varname">MASTER_SITE_BACKUP</code>. The order of all
10465: except the first can be optionally sorted by the user,
10466: via setting either <code class=
10467: "varname">MASTER_SORT_AWK</code> or <code class=
10468: "varname">MASTER_SORT_REGEX</code>.</p>
10469: </div>
10470:
1.57 ! minskim 10471: <div class="sect1" lang="en">
1.56 rillig 10472: <div class="titlepage">
10473: <div>
10474: <div>
10475: <h2 class="title" style="clear: both"><a name=
10476: "build.checksum"></a>14.6. The <span class=
10477: "emphasis"><em>checksum</em></span> phase</h2>
10478: </div>
10479: </div>
10480: </div>
10481:
10482: <p>After the distfile(s) are fetched, their checksum is
10483: generated and compared with the checksums stored in the
10484: distinfo file. If the checksums don't match, the build is
10485: aborted. This is to ensure the same distfile is used for
10486: building, and that the distfile wasn't changed, e.g. by
10487: some malign force, deliberately changed distfiles on the
10488: master distribution site or network lossage.</p>
10489: </div>
10490:
1.57 ! minskim 10491: <div class="sect1" lang="en">
1.56 rillig 10492: <div class="titlepage">
10493: <div>
10494: <div>
10495: <h2 class="title" style="clear: both"><a name=
10496: "build.extract"></a>14.7. The <span class=
10497: "emphasis"><em>extract</em></span> phase</h2>
10498: </div>
10499: </div>
10500: </div>
10501:
10502: <p>When the distfiles are present on the local system,
10503: they need to be extracted, as they are usually in the
10504: form of some compressed archive format, most commonly
10505: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10506: class="filename">.tar.gz</code>.</p>
1.1 grant 10507:
1.56 rillig 10508: <p>If only some of the distfiles need to be uncompressed,
10509: the files to be uncompressed should be put into
10510: <code class="varname">EXTRACT_ONLY</code>.</p>
1.1 grant 10511:
1.56 rillig 10512: <p>If the distfiles are not in <code xmlns=
10513: "http://www.w3.org/TR/xhtml1/transitional" class=
10514: "filename">.tar.gz</code> format, they can be extracted
10515: by setting either <code class=
10516: "varname">EXTRACT_SUFX</code>, or <code class=
10517: "varname">EXTRACT_CMD</code>, <code class=
10518: "varname">EXTRACT_BEFORE_ARGS</code> and <code class=
10519: "varname">EXTRACT_AFTER_ARGS</code>. In the former case,
10520: pkgsrc knows how to extract a number of suffixes
10521: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10522: class="filename">.tar.gz</code>, <code xmlns=
10523: "http://www.w3.org/TR/xhtml1/transitional" class=
10524: "filename">.tgz</code>, <code xmlns=
10525: "http://www.w3.org/TR/xhtml1/transitional" class=
10526: "filename">.tar.gz2</code>, <code xmlns=
10527: "http://www.w3.org/TR/xhtml1/transitional" class=
10528: "filename">.tbz</code>, <code xmlns=
10529: "http://www.w3.org/TR/xhtml1/transitional" class=
10530: "filename">.tar.Z</code>, <code xmlns=
10531: "http://www.w3.org/TR/xhtml1/transitional" class=
10532: "filename">.tar</code>, <code xmlns=
10533: "http://www.w3.org/TR/xhtml1/transitional" class=
10534: "filename">.shar.gz</code>, <code xmlns=
10535: "http://www.w3.org/TR/xhtml1/transitional" class=
10536: "filename">.shar.bz2</code>, <code xmlns=
10537: "http://www.w3.org/TR/xhtml1/transitional" class=
10538: "filename">.shar.Z</code>, <code xmlns=
10539: "http://www.w3.org/TR/xhtml1/transitional" class=
10540: "filename">.shar</code>, <code xmlns=
10541: "http://www.w3.org/TR/xhtml1/transitional" class=
10542: "filename">.Z</code>, <code xmlns=
10543: "http://www.w3.org/TR/xhtml1/transitional" class=
10544: "filename">.bz2</code> and <code xmlns=
10545: "http://www.w3.org/TR/xhtml1/transitional" class=
10546: "filename">.gz</code>; see the definition of the various
10547: <code class="varname">DECOMPRESS_CMD</code> variables in
10548: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10549: class="filename">bsd.pkg.extract.mk</code> for a complete
10550: list). Here's an example on how to use the other
10551: variables for a program that comes with a compressed
10552: shell archive whose name ends in <code xmlns=
10553: "http://www.w3.org/TR/xhtml1/transitional" class=
10554: "filename">.msg.gz</code>:</p>
10555: <pre class="programlisting">
1.51 rillig 10556: EXTRACT_SUFX= .msg.gz
10557: EXTRACT_CMD= zcat
10558: EXTRACT_BEFORE_ARGS=
10559: EXTRACT_AFTER_ARGS= |sh
1.1 grant 10560: </pre>
1.56 rillig 10561: </div>
10562:
1.57 ! minskim 10563: <div class="sect1" lang="en">
1.56 rillig 10564: <div class="titlepage">
10565: <div>
10566: <div>
10567: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 10568: "build.patch"></a>14.8. The <span class=
! 10569: "emphasis"><em>patch</em></span> phase</h2>
1.56 rillig 10570: </div>
10571: </div>
10572: </div>
10573:
10574: <p>After extraction, all the patches named by the
10575: <code class="varname">PATCHFILES</code>, those present in
10576: the patches subdirectory of the package as well as in
10577: $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
10578: "http://www.w3.org/TR/xhtml1/transitional" class=
10579: "filename">/usr/local/patches/graphics/png</code>) are
10580: applied. Patchfiles ending in <code xmlns=
10581: "http://www.w3.org/TR/xhtml1/transitional" class=
10582: "filename">.Z</code> or <code xmlns=
10583: "http://www.w3.org/TR/xhtml1/transitional" class=
10584: "filename">.gz</code> are uncompressed before they are
10585: applied, files ending in <code xmlns=
10586: "http://www.w3.org/TR/xhtml1/transitional" class=
10587: "filename">.orig</code> or <code xmlns=
10588: "http://www.w3.org/TR/xhtml1/transitional" class=
10589: "filename">.rej</code> are ignored. Any special options
10590: to <a href=
10591: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10592: <span class="citerefentry"><span class=
10593: "refentrytitle">patch</span>(1)</span></a> can be handed
10594: in <code class="varname">PATCH_DIST_ARGS</code>. See
10595: <a href="#components.patches" title=
10596: "8.3. patches/*">Section 8.3,
10597: “patches/*”</a> for more details.</p>
10598:
10599: <p>By default <a href=
10600: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10601: <span class="citerefentry"><span class=
10602: "refentrytitle">patch</span>(1)</span></a> is given
10603: special args to make it fail if the patches apply with
10604: some lines of fuzz. Please fix (regen) the patches so
10605: that they apply cleanly. The rationale behind this is
10606: that patches that don't apply cleanly may end up being
10607: applied in the wrong place, and cause severe harm
10608: there.</p>
10609: </div>
10610:
1.57 ! minskim 10611: <div class="sect1" lang="en">
1.56 rillig 10612: <div class="titlepage">
10613: <div>
10614: <div>
10615: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 10616: "build.tools"></a>14.9. The <span class=
! 10617: "emphasis"><em>tools</em></span> phase</h2>
1.56 rillig 10618: </div>
10619: </div>
10620: </div>
10621:
10622: <p>[TODO]</p>
10623: </div>
10624:
1.57 ! minskim 10625: <div class="sect1" lang="en">
1.56 rillig 10626: <div class="titlepage">
10627: <div>
10628: <div>
10629: <h2 class="title" style="clear: both"><a name=
10630: "build.wrapper"></a>14.10. The <span class=
10631: "emphasis"><em>wrapper</em></span> phase</h2>
10632: </div>
10633: </div>
10634: </div>
10635:
10636: <p>[TODO]</p>
10637: </div>
10638:
1.57 ! minskim 10639: <div class="sect1" lang="en">
1.56 rillig 10640: <div class="titlepage">
10641: <div>
10642: <div>
10643: <h2 class="title" style="clear: both"><a name=
10644: "build.configure"></a>14.11. The <span class=
10645: "emphasis"><em>configure</em></span> phase</h2>
10646: </div>
10647: </div>
10648: </div>
10649:
10650: <p>Most pieces of software need information on the header
10651: files, system calls, and library routines which are
10652: available on the platform they run on. The process of
10653: determining this information is known as configuration,
10654: and is usually automated. In most cases, a script is
10655: supplied with the distfiles, and its invocation results
10656: in generation of header files, Makefiles, etc.</p>
10657:
10658: <p>If the package contains a configure script, this can
10659: be invoked by setting <code class=
10660: "varname">HAS_CONFIGURE</code> to “<span class=
10661: "quote">yes</span>”. If the configure script is a
10662: GNU autoconf script, you should set <code class=
10663: "varname">GNU_CONFIGURE</code> to “<span class=
10664: "quote">yes</span>” instead. What happens in the
10665: <span class="emphasis"><em>configure</em></span> phase is
10666: roughly:</p>
10667: <pre class="programlisting">
10668: .for d in ${CONFIGURE_DIRS}
10669: cd ${WRKSRC} && cd ${d} && env ${CONFIGURE_ENV} \
10670: ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
10671: .endfor
10672: </pre>
1.1 grant 10673:
1.56 rillig 10674: <p><code class="varname">CONFIGURE_DIRS</code> (default:
10675: “<span class="quote">.</span>”) is a list of
10676: pathnames relative to <code class=
10677: "varname">WRKSRC</code>. In each of these directories,
10678: the configure script is run with the environment
10679: <code class="varname">CONFIGURE_ENV</code> and arguments
10680: <code class="varname">CONFIGURE_ARGS</code>. The
10681: variables <code class="varname">CONFIGURE_ENV</code>,
10682: <code class="varname">CONFIGURE_SCRIPT</code> (default:
10683: “<span class="quote">./configure</span>”) and
10684: <code class="varname">CONFIGURE_ARGS</code> may all be
10685: changed by the package.</p>
1.1 grant 10686:
1.56 rillig 10687: <p>If the program uses an <code xmlns=
10688: "http://www.w3.org/TR/xhtml1/transitional" class=
10689: "filename">Imakefile</code> for configuration, the
10690: appropriate steps can be invoked by setting <code class=
10691: "varname">USE_IMAKE</code> to “<span class=
10692: "quote">yes</span>”. (If you only want the package
10693: installed in <code class="varname">${X11PREFIX}</code>
10694: but xmkmf not being run, set <code class=
10695: "varname">USE_X11BASE</code> instead.)</p>
10696: </div>
1.1 grant 10697:
1.57 ! minskim 10698: <div class="sect1" lang="en">
1.56 rillig 10699: <div class="titlepage">
10700: <div>
10701: <div>
10702: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 10703: "build.build"></a>14.12. The <span class=
! 10704: "emphasis"><em>build</em></span> phase</h2>
1.56 rillig 10705: </div>
10706: </div>
1.1 grant 10707: </div>
10708:
1.56 rillig 10709: <p>For building a package, a rough equivalent of the
10710: following code is executed.</p>
1.1 grant 10711: <pre class="programlisting">
1.56 rillig 10712: .for d in ${BUILD_DIRS}
10713: cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \
10714: ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
10715: -f ${MAKEFILE} ${BUILD_TARGET}
10716: .endfor
1.1 grant 10717: </pre>
1.56 rillig 10718:
10719: <p><code class="varname">BUILD_DIRS</code> (default:
10720: “<span class="quote">.</span>”) is a list of
10721: pathnames relative to <code class=
10722: "varname">WRKSRC</code>. In each of these directories,
10723: <code class="varname">MAKE_PROGRAM</code> is run with the
10724: environment <code class="varname">MAKE_ENV</code> and
10725: arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
10726: The variables <code class="varname">MAKE_ENV</code>,
10727: <code class="varname">BUILD_MAKE_FLAGS</code>,
10728: <code class="varname">MAKEFILE</code> and <code class=
10729: "varname">BUILD_TARGET</code> may all be changed by the
10730: package.</p>
10731:
10732: <p>The default value of <code class=
10733: "varname">MAKE_PROGRAM</code> is “<span class=
10734: "quote">gmake</span>” if <code class=
10735: "varname">USE_TOOLS</code> contains “<span class=
10736: "quote">gmake</span>”, “<span class=
10737: "quote">make</span>” otherwise. The default value
10738: of <code class="varname">MAKEFILE</code> is
10739: “<span class="quote">Makefile</span>”, and
10740: <code class="varname">BUILD_TARGET</code> defaults to
10741: “<span class="quote">all</span>”.</p>
10742: </div>
10743:
1.57 ! minskim 10744: <div class="sect1" lang="en">
1.56 rillig 10745: <div class="titlepage">
10746: <div>
10747: <div>
10748: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 10749: "build.test"></a>14.13. The <span class=
! 10750: "emphasis"><em>test</em></span> phase</h2>
1.56 rillig 10751: </div>
10752: </div>
10753: </div>
10754:
10755: <p>[TODO]</p>
10756: </div>
10757:
1.57 ! minskim 10758: <div class="sect1" lang="en">
1.56 rillig 10759: <div class="titlepage">
10760: <div>
10761: <div>
10762: <h2 class="title" style="clear: both"><a name=
10763: "build.install"></a>14.14. The <span class=
10764: "emphasis"><em>install</em></span> phase</h2>
10765: </div>
10766: </div>
10767: </div>
10768:
10769: <p>Once the build stage has completed, the final step is
10770: to install the software in public directories, so users
10771: can access the programs and files. As in the
10772: build-target, <code class="varname">$MAKE_PROGRAM</code>
10773: is invoked on <code class="varname">$MAKEFILE</code>
10774: here, but with the <code class=
10775: "varname">$INSTALL_TARGET</code> instead, the latter
10776: defaulting to “<span class=
10777: "quote">install</span>” (plus “<span class=
10778: "quote">install.man</span>”, if <code class=
10779: "varname">USE_IMAKE</code> is set).</p>
10780: </div>
10781:
1.57 ! minskim 10782: <div class="sect1" lang="en">
1.56 rillig 10783: <div class="titlepage">
10784: <div>
10785: <div>
10786: <h2 class="title" style="clear: both"><a name=
10787: "build.package"></a>14.15. The <span class=
10788: "emphasis"><em>package</em></span> phase</h2>
10789: </div>
10790: </div>
10791: </div>
10792:
10793: <p>[TODO]</p>
1.1 grant 10794: </div>
10795:
1.57 ! minskim 10796: <div class="sect1" lang="en">
1.1 grant 10797: <div class="titlepage">
10798: <div>
10799: <div>
10800: <h2 class="title" style="clear: both"><a name=
1.56 rillig 10801: "build.helpful-targets"></a>14.16. Other
1.1 grant 10802: helpful targets</h2>
10803: </div>
10804: </div>
10805: </div>
10806:
10807: <div class="variablelist">
10808: <dl>
10809: <dt><span class="term">pre/post-*</span></dt>
10810:
10811: <dd>
10812: <p>For any of the main targets described in the
10813: previous section, two auxiliary targets exist with
10814: “<span class="quote">pre-</span>” and
10815: “<span class="quote">post-</span>” used
10816: as a prefix for the main target's name. These
10817: targets are invoked before and after the main
10818: target is called, allowing extra configuration or
10819: installation steps be performed from a package's
10820: Makefile, for example, which a program's configure
10821: script or install target omitted.</p>
10822: </dd>
10823:
10824: <dt><span class="term">do-*</span></dt>
10825:
10826: <dd>
10827: <p>Should one of the main targets do the wrong
10828: thing, and should there be no variable to fix this,
10829: you can redefine it with the do-* target. (Note
10830: that redefining the target itself instead of the
10831: do-* target is a bad idea, as the pre-* and post-*
10832: targets won't be called anymore, etc.) You will not
10833: usually need to do this.</p>
10834: </dd>
10835:
10836: <dt><span class="term">reinstall</span></dt>
10837:
10838: <dd>
1.14 xtraeme 10839: <p>If you did a <span><strong class="command">make
10840: install</strong></span> and you noticed some file
10841: was not installed properly, you can repeat the
1.1 grant 10842: installation with this target, which will ignore
10843: the “<span class="quote">already
10844: installed</span>” flag.</p>
10845: </dd>
10846:
10847: <dt><span class="term">deinstall</span></dt>
10848:
10849: <dd>
1.24 wiz 10850: <p>This target does a <a href=
10851: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10852: <span class="citerefentry"><span class=
10853: "refentrytitle">pkg_delete</span>(1)</span></a> in
10854: the current directory, effectively de-installing
10855: the package. The following variables can be used to
10856: tune the behaviour:</p>
1.1 grant 10857:
10858: <div class="variablelist">
10859: <dl>
1.14 xtraeme 10860: <dt><span class="term"><code class=
10861: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 10862:
10863: <dd>
10864: <p>Add a "-v" to the <a href=
10865: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10866: <span class="citerefentry"><span class=
10867: "refentrytitle">pkg_delete</span>(1)</span></a>
10868: command.</p>
10869: </dd>
10870:
1.14 xtraeme 10871: <dt><span class="term"><code class=
10872: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 10873:
10874: <dd>
10875: <p>Remove all packages that require (depend
10876: on) the given package. This can be used to
10877: remove any packages that may have been pulled
10878: in by a given package, e.g. if
1.14 xtraeme 10879: <span><strong class="command">make deinstall
10880: DEINSTALLDEPENDS=1</strong></span> is done in
1.45 wiz 10881: <code xmlns=
10882: "http://www.w3.org/TR/xhtml1/transitional"
10883: class="filename">pkgsrc/x11/kde</code>, this
10884: is likely to remove whole KDE. Works by
1.1 grant 10885: adding “<span class=
10886: "quote">-R</span>” to the <a href=
10887: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10888: <span class="citerefentry"><span class=
10889: "refentrytitle">pkg_delete</span>(1)</span></a>
10890: command line.</p>
10891: </dd>
10892: </dl>
10893: </div>
10894: </dd>
10895:
10896: <dt><span class="term">update</span></dt>
10897:
10898: <dd>
10899: <p>This target causes the current package to be
10900: updated to the latest version. The package and all
10901: depending packages first get de-installed, then
10902: current versions of the corresponding packages get
10903: compiled and installed. This is similar to manually
10904: noting which packages are currently installed, then
1.14 xtraeme 10905: performing a series of <span><strong class=
10906: "command">make deinstall</strong></span> and
10907: <span><strong class="command">make
10908: install</strong></span> (or whatever <code class=
10909: "varname">UPDATE_TARGET</code> is set to) for these
10910: packages.</p>
1.1 grant 10911:
10912: <p>You can use the “<span class=
10913: "quote">update</span>” target to resume
1.14 xtraeme 10914: package updating in case a previous
10915: <span><strong class="command">make
10916: update</strong></span> was interrupted for some
10917: reason. However, in this case, make sure you don't
10918: call <span><strong class="command">make
10919: clean</strong></span> or otherwise remove the list
10920: of dependent packages in <code class=
1.47 reed 10921: "varname">WRKDIR</code>. Otherwise, you lose the
1.1 grant 10922: ability to automatically update the current package
10923: along with the dependent packages you have
10924: installed.</p>
10925:
1.14 xtraeme 10926: <p>Resuming an interrupted <span><strong class=
10927: "command">make update</strong></span> will only
10928: work as long as the package tree remains unchanged.
10929: If the source code for one of the packages to be
10930: updated has been changed, resuming
10931: <span><strong class="command">make
10932: update</strong></span> will most certainly
10933: fail!</p>
1.1 grant 10934:
10935: <p>The following variables can be used either on
1.45 wiz 10936: the command line or in <code xmlns=
10937: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10938: "filename">/etc/mk.conf</code> to alter the
10939: behaviour of <span><strong class="command">make
10940: update</strong></span>:</p>
1.1 grant 10941:
10942: <div class="variablelist">
10943: <dl>
1.14 xtraeme 10944: <dt><span class="term"><code class=
10945: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 10946:
10947: <dd>
10948: <p>Install target to recursively use for the
10949: updated package and the dependent packages.
1.14 xtraeme 10950: Defaults to <code class=
10951: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 10952: “<span class=
10953: "quote">install</span>” otherwise for
1.14 xtraeme 10954: <span><strong class="command">make
10955: update</strong></span>. e.g.
10956: <span><strong class="command">make update
10957: UPDATE_TARGET=package</strong></span></p>
1.1 grant 10958: </dd>
10959:
1.14 xtraeme 10960: <dt><span class="term"><code class=
10961: "varname">NOCLEAN</code></span></dt>
1.1 grant 10962:
10963: <dd>
10964: <p>Don't clean up after updating. Useful if
10965: you want to leave the work sources of the
10966: updated packages around for inspection or
10967: other purposes. Be sure you eventually clean
10968: up the source tree (see the
10969: “<span class=
10970: "quote">clean-update</span>” target
10971: below) or you may run into troubles with old
10972: source code still lying around on your next
1.14 xtraeme 10973: <span><strong class=
10974: "command">make</strong></span> or
10975: <span><strong class="command">make
10976: update</strong></span>.</p>
1.1 grant 10977: </dd>
10978:
1.14 xtraeme 10979: <dt><span class="term"><code class=
10980: "varname">REINSTALL</code></span></dt>
1.1 grant 10981:
10982: <dd>
10983: <p>Deinstall each package before installing
1.14 xtraeme 10984: (making <code class=
10985: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 10986: necessary if the “<span class=
10987: "quote">clean-update</span>” target
10988: (see below) was called after interrupting a
1.14 xtraeme 10989: running <span><strong class="command">make
10990: update</strong></span>.</p>
1.1 grant 10991: </dd>
10992:
1.14 xtraeme 10993: <dt><span class="term"><code class=
10994: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 10995:
10996: <dd>
10997: <p>Allows you to disable recursion and
10998: hardcode the target for packages. The default
10999: is “<span class=
11000: "quote">update</span>” for the update
11001: target, facilitating a recursive update of
1.14 xtraeme 11002: prerequisite packages. Only set <code class=
11003: "varname">DEPENDS_TARGET</code> if you want
11004: to disable recursive updates. Use
11005: <code class="varname">UPDATE_TARGET</code>
11006: instead to just set a specific target for
11007: each package to be installed during
11008: <span><strong class="command">make
11009: update</strong></span> (see above).</p>
1.1 grant 11010: </dd>
11011: </dl>
11012: </div>
11013: </dd>
11014:
11015: <dt><span class="term">clean-update</span></dt>
11016:
11017: <dd>
11018: <p>Clean the source tree for all packages that
1.14 xtraeme 11019: would get updated if <span><strong class=
11020: "command">make update</strong></span> was called
11021: from the current directory. This target should not
11022: be used if the current package (or any of its
11023: depending packages) have already been de-installed
11024: (e.g., after calling <span><strong class=
11025: "command">make update</strong></span>) or you may
11026: lose some packages you intended to update. As a
11027: rule of thumb: only use this target <span class=
11028: "emphasis"><em>before</em></span> the first time
11029: you run <span><strong class="command">make
11030: update</strong></span> and only if you have a dirty
11031: package tree (e.g., if you used <code class=
11032: "varname">NOCLEAN</code>).</p>
1.1 grant 11033:
1.47 reed 11034: <p>If you are unsure about whether your tree is
11035: clean, you can either perform a
1.14 xtraeme 11036: <span><strong class="command">make
1.47 reed 11037: clean</strong></span> at the top of the tree, or
11038: use the following sequence of commands from the
11039: directory of the package you want to update
11040: (<span class="emphasis"><em>before</em></span>
11041: running <span><strong class="command">make
1.14 xtraeme 11042: update</strong></span> for the first time,
11043: otherwise you lose all the packages you wanted to
11044: update!):</p>
1.1 grant 11045: <pre class="screen">
1.14 xtraeme 11046: <code class="prompt">#</code> <strong class=
11047: "userinput"><code>make clean-update</code></strong>
11048: <code class="prompt">#</code> <strong class=
11049: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
11050: <code class="prompt">#</code> <strong class=
11051: "userinput"><code>make update</code></strong>
1.1 grant 11052: </pre>
11053:
11054: <p>The following variables can be used either on
1.45 wiz 11055: the command line or in <code xmlns=
11056: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11057: "filename">/etc/mk.conf</code> to alter the
11058: behaviour of <span><strong class="command">make
11059: clean-update</strong></span>:</p>
1.1 grant 11060:
11061: <div class="variablelist">
11062: <dl>
1.14 xtraeme 11063: <dt><span class="term"><code class=
11064: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 11065:
11066: <dd>
1.14 xtraeme 11067: <p>After <span><strong class="command">make
11068: clean</strong></span>, do not reconstruct the
11069: list of directories to update for this
11070: package. Only use this if
11071: <span><strong class="command">make
11072: update</strong></span> successfully installed
11073: all packages you wanted to update. Normally,
11074: this is done automatically on
11075: <span><strong class="command">make
11076: update</strong></span>, but may have been
11077: suppressed by the <code class=
11078: "varname">NOCLEAN</code> variable (see
1.1 grant 11079: above).</p>
11080: </dd>
11081: </dl>
11082: </div>
11083: </dd>
11084:
11085: <dt><span class="term">info</span></dt>
11086:
11087: <dd>
11088: <p>This target invokes <a href=
11089: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11090: <span class="citerefentry"><span class=
11091: "refentrytitle">pkg_info</span>(1)</span></a> for
11092: the current package. You can use this to check
11093: which version of a package is installed.</p>
11094: </dd>
11095:
11096: <dt><span class="term">readme</span></dt>
11097:
11098: <dd>
1.45 wiz 11099: <p>This target generates a <code xmlns=
11100: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11101: "filename">README.html</code> file, which can be
1.1 grant 11102: viewed using a browser such as <a xmlns=
11103: "http://www.w3.org/TR/xhtml1/transitional" href=
11104: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 11105: target="_top"><code xmlns="" class=
11106: "filename">www/mozilla</code></a> or <a xmlns=
1.20 ben 11107: "http://www.w3.org/TR/xhtml1/transitional" href=
11108: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45 wiz 11109: target="_top"><code xmlns="" class=
11110: "filename">www/links</code></a>. The generated
11111: files contain references to any packages which are
11112: in the <code class="varname">PACKAGES</code>
11113: directory on the local host. The generated files
11114: can be made to refer to URLs based on <code class=
1.20 ben 11115: "varname">FTP_PKG_URL_HOST</code> and <code class=
11116: "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45 wiz 11117: wanted to generate <code xmlns=
11118: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11119: "filename">README.html</code> files which pointed
11120: to binary packages on the local machine, in the
1.45 wiz 11121: directory <code xmlns=
11122: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11123: "filename">/usr/packages</code>, set <code class=
11124: "varname">FTP_PKG_URL_HOST=file://localhost</code>
11125: and <code class=
11126: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
11127: <code class="varname">${PACKAGES}</code> directory
11128: and its subdirectories will be searched for all the
11129: binary packages.</p>
1.1 grant 11130: </dd>
11131:
11132: <dt><span class="term">readme-all</span></dt>
11133:
11134: <dd>
1.45 wiz 11135: <p>Use this target to create a file <code xmlns=
11136: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11137: "filename">README-all.html</code> which contains a
1.1 grant 11138: list of all packages currently available in the
11139: NetBSD Packages Collection, together with the
11140: category they belong to and a short description.
1.45 wiz 11141: This file is compiled from the <code xmlns=
11142: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11143: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 11144: sure to run this <span class=
1.14 xtraeme 11145: "emphasis"><em>after</em></span> a
11146: <span><strong class="command">make
11147: readme</strong></span>.</p>
1.1 grant 11148: </dd>
11149:
11150: <dt><span class="term">cdrom-readme</span></dt>
11151:
11152: <dd>
11153: <p>This is very much the same as the
11154: “<span class="quote">readme</span>”
11155: target (see above), but is to be used when
11156: generating a pkgsrc tree to be written to a CD-ROM.
1.45 wiz 11157: This target also produces <code xmlns=
11158: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11159: "filename">README.html</code> files, and can be
11160: made to refer to URLs based on <code class=
11161: "varname">CDROM_PKG_URL_HOST</code> and
11162: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 11163: </dd>
11164:
11165: <dt><span class="term">show-distfiles</span></dt>
11166:
11167: <dd>
11168: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 11169: are needed to build the package. (<code class=
11170: "varname">DISTFILES</code> and <code class=
1.45 wiz 11171: "varname">PATCHFILES</code>, but not <code xmlns=
11172: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11173: "filename">patches/*</code>)</p>
1.1 grant 11174: </dd>
11175:
11176: <dt><span class="term">show-downlevel</span></dt>
11177:
11178: <dd>
11179: <p>This target shows nothing if the package is not
11180: installed. If a version of this package is
11181: installed, but is not the version provided in this
11182: version of pkgsrc, then a warning message is
11183: displayed. This target can be used to show which of
11184: your installed packages are downlevel, and so the
11185: old versions can be deleted, and the current ones
11186: added.</p>
11187: </dd>
11188:
11189: <dt><span class="term">show-pkgsrc-dir</span></dt>
11190:
11191: <dd>
11192: <p>This target shows the directory in the pkgsrc
11193: hierarchy from which the package can be built and
11194: installed. This may not be the same directory as
11195: the one from which the package was installed. This
11196: target is intended to be used by people who may
11197: wish to upgrade many packages on a single host, and
11198: can be invoked from the top-level pkgsrc Makefile
11199: by using the “<span class=
11200: "quote">show-host-specific-pkgs</span>”
11201: target.</p>
11202: </dd>
11203:
11204: <dt><span class=
11205: "term">show-installed-depends</span></dt>
11206:
11207: <dd>
11208: <p>This target shows which installed packages match
1.14 xtraeme 11209: the current package's <code class=
11210: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 11211: dependencies are causing build problems.</p>
11212: </dd>
11213:
11214: <dt><span class="term">check-shlibs</span></dt>
11215:
11216: <dd>
11217: <p>After a package is installed, check all its
11218: binaries and (on ELF platforms) shared libraries to
11219: see if they find the shared libs they need. Run by
1.14 xtraeme 11220: default if <code class=
11221: "varname">PKG_DEVELOPER</code> is set in
1.45 wiz 11222: <code xmlns=
11223: "http://www.w3.org/TR/xhtml1/transitional" class=
11224: "filename">/etc/mk.conf</code>.</p>
1.1 grant 11225: </dd>
11226:
11227: <dt><span class="term">print-PLIST</span></dt>
11228:
11229: <dd>
11230: <p>After a “<span class="quote">make
11231: install</span>” from a new or upgraded pkg,
11232: this prints out an attempt to generate a new
1.45 wiz 11233: <code xmlns=
11234: "http://www.w3.org/TR/xhtml1/transitional" class=
11235: "filename">PLIST</code> from a <span><strong class=
11236: "command">find -newer
1.14 xtraeme 11237: work/.extract_done</strong></span>. An attempt is
11238: made to care for shared libs etc., but it is
1.1 grant 11239: <span class="emphasis"><em>strongly</em></span>
11240: recommended to review the result before putting it
1.45 wiz 11241: into <code xmlns=
11242: "http://www.w3.org/TR/xhtml1/transitional" class=
11243: "filename">PLIST</code>. On upgrades, it's useful
11244: to diff the output of this command against an
11245: already existing <code xmlns=
11246: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11247: "filename">PLIST</code> file.</p>
1.1 grant 11248:
1.24 wiz 11249: <p>If the package installs files via <a href=
11250: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
11251: <span class="citerefentry"><span class=
11252: "refentrytitle">tar</span>(1)</span></a> or other
11253: methods that don't update file access times, be
11254: sure to add these files manually to your
1.45 wiz 11255: <code xmlns=
11256: "http://www.w3.org/TR/xhtml1/transitional" class=
11257: "filename">PLIST</code>, as the “<span class=
11258: "quote">find -newer</span>” command used by
11259: this target won't catch them!</p>
1.1 grant 11260:
11261: <p>See <a href="#print-PLIST" title=
1.38 dillo 11262: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 11263: “Tweaking output of <span><strong class=
11264: "command">make
11265: print-PLIST</strong></span>”</a> for more
11266: information on this target.</p>
1.1 grant 11267: </dd>
11268:
11269: <dt><span class="term">bulk-package</span></dt>
11270:
11271: <dd>
11272: <p>Used to do bulk builds. If an appropriate binary
11273: package already exists, no action is taken. If not,
11274: this target will compile, install and package it
1.47 reed 11275: (and its depends, if <code class=
1.14 xtraeme 11276: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 11277: <a href="#binary.configuration" title=
1.38 dillo 11278: "6.3.1. Configuration">Section 6.3.1,
1.47 reed 11279: “Configuration”</a>). After creating
11280: the binary package, the sources, the just-installed
11281: package and its required packages are removed,
1.1 grant 11282: preserving free disk space.</p>
11283:
11284: <p><span class="emphasis"><em>Beware that this
11285: target may deinstall all packages installed on a
11286: system!</em></span></p>
11287: </dd>
11288:
11289: <dt><span class="term">bulk-install</span></dt>
11290:
11291: <dd>
11292: <p>Used during bulk-installs to install required
1.47 reed 11293: packages. If an up-to-date binary package is
1.1 grant 11294: available, it will be installed via <a href=
11295: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
11296: <span class="citerefentry"><span class=
11297: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 11298: not, <span><strong class="command">make
11299: bulk-package</strong></span> will be executed, but
1.47 reed 11300: the installed binary won't be removed.</p>
1.1 grant 11301:
11302: <p>A binary package is considered
1.47 reed 11303: “<span class="quote">up-to-date</span>”
1.1 grant 11304: to be installed via <a href=
11305: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
11306: <span class="citerefentry"><span class=
11307: "refentrytitle">pkg_add</span>(1)</span></a>
11308: if:</p>
11309:
11310: <div class="itemizedlist">
11311: <ul type="disc">
11312: <li>
1.45 wiz 11313: <p>None of the package's files (<code xmlns=
11314: "http://www.w3.org/TR/xhtml1/transitional"
11315: class="filename">Makefile</code>, ...) were
1.14 xtraeme 11316: modified since it was built.</p>
1.1 grant 11317: </li>
11318:
11319: <li>
11320: <p>None of the package's required (binary)
11321: packages were modified since it was
11322: built.</p>
11323: </li>
11324: </ul>
11325: </div>
11326:
11327: <p><span class="emphasis"><em>Beware that this
11328: target may deinstall all packages installed on a
11329: system!</em></span></p>
11330: </dd>
11331: </dl>
11332: </div>
11333: </div>
11334: </div>
11335:
1.57 ! minskim 11336: <div class="chapter" lang="en">
1.1 grant 11337: <div class="titlepage">
11338: <div>
11339: <div>
1.57 ! minskim 11340: <h2 class="title"><a name=
1.55 rillig 11341: "fixes"></a>Chapter 15. Making your package
11342: work</h2>
1.1 grant 11343: </div>
11344: </div>
11345: </div>
11346:
11347: <div class="toc">
11348: <p><b>Table of Contents</b></p>
11349:
11350: <dl>
1.30 wiz 11351: <dt><span class="sect1"><a href=
1.38 dillo 11352: "#general-operation">15.1. General
1.30 wiz 11353: operation</a></span></dt>
1.1 grant 11354:
11355: <dd>
11356: <dl>
11357: <dt><span class="sect2"><a href=
1.38 dillo 11358: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 11359: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 11360:
11361: <dt><span class="sect2"><a href=
1.38 dillo 11362: "#where-to-install-documentation">15.1.2. Where to
1.31 wiz 11363: install documentation</a></span></dt>
11364:
11365: <dt><span class="sect2"><a href=
1.38 dillo 11366: "#restricted-packages">15.1.3. Restricted
1.1 grant 11367: packages</a></span></dt>
11368:
11369: <dt><span class="sect2"><a href=
1.38 dillo 11370: "#dependencies">15.1.4. Handling
1.1 grant 11371: dependencies</a></span></dt>
11372:
11373: <dt><span class="sect2"><a href=
1.38 dillo 11374: "#conflicts">15.1.5. Handling conflicts with other
1.1 grant 11375: packages</a></span></dt>
11376:
11377: <dt><span class="sect2"><a href=
1.38 dillo 11378: "#not-building-packages">15.1.6. Packages that
1.30 wiz 11379: cannot or should not be built</a></span></dt>
1.1 grant 11380:
11381: <dt><span class="sect2"><a href=
1.38 dillo 11382: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 11383: should not be deleted, once
11384: installed</a></span></dt>
1.1 grant 11385:
11386: <dt><span class="sect2"><a href=
1.38 dillo 11387: "#security-handling">15.1.8. Handling packages with
1.1 grant 11388: security problems</a></span></dt>
11389:
11390: <dt><span class="sect2"><a href=
1.38 dillo 11391: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 11392: bugs</a></span></dt>
11393:
11394: <dt><span class="sect2"><a href=
1.38 dillo 11395: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 11396: incrementing versions when fixing an existing
1.1 grant 11397: package</a></span></dt>
11398:
11399: <dt><span class="sect2"><a href=
1.38 dillo 11400: "#portability-of-packages">15.1.11. Portability of
1.1 grant 11401: packages</a></span></dt>
11402: </dl>
11403: </dd>
11404:
1.30 wiz 11405: <dt><span class="sect1"><a href=
1.38 dillo 11406: "#downloading-issues">15.2. Possible downloading
1.30 wiz 11407: issues</a></span></dt>
1.1 grant 11408:
11409: <dd>
11410: <dl>
11411: <dt><span class="sect2"><a href=
1.38 dillo 11412: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 11413: distfiles aren't available for plain
1.1 grant 11414: downloading</a></span></dt>
11415:
11416: <dt><span class="sect2"><a href=
1.38 dillo 11417: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 11418: handle modified distfiles with the 'old'
11419: name</a></span></dt>
1.1 grant 11420: </dl>
11421: </dd>
11422:
1.30 wiz 11423: <dt><span class="sect1"><a href=
1.38 dillo 11424: "#configuration-gotchas">15.3. Configuration
1.30 wiz 11425: gotchas</a></span></dt>
1.1 grant 11426:
11427: <dd>
11428: <dl>
11429: <dt><span class="sect2"><a href=
1.38 dillo 11430: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 11431: libtool</a></span></dt>
11432:
11433: <dt><span class="sect2"><a href=
1.38 dillo 11434: "#using-libtool">15.3.2. Using libtool on GNU
1.30 wiz 11435: packages that already support
11436: libtool</a></span></dt>
1.1 grant 11437:
11438: <dt><span class="sect2"><a href=
1.38 dillo 11439: "#autoconf-automake">15.3.3. GNU
1.1 grant 11440: Autoconf/Automake</a></span></dt>
11441: </dl>
11442: </dd>
11443:
1.55 rillig 11444: <dt><span class="sect1"><a href="#fixes-build">15.4.
11445: Building the package</a></span></dt>
1.1 grant 11446:
11447: <dd>
11448: <dl>
11449: <dt><span class="sect2"><a href=
1.38 dillo 11450: "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.51 rillig 11451:
11452: <dt><span class="sect2"><a href="#cpp-list">15.4.2.
11453: Getting a list of CPP defines</a></span></dt>
1.1 grant 11454: </dl>
11455: </dd>
11456:
1.30 wiz 11457: <dt><span class="sect1"><a href=
1.38 dillo 11458: "#package-specific-actions">15.5. Package specific
1.30 wiz 11459: actions</a></span></dt>
1.1 grant 11460:
11461: <dd>
11462: <dl>
11463: <dt><span class="sect2"><a href=
1.38 dillo 11464: "#user-interaction">15.5.1. User
1.2 hubertf 11465: interaction</a></span></dt>
1.1 grant 11466:
11467: <dt><span class="sect2"><a href=
1.38 dillo 11468: "#handling-licenses">15.5.2. Handling
1.1 grant 11469: licenses</a></span></dt>
11470:
11471: <dt><span class="sect2"><a href=
1.38 dillo 11472: "#installing-score-files">15.5.3. Installing score
1.1 grant 11473: files</a></span></dt>
11474:
11475: <dt><span class="sect2"><a href=
1.38 dillo 11476: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 11477: scripts</a></span></dt>
11478:
11479: <dt><span class="sect2"><a href=
1.38 dillo 11480: "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30 wiz 11481: paths to other interpreters</a></span></dt>
1.1 grant 11482:
11483: <dt><span class="sect2"><a href=
1.38 dillo 11484: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 11485: modules</a></span></dt>
11486:
11487: <dt><span class="sect2"><a href=
1.38 dillo 11488: "#faq.info-files">15.5.7. Packages installing info
1.1 grant 11489: files</a></span></dt>
11490:
1.57 ! minskim 11491: <dt><span class="sect2"><a href="#manpages">15.5.8.
! 11492: Packages installing man pages</a></span></dt>
! 11493:
1.1 grant 11494: <dt><span class="sect2"><a href=
1.57 ! minskim 11495: "#gconf2-data-files">15.5.9. Packages installing
1.30 wiz 11496: GConf2 data files</a></span></dt>
1.1 grant 11497:
11498: <dt><span class="sect2"><a href=
1.57 ! minskim 11499: "#scrollkeeper-data-files">15.5.10. Packages
1.30 wiz 11500: installing scrollkeeper data files</a></span></dt>
1.1 grant 11501:
11502: <dt><span class="sect2"><a href=
1.57 ! minskim 11503: "#x11-fonts">15.5.11. Packages installing X11
1.1 grant 11504: fonts</a></span></dt>
11505:
11506: <dt><span class="sect2"><a href=
1.57 ! minskim 11507: "#gtk2-modules">15.5.12. Packages installing GTK2
1.1 grant 11508: modules</a></span></dt>
11509:
11510: <dt><span class="sect2"><a href=
1.57 ! minskim 11511: "#sgml-xml-data">15.5.13. Packages installing SGML
1.30 wiz 11512: or XML data</a></span></dt>
1.1 grant 11513:
11514: <dt><span class="sect2"><a href=
1.57 ! minskim 11515: "#mime-database">15.5.14. Packages installing
1.1 grant 11516: extensions to the MIME database</a></span></dt>
11517:
11518: <dt><span class="sect2"><a href=
1.57 ! minskim 11519: "#intltool">15.5.15. Packages using
1.1 grant 11520: intltool</a></span></dt>
1.18 xtraeme 11521:
11522: <dt><span class="sect2"><a href=
1.57 ! minskim 11523: "#startup-scripts">15.5.16. Packages installing
1.30 wiz 11524: startup scripts</a></span></dt>
1.57 ! minskim 11525:
! 11526: <dt><span class="sect2"><a href=
! 11527: "#tex-packages">15.5.17. Packages installing TeX
! 11528: modules</a></span></dt>
1.1 grant 11529: </dl>
11530: </dd>
11531:
1.30 wiz 11532: <dt><span class="sect1"><a href=
1.38 dillo 11533: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 11534: author</a></span></dt>
1.1 grant 11535: </dl>
11536: </div>
11537:
1.57 ! minskim 11538: <div class="sect1" lang="en">
1.1 grant 11539: <div class="titlepage">
11540: <div>
11541: <div>
11542: <h2 class="title" style="clear: both"><a name=
1.38 dillo 11543: "general-operation"></a>15.1. General
1.1 grant 11544: operation</h2>
11545: </div>
11546: </div>
11547: </div>
11548:
1.57 ! minskim 11549: <div class="sect2" lang="en">
1.1 grant 11550: <div class="titlepage">
11551: <div>
11552: <div>
1.30 wiz 11553: <h3 class="title"><a name=
1.38 dillo 11554: "pulling-vars-from-etc-mk.conf"></a>15.1.1. How
1.30 wiz 11555: to pull in variables from /etc/mk.conf</h3>
1.1 grant 11556: </div>
11557: </div>
11558: </div>
11559:
11560: <p>The problem with package-defined variables that can
1.14 xtraeme 11561: be overridden via <code class="varname">MAKECONF</code>
1.45 wiz 11562: or <code xmlns=
11563: "http://www.w3.org/TR/xhtml1/transitional" class=
11564: "filename">/etc/mk.conf</code> is that <a href=
1.1 grant 11565: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
11566: <span class="citerefentry"><span class=
11567: "refentrytitle">make</span>(1)</span></a> expands a
1.47 reed 11568: variable as it is used, but evaluates preprocessor-like
1.1 grant 11569: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 11570: So, to use any variable (which may be set in
1.45 wiz 11571: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11572: class="filename">/etc/mk.conf</code>) in one of the
11573: .if* statements, the file <code xmlns=
11574: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11575: "filename">/etc/mk.conf</code> must be included before
1.1 grant 11576: that .if* statement.</p>
11577:
1.47 reed 11578: <p>Rather than having a number of ad-hoc ways of
1.45 wiz 11579: including <code xmlns=
11580: "http://www.w3.org/TR/xhtml1/transitional" class=
11581: "filename">/etc/mk.conf</code>, should it exist, or
11582: <code class="varname">MAKECONF</code>, should it exist,
11583: include the <code xmlns=
11584: "http://www.w3.org/TR/xhtml1/transitional" class=
11585: "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
11586: package Makefile before any preprocessor-like .if,
11587: .ifdef, or .ifndef statements:</p>
1.1 grant 11588: <pre class="programlisting">
1.51 rillig 11589: .include "../../mk/bsd.prefs.mk"
11590:
1.1 grant 11591: .if defined(USE_MENUS)
1.51 rillig 11592: # ...
1.1 grant 11593: .endif
11594: </pre>
11595:
1.14 xtraeme 11596: <p>If you wish to set the <code class=
1.45 wiz 11597: "varname">CFLAGS</code> variable in <code xmlns=
11598: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 11599: "filename">/etc/mk.conf</code>, please make sure to
1.1 grant 11600: use:</p>
11601: <pre class="programlisting">
1.51 rillig 11602: CFLAGS+= -your -flags
1.1 grant 11603: </pre>
11604:
1.14 xtraeme 11605: <p>Using <code class="varname">CFLAGS=</code> (i.e.
11606: without the “<span class="quote">+</span>”)
11607: may lead to problems with packages that need to add
11608: their own flags. Also, you may want to take a look at
11609: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 11610: href=
11611: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 11612: target="_top"><code xmlns="" class=
11613: "filename">devel/cpuflags</code></a> package if you're
1.20 ben 11614: interested in optimization for the current CPU.</p>
1.1 grant 11615: </div>
11616:
1.57 ! minskim 11617: <div class="sect2" lang="en">
1.1 grant 11618: <div class="titlepage">
11619: <div>
11620: <div>
1.31 wiz 11621: <h3 class="title"><a name=
1.38 dillo 11622: "where-to-install-documentation"></a>15.1.2. Where
1.31 wiz 11623: to install documentation</h3>
11624: </div>
11625: </div>
11626: </div>
11627:
1.45 wiz 11628: <p>Documentation should be installed into <code xmlns=
11629: "http://www.w3.org/TR/xhtml1/transitional" class=
1.31 wiz 11630: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45 wiz 11631: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11632: class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
11633: (the latter includes the version number of the
11634: package).</p>
1.31 wiz 11635: </div>
11636:
1.57 ! minskim 11637: <div class="sect2" lang="en">
1.31 wiz 11638: <div class="titlepage">
11639: <div>
11640: <div>
1.57 ! minskim 11641: <h3 class="title"><a name=
1.38 dillo 11642: "restricted-packages"></a>15.1.3. Restricted
1.1 grant 11643: packages</h3>
11644: </div>
11645: </div>
11646: </div>
11647:
11648: <p>Some licenses restrict how software may be
11649: re-distributed. In order to satisfy these restrictions,
11650: the package system defines five make variables that can
11651: be set to note these restrictions:</p>
11652:
11653: <div class="itemizedlist">
11654: <ul type="disc">
11655: <li>
1.14 xtraeme 11656: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 11657:
11658: <p>This variable should be set whenever a
11659: restriction exists (regardless of its kind). Set
11660: this variable to a string containing the reason
11661: for the restriction.</p>
11662: </li>
11663:
11664: <li>
1.14 xtraeme 11665: <p><code class=
11666: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 11667:
11668: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 11669: variable to <code class=
11670: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11671: package may not be included on a CD-ROM.</p>
11672: </li>
11673:
11674: <li>
1.14 xtraeme 11675: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 11676:
11677: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 11678: Set this variable to <code class=
11679: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11680: package may not not be made available on the
11681: Internet.</p>
11682: </li>
11683:
11684: <li>
1.14 xtraeme 11685: <p><code class=
11686: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 11687:
11688: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 11689: this variable to <code class=
11690: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11691: of the source code or other distfile(s) is not
11692: allowed on CD-ROMs.</p>
11693: </li>
11694:
11695: <li>
1.14 xtraeme 11696: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 11697:
11698: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 11699: variable to <code class=
11700: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11701: of the source code or other distfile(s) via the
11702: Internet is not allowed.</p>
11703: </li>
11704: </ul>
11705: </div>
11706:
1.14 xtraeme 11707: <p>Please note that the use of <code class=
11708: "varname">NO_PACKAGE</code>, <code class=
11709: "varname">IGNORE</code>, <code class=
11710: "varname">NO_CDROM</code>, or other generic make
1.1 grant 11711: variables to denote restrictions is deprecated, because
11712: they unconditionally prevent users from generating
11713: binary packages!</p>
11714: </div>
11715:
1.57 ! minskim 11716: <div class="sect2" lang="en">
1.1 grant 11717: <div class="titlepage">
11718: <div>
11719: <div>
1.57 ! minskim 11720: <h3 class="title"><a name=
1.38 dillo 11721: "dependencies"></a>15.1.4. Handling
1.1 grant 11722: dependencies</h3>
11723: </div>
11724: </div>
11725: </div>
11726:
11727: <p>Your package may depend on some other package being
11728: present - and there are various ways of expressing this
1.14 xtraeme 11729: dependency. pkgsrc supports the <code class=
11730: "varname">BUILD_DEPENDS</code> and <code class=
1.47 reed 11731: "varname">DEPENDS</code> definitions, the <code class=
11732: "varname">USE_TOOLS</code> definition, as well as
1.45 wiz 11733: dependencies via <code xmlns=
11734: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11735: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 11736: way to handle dependencies, and which uses the
11737: variables named above. See <a href="#buildlink" title=
1.38 dillo 11738: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 11739: <i>Buildlink methodology</i></a> for more
11740: information.</p>
11741:
11742: <p>The basic difference between the two variables is as
1.14 xtraeme 11743: follows: The <code class="varname">DEPENDS</code>
1.1 grant 11744: definition registers that pre-requisite in the binary
11745: package so it will be pulled in when the binary package
1.14 xtraeme 11746: is later installed, whilst the <code class=
11747: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 11748: marking a dependency that is only needed for building
11749: the package.</p>
11750:
11751: <p>This means that if you only need a package present
11752: whilst you are building, it should be noted as a
1.14 xtraeme 11753: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 11754:
1.14 xtraeme 11755: <p>The format for a <code class=
11756: "varname">BUILD_DEPENDS</code> and a <code class=
11757: "varname">DEPENDS</code> definition is:</p>
1.1 grant 11758: <pre class="programlisting">
1.51 rillig 11759: <pre-req-package-name>:../../<category>/<pre-req-package>
1.1 grant 11760: </pre>
11761:
11762: <p>Please note that the “<span class=
11763: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 11764: any of the wildcard version numbers recognized by
1.1 grant 11765: <a href=
11766: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11767: <span class="citerefentry"><span class=
11768: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
11769:
11770: <div class="orderedlist">
11771: <ol type="1">
11772: <li>
11773: <p>If your package needs another package's
11774: binaries or libraries to build or run, and if
1.45 wiz 11775: that package has a <code xmlns=
11776: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11777: "filename">buildlink3.mk</code> file available,
11778: use it:</p>
1.1 grant 11779: <pre class="programlisting">
11780: .include "../../graphics/jpeg/buildlink3.mk"
11781: </pre>
11782: </li>
11783:
11784: <li>
11785: <p>If your package needs to use another package
1.45 wiz 11786: to build itself and there is no <code xmlns=
11787: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11788: "filename">buildlink3.mk</code> file available,
11789: use the <code class=
11790: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 11791: <pre class="programlisting">
1.51 rillig 11792: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1 grant 11793: </pre>
11794: </li>
11795:
11796: <li>
11797: <p>If your package needs a library with which to
1.45 wiz 11798: link and again there is no <code xmlns=
11799: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11800: "filename">buildlink3.mk</code> file available,
11801: this is specified using the <code class=
11802: "varname">DEPENDS</code> definition. An example
11803: of this is the <a xmlns=
1.1 grant 11804: "http://www.w3.org/TR/xhtml1/transitional" href=
11805: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 11806: target="_top"><code xmlns="" class=
11807: "filename">print/lyx</code></a> package, which
11808: uses the xpm library, version 3.4j to build:</p>
1.1 grant 11809: <pre class="programlisting">
1.51 rillig 11810: DEPENDS+= xpm-3.4j:../../graphics/xpm
1.1 grant 11811: </pre>
11812:
11813: <p>You can also use wildcards in package
11814: dependences:</p>
11815: <pre class="programlisting">
1.51 rillig 11816: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
1.1 grant 11817: </pre>
11818:
11819: <p>Note that such wildcard dependencies are
11820: retained when creating binary packages. The
11821: dependency is checked when installing the binary
11822: package and any package which matches the pattern
11823: will be used. Wildcard dependencies should be
11824: used with care.</p>
11825:
11826: <p>The “<span class=
11827: "quote">-[0-9]*</span>” should be used
11828: instead of “<span class=
11829: "quote">-*</span>” to avoid potentially
11830: ambiguous matches such as “<span class=
11831: "quote">tk-postgresql</span>” matching a
11832: “<span class="quote">tk-*</span>”
1.14 xtraeme 11833: <code class="varname">DEPENDS</code>.</p>
1.1 grant 11834:
11835: <p>Wildcards can also be used to specify that a
11836: package will only build against a certain minimum
11837: version of a pre-requisite:</p>
11838: <pre class="programlisting">
1.51 rillig 11839: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
1.1 grant 11840: </pre>
11841:
11842: <p>This means that the package will build against
11843: version 3.5.4 of the tiff library or newer. Such
11844: a dependency may be warranted if, for example,
11845: the API of the library has changed with version
11846: 3.5.4 and a package would not compile against an
11847: earlier version of tiff.</p>
11848:
11849: <p>Please note that such dependencies should only
11850: be updated if a package requires a newer
11851: pre-requisite, but not to denote recommendations
11852: such as security updates or ABI changes that do
11853: not prevent a package from building correctly.
11854: Such recommendations can be expressed using
1.14 xtraeme 11855: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 11856: <pre class="programlisting">
1.51 rillig 11857: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
1.1 grant 11858: </pre>
11859:
1.14 xtraeme 11860: <p>In addition to the above <code class=
11861: "varname">DEPENDS</code> line, this denotes that
1.1 grant 11862: while a package will build against
11863: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 11864: recommended. <code class=
11865: "varname">RECOMMENDED</code> entries will be
11866: turned into dependencies unless explicitly
11867: ignored (in which case a warning will be
1.36 wiz 11868: printed).</p>
11869:
11870: <p>To ignore these dependency recommendations and
11871: just use the required <code class=
11872: "varname">DEPENDS</code>, set <code class=
11873: "varname">IGNORE_RECOMMENDED=YES</code>. This may
11874: make it easier and faster to update packages
11875: built using pkgsrc, since older compatible
11876: dependencies can continue to be used. This is
11877: useful for people who watch their rebuilds very
11878: carefully; it is not very good as a
11879: general-purpose hammer. If you use it, you need
11880: to be mindful of possible ABI changes, including
11881: those from the underlying OS.</p>
11882:
11883: <p>Packages that are built with recommendations
11884: ignored may not be uploaded to ftp.NetBSD.org by
11885: developers and should not be used across
11886: different systems that may have different
11887: versions of binary packages installed.</p>
1.1 grant 11888:
11889: <p>For security fixes, please update the package
11890: vulnerabilities file as well as setting
1.14 xtraeme 11891: <code class="varname">RECOMMENDED</code>, see
1.1 grant 11892: <a href="#security-handling" title=
1.38 dillo 11893: "15.1.8. Handling packages with security problems">
1.57 ! minskim 11894: Section 15.1.8, “Handling packages
! 11895: with security problems”</a> for more
1.1 grant 11896: information.</p>
11897: </li>
11898:
11899: <li>
11900: <p>If your package needs some executable to be
1.17 sketch 11901: able to run correctly and if there's no
1.45 wiz 11902: <code xmlns=
11903: "http://www.w3.org/TR/xhtml1/transitional" class=
11904: "filename">buildlink3.mk</code> file, this is
11905: specified using the <code class=
1.14 xtraeme 11906: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 11907: "http://www.w3.org/TR/xhtml1/transitional" href=
11908: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 11909: target="_top"><code xmlns="" class=
11910: "filename">print/lyx</code></a> package needs to
11911: be able to execute the latex binary from the
11912: teTeX package when it runs, and that is
11913: specified:</p>
1.1 grant 11914: <pre class="programlisting">
1.51 rillig 11915: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
1.1 grant 11916: </pre>
11917:
11918: <p>The comment about wildcard dependencies from
11919: previous paragraph applies here, too.</p>
11920: </li>
11921: </ol>
11922: </div>
11923:
11924: <p>If your package needs files from another package to
11925: build, see the first part of the “<span class=
11926: "quote">do-configure</span>” target <a xmlns=
11927: "http://www.w3.org/TR/xhtml1/transitional" href=
11928: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45 wiz 11929: target="_top"><code xmlns="" class=
11930: "filename">print/ghostscript5</code></a> package (it
1.20 ben 11931: relies on the jpeg sources being present in source form
11932: during the build):</p>
1.1 grant 11933: <pre class="programlisting">
1.51 rillig 11934: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
11935: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
1.1 grant 11936: fi
11937: </pre>
11938:
11939: <p>If you build any other packages that way, please
11940: make sure the working files are deleted too when this
11941: package's working files are cleaned up. The easiest way
11942: to do so is by adding a pre-clean target:</p>
11943: <pre class="programlisting">
1.51 rillig 11944: pre-clean:
11945: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
1.1 grant 11946: </pre>
11947:
1.14 xtraeme 11948: <p>Please also note the <code class=
11949: "varname">BUILD_USES_MSGFMT</code> and <code class=
11950: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
11951: which are provided as convenience definitions. The
1.24 wiz 11952: former works out whether <a href=
11953: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
11954: <span class="citerefentry"><span class=
11955: "refentrytitle">msgfmt</span>(1)</span></a> is part of
11956: the base system, and, if it isn't, installs the
11957: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11958: href=
1.1 grant 11959: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45 wiz 11960: target="_top"><code xmlns="" class=
11961: "filename">devel/gettext</code></a> package. The latter
1.20 ben 11962: adds a build dependency on either an installed version
11963: of an older gettext package, or if it isn't, installs
11964: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11965: href=
11966: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45 wiz 11967: target="_top"><code xmlns="" class=
11968: "filename">devel/gettext-m4</code></a> package.</p>
1.1 grant 11969: </div>
11970:
1.57 ! minskim 11971: <div class="sect2" lang="en">
1.1 grant 11972: <div class="titlepage">
11973: <div>
11974: <div>
1.57 ! minskim 11975: <h3 class="title"><a name=
1.38 dillo 11976: "conflicts"></a>15.1.5. Handling conflicts
1.1 grant 11977: with other packages</h3>
11978: </div>
11979: </div>
11980: </div>
11981:
11982: <p>Your package may conflict with other packages a user
11983: might already have installed on his system, e.g. if
11984: your package installs the same set of files like
11985: another package in our pkgsrc tree.</p>
11986:
1.14 xtraeme 11987: <p>In this case you can set <code class=
1.47 reed 11988: "varname">CONFLICTS</code> to a space-separated list of
1.1 grant 11989: packages (including version string) your package
11990: conflicts with.</p>
11991:
1.47 reed 11992: <p>For example, <a xmlns=
1.1 grant 11993: "http://www.w3.org/TR/xhtml1/transitional" href=
11994: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45 wiz 11995: target="_top"><code xmlns="" class=
11996: "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20 ben 11997: "http://www.w3.org/TR/xhtml1/transitional" href=
11998: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45 wiz 11999: target="_top"><code xmlns="" class=
1.47 reed 12000: "filename">x11/Xaw-Xpm</code></a> install the same
12001: shared library, thus you set in <code xmlns=
1.45 wiz 12002: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 12003: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 12004: <pre class="programlisting">
1.51 rillig 12005: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 grant 12006: </pre>
12007:
1.45 wiz 12008: <p>and in <code xmlns=
12009: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12010: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 12011: <pre class="programlisting">
1.51 rillig 12012: CONFLICTS= Xaw3d-[0-9]*
1.1 grant 12013: </pre>
12014:
12015: <p>Packages will automatically conflict with other
12016: packages with the name prefix and a different version
12017: string. “<span class=
12018: "quote">Xaw3d-1.5</span>” e.g. will automatically
12019: conflict with the older version “<span class=
12020: "quote">Xaw3d-1.3</span>”.</p>
12021: </div>
12022:
1.57 ! minskim 12023: <div class="sect2" lang="en">
1.1 grant 12024: <div class="titlepage">
12025: <div>
12026: <div>
1.57 ! minskim 12027: <h3 class="title"><a name=
1.38 dillo 12028: "not-building-packages"></a>15.1.6. Packages
1.30 wiz 12029: that cannot or should not be built</h3>
1.1 grant 12030: </div>
12031: </div>
12032: </div>
12033:
12034: <p>There are several reasons why a package might be
12035: instructed to not build under certain circumstances. If
12036: the package builds and runs on most platforms, the
1.14 xtraeme 12037: exceptions should be noted with <code class=
12038: "varname">NOT_FOR_PLATFORM</code>. If the package
12039: builds and runs on a small handful of platforms, set
12040: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45 wiz 12041: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
12042: <code class="varname">NOT_FOR_PLATFORM</code> are OS
12043: triples (OS-version-platform) that can use glob-style
12044: wildcards.</p>
12045:
12046: <p>If the package should be skipped (for example,
12047: because it provides functionality already provided by
12048: the system), set <code class=
1.14 xtraeme 12049: "varname">PKG_SKIP_REASON</code> to a descriptive
12050: message. If the package should fail because some
12051: preconditions are not met, set <code class=
12052: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 12053: message.</p>
12054: </div>
12055:
1.57 ! minskim 12056: <div class="sect2" lang="en">
1.1 grant 12057: <div class="titlepage">
12058: <div>
12059: <div>
1.57 ! minskim 12060: <h3 class="title"><a name=
1.38 dillo 12061: "undeletable-packages"></a>15.1.7. Packages
1.30 wiz 12062: which should not be deleted, once installed</h3>
1.1 grant 12063: </div>
12064: </div>
12065: </div>
12066:
12067: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 12068: has been installed, the <code class=
12069: "varname">PKG_PRESERVE</code> definition should be set
12070: in the package Makefile. This will be carried into any
1.1 grant 12071: binary package that is made from this pkgsrc entry. A
12072: “<span class="quote">preserved</span>”
12073: package will not be deleted using <a href=
12074: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
12075: <span class="citerefentry"><span class=
12076: "refentrytitle">pkg_delete</span>(1)</span></a> unless
12077: the “<span class="quote">-f</span>” option
12078: is used.</p>
12079: </div>
12080:
1.57 ! minskim 12081: <div class="sect2" lang="en">
1.1 grant 12082: <div class="titlepage">
12083: <div>
12084: <div>
1.57 ! minskim 12085: <h3 class="title"><a name=
1.38 dillo 12086: "security-handling"></a>15.1.8. Handling
1.1 grant 12087: packages with security problems</h3>
12088: </div>
12089: </div>
12090: </div>
12091:
12092: <p>When a vulnerability is found, this should be noted
1.45 wiz 12093: in <code xmlns=
12094: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12095: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43 wiz 12096: and after committing that file, use
12097: <span><strong class="command">make
12098: upload</strong></span> in the same directory to update
12099: the file on ftp.NetBSD.org.</p>
12100:
12101: <p>After fixing the vulnerability by a patch, its
12102: <code class="varname">PKGREVISION</code> should be
12103: increased (this is of course not necessary if the
12104: problem is fixed by using a newer release of the
1.45 wiz 12105: software). In addition, if a <code xmlns=
12106: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12107: "filename">buildlink3.mk</code> file exists for an
1.43 wiz 12108: affected package, a corresponding <code class=
1.14 xtraeme 12109: "varname">BUILDLINK_RECOMMENDED.<em class=
12110: "replaceable"><code>pkg</code></em></code> entry should
1.43 wiz 12111: be added or updated in it.</p>
1.1 grant 12112:
12113: <p>Also, if the fix should be applied to the stable
12114: pkgsrc branch, be sure to submit a pullup request!</p>
1.43 wiz 12115:
12116: <p>Binary packages already on ftp.NetBSD.org will be
12117: handled semi-automatically by a weekly cron job.</p>
1.1 grant 12118: </div>
12119:
1.57 ! minskim 12120: <div class="sect2" lang="en">
1.1 grant 12121: <div class="titlepage">
12122: <div>
12123: <div>
1.57 ! minskim 12124: <h3 class="title"><a name=
1.38 dillo 12125: "compiler-bugs"></a>15.1.9. How to handle
1.1 grant 12126: compiler bugs</h3>
12127: </div>
12128: </div>
12129: </div>
12130:
12131: <p>Some source files trigger bugs in the compiler,
12132: based on combinations of compiler version and
12133: architecture and almost always relation to optimisation
12134: being enabled. Common symptoms are gcc internal errors
12135: or never finishing compiling a file.</p>
12136:
1.47 reed 12137: <p>Typically, a workaround involves testing the
1.14 xtraeme 12138: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 12139: version, disabling optimisation for that
1.14 xtraeme 12140: file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45 wiz 12141: combination, and documenting it in <code xmlns=
12142: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12143: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 12144: number of examples!</p>
12145: </div>
12146:
1.57 ! minskim 12147: <div class="sect2" lang="en">
1.1 grant 12148: <div class="titlepage">
12149: <div>
12150: <div>
1.57 ! minskim 12151: <h3 class="title"><a name=
! 12152: "bumping-pkgrevision"></a>15.1.10. How to
1.30 wiz 12153: handle incrementing versions when fixing an
12154: existing package</h3>
1.1 grant 12155: </div>
12156: </div>
12157: </div>
12158:
12159: <p>When making fixes to an existing package it can be
1.14 xtraeme 12160: useful to change the version number in <code class=
12161: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 12162: future versions by the original author, a
12163: “<span class="quote">nb1</span>”,
12164: “<span class="quote">nb2</span>”, ...
12165: suffix can be used on package versions by setting
1.14 xtraeme 12166: <code class="varname">PKGREVISION=1</code> (2, ...).
12167: The “<span class="quote">nb</span>” is
12168: treated like a “<span class=
12169: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 12170: <pre class="programlisting">
1.51 rillig 12171: DISTNAME= foo-17.42
12172: PKGREVISION= 9
1.1 grant 12173: </pre>
12174:
1.14 xtraeme 12175: <p>will result in a <code class=
12176: "varname">PKGNAME</code> of “<span class=
1.1 grant 12177: "quote">foo-17.42nb9</span>”.</p>
12178:
12179: <p>When a new release of the package is released, the
1.14 xtraeme 12180: <code class="varname">PKGREVISION</code> should be
1.47 reed 12181: removed, e.g. on a new minor release of the above
1.14 xtraeme 12182: package, things should be like:</p>
1.1 grant 12183: <pre class="programlisting">
1.51 rillig 12184: DISTNAME= foo-17.43
1.1 grant 12185: </pre>
12186: </div>
12187:
1.57 ! minskim 12188: <div class="sect2" lang="en">
1.1 grant 12189: <div class="titlepage">
12190: <div>
12191: <div>
1.30 wiz 12192: <h3 class="title"><a name=
1.38 dillo 12193: "portability-of-packages"></a>15.1.11. Portability
1.30 wiz 12194: of packages</h3>
1.1 grant 12195: </div>
12196: </div>
12197: </div>
12198:
12199: <p>One appealing feature of pkgsrc is that it runs on
12200: many different platforms. As a result, it is important
12201: to ensure, where possible, that packages in pkgsrc are
12202: portable. There are some particular details you should
12203: pay attention to while working on pkgsrc.</p>
12204:
1.57 ! minskim 12205: <div class="sect3" lang="en">
1.1 grant 12206: <div class="titlepage">
12207: <div>
12208: <div>
1.57 ! minskim 12209: <h4 class="title"><a name=
1.38 dillo 12210: "install-scripts"></a>15.1.11.1. ${INSTALL},
1.1 grant 12211: ${INSTALL_DATA_DIR}, ...</h4>
12212: </div>
12213: </div>
12214: </div>
12215:
1.14 xtraeme 12216: <p>The BSD-compatible <span><strong class=
12217: "command">install</strong></span> supplied with some
1.1 grant 12218: operating systems will not perform more than one
12219: operation at a time. As such, you should call
12220: “<span class="quote">${INSTALL}</span>”,
12221: etc. like this:</p>
12222: <pre class="programlisting">
1.51 rillig 12223: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
12224: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1 grant 12225: </pre>
12226: </div>
12227: </div>
12228: </div>
12229:
1.57 ! minskim 12230: <div class="sect1" lang="en">
1.1 grant 12231: <div class="titlepage">
12232: <div>
12233: <div>
12234: <h2 class="title" style="clear: both"><a name=
1.38 dillo 12235: "downloading-issues"></a>15.2. Possible
1.1 grant 12236: downloading issues</h2>
12237: </div>
12238: </div>
12239: </div>
12240:
1.57 ! minskim 12241: <div class="sect2" lang="en">
1.1 grant 12242: <div class="titlepage">
12243: <div>
12244: <div>
1.57 ! minskim 12245: <h3 class="title"><a name=
1.38 dillo 12246: "no-plain-download"></a>15.2.1. Packages
1.30 wiz 12247: whose distfiles aren't available for plain
1.1 grant 12248: downloading</h3>
12249: </div>
12250: </div>
12251: </div>
12252:
12253: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 12254: set <code class="varname">DYNAMIC_MASTER_SITES</code>
12255: and a <span><strong class="command">make
1.45 wiz 12256: fetch</strong></span> will call <code xmlns=
12257: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12258: "filename">files/getsite.sh</code> with the name of
12259: each file to download as an argument, expecting it to
12260: output the URL of the directory from which to download
12261: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12262: href=
1.1 grant 12263: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45 wiz 12264: target="_top"><code xmlns="" class=
12265: "filename">graphics/ns-cult3d</code></a> is an example
12266: of this usage.</p>
1.1 grant 12267:
12268: <p>If the download can't be automated, because the user
12269: must submit personal information to apply for a
12270: password, or must pay for the source, or whatever, you
1.14 xtraeme 12271: can set <code class="varname">_FETCH_MESSAGE</code> to
12272: a macro which displays a message explaining the
12273: situation. <code class="varname">_FETCH_MESSAGE</code>
12274: must be executable shell commands, not just a message.
12275: (Generally, it executes <code class=
12276: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 12277: following packages use this: <a xmlns=
12278: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 12279: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45 wiz 12280: target="_top"><code xmlns="" class=
12281: "filename">cad/simian</code></a>, <a xmlns=
1.20 ben 12282: "http://www.w3.org/TR/xhtml1/transitional" href=
12283: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45 wiz 12284: target="_top"><code xmlns="" class=
12285: "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20 ben 12286: "http://www.w3.org/TR/xhtml1/transitional" href=
12287: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45 wiz 12288: target="_top"><code xmlns="" class=
12289: "filename">emulators/vmware-module</code></a>,
12290: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12291: href=
1.20 ben 12292: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45 wiz 12293: target="_top"><code xmlns="" class=
12294: "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20 ben 12295: "http://www.w3.org/TR/xhtml1/transitional" href=
1.43 wiz 12296: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45 wiz 12297: target="_top"><code xmlns="" class=
12298: "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43 wiz 12299: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 12300: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45 wiz 12301: target="_top"><code xmlns="" class=
12302: "filename">sysutils/storage-manager</code></a>,
12303: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12304: href=
1.20 ben 12305: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45 wiz 12306: target="_top"><code xmlns="" class=
12307: "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20 ben 12308: "http://www.w3.org/TR/xhtml1/transitional" href=
12309: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45 wiz 12310: target="_top"><code xmlns="" class=
12311: "filename">www/openacs</code></a>. Try to be consistent
1.20 ben 12312: with them.</p>
1.1 grant 12313: </div>
12314:
1.57 ! minskim 12315: <div class="sect2" lang="en">
1.1 grant 12316: <div class="titlepage">
12317: <div>
12318: <div>
1.30 wiz 12319: <h3 class="title"><a name=
1.38 dillo 12320: "modified-distfiles-same-name"></a>15.2.2. How
1.30 wiz 12321: to handle modified distfiles with the 'old'
12322: name</h3>
1.1 grant 12323: </div>
12324: </div>
12325: </div>
12326:
12327: <p>Sometimes authors of a software package make some
12328: modifications after the software was released, and they
12329: put up a new distfile without changing the package's
12330: version number. If a package is already in pkgsrc at
1.32 wiz 12331: that time, the checksum will no longer match. The
12332: contents of the new distfile should be compared against
12333: the old one before changing anything, to make sure the
12334: distfile was really updated on purpose, and that no
12335: trojan horse or so crept in. Then, the correct way to
12336: work around this is to set <code class=
12337: "varname">DIST_SUBDIR</code> to a unique directory
12338: name, usually based on <code class=
12339: "varname">PKGNAME_NOREV</code>. In case this happens
12340: more often, <code class="varname">PKGNAME</code> can be
1.45 wiz 12341: used (thus including the <code xmlns=
12342: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 12343: "filename">nbX</code> suffix) or a date stamp can be
12344: appended, like <code class=
12345: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45 wiz 12346: forget regenerating the <code xmlns=
12347: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 12348: "filename">distinfo</code> file after that, since it
12349: contains the <code class="varname">DIST_SUBDIR</code>
12350: path in the filenames. Furthermore, a mail to the
12351: package's authors seems appropriate telling them that
12352: changing distfiles after releases without changing the
12353: file names is not good practice.</p>
1.1 grant 12354: </div>
12355: </div>
12356:
1.57 ! minskim 12357: <div class="sect1" lang="en">
1.1 grant 12358: <div class="titlepage">
12359: <div>
12360: <div>
12361: <h2 class="title" style="clear: both"><a name=
1.38 dillo 12362: "configuration-gotchas"></a>15.3. Configuration
1.1 grant 12363: gotchas</h2>
12364: </div>
12365: </div>
12366: </div>
12367:
1.57 ! minskim 12368: <div class="sect2" lang="en">
1.1 grant 12369: <div class="titlepage">
12370: <div>
12371: <div>
1.57 ! minskim 12372: <h3 class="title"><a name=
1.38 dillo 12373: "fixes.libtool"></a>15.3.1. Shared libraries
1.1 grant 12374: - libtool</h3>
12375: </div>
12376: </div>
12377: </div>
12378:
12379: <p>pkgsrc supports many different machines, with
12380: different object formats like a.out and ELF, and
12381: varying abilities to do shared library and dynamic
12382: loading at all. To accompany this, varying commands and
12383: options have to be passed to the compiler, linker, etc.
12384: to get the Right Thing, which can be pretty annoying
12385: especially if you don't have all the machines at your
12386: hand to test things. The <a xmlns=
12387: "http://www.w3.org/TR/xhtml1/transitional" href=
12388: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45 wiz 12389: target="_top"><code xmlns="" class=
12390: "filename">devel/libtool</code></a> pkg can help here,
12391: as it just “<span class=
12392: "quote">knows</span>” how to build both static
12393: and dynamic libraries from a set of source files, thus
1.47 reed 12394: being platform-independent.</p>
1.1 grant 12395:
12396: <p>Here's how to use libtool in a pkg in seven simple
12397: steps:</p>
12398:
12399: <div class="orderedlist">
12400: <ol type="1">
12401: <li>
1.14 xtraeme 12402: <p>Add <code class=
12403: "varname">USE_LIBTOOL=yes</code> to the package
12404: Makefile.</p>
1.1 grant 12405: </li>
12406:
12407: <li>
12408: <p>For library objects, use “<span class=
12409: "quote">${LIBTOOL} --mode=compile
12410: ${CC}</span>” in place of
12411: “<span class="quote">${CC}</span>”.
12412: You could even add it to the definition of
1.14 xtraeme 12413: <code class="varname">CC</code>, if only
12414: libraries are being built in a given Makefile.
12415: This one command will build both PIC and non-PIC
12416: library objects, so you need not have separate
12417: shared and non-shared library rules.</p>
1.1 grant 12418: </li>
12419:
12420: <li>
12421: <p>For the linking of the library, remove any
12422: “<span class="quote">ar</span>”,
12423: “<span class="quote">ranlib</span>”,
12424: and “<span class="quote">ld
12425: -Bshareable</span>” commands, and instead
12426: use:</p>
12427: <pre class="programlisting">
1.51 rillig 12428: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
12429: -rpath ${PREFIX}/lib -version-info major:minor
1.1 grant 12430: </pre>
12431:
12432: <p>Note that the library is changed to have a
1.45 wiz 12433: <code xmlns=
12434: "http://www.w3.org/TR/xhtml1/transitional" class=
12435: "filename">.la</code> extension, and the objects
12436: are changed to have a <code xmlns=
12437: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12438: "filename">.lo</code> extension. Change
12439: <code class="varname">OBJS</code> as necessary.
12440: This automatically creates all of the
1.45 wiz 12441: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12442: class="filename">.a</code>, <code xmlns=
12443: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12444: "filename">.so.major.minor</code>, and ELF
12445: symlinks (if necessary) in the build directory.
12446: Be sure to include “<span class=
1.1 grant 12447: "quote">-version-info</span>”, especially
12448: when major and minor are zero, as libtool will
12449: otherwise strip off the shared library
12450: version.</p>
12451:
12452: <p>From the libtool manual:</p>
12453: <pre class="programlisting">
1.51 rillig 12454: So, libtool library versions are described by three integers:
1.1 grant 12455:
1.51 rillig 12456: CURRENT
12457: The most recent interface number that this library implements.
1.1 grant 12458:
1.51 rillig 12459: REVISION
12460: The implementation number of the CURRENT interface.
1.1 grant 12461:
1.51 rillig 12462: AGE
12463: The difference between the newest and oldest interfaces that
12464: this library implements. In other words, the library implements
12465: all the interface numbers in the range from number `CURRENT -
12466: AGE' to `CURRENT'.
1.1 grant 12467:
1.51 rillig 12468: If two libraries have identical CURRENT and AGE numbers, then the
12469: dynamic linker chooses the library with the greater REVISION number.
1.1 grant 12470: </pre>
12471:
12472: <p>The “<span class=
12473: "quote">-release</span>” option will
12474: produce different results for a.out and ELF
12475: (excluding symlinks) in only one case. An ELF
12476: library of the form “<span class=
12477: "quote">libfoo-release.so.<span class=
12478: "emphasis"><em>x</em></span>.<span class=
12479: "emphasis"><em>y</em></span></span>” will
12480: have a symlink of “<span class=
12481: "quote">libfoo.so.<span class=
12482: "emphasis"><em>x</em></span>.<span class=
12483: "emphasis"><em>y</em></span></span>” on an
12484: a.out platform. This is handled
12485: automatically.</p>
12486:
12487: <p>The “<span class="quote">-rpath
12488: argument</span>” is the install directory
12489: of the library being built.</p>
12490:
1.45 wiz 12491: <p>In the <code xmlns=
12492: "http://www.w3.org/TR/xhtml1/transitional" class=
12493: "filename">PLIST</code>, include only the
12494: <code xmlns=
12495: "http://www.w3.org/TR/xhtml1/transitional" class=
1.19 hubertf 12496: "filename">.la</code> file, the other files will
12497: be added automatically.</p>
1.1 grant 12498: </li>
12499:
12500: <li>
1.45 wiz 12501: <p>When linking shared object (<code xmlns=
12502: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12503: "filename">.so</code>) files, i.e. files that are
1.24 wiz 12504: loaded via <a href=
12505: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
12506: <span class="citerefentry"><span class=
12507: "refentrytitle">dlopen</span>(3)</span></a>, NOT
12508: shared libraries, use “<span class=
12509: "quote">-module -avoid-version</span>” to
12510: prevent them getting version tacked on.</p>
1.1 grant 12511:
1.45 wiz 12512: <p>The <code xmlns=
12513: "http://www.w3.org/TR/xhtml1/transitional" class=
12514: "filename">PLIST</code> file gets the
12515: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12516: class="filename">foo.so</code> entry.</p>
1.1 grant 12517: </li>
12518:
12519: <li>
12520: <p>When linking programs that depend on these
12521: libraries <span class=
12522: "emphasis"><em>before</em></span> they are
12523: installed, preface the <a href=
12524: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
12525: <span class="citerefentry"><span class=
12526: "refentrytitle">cc</span>(1)</span></a> or
12527: <a href=
12528: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
12529: <span class="citerefentry"><span class=
12530: "refentrytitle">ld</span>(1)</span></a> line with
12531: “<span class="quote">${LIBTOOL}
12532: --mode=link</span>”, and it will find the
12533: correct libraries (static or shared), but please
12534: be aware that libtool will not allow you to
12535: specify a relative path in -L (such as
12536: “<span class=
12537: "quote">-L../somelib</span>”), because it
12538: expects you to change that argument to be the
1.45 wiz 12539: <code xmlns=
12540: "http://www.w3.org/TR/xhtml1/transitional" class=
12541: "filename">.la</code> file. e.g.</p>
1.1 grant 12542: <pre class="programlisting">
1.51 rillig 12543: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1 grant 12544: </pre>
12545:
12546: <p>should be changed to:</p>
12547: <pre class="programlisting">
1.51 rillig 12548: ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14 xtraeme 12549: "replaceable"><code>someprog</code></em> <em class=
12550: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 12551: </pre>
12552:
12553: <p>and it will do the right thing with the
12554: libraries.</p>
12555: </li>
12556:
12557: <li>
12558: <p>When installing libraries, preface the
12559: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
12560: <span class="citerefentry"><span class=
12561: "refentrytitle">install</span>(1)</span></a> or
12562: <a href=
12563: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
12564: <span class="citerefentry"><span class=
12565: "refentrytitle">cp</span>(1)</span></a> command
12566: with “<span class="quote">${LIBTOOL}
12567: --mode=install</span>”, and change the
1.45 wiz 12568: library name to <code xmlns=
12569: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12570: "filename">.la</code>. e.g.</p>
1.1 grant 12571: <pre class="programlisting">
1.51 rillig 12572: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 grant 12573: </pre>
12574:
1.45 wiz 12575: <p>This will install the static <code xmlns=
12576: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12577: "filename">.a</code>, shared library, any needed
1.1 grant 12578: symlinks, and run <a href=
12579: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
12580: <span class="citerefentry"><span class=
12581: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
12582: </li>
12583:
12584: <li>
1.45 wiz 12585: <p>In your <code xmlns=
12586: "http://www.w3.org/TR/xhtml1/transitional" class=
12587: "filename">PLIST</code>, include only the
12588: <code xmlns=
12589: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 12590: "filename">.la</code> file (this is a change from
12591: previous behaviour).</p>
1.1 grant 12592: </li>
12593: </ol>
12594: </div>
12595: </div>
12596:
1.57 ! minskim 12597: <div class="sect2" lang="en">
1.1 grant 12598: <div class="titlepage">
12599: <div>
12600: <div>
1.57 ! minskim 12601: <h3 class="title"><a name=
1.38 dillo 12602: "using-libtool"></a>15.3.2. Using libtool on
1.30 wiz 12603: GNU packages that already support libtool</h3>
1.1 grant 12604: </div>
12605: </div>
12606: </div>
12607:
1.14 xtraeme 12608: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
12609: the package Makefile. This will override the package's
12610: own libtool in most cases. For older libtool using
1.1 grant 12611: packages, libtool is made by ltconfig script during the
12612: do-configure step; you can check the libtool script
1.14 xtraeme 12613: location by doing <span><strong class="command">make
12614: configure; find work*/ -name
12615: libtool</strong></span>.</p>
12616:
12617: <p><code class="varname">LIBTOOL_OVERRIDE</code>
12618: specifies which libtool scripts, relative to
12619: <code class="varname">WRKSRC</code>, to override. By
12620: default, it is set to “<span class=
12621: "quote">libtool */libtool */*/libtool</span>”. If
12622: this does not match the location of the package's
12623: libtool script(s), set it as appropriate.</p>
1.13 hubertf 12624:
1.45 wiz 12625: <p>If you do not need <code xmlns=
12626: "http://www.w3.org/TR/xhtml1/transitional" class=
12627: "filename">*.a</code> static libraries built and
12628: installed, then use <code class=
12629: "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1 grant 12630:
1.47 reed 12631: <p>If your package makes use of the
12632: platform-independent library for loading dynamic shared
12633: objects, that comes with libtool (libltdl), you should
12634: include devel/libltdl/buildlink3.mk.</p>
1.1 grant 12635:
12636: <p>Some packages use libtool incorrectly so that the
12637: package may not work or build in some circumstances.
12638: Some of the more common errors are:</p>
12639:
12640: <div class="itemizedlist">
12641: <ul type="disc">
12642: <li>
12643: <p>The inclusion of a shared object (-module) as
12644: a dependent library in an executable or library.
12645: This in itself isn't a problem if one of two
12646: things has been done:</p>
12647:
12648: <div class="orderedlist">
12649: <ol type="1">
12650: <li>
12651: <p>The shared object is named correctly,
1.45 wiz 12652: i.e. <code xmlns=
12653: "http://www.w3.org/TR/xhtml1/transitional"
12654: class="filename">libfoo.la</code>, not
12655: <code xmlns=
12656: "http://www.w3.org/TR/xhtml1/transitional"
12657: class="filename">foo.la</code></p>
1.1 grant 12658: </li>
12659:
12660: <li>
12661: <p>The -dlopen option is used when linking
12662: an executable.</p>
12663: </li>
12664: </ol>
12665: </div>
12666: </li>
12667:
12668: <li>
12669: <p>The use of libltdl without the correct calls
12670: to initialisation routines. The function
12671: lt_dlinit() should be called and the macro
1.14 xtraeme 12672: <code class=
12673: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 12674: included in executables.</p>
12675: </li>
12676: </ul>
12677: </div>
12678: </div>
12679:
1.57 ! minskim 12680: <div class="sect2" lang="en">
1.1 grant 12681: <div class="titlepage">
12682: <div>
12683: <div>
1.57 ! minskim 12684: <h3 class="title"><a name=
1.38 dillo 12685: "autoconf-automake"></a>15.3.3. GNU
1.1 grant 12686: Autoconf/Automake</h3>
12687: </div>
12688: </div>
12689: </div>
12690:
12691: <p>If a package needs GNU autoconf or automake to be
12692: executed to regenerate the configure script and
12693: Makefile.in makefile templates, then they should be
1.35 jmmv 12694: executed in a pre-configure target.</p>
1.1 grant 12695:
12696: <p>For packages that need only autoconf:</p>
12697: <pre class="programlisting">
1.51 rillig 12698: AUTOCONF_REQD= 2.50 # if default version is not good enough
12699: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
12700: ...
1.1 grant 12701:
1.51 rillig 12702: pre-configure:
12703: cd ${WRKSRC}; autoconf
1.1 grant 12704:
1.51 rillig 12705: ...
1.1 grant 12706: </pre>
12707:
12708: <p>and for packages that need automake and
12709: autoconf:</p>
12710: <pre class="programlisting">
1.51 rillig 12711: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
12712: USE_TOOLS+= automake # use "automake14" for automake-1.4
12713: ...
1.1 grant 12714:
1.51 rillig 12715: pre-configure:
12716: cd ${WRKSRC}; \
12717: aclocal; autoheader; \
12718: automake -a --foreign -i; autoconf
12719:
12720: ...
1.1 grant 12721: </pre>
12722:
12723: <p>Packages which use GNU Automake will almost
1.35 jmmv 12724: certainly require GNU Make.</p>
1.1 grant 12725:
12726: <p>There are times when the configure process makes
12727: additional changes to the generated files, which then
12728: causes the build process to try to re-execute the
12729: automake sequence. This is prevented by touching
12730: various files in the configure stage. If this causes
1.14 xtraeme 12731: problems with your package you can set <code class=
12732: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 12733: Makefile.</p>
12734: </div>
12735: </div>
12736:
1.57 ! minskim 12737: <div class="sect1" lang="en">
1.1 grant 12738: <div class="titlepage">
12739: <div>
12740: <div>
12741: <h2 class="title" style="clear: both"><a name=
1.55 rillig 12742: "fixes-build"></a>15.4. Building the
12743: package</h2>
1.1 grant 12744: </div>
12745: </div>
12746: </div>
12747:
1.57 ! minskim 12748: <div class="sect2" lang="en">
1.1 grant 12749: <div class="titlepage">
12750: <div>
12751: <div>
1.57 ! minskim 12752: <h3 class="title"><a name=
1.38 dillo 12753: "cpp-defines"></a>15.4.1. CPP defines</h3>
1.1 grant 12754: </div>
12755: </div>
12756: </div>
12757:
1.55 rillig 12758: <p>Sometimes you need to compile different code
12759: depending on the target platform. The C preprocessor
12760: has a set of predefined macros that can be queried by
12761: using <code class="varname">#ifdef FOO</code> or
12762: <code class="varname">#if defined(FOO)</code>. Among
12763: these macros are usually ones that describe the target
12764: CPU and operating system. Depending of which of the
12765: macros are defined, you can write code that uses
12766: features unique to a specific platform. The best way to
12767: handle these differences is to use the GNU autotools
12768: (automake, autoconf, etc.) to check for specific
12769: features (like the existence of a header file, a
12770: function or a library).</p>
12771:
12772: <p>If that is not possible you can use the predefined
12773: macros below to configure your code to the platform it
12774: runs on. Almost every operating system, hardware
12775: architecture and compiler has its own macro. For
12776: example, if the macros <code class=
12777: "varname">__GNUC__</code>, <code class=
12778: "varname">__i386__</code> and <code class=
12779: "varname">__NetBSD__</code> are all defined, you know
12780: that you are using NetBSD on an Intel CPU, and your
12781: compiler is GCC.</p>
12782:
1.57 ! minskim 12783: <div class="sect3" lang="en">
1.55 rillig 12784: <div class="titlepage">
12785: <div>
12786: <div>
12787: <h4 class="title"><a name=
12788: "fixes-build-cpp-opsys"></a>15.4.1.1. CPP
12789: defines for operating systems</h4>
12790: </div>
12791: </div>
12792: </div>
12793:
12794: <p>To distinguish between 4.4 BSD-derived systems and
12795: the rest of the world, you should use the following
12796: code.</p>
12797: <pre class="programlisting">
1.51 rillig 12798: #include <sys/param.h>
1.55 rillig 12799: #if (defined(BSD) && BSD >= 199306)
12800: /* your BSD-specific code goes here */
12801: #else
12802: /* non-BSD-specific code */
12803: #endif
1.1 grant 12804: </pre>
12805:
1.55 rillig 12806: <p>If this distinction is not fine enough, you can
12807: also use the following defines.</p>
12808: <pre class="programlisting">
12809: FreeBSD __FreeBSD__
1.56 rillig 12810: DragonFly __DragonFly__
1.57 ! minskim 12811: Interix __INTERIX
1.55 rillig 12812: Linux linux, __linux, __linux__
12813: NetBSD __NetBSD__
12814: OpenBSD __OpenBSD__
12815: Solaris sun, __sun (GCC and SunPro), __sun__ (only GCC)
1.1 grant 12816: </pre>
1.55 rillig 12817: </div>
1.1 grant 12818:
1.57 ! minskim 12819: <div class="sect3" lang="en">
1.55 rillig 12820: <div class="titlepage">
12821: <div>
12822: <div>
1.57 ! minskim 12823: <h4 class="title"><a name=
! 12824: "fixes-build-cpp-cpu"></a>15.4.1.2. CPP
1.55 rillig 12825: defines for CPUs</h4>
12826: </div>
12827: </div>
12828: </div>
12829: <pre class="programlisting">
12830: i386 i386, __i386, __i386__
12831: MIPS __mips
12832: SPARC sparc, __sparc
12833: </pre>
12834: </div>
12835:
1.57 ! minskim 12836: <div class="sect3" lang="en">
1.55 rillig 12837: <div class="titlepage">
12838: <div>
12839: <div>
12840: <h4 class="title"><a name=
12841: "fixes-build-cpp-compiler"></a>15.4.1.3. CPP
12842: defines for compilers</h4>
12843: </div>
12844: </div>
12845: </div>
12846: <pre class="programlisting">
12847: GCC __GNUC__ (major version), __GNUC_MINOR__
12848: </pre>
12849: </div>
1.1 grant 12850: </div>
1.51 rillig 12851:
1.57 ! minskim 12852: <div class="sect2" lang="en">
1.51 rillig 12853: <div class="titlepage">
12854: <div>
12855: <div>
1.57 ! minskim 12856: <h3 class="title"><a name=
1.51 rillig 12857: "cpp-list"></a>15.4.2. Getting a list of CPP
12858: defines</h3>
12859: </div>
12860: </div>
12861: </div>
12862:
12863: <p>When your system uses the GNU C Compiler, you can
12864: get a list of symbols that are defined by default, e.g.
12865: to identify the platform, with the following
12866: command:</p>
12867: <pre class="programlisting">
12868: gcc -E -dM - < /dev/null
12869: </pre>
12870: </div>
1.1 grant 12871: </div>
12872:
1.57 ! minskim 12873: <div class="sect1" lang="en">
1.1 grant 12874: <div class="titlepage">
12875: <div>
12876: <div>
12877: <h2 class="title" style="clear: both"><a name=
1.38 dillo 12878: "package-specific-actions"></a>15.5. Package
1.1 grant 12879: specific actions</h2>
12880: </div>
12881: </div>
12882: </div>
12883:
1.57 ! minskim 12884: <div class="sect2" lang="en">
1.1 grant 12885: <div class="titlepage">
12886: <div>
12887: <div>
1.57 ! minskim 12888: <h3 class="title"><a name=
1.38 dillo 12889: "user-interaction"></a>15.5.1. User
1.2 hubertf 12890: interaction</h3>
1.1 grant 12891: </div>
12892: </div>
12893: </div>
12894:
12895: <p>Occasionally, packages require interaction from the
12896: user, and this can be in a number of ways:</p>
12897:
12898: <div class="itemizedlist">
12899: <ul type="disc">
12900: <li>
12901: <p>help in fetching the distfiles</p>
12902: </li>
12903:
12904: <li>
12905: <p>help to configure the package before it is
12906: built</p>
12907: </li>
12908:
12909: <li>
12910: <p>help during the build process</p>
12911: </li>
12912:
12913: <li>
12914: <p>help during the installation of a package</p>
12915: </li>
12916: </ul>
12917: </div>
12918:
1.14 xtraeme 12919: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 12920: definition is provided to notify the pkgsrc mechanism
12921: of an interactive stage which will be needed, and this
1.45 wiz 12922: should be set in the package's <code xmlns=
12923: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 12924: "filename">Makefile</code>, e.g.:</p>
1.1 grant 12925: <pre class="programlisting">
1.51 rillig 12926: INTERACTIVE_STAGE= build
1.1 grant 12927: </pre>
12928:
12929: <p>Multiple interactive stages can be specified:</p>
12930: <pre class="programlisting">
1.51 rillig 12931: INTERACTIVE_STAGE= configure install
1.1 grant 12932: </pre>
12933: </div>
12934:
1.57 ! minskim 12935: <div class="sect2" lang="en">
1.1 grant 12936: <div class="titlepage">
12937: <div>
12938: <div>
1.57 ! minskim 12939: <h3 class="title"><a name=
1.38 dillo 12940: "handling-licenses"></a>15.5.2. Handling
1.1 grant 12941: licenses</h3>
12942: </div>
12943: </div>
12944: </div>
12945:
1.44 gdt 12946: <p>A package may be covered by a license which the user
12947: has or has not agreed to accept. For these cases,
12948: pkgsrc contains a mechanism to note that a package is
12949: covered by a particular license, and the package cannot
12950: be built unless the user has accepted the license.
12951: (Installation of binary packages are not currently
12952: subject to this mechanism.) Packages with licenses that
12953: are either Open Source according to the Open Source
12954: Initiative or Free according to the Free Software
12955: Foundation will not be marked with a license tag.
12956: Packages with licenses that have not been determined to
12957: meet either definition will be marked with a license
12958: tag referring to the license. This will prevent
12959: building unless pkgsrc is informed that the license is
12960: acceptable, and enables displaying the license.</p>
12961:
12962: <p>The license tag mechanism is intended to address
12963: copyright-related issues surrounding building,
12964: installing and using a package, and not to address
12965: redistribution issues (see <code class=
12966: "varname">RESTRICTED</code> and <code class=
12967: "varname">NO_SRC_ON_FTP</code>, etc.). However, the
12968: above definition of licenses for which tags are not
12969: needed implies that packages with redistribution
12970: restrictions should have tags.</p>
12971:
12972: <p>Denoting that a package is covered by a particular
1.45 wiz 12973: license is done by placing the license in <code xmlns=
12974: "http://www.w3.org/TR/xhtml1/transitional" class=
1.44 gdt 12975: "filename">pkgsrc/licenses</code> and setting the
12976: <code class="varname">LICENSE</code> variable to a
12977: string identifying the license, e.g. in <a xmlns=
1.14 xtraeme 12978: "http://www.w3.org/TR/xhtml1/transitional" href=
1.44 gdt 12979: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45 wiz 12980: target="_top"><code xmlns="" class=
12981: "filename">graphics/xv</code></a>:</p>
1.1 grant 12982: <pre class="programlisting">
1.51 rillig 12983: LICENSE= xv-license
1.1 grant 12984: </pre>
12985:
12986: <p>When trying to build, the user will get a notice
1.44 gdt 12987: that the package is covered by a license which has not
12988: been accepted:</p>
1.1 grant 12989: <pre class="programlisting">
1.51 rillig 12990: <code class="prompt">%</code> <strong class=
1.14 xtraeme 12991: "userinput"><code>make</code></strong>
1.51 rillig 12992: ===> xv-3.10anb9 has an unacceptable license: xv-license.
12993: ===> To view the license, enter "/usr/bin/make show-license".
12994: ===> To indicate acceptance, add this line to your /etc/mk.conf:
12995: ===> ACCEPTABLE_LICENSES+=xv-license
12996: *** Error code 1
1.1 grant 12997: </pre>
12998:
1.14 xtraeme 12999: <p>The license can be viewed with <span><strong class=
13000: "command">make show-license</strong></span>, and if it
13001: is considered appropriate, the line printed above can
1.45 wiz 13002: be added to <code xmlns=
13003: "http://www.w3.org/TR/xhtml1/transitional" class=
13004: "filename">/etc/mk.conf</code> to indicate acceptance
13005: of the particular license:</p>
1.1 grant 13006: <pre class="programlisting">
1.51 rillig 13007: ACCEPTABLE_LICENSES+=xv-license
1.1 grant 13008: </pre>
13009:
13010: <p>When adding a package with a new license, the
1.45 wiz 13011: license text should be added to <code xmlns=
13012: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13013: "filename">pkgsrc/licenses</code> for displaying. A
13014: list of known licenses can be seen in this directory as
13015: well as by looking at the list of (commented out)
13016: <code class="varname">ACCEPTABLE_LICENSES</code>
1.45 wiz 13017: variable settings in <code xmlns=
13018: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13019: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 13020:
1.44 gdt 13021: <p>The use of <code class=
13022: "varname">LICENSE=shareware</code>, <code class=
13023: "varname">LICENSE=no-commercial-use</code>, and similar
13024: language is deprecated because it does not crisply
13025: refer to a particular license text. Another problem
13026: with such usage is that it does not enable a user to
13027: denote acceptance of the license for a single package
13028: without accepting the same license text for another
13029: package. In particular, this can be inappropriate when
13030: e.g. one accepts a particular license to indicate to
13031: pkgsrc that a fee has been paid.</p>
1.1 grant 13032: </div>
13033:
1.57 ! minskim 13034: <div class="sect2" lang="en">
1.1 grant 13035: <div class="titlepage">
13036: <div>
13037: <div>
1.30 wiz 13038: <h3 class="title"><a name=
1.38 dillo 13039: "installing-score-files"></a>15.5.3. Installing
1.30 wiz 13040: score files</h3>
1.1 grant 13041: </div>
13042: </div>
13043: </div>
13044:
13045: <p>Certain packages, most of them in the games
13046: category, install a score file that allows all users on
13047: the system to record their highscores. In order for
13048: this to work, the binaries need to be installed setgid
13049: and the score files owned by the appropriate group
13050: and/or owner (traditionally the "games" user/group).
13051: The following variables, documented in more detail in
1.45 wiz 13052: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13053: class="filename">mk/defaults/mk.conf</code>, control
13054: this behaviour: <code class=
1.14 xtraeme 13055: "varname">SETGIDGAME</code>, <code class=
13056: "varname">GAMEDATAMODE</code>, <code class=
13057: "varname">GAMEGRP</code>, <code class=
13058: "varname">GAMEMODE</code>, <code class=
13059: "varname">GAMEOWN</code>.</p>
1.1 grant 13060:
13061: <p>Note that per default, setgid installation of games
1.14 xtraeme 13062: is disabled; setting <code class=
13063: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 13064: variables accordingly.</p>
13065:
13066: <p>A package should therefor never hard code file
1.14 xtraeme 13067: ownership or access permissions but rely on
13068: <code class="varname">INSTALL_GAME</code> and
13069: <code class="varname">INSTALL_GAME_DATA</code> to set
13070: these correctly.</p>
1.1 grant 13071: </div>
13072:
1.57 ! minskim 13073: <div class="sect2" lang="en">
1.1 grant 13074: <div class="titlepage">
13075: <div>
13076: <div>
1.57 ! minskim 13077: <h3 class="title"><a name=
1.38 dillo 13078: "perl-scripts"></a>15.5.4. Packages
1.30 wiz 13079: containing perl scripts</h3>
1.1 grant 13080: </div>
13081: </div>
13082: </div>
13083:
13084: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 13085: set <code class="varname">REPLACE_PERL</code> to ensure
13086: that the proper interpreter path is set. <code class=
13087: "varname">REPLACE_PERL</code> should contain a list of
13088: scripts, relative to <code class=
13089: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 13090: </div>
13091:
1.57 ! minskim 13092: <div class="sect2" lang="en">
1.1 grant 13093: <div class="titlepage">
13094: <div>
13095: <div>
1.57 ! minskim 13096: <h3 class="title"><a name=
1.38 dillo 13097: "hardcoded-paths"></a>15.5.5. Packages with
1.1 grant 13098: hardcoded paths to other interpreters</h3>
13099: </div>
13100: </div>
13101: </div>
13102:
13103: <p>Your package may also contain scripts with hardcoded
13104: paths to other interpreters besides (or as well as)
13105: perl. To correct the full pathname to the script
13106: interpreter, you need to set the following definitions
1.45 wiz 13107: in your <code xmlns=
13108: "http://www.w3.org/TR/xhtml1/transitional" class=
13109: "filename">Makefile</code> (we shall use
13110: <span><strong class="command">tclsh</strong></span> in
13111: this example):</p>
1.1 grant 13112: <pre class="programlisting">
1.51 rillig 13113: REPLACE_INTERPRETER+= tcl
13114: _REPLACE.tcl.old= .*/bin/tclsh
13115: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
13116: _REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
13117: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1 grant 13118: </pre>
13119: </div>
13120:
1.57 ! minskim 13121: <div class="sect2" lang="en">
1.1 grant 13122: <div class="titlepage">
13123: <div>
13124: <div>
1.57 ! minskim 13125: <h3 class="title"><a name=
1.38 dillo 13126: "perl-modules"></a>15.5.6. Packages
1.30 wiz 13127: installing perl modules</h3>
1.1 grant 13128: </div>
13129: </div>
13130: </div>
13131:
13132: <p>Makefiles of packages providing perl5 modules should
1.45 wiz 13133: include the Makefile fragment <code xmlns=
13134: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13135: "filename">../../lang/perl5/module.mk</code>. It
13136: provides a <span><strong class=
13137: "command">do-configure</strong></span> target for the
13138: standard perl configuration for such modules as well as
13139: various hooks to tune this configuration. See comments
13140: in this file for details.</p>
1.1 grant 13141:
13142: <p>Perl5 modules will install into different places
13143: depending on the version of perl used during the build
13144: process. To address this, pkgsrc will append lines to
1.45 wiz 13145: the <code xmlns=
13146: "http://www.w3.org/TR/xhtml1/transitional" class=
13147: "filename">PLIST</code> corresponding to the files
13148: listed in the installed <code xmlns=
13149: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13150: "filename">.packlist</code> file generated by most
13151: perl5 modules. This is invoked by defining <code class=
13152: "varname">PERL5_PACKLIST</code> to a space-separated
13153: list of paths to packlist files, e.g.:</p>
1.1 grant 13154: <pre class="programlisting">
1.51 rillig 13155: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1 grant 13156: </pre>
13157:
1.14 xtraeme 13158: <p>The variables <code class=
13159: "varname">PERL5_SITELIB</code>, <code class=
13160: "varname">PERL5_SITEARCH</code>, and <code class=
13161: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 13162: locations in which perl5 modules may be installed, and
13163: may be used by perl5 packages that don't have a
13164: packlist. These three variables are also substituted
1.45 wiz 13165: for in the <code xmlns=
13166: "http://www.w3.org/TR/xhtml1/transitional" class=
13167: "filename">PLIST</code>.</p>
1.1 grant 13168: </div>
13169:
1.57 ! minskim 13170: <div class="sect2" lang="en">
1.1 grant 13171: <div class="titlepage">
13172: <div>
13173: <div>
1.57 ! minskim 13174: <h3 class="title"><a name=
1.38 dillo 13175: "faq.info-files"></a>15.5.7. Packages
1.1 grant 13176: installing info files</h3>
13177: </div>
13178: </div>
13179: </div>
13180:
13181: <p>Some packages install info files or use the
13182: “<span class="quote">makeinfo</span>” or
13183: “<span class="quote">install-info</span>”
13184: commands. Each of the info files:</p>
13185:
13186: <div class="itemizedlist">
13187: <ul type="disc">
13188: <li>
13189: <p>is considered to be installed in the directory
1.45 wiz 13190: <code xmlns=
13191: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13192: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 13193: </li>
13194:
13195: <li>
13196: <p>is registered in the Info directory file
1.45 wiz 13197: <code xmlns=
13198: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13199: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 13200: </li>
13201:
13202: <li>
13203: <p>and must be listed as a filename in the
1.14 xtraeme 13204: <code class="varname">INFO_FILES</code> variable
13205: in the package Makefile.</p>
1.1 grant 13206: </li>
13207: </ul>
13208: </div>
13209:
1.14 xtraeme 13210: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 13211: “<span class="quote">info</span>” and can
1.45 wiz 13212: be overridden in the package Makefile. <code xmlns=
13213: "http://www.w3.org/TR/xhtml1/transitional" class=
13214: "filename">INSTALL</code> and <code xmlns=
13215: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13216: "filename">DEINSTALL</code> scripts will be generated
13217: to handle registration of the info files in the Info
1.1 grant 13218: directory file. The “<span class=
13219: "quote">install-info</span>” command used for the
13220: info files registration is either provided by the
13221: system, or by a special purpose package automatically
13222: added as dependency if needed.</p>
13223:
13224: <p>A package which needs the “<span class=
13225: "quote">makeinfo</span>” command at build time
1.14 xtraeme 13226: must define the variable <code class=
13227: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 13228: minimum version of the “<span class=
13229: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 13230: should be noted with the <code class=
13231: "varname">TEXINFO_REQD</code> variable in the package
1.45 wiz 13232: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13233: class="filename">Makefile</code>. By default, a minimum
13234: version of 3.12 is required. If the system does not
13235: provide a <span><strong class=
1.14 xtraeme 13236: "command">makeinfo</strong></span> command or if it
13237: does not match the required minimum, a build dependency
13238: on the <a xmlns=
13239: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 13240: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45 wiz 13241: target="_top"><code xmlns="" class=
13242: "filename">devel/gtexinfo</code></a> package will be
1.20 ben 13243: added automatically.</p>
1.1 grant 13244:
13245: <p>The build and installation process of the software
13246: provided by the package should not use the
1.14 xtraeme 13247: <span><strong class=
13248: "command">install-info</strong></span> command as the
13249: registration of info files is the task of the package
1.45 wiz 13250: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13251: class="filename">INSTALL</code> script, and it must use
13252: the appropriate <span><strong class=
1.14 xtraeme 13253: "command">makeinfo</strong></span> command.</p>
1.1 grant 13254:
1.47 reed 13255: <p>To achieve this goal, the pkgsrc infrastructure
1.14 xtraeme 13256: creates overriding scripts for the <span><strong class=
13257: "command">install-info</strong></span> and
13258: <span><strong class="command">makeinfo</strong></span>
13259: commands in a directory listed early in <code class=
13260: "varname">PATH</code>.</p>
1.1 grant 13261:
1.14 xtraeme 13262: <p>The script overriding <span><strong class=
13263: "command">install-info</strong></span> has no effect
13264: except the logging of a message. The script overriding
13265: <span><strong class="command">makeinfo</strong></span>
13266: logs a message and according to the value of
13267: <code class="varname">USE_MAKEINFO</code> and
13268: <code class="varname">TEXINFO_REQD</code> either run
13269: the appropriate <span><strong class=
13270: "command">makeinfo</strong></span> command or exit on
13271: error.</p>
1.1 grant 13272: </div>
13273:
1.57 ! minskim 13274: <div class="sect2" lang="en">
! 13275: <div class="titlepage">
! 13276: <div>
! 13277: <div>
! 13278: <h3 class="title"><a name=
! 13279: "manpages"></a>15.5.8. Packages installing
! 13280: man pages</h3>
! 13281: </div>
! 13282: </div>
! 13283: </div>
! 13284:
! 13285: <p>Many packages install manual pages. The man pages
! 13286: are installed under <code class=
! 13287: "varname">${PREFIX}/${PKGMANDIR}</code> which is
! 13288: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 13289: class="filename">/usr/pkg/man</code> by default.
! 13290: <code class="varname">PKGMANDIR</code> defaults to
! 13291: “<span class="quote">man</span>”. For
! 13292: example, you can set <code class=
! 13293: "varname">PKGMANDIR</code> to “<span class=
! 13294: "quote">share/man</span>” to have man pages
! 13295: install under <code xmlns=
! 13296: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13297: "filename">/usr/pkg/share/man/</code> by default.</p>
! 13298:
! 13299: <div class="note" style=
! 13300: "margin-left: 0.5in; margin-right: 0.5in;">
! 13301: <h3 class="title">Note</h3>
! 13302:
! 13303: <p>The support for a custom <code class=
! 13304: "varname">PKGMANDIR</code> is not complete.</p>
! 13305: </div>
! 13306:
! 13307: <p>The <code xmlns=
! 13308: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13309: "filename">PLIST</code> files can just use <code xmlns=
! 13310: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13311: "filename">man/</code> as the top level directory for
! 13312: the man page file entries and the pkgsrc framework will
! 13313: convert as needed.</p>
! 13314:
! 13315: <p>Packages that are configured with <code class=
! 13316: "varname">GNU_CONFIGURE</code> set as
! 13317: “<span class="quote">yes</span>”, by
! 13318: default will use the <code xmlns=
! 13319: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13320: "filename">./configure</code> --mandir switch to set
! 13321: where the man pages should be installed. The path is
! 13322: <code class="varname">GNU_CONFIGURE_MANDIR</code> which
! 13323: defaults to <code class=
! 13324: "varname">${PREFIX}/${PKGMANDIR}</code>.</p>
! 13325:
! 13326: <p>Packages that use <code class=
! 13327: "varname">GNU_CONFIGURE</code> but do not use --mandir,
! 13328: can set <code class=
! 13329: "varname">CONFIGURE_HAS_MANDIR</code> to
! 13330: “<span class="quote">no</span>”. Or if the
! 13331: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 13332: class="filename">./configure</code> script uses a
! 13333: non-standard use of --mandir, you can set <code class=
! 13334: "varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
! 13335:
! 13336: <p>See <a href="#manpage-compression" title=
! 13337: "10.5. Man page compression">Section 10.5,
! 13338: “Man page compression”</a> for information
! 13339: on installation of compressed manual pages.</p>
! 13340: </div>
! 13341:
! 13342: <div class="sect2" lang="en">
1.1 grant 13343: <div class="titlepage">
13344: <div>
13345: <div>
1.57 ! minskim 13346: <h3 class="title"><a name=
! 13347: "gconf2-data-files"></a>15.5.9. Packages
1.30 wiz 13348: installing GConf2 data files</h3>
1.1 grant 13349: </div>
13350: </div>
13351: </div>
13352:
1.45 wiz 13353: <p>If a package installs <code xmlns=
13354: "http://www.w3.org/TR/xhtml1/transitional" class=
13355: "filename">.schemas</code> or <code xmlns=
13356: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13357: "filename">.entries</code> files, used by GConf2, you
1.1 grant 13358: need to take some extra steps to make sure they get
13359: registered in the database:</p>
13360:
13361: <div class="orderedlist">
13362: <ol type="1">
13363: <li>
1.45 wiz 13364: <p>Include <code xmlns=
13365: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13366: "filename">../../devel/GConf2/schemas.mk</code>
1.45 wiz 13367: instead of its <code xmlns=
13368: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13369: "filename">buildlink3.mk</code> file. This takes
1.1 grant 13370: care of rebuilding the GConf2 database at
13371: installation and deinstallation time, and tells
13372: the package where to install GConf2 data files
13373: using some standard configure arguments. It also
13374: disallows any access to the database directly
13375: from the package.</p>
13376: </li>
13377:
13378: <li>
13379: <p>Ensure that the package installs its
1.45 wiz 13380: <code xmlns=
13381: "http://www.w3.org/TR/xhtml1/transitional" class=
13382: "filename">.schemas</code> files under
13383: <code xmlns=
13384: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13385: "filename">${PREFIX}/share/gconf/schemas</code>.
1.45 wiz 13386: If they get installed under <code xmlns=
13387: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13388: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 13389: manually patch the package.</p>
13390: </li>
13391:
13392: <li>
13393: <p>Check the PLIST and remove any entries under
13394: the etc/gconf directory, as they will be handled
13395: automatically. See <a href="#faq.conf" title=
1.38 dillo 13396: "7.14. How do I change the location of configuration files?">
13397: Section 7.14, “How do I change the
1.35 jmmv 13398: location of configuration files?”</a> for
13399: more information.</p>
1.1 grant 13400: </li>
13401:
13402: <li>
1.14 xtraeme 13403: <p>Define the <code class=
13404: "varname">GCONF2_SCHEMAS</code> variable in your
1.45 wiz 13405: <code xmlns=
13406: "http://www.w3.org/TR/xhtml1/transitional" class=
13407: "filename">Makefile</code> with a list of all
13408: <code xmlns=
13409: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13410: "filename">.schemas</code> files installed by the
13411: package, if any. Names must not contain any
13412: directories in them.</p>
1.1 grant 13413: </li>
13414:
13415: <li>
1.14 xtraeme 13416: <p>Define the <code class=
13417: "varname">GCONF2_ENTRIES</code> variable in your
1.45 wiz 13418: <code xmlns=
13419: "http://www.w3.org/TR/xhtml1/transitional" class=
13420: "filename">Makefile</code> with a list of all
13421: <code xmlns=
13422: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13423: "filename">.entries</code> files installed by the
13424: package, if any. Names must not contain any
13425: directories in them.</p>
1.1 grant 13426: </li>
13427: </ol>
13428: </div>
13429: </div>
13430:
1.57 ! minskim 13431: <div class="sect2" lang="en">
1.1 grant 13432: <div class="titlepage">
13433: <div>
13434: <div>
1.30 wiz 13435: <h3 class="title"><a name=
1.57 ! minskim 13436: "scrollkeeper-data-files"></a>15.5.10. Packages
1.30 wiz 13437: installing scrollkeeper data files</h3>
1.1 grant 13438: </div>
13439: </div>
13440: </div>
13441:
1.45 wiz 13442: <p>If a package installs <code xmlns=
13443: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13444: "filename">.omf</code> files, used by scrollkeeper, you
13445: need to take some extra steps to make sure they get
13446: registered in the database:</p>
1.1 grant 13447:
13448: <div class="orderedlist">
13449: <ol type="1">
13450: <li>
1.45 wiz 13451: <p>Include <code xmlns=
13452: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13453: "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45 wiz 13454: instead of its <code xmlns=
13455: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13456: "filename">buildlink3.mk</code> file. This takes
1.1 grant 13457: care of rebuilding the scrollkeeper database at
13458: installation and deinstallation time, and
13459: disallows any access to it directly from the
13460: package.</p>
13461: </li>
13462:
13463: <li>
13464: <p>Check the PLIST and remove any entries under
1.45 wiz 13465: the <code xmlns=
13466: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13467: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 13468: as they will be handled automatically.</p>
13469: </li>
13470:
13471: <li>
1.45 wiz 13472: <p>Remove the <code xmlns=
13473: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13474: "filename">share/omf</code> directory from the
13475: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 13476: </li>
13477: </ol>
13478: </div>
13479: </div>
13480:
1.57 ! minskim 13481: <div class="sect2" lang="en">
1.1 grant 13482: <div class="titlepage">
13483: <div>
13484: <div>
1.57 ! minskim 13485: <h3 class="title"><a name=
! 13486: "x11-fonts"></a>15.5.11. Packages installing
1.1 grant 13487: X11 fonts</h3>
13488: </div>
13489: </div>
13490: </div>
13491:
13492: <p>If a package installs font files, you will need to
13493: rebuild the fonts database in the directory where they
13494: get installed at installation and deinstallation time.
1.45 wiz 13495: This can be automatically done by using <code xmlns=
13496: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13497: "filename">mk/fonts.mk</code>, which you need to
1.45 wiz 13498: include in your <code xmlns=
13499: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13500: "filename">Makefile</code>.</p>
1.1 grant 13501:
13502: <p>When the file is included, you can list the
1.14 xtraeme 13503: directories where fonts are installed in the
13504: <code class="varname">FONTS_<em class=
13505: "replaceable"><code>type</code></em>_DIRS</code>
13506: variables, where <em class=
13507: "replaceable"><code>type</code></em> can be one of
13508: “<span class="quote">TTF</span>”,
1.1 grant 13509: “<span class="quote">TYPE1</span>” or
13510: “<span class="quote">X11</span>”. Also make
1.45 wiz 13511: sure that the database file <code xmlns=
13512: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13513: "filename">fonts.dir</code> is not listed in the
1.1 grant 13514: PLIST.</p>
13515:
13516: <p>Note that you should not create new directories for
13517: fonts; instead use the standard ones to avoid that the
13518: user needs to manually configure his X server to find
13519: them.</p>
13520: </div>
13521:
1.57 ! minskim 13522: <div class="sect2" lang="en">
1.1 grant 13523: <div class="titlepage">
13524: <div>
13525: <div>
1.57 ! minskim 13526: <h3 class="title"><a name=
! 13527: "gtk2-modules"></a>15.5.12. Packages
1.30 wiz 13528: installing GTK2 modules</h3>
1.1 grant 13529: </div>
13530: </div>
13531: </div>
13532:
1.47 reed 13533: <p>If a package installs GTK2 immodules or loaders, you
1.1 grant 13534: need to take some extra steps to get them registered in
13535: the GTK2 database properly:</p>
13536:
13537: <div class="orderedlist">
13538: <ol type="1">
13539: <li>
1.45 wiz 13540: <p>Include <code xmlns=
13541: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13542: "filename">../../x11/gtk2/modules.mk</code>
1.45 wiz 13543: instead of its <code xmlns=
13544: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13545: "filename">buildlink3.mk</code> file. This takes
13546: care of rebuilding the database at installation
13547: and deinstallation time.</p>
1.1 grant 13548: </li>
13549:
13550: <li>
1.14 xtraeme 13551: <p>Set <code class=
13552: "varname">GTK2_IMMODULES=YES</code> if your
13553: package installs GTK2 immodules.</p>
1.1 grant 13554: </li>
13555:
13556: <li>
1.14 xtraeme 13557: <p>Set <code class=
13558: "varname">GTK2_LOADERS=YES</code> if your package
13559: installs GTK2 loaders.</p>
1.1 grant 13560: </li>
13561:
13562: <li>
1.47 reed 13563: <p>Patch the package to not touch any of the GTK2
1.1 grant 13564: databases directly. These are:</p>
13565:
13566: <div class="itemizedlist">
13567: <ul type="disc">
13568: <li>
1.45 wiz 13569: <p><code xmlns=
13570: "http://www.w3.org/TR/xhtml1/transitional"
13571: class=
1.14 xtraeme 13572: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 13573: </li>
13574:
13575: <li>
1.45 wiz 13576: <p><code xmlns=
13577: "http://www.w3.org/TR/xhtml1/transitional"
13578: class=
1.14 xtraeme 13579: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 13580: </li>
13581: </ul>
13582: </div>
13583: </li>
13584:
13585: <li>
13586: <p>Check the PLIST and remove any entries under
1.45 wiz 13587: the <code xmlns=
13588: "http://www.w3.org/TR/xhtml1/transitional" class=
13589: "filename">libdata/gtk-2.0</code> directory, as
13590: they will be handled automatically.</p>
1.1 grant 13591: </li>
13592: </ol>
13593: </div>
13594: </div>
13595:
1.57 ! minskim 13596: <div class="sect2" lang="en">
1.1 grant 13597: <div class="titlepage">
13598: <div>
13599: <div>
1.57 ! minskim 13600: <h3 class="title"><a name=
! 13601: "sgml-xml-data"></a>15.5.13. Packages
1.30 wiz 13602: installing SGML or XML data</h3>
1.1 grant 13603: </div>
13604: </div>
13605: </div>
13606:
13607: <p>If a package installs SGML or XML data files that
13608: need to be registered in system-wide catalogs (like
13609: DTDs, sub-catalogs, etc.), you need to take some extra
13610: steps:</p>
13611:
13612: <div class="orderedlist">
13613: <ol type="1">
13614: <li>
1.45 wiz 13615: <p>Include <code xmlns=
13616: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13617: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45 wiz 13618: in your <code xmlns=
13619: "http://www.w3.org/TR/xhtml1/transitional" class=
13620: "filename">Makefile</code>, which takes care of
13621: registering those files in system-wide catalogs
13622: at installation and deinstallation time.</p>
1.1 grant 13623: </li>
13624:
13625: <li>
1.14 xtraeme 13626: <p>Set <code class="varname">SGML_CATALOGS</code>
13627: to the full path of any SGML catalogs installed
13628: by the package.</p>
1.1 grant 13629: </li>
13630:
13631: <li>
1.14 xtraeme 13632: <p>Set <code class="varname">XML_CATALOGS</code>
13633: to the full path of any XML catalogs installed by
1.1 grant 13634: the package.</p>
13635: </li>
13636:
13637: <li>
1.14 xtraeme 13638: <p>Set <code class="varname">SGML_ENTRIES</code>
13639: to individual entries to be added to the SGML
1.1 grant 13640: catalog. These come in groups of three strings;
13641: see xmlcatmgr(1) for more information
13642: (specifically, arguments recognized by the 'add'
13643: action). Note that you will normally not use this
13644: variable.</p>
13645: </li>
13646:
13647: <li>
1.14 xtraeme 13648: <p>Set <code class="varname">XML_ENTRIES</code>
13649: to individual entries to be added to the XML
1.1 grant 13650: catalog. These come in groups of three strings;
13651: see xmlcatmgr(1) for more information
13652: (specifically, arguments recognized by the 'add'
13653: action). Note that you will normally not use this
13654: variable.</p>
13655: </li>
13656: </ol>
13657: </div>
13658: </div>
13659:
1.57 ! minskim 13660: <div class="sect2" lang="en">
1.1 grant 13661: <div class="titlepage">
13662: <div>
13663: <div>
1.57 ! minskim 13664: <h3 class="title"><a name=
! 13665: "mime-database"></a>15.5.14. Packages
1.30 wiz 13666: installing extensions to the MIME database</h3>
1.1 grant 13667: </div>
13668: </div>
13669: </div>
13670:
13671: <p>If a package provides extensions to the MIME
1.45 wiz 13672: database by installing <code xmlns=
13673: "http://www.w3.org/TR/xhtml1/transitional" class=
13674: "filename">.xml</code> files inside <code xmlns=
13675: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13676: "filename">${PREFIX}/share/mime/packages</code>, you
13677: need to take some extra steps to ensure that the
13678: database is kept consistent with respect to these new
13679: files:</p>
1.1 grant 13680:
13681: <div class="orderedlist">
13682: <ol type="1">
13683: <li>
1.45 wiz 13684: <p>Include <code xmlns=
13685: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13686: "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45 wiz 13687: (avoid using the <code xmlns=
13688: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13689: "filename">buildlink3.mk</code> file from this
13690: same directory, which is reserved for inclusion
1.45 wiz 13691: from other <code xmlns=
13692: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13693: "filename">buildlink3.mk</code> files). It takes
13694: care of rebuilding the MIME database at
13695: installation and deinstallation time, and
13696: disallows any access to it directly from the
1.1 grant 13697: package.</p>
13698: </li>
13699:
13700: <li>
13701: <p>Check the PLIST and remove any entries under
1.45 wiz 13702: the <code xmlns=
13703: "http://www.w3.org/TR/xhtml1/transitional" class=
13704: "filename">share/mime</code> directory,
13705: <span class="emphasis"><em>except</em></span> for
13706: files saved under <code xmlns=
13707: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13708: "filename">share/mime/packages</code>. The former
1.1 grant 13709: are handled automatically by the
1.47 reed 13710: update-mime-database program, but the latter are
1.1 grant 13711: package-dependent and must be removed by the
13712: package that installed them in the first
13713: place.</p>
13714: </li>
13715:
13716: <li>
1.45 wiz 13717: <p>Remove any <code xmlns=
13718: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13719: "filename">share/mime/*</code> directories from
13720: the PLIST. They will be handled by the
1.1 grant 13721: shared-mime-info package.</p>
13722: </li>
13723: </ol>
13724: </div>
13725: </div>
13726:
1.57 ! minskim 13727: <div class="sect2" lang="en">
1.1 grant 13728: <div class="titlepage">
13729: <div>
13730: <div>
1.57 ! minskim 13731: <h3 class="title"><a name=
! 13732: "intltool"></a>15.5.15. Packages using
1.1 grant 13733: intltool</h3>
13734: </div>
13735: </div>
13736: </div>
13737:
13738: <p>If a package uses intltool during its build, include
1.45 wiz 13739: the <code xmlns=
13740: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13741: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 13742: file, which forces it to use the intltool package
13743: provided by pkgsrc, instead of the one bundled with the
13744: distribution file.</p>
13745:
13746: <p>This tracks intltool's build-time dependencies and
13747: uses the latest available version; this way, the
13748: package benefits of any bug fixes that may have
13749: appeared since it was released.</p>
13750: </div>
1.18 xtraeme 13751:
1.57 ! minskim 13752: <div class="sect2" lang="en">
1.18 xtraeme 13753: <div class="titlepage">
13754: <div>
13755: <div>
1.57 ! minskim 13756: <h3 class="title"><a name=
! 13757: "startup-scripts"></a>15.5.16. Packages
1.30 wiz 13758: installing startup scripts</h3>
1.18 xtraeme 13759: </div>
13760: </div>
13761: </div>
13762:
13763: <p>If a package contains a rc.d script, it won't be
13764: copied into the startup directory by default, but you
13765: can enable it, by adding the option <code class=
1.45 wiz 13766: "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
13767: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 13768: "filename">/etc/mk.conf</code>. This option will copy
1.45 wiz 13769: the scripts into <code xmlns=
13770: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 13771: "filename">/etc/rc.d</code> when a package is
13772: installed, and it will automatically remove the scripts
13773: when the package is deinstalled.</p>
13774: </div>
1.57 ! minskim 13775:
! 13776: <div class="sect2" lang="en">
! 13777: <div class="titlepage">
! 13778: <div>
! 13779: <div>
! 13780: <h3 class="title"><a name=
! 13781: "tex-packages"></a>15.5.17. Packages
! 13782: installing TeX modules</h3>
! 13783: </div>
! 13784: </div>
! 13785: </div>
! 13786:
! 13787: <p>If a package installs TeX packages into the texmf
! 13788: tree, the <code xmlns=
! 13789: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13790: "filename">ls-R</code> database of the tree needs to be
! 13791: updated.</p>
! 13792:
! 13793: <div class="note" style=
! 13794: "margin-left: 0.5in; margin-right: 0.5in;">
! 13795: <h3 class="title">Note</h3>
! 13796:
! 13797: <p>Except the main TeX packages such as teTeX-texmf,
! 13798: packages should install files into <code class=
! 13799: "varname">PKG_LOCALTEXMFPREFIX</code>, not
! 13800: <code class="varname">PKG_TEXMFPREFIX</code>.</p>
! 13801: </div>
! 13802:
! 13803: <div class="orderedlist">
! 13804: <ol type="1">
! 13805: <li>
! 13806: <p>Include <code xmlns=
! 13807: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13808: "filename">../../print/teTeX/module.mk</code>
! 13809: instead of <code xmlns=
! 13810: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13811: "filename">../../mk/tex.buildlink3.mk</code>.
! 13812: This takes care of rebuilding the <code xmlns=
! 13813: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13814: "filename">ls-R</code> database at installation
! 13815: and deinstallation time.</p>
! 13816: </li>
! 13817:
! 13818: <li>
! 13819: <p>If your package installs files into a texmf
! 13820: tree other than the one at <code class=
! 13821: "varname">PKG_LOCALTEXMFPREFIX</code>, set
! 13822: <code class="varname">TEXMFDIRS</code> to the
! 13823: list of all texmf trees that need database
! 13824: update.</p>
! 13825: </li>
! 13826:
! 13827: <li>
! 13828: <p>Make sure that none of <code xmlns=
! 13829: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13830: "filename">ls-R</code> databases are included in
! 13831: <code xmlns=
! 13832: "http://www.w3.org/TR/xhtml1/transitional" class=
! 13833: "filename">PLIST</code>, as they will be removed
! 13834: only by the teTeX-bin package.</p>
! 13835: </li>
! 13836: </ol>
! 13837: </div>
! 13838: </div>
1.1 grant 13839: </div>
13840:
1.57 ! minskim 13841: <div class="sect1" lang="en">
1.1 grant 13842: <div class="titlepage">
13843: <div>
13844: <div>
13845: <h2 class="title" style="clear: both"><a name=
1.38 dillo 13846: "feedback-to-author"></a>15.6. Feedback to the
1.30 wiz 13847: author</h2>
1.1 grant 13848: </div>
13849: </div>
13850: </div>
13851:
13852: <p>If you have found any bugs in the package you make
13853: available, if you had to do special steps to make it run
13854: under NetBSD or if you enhanced the software in various
13855: other ways, be sure to report these changes back to the
13856: original author of the program! With that kind of
13857: support, the next release of the program can incorporate
13858: these fixes, and people not using the NetBSD packages
13859: system can win from your efforts.</p>
13860:
13861: <p>Support the idea of free software!</p>
13862: </div>
13863: </div>
13864:
1.57 ! minskim 13865: <div class="chapter" lang="en">
1.1 grant 13866: <div class="titlepage">
13867: <div>
13868: <div>
1.57 ! minskim 13869: <h2 class="title"><a name=
1.38 dillo 13870: "debug"></a>Chapter 16. Debugging</h2>
1.1 grant 13871: </div>
13872: </div>
13873: </div>
13874:
13875: <p>To check out all the gotchas when building a package,
13876: here are the steps that I do in order to get a package
13877: working. Please note this is basically the same as what was
13878: explained in the previous sections, only with some
13879: debugging aids.</p>
13880:
13881: <div class="itemizedlist">
13882: <ul type="disc">
13883: <li>
1.14 xtraeme 13884: <p>Be sure to set <code class=
1.45 wiz 13885: "varname">PKG_DEVELOPER=1</code> in <code xmlns=
13886: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13887: "filename">/etc/mk.conf</code></p>
1.1 grant 13888: </li>
13889:
13890: <li>
13891: <p>Install <a xmlns=
13892: "http://www.w3.org/TR/xhtml1/transitional" href=
13893: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 13894: target="_top"><code xmlns="" class=
13895: "filename">pkgtools/url2pkg</code></a>, create a
1.20 ben 13896: directory for a new package, change into it, then run
13897: <span><strong class=
13898: "command">url2pkg</strong></span>:</p>
1.1 grant 13899: <pre class="screen">
1.14 xtraeme 13900: <code class="prompt">%</code> <strong class=
13901: "userinput"><code>mkdir /usr/pkgsrc/<em class=
13902: "replaceable"><code>category</code></em>/<em class=
13903: "replaceable"><code>examplepkg</code></em></code></strong>
13904: <code class="prompt">%</code> <strong class=
13905: "userinput"><code>cd /usr/pkgsrc/<em class=
13906: "replaceable"><code>category</code></em>/<em class=
13907: "replaceable"><code>examplepkg</code></em></code></strong>
13908: <code class="prompt">%</code> <strong class=
13909: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 13910: </pre>
13911: </li>
13912:
13913: <li>
1.45 wiz 13914: <p>Edit the <code xmlns=
13915: "http://www.w3.org/TR/xhtml1/transitional" class=
13916: "filename">Makefile</code> as requested.</p>
1.1 grant 13917: </li>
13918:
13919: <li>
1.45 wiz 13920: <p>Fill in the <code xmlns=
13921: "http://www.w3.org/TR/xhtml1/transitional" class=
13922: "filename">DESCR</code> file</p>
1.1 grant 13923: </li>
13924:
13925: <li>
1.14 xtraeme 13926: <p>Run <span><strong class="command">make
13927: configure</strong></span></p>
1.1 grant 13928: </li>
13929:
13930: <li>
13931: <p>Add any dependencies glimpsed from documentation
1.45 wiz 13932: and the configure step to the package's <code xmlns=
13933: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13934: "filename">Makefile</code>.</p>
1.1 grant 13935: </li>
13936:
13937: <li>
13938: <p>Make the package compile, doing multiple rounds
13939: of</p>
13940: <pre class="screen">
1.14 xtraeme 13941: <code class="prompt">%</code> <strong class=
13942: "userinput"><code>make</code></strong>
13943: <code class="prompt">%</code> <strong class=
13944: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
13945: <code class="prompt">%</code> <strong class=
13946: "userinput"><code>mkpatches</code></strong>
13947: <code class="prompt">%</code> <strong class=
13948: "userinput"><code>patchdiff</code></strong>
13949: <code class="prompt">%</code> <strong class=
13950: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
13951: <code class="prompt">%</code> <strong class=
13952: "userinput"><code>make mps</code></strong>
13953: <code class="prompt">%</code> <strong class=
13954: "userinput"><code>make clean</code></strong>
1.1 grant 13955: </pre>
13956:
13957: <p>Doing as non-root user will ensure that no files
13958: are modified that shouldn't be, especially during the
1.14 xtraeme 13959: build phase. <span><strong class=
13960: "command">mkpatches</strong></span>,
13961: <span><strong class=
13962: "command">patchdiff</strong></span> and
13963: <span><strong class="command">pkgvi</strong></span>
13964: are from the <a xmlns=
1.1 grant 13965: "http://www.w3.org/TR/xhtml1/transitional" href=
13966: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 13967: target="_top"><code xmlns="" class=
13968: "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1 grant 13969: </li>
13970:
13971: <li>
1.45 wiz 13972: <p>Look at the <code xmlns=
13973: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13974: "filename">Makefile</code>, fix if necessary; see
13975: <a href="#components.Makefile" title=
1.38 dillo 13976: "8.1. Makefile">Section 8.1,
1.45 wiz 13977: “<code xmlns=
13978: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13979: "filename">Makefile</code>”</a>.</p>
1.1 grant 13980: </li>
13981:
13982: <li>
1.45 wiz 13983: <p>Generate a <code xmlns=
13984: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13985: "filename">PLIST</code>:</p>
1.1 grant 13986: <pre class="screen">
1.14 xtraeme 13987: <code class="prompt">#</code> <strong class=
13988: "userinput"><code>make install</code></strong>
13989: <code class="prompt">#</code> <strong class=
13990: "userinput"><code>make print-PLIST >PLIST</code></strong>
13991: <code class="prompt">#</code> <strong class=
13992: "userinput"><code>make deinstall</code></strong>
13993: <code class="prompt">#</code> <strong class=
13994: "userinput"><code>make install</code></strong>
13995: <code class="prompt">#</code> <strong class=
13996: "userinput"><code>make deinstall</code></strong>
1.1 grant 13997: </pre>
13998:
1.45 wiz 13999: <p>You usually need to be <code xmlns=
14000: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14001: "username">root</code> to do this. Look if there are
1.1 grant 14002: any files left:</p>
14003: <pre class="screen">
1.14 xtraeme 14004: <code class="prompt">#</code> <strong class=
14005: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 14006: </pre>
14007:
14008: <p>If this reveals any files that are missing in
1.45 wiz 14009: <code xmlns=
14010: "http://www.w3.org/TR/xhtml1/transitional" class=
14011: "filename">PLIST</code>, add them.</p>
1.1 grant 14012: </li>
14013:
14014: <li>
1.45 wiz 14015: <p>Now that the <code xmlns=
14016: "http://www.w3.org/TR/xhtml1/transitional" class=
14017: "filename">PLIST</code> is OK, install the package
14018: again and make a binary package:</p>
1.1 grant 14019: <pre class="screen">
1.14 xtraeme 14020: <code class="prompt">#</code> <strong class=
14021: "userinput"><code>make reinstall</code></strong>
14022: <code class="prompt">#</code> <strong class=
14023: "userinput"><code>make package</code></strong>
1.1 grant 14024: </pre>
14025: </li>
14026:
14027: <li>
14028: <p>Delete the installed package:</p>
14029: <pre class="screen">
1.14 xtraeme 14030: <code class="prompt">#</code> <strong class=
14031: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 14032: </pre>
14033: </li>
14034:
14035: <li>
1.14 xtraeme 14036: <p>Repeat the above <span><strong class=
14037: "command">make print-PLIST</strong></span> command,
14038: which shouldn't find anything now:</p>
1.1 grant 14039: <pre class="screen">
1.14 xtraeme 14040: <code class="prompt">#</code> <strong class=
14041: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 14042: </pre>
14043: </li>
14044:
14045: <li>
14046: <p>Reinstall the binary package:</p>
14047: <pre class="screen">
1.14 xtraeme 14048: <code class="prompt">#</code> <strong class=
14049: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 14050: </pre>
14051: </li>
14052:
14053: <li>
14054: <p>Play with it. Make sure everything works.</p>
14055: </li>
14056:
14057: <li>
1.14 xtraeme 14058: <p>Run <span><strong class=
14059: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 14060: "http://www.w3.org/TR/xhtml1/transitional" href=
14061: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 14062: target="_top"><code xmlns="" class=
14063: "filename">pkgtools/pkglint</code></a>, and fix the
1.20 ben 14064: problems it reports:</p>
1.1 grant 14065: <pre class="screen">
1.14 xtraeme 14066: <code class="prompt">#</code> <strong class=
14067: "userinput"><code>pkglint</code></strong>
1.1 grant 14068: </pre>
14069: </li>
14070:
14071: <li>
14072: <p>Submit (or commit, if you have cvs access); see
14073: <a href="#submit" title=
1.38 dillo 14074: "Chapter 17. Submitting and Committing">Chapter 17,
1.1 grant 14075: <i>Submitting and Committing</i></a>.</p>
14076: </li>
14077: </ul>
14078: </div>
14079: </div>
14080:
1.57 ! minskim 14081: <div class="chapter" lang="en">
1.1 grant 14082: <div class="titlepage">
14083: <div>
14084: <div>
1.57 ! minskim 14085: <h2 class="title"><a name=
1.38 dillo 14086: "submit"></a>Chapter 17. Submitting and
1.1 grant 14087: Committing</h2>
14088: </div>
14089: </div>
14090: </div>
14091:
14092: <div class="toc">
14093: <p><b>Table of Contents</b></p>
14094:
14095: <dl>
1.30 wiz 14096: <dt><span class="sect1"><a href=
1.38 dillo 14097: "#submitting-your-package">17.1. Submitting your
1.30 wiz 14098: packages</a></span></dt>
1.1 grant 14099:
1.30 wiz 14100: <dt><span class="sect1"><a href=
1.41 wiz 14101: "#general-notes-for-changes">17.2. General notes when
14102: adding, updating, or removing packages</a></span></dt>
14103:
14104: <dt><span class="sect1"><a href=
14105: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 14106: package into CVS</a></span></dt>
1.1 grant 14107:
1.30 wiz 14108: <dt><span class="sect1"><a href=
1.41 wiz 14109: "#updating-package">17.4. Updating a package to a newer
1.30 wiz 14110: version</a></span></dt>
1.1 grant 14111:
1.41 wiz 14112: <dt><span class="sect1"><a href="#moving-package">17.5.
1.2 hubertf 14113: Moving a package in pkgsrc</a></span></dt>
1.1 grant 14114: </dl>
14115: </div>
14116:
1.57 ! minskim 14117: <div class="sect1" lang="en">
1.1 grant 14118: <div class="titlepage">
14119: <div>
14120: <div>
14121: <h2 class="title" style="clear: both"><a name=
1.38 dillo 14122: "submitting-your-package"></a>17.1. Submitting
1.30 wiz 14123: your packages</h2>
1.1 grant 14124: </div>
14125: </div>
14126: </div>
14127:
14128: <p>You have to separate between binary and
14129: “<span class="quote">normal</span>” (source)
14130: packages here:</p>
14131:
14132: <div class="itemizedlist">
14133: <ul type="disc">
14134: <li>
14135: <p>precompiled binary packages</p>
14136:
14137: <p>Our policy is that we accept binaries only from
14138: pkgsrc developers to guarantee that the packages
14139: don't contain any trojan horses etc. This is not to
1.13 hubertf 14140: annoy anyone but rather to protect our users!
1.1 grant 14141: You're still free to put up your home-made binary
1.13 hubertf 14142: packages and tell the world where to get them.
14143: NetBSD developers doing bulk builds and wanting to
14144: upload them please see <a href="#bulk-upload"
1.38 dillo 14145: title="6.3.8. Uploading results of a bulk build">
14146: Section 6.3.8, “Uploading results of a
1.13 hubertf 14147: bulk build”</a>.</p>
1.1 grant 14148: </li>
14149:
14150: <li>
14151: <p>packages</p>
14152:
14153: <p>First, check that your package is complete,
14154: compiles and runs well; see <a href="#debug" title=
1.38 dillo 14155: "Chapter 16. Debugging">Chapter 16,
1.1 grant 14156: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 14157: Next, generate an uuencoded gzipped <a href=
14158: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
14159: <span class="citerefentry"><span class=
14160: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 14161: preferably with all files in a single directory.
1.14 xtraeme 14162: Finally, <span><strong class=
14163: "command">send-pr</strong></span> with category
1.1 grant 14164: “<span class="quote">pkg</span>”, a
14165: synopsis which includes the package name and
14166: version number, a short description of your package
14167: (contents of the COMMENT variable or DESCR file are
14168: OK) and attach the archive to your PR.</p>
14169:
14170: <p>If you want to submit several packages, please
14171: send a separate PR for each one, it's easier for us
14172: to track things that way.</p>
14173:
14174: <p>Alternatively, you can also import new packages
14175: into pkgsrc-wip (“<span class="quote">pkgsrc
14176: work-in-progress</span>”); see the homepage
14177: at <a href="http://pkgsrc-wip.sourceforge.net/"
14178: target=
14179: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
14180: details.</p>
14181: </li>
14182: </ul>
14183: </div>
14184: </div>
14185:
1.57 ! minskim 14186: <div class="sect1" lang="en">
1.1 grant 14187: <div class="titlepage">
14188: <div>
14189: <div>
14190: <h2 class="title" style="clear: both"><a name=
1.41 wiz 14191: "general-notes-for-changes"></a>17.2. General
14192: notes when adding, updating, or removing
14193: packages</h2>
14194: </div>
14195: </div>
14196: </div>
14197:
14198: <p>Please note all package additions, updates, moves, and
1.45 wiz 14199: removals in <code xmlns=
14200: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14201: "filename">pkgsrc/doc/CHANGES</code>. It's very important
14202: to keep this file up to date and conforming to the
14203: existing format, because it will be used by scripts to
14204: automatically update pages on <a href=
14205: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45 wiz 14206: and other sites. Additionally, check the <code xmlns=
14207: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14208: "filename">pkgsrc/doc/TODO</code> file and remove the
14209: entry for the package you updated or removed, in case it
14210: was mentioned there.</p>
14211:
14212: <p>There is a make target that helps in creating proper
1.45 wiz 14213: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14214: class="filename">CHANGES</code> entries:
1.41 wiz 14215: <span><strong class="command">make
14216: changes-entry</strong></span>. It uses the optional
14217: <code class="varname">CTYPE</code> and <code class=
14218: "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45 wiz 14219: usage is to first make sure that your <code xmlns=
14220: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14221: "filename">CHANGES</code> file is up-to-date (to avoid
14222: having to resolve conflicts later-on) and then to
14223: <span><strong class="command">cd</strong></span> to the
14224: package directory. For package updates,
14225: <span><strong class="command">make
14226: changes-entry</strong></span> is enough. For new
14227: packages, or package moves or removals, set the
14228: <code class="varname">CTYPE</code> variable on the
14229: command line to "Added", "Moved", or "Removed". You can
14230: set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45 wiz 14231: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14232: class="filename">/etc/mk.conf</code> if your local login
14233: name is not the same as your NetBSD login name. Don't
14234: forget to commit the changes to <code xmlns=
14235: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14236: "filename">pkgsrc/doc/CHANGES</code>!</p>
14237: </div>
14238:
1.57 ! minskim 14239: <div class="sect1" lang="en">
1.41 wiz 14240: <div class="titlepage">
14241: <div>
14242: <div>
14243: <h2 class="title" style="clear: both"><a name=
14244: "committing-importing"></a>17.3. Committing:
1.30 wiz 14245: Importing a package into CVS</h2>
1.1 grant 14246: </div>
14247: </div>
14248: </div>
14249:
14250: <p>This section is only of interest for pkgsrc developers
14251: with write access to the pkgsrc repository. Please
14252: remember that cvs imports files relative to the current
14253: working directory, and that the pathname that you give
1.14 xtraeme 14254: the <span><strong class="command">cvs
14255: import</strong></span> command is so that it knows where
14256: to place the files in the repository. Newly created
14257: packages should be imported with a vendor tag of
14258: “<span class="quote">TNF</span>” and a
14259: release tag of “<span class=
14260: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 14261: <pre class="programlisting">
1.51 rillig 14262: <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
14263: <code class=
14264: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1 grant 14265: </pre>
14266:
14267: <p>Remember to move the directory from which you imported
14268: out of the way, or cvs will complain the next time you
14269: “<span class="quote">cvs update</span>” your
14270: source tree. Also don't forget to add the new package to
1.45 wiz 14271: the category's <code xmlns=
14272: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14273: "filename">Makefile</code>.</p>
1.1 grant 14274:
14275: <p>The commit message of the initial import should
1.45 wiz 14276: include part of the <code xmlns=
14277: "http://www.w3.org/TR/xhtml1/transitional" class=
14278: "filename">DESCR</code> file, so people reading the
14279: mailing lists know what the package is/does.</p>
1.1 grant 14280:
14281: <p>For new packages, “<span class="quote">cvs
14282: import</span>” is preferred to “<span class=
14283: "quote">cvs add</span>” because the former gets
14284: everything with a single command, and provides a
14285: consistent tag.</p>
14286: </div>
14287:
1.57 ! minskim 14288: <div class="sect1" lang="en">
1.1 grant 14289: <div class="titlepage">
14290: <div>
14291: <div>
14292: <h2 class="title" style="clear: both"><a name=
1.41 wiz 14293: "updating-package"></a>17.4. Updating a
1.30 wiz 14294: package to a newer version</h2>
1.1 grant 14295: </div>
14296: </div>
14297: </div>
14298:
14299: <p>Please always put a concise, appropriate and relevant
14300: summary of the changes between old and new versions into
14301: the commit log when updating a package. There are various
14302: reasons for this:</p>
14303:
14304: <div class="itemizedlist">
14305: <ul type="disc">
14306: <li>
14307: <p>A URL is volatile, and can change over time. It
14308: may go away completely or its information may be
14309: overwritten by newer information.</p>
14310: </li>
14311:
14312: <li>
14313: <p>Having the change information between old and
14314: new versions in our CVS repository is very useful
14315: for people who use either cvs or anoncvs.</p>
14316: </li>
14317:
14318: <li>
14319: <p>Having the change information between old and
14320: new versions in our CVS repository is very useful
14321: for people who read the pkgsrc-changes mailing
14322: list, so that they can make tactical decisions
14323: about when to upgrade the package.</p>
14324: </li>
14325: </ul>
14326: </div>
14327:
1.18 xtraeme 14328: <p>Please also recognize that, just because a new version
1.1 grant 14329: of a package has been released, it should not
14330: automatically be upgraded in the CVS repository. We
14331: prefer to be conservative in the packages that are
14332: included in pkgsrc - development or beta packages are not
14333: really the best thing for most places in which pkgsrc is
14334: used. Please use your judgement about what should go into
14335: pkgsrc, and bear in mind that stability is to be
14336: preferred above new and possibly untested features.</p>
14337: </div>
14338:
1.57 ! minskim 14339: <div class="sect1" lang="en">
1.1 grant 14340: <div class="titlepage">
14341: <div>
14342: <div>
14343: <h2 class="title" style="clear: both"><a name=
1.41 wiz 14344: "moving-package"></a>17.5. Moving a package in
1.30 wiz 14345: pkgsrc</h2>
1.1 grant 14346: </div>
14347: </div>
14348: </div>
14349:
14350: <div class="orderedlist">
14351: <ol type="1">
14352: <li>
14353: <p>Make a copy of the directory somewhere else.</p>
14354: </li>
14355:
14356: <li>
14357: <p>Remove all CVS dirs.</p>
14358:
14359: <p>Alternatively to the first two steps you can
14360: also do:</p>
14361: <pre class="screen">
1.14 xtraeme 14362: <code class="prompt">%</code> <strong class=
14363: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 14364: </pre>
14365:
14366: <p>and use that for further work.</p>
14367: </li>
14368:
14369: <li>
1.14 xtraeme 14370: <p>Fix <code class="varname">CATEGORIES</code> and
14371: any <code class="varname">DEPENDS</code> paths that
14372: just did “<span class=
1.1 grant 14373: "quote">../package</span>” instead of
14374: “<span class=
14375: "quote">../../category/package</span>”.</p>
14376: </li>
14377:
14378: <li>
1.14 xtraeme 14379: <p><span><strong class="command">cvs
14380: import</strong></span> the modified package in the
14381: new place.</p>
1.1 grant 14382: </li>
14383:
14384: <li>
14385: <p>Check if any package depends on it:</p>
14386: <pre class="screen">
1.14 xtraeme 14387: <code class="prompt">%</code> <strong class=
14388: "userinput"><code>cd /usr/pkgsrc</code></strong>
14389: <code class="prompt">%</code> <strong class=
14390: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 14391: </pre>
14392: </li>
14393:
14394: <li>
14395: <p>Fix paths in packages from step 5 to point to
14396: new location.</p>
14397: </li>
14398:
14399: <li>
1.14 xtraeme 14400: <p><span><strong class="command">cvs rm
14401: (-f)</strong></span> the package at the old
14402: location.</p>
1.1 grant 14403: </li>
14404:
14405: <li>
1.45 wiz 14406: <p>Remove from <code xmlns=
14407: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14408: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 14409: </li>
14410:
14411: <li>
1.45 wiz 14412: <p>Add to <code xmlns=
14413: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14414: "filename">newcategory/Makefile</code>.</p>
1.1 grant 14415: </li>
14416:
14417: <li>
14418: <p>Commit the changed and removed files:</p>
14419: <pre class="screen">
1.14 xtraeme 14420: <code class="prompt">%</code> <strong class=
14421: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 14422: </pre>
14423:
14424: <p>(and any packages from step 5, of course).</p>
14425: </li>
14426: </ol>
14427: </div>
14428: </div>
14429: </div>
14430: </div>
14431:
1.57 ! minskim 14432: <div class="appendix" lang="en">
1.1 grant 14433: <div class="titlepage">
14434: <div>
14435: <div>
1.57 ! minskim 14436: <h2 class="title"><a name=
1.46 gdt 14437: "examples"></a>Appendix A. A simple example
1.1 grant 14438: package: bison</h2>
14439: </div>
14440: </div>
14441: </div>
14442:
14443: <div class="toc">
14444: <p><b>Table of Contents</b></p>
14445:
14446: <dl>
1.46 gdt 14447: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 14448: files</a></span></dt>
14449:
14450: <dd>
14451: <dl>
1.30 wiz 14452: <dt><span class="sect2"><a href=
1.46 gdt 14453: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 14454:
1.30 wiz 14455: <dt><span class="sect2"><a href=
1.46 gdt 14456: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 14457:
1.30 wiz 14458: <dt><span class="sect2"><a href=
1.46 gdt 14459: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 14460:
1.30 wiz 14461: <dt><span class="sect2"><a href=
1.46 gdt 14462: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 14463: package with <span><strong class=
1.14 xtraeme 14464: "command">pkglint</strong></span></a></span></dt>
1.1 grant 14465: </dl>
14466: </dd>
14467:
1.46 gdt 14468: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 14469: Steps for building, installing, packaging</a></span></dt>
1.1 grant 14470: </dl>
14471: </div>
14472:
14473: <p>We checked to find a piece of software that wasn't in the
14474: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 14475: would want to have <span><strong class=
14476: "command">bison</strong></span> when Berkeley
14477: <span><strong class="command">yacc</strong></span> is already
14478: present in the tree is beyond us, but it's useful for the
14479: purposes of this exercise.</p>
1.1 grant 14480:
1.57 ! minskim 14481: <div class="sect1" lang="en">
1.1 grant 14482: <div class="titlepage">
14483: <div>
14484: <div>
14485: <h2 class="title" style="clear: both"><a name=
1.46 gdt 14486: "example-files"></a>A.1. files</h2>
1.1 grant 14487: </div>
14488: </div>
14489: </div>
14490:
1.57 ! minskim 14491: <div class="sect2" lang="en">
1.1 grant 14492: <div class="titlepage">
14493: <div>
14494: <div>
1.57 ! minskim 14495: <h3 class="title"><a name=
1.46 gdt 14496: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 14497: </div>
14498: </div>
14499: </div>
14500: <pre class="programlisting">
1.51 rillig 14501: # $NetBSD$
14502: #
1.1 grant 14503:
1.51 rillig 14504: DISTNAME= bison-1.25
14505: CATEGORIES= devel
14506: MASTER_SITES= ${MASTER_SITE_GNU}
1.1 grant 14507:
1.51 rillig 14508: MAINTAINER= thorpej@NetBSD.org
14509: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
14510: COMMENT= GNU yacc clone
1.1 grant 14511:
1.51 rillig 14512: GNU_CONFIGURE= yes
14513: INFO_FILES= bison.info
1.1 grant 14514:
1.51 rillig 14515: .include "../../mk/bsd.pkg.mk"
1.1 grant 14516: </pre>
14517: </div>
14518:
1.57 ! minskim 14519: <div class="sect2" lang="en">
1.1 grant 14520: <div class="titlepage">
14521: <div>
14522: <div>
1.57 ! minskim 14523: <h3 class="title"><a name=
1.46 gdt 14524: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 14525: </div>
14526: </div>
14527: </div>
14528: <pre class="programlisting">
1.51 rillig 14529: GNU version of yacc. Can make re-entrant parsers, and numerous other
14530: improvements. Why you would want this when Berkeley <a href=
1.1 grant 14531: "http://netbsd.gw.com/cgi-bin/man-cgi?yacc+1+NetBSD-current"><span class="citerefentry"><span class="refentrytitle">yacc</span>(1)</span></a> is part
1.51 rillig 14532: of the NetBSD source tree is beyond me.
1.1 grant 14533: </pre>
14534: </div>
14535:
1.57 ! minskim 14536: <div class="sect2" lang="en">
1.1 grant 14537: <div class="titlepage">
14538: <div>
14539: <div>
1.57 ! minskim 14540: <h3 class="title"><a name=
1.46 gdt 14541: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 14542: </div>
14543: </div>
14544: </div>
14545: <pre class="programlisting">
1.51 rillig 14546: @comment $NetBSD$
14547: bin/bison
14548: man/man1/bison.1.gz
14549: share/bison.simple
14550: share/bison.hairy
1.1 grant 14551: </pre>
14552: </div>
14553:
1.57 ! minskim 14554: <div class="sect2" lang="en">
1.1 grant 14555: <div class="titlepage">
14556: <div>
14557: <div>
1.30 wiz 14558: <h3 class="title"><a name=
1.46 gdt 14559: "checking-package-with-pkglint"></a>A.1.4. Checking
1.30 wiz 14560: a package with <span><strong class=
1.14 xtraeme 14561: "command">pkglint</strong></span></h3>
1.1 grant 14562: </div>
14563: </div>
14564: </div>
14565:
14566: <p>The NetBSD package system comes with <a xmlns=
14567: "http://www.w3.org/TR/xhtml1/transitional" href=
14568: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 14569: target="_top"><code xmlns="" class=
14570: "filename">pkgtools/pkglint</code></a> which helps to
14571: check the contents of these files. After installation it
14572: is quite easy to use, just change to the directory of the
1.20 ben 14573: package you wish to examine and execute
14574: <span><strong class=
14575: "command">pkglint</strong></span>:</p>
1.1 grant 14576: <pre class="screen">
1.14 xtraeme 14577: <code class="prompt">$</code> <strong class=
14578: "userinput"><code>pkglint</code></strong>
1.1 grant 14579: looks fine.
14580: </pre>
14581:
14582: <p>Depending on the supplied command line arguments (see
1.47 reed 14583: pkglint(1)), more verbose checks will be performed. Use
1.14 xtraeme 14584: e.g. <span><strong class="command">pkglint
14585: -v</strong></span> for a very verbose check.</p>
1.1 grant 14586: </div>
14587: </div>
14588:
1.57 ! minskim 14589: <div class="sect1" lang="en">
1.1 grant 14590: <div class="titlepage">
14591: <div>
14592: <div>
14593: <h2 class="title" style="clear: both"><a name=
1.46 gdt 14594: "steps-for-b-i-p"></a>A.2. Steps for building,
1.30 wiz 14595: installing, packaging</h2>
1.1 grant 14596: </div>
14597: </div>
14598: </div>
14599:
14600: <p>Create the directory where the package lives, plus any
14601: auxiliary directories:</p>
14602: <pre class="screen">
1.14 xtraeme 14603: <code class="prompt">#</code> <strong class=
14604: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
14605: <code class="prompt">#</code> <strong class=
14606: "userinput"><code>mkdir bison</code></strong>
14607: <code class="prompt">#</code> <strong class=
14608: "userinput"><code>cd bison</code></strong>
14609: <code class="prompt">#</code> <strong class=
14610: "userinput"><code>mkdir patches</code></strong>
1.1 grant 14611: </pre>
14612:
1.45 wiz 14613: <p>Create <code xmlns=
14614: "http://www.w3.org/TR/xhtml1/transitional" class=
14615: "filename">Makefile</code>, <code xmlns=
14616: "http://www.w3.org/TR/xhtml1/transitional" class=
14617: "filename">DESCR</code> and <code xmlns=
14618: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14619: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 14620: "Chapter 8. Package components - files, directories and contents">
1.57 ! minskim 14621: Chapter 8, <i>Package components - files, directories
! 14622: and contents</i></a>) then continue with fetching the
1.1 grant 14623: distfile:</p>
14624: <pre class="screen">
1.14 xtraeme 14625: <code class="prompt">#</code> <strong class=
14626: "userinput"><code>make fetch</code></strong>
1.1 grant 14627: >> bison-1.25.tar.gz doesn't seem to exist on this system.
14628: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
14629: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14630: ftp: Error retrieving file: 500 Internal error
14631:
14632: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
14633: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14634: ftp: Error retrieving file: 500 Internal error
14635:
14636: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
14637: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14638: Successfully retrieved file.
14639: </pre>
14640:
1.45 wiz 14641: <p>Generate the checksum of the distfile into <code xmlns=
14642: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14643: "filename">distinfo</code>:</p>
1.1 grant 14644: <pre class="screen">
1.14 xtraeme 14645: <code class="prompt">#</code> <strong class=
14646: "userinput"><code>make makesum</code></strong>
1.1 grant 14647: </pre>
14648:
14649: <p>Now compile:</p>
14650: <pre class="screen">
1.14 xtraeme 14651: <code class="prompt">#</code> <strong class=
14652: "userinput"><code>make</code></strong>
1.1 grant 14653: >> Checksum OK for bison-1.25.tar.gz.
14654: ===> Extracting for bison-1.25
14655: ===> Patching for bison-1.25
14656: ===> Ignoring empty patch directory
14657: ===> Configuring for bison-1.25
14658: creating cache ./config.cache
14659: checking for gcc... cc
14660: checking whether we are using GNU C... yes
14661: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
14662: checking how to run the C preprocessor... cc -E
14663: checking for minix/config.h... no
14664: checking for POSIXized ISC... no
14665: checking whether cross-compiling... no
14666: checking for ANSI C header files... yes
14667: checking for string.h... yes
14668: checking for stdlib.h... yes
14669: checking for memory.h... yes
14670: checking for working const... yes
14671: checking for working alloca.h... no
14672: checking for alloca... yes
14673: checking for strerror... yes
14674: updating cache ./config.cache
14675: creating ./config.status
14676: creating Makefile
14677: ===> Building for bison-1.25
14678: 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
14679: 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
14680: 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
14681: 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
14682: 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
14683: 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
14684: 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
14685: 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
14686: 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
14687: 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
14688: 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
14689: 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
14690: 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
14691: 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
14692: 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
14693: 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
14694: 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
14695: 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
14696: 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
14697: 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
14698: 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
14699: 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
14700: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
14701: rm -f bison.s1
14702: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
14703: </pre>
14704:
14705: <p>Everything seems OK, so install the files:</p>
14706: <pre class="screen">
1.14 xtraeme 14707: <code class="prompt">#</code> <strong class=
14708: "userinput"><code>make install</code></strong>
1.1 grant 14709: >> Checksum OK for bison-1.25.tar.gz.
14710: ===> Installing for bison-1.25
14711: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
14712: rm -f /usr/pkg/bin/bison
14713: cd /usr/pkg/share; rm -f bison.simple bison.hairy
14714: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
14715: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
14716: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
14717: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
14718: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
14719: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
14720: ===> Registering installation for bison-1.25
14721: </pre>
14722:
14723: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 14724: remove it with <span><strong class="command">pkg_delete
14725: bison</strong></span>. Should you decide that you want a
14726: binary package, do this now:</p>
1.1 grant 14727: <pre class="screen">
1.14 xtraeme 14728: <code class="prompt">#</code> <strong class=
14729: "userinput"><code>make package</code></strong>
1.1 grant 14730: >> Checksum OK for bison-1.25.tar.gz.
14731: ===> Building package for bison-1.25
14732: Creating package bison-1.25.tgz
14733: Registering depends:.
14734: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
14735: </pre>
14736:
14737: <p>Now that you don't need the source and object files any
14738: more, clean up:</p>
14739: <pre class="screen">
1.14 xtraeme 14740: <code class="prompt">#</code> <strong class=
14741: "userinput"><code>make clean</code></strong>
1.1 grant 14742: ===> Cleaning for bison-1.25
14743: </pre>
14744: </div>
14745: </div>
14746:
1.57 ! minskim 14747: <div class="appendix" lang="en">
1.1 grant 14748: <div class="titlepage">
14749: <div>
14750: <div>
1.57 ! minskim 14751: <h2 class="title"><a name=
1.46 gdt 14752: "logs"></a>Appendix B. Build logs</h2>
1.1 grant 14753: </div>
14754: </div>
14755: </div>
14756:
14757: <div class="toc">
14758: <p><b>Table of Contents</b></p>
14759:
14760: <dl>
1.46 gdt 14761: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 14762: Building figlet</a></span></dt>
14763:
1.46 gdt 14764: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 14765: Packaging figlet</a></span></dt>
14766: </dl>
14767: </div>
14768:
1.57 ! minskim 14769: <div class="sect1" lang="en">
1.1 grant 14770: <div class="titlepage">
14771: <div>
14772: <div>
14773: <h2 class="title" style="clear: both"><a name=
1.46 gdt 14774: "logs.building"></a>B.1. Building figlet</h2>
1.1 grant 14775: </div>
14776: </div>
14777: </div>
14778: <pre class="screen">
1.14 xtraeme 14779: <code class="prompt">#</code> <strong class=
14780: "userinput"><code>make</code></strong>
1.1 grant 14781: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14782: => figlet221.tar.gz doesn't seem to exist on this system.
14783: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
14784: => [172219 bytes]
14785: Connected to ftp.plig.net.
14786: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
14787: 331 Guest login ok, send your complete e-mail address as password.
14788: 230-You are user #5 of 500 simultaneous users allowed.
14789: 230-
14790: 230- ___ _ _ _
14791: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
14792: 230- | _| _| . |_| . | | | . |_| . | _| . |
14793: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
14794: 230- |_| |_| |___| |___|
14795: 230-
14796: 230-** Welcome to ftp.plig.org **
14797: 230-
14798: 230-Please note that all transfers from this FTP site are logged. If you
14799: 230-do not like this, please disconnect now.
14800: 230-
14801: 230-This arhive is available via
14802: 230-
14803: 230-HTTP: http://ftp.plig.org/
14804: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
14805: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
14806: 230-
14807: 230-Please email comments, bug reports and requests for packages to be
14808: 230-mirrored to ftp-admin@plig.org.
14809: 230-
14810: 230-
14811: 230 Logged in anonymously.
14812: Remote system type is UNIX.
14813: Using binary mode to transfer files.
14814: 200 Type okay.
14815: 250 "/pub" is new cwd.
14816: 250-"/pub/figlet" is new cwd.
14817: 250-
14818: 250-Welcome to the figlet archive at ftp.figlet.org
14819: 250-
14820: 250- ftp://ftp.figlet.org/pub/figlet/
14821: 250-
14822: 250-The official FIGlet web page is:
14823: 250- http://www.figlet.org/
14824: 250-
14825: 250-If you have questions, please mailto:info@figlet.org. If you want to
14826: 250-contribute a font or something else, you can email us.
14827: 250
14828: 250 "/pub/figlet/program" is new cwd.
14829: 250 "/pub/figlet/program/unix" is new cwd.
14830: local: figlet221.tar.gz remote: figlet221.tar.gz
14831: 502 Unimplemented command.
14832: 227 Entering Passive Mode (195,40,6,41,246,104)
14833: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
14834: 38% |************** | 65800 64.16 KB/s 00:01 ETA
14835: 226 Transfer completed.
14836: 172219 bytes received in 00:02 (75.99 KB/s)
14837: 221 Goodbye.
14838: => Checksum OK for figlet221.tar.gz.
14839: ===> Extracting for figlet-2.2.1nb2
14840: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
14841: ===> Patching for figlet-2.2.1nb2
14842: ===> Applying pkgsrc patches for figlet-2.2.1nb2
14843: ===> Overriding tools for figlet-2.2.1nb2
14844: ===> Creating toolchain wrappers for figlet-2.2.1nb2
14845: ===> Configuring for figlet-2.2.1nb2
14846: ===> Building for figlet-2.2.1nb2
14847: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
14848: chmod a+x figlet
14849: gcc -O2 -o chkfont chkfont.c
14850: => Unwrapping files-to-be-installed.
1.14 xtraeme 14851: <code class="prompt">#</code>
14852: <code class="prompt">#</code> <strong class=
14853: "userinput"><code>make install</code></strong>
1.1 grant 14854: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14855: ===> Installing for figlet-2.2.1nb2
14856: install -d -o root -g wheel -m 755 /usr/pkg/bin
14857: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
14858: mkdir -p /usr/pkg/share/figlet
14859: cp figlet /usr/pkg/bin
14860: cp chkfont /usr/pkg/bin
14861: chmod 555 figlist showfigfonts
14862: cp figlist /usr/pkg/bin
14863: cp showfigfonts /usr/pkg/bin
14864: cp fonts/*.flf /usr/pkg/share/figlet
14865: cp fonts/*.flc /usr/pkg/share/figlet
14866: cp figlet.6 /usr/pkg/man/man6
14867: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 14868: <code class="prompt">#</code>
1.1 grant 14869: </pre>
14870: </div>
14871:
1.57 ! minskim 14872: <div class="sect1" lang="en">
1.1 grant 14873: <div class="titlepage">
14874: <div>
14875: <div>
14876: <h2 class="title" style="clear: both"><a name=
1.46 gdt 14877: "logs.package"></a>B.2. Packaging figlet</h2>
1.1 grant 14878: </div>
14879: </div>
14880: </div>
14881: <pre class="screen">
1.14 xtraeme 14882: <code class="prompt">#</code> <strong class=
14883: "userinput"><code>make package</code></strong>
1.1 grant 14884: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14885: ===> Packaging figlet-2.2.1nb2
14886: ===> Building binary package for figlet-2.2.1nb2
14887: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
14888: Using SrcDir value of /usr/pkg
14889: Registering depends:.
1.14 xtraeme 14890: <code class="prompt">#</code>
1.1 grant 14891: </pre>
14892: </div>
14893: </div>
14894:
1.57 ! minskim 14895: <div class="appendix" lang="en">
1.1 grant 14896: <div class="titlepage">
14897: <div>
14898: <div>
1.57 ! minskim 14899: <h2 class="title"><a name=
1.46 gdt 14900: "ftp-layout"></a>Appendix C. Layout of the
1.1 grant 14901: FTP server's package archive</h2>
14902: </div>
14903: </div>
14904: </div>
14905:
14906: <p>Layout for precompiled binary packages on
14907: ftp.NetBSD.org:</p>
14908: <pre class="programlisting">
1.51 rillig 14909: /pub/NetBSD/packages/
14910: distfiles/
1.1 grant 14911:
1.51 rillig 14912: # Unpacked pkgsrc trees
14913: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
14914: pkgsrc-2003Q4 -> N/A
14915: pkgsrc-2004Q1/pkgsrc
14916:
14917: # pkgsrc archives
14918: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
14919: pkgsrc-2003Q4.tar.gz -> N/A
14920: pkgsrc-2004Q1.tar.gz -> N/A
14921:
14922: # Per pkgsrc-release/OS-release/arch package archives
14923: pkgsrc-2003Q4/
14924: NetBSD-1.6.2/
14925: i386/
14926: All/
14927: archivers/
14928: foo -> ../All/foo
14929: ...
14930: pkgsrc-2004Q1/
14931: NetBSD-1.6.2/
14932: i386/
14933: All/
14934: ...
14935: NetBSD-2.0/
14936: i386/
14937: All/
14938: ...
14939: SunOS-5.9/
14940: sparc/
14941: All/
14942: ...
14943: x86/
14944: All/
14945: ...
14946:
14947: # Per os-release package archive convenience links
14948: NetBSD-1.6.2 -> 1.6.2
14949: 1.6.2/
14950: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
14951: m68k/
14952: All/
14953: archivers/
14954: foo -> ../All/foo
14955: ...
14956: amiga -> m68k
14957: atari -> m68k
14958: ...
14959:
14960: 2.0 -> NetBSD-2.0 # backward compat, historic
14961: NetBSD-2.0/
14962: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
14963: SunOS-5.9/
14964: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
14965: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1 grant 14966: </pre>
14967:
14968: <p>To create:</p>
14969:
14970: <div class="orderedlist">
14971: <ol type="1">
14972: <li>
14973: <p>Run bulk build, see <a href="#bulkbuild" title=
1.57 ! minskim 14974: "6.3. Doing a bulk build of all packages">Section 6.3,
! 14975: “Doing a bulk build of all
1.1 grant 14976: packages”</a></p>
14977: </li>
14978:
14979: <li>
14980: <p>Upload /usr/pkgsrc/packages to</p>
14981: <pre class="programlisting">
14982: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51 rillig 14983: pkgsrc-2004Q4/\ # pkgsrc-branch
14984: `uname -s`-`uname -r`/\ # OS & version
14985: `uname -p` # architecture
1.1 grant 14986: </pre>
14987: </li>
14988:
14989: <li>
1.14 xtraeme 14990: <p>If necessary, create a symlink <span><strong class=
14991: "command">ln -s `uname -m` `uname -p`</strong></span>
14992: (amiga -> m68k, ...)</p>
1.1 grant 14993: </li>
14994: </ol>
14995: </div>
14996: </div>
1.2 hubertf 14997:
1.57 ! minskim 14998: <div class="appendix" lang="en">
1.2 hubertf 14999: <div class="titlepage">
15000: <div>
15001: <div>
1.57 ! minskim 15002: <h2 class="title"><a name=
1.46 gdt 15003: "editing"></a>Appendix D. Editing guidelines
1.2 hubertf 15004: for the pkgsrc guide</h2>
15005: </div>
15006: </div>
15007: </div>
15008:
15009: <div class="toc">
15010: <p><b>Table of Contents</b></p>
15011:
15012: <dl>
1.46 gdt 15013: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 15014: Targets</a></span></dt>
15015:
1.46 gdt 15016: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 15017: Procedure</a></span></dt>
15018: </dl>
15019: </div>
15020:
15021: <p>This section contains information on editing the pkgsrc
15022: guide itself.</p>
15023:
1.57 ! minskim 15024: <div class="sect1" lang="en">
1.2 hubertf 15025: <div class="titlepage">
15026: <div>
15027: <div>
15028: <h2 class="title" style="clear: both"><a name=
1.57 ! minskim 15029: "targets"></a>D.1. Targets</h2>
1.2 hubertf 15030: </div>
15031: </div>
15032: </div>
15033:
1.45 wiz 15034: <p>The pkgsrc guide's source code is stored in <code xmlns=
15035: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15036: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 15037: are created from it:</p>
15038:
15039: <div class="itemizedlist">
15040: <ul type="disc">
15041: <li>
1.45 wiz 15042: <p><code xmlns=
15043: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 15044: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 15045: </li>
15046:
15047: <li>
1.45 wiz 15048: <p><code xmlns=
15049: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15050: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 15051: </li>
15052:
15053: <li>
1.45 wiz 15054: <p><code xmlns=
15055: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15056: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 15057: the documentation on the NetBSD website will be built
15058: from pkgsrc and kept up to date on the web server
15059: itself. This means you <span class=
15060: "emphasis"><em>must</em></span> make sure that your
15061: changes haven't broken the build!</p>
15062: </li>
1.6 hubertf 15063:
15064: <li>
1.45 wiz 15065: <p><code xmlns=
15066: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15067: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 15068: PDF version of the pkgsrc guide.</p>
15069: </li>
15070:
15071: <li>
1.45 wiz 15072: <p><code xmlns=
15073: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15074: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 15075: PostScript version of the pkgsrc guide.</p>
15076: </li>
1.2 hubertf 15077: </ul>
15078: </div>
15079: </div>
15080:
1.57 ! minskim 15081: <div class="sect1" lang="en">
1.2 hubertf 15082: <div class="titlepage">
15083: <div>
15084: <div>
15085: <h2 class="title" style="clear: both"><a name=
1.46 gdt 15086: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 15087: </div>
15088: </div>
15089: </div>
15090:
15091: <p>The procedure to edit the pkgsrc guide is:</p>
15092:
15093: <div class="itemizedlist">
15094: <ul type="disc">
15095: <li>
1.6 hubertf 15096: <p>Make sure you have the packages needed to
15097: re-generate the pkgsrc guide (and other XML-based
15098: NetBSD documentation) installed. These are
1.11 ben 15099: “<span class="quote">netbsd-doc</span>”
1.47 reed 15100: for creating the ASCII and HTML versions, and
1.6 hubertf 15101: “<span class=
1.47 reed 15102: "quote">netbsd-doc-print</span>” for the
15103: PostScript and PDF versions. You will need both
1.6 hubertf 15104: packages installed, to make sure documentation is
15105: consistent across all formats. The packages can be
1.45 wiz 15106: found in <code xmlns=
15107: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15108: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45 wiz 15109: <code xmlns=
15110: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15111: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 15112: </li>
15113:
15114: <li>
1.45 wiz 15115: <p>Edit the XML file(s) in <code xmlns=
15116: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15117: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 15118: </li>
15119:
15120: <li>
1.14 xtraeme 15121: <p>Run <span><strong class="command">make extract
15122: && make do-lint</strong></span> in
1.45 wiz 15123: <code xmlns=
15124: "http://www.w3.org/TR/xhtml1/transitional" class=
15125: "filename">pkgsrc/doc/guide</code> to check the XML
15126: syntax, and fix it if needed.</p>
1.4 hubertf 15127: </li>
15128:
15129: <li>
1.14 xtraeme 15130: <p>Run <span><strong class=
1.45 wiz 15131: "command">make</strong></span> in <code xmlns=
15132: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15133: "filename">pkgsrc/doc/guide</code> to build the HTML
15134: and ASCII version.</p>
1.2 hubertf 15135: </li>
15136:
15137: <li>
1.14 xtraeme 15138: <p>If all is well, run <span><strong class=
15139: "command">make install-doc</strong></span> to put the
1.45 wiz 15140: generated files into <code xmlns=
15141: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15142: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 15143: </li>
15144:
15145: <li>
1.14 xtraeme 15146: <p><span><strong class="command">cvs commit
15147: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 15148: </li>
15149:
15150: <li>
1.14 xtraeme 15151: <p><span><strong class="command">cvs commit -m
15152: re-generate
15153: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 15154: </li>
1.4 hubertf 15155:
15156: <li>
15157: <p>Until the webserver on www.NetBSD.org is really
15158: updated automatically to pick up changes to the
1.14 xtraeme 15159: pkgsrc guide automatically, also run
1.18 xtraeme 15160: <span><strong class="command">make install-htdocs
1.14 xtraeme 15161: HTDOCSDIR=../../../htdocs</strong></span> (or
15162: similar, adjust <code class=
15163: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 15164: </li>
15165:
15166: <li>
1.14 xtraeme 15167: <p><span><strong class="command">cvs commit
15168: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 15169: </li>
1.2 hubertf 15170: </ul>
15171: </div>
15172: </div>
15173: </div>
1.1 grant 15174: </div>
15175: </body>
15176: </html>
CVSweb <webmaster@jp.NetBSD.org>