Annotation of pkgsrc/doc/pkgsrc.html, revision 1.70
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.67 hubertf 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.67 hubertf 18: <div class="book" lang="en">
1.1 grant 19: <div class="titlepage">
20: <div>
21: <div>
1.67 hubertf 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.69 rillig 69: <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.12
70: 2006/02/18 01:46:43 rillig 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
1.59 rillig 117: to get pkgsrc and how to keep it
118: up-to-date</a></span></dt>
1.1 grant 119:
120: <dd>
121: <dl>
1.30 wiz 122: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1 grant 123: As tar file</a></span></dt>
124:
1.30 wiz 125: <dt><span class="sect1"><a href="#via-sup">2.2. Via
126: SUP</a></span></dt>
1.1 grant 127:
1.30 wiz 128: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
129: CVS</a></span></dt>
1.59 rillig 130:
131: <dt><span class="sect1"><a href=
132: "#uptodate-cvs">2.4. Keeping pkgsrc up-to-date via
133: CVS</a></span></dt>
1.1 grant 134: </dl>
135: </dd>
136:
137: <dt><span class="chapter"><a href="#platforms">3. Using
138: pkgsrc on systems other than NetBSD</a></span></dt>
139:
140: <dd>
141: <dl>
1.30 wiz 142: <dt><span class="sect1"><a href=
143: "#bootstrapping-pkgsrc">3.1. Bootstrapping
144: pkgsrc</a></span></dt>
1.1 grant 145:
1.30 wiz 146: <dt><span class="sect1"><a href=
1.47 reed 147: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 148: notes</a></span></dt>
1.1 grant 149:
150: <dd>
151: <dl>
152: <dt><span class="sect2"><a href=
1.30 wiz 153: "#darwin">3.2.1. Darwin (Mac OS
1.1 grant 154: X)</a></span></dt>
155:
156: <dt><span class="sect2"><a href=
1.30 wiz 157: "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1 grant 158:
159: <dt><span class="sect2"><a href=
1.30 wiz 160: "#interix">3.2.3. Interix</a></span></dt>
1.1 grant 161:
1.30 wiz 162: <dt><span class="sect2"><a href="#irix">3.2.4.
163: IRIX</a></span></dt>
1.1 grant 164:
1.30 wiz 165: <dt><span class="sect2"><a href="#linux">3.2.5.
166: Linux</a></span></dt>
1.1 grant 167:
168: <dt><span class="sect2"><a href=
1.30 wiz 169: "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22 tv 170:
171: <dt><span class="sect2"><a href=
1.30 wiz 172: "#solaris">3.2.7. Solaris</a></span></dt>
1.1 grant 173: </dl>
174: </dd>
175: </dl>
176: </dd>
177:
178: <dt><span class="chapter"><a href="#using">4. Using
179: pkgsrc</a></span></dt>
180:
181: <dd>
182: <dl>
1.70 ! rillig 183: <dt><span class="sect1"><a href="#using-pkg">4.1.
! 184: Using binary packages</a></span></dt>
1.1 grant 185:
186: <dd>
187: <dl>
188: <dt><span class="sect2"><a href=
1.70 ! rillig 189: "#finding-binary-packages">4.1.1. Finding
! 190: binary packages</a></span></dt>
1.1 grant 191:
192: <dt><span class="sect2"><a href=
1.70 ! rillig 193: "#installing-binary-packages">4.1.2. Installing
1.30 wiz 194: binary packages</a></span></dt>
1.1 grant 195:
196: <dt><span class="sect2"><a href=
1.30 wiz 197: "#a-word-of-warning">4.1.3. A word of
1.1 grant 198: warning</a></span></dt>
199: </dl>
200: </dd>
201:
1.30 wiz 202: <dt><span class="sect1"><a href=
203: "#building-packages-from-source">4.2. Building
204: packages from source</a></span></dt>
1.1 grant 205:
206: <dd>
207: <dl>
208: <dt><span class="sect2"><a href=
1.30 wiz 209: "#requirements">4.2.1.
1.1 grant 210: Requirements</a></span></dt>
211:
212: <dt><span class="sect2"><a href=
1.30 wiz 213: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 214: distfiles</a></span></dt>
215:
216: <dt><span class="sect2"><a href=
1.30 wiz 217: "#how-to-build-and-install">4.2.3. How to build
218: and install</a></span></dt>
1.1 grant 219:
220: <dt><span class="sect2"><a href=
1.30 wiz 221: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 222: compiler</a></span></dt>
223: </dl>
224: </dd>
225: </dl>
226: </dd>
227:
1.38 dillo 228: <dt><span class="chapter"><a href="#configuring">5.
229: Configuring pkgsrc</a></span></dt>
230:
231: <dd>
232: <dl>
233: <dt><span class="sect1"><a href=
1.45 wiz 234: "#general-configuration">5.1. General
235: configuration</a></span></dt>
236:
237: <dt><span class="sect1"><a href=
238: "#variables-affecting-build">5.2. Variables
239: affecting the build process</a></span></dt>
240:
241: <dt><span class="sect1"><a href=
242: "#developer-advanced-settings">5.3.
243: Developer/advanced settings</a></span></dt>
244:
245: <dt><span class="sect1"><a href=
246: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 247: Options</a></span></dt>
1.38 dillo 248: </dl>
249: </dd>
250:
251: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 252: binary packages</a></span></dt>
253:
254: <dd>
255: <dl>
1.30 wiz 256: <dt><span class="sect1"><a href=
1.38 dillo 257: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 258: single binary package</a></span></dt>
1.1 grant 259:
1.30 wiz 260: <dt><span class="sect1"><a href=
1.38 dillo 261: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 262: Settings for creation of binary
263: packages</a></span></dt>
264:
1.38 dillo 265: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 266: Doing a bulk build of all packages</a></span></dt>
267:
268: <dd>
269: <dl>
270: <dt><span class="sect2"><a href=
1.38 dillo 271: "#binary.configuration">6.3.1.
1.1 grant 272: Configuration</a></span></dt>
273:
274: <dt><span class="sect2"><a href=
1.38 dillo 275: "#other-environmental-considerations">6.3.2.
1.30 wiz 276: Other environmental
1.1 grant 277: considerations</a></span></dt>
278:
279: <dt><span class="sect2"><a href=
1.38 dillo 280: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 281:
282: <dt><span class="sect2"><a href=
1.38 dillo 283: "#what-it-does">6.3.4. What it
1.1 grant 284: does</a></span></dt>
285:
286: <dt><span class="sect2"><a href=
1.38 dillo 287: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 288: requirements</a></span></dt>
289:
290: <dt><span class="sect2"><a href=
1.38 dillo 291: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 292: sandbox for chrooted builds</a></span></dt>
1.1 grant 293:
294: <dt><span class="sect2"><a href=
1.38 dillo 295: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 296: partial set of packages</a></span></dt>
1.13 hubertf 297:
298: <dt><span class="sect2"><a href=
1.38 dillo 299: "#bulk-upload">6.3.8. Uploading results of a
1.13 hubertf 300: bulk build</a></span></dt>
1.1 grant 301: </dl>
302: </dd>
303:
1.30 wiz 304: <dt><span class="sect1"><a href=
1.38 dillo 305: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 306: packages collection</a></span></dt>
1.1 grant 307:
308: <dd>
309: <dl>
310: <dt><span class="sect2"><a href=
1.38 dillo 311: "#cdpack-example">6.4.1. Example of
1.1 grant 312: cdpack</a></span></dt>
313: </dl>
314: </dd>
315: </dl>
316: </dd>
317:
1.38 dillo 318: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 319: Asked Questions</a></span></dt>
320:
321: <dd>
322: <dl>
1.30 wiz 323: <dt><span class="sect1"><a href=
1.38 dillo 324: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 325: lists for pkg-related discussion?</a></span></dt>
1.1 grant 326:
1.30 wiz 327: <dt><span class="sect1"><a href=
1.38 dillo 328: "#pkgviews-docs">7.2. Where's the pkgviews
1.30 wiz 329: documentation?</a></span></dt>
1.1 grant 330:
1.5 hubertf 331: <dt><span class="sect1"><a href=
1.38 dillo 332: "#faq-pkgtools">7.3. Utilities for package
1.5 hubertf 333: management (pkgtools)</a></span></dt>
1.1 grant 334:
1.30 wiz 335: <dt><span class="sect1"><a href=
1.38 dillo 336: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 337: non-root</a></span></dt>
338:
339: <dt><span class="sect1"><a href=
1.38 dillo 340: "#resume-transfers">7.5. How to resume transfers
1.30 wiz 341: when fetching distfiles?</a></span></dt>
342:
343: <dt><span class="sect1"><a href=
1.38 dillo 344: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 345: XFree86 from pkgsrc?</a></span></dt>
346:
347: <dt><span class="sect1"><a href=
1.38 dillo 348: "#x.org-from-pkgsrc">7.7. How can I install/use
1.30 wiz 349: X.org from pkgsrc?</a></span></dt>
1.1 grant 350:
1.30 wiz 351: <dt><span class="sect1"><a href=
1.38 dillo 352: "#fetch-behind-firewall">7.8. How to fetch files
1.30 wiz 353: from behind a firewall</a></span></dt>
1.1 grant 354:
1.38 dillo 355: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.14 xtraeme 356: How do I tell <span><strong class="command">make
357: fetch</strong></span> to do passive
1.1 grant 358: FTP?</a></span></dt>
359:
1.30 wiz 360: <dt><span class="sect1"><a href=
1.38 dillo 361: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 362: distfiles at once</a></span></dt>
1.1 grant 363:
1.30 wiz 364: <dt><span class="sect1"><a href=
1.38 dillo 365: "#tmac.andoc-missing">7.11. What does
1.30 wiz 366: “<span class="quote">Don't know how to make
367: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 368: mean?</a></span></dt>
1.13 hubertf 369:
1.30 wiz 370: <dt><span class="sect1"><a href=
1.38 dillo 371: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 372: “<span class="quote">Could not find
1.14 xtraeme 373: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 374:
1.30 wiz 375: <dt><span class="sect1"><a href=
1.38 dillo 376: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 377: pkgsrc</a></span></dt>
1.1 grant 378:
1.38 dillo 379: <dt><span class="sect1"><a href="#faq.conf">7.14.
1.35 jmmv 380: How do I change the location of configuration
381: files?</a></span></dt>
1.1 grant 382:
383: <dt><span class="sect1"><a href=
1.38 dillo 384: "#audit-packages">7.15. Automated security
1.1 grant 385: checks</a></span></dt>
386: </dl>
387: </dd>
388: </dl>
389: </dd>
390:
1.46 gdt 391: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 392: pkgsrc developer's guide</a></span></dt>
393:
394: <dd>
395: <dl>
1.38 dillo 396: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 397: Package components - files, directories and
398: contents</a></span></dt>
399:
400: <dd>
401: <dl>
402: <dt><span class="sect1"><a href=
1.45 wiz 403: "#components.Makefile">8.1. <code xmlns=
404: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 405: "filename">Makefile</code></a></span></dt>
406:
407: <dt><span class="sect1"><a href=
1.45 wiz 408: "#components.distinfo">8.2. <code xmlns=
409: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 410: "filename">distinfo</code></a></span></dt>
411:
412: <dt><span class="sect1"><a href=
1.38 dillo 413: "#components.patches">8.3.
1.27 rillig 414: patches/*</a></span></dt>
415:
1.30 wiz 416: <dt><span class="sect1"><a href=
1.38 dillo 417: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 418: files</a></span></dt>
1.27 rillig 419:
420: <dt><span class="sect1"><a href=
1.38 dillo 421: "#components.optional">8.5. Optional
1.27 rillig 422: files</a></span></dt>
423:
1.38 dillo 424: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 425: <code xmlns=
426: "http://www.w3.org/TR/xhtml1/transitional" class=
427: "filename">work*</code></a></span></dt>
1.27 rillig 428:
1.38 dillo 429: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 430: <code xmlns=
431: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 432: "filename">files/*</code></a></span></dt>
433: </dl>
434: </dd>
435:
1.38 dillo 436: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 437: Programming in <code xmlns=
438: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 439: "filename">Makefile</code>s</a></span></dt>
440:
441: <dd>
442: <dl>
443: <dt><span class="sect1"><a href=
1.45 wiz 444: "#makefile.variables">9.1. <code xmlns=
445: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 446: "filename">Makefile</code>
447: variables</a></span></dt>
448:
1.27 rillig 449: <dd>
450: <dl>
451: <dt><span class="sect2"><a href=
1.38 dillo 452: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 453: conventions</a></span></dt>
454: </dl>
455: </dd>
456:
1.25 rillig 457: <dt><span class="sect1"><a href=
1.38 dillo 458: "#makefile.code">9.2. Code snippets</a></span></dt>
1.25 rillig 459:
460: <dd>
461: <dl>
462: <dt><span class="sect2"><a href=
1.38 dillo 463: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 464: list</a></span></dt>
465:
466: <dt><span class="sect2"><a href=
1.38 dillo 467: "#converting-internal-to-external">9.2.2.
1.30 wiz 468: Converting an internal list into an external
469: list</a></span></dt>
1.25 rillig 470:
471: <dt><span class="sect2"><a href=
1.38 dillo 472: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 473: variables to a shell command</a></span></dt>
1.27 rillig 474:
475: <dt><span class="sect2"><a href=
1.38 dillo 476: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 477: guideline</a></span></dt>
478:
479: <dt><span class="sect2"><a href=
1.38 dillo 480: "#bsd-make-bug-workaround">9.2.5. Workaround
1.30 wiz 481: for a bug in BSD Make</a></span></dt>
1.25 rillig 482: </dl>
483: </dd>
484: </dl>
485: </dd>
486:
1.38 dillo 487: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 488: issues</a></span></dt>
489:
490: <dd>
491: <dl>
1.38 dillo 492: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.30 wiz 493: ID</a></span></dt>
1.1 grant 494:
1.30 wiz 495: <dt><span class="sect1"><a href=
1.38 dillo 496: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 497: <code xmlns=
498: "http://www.w3.org/TR/xhtml1/transitional" class=
499: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 500:
1.38 dillo 501: <dt><span class="sect1"><a href=
502: "#print-PLIST">10.3. Tweaking output of
503: <span><strong class="command">make
1.14 xtraeme 504: print-PLIST</strong></span></a></span></dt>
1.1 grant 505:
1.38 dillo 506: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 507: Variable substitution in PLIST</a></span></dt>
508:
1.30 wiz 509: <dt><span class="sect1"><a href=
1.48 dillo 510: "#manpage-compression">10.5. Man page
511: compression</a></span></dt>
1.1 grant 512:
1.30 wiz 513: <dt><span class="sect1"><a href=
1.38 dillo 514: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 515: <code class=
1.14 xtraeme 516: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 517:
1.30 wiz 518: <dt><span class="sect1"><a href=
1.47 reed 519: "#platform-specific-plist">10.7. Platform-specific
1.30 wiz 520: and differing PLISTs</a></span></dt>
1.1 grant 521:
522: <dt><span class="sect1"><a href=
1.38 dillo 523: "#faq.common-dirs">10.8. Sharing directories
524: between packages</a></span></dt>
1.1 grant 525: </dl>
526: </dd>
527:
1.38 dillo 528: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 529: Buildlink methodology</a></span></dt>
530:
531: <dd>
532: <dl>
1.30 wiz 533: <dt><span class="sect1"><a href=
1.38 dillo 534: "#converting-to-buildlink3">11.1. Converting
1.30 wiz 535: packages to use buildlink3</a></span></dt>
1.1 grant 536:
1.30 wiz 537: <dt><span class="sect1"><a href=
1.38 dillo 538: "#creating-buildlink3.mk">11.2. Writing
1.45 wiz 539: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
540: class="filename">buildlink3.mk</code>
1.14 xtraeme 541: files</a></span></dt>
1.1 grant 542:
543: <dd>
544: <dl>
545: <dt><span class="sect2"><a href=
1.38 dillo 546: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 547: buildlink3.mk file</a></span></dt>
1.1 grant 548:
549: <dt><span class="sect2"><a href=
1.38 dillo 550: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 551: <code class=
1.14 xtraeme 552: "varname">BUILDLINK_DEPENDS.<em class=
553: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 554: <code xmlns=
555: "http://www.w3.org/TR/xhtml1/transitional"
556: class="filename">buildlink3.mk</code>
1.1 grant 557: files</a></span></dt>
558: </dl>
559: </dd>
560:
1.30 wiz 561: <dt><span class="sect1"><a href=
1.45 wiz 562: "#writing-builtin.mk">11.3. Writing <code xmlns=
563: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 564: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 565:
566: <dd>
567: <dl>
568: <dt><span class="sect2"><a href=
1.38 dillo 569: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 570: <code xmlns=
571: "http://www.w3.org/TR/xhtml1/transitional"
572: class="filename">builtin.mk</code>
1.1 grant 573: file</a></span></dt>
574:
575: <dt><span class="sect2"><a href=
1.38 dillo 576: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 577: preferences for native or pkgsrc
578: software</a></span></dt>
1.1 grant 579: </dl>
580: </dd>
581: </dl>
582: </dd>
583:
1.38 dillo 584: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 585: pkginstall framework</a></span></dt>
586:
587: <dd>
588: <dl>
589: <dt><span class="sect1"><a href=
1.38 dillo 590: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 591: directories outside the installation
592: prefix</a></span></dt>
593:
594: <dd>
595: <dl>
596: <dt><span class="sect2"><a href=
1.38 dillo 597: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 598: manipulation</a></span></dt>
599:
600: <dt><span class="sect2"><a href=
1.38 dillo 601: "#files-outside-prefix">12.1.2. File
1.35 jmmv 602: manipulation</a></span></dt>
603: </dl>
604: </dd>
605:
1.38 dillo 606: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 607: Configuration files</a></span></dt>
608:
609: <dd>
610: <dl>
611: <dt><span class="sect2"><a href=
1.38 dillo 612: "#conf-files-sysconfdir">12.2.1. How
1.35 jmmv 613: <code class="varname">PKG_SYSCONFDIR</code> is
614: set</a></span></dt>
615:
616: <dt><span class="sect2"><a href=
1.38 dillo 617: "#conf-files-configure">12.2.2. Telling the
1.47 reed 618: software where configuration files
1.35 jmmv 619: are</a></span></dt>
620:
621: <dt><span class="sect2"><a href=
1.38 dillo 622: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 623: installations</a></span></dt>
624:
625: <dt><span class="sect2"><a href=
1.38 dillo 626: "#conf-files-disable">12.2.4. Disabling
1.35 jmmv 627: handling of configuration files</a></span></dt>
628: </dl>
629: </dd>
630:
631: <dt><span class="sect1"><a href=
1.38 dillo 632: "#rcd-scripts">12.3. System startup
1.35 jmmv 633: scripts</a></span></dt>
634:
635: <dd>
636: <dl>
637: <dt><span class="sect2"><a href=
1.38 dillo 638: "#rcd-scripts-disable">12.3.1. Disabling
1.35 jmmv 639: handling of system startup
640: scripts</a></span></dt>
641: </dl>
642: </dd>
643:
644: <dt><span class="sect1"><a href=
1.38 dillo 645: "#users-and-groups">12.4. System users and
1.35 jmmv 646: groups</a></span></dt>
647:
1.38 dillo 648: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 649: System shells</a></span></dt>
650:
651: <dd>
652: <dl>
653: <dt><span class="sect2"><a href=
1.65 hubertf 654: "#shells-disable">12.5.1. Disabling shell
655: registration</a></span></dt>
656: </dl>
657: </dd>
658:
659: <dt><span class="sect1"><a href="#fonts">12.6.
660: Fonts</a></span></dt>
661:
662: <dd>
663: <dl>
664: <dt><span class="sect2"><a href=
665: "#fonts-disable">12.6.1. Disabling automatic
666: update of the fonts databases</a></span></dt>
1.35 jmmv 667: </dl>
668: </dd>
669: </dl>
670: </dd>
671:
1.38 dillo 672: <dt><span class="chapter"><a href="#options">13.
1.1 grant 673: Options handling</a></span></dt>
674:
675: <dd>
676: <dl>
1.30 wiz 677: <dt><span class="sect1"><a href=
1.38 dillo 678: "#global-default-options">13.1. Global default
1.30 wiz 679: options</a></span></dt>
1.1 grant 680:
1.30 wiz 681: <dt><span class="sect1"><a href=
1.38 dillo 682: "#converting-to-options">13.2. Converting packages
1.45 wiz 683: to use <code xmlns=
684: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 685: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 686:
687: <dt><span class="sect1"><a href=
688: "#option-names">13.3. Option Names</a></span></dt>
1.1 grant 689: </dl>
690: </dd>
691:
1.38 dillo 692: <dt><span class="chapter"><a href="#build">14. The
1.1 grant 693: build process</a></span></dt>
694:
695: <dd>
696: <dl>
697: <dt><span class="sect1"><a href=
1.56 rillig 698: "#build.intro">14.1. Introduction</a></span></dt>
699:
700: <dt><span class="sect1"><a href=
701: "#build.prefix">14.2. Program
1.1 grant 702: location</a></span></dt>
703:
1.30 wiz 704: <dt><span class="sect1"><a href=
1.56 rillig 705: "#build.builddirs">14.3. Directories used during
706: the build process</a></span></dt>
707:
708: <dt><span class="sect1"><a href=
709: "#build.running">14.4. Running a
710: phase</a></span></dt>
711:
712: <dt><span class="sect1"><a href=
713: "#build.fetch">14.5. The <span class=
714: "emphasis"><em>fetch</em></span>
715: phase</a></span></dt>
716:
717: <dt><span class="sect1"><a href=
718: "#build.checksum">14.6. The <span class=
719: "emphasis"><em>checksum</em></span>
720: phase</a></span></dt>
721:
722: <dt><span class="sect1"><a href=
723: "#build.extract">14.7. The <span class=
724: "emphasis"><em>extract</em></span>
725: phase</a></span></dt>
726:
727: <dt><span class="sect1"><a href=
728: "#build.patch">14.8. The <span class=
729: "emphasis"><em>patch</em></span>
730: phase</a></span></dt>
731:
732: <dt><span class="sect1"><a href=
733: "#build.tools">14.9. The <span class=
734: "emphasis"><em>tools</em></span>
735: phase</a></span></dt>
736:
737: <dt><span class="sect1"><a href=
738: "#build.wrapper">14.10. The <span class=
739: "emphasis"><em>wrapper</em></span>
740: phase</a></span></dt>
741:
742: <dt><span class="sect1"><a href=
743: "#build.configure">14.11. The <span class=
744: "emphasis"><em>configure</em></span>
745: phase</a></span></dt>
746:
747: <dt><span class="sect1"><a href=
748: "#build.build">14.12. The <span class=
749: "emphasis"><em>build</em></span>
750: phase</a></span></dt>
751:
752: <dt><span class="sect1"><a href=
753: "#build.test">14.13. The <span class=
754: "emphasis"><em>test</em></span>
755: phase</a></span></dt>
756:
757: <dt><span class="sect1"><a href=
758: "#build.install">14.14. The <span class=
759: "emphasis"><em>install</em></span>
760: phase</a></span></dt>
1.1 grant 761:
762: <dt><span class="sect1"><a href=
1.56 rillig 763: "#build.package">14.15. The <span class=
764: "emphasis"><em>package</em></span>
765: phase</a></span></dt>
766:
767: <dt><span class="sect1"><a href=
768: "#build.helpful-targets">14.16. Other helpful
1.1 grant 769: targets</a></span></dt>
770: </dl>
771: </dd>
772:
1.68 rillig 773: <dt><span class="chapter"><a href="#tools">15. Tools
774: needed for building or running</a></span></dt>
775:
776: <dd>
777: <dl>
778: <dt><span class="sect1"><a href=
779: "#pkgsrc-tools">15.1. Tools for pkgsrc
780: builds</a></span></dt>
781:
782: <dt><span class="sect1"><a href=
783: "#package-tools">15.2. Tools needed by
784: packages</a></span></dt>
785:
786: <dt><span class="sect1"><a href=
787: "#platform-tools">15.3. Tools provided by
788: platforms</a></span></dt>
789: </dl>
790: </dd>
791:
792: <dt><span class="chapter"><a href="#fixes">16. Making
1.55 rillig 793: your package work</a></span></dt>
1.1 grant 794:
795: <dd>
796: <dl>
1.30 wiz 797: <dt><span class="sect1"><a href=
1.68 rillig 798: "#general-operation">16.1. General
1.30 wiz 799: operation</a></span></dt>
1.1 grant 800:
801: <dd>
802: <dl>
803: <dt><span class="sect2"><a href=
1.68 rillig 804: "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30 wiz 805: pull in variables from
806: /etc/mk.conf</a></span></dt>
1.1 grant 807:
808: <dt><span class="sect2"><a href=
1.68 rillig 809: "#where-to-install-documentation">16.1.2. Where
1.31 wiz 810: to install documentation</a></span></dt>
811:
812: <dt><span class="sect2"><a href=
1.68 rillig 813: "#restricted-packages">16.1.3. Restricted
1.1 grant 814: packages</a></span></dt>
815:
816: <dt><span class="sect2"><a href=
1.68 rillig 817: "#dependencies">16.1.4. Handling
1.1 grant 818: dependencies</a></span></dt>
819:
820: <dt><span class="sect2"><a href=
1.68 rillig 821: "#conflicts">16.1.5. Handling conflicts with
1.1 grant 822: other packages</a></span></dt>
823:
824: <dt><span class="sect2"><a href=
1.68 rillig 825: "#not-building-packages">16.1.6. Packages that
1.30 wiz 826: cannot or should not be built</a></span></dt>
1.1 grant 827:
828: <dt><span class="sect2"><a href=
1.68 rillig 829: "#undeletable-packages">16.1.7. Packages which
1.30 wiz 830: should not be deleted, once
831: installed</a></span></dt>
1.1 grant 832:
833: <dt><span class="sect2"><a href=
1.68 rillig 834: "#security-handling">16.1.8. Handling packages
1.1 grant 835: with security problems</a></span></dt>
836:
837: <dt><span class="sect2"><a href=
1.68 rillig 838: "#compiler-bugs">16.1.9. How to handle compiler
1.1 grant 839: bugs</a></span></dt>
840:
841: <dt><span class="sect2"><a href=
1.68 rillig 842: "#bumping-pkgrevision">16.1.10. How to handle
1.30 wiz 843: incrementing versions when fixing an existing
1.1 grant 844: package</a></span></dt>
845:
846: <dt><span class="sect2"><a href=
1.68 rillig 847: "#portability-of-packages">16.1.11. Portability
1.30 wiz 848: of packages</a></span></dt>
1.1 grant 849: </dl>
850: </dd>
851:
1.30 wiz 852: <dt><span class="sect1"><a href=
1.68 rillig 853: "#downloading-issues">16.2. Possible downloading
1.30 wiz 854: issues</a></span></dt>
1.1 grant 855:
856: <dd>
857: <dl>
858: <dt><span class="sect2"><a href=
1.68 rillig 859: "#no-plain-download">16.2.1. Packages whose
1.30 wiz 860: distfiles aren't available for plain
1.1 grant 861: downloading</a></span></dt>
862:
863: <dt><span class="sect2"><a href=
1.68 rillig 864: "#modified-distfiles-same-name">16.2.2. How to
1.30 wiz 865: handle modified distfiles with the 'old'
866: name</a></span></dt>
1.1 grant 867: </dl>
868: </dd>
869:
1.30 wiz 870: <dt><span class="sect1"><a href=
1.68 rillig 871: "#configuration-gotchas">16.3. Configuration
1.30 wiz 872: gotchas</a></span></dt>
1.1 grant 873:
874: <dd>
875: <dl>
876: <dt><span class="sect2"><a href=
1.68 rillig 877: "#fixes.libtool">16.3.1. Shared libraries -
1.1 grant 878: libtool</a></span></dt>
879:
880: <dt><span class="sect2"><a href=
1.68 rillig 881: "#using-libtool">16.3.2. Using libtool on GNU
1.1 grant 882: packages that already support
883: libtool</a></span></dt>
884:
885: <dt><span class="sect2"><a href=
1.68 rillig 886: "#autoconf-automake">16.3.3. GNU
1.1 grant 887: Autoconf/Automake</a></span></dt>
888: </dl>
889: </dd>
890:
1.30 wiz 891: <dt><span class="sect1"><a href=
1.68 rillig 892: "#fixes-build">16.4. Building the
1.55 rillig 893: package</a></span></dt>
1.1 grant 894:
895: <dd>
896: <dl>
897: <dt><span class="sect2"><a href=
1.68 rillig 898: "#cpp-defines">16.4.1. CPP
1.1 grant 899: defines</a></span></dt>
1.51 rillig 900:
901: <dt><span class="sect2"><a href=
1.68 rillig 902: "#cpp-list-examples">16.4.2. Examples of CPP
1.60 rillig 903: defines for some platforms</a></span></dt>
904:
905: <dt><span class="sect2"><a href=
1.68 rillig 906: "#cpp-list">16.4.3. Getting a list of CPP
1.51 rillig 907: defines</a></span></dt>
1.1 grant 908: </dl>
909: </dd>
910:
1.30 wiz 911: <dt><span class="sect1"><a href=
1.68 rillig 912: "#package-specific-actions">16.5. Package specific
1.30 wiz 913: actions</a></span></dt>
1.1 grant 914:
915: <dd>
916: <dl>
917: <dt><span class="sect2"><a href=
1.68 rillig 918: "#user-interaction">16.5.1. User
1.2 hubertf 919: interaction</a></span></dt>
1.1 grant 920:
921: <dt><span class="sect2"><a href=
1.68 rillig 922: "#handling-licenses">16.5.2. Handling
1.1 grant 923: licenses</a></span></dt>
924:
925: <dt><span class="sect2"><a href=
1.68 rillig 926: "#installing-score-files">16.5.3. Installing
1.30 wiz 927: score files</a></span></dt>
1.1 grant 928:
929: <dt><span class="sect2"><a href=
1.68 rillig 930: "#perl-scripts">16.5.4. Packages containing
1.30 wiz 931: perl scripts</a></span></dt>
1.1 grant 932:
933: <dt><span class="sect2"><a href=
1.68 rillig 934: "#hardcoded-paths">16.5.5. Packages with
1.30 wiz 935: hardcoded paths to other
936: interpreters</a></span></dt>
1.1 grant 937:
938: <dt><span class="sect2"><a href=
1.68 rillig 939: "#perl-modules">16.5.6. Packages installing
1.30 wiz 940: perl modules</a></span></dt>
1.1 grant 941:
942: <dt><span class="sect2"><a href=
1.68 rillig 943: "#faq.info-files">16.5.7. Packages installing
1.1 grant 944: info files</a></span></dt>
945:
946: <dt><span class="sect2"><a href=
1.68 rillig 947: "#manpages">16.5.8. Packages installing man
1.57 minskim 948: pages</a></span></dt>
949:
950: <dt><span class="sect2"><a href=
1.68 rillig 951: "#gconf2-data-files">16.5.9. Packages
1.30 wiz 952: installing GConf2 data files</a></span></dt>
1.1 grant 953:
954: <dt><span class="sect2"><a href=
1.68 rillig 955: "#scrollkeeper-data-files">16.5.10. Packages
1.30 wiz 956: installing scrollkeeper data
957: files</a></span></dt>
1.1 grant 958:
959: <dt><span class="sect2"><a href=
1.68 rillig 960: "#x11-fonts">16.5.11. Packages installing X11
1.1 grant 961: fonts</a></span></dt>
962:
963: <dt><span class="sect2"><a href=
1.68 rillig 964: "#gtk2-modules">16.5.12. Packages installing
1.30 wiz 965: GTK2 modules</a></span></dt>
1.1 grant 966:
967: <dt><span class="sect2"><a href=
1.68 rillig 968: "#sgml-xml-data">16.5.13. Packages installing
1.30 wiz 969: SGML or XML data</a></span></dt>
1.1 grant 970:
971: <dt><span class="sect2"><a href=
1.68 rillig 972: "#mime-database">16.5.14. Packages installing
1.1 grant 973: extensions to the MIME database</a></span></dt>
974:
975: <dt><span class="sect2"><a href=
1.68 rillig 976: "#intltool">16.5.15. Packages using
1.1 grant 977: intltool</a></span></dt>
1.18 xtraeme 978:
979: <dt><span class="sect2"><a href=
1.68 rillig 980: "#startup-scripts">16.5.16. Packages installing
1.18 xtraeme 981: startup scripts</a></span></dt>
1.57 minskim 982:
983: <dt><span class="sect2"><a href=
1.68 rillig 984: "#tex-packages">16.5.17. Packages installing
1.57 minskim 985: TeX modules</a></span></dt>
1.1 grant 986: </dl>
987: </dd>
988:
1.30 wiz 989: <dt><span class="sect1"><a href=
1.68 rillig 990: "#feedback-to-author">16.6. Feedback to the
1.30 wiz 991: author</a></span></dt>
1.1 grant 992: </dl>
993: </dd>
994:
1.68 rillig 995: <dt><span class="chapter"><a href="#debug">17.
1.1 grant 996: Debugging</a></span></dt>
997:
1.68 rillig 998: <dt><span class="chapter"><a href="#submit">18.
1.1 grant 999: Submitting and Committing</a></span></dt>
1000:
1001: <dd>
1002: <dl>
1.30 wiz 1003: <dt><span class="sect1"><a href=
1.68 rillig 1004: "#submitting-your-package">18.1. Submitting your
1.30 wiz 1005: packages</a></span></dt>
1.1 grant 1006:
1.30 wiz 1007: <dt><span class="sect1"><a href=
1.68 rillig 1008: "#general-notes-for-changes">18.2. General notes
1.41 wiz 1009: when adding, updating, or removing
1010: packages</a></span></dt>
1011:
1012: <dt><span class="sect1"><a href=
1.68 rillig 1013: "#committing-importing">18.3. Committing: Importing
1.30 wiz 1014: a package into CVS</a></span></dt>
1.1 grant 1015:
1.30 wiz 1016: <dt><span class="sect1"><a href=
1.68 rillig 1017: "#updating-package">18.4. Updating a package to a
1.30 wiz 1018: newer version</a></span></dt>
1.1 grant 1019:
1.30 wiz 1020: <dt><span class="sect1"><a href=
1.68 rillig 1021: "#moving-package">18.5. Moving a package in
1.30 wiz 1022: pkgsrc</a></span></dt>
1.1 grant 1023: </dl>
1024: </dd>
1.69 rillig 1025:
1026: <dt><span class="chapter"><a href="#porting">19.
1027: Porting pkgsrc</a></span></dt>
1028:
1029: <dd>
1030: <dl>
1031: <dt><span class="sect1"><a href=
1032: "#porting.opsys">19.1. Porting pkgsrc to a new
1033: operating system</a></span></dt>
1034:
1035: <dt><span class="sect1"><a href=
1036: "#porting.compiler">19.2. Adding support for a new
1037: compiler</a></span></dt>
1038: </dl>
1039: </dd>
1.1 grant 1040: </dl>
1041: </dd>
1042:
1.46 gdt 1043: <dt><span class="appendix"><a href="#examples">A. A simple
1.1 grant 1044: example package: bison</a></span></dt>
1045:
1046: <dd>
1047: <dl>
1.46 gdt 1048: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 1049: files</a></span></dt>
1050:
1051: <dd>
1052: <dl>
1.30 wiz 1053: <dt><span class="sect2"><a href=
1.46 gdt 1054: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 1055:
1.30 wiz 1056: <dt><span class="sect2"><a href=
1.46 gdt 1057: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 1058:
1.30 wiz 1059: <dt><span class="sect2"><a href=
1.46 gdt 1060: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 1061:
1.30 wiz 1062: <dt><span class="sect2"><a href=
1.46 gdt 1063: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 1064: package with <span><strong class=
1.14 xtraeme 1065: "command">pkglint</strong></span></a></span></dt>
1.1 grant 1066: </dl>
1067: </dd>
1068:
1.46 gdt 1069: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 1070: Steps for building, installing,
1071: packaging</a></span></dt>
1.1 grant 1072: </dl>
1073: </dd>
1074:
1.46 gdt 1075: <dt><span class="appendix"><a href="#logs">B. Build
1.1 grant 1076: logs</a></span></dt>
1077:
1078: <dd>
1079: <dl>
1.46 gdt 1080: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 1081: Building figlet</a></span></dt>
1082:
1.46 gdt 1083: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 1084: Packaging figlet</a></span></dt>
1085: </dl>
1086: </dd>
1087:
1.46 gdt 1088: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1 grant 1089: of the FTP server's package archive</a></span></dt>
1.2 hubertf 1090:
1.46 gdt 1091: <dt><span class="appendix"><a href="#editing">D. Editing
1.2 hubertf 1092: guidelines for the pkgsrc guide</a></span></dt>
1093:
1094: <dd>
1095: <dl>
1.46 gdt 1096: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 1097: Targets</a></span></dt>
1098:
1.46 gdt 1099: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 1100: Procedure</a></span></dt>
1101: </dl>
1102: </dd>
1.1 grant 1103: </dl>
1104: </div>
1105:
1.67 hubertf 1106: <div class="chapter" lang="en">
1.1 grant 1107: <div class="titlepage">
1108: <div>
1109: <div>
1.67 hubertf 1110: <h2 class="title"><a name=
1.51 rillig 1111: "introduction"></a>Chapter 1. What is
1112: pkgsrc?</h2>
1.1 grant 1113: </div>
1114: </div>
1115: </div>
1116:
1117: <div class="toc">
1118: <p><b>Table of Contents</b></p>
1119:
1120: <dl>
1.30 wiz 1121: <dt><span class="sect1"><a href=
1122: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 1123:
1124: <dt><span class="sect1"><a href="#overview">1.2.
1125: Overview</a></span></dt>
1126:
1127: <dt><span class="sect1"><a href="#terminology">1.3.
1128: Terminology</a></span></dt>
1129:
1130: <dt><span class="sect1"><a href="#typography">1.4.
1131: Typography</a></span></dt>
1132: </dl>
1133: </div>
1134:
1.67 hubertf 1135: <div class="sect1" lang="en">
1.1 grant 1136: <div class="titlepage">
1137: <div>
1138: <div>
1139: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1140: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 1141: </div>
1142: </div>
1143: </div>
1144:
1.47 reed 1145: <p>There is a lot of software freely available for
1146: Unix-based systems, which usually runs on NetBSD and other
1.1 grant 1147: Unix-flavoured systems, too, sometimes with some
1148: modifications. The NetBSD Packages Collection (pkgsrc)
1149: incorporates any such changes necessary to make that
1150: software run, and makes the installation (and
1151: de-installation) of the software package easy by means of a
1152: single command.</p>
1153:
1154: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 1155: the <span><strong class="command">pkg_*</strong></span>
1156: tools so that installation and de-installation, printing of
1157: an inventory of all installed packages and retrieval of
1158: one-line comments or more verbose descriptions are all
1159: simple.</p>
1.1 grant 1160:
1161: <p>pkgsrc currently contains several thousand packages,
1162: including:</p>
1163:
1164: <div class="itemizedlist">
1165: <ul type="disc">
1166: <li>
1167: <p><a xmlns=
1168: "http://www.w3.org/TR/xhtml1/transitional" href=
1169: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45 wiz 1170: target="_top"><code xmlns="" class=
1171: "filename">www/apache</code></a> - The Apache web
1.20 ben 1172: server</p>
1.1 grant 1173: </li>
1174:
1175: <li>
1176: <p><a xmlns=
1177: "http://www.w3.org/TR/xhtml1/transitional" href=
1178: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 1179: target="_top"><code xmlns="" class=
1180: "filename">www/mozilla</code></a> - The Mozilla web
1.20 ben 1181: browser</p>
1.1 grant 1182: </li>
1183:
1184: <li>
1185: <p><a xmlns=
1186: "http://www.w3.org/TR/xhtml1/transitional" href=
1187: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45 wiz 1188: target="_top"><code xmlns="" class=
1189: "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20 ben 1190: Desktop Environment</p>
1.1 grant 1191: </li>
1192:
1193: <li>
1194: <p><a xmlns=
1195: "http://www.w3.org/TR/xhtml1/transitional" href=
1196: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45 wiz 1197: target="_top"><code xmlns="" class=
1198: "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20 ben 1199: Environment</p>
1.1 grant 1200: </li>
1201: </ul>
1202: </div>
1203:
1204: <p>...just to name a few.</p>
1205:
1206: <p>pkgsrc has built-in support for handling varying
1207: dependencies, such as pthreads and X11, and extended
1208: features such as IPv6 support on a range of platforms.</p>
1209:
1210: <p>pkgsrc was derived from FreeBSD's ports system, and
1211: initially developed for NetBSD only. Since then, pkgsrc has
1212: grown a lot, and now supports the following platforms:</p>
1213:
1214: <div class="itemizedlist">
1215: <ul type="disc">
1216: <li>
1217: <p><a href="http://developer.apple.com/darwin/"
1218: target="_top">Darwin</a> (<a href=
1219: "http://www.apple.com/macosx/" target="_top">Mac OS
1220: X</a>)</p>
1221: </li>
1222:
1223: <li>
1.3 hubertf 1224: <p><a href="http://www.DragonFlyBSD.org/" target=
1.70 ! rillig 1225: "_top">DragonFly BSD</a></p>
1.3 hubertf 1226: </li>
1227:
1228: <li>
1.1 grant 1229: <p><a href="http://www.FreeBSD.org/" target=
1230: "_top">FreeBSD</a></p>
1231: </li>
1232:
1233: <li>
1.3 hubertf 1234: <p>Microsoft Windows, via <a href=
1235: "http://www.microsoft.com/windows/sfu/" target=
1236: "_top">Interix</a></p>
1.1 grant 1237: </li>
1238:
1239: <li>
1240: <p><a href="http://www.sgi.com/software/irix6.5/"
1241: target="_top">IRIX</a></p>
1242: </li>
1243:
1244: <li>
1245: <p><a href="http://www.linux.org/" target=
1246: "_top">Linux</a></p>
1247: </li>
1248:
1249: <li>
1250: <p><a href="http://www.NetBSD.org/" target=
1251: "_top">NetBSD</a> (of course)</p>
1252: </li>
1253:
1254: <li>
1.17 sketch 1255: <p><a href="http://h30097.www3.hp.com/" target=
1256: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1257: </li>
1258:
1259: <li>
1.1 grant 1260: <p><a href="http://www.openbsd.org/" target=
1261: "_top">OpenBSD</a></p>
1262: </li>
1263:
1264: <li>
1265: <p><a href="http://www.sun.com/solaris/" target=
1266: "_top">Solaris</a></p>
1267: </li>
1268: </ul>
1269: </div>
1270: </div>
1271:
1.67 hubertf 1272: <div class="sect1" lang="en">
1.1 grant 1273: <div class="titlepage">
1274: <div>
1275: <div>
1276: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1277: "overview"></a>1.2. Overview</h2>
1.1 grant 1278: </div>
1279: </div>
1280: </div>
1281:
1282: <p>This document is divided into two parts. The first,
1283: <a href="#users-guide" title=
1.46 gdt 1284: "Part I. The pkgsrc user's guide">The pkgsrc
1.2 hubertf 1285: user's guide</a>, describes how one can use one of the
1286: packages in the Package Collection, either by installing a
1287: precompiled binary package, or by building one's own copy
1288: using the NetBSD package system. The second part, <a href=
1.1 grant 1289: "#developers-guide" title=
1.46 gdt 1290: "Part II. The pkgsrc developer's guide">The
1291: pkgsrc developer's guide</a>, explains how to prepare a
1292: package so it can be easily built by other NetBSD users
1293: without knowing about the package's building details.</p>
1.1 grant 1294:
1295: <p>This document is available in various formats:</p>
1296:
1297: <div class="itemizedlist">
1298: <ul type="disc">
1299: <li>
1300: <p><a href="index.html" target="_top">HTML</a></p>
1301: </li>
1302:
1303: <li>
1304: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1305: </li>
1306:
1307: <li>
1308: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1309: </li>
1310:
1311: <li>
1312: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1313: </li>
1314: </ul>
1315: </div>
1316: </div>
1317:
1.67 hubertf 1318: <div class="sect1" lang="en">
1.1 grant 1319: <div class="titlepage">
1320: <div>
1321: <div>
1322: <h2 class="title" style="clear: both"><a name=
1323: "terminology"></a>1.3. Terminology</h2>
1324: </div>
1325: </div>
1326: </div>
1327:
1328: <p>There has been a lot of talk about “<span class=
1329: "quote">ports</span>”, “<span class=
1330: "quote">packages</span>”, etc. so far. Here is a
1331: description of all the terminology used within this
1332: document.</p>
1333:
1334: <div class="variablelist">
1335: <dl>
1336: <dt><span class="term">Package</span></dt>
1337:
1338: <dd>
1339: <p>A set of files and building instructions that
1340: describe what's necessary to build a certain piece of
1341: software using pkgsrc. Packages are traditionally
1.45 wiz 1342: stored under <code xmlns=
1343: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1344: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1345: </dd>
1346:
1347: <dt><span class="term">The NetBSD package
1348: system</span></dt>
1349:
1350: <dd>
1351: <p>This is the former name of “<span class=
1352: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1353: NetBSD operating system and can be bootstrapped to
1354: run on non-NetBSD operating systems as well. It
1355: handles building (compiling), installing, and
1356: removing of packages.</p>
1.1 grant 1357: </dd>
1358:
1359: <dt><span class="term">Distfile</span></dt>
1360:
1361: <dd>
1362: <p>This term describes the file or files that are
1363: provided by the author of the piece of software to
1364: distribute his work. All the changes necessary to
1365: build on NetBSD are reflected in the corresponding
1366: package. Usually the distfile is in the form of a
1367: compressed tar-archive, but other types are possible,
1.45 wiz 1368: too. Distfiles are usually stored below <code xmlns=
1369: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1370: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1371: </dd>
1372:
1373: <dt><span class="term">Port</span></dt>
1374:
1375: <dd>
1376: <p>This is the term used by FreeBSD and OpenBSD
1377: people for what we call a package. In NetBSD
1378: terminology, “<span class=
1379: "quote">port</span>” refers to a different
1380: architecture.</p>
1381: </dd>
1382:
1383: <dt><span class="term">Precompiled/binary
1384: package</span></dt>
1385:
1386: <dd>
1387: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1388: distfile and stuffed together in a single
1.45 wiz 1389: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1390: class="filename">.tgz</code> file so it can be
1.14 xtraeme 1391: installed on machines of the same machine
1392: architecture without the need to recompile. Packages
1.45 wiz 1393: are usually generated in <code xmlns=
1394: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1395: "filename">/usr/pkgsrc/packages</code>; there is also
1396: an archive on <a href=
1.1 grant 1397: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1398: "_top">ftp.NetBSD.org</a>.</p>
1399:
1400: <p>Sometimes, this is referred to by the term
1401: “<span class="quote">package</span>” too,
1402: especially in the context of precompiled
1403: packages.</p>
1404: </dd>
1405:
1406: <dt><span class="term">Program</span></dt>
1407:
1408: <dd>
1409: <p>The piece of software to be installed which will
1.47 reed 1410: be constructed from all the files in the distfile by
1.1 grant 1411: the actions defined in the corresponding package.</p>
1412: </dd>
1413: </dl>
1414: </div>
1415: </div>
1416:
1.67 hubertf 1417: <div class="sect1" lang="en">
1.1 grant 1418: <div class="titlepage">
1419: <div>
1420: <div>
1421: <h2 class="title" style="clear: both"><a name=
1422: "typography"></a>1.4. Typography</h2>
1423: </div>
1424: </div>
1425: </div>
1426:
1427: <p>When giving examples for commands, shell prompts are
1428: used to show if the command should/can be issued as root,
1429: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1430: privileges are sufficient. We use a <code class=
1431: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1432: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1433: assuming they use the C-shell or tcsh.</p>
1.1 grant 1434: </div>
1435: </div>
1436:
1.67 hubertf 1437: <div class="part" lang="en">
1.1 grant 1438: <div class="titlepage">
1439: <div>
1440: <div>
1.67 hubertf 1441: <h1 class="title"><a name=
1.48 dillo 1442: "users-guide"></a>Part I. The pkgsrc user's
1443: guide</h1>
1.1 grant 1444: </div>
1445: </div>
1446: </div>
1447:
1448: <div class="toc">
1449: <p><b>Table of Contents</b></p>
1450:
1451: <dl>
1452: <dt><span class="chapter"><a href="#getting">2. Where to
1.59 rillig 1453: get pkgsrc and how to keep it up-to-date</a></span></dt>
1.1 grant 1454:
1455: <dd>
1456: <dl>
1.30 wiz 1457: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1458: As tar file</a></span></dt>
1.1 grant 1459:
1.30 wiz 1460: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1461: SUP</a></span></dt>
1462:
1.30 wiz 1463: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1464: CVS</a></span></dt>
1.59 rillig 1465:
1466: <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
1467: Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1 grant 1468: </dl>
1469: </dd>
1470:
1471: <dt><span class="chapter"><a href="#platforms">3. Using
1472: pkgsrc on systems other than NetBSD</a></span></dt>
1473:
1474: <dd>
1475: <dl>
1.30 wiz 1476: <dt><span class="sect1"><a href=
1477: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1478: pkgsrc</a></span></dt>
1.1 grant 1479:
1.30 wiz 1480: <dt><span class="sect1"><a href=
1.47 reed 1481: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1482: notes</a></span></dt>
1.1 grant 1483:
1484: <dd>
1485: <dl>
1.30 wiz 1486: <dt><span class="sect2"><a href="#darwin">3.2.1.
1487: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1488:
1.30 wiz 1489: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1490: FreeBSD</a></span></dt>
1.22 tv 1491:
1.30 wiz 1492: <dt><span class="sect2"><a href="#interix">3.2.3.
1493: Interix</a></span></dt>
1.1 grant 1494:
1.30 wiz 1495: <dt><span class="sect2"><a href="#irix">3.2.4.
1496: IRIX</a></span></dt>
1.1 grant 1497:
1.30 wiz 1498: <dt><span class="sect2"><a href="#linux">3.2.5.
1499: Linux</a></span></dt>
1.1 grant 1500:
1.30 wiz 1501: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1502: OpenBSD</a></span></dt>
1.1 grant 1503:
1.30 wiz 1504: <dt><span class="sect2"><a href="#solaris">3.2.7.
1505: Solaris</a></span></dt>
1.1 grant 1506: </dl>
1507: </dd>
1508: </dl>
1509: </dd>
1510:
1511: <dt><span class="chapter"><a href="#using">4. Using
1512: pkgsrc</a></span></dt>
1513:
1514: <dd>
1515: <dl>
1.70 ! rillig 1516: <dt><span class="sect1"><a href="#using-pkg">4.1.
! 1517: Using binary packages</a></span></dt>
1.1 grant 1518:
1519: <dd>
1520: <dl>
1521: <dt><span class="sect2"><a href=
1.70 ! rillig 1522: "#finding-binary-packages">4.1.1. Finding binary
! 1523: packages</a></span></dt>
1.1 grant 1524:
1525: <dt><span class="sect2"><a href=
1.70 ! rillig 1526: "#installing-binary-packages">4.1.2. Installing
1.30 wiz 1527: binary packages</a></span></dt>
1.1 grant 1528:
1529: <dt><span class="sect2"><a href=
1.30 wiz 1530: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1531: warning</a></span></dt>
1532: </dl>
1533: </dd>
1534:
1.30 wiz 1535: <dt><span class="sect1"><a href=
1536: "#building-packages-from-source">4.2. Building
1537: packages from source</a></span></dt>
1.1 grant 1538:
1539: <dd>
1540: <dl>
1541: <dt><span class="sect2"><a href=
1.30 wiz 1542: "#requirements">4.2.1.
1543: Requirements</a></span></dt>
1.1 grant 1544:
1545: <dt><span class="sect2"><a href=
1.30 wiz 1546: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1547: distfiles</a></span></dt>
1548:
1549: <dt><span class="sect2"><a href=
1.30 wiz 1550: "#how-to-build-and-install">4.2.3. How to build
1551: and install</a></span></dt>
1.1 grant 1552:
1553: <dt><span class="sect2"><a href=
1.30 wiz 1554: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1555: compiler</a></span></dt>
1556: </dl>
1557: </dd>
1558: </dl>
1559: </dd>
1560:
1.38 dillo 1561: <dt><span class="chapter"><a href="#configuring">5.
1562: Configuring pkgsrc</a></span></dt>
1563:
1564: <dd>
1565: <dl>
1566: <dt><span class="sect1"><a href=
1.45 wiz 1567: "#general-configuration">5.1. General
1568: configuration</a></span></dt>
1569:
1570: <dt><span class="sect1"><a href=
1571: "#variables-affecting-build">5.2. Variables affecting
1572: the build process</a></span></dt>
1573:
1574: <dt><span class="sect1"><a href=
1575: "#developer-advanced-settings">5.3.
1576: Developer/advanced settings</a></span></dt>
1577:
1578: <dt><span class="sect1"><a href=
1579: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 1580: Options</a></span></dt>
1.38 dillo 1581: </dl>
1582: </dd>
1583:
1584: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 1585: binary packages</a></span></dt>
1586:
1587: <dd>
1588: <dl>
1.30 wiz 1589: <dt><span class="sect1"><a href=
1.38 dillo 1590: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 1591: single binary package</a></span></dt>
1.1 grant 1592:
1.30 wiz 1593: <dt><span class="sect1"><a href=
1.38 dillo 1594: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 1595: Settings for creation of binary
1596: packages</a></span></dt>
1597:
1.38 dillo 1598: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 1599: Doing a bulk build of all packages</a></span></dt>
1600:
1601: <dd>
1602: <dl>
1603: <dt><span class="sect2"><a href=
1.38 dillo 1604: "#binary.configuration">6.3.1.
1.1 grant 1605: Configuration</a></span></dt>
1606:
1607: <dt><span class="sect2"><a href=
1.38 dillo 1608: "#other-environmental-considerations">6.3.2.
1.30 wiz 1609: Other environmental
1.1 grant 1610: considerations</a></span></dt>
1611:
1612: <dt><span class="sect2"><a href=
1.38 dillo 1613: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 1614:
1615: <dt><span class="sect2"><a href=
1.38 dillo 1616: "#what-it-does">6.3.4. What it
1.30 wiz 1617: does</a></span></dt>
1.1 grant 1618:
1619: <dt><span class="sect2"><a href=
1.38 dillo 1620: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 1621: requirements</a></span></dt>
1622:
1623: <dt><span class="sect2"><a href=
1.38 dillo 1624: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 1625: sandbox for chrooted builds</a></span></dt>
1.1 grant 1626:
1627: <dt><span class="sect2"><a href=
1.38 dillo 1628: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 1629: partial set of packages</a></span></dt>
1.13 hubertf 1630:
1631: <dt><span class="sect2"><a href=
1.38 dillo 1632: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 1633: build</a></span></dt>
1.1 grant 1634: </dl>
1635: </dd>
1636:
1.30 wiz 1637: <dt><span class="sect1"><a href=
1.38 dillo 1638: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 1639: packages collection</a></span></dt>
1.1 grant 1640:
1641: <dd>
1642: <dl>
1643: <dt><span class="sect2"><a href=
1.38 dillo 1644: "#cdpack-example">6.4.1. Example of
1.1 grant 1645: cdpack</a></span></dt>
1646: </dl>
1647: </dd>
1648: </dl>
1649: </dd>
1650:
1.38 dillo 1651: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 1652: Asked Questions</a></span></dt>
1653:
1654: <dd>
1655: <dl>
1.30 wiz 1656: <dt><span class="sect1"><a href=
1.38 dillo 1657: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 1658: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1659:
1.38 dillo 1660: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 1661: Where's the pkgviews documentation?</a></span></dt>
1662:
1.38 dillo 1663: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 1664: Utilities for package management
1665: (pkgtools)</a></span></dt>
1666:
1.30 wiz 1667: <dt><span class="sect1"><a href=
1.38 dillo 1668: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 1669: non-root</a></span></dt>
1.1 grant 1670:
1.30 wiz 1671: <dt><span class="sect1"><a href=
1.38 dillo 1672: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 1673: fetching distfiles?</a></span></dt>
1.14 xtraeme 1674:
1.30 wiz 1675: <dt><span class="sect1"><a href=
1.38 dillo 1676: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 1677: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1678:
1.30 wiz 1679: <dt><span class="sect1"><a href=
1.38 dillo 1680: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 1681: from pkgsrc?</a></span></dt>
1.1 grant 1682:
1.30 wiz 1683: <dt><span class="sect1"><a href=
1.38 dillo 1684: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 1685: behind a firewall</a></span></dt>
1.1 grant 1686:
1.38 dillo 1687: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30 wiz 1688: How do I tell <span><strong class="command">make
1.14 xtraeme 1689: fetch</strong></span> to do passive
1.1 grant 1690: FTP?</a></span></dt>
1691:
1.30 wiz 1692: <dt><span class="sect1"><a href=
1.38 dillo 1693: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 1694: distfiles at once</a></span></dt>
1.1 grant 1695:
1.30 wiz 1696: <dt><span class="sect1"><a href=
1.38 dillo 1697: "#tmac.andoc-missing">7.11. What does
1.30 wiz 1698: “<span class="quote">Don't know how to make
1699: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1700: mean?</a></span></dt>
1.13 hubertf 1701:
1.30 wiz 1702: <dt><span class="sect1"><a href=
1.38 dillo 1703: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 1704: “<span class="quote">Could not find
1.14 xtraeme 1705: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1706:
1.30 wiz 1707: <dt><span class="sect1"><a href=
1.38 dillo 1708: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 1709: pkgsrc</a></span></dt>
1.1 grant 1710:
1.38 dillo 1711: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 1712: do I change the location of configuration
1713: files?</a></span></dt>
1.1 grant 1714:
1715: <dt><span class="sect1"><a href=
1.38 dillo 1716: "#audit-packages">7.15. Automated security
1.1 grant 1717: checks</a></span></dt>
1718: </dl>
1719: </dd>
1720: </dl>
1721: </div>
1722:
1.67 hubertf 1723: <div class="chapter" lang="en">
1.1 grant 1724: <div class="titlepage">
1725: <div>
1726: <div>
1.67 hubertf 1727: <h2 class="title"><a name=
1.1 grant 1728: "getting"></a>Chapter 2. Where to get
1.59 rillig 1729: pkgsrc and how to keep it up-to-date</h2>
1.1 grant 1730: </div>
1731: </div>
1732: </div>
1733:
1734: <div class="toc">
1735: <p><b>Table of Contents</b></p>
1736:
1737: <dl>
1.30 wiz 1738: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1739: tar file</a></span></dt>
1740:
1.30 wiz 1741: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1742: SUP</a></span></dt>
1743:
1.30 wiz 1744: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1745: CVS</a></span></dt>
1.59 rillig 1746:
1747: <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
1748: Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1 grant 1749: </dl>
1750: </div>
1751:
1752: <p>There are three ways to get pkgsrc. Either as a tar
1753: file, via SUP, or via CVS. All three ways are described
1754: here.</p>
1755:
1.67 hubertf 1756: <div class="sect1" lang="en">
1.1 grant 1757: <div class="titlepage">
1758: <div>
1759: <div>
1760: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1761: "as-tar-file"></a>2.1. As tar file</h2>
1.1 grant 1762: </div>
1763: </div>
1764: </div>
1765:
1766: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1767: file from <a href=
1.11 ben 1768: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1769: target="_top">ftp.NetBSD.org</a> and unpack it into
1.45 wiz 1770: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1771: class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1772: </div>
1773:
1.67 hubertf 1774: <div class="sect1" lang="en">
1.1 grant 1775: <div class="titlepage">
1776: <div>
1777: <div>
1778: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1779: "via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1780: </div>
1781: </div>
1782: </div>
1783:
1784: <p>As an alternative to the tar file, you can get pkgsrc
1785: via the Software Update Protocol, SUP. To do so, make
1786: sure your supfile has a line</p>
1787: <pre class="programlisting">
1.51 rillig 1788: release=pkgsrc
1.1 grant 1789: </pre>
1790:
1.45 wiz 1791: <p>in it, see the examples in <code xmlns=
1792: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1793: "filename">/usr/share/examples/supfiles</code>, and that
1.45 wiz 1794: the <code xmlns=
1795: "http://www.w3.org/TR/xhtml1/transitional" class=
1796: "filename">/usr/pkgsrc</code> directory exists. Then,
1797: simply run <span><strong class="command">sup -v
1798: <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1799: </div>
1800:
1.67 hubertf 1801: <div class="sect1" lang="en">
1.1 grant 1802: <div class="titlepage">
1803: <div>
1804: <div>
1805: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1806: "via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1807: </div>
1808: </div>
1809: </div>
1810:
1811: <p>To get pkgsrc via CVS, make sure you have
1812: “<span class="quote">cvs</span>” installed.
1.27 rillig 1813: To do an initial (full) checkout of pkgsrc, do the
1814: following steps:</p>
1.1 grant 1815: <pre class="screen">
1.14 xtraeme 1816: <code class="prompt">%</code> <strong class=
1817: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1818: <code class="prompt">%</code> <strong class=
1819: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1820: <code class="prompt">%</code> <strong class=
1821: "userinput"><code>cd /usr</code></strong>
1822: <code class="prompt">%</code> <strong class=
1823: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1824: </pre>
1825:
1.45 wiz 1826: <p>This will create the <code xmlns=
1827: "http://www.w3.org/TR/xhtml1/transitional" class=
1828: "filename">pkgsrc</code> directory in your <code xmlns=
1829: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1830: "filename">/usr</code>, and all the package source will
1.45 wiz 1831: be stored under <code xmlns=
1832: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1833: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1834: initial checkout, make sure you have <code class=
1835: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1836: <pre class="screen">
1.14 xtraeme 1837: <code class="prompt">%</code> <strong class=
1838: "userinput"><code>cd /usr/pkgsrc</code></strong>
1839: <code class="prompt">%</code> <strong class=
1840: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1841: </pre>
1842:
1843: <p>Please also note that it is possible to have multiple
1844: copies of the pkgsrc hierarchy in use at any one time -
1845: all work is done relatively within the pkgsrc tree.</p>
1846: </div>
1.59 rillig 1847:
1.67 hubertf 1848: <div class="sect1" lang="en">
1.59 rillig 1849: <div class="titlepage">
1850: <div>
1851: <div>
1852: <h2 class="title" style="clear: both"><a name=
1853: "uptodate-cvs"></a>2.4. Keeping pkgsrc
1854: up-to-date via CVS</h2>
1855: </div>
1856: </div>
1857: </div>
1858:
1859: <p>If your copy of pkgsrc contains a lot of <code xmlns=
1860: "http://www.w3.org/TR/xhtml1/transitional" class=
1861: "filename">CVS</code> directories, you can update it
1862: using the <a href=
1863: "http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current">
1864: <span class="citerefentry"><span class=
1865: "refentrytitle">cvs</span>(1)</span></a> program. First,
1866: <span><strong class="command">cd</strong></span> to the
1867: top level directory of pkgsrc. Then run
1868: <span><strong class="command">cvs -q update
1869: -dP</strong></span>, and you're done.</p>
1870:
1871: <p>If that doesn't work and the file <code xmlns=
1872: "http://www.w3.org/TR/xhtml1/transitional" class=
1873: "filename">CVS/Root</code> contains the string
1874: “<span class="quote">:pserver:</span>”, you
1875: have to run <span><strong class="command">cvs
1876: login</strong></span> once to get known to the NetBSD CVS
1877: server. The <span><strong class=
1878: "command">cvs</strong></span> utility will then ask you
1879: for a password. Just enter “<span class=
1880: "quote">anoncvs</span>”. Then try again to
1881: update.</p>
1882: </div>
1.1 grant 1883: </div>
1884:
1.67 hubertf 1885: <div class="chapter" lang="en">
1.1 grant 1886: <div class="titlepage">
1887: <div>
1888: <div>
1.67 hubertf 1889: <h2 class="title"><a name=
1.1 grant 1890: "platforms"></a>Chapter 3. Using pkgsrc on
1891: systems other than NetBSD</h2>
1892: </div>
1893: </div>
1894: </div>
1895:
1896: <div class="toc">
1897: <p><b>Table of Contents</b></p>
1898:
1899: <dl>
1.30 wiz 1900: <dt><span class="sect1"><a href=
1901: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1902: pkgsrc</a></span></dt>
1.1 grant 1903:
1.30 wiz 1904: <dt><span class="sect1"><a href=
1.47 reed 1905: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1906: notes</a></span></dt>
1.1 grant 1907:
1908: <dd>
1909: <dl>
1.30 wiz 1910: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1911: Darwin (Mac OS X)</a></span></dt>
1912:
1.30 wiz 1913: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1914: FreeBSD</a></span></dt>
1915:
1.30 wiz 1916: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1917: Interix</a></span></dt>
1918:
1.30 wiz 1919: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1920: IRIX</a></span></dt>
1921:
1.30 wiz 1922: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1923: Linux</a></span></dt>
1924:
1.30 wiz 1925: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1926: OpenBSD</a></span></dt>
1927:
1.30 wiz 1928: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1929: Solaris</a></span></dt>
1930: </dl>
1931: </dd>
1932: </dl>
1933: </div>
1934:
1.67 hubertf 1935: <div class="sect1" lang="en">
1.1 grant 1936: <div class="titlepage">
1937: <div>
1938: <div>
1939: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1940: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
1941: pkgsrc</h2>
1.1 grant 1942: </div>
1943: </div>
1944: </div>
1945:
1.27 rillig 1946: <p>For operating systems other than NetBSD, we provide a
1.1 grant 1947: bootstrap kit to build the required tools to use pkgsrc
1948: on your platform. Besides support for native NetBSD,
1949: pkgsrc and the bootstrap kit have support for the
1950: following operating systems:</p>
1951:
1952: <div class="itemizedlist">
1953: <ul type="disc">
1954: <li>
1955: <p>Darwin (Mac OS X)</p>
1956: </li>
1957:
1958: <li>
1.70 ! rillig 1959: <p>DragonFly BSD</p>
1.16 grant 1960: </li>
1961:
1962: <li>
1.1 grant 1963: <p>FreeBSD</p>
1964: </li>
1965:
1966: <li>
1967: <p>Interix (Windows 2000, XP, 2003)</p>
1968: </li>
1969:
1970: <li>
1971: <p>IRIX</p>
1972: </li>
1973:
1974: <li>
1975: <p>Linux</p>
1976: </li>
1977:
1978: <li>
1979: <p>OpenBSD</p>
1980: </li>
1981:
1982: <li>
1983: <p>Solaris</p>
1984: </li>
1.16 grant 1985:
1986: <li>
1987: <p>Tru64 (Digital UNIX/OSF1)</p>
1988: </li>
1.1 grant 1989: </ul>
1990: </div>
1991:
1992: <p>Support for other platforms is under development.</p>
1993:
1994: <p>Installing the bootstrap kit should be as simple
1995: as:</p>
1996: <pre class="screen">
1.14 xtraeme 1997: <code class="prompt">#</code> <strong class=
1998: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1999: <code class="prompt">#</code> <strong class=
2000: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
2001: <code class="prompt">#</code> <strong class=
2002: "userinput"><code>./bootstrap</code></strong>
1.1 grant 2003: </pre>
2004:
2005: <p>See <a href="#getting" title=
1.59 rillig 2006: "Chapter 2. Where to get pkgsrc and how to keep it up-to-date">
1.67 hubertf 2007: Chapter 2, <i>Where to get pkgsrc and how to keep it
1.59 rillig 2008: up-to-date</i></a> for other ways to get pkgsrc before
2009: bootstrapping. The given <span><strong class=
2010: "command">bootstrap</strong></span> command will use the
2011: defaults of <code xmlns=
1.45 wiz 2012: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2013: "filename">/usr/pkg</code> for the <span class=
2014: "emphasis"><em>prefix</em></span> where programs will be
1.45 wiz 2015: installed in, and <code xmlns=
2016: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2017: "filename">/var/db/pkg</code> for the package database
1.27 rillig 2018: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 2019: However, these can also be set using command-line
1.27 rillig 2020: arguments.</p>
1.1 grant 2021:
2022: <p>Binary packages for the pkgsrc tools and an initial
2023: set of packages is available for supported platforms. An
2024: up-to-date list of these can be found on <a href=
2025: "http://www.pkgsrc.org/" target=
1.63 dillo 2026: "_top">www.pkgsrc.org</a>. Note that this only works for
2027: privileged builds that install into <code xmlns=
2028: "http://www.w3.org/TR/xhtml1/transitional" class=
2029: "filename">/usr/pkg</code>.</p>
1.47 reed 2030:
2031: <div class="note" style=
2032: "margin-left: 0.5in; margin-right: 0.5in;">
2033: <h3 class="title">Note</h3>
2034:
2035: <p>The bootstrap installs a <span><strong class=
2036: "command">bmake</strong></span> tool. Use this
2037: <span><strong class="command">bmake</strong></span>
2038: when building via pkgsrc. For examples in this guide,
2039: use <span><strong class="command">bmake</strong></span>
2040: instead of “<span class=
2041: "quote">make</span>”.</p>
2042: </div>
1.1 grant 2043: </div>
2044:
1.67 hubertf 2045: <div class="sect1" lang="en">
1.1 grant 2046: <div class="titlepage">
2047: <div>
2048: <div>
2049: <h2 class="title" style="clear: both"><a name=
1.47 reed 2050: "platform-specific-notes"></a>3.2. Platform-specific
2051: notes</h2>
1.1 grant 2052: </div>
2053: </div>
2054: </div>
2055:
2056: <p>Here are some platform-specific notes you should be
2057: aware of.</p>
2058:
1.67 hubertf 2059: <div class="sect2" lang="en">
1.1 grant 2060: <div class="titlepage">
2061: <div>
2062: <div>
1.67 hubertf 2063: <h3 class="title"><a name=
1.30 wiz 2064: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 2065: </div>
2066: </div>
2067: </div>
2068:
2069: <p>Darwin 5.x and 6.x are supported. There are two
2070: methods of using pkgsrc on Mac OS X, by using a
2071: <a href="#platform.osx-image" title=
2072: "3.2.1.1. Using a disk image">disk image</a>, or a
2073: <a href="#platform.osx-ufs" title=
2074: "3.2.1.2. Using a UFS partition">UFS
2075: partition</a>.</p>
2076:
2077: <p>Before you start, you will need to download and
2078: install the Mac OS X Developer Tools from Apple's
2079: Developer Connection. See <a href=
2080: "http://developer.apple.com/macosx/" target=
2081: "_top">http://developer.apple.com/macosx/</a> for
2082: details. Also, make sure you install X11 for Mac OS X
2083: and the X11 SDK from <a href=
2084: "http://www.apple.com/macosx/x11/download/" target=
2085: "_top">http://www.apple.com/macosx/x11/download/</a> if
2086: you intend to build packages that use the X11 Window
2087: System.</p>
2088:
2089: <p>If you already have a UFS partition, or have a spare
2090: partition that you can format as UFS, it is recommended
2091: to use that instead of the disk image. It'll be
2092: somewhat faster and will mount automatically at boot
2093: time, where you must manually mount a disk image.</p>
2094:
2095: <div class="note" style=
2096: "margin-left: 0.5in; margin-right: 0.5in;">
2097: <h3 class="title">Note</h3>
2098:
2099: <p>You cannot use a HFS+ file system for pkgsrc,
1.47 reed 2100: because pkgsrc currently requires the file system to
1.1 grant 2101: be case-sensitive, and HFS+ is not.</p>
2102: </div>
2103:
1.67 hubertf 2104: <div class="sect3" lang="en">
1.1 grant 2105: <div class="titlepage">
2106: <div>
2107: <div>
1.67 hubertf 2108: <h4 class="title"><a name=
2109: "platform.osx-image"></a>3.2.1.1. Using a
2110: disk image</h4>
1.1 grant 2111: </div>
2112: </div>
2113: </div>
2114:
2115: <p>Create the disk image:</p>
2116: <pre class="screen">
1.14 xtraeme 2117: <code class="prompt">#</code> <strong class=
2118: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
2119: <code class="prompt">#</code> <strong class=
2120: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
2121: <code class="prompt">#</code> <strong class=
2122: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
2123: <code class="prompt">#</code> <strong class=
2124: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 2125: </pre>
2126:
2127: <p>That's it!</p>
2128: </div>
2129:
1.67 hubertf 2130: <div class="sect3" lang="en">
1.1 grant 2131: <div class="titlepage">
2132: <div>
2133: <div>
1.67 hubertf 2134: <h4 class="title"><a name=
2135: "platform.osx-ufs"></a>3.2.1.2. Using a
1.1 grant 2136: UFS partition</h4>
2137: </div>
2138: </div>
2139: </div>
2140:
1.45 wiz 2141: <p>By default, <code xmlns=
2142: "http://www.w3.org/TR/xhtml1/transitional" class=
2143: "filename">/usr</code> will be on your root file
2144: system, normally HFS+. It is possible to use the
2145: default <span class="emphasis"><em>prefix</em></span>
2146: of <code xmlns=
2147: "http://www.w3.org/TR/xhtml1/transitional" class=
2148: "filename">/usr/pkg</code> by symlinking <code xmlns=
2149: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2150: "filename">/usr/pkg</code> to a directory on a UFS
2151: file system. Obviously, another symlink is required
2152: if you want to place the package database directory
2153: outside the <span class=
2154: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 2155: <pre class="screen">
1.14 xtraeme 2156: <code class="prompt">#</code> <strong class=
1.59 rillig 2157: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb</code></strong>
1.1 grant 2158: </pre>
2159:
2160: <p>If you created your partitions at the time of
2161: installing Mac OS X and formatted the target
2162: partition as UFS, it should automatically mount on
1.45 wiz 2163: <code xmlns=
2164: "http://www.w3.org/TR/xhtml1/transitional" class=
2165: "filename">/Volumes/<volume name></code> when
2166: the machine boots. If you are (re)formatting a
2167: partition as UFS, you need to ensure that the
2168: partition map correctly reflects “<span class=
2169: "quote">Apple_UFS</span>” and not
2170: “<span class=
1.1 grant 2171: "quote">Apple_HFS</span>”.</p>
2172:
2173: <p>The problem is that none of the disk tools will
2174: let you touch a disk that is booted from. You can
2175: unmount the partition, but even if you newfs it, the
2176: partition type will be incorrect and the automounter
2177: won't mount it. It can be mounted manually, but it
2178: won't appear in Finder.</p>
2179:
2180: <p>You'll need to boot off of the OS X Installation
2181: (User) CD. When the Installation program starts, go
2182: up to the menu and select Disk Utility. Now, you will
2183: be able to select the partition you want to be UFS,
2184: and Format it Apple UFS. Quit the Disk Utility, quit
2185: the installer which will reboot your machine. The new
2186: UFS file system will appear in Finder.</p>
2187:
2188: <p>Be aware that the permissions on the new file
2189: system will be writable by root only.</p>
2190:
2191: <p>This note is as of 10.2 (Jaguar) and applies to
2192: earlier versions. Hopefully Apple will fix Disk
2193: Utility in 10.3 (Panther).</p>
2194: </div>
2195: </div>
2196:
1.67 hubertf 2197: <div class="sect2" lang="en">
1.1 grant 2198: <div class="titlepage">
2199: <div>
2200: <div>
1.67 hubertf 2201: <h3 class="title"><a name=
1.30 wiz 2202: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 2203: </div>
2204: </div>
2205: </div>
2206:
2207: <p>FreeBSD 4.7 and 5.0 have been tested and are
2208: supported, other versions may work.</p>
2209:
2210: <p>Care should be taken so that the tools that this kit
2211: installs do not conflict with the FreeBSD userland
2212: tools. There are several steps:</p>
2213:
2214: <div class="orderedlist">
2215: <ol type="1">
2216: <li>
2217: <p>FreeBSD stores its ports pkg database in
1.45 wiz 2218: <code xmlns=
2219: "http://www.w3.org/TR/xhtml1/transitional" class=
2220: "filename">/var/db/pkg</code>. It is therefore
2221: recommended that you choose a different location
2222: (e.g. <code xmlns=
2223: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2224: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2225: --pkgdbdir option to the bootstrap script.</p>
2226: </li>
2227:
2228: <li>
2229: <p>If you do not intend to use the FreeBSD ports
2230: tools, it's probably a good idea to move them out
2231: of the way to avoid confusion, e.g.</p>
2232: <pre class="screen">
1.14 xtraeme 2233: <code class="prompt">#</code> <strong class=
2234: "userinput"><code>cd /usr/sbin</code></strong>
2235: <code class="prompt">#</code> <strong class=
2236: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2237: <code class="prompt">#</code> <strong class=
2238: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2239: <code class="prompt">#</code> <strong class=
2240: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2241: <code class="prompt">#</code> <strong class=
2242: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2243: </pre>
2244: </li>
2245:
2246: <li>
1.45 wiz 2247: <p>An example <code xmlns=
2248: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2249: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2250: placed in <code xmlns=
2251: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2252: "filename">/etc/mk.conf.example</code> file when
2253: you use the bootstrap script.</p>
1.1 grant 2254: </li>
2255: </ol>
2256: </div>
2257: </div>
2258:
1.67 hubertf 2259: <div class="sect2" lang="en">
1.1 grant 2260: <div class="titlepage">
2261: <div>
2262: <div>
1.67 hubertf 2263: <h3 class="title"><a name=
1.30 wiz 2264: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2265: </div>
2266: </div>
2267: </div>
2268:
1.47 reed 2269: <p>Interix is a POSIX-compatible subsystem for the
1.1 grant 2270: Windows NT kernel, providing a Unix-like environment
2271: with a tighter kernel integration than available with
2272: Cygwin. It is part of the Windows Services for Unix
2273: package, available for free for any licensed copy of
1.22 tv 2274: Windows 2000, XP (not including XP Home), or 2003. SFU
2275: can be downloaded from <a href=
2276: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2277: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2278:
2279: <p>Services for Unix 3.5, current as of this writing,
2280: has been tested. 3.0 or 3.1 may work, but are not
2281: officially supported. (The main difference in 3.0/3.1
2282: is lack of pthreads.)</p>
2283:
1.67 hubertf 2284: <div class="sect3" lang="en">
1.1 grant 2285: <div class="titlepage">
2286: <div>
2287: <div>
2288: <h4 class="title"><a name=
2289: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2290: installing Interix/SFU</h4>
1.1 grant 2291: </div>
2292: </div>
2293: </div>
2294:
2295: <p>At an absolute minimum, the following packages
2296: must be installed from the Windows Services for Unix
2297: 3.5 distribution in order to use pkgsrc:</p>
2298:
2299: <div class="itemizedlist">
2300: <ul type="disc">
2301: <li>
2302: <p>Utilities -> Base Utilities</p>
2303: </li>
2304:
2305: <li>
2306: <p>Interix GNU Components -> (all)</p>
2307: </li>
2308:
2309: <li>
2310: <p>Remote Connectivity</p>
2311: </li>
2312:
2313: <li>
2314: <p>Interix SDK</p>
2315: </li>
2316: </ul>
2317: </div>
2318:
2319: <p>When using pkgsrc on Interix, DO NOT install the
2320: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2321: without shared module support, installed to
2322: /usr/local, and will only cause confusion. Instead,
2323: install Perl 5.8 from pkgsrc (or from a binary
2324: package).</p>
2325:
2326: <p>The Remote Connectivity subcomponent "Windows
2327: Remote Shell Service" does not need to be installed,
2328: but Remote Connectivity itself should be installed in
2329: order to have a working inetd.</p>
2330:
1.52 tv 2331: <p>During installation you may be asked whether to
2332: enable setuid behavior for Interix programs, and
2333: whether to make pathnames default to case-sensitive.
2334: Setuid should be enabled, and case-sensitivity MUST
2335: be enabled. (Without case-sensitivity, a large number
2336: of packages including perl will not build.)</p>
2337:
2338: <p>NOTE: Newer Windows service packs change the way
2339: binary execution works (via the Data Execution
2340: Prevention feature). In order to use pkgsrc and other
2341: gcc-compiled binaries reliably, a hotfix containing
2342: POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
2343: (899522 or newer) must be installed. Hotfixes are
2344: available from Microsoft through a support contract;
2345: however, a NetBSD developer has made most Interix
2346: hotfixes available for personal use from <a href=
2347: "http://www.duh.org/interix/hotfixes.php" target=
2348: "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1 grant 2349: </div>
2350:
1.67 hubertf 2351: <div class="sect3" lang="en">
1.1 grant 2352: <div class="titlepage">
2353: <div>
2354: <div>
2355: <h4 class="title"><a name=
2356: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2357: to do if Interix/SFU is already installed</h4>
2358: </div>
2359: </div>
2360: </div>
2361:
2362: <p>If SFU is already installed and you wish to alter
2363: these settings to work with pkgsrc, note the
2364: following things.</p>
2365:
2366: <div class="itemizedlist">
2367: <ul type="disc">
2368: <li>
2369: <p>To uninstall UNIX Perl, use Add/Remove
2370: Programs, select Microsoft Windows Services for
2371: UNIX, then click Change. In the installer,
2372: choose Add or Remove, then uncheck
2373: Utilities->UNIX Perl.</p>
2374: </li>
2375:
2376: <li>
1.47 reed 2377: <p>To enable case-sensitivity for the file
2378: system, run REGEDIT.EXE, and change the
1.1 grant 2379: following registry key:</p>
2380:
2381: <p>
2382: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2383: Manager\kernel</p>
2384:
2385: <p>Set the DWORD value "obcaseinsensitive" to
2386: 0; then reboot.</p>
2387: </li>
2388:
2389: <li>
2390: <p>To enable setuid binaries (optional), run
2391: REGEDIT.EXE, and change the following registry
2392: key:</p>
2393:
2394: <p>
2395: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2396: for UNIX</p>
2397:
2398: <p>Set the DWORD value "EnableSetuidBinaries"
2399: to 1; then reboot.</p>
2400: </li>
2401: </ul>
2402: </div>
2403: </div>
2404:
1.67 hubertf 2405: <div class="sect3" lang="en">
1.1 grant 2406: <div class="titlepage">
2407: <div>
2408: <div>
2409: <h4 class="title"><a name=
2410: "platform.interix-notes"></a>3.2.3.3. Important
2411: notes for using pkgsrc</h4>
2412: </div>
2413: </div>
2414: </div>
2415:
1.52 tv 2416: <p>The package manager (either the pkgsrc "su" user,
1.1 grant 2417: or the user running "pkg_add") must be a member of
2418: the local Administrators group. Such a user must also
2419: be used to run the bootstrap. This is slightly
2420: relaxed from the normal pkgsrc requirement of
2421: "root".</p>
2422:
2423: <p>The package manager should use a umask of 002.
2424: "make install" will automatically complain if this is
2425: not the case. This ensures that directories written
2426: in /var/db/pkg are Administrators-group
2427: writeable.</p>
2428:
2429: <p>The popular Interix binary packages from
2430: http://www.interopsystems.com/ use an older version
2431: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2432: used in conjunction with pkgsrc. If you choose to use
2433: them at the same time as the pkgsrc packages, ensure
2434: that you use the proper pkg_* tools for each type of
2435: binary package.</p>
1.22 tv 2436:
2437: <p>The TERM setting used for DOS-type console windows
2438: (including those invoked by the csh and ksh startup
2439: shortcuts) is "interix". Most systems don't have a
2440: termcap/terminfo entry for it, but the following
2441: .termcap entry provides adequate emulation in most
2442: cases:</p>
2443: <pre class="programlisting">
1.51 rillig 2444: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22 tv 2445: </pre>
1.1 grant 2446: </div>
1.52 tv 2447:
1.67 hubertf 2448: <div class="sect3" lang="en">
1.52 tv 2449: <div class="titlepage">
2450: <div>
2451: <div>
2452: <h4 class="title"><a name=
2453: "platform.interix-limits"></a>3.2.3.4. Limitations
2454: of the Interix platform</h4>
2455: </div>
2456: </div>
2457: </div>
2458:
2459: <p>Though Interix suffices as a familiar and flexible
2460: substitute for a full Unix-like platform, it has some
2461: drawbacks that should be noted for those desiring to
2462: make the most of Interix.</p>
2463:
2464: <div class="itemizedlist">
2465: <ul type="disc">
2466: <li>
1.54 tv 2467: <p><span class=
1.57 minskim 2468: "strong"><strong>X11:</strong></span></p>
1.52 tv 2469:
2470: <p>Interix comes with the standard set of X11R6
1.57 minskim 2471: client libraries, and can run X11 based
1.52 tv 2472: applications, but it does <span class=
2473: "emphasis"><em>not</em></span> come with an X
2474: server. Some options are <a href=
2475: "http://www.starnet.com/products/xwin32/"
2476: target="_top">StarNet X-Win32</a>, <a href=
2477: "http://connectivity.hummingbird.com/products/nc/exceed/"
1.57 minskim 2478: target="_top">Hummingbird Exceed</a> (available
2479: in a trimmed version for Interix from Interop
2480: Systems as the <a href=
2481: "http://www.interopsystems.com/InteropXserver.htm"
2482: target="_top">Interop X Server</a>), and the
2483: free X11 server included with <a href=
1.52 tv 2484: "http://x.cygwin.com/" target=
2485: "_top">Cygwin</a>.</p>
2486:
2487: <p>Also, StarNet Communications has graciously
2488: provided a free version of their X-Win32
2489: product that accepts connections only from
2490: localhost: <a href=
2491: "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
2492: target="_top">X-Win32 LX</a>, recommended by
2493: the maintainer of Interix pkgsrc support.</p>
2494: </li>
2495:
2496: <li>
1.57 minskim 2497: <p><span class="strong"><strong>X11
1.54 tv 2498: acceleration:</strong></span></p>
1.52 tv 2499:
2500: <p>Because Interix runs in a completely
2501: different NT subsystem from Win32 applications,
2502: it does not currently support various X11
2503: protocol extensions for acceleration (such as
2504: MIT-SHM or DGA). Most interactive applications
2505: to a local X server will run reasonably fast,
2506: but full motion video and other graphics
2507: intensive applications may require a
2508: faster-than-expected CPU.</p>
2509: </li>
2510:
2511: <li>
1.54 tv 2512: <p><span class=
2513: "strong"><strong>Audio:</strong></span></p>
1.52 tv 2514:
2515: <p>Interix has no native support for audio
1.53 tv 2516: output. For audio support, pkgsrc uses the
2517: <span><strong class=
1.52 tv 2518: "command">esound</strong></span> client/server
2519: audio system on Interix. Unlike on most
2520: platforms, the <a xmlns=
2521: "http://www.w3.org/TR/xhtml1/transitional"
2522: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
2523: target="_top"><code xmlns="" class=
2524: "filename">audio/esound</code></a> package does
2525: <span class="emphasis"><em>not</em></span>
2526: contain the <span><strong class=
1.53 tv 2527: "command">esd</strong></span> server component.
2528: To output audio via an Interix host, the
2529: <a xmlns=
1.52 tv 2530: "http://www.w3.org/TR/xhtml1/transitional"
2531: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
2532: target="_top"><code xmlns="" class=
2533: "filename">emulators/cygwin_esound</code></a>
2534: package must also be installed.</p>
2535: </li>
2536:
2537: <li>
1.54 tv 2538: <p><span class="strong"><strong>CD/DVDs, USB,
2539: and SCSI:</strong></span></p>
1.52 tv 2540:
2541: <p>Direct device access is not currently
2542: supported in Interix, so it is not currently
2543: possible to access CD/DVD drives, USB devices,
2544: or SCSI devices through non-filesystem means.
2545: Among other things, this makes it impossible to
2546: use Interix directly for CD/DVD burning.</p>
2547: </li>
2548:
2549: <li>
1.54 tv 2550: <p><span class="strong"><strong>Tape
2551: drives:</strong></span></p>
1.52 tv 2552:
2553: <p>Due to the same limitations as for CD-ROMs
2554: and SCSI devices, tape drives are also not
2555: directly accessible in Interix. However,
2556: support is in work to make tape drive access
2557: possible by using Cygwin as a bridge (similarly
2558: to audio bridged via Cygwin's esound
2559: server).</p>
2560: </li>
2561: </ul>
2562: </div>
2563: </div>
2564:
1.67 hubertf 2565: <div class="sect3" lang="en">
1.52 tv 2566: <div class="titlepage">
2567: <div>
2568: <div>
2569: <h4 class="title"><a name=
2570: "platform.interix-knownissues"></a>3.2.3.5. Known
2571: issues for pkgsrc on Interix</h4>
2572: </div>
2573: </div>
2574: </div>
2575:
2576: <p>It is not necessary, in general, to have a "root"
2577: user on the Windows system; any member of the local
2578: Administrators group will suffice. However, some
2579: packages currently assume that the user named "root"
2580: is the privileged user. To accommodate these, you may
2581: create such a user; make sure it is in the local
2582: group Administrators (or your language
2583: equivalent).</p>
2584:
2585: <p>"pkg_add" creates directories of mode 0755, not
2586: 0775, in $PKG_DBDIR. For the time being, install
2587: packages as the local Administrator (or your language
2588: equivalent), or run the following command after
2589: installing a package to work around the issue:</p>
2590: <pre class="screen">
2591: <code class="prompt">#</code> <strong class=
2592: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
2593: </pre>
2594: </div>
1.1 grant 2595: </div>
2596:
1.67 hubertf 2597: <div class="sect2" lang="en">
1.1 grant 2598: <div class="titlepage">
2599: <div>
2600: <div>
1.67 hubertf 2601: <h3 class="title"><a name=
1.30 wiz 2602: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2603: </div>
2604: </div>
2605: </div>
2606:
2607: <p>You will need a working C compiler, either gcc or
2608: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2609: the <code class="varname">CC</code> environment
2610: variable according to your preference. If you do not
2611: have a license for the MIPSpro compiler suite, you can
1.1 grant 2612: download a gcc tardist file from <a href=
2613: "http://freeware.sgi.com/" target=
2614: "_top">http://freeware.sgi.com/</a>.</p>
2615:
2616: <p>Please note that you will need IRIX 6.5.17 or
2617: higher, as this is the earliest version of IRIX
1.24 wiz 2618: providing support for <a href=
2619: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2620: <span class="citerefentry"><span class=
2621: "refentrytitle">if_indextoname</span>(3)</span></a>,
2622: <a href=
2623: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2624: <span class="citerefentry"><span class=
2625: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2626: etc.</p>
1.1 grant 2627:
1.27 rillig 2628: <p>At this point in time, pkgsrc only supports one ABI
2629: at a time. That is, you can not switch between the old
2630: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2631: you start out using "abi=n32", that's what all your
2632: packages will be built with.</p>
1.1 grant 2633:
2634: <p>Therefore, please make sure that you have no
1.14 xtraeme 2635: conflicting <code class="varname">CFLAGS</code> in your
1.45 wiz 2636: environment or the <code xmlns=
2637: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2638: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2639: that you do not try to link n32 object files with lib64
1.45 wiz 2640: or vice versa. Check your <code xmlns=
2641: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2642: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2643:
2644: <p>If you have the actual pkgsrc tree mounted via NFS
2645: from a different host, please make sure to set
1.14 xtraeme 2646: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2647: directory, as it appears that IRIX linker occasionally
1.47 reed 2648: runs into issues when trying to link over a
2649: network-mounted file system.</p>
1.1 grant 2650:
2651: <p>The bootstrapping process should set all the right
2652: options for programs such as imake(1), but you may want
2653: to set some options depending on your local setup.
1.45 wiz 2654: Please see <code xmlns=
2655: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2656: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2657: course, your compiler's man pages for details.</p>
1.22 tv 2658:
2659: <p>If you are using SGI's MIPSPro compiler, please
2660: set</p>
2661: <pre class="programlisting">
1.51 rillig 2662: PKGSRC_COMPILER= mipspro
1.22 tv 2663: </pre>
2664:
1.45 wiz 2665: <p>in <code xmlns=
2666: "http://www.w3.org/TR/xhtml1/transitional" class=
2667: "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
2668: assume you are using gcc and may end up passing invalid
2669: flags to the compiler. Note that bootstrap should
2670: create an appropriate <code xmlns=
2671: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2672: "filename">mk.conf.example</code> by default.</p>
2673:
2674: <p>If you have both the MIPSPro compiler chain
2675: installed as well as gcc, but want to make sure that
2676: MIPRPro is used, please set your <code class=
2677: "varname">PATH</code> to <span class=
2678: "emphasis"><em>not</em></span> include the location of
1.45 wiz 2679: gcc (often <code xmlns=
2680: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2681: "filename">/usr/freeware/bin</code>), and (important)
2682: pass the '--preserve-path' flag.</p>
1.1 grant 2683: </div>
2684:
1.67 hubertf 2685: <div class="sect2" lang="en">
1.1 grant 2686: <div class="titlepage">
2687: <div>
2688: <div>
1.67 hubertf 2689: <h3 class="title"><a name=
1.30 wiz 2690: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2691: </div>
2692: </div>
2693: </div>
2694:
2695: <p>Some versions of Linux (for example Debian
2696: GNU/Linux) need either libtermcap or libcurses
2697: (libncurses). Installing the distributions
2698: libncurses-dev package (or equivalent) should fix the
2699: problem.</p>
2700:
2701: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2702: and icc (Intel C++ Compiler). gcc is the default. icc
2703: 8.0 and 8.1 on i386 have been tested.</p>
2704:
2705: <p>To bootstrap using icc, assuming the default icc
2706: installation directory:</p>
2707: <pre class="programlisting">
1.51 rillig 2708: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2709: ac_cv___attribute__=yes ./bootstrap
1.22 tv 2710: </pre>
2711:
2712: <div class="note" style=
2713: "margin-left: 0.5in; margin-right: 0.5in;">
2714: <h3 class="title">Note</h3>
2715:
2716: <p>icc 8.1 needs the `-i-static' argument instead of
2717: -static-libcxa.</p>
2718: </div>
2719:
2720: <p>icc supports __attribute__, but the GNU configure
2721: test uses a nested function, which icc does not
2722: support. #undef'ing __attribute__ has the unfortunate
2723: side-effect of breaking many of the Linux header files,
2724: which cannot be compiled properly without
2725: __attribute__. The test must be overridden so that
2726: __attribute__ is assumed supported by the compiler.</p>
2727:
2728: <p>After bootstrapping, you should set <code class=
1.45 wiz 2729: "varname">PKGSRC_COMPILER</code> in <code xmlns=
2730: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2731: "filename">/etc/mk.conf</code>:</p>
2732: <pre class="programlisting">
1.51 rillig 2733: PKGSRC_COMPILER= icc
1.22 tv 2734: </pre>
2735:
2736: <p>The default installation directory for icc is
1.45 wiz 2737: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2738: class="filename">/opt/intel_cc_80</code>, which is also
2739: the pkgsrc default. If you have installed it into a
2740: different directory, set <code class=
2741: "varname">ICCBASE</code> in <code xmlns=
2742: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2743: "filename">/etc/mk.conf</code>:</p>
2744: <pre class="programlisting">
1.51 rillig 2745: ICCBASE= /opt/icc
1.22 tv 2746: </pre>
2747:
2748: <p>pkgsrc uses the static linking method of the runtime
2749: libraries provided by icc, so binaries can be run on
2750: other systems which do not have the shared libraries
2751: installed.</p>
2752:
2753: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2754: the <a href=
2755: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2756: <span class="citerefentry"><span class=
2757: "refentrytitle">ld</span>(1)</span></a> command run
2758: when linking a C++ shared library and records it,
2759: throwing away the -Bstatic and -Bdynamic options
2760: interspersed between the libraries. This means that
2761: libtool-linked C++ shared libraries will have a runtime
2762: dependency on the icc libraries until this is fixed in
2763: libtool.</p>
1.22 tv 2764: </div>
2765:
1.67 hubertf 2766: <div class="sect2" lang="en">
1.22 tv 2767: <div class="titlepage">
2768: <div>
2769: <div>
1.67 hubertf 2770: <h3 class="title"><a name=
1.30 wiz 2771: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2772: </div>
2773: </div>
2774: </div>
2775:
2776: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2777:
2778: <p>Care should be taken so that the tools that this kit
2779: installs do not conflict with the OpenBSD userland
2780: tools. There are several steps:</p>
2781:
2782: <div class="orderedlist">
2783: <ol type="1">
2784: <li>
2785: <p>OpenBSD stores its ports pkg database in
1.45 wiz 2786: <code xmlns=
2787: "http://www.w3.org/TR/xhtml1/transitional" class=
2788: "filename">/var/db/pkg</code>. It is therefore
2789: recommended that you choose a different location
2790: (e.g. <code xmlns=
2791: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2792: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2793: --pkgdbdir option to the bootstrap script.</p>
2794: </li>
2795:
2796: <li>
2797: <p>If you do not intend to use the OpenBSD ports
2798: tools, it's probably a good idea to move them out
2799: of the way to avoid confusion, e.g.</p>
2800: <pre class="screen">
1.14 xtraeme 2801: <code class="prompt">#</code> <strong class=
2802: "userinput"><code>cd /usr/sbin</code></strong>
2803: <code class="prompt">#</code> <strong class=
2804: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2805: <code class="prompt">#</code> <strong class=
2806: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2807: <code class="prompt">#</code> <strong class=
2808: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2809: <code class="prompt">#</code> <strong class=
2810: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2811: </pre>
2812: </li>
2813:
2814: <li>
1.45 wiz 2815: <p>An example <code xmlns=
2816: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2817: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2818: placed in <code xmlns=
2819: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2820: "filename">/etc/mk.conf.example</code> file when
2821: you use the bootstrap script. OpenBSD's make
1.45 wiz 2822: program uses <code xmlns=
2823: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2824: "filename">/etc/mk.conf</code> as well. You can
1.47 reed 2825: work around this by enclosing all the
2826: pkgsrc-specific parts of the file with:</p>
1.1 grant 2827: <pre class="programlisting">
1.51 rillig 2828: .ifdef BSD_PKG_MK
2829: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
2830: .else
2831: # OpenBSD stuff
2832: .endif
1.1 grant 2833: </pre>
2834: </li>
2835: </ol>
2836: </div>
2837: </div>
2838:
1.67 hubertf 2839: <div class="sect2" lang="en">
1.1 grant 2840: <div class="titlepage">
2841: <div>
2842: <div>
1.67 hubertf 2843: <h3 class="title"><a name=
1.30 wiz 2844: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2845: </div>
2846: </div>
2847: </div>
2848:
2849: <p>Solaris 2.6 through 9 are supported on both x86 and
2850: sparc. You will need a working C compiler. Both gcc
2851: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2852:
2853: <p>The following packages are required on Solaris 8 for
2854: the bootstrap process and to build packages.</p>
2855:
2856: <div class="itemizedlist">
2857: <ul type="disc">
2858: <li>
2859: <p>SUNWsprot</p>
2860: </li>
2861:
2862: <li>
2863: <p>SUNWarc</p>
2864: </li>
2865:
2866: <li>
2867: <p>SUNWbtool</p>
2868: </li>
2869:
2870: <li>
2871: <p>SUNWtoo</p>
2872: </li>
2873:
2874: <li>
2875: <p>SUNWlibm</p>
2876: </li>
2877: </ul>
2878: </div>
2879:
2880: <p>Please note the use of GNU binutils on Solaris is
2881: <span class="emphasis"><em>not</em></span>
2882: supported.</p>
2883:
1.70 ! rillig 2884: <p>Whichever compiler you use, please ensure the
! 2885: compiler tools and your $prefix are in your
! 2886: <code class="varname">PATH</code>. This includes
! 2887: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 2888: class="filename">/usr/ccs/{bin,lib}</code> and e.g.
! 2889: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 2890: class="filename">/usr/pkg/{bin,sbin}</code>.</p>
! 2891:
1.67 hubertf 2892: <div class="sect3" lang="en">
1.1 grant 2893: <div class="titlepage">
2894: <div>
2895: <div>
1.67 hubertf 2896: <h4 class="title"><a name=
2897: "solaris-gcc-note"></a>3.2.7.1. If you are
2898: using gcc</h4>
1.1 grant 2899: </div>
2900: </div>
2901: </div>
2902:
2903: <p>It makes life much simpler if you only use the
2904: same gcc consistently for building all packages.</p>
2905:
2906: <p>It is recommended that an external gcc be used
2907: only for bootstrapping, then either build gcc from
2908: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2909: href=
2910: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45 wiz 2911: target="_top"><code xmlns="" class=
2912: "filename">lang/gcc</code></a> or install a binary
2913: gcc package, then remove gcc used during
1.20 ben 2914: bootstrapping.</p>
1.1 grant 2915:
2916: <p>Binary packages of gcc can be found through
2917: <a href=
2918: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2919: target=
2920: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2921: </div>
2922:
1.67 hubertf 2923: <div class="sect3" lang="en">
1.1 grant 2924: <div class="titlepage">
2925: <div>
2926: <div>
1.30 wiz 2927: <h4 class="title"><a name=
2928: "solaris-sun-workshop-note"></a>3.2.7.2. If
2929: you are using Sun WorkShop</h4>
1.1 grant 2930: </div>
2931: </div>
2932: </div>
2933:
2934: <p>You will need at least the following packages
2935: installed (from WorkShop 5.0)</p>
2936:
2937: <div class="itemizedlist">
2938: <ul type="disc">
2939: <li>
2940: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2941: </li>
2942:
2943: <li>
2944: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2945: </li>
2946:
2947: <li>
2948: <p>SPROild - Sun WorkShop Incremental
2949: Linker</p>
2950: </li>
2951:
2952: <li>
2953: <p>SPROlang - Sun WorkShop Compilers common
2954: components</p>
2955: </li>
2956: </ul>
2957: </div>
2958:
1.14 xtraeme 2959: <p>You should set <code class="varname">CC</code>,
2960: <code class="varname">CXX</code> and optionally,
1.45 wiz 2961: <code class="varname">CPP</code> in <code xmlns=
2962: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2963: "filename">/etc/mk.conf</code>, e.g.:</p>
1.1 grant 2964: <pre class="programlisting">
1.51 rillig 2965: CC= cc
2966: CXX= CC
2967: CPP= /usr/ccs/lib/cpp
1.1 grant 2968: </pre>
1.70 ! rillig 2969: </div>
! 2970:
! 2971: <div class="sect3" lang="en">
! 2972: <div class="titlepage">
! 2973: <div>
! 2974: <div>
! 2975: <h4 class="title"><a name=
! 2976: "solaris-sunpro-64"></a>3.2.7.3. Buildling
! 2977: 64-bit binaries with SunPro</h4>
! 2978: </div>
! 2979: </div>
! 2980: </div>
1.1 grant 2981:
1.70 ! rillig 2982: <p>Building 64-bit binaries is a little trickier.
! 2983: First, you need to bootstrap pkgsrc in 64-bit mode.
! 2984: One problem here is that while building one of the
! 2985: programs in the bootstrap kit (<code xmlns=
! 2986: "http://www.w3.org/TR/xhtml1/transitional" class=
! 2987: "filename">bmake</code>), the <code class=
! 2988: "varname">CFLAGS</code> variable is not honored, even
! 2989: if it is set in the environment. To work around this
! 2990: bug, you can create a simple shell script called
! 2991: <code xmlns=
! 2992: "http://www.w3.org/TR/xhtml1/transitional" class=
! 2993: "filename">cc64</code> and put it somewhere in the
! 2994: <code class="varname">PATH</code>:</p>
! 2995: <pre class="programlisting">
! 2996: #! /bin/sh
! 2997: exec /opt/SUNWspro/bin/cc -xtarget=ultra -xarch=v9 ${1+"$@"}
! 2998: </pre>
! 2999:
! 3000: <p>Then, pass the definition for <code class=
! 3001: "varname">CC</code> in the environment of the
! 3002: <span><strong class=
! 3003: "command">bootstrap</strong></span> command:</p>
! 3004: <pre class="programlisting">
! 3005: <code class="prompt">$</code> <strong class=
! 3006: "userinput"><code>cd bootstrap</code></strong>
! 3007: <code class="prompt">$</code> <strong class=
! 3008: "userinput"><code>CC=cc64 ./bootstrap</code></strong>
! 3009: </pre>
! 3010:
! 3011: <p>After bootstrapping, there are two alternative
! 3012: ways, depending on whether you want to find bugs in
! 3013: packages or get your system ready quickly. If you
! 3014: just want a running system, add the following lines
! 3015: to your <code xmlns=
! 3016: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3017: "filename">mk.conf</code> file:</p>
1.1 grant 3018: <pre class="programlisting">
1.70 ! rillig 3019: CC= cc64
! 3020: CXX= CC64
! 3021: PKGSRC_COMPILER= sunpro
1.1 grant 3022: </pre>
3023:
1.70 ! rillig 3024: <p>This way, all calls to the compiler will be
! 3025: intercepted by the above wrapper and therefore get
! 3026: the necessary ABI options automatically. (Don't
! 3027: forget to create the shell script <code xmlns=
1.45 wiz 3028: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 ! rillig 3029: "filename">CC64</code>, too.)</p>
! 3030:
! 3031: <p>To find packages that ignore the user-specified
! 3032: <code class="varname">CFLAGS</code> and <code class=
! 3033: "varname">CXXFLAGS</code>, add the following lines to
! 3034: your <code xmlns=
1.45 wiz 3035: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 ! rillig 3036: "filename">mk.conf</code> file:</p>
! 3037: <pre class="programlisting">
! 3038: CC= cc
! 3039: CXX= CC
! 3040: PKGSRC_COMPILER= sunpro
! 3041: CFLAGS= -xtarget=ultra -xarch=v9
! 3042: CXXFLAGS= -xtarget=ultra -xarch=v9
! 3043: LDFLAGS= -xtarget=ultra -xarch=v9
! 3044: </pre>
! 3045:
! 3046: <p>Packages that don't use the flags provided in the
! 3047: configuration file will try to build 32-bit binaries
! 3048: and fail during linking. Detecting this is useful to
! 3049: prevent bugs on other platforms where the error would
! 3050: not show up but pass silently.</p>
1.1 grant 3051: </div>
1.68 rillig 3052:
3053: <div class="sect3" lang="en">
3054: <div class="titlepage">
3055: <div>
3056: <div>
3057: <h4 class="title"><a name=
1.70 ! rillig 3058: "plat.sunos.problems"></a>3.2.7.4. Common
1.68 rillig 3059: problems</h4>
3060: </div>
3061: </div>
3062: </div>
3063:
3064: <p>Sometimes, when using <span><strong class=
3065: "command">libtool</strong></span>, <code xmlns=
3066: "http://www.w3.org/TR/xhtml1/transitional" class=
3067: "filename">/bin/ksh</code> crashes with a
3068: segmentation fault. The workaround is to use another
3069: shell for the configure scripts, for example by
3070: installing <a xmlns=
3071: "http://www.w3.org/TR/xhtml1/transitional" href=
3072: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/bash/README.html"
3073: target="_top"><code xmlns="" class=
3074: "filename">shells/bash</code></a> and adding the
1.69 rillig 3075: following lines to your <code xmlns=
1.68 rillig 3076: "http://www.w3.org/TR/xhtml1/transitional" class=
3077: "filename">mk.conf</code>:</p>
3078: <pre class="programlisting">
3079: CONFIG_SHELL= ${LOCALBASE}/bin/bash
1.69 rillig 3080: WRAPPER_SHELL= ${LOCALBASE}/bin/bash
1.68 rillig 3081: </pre>
3082: </div>
1.1 grant 3083: </div>
3084: </div>
3085: </div>
3086:
1.67 hubertf 3087: <div class="chapter" lang="en">
1.1 grant 3088: <div class="titlepage">
3089: <div>
3090: <div>
1.67 hubertf 3091: <h2 class="title"><a name=
1.1 grant 3092: "using"></a>Chapter 4. Using pkgsrc</h2>
3093: </div>
3094: </div>
3095: </div>
3096:
3097: <div class="toc">
3098: <p><b>Table of Contents</b></p>
3099:
3100: <dl>
1.70 ! rillig 3101: <dt><span class="sect1"><a href="#using-pkg">4.1. Using
! 3102: binary packages</a></span></dt>
1.1 grant 3103:
3104: <dd>
3105: <dl>
1.30 wiz 3106: <dt><span class="sect2"><a href=
1.70 ! rillig 3107: "#finding-binary-packages">4.1.1. Finding binary
! 3108: packages</a></span></dt>
1.1 grant 3109:
1.30 wiz 3110: <dt><span class="sect2"><a href=
1.70 ! rillig 3111: "#installing-binary-packages">4.1.2. Installing
1.30 wiz 3112: binary packages</a></span></dt>
1.1 grant 3113:
1.30 wiz 3114: <dt><span class="sect2"><a href=
3115: "#a-word-of-warning">4.1.3. A word of
3116: warning</a></span></dt>
1.1 grant 3117: </dl>
3118: </dd>
3119:
1.30 wiz 3120: <dt><span class="sect1"><a href=
3121: "#building-packages-from-source">4.2. Building packages
3122: from source</a></span></dt>
1.1 grant 3123:
3124: <dd>
3125: <dl>
1.30 wiz 3126: <dt><span class="sect2"><a href=
3127: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 3128:
1.30 wiz 3129: <dt><span class="sect2"><a href=
3130: "#fetching-distfiles">4.2.2. Fetching
3131: distfiles</a></span></dt>
1.1 grant 3132:
1.30 wiz 3133: <dt><span class="sect2"><a href=
3134: "#how-to-build-and-install">4.2.3. How to build and
3135: install</a></span></dt>
1.1 grant 3136:
1.30 wiz 3137: <dt><span class="sect2"><a href=
3138: "#selecting-the-compiler">4.2.4. Selecting the
3139: compiler</a></span></dt>
1.1 grant 3140: </dl>
3141: </dd>
3142: </dl>
3143: </div>
3144:
1.70 ! rillig 3145: <p>Basically, there are two ways of using pkgsrc. The first
! 3146: is to only install the package tools and to use binary
! 3147: packages that someone else has prepared. This is the
! 3148: “<span class="quote">pkg</span>” in pkgsrc. The
! 3149: second way is to install the “<span class=
! 3150: "quote">src</span>” of pkgsrc, too. Then you are able
! 3151: to build your own packages, and you can still use binary
! 3152: packages from someone else.</p>
! 3153:
1.67 hubertf 3154: <div class="sect1" lang="en">
1.1 grant 3155: <div class="titlepage">
3156: <div>
3157: <div>
3158: <h2 class="title" style="clear: both"><a name=
1.70 ! rillig 3159: "using-pkg"></a>4.1. Using binary
1.1 grant 3160: packages</h2>
3161: </div>
3162: </div>
3163: </div>
3164:
1.70 ! rillig 3165: <p>To use binary packages, you need some tools to manage
! 3166: them. On NetBSD, these tools are already installed. On
! 3167: all other operating systems, you need to install them
! 3168: first. For the following platforms, prebuilt versions of
! 3169: the package tools are available and can simply be
! 3170: downloaded and unpacked in the <code xmlns=
! 3171: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3172: "filename">/</code> directory:</p>
! 3173:
! 3174: <div class="informaltable">
! 3175: <a name="binary-bootstrap-kits"></a>
! 3176:
! 3177: <table border="1">
! 3178: <colgroup>
! 3179: <col />
! 3180: <col />
! 3181: </colgroup>
! 3182:
! 3183: <thead>
! 3184: <tr>
! 3185: <th>Platform</th>
! 3186:
! 3187: <th>URL</th>
! 3188: </tr>
! 3189: </thead>
! 3190:
! 3191: <tbody>
! 3192: <tr>
! 3193: <td>Solaris 5.10</td>
! 3194:
! 3195: <td><code xmlns=
! 3196: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3197: "filename">http://public.enst.fr/pkgsrc/packages/bootstrap-pkgsrc/</code></td>
! 3198: </tr>
! 3199: </tbody>
! 3200: </table>
! 3201: </div>
! 3202:
! 3203: <p>These prebuilt package tools use <code xmlns=
! 3204: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3205: "filename">/usr/pkg</code> for the base directory, and
! 3206: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 3207: class="filename">/var/db/pkg</code> for the database of
! 3208: installed packages. If you cannot use these directories
! 3209: for whatever reasons (maybe because you're not root), you
! 3210: have to build the package tools yourself, which is
! 3211: explained in <a href="#bootstrapping-pkgsrc" title=
! 3212: "3.1. Bootstrapping pkgsrc">Section 3.1,
! 3213: “Bootstrapping pkgsrc”</a>.</p>
1.1 grant 3214:
1.67 hubertf 3215: <div class="sect2" lang="en">
1.1 grant 3216: <div class="titlepage">
3217: <div>
3218: <div>
1.30 wiz 3219: <h3 class="title"><a name=
1.70 ! rillig 3220: "finding-binary-packages"></a>4.1.1. Finding
! 3221: binary packages</h3>
1.1 grant 3222: </div>
3223: </div>
3224: </div>
3225:
1.70 ! rillig 3226: <p>To install binary packages, you first need to know
! 3227: from where to get them. You can get them on CD-ROMs,
! 3228: DVDs, or via FTP or HTTP.</p>
! 3229:
! 3230: <p>For NetBSD, the binary packages are made available
! 3231: on <code xmlns=
! 3232: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3233: "filename">ftp.NetBSD.org</code> and its mirrors, in
! 3234: the directory <code xmlns=
1.45 wiz 3235: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 ! rillig 3236: "filename">/pub/NetBSD/packages/<em class=
! 3237: "replaceable"><code>OSVERSION</code></em>/<em class=
! 3238: "replaceable"><code>ARCH</code></em>/</code>. For
! 3239: <em class="replaceable"><code>OSVERSION</code></em>,
! 3240: you should insert the output of <span><strong class=
! 3241: "command">uname -r</strong></span>, and for <em class=
! 3242: "replaceable"><code>ARCH</code></em> the output of
! 3243: <span><strong class="command">uname
! 3244: -p</strong></span>.</p>
! 3245:
! 3246: <p>For some other platforms, binary packages can be
! 3247: found at the following locations:</p>
! 3248:
! 3249: <div class="informaltable">
! 3250: <a name="binary-packages"></a>
! 3251:
! 3252: <table border="1">
! 3253: <colgroup>
! 3254: <col />
! 3255: <col />
! 3256: </colgroup>
! 3257:
! 3258: <thead>
! 3259: <tr>
! 3260: <th>Platform</th>
! 3261:
! 3262: <th>URL</th>
! 3263: </tr>
! 3264: </thead>
! 3265:
! 3266: <tbody>
! 3267: <tr>
! 3268: <td>Solaris 5.10</td>
! 3269:
! 3270: <td><code xmlns=
! 3271: "http://www.w3.org/TR/xhtml1/transitional"
! 3272: class=
! 3273: "filename">http://public.enst.fr/pkgsrc/packages/</code></td>
! 3274: </tr>
! 3275: </tbody>
! 3276: </table>
! 3277: </div>
! 3278:
! 3279: <p>In each of these directories, there is a
1.45 wiz 3280: subdirectory <code xmlns=
3281: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 ! rillig 3282: "filename">All</code> that contains all the binary
! 3283: packages. Further, there are subdirectories for
! 3284: categories that contain symbolic links that point to
! 3285: the actual binary package in <code xmlns=
1.45 wiz 3286: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 ! rillig 3287: "filename">../All</code>. This directory layout is used
! 3288: for all package repositories, no matter if they are
! 3289: accessed via HTTP, FTP, NFS, CD-ROM, or the local
! 3290: filesystem.</p>
1.1 grant 3291: </div>
3292:
1.67 hubertf 3293: <div class="sect2" lang="en">
1.1 grant 3294: <div class="titlepage">
3295: <div>
3296: <div>
1.30 wiz 3297: <h3 class="title"><a name=
1.70 ! rillig 3298: "installing-binary-packages"></a>4.1.2. Installing
! 3299: binary packages</h3>
1.1 grant 3300: </div>
3301: </div>
3302: </div>
3303:
1.47 reed 3304: <p>If you have the files on a CD-ROM or downloaded them
1.23 wiz 3305: to your hard disk, you can install them with the
1.27 rillig 3306: following command (be sure to <span><strong class=
1.14 xtraeme 3307: "command">su</strong></span> to root first):</p>
1.1 grant 3308: <pre class="screen">
1.14 xtraeme 3309: <code class="prompt">#</code> <strong class=
3310: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 3311: </pre>
3312:
3313: <p>If you have FTP access and you don't want to
3314: download the packages via FTP prior to installation,
1.14 xtraeme 3315: you can do this automatically by giving
3316: <span><strong class="command">pkg_add</strong></span>
3317: an FTP URL:</p>
1.1 grant 3318: <pre class="screen">
1.14 xtraeme 3319: <code class="prompt">#</code> <strong class=
1.27 rillig 3320: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 3321: </pre>
3322:
1.27 rillig 3323: <p>Note that any prerequisite packages needed to run
3324: the package in question will be installed, too,
1.1 grant 3325: assuming they are present where you install from.</p>
3326:
1.23 wiz 3327: <p>To save some typing, you can set the <code class=
3328: "varname">PKG_PATH</code> environment variable to a
1.47 reed 3329: semicolon-separated list of paths (including remote
1.23 wiz 3330: URLs); trailing slashes are not allowed.</p>
3331:
1.45 wiz 3332: <p>Additionally to the <code xmlns=
3333: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 3334: "filename">All</code> directory there exists a
1.45 wiz 3335: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3336: class="filename">vulnerable</code> directory to which
3337: binary packages with known vulnerabilities are moved,
3338: since removing them could cause missing dependencies.
3339: To use these packages, add the <code xmlns=
3340: "http://www.w3.org/TR/xhtml1/transitional" class=
3341: "filename">vulnerable</code> directory to your
3342: <code class="varname">PKG_PATH</code>. However, you
3343: should run <a xmlns=
1.23 wiz 3344: "http://www.w3.org/TR/xhtml1/transitional" href=
3345: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 3346: target="_top"><code xmlns="" class=
3347: "filename">security/audit-packages</code></a>
1.47 reed 3348: regularly, especially after installing new packages,
3349: and verify that the vulnerabilities are acceptable for
3350: your configuration. An example <code class=
3351: "varname">PKG_PATH</code> would be: <code xmlns=
3352: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 3353: "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 3354: Please note that semicolon (';') is a shell
3355: meta-character, so you'll probably have to quote
3356: it.</p>
3357:
1.1 grant 3358: <p>After you've installed packages, be sure to have
1.45 wiz 3359: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3360: class="filename">/usr/pkg/bin</code> and <code xmlns=
3361: "http://www.w3.org/TR/xhtml1/transitional" class=
3362: "filename">/usr/pkg/sbin</code> in your <code class=
3363: "varname">PATH</code> so you can actually start the
3364: just installed program.</p>
1.1 grant 3365: </div>
3366:
1.67 hubertf 3367: <div class="sect2" lang="en">
1.1 grant 3368: <div class="titlepage">
3369: <div>
3370: <div>
1.67 hubertf 3371: <h3 class="title"><a name=
1.30 wiz 3372: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 3373: warning</h3>
3374: </div>
3375: </div>
3376: </div>
3377:
3378: <p>Please pay very careful attention to the warnings
3379: expressed in the <a href=
3380: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3381: <span class="citerefentry"><span class=
3382: "refentrytitle">pkg_add</span>(1)</span></a> manual
3383: page about the inherent dangers of installing binary
3384: packages which you did not create yourself, and the
3385: security holes that can be introduced onto your system
3386: by indiscriminate adding of such files.</p>
1.66 rillig 3387:
3388: <p>The same warning of course applies to every package
3389: you install from source when you haven't completely
3390: read and understood the source code of the package, the
3391: compiler that is used to build the package and all the
3392: other tools that are involved.</p>
1.1 grant 3393: </div>
3394: </div>
3395:
1.67 hubertf 3396: <div class="sect1" lang="en">
1.1 grant 3397: <div class="titlepage">
3398: <div>
3399: <div>
3400: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3401: "building-packages-from-source"></a>4.2. Building
1.1 grant 3402: packages from source</h2>
3403: </div>
3404: </div>
3405: </div>
3406:
3407: <p>This assumes that the package is already in pkgsrc. If
3408: it is not, see <a href="#developers-guide" title=
1.46 gdt 3409: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 3410: “The pkgsrc developer's guide”</a> for
3411: instructions how to create your own packages.</p>
1.1 grant 3412:
1.67 hubertf 3413: <div class="sect2" lang="en">
1.1 grant 3414: <div class="titlepage">
3415: <div>
3416: <div>
1.67 hubertf 3417: <h3 class="title"><a name=
1.30 wiz 3418: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 3419: </div>
3420: </div>
3421: </div>
3422:
3423: <p>To build packages from source on a NetBSD system the
3424: “<span class="quote">comp</span>” and the
3425: “<span class="quote">text</span>”
3426: distribution sets must be installed. If you want to
1.47 reed 3427: build X11-related packages the “<span class=
1.1 grant 3428: "quote">xbase</span>” and “<span class=
3429: "quote">xcomp</span>” distribution sets are
3430: required, too.</p>
3431: </div>
3432:
1.67 hubertf 3433: <div class="sect2" lang="en">
1.1 grant 3434: <div class="titlepage">
3435: <div>
3436: <div>
1.67 hubertf 3437: <h3 class="title"><a name=
3438: "fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 3439: distfiles</h3>
3440: </div>
3441: </div>
3442: </div>
3443:
1.27 rillig 3444: <p>The first step for building a package is downloading
3445: the distfiles (i.e. the unmodified source). If they
3446: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 3447: automatically.</p>
3448:
3449: <p>You can overwrite some of the major distribution
3450: sites to fit to sites that are close to your own. Have
1.45 wiz 3451: a look at <code xmlns=
3452: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3453: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 3454: some examples — in particular, look for the
1.14 xtraeme 3455: <code class="varname">MASTER_SORT</code>, <code class=
3456: "varname">MASTER_SORT_REGEX</code> and <code class=
3457: "varname">INET_COUNTRY</code> definitions. This may
3458: save some of your bandwidth and time.</p>
1.1 grant 3459:
3460: <p>You can change these settings either in your shell's
3461: environment, or, if you want to keep the settings, by
1.45 wiz 3462: editing the <code xmlns=
3463: "http://www.w3.org/TR/xhtml1/transitional" class=
3464: "filename">/etc/mk.conf</code> file, and adding the
3465: definitions there.</p>
1.1 grant 3466:
3467: <p>If you don't have a permanent Internet connection
3468: and you want to know which files to download,
1.14 xtraeme 3469: <span><strong class="command">make
3470: fetch-list</strong></span> will tell you what you'll
1.45 wiz 3471: need. Put these distfiles into <code xmlns=
3472: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3473: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 3474: </div>
3475:
1.67 hubertf 3476: <div class="sect2" lang="en">
1.1 grant 3477: <div class="titlepage">
3478: <div>
3479: <div>
1.30 wiz 3480: <h3 class="title"><a name=
3481: "how-to-build-and-install"></a>4.2.3. How to
3482: build and install</h3>
1.1 grant 3483: </div>
3484: </div>
3485: </div>
3486:
3487: <p>Assuming that the distfile has been fetched (see
3488: previous section), become root and change into the
1.47 reed 3489: relevant directory and run <span><strong class=
3490: "command">make</strong></span>.</p>
3491:
3492: <div class="note" style=
3493: "margin-left: 0.5in; margin-right: 0.5in;">
3494: <h3 class="title">Note</h3>
3495:
3496: <p>If using bootstrap or pkgsrc on a non-NetBSD
3497: system, use the pkgsrc <span><strong class=
3498: "command">bmake</strong></span> command instead of
3499: “<span class="quote">make</span>” in the
3500: examples in this guide.</p>
3501: </div>
3502:
3503: <p>For example, type</p>
1.1 grant 3504: <pre class="screen">
1.14 xtraeme 3505: <code class="prompt">%</code> <strong class=
3506: "userinput"><code>cd misc/figlet</code></strong>
3507: <code class="prompt">%</code> <strong class=
3508: "userinput"><code>make</code></strong>
1.1 grant 3509: </pre>
3510:
3511: <p>at the shell prompt to build the various components
3512: of the package, and</p>
3513: <pre class="screen">
1.14 xtraeme 3514: <code class="prompt">#</code> <strong class=
3515: "userinput"><code>make install</code></strong>
1.1 grant 3516: </pre>
3517:
3518: <p>to install the various components into the correct
3519: places on your system. Installing the package on your
3520: system requires you to be root. However, pkgsrc has a
3521: <span class="emphasis"><em>just-in-time-su</em></span>
3522: feature, which allows you to only become root for the
3523: actual installation step</p>
3524:
3525: <p>Taking the figlet utility as an example, we can
3526: install it on our system by building as shown in
3527: <a href="#logs" title=
1.67 hubertf 3528: "Appendix B. Build logs">Appendix B,
3529: <i>Build logs</i></a>.</p>
1.1 grant 3530:
3531: <p>The program is installed under the default root of
1.45 wiz 3532: the packages tree - <code xmlns=
3533: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3534: "filename">/usr/pkg</code>. Should this not conform to
3535: your tastes, set the <code class=
3536: "varname">LOCALBASE</code> variable in your
1.1 grant 3537: environment, and it will use that value as the root of
1.45 wiz 3538: your packages tree. So, to use <code xmlns=
3539: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3540: "filename">/usr/local</code>, set <code class=
3541: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 3542: environment. Please note that you should use a
3543: directory which is dedicated to packages and not shared
1.47 reed 3544: with other programs (i.e., do not try and use
1.14 xtraeme 3545: <code class="varname">LOCALBASE=/usr</code>). Also, you
3546: should not try to add any of your own files or
1.45 wiz 3547: directories (such as <code xmlns=
3548: "http://www.w3.org/TR/xhtml1/transitional" class=
3549: "filename">src/</code>, <code xmlns=
3550: "http://www.w3.org/TR/xhtml1/transitional" class=
3551: "filename">obj/</code>, or <code xmlns=
3552: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3553: "filename">pkgsrc/</code>) below the <code class=
3554: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 3555: possible conflicts between programs and other files
3556: installed by the package system and whatever else may
3557: have been installed there.</p>
3558:
1.45 wiz 3559: <p>Some packages look in <code xmlns=
3560: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3561: "filename">/etc/mk.conf</code> to alter some
1.1 grant 3562: configuration options at build time. Have a look at
1.45 wiz 3563: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3564: class="filename">pkgsrc/mk/defaults/mk.conf</code> to
3565: get an overview of what will be set there by default.
1.14 xtraeme 3566: Environment variables such as <code class=
1.45 wiz 3567: "varname">LOCALBASE</code> can be set in <code xmlns=
3568: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3569: "filename">/etc/mk.conf</code> to save having to
3570: remember to set them each time you want to use
3571: pkgsrc.</p>
1.1 grant 3572:
3573: <p>Occasionally, people want to “<span class=
3574: "quote">look under the covers</span>” to see what
3575: is going on when a package is building or being
3576: installed. This may be for debugging purposes, or out
3577: of simple curiosity. A number of utility values have
3578: been added to help with this.</p>
3579:
3580: <div class="orderedlist">
3581: <ol type="1">
3582: <li>
3583: <p>If you invoke the <a href=
3584: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3585: <span class="citerefentry"><span class=
3586: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 3587: with <code class=
3588: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
3589: amount of information will be displayed. For
3590: example,</p>
1.1 grant 3591: <pre class="screen">
1.14 xtraeme 3592: <strong class=
3593: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 3594: </pre>
3595:
3596: <p>will show all the commands that are invoked,
3597: up to and including the “<span class=
3598: "quote">patch</span>” stage.</p>
3599: </li>
3600:
3601: <li>
3602: <p>If you want to know the value of a certain
1.22 tv 3603: <a href=
3604: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3605: <span class="citerefentry"><span class=
3606: "refentrytitle">make</span>(1)</span></a>
3607: definition, then the <code class=
1.14 xtraeme 3608: "varname">VARNAME</code> definition should be
3609: used, in conjunction with the show-var target.
3610: e.g. to show the expansion of the <a href=
1.1 grant 3611: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3612: <span class="citerefentry"><span class=
3613: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 3614: variable <code class=
1.22 tv 3615: "varname">LOCALBASE</code>:</p>
1.1 grant 3616: <pre class="screen">
1.14 xtraeme 3617: <code class="prompt">%</code> <strong class=
3618: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 3619: /usr/pkg
1.14 xtraeme 3620: <code class="prompt">%</code>
1.1 grant 3621:
3622: </pre>
3623: </li>
3624: </ol>
3625: </div>
3626:
3627: <p>If you want to install a binary package that you've
3628: either created yourself (see next section), that you
3629: put into pkgsrc/packages manually or that is located on
1.8 wiz 3630: a remote FTP server, you can use the "bin-install"
1.1 grant 3631: target. This target will install a binary package - if
3632: available - via <a href=
3633: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3634: <span class="citerefentry"><span class=
3635: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 3636: <span><strong class="command">make
3637: package</strong></span>. The list of remote FTP sites
3638: searched is kept in the variable <code class=
3639: "varname">BINPKG_SITES</code>, which defaults to
3640: ftp.NetBSD.org. Any flags that should be added to
3641: <a href=
1.1 grant 3642: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3643: <span class="citerefentry"><span class=
3644: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 3645: into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45 wiz 3646: See <code xmlns=
3647: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3648: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
3649: details.</p>
1.1 grant 3650:
1.47 reed 3651: <p>A final word of warning: If you set up a system that
1.14 xtraeme 3652: has a non-standard setting for <code class=
3653: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 3654: any packages are installed, as you can not use several
3655: directories for the same purpose. Doing so will result
3656: in pkgsrc not being able to properly detect your
3657: installed packages, and fail miserably. Note also that
3658: precompiled binary packages are usually built with the
1.14 xtraeme 3659: default <code class="varname">LOCALBASE</code> of
1.45 wiz 3660: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3661: class="filename">/usr/pkg</code>, and that you should
3662: <span class="emphasis"><em>not</em></span> install any
3663: if you use a non-standard <code class=
1.14 xtraeme 3664: "varname">LOCALBASE</code>.</p>
1.1 grant 3665: </div>
3666:
1.67 hubertf 3667: <div class="sect2" lang="en">
1.1 grant 3668: <div class="titlepage">
3669: <div>
3670: <div>
1.30 wiz 3671: <h3 class="title"><a name=
3672: "selecting-the-compiler"></a>4.2.4. Selecting
3673: the compiler</h3>
1.1 grant 3674: </div>
3675: </div>
3676: </div>
3677:
3678: <p>By default, pkgsrc will use GCC to build packages.
3679: This may be overridden by setting the following
3680: variables in /etc/mk.conf:</p>
3681:
3682: <div class="variablelist">
3683: <dl>
1.14 xtraeme 3684: <dt><span class="term"><code class=
3685: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3686:
3687: <dd>
3688: <p>This is a list of values specifying the chain
3689: of compilers to invoke when building packages.
3690: Valid values are:</p>
3691:
3692: <div class="itemizedlist">
3693: <ul type="disc">
3694: <li>
1.14 xtraeme 3695: <p><code class="varname">distcc</code>:
1.1 grant 3696: distributed C/C++ (chainable)</p>
3697: </li>
3698:
3699: <li>
1.14 xtraeme 3700: <p><code class="varname">ccache</code>:
1.1 grant 3701: compiler cache (chainable)</p>
3702: </li>
3703:
3704: <li>
1.14 xtraeme 3705: <p><code class="varname">gcc</code>: GNU
3706: C/C++ Compiler</p>
1.1 grant 3707: </li>
3708:
3709: <li>
1.14 xtraeme 3710: <p><code class="varname">mipspro</code>:
1.1 grant 3711: Silicon Graphics, Inc. MIPSpro
3712: (n32/n64)</p>
3713: </li>
3714:
3715: <li>
1.14 xtraeme 3716: <p><code class="varname">mipspro</code>:
1.1 grant 3717: Silicon Graphics, Inc. MIPSpro (o32)</p>
3718: </li>
3719:
3720: <li>
1.64 kim 3721: <p><code class="varname">sunpro</code>: Sun
1.1 grant 3722: Microsystems, Inc. WorkShip/Forte/Sun ONE
3723: Studio</p>
3724: </li>
3725: </ul>
3726: </div>
3727:
3728: <p>The default is “<span class=
1.14 xtraeme 3729: "quote"><code class=
3730: "varname">gcc</code></span>”. You can use
3731: <code class="varname">ccache</code> and/or
3732: <code class="varname">distcc</code> with an
3733: appropriate <code class=
3734: "varname">PKGSRC_COMPILER</code> setting, e.g.
3735: “<span class="quote"><code class=
3736: "varname">ccache gcc</code></span>”. This
1.1 grant 3737: variable should always be terminated with a value
3738: for a real compiler.</p>
3739: </dd>
3740:
1.14 xtraeme 3741: <dt><span class="term"><code class=
3742: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3743:
3744: <dd>
3745: <p>This specifies the minimum version of GCC to
3746: use when building packages. If the system GCC
3747: doesn't satisfy this requirement, then pkgsrc
3748: will build and install one of the GCC packages to
3749: use instead.</p>
3750: </dd>
3751: </dl>
3752: </div>
3753: </div>
3754: </div>
3755: </div>
3756:
1.67 hubertf 3757: <div class="chapter" lang="en">
1.1 grant 3758: <div class="titlepage">
3759: <div>
3760: <div>
1.67 hubertf 3761: <h2 class="title"><a name=
1.38 dillo 3762: "configuring"></a>Chapter 5. Configuring
3763: pkgsrc</h2>
3764: </div>
3765: </div>
3766: </div>
3767:
3768: <div class="toc">
3769: <p><b>Table of Contents</b></p>
3770:
3771: <dl>
3772: <dt><span class="sect1"><a href=
1.45 wiz 3773: "#general-configuration">5.1. General
3774: configuration</a></span></dt>
3775:
3776: <dt><span class="sect1"><a href=
3777: "#variables-affecting-build">5.2. Variables affecting
3778: the build process</a></span></dt>
3779:
3780: <dt><span class="sect1"><a href=
3781: "#developer-advanced-settings">5.3. Developer/advanced
3782: settings</a></span></dt>
3783:
3784: <dt><span class="sect1"><a href=
3785: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 3786: Options</a></span></dt>
1.38 dillo 3787: </dl>
3788: </div>
3789:
1.67 hubertf 3790: <div class="sect1" lang="en">
1.38 dillo 3791: <div class="titlepage">
3792: <div>
3793: <div>
3794: <h2 class="title" style="clear: both"><a name=
1.45 wiz 3795: "general-configuration"></a>5.1. General
3796: configuration</h2>
3797: </div>
3798: </div>
3799: </div>
3800:
1.47 reed 3801: <p>In this section, you can find some variables that
3802: apply to all pkgsrc packages. The preferred method of
3803: setting these variables is by setting them in
3804: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3805: class="filename">/etc/mk.conf</code>.</p>
1.45 wiz 3806:
3807: <div class="itemizedlist">
3808: <ul type="disc">
3809: <li>
3810: <p><code class="varname">LOCALBASE</code>: Where
3811: packages will be installed. The default is
3812: <code xmlns=
3813: "http://www.w3.org/TR/xhtml1/transitional" class=
3814: "filename">/usr/pkg</code>. Do not mix binary
3815: packages with different <code class=
3816: "varname">LOCALBASE</code>s!</p>
3817: </li>
3818:
3819: <li>
3820: <p><code class="varname">CROSSBASE</code>: Where
3821: “<span class="quote">cross</span>”
3822: category packages will be installed. The default is
3823: <code xmlns=
3824: "http://www.w3.org/TR/xhtml1/transitional" class=
3825: "filename">${LOCALBASE}/cross</code>.</p>
3826: </li>
3827:
3828: <li>
3829: <p><code class="varname">X11BASE</code>: Where X11
3830: is installed on the system. The default is
3831: <code xmlns=
3832: "http://www.w3.org/TR/xhtml1/transitional" class=
3833: "filename">/usr/X11R6</code>.</p>
3834: </li>
3835:
3836: <li>
3837: <p><code class="varname">DISTDIR</code>: Where to
3838: store the downloaded copies of the original source
3839: distributions used for building pkgsrc packages.
3840: The default is <code xmlns=
3841: "http://www.w3.org/TR/xhtml1/transitional" class=
3842: "filename">${PKGSRCDIR}/distfiles</code>.</p>
3843: </li>
3844:
3845: <li>
3846: <p><code class=
3847: "varname">MASTER_SITE_OVERRIDE</code>: If set,
3848: override the packages' <code class=
3849: "varname">MASTER_SITES</code> with this value.</p>
3850: </li>
3851:
3852: <li>
3853: <p><code class="varname">MASTER_SITE_BACKUP</code>:
3854: Backup location(s) for distribution files and patch
3855: files if not found locally or in <code xmlns=
3856: "http://www.w3.org/TR/xhtml1/transitional" class=
3857: "filename">${MASTER_SITES}</code> or <code xmlns=
3858: "http://www.w3.org/TR/xhtml1/transitional" class=
3859: "filename">${PATCH_SITES}</code> respectively. The
3860: defaults are <code xmlns=
3861: "http://www.w3.org/TR/xhtml1/transitional" class=
3862: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
3863: and <code xmlns=
3864: "http://www.w3.org/TR/xhtml1/transitional" class=
3865: "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
3866: </li>
3867:
3868: <li>
3869: <p><code class="varname">BINPKG_SITES</code>: List
3870: of sites carrying binary pkgs.</p>
3871: </li>
3872: </ul>
3873: </div>
3874: </div>
3875:
1.67 hubertf 3876: <div class="sect1" lang="en">
1.45 wiz 3877: <div class="titlepage">
3878: <div>
3879: <div>
3880: <h2 class="title" style="clear: both"><a name=
3881: "variables-affecting-build"></a>5.2. Variables
3882: affecting the build process</h2>
3883: </div>
3884: </div>
3885: </div>
3886:
3887: <p>XXX</p>
3888:
3889: <div class="itemizedlist">
3890: <ul type="disc">
3891: <li>
3892: <p><code class="varname">PACKAGES</code>: The top
3893: level directory for the binary packages. The
3894: default is <code xmlns=
3895: "http://www.w3.org/TR/xhtml1/transitional" class=
3896: "filename">${PKGSRCDIR}/packages</code>.</p>
3897: </li>
3898:
3899: <li>
3900: <p><code class="varname">WRKOBJDIR</code>: The top
3901: level directory where, if defined, the separate
3902: working directories will get created, and
3903: symbolically linked to from <code xmlns=
3904: "http://www.w3.org/TR/xhtml1/transitional" class=
3905: "filename">${WRKDIR}</code> (see below). This is
3906: useful for building packages on several
3907: architectures, then <code xmlns=
3908: "http://www.w3.org/TR/xhtml1/transitional" class=
3909: "filename">${PKGSRCDIR}</code> can be NFS-mounted
3910: while <code xmlns=
3911: "http://www.w3.org/TR/xhtml1/transitional" class=
3912: "filename">${WRKOBJDIR}</code> is local to every
3913: architecture. (It should be noted that <code class=
3914: "varname">PKGSRCDIR</code> should not be set by the
3915: user — it is an internal definition which
3916: refers to the root of the pkgsrc tree. It is
3917: possible to have many pkgsrc tree instances.)</p>
3918: </li>
3919:
3920: <li>
3921: <p><code class="varname">LOCALPATCHES</code>:
3922: Directory for local patches that aren't part of
3923: pkgsrc. See <a href="#components.patches" title=
3924: "8.3. patches/*">Section 8.3,
3925: “patches/*”</a> for more information.
3926: <em class="replaceable"><code>rel</code></em> and
3927: <em class="replaceable"><code>arch</code></em> are
3928: replaced with OS release (“<span class=
3929: "quote">2.0</span>”, etc.) and architecture
3930: (“<span class="quote">mipsel</span>”,
3931: etc.).</p>
3932: </li>
3933:
3934: <li>
3935: <p><code class="varname">PKGMAKECONF</code>:
3936: Location of the <code xmlns=
3937: "http://www.w3.org/TR/xhtml1/transitional" class=
3938: "filename">mk.conf</code> file used by a package's
3939: BSD-style Makefile. If this is not set,
3940: <code class="varname">MAKECONF</code> is set to
3941: <code xmlns=
3942: "http://www.w3.org/TR/xhtml1/transitional" class=
3943: "filename">/dev/null</code> to avoid picking up
3944: settings used by builds in <code xmlns=
3945: "http://www.w3.org/TR/xhtml1/transitional" class=
3946: "filename">/usr/src</code>.</p>
3947: </li>
3948: </ul>
3949: </div>
3950: </div>
3951:
1.67 hubertf 3952: <div class="sect1" lang="en">
1.45 wiz 3953: <div class="titlepage">
3954: <div>
3955: <div>
3956: <h2 class="title" style="clear: both"><a name=
3957: "developer-advanced-settings"></a>5.3. Developer/advanced
3958: settings</h2>
3959: </div>
3960: </div>
3961: </div>
3962:
3963: <p>XXX</p>
3964:
3965: <div class="itemizedlist">
3966: <ul type="disc">
3967: <li>
3968: <p><code class="varname">PKG_DEVELOPER</code>: Run
3969: some sanity checks that package developers
3970: want:</p>
3971:
3972: <div class="itemizedlist">
3973: <ul type="circle">
3974: <li>
3975: <p>make sure patches apply with zero fuzz</p>
3976: </li>
3977:
3978: <li>
3979: <p>run check-shlibs to see that all binaries
3980: will find their shared libs.</p>
3981: </li>
3982: </ul>
3983: </div>
3984: </li>
3985:
3986: <li>
3987: <p><code class="varname">PKG_DEBUG_LEVEL</code>:
3988: The level of debugging output which is displayed
3989: whilst making and installing the package. The
3990: default value for this is 0, which will not display
3991: the commands as they are executed (normal, default,
3992: quiet operation); the value 1 will display all
3993: shell commands before their invocation, and the
3994: value 2 will display both the shell commands before
3995: their invocation, and their actual execution
3996: progress with <span><strong class="command">set
3997: -x</strong></span> will be displayed.</p>
3998: </li>
1.58 erh 3999:
4000: <li>
4001: <p><code class=
4002: "varname">ALLOW_VULNERABILITIES.<em class=
4003: "replaceable"><code>pkgbase</code></em></code>: A
4004: space separated list of vulnerability IDs that may
4005: be ignored when performing the automated security
4006: checks. These IDs are listed in the
4007: pkg-vulnerabilities file and are displayed by
4008: <span><strong class=
4009: "command">audit-packages</strong></span> when it
4010: finds a vulnerable package.</p>
4011: </li>
4012:
4013: <li>
4014: <p><code class=
4015: "varname">SKIP_AUDIT_PACKAGES</code>: If this is
4016: set to “<span class=
4017: "quote">yes</span>”, the automated security
4018: checks (which use the <a xmlns=
4019: "http://www.w3.org/TR/xhtml1/transitional" href=
4020: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
4021: target="_top"><code xmlns="" class=
4022: "filename">security/audit-packages</code></a>
4023: package) will be <span class=
4024: "strong"><strong>entirely</strong></span> skipped
4025: for <span class=
4026: "strong"><strong>all</strong></span> packages
4027: built. Normally you'll want to use
4028: ALLOW_VULNERABILITIES instead of this.</p>
4029: </li>
1.45 wiz 4030: </ul>
4031: </div>
4032: </div>
4033:
1.67 hubertf 4034: <div class="sect1" lang="en">
1.45 wiz 4035: <div class="titlepage">
4036: <div>
4037: <div>
4038: <h2 class="title" style="clear: both"><a name=
4039: "selecting-build-options"></a>5.4. Selecting
4040: Build Options</h2>
1.38 dillo 4041: </div>
4042: </div>
4043: </div>
4044:
4045: <p>Some packages have build time options, usually to
4046: select between different dependencies, enable optional
4047: support for big dependencies or enable experimental
4048: features.</p>
4049:
4050: <p>To see which options, if any, a package supports, and
4051: which options are mutually exclusive, run
4052: <span><strong class="command">make
4053: show-options</strong></span>, for example:</p>
4054: <pre class="programlisting">
1.51 rillig 4055: The following options are supported by this package:
1.70 ! rillig 4056: ssl Enable SSL support.
1.51 rillig 4057: Exactly one of the following gecko options is required:
1.70 ! rillig 4058: firefox Use firefox as gecko rendering engine.
! 4059: mozilla Use mozilla as gecko rendering engine.
1.51 rillig 4060: At most one of the following database options may be selected:
1.70 ! rillig 4061: mysql Enable support for MySQL database.
! 4062: pgsql Enable support for PostgreSQL database.
1.51 rillig 4063:
4064: These options are enabled by default: firefox
4065: These options are currently enabled: mozilla ssl
1.38 dillo 4066: </pre>
4067:
1.45 wiz 4068: <p>The following variables can be defined in <code xmlns=
4069: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 4070: "filename">/etc/mk.conf</code> to select which options to
4071: enable for a package: <code class=
4072: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
4073: to select or disable options for all packages that
4074: support them, and <code class=
4075: "varname">PKG_OPTIONS.<em class=
4076: "replaceable"><code>pkgbase</code></em></code>, which can
4077: be used to select or disable options specifically for
4078: package <em class=
4079: "replaceable"><code>pkgbase</code></em>. Options listed
4080: in these variables are selected, options preceded by
1.67 hubertf 4081: “<span class="quote">-</span>” are disabled.
4082: A few examples:</p>
4083: <pre class="screen">
4084: <code class="prompt">$</code> <span><strong class=
4085: "command">grep "PKG.*OPTION" /etc/mk.conf</strong></span>
1.68 rillig 4086: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1.67 hubertf 4087: PKG_OPTIONS.kdebase= debug -sasl
4088: PKG_OPTIONS.apache= suexec
4089: </pre>
1.38 dillo 4090:
1.39 dillo 4091: <p>The following settings are consulted in the order
4092: given, and the last setting that selects or disables an
4093: option is used:</p>
1.38 dillo 4094:
4095: <div class="orderedlist">
4096: <ol type="1">
4097: <li>
4098: <p>the default options as suggested by the package
4099: maintainer</p>
4100: </li>
4101:
4102: <li>
4103: <p>the options implied by the settings of legacy
4104: variables (see below)</p>
4105: </li>
4106:
4107: <li>
4108: <p><code class=
4109: "varname">PKG_DEFAULT_OPTIONS</code></p>
4110: </li>
4111:
4112: <li>
4113: <p><code class="varname">PKG_OPTIONS.<em class=
4114: "replaceable"><code>pkgbase</code></em></code></p>
4115: </li>
4116: </ol>
4117: </div>
4118:
4119: <p>For groups of mutually exclusive options, the last
4120: option selected is used, all others are automatically
4121: disabled. If an option of the group is explicitly
4122: disabled, the previously selected option, if any, is
4123: used. It is an error if no option from a required group
4124: of options is selected, and building the package will
4125: fail.</p>
4126:
4127: <p>Before the options framework was introduced, build
1.65 hubertf 4128: options were selected by setting a variable (often named
4129: <code class="varname">USE_<em class=
4130: "replaceable"><code>FOO</code></em></code>) in
1.45 wiz 4131: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4132: class="filename">/etc/mk.conf</code> for each option. To
4133: ease transition to the options framework for the user,
4134: these legacy variables are converted to the appropriate
1.65 hubertf 4135: options setting (<code class=
4136: "varname">PKG_OPTIONS.<em class=
4137: "replaceable"><code>pkgbase</code></em></code>)
4138: automatically. A warning is issued to prompt the user to
4139: update <code xmlns=
1.45 wiz 4140: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 4141: "filename">/etc/mk.conf</code> to use the options
1.65 hubertf 4142: framework directly. Support for the legacy variables will
4143: be removed eventually.</p>
1.38 dillo 4144: </div>
4145: </div>
4146:
1.67 hubertf 4147: <div class="chapter" lang="en">
1.38 dillo 4148: <div class="titlepage">
4149: <div>
4150: <div>
1.67 hubertf 4151: <h2 class="title"><a name=
1.38 dillo 4152: "binary"></a>Chapter 6. Creating binary
1.1 grant 4153: packages</h2>
4154: </div>
4155: </div>
4156: </div>
4157:
4158: <div class="toc">
4159: <p><b>Table of Contents</b></p>
4160:
4161: <dl>
1.30 wiz 4162: <dt><span class="sect1"><a href=
1.38 dillo 4163: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 4164: single binary package</a></span></dt>
1.1 grant 4165:
1.30 wiz 4166: <dt><span class="sect1"><a href=
1.38 dillo 4167: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 4168: Settings for creation of binary
4169: packages</a></span></dt>
4170:
1.38 dillo 4171: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 4172: a bulk build of all packages</a></span></dt>
4173:
4174: <dd>
4175: <dl>
4176: <dt><span class="sect2"><a href=
1.38 dillo 4177: "#binary.configuration">6.3.1.
1.1 grant 4178: Configuration</a></span></dt>
4179:
1.30 wiz 4180: <dt><span class="sect2"><a href=
1.38 dillo 4181: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 4182: environmental considerations</a></span></dt>
1.1 grant 4183:
1.38 dillo 4184: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 4185: Operation</a></span></dt>
4186:
1.30 wiz 4187: <dt><span class="sect2"><a href=
1.38 dillo 4188: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 4189:
1.30 wiz 4190: <dt><span class="sect2"><a href=
1.38 dillo 4191: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 4192: requirements</a></span></dt>
1.1 grant 4193:
1.30 wiz 4194: <dt><span class="sect2"><a href=
1.38 dillo 4195: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47 reed 4196: for chrooted builds</a></span></dt>
1.1 grant 4197:
1.30 wiz 4198: <dt><span class="sect2"><a href=
1.38 dillo 4199: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 4200: set of packages</a></span></dt>
1.13 hubertf 4201:
4202: <dt><span class="sect2"><a href=
1.38 dillo 4203: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 4204: build</a></span></dt>
1.1 grant 4205: </dl>
4206: </dd>
4207:
1.38 dillo 4208: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 4209: Creating a multiple CD-ROM packages
4210: collection</a></span></dt>
4211:
4212: <dd>
4213: <dl>
1.30 wiz 4214: <dt><span class="sect2"><a href=
1.38 dillo 4215: "#cdpack-example">6.4.1. Example of
1.30 wiz 4216: cdpack</a></span></dt>
1.1 grant 4217: </dl>
4218: </dd>
4219: </dl>
4220: </div>
4221:
1.67 hubertf 4222: <div class="sect1" lang="en">
1.1 grant 4223: <div class="titlepage">
4224: <div>
4225: <div>
4226: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4227: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 4228: a single binary package</h2>
1.1 grant 4229: </div>
4230: </div>
4231: </div>
4232:
4233: <p>Once you have built and installed a package, you can
4234: create a <span class="emphasis"><em>binary
4235: package</em></span> which can be installed on another
4236: system with <a href=
4237: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4238: <span class="citerefentry"><span class=
1.47 reed 4239: "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1 grant 4240: having to build the same package on a group of hosts and
4241: wasting CPU time. It also provides a simple means for
4242: others to install your package, should you distribute
4243: it.</p>
4244:
4245: <p>To create a binary package, change into the
1.14 xtraeme 4246: appropriate directory in pkgsrc, and run
4247: <span><strong class="command">make
4248: package</strong></span>:</p>
1.1 grant 4249: <pre class="screen">
1.14 xtraeme 4250: <code class="prompt">#</code> <strong class=
4251: "userinput"><code>cd misc/figlet</code></strong>
4252: <code class="prompt">#</code> <strong class=
4253: "userinput"><code>make package</code></strong>
1.1 grant 4254: </pre>
4255:
4256: <p>This will build and install your package (if not
4257: already done), and then build a binary package from what
1.14 xtraeme 4258: was installed. You can then use the <span><strong class=
4259: "command">pkg_*</strong></span> tools to manipulate it.
1.45 wiz 4260: Binary packages are created by default in <code xmlns=
4261: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4262: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 4263: gzipped tar file. See <a href="#logs.package" title=
1.67 hubertf 4264: "B.2. Packaging figlet">Section B.2,
1.1 grant 4265: “Packaging figlet”</a> for a continuation of
4266: the above <a xmlns=
4267: "http://www.w3.org/TR/xhtml1/transitional" href=
4268: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45 wiz 4269: target="_top"><code xmlns="" class=
4270: "filename">misc/figlet</code></a> example.</p>
1.1 grant 4271:
4272: <p>See <a href="#submit" title=
1.68 rillig 4273: "Chapter 18. Submitting and Committing">Chapter 18,
1.67 hubertf 4274: <i>Submitting and Committing</i></a> for information on
4275: how to submit such a binary package.</p>
1.1 grant 4276: </div>
4277:
1.67 hubertf 4278: <div class="sect1" lang="en">
1.1 grant 4279: <div class="titlepage">
4280: <div>
4281: <div>
4282: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4283: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 4284: for creation of binary packages</h2>
4285: </div>
4286: </div>
4287: </div>
4288:
4289: <p>See <a href="#build.helpful-targets" title=
1.56 rillig 4290: "14.16. Other helpful targets">Section 14.16,
1.1 grant 4291: “Other helpful targets”</a>.</p>
4292: </div>
4293:
1.67 hubertf 4294: <div class="sect1" lang="en">
1.1 grant 4295: <div class="titlepage">
4296: <div>
4297: <div>
4298: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 4299: "bulkbuild"></a>6.3. Doing a bulk build of all
4300: packages</h2>
1.1 grant 4301: </div>
4302: </div>
4303: </div>
4304:
4305: <p>If you want to get a full set of precompiled binary
4306: packages, this section describes how to get them. Beware
4307: that the bulk build will remove all currently installed
1.63 dillo 4308: packages from your system!</p>
4309:
4310: <p>Having an FTP server configured either on the machine
4311: doing the bulk builds or on a nearby NFS server can help
4312: to make the packages available to other machines that can
4313: then save time by installing only the binary packages.
4314: See <a href=
1.1 grant 4315: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
4316: <span class="citerefentry"><span class=
4317: "refentrytitle">ftpd</span>(8)</span></a> for more
4318: information. If you use a remote NFS server's storage, be
4319: sure to not actually compile on NFS storage, as this
4320: slows things down a lot.</p>
4321:
1.67 hubertf 4322: <div class="sect2" lang="en">
1.1 grant 4323: <div class="titlepage">
4324: <div>
4325: <div>
1.67 hubertf 4326: <h3 class="title"><a name=
1.38 dillo 4327: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 4328: </div>
4329: </div>
4330: </div>
4331:
1.67 hubertf 4332: <div class="sect3" lang="en">
1.1 grant 4333: <div class="titlepage">
4334: <div>
4335: <div>
1.63 dillo 4336: <h4 class="title"><a name=
4337: "binary.bulk.build.conf"></a>6.3.1.1. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4338: class="filename">build.conf</code></h4>
4339: </div>
4340: </div>
4341: </div>
4342:
4343: <p>The <code xmlns=
4344: "http://www.w3.org/TR/xhtml1/transitional" class=
4345: "filename">build.conf</code> file is the main
4346: configuration file for bulk builds. You can configure
4347: how your copy of pkgsrc is kept up to date, how the
4348: distfiles are downloaded, how the packages are built
4349: and how the report is generated. You can find an
4350: annotated example file in <code xmlns=
4351: "http://www.w3.org/TR/xhtml1/transitional" class=
4352: "filename">pkgsrc/mk/bulk/build.conf-example</code>.
4353: To use it, copy <code xmlns=
4354: "http://www.w3.org/TR/xhtml1/transitional" class=
4355: "filename">build.conf-example</code> to <code xmlns=
4356: "http://www.w3.org/TR/xhtml1/transitional" class=
4357: "filename">build.conf</code> and edit it, following
4358: the comments in that file.</p>
4359: </div>
4360:
1.67 hubertf 4361: <div class="sect3" lang="en">
1.63 dillo 4362: <div class="titlepage">
4363: <div>
4364: <div>
1.67 hubertf 4365: <h4 class="title"><a name=
1.63 dillo 4366: "binary.mk.conf"></a>6.3.1.2. /etc/mk.conf</h4>
1.1 grant 4367: </div>
4368: </div>
4369: </div>
4370:
1.45 wiz 4371: <p>You may want to set variables in <code xmlns=
4372: "http://www.w3.org/TR/xhtml1/transitional" class=
4373: "filename">/etc/mk.conf</code>. Look at <code xmlns=
4374: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4375: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 4376: details of the default settings. You will want to
1.14 xtraeme 4377: ensure that <code class=
4378: "varname">ACCEPTABLE_LICENSES</code> meet your local
4379: policy. As used in this example, <code class=
4380: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 4381: "emphasis"><em>all</em></span> licenses.</p>
4382: <pre class="programlisting">
1.51 rillig 4383: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
4384: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
4385: BSDSRCDIR= /usr/src
4386: BSDXSRCDIR= /usr/xsrc # for x11/xservers
4387: OBJHOSTNAME?= yes # use work.`hostname`
4388: FAILOVER_FETCH= yes # insist on the correct checksum
4389: PKG_DEVELOPER?= yes
4390: _ACCEPTABLE= yes
1.1 grant 4391: </pre>
4392:
1.63 dillo 4393: <p>Some options that are especially useful for bulk
4394: builds can be found at the top lines of the file
4395: <code xmlns=
4396: "http://www.w3.org/TR/xhtml1/transitional" class=
4397: "filename">mk/bulk/bsd.bulk-pkg.mk</code>. The most
4398: useful options of these are briefly described
4399: here.</p>
4400:
4401: <div class="itemizedlist">
4402: <ul type="disc">
4403: <li>
4404: <p>If you are on a slow machine, you may want
4405: to set <code class=
4406: "varname">USE_BULK_BROKEN_CHECK</code> to
4407: “<span class=
4408: "quote">no</span>”.</p>
4409: </li>
4410:
4411: <li>
4412: <p>If you are doing bulk builds from a
4413: read-only copy of pkgsrc, you have to set
4414: <code class="varname">BULKFILESDIR</code> to
4415: the directory where all log files are created.
4416: Otherwise the log files are created in the
4417: pkgsrc directory.</p>
4418: </li>
4419:
4420: <li>
4421: <p>Another important variable is <code class=
4422: "varname">BULK_PREREQ</code>, which is a list
4423: of packages that should be always available
4424: while building other packages.</p>
4425: </li>
4426: </ul>
1.1 grant 4427: </div>
1.68 rillig 4428:
4429: <p>Some other options are scattered in the pkgsrc
4430: infrastructure:</p>
4431:
4432: <div class="itemizedlist">
4433: <ul type="disc">
4434: <li>
1.69 rillig 4435: <p><code class=
4436: "varname">ALLOW_VULNERABLE_PACKAGES</code>
4437: should be set to <code class=
4438: "literal">yes</code>. The purpose of the bulk
4439: builds is creating binary packages, no matter
4440: if they are vulnerable or not. When uploading
4441: the packages to a public server, the vulnerable
4442: packages will be put into a directory of their
4443: own. Leaving this variable unset would prevent
4444: the bulk build system from even trying to build
4445: them, so possible building errors would not
4446: show up.</p>
4447: </li>
4448:
4449: <li>
1.68 rillig 4450: <p><code class="varname">CHECK_FILES</code>
4451: (<code xmlns=
4452: "http://www.w3.org/TR/xhtml1/transitional"
4453: class=
4454: "filename">pkgsrc/mk/bsd.pkg.check.mk</code>)
4455: can be set to “<span class=
4456: "quote">yes</span>” to check that the
4457: installed set of files matches the <code xmlns=
4458: "http://www.w3.org/TR/xhtml1/transitional"
4459: class="filename">PLIST</code>.</p>
4460: </li>
4461:
4462: <li>
4463: <p><code class=
4464: "varname">CHECK_INTERPRETER</code>
4465: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4466: class=
4467: "filename">pkgsrc/mk/bsd.pkg.check.mk</code>)
4468: can be set to “<span class=
4469: "quote">yes</span>” to check that the
4470: installed “<span class=
4471: "quote">#!</span>”-scripts will find
4472: their interpreter.</p>
4473: </li>
4474: </ul>
4475: </div>
1.1 grant 4476: </div>
4477:
1.67 hubertf 4478: <div class="sect3" lang="en">
1.1 grant 4479: <div class="titlepage">
4480: <div>
4481: <div>
1.67 hubertf 4482: <h4 class="title"><a name=
1.45 wiz 4483: "pre-build.local"></a>6.3.1.3. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4484: class="filename">pre-build.local</code></h4>
1.1 grant 4485: </div>
4486: </div>
4487: </div>
4488:
4489: <p>It is possible to configure the bulk build to
1.47 reed 4490: perform certain site-specific tasks at the end of the
1.45 wiz 4491: pre-build stage. If the file <code xmlns=
4492: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4493: "filename">pre-build.local</code> exists in
1.45 wiz 4494: <code xmlns=
4495: "http://www.w3.org/TR/xhtml1/transitional" class=
4496: "filename">/usr/pkgsrc/mk/bulk</code>, it will be
4497: executed (as a <a href=
1.24 wiz 4498: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
4499: <span class="citerefentry"><span class=
4500: "refentrytitle">sh</span>(1)</span></a> script) at
4501: the end of the usual pre-build stage. An example use
1.45 wiz 4502: of <code xmlns=
4503: "http://www.w3.org/TR/xhtml1/transitional" class=
4504: "filename">pre-build.local</code> is to have the
4505: line:</p>
1.1 grant 4506: <pre class="screen">
1.14 xtraeme 4507: <code class="prompt">#</code> <strong class=
4508: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 4509: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 4510: </pre>
4511:
4512: <p>to prevent the system from trying to build a
4513: particular package which requires nearly 3 GB of disk
4514: space.</p>
4515: </div>
4516: </div>
4517:
1.67 hubertf 4518: <div class="sect2" lang="en">
1.1 grant 4519: <div class="titlepage">
4520: <div>
4521: <div>
1.30 wiz 4522: <h3 class="title"><a name=
1.38 dillo 4523: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 4524: environmental considerations</h3>
1.1 grant 4525: </div>
4526: </div>
4527: </div>
4528:
1.45 wiz 4529: <p>As <code xmlns=
4530: "http://www.w3.org/TR/xhtml1/transitional" class=
4531: "filename">/usr/pkg</code> will be completely deleted
4532: at the start of bulk builds, make sure your login shell
4533: is placed somewhere else. Either drop it into
4534: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4535: class="filename">/usr/local/bin</code> (and adjust your
4536: login shell in the passwd file), or (re-)install it via
1.14 xtraeme 4537: <a href=
1.1 grant 4538: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4539: <span class="citerefentry"><span class=
4540: "refentrytitle">pkg_add</span>(1)</span></a> from
1.45 wiz 4541: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4542: class="filename">/etc/rc.local</code>, so you can login
4543: after a reboot (remember that your current process
4544: won't die if the package is removed, you just can't
4545: start any new instances of the shell any more). Also,
4546: if you use NetBSD earlier than 1.5, or you still want
4547: to use the pkgsrc version of ssh for some reason, be
4548: sure to install ssh before starting it from
4549: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4550: class="filename">rc.local</code>:</p>
1.1 grant 4551: <pre class="programlisting">
1.51 rillig 4552: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
4553: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
4554: /usr/pkg/etc/rc.d/sshd
4555: fi
1.1 grant 4556: </pre>
4557:
4558: <p>Not doing so will result in you being not able to
4559: log in via ssh after the bulk build is finished or if
4560: the machine gets rebooted or crashes. You have been
4561: warned! :)</p>
4562: </div>
4563:
1.67 hubertf 4564: <div class="sect2" lang="en">
1.1 grant 4565: <div class="titlepage">
4566: <div>
4567: <div>
1.67 hubertf 4568: <h3 class="title"><a name=
1.38 dillo 4569: "operation"></a>6.3.3. Operation</h3>
1.1 grant 4570: </div>
4571: </div>
4572: </div>
4573:
4574: <p>Make sure you don't need any of the packages still
4575: installed.</p>
4576:
4577: <div class="warning" style=
4578: "margin-left: 0.5in; margin-right: 0.5in;">
4579: <h3 class="title">Warning</h3>
4580:
4581: <p>During the bulk build, <span class=
4582: "emphasis"><em>all packages will be
4583: removed!</em></span></p>
4584: </div>
4585:
4586: <p>Be sure to remove all other things that might
4587: interfere with builds, like some libs installed in
1.45 wiz 4588: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4589: class="filename">/usr/local</code>, etc. then become
4590: root and type:</p>
1.1 grant 4591: <pre class="screen">
1.14 xtraeme 4592: <code class="prompt">#</code> <strong class=
4593: "userinput"><code>cd /usr/pkgsrc</code></strong>
4594: <code class="prompt">#</code> <strong class=
4595: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 4596: </pre>
4597:
4598: <p>If for some reason your last build didn't complete
4599: (power failure, system panic, ...), you can continue it
4600: by running:</p>
4601: <pre class="screen">
1.14 xtraeme 4602: <code class="prompt">#</code> <strong class=
4603: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 4604: </pre>
4605:
4606: <p>At the end of the bulk build, you will get a summary
4607: via mail, and find build logs in the directory
1.14 xtraeme 4608: specified by <code class="varname">FTP</code> in the
1.45 wiz 4609: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4610: class="filename">build.conf</code> file.</p>
1.1 grant 4611: </div>
4612:
1.67 hubertf 4613: <div class="sect2" lang="en">
1.1 grant 4614: <div class="titlepage">
4615: <div>
4616: <div>
1.67 hubertf 4617: <h3 class="title"><a name=
1.38 dillo 4618: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 4619: </div>
4620: </div>
4621: </div>
4622:
4623: <p>The bulk builds consist of three steps:</p>
4624:
4625: <div class="variablelist">
4626: <dl>
4627: <dt><span class="term">1. pre-build</span></dt>
4628:
4629: <dd>
4630: <p>The script updates your pkgsrc tree via
4631: (anon)cvs, then cleans out any broken distfiles,
4632: and removes all packages installed.</p>
4633: </dd>
4634:
4635: <dt><span class="term">2. the bulk
4636: build</span></dt>
4637:
4638: <dd>
4639: <p>This is basically “<span class=
4640: "quote">make bulk-package</span>” with an
4641: optimised order in which packages will be built.
4642: Packages that don't require other packages will
4643: be built first, and packages with many
4644: dependencies will be built later.</p>
4645: </dd>
4646:
4647: <dt><span class="term">3. post-build</span></dt>
4648:
4649: <dd>
4650: <p>Generates a report that's placed in the
1.45 wiz 4651: directory specified in the <code xmlns=
4652: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4653: "filename">build.conf</code> file named
1.45 wiz 4654: <code xmlns=
4655: "http://www.w3.org/TR/xhtml1/transitional" class=
4656: "filename">broken.html</code>, a short version of
4657: that report will also be mailed to the build's
4658: admin.</p>
1.1 grant 4659: </dd>
4660: </dl>
4661: </div>
4662:
4663: <p>During the build, a list of broken packages will be
1.45 wiz 4664: compiled in <code xmlns=
4665: "http://www.w3.org/TR/xhtml1/transitional" class=
4666: "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
4667: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4668: "filename">.../.broken.${MACHINE}</code> if
4669: <code class="varname">OBJMACHINE</code> is set),
4670: individual build logs of broken builds can be found in
4671: the package's directory. These files are used by the
4672: bulk-targets to mark broken builds to not waste time
4673: trying to rebuild them, and they can be used to debug
4674: these broken package builds later.</p>
1.1 grant 4675: </div>
4676:
1.67 hubertf 4677: <div class="sect2" lang="en">
1.1 grant 4678: <div class="titlepage">
4679: <div>
4680: <div>
1.30 wiz 4681: <h3 class="title"><a name=
1.38 dillo 4682: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 4683: space requirements</h3>
1.1 grant 4684: </div>
4685: </div>
4686: </div>
4687:
4688: <p>Currently, roughly the following requirements are
4689: valid for NetBSD 2.0/i386:</p>
4690:
4691: <div class="itemizedlist">
4692: <ul type="disc">
4693: <li>
4694: <p>10 GB - distfiles (NFS ok)</p>
4695: </li>
4696:
4697: <li>
4698: <p>8 GB - full set of all binaries (NFS ok)</p>
4699: </li>
4700:
4701: <li>
4702: <p>5 GB - temp space for compiling (local disk
4703: recommended)</p>
4704: </li>
4705: </ul>
4706: </div>
4707:
4708: <p>Note that all pkgs will be de-installed as soon as
4709: they are turned into a binary package, and that sources
4710: are removed, so there is no excessively huge demand to
4711: disk space. Afterwards, if the package is needed again,
4712: it will be installed via <a href=
4713: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4714: <span class="citerefentry"><span class=
4715: "refentrytitle">pkg_add</span>(1)</span></a> instead of
4716: building again, so there are no cycles wasted by
4717: recompiling.</p>
4718: </div>
4719:
1.67 hubertf 4720: <div class="sect2" lang="en">
1.1 grant 4721: <div class="titlepage">
4722: <div>
4723: <div>
1.67 hubertf 4724: <h3 class="title"><a name=
4725: "setting-up-a-sandbox"></a>6.3.6. Setting up
4726: a sandbox for chrooted builds</h3>
1.1 grant 4727: </div>
4728: </div>
4729: </div>
4730:
1.12 agc 4731: <p>If you don't want all the packages nuked from a
4732: machine (rendering it useless for anything but pkg
1.23 wiz 4733: compiling), there is the possibility of doing the
4734: package bulk build inside a chroot environment.</p>
1.12 agc 4735:
4736: <p>The first step is to set up a chroot sandbox, e.g.
1.45 wiz 4737: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4738: class="filename">/usr/sandbox</code>. This can be done
4739: by using null mounts, or manually.</p>
1.12 agc 4740:
1.45 wiz 4741: <p>There is a shell script called <code xmlns=
4742: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4743: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
4744: set up the sandbox environment using null mounts. It
1.45 wiz 4745: will also create a script called <code xmlns=
4746: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4747: "filename">sandbox</code> in the root of the sandbox
1.12 agc 4748: environment, which will allow the null mounts to be
1.14 xtraeme 4749: activated using the <span><strong class=
4750: "command">sandbox mount</strong></span> command and
4751: deactivated using the <span><strong class=
4752: "command">sandbox umount</strong></span> command.</p>
1.12 agc 4753:
4754: <p>To set up a sandbox environment by hand, after
4755: extracting all the sets from a NetBSD installation or
1.14 xtraeme 4756: doing a <span><strong class="command">make distribution
1.45 wiz 4757: DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
4758: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4759: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 4760: items are present and properly configured:</p>
1.1 grant 4761:
4762: <div class="procedure">
4763: <ol type="1">
4764: <li>
4765: <p>Kernel</p>
4766: <pre class="screen">
1.14 xtraeme 4767: <code class="prompt">#</code> <strong class=
4768: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 4769: </pre>
4770: </li>
4771:
4772: <li>
1.45 wiz 4773: <p><code xmlns=
4774: "http://www.w3.org/TR/xhtml1/transitional" class=
4775: "filename">/dev/*</code></p>
1.1 grant 4776: <pre class="screen">
1.14 xtraeme 4777: <code class="prompt">#</code> <strong class=
4778: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 4779: </pre>
4780: </li>
4781:
4782: <li>
1.45 wiz 4783: <p><code xmlns=
4784: "http://www.w3.org/TR/xhtml1/transitional" class=
4785: "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1 grant 4786: "http://www.w3.org/TR/xhtml1/transitional" href=
4787: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4788: target="_top"><code xmlns="" class=
4789: "filename">security/smtpd</code></a> and
4790: mail):</p>
1.1 grant 4791: <pre class="screen">
1.14 xtraeme 4792: <code class="prompt">#</code> <strong class=
4793: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 4794: </pre>
4795: </li>
4796:
4797: <li>
4798: <p>Working(!) mail config (hostname,
4799: sendmail.cf):</p>
4800: <pre class="screen">
1.14 xtraeme 4801: <code class="prompt">#</code> <strong class=
4802: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 4803: </pre>
4804: </li>
4805:
4806: <li>
1.45 wiz 4807: <p><code xmlns=
4808: "http://www.w3.org/TR/xhtml1/transitional" class=
4809: "filename">/etc/localtime</code> (for <a xmlns=
1.1 grant 4810: "http://www.w3.org/TR/xhtml1/transitional" href=
4811: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4812: target="_top"><code xmlns="" class=
4813: "filename">security/smtpd</code></a>):</p>
1.1 grant 4814: <pre class="screen">
1.14 xtraeme 4815: <code class="prompt">#</code> <strong class=
4816: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 4817: </pre>
4818: </li>
4819:
4820: <li>
1.45 wiz 4821: <p><code xmlns=
4822: "http://www.w3.org/TR/xhtml1/transitional" class=
4823: "filename">/usr/src</code> (system sources, for
4824: <a xmlns=
1.1 grant 4825: "http://www.w3.org/TR/xhtml1/transitional" href=
4826: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45 wiz 4827: target="_top"><code xmlns="" class=
4828: "filename">sysutils/aperture</code></a>,
4829: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
4830: href=
1.20 ben 4831: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45 wiz 4832: target="_top"><code xmlns="" class=
4833: "filename">net/ppp-mppe</code></a>):</p>
1.1 grant 4834: <pre class="screen">
1.14 xtraeme 4835: <code class="prompt">#</code> <strong class=
4836: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
4837: <code class="prompt">#</code> <strong class=
1.23 wiz 4838: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 4839: </pre>
4840: </li>
4841:
4842: <li>
1.45 wiz 4843: <p>Create <code xmlns=
4844: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4845: "filename">/var/db/pkg</code> (not part of
4846: default install):</p>
1.1 grant 4847: <pre class="screen">
1.14 xtraeme 4848: <code class="prompt">#</code> <strong class=
4849: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 4850: </pre>
4851: </li>
4852:
4853: <li>
1.45 wiz 4854: <p>Create <code xmlns=
4855: "http://www.w3.org/TR/xhtml1/transitional" class=
4856: "filename">/usr/pkg</code> (not part of default
4857: install):</p>
1.1 grant 4858: <pre class="screen">
1.14 xtraeme 4859: <code class="prompt">#</code> <strong class=
4860: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 4861: </pre>
4862: </li>
4863:
4864: <li>
1.45 wiz 4865: <p>Checkout pkgsrc via cvs into <code xmlns=
4866: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4867: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 4868: <pre class="screen">
1.14 xtraeme 4869: <code class="prompt">#</code> <strong class=
4870: "userinput"><code>cd /usr/sandbox/usr</code></strong>
4871: <code class="prompt">#</code> <strong class=
4872: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 4873: </pre>
4874:
4875: <p>Do not mount/link this to the copy of your
4876: pkgsrc tree you do development in, as this will
4877: likely cause problems!</p>
4878: </li>
4879:
4880: <li>
1.45 wiz 4881: <p>Make <code xmlns=
4882: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4883: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45 wiz 4884: and <code xmlns=
4885: "http://www.w3.org/TR/xhtml1/transitional" class=
4886: "filename">.../distfiles</code> point somewhere
4887: appropriate. NFS- and/or nullfs-mounts may come
4888: in handy!</p>
1.1 grant 4889: </li>
4890:
4891: <li>
1.45 wiz 4892: <p>Edit <code xmlns=
4893: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4894: "filename">/etc/mk.conf</code>, see <a href=
4895: "#binary.mk.conf" title=
1.63 dillo 4896: "6.3.1.2. /etc/mk.conf">Section 6.3.1.2,
1.1 grant 4897: “/etc/mk.conf”</a>.</p>
4898: </li>
4899:
4900: <li>
1.45 wiz 4901: <p>Adjust <code xmlns=
4902: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4903: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 4904: needs.</p>
4905: </li>
4906: </ol>
4907: </div>
4908:
1.47 reed 4909: <p>When the chroot sandbox is set up, you can start the
1.1 grant 4910: build with the following steps:</p>
4911: <pre class="screen">
1.14 xtraeme 4912: <code class="prompt">#</code> <strong class=
4913: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4914: <code class="prompt">#</code> <strong class=
4915: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 4916: </pre>
4917:
4918: <p>This will just jump inside the sandbox and start
4919: building. At the end of the build, mail will be sent
4920: with the results of the build. Created binary pkgs will
1.45 wiz 4921: be in <code xmlns=
4922: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4923: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 4924: (wherever that points/mounts to/from).</p>
4925: </div>
4926:
1.67 hubertf 4927: <div class="sect2" lang="en">
1.1 grant 4928: <div class="titlepage">
4929: <div>
4930: <div>
1.30 wiz 4931: <h3 class="title"><a name=
1.38 dillo 4932: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 4933: a partial set of packages</h3>
1.1 grant 4934: </div>
4935: </div>
4936: </div>
4937:
4938: <p>In addition to building a complete set of all
1.45 wiz 4939: packages in pkgsrc, the <code xmlns=
4940: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4941: "filename">pkgsrc/mk/bulk/build</code> script may be
4942: used to build a subset of the packages contained in
1.47 reed 4943: pkgsrc. By setting <code class=
1.45 wiz 4944: "varname">SPECIFIC_PKGS</code> in <code xmlns=
4945: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4946: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 4947:
4948: <div class="itemizedlist">
4949: <ul type="disc">
4950: <li>
4951: <p>SITE_SPECIFIC_PKGS</p>
4952: </li>
4953:
4954: <li>
4955: <p>HOST_SPECIFIC_PKGS</p>
4956: </li>
4957:
4958: <li>
4959: <p>GROUP_SPECIFIC_PKGS</p>
4960: </li>
4961:
4962: <li>
4963: <p>USER_SPECIFIC_PKGS</p>
4964: </li>
4965: </ul>
4966: </div>
4967:
4968: <p>will define the set of packages which should be
4969: built. The bulk build code will also include any
4970: packages which are needed as dependencies for the
4971: explicitly listed packages.</p>
4972:
4973: <p>One use of this is to do a bulk build with
1.14 xtraeme 4974: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 4975: sandbox periodically to have a complete set of the
4976: binary packages needed for your site available without
4977: the overhead of building extra packages that are not
4978: needed.</p>
4979: </div>
1.13 hubertf 4980:
1.67 hubertf 4981: <div class="sect2" lang="en">
1.13 hubertf 4982: <div class="titlepage">
4983: <div>
4984: <div>
1.67 hubertf 4985: <h3 class="title"><a name=
1.38 dillo 4986: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 4987: of a bulk build</h3>
4988: </div>
4989: </div>
4990: </div>
4991:
4992: <p>This section describes how pkgsrc developers can
4993: upload binary pkgs built by bulk builds to
4994: ftp.NetBSD.org.</p>
4995:
1.17 sketch 4996: <p>If you would like to automatically create checksum
4997: files for the binary packages you intend to upload,
4998: remember to set <code class="varname">MKSUMS=yes</code>
1.45 wiz 4999: in your <code xmlns=
5000: "http://www.w3.org/TR/xhtml1/transitional" class=
1.17 sketch 5001: "filename">mk/bulk/build.conf</code>.</p>
5002:
5003: <p>If you would like to PGP sign the checksum files
5004: (highly recommended!), remember to set <code class=
5005: "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45 wiz 5006: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5007: class="filename">mk/bulk/build.conf</code>. This will
5008: prompt you for your GPG password to sign the files
1.17 sketch 5009: before uploading everything.</p>
5010:
5011: <p>Then, make sure that you have <code class=
1.14 xtraeme 5012: "varname">RSYNC_DST</code> set properly in your
1.45 wiz 5013: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5014: class="filename">mk/bulk/build.conf</code> file, i.e.
5015: adjust it to something like one of the following:</p>
1.13 hubertf 5016: <pre class="screen">
1.68 rillig 5017: RSYNC_DST=ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
1.13 hubertf 5018: </pre>
5019:
1.47 reed 5020: <p>Please use appropriate values for "pkgsrc-200xQy",
1.13 hubertf 5021: "NetBSD-a.b.c" and "arch" here. If your login on
1.68 rillig 5022: ftp.NetBSD.org is different from your local login,
5023: write your login directly into the variable, e.g. my
5024: local account is "feyrer", but for my login "hubertf",
5025: I use:</p>
1.13 hubertf 5026: <pre class="screen">
5027: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
5028: </pre>
5029:
1.45 wiz 5030: <p>A separate <code xmlns=
5031: "http://www.w3.org/TR/xhtml1/transitional" class=
5032: "filename">upload</code> directory is used here to
5033: allow "closing" the directory during upload. To do so,
5034: run the following command on ftp.NetBSD.org next:</p>
1.13 hubertf 5035: <pre class="screen">
1.14 xtraeme 5036: nbftp% <strong class=
5037: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 5038: </pre>
5039:
1.45 wiz 5040: <p>Please note that <code xmlns=
5041: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5042: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 5043: appropriate for packages for the NetBSD operating
5044: system. Binary packages for other operating systems
1.45 wiz 5045: should go into <code xmlns=
5046: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5047: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 5048:
5049: <p>Before uploading the binary pkgs, ssh authentication
1.47 reed 5050: needs to be set up. This example shows how to set up
1.13 hubertf 5051: temporary keys for the root account <span class=
5052: "emphasis"><em>inside the sandbox</em></span> (assuming
5053: that no keys should be present there usually):</p>
5054: <pre class="screen">
1.14 xtraeme 5055: <code class="prompt">#</code> <strong class=
1.68 rillig 5056: "userinput"><code>chroot /usr/sandbox</code></strong>
1.14 xtraeme 5057: chroot-<code class="prompt">#</code> <strong class=
1.68 rillig 5058: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
1.14 xtraeme 5059: chroot-<code class="prompt">#</code> <strong class=
1.68 rillig 5060: "userinput"><code>ssh-keygen -t dsa</code></strong>
1.14 xtraeme 5061: chroot-<code class="prompt">#</code> <strong class=
5062: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 5063: </pre>
5064:
1.45 wiz 5065: <p>Now take the output of <code xmlns=
5066: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5067: "filename">id-dsa.pub</code> and append it to your
1.45 wiz 5068: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5069: class="filename">~/.ssh/authorized_keys</code> file on
5070: ftp.NetBSD.org. You can remove the key after the upload
5071: is done!</p>
1.13 hubertf 5072:
5073: <p>Next, test if your ssh connection really works:</p>
5074: <pre class="screen">
1.14 xtraeme 5075: chroot-<code class="prompt">#</code> <strong class=
5076: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 5077: </pre>
5078:
5079: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
5080:
5081: <p>Now after all this works, you can exit the sandbox
5082: and start the upload:</p>
5083: <pre class="screen">
1.14 xtraeme 5084: chroot-<code class="prompt">#</code> <strong class=
1.68 rillig 5085: "userinput"><code>exit</code></strong>
1.14 xtraeme 5086: <code class="prompt">#</code> <strong class=
1.68 rillig 5087: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
1.14 xtraeme 5088: <code class="prompt">#</code> <strong class=
5089: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 5090: </pre>
5091:
5092: <p>The upload process may take quite some time. Use
1.24 wiz 5093: <a href=
5094: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
5095: <span class="citerefentry"><span class=
5096: "refentrytitle">ls</span>(1)</span></a> or <a href=
5097: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
5098: <span class="citerefentry"><span class=
5099: "refentrytitle">du</span>(1)</span></a> on the FTP
5100: server to monitor progress of the upload. The upload
5101: script will take care of not uploading restricted
5102: packages and putting vulnerable packages into the
1.45 wiz 5103: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5104: class="filename">vulnerable</code> subdirectory.</p>
1.13 hubertf 5105:
5106: <p>After the upload has ended, first thing is to revoke
5107: ssh access:</p>
5108: <pre class="screen">
1.14 xtraeme 5109: nbftp% <strong class=
5110: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 5111: Gdd:x!
5112: </pre>
5113:
5114: <p>Use whatever is needed to remove the key you've
5115: entered before! Last, move the uploaded packages out of
1.45 wiz 5116: the <code xmlns=
5117: "http://www.w3.org/TR/xhtml1/transitional" class=
5118: "filename">upload</code> directory to have them
5119: accessible to everyone:</p>
1.13 hubertf 5120: <pre class="screen">
1.14 xtraeme 5121: nbftp% <strong class=
5122: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
5123: nbftp% <strong class=
5124: "userinput"><code>mv upload/* .</code></strong>
5125: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
5126: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 5127: </pre>
5128: </div>
1.1 grant 5129: </div>
5130:
1.67 hubertf 5131: <div class="sect1" lang="en">
1.1 grant 5132: <div class="titlepage">
5133: <div>
5134: <div>
5135: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5136: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 5137: CD-ROM packages collection</h2>
1.1 grant 5138: </div>
5139: </div>
5140: </div>
5141:
5142: <p>After your pkgsrc bulk-build has completed, you may
5143: wish to create a CD-ROM set of the resulting binary
5144: packages to assist in installing packages on other
5145: machines. The <a xmlns=
5146: "http://www.w3.org/TR/xhtml1/transitional" href=
5147: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45 wiz 5148: target="_top"><code xmlns="" class=
5149: "filename">pkgtools/cdpack</code></a> package provides a
1.20 ben 5150: simple tool for creating the ISO 9660 images.
5151: <span><strong class="command">cdpack</strong></span>
5152: arranges the packages on the CD-ROMs in a way that keeps
1.47 reed 5153: all the dependencies for a given package on the same CD
5154: as that package.</p>
1.1 grant 5155:
1.67 hubertf 5156: <div class="sect2" lang="en">
1.1 grant 5157: <div class="titlepage">
5158: <div>
5159: <div>
1.67 hubertf 5160: <h3 class="title"><a name=
1.38 dillo 5161: "cdpack-example"></a>6.4.1. Example of
1.1 grant 5162: cdpack</h3>
5163: </div>
5164: </div>
5165: </div>
5166:
5167: <p>Complete documentation for cdpack is found in the
1.47 reed 5168: cdpack(1) man page. The following short example assumes
1.45 wiz 5169: that the binary packages are left in <code xmlns=
5170: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5171: "filename">/usr/pkgsrc/packages/All</code> and that
1.45 wiz 5172: sufficient disk space exists in <code xmlns=
5173: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5174: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 5175: <pre class="screen">
1.14 xtraeme 5176: <code class="prompt">#</code> <strong class=
5177: "userinput"><code>mkdir /u2/images</code></strong>
5178: <code class="prompt">#</code> <strong class=
5179: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
5180: <code class="prompt">#</code> <strong class=
5181: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 5182: </pre>
5183:
5184: <p>If you wish to include a common set of files
1.45 wiz 5185: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5186: class="filename">COPYRIGHT</code>, <code xmlns=
5187: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5188: "filename">README</code>, etc.) on each CD in the
1.1 grant 5189: collection, then you need to create a directory which
5190: contains these files. e.g.</p>
5191: <pre class="screen">
1.14 xtraeme 5192: <code class="prompt">#</code> <strong class=
5193: "userinput"><code>mkdir /tmp/common</code></strong>
5194: <code class="prompt">#</code> <strong class=
5195: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
5196: <code class="prompt">#</code> <strong class=
5197: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
5198: <code class="prompt">#</code> <strong class=
5199: "userinput"><code>mkdir /tmp/common/bin</code></strong>
5200: <code class="prompt">#</code> <strong class=
5201: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
5202: <code class="prompt">#</code> <strong class=
5203: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
5204: <code class="prompt">#</code> <strong class=
5205: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 5206: </pre>
5207:
5208: <p>Now create the images:</p>
5209: <pre class="screen">
1.14 xtraeme 5210: <code class="prompt">#</code> <strong class=
5211: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 5212: </pre>
5213:
1.45 wiz 5214: <p>Each image will contain <code xmlns=
5215: "http://www.w3.org/TR/xhtml1/transitional" class=
5216: "filename">README</code>, <code xmlns=
5217: "http://www.w3.org/TR/xhtml1/transitional" class=
5218: "filename">COPYING</code>, and <code xmlns=
5219: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5220: "filename">bin/myscript</code> in their root
1.1 grant 5221: directories.</p>
5222: </div>
5223: </div>
5224: </div>
5225:
1.67 hubertf 5226: <div class="chapter" lang="en">
1.1 grant 5227: <div class="titlepage">
5228: <div>
5229: <div>
1.67 hubertf 5230: <h2 class="title"><a name=
1.38 dillo 5231: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 5232: Questions</h2>
5233: </div>
5234: </div>
5235: </div>
5236:
5237: <div class="toc">
5238: <p><b>Table of Contents</b></p>
5239:
5240: <dl>
1.30 wiz 5241: <dt><span class="sect1"><a href=
1.38 dillo 5242: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 5243: lists for pkg-related discussion?</a></span></dt>
1.1 grant 5244:
1.38 dillo 5245: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 5246: Where's the pkgviews documentation?</a></span></dt>
5247:
1.38 dillo 5248: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 5249: Utilities for package management
5250: (pkgtools)</a></span></dt>
5251:
1.38 dillo 5252: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 5253: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 5254:
1.30 wiz 5255: <dt><span class="sect1"><a href=
1.38 dillo 5256: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 5257: fetching distfiles?</a></span></dt>
1.14 xtraeme 5258:
1.30 wiz 5259: <dt><span class="sect1"><a href=
1.38 dillo 5260: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 5261: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 5262:
1.30 wiz 5263: <dt><span class="sect1"><a href=
1.38 dillo 5264: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 5265: from pkgsrc?</a></span></dt>
1.1 grant 5266:
1.30 wiz 5267: <dt><span class="sect1"><a href=
1.38 dillo 5268: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 5269: behind a firewall</a></span></dt>
1.1 grant 5270:
1.38 dillo 5271: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 5272: do I tell <span><strong class="command">make
5273: fetch</strong></span> to do passive
5274: FTP?</a></span></dt>
1.1 grant 5275:
1.30 wiz 5276: <dt><span class="sect1"><a href=
1.38 dillo 5277: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 5278: distfiles at once</a></span></dt>
1.1 grant 5279:
1.30 wiz 5280: <dt><span class="sect1"><a href=
1.38 dillo 5281: "#tmac.andoc-missing">7.11. What does
1.30 wiz 5282: “<span class="quote">Don't know how to make
1.14 xtraeme 5283: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 5284: mean?</a></span></dt>
5285:
1.30 wiz 5286: <dt><span class="sect1"><a href=
1.38 dillo 5287: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 5288: “<span class="quote">Could not find
1.14 xtraeme 5289: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 5290:
1.30 wiz 5291: <dt><span class="sect1"><a href=
1.38 dillo 5292: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 5293: pkgsrc</a></span></dt>
1.1 grant 5294:
1.38 dillo 5295: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 5296: do I change the location of configuration
5297: files?</a></span></dt>
1.1 grant 5298:
1.38 dillo 5299: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 5300: Automated security checks</a></span></dt>
5301: </dl>
5302: </div>
5303:
5304: <p>This section contains hints, tips & tricks on
5305: special things in pkgsrc that we didn't find a better place
5306: for in the previous chapters, and it contains items for
5307: both pkgsrc users and developers.</p>
5308:
1.67 hubertf 5309: <div class="sect1" lang="en">
1.1 grant 5310: <div class="titlepage">
5311: <div>
5312: <div>
5313: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5314: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 5315: mailing lists for pkg-related discussion?</h2>
1.1 grant 5316: </div>
5317: </div>
5318: </div>
5319:
1.18 xtraeme 5320: <p>The following mailing lists may be of interest to
5321: pkgsrc users:</p>
5322:
5323: <div class="itemizedlist">
5324: <ul type="disc">
5325: <li>
5326: <p><a href=
5327: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34 wiz 5328: target="_top">pkgsrc-bugs</a>: A list where problem
5329: reports related to pkgsrc are sent and
5330: discussed.</p>
1.18 xtraeme 5331: </li>
5332:
5333: <li>
5334: <p><a href=
5335: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 5336: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 5337: results of pkgsrc bulk builds are sent and
1.34 wiz 5338: discussed.</p>
1.18 xtraeme 5339: </li>
5340:
5341: <li>
5342: <p><a href=
5343: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34 wiz 5344: target="_top">pkgsrc-changes</a>: A list where all
5345: commit messages to pkgsrc are sent.</p>
1.18 xtraeme 5346: </li>
5347:
5348: <li>
5349: <p><a href=
5350: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34 wiz 5351: target="_top">tech-pkg</a>: A general discussion
5352: list for all things related to pkgsrc.</p>
1.18 xtraeme 5353: </li>
5354: </ul>
5355: </div>
5356:
5357: <p>To subscribe, do:</p>
1.1 grant 5358: <pre class="programlisting">
1.51 rillig 5359: <code class="prompt">%</code> echo subscribe <em class=
1.18 xtraeme 5360: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 5361: </pre>
5362:
1.18 xtraeme 5363: <p>Archives for all these mailing lists are available
5364: from <a href="http://mail-index.NetBSD.org/" target=
5365: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 5366: </div>
5367:
1.67 hubertf 5368: <div class="sect1" lang="en">
1.1 grant 5369: <div class="titlepage">
5370: <div>
5371: <div>
5372: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5373: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 5374: documentation?</h2>
1.1 grant 5375: </div>
5376: </div>
5377: </div>
5378:
5379: <p>Pkgviews is tightly integrated with buildlink. You can
1.45 wiz 5380: find a pkgviews User's guide in <code xmlns=
5381: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5382: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 5383: </div>
5384:
1.67 hubertf 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.38 dillo 5390: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 5391: management (pkgtools)</h2>
1.1 grant 5392: </div>
5393: </div>
5394: </div>
5395:
1.45 wiz 5396: <p>The <code xmlns=
5397: "http://www.w3.org/TR/xhtml1/transitional" class=
5398: "filename">pkgsrc/pkgtools</code> directory pkgtools
5399: contains a number of useful utilities for both users and
5400: developers of pkgsrc. This section attempts only to make
5401: the reader aware of the utilities and when they might be
5402: useful, and not to duplicate the documentation that comes
5403: with each package.</p>
1.1 grant 5404:
5405: <p>Utilities used by pkgsrc (automatically installed when
5406: needed):</p>
5407:
5408: <div class="itemizedlist">
5409: <ul type="disc">
5410: <li>
5411: <p><a xmlns=
5412: "http://www.w3.org/TR/xhtml1/transitional" href=
5413: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45 wiz 5414: target="_top"><code xmlns="" class=
5415: "filename">pkgtools/x11-links</code></a>: Symlinks
1.34 wiz 5416: for use by buildlink.</p>
1.1 grant 5417: </li>
5418: </ul>
5419: </div>
5420:
5421: <p>OS tool augmentation (automatically installed when
5422: needed):</p>
5423:
5424: <div class="itemizedlist">
5425: <ul type="disc">
5426: <li>
5427: <p><a xmlns=
5428: "http://www.w3.org/TR/xhtml1/transitional" href=
5429: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 wiz 5430: target="_top"><code xmlns="" class=
5431: "filename">pkgtools/digest</code></a>: Calculates
1.34 wiz 5432: various kinds of checksums (including SHA1).</p>
1.1 grant 5433: </li>
5434:
5435: <li>
5436: <p><a xmlns=
5437: "http://www.w3.org/TR/xhtml1/transitional" href=
5438: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45 wiz 5439: target="_top"><code xmlns="" class=
5440: "filename">pkgtools/libnbcompat</code></a>:
1.34 wiz 5441: Compatibility library for pkgsrc tools.</p>
1.1 grant 5442: </li>
5443:
5444: <li>
5445: <p><a xmlns=
5446: "http://www.w3.org/TR/xhtml1/transitional" href=
5447: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45 wiz 5448: target="_top"><code xmlns="" class=
5449: "filename">pkgtools/mtree</code></a>: Installed on
1.34 wiz 5450: non-BSD systems due to lack of native mtree.</p>
1.1 grant 5451: </li>
5452:
5453: <li>
5454: <p><a xmlns=
5455: "http://www.w3.org/TR/xhtml1/transitional" href=
5456: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5457: target="_top"><code xmlns="" class=
5458: "filename">pkgtools/pkg_install</code></a>:
5459: Up-to-date replacement for <code xmlns=
5460: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5461: "filename">/usr/sbin/pkg_install</code>, or for use
5462: on operating systems where pkg_install is not
5463: present.</p>
1.1 grant 5464: </li>
5465: </ul>
5466: </div>
5467:
5468: <p>Utilities used by pkgsrc (not automatically
5469: installed):</p>
5470:
5471: <div class="itemizedlist">
5472: <ul type="disc">
5473: <li>
5474: <p><a xmlns=
5475: "http://www.w3.org/TR/xhtml1/transitional" href=
5476: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45 wiz 5477: target="_top"><code xmlns="" class=
5478: "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20 ben 5479: binary package from an already-installed package.
1.34 wiz 5480: Used by <span><strong class="command">make
5481: replace</strong></span> to save the old
5482: package.</p>
1.1 grant 5483: </li>
5484:
5485: <li>
5486: <p><a xmlns=
5487: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 5488: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45 wiz 5489: target="_top"><code xmlns="" class=
5490: "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20 ben 5491: functionality to pkgsrc, allowing it to fetch
5492: distfiles from multiple locations. It currently
5493: supports the following methods: multiple CD-ROMs
5494: and network FTP/HTTP connections.</p>
1.5 hubertf 5495: </li>
5496:
5497: <li>
5498: <p><a xmlns=
5499: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5500: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 5501: target="_top"><code xmlns="" class=
5502: "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34 wiz 5503: packages someplace else (enabled by default).</p>
1.1 grant 5504: </li>
1.5 hubertf 5505:
5506: <li>
5507: <p><a xmlns=
5508: "http://www.w3.org/TR/xhtml1/transitional" href=
5509: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 5510: target="_top"><code xmlns="" class=
5511: "filename">devel/cpuflags</code></a>: Determine the
1.34 wiz 5512: best compiler flags to optimise code for your
1.20 ben 5513: current CPU and compiler.</p>
1.5 hubertf 5514: </li>
1.1 grant 5515: </ul>
5516: </div>
5517:
5518: <p>Utilities for keeping track of installed packages,
5519: being up to date, etc:</p>
5520:
5521: <div class="itemizedlist">
5522: <ul type="disc">
5523: <li>
5524: <p><a xmlns=
5525: "http://www.w3.org/TR/xhtml1/transitional" href=
5526: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45 wiz 5527: target="_top"><code xmlns="" class=
5528: "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27 rillig 5529: packages whose installed versions do not match the
1.34 wiz 5530: latest pkgsrc entries.</p>
1.1 grant 5531: </li>
5532:
5533: <li>
5534: <p><a xmlns=
5535: "http://www.w3.org/TR/xhtml1/transitional" href=
5536: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5537: target="_top"><code xmlns="" class=
5538: "filename">pkgtools/pkgdep</code></a>: Makes
1.20 ben 5539: dependency graphs of packages, to aid in choosing a
1.34 wiz 5540: strategy for updating.</p>
1.1 grant 5541: </li>
5542:
5543: <li>
5544: <p><a xmlns=
5545: "http://www.w3.org/TR/xhtml1/transitional" href=
5546: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45 wiz 5547: target="_top"><code xmlns="" class=
5548: "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27 rillig 5549: graphs from the output of <a xmlns=
5550: "http://www.w3.org/TR/xhtml1/transitional" href=
5551: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5552: target="_top"><code xmlns="" class=
5553: "filename">pkgtools/pkgdep</code></a> (uses
1.34 wiz 5554: graphviz).</p>
1.1 grant 5555: </li>
5556:
5557: <li>
5558: <p><a xmlns=
5559: "http://www.w3.org/TR/xhtml1/transitional" href=
5560: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 5561: target="_top"><code xmlns="" class=
5562: "filename">pkgtools/pkglint</code></a>: The
1.27 rillig 5563: pkglint(1) program checks a pkgsrc entry for
5564: errors, lintpkgsrc(1) does various checks on the
5565: complete pkgsrc system.</p>
1.1 grant 5566: </li>
5567:
5568: <li>
5569: <p><a xmlns=
5570: "http://www.w3.org/TR/xhtml1/transitional" href=
5571: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45 wiz 5572: target="_top"><code xmlns="" class=
5573: "filename">pkgtools/pkgsurvey</code></a>: Report
5574: what packages you have installed.</p>
1.1 grant 5575: </li>
5576: </ul>
5577: </div>
5578:
5579: <p>Utilities for people maintaining or creating
5580: individual packages:</p>
5581:
5582: <div class="itemizedlist">
5583: <ul type="disc">
5584: <li>
5585: <p><a xmlns=
5586: "http://www.w3.org/TR/xhtml1/transitional" href=
5587: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 5588: target="_top"><code xmlns="" class=
5589: "filename">pkgtools/pkgdiff</code></a>: Automate
1.20 ben 5590: making and maintaining patches for a package
1.34 wiz 5591: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 5592: </li>
5593:
5594: <li>
5595: <p><a xmlns=
5596: "http://www.w3.org/TR/xhtml1/transitional" href=
5597: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45 wiz 5598: target="_top"><code xmlns="" class=
5599: "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20 ben 5600: "http://www.w3.org/TR/xhtml1/transitional" href=
5601: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 5602: target="_top"><code xmlns="" class=
5603: "filename">pkgtools/url2pkg</code></a>: Aids in
1.34 wiz 5604: converting to pkgsrc.</p>
1.1 grant 5605: </li>
5606:
5607: <li>
5608: <p><a xmlns=
5609: "http://www.w3.org/TR/xhtml1/transitional" href=
5610: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45 wiz 5611: target="_top"><code xmlns="" class=
5612: "filename">pkgtools/gensolpkg</code></a>: Convert
1.34 wiz 5613: pkgsrc to a Solaris package.</p>
1.1 grant 5614: </li>
5615: </ul>
5616: </div>
5617:
1.47 reed 5618: <p>Utilities for people maintaining pkgsrc (or: more
1.1 grant 5619: obscure pkg utilities)</p>
5620:
5621: <div class="itemizedlist">
5622: <ul type="disc">
5623: <li>
5624: <p><a xmlns=
5625: "http://www.w3.org/TR/xhtml1/transitional" href=
5626: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45 wiz 5627: target="_top"><code xmlns="" class=
5628: "filename">pkgtools/pkg_comp</code></a>: Build
1.34 wiz 5629: packages in a chrooted area.</p>
1.1 grant 5630: </li>
5631:
5632: <li>
5633: <p><a xmlns=
5634: "http://www.w3.org/TR/xhtml1/transitional" href=
5635: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45 wiz 5636: target="_top"><code xmlns="" class=
5637: "filename">pkgtools/libkver</code></a>: Spoof
5638: kernel version for chrooted cross builds.</p>
1.1 grant 5639: </li>
5640: </ul>
5641: </div>
5642: </div>
5643:
1.67 hubertf 5644: <div class="sect1" lang="en">
1.1 grant 5645: <div class="titlepage">
5646: <div>
5647: <div>
5648: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5649: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 5650: as non-root</h2>
1.1 grant 5651: </div>
5652: </div>
5653: </div>
5654:
5655: <p>If you want to use pkgsrc as non-root user, you can
5656: set some variables to make pkgsrc work under these
1.33 jmmv 5657: conditions. At the very least, you need to set
5658: <code class="varname">UNPRIVILEGED</code> to
5659: “<span class="quote">yes</span>”; this will
5660: turn on unprivileged mode and set multiple related
5661: variables to allow installation of packages as
5662: non-root.</p>
5663:
5664: <p>In case the defaults are not enough, you may want to
5665: tune some other variables used. For example, if the
5666: automatic user/group detection leads to incorrect values
5667: (or not the ones you would like to use), you can change
5668: them by setting <code class=
5669: "varname">UNPRIVILEGED_USER</code> and <code class=
5670: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
5671:
5672: <p>As regards bootstrapping, please note that the
5673: <span><strong class="command">bootstrap</strong></span>
5674: script will ease non-root configuration when given the
5675: “<span class=
5676: "quote">--ignore-user-check</span>” flag, as it
5677: will choose and use multiple default directories under
1.45 wiz 5678: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5679: class="filename">~/pkg</code> as the installation
1.33 jmmv 5680: targets. These directories can be overriden by the
5681: “<span class="quote">--prefix</span>” flag
5682: provided by the script, as well as some others that allow
5683: finer tuning of the tree layout.</p>
1.14 xtraeme 5684: </div>
5685:
1.67 hubertf 5686: <div class="sect1" lang="en">
1.14 xtraeme 5687: <div class="titlepage">
5688: <div>
5689: <div>
5690: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5691: "resume-transfers"></a>7.5. How to resume
1.30 wiz 5692: transfers when fetching distfiles?</h2>
1.14 xtraeme 5693: </div>
5694: </div>
5695: </div>
5696:
1.47 reed 5697: <p>By default, resuming transfers in pkgsrc is disabled,
1.15 xtraeme 5698: but you can enable this feature by adding the option
5699: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45 wiz 5700: into <code xmlns=
5701: "http://www.w3.org/TR/xhtml1/transitional" class=
5702: "filename">/etc/mk.conf</code>. If, during a fetch step,
5703: an incomplete distfile is found, pkgsrc will try to
5704: resume it.</p>
1.15 xtraeme 5705:
5706: <p>You can also use a different program than the default
1.24 wiz 5707: <a href=
5708: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5709: <span class="citerefentry"><span class=
5710: "refentrytitle">ftp</span>(1)</span></a> by changing the
5711: <code class="varname">FETCH_CMD</code> variable. Don't
5712: forget to set <code class=
5713: "varname">FETCH_RESUME_ARGS</code> and <code class=
5714: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
5715: default values.</p>
1.14 xtraeme 5716:
1.45 wiz 5717: <p>For example, if you want to use <code xmlns=
5718: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5719: "filename">wget</code> to resume downloads, you'll have
5720: to use something like:</p>
5721: <pre class="programlisting">
1.51 rillig 5722: FETCH_CMD= wget
5723: FETCH_BEFORE_ARGS= --passive-ftp
5724: FETCH_RESUME_ARGS= -c
5725: FETCH_OUTPUT_ARGS= -O
1.14 xtraeme 5726: </pre>
1.1 grant 5727: </div>
5728:
1.67 hubertf 5729: <div class="sect1" lang="en">
1.1 grant 5730: <div class="titlepage">
5731: <div>
5732: <div>
5733: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5734: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 5735: install/use XFree86 from pkgsrc?</h2>
5736: </div>
5737: </div>
5738: </div>
5739:
5740: <p>If you want to use XFree86 from pkgsrc instead of your
1.45 wiz 5741: system's own X11 (<code xmlns=
5742: "http://www.w3.org/TR/xhtml1/transitional" class=
5743: "filename">/usr/X11R6</code>, <code xmlns=
5744: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5745: "filename">/usr/openwin</code>, ...), you will have to
1.45 wiz 5746: add the following line into <code xmlns=
5747: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5748: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5749: <pre class="programlisting">
1.51 rillig 5750: X11_TYPE=XFree86
1.1 grant 5751: </pre>
5752: </div>
5753:
1.67 hubertf 5754: <div class="sect1" lang="en">
1.1 grant 5755: <div class="titlepage">
5756: <div>
5757: <div>
5758: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5759: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 5760: install/use X.org from pkgsrc?</h2>
5761: </div>
5762: </div>
5763: </div>
5764:
5765: <p>If you want to use X.org from pkgsrc instead of your
1.45 wiz 5766: system's own X11 (<code xmlns=
5767: "http://www.w3.org/TR/xhtml1/transitional" class=
5768: "filename">/usr/X11R6</code>, <code xmlns=
5769: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5770: "filename">/usr/openwin</code>, ...) you will have to add
1.45 wiz 5771: the following line into <code xmlns=
5772: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5773: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5774: <pre class="programlisting">
1.51 rillig 5775: X11_TYPE=xorg
1.1 grant 5776: </pre>
1.70 ! rillig 5777:
! 5778: <div class="note" style=
! 5779: "margin-left: 0.5in; margin-right: 0.5in;">
! 5780: <h3 class="title">Note</h3>
! 5781:
! 5782: <p>The DragonFly operating system defaults to using
! 5783: this X.org X11 implementation from pkgsrc.</p>
! 5784: </div>
1.1 grant 5785: </div>
5786:
1.67 hubertf 5787: <div class="sect1" lang="en">
1.1 grant 5788: <div class="titlepage">
5789: <div>
5790: <div>
5791: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5792: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 5793: files from behind a firewall</h2>
1.1 grant 5794: </div>
5795: </div>
5796: </div>
5797:
5798: <p>If you are sitting behind a firewall which does not
5799: allow direct connections to Internet hosts (i.e.
5800: non-NAT), you may specify the relevant proxy hosts. This
5801: is done using an environment variable in the form of a
1.47 reed 5802: URL, e.g. in Amdahl, the machine “<span class=
1.1 grant 5803: "quote">orpheus.amdahl.com</span>” is one of the
5804: firewalls, and it uses port 80 as the proxy port number.
5805: So the proxy environment variables are:</p>
5806: <pre class="programlisting">
1.51 rillig 5807: ftp_proxy=ftp://orpheus.amdahl.com:80/
5808: http_proxy=http://orpheus.amdahl.com:80/
1.1 grant 5809: </pre>
5810: </div>
5811:
1.67 hubertf 5812: <div class="sect1" lang="en">
1.1 grant 5813: <div class="titlepage">
5814: <div>
5815: <div>
5816: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 5817: "passive-ftp"></a>7.9. How do I tell
5818: <span><strong class="command">make
1.14 xtraeme 5819: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 5820: </div>
5821: </div>
5822: </div>
5823:
5824: <p>This depends on which utility is used to retrieve
1.45 wiz 5825: distfiles. From <code xmlns=
5826: "http://www.w3.org/TR/xhtml1/transitional" class=
5827: "filename">bsd.pkg.mk</code>, <code class=
5828: "varname">FETCH_CMD</code> is assigned the first
5829: available command from the following list:</p>
1.34 wiz 5830:
5831: <div class="itemizedlist">
5832: <ul type="disc">
5833: <li>
1.45 wiz 5834: <p><code xmlns=
5835: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5836: "filename">${LOCALBASE}/bin/ftp</code></p>
5837: </li>
5838:
5839: <li>
1.45 wiz 5840: <p><code xmlns=
5841: "http://www.w3.org/TR/xhtml1/transitional" class=
5842: "filename">/usr/bin/ftp</code></p>
1.34 wiz 5843: </li>
5844: </ul>
5845: </div>
1.1 grant 5846:
5847: <p>On a default NetBSD installation, this will be
1.45 wiz 5848: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5849: class="filename">/usr/bin/ftp</code>, which automatically
5850: tries passive connections first, and falls back to active
5851: connections if the server refuses to do passive. For the
5852: other tools, add the following to your <code xmlns=
5853: "http://www.w3.org/TR/xhtml1/transitional" class=
5854: "filename">/etc/mk.conf</code> file: <code class=
5855: "varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 5856:
1.45 wiz 5857: <p>Having that option present will prevent <code xmlns=
5858: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5859: "filename">/usr/bin/ftp</code> from falling back to
5860: active transfers.</p>
1.1 grant 5861: </div>
5862:
1.67 hubertf 5863: <div class="sect1" lang="en">
1.1 grant 5864: <div class="titlepage">
5865: <div>
5866: <div>
5867: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5868: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 5869: fetch all distfiles at once</h2>
5870: </div>
5871: </div>
5872: </div>
5873:
5874: <p>You would like to download all the distfiles in a
5875: single batch from work or university, where you can't run
1.14 xtraeme 5876: a <span><strong class="command">make
5877: fetch</strong></span>. There is an archive of distfiles
5878: on <a href=
1.1 grant 5879: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
5880: target="_top">ftp.NetBSD.org</a>, but downloading the
5881: entire directory may not be appropriate.</p>
5882:
1.14 xtraeme 5883: <p>The answer here is to do a <span><strong class=
1.45 wiz 5884: "command">make fetch-list</strong></span> in <code xmlns=
5885: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 5886: "filename">/usr/pkgsrc</code> or one of its
1.1 grant 5887: subdirectories, carry the resulting list to your machine
1.23 wiz 5888: at work/school and use it there. If you don't have a
1.24 wiz 5889: NetBSD-compatible <a href=
5890: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5891: <span class="citerefentry"><span class=
5892: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
5893: at work, don't forget to set <code class=
5894: "varname">FETCH_CMD</code> to something that fetches a
5895: URL:</p>
1.1 grant 5896:
5897: <p>At home:</p>
5898: <pre class="screen">
1.14 xtraeme 5899: <code class="prompt">%</code> <strong class=
5900: "userinput"><code>cd /usr/pkgsrc</code></strong>
5901: <code class="prompt">%</code> <strong class=
5902: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
5903: <code class="prompt">%</code> <strong class=
5904: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 5905: </pre>
5906:
5907: <p>At work:</p>
5908: <pre class="screen">
1.14 xtraeme 5909: <code class="prompt">%</code> <strong class=
5910: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 5911: </pre>
5912:
1.45 wiz 5913: <p>then tar up <code xmlns=
5914: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5915: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 5916:
5917: <p>If you have a machine running NetBSD, and you want to
5918: get <span class="emphasis"><em>all</em></span> distfiles
5919: (even ones that aren't for your machine architecture),
5920: you can do so by using the above-mentioned
1.14 xtraeme 5921: <span><strong class="command">make
5922: fetch-list</strong></span> approach, or fetch the
5923: distfiles directly by running:</p>
1.1 grant 5924: <pre class="screen">
1.14 xtraeme 5925: <code class="prompt">%</code> <strong class=
5926: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 5927: </pre>
5928:
1.14 xtraeme 5929: <p>If you even decide to ignore <code class=
5930: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
5931: can get everything by running:</p>
1.1 grant 5932: <pre class="screen">
1.14 xtraeme 5933: <code class="prompt">%</code> <strong class=
5934: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 5935: </pre>
5936: </div>
5937:
1.67 hubertf 5938: <div class="sect1" lang="en">
1.1 grant 5939: <div class="titlepage">
5940: <div>
5941: <div>
5942: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5943: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 5944: “<span class="quote">Don't know how to make
5945: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
5946: </div>
5947: </div>
5948: </div>
5949:
5950: <p>When compiling the <a xmlns=
5951: "http://www.w3.org/TR/xhtml1/transitional" href=
5952: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5953: target="_top"><code xmlns="" class=
5954: "filename">pkgtools/pkg_install</code></a> package, you
5955: get the error from make that it doesn't know how to make
5956: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5957: class="filename">/usr/share/tmac/tmac.andoc</code>? This
5958: indicates that you don't have installed the
1.23 wiz 5959: “<span class="quote">text</span>” set (nroff,
5960: ...) from the NetBSD base distribution on your machine.
1.47 reed 5961: It is recommended to do that to format man pages.</p>
1.1 grant 5962:
5963: <p>In the case of the <a xmlns=
5964: "http://www.w3.org/TR/xhtml1/transitional" href=
5965: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5966: target="_top"><code xmlns="" class=
5967: "filename">pkgtools/pkg_install</code></a> package, you
5968: can get away with setting <code class=
1.20 ben 5969: "varname">NOMAN=YES</code> either in the environment or
1.45 wiz 5970: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5971: class="filename">/etc/mk.conf</code>.</p>
1.1 grant 5972: </div>
5973:
1.67 hubertf 5974: <div class="sect1" lang="en">
1.1 grant 5975: <div class="titlepage">
5976: <div>
5977: <div>
5978: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5979: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 5980: “<span class="quote">Could not find
5981: bsd.own.mk</span>” mean?</h2>
5982: </div>
5983: </div>
5984: </div>
5985:
1.45 wiz 5986: <p>You didn't install the compiler set, <code xmlns=
5987: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5988: "filename">comp.tgz</code>, when you installed your
1.47 reed 5989: NetBSD machine. Please get and install it, by extracting
5990: it in <code xmlns=
1.45 wiz 5991: "http://www.w3.org/TR/xhtml1/transitional" class=
5992: "filename">/</code>:</p>
1.1 grant 5993: <pre class="screen">
1.14 xtraeme 5994: <code class="prompt">#</code> <strong class=
5995: "userinput"><code>cd /</code></strong>
5996: <code class="prompt">#</code> <strong class=
5997: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 5998: </pre>
5999:
1.45 wiz 6000: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6001: class="filename">comp.tgz</code> is part of every NetBSD
6002: release. Get the one that corresponds to your release
6003: (determine via <span><strong class="command">uname
6004: -r</strong></span>).</p>
1.1 grant 6005: </div>
6006:
1.67 hubertf 6007: <div class="sect1" lang="en">
1.1 grant 6008: <div class="titlepage">
6009: <div>
6010: <div>
6011: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6012: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 6013: 'sudo' with pkgsrc</h2>
6014: </div>
6015: </div>
6016: </div>
6017:
6018: <p>When installing packages as non-root user and using
1.24 wiz 6019: the just-in-time <a href=
6020: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
6021: <span class="citerefentry"><span class=
6022: "refentrytitle">su</span>(1)</span></a> feature of
6023: pkgsrc, it can become annoying to type in the root
6024: password for each required package installed. To avoid
6025: this, the sudo package can be used, which does password
6026: caching over a limited time. To use it, install sudo
6027: (either as binary package or from <a xmlns=
6028: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 6029: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45 wiz 6030: target="_top"><code xmlns="" class=
6031: "filename">security/sudo</code></a>) and then put the
6032: following into your <code xmlns=
6033: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 6034: "filename">/etc/mk.conf</code>:</p>
1.1 grant 6035: <pre class="programlisting">
1.51 rillig 6036: .if exists(${LOCALBASE}/bin/sudo)
6037: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
6038: .endif
1.1 grant 6039: </pre>
6040: </div>
6041:
1.67 hubertf 6042: <div class="sect1" lang="en">
1.1 grant 6043: <div class="titlepage">
6044: <div>
6045: <div>
6046: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 6047: "faq.conf"></a>7.14. How do I change the
6048: location of configuration files?</h2>
1.1 grant 6049: </div>
6050: </div>
6051: </div>
6052:
1.35 jmmv 6053: <p>As the system administrator, you can choose where
6054: configuration files are installed. The default settings
1.45 wiz 6055: make all these files go into <code xmlns=
6056: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 6057: "filename">${PREFIX}/etc</code> or some of its
6058: subdirectories; this may be suboptimal depending on your
6059: expectations (e.g., a read-only, NFS-exported
6060: <code class="varname">PREFIX</code> with a need of
6061: per-machine configuration of the provided packages).</p>
6062:
6063: <p>In order to change the defaults, you can modify the
6064: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45 wiz 6065: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6066: class="filename">/etc/mk.conf</code>) to point to your
6067: preferred configuration directory; some common examples
6068: include <code xmlns=
6069: "http://www.w3.org/TR/xhtml1/transitional" class=
6070: "filename">/etc</code> or <code xmlns=
6071: "http://www.w3.org/TR/xhtml1/transitional" class=
6072: "filename">/etc/pkg</code>.</p>
1.35 jmmv 6073:
6074: <p>Furthermore, you can change this value on a
6075: per-package basis by setting the <code class=
6076: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
6077: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
6078: value usually matches the name of the package you would
6079: like to modify, that is, the contents of <code class=
6080: "varname">PKGBASE</code>.</p>
1.1 grant 6081:
1.47 reed 6082: <p>Note that after changing these settings, you must
1.35 jmmv 6083: rebuild and reinstall any affected packages.</p>
1.1 grant 6084: </div>
6085:
1.67 hubertf 6086: <div class="sect1" lang="en">
1.1 grant 6087: <div class="titlepage">
6088: <div>
6089: <div>
6090: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6091: "audit-packages"></a>7.15. Automated security
1.1 grant 6092: checks</h2>
6093: </div>
6094: </div>
6095: </div>
6096:
6097: <p>Please be aware that there can often be bugs in
6098: third-party software, and some of these bugs can leave a
6099: machine vulnerable to exploitation by attackers. In an
6100: effort to lessen the exposure, the NetBSD packages team
6101: maintains a database of known-exploits to packages which
6102: have at one time been included in pkgsrc. The database
6103: can be downloaded automatically, and a security audit of
6104: all packages installed on a system can take place. To do
6105: this, install the <a xmlns=
6106: "http://www.w3.org/TR/xhtml1/transitional" href=
6107: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 6108: target="_top"><code xmlns="" class=
6109: "filename">security/audit-packages</code></a> package. It
1.20 ben 6110: has two components:</p>
1.1 grant 6111:
6112: <div class="orderedlist">
6113: <ol type="1">
6114: <li>
1.34 wiz 6115: <p><span><strong class=
6116: "command">download-vulnerability-list</strong></span>,
1.1 grant 6117: an easy way to download a list of the security
6118: vulnerabilities information. This list is kept up
6119: to date by the NetBSD security officer and the
6120: NetBSD packages team, and is distributed from the
6121: NetBSD ftp server:</p>
6122:
6123: <p><a href=
6124: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 6125: target=
6126: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 6127: </li>
6128:
6129: <li>
1.34 wiz 6130: <p><span><strong class=
6131: "command">audit-packages</strong></span>, an easy
6132: way to audit the current machine, checking each
1.1 grant 6133: vulnerability which is known. If a vulnerable
6134: package is installed, it will be shown by output to
6135: stdout, including a description of the type of
6136: vulnerability, and a URL containing more
6137: information.</p>
6138: </li>
6139: </ol>
6140: </div>
6141:
1.23 wiz 6142: <p>Use of the <a xmlns=
6143: "http://www.w3.org/TR/xhtml1/transitional" href=
6144: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 6145: target="_top"><code xmlns="" class=
6146: "filename">security/audit-packages</code></a> package is
1.23 wiz 6147: strongly recommended! After “<span class=
6148: "quote">audit-packages</span>” is installed, please
6149: read the package's message, which you can get by running
6150: <strong class="userinput"><code>pkg_info -D
1.65 hubertf 6151: audit-packages</code></strong>.</p>
1.58 erh 6152:
6153: <p>If this package is installed, pkgsrc builds will use
6154: it to perform a security check before building any
6155: package. See <a href="#variables-affecting-build" title=
6156: "5.2. Variables affecting the build process">Section 5.2,
6157: “Variables affecting the build process”</a>
1.59 rillig 6158: for ways to control this check.</p>
1.1 grant 6159: </div>
6160: </div>
6161: </div>
6162:
1.67 hubertf 6163: <div class="part" lang="en">
1.1 grant 6164: <div class="titlepage">
6165: <div>
6166: <div>
1.67 hubertf 6167: <h1 class="title"><a name=
1.48 dillo 6168: "developers-guide"></a>Part II. The pkgsrc
6169: developer's guide</h1>
1.1 grant 6170: </div>
6171: </div>
6172: </div>
6173:
6174: <div class="toc">
6175: <p><b>Table of Contents</b></p>
6176:
6177: <dl>
1.38 dillo 6178: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 6179: Package components - files, directories and
6180: contents</a></span></dt>
6181:
6182: <dd>
6183: <dl>
6184: <dt><span class="sect1"><a href=
1.45 wiz 6185: "#components.Makefile">8.1. <code xmlns=
6186: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6187: "filename">Makefile</code></a></span></dt>
6188:
6189: <dt><span class="sect1"><a href=
1.45 wiz 6190: "#components.distinfo">8.2. <code xmlns=
6191: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6192: "filename">distinfo</code></a></span></dt>
6193:
6194: <dt><span class="sect1"><a href=
1.38 dillo 6195: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 6196:
1.30 wiz 6197: <dt><span class="sect1"><a href=
1.38 dillo 6198: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6199: files</a></span></dt>
1.27 rillig 6200:
6201: <dt><span class="sect1"><a href=
1.38 dillo 6202: "#components.optional">8.5. Optional
1.27 rillig 6203: files</a></span></dt>
6204:
1.38 dillo 6205: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6206: <code xmlns=
6207: "http://www.w3.org/TR/xhtml1/transitional" class=
6208: "filename">work*</code></a></span></dt>
1.27 rillig 6209:
1.38 dillo 6210: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6211: <code xmlns=
6212: "http://www.w3.org/TR/xhtml1/transitional" class=
6213: "filename">files/*</code></a></span></dt>
1.27 rillig 6214: </dl>
6215: </dd>
6216:
1.38 dillo 6217: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 6218: Programming in <code xmlns=
6219: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 6220: "filename">Makefile</code>s</a></span></dt>
6221:
6222: <dd>
6223: <dl>
6224: <dt><span class="sect1"><a href=
1.45 wiz 6225: "#makefile.variables">9.1. <code xmlns=
6226: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 6227: "filename">Makefile</code> variables</a></span></dt>
6228:
1.27 rillig 6229: <dd>
6230: <dl>
6231: <dt><span class="sect2"><a href=
1.38 dillo 6232: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 6233: conventions</a></span></dt>
6234: </dl>
6235: </dd>
6236:
1.38 dillo 6237: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 6238: Code snippets</a></span></dt>
6239:
6240: <dd>
6241: <dl>
6242: <dt><span class="sect2"><a href=
1.38 dillo 6243: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 6244: list</a></span></dt>
6245:
6246: <dt><span class="sect2"><a href=
1.38 dillo 6247: "#converting-internal-to-external">9.2.2.
1.30 wiz 6248: Converting an internal list into an external
6249: list</a></span></dt>
1.25 rillig 6250:
6251: <dt><span class="sect2"><a href=
1.38 dillo 6252: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 6253: variables to a shell command</a></span></dt>
1.27 rillig 6254:
6255: <dt><span class="sect2"><a href=
1.38 dillo 6256: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 6257: guideline</a></span></dt>
6258:
6259: <dt><span class="sect2"><a href=
1.38 dillo 6260: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 6261: a bug in BSD Make</a></span></dt>
1.25 rillig 6262: </dl>
6263: </dd>
6264: </dl>
6265: </dd>
6266:
1.38 dillo 6267: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 6268: issues</a></span></dt>
6269:
6270: <dd>
6271: <dl>
1.38 dillo 6272: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 6273: ID</a></span></dt>
6274:
1.30 wiz 6275: <dt><span class="sect1"><a href=
1.38 dillo 6276: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 6277: <code xmlns=
6278: "http://www.w3.org/TR/xhtml1/transitional" class=
6279: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 6280:
1.38 dillo 6281: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 6282: Tweaking output of <span><strong class="command">make
6283: print-PLIST</strong></span></a></span></dt>
1.1 grant 6284:
1.38 dillo 6285: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 6286: Variable substitution in PLIST</a></span></dt>
6287:
1.30 wiz 6288: <dt><span class="sect1"><a href=
1.48 dillo 6289: "#manpage-compression">10.5. Man page
6290: compression</a></span></dt>
1.1 grant 6291:
1.30 wiz 6292: <dt><span class="sect1"><a href=
1.38 dillo 6293: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 6294: <code class=
1.14 xtraeme 6295: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 6296:
1.30 wiz 6297: <dt><span class="sect1"><a href=
1.47 reed 6298: "#platform-specific-plist">10.7. Platform-specific
1.38 dillo 6299: and differing PLISTs</a></span></dt>
1.1 grant 6300:
6301: <dt><span class="sect1"><a href=
1.38 dillo 6302: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 6303: packages</a></span></dt>
6304: </dl>
6305: </dd>
6306:
1.38 dillo 6307: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 6308: Buildlink methodology</a></span></dt>
6309:
6310: <dd>
6311: <dl>
1.30 wiz 6312: <dt><span class="sect1"><a href=
1.38 dillo 6313: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 6314: to use buildlink3</a></span></dt>
1.1 grant 6315:
1.30 wiz 6316: <dt><span class="sect1"><a href=
1.45 wiz 6317: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
6318: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6319: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 6320:
6321: <dd>
6322: <dl>
6323: <dt><span class="sect2"><a href=
1.38 dillo 6324: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 6325: buildlink3.mk file</a></span></dt>
1.1 grant 6326:
6327: <dt><span class="sect2"><a href=
1.38 dillo 6328: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 6329: <code class=
1.67 hubertf 6330: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
6331: in <code xmlns=
1.45 wiz 6332: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6333: "filename">buildlink3.mk</code>
1.1 grant 6334: files</a></span></dt>
6335: </dl>
6336: </dd>
6337:
1.30 wiz 6338: <dt><span class="sect1"><a href=
1.45 wiz 6339: "#writing-builtin.mk">11.3. Writing <code xmlns=
6340: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6341: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 6342:
6343: <dd>
6344: <dl>
6345: <dt><span class="sect2"><a href=
1.38 dillo 6346: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 6347: <code xmlns=
6348: "http://www.w3.org/TR/xhtml1/transitional" class=
6349: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 6350:
6351: <dt><span class="sect2"><a href=
1.38 dillo 6352: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 6353: preferences for native or pkgsrc
6354: software</a></span></dt>
1.1 grant 6355: </dl>
6356: </dd>
6357: </dl>
6358: </dd>
6359:
1.38 dillo 6360: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 6361: pkginstall framework</a></span></dt>
6362:
6363: <dd>
6364: <dl>
6365: <dt><span class="sect1"><a href=
1.38 dillo 6366: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 6367: directories outside the installation
6368: prefix</a></span></dt>
6369:
6370: <dd>
6371: <dl>
6372: <dt><span class="sect2"><a href=
1.38 dillo 6373: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 6374: manipulation</a></span></dt>
6375:
6376: <dt><span class="sect2"><a href=
1.38 dillo 6377: "#files-outside-prefix">12.1.2. File
1.35 jmmv 6378: manipulation</a></span></dt>
6379: </dl>
6380: </dd>
6381:
1.38 dillo 6382: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 6383: Configuration files</a></span></dt>
6384:
6385: <dd>
6386: <dl>
6387: <dt><span class="sect2"><a href=
1.38 dillo 6388: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 6389: "varname">PKG_SYSCONFDIR</code> is
6390: set</a></span></dt>
6391:
6392: <dt><span class="sect2"><a href=
1.38 dillo 6393: "#conf-files-configure">12.2.2. Telling the
1.47 reed 6394: software where configuration files
1.35 jmmv 6395: are</a></span></dt>
6396:
6397: <dt><span class="sect2"><a href=
1.38 dillo 6398: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 6399: installations</a></span></dt>
6400:
6401: <dt><span class="sect2"><a href=
1.38 dillo 6402: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 6403: of configuration files</a></span></dt>
6404: </dl>
6405: </dd>
6406:
1.38 dillo 6407: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 6408: System startup scripts</a></span></dt>
6409:
6410: <dd>
6411: <dl>
6412: <dt><span class="sect2"><a href=
1.38 dillo 6413: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 6414: of system startup scripts</a></span></dt>
6415: </dl>
6416: </dd>
6417:
6418: <dt><span class="sect1"><a href=
1.38 dillo 6419: "#users-and-groups">12.4. System users and
1.35 jmmv 6420: groups</a></span></dt>
6421:
1.38 dillo 6422: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 6423: System shells</a></span></dt>
6424:
6425: <dd>
6426: <dl>
6427: <dt><span class="sect2"><a href=
1.65 hubertf 6428: "#shells-disable">12.5.1. Disabling shell
6429: registration</a></span></dt>
6430: </dl>
6431: </dd>
6432:
6433: <dt><span class="sect1"><a href="#fonts">12.6.
6434: Fonts</a></span></dt>
6435:
6436: <dd>
6437: <dl>
6438: <dt><span class="sect2"><a href=
6439: "#fonts-disable">12.6.1. Disabling automatic
6440: update of the fonts databases</a></span></dt>
1.35 jmmv 6441: </dl>
6442: </dd>
6443: </dl>
6444: </dd>
6445:
1.38 dillo 6446: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 6447: handling</a></span></dt>
6448:
6449: <dd>
6450: <dl>
1.30 wiz 6451: <dt><span class="sect1"><a href=
1.38 dillo 6452: "#global-default-options">13.1. Global default
1.30 wiz 6453: options</a></span></dt>
1.1 grant 6454:
1.30 wiz 6455: <dt><span class="sect1"><a href=
1.38 dillo 6456: "#converting-to-options">13.2. Converting packages to
1.45 wiz 6457: use <code xmlns=
6458: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6459: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 6460:
6461: <dt><span class="sect1"><a href="#option-names">13.3.
6462: Option Names</a></span></dt>
1.1 grant 6463: </dl>
6464: </dd>
6465:
1.38 dillo 6466: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 6467: process</a></span></dt>
6468:
6469: <dd>
6470: <dl>
1.56 rillig 6471: <dt><span class="sect1"><a href="#build.intro">14.1.
6472: Introduction</a></span></dt>
6473:
6474: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 6475: Program location</a></span></dt>
6476:
1.56 rillig 6477: <dt><span class="sect1"><a href=
6478: "#build.builddirs">14.3. Directories used during the
6479: build process</a></span></dt>
1.1 grant 6480:
6481: <dt><span class="sect1"><a href=
1.56 rillig 6482: "#build.running">14.4. Running a
6483: phase</a></span></dt>
6484:
6485: <dt><span class="sect1"><a href="#build.fetch">14.5.
6486: The <span class="emphasis"><em>fetch</em></span>
6487: phase</a></span></dt>
6488:
6489: <dt><span class="sect1"><a href=
6490: "#build.checksum">14.6. The <span class=
6491: "emphasis"><em>checksum</em></span>
6492: phase</a></span></dt>
6493:
6494: <dt><span class="sect1"><a href=
6495: "#build.extract">14.7. The <span class=
6496: "emphasis"><em>extract</em></span>
6497: phase</a></span></dt>
6498:
6499: <dt><span class="sect1"><a href="#build.patch">14.8.
6500: The <span class="emphasis"><em>patch</em></span>
6501: phase</a></span></dt>
6502:
6503: <dt><span class="sect1"><a href="#build.tools">14.9.
6504: The <span class="emphasis"><em>tools</em></span>
6505: phase</a></span></dt>
6506:
6507: <dt><span class="sect1"><a href=
6508: "#build.wrapper">14.10. The <span class=
6509: "emphasis"><em>wrapper</em></span>
6510: phase</a></span></dt>
6511:
6512: <dt><span class="sect1"><a href=
6513: "#build.configure">14.11. The <span class=
6514: "emphasis"><em>configure</em></span>
6515: phase</a></span></dt>
6516:
6517: <dt><span class="sect1"><a href="#build.build">14.12.
6518: The <span class="emphasis"><em>build</em></span>
6519: phase</a></span></dt>
6520:
6521: <dt><span class="sect1"><a href="#build.test">14.13.
6522: The <span class="emphasis"><em>test</em></span>
6523: phase</a></span></dt>
6524:
6525: <dt><span class="sect1"><a href=
6526: "#build.install">14.14. The <span class=
6527: "emphasis"><em>install</em></span>
6528: phase</a></span></dt>
6529:
6530: <dt><span class="sect1"><a href=
6531: "#build.package">14.15. The <span class=
6532: "emphasis"><em>package</em></span>
6533: phase</a></span></dt>
6534:
6535: <dt><span class="sect1"><a href=
6536: "#build.helpful-targets">14.16. Other helpful
1.1 grant 6537: targets</a></span></dt>
6538: </dl>
6539: </dd>
6540:
1.68 rillig 6541: <dt><span class="chapter"><a href="#tools">15. Tools
6542: needed for building or running</a></span></dt>
6543:
6544: <dd>
6545: <dl>
6546: <dt><span class="sect1"><a href="#pkgsrc-tools">15.1.
6547: Tools for pkgsrc builds</a></span></dt>
6548:
6549: <dt><span class="sect1"><a href=
6550: "#package-tools">15.2. Tools needed by
6551: packages</a></span></dt>
6552:
6553: <dt><span class="sect1"><a href=
6554: "#platform-tools">15.3. Tools provided by
6555: platforms</a></span></dt>
6556: </dl>
6557: </dd>
6558:
6559: <dt><span class="chapter"><a href="#fixes">16. Making
1.55 rillig 6560: your package work</a></span></dt>
1.1 grant 6561:
6562: <dd>
6563: <dl>
1.30 wiz 6564: <dt><span class="sect1"><a href=
1.68 rillig 6565: "#general-operation">16.1. General
1.30 wiz 6566: operation</a></span></dt>
1.1 grant 6567:
6568: <dd>
6569: <dl>
6570: <dt><span class="sect2"><a href=
1.68 rillig 6571: "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30 wiz 6572: pull in variables from
6573: /etc/mk.conf</a></span></dt>
1.1 grant 6574:
6575: <dt><span class="sect2"><a href=
1.68 rillig 6576: "#where-to-install-documentation">16.1.2. Where
1.31 wiz 6577: to install documentation</a></span></dt>
6578:
6579: <dt><span class="sect2"><a href=
1.68 rillig 6580: "#restricted-packages">16.1.3. Restricted
1.1 grant 6581: packages</a></span></dt>
6582:
6583: <dt><span class="sect2"><a href=
1.68 rillig 6584: "#dependencies">16.1.4. Handling
1.1 grant 6585: dependencies</a></span></dt>
6586:
6587: <dt><span class="sect2"><a href=
1.68 rillig 6588: "#conflicts">16.1.5. Handling conflicts with
1.1 grant 6589: other packages</a></span></dt>
6590:
6591: <dt><span class="sect2"><a href=
1.68 rillig 6592: "#not-building-packages">16.1.6. Packages that
1.30 wiz 6593: cannot or should not be built</a></span></dt>
1.1 grant 6594:
6595: <dt><span class="sect2"><a href=
1.68 rillig 6596: "#undeletable-packages">16.1.7. Packages which
1.30 wiz 6597: should not be deleted, once
6598: installed</a></span></dt>
1.1 grant 6599:
6600: <dt><span class="sect2"><a href=
1.68 rillig 6601: "#security-handling">16.1.8. Handling packages
1.1 grant 6602: with security problems</a></span></dt>
6603:
6604: <dt><span class="sect2"><a href=
1.68 rillig 6605: "#compiler-bugs">16.1.9. How to handle compiler
1.1 grant 6606: bugs</a></span></dt>
6607:
6608: <dt><span class="sect2"><a href=
1.68 rillig 6609: "#bumping-pkgrevision">16.1.10. How to handle
1.30 wiz 6610: incrementing versions when fixing an existing
1.1 grant 6611: package</a></span></dt>
6612:
6613: <dt><span class="sect2"><a href=
1.68 rillig 6614: "#portability-of-packages">16.1.11. Portability
1.30 wiz 6615: of packages</a></span></dt>
1.1 grant 6616: </dl>
6617: </dd>
6618:
1.30 wiz 6619: <dt><span class="sect1"><a href=
1.68 rillig 6620: "#downloading-issues">16.2. Possible downloading
1.30 wiz 6621: issues</a></span></dt>
1.1 grant 6622:
6623: <dd>
6624: <dl>
6625: <dt><span class="sect2"><a href=
1.68 rillig 6626: "#no-plain-download">16.2.1. Packages whose
1.30 wiz 6627: distfiles aren't available for plain
1.1 grant 6628: downloading</a></span></dt>
6629:
6630: <dt><span class="sect2"><a href=
1.68 rillig 6631: "#modified-distfiles-same-name">16.2.2. How to
1.30 wiz 6632: handle modified distfiles with the 'old'
6633: name</a></span></dt>
1.1 grant 6634: </dl>
6635: </dd>
6636:
1.30 wiz 6637: <dt><span class="sect1"><a href=
1.68 rillig 6638: "#configuration-gotchas">16.3. Configuration
1.30 wiz 6639: gotchas</a></span></dt>
1.1 grant 6640:
6641: <dd>
6642: <dl>
6643: <dt><span class="sect2"><a href=
1.68 rillig 6644: "#fixes.libtool">16.3.1. Shared libraries -
1.1 grant 6645: libtool</a></span></dt>
6646:
6647: <dt><span class="sect2"><a href=
1.68 rillig 6648: "#using-libtool">16.3.2. Using libtool on GNU
1.1 grant 6649: packages that already support
6650: libtool</a></span></dt>
6651:
6652: <dt><span class="sect2"><a href=
1.68 rillig 6653: "#autoconf-automake">16.3.3. GNU
1.1 grant 6654: Autoconf/Automake</a></span></dt>
6655: </dl>
6656: </dd>
6657:
1.68 rillig 6658: <dt><span class="sect1"><a href="#fixes-build">16.4.
1.55 rillig 6659: Building the package</a></span></dt>
1.1 grant 6660:
6661: <dd>
6662: <dl>
6663: <dt><span class="sect2"><a href=
1.68 rillig 6664: "#cpp-defines">16.4.1. CPP
1.30 wiz 6665: defines</a></span></dt>
1.51 rillig 6666:
6667: <dt><span class="sect2"><a href=
1.68 rillig 6668: "#cpp-list-examples">16.4.2. Examples of CPP
1.60 rillig 6669: defines for some platforms</a></span></dt>
6670:
6671: <dt><span class="sect2"><a href=
1.68 rillig 6672: "#cpp-list">16.4.3. Getting a list of CPP
1.51 rillig 6673: defines</a></span></dt>
1.1 grant 6674: </dl>
6675: </dd>
6676:
1.30 wiz 6677: <dt><span class="sect1"><a href=
1.68 rillig 6678: "#package-specific-actions">16.5. Package specific
1.30 wiz 6679: actions</a></span></dt>
1.1 grant 6680:
6681: <dd>
6682: <dl>
6683: <dt><span class="sect2"><a href=
1.68 rillig 6684: "#user-interaction">16.5.1. User
1.2 hubertf 6685: interaction</a></span></dt>
1.1 grant 6686:
6687: <dt><span class="sect2"><a href=
1.68 rillig 6688: "#handling-licenses">16.5.2. Handling
1.1 grant 6689: licenses</a></span></dt>
6690:
6691: <dt><span class="sect2"><a href=
1.68 rillig 6692: "#installing-score-files">16.5.3. Installing
1.30 wiz 6693: score files</a></span></dt>
1.1 grant 6694:
6695: <dt><span class="sect2"><a href=
1.68 rillig 6696: "#perl-scripts">16.5.4. Packages containing perl
1.1 grant 6697: scripts</a></span></dt>
6698:
6699: <dt><span class="sect2"><a href=
1.68 rillig 6700: "#hardcoded-paths">16.5.5. Packages with
1.30 wiz 6701: hardcoded paths to other
6702: interpreters</a></span></dt>
1.1 grant 6703:
6704: <dt><span class="sect2"><a href=
1.68 rillig 6705: "#perl-modules">16.5.6. Packages installing perl
1.1 grant 6706: modules</a></span></dt>
6707:
6708: <dt><span class="sect2"><a href=
1.68 rillig 6709: "#faq.info-files">16.5.7. Packages installing
1.1 grant 6710: info files</a></span></dt>
6711:
6712: <dt><span class="sect2"><a href=
1.68 rillig 6713: "#manpages">16.5.8. Packages installing man
1.57 minskim 6714: pages</a></span></dt>
6715:
6716: <dt><span class="sect2"><a href=
1.68 rillig 6717: "#gconf2-data-files">16.5.9. Packages installing
1.30 wiz 6718: GConf2 data files</a></span></dt>
1.1 grant 6719:
6720: <dt><span class="sect2"><a href=
1.68 rillig 6721: "#scrollkeeper-data-files">16.5.10. Packages
1.30 wiz 6722: installing scrollkeeper data
6723: files</a></span></dt>
1.1 grant 6724:
6725: <dt><span class="sect2"><a href=
1.68 rillig 6726: "#x11-fonts">16.5.11. Packages installing X11
1.1 grant 6727: fonts</a></span></dt>
6728:
6729: <dt><span class="sect2"><a href=
1.68 rillig 6730: "#gtk2-modules">16.5.12. Packages installing GTK2
1.1 grant 6731: modules</a></span></dt>
6732:
6733: <dt><span class="sect2"><a href=
1.68 rillig 6734: "#sgml-xml-data">16.5.13. Packages installing
1.30 wiz 6735: SGML or XML data</a></span></dt>
1.1 grant 6736:
6737: <dt><span class="sect2"><a href=
1.68 rillig 6738: "#mime-database">16.5.14. Packages installing
1.1 grant 6739: extensions to the MIME database</a></span></dt>
6740:
6741: <dt><span class="sect2"><a href=
1.68 rillig 6742: "#intltool">16.5.15. Packages using
1.1 grant 6743: intltool</a></span></dt>
1.18 xtraeme 6744:
6745: <dt><span class="sect2"><a href=
1.68 rillig 6746: "#startup-scripts">16.5.16. Packages installing
1.30 wiz 6747: startup scripts</a></span></dt>
1.57 minskim 6748:
6749: <dt><span class="sect2"><a href=
1.68 rillig 6750: "#tex-packages">16.5.17. Packages installing TeX
1.57 minskim 6751: modules</a></span></dt>
1.1 grant 6752: </dl>
6753: </dd>
6754:
1.30 wiz 6755: <dt><span class="sect1"><a href=
1.68 rillig 6756: "#feedback-to-author">16.6. Feedback to the
1.30 wiz 6757: author</a></span></dt>
1.1 grant 6758: </dl>
6759: </dd>
6760:
1.68 rillig 6761: <dt><span class="chapter"><a href="#debug">17.
1.1 grant 6762: Debugging</a></span></dt>
6763:
1.68 rillig 6764: <dt><span class="chapter"><a href="#submit">18.
1.1 grant 6765: Submitting and Committing</a></span></dt>
6766:
6767: <dd>
6768: <dl>
1.30 wiz 6769: <dt><span class="sect1"><a href=
1.68 rillig 6770: "#submitting-your-package">18.1. Submitting your
1.30 wiz 6771: packages</a></span></dt>
1.1 grant 6772:
1.30 wiz 6773: <dt><span class="sect1"><a href=
1.68 rillig 6774: "#general-notes-for-changes">18.2. General notes when
1.41 wiz 6775: adding, updating, or removing
6776: packages</a></span></dt>
6777:
6778: <dt><span class="sect1"><a href=
1.68 rillig 6779: "#committing-importing">18.3. Committing: Importing a
1.30 wiz 6780: package into CVS</a></span></dt>
1.1 grant 6781:
1.30 wiz 6782: <dt><span class="sect1"><a href=
1.68 rillig 6783: "#updating-package">18.4. Updating a package to a
1.30 wiz 6784: newer version</a></span></dt>
1.1 grant 6785:
1.30 wiz 6786: <dt><span class="sect1"><a href=
1.68 rillig 6787: "#moving-package">18.5. Moving a package in
1.30 wiz 6788: pkgsrc</a></span></dt>
1.1 grant 6789: </dl>
6790: </dd>
1.69 rillig 6791:
6792: <dt><span class="chapter"><a href="#porting">19. Porting
6793: pkgsrc</a></span></dt>
6794:
6795: <dd>
6796: <dl>
6797: <dt><span class="sect1"><a href=
6798: "#porting.opsys">19.1. Porting pkgsrc to a new
6799: operating system</a></span></dt>
6800:
6801: <dt><span class="sect1"><a href=
6802: "#porting.compiler">19.2. Adding support for a new
6803: compiler</a></span></dt>
6804: </dl>
6805: </dd>
1.1 grant 6806: </dl>
6807: </div>
6808:
1.67 hubertf 6809: <div class="chapter" lang="en">
1.1 grant 6810: <div class="titlepage">
6811: <div>
6812: <div>
1.67 hubertf 6813: <h2 class="title"><a name=
1.38 dillo 6814: "components"></a>Chapter 8. Package
1.27 rillig 6815: components - files, directories and contents</h2>
1.25 rillig 6816: </div>
6817: </div>
6818: </div>
6819:
6820: <div class="toc">
6821: <p><b>Table of Contents</b></p>
6822:
6823: <dl>
6824: <dt><span class="sect1"><a href=
1.45 wiz 6825: "#components.Makefile">8.1. <code xmlns=
6826: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6827: "filename">Makefile</code></a></span></dt>
6828:
6829: <dt><span class="sect1"><a href=
1.45 wiz 6830: "#components.distinfo">8.2. <code xmlns=
6831: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6832: "filename">distinfo</code></a></span></dt>
6833:
6834: <dt><span class="sect1"><a href=
1.38 dillo 6835: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 6836:
1.30 wiz 6837: <dt><span class="sect1"><a href=
1.38 dillo 6838: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6839: files</a></span></dt>
1.25 rillig 6840:
1.27 rillig 6841: <dt><span class="sect1"><a href=
1.38 dillo 6842: "#components.optional">8.5. Optional
1.27 rillig 6843: files</a></span></dt>
1.25 rillig 6844:
1.38 dillo 6845: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6846: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6847: class="filename">work*</code></a></span></dt>
1.25 rillig 6848:
1.38 dillo 6849: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6850: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6851: class="filename">files/*</code></a></span></dt>
1.25 rillig 6852: </dl>
6853: </div>
6854:
1.27 rillig 6855: <p>Whenever you're preparing a package, there are a number
6856: of files involved which are described in the following
6857: sections.</p>
1.25 rillig 6858:
1.67 hubertf 6859: <div class="sect1" lang="en">
1.25 rillig 6860: <div class="titlepage">
6861: <div>
6862: <div>
6863: <h2 class="title" style="clear: both"><a name=
1.45 wiz 6864: "components.Makefile"></a>8.1. <code xmlns=
6865: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6866: "filename">Makefile</code></h2>
1.25 rillig 6867: </div>
6868: </div>
6869: </div>
6870:
1.27 rillig 6871: <p>Building, installation and creation of a binary
1.45 wiz 6872: package are all controlled by the package's <code xmlns=
6873: "http://www.w3.org/TR/xhtml1/transitional" class=
6874: "filename">Makefile</code>. The <code xmlns=
6875: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6876: "filename">Makefile</code> describes various things about
6877: a package, for example from where to get it, how to
6878: configure, build, and install it.</p>
6879:
1.45 wiz 6880: <p>A package <code xmlns=
6881: "http://www.w3.org/TR/xhtml1/transitional" class=
6882: "filename">Makefile</code> contains several sections that
6883: describe the package.</p>
1.25 rillig 6884:
1.27 rillig 6885: <p>In the first section there are the following
6886: variables, which should appear exactly in the order given
6887: here.</p>
1.25 rillig 6888:
6889: <div class="itemizedlist">
6890: <ul type="disc">
6891: <li>
1.27 rillig 6892: <p><code class="varname">DISTNAME</code> is the
6893: basename of the distribution file to be downloaded
6894: from the package's website.</p>
6895: </li>
6896:
6897: <li>
6898: <p><code class="varname">PKGNAME</code> is the name
6899: of the package, as used by pkgsrc. You only need to
1.50 rillig 6900: provide it if it differs from <code class=
6901: "varname">DISTNAME</code>. Usually it is the
6902: directory name together with the version number. It
6903: must match the regular expression <code class=
1.27 rillig 6904: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
6905: that is, it starts with a letter or digit, and
6906: contains only letters, digits, dashes, underscores,
6907: dots and plus signs.</p>
1.25 rillig 6908: </li>
6909:
6910: <li>
1.27 rillig 6911: <p><code class="varname">CATEGORIES</code> is a
6912: list of categories which the package fits in. You
6913: can choose any of the top-level directories of
6914: pkgsrc for it.</p>
1.45 wiz 6915:
6916: <p>Currently the following values are available for
6917: <code class="varname">CATEGORIES</code>. If more
6918: than one is used, they need to be separated by
6919: spaces:</p>
6920: <pre class="programlisting">
1.51 rillig 6921: archivers cross geography meta-pkgs security
6922: audio databases graphics misc shells
6923: benchmarks devel ham multimedia sysutils
6924: biology editors inputmethod net textproc
6925: cad emulators lang news time
6926: chat finance mail parallel wm
6927: comms fonts math pkgtools www
6928: converters games mbone print x11
1.45 wiz 6929: </pre>
1.25 rillig 6930: </li>
6931:
6932: <li>
1.27 rillig 6933: <p><code class="varname">MASTER_SITES</code> is a
6934: list of URLs where the distribution files can be
6935: downloaded. Each URL must end with a slash.</p>
1.45 wiz 6936:
6937: <p>The <code class="varname">MASTER_SITES</code>
6938: may make use of the following predefined sites:</p>
6939: <pre class="programlisting">
1.51 rillig 6940: ${MASTER_SITE_APACHE}
6941: ${MASTER_SITE_BACKUP}
6942: ${MASTER_SITE_CYGWIN}
6943: ${MASTER_SITE_DEBIAN}
6944: ${MASTER_SITE_FREEBSD}
6945: ${MASTER_SITE_FREEBSD_LOCAL}
6946: ${MASTER_SITE_GNOME}
6947: ${MASTER_SITE_GNU}
6948: ${MASTER_SITE_GNUSTEP}
6949: ${MASTER_SITE_IFARCHIVE}
6950: ${MASTER_SITE_MOZILLA}
6951: ${MASTER_SITE_OPENOFFICE}
6952: ${MASTER_SITE_PERL_CPAN}
6953: ${MASTER_SITE_R_CRAN}
6954: ${MASTER_SITE_SOURCEFORGE}
6955: ${MASTER_SITE_SUNSITE}
6956: ${MASTER_SITE_SUSE}
6957: ${MASTER_SITE_TEX_CTAN}
6958: ${MASTER_SITE_XCONTRIB}
6959: ${MASTER_SITE_XEMACS}
1.45 wiz 6960: </pre>
6961:
6962: <p>If one of these predefined sites is chosen, you
6963: may want to specify a subdirectory of that site.
6964: Since these macros may expand to more than one
6965: actual site, you <span class=
6966: "emphasis"><em>must</em></span> use the following
6967: construct to specify a subdirectory:</p>
6968: <pre class="programlisting">
1.51 rillig 6969: ${MASTER_SITE_GNU:=subdirectory/name/}
6970: ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45 wiz 6971: </pre>
6972:
6973: <p>Note the trailing slash after the subdirectory
6974: name.</p>
6975:
6976: <p>If the package has multiple <code class=
6977: "varname">DISTFILES</code> or multiple <code class=
6978: "varname">PATCHFILES</code> from different sites,
6979: set <code class="varname">SITES_foo</code> to a
1.47 reed 6980: list of URIs where file “<span class=
1.45 wiz 6981: "quote">foo</span>” may be found.
6982: “<span class="quote">foo</span>”
1.47 reed 6983: includes the suffix, e.g.:</p>
1.45 wiz 6984: <pre class="programlisting">
1.51 rillig 6985: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
6986: DISTFILES+= foo-file.tar.gz
1.69 rillig 6987: SITES_foo-file.tar.gz= \
6988: http://www.somewhere.com/somehow/ \
1.51 rillig 6989: http://www.somewhereelse.com/mirror/somehow/
1.45 wiz 6990: </pre>
6991: </li>
6992:
6993: <li>
6994: <p><code class="varname">DISTFILES</code>: Name(s)
6995: of archive file(s) containing distribution. The
6996: default is <code xmlns=
6997: "http://www.w3.org/TR/xhtml1/transitional" class=
6998: "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
6999: Should only be set if you have more than one
7000: distfile.</p>
7001:
7002: <p>Note that the normal default setting of
7003: <code class="varname">DISTFILES</code> must be made
7004: explicit if you want to add to it (rather than
7005: replace it), as you usually would.</p>
7006: </li>
7007:
7008: <li>
7009: <p><code class="varname">EXTRACT_SUFX</code>:
7010: Suffix of the distribution file, will be appended
7011: to <code class="varname">DISTNAME</code>. Defaults
7012: to <code xmlns=
7013: "http://www.w3.org/TR/xhtml1/transitional" class=
7014: "filename">.tar.gz</code>.</p>
7015: </li>
7016: </ul>
7017: </div>
7018:
7019: <p>The second section contains information about
7020: separately downloaded patches, if any.</p>
7021:
7022: <div class="itemizedlist">
7023: <ul type="disc">
7024: <li>
1.47 reed 7025: <p><code class="varname">PATCHFILES:</code> Name(s)
1.45 wiz 7026: of additional files that contain distribution
7027: patches. There is no default. pkgsrc will look for
7028: them at <code class="varname">PATCH_SITES</code>.
7029: They will automatically be uncompressed before
7030: patching if the names end with <code xmlns=
7031: "http://www.w3.org/TR/xhtml1/transitional" class=
7032: "filename">.gz</code> or <code xmlns=
7033: "http://www.w3.org/TR/xhtml1/transitional" class=
7034: "filename">.Z</code>.</p>
7035: </li>
7036:
7037: <li>
7038: <p><code class="varname">PATCH_SITES</code>:
7039: Primary location(s) for distribution patch files
7040: (see <code class="varname">PATCHFILES</code> below)
7041: if not found locally.</p>
1.25 rillig 7042: </li>
7043: </ul>
7044: </div>
7045:
1.45 wiz 7046: <p>The third section contains the following
1.27 rillig 7047: variables.</p>
1.25 rillig 7048:
1.27 rillig 7049: <div class="itemizedlist">
7050: <ul type="disc">
7051: <li>
7052: <p><code class="varname">MAINTAINER</code> is the
1.50 rillig 7053: email address of the person who feels responsible
7054: for this package, and who is most likely to look at
7055: problems or questions regarding this package which
7056: have been reported with <a href=
1.45 wiz 7057: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
7058: <span class="citerefentry"><span class=
1.50 rillig 7059: "refentrytitle">send-pr</span>(1)</span></a>. Other
7060: developers should contact the <code class=
7061: "varname">MAINTAINER</code> before making major
7062: changes to the package. When packaging a new
7063: program, set <code class=
7064: "varname">MAINTAINER</code> to yourself. If you
7065: really can't maintain the package for future
7066: updates, set it to <code class="email"><<a href=
1.45 wiz 7067: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.27 rillig 7068: </li>
1.25 rillig 7069:
1.27 rillig 7070: <li>
7071: <p><code class="varname">HOMEPAGE</code> is a URL
7072: where users can find more information about the
1.23 wiz 7073: package.</p>
7074: </li>
1.1 grant 7075:
1.23 wiz 7076: <li>
7077: <p><code class="varname">COMMENT</code> is a
1.45 wiz 7078: one-line description of the package (should not
7079: include the package name).</p>
1.23 wiz 7080: </li>
7081: </ul>
7082: </div>
1.1 grant 7083:
1.45 wiz 7084: <p>Other variables that affect the build:</p>
1.1 grant 7085:
1.45 wiz 7086: <div class="itemizedlist">
7087: <ul type="disc">
7088: <li>
7089: <p><code class="varname">WRKSRC</code>: The
1.50 rillig 7090: directory where the interesting distribution files
7091: of the package are found. The default is
7092: <code xmlns=
7093: "http://www.w3.org/TR/xhtml1/transitional" class=
7094: "filename">${WRKDIR}/${DISTNAME}</code>, which
7095: works for most packages.</p>
7096:
7097: <p>If a package doesn't create a subdirectory for
7098: itself (most GNU software does, for instance), but
7099: extracts itself in the current directory, you
7100: should set <code class="varname">WRKSRC=
7101: ${WRKDIR}</code>.</p>
7102:
7103: <p>If a package doesn't create a subdirectory with
7104: the name of <code class="varname">DISTNAME</code>
7105: but some different name, set <code class=
7106: "varname">WRKSRC</code> to point to the proper name
7107: in <code xmlns=
7108: "http://www.w3.org/TR/xhtml1/transitional" class=
7109: "filename">${WRKDIR}</code>, for example
7110: <code class="varname">WRKSRC=
7111: ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
7112: "http://www.w3.org/TR/xhtml1/transitional" href=
7113: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
7114: target="_top"><code xmlns="" class=
7115: "filename">lang/tcl</code></a> and <a xmlns=
7116: "http://www.w3.org/TR/xhtml1/transitional" href=
7117: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
7118: target="_top"><code xmlns="" class=
7119: "filename">x11/tk</code></a> for other
7120: examples.</p>
7121:
7122: <p>The name of the working directory created by
7123: pkgsrc is taken from the <code class=
7124: "varname">WRKDIR_BASENAME</code> variable. By
7125: default, its value is <code xmlns=
7126: "http://www.w3.org/TR/xhtml1/transitional" class=
7127: "filename">work</code>. If you want to use the same
7128: pkgsrc tree for building different kinds of binary
7129: packages, you can change the variable according to
7130: your needs. Two other variables handle common cases
7131: of setting <code class=
7132: "varname">WRKDIR_BASENAME</code> individually. If
7133: <code class="varname">OBJHOSTNAME</code> is defined
7134: in <code xmlns=
1.45 wiz 7135: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 7136: "filename">/etc/mk.conf</code>, the first component
7137: of the host's name is attached to the directory
7138: name. If <code class="varname">OBJMACHINE</code> is
7139: defined, the platform name is attached, which might
7140: look like <code xmlns=
7141: "http://www.w3.org/TR/xhtml1/transitional" class=
7142: "filename">work.i386</code> or <code xmlns=
1.45 wiz 7143: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 7144: "filename">work.sparc</code>.</p>
1.45 wiz 7145: </li>
7146: </ul>
1.1 grant 7147: </div>
7148:
7149: <p>Please pay attention to the following gotchas:</p>
7150:
7151: <div class="itemizedlist">
7152: <ul type="disc">
7153: <li>
1.14 xtraeme 7154: <p>Add <code class="varname">MANCOMPRESSED</code>
1.47 reed 7155: if man pages are installed in compressed form by
7156: the package; see comment in <code xmlns=
1.45 wiz 7157: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7158: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 7159: </li>
7160:
7161: <li>
1.45 wiz 7162: <p>Replace <code xmlns=
7163: "http://www.w3.org/TR/xhtml1/transitional" class=
7164: "filename">/usr/local</code> with
7165: “<span class="quote">${PREFIX}</span>”
7166: in all files (see patches, below).</p>
1.1 grant 7167: </li>
7168:
7169: <li>
7170: <p>If the package installs any info files, see
7171: <a href="#faq.info-files" title=
1.68 rillig 7172: "16.5.7. Packages installing info files">Section 16.5.7,
1.45 wiz 7173: “Packages installing info
1.1 grant 7174: files”</a>.</p>
7175: </li>
7176: </ul>
7177: </div>
7178: </div>
7179:
1.67 hubertf 7180: <div class="sect1" lang="en">
1.1 grant 7181: <div class="titlepage">
7182: <div>
7183: <div>
7184: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7185: "components.distinfo"></a>8.2. <code xmlns=
7186: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7187: "filename">distinfo</code></h2>
1.1 grant 7188: </div>
7189: </div>
7190: </div>
7191:
1.50 rillig 7192: <p>The <code xmlns=
7193: "http://www.w3.org/TR/xhtml1/transitional" class=
7194: "filename">distinfo</code> file contains the message
7195: digest, or checksum, of each distfile needed for the
7196: package. This ensures that the distfiles retrieved from
7197: the Internet have not been corrupted during transfer or
7198: altered by a malign force to introduce a security hole.
7199: Due to recent rumor about weaknesses of digest
7200: algorithms, all distfiles are protected using both SHA1
7201: and RMD160 message digests, as well as the file size.</p>
7202:
7203: <p>The <code xmlns=
7204: "http://www.w3.org/TR/xhtml1/transitional" class=
7205: "filename">distinfo</code> file also contains the
7206: checksums for all the patches found in the <code xmlns=
7207: "http://www.w3.org/TR/xhtml1/transitional" class=
7208: "filename">patches</code> directory (see <a href=
7209: "#components.patches" title=
7210: "8.3. patches/*">Section 8.3,
7211: “patches/*”</a>).</p>
7212:
7213: <p>To regenerate the <code xmlns=
7214: "http://www.w3.org/TR/xhtml1/transitional" class=
7215: "filename">distinfo</code> file, use the
1.14 xtraeme 7216: <span><strong class="command">make
1.50 rillig 7217: makedistinfo</strong></span> or <span><strong class=
7218: "command">make mdi</strong></span> command.</p>
1.1 grant 7219:
1.50 rillig 7220: <p>Some packages have different sets of distfiles
7221: depending on the platform, for example <a xmlns=
1.1 grant 7222: "http://www.w3.org/TR/xhtml1/transitional" href=
7223: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45 wiz 7224: target="_top"><code xmlns="" class=
7225: "filename">www/navigator</code></a>). These are kept in
1.50 rillig 7226: the same <code xmlns=
1.45 wiz 7227: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 7228: "filename">distinfo</code> file and care should be taken
7229: when upgrading such a package to ensure distfile
7230: information is not lost.</p>
1.1 grant 7231: </div>
7232:
1.67 hubertf 7233: <div class="sect1" lang="en">
1.1 grant 7234: <div class="titlepage">
7235: <div>
7236: <div>
7237: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7238: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 7239: </div>
7240: </div>
7241: </div>
7242:
7243: <p>This directory contains files that are used by the
7244: <a href=
7245: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
7246: <span class="citerefentry"><span class=
7247: "refentrytitle">patch</span>(1)</span></a> command to
7248: modify the sources as distributed in the distribution
7249: file into a form that will compile and run perfectly on
7250: NetBSD. The files are applied successively in alphabetic
7251: order (as returned by a shell “<span class=
7252: "quote">patches/patch-*</span>” glob expansion), so
1.45 wiz 7253: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7254: class="filename">patch-aa</code> is applied before
7255: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7256: class="filename">patch-ab</code>, etc.</p>
7257:
7258: <p>The <code xmlns=
7259: "http://www.w3.org/TR/xhtml1/transitional" class=
7260: "filename">patch-*</code> files should be in
7261: <span><strong class="command">diff -bu</strong></span>
7262: format, and apply without a fuzz to avoid problems. (To
7263: force patches to apply with fuzz you can set <code class=
1.14 xtraeme 7264: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 7265: not put changes for more than one file into a single
1.47 reed 7266: patch file, as this will make future modifications more
1.1 grant 7267: difficult.</p>
7268:
7269: <p>Similar, a file should be patched at most once, not
7270: several times by several different patches. If a file
7271: needs several patches, they should be combined into one
7272: file.</p>
7273:
7274: <p>One important thing to mention is to pay attention
7275: that no RCS IDs get stored in the patch files, as these
7276: will cause problems when later checked into the NetBSD
1.14 xtraeme 7277: CVS tree. Use the <span><strong class=
7278: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 7279: "http://www.w3.org/TR/xhtml1/transitional" href=
7280: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 7281: target="_top"><code xmlns="" class=
7282: "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20 ben 7283: these problems.</p>
1.1 grant 7284:
7285: <p>For even more automation, we recommend using
1.14 xtraeme 7286: <span><strong class="command">mkpatches</strong></span>
7287: from the same package to make a whole set of patches. You
7288: just have to backup files before you edit them to
1.45 wiz 7289: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7290: class="filename">filename.orig</code>, e.g. with
1.14 xtraeme 7291: <span><strong class="command">cp -p filename
7292: filename.orig</strong></span> or, easier, by using
7293: <span><strong class="command">pkgvi</strong></span> again
7294: from the same package. If you upgrade a package this way,
7295: you can easily compare the new set of patches with the
7296: previously existing one with <span><strong class=
7297: "command">patchdiff</strong></span>.</p>
1.1 grant 7298:
7299: <p>When you have finished a package, remember to generate
7300: the checksums for the patch files by using the
1.14 xtraeme 7301: <span><strong class="command">make
7302: makepatchsum</strong></span> command, see <a href=
7303: "#components.distinfo" title=
1.38 dillo 7304: "8.2. distinfo">Section 8.2,
1.45 wiz 7305: “<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7306: class="filename">distinfo</code>”</a>.</p>
1.1 grant 7307:
1.46 gdt 7308: <p>When adding a patch that corrects a problem in the
7309: distfile (rather than e.g. enforcing pkgsrc's view of
7310: where man pages should go), send the patch as a bug
7311: report to the maintainer. This benefits non-pkgsrc users
7312: of the package, and usually enables removing the patch in
7313: future version.</p>
7314:
1.1 grant 7315: <p>Patch files that are distributed by the author or
1.14 xtraeme 7316: other maintainers can be listed in <code class=
7317: "varname">$PATCHFILES</code>.</p>
1.1 grant 7318:
7319: <p>If it is desired to store any patches that should not
7320: be committed into pkgsrc, they can be kept outside the
1.45 wiz 7321: pkgsrc tree in the <code xmlns=
7322: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7323: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 7324: tree there is expected to have the same
7325: “<span class="quote">category/package</span>”
7326: structure as pkgsrc, and patches are expected to be
1.45 wiz 7327: stored inside these dirs (also known as <code xmlns=
7328: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 7329: "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
7330: if you want to keep a private patch for <code xmlns=
1.45 wiz 7331: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7332: "filename">pkgsrc/graphics/png</code>, keep it in
1.45 wiz 7333: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7334: class=
1.14 xtraeme 7335: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
7336: files in the named directory are expected to be patch
1.1 grant 7337: files, and <span class="emphasis"><em>they are applied
7338: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 7339: </div>
7340:
1.67 hubertf 7341: <div class="sect1" lang="en">
1.27 rillig 7342: <div class="titlepage">
7343: <div>
7344: <div>
7345: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7346: "other-mandatory-files"></a>8.4. Other
1.27 rillig 7347: mandatory files</h2>
7348: </div>
7349: </div>
7350: </div>
7351:
7352: <div class="variablelist">
7353: <dl>
1.45 wiz 7354: <dt><span class="term"><code xmlns=
7355: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7356: "filename">DESCR</code></span></dt>
7357:
7358: <dd>
7359: <p>A multi-line description of the piece of
7360: software. This should include any credits where
7361: they are due. Please bear in mind that others do
7362: not share your sense of humour (or spelling
7363: idiosyncrasies), and that others will read
7364: everything that you write here.</p>
7365: </dd>
7366:
1.45 wiz 7367: <dt><span class="term"><code xmlns=
7368: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7369: "filename">PLIST</code></span></dt>
7370:
7371: <dd>
7372: <p>This file governs the files that are installed
7373: on your system: all the binaries, manual pages,
7374: etc. There are other directives which may be
7375: entered in this file, to control the creation and
7376: deletion of directories, and the location of
7377: inserted files. See <a href="#plist" title=
1.38 dillo 7378: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 7379: <i>PLIST issues</i></a> for more information.</p>
7380: </dd>
7381: </dl>
7382: </div>
7383: </div>
7384:
1.67 hubertf 7385: <div class="sect1" lang="en">
1.27 rillig 7386: <div class="titlepage">
7387: <div>
7388: <div>
7389: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7390: "components.optional"></a>8.5. Optional
1.27 rillig 7391: files</h2>
7392: </div>
7393: </div>
7394: </div>
7395:
7396: <div class="variablelist">
7397: <dl>
1.45 wiz 7398: <dt><span class="term"><code xmlns=
7399: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7400: "filename">INSTALL</code></span></dt>
7401:
7402: <dd>
7403: <p>This shell script is invoked twice by <a href=
7404: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7405: <span class="citerefentry"><span class=
7406: "refentrytitle">pkg_add</span>(1)</span></a>. First
7407: time after package extraction and before files are
7408: moved in place, the second time after the files to
7409: install are moved in place. This can be used to do
7410: any custom procedures not possible with @exec
1.45 wiz 7411: commands in <code xmlns=
7412: "http://www.w3.org/TR/xhtml1/transitional" class=
7413: "filename">PLIST</code>. See <a href=
1.27 rillig 7414: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7415: <span class="citerefentry"><span class=
7416: "refentrytitle">pkg_add</span>(1)</span></a> and
7417: <a href=
7418: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7419: <span class="citerefentry"><span class=
7420: "refentrytitle">pkg_create</span>(1)</span></a> for
7421: more information.</p>
7422: </dd>
7423:
1.45 wiz 7424: <dt><span class="term"><code xmlns=
7425: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7426: "filename">DEINSTALL</code></span></dt>
7427:
7428: <dd>
7429: <p>This script is executed before and after any
7430: files are removed. It is this script's
7431: responsibility to clean up any additional messy
7432: details around the package's installation, since
7433: all pkg_delete knows is how to delete the files
7434: created in the original distribution. See <a href=
7435: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7436: <span class="citerefentry"><span class=
7437: "refentrytitle">pkg_delete</span>(1)</span></a> and
7438: <a href=
7439: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7440: <span class="citerefentry"><span class=
7441: "refentrytitle">pkg_create</span>(1)</span></a> for
7442: more information.</p>
7443: </dd>
7444:
1.45 wiz 7445: <dt><span class="term"><code xmlns=
7446: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7447: "filename">MESSAGE</code></span></dt>
7448:
7449: <dd>
1.50 rillig 7450: <p>This file is displayed after installation of the
1.27 rillig 7451: package. Useful for things like legal notices on
7452: almost-free software and hints for updating config
7453: files after installing modules for apache, PHP etc.
7454: Please note that you can modify variables in it
7455: easily by using <code class=
7456: "varname">MESSAGE_SUBST</code> in the package's
1.45 wiz 7457: <code xmlns=
7458: "http://www.w3.org/TR/xhtml1/transitional" class=
7459: "filename">Makefile</code>:</p>
1.27 rillig 7460: <pre class="programlisting">
1.51 rillig 7461: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.27 rillig 7462: </pre>
7463:
7464: <p>replaces "${SOMEVAR}" with “<span class=
1.45 wiz 7465: "quote">somevalue</span>” in <code xmlns=
7466: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7467: "filename">MESSAGE</code>.</p>
7468: </dd>
7469: </dl>
7470: </div>
7471: </div>
7472:
1.67 hubertf 7473: <div class="sect1" lang="en">
1.27 rillig 7474: <div class="titlepage">
7475: <div>
7476: <div>
7477: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 7478: "work-dir"></a>8.6. <code xmlns=
1.45 wiz 7479: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7480: "filename">work*</code></h2>
7481: </div>
7482: </div>
7483: </div>
7484:
7485: <p>When you type <span><strong class=
1.47 reed 7486: "command">make</strong></span>, the distribution files
7487: are unpacked into the directory denoted by <code class=
1.45 wiz 7488: "varname">WRKDIR</code>. It can be removed by running
7489: <span><strong class="command">make clean</strong></span>.
7490: Besides the sources, this directory is also used to keep
7491: various timestamp files. The directory gets <span class=
7492: "emphasis"><em>removed completely</em></span> on clean.
7493: The default is <code xmlns=
7494: "http://www.w3.org/TR/xhtml1/transitional" class=
7495: "filename">${.CURDIR}/work</code> or <code xmlns=
7496: "http://www.w3.org/TR/xhtml1/transitional" class=
7497: "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
7498: <code class="varname">OBJMACHINE</code> is set.</p>
1.27 rillig 7499: </div>
7500:
1.67 hubertf 7501: <div class="sect1" lang="en">
1.27 rillig 7502: <div class="titlepage">
7503: <div>
7504: <div>
7505: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7506: "files-dir"></a>8.7. <code xmlns=
7507: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7508: "filename">files/*</code></h2>
7509: </div>
7510: </div>
7511: </div>
7512:
7513: <p>If you have any files that you wish to be placed in
7514: the package prior to configuration or building, you could
7515: place these files here and use a “<span class=
7516: "quote">${CP}</span>” command in the
7517: “<span class="quote">pre-configure</span>”
7518: target to achieve this. Alternatively, you could simply
1.45 wiz 7519: diff the file against <code xmlns=
7520: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7521: "filename">/dev/null</code> and use the patch mechanism
7522: to manage the creation of this file.</p>
7523: </div>
7524: </div>
7525:
1.67 hubertf 7526: <div class="chapter" lang="en">
1.27 rillig 7527: <div class="titlepage">
7528: <div>
7529: <div>
1.67 hubertf 7530: <h2 class="title"><a name=
1.38 dillo 7531: "makefile"></a>Chapter 9. Programming in
1.45 wiz 7532: <code xmlns=
7533: "http://www.w3.org/TR/xhtml1/transitional" class=
7534: "filename">Makefile</code>s</h2>
1.27 rillig 7535: </div>
7536: </div>
7537: </div>
7538:
7539: <div class="toc">
7540: <p><b>Table of Contents</b></p>
7541:
7542: <dl>
7543: <dt><span class="sect1"><a href=
1.45 wiz 7544: "#makefile.variables">9.1. <code xmlns=
7545: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7546: "filename">Makefile</code> variables</a></span></dt>
7547:
7548: <dd>
7549: <dl>
7550: <dt><span class="sect2"><a href=
1.38 dillo 7551: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 7552: conventions</a></span></dt>
7553: </dl>
7554: </dd>
7555:
1.38 dillo 7556: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 7557: Code snippets</a></span></dt>
7558:
7559: <dd>
7560: <dl>
1.30 wiz 7561: <dt><span class="sect2"><a href=
1.38 dillo 7562: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 7563: list</a></span></dt>
1.27 rillig 7564:
1.30 wiz 7565: <dt><span class="sect2"><a href=
1.38 dillo 7566: "#converting-internal-to-external">9.2.2.
1.27 rillig 7567: Converting an internal list into an external
7568: list</a></span></dt>
7569:
1.30 wiz 7570: <dt><span class="sect2"><a href=
1.38 dillo 7571: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 7572: variables to a shell command</a></span></dt>
1.27 rillig 7573:
1.30 wiz 7574: <dt><span class="sect2"><a href=
1.38 dillo 7575: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 7576: guideline</a></span></dt>
1.27 rillig 7577:
1.30 wiz 7578: <dt><span class="sect2"><a href=
1.38 dillo 7579: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 7580: bug in BSD Make</a></span></dt>
1.27 rillig 7581: </dl>
7582: </dd>
7583: </dl>
7584: </div>
7585:
1.45 wiz 7586: <p>Pkgsrc consists of many <code xmlns=
7587: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7588: "filename">Makefile</code> fragments, each of which forms a
7589: well-defined part of the pkgsrc system. Using the <a href=
7590: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7591: <span class="citerefentry"><span class=
7592: "refentrytitle">make</span>(1)</span></a> system as a
7593: programming language for a big system like pkgsrc requires
7594: some discipline to keep the code correct and
7595: understandable.</p>
7596:
1.45 wiz 7597: <p>The basic ingredients for <code xmlns=
7598: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7599: "filename">Makefile</code> programming are variables (which
7600: are actually macros) and shell commands. Among these shell
7601: commands may even be more complex ones like <a href=
7602: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
7603: <span class="citerefentry"><span class=
7604: "refentrytitle">awk</span>(1)</span></a> programs. To make
7605: sure that every shell command runs as intended it is
7606: necessary to quote all variables correctly when they are
7607: used.</p>
7608:
7609: <p>This chapter describes some patterns, that appear quite
1.45 wiz 7610: often in <code xmlns=
7611: "http://www.w3.org/TR/xhtml1/transitional" class=
7612: "filename">Makefile</code>s, including the pitfalls that
7613: come along with them.</p>
1.27 rillig 7614:
1.67 hubertf 7615: <div class="sect1" lang="en">
1.27 rillig 7616: <div class="titlepage">
7617: <div>
7618: <div>
7619: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7620: "makefile.variables"></a>9.1. <code xmlns=
7621: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7622: "filename">Makefile</code> variables</h2>
7623: </div>
7624: </div>
7625: </div>
7626:
1.45 wiz 7627: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7628: class="filename">Makefile</code> variables contain
7629: strings that can be processed using the five operators
7630: ``='', ``+='', ``?='', ``:='', and ``!='', which are
7631: described in the <a href=
1.27 rillig 7632: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7633: <span class="citerefentry"><span class=
7634: "refentrytitle">make</span>(1)</span></a> man page.</p>
7635:
1.45 wiz 7636: <p>When a variable's value is parsed from a <code xmlns=
7637: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7638: "filename">Makefile</code>, the hash character ``#'' and
7639: the backslash character ``\'' are handled specially. If a
7640: backslash is followed by a newline, any whitespace
7641: immediately in front of the backslash, the backslash, the
7642: newline, and any whitespace immediately behind the
7643: newline are replaced with a single space. A backspace
7644: character and an immediately following hash character are
1.47 reed 7645: replaced with a single hash character. Otherwise, the
1.27 rillig 7646: backslash is passed as is. In a variable assignment, any
7647: hash character that is not preceded by a backslash starts
7648: a comment that continues upto the end of the logical
7649: line.</p>
7650:
7651: <p><span class="emphasis"><em>Note:</em></span> Because
7652: of this parsing algorithm the only way to create a
7653: variable consisting of a single backslash is using the
7654: ``!='' operator, for example: <code class=
7655: "varname">BACKSLASH!=echo "\\"</code>.</p>
7656:
7657: <p>So far for defining variables. The other thing you can
7658: do with variables is evaluating them. A variable is
7659: evaluated when it is part of the right side of the ``:=''
7660: or the ``!='' operator, or directly before executing a
7661: shell command which the variable is part of. In all other
1.47 reed 7662: cases, <a href=
1.27 rillig 7663: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7664: <span class="citerefentry"><span class=
7665: "refentrytitle">make</span>(1)</span></a> performs lazy
7666: evaluation, that is, variables are not evaluated until
7667: there's no other way. The ``modifiers'' mentioned in the
7668: man page also evaluate the variable.</p>
7669:
7670: <p>Some of the modifiers split the string into words and
7671: then operate on the words, others operate on the string
1.47 reed 7672: as a whole. When a string is split into words, it is
7673: split as you would expect it from <a href=
1.27 rillig 7674: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
7675: <span class="citerefentry"><span class=
7676: "refentrytitle">sh</span>(1)</span></a>.</p>
7677:
7678: <p>No rule without exception—the
7679: <span><strong class="command">.for</strong></span> loop
7680: does not follow the shell quoting rules but splits at
7681: sequences of whitespace.</p>
7682:
7683: <p>There are several types of variables that should be
7684: handled differently. Strings and two types of lists.</p>
7685:
7686: <div class="itemizedlist">
7687: <ul type="disc">
7688: <li>
7689: <p><span class="emphasis"><em>Strings</em></span>
1.47 reed 7690: can contain arbitrary characters. Nevertheless, you
1.27 rillig 7691: should restrict yourself to only using printable
7692: characters. Examples are <code class=
7693: "varname">PREFIX</code> and <code class=
7694: "varname">COMMENT</code>.</p>
7695: </li>
7696:
7697: <li>
7698: <p><span class="emphasis"><em>Internal
7699: lists</em></span> are lists that are never exported
7700: to any shell command. Their elements are separated
1.47 reed 7701: by whitespace. Therefore, the elements themselves
1.27 rillig 7702: cannot have embedded whitespace. Any other
7703: characters are allowed. Internal lists can be used
7704: in <span><strong class=
7705: "command">.for</strong></span> loops. Examples are
7706: <code class="varname">DEPENDS</code> and
7707: <code class="varname">BUILD_DEPENDS</code>.</p>
7708: </li>
7709:
7710: <li>
7711: <p><span class="emphasis"><em>External
7712: lists</em></span> are lists that may be exported to
7713: a shell command. Their elements can contain any
7714: characters, including whitespace. That's why they
7715: cannot be used in <span><strong class=
7716: "command">.for</strong></span> loops. Examples are
7717: <code class="varname">DISTFILES</code> and
7718: <code class="varname">MASTER_SITES</code>.</p>
7719: </li>
7720: </ul>
7721: </div>
7722:
1.67 hubertf 7723: <div class="sect2" lang="en">
1.27 rillig 7724: <div class="titlepage">
7725: <div>
7726: <div>
7727: <h3 class="title"><a name=
1.38 dillo 7728: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 7729: conventions</h3>
7730: </div>
7731: </div>
7732: </div>
7733:
7734: <div class="itemizedlist">
7735: <ul type="disc">
7736: <li>
7737: <p>All variable names starting with an underscore
7738: are reserved for use by the pkgsrc
7739: infrastructure. They shall not be used by package
1.45 wiz 7740: <code xmlns=
7741: "http://www.w3.org/TR/xhtml1/transitional" class=
7742: "filename">Makefile</code>s.</p>
1.27 rillig 7743: </li>
7744:
7745: <li>
7746: <p>In <span><strong class=
7747: "command">.for</strong></span> loops you should
7748: use lowercase variable names for the iteration
7749: variables.</p>
7750: </li>
7751:
7752: <li>
7753: <p>All list variables should have a ``plural''
7754: name, e.g. <code class=
7755: "varname">PKG_OPTIONS</code> or <code class=
7756: "varname">DISTFILES</code>.</p>
7757: </li>
7758: </ul>
7759: </div>
7760: </div>
7761: </div>
7762:
1.67 hubertf 7763: <div class="sect1" lang="en">
1.27 rillig 7764: <div class="titlepage">
7765: <div>
7766: <div>
7767: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7768: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 7769: </div>
7770: </div>
7771: </div>
7772:
7773: <p>This section presents you with some code snippets you
7774: should use in your own code. If you don't find anything
7775: appropriate here, you should test your code and add it
7776: here.</p>
7777:
1.67 hubertf 7778: <div class="sect2" lang="en">
1.27 rillig 7779: <div class="titlepage">
7780: <div>
7781: <div>
1.67 hubertf 7782: <h3 class="title"><a name=
1.38 dillo 7783: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 7784: a list</h3>
1.27 rillig 7785: </div>
7786: </div>
7787: </div>
7788: <pre class="programlisting">
1.51 rillig 7789: STRING= foo * bar `date`
7790: INT_LIST= # empty
7791: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
7792: EXT_LIST= # empty
7793: ANOTHER_EXT_LIST= a=b c=d
7794:
7795: INT_LIST+= ${STRING} # 1
7796: INT_LIST+= ${ANOTHER_INT_LIST} # 2
7797: EXT_LIST+= ${STRING:Q} # 3
7798: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
1.27 rillig 7799: </pre>
7800:
7801: <p>When you add a string to an external list (example
7802: 3), it must be quoted. In all other cases, you must not
7803: add a quoting level. You must not merge internal and
7804: external lists, unless you are sure that all entries
7805: are correctly interpreted in both lists.</p>
7806: </div>
7807:
1.67 hubertf 7808: <div class="sect2" lang="en">
1.27 rillig 7809: <div class="titlepage">
7810: <div>
7811: <div>
1.30 wiz 7812: <h3 class="title"><a name=
1.38 dillo 7813: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 7814: an internal list into an external list</h3>
1.27 rillig 7815: </div>
7816: </div>
7817: </div>
7818: <pre class="programlisting">
1.51 rillig 7819: EXT_LIST= # empty
7820: .for i in ${INT_LIST}
7821: EXT_LIST+= ${i:Q}""
7822: .endfor
1.27 rillig 7823: </pre>
7824:
7825: <p>This code converts the internal list <code class=
7826: "varname">INT_LIST</code> into the external list
7827: <code class="varname">EXT_LIST</code>. As the elements
7828: of an internal list are unquoted they must be quoted
7829: here. The reason for appending <code class=
7830: "varname">""</code> is explained below.</p>
7831: </div>
1.1 grant 7832:
1.67 hubertf 7833: <div class="sect2" lang="en">
1.27 rillig 7834: <div class="titlepage">
1.1 grant 7835: <div>
1.27 rillig 7836: <div>
1.30 wiz 7837: <h3 class="title"><a name=
1.38 dillo 7838: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 7839: variables to a shell command</h3>
1.27 rillig 7840: </div>
1.1 grant 7841: </div>
7842: </div>
1.27 rillig 7843: <pre class="programlisting">
1.51 rillig 7844: STRING= foo bar < > * `date` $$HOME ' "
7845: EXT_LIST= string=${STRING:Q} x=second\ item
1.27 rillig 7846:
1.51 rillig 7847: all:
7848: echo ${STRING} # 1
7849: echo "${STRING}" # 2
7850: echo "${STRING:Q}" # 3
7851: echo ${STRING:Q} # 4
7852: echo x${STRING:Q} | sed 1s,.,, # 5
7853: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27 rillig 7854: </pre>
7855:
7856: <p>Example 1 leads to a syntax error in the shell, as
7857: the characters are just copied.</p>
7858:
7859: <p>Example 2 leads to a syntax error too, and if you
7860: leave out the last " character from <code class=
7861: "varname">${STRING}</code>, <a href=
7862: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
7863: <span class="citerefentry"><span class=
7864: "refentrytitle">date</span>(1)</span></a> will be
7865: executed. The <code class="varname">$HOME</code> shell
7866: variable would be evaluated, too.</p>
7867:
7868: <p>Example 3 outputs each space character preceded by a
7869: backslash (or not), depending on the implementation of
7870: the <a href=
7871: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7872: <span class="citerefentry"><span class=
7873: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 7874:
1.27 rillig 7875: <p>Example 4 handles correctly every string that does
7876: not start with a dash. In that case, the result depends
7877: on the implementation of the <a href=
7878: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7879: <span class="citerefentry"><span class=
7880: "refentrytitle">echo</span>(1)</span></a> command. As
7881: long as you can guarantee that your input does not
1.47 reed 7882: start with a dash, this form is appropriate.</p>
1.1 grant 7883:
1.27 rillig 7884: <p>Example 5 handles even the case of a leading dash
7885: correctly.</p>
1.1 grant 7886:
1.27 rillig 7887: <p>The <code class="varname">EXT_LIST</code> does not
1.47 reed 7888: need to be quoted because the quoting has already been
1.27 rillig 7889: done when adding elements to the list.</p>
1.1 grant 7890:
1.27 rillig 7891: <p>As internal lists shall not be passed to the shell,
7892: there is no example for it.</p>
1.1 grant 7893: </div>
7894:
1.67 hubertf 7895: <div class="sect2" lang="en">
1.27 rillig 7896: <div class="titlepage">
1.1 grant 7897: <div>
1.27 rillig 7898: <div>
1.67 hubertf 7899: <h3 class="title"><a name=
1.38 dillo 7900: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 7901: guideline</h3>
7902: </div>
1.1 grant 7903: </div>
7904: </div>
7905:
1.27 rillig 7906: <p>There are many possible sources of wrongly quoted
7907: variables. This section lists some of the commonly
7908: known ones.</p>
1.1 grant 7909:
1.27 rillig 7910: <div class="itemizedlist">
7911: <ul type="disc">
7912: <li>
7913: <p>Whenever you use the value of a list, think
7914: about what happens to leading or trailing
7915: whitespace. If the list is a well-formed shell
1.47 reed 7916: expression, you can apply the <code class=
1.27 rillig 7917: "varname">:M*</code> modifier to strip leading
7918: and trailing whitespace from each word. The
7919: <code class="varname">:M</code> operator first
7920: splits its argument according to the rules of the
7921: shell, and then creates a new list consisting of
7922: all words that match the shell glob expression
7923: <code class="varname">*</code>, that is: all. One
7924: class of situations where this is needed is when
7925: adding a variable like <code class=
7926: "varname">CPPFLAGS</code> to <code class=
7927: "varname">CONFIGURE_ARGS</code>. If the configure
1.47 reed 7928: script invokes other configure scripts, it strips
1.27 rillig 7929: the leading and trailing whitespace from the
7930: variable and then passes it to the other
7931: configure scripts. But these configure scripts
7932: expect the (child) <code class=
7933: "varname">CPPFLAGS</code> variable to be the same
7934: as the parent <code class=
7935: "varname">CPPFLAGS</code>. That's why we better
7936: pass the <code class="varname">CPPFLAGS</code>
7937: value properly trimmed. And here is how we do
7938: it:</p>
7939: <pre class="programlisting">
1.51 rillig 7940: CPPFLAGS= # empty
7941: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
7942: CPPFLAGS+= ${MY_CPPFLAGS}
7943:
7944: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
7945:
7946: all:
7947: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
7948: echo x${CONFIGURE_ARGS}x # properly trimmed
1.27 rillig 7949: </pre>
7950: </li>
1.1 grant 7951:
1.27 rillig 7952: <li>
7953: <p>The example above contains one bug: The
7954: <code class="varname">${PREFIX}</code> is a
7955: properly quoted shell expression, but there is
7956: the C compiler after it, which also expects a
7957: properly quoted string (this time in C syntax).
7958: The version above is therefore only correct if
7959: <code class="varname">${PREFIX}</code> does not
7960: have embedded backslashes or double quotes. If
7961: you want to allow these, you have to add another
7962: layer of quoting to each variable that is used as
7963: a C string literal. You cannot use the
7964: <code class="varname">:Q</code> operator for it,
7965: as this operator only works for the shell.</p>
7966: </li>
1.1 grant 7967:
1.27 rillig 7968: <li>
1.47 reed 7969: <p>Whenever a variable can be empty, the
1.27 rillig 7970: <code class="varname">:Q</code> operator can have
7971: surprising results. Here are two completely
7972: different cases which can be solved with the same
7973: trick.</p>
7974: <pre class="programlisting">
1.51 rillig 7975: EMPTY= # empty
7976: empty_test:
7977: for i in a ${EMPTY:Q} c; do \
7978: echo "$$i"; \
7979: done
7980:
7981: for_test:
7982: .for i in a:\ a:\test.txt
7983: echo ${i:Q}
7984: echo "foo"
7985: .endfor
1.1 grant 7986: </pre>
7987:
1.27 rillig 7988: <p>The first example will only print two of the
7989: three lines we might have expected. This is
7990: because <code class="varname">${EMPTY:Q}</code>
7991: expands to the empty string, which the shell
7992: cannot see. The workaround is to write
7993: <code class="varname">${EMPTY:Q}""</code>. This
7994: pattern can be often found as <code class=
7995: "varname">${TEST} -z ${VAR:Q}</code> or as
7996: <code class="varname">${TEST} -f
7997: ${FNAME:Q}</code> (both of these are wrong).</p>
7998:
7999: <p>The second example will only print three lines
8000: instead of four. The first line looks like
8001: <code class="varname">a:\ echo foo</code>. This
8002: is because the backslash of the value
8003: <code class="varname">a:\</code> is interpreted
8004: as a line-continuation by <a href=
8005: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8006: <span class="citerefentry"><span class=
8007: "refentrytitle">make</span>(1)</span></a>, which
8008: makes the second line the arguments of the
8009: <a href=
8010: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
8011: <span class="citerefentry"><span class=
8012: "refentrytitle">echo</span>(1)</span></a> command
8013: from the first line. To avoid this, write
8014: <code class="varname">${i:Q}""</code>.</p>
8015: </li>
8016: </ul>
8017: </div>
1.1 grant 8018: </div>
8019:
1.67 hubertf 8020: <div class="sect2" lang="en">
1.27 rillig 8021: <div class="titlepage">
1.1 grant 8022: <div>
1.27 rillig 8023: <div>
1.30 wiz 8024: <h3 class="title"><a name=
1.38 dillo 8025: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 8026: for a bug in BSD Make</h3>
1.27 rillig 8027: </div>
1.1 grant 8028: </div>
8029: </div>
8030:
1.27 rillig 8031: <p>The pkgsrc bmake program does not handle the
8032: following assignment correctly. In case <code class=
8033: "varname">_othervar_</code> contains a ``-'' character,
8034: one of the closing braces is included in <code class=
8035: "varname">${VAR}</code> after this code executes.</p>
8036: <pre class="programlisting">
1.51 rillig 8037: VAR:= ${VAR:N${_othervar_:C/-//}}
1.1 grant 8038: </pre>
8039:
1.27 rillig 8040: <p>For a more complex code snippet and a workaround,
8041: see the package <a xmlns=
8042: "http://www.w3.org/TR/xhtml1/transitional" href=
8043: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45 wiz 8044: target="_top"><code xmlns="" class=
8045: "filename">regress/make-quoting</code></a>, testcase
1.27 rillig 8046: <code class="varname">bug1</code>.</p>
1.1 grant 8047: </div>
8048: </div>
8049: </div>
8050:
1.67 hubertf 8051: <div class="chapter" lang="en">
1.1 grant 8052: <div class="titlepage">
8053: <div>
8054: <div>
1.67 hubertf 8055: <h2 class="title"><a name=
1.38 dillo 8056: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 8057: </div>
8058: </div>
8059: </div>
8060:
8061: <div class="toc">
8062: <p><b>Table of Contents</b></p>
8063:
8064: <dl>
1.38 dillo 8065: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 8066: ID</a></span></dt>
8067:
1.30 wiz 8068: <dt><span class="sect1"><a href=
1.38 dillo 8069: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 8070: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8071: class="filename">PLIST</code>
1.14 xtraeme 8072: generation</a></span></dt>
1.1 grant 8073:
1.38 dillo 8074: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 8075: Tweaking output of <span><strong class="command">make
8076: print-PLIST</strong></span></a></span></dt>
1.1 grant 8077:
1.38 dillo 8078: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 8079: Variable substitution in PLIST</a></span></dt>
8080:
1.30 wiz 8081: <dt><span class="sect1"><a href=
1.48 dillo 8082: "#manpage-compression">10.5. Man page
8083: compression</a></span></dt>
1.1 grant 8084:
1.38 dillo 8085: <dt><span class="sect1"><a href=
8086: "#using-PLIST_SRC">10.6. Changing PLIST source with
8087: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 8088:
1.30 wiz 8089: <dt><span class="sect1"><a href=
1.47 reed 8090: "#platform-specific-plist">10.7. Platform-specific and
1.30 wiz 8091: differing PLISTs</a></span></dt>
1.1 grant 8092:
1.38 dillo 8093: <dt><span class="sect1"><a href=
8094: "#faq.common-dirs">10.8. Sharing directories between
8095: packages</a></span></dt>
1.1 grant 8096: </dl>
8097: </div>
8098:
1.45 wiz 8099: <p>The <code xmlns=
8100: "http://www.w3.org/TR/xhtml1/transitional" class=
8101: "filename">PLIST</code> file contains a package's
8102: “<span class="quote">packing list</span>”, i.e.
8103: a list of files that belong to the package (relative to the
8104: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8105: class="filename">${PREFIX}</code> directory it's been
8106: installed in) plus some additional statements - see the
8107: <a href=
1.1 grant 8108: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
8109: <span class="citerefentry"><span class=
1.47 reed 8110: "refentrytitle">pkg_create</span>(1)</span></a> man page
8111: for a full list. This chapter addresses some issues that
8112: need attention when dealing with the <code xmlns=
1.45 wiz 8113: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8114: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 8115:
1.67 hubertf 8116: <div class="sect1" lang="en">
1.1 grant 8117: <div class="titlepage">
8118: <div>
8119: <div>
8120: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 8121: "rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 8122: </div>
8123: </div>
8124: </div>
8125:
8126: <p>Be sure to add a RCS ID line as the first thing in any
1.45 wiz 8127: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8128: class="filename">PLIST</code> file you write:</p>
1.1 grant 8129: <pre class="programlisting">
1.51 rillig 8130: @comment $NetBSD$
1.1 grant 8131: </pre>
8132: </div>
8133:
1.67 hubertf 8134: <div class="sect1" lang="en">
1.1 grant 8135: <div class="titlepage">
8136: <div>
8137: <div>
8138: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8139: "automatic-plist-generation"></a>10.2. Semi-automatic
1.45 wiz 8140: <code xmlns=
8141: "http://www.w3.org/TR/xhtml1/transitional" class=
8142: "filename">PLIST</code> generation</h2>
1.1 grant 8143: </div>
8144: </div>
8145: </div>
8146:
1.14 xtraeme 8147: <p>You can use the <span><strong class="command">make
8148: print-PLIST</strong></span> command to output a PLIST
8149: that matches any new files since the package was
8150: extracted. See <a href="#build.helpful-targets" title=
1.56 rillig 8151: "14.16. Other helpful targets">Section 14.16,
1.1 grant 8152: “Other helpful targets”</a> for more
8153: information on this target.</p>
8154: </div>
8155:
1.67 hubertf 8156: <div class="sect1" lang="en">
1.1 grant 8157: <div class="titlepage">
8158: <div>
8159: <div>
8160: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8161: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 8162: <span><strong class="command">make
8163: print-PLIST</strong></span></h2>
1.1 grant 8164: </div>
8165: </div>
8166: </div>
8167:
8168: <p>If you have used any of the *-dirs packages, as
8169: explained in <a href="#faq.common-dirs" title=
1.38 dillo 8170: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 8171: “Sharing directories between packages”</a>,
1.14 xtraeme 8172: you may have noticed that <span><strong class=
8173: "command">make print-PLIST</strong></span> outputs a set
8174: of <code class="varname">@comment</code>s instead of real
8175: <code class="varname">@dirrm</code> lines. You can also
8176: do this for specific directories and files, so that the
8177: results of that command are very close to reality. This
8178: helps <span class="emphasis"><em>a lot</em></span> during
8179: the update of packages.</p>
8180:
8181: <p>The <code class="varname">PRINT_PLIST_AWK</code>
8182: variable takes a set of AWK patterns and actions that are
8183: used to filter the output of print-PLIST. You can
8184: <span class="emphasis"><em>append</em></span> any chunk
8185: of AWK scripting you like to it, but be careful with
1.1 grant 8186: quoting.</p>
8187:
1.45 wiz 8188: <p>For example, to get all files inside the <code xmlns=
8189: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8190: "filename">libdata/foo</code> directory removed from the
1.1 grant 8191: resulting PLIST:</p>
8192: <pre class="programlisting">
1.51 rillig 8193: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 grant 8194: </pre>
8195:
1.14 xtraeme 8196: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 8197: lines referring to a specific (shared) directory
1.14 xtraeme 8198: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 8199: <pre class="programlisting">
1.51 rillig 8200: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1 grant 8201: </pre>
8202: </div>
8203:
1.67 hubertf 8204: <div class="sect1" lang="en">
1.1 grant 8205: <div class="titlepage">
8206: <div>
8207: <div>
8208: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8209: "plist.misc"></a>10.4. Variable substitution
8210: in PLIST</h2>
1.1 grant 8211: </div>
8212: </div>
8213: </div>
8214:
8215: <p>A number of variables are substituted automatically in
8216: PLISTs when a package is installed on a system. This
8217: includes the following variables:</p>
8218:
8219: <div class="variablelist">
8220: <dl>
1.14 xtraeme 8221: <dt><span class="term"><code class=
8222: "varname">${MACHINE_ARCH}</code>, <code class=
8223: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 8224:
8225: <dd>
8226: <p>Some packages like emacs and perl embed
8227: information about which architecture they were
8228: built on into the pathnames where they install
1.47 reed 8229: their files. To handle this case, PLIST will be
1.1 grant 8230: preprocessed before actually used, and the symbol
1.14 xtraeme 8231: “<span class="quote"><code class=
8232: "varname">${MACHINE_ARCH}</code></span>” will
8233: be replaced by what <span><strong class=
8234: "command">uname -p</strong></span> gives. The same
8235: is done if the string <code class=
8236: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
8237: PLIST somewhere - use this on packages that have
1.47 reed 8238: GNU autoconf-created configure scripts.</p>
1.1 grant 8239:
8240: <div class="note" style=
8241: "margin-left: 0.5in; margin-right: 0.5in;">
8242: <h3 class="title">Legacy note</h3>
8243:
8244: <p>There used to be a symbol “<span class=
1.14 xtraeme 8245: "quote"><code class=
8246: "varname">$ARCH</code></span>” that was
8247: replaced by the output of <span><strong class=
8248: "command">uname -m</strong></span>, but that's no
1.1 grant 8249: longer supported and has been removed.</p>
8250: </div>
8251: </dd>
8252:
1.14 xtraeme 8253: <dt><span class="term"><code class=
8254: "varname">${OPSYS}</code>, <code class=
8255: "varname">${LOWER_OPSYS}</code>, <code class=
8256: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 8257:
8258: <dd>
8259: <p>Some packages want to embed the OS name and
8260: version into some paths. To do this, use these
1.45 wiz 8261: variables in the <code xmlns=
8262: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8263: "filename">PLIST</code>:</p>
1.1 grant 8264:
8265: <div class="itemizedlist">
8266: <ul type="disc">
8267: <li>
1.14 xtraeme 8268: <p><code class="varname">${OPSYS}</code> -
8269: output of “<span class=
8270: "quote"><span><strong class="command">uname
8271: -s</strong></span></span>”</p>
1.1 grant 8272: </li>
8273:
8274: <li>
1.14 xtraeme 8275: <p><code class=
8276: "varname">${LOWER_OPSYS}</code> - lowercase
8277: common name (eg. “<span class=
8278: "quote">solaris</span>”)</p>
1.1 grant 8279: </li>
8280:
8281: <li>
1.14 xtraeme 8282: <p><code class="varname">${OS_VERSION}</code>
8283: - “<span class=
8284: "quote"><span><strong class="command">uname
8285: -r</strong></span></span>”</p>
1.1 grant 8286: </li>
8287: </ul>
8288: </div>
8289: </dd>
8290:
1.14 xtraeme 8291: <dt><span class="term"><code class=
8292: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 8293:
8294: <dd>
8295: <p>Packages that install locale files should list
8296: them in the PLIST as “<span class=
8297: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
8298: instead of “<span class=
8299: "quote">share/locale/de/LC_MESSAGES/...</span>”.
8300: This properly handles the fact that different
8301: operating systems expect locale files to be either
1.45 wiz 8302: in <code xmlns=
8303: "http://www.w3.org/TR/xhtml1/transitional" class=
8304: "filename">share</code> or <code xmlns=
8305: "http://www.w3.org/TR/xhtml1/transitional" class=
8306: "filename">lib</code> by default.</p>
1.1 grant 8307: </dd>
8308: </dl>
8309: </div>
8310:
8311: <p>For a complete list of values which are replaced by
1.45 wiz 8312: default, please look in <code xmlns=
8313: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8314: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 8315: "emphasis"><em>PLIST_SUBST</em></span>).</p>
8316:
8317: <p>If you want to change other variables not listed
8318: above, you can add variables and their expansions to this
1.14 xtraeme 8319: variable in the following way, similar to <code class=
8320: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 8321: "#components.optional" title=
1.38 dillo 8322: "8.5. Optional files">Section 8.5,
1.1 grant 8323: “Optional files”</a>):</p>
8324: <pre class="programlisting">
1.51 rillig 8325: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 grant 8326: </pre>
8327:
8328: <p>This replaces all occurrences of “<span class=
8329: "quote">${SOMEVAR}</span>” in the PLIST with
8330: “<span class="quote">somevalue</span>”.</p>
8331: </div>
8332:
1.67 hubertf 8333: <div class="sect1" lang="en">
1.1 grant 8334: <div class="titlepage">
8335: <div>
8336: <div>
8337: <h2 class="title" style="clear: both"><a name=
1.48 dillo 8338: "manpage-compression"></a>10.5. Man page
8339: compression</h2>
1.1 grant 8340: </div>
8341: </div>
8342: </div>
8343:
1.47 reed 8344: <p>Man pages should be installed in compressed form if
1.45 wiz 8345: <code class="varname">MANZ</code> is set (in <code xmlns=
8346: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8347: "filename">bsd.own.mk</code>), and uncompressed
1.45 wiz 8348: otherwise. To handle this in the <code xmlns=
8349: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8350: "filename">PLIST</code> file, the suffix
8351: “<span class="quote">.gz</span>” is
1.47 reed 8352: appended/removed automatically for man pages according to
1.14 xtraeme 8353: <code class="varname">MANZ</code> and <code class=
8354: "varname">MANCOMPRESSED</code> being set or not, see
1.45 wiz 8355: above for details. This modification of the <code xmlns=
8356: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8357: "filename">PLIST</code> file is done on a copy of it, not
1.45 wiz 8358: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8359: class="filename">PLIST</code> itself.</p>
1.1 grant 8360: </div>
8361:
1.67 hubertf 8362: <div class="sect1" lang="en">
1.1 grant 8363: <div class="titlepage">
8364: <div>
8365: <div>
8366: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8367: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 8368: source with <code class=
1.14 xtraeme 8369: "varname">PLIST_SRC</code></h2>
1.1 grant 8370: </div>
8371: </div>
8372: </div>
8373:
1.14 xtraeme 8374: <p>To use one or more files as source for the
1.45 wiz 8375: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8376: class="filename">PLIST</code> used in generating the
8377: binary package, set the variable <code class=
1.14 xtraeme 8378: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 8379: The files are later concatenated using <a href=
8380: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
8381: <span class="citerefentry"><span class=
8382: "refentrytitle">cat</span>(1)</span></a>, and order of
8383: things is important.</p>
1.1 grant 8384: </div>
8385:
1.67 hubertf 8386: <div class="sect1" lang="en">
1.1 grant 8387: <div class="titlepage">
8388: <div>
8389: <div>
8390: <h2 class="title" style="clear: both"><a name=
1.47 reed 8391: "platform-specific-plist"></a>10.7. Platform-specific
8392: and differing PLISTs</h2>
1.1 grant 8393: </div>
8394: </div>
8395: </div>
8396:
8397: <p>Some packages decide to install a different set of
8398: files based on the operating system being used. These
8399: differences can be automatically handled by using the
8400: following files:</p>
8401:
8402: <div class="itemizedlist">
8403: <ul type="disc">
8404: <li>
1.45 wiz 8405: <p><code xmlns=
8406: "http://www.w3.org/TR/xhtml1/transitional" class=
8407: "filename">PLIST.common</code></p>
1.1 grant 8408: </li>
8409:
8410: <li>
1.45 wiz 8411: <p><code xmlns=
8412: "http://www.w3.org/TR/xhtml1/transitional" class=
8413: "filename">PLIST.${OPSYS}</code></p>
1.1 grant 8414: </li>
8415:
8416: <li>
1.45 wiz 8417: <p><code xmlns=
8418: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 8419: "filename">PLIST.${MACHINE_ARCH}</code></p>
8420: </li>
8421:
8422: <li>
1.45 wiz 8423: <p><code xmlns=
8424: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 8425: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
8426: </li>
8427:
8428: <li>
1.45 wiz 8429: <p><code xmlns=
8430: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8431: "filename">PLIST.common_end</code></p>
1.1 grant 8432: </li>
8433: </ul>
8434: </div>
8435: </div>
8436:
1.67 hubertf 8437: <div class="sect1" lang="en">
1.1 grant 8438: <div class="titlepage">
8439: <div>
8440: <div>
8441: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8442: "faq.common-dirs"></a>10.8. Sharing
8443: directories between packages</h2>
1.1 grant 8444: </div>
8445: </div>
8446: </div>
8447:
8448: <p>A “<span class="quote">shared
8449: directory</span>” is a directory where multiple
8450: (and unrelated) packages install files. These directories
8451: are problematic because you have to add special tricks in
8452: the PLIST to conditionally remove them, or have some
8453: centralized package handle them.</p>
8454:
8455: <p>Within pkgsrc, you'll find both approaches. If a
8456: directory is shared by a few unrelated packages, it's
8457: often not worth to add an extra package to remove it.
8458: Therefore, one simply does:</p>
8459: <pre class="programlisting">
1.51 rillig 8460: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
1.1 grant 8461: </pre>
8462:
8463: <p>in the PLISTs of all affected packages, instead of the
8464: regular "@dirrm" line.</p>
8465:
8466: <p>However, if the directory is shared across many
8467: packages, two different solutions are available:</p>
8468:
8469: <div class="orderedlist">
8470: <ol type="1">
8471: <li>
8472: <p>If the packages have a common dependency, the
8473: directory can be removed in that. For example, see
8474: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8475: href=
8476: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45 wiz 8477: target="_top"><code xmlns="" class=
8478: "filename">textproc/scrollkeeper</code></a>, which
8479: removes the shared directory <code xmlns=
8480: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 8481: "filename">share/omf</code>.</p>
1.1 grant 8482: </li>
8483:
8484: <li>
8485: <p>If the packages using the directory are not
8486: related at all (they have no common dependencies),
8487: a *-dirs package is used.</p>
8488: </li>
8489: </ol>
8490: </div>
8491:
8492: <p>From now on, we'll discuss the second solution. To get
8493: an idea of the *-dirs packages available, issue:</p>
8494: <pre class="programlisting">
1.51 rillig 8495: <code class="prompt">%</code> cd .../pkgsrc
8496: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 8497: </pre>
8498:
8499: <p>Their use from other packages is very simple. The
1.14 xtraeme 8500: <code class="varname">USE_DIRS</code> variable takes a
8501: list of package names (without the “<span class=
1.1 grant 8502: "quote">-dirs</span>” part) together with the
8503: required version number (always pick the latest one when
1.34 wiz 8504: writing new packages).</p>
1.1 grant 8505:
8506: <p>For example, if a package installs files under
1.45 wiz 8507: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8508: class="filename">share/applications</code>, it should
8509: have the following line in it:</p>
1.1 grant 8510: <pre class="programlisting">
1.51 rillig 8511: USE_DIRS+= xdg-1.1
1.1 grant 8512: </pre>
8513:
1.14 xtraeme 8514: <p>After regenerating the PLIST using
8515: <span><strong class="command">make
8516: print-PLIST</strong></span>, you should get the right
8517: (commented out) lines.</p>
1.1 grant 8518:
1.47 reed 8519: <p>Note that even if your package is using <code xmlns=
1.45 wiz 8520: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8521: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 8522: *-x11-dirs packages. Just specify the name without that
1.45 wiz 8523: part and pkgsrc (in particular, <code xmlns=
8524: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8525: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 8526: </div>
8527: </div>
8528:
1.67 hubertf 8529: <div class="chapter" lang="en">
1.1 grant 8530: <div class="titlepage">
8531: <div>
8532: <div>
1.67 hubertf 8533: <h2 class="title"><a name=
1.38 dillo 8534: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 8535: methodology</h2>
8536: </div>
8537: </div>
8538: </div>
8539:
8540: <div class="toc">
8541: <p><b>Table of Contents</b></p>
8542:
8543: <dl>
1.30 wiz 8544: <dt><span class="sect1"><a href=
1.38 dillo 8545: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 8546: to use buildlink3</a></span></dt>
1.1 grant 8547:
1.30 wiz 8548: <dt><span class="sect1"><a href=
1.45 wiz 8549: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
8550: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8551: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 8552:
8553: <dd>
8554: <dl>
1.25 rillig 8555: <dt><span class="sect2"><a href=
1.38 dillo 8556: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 8557: buildlink3.mk file</a></span></dt>
1.1 grant 8558:
1.25 rillig 8559: <dt><span class="sect2"><a href=
1.38 dillo 8560: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 8561: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 8562: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 8563: <code xmlns=
8564: "http://www.w3.org/TR/xhtml1/transitional" class=
8565: "filename">buildlink3.mk</code>
1.1 grant 8566: files</a></span></dt>
8567: </dl>
8568: </dd>
8569:
1.30 wiz 8570: <dt><span class="sect1"><a href=
1.45 wiz 8571: "#writing-builtin.mk">11.3. Writing <code xmlns=
8572: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8573: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 8574:
8575: <dd>
8576: <dl>
1.25 rillig 8577: <dt><span class="sect2"><a href=
1.38 dillo 8578: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 8579: <code xmlns=
8580: "http://www.w3.org/TR/xhtml1/transitional" class=
8581: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 8582:
1.25 rillig 8583: <dt><span class="sect2"><a href=
1.38 dillo 8584: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 8585: preferences for native or pkgsrc
8586: software</a></span></dt>
1.1 grant 8587: </dl>
8588: </dd>
8589: </dl>
8590: </div>
8591:
8592: <p>Buildlink is a framework in pkgsrc that controls what
8593: headers and libraries are seen by a package's configure and
8594: build processes. This is implemented in a two step
8595: process:</p>
8596:
8597: <div class="orderedlist">
8598: <ol type="1">
8599: <li>
8600: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 8601: into <code class="varname">BUILDLINK_DIR</code>,
8602: which by default is a subdirectory of <code class=
8603: "varname">WRKDIR</code>.</p>
1.1 grant 8604: </li>
8605:
8606: <li>
8607: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 8608: the normal compiler tools that translate <code class=
8609: "option">-I${LOCALBASE}/include</code> and
8610: <code class="option">-L${LOCALBASE}/lib</code> into
8611: references to <code class=
8612: "varname">BUILDLINK_DIR</code>. The wrapper scripts
8613: also make native compiler on some operating systems
8614: look like GCC, so that packages that expect GCC won't
8615: require modifications to build with those native
8616: compilers.</p>
1.1 grant 8617: </li>
8618: </ol>
8619: </div>
8620:
8621: <p>This normalizes the environment in which a package is
8622: built so that the package may be built consistently despite
8623: what other software may be installed. Please note that the
1.45 wiz 8624: normal system header and library paths, e.g. <code xmlns=
8625: "http://www.w3.org/TR/xhtml1/transitional" class=
8626: "filename">/usr/include</code>, <code xmlns=
8627: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8628: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 8629: buildlink3 is designed to insulate the package build from
8630: non-system-supplied software.</p>
8631:
1.67 hubertf 8632: <div class="sect1" lang="en">
1.1 grant 8633: <div class="titlepage">
8634: <div>
8635: <div>
8636: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8637: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 8638: packages to use buildlink3</h2>
1.1 grant 8639: </div>
8640: </div>
8641: </div>
8642:
8643: <p>The process of converting packages to use the
8644: buildlink3 framework (“<span class=
8645: "quote">bl3ifying</span>”) is fairly
8646: straightforward. The things to keep in mind are:</p>
8647:
8648: <div class="orderedlist">
8649: <ol type="1">
8650: <li>
8651: <p>Ensure that the build always calls the wrapper
8652: scripts instead of the actual toolchain. Some
8653: packages are tricky, and the only way to know for
1.45 wiz 8654: sure is the check <code xmlns=
8655: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8656: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 8657: wrappers are being invoked.</p>
8658: </li>
8659:
8660: <li>
1.14 xtraeme 8661: <p>Don't override <code class=
8662: "varname">PREFIX</code> from within the package
8663: Makefile, e.g. Java VMs, standalone shells, etc.,
1.45 wiz 8664: because the code to symlink files into <code xmlns=
8665: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8666: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 8667: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 8668: <em class=
8669: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 8670: </li>
8671:
8672: <li>
8673: <p>Remember that <span class=
1.45 wiz 8674: "emphasis"><em>only</em></span> the <code xmlns=
8675: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8676: "filename">buildlink3.mk</code> files that you list
1.1 grant 8677: in a package's Makefile are added as dependencies
8678: for that package.</p>
8679: </li>
8680: </ol>
8681: </div>
8682:
8683: <p>If a dependency on a particular package is required
8684: for its libraries and headers, then we replace:</p>
8685: <pre class="programlisting">
1.51 rillig 8686: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 8687: </pre>
8688:
8689: <p>with</p>
8690: <pre class="programlisting">
1.51 rillig 8691: .include "../../category/foo/buildlink3.mk"
1.1 grant 8692: </pre>
8693:
1.47 reed 8694: <p>The buildlink3.mk files usually define the required
8695: dependencies. If you need a newer version of the
8696: dependency when using buildlink3.mk files, then you can
8697: define it in your Makefile; for example:</p>
8698: <pre class="programlisting">
1.51 rillig 8699: BUILDLINK_DEPENDS.foo+= foo>=1.1.0
8700: .include "../../category/foo/buildlink3.mk"
1.47 reed 8701: </pre>
8702:
1.45 wiz 8703: <p>There are several <code xmlns=
8704: "http://www.w3.org/TR/xhtml1/transitional" class=
8705: "filename">buildlink3.mk</code> files in <code xmlns=
8706: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8707: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 8708: issues:</p>
8709:
8710: <div class="itemizedlist">
8711: <ul type="disc">
8712: <li>
1.45 wiz 8713: <p><code xmlns=
8714: "http://www.w3.org/TR/xhtml1/transitional" class=
8715: "filename">bdb.buildlink3.mk</code> chooses either
8716: the native or a pkgsrc Berkeley DB implementation
8717: based on the values of <code class=
1.14 xtraeme 8718: "varname">BDB_ACCEPTED</code> and <code class=
8719: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 8720: </li>
8721:
8722: <li>
1.45 wiz 8723: <p><code xmlns=
8724: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 8725: "filename">curses.buildlink3.mk</code>: If the
1.14 xtraeme 8726: system comes with neither Curses nor NCurses, this
8727: will take care to install the <a xmlns=
8728: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 8729: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45 wiz 8730: target="_top"><code xmlns="" class=
8731: "filename">devel/ncurses</code></a> package.</p>
1.1 grant 8732: </li>
8733:
8734: <li>
1.45 wiz 8735: <p><code xmlns=
8736: "http://www.w3.org/TR/xhtml1/transitional" class=
8737: "filename">krb5.buildlink3.mk</code> uses the value
8738: of <code class="varname">KRB5_ACCEPTED</code> to
8739: choose between adding a dependency on Heimdal or
8740: MIT-krb5 for packages that require a Kerberos 5
1.1 grant 8741: implementation.</p>
8742: </li>
8743:
8744: <li>
1.45 wiz 8745: <p><code xmlns=
8746: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8747: "filename">motif.buildlink3.mk</code> checks for a
8748: system-provided Motif installation or adds a
8749: dependency on <a xmlns=
1.1 grant 8750: "http://www.w3.org/TR/xhtml1/transitional" href=
8751: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45 wiz 8752: target="_top"><code xmlns="" class=
8753: "filename">x11/lesstif</code></a> or <a xmlns=
1.20 ben 8754: "http://www.w3.org/TR/xhtml1/transitional" href=
8755: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45 wiz 8756: target="_top"><code xmlns="" class=
1.47 reed 8757: "filename">x11/openmotif</code></a>.</p>
1.1 grant 8758: </li>
8759:
8760: <li>
1.45 wiz 8761: <p><code xmlns=
8762: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8763: "filename">ossaudio.buildlink3.mk</code> defines
8764: several variables that may be used by packages that
1.47 reed 8765: use the Open Sound System (OSS) API.</p>
1.1 grant 8766: </li>
8767:
8768: <li>
1.45 wiz 8769: <p><code xmlns=
8770: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8771: "filename">pgsql.buildlink3.mk</code> will accept
8772: either Postgres 7.3 or 7.4, whichever is found
8773: installed. See the file for more information.</p>
1.1 grant 8774: </li>
8775:
8776: <li>
1.45 wiz 8777: <p><code xmlns=
8778: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8779: "filename">pthread.buildlink3.mk</code> uses the
8780: value of <code class="varname">PTHREAD_OPTS</code>
8781: and checks for native pthreads or adds a dependency
8782: on <a xmlns=
1.1 grant 8783: "http://www.w3.org/TR/xhtml1/transitional" href=
8784: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45 wiz 8785: target="_top"><code xmlns="" class=
1.47 reed 8786: "filename">devel/pth</code></a> as needed.</p>
1.1 grant 8787: </li>
8788:
8789: <li>
1.45 wiz 8790: <p><code xmlns=
8791: "http://www.w3.org/TR/xhtml1/transitional" class=
8792: "filename">xaw.buildlink3.mk</code> uses the value
8793: of <code class="varname">XAW_TYPE</code> to choose
8794: a particular Athena widgets library.</p>
1.1 grant 8795: </li>
8796: </ul>
8797: </div>
8798:
1.45 wiz 8799: <p>The comments in those <code xmlns=
8800: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8801: "filename">buildlink3.mk</code> files provide a more
1.1 grant 8802: complete description of how to use them properly.</p>
8803: </div>
8804:
1.67 hubertf 8805: <div class="sect1" lang="en">
1.1 grant 8806: <div class="titlepage">
8807: <div>
8808: <div>
8809: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8810: "creating-buildlink3.mk"></a>11.2. Writing
1.45 wiz 8811: <code xmlns=
8812: "http://www.w3.org/TR/xhtml1/transitional" class=
8813: "filename">buildlink3.mk</code> files</h2>
1.1 grant 8814: </div>
8815: </div>
8816: </div>
8817:
1.45 wiz 8818: <p>A package's <code xmlns=
8819: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8820: "filename">buildlink3.mk</code> file is included by
8821: Makefiles to indicate the need to compile and link
8822: against header files and libraries provided by the
1.45 wiz 8823: package. A <code xmlns=
8824: "http://www.w3.org/TR/xhtml1/transitional" class=
8825: "filename">buildlink3.mk</code> file should always
8826: provide enough information to add the correct type of
8827: dependency relationship and include any other
8828: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8829: class="filename">buildlink3.mk</code> files that it needs
8830: to find headers and libraries that it needs in turn.</p>
1.1 grant 8831:
1.45 wiz 8832: <p>To generate an initial <code xmlns=
8833: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8834: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 8835: Rene Hexel's <a xmlns=
8836: "http://www.w3.org/TR/xhtml1/transitional" href=
8837: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45 wiz 8838: target="_top"><code xmlns="" class=
8839: "filename">pkgtools/createbuildlink</code></a> package is
1.20 ben 8840: highly recommended. For most packages, the following
8841: command will generate a good starting point for
1.45 wiz 8842: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8843: class="filename">buildlink3.mk</code> files:</p>
1.1 grant 8844: <pre class="screen">
1.14 xtraeme 8845: <code class="prompt">%</code> <strong class=
8846: "userinput"><code>cd pkgsrc/<em class=
8847: "replaceable"><code>category</code></em>/<em class=
8848: "replaceable"><code>pkgdir</code></em>
8849: <code class=
1.49 rillig 8850: "prompt">%</code> createbuildlink >buildlink3.mk</code></strong>
1.1 grant 8851: </pre>
8852:
1.67 hubertf 8853: <div class="sect2" lang="en">
1.1 grant 8854: <div class="titlepage">
8855: <div>
8856: <div>
1.67 hubertf 8857: <h3 class="title"><a name=
8858: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 8859: buildlink3.mk file</h3>
1.1 grant 8860: </div>
8861: </div>
8862: </div>
8863:
1.45 wiz 8864: <p>The following real-life example <code xmlns=
8865: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8866: "filename">buildlink3.mk</code> is taken from
1.45 wiz 8867: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8868: class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 8869: <pre class="programlisting">
1.51 rillig 8870: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 8871:
1.51 rillig 8872: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
8873: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
1.1 grant 8874:
1.51 rillig 8875: .if !empty(BUILDLINK_DEPTH:M+)
8876: BUILDLINK_DEPENDS+= tiff
8877: .endif
1.1 grant 8878:
1.51 rillig 8879: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
8880: BUILDLINK_PACKAGES+= tiff
1.1 grant 8881:
1.51 rillig 8882: .if !empty(TIFF_BUILDLINK3_MK:M+)
8883: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
8884: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
8885: .endif # TIFF_BUILDLINK3_MK
1.1 grant 8886:
1.51 rillig 8887: .include "../../devel/zlib/buildlink3.mk"
8888: .include "../../graphics/jpeg/buildlink3.mk"
1.1 grant 8889:
1.51 rillig 8890: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
1.1 grant 8891: </pre>
8892:
1.14 xtraeme 8893: <p>The header and footer manipulate <code class=
8894: "varname">BUILDLINK_DEPTH</code>, which is common
1.45 wiz 8895: across all <code xmlns=
8896: "http://www.w3.org/TR/xhtml1/transitional" class=
8897: "filename">buildlink3.mk</code> files and is used to
8898: track at what depth we are including <code xmlns=
8899: "http://www.w3.org/TR/xhtml1/transitional" class=
8900: "filename">buildlink3.mk</code> files.</p>
1.1 grant 8901:
8902: <p>The first section controls if the dependency on
1.14 xtraeme 8903: <em class="replaceable"><code>pkg</code></em> is added.
8904: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 8905: global list of packages for which dependencies are
8906: added by buildlink3.</p>
8907:
8908: <p>The second section advises pkgsrc that the
1.45 wiz 8909: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8910: class="filename">buildlink3.mk</code> file for
1.14 xtraeme 8911: <em class="replaceable"><code>pkg</code></em> has been
8912: included at some point. <code class=
8913: "varname">BUILDLINK_PACKAGES</code> is the global list
1.45 wiz 8914: of packages for which <code xmlns=
8915: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8916: "filename">buildlink3.mk</code> files have been
8917: included. It must <span class=
8918: "emphasis"><em>always</em></span> be appended to within
1.45 wiz 8919: a <code xmlns=
8920: "http://www.w3.org/TR/xhtml1/transitional" class=
8921: "filename">buildlink3.mk</code> file.</p>
1.1 grant 8922:
8923: <p>The third section is protected from multiple
1.14 xtraeme 8924: inclusion and controls how the dependency on <em class=
8925: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 8926: important variables are set in the section:</p>
8927:
8928: <div class="itemizedlist">
8929: <ul type="disc">
8930: <li>
1.14 xtraeme 8931: <p><code class=
8932: "varname">BUILDLINK_DEPENDS.<em class=
8933: "replaceable"><code>pkg</code></em></code> is the
8934: actual dependency recorded in the installed
8935: package; this should always be set using
8936: <span><strong class="command">+=</strong></span>
8937: to ensure that we're appending to any
8938: pre-existing list of values. This variable should
8939: be set to the first version of the package that
8940: had the last change in the major number of a
8941: shared library or that had a major API
8942: change.</p>
1.1 grant 8943: </li>
8944:
8945: <li>
1.14 xtraeme 8946: <p><code class=
8947: "varname">BUILDLINK_PKGSRCDIR.<em class=
8948: "replaceable"><code>pkg</code></em></code> is the
8949: location of the <em class=
8950: "replaceable"><code>pkg</code></em> pkgsrc
1.47 reed 8951: directory.</p>
1.1 grant 8952: </li>
8953:
8954: <li>
1.14 xtraeme 8955: <p><code class=
8956: "varname">BUILDLINK_DEPMETHOD.<em class=
8957: "replaceable"><code>pkg</code></em></code> (not
8958: shown above) controls whether we use <code class=
8959: "varname">BUILD_DEPENDS</code> or <code class=
8960: "varname">DEPENDS</code> to add the dependency on
8961: <em class="replaceable"><code>pkg</code></em>.
8962: The build dependency is selected by setting
8963: <code class=
8964: "varname">BUILDLINK_DEPMETHOD.<em class=
8965: "replaceable"><code>pkg</code></em></code> to
1.1 grant 8966: “<span class="quote">build</span>”.
8967: By default, the full dependency is used.</p>
8968: </li>
8969:
8970: <li>
1.14 xtraeme 8971: <p><code class=
8972: "varname">BUILDLINK_INCDIRS.<em class=
8973: "replaceable"><code>pkg</code></em></code> and
8974: <code class=
1.67 hubertf 8975: "varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
8976: (not shown above) are lists of subdirectories of
8977: <code xmlns=
1.45 wiz 8978: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8979: "filename">${BUILDLINK_PREFIX.<em class=
8980: "replaceable"><code>pkg</code></em>}</code> to
8981: add to the header and library search paths. These
1.1 grant 8982: default to “<span class=
8983: "quote">include</span>” and
8984: “<span class="quote">lib</span>”
8985: respectively.</p>
8986: </li>
8987:
8988: <li>
1.14 xtraeme 8989: <p><code class=
8990: "varname">BUILDLINK_CPPFLAGS.<em class=
8991: "replaceable"><code>pkg</code></em></code> (not
8992: shown above) is the list of preprocessor flags to
8993: add to <code class="varname">CPPFLAGS</code>,
8994: which are passed on to the configure and build
8995: phases. The “<span class=
8996: "quote">-I</span>” option should be avoided
8997: and instead be handled using <code class=
8998: "varname">BUILDLINK_INCDIRS.<em class=
8999: "replaceable"><code>pkg</code></em></code> as
9000: above.</p>
1.1 grant 9001: </li>
9002: </ul>
9003: </div>
9004:
9005: <p>The following variables are all optionally defined
9006: within this second section (protected against multiple
9007: inclusion) and control which package files are
1.45 wiz 9008: symlinked into <code xmlns=
9009: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9010: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 9011: are transformed during the symlinking:</p>
9012:
9013: <div class="itemizedlist">
9014: <ul type="disc">
9015: <li>
1.14 xtraeme 9016: <p><code class=
9017: "varname">BUILDLINK_FILES.<em class=
9018: "replaceable"><code>pkg</code></em></code> (not
9019: shown above) is a shell glob pattern relative to
1.45 wiz 9020: <code xmlns=
9021: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9022: "filename">${BUILDLINK_PREFIX.<em class=
9023: "replaceable"><code>pkg</code></em>}</code> to be
1.45 wiz 9024: symlinked into <code xmlns=
9025: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9026: "filename">${BUILDLINK_DIR}</code>, e.g.
1.45 wiz 9027: <code xmlns=
9028: "http://www.w3.org/TR/xhtml1/transitional" class=
9029: "filename">include/*.h</code>.</p>
1.1 grant 9030: </li>
9031:
9032: <li>
1.14 xtraeme 9033: <p><code class=
9034: "varname">BUILDLINK_FILES_CMD.<em class=
9035: "replaceable"><code>pkg</code></em></code> (not
9036: shown above) is a shell pipeline that outputs to
1.45 wiz 9037: stdout a list of files relative to <code xmlns=
9038: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9039: "filename">${BUILDLINK_PREFIX.<em class=
9040: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 9041: resulting files are to be symlinked into
1.45 wiz 9042: <code xmlns=
9043: "http://www.w3.org/TR/xhtml1/transitional" class=
9044: "filename">${BUILDLINK_DIR}</code>. By default,
9045: this takes the <code xmlns=
9046: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9047: "filename">+CONTENTS</code> of a <em class=
9048: "replaceable"><code>pkg</code></em> and filters
9049: it through <code class=
9050: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
9051: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 9052: </li>
9053:
9054: <li>
1.14 xtraeme 9055: <p><code class=
9056: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
9057: "replaceable"><code>pkg</code></em></code> (not
9058: shown above) is a filter command that filters
1.45 wiz 9059: <code xmlns=
9060: "http://www.w3.org/TR/xhtml1/transitional" class=
9061: "filename">+CONTENTS</code> input into a list of
9062: files relative to <code xmlns=
9063: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9064: "filename">${BUILDLINK_PREFIX.<em class=
9065: "replaceable"><code>pkg</code></em>}</code> on
9066: stdout. By default for overwrite packages,
9067: <code class=
9068: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
9069: "replaceable"><code>pkg</code></em></code>
1.45 wiz 9070: outputs the contents of the <code xmlns=
9071: "http://www.w3.org/TR/xhtml1/transitional" class=
9072: "filename">include</code> and <code xmlns=
9073: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9074: "filename">lib</code> directories in the package
1.45 wiz 9075: <code xmlns=
9076: "http://www.w3.org/TR/xhtml1/transitional" class=
9077: "filename">+CONTENTS</code>, and for pkgviews
9078: packages, it outputs any libtool archives in
9079: <code xmlns=
9080: "http://www.w3.org/TR/xhtml1/transitional" class=
9081: "filename">lib</code> directories.</p>
1.1 grant 9082: </li>
9083:
9084: <li>
1.14 xtraeme 9085: <p><code class=
9086: "varname">BUILDLINK_TRANSFORM.<em class=
9087: "replaceable"><code>pkg</code></em></code> (not
9088: shown above) is a list of sed arguments used to
1.1 grant 9089: transform the name of the source filename into a
1.14 xtraeme 9090: destination filename, e.g. <span><strong class=
1.1 grant 9091: "command">-e
1.14 xtraeme 9092: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 9093: </li>
9094: </ul>
9095: </div>
9096:
1.45 wiz 9097: <p>The last section includes any <code xmlns=
9098: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9099: "filename">buildlink3.mk</code> needed for <em class=
9100: "replaceable"><code>pkg</code></em>'s library
1.45 wiz 9101: dependencies. Including these <code xmlns=
9102: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9103: "filename">buildlink3.mk</code> files means that the
9104: headers and libraries for these dependencies are also
1.45 wiz 9105: symlinked into <code xmlns=
9106: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9107: "filename">${BUILDLINK_DIR}</code> whenever the
9108: <em class="replaceable"><code>pkg</code></em>
1.45 wiz 9109: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9110: class="filename">buildlink3.mk</code> file is
1.14 xtraeme 9111: included.</p>
1.1 grant 9112: </div>
9113:
1.67 hubertf 9114: <div class="sect2" lang="en">
1.1 grant 9115: <div class="titlepage">
9116: <div>
9117: <div>
1.30 wiz 9118: <h3 class="title"><a name=
1.67 hubertf 9119: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 9120: <code class=
1.67 hubertf 9121: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
9122: in <code xmlns=
1.45 wiz 9123: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 9124: "filename">buildlink3.mk</code> files</h3>
1.1 grant 9125: </div>
9126: </div>
9127: </div>
9128:
9129: <p>There are two situations that require increasing the
1.14 xtraeme 9130: dependency listed in <code class=
9131: "varname">BUILDLINK_DEPENDS.<em class=
9132: "replaceable"><code>pkg</code></em></code> after a
9133: package update:</p>
1.1 grant 9134:
9135: <div class="orderedlist">
9136: <ol type="1">
9137: <li>
9138: <p>if the sonames (major number of the library
9139: version) of any installed shared libraries
1.47 reed 9140: change.</p>
1.1 grant 9141: </li>
9142:
9143: <li>
9144: <p>if the API or interface to the header files
9145: change.</p>
9146: </li>
9147: </ol>
9148: </div>
9149:
1.14 xtraeme 9150: <p>In these cases, <code class=
9151: "varname">BUILDLINK_DEPENDS.<em class=
9152: "replaceable"><code>pkg</code></em></code> should be
9153: adjusted to require at least the new package version.
9154: In some cases, the packages that depend on this new
9155: version may need their <code class=
9156: "varname">PKGREVISION</code>s increased and, if they
1.45 wiz 9157: have <code xmlns=
9158: "http://www.w3.org/TR/xhtml1/transitional" class=
9159: "filename">buildlink3.mk</code> files, their
9160: <code class="varname">BUILDLINK_DEPENDS.<em class=
9161: "replaceable"><code>pkg</code></em></code> adjusted,
9162: too. This is needed so that binary packages made using
9163: it will require the correct package dependency and not
9164: settle for an older one which will not contain the
9165: necessary shared libraries.</p>
1.1 grant 9166:
9167: <p>Please take careful consideration before adjusting
1.14 xtraeme 9168: <code class="varname">BUILDLINK_DEPENDS.<em class=
9169: "replaceable"><code>pkg</code></em></code> as we don't
9170: want to cause unneeded package deletions and rebuilds.
9171: In many cases, new versions of packages work just fine
9172: with older dependencies. See <a href="#dependencies"
1.67 hubertf 9173: title=
1.68 rillig 9174: "16.1.4. Handling dependencies">Section 16.1.4,
1.67 hubertf 9175: “Handling dependencies”</a> for more
9176: information about dependencies on other packages,
1.25 rillig 9177: including the <code class=
9178: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
9179: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 9180: </div>
9181: </div>
9182:
1.67 hubertf 9183: <div class="sect1" lang="en">
1.1 grant 9184: <div class="titlepage">
9185: <div>
9186: <div>
9187: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9188: "writing-builtin.mk"></a>11.3. Writing
1.45 wiz 9189: <code xmlns=
9190: "http://www.w3.org/TR/xhtml1/transitional" class=
9191: "filename">builtin.mk</code> files</h2>
1.1 grant 9192: </div>
9193: </div>
9194: </div>
9195:
9196: <p>Some packages in pkgsrc install headers and libraries
9197: that coincide with headers and libraries present in the
1.45 wiz 9198: base system. Aside from a <code xmlns=
9199: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9200: "filename">buildlink3.mk</code> file, these packages
1.45 wiz 9201: should also include a <code xmlns=
9202: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9203: "filename">builtin.mk</code> file that includes the
9204: necessary checks to decide whether using the built-in
9205: software or the pkgsrc software is appropriate.</p>
1.1 grant 9206:
9207: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 9208: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 9209:
9210: <div class="orderedlist">
9211: <ol type="1">
9212: <li>
1.14 xtraeme 9213: <p>It should set <code class=
9214: "varname">USE_BUILTIN.<em class=
9215: "replaceable"><code>pkg</code></em></code> to
9216: either “<span class="quote">yes</span>”
9217: or “<span class="quote">no</span>”
9218: after it is included.</p>
1.1 grant 9219: </li>
9220:
9221: <li>
9222: <p>It should <span class=
9223: "emphasis"><em>not</em></span> override any
1.14 xtraeme 9224: <code class="varname">USE_BUILTIN.<em class=
9225: "replaceable"><code>pkg</code></em></code> which is
1.45 wiz 9226: already set before the <code xmlns=
9227: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9228: "filename">builtin.mk</code> file is included.</p>
1.1 grant 9229: </li>
9230:
9231: <li>
9232: <p>It should be written to allow multiple
9233: inclusion. This is <span class=
9234: "emphasis"><em>very</em></span> important and takes
1.45 wiz 9235: careful attention to <code xmlns=
9236: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9237: "filename">Makefile</code> coding.</p>
1.1 grant 9238: </li>
9239: </ol>
9240: </div>
9241:
1.67 hubertf 9242: <div class="sect2" lang="en">
1.1 grant 9243: <div class="titlepage">
9244: <div>
9245: <div>
1.67 hubertf 9246: <h3 class="title"><a name=
1.38 dillo 9247: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.45 wiz 9248: of a <code xmlns=
9249: "http://www.w3.org/TR/xhtml1/transitional" class=
9250: "filename">builtin.mk</code> file</h3>
1.1 grant 9251: </div>
9252: </div>
9253: </div>
9254:
9255: <p>The following is the recommended template for
9256: builtin.mk files:</p>
9257: <pre class="programlisting">
1.51 rillig 9258: .if !defined(IS_BUILTIN.foo)
9259: #
9260: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
9261: # genuinely exists in the system or not.
9262: #
9263: IS_BUILTIN.foo?= no
9264:
9265: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
9266: # version can be determined.
9267: #
9268: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
9269: BUILTIN_PKG.foo?= foo-1.0
9270: . endif
9271: .endif # IS_BUILTIN.foo
9272:
9273: .if !defined(USE_BUILTIN.foo)
9274: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
9275: . if defined(BUILTIN_PKG.foo)
9276: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
9277: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
9278: USE_BUILTIN.foo!= \
9279: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
9280: ${ECHO} "yes"; \
9281: else \
9282: ${ECHO} "no"; \
9283: fi
9284: . endif
9285: . endfor
9286: . endif
9287: .endif # USE_BUILTIN.foo
9288:
9289: CHECK_BUILTIN.foo?= no
9290: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
9291: #
9292: # Here we place code that depends on whether USE_BUILTIN.foo is set to
9293: # "yes" or "no".
9294: #
9295: .endif # CHECK_BUILTIN.foo
1.1 grant 9296: </pre>
9297:
1.14 xtraeme 9298: <p>The first section sets <code class=
9299: "varname">IS_BUILTIN.<em class=
9300: "replaceable"><code>pkg</code></em></code> depending on
9301: if <em class="replaceable"><code>pkg</code></em> really
9302: exists in the base system. This should not be a base
9303: system software with similar functionality to
9304: <em class="replaceable"><code>pkg</code></em>; it
9305: should only be “<span class=
9306: "quote">yes</span>” if the actual package is
9307: included as part of the base system. This variable is
1.45 wiz 9308: only used internally within the <code xmlns=
9309: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9310: "filename">builtin.mk</code> file.</p>
9311:
9312: <p>The second section sets <code class=
9313: "varname">BUILTIN_PKG.<em class=
9314: "replaceable"><code>pkg</code></em></code> to the
9315: version of <em class=
9316: "replaceable"><code>pkg</code></em> in the base system
9317: if it exists (if <code class=
9318: "varname">IS_BUILTIN.<em class=
9319: "replaceable"><code>pkg</code></em></code> is
1.1 grant 9320: “<span class="quote">yes</span>”). This
1.14 xtraeme 9321: variable is only used internally within the
1.45 wiz 9322: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9323: class="filename">builtin.mk</code> file.</p>
1.1 grant 9324:
1.14 xtraeme 9325: <p>The third section sets <code class=
9326: "varname">USE_BUILTIN.<em class=
9327: "replaceable"><code>pkg</code></em></code> and is
9328: <span class="emphasis"><em>required</em></span> in all
1.45 wiz 9329: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9330: class="filename">builtin.mk</code> files. The code in
9331: this section must make the determination whether the
9332: built-in software is adequate to satisfy the
9333: dependencies listed in <code class=
1.14 xtraeme 9334: "varname">BUILDLINK_DEPENDS.<em class=
9335: "replaceable"><code>pkg</code></em></code>. This is
9336: typically done by comparing <code class=
9337: "varname">BUILTIN_PKG.<em class=
9338: "replaceable"><code>pkg</code></em></code> against each
9339: of the dependencies in <code class=
9340: "varname">BUILDLINK_DEPENDS.<em class=
9341: "replaceable"><code>pkg</code></em></code>.
9342: <code class="varname">USE_BUILTIN.<em class=
9343: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 9344: "emphasis"><em>must</em></span> be set to the correct
1.45 wiz 9345: value by the end of the <code xmlns=
9346: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9347: "filename">builtin.mk</code> file. Note that
9348: <code class="varname">USE_BUILTIN.<em class=
9349: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 9350: “<span class="quote">yes</span>” even if
1.14 xtraeme 9351: <code class="varname">IS_BUILTIN.<em class=
9352: "replaceable"><code>pkg</code></em></code> is
1.1 grant 9353: “<span class="quote">no</span>” because we
9354: may make the determination that the built-in version of
9355: the software is similar enough to be used as a
9356: replacement.</p>
9357:
1.14 xtraeme 9358: <p>The last section is guarded by <code class=
9359: "varname">CHECK_BUILTIN.<em class=
9360: "replaceable"><code>pkg</code></em></code>, and
9361: includes code that uses the value of <code class=
9362: "varname">USE_BUILTIN.<em class=
9363: "replaceable"><code>pkg</code></em></code> set in the
9364: previous section. This typically includes, e.g., adding
1.1 grant 9365: additional dependency restrictions and listing
1.45 wiz 9366: additional files to symlink into <code xmlns=
9367: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9368: "filename">${BUILDLINK_DIR}</code> (via <code class=
9369: "varname">BUILDLINK_FILES.<em class=
9370: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 9371: </div>
9372:
1.67 hubertf 9373: <div class="sect2" lang="en">
1.1 grant 9374: <div class="titlepage">
9375: <div>
9376: <div>
1.30 wiz 9377: <h3 class="title"><a name=
1.38 dillo 9378: "native-or-pkgsrc-preference"></a>11.3.2. Global
1.30 wiz 9379: preferences for native or pkgsrc software</h3>
1.1 grant 9380: </div>
9381: </div>
9382: </div>
9383:
9384: <p>When building packages, it's possible to choose
9385: whether to set a global preference for using either the
9386: built-in (native) version or the pkgsrc version of
9387: software to satisfy a dependency. This is controlled by
1.14 xtraeme 9388: setting <code class="varname">PREFER_PKGSRC</code> and
9389: <code class="varname">PREFER_NATIVE</code>. These
9390: variables take values of either “<span class=
1.1 grant 9391: "quote">yes</span>”, “<span class=
9392: "quote">no</span>”, or a list of packages.
1.14 xtraeme 9393: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
9394: to use the pkgsrc versions of software, while
9395: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
9396: to use the built-in versions. Preferences are
9397: determined by the most specific instance of the package
9398: in either <code class="varname">PREFER_PKGSRC</code> or
9399: <code class="varname">PREFER_NATIVE</code>. If a
9400: package is specified in neither or in both variables,
9401: then <code class="varname">PREFER_PKGSRC</code> has
9402: precedence over <code class=
9403: "varname">PREFER_NATIVE</code>. For example, to require
9404: using pkgsrc versions of software for all but the most
9405: basic bits on a NetBSD system, you can set:</p>
1.1 grant 9406: <pre class="programlisting">
1.51 rillig 9407: PREFER_PKGSRC= yes
9408: PREFER_NATIVE= getopt skey tcp_wrappers
1.1 grant 9409: </pre>
9410:
9411: <p>A package <span class=
1.45 wiz 9412: "emphasis"><em>must</em></span> have a <code xmlns=
9413: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9414: "filename">builtin.mk</code> file to be listed in
9415: <code class="varname">PREFER_NATIVE</code>, otherwise
9416: it is simply ignored in that list.</p>
1.1 grant 9417: </div>
9418: </div>
9419: </div>
9420:
1.67 hubertf 9421: <div class="chapter" lang="en">
1.1 grant 9422: <div class="titlepage">
9423: <div>
9424: <div>
1.67 hubertf 9425: <h2 class="title"><a name=
1.38 dillo 9426: "pkginstall"></a>Chapter 12. The pkginstall
1.35 jmmv 9427: framework</h2>
1.1 grant 9428: </div>
9429: </div>
9430: </div>
9431:
9432: <div class="toc">
9433: <p><b>Table of Contents</b></p>
9434:
9435: <dl>
1.30 wiz 9436: <dt><span class="sect1"><a href=
1.38 dillo 9437: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 9438: directories outside the installation
9439: prefix</a></span></dt>
9440:
9441: <dd>
9442: <dl>
9443: <dt><span class="sect2"><a href=
1.38 dillo 9444: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 9445: manipulation</a></span></dt>
9446:
9447: <dt><span class="sect2"><a href=
1.38 dillo 9448: "#files-outside-prefix">12.1.2. File
1.35 jmmv 9449: manipulation</a></span></dt>
9450: </dl>
9451: </dd>
9452:
1.38 dillo 9453: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 9454: Configuration files</a></span></dt>
9455:
9456: <dd>
9457: <dl>
9458: <dt><span class="sect2"><a href=
1.38 dillo 9459: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 9460: "varname">PKG_SYSCONFDIR</code> is
9461: set</a></span></dt>
9462:
9463: <dt><span class="sect2"><a href=
1.38 dillo 9464: "#conf-files-configure">12.2.2. Telling the
1.47 reed 9465: software where configuration files
1.35 jmmv 9466: are</a></span></dt>
9467:
9468: <dt><span class="sect2"><a href=
1.38 dillo 9469: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 9470: installations</a></span></dt>
9471:
9472: <dt><span class="sect2"><a href=
1.38 dillo 9473: "#conf-files-disable">12.2.4. Disabling handling of
1.35 jmmv 9474: configuration files</a></span></dt>
9475: </dl>
9476: </dd>
9477:
1.38 dillo 9478: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 9479: System startup scripts</a></span></dt>
9480:
9481: <dd>
9482: <dl>
9483: <dt><span class="sect2"><a href=
1.38 dillo 9484: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 9485: of system startup scripts</a></span></dt>
9486: </dl>
9487: </dd>
1.1 grant 9488:
1.30 wiz 9489: <dt><span class="sect1"><a href=
1.38 dillo 9490: "#users-and-groups">12.4. System users and
1.35 jmmv 9491: groups</a></span></dt>
9492:
1.38 dillo 9493: <dt><span class="sect1"><a href="#shells">12.5. System
1.35 jmmv 9494: shells</a></span></dt>
9495:
9496: <dd>
9497: <dl>
9498: <dt><span class="sect2"><a href=
1.65 hubertf 9499: "#shells-disable">12.5.1. Disabling shell
9500: registration</a></span></dt>
9501: </dl>
9502: </dd>
9503:
9504: <dt><span class="sect1"><a href="#fonts">12.6.
9505: Fonts</a></span></dt>
9506:
9507: <dd>
9508: <dl>
9509: <dt><span class="sect2"><a href=
9510: "#fonts-disable">12.6.1. Disabling automatic update
9511: of the fonts databases</a></span></dt>
1.35 jmmv 9512: </dl>
9513: </dd>
1.1 grant 9514: </dl>
9515: </div>
9516:
1.35 jmmv 9517: <p>This chapter describes the framework known as
9518: <code class="literal">pkginstall</code>, whose key features
9519: are:</p>
9520:
9521: <div class="itemizedlist">
9522: <ul type="disc">
9523: <li>
9524: <p>Generic installation and manipulation of
9525: directories and files outside the pkgsrc-handled
9526: tree, <code class="varname">LOCALBASE</code>.</p>
9527: </li>
9528:
9529: <li>
9530: <p>Automatic handling of configuration files during
9531: installation, provided that packages are correctly
9532: designed.</p>
9533: </li>
9534:
9535: <li>
9536: <p>Generation and installation of system startup
9537: scripts.</p>
9538: </li>
9539:
9540: <li>
9541: <p>Registration of system users and groups.</p>
9542: </li>
9543:
9544: <li>
9545: <p>Registration of system shells.</p>
9546: </li>
1.65 hubertf 9547:
9548: <li>
9549: <p>Automatic updating of fonts databases.</p>
9550: </li>
1.35 jmmv 9551: </ul>
9552: </div>
9553:
9554: <p>The following sections inspect each of the above points
1.65 hubertf 9555: in detail.</p>
1.35 jmmv 9556:
9557: <p>You may be thinking that many of the things described
9558: here could be easily done with simple code in the package's
9559: post-installation target (<code class=
9560: "literal">post-install</code>). <span class=
9561: "emphasis"><em>This is incorrect</em></span>, as the code
9562: in them is only executed when building from source.
9563: Machines using binary packages could not benefit from it at
9564: all (as the code itself could be unavailable). Therefore,
9565: the only way to achieve any of the items described above is
9566: by means of the installation scripts, which are
9567: automatically generated by pkginstall.</p>
1.1 grant 9568:
1.67 hubertf 9569: <div class="sect1" lang="en">
1.1 grant 9570: <div class="titlepage">
9571: <div>
9572: <div>
9573: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9574: "files-and-dirs-outside-prefix"></a>12.1. Files
9575: and directories outside the installation
9576: prefix</h2>
1.1 grant 9577: </div>
9578: </div>
9579: </div>
9580:
1.45 wiz 9581: <p>As you already know, the <code xmlns=
9582: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9583: "filename">PLIST</code> file holds a list of files and
9584: directories that belong to a package. The names used in
1.45 wiz 9585: it are relative to the installation prefix (<code xmlns=
9586: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9587: "filename">${PREFIX}</code>), which means that it cannot
9588: register files outside this directory (absolute path
9589: names are not allowed). Despite this restriction, some
9590: packages need to install files outside this location;
1.45 wiz 9591: e.g., under <code xmlns=
9592: "http://www.w3.org/TR/xhtml1/transitional" class=
9593: "filename">${VARBASE}</code> or <code xmlns=
9594: "http://www.w3.org/TR/xhtml1/transitional" class=
9595: "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35 jmmv 9596:
9597: <p>The only way to achieve this is to create such files
9598: during installation time by using the installation
9599: scripts. These scripts can run arbitrary commands, so
9600: they have the potential to create and manage files
1.47 reed 9601: anywhere in the file system. Here is where pkginstall
1.35 jmmv 9602: comes into play: it provides generic scripts to abstract
9603: the manipulation of such files and directories based on
1.45 wiz 9604: variables set in the package's <code xmlns=
9605: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9606: "filename">Makefile</code>. The rest of this section
1.47 reed 9607: describes these variables.</p>
1.1 grant 9608:
1.67 hubertf 9609: <div class="sect2" lang="en">
1.35 jmmv 9610: <div class="titlepage">
1.1 grant 9611: <div>
1.35 jmmv 9612: <div>
1.67 hubertf 9613: <h3 class="title"><a name=
1.63 dillo 9614: "dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 9615: manipulation</h3>
9616: </div>
1.1 grant 9617: </div>
9618: </div>
9619:
1.35 jmmv 9620: <p>The following variables can be set to request the
1.47 reed 9621: creation of directories anywhere in the file
9622: system:</p>
1.27 rillig 9623:
1.35 jmmv 9624: <div class="itemizedlist">
9625: <ul type="disc">
9626: <li>
9627: <p><code class="varname">MAKE_DIRS</code> and
9628: <code class="varname">OWN_DIRS</code> contain a
9629: list of directories that should be created and
9630: should attempt to be destroyed by the
9631: installation scripts. The difference between the
9632: two is that the latter prompts the administrator
9633: to remove any directories that may be left after
9634: deinstallation (because they were not empty),
9635: while the former does not.</p>
9636: </li>
1.1 grant 9637:
1.35 jmmv 9638: <li>
9639: <p><code class="varname">MAKE_DIRS_PERMS</code>
9640: and <code class="varname">OWN_DIRS_PERMS</code>
9641: contain a list of tuples describing which
9642: directories should be created and should attempt
9643: to be destroyed by the installation scripts. Each
9644: tuple holds the following values, separated by
9645: spaces: the directory name, its owner, its group
9646: and its numerical mode. For example:</p>
9647: <pre class="programlisting">
1.51 rillig 9648: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9649: </pre>
1.1 grant 9650:
1.35 jmmv 9651: <p>The difference between the two is exactly the
9652: same as their non-<code class=
9653: "varname">PERMS</code> counterparts.</p>
9654: </li>
9655: </ul>
9656: </div>
9657: </div>
9658:
1.67 hubertf 9659: <div class="sect2" lang="en">
1.35 jmmv 9660: <div class="titlepage">
9661: <div>
9662: <div>
1.67 hubertf 9663: <h3 class="title"><a name=
9664: "files-outside-prefix"></a>12.1.2. File
1.35 jmmv 9665: manipulation</h3>
9666: </div>
9667: </div>
9668: </div>
9669:
9670: <p>Creating non-empty files outside the installation
1.45 wiz 9671: prefix is tricky because the <code xmlns=
9672: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9673: "filename">PLIST</code> forces all files to be inside
9674: it. To overcome this problem, the only solution is to
9675: extract the file in the known place (i.e., inside the
9676: installation prefix) and copy it to the appropriate
9677: location during installation (done by the installation
9678: scripts generated by pkginstall). We will call the
9679: former the <span class="emphasis"><em>master
9680: file</em></span> in the following paragraphs, which
9681: describe the variables that can be used to
9682: automatically and consistently handle files outside the
9683: installation prefix:</p>
9684:
9685: <div class="itemizedlist">
9686: <ul type="disc">
9687: <li>
9688: <p><code class="varname">CONF_FILES</code> and
9689: <code class="varname">SUPPORT_FILES</code> are
9690: pairs of master and target files. During
9691: installation time, the master file is copied to
9692: the target one if and only if the latter does not
9693: exist. Upon deinstallation, the target file is
9694: removed provided that it was not modified by the
9695: installation.</p>
9696:
9697: <p>The difference between the two is that the
9698: latter prompts the administrator to remove any
9699: files that may be left after deinstallation
9700: (because they were not empty), while the former
9701: does not.</p>
9702: </li>
9703:
9704: <li>
9705: <p><code class="varname">CONF_FILES_PERMS</code>
9706: and <code class=
9707: "varname">SUPPORT_FILES_PERMS</code> contain
9708: tuples describing master files as well as their
9709: target locations. For each of them, it also
9710: specifies their owner, their group and their
9711: numeric permissions, in this order. For
9712: example:</p>
9713: <pre class="programlisting">
1.51 rillig 9714: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9715: </pre>
9716:
9717: <p>The difference between the two is exactly the
9718: same as their non-<code class=
9719: "varname">PERMS</code> counterparts.</p>
9720: </li>
9721: </ul>
9722: </div>
9723: </div>
9724: </div>
9725:
1.67 hubertf 9726: <div class="sect1" lang="en">
1.35 jmmv 9727: <div class="titlepage">
9728: <div>
9729: <div>
9730: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9731: "conf-files"></a>12.2. Configuration
9732: files</h2>
1.35 jmmv 9733: </div>
9734: </div>
9735: </div>
9736:
9737: <p>Configuration files are special in the sense that they
9738: are installed in their own specific directory,
9739: <code class="varname">PKG_SYSCONFDIR</code>, and need
9740: special treatment during installation (most of which is
9741: automated by pkginstall). The main concept you must bear
1.36 wiz 9742: in mind is that files marked as configuration files are
1.35 jmmv 9743: automatically copied to the right place (somewhere inside
9744: <code class="varname">PKG_SYSCONFDIR</code>) during
9745: installation <span class="emphasis"><em>if and only
9746: if</em></span> they didn't exist before. Similarly, they
9747: will not be removed if they have local modifications.
1.36 wiz 9748: This ensures that administrators never lose any custom
1.35 jmmv 9749: changes they may have made.</p>
9750:
1.67 hubertf 9751: <div class="sect2" lang="en">
1.35 jmmv 9752: <div class="titlepage">
9753: <div>
9754: <div>
1.67 hubertf 9755: <h3 class="title"><a name=
9756: "conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 9757: <code class="varname">PKG_SYSCONFDIR</code> is
9758: set</h3>
9759: </div>
9760: </div>
9761: </div>
9762:
9763: <p>As said before, the <code class=
9764: "varname">PKG_SYSCONFDIR</code> variable specifies
9765: where configuration files shall be installed. Its
9766: contents are set based upon the following
9767: variables:</p>
9768:
9769: <div class="itemizedlist">
9770: <ul type="disc">
9771: <li>
9772: <p><code class="varname">PKG_SYSCONFBASE</code>:
9773: The configuration's root directory. Defaults to
1.45 wiz 9774: <code xmlns=
9775: "http://www.w3.org/TR/xhtml1/transitional" class=
9776: "filename">${PREFIX}/etc</code> although it may
9777: be overridden by the user to point to his
9778: preferred location (e.g., <code xmlns=
9779: "http://www.w3.org/TR/xhtml1/transitional" class=
9780: "filename">/etc</code>, <code xmlns=
9781: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9782: "filename">/etc/pkg</code>, etc.). Packages must
9783: not use it directly.</p>
9784: </li>
9785:
9786: <li>
9787: <p><code class=
9788: "varname">PKG_SYSCONFSUBDIR</code>: A
9789: subdirectory of <code class=
9790: "varname">PKG_SYSCONFBASE</code> under which the
9791: configuration files for the package being built
9792: shall be installed. The definition of this
9793: variable only makes sense in the package's
1.45 wiz 9794: <code xmlns=
9795: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 9796: "filename">Makefile</code> (i.e., it is not
9797: user-customizable).</p>
1.35 jmmv 9798:
9799: <p>As an example, consider the Apache package,
9800: <a xmlns=
9801: "http://www.w3.org/TR/xhtml1/transitional" href=
9802: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45 wiz 9803: target="_top"><code xmlns="" class=
9804: "filename">www/apache2</code></a>, which places
9805: its configuration files under the <code xmlns=
9806: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9807: "filename">httpd/</code> subdirectory of
9808: <code class="varname">PKG_SYSCONFBASE</code>.
9809: This should be set in the package Makefile.</p>
9810: </li>
9811:
9812: <li>
9813: <p><code class="varname">PKG_SYSCONFVAR</code>:
9814: Specifies the name of the variable that holds
9815: this package's configuration directory (if
9816: different from <code class=
9817: "varname">PKG_SYSCONFBASE</code>). It defaults to
9818: <code class="varname">PKGBASE</code>'s value, and
9819: is always prefixed with <code class=
9820: "literal">PKG_SYSCONFDIR</code>.</p>
9821: </li>
9822:
9823: <li>
9824: <p><code class=
9825: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
9826: Holds the directory where the configuration files
9827: for the package identified by <code class=
9828: "varname">PKG_SYSCONFVAR</code>'s shall be
9829: placed.</p>
9830: </li>
9831: </ul>
9832: </div>
9833:
9834: <p>Based on the above variables, pkginstall determines
9835: the value of <code class=
9836: "varname">PKG_SYSCONFDIR</code>, which is the
9837: <span class="emphasis"><em>only</em></span> variable
9838: that can be used within a package to refer to its
9839: configuration directory. The algorithm used to set its
9840: value is basically the following:</p>
9841:
9842: <div class="orderedlist">
9843: <ol type="1">
9844: <li>
9845: <p>If <code class=
9846: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9847: is set, its value is used.</p>
9848: </li>
9849:
9850: <li>
9851: <p>If the previous variable is not defined but
9852: <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45 wiz 9853: set in the package's <code xmlns=
9854: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9855: "filename">Makefile</code>, the resulting value
1.45 wiz 9856: is <code xmlns=
9857: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9858: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
9859: </li>
9860:
9861: <li>
1.45 wiz 9862: <p>Otherwise, it is set to <code xmlns=
9863: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9864: "filename">${PKG_SYSCONFBASE}</code>.</p>
9865: </li>
9866: </ol>
9867: </div>
9868:
1.45 wiz 9869: <p>It is worth mentioning that <code xmlns=
9870: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9871: "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45 wiz 9872: added to <code xmlns=
9873: "http://www.w3.org/TR/xhtml1/transitional" class=
9874: "filename">OWN_DIRS</code>. See <a href=
9875: "#dirs-outside-prefix" title=
1.63 dillo 9876: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 9877: “Directory manipulation”</a> what this
9878: means.</p>
9879: </div>
9880:
1.67 hubertf 9881: <div class="sect2" lang="en">
1.35 jmmv 9882: <div class="titlepage">
9883: <div>
9884: <div>
1.67 hubertf 9885: <h3 class="title"><a name=
1.63 dillo 9886: "conf-files-configure"></a>12.2.2. Telling
9887: the software where configuration files are</h3>
1.35 jmmv 9888: </div>
9889: </div>
9890: </div>
9891:
9892: <p>Given that pkgsrc (and users!) expect configuration
9893: files to be in a known place, you need to teach each
1.36 wiz 9894: package where it shall install its files. In some cases
1.35 jmmv 9895: you will have to patch the package Makefiles to achieve
9896: it. If you are lucky, though, it may be as easy as
9897: passing an extra flag to the configuration script; this
1.47 reed 9898: is the case of GNU Autoconf- generated files:</p>
1.35 jmmv 9899: <pre class="programlisting">
1.51 rillig 9900: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35 jmmv 9901: </pre>
9902:
9903: <p>Note that this specifies where the package has to
9904: <span class="emphasis"><em>look for</em></span> its
9905: configuration files, not where they will be originally
9906: installed (although the difference is never explicit,
9907: unfortunately).</p>
9908: </div>
9909:
1.67 hubertf 9910: <div class="sect2" lang="en">
1.35 jmmv 9911: <div class="titlepage">
9912: <div>
9913: <div>
1.67 hubertf 9914: <h3 class="title"><a name=
1.63 dillo 9915: "conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 9916: installations</h3>
9917: </div>
9918: </div>
9919: </div>
9920:
9921: <p>As said before, pkginstall automatically handles
9922: configuration files. This means that <span class=
9923: "strong"><strong>the packages themselves must not touch
1.45 wiz 9924: the contents of <code xmlns=
9925: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9926: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 9927: directly</strong></span>. Bad news is that many
9928: software installation scripts will, out of the box,
9929: mess with the contents of that directory. So what is
9930: the correct procedure to fix this issue?</p>
1.35 jmmv 9931:
9932: <p>You must teach the package (usually by manually
9933: patching it) to install any configuration files under
1.45 wiz 9934: the examples hierarchy, <code xmlns=
9935: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9936: "filename">share/examples/${PKGBASE}/</code>. This way,
1.45 wiz 9937: the <code xmlns=
9938: "http://www.w3.org/TR/xhtml1/transitional" class=
9939: "filename">PLIST</code> registers them and the
9940: administrator always has the original copies
1.35 jmmv 9941: available.</p>
9942:
9943: <p>Once the required configuration files are in place
9944: (i.e., under the examples hierarchy), the pkginstall
9945: framework can use them as master copies during the
1.45 wiz 9946: package installation to update what is in <code xmlns=
9947: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9948: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
9949: the variables <code class="varname">CONF_FILES</code>
9950: and <code class="varname">CONF_FILES_PERMS</code> are
9951: used. Check out <a href="#files-outside-prefix" title=
1.63 dillo 9952: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 9953: “File manipulation”</a> for information
9954: about their syntax and their purpose. Here is an
9955: example, taken from the <a xmlns=
9956: "http://www.w3.org/TR/xhtml1/transitional" href=
9957: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45 wiz 9958: target="_top"><code xmlns="" class=
9959: "filename">mail/mutt</code></a> package:</p>
1.35 jmmv 9960: <pre class="programlisting">
1.51 rillig 9961: EGDIR= ${PREFIX}/share/doc/mutt/samples
9962: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35 jmmv 9963: </pre>
9964:
9965: <p>Note that the <code class="varname">EGDIR</code>
9966: variable is specific to that package and has no meaning
9967: outside it.</p>
9968: </div>
9969:
1.67 hubertf 9970: <div class="sect2" lang="en">
1.35 jmmv 9971: <div class="titlepage">
9972: <div>
9973: <div>
1.67 hubertf 9974: <h3 class="title"><a name=
9975: "conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 9976: handling of configuration files</h3>
9977: </div>
9978: </div>
9979: </div>
9980:
9981: <p>The automatic copying of config files can be toggled
9982: by setting the environment variable <code class=
9983: "varname">PKG_CONFIG</code> prior to package
9984: installation.</p>
9985: </div>
9986: </div>
9987:
1.67 hubertf 9988: <div class="sect1" lang="en">
1.35 jmmv 9989: <div class="titlepage">
9990: <div>
9991: <div>
9992: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9993: "rcd-scripts"></a>12.3. System startup
9994: scripts</h2>
1.35 jmmv 9995: </div>
9996: </div>
9997: </div>
9998:
9999: <p>System startup scripts are special files because they
10000: must be installed in a place known by the underlying OS,
10001: usually outside the installation prefix. Therefore, the
10002: same rules described in <a href=
10003: "#files-and-dirs-outside-prefix" title=
1.38 dillo 10004: "12.1. Files and directories outside the installation prefix">
1.63 dillo 10005: Section 12.1, “Files and directories outside
10006: the installation prefix”</a> apply, and the same
1.35 jmmv 10007: solutions can be used. However, pkginstall provides a
1.36 wiz 10008: special mechanism to handle these files.</p>
1.35 jmmv 10009:
10010: <p>In order to provide system startup scripts, the
10011: package has to:</p>
10012:
10013: <div class="orderedlist">
10014: <ol type="1">
10015: <li>
1.45 wiz 10016: <p>Store the script inside <code xmlns=
10017: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10018: "filename">${FILESDIR}</code>, with the
10019: <code class="literal">.sh</code> suffix appended.
10020: Considering the <a xmlns=
10021: "http://www.w3.org/TR/xhtml1/transitional" href=
10022: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45 wiz 10023: target="_top"><code xmlns="" class=
10024: "filename">print/cups</code></a> package as an
10025: example, it has a <code xmlns=
10026: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10027: "filename">cupsd.sh</code> in its files
10028: directory.</p>
10029: </li>
10030:
10031: <li>
10032: <p>Tell pkginstall to handle it, appending the name
10033: of the script, without its extension, to the
10034: <code class="varname">RCD_SCRIPTS</code> variable.
10035: Continuing the previous example:</p>
10036: <pre class="programlisting">
1.51 rillig 10037: RCD_SCRIPTS+= cupsd
1.35 jmmv 10038: </pre>
10039: </li>
10040: </ol>
10041: </div>
10042:
10043: <p>Once this is done, pkginstall will do the following
10044: steps for each script in an automated fashion:</p>
10045:
10046: <div class="orderedlist">
10047: <ol type="1">
10048: <li>
10049: <p>Process the file found in the files directory
10050: applying all the substitutions described in the
1.45 wiz 10051: <code xmlns=
10052: "http://www.w3.org/TR/xhtml1/transitional" class=
10053: "filename">FILES_SUBST</code> variable.</p>
1.35 jmmv 10054: </li>
10055:
10056: <li>
10057: <p>Copy the script from the files directory to the
1.45 wiz 10058: examples hierarchy, <code xmlns=
10059: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10060: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 10061: Note that this master file must be explicitly
1.45 wiz 10062: registered in the <code xmlns=
10063: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10064: "filename">PLIST</code>.</p>
10065: </li>
10066:
10067: <li>
10068: <p>Add code to the installation scripts to copy the
10069: startup script from the examples hierarchy into the
10070: system-wide startup scripts directory.</p>
10071: </li>
10072: </ol>
10073: </div>
10074:
1.67 hubertf 10075: <div class="sect2" lang="en">
1.35 jmmv 10076: <div class="titlepage">
10077: <div>
10078: <div>
1.67 hubertf 10079: <h3 class="title"><a name=
1.63 dillo 10080: "rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 10081: handling of system startup scripts</h3>
10082: </div>
10083: </div>
10084: </div>
10085:
10086: <p>The automatic copying of config files can be toggled
10087: by setting the environment variable <code class=
10088: "varname">PKG_RCD_SCRIPTS</code> prior to package
10089: installation. Note that the scripts will be always
1.45 wiz 10090: copied inside the examples hierarchy, <code xmlns=
10091: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10092: "filename">${PREFIX}/share/examples/rc.d/</code>, no
10093: matter what the value of this variable is.</p>
10094: </div>
10095: </div>
10096:
1.67 hubertf 10097: <div class="sect1" lang="en">
1.35 jmmv 10098: <div class="titlepage">
10099: <div>
10100: <div>
10101: <h2 class="title" style="clear: both"><a name=
1.63 dillo 10102: "users-and-groups"></a>12.4. System users and
10103: groups</h2>
1.35 jmmv 10104: </div>
10105: </div>
10106: </div>
10107:
10108: <p>If a package needs to create special users and/or
10109: groups during installation, it can do so by using the
10110: pkginstall framework.</p>
10111:
10112: <p>Users can be created by adding entries to the
10113: <code class="varname">PKG_USERS</code> variable. Each
1.45 wiz 10114: entry has the following syntax, which mimics <code xmlns=
10115: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10116: "filename">/etc/passwd</code>:</p>
10117: <pre class="programlisting">
1.51 rillig 10118: user:group[:[userid][:[descr][:[home][:shell]]]]
1.35 jmmv 10119: </pre>
10120:
10121: <p>Only the user and group are required; everything else
10122: is optional, but the colons must be in the right places
10123: when specifying optional bits. By default, a new user
1.45 wiz 10124: will have home directory <code xmlns=
10125: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10126: "filename">/nonexistent</code>, and login shell
1.45 wiz 10127: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10128: class="filename">/sbin/nologin</code> unless they are
10129: specified as part of the user element. Note that if the
1.51 rillig 10130: description contains spaces, then spaces should be
1.45 wiz 10131: backslash-escaped, as in:</p>
1.35 jmmv 10132: <pre class="programlisting">
1.51 rillig 10133: foo:foogrp::The\ Foomister
1.35 jmmv 10134: </pre>
10135:
10136: <p>Similarly, groups can be created using the
10137: <code class="varname">PKG_GROUPS</code> variable, whose
10138: syntax is:</p>
10139: <pre class="programlisting">
1.51 rillig 10140: group[:groupid]
1.35 jmmv 10141: </pre>
10142:
10143: <p>As before, only the group name is required; the
10144: numeric identifier is optional.</p>
10145: </div>
10146:
1.67 hubertf 10147: <div class="sect1" lang="en">
1.35 jmmv 10148: <div class="titlepage">
10149: <div>
10150: <div>
10151: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 10152: "shells"></a>12.5. System shells</h2>
1.35 jmmv 10153: </div>
10154: </div>
10155: </div>
10156:
10157: <p>Packages that install system shells should register
1.45 wiz 10158: them in the shell database, <code xmlns=
10159: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10160: "filename">/etc/shells</code>, to make things easier to
10161: the administrator. This must be done from the
10162: installation scripts to keep binary packages working on
10163: any system. pkginstall provides an easy way to accomplish
10164: this task.</p>
10165:
10166: <p>When a package provides a shell interpreter, it has to
10167: set the <code class="varname">PKG_SHELL</code> variable
10168: to its absolute file name. This will add some hooks to
10169: the installation scripts to handle it. Consider the
10170: following example, taken from <a xmlns=
10171: "http://www.w3.org/TR/xhtml1/transitional" href=
10172: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45 wiz 10173: target="_top"><code xmlns="" class=
10174: "filename">shells/zsh</code></a>:</p>
1.35 jmmv 10175: <pre class="programlisting">
1.51 rillig 10176: PKG_SHELL= ${PREFIX}/bin/zsh
1.35 jmmv 10177: </pre>
10178:
1.67 hubertf 10179: <div class="sect2" lang="en">
1.35 jmmv 10180: <div class="titlepage">
10181: <div>
10182: <div>
1.67 hubertf 10183: <h3 class="title"><a name=
10184: "shells-disable"></a>12.5.1. Disabling shell
1.65 hubertf 10185: registration</h3>
1.35 jmmv 10186: </div>
10187: </div>
10188: </div>
10189:
10190: <p>The automatic registration of shell interpreters can
10191: be disabled by the administrator by setting the
1.45 wiz 10192: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10193: class="filename">PKG_REGISTER_SHELLS</code> environment
10194: variable to <code class="literal">NO</code>.</p>
1.35 jmmv 10195: </div>
10196: </div>
1.65 hubertf 10197:
1.67 hubertf 10198: <div class="sect1" lang="en">
1.65 hubertf 10199: <div class="titlepage">
10200: <div>
10201: <div>
10202: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 10203: "fonts"></a>12.6. Fonts</h2>
1.65 hubertf 10204: </div>
10205: </div>
10206: </div>
10207:
10208: <p>Packages that install X11 fonts should update the
10209: database files that index the fonts within each fonts
10210: directory. This can easily be accomplished within the
10211: pkginstall framework.</p>
10212:
10213: <p>When a package installs X11 fonts, it must list the
10214: directories in which fonts are installed in the
10215: <code class="varname">FONTS_DIRS.<em class=
10216: "replaceable"><code>type</code></em></code> variables,
10217: where <em class="replaceable"><code>type</code></em> can
10218: be one of “<span class="quote">ttf</span>”,
10219: “<span class="quote">type1</span>” or
10220: “<span class="quote">x11</span>”. This will
10221: add hooks to the installation scripts to run the
10222: appropriate commands to update the fonts database files
10223: within each of those directories. For convenience, if the
10224: directory path is relative, it is taken to be relative to
10225: the package's installation prefix. Consider the following
10226: example, taken from <a xmlns=
10227: "http://www.w3.org/TR/xhtml1/transitional" href=
10228: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/dbz-ttf/README.html"
10229: target="_top"><code xmlns="" class=
10230: "filename">fonts/dbz-ttf</code></a>:</p>
10231: <pre class="programlisting">
10232: FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF
10233: </pre>
10234:
1.67 hubertf 10235: <div class="sect2" lang="en">
1.65 hubertf 10236: <div class="titlepage">
10237: <div>
10238: <div>
1.67 hubertf 10239: <h3 class="title"><a name=
10240: "fonts-disable"></a>12.6.1. Disabling
10241: automatic update of the fonts databases</h3>
1.65 hubertf 10242: </div>
10243: </div>
10244: </div>
10245:
10246: <p>The automatic update of fonts databases can be
10247: disabled by the administrator by setting the
10248: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10249: class="filename">PKG_UPDATE_FONTS_DB</code> environment
10250: variable to <code class="literal">NO</code>.</p>
10251: </div>
10252: </div>
1.35 jmmv 10253: </div>
10254:
1.67 hubertf 10255: <div class="chapter" lang="en">
1.35 jmmv 10256: <div class="titlepage">
10257: <div>
10258: <div>
1.67 hubertf 10259: <h2 class="title"><a name=
1.38 dillo 10260: "options"></a>Chapter 13. Options
1.35 jmmv 10261: handling</h2>
10262: </div>
10263: </div>
10264: </div>
10265:
10266: <div class="toc">
10267: <p><b>Table of Contents</b></p>
10268:
10269: <dl>
10270: <dt><span class="sect1"><a href=
1.38 dillo 10271: "#global-default-options">13.1. Global default
1.35 jmmv 10272: options</a></span></dt>
10273:
10274: <dt><span class="sect1"><a href=
1.38 dillo 10275: "#converting-to-options">13.2. Converting packages to
1.45 wiz 10276: use <code xmlns=
10277: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10278: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 10279:
10280: <dt><span class="sect1"><a href="#option-names">13.3.
10281: Option Names</a></span></dt>
1.35 jmmv 10282: </dl>
10283: </div>
10284:
10285: <p>Many packages have the ability to be built to support
1.45 wiz 10286: different sets of features. <code xmlns=
10287: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10288: "filename">bsd.options.mk</code> is a framework in pkgsrc
10289: that provides generic handling of those options that
10290: determine different ways in which the packages can be
10291: built. It's possible for the user to specify exactly which
10292: sets of options will be built into a package or to allow a
10293: set of global default options apply.</p>
10294:
1.67 hubertf 10295: <div class="sect1" lang="en">
1.35 jmmv 10296: <div class="titlepage">
10297: <div>
10298: <div>
10299: <h2 class="title" style="clear: both"><a name=
1.38 dillo 10300: "global-default-options"></a>13.1. Global
1.35 jmmv 10301: default options</h2>
10302: </div>
10303: </div>
10304: </div>
10305:
10306: <p>Global default options are listed in <code class=
10307: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
10308: the options that should be built into every package if
10309: that option is supported. This variable should be set in
1.45 wiz 10310: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10311: class="filename">/etc/mk.conf</code>.</p>
1.35 jmmv 10312: </div>
10313:
1.67 hubertf 10314: <div class="sect1" lang="en">
1.35 jmmv 10315: <div class="titlepage">
10316: <div>
10317: <div>
10318: <h2 class="title" style="clear: both"><a name=
1.38 dillo 10319: "converting-to-options"></a>13.2. Converting
1.45 wiz 10320: packages to use <code xmlns=
10321: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10322: "filename">bsd.options.mk</code></h2>
10323: </div>
10324: </div>
10325: </div>
10326:
1.45 wiz 10327: <p>The following example shows how <code xmlns=
10328: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10329: "filename">bsd.options.mk</code> should be used by the
10330: hypothetical ``wibble'' package, either in the package
1.45 wiz 10331: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10332: class="filename">Makefile</code>, or in a file, e.g.
10333: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10334: class="filename">options.mk</code>, that is included by
10335: the main package <code xmlns=
10336: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10337: "filename">Makefile</code>.</p>
10338: <pre class="programlisting">
1.51 rillig 10339: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
10340: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
10341: PKG_OPTIONS_OPTIONAL_GROUPS= database
10342: PKG_OPTIONS_GROUP.database= mysql pgsql
10343: PKG_SUGGESTED_OPTIONS= wibble-foo
10344: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
10345: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
10346:
10347: .include "../../mk/bsd.prefs.mk"
10348:
10349: # this package was previously named wibble2
10350: .if defined(PKG_OPTIONS.wibble2)
10351: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
10352: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
10353: "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
10354: .endif
10355:
10356: .include "../../mk/bsd.options.mk"
10357:
10358: # Package-specific option-handling
10359:
10360: ###
10361: ### FOO support
10362: ###
10363: .if !empty(PKG_OPTIONS:Mwibble-foo)
10364: CONFIGURE_ARGS+= --enable-foo
10365: .endif
10366:
10367: ###
10368: ### LDAP support
10369: ###
10370: .if !empty(PKG_OPTIONS:Mldap)
10371: . include "../../databases/openldap/buildlink3.mk"
10372: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
10373: .endif
10374:
10375: ###
10376: ### database support
10377: ###
10378: .if !empty(PKG_OPTIONS:Mmysql)
10379: . include "../../mk/mysql.buildlink3.mk"
10380: .endif
10381: .if !empty(PKG_OPTIONS:Mpgsql)
10382: . include "../../mk/pgsql.buildlink3.mk"
10383: .endif
1.1 grant 10384: </pre>
10385:
1.28 rillig 10386: <p>The first section contains the information about which
10387: build options are supported by the package, and any
1.1 grant 10388: default options settings if needed.</p>
10389:
10390: <div class="orderedlist">
10391: <ol type="1">
10392: <li>
1.14 xtraeme 10393: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 10394: the name of the <a href=
1.1 grant 10395: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10396: <span class="citerefentry"><span class=
1.27 rillig 10397: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 10398: that the user can set to override the default
1.57 minskim 10399: options. It should be set to PKG_OPTIONS.<em class=
1.63 dillo 10400: "replaceable"><code>pkgbase</code></em>. Do not set
10401: it to PKG_OPTIONS.${PKGBASE}, since <code class=
10402: "varname">PKGBASE</code> is set after <code class=
10403: "varname">PKG_OPTIONS_VAR</code> is used.</p>
1.1 grant 10404: </li>
10405:
10406: <li>
1.14 xtraeme 10407: <p><code class=
10408: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 10409: build options supported by the package.</p>
10410: </li>
10411:
10412: <li>
10413: <p><code class=
10414: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
10415: list of names of groups of mutually exclusive
10416: options. The options in each group are listed in
10417: <code class="varname">PKG_OPTIONS_GROUP.<em class=
10418: "replaceable"><code>groupname</code></em></code>.
10419: The most specific setting of any option from the
10420: group takes precedence over all other options in
10421: the group. Options from the groups will be
10422: automatically added to <code class=
10423: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
10424: </li>
10425:
10426: <li>
10427: <p><code class=
10428: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
10429: like <code class=
10430: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
10431: building the packages will fail if no option from
10432: the group is selected.</p>
1.1 grant 10433: </li>
10434:
10435: <li>
1.27 rillig 10436: <p><code class=
1.44 gdt 10437: "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
10438: list of names of sets of options. At least one
10439: option from each set must be selected. The options
10440: in each set are listed in <code class=
10441: "varname">PKG_OPTIONS_SET.<em class=
10442: "replaceable"><code>setname</code></em></code>.
10443: Options from the sets will be automatically added
10444: to <code class=
10445: "varname">PKG_SUPPORTED_OPTIONS</code>. Building
10446: the package will fail if no option from the set is
10447: selected.</p>
10448: </li>
10449:
10450: <li>
10451: <p><code class=
1.27 rillig 10452: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
10453: build options which are enabled by default.</p>
10454: </li>
10455:
10456: <li>
1.37 dillo 10457: <p><code class=
10458: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
10459: of “<span class="quote"><em class=
1.67 hubertf 10460: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>”
10461: pairs that map legacy <code xmlns=
1.45 wiz 10462: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 10463: "filename">/etc/mk.conf</code> variables to their
10464: option counterparts. Pairs should be added with
10465: “<span class="quote">+=</span>” to keep
10466: the listing of global legacy variables. A warning
10467: will be issued if the user uses a legacy
10468: variable.</p>
10469: </li>
1.1 grant 10470:
1.37 dillo 10471: <li>
10472: <p><code class=
10473: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
10474: of “<span class="quote"><em class=
1.67 hubertf 10475: "replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>”
10476: pairs that map options that have been renamed to
10477: their new counterparts. Pairs should be added with
1.37 dillo 10478: “<span class="quote">+=</span>” to keep
10479: the listing of global legacy options. A warning
10480: will be issued if the user uses a legacy
10481: option.</p>
10482: </li>
1.1 grant 10483:
1.37 dillo 10484: <li>
10485: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
10486: is a list of options implied by deprecated
10487: variables used. This can be used for cases that
10488: neither <code class=
10489: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
10490: <code class=
10491: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
10492: handle, e. g. when <code class=
10493: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 10494: </li>
10495:
10496: <li>
1.37 dillo 10497: <p><code class=
10498: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
10499: a list of warnings about deprecated variables or
10500: options used, and what to use instead.</p>
1.1 grant 10501: </li>
1.28 rillig 10502: </ol>
1.1 grant 10503: </div>
10504:
1.37 dillo 10505: <p>A package should never modify <code class=
10506: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
10507: named in <code class="varname">PKG_OPTIONS_VAR</code>.
10508: These are strictly user-settable. To suggest a default
10509: set of options, use <code class=
10510: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
10511:
1.42 dillo 10512: <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45 wiz 10513: defined before including <code xmlns=
10514: "http://www.w3.org/TR/xhtml1/transitional" class=
1.42 dillo 10515: "filename">bsd.options.mk</code>. If none of <code class=
1.37 dillo 10516: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
10517: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
10518: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47 reed 10519: are defined (as can happen with platform-specific options
1.42 dillo 10520: if none of them is supported on the current platform),
10521: <code class="varname">PKG_OPTIONS</code> is set to the
10522: empty list and the package is otherwise treated as not
10523: using the options framework.</p>
1.37 dillo 10524:
1.45 wiz 10525: <p>After the inclusion of <code xmlns=
10526: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 10527: "filename">bsd.options.mk</code>, the variable
1.28 rillig 10528: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 10529: list of selected build options, properly filtered to
1.28 rillig 10530: remove unsupported and duplicate options.</p>
10531:
1.1 grant 10532: <p>The remaining sections contain the logic that is
1.37 dillo 10533: specific to each option. The correct way to check for an
10534: option is to check whether it is listed in <code class=
10535: "varname">PKG_OPTIONS</code>:</p>
10536: <pre class="programlisting">
1.51 rillig 10537: .if !empty(PKG_OPTIONS:M<em class=
1.37 dillo 10538: "replaceable"><code>option</code></em>)
10539: </pre>
1.48 dillo 10540: </div>
1.37 dillo 10541:
1.67 hubertf 10542: <div class="sect1" lang="en">
1.48 dillo 10543: <div class="titlepage">
10544: <div>
10545: <div>
10546: <h2 class="title" style="clear: both"><a name=
10547: "option-names"></a>13.3. Option Names</h2>
10548: </div>
10549: </div>
10550: </div>
10551:
10552: <p>Options that enable similar features in different
10553: packages (like optional support for a library) should use
10554: a common name in all packages that support it (like the
10555: name of the library). If another package already has an
10556: option with the same meaning, use the same name.</p>
10557:
10558: <p>Options that enable features specific to one package,
10559: where it's unlikely that another (unrelated) package has
10560: the same (or a similar) optional feature, should use a
10561: name prefixed with <code class="varname"><em class=
10562: "replaceable"><code>pkgname</code></em>-</code>.</p>
10563:
10564: <p>If a group of related packages share an optional
10565: feature specific to that group, prefix it with the name
10566: of the “<span class="quote">main</span>”
10567: package (e. g. <code class=
10568: "varname">djbware-errno-hack</code>).</p>
10569:
10570: <p>For new options, add a line to <code xmlns=
10571: "http://www.w3.org/TR/xhtml1/transitional" class=
10572: "filename">mk/defaults/options.description</code>. Lines
10573: have two fields, separated by tab. The first field is the
10574: option name, the second its description. The description
10575: should be a whole sentence (starting with an uppercase
10576: letter and ending with a period) that describes what
10577: enabling the option does. E. g. “<span class=
10578: "quote">Enable ispell support.</span>” The file is
10579: sorted by option names.</p>
1.1 grant 10580: </div>
10581: </div>
10582:
1.67 hubertf 10583: <div class="chapter" lang="en">
1.1 grant 10584: <div class="titlepage">
10585: <div>
10586: <div>
1.67 hubertf 10587: <h2 class="title"><a name=
1.38 dillo 10588: "build"></a>Chapter 14. The build
1.1 grant 10589: process</h2>
10590: </div>
10591: </div>
10592: </div>
10593:
10594: <div class="toc">
10595: <p><b>Table of Contents</b></p>
10596:
10597: <dl>
1.56 rillig 10598: <dt><span class="sect1"><a href="#build.intro">14.1.
10599: Introduction</a></span></dt>
10600:
10601: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 10602: Program location</a></span></dt>
10603:
1.56 rillig 10604: <dt><span class="sect1"><a href=
10605: "#build.builddirs">14.3. Directories used during the
10606: build process</a></span></dt>
10607:
10608: <dt><span class="sect1"><a href="#build.running">14.4.
10609: Running a phase</a></span></dt>
10610:
10611: <dt><span class="sect1"><a href="#build.fetch">14.5.
10612: The <span class="emphasis"><em>fetch</em></span>
10613: phase</a></span></dt>
10614:
10615: <dt><span class="sect1"><a href="#build.checksum">14.6.
10616: The <span class="emphasis"><em>checksum</em></span>
10617: phase</a></span></dt>
10618:
10619: <dt><span class="sect1"><a href="#build.extract">14.7.
10620: The <span class="emphasis"><em>extract</em></span>
10621: phase</a></span></dt>
10622:
10623: <dt><span class="sect1"><a href="#build.patch">14.8.
10624: The <span class="emphasis"><em>patch</em></span>
10625: phase</a></span></dt>
10626:
10627: <dt><span class="sect1"><a href="#build.tools">14.9.
10628: The <span class="emphasis"><em>tools</em></span>
10629: phase</a></span></dt>
10630:
10631: <dt><span class="sect1"><a href="#build.wrapper">14.10.
10632: The <span class="emphasis"><em>wrapper</em></span>
10633: phase</a></span></dt>
1.1 grant 10634:
10635: <dt><span class="sect1"><a href=
1.56 rillig 10636: "#build.configure">14.11. The <span class=
10637: "emphasis"><em>configure</em></span>
10638: phase</a></span></dt>
10639:
10640: <dt><span class="sect1"><a href="#build.build">14.12.
10641: The <span class="emphasis"><em>build</em></span>
10642: phase</a></span></dt>
10643:
10644: <dt><span class="sect1"><a href="#build.test">14.13.
10645: The <span class="emphasis"><em>test</em></span>
10646: phase</a></span></dt>
10647:
10648: <dt><span class="sect1"><a href="#build.install">14.14.
10649: The <span class="emphasis"><em>install</em></span>
10650: phase</a></span></dt>
10651:
10652: <dt><span class="sect1"><a href="#build.package">14.15.
10653: The <span class="emphasis"><em>package</em></span>
10654: phase</a></span></dt>
10655:
10656: <dt><span class="sect1"><a href=
10657: "#build.helpful-targets">14.16. Other helpful
1.1 grant 10658: targets</a></span></dt>
10659: </dl>
10660: </div>
10661:
1.67 hubertf 10662: <div class="sect1" lang="en">
1.56 rillig 10663: <div class="titlepage">
10664: <div>
10665: <div>
10666: <h2 class="title" style="clear: both"><a name=
10667: "build.intro"></a>14.1. Introduction</h2>
10668: </div>
10669: </div>
10670: </div>
10671:
10672: <p>This chapter gives a detailed description on how a
10673: package is built. Building a package is separated into
10674: different <span class="emphasis"><em>phases</em></span>
10675: (for example <code class="varname">fetch</code>,
10676: <code class="varname">build</code>, <code class=
10677: "varname">install</code>), all of which are described in
10678: the following sections. Each phase is splitted into
10679: so-called <span class="emphasis"><em>stages</em></span>,
1.66 rillig 10680: which take the name of the containing phase, prefixed by
1.56 rillig 10681: one of <code class="varname">pre-</code>, <code class=
10682: "varname">do-</code> or <code class=
10683: "varname">post-</code>. (Examples are <code class=
10684: "varname">pre-configure</code>, <code class=
10685: "varname">post-build</code>.) Most of the actual work is
10686: done in the <code class="varname">do-*</code> stages.</p>
10687:
10688: <p>The basic steps for building a program are always the
10689: same. First the program's source (<span class=
10690: "emphasis"><em>distfile</em></span>) must be brought to
1.66 rillig 10691: the local system and then extracted. After any
10692: pkgsrc-specific patches to compile properly are applied,
10693: the software can be configured, then built (usually by
10694: compiling), and finally the generated binaries, etc. can
10695: be put into place on the system.</p>
1.56 rillig 10696: </div>
1.1 grant 10697:
1.67 hubertf 10698: <div class="sect1" lang="en">
1.1 grant 10699: <div class="titlepage">
10700: <div>
10701: <div>
10702: <h2 class="title" style="clear: both"><a name=
1.56 rillig 10703: "build.prefix"></a>14.2. Program location</h2>
1.1 grant 10704: </div>
10705: </div>
10706: </div>
10707:
10708: <p>Before outlining the process performed by the NetBSD
10709: package system in the next section, here's a brief
10710: discussion on where programs are installed, and which
10711: variables influence this.</p>
10712:
1.14 xtraeme 10713: <p>The automatic variable <code class=
10714: "varname">PREFIX</code> indicates where all files of the
10715: final program shall be installed. It is usually set to
1.45 wiz 10716: <code class="varname">LOCALBASE</code> (<code xmlns=
10717: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10718: "filename">/usr/pkg</code>), or <code class=
10719: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 10720: “<span class="quote">cross</span>” category.
1.14 xtraeme 10721: The value of <code class="varname">PREFIX</code> needs to
10722: be put into the various places in the program's source
10723: where paths to these files are encoded. See <a href=
1.1 grant 10724: "#components.patches" title=
1.38 dillo 10725: "8.3. patches/*">Section 8.3,
1.1 grant 10726: “patches/*”</a> and <a href="#fixes.libtool"
10727: title=
1.68 rillig 10728: "16.3.1. Shared libraries - libtool">Section 16.3.1,
1.1 grant 10729: “Shared libraries - libtool”</a> for more
10730: details.</p>
10731:
10732: <p>When choosing which of these variables to use, follow
10733: the following rules:</p>
10734:
10735: <div class="itemizedlist">
10736: <ul type="disc">
10737: <li>
1.14 xtraeme 10738: <p><code class="varname">PREFIX</code> always
10739: points to the location where the current pkg will
10740: be installed. When referring to a pkg's own
1.1 grant 10741: installation path, use “<span class=
10742: "quote">${PREFIX}</span>”.</p>
10743: </li>
10744:
10745: <li>
1.14 xtraeme 10746: <p><code class="varname">LOCALBASE</code> is where
10747: all non-X11 pkgs are installed. If you need to
1.1 grant 10748: construct a -I or -L argument to the compiler to
10749: find includes and libraries installed by another
10750: non-X11 pkg, use “<span class=
10751: "quote">${LOCALBASE}</span>”.</p>
10752: </li>
10753:
10754: <li>
1.14 xtraeme 10755: <p><code class="varname">X11BASE</code> is where
10756: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 10757: installed. When looking for <span class=
10758: "emphasis"><em>standard</em></span> X11 includes
10759: (not those installed by a pkg), use
10760: “<span class=
10761: "quote">${X11BASE}</span>”.</p>
10762: </li>
10763:
10764: <li>
1.47 reed 10765: <p>X11-based packages are special in that they may
10766: be installed in either <code class=
1.14 xtraeme 10767: "varname">X11BASE</code> or <code class=
10768: "varname">LOCALBASE</code>.</p>
1.1 grant 10769:
10770: <p>Usually, X11 packages should be installed under
1.14 xtraeme 10771: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 10772: possible. Note that you will need to include
1.45 wiz 10773: <code xmlns=
10774: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 10775: "filename">../../mk/x11.buildlink3.mk</code> in
10776: them to request the presence of X11 and to get the
10777: right compilation flags.</p>
1.1 grant 10778:
10779: <p>Even though, there are some packages that cannot
1.14 xtraeme 10780: be installed under <code class=
10781: "varname">LOCALBASE</code>: those that come with
1.1 grant 10782: app-defaults files. These packages are special and
1.14 xtraeme 10783: they must be placed under <code class=
10784: "varname">X11BASE</code>. To accomplish this, set
10785: either <code class="varname">USE_X11BASE</code> or
10786: <code class="varname">USE_IMAKE</code> in your
1.1 grant 10787: package.</p>
10788:
1.34 wiz 10789: <p>Some notes: If you need to find includes or
1.14 xtraeme 10790: libraries installed by a pkg that has <code class=
10791: "varname">USE_IMAKE</code> or <code class=
10792: "varname">USE_X11BASE</code> in its pkg
1.45 wiz 10793: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10794: class="filename">Makefile</code>, you need to look
10795: in <span class="emphasis"><em>both</em></span>
10796: <code xmlns=
10797: "http://www.w3.org/TR/xhtml1/transitional" class=
10798: "filename">${X11BASE}</code> and <code xmlns=
10799: "http://www.w3.org/TR/xhtml1/transitional" class=
10800: "filename">${LOCALBASE}</code>. To force
10801: installation of all X11 packages in <code class=
10802: "varname">LOCALBASE</code>, the <a xmlns=
10803: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10804: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 10805: target="_top"><code xmlns="" class=
10806: "filename">pkgtools/xpkgwedge</code></a> package is
1.34 wiz 10807: enabled by default.</p>
1.1 grant 10808: </li>
10809:
10810: <li>
1.14 xtraeme 10811: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 10812: used to refer to the installed location of an X11
1.14 xtraeme 10813: package. <code class="varname">X11PREFIX</code>
10814: will be set to <code class="varname">X11BASE</code>
10815: if xpkgwedge is not installed, and to <code class=
10816: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 10817: installed.</p>
10818: </li>
10819:
10820: <li>
10821: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 10822: have some packages installed in <code class=
10823: "varname">X11BASE</code> and some in <code class=
10824: "varname">LOCALBASE</code>. To determine the prefix
10825: of an installed package, the <code class=
10826: "varname">EVAL_PREFIX</code> definition can be
10827: used. It takes pairs in the format
10828: “<span class=
1.1 grant 10829: "quote">DIRNAME=<package></span>”, and
1.24 wiz 10830: the <a href=
10831: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10832: <span class="citerefentry"><span class=
10833: "refentrytitle">make</span>(1)</span></a> variable
10834: <code class="varname">DIRNAME</code> will be set to
10835: the prefix of the installed package
10836: <package>, or “<span class=
1.1 grant 10837: "quote">${X11PREFIX}</span>” if the package
10838: is not installed.</p>
10839:
10840: <p>This is best illustrated by example.</p>
10841:
1.45 wiz 10842: <p>The following lines are taken from <code xmlns=
10843: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10844: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 10845: <pre class="programlisting">
1.51 rillig 10846: EVAL_PREFIX+= GTKDIR=gtk+
1.69 rillig 10847: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE:Q}
10848: CONFIGURE_ARGS+= --with-gtk-prefix=${GTKDIR:Q}
10849: CONFIGURE_ARGS+= --enable-multibyte
1.1 grant 10850: </pre>
10851:
10852: <p>Specific defaults can be defined for the
1.14 xtraeme 10853: packages evaluated using <code class=
10854: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 10855: of the form:</p>
10856: <pre class="programlisting">
1.51 rillig 10857: GTKDIR_DEFAULT= ${LOCALBASE}
1.1 grant 10858: </pre>
10859:
1.14 xtraeme 10860: <p>where <code class="varname">GTKDIR</code>
1.1 grant 10861: corresponds to the first definition in the
1.14 xtraeme 10862: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 10863: </li>
10864:
10865: <li>
1.45 wiz 10866: <p>Within <code xmlns=
10867: "http://www.w3.org/TR/xhtml1/transitional" class=
10868: "filename">${PREFIX}</code>, packages should
10869: install files according to <a href=
1.24 wiz 10870: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
10871: <span class="citerefentry"><span class=
10872: "refentrytitle">hier</span>(7)</span></a>, with the
1.45 wiz 10873: exception that manual pages go into <code xmlns=
10874: "http://www.w3.org/TR/xhtml1/transitional" class=
10875: "filename">${PREFIX}/man</code>, not <code xmlns=
10876: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10877: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 10878: </li>
10879: </ul>
10880: </div>
10881: </div>
10882:
1.67 hubertf 10883: <div class="sect1" lang="en">
1.1 grant 10884: <div class="titlepage">
10885: <div>
10886: <div>
10887: <h2 class="title" style="clear: both"><a name=
1.56 rillig 10888: "build.builddirs"></a>14.3. Directories used
10889: during the build process</h2>
1.1 grant 10890: </div>
10891: </div>
10892: </div>
10893:
1.56 rillig 10894: <p>When building a package, a number of directories is
10895: used to store source files, temporary files,
10896: pkgsrc-internal files, and so on. These directories are
10897: explained here.</p>
10898:
10899: <p>Some of the directory variables contain relative
10900: pathnames. There are two common base directories for
10901: these relative directories: <code class=
10902: "varname">PKGSRCDIR/PKGPATH</code> is used for
10903: directories that are pkgsrc-specific. <code class=
10904: "varname">WRKSRC</code> is used for directories inside
1.66 rillig 10905: the package itself.</p>
1.1 grant 10906:
10907: <div class="variablelist">
10908: <dl>
1.56 rillig 10909: <dt><span class="term"><code class=
1.66 rillig 10910: "varname">PKGSRCDIR</code></span></dt>
1.56 rillig 10911:
10912: <dd>
10913: <p>This is an absolute pathname that points to the
10914: pkgsrc root directory. Generally, you don't need
10915: it.</p>
10916: </dd>
10917:
10918: <dt><span class="term"><code class=
1.66 rillig 10919: "varname">PKGPATH</code></span></dt>
1.1 grant 10920:
10921: <dd>
1.56 rillig 10922: <p>This is a pathname relative to <code class=
10923: "varname">PKGSRCDIR</code> that points to the
10924: current package.</p>
10925: </dd>
10926:
10927: <dt><span class="term"><code class=
1.66 rillig 10928: "varname">WRKDIR</code></span></dt>
1.56 rillig 10929:
10930: <dd>
10931: <p>This is an absolute pathname pointing to the
1.57 minskim 10932: directory where all work takes place. The distfiles
10933: are extraced to this directory. It also contains
10934: temporary directories and log files used by the
10935: various pkgsrc frameworks, like <span class=
10936: "emphasis"><em>buildlink</em></span> or the
10937: <span class=
1.56 rillig 10938: "emphasis"><em>wrappers</em></span>.</p>
10939: </dd>
10940:
10941: <dt><span class="term"><code class=
1.66 rillig 10942: "varname">WRKSRC</code></span></dt>
1.56 rillig 10943:
10944: <dd>
10945: <p>This is an absolute pathname pointing to the
10946: directory where the distfiles are extracted. It is
10947: usually a direct subdirectory of <code class=
10948: "varname">WRKDIR</code>, and often it's the only
1.66 rillig 10949: directory entry that isn't hidden. This variable
10950: may be changed by a package <code xmlns=
10951: "http://www.w3.org/TR/xhtml1/transitional" class=
10952: "filename">Makefile</code>.</p>
1.56 rillig 10953: </dd>
10954: </dl>
10955: </div>
10956: </div>
10957:
1.67 hubertf 10958: <div class="sect1" lang="en">
1.56 rillig 10959: <div class="titlepage">
10960: <div>
10961: <div>
10962: <h2 class="title" style="clear: both"><a name=
10963: "build.running"></a>14.4. Running a phase</h2>
10964: </div>
10965: </div>
10966: </div>
10967:
10968: <p>You can run a particular phase by typing
10969: <span><strong class="command">make phase</strong></span>,
10970: where <span class="emphasis"><em>phase</em></span> is the
10971: name of the phase. This will automatically run all phases
10972: that are required for this phase. The default phase is
10973: <code class="varname">build</code>, that is, when you run
10974: <span><strong class="command">make</strong></span>
10975: without parameters in a package directory, the package
10976: will be built, but not installed.</p>
10977: </div>
10978:
1.67 hubertf 10979: <div class="sect1" lang="en">
1.56 rillig 10980: <div class="titlepage">
10981: <div>
10982: <div>
10983: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 10984: "build.fetch"></a>14.5. The <span class=
10985: "emphasis"><em>fetch</em></span> phase</h2>
1.56 rillig 10986: </div>
10987: </div>
10988: </div>
10989:
10990: <p>This will check if the file(s) given in the variables
10991: <code class="varname">DISTFILES</code> and <code class=
10992: "varname">PATCHFILES</code> (as defined in the package's
10993: Makefile) are present on the local system in <code xmlns=
10994: "http://www.w3.org/TR/xhtml1/transitional" class=
10995: "filename">/usr/pkgsrc/distfiles</code>. If they are not
10996: present, an attempt will be made to fetch them using
10997: commands of the form:</p>
10998: <pre class="programlisting">
1.51 rillig 10999: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 grant 11000: </pre>
11001:
1.56 rillig 11002: <p>where ${site} varies through several possibilities in
11003: turn: first, <code class=
11004: "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
11005: sites specified in either <code class=
11006: "varname">SITES_file</code> if defined, else <code class=
11007: "varname">MASTER_SITES</code> or <code class=
11008: "varname">PATCH_SITES</code>, as applies, then finally
11009: the value of <code class=
11010: "varname">MASTER_SITE_BACKUP</code>. The order of all
11011: except the first can be optionally sorted by the user,
11012: via setting either <code class=
11013: "varname">MASTER_SORT_AWK</code> or <code class=
11014: "varname">MASTER_SORT_REGEX</code>.</p>
11015: </div>
11016:
1.67 hubertf 11017: <div class="sect1" lang="en">
1.56 rillig 11018: <div class="titlepage">
11019: <div>
11020: <div>
11021: <h2 class="title" style="clear: both"><a name=
11022: "build.checksum"></a>14.6. The <span class=
11023: "emphasis"><em>checksum</em></span> phase</h2>
11024: </div>
11025: </div>
11026: </div>
11027:
11028: <p>After the distfile(s) are fetched, their checksum is
11029: generated and compared with the checksums stored in the
11030: distinfo file. If the checksums don't match, the build is
11031: aborted. This is to ensure the same distfile is used for
11032: building, and that the distfile wasn't changed, e.g. by
11033: some malign force, deliberately changed distfiles on the
11034: master distribution site or network lossage.</p>
11035: </div>
11036:
1.67 hubertf 11037: <div class="sect1" lang="en">
1.56 rillig 11038: <div class="titlepage">
11039: <div>
11040: <div>
11041: <h2 class="title" style="clear: both"><a name=
11042: "build.extract"></a>14.7. The <span class=
11043: "emphasis"><em>extract</em></span> phase</h2>
11044: </div>
11045: </div>
11046: </div>
11047:
11048: <p>When the distfiles are present on the local system,
1.69 rillig 11049: they need to be extracted, as they usually come in the
11050: form of some compressed archive format.</p>
11051:
11052: <p>By default, all <code class="varname">DISTFILES</code>
11053: are extracted. If you only need some of them, you can set
11054: the <code class="varname">EXTRACT_ONLY</code> variable to
11055: the list of those files.</p>
11056:
11057: <p>Extracting the files is usually done by a little
11058: program, <code xmlns=
11059: "http://www.w3.org/TR/xhtml1/transitional" class=
11060: "filename">mk/scripts/extract</code>, which already knows
11061: how to extract various archive formats, so most likely
11062: you will not need to change anything here. But if you
11063: need, the following variables may help you:</p>
11064:
11065: <div class="variablelist">
11066: <dl>
11067: <dt><span class="term"><code class=
11068: "varname">EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}</code></span></dt>
11069:
11070: <dd>
11071: <p>Use these variables to override the default
11072: options for an extract command, which are defined
11073: in <code xmlns=
11074: "http://www.w3.org/TR/xhtml1/transitional" class=
11075: "filename">mk/scripts/extract</code>.</p>
11076: </dd>
1.1 grant 11077:
1.69 rillig 11078: <dt><span class="term"><code class=
11079: "varname">EXTRACT_USING</code></span></dt>
1.1 grant 11080:
1.69 rillig 11081: <dd>
11082: <p>This variable can be set to <code class=
11083: "literal">pax</code>, <code class=
11084: "literal">tar</code> or an absolute pathname
11085: pointing to the command with which tar archives
11086: should be extracted.</p>
11087: </dd>
11088: </dl>
11089: </div>
11090:
11091: <p>If the <code xmlns=
1.56 rillig 11092: "http://www.w3.org/TR/xhtml1/transitional" class=
1.69 rillig 11093: "filename">extract</code> program doesn't serve your
11094: needs, you can also override the <code class=
11095: "varname">EXTRACT_CMD</code> variable, which holds the
11096: command used for extracting the files. This command is
11097: executed in the <code xmlns=
11098: "http://www.w3.org/TR/xhtml1/transitional" class=
11099: "filename">${WRKSRC}</code> directory. During execution
11100: of this command, the shell variable <code class=
11101: "varname">extract_file</code> holds the absolute pathname
11102: of the file that is going to be extracted.</p>
11103:
11104: <p>And if that still does not suffice, you can override
11105: the <code class="varname">do-extract</code> target in the
11106: package Makefile.</p>
1.56 rillig 11107: </div>
11108:
1.67 hubertf 11109: <div class="sect1" lang="en">
1.56 rillig 11110: <div class="titlepage">
11111: <div>
11112: <div>
11113: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11114: "build.patch"></a>14.8. The <span class=
11115: "emphasis"><em>patch</em></span> phase</h2>
1.56 rillig 11116: </div>
11117: </div>
11118: </div>
11119:
11120: <p>After extraction, all the patches named by the
11121: <code class="varname">PATCHFILES</code>, those present in
11122: the patches subdirectory of the package as well as in
11123: $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
11124: "http://www.w3.org/TR/xhtml1/transitional" class=
11125: "filename">/usr/local/patches/graphics/png</code>) are
11126: applied. Patchfiles ending in <code xmlns=
11127: "http://www.w3.org/TR/xhtml1/transitional" class=
11128: "filename">.Z</code> or <code xmlns=
11129: "http://www.w3.org/TR/xhtml1/transitional" class=
11130: "filename">.gz</code> are uncompressed before they are
11131: applied, files ending in <code xmlns=
11132: "http://www.w3.org/TR/xhtml1/transitional" class=
11133: "filename">.orig</code> or <code xmlns=
11134: "http://www.w3.org/TR/xhtml1/transitional" class=
11135: "filename">.rej</code> are ignored. Any special options
11136: to <a href=
11137: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
11138: <span class="citerefentry"><span class=
11139: "refentrytitle">patch</span>(1)</span></a> can be handed
11140: in <code class="varname">PATCH_DIST_ARGS</code>. See
11141: <a href="#components.patches" title=
11142: "8.3. patches/*">Section 8.3,
11143: “patches/*”</a> for more details.</p>
11144:
11145: <p>By default <a href=
11146: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
11147: <span class="citerefentry"><span class=
11148: "refentrytitle">patch</span>(1)</span></a> is given
11149: special args to make it fail if the patches apply with
11150: some lines of fuzz. Please fix (regen) the patches so
11151: that they apply cleanly. The rationale behind this is
11152: that patches that don't apply cleanly may end up being
11153: applied in the wrong place, and cause severe harm
11154: there.</p>
11155: </div>
11156:
1.67 hubertf 11157: <div class="sect1" lang="en">
1.56 rillig 11158: <div class="titlepage">
11159: <div>
11160: <div>
11161: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11162: "build.tools"></a>14.9. The <span class=
11163: "emphasis"><em>tools</em></span> phase</h2>
1.56 rillig 11164: </div>
11165: </div>
11166: </div>
11167:
1.68 rillig 11168: <p>This is covered in <a href="#tools" title=
11169: "Chapter 15. Tools needed for building or running">
11170: Chapter 15, <i>Tools needed for building or
11171: running</i></a>.</p>
1.56 rillig 11172: </div>
11173:
1.67 hubertf 11174: <div class="sect1" lang="en">
1.56 rillig 11175: <div class="titlepage">
11176: <div>
11177: <div>
11178: <h2 class="title" style="clear: both"><a name=
11179: "build.wrapper"></a>14.10. The <span class=
11180: "emphasis"><em>wrapper</em></span> phase</h2>
11181: </div>
11182: </div>
11183: </div>
11184:
11185: <p>[TODO]</p>
11186: </div>
11187:
1.67 hubertf 11188: <div class="sect1" lang="en">
1.56 rillig 11189: <div class="titlepage">
11190: <div>
11191: <div>
11192: <h2 class="title" style="clear: both"><a name=
11193: "build.configure"></a>14.11. The <span class=
11194: "emphasis"><em>configure</em></span> phase</h2>
11195: </div>
11196: </div>
11197: </div>
11198:
11199: <p>Most pieces of software need information on the header
11200: files, system calls, and library routines which are
11201: available on the platform they run on. The process of
11202: determining this information is known as configuration,
11203: and is usually automated. In most cases, a script is
11204: supplied with the distfiles, and its invocation results
11205: in generation of header files, Makefiles, etc.</p>
11206:
11207: <p>If the package contains a configure script, this can
11208: be invoked by setting <code class=
11209: "varname">HAS_CONFIGURE</code> to “<span class=
11210: "quote">yes</span>”. If the configure script is a
11211: GNU autoconf script, you should set <code class=
11212: "varname">GNU_CONFIGURE</code> to “<span class=
11213: "quote">yes</span>” instead. What happens in the
11214: <span class="emphasis"><em>configure</em></span> phase is
11215: roughly:</p>
11216: <pre class="programlisting">
11217: .for d in ${CONFIGURE_DIRS}
11218: cd ${WRKSRC} && cd ${d} && env ${CONFIGURE_ENV} \
11219: ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
11220: .endfor
11221: </pre>
1.1 grant 11222:
1.56 rillig 11223: <p><code class="varname">CONFIGURE_DIRS</code> (default:
11224: “<span class="quote">.</span>”) is a list of
11225: pathnames relative to <code class=
11226: "varname">WRKSRC</code>. In each of these directories,
11227: the configure script is run with the environment
11228: <code class="varname">CONFIGURE_ENV</code> and arguments
11229: <code class="varname">CONFIGURE_ARGS</code>. The
11230: variables <code class="varname">CONFIGURE_ENV</code>,
11231: <code class="varname">CONFIGURE_SCRIPT</code> (default:
11232: “<span class="quote">./configure</span>”) and
11233: <code class="varname">CONFIGURE_ARGS</code> may all be
11234: changed by the package.</p>
1.1 grant 11235:
1.56 rillig 11236: <p>If the program uses an <code xmlns=
11237: "http://www.w3.org/TR/xhtml1/transitional" class=
11238: "filename">Imakefile</code> for configuration, the
11239: appropriate steps can be invoked by setting <code class=
11240: "varname">USE_IMAKE</code> to “<span class=
11241: "quote">yes</span>”. (If you only want the package
11242: installed in <code class="varname">${X11PREFIX}</code>
11243: but xmkmf not being run, set <code class=
11244: "varname">USE_X11BASE</code> instead.)</p>
11245: </div>
1.1 grant 11246:
1.67 hubertf 11247: <div class="sect1" lang="en">
1.56 rillig 11248: <div class="titlepage">
11249: <div>
11250: <div>
11251: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11252: "build.build"></a>14.12. The <span class=
11253: "emphasis"><em>build</em></span> phase</h2>
1.56 rillig 11254: </div>
11255: </div>
1.1 grant 11256: </div>
11257:
1.56 rillig 11258: <p>For building a package, a rough equivalent of the
11259: following code is executed.</p>
1.1 grant 11260: <pre class="programlisting">
1.56 rillig 11261: .for d in ${BUILD_DIRS}
11262: cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \
11263: ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
11264: -f ${MAKEFILE} ${BUILD_TARGET}
11265: .endfor
1.1 grant 11266: </pre>
1.56 rillig 11267:
11268: <p><code class="varname">BUILD_DIRS</code> (default:
11269: “<span class="quote">.</span>”) is a list of
11270: pathnames relative to <code class=
11271: "varname">WRKSRC</code>. In each of these directories,
11272: <code class="varname">MAKE_PROGRAM</code> is run with the
11273: environment <code class="varname">MAKE_ENV</code> and
11274: arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
11275: The variables <code class="varname">MAKE_ENV</code>,
11276: <code class="varname">BUILD_MAKE_FLAGS</code>,
11277: <code class="varname">MAKEFILE</code> and <code class=
11278: "varname">BUILD_TARGET</code> may all be changed by the
11279: package.</p>
11280:
11281: <p>The default value of <code class=
11282: "varname">MAKE_PROGRAM</code> is “<span class=
11283: "quote">gmake</span>” if <code class=
11284: "varname">USE_TOOLS</code> contains “<span class=
11285: "quote">gmake</span>”, “<span class=
11286: "quote">make</span>” otherwise. The default value
11287: of <code class="varname">MAKEFILE</code> is
11288: “<span class="quote">Makefile</span>”, and
11289: <code class="varname">BUILD_TARGET</code> defaults to
11290: “<span class="quote">all</span>”.</p>
11291: </div>
11292:
1.67 hubertf 11293: <div class="sect1" lang="en">
1.56 rillig 11294: <div class="titlepage">
11295: <div>
11296: <div>
11297: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11298: "build.test"></a>14.13. The <span class=
11299: "emphasis"><em>test</em></span> phase</h2>
1.56 rillig 11300: </div>
11301: </div>
11302: </div>
11303:
11304: <p>[TODO]</p>
11305: </div>
11306:
1.67 hubertf 11307: <div class="sect1" lang="en">
1.56 rillig 11308: <div class="titlepage">
11309: <div>
11310: <div>
11311: <h2 class="title" style="clear: both"><a name=
11312: "build.install"></a>14.14. The <span class=
11313: "emphasis"><em>install</em></span> phase</h2>
11314: </div>
11315: </div>
11316: </div>
11317:
11318: <p>Once the build stage has completed, the final step is
11319: to install the software in public directories, so users
1.68 rillig 11320: can access the programs and files.</p>
11321:
11322: <p>In the <span class="emphasis"><em>install</em></span>
11323: phase, a rough equivalent of the following code is
11324: executed. Additionally, before and after this code, much
11325: magic is performed to do consistency checks, registering
11326: the package, and so on.</p>
11327: <pre class="programlisting">
11328: .for d in ${INSTALL_DIRS}
11329: cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \
11330: ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \
11331: -f ${MAKEFILE} ${BUILD_TARGET}
11332: .endfor
11333: </pre>
11334:
11335: <p>The variable's meanings are analogous to the ones in
11336: the <span class="emphasis"><em>build</em></span> phase.
11337: <code class="varname">INSTALL_DIRS</code> defaults to
11338: <code class="varname">BUILD_DIRS</code>. <code class=
11339: "varname">INSTALL_TARGET</code> is “<span class=
11340: "quote">install</span>” by default, plus
11341: “<span class="quote">install.man</span>” if
11342: <code class="varname">USE_IMAKE</code> is defined.</p>
11343:
11344: <p>In the <span class="emphasis"><em>install</em></span>
11345: phase, the following variables are useful. They are all
11346: variations of the <a href=
11347: "http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
11348: <span class="citerefentry"><span class=
11349: "refentrytitle">install</span>(1)</span></a> command that
11350: have the owner, group and permissions preset.
11351: <code class="varname">INSTALL</code> is the plain install
11352: command. The specialized variants, together with their
11353: intended use, are:</p>
11354:
11355: <div class="variablelist">
11356: <dl>
11357: <dt><span class="term"><code class=
11358: "varname">INSTALL_PROGRAM_DIR</code></span></dt>
11359:
11360: <dd>
11361: <p>directories that contain binaries</p>
11362: </dd>
11363:
11364: <dt><span class="term"><code class=
11365: "varname">INSTALL_SCRIPT_DIR</code></span></dt>
11366:
11367: <dd>
11368: <p>directories that contain scripts</p>
11369: </dd>
11370:
11371: <dt><span class="term"><code class=
11372: "varname">INSTALL_LIB_DIR</code></span></dt>
11373:
11374: <dd>
11375: <p>directories that contain shared and static
11376: libraries</p>
11377: </dd>
11378:
11379: <dt><span class="term"><code class=
11380: "varname">INSTALL_DATA_DIR</code></span></dt>
11381:
11382: <dd>
11383: <p>directories that contain data files</p>
11384: </dd>
11385:
11386: <dt><span class="term"><code class=
11387: "varname">INSTALL_MAN_DIR</code></span></dt>
11388:
11389: <dd>
11390: <p>directories that contain man pages</p>
11391: </dd>
11392:
11393: <dt><span class="term"><code class=
11394: "varname">INSTALL_PROGRAM</code></span></dt>
11395:
11396: <dd>
11397: <p>binaries that can be stripped from debugging
11398: symbols</p>
11399: </dd>
11400:
11401: <dt><span class="term"><code class=
11402: "varname">INSTALL_SCRIPT</code></span></dt>
11403:
11404: <dd>
11405: <p>binaries that cannot be stripped</p>
11406: </dd>
11407:
11408: <dt><span class="term"><code class=
11409: "varname">INSTALL_GAME</code></span></dt>
11410:
11411: <dd>
11412: <p>game binaries</p>
11413: </dd>
11414:
11415: <dt><span class="term"><code class=
11416: "varname">INSTALL_LIB</code></span></dt>
11417:
11418: <dd>
11419: <p>shared and static libraries</p>
11420: </dd>
11421:
11422: <dt><span class="term"><code class=
11423: "varname">INSTALL_DATA</code></span></dt>
11424:
11425: <dd>
11426: <p>data files</p>
11427: </dd>
11428:
11429: <dt><span class="term"><code class=
11430: "varname">INSTALL_GAME_DATA</code></span></dt>
11431:
11432: <dd>
11433: <p>data files for games</p>
11434: </dd>
11435:
11436: <dt><span class="term"><code class=
11437: "varname">INSTALL_MAN</code></span></dt>
11438:
11439: <dd>
11440: <p>man pages</p>
11441: </dd>
11442: </dl>
11443: </div>
11444:
11445: <p>Some other variables are:</p>
11446:
11447: <div class="variablelist">
11448: <dl>
11449: <dt><span class="term"><code class=
11450: "varname">INSTALLATION_DIRS</code></span></dt>
11451:
11452: <dd>
11453: <p>A list of directories relative to <code class=
11454: "varname">PREFIX</code> that are created by pkgsrc
11455: at the beginning of the <span class=
11456: "emphasis"><em>install</em></span> phase. If this
11457: variable is set, <code class=
11458: "varname">NO_MTREE</code>=“<span class=
11459: "quote">yes</span>” is assumed, which means
11460: that the package claims to create all needed
11461: directories itself before installing files to it.
11462: Therefore this variable should only be set in
11463: <code xmlns=
11464: "http://www.w3.org/TR/xhtml1/transitional" class=
11465: "filename">Makefile</code>s that are under control
11466: of the package's author.</p>
11467: </dd>
11468: </dl>
11469: </div>
1.56 rillig 11470: </div>
11471:
1.67 hubertf 11472: <div class="sect1" lang="en">
1.56 rillig 11473: <div class="titlepage">
11474: <div>
11475: <div>
11476: <h2 class="title" style="clear: both"><a name=
11477: "build.package"></a>14.15. The <span class=
11478: "emphasis"><em>package</em></span> phase</h2>
11479: </div>
11480: </div>
11481: </div>
11482:
11483: <p>[TODO]</p>
1.1 grant 11484: </div>
11485:
1.67 hubertf 11486: <div class="sect1" lang="en">
1.1 grant 11487: <div class="titlepage">
11488: <div>
11489: <div>
11490: <h2 class="title" style="clear: both"><a name=
1.56 rillig 11491: "build.helpful-targets"></a>14.16. Other
1.1 grant 11492: helpful targets</h2>
11493: </div>
11494: </div>
11495: </div>
11496:
11497: <div class="variablelist">
11498: <dl>
11499: <dt><span class="term">pre/post-*</span></dt>
11500:
11501: <dd>
11502: <p>For any of the main targets described in the
11503: previous section, two auxiliary targets exist with
11504: “<span class="quote">pre-</span>” and
11505: “<span class="quote">post-</span>” used
11506: as a prefix for the main target's name. These
11507: targets are invoked before and after the main
11508: target is called, allowing extra configuration or
11509: installation steps be performed from a package's
11510: Makefile, for example, which a program's configure
11511: script or install target omitted.</p>
11512: </dd>
11513:
11514: <dt><span class="term">do-*</span></dt>
11515:
11516: <dd>
11517: <p>Should one of the main targets do the wrong
11518: thing, and should there be no variable to fix this,
11519: you can redefine it with the do-* target. (Note
11520: that redefining the target itself instead of the
11521: do-* target is a bad idea, as the pre-* and post-*
11522: targets won't be called anymore, etc.) You will not
11523: usually need to do this.</p>
11524: </dd>
11525:
11526: <dt><span class="term">reinstall</span></dt>
11527:
11528: <dd>
1.14 xtraeme 11529: <p>If you did a <span><strong class="command">make
11530: install</strong></span> and you noticed some file
11531: was not installed properly, you can repeat the
1.1 grant 11532: installation with this target, which will ignore
11533: the “<span class="quote">already
11534: installed</span>” flag.</p>
11535: </dd>
11536:
11537: <dt><span class="term">deinstall</span></dt>
11538:
11539: <dd>
1.24 wiz 11540: <p>This target does a <a href=
11541: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11542: <span class="citerefentry"><span class=
11543: "refentrytitle">pkg_delete</span>(1)</span></a> in
11544: the current directory, effectively de-installing
11545: the package. The following variables can be used to
11546: tune the behaviour:</p>
1.1 grant 11547:
11548: <div class="variablelist">
11549: <dl>
1.14 xtraeme 11550: <dt><span class="term"><code class=
11551: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 11552:
11553: <dd>
11554: <p>Add a "-v" to the <a href=
11555: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11556: <span class="citerefentry"><span class=
11557: "refentrytitle">pkg_delete</span>(1)</span></a>
11558: command.</p>
11559: </dd>
11560:
1.14 xtraeme 11561: <dt><span class="term"><code class=
11562: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 11563:
11564: <dd>
11565: <p>Remove all packages that require (depend
11566: on) the given package. This can be used to
11567: remove any packages that may have been pulled
11568: in by a given package, e.g. if
1.14 xtraeme 11569: <span><strong class="command">make deinstall
11570: DEINSTALLDEPENDS=1</strong></span> is done in
1.45 wiz 11571: <code xmlns=
11572: "http://www.w3.org/TR/xhtml1/transitional"
11573: class="filename">pkgsrc/x11/kde</code>, this
11574: is likely to remove whole KDE. Works by
1.1 grant 11575: adding “<span class=
11576: "quote">-R</span>” to the <a href=
11577: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11578: <span class="citerefentry"><span class=
11579: "refentrytitle">pkg_delete</span>(1)</span></a>
11580: command line.</p>
11581: </dd>
11582: </dl>
11583: </div>
11584: </dd>
11585:
11586: <dt><span class="term">update</span></dt>
11587:
11588: <dd>
11589: <p>This target causes the current package to be
11590: updated to the latest version. The package and all
11591: depending packages first get de-installed, then
11592: current versions of the corresponding packages get
11593: compiled and installed. This is similar to manually
11594: noting which packages are currently installed, then
1.14 xtraeme 11595: performing a series of <span><strong class=
11596: "command">make deinstall</strong></span> and
11597: <span><strong class="command">make
11598: install</strong></span> (or whatever <code class=
11599: "varname">UPDATE_TARGET</code> is set to) for these
11600: packages.</p>
1.1 grant 11601:
11602: <p>You can use the “<span class=
11603: "quote">update</span>” target to resume
1.14 xtraeme 11604: package updating in case a previous
11605: <span><strong class="command">make
11606: update</strong></span> was interrupted for some
11607: reason. However, in this case, make sure you don't
11608: call <span><strong class="command">make
11609: clean</strong></span> or otherwise remove the list
11610: of dependent packages in <code class=
1.47 reed 11611: "varname">WRKDIR</code>. Otherwise, you lose the
1.1 grant 11612: ability to automatically update the current package
11613: along with the dependent packages you have
11614: installed.</p>
11615:
1.14 xtraeme 11616: <p>Resuming an interrupted <span><strong class=
11617: "command">make update</strong></span> will only
11618: work as long as the package tree remains unchanged.
11619: If the source code for one of the packages to be
11620: updated has been changed, resuming
11621: <span><strong class="command">make
11622: update</strong></span> will most certainly
11623: fail!</p>
1.1 grant 11624:
11625: <p>The following variables can be used either on
1.45 wiz 11626: the command line or in <code xmlns=
11627: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11628: "filename">/etc/mk.conf</code> to alter the
11629: behaviour of <span><strong class="command">make
11630: update</strong></span>:</p>
1.1 grant 11631:
11632: <div class="variablelist">
11633: <dl>
1.14 xtraeme 11634: <dt><span class="term"><code class=
11635: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 11636:
11637: <dd>
11638: <p>Install target to recursively use for the
11639: updated package and the dependent packages.
1.14 xtraeme 11640: Defaults to <code class=
11641: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 11642: “<span class=
11643: "quote">install</span>” otherwise for
1.14 xtraeme 11644: <span><strong class="command">make
11645: update</strong></span>. e.g.
11646: <span><strong class="command">make update
11647: UPDATE_TARGET=package</strong></span></p>
1.1 grant 11648: </dd>
11649:
1.14 xtraeme 11650: <dt><span class="term"><code class=
11651: "varname">NOCLEAN</code></span></dt>
1.1 grant 11652:
11653: <dd>
11654: <p>Don't clean up after updating. Useful if
11655: you want to leave the work sources of the
11656: updated packages around for inspection or
11657: other purposes. Be sure you eventually clean
11658: up the source tree (see the
11659: “<span class=
11660: "quote">clean-update</span>” target
11661: below) or you may run into troubles with old
11662: source code still lying around on your next
1.14 xtraeme 11663: <span><strong class=
11664: "command">make</strong></span> or
11665: <span><strong class="command">make
11666: update</strong></span>.</p>
1.1 grant 11667: </dd>
11668:
1.14 xtraeme 11669: <dt><span class="term"><code class=
11670: "varname">REINSTALL</code></span></dt>
1.1 grant 11671:
11672: <dd>
11673: <p>Deinstall each package before installing
1.14 xtraeme 11674: (making <code class=
11675: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 11676: necessary if the “<span class=
11677: "quote">clean-update</span>” target
11678: (see below) was called after interrupting a
1.14 xtraeme 11679: running <span><strong class="command">make
11680: update</strong></span>.</p>
1.1 grant 11681: </dd>
11682:
1.14 xtraeme 11683: <dt><span class="term"><code class=
11684: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 11685:
11686: <dd>
11687: <p>Allows you to disable recursion and
11688: hardcode the target for packages. The default
11689: is “<span class=
11690: "quote">update</span>” for the update
11691: target, facilitating a recursive update of
1.14 xtraeme 11692: prerequisite packages. Only set <code class=
11693: "varname">DEPENDS_TARGET</code> if you want
11694: to disable recursive updates. Use
11695: <code class="varname">UPDATE_TARGET</code>
11696: instead to just set a specific target for
11697: each package to be installed during
11698: <span><strong class="command">make
11699: update</strong></span> (see above).</p>
1.1 grant 11700: </dd>
11701: </dl>
11702: </div>
11703: </dd>
11704:
11705: <dt><span class="term">clean-update</span></dt>
11706:
11707: <dd>
11708: <p>Clean the source tree for all packages that
1.14 xtraeme 11709: would get updated if <span><strong class=
11710: "command">make update</strong></span> was called
11711: from the current directory. This target should not
11712: be used if the current package (or any of its
11713: depending packages) have already been de-installed
11714: (e.g., after calling <span><strong class=
11715: "command">make update</strong></span>) or you may
11716: lose some packages you intended to update. As a
11717: rule of thumb: only use this target <span class=
11718: "emphasis"><em>before</em></span> the first time
11719: you run <span><strong class="command">make
11720: update</strong></span> and only if you have a dirty
11721: package tree (e.g., if you used <code class=
11722: "varname">NOCLEAN</code>).</p>
1.1 grant 11723:
1.47 reed 11724: <p>If you are unsure about whether your tree is
11725: clean, you can either perform a
1.14 xtraeme 11726: <span><strong class="command">make
1.47 reed 11727: clean</strong></span> at the top of the tree, or
11728: use the following sequence of commands from the
11729: directory of the package you want to update
11730: (<span class="emphasis"><em>before</em></span>
11731: running <span><strong class="command">make
1.14 xtraeme 11732: update</strong></span> for the first time,
11733: otherwise you lose all the packages you wanted to
11734: update!):</p>
1.1 grant 11735: <pre class="screen">
1.14 xtraeme 11736: <code class="prompt">#</code> <strong class=
11737: "userinput"><code>make clean-update</code></strong>
11738: <code class="prompt">#</code> <strong class=
11739: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
11740: <code class="prompt">#</code> <strong class=
11741: "userinput"><code>make update</code></strong>
1.1 grant 11742: </pre>
11743:
11744: <p>The following variables can be used either on
1.45 wiz 11745: the command line or in <code xmlns=
11746: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11747: "filename">/etc/mk.conf</code> to alter the
11748: behaviour of <span><strong class="command">make
11749: clean-update</strong></span>:</p>
1.1 grant 11750:
11751: <div class="variablelist">
11752: <dl>
1.14 xtraeme 11753: <dt><span class="term"><code class=
11754: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 11755:
11756: <dd>
1.14 xtraeme 11757: <p>After <span><strong class="command">make
11758: clean</strong></span>, do not reconstruct the
11759: list of directories to update for this
11760: package. Only use this if
11761: <span><strong class="command">make
11762: update</strong></span> successfully installed
11763: all packages you wanted to update. Normally,
11764: this is done automatically on
11765: <span><strong class="command">make
11766: update</strong></span>, but may have been
11767: suppressed by the <code class=
11768: "varname">NOCLEAN</code> variable (see
1.1 grant 11769: above).</p>
11770: </dd>
11771: </dl>
11772: </div>
11773: </dd>
11774:
11775: <dt><span class="term">info</span></dt>
11776:
11777: <dd>
11778: <p>This target invokes <a href=
11779: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11780: <span class="citerefentry"><span class=
11781: "refentrytitle">pkg_info</span>(1)</span></a> for
11782: the current package. You can use this to check
11783: which version of a package is installed.</p>
11784: </dd>
11785:
11786: <dt><span class="term">readme</span></dt>
11787:
11788: <dd>
1.45 wiz 11789: <p>This target generates a <code xmlns=
11790: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11791: "filename">README.html</code> file, which can be
1.1 grant 11792: viewed using a browser such as <a xmlns=
11793: "http://www.w3.org/TR/xhtml1/transitional" href=
11794: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 11795: target="_top"><code xmlns="" class=
11796: "filename">www/mozilla</code></a> or <a xmlns=
1.20 ben 11797: "http://www.w3.org/TR/xhtml1/transitional" href=
11798: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45 wiz 11799: target="_top"><code xmlns="" class=
11800: "filename">www/links</code></a>. The generated
11801: files contain references to any packages which are
11802: in the <code class="varname">PACKAGES</code>
11803: directory on the local host. The generated files
11804: can be made to refer to URLs based on <code class=
1.20 ben 11805: "varname">FTP_PKG_URL_HOST</code> and <code class=
11806: "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45 wiz 11807: wanted to generate <code xmlns=
11808: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11809: "filename">README.html</code> files which pointed
11810: to binary packages on the local machine, in the
1.45 wiz 11811: directory <code xmlns=
11812: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11813: "filename">/usr/packages</code>, set <code class=
11814: "varname">FTP_PKG_URL_HOST=file://localhost</code>
11815: and <code class=
11816: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
11817: <code class="varname">${PACKAGES}</code> directory
11818: and its subdirectories will be searched for all the
11819: binary packages.</p>
1.1 grant 11820: </dd>
11821:
11822: <dt><span class="term">readme-all</span></dt>
11823:
11824: <dd>
1.45 wiz 11825: <p>Use this target to create a file <code xmlns=
11826: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11827: "filename">README-all.html</code> which contains a
1.1 grant 11828: list of all packages currently available in the
11829: NetBSD Packages Collection, together with the
11830: category they belong to and a short description.
1.45 wiz 11831: This file is compiled from the <code xmlns=
11832: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11833: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 11834: sure to run this <span class=
1.14 xtraeme 11835: "emphasis"><em>after</em></span> a
11836: <span><strong class="command">make
11837: readme</strong></span>.</p>
1.1 grant 11838: </dd>
11839:
11840: <dt><span class="term">cdrom-readme</span></dt>
11841:
11842: <dd>
11843: <p>This is very much the same as the
11844: “<span class="quote">readme</span>”
11845: target (see above), but is to be used when
11846: generating a pkgsrc tree to be written to a CD-ROM.
1.45 wiz 11847: This target also produces <code xmlns=
11848: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11849: "filename">README.html</code> files, and can be
11850: made to refer to URLs based on <code class=
11851: "varname">CDROM_PKG_URL_HOST</code> and
11852: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 11853: </dd>
11854:
11855: <dt><span class="term">show-distfiles</span></dt>
11856:
11857: <dd>
11858: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 11859: are needed to build the package. (<code class=
11860: "varname">DISTFILES</code> and <code class=
1.45 wiz 11861: "varname">PATCHFILES</code>, but not <code xmlns=
11862: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11863: "filename">patches/*</code>)</p>
1.1 grant 11864: </dd>
11865:
11866: <dt><span class="term">show-downlevel</span></dt>
11867:
11868: <dd>
11869: <p>This target shows nothing if the package is not
11870: installed. If a version of this package is
11871: installed, but is not the version provided in this
11872: version of pkgsrc, then a warning message is
11873: displayed. This target can be used to show which of
11874: your installed packages are downlevel, and so the
11875: old versions can be deleted, and the current ones
11876: added.</p>
11877: </dd>
11878:
11879: <dt><span class="term">show-pkgsrc-dir</span></dt>
11880:
11881: <dd>
11882: <p>This target shows the directory in the pkgsrc
11883: hierarchy from which the package can be built and
11884: installed. This may not be the same directory as
11885: the one from which the package was installed. This
11886: target is intended to be used by people who may
11887: wish to upgrade many packages on a single host, and
11888: can be invoked from the top-level pkgsrc Makefile
11889: by using the “<span class=
11890: "quote">show-host-specific-pkgs</span>”
11891: target.</p>
11892: </dd>
11893:
11894: <dt><span class=
11895: "term">show-installed-depends</span></dt>
11896:
11897: <dd>
11898: <p>This target shows which installed packages match
1.14 xtraeme 11899: the current package's <code class=
11900: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 11901: dependencies are causing build problems.</p>
11902: </dd>
11903:
11904: <dt><span class="term">check-shlibs</span></dt>
11905:
11906: <dd>
11907: <p>After a package is installed, check all its
11908: binaries and (on ELF platforms) shared libraries to
11909: see if they find the shared libs they need. Run by
1.14 xtraeme 11910: default if <code class=
11911: "varname">PKG_DEVELOPER</code> is set in
1.45 wiz 11912: <code xmlns=
11913: "http://www.w3.org/TR/xhtml1/transitional" class=
11914: "filename">/etc/mk.conf</code>.</p>
1.1 grant 11915: </dd>
11916:
11917: <dt><span class="term">print-PLIST</span></dt>
11918:
11919: <dd>
11920: <p>After a “<span class="quote">make
11921: install</span>” from a new or upgraded pkg,
11922: this prints out an attempt to generate a new
1.45 wiz 11923: <code xmlns=
11924: "http://www.w3.org/TR/xhtml1/transitional" class=
11925: "filename">PLIST</code> from a <span><strong class=
11926: "command">find -newer
1.14 xtraeme 11927: work/.extract_done</strong></span>. An attempt is
11928: made to care for shared libs etc., but it is
1.1 grant 11929: <span class="emphasis"><em>strongly</em></span>
11930: recommended to review the result before putting it
1.45 wiz 11931: into <code xmlns=
11932: "http://www.w3.org/TR/xhtml1/transitional" class=
11933: "filename">PLIST</code>. On upgrades, it's useful
11934: to diff the output of this command against an
11935: already existing <code xmlns=
11936: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11937: "filename">PLIST</code> file.</p>
1.1 grant 11938:
1.24 wiz 11939: <p>If the package installs files via <a href=
11940: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
11941: <span class="citerefentry"><span class=
11942: "refentrytitle">tar</span>(1)</span></a> or other
11943: methods that don't update file access times, be
11944: sure to add these files manually to your
1.45 wiz 11945: <code xmlns=
11946: "http://www.w3.org/TR/xhtml1/transitional" class=
11947: "filename">PLIST</code>, as the “<span class=
11948: "quote">find -newer</span>” command used by
11949: this target won't catch them!</p>
1.1 grant 11950:
11951: <p>See <a href="#print-PLIST" title=
1.38 dillo 11952: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 11953: “Tweaking output of <span><strong class=
11954: "command">make
11955: print-PLIST</strong></span>”</a> for more
11956: information on this target.</p>
1.1 grant 11957: </dd>
11958:
11959: <dt><span class="term">bulk-package</span></dt>
11960:
11961: <dd>
11962: <p>Used to do bulk builds. If an appropriate binary
11963: package already exists, no action is taken. If not,
11964: this target will compile, install and package it
1.47 reed 11965: (and its depends, if <code class=
1.14 xtraeme 11966: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 11967: <a href="#binary.configuration" title=
1.38 dillo 11968: "6.3.1. Configuration">Section 6.3.1,
1.47 reed 11969: “Configuration”</a>). After creating
11970: the binary package, the sources, the just-installed
11971: package and its required packages are removed,
1.1 grant 11972: preserving free disk space.</p>
11973:
11974: <p><span class="emphasis"><em>Beware that this
11975: target may deinstall all packages installed on a
11976: system!</em></span></p>
11977: </dd>
11978:
11979: <dt><span class="term">bulk-install</span></dt>
11980:
11981: <dd>
11982: <p>Used during bulk-installs to install required
1.47 reed 11983: packages. If an up-to-date binary package is
1.1 grant 11984: available, it will be installed via <a href=
11985: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
11986: <span class="citerefentry"><span class=
11987: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 11988: not, <span><strong class="command">make
11989: bulk-package</strong></span> will be executed, but
1.47 reed 11990: the installed binary won't be removed.</p>
1.1 grant 11991:
11992: <p>A binary package is considered
1.47 reed 11993: “<span class="quote">up-to-date</span>”
1.1 grant 11994: to be installed via <a href=
11995: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
11996: <span class="citerefentry"><span class=
11997: "refentrytitle">pkg_add</span>(1)</span></a>
11998: if:</p>
11999:
12000: <div class="itemizedlist">
12001: <ul type="disc">
12002: <li>
1.45 wiz 12003: <p>None of the package's files (<code xmlns=
12004: "http://www.w3.org/TR/xhtml1/transitional"
12005: class="filename">Makefile</code>, ...) were
1.14 xtraeme 12006: modified since it was built.</p>
1.1 grant 12007: </li>
12008:
12009: <li>
12010: <p>None of the package's required (binary)
12011: packages were modified since it was
12012: built.</p>
12013: </li>
12014: </ul>
12015: </div>
12016:
12017: <p><span class="emphasis"><em>Beware that this
12018: target may deinstall all packages installed on a
12019: system!</em></span></p>
12020: </dd>
12021: </dl>
12022: </div>
12023: </div>
12024: </div>
12025:
1.67 hubertf 12026: <div class="chapter" lang="en">
1.1 grant 12027: <div class="titlepage">
12028: <div>
12029: <div>
1.67 hubertf 12030: <h2 class="title"><a name=
1.68 rillig 12031: "tools"></a>Chapter 15. Tools needed for
12032: building or running</h2>
12033: </div>
12034: </div>
12035: </div>
12036:
12037: <div class="toc">
12038: <p><b>Table of Contents</b></p>
12039:
12040: <dl>
12041: <dt><span class="sect1"><a href="#pkgsrc-tools">15.1.
12042: Tools for pkgsrc builds</a></span></dt>
12043:
12044: <dt><span class="sect1"><a href="#package-tools">15.2.
12045: Tools needed by packages</a></span></dt>
12046:
12047: <dt><span class="sect1"><a href="#platform-tools">15.3.
12048: Tools provided by platforms</a></span></dt>
12049: </dl>
12050: </div>
12051:
12052: <p>The <code class="varname">USE_TOOLS</code> definition is
12053: used both internally by pkgsrc and also for individual
12054: packages to define what commands are needed for building a
12055: package (like <code class="varname">BUILD_DEPENDS</code>)
12056: or for later run-time of an installed packaged (such as
12057: <code class="varname">DEPENDS</code>). If the native system
12058: provides an adequate tool, then in many cases, a pkgsrc
12059: package will not be used.</p>
12060:
12061: <p>When building a package, the replacement tools are made
12062: available in a directory (as symlinks or wrapper scripts)
12063: that is early in the executable search path. Just like the
12064: buildlink system, this helps with consistent builds.</p>
12065:
12066: <p>A tool may be needed to help build a specific package.
12067: For example, perl, GNU make (gmake) or yacc may be
12068: needed.</p>
12069:
12070: <p>Also a tool may be needed, for example, because the
12071: native system's supplied tool may be inefficient for
12072: building a package with pkgsrc. For example, a package may
12073: need GNU awk, bison (instead of yacc) or a better sed.</p>
12074:
12075: <p>The tools used by a package can be listed by running
12076: <span><strong class="command">make
12077: show-tools</strong></span>.</p>
12078:
12079: <div class="sect1" lang="en">
12080: <div class="titlepage">
12081: <div>
12082: <div>
12083: <h2 class="title" style="clear: both"><a name=
12084: "pkgsrc-tools"></a>15.1. Tools for pkgsrc
12085: builds</h2>
12086: </div>
12087: </div>
12088: </div>
12089:
12090: <p>The default set of tools used by pkgsrc is defined in
12091: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12092: class="filename">bsd.pkg.mk</code>. This includes
12093: standard Unix tools, such as: <span><strong class=
12094: "command">cat</strong></span>, <span><strong class=
12095: "command">awk</strong></span>, <span><strong class=
12096: "command">chmod</strong></span>, <span><strong class=
12097: "command">test</strong></span>, and so on. These can be
12098: seen by running: <span><strong class="command">make
12099: show-var VARNAME=USE_TOOLS</strong></span>.</p>
12100:
12101: <p>If a package needs a specific program to build then
12102: the <code class="varname">USE_TOOLS</code> variable can
12103: be used to define the tools needed.</p>
12104: </div>
12105:
12106: <div class="sect1" lang="en">
12107: <div class="titlepage">
12108: <div>
12109: <div>
12110: <h2 class="title" style="clear: both"><a name=
12111: "package-tools"></a>15.2. Tools needed by
12112: packages</h2>
12113: </div>
12114: </div>
12115: </div>
12116:
12117: <p>In the following examples, the :pkgsrc means to use
12118: the pkgsrc version and not the native version for a build
12119: dependency. And the :run means that it is used for a
12120: run-time dependencies also (and becomes a DEPENDS). The
12121: default is a build dependency which can be set with
12122: :build. (So in this example, it is the same as
12123: gmake:build and pkg-config:build.)</p>
12124: <pre class="programlisting">
12125: USE_TOOLS+= mktemp:pkgsrc
12126: USE_TOOLS+= gmake perl:run pkg-config
12127: </pre>
12128:
12129: <p>When using the tools framework, a <code class=
12130: "varname">TOOLS_PATH.foo</code> variable is defined which
12131: contains the full path to the appropriate tool. For
12132: example, <code class="varname">TOOLS_PATH.bash</code>
12133: could be “<span class=
12134: "quote">/bin/bash</span>” on Linux systems.</p>
12135:
12136: <p>If you always need a pkgsrc version of the tool at
12137: run-time, then just use <code class=
12138: "varname">DEPENDS</code> instead.</p>
12139: </div>
12140:
12141: <div class="sect1" lang="en">
12142: <div class="titlepage">
12143: <div>
12144: <div>
12145: <h2 class="title" style="clear: both"><a name=
12146: "platform-tools"></a>15.3. Tools provided by
12147: platforms</h2>
12148: </div>
12149: </div>
12150: </div>
12151:
12152: <p>When improving or porting pkgsrc to a new platform,
12153: have a look at (or create) the corresponding platform
12154: specific make file fragment under <code xmlns=
12155: "http://www.w3.org/TR/xhtml1/transitional" class=
12156: "filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which
12157: defines the name of the common tools. For example:</p>
12158: <pre class="programlisting">
12159: .if exists(/usr/bin/bzcat)
12160: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
12161: .elif exists(/usr/bin/bzip2)
12162: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
12163: .endif
12164:
12165: TOOLS_PLATFORM.true?= true # shell builtin
12166: </pre>
12167: </div>
12168: </div>
12169:
12170: <div class="chapter" lang="en">
12171: <div class="titlepage">
12172: <div>
12173: <div>
12174: <h2 class="title"><a name=
12175: "fixes"></a>Chapter 16. Making your package
1.55 rillig 12176: work</h2>
1.1 grant 12177: </div>
12178: </div>
12179: </div>
12180:
12181: <div class="toc">
12182: <p><b>Table of Contents</b></p>
12183:
12184: <dl>
1.30 wiz 12185: <dt><span class="sect1"><a href=
1.68 rillig 12186: "#general-operation">16.1. General
1.30 wiz 12187: operation</a></span></dt>
1.1 grant 12188:
12189: <dd>
12190: <dl>
12191: <dt><span class="sect2"><a href=
1.68 rillig 12192: "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30 wiz 12193: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 12194:
12195: <dt><span class="sect2"><a href=
1.68 rillig 12196: "#where-to-install-documentation">16.1.2. Where to
1.31 wiz 12197: install documentation</a></span></dt>
12198:
12199: <dt><span class="sect2"><a href=
1.68 rillig 12200: "#restricted-packages">16.1.3. Restricted
1.1 grant 12201: packages</a></span></dt>
12202:
12203: <dt><span class="sect2"><a href=
1.68 rillig 12204: "#dependencies">16.1.4. Handling
1.1 grant 12205: dependencies</a></span></dt>
12206:
12207: <dt><span class="sect2"><a href=
1.68 rillig 12208: "#conflicts">16.1.5. Handling conflicts with other
1.1 grant 12209: packages</a></span></dt>
12210:
12211: <dt><span class="sect2"><a href=
1.68 rillig 12212: "#not-building-packages">16.1.6. Packages that
1.30 wiz 12213: cannot or should not be built</a></span></dt>
1.1 grant 12214:
12215: <dt><span class="sect2"><a href=
1.68 rillig 12216: "#undeletable-packages">16.1.7. Packages which
1.30 wiz 12217: should not be deleted, once
12218: installed</a></span></dt>
1.1 grant 12219:
12220: <dt><span class="sect2"><a href=
1.68 rillig 12221: "#security-handling">16.1.8. Handling packages with
1.1 grant 12222: security problems</a></span></dt>
12223:
12224: <dt><span class="sect2"><a href=
1.68 rillig 12225: "#compiler-bugs">16.1.9. How to handle compiler
1.1 grant 12226: bugs</a></span></dt>
12227:
12228: <dt><span class="sect2"><a href=
1.68 rillig 12229: "#bumping-pkgrevision">16.1.10. How to handle
1.30 wiz 12230: incrementing versions when fixing an existing
1.1 grant 12231: package</a></span></dt>
12232:
12233: <dt><span class="sect2"><a href=
1.68 rillig 12234: "#portability-of-packages">16.1.11. Portability of
1.1 grant 12235: packages</a></span></dt>
12236: </dl>
12237: </dd>
12238:
1.30 wiz 12239: <dt><span class="sect1"><a href=
1.68 rillig 12240: "#downloading-issues">16.2. Possible downloading
1.30 wiz 12241: issues</a></span></dt>
1.1 grant 12242:
12243: <dd>
12244: <dl>
12245: <dt><span class="sect2"><a href=
1.68 rillig 12246: "#no-plain-download">16.2.1. Packages whose
1.30 wiz 12247: distfiles aren't available for plain
1.1 grant 12248: downloading</a></span></dt>
12249:
12250: <dt><span class="sect2"><a href=
1.68 rillig 12251: "#modified-distfiles-same-name">16.2.2. How to
1.30 wiz 12252: handle modified distfiles with the 'old'
12253: name</a></span></dt>
1.1 grant 12254: </dl>
12255: </dd>
12256:
1.30 wiz 12257: <dt><span class="sect1"><a href=
1.68 rillig 12258: "#configuration-gotchas">16.3. Configuration
1.30 wiz 12259: gotchas</a></span></dt>
1.1 grant 12260:
12261: <dd>
12262: <dl>
12263: <dt><span class="sect2"><a href=
1.68 rillig 12264: "#fixes.libtool">16.3.1. Shared libraries -
1.1 grant 12265: libtool</a></span></dt>
12266:
12267: <dt><span class="sect2"><a href=
1.68 rillig 12268: "#using-libtool">16.3.2. Using libtool on GNU
1.30 wiz 12269: packages that already support
12270: libtool</a></span></dt>
1.1 grant 12271:
12272: <dt><span class="sect2"><a href=
1.68 rillig 12273: "#autoconf-automake">16.3.3. GNU
1.1 grant 12274: Autoconf/Automake</a></span></dt>
12275: </dl>
12276: </dd>
12277:
1.68 rillig 12278: <dt><span class="sect1"><a href="#fixes-build">16.4.
1.55 rillig 12279: Building the package</a></span></dt>
1.1 grant 12280:
12281: <dd>
12282: <dl>
12283: <dt><span class="sect2"><a href=
1.68 rillig 12284: "#cpp-defines">16.4.1. CPP defines</a></span></dt>
1.51 rillig 12285:
1.60 rillig 12286: <dt><span class="sect2"><a href=
1.68 rillig 12287: "#cpp-list-examples">16.4.2. Examples of CPP
1.60 rillig 12288: defines for some platforms</a></span></dt>
12289:
1.68 rillig 12290: <dt><span class="sect2"><a href="#cpp-list">16.4.3.
1.51 rillig 12291: Getting a list of CPP defines</a></span></dt>
1.1 grant 12292: </dl>
12293: </dd>
12294:
1.30 wiz 12295: <dt><span class="sect1"><a href=
1.68 rillig 12296: "#package-specific-actions">16.5. Package specific
1.30 wiz 12297: actions</a></span></dt>
1.1 grant 12298:
12299: <dd>
12300: <dl>
12301: <dt><span class="sect2"><a href=
1.68 rillig 12302: "#user-interaction">16.5.1. User
1.2 hubertf 12303: interaction</a></span></dt>
1.1 grant 12304:
12305: <dt><span class="sect2"><a href=
1.68 rillig 12306: "#handling-licenses">16.5.2. Handling
1.1 grant 12307: licenses</a></span></dt>
12308:
12309: <dt><span class="sect2"><a href=
1.68 rillig 12310: "#installing-score-files">16.5.3. Installing score
1.1 grant 12311: files</a></span></dt>
12312:
12313: <dt><span class="sect2"><a href=
1.68 rillig 12314: "#perl-scripts">16.5.4. Packages containing perl
1.1 grant 12315: scripts</a></span></dt>
12316:
12317: <dt><span class="sect2"><a href=
1.68 rillig 12318: "#hardcoded-paths">16.5.5. Packages with hardcoded
1.30 wiz 12319: paths to other interpreters</a></span></dt>
1.1 grant 12320:
12321: <dt><span class="sect2"><a href=
1.68 rillig 12322: "#perl-modules">16.5.6. Packages installing perl
1.1 grant 12323: modules</a></span></dt>
12324:
12325: <dt><span class="sect2"><a href=
1.68 rillig 12326: "#faq.info-files">16.5.7. Packages installing info
1.1 grant 12327: files</a></span></dt>
12328:
1.68 rillig 12329: <dt><span class="sect2"><a href="#manpages">16.5.8.
1.57 minskim 12330: Packages installing man pages</a></span></dt>
12331:
1.1 grant 12332: <dt><span class="sect2"><a href=
1.68 rillig 12333: "#gconf2-data-files">16.5.9. Packages installing
1.30 wiz 12334: GConf2 data files</a></span></dt>
1.1 grant 12335:
12336: <dt><span class="sect2"><a href=
1.68 rillig 12337: "#scrollkeeper-data-files">16.5.10. Packages
1.30 wiz 12338: installing scrollkeeper data files</a></span></dt>
1.1 grant 12339:
12340: <dt><span class="sect2"><a href=
1.68 rillig 12341: "#x11-fonts">16.5.11. Packages installing X11
1.1 grant 12342: fonts</a></span></dt>
12343:
12344: <dt><span class="sect2"><a href=
1.68 rillig 12345: "#gtk2-modules">16.5.12. Packages installing GTK2
1.1 grant 12346: modules</a></span></dt>
12347:
12348: <dt><span class="sect2"><a href=
1.68 rillig 12349: "#sgml-xml-data">16.5.13. Packages installing SGML
1.30 wiz 12350: or XML data</a></span></dt>
1.1 grant 12351:
12352: <dt><span class="sect2"><a href=
1.68 rillig 12353: "#mime-database">16.5.14. Packages installing
1.1 grant 12354: extensions to the MIME database</a></span></dt>
12355:
12356: <dt><span class="sect2"><a href=
1.68 rillig 12357: "#intltool">16.5.15. Packages using
1.1 grant 12358: intltool</a></span></dt>
1.18 xtraeme 12359:
12360: <dt><span class="sect2"><a href=
1.68 rillig 12361: "#startup-scripts">16.5.16. Packages installing
1.30 wiz 12362: startup scripts</a></span></dt>
1.57 minskim 12363:
12364: <dt><span class="sect2"><a href=
1.68 rillig 12365: "#tex-packages">16.5.17. Packages installing TeX
1.57 minskim 12366: modules</a></span></dt>
1.1 grant 12367: </dl>
12368: </dd>
12369:
1.30 wiz 12370: <dt><span class="sect1"><a href=
1.68 rillig 12371: "#feedback-to-author">16.6. Feedback to the
1.30 wiz 12372: author</a></span></dt>
1.1 grant 12373: </dl>
12374: </div>
12375:
1.67 hubertf 12376: <div class="sect1" lang="en">
1.1 grant 12377: <div class="titlepage">
12378: <div>
12379: <div>
12380: <h2 class="title" style="clear: both"><a name=
1.68 rillig 12381: "general-operation"></a>16.1. General
1.1 grant 12382: operation</h2>
12383: </div>
12384: </div>
12385: </div>
12386:
1.67 hubertf 12387: <div class="sect2" lang="en">
1.1 grant 12388: <div class="titlepage">
12389: <div>
12390: <div>
1.30 wiz 12391: <h3 class="title"><a name=
1.68 rillig 12392: "pulling-vars-from-etc-mk.conf"></a>16.1.1. How
1.30 wiz 12393: to pull in variables from /etc/mk.conf</h3>
1.1 grant 12394: </div>
12395: </div>
12396: </div>
12397:
12398: <p>The problem with package-defined variables that can
1.14 xtraeme 12399: be overridden via <code class="varname">MAKECONF</code>
1.45 wiz 12400: or <code xmlns=
12401: "http://www.w3.org/TR/xhtml1/transitional" class=
12402: "filename">/etc/mk.conf</code> is that <a href=
1.1 grant 12403: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
12404: <span class="citerefentry"><span class=
12405: "refentrytitle">make</span>(1)</span></a> expands a
1.47 reed 12406: variable as it is used, but evaluates preprocessor-like
1.1 grant 12407: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 12408: So, to use any variable (which may be set in
1.45 wiz 12409: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12410: class="filename">/etc/mk.conf</code>) in one of the
12411: .if* statements, the file <code xmlns=
12412: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12413: "filename">/etc/mk.conf</code> must be included before
1.1 grant 12414: that .if* statement.</p>
12415:
1.47 reed 12416: <p>Rather than having a number of ad-hoc ways of
1.45 wiz 12417: including <code xmlns=
12418: "http://www.w3.org/TR/xhtml1/transitional" class=
12419: "filename">/etc/mk.conf</code>, should it exist, or
12420: <code class="varname">MAKECONF</code>, should it exist,
12421: include the <code xmlns=
12422: "http://www.w3.org/TR/xhtml1/transitional" class=
12423: "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
12424: package Makefile before any preprocessor-like .if,
12425: .ifdef, or .ifndef statements:</p>
1.1 grant 12426: <pre class="programlisting">
1.51 rillig 12427: .include "../../mk/bsd.prefs.mk"
12428:
1.1 grant 12429: .if defined(USE_MENUS)
1.51 rillig 12430: # ...
1.1 grant 12431: .endif
12432: </pre>
12433:
1.14 xtraeme 12434: <p>If you wish to set the <code class=
1.45 wiz 12435: "varname">CFLAGS</code> variable in <code xmlns=
12436: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 12437: "filename">/etc/mk.conf</code>, please make sure to
1.1 grant 12438: use:</p>
12439: <pre class="programlisting">
1.51 rillig 12440: CFLAGS+= -your -flags
1.1 grant 12441: </pre>
12442:
1.14 xtraeme 12443: <p>Using <code class="varname">CFLAGS=</code> (i.e.
12444: without the “<span class="quote">+</span>”)
12445: may lead to problems with packages that need to add
12446: their own flags. Also, you may want to take a look at
12447: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 12448: href=
12449: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 12450: target="_top"><code xmlns="" class=
12451: "filename">devel/cpuflags</code></a> package if you're
1.20 ben 12452: interested in optimization for the current CPU.</p>
1.1 grant 12453: </div>
12454:
1.67 hubertf 12455: <div class="sect2" lang="en">
1.1 grant 12456: <div class="titlepage">
12457: <div>
12458: <div>
1.31 wiz 12459: <h3 class="title"><a name=
1.68 rillig 12460: "where-to-install-documentation"></a>16.1.2. Where
1.31 wiz 12461: to install documentation</h3>
12462: </div>
12463: </div>
12464: </div>
12465:
1.45 wiz 12466: <p>Documentation should be installed into <code xmlns=
12467: "http://www.w3.org/TR/xhtml1/transitional" class=
1.31 wiz 12468: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45 wiz 12469: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12470: class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
12471: (the latter includes the version number of the
12472: package).</p>
1.31 wiz 12473: </div>
12474:
1.67 hubertf 12475: <div class="sect2" lang="en">
1.31 wiz 12476: <div class="titlepage">
12477: <div>
12478: <div>
1.67 hubertf 12479: <h3 class="title"><a name=
1.68 rillig 12480: "restricted-packages"></a>16.1.3. Restricted
1.1 grant 12481: packages</h3>
12482: </div>
12483: </div>
12484: </div>
12485:
12486: <p>Some licenses restrict how software may be
12487: re-distributed. In order to satisfy these restrictions,
12488: the package system defines five make variables that can
12489: be set to note these restrictions:</p>
12490:
12491: <div class="itemizedlist">
12492: <ul type="disc">
12493: <li>
1.14 xtraeme 12494: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 12495:
12496: <p>This variable should be set whenever a
12497: restriction exists (regardless of its kind). Set
12498: this variable to a string containing the reason
12499: for the restriction.</p>
12500: </li>
12501:
12502: <li>
1.14 xtraeme 12503: <p><code class=
12504: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 12505:
12506: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 12507: variable to <code class=
12508: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 12509: package may not be included on a CD-ROM.</p>
12510: </li>
12511:
12512: <li>
1.14 xtraeme 12513: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 12514:
12515: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 12516: Set this variable to <code class=
12517: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 12518: package may not not be made available on the
12519: Internet.</p>
12520: </li>
12521:
12522: <li>
1.14 xtraeme 12523: <p><code class=
12524: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 12525:
12526: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 12527: this variable to <code class=
12528: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 12529: of the source code or other distfile(s) is not
12530: allowed on CD-ROMs.</p>
12531: </li>
12532:
12533: <li>
1.14 xtraeme 12534: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 12535:
12536: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 12537: variable to <code class=
12538: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 12539: of the source code or other distfile(s) via the
12540: Internet is not allowed.</p>
12541: </li>
12542: </ul>
12543: </div>
12544:
1.14 xtraeme 12545: <p>Please note that the use of <code class=
12546: "varname">NO_PACKAGE</code>, <code class=
12547: "varname">IGNORE</code>, <code class=
12548: "varname">NO_CDROM</code>, or other generic make
1.1 grant 12549: variables to denote restrictions is deprecated, because
12550: they unconditionally prevent users from generating
12551: binary packages!</p>
12552: </div>
12553:
1.67 hubertf 12554: <div class="sect2" lang="en">
1.1 grant 12555: <div class="titlepage">
12556: <div>
12557: <div>
1.67 hubertf 12558: <h3 class="title"><a name=
1.68 rillig 12559: "dependencies"></a>16.1.4. Handling
1.1 grant 12560: dependencies</h3>
12561: </div>
12562: </div>
12563: </div>
12564:
12565: <p>Your package may depend on some other package being
12566: present - and there are various ways of expressing this
1.14 xtraeme 12567: dependency. pkgsrc supports the <code class=
12568: "varname">BUILD_DEPENDS</code> and <code class=
1.47 reed 12569: "varname">DEPENDS</code> definitions, the <code class=
12570: "varname">USE_TOOLS</code> definition, as well as
1.45 wiz 12571: dependencies via <code xmlns=
12572: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12573: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 12574: way to handle dependencies, and which uses the
12575: variables named above. See <a href="#buildlink" title=
1.38 dillo 12576: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 12577: <i>Buildlink methodology</i></a> for more
12578: information.</p>
12579:
12580: <p>The basic difference between the two variables is as
1.14 xtraeme 12581: follows: The <code class="varname">DEPENDS</code>
1.1 grant 12582: definition registers that pre-requisite in the binary
12583: package so it will be pulled in when the binary package
1.14 xtraeme 12584: is later installed, whilst the <code class=
12585: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 12586: marking a dependency that is only needed for building
12587: the package.</p>
12588:
12589: <p>This means that if you only need a package present
12590: whilst you are building, it should be noted as a
1.14 xtraeme 12591: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 12592:
1.14 xtraeme 12593: <p>The format for a <code class=
12594: "varname">BUILD_DEPENDS</code> and a <code class=
12595: "varname">DEPENDS</code> definition is:</p>
1.1 grant 12596: <pre class="programlisting">
1.51 rillig 12597: <pre-req-package-name>:../../<category>/<pre-req-package>
1.1 grant 12598: </pre>
12599:
12600: <p>Please note that the “<span class=
12601: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 12602: any of the wildcard version numbers recognized by
1.1 grant 12603: <a href=
12604: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
12605: <span class="citerefentry"><span class=
12606: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
12607:
12608: <div class="orderedlist">
12609: <ol type="1">
12610: <li>
12611: <p>If your package needs another package's
12612: binaries or libraries to build or run, and if
1.45 wiz 12613: that package has a <code xmlns=
12614: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12615: "filename">buildlink3.mk</code> file available,
12616: use it:</p>
1.1 grant 12617: <pre class="programlisting">
12618: .include "../../graphics/jpeg/buildlink3.mk"
12619: </pre>
12620: </li>
12621:
12622: <li>
12623: <p>If your package needs to use another package
1.45 wiz 12624: to build itself and there is no <code xmlns=
12625: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12626: "filename">buildlink3.mk</code> file available,
12627: use the <code class=
12628: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 12629: <pre class="programlisting">
1.51 rillig 12630: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1 grant 12631: </pre>
12632: </li>
12633:
12634: <li>
12635: <p>If your package needs a library with which to
1.45 wiz 12636: link and again there is no <code xmlns=
12637: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12638: "filename">buildlink3.mk</code> file available,
12639: this is specified using the <code class=
12640: "varname">DEPENDS</code> definition. An example
12641: of this is the <a xmlns=
1.1 grant 12642: "http://www.w3.org/TR/xhtml1/transitional" href=
12643: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 12644: target="_top"><code xmlns="" class=
12645: "filename">print/lyx</code></a> package, which
12646: uses the xpm library, version 3.4j to build:</p>
1.1 grant 12647: <pre class="programlisting">
1.51 rillig 12648: DEPENDS+= xpm-3.4j:../../graphics/xpm
1.1 grant 12649: </pre>
12650:
12651: <p>You can also use wildcards in package
12652: dependences:</p>
12653: <pre class="programlisting">
1.51 rillig 12654: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
1.1 grant 12655: </pre>
12656:
12657: <p>Note that such wildcard dependencies are
12658: retained when creating binary packages. The
12659: dependency is checked when installing the binary
12660: package and any package which matches the pattern
12661: will be used. Wildcard dependencies should be
12662: used with care.</p>
12663:
12664: <p>The “<span class=
12665: "quote">-[0-9]*</span>” should be used
12666: instead of “<span class=
12667: "quote">-*</span>” to avoid potentially
12668: ambiguous matches such as “<span class=
12669: "quote">tk-postgresql</span>” matching a
12670: “<span class="quote">tk-*</span>”
1.14 xtraeme 12671: <code class="varname">DEPENDS</code>.</p>
1.1 grant 12672:
12673: <p>Wildcards can also be used to specify that a
12674: package will only build against a certain minimum
12675: version of a pre-requisite:</p>
12676: <pre class="programlisting">
1.51 rillig 12677: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
1.1 grant 12678: </pre>
12679:
12680: <p>This means that the package will build against
12681: version 3.5.4 of the tiff library or newer. Such
12682: a dependency may be warranted if, for example,
12683: the API of the library has changed with version
12684: 3.5.4 and a package would not compile against an
12685: earlier version of tiff.</p>
12686:
12687: <p>Please note that such dependencies should only
12688: be updated if a package requires a newer
12689: pre-requisite, but not to denote recommendations
12690: such as security updates or ABI changes that do
12691: not prevent a package from building correctly.
12692: Such recommendations can be expressed using
1.14 xtraeme 12693: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 12694: <pre class="programlisting">
1.51 rillig 12695: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
1.1 grant 12696: </pre>
12697:
1.14 xtraeme 12698: <p>In addition to the above <code class=
12699: "varname">DEPENDS</code> line, this denotes that
1.1 grant 12700: while a package will build against
12701: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 12702: recommended. <code class=
12703: "varname">RECOMMENDED</code> entries will be
12704: turned into dependencies unless explicitly
12705: ignored (in which case a warning will be
1.36 wiz 12706: printed).</p>
12707:
12708: <p>To ignore these dependency recommendations and
12709: just use the required <code class=
12710: "varname">DEPENDS</code>, set <code class=
12711: "varname">IGNORE_RECOMMENDED=YES</code>. This may
12712: make it easier and faster to update packages
12713: built using pkgsrc, since older compatible
12714: dependencies can continue to be used. This is
12715: useful for people who watch their rebuilds very
12716: carefully; it is not very good as a
12717: general-purpose hammer. If you use it, you need
12718: to be mindful of possible ABI changes, including
12719: those from the underlying OS.</p>
12720:
12721: <p>Packages that are built with recommendations
12722: ignored may not be uploaded to ftp.NetBSD.org by
12723: developers and should not be used across
12724: different systems that may have different
12725: versions of binary packages installed.</p>
1.1 grant 12726:
12727: <p>For security fixes, please update the package
12728: vulnerabilities file as well as setting
1.14 xtraeme 12729: <code class="varname">RECOMMENDED</code>, see
1.1 grant 12730: <a href="#security-handling" title=
1.68 rillig 12731: "16.1.8. Handling packages with security problems">
12732: Section 16.1.8, “Handling packages
1.67 hubertf 12733: with security problems”</a> for more
1.1 grant 12734: information.</p>
12735: </li>
12736:
12737: <li>
12738: <p>If your package needs some executable to be
1.17 sketch 12739: able to run correctly and if there's no
1.45 wiz 12740: <code xmlns=
12741: "http://www.w3.org/TR/xhtml1/transitional" class=
12742: "filename">buildlink3.mk</code> file, this is
12743: specified using the <code class=
1.14 xtraeme 12744: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 12745: "http://www.w3.org/TR/xhtml1/transitional" href=
12746: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 12747: target="_top"><code xmlns="" class=
12748: "filename">print/lyx</code></a> package needs to
12749: be able to execute the latex binary from the
12750: teTeX package when it runs, and that is
12751: specified:</p>
1.1 grant 12752: <pre class="programlisting">
1.51 rillig 12753: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
1.1 grant 12754: </pre>
12755:
12756: <p>The comment about wildcard dependencies from
12757: previous paragraph applies here, too.</p>
12758: </li>
12759: </ol>
12760: </div>
12761:
12762: <p>If your package needs files from another package to
12763: build, see the first part of the “<span class=
12764: "quote">do-configure</span>” target <a xmlns=
12765: "http://www.w3.org/TR/xhtml1/transitional" href=
12766: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45 wiz 12767: target="_top"><code xmlns="" class=
12768: "filename">print/ghostscript5</code></a> package (it
1.20 ben 12769: relies on the jpeg sources being present in source form
12770: during the build):</p>
1.1 grant 12771: <pre class="programlisting">
1.51 rillig 12772: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
12773: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
1.1 grant 12774: fi
12775: </pre>
12776:
12777: <p>If you build any other packages that way, please
12778: make sure the working files are deleted too when this
12779: package's working files are cleaned up. The easiest way
12780: to do so is by adding a pre-clean target:</p>
12781: <pre class="programlisting">
1.51 rillig 12782: pre-clean:
12783: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
1.1 grant 12784: </pre>
12785:
1.14 xtraeme 12786: <p>Please also note the <code class=
12787: "varname">BUILD_USES_MSGFMT</code> and <code class=
12788: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
12789: which are provided as convenience definitions. The
1.24 wiz 12790: former works out whether <a href=
12791: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
12792: <span class="citerefentry"><span class=
12793: "refentrytitle">msgfmt</span>(1)</span></a> is part of
12794: the base system, and, if it isn't, installs the
12795: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12796: href=
1.1 grant 12797: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45 wiz 12798: target="_top"><code xmlns="" class=
12799: "filename">devel/gettext</code></a> package. The latter
1.20 ben 12800: adds a build dependency on either an installed version
12801: of an older gettext package, or if it isn't, installs
12802: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12803: href=
12804: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45 wiz 12805: target="_top"><code xmlns="" class=
12806: "filename">devel/gettext-m4</code></a> package.</p>
1.1 grant 12807: </div>
12808:
1.67 hubertf 12809: <div class="sect2" lang="en">
1.1 grant 12810: <div class="titlepage">
12811: <div>
12812: <div>
1.67 hubertf 12813: <h3 class="title"><a name=
1.68 rillig 12814: "conflicts"></a>16.1.5. Handling conflicts
1.1 grant 12815: with other packages</h3>
12816: </div>
12817: </div>
12818: </div>
12819:
12820: <p>Your package may conflict with other packages a user
12821: might already have installed on his system, e.g. if
12822: your package installs the same set of files like
12823: another package in our pkgsrc tree.</p>
12824:
1.14 xtraeme 12825: <p>In this case you can set <code class=
1.47 reed 12826: "varname">CONFLICTS</code> to a space-separated list of
1.1 grant 12827: packages (including version string) your package
12828: conflicts with.</p>
12829:
1.47 reed 12830: <p>For example, <a xmlns=
1.1 grant 12831: "http://www.w3.org/TR/xhtml1/transitional" href=
12832: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45 wiz 12833: target="_top"><code xmlns="" class=
12834: "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20 ben 12835: "http://www.w3.org/TR/xhtml1/transitional" href=
12836: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45 wiz 12837: target="_top"><code xmlns="" class=
1.47 reed 12838: "filename">x11/Xaw-Xpm</code></a> install the same
12839: shared library, thus you set in <code xmlns=
1.45 wiz 12840: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 12841: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 12842: <pre class="programlisting">
1.51 rillig 12843: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 grant 12844: </pre>
12845:
1.45 wiz 12846: <p>and in <code xmlns=
12847: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12848: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 12849: <pre class="programlisting">
1.51 rillig 12850: CONFLICTS= Xaw3d-[0-9]*
1.1 grant 12851: </pre>
12852:
12853: <p>Packages will automatically conflict with other
12854: packages with the name prefix and a different version
12855: string. “<span class=
12856: "quote">Xaw3d-1.5</span>” e.g. will automatically
12857: conflict with the older version “<span class=
12858: "quote">Xaw3d-1.3</span>”.</p>
12859: </div>
12860:
1.67 hubertf 12861: <div class="sect2" lang="en">
1.1 grant 12862: <div class="titlepage">
12863: <div>
12864: <div>
1.67 hubertf 12865: <h3 class="title"><a name=
1.68 rillig 12866: "not-building-packages"></a>16.1.6. Packages
1.30 wiz 12867: that cannot or should not be built</h3>
1.1 grant 12868: </div>
12869: </div>
12870: </div>
12871:
12872: <p>There are several reasons why a package might be
12873: instructed to not build under certain circumstances. If
12874: the package builds and runs on most platforms, the
1.14 xtraeme 12875: exceptions should be noted with <code class=
12876: "varname">NOT_FOR_PLATFORM</code>. If the package
12877: builds and runs on a small handful of platforms, set
12878: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45 wiz 12879: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
12880: <code class="varname">NOT_FOR_PLATFORM</code> are OS
12881: triples (OS-version-platform) that can use glob-style
12882: wildcards.</p>
12883:
12884: <p>If the package should be skipped (for example,
12885: because it provides functionality already provided by
12886: the system), set <code class=
1.14 xtraeme 12887: "varname">PKG_SKIP_REASON</code> to a descriptive
12888: message. If the package should fail because some
12889: preconditions are not met, set <code class=
12890: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 12891: message.</p>
12892: </div>
12893:
1.67 hubertf 12894: <div class="sect2" lang="en">
1.1 grant 12895: <div class="titlepage">
12896: <div>
12897: <div>
1.67 hubertf 12898: <h3 class="title"><a name=
1.68 rillig 12899: "undeletable-packages"></a>16.1.7. Packages
1.30 wiz 12900: which should not be deleted, once installed</h3>
1.1 grant 12901: </div>
12902: </div>
12903: </div>
12904:
12905: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 12906: has been installed, the <code class=
12907: "varname">PKG_PRESERVE</code> definition should be set
12908: in the package Makefile. This will be carried into any
1.1 grant 12909: binary package that is made from this pkgsrc entry. A
12910: “<span class="quote">preserved</span>”
12911: package will not be deleted using <a href=
12912: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
12913: <span class="citerefentry"><span class=
12914: "refentrytitle">pkg_delete</span>(1)</span></a> unless
12915: the “<span class="quote">-f</span>” option
12916: is used.</p>
12917: </div>
12918:
1.67 hubertf 12919: <div class="sect2" lang="en">
1.1 grant 12920: <div class="titlepage">
12921: <div>
12922: <div>
1.67 hubertf 12923: <h3 class="title"><a name=
1.68 rillig 12924: "security-handling"></a>16.1.8. Handling
1.1 grant 12925: packages with security problems</h3>
12926: </div>
12927: </div>
12928: </div>
12929:
12930: <p>When a vulnerability is found, this should be noted
1.45 wiz 12931: in <code xmlns=
12932: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12933: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43 wiz 12934: and after committing that file, use
12935: <span><strong class="command">make
12936: upload</strong></span> in the same directory to update
12937: the file on ftp.NetBSD.org.</p>
12938:
12939: <p>After fixing the vulnerability by a patch, its
12940: <code class="varname">PKGREVISION</code> should be
12941: increased (this is of course not necessary if the
12942: problem is fixed by using a newer release of the
1.45 wiz 12943: software). In addition, if a <code xmlns=
12944: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12945: "filename">buildlink3.mk</code> file exists for an
1.43 wiz 12946: affected package, a corresponding <code class=
1.14 xtraeme 12947: "varname">BUILDLINK_RECOMMENDED.<em class=
12948: "replaceable"><code>pkg</code></em></code> entry should
1.43 wiz 12949: be added or updated in it.</p>
1.1 grant 12950:
12951: <p>Also, if the fix should be applied to the stable
12952: pkgsrc branch, be sure to submit a pullup request!</p>
1.43 wiz 12953:
12954: <p>Binary packages already on ftp.NetBSD.org will be
12955: handled semi-automatically by a weekly cron job.</p>
1.1 grant 12956: </div>
12957:
1.67 hubertf 12958: <div class="sect2" lang="en">
1.1 grant 12959: <div class="titlepage">
12960: <div>
12961: <div>
1.67 hubertf 12962: <h3 class="title"><a name=
1.68 rillig 12963: "compiler-bugs"></a>16.1.9. How to handle
1.1 grant 12964: compiler bugs</h3>
12965: </div>
12966: </div>
12967: </div>
12968:
12969: <p>Some source files trigger bugs in the compiler,
12970: based on combinations of compiler version and
12971: architecture and almost always relation to optimisation
12972: being enabled. Common symptoms are gcc internal errors
12973: or never finishing compiling a file.</p>
12974:
1.47 reed 12975: <p>Typically, a workaround involves testing the
1.14 xtraeme 12976: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 12977: version, disabling optimisation for that
1.14 xtraeme 12978: file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45 wiz 12979: combination, and documenting it in <code xmlns=
12980: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12981: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 12982: number of examples!</p>
12983: </div>
12984:
1.67 hubertf 12985: <div class="sect2" lang="en">
1.1 grant 12986: <div class="titlepage">
12987: <div>
12988: <div>
1.67 hubertf 12989: <h3 class="title"><a name=
1.68 rillig 12990: "bumping-pkgrevision"></a>16.1.10. How to
1.30 wiz 12991: handle incrementing versions when fixing an
12992: existing package</h3>
1.1 grant 12993: </div>
12994: </div>
12995: </div>
12996:
12997: <p>When making fixes to an existing package it can be
1.14 xtraeme 12998: useful to change the version number in <code class=
12999: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 13000: future versions by the original author, a
13001: “<span class="quote">nb1</span>”,
13002: “<span class="quote">nb2</span>”, ...
13003: suffix can be used on package versions by setting
1.14 xtraeme 13004: <code class="varname">PKGREVISION=1</code> (2, ...).
13005: The “<span class="quote">nb</span>” is
13006: treated like a “<span class=
13007: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 13008: <pre class="programlisting">
1.51 rillig 13009: DISTNAME= foo-17.42
13010: PKGREVISION= 9
1.1 grant 13011: </pre>
13012:
1.14 xtraeme 13013: <p>will result in a <code class=
13014: "varname">PKGNAME</code> of “<span class=
1.1 grant 13015: "quote">foo-17.42nb9</span>”.</p>
13016:
13017: <p>When a new release of the package is released, the
1.14 xtraeme 13018: <code class="varname">PKGREVISION</code> should be
1.47 reed 13019: removed, e.g. on a new minor release of the above
1.14 xtraeme 13020: package, things should be like:</p>
1.1 grant 13021: <pre class="programlisting">
1.51 rillig 13022: DISTNAME= foo-17.43
1.1 grant 13023: </pre>
13024: </div>
13025:
1.67 hubertf 13026: <div class="sect2" lang="en">
1.1 grant 13027: <div class="titlepage">
13028: <div>
13029: <div>
1.30 wiz 13030: <h3 class="title"><a name=
1.68 rillig 13031: "portability-of-packages"></a>16.1.11. Portability
1.30 wiz 13032: of packages</h3>
1.1 grant 13033: </div>
13034: </div>
13035: </div>
13036:
13037: <p>One appealing feature of pkgsrc is that it runs on
13038: many different platforms. As a result, it is important
13039: to ensure, where possible, that packages in pkgsrc are
13040: portable. There are some particular details you should
13041: pay attention to while working on pkgsrc.</p>
13042:
1.67 hubertf 13043: <div class="sect3" lang="en">
1.1 grant 13044: <div class="titlepage">
13045: <div>
13046: <div>
1.67 hubertf 13047: <h4 class="title"><a name=
1.68 rillig 13048: "install-scripts"></a>16.1.11.1. ${INSTALL},
1.1 grant 13049: ${INSTALL_DATA_DIR}, ...</h4>
13050: </div>
13051: </div>
13052: </div>
13053:
1.14 xtraeme 13054: <p>The BSD-compatible <span><strong class=
13055: "command">install</strong></span> supplied with some
1.1 grant 13056: operating systems will not perform more than one
13057: operation at a time. As such, you should call
13058: “<span class="quote">${INSTALL}</span>”,
13059: etc. like this:</p>
13060: <pre class="programlisting">
1.51 rillig 13061: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
13062: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1 grant 13063: </pre>
13064: </div>
13065: </div>
13066: </div>
13067:
1.67 hubertf 13068: <div class="sect1" lang="en">
1.1 grant 13069: <div class="titlepage">
13070: <div>
13071: <div>
13072: <h2 class="title" style="clear: both"><a name=
1.68 rillig 13073: "downloading-issues"></a>16.2. Possible
1.1 grant 13074: downloading issues</h2>
13075: </div>
13076: </div>
13077: </div>
13078:
1.67 hubertf 13079: <div class="sect2" lang="en">
1.1 grant 13080: <div class="titlepage">
13081: <div>
13082: <div>
1.67 hubertf 13083: <h3 class="title"><a name=
1.68 rillig 13084: "no-plain-download"></a>16.2.1. Packages
1.30 wiz 13085: whose distfiles aren't available for plain
1.1 grant 13086: downloading</h3>
13087: </div>
13088: </div>
13089: </div>
13090:
13091: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 13092: set <code class="varname">DYNAMIC_MASTER_SITES</code>
13093: and a <span><strong class="command">make
1.45 wiz 13094: fetch</strong></span> will call <code xmlns=
13095: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13096: "filename">files/getsite.sh</code> with the name of
13097: each file to download as an argument, expecting it to
13098: output the URL of the directory from which to download
13099: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
13100: href=
1.1 grant 13101: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45 wiz 13102: target="_top"><code xmlns="" class=
13103: "filename">graphics/ns-cult3d</code></a> is an example
13104: of this usage.</p>
1.1 grant 13105:
13106: <p>If the download can't be automated, because the user
13107: must submit personal information to apply for a
13108: password, or must pay for the source, or whatever, you
1.14 xtraeme 13109: can set <code class="varname">_FETCH_MESSAGE</code> to
13110: a macro which displays a message explaining the
13111: situation. <code class="varname">_FETCH_MESSAGE</code>
13112: must be executable shell commands, not just a message.
13113: (Generally, it executes <code class=
13114: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 13115: following packages use this: <a xmlns=
13116: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 13117: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45 wiz 13118: target="_top"><code xmlns="" class=
13119: "filename">cad/simian</code></a>, <a xmlns=
1.20 ben 13120: "http://www.w3.org/TR/xhtml1/transitional" href=
13121: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45 wiz 13122: target="_top"><code xmlns="" class=
13123: "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20 ben 13124: "http://www.w3.org/TR/xhtml1/transitional" href=
13125: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45 wiz 13126: target="_top"><code xmlns="" class=
13127: "filename">emulators/vmware-module</code></a>,
13128: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
13129: href=
1.20 ben 13130: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45 wiz 13131: target="_top"><code xmlns="" class=
13132: "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20 ben 13133: "http://www.w3.org/TR/xhtml1/transitional" href=
1.43 wiz 13134: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45 wiz 13135: target="_top"><code xmlns="" class=
13136: "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43 wiz 13137: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 13138: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45 wiz 13139: target="_top"><code xmlns="" class=
13140: "filename">sysutils/storage-manager</code></a>,
13141: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
13142: href=
1.20 ben 13143: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45 wiz 13144: target="_top"><code xmlns="" class=
13145: "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20 ben 13146: "http://www.w3.org/TR/xhtml1/transitional" href=
13147: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45 wiz 13148: target="_top"><code xmlns="" class=
13149: "filename">www/openacs</code></a>. Try to be consistent
1.20 ben 13150: with them.</p>
1.1 grant 13151: </div>
13152:
1.67 hubertf 13153: <div class="sect2" lang="en">
1.1 grant 13154: <div class="titlepage">
13155: <div>
13156: <div>
1.30 wiz 13157: <h3 class="title"><a name=
1.68 rillig 13158: "modified-distfiles-same-name"></a>16.2.2. How
1.30 wiz 13159: to handle modified distfiles with the 'old'
13160: name</h3>
1.1 grant 13161: </div>
13162: </div>
13163: </div>
13164:
13165: <p>Sometimes authors of a software package make some
13166: modifications after the software was released, and they
13167: put up a new distfile without changing the package's
13168: version number. If a package is already in pkgsrc at
1.32 wiz 13169: that time, the checksum will no longer match. The
13170: contents of the new distfile should be compared against
13171: the old one before changing anything, to make sure the
13172: distfile was really updated on purpose, and that no
13173: trojan horse or so crept in. Then, the correct way to
13174: work around this is to set <code class=
13175: "varname">DIST_SUBDIR</code> to a unique directory
13176: name, usually based on <code class=
13177: "varname">PKGNAME_NOREV</code>. In case this happens
13178: more often, <code class="varname">PKGNAME</code> can be
1.45 wiz 13179: used (thus including the <code xmlns=
13180: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 13181: "filename">nbX</code> suffix) or a date stamp can be
13182: appended, like <code class=
13183: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45 wiz 13184: forget regenerating the <code xmlns=
13185: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 13186: "filename">distinfo</code> file after that, since it
13187: contains the <code class="varname">DIST_SUBDIR</code>
13188: path in the filenames. Furthermore, a mail to the
13189: package's authors seems appropriate telling them that
13190: changing distfiles after releases without changing the
13191: file names is not good practice.</p>
1.1 grant 13192: </div>
13193: </div>
13194:
1.67 hubertf 13195: <div class="sect1" lang="en">
1.1 grant 13196: <div class="titlepage">
13197: <div>
13198: <div>
13199: <h2 class="title" style="clear: both"><a name=
1.68 rillig 13200: "configuration-gotchas"></a>16.3. Configuration
1.1 grant 13201: gotchas</h2>
13202: </div>
13203: </div>
13204: </div>
13205:
1.67 hubertf 13206: <div class="sect2" lang="en">
1.1 grant 13207: <div class="titlepage">
13208: <div>
13209: <div>
1.67 hubertf 13210: <h3 class="title"><a name=
1.68 rillig 13211: "fixes.libtool"></a>16.3.1. Shared libraries
1.1 grant 13212: - libtool</h3>
13213: </div>
13214: </div>
13215: </div>
13216:
13217: <p>pkgsrc supports many different machines, with
13218: different object formats like a.out and ELF, and
13219: varying abilities to do shared library and dynamic
13220: loading at all. To accompany this, varying commands and
13221: options have to be passed to the compiler, linker, etc.
13222: to get the Right Thing, which can be pretty annoying
13223: especially if you don't have all the machines at your
13224: hand to test things. The <a xmlns=
13225: "http://www.w3.org/TR/xhtml1/transitional" href=
13226: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45 wiz 13227: target="_top"><code xmlns="" class=
13228: "filename">devel/libtool</code></a> pkg can help here,
13229: as it just “<span class=
13230: "quote">knows</span>” how to build both static
13231: and dynamic libraries from a set of source files, thus
1.47 reed 13232: being platform-independent.</p>
1.1 grant 13233:
13234: <p>Here's how to use libtool in a pkg in seven simple
13235: steps:</p>
13236:
13237: <div class="orderedlist">
13238: <ol type="1">
13239: <li>
1.14 xtraeme 13240: <p>Add <code class=
13241: "varname">USE_LIBTOOL=yes</code> to the package
13242: Makefile.</p>
1.1 grant 13243: </li>
13244:
13245: <li>
13246: <p>For library objects, use “<span class=
13247: "quote">${LIBTOOL} --mode=compile
13248: ${CC}</span>” in place of
13249: “<span class="quote">${CC}</span>”.
13250: You could even add it to the definition of
1.14 xtraeme 13251: <code class="varname">CC</code>, if only
13252: libraries are being built in a given Makefile.
13253: This one command will build both PIC and non-PIC
13254: library objects, so you need not have separate
13255: shared and non-shared library rules.</p>
1.1 grant 13256: </li>
13257:
13258: <li>
13259: <p>For the linking of the library, remove any
13260: “<span class="quote">ar</span>”,
13261: “<span class="quote">ranlib</span>”,
13262: and “<span class="quote">ld
13263: -Bshareable</span>” commands, and instead
13264: use:</p>
13265: <pre class="programlisting">
1.51 rillig 13266: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
13267: -rpath ${PREFIX}/lib -version-info major:minor
1.1 grant 13268: </pre>
13269:
13270: <p>Note that the library is changed to have a
1.45 wiz 13271: <code xmlns=
13272: "http://www.w3.org/TR/xhtml1/transitional" class=
13273: "filename">.la</code> extension, and the objects
13274: are changed to have a <code xmlns=
13275: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13276: "filename">.lo</code> extension. Change
13277: <code class="varname">OBJS</code> as necessary.
13278: This automatically creates all of the
1.45 wiz 13279: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13280: class="filename">.a</code>, <code xmlns=
13281: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13282: "filename">.so.major.minor</code>, and ELF
13283: symlinks (if necessary) in the build directory.
13284: Be sure to include “<span class=
1.1 grant 13285: "quote">-version-info</span>”, especially
13286: when major and minor are zero, as libtool will
13287: otherwise strip off the shared library
13288: version.</p>
13289:
13290: <p>From the libtool manual:</p>
13291: <pre class="programlisting">
1.51 rillig 13292: So, libtool library versions are described by three integers:
1.1 grant 13293:
1.51 rillig 13294: CURRENT
13295: The most recent interface number that this library implements.
1.1 grant 13296:
1.51 rillig 13297: REVISION
13298: The implementation number of the CURRENT interface.
1.1 grant 13299:
1.51 rillig 13300: AGE
13301: The difference between the newest and oldest interfaces that
13302: this library implements. In other words, the library implements
13303: all the interface numbers in the range from number `CURRENT -
13304: AGE' to `CURRENT'.
1.68 rillig 13305:
1.51 rillig 13306: If two libraries have identical CURRENT and AGE numbers, then the
13307: dynamic linker chooses the library with the greater REVISION number.
1.1 grant 13308: </pre>
13309:
13310: <p>The “<span class=
13311: "quote">-release</span>” option will
13312: produce different results for a.out and ELF
13313: (excluding symlinks) in only one case. An ELF
13314: library of the form “<span class=
13315: "quote">libfoo-release.so.<span class=
13316: "emphasis"><em>x</em></span>.<span class=
13317: "emphasis"><em>y</em></span></span>” will
13318: have a symlink of “<span class=
13319: "quote">libfoo.so.<span class=
13320: "emphasis"><em>x</em></span>.<span class=
13321: "emphasis"><em>y</em></span></span>” on an
13322: a.out platform. This is handled
13323: automatically.</p>
13324:
13325: <p>The “<span class="quote">-rpath
13326: argument</span>” is the install directory
13327: of the library being built.</p>
13328:
1.45 wiz 13329: <p>In the <code xmlns=
13330: "http://www.w3.org/TR/xhtml1/transitional" class=
13331: "filename">PLIST</code>, include only the
13332: <code xmlns=
13333: "http://www.w3.org/TR/xhtml1/transitional" class=
1.19 hubertf 13334: "filename">.la</code> file, the other files will
13335: be added automatically.</p>
1.1 grant 13336: </li>
13337:
13338: <li>
1.45 wiz 13339: <p>When linking shared object (<code xmlns=
13340: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13341: "filename">.so</code>) files, i.e. files that are
1.24 wiz 13342: loaded via <a href=
13343: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
13344: <span class="citerefentry"><span class=
13345: "refentrytitle">dlopen</span>(3)</span></a>, NOT
13346: shared libraries, use “<span class=
13347: "quote">-module -avoid-version</span>” to
13348: prevent them getting version tacked on.</p>
1.1 grant 13349:
1.45 wiz 13350: <p>The <code xmlns=
13351: "http://www.w3.org/TR/xhtml1/transitional" class=
13352: "filename">PLIST</code> file gets the
13353: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13354: class="filename">foo.so</code> entry.</p>
1.1 grant 13355: </li>
13356:
13357: <li>
13358: <p>When linking programs that depend on these
13359: libraries <span class=
13360: "emphasis"><em>before</em></span> they are
13361: installed, preface the <a href=
13362: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
13363: <span class="citerefentry"><span class=
13364: "refentrytitle">cc</span>(1)</span></a> or
13365: <a href=
13366: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
13367: <span class="citerefentry"><span class=
13368: "refentrytitle">ld</span>(1)</span></a> line with
13369: “<span class="quote">${LIBTOOL}
13370: --mode=link</span>”, and it will find the
13371: correct libraries (static or shared), but please
13372: be aware that libtool will not allow you to
13373: specify a relative path in -L (such as
13374: “<span class=
13375: "quote">-L../somelib</span>”), because it
13376: expects you to change that argument to be the
1.45 wiz 13377: <code xmlns=
13378: "http://www.w3.org/TR/xhtml1/transitional" class=
13379: "filename">.la</code> file. e.g.</p>
1.1 grant 13380: <pre class="programlisting">
1.51 rillig 13381: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1 grant 13382: </pre>
13383:
13384: <p>should be changed to:</p>
13385: <pre class="programlisting">
1.51 rillig 13386: ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14 xtraeme 13387: "replaceable"><code>someprog</code></em> <em class=
13388: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 13389: </pre>
13390:
13391: <p>and it will do the right thing with the
13392: libraries.</p>
13393: </li>
13394:
13395: <li>
13396: <p>When installing libraries, preface the
13397: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
13398: <span class="citerefentry"><span class=
13399: "refentrytitle">install</span>(1)</span></a> or
13400: <a href=
13401: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
13402: <span class="citerefentry"><span class=
13403: "refentrytitle">cp</span>(1)</span></a> command
13404: with “<span class="quote">${LIBTOOL}
13405: --mode=install</span>”, and change the
1.45 wiz 13406: library name to <code xmlns=
13407: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13408: "filename">.la</code>. e.g.</p>
1.1 grant 13409: <pre class="programlisting">
1.51 rillig 13410: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 grant 13411: </pre>
13412:
1.45 wiz 13413: <p>This will install the static <code xmlns=
13414: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13415: "filename">.a</code>, shared library, any needed
1.1 grant 13416: symlinks, and run <a href=
13417: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
13418: <span class="citerefentry"><span class=
13419: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
13420: </li>
13421:
13422: <li>
1.45 wiz 13423: <p>In your <code xmlns=
13424: "http://www.w3.org/TR/xhtml1/transitional" class=
13425: "filename">PLIST</code>, include only the
13426: <code xmlns=
13427: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 13428: "filename">.la</code> file (this is a change from
13429: previous behaviour).</p>
1.1 grant 13430: </li>
13431: </ol>
13432: </div>
13433: </div>
13434:
1.67 hubertf 13435: <div class="sect2" lang="en">
1.1 grant 13436: <div class="titlepage">
13437: <div>
13438: <div>
1.67 hubertf 13439: <h3 class="title"><a name=
1.68 rillig 13440: "using-libtool"></a>16.3.2. Using libtool on
1.30 wiz 13441: GNU packages that already support libtool</h3>
1.1 grant 13442: </div>
13443: </div>
13444: </div>
13445:
1.14 xtraeme 13446: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
13447: the package Makefile. This will override the package's
13448: own libtool in most cases. For older libtool using
1.1 grant 13449: packages, libtool is made by ltconfig script during the
13450: do-configure step; you can check the libtool script
1.14 xtraeme 13451: location by doing <span><strong class="command">make
13452: configure; find work*/ -name
13453: libtool</strong></span>.</p>
13454:
13455: <p><code class="varname">LIBTOOL_OVERRIDE</code>
13456: specifies which libtool scripts, relative to
13457: <code class="varname">WRKSRC</code>, to override. By
13458: default, it is set to “<span class=
13459: "quote">libtool */libtool */*/libtool</span>”. If
13460: this does not match the location of the package's
13461: libtool script(s), set it as appropriate.</p>
1.13 hubertf 13462:
1.45 wiz 13463: <p>If you do not need <code xmlns=
13464: "http://www.w3.org/TR/xhtml1/transitional" class=
13465: "filename">*.a</code> static libraries built and
13466: installed, then use <code class=
13467: "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1 grant 13468:
1.47 reed 13469: <p>If your package makes use of the
13470: platform-independent library for loading dynamic shared
13471: objects, that comes with libtool (libltdl), you should
13472: include devel/libltdl/buildlink3.mk.</p>
1.1 grant 13473:
13474: <p>Some packages use libtool incorrectly so that the
13475: package may not work or build in some circumstances.
13476: Some of the more common errors are:</p>
13477:
13478: <div class="itemizedlist">
13479: <ul type="disc">
13480: <li>
13481: <p>The inclusion of a shared object (-module) as
13482: a dependent library in an executable or library.
13483: This in itself isn't a problem if one of two
13484: things has been done:</p>
13485:
13486: <div class="orderedlist">
13487: <ol type="1">
13488: <li>
13489: <p>The shared object is named correctly,
1.45 wiz 13490: i.e. <code xmlns=
13491: "http://www.w3.org/TR/xhtml1/transitional"
13492: class="filename">libfoo.la</code>, not
13493: <code xmlns=
13494: "http://www.w3.org/TR/xhtml1/transitional"
13495: class="filename">foo.la</code></p>
1.1 grant 13496: </li>
13497:
13498: <li>
13499: <p>The -dlopen option is used when linking
13500: an executable.</p>
13501: </li>
13502: </ol>
13503: </div>
13504: </li>
13505:
13506: <li>
13507: <p>The use of libltdl without the correct calls
13508: to initialisation routines. The function
13509: lt_dlinit() should be called and the macro
1.14 xtraeme 13510: <code class=
13511: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 13512: included in executables.</p>
13513: </li>
13514: </ul>
13515: </div>
13516: </div>
13517:
1.67 hubertf 13518: <div class="sect2" lang="en">
1.1 grant 13519: <div class="titlepage">
13520: <div>
13521: <div>
1.67 hubertf 13522: <h3 class="title"><a name=
1.68 rillig 13523: "autoconf-automake"></a>16.3.3. GNU
1.1 grant 13524: Autoconf/Automake</h3>
13525: </div>
13526: </div>
13527: </div>
13528:
13529: <p>If a package needs GNU autoconf or automake to be
13530: executed to regenerate the configure script and
13531: Makefile.in makefile templates, then they should be
1.35 jmmv 13532: executed in a pre-configure target.</p>
1.1 grant 13533:
13534: <p>For packages that need only autoconf:</p>
13535: <pre class="programlisting">
1.51 rillig 13536: AUTOCONF_REQD= 2.50 # if default version is not good enough
13537: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
13538: ...
1.1 grant 13539:
1.51 rillig 13540: pre-configure:
13541: cd ${WRKSRC}; autoconf
1.1 grant 13542:
1.51 rillig 13543: ...
1.1 grant 13544: </pre>
13545:
13546: <p>and for packages that need automake and
13547: autoconf:</p>
13548: <pre class="programlisting">
1.51 rillig 13549: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
13550: USE_TOOLS+= automake # use "automake14" for automake-1.4
13551: ...
1.1 grant 13552:
1.51 rillig 13553: pre-configure:
13554: cd ${WRKSRC}; \
13555: aclocal; autoheader; \
13556: automake -a --foreign -i; autoconf
13557:
13558: ...
1.1 grant 13559: </pre>
13560:
13561: <p>Packages which use GNU Automake will almost
1.35 jmmv 13562: certainly require GNU Make.</p>
1.1 grant 13563:
13564: <p>There are times when the configure process makes
13565: additional changes to the generated files, which then
13566: causes the build process to try to re-execute the
13567: automake sequence. This is prevented by touching
13568: various files in the configure stage. If this causes
1.14 xtraeme 13569: problems with your package you can set <code class=
13570: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 13571: Makefile.</p>
13572: </div>
13573: </div>
13574:
1.67 hubertf 13575: <div class="sect1" lang="en">
1.1 grant 13576: <div class="titlepage">
13577: <div>
13578: <div>
13579: <h2 class="title" style="clear: both"><a name=
1.68 rillig 13580: "fixes-build"></a>16.4. Building the
1.55 rillig 13581: package</h2>
1.1 grant 13582: </div>
13583: </div>
13584: </div>
13585:
1.67 hubertf 13586: <div class="sect2" lang="en">
1.1 grant 13587: <div class="titlepage">
13588: <div>
13589: <div>
1.67 hubertf 13590: <h3 class="title"><a name=
1.68 rillig 13591: "cpp-defines"></a>16.4.1. CPP defines</h3>
1.1 grant 13592: </div>
13593: </div>
13594: </div>
13595:
1.55 rillig 13596: <p>Sometimes you need to compile different code
13597: depending on the target platform. The C preprocessor
13598: has a set of predefined macros that can be queried by
13599: using <code class="varname">#ifdef FOO</code> or
13600: <code class="varname">#if defined(FOO)</code>. Among
13601: these macros are usually ones that describe the target
13602: CPU and operating system. Depending of which of the
13603: macros are defined, you can write code that uses
1.61 rillig 13604: features unique to a specific platform. Generally you
13605: should rather use the GNU autotools (automake,
13606: autoconf, etc.) to check for specific features (like
13607: the existence of a header file, a function or a
13608: library), but sometimes this is not possible or
13609: desired.</p>
13610:
13611: <p>In that case you can use the predefined macros below
13612: to configure your code to the platform it runs on.
13613: Almost every operating system, hardware architecture
13614: and compiler has its own macro. For example, if the
13615: macros <code class="varname">__GNUC__</code>,
13616: <code class="varname">__i386__</code> and <code class=
1.55 rillig 13617: "varname">__NetBSD__</code> are all defined, you know
1.61 rillig 13618: that you are using NetBSD on an i386 compatible CPU,
13619: and your compiler is GCC.</p>
1.55 rillig 13620:
1.67 hubertf 13621: <div class="sect3" lang="en">
1.55 rillig 13622: <div class="titlepage">
13623: <div>
13624: <div>
13625: <h4 class="title"><a name=
1.68 rillig 13626: "fixes-build-cpp-opsys"></a>16.4.1.1. CPP
1.55 rillig 13627: defines for operating systems</h4>
13628: </div>
13629: </div>
13630: </div>
13631:
13632: <p>To distinguish between 4.4 BSD-derived systems and
13633: the rest of the world, you should use the following
13634: code.</p>
13635: <pre class="programlisting">
1.51 rillig 13636: #include <sys/param.h>
1.55 rillig 13637: #if (defined(BSD) && BSD >= 199306)
1.60 rillig 13638: /* BSD-specific code goes here */
1.55 rillig 13639: #else
1.60 rillig 13640: /* non-BSD-specific code goes here */
1.55 rillig 13641: #endif
1.1 grant 13642: </pre>
13643:
1.55 rillig 13644: <p>If this distinction is not fine enough, you can
13645: also use the following defines.</p>
13646: <pre class="programlisting">
13647: FreeBSD __FreeBSD__
1.56 rillig 13648: DragonFly __DragonFly__
1.57 minskim 13649: Interix __INTERIX
1.55 rillig 13650: Linux linux, __linux, __linux__
13651: NetBSD __NetBSD__
13652: OpenBSD __OpenBSD__
1.60 rillig 13653: Solaris sun, __sun
1.1 grant 13654: </pre>
1.55 rillig 13655: </div>
1.1 grant 13656:
1.67 hubertf 13657: <div class="sect3" lang="en">
1.55 rillig 13658: <div class="titlepage">
13659: <div>
13660: <div>
1.67 hubertf 13661: <h4 class="title"><a name=
1.68 rillig 13662: "fixes-build-cpp-cpu"></a>16.4.1.2. CPP
1.55 rillig 13663: defines for CPUs</h4>
13664: </div>
13665: </div>
13666: </div>
13667: <pre class="programlisting">
13668: i386 i386, __i386, __i386__
13669: MIPS __mips
13670: SPARC sparc, __sparc
13671: </pre>
13672: </div>
13673:
1.67 hubertf 13674: <div class="sect3" lang="en">
1.55 rillig 13675: <div class="titlepage">
13676: <div>
13677: <div>
13678: <h4 class="title"><a name=
1.68 rillig 13679: "fixes-build-cpp-compiler"></a>16.4.1.3. CPP
1.55 rillig 13680: defines for compilers</h4>
13681: </div>
13682: </div>
13683: </div>
13684: <pre class="programlisting">
13685: GCC __GNUC__ (major version), __GNUC_MINOR__
1.60 rillig 13686: SunPro __SUNPRO_C (0x570 for version 5.7)
1.55 rillig 13687: </pre>
13688: </div>
1.1 grant 13689: </div>
1.51 rillig 13690:
1.67 hubertf 13691: <div class="sect2" lang="en">
1.51 rillig 13692: <div class="titlepage">
13693: <div>
13694: <div>
1.67 hubertf 13695: <h3 class="title"><a name=
1.68 rillig 13696: "cpp-list-examples"></a>16.4.2. Examples of
1.60 rillig 13697: CPP defines for some platforms</h3>
13698: </div>
13699: </div>
13700: </div>
13701:
13702: <p>The list of the CPP identification macros for
13703: hardware and operating system may depend on the
13704: compiler that is used. The following list contains some
13705: examples that may help you to choose the right ones.
13706: For example, if you want to conditionally compile code
13707: on Solaris, don't use <code class=
13708: "varname">__sun__</code>, as the SunPro compiler does
13709: not define it. Use <code class="varname">__sun</code>
13710: instead.</p>
13711:
13712: <div class="variablelist">
13713: <dl>
1.61 rillig 13714: <dt><span class="term">GCC 3.3.3 + SuSE Linux 9.1 +
13715: i386</span></dt>
13716:
13717: <dd>
1.62 rillig 13718: <p>__ELF__, __gnu_linux__, __i386, __i386__,
1.61 rillig 13719: __linux, __linux__, __unix, __unix__, i386,
13720: linux, unix.</p>
13721: </dd>
13722:
13723: <dt><span class="term">GCC 2.95 + NetBSD 1.6.2 +
13724: i386</span></dt>
13725:
13726: <dd>
1.62 rillig 13727: <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61 rillig 13728: i386.</p>
13729: </dd>
13730:
13731: <dt><span class="term">GCC 3.3.3 + NetBSD 2.0 +
13732: i386</span></dt>
1.60 rillig 13733:
13734: <dd>
1.62 rillig 13735: <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61 rillig 13736: i386.</p>
1.60 rillig 13737: </dd>
13738:
13739: <dt><span class="term">GCC 4 + Solaris 8 +
13740: SPARC</span></dt>
13741:
13742: <dd>
13743: <p>__ELF__, __sparc, __sparc__, __sun, __sun__,
13744: __SVR4, __svr4__, __unix, __unix__, sparc, sun,
13745: unix.</p>
13746: </dd>
1.61 rillig 13747:
13748: <dt><span class="term">SunPro 5.7 + Solaris 8 +
13749: SPARC</span></dt>
13750:
13751: <dd>
13752: <p>__SVR4, __sparc, __sun, __unix, sparc, sun,
13753: unix.</p>
13754: </dd>
1.60 rillig 13755: </dl>
13756: </div>
13757: </div>
13758:
1.67 hubertf 13759: <div class="sect2" lang="en">
1.60 rillig 13760: <div class="titlepage">
13761: <div>
13762: <div>
1.67 hubertf 13763: <h3 class="title"><a name=
1.68 rillig 13764: "cpp-list"></a>16.4.3. Getting a list of CPP
1.51 rillig 13765: defines</h3>
13766: </div>
13767: </div>
13768: </div>
13769:
1.60 rillig 13770: <p>If your system uses the GNU C Compiler, you can get
13771: a list of symbols that are defined by default, e.g. to
13772: identify the platform, with the following command:</p>
1.51 rillig 13773: <pre class="programlisting">
13774: gcc -E -dM - < /dev/null
13775: </pre>
1.60 rillig 13776:
13777: <p>On other systems you may get the list by using the
13778: system's syscall trace utility (ktrace, truss, strace)
13779: to have a look which arguments are passed to the actual
13780: compiler.</p>
1.51 rillig 13781: </div>
1.1 grant 13782: </div>
13783:
1.67 hubertf 13784: <div class="sect1" lang="en">
1.1 grant 13785: <div class="titlepage">
13786: <div>
13787: <div>
13788: <h2 class="title" style="clear: both"><a name=
1.68 rillig 13789: "package-specific-actions"></a>16.5. Package
1.1 grant 13790: specific actions</h2>
13791: </div>
13792: </div>
13793: </div>
13794:
1.67 hubertf 13795: <div class="sect2" lang="en">
1.1 grant 13796: <div class="titlepage">
13797: <div>
13798: <div>
1.67 hubertf 13799: <h3 class="title"><a name=
1.68 rillig 13800: "user-interaction"></a>16.5.1. User
1.2 hubertf 13801: interaction</h3>
1.1 grant 13802: </div>
13803: </div>
13804: </div>
13805:
13806: <p>Occasionally, packages require interaction from the
13807: user, and this can be in a number of ways:</p>
13808:
13809: <div class="itemizedlist">
13810: <ul type="disc">
13811: <li>
13812: <p>help in fetching the distfiles</p>
13813: </li>
13814:
13815: <li>
13816: <p>help to configure the package before it is
13817: built</p>
13818: </li>
13819:
13820: <li>
13821: <p>help during the build process</p>
13822: </li>
13823:
13824: <li>
13825: <p>help during the installation of a package</p>
13826: </li>
13827: </ul>
13828: </div>
13829:
1.14 xtraeme 13830: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 13831: definition is provided to notify the pkgsrc mechanism
13832: of an interactive stage which will be needed, and this
1.45 wiz 13833: should be set in the package's <code xmlns=
13834: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 13835: "filename">Makefile</code>, e.g.:</p>
1.1 grant 13836: <pre class="programlisting">
1.51 rillig 13837: INTERACTIVE_STAGE= build
1.1 grant 13838: </pre>
13839:
13840: <p>Multiple interactive stages can be specified:</p>
13841: <pre class="programlisting">
1.51 rillig 13842: INTERACTIVE_STAGE= configure install
1.1 grant 13843: </pre>
13844: </div>
13845:
1.67 hubertf 13846: <div class="sect2" lang="en">
1.1 grant 13847: <div class="titlepage">
13848: <div>
13849: <div>
1.67 hubertf 13850: <h3 class="title"><a name=
1.68 rillig 13851: "handling-licenses"></a>16.5.2. Handling
1.1 grant 13852: licenses</h3>
13853: </div>
13854: </div>
13855: </div>
13856:
1.44 gdt 13857: <p>A package may be covered by a license which the user
13858: has or has not agreed to accept. For these cases,
13859: pkgsrc contains a mechanism to note that a package is
13860: covered by a particular license, and the package cannot
13861: be built unless the user has accepted the license.
13862: (Installation of binary packages are not currently
13863: subject to this mechanism.) Packages with licenses that
13864: are either Open Source according to the Open Source
13865: Initiative or Free according to the Free Software
13866: Foundation will not be marked with a license tag.
13867: Packages with licenses that have not been determined to
13868: meet either definition will be marked with a license
13869: tag referring to the license. This will prevent
13870: building unless pkgsrc is informed that the license is
13871: acceptable, and enables displaying the license.</p>
13872:
13873: <p>The license tag mechanism is intended to address
13874: copyright-related issues surrounding building,
13875: installing and using a package, and not to address
13876: redistribution issues (see <code class=
13877: "varname">RESTRICTED</code> and <code class=
13878: "varname">NO_SRC_ON_FTP</code>, etc.). However, the
13879: above definition of licenses for which tags are not
13880: needed implies that packages with redistribution
13881: restrictions should have tags.</p>
13882:
13883: <p>Denoting that a package is covered by a particular
1.45 wiz 13884: license is done by placing the license in <code xmlns=
13885: "http://www.w3.org/TR/xhtml1/transitional" class=
1.44 gdt 13886: "filename">pkgsrc/licenses</code> and setting the
13887: <code class="varname">LICENSE</code> variable to a
13888: string identifying the license, e.g. in <a xmlns=
1.14 xtraeme 13889: "http://www.w3.org/TR/xhtml1/transitional" href=
1.44 gdt 13890: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45 wiz 13891: target="_top"><code xmlns="" class=
13892: "filename">graphics/xv</code></a>:</p>
1.1 grant 13893: <pre class="programlisting">
1.51 rillig 13894: LICENSE= xv-license
1.1 grant 13895: </pre>
13896:
13897: <p>When trying to build, the user will get a notice
1.44 gdt 13898: that the package is covered by a license which has not
13899: been accepted:</p>
1.1 grant 13900: <pre class="programlisting">
1.51 rillig 13901: <code class="prompt">%</code> <strong class=
1.14 xtraeme 13902: "userinput"><code>make</code></strong>
1.51 rillig 13903: ===> xv-3.10anb9 has an unacceptable license: xv-license.
13904: ===> To view the license, enter "/usr/bin/make show-license".
13905: ===> To indicate acceptance, add this line to your /etc/mk.conf:
13906: ===> ACCEPTABLE_LICENSES+=xv-license
13907: *** Error code 1
1.1 grant 13908: </pre>
13909:
1.14 xtraeme 13910: <p>The license can be viewed with <span><strong class=
13911: "command">make show-license</strong></span>, and if it
13912: is considered appropriate, the line printed above can
1.45 wiz 13913: be added to <code xmlns=
13914: "http://www.w3.org/TR/xhtml1/transitional" class=
13915: "filename">/etc/mk.conf</code> to indicate acceptance
13916: of the particular license:</p>
1.1 grant 13917: <pre class="programlisting">
1.51 rillig 13918: ACCEPTABLE_LICENSES+=xv-license
1.1 grant 13919: </pre>
13920:
13921: <p>When adding a package with a new license, the
1.45 wiz 13922: license text should be added to <code xmlns=
13923: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13924: "filename">pkgsrc/licenses</code> for displaying. A
13925: list of known licenses can be seen in this directory as
13926: well as by looking at the list of (commented out)
13927: <code class="varname">ACCEPTABLE_LICENSES</code>
1.45 wiz 13928: variable settings in <code xmlns=
13929: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13930: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 13931:
1.44 gdt 13932: <p>The use of <code class=
13933: "varname">LICENSE=shareware</code>, <code class=
13934: "varname">LICENSE=no-commercial-use</code>, and similar
13935: language is deprecated because it does not crisply
13936: refer to a particular license text. Another problem
13937: with such usage is that it does not enable a user to
13938: denote acceptance of the license for a single package
13939: without accepting the same license text for another
13940: package. In particular, this can be inappropriate when
13941: e.g. one accepts a particular license to indicate to
13942: pkgsrc that a fee has been paid.</p>
1.1 grant 13943: </div>
13944:
1.67 hubertf 13945: <div class="sect2" lang="en">
1.1 grant 13946: <div class="titlepage">
13947: <div>
13948: <div>
1.30 wiz 13949: <h3 class="title"><a name=
1.68 rillig 13950: "installing-score-files"></a>16.5.3. Installing
1.30 wiz 13951: score files</h3>
1.1 grant 13952: </div>
13953: </div>
13954: </div>
13955:
13956: <p>Certain packages, most of them in the games
13957: category, install a score file that allows all users on
13958: the system to record their highscores. In order for
13959: this to work, the binaries need to be installed setgid
13960: and the score files owned by the appropriate group
13961: and/or owner (traditionally the "games" user/group).
13962: The following variables, documented in more detail in
1.45 wiz 13963: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13964: class="filename">mk/defaults/mk.conf</code>, control
13965: this behaviour: <code class=
1.14 xtraeme 13966: "varname">SETGIDGAME</code>, <code class=
13967: "varname">GAMEDATAMODE</code>, <code class=
13968: "varname">GAMEGRP</code>, <code class=
13969: "varname">GAMEMODE</code>, <code class=
13970: "varname">GAMEOWN</code>.</p>
1.1 grant 13971:
13972: <p>Note that per default, setgid installation of games
1.14 xtraeme 13973: is disabled; setting <code class=
13974: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 13975: variables accordingly.</p>
13976:
13977: <p>A package should therefor never hard code file
1.14 xtraeme 13978: ownership or access permissions but rely on
13979: <code class="varname">INSTALL_GAME</code> and
13980: <code class="varname">INSTALL_GAME_DATA</code> to set
13981: these correctly.</p>
1.1 grant 13982: </div>
13983:
1.67 hubertf 13984: <div class="sect2" lang="en">
1.1 grant 13985: <div class="titlepage">
13986: <div>
13987: <div>
1.67 hubertf 13988: <h3 class="title"><a name=
1.68 rillig 13989: "perl-scripts"></a>16.5.4. Packages
1.30 wiz 13990: containing perl scripts</h3>
1.1 grant 13991: </div>
13992: </div>
13993: </div>
13994:
13995: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 13996: set <code class="varname">REPLACE_PERL</code> to ensure
13997: that the proper interpreter path is set. <code class=
13998: "varname">REPLACE_PERL</code> should contain a list of
13999: scripts, relative to <code class=
14000: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 14001: </div>
14002:
1.67 hubertf 14003: <div class="sect2" lang="en">
1.1 grant 14004: <div class="titlepage">
14005: <div>
14006: <div>
1.67 hubertf 14007: <h3 class="title"><a name=
1.68 rillig 14008: "hardcoded-paths"></a>16.5.5. Packages with
1.1 grant 14009: hardcoded paths to other interpreters</h3>
14010: </div>
14011: </div>
14012: </div>
14013:
14014: <p>Your package may also contain scripts with hardcoded
14015: paths to other interpreters besides (or as well as)
14016: perl. To correct the full pathname to the script
14017: interpreter, you need to set the following definitions
1.45 wiz 14018: in your <code xmlns=
14019: "http://www.w3.org/TR/xhtml1/transitional" class=
14020: "filename">Makefile</code> (we shall use
14021: <span><strong class="command">tclsh</strong></span> in
14022: this example):</p>
1.1 grant 14023: <pre class="programlisting">
1.51 rillig 14024: REPLACE_INTERPRETER+= tcl
14025: _REPLACE.tcl.old= .*/bin/tclsh
14026: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
14027: _REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
14028: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1 grant 14029: </pre>
14030: </div>
14031:
1.67 hubertf 14032: <div class="sect2" lang="en">
1.1 grant 14033: <div class="titlepage">
14034: <div>
14035: <div>
1.67 hubertf 14036: <h3 class="title"><a name=
1.68 rillig 14037: "perl-modules"></a>16.5.6. Packages
1.30 wiz 14038: installing perl modules</h3>
1.1 grant 14039: </div>
14040: </div>
14041: </div>
14042:
14043: <p>Makefiles of packages providing perl5 modules should
1.45 wiz 14044: include the Makefile fragment <code xmlns=
14045: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14046: "filename">../../lang/perl5/module.mk</code>. It
14047: provides a <span><strong class=
14048: "command">do-configure</strong></span> target for the
14049: standard perl configuration for such modules as well as
14050: various hooks to tune this configuration. See comments
14051: in this file for details.</p>
1.1 grant 14052:
14053: <p>Perl5 modules will install into different places
14054: depending on the version of perl used during the build
14055: process. To address this, pkgsrc will append lines to
1.45 wiz 14056: the <code xmlns=
14057: "http://www.w3.org/TR/xhtml1/transitional" class=
14058: "filename">PLIST</code> corresponding to the files
14059: listed in the installed <code xmlns=
14060: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14061: "filename">.packlist</code> file generated by most
14062: perl5 modules. This is invoked by defining <code class=
14063: "varname">PERL5_PACKLIST</code> to a space-separated
14064: list of paths to packlist files, e.g.:</p>
1.1 grant 14065: <pre class="programlisting">
1.51 rillig 14066: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1 grant 14067: </pre>
14068:
1.14 xtraeme 14069: <p>The variables <code class=
14070: "varname">PERL5_SITELIB</code>, <code class=
14071: "varname">PERL5_SITEARCH</code>, and <code class=
14072: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 14073: locations in which perl5 modules may be installed, and
14074: may be used by perl5 packages that don't have a
14075: packlist. These three variables are also substituted
1.45 wiz 14076: for in the <code xmlns=
14077: "http://www.w3.org/TR/xhtml1/transitional" class=
14078: "filename">PLIST</code>.</p>
1.1 grant 14079: </div>
14080:
1.67 hubertf 14081: <div class="sect2" lang="en">
1.1 grant 14082: <div class="titlepage">
14083: <div>
14084: <div>
1.67 hubertf 14085: <h3 class="title"><a name=
1.68 rillig 14086: "faq.info-files"></a>16.5.7. Packages
1.1 grant 14087: installing info files</h3>
14088: </div>
14089: </div>
14090: </div>
14091:
14092: <p>Some packages install info files or use the
14093: “<span class="quote">makeinfo</span>” or
14094: “<span class="quote">install-info</span>”
14095: commands. Each of the info files:</p>
14096:
14097: <div class="itemizedlist">
14098: <ul type="disc">
14099: <li>
14100: <p>is considered to be installed in the directory
1.45 wiz 14101: <code xmlns=
14102: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14103: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 14104: </li>
14105:
14106: <li>
14107: <p>is registered in the Info directory file
1.45 wiz 14108: <code xmlns=
14109: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14110: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 14111: </li>
14112:
14113: <li>
14114: <p>and must be listed as a filename in the
1.14 xtraeme 14115: <code class="varname">INFO_FILES</code> variable
14116: in the package Makefile.</p>
1.1 grant 14117: </li>
14118: </ul>
14119: </div>
14120:
1.14 xtraeme 14121: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 14122: “<span class="quote">info</span>” and can
1.45 wiz 14123: be overridden in the package Makefile. <code xmlns=
14124: "http://www.w3.org/TR/xhtml1/transitional" class=
14125: "filename">INSTALL</code> and <code xmlns=
14126: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14127: "filename">DEINSTALL</code> scripts will be generated
14128: to handle registration of the info files in the Info
1.1 grant 14129: directory file. The “<span class=
14130: "quote">install-info</span>” command used for the
14131: info files registration is either provided by the
14132: system, or by a special purpose package automatically
14133: added as dependency if needed.</p>
14134:
14135: <p>A package which needs the “<span class=
14136: "quote">makeinfo</span>” command at build time
1.14 xtraeme 14137: must define the variable <code class=
14138: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 14139: minimum version of the “<span class=
14140: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 14141: should be noted with the <code class=
14142: "varname">TEXINFO_REQD</code> variable in the package
1.45 wiz 14143: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14144: class="filename">Makefile</code>. By default, a minimum
14145: version of 3.12 is required. If the system does not
14146: provide a <span><strong class=
1.14 xtraeme 14147: "command">makeinfo</strong></span> command or if it
14148: does not match the required minimum, a build dependency
14149: on the <a xmlns=
14150: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 14151: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45 wiz 14152: target="_top"><code xmlns="" class=
14153: "filename">devel/gtexinfo</code></a> package will be
1.20 ben 14154: added automatically.</p>
1.1 grant 14155:
14156: <p>The build and installation process of the software
14157: provided by the package should not use the
1.14 xtraeme 14158: <span><strong class=
14159: "command">install-info</strong></span> command as the
14160: registration of info files is the task of the package
1.45 wiz 14161: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14162: class="filename">INSTALL</code> script, and it must use
14163: the appropriate <span><strong class=
1.14 xtraeme 14164: "command">makeinfo</strong></span> command.</p>
1.1 grant 14165:
1.47 reed 14166: <p>To achieve this goal, the pkgsrc infrastructure
1.14 xtraeme 14167: creates overriding scripts for the <span><strong class=
14168: "command">install-info</strong></span> and
14169: <span><strong class="command">makeinfo</strong></span>
14170: commands in a directory listed early in <code class=
14171: "varname">PATH</code>.</p>
1.1 grant 14172:
1.14 xtraeme 14173: <p>The script overriding <span><strong class=
14174: "command">install-info</strong></span> has no effect
14175: except the logging of a message. The script overriding
14176: <span><strong class="command">makeinfo</strong></span>
14177: logs a message and according to the value of
14178: <code class="varname">USE_MAKEINFO</code> and
14179: <code class="varname">TEXINFO_REQD</code> either run
14180: the appropriate <span><strong class=
14181: "command">makeinfo</strong></span> command or exit on
14182: error.</p>
1.1 grant 14183: </div>
14184:
1.67 hubertf 14185: <div class="sect2" lang="en">
1.57 minskim 14186: <div class="titlepage">
14187: <div>
14188: <div>
1.67 hubertf 14189: <h3 class="title"><a name=
1.68 rillig 14190: "manpages"></a>16.5.8. Packages installing
1.57 minskim 14191: man pages</h3>
14192: </div>
14193: </div>
14194: </div>
14195:
14196: <p>Many packages install manual pages. The man pages
14197: are installed under <code class=
14198: "varname">${PREFIX}/${PKGMANDIR}</code> which is
14199: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14200: class="filename">/usr/pkg/man</code> by default.
14201: <code class="varname">PKGMANDIR</code> defaults to
14202: “<span class="quote">man</span>”. For
14203: example, you can set <code class=
14204: "varname">PKGMANDIR</code> to “<span class=
14205: "quote">share/man</span>” to have man pages
14206: install under <code xmlns=
14207: "http://www.w3.org/TR/xhtml1/transitional" class=
14208: "filename">/usr/pkg/share/man/</code> by default.</p>
14209:
14210: <div class="note" style=
14211: "margin-left: 0.5in; margin-right: 0.5in;">
14212: <h3 class="title">Note</h3>
14213:
14214: <p>The support for a custom <code class=
14215: "varname">PKGMANDIR</code> is not complete.</p>
14216: </div>
14217:
14218: <p>The <code xmlns=
14219: "http://www.w3.org/TR/xhtml1/transitional" class=
14220: "filename">PLIST</code> files can just use <code xmlns=
14221: "http://www.w3.org/TR/xhtml1/transitional" class=
14222: "filename">man/</code> as the top level directory for
14223: the man page file entries and the pkgsrc framework will
14224: convert as needed.</p>
14225:
14226: <p>Packages that are configured with <code class=
14227: "varname">GNU_CONFIGURE</code> set as
14228: “<span class="quote">yes</span>”, by
14229: default will use the <code xmlns=
14230: "http://www.w3.org/TR/xhtml1/transitional" class=
14231: "filename">./configure</code> --mandir switch to set
14232: where the man pages should be installed. The path is
14233: <code class="varname">GNU_CONFIGURE_MANDIR</code> which
14234: defaults to <code class=
14235: "varname">${PREFIX}/${PKGMANDIR}</code>.</p>
14236:
14237: <p>Packages that use <code class=
14238: "varname">GNU_CONFIGURE</code> but do not use --mandir,
14239: can set <code class=
14240: "varname">CONFIGURE_HAS_MANDIR</code> to
14241: “<span class="quote">no</span>”. Or if the
14242: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14243: class="filename">./configure</code> script uses a
14244: non-standard use of --mandir, you can set <code class=
14245: "varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
14246:
14247: <p>See <a href="#manpage-compression" title=
14248: "10.5. Man page compression">Section 10.5,
14249: “Man page compression”</a> for information
14250: on installation of compressed manual pages.</p>
14251: </div>
14252:
1.67 hubertf 14253: <div class="sect2" lang="en">
1.1 grant 14254: <div class="titlepage">
14255: <div>
14256: <div>
1.67 hubertf 14257: <h3 class="title"><a name=
1.68 rillig 14258: "gconf2-data-files"></a>16.5.9. Packages
1.30 wiz 14259: installing GConf2 data files</h3>
1.1 grant 14260: </div>
14261: </div>
14262: </div>
14263:
1.45 wiz 14264: <p>If a package installs <code xmlns=
14265: "http://www.w3.org/TR/xhtml1/transitional" class=
14266: "filename">.schemas</code> or <code xmlns=
14267: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14268: "filename">.entries</code> files, used by GConf2, you
1.1 grant 14269: need to take some extra steps to make sure they get
14270: registered in the database:</p>
14271:
14272: <div class="orderedlist">
14273: <ol type="1">
14274: <li>
1.45 wiz 14275: <p>Include <code xmlns=
14276: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14277: "filename">../../devel/GConf2/schemas.mk</code>
1.45 wiz 14278: instead of its <code xmlns=
14279: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14280: "filename">buildlink3.mk</code> file. This takes
1.1 grant 14281: care of rebuilding the GConf2 database at
14282: installation and deinstallation time, and tells
14283: the package where to install GConf2 data files
14284: using some standard configure arguments. It also
14285: disallows any access to the database directly
14286: from the package.</p>
14287: </li>
14288:
14289: <li>
14290: <p>Ensure that the package installs its
1.45 wiz 14291: <code xmlns=
14292: "http://www.w3.org/TR/xhtml1/transitional" class=
14293: "filename">.schemas</code> files under
14294: <code xmlns=
14295: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14296: "filename">${PREFIX}/share/gconf/schemas</code>.
1.45 wiz 14297: If they get installed under <code xmlns=
14298: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14299: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 14300: manually patch the package.</p>
14301: </li>
14302:
14303: <li>
14304: <p>Check the PLIST and remove any entries under
14305: the etc/gconf directory, as they will be handled
14306: automatically. See <a href="#faq.conf" title=
1.38 dillo 14307: "7.14. How do I change the location of configuration files?">
14308: Section 7.14, “How do I change the
1.35 jmmv 14309: location of configuration files?”</a> for
14310: more information.</p>
1.1 grant 14311: </li>
14312:
14313: <li>
1.14 xtraeme 14314: <p>Define the <code class=
14315: "varname">GCONF2_SCHEMAS</code> variable in your
1.45 wiz 14316: <code xmlns=
14317: "http://www.w3.org/TR/xhtml1/transitional" class=
14318: "filename">Makefile</code> with a list of all
14319: <code xmlns=
14320: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14321: "filename">.schemas</code> files installed by the
14322: package, if any. Names must not contain any
14323: directories in them.</p>
1.1 grant 14324: </li>
14325:
14326: <li>
1.14 xtraeme 14327: <p>Define the <code class=
14328: "varname">GCONF2_ENTRIES</code> variable in your
1.45 wiz 14329: <code xmlns=
14330: "http://www.w3.org/TR/xhtml1/transitional" class=
14331: "filename">Makefile</code> with a list of all
14332: <code xmlns=
14333: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14334: "filename">.entries</code> files installed by the
14335: package, if any. Names must not contain any
14336: directories in them.</p>
1.1 grant 14337: </li>
14338: </ol>
14339: </div>
14340: </div>
14341:
1.67 hubertf 14342: <div class="sect2" lang="en">
1.1 grant 14343: <div class="titlepage">
14344: <div>
14345: <div>
1.30 wiz 14346: <h3 class="title"><a name=
1.68 rillig 14347: "scrollkeeper-data-files"></a>16.5.10. Packages
1.30 wiz 14348: installing scrollkeeper data files</h3>
1.1 grant 14349: </div>
14350: </div>
14351: </div>
14352:
1.45 wiz 14353: <p>If a package installs <code xmlns=
14354: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14355: "filename">.omf</code> files, used by scrollkeeper, you
14356: need to take some extra steps to make sure they get
14357: registered in the database:</p>
1.1 grant 14358:
14359: <div class="orderedlist">
14360: <ol type="1">
14361: <li>
1.45 wiz 14362: <p>Include <code xmlns=
14363: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14364: "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45 wiz 14365: instead of its <code xmlns=
14366: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14367: "filename">buildlink3.mk</code> file. This takes
1.1 grant 14368: care of rebuilding the scrollkeeper database at
14369: installation and deinstallation time, and
14370: disallows any access to it directly from the
14371: package.</p>
14372: </li>
14373:
14374: <li>
14375: <p>Check the PLIST and remove any entries under
1.45 wiz 14376: the <code xmlns=
14377: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14378: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 14379: as they will be handled automatically.</p>
14380: </li>
14381:
14382: <li>
1.45 wiz 14383: <p>Remove the <code xmlns=
14384: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14385: "filename">share/omf</code> directory from the
14386: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 14387: </li>
14388: </ol>
14389: </div>
14390: </div>
14391:
1.67 hubertf 14392: <div class="sect2" lang="en">
1.1 grant 14393: <div class="titlepage">
14394: <div>
14395: <div>
1.67 hubertf 14396: <h3 class="title"><a name=
1.68 rillig 14397: "x11-fonts"></a>16.5.11. Packages installing
1.1 grant 14398: X11 fonts</h3>
14399: </div>
14400: </div>
14401: </div>
14402:
14403: <p>If a package installs font files, you will need to
14404: rebuild the fonts database in the directory where they
14405: get installed at installation and deinstallation time.
1.65 hubertf 14406: This can be automatically done by using the pkginstall
14407: framework.</p>
1.1 grant 14408:
1.65 hubertf 14409: <p>You can list the directories where fonts are
14410: installed in the <code class=
14411: "varname">FONTS_DIRS.<em class=
14412: "replaceable"><code>type</code></em></code> variables,
14413: where <em class="replaceable"><code>type</code></em>
14414: can be one of “<span class=
14415: "quote">ttf</span>”, “<span class=
14416: "quote">type1</span>” or “<span class=
14417: "quote">x11</span>”. Also make sure that the
14418: database file <code xmlns=
1.45 wiz 14419: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14420: "filename">fonts.dir</code> is not listed in the
1.1 grant 14421: PLIST.</p>
14422:
14423: <p>Note that you should not create new directories for
14424: fonts; instead use the standard ones to avoid that the
14425: user needs to manually configure his X server to find
14426: them.</p>
14427: </div>
14428:
1.67 hubertf 14429: <div class="sect2" lang="en">
1.1 grant 14430: <div class="titlepage">
14431: <div>
14432: <div>
1.67 hubertf 14433: <h3 class="title"><a name=
1.68 rillig 14434: "gtk2-modules"></a>16.5.12. Packages
1.30 wiz 14435: installing GTK2 modules</h3>
1.1 grant 14436: </div>
14437: </div>
14438: </div>
14439:
1.47 reed 14440: <p>If a package installs GTK2 immodules or loaders, you
1.1 grant 14441: need to take some extra steps to get them registered in
14442: the GTK2 database properly:</p>
14443:
14444: <div class="orderedlist">
14445: <ol type="1">
14446: <li>
1.45 wiz 14447: <p>Include <code xmlns=
14448: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14449: "filename">../../x11/gtk2/modules.mk</code>
1.45 wiz 14450: instead of its <code xmlns=
14451: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14452: "filename">buildlink3.mk</code> file. This takes
14453: care of rebuilding the database at installation
14454: and deinstallation time.</p>
1.1 grant 14455: </li>
14456:
14457: <li>
1.14 xtraeme 14458: <p>Set <code class=
14459: "varname">GTK2_IMMODULES=YES</code> if your
14460: package installs GTK2 immodules.</p>
1.1 grant 14461: </li>
14462:
14463: <li>
1.14 xtraeme 14464: <p>Set <code class=
14465: "varname">GTK2_LOADERS=YES</code> if your package
14466: installs GTK2 loaders.</p>
1.1 grant 14467: </li>
14468:
14469: <li>
1.47 reed 14470: <p>Patch the package to not touch any of the GTK2
1.1 grant 14471: databases directly. These are:</p>
14472:
14473: <div class="itemizedlist">
14474: <ul type="disc">
14475: <li>
1.45 wiz 14476: <p><code xmlns=
14477: "http://www.w3.org/TR/xhtml1/transitional"
14478: class=
1.14 xtraeme 14479: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 14480: </li>
14481:
14482: <li>
1.45 wiz 14483: <p><code xmlns=
14484: "http://www.w3.org/TR/xhtml1/transitional"
14485: class=
1.14 xtraeme 14486: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 14487: </li>
14488: </ul>
14489: </div>
14490: </li>
14491:
14492: <li>
14493: <p>Check the PLIST and remove any entries under
1.45 wiz 14494: the <code xmlns=
14495: "http://www.w3.org/TR/xhtml1/transitional" class=
14496: "filename">libdata/gtk-2.0</code> directory, as
14497: they will be handled automatically.</p>
1.1 grant 14498: </li>
14499: </ol>
14500: </div>
14501: </div>
14502:
1.67 hubertf 14503: <div class="sect2" lang="en">
1.1 grant 14504: <div class="titlepage">
14505: <div>
14506: <div>
1.67 hubertf 14507: <h3 class="title"><a name=
1.68 rillig 14508: "sgml-xml-data"></a>16.5.13. Packages
1.30 wiz 14509: installing SGML or XML data</h3>
1.1 grant 14510: </div>
14511: </div>
14512: </div>
14513:
14514: <p>If a package installs SGML or XML data files that
14515: need to be registered in system-wide catalogs (like
14516: DTDs, sub-catalogs, etc.), you need to take some extra
14517: steps:</p>
14518:
14519: <div class="orderedlist">
14520: <ol type="1">
14521: <li>
1.45 wiz 14522: <p>Include <code xmlns=
14523: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14524: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45 wiz 14525: in your <code xmlns=
14526: "http://www.w3.org/TR/xhtml1/transitional" class=
14527: "filename">Makefile</code>, which takes care of
14528: registering those files in system-wide catalogs
14529: at installation and deinstallation time.</p>
1.1 grant 14530: </li>
14531:
14532: <li>
1.14 xtraeme 14533: <p>Set <code class="varname">SGML_CATALOGS</code>
14534: to the full path of any SGML catalogs installed
14535: by the package.</p>
1.1 grant 14536: </li>
14537:
14538: <li>
1.14 xtraeme 14539: <p>Set <code class="varname">XML_CATALOGS</code>
14540: to the full path of any XML catalogs installed by
1.1 grant 14541: the package.</p>
14542: </li>
14543:
14544: <li>
1.14 xtraeme 14545: <p>Set <code class="varname">SGML_ENTRIES</code>
14546: to individual entries to be added to the SGML
1.1 grant 14547: catalog. These come in groups of three strings;
14548: see xmlcatmgr(1) for more information
14549: (specifically, arguments recognized by the 'add'
14550: action). Note that you will normally not use this
14551: variable.</p>
14552: </li>
14553:
14554: <li>
1.14 xtraeme 14555: <p>Set <code class="varname">XML_ENTRIES</code>
14556: to individual entries to be added to the XML
1.1 grant 14557: catalog. These come in groups of three strings;
14558: see xmlcatmgr(1) for more information
14559: (specifically, arguments recognized by the 'add'
14560: action). Note that you will normally not use this
14561: variable.</p>
14562: </li>
14563: </ol>
14564: </div>
14565: </div>
14566:
1.67 hubertf 14567: <div class="sect2" lang="en">
1.1 grant 14568: <div class="titlepage">
14569: <div>
14570: <div>
1.67 hubertf 14571: <h3 class="title"><a name=
1.68 rillig 14572: "mime-database"></a>16.5.14. Packages
1.30 wiz 14573: installing extensions to the MIME database</h3>
1.1 grant 14574: </div>
14575: </div>
14576: </div>
14577:
14578: <p>If a package provides extensions to the MIME
1.45 wiz 14579: database by installing <code xmlns=
14580: "http://www.w3.org/TR/xhtml1/transitional" class=
14581: "filename">.xml</code> files inside <code xmlns=
14582: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14583: "filename">${PREFIX}/share/mime/packages</code>, you
14584: need to take some extra steps to ensure that the
14585: database is kept consistent with respect to these new
14586: files:</p>
1.1 grant 14587:
14588: <div class="orderedlist">
14589: <ol type="1">
14590: <li>
1.45 wiz 14591: <p>Include <code xmlns=
14592: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14593: "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45 wiz 14594: (avoid using the <code xmlns=
14595: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14596: "filename">buildlink3.mk</code> file from this
14597: same directory, which is reserved for inclusion
1.45 wiz 14598: from other <code xmlns=
14599: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14600: "filename">buildlink3.mk</code> files). It takes
14601: care of rebuilding the MIME database at
14602: installation and deinstallation time, and
14603: disallows any access to it directly from the
1.1 grant 14604: package.</p>
14605: </li>
14606:
14607: <li>
14608: <p>Check the PLIST and remove any entries under
1.45 wiz 14609: the <code xmlns=
14610: "http://www.w3.org/TR/xhtml1/transitional" class=
14611: "filename">share/mime</code> directory,
14612: <span class="emphasis"><em>except</em></span> for
14613: files saved under <code xmlns=
14614: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14615: "filename">share/mime/packages</code>. The former
1.1 grant 14616: are handled automatically by the
1.47 reed 14617: update-mime-database program, but the latter are
1.1 grant 14618: package-dependent and must be removed by the
14619: package that installed them in the first
14620: place.</p>
14621: </li>
14622:
14623: <li>
1.45 wiz 14624: <p>Remove any <code xmlns=
14625: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14626: "filename">share/mime/*</code> directories from
14627: the PLIST. They will be handled by the
1.1 grant 14628: shared-mime-info package.</p>
14629: </li>
14630: </ol>
14631: </div>
14632: </div>
14633:
1.67 hubertf 14634: <div class="sect2" lang="en">
1.1 grant 14635: <div class="titlepage">
14636: <div>
14637: <div>
1.67 hubertf 14638: <h3 class="title"><a name=
1.68 rillig 14639: "intltool"></a>16.5.15. Packages using
1.1 grant 14640: intltool</h3>
14641: </div>
14642: </div>
14643: </div>
14644:
14645: <p>If a package uses intltool during its build, include
1.45 wiz 14646: the <code xmlns=
14647: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14648: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 14649: file, which forces it to use the intltool package
14650: provided by pkgsrc, instead of the one bundled with the
14651: distribution file.</p>
14652:
14653: <p>This tracks intltool's build-time dependencies and
14654: uses the latest available version; this way, the
14655: package benefits of any bug fixes that may have
14656: appeared since it was released.</p>
14657: </div>
1.18 xtraeme 14658:
1.67 hubertf 14659: <div class="sect2" lang="en">
1.18 xtraeme 14660: <div class="titlepage">
14661: <div>
14662: <div>
1.67 hubertf 14663: <h3 class="title"><a name=
1.68 rillig 14664: "startup-scripts"></a>16.5.16. Packages
1.30 wiz 14665: installing startup scripts</h3>
1.18 xtraeme 14666: </div>
14667: </div>
14668: </div>
14669:
14670: <p>If a package contains a rc.d script, it won't be
14671: copied into the startup directory by default, but you
14672: can enable it, by adding the option <code class=
1.45 wiz 14673: "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
14674: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 14675: "filename">/etc/mk.conf</code>. This option will copy
1.45 wiz 14676: the scripts into <code xmlns=
14677: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 14678: "filename">/etc/rc.d</code> when a package is
14679: installed, and it will automatically remove the scripts
14680: when the package is deinstalled.</p>
14681: </div>
1.57 minskim 14682:
1.67 hubertf 14683: <div class="sect2" lang="en">
1.57 minskim 14684: <div class="titlepage">
14685: <div>
14686: <div>
1.67 hubertf 14687: <h3 class="title"><a name=
1.68 rillig 14688: "tex-packages"></a>16.5.17. Packages
1.57 minskim 14689: installing TeX modules</h3>
14690: </div>
14691: </div>
14692: </div>
14693:
14694: <p>If a package installs TeX packages into the texmf
14695: tree, the <code xmlns=
14696: "http://www.w3.org/TR/xhtml1/transitional" class=
14697: "filename">ls-R</code> database of the tree needs to be
14698: updated.</p>
14699:
14700: <div class="note" style=
14701: "margin-left: 0.5in; margin-right: 0.5in;">
14702: <h3 class="title">Note</h3>
14703:
14704: <p>Except the main TeX packages such as teTeX-texmf,
14705: packages should install files into <code class=
14706: "varname">PKG_LOCALTEXMFPREFIX</code>, not
14707: <code class="varname">PKG_TEXMFPREFIX</code>.</p>
14708: </div>
14709:
14710: <div class="orderedlist">
14711: <ol type="1">
14712: <li>
14713: <p>Include <code xmlns=
14714: "http://www.w3.org/TR/xhtml1/transitional" class=
14715: "filename">../../print/teTeX/module.mk</code>
14716: instead of <code xmlns=
14717: "http://www.w3.org/TR/xhtml1/transitional" class=
14718: "filename">../../mk/tex.buildlink3.mk</code>.
14719: This takes care of rebuilding the <code xmlns=
14720: "http://www.w3.org/TR/xhtml1/transitional" class=
14721: "filename">ls-R</code> database at installation
14722: and deinstallation time.</p>
14723: </li>
14724:
14725: <li>
14726: <p>If your package installs files into a texmf
14727: tree other than the one at <code class=
14728: "varname">PKG_LOCALTEXMFPREFIX</code>, set
14729: <code class="varname">TEXMFDIRS</code> to the
14730: list of all texmf trees that need database
14731: update.</p>
1.64 kim 14732:
14733: <p>If your package also installs font map files
14734: that need to be registered using
14735: <span><strong class=
14736: "command">updmap</strong></span>, set
14737: <code class="varname">TEX_FONTMAPS</code> to the
14738: list of all such font map files. Then
14739: <span><strong class=
14740: "command">updmap</strong></span> will be run
14741: automatically at installation/deinstallation to
14742: enable/disable font map files for TeX output
14743: drivers.</p>
1.57 minskim 14744: </li>
14745:
14746: <li>
14747: <p>Make sure that none of <code xmlns=
14748: "http://www.w3.org/TR/xhtml1/transitional" class=
14749: "filename">ls-R</code> databases are included in
14750: <code xmlns=
14751: "http://www.w3.org/TR/xhtml1/transitional" class=
14752: "filename">PLIST</code>, as they will be removed
14753: only by the teTeX-bin package.</p>
14754: </li>
14755: </ol>
14756: </div>
14757: </div>
1.1 grant 14758: </div>
14759:
1.67 hubertf 14760: <div class="sect1" lang="en">
1.1 grant 14761: <div class="titlepage">
14762: <div>
14763: <div>
14764: <h2 class="title" style="clear: both"><a name=
1.68 rillig 14765: "feedback-to-author"></a>16.6. Feedback to the
1.30 wiz 14766: author</h2>
1.1 grant 14767: </div>
14768: </div>
14769: </div>
14770:
14771: <p>If you have found any bugs in the package you make
14772: available, if you had to do special steps to make it run
14773: under NetBSD or if you enhanced the software in various
14774: other ways, be sure to report these changes back to the
14775: original author of the program! With that kind of
14776: support, the next release of the program can incorporate
14777: these fixes, and people not using the NetBSD packages
14778: system can win from your efforts.</p>
14779:
14780: <p>Support the idea of free software!</p>
14781: </div>
14782: </div>
14783:
1.67 hubertf 14784: <div class="chapter" lang="en">
1.1 grant 14785: <div class="titlepage">
14786: <div>
14787: <div>
1.67 hubertf 14788: <h2 class="title"><a name=
1.68 rillig 14789: "debug"></a>Chapter 17. Debugging</h2>
1.1 grant 14790: </div>
14791: </div>
14792: </div>
14793:
14794: <p>To check out all the gotchas when building a package,
14795: here are the steps that I do in order to get a package
14796: working. Please note this is basically the same as what was
14797: explained in the previous sections, only with some
14798: debugging aids.</p>
14799:
14800: <div class="itemizedlist">
14801: <ul type="disc">
14802: <li>
1.14 xtraeme 14803: <p>Be sure to set <code class=
1.45 wiz 14804: "varname">PKG_DEVELOPER=1</code> in <code xmlns=
14805: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14806: "filename">/etc/mk.conf</code></p>
1.1 grant 14807: </li>
14808:
14809: <li>
14810: <p>Install <a xmlns=
14811: "http://www.w3.org/TR/xhtml1/transitional" href=
14812: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 14813: target="_top"><code xmlns="" class=
14814: "filename">pkgtools/url2pkg</code></a>, create a
1.20 ben 14815: directory for a new package, change into it, then run
14816: <span><strong class=
14817: "command">url2pkg</strong></span>:</p>
1.1 grant 14818: <pre class="screen">
1.14 xtraeme 14819: <code class="prompt">%</code> <strong class=
14820: "userinput"><code>mkdir /usr/pkgsrc/<em class=
14821: "replaceable"><code>category</code></em>/<em class=
14822: "replaceable"><code>examplepkg</code></em></code></strong>
14823: <code class="prompt">%</code> <strong class=
14824: "userinput"><code>cd /usr/pkgsrc/<em class=
14825: "replaceable"><code>category</code></em>/<em class=
14826: "replaceable"><code>examplepkg</code></em></code></strong>
14827: <code class="prompt">%</code> <strong class=
14828: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 14829: </pre>
14830: </li>
14831:
14832: <li>
1.45 wiz 14833: <p>Edit the <code xmlns=
14834: "http://www.w3.org/TR/xhtml1/transitional" class=
14835: "filename">Makefile</code> as requested.</p>
1.1 grant 14836: </li>
14837:
14838: <li>
1.45 wiz 14839: <p>Fill in the <code xmlns=
14840: "http://www.w3.org/TR/xhtml1/transitional" class=
14841: "filename">DESCR</code> file</p>
1.1 grant 14842: </li>
14843:
14844: <li>
1.14 xtraeme 14845: <p>Run <span><strong class="command">make
14846: configure</strong></span></p>
1.1 grant 14847: </li>
14848:
14849: <li>
14850: <p>Add any dependencies glimpsed from documentation
1.45 wiz 14851: and the configure step to the package's <code xmlns=
14852: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14853: "filename">Makefile</code>.</p>
1.1 grant 14854: </li>
14855:
14856: <li>
14857: <p>Make the package compile, doing multiple rounds
14858: of</p>
14859: <pre class="screen">
1.14 xtraeme 14860: <code class="prompt">%</code> <strong class=
14861: "userinput"><code>make</code></strong>
14862: <code class="prompt">%</code> <strong class=
14863: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
14864: <code class="prompt">%</code> <strong class=
14865: "userinput"><code>mkpatches</code></strong>
14866: <code class="prompt">%</code> <strong class=
14867: "userinput"><code>patchdiff</code></strong>
14868: <code class="prompt">%</code> <strong class=
14869: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
14870: <code class="prompt">%</code> <strong class=
14871: "userinput"><code>make mps</code></strong>
14872: <code class="prompt">%</code> <strong class=
14873: "userinput"><code>make clean</code></strong>
1.1 grant 14874: </pre>
14875:
14876: <p>Doing as non-root user will ensure that no files
14877: are modified that shouldn't be, especially during the
1.14 xtraeme 14878: build phase. <span><strong class=
14879: "command">mkpatches</strong></span>,
14880: <span><strong class=
14881: "command">patchdiff</strong></span> and
14882: <span><strong class="command">pkgvi</strong></span>
14883: are from the <a xmlns=
1.1 grant 14884: "http://www.w3.org/TR/xhtml1/transitional" href=
14885: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 14886: target="_top"><code xmlns="" class=
14887: "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1 grant 14888: </li>
14889:
14890: <li>
1.45 wiz 14891: <p>Look at the <code xmlns=
14892: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14893: "filename">Makefile</code>, fix if necessary; see
14894: <a href="#components.Makefile" title=
1.38 dillo 14895: "8.1. Makefile">Section 8.1,
1.45 wiz 14896: “<code xmlns=
14897: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14898: "filename">Makefile</code>”</a>.</p>
1.1 grant 14899: </li>
14900:
14901: <li>
1.45 wiz 14902: <p>Generate a <code xmlns=
14903: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14904: "filename">PLIST</code>:</p>
1.1 grant 14905: <pre class="screen">
1.14 xtraeme 14906: <code class="prompt">#</code> <strong class=
14907: "userinput"><code>make install</code></strong>
14908: <code class="prompt">#</code> <strong class=
14909: "userinput"><code>make print-PLIST >PLIST</code></strong>
14910: <code class="prompt">#</code> <strong class=
14911: "userinput"><code>make deinstall</code></strong>
14912: <code class="prompt">#</code> <strong class=
14913: "userinput"><code>make install</code></strong>
14914: <code class="prompt">#</code> <strong class=
14915: "userinput"><code>make deinstall</code></strong>
1.1 grant 14916: </pre>
14917:
1.45 wiz 14918: <p>You usually need to be <code xmlns=
14919: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14920: "username">root</code> to do this. Look if there are
1.1 grant 14921: any files left:</p>
14922: <pre class="screen">
1.14 xtraeme 14923: <code class="prompt">#</code> <strong class=
14924: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 14925: </pre>
14926:
14927: <p>If this reveals any files that are missing in
1.45 wiz 14928: <code xmlns=
14929: "http://www.w3.org/TR/xhtml1/transitional" class=
14930: "filename">PLIST</code>, add them.</p>
1.1 grant 14931: </li>
14932:
14933: <li>
1.45 wiz 14934: <p>Now that the <code xmlns=
14935: "http://www.w3.org/TR/xhtml1/transitional" class=
14936: "filename">PLIST</code> is OK, install the package
14937: again and make a binary package:</p>
1.1 grant 14938: <pre class="screen">
1.14 xtraeme 14939: <code class="prompt">#</code> <strong class=
14940: "userinput"><code>make reinstall</code></strong>
14941: <code class="prompt">#</code> <strong class=
14942: "userinput"><code>make package</code></strong>
1.1 grant 14943: </pre>
14944: </li>
14945:
14946: <li>
14947: <p>Delete the installed package:</p>
14948: <pre class="screen">
1.14 xtraeme 14949: <code class="prompt">#</code> <strong class=
14950: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 14951: </pre>
14952: </li>
14953:
14954: <li>
1.14 xtraeme 14955: <p>Repeat the above <span><strong class=
14956: "command">make print-PLIST</strong></span> command,
14957: which shouldn't find anything now:</p>
1.1 grant 14958: <pre class="screen">
1.14 xtraeme 14959: <code class="prompt">#</code> <strong class=
14960: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 14961: </pre>
14962: </li>
14963:
14964: <li>
14965: <p>Reinstall the binary package:</p>
14966: <pre class="screen">
1.14 xtraeme 14967: <code class="prompt">#</code> <strong class=
14968: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 14969: </pre>
14970: </li>
14971:
14972: <li>
14973: <p>Play with it. Make sure everything works.</p>
14974: </li>
14975:
14976: <li>
1.14 xtraeme 14977: <p>Run <span><strong class=
14978: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 14979: "http://www.w3.org/TR/xhtml1/transitional" href=
14980: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 14981: target="_top"><code xmlns="" class=
14982: "filename">pkgtools/pkglint</code></a>, and fix the
1.20 ben 14983: problems it reports:</p>
1.1 grant 14984: <pre class="screen">
1.14 xtraeme 14985: <code class="prompt">#</code> <strong class=
14986: "userinput"><code>pkglint</code></strong>
1.1 grant 14987: </pre>
14988: </li>
14989:
14990: <li>
14991: <p>Submit (or commit, if you have cvs access); see
14992: <a href="#submit" title=
1.68 rillig 14993: "Chapter 18. Submitting and Committing">Chapter 18,
1.1 grant 14994: <i>Submitting and Committing</i></a>.</p>
14995: </li>
14996: </ul>
14997: </div>
14998: </div>
14999:
1.67 hubertf 15000: <div class="chapter" lang="en">
1.1 grant 15001: <div class="titlepage">
15002: <div>
15003: <div>
1.67 hubertf 15004: <h2 class="title"><a name=
1.68 rillig 15005: "submit"></a>Chapter 18. Submitting and
1.1 grant 15006: Committing</h2>
15007: </div>
15008: </div>
15009: </div>
15010:
15011: <div class="toc">
15012: <p><b>Table of Contents</b></p>
15013:
15014: <dl>
1.30 wiz 15015: <dt><span class="sect1"><a href=
1.68 rillig 15016: "#submitting-your-package">18.1. Submitting your
1.30 wiz 15017: packages</a></span></dt>
1.1 grant 15018:
1.30 wiz 15019: <dt><span class="sect1"><a href=
1.68 rillig 15020: "#general-notes-for-changes">18.2. General notes when
1.41 wiz 15021: adding, updating, or removing packages</a></span></dt>
15022:
15023: <dt><span class="sect1"><a href=
1.68 rillig 15024: "#committing-importing">18.3. Committing: Importing a
1.30 wiz 15025: package into CVS</a></span></dt>
1.1 grant 15026:
1.30 wiz 15027: <dt><span class="sect1"><a href=
1.68 rillig 15028: "#updating-package">18.4. Updating a package to a newer
1.30 wiz 15029: version</a></span></dt>
1.1 grant 15030:
1.68 rillig 15031: <dt><span class="sect1"><a href="#moving-package">18.5.
1.2 hubertf 15032: Moving a package in pkgsrc</a></span></dt>
1.1 grant 15033: </dl>
15034: </div>
15035:
1.67 hubertf 15036: <div class="sect1" lang="en">
1.1 grant 15037: <div class="titlepage">
15038: <div>
15039: <div>
15040: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15041: "submitting-your-package"></a>18.1. Submitting
1.30 wiz 15042: your packages</h2>
1.1 grant 15043: </div>
15044: </div>
15045: </div>
15046:
15047: <p>You have to separate between binary and
15048: “<span class="quote">normal</span>” (source)
15049: packages here:</p>
15050:
15051: <div class="itemizedlist">
15052: <ul type="disc">
15053: <li>
15054: <p>precompiled binary packages</p>
15055:
15056: <p>Our policy is that we accept binaries only from
15057: pkgsrc developers to guarantee that the packages
15058: don't contain any trojan horses etc. This is not to
1.13 hubertf 15059: annoy anyone but rather to protect our users!
1.1 grant 15060: You're still free to put up your home-made binary
1.13 hubertf 15061: packages and tell the world where to get them.
15062: NetBSD developers doing bulk builds and wanting to
15063: upload them please see <a href="#bulk-upload"
1.38 dillo 15064: title="6.3.8. Uploading results of a bulk build">
15065: Section 6.3.8, “Uploading results of a
1.13 hubertf 15066: bulk build”</a>.</p>
1.1 grant 15067: </li>
15068:
15069: <li>
15070: <p>packages</p>
15071:
15072: <p>First, check that your package is complete,
15073: compiles and runs well; see <a href="#debug" title=
1.68 rillig 15074: "Chapter 17. Debugging">Chapter 17,
1.1 grant 15075: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 15076: Next, generate an uuencoded gzipped <a href=
15077: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
15078: <span class="citerefentry"><span class=
15079: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 15080: preferably with all files in a single directory.
1.14 xtraeme 15081: Finally, <span><strong class=
15082: "command">send-pr</strong></span> with category
1.1 grant 15083: “<span class="quote">pkg</span>”, a
15084: synopsis which includes the package name and
15085: version number, a short description of your package
15086: (contents of the COMMENT variable or DESCR file are
15087: OK) and attach the archive to your PR.</p>
15088:
15089: <p>If you want to submit several packages, please
15090: send a separate PR for each one, it's easier for us
15091: to track things that way.</p>
15092:
15093: <p>Alternatively, you can also import new packages
15094: into pkgsrc-wip (“<span class="quote">pkgsrc
15095: work-in-progress</span>”); see the homepage
15096: at <a href="http://pkgsrc-wip.sourceforge.net/"
15097: target=
15098: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
15099: details.</p>
15100: </li>
15101: </ul>
15102: </div>
15103: </div>
15104:
1.67 hubertf 15105: <div class="sect1" lang="en">
1.1 grant 15106: <div class="titlepage">
15107: <div>
15108: <div>
15109: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15110: "general-notes-for-changes"></a>18.2. General
1.41 wiz 15111: notes when adding, updating, or removing
15112: packages</h2>
15113: </div>
15114: </div>
15115: </div>
15116:
15117: <p>Please note all package additions, updates, moves, and
1.45 wiz 15118: removals in <code xmlns=
15119: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15120: "filename">pkgsrc/doc/CHANGES</code>. It's very important
15121: to keep this file up to date and conforming to the
15122: existing format, because it will be used by scripts to
15123: automatically update pages on <a href=
15124: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45 wiz 15125: and other sites. Additionally, check the <code xmlns=
15126: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15127: "filename">pkgsrc/doc/TODO</code> file and remove the
15128: entry for the package you updated or removed, in case it
15129: was mentioned there.</p>
15130:
15131: <p>There is a make target that helps in creating proper
1.45 wiz 15132: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
15133: class="filename">CHANGES</code> entries:
1.41 wiz 15134: <span><strong class="command">make
15135: changes-entry</strong></span>. It uses the optional
15136: <code class="varname">CTYPE</code> and <code class=
15137: "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45 wiz 15138: usage is to first make sure that your <code xmlns=
15139: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15140: "filename">CHANGES</code> file is up-to-date (to avoid
15141: having to resolve conflicts later-on) and then to
15142: <span><strong class="command">cd</strong></span> to the
15143: package directory. For package updates,
15144: <span><strong class="command">make
15145: changes-entry</strong></span> is enough. For new
15146: packages, or package moves or removals, set the
15147: <code class="varname">CTYPE</code> variable on the
15148: command line to "Added", "Moved", or "Removed". You can
15149: set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45 wiz 15150: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
15151: class="filename">/etc/mk.conf</code> if your local login
15152: name is not the same as your NetBSD login name. Don't
15153: forget to commit the changes to <code xmlns=
15154: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15155: "filename">pkgsrc/doc/CHANGES</code>!</p>
15156: </div>
15157:
1.67 hubertf 15158: <div class="sect1" lang="en">
1.41 wiz 15159: <div class="titlepage">
15160: <div>
15161: <div>
15162: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15163: "committing-importing"></a>18.3. Committing:
1.30 wiz 15164: Importing a package into CVS</h2>
1.1 grant 15165: </div>
15166: </div>
15167: </div>
15168:
15169: <p>This section is only of interest for pkgsrc developers
15170: with write access to the pkgsrc repository. Please
15171: remember that cvs imports files relative to the current
15172: working directory, and that the pathname that you give
1.14 xtraeme 15173: the <span><strong class="command">cvs
15174: import</strong></span> command is so that it knows where
15175: to place the files in the repository. Newly created
15176: packages should be imported with a vendor tag of
15177: “<span class="quote">TNF</span>” and a
15178: release tag of “<span class=
15179: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 15180: <pre class="programlisting">
1.51 rillig 15181: <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
15182: <code class=
15183: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1 grant 15184: </pre>
15185:
15186: <p>Remember to move the directory from which you imported
15187: out of the way, or cvs will complain the next time you
15188: “<span class="quote">cvs update</span>” your
15189: source tree. Also don't forget to add the new package to
1.45 wiz 15190: the category's <code xmlns=
15191: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15192: "filename">Makefile</code>.</p>
1.1 grant 15193:
15194: <p>The commit message of the initial import should
1.45 wiz 15195: include part of the <code xmlns=
15196: "http://www.w3.org/TR/xhtml1/transitional" class=
15197: "filename">DESCR</code> file, so people reading the
15198: mailing lists know what the package is/does.</p>
1.1 grant 15199:
15200: <p>For new packages, “<span class="quote">cvs
15201: import</span>” is preferred to “<span class=
15202: "quote">cvs add</span>” because the former gets
15203: everything with a single command, and provides a
15204: consistent tag.</p>
15205: </div>
15206:
1.67 hubertf 15207: <div class="sect1" lang="en">
1.1 grant 15208: <div class="titlepage">
15209: <div>
15210: <div>
15211: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15212: "updating-package"></a>18.4. Updating a
1.30 wiz 15213: package to a newer version</h2>
1.1 grant 15214: </div>
15215: </div>
15216: </div>
15217:
15218: <p>Please always put a concise, appropriate and relevant
15219: summary of the changes between old and new versions into
15220: the commit log when updating a package. There are various
15221: reasons for this:</p>
15222:
15223: <div class="itemizedlist">
15224: <ul type="disc">
15225: <li>
15226: <p>A URL is volatile, and can change over time. It
15227: may go away completely or its information may be
15228: overwritten by newer information.</p>
15229: </li>
15230:
15231: <li>
15232: <p>Having the change information between old and
15233: new versions in our CVS repository is very useful
15234: for people who use either cvs or anoncvs.</p>
15235: </li>
15236:
15237: <li>
15238: <p>Having the change information between old and
15239: new versions in our CVS repository is very useful
15240: for people who read the pkgsrc-changes mailing
15241: list, so that they can make tactical decisions
15242: about when to upgrade the package.</p>
15243: </li>
15244: </ul>
15245: </div>
15246:
1.18 xtraeme 15247: <p>Please also recognize that, just because a new version
1.1 grant 15248: of a package has been released, it should not
15249: automatically be upgraded in the CVS repository. We
15250: prefer to be conservative in the packages that are
15251: included in pkgsrc - development or beta packages are not
15252: really the best thing for most places in which pkgsrc is
15253: used. Please use your judgement about what should go into
15254: pkgsrc, and bear in mind that stability is to be
15255: preferred above new and possibly untested features.</p>
15256: </div>
15257:
1.67 hubertf 15258: <div class="sect1" lang="en">
1.1 grant 15259: <div class="titlepage">
15260: <div>
15261: <div>
15262: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15263: "moving-package"></a>18.5. Moving a package in
1.30 wiz 15264: pkgsrc</h2>
1.1 grant 15265: </div>
15266: </div>
15267: </div>
15268:
15269: <div class="orderedlist">
15270: <ol type="1">
15271: <li>
15272: <p>Make a copy of the directory somewhere else.</p>
15273: </li>
15274:
15275: <li>
15276: <p>Remove all CVS dirs.</p>
15277:
15278: <p>Alternatively to the first two steps you can
15279: also do:</p>
15280: <pre class="screen">
1.14 xtraeme 15281: <code class="prompt">%</code> <strong class=
15282: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 15283: </pre>
15284:
15285: <p>and use that for further work.</p>
15286: </li>
15287:
15288: <li>
1.14 xtraeme 15289: <p>Fix <code class="varname">CATEGORIES</code> and
15290: any <code class="varname">DEPENDS</code> paths that
15291: just did “<span class=
1.1 grant 15292: "quote">../package</span>” instead of
15293: “<span class=
15294: "quote">../../category/package</span>”.</p>
15295: </li>
15296:
15297: <li>
1.14 xtraeme 15298: <p><span><strong class="command">cvs
15299: import</strong></span> the modified package in the
15300: new place.</p>
1.1 grant 15301: </li>
15302:
15303: <li>
15304: <p>Check if any package depends on it:</p>
15305: <pre class="screen">
1.14 xtraeme 15306: <code class="prompt">%</code> <strong class=
15307: "userinput"><code>cd /usr/pkgsrc</code></strong>
15308: <code class="prompt">%</code> <strong class=
15309: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 15310: </pre>
15311: </li>
15312:
15313: <li>
15314: <p>Fix paths in packages from step 5 to point to
15315: new location.</p>
15316: </li>
15317:
15318: <li>
1.14 xtraeme 15319: <p><span><strong class="command">cvs rm
15320: (-f)</strong></span> the package at the old
15321: location.</p>
1.1 grant 15322: </li>
15323:
15324: <li>
1.45 wiz 15325: <p>Remove from <code xmlns=
15326: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15327: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 15328: </li>
15329:
15330: <li>
1.45 wiz 15331: <p>Add to <code xmlns=
15332: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15333: "filename">newcategory/Makefile</code>.</p>
1.1 grant 15334: </li>
15335:
15336: <li>
15337: <p>Commit the changed and removed files:</p>
15338: <pre class="screen">
1.14 xtraeme 15339: <code class="prompt">%</code> <strong class=
15340: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 15341: </pre>
15342:
15343: <p>(and any packages from step 5, of course).</p>
15344: </li>
15345: </ol>
15346: </div>
15347: </div>
15348: </div>
1.69 rillig 15349:
15350: <div class="chapter" lang="en">
15351: <div class="titlepage">
15352: <div>
15353: <div>
15354: <h2 class="title"><a name=
15355: "porting"></a>Chapter 19. Porting
15356: pkgsrc</h2>
15357: </div>
15358: </div>
15359: </div>
15360:
15361: <div class="toc">
15362: <p><b>Table of Contents</b></p>
15363:
15364: <dl>
15365: <dt><span class="sect1"><a href="#porting.opsys">19.1.
15366: Porting pkgsrc to a new operating
15367: system</a></span></dt>
15368:
15369: <dt><span class="sect1"><a href=
15370: "#porting.compiler">19.2. Adding support for a new
15371: compiler</a></span></dt>
15372: </dl>
15373: </div>
15374:
15375: <p>The pkgsrc system has already been ported to many
15376: operating systems, hardware architectures and compilers.
15377: This chapter explains the necessary steps to make pkgsrc
15378: even more portable.</p>
15379:
15380: <div class="sect1" lang="en">
15381: <div class="titlepage">
15382: <div>
15383: <div>
15384: <h2 class="title" style="clear: both"><a name=
15385: "porting.opsys"></a>19.1. Porting pkgsrc to a
15386: new operating system</h2>
15387: </div>
15388: </div>
15389: </div>
15390:
15391: <p>To port pkgsrc to a new operating system (called
15392: <code class="literal">MyOS</code> in this example), you
15393: need to touch the following files:</p>
15394:
15395: <div class="variablelist">
15396: <dl>
15397: <dt><span class="term"><code xmlns=
15398: "http://www.w3.org/TR/xhtml1/transitional" class=
15399: "filename">bootstrap/mods/mk/<em class=
15400: "replaceable"><code>MyOS</code></em>.sys.mk</code></span></dt>
15401:
15402: <dd>
15403: <p>This file contains some basic definitions, for
15404: example the name of the C compiler.</p>
15405: </dd>
15406:
15407: <dt><span class="term"><code xmlns=
15408: "http://www.w3.org/TR/xhtml1/transitional" class=
15409: "filename">mk/bsd.prefs.mk</code></span></dt>
15410:
15411: <dd>
15412: <p>Insert code that defines the variables
15413: <code class="varname">OPSYS</code>, <code class=
15414: "varname">OS_VERSION</code>, <code class=
15415: "varname">LOWER_OS_VERSION</code>, <code class=
15416: "varname">LOWER_VENDOR</code>, <code class=
15417: "varname">MACHINE_ARCH</code>, <code class=
15418: "varname">OBJECT_FMT</code>, <code class=
15419: "varname">APPEND_ELF</code>, and the other
15420: variables that appear in this file.</p>
15421: </dd>
15422:
15423: <dt><span class="term"><code xmlns=
15424: "http://www.w3.org/TR/xhtml1/transitional" class=
15425: "filename">mk/platform/MyOS.mk</code></span></dt>
15426:
15427: <dd>
15428: <p>This file contains the platform-specific
15429: definitions that are used by pkgsrc. Start by
15430: copying one of the other files and edit it to your
15431: needs.</p>
15432: </dd>
15433:
15434: <dt><span class="term"><code xmlns=
15435: "http://www.w3.org/TR/xhtml1/transitional" class=
15436: "filename">mk/platform/MyOS.pkg.dist</code></span></dt>
15437:
15438: <dd>
15439: <p>This file contains a list of directories,
15440: together with their permission bits and ownership.
15441: These directories will be created automatically
15442: with every package that does not explicitly set
15443: <code class="varname">NO_MTREE</code>. There have
15444: been some discussions about whether this file is
15445: needed at all, but with no result.</p>
15446: </dd>
15447:
15448: <dt><span class="term"><code xmlns=
15449: "http://www.w3.org/TR/xhtml1/transitional" class=
15450: "filename">mk/platform/MyOS.x11.dist</code></span></dt>
15451:
15452: <dd>
15453: <p>Just copy one of the pre-existing x11.dist files
15454: to your <code xmlns=
15455: "http://www.w3.org/TR/xhtml1/transitional" class=
15456: "filename"><em class=
15457: "replaceable"><code>MyOS</code></em>.x11.dist</code>.</p>
15458: </dd>
15459:
15460: <dt><span class="term"><code xmlns=
15461: "http://www.w3.org/TR/xhtml1/transitional" class=
15462: "filename">mk/tools/bootstrap.mk</code></span></dt>
15463:
15464: <dd>
15465: <p>On some operating systems, the tools that are
15466: provided with the base system are not good enough
15467: for pkgsrc. For example, there are many versions of
15468: <a href=
15469: "http://netbsd.gw.com/cgi-bin/man-cgi?sed+1+NetBSD-current">
15470: <span class="citerefentry"><span class=
15471: "refentrytitle">sed</span>(1)</span></a> that have
15472: a narrow limit on the line length they can process.
15473: Therefore pkgsrc brings its own tools, which can be
15474: enabled here.</p>
15475: </dd>
15476:
15477: <dt><span class="term"><code xmlns=
15478: "http://www.w3.org/TR/xhtml1/transitional" class=
15479: "filename">mk/tools/<em class=
15480: "replaceable"><code>MyOS</code></em>.mk</code></span></dt>
15481:
15482: <dd>
15483: <p>This file defines the paths to all the tools
15484: that are needed by one or the other package in
15485: pkgsrc, as well as by pkgsrc itself. Find out where
15486: these tools are on your platform and add them.</p>
15487: </dd>
15488: </dl>
15489: </div>
15490:
15491: <p>Now, you should be able to build some basic packages,
15492: like <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
15493: href=
15494: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/perl5/README.html"
15495: target="_top"><code xmlns="" class=
15496: "filename">lang/perl5</code></a>, <a xmlns=
15497: "http://www.w3.org/TR/xhtml1/transitional" href=
15498: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/bash/README.html"
15499: target="_top"><code xmlns="" class=
15500: "filename">shells/bash</code></a>.</p>
15501: </div>
15502:
15503: <div class="sect1" lang="en">
15504: <div class="titlepage">
15505: <div>
15506: <div>
15507: <h2 class="title" style="clear: both"><a name=
15508: "porting.compiler"></a>19.2. Adding support
15509: for a new compiler</h2>
15510: </div>
15511: </div>
15512: </div>
15513:
15514: <p>TODO</p>
15515: </div>
15516: </div>
1.1 grant 15517: </div>
15518:
1.67 hubertf 15519: <div class="appendix" lang="en">
1.1 grant 15520: <div class="titlepage">
15521: <div>
15522: <div>
1.67 hubertf 15523: <h2 class="title"><a name=
1.46 gdt 15524: "examples"></a>Appendix A. A simple example
1.1 grant 15525: package: bison</h2>
15526: </div>
15527: </div>
15528: </div>
15529:
15530: <div class="toc">
15531: <p><b>Table of Contents</b></p>
15532:
15533: <dl>
1.46 gdt 15534: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 15535: files</a></span></dt>
15536:
15537: <dd>
15538: <dl>
1.30 wiz 15539: <dt><span class="sect2"><a href=
1.46 gdt 15540: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 15541:
1.30 wiz 15542: <dt><span class="sect2"><a href=
1.46 gdt 15543: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 15544:
1.30 wiz 15545: <dt><span class="sect2"><a href=
1.46 gdt 15546: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 15547:
1.30 wiz 15548: <dt><span class="sect2"><a href=
1.46 gdt 15549: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 15550: package with <span><strong class=
1.14 xtraeme 15551: "command">pkglint</strong></span></a></span></dt>
1.1 grant 15552: </dl>
15553: </dd>
15554:
1.46 gdt 15555: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 15556: Steps for building, installing, packaging</a></span></dt>
1.1 grant 15557: </dl>
15558: </div>
15559:
15560: <p>We checked to find a piece of software that wasn't in the
15561: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 15562: would want to have <span><strong class=
15563: "command">bison</strong></span> when Berkeley
15564: <span><strong class="command">yacc</strong></span> is already
15565: present in the tree is beyond us, but it's useful for the
15566: purposes of this exercise.</p>
1.1 grant 15567:
1.67 hubertf 15568: <div class="sect1" lang="en">
1.1 grant 15569: <div class="titlepage">
15570: <div>
15571: <div>
15572: <h2 class="title" style="clear: both"><a name=
1.46 gdt 15573: "example-files"></a>A.1. files</h2>
1.1 grant 15574: </div>
15575: </div>
15576: </div>
15577:
1.67 hubertf 15578: <div class="sect2" lang="en">
1.1 grant 15579: <div class="titlepage">
15580: <div>
15581: <div>
1.67 hubertf 15582: <h3 class="title"><a name=
1.46 gdt 15583: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 15584: </div>
15585: </div>
15586: </div>
15587: <pre class="programlisting">
1.51 rillig 15588: # $NetBSD$
15589: #
1.1 grant 15590:
1.51 rillig 15591: DISTNAME= bison-1.25
15592: CATEGORIES= devel
15593: MASTER_SITES= ${MASTER_SITE_GNU}
1.1 grant 15594:
1.51 rillig 15595: MAINTAINER= thorpej@NetBSD.org
15596: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
15597: COMMENT= GNU yacc clone
1.1 grant 15598:
1.51 rillig 15599: GNU_CONFIGURE= yes
15600: INFO_FILES= bison.info
1.1 grant 15601:
1.51 rillig 15602: .include "../../mk/bsd.pkg.mk"
1.1 grant 15603: </pre>
15604: </div>
15605:
1.67 hubertf 15606: <div class="sect2" lang="en">
1.1 grant 15607: <div class="titlepage">
15608: <div>
15609: <div>
1.67 hubertf 15610: <h3 class="title"><a name=
1.46 gdt 15611: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 15612: </div>
15613: </div>
15614: </div>
15615: <pre class="programlisting">
1.51 rillig 15616: GNU version of yacc. Can make re-entrant parsers, and numerous other
15617: improvements. Why you would want this when Berkeley <a href=
1.1 grant 15618: "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 15619: of the NetBSD source tree is beyond me.
1.1 grant 15620: </pre>
15621: </div>
15622:
1.67 hubertf 15623: <div class="sect2" lang="en">
1.1 grant 15624: <div class="titlepage">
15625: <div>
15626: <div>
1.67 hubertf 15627: <h3 class="title"><a name=
1.46 gdt 15628: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 15629: </div>
15630: </div>
15631: </div>
15632: <pre class="programlisting">
1.51 rillig 15633: @comment $NetBSD$
15634: bin/bison
15635: man/man1/bison.1.gz
15636: share/bison.simple
15637: share/bison.hairy
1.1 grant 15638: </pre>
15639: </div>
15640:
1.67 hubertf 15641: <div class="sect2" lang="en">
1.1 grant 15642: <div class="titlepage">
15643: <div>
15644: <div>
1.30 wiz 15645: <h3 class="title"><a name=
1.46 gdt 15646: "checking-package-with-pkglint"></a>A.1.4. Checking
1.30 wiz 15647: a package with <span><strong class=
1.14 xtraeme 15648: "command">pkglint</strong></span></h3>
1.1 grant 15649: </div>
15650: </div>
15651: </div>
15652:
15653: <p>The NetBSD package system comes with <a xmlns=
15654: "http://www.w3.org/TR/xhtml1/transitional" href=
15655: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 15656: target="_top"><code xmlns="" class=
15657: "filename">pkgtools/pkglint</code></a> which helps to
15658: check the contents of these files. After installation it
15659: is quite easy to use, just change to the directory of the
1.20 ben 15660: package you wish to examine and execute
15661: <span><strong class=
15662: "command">pkglint</strong></span>:</p>
1.1 grant 15663: <pre class="screen">
1.14 xtraeme 15664: <code class="prompt">$</code> <strong class=
15665: "userinput"><code>pkglint</code></strong>
1.1 grant 15666: looks fine.
15667: </pre>
15668:
15669: <p>Depending on the supplied command line arguments (see
1.60 rillig 15670: pkglint(1)), more checks will be performed. Use e.g.
15671: <span><strong class="command">pkglint -Call
15672: -Wall</strong></span> for a very thorough check.</p>
1.1 grant 15673: </div>
15674: </div>
15675:
1.67 hubertf 15676: <div class="sect1" lang="en">
1.1 grant 15677: <div class="titlepage">
15678: <div>
15679: <div>
15680: <h2 class="title" style="clear: both"><a name=
1.46 gdt 15681: "steps-for-b-i-p"></a>A.2. Steps for building,
1.30 wiz 15682: installing, packaging</h2>
1.1 grant 15683: </div>
15684: </div>
15685: </div>
15686:
15687: <p>Create the directory where the package lives, plus any
15688: auxiliary directories:</p>
15689: <pre class="screen">
1.14 xtraeme 15690: <code class="prompt">#</code> <strong class=
15691: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
15692: <code class="prompt">#</code> <strong class=
15693: "userinput"><code>mkdir bison</code></strong>
15694: <code class="prompt">#</code> <strong class=
15695: "userinput"><code>cd bison</code></strong>
15696: <code class="prompt">#</code> <strong class=
15697: "userinput"><code>mkdir patches</code></strong>
1.1 grant 15698: </pre>
15699:
1.45 wiz 15700: <p>Create <code xmlns=
15701: "http://www.w3.org/TR/xhtml1/transitional" class=
15702: "filename">Makefile</code>, <code xmlns=
15703: "http://www.w3.org/TR/xhtml1/transitional" class=
15704: "filename">DESCR</code> and <code xmlns=
15705: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15706: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 15707: "Chapter 8. Package components - files, directories and contents">
1.67 hubertf 15708: Chapter 8, <i>Package components - files, directories
15709: and contents</i></a>) then continue with fetching the
1.1 grant 15710: distfile:</p>
15711: <pre class="screen">
1.14 xtraeme 15712: <code class="prompt">#</code> <strong class=
15713: "userinput"><code>make fetch</code></strong>
1.1 grant 15714: >> bison-1.25.tar.gz doesn't seem to exist on this system.
15715: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
15716: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
15717: ftp: Error retrieving file: 500 Internal error
15718:
15719: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
15720: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
15721: ftp: Error retrieving file: 500 Internal error
15722:
15723: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
15724: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
15725: Successfully retrieved file.
15726: </pre>
15727:
1.45 wiz 15728: <p>Generate the checksum of the distfile into <code xmlns=
15729: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15730: "filename">distinfo</code>:</p>
1.1 grant 15731: <pre class="screen">
1.14 xtraeme 15732: <code class="prompt">#</code> <strong class=
15733: "userinput"><code>make makesum</code></strong>
1.1 grant 15734: </pre>
15735:
15736: <p>Now compile:</p>
15737: <pre class="screen">
1.14 xtraeme 15738: <code class="prompt">#</code> <strong class=
15739: "userinput"><code>make</code></strong>
1.1 grant 15740: >> Checksum OK for bison-1.25.tar.gz.
15741: ===> Extracting for bison-1.25
15742: ===> Patching for bison-1.25
15743: ===> Ignoring empty patch directory
15744: ===> Configuring for bison-1.25
15745: creating cache ./config.cache
15746: checking for gcc... cc
15747: checking whether we are using GNU C... yes
15748: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
15749: checking how to run the C preprocessor... cc -E
15750: checking for minix/config.h... no
15751: checking for POSIXized ISC... no
15752: checking whether cross-compiling... no
15753: checking for ANSI C header files... yes
15754: checking for string.h... yes
15755: checking for stdlib.h... yes
15756: checking for memory.h... yes
15757: checking for working const... yes
15758: checking for working alloca.h... no
15759: checking for alloca... yes
15760: checking for strerror... yes
15761: updating cache ./config.cache
15762: creating ./config.status
15763: creating Makefile
15764: ===> Building for bison-1.25
15765: 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
15766: 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
15767: 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
15768: 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
15769: 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
1.68 rillig 15770: 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
1.1 grant 15771: 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
15772: 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
15773: 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
15774: 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
15775: 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
15776: 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
15777: 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
15778: 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
15779: 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
15780: 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
15781: 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
15782: 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
15783: 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
15784: 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
15785: 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
15786: 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
15787: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
15788: rm -f bison.s1
15789: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
15790: </pre>
15791:
15792: <p>Everything seems OK, so install the files:</p>
15793: <pre class="screen">
1.14 xtraeme 15794: <code class="prompt">#</code> <strong class=
15795: "userinput"><code>make install</code></strong>
1.1 grant 15796: >> Checksum OK for bison-1.25.tar.gz.
15797: ===> Installing for bison-1.25
15798: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
15799: rm -f /usr/pkg/bin/bison
15800: cd /usr/pkg/share; rm -f bison.simple bison.hairy
15801: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
15802: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
15803: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
15804: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
15805: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
15806: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
15807: ===> Registering installation for bison-1.25
15808: </pre>
15809:
15810: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 15811: remove it with <span><strong class="command">pkg_delete
15812: bison</strong></span>. Should you decide that you want a
15813: binary package, do this now:</p>
1.1 grant 15814: <pre class="screen">
1.14 xtraeme 15815: <code class="prompt">#</code> <strong class=
15816: "userinput"><code>make package</code></strong>
1.1 grant 15817: >> Checksum OK for bison-1.25.tar.gz.
15818: ===> Building package for bison-1.25
15819: Creating package bison-1.25.tgz
15820: Registering depends:.
15821: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
15822: </pre>
15823:
15824: <p>Now that you don't need the source and object files any
15825: more, clean up:</p>
15826: <pre class="screen">
1.14 xtraeme 15827: <code class="prompt">#</code> <strong class=
15828: "userinput"><code>make clean</code></strong>
1.1 grant 15829: ===> Cleaning for bison-1.25
15830: </pre>
15831: </div>
15832: </div>
15833:
1.67 hubertf 15834: <div class="appendix" lang="en">
1.1 grant 15835: <div class="titlepage">
15836: <div>
15837: <div>
1.67 hubertf 15838: <h2 class="title"><a name=
1.46 gdt 15839: "logs"></a>Appendix B. Build logs</h2>
1.1 grant 15840: </div>
15841: </div>
15842: </div>
15843:
15844: <div class="toc">
15845: <p><b>Table of Contents</b></p>
15846:
15847: <dl>
1.46 gdt 15848: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 15849: Building figlet</a></span></dt>
15850:
1.46 gdt 15851: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 15852: Packaging figlet</a></span></dt>
15853: </dl>
15854: </div>
15855:
1.67 hubertf 15856: <div class="sect1" lang="en">
1.1 grant 15857: <div class="titlepage">
15858: <div>
15859: <div>
15860: <h2 class="title" style="clear: both"><a name=
1.46 gdt 15861: "logs.building"></a>B.1. Building figlet</h2>
1.1 grant 15862: </div>
15863: </div>
15864: </div>
15865: <pre class="screen">
1.14 xtraeme 15866: <code class="prompt">#</code> <strong class=
15867: "userinput"><code>make</code></strong>
1.1 grant 15868: ===> Checking for vulnerabilities in figlet-2.2.1nb2
15869: => figlet221.tar.gz doesn't seem to exist on this system.
15870: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
15871: => [172219 bytes]
15872: Connected to ftp.plig.net.
15873: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
15874: 331 Guest login ok, send your complete e-mail address as password.
15875: 230-You are user #5 of 500 simultaneous users allowed.
15876: 230-
1.68 rillig 15877: 230- ___ _ _ _
15878: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
1.1 grant 15879: 230- | _| _| . |_| . | | | . |_| . | _| . |
15880: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
15881: 230- |_| |_| |___| |___|
15882: 230-
15883: 230-** Welcome to ftp.plig.org **
15884: 230-
15885: 230-Please note that all transfers from this FTP site are logged. If you
15886: 230-do not like this, please disconnect now.
15887: 230-
15888: 230-This arhive is available via
15889: 230-
15890: 230-HTTP: http://ftp.plig.org/
15891: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
15892: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
15893: 230-
15894: 230-Please email comments, bug reports and requests for packages to be
1.68 rillig 15895: 230-mirrored to ftp-admin@plig.org.
1.1 grant 15896: 230-
15897: 230-
15898: 230 Logged in anonymously.
15899: Remote system type is UNIX.
15900: Using binary mode to transfer files.
15901: 200 Type okay.
15902: 250 "/pub" is new cwd.
15903: 250-"/pub/figlet" is new cwd.
15904: 250-
15905: 250-Welcome to the figlet archive at ftp.figlet.org
1.68 rillig 15906: 250-
1.1 grant 15907: 250- ftp://ftp.figlet.org/pub/figlet/
15908: 250-
15909: 250-The official FIGlet web page is:
15910: 250- http://www.figlet.org/
15911: 250-
15912: 250-If you have questions, please mailto:info@figlet.org. If you want to
15913: 250-contribute a font or something else, you can email us.
1.68 rillig 15914: 250
1.1 grant 15915: 250 "/pub/figlet/program" is new cwd.
15916: 250 "/pub/figlet/program/unix" is new cwd.
15917: local: figlet221.tar.gz remote: figlet221.tar.gz
15918: 502 Unimplemented command.
15919: 227 Entering Passive Mode (195,40,6,41,246,104)
15920: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
15921: 38% |************** | 65800 64.16 KB/s 00:01 ETA
15922: 226 Transfer completed.
15923: 172219 bytes received in 00:02 (75.99 KB/s)
15924: 221 Goodbye.
15925: => Checksum OK for figlet221.tar.gz.
15926: ===> Extracting for figlet-2.2.1nb2
15927: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
15928: ===> Patching for figlet-2.2.1nb2
15929: ===> Applying pkgsrc patches for figlet-2.2.1nb2
15930: ===> Overriding tools for figlet-2.2.1nb2
15931: ===> Creating toolchain wrappers for figlet-2.2.1nb2
15932: ===> Configuring for figlet-2.2.1nb2
15933: ===> Building for figlet-2.2.1nb2
15934: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
15935: chmod a+x figlet
15936: gcc -O2 -o chkfont chkfont.c
15937: => Unwrapping files-to-be-installed.
1.14 xtraeme 15938: <code class="prompt">#</code>
15939: <code class="prompt">#</code> <strong class=
15940: "userinput"><code>make install</code></strong>
1.1 grant 15941: ===> Checking for vulnerabilities in figlet-2.2.1nb2
15942: ===> Installing for figlet-2.2.1nb2
15943: install -d -o root -g wheel -m 755 /usr/pkg/bin
15944: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
15945: mkdir -p /usr/pkg/share/figlet
15946: cp figlet /usr/pkg/bin
15947: cp chkfont /usr/pkg/bin
15948: chmod 555 figlist showfigfonts
15949: cp figlist /usr/pkg/bin
15950: cp showfigfonts /usr/pkg/bin
15951: cp fonts/*.flf /usr/pkg/share/figlet
15952: cp fonts/*.flc /usr/pkg/share/figlet
15953: cp figlet.6 /usr/pkg/man/man6
15954: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 15955: <code class="prompt">#</code>
1.1 grant 15956: </pre>
15957: </div>
15958:
1.67 hubertf 15959: <div class="sect1" lang="en">
1.1 grant 15960: <div class="titlepage">
15961: <div>
15962: <div>
15963: <h2 class="title" style="clear: both"><a name=
1.46 gdt 15964: "logs.package"></a>B.2. Packaging figlet</h2>
1.1 grant 15965: </div>
15966: </div>
15967: </div>
15968: <pre class="screen">
1.14 xtraeme 15969: <code class="prompt">#</code> <strong class=
15970: "userinput"><code>make package</code></strong>
1.1 grant 15971: ===> Checking for vulnerabilities in figlet-2.2.1nb2
15972: ===> Packaging figlet-2.2.1nb2
15973: ===> Building binary package for figlet-2.2.1nb2
15974: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
15975: Using SrcDir value of /usr/pkg
1.68 rillig 15976: Registering depends:.
1.14 xtraeme 15977: <code class="prompt">#</code>
1.1 grant 15978: </pre>
15979: </div>
15980: </div>
15981:
1.67 hubertf 15982: <div class="appendix" lang="en">
1.1 grant 15983: <div class="titlepage">
15984: <div>
15985: <div>
1.67 hubertf 15986: <h2 class="title"><a name=
1.46 gdt 15987: "ftp-layout"></a>Appendix C. Layout of the
1.1 grant 15988: FTP server's package archive</h2>
15989: </div>
15990: </div>
15991: </div>
15992:
15993: <p>Layout for precompiled binary packages on
15994: ftp.NetBSD.org:</p>
15995: <pre class="programlisting">
1.51 rillig 15996: /pub/NetBSD/packages/
15997: distfiles/
1.1 grant 15998:
1.51 rillig 15999: # Unpacked pkgsrc trees
16000: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
16001: pkgsrc-2003Q4 -> N/A
16002: pkgsrc-2004Q1/pkgsrc
16003:
16004: # pkgsrc archives
16005: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
16006: pkgsrc-2003Q4.tar.gz -> N/A
16007: pkgsrc-2004Q1.tar.gz -> N/A
16008:
16009: # Per pkgsrc-release/OS-release/arch package archives
16010: pkgsrc-2003Q4/
16011: NetBSD-1.6.2/
16012: i386/
16013: All/
16014: archivers/
16015: foo -> ../All/foo
16016: ...
16017: pkgsrc-2004Q1/
16018: NetBSD-1.6.2/
16019: i386/
16020: All/
16021: ...
16022: NetBSD-2.0/
16023: i386/
16024: All/
16025: ...
16026: SunOS-5.9/
16027: sparc/
16028: All/
16029: ...
16030: x86/
16031: All/
16032: ...
16033:
16034: # Per os-release package archive convenience links
16035: NetBSD-1.6.2 -> 1.6.2
16036: 1.6.2/
16037: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
16038: m68k/
16039: All/
16040: archivers/
16041: foo -> ../All/foo
16042: ...
16043: amiga -> m68k
16044: atari -> m68k
16045: ...
16046:
16047: 2.0 -> NetBSD-2.0 # backward compat, historic
16048: NetBSD-2.0/
16049: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
16050: SunOS-5.9/
16051: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
16052: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1 grant 16053: </pre>
16054:
16055: <p>To create:</p>
16056:
16057: <div class="orderedlist">
16058: <ol type="1">
16059: <li>
16060: <p>Run bulk build, see <a href="#bulkbuild" title=
1.67 hubertf 16061: "6.3. Doing a bulk build of all packages">Section 6.3,
16062: “Doing a bulk build of all
1.1 grant 16063: packages”</a></p>
16064: </li>
16065:
16066: <li>
16067: <p>Upload /usr/pkgsrc/packages to</p>
16068: <pre class="programlisting">
16069: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51 rillig 16070: pkgsrc-2004Q4/\ # pkgsrc-branch
16071: `uname -s`-`uname -r`/\ # OS & version
16072: `uname -p` # architecture
1.1 grant 16073: </pre>
16074: </li>
16075:
16076: <li>
1.14 xtraeme 16077: <p>If necessary, create a symlink <span><strong class=
16078: "command">ln -s `uname -m` `uname -p`</strong></span>
16079: (amiga -> m68k, ...)</p>
1.1 grant 16080: </li>
16081: </ol>
16082: </div>
16083: </div>
1.2 hubertf 16084:
1.67 hubertf 16085: <div class="appendix" lang="en">
1.2 hubertf 16086: <div class="titlepage">
16087: <div>
16088: <div>
1.67 hubertf 16089: <h2 class="title"><a name=
1.46 gdt 16090: "editing"></a>Appendix D. Editing guidelines
1.2 hubertf 16091: for the pkgsrc guide</h2>
16092: </div>
16093: </div>
16094: </div>
16095:
16096: <div class="toc">
16097: <p><b>Table of Contents</b></p>
16098:
16099: <dl>
1.46 gdt 16100: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 16101: Targets</a></span></dt>
16102:
1.46 gdt 16103: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 16104: Procedure</a></span></dt>
16105: </dl>
16106: </div>
16107:
16108: <p>This section contains information on editing the pkgsrc
16109: guide itself.</p>
16110:
1.67 hubertf 16111: <div class="sect1" lang="en">
1.2 hubertf 16112: <div class="titlepage">
16113: <div>
16114: <div>
16115: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 16116: "targets"></a>D.1. Targets</h2>
1.2 hubertf 16117: </div>
16118: </div>
16119: </div>
16120:
1.45 wiz 16121: <p>The pkgsrc guide's source code is stored in <code xmlns=
16122: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16123: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 16124: are created from it:</p>
16125:
16126: <div class="itemizedlist">
16127: <ul type="disc">
16128: <li>
1.45 wiz 16129: <p><code xmlns=
16130: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 16131: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 16132: </li>
16133:
16134: <li>
1.45 wiz 16135: <p><code xmlns=
16136: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16137: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 16138: </li>
16139:
16140: <li>
1.45 wiz 16141: <p><code xmlns=
16142: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16143: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 16144: the documentation on the NetBSD website will be built
16145: from pkgsrc and kept up to date on the web server
16146: itself. This means you <span class=
16147: "emphasis"><em>must</em></span> make sure that your
16148: changes haven't broken the build!</p>
16149: </li>
1.6 hubertf 16150:
16151: <li>
1.45 wiz 16152: <p><code xmlns=
16153: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16154: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 16155: PDF version of the pkgsrc guide.</p>
16156: </li>
16157:
16158: <li>
1.45 wiz 16159: <p><code xmlns=
16160: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16161: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 16162: PostScript version of the pkgsrc guide.</p>
16163: </li>
1.2 hubertf 16164: </ul>
16165: </div>
16166: </div>
16167:
1.67 hubertf 16168: <div class="sect1" lang="en">
1.2 hubertf 16169: <div class="titlepage">
16170: <div>
16171: <div>
16172: <h2 class="title" style="clear: both"><a name=
1.46 gdt 16173: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 16174: </div>
16175: </div>
16176: </div>
16177:
16178: <p>The procedure to edit the pkgsrc guide is:</p>
16179:
16180: <div class="itemizedlist">
16181: <ul type="disc">
16182: <li>
1.6 hubertf 16183: <p>Make sure you have the packages needed to
16184: re-generate the pkgsrc guide (and other XML-based
16185: NetBSD documentation) installed. These are
1.11 ben 16186: “<span class="quote">netbsd-doc</span>”
1.47 reed 16187: for creating the ASCII and HTML versions, and
1.6 hubertf 16188: “<span class=
1.47 reed 16189: "quote">netbsd-doc-print</span>” for the
16190: PostScript and PDF versions. You will need both
1.6 hubertf 16191: packages installed, to make sure documentation is
16192: consistent across all formats. The packages can be
1.45 wiz 16193: found in <code xmlns=
16194: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16195: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45 wiz 16196: <code xmlns=
16197: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16198: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 16199: </li>
16200:
16201: <li>
1.45 wiz 16202: <p>Edit the XML file(s) in <code xmlns=
16203: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16204: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 16205: </li>
16206:
16207: <li>
1.14 xtraeme 16208: <p>Run <span><strong class="command">make extract
16209: && make do-lint</strong></span> in
1.45 wiz 16210: <code xmlns=
16211: "http://www.w3.org/TR/xhtml1/transitional" class=
16212: "filename">pkgsrc/doc/guide</code> to check the XML
16213: syntax, and fix it if needed.</p>
1.4 hubertf 16214: </li>
16215:
16216: <li>
1.14 xtraeme 16217: <p>Run <span><strong class=
1.45 wiz 16218: "command">make</strong></span> in <code xmlns=
16219: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16220: "filename">pkgsrc/doc/guide</code> to build the HTML
16221: and ASCII version.</p>
1.2 hubertf 16222: </li>
16223:
16224: <li>
1.14 xtraeme 16225: <p>If all is well, run <span><strong class=
16226: "command">make install-doc</strong></span> to put the
1.45 wiz 16227: generated files into <code xmlns=
16228: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16229: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 16230: </li>
16231:
16232: <li>
1.14 xtraeme 16233: <p><span><strong class="command">cvs commit
16234: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 16235: </li>
16236:
16237: <li>
1.14 xtraeme 16238: <p><span><strong class="command">cvs commit -m
16239: re-generate
16240: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 16241: </li>
1.4 hubertf 16242:
16243: <li>
16244: <p>Until the webserver on www.NetBSD.org is really
16245: updated automatically to pick up changes to the
1.14 xtraeme 16246: pkgsrc guide automatically, also run
1.18 xtraeme 16247: <span><strong class="command">make install-htdocs
1.14 xtraeme 16248: HTDOCSDIR=../../../htdocs</strong></span> (or
16249: similar, adjust <code class=
16250: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 16251: </li>
16252:
16253: <li>
1.14 xtraeme 16254: <p><span><strong class="command">cvs commit
16255: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 16256: </li>
1.2 hubertf 16257: </ul>
16258: </div>
16259: </div>
16260: </div>
1.1 grant 16261: </div>
16262: </body>
16263: </html>
CVSweb <webmaster@jp.NetBSD.org>