Annotation of pkgsrc/doc/pkgsrc.html, revision 1.72
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.72 ! rillig 69: <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.14
! 70: 2006/05/10 20:56:00 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.72 ! rillig 552: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 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:
1.72 ! rillig 1026: <dt><span class="chapter"><a href="#devfaq">19.
! 1027: Frequently Asked Questions</a></span></dt>
! 1028: </dl>
! 1029: </dd>
! 1030:
! 1031: <dt><span class="part"><a href="#infrastructure">III. The
! 1032: pkgsrc infrastructure</a></span></dt>
! 1033:
! 1034: <dd>
! 1035: <dl>
! 1036: <dt><span class="chapter"><a href="#regression">20.
! 1037: Regression tests</a></span></dt>
! 1038:
! 1039: <dd>
! 1040: <dl>
! 1041: <dt><span class="sect1"><a href=
! 1042: "#regression.descr">20.1. The regression tests
! 1043: framework</a></span></dt>
! 1044:
! 1045: <dt><span class="sect1"><a href=
! 1046: "#regression.run">20.2. Running the regression
! 1047: tests</a></span></dt>
! 1048:
! 1049: <dt><span class="sect1"><a href=
! 1050: "#regression.new">20.3. Adding a new regression
! 1051: test</a></span></dt>
! 1052:
! 1053: <dd>
! 1054: <dl>
! 1055: <dt><span class="sect2"><a href=
! 1056: "#regression.fun.override">20.3.1. Overridable
! 1057: functions</a></span></dt>
! 1058:
! 1059: <dt><span class="sect2"><a href=
! 1060: "#regression.fun.helper">20.3.2. Helper
! 1061: functions</a></span></dt>
! 1062: </dl>
! 1063: </dd>
! 1064: </dl>
! 1065: </dd>
! 1066:
! 1067: <dt><span class="chapter"><a href="#porting">21.
1.69 rillig 1068: Porting pkgsrc</a></span></dt>
1069:
1070: <dd>
1071: <dl>
1072: <dt><span class="sect1"><a href=
1.72 ! rillig 1073: "#porting.opsys">21.1. Porting pkgsrc to a new
1.69 rillig 1074: operating system</a></span></dt>
1075:
1076: <dt><span class="sect1"><a href=
1.72 ! rillig 1077: "#porting.compiler">21.2. Adding support for a new
1.69 rillig 1078: compiler</a></span></dt>
1079: </dl>
1080: </dd>
1.1 grant 1081: </dl>
1082: </dd>
1083:
1.46 gdt 1084: <dt><span class="appendix"><a href="#examples">A. A simple
1.1 grant 1085: example package: bison</a></span></dt>
1086:
1087: <dd>
1088: <dl>
1.46 gdt 1089: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 1090: files</a></span></dt>
1091:
1092: <dd>
1093: <dl>
1.30 wiz 1094: <dt><span class="sect2"><a href=
1.46 gdt 1095: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 1096:
1.30 wiz 1097: <dt><span class="sect2"><a href=
1.46 gdt 1098: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 1099:
1.30 wiz 1100: <dt><span class="sect2"><a href=
1.46 gdt 1101: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 1102:
1.30 wiz 1103: <dt><span class="sect2"><a href=
1.46 gdt 1104: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 1105: package with <span><strong class=
1.14 xtraeme 1106: "command">pkglint</strong></span></a></span></dt>
1.1 grant 1107: </dl>
1108: </dd>
1109:
1.46 gdt 1110: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 1111: Steps for building, installing,
1112: packaging</a></span></dt>
1.1 grant 1113: </dl>
1114: </dd>
1115:
1.46 gdt 1116: <dt><span class="appendix"><a href="#logs">B. Build
1.1 grant 1117: logs</a></span></dt>
1118:
1119: <dd>
1120: <dl>
1.46 gdt 1121: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 1122: Building figlet</a></span></dt>
1123:
1.46 gdt 1124: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 1125: Packaging figlet</a></span></dt>
1126: </dl>
1127: </dd>
1128:
1.46 gdt 1129: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1 grant 1130: of the FTP server's package archive</a></span></dt>
1.2 hubertf 1131:
1.46 gdt 1132: <dt><span class="appendix"><a href="#editing">D. Editing
1.2 hubertf 1133: guidelines for the pkgsrc guide</a></span></dt>
1134:
1135: <dd>
1136: <dl>
1.46 gdt 1137: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 1138: Targets</a></span></dt>
1139:
1.46 gdt 1140: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 1141: Procedure</a></span></dt>
1142: </dl>
1143: </dd>
1.1 grant 1144: </dl>
1145: </div>
1146:
1.67 hubertf 1147: <div class="chapter" lang="en">
1.1 grant 1148: <div class="titlepage">
1149: <div>
1150: <div>
1.67 hubertf 1151: <h2 class="title"><a name=
1.51 rillig 1152: "introduction"></a>Chapter 1. What is
1153: pkgsrc?</h2>
1.1 grant 1154: </div>
1155: </div>
1156: </div>
1157:
1158: <div class="toc">
1159: <p><b>Table of Contents</b></p>
1160:
1161: <dl>
1.30 wiz 1162: <dt><span class="sect1"><a href=
1163: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 1164:
1165: <dt><span class="sect1"><a href="#overview">1.2.
1166: Overview</a></span></dt>
1167:
1168: <dt><span class="sect1"><a href="#terminology">1.3.
1169: Terminology</a></span></dt>
1170:
1171: <dt><span class="sect1"><a href="#typography">1.4.
1172: Typography</a></span></dt>
1173: </dl>
1174: </div>
1175:
1.67 hubertf 1176: <div class="sect1" lang="en">
1.1 grant 1177: <div class="titlepage">
1178: <div>
1179: <div>
1180: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1181: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 1182: </div>
1183: </div>
1184: </div>
1185:
1.47 reed 1186: <p>There is a lot of software freely available for
1187: Unix-based systems, which usually runs on NetBSD and other
1.1 grant 1188: Unix-flavoured systems, too, sometimes with some
1189: modifications. The NetBSD Packages Collection (pkgsrc)
1190: incorporates any such changes necessary to make that
1191: software run, and makes the installation (and
1192: de-installation) of the software package easy by means of a
1193: single command.</p>
1194:
1195: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 1196: the <span><strong class="command">pkg_*</strong></span>
1197: tools so that installation and de-installation, printing of
1198: an inventory of all installed packages and retrieval of
1199: one-line comments or more verbose descriptions are all
1200: simple.</p>
1.1 grant 1201:
1202: <p>pkgsrc currently contains several thousand packages,
1203: including:</p>
1204:
1205: <div class="itemizedlist">
1206: <ul type="disc">
1207: <li>
1208: <p><a xmlns=
1209: "http://www.w3.org/TR/xhtml1/transitional" href=
1210: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45 wiz 1211: target="_top"><code xmlns="" class=
1212: "filename">www/apache</code></a> - The Apache web
1.20 ben 1213: server</p>
1.1 grant 1214: </li>
1215:
1216: <li>
1217: <p><a xmlns=
1218: "http://www.w3.org/TR/xhtml1/transitional" href=
1219: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 1220: target="_top"><code xmlns="" class=
1221: "filename">www/mozilla</code></a> - The Mozilla web
1.20 ben 1222: browser</p>
1.1 grant 1223: </li>
1224:
1225: <li>
1226: <p><a xmlns=
1227: "http://www.w3.org/TR/xhtml1/transitional" href=
1228: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45 wiz 1229: target="_top"><code xmlns="" class=
1230: "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20 ben 1231: Desktop Environment</p>
1.1 grant 1232: </li>
1233:
1234: <li>
1235: <p><a xmlns=
1236: "http://www.w3.org/TR/xhtml1/transitional" href=
1237: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45 wiz 1238: target="_top"><code xmlns="" class=
1239: "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20 ben 1240: Environment</p>
1.1 grant 1241: </li>
1242: </ul>
1243: </div>
1244:
1245: <p>...just to name a few.</p>
1246:
1247: <p>pkgsrc has built-in support for handling varying
1248: dependencies, such as pthreads and X11, and extended
1249: features such as IPv6 support on a range of platforms.</p>
1250:
1251: <p>pkgsrc was derived from FreeBSD's ports system, and
1252: initially developed for NetBSD only. Since then, pkgsrc has
1253: grown a lot, and now supports the following platforms:</p>
1254:
1255: <div class="itemizedlist">
1256: <ul type="disc">
1257: <li>
1258: <p><a href="http://developer.apple.com/darwin/"
1259: target="_top">Darwin</a> (<a href=
1260: "http://www.apple.com/macosx/" target="_top">Mac OS
1261: X</a>)</p>
1262: </li>
1263:
1264: <li>
1.3 hubertf 1265: <p><a href="http://www.DragonFlyBSD.org/" target=
1.70 rillig 1266: "_top">DragonFly BSD</a></p>
1.3 hubertf 1267: </li>
1268:
1269: <li>
1.1 grant 1270: <p><a href="http://www.FreeBSD.org/" target=
1271: "_top">FreeBSD</a></p>
1272: </li>
1273:
1274: <li>
1.3 hubertf 1275: <p>Microsoft Windows, via <a href=
1276: "http://www.microsoft.com/windows/sfu/" target=
1277: "_top">Interix</a></p>
1.1 grant 1278: </li>
1279:
1280: <li>
1281: <p><a href="http://www.sgi.com/software/irix6.5/"
1282: target="_top">IRIX</a></p>
1283: </li>
1284:
1285: <li>
1286: <p><a href="http://www.linux.org/" target=
1287: "_top">Linux</a></p>
1288: </li>
1289:
1290: <li>
1291: <p><a href="http://www.NetBSD.org/" target=
1292: "_top">NetBSD</a> (of course)</p>
1293: </li>
1294:
1295: <li>
1.17 sketch 1296: <p><a href="http://h30097.www3.hp.com/" target=
1297: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1298: </li>
1299:
1300: <li>
1.1 grant 1301: <p><a href="http://www.openbsd.org/" target=
1302: "_top">OpenBSD</a></p>
1303: </li>
1304:
1305: <li>
1306: <p><a href="http://www.sun.com/solaris/" target=
1307: "_top">Solaris</a></p>
1308: </li>
1309: </ul>
1310: </div>
1311: </div>
1312:
1.67 hubertf 1313: <div class="sect1" lang="en">
1.1 grant 1314: <div class="titlepage">
1315: <div>
1316: <div>
1317: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1318: "overview"></a>1.2. Overview</h2>
1.1 grant 1319: </div>
1320: </div>
1321: </div>
1322:
1323: <p>This document is divided into two parts. The first,
1324: <a href="#users-guide" title=
1.46 gdt 1325: "Part I. The pkgsrc user's guide">The pkgsrc
1.2 hubertf 1326: user's guide</a>, describes how one can use one of the
1327: packages in the Package Collection, either by installing a
1328: precompiled binary package, or by building one's own copy
1329: using the NetBSD package system. The second part, <a href=
1.1 grant 1330: "#developers-guide" title=
1.46 gdt 1331: "Part II. The pkgsrc developer's guide">The
1332: pkgsrc developer's guide</a>, explains how to prepare a
1333: package so it can be easily built by other NetBSD users
1334: without knowing about the package's building details.</p>
1.1 grant 1335:
1336: <p>This document is available in various formats:</p>
1337:
1338: <div class="itemizedlist">
1339: <ul type="disc">
1340: <li>
1341: <p><a href="index.html" target="_top">HTML</a></p>
1342: </li>
1343:
1344: <li>
1345: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1346: </li>
1347:
1348: <li>
1349: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1350: </li>
1351:
1352: <li>
1353: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1354: </li>
1355: </ul>
1356: </div>
1357: </div>
1358:
1.67 hubertf 1359: <div class="sect1" lang="en">
1.1 grant 1360: <div class="titlepage">
1361: <div>
1362: <div>
1363: <h2 class="title" style="clear: both"><a name=
1364: "terminology"></a>1.3. Terminology</h2>
1365: </div>
1366: </div>
1367: </div>
1368:
1369: <p>There has been a lot of talk about “<span class=
1370: "quote">ports</span>”, “<span class=
1371: "quote">packages</span>”, etc. so far. Here is a
1372: description of all the terminology used within this
1373: document.</p>
1374:
1375: <div class="variablelist">
1376: <dl>
1377: <dt><span class="term">Package</span></dt>
1378:
1379: <dd>
1380: <p>A set of files and building instructions that
1381: describe what's necessary to build a certain piece of
1382: software using pkgsrc. Packages are traditionally
1.45 wiz 1383: stored under <code xmlns=
1384: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1385: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1386: </dd>
1387:
1388: <dt><span class="term">The NetBSD package
1389: system</span></dt>
1390:
1391: <dd>
1392: <p>This is the former name of “<span class=
1393: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1394: NetBSD operating system and can be bootstrapped to
1395: run on non-NetBSD operating systems as well. It
1396: handles building (compiling), installing, and
1397: removing of packages.</p>
1.1 grant 1398: </dd>
1399:
1400: <dt><span class="term">Distfile</span></dt>
1401:
1402: <dd>
1403: <p>This term describes the file or files that are
1404: provided by the author of the piece of software to
1405: distribute his work. All the changes necessary to
1406: build on NetBSD are reflected in the corresponding
1407: package. Usually the distfile is in the form of a
1408: compressed tar-archive, but other types are possible,
1.45 wiz 1409: too. Distfiles are usually stored below <code xmlns=
1410: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1411: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1412: </dd>
1413:
1414: <dt><span class="term">Port</span></dt>
1415:
1416: <dd>
1417: <p>This is the term used by FreeBSD and OpenBSD
1418: people for what we call a package. In NetBSD
1419: terminology, “<span class=
1420: "quote">port</span>” refers to a different
1421: architecture.</p>
1422: </dd>
1423:
1424: <dt><span class="term">Precompiled/binary
1425: package</span></dt>
1426:
1427: <dd>
1428: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1429: distfile and stuffed together in a single
1.45 wiz 1430: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1431: class="filename">.tgz</code> file so it can be
1.14 xtraeme 1432: installed on machines of the same machine
1433: architecture without the need to recompile. Packages
1.45 wiz 1434: are usually generated in <code xmlns=
1435: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1436: "filename">/usr/pkgsrc/packages</code>; there is also
1437: an archive on <a href=
1.1 grant 1438: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1439: "_top">ftp.NetBSD.org</a>.</p>
1440:
1441: <p>Sometimes, this is referred to by the term
1442: “<span class="quote">package</span>” too,
1443: especially in the context of precompiled
1444: packages.</p>
1445: </dd>
1446:
1447: <dt><span class="term">Program</span></dt>
1448:
1449: <dd>
1450: <p>The piece of software to be installed which will
1.47 reed 1451: be constructed from all the files in the distfile by
1.1 grant 1452: the actions defined in the corresponding package.</p>
1453: </dd>
1454: </dl>
1455: </div>
1456: </div>
1457:
1.67 hubertf 1458: <div class="sect1" lang="en">
1.1 grant 1459: <div class="titlepage">
1460: <div>
1461: <div>
1462: <h2 class="title" style="clear: both"><a name=
1463: "typography"></a>1.4. Typography</h2>
1464: </div>
1465: </div>
1466: </div>
1467:
1468: <p>When giving examples for commands, shell prompts are
1469: used to show if the command should/can be issued as root,
1470: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1471: privileges are sufficient. We use a <code class=
1472: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1473: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1474: assuming they use the C-shell or tcsh.</p>
1.1 grant 1475: </div>
1476: </div>
1477:
1.67 hubertf 1478: <div class="part" lang="en">
1.1 grant 1479: <div class="titlepage">
1480: <div>
1481: <div>
1.67 hubertf 1482: <h1 class="title"><a name=
1.48 dillo 1483: "users-guide"></a>Part I. The pkgsrc user's
1484: guide</h1>
1.1 grant 1485: </div>
1486: </div>
1487: </div>
1488:
1489: <div class="toc">
1490: <p><b>Table of Contents</b></p>
1491:
1492: <dl>
1493: <dt><span class="chapter"><a href="#getting">2. Where to
1.59 rillig 1494: get pkgsrc and how to keep it up-to-date</a></span></dt>
1.1 grant 1495:
1496: <dd>
1497: <dl>
1.30 wiz 1498: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1499: As tar file</a></span></dt>
1.1 grant 1500:
1.30 wiz 1501: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1502: SUP</a></span></dt>
1503:
1.30 wiz 1504: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1505: CVS</a></span></dt>
1.59 rillig 1506:
1507: <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
1508: Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1 grant 1509: </dl>
1510: </dd>
1511:
1512: <dt><span class="chapter"><a href="#platforms">3. Using
1513: pkgsrc on systems other than NetBSD</a></span></dt>
1514:
1515: <dd>
1516: <dl>
1.30 wiz 1517: <dt><span class="sect1"><a href=
1518: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1519: pkgsrc</a></span></dt>
1.1 grant 1520:
1.30 wiz 1521: <dt><span class="sect1"><a href=
1.47 reed 1522: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1523: notes</a></span></dt>
1.1 grant 1524:
1525: <dd>
1526: <dl>
1.30 wiz 1527: <dt><span class="sect2"><a href="#darwin">3.2.1.
1528: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1529:
1.30 wiz 1530: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1531: FreeBSD</a></span></dt>
1.22 tv 1532:
1.30 wiz 1533: <dt><span class="sect2"><a href="#interix">3.2.3.
1534: Interix</a></span></dt>
1.1 grant 1535:
1.30 wiz 1536: <dt><span class="sect2"><a href="#irix">3.2.4.
1537: IRIX</a></span></dt>
1.1 grant 1538:
1.30 wiz 1539: <dt><span class="sect2"><a href="#linux">3.2.5.
1540: Linux</a></span></dt>
1.1 grant 1541:
1.30 wiz 1542: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1543: OpenBSD</a></span></dt>
1.1 grant 1544:
1.30 wiz 1545: <dt><span class="sect2"><a href="#solaris">3.2.7.
1546: Solaris</a></span></dt>
1.1 grant 1547: </dl>
1548: </dd>
1549: </dl>
1550: </dd>
1551:
1552: <dt><span class="chapter"><a href="#using">4. Using
1553: pkgsrc</a></span></dt>
1554:
1555: <dd>
1556: <dl>
1.70 rillig 1557: <dt><span class="sect1"><a href="#using-pkg">4.1.
1558: Using binary packages</a></span></dt>
1.1 grant 1559:
1560: <dd>
1561: <dl>
1562: <dt><span class="sect2"><a href=
1.70 rillig 1563: "#finding-binary-packages">4.1.1. Finding binary
1564: packages</a></span></dt>
1.1 grant 1565:
1566: <dt><span class="sect2"><a href=
1.70 rillig 1567: "#installing-binary-packages">4.1.2. Installing
1.30 wiz 1568: binary packages</a></span></dt>
1.1 grant 1569:
1570: <dt><span class="sect2"><a href=
1.30 wiz 1571: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1572: warning</a></span></dt>
1573: </dl>
1574: </dd>
1575:
1.30 wiz 1576: <dt><span class="sect1"><a href=
1577: "#building-packages-from-source">4.2. Building
1578: packages from source</a></span></dt>
1.1 grant 1579:
1580: <dd>
1581: <dl>
1582: <dt><span class="sect2"><a href=
1.30 wiz 1583: "#requirements">4.2.1.
1584: Requirements</a></span></dt>
1.1 grant 1585:
1586: <dt><span class="sect2"><a href=
1.30 wiz 1587: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1588: distfiles</a></span></dt>
1589:
1590: <dt><span class="sect2"><a href=
1.30 wiz 1591: "#how-to-build-and-install">4.2.3. How to build
1592: and install</a></span></dt>
1.1 grant 1593:
1594: <dt><span class="sect2"><a href=
1.30 wiz 1595: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1596: compiler</a></span></dt>
1597: </dl>
1598: </dd>
1599: </dl>
1600: </dd>
1601:
1.38 dillo 1602: <dt><span class="chapter"><a href="#configuring">5.
1603: Configuring pkgsrc</a></span></dt>
1604:
1605: <dd>
1606: <dl>
1607: <dt><span class="sect1"><a href=
1.45 wiz 1608: "#general-configuration">5.1. General
1609: configuration</a></span></dt>
1610:
1611: <dt><span class="sect1"><a href=
1612: "#variables-affecting-build">5.2. Variables affecting
1613: the build process</a></span></dt>
1614:
1615: <dt><span class="sect1"><a href=
1616: "#developer-advanced-settings">5.3.
1617: Developer/advanced settings</a></span></dt>
1618:
1619: <dt><span class="sect1"><a href=
1620: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 1621: Options</a></span></dt>
1.38 dillo 1622: </dl>
1623: </dd>
1624:
1625: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 1626: binary packages</a></span></dt>
1627:
1628: <dd>
1629: <dl>
1.30 wiz 1630: <dt><span class="sect1"><a href=
1.38 dillo 1631: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 1632: single binary package</a></span></dt>
1.1 grant 1633:
1.30 wiz 1634: <dt><span class="sect1"><a href=
1.38 dillo 1635: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 1636: Settings for creation of binary
1637: packages</a></span></dt>
1638:
1.38 dillo 1639: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 1640: Doing a bulk build of all packages</a></span></dt>
1641:
1642: <dd>
1643: <dl>
1644: <dt><span class="sect2"><a href=
1.38 dillo 1645: "#binary.configuration">6.3.1.
1.1 grant 1646: Configuration</a></span></dt>
1647:
1648: <dt><span class="sect2"><a href=
1.38 dillo 1649: "#other-environmental-considerations">6.3.2.
1.30 wiz 1650: Other environmental
1.1 grant 1651: considerations</a></span></dt>
1652:
1653: <dt><span class="sect2"><a href=
1.38 dillo 1654: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 1655:
1656: <dt><span class="sect2"><a href=
1.38 dillo 1657: "#what-it-does">6.3.4. What it
1.30 wiz 1658: does</a></span></dt>
1.1 grant 1659:
1660: <dt><span class="sect2"><a href=
1.38 dillo 1661: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 1662: requirements</a></span></dt>
1663:
1664: <dt><span class="sect2"><a href=
1.38 dillo 1665: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 1666: sandbox for chrooted builds</a></span></dt>
1.1 grant 1667:
1668: <dt><span class="sect2"><a href=
1.38 dillo 1669: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 1670: partial set of packages</a></span></dt>
1.13 hubertf 1671:
1672: <dt><span class="sect2"><a href=
1.38 dillo 1673: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 1674: build</a></span></dt>
1.1 grant 1675: </dl>
1676: </dd>
1677:
1.30 wiz 1678: <dt><span class="sect1"><a href=
1.38 dillo 1679: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 1680: packages collection</a></span></dt>
1.1 grant 1681:
1682: <dd>
1683: <dl>
1684: <dt><span class="sect2"><a href=
1.38 dillo 1685: "#cdpack-example">6.4.1. Example of
1.1 grant 1686: cdpack</a></span></dt>
1687: </dl>
1688: </dd>
1689: </dl>
1690: </dd>
1691:
1.38 dillo 1692: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 1693: Asked Questions</a></span></dt>
1694:
1695: <dd>
1696: <dl>
1.30 wiz 1697: <dt><span class="sect1"><a href=
1.38 dillo 1698: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 1699: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1700:
1.38 dillo 1701: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 1702: Where's the pkgviews documentation?</a></span></dt>
1703:
1.38 dillo 1704: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 1705: Utilities for package management
1706: (pkgtools)</a></span></dt>
1707:
1.30 wiz 1708: <dt><span class="sect1"><a href=
1.38 dillo 1709: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 1710: non-root</a></span></dt>
1.1 grant 1711:
1.30 wiz 1712: <dt><span class="sect1"><a href=
1.38 dillo 1713: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 1714: fetching distfiles?</a></span></dt>
1.14 xtraeme 1715:
1.30 wiz 1716: <dt><span class="sect1"><a href=
1.38 dillo 1717: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 1718: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1719:
1.30 wiz 1720: <dt><span class="sect1"><a href=
1.38 dillo 1721: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 1722: from pkgsrc?</a></span></dt>
1.1 grant 1723:
1.30 wiz 1724: <dt><span class="sect1"><a href=
1.38 dillo 1725: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 1726: behind a firewall</a></span></dt>
1.1 grant 1727:
1.38 dillo 1728: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30 wiz 1729: How do I tell <span><strong class="command">make
1.14 xtraeme 1730: fetch</strong></span> to do passive
1.1 grant 1731: FTP?</a></span></dt>
1732:
1.30 wiz 1733: <dt><span class="sect1"><a href=
1.38 dillo 1734: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 1735: distfiles at once</a></span></dt>
1.1 grant 1736:
1.30 wiz 1737: <dt><span class="sect1"><a href=
1.38 dillo 1738: "#tmac.andoc-missing">7.11. What does
1.30 wiz 1739: “<span class="quote">Don't know how to make
1740: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1741: mean?</a></span></dt>
1.13 hubertf 1742:
1.30 wiz 1743: <dt><span class="sect1"><a href=
1.38 dillo 1744: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 1745: “<span class="quote">Could not find
1.14 xtraeme 1746: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1747:
1.30 wiz 1748: <dt><span class="sect1"><a href=
1.38 dillo 1749: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 1750: pkgsrc</a></span></dt>
1.1 grant 1751:
1.38 dillo 1752: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 1753: do I change the location of configuration
1754: files?</a></span></dt>
1.1 grant 1755:
1756: <dt><span class="sect1"><a href=
1.38 dillo 1757: "#audit-packages">7.15. Automated security
1.1 grant 1758: checks</a></span></dt>
1759: </dl>
1760: </dd>
1761: </dl>
1762: </div>
1763:
1.67 hubertf 1764: <div class="chapter" lang="en">
1.1 grant 1765: <div class="titlepage">
1766: <div>
1767: <div>
1.67 hubertf 1768: <h2 class="title"><a name=
1.1 grant 1769: "getting"></a>Chapter 2. Where to get
1.59 rillig 1770: pkgsrc and how to keep it up-to-date</h2>
1.1 grant 1771: </div>
1772: </div>
1773: </div>
1774:
1775: <div class="toc">
1776: <p><b>Table of Contents</b></p>
1777:
1778: <dl>
1.30 wiz 1779: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1780: tar file</a></span></dt>
1781:
1.30 wiz 1782: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1783: SUP</a></span></dt>
1784:
1.30 wiz 1785: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1786: CVS</a></span></dt>
1.59 rillig 1787:
1788: <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
1789: Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1 grant 1790: </dl>
1791: </div>
1792:
1793: <p>There are three ways to get pkgsrc. Either as a tar
1794: file, via SUP, or via CVS. All three ways are described
1795: here.</p>
1796:
1.67 hubertf 1797: <div class="sect1" lang="en">
1.1 grant 1798: <div class="titlepage">
1799: <div>
1800: <div>
1801: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1802: "as-tar-file"></a>2.1. As tar file</h2>
1.1 grant 1803: </div>
1804: </div>
1805: </div>
1806:
1807: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1808: file from <a href=
1.11 ben 1809: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1810: target="_top">ftp.NetBSD.org</a> and unpack it into
1.45 wiz 1811: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1812: class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1813: </div>
1814:
1.67 hubertf 1815: <div class="sect1" lang="en">
1.1 grant 1816: <div class="titlepage">
1817: <div>
1818: <div>
1819: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1820: "via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1821: </div>
1822: </div>
1823: </div>
1824:
1825: <p>As an alternative to the tar file, you can get pkgsrc
1826: via the Software Update Protocol, SUP. To do so, make
1827: sure your supfile has a line</p>
1828: <pre class="programlisting">
1.51 rillig 1829: release=pkgsrc
1.1 grant 1830: </pre>
1831:
1.45 wiz 1832: <p>in it, see the examples in <code xmlns=
1833: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1834: "filename">/usr/share/examples/supfiles</code>, and that
1.45 wiz 1835: the <code xmlns=
1836: "http://www.w3.org/TR/xhtml1/transitional" class=
1837: "filename">/usr/pkgsrc</code> directory exists. Then,
1838: simply run <span><strong class="command">sup -v
1839: <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1840: </div>
1841:
1.67 hubertf 1842: <div class="sect1" lang="en">
1.1 grant 1843: <div class="titlepage">
1844: <div>
1845: <div>
1846: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1847: "via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1848: </div>
1849: </div>
1850: </div>
1851:
1852: <p>To get pkgsrc via CVS, make sure you have
1853: “<span class="quote">cvs</span>” installed.
1.27 rillig 1854: To do an initial (full) checkout of pkgsrc, do the
1855: following steps:</p>
1.1 grant 1856: <pre class="screen">
1.14 xtraeme 1857: <code class="prompt">%</code> <strong class=
1858: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1859: <code class="prompt">%</code> <strong class=
1860: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1861: <code class="prompt">%</code> <strong class=
1862: "userinput"><code>cd /usr</code></strong>
1863: <code class="prompt">%</code> <strong class=
1864: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1865: </pre>
1866:
1.45 wiz 1867: <p>This will create the <code xmlns=
1868: "http://www.w3.org/TR/xhtml1/transitional" class=
1869: "filename">pkgsrc</code> directory in your <code xmlns=
1870: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1871: "filename">/usr</code>, and all the package source will
1.45 wiz 1872: be stored under <code xmlns=
1873: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1874: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1875: initial checkout, make sure you have <code class=
1876: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1877: <pre class="screen">
1.14 xtraeme 1878: <code class="prompt">%</code> <strong class=
1879: "userinput"><code>cd /usr/pkgsrc</code></strong>
1880: <code class="prompt">%</code> <strong class=
1881: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1882: </pre>
1883:
1884: <p>Please also note that it is possible to have multiple
1885: copies of the pkgsrc hierarchy in use at any one time -
1886: all work is done relatively within the pkgsrc tree.</p>
1887: </div>
1.59 rillig 1888:
1.67 hubertf 1889: <div class="sect1" lang="en">
1.59 rillig 1890: <div class="titlepage">
1891: <div>
1892: <div>
1893: <h2 class="title" style="clear: both"><a name=
1894: "uptodate-cvs"></a>2.4. Keeping pkgsrc
1895: up-to-date via CVS</h2>
1896: </div>
1897: </div>
1898: </div>
1899:
1900: <p>If your copy of pkgsrc contains a lot of <code xmlns=
1901: "http://www.w3.org/TR/xhtml1/transitional" class=
1902: "filename">CVS</code> directories, you can update it
1903: using the <a href=
1904: "http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current">
1905: <span class="citerefentry"><span class=
1906: "refentrytitle">cvs</span>(1)</span></a> program. First,
1907: <span><strong class="command">cd</strong></span> to the
1908: top level directory of pkgsrc. Then run
1909: <span><strong class="command">cvs -q update
1910: -dP</strong></span>, and you're done.</p>
1911:
1912: <p>If that doesn't work and the file <code xmlns=
1913: "http://www.w3.org/TR/xhtml1/transitional" class=
1914: "filename">CVS/Root</code> contains the string
1915: “<span class="quote">:pserver:</span>”, you
1916: have to run <span><strong class="command">cvs
1917: login</strong></span> once to get known to the NetBSD CVS
1918: server. The <span><strong class=
1919: "command">cvs</strong></span> utility will then ask you
1920: for a password. Just enter “<span class=
1921: "quote">anoncvs</span>”. Then try again to
1922: update.</p>
1923: </div>
1.1 grant 1924: </div>
1925:
1.67 hubertf 1926: <div class="chapter" lang="en">
1.1 grant 1927: <div class="titlepage">
1928: <div>
1929: <div>
1.67 hubertf 1930: <h2 class="title"><a name=
1.1 grant 1931: "platforms"></a>Chapter 3. Using pkgsrc on
1932: systems other than NetBSD</h2>
1933: </div>
1934: </div>
1935: </div>
1936:
1937: <div class="toc">
1938: <p><b>Table of Contents</b></p>
1939:
1940: <dl>
1.30 wiz 1941: <dt><span class="sect1"><a href=
1942: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1943: pkgsrc</a></span></dt>
1.1 grant 1944:
1.30 wiz 1945: <dt><span class="sect1"><a href=
1.47 reed 1946: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1947: notes</a></span></dt>
1.1 grant 1948:
1949: <dd>
1950: <dl>
1.30 wiz 1951: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1952: Darwin (Mac OS X)</a></span></dt>
1953:
1.30 wiz 1954: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1955: FreeBSD</a></span></dt>
1956:
1.30 wiz 1957: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1958: Interix</a></span></dt>
1959:
1.30 wiz 1960: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1961: IRIX</a></span></dt>
1962:
1.30 wiz 1963: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1964: Linux</a></span></dt>
1965:
1.30 wiz 1966: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1967: OpenBSD</a></span></dt>
1968:
1.30 wiz 1969: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1970: Solaris</a></span></dt>
1971: </dl>
1972: </dd>
1973: </dl>
1974: </div>
1975:
1.67 hubertf 1976: <div class="sect1" lang="en">
1.1 grant 1977: <div class="titlepage">
1978: <div>
1979: <div>
1980: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1981: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
1982: pkgsrc</h2>
1.1 grant 1983: </div>
1984: </div>
1985: </div>
1986:
1.27 rillig 1987: <p>For operating systems other than NetBSD, we provide a
1.1 grant 1988: bootstrap kit to build the required tools to use pkgsrc
1989: on your platform. Besides support for native NetBSD,
1990: pkgsrc and the bootstrap kit have support for the
1991: following operating systems:</p>
1992:
1993: <div class="itemizedlist">
1994: <ul type="disc">
1995: <li>
1996: <p>Darwin (Mac OS X)</p>
1997: </li>
1998:
1999: <li>
1.70 rillig 2000: <p>DragonFly BSD</p>
1.16 grant 2001: </li>
2002:
2003: <li>
1.1 grant 2004: <p>FreeBSD</p>
2005: </li>
2006:
2007: <li>
2008: <p>Interix (Windows 2000, XP, 2003)</p>
2009: </li>
2010:
2011: <li>
2012: <p>IRIX</p>
2013: </li>
2014:
2015: <li>
2016: <p>Linux</p>
2017: </li>
2018:
2019: <li>
2020: <p>OpenBSD</p>
2021: </li>
2022:
2023: <li>
2024: <p>Solaris</p>
2025: </li>
1.16 grant 2026:
2027: <li>
2028: <p>Tru64 (Digital UNIX/OSF1)</p>
2029: </li>
1.1 grant 2030: </ul>
2031: </div>
2032:
2033: <p>Support for other platforms is under development.</p>
2034:
2035: <p>Installing the bootstrap kit should be as simple
2036: as:</p>
2037: <pre class="screen">
1.14 xtraeme 2038: <code class="prompt">#</code> <strong class=
2039: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
2040: <code class="prompt">#</code> <strong class=
2041: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
2042: <code class="prompt">#</code> <strong class=
2043: "userinput"><code>./bootstrap</code></strong>
1.1 grant 2044: </pre>
2045:
2046: <p>See <a href="#getting" title=
1.59 rillig 2047: "Chapter 2. Where to get pkgsrc and how to keep it up-to-date">
1.67 hubertf 2048: Chapter 2, <i>Where to get pkgsrc and how to keep it
1.59 rillig 2049: up-to-date</i></a> for other ways to get pkgsrc before
2050: bootstrapping. The given <span><strong class=
2051: "command">bootstrap</strong></span> command will use the
2052: defaults of <code xmlns=
1.45 wiz 2053: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2054: "filename">/usr/pkg</code> for the <span class=
2055: "emphasis"><em>prefix</em></span> where programs will be
1.45 wiz 2056: installed in, and <code xmlns=
2057: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2058: "filename">/var/db/pkg</code> for the package database
1.27 rillig 2059: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 2060: However, these can also be set using command-line
1.27 rillig 2061: arguments.</p>
1.1 grant 2062:
2063: <p>Binary packages for the pkgsrc tools and an initial
2064: set of packages is available for supported platforms. An
2065: up-to-date list of these can be found on <a href=
2066: "http://www.pkgsrc.org/" target=
1.63 dillo 2067: "_top">www.pkgsrc.org</a>. Note that this only works for
2068: privileged builds that install into <code xmlns=
2069: "http://www.w3.org/TR/xhtml1/transitional" class=
2070: "filename">/usr/pkg</code>.</p>
1.47 reed 2071:
2072: <div class="note" style=
2073: "margin-left: 0.5in; margin-right: 0.5in;">
2074: <h3 class="title">Note</h3>
2075:
2076: <p>The bootstrap installs a <span><strong class=
2077: "command">bmake</strong></span> tool. Use this
2078: <span><strong class="command">bmake</strong></span>
2079: when building via pkgsrc. For examples in this guide,
2080: use <span><strong class="command">bmake</strong></span>
2081: instead of “<span class=
2082: "quote">make</span>”.</p>
2083: </div>
1.1 grant 2084: </div>
2085:
1.67 hubertf 2086: <div class="sect1" lang="en">
1.1 grant 2087: <div class="titlepage">
2088: <div>
2089: <div>
2090: <h2 class="title" style="clear: both"><a name=
1.47 reed 2091: "platform-specific-notes"></a>3.2. Platform-specific
2092: notes</h2>
1.1 grant 2093: </div>
2094: </div>
2095: </div>
2096:
2097: <p>Here are some platform-specific notes you should be
2098: aware of.</p>
2099:
1.67 hubertf 2100: <div class="sect2" lang="en">
1.1 grant 2101: <div class="titlepage">
2102: <div>
2103: <div>
1.67 hubertf 2104: <h3 class="title"><a name=
1.30 wiz 2105: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 2106: </div>
2107: </div>
2108: </div>
2109:
2110: <p>Darwin 5.x and 6.x are supported. There are two
2111: methods of using pkgsrc on Mac OS X, by using a
2112: <a href="#platform.osx-image" title=
2113: "3.2.1.1. Using a disk image">disk image</a>, or a
2114: <a href="#platform.osx-ufs" title=
2115: "3.2.1.2. Using a UFS partition">UFS
2116: partition</a>.</p>
2117:
2118: <p>Before you start, you will need to download and
2119: install the Mac OS X Developer Tools from Apple's
2120: Developer Connection. See <a href=
2121: "http://developer.apple.com/macosx/" target=
2122: "_top">http://developer.apple.com/macosx/</a> for
2123: details. Also, make sure you install X11 for Mac OS X
2124: and the X11 SDK from <a href=
2125: "http://www.apple.com/macosx/x11/download/" target=
2126: "_top">http://www.apple.com/macosx/x11/download/</a> if
2127: you intend to build packages that use the X11 Window
2128: System.</p>
2129:
2130: <p>If you already have a UFS partition, or have a spare
2131: partition that you can format as UFS, it is recommended
2132: to use that instead of the disk image. It'll be
2133: somewhat faster and will mount automatically at boot
2134: time, where you must manually mount a disk image.</p>
2135:
2136: <div class="note" style=
2137: "margin-left: 0.5in; margin-right: 0.5in;">
2138: <h3 class="title">Note</h3>
2139:
2140: <p>You cannot use a HFS+ file system for pkgsrc,
1.47 reed 2141: because pkgsrc currently requires the file system to
1.1 grant 2142: be case-sensitive, and HFS+ is not.</p>
2143: </div>
2144:
1.67 hubertf 2145: <div class="sect3" lang="en">
1.1 grant 2146: <div class="titlepage">
2147: <div>
2148: <div>
1.67 hubertf 2149: <h4 class="title"><a name=
2150: "platform.osx-image"></a>3.2.1.1. Using a
2151: disk image</h4>
1.1 grant 2152: </div>
2153: </div>
2154: </div>
2155:
2156: <p>Create the disk image:</p>
2157: <pre class="screen">
1.14 xtraeme 2158: <code class="prompt">#</code> <strong class=
2159: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
2160: <code class="prompt">#</code> <strong class=
2161: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
2162: <code class="prompt">#</code> <strong class=
2163: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
2164: <code class="prompt">#</code> <strong class=
2165: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 2166: </pre>
2167:
2168: <p>That's it!</p>
2169: </div>
2170:
1.67 hubertf 2171: <div class="sect3" lang="en">
1.1 grant 2172: <div class="titlepage">
2173: <div>
2174: <div>
1.67 hubertf 2175: <h4 class="title"><a name=
2176: "platform.osx-ufs"></a>3.2.1.2. Using a
1.1 grant 2177: UFS partition</h4>
2178: </div>
2179: </div>
2180: </div>
2181:
1.45 wiz 2182: <p>By default, <code xmlns=
2183: "http://www.w3.org/TR/xhtml1/transitional" class=
2184: "filename">/usr</code> will be on your root file
2185: system, normally HFS+. It is possible to use the
2186: default <span class="emphasis"><em>prefix</em></span>
2187: of <code xmlns=
2188: "http://www.w3.org/TR/xhtml1/transitional" class=
2189: "filename">/usr/pkg</code> by symlinking <code xmlns=
2190: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2191: "filename">/usr/pkg</code> to a directory on a UFS
2192: file system. Obviously, another symlink is required
2193: if you want to place the package database directory
2194: outside the <span class=
2195: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 2196: <pre class="screen">
1.14 xtraeme 2197: <code class="prompt">#</code> <strong class=
1.59 rillig 2198: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb</code></strong>
1.1 grant 2199: </pre>
2200:
2201: <p>If you created your partitions at the time of
2202: installing Mac OS X and formatted the target
2203: partition as UFS, it should automatically mount on
1.45 wiz 2204: <code xmlns=
2205: "http://www.w3.org/TR/xhtml1/transitional" class=
2206: "filename">/Volumes/<volume name></code> when
2207: the machine boots. If you are (re)formatting a
2208: partition as UFS, you need to ensure that the
2209: partition map correctly reflects “<span class=
2210: "quote">Apple_UFS</span>” and not
2211: “<span class=
1.1 grant 2212: "quote">Apple_HFS</span>”.</p>
2213:
2214: <p>The problem is that none of the disk tools will
2215: let you touch a disk that is booted from. You can
2216: unmount the partition, but even if you newfs it, the
2217: partition type will be incorrect and the automounter
2218: won't mount it. It can be mounted manually, but it
2219: won't appear in Finder.</p>
2220:
2221: <p>You'll need to boot off of the OS X Installation
2222: (User) CD. When the Installation program starts, go
2223: up to the menu and select Disk Utility. Now, you will
2224: be able to select the partition you want to be UFS,
2225: and Format it Apple UFS. Quit the Disk Utility, quit
2226: the installer which will reboot your machine. The new
2227: UFS file system will appear in Finder.</p>
2228:
2229: <p>Be aware that the permissions on the new file
2230: system will be writable by root only.</p>
2231:
2232: <p>This note is as of 10.2 (Jaguar) and applies to
2233: earlier versions. Hopefully Apple will fix Disk
2234: Utility in 10.3 (Panther).</p>
2235: </div>
2236: </div>
2237:
1.67 hubertf 2238: <div class="sect2" lang="en">
1.1 grant 2239: <div class="titlepage">
2240: <div>
2241: <div>
1.67 hubertf 2242: <h3 class="title"><a name=
1.30 wiz 2243: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 2244: </div>
2245: </div>
2246: </div>
2247:
2248: <p>FreeBSD 4.7 and 5.0 have been tested and are
2249: supported, other versions may work.</p>
2250:
2251: <p>Care should be taken so that the tools that this kit
2252: installs do not conflict with the FreeBSD userland
2253: tools. There are several steps:</p>
2254:
2255: <div class="orderedlist">
2256: <ol type="1">
2257: <li>
2258: <p>FreeBSD stores its ports pkg database in
1.45 wiz 2259: <code xmlns=
2260: "http://www.w3.org/TR/xhtml1/transitional" class=
2261: "filename">/var/db/pkg</code>. It is therefore
2262: recommended that you choose a different location
2263: (e.g. <code xmlns=
2264: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2265: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2266: --pkgdbdir option to the bootstrap script.</p>
2267: </li>
2268:
2269: <li>
2270: <p>If you do not intend to use the FreeBSD ports
2271: tools, it's probably a good idea to move them out
2272: of the way to avoid confusion, e.g.</p>
2273: <pre class="screen">
1.14 xtraeme 2274: <code class="prompt">#</code> <strong class=
2275: "userinput"><code>cd /usr/sbin</code></strong>
2276: <code class="prompt">#</code> <strong class=
2277: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2278: <code class="prompt">#</code> <strong class=
2279: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2280: <code class="prompt">#</code> <strong class=
2281: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2282: <code class="prompt">#</code> <strong class=
2283: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2284: </pre>
2285: </li>
2286:
2287: <li>
1.45 wiz 2288: <p>An example <code xmlns=
2289: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2290: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2291: placed in <code xmlns=
2292: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2293: "filename">/etc/mk.conf.example</code> file when
2294: you use the bootstrap script.</p>
1.1 grant 2295: </li>
2296: </ol>
2297: </div>
2298: </div>
2299:
1.67 hubertf 2300: <div class="sect2" lang="en">
1.1 grant 2301: <div class="titlepage">
2302: <div>
2303: <div>
1.67 hubertf 2304: <h3 class="title"><a name=
1.30 wiz 2305: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2306: </div>
2307: </div>
2308: </div>
2309:
1.47 reed 2310: <p>Interix is a POSIX-compatible subsystem for the
1.1 grant 2311: Windows NT kernel, providing a Unix-like environment
2312: with a tighter kernel integration than available with
2313: Cygwin. It is part of the Windows Services for Unix
2314: package, available for free for any licensed copy of
1.22 tv 2315: Windows 2000, XP (not including XP Home), or 2003. SFU
2316: can be downloaded from <a href=
2317: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2318: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2319:
2320: <p>Services for Unix 3.5, current as of this writing,
2321: has been tested. 3.0 or 3.1 may work, but are not
2322: officially supported. (The main difference in 3.0/3.1
2323: is lack of pthreads.)</p>
2324:
1.67 hubertf 2325: <div class="sect3" lang="en">
1.1 grant 2326: <div class="titlepage">
2327: <div>
2328: <div>
2329: <h4 class="title"><a name=
2330: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2331: installing Interix/SFU</h4>
1.1 grant 2332: </div>
2333: </div>
2334: </div>
2335:
2336: <p>At an absolute minimum, the following packages
2337: must be installed from the Windows Services for Unix
2338: 3.5 distribution in order to use pkgsrc:</p>
2339:
2340: <div class="itemizedlist">
2341: <ul type="disc">
2342: <li>
2343: <p>Utilities -> Base Utilities</p>
2344: </li>
2345:
2346: <li>
2347: <p>Interix GNU Components -> (all)</p>
2348: </li>
2349:
2350: <li>
2351: <p>Remote Connectivity</p>
2352: </li>
2353:
2354: <li>
2355: <p>Interix SDK</p>
2356: </li>
2357: </ul>
2358: </div>
2359:
2360: <p>When using pkgsrc on Interix, DO NOT install the
2361: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2362: without shared module support, installed to
2363: /usr/local, and will only cause confusion. Instead,
2364: install Perl 5.8 from pkgsrc (or from a binary
2365: package).</p>
2366:
2367: <p>The Remote Connectivity subcomponent "Windows
2368: Remote Shell Service" does not need to be installed,
2369: but Remote Connectivity itself should be installed in
2370: order to have a working inetd.</p>
2371:
1.52 tv 2372: <p>During installation you may be asked whether to
2373: enable setuid behavior for Interix programs, and
2374: whether to make pathnames default to case-sensitive.
2375: Setuid should be enabled, and case-sensitivity MUST
2376: be enabled. (Without case-sensitivity, a large number
2377: of packages including perl will not build.)</p>
2378:
2379: <p>NOTE: Newer Windows service packs change the way
2380: binary execution works (via the Data Execution
2381: Prevention feature). In order to use pkgsrc and other
2382: gcc-compiled binaries reliably, a hotfix containing
2383: POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
2384: (899522 or newer) must be installed. Hotfixes are
2385: available from Microsoft through a support contract;
2386: however, a NetBSD developer has made most Interix
2387: hotfixes available for personal use from <a href=
2388: "http://www.duh.org/interix/hotfixes.php" target=
2389: "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1 grant 2390: </div>
2391:
1.67 hubertf 2392: <div class="sect3" lang="en">
1.1 grant 2393: <div class="titlepage">
2394: <div>
2395: <div>
2396: <h4 class="title"><a name=
2397: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2398: to do if Interix/SFU is already installed</h4>
2399: </div>
2400: </div>
2401: </div>
2402:
2403: <p>If SFU is already installed and you wish to alter
2404: these settings to work with pkgsrc, note the
2405: following things.</p>
2406:
2407: <div class="itemizedlist">
2408: <ul type="disc">
2409: <li>
2410: <p>To uninstall UNIX Perl, use Add/Remove
2411: Programs, select Microsoft Windows Services for
2412: UNIX, then click Change. In the installer,
2413: choose Add or Remove, then uncheck
2414: Utilities->UNIX Perl.</p>
2415: </li>
2416:
2417: <li>
1.47 reed 2418: <p>To enable case-sensitivity for the file
2419: system, run REGEDIT.EXE, and change the
1.1 grant 2420: following registry key:</p>
2421:
2422: <p>
2423: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2424: Manager\kernel</p>
2425:
2426: <p>Set the DWORD value "obcaseinsensitive" to
2427: 0; then reboot.</p>
2428: </li>
2429:
2430: <li>
2431: <p>To enable setuid binaries (optional), run
2432: REGEDIT.EXE, and change the following registry
2433: key:</p>
2434:
2435: <p>
2436: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2437: for UNIX</p>
2438:
2439: <p>Set the DWORD value "EnableSetuidBinaries"
2440: to 1; then reboot.</p>
2441: </li>
2442: </ul>
2443: </div>
2444: </div>
2445:
1.67 hubertf 2446: <div class="sect3" lang="en">
1.1 grant 2447: <div class="titlepage">
2448: <div>
2449: <div>
2450: <h4 class="title"><a name=
2451: "platform.interix-notes"></a>3.2.3.3. Important
2452: notes for using pkgsrc</h4>
2453: </div>
2454: </div>
2455: </div>
2456:
1.52 tv 2457: <p>The package manager (either the pkgsrc "su" user,
1.1 grant 2458: or the user running "pkg_add") must be a member of
2459: the local Administrators group. Such a user must also
2460: be used to run the bootstrap. This is slightly
2461: relaxed from the normal pkgsrc requirement of
2462: "root".</p>
2463:
2464: <p>The package manager should use a umask of 002.
2465: "make install" will automatically complain if this is
2466: not the case. This ensures that directories written
2467: in /var/db/pkg are Administrators-group
2468: writeable.</p>
2469:
2470: <p>The popular Interix binary packages from
2471: http://www.interopsystems.com/ use an older version
2472: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2473: used in conjunction with pkgsrc. If you choose to use
2474: them at the same time as the pkgsrc packages, ensure
2475: that you use the proper pkg_* tools for each type of
2476: binary package.</p>
1.22 tv 2477:
2478: <p>The TERM setting used for DOS-type console windows
2479: (including those invoked by the csh and ksh startup
2480: shortcuts) is "interix". Most systems don't have a
2481: termcap/terminfo entry for it, but the following
2482: .termcap entry provides adequate emulation in most
2483: cases:</p>
2484: <pre class="programlisting">
1.51 rillig 2485: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22 tv 2486: </pre>
1.1 grant 2487: </div>
1.52 tv 2488:
1.67 hubertf 2489: <div class="sect3" lang="en">
1.52 tv 2490: <div class="titlepage">
2491: <div>
2492: <div>
2493: <h4 class="title"><a name=
2494: "platform.interix-limits"></a>3.2.3.4. Limitations
2495: of the Interix platform</h4>
2496: </div>
2497: </div>
2498: </div>
2499:
2500: <p>Though Interix suffices as a familiar and flexible
2501: substitute for a full Unix-like platform, it has some
2502: drawbacks that should be noted for those desiring to
2503: make the most of Interix.</p>
2504:
2505: <div class="itemizedlist">
2506: <ul type="disc">
2507: <li>
1.54 tv 2508: <p><span class=
1.57 minskim 2509: "strong"><strong>X11:</strong></span></p>
1.52 tv 2510:
2511: <p>Interix comes with the standard set of X11R6
1.57 minskim 2512: client libraries, and can run X11 based
1.52 tv 2513: applications, but it does <span class=
2514: "emphasis"><em>not</em></span> come with an X
2515: server. Some options are <a href=
2516: "http://www.starnet.com/products/xwin32/"
2517: target="_top">StarNet X-Win32</a>, <a href=
2518: "http://connectivity.hummingbird.com/products/nc/exceed/"
1.57 minskim 2519: target="_top">Hummingbird Exceed</a> (available
2520: in a trimmed version for Interix from Interop
2521: Systems as the <a href=
2522: "http://www.interopsystems.com/InteropXserver.htm"
2523: target="_top">Interop X Server</a>), and the
2524: free X11 server included with <a href=
1.52 tv 2525: "http://x.cygwin.com/" target=
2526: "_top">Cygwin</a>.</p>
2527:
2528: <p>Also, StarNet Communications has graciously
2529: provided a free version of their X-Win32
2530: product that accepts connections only from
2531: localhost: <a href=
2532: "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
2533: target="_top">X-Win32 LX</a>, recommended by
2534: the maintainer of Interix pkgsrc support.</p>
2535: </li>
2536:
2537: <li>
1.57 minskim 2538: <p><span class="strong"><strong>X11
1.54 tv 2539: acceleration:</strong></span></p>
1.52 tv 2540:
2541: <p>Because Interix runs in a completely
2542: different NT subsystem from Win32 applications,
2543: it does not currently support various X11
2544: protocol extensions for acceleration (such as
2545: MIT-SHM or DGA). Most interactive applications
2546: to a local X server will run reasonably fast,
2547: but full motion video and other graphics
2548: intensive applications may require a
2549: faster-than-expected CPU.</p>
2550: </li>
2551:
2552: <li>
1.54 tv 2553: <p><span class=
2554: "strong"><strong>Audio:</strong></span></p>
1.52 tv 2555:
2556: <p>Interix has no native support for audio
1.53 tv 2557: output. For audio support, pkgsrc uses the
2558: <span><strong class=
1.52 tv 2559: "command">esound</strong></span> client/server
2560: audio system on Interix. Unlike on most
2561: platforms, the <a xmlns=
2562: "http://www.w3.org/TR/xhtml1/transitional"
2563: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
2564: target="_top"><code xmlns="" class=
2565: "filename">audio/esound</code></a> package does
2566: <span class="emphasis"><em>not</em></span>
2567: contain the <span><strong class=
1.53 tv 2568: "command">esd</strong></span> server component.
2569: To output audio via an Interix host, the
2570: <a xmlns=
1.52 tv 2571: "http://www.w3.org/TR/xhtml1/transitional"
2572: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
2573: target="_top"><code xmlns="" class=
2574: "filename">emulators/cygwin_esound</code></a>
2575: package must also be installed.</p>
2576: </li>
2577:
2578: <li>
1.54 tv 2579: <p><span class="strong"><strong>CD/DVDs, USB,
2580: and SCSI:</strong></span></p>
1.52 tv 2581:
2582: <p>Direct device access is not currently
2583: supported in Interix, so it is not currently
2584: possible to access CD/DVD drives, USB devices,
2585: or SCSI devices through non-filesystem means.
2586: Among other things, this makes it impossible to
2587: use Interix directly for CD/DVD burning.</p>
2588: </li>
2589:
2590: <li>
1.54 tv 2591: <p><span class="strong"><strong>Tape
2592: drives:</strong></span></p>
1.52 tv 2593:
2594: <p>Due to the same limitations as for CD-ROMs
2595: and SCSI devices, tape drives are also not
2596: directly accessible in Interix. However,
2597: support is in work to make tape drive access
2598: possible by using Cygwin as a bridge (similarly
2599: to audio bridged via Cygwin's esound
2600: server).</p>
2601: </li>
2602: </ul>
2603: </div>
2604: </div>
2605:
1.67 hubertf 2606: <div class="sect3" lang="en">
1.52 tv 2607: <div class="titlepage">
2608: <div>
2609: <div>
2610: <h4 class="title"><a name=
2611: "platform.interix-knownissues"></a>3.2.3.5. Known
2612: issues for pkgsrc on Interix</h4>
2613: </div>
2614: </div>
2615: </div>
2616:
2617: <p>It is not necessary, in general, to have a "root"
2618: user on the Windows system; any member of the local
2619: Administrators group will suffice. However, some
2620: packages currently assume that the user named "root"
2621: is the privileged user. To accommodate these, you may
2622: create such a user; make sure it is in the local
2623: group Administrators (or your language
2624: equivalent).</p>
2625:
2626: <p>"pkg_add" creates directories of mode 0755, not
2627: 0775, in $PKG_DBDIR. For the time being, install
2628: packages as the local Administrator (or your language
2629: equivalent), or run the following command after
2630: installing a package to work around the issue:</p>
2631: <pre class="screen">
2632: <code class="prompt">#</code> <strong class=
2633: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
2634: </pre>
2635: </div>
1.1 grant 2636: </div>
2637:
1.67 hubertf 2638: <div class="sect2" lang="en">
1.1 grant 2639: <div class="titlepage">
2640: <div>
2641: <div>
1.67 hubertf 2642: <h3 class="title"><a name=
1.30 wiz 2643: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2644: </div>
2645: </div>
2646: </div>
2647:
2648: <p>You will need a working C compiler, either gcc or
2649: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2650: the <code class="varname">CC</code> environment
2651: variable according to your preference. If you do not
2652: have a license for the MIPSpro compiler suite, you can
1.1 grant 2653: download a gcc tardist file from <a href=
2654: "http://freeware.sgi.com/" target=
2655: "_top">http://freeware.sgi.com/</a>.</p>
2656:
2657: <p>Please note that you will need IRIX 6.5.17 or
2658: higher, as this is the earliest version of IRIX
1.24 wiz 2659: providing support for <a href=
2660: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2661: <span class="citerefentry"><span class=
2662: "refentrytitle">if_indextoname</span>(3)</span></a>,
2663: <a href=
2664: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2665: <span class="citerefentry"><span class=
2666: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2667: etc.</p>
1.1 grant 2668:
1.27 rillig 2669: <p>At this point in time, pkgsrc only supports one ABI
2670: at a time. That is, you can not switch between the old
2671: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2672: you start out using "abi=n32", that's what all your
2673: packages will be built with.</p>
1.1 grant 2674:
2675: <p>Therefore, please make sure that you have no
1.14 xtraeme 2676: conflicting <code class="varname">CFLAGS</code> in your
1.45 wiz 2677: environment or the <code xmlns=
2678: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2679: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2680: that you do not try to link n32 object files with lib64
1.45 wiz 2681: or vice versa. Check your <code xmlns=
2682: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2683: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2684:
2685: <p>If you have the actual pkgsrc tree mounted via NFS
2686: from a different host, please make sure to set
1.14 xtraeme 2687: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2688: directory, as it appears that IRIX linker occasionally
1.47 reed 2689: runs into issues when trying to link over a
2690: network-mounted file system.</p>
1.1 grant 2691:
2692: <p>The bootstrapping process should set all the right
2693: options for programs such as imake(1), but you may want
2694: to set some options depending on your local setup.
1.45 wiz 2695: Please see <code xmlns=
2696: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2697: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2698: course, your compiler's man pages for details.</p>
1.22 tv 2699:
2700: <p>If you are using SGI's MIPSPro compiler, please
2701: set</p>
2702: <pre class="programlisting">
1.51 rillig 2703: PKGSRC_COMPILER= mipspro
1.22 tv 2704: </pre>
2705:
1.45 wiz 2706: <p>in <code xmlns=
2707: "http://www.w3.org/TR/xhtml1/transitional" class=
2708: "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
2709: assume you are using gcc and may end up passing invalid
2710: flags to the compiler. Note that bootstrap should
2711: create an appropriate <code xmlns=
2712: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2713: "filename">mk.conf.example</code> by default.</p>
2714:
2715: <p>If you have both the MIPSPro compiler chain
2716: installed as well as gcc, but want to make sure that
2717: MIPRPro is used, please set your <code class=
2718: "varname">PATH</code> to <span class=
2719: "emphasis"><em>not</em></span> include the location of
1.45 wiz 2720: gcc (often <code xmlns=
2721: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2722: "filename">/usr/freeware/bin</code>), and (important)
2723: pass the '--preserve-path' flag.</p>
1.1 grant 2724: </div>
2725:
1.67 hubertf 2726: <div class="sect2" lang="en">
1.1 grant 2727: <div class="titlepage">
2728: <div>
2729: <div>
1.67 hubertf 2730: <h3 class="title"><a name=
1.30 wiz 2731: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2732: </div>
2733: </div>
2734: </div>
2735:
2736: <p>Some versions of Linux (for example Debian
2737: GNU/Linux) need either libtermcap or libcurses
2738: (libncurses). Installing the distributions
2739: libncurses-dev package (or equivalent) should fix the
2740: problem.</p>
2741:
2742: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2743: and icc (Intel C++ Compiler). gcc is the default. icc
2744: 8.0 and 8.1 on i386 have been tested.</p>
2745:
2746: <p>To bootstrap using icc, assuming the default icc
2747: installation directory:</p>
2748: <pre class="programlisting">
1.51 rillig 2749: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2750: ac_cv___attribute__=yes ./bootstrap
1.22 tv 2751: </pre>
2752:
2753: <div class="note" style=
2754: "margin-left: 0.5in; margin-right: 0.5in;">
2755: <h3 class="title">Note</h3>
2756:
2757: <p>icc 8.1 needs the `-i-static' argument instead of
2758: -static-libcxa.</p>
2759: </div>
2760:
2761: <p>icc supports __attribute__, but the GNU configure
2762: test uses a nested function, which icc does not
2763: support. #undef'ing __attribute__ has the unfortunate
2764: side-effect of breaking many of the Linux header files,
2765: which cannot be compiled properly without
2766: __attribute__. The test must be overridden so that
2767: __attribute__ is assumed supported by the compiler.</p>
2768:
2769: <p>After bootstrapping, you should set <code class=
1.45 wiz 2770: "varname">PKGSRC_COMPILER</code> in <code xmlns=
2771: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2772: "filename">/etc/mk.conf</code>:</p>
2773: <pre class="programlisting">
1.51 rillig 2774: PKGSRC_COMPILER= icc
1.22 tv 2775: </pre>
2776:
2777: <p>The default installation directory for icc is
1.45 wiz 2778: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2779: class="filename">/opt/intel_cc_80</code>, which is also
2780: the pkgsrc default. If you have installed it into a
2781: different directory, set <code class=
2782: "varname">ICCBASE</code> in <code xmlns=
2783: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2784: "filename">/etc/mk.conf</code>:</p>
2785: <pre class="programlisting">
1.51 rillig 2786: ICCBASE= /opt/icc
1.22 tv 2787: </pre>
2788:
2789: <p>pkgsrc uses the static linking method of the runtime
2790: libraries provided by icc, so binaries can be run on
2791: other systems which do not have the shared libraries
2792: installed.</p>
2793:
2794: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2795: the <a href=
2796: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2797: <span class="citerefentry"><span class=
2798: "refentrytitle">ld</span>(1)</span></a> command run
2799: when linking a C++ shared library and records it,
2800: throwing away the -Bstatic and -Bdynamic options
2801: interspersed between the libraries. This means that
2802: libtool-linked C++ shared libraries will have a runtime
2803: dependency on the icc libraries until this is fixed in
2804: libtool.</p>
1.22 tv 2805: </div>
2806:
1.67 hubertf 2807: <div class="sect2" lang="en">
1.22 tv 2808: <div class="titlepage">
2809: <div>
2810: <div>
1.67 hubertf 2811: <h3 class="title"><a name=
1.30 wiz 2812: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2813: </div>
2814: </div>
2815: </div>
2816:
2817: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2818:
2819: <p>Care should be taken so that the tools that this kit
2820: installs do not conflict with the OpenBSD userland
2821: tools. There are several steps:</p>
2822:
2823: <div class="orderedlist">
2824: <ol type="1">
2825: <li>
2826: <p>OpenBSD stores its ports pkg database in
1.45 wiz 2827: <code xmlns=
2828: "http://www.w3.org/TR/xhtml1/transitional" class=
2829: "filename">/var/db/pkg</code>. It is therefore
2830: recommended that you choose a different location
2831: (e.g. <code xmlns=
2832: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2833: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2834: --pkgdbdir option to the bootstrap script.</p>
2835: </li>
2836:
2837: <li>
2838: <p>If you do not intend to use the OpenBSD ports
2839: tools, it's probably a good idea to move them out
2840: of the way to avoid confusion, e.g.</p>
2841: <pre class="screen">
1.14 xtraeme 2842: <code class="prompt">#</code> <strong class=
2843: "userinput"><code>cd /usr/sbin</code></strong>
2844: <code class="prompt">#</code> <strong class=
2845: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2846: <code class="prompt">#</code> <strong class=
2847: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2848: <code class="prompt">#</code> <strong class=
2849: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2850: <code class="prompt">#</code> <strong class=
2851: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2852: </pre>
2853: </li>
2854:
2855: <li>
1.45 wiz 2856: <p>An example <code xmlns=
2857: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2858: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2859: placed in <code xmlns=
2860: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2861: "filename">/etc/mk.conf.example</code> file when
2862: you use the bootstrap script. OpenBSD's make
1.45 wiz 2863: program uses <code xmlns=
2864: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2865: "filename">/etc/mk.conf</code> as well. You can
1.47 reed 2866: work around this by enclosing all the
2867: pkgsrc-specific parts of the file with:</p>
1.1 grant 2868: <pre class="programlisting">
1.51 rillig 2869: .ifdef BSD_PKG_MK
2870: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
2871: .else
2872: # OpenBSD stuff
2873: .endif
1.1 grant 2874: </pre>
2875: </li>
2876: </ol>
2877: </div>
2878: </div>
2879:
1.67 hubertf 2880: <div class="sect2" lang="en">
1.1 grant 2881: <div class="titlepage">
2882: <div>
2883: <div>
1.67 hubertf 2884: <h3 class="title"><a name=
1.30 wiz 2885: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2886: </div>
2887: </div>
2888: </div>
2889:
2890: <p>Solaris 2.6 through 9 are supported on both x86 and
2891: sparc. You will need a working C compiler. Both gcc
2892: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2893:
2894: <p>The following packages are required on Solaris 8 for
2895: the bootstrap process and to build packages.</p>
2896:
2897: <div class="itemizedlist">
2898: <ul type="disc">
2899: <li>
2900: <p>SUNWsprot</p>
2901: </li>
2902:
2903: <li>
2904: <p>SUNWarc</p>
2905: </li>
2906:
2907: <li>
2908: <p>SUNWbtool</p>
2909: </li>
2910:
2911: <li>
2912: <p>SUNWtoo</p>
2913: </li>
2914:
2915: <li>
2916: <p>SUNWlibm</p>
2917: </li>
2918: </ul>
2919: </div>
2920:
2921: <p>Please note the use of GNU binutils on Solaris is
2922: <span class="emphasis"><em>not</em></span>
2923: supported.</p>
2924:
1.70 rillig 2925: <p>Whichever compiler you use, please ensure the
2926: compiler tools and your $prefix are in your
2927: <code class="varname">PATH</code>. This includes
2928: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2929: class="filename">/usr/ccs/{bin,lib}</code> and e.g.
2930: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2931: class="filename">/usr/pkg/{bin,sbin}</code>.</p>
2932:
1.67 hubertf 2933: <div class="sect3" lang="en">
1.1 grant 2934: <div class="titlepage">
2935: <div>
2936: <div>
1.67 hubertf 2937: <h4 class="title"><a name=
2938: "solaris-gcc-note"></a>3.2.7.1. If you are
2939: using gcc</h4>
1.1 grant 2940: </div>
2941: </div>
2942: </div>
2943:
2944: <p>It makes life much simpler if you only use the
2945: same gcc consistently for building all packages.</p>
2946:
2947: <p>It is recommended that an external gcc be used
2948: only for bootstrapping, then either build gcc from
2949: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2950: href=
2951: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45 wiz 2952: target="_top"><code xmlns="" class=
2953: "filename">lang/gcc</code></a> or install a binary
2954: gcc package, then remove gcc used during
1.20 ben 2955: bootstrapping.</p>
1.1 grant 2956:
2957: <p>Binary packages of gcc can be found through
2958: <a href=
2959: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2960: target=
2961: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2962: </div>
2963:
1.67 hubertf 2964: <div class="sect3" lang="en">
1.1 grant 2965: <div class="titlepage">
2966: <div>
2967: <div>
1.30 wiz 2968: <h4 class="title"><a name=
2969: "solaris-sun-workshop-note"></a>3.2.7.2. If
2970: you are using Sun WorkShop</h4>
1.1 grant 2971: </div>
2972: </div>
2973: </div>
2974:
2975: <p>You will need at least the following packages
2976: installed (from WorkShop 5.0)</p>
2977:
2978: <div class="itemizedlist">
2979: <ul type="disc">
2980: <li>
2981: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2982: </li>
2983:
2984: <li>
2985: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2986: </li>
2987:
2988: <li>
2989: <p>SPROild - Sun WorkShop Incremental
2990: Linker</p>
2991: </li>
2992:
2993: <li>
2994: <p>SPROlang - Sun WorkShop Compilers common
2995: components</p>
2996: </li>
2997: </ul>
2998: </div>
2999:
1.14 xtraeme 3000: <p>You should set <code class="varname">CC</code>,
3001: <code class="varname">CXX</code> and optionally,
1.45 wiz 3002: <code class="varname">CPP</code> in <code xmlns=
3003: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 3004: "filename">/etc/mk.conf</code>, e.g.:</p>
1.1 grant 3005: <pre class="programlisting">
1.51 rillig 3006: CC= cc
3007: CXX= CC
3008: CPP= /usr/ccs/lib/cpp
1.1 grant 3009: </pre>
1.70 rillig 3010: </div>
3011:
3012: <div class="sect3" lang="en">
3013: <div class="titlepage">
3014: <div>
3015: <div>
3016: <h4 class="title"><a name=
3017: "solaris-sunpro-64"></a>3.2.7.3. Buildling
3018: 64-bit binaries with SunPro</h4>
3019: </div>
3020: </div>
3021: </div>
1.1 grant 3022:
1.70 rillig 3023: <p>Building 64-bit binaries is a little trickier.
3024: First, you need to bootstrap pkgsrc in 64-bit mode.
3025: One problem here is that while building one of the
3026: programs in the bootstrap kit (<code xmlns=
3027: "http://www.w3.org/TR/xhtml1/transitional" class=
3028: "filename">bmake</code>), the <code class=
3029: "varname">CFLAGS</code> variable is not honored, even
3030: if it is set in the environment. To work around this
3031: bug, you can create a simple shell script called
3032: <code xmlns=
3033: "http://www.w3.org/TR/xhtml1/transitional" class=
3034: "filename">cc64</code> and put it somewhere in the
3035: <code class="varname">PATH</code>:</p>
3036: <pre class="programlisting">
3037: #! /bin/sh
3038: exec /opt/SUNWspro/bin/cc -xtarget=ultra -xarch=v9 ${1+"$@"}
3039: </pre>
3040:
3041: <p>Then, pass the definition for <code class=
3042: "varname">CC</code> in the environment of the
3043: <span><strong class=
3044: "command">bootstrap</strong></span> command:</p>
3045: <pre class="programlisting">
3046: <code class="prompt">$</code> <strong class=
3047: "userinput"><code>cd bootstrap</code></strong>
3048: <code class="prompt">$</code> <strong class=
3049: "userinput"><code>CC=cc64 ./bootstrap</code></strong>
3050: </pre>
3051:
3052: <p>After bootstrapping, there are two alternative
3053: ways, depending on whether you want to find bugs in
3054: packages or get your system ready quickly. If you
3055: just want a running system, add the following lines
3056: to your <code xmlns=
3057: "http://www.w3.org/TR/xhtml1/transitional" class=
3058: "filename">mk.conf</code> file:</p>
1.1 grant 3059: <pre class="programlisting">
1.70 rillig 3060: CC= cc64
3061: CXX= CC64
3062: PKGSRC_COMPILER= sunpro
1.1 grant 3063: </pre>
3064:
1.70 rillig 3065: <p>This way, all calls to the compiler will be
3066: intercepted by the above wrapper and therefore get
3067: the necessary ABI options automatically. (Don't
3068: forget to create the shell script <code xmlns=
1.45 wiz 3069: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 rillig 3070: "filename">CC64</code>, too.)</p>
3071:
3072: <p>To find packages that ignore the user-specified
3073: <code class="varname">CFLAGS</code> and <code class=
3074: "varname">CXXFLAGS</code>, add the following lines to
3075: your <code xmlns=
1.45 wiz 3076: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 rillig 3077: "filename">mk.conf</code> file:</p>
3078: <pre class="programlisting">
3079: CC= cc
3080: CXX= CC
3081: PKGSRC_COMPILER= sunpro
3082: CFLAGS= -xtarget=ultra -xarch=v9
3083: CXXFLAGS= -xtarget=ultra -xarch=v9
3084: LDFLAGS= -xtarget=ultra -xarch=v9
3085: </pre>
3086:
3087: <p>Packages that don't use the flags provided in the
3088: configuration file will try to build 32-bit binaries
3089: and fail during linking. Detecting this is useful to
3090: prevent bugs on other platforms where the error would
3091: not show up but pass silently.</p>
1.1 grant 3092: </div>
1.68 rillig 3093:
3094: <div class="sect3" lang="en">
3095: <div class="titlepage">
3096: <div>
3097: <div>
3098: <h4 class="title"><a name=
1.70 rillig 3099: "plat.sunos.problems"></a>3.2.7.4. Common
1.68 rillig 3100: problems</h4>
3101: </div>
3102: </div>
3103: </div>
3104:
3105: <p>Sometimes, when using <span><strong class=
3106: "command">libtool</strong></span>, <code xmlns=
3107: "http://www.w3.org/TR/xhtml1/transitional" class=
3108: "filename">/bin/ksh</code> crashes with a
3109: segmentation fault. The workaround is to use another
3110: shell for the configure scripts, for example by
3111: installing <a xmlns=
3112: "http://www.w3.org/TR/xhtml1/transitional" href=
3113: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/bash/README.html"
3114: target="_top"><code xmlns="" class=
3115: "filename">shells/bash</code></a> and adding the
1.69 rillig 3116: following lines to your <code xmlns=
1.68 rillig 3117: "http://www.w3.org/TR/xhtml1/transitional" class=
3118: "filename">mk.conf</code>:</p>
3119: <pre class="programlisting">
3120: CONFIG_SHELL= ${LOCALBASE}/bin/bash
1.69 rillig 3121: WRAPPER_SHELL= ${LOCALBASE}/bin/bash
1.68 rillig 3122: </pre>
1.71 wiz 3123:
3124: <p>Then, rebuild the <a xmlns=
3125: "http://www.w3.org/TR/xhtml1/transitional" href=
3126: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool-base/README.html"
3127: target="_top"><code xmlns="" class=
3128: "filename">devel/libtool-base</code></a> package.</p>
1.68 rillig 3129: </div>
1.1 grant 3130: </div>
3131: </div>
3132: </div>
3133:
1.67 hubertf 3134: <div class="chapter" lang="en">
1.1 grant 3135: <div class="titlepage">
3136: <div>
3137: <div>
1.67 hubertf 3138: <h2 class="title"><a name=
1.1 grant 3139: "using"></a>Chapter 4. Using pkgsrc</h2>
3140: </div>
3141: </div>
3142: </div>
3143:
3144: <div class="toc">
3145: <p><b>Table of Contents</b></p>
3146:
3147: <dl>
1.70 rillig 3148: <dt><span class="sect1"><a href="#using-pkg">4.1. Using
3149: binary packages</a></span></dt>
1.1 grant 3150:
3151: <dd>
3152: <dl>
1.30 wiz 3153: <dt><span class="sect2"><a href=
1.70 rillig 3154: "#finding-binary-packages">4.1.1. Finding binary
3155: packages</a></span></dt>
1.1 grant 3156:
1.30 wiz 3157: <dt><span class="sect2"><a href=
1.70 rillig 3158: "#installing-binary-packages">4.1.2. Installing
1.30 wiz 3159: binary packages</a></span></dt>
1.1 grant 3160:
1.30 wiz 3161: <dt><span class="sect2"><a href=
3162: "#a-word-of-warning">4.1.3. A word of
3163: warning</a></span></dt>
1.1 grant 3164: </dl>
3165: </dd>
3166:
1.30 wiz 3167: <dt><span class="sect1"><a href=
3168: "#building-packages-from-source">4.2. Building packages
3169: from source</a></span></dt>
1.1 grant 3170:
3171: <dd>
3172: <dl>
1.30 wiz 3173: <dt><span class="sect2"><a href=
3174: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 3175:
1.30 wiz 3176: <dt><span class="sect2"><a href=
3177: "#fetching-distfiles">4.2.2. Fetching
3178: distfiles</a></span></dt>
1.1 grant 3179:
1.30 wiz 3180: <dt><span class="sect2"><a href=
3181: "#how-to-build-and-install">4.2.3. How to build and
3182: install</a></span></dt>
1.1 grant 3183:
1.30 wiz 3184: <dt><span class="sect2"><a href=
3185: "#selecting-the-compiler">4.2.4. Selecting the
3186: compiler</a></span></dt>
1.1 grant 3187: </dl>
3188: </dd>
3189: </dl>
3190: </div>
3191:
1.70 rillig 3192: <p>Basically, there are two ways of using pkgsrc. The first
3193: is to only install the package tools and to use binary
3194: packages that someone else has prepared. This is the
3195: “<span class="quote">pkg</span>” in pkgsrc. The
3196: second way is to install the “<span class=
3197: "quote">src</span>” of pkgsrc, too. Then you are able
3198: to build your own packages, and you can still use binary
3199: packages from someone else.</p>
3200:
1.67 hubertf 3201: <div class="sect1" lang="en">
1.1 grant 3202: <div class="titlepage">
3203: <div>
3204: <div>
3205: <h2 class="title" style="clear: both"><a name=
1.70 rillig 3206: "using-pkg"></a>4.1. Using binary
1.1 grant 3207: packages</h2>
3208: </div>
3209: </div>
3210: </div>
3211:
1.70 rillig 3212: <p>To use binary packages, you need some tools to manage
3213: them. On NetBSD, these tools are already installed. On
3214: all other operating systems, you need to install them
3215: first. For the following platforms, prebuilt versions of
3216: the package tools are available and can simply be
3217: downloaded and unpacked in the <code xmlns=
3218: "http://www.w3.org/TR/xhtml1/transitional" class=
3219: "filename">/</code> directory:</p>
3220:
3221: <div class="informaltable">
3222: <a name="binary-bootstrap-kits"></a>
3223:
3224: <table border="1">
3225: <colgroup>
3226: <col />
3227: <col />
3228: </colgroup>
3229:
3230: <thead>
3231: <tr>
3232: <th>Platform</th>
3233:
3234: <th>URL</th>
3235: </tr>
3236: </thead>
3237:
3238: <tbody>
3239: <tr>
1.72 ! rillig 3240: <td>Solaris 9</td>
! 3241:
! 3242: <td><code xmlns=
! 3243: "http://www.w3.org/TR/xhtml1/transitional" class=
! 3244: "filename">ftp://ftp0.mh.bbc.co.uk/pub/pkgsrc/packages/bootstrap-pkgsrc/</code></td>
! 3245: </tr>
! 3246:
! 3247: <tr>
! 3248: <td>Solaris 10</td>
1.70 rillig 3249:
3250: <td><code xmlns=
3251: "http://www.w3.org/TR/xhtml1/transitional" class=
3252: "filename">http://public.enst.fr/pkgsrc/packages/bootstrap-pkgsrc/</code></td>
3253: </tr>
3254: </tbody>
3255: </table>
3256: </div>
3257:
3258: <p>These prebuilt package tools use <code xmlns=
3259: "http://www.w3.org/TR/xhtml1/transitional" class=
3260: "filename">/usr/pkg</code> for the base directory, and
3261: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3262: class="filename">/var/db/pkg</code> for the database of
3263: installed packages. If you cannot use these directories
3264: for whatever reasons (maybe because you're not root), you
3265: have to build the package tools yourself, which is
3266: explained in <a href="#bootstrapping-pkgsrc" title=
3267: "3.1. Bootstrapping pkgsrc">Section 3.1,
3268: “Bootstrapping pkgsrc”</a>.</p>
1.1 grant 3269:
1.67 hubertf 3270: <div class="sect2" lang="en">
1.1 grant 3271: <div class="titlepage">
3272: <div>
3273: <div>
1.30 wiz 3274: <h3 class="title"><a name=
1.70 rillig 3275: "finding-binary-packages"></a>4.1.1. Finding
3276: binary packages</h3>
1.1 grant 3277: </div>
3278: </div>
3279: </div>
3280:
1.70 rillig 3281: <p>To install binary packages, you first need to know
3282: from where to get them. You can get them on CD-ROMs,
3283: DVDs, or via FTP or HTTP.</p>
3284:
3285: <p>For NetBSD, the binary packages are made available
3286: on <code xmlns=
3287: "http://www.w3.org/TR/xhtml1/transitional" class=
3288: "filename">ftp.NetBSD.org</code> and its mirrors, in
3289: the directory <code xmlns=
1.45 wiz 3290: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 rillig 3291: "filename">/pub/NetBSD/packages/<em class=
3292: "replaceable"><code>OSVERSION</code></em>/<em class=
3293: "replaceable"><code>ARCH</code></em>/</code>. For
3294: <em class="replaceable"><code>OSVERSION</code></em>,
3295: you should insert the output of <span><strong class=
3296: "command">uname -r</strong></span>, and for <em class=
3297: "replaceable"><code>ARCH</code></em> the output of
3298: <span><strong class="command">uname
3299: -p</strong></span>.</p>
3300:
3301: <p>For some other platforms, binary packages can be
3302: found at the following locations:</p>
3303:
3304: <div class="informaltable">
3305: <a name="binary-packages"></a>
3306:
3307: <table border="1">
3308: <colgroup>
3309: <col />
3310: <col />
3311: </colgroup>
3312:
3313: <thead>
3314: <tr>
3315: <th>Platform</th>
3316:
3317: <th>URL</th>
3318: </tr>
3319: </thead>
3320:
3321: <tbody>
3322: <tr>
1.72 ! rillig 3323: <td>Solaris 9</td>
! 3324:
! 3325: <td><code xmlns=
! 3326: "http://www.w3.org/TR/xhtml1/transitional"
! 3327: class=
! 3328: "filename">ftp://ftp0.mh.bbc.co.uk/pub/pkgsrc/packages/</code></td>
! 3329: </tr>
! 3330:
! 3331: <tr>
! 3332: <td>Solaris 10</td>
1.70 rillig 3333:
3334: <td><code xmlns=
3335: "http://www.w3.org/TR/xhtml1/transitional"
3336: class=
3337: "filename">http://public.enst.fr/pkgsrc/packages/</code></td>
3338: </tr>
3339: </tbody>
3340: </table>
3341: </div>
3342:
1.72 ! rillig 3343: <p>Most of these directories contain the pkgsrc
! 3344: distribution for multiple platforms. Select the
! 3345: appropriate subdirectories, according to your machine
! 3346: architecture and operating system, until you find a
! 3347: directory called <code xmlns=
1.45 wiz 3348: "http://www.w3.org/TR/xhtml1/transitional" class=
1.72 ! rillig 3349: "filename">All</code>. This directory contains all the
! 3350: binary packages. Further, there are subdirectories for
1.70 rillig 3351: categories that contain symbolic links that point to
3352: the actual binary package in <code xmlns=
1.45 wiz 3353: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 rillig 3354: "filename">../All</code>. This directory layout is used
3355: for all package repositories, no matter if they are
3356: accessed via HTTP, FTP, NFS, CD-ROM, or the local
3357: filesystem.</p>
1.1 grant 3358: </div>
3359:
1.67 hubertf 3360: <div class="sect2" lang="en">
1.1 grant 3361: <div class="titlepage">
3362: <div>
3363: <div>
1.30 wiz 3364: <h3 class="title"><a name=
1.70 rillig 3365: "installing-binary-packages"></a>4.1.2. Installing
3366: binary packages</h3>
1.1 grant 3367: </div>
3368: </div>
3369: </div>
3370:
1.47 reed 3371: <p>If you have the files on a CD-ROM or downloaded them
1.23 wiz 3372: to your hard disk, you can install them with the
1.27 rillig 3373: following command (be sure to <span><strong class=
1.14 xtraeme 3374: "command">su</strong></span> to root first):</p>
1.1 grant 3375: <pre class="screen">
1.14 xtraeme 3376: <code class="prompt">#</code> <strong class=
3377: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 3378: </pre>
3379:
3380: <p>If you have FTP access and you don't want to
3381: download the packages via FTP prior to installation,
1.14 xtraeme 3382: you can do this automatically by giving
3383: <span><strong class="command">pkg_add</strong></span>
3384: an FTP URL:</p>
1.1 grant 3385: <pre class="screen">
1.14 xtraeme 3386: <code class="prompt">#</code> <strong class=
1.27 rillig 3387: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 3388: </pre>
3389:
1.27 rillig 3390: <p>Note that any prerequisite packages needed to run
3391: the package in question will be installed, too,
1.1 grant 3392: assuming they are present where you install from.</p>
3393:
1.23 wiz 3394: <p>To save some typing, you can set the <code class=
3395: "varname">PKG_PATH</code> environment variable to a
1.47 reed 3396: semicolon-separated list of paths (including remote
1.23 wiz 3397: URLs); trailing slashes are not allowed.</p>
3398:
1.45 wiz 3399: <p>Additionally to the <code xmlns=
3400: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 3401: "filename">All</code> directory there exists a
1.45 wiz 3402: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3403: class="filename">vulnerable</code> directory to which
3404: binary packages with known vulnerabilities are moved,
3405: since removing them could cause missing dependencies.
3406: To use these packages, add the <code xmlns=
3407: "http://www.w3.org/TR/xhtml1/transitional" class=
3408: "filename">vulnerable</code> directory to your
3409: <code class="varname">PKG_PATH</code>. However, you
3410: should run <a xmlns=
1.23 wiz 3411: "http://www.w3.org/TR/xhtml1/transitional" href=
3412: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 3413: target="_top"><code xmlns="" class=
3414: "filename">security/audit-packages</code></a>
1.47 reed 3415: regularly, especially after installing new packages,
3416: and verify that the vulnerabilities are acceptable for
3417: your configuration. An example <code class=
3418: "varname">PKG_PATH</code> would be: <code xmlns=
3419: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 3420: "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 3421: Please note that semicolon (';') is a shell
3422: meta-character, so you'll probably have to quote
3423: it.</p>
3424:
1.1 grant 3425: <p>After you've installed packages, be sure to have
1.45 wiz 3426: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3427: class="filename">/usr/pkg/bin</code> and <code xmlns=
3428: "http://www.w3.org/TR/xhtml1/transitional" class=
3429: "filename">/usr/pkg/sbin</code> in your <code class=
3430: "varname">PATH</code> so you can actually start the
3431: just installed program.</p>
1.1 grant 3432: </div>
3433:
1.67 hubertf 3434: <div class="sect2" lang="en">
1.1 grant 3435: <div class="titlepage">
3436: <div>
3437: <div>
1.67 hubertf 3438: <h3 class="title"><a name=
1.30 wiz 3439: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 3440: warning</h3>
3441: </div>
3442: </div>
3443: </div>
3444:
3445: <p>Please pay very careful attention to the warnings
3446: expressed in the <a href=
3447: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3448: <span class="citerefentry"><span class=
3449: "refentrytitle">pkg_add</span>(1)</span></a> manual
3450: page about the inherent dangers of installing binary
3451: packages which you did not create yourself, and the
3452: security holes that can be introduced onto your system
3453: by indiscriminate adding of such files.</p>
1.66 rillig 3454:
3455: <p>The same warning of course applies to every package
3456: you install from source when you haven't completely
3457: read and understood the source code of the package, the
3458: compiler that is used to build the package and all the
3459: other tools that are involved.</p>
1.1 grant 3460: </div>
3461: </div>
3462:
1.67 hubertf 3463: <div class="sect1" lang="en">
1.1 grant 3464: <div class="titlepage">
3465: <div>
3466: <div>
3467: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3468: "building-packages-from-source"></a>4.2. Building
1.1 grant 3469: packages from source</h2>
3470: </div>
3471: </div>
3472: </div>
3473:
3474: <p>This assumes that the package is already in pkgsrc. If
3475: it is not, see <a href="#developers-guide" title=
1.46 gdt 3476: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 3477: “The pkgsrc developer's guide”</a> for
3478: instructions how to create your own packages.</p>
1.1 grant 3479:
1.67 hubertf 3480: <div class="sect2" lang="en">
1.1 grant 3481: <div class="titlepage">
3482: <div>
3483: <div>
1.67 hubertf 3484: <h3 class="title"><a name=
1.30 wiz 3485: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 3486: </div>
3487: </div>
3488: </div>
3489:
3490: <p>To build packages from source on a NetBSD system the
3491: “<span class="quote">comp</span>” and the
3492: “<span class="quote">text</span>”
3493: distribution sets must be installed. If you want to
1.47 reed 3494: build X11-related packages the “<span class=
1.1 grant 3495: "quote">xbase</span>” and “<span class=
3496: "quote">xcomp</span>” distribution sets are
3497: required, too.</p>
3498: </div>
3499:
1.67 hubertf 3500: <div class="sect2" lang="en">
1.1 grant 3501: <div class="titlepage">
3502: <div>
3503: <div>
1.67 hubertf 3504: <h3 class="title"><a name=
3505: "fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 3506: distfiles</h3>
3507: </div>
3508: </div>
3509: </div>
3510:
1.27 rillig 3511: <p>The first step for building a package is downloading
3512: the distfiles (i.e. the unmodified source). If they
3513: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 3514: automatically.</p>
3515:
3516: <p>You can overwrite some of the major distribution
3517: sites to fit to sites that are close to your own. Have
1.45 wiz 3518: a look at <code xmlns=
3519: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3520: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 3521: some examples — in particular, look for the
1.14 xtraeme 3522: <code class="varname">MASTER_SORT</code>, <code class=
3523: "varname">MASTER_SORT_REGEX</code> and <code class=
3524: "varname">INET_COUNTRY</code> definitions. This may
3525: save some of your bandwidth and time.</p>
1.1 grant 3526:
3527: <p>You can change these settings either in your shell's
3528: environment, or, if you want to keep the settings, by
1.45 wiz 3529: editing the <code xmlns=
3530: "http://www.w3.org/TR/xhtml1/transitional" class=
3531: "filename">/etc/mk.conf</code> file, and adding the
3532: definitions there.</p>
1.1 grant 3533:
3534: <p>If you don't have a permanent Internet connection
3535: and you want to know which files to download,
1.14 xtraeme 3536: <span><strong class="command">make
3537: fetch-list</strong></span> will tell you what you'll
1.45 wiz 3538: need. Put these distfiles into <code xmlns=
3539: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3540: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 3541: </div>
3542:
1.67 hubertf 3543: <div class="sect2" lang="en">
1.1 grant 3544: <div class="titlepage">
3545: <div>
3546: <div>
1.30 wiz 3547: <h3 class="title"><a name=
3548: "how-to-build-and-install"></a>4.2.3. How to
3549: build and install</h3>
1.1 grant 3550: </div>
3551: </div>
3552: </div>
3553:
3554: <p>Assuming that the distfile has been fetched (see
3555: previous section), become root and change into the
1.47 reed 3556: relevant directory and run <span><strong class=
3557: "command">make</strong></span>.</p>
3558:
3559: <div class="note" style=
3560: "margin-left: 0.5in; margin-right: 0.5in;">
3561: <h3 class="title">Note</h3>
3562:
3563: <p>If using bootstrap or pkgsrc on a non-NetBSD
3564: system, use the pkgsrc <span><strong class=
3565: "command">bmake</strong></span> command instead of
3566: “<span class="quote">make</span>” in the
3567: examples in this guide.</p>
3568: </div>
3569:
3570: <p>For example, type</p>
1.1 grant 3571: <pre class="screen">
1.14 xtraeme 3572: <code class="prompt">%</code> <strong class=
3573: "userinput"><code>cd misc/figlet</code></strong>
3574: <code class="prompt">%</code> <strong class=
3575: "userinput"><code>make</code></strong>
1.1 grant 3576: </pre>
3577:
3578: <p>at the shell prompt to build the various components
3579: of the package, and</p>
3580: <pre class="screen">
1.14 xtraeme 3581: <code class="prompt">#</code> <strong class=
3582: "userinput"><code>make install</code></strong>
1.1 grant 3583: </pre>
3584:
3585: <p>to install the various components into the correct
3586: places on your system. Installing the package on your
3587: system requires you to be root. However, pkgsrc has a
3588: <span class="emphasis"><em>just-in-time-su</em></span>
3589: feature, which allows you to only become root for the
3590: actual installation step</p>
3591:
3592: <p>Taking the figlet utility as an example, we can
3593: install it on our system by building as shown in
3594: <a href="#logs" title=
1.67 hubertf 3595: "Appendix B. Build logs">Appendix B,
3596: <i>Build logs</i></a>.</p>
1.1 grant 3597:
3598: <p>The program is installed under the default root of
1.45 wiz 3599: the packages tree - <code xmlns=
3600: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3601: "filename">/usr/pkg</code>. Should this not conform to
3602: your tastes, set the <code class=
3603: "varname">LOCALBASE</code> variable in your
1.1 grant 3604: environment, and it will use that value as the root of
1.45 wiz 3605: your packages tree. So, to use <code xmlns=
3606: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3607: "filename">/usr/local</code>, set <code class=
3608: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 3609: environment. Please note that you should use a
3610: directory which is dedicated to packages and not shared
1.47 reed 3611: with other programs (i.e., do not try and use
1.14 xtraeme 3612: <code class="varname">LOCALBASE=/usr</code>). Also, you
3613: should not try to add any of your own files or
1.45 wiz 3614: directories (such as <code xmlns=
3615: "http://www.w3.org/TR/xhtml1/transitional" class=
3616: "filename">src/</code>, <code xmlns=
3617: "http://www.w3.org/TR/xhtml1/transitional" class=
3618: "filename">obj/</code>, or <code xmlns=
3619: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3620: "filename">pkgsrc/</code>) below the <code class=
3621: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 3622: possible conflicts between programs and other files
3623: installed by the package system and whatever else may
3624: have been installed there.</p>
3625:
1.45 wiz 3626: <p>Some packages look in <code xmlns=
3627: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3628: "filename">/etc/mk.conf</code> to alter some
1.1 grant 3629: configuration options at build time. Have a look at
1.45 wiz 3630: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3631: class="filename">pkgsrc/mk/defaults/mk.conf</code> to
3632: get an overview of what will be set there by default.
1.14 xtraeme 3633: Environment variables such as <code class=
1.45 wiz 3634: "varname">LOCALBASE</code> can be set in <code xmlns=
3635: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3636: "filename">/etc/mk.conf</code> to save having to
3637: remember to set them each time you want to use
3638: pkgsrc.</p>
1.1 grant 3639:
3640: <p>Occasionally, people want to “<span class=
3641: "quote">look under the covers</span>” to see what
3642: is going on when a package is building or being
3643: installed. This may be for debugging purposes, or out
3644: of simple curiosity. A number of utility values have
3645: been added to help with this.</p>
3646:
3647: <div class="orderedlist">
3648: <ol type="1">
3649: <li>
3650: <p>If you invoke the <a href=
3651: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3652: <span class="citerefentry"><span class=
3653: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 3654: with <code class=
3655: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
3656: amount of information will be displayed. For
3657: example,</p>
1.1 grant 3658: <pre class="screen">
1.14 xtraeme 3659: <strong class=
3660: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 3661: </pre>
3662:
3663: <p>will show all the commands that are invoked,
3664: up to and including the “<span class=
3665: "quote">patch</span>” stage.</p>
3666: </li>
3667:
3668: <li>
3669: <p>If you want to know the value of a certain
1.22 tv 3670: <a href=
3671: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3672: <span class="citerefentry"><span class=
3673: "refentrytitle">make</span>(1)</span></a>
3674: definition, then the <code class=
1.14 xtraeme 3675: "varname">VARNAME</code> definition should be
3676: used, in conjunction with the show-var target.
3677: e.g. to show the expansion of the <a href=
1.1 grant 3678: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3679: <span class="citerefentry"><span class=
3680: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 3681: variable <code class=
1.22 tv 3682: "varname">LOCALBASE</code>:</p>
1.1 grant 3683: <pre class="screen">
1.14 xtraeme 3684: <code class="prompt">%</code> <strong class=
3685: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 3686: /usr/pkg
1.14 xtraeme 3687: <code class="prompt">%</code>
1.1 grant 3688:
3689: </pre>
3690: </li>
3691: </ol>
3692: </div>
3693:
3694: <p>If you want to install a binary package that you've
3695: either created yourself (see next section), that you
3696: put into pkgsrc/packages manually or that is located on
1.8 wiz 3697: a remote FTP server, you can use the "bin-install"
1.1 grant 3698: target. This target will install a binary package - if
3699: available - via <a href=
3700: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3701: <span class="citerefentry"><span class=
3702: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 3703: <span><strong class="command">make
3704: package</strong></span>. The list of remote FTP sites
3705: searched is kept in the variable <code class=
3706: "varname">BINPKG_SITES</code>, which defaults to
3707: ftp.NetBSD.org. Any flags that should be added to
3708: <a href=
1.1 grant 3709: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3710: <span class="citerefentry"><span class=
3711: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 3712: into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45 wiz 3713: See <code xmlns=
3714: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3715: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
3716: details.</p>
1.1 grant 3717:
1.47 reed 3718: <p>A final word of warning: If you set up a system that
1.14 xtraeme 3719: has a non-standard setting for <code class=
3720: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 3721: any packages are installed, as you can not use several
3722: directories for the same purpose. Doing so will result
3723: in pkgsrc not being able to properly detect your
3724: installed packages, and fail miserably. Note also that
3725: precompiled binary packages are usually built with the
1.14 xtraeme 3726: default <code class="varname">LOCALBASE</code> of
1.45 wiz 3727: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3728: class="filename">/usr/pkg</code>, and that you should
3729: <span class="emphasis"><em>not</em></span> install any
3730: if you use a non-standard <code class=
1.14 xtraeme 3731: "varname">LOCALBASE</code>.</p>
1.1 grant 3732: </div>
3733:
1.67 hubertf 3734: <div class="sect2" lang="en">
1.1 grant 3735: <div class="titlepage">
3736: <div>
3737: <div>
1.30 wiz 3738: <h3 class="title"><a name=
3739: "selecting-the-compiler"></a>4.2.4. Selecting
3740: the compiler</h3>
1.1 grant 3741: </div>
3742: </div>
3743: </div>
3744:
3745: <p>By default, pkgsrc will use GCC to build packages.
3746: This may be overridden by setting the following
3747: variables in /etc/mk.conf:</p>
3748:
3749: <div class="variablelist">
3750: <dl>
1.14 xtraeme 3751: <dt><span class="term"><code class=
3752: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3753:
3754: <dd>
3755: <p>This is a list of values specifying the chain
3756: of compilers to invoke when building packages.
3757: Valid values are:</p>
3758:
3759: <div class="itemizedlist">
3760: <ul type="disc">
3761: <li>
1.14 xtraeme 3762: <p><code class="varname">distcc</code>:
1.1 grant 3763: distributed C/C++ (chainable)</p>
3764: </li>
3765:
3766: <li>
1.14 xtraeme 3767: <p><code class="varname">ccache</code>:
1.1 grant 3768: compiler cache (chainable)</p>
3769: </li>
3770:
3771: <li>
1.14 xtraeme 3772: <p><code class="varname">gcc</code>: GNU
3773: C/C++ Compiler</p>
1.1 grant 3774: </li>
3775:
3776: <li>
1.14 xtraeme 3777: <p><code class="varname">mipspro</code>:
1.1 grant 3778: Silicon Graphics, Inc. MIPSpro
3779: (n32/n64)</p>
3780: </li>
3781:
3782: <li>
1.14 xtraeme 3783: <p><code class="varname">mipspro</code>:
1.1 grant 3784: Silicon Graphics, Inc. MIPSpro (o32)</p>
3785: </li>
3786:
3787: <li>
1.64 kim 3788: <p><code class="varname">sunpro</code>: Sun
1.1 grant 3789: Microsystems, Inc. WorkShip/Forte/Sun ONE
3790: Studio</p>
3791: </li>
3792: </ul>
3793: </div>
3794:
3795: <p>The default is “<span class=
1.14 xtraeme 3796: "quote"><code class=
3797: "varname">gcc</code></span>”. You can use
3798: <code class="varname">ccache</code> and/or
3799: <code class="varname">distcc</code> with an
3800: appropriate <code class=
3801: "varname">PKGSRC_COMPILER</code> setting, e.g.
3802: “<span class="quote"><code class=
3803: "varname">ccache gcc</code></span>”. This
1.1 grant 3804: variable should always be terminated with a value
3805: for a real compiler.</p>
3806: </dd>
3807:
1.14 xtraeme 3808: <dt><span class="term"><code class=
3809: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3810:
3811: <dd>
3812: <p>This specifies the minimum version of GCC to
3813: use when building packages. If the system GCC
3814: doesn't satisfy this requirement, then pkgsrc
3815: will build and install one of the GCC packages to
3816: use instead.</p>
3817: </dd>
3818: </dl>
3819: </div>
3820: </div>
3821: </div>
3822: </div>
3823:
1.67 hubertf 3824: <div class="chapter" lang="en">
1.1 grant 3825: <div class="titlepage">
3826: <div>
3827: <div>
1.67 hubertf 3828: <h2 class="title"><a name=
1.38 dillo 3829: "configuring"></a>Chapter 5. Configuring
3830: pkgsrc</h2>
3831: </div>
3832: </div>
3833: </div>
3834:
3835: <div class="toc">
3836: <p><b>Table of Contents</b></p>
3837:
3838: <dl>
3839: <dt><span class="sect1"><a href=
1.45 wiz 3840: "#general-configuration">5.1. General
3841: configuration</a></span></dt>
3842:
3843: <dt><span class="sect1"><a href=
3844: "#variables-affecting-build">5.2. Variables affecting
3845: the build process</a></span></dt>
3846:
3847: <dt><span class="sect1"><a href=
3848: "#developer-advanced-settings">5.3. Developer/advanced
3849: settings</a></span></dt>
3850:
3851: <dt><span class="sect1"><a href=
3852: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 3853: Options</a></span></dt>
1.38 dillo 3854: </dl>
3855: </div>
3856:
1.67 hubertf 3857: <div class="sect1" lang="en">
1.38 dillo 3858: <div class="titlepage">
3859: <div>
3860: <div>
3861: <h2 class="title" style="clear: both"><a name=
1.45 wiz 3862: "general-configuration"></a>5.1. General
3863: configuration</h2>
3864: </div>
3865: </div>
3866: </div>
3867:
1.47 reed 3868: <p>In this section, you can find some variables that
3869: apply to all pkgsrc packages. The preferred method of
3870: setting these variables is by setting them in
3871: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3872: class="filename">/etc/mk.conf</code>.</p>
1.45 wiz 3873:
3874: <div class="itemizedlist">
3875: <ul type="disc">
3876: <li>
3877: <p><code class="varname">LOCALBASE</code>: Where
3878: packages will be installed. The default is
3879: <code xmlns=
3880: "http://www.w3.org/TR/xhtml1/transitional" class=
3881: "filename">/usr/pkg</code>. Do not mix binary
3882: packages with different <code class=
3883: "varname">LOCALBASE</code>s!</p>
3884: </li>
3885:
3886: <li>
3887: <p><code class="varname">CROSSBASE</code>: Where
3888: “<span class="quote">cross</span>”
3889: category packages will be installed. The default is
3890: <code xmlns=
3891: "http://www.w3.org/TR/xhtml1/transitional" class=
3892: "filename">${LOCALBASE}/cross</code>.</p>
3893: </li>
3894:
3895: <li>
3896: <p><code class="varname">X11BASE</code>: Where X11
3897: is installed on the system. The default is
3898: <code xmlns=
3899: "http://www.w3.org/TR/xhtml1/transitional" class=
3900: "filename">/usr/X11R6</code>.</p>
3901: </li>
3902:
3903: <li>
3904: <p><code class="varname">DISTDIR</code>: Where to
3905: store the downloaded copies of the original source
3906: distributions used for building pkgsrc packages.
3907: The default is <code xmlns=
3908: "http://www.w3.org/TR/xhtml1/transitional" class=
3909: "filename">${PKGSRCDIR}/distfiles</code>.</p>
3910: </li>
3911:
3912: <li>
3913: <p><code class=
3914: "varname">MASTER_SITE_OVERRIDE</code>: If set,
3915: override the packages' <code class=
3916: "varname">MASTER_SITES</code> with this value.</p>
3917: </li>
3918:
3919: <li>
3920: <p><code class="varname">MASTER_SITE_BACKUP</code>:
3921: Backup location(s) for distribution files and patch
3922: files if not found locally or in <code xmlns=
3923: "http://www.w3.org/TR/xhtml1/transitional" class=
3924: "filename">${MASTER_SITES}</code> or <code xmlns=
3925: "http://www.w3.org/TR/xhtml1/transitional" class=
3926: "filename">${PATCH_SITES}</code> respectively. The
3927: defaults are <code xmlns=
3928: "http://www.w3.org/TR/xhtml1/transitional" class=
3929: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
3930: and <code xmlns=
3931: "http://www.w3.org/TR/xhtml1/transitional" class=
3932: "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
3933: </li>
3934:
3935: <li>
3936: <p><code class="varname">BINPKG_SITES</code>: List
3937: of sites carrying binary pkgs.</p>
3938: </li>
3939: </ul>
3940: </div>
3941: </div>
3942:
1.67 hubertf 3943: <div class="sect1" lang="en">
1.45 wiz 3944: <div class="titlepage">
3945: <div>
3946: <div>
3947: <h2 class="title" style="clear: both"><a name=
3948: "variables-affecting-build"></a>5.2. Variables
3949: affecting the build process</h2>
3950: </div>
3951: </div>
3952: </div>
3953:
3954: <p>XXX</p>
3955:
3956: <div class="itemizedlist">
3957: <ul type="disc">
3958: <li>
3959: <p><code class="varname">PACKAGES</code>: The top
3960: level directory for the binary packages. The
3961: default is <code xmlns=
3962: "http://www.w3.org/TR/xhtml1/transitional" class=
3963: "filename">${PKGSRCDIR}/packages</code>.</p>
3964: </li>
3965:
3966: <li>
3967: <p><code class="varname">WRKOBJDIR</code>: The top
3968: level directory where, if defined, the separate
3969: working directories will get created, and
3970: symbolically linked to from <code xmlns=
3971: "http://www.w3.org/TR/xhtml1/transitional" class=
3972: "filename">${WRKDIR}</code> (see below). This is
3973: useful for building packages on several
3974: architectures, then <code xmlns=
3975: "http://www.w3.org/TR/xhtml1/transitional" class=
3976: "filename">${PKGSRCDIR}</code> can be NFS-mounted
3977: while <code xmlns=
3978: "http://www.w3.org/TR/xhtml1/transitional" class=
3979: "filename">${WRKOBJDIR}</code> is local to every
3980: architecture. (It should be noted that <code class=
3981: "varname">PKGSRCDIR</code> should not be set by the
3982: user — it is an internal definition which
3983: refers to the root of the pkgsrc tree. It is
3984: possible to have many pkgsrc tree instances.)</p>
3985: </li>
3986:
3987: <li>
3988: <p><code class="varname">LOCALPATCHES</code>:
3989: Directory for local patches that aren't part of
3990: pkgsrc. See <a href="#components.patches" title=
3991: "8.3. patches/*">Section 8.3,
3992: “patches/*”</a> for more information.
3993: <em class="replaceable"><code>rel</code></em> and
3994: <em class="replaceable"><code>arch</code></em> are
3995: replaced with OS release (“<span class=
3996: "quote">2.0</span>”, etc.) and architecture
3997: (“<span class="quote">mipsel</span>”,
3998: etc.).</p>
3999: </li>
4000:
4001: <li>
4002: <p><code class="varname">PKGMAKECONF</code>:
4003: Location of the <code xmlns=
4004: "http://www.w3.org/TR/xhtml1/transitional" class=
4005: "filename">mk.conf</code> file used by a package's
4006: BSD-style Makefile. If this is not set,
4007: <code class="varname">MAKECONF</code> is set to
4008: <code xmlns=
4009: "http://www.w3.org/TR/xhtml1/transitional" class=
4010: "filename">/dev/null</code> to avoid picking up
4011: settings used by builds in <code xmlns=
4012: "http://www.w3.org/TR/xhtml1/transitional" class=
4013: "filename">/usr/src</code>.</p>
4014: </li>
4015: </ul>
4016: </div>
4017: </div>
4018:
1.67 hubertf 4019: <div class="sect1" lang="en">
1.45 wiz 4020: <div class="titlepage">
4021: <div>
4022: <div>
4023: <h2 class="title" style="clear: both"><a name=
4024: "developer-advanced-settings"></a>5.3. Developer/advanced
4025: settings</h2>
4026: </div>
4027: </div>
4028: </div>
4029:
4030: <p>XXX</p>
4031:
4032: <div class="itemizedlist">
4033: <ul type="disc">
4034: <li>
4035: <p><code class="varname">PKG_DEVELOPER</code>: Run
4036: some sanity checks that package developers
4037: want:</p>
4038:
4039: <div class="itemizedlist">
4040: <ul type="circle">
4041: <li>
4042: <p>make sure patches apply with zero fuzz</p>
4043: </li>
4044:
4045: <li>
4046: <p>run check-shlibs to see that all binaries
4047: will find their shared libs.</p>
4048: </li>
4049: </ul>
4050: </div>
4051: </li>
4052:
4053: <li>
4054: <p><code class="varname">PKG_DEBUG_LEVEL</code>:
4055: The level of debugging output which is displayed
4056: whilst making and installing the package. The
4057: default value for this is 0, which will not display
4058: the commands as they are executed (normal, default,
4059: quiet operation); the value 1 will display all
4060: shell commands before their invocation, and the
4061: value 2 will display both the shell commands before
4062: their invocation, and their actual execution
4063: progress with <span><strong class="command">set
4064: -x</strong></span> will be displayed.</p>
4065: </li>
1.58 erh 4066:
4067: <li>
4068: <p><code class=
4069: "varname">ALLOW_VULNERABILITIES.<em class=
4070: "replaceable"><code>pkgbase</code></em></code>: A
4071: space separated list of vulnerability IDs that may
4072: be ignored when performing the automated security
4073: checks. These IDs are listed in the
4074: pkg-vulnerabilities file and are displayed by
4075: <span><strong class=
4076: "command">audit-packages</strong></span> when it
4077: finds a vulnerable package.</p>
4078: </li>
4079:
4080: <li>
4081: <p><code class=
4082: "varname">SKIP_AUDIT_PACKAGES</code>: If this is
4083: set to “<span class=
4084: "quote">yes</span>”, the automated security
4085: checks (which use the <a xmlns=
4086: "http://www.w3.org/TR/xhtml1/transitional" href=
4087: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
4088: target="_top"><code xmlns="" class=
4089: "filename">security/audit-packages</code></a>
4090: package) will be <span class=
4091: "strong"><strong>entirely</strong></span> skipped
4092: for <span class=
4093: "strong"><strong>all</strong></span> packages
4094: built. Normally you'll want to use
4095: ALLOW_VULNERABILITIES instead of this.</p>
4096: </li>
1.45 wiz 4097: </ul>
4098: </div>
4099: </div>
4100:
1.67 hubertf 4101: <div class="sect1" lang="en">
1.45 wiz 4102: <div class="titlepage">
4103: <div>
4104: <div>
4105: <h2 class="title" style="clear: both"><a name=
4106: "selecting-build-options"></a>5.4. Selecting
4107: Build Options</h2>
1.38 dillo 4108: </div>
4109: </div>
4110: </div>
4111:
4112: <p>Some packages have build time options, usually to
4113: select between different dependencies, enable optional
4114: support for big dependencies or enable experimental
4115: features.</p>
4116:
4117: <p>To see which options, if any, a package supports, and
4118: which options are mutually exclusive, run
4119: <span><strong class="command">make
4120: show-options</strong></span>, for example:</p>
4121: <pre class="programlisting">
1.51 rillig 4122: The following options are supported by this package:
1.70 rillig 4123: ssl Enable SSL support.
1.51 rillig 4124: Exactly one of the following gecko options is required:
1.70 rillig 4125: firefox Use firefox as gecko rendering engine.
4126: mozilla Use mozilla as gecko rendering engine.
1.51 rillig 4127: At most one of the following database options may be selected:
1.70 rillig 4128: mysql Enable support for MySQL database.
4129: pgsql Enable support for PostgreSQL database.
1.51 rillig 4130:
4131: These options are enabled by default: firefox
4132: These options are currently enabled: mozilla ssl
1.38 dillo 4133: </pre>
4134:
1.45 wiz 4135: <p>The following variables can be defined in <code xmlns=
4136: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 4137: "filename">/etc/mk.conf</code> to select which options to
4138: enable for a package: <code class=
4139: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
4140: to select or disable options for all packages that
4141: support them, and <code class=
4142: "varname">PKG_OPTIONS.<em class=
4143: "replaceable"><code>pkgbase</code></em></code>, which can
4144: be used to select or disable options specifically for
4145: package <em class=
4146: "replaceable"><code>pkgbase</code></em>. Options listed
4147: in these variables are selected, options preceded by
1.67 hubertf 4148: “<span class="quote">-</span>” are disabled.
4149: A few examples:</p>
4150: <pre class="screen">
4151: <code class="prompt">$</code> <span><strong class=
4152: "command">grep "PKG.*OPTION" /etc/mk.conf</strong></span>
1.68 rillig 4153: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1.67 hubertf 4154: PKG_OPTIONS.kdebase= debug -sasl
4155: PKG_OPTIONS.apache= suexec
4156: </pre>
1.38 dillo 4157:
1.39 dillo 4158: <p>The following settings are consulted in the order
4159: given, and the last setting that selects or disables an
4160: option is used:</p>
1.38 dillo 4161:
4162: <div class="orderedlist">
4163: <ol type="1">
4164: <li>
4165: <p>the default options as suggested by the package
4166: maintainer</p>
4167: </li>
4168:
4169: <li>
4170: <p>the options implied by the settings of legacy
4171: variables (see below)</p>
4172: </li>
4173:
4174: <li>
4175: <p><code class=
4176: "varname">PKG_DEFAULT_OPTIONS</code></p>
4177: </li>
4178:
4179: <li>
4180: <p><code class="varname">PKG_OPTIONS.<em class=
4181: "replaceable"><code>pkgbase</code></em></code></p>
4182: </li>
4183: </ol>
4184: </div>
4185:
4186: <p>For groups of mutually exclusive options, the last
4187: option selected is used, all others are automatically
4188: disabled. If an option of the group is explicitly
4189: disabled, the previously selected option, if any, is
4190: used. It is an error if no option from a required group
4191: of options is selected, and building the package will
4192: fail.</p>
4193:
4194: <p>Before the options framework was introduced, build
1.65 hubertf 4195: options were selected by setting a variable (often named
4196: <code class="varname">USE_<em class=
4197: "replaceable"><code>FOO</code></em></code>) in
1.45 wiz 4198: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4199: class="filename">/etc/mk.conf</code> for each option. To
4200: ease transition to the options framework for the user,
4201: these legacy variables are converted to the appropriate
1.65 hubertf 4202: options setting (<code class=
4203: "varname">PKG_OPTIONS.<em class=
4204: "replaceable"><code>pkgbase</code></em></code>)
4205: automatically. A warning is issued to prompt the user to
4206: update <code xmlns=
1.45 wiz 4207: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 4208: "filename">/etc/mk.conf</code> to use the options
1.65 hubertf 4209: framework directly. Support for the legacy variables will
4210: be removed eventually.</p>
1.38 dillo 4211: </div>
4212: </div>
4213:
1.67 hubertf 4214: <div class="chapter" lang="en">
1.38 dillo 4215: <div class="titlepage">
4216: <div>
4217: <div>
1.67 hubertf 4218: <h2 class="title"><a name=
1.38 dillo 4219: "binary"></a>Chapter 6. Creating binary
1.1 grant 4220: packages</h2>
4221: </div>
4222: </div>
4223: </div>
4224:
4225: <div class="toc">
4226: <p><b>Table of Contents</b></p>
4227:
4228: <dl>
1.30 wiz 4229: <dt><span class="sect1"><a href=
1.38 dillo 4230: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 4231: single binary package</a></span></dt>
1.1 grant 4232:
1.30 wiz 4233: <dt><span class="sect1"><a href=
1.38 dillo 4234: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 4235: Settings for creation of binary
4236: packages</a></span></dt>
4237:
1.38 dillo 4238: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 4239: a bulk build of all packages</a></span></dt>
4240:
4241: <dd>
4242: <dl>
4243: <dt><span class="sect2"><a href=
1.38 dillo 4244: "#binary.configuration">6.3.1.
1.1 grant 4245: Configuration</a></span></dt>
4246:
1.30 wiz 4247: <dt><span class="sect2"><a href=
1.38 dillo 4248: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 4249: environmental considerations</a></span></dt>
1.1 grant 4250:
1.38 dillo 4251: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 4252: Operation</a></span></dt>
4253:
1.30 wiz 4254: <dt><span class="sect2"><a href=
1.38 dillo 4255: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 4256:
1.30 wiz 4257: <dt><span class="sect2"><a href=
1.38 dillo 4258: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 4259: requirements</a></span></dt>
1.1 grant 4260:
1.30 wiz 4261: <dt><span class="sect2"><a href=
1.38 dillo 4262: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47 reed 4263: for chrooted builds</a></span></dt>
1.1 grant 4264:
1.30 wiz 4265: <dt><span class="sect2"><a href=
1.38 dillo 4266: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 4267: set of packages</a></span></dt>
1.13 hubertf 4268:
4269: <dt><span class="sect2"><a href=
1.38 dillo 4270: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 4271: build</a></span></dt>
1.1 grant 4272: </dl>
4273: </dd>
4274:
1.38 dillo 4275: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 4276: Creating a multiple CD-ROM packages
4277: collection</a></span></dt>
4278:
4279: <dd>
4280: <dl>
1.30 wiz 4281: <dt><span class="sect2"><a href=
1.38 dillo 4282: "#cdpack-example">6.4.1. Example of
1.30 wiz 4283: cdpack</a></span></dt>
1.1 grant 4284: </dl>
4285: </dd>
4286: </dl>
4287: </div>
4288:
1.67 hubertf 4289: <div class="sect1" lang="en">
1.1 grant 4290: <div class="titlepage">
4291: <div>
4292: <div>
4293: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4294: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 4295: a single binary package</h2>
1.1 grant 4296: </div>
4297: </div>
4298: </div>
4299:
4300: <p>Once you have built and installed a package, you can
4301: create a <span class="emphasis"><em>binary
4302: package</em></span> which can be installed on another
4303: system with <a href=
4304: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4305: <span class="citerefentry"><span class=
1.47 reed 4306: "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1 grant 4307: having to build the same package on a group of hosts and
4308: wasting CPU time. It also provides a simple means for
4309: others to install your package, should you distribute
4310: it.</p>
4311:
4312: <p>To create a binary package, change into the
1.14 xtraeme 4313: appropriate directory in pkgsrc, and run
4314: <span><strong class="command">make
4315: package</strong></span>:</p>
1.1 grant 4316: <pre class="screen">
1.14 xtraeme 4317: <code class="prompt">#</code> <strong class=
4318: "userinput"><code>cd misc/figlet</code></strong>
4319: <code class="prompt">#</code> <strong class=
4320: "userinput"><code>make package</code></strong>
1.1 grant 4321: </pre>
4322:
4323: <p>This will build and install your package (if not
4324: already done), and then build a binary package from what
1.14 xtraeme 4325: was installed. You can then use the <span><strong class=
4326: "command">pkg_*</strong></span> tools to manipulate it.
1.45 wiz 4327: Binary packages are created by default in <code xmlns=
4328: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4329: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 4330: gzipped tar file. See <a href="#logs.package" title=
1.67 hubertf 4331: "B.2. Packaging figlet">Section B.2,
1.1 grant 4332: “Packaging figlet”</a> for a continuation of
4333: the above <a xmlns=
4334: "http://www.w3.org/TR/xhtml1/transitional" href=
4335: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45 wiz 4336: target="_top"><code xmlns="" class=
4337: "filename">misc/figlet</code></a> example.</p>
1.1 grant 4338:
4339: <p>See <a href="#submit" title=
1.68 rillig 4340: "Chapter 18. Submitting and Committing">Chapter 18,
1.67 hubertf 4341: <i>Submitting and Committing</i></a> for information on
4342: how to submit such a binary package.</p>
1.1 grant 4343: </div>
4344:
1.67 hubertf 4345: <div class="sect1" lang="en">
1.1 grant 4346: <div class="titlepage">
4347: <div>
4348: <div>
4349: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4350: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 4351: for creation of binary packages</h2>
4352: </div>
4353: </div>
4354: </div>
4355:
4356: <p>See <a href="#build.helpful-targets" title=
1.56 rillig 4357: "14.16. Other helpful targets">Section 14.16,
1.1 grant 4358: “Other helpful targets”</a>.</p>
4359: </div>
4360:
1.67 hubertf 4361: <div class="sect1" lang="en">
1.1 grant 4362: <div class="titlepage">
4363: <div>
4364: <div>
4365: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 4366: "bulkbuild"></a>6.3. Doing a bulk build of all
4367: packages</h2>
1.1 grant 4368: </div>
4369: </div>
4370: </div>
4371:
4372: <p>If you want to get a full set of precompiled binary
4373: packages, this section describes how to get them. Beware
4374: that the bulk build will remove all currently installed
1.63 dillo 4375: packages from your system!</p>
4376:
4377: <p>Having an FTP server configured either on the machine
4378: doing the bulk builds or on a nearby NFS server can help
4379: to make the packages available to other machines that can
4380: then save time by installing only the binary packages.
4381: See <a href=
1.1 grant 4382: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
4383: <span class="citerefentry"><span class=
4384: "refentrytitle">ftpd</span>(8)</span></a> for more
4385: information. If you use a remote NFS server's storage, be
4386: sure to not actually compile on NFS storage, as this
4387: slows things down a lot.</p>
4388:
1.67 hubertf 4389: <div class="sect2" lang="en">
1.1 grant 4390: <div class="titlepage">
4391: <div>
4392: <div>
1.67 hubertf 4393: <h3 class="title"><a name=
1.38 dillo 4394: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 4395: </div>
4396: </div>
4397: </div>
4398:
1.67 hubertf 4399: <div class="sect3" lang="en">
1.1 grant 4400: <div class="titlepage">
4401: <div>
4402: <div>
1.63 dillo 4403: <h4 class="title"><a name=
4404: "binary.bulk.build.conf"></a>6.3.1.1. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4405: class="filename">build.conf</code></h4>
4406: </div>
4407: </div>
4408: </div>
4409:
4410: <p>The <code xmlns=
4411: "http://www.w3.org/TR/xhtml1/transitional" class=
4412: "filename">build.conf</code> file is the main
4413: configuration file for bulk builds. You can configure
4414: how your copy of pkgsrc is kept up to date, how the
4415: distfiles are downloaded, how the packages are built
4416: and how the report is generated. You can find an
4417: annotated example file in <code xmlns=
4418: "http://www.w3.org/TR/xhtml1/transitional" class=
4419: "filename">pkgsrc/mk/bulk/build.conf-example</code>.
4420: To use it, copy <code xmlns=
4421: "http://www.w3.org/TR/xhtml1/transitional" class=
4422: "filename">build.conf-example</code> to <code xmlns=
4423: "http://www.w3.org/TR/xhtml1/transitional" class=
4424: "filename">build.conf</code> and edit it, following
4425: the comments in that file.</p>
4426: </div>
4427:
1.67 hubertf 4428: <div class="sect3" lang="en">
1.63 dillo 4429: <div class="titlepage">
4430: <div>
4431: <div>
1.67 hubertf 4432: <h4 class="title"><a name=
1.63 dillo 4433: "binary.mk.conf"></a>6.3.1.2. /etc/mk.conf</h4>
1.1 grant 4434: </div>
4435: </div>
4436: </div>
4437:
1.45 wiz 4438: <p>You may want to set variables in <code xmlns=
4439: "http://www.w3.org/TR/xhtml1/transitional" class=
4440: "filename">/etc/mk.conf</code>. Look at <code xmlns=
4441: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4442: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 4443: details of the default settings. You will want to
1.14 xtraeme 4444: ensure that <code class=
4445: "varname">ACCEPTABLE_LICENSES</code> meet your local
4446: policy. As used in this example, <code class=
4447: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 4448: "emphasis"><em>all</em></span> licenses.</p>
4449: <pre class="programlisting">
1.51 rillig 4450: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
4451: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
4452: BSDSRCDIR= /usr/src
4453: BSDXSRCDIR= /usr/xsrc # for x11/xservers
4454: OBJHOSTNAME?= yes # use work.`hostname`
4455: FAILOVER_FETCH= yes # insist on the correct checksum
4456: PKG_DEVELOPER?= yes
4457: _ACCEPTABLE= yes
1.1 grant 4458: </pre>
4459:
1.63 dillo 4460: <p>Some options that are especially useful for bulk
4461: builds can be found at the top lines of the file
4462: <code xmlns=
4463: "http://www.w3.org/TR/xhtml1/transitional" class=
4464: "filename">mk/bulk/bsd.bulk-pkg.mk</code>. The most
4465: useful options of these are briefly described
4466: here.</p>
4467:
4468: <div class="itemizedlist">
4469: <ul type="disc">
4470: <li>
4471: <p>If you are on a slow machine, you may want
4472: to set <code class=
4473: "varname">USE_BULK_BROKEN_CHECK</code> to
4474: “<span class=
4475: "quote">no</span>”.</p>
4476: </li>
4477:
4478: <li>
4479: <p>If you are doing bulk builds from a
4480: read-only copy of pkgsrc, you have to set
4481: <code class="varname">BULKFILESDIR</code> to
4482: the directory where all log files are created.
4483: Otherwise the log files are created in the
4484: pkgsrc directory.</p>
4485: </li>
4486:
4487: <li>
4488: <p>Another important variable is <code class=
4489: "varname">BULK_PREREQ</code>, which is a list
4490: of packages that should be always available
4491: while building other packages.</p>
4492: </li>
4493: </ul>
1.1 grant 4494: </div>
1.68 rillig 4495:
4496: <p>Some other options are scattered in the pkgsrc
4497: infrastructure:</p>
4498:
4499: <div class="itemizedlist">
4500: <ul type="disc">
4501: <li>
1.69 rillig 4502: <p><code class=
4503: "varname">ALLOW_VULNERABLE_PACKAGES</code>
4504: should be set to <code class=
4505: "literal">yes</code>. The purpose of the bulk
4506: builds is creating binary packages, no matter
4507: if they are vulnerable or not. When uploading
4508: the packages to a public server, the vulnerable
4509: packages will be put into a directory of their
4510: own. Leaving this variable unset would prevent
4511: the bulk build system from even trying to build
4512: them, so possible building errors would not
4513: show up.</p>
4514: </li>
4515:
4516: <li>
1.68 rillig 4517: <p><code class="varname">CHECK_FILES</code>
4518: (<code xmlns=
4519: "http://www.w3.org/TR/xhtml1/transitional"
4520: class=
4521: "filename">pkgsrc/mk/bsd.pkg.check.mk</code>)
4522: can be set to “<span class=
4523: "quote">yes</span>” to check that the
4524: installed set of files matches the <code xmlns=
4525: "http://www.w3.org/TR/xhtml1/transitional"
4526: class="filename">PLIST</code>.</p>
4527: </li>
4528:
4529: <li>
4530: <p><code class=
4531: "varname">CHECK_INTERPRETER</code>
4532: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4533: class=
4534: "filename">pkgsrc/mk/bsd.pkg.check.mk</code>)
4535: can be set to “<span class=
4536: "quote">yes</span>” to check that the
4537: installed “<span class=
4538: "quote">#!</span>”-scripts will find
4539: their interpreter.</p>
4540: </li>
4541: </ul>
4542: </div>
1.1 grant 4543: </div>
4544:
1.67 hubertf 4545: <div class="sect3" lang="en">
1.1 grant 4546: <div class="titlepage">
4547: <div>
4548: <div>
1.67 hubertf 4549: <h4 class="title"><a name=
1.45 wiz 4550: "pre-build.local"></a>6.3.1.3. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4551: class="filename">pre-build.local</code></h4>
1.1 grant 4552: </div>
4553: </div>
4554: </div>
4555:
4556: <p>It is possible to configure the bulk build to
1.47 reed 4557: perform certain site-specific tasks at the end of the
1.45 wiz 4558: pre-build stage. If the file <code xmlns=
4559: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4560: "filename">pre-build.local</code> exists in
1.45 wiz 4561: <code xmlns=
4562: "http://www.w3.org/TR/xhtml1/transitional" class=
4563: "filename">/usr/pkgsrc/mk/bulk</code>, it will be
4564: executed (as a <a href=
1.24 wiz 4565: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
4566: <span class="citerefentry"><span class=
4567: "refentrytitle">sh</span>(1)</span></a> script) at
4568: the end of the usual pre-build stage. An example use
1.45 wiz 4569: of <code xmlns=
4570: "http://www.w3.org/TR/xhtml1/transitional" class=
4571: "filename">pre-build.local</code> is to have the
4572: line:</p>
1.1 grant 4573: <pre class="screen">
1.71 wiz 4574: echo "I do not have enough disk space to build this pig." \
4575: > misc/openoffice/$BROKENF
1.1 grant 4576: </pre>
4577:
4578: <p>to prevent the system from trying to build a
4579: particular package which requires nearly 3 GB of disk
4580: space.</p>
4581: </div>
4582: </div>
4583:
1.67 hubertf 4584: <div class="sect2" lang="en">
1.1 grant 4585: <div class="titlepage">
4586: <div>
4587: <div>
1.30 wiz 4588: <h3 class="title"><a name=
1.38 dillo 4589: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 4590: environmental considerations</h3>
1.1 grant 4591: </div>
4592: </div>
4593: </div>
4594:
1.45 wiz 4595: <p>As <code xmlns=
4596: "http://www.w3.org/TR/xhtml1/transitional" class=
4597: "filename">/usr/pkg</code> will be completely deleted
4598: at the start of bulk builds, make sure your login shell
4599: is placed somewhere else. Either drop it into
4600: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4601: class="filename">/usr/local/bin</code> (and adjust your
4602: login shell in the passwd file), or (re-)install it via
1.14 xtraeme 4603: <a href=
1.1 grant 4604: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4605: <span class="citerefentry"><span class=
4606: "refentrytitle">pkg_add</span>(1)</span></a> from
1.45 wiz 4607: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4608: class="filename">/etc/rc.local</code>, so you can login
4609: after a reboot (remember that your current process
4610: won't die if the package is removed, you just can't
4611: start any new instances of the shell any more). Also,
4612: if you use NetBSD earlier than 1.5, or you still want
4613: to use the pkgsrc version of ssh for some reason, be
4614: sure to install ssh before starting it from
4615: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4616: class="filename">rc.local</code>:</p>
1.1 grant 4617: <pre class="programlisting">
1.51 rillig 4618: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
4619: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
4620: /usr/pkg/etc/rc.d/sshd
4621: fi
1.1 grant 4622: </pre>
4623:
4624: <p>Not doing so will result in you being not able to
4625: log in via ssh after the bulk build is finished or if
4626: the machine gets rebooted or crashes. You have been
4627: warned! :)</p>
4628: </div>
4629:
1.67 hubertf 4630: <div class="sect2" lang="en">
1.1 grant 4631: <div class="titlepage">
4632: <div>
4633: <div>
1.67 hubertf 4634: <h3 class="title"><a name=
1.38 dillo 4635: "operation"></a>6.3.3. Operation</h3>
1.1 grant 4636: </div>
4637: </div>
4638: </div>
4639:
4640: <p>Make sure you don't need any of the packages still
4641: installed.</p>
4642:
4643: <div class="warning" style=
4644: "margin-left: 0.5in; margin-right: 0.5in;">
4645: <h3 class="title">Warning</h3>
4646:
4647: <p>During the bulk build, <span class=
4648: "emphasis"><em>all packages will be
4649: removed!</em></span></p>
4650: </div>
4651:
4652: <p>Be sure to remove all other things that might
4653: interfere with builds, like some libs installed in
1.45 wiz 4654: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4655: class="filename">/usr/local</code>, etc. then become
4656: root and type:</p>
1.1 grant 4657: <pre class="screen">
1.14 xtraeme 4658: <code class="prompt">#</code> <strong class=
4659: "userinput"><code>cd /usr/pkgsrc</code></strong>
4660: <code class="prompt">#</code> <strong class=
4661: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 4662: </pre>
4663:
4664: <p>If for some reason your last build didn't complete
4665: (power failure, system panic, ...), you can continue it
4666: by running:</p>
4667: <pre class="screen">
1.14 xtraeme 4668: <code class="prompt">#</code> <strong class=
4669: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 4670: </pre>
4671:
4672: <p>At the end of the bulk build, you will get a summary
4673: via mail, and find build logs in the directory
1.14 xtraeme 4674: specified by <code class="varname">FTP</code> in the
1.45 wiz 4675: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4676: class="filename">build.conf</code> file.</p>
1.1 grant 4677: </div>
4678:
1.67 hubertf 4679: <div class="sect2" lang="en">
1.1 grant 4680: <div class="titlepage">
4681: <div>
4682: <div>
1.67 hubertf 4683: <h3 class="title"><a name=
1.38 dillo 4684: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 4685: </div>
4686: </div>
4687: </div>
4688:
4689: <p>The bulk builds consist of three steps:</p>
4690:
4691: <div class="variablelist">
4692: <dl>
4693: <dt><span class="term">1. pre-build</span></dt>
4694:
4695: <dd>
4696: <p>The script updates your pkgsrc tree via
4697: (anon)cvs, then cleans out any broken distfiles,
4698: and removes all packages installed.</p>
4699: </dd>
4700:
4701: <dt><span class="term">2. the bulk
4702: build</span></dt>
4703:
4704: <dd>
4705: <p>This is basically “<span class=
4706: "quote">make bulk-package</span>” with an
4707: optimised order in which packages will be built.
4708: Packages that don't require other packages will
4709: be built first, and packages with many
4710: dependencies will be built later.</p>
4711: </dd>
4712:
4713: <dt><span class="term">3. post-build</span></dt>
4714:
4715: <dd>
4716: <p>Generates a report that's placed in the
1.45 wiz 4717: directory specified in the <code xmlns=
4718: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4719: "filename">build.conf</code> file named
1.45 wiz 4720: <code xmlns=
4721: "http://www.w3.org/TR/xhtml1/transitional" class=
4722: "filename">broken.html</code>, a short version of
4723: that report will also be mailed to the build's
4724: admin.</p>
1.1 grant 4725: </dd>
4726: </dl>
4727: </div>
4728:
4729: <p>During the build, a list of broken packages will be
1.45 wiz 4730: compiled in <code xmlns=
4731: "http://www.w3.org/TR/xhtml1/transitional" class=
4732: "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
4733: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4734: "filename">.../.broken.${MACHINE}</code> if
4735: <code class="varname">OBJMACHINE</code> is set),
4736: individual build logs of broken builds can be found in
4737: the package's directory. These files are used by the
4738: bulk-targets to mark broken builds to not waste time
4739: trying to rebuild them, and they can be used to debug
4740: these broken package builds later.</p>
1.1 grant 4741: </div>
4742:
1.67 hubertf 4743: <div class="sect2" lang="en">
1.1 grant 4744: <div class="titlepage">
4745: <div>
4746: <div>
1.30 wiz 4747: <h3 class="title"><a name=
1.38 dillo 4748: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 4749: space requirements</h3>
1.1 grant 4750: </div>
4751: </div>
4752: </div>
4753:
4754: <p>Currently, roughly the following requirements are
4755: valid for NetBSD 2.0/i386:</p>
4756:
4757: <div class="itemizedlist">
4758: <ul type="disc">
4759: <li>
4760: <p>10 GB - distfiles (NFS ok)</p>
4761: </li>
4762:
4763: <li>
4764: <p>8 GB - full set of all binaries (NFS ok)</p>
4765: </li>
4766:
4767: <li>
4768: <p>5 GB - temp space for compiling (local disk
4769: recommended)</p>
4770: </li>
4771: </ul>
4772: </div>
4773:
4774: <p>Note that all pkgs will be de-installed as soon as
4775: they are turned into a binary package, and that sources
4776: are removed, so there is no excessively huge demand to
4777: disk space. Afterwards, if the package is needed again,
4778: it will be installed via <a href=
4779: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4780: <span class="citerefentry"><span class=
4781: "refentrytitle">pkg_add</span>(1)</span></a> instead of
4782: building again, so there are no cycles wasted by
4783: recompiling.</p>
4784: </div>
4785:
1.67 hubertf 4786: <div class="sect2" lang="en">
1.1 grant 4787: <div class="titlepage">
4788: <div>
4789: <div>
1.67 hubertf 4790: <h3 class="title"><a name=
4791: "setting-up-a-sandbox"></a>6.3.6. Setting up
4792: a sandbox for chrooted builds</h3>
1.1 grant 4793: </div>
4794: </div>
4795: </div>
4796:
1.12 agc 4797: <p>If you don't want all the packages nuked from a
4798: machine (rendering it useless for anything but pkg
1.23 wiz 4799: compiling), there is the possibility of doing the
4800: package bulk build inside a chroot environment.</p>
1.12 agc 4801:
4802: <p>The first step is to set up a chroot sandbox, e.g.
1.45 wiz 4803: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4804: class="filename">/usr/sandbox</code>. This can be done
4805: by using null mounts, or manually.</p>
1.12 agc 4806:
1.45 wiz 4807: <p>There is a shell script called <code xmlns=
4808: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4809: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
4810: set up the sandbox environment using null mounts. It
1.45 wiz 4811: will also create a script called <code xmlns=
4812: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4813: "filename">sandbox</code> in the root of the sandbox
1.12 agc 4814: environment, which will allow the null mounts to be
1.14 xtraeme 4815: activated using the <span><strong class=
4816: "command">sandbox mount</strong></span> command and
4817: deactivated using the <span><strong class=
4818: "command">sandbox umount</strong></span> command.</p>
1.12 agc 4819:
4820: <p>To set up a sandbox environment by hand, after
4821: extracting all the sets from a NetBSD installation or
1.14 xtraeme 4822: doing a <span><strong class="command">make distribution
1.45 wiz 4823: DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
4824: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4825: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 4826: items are present and properly configured:</p>
1.1 grant 4827:
4828: <div class="procedure">
4829: <ol type="1">
4830: <li>
4831: <p>Kernel</p>
4832: <pre class="screen">
1.14 xtraeme 4833: <code class="prompt">#</code> <strong class=
4834: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 4835: </pre>
4836: </li>
4837:
4838: <li>
1.45 wiz 4839: <p><code xmlns=
4840: "http://www.w3.org/TR/xhtml1/transitional" class=
4841: "filename">/dev/*</code></p>
1.1 grant 4842: <pre class="screen">
1.14 xtraeme 4843: <code class="prompt">#</code> <strong class=
4844: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 4845: </pre>
4846: </li>
4847:
4848: <li>
1.45 wiz 4849: <p><code xmlns=
4850: "http://www.w3.org/TR/xhtml1/transitional" class=
4851: "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1 grant 4852: "http://www.w3.org/TR/xhtml1/transitional" href=
4853: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4854: target="_top"><code xmlns="" class=
4855: "filename">security/smtpd</code></a> and
4856: mail):</p>
1.1 grant 4857: <pre class="screen">
1.14 xtraeme 4858: <code class="prompt">#</code> <strong class=
4859: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 4860: </pre>
4861: </li>
4862:
4863: <li>
4864: <p>Working(!) mail config (hostname,
4865: sendmail.cf):</p>
4866: <pre class="screen">
1.14 xtraeme 4867: <code class="prompt">#</code> <strong class=
4868: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 4869: </pre>
4870: </li>
4871:
4872: <li>
1.45 wiz 4873: <p><code xmlns=
4874: "http://www.w3.org/TR/xhtml1/transitional" class=
4875: "filename">/etc/localtime</code> (for <a xmlns=
1.1 grant 4876: "http://www.w3.org/TR/xhtml1/transitional" href=
4877: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4878: target="_top"><code xmlns="" class=
4879: "filename">security/smtpd</code></a>):</p>
1.1 grant 4880: <pre class="screen">
1.14 xtraeme 4881: <code class="prompt">#</code> <strong class=
4882: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 4883: </pre>
4884: </li>
4885:
4886: <li>
1.45 wiz 4887: <p><code xmlns=
4888: "http://www.w3.org/TR/xhtml1/transitional" class=
1.71 wiz 4889: "filename">/usr/src</code> (system sources,
4890: e. g. for <a xmlns=
1.1 grant 4891: "http://www.w3.org/TR/xhtml1/transitional" href=
4892: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45 wiz 4893: target="_top"><code xmlns="" class=
1.71 wiz 4894: "filename">sysutils/aperture</code></a>):</p>
1.1 grant 4895: <pre class="screen">
1.14 xtraeme 4896: <code class="prompt">#</code> <strong class=
4897: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
4898: <code class="prompt">#</code> <strong class=
1.23 wiz 4899: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 4900: </pre>
4901: </li>
4902:
4903: <li>
1.45 wiz 4904: <p>Create <code xmlns=
4905: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4906: "filename">/var/db/pkg</code> (not part of
4907: default install):</p>
1.1 grant 4908: <pre class="screen">
1.14 xtraeme 4909: <code class="prompt">#</code> <strong class=
4910: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 4911: </pre>
4912: </li>
4913:
4914: <li>
1.45 wiz 4915: <p>Create <code xmlns=
4916: "http://www.w3.org/TR/xhtml1/transitional" class=
4917: "filename">/usr/pkg</code> (not part of default
4918: install):</p>
1.1 grant 4919: <pre class="screen">
1.14 xtraeme 4920: <code class="prompt">#</code> <strong class=
4921: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 4922: </pre>
4923: </li>
4924:
4925: <li>
1.45 wiz 4926: <p>Checkout pkgsrc via cvs into <code xmlns=
4927: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4928: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 4929: <pre class="screen">
1.14 xtraeme 4930: <code class="prompt">#</code> <strong class=
4931: "userinput"><code>cd /usr/sandbox/usr</code></strong>
4932: <code class="prompt">#</code> <strong class=
4933: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 4934: </pre>
4935:
4936: <p>Do not mount/link this to the copy of your
4937: pkgsrc tree you do development in, as this will
4938: likely cause problems!</p>
4939: </li>
4940:
4941: <li>
1.45 wiz 4942: <p>Make <code xmlns=
4943: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4944: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45 wiz 4945: and <code xmlns=
4946: "http://www.w3.org/TR/xhtml1/transitional" class=
4947: "filename">.../distfiles</code> point somewhere
4948: appropriate. NFS- and/or nullfs-mounts may come
4949: in handy!</p>
1.1 grant 4950: </li>
4951:
4952: <li>
1.45 wiz 4953: <p>Edit <code xmlns=
4954: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4955: "filename">/etc/mk.conf</code>, see <a href=
4956: "#binary.mk.conf" title=
1.63 dillo 4957: "6.3.1.2. /etc/mk.conf">Section 6.3.1.2,
1.1 grant 4958: “/etc/mk.conf”</a>.</p>
4959: </li>
4960:
4961: <li>
1.45 wiz 4962: <p>Adjust <code xmlns=
4963: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4964: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 4965: needs.</p>
4966: </li>
4967: </ol>
4968: </div>
4969:
1.47 reed 4970: <p>When the chroot sandbox is set up, you can start the
1.1 grant 4971: build with the following steps:</p>
4972: <pre class="screen">
1.14 xtraeme 4973: <code class="prompt">#</code> <strong class=
4974: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4975: <code class="prompt">#</code> <strong class=
4976: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 4977: </pre>
4978:
4979: <p>This will just jump inside the sandbox and start
4980: building. At the end of the build, mail will be sent
4981: with the results of the build. Created binary pkgs will
1.45 wiz 4982: be in <code xmlns=
4983: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4984: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 4985: (wherever that points/mounts to/from).</p>
4986: </div>
4987:
1.67 hubertf 4988: <div class="sect2" lang="en">
1.1 grant 4989: <div class="titlepage">
4990: <div>
4991: <div>
1.30 wiz 4992: <h3 class="title"><a name=
1.38 dillo 4993: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 4994: a partial set of packages</h3>
1.1 grant 4995: </div>
4996: </div>
4997: </div>
4998:
4999: <p>In addition to building a complete set of all
1.45 wiz 5000: packages in pkgsrc, the <code xmlns=
5001: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5002: "filename">pkgsrc/mk/bulk/build</code> script may be
5003: used to build a subset of the packages contained in
1.47 reed 5004: pkgsrc. By setting <code class=
1.45 wiz 5005: "varname">SPECIFIC_PKGS</code> in <code xmlns=
5006: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5007: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 5008:
5009: <div class="itemizedlist">
5010: <ul type="disc">
5011: <li>
5012: <p>SITE_SPECIFIC_PKGS</p>
5013: </li>
5014:
5015: <li>
5016: <p>HOST_SPECIFIC_PKGS</p>
5017: </li>
5018:
5019: <li>
5020: <p>GROUP_SPECIFIC_PKGS</p>
5021: </li>
5022:
5023: <li>
5024: <p>USER_SPECIFIC_PKGS</p>
5025: </li>
5026: </ul>
5027: </div>
5028:
5029: <p>will define the set of packages which should be
5030: built. The bulk build code will also include any
5031: packages which are needed as dependencies for the
5032: explicitly listed packages.</p>
5033:
5034: <p>One use of this is to do a bulk build with
1.14 xtraeme 5035: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 5036: sandbox periodically to have a complete set of the
5037: binary packages needed for your site available without
5038: the overhead of building extra packages that are not
5039: needed.</p>
5040: </div>
1.13 hubertf 5041:
1.67 hubertf 5042: <div class="sect2" lang="en">
1.13 hubertf 5043: <div class="titlepage">
5044: <div>
5045: <div>
1.67 hubertf 5046: <h3 class="title"><a name=
1.38 dillo 5047: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 5048: of a bulk build</h3>
5049: </div>
5050: </div>
5051: </div>
5052:
5053: <p>This section describes how pkgsrc developers can
5054: upload binary pkgs built by bulk builds to
5055: ftp.NetBSD.org.</p>
5056:
1.17 sketch 5057: <p>If you would like to automatically create checksum
5058: files for the binary packages you intend to upload,
5059: remember to set <code class="varname">MKSUMS=yes</code>
1.45 wiz 5060: in your <code xmlns=
5061: "http://www.w3.org/TR/xhtml1/transitional" class=
1.17 sketch 5062: "filename">mk/bulk/build.conf</code>.</p>
5063:
5064: <p>If you would like to PGP sign the checksum files
5065: (highly recommended!), remember to set <code class=
5066: "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45 wiz 5067: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5068: class="filename">mk/bulk/build.conf</code>. This will
5069: prompt you for your GPG password to sign the files
1.17 sketch 5070: before uploading everything.</p>
5071:
5072: <p>Then, make sure that you have <code class=
1.14 xtraeme 5073: "varname">RSYNC_DST</code> set properly in your
1.45 wiz 5074: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5075: class="filename">mk/bulk/build.conf</code> file, i.e.
5076: adjust it to something like one of the following:</p>
1.13 hubertf 5077: <pre class="screen">
1.68 rillig 5078: RSYNC_DST=ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
1.13 hubertf 5079: </pre>
5080:
1.47 reed 5081: <p>Please use appropriate values for "pkgsrc-200xQy",
1.13 hubertf 5082: "NetBSD-a.b.c" and "arch" here. If your login on
1.68 rillig 5083: ftp.NetBSD.org is different from your local login,
5084: write your login directly into the variable, e.g. my
5085: local account is "feyrer", but for my login "hubertf",
5086: I use:</p>
1.13 hubertf 5087: <pre class="screen">
5088: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
5089: </pre>
5090:
1.45 wiz 5091: <p>A separate <code xmlns=
5092: "http://www.w3.org/TR/xhtml1/transitional" class=
5093: "filename">upload</code> directory is used here to
5094: allow "closing" the directory during upload. To do so,
5095: run the following command on ftp.NetBSD.org next:</p>
1.13 hubertf 5096: <pre class="screen">
1.14 xtraeme 5097: nbftp% <strong class=
5098: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 5099: </pre>
5100:
1.45 wiz 5101: <p>Please note that <code xmlns=
5102: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5103: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 5104: appropriate for packages for the NetBSD operating
5105: system. Binary packages for other operating systems
1.45 wiz 5106: should go into <code xmlns=
5107: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5108: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 5109:
5110: <p>Before uploading the binary pkgs, ssh authentication
1.47 reed 5111: needs to be set up. This example shows how to set up
1.13 hubertf 5112: temporary keys for the root account <span class=
5113: "emphasis"><em>inside the sandbox</em></span> (assuming
5114: that no keys should be present there usually):</p>
5115: <pre class="screen">
1.14 xtraeme 5116: <code class="prompt">#</code> <strong class=
1.68 rillig 5117: "userinput"><code>chroot /usr/sandbox</code></strong>
1.14 xtraeme 5118: chroot-<code class="prompt">#</code> <strong class=
1.68 rillig 5119: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
1.14 xtraeme 5120: chroot-<code class="prompt">#</code> <strong class=
1.68 rillig 5121: "userinput"><code>ssh-keygen -t dsa</code></strong>
1.14 xtraeme 5122: chroot-<code class="prompt">#</code> <strong class=
5123: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 5124: </pre>
5125:
1.45 wiz 5126: <p>Now take the output of <code xmlns=
5127: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5128: "filename">id-dsa.pub</code> and append it to your
1.45 wiz 5129: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5130: class="filename">~/.ssh/authorized_keys</code> file on
5131: ftp.NetBSD.org. You can remove the key after the upload
5132: is done!</p>
1.13 hubertf 5133:
5134: <p>Next, test if your ssh connection really works:</p>
5135: <pre class="screen">
1.14 xtraeme 5136: chroot-<code class="prompt">#</code> <strong class=
5137: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 5138: </pre>
5139:
5140: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
5141:
5142: <p>Now after all this works, you can exit the sandbox
5143: and start the upload:</p>
5144: <pre class="screen">
1.14 xtraeme 5145: chroot-<code class="prompt">#</code> <strong class=
1.68 rillig 5146: "userinput"><code>exit</code></strong>
1.14 xtraeme 5147: <code class="prompt">#</code> <strong class=
1.68 rillig 5148: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
1.14 xtraeme 5149: <code class="prompt">#</code> <strong class=
5150: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 5151: </pre>
5152:
5153: <p>The upload process may take quite some time. Use
1.24 wiz 5154: <a href=
5155: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
5156: <span class="citerefentry"><span class=
5157: "refentrytitle">ls</span>(1)</span></a> or <a href=
5158: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
5159: <span class="citerefentry"><span class=
5160: "refentrytitle">du</span>(1)</span></a> on the FTP
5161: server to monitor progress of the upload. The upload
5162: script will take care of not uploading restricted
5163: packages and putting vulnerable packages into the
1.45 wiz 5164: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5165: class="filename">vulnerable</code> subdirectory.</p>
1.13 hubertf 5166:
5167: <p>After the upload has ended, first thing is to revoke
5168: ssh access:</p>
5169: <pre class="screen">
1.14 xtraeme 5170: nbftp% <strong class=
5171: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 5172: Gdd:x!
5173: </pre>
5174:
5175: <p>Use whatever is needed to remove the key you've
5176: entered before! Last, move the uploaded packages out of
1.45 wiz 5177: the <code xmlns=
5178: "http://www.w3.org/TR/xhtml1/transitional" class=
5179: "filename">upload</code> directory to have them
5180: accessible to everyone:</p>
1.13 hubertf 5181: <pre class="screen">
1.14 xtraeme 5182: nbftp% <strong class=
5183: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
5184: nbftp% <strong class=
5185: "userinput"><code>mv upload/* .</code></strong>
5186: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
5187: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 5188: </pre>
5189: </div>
1.1 grant 5190: </div>
5191:
1.67 hubertf 5192: <div class="sect1" lang="en">
1.1 grant 5193: <div class="titlepage">
5194: <div>
5195: <div>
5196: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5197: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 5198: CD-ROM packages collection</h2>
1.1 grant 5199: </div>
5200: </div>
5201: </div>
5202:
5203: <p>After your pkgsrc bulk-build has completed, you may
5204: wish to create a CD-ROM set of the resulting binary
5205: packages to assist in installing packages on other
5206: machines. The <a xmlns=
5207: "http://www.w3.org/TR/xhtml1/transitional" href=
5208: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45 wiz 5209: target="_top"><code xmlns="" class=
5210: "filename">pkgtools/cdpack</code></a> package provides a
1.20 ben 5211: simple tool for creating the ISO 9660 images.
5212: <span><strong class="command">cdpack</strong></span>
5213: arranges the packages on the CD-ROMs in a way that keeps
1.47 reed 5214: all the dependencies for a given package on the same CD
5215: as that package.</p>
1.1 grant 5216:
1.67 hubertf 5217: <div class="sect2" lang="en">
1.1 grant 5218: <div class="titlepage">
5219: <div>
5220: <div>
1.67 hubertf 5221: <h3 class="title"><a name=
1.38 dillo 5222: "cdpack-example"></a>6.4.1. Example of
1.1 grant 5223: cdpack</h3>
5224: </div>
5225: </div>
5226: </div>
5227:
5228: <p>Complete documentation for cdpack is found in the
1.47 reed 5229: cdpack(1) man page. The following short example assumes
1.45 wiz 5230: that the binary packages are left in <code xmlns=
5231: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5232: "filename">/usr/pkgsrc/packages/All</code> and that
1.45 wiz 5233: sufficient disk space exists in <code xmlns=
5234: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5235: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 5236: <pre class="screen">
1.14 xtraeme 5237: <code class="prompt">#</code> <strong class=
5238: "userinput"><code>mkdir /u2/images</code></strong>
5239: <code class="prompt">#</code> <strong class=
5240: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
5241: <code class="prompt">#</code> <strong class=
5242: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 5243: </pre>
5244:
5245: <p>If you wish to include a common set of files
1.45 wiz 5246: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5247: class="filename">COPYRIGHT</code>, <code xmlns=
5248: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5249: "filename">README</code>, etc.) on each CD in the
1.1 grant 5250: collection, then you need to create a directory which
5251: contains these files. e.g.</p>
5252: <pre class="screen">
1.14 xtraeme 5253: <code class="prompt">#</code> <strong class=
5254: "userinput"><code>mkdir /tmp/common</code></strong>
5255: <code class="prompt">#</code> <strong class=
5256: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
5257: <code class="prompt">#</code> <strong class=
5258: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
5259: <code class="prompt">#</code> <strong class=
5260: "userinput"><code>mkdir /tmp/common/bin</code></strong>
5261: <code class="prompt">#</code> <strong class=
5262: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
5263: <code class="prompt">#</code> <strong class=
5264: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
5265: <code class="prompt">#</code> <strong class=
5266: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 5267: </pre>
5268:
5269: <p>Now create the images:</p>
5270: <pre class="screen">
1.14 xtraeme 5271: <code class="prompt">#</code> <strong class=
5272: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 5273: </pre>
5274:
1.45 wiz 5275: <p>Each image will contain <code xmlns=
5276: "http://www.w3.org/TR/xhtml1/transitional" class=
5277: "filename">README</code>, <code xmlns=
5278: "http://www.w3.org/TR/xhtml1/transitional" class=
5279: "filename">COPYING</code>, and <code xmlns=
5280: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5281: "filename">bin/myscript</code> in their root
1.1 grant 5282: directories.</p>
5283: </div>
5284: </div>
5285: </div>
5286:
1.67 hubertf 5287: <div class="chapter" lang="en">
1.1 grant 5288: <div class="titlepage">
5289: <div>
5290: <div>
1.67 hubertf 5291: <h2 class="title"><a name=
1.38 dillo 5292: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 5293: Questions</h2>
5294: </div>
5295: </div>
5296: </div>
5297:
5298: <div class="toc">
5299: <p><b>Table of Contents</b></p>
5300:
5301: <dl>
1.30 wiz 5302: <dt><span class="sect1"><a href=
1.38 dillo 5303: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 5304: lists for pkg-related discussion?</a></span></dt>
1.1 grant 5305:
1.38 dillo 5306: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 5307: Where's the pkgviews documentation?</a></span></dt>
5308:
1.38 dillo 5309: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 5310: Utilities for package management
5311: (pkgtools)</a></span></dt>
5312:
1.38 dillo 5313: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 5314: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 5315:
1.30 wiz 5316: <dt><span class="sect1"><a href=
1.38 dillo 5317: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 5318: fetching distfiles?</a></span></dt>
1.14 xtraeme 5319:
1.30 wiz 5320: <dt><span class="sect1"><a href=
1.38 dillo 5321: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 5322: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 5323:
1.30 wiz 5324: <dt><span class="sect1"><a href=
1.38 dillo 5325: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 5326: from pkgsrc?</a></span></dt>
1.1 grant 5327:
1.30 wiz 5328: <dt><span class="sect1"><a href=
1.38 dillo 5329: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 5330: behind a firewall</a></span></dt>
1.1 grant 5331:
1.38 dillo 5332: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 5333: do I tell <span><strong class="command">make
5334: fetch</strong></span> to do passive
5335: FTP?</a></span></dt>
1.1 grant 5336:
1.30 wiz 5337: <dt><span class="sect1"><a href=
1.38 dillo 5338: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 5339: distfiles at once</a></span></dt>
1.1 grant 5340:
1.30 wiz 5341: <dt><span class="sect1"><a href=
1.38 dillo 5342: "#tmac.andoc-missing">7.11. What does
1.30 wiz 5343: “<span class="quote">Don't know how to make
1.14 xtraeme 5344: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 5345: mean?</a></span></dt>
5346:
1.30 wiz 5347: <dt><span class="sect1"><a href=
1.38 dillo 5348: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 5349: “<span class="quote">Could not find
1.14 xtraeme 5350: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 5351:
1.30 wiz 5352: <dt><span class="sect1"><a href=
1.38 dillo 5353: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 5354: pkgsrc</a></span></dt>
1.1 grant 5355:
1.38 dillo 5356: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 5357: do I change the location of configuration
5358: files?</a></span></dt>
1.1 grant 5359:
1.38 dillo 5360: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 5361: Automated security checks</a></span></dt>
5362: </dl>
5363: </div>
5364:
5365: <p>This section contains hints, tips & tricks on
5366: special things in pkgsrc that we didn't find a better place
5367: for in the previous chapters, and it contains items for
5368: both pkgsrc users and developers.</p>
5369:
1.67 hubertf 5370: <div class="sect1" lang="en">
1.1 grant 5371: <div class="titlepage">
5372: <div>
5373: <div>
5374: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5375: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 5376: mailing lists for pkg-related discussion?</h2>
1.1 grant 5377: </div>
5378: </div>
5379: </div>
5380:
1.18 xtraeme 5381: <p>The following mailing lists may be of interest to
5382: pkgsrc users:</p>
5383:
5384: <div class="itemizedlist">
5385: <ul type="disc">
5386: <li>
5387: <p><a href=
5388: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.71 wiz 5389: target="_top">pkgsrc-bugs</a>: All bug reports in
5390: category "pkg" sent with <a href=
5391: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
5392: <span class="citerefentry"><span class=
5393: "refentrytitle">send-pr</span>(1)</span></a> appear
5394: here. Please do not report your bugs here directly;
5395: use one of the other mailing lists. discussed.</p>
1.18 xtraeme 5396: </li>
5397:
5398: <li>
5399: <p><a href=
5400: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 5401: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 5402: results of pkgsrc bulk builds are sent and
1.34 wiz 5403: discussed.</p>
1.18 xtraeme 5404: </li>
5405:
5406: <li>
5407: <p><a href=
5408: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.71 wiz 5409: target="_top">pkgsrc-changes</a>: This list is for
5410: those who are interested in getting a commit
5411: message for every change committed to pkgsrc. It is
5412: also available in digest form, meaning one daily
5413: message containing all commit messages for changes
5414: to the package source tree in that 24 hour
5415: period.</p>
1.18 xtraeme 5416: </li>
5417:
5418: <li>
5419: <p><a href=
5420: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.71 wiz 5421: target="_top">pkgsrc-users</a>: This is a general
5422: purpose list for most issues regarding pkgsrc,
5423: regardless of platform, e.g. soliciting user help
5424: for pkgsrc configuration, unexpected build
5425: failures, using particular packages, upgrading
5426: pkgsrc installations, questions regarding the
5427: pkgsrc release branches, etc. General announcements
5428: or proposals for changes that impact the pkgsrc
5429: user community, e.g. major infrastructure changes,
5430: new features, package removals, etc., may also be
5431: posted.</p>
5432: </li>
5433:
5434: <li>
5435: <p><a href=
5436: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
5437: target="_top">tech-pkg</a>: This is a list for
5438: technical discussions related to pkgsrc
5439: development, e.g. soliciting feedback for changes
5440: to pkgsrc infrastructure, proposed new features,
5441: questions related to porting pkgsrc to a new
5442: platform, advice for maintaining a package, patches
5443: that affect many packages, help requests moved from
5444: pkgsrc-users when an infrastructure bug is found,
5445: etc.</p>
1.18 xtraeme 5446: </li>
5447: </ul>
5448: </div>
5449:
5450: <p>To subscribe, do:</p>
1.1 grant 5451: <pre class="programlisting">
1.51 rillig 5452: <code class="prompt">%</code> echo subscribe <em class=
1.18 xtraeme 5453: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 5454: </pre>
5455:
1.18 xtraeme 5456: <p>Archives for all these mailing lists are available
5457: from <a href="http://mail-index.NetBSD.org/" target=
5458: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 5459: </div>
5460:
1.67 hubertf 5461: <div class="sect1" lang="en">
1.1 grant 5462: <div class="titlepage">
5463: <div>
5464: <div>
5465: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5466: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 5467: documentation?</h2>
1.1 grant 5468: </div>
5469: </div>
5470: </div>
5471:
5472: <p>Pkgviews is tightly integrated with buildlink. You can
1.45 wiz 5473: find a pkgviews User's guide in <code xmlns=
5474: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5475: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 5476: </div>
5477:
1.67 hubertf 5478: <div class="sect1" lang="en">
1.1 grant 5479: <div class="titlepage">
5480: <div>
5481: <div>
5482: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5483: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 5484: management (pkgtools)</h2>
1.1 grant 5485: </div>
5486: </div>
5487: </div>
5488:
1.45 wiz 5489: <p>The <code xmlns=
5490: "http://www.w3.org/TR/xhtml1/transitional" class=
5491: "filename">pkgsrc/pkgtools</code> directory pkgtools
5492: contains a number of useful utilities for both users and
5493: developers of pkgsrc. This section attempts only to make
5494: the reader aware of the utilities and when they might be
5495: useful, and not to duplicate the documentation that comes
5496: with each package.</p>
1.1 grant 5497:
5498: <p>Utilities used by pkgsrc (automatically installed when
5499: needed):</p>
5500:
5501: <div class="itemizedlist">
5502: <ul type="disc">
5503: <li>
5504: <p><a xmlns=
5505: "http://www.w3.org/TR/xhtml1/transitional" href=
5506: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45 wiz 5507: target="_top"><code xmlns="" class=
5508: "filename">pkgtools/x11-links</code></a>: Symlinks
1.34 wiz 5509: for use by buildlink.</p>
1.1 grant 5510: </li>
5511: </ul>
5512: </div>
5513:
5514: <p>OS tool augmentation (automatically installed when
5515: needed):</p>
5516:
5517: <div class="itemizedlist">
5518: <ul type="disc">
5519: <li>
5520: <p><a xmlns=
5521: "http://www.w3.org/TR/xhtml1/transitional" href=
5522: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 wiz 5523: target="_top"><code xmlns="" class=
5524: "filename">pkgtools/digest</code></a>: Calculates
1.34 wiz 5525: various kinds of checksums (including SHA1).</p>
1.1 grant 5526: </li>
5527:
5528: <li>
5529: <p><a xmlns=
5530: "http://www.w3.org/TR/xhtml1/transitional" href=
5531: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45 wiz 5532: target="_top"><code xmlns="" class=
5533: "filename">pkgtools/libnbcompat</code></a>:
1.34 wiz 5534: Compatibility library for pkgsrc tools.</p>
1.1 grant 5535: </li>
5536:
5537: <li>
5538: <p><a xmlns=
5539: "http://www.w3.org/TR/xhtml1/transitional" href=
5540: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45 wiz 5541: target="_top"><code xmlns="" class=
5542: "filename">pkgtools/mtree</code></a>: Installed on
1.34 wiz 5543: non-BSD systems due to lack of native mtree.</p>
1.1 grant 5544: </li>
5545:
5546: <li>
5547: <p><a xmlns=
5548: "http://www.w3.org/TR/xhtml1/transitional" href=
5549: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5550: target="_top"><code xmlns="" class=
5551: "filename">pkgtools/pkg_install</code></a>:
5552: Up-to-date replacement for <code xmlns=
5553: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5554: "filename">/usr/sbin/pkg_install</code>, or for use
5555: on operating systems where pkg_install is not
5556: present.</p>
1.1 grant 5557: </li>
5558: </ul>
5559: </div>
5560:
5561: <p>Utilities used by pkgsrc (not automatically
5562: installed):</p>
5563:
5564: <div class="itemizedlist">
5565: <ul type="disc">
5566: <li>
5567: <p><a xmlns=
5568: "http://www.w3.org/TR/xhtml1/transitional" href=
5569: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45 wiz 5570: target="_top"><code xmlns="" class=
5571: "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20 ben 5572: binary package from an already-installed package.
1.34 wiz 5573: Used by <span><strong class="command">make
5574: replace</strong></span> to save the old
5575: package.</p>
1.1 grant 5576: </li>
5577:
5578: <li>
5579: <p><a xmlns=
5580: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 5581: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45 wiz 5582: target="_top"><code xmlns="" class=
5583: "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20 ben 5584: functionality to pkgsrc, allowing it to fetch
5585: distfiles from multiple locations. It currently
5586: supports the following methods: multiple CD-ROMs
5587: and network FTP/HTTP connections.</p>
1.5 hubertf 5588: </li>
5589:
5590: <li>
5591: <p><a xmlns=
5592: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5593: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 5594: target="_top"><code xmlns="" class=
5595: "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34 wiz 5596: packages someplace else (enabled by default).</p>
1.1 grant 5597: </li>
1.5 hubertf 5598:
5599: <li>
5600: <p><a xmlns=
5601: "http://www.w3.org/TR/xhtml1/transitional" href=
5602: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 5603: target="_top"><code xmlns="" class=
5604: "filename">devel/cpuflags</code></a>: Determine the
1.34 wiz 5605: best compiler flags to optimise code for your
1.20 ben 5606: current CPU and compiler.</p>
1.5 hubertf 5607: </li>
1.1 grant 5608: </ul>
5609: </div>
5610:
5611: <p>Utilities for keeping track of installed packages,
5612: being up to date, etc:</p>
5613:
5614: <div class="itemizedlist">
5615: <ul type="disc">
5616: <li>
5617: <p><a xmlns=
5618: "http://www.w3.org/TR/xhtml1/transitional" href=
5619: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45 wiz 5620: target="_top"><code xmlns="" class=
5621: "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27 rillig 5622: packages whose installed versions do not match the
1.34 wiz 5623: latest pkgsrc entries.</p>
1.1 grant 5624: </li>
5625:
5626: <li>
5627: <p><a xmlns=
5628: "http://www.w3.org/TR/xhtml1/transitional" href=
5629: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5630: target="_top"><code xmlns="" class=
5631: "filename">pkgtools/pkgdep</code></a>: Makes
1.20 ben 5632: dependency graphs of packages, to aid in choosing a
1.34 wiz 5633: strategy for updating.</p>
1.1 grant 5634: </li>
5635:
5636: <li>
5637: <p><a xmlns=
5638: "http://www.w3.org/TR/xhtml1/transitional" href=
5639: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45 wiz 5640: target="_top"><code xmlns="" class=
5641: "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27 rillig 5642: graphs from the output of <a xmlns=
5643: "http://www.w3.org/TR/xhtml1/transitional" href=
5644: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5645: target="_top"><code xmlns="" class=
5646: "filename">pkgtools/pkgdep</code></a> (uses
1.34 wiz 5647: graphviz).</p>
1.1 grant 5648: </li>
5649:
5650: <li>
5651: <p><a xmlns=
5652: "http://www.w3.org/TR/xhtml1/transitional" href=
5653: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 5654: target="_top"><code xmlns="" class=
5655: "filename">pkgtools/pkglint</code></a>: The
1.27 rillig 5656: pkglint(1) program checks a pkgsrc entry for
5657: errors, lintpkgsrc(1) does various checks on the
5658: complete pkgsrc system.</p>
1.1 grant 5659: </li>
5660:
5661: <li>
5662: <p><a xmlns=
5663: "http://www.w3.org/TR/xhtml1/transitional" href=
5664: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45 wiz 5665: target="_top"><code xmlns="" class=
5666: "filename">pkgtools/pkgsurvey</code></a>: Report
5667: what packages you have installed.</p>
1.1 grant 5668: </li>
5669: </ul>
5670: </div>
5671:
5672: <p>Utilities for people maintaining or creating
5673: individual packages:</p>
5674:
5675: <div class="itemizedlist">
5676: <ul type="disc">
5677: <li>
5678: <p><a xmlns=
5679: "http://www.w3.org/TR/xhtml1/transitional" href=
5680: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 5681: target="_top"><code xmlns="" class=
5682: "filename">pkgtools/pkgdiff</code></a>: Automate
1.20 ben 5683: making and maintaining patches for a package
1.34 wiz 5684: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 5685: </li>
5686:
5687: <li>
5688: <p><a xmlns=
5689: "http://www.w3.org/TR/xhtml1/transitional" href=
5690: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45 wiz 5691: target="_top"><code xmlns="" class=
5692: "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20 ben 5693: "http://www.w3.org/TR/xhtml1/transitional" href=
5694: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 5695: target="_top"><code xmlns="" class=
5696: "filename">pkgtools/url2pkg</code></a>: Aids in
1.34 wiz 5697: converting to pkgsrc.</p>
1.1 grant 5698: </li>
5699:
5700: <li>
5701: <p><a xmlns=
5702: "http://www.w3.org/TR/xhtml1/transitional" href=
5703: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45 wiz 5704: target="_top"><code xmlns="" class=
5705: "filename">pkgtools/gensolpkg</code></a>: Convert
1.34 wiz 5706: pkgsrc to a Solaris package.</p>
1.1 grant 5707: </li>
5708: </ul>
5709: </div>
5710:
1.47 reed 5711: <p>Utilities for people maintaining pkgsrc (or: more
1.1 grant 5712: obscure pkg utilities)</p>
5713:
5714: <div class="itemizedlist">
5715: <ul type="disc">
5716: <li>
5717: <p><a xmlns=
5718: "http://www.w3.org/TR/xhtml1/transitional" href=
5719: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45 wiz 5720: target="_top"><code xmlns="" class=
5721: "filename">pkgtools/pkg_comp</code></a>: Build
1.34 wiz 5722: packages in a chrooted area.</p>
1.1 grant 5723: </li>
5724:
5725: <li>
5726: <p><a xmlns=
5727: "http://www.w3.org/TR/xhtml1/transitional" href=
5728: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45 wiz 5729: target="_top"><code xmlns="" class=
5730: "filename">pkgtools/libkver</code></a>: Spoof
5731: kernel version for chrooted cross builds.</p>
1.1 grant 5732: </li>
5733: </ul>
5734: </div>
5735: </div>
5736:
1.67 hubertf 5737: <div class="sect1" lang="en">
1.1 grant 5738: <div class="titlepage">
5739: <div>
5740: <div>
5741: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5742: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 5743: as non-root</h2>
1.1 grant 5744: </div>
5745: </div>
5746: </div>
5747:
5748: <p>If you want to use pkgsrc as non-root user, you can
5749: set some variables to make pkgsrc work under these
1.33 jmmv 5750: conditions. At the very least, you need to set
5751: <code class="varname">UNPRIVILEGED</code> to
5752: “<span class="quote">yes</span>”; this will
5753: turn on unprivileged mode and set multiple related
5754: variables to allow installation of packages as
5755: non-root.</p>
5756:
5757: <p>In case the defaults are not enough, you may want to
5758: tune some other variables used. For example, if the
5759: automatic user/group detection leads to incorrect values
5760: (or not the ones you would like to use), you can change
5761: them by setting <code class=
5762: "varname">UNPRIVILEGED_USER</code> and <code class=
5763: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
5764:
5765: <p>As regards bootstrapping, please note that the
5766: <span><strong class="command">bootstrap</strong></span>
5767: script will ease non-root configuration when given the
5768: “<span class=
5769: "quote">--ignore-user-check</span>” flag, as it
5770: will choose and use multiple default directories under
1.45 wiz 5771: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5772: class="filename">~/pkg</code> as the installation
1.33 jmmv 5773: targets. These directories can be overriden by the
5774: “<span class="quote">--prefix</span>” flag
5775: provided by the script, as well as some others that allow
5776: finer tuning of the tree layout.</p>
1.14 xtraeme 5777: </div>
5778:
1.67 hubertf 5779: <div class="sect1" lang="en">
1.14 xtraeme 5780: <div class="titlepage">
5781: <div>
5782: <div>
5783: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5784: "resume-transfers"></a>7.5. How to resume
1.30 wiz 5785: transfers when fetching distfiles?</h2>
1.14 xtraeme 5786: </div>
5787: </div>
5788: </div>
5789:
1.47 reed 5790: <p>By default, resuming transfers in pkgsrc is disabled,
1.15 xtraeme 5791: but you can enable this feature by adding the option
5792: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45 wiz 5793: into <code xmlns=
5794: "http://www.w3.org/TR/xhtml1/transitional" class=
5795: "filename">/etc/mk.conf</code>. If, during a fetch step,
5796: an incomplete distfile is found, pkgsrc will try to
5797: resume it.</p>
1.15 xtraeme 5798:
5799: <p>You can also use a different program than the default
1.24 wiz 5800: <a href=
5801: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5802: <span class="citerefentry"><span class=
5803: "refentrytitle">ftp</span>(1)</span></a> by changing the
5804: <code class="varname">FETCH_CMD</code> variable. Don't
5805: forget to set <code class=
5806: "varname">FETCH_RESUME_ARGS</code> and <code class=
5807: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
5808: default values.</p>
1.14 xtraeme 5809:
1.45 wiz 5810: <p>For example, if you want to use <code xmlns=
5811: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5812: "filename">wget</code> to resume downloads, you'll have
5813: to use something like:</p>
5814: <pre class="programlisting">
1.51 rillig 5815: FETCH_CMD= wget
5816: FETCH_BEFORE_ARGS= --passive-ftp
5817: FETCH_RESUME_ARGS= -c
5818: FETCH_OUTPUT_ARGS= -O
1.14 xtraeme 5819: </pre>
1.1 grant 5820: </div>
5821:
1.67 hubertf 5822: <div class="sect1" lang="en">
1.1 grant 5823: <div class="titlepage">
5824: <div>
5825: <div>
5826: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5827: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 5828: install/use XFree86 from pkgsrc?</h2>
5829: </div>
5830: </div>
5831: </div>
5832:
5833: <p>If you want to use XFree86 from pkgsrc instead of your
1.45 wiz 5834: system's own X11 (<code xmlns=
5835: "http://www.w3.org/TR/xhtml1/transitional" class=
5836: "filename">/usr/X11R6</code>, <code xmlns=
5837: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5838: "filename">/usr/openwin</code>, ...), you will have to
1.45 wiz 5839: add the following line into <code xmlns=
5840: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5841: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5842: <pre class="programlisting">
1.51 rillig 5843: X11_TYPE=XFree86
1.1 grant 5844: </pre>
5845: </div>
5846:
1.67 hubertf 5847: <div class="sect1" lang="en">
1.1 grant 5848: <div class="titlepage">
5849: <div>
5850: <div>
5851: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5852: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 5853: install/use X.org from pkgsrc?</h2>
5854: </div>
5855: </div>
5856: </div>
5857:
5858: <p>If you want to use X.org from pkgsrc instead of your
1.45 wiz 5859: system's own X11 (<code xmlns=
5860: "http://www.w3.org/TR/xhtml1/transitional" class=
5861: "filename">/usr/X11R6</code>, <code xmlns=
5862: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5863: "filename">/usr/openwin</code>, ...) you will have to add
1.45 wiz 5864: the following line into <code xmlns=
5865: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5866: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5867: <pre class="programlisting">
1.51 rillig 5868: X11_TYPE=xorg
1.1 grant 5869: </pre>
1.70 rillig 5870:
5871: <div class="note" style=
5872: "margin-left: 0.5in; margin-right: 0.5in;">
5873: <h3 class="title">Note</h3>
5874:
5875: <p>The DragonFly operating system defaults to using
5876: this X.org X11 implementation from pkgsrc.</p>
5877: </div>
1.1 grant 5878: </div>
5879:
1.67 hubertf 5880: <div class="sect1" lang="en">
1.1 grant 5881: <div class="titlepage">
5882: <div>
5883: <div>
5884: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5885: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 5886: files from behind a firewall</h2>
1.1 grant 5887: </div>
5888: </div>
5889: </div>
5890:
5891: <p>If you are sitting behind a firewall which does not
5892: allow direct connections to Internet hosts (i.e.
5893: non-NAT), you may specify the relevant proxy hosts. This
5894: is done using an environment variable in the form of a
1.47 reed 5895: URL, e.g. in Amdahl, the machine “<span class=
1.1 grant 5896: "quote">orpheus.amdahl.com</span>” is one of the
5897: firewalls, and it uses port 80 as the proxy port number.
5898: So the proxy environment variables are:</p>
5899: <pre class="programlisting">
1.51 rillig 5900: ftp_proxy=ftp://orpheus.amdahl.com:80/
5901: http_proxy=http://orpheus.amdahl.com:80/
1.1 grant 5902: </pre>
5903: </div>
5904:
1.67 hubertf 5905: <div class="sect1" lang="en">
1.1 grant 5906: <div class="titlepage">
5907: <div>
5908: <div>
5909: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 5910: "passive-ftp"></a>7.9. How do I tell
5911: <span><strong class="command">make
1.14 xtraeme 5912: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 5913: </div>
5914: </div>
5915: </div>
5916:
5917: <p>This depends on which utility is used to retrieve
1.45 wiz 5918: distfiles. From <code xmlns=
5919: "http://www.w3.org/TR/xhtml1/transitional" class=
5920: "filename">bsd.pkg.mk</code>, <code class=
5921: "varname">FETCH_CMD</code> is assigned the first
5922: available command from the following list:</p>
1.34 wiz 5923:
5924: <div class="itemizedlist">
5925: <ul type="disc">
5926: <li>
1.45 wiz 5927: <p><code xmlns=
5928: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5929: "filename">${LOCALBASE}/bin/ftp</code></p>
5930: </li>
5931:
5932: <li>
1.45 wiz 5933: <p><code xmlns=
5934: "http://www.w3.org/TR/xhtml1/transitional" class=
5935: "filename">/usr/bin/ftp</code></p>
1.34 wiz 5936: </li>
5937: </ul>
5938: </div>
1.1 grant 5939:
5940: <p>On a default NetBSD installation, this will be
1.45 wiz 5941: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5942: class="filename">/usr/bin/ftp</code>, which automatically
5943: tries passive connections first, and falls back to active
5944: connections if the server refuses to do passive. For the
5945: other tools, add the following to your <code xmlns=
5946: "http://www.w3.org/TR/xhtml1/transitional" class=
5947: "filename">/etc/mk.conf</code> file: <code class=
5948: "varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 5949:
1.45 wiz 5950: <p>Having that option present will prevent <code xmlns=
5951: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5952: "filename">/usr/bin/ftp</code> from falling back to
5953: active transfers.</p>
1.1 grant 5954: </div>
5955:
1.67 hubertf 5956: <div class="sect1" lang="en">
1.1 grant 5957: <div class="titlepage">
5958: <div>
5959: <div>
5960: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5961: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 5962: fetch all distfiles at once</h2>
5963: </div>
5964: </div>
5965: </div>
5966:
5967: <p>You would like to download all the distfiles in a
5968: single batch from work or university, where you can't run
1.14 xtraeme 5969: a <span><strong class="command">make
5970: fetch</strong></span>. There is an archive of distfiles
5971: on <a href=
1.1 grant 5972: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
5973: target="_top">ftp.NetBSD.org</a>, but downloading the
5974: entire directory may not be appropriate.</p>
5975:
1.14 xtraeme 5976: <p>The answer here is to do a <span><strong class=
1.45 wiz 5977: "command">make fetch-list</strong></span> in <code xmlns=
5978: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 5979: "filename">/usr/pkgsrc</code> or one of its
1.1 grant 5980: subdirectories, carry the resulting list to your machine
1.23 wiz 5981: at work/school and use it there. If you don't have a
1.24 wiz 5982: NetBSD-compatible <a href=
5983: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5984: <span class="citerefentry"><span class=
1.72 ! rillig 5985: "refentrytitle">ftp</span>(1)</span></a> (like tnftp) at
! 5986: work, don't forget to set <code class=
1.24 wiz 5987: "varname">FETCH_CMD</code> to something that fetches a
5988: URL:</p>
1.1 grant 5989:
5990: <p>At home:</p>
5991: <pre class="screen">
1.14 xtraeme 5992: <code class="prompt">%</code> <strong class=
5993: "userinput"><code>cd /usr/pkgsrc</code></strong>
5994: <code class="prompt">%</code> <strong class=
5995: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
5996: <code class="prompt">%</code> <strong class=
5997: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 5998: </pre>
5999:
6000: <p>At work:</p>
6001: <pre class="screen">
1.14 xtraeme 6002: <code class="prompt">%</code> <strong class=
6003: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 6004: </pre>
6005:
1.45 wiz 6006: <p>then tar up <code xmlns=
6007: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6008: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 6009:
6010: <p>If you have a machine running NetBSD, and you want to
6011: get <span class="emphasis"><em>all</em></span> distfiles
6012: (even ones that aren't for your machine architecture),
6013: you can do so by using the above-mentioned
1.14 xtraeme 6014: <span><strong class="command">make
6015: fetch-list</strong></span> approach, or fetch the
6016: distfiles directly by running:</p>
1.1 grant 6017: <pre class="screen">
1.14 xtraeme 6018: <code class="prompt">%</code> <strong class=
6019: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 6020: </pre>
6021:
1.14 xtraeme 6022: <p>If you even decide to ignore <code class=
6023: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
6024: can get everything by running:</p>
1.1 grant 6025: <pre class="screen">
1.14 xtraeme 6026: <code class="prompt">%</code> <strong class=
6027: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 6028: </pre>
6029: </div>
6030:
1.67 hubertf 6031: <div class="sect1" lang="en">
1.1 grant 6032: <div class="titlepage">
6033: <div>
6034: <div>
6035: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6036: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 6037: “<span class="quote">Don't know how to make
6038: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
6039: </div>
6040: </div>
6041: </div>
6042:
6043: <p>When compiling the <a xmlns=
6044: "http://www.w3.org/TR/xhtml1/transitional" href=
6045: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 6046: target="_top"><code xmlns="" class=
6047: "filename">pkgtools/pkg_install</code></a> package, you
6048: get the error from make that it doesn't know how to make
6049: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6050: class="filename">/usr/share/tmac/tmac.andoc</code>? This
6051: indicates that you don't have installed the
1.23 wiz 6052: “<span class="quote">text</span>” set (nroff,
6053: ...) from the NetBSD base distribution on your machine.
1.47 reed 6054: It is recommended to do that to format man pages.</p>
1.1 grant 6055:
6056: <p>In the case of the <a xmlns=
6057: "http://www.w3.org/TR/xhtml1/transitional" href=
6058: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 6059: target="_top"><code xmlns="" class=
6060: "filename">pkgtools/pkg_install</code></a> package, you
6061: can get away with setting <code class=
1.20 ben 6062: "varname">NOMAN=YES</code> either in the environment or
1.45 wiz 6063: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6064: class="filename">/etc/mk.conf</code>.</p>
1.1 grant 6065: </div>
6066:
1.67 hubertf 6067: <div class="sect1" lang="en">
1.1 grant 6068: <div class="titlepage">
6069: <div>
6070: <div>
6071: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6072: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 6073: “<span class="quote">Could not find
6074: bsd.own.mk</span>” mean?</h2>
6075: </div>
6076: </div>
6077: </div>
6078:
1.45 wiz 6079: <p>You didn't install the compiler set, <code xmlns=
6080: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6081: "filename">comp.tgz</code>, when you installed your
1.47 reed 6082: NetBSD machine. Please get and install it, by extracting
6083: it in <code xmlns=
1.45 wiz 6084: "http://www.w3.org/TR/xhtml1/transitional" class=
6085: "filename">/</code>:</p>
1.1 grant 6086: <pre class="screen">
1.14 xtraeme 6087: <code class="prompt">#</code> <strong class=
6088: "userinput"><code>cd /</code></strong>
6089: <code class="prompt">#</code> <strong class=
6090: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 6091: </pre>
6092:
1.45 wiz 6093: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6094: class="filename">comp.tgz</code> is part of every NetBSD
6095: release. Get the one that corresponds to your release
6096: (determine via <span><strong class="command">uname
6097: -r</strong></span>).</p>
1.1 grant 6098: </div>
6099:
1.67 hubertf 6100: <div class="sect1" lang="en">
1.1 grant 6101: <div class="titlepage">
6102: <div>
6103: <div>
6104: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6105: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 6106: 'sudo' with pkgsrc</h2>
6107: </div>
6108: </div>
6109: </div>
6110:
6111: <p>When installing packages as non-root user and using
1.24 wiz 6112: the just-in-time <a href=
6113: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
6114: <span class="citerefentry"><span class=
6115: "refentrytitle">su</span>(1)</span></a> feature of
6116: pkgsrc, it can become annoying to type in the root
6117: password for each required package installed. To avoid
6118: this, the sudo package can be used, which does password
6119: caching over a limited time. To use it, install sudo
6120: (either as binary package or from <a xmlns=
6121: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 6122: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45 wiz 6123: target="_top"><code xmlns="" class=
6124: "filename">security/sudo</code></a>) and then put the
6125: following into your <code xmlns=
6126: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 6127: "filename">/etc/mk.conf</code>:</p>
1.1 grant 6128: <pre class="programlisting">
1.51 rillig 6129: .if exists(${LOCALBASE}/bin/sudo)
6130: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
6131: .endif
1.1 grant 6132: </pre>
6133: </div>
6134:
1.67 hubertf 6135: <div class="sect1" lang="en">
1.1 grant 6136: <div class="titlepage">
6137: <div>
6138: <div>
6139: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 6140: "faq.conf"></a>7.14. How do I change the
6141: location of configuration files?</h2>
1.1 grant 6142: </div>
6143: </div>
6144: </div>
6145:
1.35 jmmv 6146: <p>As the system administrator, you can choose where
6147: configuration files are installed. The default settings
1.45 wiz 6148: make all these files go into <code xmlns=
6149: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 6150: "filename">${PREFIX}/etc</code> or some of its
6151: subdirectories; this may be suboptimal depending on your
6152: expectations (e.g., a read-only, NFS-exported
6153: <code class="varname">PREFIX</code> with a need of
6154: per-machine configuration of the provided packages).</p>
6155:
6156: <p>In order to change the defaults, you can modify the
6157: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45 wiz 6158: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6159: class="filename">/etc/mk.conf</code>) to point to your
6160: preferred configuration directory; some common examples
6161: include <code xmlns=
6162: "http://www.w3.org/TR/xhtml1/transitional" class=
6163: "filename">/etc</code> or <code xmlns=
6164: "http://www.w3.org/TR/xhtml1/transitional" class=
6165: "filename">/etc/pkg</code>.</p>
1.35 jmmv 6166:
6167: <p>Furthermore, you can change this value on a
6168: per-package basis by setting the <code class=
6169: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
6170: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
6171: value usually matches the name of the package you would
6172: like to modify, that is, the contents of <code class=
6173: "varname">PKGBASE</code>.</p>
1.1 grant 6174:
1.47 reed 6175: <p>Note that after changing these settings, you must
1.35 jmmv 6176: rebuild and reinstall any affected packages.</p>
1.1 grant 6177: </div>
6178:
1.67 hubertf 6179: <div class="sect1" lang="en">
1.1 grant 6180: <div class="titlepage">
6181: <div>
6182: <div>
6183: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6184: "audit-packages"></a>7.15. Automated security
1.1 grant 6185: checks</h2>
6186: </div>
6187: </div>
6188: </div>
6189:
6190: <p>Please be aware that there can often be bugs in
6191: third-party software, and some of these bugs can leave a
6192: machine vulnerable to exploitation by attackers. In an
6193: effort to lessen the exposure, the NetBSD packages team
6194: maintains a database of known-exploits to packages which
6195: have at one time been included in pkgsrc. The database
6196: can be downloaded automatically, and a security audit of
6197: all packages installed on a system can take place. To do
6198: this, install the <a xmlns=
6199: "http://www.w3.org/TR/xhtml1/transitional" href=
6200: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 6201: target="_top"><code xmlns="" class=
6202: "filename">security/audit-packages</code></a> package. It
1.20 ben 6203: has two components:</p>
1.1 grant 6204:
6205: <div class="orderedlist">
6206: <ol type="1">
6207: <li>
1.34 wiz 6208: <p><span><strong class=
6209: "command">download-vulnerability-list</strong></span>,
1.1 grant 6210: an easy way to download a list of the security
6211: vulnerabilities information. This list is kept up
6212: to date by the NetBSD security officer and the
6213: NetBSD packages team, and is distributed from the
6214: NetBSD ftp server:</p>
6215:
6216: <p><a href=
6217: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 6218: target=
6219: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 6220: </li>
6221:
6222: <li>
1.34 wiz 6223: <p><span><strong class=
6224: "command">audit-packages</strong></span>, an easy
6225: way to audit the current machine, checking each
1.1 grant 6226: vulnerability which is known. If a vulnerable
6227: package is installed, it will be shown by output to
6228: stdout, including a description of the type of
6229: vulnerability, and a URL containing more
6230: information.</p>
6231: </li>
6232: </ol>
6233: </div>
6234:
1.23 wiz 6235: <p>Use of the <a xmlns=
6236: "http://www.w3.org/TR/xhtml1/transitional" href=
6237: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 6238: target="_top"><code xmlns="" class=
6239: "filename">security/audit-packages</code></a> package is
1.23 wiz 6240: strongly recommended! After “<span class=
6241: "quote">audit-packages</span>” is installed, please
6242: read the package's message, which you can get by running
6243: <strong class="userinput"><code>pkg_info -D
1.65 hubertf 6244: audit-packages</code></strong>.</p>
1.58 erh 6245:
6246: <p>If this package is installed, pkgsrc builds will use
6247: it to perform a security check before building any
6248: package. See <a href="#variables-affecting-build" title=
6249: "5.2. Variables affecting the build process">Section 5.2,
6250: “Variables affecting the build process”</a>
1.59 rillig 6251: for ways to control this check.</p>
1.1 grant 6252: </div>
6253: </div>
6254: </div>
6255:
1.67 hubertf 6256: <div class="part" lang="en">
1.1 grant 6257: <div class="titlepage">
6258: <div>
6259: <div>
1.67 hubertf 6260: <h1 class="title"><a name=
1.48 dillo 6261: "developers-guide"></a>Part II. The pkgsrc
6262: developer's guide</h1>
1.1 grant 6263: </div>
6264: </div>
6265: </div>
6266:
6267: <div class="toc">
6268: <p><b>Table of Contents</b></p>
6269:
6270: <dl>
1.38 dillo 6271: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 6272: Package components - files, directories and
6273: contents</a></span></dt>
6274:
6275: <dd>
6276: <dl>
6277: <dt><span class="sect1"><a href=
1.45 wiz 6278: "#components.Makefile">8.1. <code xmlns=
6279: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6280: "filename">Makefile</code></a></span></dt>
6281:
6282: <dt><span class="sect1"><a href=
1.45 wiz 6283: "#components.distinfo">8.2. <code xmlns=
6284: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6285: "filename">distinfo</code></a></span></dt>
6286:
6287: <dt><span class="sect1"><a href=
1.38 dillo 6288: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 6289:
1.30 wiz 6290: <dt><span class="sect1"><a href=
1.38 dillo 6291: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6292: files</a></span></dt>
1.27 rillig 6293:
6294: <dt><span class="sect1"><a href=
1.38 dillo 6295: "#components.optional">8.5. Optional
1.27 rillig 6296: files</a></span></dt>
6297:
1.38 dillo 6298: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6299: <code xmlns=
6300: "http://www.w3.org/TR/xhtml1/transitional" class=
6301: "filename">work*</code></a></span></dt>
1.27 rillig 6302:
1.38 dillo 6303: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6304: <code xmlns=
6305: "http://www.w3.org/TR/xhtml1/transitional" class=
6306: "filename">files/*</code></a></span></dt>
1.27 rillig 6307: </dl>
6308: </dd>
6309:
1.38 dillo 6310: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 6311: Programming in <code xmlns=
6312: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 6313: "filename">Makefile</code>s</a></span></dt>
6314:
6315: <dd>
6316: <dl>
6317: <dt><span class="sect1"><a href=
1.45 wiz 6318: "#makefile.variables">9.1. <code xmlns=
6319: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 6320: "filename">Makefile</code> variables</a></span></dt>
6321:
1.27 rillig 6322: <dd>
6323: <dl>
6324: <dt><span class="sect2"><a href=
1.38 dillo 6325: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 6326: conventions</a></span></dt>
6327: </dl>
6328: </dd>
6329:
1.38 dillo 6330: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 6331: Code snippets</a></span></dt>
6332:
6333: <dd>
6334: <dl>
6335: <dt><span class="sect2"><a href=
1.38 dillo 6336: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 6337: list</a></span></dt>
6338:
6339: <dt><span class="sect2"><a href=
1.38 dillo 6340: "#converting-internal-to-external">9.2.2.
1.30 wiz 6341: Converting an internal list into an external
6342: list</a></span></dt>
1.25 rillig 6343:
6344: <dt><span class="sect2"><a href=
1.38 dillo 6345: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 6346: variables to a shell command</a></span></dt>
1.27 rillig 6347:
6348: <dt><span class="sect2"><a href=
1.38 dillo 6349: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 6350: guideline</a></span></dt>
6351:
6352: <dt><span class="sect2"><a href=
1.38 dillo 6353: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 6354: a bug in BSD Make</a></span></dt>
1.25 rillig 6355: </dl>
6356: </dd>
6357: </dl>
6358: </dd>
6359:
1.38 dillo 6360: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 6361: issues</a></span></dt>
6362:
6363: <dd>
6364: <dl>
1.38 dillo 6365: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 6366: ID</a></span></dt>
6367:
1.30 wiz 6368: <dt><span class="sect1"><a href=
1.38 dillo 6369: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 6370: <code xmlns=
6371: "http://www.w3.org/TR/xhtml1/transitional" class=
6372: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 6373:
1.38 dillo 6374: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 6375: Tweaking output of <span><strong class="command">make
6376: print-PLIST</strong></span></a></span></dt>
1.1 grant 6377:
1.38 dillo 6378: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 6379: Variable substitution in PLIST</a></span></dt>
6380:
1.30 wiz 6381: <dt><span class="sect1"><a href=
1.48 dillo 6382: "#manpage-compression">10.5. Man page
6383: compression</a></span></dt>
1.1 grant 6384:
1.30 wiz 6385: <dt><span class="sect1"><a href=
1.38 dillo 6386: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 6387: <code class=
1.14 xtraeme 6388: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 6389:
1.30 wiz 6390: <dt><span class="sect1"><a href=
1.47 reed 6391: "#platform-specific-plist">10.7. Platform-specific
1.38 dillo 6392: and differing PLISTs</a></span></dt>
1.1 grant 6393:
6394: <dt><span class="sect1"><a href=
1.38 dillo 6395: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 6396: packages</a></span></dt>
6397: </dl>
6398: </dd>
6399:
1.38 dillo 6400: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 6401: Buildlink methodology</a></span></dt>
6402:
6403: <dd>
6404: <dl>
1.30 wiz 6405: <dt><span class="sect1"><a href=
1.38 dillo 6406: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 6407: to use buildlink3</a></span></dt>
1.1 grant 6408:
1.30 wiz 6409: <dt><span class="sect1"><a href=
1.45 wiz 6410: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
6411: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6412: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 6413:
6414: <dd>
6415: <dl>
6416: <dt><span class="sect2"><a href=
1.38 dillo 6417: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 6418: buildlink3.mk file</a></span></dt>
1.1 grant 6419:
6420: <dt><span class="sect2"><a href=
1.38 dillo 6421: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 6422: <code class=
1.72 ! rillig 6423: "varname">BUILDLINK_API_DEPENDS.<em class=
! 6424: "replaceable"><code>pkg</code></em></code> in
! 6425: <code xmlns=
1.45 wiz 6426: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6427: "filename">buildlink3.mk</code>
1.1 grant 6428: files</a></span></dt>
6429: </dl>
6430: </dd>
6431:
1.30 wiz 6432: <dt><span class="sect1"><a href=
1.45 wiz 6433: "#writing-builtin.mk">11.3. Writing <code xmlns=
6434: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6435: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 6436:
6437: <dd>
6438: <dl>
6439: <dt><span class="sect2"><a href=
1.38 dillo 6440: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 6441: <code xmlns=
6442: "http://www.w3.org/TR/xhtml1/transitional" class=
6443: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 6444:
6445: <dt><span class="sect2"><a href=
1.38 dillo 6446: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 6447: preferences for native or pkgsrc
6448: software</a></span></dt>
1.1 grant 6449: </dl>
6450: </dd>
6451: </dl>
6452: </dd>
6453:
1.38 dillo 6454: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 6455: pkginstall framework</a></span></dt>
6456:
6457: <dd>
6458: <dl>
6459: <dt><span class="sect1"><a href=
1.38 dillo 6460: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 6461: directories outside the installation
6462: prefix</a></span></dt>
6463:
6464: <dd>
6465: <dl>
6466: <dt><span class="sect2"><a href=
1.38 dillo 6467: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 6468: manipulation</a></span></dt>
6469:
6470: <dt><span class="sect2"><a href=
1.38 dillo 6471: "#files-outside-prefix">12.1.2. File
1.35 jmmv 6472: manipulation</a></span></dt>
6473: </dl>
6474: </dd>
6475:
1.38 dillo 6476: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 6477: Configuration files</a></span></dt>
6478:
6479: <dd>
6480: <dl>
6481: <dt><span class="sect2"><a href=
1.38 dillo 6482: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 6483: "varname">PKG_SYSCONFDIR</code> is
6484: set</a></span></dt>
6485:
6486: <dt><span class="sect2"><a href=
1.38 dillo 6487: "#conf-files-configure">12.2.2. Telling the
1.47 reed 6488: software where configuration files
1.35 jmmv 6489: are</a></span></dt>
6490:
6491: <dt><span class="sect2"><a href=
1.38 dillo 6492: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 6493: installations</a></span></dt>
6494:
6495: <dt><span class="sect2"><a href=
1.38 dillo 6496: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 6497: of configuration files</a></span></dt>
6498: </dl>
6499: </dd>
6500:
1.38 dillo 6501: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 6502: System startup scripts</a></span></dt>
6503:
6504: <dd>
6505: <dl>
6506: <dt><span class="sect2"><a href=
1.38 dillo 6507: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 6508: of system startup scripts</a></span></dt>
6509: </dl>
6510: </dd>
6511:
6512: <dt><span class="sect1"><a href=
1.38 dillo 6513: "#users-and-groups">12.4. System users and
1.35 jmmv 6514: groups</a></span></dt>
6515:
1.38 dillo 6516: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 6517: System shells</a></span></dt>
6518:
6519: <dd>
6520: <dl>
6521: <dt><span class="sect2"><a href=
1.65 hubertf 6522: "#shells-disable">12.5.1. Disabling shell
6523: registration</a></span></dt>
6524: </dl>
6525: </dd>
6526:
6527: <dt><span class="sect1"><a href="#fonts">12.6.
6528: Fonts</a></span></dt>
6529:
6530: <dd>
6531: <dl>
6532: <dt><span class="sect2"><a href=
6533: "#fonts-disable">12.6.1. Disabling automatic
6534: update of the fonts databases</a></span></dt>
1.35 jmmv 6535: </dl>
6536: </dd>
6537: </dl>
6538: </dd>
6539:
1.38 dillo 6540: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 6541: handling</a></span></dt>
6542:
6543: <dd>
6544: <dl>
1.30 wiz 6545: <dt><span class="sect1"><a href=
1.38 dillo 6546: "#global-default-options">13.1. Global default
1.30 wiz 6547: options</a></span></dt>
1.1 grant 6548:
1.30 wiz 6549: <dt><span class="sect1"><a href=
1.38 dillo 6550: "#converting-to-options">13.2. Converting packages to
1.45 wiz 6551: use <code xmlns=
6552: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6553: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 6554:
6555: <dt><span class="sect1"><a href="#option-names">13.3.
6556: Option Names</a></span></dt>
1.1 grant 6557: </dl>
6558: </dd>
6559:
1.38 dillo 6560: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 6561: process</a></span></dt>
6562:
6563: <dd>
6564: <dl>
1.56 rillig 6565: <dt><span class="sect1"><a href="#build.intro">14.1.
6566: Introduction</a></span></dt>
6567:
6568: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 6569: Program location</a></span></dt>
6570:
1.56 rillig 6571: <dt><span class="sect1"><a href=
6572: "#build.builddirs">14.3. Directories used during the
6573: build process</a></span></dt>
1.1 grant 6574:
6575: <dt><span class="sect1"><a href=
1.56 rillig 6576: "#build.running">14.4. Running a
6577: phase</a></span></dt>
6578:
6579: <dt><span class="sect1"><a href="#build.fetch">14.5.
6580: The <span class="emphasis"><em>fetch</em></span>
6581: phase</a></span></dt>
6582:
6583: <dt><span class="sect1"><a href=
6584: "#build.checksum">14.6. The <span class=
6585: "emphasis"><em>checksum</em></span>
6586: phase</a></span></dt>
6587:
6588: <dt><span class="sect1"><a href=
6589: "#build.extract">14.7. The <span class=
6590: "emphasis"><em>extract</em></span>
6591: phase</a></span></dt>
6592:
6593: <dt><span class="sect1"><a href="#build.patch">14.8.
6594: The <span class="emphasis"><em>patch</em></span>
6595: phase</a></span></dt>
6596:
6597: <dt><span class="sect1"><a href="#build.tools">14.9.
6598: The <span class="emphasis"><em>tools</em></span>
6599: phase</a></span></dt>
6600:
6601: <dt><span class="sect1"><a href=
6602: "#build.wrapper">14.10. The <span class=
6603: "emphasis"><em>wrapper</em></span>
6604: phase</a></span></dt>
6605:
6606: <dt><span class="sect1"><a href=
6607: "#build.configure">14.11. The <span class=
6608: "emphasis"><em>configure</em></span>
6609: phase</a></span></dt>
6610:
6611: <dt><span class="sect1"><a href="#build.build">14.12.
6612: The <span class="emphasis"><em>build</em></span>
6613: phase</a></span></dt>
6614:
6615: <dt><span class="sect1"><a href="#build.test">14.13.
6616: The <span class="emphasis"><em>test</em></span>
6617: phase</a></span></dt>
6618:
6619: <dt><span class="sect1"><a href=
6620: "#build.install">14.14. The <span class=
6621: "emphasis"><em>install</em></span>
6622: phase</a></span></dt>
6623:
6624: <dt><span class="sect1"><a href=
6625: "#build.package">14.15. The <span class=
6626: "emphasis"><em>package</em></span>
6627: phase</a></span></dt>
6628:
6629: <dt><span class="sect1"><a href=
6630: "#build.helpful-targets">14.16. Other helpful
1.1 grant 6631: targets</a></span></dt>
6632: </dl>
6633: </dd>
6634:
1.68 rillig 6635: <dt><span class="chapter"><a href="#tools">15. Tools
6636: needed for building or running</a></span></dt>
6637:
6638: <dd>
6639: <dl>
6640: <dt><span class="sect1"><a href="#pkgsrc-tools">15.1.
6641: Tools for pkgsrc builds</a></span></dt>
6642:
6643: <dt><span class="sect1"><a href=
6644: "#package-tools">15.2. Tools needed by
6645: packages</a></span></dt>
6646:
6647: <dt><span class="sect1"><a href=
6648: "#platform-tools">15.3. Tools provided by
6649: platforms</a></span></dt>
6650: </dl>
6651: </dd>
6652:
6653: <dt><span class="chapter"><a href="#fixes">16. Making
1.55 rillig 6654: your package work</a></span></dt>
1.1 grant 6655:
6656: <dd>
6657: <dl>
1.30 wiz 6658: <dt><span class="sect1"><a href=
1.68 rillig 6659: "#general-operation">16.1. General
1.30 wiz 6660: operation</a></span></dt>
1.1 grant 6661:
6662: <dd>
6663: <dl>
6664: <dt><span class="sect2"><a href=
1.68 rillig 6665: "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30 wiz 6666: pull in variables from
6667: /etc/mk.conf</a></span></dt>
1.1 grant 6668:
6669: <dt><span class="sect2"><a href=
1.68 rillig 6670: "#where-to-install-documentation">16.1.2. Where
1.31 wiz 6671: to install documentation</a></span></dt>
6672:
6673: <dt><span class="sect2"><a href=
1.68 rillig 6674: "#restricted-packages">16.1.3. Restricted
1.1 grant 6675: packages</a></span></dt>
6676:
6677: <dt><span class="sect2"><a href=
1.68 rillig 6678: "#dependencies">16.1.4. Handling
1.1 grant 6679: dependencies</a></span></dt>
6680:
6681: <dt><span class="sect2"><a href=
1.68 rillig 6682: "#conflicts">16.1.5. Handling conflicts with
1.1 grant 6683: other packages</a></span></dt>
6684:
6685: <dt><span class="sect2"><a href=
1.68 rillig 6686: "#not-building-packages">16.1.6. Packages that
1.30 wiz 6687: cannot or should not be built</a></span></dt>
1.1 grant 6688:
6689: <dt><span class="sect2"><a href=
1.68 rillig 6690: "#undeletable-packages">16.1.7. Packages which
1.30 wiz 6691: should not be deleted, once
6692: installed</a></span></dt>
1.1 grant 6693:
6694: <dt><span class="sect2"><a href=
1.68 rillig 6695: "#security-handling">16.1.8. Handling packages
1.1 grant 6696: with security problems</a></span></dt>
6697:
6698: <dt><span class="sect2"><a href=
1.68 rillig 6699: "#compiler-bugs">16.1.9. How to handle compiler
1.1 grant 6700: bugs</a></span></dt>
6701:
6702: <dt><span class="sect2"><a href=
1.68 rillig 6703: "#bumping-pkgrevision">16.1.10. How to handle
1.30 wiz 6704: incrementing versions when fixing an existing
1.1 grant 6705: package</a></span></dt>
6706:
6707: <dt><span class="sect2"><a href=
1.68 rillig 6708: "#portability-of-packages">16.1.11. Portability
1.30 wiz 6709: of packages</a></span></dt>
1.1 grant 6710: </dl>
6711: </dd>
6712:
1.30 wiz 6713: <dt><span class="sect1"><a href=
1.68 rillig 6714: "#downloading-issues">16.2. Possible downloading
1.30 wiz 6715: issues</a></span></dt>
1.1 grant 6716:
6717: <dd>
6718: <dl>
6719: <dt><span class="sect2"><a href=
1.68 rillig 6720: "#no-plain-download">16.2.1. Packages whose
1.30 wiz 6721: distfiles aren't available for plain
1.1 grant 6722: downloading</a></span></dt>
6723:
6724: <dt><span class="sect2"><a href=
1.68 rillig 6725: "#modified-distfiles-same-name">16.2.2. How to
1.30 wiz 6726: handle modified distfiles with the 'old'
6727: name</a></span></dt>
1.1 grant 6728: </dl>
6729: </dd>
6730:
1.30 wiz 6731: <dt><span class="sect1"><a href=
1.68 rillig 6732: "#configuration-gotchas">16.3. Configuration
1.30 wiz 6733: gotchas</a></span></dt>
1.1 grant 6734:
6735: <dd>
6736: <dl>
6737: <dt><span class="sect2"><a href=
1.68 rillig 6738: "#fixes.libtool">16.3.1. Shared libraries -
1.1 grant 6739: libtool</a></span></dt>
6740:
6741: <dt><span class="sect2"><a href=
1.68 rillig 6742: "#using-libtool">16.3.2. Using libtool on GNU
1.1 grant 6743: packages that already support
6744: libtool</a></span></dt>
6745:
6746: <dt><span class="sect2"><a href=
1.68 rillig 6747: "#autoconf-automake">16.3.3. GNU
1.1 grant 6748: Autoconf/Automake</a></span></dt>
6749: </dl>
6750: </dd>
6751:
1.68 rillig 6752: <dt><span class="sect1"><a href="#fixes-build">16.4.
1.55 rillig 6753: Building the package</a></span></dt>
1.1 grant 6754:
6755: <dd>
6756: <dl>
6757: <dt><span class="sect2"><a href=
1.68 rillig 6758: "#cpp-defines">16.4.1. CPP
1.30 wiz 6759: defines</a></span></dt>
1.51 rillig 6760:
6761: <dt><span class="sect2"><a href=
1.68 rillig 6762: "#cpp-list-examples">16.4.2. Examples of CPP
1.60 rillig 6763: defines for some platforms</a></span></dt>
6764:
6765: <dt><span class="sect2"><a href=
1.68 rillig 6766: "#cpp-list">16.4.3. Getting a list of CPP
1.51 rillig 6767: defines</a></span></dt>
1.1 grant 6768: </dl>
6769: </dd>
6770:
1.30 wiz 6771: <dt><span class="sect1"><a href=
1.68 rillig 6772: "#package-specific-actions">16.5. Package specific
1.30 wiz 6773: actions</a></span></dt>
1.1 grant 6774:
6775: <dd>
6776: <dl>
6777: <dt><span class="sect2"><a href=
1.68 rillig 6778: "#user-interaction">16.5.1. User
1.2 hubertf 6779: interaction</a></span></dt>
1.1 grant 6780:
6781: <dt><span class="sect2"><a href=
1.68 rillig 6782: "#handling-licenses">16.5.2. Handling
1.1 grant 6783: licenses</a></span></dt>
6784:
6785: <dt><span class="sect2"><a href=
1.68 rillig 6786: "#installing-score-files">16.5.3. Installing
1.30 wiz 6787: score files</a></span></dt>
1.1 grant 6788:
6789: <dt><span class="sect2"><a href=
1.68 rillig 6790: "#perl-scripts">16.5.4. Packages containing perl
1.1 grant 6791: scripts</a></span></dt>
6792:
6793: <dt><span class="sect2"><a href=
1.68 rillig 6794: "#hardcoded-paths">16.5.5. Packages with
1.30 wiz 6795: hardcoded paths to other
6796: interpreters</a></span></dt>
1.1 grant 6797:
6798: <dt><span class="sect2"><a href=
1.68 rillig 6799: "#perl-modules">16.5.6. Packages installing perl
1.1 grant 6800: modules</a></span></dt>
6801:
6802: <dt><span class="sect2"><a href=
1.68 rillig 6803: "#faq.info-files">16.5.7. Packages installing
1.1 grant 6804: info files</a></span></dt>
6805:
6806: <dt><span class="sect2"><a href=
1.68 rillig 6807: "#manpages">16.5.8. Packages installing man
1.57 minskim 6808: pages</a></span></dt>
6809:
6810: <dt><span class="sect2"><a href=
1.68 rillig 6811: "#gconf2-data-files">16.5.9. Packages installing
1.30 wiz 6812: GConf2 data files</a></span></dt>
1.1 grant 6813:
6814: <dt><span class="sect2"><a href=
1.68 rillig 6815: "#scrollkeeper-data-files">16.5.10. Packages
1.30 wiz 6816: installing scrollkeeper data
6817: files</a></span></dt>
1.1 grant 6818:
6819: <dt><span class="sect2"><a href=
1.68 rillig 6820: "#x11-fonts">16.5.11. Packages installing X11
1.1 grant 6821: fonts</a></span></dt>
6822:
6823: <dt><span class="sect2"><a href=
1.68 rillig 6824: "#gtk2-modules">16.5.12. Packages installing GTK2
1.1 grant 6825: modules</a></span></dt>
6826:
6827: <dt><span class="sect2"><a href=
1.68 rillig 6828: "#sgml-xml-data">16.5.13. Packages installing
1.30 wiz 6829: SGML or XML data</a></span></dt>
1.1 grant 6830:
6831: <dt><span class="sect2"><a href=
1.68 rillig 6832: "#mime-database">16.5.14. Packages installing
1.1 grant 6833: extensions to the MIME database</a></span></dt>
6834:
6835: <dt><span class="sect2"><a href=
1.68 rillig 6836: "#intltool">16.5.15. Packages using
1.1 grant 6837: intltool</a></span></dt>
1.18 xtraeme 6838:
6839: <dt><span class="sect2"><a href=
1.68 rillig 6840: "#startup-scripts">16.5.16. Packages installing
1.30 wiz 6841: startup scripts</a></span></dt>
1.57 minskim 6842:
6843: <dt><span class="sect2"><a href=
1.68 rillig 6844: "#tex-packages">16.5.17. Packages installing TeX
1.57 minskim 6845: modules</a></span></dt>
1.1 grant 6846: </dl>
6847: </dd>
6848:
1.30 wiz 6849: <dt><span class="sect1"><a href=
1.68 rillig 6850: "#feedback-to-author">16.6. Feedback to the
1.30 wiz 6851: author</a></span></dt>
1.1 grant 6852: </dl>
6853: </dd>
6854:
1.68 rillig 6855: <dt><span class="chapter"><a href="#debug">17.
1.1 grant 6856: Debugging</a></span></dt>
6857:
1.68 rillig 6858: <dt><span class="chapter"><a href="#submit">18.
1.1 grant 6859: Submitting and Committing</a></span></dt>
6860:
6861: <dd>
6862: <dl>
1.30 wiz 6863: <dt><span class="sect1"><a href=
1.68 rillig 6864: "#submitting-your-package">18.1. Submitting your
1.30 wiz 6865: packages</a></span></dt>
1.1 grant 6866:
1.30 wiz 6867: <dt><span class="sect1"><a href=
1.68 rillig 6868: "#general-notes-for-changes">18.2. General notes when
1.41 wiz 6869: adding, updating, or removing
6870: packages</a></span></dt>
6871:
6872: <dt><span class="sect1"><a href=
1.68 rillig 6873: "#committing-importing">18.3. Committing: Importing a
1.30 wiz 6874: package into CVS</a></span></dt>
1.1 grant 6875:
1.30 wiz 6876: <dt><span class="sect1"><a href=
1.68 rillig 6877: "#updating-package">18.4. Updating a package to a
1.30 wiz 6878: newer version</a></span></dt>
1.1 grant 6879:
1.30 wiz 6880: <dt><span class="sect1"><a href=
1.68 rillig 6881: "#moving-package">18.5. Moving a package in
1.30 wiz 6882: pkgsrc</a></span></dt>
1.1 grant 6883: </dl>
6884: </dd>
1.69 rillig 6885:
1.72 ! rillig 6886: <dt><span class="chapter"><a href="#devfaq">19.
! 6887: Frequently Asked Questions</a></span></dt>
1.1 grant 6888: </dl>
6889: </div>
6890:
1.67 hubertf 6891: <div class="chapter" lang="en">
1.1 grant 6892: <div class="titlepage">
6893: <div>
6894: <div>
1.67 hubertf 6895: <h2 class="title"><a name=
1.38 dillo 6896: "components"></a>Chapter 8. Package
1.27 rillig 6897: components - files, directories and contents</h2>
1.25 rillig 6898: </div>
6899: </div>
6900: </div>
6901:
6902: <div class="toc">
6903: <p><b>Table of Contents</b></p>
6904:
6905: <dl>
6906: <dt><span class="sect1"><a href=
1.45 wiz 6907: "#components.Makefile">8.1. <code xmlns=
6908: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6909: "filename">Makefile</code></a></span></dt>
6910:
6911: <dt><span class="sect1"><a href=
1.45 wiz 6912: "#components.distinfo">8.2. <code xmlns=
6913: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6914: "filename">distinfo</code></a></span></dt>
6915:
6916: <dt><span class="sect1"><a href=
1.38 dillo 6917: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 6918:
1.30 wiz 6919: <dt><span class="sect1"><a href=
1.38 dillo 6920: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6921: files</a></span></dt>
1.25 rillig 6922:
1.27 rillig 6923: <dt><span class="sect1"><a href=
1.38 dillo 6924: "#components.optional">8.5. Optional
1.27 rillig 6925: files</a></span></dt>
1.25 rillig 6926:
1.38 dillo 6927: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6928: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6929: class="filename">work*</code></a></span></dt>
1.25 rillig 6930:
1.38 dillo 6931: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6932: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6933: class="filename">files/*</code></a></span></dt>
1.25 rillig 6934: </dl>
6935: </div>
6936:
1.27 rillig 6937: <p>Whenever you're preparing a package, there are a number
6938: of files involved which are described in the following
6939: sections.</p>
1.25 rillig 6940:
1.67 hubertf 6941: <div class="sect1" lang="en">
1.25 rillig 6942: <div class="titlepage">
6943: <div>
6944: <div>
6945: <h2 class="title" style="clear: both"><a name=
1.45 wiz 6946: "components.Makefile"></a>8.1. <code xmlns=
6947: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6948: "filename">Makefile</code></h2>
1.25 rillig 6949: </div>
6950: </div>
6951: </div>
6952:
1.27 rillig 6953: <p>Building, installation and creation of a binary
1.45 wiz 6954: package are all controlled by the package's <code xmlns=
6955: "http://www.w3.org/TR/xhtml1/transitional" class=
6956: "filename">Makefile</code>. The <code xmlns=
6957: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6958: "filename">Makefile</code> describes various things about
6959: a package, for example from where to get it, how to
6960: configure, build, and install it.</p>
6961:
1.45 wiz 6962: <p>A package <code xmlns=
6963: "http://www.w3.org/TR/xhtml1/transitional" class=
6964: "filename">Makefile</code> contains several sections that
6965: describe the package.</p>
1.25 rillig 6966:
1.27 rillig 6967: <p>In the first section there are the following
6968: variables, which should appear exactly in the order given
6969: here.</p>
1.25 rillig 6970:
6971: <div class="itemizedlist">
6972: <ul type="disc">
6973: <li>
1.27 rillig 6974: <p><code class="varname">DISTNAME</code> is the
6975: basename of the distribution file to be downloaded
6976: from the package's website.</p>
6977: </li>
6978:
6979: <li>
6980: <p><code class="varname">PKGNAME</code> is the name
6981: of the package, as used by pkgsrc. You only need to
1.50 rillig 6982: provide it if it differs from <code class=
6983: "varname">DISTNAME</code>. Usually it is the
6984: directory name together with the version number. It
6985: must match the regular expression <code class=
1.27 rillig 6986: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
6987: that is, it starts with a letter or digit, and
6988: contains only letters, digits, dashes, underscores,
6989: dots and plus signs.</p>
1.25 rillig 6990: </li>
6991:
6992: <li>
1.27 rillig 6993: <p><code class="varname">CATEGORIES</code> is a
6994: list of categories which the package fits in. You
6995: can choose any of the top-level directories of
6996: pkgsrc for it.</p>
1.45 wiz 6997:
6998: <p>Currently the following values are available for
6999: <code class="varname">CATEGORIES</code>. If more
7000: than one is used, they need to be separated by
7001: spaces:</p>
7002: <pre class="programlisting">
1.51 rillig 7003: archivers cross geography meta-pkgs security
7004: audio databases graphics misc shells
7005: benchmarks devel ham multimedia sysutils
7006: biology editors inputmethod net textproc
7007: cad emulators lang news time
7008: chat finance mail parallel wm
7009: comms fonts math pkgtools www
7010: converters games mbone print x11
1.45 wiz 7011: </pre>
1.25 rillig 7012: </li>
7013:
7014: <li>
1.27 rillig 7015: <p><code class="varname">MASTER_SITES</code> is a
7016: list of URLs where the distribution files can be
7017: downloaded. Each URL must end with a slash.</p>
1.45 wiz 7018:
7019: <p>The <code class="varname">MASTER_SITES</code>
7020: may make use of the following predefined sites:</p>
7021: <pre class="programlisting">
1.51 rillig 7022: ${MASTER_SITE_APACHE}
7023: ${MASTER_SITE_BACKUP}
7024: ${MASTER_SITE_CYGWIN}
7025: ${MASTER_SITE_DEBIAN}
7026: ${MASTER_SITE_FREEBSD}
7027: ${MASTER_SITE_FREEBSD_LOCAL}
7028: ${MASTER_SITE_GNOME}
7029: ${MASTER_SITE_GNU}
7030: ${MASTER_SITE_GNUSTEP}
7031: ${MASTER_SITE_IFARCHIVE}
7032: ${MASTER_SITE_MOZILLA}
7033: ${MASTER_SITE_OPENOFFICE}
7034: ${MASTER_SITE_PERL_CPAN}
7035: ${MASTER_SITE_R_CRAN}
7036: ${MASTER_SITE_SOURCEFORGE}
7037: ${MASTER_SITE_SUNSITE}
7038: ${MASTER_SITE_SUSE}
7039: ${MASTER_SITE_TEX_CTAN}
7040: ${MASTER_SITE_XCONTRIB}
7041: ${MASTER_SITE_XEMACS}
1.45 wiz 7042: </pre>
7043:
7044: <p>If one of these predefined sites is chosen, you
7045: may want to specify a subdirectory of that site.
7046: Since these macros may expand to more than one
7047: actual site, you <span class=
7048: "emphasis"><em>must</em></span> use the following
7049: construct to specify a subdirectory:</p>
7050: <pre class="programlisting">
1.51 rillig 7051: ${MASTER_SITE_GNU:=subdirectory/name/}
7052: ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45 wiz 7053: </pre>
7054:
7055: <p>Note the trailing slash after the subdirectory
7056: name.</p>
7057:
7058: <p>If the package has multiple <code class=
7059: "varname">DISTFILES</code> or multiple <code class=
7060: "varname">PATCHFILES</code> from different sites,
1.72 ! rillig 7061: set <code class="varname">SITES.foo</code> to a
1.47 reed 7062: list of URIs where file “<span class=
1.45 wiz 7063: "quote">foo</span>” may be found.
7064: “<span class="quote">foo</span>”
1.47 reed 7065: includes the suffix, e.g.:</p>
1.45 wiz 7066: <pre class="programlisting">
1.51 rillig 7067: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
7068: DISTFILES+= foo-file.tar.gz
1.72 ! rillig 7069: SITES.foo-file.tar.gz= \
1.69 rillig 7070: http://www.somewhere.com/somehow/ \
1.51 rillig 7071: http://www.somewhereelse.com/mirror/somehow/
1.45 wiz 7072: </pre>
7073: </li>
7074:
7075: <li>
7076: <p><code class="varname">DISTFILES</code>: Name(s)
7077: of archive file(s) containing distribution. The
7078: default is <code xmlns=
7079: "http://www.w3.org/TR/xhtml1/transitional" class=
7080: "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
7081: Should only be set if you have more than one
7082: distfile.</p>
7083:
7084: <p>Note that the normal default setting of
7085: <code class="varname">DISTFILES</code> must be made
7086: explicit if you want to add to it (rather than
7087: replace it), as you usually would.</p>
7088: </li>
7089:
7090: <li>
7091: <p><code class="varname">EXTRACT_SUFX</code>:
7092: Suffix of the distribution file, will be appended
7093: to <code class="varname">DISTNAME</code>. Defaults
7094: to <code xmlns=
7095: "http://www.w3.org/TR/xhtml1/transitional" class=
7096: "filename">.tar.gz</code>.</p>
7097: </li>
7098: </ul>
7099: </div>
7100:
7101: <p>The second section contains information about
7102: separately downloaded patches, if any.</p>
7103:
7104: <div class="itemizedlist">
7105: <ul type="disc">
7106: <li>
1.47 reed 7107: <p><code class="varname">PATCHFILES:</code> Name(s)
1.45 wiz 7108: of additional files that contain distribution
7109: patches. There is no default. pkgsrc will look for
7110: them at <code class="varname">PATCH_SITES</code>.
7111: They will automatically be uncompressed before
7112: patching if the names end with <code xmlns=
7113: "http://www.w3.org/TR/xhtml1/transitional" class=
7114: "filename">.gz</code> or <code xmlns=
7115: "http://www.w3.org/TR/xhtml1/transitional" class=
7116: "filename">.Z</code>.</p>
7117: </li>
7118:
7119: <li>
7120: <p><code class="varname">PATCH_SITES</code>:
7121: Primary location(s) for distribution patch files
7122: (see <code class="varname">PATCHFILES</code> below)
7123: if not found locally.</p>
1.25 rillig 7124: </li>
7125: </ul>
7126: </div>
7127:
1.45 wiz 7128: <p>The third section contains the following
1.27 rillig 7129: variables.</p>
1.25 rillig 7130:
1.27 rillig 7131: <div class="itemizedlist">
7132: <ul type="disc">
7133: <li>
7134: <p><code class="varname">MAINTAINER</code> is the
1.50 rillig 7135: email address of the person who feels responsible
7136: for this package, and who is most likely to look at
7137: problems or questions regarding this package which
7138: have been reported with <a href=
1.45 wiz 7139: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
7140: <span class="citerefentry"><span class=
1.50 rillig 7141: "refentrytitle">send-pr</span>(1)</span></a>. Other
7142: developers should contact the <code class=
7143: "varname">MAINTAINER</code> before making major
7144: changes to the package. When packaging a new
7145: program, set <code class=
7146: "varname">MAINTAINER</code> to yourself. If you
7147: really can't maintain the package for future
7148: updates, set it to <code class="email"><<a href=
1.71 wiz 7149: "mailto:pkgsrc-users@NetBSD.org">pkgsrc-users@NetBSD.org</a>></code>.</p>
1.27 rillig 7150: </li>
1.25 rillig 7151:
1.27 rillig 7152: <li>
7153: <p><code class="varname">HOMEPAGE</code> is a URL
7154: where users can find more information about the
1.23 wiz 7155: package.</p>
7156: </li>
1.1 grant 7157:
1.23 wiz 7158: <li>
7159: <p><code class="varname">COMMENT</code> is a
1.45 wiz 7160: one-line description of the package (should not
7161: include the package name).</p>
1.23 wiz 7162: </li>
7163: </ul>
7164: </div>
1.1 grant 7165:
1.45 wiz 7166: <p>Other variables that affect the build:</p>
1.1 grant 7167:
1.45 wiz 7168: <div class="itemizedlist">
7169: <ul type="disc">
7170: <li>
7171: <p><code class="varname">WRKSRC</code>: The
1.50 rillig 7172: directory where the interesting distribution files
7173: of the package are found. The default is
7174: <code xmlns=
7175: "http://www.w3.org/TR/xhtml1/transitional" class=
7176: "filename">${WRKDIR}/${DISTNAME}</code>, which
7177: works for most packages.</p>
7178:
7179: <p>If a package doesn't create a subdirectory for
7180: itself (most GNU software does, for instance), but
7181: extracts itself in the current directory, you
7182: should set <code class="varname">WRKSRC=
7183: ${WRKDIR}</code>.</p>
7184:
7185: <p>If a package doesn't create a subdirectory with
7186: the name of <code class="varname">DISTNAME</code>
7187: but some different name, set <code class=
7188: "varname">WRKSRC</code> to point to the proper name
7189: in <code xmlns=
7190: "http://www.w3.org/TR/xhtml1/transitional" class=
7191: "filename">${WRKDIR}</code>, for example
7192: <code class="varname">WRKSRC=
7193: ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
7194: "http://www.w3.org/TR/xhtml1/transitional" href=
7195: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
7196: target="_top"><code xmlns="" class=
7197: "filename">lang/tcl</code></a> and <a xmlns=
7198: "http://www.w3.org/TR/xhtml1/transitional" href=
7199: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
7200: target="_top"><code xmlns="" class=
7201: "filename">x11/tk</code></a> for other
7202: examples.</p>
7203:
7204: <p>The name of the working directory created by
7205: pkgsrc is taken from the <code class=
7206: "varname">WRKDIR_BASENAME</code> variable. By
7207: default, its value is <code xmlns=
7208: "http://www.w3.org/TR/xhtml1/transitional" class=
7209: "filename">work</code>. If you want to use the same
7210: pkgsrc tree for building different kinds of binary
7211: packages, you can change the variable according to
7212: your needs. Two other variables handle common cases
7213: of setting <code class=
7214: "varname">WRKDIR_BASENAME</code> individually. If
7215: <code class="varname">OBJHOSTNAME</code> is defined
7216: in <code xmlns=
1.45 wiz 7217: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 7218: "filename">/etc/mk.conf</code>, the first component
7219: of the host's name is attached to the directory
7220: name. If <code class="varname">OBJMACHINE</code> is
7221: defined, the platform name is attached, which might
7222: look like <code xmlns=
7223: "http://www.w3.org/TR/xhtml1/transitional" class=
7224: "filename">work.i386</code> or <code xmlns=
1.45 wiz 7225: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 7226: "filename">work.sparc</code>.</p>
1.45 wiz 7227: </li>
7228: </ul>
1.1 grant 7229: </div>
7230:
7231: <p>Please pay attention to the following gotchas:</p>
7232:
7233: <div class="itemizedlist">
7234: <ul type="disc">
7235: <li>
1.14 xtraeme 7236: <p>Add <code class="varname">MANCOMPRESSED</code>
1.47 reed 7237: if man pages are installed in compressed form by
7238: the package; see comment in <code xmlns=
1.45 wiz 7239: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7240: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 7241: </li>
7242:
7243: <li>
1.45 wiz 7244: <p>Replace <code xmlns=
7245: "http://www.w3.org/TR/xhtml1/transitional" class=
7246: "filename">/usr/local</code> with
7247: “<span class="quote">${PREFIX}</span>”
7248: in all files (see patches, below).</p>
1.1 grant 7249: </li>
7250:
7251: <li>
7252: <p>If the package installs any info files, see
7253: <a href="#faq.info-files" title=
1.68 rillig 7254: "16.5.7. Packages installing info files">Section 16.5.7,
1.45 wiz 7255: “Packages installing info
1.1 grant 7256: files”</a>.</p>
7257: </li>
7258: </ul>
7259: </div>
7260: </div>
7261:
1.67 hubertf 7262: <div class="sect1" lang="en">
1.1 grant 7263: <div class="titlepage">
7264: <div>
7265: <div>
7266: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7267: "components.distinfo"></a>8.2. <code xmlns=
7268: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7269: "filename">distinfo</code></h2>
1.1 grant 7270: </div>
7271: </div>
7272: </div>
7273:
1.50 rillig 7274: <p>The <code xmlns=
7275: "http://www.w3.org/TR/xhtml1/transitional" class=
7276: "filename">distinfo</code> file contains the message
7277: digest, or checksum, of each distfile needed for the
7278: package. This ensures that the distfiles retrieved from
7279: the Internet have not been corrupted during transfer or
7280: altered by a malign force to introduce a security hole.
7281: Due to recent rumor about weaknesses of digest
7282: algorithms, all distfiles are protected using both SHA1
7283: and RMD160 message digests, as well as the file size.</p>
7284:
7285: <p>The <code xmlns=
7286: "http://www.w3.org/TR/xhtml1/transitional" class=
7287: "filename">distinfo</code> file also contains the
7288: checksums for all the patches found in the <code xmlns=
7289: "http://www.w3.org/TR/xhtml1/transitional" class=
7290: "filename">patches</code> directory (see <a href=
7291: "#components.patches" title=
7292: "8.3. patches/*">Section 8.3,
7293: “patches/*”</a>).</p>
7294:
7295: <p>To regenerate the <code xmlns=
7296: "http://www.w3.org/TR/xhtml1/transitional" class=
7297: "filename">distinfo</code> file, use the
1.14 xtraeme 7298: <span><strong class="command">make
1.50 rillig 7299: makedistinfo</strong></span> or <span><strong class=
7300: "command">make mdi</strong></span> command.</p>
1.1 grant 7301:
1.50 rillig 7302: <p>Some packages have different sets of distfiles
7303: depending on the platform, for example <a xmlns=
1.1 grant 7304: "http://www.w3.org/TR/xhtml1/transitional" href=
7305: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45 wiz 7306: target="_top"><code xmlns="" class=
7307: "filename">www/navigator</code></a>). These are kept in
1.50 rillig 7308: the same <code xmlns=
1.45 wiz 7309: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 7310: "filename">distinfo</code> file and care should be taken
7311: when upgrading such a package to ensure distfile
7312: information is not lost.</p>
1.1 grant 7313: </div>
7314:
1.67 hubertf 7315: <div class="sect1" lang="en">
1.1 grant 7316: <div class="titlepage">
7317: <div>
7318: <div>
7319: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7320: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 7321: </div>
7322: </div>
7323: </div>
7324:
7325: <p>This directory contains files that are used by the
7326: <a href=
7327: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
7328: <span class="citerefentry"><span class=
7329: "refentrytitle">patch</span>(1)</span></a> command to
7330: modify the sources as distributed in the distribution
7331: file into a form that will compile and run perfectly on
7332: NetBSD. The files are applied successively in alphabetic
7333: order (as returned by a shell “<span class=
7334: "quote">patches/patch-*</span>” glob expansion), so
1.45 wiz 7335: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7336: class="filename">patch-aa</code> is applied before
7337: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7338: class="filename">patch-ab</code>, etc.</p>
7339:
7340: <p>The <code xmlns=
7341: "http://www.w3.org/TR/xhtml1/transitional" class=
7342: "filename">patch-*</code> files should be in
7343: <span><strong class="command">diff -bu</strong></span>
7344: format, and apply without a fuzz to avoid problems. (To
7345: force patches to apply with fuzz you can set <code class=
1.14 xtraeme 7346: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 7347: not put changes for more than one file into a single
1.47 reed 7348: patch file, as this will make future modifications more
1.1 grant 7349: difficult.</p>
7350:
7351: <p>Similar, a file should be patched at most once, not
7352: several times by several different patches. If a file
7353: needs several patches, they should be combined into one
7354: file.</p>
7355:
7356: <p>One important thing to mention is to pay attention
7357: that no RCS IDs get stored in the patch files, as these
7358: will cause problems when later checked into the NetBSD
1.14 xtraeme 7359: CVS tree. Use the <span><strong class=
7360: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 7361: "http://www.w3.org/TR/xhtml1/transitional" href=
7362: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 7363: target="_top"><code xmlns="" class=
7364: "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20 ben 7365: these problems.</p>
1.1 grant 7366:
7367: <p>For even more automation, we recommend using
1.14 xtraeme 7368: <span><strong class="command">mkpatches</strong></span>
7369: from the same package to make a whole set of patches. You
7370: just have to backup files before you edit them to
1.45 wiz 7371: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7372: class="filename">filename.orig</code>, e.g. with
1.14 xtraeme 7373: <span><strong class="command">cp -p filename
7374: filename.orig</strong></span> or, easier, by using
7375: <span><strong class="command">pkgvi</strong></span> again
7376: from the same package. If you upgrade a package this way,
7377: you can easily compare the new set of patches with the
7378: previously existing one with <span><strong class=
7379: "command">patchdiff</strong></span>.</p>
1.1 grant 7380:
7381: <p>When you have finished a package, remember to generate
7382: the checksums for the patch files by using the
1.14 xtraeme 7383: <span><strong class="command">make
7384: makepatchsum</strong></span> command, see <a href=
7385: "#components.distinfo" title=
1.38 dillo 7386: "8.2. distinfo">Section 8.2,
1.45 wiz 7387: “<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7388: class="filename">distinfo</code>”</a>.</p>
1.1 grant 7389:
1.46 gdt 7390: <p>When adding a patch that corrects a problem in the
7391: distfile (rather than e.g. enforcing pkgsrc's view of
7392: where man pages should go), send the patch as a bug
7393: report to the maintainer. This benefits non-pkgsrc users
7394: of the package, and usually enables removing the patch in
7395: future version.</p>
7396:
1.1 grant 7397: <p>Patch files that are distributed by the author or
1.14 xtraeme 7398: other maintainers can be listed in <code class=
7399: "varname">$PATCHFILES</code>.</p>
1.1 grant 7400:
7401: <p>If it is desired to store any patches that should not
7402: be committed into pkgsrc, they can be kept outside the
1.45 wiz 7403: pkgsrc tree in the <code xmlns=
7404: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7405: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 7406: tree there is expected to have the same
7407: “<span class="quote">category/package</span>”
7408: structure as pkgsrc, and patches are expected to be
1.45 wiz 7409: stored inside these dirs (also known as <code xmlns=
7410: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 7411: "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
7412: if you want to keep a private patch for <code xmlns=
1.45 wiz 7413: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7414: "filename">pkgsrc/graphics/png</code>, keep it in
1.45 wiz 7415: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7416: class=
1.14 xtraeme 7417: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
7418: files in the named directory are expected to be patch
1.1 grant 7419: files, and <span class="emphasis"><em>they are applied
7420: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 7421: </div>
7422:
1.67 hubertf 7423: <div class="sect1" lang="en">
1.27 rillig 7424: <div class="titlepage">
7425: <div>
7426: <div>
7427: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7428: "other-mandatory-files"></a>8.4. Other
1.27 rillig 7429: mandatory files</h2>
7430: </div>
7431: </div>
7432: </div>
7433:
7434: <div class="variablelist">
7435: <dl>
1.45 wiz 7436: <dt><span class="term"><code xmlns=
7437: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7438: "filename">DESCR</code></span></dt>
7439:
7440: <dd>
7441: <p>A multi-line description of the piece of
7442: software. This should include any credits where
7443: they are due. Please bear in mind that others do
7444: not share your sense of humour (or spelling
7445: idiosyncrasies), and that others will read
7446: everything that you write here.</p>
7447: </dd>
7448:
1.45 wiz 7449: <dt><span class="term"><code xmlns=
7450: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7451: "filename">PLIST</code></span></dt>
7452:
7453: <dd>
7454: <p>This file governs the files that are installed
7455: on your system: all the binaries, manual pages,
7456: etc. There are other directives which may be
7457: entered in this file, to control the creation and
7458: deletion of directories, and the location of
7459: inserted files. See <a href="#plist" title=
1.38 dillo 7460: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 7461: <i>PLIST issues</i></a> for more information.</p>
7462: </dd>
7463: </dl>
7464: </div>
7465: </div>
7466:
1.67 hubertf 7467: <div class="sect1" lang="en">
1.27 rillig 7468: <div class="titlepage">
7469: <div>
7470: <div>
7471: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7472: "components.optional"></a>8.5. Optional
1.27 rillig 7473: files</h2>
7474: </div>
7475: </div>
7476: </div>
7477:
7478: <div class="variablelist">
7479: <dl>
1.45 wiz 7480: <dt><span class="term"><code xmlns=
7481: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7482: "filename">INSTALL</code></span></dt>
7483:
7484: <dd>
7485: <p>This shell script is invoked twice by <a href=
7486: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7487: <span class="citerefentry"><span class=
7488: "refentrytitle">pkg_add</span>(1)</span></a>. First
7489: time after package extraction and before files are
7490: moved in place, the second time after the files to
7491: install are moved in place. This can be used to do
7492: any custom procedures not possible with @exec
1.45 wiz 7493: commands in <code xmlns=
7494: "http://www.w3.org/TR/xhtml1/transitional" class=
7495: "filename">PLIST</code>. See <a href=
1.27 rillig 7496: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7497: <span class="citerefentry"><span class=
7498: "refentrytitle">pkg_add</span>(1)</span></a> and
7499: <a href=
7500: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7501: <span class="citerefentry"><span class=
7502: "refentrytitle">pkg_create</span>(1)</span></a> for
7503: more information.</p>
7504: </dd>
7505:
1.45 wiz 7506: <dt><span class="term"><code xmlns=
7507: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7508: "filename">DEINSTALL</code></span></dt>
7509:
7510: <dd>
7511: <p>This script is executed before and after any
7512: files are removed. It is this script's
7513: responsibility to clean up any additional messy
7514: details around the package's installation, since
7515: all pkg_delete knows is how to delete the files
7516: created in the original distribution. See <a href=
7517: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7518: <span class="citerefentry"><span class=
7519: "refentrytitle">pkg_delete</span>(1)</span></a> and
7520: <a href=
7521: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7522: <span class="citerefentry"><span class=
7523: "refentrytitle">pkg_create</span>(1)</span></a> for
7524: more information.</p>
7525: </dd>
7526:
1.45 wiz 7527: <dt><span class="term"><code xmlns=
7528: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7529: "filename">MESSAGE</code></span></dt>
7530:
7531: <dd>
1.50 rillig 7532: <p>This file is displayed after installation of the
1.27 rillig 7533: package. Useful for things like legal notices on
7534: almost-free software and hints for updating config
7535: files after installing modules for apache, PHP etc.
7536: Please note that you can modify variables in it
7537: easily by using <code class=
7538: "varname">MESSAGE_SUBST</code> in the package's
1.45 wiz 7539: <code xmlns=
7540: "http://www.w3.org/TR/xhtml1/transitional" class=
7541: "filename">Makefile</code>:</p>
1.27 rillig 7542: <pre class="programlisting">
1.51 rillig 7543: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.27 rillig 7544: </pre>
7545:
7546: <p>replaces "${SOMEVAR}" with “<span class=
1.45 wiz 7547: "quote">somevalue</span>” in <code xmlns=
7548: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7549: "filename">MESSAGE</code>.</p>
7550: </dd>
7551: </dl>
7552: </div>
7553: </div>
7554:
1.67 hubertf 7555: <div class="sect1" lang="en">
1.27 rillig 7556: <div class="titlepage">
7557: <div>
7558: <div>
7559: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 7560: "work-dir"></a>8.6. <code xmlns=
1.45 wiz 7561: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7562: "filename">work*</code></h2>
7563: </div>
7564: </div>
7565: </div>
7566:
7567: <p>When you type <span><strong class=
1.47 reed 7568: "command">make</strong></span>, the distribution files
7569: are unpacked into the directory denoted by <code class=
1.45 wiz 7570: "varname">WRKDIR</code>. It can be removed by running
7571: <span><strong class="command">make clean</strong></span>.
7572: Besides the sources, this directory is also used to keep
7573: various timestamp files. The directory gets <span class=
7574: "emphasis"><em>removed completely</em></span> on clean.
7575: The default is <code xmlns=
7576: "http://www.w3.org/TR/xhtml1/transitional" class=
7577: "filename">${.CURDIR}/work</code> or <code xmlns=
7578: "http://www.w3.org/TR/xhtml1/transitional" class=
7579: "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
7580: <code class="varname">OBJMACHINE</code> is set.</p>
1.27 rillig 7581: </div>
7582:
1.67 hubertf 7583: <div class="sect1" lang="en">
1.27 rillig 7584: <div class="titlepage">
7585: <div>
7586: <div>
7587: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7588: "files-dir"></a>8.7. <code xmlns=
7589: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7590: "filename">files/*</code></h2>
7591: </div>
7592: </div>
7593: </div>
7594:
7595: <p>If you have any files that you wish to be placed in
7596: the package prior to configuration or building, you could
7597: place these files here and use a “<span class=
7598: "quote">${CP}</span>” command in the
7599: “<span class="quote">pre-configure</span>”
7600: target to achieve this. Alternatively, you could simply
1.45 wiz 7601: diff the file against <code xmlns=
7602: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7603: "filename">/dev/null</code> and use the patch mechanism
7604: to manage the creation of this file.</p>
7605: </div>
7606: </div>
7607:
1.67 hubertf 7608: <div class="chapter" lang="en">
1.27 rillig 7609: <div class="titlepage">
7610: <div>
7611: <div>
1.67 hubertf 7612: <h2 class="title"><a name=
1.38 dillo 7613: "makefile"></a>Chapter 9. Programming in
1.45 wiz 7614: <code xmlns=
7615: "http://www.w3.org/TR/xhtml1/transitional" class=
7616: "filename">Makefile</code>s</h2>
1.27 rillig 7617: </div>
7618: </div>
7619: </div>
7620:
7621: <div class="toc">
7622: <p><b>Table of Contents</b></p>
7623:
7624: <dl>
7625: <dt><span class="sect1"><a href=
1.45 wiz 7626: "#makefile.variables">9.1. <code xmlns=
7627: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7628: "filename">Makefile</code> variables</a></span></dt>
7629:
7630: <dd>
7631: <dl>
7632: <dt><span class="sect2"><a href=
1.38 dillo 7633: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 7634: conventions</a></span></dt>
7635: </dl>
7636: </dd>
7637:
1.38 dillo 7638: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 7639: Code snippets</a></span></dt>
7640:
7641: <dd>
7642: <dl>
1.30 wiz 7643: <dt><span class="sect2"><a href=
1.38 dillo 7644: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 7645: list</a></span></dt>
1.27 rillig 7646:
1.30 wiz 7647: <dt><span class="sect2"><a href=
1.38 dillo 7648: "#converting-internal-to-external">9.2.2.
1.27 rillig 7649: Converting an internal list into an external
7650: list</a></span></dt>
7651:
1.30 wiz 7652: <dt><span class="sect2"><a href=
1.38 dillo 7653: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 7654: variables to a shell command</a></span></dt>
1.27 rillig 7655:
1.30 wiz 7656: <dt><span class="sect2"><a href=
1.38 dillo 7657: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 7658: guideline</a></span></dt>
1.27 rillig 7659:
1.30 wiz 7660: <dt><span class="sect2"><a href=
1.38 dillo 7661: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 7662: bug in BSD Make</a></span></dt>
1.27 rillig 7663: </dl>
7664: </dd>
7665: </dl>
7666: </div>
7667:
1.45 wiz 7668: <p>Pkgsrc consists of many <code xmlns=
7669: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7670: "filename">Makefile</code> fragments, each of which forms a
7671: well-defined part of the pkgsrc system. Using the <a href=
7672: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7673: <span class="citerefentry"><span class=
7674: "refentrytitle">make</span>(1)</span></a> system as a
7675: programming language for a big system like pkgsrc requires
7676: some discipline to keep the code correct and
7677: understandable.</p>
7678:
1.45 wiz 7679: <p>The basic ingredients for <code xmlns=
7680: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7681: "filename">Makefile</code> programming are variables (which
7682: are actually macros) and shell commands. Among these shell
7683: commands may even be more complex ones like <a href=
7684: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
7685: <span class="citerefentry"><span class=
7686: "refentrytitle">awk</span>(1)</span></a> programs. To make
7687: sure that every shell command runs as intended it is
7688: necessary to quote all variables correctly when they are
7689: used.</p>
7690:
7691: <p>This chapter describes some patterns, that appear quite
1.45 wiz 7692: often in <code xmlns=
7693: "http://www.w3.org/TR/xhtml1/transitional" class=
7694: "filename">Makefile</code>s, including the pitfalls that
7695: come along with them.</p>
1.27 rillig 7696:
1.67 hubertf 7697: <div class="sect1" lang="en">
1.27 rillig 7698: <div class="titlepage">
7699: <div>
7700: <div>
7701: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7702: "makefile.variables"></a>9.1. <code xmlns=
7703: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7704: "filename">Makefile</code> variables</h2>
7705: </div>
7706: </div>
7707: </div>
7708:
1.45 wiz 7709: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7710: class="filename">Makefile</code> variables contain
7711: strings that can be processed using the five operators
7712: ``='', ``+='', ``?='', ``:='', and ``!='', which are
7713: described in the <a href=
1.27 rillig 7714: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7715: <span class="citerefentry"><span class=
7716: "refentrytitle">make</span>(1)</span></a> man page.</p>
7717:
1.45 wiz 7718: <p>When a variable's value is parsed from a <code xmlns=
7719: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7720: "filename">Makefile</code>, the hash character ``#'' and
7721: the backslash character ``\'' are handled specially. If a
7722: backslash is followed by a newline, any whitespace
7723: immediately in front of the backslash, the backslash, the
7724: newline, and any whitespace immediately behind the
7725: newline are replaced with a single space. A backspace
7726: character and an immediately following hash character are
1.47 reed 7727: replaced with a single hash character. Otherwise, the
1.27 rillig 7728: backslash is passed as is. In a variable assignment, any
7729: hash character that is not preceded by a backslash starts
7730: a comment that continues upto the end of the logical
7731: line.</p>
7732:
7733: <p><span class="emphasis"><em>Note:</em></span> Because
7734: of this parsing algorithm the only way to create a
7735: variable consisting of a single backslash is using the
7736: ``!='' operator, for example: <code class=
7737: "varname">BACKSLASH!=echo "\\"</code>.</p>
7738:
7739: <p>So far for defining variables. The other thing you can
7740: do with variables is evaluating them. A variable is
7741: evaluated when it is part of the right side of the ``:=''
7742: or the ``!='' operator, or directly before executing a
7743: shell command which the variable is part of. In all other
1.47 reed 7744: cases, <a href=
1.27 rillig 7745: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7746: <span class="citerefentry"><span class=
7747: "refentrytitle">make</span>(1)</span></a> performs lazy
7748: evaluation, that is, variables are not evaluated until
7749: there's no other way. The ``modifiers'' mentioned in the
7750: man page also evaluate the variable.</p>
7751:
7752: <p>Some of the modifiers split the string into words and
7753: then operate on the words, others operate on the string
1.47 reed 7754: as a whole. When a string is split into words, it is
7755: split as you would expect it from <a href=
1.27 rillig 7756: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
7757: <span class="citerefentry"><span class=
7758: "refentrytitle">sh</span>(1)</span></a>.</p>
7759:
7760: <p>No rule without exception—the
7761: <span><strong class="command">.for</strong></span> loop
7762: does not follow the shell quoting rules but splits at
7763: sequences of whitespace.</p>
7764:
7765: <p>There are several types of variables that should be
7766: handled differently. Strings and two types of lists.</p>
7767:
7768: <div class="itemizedlist">
7769: <ul type="disc">
7770: <li>
7771: <p><span class="emphasis"><em>Strings</em></span>
1.47 reed 7772: can contain arbitrary characters. Nevertheless, you
1.27 rillig 7773: should restrict yourself to only using printable
7774: characters. Examples are <code class=
7775: "varname">PREFIX</code> and <code class=
7776: "varname">COMMENT</code>.</p>
7777: </li>
7778:
7779: <li>
7780: <p><span class="emphasis"><em>Internal
7781: lists</em></span> are lists that are never exported
7782: to any shell command. Their elements are separated
1.47 reed 7783: by whitespace. Therefore, the elements themselves
1.27 rillig 7784: cannot have embedded whitespace. Any other
7785: characters are allowed. Internal lists can be used
7786: in <span><strong class=
7787: "command">.for</strong></span> loops. Examples are
7788: <code class="varname">DEPENDS</code> and
7789: <code class="varname">BUILD_DEPENDS</code>.</p>
7790: </li>
7791:
7792: <li>
7793: <p><span class="emphasis"><em>External
7794: lists</em></span> are lists that may be exported to
7795: a shell command. Their elements can contain any
7796: characters, including whitespace. That's why they
7797: cannot be used in <span><strong class=
7798: "command">.for</strong></span> loops. Examples are
7799: <code class="varname">DISTFILES</code> and
7800: <code class="varname">MASTER_SITES</code>.</p>
7801: </li>
7802: </ul>
7803: </div>
7804:
1.67 hubertf 7805: <div class="sect2" lang="en">
1.27 rillig 7806: <div class="titlepage">
7807: <div>
7808: <div>
7809: <h3 class="title"><a name=
1.38 dillo 7810: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 7811: conventions</h3>
7812: </div>
7813: </div>
7814: </div>
7815:
7816: <div class="itemizedlist">
7817: <ul type="disc">
7818: <li>
7819: <p>All variable names starting with an underscore
7820: are reserved for use by the pkgsrc
7821: infrastructure. They shall not be used by package
1.45 wiz 7822: <code xmlns=
7823: "http://www.w3.org/TR/xhtml1/transitional" class=
7824: "filename">Makefile</code>s.</p>
1.27 rillig 7825: </li>
7826:
7827: <li>
7828: <p>In <span><strong class=
7829: "command">.for</strong></span> loops you should
7830: use lowercase variable names for the iteration
7831: variables.</p>
7832: </li>
7833:
7834: <li>
7835: <p>All list variables should have a ``plural''
7836: name, e.g. <code class=
7837: "varname">PKG_OPTIONS</code> or <code class=
7838: "varname">DISTFILES</code>.</p>
7839: </li>
7840: </ul>
7841: </div>
7842: </div>
7843: </div>
7844:
1.67 hubertf 7845: <div class="sect1" lang="en">
1.27 rillig 7846: <div class="titlepage">
7847: <div>
7848: <div>
7849: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7850: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 7851: </div>
7852: </div>
7853: </div>
7854:
7855: <p>This section presents you with some code snippets you
7856: should use in your own code. If you don't find anything
7857: appropriate here, you should test your code and add it
7858: here.</p>
7859:
1.67 hubertf 7860: <div class="sect2" lang="en">
1.27 rillig 7861: <div class="titlepage">
7862: <div>
7863: <div>
1.67 hubertf 7864: <h3 class="title"><a name=
1.38 dillo 7865: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 7866: a list</h3>
1.27 rillig 7867: </div>
7868: </div>
7869: </div>
7870: <pre class="programlisting">
1.51 rillig 7871: STRING= foo * bar `date`
7872: INT_LIST= # empty
7873: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
7874: EXT_LIST= # empty
7875: ANOTHER_EXT_LIST= a=b c=d
7876:
7877: INT_LIST+= ${STRING} # 1
7878: INT_LIST+= ${ANOTHER_INT_LIST} # 2
7879: EXT_LIST+= ${STRING:Q} # 3
7880: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
1.27 rillig 7881: </pre>
7882:
7883: <p>When you add a string to an external list (example
7884: 3), it must be quoted. In all other cases, you must not
7885: add a quoting level. You must not merge internal and
7886: external lists, unless you are sure that all entries
7887: are correctly interpreted in both lists.</p>
7888: </div>
7889:
1.67 hubertf 7890: <div class="sect2" lang="en">
1.27 rillig 7891: <div class="titlepage">
7892: <div>
7893: <div>
1.30 wiz 7894: <h3 class="title"><a name=
1.38 dillo 7895: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 7896: an internal list into an external list</h3>
1.27 rillig 7897: </div>
7898: </div>
7899: </div>
7900: <pre class="programlisting">
1.51 rillig 7901: EXT_LIST= # empty
7902: .for i in ${INT_LIST}
7903: EXT_LIST+= ${i:Q}""
7904: .endfor
1.27 rillig 7905: </pre>
7906:
7907: <p>This code converts the internal list <code class=
7908: "varname">INT_LIST</code> into the external list
7909: <code class="varname">EXT_LIST</code>. As the elements
7910: of an internal list are unquoted they must be quoted
7911: here. The reason for appending <code class=
7912: "varname">""</code> is explained below.</p>
7913: </div>
1.1 grant 7914:
1.67 hubertf 7915: <div class="sect2" lang="en">
1.27 rillig 7916: <div class="titlepage">
1.1 grant 7917: <div>
1.27 rillig 7918: <div>
1.30 wiz 7919: <h3 class="title"><a name=
1.38 dillo 7920: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 7921: variables to a shell command</h3>
1.27 rillig 7922: </div>
1.1 grant 7923: </div>
7924: </div>
1.27 rillig 7925: <pre class="programlisting">
1.51 rillig 7926: STRING= foo bar < > * `date` $$HOME ' "
7927: EXT_LIST= string=${STRING:Q} x=second\ item
1.27 rillig 7928:
1.51 rillig 7929: all:
7930: echo ${STRING} # 1
7931: echo "${STRING}" # 2
7932: echo "${STRING:Q}" # 3
7933: echo ${STRING:Q} # 4
7934: echo x${STRING:Q} | sed 1s,.,, # 5
7935: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27 rillig 7936: </pre>
7937:
7938: <p>Example 1 leads to a syntax error in the shell, as
7939: the characters are just copied.</p>
7940:
7941: <p>Example 2 leads to a syntax error too, and if you
7942: leave out the last " character from <code class=
7943: "varname">${STRING}</code>, <a href=
7944: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
7945: <span class="citerefentry"><span class=
7946: "refentrytitle">date</span>(1)</span></a> will be
7947: executed. The <code class="varname">$HOME</code> shell
7948: variable would be evaluated, too.</p>
7949:
7950: <p>Example 3 outputs each space character preceded by a
7951: backslash (or not), depending on the implementation of
7952: the <a href=
7953: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7954: <span class="citerefentry"><span class=
7955: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 7956:
1.27 rillig 7957: <p>Example 4 handles correctly every string that does
7958: not start with a dash. In that case, the result depends
7959: on the implementation of the <a href=
7960: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7961: <span class="citerefentry"><span class=
7962: "refentrytitle">echo</span>(1)</span></a> command. As
7963: long as you can guarantee that your input does not
1.47 reed 7964: start with a dash, this form is appropriate.</p>
1.1 grant 7965:
1.27 rillig 7966: <p>Example 5 handles even the case of a leading dash
7967: correctly.</p>
1.1 grant 7968:
1.27 rillig 7969: <p>The <code class="varname">EXT_LIST</code> does not
1.47 reed 7970: need to be quoted because the quoting has already been
1.27 rillig 7971: done when adding elements to the list.</p>
1.1 grant 7972:
1.27 rillig 7973: <p>As internal lists shall not be passed to the shell,
7974: there is no example for it.</p>
1.1 grant 7975: </div>
7976:
1.67 hubertf 7977: <div class="sect2" lang="en">
1.27 rillig 7978: <div class="titlepage">
1.1 grant 7979: <div>
1.27 rillig 7980: <div>
1.67 hubertf 7981: <h3 class="title"><a name=
1.38 dillo 7982: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 7983: guideline</h3>
7984: </div>
1.1 grant 7985: </div>
7986: </div>
7987:
1.27 rillig 7988: <p>There are many possible sources of wrongly quoted
7989: variables. This section lists some of the commonly
7990: known ones.</p>
1.1 grant 7991:
1.27 rillig 7992: <div class="itemizedlist">
7993: <ul type="disc">
7994: <li>
7995: <p>Whenever you use the value of a list, think
7996: about what happens to leading or trailing
7997: whitespace. If the list is a well-formed shell
1.47 reed 7998: expression, you can apply the <code class=
1.27 rillig 7999: "varname">:M*</code> modifier to strip leading
8000: and trailing whitespace from each word. The
8001: <code class="varname">:M</code> operator first
8002: splits its argument according to the rules of the
8003: shell, and then creates a new list consisting of
8004: all words that match the shell glob expression
8005: <code class="varname">*</code>, that is: all. One
8006: class of situations where this is needed is when
8007: adding a variable like <code class=
8008: "varname">CPPFLAGS</code> to <code class=
8009: "varname">CONFIGURE_ARGS</code>. If the configure
1.47 reed 8010: script invokes other configure scripts, it strips
1.27 rillig 8011: the leading and trailing whitespace from the
8012: variable and then passes it to the other
8013: configure scripts. But these configure scripts
8014: expect the (child) <code class=
8015: "varname">CPPFLAGS</code> variable to be the same
8016: as the parent <code class=
8017: "varname">CPPFLAGS</code>. That's why we better
8018: pass the <code class="varname">CPPFLAGS</code>
8019: value properly trimmed. And here is how we do
8020: it:</p>
8021: <pre class="programlisting">
1.51 rillig 8022: CPPFLAGS= # empty
8023: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
8024: CPPFLAGS+= ${MY_CPPFLAGS}
8025:
8026: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
8027:
8028: all:
8029: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
8030: echo x${CONFIGURE_ARGS}x # properly trimmed
1.27 rillig 8031: </pre>
8032: </li>
1.1 grant 8033:
1.27 rillig 8034: <li>
8035: <p>The example above contains one bug: The
8036: <code class="varname">${PREFIX}</code> is a
8037: properly quoted shell expression, but there is
8038: the C compiler after it, which also expects a
8039: properly quoted string (this time in C syntax).
8040: The version above is therefore only correct if
8041: <code class="varname">${PREFIX}</code> does not
8042: have embedded backslashes or double quotes. If
8043: you want to allow these, you have to add another
8044: layer of quoting to each variable that is used as
8045: a C string literal. You cannot use the
8046: <code class="varname">:Q</code> operator for it,
8047: as this operator only works for the shell.</p>
8048: </li>
1.1 grant 8049:
1.27 rillig 8050: <li>
1.47 reed 8051: <p>Whenever a variable can be empty, the
1.27 rillig 8052: <code class="varname">:Q</code> operator can have
8053: surprising results. Here are two completely
8054: different cases which can be solved with the same
8055: trick.</p>
8056: <pre class="programlisting">
1.51 rillig 8057: EMPTY= # empty
8058: empty_test:
8059: for i in a ${EMPTY:Q} c; do \
8060: echo "$$i"; \
8061: done
8062:
8063: for_test:
8064: .for i in a:\ a:\test.txt
8065: echo ${i:Q}
8066: echo "foo"
8067: .endfor
1.1 grant 8068: </pre>
8069:
1.27 rillig 8070: <p>The first example will only print two of the
8071: three lines we might have expected. This is
8072: because <code class="varname">${EMPTY:Q}</code>
8073: expands to the empty string, which the shell
8074: cannot see. The workaround is to write
8075: <code class="varname">${EMPTY:Q}""</code>. This
8076: pattern can be often found as <code class=
8077: "varname">${TEST} -z ${VAR:Q}</code> or as
8078: <code class="varname">${TEST} -f
8079: ${FNAME:Q}</code> (both of these are wrong).</p>
8080:
8081: <p>The second example will only print three lines
8082: instead of four. The first line looks like
8083: <code class="varname">a:\ echo foo</code>. This
8084: is because the backslash of the value
8085: <code class="varname">a:\</code> is interpreted
8086: as a line-continuation by <a href=
8087: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8088: <span class="citerefentry"><span class=
8089: "refentrytitle">make</span>(1)</span></a>, which
8090: makes the second line the arguments of the
8091: <a href=
8092: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
8093: <span class="citerefentry"><span class=
8094: "refentrytitle">echo</span>(1)</span></a> command
8095: from the first line. To avoid this, write
8096: <code class="varname">${i:Q}""</code>.</p>
8097: </li>
8098: </ul>
8099: </div>
1.1 grant 8100: </div>
8101:
1.67 hubertf 8102: <div class="sect2" lang="en">
1.27 rillig 8103: <div class="titlepage">
1.1 grant 8104: <div>
1.27 rillig 8105: <div>
1.30 wiz 8106: <h3 class="title"><a name=
1.38 dillo 8107: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 8108: for a bug in BSD Make</h3>
1.27 rillig 8109: </div>
1.1 grant 8110: </div>
8111: </div>
8112:
1.27 rillig 8113: <p>The pkgsrc bmake program does not handle the
8114: following assignment correctly. In case <code class=
8115: "varname">_othervar_</code> contains a ``-'' character,
8116: one of the closing braces is included in <code class=
8117: "varname">${VAR}</code> after this code executes.</p>
8118: <pre class="programlisting">
1.51 rillig 8119: VAR:= ${VAR:N${_othervar_:C/-//}}
1.1 grant 8120: </pre>
8121:
1.27 rillig 8122: <p>For a more complex code snippet and a workaround,
8123: see the package <a xmlns=
8124: "http://www.w3.org/TR/xhtml1/transitional" href=
8125: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45 wiz 8126: target="_top"><code xmlns="" class=
8127: "filename">regress/make-quoting</code></a>, testcase
1.27 rillig 8128: <code class="varname">bug1</code>.</p>
1.1 grant 8129: </div>
8130: </div>
8131: </div>
8132:
1.67 hubertf 8133: <div class="chapter" lang="en">
1.1 grant 8134: <div class="titlepage">
8135: <div>
8136: <div>
1.67 hubertf 8137: <h2 class="title"><a name=
1.38 dillo 8138: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 8139: </div>
8140: </div>
8141: </div>
8142:
8143: <div class="toc">
8144: <p><b>Table of Contents</b></p>
8145:
8146: <dl>
1.38 dillo 8147: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 8148: ID</a></span></dt>
8149:
1.30 wiz 8150: <dt><span class="sect1"><a href=
1.38 dillo 8151: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 8152: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8153: class="filename">PLIST</code>
1.14 xtraeme 8154: generation</a></span></dt>
1.1 grant 8155:
1.38 dillo 8156: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 8157: Tweaking output of <span><strong class="command">make
8158: print-PLIST</strong></span></a></span></dt>
1.1 grant 8159:
1.38 dillo 8160: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 8161: Variable substitution in PLIST</a></span></dt>
8162:
1.30 wiz 8163: <dt><span class="sect1"><a href=
1.48 dillo 8164: "#manpage-compression">10.5. Man page
8165: compression</a></span></dt>
1.1 grant 8166:
1.38 dillo 8167: <dt><span class="sect1"><a href=
8168: "#using-PLIST_SRC">10.6. Changing PLIST source with
8169: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 8170:
1.30 wiz 8171: <dt><span class="sect1"><a href=
1.47 reed 8172: "#platform-specific-plist">10.7. Platform-specific and
1.30 wiz 8173: differing PLISTs</a></span></dt>
1.1 grant 8174:
1.38 dillo 8175: <dt><span class="sect1"><a href=
8176: "#faq.common-dirs">10.8. Sharing directories between
8177: packages</a></span></dt>
1.1 grant 8178: </dl>
8179: </div>
8180:
1.45 wiz 8181: <p>The <code xmlns=
8182: "http://www.w3.org/TR/xhtml1/transitional" class=
8183: "filename">PLIST</code> file contains a package's
8184: “<span class="quote">packing list</span>”, i.e.
8185: a list of files that belong to the package (relative to the
8186: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8187: class="filename">${PREFIX}</code> directory it's been
8188: installed in) plus some additional statements - see the
8189: <a href=
1.1 grant 8190: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
8191: <span class="citerefentry"><span class=
1.47 reed 8192: "refentrytitle">pkg_create</span>(1)</span></a> man page
8193: for a full list. This chapter addresses some issues that
8194: need attention when dealing with the <code xmlns=
1.45 wiz 8195: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8196: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 8197:
1.67 hubertf 8198: <div class="sect1" lang="en">
1.1 grant 8199: <div class="titlepage">
8200: <div>
8201: <div>
8202: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 8203: "rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 8204: </div>
8205: </div>
8206: </div>
8207:
8208: <p>Be sure to add a RCS ID line as the first thing in any
1.45 wiz 8209: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8210: class="filename">PLIST</code> file you write:</p>
1.1 grant 8211: <pre class="programlisting">
1.51 rillig 8212: @comment $NetBSD$
1.1 grant 8213: </pre>
8214: </div>
8215:
1.67 hubertf 8216: <div class="sect1" lang="en">
1.1 grant 8217: <div class="titlepage">
8218: <div>
8219: <div>
8220: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8221: "automatic-plist-generation"></a>10.2. Semi-automatic
1.45 wiz 8222: <code xmlns=
8223: "http://www.w3.org/TR/xhtml1/transitional" class=
8224: "filename">PLIST</code> generation</h2>
1.1 grant 8225: </div>
8226: </div>
8227: </div>
8228:
1.14 xtraeme 8229: <p>You can use the <span><strong class="command">make
8230: print-PLIST</strong></span> command to output a PLIST
8231: that matches any new files since the package was
8232: extracted. See <a href="#build.helpful-targets" title=
1.56 rillig 8233: "14.16. Other helpful targets">Section 14.16,
1.1 grant 8234: “Other helpful targets”</a> for more
8235: information on this target.</p>
8236: </div>
8237:
1.67 hubertf 8238: <div class="sect1" lang="en">
1.1 grant 8239: <div class="titlepage">
8240: <div>
8241: <div>
8242: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8243: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 8244: <span><strong class="command">make
8245: print-PLIST</strong></span></h2>
1.1 grant 8246: </div>
8247: </div>
8248: </div>
8249:
8250: <p>If you have used any of the *-dirs packages, as
8251: explained in <a href="#faq.common-dirs" title=
1.38 dillo 8252: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 8253: “Sharing directories between packages”</a>,
1.14 xtraeme 8254: you may have noticed that <span><strong class=
8255: "command">make print-PLIST</strong></span> outputs a set
8256: of <code class="varname">@comment</code>s instead of real
8257: <code class="varname">@dirrm</code> lines. You can also
8258: do this for specific directories and files, so that the
8259: results of that command are very close to reality. This
8260: helps <span class="emphasis"><em>a lot</em></span> during
8261: the update of packages.</p>
8262:
8263: <p>The <code class="varname">PRINT_PLIST_AWK</code>
8264: variable takes a set of AWK patterns and actions that are
8265: used to filter the output of print-PLIST. You can
8266: <span class="emphasis"><em>append</em></span> any chunk
8267: of AWK scripting you like to it, but be careful with
1.1 grant 8268: quoting.</p>
8269:
1.45 wiz 8270: <p>For example, to get all files inside the <code xmlns=
8271: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8272: "filename">libdata/foo</code> directory removed from the
1.1 grant 8273: resulting PLIST:</p>
8274: <pre class="programlisting">
1.51 rillig 8275: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 grant 8276: </pre>
8277:
1.14 xtraeme 8278: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 8279: lines referring to a specific (shared) directory
1.14 xtraeme 8280: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 8281: <pre class="programlisting">
1.51 rillig 8282: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1 grant 8283: </pre>
8284: </div>
8285:
1.67 hubertf 8286: <div class="sect1" lang="en">
1.1 grant 8287: <div class="titlepage">
8288: <div>
8289: <div>
8290: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8291: "plist.misc"></a>10.4. Variable substitution
8292: in PLIST</h2>
1.1 grant 8293: </div>
8294: </div>
8295: </div>
8296:
8297: <p>A number of variables are substituted automatically in
8298: PLISTs when a package is installed on a system. This
8299: includes the following variables:</p>
8300:
8301: <div class="variablelist">
8302: <dl>
1.14 xtraeme 8303: <dt><span class="term"><code class=
8304: "varname">${MACHINE_ARCH}</code>, <code class=
8305: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 8306:
8307: <dd>
8308: <p>Some packages like emacs and perl embed
8309: information about which architecture they were
8310: built on into the pathnames where they install
1.47 reed 8311: their files. To handle this case, PLIST will be
1.1 grant 8312: preprocessed before actually used, and the symbol
1.14 xtraeme 8313: “<span class="quote"><code class=
8314: "varname">${MACHINE_ARCH}</code></span>” will
8315: be replaced by what <span><strong class=
8316: "command">uname -p</strong></span> gives. The same
8317: is done if the string <code class=
8318: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
8319: PLIST somewhere - use this on packages that have
1.47 reed 8320: GNU autoconf-created configure scripts.</p>
1.1 grant 8321:
8322: <div class="note" style=
8323: "margin-left: 0.5in; margin-right: 0.5in;">
8324: <h3 class="title">Legacy note</h3>
8325:
8326: <p>There used to be a symbol “<span class=
1.14 xtraeme 8327: "quote"><code class=
8328: "varname">$ARCH</code></span>” that was
8329: replaced by the output of <span><strong class=
8330: "command">uname -m</strong></span>, but that's no
1.1 grant 8331: longer supported and has been removed.</p>
8332: </div>
8333: </dd>
8334:
1.14 xtraeme 8335: <dt><span class="term"><code class=
8336: "varname">${OPSYS}</code>, <code class=
8337: "varname">${LOWER_OPSYS}</code>, <code class=
8338: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 8339:
8340: <dd>
8341: <p>Some packages want to embed the OS name and
8342: version into some paths. To do this, use these
1.45 wiz 8343: variables in the <code xmlns=
8344: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8345: "filename">PLIST</code>:</p>
1.1 grant 8346:
8347: <div class="itemizedlist">
8348: <ul type="disc">
8349: <li>
1.14 xtraeme 8350: <p><code class="varname">${OPSYS}</code> -
8351: output of “<span class=
8352: "quote"><span><strong class="command">uname
8353: -s</strong></span></span>”</p>
1.1 grant 8354: </li>
8355:
8356: <li>
1.14 xtraeme 8357: <p><code class=
8358: "varname">${LOWER_OPSYS}</code> - lowercase
8359: common name (eg. “<span class=
8360: "quote">solaris</span>”)</p>
1.1 grant 8361: </li>
8362:
8363: <li>
1.14 xtraeme 8364: <p><code class="varname">${OS_VERSION}</code>
8365: - “<span class=
8366: "quote"><span><strong class="command">uname
8367: -r</strong></span></span>”</p>
1.1 grant 8368: </li>
8369: </ul>
8370: </div>
8371: </dd>
8372: </dl>
8373: </div>
8374:
8375: <p>For a complete list of values which are replaced by
1.45 wiz 8376: default, please look in <code xmlns=
8377: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8378: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 8379: "emphasis"><em>PLIST_SUBST</em></span>).</p>
8380:
8381: <p>If you want to change other variables not listed
8382: above, you can add variables and their expansions to this
1.14 xtraeme 8383: variable in the following way, similar to <code class=
8384: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 8385: "#components.optional" title=
1.38 dillo 8386: "8.5. Optional files">Section 8.5,
1.1 grant 8387: “Optional files”</a>):</p>
8388: <pre class="programlisting">
1.51 rillig 8389: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 grant 8390: </pre>
8391:
8392: <p>This replaces all occurrences of “<span class=
8393: "quote">${SOMEVAR}</span>” in the PLIST with
8394: “<span class="quote">somevalue</span>”.</p>
8395: </div>
8396:
1.67 hubertf 8397: <div class="sect1" lang="en">
1.1 grant 8398: <div class="titlepage">
8399: <div>
8400: <div>
8401: <h2 class="title" style="clear: both"><a name=
1.48 dillo 8402: "manpage-compression"></a>10.5. Man page
8403: compression</h2>
1.1 grant 8404: </div>
8405: </div>
8406: </div>
8407:
1.47 reed 8408: <p>Man pages should be installed in compressed form if
1.45 wiz 8409: <code class="varname">MANZ</code> is set (in <code xmlns=
8410: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8411: "filename">bsd.own.mk</code>), and uncompressed
1.45 wiz 8412: otherwise. To handle this in the <code xmlns=
8413: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8414: "filename">PLIST</code> file, the suffix
8415: “<span class="quote">.gz</span>” is
1.47 reed 8416: appended/removed automatically for man pages according to
1.14 xtraeme 8417: <code class="varname">MANZ</code> and <code class=
8418: "varname">MANCOMPRESSED</code> being set or not, see
1.45 wiz 8419: above for details. This modification of the <code xmlns=
8420: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8421: "filename">PLIST</code> file is done on a copy of it, not
1.45 wiz 8422: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8423: class="filename">PLIST</code> itself.</p>
1.1 grant 8424: </div>
8425:
1.67 hubertf 8426: <div class="sect1" lang="en">
1.1 grant 8427: <div class="titlepage">
8428: <div>
8429: <div>
8430: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8431: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 8432: source with <code class=
1.14 xtraeme 8433: "varname">PLIST_SRC</code></h2>
1.1 grant 8434: </div>
8435: </div>
8436: </div>
8437:
1.14 xtraeme 8438: <p>To use one or more files as source for the
1.45 wiz 8439: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8440: class="filename">PLIST</code> used in generating the
8441: binary package, set the variable <code class=
1.14 xtraeme 8442: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 8443: The files are later concatenated using <a href=
8444: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
8445: <span class="citerefentry"><span class=
8446: "refentrytitle">cat</span>(1)</span></a>, and order of
8447: things is important.</p>
1.1 grant 8448: </div>
8449:
1.67 hubertf 8450: <div class="sect1" lang="en">
1.1 grant 8451: <div class="titlepage">
8452: <div>
8453: <div>
8454: <h2 class="title" style="clear: both"><a name=
1.47 reed 8455: "platform-specific-plist"></a>10.7. Platform-specific
8456: and differing PLISTs</h2>
1.1 grant 8457: </div>
8458: </div>
8459: </div>
8460:
8461: <p>Some packages decide to install a different set of
8462: files based on the operating system being used. These
8463: differences can be automatically handled by using the
8464: following files:</p>
8465:
8466: <div class="itemizedlist">
8467: <ul type="disc">
8468: <li>
1.45 wiz 8469: <p><code xmlns=
8470: "http://www.w3.org/TR/xhtml1/transitional" class=
8471: "filename">PLIST.common</code></p>
1.1 grant 8472: </li>
8473:
8474: <li>
1.45 wiz 8475: <p><code xmlns=
8476: "http://www.w3.org/TR/xhtml1/transitional" class=
8477: "filename">PLIST.${OPSYS}</code></p>
1.1 grant 8478: </li>
8479:
8480: <li>
1.45 wiz 8481: <p><code xmlns=
8482: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 8483: "filename">PLIST.${MACHINE_ARCH}</code></p>
8484: </li>
8485:
8486: <li>
1.45 wiz 8487: <p><code xmlns=
8488: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 8489: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
8490: </li>
8491:
8492: <li>
1.45 wiz 8493: <p><code xmlns=
8494: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8495: "filename">PLIST.common_end</code></p>
1.1 grant 8496: </li>
8497: </ul>
8498: </div>
8499: </div>
8500:
1.67 hubertf 8501: <div class="sect1" lang="en">
1.1 grant 8502: <div class="titlepage">
8503: <div>
8504: <div>
8505: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8506: "faq.common-dirs"></a>10.8. Sharing
8507: directories between packages</h2>
1.1 grant 8508: </div>
8509: </div>
8510: </div>
8511:
8512: <p>A “<span class="quote">shared
8513: directory</span>” is a directory where multiple
8514: (and unrelated) packages install files. These directories
8515: are problematic because you have to add special tricks in
8516: the PLIST to conditionally remove them, or have some
8517: centralized package handle them.</p>
8518:
8519: <p>Within pkgsrc, you'll find both approaches. If a
8520: directory is shared by a few unrelated packages, it's
8521: often not worth to add an extra package to remove it.
8522: Therefore, one simply does:</p>
8523: <pre class="programlisting">
1.51 rillig 8524: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
1.1 grant 8525: </pre>
8526:
8527: <p>in the PLISTs of all affected packages, instead of the
8528: regular "@dirrm" line.</p>
8529:
8530: <p>However, if the directory is shared across many
8531: packages, two different solutions are available:</p>
8532:
8533: <div class="orderedlist">
8534: <ol type="1">
8535: <li>
8536: <p>If the packages have a common dependency, the
8537: directory can be removed in that. For example, see
8538: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8539: href=
8540: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45 wiz 8541: target="_top"><code xmlns="" class=
8542: "filename">textproc/scrollkeeper</code></a>, which
8543: removes the shared directory <code xmlns=
8544: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 8545: "filename">share/omf</code>.</p>
1.1 grant 8546: </li>
8547:
8548: <li>
8549: <p>If the packages using the directory are not
8550: related at all (they have no common dependencies),
8551: a *-dirs package is used.</p>
8552: </li>
8553: </ol>
8554: </div>
8555:
8556: <p>From now on, we'll discuss the second solution. To get
8557: an idea of the *-dirs packages available, issue:</p>
8558: <pre class="programlisting">
1.51 rillig 8559: <code class="prompt">%</code> cd .../pkgsrc
8560: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 8561: </pre>
8562:
8563: <p>Their use from other packages is very simple. The
1.14 xtraeme 8564: <code class="varname">USE_DIRS</code> variable takes a
8565: list of package names (without the “<span class=
1.1 grant 8566: "quote">-dirs</span>” part) together with the
8567: required version number (always pick the latest one when
1.34 wiz 8568: writing new packages).</p>
1.1 grant 8569:
8570: <p>For example, if a package installs files under
1.45 wiz 8571: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8572: class="filename">share/applications</code>, it should
8573: have the following line in it:</p>
1.1 grant 8574: <pre class="programlisting">
1.51 rillig 8575: USE_DIRS+= xdg-1.1
1.1 grant 8576: </pre>
8577:
1.14 xtraeme 8578: <p>After regenerating the PLIST using
8579: <span><strong class="command">make
8580: print-PLIST</strong></span>, you should get the right
8581: (commented out) lines.</p>
1.1 grant 8582:
1.47 reed 8583: <p>Note that even if your package is using <code xmlns=
1.45 wiz 8584: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8585: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 8586: *-x11-dirs packages. Just specify the name without that
1.45 wiz 8587: part and pkgsrc (in particular, <code xmlns=
8588: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8589: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 8590: </div>
8591: </div>
8592:
1.67 hubertf 8593: <div class="chapter" lang="en">
1.1 grant 8594: <div class="titlepage">
8595: <div>
8596: <div>
1.67 hubertf 8597: <h2 class="title"><a name=
1.38 dillo 8598: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 8599: methodology</h2>
8600: </div>
8601: </div>
8602: </div>
8603:
8604: <div class="toc">
8605: <p><b>Table of Contents</b></p>
8606:
8607: <dl>
1.30 wiz 8608: <dt><span class="sect1"><a href=
1.38 dillo 8609: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 8610: to use buildlink3</a></span></dt>
1.1 grant 8611:
1.30 wiz 8612: <dt><span class="sect1"><a href=
1.45 wiz 8613: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
8614: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8615: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 8616:
8617: <dd>
8618: <dl>
1.25 rillig 8619: <dt><span class="sect2"><a href=
1.38 dillo 8620: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 8621: buildlink3.mk file</a></span></dt>
1.1 grant 8622:
1.25 rillig 8623: <dt><span class="sect2"><a href=
1.38 dillo 8624: "#updating-buildlink-depends">11.2.2. Updating
1.72 ! rillig 8625: <code class=
! 8626: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 8627: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 8628: <code xmlns=
8629: "http://www.w3.org/TR/xhtml1/transitional" class=
8630: "filename">buildlink3.mk</code>
1.1 grant 8631: files</a></span></dt>
8632: </dl>
8633: </dd>
8634:
1.30 wiz 8635: <dt><span class="sect1"><a href=
1.45 wiz 8636: "#writing-builtin.mk">11.3. Writing <code xmlns=
8637: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8638: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 8639:
8640: <dd>
8641: <dl>
1.25 rillig 8642: <dt><span class="sect2"><a href=
1.38 dillo 8643: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 8644: <code xmlns=
8645: "http://www.w3.org/TR/xhtml1/transitional" class=
8646: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 8647:
1.25 rillig 8648: <dt><span class="sect2"><a href=
1.38 dillo 8649: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 8650: preferences for native or pkgsrc
8651: software</a></span></dt>
1.1 grant 8652: </dl>
8653: </dd>
8654: </dl>
8655: </div>
8656:
8657: <p>Buildlink is a framework in pkgsrc that controls what
8658: headers and libraries are seen by a package's configure and
8659: build processes. This is implemented in a two step
8660: process:</p>
8661:
8662: <div class="orderedlist">
8663: <ol type="1">
8664: <li>
8665: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 8666: into <code class="varname">BUILDLINK_DIR</code>,
8667: which by default is a subdirectory of <code class=
8668: "varname">WRKDIR</code>.</p>
1.1 grant 8669: </li>
8670:
8671: <li>
8672: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 8673: the normal compiler tools that translate <code class=
8674: "option">-I${LOCALBASE}/include</code> and
8675: <code class="option">-L${LOCALBASE}/lib</code> into
8676: references to <code class=
8677: "varname">BUILDLINK_DIR</code>. The wrapper scripts
8678: also make native compiler on some operating systems
8679: look like GCC, so that packages that expect GCC won't
8680: require modifications to build with those native
8681: compilers.</p>
1.1 grant 8682: </li>
8683: </ol>
8684: </div>
8685:
8686: <p>This normalizes the environment in which a package is
8687: built so that the package may be built consistently despite
8688: what other software may be installed. Please note that the
1.45 wiz 8689: normal system header and library paths, e.g. <code xmlns=
8690: "http://www.w3.org/TR/xhtml1/transitional" class=
8691: "filename">/usr/include</code>, <code xmlns=
8692: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8693: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 8694: buildlink3 is designed to insulate the package build from
8695: non-system-supplied software.</p>
8696:
1.67 hubertf 8697: <div class="sect1" lang="en">
1.1 grant 8698: <div class="titlepage">
8699: <div>
8700: <div>
8701: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8702: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 8703: packages to use buildlink3</h2>
1.1 grant 8704: </div>
8705: </div>
8706: </div>
8707:
8708: <p>The process of converting packages to use the
8709: buildlink3 framework (“<span class=
8710: "quote">bl3ifying</span>”) is fairly
8711: straightforward. The things to keep in mind are:</p>
8712:
8713: <div class="orderedlist">
8714: <ol type="1">
8715: <li>
8716: <p>Ensure that the build always calls the wrapper
8717: scripts instead of the actual toolchain. Some
8718: packages are tricky, and the only way to know for
1.45 wiz 8719: sure is the check <code xmlns=
8720: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8721: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 8722: wrappers are being invoked.</p>
8723: </li>
8724:
8725: <li>
1.14 xtraeme 8726: <p>Don't override <code class=
8727: "varname">PREFIX</code> from within the package
8728: Makefile, e.g. Java VMs, standalone shells, etc.,
1.45 wiz 8729: because the code to symlink files into <code xmlns=
8730: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8731: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 8732: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 8733: <em class=
8734: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 8735: </li>
8736:
8737: <li>
8738: <p>Remember that <span class=
1.45 wiz 8739: "emphasis"><em>only</em></span> the <code xmlns=
8740: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8741: "filename">buildlink3.mk</code> files that you list
1.1 grant 8742: in a package's Makefile are added as dependencies
8743: for that package.</p>
8744: </li>
8745: </ol>
8746: </div>
8747:
8748: <p>If a dependency on a particular package is required
8749: for its libraries and headers, then we replace:</p>
8750: <pre class="programlisting">
1.51 rillig 8751: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 8752: </pre>
8753:
8754: <p>with</p>
8755: <pre class="programlisting">
1.51 rillig 8756: .include "../../category/foo/buildlink3.mk"
1.1 grant 8757: </pre>
8758:
1.47 reed 8759: <p>The buildlink3.mk files usually define the required
8760: dependencies. If you need a newer version of the
8761: dependency when using buildlink3.mk files, then you can
8762: define it in your Makefile; for example:</p>
8763: <pre class="programlisting">
1.72 ! rillig 8764: BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
1.51 rillig 8765: .include "../../category/foo/buildlink3.mk"
1.47 reed 8766: </pre>
8767:
1.45 wiz 8768: <p>There are several <code xmlns=
8769: "http://www.w3.org/TR/xhtml1/transitional" class=
8770: "filename">buildlink3.mk</code> files in <code xmlns=
8771: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8772: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 8773: issues:</p>
8774:
8775: <div class="itemizedlist">
8776: <ul type="disc">
8777: <li>
1.45 wiz 8778: <p><code xmlns=
8779: "http://www.w3.org/TR/xhtml1/transitional" class=
8780: "filename">bdb.buildlink3.mk</code> chooses either
8781: the native or a pkgsrc Berkeley DB implementation
8782: based on the values of <code class=
1.14 xtraeme 8783: "varname">BDB_ACCEPTED</code> and <code class=
8784: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 8785: </li>
8786:
8787: <li>
1.45 wiz 8788: <p><code xmlns=
8789: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 8790: "filename">curses.buildlink3.mk</code>: If the
1.14 xtraeme 8791: system comes with neither Curses nor NCurses, this
8792: will take care to install the <a xmlns=
8793: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 8794: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45 wiz 8795: target="_top"><code xmlns="" class=
8796: "filename">devel/ncurses</code></a> package.</p>
1.1 grant 8797: </li>
8798:
8799: <li>
1.45 wiz 8800: <p><code xmlns=
8801: "http://www.w3.org/TR/xhtml1/transitional" class=
8802: "filename">krb5.buildlink3.mk</code> uses the value
8803: of <code class="varname">KRB5_ACCEPTED</code> to
8804: choose between adding a dependency on Heimdal or
8805: MIT-krb5 for packages that require a Kerberos 5
1.1 grant 8806: implementation.</p>
8807: </li>
8808:
8809: <li>
1.45 wiz 8810: <p><code xmlns=
8811: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8812: "filename">motif.buildlink3.mk</code> checks for a
8813: system-provided Motif installation or adds a
8814: dependency on <a xmlns=
1.1 grant 8815: "http://www.w3.org/TR/xhtml1/transitional" href=
8816: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45 wiz 8817: target="_top"><code xmlns="" class=
8818: "filename">x11/lesstif</code></a> or <a xmlns=
1.20 ben 8819: "http://www.w3.org/TR/xhtml1/transitional" href=
8820: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45 wiz 8821: target="_top"><code xmlns="" class=
1.47 reed 8822: "filename">x11/openmotif</code></a>.</p>
1.1 grant 8823: </li>
8824:
8825: <li>
1.45 wiz 8826: <p><code xmlns=
8827: "http://www.w3.org/TR/xhtml1/transitional" class=
1.71 wiz 8828: "filename">oss.buildlink3.mk</code> defines several
8829: variables that may be used by packages that use the
8830: Open Sound System (OSS) API.</p>
1.1 grant 8831: </li>
8832:
8833: <li>
1.45 wiz 8834: <p><code xmlns=
8835: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8836: "filename">pgsql.buildlink3.mk</code> will accept
8837: either Postgres 7.3 or 7.4, whichever is found
8838: installed. See the file for more information.</p>
1.1 grant 8839: </li>
8840:
8841: <li>
1.45 wiz 8842: <p><code xmlns=
8843: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8844: "filename">pthread.buildlink3.mk</code> uses the
8845: value of <code class="varname">PTHREAD_OPTS</code>
8846: and checks for native pthreads or adds a dependency
8847: on <a xmlns=
1.1 grant 8848: "http://www.w3.org/TR/xhtml1/transitional" href=
8849: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45 wiz 8850: target="_top"><code xmlns="" class=
1.47 reed 8851: "filename">devel/pth</code></a> as needed.</p>
1.1 grant 8852: </li>
8853:
8854: <li>
1.45 wiz 8855: <p><code xmlns=
8856: "http://www.w3.org/TR/xhtml1/transitional" class=
8857: "filename">xaw.buildlink3.mk</code> uses the value
8858: of <code class="varname">XAW_TYPE</code> to choose
8859: a particular Athena widgets library.</p>
1.1 grant 8860: </li>
8861: </ul>
8862: </div>
8863:
1.45 wiz 8864: <p>The comments in those <code xmlns=
8865: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8866: "filename">buildlink3.mk</code> files provide a more
1.1 grant 8867: complete description of how to use them properly.</p>
8868: </div>
8869:
1.67 hubertf 8870: <div class="sect1" lang="en">
1.1 grant 8871: <div class="titlepage">
8872: <div>
8873: <div>
8874: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8875: "creating-buildlink3.mk"></a>11.2. Writing
1.45 wiz 8876: <code xmlns=
8877: "http://www.w3.org/TR/xhtml1/transitional" class=
8878: "filename">buildlink3.mk</code> files</h2>
1.1 grant 8879: </div>
8880: </div>
8881: </div>
8882:
1.45 wiz 8883: <p>A package's <code xmlns=
8884: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8885: "filename">buildlink3.mk</code> file is included by
8886: Makefiles to indicate the need to compile and link
8887: against header files and libraries provided by the
1.45 wiz 8888: package. A <code xmlns=
8889: "http://www.w3.org/TR/xhtml1/transitional" class=
8890: "filename">buildlink3.mk</code> file should always
8891: provide enough information to add the correct type of
8892: dependency relationship and include any other
8893: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8894: class="filename">buildlink3.mk</code> files that it needs
8895: to find headers and libraries that it needs in turn.</p>
1.1 grant 8896:
1.45 wiz 8897: <p>To generate an initial <code xmlns=
8898: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8899: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 8900: Rene Hexel's <a xmlns=
8901: "http://www.w3.org/TR/xhtml1/transitional" href=
8902: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45 wiz 8903: target="_top"><code xmlns="" class=
8904: "filename">pkgtools/createbuildlink</code></a> package is
1.20 ben 8905: highly recommended. For most packages, the following
8906: command will generate a good starting point for
1.45 wiz 8907: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8908: class="filename">buildlink3.mk</code> files:</p>
1.1 grant 8909: <pre class="screen">
1.14 xtraeme 8910: <code class="prompt">%</code> <strong class=
8911: "userinput"><code>cd pkgsrc/<em class=
8912: "replaceable"><code>category</code></em>/<em class=
8913: "replaceable"><code>pkgdir</code></em>
8914: <code class=
1.49 rillig 8915: "prompt">%</code> createbuildlink >buildlink3.mk</code></strong>
1.1 grant 8916: </pre>
8917:
1.67 hubertf 8918: <div class="sect2" lang="en">
1.1 grant 8919: <div class="titlepage">
8920: <div>
8921: <div>
1.67 hubertf 8922: <h3 class="title"><a name=
8923: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 8924: buildlink3.mk file</h3>
1.1 grant 8925: </div>
8926: </div>
8927: </div>
8928:
1.45 wiz 8929: <p>The following real-life example <code xmlns=
8930: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8931: "filename">buildlink3.mk</code> is taken from
1.45 wiz 8932: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8933: class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 8934: <pre class="programlisting">
1.51 rillig 8935: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 8936:
1.51 rillig 8937: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
8938: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
1.1 grant 8939:
1.51 rillig 8940: .if !empty(BUILDLINK_DEPTH:M+)
8941: BUILDLINK_DEPENDS+= tiff
8942: .endif
1.1 grant 8943:
1.51 rillig 8944: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
8945: BUILDLINK_PACKAGES+= tiff
1.1 grant 8946:
1.51 rillig 8947: .if !empty(TIFF_BUILDLINK3_MK:M+)
1.72 ! rillig 8948: BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
1.51 rillig 8949: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
8950: .endif # TIFF_BUILDLINK3_MK
1.1 grant 8951:
1.51 rillig 8952: .include "../../devel/zlib/buildlink3.mk"
8953: .include "../../graphics/jpeg/buildlink3.mk"
1.1 grant 8954:
1.51 rillig 8955: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
1.1 grant 8956: </pre>
8957:
1.14 xtraeme 8958: <p>The header and footer manipulate <code class=
8959: "varname">BUILDLINK_DEPTH</code>, which is common
1.45 wiz 8960: across all <code xmlns=
8961: "http://www.w3.org/TR/xhtml1/transitional" class=
8962: "filename">buildlink3.mk</code> files and is used to
8963: track at what depth we are including <code xmlns=
8964: "http://www.w3.org/TR/xhtml1/transitional" class=
8965: "filename">buildlink3.mk</code> files.</p>
1.1 grant 8966:
8967: <p>The first section controls if the dependency on
1.14 xtraeme 8968: <em class="replaceable"><code>pkg</code></em> is added.
8969: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 8970: global list of packages for which dependencies are
8971: added by buildlink3.</p>
8972:
8973: <p>The second section advises pkgsrc that the
1.45 wiz 8974: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8975: class="filename">buildlink3.mk</code> file for
1.14 xtraeme 8976: <em class="replaceable"><code>pkg</code></em> has been
8977: included at some point. <code class=
8978: "varname">BUILDLINK_PACKAGES</code> is the global list
1.45 wiz 8979: of packages for which <code xmlns=
8980: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8981: "filename">buildlink3.mk</code> files have been
8982: included. It must <span class=
8983: "emphasis"><em>always</em></span> be appended to within
1.45 wiz 8984: a <code xmlns=
8985: "http://www.w3.org/TR/xhtml1/transitional" class=
8986: "filename">buildlink3.mk</code> file.</p>
1.1 grant 8987:
8988: <p>The third section is protected from multiple
1.14 xtraeme 8989: inclusion and controls how the dependency on <em class=
8990: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 8991: important variables are set in the section:</p>
8992:
8993: <div class="itemizedlist">
8994: <ul type="disc">
8995: <li>
1.14 xtraeme 8996: <p><code class=
1.72 ! rillig 8997: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 8998: "replaceable"><code>pkg</code></em></code> is the
8999: actual dependency recorded in the installed
9000: package; this should always be set using
9001: <span><strong class="command">+=</strong></span>
9002: to ensure that we're appending to any
9003: pre-existing list of values. This variable should
9004: be set to the first version of the package that
1.72 ! rillig 9005: had an API change.</p>
1.1 grant 9006: </li>
9007:
9008: <li>
1.14 xtraeme 9009: <p><code class=
9010: "varname">BUILDLINK_PKGSRCDIR.<em class=
9011: "replaceable"><code>pkg</code></em></code> is the
9012: location of the <em class=
9013: "replaceable"><code>pkg</code></em> pkgsrc
1.47 reed 9014: directory.</p>
1.1 grant 9015: </li>
9016:
9017: <li>
1.14 xtraeme 9018: <p><code class=
9019: "varname">BUILDLINK_DEPMETHOD.<em class=
9020: "replaceable"><code>pkg</code></em></code> (not
9021: shown above) controls whether we use <code class=
9022: "varname">BUILD_DEPENDS</code> or <code class=
9023: "varname">DEPENDS</code> to add the dependency on
9024: <em class="replaceable"><code>pkg</code></em>.
9025: The build dependency is selected by setting
9026: <code class=
9027: "varname">BUILDLINK_DEPMETHOD.<em class=
9028: "replaceable"><code>pkg</code></em></code> to
1.1 grant 9029: “<span class="quote">build</span>”.
9030: By default, the full dependency is used.</p>
9031: </li>
9032:
9033: <li>
1.14 xtraeme 9034: <p><code class=
9035: "varname">BUILDLINK_INCDIRS.<em class=
9036: "replaceable"><code>pkg</code></em></code> and
9037: <code class=
1.67 hubertf 9038: "varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
9039: (not shown above) are lists of subdirectories of
9040: <code xmlns=
1.45 wiz 9041: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9042: "filename">${BUILDLINK_PREFIX.<em class=
9043: "replaceable"><code>pkg</code></em>}</code> to
9044: add to the header and library search paths. These
1.1 grant 9045: default to “<span class=
9046: "quote">include</span>” and
9047: “<span class="quote">lib</span>”
9048: respectively.</p>
9049: </li>
9050:
9051: <li>
1.14 xtraeme 9052: <p><code class=
9053: "varname">BUILDLINK_CPPFLAGS.<em class=
9054: "replaceable"><code>pkg</code></em></code> (not
9055: shown above) is the list of preprocessor flags to
9056: add to <code class="varname">CPPFLAGS</code>,
9057: which are passed on to the configure and build
9058: phases. The “<span class=
9059: "quote">-I</span>” option should be avoided
9060: and instead be handled using <code class=
9061: "varname">BUILDLINK_INCDIRS.<em class=
9062: "replaceable"><code>pkg</code></em></code> as
9063: above.</p>
1.1 grant 9064: </li>
9065: </ul>
9066: </div>
9067:
9068: <p>The following variables are all optionally defined
9069: within this second section (protected against multiple
9070: inclusion) and control which package files are
1.45 wiz 9071: symlinked into <code xmlns=
9072: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9073: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 9074: are transformed during the symlinking:</p>
9075:
9076: <div class="itemizedlist">
9077: <ul type="disc">
9078: <li>
1.14 xtraeme 9079: <p><code class=
9080: "varname">BUILDLINK_FILES.<em class=
9081: "replaceable"><code>pkg</code></em></code> (not
9082: shown above) is a shell glob pattern relative to
1.45 wiz 9083: <code xmlns=
9084: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9085: "filename">${BUILDLINK_PREFIX.<em class=
9086: "replaceable"><code>pkg</code></em>}</code> to be
1.45 wiz 9087: symlinked into <code xmlns=
9088: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9089: "filename">${BUILDLINK_DIR}</code>, e.g.
1.45 wiz 9090: <code xmlns=
9091: "http://www.w3.org/TR/xhtml1/transitional" class=
9092: "filename">include/*.h</code>.</p>
1.1 grant 9093: </li>
9094:
9095: <li>
1.14 xtraeme 9096: <p><code class=
9097: "varname">BUILDLINK_FILES_CMD.<em class=
9098: "replaceable"><code>pkg</code></em></code> (not
9099: shown above) is a shell pipeline that outputs to
1.45 wiz 9100: stdout a list of files relative to <code xmlns=
9101: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9102: "filename">${BUILDLINK_PREFIX.<em class=
9103: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 9104: resulting files are to be symlinked into
1.45 wiz 9105: <code xmlns=
9106: "http://www.w3.org/TR/xhtml1/transitional" class=
9107: "filename">${BUILDLINK_DIR}</code>. By default,
9108: this takes the <code xmlns=
9109: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9110: "filename">+CONTENTS</code> of a <em class=
9111: "replaceable"><code>pkg</code></em> and filters
9112: it through <code class=
9113: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
9114: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 9115: </li>
9116:
9117: <li>
1.14 xtraeme 9118: <p><code class=
9119: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
9120: "replaceable"><code>pkg</code></em></code> (not
9121: shown above) is a filter command that filters
1.45 wiz 9122: <code xmlns=
9123: "http://www.w3.org/TR/xhtml1/transitional" class=
9124: "filename">+CONTENTS</code> input into a list of
9125: files relative to <code xmlns=
9126: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9127: "filename">${BUILDLINK_PREFIX.<em class=
9128: "replaceable"><code>pkg</code></em>}</code> on
9129: stdout. By default for overwrite packages,
9130: <code class=
9131: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
9132: "replaceable"><code>pkg</code></em></code>
1.45 wiz 9133: outputs the contents of the <code xmlns=
9134: "http://www.w3.org/TR/xhtml1/transitional" class=
9135: "filename">include</code> and <code xmlns=
9136: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9137: "filename">lib</code> directories in the package
1.45 wiz 9138: <code xmlns=
9139: "http://www.w3.org/TR/xhtml1/transitional" class=
9140: "filename">+CONTENTS</code>, and for pkgviews
9141: packages, it outputs any libtool archives in
9142: <code xmlns=
9143: "http://www.w3.org/TR/xhtml1/transitional" class=
9144: "filename">lib</code> directories.</p>
1.1 grant 9145: </li>
9146:
9147: <li>
1.14 xtraeme 9148: <p><code class=
9149: "varname">BUILDLINK_TRANSFORM.<em class=
9150: "replaceable"><code>pkg</code></em></code> (not
9151: shown above) is a list of sed arguments used to
1.1 grant 9152: transform the name of the source filename into a
1.14 xtraeme 9153: destination filename, e.g. <span><strong class=
1.1 grant 9154: "command">-e
1.14 xtraeme 9155: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 9156: </li>
9157: </ul>
9158: </div>
9159:
1.45 wiz 9160: <p>The last section includes any <code xmlns=
9161: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9162: "filename">buildlink3.mk</code> needed for <em class=
9163: "replaceable"><code>pkg</code></em>'s library
1.45 wiz 9164: dependencies. Including these <code xmlns=
9165: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9166: "filename">buildlink3.mk</code> files means that the
9167: headers and libraries for these dependencies are also
1.45 wiz 9168: symlinked into <code xmlns=
9169: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9170: "filename">${BUILDLINK_DIR}</code> whenever the
9171: <em class="replaceable"><code>pkg</code></em>
1.45 wiz 9172: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9173: class="filename">buildlink3.mk</code> file is
1.14 xtraeme 9174: included.</p>
1.1 grant 9175: </div>
9176:
1.67 hubertf 9177: <div class="sect2" lang="en">
1.1 grant 9178: <div class="titlepage">
9179: <div>
9180: <div>
1.30 wiz 9181: <h3 class="title"><a name=
1.67 hubertf 9182: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 9183: <code class=
1.72 ! rillig 9184: "varname">BUILDLINK_API_DEPENDS.<em class=
! 9185: "replaceable"><code>pkg</code></em></code> in
! 9186: <code xmlns=
1.45 wiz 9187: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 9188: "filename">buildlink3.mk</code> files</h3>
1.1 grant 9189: </div>
9190: </div>
9191: </div>
9192:
1.72 ! rillig 9193: <p>The situation that requires increasing the
1.14 xtraeme 9194: dependency listed in <code class=
1.72 ! rillig 9195: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 9196: "replaceable"><code>pkg</code></em></code> after a
1.72 ! rillig 9197: package update is when the API or interface to the
! 9198: header files change.</p>
1.1 grant 9199:
1.72 ! rillig 9200: <p>In this case, <code class=
! 9201: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 9202: "replaceable"><code>pkg</code></em></code> should be
9203: adjusted to require at least the new package version.
9204: In some cases, the packages that depend on this new
9205: version may need their <code class=
9206: "varname">PKGREVISION</code>s increased and, if they
1.45 wiz 9207: have <code xmlns=
9208: "http://www.w3.org/TR/xhtml1/transitional" class=
9209: "filename">buildlink3.mk</code> files, their
1.72 ! rillig 9210: <code class="varname">BUILDLINK_API_DEPENDS.<em class=
1.45 wiz 9211: "replaceable"><code>pkg</code></em></code> adjusted,
1.72 ! rillig 9212: too. This is needed so pkgsrc will require the correct
! 9213: package dependency and not settle for an older one when
! 9214: building the source.</p>
! 9215:
! 9216: <p><code class=
! 9217: "varname">BUILDLINK_ABI_DEPENDS.<em class=
! 9218: "replaceable"><code>pkg</code></em></code> should be
! 9219: increased when the binary interface or sonames (major
! 9220: number of the library version) of any installed shared
! 9221: libraries change. This is needed so that binary
! 9222: packages made using it will require the correct package
! 9223: dependency and not settle for an older one which will
! 9224: not contain the necessary shared libraries.</p>
! 9225:
! 9226: <p>See <a href="#dependencies" title=
! 9227: "16.1.4. Handling dependencies">Section 16.1.4,
! 9228: “Handling dependencies”</a> for more
! 9229: information about dependencies on other packages,
! 9230: including the <code class=
! 9231: "varname">BUILDLINK_ABI_DEPENDS</code> and <code class=
! 9232: "varname">ABI_DEPENDS</code> definitions.</p>
1.1 grant 9233:
9234: <p>Please take careful consideration before adjusting
1.72 ! rillig 9235: <code class="varname">BUILDLINK_API_DEPENDS.<em class=
! 9236: "replaceable"><code>pkg</code></em></code> or
! 9237: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class=
1.14 xtraeme 9238: "replaceable"><code>pkg</code></em></code> as we don't
9239: want to cause unneeded package deletions and rebuilds.
9240: In many cases, new versions of packages work just fine
1.72 ! rillig 9241: with older dependencies.</p>
! 9242:
! 9243: <p>Also it is not needed to set <code class=
! 9244: "varname">BUILDLINK_ABI_DEPENDS.<em class=
! 9245: "replaceable"><code>pkg</code></em></code> when it is
! 9246: identical to <code class=
! 9247: "varname">BUILDLINK_API_DEPENDS.<em class=
! 9248: "replaceable"><code>pkg</code></em></code>.</p>
1.1 grant 9249: </div>
9250: </div>
9251:
1.67 hubertf 9252: <div class="sect1" lang="en">
1.1 grant 9253: <div class="titlepage">
9254: <div>
9255: <div>
9256: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9257: "writing-builtin.mk"></a>11.3. Writing
1.45 wiz 9258: <code xmlns=
9259: "http://www.w3.org/TR/xhtml1/transitional" class=
9260: "filename">builtin.mk</code> files</h2>
1.1 grant 9261: </div>
9262: </div>
9263: </div>
9264:
9265: <p>Some packages in pkgsrc install headers and libraries
9266: that coincide with headers and libraries present in the
1.45 wiz 9267: base system. Aside from a <code xmlns=
9268: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9269: "filename">buildlink3.mk</code> file, these packages
1.45 wiz 9270: should also include a <code xmlns=
9271: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9272: "filename">builtin.mk</code> file that includes the
9273: necessary checks to decide whether using the built-in
9274: software or the pkgsrc software is appropriate.</p>
1.1 grant 9275:
9276: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 9277: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 9278:
9279: <div class="orderedlist">
9280: <ol type="1">
9281: <li>
1.14 xtraeme 9282: <p>It should set <code class=
9283: "varname">USE_BUILTIN.<em class=
9284: "replaceable"><code>pkg</code></em></code> to
9285: either “<span class="quote">yes</span>”
9286: or “<span class="quote">no</span>”
9287: after it is included.</p>
1.1 grant 9288: </li>
9289:
9290: <li>
9291: <p>It should <span class=
9292: "emphasis"><em>not</em></span> override any
1.14 xtraeme 9293: <code class="varname">USE_BUILTIN.<em class=
9294: "replaceable"><code>pkg</code></em></code> which is
1.45 wiz 9295: already set before the <code xmlns=
9296: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9297: "filename">builtin.mk</code> file is included.</p>
1.1 grant 9298: </li>
9299:
9300: <li>
9301: <p>It should be written to allow multiple
9302: inclusion. This is <span class=
9303: "emphasis"><em>very</em></span> important and takes
1.45 wiz 9304: careful attention to <code xmlns=
9305: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9306: "filename">Makefile</code> coding.</p>
1.1 grant 9307: </li>
9308: </ol>
9309: </div>
9310:
1.67 hubertf 9311: <div class="sect2" lang="en">
1.1 grant 9312: <div class="titlepage">
9313: <div>
9314: <div>
1.67 hubertf 9315: <h3 class="title"><a name=
1.38 dillo 9316: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.45 wiz 9317: of a <code xmlns=
9318: "http://www.w3.org/TR/xhtml1/transitional" class=
9319: "filename">builtin.mk</code> file</h3>
1.1 grant 9320: </div>
9321: </div>
9322: </div>
9323:
9324: <p>The following is the recommended template for
9325: builtin.mk files:</p>
9326: <pre class="programlisting">
1.51 rillig 9327: .if !defined(IS_BUILTIN.foo)
9328: #
9329: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
9330: # genuinely exists in the system or not.
9331: #
9332: IS_BUILTIN.foo?= no
9333:
9334: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
9335: # version can be determined.
9336: #
9337: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
9338: BUILTIN_PKG.foo?= foo-1.0
9339: . endif
9340: .endif # IS_BUILTIN.foo
9341:
9342: .if !defined(USE_BUILTIN.foo)
9343: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
9344: . if defined(BUILTIN_PKG.foo)
1.72 ! rillig 9345: . for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
1.51 rillig 9346: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
9347: USE_BUILTIN.foo!= \
9348: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
9349: ${ECHO} "yes"; \
9350: else \
9351: ${ECHO} "no"; \
9352: fi
9353: . endif
9354: . endfor
9355: . endif
9356: .endif # USE_BUILTIN.foo
9357:
9358: CHECK_BUILTIN.foo?= no
9359: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
9360: #
9361: # Here we place code that depends on whether USE_BUILTIN.foo is set to
9362: # "yes" or "no".
9363: #
9364: .endif # CHECK_BUILTIN.foo
1.1 grant 9365: </pre>
9366:
1.14 xtraeme 9367: <p>The first section sets <code class=
9368: "varname">IS_BUILTIN.<em class=
9369: "replaceable"><code>pkg</code></em></code> depending on
9370: if <em class="replaceable"><code>pkg</code></em> really
9371: exists in the base system. This should not be a base
9372: system software with similar functionality to
9373: <em class="replaceable"><code>pkg</code></em>; it
9374: should only be “<span class=
9375: "quote">yes</span>” if the actual package is
9376: included as part of the base system. This variable is
1.45 wiz 9377: only used internally within the <code xmlns=
9378: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9379: "filename">builtin.mk</code> file.</p>
9380:
9381: <p>The second section sets <code class=
9382: "varname">BUILTIN_PKG.<em class=
9383: "replaceable"><code>pkg</code></em></code> to the
9384: version of <em class=
9385: "replaceable"><code>pkg</code></em> in the base system
9386: if it exists (if <code class=
9387: "varname">IS_BUILTIN.<em class=
9388: "replaceable"><code>pkg</code></em></code> is
1.1 grant 9389: “<span class="quote">yes</span>”). This
1.14 xtraeme 9390: variable is only used internally within the
1.45 wiz 9391: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9392: class="filename">builtin.mk</code> file.</p>
1.1 grant 9393:
1.14 xtraeme 9394: <p>The third section sets <code class=
9395: "varname">USE_BUILTIN.<em class=
9396: "replaceable"><code>pkg</code></em></code> and is
9397: <span class="emphasis"><em>required</em></span> in all
1.45 wiz 9398: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9399: class="filename">builtin.mk</code> files. The code in
9400: this section must make the determination whether the
9401: built-in software is adequate to satisfy the
9402: dependencies listed in <code class=
1.72 ! rillig 9403: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 9404: "replaceable"><code>pkg</code></em></code>. This is
9405: typically done by comparing <code class=
9406: "varname">BUILTIN_PKG.<em class=
9407: "replaceable"><code>pkg</code></em></code> against each
9408: of the dependencies in <code class=
1.72 ! rillig 9409: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 9410: "replaceable"><code>pkg</code></em></code>.
9411: <code class="varname">USE_BUILTIN.<em class=
9412: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 9413: "emphasis"><em>must</em></span> be set to the correct
1.45 wiz 9414: value by the end of the <code xmlns=
9415: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9416: "filename">builtin.mk</code> file. Note that
9417: <code class="varname">USE_BUILTIN.<em class=
9418: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 9419: “<span class="quote">yes</span>” even if
1.14 xtraeme 9420: <code class="varname">IS_BUILTIN.<em class=
9421: "replaceable"><code>pkg</code></em></code> is
1.1 grant 9422: “<span class="quote">no</span>” because we
9423: may make the determination that the built-in version of
9424: the software is similar enough to be used as a
9425: replacement.</p>
9426:
1.14 xtraeme 9427: <p>The last section is guarded by <code class=
9428: "varname">CHECK_BUILTIN.<em class=
9429: "replaceable"><code>pkg</code></em></code>, and
9430: includes code that uses the value of <code class=
9431: "varname">USE_BUILTIN.<em class=
9432: "replaceable"><code>pkg</code></em></code> set in the
9433: previous section. This typically includes, e.g., adding
1.1 grant 9434: additional dependency restrictions and listing
1.45 wiz 9435: additional files to symlink into <code xmlns=
9436: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9437: "filename">${BUILDLINK_DIR}</code> (via <code class=
9438: "varname">BUILDLINK_FILES.<em class=
9439: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 9440: </div>
9441:
1.67 hubertf 9442: <div class="sect2" lang="en">
1.1 grant 9443: <div class="titlepage">
9444: <div>
9445: <div>
1.30 wiz 9446: <h3 class="title"><a name=
1.38 dillo 9447: "native-or-pkgsrc-preference"></a>11.3.2. Global
1.30 wiz 9448: preferences for native or pkgsrc software</h3>
1.1 grant 9449: </div>
9450: </div>
9451: </div>
9452:
9453: <p>When building packages, it's possible to choose
9454: whether to set a global preference for using either the
9455: built-in (native) version or the pkgsrc version of
9456: software to satisfy a dependency. This is controlled by
1.14 xtraeme 9457: setting <code class="varname">PREFER_PKGSRC</code> and
9458: <code class="varname">PREFER_NATIVE</code>. These
9459: variables take values of either “<span class=
1.1 grant 9460: "quote">yes</span>”, “<span class=
9461: "quote">no</span>”, or a list of packages.
1.14 xtraeme 9462: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
9463: to use the pkgsrc versions of software, while
9464: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
9465: to use the built-in versions. Preferences are
9466: determined by the most specific instance of the package
9467: in either <code class="varname">PREFER_PKGSRC</code> or
9468: <code class="varname">PREFER_NATIVE</code>. If a
9469: package is specified in neither or in both variables,
9470: then <code class="varname">PREFER_PKGSRC</code> has
9471: precedence over <code class=
9472: "varname">PREFER_NATIVE</code>. For example, to require
9473: using pkgsrc versions of software for all but the most
9474: basic bits on a NetBSD system, you can set:</p>
1.1 grant 9475: <pre class="programlisting">
1.51 rillig 9476: PREFER_PKGSRC= yes
9477: PREFER_NATIVE= getopt skey tcp_wrappers
1.1 grant 9478: </pre>
9479:
9480: <p>A package <span class=
1.45 wiz 9481: "emphasis"><em>must</em></span> have a <code xmlns=
9482: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9483: "filename">builtin.mk</code> file to be listed in
9484: <code class="varname">PREFER_NATIVE</code>, otherwise
9485: it is simply ignored in that list.</p>
1.1 grant 9486: </div>
9487: </div>
9488: </div>
9489:
1.67 hubertf 9490: <div class="chapter" lang="en">
1.1 grant 9491: <div class="titlepage">
9492: <div>
9493: <div>
1.67 hubertf 9494: <h2 class="title"><a name=
1.38 dillo 9495: "pkginstall"></a>Chapter 12. The pkginstall
1.35 jmmv 9496: framework</h2>
1.1 grant 9497: </div>
9498: </div>
9499: </div>
9500:
9501: <div class="toc">
9502: <p><b>Table of Contents</b></p>
9503:
9504: <dl>
1.30 wiz 9505: <dt><span class="sect1"><a href=
1.38 dillo 9506: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 9507: directories outside the installation
9508: prefix</a></span></dt>
9509:
9510: <dd>
9511: <dl>
9512: <dt><span class="sect2"><a href=
1.38 dillo 9513: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 9514: manipulation</a></span></dt>
9515:
9516: <dt><span class="sect2"><a href=
1.38 dillo 9517: "#files-outside-prefix">12.1.2. File
1.35 jmmv 9518: manipulation</a></span></dt>
9519: </dl>
9520: </dd>
9521:
1.38 dillo 9522: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 9523: Configuration files</a></span></dt>
9524:
9525: <dd>
9526: <dl>
9527: <dt><span class="sect2"><a href=
1.38 dillo 9528: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 9529: "varname">PKG_SYSCONFDIR</code> is
9530: set</a></span></dt>
9531:
9532: <dt><span class="sect2"><a href=
1.38 dillo 9533: "#conf-files-configure">12.2.2. Telling the
1.47 reed 9534: software where configuration files
1.35 jmmv 9535: are</a></span></dt>
9536:
9537: <dt><span class="sect2"><a href=
1.38 dillo 9538: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 9539: installations</a></span></dt>
9540:
9541: <dt><span class="sect2"><a href=
1.38 dillo 9542: "#conf-files-disable">12.2.4. Disabling handling of
1.35 jmmv 9543: configuration files</a></span></dt>
9544: </dl>
9545: </dd>
9546:
1.38 dillo 9547: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 9548: System startup scripts</a></span></dt>
9549:
9550: <dd>
9551: <dl>
9552: <dt><span class="sect2"><a href=
1.38 dillo 9553: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 9554: of system startup scripts</a></span></dt>
9555: </dl>
9556: </dd>
1.1 grant 9557:
1.30 wiz 9558: <dt><span class="sect1"><a href=
1.38 dillo 9559: "#users-and-groups">12.4. System users and
1.35 jmmv 9560: groups</a></span></dt>
9561:
1.38 dillo 9562: <dt><span class="sect1"><a href="#shells">12.5. System
1.35 jmmv 9563: shells</a></span></dt>
9564:
9565: <dd>
9566: <dl>
9567: <dt><span class="sect2"><a href=
1.65 hubertf 9568: "#shells-disable">12.5.1. Disabling shell
9569: registration</a></span></dt>
9570: </dl>
9571: </dd>
9572:
9573: <dt><span class="sect1"><a href="#fonts">12.6.
9574: Fonts</a></span></dt>
9575:
9576: <dd>
9577: <dl>
9578: <dt><span class="sect2"><a href=
9579: "#fonts-disable">12.6.1. Disabling automatic update
9580: of the fonts databases</a></span></dt>
1.35 jmmv 9581: </dl>
9582: </dd>
1.1 grant 9583: </dl>
9584: </div>
9585:
1.35 jmmv 9586: <p>This chapter describes the framework known as
9587: <code class="literal">pkginstall</code>, whose key features
9588: are:</p>
9589:
9590: <div class="itemizedlist">
9591: <ul type="disc">
9592: <li>
9593: <p>Generic installation and manipulation of
9594: directories and files outside the pkgsrc-handled
9595: tree, <code class="varname">LOCALBASE</code>.</p>
9596: </li>
9597:
9598: <li>
9599: <p>Automatic handling of configuration files during
9600: installation, provided that packages are correctly
9601: designed.</p>
9602: </li>
9603:
9604: <li>
9605: <p>Generation and installation of system startup
9606: scripts.</p>
9607: </li>
9608:
9609: <li>
9610: <p>Registration of system users and groups.</p>
9611: </li>
9612:
9613: <li>
9614: <p>Registration of system shells.</p>
9615: </li>
1.65 hubertf 9616:
9617: <li>
9618: <p>Automatic updating of fonts databases.</p>
9619: </li>
1.35 jmmv 9620: </ul>
9621: </div>
9622:
9623: <p>The following sections inspect each of the above points
1.65 hubertf 9624: in detail.</p>
1.35 jmmv 9625:
9626: <p>You may be thinking that many of the things described
9627: here could be easily done with simple code in the package's
9628: post-installation target (<code class=
9629: "literal">post-install</code>). <span class=
9630: "emphasis"><em>This is incorrect</em></span>, as the code
9631: in them is only executed when building from source.
9632: Machines using binary packages could not benefit from it at
9633: all (as the code itself could be unavailable). Therefore,
9634: the only way to achieve any of the items described above is
9635: by means of the installation scripts, which are
9636: automatically generated by pkginstall.</p>
1.1 grant 9637:
1.67 hubertf 9638: <div class="sect1" lang="en">
1.1 grant 9639: <div class="titlepage">
9640: <div>
9641: <div>
9642: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9643: "files-and-dirs-outside-prefix"></a>12.1. Files
9644: and directories outside the installation
9645: prefix</h2>
1.1 grant 9646: </div>
9647: </div>
9648: </div>
9649:
1.45 wiz 9650: <p>As you already know, the <code xmlns=
9651: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9652: "filename">PLIST</code> file holds a list of files and
9653: directories that belong to a package. The names used in
1.45 wiz 9654: it are relative to the installation prefix (<code xmlns=
9655: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9656: "filename">${PREFIX}</code>), which means that it cannot
9657: register files outside this directory (absolute path
9658: names are not allowed). Despite this restriction, some
9659: packages need to install files outside this location;
1.45 wiz 9660: e.g., under <code xmlns=
9661: "http://www.w3.org/TR/xhtml1/transitional" class=
9662: "filename">${VARBASE}</code> or <code xmlns=
9663: "http://www.w3.org/TR/xhtml1/transitional" class=
9664: "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35 jmmv 9665:
9666: <p>The only way to achieve this is to create such files
9667: during installation time by using the installation
9668: scripts. These scripts can run arbitrary commands, so
9669: they have the potential to create and manage files
1.47 reed 9670: anywhere in the file system. Here is where pkginstall
1.35 jmmv 9671: comes into play: it provides generic scripts to abstract
9672: the manipulation of such files and directories based on
1.45 wiz 9673: variables set in the package's <code xmlns=
9674: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9675: "filename">Makefile</code>. The rest of this section
1.47 reed 9676: describes these variables.</p>
1.1 grant 9677:
1.67 hubertf 9678: <div class="sect2" lang="en">
1.35 jmmv 9679: <div class="titlepage">
1.1 grant 9680: <div>
1.35 jmmv 9681: <div>
1.67 hubertf 9682: <h3 class="title"><a name=
1.63 dillo 9683: "dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 9684: manipulation</h3>
9685: </div>
1.1 grant 9686: </div>
9687: </div>
9688:
1.35 jmmv 9689: <p>The following variables can be set to request the
1.47 reed 9690: creation of directories anywhere in the file
9691: system:</p>
1.27 rillig 9692:
1.35 jmmv 9693: <div class="itemizedlist">
9694: <ul type="disc">
9695: <li>
9696: <p><code class="varname">MAKE_DIRS</code> and
9697: <code class="varname">OWN_DIRS</code> contain a
9698: list of directories that should be created and
9699: should attempt to be destroyed by the
9700: installation scripts. The difference between the
9701: two is that the latter prompts the administrator
9702: to remove any directories that may be left after
9703: deinstallation (because they were not empty),
9704: while the former does not.</p>
9705: </li>
1.1 grant 9706:
1.35 jmmv 9707: <li>
9708: <p><code class="varname">MAKE_DIRS_PERMS</code>
9709: and <code class="varname">OWN_DIRS_PERMS</code>
9710: contain a list of tuples describing which
9711: directories should be created and should attempt
9712: to be destroyed by the installation scripts. Each
9713: tuple holds the following values, separated by
9714: spaces: the directory name, its owner, its group
9715: and its numerical mode. For example:</p>
9716: <pre class="programlisting">
1.51 rillig 9717: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9718: </pre>
1.1 grant 9719:
1.35 jmmv 9720: <p>The difference between the two is exactly the
9721: same as their non-<code class=
9722: "varname">PERMS</code> counterparts.</p>
9723: </li>
9724: </ul>
9725: </div>
9726: </div>
9727:
1.67 hubertf 9728: <div class="sect2" lang="en">
1.35 jmmv 9729: <div class="titlepage">
9730: <div>
9731: <div>
1.67 hubertf 9732: <h3 class="title"><a name=
9733: "files-outside-prefix"></a>12.1.2. File
1.35 jmmv 9734: manipulation</h3>
9735: </div>
9736: </div>
9737: </div>
9738:
9739: <p>Creating non-empty files outside the installation
1.45 wiz 9740: prefix is tricky because the <code xmlns=
9741: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9742: "filename">PLIST</code> forces all files to be inside
9743: it. To overcome this problem, the only solution is to
9744: extract the file in the known place (i.e., inside the
9745: installation prefix) and copy it to the appropriate
9746: location during installation (done by the installation
9747: scripts generated by pkginstall). We will call the
9748: former the <span class="emphasis"><em>master
9749: file</em></span> in the following paragraphs, which
9750: describe the variables that can be used to
9751: automatically and consistently handle files outside the
9752: installation prefix:</p>
9753:
9754: <div class="itemizedlist">
9755: <ul type="disc">
9756: <li>
9757: <p><code class="varname">CONF_FILES</code> and
9758: <code class="varname">SUPPORT_FILES</code> are
9759: pairs of master and target files. During
9760: installation time, the master file is copied to
9761: the target one if and only if the latter does not
9762: exist. Upon deinstallation, the target file is
9763: removed provided that it was not modified by the
9764: installation.</p>
9765:
9766: <p>The difference between the two is that the
9767: latter prompts the administrator to remove any
9768: files that may be left after deinstallation
9769: (because they were not empty), while the former
9770: does not.</p>
9771: </li>
9772:
9773: <li>
9774: <p><code class="varname">CONF_FILES_PERMS</code>
9775: and <code class=
9776: "varname">SUPPORT_FILES_PERMS</code> contain
9777: tuples describing master files as well as their
9778: target locations. For each of them, it also
9779: specifies their owner, their group and their
9780: numeric permissions, in this order. For
9781: example:</p>
9782: <pre class="programlisting">
1.51 rillig 9783: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9784: </pre>
9785:
9786: <p>The difference between the two is exactly the
9787: same as their non-<code class=
9788: "varname">PERMS</code> counterparts.</p>
9789: </li>
9790: </ul>
9791: </div>
9792: </div>
9793: </div>
9794:
1.67 hubertf 9795: <div class="sect1" lang="en">
1.35 jmmv 9796: <div class="titlepage">
9797: <div>
9798: <div>
9799: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9800: "conf-files"></a>12.2. Configuration
9801: files</h2>
1.35 jmmv 9802: </div>
9803: </div>
9804: </div>
9805:
9806: <p>Configuration files are special in the sense that they
9807: are installed in their own specific directory,
9808: <code class="varname">PKG_SYSCONFDIR</code>, and need
9809: special treatment during installation (most of which is
9810: automated by pkginstall). The main concept you must bear
1.36 wiz 9811: in mind is that files marked as configuration files are
1.35 jmmv 9812: automatically copied to the right place (somewhere inside
9813: <code class="varname">PKG_SYSCONFDIR</code>) during
9814: installation <span class="emphasis"><em>if and only
9815: if</em></span> they didn't exist before. Similarly, they
9816: will not be removed if they have local modifications.
1.36 wiz 9817: This ensures that administrators never lose any custom
1.35 jmmv 9818: changes they may have made.</p>
9819:
1.67 hubertf 9820: <div class="sect2" lang="en">
1.35 jmmv 9821: <div class="titlepage">
9822: <div>
9823: <div>
1.67 hubertf 9824: <h3 class="title"><a name=
9825: "conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 9826: <code class="varname">PKG_SYSCONFDIR</code> is
9827: set</h3>
9828: </div>
9829: </div>
9830: </div>
9831:
9832: <p>As said before, the <code class=
9833: "varname">PKG_SYSCONFDIR</code> variable specifies
9834: where configuration files shall be installed. Its
9835: contents are set based upon the following
9836: variables:</p>
9837:
9838: <div class="itemizedlist">
9839: <ul type="disc">
9840: <li>
9841: <p><code class="varname">PKG_SYSCONFBASE</code>:
9842: The configuration's root directory. Defaults to
1.45 wiz 9843: <code xmlns=
9844: "http://www.w3.org/TR/xhtml1/transitional" class=
9845: "filename">${PREFIX}/etc</code> although it may
9846: be overridden by the user to point to his
9847: preferred location (e.g., <code xmlns=
9848: "http://www.w3.org/TR/xhtml1/transitional" class=
9849: "filename">/etc</code>, <code xmlns=
9850: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9851: "filename">/etc/pkg</code>, etc.). Packages must
9852: not use it directly.</p>
9853: </li>
9854:
9855: <li>
9856: <p><code class=
9857: "varname">PKG_SYSCONFSUBDIR</code>: A
9858: subdirectory of <code class=
9859: "varname">PKG_SYSCONFBASE</code> under which the
9860: configuration files for the package being built
9861: shall be installed. The definition of this
9862: variable only makes sense in the package's
1.45 wiz 9863: <code xmlns=
9864: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 9865: "filename">Makefile</code> (i.e., it is not
9866: user-customizable).</p>
1.35 jmmv 9867:
9868: <p>As an example, consider the Apache package,
9869: <a xmlns=
9870: "http://www.w3.org/TR/xhtml1/transitional" href=
9871: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45 wiz 9872: target="_top"><code xmlns="" class=
9873: "filename">www/apache2</code></a>, which places
9874: its configuration files under the <code xmlns=
9875: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9876: "filename">httpd/</code> subdirectory of
9877: <code class="varname">PKG_SYSCONFBASE</code>.
9878: This should be set in the package Makefile.</p>
9879: </li>
9880:
9881: <li>
9882: <p><code class="varname">PKG_SYSCONFVAR</code>:
9883: Specifies the name of the variable that holds
9884: this package's configuration directory (if
9885: different from <code class=
9886: "varname">PKG_SYSCONFBASE</code>). It defaults to
9887: <code class="varname">PKGBASE</code>'s value, and
9888: is always prefixed with <code class=
9889: "literal">PKG_SYSCONFDIR</code>.</p>
9890: </li>
9891:
9892: <li>
9893: <p><code class=
9894: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
9895: Holds the directory where the configuration files
9896: for the package identified by <code class=
9897: "varname">PKG_SYSCONFVAR</code>'s shall be
9898: placed.</p>
9899: </li>
9900: </ul>
9901: </div>
9902:
9903: <p>Based on the above variables, pkginstall determines
9904: the value of <code class=
9905: "varname">PKG_SYSCONFDIR</code>, which is the
9906: <span class="emphasis"><em>only</em></span> variable
9907: that can be used within a package to refer to its
9908: configuration directory. The algorithm used to set its
9909: value is basically the following:</p>
9910:
9911: <div class="orderedlist">
9912: <ol type="1">
9913: <li>
9914: <p>If <code class=
9915: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9916: is set, its value is used.</p>
9917: </li>
9918:
9919: <li>
9920: <p>If the previous variable is not defined but
9921: <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45 wiz 9922: set in the package's <code xmlns=
9923: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9924: "filename">Makefile</code>, the resulting value
1.45 wiz 9925: is <code xmlns=
9926: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9927: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
9928: </li>
9929:
9930: <li>
1.45 wiz 9931: <p>Otherwise, it is set to <code xmlns=
9932: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9933: "filename">${PKG_SYSCONFBASE}</code>.</p>
9934: </li>
9935: </ol>
9936: </div>
9937:
1.45 wiz 9938: <p>It is worth mentioning that <code xmlns=
9939: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9940: "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45 wiz 9941: added to <code xmlns=
9942: "http://www.w3.org/TR/xhtml1/transitional" class=
9943: "filename">OWN_DIRS</code>. See <a href=
9944: "#dirs-outside-prefix" title=
1.63 dillo 9945: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 9946: “Directory manipulation”</a> what this
9947: means.</p>
9948: </div>
9949:
1.67 hubertf 9950: <div class="sect2" lang="en">
1.35 jmmv 9951: <div class="titlepage">
9952: <div>
9953: <div>
1.67 hubertf 9954: <h3 class="title"><a name=
1.63 dillo 9955: "conf-files-configure"></a>12.2.2. Telling
9956: the software where configuration files are</h3>
1.35 jmmv 9957: </div>
9958: </div>
9959: </div>
9960:
9961: <p>Given that pkgsrc (and users!) expect configuration
9962: files to be in a known place, you need to teach each
1.36 wiz 9963: package where it shall install its files. In some cases
1.35 jmmv 9964: you will have to patch the package Makefiles to achieve
9965: it. If you are lucky, though, it may be as easy as
9966: passing an extra flag to the configuration script; this
1.47 reed 9967: is the case of GNU Autoconf- generated files:</p>
1.35 jmmv 9968: <pre class="programlisting">
1.51 rillig 9969: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35 jmmv 9970: </pre>
9971:
9972: <p>Note that this specifies where the package has to
9973: <span class="emphasis"><em>look for</em></span> its
9974: configuration files, not where they will be originally
9975: installed (although the difference is never explicit,
9976: unfortunately).</p>
9977: </div>
9978:
1.67 hubertf 9979: <div class="sect2" lang="en">
1.35 jmmv 9980: <div class="titlepage">
9981: <div>
9982: <div>
1.67 hubertf 9983: <h3 class="title"><a name=
1.63 dillo 9984: "conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 9985: installations</h3>
9986: </div>
9987: </div>
9988: </div>
9989:
9990: <p>As said before, pkginstall automatically handles
9991: configuration files. This means that <span class=
9992: "strong"><strong>the packages themselves must not touch
1.45 wiz 9993: the contents of <code xmlns=
9994: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9995: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 9996: directly</strong></span>. Bad news is that many
9997: software installation scripts will, out of the box,
9998: mess with the contents of that directory. So what is
9999: the correct procedure to fix this issue?</p>
1.35 jmmv 10000:
10001: <p>You must teach the package (usually by manually
10002: patching it) to install any configuration files under
1.45 wiz 10003: the examples hierarchy, <code xmlns=
10004: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10005: "filename">share/examples/${PKGBASE}/</code>. This way,
1.45 wiz 10006: the <code xmlns=
10007: "http://www.w3.org/TR/xhtml1/transitional" class=
10008: "filename">PLIST</code> registers them and the
10009: administrator always has the original copies
1.35 jmmv 10010: available.</p>
10011:
10012: <p>Once the required configuration files are in place
10013: (i.e., under the examples hierarchy), the pkginstall
10014: framework can use them as master copies during the
1.45 wiz 10015: package installation to update what is in <code xmlns=
10016: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10017: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
10018: the variables <code class="varname">CONF_FILES</code>
10019: and <code class="varname">CONF_FILES_PERMS</code> are
10020: used. Check out <a href="#files-outside-prefix" title=
1.63 dillo 10021: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 10022: “File manipulation”</a> for information
10023: about their syntax and their purpose. Here is an
10024: example, taken from the <a xmlns=
10025: "http://www.w3.org/TR/xhtml1/transitional" href=
10026: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45 wiz 10027: target="_top"><code xmlns="" class=
10028: "filename">mail/mutt</code></a> package:</p>
1.35 jmmv 10029: <pre class="programlisting">
1.51 rillig 10030: EGDIR= ${PREFIX}/share/doc/mutt/samples
10031: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35 jmmv 10032: </pre>
10033:
10034: <p>Note that the <code class="varname">EGDIR</code>
10035: variable is specific to that package and has no meaning
10036: outside it.</p>
10037: </div>
10038:
1.67 hubertf 10039: <div class="sect2" lang="en">
1.35 jmmv 10040: <div class="titlepage">
10041: <div>
10042: <div>
1.67 hubertf 10043: <h3 class="title"><a name=
10044: "conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 10045: handling of configuration files</h3>
10046: </div>
10047: </div>
10048: </div>
10049:
10050: <p>The automatic copying of config files can be toggled
10051: by setting the environment variable <code class=
10052: "varname">PKG_CONFIG</code> prior to package
10053: installation.</p>
10054: </div>
10055: </div>
10056:
1.67 hubertf 10057: <div class="sect1" lang="en">
1.35 jmmv 10058: <div class="titlepage">
10059: <div>
10060: <div>
10061: <h2 class="title" style="clear: both"><a name=
1.63 dillo 10062: "rcd-scripts"></a>12.3. System startup
10063: scripts</h2>
1.35 jmmv 10064: </div>
10065: </div>
10066: </div>
10067:
10068: <p>System startup scripts are special files because they
10069: must be installed in a place known by the underlying OS,
10070: usually outside the installation prefix. Therefore, the
10071: same rules described in <a href=
10072: "#files-and-dirs-outside-prefix" title=
1.38 dillo 10073: "12.1. Files and directories outside the installation prefix">
1.63 dillo 10074: Section 12.1, “Files and directories outside
10075: the installation prefix”</a> apply, and the same
1.35 jmmv 10076: solutions can be used. However, pkginstall provides a
1.36 wiz 10077: special mechanism to handle these files.</p>
1.35 jmmv 10078:
10079: <p>In order to provide system startup scripts, the
10080: package has to:</p>
10081:
10082: <div class="orderedlist">
10083: <ol type="1">
10084: <li>
1.45 wiz 10085: <p>Store the script inside <code xmlns=
10086: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10087: "filename">${FILESDIR}</code>, with the
10088: <code class="literal">.sh</code> suffix appended.
10089: Considering the <a xmlns=
10090: "http://www.w3.org/TR/xhtml1/transitional" href=
10091: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45 wiz 10092: target="_top"><code xmlns="" class=
10093: "filename">print/cups</code></a> package as an
10094: example, it has a <code xmlns=
10095: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10096: "filename">cupsd.sh</code> in its files
10097: directory.</p>
10098: </li>
10099:
10100: <li>
10101: <p>Tell pkginstall to handle it, appending the name
10102: of the script, without its extension, to the
10103: <code class="varname">RCD_SCRIPTS</code> variable.
10104: Continuing the previous example:</p>
10105: <pre class="programlisting">
1.51 rillig 10106: RCD_SCRIPTS+= cupsd
1.35 jmmv 10107: </pre>
10108: </li>
10109: </ol>
10110: </div>
10111:
10112: <p>Once this is done, pkginstall will do the following
10113: steps for each script in an automated fashion:</p>
10114:
10115: <div class="orderedlist">
10116: <ol type="1">
10117: <li>
10118: <p>Process the file found in the files directory
10119: applying all the substitutions described in the
1.45 wiz 10120: <code xmlns=
10121: "http://www.w3.org/TR/xhtml1/transitional" class=
10122: "filename">FILES_SUBST</code> variable.</p>
1.35 jmmv 10123: </li>
10124:
10125: <li>
10126: <p>Copy the script from the files directory to the
1.45 wiz 10127: examples hierarchy, <code xmlns=
10128: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10129: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 10130: Note that this master file must be explicitly
1.45 wiz 10131: registered in the <code xmlns=
10132: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10133: "filename">PLIST</code>.</p>
10134: </li>
10135:
10136: <li>
10137: <p>Add code to the installation scripts to copy the
10138: startup script from the examples hierarchy into the
10139: system-wide startup scripts directory.</p>
10140: </li>
10141: </ol>
10142: </div>
10143:
1.67 hubertf 10144: <div class="sect2" lang="en">
1.35 jmmv 10145: <div class="titlepage">
10146: <div>
10147: <div>
1.67 hubertf 10148: <h3 class="title"><a name=
1.63 dillo 10149: "rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 10150: handling of system startup scripts</h3>
10151: </div>
10152: </div>
10153: </div>
10154:
10155: <p>The automatic copying of config files can be toggled
10156: by setting the environment variable <code class=
10157: "varname">PKG_RCD_SCRIPTS</code> prior to package
10158: installation. Note that the scripts will be always
1.45 wiz 10159: copied inside the examples hierarchy, <code xmlns=
10160: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10161: "filename">${PREFIX}/share/examples/rc.d/</code>, no
10162: matter what the value of this variable is.</p>
10163: </div>
10164: </div>
10165:
1.67 hubertf 10166: <div class="sect1" lang="en">
1.35 jmmv 10167: <div class="titlepage">
10168: <div>
10169: <div>
10170: <h2 class="title" style="clear: both"><a name=
1.63 dillo 10171: "users-and-groups"></a>12.4. System users and
10172: groups</h2>
1.35 jmmv 10173: </div>
10174: </div>
10175: </div>
10176:
10177: <p>If a package needs to create special users and/or
10178: groups during installation, it can do so by using the
10179: pkginstall framework.</p>
10180:
10181: <p>Users can be created by adding entries to the
10182: <code class="varname">PKG_USERS</code> variable. Each
1.72 ! rillig 10183: entry has the following syntax:</p>
1.35 jmmv 10184: <pre class="programlisting">
1.72 ! rillig 10185: user:group
1.35 jmmv 10186: </pre>
10187:
1.72 ! rillig 10188: <p>Further specification of user details may be done by
! 10189: setting per-user variables. <code class=
! 10190: "varname">PKG_UID.<em class=
! 10191: "replaceable"><code>user</code></em></code> is the
! 10192: numeric UID for the user. <code class=
! 10193: "varname">PKG_GECOS.<em class=
! 10194: "replaceable"><code>user</code></em></code> is the user's
! 10195: description or comment. <code class=
! 10196: "varname">PKG_HOME.<em class=
! 10197: "replaceable"><code>user</code></em></code> is the user's
! 10198: home directory, and defaults to <code xmlns=
! 10199: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10200: "filename">/nonexistent</code> if not specified.
! 10201: <code class="varname">PKG_SHELL.<em class=
! 10202: "replaceable"><code>user</code></em></code> is the user's
! 10203: shell, and defaults to <code xmlns=
! 10204: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10205: "filename">/sbinno/login</code> if not specified.</p>
! 10206:
! 10207: <p>Similarly, groups can be created by adding entries to
! 10208: the <code class="varname">PKG_GROUPS</code> variable,
! 10209: whose syntax is:</p>
1.35 jmmv 10210: <pre class="programlisting">
1.72 ! rillig 10211: group
1.35 jmmv 10212: </pre>
10213:
1.72 ! rillig 10214: <p>The numeric GID of the group may be set by defining
! 10215: <code class="varname">PKG_GID.<em class=
! 10216: "replaceable"><code>group</code></em></code>.</p>
! 10217:
! 10218: <p>If a package needs to create the users and groups at
! 10219: an earlier stage, then it can set <code class=
! 10220: "varname">USERGROUP_PHASE</code> to either <code class=
! 10221: "literal">configure</code> or <code class=
! 10222: "literal">build</code> to indicate the phase before which
! 10223: the users and groups are created. In this case, the
! 10224: numeric UIDs and GIDs of the created users and groups are
! 10225: automatically hardcoded into the final installation
! 10226: scripts.</p>
1.35 jmmv 10227: </div>
10228:
1.67 hubertf 10229: <div class="sect1" lang="en">
1.35 jmmv 10230: <div class="titlepage">
10231: <div>
10232: <div>
10233: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 10234: "shells"></a>12.5. System shells</h2>
1.35 jmmv 10235: </div>
10236: </div>
10237: </div>
10238:
10239: <p>Packages that install system shells should register
1.45 wiz 10240: them in the shell database, <code xmlns=
10241: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10242: "filename">/etc/shells</code>, to make things easier to
10243: the administrator. This must be done from the
10244: installation scripts to keep binary packages working on
10245: any system. pkginstall provides an easy way to accomplish
10246: this task.</p>
10247:
10248: <p>When a package provides a shell interpreter, it has to
10249: set the <code class="varname">PKG_SHELL</code> variable
10250: to its absolute file name. This will add some hooks to
10251: the installation scripts to handle it. Consider the
10252: following example, taken from <a xmlns=
10253: "http://www.w3.org/TR/xhtml1/transitional" href=
10254: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45 wiz 10255: target="_top"><code xmlns="" class=
10256: "filename">shells/zsh</code></a>:</p>
1.35 jmmv 10257: <pre class="programlisting">
1.51 rillig 10258: PKG_SHELL= ${PREFIX}/bin/zsh
1.35 jmmv 10259: </pre>
10260:
1.67 hubertf 10261: <div class="sect2" lang="en">
1.35 jmmv 10262: <div class="titlepage">
10263: <div>
10264: <div>
1.67 hubertf 10265: <h3 class="title"><a name=
10266: "shells-disable"></a>12.5.1. Disabling shell
1.65 hubertf 10267: registration</h3>
1.35 jmmv 10268: </div>
10269: </div>
10270: </div>
10271:
10272: <p>The automatic registration of shell interpreters can
10273: be disabled by the administrator by setting the
1.45 wiz 10274: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10275: class="filename">PKG_REGISTER_SHELLS</code> environment
10276: variable to <code class="literal">NO</code>.</p>
1.35 jmmv 10277: </div>
10278: </div>
1.65 hubertf 10279:
1.67 hubertf 10280: <div class="sect1" lang="en">
1.65 hubertf 10281: <div class="titlepage">
10282: <div>
10283: <div>
10284: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 10285: "fonts"></a>12.6. Fonts</h2>
1.65 hubertf 10286: </div>
10287: </div>
10288: </div>
10289:
10290: <p>Packages that install X11 fonts should update the
10291: database files that index the fonts within each fonts
10292: directory. This can easily be accomplished within the
10293: pkginstall framework.</p>
10294:
10295: <p>When a package installs X11 fonts, it must list the
10296: directories in which fonts are installed in the
10297: <code class="varname">FONTS_DIRS.<em class=
10298: "replaceable"><code>type</code></em></code> variables,
10299: where <em class="replaceable"><code>type</code></em> can
10300: be one of “<span class="quote">ttf</span>”,
10301: “<span class="quote">type1</span>” or
10302: “<span class="quote">x11</span>”. This will
10303: add hooks to the installation scripts to run the
10304: appropriate commands to update the fonts database files
10305: within each of those directories. For convenience, if the
10306: directory path is relative, it is taken to be relative to
10307: the package's installation prefix. Consider the following
10308: example, taken from <a xmlns=
10309: "http://www.w3.org/TR/xhtml1/transitional" href=
10310: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/dbz-ttf/README.html"
10311: target="_top"><code xmlns="" class=
10312: "filename">fonts/dbz-ttf</code></a>:</p>
10313: <pre class="programlisting">
10314: FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF
10315: </pre>
10316:
1.67 hubertf 10317: <div class="sect2" lang="en">
1.65 hubertf 10318: <div class="titlepage">
10319: <div>
10320: <div>
1.67 hubertf 10321: <h3 class="title"><a name=
10322: "fonts-disable"></a>12.6.1. Disabling
10323: automatic update of the fonts databases</h3>
1.65 hubertf 10324: </div>
10325: </div>
10326: </div>
10327:
10328: <p>The automatic update of fonts databases can be
10329: disabled by the administrator by setting the
10330: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10331: class="filename">PKG_UPDATE_FONTS_DB</code> environment
10332: variable to <code class="literal">NO</code>.</p>
10333: </div>
10334: </div>
1.35 jmmv 10335: </div>
10336:
1.67 hubertf 10337: <div class="chapter" lang="en">
1.35 jmmv 10338: <div class="titlepage">
10339: <div>
10340: <div>
1.67 hubertf 10341: <h2 class="title"><a name=
1.38 dillo 10342: "options"></a>Chapter 13. Options
1.35 jmmv 10343: handling</h2>
10344: </div>
10345: </div>
10346: </div>
10347:
10348: <div class="toc">
10349: <p><b>Table of Contents</b></p>
10350:
10351: <dl>
10352: <dt><span class="sect1"><a href=
1.38 dillo 10353: "#global-default-options">13.1. Global default
1.35 jmmv 10354: options</a></span></dt>
10355:
10356: <dt><span class="sect1"><a href=
1.38 dillo 10357: "#converting-to-options">13.2. Converting packages to
1.45 wiz 10358: use <code xmlns=
10359: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10360: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 10361:
10362: <dt><span class="sect1"><a href="#option-names">13.3.
10363: Option Names</a></span></dt>
1.35 jmmv 10364: </dl>
10365: </div>
10366:
10367: <p>Many packages have the ability to be built to support
1.45 wiz 10368: different sets of features. <code xmlns=
10369: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10370: "filename">bsd.options.mk</code> is a framework in pkgsrc
10371: that provides generic handling of those options that
10372: determine different ways in which the packages can be
10373: built. It's possible for the user to specify exactly which
10374: sets of options will be built into a package or to allow a
10375: set of global default options apply.</p>
10376:
1.67 hubertf 10377: <div class="sect1" lang="en">
1.35 jmmv 10378: <div class="titlepage">
10379: <div>
10380: <div>
10381: <h2 class="title" style="clear: both"><a name=
1.38 dillo 10382: "global-default-options"></a>13.1. Global
1.35 jmmv 10383: default options</h2>
10384: </div>
10385: </div>
10386: </div>
10387:
10388: <p>Global default options are listed in <code class=
10389: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
10390: the options that should be built into every package if
10391: that option is supported. This variable should be set in
1.45 wiz 10392: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10393: class="filename">/etc/mk.conf</code>.</p>
1.35 jmmv 10394: </div>
10395:
1.67 hubertf 10396: <div class="sect1" lang="en">
1.35 jmmv 10397: <div class="titlepage">
10398: <div>
10399: <div>
10400: <h2 class="title" style="clear: both"><a name=
1.38 dillo 10401: "converting-to-options"></a>13.2. Converting
1.45 wiz 10402: packages to use <code xmlns=
10403: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10404: "filename">bsd.options.mk</code></h2>
10405: </div>
10406: </div>
10407: </div>
10408:
1.45 wiz 10409: <p>The following example shows how <code xmlns=
10410: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10411: "filename">bsd.options.mk</code> should be used by the
10412: hypothetical ``wibble'' package, either in the package
1.45 wiz 10413: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10414: class="filename">Makefile</code>, or in a file, e.g.
10415: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10416: class="filename">options.mk</code>, that is included by
10417: the main package <code xmlns=
10418: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10419: "filename">Makefile</code>.</p>
10420: <pre class="programlisting">
1.51 rillig 10421: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
10422: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
10423: PKG_OPTIONS_OPTIONAL_GROUPS= database
10424: PKG_OPTIONS_GROUP.database= mysql pgsql
10425: PKG_SUGGESTED_OPTIONS= wibble-foo
10426: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
10427: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
10428:
10429: .include "../../mk/bsd.prefs.mk"
10430:
10431: # this package was previously named wibble2
10432: .if defined(PKG_OPTIONS.wibble2)
10433: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
10434: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
10435: "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
10436: .endif
10437:
10438: .include "../../mk/bsd.options.mk"
10439:
10440: # Package-specific option-handling
10441:
10442: ###
10443: ### FOO support
10444: ###
10445: .if !empty(PKG_OPTIONS:Mwibble-foo)
10446: CONFIGURE_ARGS+= --enable-foo
10447: .endif
10448:
10449: ###
10450: ### LDAP support
10451: ###
10452: .if !empty(PKG_OPTIONS:Mldap)
10453: . include "../../databases/openldap/buildlink3.mk"
10454: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
10455: .endif
10456:
10457: ###
10458: ### database support
10459: ###
10460: .if !empty(PKG_OPTIONS:Mmysql)
10461: . include "../../mk/mysql.buildlink3.mk"
10462: .endif
10463: .if !empty(PKG_OPTIONS:Mpgsql)
10464: . include "../../mk/pgsql.buildlink3.mk"
10465: .endif
1.1 grant 10466: </pre>
10467:
1.28 rillig 10468: <p>The first section contains the information about which
10469: build options are supported by the package, and any
1.1 grant 10470: default options settings if needed.</p>
10471:
10472: <div class="orderedlist">
10473: <ol type="1">
10474: <li>
1.14 xtraeme 10475: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 10476: the name of the <a href=
1.1 grant 10477: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10478: <span class="citerefentry"><span class=
1.27 rillig 10479: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 10480: that the user can set to override the default
1.57 minskim 10481: options. It should be set to PKG_OPTIONS.<em class=
1.63 dillo 10482: "replaceable"><code>pkgbase</code></em>. Do not set
10483: it to PKG_OPTIONS.${PKGBASE}, since <code class=
10484: "varname">PKGBASE</code> is set after <code class=
10485: "varname">PKG_OPTIONS_VAR</code> is used.</p>
1.1 grant 10486: </li>
10487:
10488: <li>
1.14 xtraeme 10489: <p><code class=
10490: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 10491: build options supported by the package.</p>
10492: </li>
10493:
10494: <li>
10495: <p><code class=
10496: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
10497: list of names of groups of mutually exclusive
10498: options. The options in each group are listed in
10499: <code class="varname">PKG_OPTIONS_GROUP.<em class=
10500: "replaceable"><code>groupname</code></em></code>.
10501: The most specific setting of any option from the
10502: group takes precedence over all other options in
10503: the group. Options from the groups will be
10504: automatically added to <code class=
10505: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
10506: </li>
10507:
10508: <li>
10509: <p><code class=
10510: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
10511: like <code class=
10512: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
10513: building the packages will fail if no option from
10514: the group is selected.</p>
1.1 grant 10515: </li>
10516:
10517: <li>
1.27 rillig 10518: <p><code class=
1.44 gdt 10519: "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
10520: list of names of sets of options. At least one
10521: option from each set must be selected. The options
10522: in each set are listed in <code class=
10523: "varname">PKG_OPTIONS_SET.<em class=
10524: "replaceable"><code>setname</code></em></code>.
10525: Options from the sets will be automatically added
10526: to <code class=
10527: "varname">PKG_SUPPORTED_OPTIONS</code>. Building
10528: the package will fail if no option from the set is
10529: selected.</p>
10530: </li>
10531:
10532: <li>
10533: <p><code class=
1.27 rillig 10534: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
10535: build options which are enabled by default.</p>
10536: </li>
10537:
10538: <li>
1.37 dillo 10539: <p><code class=
10540: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
10541: of “<span class="quote"><em class=
1.67 hubertf 10542: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>”
10543: pairs that map legacy <code xmlns=
1.45 wiz 10544: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 10545: "filename">/etc/mk.conf</code> variables to their
10546: option counterparts. Pairs should be added with
10547: “<span class="quote">+=</span>” to keep
10548: the listing of global legacy variables. A warning
10549: will be issued if the user uses a legacy
10550: variable.</p>
10551: </li>
1.1 grant 10552:
1.37 dillo 10553: <li>
10554: <p><code class=
10555: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
10556: of “<span class="quote"><em class=
1.67 hubertf 10557: "replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>”
10558: pairs that map options that have been renamed to
10559: their new counterparts. Pairs should be added with
1.37 dillo 10560: “<span class="quote">+=</span>” to keep
10561: the listing of global legacy options. A warning
10562: will be issued if the user uses a legacy
10563: option.</p>
10564: </li>
1.1 grant 10565:
1.37 dillo 10566: <li>
10567: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
10568: is a list of options implied by deprecated
10569: variables used. This can be used for cases that
10570: neither <code class=
10571: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
10572: <code class=
10573: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
10574: handle, e. g. when <code class=
10575: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 10576: </li>
10577:
10578: <li>
1.37 dillo 10579: <p><code class=
10580: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
10581: a list of warnings about deprecated variables or
10582: options used, and what to use instead.</p>
1.1 grant 10583: </li>
1.28 rillig 10584: </ol>
1.1 grant 10585: </div>
10586:
1.37 dillo 10587: <p>A package should never modify <code class=
10588: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
10589: named in <code class="varname">PKG_OPTIONS_VAR</code>.
10590: These are strictly user-settable. To suggest a default
10591: set of options, use <code class=
10592: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
10593:
1.42 dillo 10594: <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45 wiz 10595: defined before including <code xmlns=
10596: "http://www.w3.org/TR/xhtml1/transitional" class=
1.42 dillo 10597: "filename">bsd.options.mk</code>. If none of <code class=
1.37 dillo 10598: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
10599: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
10600: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47 reed 10601: are defined (as can happen with platform-specific options
1.42 dillo 10602: if none of them is supported on the current platform),
10603: <code class="varname">PKG_OPTIONS</code> is set to the
10604: empty list and the package is otherwise treated as not
10605: using the options framework.</p>
1.37 dillo 10606:
1.45 wiz 10607: <p>After the inclusion of <code xmlns=
10608: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 10609: "filename">bsd.options.mk</code>, the variable
1.28 rillig 10610: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 10611: list of selected build options, properly filtered to
1.28 rillig 10612: remove unsupported and duplicate options.</p>
10613:
1.1 grant 10614: <p>The remaining sections contain the logic that is
1.37 dillo 10615: specific to each option. The correct way to check for an
10616: option is to check whether it is listed in <code class=
10617: "varname">PKG_OPTIONS</code>:</p>
10618: <pre class="programlisting">
1.51 rillig 10619: .if !empty(PKG_OPTIONS:M<em class=
1.37 dillo 10620: "replaceable"><code>option</code></em>)
10621: </pre>
1.48 dillo 10622: </div>
1.37 dillo 10623:
1.67 hubertf 10624: <div class="sect1" lang="en">
1.48 dillo 10625: <div class="titlepage">
10626: <div>
10627: <div>
10628: <h2 class="title" style="clear: both"><a name=
10629: "option-names"></a>13.3. Option Names</h2>
10630: </div>
10631: </div>
10632: </div>
10633:
10634: <p>Options that enable similar features in different
10635: packages (like optional support for a library) should use
10636: a common name in all packages that support it (like the
10637: name of the library). If another package already has an
10638: option with the same meaning, use the same name.</p>
10639:
10640: <p>Options that enable features specific to one package,
10641: where it's unlikely that another (unrelated) package has
10642: the same (or a similar) optional feature, should use a
10643: name prefixed with <code class="varname"><em class=
10644: "replaceable"><code>pkgname</code></em>-</code>.</p>
10645:
10646: <p>If a group of related packages share an optional
10647: feature specific to that group, prefix it with the name
10648: of the “<span class="quote">main</span>”
10649: package (e. g. <code class=
10650: "varname">djbware-errno-hack</code>).</p>
10651:
10652: <p>For new options, add a line to <code xmlns=
10653: "http://www.w3.org/TR/xhtml1/transitional" class=
10654: "filename">mk/defaults/options.description</code>. Lines
10655: have two fields, separated by tab. The first field is the
10656: option name, the second its description. The description
10657: should be a whole sentence (starting with an uppercase
10658: letter and ending with a period) that describes what
10659: enabling the option does. E. g. “<span class=
10660: "quote">Enable ispell support.</span>” The file is
10661: sorted by option names.</p>
1.1 grant 10662: </div>
10663: </div>
10664:
1.67 hubertf 10665: <div class="chapter" lang="en">
1.1 grant 10666: <div class="titlepage">
10667: <div>
10668: <div>
1.67 hubertf 10669: <h2 class="title"><a name=
1.38 dillo 10670: "build"></a>Chapter 14. The build
1.1 grant 10671: process</h2>
10672: </div>
10673: </div>
10674: </div>
10675:
10676: <div class="toc">
10677: <p><b>Table of Contents</b></p>
10678:
10679: <dl>
1.56 rillig 10680: <dt><span class="sect1"><a href="#build.intro">14.1.
10681: Introduction</a></span></dt>
10682:
10683: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 10684: Program location</a></span></dt>
10685:
1.56 rillig 10686: <dt><span class="sect1"><a href=
10687: "#build.builddirs">14.3. Directories used during the
10688: build process</a></span></dt>
10689:
10690: <dt><span class="sect1"><a href="#build.running">14.4.
10691: Running a phase</a></span></dt>
10692:
10693: <dt><span class="sect1"><a href="#build.fetch">14.5.
10694: The <span class="emphasis"><em>fetch</em></span>
10695: phase</a></span></dt>
10696:
10697: <dt><span class="sect1"><a href="#build.checksum">14.6.
10698: The <span class="emphasis"><em>checksum</em></span>
10699: phase</a></span></dt>
10700:
10701: <dt><span class="sect1"><a href="#build.extract">14.7.
10702: The <span class="emphasis"><em>extract</em></span>
10703: phase</a></span></dt>
10704:
10705: <dt><span class="sect1"><a href="#build.patch">14.8.
10706: The <span class="emphasis"><em>patch</em></span>
10707: phase</a></span></dt>
10708:
10709: <dt><span class="sect1"><a href="#build.tools">14.9.
10710: The <span class="emphasis"><em>tools</em></span>
10711: phase</a></span></dt>
10712:
10713: <dt><span class="sect1"><a href="#build.wrapper">14.10.
10714: The <span class="emphasis"><em>wrapper</em></span>
10715: phase</a></span></dt>
1.1 grant 10716:
10717: <dt><span class="sect1"><a href=
1.56 rillig 10718: "#build.configure">14.11. The <span class=
10719: "emphasis"><em>configure</em></span>
10720: phase</a></span></dt>
10721:
10722: <dt><span class="sect1"><a href="#build.build">14.12.
10723: The <span class="emphasis"><em>build</em></span>
10724: phase</a></span></dt>
10725:
10726: <dt><span class="sect1"><a href="#build.test">14.13.
10727: The <span class="emphasis"><em>test</em></span>
10728: phase</a></span></dt>
10729:
10730: <dt><span class="sect1"><a href="#build.install">14.14.
10731: The <span class="emphasis"><em>install</em></span>
10732: phase</a></span></dt>
10733:
10734: <dt><span class="sect1"><a href="#build.package">14.15.
10735: The <span class="emphasis"><em>package</em></span>
10736: phase</a></span></dt>
10737:
10738: <dt><span class="sect1"><a href=
10739: "#build.helpful-targets">14.16. Other helpful
1.1 grant 10740: targets</a></span></dt>
10741: </dl>
10742: </div>
10743:
1.67 hubertf 10744: <div class="sect1" lang="en">
1.56 rillig 10745: <div class="titlepage">
10746: <div>
10747: <div>
10748: <h2 class="title" style="clear: both"><a name=
10749: "build.intro"></a>14.1. Introduction</h2>
10750: </div>
10751: </div>
10752: </div>
10753:
10754: <p>This chapter gives a detailed description on how a
10755: package is built. Building a package is separated into
10756: different <span class="emphasis"><em>phases</em></span>
10757: (for example <code class="varname">fetch</code>,
10758: <code class="varname">build</code>, <code class=
10759: "varname">install</code>), all of which are described in
10760: the following sections. Each phase is splitted into
10761: so-called <span class="emphasis"><em>stages</em></span>,
1.66 rillig 10762: which take the name of the containing phase, prefixed by
1.56 rillig 10763: one of <code class="varname">pre-</code>, <code class=
10764: "varname">do-</code> or <code class=
10765: "varname">post-</code>. (Examples are <code class=
10766: "varname">pre-configure</code>, <code class=
10767: "varname">post-build</code>.) Most of the actual work is
10768: done in the <code class="varname">do-*</code> stages.</p>
10769:
10770: <p>The basic steps for building a program are always the
10771: same. First the program's source (<span class=
10772: "emphasis"><em>distfile</em></span>) must be brought to
1.66 rillig 10773: the local system and then extracted. After any
10774: pkgsrc-specific patches to compile properly are applied,
10775: the software can be configured, then built (usually by
10776: compiling), and finally the generated binaries, etc. can
10777: be put into place on the system.</p>
1.56 rillig 10778: </div>
1.1 grant 10779:
1.67 hubertf 10780: <div class="sect1" lang="en">
1.1 grant 10781: <div class="titlepage">
10782: <div>
10783: <div>
10784: <h2 class="title" style="clear: both"><a name=
1.56 rillig 10785: "build.prefix"></a>14.2. Program location</h2>
1.1 grant 10786: </div>
10787: </div>
10788: </div>
10789:
10790: <p>Before outlining the process performed by the NetBSD
10791: package system in the next section, here's a brief
10792: discussion on where programs are installed, and which
10793: variables influence this.</p>
10794:
1.14 xtraeme 10795: <p>The automatic variable <code class=
10796: "varname">PREFIX</code> indicates where all files of the
10797: final program shall be installed. It is usually set to
1.45 wiz 10798: <code class="varname">LOCALBASE</code> (<code xmlns=
10799: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10800: "filename">/usr/pkg</code>), or <code class=
10801: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 10802: “<span class="quote">cross</span>” category.
1.14 xtraeme 10803: The value of <code class="varname">PREFIX</code> needs to
10804: be put into the various places in the program's source
10805: where paths to these files are encoded. See <a href=
1.1 grant 10806: "#components.patches" title=
1.38 dillo 10807: "8.3. patches/*">Section 8.3,
1.1 grant 10808: “patches/*”</a> and <a href="#fixes.libtool"
10809: title=
1.68 rillig 10810: "16.3.1. Shared libraries - libtool">Section 16.3.1,
1.1 grant 10811: “Shared libraries - libtool”</a> for more
10812: details.</p>
10813:
10814: <p>When choosing which of these variables to use, follow
10815: the following rules:</p>
10816:
10817: <div class="itemizedlist">
10818: <ul type="disc">
10819: <li>
1.14 xtraeme 10820: <p><code class="varname">PREFIX</code> always
10821: points to the location where the current pkg will
10822: be installed. When referring to a pkg's own
1.1 grant 10823: installation path, use “<span class=
10824: "quote">${PREFIX}</span>”.</p>
10825: </li>
10826:
10827: <li>
1.14 xtraeme 10828: <p><code class="varname">LOCALBASE</code> is where
10829: all non-X11 pkgs are installed. If you need to
1.1 grant 10830: construct a -I or -L argument to the compiler to
10831: find includes and libraries installed by another
10832: non-X11 pkg, use “<span class=
10833: "quote">${LOCALBASE}</span>”.</p>
10834: </li>
10835:
10836: <li>
1.14 xtraeme 10837: <p><code class="varname">X11BASE</code> is where
10838: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 10839: installed. When looking for <span class=
10840: "emphasis"><em>standard</em></span> X11 includes
10841: (not those installed by a pkg), use
10842: “<span class=
10843: "quote">${X11BASE}</span>”.</p>
10844: </li>
10845:
10846: <li>
1.47 reed 10847: <p>X11-based packages are special in that they may
10848: be installed in either <code class=
1.14 xtraeme 10849: "varname">X11BASE</code> or <code class=
10850: "varname">LOCALBASE</code>.</p>
1.1 grant 10851:
10852: <p>Usually, X11 packages should be installed under
1.14 xtraeme 10853: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 10854: possible. Note that you will need to include
1.45 wiz 10855: <code xmlns=
10856: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 10857: "filename">../../mk/x11.buildlink3.mk</code> in
10858: them to request the presence of X11 and to get the
10859: right compilation flags.</p>
1.1 grant 10860:
10861: <p>Even though, there are some packages that cannot
1.14 xtraeme 10862: be installed under <code class=
10863: "varname">LOCALBASE</code>: those that come with
1.1 grant 10864: app-defaults files. These packages are special and
1.14 xtraeme 10865: they must be placed under <code class=
10866: "varname">X11BASE</code>. To accomplish this, set
10867: either <code class="varname">USE_X11BASE</code> or
10868: <code class="varname">USE_IMAKE</code> in your
1.1 grant 10869: package.</p>
10870:
1.34 wiz 10871: <p>Some notes: If you need to find includes or
1.14 xtraeme 10872: libraries installed by a pkg that has <code class=
10873: "varname">USE_IMAKE</code> or <code class=
10874: "varname">USE_X11BASE</code> in its pkg
1.45 wiz 10875: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10876: class="filename">Makefile</code>, you need to look
10877: in <span class="emphasis"><em>both</em></span>
10878: <code xmlns=
10879: "http://www.w3.org/TR/xhtml1/transitional" class=
10880: "filename">${X11BASE}</code> and <code xmlns=
10881: "http://www.w3.org/TR/xhtml1/transitional" class=
10882: "filename">${LOCALBASE}</code>. To force
10883: installation of all X11 packages in <code class=
10884: "varname">LOCALBASE</code>, the <a xmlns=
10885: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10886: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 10887: target="_top"><code xmlns="" class=
10888: "filename">pkgtools/xpkgwedge</code></a> package is
1.34 wiz 10889: enabled by default.</p>
1.1 grant 10890: </li>
10891:
10892: <li>
1.14 xtraeme 10893: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 10894: used to refer to the installed location of an X11
1.14 xtraeme 10895: package. <code class="varname">X11PREFIX</code>
10896: will be set to <code class="varname">X11BASE</code>
10897: if xpkgwedge is not installed, and to <code class=
10898: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 10899: installed.</p>
10900: </li>
10901:
10902: <li>
10903: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 10904: have some packages installed in <code class=
10905: "varname">X11BASE</code> and some in <code class=
10906: "varname">LOCALBASE</code>. To determine the prefix
10907: of an installed package, the <code class=
10908: "varname">EVAL_PREFIX</code> definition can be
10909: used. It takes pairs in the format
10910: “<span class=
1.1 grant 10911: "quote">DIRNAME=<package></span>”, and
1.24 wiz 10912: the <a href=
10913: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10914: <span class="citerefentry"><span class=
10915: "refentrytitle">make</span>(1)</span></a> variable
10916: <code class="varname">DIRNAME</code> will be set to
10917: the prefix of the installed package
10918: <package>, or “<span class=
1.1 grant 10919: "quote">${X11PREFIX}</span>” if the package
10920: is not installed.</p>
10921:
10922: <p>This is best illustrated by example.</p>
10923:
1.45 wiz 10924: <p>The following lines are taken from <code xmlns=
10925: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10926: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 10927: <pre class="programlisting">
1.51 rillig 10928: EVAL_PREFIX+= GTKDIR=gtk+
1.69 rillig 10929: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE:Q}
10930: CONFIGURE_ARGS+= --with-gtk-prefix=${GTKDIR:Q}
10931: CONFIGURE_ARGS+= --enable-multibyte
1.1 grant 10932: </pre>
10933:
10934: <p>Specific defaults can be defined for the
1.14 xtraeme 10935: packages evaluated using <code class=
10936: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 10937: of the form:</p>
10938: <pre class="programlisting">
1.51 rillig 10939: GTKDIR_DEFAULT= ${LOCALBASE}
1.1 grant 10940: </pre>
10941:
1.14 xtraeme 10942: <p>where <code class="varname">GTKDIR</code>
1.1 grant 10943: corresponds to the first definition in the
1.14 xtraeme 10944: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 10945: </li>
10946:
10947: <li>
1.45 wiz 10948: <p>Within <code xmlns=
10949: "http://www.w3.org/TR/xhtml1/transitional" class=
10950: "filename">${PREFIX}</code>, packages should
10951: install files according to <a href=
1.24 wiz 10952: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
10953: <span class="citerefentry"><span class=
10954: "refentrytitle">hier</span>(7)</span></a>, with the
1.45 wiz 10955: exception that manual pages go into <code xmlns=
10956: "http://www.w3.org/TR/xhtml1/transitional" class=
10957: "filename">${PREFIX}/man</code>, not <code xmlns=
10958: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10959: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 10960: </li>
10961: </ul>
10962: </div>
10963: </div>
10964:
1.67 hubertf 10965: <div class="sect1" lang="en">
1.1 grant 10966: <div class="titlepage">
10967: <div>
10968: <div>
10969: <h2 class="title" style="clear: both"><a name=
1.56 rillig 10970: "build.builddirs"></a>14.3. Directories used
10971: during the build process</h2>
1.1 grant 10972: </div>
10973: </div>
10974: </div>
10975:
1.56 rillig 10976: <p>When building a package, a number of directories is
10977: used to store source files, temporary files,
10978: pkgsrc-internal files, and so on. These directories are
10979: explained here.</p>
10980:
10981: <p>Some of the directory variables contain relative
10982: pathnames. There are two common base directories for
10983: these relative directories: <code class=
10984: "varname">PKGSRCDIR/PKGPATH</code> is used for
10985: directories that are pkgsrc-specific. <code class=
10986: "varname">WRKSRC</code> is used for directories inside
1.66 rillig 10987: the package itself.</p>
1.1 grant 10988:
10989: <div class="variablelist">
10990: <dl>
1.56 rillig 10991: <dt><span class="term"><code class=
1.66 rillig 10992: "varname">PKGSRCDIR</code></span></dt>
1.56 rillig 10993:
10994: <dd>
10995: <p>This is an absolute pathname that points to the
10996: pkgsrc root directory. Generally, you don't need
10997: it.</p>
10998: </dd>
10999:
11000: <dt><span class="term"><code class=
1.66 rillig 11001: "varname">PKGPATH</code></span></dt>
1.1 grant 11002:
11003: <dd>
1.56 rillig 11004: <p>This is a pathname relative to <code class=
11005: "varname">PKGSRCDIR</code> that points to the
11006: current package.</p>
11007: </dd>
11008:
11009: <dt><span class="term"><code class=
1.66 rillig 11010: "varname">WRKDIR</code></span></dt>
1.56 rillig 11011:
11012: <dd>
11013: <p>This is an absolute pathname pointing to the
1.57 minskim 11014: directory where all work takes place. The distfiles
11015: are extraced to this directory. It also contains
11016: temporary directories and log files used by the
11017: various pkgsrc frameworks, like <span class=
11018: "emphasis"><em>buildlink</em></span> or the
11019: <span class=
1.56 rillig 11020: "emphasis"><em>wrappers</em></span>.</p>
11021: </dd>
11022:
11023: <dt><span class="term"><code class=
1.66 rillig 11024: "varname">WRKSRC</code></span></dt>
1.56 rillig 11025:
11026: <dd>
11027: <p>This is an absolute pathname pointing to the
11028: directory where the distfiles are extracted. It is
11029: usually a direct subdirectory of <code class=
11030: "varname">WRKDIR</code>, and often it's the only
1.66 rillig 11031: directory entry that isn't hidden. This variable
11032: may be changed by a package <code xmlns=
11033: "http://www.w3.org/TR/xhtml1/transitional" class=
11034: "filename">Makefile</code>.</p>
1.56 rillig 11035: </dd>
11036: </dl>
11037: </div>
11038: </div>
11039:
1.67 hubertf 11040: <div class="sect1" lang="en">
1.56 rillig 11041: <div class="titlepage">
11042: <div>
11043: <div>
11044: <h2 class="title" style="clear: both"><a name=
11045: "build.running"></a>14.4. Running a phase</h2>
11046: </div>
11047: </div>
11048: </div>
11049:
11050: <p>You can run a particular phase by typing
11051: <span><strong class="command">make phase</strong></span>,
11052: where <span class="emphasis"><em>phase</em></span> is the
11053: name of the phase. This will automatically run all phases
11054: that are required for this phase. The default phase is
11055: <code class="varname">build</code>, that is, when you run
11056: <span><strong class="command">make</strong></span>
11057: without parameters in a package directory, the package
11058: will be built, but not installed.</p>
11059: </div>
11060:
1.67 hubertf 11061: <div class="sect1" lang="en">
1.56 rillig 11062: <div class="titlepage">
11063: <div>
11064: <div>
11065: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11066: "build.fetch"></a>14.5. The <span class=
11067: "emphasis"><em>fetch</em></span> phase</h2>
1.56 rillig 11068: </div>
11069: </div>
11070: </div>
11071:
11072: <p>This will check if the file(s) given in the variables
11073: <code class="varname">DISTFILES</code> and <code class=
11074: "varname">PATCHFILES</code> (as defined in the package's
11075: Makefile) are present on the local system in <code xmlns=
11076: "http://www.w3.org/TR/xhtml1/transitional" class=
11077: "filename">/usr/pkgsrc/distfiles</code>. If they are not
11078: present, an attempt will be made to fetch them using
11079: commands of the form:</p>
11080: <pre class="programlisting">
1.51 rillig 11081: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 grant 11082: </pre>
11083:
1.56 rillig 11084: <p>where ${site} varies through several possibilities in
11085: turn: first, <code class=
11086: "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
11087: sites specified in either <code class=
1.72 ! rillig 11088: "varname">SITES.file</code> if defined, else <code class=
1.56 rillig 11089: "varname">MASTER_SITES</code> or <code class=
11090: "varname">PATCH_SITES</code>, as applies, then finally
11091: the value of <code class=
11092: "varname">MASTER_SITE_BACKUP</code>. The order of all
11093: except the first can be optionally sorted by the user,
11094: via setting either <code class=
11095: "varname">MASTER_SORT_AWK</code> or <code class=
11096: "varname">MASTER_SORT_REGEX</code>.</p>
11097: </div>
11098:
1.67 hubertf 11099: <div class="sect1" lang="en">
1.56 rillig 11100: <div class="titlepage">
11101: <div>
11102: <div>
11103: <h2 class="title" style="clear: both"><a name=
11104: "build.checksum"></a>14.6. The <span class=
11105: "emphasis"><em>checksum</em></span> phase</h2>
11106: </div>
11107: </div>
11108: </div>
11109:
11110: <p>After the distfile(s) are fetched, their checksum is
11111: generated and compared with the checksums stored in the
11112: distinfo file. If the checksums don't match, the build is
11113: aborted. This is to ensure the same distfile is used for
11114: building, and that the distfile wasn't changed, e.g. by
11115: some malign force, deliberately changed distfiles on the
11116: master distribution site or network lossage.</p>
11117: </div>
11118:
1.67 hubertf 11119: <div class="sect1" lang="en">
1.56 rillig 11120: <div class="titlepage">
11121: <div>
11122: <div>
11123: <h2 class="title" style="clear: both"><a name=
11124: "build.extract"></a>14.7. The <span class=
11125: "emphasis"><em>extract</em></span> phase</h2>
11126: </div>
11127: </div>
11128: </div>
11129:
11130: <p>When the distfiles are present on the local system,
1.69 rillig 11131: they need to be extracted, as they usually come in the
11132: form of some compressed archive format.</p>
11133:
11134: <p>By default, all <code class="varname">DISTFILES</code>
11135: are extracted. If you only need some of them, you can set
11136: the <code class="varname">EXTRACT_ONLY</code> variable to
11137: the list of those files.</p>
11138:
11139: <p>Extracting the files is usually done by a little
11140: program, <code xmlns=
11141: "http://www.w3.org/TR/xhtml1/transitional" class=
11142: "filename">mk/scripts/extract</code>, which already knows
11143: how to extract various archive formats, so most likely
11144: you will not need to change anything here. But if you
11145: need, the following variables may help you:</p>
11146:
11147: <div class="variablelist">
11148: <dl>
11149: <dt><span class="term"><code class=
11150: "varname">EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}</code></span></dt>
11151:
11152: <dd>
11153: <p>Use these variables to override the default
11154: options for an extract command, which are defined
11155: in <code xmlns=
11156: "http://www.w3.org/TR/xhtml1/transitional" class=
11157: "filename">mk/scripts/extract</code>.</p>
11158: </dd>
1.1 grant 11159:
1.69 rillig 11160: <dt><span class="term"><code class=
11161: "varname">EXTRACT_USING</code></span></dt>
1.1 grant 11162:
1.69 rillig 11163: <dd>
11164: <p>This variable can be set to <code class=
11165: "literal">pax</code>, <code class=
11166: "literal">tar</code> or an absolute pathname
11167: pointing to the command with which tar archives
11168: should be extracted.</p>
11169: </dd>
11170: </dl>
11171: </div>
11172:
11173: <p>If the <code xmlns=
1.56 rillig 11174: "http://www.w3.org/TR/xhtml1/transitional" class=
1.69 rillig 11175: "filename">extract</code> program doesn't serve your
11176: needs, you can also override the <code class=
11177: "varname">EXTRACT_CMD</code> variable, which holds the
11178: command used for extracting the files. This command is
11179: executed in the <code xmlns=
11180: "http://www.w3.org/TR/xhtml1/transitional" class=
11181: "filename">${WRKSRC}</code> directory. During execution
11182: of this command, the shell variable <code class=
11183: "varname">extract_file</code> holds the absolute pathname
11184: of the file that is going to be extracted.</p>
11185:
11186: <p>And if that still does not suffice, you can override
11187: the <code class="varname">do-extract</code> target in the
11188: package Makefile.</p>
1.56 rillig 11189: </div>
11190:
1.67 hubertf 11191: <div class="sect1" lang="en">
1.56 rillig 11192: <div class="titlepage">
11193: <div>
11194: <div>
11195: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11196: "build.patch"></a>14.8. The <span class=
11197: "emphasis"><em>patch</em></span> phase</h2>
1.56 rillig 11198: </div>
11199: </div>
11200: </div>
11201:
11202: <p>After extraction, all the patches named by the
11203: <code class="varname">PATCHFILES</code>, those present in
11204: the patches subdirectory of the package as well as in
11205: $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
11206: "http://www.w3.org/TR/xhtml1/transitional" class=
11207: "filename">/usr/local/patches/graphics/png</code>) are
11208: applied. Patchfiles ending in <code xmlns=
11209: "http://www.w3.org/TR/xhtml1/transitional" class=
11210: "filename">.Z</code> or <code xmlns=
11211: "http://www.w3.org/TR/xhtml1/transitional" class=
11212: "filename">.gz</code> are uncompressed before they are
11213: applied, files ending in <code xmlns=
11214: "http://www.w3.org/TR/xhtml1/transitional" class=
11215: "filename">.orig</code> or <code xmlns=
11216: "http://www.w3.org/TR/xhtml1/transitional" class=
11217: "filename">.rej</code> are ignored. Any special options
11218: to <a href=
11219: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
11220: <span class="citerefentry"><span class=
11221: "refentrytitle">patch</span>(1)</span></a> can be handed
11222: in <code class="varname">PATCH_DIST_ARGS</code>. See
11223: <a href="#components.patches" title=
11224: "8.3. patches/*">Section 8.3,
11225: “patches/*”</a> for more details.</p>
11226:
11227: <p>By default <a href=
11228: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
11229: <span class="citerefentry"><span class=
11230: "refentrytitle">patch</span>(1)</span></a> is given
11231: special args to make it fail if the patches apply with
11232: some lines of fuzz. Please fix (regen) the patches so
11233: that they apply cleanly. The rationale behind this is
11234: that patches that don't apply cleanly may end up being
11235: applied in the wrong place, and cause severe harm
11236: there.</p>
11237: </div>
11238:
1.67 hubertf 11239: <div class="sect1" lang="en">
1.56 rillig 11240: <div class="titlepage">
11241: <div>
11242: <div>
11243: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11244: "build.tools"></a>14.9. The <span class=
11245: "emphasis"><em>tools</em></span> phase</h2>
1.56 rillig 11246: </div>
11247: </div>
11248: </div>
11249:
1.68 rillig 11250: <p>This is covered in <a href="#tools" title=
11251: "Chapter 15. Tools needed for building or running">
11252: Chapter 15, <i>Tools needed for building or
11253: running</i></a>.</p>
1.56 rillig 11254: </div>
11255:
1.67 hubertf 11256: <div class="sect1" lang="en">
1.56 rillig 11257: <div class="titlepage">
11258: <div>
11259: <div>
11260: <h2 class="title" style="clear: both"><a name=
11261: "build.wrapper"></a>14.10. The <span class=
11262: "emphasis"><em>wrapper</em></span> phase</h2>
11263: </div>
11264: </div>
11265: </div>
11266:
1.72 ! rillig 11267: <p>This phase creates wrapper programs for the compilers
! 11268: and linkers. The following variables can be used to tweak
! 11269: the wrappers.</p>
! 11270:
! 11271: <div class="variablelist">
! 11272: <dl>
! 11273: <dt><span class="term"><code class=
! 11274: "varname">ECHO_WRAPPER_MSG</code></span></dt>
! 11275:
! 11276: <dd>
! 11277: <p>The command used to print progress messages.
! 11278: Does nothing by default. Set to <code class=
! 11279: "literal">${ECHO}</code> to see the progress
! 11280: messages.</p>
! 11281: </dd>
! 11282:
! 11283: <dt><span class="term"><code class=
! 11284: "varname">WRAPPER_DEBUG</code></span></dt>
! 11285:
! 11286: <dd>
! 11287: <p>This variable can be set to <code class=
! 11288: "literal">yes</code> (default) or <code class=
! 11289: "literal">no</code>, depending on whether you want
! 11290: additional information in the wrapper log file.</p>
! 11291: </dd>
! 11292:
! 11293: <dt><span class="term"><code class=
! 11294: "varname">WRAPPER_UPDATE_CACHE</code></span></dt>
! 11295:
! 11296: <dd>
! 11297: <p>This variable can be set to <code class=
! 11298: "literal">yes</code> or <code class=
! 11299: "literal">no</code>, depending on whether the
! 11300: wrapper should use its cache, which will improve
! 11301: the speed. The default value is <code class=
! 11302: "literal">yes</code>, but is forced to <code class=
! 11303: "literal">no</code> if the platform does not
! 11304: support it.</p>
! 11305: </dd>
! 11306:
! 11307: <dt><span class="term"><code class=
! 11308: "varname">WRAPPER_REORDER_CMDS</code></span></dt>
! 11309:
! 11310: <dd>
! 11311: <p>A list of reordering commands. A reordering
! 11312: command has the form <code class=
! 11313: "literal">reorder:l:<em class=
! 11314: "replaceable"><code>lib1</code></em>:<em class=
! 11315: "replaceable"><code>lib2</code></em></code>. It
! 11316: ensures that that <code class=
! 11317: "literal">-l<em class="replaceable"><code>lib1</code></em></code>
! 11318: occurs before <code class="literal">-l<em class=
! 11319: "replaceable"><code>lib2</code></em></code>.</p>
! 11320: </dd>
! 11321:
! 11322: <dt><span class="term"><code class=
! 11323: "varname">WRAPPER_TRANSFORM_CMDS</code></span></dt>
! 11324:
! 11325: <dd>
! 11326: <p>A list of transformation commands. [TODO:
! 11327: investigate further]</p>
! 11328: </dd>
! 11329: </dl>
! 11330: </div>
1.56 rillig 11331: </div>
11332:
1.67 hubertf 11333: <div class="sect1" lang="en">
1.56 rillig 11334: <div class="titlepage">
11335: <div>
11336: <div>
11337: <h2 class="title" style="clear: both"><a name=
11338: "build.configure"></a>14.11. The <span class=
11339: "emphasis"><em>configure</em></span> phase</h2>
11340: </div>
11341: </div>
11342: </div>
11343:
11344: <p>Most pieces of software need information on the header
11345: files, system calls, and library routines which are
11346: available on the platform they run on. The process of
11347: determining this information is known as configuration,
11348: and is usually automated. In most cases, a script is
11349: supplied with the distfiles, and its invocation results
11350: in generation of header files, Makefiles, etc.</p>
11351:
11352: <p>If the package contains a configure script, this can
11353: be invoked by setting <code class=
11354: "varname">HAS_CONFIGURE</code> to “<span class=
11355: "quote">yes</span>”. If the configure script is a
11356: GNU autoconf script, you should set <code class=
11357: "varname">GNU_CONFIGURE</code> to “<span class=
11358: "quote">yes</span>” instead. What happens in the
11359: <span class="emphasis"><em>configure</em></span> phase is
11360: roughly:</p>
11361: <pre class="programlisting">
11362: .for d in ${CONFIGURE_DIRS}
11363: cd ${WRKSRC} && cd ${d} && env ${CONFIGURE_ENV} \
11364: ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
11365: .endfor
11366: </pre>
1.1 grant 11367:
1.56 rillig 11368: <p><code class="varname">CONFIGURE_DIRS</code> (default:
11369: “<span class="quote">.</span>”) is a list of
11370: pathnames relative to <code class=
11371: "varname">WRKSRC</code>. In each of these directories,
11372: the configure script is run with the environment
11373: <code class="varname">CONFIGURE_ENV</code> and arguments
11374: <code class="varname">CONFIGURE_ARGS</code>. The
11375: variables <code class="varname">CONFIGURE_ENV</code>,
11376: <code class="varname">CONFIGURE_SCRIPT</code> (default:
11377: “<span class="quote">./configure</span>”) and
11378: <code class="varname">CONFIGURE_ARGS</code> may all be
11379: changed by the package.</p>
1.1 grant 11380:
1.56 rillig 11381: <p>If the program uses an <code xmlns=
11382: "http://www.w3.org/TR/xhtml1/transitional" class=
11383: "filename">Imakefile</code> for configuration, the
11384: appropriate steps can be invoked by setting <code class=
11385: "varname">USE_IMAKE</code> to “<span class=
11386: "quote">yes</span>”. (If you only want the package
11387: installed in <code class="varname">${X11PREFIX}</code>
11388: but xmkmf not being run, set <code class=
11389: "varname">USE_X11BASE</code> instead.)</p>
11390: </div>
1.1 grant 11391:
1.67 hubertf 11392: <div class="sect1" lang="en">
1.56 rillig 11393: <div class="titlepage">
11394: <div>
11395: <div>
11396: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11397: "build.build"></a>14.12. The <span class=
11398: "emphasis"><em>build</em></span> phase</h2>
1.56 rillig 11399: </div>
11400: </div>
1.1 grant 11401: </div>
11402:
1.56 rillig 11403: <p>For building a package, a rough equivalent of the
11404: following code is executed.</p>
1.1 grant 11405: <pre class="programlisting">
1.56 rillig 11406: .for d in ${BUILD_DIRS}
11407: cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \
11408: ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
11409: -f ${MAKEFILE} ${BUILD_TARGET}
11410: .endfor
1.1 grant 11411: </pre>
1.56 rillig 11412:
11413: <p><code class="varname">BUILD_DIRS</code> (default:
11414: “<span class="quote">.</span>”) is a list of
11415: pathnames relative to <code class=
11416: "varname">WRKSRC</code>. In each of these directories,
11417: <code class="varname">MAKE_PROGRAM</code> is run with the
11418: environment <code class="varname">MAKE_ENV</code> and
11419: arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
11420: The variables <code class="varname">MAKE_ENV</code>,
11421: <code class="varname">BUILD_MAKE_FLAGS</code>,
11422: <code class="varname">MAKEFILE</code> and <code class=
11423: "varname">BUILD_TARGET</code> may all be changed by the
11424: package.</p>
11425:
11426: <p>The default value of <code class=
11427: "varname">MAKE_PROGRAM</code> is “<span class=
11428: "quote">gmake</span>” if <code class=
11429: "varname">USE_TOOLS</code> contains “<span class=
11430: "quote">gmake</span>”, “<span class=
11431: "quote">make</span>” otherwise. The default value
11432: of <code class="varname">MAKEFILE</code> is
11433: “<span class="quote">Makefile</span>”, and
11434: <code class="varname">BUILD_TARGET</code> defaults to
11435: “<span class="quote">all</span>”.</p>
11436: </div>
11437:
1.67 hubertf 11438: <div class="sect1" lang="en">
1.56 rillig 11439: <div class="titlepage">
11440: <div>
11441: <div>
11442: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11443: "build.test"></a>14.13. The <span class=
11444: "emphasis"><em>test</em></span> phase</h2>
1.56 rillig 11445: </div>
11446: </div>
11447: </div>
11448:
11449: <p>[TODO]</p>
11450: </div>
11451:
1.67 hubertf 11452: <div class="sect1" lang="en">
1.56 rillig 11453: <div class="titlepage">
11454: <div>
11455: <div>
11456: <h2 class="title" style="clear: both"><a name=
11457: "build.install"></a>14.14. The <span class=
11458: "emphasis"><em>install</em></span> phase</h2>
11459: </div>
11460: </div>
11461: </div>
11462:
11463: <p>Once the build stage has completed, the final step is
11464: to install the software in public directories, so users
1.68 rillig 11465: can access the programs and files.</p>
11466:
11467: <p>In the <span class="emphasis"><em>install</em></span>
11468: phase, a rough equivalent of the following code is
11469: executed. Additionally, before and after this code, much
11470: magic is performed to do consistency checks, registering
11471: the package, and so on.</p>
11472: <pre class="programlisting">
11473: .for d in ${INSTALL_DIRS}
11474: cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \
11475: ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \
11476: -f ${MAKEFILE} ${BUILD_TARGET}
11477: .endfor
11478: </pre>
11479:
11480: <p>The variable's meanings are analogous to the ones in
11481: the <span class="emphasis"><em>build</em></span> phase.
11482: <code class="varname">INSTALL_DIRS</code> defaults to
11483: <code class="varname">BUILD_DIRS</code>. <code class=
11484: "varname">INSTALL_TARGET</code> is “<span class=
11485: "quote">install</span>” by default, plus
11486: “<span class="quote">install.man</span>” if
11487: <code class="varname">USE_IMAKE</code> is defined.</p>
11488:
11489: <p>In the <span class="emphasis"><em>install</em></span>
11490: phase, the following variables are useful. They are all
11491: variations of the <a href=
11492: "http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
11493: <span class="citerefentry"><span class=
11494: "refentrytitle">install</span>(1)</span></a> command that
11495: have the owner, group and permissions preset.
11496: <code class="varname">INSTALL</code> is the plain install
11497: command. The specialized variants, together with their
11498: intended use, are:</p>
11499:
11500: <div class="variablelist">
11501: <dl>
11502: <dt><span class="term"><code class=
11503: "varname">INSTALL_PROGRAM_DIR</code></span></dt>
11504:
11505: <dd>
11506: <p>directories that contain binaries</p>
11507: </dd>
11508:
11509: <dt><span class="term"><code class=
11510: "varname">INSTALL_SCRIPT_DIR</code></span></dt>
11511:
11512: <dd>
11513: <p>directories that contain scripts</p>
11514: </dd>
11515:
11516: <dt><span class="term"><code class=
11517: "varname">INSTALL_LIB_DIR</code></span></dt>
11518:
11519: <dd>
11520: <p>directories that contain shared and static
11521: libraries</p>
11522: </dd>
11523:
11524: <dt><span class="term"><code class=
11525: "varname">INSTALL_DATA_DIR</code></span></dt>
11526:
11527: <dd>
11528: <p>directories that contain data files</p>
11529: </dd>
11530:
11531: <dt><span class="term"><code class=
11532: "varname">INSTALL_MAN_DIR</code></span></dt>
11533:
11534: <dd>
11535: <p>directories that contain man pages</p>
11536: </dd>
11537:
11538: <dt><span class="term"><code class=
11539: "varname">INSTALL_PROGRAM</code></span></dt>
11540:
11541: <dd>
11542: <p>binaries that can be stripped from debugging
11543: symbols</p>
11544: </dd>
11545:
11546: <dt><span class="term"><code class=
11547: "varname">INSTALL_SCRIPT</code></span></dt>
11548:
11549: <dd>
11550: <p>binaries that cannot be stripped</p>
11551: </dd>
11552:
11553: <dt><span class="term"><code class=
11554: "varname">INSTALL_GAME</code></span></dt>
11555:
11556: <dd>
11557: <p>game binaries</p>
11558: </dd>
11559:
11560: <dt><span class="term"><code class=
11561: "varname">INSTALL_LIB</code></span></dt>
11562:
11563: <dd>
11564: <p>shared and static libraries</p>
11565: </dd>
11566:
11567: <dt><span class="term"><code class=
11568: "varname">INSTALL_DATA</code></span></dt>
11569:
11570: <dd>
11571: <p>data files</p>
11572: </dd>
11573:
11574: <dt><span class="term"><code class=
11575: "varname">INSTALL_GAME_DATA</code></span></dt>
11576:
11577: <dd>
11578: <p>data files for games</p>
11579: </dd>
11580:
11581: <dt><span class="term"><code class=
11582: "varname">INSTALL_MAN</code></span></dt>
11583:
11584: <dd>
11585: <p>man pages</p>
11586: </dd>
11587: </dl>
11588: </div>
11589:
11590: <p>Some other variables are:</p>
11591:
11592: <div class="variablelist">
11593: <dl>
11594: <dt><span class="term"><code class=
11595: "varname">INSTALLATION_DIRS</code></span></dt>
11596:
11597: <dd>
11598: <p>A list of directories relative to <code class=
11599: "varname">PREFIX</code> that are created by pkgsrc
11600: at the beginning of the <span class=
11601: "emphasis"><em>install</em></span> phase. If this
11602: variable is set, <code class=
11603: "varname">NO_MTREE</code>=“<span class=
11604: "quote">yes</span>” is assumed, which means
11605: that the package claims to create all needed
11606: directories itself before installing files to it.
11607: Therefore this variable should only be set in
11608: <code xmlns=
11609: "http://www.w3.org/TR/xhtml1/transitional" class=
11610: "filename">Makefile</code>s that are under control
11611: of the package's author.</p>
11612: </dd>
11613: </dl>
11614: </div>
1.56 rillig 11615: </div>
11616:
1.67 hubertf 11617: <div class="sect1" lang="en">
1.56 rillig 11618: <div class="titlepage">
11619: <div>
11620: <div>
11621: <h2 class="title" style="clear: both"><a name=
11622: "build.package"></a>14.15. The <span class=
11623: "emphasis"><em>package</em></span> phase</h2>
11624: </div>
11625: </div>
11626: </div>
11627:
11628: <p>[TODO]</p>
1.1 grant 11629: </div>
11630:
1.67 hubertf 11631: <div class="sect1" lang="en">
1.1 grant 11632: <div class="titlepage">
11633: <div>
11634: <div>
11635: <h2 class="title" style="clear: both"><a name=
1.56 rillig 11636: "build.helpful-targets"></a>14.16. Other
1.1 grant 11637: helpful targets</h2>
11638: </div>
11639: </div>
11640: </div>
11641:
11642: <div class="variablelist">
11643: <dl>
11644: <dt><span class="term">pre/post-*</span></dt>
11645:
11646: <dd>
11647: <p>For any of the main targets described in the
11648: previous section, two auxiliary targets exist with
11649: “<span class="quote">pre-</span>” and
11650: “<span class="quote">post-</span>” used
11651: as a prefix for the main target's name. These
11652: targets are invoked before and after the main
11653: target is called, allowing extra configuration or
11654: installation steps be performed from a package's
11655: Makefile, for example, which a program's configure
11656: script or install target omitted.</p>
11657: </dd>
11658:
11659: <dt><span class="term">do-*</span></dt>
11660:
11661: <dd>
11662: <p>Should one of the main targets do the wrong
11663: thing, and should there be no variable to fix this,
11664: you can redefine it with the do-* target. (Note
11665: that redefining the target itself instead of the
11666: do-* target is a bad idea, as the pre-* and post-*
11667: targets won't be called anymore, etc.) You will not
11668: usually need to do this.</p>
11669: </dd>
11670:
11671: <dt><span class="term">reinstall</span></dt>
11672:
11673: <dd>
1.14 xtraeme 11674: <p>If you did a <span><strong class="command">make
11675: install</strong></span> and you noticed some file
11676: was not installed properly, you can repeat the
1.1 grant 11677: installation with this target, which will ignore
11678: the “<span class="quote">already
11679: installed</span>” flag.</p>
11680: </dd>
11681:
11682: <dt><span class="term">deinstall</span></dt>
11683:
11684: <dd>
1.24 wiz 11685: <p>This target does a <a href=
11686: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11687: <span class="citerefentry"><span class=
11688: "refentrytitle">pkg_delete</span>(1)</span></a> in
11689: the current directory, effectively de-installing
11690: the package. The following variables can be used to
11691: tune the behaviour:</p>
1.1 grant 11692:
11693: <div class="variablelist">
11694: <dl>
1.14 xtraeme 11695: <dt><span class="term"><code class=
11696: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 11697:
11698: <dd>
11699: <p>Add a "-v" to the <a href=
11700: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11701: <span class="citerefentry"><span class=
11702: "refentrytitle">pkg_delete</span>(1)</span></a>
11703: command.</p>
11704: </dd>
11705:
1.14 xtraeme 11706: <dt><span class="term"><code class=
11707: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 11708:
11709: <dd>
11710: <p>Remove all packages that require (depend
11711: on) the given package. This can be used to
11712: remove any packages that may have been pulled
11713: in by a given package, e.g. if
1.14 xtraeme 11714: <span><strong class="command">make deinstall
11715: DEINSTALLDEPENDS=1</strong></span> is done in
1.45 wiz 11716: <code xmlns=
11717: "http://www.w3.org/TR/xhtml1/transitional"
11718: class="filename">pkgsrc/x11/kde</code>, this
11719: is likely to remove whole KDE. Works by
1.1 grant 11720: adding “<span class=
11721: "quote">-R</span>” to the <a href=
11722: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11723: <span class="citerefentry"><span class=
11724: "refentrytitle">pkg_delete</span>(1)</span></a>
11725: command line.</p>
11726: </dd>
11727: </dl>
11728: </div>
11729: </dd>
11730:
11731: <dt><span class="term">update</span></dt>
11732:
11733: <dd>
11734: <p>This target causes the current package to be
11735: updated to the latest version. The package and all
11736: depending packages first get de-installed, then
11737: current versions of the corresponding packages get
11738: compiled and installed. This is similar to manually
11739: noting which packages are currently installed, then
1.14 xtraeme 11740: performing a series of <span><strong class=
11741: "command">make deinstall</strong></span> and
11742: <span><strong class="command">make
11743: install</strong></span> (or whatever <code class=
11744: "varname">UPDATE_TARGET</code> is set to) for these
11745: packages.</p>
1.1 grant 11746:
11747: <p>You can use the “<span class=
11748: "quote">update</span>” target to resume
1.14 xtraeme 11749: package updating in case a previous
11750: <span><strong class="command">make
11751: update</strong></span> was interrupted for some
11752: reason. However, in this case, make sure you don't
11753: call <span><strong class="command">make
11754: clean</strong></span> or otherwise remove the list
11755: of dependent packages in <code class=
1.47 reed 11756: "varname">WRKDIR</code>. Otherwise, you lose the
1.1 grant 11757: ability to automatically update the current package
11758: along with the dependent packages you have
11759: installed.</p>
11760:
1.14 xtraeme 11761: <p>Resuming an interrupted <span><strong class=
11762: "command">make update</strong></span> will only
11763: work as long as the package tree remains unchanged.
11764: If the source code for one of the packages to be
11765: updated has been changed, resuming
11766: <span><strong class="command">make
11767: update</strong></span> will most certainly
11768: fail!</p>
1.1 grant 11769:
11770: <p>The following variables can be used either on
1.45 wiz 11771: the command line or in <code xmlns=
11772: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11773: "filename">/etc/mk.conf</code> to alter the
11774: behaviour of <span><strong class="command">make
11775: update</strong></span>:</p>
1.1 grant 11776:
11777: <div class="variablelist">
11778: <dl>
1.14 xtraeme 11779: <dt><span class="term"><code class=
11780: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 11781:
11782: <dd>
11783: <p>Install target to recursively use for the
11784: updated package and the dependent packages.
1.14 xtraeme 11785: Defaults to <code class=
11786: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 11787: “<span class=
11788: "quote">install</span>” otherwise for
1.14 xtraeme 11789: <span><strong class="command">make
11790: update</strong></span>. e.g.
11791: <span><strong class="command">make update
11792: UPDATE_TARGET=package</strong></span></p>
1.1 grant 11793: </dd>
11794:
1.14 xtraeme 11795: <dt><span class="term"><code class=
11796: "varname">NOCLEAN</code></span></dt>
1.1 grant 11797:
11798: <dd>
11799: <p>Don't clean up after updating. Useful if
11800: you want to leave the work sources of the
11801: updated packages around for inspection or
11802: other purposes. Be sure you eventually clean
11803: up the source tree (see the
11804: “<span class=
11805: "quote">clean-update</span>” target
11806: below) or you may run into troubles with old
11807: source code still lying around on your next
1.14 xtraeme 11808: <span><strong class=
11809: "command">make</strong></span> or
11810: <span><strong class="command">make
11811: update</strong></span>.</p>
1.1 grant 11812: </dd>
11813:
1.14 xtraeme 11814: <dt><span class="term"><code class=
11815: "varname">REINSTALL</code></span></dt>
1.1 grant 11816:
11817: <dd>
11818: <p>Deinstall each package before installing
1.14 xtraeme 11819: (making <code class=
11820: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 11821: necessary if the “<span class=
11822: "quote">clean-update</span>” target
11823: (see below) was called after interrupting a
1.14 xtraeme 11824: running <span><strong class="command">make
11825: update</strong></span>.</p>
1.1 grant 11826: </dd>
11827:
1.14 xtraeme 11828: <dt><span class="term"><code class=
11829: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 11830:
11831: <dd>
11832: <p>Allows you to disable recursion and
11833: hardcode the target for packages. The default
11834: is “<span class=
11835: "quote">update</span>” for the update
11836: target, facilitating a recursive update of
1.14 xtraeme 11837: prerequisite packages. Only set <code class=
11838: "varname">DEPENDS_TARGET</code> if you want
11839: to disable recursive updates. Use
11840: <code class="varname">UPDATE_TARGET</code>
11841: instead to just set a specific target for
11842: each package to be installed during
11843: <span><strong class="command">make
11844: update</strong></span> (see above).</p>
1.1 grant 11845: </dd>
11846: </dl>
11847: </div>
11848: </dd>
11849:
11850: <dt><span class="term">clean-update</span></dt>
11851:
11852: <dd>
11853: <p>Clean the source tree for all packages that
1.14 xtraeme 11854: would get updated if <span><strong class=
11855: "command">make update</strong></span> was called
11856: from the current directory. This target should not
11857: be used if the current package (or any of its
11858: depending packages) have already been de-installed
11859: (e.g., after calling <span><strong class=
11860: "command">make update</strong></span>) or you may
11861: lose some packages you intended to update. As a
11862: rule of thumb: only use this target <span class=
11863: "emphasis"><em>before</em></span> the first time
11864: you run <span><strong class="command">make
11865: update</strong></span> and only if you have a dirty
11866: package tree (e.g., if you used <code class=
11867: "varname">NOCLEAN</code>).</p>
1.1 grant 11868:
1.47 reed 11869: <p>If you are unsure about whether your tree is
11870: clean, you can either perform a
1.14 xtraeme 11871: <span><strong class="command">make
1.47 reed 11872: clean</strong></span> at the top of the tree, or
11873: use the following sequence of commands from the
11874: directory of the package you want to update
11875: (<span class="emphasis"><em>before</em></span>
11876: running <span><strong class="command">make
1.14 xtraeme 11877: update</strong></span> for the first time,
11878: otherwise you lose all the packages you wanted to
11879: update!):</p>
1.1 grant 11880: <pre class="screen">
1.14 xtraeme 11881: <code class="prompt">#</code> <strong class=
11882: "userinput"><code>make clean-update</code></strong>
11883: <code class="prompt">#</code> <strong class=
11884: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
11885: <code class="prompt">#</code> <strong class=
11886: "userinput"><code>make update</code></strong>
1.1 grant 11887: </pre>
11888:
11889: <p>The following variables can be used either on
1.45 wiz 11890: the command line or in <code xmlns=
11891: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11892: "filename">/etc/mk.conf</code> to alter the
11893: behaviour of <span><strong class="command">make
11894: clean-update</strong></span>:</p>
1.1 grant 11895:
11896: <div class="variablelist">
11897: <dl>
1.14 xtraeme 11898: <dt><span class="term"><code class=
11899: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 11900:
11901: <dd>
1.14 xtraeme 11902: <p>After <span><strong class="command">make
11903: clean</strong></span>, do not reconstruct the
11904: list of directories to update for this
11905: package. Only use this if
11906: <span><strong class="command">make
11907: update</strong></span> successfully installed
11908: all packages you wanted to update. Normally,
11909: this is done automatically on
11910: <span><strong class="command">make
11911: update</strong></span>, but may have been
11912: suppressed by the <code class=
11913: "varname">NOCLEAN</code> variable (see
1.1 grant 11914: above).</p>
11915: </dd>
11916: </dl>
11917: </div>
11918: </dd>
11919:
11920: <dt><span class="term">info</span></dt>
11921:
11922: <dd>
11923: <p>This target invokes <a href=
11924: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11925: <span class="citerefentry"><span class=
11926: "refentrytitle">pkg_info</span>(1)</span></a> for
11927: the current package. You can use this to check
11928: which version of a package is installed.</p>
11929: </dd>
11930:
11931: <dt><span class="term">readme</span></dt>
11932:
11933: <dd>
1.45 wiz 11934: <p>This target generates a <code xmlns=
11935: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11936: "filename">README.html</code> file, which can be
1.1 grant 11937: viewed using a browser such as <a xmlns=
11938: "http://www.w3.org/TR/xhtml1/transitional" href=
11939: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 11940: target="_top"><code xmlns="" class=
11941: "filename">www/mozilla</code></a> or <a xmlns=
1.20 ben 11942: "http://www.w3.org/TR/xhtml1/transitional" href=
11943: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45 wiz 11944: target="_top"><code xmlns="" class=
11945: "filename">www/links</code></a>. The generated
11946: files contain references to any packages which are
11947: in the <code class="varname">PACKAGES</code>
11948: directory on the local host. The generated files
11949: can be made to refer to URLs based on <code class=
1.20 ben 11950: "varname">FTP_PKG_URL_HOST</code> and <code class=
11951: "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45 wiz 11952: wanted to generate <code xmlns=
11953: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11954: "filename">README.html</code> files which pointed
11955: to binary packages on the local machine, in the
1.45 wiz 11956: directory <code xmlns=
11957: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11958: "filename">/usr/packages</code>, set <code class=
11959: "varname">FTP_PKG_URL_HOST=file://localhost</code>
11960: and <code class=
11961: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
11962: <code class="varname">${PACKAGES}</code> directory
11963: and its subdirectories will be searched for all the
11964: binary packages.</p>
1.1 grant 11965: </dd>
11966:
11967: <dt><span class="term">readme-all</span></dt>
11968:
11969: <dd>
1.45 wiz 11970: <p>Use this target to create a file <code xmlns=
11971: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11972: "filename">README-all.html</code> which contains a
1.1 grant 11973: list of all packages currently available in the
11974: NetBSD Packages Collection, together with the
11975: category they belong to and a short description.
1.45 wiz 11976: This file is compiled from the <code xmlns=
11977: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11978: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 11979: sure to run this <span class=
1.14 xtraeme 11980: "emphasis"><em>after</em></span> a
11981: <span><strong class="command">make
11982: readme</strong></span>.</p>
1.1 grant 11983: </dd>
11984:
11985: <dt><span class="term">cdrom-readme</span></dt>
11986:
11987: <dd>
11988: <p>This is very much the same as the
11989: “<span class="quote">readme</span>”
11990: target (see above), but is to be used when
11991: generating a pkgsrc tree to be written to a CD-ROM.
1.45 wiz 11992: This target also produces <code xmlns=
11993: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11994: "filename">README.html</code> files, and can be
11995: made to refer to URLs based on <code class=
11996: "varname">CDROM_PKG_URL_HOST</code> and
11997: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 11998: </dd>
11999:
12000: <dt><span class="term">show-distfiles</span></dt>
12001:
12002: <dd>
12003: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 12004: are needed to build the package. (<code class=
12005: "varname">DISTFILES</code> and <code class=
1.45 wiz 12006: "varname">PATCHFILES</code>, but not <code xmlns=
12007: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12008: "filename">patches/*</code>)</p>
1.1 grant 12009: </dd>
12010:
12011: <dt><span class="term">show-downlevel</span></dt>
12012:
12013: <dd>
12014: <p>This target shows nothing if the package is not
12015: installed. If a version of this package is
12016: installed, but is not the version provided in this
12017: version of pkgsrc, then a warning message is
12018: displayed. This target can be used to show which of
12019: your installed packages are downlevel, and so the
12020: old versions can be deleted, and the current ones
12021: added.</p>
12022: </dd>
12023:
12024: <dt><span class="term">show-pkgsrc-dir</span></dt>
12025:
12026: <dd>
12027: <p>This target shows the directory in the pkgsrc
12028: hierarchy from which the package can be built and
12029: installed. This may not be the same directory as
12030: the one from which the package was installed. This
12031: target is intended to be used by people who may
12032: wish to upgrade many packages on a single host, and
12033: can be invoked from the top-level pkgsrc Makefile
12034: by using the “<span class=
12035: "quote">show-host-specific-pkgs</span>”
12036: target.</p>
12037: </dd>
12038:
12039: <dt><span class=
12040: "term">show-installed-depends</span></dt>
12041:
12042: <dd>
12043: <p>This target shows which installed packages match
1.14 xtraeme 12044: the current package's <code class=
12045: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 12046: dependencies are causing build problems.</p>
12047: </dd>
12048:
12049: <dt><span class="term">check-shlibs</span></dt>
12050:
12051: <dd>
12052: <p>After a package is installed, check all its
12053: binaries and (on ELF platforms) shared libraries to
12054: see if they find the shared libs they need. Run by
1.14 xtraeme 12055: default if <code class=
12056: "varname">PKG_DEVELOPER</code> is set in
1.45 wiz 12057: <code xmlns=
12058: "http://www.w3.org/TR/xhtml1/transitional" class=
12059: "filename">/etc/mk.conf</code>.</p>
1.1 grant 12060: </dd>
12061:
12062: <dt><span class="term">print-PLIST</span></dt>
12063:
12064: <dd>
12065: <p>After a “<span class="quote">make
12066: install</span>” from a new or upgraded pkg,
12067: this prints out an attempt to generate a new
1.45 wiz 12068: <code xmlns=
12069: "http://www.w3.org/TR/xhtml1/transitional" class=
12070: "filename">PLIST</code> from a <span><strong class=
12071: "command">find -newer
1.14 xtraeme 12072: work/.extract_done</strong></span>. An attempt is
12073: made to care for shared libs etc., but it is
1.1 grant 12074: <span class="emphasis"><em>strongly</em></span>
12075: recommended to review the result before putting it
1.45 wiz 12076: into <code xmlns=
12077: "http://www.w3.org/TR/xhtml1/transitional" class=
12078: "filename">PLIST</code>. On upgrades, it's useful
12079: to diff the output of this command against an
12080: already existing <code xmlns=
12081: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12082: "filename">PLIST</code> file.</p>
1.1 grant 12083:
1.24 wiz 12084: <p>If the package installs files via <a href=
12085: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
12086: <span class="citerefentry"><span class=
12087: "refentrytitle">tar</span>(1)</span></a> or other
12088: methods that don't update file access times, be
12089: sure to add these files manually to your
1.45 wiz 12090: <code xmlns=
12091: "http://www.w3.org/TR/xhtml1/transitional" class=
12092: "filename">PLIST</code>, as the “<span class=
12093: "quote">find -newer</span>” command used by
12094: this target won't catch them!</p>
1.1 grant 12095:
12096: <p>See <a href="#print-PLIST" title=
1.38 dillo 12097: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 12098: “Tweaking output of <span><strong class=
12099: "command">make
12100: print-PLIST</strong></span>”</a> for more
12101: information on this target.</p>
1.1 grant 12102: </dd>
12103:
12104: <dt><span class="term">bulk-package</span></dt>
12105:
12106: <dd>
12107: <p>Used to do bulk builds. If an appropriate binary
12108: package already exists, no action is taken. If not,
12109: this target will compile, install and package it
1.47 reed 12110: (and its depends, if <code class=
1.14 xtraeme 12111: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 12112: <a href="#binary.configuration" title=
1.38 dillo 12113: "6.3.1. Configuration">Section 6.3.1,
1.47 reed 12114: “Configuration”</a>). After creating
12115: the binary package, the sources, the just-installed
12116: package and its required packages are removed,
1.1 grant 12117: preserving free disk space.</p>
12118:
12119: <p><span class="emphasis"><em>Beware that this
12120: target may deinstall all packages installed on a
12121: system!</em></span></p>
12122: </dd>
12123:
12124: <dt><span class="term">bulk-install</span></dt>
12125:
12126: <dd>
12127: <p>Used during bulk-installs to install required
1.47 reed 12128: packages. If an up-to-date binary package is
1.1 grant 12129: available, it will be installed via <a href=
12130: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
12131: <span class="citerefentry"><span class=
12132: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 12133: not, <span><strong class="command">make
12134: bulk-package</strong></span> will be executed, but
1.47 reed 12135: the installed binary won't be removed.</p>
1.1 grant 12136:
12137: <p>A binary package is considered
1.47 reed 12138: “<span class="quote">up-to-date</span>”
1.1 grant 12139: to be installed via <a href=
12140: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
12141: <span class="citerefentry"><span class=
12142: "refentrytitle">pkg_add</span>(1)</span></a>
12143: if:</p>
12144:
12145: <div class="itemizedlist">
12146: <ul type="disc">
12147: <li>
1.45 wiz 12148: <p>None of the package's files (<code xmlns=
12149: "http://www.w3.org/TR/xhtml1/transitional"
12150: class="filename">Makefile</code>, ...) were
1.14 xtraeme 12151: modified since it was built.</p>
1.1 grant 12152: </li>
12153:
12154: <li>
12155: <p>None of the package's required (binary)
12156: packages were modified since it was
12157: built.</p>
12158: </li>
12159: </ul>
12160: </div>
12161:
12162: <p><span class="emphasis"><em>Beware that this
12163: target may deinstall all packages installed on a
12164: system!</em></span></p>
12165: </dd>
12166: </dl>
12167: </div>
12168: </div>
12169: </div>
12170:
1.67 hubertf 12171: <div class="chapter" lang="en">
1.1 grant 12172: <div class="titlepage">
12173: <div>
12174: <div>
1.67 hubertf 12175: <h2 class="title"><a name=
1.68 rillig 12176: "tools"></a>Chapter 15. Tools needed for
12177: building or running</h2>
12178: </div>
12179: </div>
12180: </div>
12181:
12182: <div class="toc">
12183: <p><b>Table of Contents</b></p>
12184:
12185: <dl>
12186: <dt><span class="sect1"><a href="#pkgsrc-tools">15.1.
12187: Tools for pkgsrc builds</a></span></dt>
12188:
12189: <dt><span class="sect1"><a href="#package-tools">15.2.
12190: Tools needed by packages</a></span></dt>
12191:
12192: <dt><span class="sect1"><a href="#platform-tools">15.3.
12193: Tools provided by platforms</a></span></dt>
12194: </dl>
12195: </div>
12196:
12197: <p>The <code class="varname">USE_TOOLS</code> definition is
12198: used both internally by pkgsrc and also for individual
12199: packages to define what commands are needed for building a
12200: package (like <code class="varname">BUILD_DEPENDS</code>)
12201: or for later run-time of an installed packaged (such as
12202: <code class="varname">DEPENDS</code>). If the native system
12203: provides an adequate tool, then in many cases, a pkgsrc
12204: package will not be used.</p>
12205:
12206: <p>When building a package, the replacement tools are made
12207: available in a directory (as symlinks or wrapper scripts)
12208: that is early in the executable search path. Just like the
12209: buildlink system, this helps with consistent builds.</p>
12210:
12211: <p>A tool may be needed to help build a specific package.
12212: For example, perl, GNU make (gmake) or yacc may be
12213: needed.</p>
12214:
12215: <p>Also a tool may be needed, for example, because the
12216: native system's supplied tool may be inefficient for
12217: building a package with pkgsrc. For example, a package may
12218: need GNU awk, bison (instead of yacc) or a better sed.</p>
12219:
12220: <p>The tools used by a package can be listed by running
12221: <span><strong class="command">make
12222: show-tools</strong></span>.</p>
12223:
12224: <div class="sect1" lang="en">
12225: <div class="titlepage">
12226: <div>
12227: <div>
12228: <h2 class="title" style="clear: both"><a name=
12229: "pkgsrc-tools"></a>15.1. Tools for pkgsrc
12230: builds</h2>
12231: </div>
12232: </div>
12233: </div>
12234:
12235: <p>The default set of tools used by pkgsrc is defined in
12236: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12237: class="filename">bsd.pkg.mk</code>. This includes
12238: standard Unix tools, such as: <span><strong class=
12239: "command">cat</strong></span>, <span><strong class=
12240: "command">awk</strong></span>, <span><strong class=
12241: "command">chmod</strong></span>, <span><strong class=
12242: "command">test</strong></span>, and so on. These can be
12243: seen by running: <span><strong class="command">make
12244: show-var VARNAME=USE_TOOLS</strong></span>.</p>
12245:
12246: <p>If a package needs a specific program to build then
12247: the <code class="varname">USE_TOOLS</code> variable can
12248: be used to define the tools needed.</p>
12249: </div>
12250:
12251: <div class="sect1" lang="en">
12252: <div class="titlepage">
12253: <div>
12254: <div>
12255: <h2 class="title" style="clear: both"><a name=
12256: "package-tools"></a>15.2. Tools needed by
12257: packages</h2>
12258: </div>
12259: </div>
12260: </div>
12261:
12262: <p>In the following examples, the :pkgsrc means to use
12263: the pkgsrc version and not the native version for a build
12264: dependency. And the :run means that it is used for a
12265: run-time dependencies also (and becomes a DEPENDS). The
12266: default is a build dependency which can be set with
12267: :build. (So in this example, it is the same as
12268: gmake:build and pkg-config:build.)</p>
12269: <pre class="programlisting">
12270: USE_TOOLS+= mktemp:pkgsrc
12271: USE_TOOLS+= gmake perl:run pkg-config
12272: </pre>
12273:
12274: <p>When using the tools framework, a <code class=
12275: "varname">TOOLS_PATH.foo</code> variable is defined which
12276: contains the full path to the appropriate tool. For
12277: example, <code class="varname">TOOLS_PATH.bash</code>
12278: could be “<span class=
12279: "quote">/bin/bash</span>” on Linux systems.</p>
12280:
12281: <p>If you always need a pkgsrc version of the tool at
12282: run-time, then just use <code class=
12283: "varname">DEPENDS</code> instead.</p>
12284: </div>
12285:
12286: <div class="sect1" lang="en">
12287: <div class="titlepage">
12288: <div>
12289: <div>
12290: <h2 class="title" style="clear: both"><a name=
12291: "platform-tools"></a>15.3. Tools provided by
12292: platforms</h2>
12293: </div>
12294: </div>
12295: </div>
12296:
12297: <p>When improving or porting pkgsrc to a new platform,
12298: have a look at (or create) the corresponding platform
12299: specific make file fragment under <code xmlns=
12300: "http://www.w3.org/TR/xhtml1/transitional" class=
12301: "filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which
12302: defines the name of the common tools. For example:</p>
12303: <pre class="programlisting">
12304: .if exists(/usr/bin/bzcat)
12305: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
12306: .elif exists(/usr/bin/bzip2)
12307: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
12308: .endif
12309:
12310: TOOLS_PLATFORM.true?= true # shell builtin
12311: </pre>
12312: </div>
12313: </div>
12314:
12315: <div class="chapter" lang="en">
12316: <div class="titlepage">
12317: <div>
12318: <div>
12319: <h2 class="title"><a name=
12320: "fixes"></a>Chapter 16. Making your package
1.55 rillig 12321: work</h2>
1.1 grant 12322: </div>
12323: </div>
12324: </div>
12325:
12326: <div class="toc">
12327: <p><b>Table of Contents</b></p>
12328:
12329: <dl>
1.30 wiz 12330: <dt><span class="sect1"><a href=
1.68 rillig 12331: "#general-operation">16.1. General
1.30 wiz 12332: operation</a></span></dt>
1.1 grant 12333:
12334: <dd>
12335: <dl>
12336: <dt><span class="sect2"><a href=
1.68 rillig 12337: "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30 wiz 12338: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 12339:
12340: <dt><span class="sect2"><a href=
1.68 rillig 12341: "#where-to-install-documentation">16.1.2. Where to
1.31 wiz 12342: install documentation</a></span></dt>
12343:
12344: <dt><span class="sect2"><a href=
1.68 rillig 12345: "#restricted-packages">16.1.3. Restricted
1.1 grant 12346: packages</a></span></dt>
12347:
12348: <dt><span class="sect2"><a href=
1.68 rillig 12349: "#dependencies">16.1.4. Handling
1.1 grant 12350: dependencies</a></span></dt>
12351:
12352: <dt><span class="sect2"><a href=
1.68 rillig 12353: "#conflicts">16.1.5. Handling conflicts with other
1.1 grant 12354: packages</a></span></dt>
12355:
12356: <dt><span class="sect2"><a href=
1.68 rillig 12357: "#not-building-packages">16.1.6. Packages that
1.30 wiz 12358: cannot or should not be built</a></span></dt>
1.1 grant 12359:
12360: <dt><span class="sect2"><a href=
1.68 rillig 12361: "#undeletable-packages">16.1.7. Packages which
1.30 wiz 12362: should not be deleted, once
12363: installed</a></span></dt>
1.1 grant 12364:
12365: <dt><span class="sect2"><a href=
1.68 rillig 12366: "#security-handling">16.1.8. Handling packages with
1.1 grant 12367: security problems</a></span></dt>
12368:
12369: <dt><span class="sect2"><a href=
1.68 rillig 12370: "#compiler-bugs">16.1.9. How to handle compiler
1.1 grant 12371: bugs</a></span></dt>
12372:
12373: <dt><span class="sect2"><a href=
1.68 rillig 12374: "#bumping-pkgrevision">16.1.10. How to handle
1.30 wiz 12375: incrementing versions when fixing an existing
1.1 grant 12376: package</a></span></dt>
12377:
12378: <dt><span class="sect2"><a href=
1.68 rillig 12379: "#portability-of-packages">16.1.11. Portability of
1.1 grant 12380: packages</a></span></dt>
12381: </dl>
12382: </dd>
12383:
1.30 wiz 12384: <dt><span class="sect1"><a href=
1.68 rillig 12385: "#downloading-issues">16.2. Possible downloading
1.30 wiz 12386: issues</a></span></dt>
1.1 grant 12387:
12388: <dd>
12389: <dl>
12390: <dt><span class="sect2"><a href=
1.68 rillig 12391: "#no-plain-download">16.2.1. Packages whose
1.30 wiz 12392: distfiles aren't available for plain
1.1 grant 12393: downloading</a></span></dt>
12394:
12395: <dt><span class="sect2"><a href=
1.68 rillig 12396: "#modified-distfiles-same-name">16.2.2. How to
1.30 wiz 12397: handle modified distfiles with the 'old'
12398: name</a></span></dt>
1.1 grant 12399: </dl>
12400: </dd>
12401:
1.30 wiz 12402: <dt><span class="sect1"><a href=
1.68 rillig 12403: "#configuration-gotchas">16.3. Configuration
1.30 wiz 12404: gotchas</a></span></dt>
1.1 grant 12405:
12406: <dd>
12407: <dl>
12408: <dt><span class="sect2"><a href=
1.68 rillig 12409: "#fixes.libtool">16.3.1. Shared libraries -
1.1 grant 12410: libtool</a></span></dt>
12411:
12412: <dt><span class="sect2"><a href=
1.68 rillig 12413: "#using-libtool">16.3.2. Using libtool on GNU
1.30 wiz 12414: packages that already support
12415: libtool</a></span></dt>
1.1 grant 12416:
12417: <dt><span class="sect2"><a href=
1.68 rillig 12418: "#autoconf-automake">16.3.3. GNU
1.1 grant 12419: Autoconf/Automake</a></span></dt>
12420: </dl>
12421: </dd>
12422:
1.68 rillig 12423: <dt><span class="sect1"><a href="#fixes-build">16.4.
1.55 rillig 12424: Building the package</a></span></dt>
1.1 grant 12425:
12426: <dd>
12427: <dl>
12428: <dt><span class="sect2"><a href=
1.68 rillig 12429: "#cpp-defines">16.4.1. CPP defines</a></span></dt>
1.51 rillig 12430:
1.60 rillig 12431: <dt><span class="sect2"><a href=
1.68 rillig 12432: "#cpp-list-examples">16.4.2. Examples of CPP
1.60 rillig 12433: defines for some platforms</a></span></dt>
12434:
1.68 rillig 12435: <dt><span class="sect2"><a href="#cpp-list">16.4.3.
1.51 rillig 12436: Getting a list of CPP defines</a></span></dt>
1.1 grant 12437: </dl>
12438: </dd>
12439:
1.30 wiz 12440: <dt><span class="sect1"><a href=
1.68 rillig 12441: "#package-specific-actions">16.5. Package specific
1.30 wiz 12442: actions</a></span></dt>
1.1 grant 12443:
12444: <dd>
12445: <dl>
12446: <dt><span class="sect2"><a href=
1.68 rillig 12447: "#user-interaction">16.5.1. User
1.2 hubertf 12448: interaction</a></span></dt>
1.1 grant 12449:
12450: <dt><span class="sect2"><a href=
1.68 rillig 12451: "#handling-licenses">16.5.2. Handling
1.1 grant 12452: licenses</a></span></dt>
12453:
12454: <dt><span class="sect2"><a href=
1.68 rillig 12455: "#installing-score-files">16.5.3. Installing score
1.1 grant 12456: files</a></span></dt>
12457:
12458: <dt><span class="sect2"><a href=
1.68 rillig 12459: "#perl-scripts">16.5.4. Packages containing perl
1.1 grant 12460: scripts</a></span></dt>
12461:
12462: <dt><span class="sect2"><a href=
1.68 rillig 12463: "#hardcoded-paths">16.5.5. Packages with hardcoded
1.30 wiz 12464: paths to other interpreters</a></span></dt>
1.1 grant 12465:
12466: <dt><span class="sect2"><a href=
1.68 rillig 12467: "#perl-modules">16.5.6. Packages installing perl
1.1 grant 12468: modules</a></span></dt>
12469:
12470: <dt><span class="sect2"><a href=
1.68 rillig 12471: "#faq.info-files">16.5.7. Packages installing info
1.1 grant 12472: files</a></span></dt>
12473:
1.68 rillig 12474: <dt><span class="sect2"><a href="#manpages">16.5.8.
1.57 minskim 12475: Packages installing man pages</a></span></dt>
12476:
1.1 grant 12477: <dt><span class="sect2"><a href=
1.68 rillig 12478: "#gconf2-data-files">16.5.9. Packages installing
1.30 wiz 12479: GConf2 data files</a></span></dt>
1.1 grant 12480:
12481: <dt><span class="sect2"><a href=
1.68 rillig 12482: "#scrollkeeper-data-files">16.5.10. Packages
1.30 wiz 12483: installing scrollkeeper data files</a></span></dt>
1.1 grant 12484:
12485: <dt><span class="sect2"><a href=
1.68 rillig 12486: "#x11-fonts">16.5.11. Packages installing X11
1.1 grant 12487: fonts</a></span></dt>
12488:
12489: <dt><span class="sect2"><a href=
1.68 rillig 12490: "#gtk2-modules">16.5.12. Packages installing GTK2
1.1 grant 12491: modules</a></span></dt>
12492:
12493: <dt><span class="sect2"><a href=
1.68 rillig 12494: "#sgml-xml-data">16.5.13. Packages installing SGML
1.30 wiz 12495: or XML data</a></span></dt>
1.1 grant 12496:
12497: <dt><span class="sect2"><a href=
1.68 rillig 12498: "#mime-database">16.5.14. Packages installing
1.1 grant 12499: extensions to the MIME database</a></span></dt>
12500:
12501: <dt><span class="sect2"><a href=
1.68 rillig 12502: "#intltool">16.5.15. Packages using
1.1 grant 12503: intltool</a></span></dt>
1.18 xtraeme 12504:
12505: <dt><span class="sect2"><a href=
1.68 rillig 12506: "#startup-scripts">16.5.16. Packages installing
1.30 wiz 12507: startup scripts</a></span></dt>
1.57 minskim 12508:
12509: <dt><span class="sect2"><a href=
1.68 rillig 12510: "#tex-packages">16.5.17. Packages installing TeX
1.57 minskim 12511: modules</a></span></dt>
1.1 grant 12512: </dl>
12513: </dd>
12514:
1.30 wiz 12515: <dt><span class="sect1"><a href=
1.68 rillig 12516: "#feedback-to-author">16.6. Feedback to the
1.30 wiz 12517: author</a></span></dt>
1.1 grant 12518: </dl>
12519: </div>
12520:
1.67 hubertf 12521: <div class="sect1" lang="en">
1.1 grant 12522: <div class="titlepage">
12523: <div>
12524: <div>
12525: <h2 class="title" style="clear: both"><a name=
1.68 rillig 12526: "general-operation"></a>16.1. General
1.1 grant 12527: operation</h2>
12528: </div>
12529: </div>
12530: </div>
12531:
1.67 hubertf 12532: <div class="sect2" lang="en">
1.1 grant 12533: <div class="titlepage">
12534: <div>
12535: <div>
1.30 wiz 12536: <h3 class="title"><a name=
1.68 rillig 12537: "pulling-vars-from-etc-mk.conf"></a>16.1.1. How
1.30 wiz 12538: to pull in variables from /etc/mk.conf</h3>
1.1 grant 12539: </div>
12540: </div>
12541: </div>
12542:
12543: <p>The problem with package-defined variables that can
1.14 xtraeme 12544: be overridden via <code class="varname">MAKECONF</code>
1.45 wiz 12545: or <code xmlns=
12546: "http://www.w3.org/TR/xhtml1/transitional" class=
12547: "filename">/etc/mk.conf</code> is that <a href=
1.1 grant 12548: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
12549: <span class="citerefentry"><span class=
12550: "refentrytitle">make</span>(1)</span></a> expands a
1.47 reed 12551: variable as it is used, but evaluates preprocessor-like
1.1 grant 12552: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 12553: So, to use any variable (which may be set in
1.45 wiz 12554: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12555: class="filename">/etc/mk.conf</code>) in one of the
12556: .if* statements, the file <code xmlns=
12557: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12558: "filename">/etc/mk.conf</code> must be included before
1.1 grant 12559: that .if* statement.</p>
12560:
1.47 reed 12561: <p>Rather than having a number of ad-hoc ways of
1.45 wiz 12562: including <code xmlns=
12563: "http://www.w3.org/TR/xhtml1/transitional" class=
12564: "filename">/etc/mk.conf</code>, should it exist, or
12565: <code class="varname">MAKECONF</code>, should it exist,
12566: include the <code xmlns=
12567: "http://www.w3.org/TR/xhtml1/transitional" class=
12568: "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
12569: package Makefile before any preprocessor-like .if,
12570: .ifdef, or .ifndef statements:</p>
1.1 grant 12571: <pre class="programlisting">
1.51 rillig 12572: .include "../../mk/bsd.prefs.mk"
12573:
1.1 grant 12574: .if defined(USE_MENUS)
1.51 rillig 12575: # ...
1.1 grant 12576: .endif
12577: </pre>
12578:
1.14 xtraeme 12579: <p>If you wish to set the <code class=
1.45 wiz 12580: "varname">CFLAGS</code> variable in <code xmlns=
12581: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 12582: "filename">/etc/mk.conf</code>, please make sure to
1.1 grant 12583: use:</p>
12584: <pre class="programlisting">
1.51 rillig 12585: CFLAGS+= -your -flags
1.1 grant 12586: </pre>
12587:
1.14 xtraeme 12588: <p>Using <code class="varname">CFLAGS=</code> (i.e.
12589: without the “<span class="quote">+</span>”)
12590: may lead to problems with packages that need to add
12591: their own flags. Also, you may want to take a look at
12592: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 12593: href=
12594: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 12595: target="_top"><code xmlns="" class=
12596: "filename">devel/cpuflags</code></a> package if you're
1.20 ben 12597: interested in optimization for the current CPU.</p>
1.1 grant 12598: </div>
12599:
1.67 hubertf 12600: <div class="sect2" lang="en">
1.1 grant 12601: <div class="titlepage">
12602: <div>
12603: <div>
1.31 wiz 12604: <h3 class="title"><a name=
1.68 rillig 12605: "where-to-install-documentation"></a>16.1.2. Where
1.31 wiz 12606: to install documentation</h3>
12607: </div>
12608: </div>
12609: </div>
12610:
1.45 wiz 12611: <p>Documentation should be installed into <code xmlns=
12612: "http://www.w3.org/TR/xhtml1/transitional" class=
1.31 wiz 12613: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45 wiz 12614: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12615: class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
12616: (the latter includes the version number of the
12617: package).</p>
1.31 wiz 12618: </div>
12619:
1.67 hubertf 12620: <div class="sect2" lang="en">
1.31 wiz 12621: <div class="titlepage">
12622: <div>
12623: <div>
1.67 hubertf 12624: <h3 class="title"><a name=
1.68 rillig 12625: "restricted-packages"></a>16.1.3. Restricted
1.1 grant 12626: packages</h3>
12627: </div>
12628: </div>
12629: </div>
12630:
12631: <p>Some licenses restrict how software may be
12632: re-distributed. In order to satisfy these restrictions,
12633: the package system defines five make variables that can
12634: be set to note these restrictions:</p>
12635:
12636: <div class="itemizedlist">
12637: <ul type="disc">
12638: <li>
1.14 xtraeme 12639: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 12640:
12641: <p>This variable should be set whenever a
12642: restriction exists (regardless of its kind). Set
12643: this variable to a string containing the reason
12644: for the restriction.</p>
12645: </li>
12646:
12647: <li>
1.14 xtraeme 12648: <p><code class=
12649: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 12650:
12651: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 12652: variable to <code class=
12653: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 12654: package may not be included on a CD-ROM.</p>
12655: </li>
12656:
12657: <li>
1.14 xtraeme 12658: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 12659:
12660: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 12661: Set this variable to <code class=
12662: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 12663: package may not not be made available on the
12664: Internet.</p>
12665: </li>
12666:
12667: <li>
1.14 xtraeme 12668: <p><code class=
12669: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 12670:
12671: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 12672: this variable to <code class=
12673: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 12674: of the source code or other distfile(s) is not
12675: allowed on CD-ROMs.</p>
12676: </li>
12677:
12678: <li>
1.14 xtraeme 12679: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 12680:
12681: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 12682: variable to <code class=
12683: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 12684: of the source code or other distfile(s) via the
12685: Internet is not allowed.</p>
12686: </li>
12687: </ul>
12688: </div>
12689:
1.14 xtraeme 12690: <p>Please note that the use of <code class=
12691: "varname">NO_PACKAGE</code>, <code class=
12692: "varname">IGNORE</code>, <code class=
12693: "varname">NO_CDROM</code>, or other generic make
1.1 grant 12694: variables to denote restrictions is deprecated, because
12695: they unconditionally prevent users from generating
12696: binary packages!</p>
12697: </div>
12698:
1.67 hubertf 12699: <div class="sect2" lang="en">
1.1 grant 12700: <div class="titlepage">
12701: <div>
12702: <div>
1.67 hubertf 12703: <h3 class="title"><a name=
1.68 rillig 12704: "dependencies"></a>16.1.4. Handling
1.1 grant 12705: dependencies</h3>
12706: </div>
12707: </div>
12708: </div>
12709:
12710: <p>Your package may depend on some other package being
12711: present - and there are various ways of expressing this
1.14 xtraeme 12712: dependency. pkgsrc supports the <code class=
12713: "varname">BUILD_DEPENDS</code> and <code class=
1.47 reed 12714: "varname">DEPENDS</code> definitions, the <code class=
12715: "varname">USE_TOOLS</code> definition, as well as
1.45 wiz 12716: dependencies via <code xmlns=
12717: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12718: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 12719: way to handle dependencies, and which uses the
12720: variables named above. See <a href="#buildlink" title=
1.38 dillo 12721: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 12722: <i>Buildlink methodology</i></a> for more
12723: information.</p>
12724:
12725: <p>The basic difference between the two variables is as
1.14 xtraeme 12726: follows: The <code class="varname">DEPENDS</code>
1.1 grant 12727: definition registers that pre-requisite in the binary
12728: package so it will be pulled in when the binary package
1.14 xtraeme 12729: is later installed, whilst the <code class=
12730: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 12731: marking a dependency that is only needed for building
12732: the package.</p>
12733:
12734: <p>This means that if you only need a package present
12735: whilst you are building, it should be noted as a
1.14 xtraeme 12736: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 12737:
1.14 xtraeme 12738: <p>The format for a <code class=
12739: "varname">BUILD_DEPENDS</code> and a <code class=
12740: "varname">DEPENDS</code> definition is:</p>
1.1 grant 12741: <pre class="programlisting">
1.51 rillig 12742: <pre-req-package-name>:../../<category>/<pre-req-package>
1.1 grant 12743: </pre>
12744:
12745: <p>Please note that the “<span class=
12746: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 12747: any of the wildcard version numbers recognized by
1.1 grant 12748: <a href=
12749: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
12750: <span class="citerefentry"><span class=
12751: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
12752:
12753: <div class="orderedlist">
12754: <ol type="1">
12755: <li>
12756: <p>If your package needs another package's
12757: binaries or libraries to build or run, and if
1.45 wiz 12758: that package has a <code xmlns=
12759: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12760: "filename">buildlink3.mk</code> file available,
12761: use it:</p>
1.1 grant 12762: <pre class="programlisting">
12763: .include "../../graphics/jpeg/buildlink3.mk"
12764: </pre>
12765: </li>
12766:
12767: <li>
12768: <p>If your package needs to use another package
1.45 wiz 12769: to build itself and there is no <code xmlns=
12770: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12771: "filename">buildlink3.mk</code> file available,
12772: use the <code class=
12773: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 12774: <pre class="programlisting">
1.51 rillig 12775: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1 grant 12776: </pre>
12777: </li>
12778:
12779: <li>
12780: <p>If your package needs a library with which to
1.45 wiz 12781: link and again there is no <code xmlns=
12782: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12783: "filename">buildlink3.mk</code> file available,
12784: this is specified using the <code class=
1.71 wiz 12785: "varname">DEPENDS</code> definition. For
12786: example:</p>
1.1 grant 12787: <pre class="programlisting">
1.51 rillig 12788: DEPENDS+= xpm-3.4j:../../graphics/xpm
1.1 grant 12789: </pre>
12790:
12791: <p>You can also use wildcards in package
12792: dependences:</p>
12793: <pre class="programlisting">
1.51 rillig 12794: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
1.1 grant 12795: </pre>
12796:
12797: <p>Note that such wildcard dependencies are
12798: retained when creating binary packages. The
12799: dependency is checked when installing the binary
12800: package and any package which matches the pattern
12801: will be used. Wildcard dependencies should be
12802: used with care.</p>
12803:
12804: <p>The “<span class=
12805: "quote">-[0-9]*</span>” should be used
12806: instead of “<span class=
12807: "quote">-*</span>” to avoid potentially
12808: ambiguous matches such as “<span class=
12809: "quote">tk-postgresql</span>” matching a
12810: “<span class="quote">tk-*</span>”
1.14 xtraeme 12811: <code class="varname">DEPENDS</code>.</p>
1.1 grant 12812:
12813: <p>Wildcards can also be used to specify that a
12814: package will only build against a certain minimum
12815: version of a pre-requisite:</p>
12816: <pre class="programlisting">
1.51 rillig 12817: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
1.1 grant 12818: </pre>
12819:
12820: <p>This means that the package will build against
12821: version 3.5.4 of the tiff library or newer. Such
12822: a dependency may be warranted if, for example,
12823: the API of the library has changed with version
12824: 3.5.4 and a package would not compile against an
12825: earlier version of tiff.</p>
12826:
12827: <p>Please note that such dependencies should only
12828: be updated if a package requires a newer
12829: pre-requisite, but not to denote recommendations
1.72 ! rillig 12830: such as ABI changes that do not prevent a package
! 12831: from building correctly. Such recommendations can
! 12832: be expressed using <code class=
! 12833: "varname">ABI_DEPENDS</code>:</p>
1.1 grant 12834: <pre class="programlisting">
1.72 ! rillig 12835: ABI_DEPENDS+= tiff>=3.6.1:../../graphics/tiff
1.1 grant 12836: </pre>
12837:
1.14 xtraeme 12838: <p>In addition to the above <code class=
12839: "varname">DEPENDS</code> line, this denotes that
1.1 grant 12840: while a package will build against
12841: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 12842: recommended. <code class=
1.72 ! rillig 12843: "varname">ABI_DEPENDS</code> entries will be
1.14 xtraeme 12844: turned into dependencies unless explicitly
12845: ignored (in which case a warning will be
1.36 wiz 12846: printed).</p>
12847:
1.72 ! rillig 12848: <p>To ignore these ABI dependency recommendations
! 12849: and just use the required <code class=
1.36 wiz 12850: "varname">DEPENDS</code>, set <code class=
1.72 ! rillig 12851: "varname">USE_ABI_DEPENDS=NO</code>. This may
1.36 wiz 12852: make it easier and faster to update packages
12853: built using pkgsrc, since older compatible
12854: dependencies can continue to be used. This is
12855: useful for people who watch their rebuilds very
12856: carefully; it is not very good as a
12857: general-purpose hammer. If you use it, you need
12858: to be mindful of possible ABI changes, including
12859: those from the underlying OS.</p>
12860:
12861: <p>Packages that are built with recommendations
12862: ignored may not be uploaded to ftp.NetBSD.org by
12863: developers and should not be used across
12864: different systems that may have different
12865: versions of binary packages installed.</p>
1.1 grant 12866:
12867: <p>For security fixes, please update the package
1.72 ! rillig 12868: vulnerabilities file. See <a href=
! 12869: "#security-handling" title=
1.68 rillig 12870: "16.1.8. Handling packages with security problems">
12871: Section 16.1.8, “Handling packages
1.67 hubertf 12872: with security problems”</a> for more
1.1 grant 12873: information.</p>
12874: </li>
12875:
12876: <li>
12877: <p>If your package needs some executable to be
1.17 sketch 12878: able to run correctly and if there's no
1.45 wiz 12879: <code xmlns=
12880: "http://www.w3.org/TR/xhtml1/transitional" class=
12881: "filename">buildlink3.mk</code> file, this is
12882: specified using the <code class=
1.14 xtraeme 12883: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 12884: "http://www.w3.org/TR/xhtml1/transitional" href=
12885: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 12886: target="_top"><code xmlns="" class=
12887: "filename">print/lyx</code></a> package needs to
12888: be able to execute the latex binary from the
12889: teTeX package when it runs, and that is
12890: specified:</p>
1.1 grant 12891: <pre class="programlisting">
1.51 rillig 12892: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
1.1 grant 12893: </pre>
12894:
12895: <p>The comment about wildcard dependencies from
12896: previous paragraph applies here, too.</p>
12897: </li>
12898: </ol>
12899: </div>
12900:
12901: <p>If your package needs files from another package to
1.71 wiz 12902: build, add the relevant distribution files to
12903: <code class="varname">DISTFILES</code>, so they will be
12904: extracted automatically. See the <a xmlns=
1.1 grant 12905: "http://www.w3.org/TR/xhtml1/transitional" href=
1.71 wiz 12906: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript/README.html"
1.45 wiz 12907: target="_top"><code xmlns="" class=
1.71 wiz 12908: "filename">print/ghostscript</code></a> package for an
12909: example. (It relies on the jpeg sources being present
12910: in source form during the build.)</p>
1.1 grant 12911:
1.14 xtraeme 12912: <p>Please also note the <code class=
12913: "varname">BUILD_USES_MSGFMT</code> and <code class=
12914: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
12915: which are provided as convenience definitions. The
1.24 wiz 12916: former works out whether <a href=
12917: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
12918: <span class="citerefentry"><span class=
12919: "refentrytitle">msgfmt</span>(1)</span></a> is part of
12920: the base system, and, if it isn't, installs the
12921: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12922: href=
1.1 grant 12923: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45 wiz 12924: target="_top"><code xmlns="" class=
12925: "filename">devel/gettext</code></a> package. The latter
1.20 ben 12926: adds a build dependency on either an installed version
12927: of an older gettext package, or if it isn't, installs
12928: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12929: href=
12930: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45 wiz 12931: target="_top"><code xmlns="" class=
12932: "filename">devel/gettext-m4</code></a> package.</p>
1.1 grant 12933: </div>
12934:
1.67 hubertf 12935: <div class="sect2" lang="en">
1.1 grant 12936: <div class="titlepage">
12937: <div>
12938: <div>
1.67 hubertf 12939: <h3 class="title"><a name=
1.68 rillig 12940: "conflicts"></a>16.1.5. Handling conflicts
1.1 grant 12941: with other packages</h3>
12942: </div>
12943: </div>
12944: </div>
12945:
12946: <p>Your package may conflict with other packages a user
12947: might already have installed on his system, e.g. if
12948: your package installs the same set of files like
12949: another package in our pkgsrc tree.</p>
12950:
1.14 xtraeme 12951: <p>In this case you can set <code class=
1.47 reed 12952: "varname">CONFLICTS</code> to a space-separated list of
1.1 grant 12953: packages (including version string) your package
12954: conflicts with.</p>
12955:
1.47 reed 12956: <p>For example, <a xmlns=
1.1 grant 12957: "http://www.w3.org/TR/xhtml1/transitional" href=
12958: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45 wiz 12959: target="_top"><code xmlns="" class=
12960: "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20 ben 12961: "http://www.w3.org/TR/xhtml1/transitional" href=
12962: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45 wiz 12963: target="_top"><code xmlns="" class=
1.47 reed 12964: "filename">x11/Xaw-Xpm</code></a> install the same
12965: shared library, thus you set in <code xmlns=
1.45 wiz 12966: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 12967: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 12968: <pre class="programlisting">
1.51 rillig 12969: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 grant 12970: </pre>
12971:
1.45 wiz 12972: <p>and in <code xmlns=
12973: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12974: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 12975: <pre class="programlisting">
1.51 rillig 12976: CONFLICTS= Xaw3d-[0-9]*
1.1 grant 12977: </pre>
12978:
12979: <p>Packages will automatically conflict with other
12980: packages with the name prefix and a different version
12981: string. “<span class=
12982: "quote">Xaw3d-1.5</span>” e.g. will automatically
12983: conflict with the older version “<span class=
12984: "quote">Xaw3d-1.3</span>”.</p>
12985: </div>
12986:
1.67 hubertf 12987: <div class="sect2" lang="en">
1.1 grant 12988: <div class="titlepage">
12989: <div>
12990: <div>
1.67 hubertf 12991: <h3 class="title"><a name=
1.68 rillig 12992: "not-building-packages"></a>16.1.6. Packages
1.30 wiz 12993: that cannot or should not be built</h3>
1.1 grant 12994: </div>
12995: </div>
12996: </div>
12997:
12998: <p>There are several reasons why a package might be
12999: instructed to not build under certain circumstances. If
13000: the package builds and runs on most platforms, the
1.14 xtraeme 13001: exceptions should be noted with <code class=
13002: "varname">NOT_FOR_PLATFORM</code>. If the package
13003: builds and runs on a small handful of platforms, set
13004: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45 wiz 13005: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
13006: <code class="varname">NOT_FOR_PLATFORM</code> are OS
13007: triples (OS-version-platform) that can use glob-style
13008: wildcards.</p>
13009:
13010: <p>If the package should be skipped (for example,
13011: because it provides functionality already provided by
13012: the system), set <code class=
1.14 xtraeme 13013: "varname">PKG_SKIP_REASON</code> to a descriptive
13014: message. If the package should fail because some
13015: preconditions are not met, set <code class=
13016: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 13017: message.</p>
13018: </div>
13019:
1.67 hubertf 13020: <div class="sect2" lang="en">
1.1 grant 13021: <div class="titlepage">
13022: <div>
13023: <div>
1.67 hubertf 13024: <h3 class="title"><a name=
1.68 rillig 13025: "undeletable-packages"></a>16.1.7. Packages
1.30 wiz 13026: which should not be deleted, once installed</h3>
1.1 grant 13027: </div>
13028: </div>
13029: </div>
13030:
13031: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 13032: has been installed, the <code class=
13033: "varname">PKG_PRESERVE</code> definition should be set
13034: in the package Makefile. This will be carried into any
1.1 grant 13035: binary package that is made from this pkgsrc entry. A
13036: “<span class="quote">preserved</span>”
13037: package will not be deleted using <a href=
13038: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
13039: <span class="citerefentry"><span class=
13040: "refentrytitle">pkg_delete</span>(1)</span></a> unless
13041: the “<span class="quote">-f</span>” option
13042: is used.</p>
13043: </div>
13044:
1.67 hubertf 13045: <div class="sect2" lang="en">
1.1 grant 13046: <div class="titlepage">
13047: <div>
13048: <div>
1.67 hubertf 13049: <h3 class="title"><a name=
1.68 rillig 13050: "security-handling"></a>16.1.8. Handling
1.1 grant 13051: packages with security problems</h3>
13052: </div>
13053: </div>
13054: </div>
13055:
13056: <p>When a vulnerability is found, this should be noted
1.45 wiz 13057: in <code xmlns=
13058: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13059: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43 wiz 13060: and after committing that file, use
13061: <span><strong class="command">make
13062: upload</strong></span> in the same directory to update
13063: the file on ftp.NetBSD.org.</p>
13064:
13065: <p>After fixing the vulnerability by a patch, its
13066: <code class="varname">PKGREVISION</code> should be
13067: increased (this is of course not necessary if the
13068: problem is fixed by using a newer release of the
1.72 ! rillig 13069: software).</p>
1.1 grant 13070:
13071: <p>Also, if the fix should be applied to the stable
13072: pkgsrc branch, be sure to submit a pullup request!</p>
1.43 wiz 13073:
13074: <p>Binary packages already on ftp.NetBSD.org will be
13075: handled semi-automatically by a weekly cron job.</p>
1.1 grant 13076: </div>
13077:
1.67 hubertf 13078: <div class="sect2" lang="en">
1.1 grant 13079: <div class="titlepage">
13080: <div>
13081: <div>
1.67 hubertf 13082: <h3 class="title"><a name=
1.68 rillig 13083: "compiler-bugs"></a>16.1.9. How to handle
1.1 grant 13084: compiler bugs</h3>
13085: </div>
13086: </div>
13087: </div>
13088:
13089: <p>Some source files trigger bugs in the compiler,
13090: based on combinations of compiler version and
13091: architecture and almost always relation to optimisation
13092: being enabled. Common symptoms are gcc internal errors
13093: or never finishing compiling a file.</p>
13094:
1.47 reed 13095: <p>Typically, a workaround involves testing the
1.14 xtraeme 13096: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 13097: version, disabling optimisation for that
1.14 xtraeme 13098: file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45 wiz 13099: combination, and documenting it in <code xmlns=
13100: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13101: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 13102: number of examples!</p>
13103: </div>
13104:
1.67 hubertf 13105: <div class="sect2" lang="en">
1.1 grant 13106: <div class="titlepage">
13107: <div>
13108: <div>
1.67 hubertf 13109: <h3 class="title"><a name=
1.68 rillig 13110: "bumping-pkgrevision"></a>16.1.10. How to
1.30 wiz 13111: handle incrementing versions when fixing an
13112: existing package</h3>
1.1 grant 13113: </div>
13114: </div>
13115: </div>
13116:
13117: <p>When making fixes to an existing package it can be
1.14 xtraeme 13118: useful to change the version number in <code class=
13119: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 13120: future versions by the original author, a
13121: “<span class="quote">nb1</span>”,
13122: “<span class="quote">nb2</span>”, ...
13123: suffix can be used on package versions by setting
1.14 xtraeme 13124: <code class="varname">PKGREVISION=1</code> (2, ...).
13125: The “<span class="quote">nb</span>” is
13126: treated like a “<span class=
13127: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 13128: <pre class="programlisting">
1.51 rillig 13129: DISTNAME= foo-17.42
13130: PKGREVISION= 9
1.1 grant 13131: </pre>
13132:
1.14 xtraeme 13133: <p>will result in a <code class=
13134: "varname">PKGNAME</code> of “<span class=
1.1 grant 13135: "quote">foo-17.42nb9</span>”.</p>
13136:
13137: <p>When a new release of the package is released, the
1.14 xtraeme 13138: <code class="varname">PKGREVISION</code> should be
1.47 reed 13139: removed, e.g. on a new minor release of the above
1.14 xtraeme 13140: package, things should be like:</p>
1.1 grant 13141: <pre class="programlisting">
1.51 rillig 13142: DISTNAME= foo-17.43
1.1 grant 13143: </pre>
13144: </div>
13145:
1.67 hubertf 13146: <div class="sect2" lang="en">
1.1 grant 13147: <div class="titlepage">
13148: <div>
13149: <div>
1.30 wiz 13150: <h3 class="title"><a name=
1.68 rillig 13151: "portability-of-packages"></a>16.1.11. Portability
1.30 wiz 13152: of packages</h3>
1.1 grant 13153: </div>
13154: </div>
13155: </div>
13156:
13157: <p>One appealing feature of pkgsrc is that it runs on
13158: many different platforms. As a result, it is important
13159: to ensure, where possible, that packages in pkgsrc are
13160: portable. There are some particular details you should
13161: pay attention to while working on pkgsrc.</p>
13162:
1.67 hubertf 13163: <div class="sect3" lang="en">
1.1 grant 13164: <div class="titlepage">
13165: <div>
13166: <div>
1.67 hubertf 13167: <h4 class="title"><a name=
1.68 rillig 13168: "install-scripts"></a>16.1.11.1. ${INSTALL},
1.1 grant 13169: ${INSTALL_DATA_DIR}, ...</h4>
13170: </div>
13171: </div>
13172: </div>
13173:
1.14 xtraeme 13174: <p>The BSD-compatible <span><strong class=
13175: "command">install</strong></span> supplied with some
1.1 grant 13176: operating systems will not perform more than one
13177: operation at a time. As such, you should call
13178: “<span class="quote">${INSTALL}</span>”,
13179: etc. like this:</p>
13180: <pre class="programlisting">
1.51 rillig 13181: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
13182: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1 grant 13183: </pre>
13184: </div>
13185: </div>
13186: </div>
13187:
1.67 hubertf 13188: <div class="sect1" lang="en">
1.1 grant 13189: <div class="titlepage">
13190: <div>
13191: <div>
13192: <h2 class="title" style="clear: both"><a name=
1.68 rillig 13193: "downloading-issues"></a>16.2. Possible
1.1 grant 13194: downloading issues</h2>
13195: </div>
13196: </div>
13197: </div>
13198:
1.67 hubertf 13199: <div class="sect2" lang="en">
1.1 grant 13200: <div class="titlepage">
13201: <div>
13202: <div>
1.67 hubertf 13203: <h3 class="title"><a name=
1.68 rillig 13204: "no-plain-download"></a>16.2.1. Packages
1.30 wiz 13205: whose distfiles aren't available for plain
1.1 grant 13206: downloading</h3>
13207: </div>
13208: </div>
13209: </div>
13210:
13211: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 13212: set <code class="varname">DYNAMIC_MASTER_SITES</code>
13213: and a <span><strong class="command">make
1.45 wiz 13214: fetch</strong></span> will call <code xmlns=
13215: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13216: "filename">files/getsite.sh</code> with the name of
13217: each file to download as an argument, expecting it to
13218: output the URL of the directory from which to download
13219: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
13220: href=
1.1 grant 13221: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45 wiz 13222: target="_top"><code xmlns="" class=
13223: "filename">graphics/ns-cult3d</code></a> is an example
13224: of this usage.</p>
1.1 grant 13225:
13226: <p>If the download can't be automated, because the user
13227: must submit personal information to apply for a
13228: password, or must pay for the source, or whatever, you
1.14 xtraeme 13229: can set <code class="varname">_FETCH_MESSAGE</code> to
13230: a macro which displays a message explaining the
13231: situation. <code class="varname">_FETCH_MESSAGE</code>
13232: must be executable shell commands, not just a message.
13233: (Generally, it executes <code class=
1.71 wiz 13234: "varname">${ECHO}</code>). See one of the following
13235: packages for an example: <a xmlns=
1.20 ben 13236: "http://www.w3.org/TR/xhtml1/transitional" href=
13237: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45 wiz 13238: target="_top"><code xmlns="" class=
13239: "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20 ben 13240: "http://www.w3.org/TR/xhtml1/transitional" href=
13241: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45 wiz 13242: target="_top"><code xmlns="" class=
1.71 wiz 13243: "filename">sysutils/storage-manager</code></a>.</p>
1.1 grant 13244: </div>
13245:
1.67 hubertf 13246: <div class="sect2" lang="en">
1.1 grant 13247: <div class="titlepage">
13248: <div>
13249: <div>
1.30 wiz 13250: <h3 class="title"><a name=
1.68 rillig 13251: "modified-distfiles-same-name"></a>16.2.2. How
1.30 wiz 13252: to handle modified distfiles with the 'old'
13253: name</h3>
1.1 grant 13254: </div>
13255: </div>
13256: </div>
13257:
13258: <p>Sometimes authors of a software package make some
13259: modifications after the software was released, and they
13260: put up a new distfile without changing the package's
13261: version number. If a package is already in pkgsrc at
1.32 wiz 13262: that time, the checksum will no longer match. The
13263: contents of the new distfile should be compared against
13264: the old one before changing anything, to make sure the
13265: distfile was really updated on purpose, and that no
13266: trojan horse or so crept in. Then, the correct way to
13267: work around this is to set <code class=
13268: "varname">DIST_SUBDIR</code> to a unique directory
13269: name, usually based on <code class=
13270: "varname">PKGNAME_NOREV</code>. In case this happens
13271: more often, <code class="varname">PKGNAME</code> can be
1.45 wiz 13272: used (thus including the <code xmlns=
13273: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 13274: "filename">nbX</code> suffix) or a date stamp can be
13275: appended, like <code class=
13276: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45 wiz 13277: forget regenerating the <code xmlns=
13278: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 13279: "filename">distinfo</code> file after that, since it
13280: contains the <code class="varname">DIST_SUBDIR</code>
13281: path in the filenames. Furthermore, a mail to the
13282: package's authors seems appropriate telling them that
13283: changing distfiles after releases without changing the
13284: file names is not good practice.</p>
1.1 grant 13285: </div>
13286: </div>
13287:
1.67 hubertf 13288: <div class="sect1" lang="en">
1.1 grant 13289: <div class="titlepage">
13290: <div>
13291: <div>
13292: <h2 class="title" style="clear: both"><a name=
1.68 rillig 13293: "configuration-gotchas"></a>16.3. Configuration
1.1 grant 13294: gotchas</h2>
13295: </div>
13296: </div>
13297: </div>
13298:
1.67 hubertf 13299: <div class="sect2" lang="en">
1.1 grant 13300: <div class="titlepage">
13301: <div>
13302: <div>
1.67 hubertf 13303: <h3 class="title"><a name=
1.68 rillig 13304: "fixes.libtool"></a>16.3.1. Shared libraries
1.1 grant 13305: - libtool</h3>
13306: </div>
13307: </div>
13308: </div>
13309:
13310: <p>pkgsrc supports many different machines, with
13311: different object formats like a.out and ELF, and
13312: varying abilities to do shared library and dynamic
13313: loading at all. To accompany this, varying commands and
13314: options have to be passed to the compiler, linker, etc.
13315: to get the Right Thing, which can be pretty annoying
13316: especially if you don't have all the machines at your
13317: hand to test things. The <a xmlns=
13318: "http://www.w3.org/TR/xhtml1/transitional" href=
13319: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45 wiz 13320: target="_top"><code xmlns="" class=
13321: "filename">devel/libtool</code></a> pkg can help here,
13322: as it just “<span class=
13323: "quote">knows</span>” how to build both static
13324: and dynamic libraries from a set of source files, thus
1.47 reed 13325: being platform-independent.</p>
1.1 grant 13326:
13327: <p>Here's how to use libtool in a pkg in seven simple
13328: steps:</p>
13329:
13330: <div class="orderedlist">
13331: <ol type="1">
13332: <li>
1.14 xtraeme 13333: <p>Add <code class=
13334: "varname">USE_LIBTOOL=yes</code> to the package
13335: Makefile.</p>
1.1 grant 13336: </li>
13337:
13338: <li>
13339: <p>For library objects, use “<span class=
13340: "quote">${LIBTOOL} --mode=compile
13341: ${CC}</span>” in place of
13342: “<span class="quote">${CC}</span>”.
13343: You could even add it to the definition of
1.14 xtraeme 13344: <code class="varname">CC</code>, if only
13345: libraries are being built in a given Makefile.
13346: This one command will build both PIC and non-PIC
13347: library objects, so you need not have separate
13348: shared and non-shared library rules.</p>
1.1 grant 13349: </li>
13350:
13351: <li>
13352: <p>For the linking of the library, remove any
13353: “<span class="quote">ar</span>”,
13354: “<span class="quote">ranlib</span>”,
13355: and “<span class="quote">ld
13356: -Bshareable</span>” commands, and instead
13357: use:</p>
13358: <pre class="programlisting">
1.51 rillig 13359: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
13360: -rpath ${PREFIX}/lib -version-info major:minor
1.1 grant 13361: </pre>
13362:
13363: <p>Note that the library is changed to have a
1.45 wiz 13364: <code xmlns=
13365: "http://www.w3.org/TR/xhtml1/transitional" class=
13366: "filename">.la</code> extension, and the objects
13367: are changed to have a <code xmlns=
13368: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13369: "filename">.lo</code> extension. Change
13370: <code class="varname">OBJS</code> as necessary.
13371: This automatically creates all of the
1.45 wiz 13372: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13373: class="filename">.a</code>, <code xmlns=
13374: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13375: "filename">.so.major.minor</code>, and ELF
13376: symlinks (if necessary) in the build directory.
13377: Be sure to include “<span class=
1.1 grant 13378: "quote">-version-info</span>”, especially
13379: when major and minor are zero, as libtool will
13380: otherwise strip off the shared library
13381: version.</p>
13382:
13383: <p>From the libtool manual:</p>
13384: <pre class="programlisting">
1.51 rillig 13385: So, libtool library versions are described by three integers:
1.1 grant 13386:
1.51 rillig 13387: CURRENT
13388: The most recent interface number that this library implements.
1.1 grant 13389:
1.51 rillig 13390: REVISION
13391: The implementation number of the CURRENT interface.
1.1 grant 13392:
1.51 rillig 13393: AGE
13394: The difference between the newest and oldest interfaces that
13395: this library implements. In other words, the library implements
13396: all the interface numbers in the range from number `CURRENT -
13397: AGE' to `CURRENT'.
1.68 rillig 13398:
1.51 rillig 13399: If two libraries have identical CURRENT and AGE numbers, then the
13400: dynamic linker chooses the library with the greater REVISION number.
1.1 grant 13401: </pre>
13402:
13403: <p>The “<span class=
13404: "quote">-release</span>” option will
13405: produce different results for a.out and ELF
13406: (excluding symlinks) in only one case. An ELF
13407: library of the form “<span class=
13408: "quote">libfoo-release.so.<span class=
13409: "emphasis"><em>x</em></span>.<span class=
13410: "emphasis"><em>y</em></span></span>” will
13411: have a symlink of “<span class=
13412: "quote">libfoo.so.<span class=
13413: "emphasis"><em>x</em></span>.<span class=
13414: "emphasis"><em>y</em></span></span>” on an
13415: a.out platform. This is handled
13416: automatically.</p>
13417:
13418: <p>The “<span class="quote">-rpath
13419: argument</span>” is the install directory
13420: of the library being built.</p>
13421:
1.45 wiz 13422: <p>In the <code xmlns=
13423: "http://www.w3.org/TR/xhtml1/transitional" class=
13424: "filename">PLIST</code>, include only the
13425: <code xmlns=
13426: "http://www.w3.org/TR/xhtml1/transitional" class=
1.19 hubertf 13427: "filename">.la</code> file, the other files will
13428: be added automatically.</p>
1.1 grant 13429: </li>
13430:
13431: <li>
1.45 wiz 13432: <p>When linking shared object (<code xmlns=
13433: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13434: "filename">.so</code>) files, i.e. files that are
1.24 wiz 13435: loaded via <a href=
13436: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
13437: <span class="citerefentry"><span class=
13438: "refentrytitle">dlopen</span>(3)</span></a>, NOT
13439: shared libraries, use “<span class=
13440: "quote">-module -avoid-version</span>” to
13441: prevent them getting version tacked on.</p>
1.1 grant 13442:
1.45 wiz 13443: <p>The <code xmlns=
13444: "http://www.w3.org/TR/xhtml1/transitional" class=
13445: "filename">PLIST</code> file gets the
13446: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13447: class="filename">foo.so</code> entry.</p>
1.1 grant 13448: </li>
13449:
13450: <li>
13451: <p>When linking programs that depend on these
13452: libraries <span class=
13453: "emphasis"><em>before</em></span> they are
13454: installed, preface the <a href=
13455: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
13456: <span class="citerefentry"><span class=
13457: "refentrytitle">cc</span>(1)</span></a> or
13458: <a href=
13459: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
13460: <span class="citerefentry"><span class=
13461: "refentrytitle">ld</span>(1)</span></a> line with
13462: “<span class="quote">${LIBTOOL}
13463: --mode=link</span>”, and it will find the
13464: correct libraries (static or shared), but please
13465: be aware that libtool will not allow you to
13466: specify a relative path in -L (such as
13467: “<span class=
13468: "quote">-L../somelib</span>”), because it
13469: expects you to change that argument to be the
1.45 wiz 13470: <code xmlns=
13471: "http://www.w3.org/TR/xhtml1/transitional" class=
13472: "filename">.la</code> file. e.g.</p>
1.1 grant 13473: <pre class="programlisting">
1.51 rillig 13474: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1 grant 13475: </pre>
13476:
13477: <p>should be changed to:</p>
13478: <pre class="programlisting">
1.51 rillig 13479: ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14 xtraeme 13480: "replaceable"><code>someprog</code></em> <em class=
13481: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 13482: </pre>
13483:
13484: <p>and it will do the right thing with the
13485: libraries.</p>
13486: </li>
13487:
13488: <li>
13489: <p>When installing libraries, preface the
13490: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
13491: <span class="citerefentry"><span class=
13492: "refentrytitle">install</span>(1)</span></a> or
13493: <a href=
13494: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
13495: <span class="citerefentry"><span class=
13496: "refentrytitle">cp</span>(1)</span></a> command
13497: with “<span class="quote">${LIBTOOL}
13498: --mode=install</span>”, and change the
1.45 wiz 13499: library name to <code xmlns=
13500: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13501: "filename">.la</code>. e.g.</p>
1.1 grant 13502: <pre class="programlisting">
1.51 rillig 13503: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 grant 13504: </pre>
13505:
1.45 wiz 13506: <p>This will install the static <code xmlns=
13507: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13508: "filename">.a</code>, shared library, any needed
1.1 grant 13509: symlinks, and run <a href=
13510: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
13511: <span class="citerefentry"><span class=
13512: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
13513: </li>
13514:
13515: <li>
1.45 wiz 13516: <p>In your <code xmlns=
13517: "http://www.w3.org/TR/xhtml1/transitional" class=
13518: "filename">PLIST</code>, include only the
13519: <code xmlns=
13520: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 13521: "filename">.la</code> file (this is a change from
13522: previous behaviour).</p>
1.1 grant 13523: </li>
13524: </ol>
13525: </div>
13526: </div>
13527:
1.67 hubertf 13528: <div class="sect2" lang="en">
1.1 grant 13529: <div class="titlepage">
13530: <div>
13531: <div>
1.67 hubertf 13532: <h3 class="title"><a name=
1.68 rillig 13533: "using-libtool"></a>16.3.2. Using libtool on
1.30 wiz 13534: GNU packages that already support libtool</h3>
1.1 grant 13535: </div>
13536: </div>
13537: </div>
13538:
1.14 xtraeme 13539: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
13540: the package Makefile. This will override the package's
13541: own libtool in most cases. For older libtool using
1.1 grant 13542: packages, libtool is made by ltconfig script during the
13543: do-configure step; you can check the libtool script
1.14 xtraeme 13544: location by doing <span><strong class="command">make
13545: configure; find work*/ -name
13546: libtool</strong></span>.</p>
13547:
13548: <p><code class="varname">LIBTOOL_OVERRIDE</code>
13549: specifies which libtool scripts, relative to
13550: <code class="varname">WRKSRC</code>, to override. By
13551: default, it is set to “<span class=
13552: "quote">libtool */libtool */*/libtool</span>”. If
13553: this does not match the location of the package's
13554: libtool script(s), set it as appropriate.</p>
1.13 hubertf 13555:
1.45 wiz 13556: <p>If you do not need <code xmlns=
13557: "http://www.w3.org/TR/xhtml1/transitional" class=
13558: "filename">*.a</code> static libraries built and
13559: installed, then use <code class=
13560: "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1 grant 13561:
1.47 reed 13562: <p>If your package makes use of the
13563: platform-independent library for loading dynamic shared
13564: objects, that comes with libtool (libltdl), you should
13565: include devel/libltdl/buildlink3.mk.</p>
1.1 grant 13566:
13567: <p>Some packages use libtool incorrectly so that the
13568: package may not work or build in some circumstances.
13569: Some of the more common errors are:</p>
13570:
13571: <div class="itemizedlist">
13572: <ul type="disc">
13573: <li>
13574: <p>The inclusion of a shared object (-module) as
13575: a dependent library in an executable or library.
13576: This in itself isn't a problem if one of two
13577: things has been done:</p>
13578:
13579: <div class="orderedlist">
13580: <ol type="1">
13581: <li>
13582: <p>The shared object is named correctly,
1.45 wiz 13583: i.e. <code xmlns=
13584: "http://www.w3.org/TR/xhtml1/transitional"
13585: class="filename">libfoo.la</code>, not
13586: <code xmlns=
13587: "http://www.w3.org/TR/xhtml1/transitional"
13588: class="filename">foo.la</code></p>
1.1 grant 13589: </li>
13590:
13591: <li>
13592: <p>The -dlopen option is used when linking
13593: an executable.</p>
13594: </li>
13595: </ol>
13596: </div>
13597: </li>
13598:
13599: <li>
13600: <p>The use of libltdl without the correct calls
13601: to initialisation routines. The function
13602: lt_dlinit() should be called and the macro
1.14 xtraeme 13603: <code class=
13604: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 13605: included in executables.</p>
13606: </li>
13607: </ul>
13608: </div>
13609: </div>
13610:
1.67 hubertf 13611: <div class="sect2" lang="en">
1.1 grant 13612: <div class="titlepage">
13613: <div>
13614: <div>
1.67 hubertf 13615: <h3 class="title"><a name=
1.68 rillig 13616: "autoconf-automake"></a>16.3.3. GNU
1.1 grant 13617: Autoconf/Automake</h3>
13618: </div>
13619: </div>
13620: </div>
13621:
13622: <p>If a package needs GNU autoconf or automake to be
13623: executed to regenerate the configure script and
13624: Makefile.in makefile templates, then they should be
1.35 jmmv 13625: executed in a pre-configure target.</p>
1.1 grant 13626:
13627: <p>For packages that need only autoconf:</p>
13628: <pre class="programlisting">
1.51 rillig 13629: AUTOCONF_REQD= 2.50 # if default version is not good enough
13630: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
13631: ...
1.1 grant 13632:
1.51 rillig 13633: pre-configure:
13634: cd ${WRKSRC}; autoconf
1.1 grant 13635:
1.51 rillig 13636: ...
1.1 grant 13637: </pre>
13638:
13639: <p>and for packages that need automake and
13640: autoconf:</p>
13641: <pre class="programlisting">
1.51 rillig 13642: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
13643: USE_TOOLS+= automake # use "automake14" for automake-1.4
13644: ...
1.1 grant 13645:
1.51 rillig 13646: pre-configure:
13647: cd ${WRKSRC}; \
13648: aclocal; autoheader; \
13649: automake -a --foreign -i; autoconf
13650:
13651: ...
1.1 grant 13652: </pre>
13653:
13654: <p>Packages which use GNU Automake will almost
1.35 jmmv 13655: certainly require GNU Make.</p>
1.1 grant 13656:
13657: <p>There are times when the configure process makes
13658: additional changes to the generated files, which then
13659: causes the build process to try to re-execute the
13660: automake sequence. This is prevented by touching
13661: various files in the configure stage. If this causes
1.14 xtraeme 13662: problems with your package you can set <code class=
13663: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 13664: Makefile.</p>
13665: </div>
13666: </div>
13667:
1.67 hubertf 13668: <div class="sect1" lang="en">
1.1 grant 13669: <div class="titlepage">
13670: <div>
13671: <div>
13672: <h2 class="title" style="clear: both"><a name=
1.68 rillig 13673: "fixes-build"></a>16.4. Building the
1.55 rillig 13674: package</h2>
1.1 grant 13675: </div>
13676: </div>
13677: </div>
13678:
1.67 hubertf 13679: <div class="sect2" lang="en">
1.1 grant 13680: <div class="titlepage">
13681: <div>
13682: <div>
1.67 hubertf 13683: <h3 class="title"><a name=
1.68 rillig 13684: "cpp-defines"></a>16.4.1. CPP defines</h3>
1.1 grant 13685: </div>
13686: </div>
13687: </div>
13688:
1.55 rillig 13689: <p>Sometimes you need to compile different code
13690: depending on the target platform. The C preprocessor
13691: has a set of predefined macros that can be queried by
13692: using <code class="varname">#ifdef FOO</code> or
13693: <code class="varname">#if defined(FOO)</code>. Among
13694: these macros are usually ones that describe the target
13695: CPU and operating system. Depending of which of the
13696: macros are defined, you can write code that uses
1.61 rillig 13697: features unique to a specific platform. Generally you
13698: should rather use the GNU autotools (automake,
13699: autoconf, etc.) to check for specific features (like
13700: the existence of a header file, a function or a
13701: library), but sometimes this is not possible or
13702: desired.</p>
13703:
13704: <p>In that case you can use the predefined macros below
13705: to configure your code to the platform it runs on.
13706: Almost every operating system, hardware architecture
13707: and compiler has its own macro. For example, if the
13708: macros <code class="varname">__GNUC__</code>,
13709: <code class="varname">__i386__</code> and <code class=
1.55 rillig 13710: "varname">__NetBSD__</code> are all defined, you know
1.61 rillig 13711: that you are using NetBSD on an i386 compatible CPU,
13712: and your compiler is GCC.</p>
1.55 rillig 13713:
1.67 hubertf 13714: <div class="sect3" lang="en">
1.55 rillig 13715: <div class="titlepage">
13716: <div>
13717: <div>
13718: <h4 class="title"><a name=
1.68 rillig 13719: "fixes-build-cpp-opsys"></a>16.4.1.1. CPP
1.55 rillig 13720: defines for operating systems</h4>
13721: </div>
13722: </div>
13723: </div>
13724:
13725: <p>To distinguish between 4.4 BSD-derived systems and
13726: the rest of the world, you should use the following
13727: code.</p>
13728: <pre class="programlisting">
1.51 rillig 13729: #include <sys/param.h>
1.55 rillig 13730: #if (defined(BSD) && BSD >= 199306)
1.60 rillig 13731: /* BSD-specific code goes here */
1.55 rillig 13732: #else
1.60 rillig 13733: /* non-BSD-specific code goes here */
1.55 rillig 13734: #endif
1.1 grant 13735: </pre>
13736:
1.55 rillig 13737: <p>If this distinction is not fine enough, you can
13738: also use the following defines.</p>
13739: <pre class="programlisting">
13740: FreeBSD __FreeBSD__
1.56 rillig 13741: DragonFly __DragonFly__
1.57 minskim 13742: Interix __INTERIX
1.55 rillig 13743: Linux linux, __linux, __linux__
13744: NetBSD __NetBSD__
13745: OpenBSD __OpenBSD__
1.60 rillig 13746: Solaris sun, __sun
1.1 grant 13747: </pre>
1.55 rillig 13748: </div>
1.1 grant 13749:
1.67 hubertf 13750: <div class="sect3" lang="en">
1.55 rillig 13751: <div class="titlepage">
13752: <div>
13753: <div>
1.67 hubertf 13754: <h4 class="title"><a name=
1.68 rillig 13755: "fixes-build-cpp-cpu"></a>16.4.1.2. CPP
1.55 rillig 13756: defines for CPUs</h4>
13757: </div>
13758: </div>
13759: </div>
13760: <pre class="programlisting">
13761: i386 i386, __i386, __i386__
13762: MIPS __mips
13763: SPARC sparc, __sparc
13764: </pre>
13765: </div>
13766:
1.67 hubertf 13767: <div class="sect3" lang="en">
1.55 rillig 13768: <div class="titlepage">
13769: <div>
13770: <div>
13771: <h4 class="title"><a name=
1.68 rillig 13772: "fixes-build-cpp-compiler"></a>16.4.1.3. CPP
1.55 rillig 13773: defines for compilers</h4>
13774: </div>
13775: </div>
13776: </div>
13777: <pre class="programlisting">
13778: GCC __GNUC__ (major version), __GNUC_MINOR__
1.60 rillig 13779: SunPro __SUNPRO_C (0x570 for version 5.7)
1.55 rillig 13780: </pre>
13781: </div>
1.1 grant 13782: </div>
1.51 rillig 13783:
1.67 hubertf 13784: <div class="sect2" lang="en">
1.51 rillig 13785: <div class="titlepage">
13786: <div>
13787: <div>
1.67 hubertf 13788: <h3 class="title"><a name=
1.68 rillig 13789: "cpp-list-examples"></a>16.4.2. Examples of
1.60 rillig 13790: CPP defines for some platforms</h3>
13791: </div>
13792: </div>
13793: </div>
13794:
13795: <p>The list of the CPP identification macros for
13796: hardware and operating system may depend on the
13797: compiler that is used. The following list contains some
13798: examples that may help you to choose the right ones.
13799: For example, if you want to conditionally compile code
13800: on Solaris, don't use <code class=
13801: "varname">__sun__</code>, as the SunPro compiler does
13802: not define it. Use <code class="varname">__sun</code>
13803: instead.</p>
13804:
13805: <div class="variablelist">
13806: <dl>
1.61 rillig 13807: <dt><span class="term">GCC 3.3.3 + SuSE Linux 9.1 +
13808: i386</span></dt>
13809:
13810: <dd>
1.62 rillig 13811: <p>__ELF__, __gnu_linux__, __i386, __i386__,
1.61 rillig 13812: __linux, __linux__, __unix, __unix__, i386,
13813: linux, unix.</p>
13814: </dd>
13815:
13816: <dt><span class="term">GCC 2.95 + NetBSD 1.6.2 +
13817: i386</span></dt>
13818:
13819: <dd>
1.62 rillig 13820: <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61 rillig 13821: i386.</p>
13822: </dd>
13823:
13824: <dt><span class="term">GCC 3.3.3 + NetBSD 2.0 +
13825: i386</span></dt>
1.60 rillig 13826:
13827: <dd>
1.62 rillig 13828: <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61 rillig 13829: i386.</p>
1.60 rillig 13830: </dd>
13831:
13832: <dt><span class="term">GCC 4 + Solaris 8 +
13833: SPARC</span></dt>
13834:
13835: <dd>
13836: <p>__ELF__, __sparc, __sparc__, __sun, __sun__,
13837: __SVR4, __svr4__, __unix, __unix__, sparc, sun,
13838: unix.</p>
13839: </dd>
1.61 rillig 13840:
13841: <dt><span class="term">SunPro 5.7 + Solaris 8 +
13842: SPARC</span></dt>
13843:
13844: <dd>
13845: <p>__SVR4, __sparc, __sun, __unix, sparc, sun,
13846: unix.</p>
13847: </dd>
1.60 rillig 13848: </dl>
13849: </div>
13850: </div>
13851:
1.67 hubertf 13852: <div class="sect2" lang="en">
1.60 rillig 13853: <div class="titlepage">
13854: <div>
13855: <div>
1.67 hubertf 13856: <h3 class="title"><a name=
1.68 rillig 13857: "cpp-list"></a>16.4.3. Getting a list of CPP
1.51 rillig 13858: defines</h3>
13859: </div>
13860: </div>
13861: </div>
13862:
1.60 rillig 13863: <p>If your system uses the GNU C Compiler, you can get
13864: a list of symbols that are defined by default, e.g. to
13865: identify the platform, with the following command:</p>
1.51 rillig 13866: <pre class="programlisting">
13867: gcc -E -dM - < /dev/null
13868: </pre>
1.60 rillig 13869:
13870: <p>On other systems you may get the list by using the
13871: system's syscall trace utility (ktrace, truss, strace)
13872: to have a look which arguments are passed to the actual
13873: compiler.</p>
1.51 rillig 13874: </div>
1.1 grant 13875: </div>
13876:
1.67 hubertf 13877: <div class="sect1" lang="en">
1.1 grant 13878: <div class="titlepage">
13879: <div>
13880: <div>
13881: <h2 class="title" style="clear: both"><a name=
1.68 rillig 13882: "package-specific-actions"></a>16.5. Package
1.1 grant 13883: specific actions</h2>
13884: </div>
13885: </div>
13886: </div>
13887:
1.67 hubertf 13888: <div class="sect2" lang="en">
1.1 grant 13889: <div class="titlepage">
13890: <div>
13891: <div>
1.67 hubertf 13892: <h3 class="title"><a name=
1.68 rillig 13893: "user-interaction"></a>16.5.1. User
1.2 hubertf 13894: interaction</h3>
1.1 grant 13895: </div>
13896: </div>
13897: </div>
13898:
13899: <p>Occasionally, packages require interaction from the
13900: user, and this can be in a number of ways:</p>
13901:
13902: <div class="itemizedlist">
13903: <ul type="disc">
13904: <li>
13905: <p>help in fetching the distfiles</p>
13906: </li>
13907:
13908: <li>
13909: <p>help to configure the package before it is
13910: built</p>
13911: </li>
13912:
13913: <li>
13914: <p>help during the build process</p>
13915: </li>
13916:
13917: <li>
13918: <p>help during the installation of a package</p>
13919: </li>
13920: </ul>
13921: </div>
13922:
1.14 xtraeme 13923: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 13924: definition is provided to notify the pkgsrc mechanism
13925: of an interactive stage which will be needed, and this
1.45 wiz 13926: should be set in the package's <code xmlns=
13927: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 13928: "filename">Makefile</code>, e.g.:</p>
1.1 grant 13929: <pre class="programlisting">
1.51 rillig 13930: INTERACTIVE_STAGE= build
1.1 grant 13931: </pre>
13932:
13933: <p>Multiple interactive stages can be specified:</p>
13934: <pre class="programlisting">
1.51 rillig 13935: INTERACTIVE_STAGE= configure install
1.1 grant 13936: </pre>
13937: </div>
13938:
1.67 hubertf 13939: <div class="sect2" lang="en">
1.1 grant 13940: <div class="titlepage">
13941: <div>
13942: <div>
1.67 hubertf 13943: <h3 class="title"><a name=
1.68 rillig 13944: "handling-licenses"></a>16.5.2. Handling
1.1 grant 13945: licenses</h3>
13946: </div>
13947: </div>
13948: </div>
13949:
1.44 gdt 13950: <p>A package may be covered by a license which the user
13951: has or has not agreed to accept. For these cases,
13952: pkgsrc contains a mechanism to note that a package is
13953: covered by a particular license, and the package cannot
13954: be built unless the user has accepted the license.
13955: (Installation of binary packages are not currently
13956: subject to this mechanism.) Packages with licenses that
13957: are either Open Source according to the Open Source
13958: Initiative or Free according to the Free Software
13959: Foundation will not be marked with a license tag.
13960: Packages with licenses that have not been determined to
13961: meet either definition will be marked with a license
13962: tag referring to the license. This will prevent
13963: building unless pkgsrc is informed that the license is
13964: acceptable, and enables displaying the license.</p>
13965:
13966: <p>The license tag mechanism is intended to address
13967: copyright-related issues surrounding building,
13968: installing and using a package, and not to address
13969: redistribution issues (see <code class=
13970: "varname">RESTRICTED</code> and <code class=
13971: "varname">NO_SRC_ON_FTP</code>, etc.). However, the
13972: above definition of licenses for which tags are not
13973: needed implies that packages with redistribution
13974: restrictions should have tags.</p>
13975:
13976: <p>Denoting that a package is covered by a particular
1.45 wiz 13977: license is done by placing the license in <code xmlns=
13978: "http://www.w3.org/TR/xhtml1/transitional" class=
1.44 gdt 13979: "filename">pkgsrc/licenses</code> and setting the
13980: <code class="varname">LICENSE</code> variable to a
13981: string identifying the license, e.g. in <a xmlns=
1.14 xtraeme 13982: "http://www.w3.org/TR/xhtml1/transitional" href=
1.44 gdt 13983: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45 wiz 13984: target="_top"><code xmlns="" class=
13985: "filename">graphics/xv</code></a>:</p>
1.1 grant 13986: <pre class="programlisting">
1.51 rillig 13987: LICENSE= xv-license
1.1 grant 13988: </pre>
13989:
13990: <p>When trying to build, the user will get a notice
1.44 gdt 13991: that the package is covered by a license which has not
13992: been accepted:</p>
1.1 grant 13993: <pre class="programlisting">
1.51 rillig 13994: <code class="prompt">%</code> <strong class=
1.14 xtraeme 13995: "userinput"><code>make</code></strong>
1.51 rillig 13996: ===> xv-3.10anb9 has an unacceptable license: xv-license.
13997: ===> To view the license, enter "/usr/bin/make show-license".
13998: ===> To indicate acceptance, add this line to your /etc/mk.conf:
13999: ===> ACCEPTABLE_LICENSES+=xv-license
14000: *** Error code 1
1.1 grant 14001: </pre>
14002:
1.14 xtraeme 14003: <p>The license can be viewed with <span><strong class=
14004: "command">make show-license</strong></span>, and if it
14005: is considered appropriate, the line printed above can
1.45 wiz 14006: be added to <code xmlns=
14007: "http://www.w3.org/TR/xhtml1/transitional" class=
14008: "filename">/etc/mk.conf</code> to indicate acceptance
14009: of the particular license:</p>
1.1 grant 14010: <pre class="programlisting">
1.51 rillig 14011: ACCEPTABLE_LICENSES+=xv-license
1.1 grant 14012: </pre>
14013:
14014: <p>When adding a package with a new license, the
1.45 wiz 14015: license text should be added to <code xmlns=
14016: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14017: "filename">pkgsrc/licenses</code> for displaying. A
14018: list of known licenses can be seen in this directory as
14019: well as by looking at the list of (commented out)
14020: <code class="varname">ACCEPTABLE_LICENSES</code>
1.45 wiz 14021: variable settings in <code xmlns=
14022: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14023: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 14024:
1.44 gdt 14025: <p>The use of <code class=
14026: "varname">LICENSE=shareware</code>, <code class=
14027: "varname">LICENSE=no-commercial-use</code>, and similar
14028: language is deprecated because it does not crisply
14029: refer to a particular license text. Another problem
14030: with such usage is that it does not enable a user to
14031: denote acceptance of the license for a single package
14032: without accepting the same license text for another
14033: package. In particular, this can be inappropriate when
14034: e.g. one accepts a particular license to indicate to
14035: pkgsrc that a fee has been paid.</p>
1.1 grant 14036: </div>
14037:
1.67 hubertf 14038: <div class="sect2" lang="en">
1.1 grant 14039: <div class="titlepage">
14040: <div>
14041: <div>
1.30 wiz 14042: <h3 class="title"><a name=
1.68 rillig 14043: "installing-score-files"></a>16.5.3. Installing
1.30 wiz 14044: score files</h3>
1.1 grant 14045: </div>
14046: </div>
14047: </div>
14048:
14049: <p>Certain packages, most of them in the games
14050: category, install a score file that allows all users on
14051: the system to record their highscores. In order for
14052: this to work, the binaries need to be installed setgid
14053: and the score files owned by the appropriate group
14054: and/or owner (traditionally the "games" user/group).
14055: The following variables, documented in more detail in
1.45 wiz 14056: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14057: class="filename">mk/defaults/mk.conf</code>, control
14058: this behaviour: <code class=
1.14 xtraeme 14059: "varname">SETGIDGAME</code>, <code class=
14060: "varname">GAMEDATAMODE</code>, <code class=
14061: "varname">GAMEGRP</code>, <code class=
14062: "varname">GAMEMODE</code>, <code class=
14063: "varname">GAMEOWN</code>.</p>
1.1 grant 14064:
14065: <p>Note that per default, setgid installation of games
1.14 xtraeme 14066: is disabled; setting <code class=
14067: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 14068: variables accordingly.</p>
14069:
14070: <p>A package should therefor never hard code file
1.14 xtraeme 14071: ownership or access permissions but rely on
14072: <code class="varname">INSTALL_GAME</code> and
14073: <code class="varname">INSTALL_GAME_DATA</code> to set
14074: these correctly.</p>
1.1 grant 14075: </div>
14076:
1.67 hubertf 14077: <div class="sect2" lang="en">
1.1 grant 14078: <div class="titlepage">
14079: <div>
14080: <div>
1.67 hubertf 14081: <h3 class="title"><a name=
1.68 rillig 14082: "perl-scripts"></a>16.5.4. Packages
1.30 wiz 14083: containing perl scripts</h3>
1.1 grant 14084: </div>
14085: </div>
14086: </div>
14087:
14088: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 14089: set <code class="varname">REPLACE_PERL</code> to ensure
14090: that the proper interpreter path is set. <code class=
14091: "varname">REPLACE_PERL</code> should contain a list of
14092: scripts, relative to <code class=
14093: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 14094: </div>
14095:
1.67 hubertf 14096: <div class="sect2" lang="en">
1.1 grant 14097: <div class="titlepage">
14098: <div>
14099: <div>
1.67 hubertf 14100: <h3 class="title"><a name=
1.68 rillig 14101: "hardcoded-paths"></a>16.5.5. Packages with
1.1 grant 14102: hardcoded paths to other interpreters</h3>
14103: </div>
14104: </div>
14105: </div>
14106:
14107: <p>Your package may also contain scripts with hardcoded
14108: paths to other interpreters besides (or as well as)
14109: perl. To correct the full pathname to the script
14110: interpreter, you need to set the following definitions
1.45 wiz 14111: in your <code xmlns=
14112: "http://www.w3.org/TR/xhtml1/transitional" class=
14113: "filename">Makefile</code> (we shall use
14114: <span><strong class="command">tclsh</strong></span> in
14115: this example):</p>
1.1 grant 14116: <pre class="programlisting">
1.51 rillig 14117: REPLACE_INTERPRETER+= tcl
1.71 wiz 14118: REPLACE.tcl.old= .*/bin/tclsh
14119: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
14120: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
1.51 rillig 14121: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1 grant 14122: </pre>
1.71 wiz 14123:
14124: <div class="note" style=
14125: "margin-left: 0.5in; margin-right: 0.5in;">
14126: <h3 class="title">Note</h3>
14127:
14128: <p>Before March 2006, these variables were called
14129: <code class="varname">_REPLACE.*</code> and
14130: <code class="varname">_REPLACE_FILES.*</code>.</p>
14131: </div>
1.1 grant 14132: </div>
14133:
1.67 hubertf 14134: <div class="sect2" lang="en">
1.1 grant 14135: <div class="titlepage">
14136: <div>
14137: <div>
1.67 hubertf 14138: <h3 class="title"><a name=
1.68 rillig 14139: "perl-modules"></a>16.5.6. Packages
1.30 wiz 14140: installing perl modules</h3>
1.1 grant 14141: </div>
14142: </div>
14143: </div>
14144:
14145: <p>Makefiles of packages providing perl5 modules should
1.45 wiz 14146: include the Makefile fragment <code xmlns=
14147: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14148: "filename">../../lang/perl5/module.mk</code>. It
14149: provides a <span><strong class=
14150: "command">do-configure</strong></span> target for the
14151: standard perl configuration for such modules as well as
14152: various hooks to tune this configuration. See comments
14153: in this file for details.</p>
1.1 grant 14154:
14155: <p>Perl5 modules will install into different places
14156: depending on the version of perl used during the build
14157: process. To address this, pkgsrc will append lines to
1.45 wiz 14158: the <code xmlns=
14159: "http://www.w3.org/TR/xhtml1/transitional" class=
14160: "filename">PLIST</code> corresponding to the files
14161: listed in the installed <code xmlns=
14162: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14163: "filename">.packlist</code> file generated by most
14164: perl5 modules. This is invoked by defining <code class=
14165: "varname">PERL5_PACKLIST</code> to a space-separated
14166: list of paths to packlist files, e.g.:</p>
1.1 grant 14167: <pre class="programlisting">
1.51 rillig 14168: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1 grant 14169: </pre>
14170:
1.14 xtraeme 14171: <p>The variables <code class=
14172: "varname">PERL5_SITELIB</code>, <code class=
14173: "varname">PERL5_SITEARCH</code>, and <code class=
14174: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 14175: locations in which perl5 modules may be installed, and
14176: may be used by perl5 packages that don't have a
14177: packlist. These three variables are also substituted
1.45 wiz 14178: for in the <code xmlns=
14179: "http://www.w3.org/TR/xhtml1/transitional" class=
14180: "filename">PLIST</code>.</p>
1.1 grant 14181: </div>
14182:
1.67 hubertf 14183: <div class="sect2" lang="en">
1.1 grant 14184: <div class="titlepage">
14185: <div>
14186: <div>
1.67 hubertf 14187: <h3 class="title"><a name=
1.68 rillig 14188: "faq.info-files"></a>16.5.7. Packages
1.1 grant 14189: installing info files</h3>
14190: </div>
14191: </div>
14192: </div>
14193:
14194: <p>Some packages install info files or use the
14195: “<span class="quote">makeinfo</span>” or
14196: “<span class="quote">install-info</span>”
1.72 ! rillig 14197: commands. <code class="varname">INFO_FILES</code>
! 14198: should be defined in the package Makefile so that
! 14199: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 14200: class="filename">INSTALL</code> and <code xmlns=
1.45 wiz 14201: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14202: "filename">DEINSTALL</code> scripts will be generated
14203: to handle registration of the info files in the Info
1.1 grant 14204: directory file. The “<span class=
14205: "quote">install-info</span>” command used for the
14206: info files registration is either provided by the
14207: system, or by a special purpose package automatically
14208: added as dependency if needed.</p>
14209:
1.72 ! rillig 14210: <p><code class="varname">PKGINFODIR</code> is the
! 14211: directory under <code xmlns=
! 14212: "http://www.w3.org/TR/xhtml1/transitional" class=
! 14213: "filename">${PREFIX}</code> where info files are
! 14214: primarily located. <code class=
! 14215: "varname">PKGINFODIR</code> defaults to
! 14216: “<span class="quote">info</span>” and can
! 14217: be overridden by the user.</p>
! 14218:
! 14219: <p>The info files for the package should be listed in
! 14220: the package <code xmlns=
! 14221: "http://www.w3.org/TR/xhtml1/transitional" class=
! 14222: "filename">PLIST</code>; however any split info files
! 14223: need not be listed.</p>
! 14224:
1.1 grant 14225: <p>A package which needs the “<span class=
14226: "quote">makeinfo</span>” command at build time
1.72 ! rillig 14227: must add “<span class=
! 14228: "quote">makeinfo</span>” to <code class=
! 14229: "varname">USE_TOOLS</code> in its Makefile. If a
1.1 grant 14230: minimum version of the “<span class=
14231: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 14232: should be noted with the <code class=
14233: "varname">TEXINFO_REQD</code> variable in the package
1.45 wiz 14234: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14235: class="filename">Makefile</code>. By default, a minimum
14236: version of 3.12 is required. If the system does not
14237: provide a <span><strong class=
1.14 xtraeme 14238: "command">makeinfo</strong></span> command or if it
14239: does not match the required minimum, a build dependency
14240: on the <a xmlns=
14241: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 14242: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45 wiz 14243: target="_top"><code xmlns="" class=
14244: "filename">devel/gtexinfo</code></a> package will be
1.20 ben 14245: added automatically.</p>
1.1 grant 14246:
14247: <p>The build and installation process of the software
14248: provided by the package should not use the
1.14 xtraeme 14249: <span><strong class=
14250: "command">install-info</strong></span> command as the
14251: registration of info files is the task of the package
1.45 wiz 14252: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14253: class="filename">INSTALL</code> script, and it must use
14254: the appropriate <span><strong class=
1.14 xtraeme 14255: "command">makeinfo</strong></span> command.</p>
1.1 grant 14256:
1.47 reed 14257: <p>To achieve this goal, the pkgsrc infrastructure
1.14 xtraeme 14258: creates overriding scripts for the <span><strong class=
14259: "command">install-info</strong></span> and
14260: <span><strong class="command">makeinfo</strong></span>
14261: commands in a directory listed early in <code class=
14262: "varname">PATH</code>.</p>
1.1 grant 14263:
1.14 xtraeme 14264: <p>The script overriding <span><strong class=
14265: "command">install-info</strong></span> has no effect
14266: except the logging of a message. The script overriding
14267: <span><strong class="command">makeinfo</strong></span>
14268: logs a message and according to the value of
1.72 ! rillig 14269: <code class="varname">TEXINFO_REQD</code> either runs
1.14 xtraeme 14270: the appropriate <span><strong class=
14271: "command">makeinfo</strong></span> command or exit on
14272: error.</p>
1.1 grant 14273: </div>
14274:
1.67 hubertf 14275: <div class="sect2" lang="en">
1.57 minskim 14276: <div class="titlepage">
14277: <div>
14278: <div>
1.67 hubertf 14279: <h3 class="title"><a name=
1.68 rillig 14280: "manpages"></a>16.5.8. Packages installing
1.57 minskim 14281: man pages</h3>
14282: </div>
14283: </div>
14284: </div>
14285:
14286: <p>Many packages install manual pages. The man pages
14287: are installed under <code class=
14288: "varname">${PREFIX}/${PKGMANDIR}</code> which is
14289: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14290: class="filename">/usr/pkg/man</code> by default.
14291: <code class="varname">PKGMANDIR</code> defaults to
14292: “<span class="quote">man</span>”. For
14293: example, you can set <code class=
14294: "varname">PKGMANDIR</code> to “<span class=
14295: "quote">share/man</span>” to have man pages
14296: install under <code xmlns=
14297: "http://www.w3.org/TR/xhtml1/transitional" class=
14298: "filename">/usr/pkg/share/man/</code> by default.</p>
14299:
14300: <div class="note" style=
14301: "margin-left: 0.5in; margin-right: 0.5in;">
14302: <h3 class="title">Note</h3>
14303:
14304: <p>The support for a custom <code class=
14305: "varname">PKGMANDIR</code> is not complete.</p>
14306: </div>
14307:
14308: <p>The <code xmlns=
14309: "http://www.w3.org/TR/xhtml1/transitional" class=
14310: "filename">PLIST</code> files can just use <code xmlns=
14311: "http://www.w3.org/TR/xhtml1/transitional" class=
14312: "filename">man/</code> as the top level directory for
14313: the man page file entries and the pkgsrc framework will
14314: convert as needed.</p>
14315:
14316: <p>Packages that are configured with <code class=
14317: "varname">GNU_CONFIGURE</code> set as
14318: “<span class="quote">yes</span>”, by
14319: default will use the <code xmlns=
14320: "http://www.w3.org/TR/xhtml1/transitional" class=
14321: "filename">./configure</code> --mandir switch to set
14322: where the man pages should be installed. The path is
14323: <code class="varname">GNU_CONFIGURE_MANDIR</code> which
14324: defaults to <code class=
14325: "varname">${PREFIX}/${PKGMANDIR}</code>.</p>
14326:
14327: <p>Packages that use <code class=
14328: "varname">GNU_CONFIGURE</code> but do not use --mandir,
14329: can set <code class=
14330: "varname">CONFIGURE_HAS_MANDIR</code> to
14331: “<span class="quote">no</span>”. Or if the
14332: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14333: class="filename">./configure</code> script uses a
14334: non-standard use of --mandir, you can set <code class=
14335: "varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
14336:
14337: <p>See <a href="#manpage-compression" title=
14338: "10.5. Man page compression">Section 10.5,
14339: “Man page compression”</a> for information
14340: on installation of compressed manual pages.</p>
14341: </div>
14342:
1.67 hubertf 14343: <div class="sect2" lang="en">
1.1 grant 14344: <div class="titlepage">
14345: <div>
14346: <div>
1.67 hubertf 14347: <h3 class="title"><a name=
1.68 rillig 14348: "gconf2-data-files"></a>16.5.9. Packages
1.30 wiz 14349: installing GConf2 data files</h3>
1.1 grant 14350: </div>
14351: </div>
14352: </div>
14353:
1.45 wiz 14354: <p>If a package installs <code xmlns=
14355: "http://www.w3.org/TR/xhtml1/transitional" class=
14356: "filename">.schemas</code> or <code xmlns=
14357: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14358: "filename">.entries</code> files, used by GConf2, you
1.1 grant 14359: need to take some extra steps to make sure they get
14360: registered in the database:</p>
14361:
14362: <div class="orderedlist">
14363: <ol type="1">
14364: <li>
1.45 wiz 14365: <p>Include <code xmlns=
14366: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14367: "filename">../../devel/GConf2/schemas.mk</code>
1.45 wiz 14368: instead of its <code xmlns=
14369: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14370: "filename">buildlink3.mk</code> file. This takes
1.1 grant 14371: care of rebuilding the GConf2 database at
14372: installation and deinstallation time, and tells
14373: the package where to install GConf2 data files
14374: using some standard configure arguments. It also
14375: disallows any access to the database directly
14376: from the package.</p>
14377: </li>
14378:
14379: <li>
14380: <p>Ensure that the package installs its
1.45 wiz 14381: <code xmlns=
14382: "http://www.w3.org/TR/xhtml1/transitional" class=
14383: "filename">.schemas</code> files under
14384: <code xmlns=
14385: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14386: "filename">${PREFIX}/share/gconf/schemas</code>.
1.45 wiz 14387: If they get installed under <code xmlns=
14388: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14389: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 14390: manually patch the package.</p>
14391: </li>
14392:
14393: <li>
14394: <p>Check the PLIST and remove any entries under
14395: the etc/gconf directory, as they will be handled
14396: automatically. See <a href="#faq.conf" title=
1.38 dillo 14397: "7.14. How do I change the location of configuration files?">
14398: Section 7.14, “How do I change the
1.35 jmmv 14399: location of configuration files?”</a> for
14400: more information.</p>
1.1 grant 14401: </li>
14402:
14403: <li>
1.14 xtraeme 14404: <p>Define the <code class=
14405: "varname">GCONF2_SCHEMAS</code> variable in your
1.45 wiz 14406: <code xmlns=
14407: "http://www.w3.org/TR/xhtml1/transitional" class=
14408: "filename">Makefile</code> with a list of all
14409: <code xmlns=
14410: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14411: "filename">.schemas</code> files installed by the
14412: package, if any. Names must not contain any
14413: directories in them.</p>
1.1 grant 14414: </li>
14415:
14416: <li>
1.14 xtraeme 14417: <p>Define the <code class=
14418: "varname">GCONF2_ENTRIES</code> variable in your
1.45 wiz 14419: <code xmlns=
14420: "http://www.w3.org/TR/xhtml1/transitional" class=
14421: "filename">Makefile</code> with a list of all
14422: <code xmlns=
14423: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14424: "filename">.entries</code> files installed by the
14425: package, if any. Names must not contain any
14426: directories in them.</p>
1.1 grant 14427: </li>
14428: </ol>
14429: </div>
14430: </div>
14431:
1.67 hubertf 14432: <div class="sect2" lang="en">
1.1 grant 14433: <div class="titlepage">
14434: <div>
14435: <div>
1.30 wiz 14436: <h3 class="title"><a name=
1.68 rillig 14437: "scrollkeeper-data-files"></a>16.5.10. Packages
1.30 wiz 14438: installing scrollkeeper data files</h3>
1.1 grant 14439: </div>
14440: </div>
14441: </div>
14442:
1.45 wiz 14443: <p>If a package installs <code xmlns=
14444: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14445: "filename">.omf</code> files, used by scrollkeeper, you
14446: need to take some extra steps to make sure they get
14447: registered in the database:</p>
1.1 grant 14448:
14449: <div class="orderedlist">
14450: <ol type="1">
14451: <li>
1.45 wiz 14452: <p>Include <code xmlns=
14453: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14454: "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45 wiz 14455: instead of its <code xmlns=
14456: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14457: "filename">buildlink3.mk</code> file. This takes
1.1 grant 14458: care of rebuilding the scrollkeeper database at
14459: installation and deinstallation time, and
14460: disallows any access to it directly from the
14461: package.</p>
14462: </li>
14463:
14464: <li>
14465: <p>Check the PLIST and remove any entries under
1.45 wiz 14466: the <code xmlns=
14467: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14468: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 14469: as they will be handled automatically.</p>
14470: </li>
14471:
14472: <li>
1.45 wiz 14473: <p>Remove the <code xmlns=
14474: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14475: "filename">share/omf</code> directory from the
14476: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 14477: </li>
14478: </ol>
14479: </div>
14480: </div>
14481:
1.67 hubertf 14482: <div class="sect2" lang="en">
1.1 grant 14483: <div class="titlepage">
14484: <div>
14485: <div>
1.67 hubertf 14486: <h3 class="title"><a name=
1.68 rillig 14487: "x11-fonts"></a>16.5.11. Packages installing
1.1 grant 14488: X11 fonts</h3>
14489: </div>
14490: </div>
14491: </div>
14492:
14493: <p>If a package installs font files, you will need to
14494: rebuild the fonts database in the directory where they
14495: get installed at installation and deinstallation time.
1.65 hubertf 14496: This can be automatically done by using the pkginstall
14497: framework.</p>
1.1 grant 14498:
1.65 hubertf 14499: <p>You can list the directories where fonts are
14500: installed in the <code class=
14501: "varname">FONTS_DIRS.<em class=
14502: "replaceable"><code>type</code></em></code> variables,
14503: where <em class="replaceable"><code>type</code></em>
14504: can be one of “<span class=
14505: "quote">ttf</span>”, “<span class=
14506: "quote">type1</span>” or “<span class=
14507: "quote">x11</span>”. Also make sure that the
14508: database file <code xmlns=
1.45 wiz 14509: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14510: "filename">fonts.dir</code> is not listed in the
1.1 grant 14511: PLIST.</p>
14512:
14513: <p>Note that you should not create new directories for
14514: fonts; instead use the standard ones to avoid that the
14515: user needs to manually configure his X server to find
14516: them.</p>
14517: </div>
14518:
1.67 hubertf 14519: <div class="sect2" lang="en">
1.1 grant 14520: <div class="titlepage">
14521: <div>
14522: <div>
1.67 hubertf 14523: <h3 class="title"><a name=
1.68 rillig 14524: "gtk2-modules"></a>16.5.12. Packages
1.30 wiz 14525: installing GTK2 modules</h3>
1.1 grant 14526: </div>
14527: </div>
14528: </div>
14529:
1.47 reed 14530: <p>If a package installs GTK2 immodules or loaders, you
1.1 grant 14531: need to take some extra steps to get them registered in
14532: the GTK2 database properly:</p>
14533:
14534: <div class="orderedlist">
14535: <ol type="1">
14536: <li>
1.45 wiz 14537: <p>Include <code xmlns=
14538: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14539: "filename">../../x11/gtk2/modules.mk</code>
1.45 wiz 14540: instead of its <code xmlns=
14541: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14542: "filename">buildlink3.mk</code> file. This takes
14543: care of rebuilding the database at installation
14544: and deinstallation time.</p>
1.1 grant 14545: </li>
14546:
14547: <li>
1.14 xtraeme 14548: <p>Set <code class=
14549: "varname">GTK2_IMMODULES=YES</code> if your
14550: package installs GTK2 immodules.</p>
1.1 grant 14551: </li>
14552:
14553: <li>
1.14 xtraeme 14554: <p>Set <code class=
14555: "varname">GTK2_LOADERS=YES</code> if your package
14556: installs GTK2 loaders.</p>
1.1 grant 14557: </li>
14558:
14559: <li>
1.47 reed 14560: <p>Patch the package to not touch any of the GTK2
1.1 grant 14561: databases directly. These are:</p>
14562:
14563: <div class="itemizedlist">
14564: <ul type="disc">
14565: <li>
1.45 wiz 14566: <p><code xmlns=
14567: "http://www.w3.org/TR/xhtml1/transitional"
14568: class=
1.14 xtraeme 14569: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 14570: </li>
14571:
14572: <li>
1.45 wiz 14573: <p><code xmlns=
14574: "http://www.w3.org/TR/xhtml1/transitional"
14575: class=
1.14 xtraeme 14576: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 14577: </li>
14578: </ul>
14579: </div>
14580: </li>
14581:
14582: <li>
14583: <p>Check the PLIST and remove any entries under
1.45 wiz 14584: the <code xmlns=
14585: "http://www.w3.org/TR/xhtml1/transitional" class=
14586: "filename">libdata/gtk-2.0</code> directory, as
14587: they will be handled automatically.</p>
1.1 grant 14588: </li>
14589: </ol>
14590: </div>
14591: </div>
14592:
1.67 hubertf 14593: <div class="sect2" lang="en">
1.1 grant 14594: <div class="titlepage">
14595: <div>
14596: <div>
1.67 hubertf 14597: <h3 class="title"><a name=
1.68 rillig 14598: "sgml-xml-data"></a>16.5.13. Packages
1.30 wiz 14599: installing SGML or XML data</h3>
1.1 grant 14600: </div>
14601: </div>
14602: </div>
14603:
14604: <p>If a package installs SGML or XML data files that
14605: need to be registered in system-wide catalogs (like
14606: DTDs, sub-catalogs, etc.), you need to take some extra
14607: steps:</p>
14608:
14609: <div class="orderedlist">
14610: <ol type="1">
14611: <li>
1.45 wiz 14612: <p>Include <code xmlns=
14613: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14614: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45 wiz 14615: in your <code xmlns=
14616: "http://www.w3.org/TR/xhtml1/transitional" class=
14617: "filename">Makefile</code>, which takes care of
14618: registering those files in system-wide catalogs
14619: at installation and deinstallation time.</p>
1.1 grant 14620: </li>
14621:
14622: <li>
1.14 xtraeme 14623: <p>Set <code class="varname">SGML_CATALOGS</code>
14624: to the full path of any SGML catalogs installed
14625: by the package.</p>
1.1 grant 14626: </li>
14627:
14628: <li>
1.14 xtraeme 14629: <p>Set <code class="varname">XML_CATALOGS</code>
14630: to the full path of any XML catalogs installed by
1.1 grant 14631: the package.</p>
14632: </li>
14633:
14634: <li>
1.14 xtraeme 14635: <p>Set <code class="varname">SGML_ENTRIES</code>
14636: to individual entries to be added to the SGML
1.1 grant 14637: catalog. These come in groups of three strings;
14638: see xmlcatmgr(1) for more information
14639: (specifically, arguments recognized by the 'add'
14640: action). Note that you will normally not use this
14641: variable.</p>
14642: </li>
14643:
14644: <li>
1.14 xtraeme 14645: <p>Set <code class="varname">XML_ENTRIES</code>
14646: to individual entries to be added to the XML
1.1 grant 14647: catalog. These come in groups of three strings;
14648: see xmlcatmgr(1) for more information
14649: (specifically, arguments recognized by the 'add'
14650: action). Note that you will normally not use this
14651: variable.</p>
14652: </li>
14653: </ol>
14654: </div>
14655: </div>
14656:
1.67 hubertf 14657: <div class="sect2" lang="en">
1.1 grant 14658: <div class="titlepage">
14659: <div>
14660: <div>
1.67 hubertf 14661: <h3 class="title"><a name=
1.68 rillig 14662: "mime-database"></a>16.5.14. Packages
1.30 wiz 14663: installing extensions to the MIME database</h3>
1.1 grant 14664: </div>
14665: </div>
14666: </div>
14667:
14668: <p>If a package provides extensions to the MIME
1.45 wiz 14669: database by installing <code xmlns=
14670: "http://www.w3.org/TR/xhtml1/transitional" class=
14671: "filename">.xml</code> files inside <code xmlns=
14672: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14673: "filename">${PREFIX}/share/mime/packages</code>, you
14674: need to take some extra steps to ensure that the
14675: database is kept consistent with respect to these new
14676: files:</p>
1.1 grant 14677:
14678: <div class="orderedlist">
14679: <ol type="1">
14680: <li>
1.45 wiz 14681: <p>Include <code xmlns=
14682: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14683: "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45 wiz 14684: (avoid using the <code xmlns=
14685: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14686: "filename">buildlink3.mk</code> file from this
14687: same directory, which is reserved for inclusion
1.45 wiz 14688: from other <code xmlns=
14689: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14690: "filename">buildlink3.mk</code> files). It takes
14691: care of rebuilding the MIME database at
14692: installation and deinstallation time, and
14693: disallows any access to it directly from the
1.1 grant 14694: package.</p>
14695: </li>
14696:
14697: <li>
14698: <p>Check the PLIST and remove any entries under
1.45 wiz 14699: the <code xmlns=
14700: "http://www.w3.org/TR/xhtml1/transitional" class=
14701: "filename">share/mime</code> directory,
14702: <span class="emphasis"><em>except</em></span> for
14703: files saved under <code xmlns=
14704: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14705: "filename">share/mime/packages</code>. The former
1.1 grant 14706: are handled automatically by the
1.47 reed 14707: update-mime-database program, but the latter are
1.1 grant 14708: package-dependent and must be removed by the
14709: package that installed them in the first
14710: place.</p>
14711: </li>
14712:
14713: <li>
1.45 wiz 14714: <p>Remove any <code xmlns=
14715: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14716: "filename">share/mime/*</code> directories from
14717: the PLIST. They will be handled by the
1.1 grant 14718: shared-mime-info package.</p>
14719: </li>
14720: </ol>
14721: </div>
14722: </div>
14723:
1.67 hubertf 14724: <div class="sect2" lang="en">
1.1 grant 14725: <div class="titlepage">
14726: <div>
14727: <div>
1.67 hubertf 14728: <h3 class="title"><a name=
1.68 rillig 14729: "intltool"></a>16.5.15. Packages using
1.1 grant 14730: intltool</h3>
14731: </div>
14732: </div>
14733: </div>
14734:
14735: <p>If a package uses intltool during its build, include
1.45 wiz 14736: the <code xmlns=
14737: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14738: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 14739: file, which forces it to use the intltool package
14740: provided by pkgsrc, instead of the one bundled with the
14741: distribution file.</p>
14742:
14743: <p>This tracks intltool's build-time dependencies and
14744: uses the latest available version; this way, the
14745: package benefits of any bug fixes that may have
14746: appeared since it was released.</p>
14747: </div>
1.18 xtraeme 14748:
1.67 hubertf 14749: <div class="sect2" lang="en">
1.18 xtraeme 14750: <div class="titlepage">
14751: <div>
14752: <div>
1.67 hubertf 14753: <h3 class="title"><a name=
1.68 rillig 14754: "startup-scripts"></a>16.5.16. Packages
1.30 wiz 14755: installing startup scripts</h3>
1.18 xtraeme 14756: </div>
14757: </div>
14758: </div>
14759:
14760: <p>If a package contains a rc.d script, it won't be
14761: copied into the startup directory by default, but you
14762: can enable it, by adding the option <code class=
1.45 wiz 14763: "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
14764: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 14765: "filename">/etc/mk.conf</code>. This option will copy
1.45 wiz 14766: the scripts into <code xmlns=
14767: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 14768: "filename">/etc/rc.d</code> when a package is
14769: installed, and it will automatically remove the scripts
14770: when the package is deinstalled.</p>
14771: </div>
1.57 minskim 14772:
1.67 hubertf 14773: <div class="sect2" lang="en">
1.57 minskim 14774: <div class="titlepage">
14775: <div>
14776: <div>
1.67 hubertf 14777: <h3 class="title"><a name=
1.68 rillig 14778: "tex-packages"></a>16.5.17. Packages
1.57 minskim 14779: installing TeX modules</h3>
14780: </div>
14781: </div>
14782: </div>
14783:
14784: <p>If a package installs TeX packages into the texmf
14785: tree, the <code xmlns=
14786: "http://www.w3.org/TR/xhtml1/transitional" class=
14787: "filename">ls-R</code> database of the tree needs to be
14788: updated.</p>
14789:
14790: <div class="note" style=
14791: "margin-left: 0.5in; margin-right: 0.5in;">
14792: <h3 class="title">Note</h3>
14793:
14794: <p>Except the main TeX packages such as teTeX-texmf,
14795: packages should install files into <code class=
14796: "varname">PKG_LOCALTEXMFPREFIX</code>, not
14797: <code class="varname">PKG_TEXMFPREFIX</code>.</p>
14798: </div>
14799:
14800: <div class="orderedlist">
14801: <ol type="1">
14802: <li>
14803: <p>Include <code xmlns=
14804: "http://www.w3.org/TR/xhtml1/transitional" class=
14805: "filename">../../print/teTeX/module.mk</code>
14806: instead of <code xmlns=
14807: "http://www.w3.org/TR/xhtml1/transitional" class=
14808: "filename">../../mk/tex.buildlink3.mk</code>.
14809: This takes care of rebuilding the <code xmlns=
14810: "http://www.w3.org/TR/xhtml1/transitional" class=
14811: "filename">ls-R</code> database at installation
14812: and deinstallation time.</p>
14813: </li>
14814:
14815: <li>
14816: <p>If your package installs files into a texmf
14817: tree other than the one at <code class=
14818: "varname">PKG_LOCALTEXMFPREFIX</code>, set
14819: <code class="varname">TEXMFDIRS</code> to the
14820: list of all texmf trees that need database
14821: update.</p>
1.64 kim 14822:
14823: <p>If your package also installs font map files
14824: that need to be registered using
14825: <span><strong class=
14826: "command">updmap</strong></span>, set
14827: <code class="varname">TEX_FONTMAPS</code> to the
14828: list of all such font map files. Then
14829: <span><strong class=
14830: "command">updmap</strong></span> will be run
14831: automatically at installation/deinstallation to
14832: enable/disable font map files for TeX output
14833: drivers.</p>
1.57 minskim 14834: </li>
14835:
14836: <li>
14837: <p>Make sure that none of <code xmlns=
14838: "http://www.w3.org/TR/xhtml1/transitional" class=
14839: "filename">ls-R</code> databases are included in
14840: <code xmlns=
14841: "http://www.w3.org/TR/xhtml1/transitional" class=
14842: "filename">PLIST</code>, as they will be removed
14843: only by the teTeX-bin package.</p>
14844: </li>
14845: </ol>
14846: </div>
14847: </div>
1.1 grant 14848: </div>
14849:
1.67 hubertf 14850: <div class="sect1" lang="en">
1.1 grant 14851: <div class="titlepage">
14852: <div>
14853: <div>
14854: <h2 class="title" style="clear: both"><a name=
1.68 rillig 14855: "feedback-to-author"></a>16.6. Feedback to the
1.30 wiz 14856: author</h2>
1.1 grant 14857: </div>
14858: </div>
14859: </div>
14860:
14861: <p>If you have found any bugs in the package you make
14862: available, if you had to do special steps to make it run
14863: under NetBSD or if you enhanced the software in various
14864: other ways, be sure to report these changes back to the
14865: original author of the program! With that kind of
14866: support, the next release of the program can incorporate
14867: these fixes, and people not using the NetBSD packages
14868: system can win from your efforts.</p>
14869:
14870: <p>Support the idea of free software!</p>
14871: </div>
14872: </div>
14873:
1.67 hubertf 14874: <div class="chapter" lang="en">
1.1 grant 14875: <div class="titlepage">
14876: <div>
14877: <div>
1.67 hubertf 14878: <h2 class="title"><a name=
1.68 rillig 14879: "debug"></a>Chapter 17. Debugging</h2>
1.1 grant 14880: </div>
14881: </div>
14882: </div>
14883:
14884: <p>To check out all the gotchas when building a package,
14885: here are the steps that I do in order to get a package
14886: working. Please note this is basically the same as what was
14887: explained in the previous sections, only with some
14888: debugging aids.</p>
14889:
14890: <div class="itemizedlist">
14891: <ul type="disc">
14892: <li>
1.14 xtraeme 14893: <p>Be sure to set <code class=
1.45 wiz 14894: "varname">PKG_DEVELOPER=1</code> in <code xmlns=
14895: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14896: "filename">/etc/mk.conf</code></p>
1.1 grant 14897: </li>
14898:
14899: <li>
14900: <p>Install <a xmlns=
14901: "http://www.w3.org/TR/xhtml1/transitional" href=
14902: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 14903: target="_top"><code xmlns="" class=
14904: "filename">pkgtools/url2pkg</code></a>, create a
1.20 ben 14905: directory for a new package, change into it, then run
14906: <span><strong class=
14907: "command">url2pkg</strong></span>:</p>
1.1 grant 14908: <pre class="screen">
1.14 xtraeme 14909: <code class="prompt">%</code> <strong class=
14910: "userinput"><code>mkdir /usr/pkgsrc/<em class=
14911: "replaceable"><code>category</code></em>/<em class=
14912: "replaceable"><code>examplepkg</code></em></code></strong>
14913: <code class="prompt">%</code> <strong class=
14914: "userinput"><code>cd /usr/pkgsrc/<em class=
14915: "replaceable"><code>category</code></em>/<em class=
14916: "replaceable"><code>examplepkg</code></em></code></strong>
14917: <code class="prompt">%</code> <strong class=
14918: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 14919: </pre>
14920: </li>
14921:
14922: <li>
1.45 wiz 14923: <p>Edit the <code xmlns=
14924: "http://www.w3.org/TR/xhtml1/transitional" class=
14925: "filename">Makefile</code> as requested.</p>
1.1 grant 14926: </li>
14927:
14928: <li>
1.45 wiz 14929: <p>Fill in the <code xmlns=
14930: "http://www.w3.org/TR/xhtml1/transitional" class=
14931: "filename">DESCR</code> file</p>
1.1 grant 14932: </li>
14933:
14934: <li>
1.14 xtraeme 14935: <p>Run <span><strong class="command">make
14936: configure</strong></span></p>
1.1 grant 14937: </li>
14938:
14939: <li>
14940: <p>Add any dependencies glimpsed from documentation
1.45 wiz 14941: and the configure step to the package's <code xmlns=
14942: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14943: "filename">Makefile</code>.</p>
1.1 grant 14944: </li>
14945:
14946: <li>
14947: <p>Make the package compile, doing multiple rounds
14948: of</p>
14949: <pre class="screen">
1.14 xtraeme 14950: <code class="prompt">%</code> <strong class=
14951: "userinput"><code>make</code></strong>
14952: <code class="prompt">%</code> <strong class=
14953: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
14954: <code class="prompt">%</code> <strong class=
14955: "userinput"><code>mkpatches</code></strong>
14956: <code class="prompt">%</code> <strong class=
14957: "userinput"><code>patchdiff</code></strong>
14958: <code class="prompt">%</code> <strong class=
14959: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
14960: <code class="prompt">%</code> <strong class=
14961: "userinput"><code>make mps</code></strong>
14962: <code class="prompt">%</code> <strong class=
14963: "userinput"><code>make clean</code></strong>
1.1 grant 14964: </pre>
14965:
14966: <p>Doing as non-root user will ensure that no files
14967: are modified that shouldn't be, especially during the
1.14 xtraeme 14968: build phase. <span><strong class=
14969: "command">mkpatches</strong></span>,
14970: <span><strong class=
14971: "command">patchdiff</strong></span> and
14972: <span><strong class="command">pkgvi</strong></span>
14973: are from the <a xmlns=
1.1 grant 14974: "http://www.w3.org/TR/xhtml1/transitional" href=
14975: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 14976: target="_top"><code xmlns="" class=
14977: "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1 grant 14978: </li>
14979:
14980: <li>
1.45 wiz 14981: <p>Look at the <code xmlns=
14982: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14983: "filename">Makefile</code>, fix if necessary; see
14984: <a href="#components.Makefile" title=
1.38 dillo 14985: "8.1. Makefile">Section 8.1,
1.45 wiz 14986: “<code xmlns=
14987: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14988: "filename">Makefile</code>”</a>.</p>
1.1 grant 14989: </li>
14990:
14991: <li>
1.45 wiz 14992: <p>Generate a <code xmlns=
14993: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14994: "filename">PLIST</code>:</p>
1.1 grant 14995: <pre class="screen">
1.14 xtraeme 14996: <code class="prompt">#</code> <strong class=
14997: "userinput"><code>make install</code></strong>
14998: <code class="prompt">#</code> <strong class=
14999: "userinput"><code>make print-PLIST >PLIST</code></strong>
15000: <code class="prompt">#</code> <strong class=
15001: "userinput"><code>make deinstall</code></strong>
15002: <code class="prompt">#</code> <strong class=
15003: "userinput"><code>make install</code></strong>
15004: <code class="prompt">#</code> <strong class=
15005: "userinput"><code>make deinstall</code></strong>
1.1 grant 15006: </pre>
15007:
1.45 wiz 15008: <p>You usually need to be <code xmlns=
15009: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15010: "username">root</code> to do this. Look if there are
1.1 grant 15011: any files left:</p>
15012: <pre class="screen">
1.14 xtraeme 15013: <code class="prompt">#</code> <strong class=
15014: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 15015: </pre>
15016:
15017: <p>If this reveals any files that are missing in
1.45 wiz 15018: <code xmlns=
15019: "http://www.w3.org/TR/xhtml1/transitional" class=
15020: "filename">PLIST</code>, add them.</p>
1.1 grant 15021: </li>
15022:
15023: <li>
1.45 wiz 15024: <p>Now that the <code xmlns=
15025: "http://www.w3.org/TR/xhtml1/transitional" class=
15026: "filename">PLIST</code> is OK, install the package
15027: again and make a binary package:</p>
1.1 grant 15028: <pre class="screen">
1.14 xtraeme 15029: <code class="prompt">#</code> <strong class=
15030: "userinput"><code>make reinstall</code></strong>
15031: <code class="prompt">#</code> <strong class=
15032: "userinput"><code>make package</code></strong>
1.1 grant 15033: </pre>
15034: </li>
15035:
15036: <li>
15037: <p>Delete the installed package:</p>
15038: <pre class="screen">
1.14 xtraeme 15039: <code class="prompt">#</code> <strong class=
15040: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 15041: </pre>
15042: </li>
15043:
15044: <li>
1.14 xtraeme 15045: <p>Repeat the above <span><strong class=
15046: "command">make print-PLIST</strong></span> command,
15047: which shouldn't find anything now:</p>
1.1 grant 15048: <pre class="screen">
1.14 xtraeme 15049: <code class="prompt">#</code> <strong class=
15050: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 15051: </pre>
15052: </li>
15053:
15054: <li>
15055: <p>Reinstall the binary package:</p>
15056: <pre class="screen">
1.14 xtraeme 15057: <code class="prompt">#</code> <strong class=
15058: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 15059: </pre>
15060: </li>
15061:
15062: <li>
15063: <p>Play with it. Make sure everything works.</p>
15064: </li>
15065:
15066: <li>
1.14 xtraeme 15067: <p>Run <span><strong class=
15068: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 15069: "http://www.w3.org/TR/xhtml1/transitional" href=
15070: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 15071: target="_top"><code xmlns="" class=
15072: "filename">pkgtools/pkglint</code></a>, and fix the
1.20 ben 15073: problems it reports:</p>
1.1 grant 15074: <pre class="screen">
1.14 xtraeme 15075: <code class="prompt">#</code> <strong class=
15076: "userinput"><code>pkglint</code></strong>
1.1 grant 15077: </pre>
15078: </li>
15079:
15080: <li>
15081: <p>Submit (or commit, if you have cvs access); see
15082: <a href="#submit" title=
1.68 rillig 15083: "Chapter 18. Submitting and Committing">Chapter 18,
1.1 grant 15084: <i>Submitting and Committing</i></a>.</p>
15085: </li>
15086: </ul>
15087: </div>
15088: </div>
15089:
1.67 hubertf 15090: <div class="chapter" lang="en">
1.1 grant 15091: <div class="titlepage">
15092: <div>
15093: <div>
1.67 hubertf 15094: <h2 class="title"><a name=
1.68 rillig 15095: "submit"></a>Chapter 18. Submitting and
1.1 grant 15096: Committing</h2>
15097: </div>
15098: </div>
15099: </div>
15100:
15101: <div class="toc">
15102: <p><b>Table of Contents</b></p>
15103:
15104: <dl>
1.30 wiz 15105: <dt><span class="sect1"><a href=
1.68 rillig 15106: "#submitting-your-package">18.1. Submitting your
1.30 wiz 15107: packages</a></span></dt>
1.1 grant 15108:
1.30 wiz 15109: <dt><span class="sect1"><a href=
1.68 rillig 15110: "#general-notes-for-changes">18.2. General notes when
1.41 wiz 15111: adding, updating, or removing packages</a></span></dt>
15112:
15113: <dt><span class="sect1"><a href=
1.68 rillig 15114: "#committing-importing">18.3. Committing: Importing a
1.30 wiz 15115: package into CVS</a></span></dt>
1.1 grant 15116:
1.30 wiz 15117: <dt><span class="sect1"><a href=
1.68 rillig 15118: "#updating-package">18.4. Updating a package to a newer
1.30 wiz 15119: version</a></span></dt>
1.1 grant 15120:
1.68 rillig 15121: <dt><span class="sect1"><a href="#moving-package">18.5.
1.2 hubertf 15122: Moving a package in pkgsrc</a></span></dt>
1.1 grant 15123: </dl>
15124: </div>
15125:
1.67 hubertf 15126: <div class="sect1" lang="en">
1.1 grant 15127: <div class="titlepage">
15128: <div>
15129: <div>
15130: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15131: "submitting-your-package"></a>18.1. Submitting
1.30 wiz 15132: your packages</h2>
1.1 grant 15133: </div>
15134: </div>
15135: </div>
15136:
15137: <p>You have to separate between binary and
15138: “<span class="quote">normal</span>” (source)
15139: packages here:</p>
15140:
15141: <div class="itemizedlist">
15142: <ul type="disc">
15143: <li>
15144: <p>precompiled binary packages</p>
15145:
15146: <p>Our policy is that we accept binaries only from
15147: pkgsrc developers to guarantee that the packages
15148: don't contain any trojan horses etc. This is not to
1.13 hubertf 15149: annoy anyone but rather to protect our users!
1.1 grant 15150: You're still free to put up your home-made binary
1.13 hubertf 15151: packages and tell the world where to get them.
15152: NetBSD developers doing bulk builds and wanting to
15153: upload them please see <a href="#bulk-upload"
1.38 dillo 15154: title="6.3.8. Uploading results of a bulk build">
15155: Section 6.3.8, “Uploading results of a
1.13 hubertf 15156: bulk build”</a>.</p>
1.1 grant 15157: </li>
15158:
15159: <li>
15160: <p>packages</p>
15161:
15162: <p>First, check that your package is complete,
15163: compiles and runs well; see <a href="#debug" title=
1.68 rillig 15164: "Chapter 17. Debugging">Chapter 17,
1.1 grant 15165: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 15166: Next, generate an uuencoded gzipped <a href=
15167: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
15168: <span class="citerefentry"><span class=
15169: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 15170: preferably with all files in a single directory.
1.14 xtraeme 15171: Finally, <span><strong class=
15172: "command">send-pr</strong></span> with category
1.1 grant 15173: “<span class="quote">pkg</span>”, a
15174: synopsis which includes the package name and
15175: version number, a short description of your package
15176: (contents of the COMMENT variable or DESCR file are
15177: OK) and attach the archive to your PR.</p>
15178:
15179: <p>If you want to submit several packages, please
15180: send a separate PR for each one, it's easier for us
15181: to track things that way.</p>
15182:
15183: <p>Alternatively, you can also import new packages
15184: into pkgsrc-wip (“<span class="quote">pkgsrc
15185: work-in-progress</span>”); see the homepage
15186: at <a href="http://pkgsrc-wip.sourceforge.net/"
15187: target=
15188: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
15189: details.</p>
15190: </li>
15191: </ul>
15192: </div>
15193: </div>
15194:
1.67 hubertf 15195: <div class="sect1" lang="en">
1.1 grant 15196: <div class="titlepage">
15197: <div>
15198: <div>
15199: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15200: "general-notes-for-changes"></a>18.2. General
1.41 wiz 15201: notes when adding, updating, or removing
15202: packages</h2>
15203: </div>
15204: </div>
15205: </div>
15206:
15207: <p>Please note all package additions, updates, moves, and
1.45 wiz 15208: removals in <code xmlns=
15209: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15210: "filename">pkgsrc/doc/CHANGES</code>. It's very important
15211: to keep this file up to date and conforming to the
15212: existing format, because it will be used by scripts to
15213: automatically update pages on <a href=
15214: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45 wiz 15215: and other sites. Additionally, check the <code xmlns=
15216: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15217: "filename">pkgsrc/doc/TODO</code> file and remove the
15218: entry for the package you updated or removed, in case it
15219: was mentioned there.</p>
15220:
1.71 wiz 15221: <p>When the <code class="varname">PKGREVISION</code> of a
15222: package is bumped, the change should appear in
15223: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
15224: class="filename">pkgsrc/doc/CHANGES</code> if it is
15225: security related or otherwise relevant. Mass bumps that
15226: result from a dependency being updated should not be
15227: mentioned. In all other cases it's the developer's
15228: decision.</p>
15229:
1.41 wiz 15230: <p>There is a make target that helps in creating proper
1.45 wiz 15231: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
15232: class="filename">CHANGES</code> entries:
1.41 wiz 15233: <span><strong class="command">make
15234: changes-entry</strong></span>. It uses the optional
15235: <code class="varname">CTYPE</code> and <code class=
15236: "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45 wiz 15237: usage is to first make sure that your <code xmlns=
15238: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15239: "filename">CHANGES</code> file is up-to-date (to avoid
15240: having to resolve conflicts later-on) and then to
15241: <span><strong class="command">cd</strong></span> to the
15242: package directory. For package updates,
15243: <span><strong class="command">make
15244: changes-entry</strong></span> is enough. For new
15245: packages, or package moves or removals, set the
15246: <code class="varname">CTYPE</code> variable on the
15247: command line to "Added", "Moved", or "Removed". You can
15248: set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45 wiz 15249: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
15250: class="filename">/etc/mk.conf</code> if your local login
15251: name is not the same as your NetBSD login name. Don't
15252: forget to commit the changes to <code xmlns=
15253: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15254: "filename">pkgsrc/doc/CHANGES</code>!</p>
15255: </div>
15256:
1.67 hubertf 15257: <div class="sect1" lang="en">
1.41 wiz 15258: <div class="titlepage">
15259: <div>
15260: <div>
15261: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15262: "committing-importing"></a>18.3. Committing:
1.30 wiz 15263: Importing a package into CVS</h2>
1.1 grant 15264: </div>
15265: </div>
15266: </div>
15267:
15268: <p>This section is only of interest for pkgsrc developers
15269: with write access to the pkgsrc repository. Please
15270: remember that cvs imports files relative to the current
15271: working directory, and that the pathname that you give
1.14 xtraeme 15272: the <span><strong class="command">cvs
15273: import</strong></span> command is so that it knows where
15274: to place the files in the repository. Newly created
15275: packages should be imported with a vendor tag of
15276: “<span class="quote">TNF</span>” and a
15277: release tag of “<span class=
15278: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 15279: <pre class="programlisting">
1.51 rillig 15280: <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
15281: <code class=
15282: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1 grant 15283: </pre>
15284:
15285: <p>Remember to move the directory from which you imported
15286: out of the way, or cvs will complain the next time you
15287: “<span class="quote">cvs update</span>” your
15288: source tree. Also don't forget to add the new package to
1.45 wiz 15289: the category's <code xmlns=
15290: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15291: "filename">Makefile</code>.</p>
1.1 grant 15292:
15293: <p>The commit message of the initial import should
1.45 wiz 15294: include part of the <code xmlns=
15295: "http://www.w3.org/TR/xhtml1/transitional" class=
15296: "filename">DESCR</code> file, so people reading the
15297: mailing lists know what the package is/does.</p>
1.1 grant 15298:
15299: <p>For new packages, “<span class="quote">cvs
15300: import</span>” is preferred to “<span class=
15301: "quote">cvs add</span>” because the former gets
15302: everything with a single command, and provides a
15303: consistent tag.</p>
15304: </div>
15305:
1.67 hubertf 15306: <div class="sect1" lang="en">
1.1 grant 15307: <div class="titlepage">
15308: <div>
15309: <div>
15310: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15311: "updating-package"></a>18.4. Updating a
1.30 wiz 15312: package to a newer version</h2>
1.1 grant 15313: </div>
15314: </div>
15315: </div>
15316:
15317: <p>Please always put a concise, appropriate and relevant
15318: summary of the changes between old and new versions into
15319: the commit log when updating a package. There are various
15320: reasons for this:</p>
15321:
15322: <div class="itemizedlist">
15323: <ul type="disc">
15324: <li>
15325: <p>A URL is volatile, and can change over time. It
15326: may go away completely or its information may be
15327: overwritten by newer information.</p>
15328: </li>
15329:
15330: <li>
15331: <p>Having the change information between old and
15332: new versions in our CVS repository is very useful
15333: for people who use either cvs or anoncvs.</p>
15334: </li>
15335:
15336: <li>
15337: <p>Having the change information between old and
15338: new versions in our CVS repository is very useful
15339: for people who read the pkgsrc-changes mailing
15340: list, so that they can make tactical decisions
15341: about when to upgrade the package.</p>
15342: </li>
15343: </ul>
15344: </div>
15345:
1.18 xtraeme 15346: <p>Please also recognize that, just because a new version
1.1 grant 15347: of a package has been released, it should not
15348: automatically be upgraded in the CVS repository. We
15349: prefer to be conservative in the packages that are
15350: included in pkgsrc - development or beta packages are not
15351: really the best thing for most places in which pkgsrc is
15352: used. Please use your judgement about what should go into
15353: pkgsrc, and bear in mind that stability is to be
15354: preferred above new and possibly untested features.</p>
15355: </div>
15356:
1.67 hubertf 15357: <div class="sect1" lang="en">
1.1 grant 15358: <div class="titlepage">
15359: <div>
15360: <div>
15361: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15362: "moving-package"></a>18.5. Moving a package in
1.30 wiz 15363: pkgsrc</h2>
1.1 grant 15364: </div>
15365: </div>
15366: </div>
15367:
15368: <div class="orderedlist">
15369: <ol type="1">
15370: <li>
15371: <p>Make a copy of the directory somewhere else.</p>
15372: </li>
15373:
15374: <li>
15375: <p>Remove all CVS dirs.</p>
15376:
15377: <p>Alternatively to the first two steps you can
15378: also do:</p>
15379: <pre class="screen">
1.14 xtraeme 15380: <code class="prompt">%</code> <strong class=
15381: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 15382: </pre>
15383:
15384: <p>and use that for further work.</p>
15385: </li>
15386:
15387: <li>
1.14 xtraeme 15388: <p>Fix <code class="varname">CATEGORIES</code> and
15389: any <code class="varname">DEPENDS</code> paths that
15390: just did “<span class=
1.1 grant 15391: "quote">../package</span>” instead of
15392: “<span class=
15393: "quote">../../category/package</span>”.</p>
15394: </li>
15395:
15396: <li>
1.14 xtraeme 15397: <p><span><strong class="command">cvs
15398: import</strong></span> the modified package in the
15399: new place.</p>
1.1 grant 15400: </li>
15401:
15402: <li>
15403: <p>Check if any package depends on it:</p>
15404: <pre class="screen">
1.14 xtraeme 15405: <code class="prompt">%</code> <strong class=
15406: "userinput"><code>cd /usr/pkgsrc</code></strong>
15407: <code class="prompt">%</code> <strong class=
15408: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 15409: </pre>
15410: </li>
15411:
15412: <li>
15413: <p>Fix paths in packages from step 5 to point to
15414: new location.</p>
15415: </li>
15416:
15417: <li>
1.14 xtraeme 15418: <p><span><strong class="command">cvs rm
15419: (-f)</strong></span> the package at the old
15420: location.</p>
1.1 grant 15421: </li>
15422:
15423: <li>
1.45 wiz 15424: <p>Remove from <code xmlns=
15425: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15426: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 15427: </li>
15428:
15429: <li>
1.45 wiz 15430: <p>Add to <code xmlns=
15431: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15432: "filename">newcategory/Makefile</code>.</p>
1.1 grant 15433: </li>
15434:
15435: <li>
15436: <p>Commit the changed and removed files:</p>
15437: <pre class="screen">
1.14 xtraeme 15438: <code class="prompt">%</code> <strong class=
15439: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 15440: </pre>
15441:
15442: <p>(and any packages from step 5, of course).</p>
15443: </li>
15444: </ol>
15445: </div>
15446: </div>
15447: </div>
1.69 rillig 15448:
15449: <div class="chapter" lang="en">
15450: <div class="titlepage">
15451: <div>
15452: <div>
15453: <h2 class="title"><a name=
1.72 ! rillig 15454: "devfaq"></a>Chapter 19. Frequently Asked
! 15455: Questions</h2>
! 15456: </div>
! 15457: </div>
! 15458: </div>
! 15459:
! 15460: <p>This section contains the answers to questions that may
! 15461: arise when you are writing a package. If you don't find
! 15462: your question answered here, first have a look in the other
! 15463: chapters, and if you still don't have the answer, ask on
! 15464: the <code class="literal">pkgsrc-users</code> mailing
! 15465: list.</p>
! 15466:
! 15467: <div class="qandaset">
! 15468: <dl>
! 15469: <dt>19.1. <a href="#id2654337">What is the difference
! 15470: between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?</a></dt>
! 15471:
! 15472: <dt>19.2. <a href="#id2654373">What is the difference
! 15473: between MAKE, GMAKE and MAKE_PROGRAM?</a></dt>
! 15474:
! 15475: <dt>19.3. <a href="#id2654411">What is the difference
! 15476: between CC, PKG_CC and PKGSRC_COMPILER?</a></dt>
! 15477:
! 15478: <dt>19.4. <a href="#id2654449">What is the difference
! 15479: between BUILDLINK_LDFLAGS, BUILDLINK_LDADD and
! 15480: BUILDLINK_LIBS?</a></dt>
! 15481:
! 15482: <dt>19.5. <a href="#id2654467">Why does make show-var
! 15483: VARNAME=BUILDLINK_PREFIX.foo say it's empty?</a></dt>
! 15484: </dl>
! 15485:
! 15486: <table border="0" summary="Q and A Set">
! 15487: <col align="left" width="1%" />
! 15488:
! 15489: <tbody>
! 15490: <tr class="question">
! 15491: <td align="left" valign="top"><a name=
! 15492: "id2654337"></a><a name=
! 15493: "id2654338"></a><b>19.1.</b></td>
! 15494:
! 15495: <td align="left" valign="top">
! 15496: <p>What is the difference between <code class=
! 15497: "varname">MAKEFLAGS</code>, <code class=
! 15498: "varname">.MAKEFLAGS</code> and <code class=
! 15499: "varname">MAKE_FLAGS</code>?</p>
! 15500: </td>
! 15501: </tr>
! 15502:
! 15503: <tr class="answer">
! 15504: <td align="left" valign="top"></td>
! 15505:
! 15506: <td align="left" valign="top">
! 15507: <p><code class="varname">MAKEFLAGS</code> are the
! 15508: flags passed to the pkgsrc-internal invocations
! 15509: of <a href=
! 15510: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
! 15511: <span class="citerefentry"><span class=
! 15512: "refentrytitle">make</span>(1)</span></a>, while
! 15513: <code class="varname">MAKE_FLAGS</code> are the
! 15514: flags that are passed to the <code class=
! 15515: "varname">MAKE_PROGRAM</code> when building the
! 15516: package. [FIXME: What is .MAKEFLAGS for?]</p>
! 15517: </td>
! 15518: </tr>
! 15519:
! 15520: <tr class="question">
! 15521: <td align="left" valign="top"><a name=
! 15522: "id2654373"></a><a name=
! 15523: "id2654374"></a><b>19.2.</b></td>
! 15524:
! 15525: <td align="left" valign="top">
! 15526: <p>What is the difference between <code class=
! 15527: "varname">MAKE</code>, <code class=
! 15528: "varname">GMAKE</code> and <code class=
! 15529: "varname">MAKE_PROGRAM</code>?</p>
! 15530: </td>
! 15531: </tr>
! 15532:
! 15533: <tr class="answer">
! 15534: <td align="left" valign="top"></td>
! 15535:
! 15536: <td align="left" valign="top">
! 15537: <p><code class="varname">MAKE</code> is the path
! 15538: to the <a href=
! 15539: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
! 15540: <span class="citerefentry"><span class=
! 15541: "refentrytitle">make</span>(1)</span></a> program
! 15542: that is used in the pkgsrc infrastructure.
! 15543: <code class="varname">GMAKE</code> is the path to
! 15544: GNU Make, but you need to say <code class=
! 15545: "varname">USE_TOOLS+=gmake</code> to use that.
! 15546: <code class="varname">MAKE_PROGRAM</code> is the
! 15547: path to the Make program that is used for
! 15548: building the package.</p>
! 15549: </td>
! 15550: </tr>
! 15551:
! 15552: <tr class="question">
! 15553: <td align="left" valign="top"><a name=
! 15554: "id2654411"></a><a name=
! 15555: "id2654412"></a><b>19.3.</b></td>
! 15556:
! 15557: <td align="left" valign="top">
! 15558: <p>What is the difference between <code class=
! 15559: "varname">CC</code>, <code class=
! 15560: "varname">PKG_CC</code> and <code class=
! 15561: "varname">PKGSRC_COMPILER</code>?</p>
! 15562: </td>
! 15563: </tr>
! 15564:
! 15565: <tr class="answer">
! 15566: <td align="left" valign="top"></td>
! 15567:
! 15568: <td align="left" valign="top">
! 15569: <p><code class="varname">CC</code> is the path to
! 15570: the real C compiler, which can be configured by
! 15571: the pkgsrc user. <code class=
! 15572: "varname">PKG_CC</code> is the path to the
! 15573: compiler wrapper. <code class=
! 15574: "varname">PKGSRC_COMPILER</code> is <span class=
! 15575: "emphasis"><em>not</em></span> a path to a
! 15576: compiler, but the type of compiler that should be
! 15577: used. See <code xmlns=
! 15578: "http://www.w3.org/TR/xhtml1/transitional" class=
! 15579: "filename">mk/compiler.mk</code> for more
! 15580: information about the latter variable.</p>
! 15581: </td>
! 15582: </tr>
! 15583:
! 15584: <tr class="question">
! 15585: <td align="left" valign="top"><a name=
! 15586: "id2654449"></a><a name=
! 15587: "id2654450"></a><b>19.4.</b></td>
! 15588:
! 15589: <td align="left" valign="top">
! 15590: <p>What is the difference between <code class=
! 15591: "varname">BUILDLINK_LDFLAGS</code>, <code class=
! 15592: "varname">BUILDLINK_LDADD</code> and <code class=
! 15593: "varname">BUILDLINK_LIBS</code>?</p>
! 15594: </td>
! 15595: </tr>
! 15596:
! 15597: <tr class="answer">
! 15598: <td align="left" valign="top"></td>
! 15599:
! 15600: <td align="left" valign="top">
! 15601: <p>[FIXME]</p>
! 15602: </td>
! 15603: </tr>
! 15604:
! 15605: <tr class="question">
! 15606: <td align="left" valign="top"><a name=
! 15607: "id2654467"></a><a name=
! 15608: "id2654468"></a><b>19.5.</b></td>
! 15609:
! 15610: <td align="left" valign="top">
! 15611: <p>Why does <span><strong class="command">make
! 15612: show-var VARNAME=BUILDLINK_PREFIX.<em class=
! 15613: "replaceable"><code>foo</code></em></strong></span>
! 15614: say it's empty?</p>
! 15615: </td>
! 15616: </tr>
! 15617:
! 15618: <tr class="answer">
! 15619: <td align="left" valign="top"></td>
! 15620:
! 15621: <td align="left" valign="top">
! 15622: <p>For optimization reasons, some variables are
! 15623: only available in the “<span class=
! 15624: "quote">wrapper</span>” phase and later. To
! 15625: “<span class="quote">simulate</span>”
! 15626: the wrapper phase, append <span><strong class=
! 15627: "command">PKG_PHASE=wrapper</strong></span> to
! 15628: the above command.</p>
! 15629: </td>
! 15630: </tr>
! 15631: </tbody>
! 15632: </table>
! 15633: </div>
! 15634: </div>
! 15635: </div>
! 15636:
! 15637: <div class="part" lang="en">
! 15638: <div class="titlepage">
! 15639: <div>
! 15640: <div>
! 15641: <h1 class="title"><a name=
! 15642: "infrastructure"></a>Part III. The pkgsrc
! 15643: infrastructure</h1>
! 15644: </div>
! 15645: </div>
! 15646: </div>
! 15647:
! 15648: <div class="toc">
! 15649: <p><b>Table of Contents</b></p>
! 15650:
! 15651: <dl>
! 15652: <dt><span class="chapter"><a href="#regression">20.
! 15653: Regression tests</a></span></dt>
! 15654:
! 15655: <dd>
! 15656: <dl>
! 15657: <dt><span class="sect1"><a href=
! 15658: "#regression.descr">20.1. The regression tests
! 15659: framework</a></span></dt>
! 15660:
! 15661: <dt><span class="sect1"><a href=
! 15662: "#regression.run">20.2. Running the regression
! 15663: tests</a></span></dt>
! 15664:
! 15665: <dt><span class="sect1"><a href=
! 15666: "#regression.new">20.3. Adding a new regression
! 15667: test</a></span></dt>
! 15668:
! 15669: <dd>
! 15670: <dl>
! 15671: <dt><span class="sect2"><a href=
! 15672: "#regression.fun.override">20.3.1. Overridable
! 15673: functions</a></span></dt>
! 15674:
! 15675: <dt><span class="sect2"><a href=
! 15676: "#regression.fun.helper">20.3.2. Helper
! 15677: functions</a></span></dt>
! 15678: </dl>
! 15679: </dd>
! 15680: </dl>
! 15681: </dd>
! 15682:
! 15683: <dt><span class="chapter"><a href="#porting">21. Porting
! 15684: pkgsrc</a></span></dt>
! 15685:
! 15686: <dd>
! 15687: <dl>
! 15688: <dt><span class="sect1"><a href=
! 15689: "#porting.opsys">21.1. Porting pkgsrc to a new
! 15690: operating system</a></span></dt>
! 15691:
! 15692: <dt><span class="sect1"><a href=
! 15693: "#porting.compiler">21.2. Adding support for a new
! 15694: compiler</a></span></dt>
! 15695: </dl>
! 15696: </dd>
! 15697: </dl>
! 15698: </div>
! 15699:
! 15700: <div class="chapter" lang="en">
! 15701: <div class="titlepage">
! 15702: <div>
! 15703: <div>
! 15704: <h2 class="title"><a name=
! 15705: "regression"></a>Chapter 20. Regression
! 15706: tests</h2>
! 15707: </div>
! 15708: </div>
! 15709: </div>
! 15710:
! 15711: <div class="toc">
! 15712: <p><b>Table of Contents</b></p>
! 15713:
! 15714: <dl>
! 15715: <dt><span class="sect1"><a href=
! 15716: "#regression.descr">20.1. The regression tests
! 15717: framework</a></span></dt>
! 15718:
! 15719: <dt><span class="sect1"><a href="#regression.run">20.2.
! 15720: Running the regression tests</a></span></dt>
! 15721:
! 15722: <dt><span class="sect1"><a href="#regression.new">20.3.
! 15723: Adding a new regression test</a></span></dt>
! 15724:
! 15725: <dd>
! 15726: <dl>
! 15727: <dt><span class="sect2"><a href=
! 15728: "#regression.fun.override">20.3.1. Overridable
! 15729: functions</a></span></dt>
! 15730:
! 15731: <dt><span class="sect2"><a href=
! 15732: "#regression.fun.helper">20.3.2. Helper
! 15733: functions</a></span></dt>
! 15734: </dl>
! 15735: </dd>
! 15736: </dl>
! 15737: </div>
! 15738:
! 15739: <p>The pkgsrc infrastructure consists of a large codebase,
! 15740: and there are many corners where every little bit of a file
! 15741: is well thought out, making pkgsrc likely to fail as soon
! 15742: as anything is changed near those parts. To prevent most
! 15743: changes from breaking anything, a suite of regression tests
! 15744: should go along with every important part of the pkgsrc
! 15745: infrastructure. This chapter describes how regression tests
! 15746: work in pkgsrc and how you can add new tests.</p>
! 15747:
! 15748: <div class="sect1" lang="en">
! 15749: <div class="titlepage">
! 15750: <div>
! 15751: <div>
! 15752: <h2 class="title" style="clear: both"><a name=
! 15753: "regression.descr"></a>20.1. The regression
! 15754: tests framework</h2>
! 15755: </div>
! 15756: </div>
! 15757: </div>
! 15758: </div>
! 15759:
! 15760: <div class="sect1" lang="en">
! 15761: <div class="titlepage">
! 15762: <div>
! 15763: <div>
! 15764: <h2 class="title" style="clear: both"><a name=
! 15765: "regression.run"></a>20.2. Running the
! 15766: regression tests</h2>
! 15767: </div>
! 15768: </div>
! 15769: </div>
! 15770:
! 15771: <p>You first need to install the <a xmlns=
! 15772: "http://www.w3.org/TR/xhtml1/transitional" href=
! 15773: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_regress/README.html"
! 15774: target="_top"><code xmlns="" class=
! 15775: "filename">pkgtools/pkg_regress</code></a> package, which
! 15776: provides the <span><strong class=
! 15777: "command">pkg_regress</strong></span> command. Then you
! 15778: can simply run that command, which will run all tests in
! 15779: the <code xmlns=
! 15780: "http://www.w3.org/TR/xhtml1/transitional" class=
! 15781: "filename">regress</code> category.</p>
! 15782: </div>
! 15783:
! 15784: <div class="sect1" lang="en">
! 15785: <div class="titlepage">
! 15786: <div>
! 15787: <div>
! 15788: <h2 class="title" style="clear: both"><a name=
! 15789: "regression.new"></a>20.3. Adding a new
! 15790: regression test</h2>
! 15791: </div>
! 15792: </div>
! 15793: </div>
! 15794:
! 15795: <p>Every directory in the <code xmlns=
! 15796: "http://www.w3.org/TR/xhtml1/transitional" class=
! 15797: "filename">regress</code> category that contains a file
! 15798: called <code xmlns=
! 15799: "http://www.w3.org/TR/xhtml1/transitional" class=
! 15800: "filename">spec</code> is considered a regression test.
! 15801: This file is a shell program that is included by the
! 15802: <span><strong class="command">pkg_regress</strong></span>
! 15803: command. The following functions can be overridden to
! 15804: suit your needs.</p>
! 15805:
! 15806: <div class="sect2" lang="en">
! 15807: <div class="titlepage">
! 15808: <div>
! 15809: <div>
! 15810: <h3 class="title"><a name=
! 15811: "regression.fun.override"></a>20.3.1. Overridable
! 15812: functions</h3>
! 15813: </div>
! 15814: </div>
! 15815: </div>
! 15816:
! 15817: <p>These functions do not take any parameters. They are
! 15818: all called in “<span class="quote">set
! 15819: -e</span>” mode, so you should be careful to
! 15820: check the exitcodes of any commands you run in the
! 15821: test.</p>
! 15822:
! 15823: <div class="variablelist">
! 15824: <dl>
! 15825: <dt><span class="term"><code class=
! 15826: "varname">do_setup()</code></span></dt>
! 15827:
! 15828: <dd>
! 15829: <p>This function prepares the environment for the
! 15830: test. By default it does nothing.</p>
! 15831: </dd>
! 15832:
! 15833: <dt><span class="term"><code class=
! 15834: "varname">do_test()</code></span></dt>
! 15835:
! 15836: <dd>
! 15837: <p>This function runs the actual test. By
! 15838: default, it calls <code class=
! 15839: "varname">TEST_MAKE</code> with the arguments
! 15840: <code class="varname">MAKEARGS_TEST</code> and
! 15841: writes its output including error messages into
! 15842: the file <code class=
! 15843: "varname">TEST_OUTFILE</code>.</p>
! 15844: </dd>
! 15845:
! 15846: <dt><span class="term"><code class=
! 15847: "varname">check_result()</code></span></dt>
! 15848:
! 15849: <dd>
! 15850: <p>This function is run after the test and is
! 15851: typically used to compare the actual output from
! 15852: the one that is expected. It can make use of the
! 15853: various helper functions from the next
! 15854: section.</p>
! 15855: </dd>
! 15856:
! 15857: <dt><span class="term"><code class=
! 15858: "varname">do_cleanup()</code></span></dt>
! 15859:
! 15860: <dd>
! 15861: <p>This function cleans everything up after the
! 15862: test has been run. By default it does
! 15863: nothing.</p>
! 15864: </dd>
! 15865: </dl>
! 15866: </div>
! 15867: </div>
! 15868:
! 15869: <div class="sect2" lang="en">
! 15870: <div class="titlepage">
! 15871: <div>
! 15872: <div>
! 15873: <h3 class="title"><a name=
! 15874: "regression.fun.helper"></a>20.3.2. Helper
! 15875: functions</h3>
! 15876: </div>
! 15877: </div>
! 15878: </div>
! 15879:
! 15880: <div class="variablelist">
! 15881: <dl>
! 15882: <dt><span class="term"><code class=
! 15883: "varname">exit_status(expected)</code></span></dt>
! 15884:
! 15885: <dd>
! 15886: <p>This function compares the exitcode of the
! 15887: <span><strong class=
! 15888: "command">do_test()</strong></span> function with
! 15889: its first parameter. If they differ, the test
! 15890: will fail.</p>
! 15891: </dd>
! 15892:
! 15893: <dt><span class="term"><code class=
! 15894: "varname">output_require(regex...)</code></span></dt>
! 15895:
! 15896: <dd>
! 15897: <p>This function checks for each of its
! 15898: parameters if the output from
! 15899: <span><strong class="command">do_test()</strong></span>
! 15900: matches the extended regular expression. If it
! 15901: does not, the test will fail.</p>
! 15902: </dd>
! 15903:
! 15904: <dt><span class="term"><code class=
! 15905: "varname">output_prohibit(regex...)</code></span></dt>
! 15906:
! 15907: <dd>
! 15908: <p>This function checks for each of its
! 15909: parameters if the output from
! 15910: <span><strong class="command">do_test()</strong></span>
! 15911: does <span class="emphasis"><em>not</em></span>
! 15912: match the extended regular expression. If any of
! 15913: the regular expressions matches, the test will
! 15914: fail.</p>
! 15915: </dd>
! 15916: </dl>
! 15917: </div>
! 15918: </div>
! 15919: </div>
! 15920: </div>
! 15921:
! 15922: <div class="chapter" lang="en">
! 15923: <div class="titlepage">
! 15924: <div>
! 15925: <div>
! 15926: <h2 class="title"><a name=
! 15927: "porting"></a>Chapter 21. Porting
1.69 rillig 15928: pkgsrc</h2>
15929: </div>
15930: </div>
15931: </div>
15932:
15933: <div class="toc">
15934: <p><b>Table of Contents</b></p>
15935:
15936: <dl>
1.72 ! rillig 15937: <dt><span class="sect1"><a href="#porting.opsys">21.1.
1.69 rillig 15938: Porting pkgsrc to a new operating
15939: system</a></span></dt>
15940:
15941: <dt><span class="sect1"><a href=
1.72 ! rillig 15942: "#porting.compiler">21.2. Adding support for a new
1.69 rillig 15943: compiler</a></span></dt>
15944: </dl>
15945: </div>
15946:
15947: <p>The pkgsrc system has already been ported to many
15948: operating systems, hardware architectures and compilers.
15949: This chapter explains the necessary steps to make pkgsrc
15950: even more portable.</p>
15951:
15952: <div class="sect1" lang="en">
15953: <div class="titlepage">
15954: <div>
15955: <div>
15956: <h2 class="title" style="clear: both"><a name=
1.72 ! rillig 15957: "porting.opsys"></a>21.1. Porting pkgsrc to a
1.69 rillig 15958: new operating system</h2>
15959: </div>
15960: </div>
15961: </div>
15962:
15963: <p>To port pkgsrc to a new operating system (called
15964: <code class="literal">MyOS</code> in this example), you
15965: need to touch the following files:</p>
15966:
15967: <div class="variablelist">
15968: <dl>
15969: <dt><span class="term"><code xmlns=
15970: "http://www.w3.org/TR/xhtml1/transitional" class=
15971: "filename">bootstrap/mods/mk/<em class=
15972: "replaceable"><code>MyOS</code></em>.sys.mk</code></span></dt>
15973:
15974: <dd>
15975: <p>This file contains some basic definitions, for
15976: example the name of the C compiler.</p>
15977: </dd>
15978:
15979: <dt><span class="term"><code xmlns=
15980: "http://www.w3.org/TR/xhtml1/transitional" class=
15981: "filename">mk/bsd.prefs.mk</code></span></dt>
15982:
15983: <dd>
15984: <p>Insert code that defines the variables
15985: <code class="varname">OPSYS</code>, <code class=
15986: "varname">OS_VERSION</code>, <code class=
15987: "varname">LOWER_OS_VERSION</code>, <code class=
15988: "varname">LOWER_VENDOR</code>, <code class=
15989: "varname">MACHINE_ARCH</code>, <code class=
15990: "varname">OBJECT_FMT</code>, <code class=
15991: "varname">APPEND_ELF</code>, and the other
15992: variables that appear in this file.</p>
15993: </dd>
15994:
15995: <dt><span class="term"><code xmlns=
15996: "http://www.w3.org/TR/xhtml1/transitional" class=
15997: "filename">mk/platform/MyOS.mk</code></span></dt>
15998:
15999: <dd>
16000: <p>This file contains the platform-specific
16001: definitions that are used by pkgsrc. Start by
16002: copying one of the other files and edit it to your
16003: needs.</p>
16004: </dd>
16005:
16006: <dt><span class="term"><code xmlns=
16007: "http://www.w3.org/TR/xhtml1/transitional" class=
16008: "filename">mk/platform/MyOS.pkg.dist</code></span></dt>
16009:
16010: <dd>
16011: <p>This file contains a list of directories,
16012: together with their permission bits and ownership.
16013: These directories will be created automatically
16014: with every package that does not explicitly set
16015: <code class="varname">NO_MTREE</code>. There have
16016: been some discussions about whether this file is
16017: needed at all, but with no result.</p>
16018: </dd>
16019:
16020: <dt><span class="term"><code xmlns=
16021: "http://www.w3.org/TR/xhtml1/transitional" class=
16022: "filename">mk/platform/MyOS.x11.dist</code></span></dt>
16023:
16024: <dd>
16025: <p>Just copy one of the pre-existing x11.dist files
16026: to your <code xmlns=
16027: "http://www.w3.org/TR/xhtml1/transitional" class=
16028: "filename"><em class=
16029: "replaceable"><code>MyOS</code></em>.x11.dist</code>.</p>
16030: </dd>
16031:
16032: <dt><span class="term"><code xmlns=
16033: "http://www.w3.org/TR/xhtml1/transitional" class=
16034: "filename">mk/tools/bootstrap.mk</code></span></dt>
16035:
16036: <dd>
16037: <p>On some operating systems, the tools that are
16038: provided with the base system are not good enough
16039: for pkgsrc. For example, there are many versions of
16040: <a href=
16041: "http://netbsd.gw.com/cgi-bin/man-cgi?sed+1+NetBSD-current">
16042: <span class="citerefentry"><span class=
16043: "refentrytitle">sed</span>(1)</span></a> that have
16044: a narrow limit on the line length they can process.
16045: Therefore pkgsrc brings its own tools, which can be
16046: enabled here.</p>
16047: </dd>
16048:
16049: <dt><span class="term"><code xmlns=
16050: "http://www.w3.org/TR/xhtml1/transitional" class=
16051: "filename">mk/tools/<em class=
16052: "replaceable"><code>MyOS</code></em>.mk</code></span></dt>
16053:
16054: <dd>
16055: <p>This file defines the paths to all the tools
16056: that are needed by one or the other package in
16057: pkgsrc, as well as by pkgsrc itself. Find out where
16058: these tools are on your platform and add them.</p>
16059: </dd>
16060: </dl>
16061: </div>
16062:
16063: <p>Now, you should be able to build some basic packages,
16064: like <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
16065: href=
16066: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/perl5/README.html"
16067: target="_top"><code xmlns="" class=
16068: "filename">lang/perl5</code></a>, <a xmlns=
16069: "http://www.w3.org/TR/xhtml1/transitional" href=
16070: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/bash/README.html"
16071: target="_top"><code xmlns="" class=
16072: "filename">shells/bash</code></a>.</p>
16073: </div>
16074:
16075: <div class="sect1" lang="en">
16076: <div class="titlepage">
16077: <div>
16078: <div>
16079: <h2 class="title" style="clear: both"><a name=
1.72 ! rillig 16080: "porting.compiler"></a>21.2. Adding support
1.69 rillig 16081: for a new compiler</h2>
16082: </div>
16083: </div>
16084: </div>
16085:
16086: <p>TODO</p>
16087: </div>
16088: </div>
1.1 grant 16089: </div>
16090:
1.67 hubertf 16091: <div class="appendix" lang="en">
1.1 grant 16092: <div class="titlepage">
16093: <div>
16094: <div>
1.67 hubertf 16095: <h2 class="title"><a name=
1.46 gdt 16096: "examples"></a>Appendix A. A simple example
1.1 grant 16097: package: bison</h2>
16098: </div>
16099: </div>
16100: </div>
16101:
16102: <div class="toc">
16103: <p><b>Table of Contents</b></p>
16104:
16105: <dl>
1.46 gdt 16106: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 16107: files</a></span></dt>
16108:
16109: <dd>
16110: <dl>
1.30 wiz 16111: <dt><span class="sect2"><a href=
1.46 gdt 16112: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 16113:
1.30 wiz 16114: <dt><span class="sect2"><a href=
1.46 gdt 16115: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 16116:
1.30 wiz 16117: <dt><span class="sect2"><a href=
1.46 gdt 16118: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 16119:
1.30 wiz 16120: <dt><span class="sect2"><a href=
1.46 gdt 16121: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 16122: package with <span><strong class=
1.14 xtraeme 16123: "command">pkglint</strong></span></a></span></dt>
1.1 grant 16124: </dl>
16125: </dd>
16126:
1.46 gdt 16127: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 16128: Steps for building, installing, packaging</a></span></dt>
1.1 grant 16129: </dl>
16130: </div>
16131:
16132: <p>We checked to find a piece of software that wasn't in the
16133: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 16134: would want to have <span><strong class=
16135: "command">bison</strong></span> when Berkeley
16136: <span><strong class="command">yacc</strong></span> is already
16137: present in the tree is beyond us, but it's useful for the
16138: purposes of this exercise.</p>
1.1 grant 16139:
1.67 hubertf 16140: <div class="sect1" lang="en">
1.1 grant 16141: <div class="titlepage">
16142: <div>
16143: <div>
16144: <h2 class="title" style="clear: both"><a name=
1.46 gdt 16145: "example-files"></a>A.1. files</h2>
1.1 grant 16146: </div>
16147: </div>
16148: </div>
16149:
1.67 hubertf 16150: <div class="sect2" lang="en">
1.1 grant 16151: <div class="titlepage">
16152: <div>
16153: <div>
1.67 hubertf 16154: <h3 class="title"><a name=
1.46 gdt 16155: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 16156: </div>
16157: </div>
16158: </div>
16159: <pre class="programlisting">
1.51 rillig 16160: # $NetBSD$
16161: #
1.1 grant 16162:
1.51 rillig 16163: DISTNAME= bison-1.25
16164: CATEGORIES= devel
16165: MASTER_SITES= ${MASTER_SITE_GNU}
1.1 grant 16166:
1.51 rillig 16167: MAINTAINER= thorpej@NetBSD.org
16168: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
16169: COMMENT= GNU yacc clone
1.1 grant 16170:
1.51 rillig 16171: GNU_CONFIGURE= yes
16172: INFO_FILES= bison.info
1.1 grant 16173:
1.51 rillig 16174: .include "../../mk/bsd.pkg.mk"
1.1 grant 16175: </pre>
16176: </div>
16177:
1.67 hubertf 16178: <div class="sect2" lang="en">
1.1 grant 16179: <div class="titlepage">
16180: <div>
16181: <div>
1.67 hubertf 16182: <h3 class="title"><a name=
1.46 gdt 16183: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 16184: </div>
16185: </div>
16186: </div>
16187: <pre class="programlisting">
1.51 rillig 16188: GNU version of yacc. Can make re-entrant parsers, and numerous other
16189: improvements. Why you would want this when Berkeley <a href=
1.1 grant 16190: "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 16191: of the NetBSD source tree is beyond me.
1.1 grant 16192: </pre>
16193: </div>
16194:
1.67 hubertf 16195: <div class="sect2" lang="en">
1.1 grant 16196: <div class="titlepage">
16197: <div>
16198: <div>
1.67 hubertf 16199: <h3 class="title"><a name=
1.46 gdt 16200: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 16201: </div>
16202: </div>
16203: </div>
16204: <pre class="programlisting">
1.51 rillig 16205: @comment $NetBSD$
16206: bin/bison
16207: man/man1/bison.1.gz
16208: share/bison.simple
16209: share/bison.hairy
1.1 grant 16210: </pre>
16211: </div>
16212:
1.67 hubertf 16213: <div class="sect2" lang="en">
1.1 grant 16214: <div class="titlepage">
16215: <div>
16216: <div>
1.30 wiz 16217: <h3 class="title"><a name=
1.46 gdt 16218: "checking-package-with-pkglint"></a>A.1.4. Checking
1.30 wiz 16219: a package with <span><strong class=
1.14 xtraeme 16220: "command">pkglint</strong></span></h3>
1.1 grant 16221: </div>
16222: </div>
16223: </div>
16224:
16225: <p>The NetBSD package system comes with <a xmlns=
16226: "http://www.w3.org/TR/xhtml1/transitional" href=
16227: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 16228: target="_top"><code xmlns="" class=
16229: "filename">pkgtools/pkglint</code></a> which helps to
16230: check the contents of these files. After installation it
16231: is quite easy to use, just change to the directory of the
1.20 ben 16232: package you wish to examine and execute
16233: <span><strong class=
16234: "command">pkglint</strong></span>:</p>
1.1 grant 16235: <pre class="screen">
1.14 xtraeme 16236: <code class="prompt">$</code> <strong class=
16237: "userinput"><code>pkglint</code></strong>
1.1 grant 16238: looks fine.
16239: </pre>
16240:
16241: <p>Depending on the supplied command line arguments (see
1.60 rillig 16242: pkglint(1)), more checks will be performed. Use e.g.
16243: <span><strong class="command">pkglint -Call
16244: -Wall</strong></span> for a very thorough check.</p>
1.1 grant 16245: </div>
16246: </div>
16247:
1.67 hubertf 16248: <div class="sect1" lang="en">
1.1 grant 16249: <div class="titlepage">
16250: <div>
16251: <div>
16252: <h2 class="title" style="clear: both"><a name=
1.46 gdt 16253: "steps-for-b-i-p"></a>A.2. Steps for building,
1.30 wiz 16254: installing, packaging</h2>
1.1 grant 16255: </div>
16256: </div>
16257: </div>
16258:
16259: <p>Create the directory where the package lives, plus any
16260: auxiliary directories:</p>
16261: <pre class="screen">
1.14 xtraeme 16262: <code class="prompt">#</code> <strong class=
16263: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
16264: <code class="prompt">#</code> <strong class=
16265: "userinput"><code>mkdir bison</code></strong>
16266: <code class="prompt">#</code> <strong class=
16267: "userinput"><code>cd bison</code></strong>
16268: <code class="prompt">#</code> <strong class=
16269: "userinput"><code>mkdir patches</code></strong>
1.1 grant 16270: </pre>
16271:
1.45 wiz 16272: <p>Create <code xmlns=
16273: "http://www.w3.org/TR/xhtml1/transitional" class=
16274: "filename">Makefile</code>, <code xmlns=
16275: "http://www.w3.org/TR/xhtml1/transitional" class=
16276: "filename">DESCR</code> and <code xmlns=
16277: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16278: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 16279: "Chapter 8. Package components - files, directories and contents">
1.67 hubertf 16280: Chapter 8, <i>Package components - files, directories
16281: and contents</i></a>) then continue with fetching the
1.1 grant 16282: distfile:</p>
16283: <pre class="screen">
1.14 xtraeme 16284: <code class="prompt">#</code> <strong class=
16285: "userinput"><code>make fetch</code></strong>
1.1 grant 16286: >> bison-1.25.tar.gz doesn't seem to exist on this system.
16287: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
16288: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
16289: ftp: Error retrieving file: 500 Internal error
16290:
16291: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
16292: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
16293: ftp: Error retrieving file: 500 Internal error
16294:
16295: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
16296: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
16297: Successfully retrieved file.
16298: </pre>
16299:
1.45 wiz 16300: <p>Generate the checksum of the distfile into <code xmlns=
16301: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16302: "filename">distinfo</code>:</p>
1.1 grant 16303: <pre class="screen">
1.14 xtraeme 16304: <code class="prompt">#</code> <strong class=
16305: "userinput"><code>make makesum</code></strong>
1.1 grant 16306: </pre>
16307:
16308: <p>Now compile:</p>
16309: <pre class="screen">
1.14 xtraeme 16310: <code class="prompt">#</code> <strong class=
16311: "userinput"><code>make</code></strong>
1.1 grant 16312: >> Checksum OK for bison-1.25.tar.gz.
16313: ===> Extracting for bison-1.25
16314: ===> Patching for bison-1.25
16315: ===> Ignoring empty patch directory
16316: ===> Configuring for bison-1.25
16317: creating cache ./config.cache
16318: checking for gcc... cc
16319: checking whether we are using GNU C... yes
16320: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
16321: checking how to run the C preprocessor... cc -E
16322: checking for minix/config.h... no
16323: checking for POSIXized ISC... no
16324: checking whether cross-compiling... no
16325: checking for ANSI C header files... yes
16326: checking for string.h... yes
16327: checking for stdlib.h... yes
16328: checking for memory.h... yes
16329: checking for working const... yes
16330: checking for working alloca.h... no
16331: checking for alloca... yes
16332: checking for strerror... yes
16333: updating cache ./config.cache
16334: creating ./config.status
16335: creating Makefile
16336: ===> Building for bison-1.25
16337: 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
16338: 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
16339: 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
16340: 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
16341: 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 16342: 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 16343: 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
16344: 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
16345: 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
16346: 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
16347: 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
16348: 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
16349: 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
16350: 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
16351: 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
16352: 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
16353: 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
16354: 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
16355: 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
16356: 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
16357: 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
16358: 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
16359: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
16360: rm -f bison.s1
16361: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
16362: </pre>
16363:
16364: <p>Everything seems OK, so install the files:</p>
16365: <pre class="screen">
1.14 xtraeme 16366: <code class="prompt">#</code> <strong class=
16367: "userinput"><code>make install</code></strong>
1.1 grant 16368: >> Checksum OK for bison-1.25.tar.gz.
16369: ===> Installing for bison-1.25
16370: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
16371: rm -f /usr/pkg/bin/bison
16372: cd /usr/pkg/share; rm -f bison.simple bison.hairy
16373: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
16374: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
16375: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
16376: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
16377: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
16378: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
16379: ===> Registering installation for bison-1.25
16380: </pre>
16381:
16382: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 16383: remove it with <span><strong class="command">pkg_delete
16384: bison</strong></span>. Should you decide that you want a
16385: binary package, do this now:</p>
1.1 grant 16386: <pre class="screen">
1.14 xtraeme 16387: <code class="prompt">#</code> <strong class=
16388: "userinput"><code>make package</code></strong>
1.1 grant 16389: >> Checksum OK for bison-1.25.tar.gz.
16390: ===> Building package for bison-1.25
16391: Creating package bison-1.25.tgz
16392: Registering depends:.
16393: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
16394: </pre>
16395:
16396: <p>Now that you don't need the source and object files any
16397: more, clean up:</p>
16398: <pre class="screen">
1.14 xtraeme 16399: <code class="prompt">#</code> <strong class=
16400: "userinput"><code>make clean</code></strong>
1.1 grant 16401: ===> Cleaning for bison-1.25
16402: </pre>
16403: </div>
16404: </div>
16405:
1.67 hubertf 16406: <div class="appendix" lang="en">
1.1 grant 16407: <div class="titlepage">
16408: <div>
16409: <div>
1.67 hubertf 16410: <h2 class="title"><a name=
1.46 gdt 16411: "logs"></a>Appendix B. Build logs</h2>
1.1 grant 16412: </div>
16413: </div>
16414: </div>
16415:
16416: <div class="toc">
16417: <p><b>Table of Contents</b></p>
16418:
16419: <dl>
1.46 gdt 16420: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 16421: Building figlet</a></span></dt>
16422:
1.46 gdt 16423: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 16424: Packaging figlet</a></span></dt>
16425: </dl>
16426: </div>
16427:
1.67 hubertf 16428: <div class="sect1" lang="en">
1.1 grant 16429: <div class="titlepage">
16430: <div>
16431: <div>
16432: <h2 class="title" style="clear: both"><a name=
1.46 gdt 16433: "logs.building"></a>B.1. Building figlet</h2>
1.1 grant 16434: </div>
16435: </div>
16436: </div>
16437: <pre class="screen">
1.14 xtraeme 16438: <code class="prompt">#</code> <strong class=
16439: "userinput"><code>make</code></strong>
1.1 grant 16440: ===> Checking for vulnerabilities in figlet-2.2.1nb2
16441: => figlet221.tar.gz doesn't seem to exist on this system.
16442: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
16443: => [172219 bytes]
16444: Connected to ftp.plig.net.
16445: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
16446: 331 Guest login ok, send your complete e-mail address as password.
16447: 230-You are user #5 of 500 simultaneous users allowed.
16448: 230-
1.68 rillig 16449: 230- ___ _ _ _
16450: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
1.1 grant 16451: 230- | _| _| . |_| . | | | . |_| . | _| . |
16452: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
16453: 230- |_| |_| |___| |___|
16454: 230-
16455: 230-** Welcome to ftp.plig.org **
16456: 230-
16457: 230-Please note that all transfers from this FTP site are logged. If you
16458: 230-do not like this, please disconnect now.
16459: 230-
16460: 230-This arhive is available via
16461: 230-
16462: 230-HTTP: http://ftp.plig.org/
16463: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
16464: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
16465: 230-
16466: 230-Please email comments, bug reports and requests for packages to be
1.68 rillig 16467: 230-mirrored to ftp-admin@plig.org.
1.1 grant 16468: 230-
16469: 230-
16470: 230 Logged in anonymously.
16471: Remote system type is UNIX.
16472: Using binary mode to transfer files.
16473: 200 Type okay.
16474: 250 "/pub" is new cwd.
16475: 250-"/pub/figlet" is new cwd.
16476: 250-
16477: 250-Welcome to the figlet archive at ftp.figlet.org
1.68 rillig 16478: 250-
1.1 grant 16479: 250- ftp://ftp.figlet.org/pub/figlet/
16480: 250-
16481: 250-The official FIGlet web page is:
16482: 250- http://www.figlet.org/
16483: 250-
16484: 250-If you have questions, please mailto:info@figlet.org. If you want to
16485: 250-contribute a font or something else, you can email us.
1.68 rillig 16486: 250
1.1 grant 16487: 250 "/pub/figlet/program" is new cwd.
16488: 250 "/pub/figlet/program/unix" is new cwd.
16489: local: figlet221.tar.gz remote: figlet221.tar.gz
16490: 502 Unimplemented command.
16491: 227 Entering Passive Mode (195,40,6,41,246,104)
16492: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
16493: 38% |************** | 65800 64.16 KB/s 00:01 ETA
16494: 226 Transfer completed.
16495: 172219 bytes received in 00:02 (75.99 KB/s)
16496: 221 Goodbye.
16497: => Checksum OK for figlet221.tar.gz.
16498: ===> Extracting for figlet-2.2.1nb2
16499: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
16500: ===> Patching for figlet-2.2.1nb2
16501: ===> Applying pkgsrc patches for figlet-2.2.1nb2
16502: ===> Overriding tools for figlet-2.2.1nb2
16503: ===> Creating toolchain wrappers for figlet-2.2.1nb2
16504: ===> Configuring for figlet-2.2.1nb2
16505: ===> Building for figlet-2.2.1nb2
16506: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
16507: chmod a+x figlet
16508: gcc -O2 -o chkfont chkfont.c
16509: => Unwrapping files-to-be-installed.
1.14 xtraeme 16510: <code class="prompt">#</code>
16511: <code class="prompt">#</code> <strong class=
16512: "userinput"><code>make install</code></strong>
1.1 grant 16513: ===> Checking for vulnerabilities in figlet-2.2.1nb2
16514: ===> Installing for figlet-2.2.1nb2
16515: install -d -o root -g wheel -m 755 /usr/pkg/bin
16516: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
16517: mkdir -p /usr/pkg/share/figlet
16518: cp figlet /usr/pkg/bin
16519: cp chkfont /usr/pkg/bin
16520: chmod 555 figlist showfigfonts
16521: cp figlist /usr/pkg/bin
16522: cp showfigfonts /usr/pkg/bin
16523: cp fonts/*.flf /usr/pkg/share/figlet
16524: cp fonts/*.flc /usr/pkg/share/figlet
16525: cp figlet.6 /usr/pkg/man/man6
16526: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 16527: <code class="prompt">#</code>
1.1 grant 16528: </pre>
16529: </div>
16530:
1.67 hubertf 16531: <div class="sect1" lang="en">
1.1 grant 16532: <div class="titlepage">
16533: <div>
16534: <div>
16535: <h2 class="title" style="clear: both"><a name=
1.46 gdt 16536: "logs.package"></a>B.2. Packaging figlet</h2>
1.1 grant 16537: </div>
16538: </div>
16539: </div>
16540: <pre class="screen">
1.14 xtraeme 16541: <code class="prompt">#</code> <strong class=
16542: "userinput"><code>make package</code></strong>
1.1 grant 16543: ===> Checking for vulnerabilities in figlet-2.2.1nb2
16544: ===> Packaging figlet-2.2.1nb2
16545: ===> Building binary package for figlet-2.2.1nb2
16546: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
16547: Using SrcDir value of /usr/pkg
1.68 rillig 16548: Registering depends:.
1.14 xtraeme 16549: <code class="prompt">#</code>
1.1 grant 16550: </pre>
16551: </div>
16552: </div>
16553:
1.67 hubertf 16554: <div class="appendix" lang="en">
1.1 grant 16555: <div class="titlepage">
16556: <div>
16557: <div>
1.67 hubertf 16558: <h2 class="title"><a name=
1.46 gdt 16559: "ftp-layout"></a>Appendix C. Layout of the
1.1 grant 16560: FTP server's package archive</h2>
16561: </div>
16562: </div>
16563: </div>
16564:
16565: <p>Layout for precompiled binary packages on
16566: ftp.NetBSD.org:</p>
16567: <pre class="programlisting">
1.51 rillig 16568: /pub/NetBSD/packages/
16569: distfiles/
1.1 grant 16570:
1.51 rillig 16571: # Unpacked pkgsrc trees
16572: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
16573: pkgsrc-2003Q4 -> N/A
16574: pkgsrc-2004Q1/pkgsrc
16575:
16576: # pkgsrc archives
16577: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
16578: pkgsrc-2003Q4.tar.gz -> N/A
16579: pkgsrc-2004Q1.tar.gz -> N/A
16580:
16581: # Per pkgsrc-release/OS-release/arch package archives
16582: pkgsrc-2003Q4/
16583: NetBSD-1.6.2/
16584: i386/
16585: All/
16586: archivers/
16587: foo -> ../All/foo
16588: ...
16589: pkgsrc-2004Q1/
16590: NetBSD-1.6.2/
16591: i386/
16592: All/
16593: ...
16594: NetBSD-2.0/
16595: i386/
16596: All/
16597: ...
16598: SunOS-5.9/
16599: sparc/
16600: All/
16601: ...
16602: x86/
16603: All/
16604: ...
16605:
16606: # Per os-release package archive convenience links
16607: NetBSD-1.6.2 -> 1.6.2
16608: 1.6.2/
16609: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
16610: m68k/
16611: All/
16612: archivers/
16613: foo -> ../All/foo
16614: ...
16615: amiga -> m68k
16616: atari -> m68k
16617: ...
16618:
16619: 2.0 -> NetBSD-2.0 # backward compat, historic
16620: NetBSD-2.0/
16621: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
16622: SunOS-5.9/
16623: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
16624: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1 grant 16625: </pre>
16626:
16627: <p>To create:</p>
16628:
16629: <div class="orderedlist">
16630: <ol type="1">
16631: <li>
16632: <p>Run bulk build, see <a href="#bulkbuild" title=
1.67 hubertf 16633: "6.3. Doing a bulk build of all packages">Section 6.3,
16634: “Doing a bulk build of all
1.1 grant 16635: packages”</a></p>
16636: </li>
16637:
16638: <li>
16639: <p>Upload /usr/pkgsrc/packages to</p>
16640: <pre class="programlisting">
16641: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51 rillig 16642: pkgsrc-2004Q4/\ # pkgsrc-branch
16643: `uname -s`-`uname -r`/\ # OS & version
16644: `uname -p` # architecture
1.1 grant 16645: </pre>
16646: </li>
16647:
16648: <li>
1.14 xtraeme 16649: <p>If necessary, create a symlink <span><strong class=
16650: "command">ln -s `uname -m` `uname -p`</strong></span>
16651: (amiga -> m68k, ...)</p>
1.1 grant 16652: </li>
16653: </ol>
16654: </div>
16655: </div>
1.2 hubertf 16656:
1.67 hubertf 16657: <div class="appendix" lang="en">
1.2 hubertf 16658: <div class="titlepage">
16659: <div>
16660: <div>
1.67 hubertf 16661: <h2 class="title"><a name=
1.46 gdt 16662: "editing"></a>Appendix D. Editing guidelines
1.2 hubertf 16663: for the pkgsrc guide</h2>
16664: </div>
16665: </div>
16666: </div>
16667:
16668: <div class="toc">
16669: <p><b>Table of Contents</b></p>
16670:
16671: <dl>
1.46 gdt 16672: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 16673: Targets</a></span></dt>
16674:
1.46 gdt 16675: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 16676: Procedure</a></span></dt>
16677: </dl>
16678: </div>
16679:
16680: <p>This section contains information on editing the pkgsrc
16681: guide itself.</p>
16682:
1.67 hubertf 16683: <div class="sect1" lang="en">
1.2 hubertf 16684: <div class="titlepage">
16685: <div>
16686: <div>
16687: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 16688: "targets"></a>D.1. Targets</h2>
1.2 hubertf 16689: </div>
16690: </div>
16691: </div>
16692:
1.45 wiz 16693: <p>The pkgsrc guide's source code is stored in <code xmlns=
16694: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16695: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 16696: are created from it:</p>
16697:
16698: <div class="itemizedlist">
16699: <ul type="disc">
16700: <li>
1.45 wiz 16701: <p><code xmlns=
16702: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 16703: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 16704: </li>
16705:
16706: <li>
1.45 wiz 16707: <p><code xmlns=
16708: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16709: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 16710: </li>
16711:
16712: <li>
1.45 wiz 16713: <p><code xmlns=
16714: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16715: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 16716: the documentation on the NetBSD website will be built
16717: from pkgsrc and kept up to date on the web server
16718: itself. This means you <span class=
16719: "emphasis"><em>must</em></span> make sure that your
16720: changes haven't broken the build!</p>
16721: </li>
1.6 hubertf 16722:
16723: <li>
1.45 wiz 16724: <p><code xmlns=
16725: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16726: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 16727: PDF version of the pkgsrc guide.</p>
16728: </li>
16729:
16730: <li>
1.45 wiz 16731: <p><code xmlns=
16732: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16733: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 16734: PostScript version of the pkgsrc guide.</p>
16735: </li>
1.2 hubertf 16736: </ul>
16737: </div>
16738: </div>
16739:
1.67 hubertf 16740: <div class="sect1" lang="en">
1.2 hubertf 16741: <div class="titlepage">
16742: <div>
16743: <div>
16744: <h2 class="title" style="clear: both"><a name=
1.46 gdt 16745: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 16746: </div>
16747: </div>
16748: </div>
16749:
16750: <p>The procedure to edit the pkgsrc guide is:</p>
16751:
16752: <div class="itemizedlist">
16753: <ul type="disc">
16754: <li>
1.6 hubertf 16755: <p>Make sure you have the packages needed to
16756: re-generate the pkgsrc guide (and other XML-based
16757: NetBSD documentation) installed. These are
1.11 ben 16758: “<span class="quote">netbsd-doc</span>”
1.47 reed 16759: for creating the ASCII and HTML versions, and
1.6 hubertf 16760: “<span class=
1.47 reed 16761: "quote">netbsd-doc-print</span>” for the
16762: PostScript and PDF versions. You will need both
1.6 hubertf 16763: packages installed, to make sure documentation is
16764: consistent across all formats. The packages can be
1.45 wiz 16765: found in <code xmlns=
16766: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16767: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45 wiz 16768: <code xmlns=
16769: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16770: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 16771: </li>
16772:
16773: <li>
1.45 wiz 16774: <p>Edit the XML file(s) in <code xmlns=
16775: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16776: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 16777: </li>
16778:
16779: <li>
1.14 xtraeme 16780: <p>Run <span><strong class="command">make extract
16781: && make do-lint</strong></span> in
1.45 wiz 16782: <code xmlns=
16783: "http://www.w3.org/TR/xhtml1/transitional" class=
16784: "filename">pkgsrc/doc/guide</code> to check the XML
16785: syntax, and fix it if needed.</p>
1.4 hubertf 16786: </li>
16787:
16788: <li>
1.14 xtraeme 16789: <p>Run <span><strong class=
1.45 wiz 16790: "command">make</strong></span> in <code xmlns=
16791: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16792: "filename">pkgsrc/doc/guide</code> to build the HTML
16793: and ASCII version.</p>
1.2 hubertf 16794: </li>
16795:
16796: <li>
1.14 xtraeme 16797: <p>If all is well, run <span><strong class=
16798: "command">make install-doc</strong></span> to put the
1.45 wiz 16799: generated files into <code xmlns=
16800: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16801: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 16802: </li>
16803:
16804: <li>
1.14 xtraeme 16805: <p><span><strong class="command">cvs commit
16806: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 16807: </li>
16808:
16809: <li>
1.14 xtraeme 16810: <p><span><strong class="command">cvs commit -m
16811: re-generate
16812: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 16813: </li>
1.4 hubertf 16814:
16815: <li>
16816: <p>Until the webserver on www.NetBSD.org is really
16817: updated automatically to pick up changes to the
1.14 xtraeme 16818: pkgsrc guide automatically, also run
1.18 xtraeme 16819: <span><strong class="command">make install-htdocs
1.14 xtraeme 16820: HTDOCSDIR=../../../htdocs</strong></span> (or
16821: similar, adjust <code class=
16822: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 16823: </li>
16824:
16825: <li>
1.14 xtraeme 16826: <p><span><strong class="command">cvs commit
16827: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 16828: </li>
1.2 hubertf 16829: </ul>
16830: </div>
16831: </div>
16832: </div>
1.1 grant 16833: </div>
16834: </body>
16835: </html>
CVSweb <webmaster@jp.NetBSD.org>