Annotation of pkgsrc/doc/pkgsrc.html, revision 1.74
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=
1.74 ! rillig 13: "pkgsrc is a centralized package management system for Unix-like operating systems. This guide provides information for users and developers of pkgsrc. It covers installation of binary and source packages, creation of binary and source packages and a high-level overview about the infrastructure." />
1.1 grant 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.74 ! rillig 64: <p class="copyright">Copyright © 1994-2006 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.74 ! rillig 69: <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.18
! 70: 2006/05/19 22:05:09 rillig Exp $</p>
1.1 grant 71: </div>
72:
73: <div>
74: <div class="abstract">
75: <p class="title"><b>Abstract</b></p>
76:
1.74 ! rillig 77: <p>pkgsrc is a centralized package management system
! 78: for Unix-like operating systems. This guide provides
! 79: information for users and developers of pkgsrc. It
! 80: covers installation of binary and source packages,
! 81: creation of binary and source packages and a high-level
! 82: overview about the infrastructure.</p>
1.1 grant 83: </div>
84: </div>
85: </div>
86: <hr />
87: </div>
88:
89: <div class="toc">
90: <p><b>Table of Contents</b></p>
91:
92: <dl>
1.51 rillig 93: <dt><span class="chapter"><a href="#introduction">1. What
94: is pkgsrc?</a></span></dt>
1.1 grant 95:
96: <dd>
97: <dl>
1.30 wiz 98: <dt><span class="sect1"><a href=
99: "#introduction-section">1.1.
1.1 grant 100: Introduction</a></span></dt>
101:
102: <dt><span class="sect1"><a href="#overview">1.2.
103: Overview</a></span></dt>
104:
105: <dt><span class="sect1"><a href="#terminology">1.3.
106: Terminology</a></span></dt>
107:
1.74 ! rillig 108: <dd>
! 109: <dl>
! 110: <dt><span class="sect2"><a href=
! 111: "#term.people">1.3.1. People involved in
! 112: pkgsrc</a></span></dt>
! 113: </dl>
! 114: </dd>
! 115:
1.1 grant 116: <dt><span class="sect1"><a href="#typography">1.4.
117: Typography</a></span></dt>
118: </dl>
119: </dd>
120:
1.46 gdt 121: <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1 grant 122: user's guide</a></span></dt>
123:
124: <dd>
125: <dl>
126: <dt><span class="chapter"><a href="#getting">2. Where
1.59 rillig 127: to get pkgsrc and how to keep it
128: up-to-date</a></span></dt>
1.1 grant 129:
130: <dd>
131: <dl>
1.30 wiz 132: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1 grant 133: As tar file</a></span></dt>
134:
1.30 wiz 135: <dt><span class="sect1"><a href="#via-sup">2.2. Via
136: SUP</a></span></dt>
1.1 grant 137:
1.30 wiz 138: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
139: CVS</a></span></dt>
1.59 rillig 140:
141: <dt><span class="sect1"><a href=
142: "#uptodate-cvs">2.4. Keeping pkgsrc up-to-date via
143: CVS</a></span></dt>
1.1 grant 144: </dl>
145: </dd>
146:
147: <dt><span class="chapter"><a href="#platforms">3. Using
148: pkgsrc on systems other than NetBSD</a></span></dt>
149:
150: <dd>
151: <dl>
1.30 wiz 152: <dt><span class="sect1"><a href=
153: "#bootstrapping-pkgsrc">3.1. Bootstrapping
154: pkgsrc</a></span></dt>
1.1 grant 155:
1.30 wiz 156: <dt><span class="sect1"><a href=
1.47 reed 157: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 158: notes</a></span></dt>
1.1 grant 159:
160: <dd>
161: <dl>
162: <dt><span class="sect2"><a href=
1.30 wiz 163: "#darwin">3.2.1. Darwin (Mac OS
1.1 grant 164: X)</a></span></dt>
165:
166: <dt><span class="sect2"><a href=
1.30 wiz 167: "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1 grant 168:
169: <dt><span class="sect2"><a href=
1.30 wiz 170: "#interix">3.2.3. Interix</a></span></dt>
1.1 grant 171:
1.30 wiz 172: <dt><span class="sect2"><a href="#irix">3.2.4.
173: IRIX</a></span></dt>
1.1 grant 174:
1.30 wiz 175: <dt><span class="sect2"><a href="#linux">3.2.5.
176: Linux</a></span></dt>
1.1 grant 177:
178: <dt><span class="sect2"><a href=
1.30 wiz 179: "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22 tv 180:
181: <dt><span class="sect2"><a href=
1.30 wiz 182: "#solaris">3.2.7. Solaris</a></span></dt>
1.1 grant 183: </dl>
184: </dd>
185: </dl>
186: </dd>
187:
188: <dt><span class="chapter"><a href="#using">4. Using
189: pkgsrc</a></span></dt>
190:
191: <dd>
192: <dl>
1.70 rillig 193: <dt><span class="sect1"><a href="#using-pkg">4.1.
194: Using binary packages</a></span></dt>
1.1 grant 195:
196: <dd>
197: <dl>
198: <dt><span class="sect2"><a href=
1.70 rillig 199: "#finding-binary-packages">4.1.1. Finding
200: binary packages</a></span></dt>
1.1 grant 201:
202: <dt><span class="sect2"><a href=
1.70 rillig 203: "#installing-binary-packages">4.1.2. Installing
1.30 wiz 204: binary packages</a></span></dt>
1.1 grant 205:
206: <dt><span class="sect2"><a href=
1.30 wiz 207: "#a-word-of-warning">4.1.3. A word of
1.1 grant 208: warning</a></span></dt>
209: </dl>
210: </dd>
211:
1.30 wiz 212: <dt><span class="sect1"><a href=
213: "#building-packages-from-source">4.2. Building
214: packages from source</a></span></dt>
1.1 grant 215:
216: <dd>
217: <dl>
218: <dt><span class="sect2"><a href=
1.30 wiz 219: "#requirements">4.2.1.
1.1 grant 220: Requirements</a></span></dt>
221:
222: <dt><span class="sect2"><a href=
1.30 wiz 223: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 224: distfiles</a></span></dt>
225:
226: <dt><span class="sect2"><a href=
1.30 wiz 227: "#how-to-build-and-install">4.2.3. How to build
228: and install</a></span></dt>
1.1 grant 229:
230: <dt><span class="sect2"><a href=
1.30 wiz 231: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 232: compiler</a></span></dt>
233: </dl>
234: </dd>
235: </dl>
236: </dd>
237:
1.38 dillo 238: <dt><span class="chapter"><a href="#configuring">5.
239: Configuring pkgsrc</a></span></dt>
240:
241: <dd>
242: <dl>
243: <dt><span class="sect1"><a href=
1.45 wiz 244: "#general-configuration">5.1. General
245: configuration</a></span></dt>
246:
247: <dt><span class="sect1"><a href=
248: "#variables-affecting-build">5.2. Variables
249: affecting the build process</a></span></dt>
250:
251: <dt><span class="sect1"><a href=
252: "#developer-advanced-settings">5.3.
253: Developer/advanced settings</a></span></dt>
254:
255: <dt><span class="sect1"><a href=
256: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 257: Options</a></span></dt>
1.38 dillo 258: </dl>
259: </dd>
260:
261: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 262: binary packages</a></span></dt>
263:
264: <dd>
265: <dl>
1.30 wiz 266: <dt><span class="sect1"><a href=
1.38 dillo 267: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 268: single binary package</a></span></dt>
1.1 grant 269:
1.30 wiz 270: <dt><span class="sect1"><a href=
1.38 dillo 271: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 272: Settings for creation of binary
273: packages</a></span></dt>
274:
1.38 dillo 275: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 276: Doing a bulk build of all packages</a></span></dt>
277:
278: <dd>
279: <dl>
280: <dt><span class="sect2"><a href=
1.38 dillo 281: "#binary.configuration">6.3.1.
1.1 grant 282: Configuration</a></span></dt>
283:
284: <dt><span class="sect2"><a href=
1.38 dillo 285: "#other-environmental-considerations">6.3.2.
1.30 wiz 286: Other environmental
1.1 grant 287: considerations</a></span></dt>
288:
289: <dt><span class="sect2"><a href=
1.38 dillo 290: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 291:
292: <dt><span class="sect2"><a href=
1.38 dillo 293: "#what-it-does">6.3.4. What it
1.1 grant 294: does</a></span></dt>
295:
296: <dt><span class="sect2"><a href=
1.38 dillo 297: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 298: requirements</a></span></dt>
299:
300: <dt><span class="sect2"><a href=
1.38 dillo 301: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 302: sandbox for chrooted builds</a></span></dt>
1.1 grant 303:
304: <dt><span class="sect2"><a href=
1.38 dillo 305: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 306: partial set of packages</a></span></dt>
1.13 hubertf 307:
308: <dt><span class="sect2"><a href=
1.38 dillo 309: "#bulk-upload">6.3.8. Uploading results of a
1.13 hubertf 310: bulk build</a></span></dt>
1.1 grant 311: </dl>
312: </dd>
313:
1.30 wiz 314: <dt><span class="sect1"><a href=
1.38 dillo 315: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 316: packages collection</a></span></dt>
1.1 grant 317:
318: <dd>
319: <dl>
320: <dt><span class="sect2"><a href=
1.38 dillo 321: "#cdpack-example">6.4.1. Example of
1.1 grant 322: cdpack</a></span></dt>
323: </dl>
324: </dd>
325: </dl>
326: </dd>
327:
1.38 dillo 328: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 329: Asked Questions</a></span></dt>
330:
331: <dd>
332: <dl>
1.30 wiz 333: <dt><span class="sect1"><a href=
1.38 dillo 334: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 335: lists for pkg-related discussion?</a></span></dt>
1.1 grant 336:
1.30 wiz 337: <dt><span class="sect1"><a href=
1.38 dillo 338: "#pkgviews-docs">7.2. Where's the pkgviews
1.30 wiz 339: documentation?</a></span></dt>
1.1 grant 340:
1.5 hubertf 341: <dt><span class="sect1"><a href=
1.38 dillo 342: "#faq-pkgtools">7.3. Utilities for package
1.5 hubertf 343: management (pkgtools)</a></span></dt>
1.1 grant 344:
1.30 wiz 345: <dt><span class="sect1"><a href=
1.38 dillo 346: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 347: non-root</a></span></dt>
348:
349: <dt><span class="sect1"><a href=
1.38 dillo 350: "#resume-transfers">7.5. How to resume transfers
1.30 wiz 351: when fetching distfiles?</a></span></dt>
352:
353: <dt><span class="sect1"><a href=
1.38 dillo 354: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 355: XFree86 from pkgsrc?</a></span></dt>
356:
357: <dt><span class="sect1"><a href=
1.38 dillo 358: "#x.org-from-pkgsrc">7.7. How can I install/use
1.30 wiz 359: X.org from pkgsrc?</a></span></dt>
1.1 grant 360:
1.30 wiz 361: <dt><span class="sect1"><a href=
1.38 dillo 362: "#fetch-behind-firewall">7.8. How to fetch files
1.30 wiz 363: from behind a firewall</a></span></dt>
1.1 grant 364:
1.38 dillo 365: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.14 xtraeme 366: How do I tell <span><strong class="command">make
367: fetch</strong></span> to do passive
1.1 grant 368: FTP?</a></span></dt>
369:
1.30 wiz 370: <dt><span class="sect1"><a href=
1.38 dillo 371: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 372: distfiles at once</a></span></dt>
1.1 grant 373:
1.30 wiz 374: <dt><span class="sect1"><a href=
1.38 dillo 375: "#tmac.andoc-missing">7.11. What does
1.30 wiz 376: “<span class="quote">Don't know how to make
377: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 378: mean?</a></span></dt>
1.13 hubertf 379:
1.30 wiz 380: <dt><span class="sect1"><a href=
1.38 dillo 381: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 382: “<span class="quote">Could not find
1.14 xtraeme 383: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 384:
1.30 wiz 385: <dt><span class="sect1"><a href=
1.38 dillo 386: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 387: pkgsrc</a></span></dt>
1.1 grant 388:
1.38 dillo 389: <dt><span class="sect1"><a href="#faq.conf">7.14.
1.35 jmmv 390: How do I change the location of configuration
391: files?</a></span></dt>
1.1 grant 392:
393: <dt><span class="sect1"><a href=
1.38 dillo 394: "#audit-packages">7.15. Automated security
1.1 grant 395: checks</a></span></dt>
1.74 ! rillig 396:
! 397: <dt><span class="sect1"><a href=
! 398: "#ufaq-cflags">7.16. Why do some packages ignore my
! 399: <code class=
! 400: "varname">CFLAGS</code>?</a></span></dt>
1.1 grant 401: </dl>
402: </dd>
403: </dl>
404: </dd>
405:
1.46 gdt 406: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 407: pkgsrc developer's guide</a></span></dt>
408:
409: <dd>
410: <dl>
1.38 dillo 411: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 412: Package components - files, directories and
413: contents</a></span></dt>
414:
415: <dd>
416: <dl>
417: <dt><span class="sect1"><a href=
1.45 wiz 418: "#components.Makefile">8.1. <code xmlns=
419: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 420: "filename">Makefile</code></a></span></dt>
421:
422: <dt><span class="sect1"><a href=
1.45 wiz 423: "#components.distinfo">8.2. <code xmlns=
424: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 425: "filename">distinfo</code></a></span></dt>
426:
427: <dt><span class="sect1"><a href=
1.38 dillo 428: "#components.patches">8.3.
1.27 rillig 429: patches/*</a></span></dt>
430:
1.30 wiz 431: <dt><span class="sect1"><a href=
1.38 dillo 432: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 433: files</a></span></dt>
1.27 rillig 434:
435: <dt><span class="sect1"><a href=
1.38 dillo 436: "#components.optional">8.5. Optional
1.27 rillig 437: files</a></span></dt>
438:
1.38 dillo 439: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 440: <code xmlns=
441: "http://www.w3.org/TR/xhtml1/transitional" class=
442: "filename">work*</code></a></span></dt>
1.27 rillig 443:
1.38 dillo 444: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 445: <code xmlns=
446: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 447: "filename">files/*</code></a></span></dt>
448: </dl>
449: </dd>
450:
1.38 dillo 451: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 452: Programming in <code xmlns=
453: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 454: "filename">Makefile</code>s</a></span></dt>
455:
456: <dd>
457: <dl>
458: <dt><span class="sect1"><a href=
1.45 wiz 459: "#makefile.variables">9.1. <code xmlns=
460: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 461: "filename">Makefile</code>
462: variables</a></span></dt>
463:
1.27 rillig 464: <dd>
465: <dl>
466: <dt><span class="sect2"><a href=
1.38 dillo 467: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 468: conventions</a></span></dt>
469: </dl>
470: </dd>
471:
1.25 rillig 472: <dt><span class="sect1"><a href=
1.38 dillo 473: "#makefile.code">9.2. Code snippets</a></span></dt>
1.25 rillig 474:
475: <dd>
476: <dl>
477: <dt><span class="sect2"><a href=
1.38 dillo 478: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 479: list</a></span></dt>
480:
481: <dt><span class="sect2"><a href=
1.38 dillo 482: "#converting-internal-to-external">9.2.2.
1.30 wiz 483: Converting an internal list into an external
484: list</a></span></dt>
1.25 rillig 485:
486: <dt><span class="sect2"><a href=
1.38 dillo 487: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 488: variables to a shell command</a></span></dt>
1.27 rillig 489:
490: <dt><span class="sect2"><a href=
1.38 dillo 491: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 492: guideline</a></span></dt>
493:
494: <dt><span class="sect2"><a href=
1.38 dillo 495: "#bsd-make-bug-workaround">9.2.5. Workaround
1.30 wiz 496: for a bug in BSD Make</a></span></dt>
1.25 rillig 497: </dl>
498: </dd>
499: </dl>
500: </dd>
501:
1.38 dillo 502: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 503: issues</a></span></dt>
504:
505: <dd>
506: <dl>
1.38 dillo 507: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.30 wiz 508: ID</a></span></dt>
1.1 grant 509:
1.30 wiz 510: <dt><span class="sect1"><a href=
1.38 dillo 511: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 512: <code xmlns=
513: "http://www.w3.org/TR/xhtml1/transitional" class=
514: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 515:
1.38 dillo 516: <dt><span class="sect1"><a href=
517: "#print-PLIST">10.3. Tweaking output of
518: <span><strong class="command">make
1.14 xtraeme 519: print-PLIST</strong></span></a></span></dt>
1.1 grant 520:
1.38 dillo 521: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 522: Variable substitution in PLIST</a></span></dt>
523:
1.30 wiz 524: <dt><span class="sect1"><a href=
1.48 dillo 525: "#manpage-compression">10.5. Man page
526: compression</a></span></dt>
1.1 grant 527:
1.30 wiz 528: <dt><span class="sect1"><a href=
1.38 dillo 529: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 530: <code class=
1.14 xtraeme 531: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 532:
1.30 wiz 533: <dt><span class="sect1"><a href=
1.47 reed 534: "#platform-specific-plist">10.7. Platform-specific
1.30 wiz 535: and differing PLISTs</a></span></dt>
1.1 grant 536:
537: <dt><span class="sect1"><a href=
1.38 dillo 538: "#faq.common-dirs">10.8. Sharing directories
539: between packages</a></span></dt>
1.1 grant 540: </dl>
541: </dd>
542:
1.38 dillo 543: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 544: Buildlink methodology</a></span></dt>
545:
546: <dd>
547: <dl>
1.30 wiz 548: <dt><span class="sect1"><a href=
1.38 dillo 549: "#converting-to-buildlink3">11.1. Converting
1.30 wiz 550: packages to use buildlink3</a></span></dt>
1.1 grant 551:
1.30 wiz 552: <dt><span class="sect1"><a href=
1.38 dillo 553: "#creating-buildlink3.mk">11.2. Writing
1.45 wiz 554: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
555: class="filename">buildlink3.mk</code>
1.14 xtraeme 556: files</a></span></dt>
1.1 grant 557:
558: <dd>
559: <dl>
560: <dt><span class="sect2"><a href=
1.38 dillo 561: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 562: buildlink3.mk file</a></span></dt>
1.1 grant 563:
564: <dt><span class="sect2"><a href=
1.38 dillo 565: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 566: <code class=
1.72 rillig 567: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 568: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 569: <code xmlns=
570: "http://www.w3.org/TR/xhtml1/transitional"
571: class="filename">buildlink3.mk</code>
1.1 grant 572: files</a></span></dt>
573: </dl>
574: </dd>
575:
1.30 wiz 576: <dt><span class="sect1"><a href=
1.45 wiz 577: "#writing-builtin.mk">11.3. Writing <code xmlns=
578: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 579: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 580:
581: <dd>
582: <dl>
583: <dt><span class="sect2"><a href=
1.38 dillo 584: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 585: <code xmlns=
586: "http://www.w3.org/TR/xhtml1/transitional"
587: class="filename">builtin.mk</code>
1.1 grant 588: file</a></span></dt>
589:
590: <dt><span class="sect2"><a href=
1.38 dillo 591: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 592: preferences for native or pkgsrc
593: software</a></span></dt>
1.1 grant 594: </dl>
595: </dd>
596: </dl>
597: </dd>
598:
1.38 dillo 599: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 600: pkginstall framework</a></span></dt>
601:
602: <dd>
603: <dl>
604: <dt><span class="sect1"><a href=
1.38 dillo 605: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 606: directories outside the installation
607: prefix</a></span></dt>
608:
609: <dd>
610: <dl>
611: <dt><span class="sect2"><a href=
1.38 dillo 612: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 613: manipulation</a></span></dt>
614:
615: <dt><span class="sect2"><a href=
1.38 dillo 616: "#files-outside-prefix">12.1.2. File
1.35 jmmv 617: manipulation</a></span></dt>
618: </dl>
619: </dd>
620:
1.38 dillo 621: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 622: Configuration files</a></span></dt>
623:
624: <dd>
625: <dl>
626: <dt><span class="sect2"><a href=
1.38 dillo 627: "#conf-files-sysconfdir">12.2.1. How
1.35 jmmv 628: <code class="varname">PKG_SYSCONFDIR</code> is
629: set</a></span></dt>
630:
631: <dt><span class="sect2"><a href=
1.38 dillo 632: "#conf-files-configure">12.2.2. Telling the
1.47 reed 633: software where configuration files
1.35 jmmv 634: are</a></span></dt>
635:
636: <dt><span class="sect2"><a href=
1.38 dillo 637: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 638: installations</a></span></dt>
639:
640: <dt><span class="sect2"><a href=
1.38 dillo 641: "#conf-files-disable">12.2.4. Disabling
1.35 jmmv 642: handling of configuration files</a></span></dt>
643: </dl>
644: </dd>
645:
646: <dt><span class="sect1"><a href=
1.38 dillo 647: "#rcd-scripts">12.3. System startup
1.35 jmmv 648: scripts</a></span></dt>
649:
650: <dd>
651: <dl>
652: <dt><span class="sect2"><a href=
1.38 dillo 653: "#rcd-scripts-disable">12.3.1. Disabling
1.35 jmmv 654: handling of system startup
655: scripts</a></span></dt>
656: </dl>
657: </dd>
658:
659: <dt><span class="sect1"><a href=
1.38 dillo 660: "#users-and-groups">12.4. System users and
1.35 jmmv 661: groups</a></span></dt>
662:
1.38 dillo 663: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 664: System shells</a></span></dt>
665:
666: <dd>
667: <dl>
668: <dt><span class="sect2"><a href=
1.65 hubertf 669: "#shells-disable">12.5.1. Disabling shell
670: registration</a></span></dt>
671: </dl>
672: </dd>
673:
674: <dt><span class="sect1"><a href="#fonts">12.6.
675: Fonts</a></span></dt>
676:
677: <dd>
678: <dl>
679: <dt><span class="sect2"><a href=
680: "#fonts-disable">12.6.1. Disabling automatic
681: update of the fonts databases</a></span></dt>
1.35 jmmv 682: </dl>
683: </dd>
684: </dl>
685: </dd>
686:
1.38 dillo 687: <dt><span class="chapter"><a href="#options">13.
1.1 grant 688: Options handling</a></span></dt>
689:
690: <dd>
691: <dl>
1.30 wiz 692: <dt><span class="sect1"><a href=
1.38 dillo 693: "#global-default-options">13.1. Global default
1.30 wiz 694: options</a></span></dt>
1.1 grant 695:
1.30 wiz 696: <dt><span class="sect1"><a href=
1.38 dillo 697: "#converting-to-options">13.2. Converting packages
1.45 wiz 698: to use <code xmlns=
699: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 700: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 701:
702: <dt><span class="sect1"><a href=
703: "#option-names">13.3. Option Names</a></span></dt>
1.1 grant 704: </dl>
705: </dd>
706:
1.38 dillo 707: <dt><span class="chapter"><a href="#build">14. The
1.1 grant 708: build process</a></span></dt>
709:
710: <dd>
711: <dl>
712: <dt><span class="sect1"><a href=
1.56 rillig 713: "#build.intro">14.1. Introduction</a></span></dt>
714:
715: <dt><span class="sect1"><a href=
716: "#build.prefix">14.2. Program
1.1 grant 717: location</a></span></dt>
718:
1.30 wiz 719: <dt><span class="sect1"><a href=
1.56 rillig 720: "#build.builddirs">14.3. Directories used during
721: the build process</a></span></dt>
722:
723: <dt><span class="sect1"><a href=
724: "#build.running">14.4. Running a
725: phase</a></span></dt>
726:
727: <dt><span class="sect1"><a href=
728: "#build.fetch">14.5. The <span class=
729: "emphasis"><em>fetch</em></span>
730: phase</a></span></dt>
731:
732: <dt><span class="sect1"><a href=
733: "#build.checksum">14.6. The <span class=
734: "emphasis"><em>checksum</em></span>
735: phase</a></span></dt>
736:
737: <dt><span class="sect1"><a href=
738: "#build.extract">14.7. The <span class=
739: "emphasis"><em>extract</em></span>
740: phase</a></span></dt>
741:
742: <dt><span class="sect1"><a href=
743: "#build.patch">14.8. The <span class=
744: "emphasis"><em>patch</em></span>
745: phase</a></span></dt>
746:
747: <dt><span class="sect1"><a href=
748: "#build.tools">14.9. The <span class=
749: "emphasis"><em>tools</em></span>
750: phase</a></span></dt>
751:
752: <dt><span class="sect1"><a href=
753: "#build.wrapper">14.10. The <span class=
754: "emphasis"><em>wrapper</em></span>
755: phase</a></span></dt>
756:
757: <dt><span class="sect1"><a href=
758: "#build.configure">14.11. The <span class=
759: "emphasis"><em>configure</em></span>
760: phase</a></span></dt>
761:
762: <dt><span class="sect1"><a href=
763: "#build.build">14.12. The <span class=
764: "emphasis"><em>build</em></span>
765: phase</a></span></dt>
766:
767: <dt><span class="sect1"><a href=
768: "#build.test">14.13. The <span class=
769: "emphasis"><em>test</em></span>
770: phase</a></span></dt>
771:
772: <dt><span class="sect1"><a href=
773: "#build.install">14.14. The <span class=
774: "emphasis"><em>install</em></span>
775: phase</a></span></dt>
1.1 grant 776:
777: <dt><span class="sect1"><a href=
1.56 rillig 778: "#build.package">14.15. The <span class=
779: "emphasis"><em>package</em></span>
780: phase</a></span></dt>
781:
782: <dt><span class="sect1"><a href=
783: "#build.helpful-targets">14.16. Other helpful
1.1 grant 784: targets</a></span></dt>
785: </dl>
786: </dd>
787:
1.68 rillig 788: <dt><span class="chapter"><a href="#tools">15. Tools
789: needed for building or running</a></span></dt>
790:
791: <dd>
792: <dl>
793: <dt><span class="sect1"><a href=
794: "#pkgsrc-tools">15.1. Tools for pkgsrc
795: builds</a></span></dt>
796:
797: <dt><span class="sect1"><a href=
798: "#package-tools">15.2. Tools needed by
799: packages</a></span></dt>
800:
801: <dt><span class="sect1"><a href=
802: "#platform-tools">15.3. Tools provided by
803: platforms</a></span></dt>
804: </dl>
805: </dd>
806:
807: <dt><span class="chapter"><a href="#fixes">16. Making
1.55 rillig 808: your package work</a></span></dt>
1.1 grant 809:
810: <dd>
811: <dl>
1.30 wiz 812: <dt><span class="sect1"><a href=
1.68 rillig 813: "#general-operation">16.1. General
1.30 wiz 814: operation</a></span></dt>
1.1 grant 815:
816: <dd>
817: <dl>
818: <dt><span class="sect2"><a href=
1.68 rillig 819: "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30 wiz 820: pull in variables from
821: /etc/mk.conf</a></span></dt>
1.1 grant 822:
823: <dt><span class="sect2"><a href=
1.68 rillig 824: "#where-to-install-documentation">16.1.2. Where
1.31 wiz 825: to install documentation</a></span></dt>
826:
827: <dt><span class="sect2"><a href=
1.68 rillig 828: "#restricted-packages">16.1.3. Restricted
1.1 grant 829: packages</a></span></dt>
830:
831: <dt><span class="sect2"><a href=
1.68 rillig 832: "#dependencies">16.1.4. Handling
1.1 grant 833: dependencies</a></span></dt>
834:
835: <dt><span class="sect2"><a href=
1.68 rillig 836: "#conflicts">16.1.5. Handling conflicts with
1.1 grant 837: other packages</a></span></dt>
838:
839: <dt><span class="sect2"><a href=
1.68 rillig 840: "#not-building-packages">16.1.6. Packages that
1.30 wiz 841: cannot or should not be built</a></span></dt>
1.1 grant 842:
843: <dt><span class="sect2"><a href=
1.68 rillig 844: "#undeletable-packages">16.1.7. Packages which
1.30 wiz 845: should not be deleted, once
846: installed</a></span></dt>
1.1 grant 847:
848: <dt><span class="sect2"><a href=
1.68 rillig 849: "#security-handling">16.1.8. Handling packages
1.1 grant 850: with security problems</a></span></dt>
851:
852: <dt><span class="sect2"><a href=
1.68 rillig 853: "#compiler-bugs">16.1.9. How to handle compiler
1.1 grant 854: bugs</a></span></dt>
855:
856: <dt><span class="sect2"><a href=
1.68 rillig 857: "#bumping-pkgrevision">16.1.10. How to handle
1.30 wiz 858: incrementing versions when fixing an existing
1.1 grant 859: package</a></span></dt>
860:
861: <dt><span class="sect2"><a href=
1.68 rillig 862: "#portability-of-packages">16.1.11. Portability
1.30 wiz 863: of packages</a></span></dt>
1.1 grant 864: </dl>
865: </dd>
866:
1.30 wiz 867: <dt><span class="sect1"><a href=
1.68 rillig 868: "#downloading-issues">16.2. Possible downloading
1.30 wiz 869: issues</a></span></dt>
1.1 grant 870:
871: <dd>
872: <dl>
873: <dt><span class="sect2"><a href=
1.68 rillig 874: "#no-plain-download">16.2.1. Packages whose
1.30 wiz 875: distfiles aren't available for plain
1.1 grant 876: downloading</a></span></dt>
877:
878: <dt><span class="sect2"><a href=
1.68 rillig 879: "#modified-distfiles-same-name">16.2.2. How to
1.30 wiz 880: handle modified distfiles with the 'old'
881: name</a></span></dt>
1.1 grant 882: </dl>
883: </dd>
884:
1.30 wiz 885: <dt><span class="sect1"><a href=
1.68 rillig 886: "#configuration-gotchas">16.3. Configuration
1.30 wiz 887: gotchas</a></span></dt>
1.1 grant 888:
889: <dd>
890: <dl>
891: <dt><span class="sect2"><a href=
1.68 rillig 892: "#fixes.libtool">16.3.1. Shared libraries -
1.1 grant 893: libtool</a></span></dt>
894:
895: <dt><span class="sect2"><a href=
1.68 rillig 896: "#using-libtool">16.3.2. Using libtool on GNU
1.1 grant 897: packages that already support
898: libtool</a></span></dt>
899:
900: <dt><span class="sect2"><a href=
1.68 rillig 901: "#autoconf-automake">16.3.3. GNU
1.1 grant 902: Autoconf/Automake</a></span></dt>
903: </dl>
904: </dd>
905:
1.30 wiz 906: <dt><span class="sect1"><a href=
1.68 rillig 907: "#fixes-build">16.4. Building the
1.55 rillig 908: package</a></span></dt>
1.1 grant 909:
910: <dd>
911: <dl>
912: <dt><span class="sect2"><a href=
1.68 rillig 913: "#cpp-defines">16.4.1. CPP
1.1 grant 914: defines</a></span></dt>
1.51 rillig 915:
916: <dt><span class="sect2"><a href=
1.68 rillig 917: "#cpp-list-examples">16.4.2. Examples of CPP
1.60 rillig 918: defines for some platforms</a></span></dt>
919:
920: <dt><span class="sect2"><a href=
1.68 rillig 921: "#cpp-list">16.4.3. Getting a list of CPP
1.51 rillig 922: defines</a></span></dt>
1.1 grant 923: </dl>
924: </dd>
925:
1.30 wiz 926: <dt><span class="sect1"><a href=
1.68 rillig 927: "#package-specific-actions">16.5. Package specific
1.30 wiz 928: actions</a></span></dt>
1.1 grant 929:
930: <dd>
931: <dl>
932: <dt><span class="sect2"><a href=
1.68 rillig 933: "#user-interaction">16.5.1. User
1.2 hubertf 934: interaction</a></span></dt>
1.1 grant 935:
936: <dt><span class="sect2"><a href=
1.68 rillig 937: "#handling-licenses">16.5.2. Handling
1.1 grant 938: licenses</a></span></dt>
939:
940: <dt><span class="sect2"><a href=
1.68 rillig 941: "#installing-score-files">16.5.3. Installing
1.30 wiz 942: score files</a></span></dt>
1.1 grant 943:
944: <dt><span class="sect2"><a href=
1.68 rillig 945: "#perl-scripts">16.5.4. Packages containing
1.30 wiz 946: perl scripts</a></span></dt>
1.1 grant 947:
948: <dt><span class="sect2"><a href=
1.68 rillig 949: "#hardcoded-paths">16.5.5. Packages with
1.30 wiz 950: hardcoded paths to other
951: interpreters</a></span></dt>
1.1 grant 952:
953: <dt><span class="sect2"><a href=
1.68 rillig 954: "#perl-modules">16.5.6. Packages installing
1.30 wiz 955: perl modules</a></span></dt>
1.1 grant 956:
957: <dt><span class="sect2"><a href=
1.68 rillig 958: "#faq.info-files">16.5.7. Packages installing
1.1 grant 959: info files</a></span></dt>
960:
961: <dt><span class="sect2"><a href=
1.68 rillig 962: "#manpages">16.5.8. Packages installing man
1.57 minskim 963: pages</a></span></dt>
964:
965: <dt><span class="sect2"><a href=
1.68 rillig 966: "#gconf2-data-files">16.5.9. Packages
1.30 wiz 967: installing GConf2 data files</a></span></dt>
1.1 grant 968:
969: <dt><span class="sect2"><a href=
1.68 rillig 970: "#scrollkeeper-data-files">16.5.10. Packages
1.30 wiz 971: installing scrollkeeper data
972: files</a></span></dt>
1.1 grant 973:
974: <dt><span class="sect2"><a href=
1.68 rillig 975: "#x11-fonts">16.5.11. Packages installing X11
1.1 grant 976: fonts</a></span></dt>
977:
978: <dt><span class="sect2"><a href=
1.68 rillig 979: "#gtk2-modules">16.5.12. Packages installing
1.30 wiz 980: GTK2 modules</a></span></dt>
1.1 grant 981:
982: <dt><span class="sect2"><a href=
1.68 rillig 983: "#sgml-xml-data">16.5.13. Packages installing
1.30 wiz 984: SGML or XML data</a></span></dt>
1.1 grant 985:
986: <dt><span class="sect2"><a href=
1.68 rillig 987: "#mime-database">16.5.14. Packages installing
1.1 grant 988: extensions to the MIME database</a></span></dt>
989:
990: <dt><span class="sect2"><a href=
1.68 rillig 991: "#intltool">16.5.15. Packages using
1.1 grant 992: intltool</a></span></dt>
1.18 xtraeme 993:
994: <dt><span class="sect2"><a href=
1.68 rillig 995: "#startup-scripts">16.5.16. Packages installing
1.18 xtraeme 996: startup scripts</a></span></dt>
1.57 minskim 997:
998: <dt><span class="sect2"><a href=
1.68 rillig 999: "#tex-packages">16.5.17. Packages installing
1.57 minskim 1000: TeX modules</a></span></dt>
1.1 grant 1001: </dl>
1002: </dd>
1003:
1.30 wiz 1004: <dt><span class="sect1"><a href=
1.68 rillig 1005: "#feedback-to-author">16.6. Feedback to the
1.30 wiz 1006: author</a></span></dt>
1.1 grant 1007: </dl>
1008: </dd>
1009:
1.68 rillig 1010: <dt><span class="chapter"><a href="#debug">17.
1.1 grant 1011: Debugging</a></span></dt>
1012:
1.68 rillig 1013: <dt><span class="chapter"><a href="#submit">18.
1.1 grant 1014: Submitting and Committing</a></span></dt>
1015:
1016: <dd>
1017: <dl>
1.30 wiz 1018: <dt><span class="sect1"><a href=
1.74 ! rillig 1019: "#submitting-binary-packages">18.1. Submitting
! 1020: binary packages</a></span></dt>
! 1021:
! 1022: <dt><span class="sect1"><a href=
! 1023: "#submitting-your-package">18.2. Submitting source
! 1024: packages (for
! 1025: non-NetBSD-developers)</a></span></dt>
1.1 grant 1026:
1.30 wiz 1027: <dt><span class="sect1"><a href=
1.74 ! rillig 1028: "#general-notes-for-changes">18.3. General notes
1.41 wiz 1029: when adding, updating, or removing
1030: packages</a></span></dt>
1031:
1032: <dt><span class="sect1"><a href=
1.74 ! rillig 1033: "#committing-importing">18.4. Committing: Importing
1.30 wiz 1034: a package into CVS</a></span></dt>
1.1 grant 1035:
1.30 wiz 1036: <dt><span class="sect1"><a href=
1.74 ! rillig 1037: "#updating-package">18.5. Updating a package to a
1.30 wiz 1038: newer version</a></span></dt>
1.1 grant 1039:
1.30 wiz 1040: <dt><span class="sect1"><a href=
1.74 ! rillig 1041: "#moving-package">18.6. Moving a package in
1.30 wiz 1042: pkgsrc</a></span></dt>
1.1 grant 1043: </dl>
1044: </dd>
1.69 rillig 1045:
1.72 rillig 1046: <dt><span class="chapter"><a href="#devfaq">19.
1047: Frequently Asked Questions</a></span></dt>
1048: </dl>
1049: </dd>
1050:
1051: <dt><span class="part"><a href="#infrastructure">III. The
1.73 rillig 1052: pkgsrc infrastructure internals</a></span></dt>
1.72 rillig 1053:
1054: <dd>
1055: <dl>
1.73 rillig 1056: <dt><span class="chapter"><a href="#infr.design">20.
1057: Design of the pkgsrc infrastructure</a></span></dt>
1058:
1059: <dd>
1060: <dl>
1061: <dt><span class="sect1"><a href="#infr.var">20.1.
1062: Variable evaluation</a></span></dt>
1063:
1064: <dd>
1065: <dl>
1066: <dt><span class="sect2"><a href=
1067: "#infr.var.load">20.1.1. At load
1068: time</a></span></dt>
1069:
1070: <dt><span class="sect2"><a href=
1071: "#infr.var.run">20.1.2. At
1072: runtime</a></span></dt>
1073: </dl>
1074: </dd>
1075:
1076: <dt><span class="sect1"><a href=
1077: "#infr.design.intf">20.2. Designing interfaces for
1078: Makefile fragments</a></span></dt>
1079:
1080: <dd>
1081: <dl>
1082: <dt><span class="sect2"><a href=
1083: "#infr.design.intf.proc">20.2.1. Procedures
1084: with parameters</a></span></dt>
1085:
1086: <dt><span class="sect2"><a href=
1087: "#infr.design.intf.action">20.2.2. Actions
1088: taken on behalf of parameters</a></span></dt>
1089: </dl>
1090: </dd>
1091: </dl>
1092: </dd>
1093:
1094: <dt><span class="chapter"><a href="#regression">21.
1.72 rillig 1095: Regression tests</a></span></dt>
1096:
1097: <dd>
1098: <dl>
1099: <dt><span class="sect1"><a href=
1.73 rillig 1100: "#regression.descr">21.1. The regression tests
1.72 rillig 1101: framework</a></span></dt>
1102:
1103: <dt><span class="sect1"><a href=
1.73 rillig 1104: "#regression.run">21.2. Running the regression
1.72 rillig 1105: tests</a></span></dt>
1106:
1107: <dt><span class="sect1"><a href=
1.73 rillig 1108: "#regression.new">21.3. Adding a new regression
1.72 rillig 1109: test</a></span></dt>
1110:
1111: <dd>
1112: <dl>
1113: <dt><span class="sect2"><a href=
1.73 rillig 1114: "#regression.fun.override">21.3.1. Overridable
1.72 rillig 1115: functions</a></span></dt>
1116:
1117: <dt><span class="sect2"><a href=
1.73 rillig 1118: "#regression.fun.helper">21.3.2. Helper
1.72 rillig 1119: functions</a></span></dt>
1120: </dl>
1121: </dd>
1122: </dl>
1123: </dd>
1124:
1.73 rillig 1125: <dt><span class="chapter"><a href="#porting">22.
1.69 rillig 1126: Porting pkgsrc</a></span></dt>
1127:
1128: <dd>
1129: <dl>
1130: <dt><span class="sect1"><a href=
1.73 rillig 1131: "#porting.opsys">22.1. Porting pkgsrc to a new
1.69 rillig 1132: operating system</a></span></dt>
1133:
1134: <dt><span class="sect1"><a href=
1.73 rillig 1135: "#porting.compiler">22.2. Adding support for a new
1.69 rillig 1136: compiler</a></span></dt>
1137: </dl>
1138: </dd>
1.1 grant 1139: </dl>
1140: </dd>
1141:
1.46 gdt 1142: <dt><span class="appendix"><a href="#examples">A. A simple
1.1 grant 1143: example package: bison</a></span></dt>
1144:
1145: <dd>
1146: <dl>
1.46 gdt 1147: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 1148: files</a></span></dt>
1149:
1150: <dd>
1151: <dl>
1.30 wiz 1152: <dt><span class="sect2"><a href=
1.46 gdt 1153: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 1154:
1.30 wiz 1155: <dt><span class="sect2"><a href=
1.46 gdt 1156: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 1157:
1.30 wiz 1158: <dt><span class="sect2"><a href=
1.46 gdt 1159: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 1160:
1.30 wiz 1161: <dt><span class="sect2"><a href=
1.46 gdt 1162: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 1163: package with <span><strong class=
1.14 xtraeme 1164: "command">pkglint</strong></span></a></span></dt>
1.1 grant 1165: </dl>
1166: </dd>
1167:
1.46 gdt 1168: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 1169: Steps for building, installing,
1170: packaging</a></span></dt>
1.1 grant 1171: </dl>
1172: </dd>
1173:
1.46 gdt 1174: <dt><span class="appendix"><a href="#logs">B. Build
1.1 grant 1175: logs</a></span></dt>
1176:
1177: <dd>
1178: <dl>
1.46 gdt 1179: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 1180: Building figlet</a></span></dt>
1181:
1.46 gdt 1182: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 1183: Packaging figlet</a></span></dt>
1184: </dl>
1185: </dd>
1186:
1.46 gdt 1187: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1 grant 1188: of the FTP server's package archive</a></span></dt>
1.2 hubertf 1189:
1.46 gdt 1190: <dt><span class="appendix"><a href="#editing">D. Editing
1.2 hubertf 1191: guidelines for the pkgsrc guide</a></span></dt>
1192:
1193: <dd>
1194: <dl>
1.46 gdt 1195: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 1196: Targets</a></span></dt>
1197:
1.46 gdt 1198: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 1199: Procedure</a></span></dt>
1200: </dl>
1201: </dd>
1.1 grant 1202: </dl>
1203: </div>
1204:
1.67 hubertf 1205: <div class="chapter" lang="en">
1.1 grant 1206: <div class="titlepage">
1207: <div>
1208: <div>
1.67 hubertf 1209: <h2 class="title"><a name=
1.51 rillig 1210: "introduction"></a>Chapter 1. What is
1211: pkgsrc?</h2>
1.1 grant 1212: </div>
1213: </div>
1214: </div>
1215:
1216: <div class="toc">
1217: <p><b>Table of Contents</b></p>
1218:
1219: <dl>
1.30 wiz 1220: <dt><span class="sect1"><a href=
1221: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 1222:
1223: <dt><span class="sect1"><a href="#overview">1.2.
1224: Overview</a></span></dt>
1225:
1226: <dt><span class="sect1"><a href="#terminology">1.3.
1227: Terminology</a></span></dt>
1228:
1.74 ! rillig 1229: <dd>
! 1230: <dl>
! 1231: <dt><span class="sect2"><a href="#term.people">1.3.1.
! 1232: People involved in pkgsrc</a></span></dt>
! 1233: </dl>
! 1234: </dd>
! 1235:
1.1 grant 1236: <dt><span class="sect1"><a href="#typography">1.4.
1237: Typography</a></span></dt>
1238: </dl>
1239: </div>
1240:
1.67 hubertf 1241: <div class="sect1" lang="en">
1.1 grant 1242: <div class="titlepage">
1243: <div>
1244: <div>
1245: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1246: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 1247: </div>
1248: </div>
1249: </div>
1250:
1.47 reed 1251: <p>There is a lot of software freely available for
1252: Unix-based systems, which usually runs on NetBSD and other
1.1 grant 1253: Unix-flavoured systems, too, sometimes with some
1254: modifications. The NetBSD Packages Collection (pkgsrc)
1255: incorporates any such changes necessary to make that
1256: software run, and makes the installation (and
1257: de-installation) of the software package easy by means of a
1258: single command.</p>
1259:
1260: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 1261: the <span><strong class="command">pkg_*</strong></span>
1262: tools so that installation and de-installation, printing of
1263: an inventory of all installed packages and retrieval of
1264: one-line comments or more verbose descriptions are all
1265: simple.</p>
1.1 grant 1266:
1267: <p>pkgsrc currently contains several thousand packages,
1268: including:</p>
1269:
1270: <div class="itemizedlist">
1271: <ul type="disc">
1272: <li>
1273: <p><a xmlns=
1274: "http://www.w3.org/TR/xhtml1/transitional" href=
1275: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45 wiz 1276: target="_top"><code xmlns="" class=
1277: "filename">www/apache</code></a> - The Apache web
1.20 ben 1278: server</p>
1.1 grant 1279: </li>
1280:
1281: <li>
1282: <p><a xmlns=
1283: "http://www.w3.org/TR/xhtml1/transitional" href=
1284: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 1285: target="_top"><code xmlns="" class=
1286: "filename">www/mozilla</code></a> - The Mozilla web
1.20 ben 1287: browser</p>
1.1 grant 1288: </li>
1289:
1290: <li>
1291: <p><a xmlns=
1292: "http://www.w3.org/TR/xhtml1/transitional" href=
1293: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45 wiz 1294: target="_top"><code xmlns="" class=
1295: "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20 ben 1296: Desktop Environment</p>
1.1 grant 1297: </li>
1298:
1299: <li>
1300: <p><a xmlns=
1301: "http://www.w3.org/TR/xhtml1/transitional" href=
1302: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45 wiz 1303: target="_top"><code xmlns="" class=
1304: "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20 ben 1305: Environment</p>
1.1 grant 1306: </li>
1307: </ul>
1308: </div>
1309:
1310: <p>...just to name a few.</p>
1311:
1312: <p>pkgsrc has built-in support for handling varying
1313: dependencies, such as pthreads and X11, and extended
1314: features such as IPv6 support on a range of platforms.</p>
1315:
1316: <p>pkgsrc was derived from FreeBSD's ports system, and
1317: initially developed for NetBSD only. Since then, pkgsrc has
1318: grown a lot, and now supports the following platforms:</p>
1319:
1320: <div class="itemizedlist">
1321: <ul type="disc">
1322: <li>
1323: <p><a href="http://developer.apple.com/darwin/"
1324: target="_top">Darwin</a> (<a href=
1325: "http://www.apple.com/macosx/" target="_top">Mac OS
1326: X</a>)</p>
1327: </li>
1328:
1329: <li>
1.3 hubertf 1330: <p><a href="http://www.DragonFlyBSD.org/" target=
1.70 rillig 1331: "_top">DragonFly BSD</a></p>
1.3 hubertf 1332: </li>
1333:
1334: <li>
1.1 grant 1335: <p><a href="http://www.FreeBSD.org/" target=
1336: "_top">FreeBSD</a></p>
1337: </li>
1338:
1339: <li>
1.3 hubertf 1340: <p>Microsoft Windows, via <a href=
1341: "http://www.microsoft.com/windows/sfu/" target=
1342: "_top">Interix</a></p>
1.1 grant 1343: </li>
1344:
1345: <li>
1346: <p><a href="http://www.sgi.com/software/irix6.5/"
1347: target="_top">IRIX</a></p>
1348: </li>
1349:
1350: <li>
1351: <p><a href="http://www.linux.org/" target=
1352: "_top">Linux</a></p>
1353: </li>
1354:
1355: <li>
1356: <p><a href="http://www.NetBSD.org/" target=
1357: "_top">NetBSD</a> (of course)</p>
1358: </li>
1359:
1360: <li>
1.17 sketch 1361: <p><a href="http://h30097.www3.hp.com/" target=
1362: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1363: </li>
1364:
1365: <li>
1.1 grant 1366: <p><a href="http://www.openbsd.org/" target=
1367: "_top">OpenBSD</a></p>
1368: </li>
1369:
1370: <li>
1371: <p><a href="http://www.sun.com/solaris/" target=
1372: "_top">Solaris</a></p>
1373: </li>
1374: </ul>
1375: </div>
1376: </div>
1377:
1.67 hubertf 1378: <div class="sect1" lang="en">
1.1 grant 1379: <div class="titlepage">
1380: <div>
1381: <div>
1382: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1383: "overview"></a>1.2. Overview</h2>
1.1 grant 1384: </div>
1385: </div>
1386: </div>
1387:
1.73 rillig 1388: <p>This document is divided into three parts. The first,
1.1 grant 1389: <a href="#users-guide" title=
1.46 gdt 1390: "Part I. The pkgsrc user's guide">The pkgsrc
1.2 hubertf 1391: user's guide</a>, describes how one can use one of the
1392: packages in the Package Collection, either by installing a
1393: precompiled binary package, or by building one's own copy
1394: using the NetBSD package system. The second part, <a href=
1.1 grant 1395: "#developers-guide" title=
1.46 gdt 1396: "Part II. The pkgsrc developer's guide">The
1397: pkgsrc developer's guide</a>, explains how to prepare a
1398: package so it can be easily built by other NetBSD users
1.73 rillig 1399: without knowing about the package's building details. The
1400: third part, <a href="#infrastructure" title=
1401: "Part III. The pkgsrc infrastructure internals">The
1402: pkgsrc infrastructure internals</a> is intended for those
1403: who want to understand how pkgsrc is implemented.</p>
1404:
1405: <p>This document is available in various formats:
1406: <span class="simplelist"><a href="index.html" target=
1407: "_top">HTML</a>, <a href="pkgsrc.pdf" target=
1408: "_top">PDF</a>, <a href="pkgsrc.ps" target="_top">PS</a>,
1409: <a href="pkgsrc.txt" target="_top">TXT</a></span>.</p>
1.1 grant 1410: </div>
1411:
1.67 hubertf 1412: <div class="sect1" lang="en">
1.1 grant 1413: <div class="titlepage">
1414: <div>
1415: <div>
1416: <h2 class="title" style="clear: both"><a name=
1417: "terminology"></a>1.3. Terminology</h2>
1418: </div>
1419: </div>
1420: </div>
1421:
1422: <p>There has been a lot of talk about “<span class=
1423: "quote">ports</span>”, “<span class=
1424: "quote">packages</span>”, etc. so far. Here is a
1425: description of all the terminology used within this
1426: document.</p>
1427:
1428: <div class="variablelist">
1429: <dl>
1430: <dt><span class="term">Package</span></dt>
1431:
1432: <dd>
1433: <p>A set of files and building instructions that
1434: describe what's necessary to build a certain piece of
1435: software using pkgsrc. Packages are traditionally
1.45 wiz 1436: stored under <code xmlns=
1437: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1438: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1439: </dd>
1440:
1441: <dt><span class="term">The NetBSD package
1442: system</span></dt>
1443:
1444: <dd>
1445: <p>This is the former name of “<span class=
1446: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1447: NetBSD operating system and can be bootstrapped to
1448: run on non-NetBSD operating systems as well. It
1449: handles building (compiling), installing, and
1450: removing of packages.</p>
1.1 grant 1451: </dd>
1452:
1453: <dt><span class="term">Distfile</span></dt>
1454:
1455: <dd>
1456: <p>This term describes the file or files that are
1457: provided by the author of the piece of software to
1458: distribute his work. All the changes necessary to
1459: build on NetBSD are reflected in the corresponding
1460: package. Usually the distfile is in the form of a
1461: compressed tar-archive, but other types are possible,
1.45 wiz 1462: too. Distfiles are usually stored below <code xmlns=
1463: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1464: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1465: </dd>
1466:
1467: <dt><span class="term">Port</span></dt>
1468:
1469: <dd>
1470: <p>This is the term used by FreeBSD and OpenBSD
1471: people for what we call a package. In NetBSD
1472: terminology, “<span class=
1473: "quote">port</span>” refers to a different
1474: architecture.</p>
1475: </dd>
1476:
1477: <dt><span class="term">Precompiled/binary
1478: package</span></dt>
1479:
1480: <dd>
1481: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1482: distfile and stuffed together in a single
1.45 wiz 1483: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1484: class="filename">.tgz</code> file so it can be
1.14 xtraeme 1485: installed on machines of the same machine
1486: architecture without the need to recompile. Packages
1.45 wiz 1487: are usually generated in <code xmlns=
1488: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1489: "filename">/usr/pkgsrc/packages</code>; there is also
1490: an archive on <a href=
1.1 grant 1491: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1492: "_top">ftp.NetBSD.org</a>.</p>
1493:
1494: <p>Sometimes, this is referred to by the term
1495: “<span class="quote">package</span>” too,
1496: especially in the context of precompiled
1497: packages.</p>
1498: </dd>
1499:
1500: <dt><span class="term">Program</span></dt>
1501:
1502: <dd>
1503: <p>The piece of software to be installed which will
1.47 reed 1504: be constructed from all the files in the distfile by
1.1 grant 1505: the actions defined in the corresponding package.</p>
1506: </dd>
1507: </dl>
1508: </div>
1.74 ! rillig 1509:
! 1510: <div class="sect2" lang="en">
! 1511: <div class="titlepage">
! 1512: <div>
! 1513: <div>
! 1514: <h3 class="title"><a name=
! 1515: "term.people"></a>1.3.1. People involved in
! 1516: pkgsrc</h3>
! 1517: </div>
! 1518: </div>
! 1519: </div>
! 1520:
! 1521: <div class="variablelist">
! 1522: <dl>
! 1523: <dt><span class="term">pkgsrc users</span></dt>
! 1524:
! 1525: <dd>
! 1526: <p>The pkgsrc users are people who use the packages
! 1527: provided by pkgsrc. Typically they are system
! 1528: administrators. The people using the software that
! 1529: is inside the packages (maybe called
! 1530: “<span class="quote">end users</span>”)
! 1531: are not covered by the pkgsrc guide.</p>
! 1532:
! 1533: <p>There are two kinds of pkgsrc users: Some only
! 1534: want to install pre-built binary packages. Others
! 1535: build the pkgsrc packages from source, either for
! 1536: installing them directly or for building binary
! 1537: packages themselves. For pkgsrc users <a href=
! 1538: "#users-guide" title=
! 1539: "Part I. The pkgsrc user's guide">Part I,
! 1540: “The pkgsrc user's guide”</a> should
! 1541: provide all necessary documentation.</p>
! 1542: </dd>
! 1543:
! 1544: <dt><span class="term">package
! 1545: maintainers</span></dt>
! 1546:
! 1547: <dd>
! 1548: <p>A package maintainer creates packages as
! 1549: described in <a href="#developers-guide" title=
! 1550: "Part II. The pkgsrc developer's guide">Part II,
! 1551: “The pkgsrc developer's guide”</a>.</p>
! 1552: </dd>
! 1553:
! 1554: <dt><span class="term">infrastructure
! 1555: developers</span></dt>
! 1556:
! 1557: <dd>
! 1558: <p>These people are involved in all those files
! 1559: that live in the <code xmlns=
! 1560: "http://www.w3.org/TR/xhtml1/transitional" class=
! 1561: "filename">mk/</code> directory and below. Only
! 1562: these people should need to read through <a href=
! 1563: "#infrastructure" title=
! 1564: "Part III. The pkgsrc infrastructure internals">
! 1565: Part III, “The pkgsrc infrastructure
! 1566: internals”</a>, though others might be
! 1567: curious, too.</p>
! 1568: </dd>
! 1569: </dl>
! 1570: </div>
! 1571: </div>
1.1 grant 1572: </div>
1573:
1.67 hubertf 1574: <div class="sect1" lang="en">
1.1 grant 1575: <div class="titlepage">
1576: <div>
1577: <div>
1578: <h2 class="title" style="clear: both"><a name=
1579: "typography"></a>1.4. Typography</h2>
1580: </div>
1581: </div>
1582: </div>
1583:
1584: <p>When giving examples for commands, shell prompts are
1585: used to show if the command should/can be issued as root,
1586: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1587: privileges are sufficient. We use a <code class=
1588: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1589: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1590: assuming they use the C-shell or tcsh.</p>
1.1 grant 1591: </div>
1592: </div>
1593:
1.67 hubertf 1594: <div class="part" lang="en">
1.1 grant 1595: <div class="titlepage">
1596: <div>
1597: <div>
1.67 hubertf 1598: <h1 class="title"><a name=
1.48 dillo 1599: "users-guide"></a>Part I. The pkgsrc user's
1600: guide</h1>
1.1 grant 1601: </div>
1602: </div>
1603: </div>
1604:
1605: <div class="toc">
1606: <p><b>Table of Contents</b></p>
1607:
1608: <dl>
1609: <dt><span class="chapter"><a href="#getting">2. Where to
1.59 rillig 1610: get pkgsrc and how to keep it up-to-date</a></span></dt>
1.1 grant 1611:
1612: <dd>
1613: <dl>
1.30 wiz 1614: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1615: As tar file</a></span></dt>
1.1 grant 1616:
1.30 wiz 1617: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1618: SUP</a></span></dt>
1619:
1.30 wiz 1620: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1621: CVS</a></span></dt>
1.59 rillig 1622:
1623: <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
1624: Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1 grant 1625: </dl>
1626: </dd>
1627:
1628: <dt><span class="chapter"><a href="#platforms">3. Using
1629: pkgsrc on systems other than NetBSD</a></span></dt>
1630:
1631: <dd>
1632: <dl>
1.30 wiz 1633: <dt><span class="sect1"><a href=
1634: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1635: pkgsrc</a></span></dt>
1.1 grant 1636:
1.30 wiz 1637: <dt><span class="sect1"><a href=
1.47 reed 1638: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1639: notes</a></span></dt>
1.1 grant 1640:
1641: <dd>
1642: <dl>
1.30 wiz 1643: <dt><span class="sect2"><a href="#darwin">3.2.1.
1644: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1645:
1.30 wiz 1646: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1647: FreeBSD</a></span></dt>
1.22 tv 1648:
1.30 wiz 1649: <dt><span class="sect2"><a href="#interix">3.2.3.
1650: Interix</a></span></dt>
1.1 grant 1651:
1.30 wiz 1652: <dt><span class="sect2"><a href="#irix">3.2.4.
1653: IRIX</a></span></dt>
1.1 grant 1654:
1.30 wiz 1655: <dt><span class="sect2"><a href="#linux">3.2.5.
1656: Linux</a></span></dt>
1.1 grant 1657:
1.30 wiz 1658: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1659: OpenBSD</a></span></dt>
1.1 grant 1660:
1.30 wiz 1661: <dt><span class="sect2"><a href="#solaris">3.2.7.
1662: Solaris</a></span></dt>
1.1 grant 1663: </dl>
1664: </dd>
1665: </dl>
1666: </dd>
1667:
1668: <dt><span class="chapter"><a href="#using">4. Using
1669: pkgsrc</a></span></dt>
1670:
1671: <dd>
1672: <dl>
1.70 rillig 1673: <dt><span class="sect1"><a href="#using-pkg">4.1.
1674: Using binary packages</a></span></dt>
1.1 grant 1675:
1676: <dd>
1677: <dl>
1678: <dt><span class="sect2"><a href=
1.70 rillig 1679: "#finding-binary-packages">4.1.1. Finding binary
1680: packages</a></span></dt>
1.1 grant 1681:
1682: <dt><span class="sect2"><a href=
1.70 rillig 1683: "#installing-binary-packages">4.1.2. Installing
1.30 wiz 1684: binary packages</a></span></dt>
1.1 grant 1685:
1686: <dt><span class="sect2"><a href=
1.30 wiz 1687: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1688: warning</a></span></dt>
1689: </dl>
1690: </dd>
1691:
1.30 wiz 1692: <dt><span class="sect1"><a href=
1693: "#building-packages-from-source">4.2. Building
1694: packages from source</a></span></dt>
1.1 grant 1695:
1696: <dd>
1697: <dl>
1698: <dt><span class="sect2"><a href=
1.30 wiz 1699: "#requirements">4.2.1.
1700: Requirements</a></span></dt>
1.1 grant 1701:
1702: <dt><span class="sect2"><a href=
1.30 wiz 1703: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1704: distfiles</a></span></dt>
1705:
1706: <dt><span class="sect2"><a href=
1.30 wiz 1707: "#how-to-build-and-install">4.2.3. How to build
1708: and install</a></span></dt>
1.1 grant 1709:
1710: <dt><span class="sect2"><a href=
1.30 wiz 1711: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1712: compiler</a></span></dt>
1713: </dl>
1714: </dd>
1715: </dl>
1716: </dd>
1717:
1.38 dillo 1718: <dt><span class="chapter"><a href="#configuring">5.
1719: Configuring pkgsrc</a></span></dt>
1720:
1721: <dd>
1722: <dl>
1723: <dt><span class="sect1"><a href=
1.45 wiz 1724: "#general-configuration">5.1. General
1725: configuration</a></span></dt>
1726:
1727: <dt><span class="sect1"><a href=
1728: "#variables-affecting-build">5.2. Variables affecting
1729: the build process</a></span></dt>
1730:
1731: <dt><span class="sect1"><a href=
1732: "#developer-advanced-settings">5.3.
1733: Developer/advanced settings</a></span></dt>
1734:
1735: <dt><span class="sect1"><a href=
1736: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 1737: Options</a></span></dt>
1.38 dillo 1738: </dl>
1739: </dd>
1740:
1741: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 1742: binary packages</a></span></dt>
1743:
1744: <dd>
1745: <dl>
1.30 wiz 1746: <dt><span class="sect1"><a href=
1.38 dillo 1747: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 1748: single binary package</a></span></dt>
1.1 grant 1749:
1.30 wiz 1750: <dt><span class="sect1"><a href=
1.38 dillo 1751: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 1752: Settings for creation of binary
1753: packages</a></span></dt>
1754:
1.38 dillo 1755: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 1756: Doing a bulk build of all packages</a></span></dt>
1757:
1758: <dd>
1759: <dl>
1760: <dt><span class="sect2"><a href=
1.38 dillo 1761: "#binary.configuration">6.3.1.
1.1 grant 1762: Configuration</a></span></dt>
1763:
1764: <dt><span class="sect2"><a href=
1.38 dillo 1765: "#other-environmental-considerations">6.3.2.
1.30 wiz 1766: Other environmental
1.1 grant 1767: considerations</a></span></dt>
1768:
1769: <dt><span class="sect2"><a href=
1.38 dillo 1770: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 1771:
1772: <dt><span class="sect2"><a href=
1.38 dillo 1773: "#what-it-does">6.3.4. What it
1.30 wiz 1774: does</a></span></dt>
1.1 grant 1775:
1776: <dt><span class="sect2"><a href=
1.38 dillo 1777: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 1778: requirements</a></span></dt>
1779:
1780: <dt><span class="sect2"><a href=
1.38 dillo 1781: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 1782: sandbox for chrooted builds</a></span></dt>
1.1 grant 1783:
1784: <dt><span class="sect2"><a href=
1.38 dillo 1785: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 1786: partial set of packages</a></span></dt>
1.13 hubertf 1787:
1788: <dt><span class="sect2"><a href=
1.38 dillo 1789: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 1790: build</a></span></dt>
1.1 grant 1791: </dl>
1792: </dd>
1793:
1.30 wiz 1794: <dt><span class="sect1"><a href=
1.38 dillo 1795: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 1796: packages collection</a></span></dt>
1.1 grant 1797:
1798: <dd>
1799: <dl>
1800: <dt><span class="sect2"><a href=
1.38 dillo 1801: "#cdpack-example">6.4.1. Example of
1.1 grant 1802: cdpack</a></span></dt>
1803: </dl>
1804: </dd>
1805: </dl>
1806: </dd>
1807:
1.38 dillo 1808: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 1809: Asked Questions</a></span></dt>
1810:
1811: <dd>
1812: <dl>
1.30 wiz 1813: <dt><span class="sect1"><a href=
1.38 dillo 1814: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 1815: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1816:
1.38 dillo 1817: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 1818: Where's the pkgviews documentation?</a></span></dt>
1819:
1.38 dillo 1820: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 1821: Utilities for package management
1822: (pkgtools)</a></span></dt>
1823:
1.30 wiz 1824: <dt><span class="sect1"><a href=
1.38 dillo 1825: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 1826: non-root</a></span></dt>
1.1 grant 1827:
1.30 wiz 1828: <dt><span class="sect1"><a href=
1.38 dillo 1829: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 1830: fetching distfiles?</a></span></dt>
1.14 xtraeme 1831:
1.30 wiz 1832: <dt><span class="sect1"><a href=
1.38 dillo 1833: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 1834: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1835:
1.30 wiz 1836: <dt><span class="sect1"><a href=
1.38 dillo 1837: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 1838: from pkgsrc?</a></span></dt>
1.1 grant 1839:
1.30 wiz 1840: <dt><span class="sect1"><a href=
1.38 dillo 1841: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 1842: behind a firewall</a></span></dt>
1.1 grant 1843:
1.38 dillo 1844: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30 wiz 1845: How do I tell <span><strong class="command">make
1.14 xtraeme 1846: fetch</strong></span> to do passive
1.1 grant 1847: FTP?</a></span></dt>
1848:
1.30 wiz 1849: <dt><span class="sect1"><a href=
1.38 dillo 1850: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 1851: distfiles at once</a></span></dt>
1.1 grant 1852:
1.30 wiz 1853: <dt><span class="sect1"><a href=
1.38 dillo 1854: "#tmac.andoc-missing">7.11. What does
1.30 wiz 1855: “<span class="quote">Don't know how to make
1856: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1857: mean?</a></span></dt>
1.13 hubertf 1858:
1.30 wiz 1859: <dt><span class="sect1"><a href=
1.38 dillo 1860: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 1861: “<span class="quote">Could not find
1.14 xtraeme 1862: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1863:
1.30 wiz 1864: <dt><span class="sect1"><a href=
1.38 dillo 1865: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 1866: pkgsrc</a></span></dt>
1.1 grant 1867:
1.38 dillo 1868: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 1869: do I change the location of configuration
1870: files?</a></span></dt>
1.1 grant 1871:
1872: <dt><span class="sect1"><a href=
1.38 dillo 1873: "#audit-packages">7.15. Automated security
1.1 grant 1874: checks</a></span></dt>
1.74 ! rillig 1875:
! 1876: <dt><span class="sect1"><a href="#ufaq-cflags">7.16.
! 1877: Why do some packages ignore my <code class=
! 1878: "varname">CFLAGS</code>?</a></span></dt>
1.1 grant 1879: </dl>
1880: </dd>
1881: </dl>
1882: </div>
1883:
1.67 hubertf 1884: <div class="chapter" lang="en">
1.1 grant 1885: <div class="titlepage">
1886: <div>
1887: <div>
1.67 hubertf 1888: <h2 class="title"><a name=
1.1 grant 1889: "getting"></a>Chapter 2. Where to get
1.59 rillig 1890: pkgsrc and how to keep it up-to-date</h2>
1.1 grant 1891: </div>
1892: </div>
1893: </div>
1894:
1895: <div class="toc">
1896: <p><b>Table of Contents</b></p>
1897:
1898: <dl>
1.30 wiz 1899: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1900: tar file</a></span></dt>
1901:
1.30 wiz 1902: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1903: SUP</a></span></dt>
1904:
1.30 wiz 1905: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1906: CVS</a></span></dt>
1.59 rillig 1907:
1908: <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
1909: Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1 grant 1910: </dl>
1911: </div>
1912:
1913: <p>There are three ways to get pkgsrc. Either as a tar
1914: file, via SUP, or via CVS. All three ways are described
1915: here.</p>
1916:
1.67 hubertf 1917: <div class="sect1" lang="en">
1.1 grant 1918: <div class="titlepage">
1919: <div>
1920: <div>
1921: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1922: "as-tar-file"></a>2.1. As tar file</h2>
1.1 grant 1923: </div>
1924: </div>
1925: </div>
1926:
1927: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1928: file from <a href=
1.11 ben 1929: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1930: target="_top">ftp.NetBSD.org</a> and unpack it into
1.45 wiz 1931: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1932: class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1933: </div>
1934:
1.67 hubertf 1935: <div class="sect1" lang="en">
1.1 grant 1936: <div class="titlepage">
1937: <div>
1938: <div>
1939: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1940: "via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1941: </div>
1942: </div>
1943: </div>
1944:
1945: <p>As an alternative to the tar file, you can get pkgsrc
1946: via the Software Update Protocol, SUP. To do so, make
1947: sure your supfile has a line</p>
1948: <pre class="programlisting">
1.51 rillig 1949: release=pkgsrc
1.1 grant 1950: </pre>
1951:
1.45 wiz 1952: <p>in it, see the examples in <code xmlns=
1953: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1954: "filename">/usr/share/examples/supfiles</code>, and that
1.45 wiz 1955: the <code xmlns=
1956: "http://www.w3.org/TR/xhtml1/transitional" class=
1957: "filename">/usr/pkgsrc</code> directory exists. Then,
1958: simply run <span><strong class="command">sup -v
1959: <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1960: </div>
1961:
1.67 hubertf 1962: <div class="sect1" lang="en">
1.1 grant 1963: <div class="titlepage">
1964: <div>
1965: <div>
1966: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1967: "via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1968: </div>
1969: </div>
1970: </div>
1971:
1972: <p>To get pkgsrc via CVS, make sure you have
1973: “<span class="quote">cvs</span>” installed.
1.27 rillig 1974: To do an initial (full) checkout of pkgsrc, do the
1975: following steps:</p>
1.1 grant 1976: <pre class="screen">
1.14 xtraeme 1977: <code class="prompt">%</code> <strong class=
1978: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1979: <code class="prompt">%</code> <strong class=
1980: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1981: <code class="prompt">%</code> <strong class=
1982: "userinput"><code>cd /usr</code></strong>
1983: <code class="prompt">%</code> <strong class=
1984: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1985: </pre>
1986:
1.45 wiz 1987: <p>This will create the <code xmlns=
1988: "http://www.w3.org/TR/xhtml1/transitional" class=
1989: "filename">pkgsrc</code> directory in your <code xmlns=
1990: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1991: "filename">/usr</code>, and all the package source will
1.45 wiz 1992: be stored under <code xmlns=
1993: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1994: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1995: initial checkout, make sure you have <code class=
1996: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1997: <pre class="screen">
1.14 xtraeme 1998: <code class="prompt">%</code> <strong class=
1999: "userinput"><code>cd /usr/pkgsrc</code></strong>
2000: <code class="prompt">%</code> <strong class=
2001: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 2002: </pre>
2003:
2004: <p>Please also note that it is possible to have multiple
2005: copies of the pkgsrc hierarchy in use at any one time -
2006: all work is done relatively within the pkgsrc tree.</p>
2007: </div>
1.59 rillig 2008:
1.67 hubertf 2009: <div class="sect1" lang="en">
1.59 rillig 2010: <div class="titlepage">
2011: <div>
2012: <div>
2013: <h2 class="title" style="clear: both"><a name=
2014: "uptodate-cvs"></a>2.4. Keeping pkgsrc
2015: up-to-date via CVS</h2>
2016: </div>
2017: </div>
2018: </div>
2019:
2020: <p>If your copy of pkgsrc contains a lot of <code xmlns=
2021: "http://www.w3.org/TR/xhtml1/transitional" class=
2022: "filename">CVS</code> directories, you can update it
2023: using the <a href=
2024: "http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current">
2025: <span class="citerefentry"><span class=
2026: "refentrytitle">cvs</span>(1)</span></a> program. First,
2027: <span><strong class="command">cd</strong></span> to the
2028: top level directory of pkgsrc. Then run
2029: <span><strong class="command">cvs -q update
2030: -dP</strong></span>, and you're done.</p>
2031:
2032: <p>If that doesn't work and the file <code xmlns=
2033: "http://www.w3.org/TR/xhtml1/transitional" class=
2034: "filename">CVS/Root</code> contains the string
2035: “<span class="quote">:pserver:</span>”, you
2036: have to run <span><strong class="command">cvs
2037: login</strong></span> once to get known to the NetBSD CVS
2038: server. The <span><strong class=
2039: "command">cvs</strong></span> utility will then ask you
2040: for a password. Just enter “<span class=
2041: "quote">anoncvs</span>”. Then try again to
2042: update.</p>
2043: </div>
1.1 grant 2044: </div>
2045:
1.67 hubertf 2046: <div class="chapter" lang="en">
1.1 grant 2047: <div class="titlepage">
2048: <div>
2049: <div>
1.67 hubertf 2050: <h2 class="title"><a name=
1.1 grant 2051: "platforms"></a>Chapter 3. Using pkgsrc on
2052: systems other than NetBSD</h2>
2053: </div>
2054: </div>
2055: </div>
2056:
2057: <div class="toc">
2058: <p><b>Table of Contents</b></p>
2059:
2060: <dl>
1.30 wiz 2061: <dt><span class="sect1"><a href=
2062: "#bootstrapping-pkgsrc">3.1. Bootstrapping
2063: pkgsrc</a></span></dt>
1.1 grant 2064:
1.30 wiz 2065: <dt><span class="sect1"><a href=
1.47 reed 2066: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 2067: notes</a></span></dt>
1.1 grant 2068:
2069: <dd>
2070: <dl>
1.30 wiz 2071: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 2072: Darwin (Mac OS X)</a></span></dt>
2073:
1.30 wiz 2074: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 2075: FreeBSD</a></span></dt>
2076:
1.30 wiz 2077: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 2078: Interix</a></span></dt>
2079:
1.30 wiz 2080: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 2081: IRIX</a></span></dt>
2082:
1.30 wiz 2083: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 2084: Linux</a></span></dt>
2085:
1.30 wiz 2086: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 2087: OpenBSD</a></span></dt>
2088:
1.30 wiz 2089: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 2090: Solaris</a></span></dt>
2091: </dl>
2092: </dd>
2093: </dl>
2094: </div>
2095:
1.67 hubertf 2096: <div class="sect1" lang="en">
1.1 grant 2097: <div class="titlepage">
2098: <div>
2099: <div>
2100: <h2 class="title" style="clear: both"><a name=
1.30 wiz 2101: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
2102: pkgsrc</h2>
1.1 grant 2103: </div>
2104: </div>
2105: </div>
2106:
1.27 rillig 2107: <p>For operating systems other than NetBSD, we provide a
1.1 grant 2108: bootstrap kit to build the required tools to use pkgsrc
2109: on your platform. Besides support for native NetBSD,
2110: pkgsrc and the bootstrap kit have support for the
2111: following operating systems:</p>
2112:
2113: <div class="itemizedlist">
2114: <ul type="disc">
2115: <li>
2116: <p>Darwin (Mac OS X)</p>
2117: </li>
2118:
2119: <li>
1.70 rillig 2120: <p>DragonFly BSD</p>
1.16 grant 2121: </li>
2122:
2123: <li>
1.1 grant 2124: <p>FreeBSD</p>
2125: </li>
2126:
2127: <li>
2128: <p>Interix (Windows 2000, XP, 2003)</p>
2129: </li>
2130:
2131: <li>
2132: <p>IRIX</p>
2133: </li>
2134:
2135: <li>
2136: <p>Linux</p>
2137: </li>
2138:
2139: <li>
2140: <p>OpenBSD</p>
2141: </li>
2142:
2143: <li>
2144: <p>Solaris</p>
2145: </li>
1.16 grant 2146:
2147: <li>
2148: <p>Tru64 (Digital UNIX/OSF1)</p>
2149: </li>
1.1 grant 2150: </ul>
2151: </div>
2152:
2153: <p>Support for other platforms is under development.</p>
2154:
2155: <p>Installing the bootstrap kit should be as simple
2156: as:</p>
2157: <pre class="screen">
1.14 xtraeme 2158: <code class="prompt">#</code> <strong class=
2159: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
2160: <code class="prompt">#</code> <strong class=
2161: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
2162: <code class="prompt">#</code> <strong class=
2163: "userinput"><code>./bootstrap</code></strong>
1.1 grant 2164: </pre>
2165:
2166: <p>See <a href="#getting" title=
1.59 rillig 2167: "Chapter 2. Where to get pkgsrc and how to keep it up-to-date">
1.67 hubertf 2168: Chapter 2, <i>Where to get pkgsrc and how to keep it
1.59 rillig 2169: up-to-date</i></a> for other ways to get pkgsrc before
2170: bootstrapping. The given <span><strong class=
2171: "command">bootstrap</strong></span> command will use the
2172: defaults of <code xmlns=
1.45 wiz 2173: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2174: "filename">/usr/pkg</code> for the <span class=
2175: "emphasis"><em>prefix</em></span> where programs will be
1.45 wiz 2176: installed in, and <code xmlns=
2177: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2178: "filename">/var/db/pkg</code> for the package database
1.27 rillig 2179: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 2180: However, these can also be set using command-line
1.27 rillig 2181: arguments.</p>
1.1 grant 2182:
2183: <p>Binary packages for the pkgsrc tools and an initial
2184: set of packages is available for supported platforms. An
2185: up-to-date list of these can be found on <a href=
2186: "http://www.pkgsrc.org/" target=
1.63 dillo 2187: "_top">www.pkgsrc.org</a>. Note that this only works for
2188: privileged builds that install into <code xmlns=
2189: "http://www.w3.org/TR/xhtml1/transitional" class=
2190: "filename">/usr/pkg</code>.</p>
1.47 reed 2191:
2192: <div class="note" style=
2193: "margin-left: 0.5in; margin-right: 0.5in;">
2194: <h3 class="title">Note</h3>
2195:
2196: <p>The bootstrap installs a <span><strong class=
2197: "command">bmake</strong></span> tool. Use this
2198: <span><strong class="command">bmake</strong></span>
2199: when building via pkgsrc. For examples in this guide,
2200: use <span><strong class="command">bmake</strong></span>
2201: instead of “<span class=
2202: "quote">make</span>”.</p>
2203: </div>
1.1 grant 2204: </div>
2205:
1.67 hubertf 2206: <div class="sect1" lang="en">
1.1 grant 2207: <div class="titlepage">
2208: <div>
2209: <div>
2210: <h2 class="title" style="clear: both"><a name=
1.47 reed 2211: "platform-specific-notes"></a>3.2. Platform-specific
2212: notes</h2>
1.1 grant 2213: </div>
2214: </div>
2215: </div>
2216:
2217: <p>Here are some platform-specific notes you should be
2218: aware of.</p>
2219:
1.67 hubertf 2220: <div class="sect2" lang="en">
1.1 grant 2221: <div class="titlepage">
2222: <div>
2223: <div>
1.67 hubertf 2224: <h3 class="title"><a name=
1.30 wiz 2225: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 2226: </div>
2227: </div>
2228: </div>
2229:
2230: <p>Darwin 5.x and 6.x are supported. There are two
2231: methods of using pkgsrc on Mac OS X, by using a
2232: <a href="#platform.osx-image" title=
2233: "3.2.1.1. Using a disk image">disk image</a>, or a
2234: <a href="#platform.osx-ufs" title=
2235: "3.2.1.2. Using a UFS partition">UFS
2236: partition</a>.</p>
2237:
2238: <p>Before you start, you will need to download and
2239: install the Mac OS X Developer Tools from Apple's
2240: Developer Connection. See <a href=
2241: "http://developer.apple.com/macosx/" target=
2242: "_top">http://developer.apple.com/macosx/</a> for
2243: details. Also, make sure you install X11 for Mac OS X
2244: and the X11 SDK from <a href=
2245: "http://www.apple.com/macosx/x11/download/" target=
2246: "_top">http://www.apple.com/macosx/x11/download/</a> if
2247: you intend to build packages that use the X11 Window
2248: System.</p>
2249:
2250: <p>If you already have a UFS partition, or have a spare
2251: partition that you can format as UFS, it is recommended
2252: to use that instead of the disk image. It'll be
2253: somewhat faster and will mount automatically at boot
2254: time, where you must manually mount a disk image.</p>
2255:
2256: <div class="note" style=
2257: "margin-left: 0.5in; margin-right: 0.5in;">
2258: <h3 class="title">Note</h3>
2259:
2260: <p>You cannot use a HFS+ file system for pkgsrc,
1.47 reed 2261: because pkgsrc currently requires the file system to
1.1 grant 2262: be case-sensitive, and HFS+ is not.</p>
2263: </div>
2264:
1.67 hubertf 2265: <div class="sect3" lang="en">
1.1 grant 2266: <div class="titlepage">
2267: <div>
2268: <div>
1.67 hubertf 2269: <h4 class="title"><a name=
2270: "platform.osx-image"></a>3.2.1.1. Using a
2271: disk image</h4>
1.1 grant 2272: </div>
2273: </div>
2274: </div>
2275:
2276: <p>Create the disk image:</p>
2277: <pre class="screen">
1.14 xtraeme 2278: <code class="prompt">#</code> <strong class=
2279: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
2280: <code class="prompt">#</code> <strong class=
2281: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
2282: <code class="prompt">#</code> <strong class=
2283: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
2284: <code class="prompt">#</code> <strong class=
2285: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 2286: </pre>
2287:
2288: <p>That's it!</p>
2289: </div>
2290:
1.67 hubertf 2291: <div class="sect3" lang="en">
1.1 grant 2292: <div class="titlepage">
2293: <div>
2294: <div>
1.67 hubertf 2295: <h4 class="title"><a name=
2296: "platform.osx-ufs"></a>3.2.1.2. Using a
1.1 grant 2297: UFS partition</h4>
2298: </div>
2299: </div>
2300: </div>
2301:
1.45 wiz 2302: <p>By default, <code xmlns=
2303: "http://www.w3.org/TR/xhtml1/transitional" class=
2304: "filename">/usr</code> will be on your root file
2305: system, normally HFS+. It is possible to use the
2306: default <span class="emphasis"><em>prefix</em></span>
2307: of <code xmlns=
2308: "http://www.w3.org/TR/xhtml1/transitional" class=
2309: "filename">/usr/pkg</code> by symlinking <code xmlns=
2310: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2311: "filename">/usr/pkg</code> to a directory on a UFS
2312: file system. Obviously, another symlink is required
2313: if you want to place the package database directory
2314: outside the <span class=
2315: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 2316: <pre class="screen">
1.14 xtraeme 2317: <code class="prompt">#</code> <strong class=
1.59 rillig 2318: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb</code></strong>
1.1 grant 2319: </pre>
2320:
2321: <p>If you created your partitions at the time of
2322: installing Mac OS X and formatted the target
2323: partition as UFS, it should automatically mount on
1.45 wiz 2324: <code xmlns=
2325: "http://www.w3.org/TR/xhtml1/transitional" class=
2326: "filename">/Volumes/<volume name></code> when
2327: the machine boots. If you are (re)formatting a
2328: partition as UFS, you need to ensure that the
2329: partition map correctly reflects “<span class=
2330: "quote">Apple_UFS</span>” and not
2331: “<span class=
1.1 grant 2332: "quote">Apple_HFS</span>”.</p>
2333:
2334: <p>The problem is that none of the disk tools will
2335: let you touch a disk that is booted from. You can
2336: unmount the partition, but even if you newfs it, the
2337: partition type will be incorrect and the automounter
2338: won't mount it. It can be mounted manually, but it
2339: won't appear in Finder.</p>
2340:
2341: <p>You'll need to boot off of the OS X Installation
2342: (User) CD. When the Installation program starts, go
2343: up to the menu and select Disk Utility. Now, you will
2344: be able to select the partition you want to be UFS,
2345: and Format it Apple UFS. Quit the Disk Utility, quit
2346: the installer which will reboot your machine. The new
2347: UFS file system will appear in Finder.</p>
2348:
2349: <p>Be aware that the permissions on the new file
2350: system will be writable by root only.</p>
2351:
2352: <p>This note is as of 10.2 (Jaguar) and applies to
2353: earlier versions. Hopefully Apple will fix Disk
2354: Utility in 10.3 (Panther).</p>
2355: </div>
2356: </div>
2357:
1.67 hubertf 2358: <div class="sect2" lang="en">
1.1 grant 2359: <div class="titlepage">
2360: <div>
2361: <div>
1.67 hubertf 2362: <h3 class="title"><a name=
1.30 wiz 2363: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 2364: </div>
2365: </div>
2366: </div>
2367:
2368: <p>FreeBSD 4.7 and 5.0 have been tested and are
2369: supported, other versions may work.</p>
2370:
2371: <p>Care should be taken so that the tools that this kit
2372: installs do not conflict with the FreeBSD userland
2373: tools. There are several steps:</p>
2374:
2375: <div class="orderedlist">
2376: <ol type="1">
2377: <li>
2378: <p>FreeBSD stores its ports pkg database in
1.45 wiz 2379: <code xmlns=
2380: "http://www.w3.org/TR/xhtml1/transitional" class=
2381: "filename">/var/db/pkg</code>. It is therefore
2382: recommended that you choose a different location
2383: (e.g. <code xmlns=
2384: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2385: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2386: --pkgdbdir option to the bootstrap script.</p>
2387: </li>
2388:
2389: <li>
2390: <p>If you do not intend to use the FreeBSD ports
2391: tools, it's probably a good idea to move them out
2392: of the way to avoid confusion, e.g.</p>
2393: <pre class="screen">
1.14 xtraeme 2394: <code class="prompt">#</code> <strong class=
2395: "userinput"><code>cd /usr/sbin</code></strong>
2396: <code class="prompt">#</code> <strong class=
2397: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2398: <code class="prompt">#</code> <strong class=
2399: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2400: <code class="prompt">#</code> <strong class=
2401: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2402: <code class="prompt">#</code> <strong class=
2403: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2404: </pre>
2405: </li>
2406:
2407: <li>
1.45 wiz 2408: <p>An example <code xmlns=
2409: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2410: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2411: placed in <code xmlns=
2412: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2413: "filename">/etc/mk.conf.example</code> file when
2414: you use the bootstrap script.</p>
1.1 grant 2415: </li>
2416: </ol>
2417: </div>
2418: </div>
2419:
1.67 hubertf 2420: <div class="sect2" lang="en">
1.1 grant 2421: <div class="titlepage">
2422: <div>
2423: <div>
1.67 hubertf 2424: <h3 class="title"><a name=
1.30 wiz 2425: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2426: </div>
2427: </div>
2428: </div>
2429:
1.47 reed 2430: <p>Interix is a POSIX-compatible subsystem for the
1.1 grant 2431: Windows NT kernel, providing a Unix-like environment
2432: with a tighter kernel integration than available with
2433: Cygwin. It is part of the Windows Services for Unix
2434: package, available for free for any licensed copy of
1.22 tv 2435: Windows 2000, XP (not including XP Home), or 2003. SFU
2436: can be downloaded from <a href=
2437: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2438: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2439:
2440: <p>Services for Unix 3.5, current as of this writing,
2441: has been tested. 3.0 or 3.1 may work, but are not
2442: officially supported. (The main difference in 3.0/3.1
2443: is lack of pthreads.)</p>
2444:
1.67 hubertf 2445: <div class="sect3" lang="en">
1.1 grant 2446: <div class="titlepage">
2447: <div>
2448: <div>
2449: <h4 class="title"><a name=
2450: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2451: installing Interix/SFU</h4>
1.1 grant 2452: </div>
2453: </div>
2454: </div>
2455:
2456: <p>At an absolute minimum, the following packages
2457: must be installed from the Windows Services for Unix
2458: 3.5 distribution in order to use pkgsrc:</p>
2459:
2460: <div class="itemizedlist">
2461: <ul type="disc">
2462: <li>
2463: <p>Utilities -> Base Utilities</p>
2464: </li>
2465:
2466: <li>
2467: <p>Interix GNU Components -> (all)</p>
2468: </li>
2469:
2470: <li>
2471: <p>Remote Connectivity</p>
2472: </li>
2473:
2474: <li>
2475: <p>Interix SDK</p>
2476: </li>
2477: </ul>
2478: </div>
2479:
2480: <p>When using pkgsrc on Interix, DO NOT install the
2481: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2482: without shared module support, installed to
2483: /usr/local, and will only cause confusion. Instead,
2484: install Perl 5.8 from pkgsrc (or from a binary
2485: package).</p>
2486:
2487: <p>The Remote Connectivity subcomponent "Windows
2488: Remote Shell Service" does not need to be installed,
2489: but Remote Connectivity itself should be installed in
2490: order to have a working inetd.</p>
2491:
1.52 tv 2492: <p>During installation you may be asked whether to
2493: enable setuid behavior for Interix programs, and
2494: whether to make pathnames default to case-sensitive.
2495: Setuid should be enabled, and case-sensitivity MUST
2496: be enabled. (Without case-sensitivity, a large number
2497: of packages including perl will not build.)</p>
2498:
2499: <p>NOTE: Newer Windows service packs change the way
2500: binary execution works (via the Data Execution
2501: Prevention feature). In order to use pkgsrc and other
2502: gcc-compiled binaries reliably, a hotfix containing
2503: POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
2504: (899522 or newer) must be installed. Hotfixes are
2505: available from Microsoft through a support contract;
2506: however, a NetBSD developer has made most Interix
2507: hotfixes available for personal use from <a href=
2508: "http://www.duh.org/interix/hotfixes.php" target=
2509: "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1 grant 2510: </div>
2511:
1.67 hubertf 2512: <div class="sect3" lang="en">
1.1 grant 2513: <div class="titlepage">
2514: <div>
2515: <div>
2516: <h4 class="title"><a name=
2517: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2518: to do if Interix/SFU is already installed</h4>
2519: </div>
2520: </div>
2521: </div>
2522:
2523: <p>If SFU is already installed and you wish to alter
2524: these settings to work with pkgsrc, note the
2525: following things.</p>
2526:
2527: <div class="itemizedlist">
2528: <ul type="disc">
2529: <li>
2530: <p>To uninstall UNIX Perl, use Add/Remove
2531: Programs, select Microsoft Windows Services for
2532: UNIX, then click Change. In the installer,
2533: choose Add or Remove, then uncheck
2534: Utilities->UNIX Perl.</p>
2535: </li>
2536:
2537: <li>
1.47 reed 2538: <p>To enable case-sensitivity for the file
2539: system, run REGEDIT.EXE, and change the
1.1 grant 2540: following registry key:</p>
2541:
2542: <p>
2543: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2544: Manager\kernel</p>
2545:
2546: <p>Set the DWORD value "obcaseinsensitive" to
2547: 0; then reboot.</p>
2548: </li>
2549:
2550: <li>
2551: <p>To enable setuid binaries (optional), run
2552: REGEDIT.EXE, and change the following registry
2553: key:</p>
2554:
2555: <p>
2556: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2557: for UNIX</p>
2558:
2559: <p>Set the DWORD value "EnableSetuidBinaries"
2560: to 1; then reboot.</p>
2561: </li>
2562: </ul>
2563: </div>
2564: </div>
2565:
1.67 hubertf 2566: <div class="sect3" lang="en">
1.1 grant 2567: <div class="titlepage">
2568: <div>
2569: <div>
2570: <h4 class="title"><a name=
2571: "platform.interix-notes"></a>3.2.3.3. Important
2572: notes for using pkgsrc</h4>
2573: </div>
2574: </div>
2575: </div>
2576:
1.52 tv 2577: <p>The package manager (either the pkgsrc "su" user,
1.1 grant 2578: or the user running "pkg_add") must be a member of
2579: the local Administrators group. Such a user must also
2580: be used to run the bootstrap. This is slightly
2581: relaxed from the normal pkgsrc requirement of
2582: "root".</p>
2583:
2584: <p>The package manager should use a umask of 002.
2585: "make install" will automatically complain if this is
2586: not the case. This ensures that directories written
2587: in /var/db/pkg are Administrators-group
2588: writeable.</p>
2589:
2590: <p>The popular Interix binary packages from
2591: http://www.interopsystems.com/ use an older version
2592: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2593: used in conjunction with pkgsrc. If you choose to use
2594: them at the same time as the pkgsrc packages, ensure
2595: that you use the proper pkg_* tools for each type of
2596: binary package.</p>
1.22 tv 2597:
2598: <p>The TERM setting used for DOS-type console windows
2599: (including those invoked by the csh and ksh startup
2600: shortcuts) is "interix". Most systems don't have a
2601: termcap/terminfo entry for it, but the following
2602: .termcap entry provides adequate emulation in most
2603: cases:</p>
2604: <pre class="programlisting">
1.51 rillig 2605: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22 tv 2606: </pre>
1.1 grant 2607: </div>
1.52 tv 2608:
1.67 hubertf 2609: <div class="sect3" lang="en">
1.52 tv 2610: <div class="titlepage">
2611: <div>
2612: <div>
2613: <h4 class="title"><a name=
2614: "platform.interix-limits"></a>3.2.3.4. Limitations
2615: of the Interix platform</h4>
2616: </div>
2617: </div>
2618: </div>
2619:
2620: <p>Though Interix suffices as a familiar and flexible
2621: substitute for a full Unix-like platform, it has some
2622: drawbacks that should be noted for those desiring to
2623: make the most of Interix.</p>
2624:
2625: <div class="itemizedlist">
2626: <ul type="disc">
2627: <li>
1.54 tv 2628: <p><span class=
1.57 minskim 2629: "strong"><strong>X11:</strong></span></p>
1.52 tv 2630:
2631: <p>Interix comes with the standard set of X11R6
1.57 minskim 2632: client libraries, and can run X11 based
1.52 tv 2633: applications, but it does <span class=
2634: "emphasis"><em>not</em></span> come with an X
2635: server. Some options are <a href=
2636: "http://www.starnet.com/products/xwin32/"
2637: target="_top">StarNet X-Win32</a>, <a href=
2638: "http://connectivity.hummingbird.com/products/nc/exceed/"
1.57 minskim 2639: target="_top">Hummingbird Exceed</a> (available
2640: in a trimmed version for Interix from Interop
2641: Systems as the <a href=
2642: "http://www.interopsystems.com/InteropXserver.htm"
2643: target="_top">Interop X Server</a>), and the
2644: free X11 server included with <a href=
1.52 tv 2645: "http://x.cygwin.com/" target=
2646: "_top">Cygwin</a>.</p>
2647:
2648: <p>Also, StarNet Communications has graciously
2649: provided a free version of their X-Win32
2650: product that accepts connections only from
2651: localhost: <a href=
2652: "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
2653: target="_top">X-Win32 LX</a>, recommended by
2654: the maintainer of Interix pkgsrc support.</p>
2655: </li>
2656:
2657: <li>
1.57 minskim 2658: <p><span class="strong"><strong>X11
1.54 tv 2659: acceleration:</strong></span></p>
1.52 tv 2660:
2661: <p>Because Interix runs in a completely
2662: different NT subsystem from Win32 applications,
2663: it does not currently support various X11
2664: protocol extensions for acceleration (such as
2665: MIT-SHM or DGA). Most interactive applications
2666: to a local X server will run reasonably fast,
2667: but full motion video and other graphics
2668: intensive applications may require a
2669: faster-than-expected CPU.</p>
2670: </li>
2671:
2672: <li>
1.54 tv 2673: <p><span class=
2674: "strong"><strong>Audio:</strong></span></p>
1.52 tv 2675:
2676: <p>Interix has no native support for audio
1.53 tv 2677: output. For audio support, pkgsrc uses the
2678: <span><strong class=
1.52 tv 2679: "command">esound</strong></span> client/server
2680: audio system on Interix. Unlike on most
2681: platforms, the <a xmlns=
2682: "http://www.w3.org/TR/xhtml1/transitional"
2683: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
2684: target="_top"><code xmlns="" class=
2685: "filename">audio/esound</code></a> package does
2686: <span class="emphasis"><em>not</em></span>
2687: contain the <span><strong class=
1.53 tv 2688: "command">esd</strong></span> server component.
2689: To output audio via an Interix host, the
2690: <a xmlns=
1.52 tv 2691: "http://www.w3.org/TR/xhtml1/transitional"
2692: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
2693: target="_top"><code xmlns="" class=
2694: "filename">emulators/cygwin_esound</code></a>
2695: package must also be installed.</p>
2696: </li>
2697:
2698: <li>
1.54 tv 2699: <p><span class="strong"><strong>CD/DVDs, USB,
2700: and SCSI:</strong></span></p>
1.52 tv 2701:
2702: <p>Direct device access is not currently
2703: supported in Interix, so it is not currently
2704: possible to access CD/DVD drives, USB devices,
2705: or SCSI devices through non-filesystem means.
2706: Among other things, this makes it impossible to
2707: use Interix directly for CD/DVD burning.</p>
2708: </li>
2709:
2710: <li>
1.54 tv 2711: <p><span class="strong"><strong>Tape
2712: drives:</strong></span></p>
1.52 tv 2713:
2714: <p>Due to the same limitations as for CD-ROMs
2715: and SCSI devices, tape drives are also not
2716: directly accessible in Interix. However,
2717: support is in work to make tape drive access
2718: possible by using Cygwin as a bridge (similarly
2719: to audio bridged via Cygwin's esound
2720: server).</p>
2721: </li>
2722: </ul>
2723: </div>
2724: </div>
2725:
1.67 hubertf 2726: <div class="sect3" lang="en">
1.52 tv 2727: <div class="titlepage">
2728: <div>
2729: <div>
2730: <h4 class="title"><a name=
2731: "platform.interix-knownissues"></a>3.2.3.5. Known
2732: issues for pkgsrc on Interix</h4>
2733: </div>
2734: </div>
2735: </div>
2736:
2737: <p>It is not necessary, in general, to have a "root"
2738: user on the Windows system; any member of the local
2739: Administrators group will suffice. However, some
2740: packages currently assume that the user named "root"
2741: is the privileged user. To accommodate these, you may
2742: create such a user; make sure it is in the local
2743: group Administrators (or your language
2744: equivalent).</p>
2745:
2746: <p>"pkg_add" creates directories of mode 0755, not
2747: 0775, in $PKG_DBDIR. For the time being, install
2748: packages as the local Administrator (or your language
2749: equivalent), or run the following command after
2750: installing a package to work around the issue:</p>
2751: <pre class="screen">
2752: <code class="prompt">#</code> <strong class=
2753: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
2754: </pre>
2755: </div>
1.1 grant 2756: </div>
2757:
1.67 hubertf 2758: <div class="sect2" lang="en">
1.1 grant 2759: <div class="titlepage">
2760: <div>
2761: <div>
1.67 hubertf 2762: <h3 class="title"><a name=
1.30 wiz 2763: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2764: </div>
2765: </div>
2766: </div>
2767:
2768: <p>You will need a working C compiler, either gcc or
2769: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2770: the <code class="varname">CC</code> environment
2771: variable according to your preference. If you do not
2772: have a license for the MIPSpro compiler suite, you can
1.1 grant 2773: download a gcc tardist file from <a href=
2774: "http://freeware.sgi.com/" target=
2775: "_top">http://freeware.sgi.com/</a>.</p>
2776:
2777: <p>Please note that you will need IRIX 6.5.17 or
2778: higher, as this is the earliest version of IRIX
1.24 wiz 2779: providing support for <a href=
2780: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2781: <span class="citerefentry"><span class=
2782: "refentrytitle">if_indextoname</span>(3)</span></a>,
2783: <a href=
2784: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2785: <span class="citerefentry"><span class=
2786: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2787: etc.</p>
1.1 grant 2788:
1.27 rillig 2789: <p>At this point in time, pkgsrc only supports one ABI
2790: at a time. That is, you can not switch between the old
2791: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2792: you start out using "abi=n32", that's what all your
2793: packages will be built with.</p>
1.1 grant 2794:
2795: <p>Therefore, please make sure that you have no
1.14 xtraeme 2796: conflicting <code class="varname">CFLAGS</code> in your
1.45 wiz 2797: environment or the <code xmlns=
2798: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2799: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2800: that you do not try to link n32 object files with lib64
1.45 wiz 2801: or vice versa. Check your <code xmlns=
2802: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2803: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2804:
2805: <p>If you have the actual pkgsrc tree mounted via NFS
2806: from a different host, please make sure to set
1.14 xtraeme 2807: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2808: directory, as it appears that IRIX linker occasionally
1.47 reed 2809: runs into issues when trying to link over a
2810: network-mounted file system.</p>
1.1 grant 2811:
2812: <p>The bootstrapping process should set all the right
2813: options for programs such as imake(1), but you may want
2814: to set some options depending on your local setup.
1.45 wiz 2815: Please see <code xmlns=
2816: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2817: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2818: course, your compiler's man pages for details.</p>
1.22 tv 2819:
2820: <p>If you are using SGI's MIPSPro compiler, please
2821: set</p>
2822: <pre class="programlisting">
1.51 rillig 2823: PKGSRC_COMPILER= mipspro
1.22 tv 2824: </pre>
2825:
1.45 wiz 2826: <p>in <code xmlns=
2827: "http://www.w3.org/TR/xhtml1/transitional" class=
2828: "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
2829: assume you are using gcc and may end up passing invalid
2830: flags to the compiler. Note that bootstrap should
2831: create an appropriate <code xmlns=
2832: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2833: "filename">mk.conf.example</code> by default.</p>
2834:
2835: <p>If you have both the MIPSPro compiler chain
2836: installed as well as gcc, but want to make sure that
2837: MIPRPro is used, please set your <code class=
2838: "varname">PATH</code> to <span class=
2839: "emphasis"><em>not</em></span> include the location of
1.45 wiz 2840: gcc (often <code xmlns=
2841: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2842: "filename">/usr/freeware/bin</code>), and (important)
2843: pass the '--preserve-path' flag.</p>
1.1 grant 2844: </div>
2845:
1.67 hubertf 2846: <div class="sect2" lang="en">
1.1 grant 2847: <div class="titlepage">
2848: <div>
2849: <div>
1.67 hubertf 2850: <h3 class="title"><a name=
1.30 wiz 2851: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2852: </div>
2853: </div>
2854: </div>
2855:
2856: <p>Some versions of Linux (for example Debian
2857: GNU/Linux) need either libtermcap or libcurses
2858: (libncurses). Installing the distributions
2859: libncurses-dev package (or equivalent) should fix the
2860: problem.</p>
2861:
2862: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2863: and icc (Intel C++ Compiler). gcc is the default. icc
2864: 8.0 and 8.1 on i386 have been tested.</p>
2865:
2866: <p>To bootstrap using icc, assuming the default icc
2867: installation directory:</p>
2868: <pre class="programlisting">
1.51 rillig 2869: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2870: ac_cv___attribute__=yes ./bootstrap
1.22 tv 2871: </pre>
2872:
2873: <div class="note" style=
2874: "margin-left: 0.5in; margin-right: 0.5in;">
2875: <h3 class="title">Note</h3>
2876:
2877: <p>icc 8.1 needs the `-i-static' argument instead of
2878: -static-libcxa.</p>
2879: </div>
2880:
2881: <p>icc supports __attribute__, but the GNU configure
2882: test uses a nested function, which icc does not
2883: support. #undef'ing __attribute__ has the unfortunate
2884: side-effect of breaking many of the Linux header files,
2885: which cannot be compiled properly without
2886: __attribute__. The test must be overridden so that
2887: __attribute__ is assumed supported by the compiler.</p>
2888:
2889: <p>After bootstrapping, you should set <code class=
1.45 wiz 2890: "varname">PKGSRC_COMPILER</code> in <code xmlns=
2891: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2892: "filename">/etc/mk.conf</code>:</p>
2893: <pre class="programlisting">
1.51 rillig 2894: PKGSRC_COMPILER= icc
1.22 tv 2895: </pre>
2896:
2897: <p>The default installation directory for icc is
1.45 wiz 2898: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2899: class="filename">/opt/intel_cc_80</code>, which is also
2900: the pkgsrc default. If you have installed it into a
2901: different directory, set <code class=
2902: "varname">ICCBASE</code> in <code xmlns=
2903: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2904: "filename">/etc/mk.conf</code>:</p>
2905: <pre class="programlisting">
1.51 rillig 2906: ICCBASE= /opt/icc
1.22 tv 2907: </pre>
2908:
2909: <p>pkgsrc uses the static linking method of the runtime
2910: libraries provided by icc, so binaries can be run on
2911: other systems which do not have the shared libraries
2912: installed.</p>
2913:
2914: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2915: the <a href=
2916: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2917: <span class="citerefentry"><span class=
2918: "refentrytitle">ld</span>(1)</span></a> command run
2919: when linking a C++ shared library and records it,
2920: throwing away the -Bstatic and -Bdynamic options
2921: interspersed between the libraries. This means that
2922: libtool-linked C++ shared libraries will have a runtime
2923: dependency on the icc libraries until this is fixed in
2924: libtool.</p>
1.22 tv 2925: </div>
2926:
1.67 hubertf 2927: <div class="sect2" lang="en">
1.22 tv 2928: <div class="titlepage">
2929: <div>
2930: <div>
1.67 hubertf 2931: <h3 class="title"><a name=
1.30 wiz 2932: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2933: </div>
2934: </div>
2935: </div>
2936:
2937: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2938:
2939: <p>Care should be taken so that the tools that this kit
2940: installs do not conflict with the OpenBSD userland
2941: tools. There are several steps:</p>
2942:
2943: <div class="orderedlist">
2944: <ol type="1">
2945: <li>
2946: <p>OpenBSD stores its ports pkg database in
1.45 wiz 2947: <code xmlns=
2948: "http://www.w3.org/TR/xhtml1/transitional" class=
2949: "filename">/var/db/pkg</code>. It is therefore
2950: recommended that you choose a different location
2951: (e.g. <code xmlns=
2952: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2953: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2954: --pkgdbdir option to the bootstrap script.</p>
2955: </li>
2956:
2957: <li>
2958: <p>If you do not intend to use the OpenBSD ports
2959: tools, it's probably a good idea to move them out
2960: of the way to avoid confusion, e.g.</p>
2961: <pre class="screen">
1.14 xtraeme 2962: <code class="prompt">#</code> <strong class=
2963: "userinput"><code>cd /usr/sbin</code></strong>
2964: <code class="prompt">#</code> <strong class=
2965: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2966: <code class="prompt">#</code> <strong class=
2967: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2968: <code class="prompt">#</code> <strong class=
2969: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2970: <code class="prompt">#</code> <strong class=
2971: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2972: </pre>
2973: </li>
2974:
2975: <li>
1.45 wiz 2976: <p>An example <code xmlns=
2977: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2978: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2979: placed in <code xmlns=
2980: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2981: "filename">/etc/mk.conf.example</code> file when
2982: you use the bootstrap script. OpenBSD's make
1.45 wiz 2983: program uses <code xmlns=
2984: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2985: "filename">/etc/mk.conf</code> as well. You can
1.47 reed 2986: work around this by enclosing all the
2987: pkgsrc-specific parts of the file with:</p>
1.1 grant 2988: <pre class="programlisting">
1.51 rillig 2989: .ifdef BSD_PKG_MK
2990: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
2991: .else
2992: # OpenBSD stuff
2993: .endif
1.1 grant 2994: </pre>
2995: </li>
2996: </ol>
2997: </div>
2998: </div>
2999:
1.67 hubertf 3000: <div class="sect2" lang="en">
1.1 grant 3001: <div class="titlepage">
3002: <div>
3003: <div>
1.67 hubertf 3004: <h3 class="title"><a name=
1.30 wiz 3005: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 3006: </div>
3007: </div>
3008: </div>
3009:
3010: <p>Solaris 2.6 through 9 are supported on both x86 and
3011: sparc. You will need a working C compiler. Both gcc
3012: 2.95.3 and Sun WorkShop 5 have been tested.</p>
3013:
3014: <p>The following packages are required on Solaris 8 for
3015: the bootstrap process and to build packages.</p>
3016:
3017: <div class="itemizedlist">
3018: <ul type="disc">
3019: <li>
3020: <p>SUNWsprot</p>
3021: </li>
3022:
3023: <li>
3024: <p>SUNWarc</p>
3025: </li>
3026:
3027: <li>
3028: <p>SUNWbtool</p>
3029: </li>
3030:
3031: <li>
3032: <p>SUNWtoo</p>
3033: </li>
3034:
3035: <li>
3036: <p>SUNWlibm</p>
3037: </li>
3038: </ul>
3039: </div>
3040:
3041: <p>Please note the use of GNU binutils on Solaris is
3042: <span class="emphasis"><em>not</em></span>
3043: supported.</p>
3044:
1.70 rillig 3045: <p>Whichever compiler you use, please ensure the
3046: compiler tools and your $prefix are in your
3047: <code class="varname">PATH</code>. This includes
3048: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3049: class="filename">/usr/ccs/{bin,lib}</code> and e.g.
3050: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3051: class="filename">/usr/pkg/{bin,sbin}</code>.</p>
3052:
1.67 hubertf 3053: <div class="sect3" lang="en">
1.1 grant 3054: <div class="titlepage">
3055: <div>
3056: <div>
1.67 hubertf 3057: <h4 class="title"><a name=
3058: "solaris-gcc-note"></a>3.2.7.1. If you are
3059: using gcc</h4>
1.1 grant 3060: </div>
3061: </div>
3062: </div>
3063:
3064: <p>It makes life much simpler if you only use the
3065: same gcc consistently for building all packages.</p>
3066:
3067: <p>It is recommended that an external gcc be used
3068: only for bootstrapping, then either build gcc from
3069: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
3070: href=
3071: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45 wiz 3072: target="_top"><code xmlns="" class=
3073: "filename">lang/gcc</code></a> or install a binary
3074: gcc package, then remove gcc used during
1.20 ben 3075: bootstrapping.</p>
1.1 grant 3076:
3077: <p>Binary packages of gcc can be found through
3078: <a href=
3079: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 3080: target=
3081: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 3082: </div>
3083:
1.67 hubertf 3084: <div class="sect3" lang="en">
1.1 grant 3085: <div class="titlepage">
3086: <div>
3087: <div>
1.30 wiz 3088: <h4 class="title"><a name=
3089: "solaris-sun-workshop-note"></a>3.2.7.2. If
3090: you are using Sun WorkShop</h4>
1.1 grant 3091: </div>
3092: </div>
3093: </div>
3094:
3095: <p>You will need at least the following packages
3096: installed (from WorkShop 5.0)</p>
3097:
3098: <div class="itemizedlist">
3099: <ul type="disc">
3100: <li>
3101: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
3102: </li>
3103:
3104: <li>
3105: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
3106: </li>
3107:
3108: <li>
3109: <p>SPROild - Sun WorkShop Incremental
3110: Linker</p>
3111: </li>
3112:
3113: <li>
3114: <p>SPROlang - Sun WorkShop Compilers common
3115: components</p>
3116: </li>
3117: </ul>
3118: </div>
3119:
1.14 xtraeme 3120: <p>You should set <code class="varname">CC</code>,
3121: <code class="varname">CXX</code> and optionally,
1.45 wiz 3122: <code class="varname">CPP</code> in <code xmlns=
3123: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 3124: "filename">/etc/mk.conf</code>, e.g.:</p>
1.1 grant 3125: <pre class="programlisting">
1.51 rillig 3126: CC= cc
3127: CXX= CC
3128: CPP= /usr/ccs/lib/cpp
1.1 grant 3129: </pre>
1.70 rillig 3130: </div>
3131:
3132: <div class="sect3" lang="en">
3133: <div class="titlepage">
3134: <div>
3135: <div>
3136: <h4 class="title"><a name=
3137: "solaris-sunpro-64"></a>3.2.7.3. Buildling
3138: 64-bit binaries with SunPro</h4>
3139: </div>
3140: </div>
3141: </div>
1.1 grant 3142:
1.70 rillig 3143: <p>Building 64-bit binaries is a little trickier.
3144: First, you need to bootstrap pkgsrc in 64-bit mode.
3145: One problem here is that while building one of the
3146: programs in the bootstrap kit (<code xmlns=
3147: "http://www.w3.org/TR/xhtml1/transitional" class=
3148: "filename">bmake</code>), the <code class=
3149: "varname">CFLAGS</code> variable is not honored, even
3150: if it is set in the environment. To work around this
3151: bug, you can create a simple shell script called
3152: <code xmlns=
3153: "http://www.w3.org/TR/xhtml1/transitional" class=
3154: "filename">cc64</code> and put it somewhere in the
3155: <code class="varname">PATH</code>:</p>
3156: <pre class="programlisting">
3157: #! /bin/sh
3158: exec /opt/SUNWspro/bin/cc -xtarget=ultra -xarch=v9 ${1+"$@"}
3159: </pre>
3160:
3161: <p>Then, pass the definition for <code class=
3162: "varname">CC</code> in the environment of the
3163: <span><strong class=
3164: "command">bootstrap</strong></span> command:</p>
3165: <pre class="programlisting">
3166: <code class="prompt">$</code> <strong class=
3167: "userinput"><code>cd bootstrap</code></strong>
3168: <code class="prompt">$</code> <strong class=
3169: "userinput"><code>CC=cc64 ./bootstrap</code></strong>
3170: </pre>
3171:
3172: <p>After bootstrapping, there are two alternative
3173: ways, depending on whether you want to find bugs in
3174: packages or get your system ready quickly. If you
3175: just want a running system, add the following lines
3176: to your <code xmlns=
3177: "http://www.w3.org/TR/xhtml1/transitional" class=
3178: "filename">mk.conf</code> file:</p>
1.1 grant 3179: <pre class="programlisting">
1.70 rillig 3180: CC= cc64
3181: CXX= CC64
3182: PKGSRC_COMPILER= sunpro
1.1 grant 3183: </pre>
3184:
1.70 rillig 3185: <p>This way, all calls to the compiler will be
3186: intercepted by the above wrapper and therefore get
3187: the necessary ABI options automatically. (Don't
3188: forget to create the shell script <code xmlns=
1.45 wiz 3189: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 rillig 3190: "filename">CC64</code>, too.)</p>
3191:
3192: <p>To find packages that ignore the user-specified
3193: <code class="varname">CFLAGS</code> and <code class=
3194: "varname">CXXFLAGS</code>, add the following lines to
3195: your <code xmlns=
1.45 wiz 3196: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 rillig 3197: "filename">mk.conf</code> file:</p>
3198: <pre class="programlisting">
3199: CC= cc
3200: CXX= CC
3201: PKGSRC_COMPILER= sunpro
3202: CFLAGS= -xtarget=ultra -xarch=v9
3203: CXXFLAGS= -xtarget=ultra -xarch=v9
3204: LDFLAGS= -xtarget=ultra -xarch=v9
3205: </pre>
3206:
3207: <p>Packages that don't use the flags provided in the
3208: configuration file will try to build 32-bit binaries
3209: and fail during linking. Detecting this is useful to
3210: prevent bugs on other platforms where the error would
3211: not show up but pass silently.</p>
1.1 grant 3212: </div>
1.68 rillig 3213:
3214: <div class="sect3" lang="en">
3215: <div class="titlepage">
3216: <div>
3217: <div>
3218: <h4 class="title"><a name=
1.70 rillig 3219: "plat.sunos.problems"></a>3.2.7.4. Common
1.68 rillig 3220: problems</h4>
3221: </div>
3222: </div>
3223: </div>
3224:
3225: <p>Sometimes, when using <span><strong class=
3226: "command">libtool</strong></span>, <code xmlns=
3227: "http://www.w3.org/TR/xhtml1/transitional" class=
3228: "filename">/bin/ksh</code> crashes with a
3229: segmentation fault. The workaround is to use another
3230: shell for the configure scripts, for example by
3231: installing <a xmlns=
3232: "http://www.w3.org/TR/xhtml1/transitional" href=
3233: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/bash/README.html"
3234: target="_top"><code xmlns="" class=
3235: "filename">shells/bash</code></a> and adding the
1.69 rillig 3236: following lines to your <code xmlns=
1.68 rillig 3237: "http://www.w3.org/TR/xhtml1/transitional" class=
3238: "filename">mk.conf</code>:</p>
3239: <pre class="programlisting">
3240: CONFIG_SHELL= ${LOCALBASE}/bin/bash
1.69 rillig 3241: WRAPPER_SHELL= ${LOCALBASE}/bin/bash
1.68 rillig 3242: </pre>
1.71 wiz 3243:
3244: <p>Then, rebuild the <a xmlns=
3245: "http://www.w3.org/TR/xhtml1/transitional" href=
3246: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool-base/README.html"
3247: target="_top"><code xmlns="" class=
3248: "filename">devel/libtool-base</code></a> package.</p>
1.68 rillig 3249: </div>
1.1 grant 3250: </div>
3251: </div>
3252: </div>
3253:
1.67 hubertf 3254: <div class="chapter" lang="en">
1.1 grant 3255: <div class="titlepage">
3256: <div>
3257: <div>
1.67 hubertf 3258: <h2 class="title"><a name=
1.1 grant 3259: "using"></a>Chapter 4. Using pkgsrc</h2>
3260: </div>
3261: </div>
3262: </div>
3263:
3264: <div class="toc">
3265: <p><b>Table of Contents</b></p>
3266:
3267: <dl>
1.70 rillig 3268: <dt><span class="sect1"><a href="#using-pkg">4.1. Using
3269: binary packages</a></span></dt>
1.1 grant 3270:
3271: <dd>
3272: <dl>
1.30 wiz 3273: <dt><span class="sect2"><a href=
1.70 rillig 3274: "#finding-binary-packages">4.1.1. Finding binary
3275: packages</a></span></dt>
1.1 grant 3276:
1.30 wiz 3277: <dt><span class="sect2"><a href=
1.70 rillig 3278: "#installing-binary-packages">4.1.2. Installing
1.30 wiz 3279: binary packages</a></span></dt>
1.1 grant 3280:
1.30 wiz 3281: <dt><span class="sect2"><a href=
3282: "#a-word-of-warning">4.1.3. A word of
3283: warning</a></span></dt>
1.1 grant 3284: </dl>
3285: </dd>
3286:
1.30 wiz 3287: <dt><span class="sect1"><a href=
3288: "#building-packages-from-source">4.2. Building packages
3289: from source</a></span></dt>
1.1 grant 3290:
3291: <dd>
3292: <dl>
1.30 wiz 3293: <dt><span class="sect2"><a href=
3294: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 3295:
1.30 wiz 3296: <dt><span class="sect2"><a href=
3297: "#fetching-distfiles">4.2.2. Fetching
3298: distfiles</a></span></dt>
1.1 grant 3299:
1.30 wiz 3300: <dt><span class="sect2"><a href=
3301: "#how-to-build-and-install">4.2.3. How to build and
3302: install</a></span></dt>
1.1 grant 3303:
1.30 wiz 3304: <dt><span class="sect2"><a href=
3305: "#selecting-the-compiler">4.2.4. Selecting the
3306: compiler</a></span></dt>
1.1 grant 3307: </dl>
3308: </dd>
3309: </dl>
3310: </div>
3311:
1.70 rillig 3312: <p>Basically, there are two ways of using pkgsrc. The first
3313: is to only install the package tools and to use binary
3314: packages that someone else has prepared. This is the
3315: “<span class="quote">pkg</span>” in pkgsrc. The
3316: second way is to install the “<span class=
3317: "quote">src</span>” of pkgsrc, too. Then you are able
3318: to build your own packages, and you can still use binary
3319: packages from someone else.</p>
3320:
1.67 hubertf 3321: <div class="sect1" lang="en">
1.1 grant 3322: <div class="titlepage">
3323: <div>
3324: <div>
3325: <h2 class="title" style="clear: both"><a name=
1.70 rillig 3326: "using-pkg"></a>4.1. Using binary
1.1 grant 3327: packages</h2>
3328: </div>
3329: </div>
3330: </div>
3331:
1.70 rillig 3332: <p>To use binary packages, you need some tools to manage
3333: them. On NetBSD, these tools are already installed. On
3334: all other operating systems, you need to install them
3335: first. For the following platforms, prebuilt versions of
3336: the package tools are available and can simply be
3337: downloaded and unpacked in the <code xmlns=
3338: "http://www.w3.org/TR/xhtml1/transitional" class=
3339: "filename">/</code> directory:</p>
3340:
3341: <div class="informaltable">
3342: <a name="binary-bootstrap-kits"></a>
3343:
3344: <table border="1">
3345: <colgroup>
3346: <col />
3347: <col />
3348: </colgroup>
3349:
3350: <thead>
3351: <tr>
3352: <th>Platform</th>
3353:
3354: <th>URL</th>
3355: </tr>
3356: </thead>
3357:
3358: <tbody>
3359: <tr>
1.72 rillig 3360: <td>Solaris 9</td>
3361:
3362: <td><code xmlns=
3363: "http://www.w3.org/TR/xhtml1/transitional" class=
3364: "filename">ftp://ftp0.mh.bbc.co.uk/pub/pkgsrc/packages/bootstrap-pkgsrc/</code></td>
3365: </tr>
3366:
3367: <tr>
3368: <td>Solaris 10</td>
1.70 rillig 3369:
3370: <td><code xmlns=
3371: "http://www.w3.org/TR/xhtml1/transitional" class=
3372: "filename">http://public.enst.fr/pkgsrc/packages/bootstrap-pkgsrc/</code></td>
3373: </tr>
3374: </tbody>
3375: </table>
3376: </div>
3377:
3378: <p>These prebuilt package tools use <code xmlns=
3379: "http://www.w3.org/TR/xhtml1/transitional" class=
3380: "filename">/usr/pkg</code> for the base directory, and
3381: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3382: class="filename">/var/db/pkg</code> for the database of
3383: installed packages. If you cannot use these directories
3384: for whatever reasons (maybe because you're not root), you
3385: have to build the package tools yourself, which is
3386: explained in <a href="#bootstrapping-pkgsrc" title=
3387: "3.1. Bootstrapping pkgsrc">Section 3.1,
3388: “Bootstrapping pkgsrc”</a>.</p>
1.1 grant 3389:
1.67 hubertf 3390: <div class="sect2" lang="en">
1.1 grant 3391: <div class="titlepage">
3392: <div>
3393: <div>
1.30 wiz 3394: <h3 class="title"><a name=
1.70 rillig 3395: "finding-binary-packages"></a>4.1.1. Finding
3396: binary packages</h3>
1.1 grant 3397: </div>
3398: </div>
3399: </div>
3400:
1.70 rillig 3401: <p>To install binary packages, you first need to know
3402: from where to get them. You can get them on CD-ROMs,
3403: DVDs, or via FTP or HTTP.</p>
3404:
3405: <p>For NetBSD, the binary packages are made available
3406: on <code xmlns=
3407: "http://www.w3.org/TR/xhtml1/transitional" class=
3408: "filename">ftp.NetBSD.org</code> and its mirrors, in
3409: the directory <code xmlns=
1.45 wiz 3410: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 rillig 3411: "filename">/pub/NetBSD/packages/<em class=
3412: "replaceable"><code>OSVERSION</code></em>/<em class=
3413: "replaceable"><code>ARCH</code></em>/</code>. For
3414: <em class="replaceable"><code>OSVERSION</code></em>,
3415: you should insert the output of <span><strong class=
3416: "command">uname -r</strong></span>, and for <em class=
3417: "replaceable"><code>ARCH</code></em> the output of
3418: <span><strong class="command">uname
3419: -p</strong></span>.</p>
3420:
3421: <p>For some other platforms, binary packages can be
3422: found at the following locations:</p>
3423:
3424: <div class="informaltable">
3425: <a name="binary-packages"></a>
3426:
3427: <table border="1">
3428: <colgroup>
3429: <col />
3430: <col />
3431: </colgroup>
3432:
3433: <thead>
3434: <tr>
3435: <th>Platform</th>
3436:
3437: <th>URL</th>
3438: </tr>
3439: </thead>
3440:
3441: <tbody>
3442: <tr>
1.72 rillig 3443: <td>Solaris 9</td>
3444:
3445: <td><code xmlns=
3446: "http://www.w3.org/TR/xhtml1/transitional"
3447: class=
3448: "filename">ftp://ftp0.mh.bbc.co.uk/pub/pkgsrc/packages/</code></td>
3449: </tr>
3450:
3451: <tr>
3452: <td>Solaris 10</td>
1.70 rillig 3453:
3454: <td><code xmlns=
3455: "http://www.w3.org/TR/xhtml1/transitional"
3456: class=
3457: "filename">http://public.enst.fr/pkgsrc/packages/</code></td>
3458: </tr>
3459: </tbody>
3460: </table>
3461: </div>
3462:
1.72 rillig 3463: <p>Most of these directories contain the pkgsrc
3464: distribution for multiple platforms. Select the
3465: appropriate subdirectories, according to your machine
3466: architecture and operating system, until you find a
3467: directory called <code xmlns=
1.45 wiz 3468: "http://www.w3.org/TR/xhtml1/transitional" class=
1.72 rillig 3469: "filename">All</code>. This directory contains all the
3470: binary packages. Further, there are subdirectories for
1.70 rillig 3471: categories that contain symbolic links that point to
3472: the actual binary package in <code xmlns=
1.45 wiz 3473: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 rillig 3474: "filename">../All</code>. This directory layout is used
3475: for all package repositories, no matter if they are
3476: accessed via HTTP, FTP, NFS, CD-ROM, or the local
3477: filesystem.</p>
1.1 grant 3478: </div>
3479:
1.67 hubertf 3480: <div class="sect2" lang="en">
1.1 grant 3481: <div class="titlepage">
3482: <div>
3483: <div>
1.30 wiz 3484: <h3 class="title"><a name=
1.70 rillig 3485: "installing-binary-packages"></a>4.1.2. Installing
3486: binary packages</h3>
1.1 grant 3487: </div>
3488: </div>
3489: </div>
3490:
1.47 reed 3491: <p>If you have the files on a CD-ROM or downloaded them
1.23 wiz 3492: to your hard disk, you can install them with the
1.27 rillig 3493: following command (be sure to <span><strong class=
1.14 xtraeme 3494: "command">su</strong></span> to root first):</p>
1.1 grant 3495: <pre class="screen">
1.14 xtraeme 3496: <code class="prompt">#</code> <strong class=
3497: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 3498: </pre>
3499:
3500: <p>If you have FTP access and you don't want to
3501: download the packages via FTP prior to installation,
1.14 xtraeme 3502: you can do this automatically by giving
3503: <span><strong class="command">pkg_add</strong></span>
3504: an FTP URL:</p>
1.1 grant 3505: <pre class="screen">
1.14 xtraeme 3506: <code class="prompt">#</code> <strong class=
1.27 rillig 3507: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 3508: </pre>
3509:
1.27 rillig 3510: <p>Note that any prerequisite packages needed to run
3511: the package in question will be installed, too,
1.1 grant 3512: assuming they are present where you install from.</p>
3513:
1.23 wiz 3514: <p>To save some typing, you can set the <code class=
3515: "varname">PKG_PATH</code> environment variable to a
1.47 reed 3516: semicolon-separated list of paths (including remote
1.23 wiz 3517: URLs); trailing slashes are not allowed.</p>
3518:
1.45 wiz 3519: <p>Additionally to the <code xmlns=
3520: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 3521: "filename">All</code> directory there exists a
1.45 wiz 3522: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3523: class="filename">vulnerable</code> directory to which
3524: binary packages with known vulnerabilities are moved,
3525: since removing them could cause missing dependencies.
3526: To use these packages, add the <code xmlns=
3527: "http://www.w3.org/TR/xhtml1/transitional" class=
3528: "filename">vulnerable</code> directory to your
3529: <code class="varname">PKG_PATH</code>. However, you
3530: should run <a xmlns=
1.23 wiz 3531: "http://www.w3.org/TR/xhtml1/transitional" href=
3532: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 3533: target="_top"><code xmlns="" class=
3534: "filename">security/audit-packages</code></a>
1.47 reed 3535: regularly, especially after installing new packages,
3536: and verify that the vulnerabilities are acceptable for
3537: your configuration. An example <code class=
3538: "varname">PKG_PATH</code> would be: <code xmlns=
3539: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 3540: "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 3541: Please note that semicolon (';') is a shell
3542: meta-character, so you'll probably have to quote
3543: it.</p>
3544:
1.1 grant 3545: <p>After you've installed packages, be sure to have
1.45 wiz 3546: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3547: class="filename">/usr/pkg/bin</code> and <code xmlns=
3548: "http://www.w3.org/TR/xhtml1/transitional" class=
3549: "filename">/usr/pkg/sbin</code> in your <code class=
3550: "varname">PATH</code> so you can actually start the
3551: just installed program.</p>
1.1 grant 3552: </div>
3553:
1.67 hubertf 3554: <div class="sect2" lang="en">
1.1 grant 3555: <div class="titlepage">
3556: <div>
3557: <div>
1.67 hubertf 3558: <h3 class="title"><a name=
1.30 wiz 3559: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 3560: warning</h3>
3561: </div>
3562: </div>
3563: </div>
3564:
3565: <p>Please pay very careful attention to the warnings
3566: expressed in the <a href=
3567: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3568: <span class="citerefentry"><span class=
3569: "refentrytitle">pkg_add</span>(1)</span></a> manual
3570: page about the inherent dangers of installing binary
3571: packages which you did not create yourself, and the
3572: security holes that can be introduced onto your system
3573: by indiscriminate adding of such files.</p>
1.66 rillig 3574:
3575: <p>The same warning of course applies to every package
3576: you install from source when you haven't completely
3577: read and understood the source code of the package, the
3578: compiler that is used to build the package and all the
3579: other tools that are involved.</p>
1.1 grant 3580: </div>
3581: </div>
3582:
1.67 hubertf 3583: <div class="sect1" lang="en">
1.1 grant 3584: <div class="titlepage">
3585: <div>
3586: <div>
3587: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3588: "building-packages-from-source"></a>4.2. Building
1.1 grant 3589: packages from source</h2>
3590: </div>
3591: </div>
3592: </div>
3593:
3594: <p>This assumes that the package is already in pkgsrc. If
3595: it is not, see <a href="#developers-guide" title=
1.46 gdt 3596: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 3597: “The pkgsrc developer's guide”</a> for
3598: instructions how to create your own packages.</p>
1.1 grant 3599:
1.67 hubertf 3600: <div class="sect2" lang="en">
1.1 grant 3601: <div class="titlepage">
3602: <div>
3603: <div>
1.67 hubertf 3604: <h3 class="title"><a name=
1.30 wiz 3605: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 3606: </div>
3607: </div>
3608: </div>
3609:
3610: <p>To build packages from source on a NetBSD system the
3611: “<span class="quote">comp</span>” and the
3612: “<span class="quote">text</span>”
3613: distribution sets must be installed. If you want to
1.47 reed 3614: build X11-related packages the “<span class=
1.1 grant 3615: "quote">xbase</span>” and “<span class=
3616: "quote">xcomp</span>” distribution sets are
3617: required, too.</p>
3618: </div>
3619:
1.67 hubertf 3620: <div class="sect2" lang="en">
1.1 grant 3621: <div class="titlepage">
3622: <div>
3623: <div>
1.67 hubertf 3624: <h3 class="title"><a name=
3625: "fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 3626: distfiles</h3>
3627: </div>
3628: </div>
3629: </div>
3630:
1.27 rillig 3631: <p>The first step for building a package is downloading
3632: the distfiles (i.e. the unmodified source). If they
3633: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 3634: automatically.</p>
3635:
3636: <p>You can overwrite some of the major distribution
3637: sites to fit to sites that are close to your own. Have
1.45 wiz 3638: a look at <code xmlns=
3639: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3640: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 3641: some examples — in particular, look for the
1.14 xtraeme 3642: <code class="varname">MASTER_SORT</code>, <code class=
3643: "varname">MASTER_SORT_REGEX</code> and <code class=
3644: "varname">INET_COUNTRY</code> definitions. This may
3645: save some of your bandwidth and time.</p>
1.1 grant 3646:
3647: <p>You can change these settings either in your shell's
3648: environment, or, if you want to keep the settings, by
1.45 wiz 3649: editing the <code xmlns=
3650: "http://www.w3.org/TR/xhtml1/transitional" class=
3651: "filename">/etc/mk.conf</code> file, and adding the
3652: definitions there.</p>
1.1 grant 3653:
3654: <p>If you don't have a permanent Internet connection
3655: and you want to know which files to download,
1.14 xtraeme 3656: <span><strong class="command">make
3657: fetch-list</strong></span> will tell you what you'll
1.45 wiz 3658: need. Put these distfiles into <code xmlns=
3659: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3660: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 3661: </div>
3662:
1.67 hubertf 3663: <div class="sect2" lang="en">
1.1 grant 3664: <div class="titlepage">
3665: <div>
3666: <div>
1.30 wiz 3667: <h3 class="title"><a name=
3668: "how-to-build-and-install"></a>4.2.3. How to
3669: build and install</h3>
1.1 grant 3670: </div>
3671: </div>
3672: </div>
3673:
3674: <p>Assuming that the distfile has been fetched (see
3675: previous section), become root and change into the
1.47 reed 3676: relevant directory and run <span><strong class=
3677: "command">make</strong></span>.</p>
3678:
3679: <div class="note" style=
3680: "margin-left: 0.5in; margin-right: 0.5in;">
3681: <h3 class="title">Note</h3>
3682:
3683: <p>If using bootstrap or pkgsrc on a non-NetBSD
3684: system, use the pkgsrc <span><strong class=
3685: "command">bmake</strong></span> command instead of
3686: “<span class="quote">make</span>” in the
3687: examples in this guide.</p>
3688: </div>
3689:
3690: <p>For example, type</p>
1.1 grant 3691: <pre class="screen">
1.14 xtraeme 3692: <code class="prompt">%</code> <strong class=
3693: "userinput"><code>cd misc/figlet</code></strong>
3694: <code class="prompt">%</code> <strong class=
3695: "userinput"><code>make</code></strong>
1.1 grant 3696: </pre>
3697:
3698: <p>at the shell prompt to build the various components
3699: of the package, and</p>
3700: <pre class="screen">
1.14 xtraeme 3701: <code class="prompt">#</code> <strong class=
3702: "userinput"><code>make install</code></strong>
1.1 grant 3703: </pre>
3704:
3705: <p>to install the various components into the correct
3706: places on your system. Installing the package on your
3707: system requires you to be root. However, pkgsrc has a
3708: <span class="emphasis"><em>just-in-time-su</em></span>
3709: feature, which allows you to only become root for the
3710: actual installation step</p>
3711:
3712: <p>Taking the figlet utility as an example, we can
3713: install it on our system by building as shown in
3714: <a href="#logs" title=
1.67 hubertf 3715: "Appendix B. Build logs">Appendix B,
3716: <i>Build logs</i></a>.</p>
1.1 grant 3717:
3718: <p>The program is installed under the default root of
1.45 wiz 3719: the packages tree - <code xmlns=
3720: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3721: "filename">/usr/pkg</code>. Should this not conform to
3722: your tastes, set the <code class=
3723: "varname">LOCALBASE</code> variable in your
1.1 grant 3724: environment, and it will use that value as the root of
1.45 wiz 3725: your packages tree. So, to use <code xmlns=
3726: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3727: "filename">/usr/local</code>, set <code class=
3728: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 3729: environment. Please note that you should use a
3730: directory which is dedicated to packages and not shared
1.47 reed 3731: with other programs (i.e., do not try and use
1.14 xtraeme 3732: <code class="varname">LOCALBASE=/usr</code>). Also, you
3733: should not try to add any of your own files or
1.45 wiz 3734: directories (such as <code xmlns=
3735: "http://www.w3.org/TR/xhtml1/transitional" class=
3736: "filename">src/</code>, <code xmlns=
3737: "http://www.w3.org/TR/xhtml1/transitional" class=
3738: "filename">obj/</code>, or <code xmlns=
3739: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3740: "filename">pkgsrc/</code>) below the <code class=
3741: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 3742: possible conflicts between programs and other files
3743: installed by the package system and whatever else may
3744: have been installed there.</p>
3745:
1.45 wiz 3746: <p>Some packages look in <code xmlns=
3747: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3748: "filename">/etc/mk.conf</code> to alter some
1.1 grant 3749: configuration options at build time. Have a look at
1.45 wiz 3750: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3751: class="filename">pkgsrc/mk/defaults/mk.conf</code> to
3752: get an overview of what will be set there by default.
1.14 xtraeme 3753: Environment variables such as <code class=
1.45 wiz 3754: "varname">LOCALBASE</code> can be set in <code xmlns=
3755: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3756: "filename">/etc/mk.conf</code> to save having to
3757: remember to set them each time you want to use
3758: pkgsrc.</p>
1.1 grant 3759:
3760: <p>Occasionally, people want to “<span class=
3761: "quote">look under the covers</span>” to see what
3762: is going on when a package is building or being
3763: installed. This may be for debugging purposes, or out
3764: of simple curiosity. A number of utility values have
3765: been added to help with this.</p>
3766:
3767: <div class="orderedlist">
3768: <ol type="1">
3769: <li>
3770: <p>If you invoke the <a href=
3771: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3772: <span class="citerefentry"><span class=
3773: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 3774: with <code class=
3775: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
3776: amount of information will be displayed. For
3777: example,</p>
1.1 grant 3778: <pre class="screen">
1.14 xtraeme 3779: <strong class=
3780: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 3781: </pre>
3782:
3783: <p>will show all the commands that are invoked,
3784: up to and including the “<span class=
3785: "quote">patch</span>” stage.</p>
3786: </li>
3787:
3788: <li>
3789: <p>If you want to know the value of a certain
1.22 tv 3790: <a href=
3791: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3792: <span class="citerefentry"><span class=
3793: "refentrytitle">make</span>(1)</span></a>
3794: definition, then the <code class=
1.14 xtraeme 3795: "varname">VARNAME</code> definition should be
3796: used, in conjunction with the show-var target.
3797: e.g. to show the expansion of the <a href=
1.1 grant 3798: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3799: <span class="citerefentry"><span class=
3800: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 3801: variable <code class=
1.22 tv 3802: "varname">LOCALBASE</code>:</p>
1.1 grant 3803: <pre class="screen">
1.14 xtraeme 3804: <code class="prompt">%</code> <strong class=
3805: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 3806: /usr/pkg
1.14 xtraeme 3807: <code class="prompt">%</code>
1.1 grant 3808:
3809: </pre>
3810: </li>
3811: </ol>
3812: </div>
3813:
3814: <p>If you want to install a binary package that you've
3815: either created yourself (see next section), that you
3816: put into pkgsrc/packages manually or that is located on
1.8 wiz 3817: a remote FTP server, you can use the "bin-install"
1.1 grant 3818: target. This target will install a binary package - if
3819: available - via <a href=
3820: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3821: <span class="citerefentry"><span class=
3822: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 3823: <span><strong class="command">make
3824: package</strong></span>. The list of remote FTP sites
3825: searched is kept in the variable <code class=
3826: "varname">BINPKG_SITES</code>, which defaults to
3827: ftp.NetBSD.org. Any flags that should be added to
3828: <a href=
1.1 grant 3829: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3830: <span class="citerefentry"><span class=
3831: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 3832: into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45 wiz 3833: See <code xmlns=
3834: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3835: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
3836: details.</p>
1.1 grant 3837:
1.47 reed 3838: <p>A final word of warning: If you set up a system that
1.14 xtraeme 3839: has a non-standard setting for <code class=
3840: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 3841: any packages are installed, as you can not use several
3842: directories for the same purpose. Doing so will result
3843: in pkgsrc not being able to properly detect your
3844: installed packages, and fail miserably. Note also that
3845: precompiled binary packages are usually built with the
1.14 xtraeme 3846: default <code class="varname">LOCALBASE</code> of
1.45 wiz 3847: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3848: class="filename">/usr/pkg</code>, and that you should
3849: <span class="emphasis"><em>not</em></span> install any
3850: if you use a non-standard <code class=
1.14 xtraeme 3851: "varname">LOCALBASE</code>.</p>
1.1 grant 3852: </div>
3853:
1.67 hubertf 3854: <div class="sect2" lang="en">
1.1 grant 3855: <div class="titlepage">
3856: <div>
3857: <div>
1.30 wiz 3858: <h3 class="title"><a name=
3859: "selecting-the-compiler"></a>4.2.4. Selecting
3860: the compiler</h3>
1.1 grant 3861: </div>
3862: </div>
3863: </div>
3864:
3865: <p>By default, pkgsrc will use GCC to build packages.
3866: This may be overridden by setting the following
3867: variables in /etc/mk.conf:</p>
3868:
3869: <div class="variablelist">
3870: <dl>
1.14 xtraeme 3871: <dt><span class="term"><code class=
3872: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3873:
3874: <dd>
3875: <p>This is a list of values specifying the chain
3876: of compilers to invoke when building packages.
3877: Valid values are:</p>
3878:
3879: <div class="itemizedlist">
3880: <ul type="disc">
3881: <li>
1.14 xtraeme 3882: <p><code class="varname">distcc</code>:
1.1 grant 3883: distributed C/C++ (chainable)</p>
3884: </li>
3885:
3886: <li>
1.14 xtraeme 3887: <p><code class="varname">ccache</code>:
1.1 grant 3888: compiler cache (chainable)</p>
3889: </li>
3890:
3891: <li>
1.14 xtraeme 3892: <p><code class="varname">gcc</code>: GNU
3893: C/C++ Compiler</p>
1.1 grant 3894: </li>
3895:
3896: <li>
1.14 xtraeme 3897: <p><code class="varname">mipspro</code>:
1.1 grant 3898: Silicon Graphics, Inc. MIPSpro
3899: (n32/n64)</p>
3900: </li>
3901:
3902: <li>
1.14 xtraeme 3903: <p><code class="varname">mipspro</code>:
1.1 grant 3904: Silicon Graphics, Inc. MIPSpro (o32)</p>
3905: </li>
3906:
3907: <li>
1.64 kim 3908: <p><code class="varname">sunpro</code>: Sun
1.1 grant 3909: Microsystems, Inc. WorkShip/Forte/Sun ONE
3910: Studio</p>
3911: </li>
3912: </ul>
3913: </div>
3914:
3915: <p>The default is “<span class=
1.14 xtraeme 3916: "quote"><code class=
3917: "varname">gcc</code></span>”. You can use
3918: <code class="varname">ccache</code> and/or
3919: <code class="varname">distcc</code> with an
3920: appropriate <code class=
3921: "varname">PKGSRC_COMPILER</code> setting, e.g.
3922: “<span class="quote"><code class=
3923: "varname">ccache gcc</code></span>”. This
1.1 grant 3924: variable should always be terminated with a value
3925: for a real compiler.</p>
3926: </dd>
3927:
1.14 xtraeme 3928: <dt><span class="term"><code class=
3929: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3930:
3931: <dd>
3932: <p>This specifies the minimum version of GCC to
3933: use when building packages. If the system GCC
3934: doesn't satisfy this requirement, then pkgsrc
3935: will build and install one of the GCC packages to
3936: use instead.</p>
3937: </dd>
3938: </dl>
3939: </div>
3940: </div>
3941: </div>
3942: </div>
3943:
1.67 hubertf 3944: <div class="chapter" lang="en">
1.1 grant 3945: <div class="titlepage">
3946: <div>
3947: <div>
1.67 hubertf 3948: <h2 class="title"><a name=
1.38 dillo 3949: "configuring"></a>Chapter 5. Configuring
3950: pkgsrc</h2>
3951: </div>
3952: </div>
3953: </div>
3954:
3955: <div class="toc">
3956: <p><b>Table of Contents</b></p>
3957:
3958: <dl>
3959: <dt><span class="sect1"><a href=
1.45 wiz 3960: "#general-configuration">5.1. General
3961: configuration</a></span></dt>
3962:
3963: <dt><span class="sect1"><a href=
3964: "#variables-affecting-build">5.2. Variables affecting
3965: the build process</a></span></dt>
3966:
3967: <dt><span class="sect1"><a href=
3968: "#developer-advanced-settings">5.3. Developer/advanced
3969: settings</a></span></dt>
3970:
3971: <dt><span class="sect1"><a href=
3972: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 3973: Options</a></span></dt>
1.38 dillo 3974: </dl>
3975: </div>
3976:
1.67 hubertf 3977: <div class="sect1" lang="en">
1.38 dillo 3978: <div class="titlepage">
3979: <div>
3980: <div>
3981: <h2 class="title" style="clear: both"><a name=
1.45 wiz 3982: "general-configuration"></a>5.1. General
3983: configuration</h2>
3984: </div>
3985: </div>
3986: </div>
3987:
1.47 reed 3988: <p>In this section, you can find some variables that
3989: apply to all pkgsrc packages. The preferred method of
3990: setting these variables is by setting them in
3991: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3992: class="filename">/etc/mk.conf</code>.</p>
1.45 wiz 3993:
3994: <div class="itemizedlist">
3995: <ul type="disc">
3996: <li>
3997: <p><code class="varname">LOCALBASE</code>: Where
3998: packages will be installed. The default is
3999: <code xmlns=
4000: "http://www.w3.org/TR/xhtml1/transitional" class=
4001: "filename">/usr/pkg</code>. Do not mix binary
4002: packages with different <code class=
4003: "varname">LOCALBASE</code>s!</p>
4004: </li>
4005:
4006: <li>
4007: <p><code class="varname">CROSSBASE</code>: Where
4008: “<span class="quote">cross</span>”
4009: category packages will be installed. The default is
4010: <code xmlns=
4011: "http://www.w3.org/TR/xhtml1/transitional" class=
4012: "filename">${LOCALBASE}/cross</code>.</p>
4013: </li>
4014:
4015: <li>
4016: <p><code class="varname">X11BASE</code>: Where X11
4017: is installed on the system. The default is
4018: <code xmlns=
4019: "http://www.w3.org/TR/xhtml1/transitional" class=
4020: "filename">/usr/X11R6</code>.</p>
4021: </li>
4022:
4023: <li>
4024: <p><code class="varname">DISTDIR</code>: Where to
4025: store the downloaded copies of the original source
4026: distributions used for building pkgsrc packages.
4027: The default is <code xmlns=
4028: "http://www.w3.org/TR/xhtml1/transitional" class=
4029: "filename">${PKGSRCDIR}/distfiles</code>.</p>
4030: </li>
4031:
4032: <li>
4033: <p><code class=
4034: "varname">MASTER_SITE_OVERRIDE</code>: If set,
4035: override the packages' <code class=
4036: "varname">MASTER_SITES</code> with this value.</p>
4037: </li>
4038:
4039: <li>
4040: <p><code class="varname">MASTER_SITE_BACKUP</code>:
4041: Backup location(s) for distribution files and patch
4042: files if not found locally or in <code xmlns=
4043: "http://www.w3.org/TR/xhtml1/transitional" class=
4044: "filename">${MASTER_SITES}</code> or <code xmlns=
4045: "http://www.w3.org/TR/xhtml1/transitional" class=
4046: "filename">${PATCH_SITES}</code> respectively. The
4047: defaults are <code xmlns=
4048: "http://www.w3.org/TR/xhtml1/transitional" class=
4049: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
4050: and <code xmlns=
4051: "http://www.w3.org/TR/xhtml1/transitional" class=
4052: "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
4053: </li>
4054:
4055: <li>
4056: <p><code class="varname">BINPKG_SITES</code>: List
4057: of sites carrying binary pkgs.</p>
4058: </li>
4059: </ul>
4060: </div>
4061: </div>
4062:
1.67 hubertf 4063: <div class="sect1" lang="en">
1.45 wiz 4064: <div class="titlepage">
4065: <div>
4066: <div>
4067: <h2 class="title" style="clear: both"><a name=
4068: "variables-affecting-build"></a>5.2. Variables
4069: affecting the build process</h2>
4070: </div>
4071: </div>
4072: </div>
4073:
4074: <p>XXX</p>
4075:
4076: <div class="itemizedlist">
4077: <ul type="disc">
4078: <li>
4079: <p><code class="varname">PACKAGES</code>: The top
4080: level directory for the binary packages. The
4081: default is <code xmlns=
4082: "http://www.w3.org/TR/xhtml1/transitional" class=
4083: "filename">${PKGSRCDIR}/packages</code>.</p>
4084: </li>
4085:
4086: <li>
4087: <p><code class="varname">WRKOBJDIR</code>: The top
4088: level directory where, if defined, the separate
4089: working directories will get created, and
4090: symbolically linked to from <code xmlns=
4091: "http://www.w3.org/TR/xhtml1/transitional" class=
4092: "filename">${WRKDIR}</code> (see below). This is
4093: useful for building packages on several
4094: architectures, then <code xmlns=
4095: "http://www.w3.org/TR/xhtml1/transitional" class=
4096: "filename">${PKGSRCDIR}</code> can be NFS-mounted
4097: while <code xmlns=
4098: "http://www.w3.org/TR/xhtml1/transitional" class=
4099: "filename">${WRKOBJDIR}</code> is local to every
4100: architecture. (It should be noted that <code class=
4101: "varname">PKGSRCDIR</code> should not be set by the
4102: user — it is an internal definition which
4103: refers to the root of the pkgsrc tree. It is
4104: possible to have many pkgsrc tree instances.)</p>
4105: </li>
4106:
4107: <li>
4108: <p><code class="varname">LOCALPATCHES</code>:
4109: Directory for local patches that aren't part of
4110: pkgsrc. See <a href="#components.patches" title=
4111: "8.3. patches/*">Section 8.3,
4112: “patches/*”</a> for more information.
4113: <em class="replaceable"><code>rel</code></em> and
4114: <em class="replaceable"><code>arch</code></em> are
4115: replaced with OS release (“<span class=
4116: "quote">2.0</span>”, etc.) and architecture
4117: (“<span class="quote">mipsel</span>”,
4118: etc.).</p>
4119: </li>
4120:
4121: <li>
4122: <p><code class="varname">PKGMAKECONF</code>:
4123: Location of the <code xmlns=
4124: "http://www.w3.org/TR/xhtml1/transitional" class=
4125: "filename">mk.conf</code> file used by a package's
4126: BSD-style Makefile. If this is not set,
4127: <code class="varname">MAKECONF</code> is set to
4128: <code xmlns=
4129: "http://www.w3.org/TR/xhtml1/transitional" class=
4130: "filename">/dev/null</code> to avoid picking up
4131: settings used by builds in <code xmlns=
4132: "http://www.w3.org/TR/xhtml1/transitional" class=
4133: "filename">/usr/src</code>.</p>
4134: </li>
4135: </ul>
4136: </div>
4137: </div>
4138:
1.67 hubertf 4139: <div class="sect1" lang="en">
1.45 wiz 4140: <div class="titlepage">
4141: <div>
4142: <div>
4143: <h2 class="title" style="clear: both"><a name=
4144: "developer-advanced-settings"></a>5.3. Developer/advanced
4145: settings</h2>
4146: </div>
4147: </div>
4148: </div>
4149:
4150: <p>XXX</p>
4151:
4152: <div class="itemizedlist">
4153: <ul type="disc">
4154: <li>
4155: <p><code class="varname">PKG_DEVELOPER</code>: Run
4156: some sanity checks that package developers
4157: want:</p>
4158:
4159: <div class="itemizedlist">
4160: <ul type="circle">
4161: <li>
4162: <p>make sure patches apply with zero fuzz</p>
4163: </li>
4164:
4165: <li>
4166: <p>run check-shlibs to see that all binaries
4167: will find their shared libs.</p>
4168: </li>
4169: </ul>
4170: </div>
4171: </li>
4172:
4173: <li>
4174: <p><code class="varname">PKG_DEBUG_LEVEL</code>:
4175: The level of debugging output which is displayed
4176: whilst making and installing the package. The
4177: default value for this is 0, which will not display
4178: the commands as they are executed (normal, default,
4179: quiet operation); the value 1 will display all
4180: shell commands before their invocation, and the
4181: value 2 will display both the shell commands before
4182: their invocation, and their actual execution
4183: progress with <span><strong class="command">set
4184: -x</strong></span> will be displayed.</p>
4185: </li>
1.58 erh 4186:
4187: <li>
4188: <p><code class=
4189: "varname">ALLOW_VULNERABILITIES.<em class=
4190: "replaceable"><code>pkgbase</code></em></code>: A
4191: space separated list of vulnerability IDs that may
4192: be ignored when performing the automated security
4193: checks. These IDs are listed in the
4194: pkg-vulnerabilities file and are displayed by
4195: <span><strong class=
4196: "command">audit-packages</strong></span> when it
4197: finds a vulnerable package.</p>
4198: </li>
4199:
4200: <li>
4201: <p><code class=
4202: "varname">SKIP_AUDIT_PACKAGES</code>: If this is
4203: set to “<span class=
4204: "quote">yes</span>”, the automated security
4205: checks (which use the <a xmlns=
4206: "http://www.w3.org/TR/xhtml1/transitional" href=
4207: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
4208: target="_top"><code xmlns="" class=
4209: "filename">security/audit-packages</code></a>
4210: package) will be <span class=
4211: "strong"><strong>entirely</strong></span> skipped
4212: for <span class=
4213: "strong"><strong>all</strong></span> packages
4214: built. Normally you'll want to use
4215: ALLOW_VULNERABILITIES instead of this.</p>
4216: </li>
1.45 wiz 4217: </ul>
4218: </div>
4219: </div>
4220:
1.67 hubertf 4221: <div class="sect1" lang="en">
1.45 wiz 4222: <div class="titlepage">
4223: <div>
4224: <div>
4225: <h2 class="title" style="clear: both"><a name=
4226: "selecting-build-options"></a>5.4. Selecting
4227: Build Options</h2>
1.38 dillo 4228: </div>
4229: </div>
4230: </div>
4231:
4232: <p>Some packages have build time options, usually to
4233: select between different dependencies, enable optional
4234: support for big dependencies or enable experimental
4235: features.</p>
4236:
4237: <p>To see which options, if any, a package supports, and
4238: which options are mutually exclusive, run
4239: <span><strong class="command">make
4240: show-options</strong></span>, for example:</p>
4241: <pre class="programlisting">
1.51 rillig 4242: The following options are supported by this package:
1.70 rillig 4243: ssl Enable SSL support.
1.51 rillig 4244: Exactly one of the following gecko options is required:
1.70 rillig 4245: firefox Use firefox as gecko rendering engine.
4246: mozilla Use mozilla as gecko rendering engine.
1.51 rillig 4247: At most one of the following database options may be selected:
1.70 rillig 4248: mysql Enable support for MySQL database.
4249: pgsql Enable support for PostgreSQL database.
1.51 rillig 4250:
4251: These options are enabled by default: firefox
4252: These options are currently enabled: mozilla ssl
1.38 dillo 4253: </pre>
4254:
1.45 wiz 4255: <p>The following variables can be defined in <code xmlns=
4256: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 4257: "filename">/etc/mk.conf</code> to select which options to
4258: enable for a package: <code class=
4259: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
4260: to select or disable options for all packages that
4261: support them, and <code class=
4262: "varname">PKG_OPTIONS.<em class=
4263: "replaceable"><code>pkgbase</code></em></code>, which can
4264: be used to select or disable options specifically for
4265: package <em class=
4266: "replaceable"><code>pkgbase</code></em>. Options listed
4267: in these variables are selected, options preceded by
1.67 hubertf 4268: “<span class="quote">-</span>” are disabled.
4269: A few examples:</p>
4270: <pre class="screen">
4271: <code class="prompt">$</code> <span><strong class=
4272: "command">grep "PKG.*OPTION" /etc/mk.conf</strong></span>
1.68 rillig 4273: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1.67 hubertf 4274: PKG_OPTIONS.kdebase= debug -sasl
4275: PKG_OPTIONS.apache= suexec
4276: </pre>
1.38 dillo 4277:
1.39 dillo 4278: <p>The following settings are consulted in the order
4279: given, and the last setting that selects or disables an
4280: option is used:</p>
1.38 dillo 4281:
4282: <div class="orderedlist">
4283: <ol type="1">
4284: <li>
4285: <p>the default options as suggested by the package
4286: maintainer</p>
4287: </li>
4288:
4289: <li>
4290: <p>the options implied by the settings of legacy
4291: variables (see below)</p>
4292: </li>
4293:
4294: <li>
4295: <p><code class=
4296: "varname">PKG_DEFAULT_OPTIONS</code></p>
4297: </li>
4298:
4299: <li>
4300: <p><code class="varname">PKG_OPTIONS.<em class=
4301: "replaceable"><code>pkgbase</code></em></code></p>
4302: </li>
4303: </ol>
4304: </div>
4305:
4306: <p>For groups of mutually exclusive options, the last
4307: option selected is used, all others are automatically
4308: disabled. If an option of the group is explicitly
4309: disabled, the previously selected option, if any, is
4310: used. It is an error if no option from a required group
4311: of options is selected, and building the package will
4312: fail.</p>
4313:
4314: <p>Before the options framework was introduced, build
1.65 hubertf 4315: options were selected by setting a variable (often named
4316: <code class="varname">USE_<em class=
4317: "replaceable"><code>FOO</code></em></code>) in
1.45 wiz 4318: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4319: class="filename">/etc/mk.conf</code> for each option. To
4320: ease transition to the options framework for the user,
4321: these legacy variables are converted to the appropriate
1.65 hubertf 4322: options setting (<code class=
4323: "varname">PKG_OPTIONS.<em class=
4324: "replaceable"><code>pkgbase</code></em></code>)
4325: automatically. A warning is issued to prompt the user to
4326: update <code xmlns=
1.45 wiz 4327: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 4328: "filename">/etc/mk.conf</code> to use the options
1.65 hubertf 4329: framework directly. Support for the legacy variables will
4330: be removed eventually.</p>
1.38 dillo 4331: </div>
4332: </div>
4333:
1.67 hubertf 4334: <div class="chapter" lang="en">
1.38 dillo 4335: <div class="titlepage">
4336: <div>
4337: <div>
1.67 hubertf 4338: <h2 class="title"><a name=
1.38 dillo 4339: "binary"></a>Chapter 6. Creating binary
1.1 grant 4340: packages</h2>
4341: </div>
4342: </div>
4343: </div>
4344:
4345: <div class="toc">
4346: <p><b>Table of Contents</b></p>
4347:
4348: <dl>
1.30 wiz 4349: <dt><span class="sect1"><a href=
1.38 dillo 4350: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 4351: single binary package</a></span></dt>
1.1 grant 4352:
1.30 wiz 4353: <dt><span class="sect1"><a href=
1.38 dillo 4354: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 4355: Settings for creation of binary
4356: packages</a></span></dt>
4357:
1.38 dillo 4358: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 4359: a bulk build of all packages</a></span></dt>
4360:
4361: <dd>
4362: <dl>
4363: <dt><span class="sect2"><a href=
1.38 dillo 4364: "#binary.configuration">6.3.1.
1.1 grant 4365: Configuration</a></span></dt>
4366:
1.30 wiz 4367: <dt><span class="sect2"><a href=
1.38 dillo 4368: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 4369: environmental considerations</a></span></dt>
1.1 grant 4370:
1.38 dillo 4371: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 4372: Operation</a></span></dt>
4373:
1.30 wiz 4374: <dt><span class="sect2"><a href=
1.38 dillo 4375: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 4376:
1.30 wiz 4377: <dt><span class="sect2"><a href=
1.38 dillo 4378: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 4379: requirements</a></span></dt>
1.1 grant 4380:
1.30 wiz 4381: <dt><span class="sect2"><a href=
1.38 dillo 4382: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47 reed 4383: for chrooted builds</a></span></dt>
1.1 grant 4384:
1.30 wiz 4385: <dt><span class="sect2"><a href=
1.38 dillo 4386: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 4387: set of packages</a></span></dt>
1.13 hubertf 4388:
4389: <dt><span class="sect2"><a href=
1.38 dillo 4390: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 4391: build</a></span></dt>
1.1 grant 4392: </dl>
4393: </dd>
4394:
1.38 dillo 4395: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 4396: Creating a multiple CD-ROM packages
4397: collection</a></span></dt>
4398:
4399: <dd>
4400: <dl>
1.30 wiz 4401: <dt><span class="sect2"><a href=
1.38 dillo 4402: "#cdpack-example">6.4.1. Example of
1.30 wiz 4403: cdpack</a></span></dt>
1.1 grant 4404: </dl>
4405: </dd>
4406: </dl>
4407: </div>
4408:
1.67 hubertf 4409: <div class="sect1" lang="en">
1.1 grant 4410: <div class="titlepage">
4411: <div>
4412: <div>
4413: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4414: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 4415: a single binary package</h2>
1.1 grant 4416: </div>
4417: </div>
4418: </div>
4419:
4420: <p>Once you have built and installed a package, you can
4421: create a <span class="emphasis"><em>binary
4422: package</em></span> which can be installed on another
4423: system with <a href=
4424: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4425: <span class="citerefentry"><span class=
1.47 reed 4426: "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1 grant 4427: having to build the same package on a group of hosts and
4428: wasting CPU time. It also provides a simple means for
4429: others to install your package, should you distribute
4430: it.</p>
4431:
4432: <p>To create a binary package, change into the
1.14 xtraeme 4433: appropriate directory in pkgsrc, and run
4434: <span><strong class="command">make
4435: package</strong></span>:</p>
1.1 grant 4436: <pre class="screen">
1.14 xtraeme 4437: <code class="prompt">#</code> <strong class=
4438: "userinput"><code>cd misc/figlet</code></strong>
4439: <code class="prompt">#</code> <strong class=
4440: "userinput"><code>make package</code></strong>
1.1 grant 4441: </pre>
4442:
4443: <p>This will build and install your package (if not
4444: already done), and then build a binary package from what
1.14 xtraeme 4445: was installed. You can then use the <span><strong class=
4446: "command">pkg_*</strong></span> tools to manipulate it.
1.45 wiz 4447: Binary packages are created by default in <code xmlns=
4448: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4449: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 4450: gzipped tar file. See <a href="#logs.package" title=
1.67 hubertf 4451: "B.2. Packaging figlet">Section B.2,
1.1 grant 4452: “Packaging figlet”</a> for a continuation of
4453: the above <a xmlns=
4454: "http://www.w3.org/TR/xhtml1/transitional" href=
4455: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45 wiz 4456: target="_top"><code xmlns="" class=
4457: "filename">misc/figlet</code></a> example.</p>
1.1 grant 4458:
4459: <p>See <a href="#submit" title=
1.68 rillig 4460: "Chapter 18. Submitting and Committing">Chapter 18,
1.67 hubertf 4461: <i>Submitting and Committing</i></a> for information on
4462: how to submit such a binary package.</p>
1.1 grant 4463: </div>
4464:
1.67 hubertf 4465: <div class="sect1" lang="en">
1.1 grant 4466: <div class="titlepage">
4467: <div>
4468: <div>
4469: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4470: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 4471: for creation of binary packages</h2>
4472: </div>
4473: </div>
4474: </div>
4475:
4476: <p>See <a href="#build.helpful-targets" title=
1.56 rillig 4477: "14.16. Other helpful targets">Section 14.16,
1.1 grant 4478: “Other helpful targets”</a>.</p>
4479: </div>
4480:
1.67 hubertf 4481: <div class="sect1" lang="en">
1.1 grant 4482: <div class="titlepage">
4483: <div>
4484: <div>
4485: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 4486: "bulkbuild"></a>6.3. Doing a bulk build of all
4487: packages</h2>
1.1 grant 4488: </div>
4489: </div>
4490: </div>
4491:
4492: <p>If you want to get a full set of precompiled binary
4493: packages, this section describes how to get them. Beware
4494: that the bulk build will remove all currently installed
1.63 dillo 4495: packages from your system!</p>
4496:
4497: <p>Having an FTP server configured either on the machine
4498: doing the bulk builds or on a nearby NFS server can help
4499: to make the packages available to other machines that can
4500: then save time by installing only the binary packages.
4501: See <a href=
1.1 grant 4502: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
4503: <span class="citerefentry"><span class=
4504: "refentrytitle">ftpd</span>(8)</span></a> for more
4505: information. If you use a remote NFS server's storage, be
4506: sure to not actually compile on NFS storage, as this
4507: slows things down a lot.</p>
4508:
1.67 hubertf 4509: <div class="sect2" lang="en">
1.1 grant 4510: <div class="titlepage">
4511: <div>
4512: <div>
1.67 hubertf 4513: <h3 class="title"><a name=
1.38 dillo 4514: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 4515: </div>
4516: </div>
4517: </div>
4518:
1.67 hubertf 4519: <div class="sect3" lang="en">
1.1 grant 4520: <div class="titlepage">
4521: <div>
4522: <div>
1.63 dillo 4523: <h4 class="title"><a name=
4524: "binary.bulk.build.conf"></a>6.3.1.1. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4525: class="filename">build.conf</code></h4>
4526: </div>
4527: </div>
4528: </div>
4529:
4530: <p>The <code xmlns=
4531: "http://www.w3.org/TR/xhtml1/transitional" class=
4532: "filename">build.conf</code> file is the main
4533: configuration file for bulk builds. You can configure
4534: how your copy of pkgsrc is kept up to date, how the
4535: distfiles are downloaded, how the packages are built
4536: and how the report is generated. You can find an
4537: annotated example file in <code xmlns=
4538: "http://www.w3.org/TR/xhtml1/transitional" class=
4539: "filename">pkgsrc/mk/bulk/build.conf-example</code>.
4540: To use it, copy <code xmlns=
4541: "http://www.w3.org/TR/xhtml1/transitional" class=
4542: "filename">build.conf-example</code> to <code xmlns=
4543: "http://www.w3.org/TR/xhtml1/transitional" class=
4544: "filename">build.conf</code> and edit it, following
4545: the comments in that file.</p>
4546: </div>
4547:
1.67 hubertf 4548: <div class="sect3" lang="en">
1.63 dillo 4549: <div class="titlepage">
4550: <div>
4551: <div>
1.67 hubertf 4552: <h4 class="title"><a name=
1.63 dillo 4553: "binary.mk.conf"></a>6.3.1.2. /etc/mk.conf</h4>
1.1 grant 4554: </div>
4555: </div>
4556: </div>
4557:
1.45 wiz 4558: <p>You may want to set variables in <code xmlns=
4559: "http://www.w3.org/TR/xhtml1/transitional" class=
4560: "filename">/etc/mk.conf</code>. Look at <code xmlns=
4561: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4562: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 4563: details of the default settings. You will want to
1.14 xtraeme 4564: ensure that <code class=
4565: "varname">ACCEPTABLE_LICENSES</code> meet your local
4566: policy. As used in this example, <code class=
4567: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 4568: "emphasis"><em>all</em></span> licenses.</p>
4569: <pre class="programlisting">
1.51 rillig 4570: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
4571: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
4572: BSDSRCDIR= /usr/src
4573: BSDXSRCDIR= /usr/xsrc # for x11/xservers
4574: OBJHOSTNAME?= yes # use work.`hostname`
4575: FAILOVER_FETCH= yes # insist on the correct checksum
4576: PKG_DEVELOPER?= yes
4577: _ACCEPTABLE= yes
1.1 grant 4578: </pre>
4579:
1.63 dillo 4580: <p>Some options that are especially useful for bulk
4581: builds can be found at the top lines of the file
4582: <code xmlns=
4583: "http://www.w3.org/TR/xhtml1/transitional" class=
4584: "filename">mk/bulk/bsd.bulk-pkg.mk</code>. The most
4585: useful options of these are briefly described
4586: here.</p>
4587:
4588: <div class="itemizedlist">
4589: <ul type="disc">
4590: <li>
4591: <p>If you are on a slow machine, you may want
4592: to set <code class=
4593: "varname">USE_BULK_BROKEN_CHECK</code> to
4594: “<span class=
4595: "quote">no</span>”.</p>
4596: </li>
4597:
4598: <li>
4599: <p>If you are doing bulk builds from a
4600: read-only copy of pkgsrc, you have to set
4601: <code class="varname">BULKFILESDIR</code> to
4602: the directory where all log files are created.
4603: Otherwise the log files are created in the
4604: pkgsrc directory.</p>
4605: </li>
4606:
4607: <li>
4608: <p>Another important variable is <code class=
4609: "varname">BULK_PREREQ</code>, which is a list
4610: of packages that should be always available
4611: while building other packages.</p>
4612: </li>
4613: </ul>
1.1 grant 4614: </div>
1.68 rillig 4615:
4616: <p>Some other options are scattered in the pkgsrc
4617: infrastructure:</p>
4618:
4619: <div class="itemizedlist">
4620: <ul type="disc">
4621: <li>
1.69 rillig 4622: <p><code class=
4623: "varname">ALLOW_VULNERABLE_PACKAGES</code>
4624: should be set to <code class=
4625: "literal">yes</code>. The purpose of the bulk
4626: builds is creating binary packages, no matter
4627: if they are vulnerable or not. When uploading
4628: the packages to a public server, the vulnerable
4629: packages will be put into a directory of their
4630: own. Leaving this variable unset would prevent
4631: the bulk build system from even trying to build
4632: them, so possible building errors would not
4633: show up.</p>
4634: </li>
4635:
4636: <li>
1.68 rillig 4637: <p><code class="varname">CHECK_FILES</code>
4638: (<code xmlns=
4639: "http://www.w3.org/TR/xhtml1/transitional"
4640: class=
4641: "filename">pkgsrc/mk/bsd.pkg.check.mk</code>)
4642: can be set to “<span class=
4643: "quote">yes</span>” to check that the
4644: installed set of files matches the <code xmlns=
4645: "http://www.w3.org/TR/xhtml1/transitional"
4646: class="filename">PLIST</code>.</p>
4647: </li>
4648:
4649: <li>
4650: <p><code class=
4651: "varname">CHECK_INTERPRETER</code>
4652: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4653: class=
4654: "filename">pkgsrc/mk/bsd.pkg.check.mk</code>)
4655: can be set to “<span class=
4656: "quote">yes</span>” to check that the
4657: installed “<span class=
4658: "quote">#!</span>”-scripts will find
4659: their interpreter.</p>
4660: </li>
4661: </ul>
4662: </div>
1.1 grant 4663: </div>
4664:
1.67 hubertf 4665: <div class="sect3" lang="en">
1.1 grant 4666: <div class="titlepage">
4667: <div>
4668: <div>
1.67 hubertf 4669: <h4 class="title"><a name=
1.45 wiz 4670: "pre-build.local"></a>6.3.1.3. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4671: class="filename">pre-build.local</code></h4>
1.1 grant 4672: </div>
4673: </div>
4674: </div>
4675:
4676: <p>It is possible to configure the bulk build to
1.47 reed 4677: perform certain site-specific tasks at the end of the
1.45 wiz 4678: pre-build stage. If the file <code xmlns=
4679: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4680: "filename">pre-build.local</code> exists in
1.45 wiz 4681: <code xmlns=
4682: "http://www.w3.org/TR/xhtml1/transitional" class=
4683: "filename">/usr/pkgsrc/mk/bulk</code>, it will be
4684: executed (as a <a href=
1.24 wiz 4685: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
4686: <span class="citerefentry"><span class=
4687: "refentrytitle">sh</span>(1)</span></a> script) at
4688: the end of the usual pre-build stage. An example use
1.45 wiz 4689: of <code xmlns=
4690: "http://www.w3.org/TR/xhtml1/transitional" class=
4691: "filename">pre-build.local</code> is to have the
4692: line:</p>
1.1 grant 4693: <pre class="screen">
1.71 wiz 4694: echo "I do not have enough disk space to build this pig." \
4695: > misc/openoffice/$BROKENF
1.1 grant 4696: </pre>
4697:
4698: <p>to prevent the system from trying to build a
4699: particular package which requires nearly 3 GB of disk
4700: space.</p>
4701: </div>
4702: </div>
4703:
1.67 hubertf 4704: <div class="sect2" lang="en">
1.1 grant 4705: <div class="titlepage">
4706: <div>
4707: <div>
1.30 wiz 4708: <h3 class="title"><a name=
1.38 dillo 4709: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 4710: environmental considerations</h3>
1.1 grant 4711: </div>
4712: </div>
4713: </div>
4714:
1.45 wiz 4715: <p>As <code xmlns=
4716: "http://www.w3.org/TR/xhtml1/transitional" class=
4717: "filename">/usr/pkg</code> will be completely deleted
4718: at the start of bulk builds, make sure your login shell
4719: is placed somewhere else. Either drop it into
4720: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4721: class="filename">/usr/local/bin</code> (and adjust your
4722: login shell in the passwd file), or (re-)install it via
1.14 xtraeme 4723: <a href=
1.1 grant 4724: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4725: <span class="citerefentry"><span class=
4726: "refentrytitle">pkg_add</span>(1)</span></a> from
1.45 wiz 4727: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4728: class="filename">/etc/rc.local</code>, so you can login
4729: after a reboot (remember that your current process
4730: won't die if the package is removed, you just can't
4731: start any new instances of the shell any more). Also,
4732: if you use NetBSD earlier than 1.5, or you still want
4733: to use the pkgsrc version of ssh for some reason, be
4734: sure to install ssh before starting it from
4735: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4736: class="filename">rc.local</code>:</p>
1.1 grant 4737: <pre class="programlisting">
1.51 rillig 4738: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
4739: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
4740: /usr/pkg/etc/rc.d/sshd
4741: fi
1.1 grant 4742: </pre>
4743:
4744: <p>Not doing so will result in you being not able to
4745: log in via ssh after the bulk build is finished or if
4746: the machine gets rebooted or crashes. You have been
4747: warned! :)</p>
4748: </div>
4749:
1.67 hubertf 4750: <div class="sect2" lang="en">
1.1 grant 4751: <div class="titlepage">
4752: <div>
4753: <div>
1.67 hubertf 4754: <h3 class="title"><a name=
1.38 dillo 4755: "operation"></a>6.3.3. Operation</h3>
1.1 grant 4756: </div>
4757: </div>
4758: </div>
4759:
4760: <p>Make sure you don't need any of the packages still
4761: installed.</p>
4762:
4763: <div class="warning" style=
4764: "margin-left: 0.5in; margin-right: 0.5in;">
4765: <h3 class="title">Warning</h3>
4766:
4767: <p>During the bulk build, <span class=
4768: "emphasis"><em>all packages will be
4769: removed!</em></span></p>
4770: </div>
4771:
4772: <p>Be sure to remove all other things that might
4773: interfere with builds, like some libs installed in
1.45 wiz 4774: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4775: class="filename">/usr/local</code>, etc. then become
4776: root and type:</p>
1.1 grant 4777: <pre class="screen">
1.14 xtraeme 4778: <code class="prompt">#</code> <strong class=
4779: "userinput"><code>cd /usr/pkgsrc</code></strong>
4780: <code class="prompt">#</code> <strong class=
4781: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 4782: </pre>
4783:
4784: <p>If for some reason your last build didn't complete
4785: (power failure, system panic, ...), you can continue it
4786: by running:</p>
4787: <pre class="screen">
1.14 xtraeme 4788: <code class="prompt">#</code> <strong class=
4789: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 4790: </pre>
4791:
4792: <p>At the end of the bulk build, you will get a summary
4793: via mail, and find build logs in the directory
1.14 xtraeme 4794: specified by <code class="varname">FTP</code> in the
1.45 wiz 4795: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4796: class="filename">build.conf</code> file.</p>
1.1 grant 4797: </div>
4798:
1.67 hubertf 4799: <div class="sect2" lang="en">
1.1 grant 4800: <div class="titlepage">
4801: <div>
4802: <div>
1.67 hubertf 4803: <h3 class="title"><a name=
1.38 dillo 4804: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 4805: </div>
4806: </div>
4807: </div>
4808:
4809: <p>The bulk builds consist of three steps:</p>
4810:
4811: <div class="variablelist">
4812: <dl>
4813: <dt><span class="term">1. pre-build</span></dt>
4814:
4815: <dd>
4816: <p>The script updates your pkgsrc tree via
4817: (anon)cvs, then cleans out any broken distfiles,
4818: and removes all packages installed.</p>
4819: </dd>
4820:
4821: <dt><span class="term">2. the bulk
4822: build</span></dt>
4823:
4824: <dd>
4825: <p>This is basically “<span class=
4826: "quote">make bulk-package</span>” with an
4827: optimised order in which packages will be built.
4828: Packages that don't require other packages will
4829: be built first, and packages with many
4830: dependencies will be built later.</p>
4831: </dd>
4832:
4833: <dt><span class="term">3. post-build</span></dt>
4834:
4835: <dd>
4836: <p>Generates a report that's placed in the
1.45 wiz 4837: directory specified in the <code xmlns=
4838: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4839: "filename">build.conf</code> file named
1.45 wiz 4840: <code xmlns=
4841: "http://www.w3.org/TR/xhtml1/transitional" class=
4842: "filename">broken.html</code>, a short version of
4843: that report will also be mailed to the build's
4844: admin.</p>
1.1 grant 4845: </dd>
4846: </dl>
4847: </div>
4848:
4849: <p>During the build, a list of broken packages will be
1.45 wiz 4850: compiled in <code xmlns=
4851: "http://www.w3.org/TR/xhtml1/transitional" class=
4852: "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
4853: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4854: "filename">.../.broken.${MACHINE}</code> if
4855: <code class="varname">OBJMACHINE</code> is set),
4856: individual build logs of broken builds can be found in
4857: the package's directory. These files are used by the
4858: bulk-targets to mark broken builds to not waste time
4859: trying to rebuild them, and they can be used to debug
4860: these broken package builds later.</p>
1.1 grant 4861: </div>
4862:
1.67 hubertf 4863: <div class="sect2" lang="en">
1.1 grant 4864: <div class="titlepage">
4865: <div>
4866: <div>
1.30 wiz 4867: <h3 class="title"><a name=
1.38 dillo 4868: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 4869: space requirements</h3>
1.1 grant 4870: </div>
4871: </div>
4872: </div>
4873:
4874: <p>Currently, roughly the following requirements are
4875: valid for NetBSD 2.0/i386:</p>
4876:
4877: <div class="itemizedlist">
4878: <ul type="disc">
4879: <li>
4880: <p>10 GB - distfiles (NFS ok)</p>
4881: </li>
4882:
4883: <li>
4884: <p>8 GB - full set of all binaries (NFS ok)</p>
4885: </li>
4886:
4887: <li>
4888: <p>5 GB - temp space for compiling (local disk
4889: recommended)</p>
4890: </li>
4891: </ul>
4892: </div>
4893:
4894: <p>Note that all pkgs will be de-installed as soon as
4895: they are turned into a binary package, and that sources
4896: are removed, so there is no excessively huge demand to
4897: disk space. Afterwards, if the package is needed again,
4898: it will be installed via <a href=
4899: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4900: <span class="citerefentry"><span class=
4901: "refentrytitle">pkg_add</span>(1)</span></a> instead of
4902: building again, so there are no cycles wasted by
4903: recompiling.</p>
4904: </div>
4905:
1.67 hubertf 4906: <div class="sect2" lang="en">
1.1 grant 4907: <div class="titlepage">
4908: <div>
4909: <div>
1.67 hubertf 4910: <h3 class="title"><a name=
4911: "setting-up-a-sandbox"></a>6.3.6. Setting up
4912: a sandbox for chrooted builds</h3>
1.1 grant 4913: </div>
4914: </div>
4915: </div>
4916:
1.12 agc 4917: <p>If you don't want all the packages nuked from a
4918: machine (rendering it useless for anything but pkg
1.23 wiz 4919: compiling), there is the possibility of doing the
4920: package bulk build inside a chroot environment.</p>
1.12 agc 4921:
4922: <p>The first step is to set up a chroot sandbox, e.g.
1.45 wiz 4923: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4924: class="filename">/usr/sandbox</code>. This can be done
4925: by using null mounts, or manually.</p>
1.12 agc 4926:
1.45 wiz 4927: <p>There is a shell script called <code xmlns=
4928: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4929: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
4930: set up the sandbox environment using null mounts. It
1.45 wiz 4931: will also create a script called <code xmlns=
4932: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4933: "filename">sandbox</code> in the root of the sandbox
1.12 agc 4934: environment, which will allow the null mounts to be
1.14 xtraeme 4935: activated using the <span><strong class=
4936: "command">sandbox mount</strong></span> command and
4937: deactivated using the <span><strong class=
4938: "command">sandbox umount</strong></span> command.</p>
1.12 agc 4939:
4940: <p>To set up a sandbox environment by hand, after
4941: extracting all the sets from a NetBSD installation or
1.14 xtraeme 4942: doing a <span><strong class="command">make distribution
1.45 wiz 4943: DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
4944: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4945: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 4946: items are present and properly configured:</p>
1.1 grant 4947:
4948: <div class="procedure">
4949: <ol type="1">
4950: <li>
4951: <p>Kernel</p>
4952: <pre class="screen">
1.14 xtraeme 4953: <code class="prompt">#</code> <strong class=
4954: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 4955: </pre>
4956: </li>
4957:
4958: <li>
1.45 wiz 4959: <p><code xmlns=
4960: "http://www.w3.org/TR/xhtml1/transitional" class=
4961: "filename">/dev/*</code></p>
1.1 grant 4962: <pre class="screen">
1.14 xtraeme 4963: <code class="prompt">#</code> <strong class=
4964: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 4965: </pre>
4966: </li>
4967:
4968: <li>
1.45 wiz 4969: <p><code xmlns=
4970: "http://www.w3.org/TR/xhtml1/transitional" class=
4971: "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1 grant 4972: "http://www.w3.org/TR/xhtml1/transitional" href=
4973: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4974: target="_top"><code xmlns="" class=
4975: "filename">security/smtpd</code></a> and
4976: mail):</p>
1.1 grant 4977: <pre class="screen">
1.14 xtraeme 4978: <code class="prompt">#</code> <strong class=
4979: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 4980: </pre>
4981: </li>
4982:
4983: <li>
4984: <p>Working(!) mail config (hostname,
4985: sendmail.cf):</p>
4986: <pre class="screen">
1.14 xtraeme 4987: <code class="prompt">#</code> <strong class=
4988: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 4989: </pre>
4990: </li>
4991:
4992: <li>
1.45 wiz 4993: <p><code xmlns=
4994: "http://www.w3.org/TR/xhtml1/transitional" class=
4995: "filename">/etc/localtime</code> (for <a xmlns=
1.1 grant 4996: "http://www.w3.org/TR/xhtml1/transitional" href=
4997: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4998: target="_top"><code xmlns="" class=
4999: "filename">security/smtpd</code></a>):</p>
1.1 grant 5000: <pre class="screen">
1.14 xtraeme 5001: <code class="prompt">#</code> <strong class=
5002: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 5003: </pre>
5004: </li>
5005:
5006: <li>
1.45 wiz 5007: <p><code xmlns=
5008: "http://www.w3.org/TR/xhtml1/transitional" class=
1.71 wiz 5009: "filename">/usr/src</code> (system sources,
5010: e. g. for <a xmlns=
1.1 grant 5011: "http://www.w3.org/TR/xhtml1/transitional" href=
5012: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45 wiz 5013: target="_top"><code xmlns="" class=
1.71 wiz 5014: "filename">sysutils/aperture</code></a>):</p>
1.1 grant 5015: <pre class="screen">
1.14 xtraeme 5016: <code class="prompt">#</code> <strong class=
5017: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
5018: <code class="prompt">#</code> <strong class=
1.23 wiz 5019: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 5020: </pre>
5021: </li>
5022:
5023: <li>
1.45 wiz 5024: <p>Create <code xmlns=
5025: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5026: "filename">/var/db/pkg</code> (not part of
5027: default install):</p>
1.1 grant 5028: <pre class="screen">
1.14 xtraeme 5029: <code class="prompt">#</code> <strong class=
5030: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 5031: </pre>
5032: </li>
5033:
5034: <li>
1.45 wiz 5035: <p>Create <code xmlns=
5036: "http://www.w3.org/TR/xhtml1/transitional" class=
5037: "filename">/usr/pkg</code> (not part of default
5038: install):</p>
1.1 grant 5039: <pre class="screen">
1.14 xtraeme 5040: <code class="prompt">#</code> <strong class=
5041: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 5042: </pre>
5043: </li>
5044:
5045: <li>
1.45 wiz 5046: <p>Checkout pkgsrc via cvs into <code xmlns=
5047: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5048: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 5049: <pre class="screen">
1.14 xtraeme 5050: <code class="prompt">#</code> <strong class=
5051: "userinput"><code>cd /usr/sandbox/usr</code></strong>
5052: <code class="prompt">#</code> <strong class=
5053: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 5054: </pre>
5055:
5056: <p>Do not mount/link this to the copy of your
5057: pkgsrc tree you do development in, as this will
5058: likely cause problems!</p>
5059: </li>
5060:
5061: <li>
1.45 wiz 5062: <p>Make <code xmlns=
5063: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5064: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45 wiz 5065: and <code xmlns=
5066: "http://www.w3.org/TR/xhtml1/transitional" class=
5067: "filename">.../distfiles</code> point somewhere
5068: appropriate. NFS- and/or nullfs-mounts may come
5069: in handy!</p>
1.1 grant 5070: </li>
5071:
5072: <li>
1.45 wiz 5073: <p>Edit <code xmlns=
5074: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5075: "filename">/etc/mk.conf</code>, see <a href=
5076: "#binary.mk.conf" title=
1.63 dillo 5077: "6.3.1.2. /etc/mk.conf">Section 6.3.1.2,
1.1 grant 5078: “/etc/mk.conf”</a>.</p>
5079: </li>
5080:
5081: <li>
1.45 wiz 5082: <p>Adjust <code xmlns=
5083: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5084: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 5085: needs.</p>
5086: </li>
5087: </ol>
5088: </div>
5089:
1.47 reed 5090: <p>When the chroot sandbox is set up, you can start the
1.1 grant 5091: build with the following steps:</p>
5092: <pre class="screen">
1.14 xtraeme 5093: <code class="prompt">#</code> <strong class=
5094: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
5095: <code class="prompt">#</code> <strong class=
5096: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 5097: </pre>
5098:
5099: <p>This will just jump inside the sandbox and start
5100: building. At the end of the build, mail will be sent
5101: with the results of the build. Created binary pkgs will
1.45 wiz 5102: be in <code xmlns=
5103: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5104: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 5105: (wherever that points/mounts to/from).</p>
5106: </div>
5107:
1.67 hubertf 5108: <div class="sect2" lang="en">
1.1 grant 5109: <div class="titlepage">
5110: <div>
5111: <div>
1.30 wiz 5112: <h3 class="title"><a name=
1.38 dillo 5113: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 5114: a partial set of packages</h3>
1.1 grant 5115: </div>
5116: </div>
5117: </div>
5118:
5119: <p>In addition to building a complete set of all
1.45 wiz 5120: packages in pkgsrc, the <code xmlns=
5121: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5122: "filename">pkgsrc/mk/bulk/build</code> script may be
5123: used to build a subset of the packages contained in
1.47 reed 5124: pkgsrc. By setting <code class=
1.45 wiz 5125: "varname">SPECIFIC_PKGS</code> in <code xmlns=
5126: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5127: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 5128:
5129: <div class="itemizedlist">
5130: <ul type="disc">
5131: <li>
5132: <p>SITE_SPECIFIC_PKGS</p>
5133: </li>
5134:
5135: <li>
5136: <p>HOST_SPECIFIC_PKGS</p>
5137: </li>
5138:
5139: <li>
5140: <p>GROUP_SPECIFIC_PKGS</p>
5141: </li>
5142:
5143: <li>
5144: <p>USER_SPECIFIC_PKGS</p>
5145: </li>
5146: </ul>
5147: </div>
5148:
5149: <p>will define the set of packages which should be
5150: built. The bulk build code will also include any
5151: packages which are needed as dependencies for the
5152: explicitly listed packages.</p>
5153:
5154: <p>One use of this is to do a bulk build with
1.14 xtraeme 5155: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 5156: sandbox periodically to have a complete set of the
5157: binary packages needed for your site available without
5158: the overhead of building extra packages that are not
5159: needed.</p>
5160: </div>
1.13 hubertf 5161:
1.67 hubertf 5162: <div class="sect2" lang="en">
1.13 hubertf 5163: <div class="titlepage">
5164: <div>
5165: <div>
1.67 hubertf 5166: <h3 class="title"><a name=
1.38 dillo 5167: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 5168: of a bulk build</h3>
5169: </div>
5170: </div>
5171: </div>
5172:
5173: <p>This section describes how pkgsrc developers can
5174: upload binary pkgs built by bulk builds to
5175: ftp.NetBSD.org.</p>
5176:
1.17 sketch 5177: <p>If you would like to automatically create checksum
5178: files for the binary packages you intend to upload,
5179: remember to set <code class="varname">MKSUMS=yes</code>
1.45 wiz 5180: in your <code xmlns=
5181: "http://www.w3.org/TR/xhtml1/transitional" class=
1.17 sketch 5182: "filename">mk/bulk/build.conf</code>.</p>
5183:
5184: <p>If you would like to PGP sign the checksum files
5185: (highly recommended!), remember to set <code class=
5186: "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45 wiz 5187: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5188: class="filename">mk/bulk/build.conf</code>. This will
5189: prompt you for your GPG password to sign the files
1.17 sketch 5190: before uploading everything.</p>
5191:
5192: <p>Then, make sure that you have <code class=
1.14 xtraeme 5193: "varname">RSYNC_DST</code> set properly in your
1.45 wiz 5194: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5195: class="filename">mk/bulk/build.conf</code> file, i.e.
5196: adjust it to something like one of the following:</p>
1.13 hubertf 5197: <pre class="screen">
1.68 rillig 5198: RSYNC_DST=ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
1.13 hubertf 5199: </pre>
5200:
1.47 reed 5201: <p>Please use appropriate values for "pkgsrc-200xQy",
1.13 hubertf 5202: "NetBSD-a.b.c" and "arch" here. If your login on
1.68 rillig 5203: ftp.NetBSD.org is different from your local login,
5204: write your login directly into the variable, e.g. my
5205: local account is "feyrer", but for my login "hubertf",
5206: I use:</p>
1.13 hubertf 5207: <pre class="screen">
5208: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
5209: </pre>
5210:
1.45 wiz 5211: <p>A separate <code xmlns=
5212: "http://www.w3.org/TR/xhtml1/transitional" class=
5213: "filename">upload</code> directory is used here to
5214: allow "closing" the directory during upload. To do so,
5215: run the following command on ftp.NetBSD.org next:</p>
1.13 hubertf 5216: <pre class="screen">
1.14 xtraeme 5217: nbftp% <strong class=
5218: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 5219: </pre>
5220:
1.45 wiz 5221: <p>Please note that <code xmlns=
5222: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5223: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 5224: appropriate for packages for the NetBSD operating
5225: system. Binary packages for other operating systems
1.45 wiz 5226: should go into <code xmlns=
5227: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5228: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 5229:
5230: <p>Before uploading the binary pkgs, ssh authentication
1.47 reed 5231: needs to be set up. This example shows how to set up
1.13 hubertf 5232: temporary keys for the root account <span class=
5233: "emphasis"><em>inside the sandbox</em></span> (assuming
5234: that no keys should be present there usually):</p>
5235: <pre class="screen">
1.14 xtraeme 5236: <code class="prompt">#</code> <strong class=
1.68 rillig 5237: "userinput"><code>chroot /usr/sandbox</code></strong>
1.14 xtraeme 5238: chroot-<code class="prompt">#</code> <strong class=
1.68 rillig 5239: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
1.14 xtraeme 5240: chroot-<code class="prompt">#</code> <strong class=
1.68 rillig 5241: "userinput"><code>ssh-keygen -t dsa</code></strong>
1.14 xtraeme 5242: chroot-<code class="prompt">#</code> <strong class=
5243: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 5244: </pre>
5245:
1.45 wiz 5246: <p>Now take the output of <code xmlns=
5247: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5248: "filename">id-dsa.pub</code> and append it to your
1.45 wiz 5249: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5250: class="filename">~/.ssh/authorized_keys</code> file on
5251: ftp.NetBSD.org. You can remove the key after the upload
5252: is done!</p>
1.13 hubertf 5253:
5254: <p>Next, test if your ssh connection really works:</p>
5255: <pre class="screen">
1.14 xtraeme 5256: chroot-<code class="prompt">#</code> <strong class=
5257: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 5258: </pre>
5259:
5260: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
5261:
5262: <p>Now after all this works, you can exit the sandbox
5263: and start the upload:</p>
5264: <pre class="screen">
1.14 xtraeme 5265: chroot-<code class="prompt">#</code> <strong class=
1.68 rillig 5266: "userinput"><code>exit</code></strong>
1.14 xtraeme 5267: <code class="prompt">#</code> <strong class=
1.68 rillig 5268: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
1.14 xtraeme 5269: <code class="prompt">#</code> <strong class=
5270: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 5271: </pre>
5272:
5273: <p>The upload process may take quite some time. Use
1.24 wiz 5274: <a href=
5275: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
5276: <span class="citerefentry"><span class=
5277: "refentrytitle">ls</span>(1)</span></a> or <a href=
5278: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
5279: <span class="citerefentry"><span class=
5280: "refentrytitle">du</span>(1)</span></a> on the FTP
5281: server to monitor progress of the upload. The upload
5282: script will take care of not uploading restricted
5283: packages and putting vulnerable packages into the
1.45 wiz 5284: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5285: class="filename">vulnerable</code> subdirectory.</p>
1.13 hubertf 5286:
5287: <p>After the upload has ended, first thing is to revoke
5288: ssh access:</p>
5289: <pre class="screen">
1.14 xtraeme 5290: nbftp% <strong class=
5291: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 5292: Gdd:x!
5293: </pre>
5294:
5295: <p>Use whatever is needed to remove the key you've
5296: entered before! Last, move the uploaded packages out of
1.45 wiz 5297: the <code xmlns=
5298: "http://www.w3.org/TR/xhtml1/transitional" class=
5299: "filename">upload</code> directory to have them
5300: accessible to everyone:</p>
1.13 hubertf 5301: <pre class="screen">
1.14 xtraeme 5302: nbftp% <strong class=
5303: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
5304: nbftp% <strong class=
5305: "userinput"><code>mv upload/* .</code></strong>
5306: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
5307: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 5308: </pre>
5309: </div>
1.1 grant 5310: </div>
5311:
1.67 hubertf 5312: <div class="sect1" lang="en">
1.1 grant 5313: <div class="titlepage">
5314: <div>
5315: <div>
5316: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5317: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 5318: CD-ROM packages collection</h2>
1.1 grant 5319: </div>
5320: </div>
5321: </div>
5322:
5323: <p>After your pkgsrc bulk-build has completed, you may
5324: wish to create a CD-ROM set of the resulting binary
5325: packages to assist in installing packages on other
5326: machines. The <a xmlns=
5327: "http://www.w3.org/TR/xhtml1/transitional" href=
5328: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45 wiz 5329: target="_top"><code xmlns="" class=
5330: "filename">pkgtools/cdpack</code></a> package provides a
1.20 ben 5331: simple tool for creating the ISO 9660 images.
5332: <span><strong class="command">cdpack</strong></span>
5333: arranges the packages on the CD-ROMs in a way that keeps
1.47 reed 5334: all the dependencies for a given package on the same CD
5335: as that package.</p>
1.1 grant 5336:
1.67 hubertf 5337: <div class="sect2" lang="en">
1.1 grant 5338: <div class="titlepage">
5339: <div>
5340: <div>
1.67 hubertf 5341: <h3 class="title"><a name=
1.38 dillo 5342: "cdpack-example"></a>6.4.1. Example of
1.1 grant 5343: cdpack</h3>
5344: </div>
5345: </div>
5346: </div>
5347:
5348: <p>Complete documentation for cdpack is found in the
1.47 reed 5349: cdpack(1) man page. The following short example assumes
1.45 wiz 5350: that the binary packages are left in <code xmlns=
5351: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5352: "filename">/usr/pkgsrc/packages/All</code> and that
1.45 wiz 5353: sufficient disk space exists in <code xmlns=
5354: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5355: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 5356: <pre class="screen">
1.14 xtraeme 5357: <code class="prompt">#</code> <strong class=
5358: "userinput"><code>mkdir /u2/images</code></strong>
5359: <code class="prompt">#</code> <strong class=
5360: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
5361: <code class="prompt">#</code> <strong class=
5362: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 5363: </pre>
5364:
5365: <p>If you wish to include a common set of files
1.45 wiz 5366: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5367: class="filename">COPYRIGHT</code>, <code xmlns=
5368: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5369: "filename">README</code>, etc.) on each CD in the
1.1 grant 5370: collection, then you need to create a directory which
5371: contains these files. e.g.</p>
5372: <pre class="screen">
1.14 xtraeme 5373: <code class="prompt">#</code> <strong class=
5374: "userinput"><code>mkdir /tmp/common</code></strong>
5375: <code class="prompt">#</code> <strong class=
5376: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
5377: <code class="prompt">#</code> <strong class=
5378: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
5379: <code class="prompt">#</code> <strong class=
5380: "userinput"><code>mkdir /tmp/common/bin</code></strong>
5381: <code class="prompt">#</code> <strong class=
5382: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
5383: <code class="prompt">#</code> <strong class=
5384: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
5385: <code class="prompt">#</code> <strong class=
5386: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 5387: </pre>
5388:
5389: <p>Now create the images:</p>
5390: <pre class="screen">
1.14 xtraeme 5391: <code class="prompt">#</code> <strong class=
5392: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 5393: </pre>
5394:
1.45 wiz 5395: <p>Each image will contain <code xmlns=
5396: "http://www.w3.org/TR/xhtml1/transitional" class=
5397: "filename">README</code>, <code xmlns=
5398: "http://www.w3.org/TR/xhtml1/transitional" class=
5399: "filename">COPYING</code>, and <code xmlns=
5400: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5401: "filename">bin/myscript</code> in their root
1.1 grant 5402: directories.</p>
5403: </div>
5404: </div>
5405: </div>
5406:
1.67 hubertf 5407: <div class="chapter" lang="en">
1.1 grant 5408: <div class="titlepage">
5409: <div>
5410: <div>
1.67 hubertf 5411: <h2 class="title"><a name=
1.38 dillo 5412: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 5413: Questions</h2>
5414: </div>
5415: </div>
5416: </div>
5417:
5418: <div class="toc">
5419: <p><b>Table of Contents</b></p>
5420:
5421: <dl>
1.30 wiz 5422: <dt><span class="sect1"><a href=
1.38 dillo 5423: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 5424: lists for pkg-related discussion?</a></span></dt>
1.1 grant 5425:
1.38 dillo 5426: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 5427: Where's the pkgviews documentation?</a></span></dt>
5428:
1.38 dillo 5429: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 5430: Utilities for package management
5431: (pkgtools)</a></span></dt>
5432:
1.38 dillo 5433: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 5434: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 5435:
1.30 wiz 5436: <dt><span class="sect1"><a href=
1.38 dillo 5437: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 5438: fetching distfiles?</a></span></dt>
1.14 xtraeme 5439:
1.30 wiz 5440: <dt><span class="sect1"><a href=
1.38 dillo 5441: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 5442: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 5443:
1.30 wiz 5444: <dt><span class="sect1"><a href=
1.38 dillo 5445: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 5446: from pkgsrc?</a></span></dt>
1.1 grant 5447:
1.30 wiz 5448: <dt><span class="sect1"><a href=
1.38 dillo 5449: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 5450: behind a firewall</a></span></dt>
1.1 grant 5451:
1.38 dillo 5452: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 5453: do I tell <span><strong class="command">make
5454: fetch</strong></span> to do passive
5455: FTP?</a></span></dt>
1.1 grant 5456:
1.30 wiz 5457: <dt><span class="sect1"><a href=
1.38 dillo 5458: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 5459: distfiles at once</a></span></dt>
1.1 grant 5460:
1.30 wiz 5461: <dt><span class="sect1"><a href=
1.38 dillo 5462: "#tmac.andoc-missing">7.11. What does
1.30 wiz 5463: “<span class="quote">Don't know how to make
1.14 xtraeme 5464: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 5465: mean?</a></span></dt>
5466:
1.30 wiz 5467: <dt><span class="sect1"><a href=
1.38 dillo 5468: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 5469: “<span class="quote">Could not find
1.14 xtraeme 5470: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 5471:
1.30 wiz 5472: <dt><span class="sect1"><a href=
1.38 dillo 5473: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 5474: pkgsrc</a></span></dt>
1.1 grant 5475:
1.38 dillo 5476: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 5477: do I change the location of configuration
5478: files?</a></span></dt>
1.1 grant 5479:
1.38 dillo 5480: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 5481: Automated security checks</a></span></dt>
1.74 ! rillig 5482:
! 5483: <dt><span class="sect1"><a href="#ufaq-cflags">7.16.
! 5484: Why do some packages ignore my <code class=
! 5485: "varname">CFLAGS</code>?</a></span></dt>
1.1 grant 5486: </dl>
5487: </div>
5488:
5489: <p>This section contains hints, tips & tricks on
5490: special things in pkgsrc that we didn't find a better place
5491: for in the previous chapters, and it contains items for
5492: both pkgsrc users and developers.</p>
5493:
1.67 hubertf 5494: <div class="sect1" lang="en">
1.1 grant 5495: <div class="titlepage">
5496: <div>
5497: <div>
5498: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5499: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 5500: mailing lists for pkg-related discussion?</h2>
1.1 grant 5501: </div>
5502: </div>
5503: </div>
5504:
1.18 xtraeme 5505: <p>The following mailing lists may be of interest to
5506: pkgsrc users:</p>
5507:
5508: <div class="itemizedlist">
5509: <ul type="disc">
5510: <li>
5511: <p><a href=
5512: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.71 wiz 5513: target="_top">pkgsrc-bugs</a>: All bug reports in
5514: category "pkg" sent with <a href=
5515: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
5516: <span class="citerefentry"><span class=
5517: "refentrytitle">send-pr</span>(1)</span></a> appear
5518: here. Please do not report your bugs here directly;
5519: use one of the other mailing lists. discussed.</p>
1.18 xtraeme 5520: </li>
5521:
5522: <li>
5523: <p><a href=
5524: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 5525: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 5526: results of pkgsrc bulk builds are sent and
1.34 wiz 5527: discussed.</p>
1.18 xtraeme 5528: </li>
5529:
5530: <li>
5531: <p><a href=
5532: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.71 wiz 5533: target="_top">pkgsrc-changes</a>: This list is for
5534: those who are interested in getting a commit
5535: message for every change committed to pkgsrc. It is
5536: also available in digest form, meaning one daily
5537: message containing all commit messages for changes
5538: to the package source tree in that 24 hour
5539: period.</p>
1.18 xtraeme 5540: </li>
5541:
5542: <li>
5543: <p><a href=
5544: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.71 wiz 5545: target="_top">pkgsrc-users</a>: This is a general
5546: purpose list for most issues regarding pkgsrc,
5547: regardless of platform, e.g. soliciting user help
5548: for pkgsrc configuration, unexpected build
5549: failures, using particular packages, upgrading
5550: pkgsrc installations, questions regarding the
5551: pkgsrc release branches, etc. General announcements
5552: or proposals for changes that impact the pkgsrc
5553: user community, e.g. major infrastructure changes,
5554: new features, package removals, etc., may also be
5555: posted.</p>
5556: </li>
5557:
5558: <li>
5559: <p><a href=
5560: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
5561: target="_top">tech-pkg</a>: This is a list for
5562: technical discussions related to pkgsrc
5563: development, e.g. soliciting feedback for changes
5564: to pkgsrc infrastructure, proposed new features,
5565: questions related to porting pkgsrc to a new
5566: platform, advice for maintaining a package, patches
5567: that affect many packages, help requests moved from
5568: pkgsrc-users when an infrastructure bug is found,
5569: etc.</p>
1.18 xtraeme 5570: </li>
5571: </ul>
5572: </div>
5573:
5574: <p>To subscribe, do:</p>
1.1 grant 5575: <pre class="programlisting">
1.51 rillig 5576: <code class="prompt">%</code> echo subscribe <em class=
1.18 xtraeme 5577: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 5578: </pre>
5579:
1.18 xtraeme 5580: <p>Archives for all these mailing lists are available
5581: from <a href="http://mail-index.NetBSD.org/" target=
5582: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 5583: </div>
5584:
1.67 hubertf 5585: <div class="sect1" lang="en">
1.1 grant 5586: <div class="titlepage">
5587: <div>
5588: <div>
5589: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5590: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 5591: documentation?</h2>
1.1 grant 5592: </div>
5593: </div>
5594: </div>
5595:
5596: <p>Pkgviews is tightly integrated with buildlink. You can
1.45 wiz 5597: find a pkgviews User's guide in <code xmlns=
5598: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5599: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 5600: </div>
5601:
1.67 hubertf 5602: <div class="sect1" lang="en">
1.1 grant 5603: <div class="titlepage">
5604: <div>
5605: <div>
5606: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5607: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 5608: management (pkgtools)</h2>
1.1 grant 5609: </div>
5610: </div>
5611: </div>
5612:
1.45 wiz 5613: <p>The <code xmlns=
5614: "http://www.w3.org/TR/xhtml1/transitional" class=
5615: "filename">pkgsrc/pkgtools</code> directory pkgtools
5616: contains a number of useful utilities for both users and
5617: developers of pkgsrc. This section attempts only to make
5618: the reader aware of the utilities and when they might be
5619: useful, and not to duplicate the documentation that comes
5620: with each package.</p>
1.1 grant 5621:
5622: <p>Utilities used by pkgsrc (automatically installed when
5623: needed):</p>
5624:
5625: <div class="itemizedlist">
5626: <ul type="disc">
5627: <li>
5628: <p><a xmlns=
5629: "http://www.w3.org/TR/xhtml1/transitional" href=
5630: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45 wiz 5631: target="_top"><code xmlns="" class=
5632: "filename">pkgtools/x11-links</code></a>: Symlinks
1.34 wiz 5633: for use by buildlink.</p>
1.1 grant 5634: </li>
5635: </ul>
5636: </div>
5637:
5638: <p>OS tool augmentation (automatically installed when
5639: needed):</p>
5640:
5641: <div class="itemizedlist">
5642: <ul type="disc">
5643: <li>
5644: <p><a xmlns=
5645: "http://www.w3.org/TR/xhtml1/transitional" href=
5646: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 wiz 5647: target="_top"><code xmlns="" class=
5648: "filename">pkgtools/digest</code></a>: Calculates
1.34 wiz 5649: various kinds of checksums (including SHA1).</p>
1.1 grant 5650: </li>
5651:
5652: <li>
5653: <p><a xmlns=
5654: "http://www.w3.org/TR/xhtml1/transitional" href=
5655: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45 wiz 5656: target="_top"><code xmlns="" class=
5657: "filename">pkgtools/libnbcompat</code></a>:
1.34 wiz 5658: Compatibility library for pkgsrc tools.</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/mtree/README.html"
1.45 wiz 5665: target="_top"><code xmlns="" class=
5666: "filename">pkgtools/mtree</code></a>: Installed on
1.34 wiz 5667: non-BSD systems due to lack of native mtree.</p>
1.1 grant 5668: </li>
5669:
5670: <li>
5671: <p><a xmlns=
5672: "http://www.w3.org/TR/xhtml1/transitional" href=
5673: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5674: target="_top"><code xmlns="" class=
5675: "filename">pkgtools/pkg_install</code></a>:
5676: Up-to-date replacement for <code xmlns=
5677: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5678: "filename">/usr/sbin/pkg_install</code>, or for use
5679: on operating systems where pkg_install is not
5680: present.</p>
1.1 grant 5681: </li>
5682: </ul>
5683: </div>
5684:
5685: <p>Utilities used by pkgsrc (not automatically
5686: installed):</p>
5687:
5688: <div class="itemizedlist">
5689: <ul type="disc">
5690: <li>
5691: <p><a xmlns=
5692: "http://www.w3.org/TR/xhtml1/transitional" href=
5693: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45 wiz 5694: target="_top"><code xmlns="" class=
5695: "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20 ben 5696: binary package from an already-installed package.
1.34 wiz 5697: Used by <span><strong class="command">make
5698: replace</strong></span> to save the old
5699: package.</p>
1.1 grant 5700: </li>
5701:
5702: <li>
5703: <p><a xmlns=
5704: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 5705: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45 wiz 5706: target="_top"><code xmlns="" class=
5707: "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20 ben 5708: functionality to pkgsrc, allowing it to fetch
5709: distfiles from multiple locations. It currently
5710: supports the following methods: multiple CD-ROMs
5711: and network FTP/HTTP connections.</p>
1.5 hubertf 5712: </li>
5713:
5714: <li>
5715: <p><a xmlns=
5716: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5717: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 5718: target="_top"><code xmlns="" class=
5719: "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34 wiz 5720: packages someplace else (enabled by default).</p>
1.1 grant 5721: </li>
1.5 hubertf 5722:
5723: <li>
5724: <p><a xmlns=
5725: "http://www.w3.org/TR/xhtml1/transitional" href=
5726: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 5727: target="_top"><code xmlns="" class=
5728: "filename">devel/cpuflags</code></a>: Determine the
1.34 wiz 5729: best compiler flags to optimise code for your
1.20 ben 5730: current CPU and compiler.</p>
1.5 hubertf 5731: </li>
1.1 grant 5732: </ul>
5733: </div>
5734:
5735: <p>Utilities for keeping track of installed packages,
5736: being up to date, etc:</p>
5737:
5738: <div class="itemizedlist">
5739: <ul type="disc">
5740: <li>
5741: <p><a xmlns=
5742: "http://www.w3.org/TR/xhtml1/transitional" href=
5743: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45 wiz 5744: target="_top"><code xmlns="" class=
5745: "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27 rillig 5746: packages whose installed versions do not match the
1.34 wiz 5747: latest pkgsrc entries.</p>
1.1 grant 5748: </li>
5749:
5750: <li>
5751: <p><a xmlns=
5752: "http://www.w3.org/TR/xhtml1/transitional" href=
5753: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5754: target="_top"><code xmlns="" class=
5755: "filename">pkgtools/pkgdep</code></a>: Makes
1.20 ben 5756: dependency graphs of packages, to aid in choosing a
1.34 wiz 5757: strategy for updating.</p>
1.1 grant 5758: </li>
5759:
5760: <li>
5761: <p><a xmlns=
5762: "http://www.w3.org/TR/xhtml1/transitional" href=
5763: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45 wiz 5764: target="_top"><code xmlns="" class=
5765: "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27 rillig 5766: graphs from the output of <a xmlns=
5767: "http://www.w3.org/TR/xhtml1/transitional" href=
5768: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5769: target="_top"><code xmlns="" class=
5770: "filename">pkgtools/pkgdep</code></a> (uses
1.34 wiz 5771: graphviz).</p>
1.1 grant 5772: </li>
5773:
5774: <li>
5775: <p><a xmlns=
5776: "http://www.w3.org/TR/xhtml1/transitional" href=
5777: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 5778: target="_top"><code xmlns="" class=
5779: "filename">pkgtools/pkglint</code></a>: The
1.27 rillig 5780: pkglint(1) program checks a pkgsrc entry for
5781: errors, lintpkgsrc(1) does various checks on the
5782: complete pkgsrc system.</p>
1.1 grant 5783: </li>
5784:
5785: <li>
5786: <p><a xmlns=
5787: "http://www.w3.org/TR/xhtml1/transitional" href=
5788: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45 wiz 5789: target="_top"><code xmlns="" class=
5790: "filename">pkgtools/pkgsurvey</code></a>: Report
5791: what packages you have installed.</p>
1.1 grant 5792: </li>
5793: </ul>
5794: </div>
5795:
5796: <p>Utilities for people maintaining or creating
5797: individual packages:</p>
5798:
5799: <div class="itemizedlist">
5800: <ul type="disc">
5801: <li>
5802: <p><a xmlns=
5803: "http://www.w3.org/TR/xhtml1/transitional" href=
5804: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 5805: target="_top"><code xmlns="" class=
5806: "filename">pkgtools/pkgdiff</code></a>: Automate
1.20 ben 5807: making and maintaining patches for a package
1.34 wiz 5808: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 5809: </li>
5810:
5811: <li>
5812: <p><a xmlns=
5813: "http://www.w3.org/TR/xhtml1/transitional" href=
5814: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45 wiz 5815: target="_top"><code xmlns="" class=
5816: "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20 ben 5817: "http://www.w3.org/TR/xhtml1/transitional" href=
5818: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 5819: target="_top"><code xmlns="" class=
5820: "filename">pkgtools/url2pkg</code></a>: Aids in
1.34 wiz 5821: converting to pkgsrc.</p>
1.1 grant 5822: </li>
5823:
5824: <li>
5825: <p><a xmlns=
5826: "http://www.w3.org/TR/xhtml1/transitional" href=
5827: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45 wiz 5828: target="_top"><code xmlns="" class=
5829: "filename">pkgtools/gensolpkg</code></a>: Convert
1.34 wiz 5830: pkgsrc to a Solaris package.</p>
1.1 grant 5831: </li>
5832: </ul>
5833: </div>
5834:
1.47 reed 5835: <p>Utilities for people maintaining pkgsrc (or: more
1.1 grant 5836: obscure pkg utilities)</p>
5837:
5838: <div class="itemizedlist">
5839: <ul type="disc">
5840: <li>
5841: <p><a xmlns=
5842: "http://www.w3.org/TR/xhtml1/transitional" href=
5843: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45 wiz 5844: target="_top"><code xmlns="" class=
5845: "filename">pkgtools/pkg_comp</code></a>: Build
1.34 wiz 5846: packages in a chrooted area.</p>
1.1 grant 5847: </li>
5848:
5849: <li>
5850: <p><a xmlns=
5851: "http://www.w3.org/TR/xhtml1/transitional" href=
5852: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45 wiz 5853: target="_top"><code xmlns="" class=
5854: "filename">pkgtools/libkver</code></a>: Spoof
5855: kernel version for chrooted cross builds.</p>
1.1 grant 5856: </li>
5857: </ul>
5858: </div>
5859: </div>
5860:
1.67 hubertf 5861: <div class="sect1" lang="en">
1.1 grant 5862: <div class="titlepage">
5863: <div>
5864: <div>
5865: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5866: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 5867: as non-root</h2>
1.1 grant 5868: </div>
5869: </div>
5870: </div>
5871:
5872: <p>If you want to use pkgsrc as non-root user, you can
5873: set some variables to make pkgsrc work under these
1.33 jmmv 5874: conditions. At the very least, you need to set
5875: <code class="varname">UNPRIVILEGED</code> to
5876: “<span class="quote">yes</span>”; this will
5877: turn on unprivileged mode and set multiple related
5878: variables to allow installation of packages as
5879: non-root.</p>
5880:
5881: <p>In case the defaults are not enough, you may want to
5882: tune some other variables used. For example, if the
5883: automatic user/group detection leads to incorrect values
5884: (or not the ones you would like to use), you can change
5885: them by setting <code class=
5886: "varname">UNPRIVILEGED_USER</code> and <code class=
5887: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
5888:
5889: <p>As regards bootstrapping, please note that the
5890: <span><strong class="command">bootstrap</strong></span>
5891: script will ease non-root configuration when given the
5892: “<span class=
5893: "quote">--ignore-user-check</span>” flag, as it
5894: will choose and use multiple default directories under
1.45 wiz 5895: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5896: class="filename">~/pkg</code> as the installation
1.33 jmmv 5897: targets. These directories can be overriden by the
5898: “<span class="quote">--prefix</span>” flag
5899: provided by the script, as well as some others that allow
5900: finer tuning of the tree layout.</p>
1.14 xtraeme 5901: </div>
5902:
1.67 hubertf 5903: <div class="sect1" lang="en">
1.14 xtraeme 5904: <div class="titlepage">
5905: <div>
5906: <div>
5907: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5908: "resume-transfers"></a>7.5. How to resume
1.30 wiz 5909: transfers when fetching distfiles?</h2>
1.14 xtraeme 5910: </div>
5911: </div>
5912: </div>
5913:
1.47 reed 5914: <p>By default, resuming transfers in pkgsrc is disabled,
1.15 xtraeme 5915: but you can enable this feature by adding the option
5916: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45 wiz 5917: into <code xmlns=
5918: "http://www.w3.org/TR/xhtml1/transitional" class=
5919: "filename">/etc/mk.conf</code>. If, during a fetch step,
5920: an incomplete distfile is found, pkgsrc will try to
5921: resume it.</p>
1.15 xtraeme 5922:
5923: <p>You can also use a different program than the default
1.24 wiz 5924: <a href=
5925: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5926: <span class="citerefentry"><span class=
5927: "refentrytitle">ftp</span>(1)</span></a> by changing the
5928: <code class="varname">FETCH_CMD</code> variable. Don't
5929: forget to set <code class=
5930: "varname">FETCH_RESUME_ARGS</code> and <code class=
5931: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
5932: default values.</p>
1.14 xtraeme 5933:
1.45 wiz 5934: <p>For example, if you want to use <code xmlns=
5935: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5936: "filename">wget</code> to resume downloads, you'll have
5937: to use something like:</p>
5938: <pre class="programlisting">
1.51 rillig 5939: FETCH_CMD= wget
5940: FETCH_BEFORE_ARGS= --passive-ftp
5941: FETCH_RESUME_ARGS= -c
5942: FETCH_OUTPUT_ARGS= -O
1.14 xtraeme 5943: </pre>
1.1 grant 5944: </div>
5945:
1.67 hubertf 5946: <div class="sect1" lang="en">
1.1 grant 5947: <div class="titlepage">
5948: <div>
5949: <div>
5950: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5951: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 5952: install/use XFree86 from pkgsrc?</h2>
5953: </div>
5954: </div>
5955: </div>
5956:
5957: <p>If you want to use XFree86 from pkgsrc instead of your
1.45 wiz 5958: system's own X11 (<code xmlns=
5959: "http://www.w3.org/TR/xhtml1/transitional" class=
5960: "filename">/usr/X11R6</code>, <code xmlns=
5961: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5962: "filename">/usr/openwin</code>, ...), you will have to
1.45 wiz 5963: add the following line into <code xmlns=
5964: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5965: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5966: <pre class="programlisting">
1.51 rillig 5967: X11_TYPE=XFree86
1.1 grant 5968: </pre>
5969: </div>
5970:
1.67 hubertf 5971: <div class="sect1" lang="en">
1.1 grant 5972: <div class="titlepage">
5973: <div>
5974: <div>
5975: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5976: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 5977: install/use X.org from pkgsrc?</h2>
5978: </div>
5979: </div>
5980: </div>
5981:
5982: <p>If you want to use X.org from pkgsrc instead of your
1.45 wiz 5983: system's own X11 (<code xmlns=
5984: "http://www.w3.org/TR/xhtml1/transitional" class=
5985: "filename">/usr/X11R6</code>, <code xmlns=
5986: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5987: "filename">/usr/openwin</code>, ...) you will have to add
1.45 wiz 5988: the following line into <code xmlns=
5989: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5990: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5991: <pre class="programlisting">
1.51 rillig 5992: X11_TYPE=xorg
1.1 grant 5993: </pre>
1.70 rillig 5994:
5995: <div class="note" style=
5996: "margin-left: 0.5in; margin-right: 0.5in;">
5997: <h3 class="title">Note</h3>
5998:
5999: <p>The DragonFly operating system defaults to using
6000: this X.org X11 implementation from pkgsrc.</p>
6001: </div>
1.1 grant 6002: </div>
6003:
1.67 hubertf 6004: <div class="sect1" lang="en">
1.1 grant 6005: <div class="titlepage">
6006: <div>
6007: <div>
6008: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6009: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 6010: files from behind a firewall</h2>
1.1 grant 6011: </div>
6012: </div>
6013: </div>
6014:
6015: <p>If you are sitting behind a firewall which does not
6016: allow direct connections to Internet hosts (i.e.
6017: non-NAT), you may specify the relevant proxy hosts. This
6018: is done using an environment variable in the form of a
1.47 reed 6019: URL, e.g. in Amdahl, the machine “<span class=
1.1 grant 6020: "quote">orpheus.amdahl.com</span>” is one of the
6021: firewalls, and it uses port 80 as the proxy port number.
6022: So the proxy environment variables are:</p>
6023: <pre class="programlisting">
1.51 rillig 6024: ftp_proxy=ftp://orpheus.amdahl.com:80/
6025: http_proxy=http://orpheus.amdahl.com:80/
1.1 grant 6026: </pre>
6027: </div>
6028:
1.67 hubertf 6029: <div class="sect1" lang="en">
1.1 grant 6030: <div class="titlepage">
6031: <div>
6032: <div>
6033: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 6034: "passive-ftp"></a>7.9. How do I tell
6035: <span><strong class="command">make
1.14 xtraeme 6036: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 6037: </div>
6038: </div>
6039: </div>
6040:
6041: <p>This depends on which utility is used to retrieve
1.45 wiz 6042: distfiles. From <code xmlns=
6043: "http://www.w3.org/TR/xhtml1/transitional" class=
6044: "filename">bsd.pkg.mk</code>, <code class=
6045: "varname">FETCH_CMD</code> is assigned the first
6046: available command from the following list:</p>
1.34 wiz 6047:
6048: <div class="itemizedlist">
6049: <ul type="disc">
6050: <li>
1.45 wiz 6051: <p><code xmlns=
6052: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 6053: "filename">${LOCALBASE}/bin/ftp</code></p>
6054: </li>
6055:
6056: <li>
1.45 wiz 6057: <p><code xmlns=
6058: "http://www.w3.org/TR/xhtml1/transitional" class=
6059: "filename">/usr/bin/ftp</code></p>
1.34 wiz 6060: </li>
6061: </ul>
6062: </div>
1.1 grant 6063:
6064: <p>On a default NetBSD installation, this will be
1.45 wiz 6065: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6066: class="filename">/usr/bin/ftp</code>, which automatically
6067: tries passive connections first, and falls back to active
6068: connections if the server refuses to do passive. For the
6069: other tools, add the following to your <code xmlns=
6070: "http://www.w3.org/TR/xhtml1/transitional" class=
6071: "filename">/etc/mk.conf</code> file: <code class=
6072: "varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 6073:
1.45 wiz 6074: <p>Having that option present will prevent <code xmlns=
6075: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6076: "filename">/usr/bin/ftp</code> from falling back to
6077: active transfers.</p>
1.1 grant 6078: </div>
6079:
1.67 hubertf 6080: <div class="sect1" lang="en">
1.1 grant 6081: <div class="titlepage">
6082: <div>
6083: <div>
6084: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6085: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 6086: fetch all distfiles at once</h2>
6087: </div>
6088: </div>
6089: </div>
6090:
6091: <p>You would like to download all the distfiles in a
6092: single batch from work or university, where you can't run
1.14 xtraeme 6093: a <span><strong class="command">make
6094: fetch</strong></span>. There is an archive of distfiles
6095: on <a href=
1.1 grant 6096: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
6097: target="_top">ftp.NetBSD.org</a>, but downloading the
6098: entire directory may not be appropriate.</p>
6099:
1.14 xtraeme 6100: <p>The answer here is to do a <span><strong class=
1.45 wiz 6101: "command">make fetch-list</strong></span> in <code xmlns=
6102: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 6103: "filename">/usr/pkgsrc</code> or one of its
1.1 grant 6104: subdirectories, carry the resulting list to your machine
1.23 wiz 6105: at work/school and use it there. If you don't have a
1.24 wiz 6106: NetBSD-compatible <a href=
6107: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
6108: <span class="citerefentry"><span class=
1.72 rillig 6109: "refentrytitle">ftp</span>(1)</span></a> (like tnftp) at
6110: work, don't forget to set <code class=
1.24 wiz 6111: "varname">FETCH_CMD</code> to something that fetches a
6112: URL:</p>
1.1 grant 6113:
6114: <p>At home:</p>
6115: <pre class="screen">
1.14 xtraeme 6116: <code class="prompt">%</code> <strong class=
6117: "userinput"><code>cd /usr/pkgsrc</code></strong>
6118: <code class="prompt">%</code> <strong class=
6119: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
6120: <code class="prompt">%</code> <strong class=
6121: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 6122: </pre>
6123:
6124: <p>At work:</p>
6125: <pre class="screen">
1.14 xtraeme 6126: <code class="prompt">%</code> <strong class=
6127: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 6128: </pre>
6129:
1.45 wiz 6130: <p>then tar up <code xmlns=
6131: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6132: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 6133:
6134: <p>If you have a machine running NetBSD, and you want to
6135: get <span class="emphasis"><em>all</em></span> distfiles
6136: (even ones that aren't for your machine architecture),
6137: you can do so by using the above-mentioned
1.14 xtraeme 6138: <span><strong class="command">make
6139: fetch-list</strong></span> approach, or fetch the
6140: distfiles directly by running:</p>
1.1 grant 6141: <pre class="screen">
1.14 xtraeme 6142: <code class="prompt">%</code> <strong class=
6143: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 6144: </pre>
6145:
1.14 xtraeme 6146: <p>If you even decide to ignore <code class=
6147: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
6148: can get everything by running:</p>
1.1 grant 6149: <pre class="screen">
1.14 xtraeme 6150: <code class="prompt">%</code> <strong class=
6151: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 6152: </pre>
6153: </div>
6154:
1.67 hubertf 6155: <div class="sect1" lang="en">
1.1 grant 6156: <div class="titlepage">
6157: <div>
6158: <div>
6159: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6160: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 6161: “<span class="quote">Don't know how to make
6162: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
6163: </div>
6164: </div>
6165: </div>
6166:
6167: <p>When compiling the <a xmlns=
6168: "http://www.w3.org/TR/xhtml1/transitional" href=
6169: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 6170: target="_top"><code xmlns="" class=
6171: "filename">pkgtools/pkg_install</code></a> package, you
6172: get the error from make that it doesn't know how to make
6173: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6174: class="filename">/usr/share/tmac/tmac.andoc</code>? This
6175: indicates that you don't have installed the
1.23 wiz 6176: “<span class="quote">text</span>” set (nroff,
6177: ...) from the NetBSD base distribution on your machine.
1.47 reed 6178: It is recommended to do that to format man pages.</p>
1.1 grant 6179:
6180: <p>In the case of the <a xmlns=
6181: "http://www.w3.org/TR/xhtml1/transitional" href=
6182: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 6183: target="_top"><code xmlns="" class=
6184: "filename">pkgtools/pkg_install</code></a> package, you
6185: can get away with setting <code class=
1.20 ben 6186: "varname">NOMAN=YES</code> either in the environment or
1.45 wiz 6187: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6188: class="filename">/etc/mk.conf</code>.</p>
1.1 grant 6189: </div>
6190:
1.67 hubertf 6191: <div class="sect1" lang="en">
1.1 grant 6192: <div class="titlepage">
6193: <div>
6194: <div>
6195: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6196: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 6197: “<span class="quote">Could not find
6198: bsd.own.mk</span>” mean?</h2>
6199: </div>
6200: </div>
6201: </div>
6202:
1.45 wiz 6203: <p>You didn't install the compiler set, <code xmlns=
6204: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6205: "filename">comp.tgz</code>, when you installed your
1.47 reed 6206: NetBSD machine. Please get and install it, by extracting
6207: it in <code xmlns=
1.45 wiz 6208: "http://www.w3.org/TR/xhtml1/transitional" class=
6209: "filename">/</code>:</p>
1.1 grant 6210: <pre class="screen">
1.14 xtraeme 6211: <code class="prompt">#</code> <strong class=
6212: "userinput"><code>cd /</code></strong>
6213: <code class="prompt">#</code> <strong class=
6214: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 6215: </pre>
6216:
1.45 wiz 6217: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6218: class="filename">comp.tgz</code> is part of every NetBSD
6219: release. Get the one that corresponds to your release
6220: (determine via <span><strong class="command">uname
6221: -r</strong></span>).</p>
1.1 grant 6222: </div>
6223:
1.67 hubertf 6224: <div class="sect1" lang="en">
1.1 grant 6225: <div class="titlepage">
6226: <div>
6227: <div>
6228: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6229: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 6230: 'sudo' with pkgsrc</h2>
6231: </div>
6232: </div>
6233: </div>
6234:
6235: <p>When installing packages as non-root user and using
1.24 wiz 6236: the just-in-time <a href=
6237: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
6238: <span class="citerefentry"><span class=
6239: "refentrytitle">su</span>(1)</span></a> feature of
6240: pkgsrc, it can become annoying to type in the root
6241: password for each required package installed. To avoid
6242: this, the sudo package can be used, which does password
6243: caching over a limited time. To use it, install sudo
6244: (either as binary package or from <a xmlns=
6245: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 6246: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45 wiz 6247: target="_top"><code xmlns="" class=
6248: "filename">security/sudo</code></a>) and then put the
6249: following into your <code xmlns=
6250: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 6251: "filename">/etc/mk.conf</code>:</p>
1.1 grant 6252: <pre class="programlisting">
1.51 rillig 6253: .if exists(${LOCALBASE}/bin/sudo)
6254: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
6255: .endif
1.1 grant 6256: </pre>
6257: </div>
6258:
1.67 hubertf 6259: <div class="sect1" lang="en">
1.1 grant 6260: <div class="titlepage">
6261: <div>
6262: <div>
6263: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 6264: "faq.conf"></a>7.14. How do I change the
6265: location of configuration files?</h2>
1.1 grant 6266: </div>
6267: </div>
6268: </div>
6269:
1.35 jmmv 6270: <p>As the system administrator, you can choose where
6271: configuration files are installed. The default settings
1.45 wiz 6272: make all these files go into <code xmlns=
6273: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 6274: "filename">${PREFIX}/etc</code> or some of its
6275: subdirectories; this may be suboptimal depending on your
6276: expectations (e.g., a read-only, NFS-exported
6277: <code class="varname">PREFIX</code> with a need of
6278: per-machine configuration of the provided packages).</p>
6279:
6280: <p>In order to change the defaults, you can modify the
6281: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45 wiz 6282: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6283: class="filename">/etc/mk.conf</code>) to point to your
6284: preferred configuration directory; some common examples
6285: include <code xmlns=
6286: "http://www.w3.org/TR/xhtml1/transitional" class=
6287: "filename">/etc</code> or <code xmlns=
6288: "http://www.w3.org/TR/xhtml1/transitional" class=
6289: "filename">/etc/pkg</code>.</p>
1.35 jmmv 6290:
6291: <p>Furthermore, you can change this value on a
6292: per-package basis by setting the <code class=
6293: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
6294: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
6295: value usually matches the name of the package you would
6296: like to modify, that is, the contents of <code class=
6297: "varname">PKGBASE</code>.</p>
1.1 grant 6298:
1.47 reed 6299: <p>Note that after changing these settings, you must
1.35 jmmv 6300: rebuild and reinstall any affected packages.</p>
1.1 grant 6301: </div>
6302:
1.67 hubertf 6303: <div class="sect1" lang="en">
1.1 grant 6304: <div class="titlepage">
6305: <div>
6306: <div>
6307: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6308: "audit-packages"></a>7.15. Automated security
1.1 grant 6309: checks</h2>
6310: </div>
6311: </div>
6312: </div>
6313:
6314: <p>Please be aware that there can often be bugs in
6315: third-party software, and some of these bugs can leave a
6316: machine vulnerable to exploitation by attackers. In an
6317: effort to lessen the exposure, the NetBSD packages team
6318: maintains a database of known-exploits to packages which
6319: have at one time been included in pkgsrc. The database
6320: can be downloaded automatically, and a security audit of
6321: all packages installed on a system can take place. To do
6322: this, install the <a xmlns=
6323: "http://www.w3.org/TR/xhtml1/transitional" href=
6324: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 6325: target="_top"><code xmlns="" class=
6326: "filename">security/audit-packages</code></a> package. It
1.20 ben 6327: has two components:</p>
1.1 grant 6328:
6329: <div class="orderedlist">
6330: <ol type="1">
6331: <li>
1.34 wiz 6332: <p><span><strong class=
6333: "command">download-vulnerability-list</strong></span>,
1.1 grant 6334: an easy way to download a list of the security
6335: vulnerabilities information. This list is kept up
6336: to date by the NetBSD security officer and the
6337: NetBSD packages team, and is distributed from the
6338: NetBSD ftp server:</p>
6339:
6340: <p><a href=
6341: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 6342: target=
6343: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 6344: </li>
6345:
6346: <li>
1.34 wiz 6347: <p><span><strong class=
6348: "command">audit-packages</strong></span>, an easy
6349: way to audit the current machine, checking each
1.1 grant 6350: vulnerability which is known. If a vulnerable
6351: package is installed, it will be shown by output to
6352: stdout, including a description of the type of
6353: vulnerability, and a URL containing more
6354: information.</p>
6355: </li>
6356: </ol>
6357: </div>
6358:
1.23 wiz 6359: <p>Use of the <a xmlns=
6360: "http://www.w3.org/TR/xhtml1/transitional" href=
6361: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 6362: target="_top"><code xmlns="" class=
6363: "filename">security/audit-packages</code></a> package is
1.23 wiz 6364: strongly recommended! After “<span class=
6365: "quote">audit-packages</span>” is installed, please
6366: read the package's message, which you can get by running
6367: <strong class="userinput"><code>pkg_info -D
1.65 hubertf 6368: audit-packages</code></strong>.</p>
1.58 erh 6369:
6370: <p>If this package is installed, pkgsrc builds will use
6371: it to perform a security check before building any
6372: package. See <a href="#variables-affecting-build" title=
6373: "5.2. Variables affecting the build process">Section 5.2,
6374: “Variables affecting the build process”</a>
1.59 rillig 6375: for ways to control this check.</p>
1.1 grant 6376: </div>
1.74 ! rillig 6377:
! 6378: <div class="sect1" lang="en">
! 6379: <div class="titlepage">
! 6380: <div>
! 6381: <div>
! 6382: <h2 class="title" style="clear: both"><a name=
! 6383: "ufaq-cflags"></a>7.16. Why do some packages
! 6384: ignore my <code class="varname">CFLAGS</code>?</h2>
! 6385: </div>
! 6386: </div>
! 6387: </div>
! 6388:
! 6389: <p>When you add your own preferences to the <code class=
! 6390: "varname">CFLAGS</code> variable in your <code xmlns=
! 6391: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6392: "filename">mk.conf</code>, these flags are passed in
! 6393: environment variables to the <code xmlns=
! 6394: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6395: "filename">./configure</code> scripts and to <a href=
! 6396: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
! 6397: <span class="citerefentry"><span class=
! 6398: "refentrytitle">make</span>(1)</span></a>. Some package
! 6399: authors ignore the <code class="varname">CFLAGS</code>
! 6400: from the environment variable by overriding them in the
! 6401: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 6402: class="filename">Makefile</code>s of their package.</p>
! 6403:
! 6404: <p>Currently there is no solution to this problem. If you
! 6405: really need the package to use your <code class=
! 6406: "varname">CFLAGS</code> you should run
! 6407: <span><strong class="command">make patch</strong></span>
! 6408: in the package directory and then inspect any
! 6409: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 6410: class="filename">Makefile</code> and <code xmlns=
! 6411: "http://www.w3.org/TR/xhtml1/transitional" class=
! 6412: "filename">Makefile.in</code> for whether they define
! 6413: <code class="varname">CFLAGS</code> explicitly. Usually
! 6414: you can remove these lines. But be aware that some
! 6415: “<span class="quote">smart</span>”
! 6416: programmers write so bad code that it only works for the
! 6417: specific combination of <code class=
! 6418: "varname">CFLAGS</code> they have chosen.</p>
! 6419: </div>
1.1 grant 6420: </div>
6421: </div>
6422:
1.67 hubertf 6423: <div class="part" lang="en">
1.1 grant 6424: <div class="titlepage">
6425: <div>
6426: <div>
1.67 hubertf 6427: <h1 class="title"><a name=
1.48 dillo 6428: "developers-guide"></a>Part II. The pkgsrc
6429: developer's guide</h1>
1.1 grant 6430: </div>
6431: </div>
6432: </div>
6433:
6434: <div class="toc">
6435: <p><b>Table of Contents</b></p>
6436:
6437: <dl>
1.38 dillo 6438: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 6439: Package components - files, directories and
6440: contents</a></span></dt>
6441:
6442: <dd>
6443: <dl>
6444: <dt><span class="sect1"><a href=
1.45 wiz 6445: "#components.Makefile">8.1. <code xmlns=
6446: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6447: "filename">Makefile</code></a></span></dt>
6448:
6449: <dt><span class="sect1"><a href=
1.45 wiz 6450: "#components.distinfo">8.2. <code xmlns=
6451: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6452: "filename">distinfo</code></a></span></dt>
6453:
6454: <dt><span class="sect1"><a href=
1.38 dillo 6455: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 6456:
1.30 wiz 6457: <dt><span class="sect1"><a href=
1.38 dillo 6458: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6459: files</a></span></dt>
1.27 rillig 6460:
6461: <dt><span class="sect1"><a href=
1.38 dillo 6462: "#components.optional">8.5. Optional
1.27 rillig 6463: files</a></span></dt>
6464:
1.38 dillo 6465: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6466: <code xmlns=
6467: "http://www.w3.org/TR/xhtml1/transitional" class=
6468: "filename">work*</code></a></span></dt>
1.27 rillig 6469:
1.38 dillo 6470: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6471: <code xmlns=
6472: "http://www.w3.org/TR/xhtml1/transitional" class=
6473: "filename">files/*</code></a></span></dt>
1.27 rillig 6474: </dl>
6475: </dd>
6476:
1.38 dillo 6477: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 6478: Programming in <code xmlns=
6479: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 6480: "filename">Makefile</code>s</a></span></dt>
6481:
6482: <dd>
6483: <dl>
6484: <dt><span class="sect1"><a href=
1.45 wiz 6485: "#makefile.variables">9.1. <code xmlns=
6486: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 6487: "filename">Makefile</code> variables</a></span></dt>
6488:
1.27 rillig 6489: <dd>
6490: <dl>
6491: <dt><span class="sect2"><a href=
1.38 dillo 6492: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 6493: conventions</a></span></dt>
6494: </dl>
6495: </dd>
6496:
1.38 dillo 6497: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 6498: Code snippets</a></span></dt>
6499:
6500: <dd>
6501: <dl>
6502: <dt><span class="sect2"><a href=
1.38 dillo 6503: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 6504: list</a></span></dt>
6505:
6506: <dt><span class="sect2"><a href=
1.38 dillo 6507: "#converting-internal-to-external">9.2.2.
1.30 wiz 6508: Converting an internal list into an external
6509: list</a></span></dt>
1.25 rillig 6510:
6511: <dt><span class="sect2"><a href=
1.38 dillo 6512: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 6513: variables to a shell command</a></span></dt>
1.27 rillig 6514:
6515: <dt><span class="sect2"><a href=
1.38 dillo 6516: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 6517: guideline</a></span></dt>
6518:
6519: <dt><span class="sect2"><a href=
1.38 dillo 6520: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 6521: a bug in BSD Make</a></span></dt>
1.25 rillig 6522: </dl>
6523: </dd>
6524: </dl>
6525: </dd>
6526:
1.38 dillo 6527: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 6528: issues</a></span></dt>
6529:
6530: <dd>
6531: <dl>
1.38 dillo 6532: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 6533: ID</a></span></dt>
6534:
1.30 wiz 6535: <dt><span class="sect1"><a href=
1.38 dillo 6536: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 6537: <code xmlns=
6538: "http://www.w3.org/TR/xhtml1/transitional" class=
6539: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 6540:
1.38 dillo 6541: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 6542: Tweaking output of <span><strong class="command">make
6543: print-PLIST</strong></span></a></span></dt>
1.1 grant 6544:
1.38 dillo 6545: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 6546: Variable substitution in PLIST</a></span></dt>
6547:
1.30 wiz 6548: <dt><span class="sect1"><a href=
1.48 dillo 6549: "#manpage-compression">10.5. Man page
6550: compression</a></span></dt>
1.1 grant 6551:
1.30 wiz 6552: <dt><span class="sect1"><a href=
1.38 dillo 6553: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 6554: <code class=
1.14 xtraeme 6555: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 6556:
1.30 wiz 6557: <dt><span class="sect1"><a href=
1.47 reed 6558: "#platform-specific-plist">10.7. Platform-specific
1.38 dillo 6559: and differing PLISTs</a></span></dt>
1.1 grant 6560:
6561: <dt><span class="sect1"><a href=
1.38 dillo 6562: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 6563: packages</a></span></dt>
6564: </dl>
6565: </dd>
6566:
1.38 dillo 6567: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 6568: Buildlink methodology</a></span></dt>
6569:
6570: <dd>
6571: <dl>
1.30 wiz 6572: <dt><span class="sect1"><a href=
1.38 dillo 6573: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 6574: to use buildlink3</a></span></dt>
1.1 grant 6575:
1.30 wiz 6576: <dt><span class="sect1"><a href=
1.45 wiz 6577: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
6578: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6579: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 6580:
6581: <dd>
6582: <dl>
6583: <dt><span class="sect2"><a href=
1.38 dillo 6584: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 6585: buildlink3.mk file</a></span></dt>
1.1 grant 6586:
6587: <dt><span class="sect2"><a href=
1.38 dillo 6588: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 6589: <code class=
1.72 rillig 6590: "varname">BUILDLINK_API_DEPENDS.<em class=
6591: "replaceable"><code>pkg</code></em></code> in
6592: <code xmlns=
1.45 wiz 6593: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6594: "filename">buildlink3.mk</code>
1.1 grant 6595: files</a></span></dt>
6596: </dl>
6597: </dd>
6598:
1.30 wiz 6599: <dt><span class="sect1"><a href=
1.45 wiz 6600: "#writing-builtin.mk">11.3. Writing <code xmlns=
6601: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6602: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 6603:
6604: <dd>
6605: <dl>
6606: <dt><span class="sect2"><a href=
1.38 dillo 6607: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 6608: <code xmlns=
6609: "http://www.w3.org/TR/xhtml1/transitional" class=
6610: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 6611:
6612: <dt><span class="sect2"><a href=
1.38 dillo 6613: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 6614: preferences for native or pkgsrc
6615: software</a></span></dt>
1.1 grant 6616: </dl>
6617: </dd>
6618: </dl>
6619: </dd>
6620:
1.38 dillo 6621: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 6622: pkginstall framework</a></span></dt>
6623:
6624: <dd>
6625: <dl>
6626: <dt><span class="sect1"><a href=
1.38 dillo 6627: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 6628: directories outside the installation
6629: prefix</a></span></dt>
6630:
6631: <dd>
6632: <dl>
6633: <dt><span class="sect2"><a href=
1.38 dillo 6634: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 6635: manipulation</a></span></dt>
6636:
6637: <dt><span class="sect2"><a href=
1.38 dillo 6638: "#files-outside-prefix">12.1.2. File
1.35 jmmv 6639: manipulation</a></span></dt>
6640: </dl>
6641: </dd>
6642:
1.38 dillo 6643: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 6644: Configuration files</a></span></dt>
6645:
6646: <dd>
6647: <dl>
6648: <dt><span class="sect2"><a href=
1.38 dillo 6649: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 6650: "varname">PKG_SYSCONFDIR</code> is
6651: set</a></span></dt>
6652:
6653: <dt><span class="sect2"><a href=
1.38 dillo 6654: "#conf-files-configure">12.2.2. Telling the
1.47 reed 6655: software where configuration files
1.35 jmmv 6656: are</a></span></dt>
6657:
6658: <dt><span class="sect2"><a href=
1.38 dillo 6659: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 6660: installations</a></span></dt>
6661:
6662: <dt><span class="sect2"><a href=
1.38 dillo 6663: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 6664: of configuration files</a></span></dt>
6665: </dl>
6666: </dd>
6667:
1.38 dillo 6668: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 6669: System startup scripts</a></span></dt>
6670:
6671: <dd>
6672: <dl>
6673: <dt><span class="sect2"><a href=
1.38 dillo 6674: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 6675: of system startup scripts</a></span></dt>
6676: </dl>
6677: </dd>
6678:
6679: <dt><span class="sect1"><a href=
1.38 dillo 6680: "#users-and-groups">12.4. System users and
1.35 jmmv 6681: groups</a></span></dt>
6682:
1.38 dillo 6683: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 6684: System shells</a></span></dt>
6685:
6686: <dd>
6687: <dl>
6688: <dt><span class="sect2"><a href=
1.65 hubertf 6689: "#shells-disable">12.5.1. Disabling shell
6690: registration</a></span></dt>
6691: </dl>
6692: </dd>
6693:
6694: <dt><span class="sect1"><a href="#fonts">12.6.
6695: Fonts</a></span></dt>
6696:
6697: <dd>
6698: <dl>
6699: <dt><span class="sect2"><a href=
6700: "#fonts-disable">12.6.1. Disabling automatic
6701: update of the fonts databases</a></span></dt>
1.35 jmmv 6702: </dl>
6703: </dd>
6704: </dl>
6705: </dd>
6706:
1.38 dillo 6707: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 6708: handling</a></span></dt>
6709:
6710: <dd>
6711: <dl>
1.30 wiz 6712: <dt><span class="sect1"><a href=
1.38 dillo 6713: "#global-default-options">13.1. Global default
1.30 wiz 6714: options</a></span></dt>
1.1 grant 6715:
1.30 wiz 6716: <dt><span class="sect1"><a href=
1.38 dillo 6717: "#converting-to-options">13.2. Converting packages to
1.45 wiz 6718: use <code xmlns=
6719: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6720: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 6721:
6722: <dt><span class="sect1"><a href="#option-names">13.3.
6723: Option Names</a></span></dt>
1.1 grant 6724: </dl>
6725: </dd>
6726:
1.38 dillo 6727: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 6728: process</a></span></dt>
6729:
6730: <dd>
6731: <dl>
1.56 rillig 6732: <dt><span class="sect1"><a href="#build.intro">14.1.
6733: Introduction</a></span></dt>
6734:
6735: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 6736: Program location</a></span></dt>
6737:
1.56 rillig 6738: <dt><span class="sect1"><a href=
6739: "#build.builddirs">14.3. Directories used during the
6740: build process</a></span></dt>
1.1 grant 6741:
6742: <dt><span class="sect1"><a href=
1.56 rillig 6743: "#build.running">14.4. Running a
6744: phase</a></span></dt>
6745:
6746: <dt><span class="sect1"><a href="#build.fetch">14.5.
6747: The <span class="emphasis"><em>fetch</em></span>
6748: phase</a></span></dt>
6749:
6750: <dt><span class="sect1"><a href=
6751: "#build.checksum">14.6. The <span class=
6752: "emphasis"><em>checksum</em></span>
6753: phase</a></span></dt>
6754:
6755: <dt><span class="sect1"><a href=
6756: "#build.extract">14.7. The <span class=
6757: "emphasis"><em>extract</em></span>
6758: phase</a></span></dt>
6759:
6760: <dt><span class="sect1"><a href="#build.patch">14.8.
6761: The <span class="emphasis"><em>patch</em></span>
6762: phase</a></span></dt>
6763:
6764: <dt><span class="sect1"><a href="#build.tools">14.9.
6765: The <span class="emphasis"><em>tools</em></span>
6766: phase</a></span></dt>
6767:
6768: <dt><span class="sect1"><a href=
6769: "#build.wrapper">14.10. The <span class=
6770: "emphasis"><em>wrapper</em></span>
6771: phase</a></span></dt>
6772:
6773: <dt><span class="sect1"><a href=
6774: "#build.configure">14.11. The <span class=
6775: "emphasis"><em>configure</em></span>
6776: phase</a></span></dt>
6777:
6778: <dt><span class="sect1"><a href="#build.build">14.12.
6779: The <span class="emphasis"><em>build</em></span>
6780: phase</a></span></dt>
6781:
6782: <dt><span class="sect1"><a href="#build.test">14.13.
6783: The <span class="emphasis"><em>test</em></span>
6784: phase</a></span></dt>
6785:
6786: <dt><span class="sect1"><a href=
6787: "#build.install">14.14. The <span class=
6788: "emphasis"><em>install</em></span>
6789: phase</a></span></dt>
6790:
6791: <dt><span class="sect1"><a href=
6792: "#build.package">14.15. The <span class=
6793: "emphasis"><em>package</em></span>
6794: phase</a></span></dt>
6795:
6796: <dt><span class="sect1"><a href=
6797: "#build.helpful-targets">14.16. Other helpful
1.1 grant 6798: targets</a></span></dt>
6799: </dl>
6800: </dd>
6801:
1.68 rillig 6802: <dt><span class="chapter"><a href="#tools">15. Tools
6803: needed for building or running</a></span></dt>
6804:
6805: <dd>
6806: <dl>
6807: <dt><span class="sect1"><a href="#pkgsrc-tools">15.1.
6808: Tools for pkgsrc builds</a></span></dt>
6809:
6810: <dt><span class="sect1"><a href=
6811: "#package-tools">15.2. Tools needed by
6812: packages</a></span></dt>
6813:
6814: <dt><span class="sect1"><a href=
6815: "#platform-tools">15.3. Tools provided by
6816: platforms</a></span></dt>
6817: </dl>
6818: </dd>
6819:
6820: <dt><span class="chapter"><a href="#fixes">16. Making
1.55 rillig 6821: your package work</a></span></dt>
1.1 grant 6822:
6823: <dd>
6824: <dl>
1.30 wiz 6825: <dt><span class="sect1"><a href=
1.68 rillig 6826: "#general-operation">16.1. General
1.30 wiz 6827: operation</a></span></dt>
1.1 grant 6828:
6829: <dd>
6830: <dl>
6831: <dt><span class="sect2"><a href=
1.68 rillig 6832: "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30 wiz 6833: pull in variables from
6834: /etc/mk.conf</a></span></dt>
1.1 grant 6835:
6836: <dt><span class="sect2"><a href=
1.68 rillig 6837: "#where-to-install-documentation">16.1.2. Where
1.31 wiz 6838: to install documentation</a></span></dt>
6839:
6840: <dt><span class="sect2"><a href=
1.68 rillig 6841: "#restricted-packages">16.1.3. Restricted
1.1 grant 6842: packages</a></span></dt>
6843:
6844: <dt><span class="sect2"><a href=
1.68 rillig 6845: "#dependencies">16.1.4. Handling
1.1 grant 6846: dependencies</a></span></dt>
6847:
6848: <dt><span class="sect2"><a href=
1.68 rillig 6849: "#conflicts">16.1.5. Handling conflicts with
1.1 grant 6850: other packages</a></span></dt>
6851:
6852: <dt><span class="sect2"><a href=
1.68 rillig 6853: "#not-building-packages">16.1.6. Packages that
1.30 wiz 6854: cannot or should not be built</a></span></dt>
1.1 grant 6855:
6856: <dt><span class="sect2"><a href=
1.68 rillig 6857: "#undeletable-packages">16.1.7. Packages which
1.30 wiz 6858: should not be deleted, once
6859: installed</a></span></dt>
1.1 grant 6860:
6861: <dt><span class="sect2"><a href=
1.68 rillig 6862: "#security-handling">16.1.8. Handling packages
1.1 grant 6863: with security problems</a></span></dt>
6864:
6865: <dt><span class="sect2"><a href=
1.68 rillig 6866: "#compiler-bugs">16.1.9. How to handle compiler
1.1 grant 6867: bugs</a></span></dt>
6868:
6869: <dt><span class="sect2"><a href=
1.68 rillig 6870: "#bumping-pkgrevision">16.1.10. How to handle
1.30 wiz 6871: incrementing versions when fixing an existing
1.1 grant 6872: package</a></span></dt>
6873:
6874: <dt><span class="sect2"><a href=
1.68 rillig 6875: "#portability-of-packages">16.1.11. Portability
1.30 wiz 6876: of packages</a></span></dt>
1.1 grant 6877: </dl>
6878: </dd>
6879:
1.30 wiz 6880: <dt><span class="sect1"><a href=
1.68 rillig 6881: "#downloading-issues">16.2. Possible downloading
1.30 wiz 6882: issues</a></span></dt>
1.1 grant 6883:
6884: <dd>
6885: <dl>
6886: <dt><span class="sect2"><a href=
1.68 rillig 6887: "#no-plain-download">16.2.1. Packages whose
1.30 wiz 6888: distfiles aren't available for plain
1.1 grant 6889: downloading</a></span></dt>
6890:
6891: <dt><span class="sect2"><a href=
1.68 rillig 6892: "#modified-distfiles-same-name">16.2.2. How to
1.30 wiz 6893: handle modified distfiles with the 'old'
6894: name</a></span></dt>
1.1 grant 6895: </dl>
6896: </dd>
6897:
1.30 wiz 6898: <dt><span class="sect1"><a href=
1.68 rillig 6899: "#configuration-gotchas">16.3. Configuration
1.30 wiz 6900: gotchas</a></span></dt>
1.1 grant 6901:
6902: <dd>
6903: <dl>
6904: <dt><span class="sect2"><a href=
1.68 rillig 6905: "#fixes.libtool">16.3.1. Shared libraries -
1.1 grant 6906: libtool</a></span></dt>
6907:
6908: <dt><span class="sect2"><a href=
1.68 rillig 6909: "#using-libtool">16.3.2. Using libtool on GNU
1.1 grant 6910: packages that already support
6911: libtool</a></span></dt>
6912:
6913: <dt><span class="sect2"><a href=
1.68 rillig 6914: "#autoconf-automake">16.3.3. GNU
1.1 grant 6915: Autoconf/Automake</a></span></dt>
6916: </dl>
6917: </dd>
6918:
1.68 rillig 6919: <dt><span class="sect1"><a href="#fixes-build">16.4.
1.55 rillig 6920: Building the package</a></span></dt>
1.1 grant 6921:
6922: <dd>
6923: <dl>
6924: <dt><span class="sect2"><a href=
1.68 rillig 6925: "#cpp-defines">16.4.1. CPP
1.30 wiz 6926: defines</a></span></dt>
1.51 rillig 6927:
6928: <dt><span class="sect2"><a href=
1.68 rillig 6929: "#cpp-list-examples">16.4.2. Examples of CPP
1.60 rillig 6930: defines for some platforms</a></span></dt>
6931:
6932: <dt><span class="sect2"><a href=
1.68 rillig 6933: "#cpp-list">16.4.3. Getting a list of CPP
1.51 rillig 6934: defines</a></span></dt>
1.1 grant 6935: </dl>
6936: </dd>
6937:
1.30 wiz 6938: <dt><span class="sect1"><a href=
1.68 rillig 6939: "#package-specific-actions">16.5. Package specific
1.30 wiz 6940: actions</a></span></dt>
1.1 grant 6941:
6942: <dd>
6943: <dl>
6944: <dt><span class="sect2"><a href=
1.68 rillig 6945: "#user-interaction">16.5.1. User
1.2 hubertf 6946: interaction</a></span></dt>
1.1 grant 6947:
6948: <dt><span class="sect2"><a href=
1.68 rillig 6949: "#handling-licenses">16.5.2. Handling
1.1 grant 6950: licenses</a></span></dt>
6951:
6952: <dt><span class="sect2"><a href=
1.68 rillig 6953: "#installing-score-files">16.5.3. Installing
1.30 wiz 6954: score files</a></span></dt>
1.1 grant 6955:
6956: <dt><span class="sect2"><a href=
1.68 rillig 6957: "#perl-scripts">16.5.4. Packages containing perl
1.1 grant 6958: scripts</a></span></dt>
6959:
6960: <dt><span class="sect2"><a href=
1.68 rillig 6961: "#hardcoded-paths">16.5.5. Packages with
1.30 wiz 6962: hardcoded paths to other
6963: interpreters</a></span></dt>
1.1 grant 6964:
6965: <dt><span class="sect2"><a href=
1.68 rillig 6966: "#perl-modules">16.5.6. Packages installing perl
1.1 grant 6967: modules</a></span></dt>
6968:
6969: <dt><span class="sect2"><a href=
1.68 rillig 6970: "#faq.info-files">16.5.7. Packages installing
1.1 grant 6971: info files</a></span></dt>
6972:
6973: <dt><span class="sect2"><a href=
1.68 rillig 6974: "#manpages">16.5.8. Packages installing man
1.57 minskim 6975: pages</a></span></dt>
6976:
6977: <dt><span class="sect2"><a href=
1.68 rillig 6978: "#gconf2-data-files">16.5.9. Packages installing
1.30 wiz 6979: GConf2 data files</a></span></dt>
1.1 grant 6980:
6981: <dt><span class="sect2"><a href=
1.68 rillig 6982: "#scrollkeeper-data-files">16.5.10. Packages
1.30 wiz 6983: installing scrollkeeper data
6984: files</a></span></dt>
1.1 grant 6985:
6986: <dt><span class="sect2"><a href=
1.68 rillig 6987: "#x11-fonts">16.5.11. Packages installing X11
1.1 grant 6988: fonts</a></span></dt>
6989:
6990: <dt><span class="sect2"><a href=
1.68 rillig 6991: "#gtk2-modules">16.5.12. Packages installing GTK2
1.1 grant 6992: modules</a></span></dt>
6993:
6994: <dt><span class="sect2"><a href=
1.68 rillig 6995: "#sgml-xml-data">16.5.13. Packages installing
1.30 wiz 6996: SGML or XML data</a></span></dt>
1.1 grant 6997:
6998: <dt><span class="sect2"><a href=
1.68 rillig 6999: "#mime-database">16.5.14. Packages installing
1.1 grant 7000: extensions to the MIME database</a></span></dt>
7001:
7002: <dt><span class="sect2"><a href=
1.68 rillig 7003: "#intltool">16.5.15. Packages using
1.1 grant 7004: intltool</a></span></dt>
1.18 xtraeme 7005:
7006: <dt><span class="sect2"><a href=
1.68 rillig 7007: "#startup-scripts">16.5.16. Packages installing
1.30 wiz 7008: startup scripts</a></span></dt>
1.57 minskim 7009:
7010: <dt><span class="sect2"><a href=
1.68 rillig 7011: "#tex-packages">16.5.17. Packages installing TeX
1.57 minskim 7012: modules</a></span></dt>
1.1 grant 7013: </dl>
7014: </dd>
7015:
1.30 wiz 7016: <dt><span class="sect1"><a href=
1.68 rillig 7017: "#feedback-to-author">16.6. Feedback to the
1.30 wiz 7018: author</a></span></dt>
1.1 grant 7019: </dl>
7020: </dd>
7021:
1.68 rillig 7022: <dt><span class="chapter"><a href="#debug">17.
1.1 grant 7023: Debugging</a></span></dt>
7024:
1.68 rillig 7025: <dt><span class="chapter"><a href="#submit">18.
1.1 grant 7026: Submitting and Committing</a></span></dt>
7027:
7028: <dd>
7029: <dl>
1.30 wiz 7030: <dt><span class="sect1"><a href=
1.74 ! rillig 7031: "#submitting-binary-packages">18.1. Submitting binary
1.30 wiz 7032: packages</a></span></dt>
1.1 grant 7033:
1.30 wiz 7034: <dt><span class="sect1"><a href=
1.74 ! rillig 7035: "#submitting-your-package">18.2. Submitting source
! 7036: packages (for non-NetBSD-developers)</a></span></dt>
! 7037:
! 7038: <dt><span class="sect1"><a href=
! 7039: "#general-notes-for-changes">18.3. General notes when
1.41 wiz 7040: adding, updating, or removing
7041: packages</a></span></dt>
7042:
7043: <dt><span class="sect1"><a href=
1.74 ! rillig 7044: "#committing-importing">18.4. Committing: Importing a
1.30 wiz 7045: package into CVS</a></span></dt>
1.1 grant 7046:
1.30 wiz 7047: <dt><span class="sect1"><a href=
1.74 ! rillig 7048: "#updating-package">18.5. Updating a package to a
1.30 wiz 7049: newer version</a></span></dt>
1.1 grant 7050:
1.30 wiz 7051: <dt><span class="sect1"><a href=
1.74 ! rillig 7052: "#moving-package">18.6. Moving a package in
1.30 wiz 7053: pkgsrc</a></span></dt>
1.1 grant 7054: </dl>
7055: </dd>
1.69 rillig 7056:
1.72 rillig 7057: <dt><span class="chapter"><a href="#devfaq">19.
7058: Frequently Asked Questions</a></span></dt>
1.1 grant 7059: </dl>
7060: </div>
7061:
1.67 hubertf 7062: <div class="chapter" lang="en">
1.1 grant 7063: <div class="titlepage">
7064: <div>
7065: <div>
1.67 hubertf 7066: <h2 class="title"><a name=
1.38 dillo 7067: "components"></a>Chapter 8. Package
1.27 rillig 7068: components - files, directories and contents</h2>
1.25 rillig 7069: </div>
7070: </div>
7071: </div>
7072:
7073: <div class="toc">
7074: <p><b>Table of Contents</b></p>
7075:
7076: <dl>
7077: <dt><span class="sect1"><a href=
1.45 wiz 7078: "#components.Makefile">8.1. <code xmlns=
7079: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7080: "filename">Makefile</code></a></span></dt>
7081:
7082: <dt><span class="sect1"><a href=
1.45 wiz 7083: "#components.distinfo">8.2. <code xmlns=
7084: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7085: "filename">distinfo</code></a></span></dt>
7086:
7087: <dt><span class="sect1"><a href=
1.38 dillo 7088: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 7089:
1.30 wiz 7090: <dt><span class="sect1"><a href=
1.38 dillo 7091: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 7092: files</a></span></dt>
1.25 rillig 7093:
1.27 rillig 7094: <dt><span class="sect1"><a href=
1.38 dillo 7095: "#components.optional">8.5. Optional
1.27 rillig 7096: files</a></span></dt>
1.25 rillig 7097:
1.38 dillo 7098: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 7099: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7100: class="filename">work*</code></a></span></dt>
1.25 rillig 7101:
1.38 dillo 7102: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 7103: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7104: class="filename">files/*</code></a></span></dt>
1.25 rillig 7105: </dl>
7106: </div>
7107:
1.27 rillig 7108: <p>Whenever you're preparing a package, there are a number
7109: of files involved which are described in the following
7110: sections.</p>
1.25 rillig 7111:
1.67 hubertf 7112: <div class="sect1" lang="en">
1.25 rillig 7113: <div class="titlepage">
7114: <div>
7115: <div>
7116: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7117: "components.Makefile"></a>8.1. <code xmlns=
7118: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7119: "filename">Makefile</code></h2>
1.25 rillig 7120: </div>
7121: </div>
7122: </div>
7123:
1.27 rillig 7124: <p>Building, installation and creation of a binary
1.45 wiz 7125: package are all controlled by the package's <code xmlns=
7126: "http://www.w3.org/TR/xhtml1/transitional" class=
7127: "filename">Makefile</code>. The <code xmlns=
7128: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7129: "filename">Makefile</code> describes various things about
7130: a package, for example from where to get it, how to
7131: configure, build, and install it.</p>
7132:
1.45 wiz 7133: <p>A package <code xmlns=
7134: "http://www.w3.org/TR/xhtml1/transitional" class=
7135: "filename">Makefile</code> contains several sections that
7136: describe the package.</p>
1.25 rillig 7137:
1.27 rillig 7138: <p>In the first section there are the following
7139: variables, which should appear exactly in the order given
7140: here.</p>
1.25 rillig 7141:
7142: <div class="itemizedlist">
7143: <ul type="disc">
7144: <li>
1.27 rillig 7145: <p><code class="varname">DISTNAME</code> is the
7146: basename of the distribution file to be downloaded
7147: from the package's website.</p>
7148: </li>
7149:
7150: <li>
7151: <p><code class="varname">PKGNAME</code> is the name
7152: of the package, as used by pkgsrc. You only need to
1.50 rillig 7153: provide it if it differs from <code class=
7154: "varname">DISTNAME</code>. Usually it is the
7155: directory name together with the version number. It
7156: must match the regular expression <code class=
1.27 rillig 7157: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
7158: that is, it starts with a letter or digit, and
7159: contains only letters, digits, dashes, underscores,
7160: dots and plus signs.</p>
1.25 rillig 7161: </li>
7162:
7163: <li>
1.27 rillig 7164: <p><code class="varname">CATEGORIES</code> is a
7165: list of categories which the package fits in. You
7166: can choose any of the top-level directories of
7167: pkgsrc for it.</p>
1.45 wiz 7168:
7169: <p>Currently the following values are available for
7170: <code class="varname">CATEGORIES</code>. If more
7171: than one is used, they need to be separated by
7172: spaces:</p>
7173: <pre class="programlisting">
1.51 rillig 7174: archivers cross geography meta-pkgs security
7175: audio databases graphics misc shells
7176: benchmarks devel ham multimedia sysutils
7177: biology editors inputmethod net textproc
7178: cad emulators lang news time
7179: chat finance mail parallel wm
7180: comms fonts math pkgtools www
7181: converters games mbone print x11
1.45 wiz 7182: </pre>
1.25 rillig 7183: </li>
7184:
7185: <li>
1.27 rillig 7186: <p><code class="varname">MASTER_SITES</code> is a
7187: list of URLs where the distribution files can be
7188: downloaded. Each URL must end with a slash.</p>
1.45 wiz 7189:
7190: <p>The <code class="varname">MASTER_SITES</code>
7191: may make use of the following predefined sites:</p>
7192: <pre class="programlisting">
1.51 rillig 7193: ${MASTER_SITE_APACHE}
7194: ${MASTER_SITE_BACKUP}
7195: ${MASTER_SITE_CYGWIN}
7196: ${MASTER_SITE_DEBIAN}
7197: ${MASTER_SITE_FREEBSD}
7198: ${MASTER_SITE_FREEBSD_LOCAL}
7199: ${MASTER_SITE_GNOME}
7200: ${MASTER_SITE_GNU}
7201: ${MASTER_SITE_GNUSTEP}
7202: ${MASTER_SITE_IFARCHIVE}
7203: ${MASTER_SITE_MOZILLA}
7204: ${MASTER_SITE_OPENOFFICE}
7205: ${MASTER_SITE_PERL_CPAN}
7206: ${MASTER_SITE_R_CRAN}
7207: ${MASTER_SITE_SOURCEFORGE}
7208: ${MASTER_SITE_SUNSITE}
7209: ${MASTER_SITE_SUSE}
7210: ${MASTER_SITE_TEX_CTAN}
7211: ${MASTER_SITE_XCONTRIB}
7212: ${MASTER_SITE_XEMACS}
1.45 wiz 7213: </pre>
7214:
7215: <p>If one of these predefined sites is chosen, you
7216: may want to specify a subdirectory of that site.
7217: Since these macros may expand to more than one
7218: actual site, you <span class=
7219: "emphasis"><em>must</em></span> use the following
7220: construct to specify a subdirectory:</p>
7221: <pre class="programlisting">
1.51 rillig 7222: ${MASTER_SITE_GNU:=subdirectory/name/}
7223: ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45 wiz 7224: </pre>
7225:
7226: <p>Note the trailing slash after the subdirectory
7227: name.</p>
7228:
7229: <p>If the package has multiple <code class=
7230: "varname">DISTFILES</code> or multiple <code class=
7231: "varname">PATCHFILES</code> from different sites,
1.72 rillig 7232: set <code class="varname">SITES.foo</code> to a
1.47 reed 7233: list of URIs where file “<span class=
1.45 wiz 7234: "quote">foo</span>” may be found.
7235: “<span class="quote">foo</span>”
1.47 reed 7236: includes the suffix, e.g.:</p>
1.45 wiz 7237: <pre class="programlisting">
1.51 rillig 7238: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
7239: DISTFILES+= foo-file.tar.gz
1.72 rillig 7240: SITES.foo-file.tar.gz= \
1.69 rillig 7241: http://www.somewhere.com/somehow/ \
1.51 rillig 7242: http://www.somewhereelse.com/mirror/somehow/
1.45 wiz 7243: </pre>
7244: </li>
7245:
7246: <li>
7247: <p><code class="varname">DISTFILES</code>: Name(s)
7248: of archive file(s) containing distribution. The
7249: default is <code xmlns=
7250: "http://www.w3.org/TR/xhtml1/transitional" class=
7251: "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
7252: Should only be set if you have more than one
7253: distfile.</p>
7254:
7255: <p>Note that the normal default setting of
7256: <code class="varname">DISTFILES</code> must be made
7257: explicit if you want to add to it (rather than
7258: replace it), as you usually would.</p>
7259: </li>
7260:
7261: <li>
7262: <p><code class="varname">EXTRACT_SUFX</code>:
7263: Suffix of the distribution file, will be appended
7264: to <code class="varname">DISTNAME</code>. Defaults
7265: to <code xmlns=
7266: "http://www.w3.org/TR/xhtml1/transitional" class=
7267: "filename">.tar.gz</code>.</p>
7268: </li>
7269: </ul>
7270: </div>
7271:
7272: <p>The second section contains information about
7273: separately downloaded patches, if any.</p>
7274:
7275: <div class="itemizedlist">
7276: <ul type="disc">
7277: <li>
1.47 reed 7278: <p><code class="varname">PATCHFILES:</code> Name(s)
1.45 wiz 7279: of additional files that contain distribution
7280: patches. There is no default. pkgsrc will look for
7281: them at <code class="varname">PATCH_SITES</code>.
7282: They will automatically be uncompressed before
7283: patching if the names end with <code xmlns=
7284: "http://www.w3.org/TR/xhtml1/transitional" class=
7285: "filename">.gz</code> or <code xmlns=
7286: "http://www.w3.org/TR/xhtml1/transitional" class=
7287: "filename">.Z</code>.</p>
7288: </li>
7289:
7290: <li>
7291: <p><code class="varname">PATCH_SITES</code>:
7292: Primary location(s) for distribution patch files
7293: (see <code class="varname">PATCHFILES</code> below)
7294: if not found locally.</p>
1.25 rillig 7295: </li>
7296: </ul>
7297: </div>
7298:
1.45 wiz 7299: <p>The third section contains the following
1.27 rillig 7300: variables.</p>
1.25 rillig 7301:
1.27 rillig 7302: <div class="itemizedlist">
7303: <ul type="disc">
7304: <li>
7305: <p><code class="varname">MAINTAINER</code> is the
1.50 rillig 7306: email address of the person who feels responsible
7307: for this package, and who is most likely to look at
7308: problems or questions regarding this package which
7309: have been reported with <a href=
1.45 wiz 7310: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
7311: <span class="citerefentry"><span class=
1.50 rillig 7312: "refentrytitle">send-pr</span>(1)</span></a>. Other
7313: developers should contact the <code class=
7314: "varname">MAINTAINER</code> before making major
7315: changes to the package. When packaging a new
7316: program, set <code class=
7317: "varname">MAINTAINER</code> to yourself. If you
7318: really can't maintain the package for future
7319: updates, set it to <code class="email"><<a href=
1.71 wiz 7320: "mailto:pkgsrc-users@NetBSD.org">pkgsrc-users@NetBSD.org</a>></code>.</p>
1.27 rillig 7321: </li>
1.25 rillig 7322:
1.27 rillig 7323: <li>
7324: <p><code class="varname">HOMEPAGE</code> is a URL
7325: where users can find more information about the
1.23 wiz 7326: package.</p>
7327: </li>
1.1 grant 7328:
1.23 wiz 7329: <li>
7330: <p><code class="varname">COMMENT</code> is a
1.45 wiz 7331: one-line description of the package (should not
7332: include the package name).</p>
1.23 wiz 7333: </li>
7334: </ul>
7335: </div>
1.1 grant 7336:
1.45 wiz 7337: <p>Other variables that affect the build:</p>
1.1 grant 7338:
1.45 wiz 7339: <div class="itemizedlist">
7340: <ul type="disc">
7341: <li>
7342: <p><code class="varname">WRKSRC</code>: The
1.50 rillig 7343: directory where the interesting distribution files
7344: of the package are found. The default is
7345: <code xmlns=
7346: "http://www.w3.org/TR/xhtml1/transitional" class=
7347: "filename">${WRKDIR}/${DISTNAME}</code>, which
7348: works for most packages.</p>
7349:
7350: <p>If a package doesn't create a subdirectory for
7351: itself (most GNU software does, for instance), but
7352: extracts itself in the current directory, you
7353: should set <code class="varname">WRKSRC=
7354: ${WRKDIR}</code>.</p>
7355:
7356: <p>If a package doesn't create a subdirectory with
7357: the name of <code class="varname">DISTNAME</code>
7358: but some different name, set <code class=
7359: "varname">WRKSRC</code> to point to the proper name
7360: in <code xmlns=
7361: "http://www.w3.org/TR/xhtml1/transitional" class=
7362: "filename">${WRKDIR}</code>, for example
7363: <code class="varname">WRKSRC=
7364: ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
7365: "http://www.w3.org/TR/xhtml1/transitional" href=
7366: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
7367: target="_top"><code xmlns="" class=
7368: "filename">lang/tcl</code></a> and <a xmlns=
7369: "http://www.w3.org/TR/xhtml1/transitional" href=
7370: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
7371: target="_top"><code xmlns="" class=
7372: "filename">x11/tk</code></a> for other
7373: examples.</p>
7374:
7375: <p>The name of the working directory created by
7376: pkgsrc is taken from the <code class=
7377: "varname">WRKDIR_BASENAME</code> variable. By
7378: default, its value is <code xmlns=
7379: "http://www.w3.org/TR/xhtml1/transitional" class=
7380: "filename">work</code>. If you want to use the same
7381: pkgsrc tree for building different kinds of binary
7382: packages, you can change the variable according to
7383: your needs. Two other variables handle common cases
7384: of setting <code class=
7385: "varname">WRKDIR_BASENAME</code> individually. If
7386: <code class="varname">OBJHOSTNAME</code> is defined
7387: in <code xmlns=
1.45 wiz 7388: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 7389: "filename">/etc/mk.conf</code>, the first component
7390: of the host's name is attached to the directory
7391: name. If <code class="varname">OBJMACHINE</code> is
7392: defined, the platform name is attached, which might
7393: look like <code xmlns=
7394: "http://www.w3.org/TR/xhtml1/transitional" class=
7395: "filename">work.i386</code> or <code xmlns=
1.45 wiz 7396: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 7397: "filename">work.sparc</code>.</p>
1.45 wiz 7398: </li>
7399: </ul>
1.1 grant 7400: </div>
7401:
7402: <p>Please pay attention to the following gotchas:</p>
7403:
7404: <div class="itemizedlist">
7405: <ul type="disc">
7406: <li>
1.14 xtraeme 7407: <p>Add <code class="varname">MANCOMPRESSED</code>
1.47 reed 7408: if man pages are installed in compressed form by
7409: the package; see comment in <code xmlns=
1.45 wiz 7410: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7411: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 7412: </li>
7413:
7414: <li>
1.45 wiz 7415: <p>Replace <code xmlns=
7416: "http://www.w3.org/TR/xhtml1/transitional" class=
7417: "filename">/usr/local</code> with
7418: “<span class="quote">${PREFIX}</span>”
7419: in all files (see patches, below).</p>
1.1 grant 7420: </li>
7421:
7422: <li>
7423: <p>If the package installs any info files, see
7424: <a href="#faq.info-files" title=
1.68 rillig 7425: "16.5.7. Packages installing info files">Section 16.5.7,
1.45 wiz 7426: “Packages installing info
1.1 grant 7427: files”</a>.</p>
7428: </li>
7429: </ul>
7430: </div>
7431: </div>
7432:
1.67 hubertf 7433: <div class="sect1" lang="en">
1.1 grant 7434: <div class="titlepage">
7435: <div>
7436: <div>
7437: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7438: "components.distinfo"></a>8.2. <code xmlns=
7439: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7440: "filename">distinfo</code></h2>
1.1 grant 7441: </div>
7442: </div>
7443: </div>
7444:
1.50 rillig 7445: <p>The <code xmlns=
7446: "http://www.w3.org/TR/xhtml1/transitional" class=
7447: "filename">distinfo</code> file contains the message
7448: digest, or checksum, of each distfile needed for the
7449: package. This ensures that the distfiles retrieved from
7450: the Internet have not been corrupted during transfer or
7451: altered by a malign force to introduce a security hole.
7452: Due to recent rumor about weaknesses of digest
7453: algorithms, all distfiles are protected using both SHA1
7454: and RMD160 message digests, as well as the file size.</p>
7455:
7456: <p>The <code xmlns=
7457: "http://www.w3.org/TR/xhtml1/transitional" class=
7458: "filename">distinfo</code> file also contains the
7459: checksums for all the patches found in the <code xmlns=
7460: "http://www.w3.org/TR/xhtml1/transitional" class=
7461: "filename">patches</code> directory (see <a href=
7462: "#components.patches" title=
7463: "8.3. patches/*">Section 8.3,
7464: “patches/*”</a>).</p>
7465:
7466: <p>To regenerate the <code xmlns=
7467: "http://www.w3.org/TR/xhtml1/transitional" class=
7468: "filename">distinfo</code> file, use the
1.14 xtraeme 7469: <span><strong class="command">make
1.50 rillig 7470: makedistinfo</strong></span> or <span><strong class=
7471: "command">make mdi</strong></span> command.</p>
1.1 grant 7472:
1.50 rillig 7473: <p>Some packages have different sets of distfiles
7474: depending on the platform, for example <a xmlns=
1.1 grant 7475: "http://www.w3.org/TR/xhtml1/transitional" href=
7476: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45 wiz 7477: target="_top"><code xmlns="" class=
7478: "filename">www/navigator</code></a>). These are kept in
1.50 rillig 7479: the same <code xmlns=
1.45 wiz 7480: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 7481: "filename">distinfo</code> file and care should be taken
7482: when upgrading such a package to ensure distfile
7483: information is not lost.</p>
1.1 grant 7484: </div>
7485:
1.67 hubertf 7486: <div class="sect1" lang="en">
1.1 grant 7487: <div class="titlepage">
7488: <div>
7489: <div>
7490: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7491: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 7492: </div>
7493: </div>
7494: </div>
7495:
7496: <p>This directory contains files that are used by the
7497: <a href=
7498: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
7499: <span class="citerefentry"><span class=
7500: "refentrytitle">patch</span>(1)</span></a> command to
7501: modify the sources as distributed in the distribution
7502: file into a form that will compile and run perfectly on
7503: NetBSD. The files are applied successively in alphabetic
7504: order (as returned by a shell “<span class=
7505: "quote">patches/patch-*</span>” glob expansion), so
1.45 wiz 7506: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7507: class="filename">patch-aa</code> is applied before
7508: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7509: class="filename">patch-ab</code>, etc.</p>
7510:
7511: <p>The <code xmlns=
7512: "http://www.w3.org/TR/xhtml1/transitional" class=
7513: "filename">patch-*</code> files should be in
7514: <span><strong class="command">diff -bu</strong></span>
7515: format, and apply without a fuzz to avoid problems. (To
7516: force patches to apply with fuzz you can set <code class=
1.14 xtraeme 7517: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 7518: not put changes for more than one file into a single
1.47 reed 7519: patch file, as this will make future modifications more
1.1 grant 7520: difficult.</p>
7521:
7522: <p>Similar, a file should be patched at most once, not
7523: several times by several different patches. If a file
7524: needs several patches, they should be combined into one
7525: file.</p>
7526:
7527: <p>One important thing to mention is to pay attention
7528: that no RCS IDs get stored in the patch files, as these
7529: will cause problems when later checked into the NetBSD
1.14 xtraeme 7530: CVS tree. Use the <span><strong class=
7531: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 7532: "http://www.w3.org/TR/xhtml1/transitional" href=
7533: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 7534: target="_top"><code xmlns="" class=
7535: "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20 ben 7536: these problems.</p>
1.1 grant 7537:
7538: <p>For even more automation, we recommend using
1.14 xtraeme 7539: <span><strong class="command">mkpatches</strong></span>
7540: from the same package to make a whole set of patches. You
7541: just have to backup files before you edit them to
1.45 wiz 7542: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7543: class="filename">filename.orig</code>, e.g. with
1.14 xtraeme 7544: <span><strong class="command">cp -p filename
7545: filename.orig</strong></span> or, easier, by using
7546: <span><strong class="command">pkgvi</strong></span> again
7547: from the same package. If you upgrade a package this way,
7548: you can easily compare the new set of patches with the
7549: previously existing one with <span><strong class=
7550: "command">patchdiff</strong></span>.</p>
1.1 grant 7551:
7552: <p>When you have finished a package, remember to generate
7553: the checksums for the patch files by using the
1.14 xtraeme 7554: <span><strong class="command">make
7555: makepatchsum</strong></span> command, see <a href=
7556: "#components.distinfo" title=
1.38 dillo 7557: "8.2. distinfo">Section 8.2,
1.45 wiz 7558: “<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7559: class="filename">distinfo</code>”</a>.</p>
1.1 grant 7560:
1.46 gdt 7561: <p>When adding a patch that corrects a problem in the
7562: distfile (rather than e.g. enforcing pkgsrc's view of
7563: where man pages should go), send the patch as a bug
7564: report to the maintainer. This benefits non-pkgsrc users
7565: of the package, and usually enables removing the patch in
7566: future version.</p>
7567:
1.1 grant 7568: <p>Patch files that are distributed by the author or
1.14 xtraeme 7569: other maintainers can be listed in <code class=
7570: "varname">$PATCHFILES</code>.</p>
1.1 grant 7571:
7572: <p>If it is desired to store any patches that should not
7573: be committed into pkgsrc, they can be kept outside the
1.45 wiz 7574: pkgsrc tree in the <code xmlns=
7575: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7576: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 7577: tree there is expected to have the same
7578: “<span class="quote">category/package</span>”
7579: structure as pkgsrc, and patches are expected to be
1.45 wiz 7580: stored inside these dirs (also known as <code xmlns=
7581: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 7582: "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
7583: if you want to keep a private patch for <code xmlns=
1.45 wiz 7584: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7585: "filename">pkgsrc/graphics/png</code>, keep it in
1.45 wiz 7586: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7587: class=
1.14 xtraeme 7588: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
7589: files in the named directory are expected to be patch
1.1 grant 7590: files, and <span class="emphasis"><em>they are applied
7591: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 7592: </div>
7593:
1.67 hubertf 7594: <div class="sect1" lang="en">
1.27 rillig 7595: <div class="titlepage">
7596: <div>
7597: <div>
7598: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7599: "other-mandatory-files"></a>8.4. Other
1.27 rillig 7600: mandatory files</h2>
7601: </div>
7602: </div>
7603: </div>
7604:
7605: <div class="variablelist">
7606: <dl>
1.45 wiz 7607: <dt><span class="term"><code xmlns=
7608: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7609: "filename">DESCR</code></span></dt>
7610:
7611: <dd>
7612: <p>A multi-line description of the piece of
7613: software. This should include any credits where
7614: they are due. Please bear in mind that others do
7615: not share your sense of humour (or spelling
7616: idiosyncrasies), and that others will read
7617: everything that you write here.</p>
7618: </dd>
7619:
1.45 wiz 7620: <dt><span class="term"><code xmlns=
7621: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7622: "filename">PLIST</code></span></dt>
7623:
7624: <dd>
7625: <p>This file governs the files that are installed
7626: on your system: all the binaries, manual pages,
7627: etc. There are other directives which may be
7628: entered in this file, to control the creation and
7629: deletion of directories, and the location of
7630: inserted files. See <a href="#plist" title=
1.38 dillo 7631: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 7632: <i>PLIST issues</i></a> for more information.</p>
7633: </dd>
7634: </dl>
7635: </div>
7636: </div>
7637:
1.67 hubertf 7638: <div class="sect1" lang="en">
1.27 rillig 7639: <div class="titlepage">
7640: <div>
7641: <div>
7642: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7643: "components.optional"></a>8.5. Optional
1.27 rillig 7644: files</h2>
7645: </div>
7646: </div>
7647: </div>
7648:
7649: <div class="variablelist">
7650: <dl>
1.45 wiz 7651: <dt><span class="term"><code xmlns=
7652: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7653: "filename">INSTALL</code></span></dt>
7654:
7655: <dd>
7656: <p>This shell script is invoked twice by <a href=
7657: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7658: <span class="citerefentry"><span class=
7659: "refentrytitle">pkg_add</span>(1)</span></a>. First
7660: time after package extraction and before files are
7661: moved in place, the second time after the files to
7662: install are moved in place. This can be used to do
7663: any custom procedures not possible with @exec
1.45 wiz 7664: commands in <code xmlns=
7665: "http://www.w3.org/TR/xhtml1/transitional" class=
7666: "filename">PLIST</code>. See <a href=
1.27 rillig 7667: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7668: <span class="citerefentry"><span class=
7669: "refentrytitle">pkg_add</span>(1)</span></a> and
7670: <a href=
7671: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7672: <span class="citerefentry"><span class=
7673: "refentrytitle">pkg_create</span>(1)</span></a> for
7674: more information.</p>
7675: </dd>
7676:
1.45 wiz 7677: <dt><span class="term"><code xmlns=
7678: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7679: "filename">DEINSTALL</code></span></dt>
7680:
7681: <dd>
7682: <p>This script is executed before and after any
7683: files are removed. It is this script's
7684: responsibility to clean up any additional messy
7685: details around the package's installation, since
7686: all pkg_delete knows is how to delete the files
7687: created in the original distribution. See <a href=
7688: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7689: <span class="citerefentry"><span class=
7690: "refentrytitle">pkg_delete</span>(1)</span></a> and
7691: <a href=
7692: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7693: <span class="citerefentry"><span class=
7694: "refentrytitle">pkg_create</span>(1)</span></a> for
7695: more information.</p>
7696: </dd>
7697:
1.45 wiz 7698: <dt><span class="term"><code xmlns=
7699: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7700: "filename">MESSAGE</code></span></dt>
7701:
7702: <dd>
1.50 rillig 7703: <p>This file is displayed after installation of the
1.27 rillig 7704: package. Useful for things like legal notices on
7705: almost-free software and hints for updating config
7706: files after installing modules for apache, PHP etc.
7707: Please note that you can modify variables in it
7708: easily by using <code class=
7709: "varname">MESSAGE_SUBST</code> in the package's
1.45 wiz 7710: <code xmlns=
7711: "http://www.w3.org/TR/xhtml1/transitional" class=
7712: "filename">Makefile</code>:</p>
1.27 rillig 7713: <pre class="programlisting">
1.51 rillig 7714: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.27 rillig 7715: </pre>
7716:
7717: <p>replaces "${SOMEVAR}" with “<span class=
1.45 wiz 7718: "quote">somevalue</span>” in <code xmlns=
7719: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7720: "filename">MESSAGE</code>.</p>
7721: </dd>
7722: </dl>
7723: </div>
7724: </div>
7725:
1.67 hubertf 7726: <div class="sect1" lang="en">
1.27 rillig 7727: <div class="titlepage">
7728: <div>
7729: <div>
7730: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 7731: "work-dir"></a>8.6. <code xmlns=
1.45 wiz 7732: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7733: "filename">work*</code></h2>
7734: </div>
7735: </div>
7736: </div>
7737:
7738: <p>When you type <span><strong class=
1.47 reed 7739: "command">make</strong></span>, the distribution files
7740: are unpacked into the directory denoted by <code class=
1.45 wiz 7741: "varname">WRKDIR</code>. It can be removed by running
7742: <span><strong class="command">make clean</strong></span>.
7743: Besides the sources, this directory is also used to keep
7744: various timestamp files. The directory gets <span class=
7745: "emphasis"><em>removed completely</em></span> on clean.
7746: The default is <code xmlns=
7747: "http://www.w3.org/TR/xhtml1/transitional" class=
7748: "filename">${.CURDIR}/work</code> or <code xmlns=
7749: "http://www.w3.org/TR/xhtml1/transitional" class=
7750: "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
7751: <code class="varname">OBJMACHINE</code> is set.</p>
1.27 rillig 7752: </div>
7753:
1.67 hubertf 7754: <div class="sect1" lang="en">
1.27 rillig 7755: <div class="titlepage">
7756: <div>
7757: <div>
7758: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7759: "files-dir"></a>8.7. <code xmlns=
7760: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7761: "filename">files/*</code></h2>
7762: </div>
7763: </div>
7764: </div>
7765:
7766: <p>If you have any files that you wish to be placed in
7767: the package prior to configuration or building, you could
7768: place these files here and use a “<span class=
7769: "quote">${CP}</span>” command in the
7770: “<span class="quote">pre-configure</span>”
7771: target to achieve this. Alternatively, you could simply
1.45 wiz 7772: diff the file against <code xmlns=
7773: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7774: "filename">/dev/null</code> and use the patch mechanism
7775: to manage the creation of this file.</p>
7776: </div>
7777: </div>
7778:
1.67 hubertf 7779: <div class="chapter" lang="en">
1.27 rillig 7780: <div class="titlepage">
7781: <div>
7782: <div>
1.67 hubertf 7783: <h2 class="title"><a name=
1.38 dillo 7784: "makefile"></a>Chapter 9. Programming in
1.45 wiz 7785: <code xmlns=
7786: "http://www.w3.org/TR/xhtml1/transitional" class=
7787: "filename">Makefile</code>s</h2>
1.27 rillig 7788: </div>
7789: </div>
7790: </div>
7791:
7792: <div class="toc">
7793: <p><b>Table of Contents</b></p>
7794:
7795: <dl>
7796: <dt><span class="sect1"><a href=
1.45 wiz 7797: "#makefile.variables">9.1. <code xmlns=
7798: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7799: "filename">Makefile</code> variables</a></span></dt>
7800:
7801: <dd>
7802: <dl>
7803: <dt><span class="sect2"><a href=
1.38 dillo 7804: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 7805: conventions</a></span></dt>
7806: </dl>
7807: </dd>
7808:
1.38 dillo 7809: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 7810: Code snippets</a></span></dt>
7811:
7812: <dd>
7813: <dl>
1.30 wiz 7814: <dt><span class="sect2"><a href=
1.38 dillo 7815: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 7816: list</a></span></dt>
1.27 rillig 7817:
1.30 wiz 7818: <dt><span class="sect2"><a href=
1.38 dillo 7819: "#converting-internal-to-external">9.2.2.
1.27 rillig 7820: Converting an internal list into an external
7821: list</a></span></dt>
7822:
1.30 wiz 7823: <dt><span class="sect2"><a href=
1.38 dillo 7824: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 7825: variables to a shell command</a></span></dt>
1.27 rillig 7826:
1.30 wiz 7827: <dt><span class="sect2"><a href=
1.38 dillo 7828: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 7829: guideline</a></span></dt>
1.27 rillig 7830:
1.30 wiz 7831: <dt><span class="sect2"><a href=
1.38 dillo 7832: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 7833: bug in BSD Make</a></span></dt>
1.27 rillig 7834: </dl>
7835: </dd>
7836: </dl>
7837: </div>
7838:
1.45 wiz 7839: <p>Pkgsrc consists of many <code xmlns=
7840: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7841: "filename">Makefile</code> fragments, each of which forms a
7842: well-defined part of the pkgsrc system. Using the <a href=
7843: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7844: <span class="citerefentry"><span class=
7845: "refentrytitle">make</span>(1)</span></a> system as a
7846: programming language for a big system like pkgsrc requires
7847: some discipline to keep the code correct and
7848: understandable.</p>
7849:
1.45 wiz 7850: <p>The basic ingredients for <code xmlns=
7851: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7852: "filename">Makefile</code> programming are variables (which
7853: are actually macros) and shell commands. Among these shell
7854: commands may even be more complex ones like <a href=
7855: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
7856: <span class="citerefentry"><span class=
7857: "refentrytitle">awk</span>(1)</span></a> programs. To make
7858: sure that every shell command runs as intended it is
7859: necessary to quote all variables correctly when they are
7860: used.</p>
7861:
7862: <p>This chapter describes some patterns, that appear quite
1.45 wiz 7863: often in <code xmlns=
7864: "http://www.w3.org/TR/xhtml1/transitional" class=
7865: "filename">Makefile</code>s, including the pitfalls that
7866: come along with them.</p>
1.27 rillig 7867:
1.67 hubertf 7868: <div class="sect1" lang="en">
1.27 rillig 7869: <div class="titlepage">
7870: <div>
7871: <div>
7872: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7873: "makefile.variables"></a>9.1. <code xmlns=
7874: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7875: "filename">Makefile</code> variables</h2>
7876: </div>
7877: </div>
7878: </div>
7879:
1.45 wiz 7880: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7881: class="filename">Makefile</code> variables contain
7882: strings that can be processed using the five operators
7883: ``='', ``+='', ``?='', ``:='', and ``!='', which are
7884: described in the <a href=
1.27 rillig 7885: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7886: <span class="citerefentry"><span class=
7887: "refentrytitle">make</span>(1)</span></a> man page.</p>
7888:
1.45 wiz 7889: <p>When a variable's value is parsed from a <code xmlns=
7890: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7891: "filename">Makefile</code>, the hash character ``#'' and
7892: the backslash character ``\'' are handled specially. If a
7893: backslash is followed by a newline, any whitespace
7894: immediately in front of the backslash, the backslash, the
7895: newline, and any whitespace immediately behind the
1.74 ! rillig 7896: newline are replaced with a single space. A backslash
1.27 rillig 7897: character and an immediately following hash character are
1.47 reed 7898: replaced with a single hash character. Otherwise, the
1.27 rillig 7899: backslash is passed as is. In a variable assignment, any
7900: hash character that is not preceded by a backslash starts
7901: a comment that continues upto the end of the logical
7902: line.</p>
7903:
7904: <p><span class="emphasis"><em>Note:</em></span> Because
7905: of this parsing algorithm the only way to create a
7906: variable consisting of a single backslash is using the
7907: ``!='' operator, for example: <code class=
7908: "varname">BACKSLASH!=echo "\\"</code>.</p>
7909:
7910: <p>So far for defining variables. The other thing you can
7911: do with variables is evaluating them. A variable is
7912: evaluated when it is part of the right side of the ``:=''
7913: or the ``!='' operator, or directly before executing a
7914: shell command which the variable is part of. In all other
1.47 reed 7915: cases, <a href=
1.27 rillig 7916: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7917: <span class="citerefentry"><span class=
7918: "refentrytitle">make</span>(1)</span></a> performs lazy
7919: evaluation, that is, variables are not evaluated until
7920: there's no other way. The ``modifiers'' mentioned in the
7921: man page also evaluate the variable.</p>
7922:
7923: <p>Some of the modifiers split the string into words and
7924: then operate on the words, others operate on the string
1.47 reed 7925: as a whole. When a string is split into words, it is
7926: split as you would expect it from <a href=
1.27 rillig 7927: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
7928: <span class="citerefentry"><span class=
7929: "refentrytitle">sh</span>(1)</span></a>.</p>
7930:
7931: <p>No rule without exception—the
7932: <span><strong class="command">.for</strong></span> loop
7933: does not follow the shell quoting rules but splits at
7934: sequences of whitespace.</p>
7935:
7936: <p>There are several types of variables that should be
7937: handled differently. Strings and two types of lists.</p>
7938:
7939: <div class="itemizedlist">
7940: <ul type="disc">
7941: <li>
7942: <p><span class="emphasis"><em>Strings</em></span>
1.47 reed 7943: can contain arbitrary characters. Nevertheless, you
1.27 rillig 7944: should restrict yourself to only using printable
7945: characters. Examples are <code class=
7946: "varname">PREFIX</code> and <code class=
7947: "varname">COMMENT</code>.</p>
7948: </li>
7949:
7950: <li>
7951: <p><span class="emphasis"><em>Internal
7952: lists</em></span> are lists that are never exported
7953: to any shell command. Their elements are separated
1.47 reed 7954: by whitespace. Therefore, the elements themselves
1.27 rillig 7955: cannot have embedded whitespace. Any other
7956: characters are allowed. Internal lists can be used
7957: in <span><strong class=
7958: "command">.for</strong></span> loops. Examples are
7959: <code class="varname">DEPENDS</code> and
7960: <code class="varname">BUILD_DEPENDS</code>.</p>
7961: </li>
7962:
7963: <li>
7964: <p><span class="emphasis"><em>External
7965: lists</em></span> are lists that may be exported to
7966: a shell command. Their elements can contain any
7967: characters, including whitespace. That's why they
7968: cannot be used in <span><strong class=
7969: "command">.for</strong></span> loops. Examples are
7970: <code class="varname">DISTFILES</code> and
7971: <code class="varname">MASTER_SITES</code>.</p>
7972: </li>
7973: </ul>
7974: </div>
7975:
1.67 hubertf 7976: <div class="sect2" lang="en">
1.27 rillig 7977: <div class="titlepage">
7978: <div>
7979: <div>
7980: <h3 class="title"><a name=
1.38 dillo 7981: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 7982: conventions</h3>
7983: </div>
7984: </div>
7985: </div>
7986:
7987: <div class="itemizedlist">
7988: <ul type="disc">
7989: <li>
7990: <p>All variable names starting with an underscore
7991: are reserved for use by the pkgsrc
7992: infrastructure. They shall not be used by package
1.45 wiz 7993: <code xmlns=
7994: "http://www.w3.org/TR/xhtml1/transitional" class=
7995: "filename">Makefile</code>s.</p>
1.27 rillig 7996: </li>
7997:
7998: <li>
7999: <p>In <span><strong class=
8000: "command">.for</strong></span> loops you should
8001: use lowercase variable names for the iteration
8002: variables.</p>
8003: </li>
8004:
8005: <li>
8006: <p>All list variables should have a ``plural''
8007: name, e.g. <code class=
8008: "varname">PKG_OPTIONS</code> or <code class=
8009: "varname">DISTFILES</code>.</p>
8010: </li>
8011: </ul>
8012: </div>
8013: </div>
8014: </div>
8015:
1.67 hubertf 8016: <div class="sect1" lang="en">
1.27 rillig 8017: <div class="titlepage">
8018: <div>
8019: <div>
8020: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8021: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 8022: </div>
8023: </div>
8024: </div>
8025:
8026: <p>This section presents you with some code snippets you
8027: should use in your own code. If you don't find anything
8028: appropriate here, you should test your code and add it
8029: here.</p>
8030:
1.67 hubertf 8031: <div class="sect2" lang="en">
1.27 rillig 8032: <div class="titlepage">
8033: <div>
8034: <div>
1.67 hubertf 8035: <h3 class="title"><a name=
1.38 dillo 8036: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 8037: a list</h3>
1.27 rillig 8038: </div>
8039: </div>
8040: </div>
8041: <pre class="programlisting">
1.51 rillig 8042: STRING= foo * bar `date`
8043: INT_LIST= # empty
8044: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
8045: EXT_LIST= # empty
8046: ANOTHER_EXT_LIST= a=b c=d
8047:
8048: INT_LIST+= ${STRING} # 1
8049: INT_LIST+= ${ANOTHER_INT_LIST} # 2
8050: EXT_LIST+= ${STRING:Q} # 3
8051: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
1.27 rillig 8052: </pre>
8053:
8054: <p>When you add a string to an external list (example
8055: 3), it must be quoted. In all other cases, you must not
8056: add a quoting level. You must not merge internal and
8057: external lists, unless you are sure that all entries
8058: are correctly interpreted in both lists.</p>
8059: </div>
8060:
1.67 hubertf 8061: <div class="sect2" lang="en">
1.27 rillig 8062: <div class="titlepage">
8063: <div>
8064: <div>
1.30 wiz 8065: <h3 class="title"><a name=
1.38 dillo 8066: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 8067: an internal list into an external list</h3>
1.27 rillig 8068: </div>
8069: </div>
8070: </div>
8071: <pre class="programlisting">
1.51 rillig 8072: EXT_LIST= # empty
8073: .for i in ${INT_LIST}
8074: EXT_LIST+= ${i:Q}""
8075: .endfor
1.27 rillig 8076: </pre>
8077:
8078: <p>This code converts the internal list <code class=
8079: "varname">INT_LIST</code> into the external list
8080: <code class="varname">EXT_LIST</code>. As the elements
8081: of an internal list are unquoted they must be quoted
8082: here. The reason for appending <code class=
8083: "varname">""</code> is explained below.</p>
8084: </div>
1.1 grant 8085:
1.67 hubertf 8086: <div class="sect2" lang="en">
1.27 rillig 8087: <div class="titlepage">
1.1 grant 8088: <div>
1.27 rillig 8089: <div>
1.30 wiz 8090: <h3 class="title"><a name=
1.38 dillo 8091: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 8092: variables to a shell command</h3>
1.27 rillig 8093: </div>
1.1 grant 8094: </div>
8095: </div>
1.27 rillig 8096: <pre class="programlisting">
1.51 rillig 8097: STRING= foo bar < > * `date` $$HOME ' "
8098: EXT_LIST= string=${STRING:Q} x=second\ item
1.27 rillig 8099:
1.51 rillig 8100: all:
8101: echo ${STRING} # 1
8102: echo "${STRING}" # 2
8103: echo "${STRING:Q}" # 3
8104: echo ${STRING:Q} # 4
8105: echo x${STRING:Q} | sed 1s,.,, # 5
8106: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27 rillig 8107: </pre>
8108:
8109: <p>Example 1 leads to a syntax error in the shell, as
8110: the characters are just copied.</p>
8111:
8112: <p>Example 2 leads to a syntax error too, and if you
8113: leave out the last " character from <code class=
8114: "varname">${STRING}</code>, <a href=
8115: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
8116: <span class="citerefentry"><span class=
8117: "refentrytitle">date</span>(1)</span></a> will be
8118: executed. The <code class="varname">$HOME</code> shell
8119: variable would be evaluated, too.</p>
8120:
8121: <p>Example 3 outputs each space character preceded by a
8122: backslash (or not), depending on the implementation of
8123: the <a href=
8124: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
8125: <span class="citerefentry"><span class=
8126: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 8127:
1.27 rillig 8128: <p>Example 4 handles correctly every string that does
8129: not start with a dash. In that case, the result depends
8130: on the implementation of the <a href=
8131: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
8132: <span class="citerefentry"><span class=
8133: "refentrytitle">echo</span>(1)</span></a> command. As
8134: long as you can guarantee that your input does not
1.47 reed 8135: start with a dash, this form is appropriate.</p>
1.1 grant 8136:
1.27 rillig 8137: <p>Example 5 handles even the case of a leading dash
8138: correctly.</p>
1.1 grant 8139:
1.27 rillig 8140: <p>The <code class="varname">EXT_LIST</code> does not
1.47 reed 8141: need to be quoted because the quoting has already been
1.27 rillig 8142: done when adding elements to the list.</p>
1.1 grant 8143:
1.27 rillig 8144: <p>As internal lists shall not be passed to the shell,
8145: there is no example for it.</p>
1.1 grant 8146: </div>
8147:
1.67 hubertf 8148: <div class="sect2" lang="en">
1.27 rillig 8149: <div class="titlepage">
1.1 grant 8150: <div>
1.27 rillig 8151: <div>
1.67 hubertf 8152: <h3 class="title"><a name=
1.38 dillo 8153: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 8154: guideline</h3>
8155: </div>
1.1 grant 8156: </div>
8157: </div>
8158:
1.27 rillig 8159: <p>There are many possible sources of wrongly quoted
8160: variables. This section lists some of the commonly
8161: known ones.</p>
1.1 grant 8162:
1.27 rillig 8163: <div class="itemizedlist">
8164: <ul type="disc">
8165: <li>
8166: <p>Whenever you use the value of a list, think
8167: about what happens to leading or trailing
8168: whitespace. If the list is a well-formed shell
1.47 reed 8169: expression, you can apply the <code class=
1.27 rillig 8170: "varname">:M*</code> modifier to strip leading
8171: and trailing whitespace from each word. The
8172: <code class="varname">:M</code> operator first
8173: splits its argument according to the rules of the
8174: shell, and then creates a new list consisting of
8175: all words that match the shell glob expression
8176: <code class="varname">*</code>, that is: all. One
8177: class of situations where this is needed is when
8178: adding a variable like <code class=
8179: "varname">CPPFLAGS</code> to <code class=
8180: "varname">CONFIGURE_ARGS</code>. If the configure
1.47 reed 8181: script invokes other configure scripts, it strips
1.27 rillig 8182: the leading and trailing whitespace from the
8183: variable and then passes it to the other
8184: configure scripts. But these configure scripts
8185: expect the (child) <code class=
8186: "varname">CPPFLAGS</code> variable to be the same
8187: as the parent <code class=
8188: "varname">CPPFLAGS</code>. That's why we better
8189: pass the <code class="varname">CPPFLAGS</code>
8190: value properly trimmed. And here is how we do
8191: it:</p>
8192: <pre class="programlisting">
1.51 rillig 8193: CPPFLAGS= # empty
8194: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
8195: CPPFLAGS+= ${MY_CPPFLAGS}
8196:
8197: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
8198:
8199: all:
8200: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
8201: echo x${CONFIGURE_ARGS}x # properly trimmed
1.27 rillig 8202: </pre>
8203: </li>
1.1 grant 8204:
1.27 rillig 8205: <li>
8206: <p>The example above contains one bug: The
8207: <code class="varname">${PREFIX}</code> is a
8208: properly quoted shell expression, but there is
8209: the C compiler after it, which also expects a
8210: properly quoted string (this time in C syntax).
8211: The version above is therefore only correct if
8212: <code class="varname">${PREFIX}</code> does not
8213: have embedded backslashes or double quotes. If
8214: you want to allow these, you have to add another
8215: layer of quoting to each variable that is used as
8216: a C string literal. You cannot use the
8217: <code class="varname">:Q</code> operator for it,
8218: as this operator only works for the shell.</p>
8219: </li>
1.1 grant 8220:
1.27 rillig 8221: <li>
1.47 reed 8222: <p>Whenever a variable can be empty, the
1.27 rillig 8223: <code class="varname">:Q</code> operator can have
8224: surprising results. Here are two completely
8225: different cases which can be solved with the same
8226: trick.</p>
8227: <pre class="programlisting">
1.51 rillig 8228: EMPTY= # empty
8229: empty_test:
8230: for i in a ${EMPTY:Q} c; do \
8231: echo "$$i"; \
8232: done
8233:
8234: for_test:
8235: .for i in a:\ a:\test.txt
8236: echo ${i:Q}
8237: echo "foo"
8238: .endfor
1.1 grant 8239: </pre>
8240:
1.27 rillig 8241: <p>The first example will only print two of the
8242: three lines we might have expected. This is
8243: because <code class="varname">${EMPTY:Q}</code>
8244: expands to the empty string, which the shell
8245: cannot see. The workaround is to write
8246: <code class="varname">${EMPTY:Q}""</code>. This
8247: pattern can be often found as <code class=
8248: "varname">${TEST} -z ${VAR:Q}</code> or as
8249: <code class="varname">${TEST} -f
8250: ${FNAME:Q}</code> (both of these are wrong).</p>
8251:
8252: <p>The second example will only print three lines
8253: instead of four. The first line looks like
8254: <code class="varname">a:\ echo foo</code>. This
8255: is because the backslash of the value
8256: <code class="varname">a:\</code> is interpreted
8257: as a line-continuation by <a href=
8258: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8259: <span class="citerefentry"><span class=
8260: "refentrytitle">make</span>(1)</span></a>, which
8261: makes the second line the arguments of the
8262: <a href=
8263: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
8264: <span class="citerefentry"><span class=
8265: "refentrytitle">echo</span>(1)</span></a> command
8266: from the first line. To avoid this, write
8267: <code class="varname">${i:Q}""</code>.</p>
8268: </li>
8269: </ul>
8270: </div>
1.1 grant 8271: </div>
8272:
1.67 hubertf 8273: <div class="sect2" lang="en">
1.27 rillig 8274: <div class="titlepage">
1.1 grant 8275: <div>
1.27 rillig 8276: <div>
1.30 wiz 8277: <h3 class="title"><a name=
1.38 dillo 8278: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 8279: for a bug in BSD Make</h3>
1.27 rillig 8280: </div>
1.1 grant 8281: </div>
8282: </div>
8283:
1.27 rillig 8284: <p>The pkgsrc bmake program does not handle the
8285: following assignment correctly. In case <code class=
8286: "varname">_othervar_</code> contains a ``-'' character,
8287: one of the closing braces is included in <code class=
8288: "varname">${VAR}</code> after this code executes.</p>
8289: <pre class="programlisting">
1.51 rillig 8290: VAR:= ${VAR:N${_othervar_:C/-//}}
1.1 grant 8291: </pre>
8292:
1.27 rillig 8293: <p>For a more complex code snippet and a workaround,
8294: see the package <a xmlns=
8295: "http://www.w3.org/TR/xhtml1/transitional" href=
8296: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45 wiz 8297: target="_top"><code xmlns="" class=
8298: "filename">regress/make-quoting</code></a>, testcase
1.27 rillig 8299: <code class="varname">bug1</code>.</p>
1.1 grant 8300: </div>
8301: </div>
8302: </div>
8303:
1.67 hubertf 8304: <div class="chapter" lang="en">
1.1 grant 8305: <div class="titlepage">
8306: <div>
8307: <div>
1.67 hubertf 8308: <h2 class="title"><a name=
1.38 dillo 8309: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 8310: </div>
8311: </div>
8312: </div>
8313:
8314: <div class="toc">
8315: <p><b>Table of Contents</b></p>
8316:
8317: <dl>
1.38 dillo 8318: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 8319: ID</a></span></dt>
8320:
1.30 wiz 8321: <dt><span class="sect1"><a href=
1.38 dillo 8322: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 8323: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8324: class="filename">PLIST</code>
1.14 xtraeme 8325: generation</a></span></dt>
1.1 grant 8326:
1.38 dillo 8327: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 8328: Tweaking output of <span><strong class="command">make
8329: print-PLIST</strong></span></a></span></dt>
1.1 grant 8330:
1.38 dillo 8331: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 8332: Variable substitution in PLIST</a></span></dt>
8333:
1.30 wiz 8334: <dt><span class="sect1"><a href=
1.48 dillo 8335: "#manpage-compression">10.5. Man page
8336: compression</a></span></dt>
1.1 grant 8337:
1.38 dillo 8338: <dt><span class="sect1"><a href=
8339: "#using-PLIST_SRC">10.6. Changing PLIST source with
8340: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 8341:
1.30 wiz 8342: <dt><span class="sect1"><a href=
1.47 reed 8343: "#platform-specific-plist">10.7. Platform-specific and
1.30 wiz 8344: differing PLISTs</a></span></dt>
1.1 grant 8345:
1.38 dillo 8346: <dt><span class="sect1"><a href=
8347: "#faq.common-dirs">10.8. Sharing directories between
8348: packages</a></span></dt>
1.1 grant 8349: </dl>
8350: </div>
8351:
1.45 wiz 8352: <p>The <code xmlns=
8353: "http://www.w3.org/TR/xhtml1/transitional" class=
8354: "filename">PLIST</code> file contains a package's
8355: “<span class="quote">packing list</span>”, i.e.
8356: a list of files that belong to the package (relative to the
8357: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8358: class="filename">${PREFIX}</code> directory it's been
8359: installed in) plus some additional statements - see the
8360: <a href=
1.1 grant 8361: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
8362: <span class="citerefentry"><span class=
1.47 reed 8363: "refentrytitle">pkg_create</span>(1)</span></a> man page
8364: for a full list. This chapter addresses some issues that
8365: need attention when dealing with the <code xmlns=
1.45 wiz 8366: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8367: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 8368:
1.67 hubertf 8369: <div class="sect1" lang="en">
1.1 grant 8370: <div class="titlepage">
8371: <div>
8372: <div>
8373: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 8374: "rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 8375: </div>
8376: </div>
8377: </div>
8378:
8379: <p>Be sure to add a RCS ID line as the first thing in any
1.45 wiz 8380: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8381: class="filename">PLIST</code> file you write:</p>
1.1 grant 8382: <pre class="programlisting">
1.51 rillig 8383: @comment $NetBSD$
1.1 grant 8384: </pre>
8385: </div>
8386:
1.67 hubertf 8387: <div class="sect1" lang="en">
1.1 grant 8388: <div class="titlepage">
8389: <div>
8390: <div>
8391: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8392: "automatic-plist-generation"></a>10.2. Semi-automatic
1.45 wiz 8393: <code xmlns=
8394: "http://www.w3.org/TR/xhtml1/transitional" class=
8395: "filename">PLIST</code> generation</h2>
1.1 grant 8396: </div>
8397: </div>
8398: </div>
8399:
1.14 xtraeme 8400: <p>You can use the <span><strong class="command">make
8401: print-PLIST</strong></span> command to output a PLIST
8402: that matches any new files since the package was
8403: extracted. See <a href="#build.helpful-targets" title=
1.56 rillig 8404: "14.16. Other helpful targets">Section 14.16,
1.1 grant 8405: “Other helpful targets”</a> for more
8406: information on this target.</p>
8407: </div>
8408:
1.67 hubertf 8409: <div class="sect1" lang="en">
1.1 grant 8410: <div class="titlepage">
8411: <div>
8412: <div>
8413: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8414: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 8415: <span><strong class="command">make
8416: print-PLIST</strong></span></h2>
1.1 grant 8417: </div>
8418: </div>
8419: </div>
8420:
8421: <p>If you have used any of the *-dirs packages, as
8422: explained in <a href="#faq.common-dirs" title=
1.38 dillo 8423: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 8424: “Sharing directories between packages”</a>,
1.14 xtraeme 8425: you may have noticed that <span><strong class=
8426: "command">make print-PLIST</strong></span> outputs a set
8427: of <code class="varname">@comment</code>s instead of real
8428: <code class="varname">@dirrm</code> lines. You can also
8429: do this for specific directories and files, so that the
8430: results of that command are very close to reality. This
8431: helps <span class="emphasis"><em>a lot</em></span> during
8432: the update of packages.</p>
8433:
8434: <p>The <code class="varname">PRINT_PLIST_AWK</code>
8435: variable takes a set of AWK patterns and actions that are
8436: used to filter the output of print-PLIST. You can
8437: <span class="emphasis"><em>append</em></span> any chunk
8438: of AWK scripting you like to it, but be careful with
1.1 grant 8439: quoting.</p>
8440:
1.45 wiz 8441: <p>For example, to get all files inside the <code xmlns=
8442: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8443: "filename">libdata/foo</code> directory removed from the
1.1 grant 8444: resulting PLIST:</p>
8445: <pre class="programlisting">
1.51 rillig 8446: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 grant 8447: </pre>
8448:
1.14 xtraeme 8449: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 8450: lines referring to a specific (shared) directory
1.14 xtraeme 8451: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 8452: <pre class="programlisting">
1.51 rillig 8453: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1 grant 8454: </pre>
8455: </div>
8456:
1.67 hubertf 8457: <div class="sect1" lang="en">
1.1 grant 8458: <div class="titlepage">
8459: <div>
8460: <div>
8461: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8462: "plist.misc"></a>10.4. Variable substitution
8463: in PLIST</h2>
1.1 grant 8464: </div>
8465: </div>
8466: </div>
8467:
8468: <p>A number of variables are substituted automatically in
8469: PLISTs when a package is installed on a system. This
8470: includes the following variables:</p>
8471:
8472: <div class="variablelist">
8473: <dl>
1.14 xtraeme 8474: <dt><span class="term"><code class=
8475: "varname">${MACHINE_ARCH}</code>, <code class=
8476: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 8477:
8478: <dd>
8479: <p>Some packages like emacs and perl embed
8480: information about which architecture they were
8481: built on into the pathnames where they install
1.47 reed 8482: their files. To handle this case, PLIST will be
1.1 grant 8483: preprocessed before actually used, and the symbol
1.14 xtraeme 8484: “<span class="quote"><code class=
8485: "varname">${MACHINE_ARCH}</code></span>” will
8486: be replaced by what <span><strong class=
8487: "command">uname -p</strong></span> gives. The same
8488: is done if the string <code class=
8489: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
8490: PLIST somewhere - use this on packages that have
1.47 reed 8491: GNU autoconf-created configure scripts.</p>
1.1 grant 8492:
8493: <div class="note" style=
8494: "margin-left: 0.5in; margin-right: 0.5in;">
8495: <h3 class="title">Legacy note</h3>
8496:
8497: <p>There used to be a symbol “<span class=
1.14 xtraeme 8498: "quote"><code class=
8499: "varname">$ARCH</code></span>” that was
8500: replaced by the output of <span><strong class=
8501: "command">uname -m</strong></span>, but that's no
1.1 grant 8502: longer supported and has been removed.</p>
8503: </div>
8504: </dd>
8505:
1.14 xtraeme 8506: <dt><span class="term"><code class=
8507: "varname">${OPSYS}</code>, <code class=
8508: "varname">${LOWER_OPSYS}</code>, <code class=
8509: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 8510:
8511: <dd>
8512: <p>Some packages want to embed the OS name and
8513: version into some paths. To do this, use these
1.45 wiz 8514: variables in the <code xmlns=
8515: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8516: "filename">PLIST</code>:</p>
1.1 grant 8517:
8518: <div class="itemizedlist">
8519: <ul type="disc">
8520: <li>
1.14 xtraeme 8521: <p><code class="varname">${OPSYS}</code> -
8522: output of “<span class=
8523: "quote"><span><strong class="command">uname
8524: -s</strong></span></span>”</p>
1.1 grant 8525: </li>
8526:
8527: <li>
1.14 xtraeme 8528: <p><code class=
8529: "varname">${LOWER_OPSYS}</code> - lowercase
8530: common name (eg. “<span class=
8531: "quote">solaris</span>”)</p>
1.1 grant 8532: </li>
8533:
8534: <li>
1.14 xtraeme 8535: <p><code class="varname">${OS_VERSION}</code>
8536: - “<span class=
8537: "quote"><span><strong class="command">uname
8538: -r</strong></span></span>”</p>
1.1 grant 8539: </li>
8540: </ul>
8541: </div>
8542: </dd>
8543: </dl>
8544: </div>
8545:
8546: <p>For a complete list of values which are replaced by
1.45 wiz 8547: default, please look in <code xmlns=
8548: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8549: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 8550: "emphasis"><em>PLIST_SUBST</em></span>).</p>
8551:
8552: <p>If you want to change other variables not listed
8553: above, you can add variables and their expansions to this
1.14 xtraeme 8554: variable in the following way, similar to <code class=
8555: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 8556: "#components.optional" title=
1.38 dillo 8557: "8.5. Optional files">Section 8.5,
1.1 grant 8558: “Optional files”</a>):</p>
8559: <pre class="programlisting">
1.51 rillig 8560: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 grant 8561: </pre>
8562:
8563: <p>This replaces all occurrences of “<span class=
8564: "quote">${SOMEVAR}</span>” in the PLIST with
8565: “<span class="quote">somevalue</span>”.</p>
8566: </div>
8567:
1.67 hubertf 8568: <div class="sect1" lang="en">
1.1 grant 8569: <div class="titlepage">
8570: <div>
8571: <div>
8572: <h2 class="title" style="clear: both"><a name=
1.48 dillo 8573: "manpage-compression"></a>10.5. Man page
8574: compression</h2>
1.1 grant 8575: </div>
8576: </div>
8577: </div>
8578:
1.47 reed 8579: <p>Man pages should be installed in compressed form if
1.45 wiz 8580: <code class="varname">MANZ</code> is set (in <code xmlns=
8581: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8582: "filename">bsd.own.mk</code>), and uncompressed
1.45 wiz 8583: otherwise. To handle this in the <code xmlns=
8584: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8585: "filename">PLIST</code> file, the suffix
8586: “<span class="quote">.gz</span>” is
1.47 reed 8587: appended/removed automatically for man pages according to
1.14 xtraeme 8588: <code class="varname">MANZ</code> and <code class=
8589: "varname">MANCOMPRESSED</code> being set or not, see
1.45 wiz 8590: above for details. This modification of the <code xmlns=
8591: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8592: "filename">PLIST</code> file is done on a copy of it, not
1.45 wiz 8593: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8594: class="filename">PLIST</code> itself.</p>
1.1 grant 8595: </div>
8596:
1.67 hubertf 8597: <div class="sect1" lang="en">
1.1 grant 8598: <div class="titlepage">
8599: <div>
8600: <div>
8601: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8602: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 8603: source with <code class=
1.14 xtraeme 8604: "varname">PLIST_SRC</code></h2>
1.1 grant 8605: </div>
8606: </div>
8607: </div>
8608:
1.14 xtraeme 8609: <p>To use one or more files as source for the
1.45 wiz 8610: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8611: class="filename">PLIST</code> used in generating the
8612: binary package, set the variable <code class=
1.14 xtraeme 8613: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 8614: The files are later concatenated using <a href=
8615: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
8616: <span class="citerefentry"><span class=
8617: "refentrytitle">cat</span>(1)</span></a>, and order of
8618: things is important.</p>
1.1 grant 8619: </div>
8620:
1.67 hubertf 8621: <div class="sect1" lang="en">
1.1 grant 8622: <div class="titlepage">
8623: <div>
8624: <div>
8625: <h2 class="title" style="clear: both"><a name=
1.47 reed 8626: "platform-specific-plist"></a>10.7. Platform-specific
8627: and differing PLISTs</h2>
1.1 grant 8628: </div>
8629: </div>
8630: </div>
8631:
8632: <p>Some packages decide to install a different set of
8633: files based on the operating system being used. These
8634: differences can be automatically handled by using the
8635: following files:</p>
8636:
8637: <div class="itemizedlist">
8638: <ul type="disc">
8639: <li>
1.45 wiz 8640: <p><code xmlns=
8641: "http://www.w3.org/TR/xhtml1/transitional" class=
8642: "filename">PLIST.common</code></p>
1.1 grant 8643: </li>
8644:
8645: <li>
1.45 wiz 8646: <p><code xmlns=
8647: "http://www.w3.org/TR/xhtml1/transitional" class=
8648: "filename">PLIST.${OPSYS}</code></p>
1.1 grant 8649: </li>
8650:
8651: <li>
1.45 wiz 8652: <p><code xmlns=
8653: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 8654: "filename">PLIST.${MACHINE_ARCH}</code></p>
8655: </li>
8656:
8657: <li>
1.45 wiz 8658: <p><code xmlns=
8659: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 8660: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
8661: </li>
8662:
8663: <li>
1.45 wiz 8664: <p><code xmlns=
8665: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8666: "filename">PLIST.common_end</code></p>
1.1 grant 8667: </li>
8668: </ul>
8669: </div>
8670: </div>
8671:
1.67 hubertf 8672: <div class="sect1" lang="en">
1.1 grant 8673: <div class="titlepage">
8674: <div>
8675: <div>
8676: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8677: "faq.common-dirs"></a>10.8. Sharing
8678: directories between packages</h2>
1.1 grant 8679: </div>
8680: </div>
8681: </div>
8682:
8683: <p>A “<span class="quote">shared
8684: directory</span>” is a directory where multiple
8685: (and unrelated) packages install files. These directories
8686: are problematic because you have to add special tricks in
8687: the PLIST to conditionally remove them, or have some
8688: centralized package handle them.</p>
8689:
8690: <p>Within pkgsrc, you'll find both approaches. If a
8691: directory is shared by a few unrelated packages, it's
8692: often not worth to add an extra package to remove it.
8693: Therefore, one simply does:</p>
8694: <pre class="programlisting">
1.51 rillig 8695: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
1.1 grant 8696: </pre>
8697:
8698: <p>in the PLISTs of all affected packages, instead of the
8699: regular "@dirrm" line.</p>
8700:
8701: <p>However, if the directory is shared across many
8702: packages, two different solutions are available:</p>
8703:
8704: <div class="orderedlist">
8705: <ol type="1">
8706: <li>
8707: <p>If the packages have a common dependency, the
8708: directory can be removed in that. For example, see
8709: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8710: href=
8711: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45 wiz 8712: target="_top"><code xmlns="" class=
8713: "filename">textproc/scrollkeeper</code></a>, which
8714: removes the shared directory <code xmlns=
8715: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 8716: "filename">share/omf</code>.</p>
1.1 grant 8717: </li>
8718:
8719: <li>
8720: <p>If the packages using the directory are not
8721: related at all (they have no common dependencies),
8722: a *-dirs package is used.</p>
8723: </li>
8724: </ol>
8725: </div>
8726:
8727: <p>From now on, we'll discuss the second solution. To get
8728: an idea of the *-dirs packages available, issue:</p>
8729: <pre class="programlisting">
1.51 rillig 8730: <code class="prompt">%</code> cd .../pkgsrc
8731: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 8732: </pre>
8733:
8734: <p>Their use from other packages is very simple. The
1.14 xtraeme 8735: <code class="varname">USE_DIRS</code> variable takes a
8736: list of package names (without the “<span class=
1.1 grant 8737: "quote">-dirs</span>” part) together with the
8738: required version number (always pick the latest one when
1.34 wiz 8739: writing new packages).</p>
1.1 grant 8740:
8741: <p>For example, if a package installs files under
1.45 wiz 8742: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8743: class="filename">share/applications</code>, it should
8744: have the following line in it:</p>
1.1 grant 8745: <pre class="programlisting">
1.51 rillig 8746: USE_DIRS+= xdg-1.1
1.1 grant 8747: </pre>
8748:
1.14 xtraeme 8749: <p>After regenerating the PLIST using
8750: <span><strong class="command">make
8751: print-PLIST</strong></span>, you should get the right
8752: (commented out) lines.</p>
1.1 grant 8753:
1.47 reed 8754: <p>Note that even if your package is using <code xmlns=
1.45 wiz 8755: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8756: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 8757: *-x11-dirs packages. Just specify the name without that
1.45 wiz 8758: part and pkgsrc (in particular, <code xmlns=
8759: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8760: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 8761: </div>
8762: </div>
8763:
1.67 hubertf 8764: <div class="chapter" lang="en">
1.1 grant 8765: <div class="titlepage">
8766: <div>
8767: <div>
1.67 hubertf 8768: <h2 class="title"><a name=
1.38 dillo 8769: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 8770: methodology</h2>
8771: </div>
8772: </div>
8773: </div>
8774:
8775: <div class="toc">
8776: <p><b>Table of Contents</b></p>
8777:
8778: <dl>
1.30 wiz 8779: <dt><span class="sect1"><a href=
1.38 dillo 8780: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 8781: to use buildlink3</a></span></dt>
1.1 grant 8782:
1.30 wiz 8783: <dt><span class="sect1"><a href=
1.45 wiz 8784: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
8785: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8786: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 8787:
8788: <dd>
8789: <dl>
1.25 rillig 8790: <dt><span class="sect2"><a href=
1.38 dillo 8791: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 8792: buildlink3.mk file</a></span></dt>
1.1 grant 8793:
1.25 rillig 8794: <dt><span class="sect2"><a href=
1.38 dillo 8795: "#updating-buildlink-depends">11.2.2. Updating
1.72 rillig 8796: <code class=
8797: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 8798: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 8799: <code xmlns=
8800: "http://www.w3.org/TR/xhtml1/transitional" class=
8801: "filename">buildlink3.mk</code>
1.1 grant 8802: files</a></span></dt>
8803: </dl>
8804: </dd>
8805:
1.30 wiz 8806: <dt><span class="sect1"><a href=
1.45 wiz 8807: "#writing-builtin.mk">11.3. Writing <code xmlns=
8808: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8809: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 8810:
8811: <dd>
8812: <dl>
1.25 rillig 8813: <dt><span class="sect2"><a href=
1.38 dillo 8814: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 8815: <code xmlns=
8816: "http://www.w3.org/TR/xhtml1/transitional" class=
8817: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 8818:
1.25 rillig 8819: <dt><span class="sect2"><a href=
1.38 dillo 8820: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 8821: preferences for native or pkgsrc
8822: software</a></span></dt>
1.1 grant 8823: </dl>
8824: </dd>
8825: </dl>
8826: </div>
8827:
8828: <p>Buildlink is a framework in pkgsrc that controls what
8829: headers and libraries are seen by a package's configure and
8830: build processes. This is implemented in a two step
8831: process:</p>
8832:
8833: <div class="orderedlist">
8834: <ol type="1">
8835: <li>
8836: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 8837: into <code class="varname">BUILDLINK_DIR</code>,
8838: which by default is a subdirectory of <code class=
8839: "varname">WRKDIR</code>.</p>
1.1 grant 8840: </li>
8841:
8842: <li>
8843: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 8844: the normal compiler tools that translate <code class=
8845: "option">-I${LOCALBASE}/include</code> and
8846: <code class="option">-L${LOCALBASE}/lib</code> into
8847: references to <code class=
8848: "varname">BUILDLINK_DIR</code>. The wrapper scripts
8849: also make native compiler on some operating systems
8850: look like GCC, so that packages that expect GCC won't
8851: require modifications to build with those native
8852: compilers.</p>
1.1 grant 8853: </li>
8854: </ol>
8855: </div>
8856:
8857: <p>This normalizes the environment in which a package is
8858: built so that the package may be built consistently despite
8859: what other software may be installed. Please note that the
1.45 wiz 8860: normal system header and library paths, e.g. <code xmlns=
8861: "http://www.w3.org/TR/xhtml1/transitional" class=
8862: "filename">/usr/include</code>, <code xmlns=
8863: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8864: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 8865: buildlink3 is designed to insulate the package build from
8866: non-system-supplied software.</p>
8867:
1.67 hubertf 8868: <div class="sect1" lang="en">
1.1 grant 8869: <div class="titlepage">
8870: <div>
8871: <div>
8872: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8873: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 8874: packages to use buildlink3</h2>
1.1 grant 8875: </div>
8876: </div>
8877: </div>
8878:
8879: <p>The process of converting packages to use the
8880: buildlink3 framework (“<span class=
8881: "quote">bl3ifying</span>”) is fairly
8882: straightforward. The things to keep in mind are:</p>
8883:
8884: <div class="orderedlist">
8885: <ol type="1">
8886: <li>
8887: <p>Ensure that the build always calls the wrapper
8888: scripts instead of the actual toolchain. Some
8889: packages are tricky, and the only way to know for
1.45 wiz 8890: sure is the check <code xmlns=
8891: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8892: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 8893: wrappers are being invoked.</p>
8894: </li>
8895:
8896: <li>
1.14 xtraeme 8897: <p>Don't override <code class=
8898: "varname">PREFIX</code> from within the package
8899: Makefile, e.g. Java VMs, standalone shells, etc.,
1.45 wiz 8900: because the code to symlink files into <code xmlns=
8901: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8902: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 8903: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 8904: <em class=
8905: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 8906: </li>
8907:
8908: <li>
8909: <p>Remember that <span class=
1.45 wiz 8910: "emphasis"><em>only</em></span> the <code xmlns=
8911: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8912: "filename">buildlink3.mk</code> files that you list
1.1 grant 8913: in a package's Makefile are added as dependencies
8914: for that package.</p>
8915: </li>
8916: </ol>
8917: </div>
8918:
8919: <p>If a dependency on a particular package is required
8920: for its libraries and headers, then we replace:</p>
8921: <pre class="programlisting">
1.51 rillig 8922: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 8923: </pre>
8924:
8925: <p>with</p>
8926: <pre class="programlisting">
1.51 rillig 8927: .include "../../category/foo/buildlink3.mk"
1.1 grant 8928: </pre>
8929:
1.47 reed 8930: <p>The buildlink3.mk files usually define the required
8931: dependencies. If you need a newer version of the
8932: dependency when using buildlink3.mk files, then you can
8933: define it in your Makefile; for example:</p>
8934: <pre class="programlisting">
1.72 rillig 8935: BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
1.51 rillig 8936: .include "../../category/foo/buildlink3.mk"
1.47 reed 8937: </pre>
8938:
1.45 wiz 8939: <p>There are several <code xmlns=
8940: "http://www.w3.org/TR/xhtml1/transitional" class=
8941: "filename">buildlink3.mk</code> files in <code xmlns=
8942: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8943: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 8944: issues:</p>
8945:
8946: <div class="itemizedlist">
8947: <ul type="disc">
8948: <li>
1.45 wiz 8949: <p><code xmlns=
8950: "http://www.w3.org/TR/xhtml1/transitional" class=
8951: "filename">bdb.buildlink3.mk</code> chooses either
8952: the native or a pkgsrc Berkeley DB implementation
8953: based on the values of <code class=
1.14 xtraeme 8954: "varname">BDB_ACCEPTED</code> and <code class=
8955: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 8956: </li>
8957:
8958: <li>
1.45 wiz 8959: <p><code xmlns=
8960: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 8961: "filename">curses.buildlink3.mk</code>: If the
1.14 xtraeme 8962: system comes with neither Curses nor NCurses, this
8963: will take care to install the <a xmlns=
8964: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 8965: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45 wiz 8966: target="_top"><code xmlns="" class=
8967: "filename">devel/ncurses</code></a> package.</p>
1.1 grant 8968: </li>
8969:
8970: <li>
1.45 wiz 8971: <p><code xmlns=
8972: "http://www.w3.org/TR/xhtml1/transitional" class=
8973: "filename">krb5.buildlink3.mk</code> uses the value
8974: of <code class="varname">KRB5_ACCEPTED</code> to
8975: choose between adding a dependency on Heimdal or
8976: MIT-krb5 for packages that require a Kerberos 5
1.1 grant 8977: implementation.</p>
8978: </li>
8979:
8980: <li>
1.45 wiz 8981: <p><code xmlns=
8982: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8983: "filename">motif.buildlink3.mk</code> checks for a
8984: system-provided Motif installation or adds a
8985: dependency on <a xmlns=
1.1 grant 8986: "http://www.w3.org/TR/xhtml1/transitional" href=
8987: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45 wiz 8988: target="_top"><code xmlns="" class=
8989: "filename">x11/lesstif</code></a> or <a xmlns=
1.20 ben 8990: "http://www.w3.org/TR/xhtml1/transitional" href=
8991: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45 wiz 8992: target="_top"><code xmlns="" class=
1.47 reed 8993: "filename">x11/openmotif</code></a>.</p>
1.1 grant 8994: </li>
8995:
8996: <li>
1.45 wiz 8997: <p><code xmlns=
8998: "http://www.w3.org/TR/xhtml1/transitional" class=
1.71 wiz 8999: "filename">oss.buildlink3.mk</code> defines several
9000: variables that may be used by packages that use the
9001: Open Sound System (OSS) API.</p>
1.1 grant 9002: </li>
9003:
9004: <li>
1.45 wiz 9005: <p><code xmlns=
9006: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9007: "filename">pgsql.buildlink3.mk</code> will accept
9008: either Postgres 7.3 or 7.4, whichever is found
9009: installed. See the file for more information.</p>
1.1 grant 9010: </li>
9011:
9012: <li>
1.45 wiz 9013: <p><code xmlns=
9014: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9015: "filename">pthread.buildlink3.mk</code> uses the
9016: value of <code class="varname">PTHREAD_OPTS</code>
9017: and checks for native pthreads or adds a dependency
9018: on <a xmlns=
1.1 grant 9019: "http://www.w3.org/TR/xhtml1/transitional" href=
9020: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45 wiz 9021: target="_top"><code xmlns="" class=
1.47 reed 9022: "filename">devel/pth</code></a> as needed.</p>
1.1 grant 9023: </li>
9024:
9025: <li>
1.45 wiz 9026: <p><code xmlns=
9027: "http://www.w3.org/TR/xhtml1/transitional" class=
9028: "filename">xaw.buildlink3.mk</code> uses the value
9029: of <code class="varname">XAW_TYPE</code> to choose
9030: a particular Athena widgets library.</p>
1.1 grant 9031: </li>
9032: </ul>
9033: </div>
9034:
1.45 wiz 9035: <p>The comments in those <code xmlns=
9036: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9037: "filename">buildlink3.mk</code> files provide a more
1.1 grant 9038: complete description of how to use them properly.</p>
9039: </div>
9040:
1.67 hubertf 9041: <div class="sect1" lang="en">
1.1 grant 9042: <div class="titlepage">
9043: <div>
9044: <div>
9045: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9046: "creating-buildlink3.mk"></a>11.2. Writing
1.45 wiz 9047: <code xmlns=
9048: "http://www.w3.org/TR/xhtml1/transitional" class=
9049: "filename">buildlink3.mk</code> files</h2>
1.1 grant 9050: </div>
9051: </div>
9052: </div>
9053:
1.45 wiz 9054: <p>A package's <code xmlns=
9055: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9056: "filename">buildlink3.mk</code> file is included by
9057: Makefiles to indicate the need to compile and link
9058: against header files and libraries provided by the
1.45 wiz 9059: package. A <code xmlns=
9060: "http://www.w3.org/TR/xhtml1/transitional" class=
9061: "filename">buildlink3.mk</code> file should always
9062: provide enough information to add the correct type of
9063: dependency relationship and include any other
9064: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9065: class="filename">buildlink3.mk</code> files that it needs
9066: to find headers and libraries that it needs in turn.</p>
1.1 grant 9067:
1.45 wiz 9068: <p>To generate an initial <code xmlns=
9069: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9070: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 9071: Rene Hexel's <a xmlns=
9072: "http://www.w3.org/TR/xhtml1/transitional" href=
9073: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45 wiz 9074: target="_top"><code xmlns="" class=
9075: "filename">pkgtools/createbuildlink</code></a> package is
1.20 ben 9076: highly recommended. For most packages, the following
9077: command will generate a good starting point for
1.45 wiz 9078: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9079: class="filename">buildlink3.mk</code> files:</p>
1.1 grant 9080: <pre class="screen">
1.14 xtraeme 9081: <code class="prompt">%</code> <strong class=
9082: "userinput"><code>cd pkgsrc/<em class=
9083: "replaceable"><code>category</code></em>/<em class=
9084: "replaceable"><code>pkgdir</code></em>
9085: <code class=
1.49 rillig 9086: "prompt">%</code> createbuildlink >buildlink3.mk</code></strong>
1.1 grant 9087: </pre>
9088:
1.67 hubertf 9089: <div class="sect2" lang="en">
1.1 grant 9090: <div class="titlepage">
9091: <div>
9092: <div>
1.67 hubertf 9093: <h3 class="title"><a name=
9094: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 9095: buildlink3.mk file</h3>
1.1 grant 9096: </div>
9097: </div>
9098: </div>
9099:
1.45 wiz 9100: <p>The following real-life example <code xmlns=
9101: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9102: "filename">buildlink3.mk</code> is taken from
1.45 wiz 9103: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9104: class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 9105: <pre class="programlisting">
1.51 rillig 9106: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 9107:
1.51 rillig 9108: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
9109: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
1.1 grant 9110:
1.51 rillig 9111: .if !empty(BUILDLINK_DEPTH:M+)
9112: BUILDLINK_DEPENDS+= tiff
9113: .endif
1.1 grant 9114:
1.51 rillig 9115: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
9116: BUILDLINK_PACKAGES+= tiff
1.1 grant 9117:
1.51 rillig 9118: .if !empty(TIFF_BUILDLINK3_MK:M+)
1.72 rillig 9119: BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
1.51 rillig 9120: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
9121: .endif # TIFF_BUILDLINK3_MK
1.1 grant 9122:
1.51 rillig 9123: .include "../../devel/zlib/buildlink3.mk"
9124: .include "../../graphics/jpeg/buildlink3.mk"
1.1 grant 9125:
1.51 rillig 9126: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
1.1 grant 9127: </pre>
9128:
1.14 xtraeme 9129: <p>The header and footer manipulate <code class=
9130: "varname">BUILDLINK_DEPTH</code>, which is common
1.45 wiz 9131: across all <code xmlns=
9132: "http://www.w3.org/TR/xhtml1/transitional" class=
9133: "filename">buildlink3.mk</code> files and is used to
9134: track at what depth we are including <code xmlns=
9135: "http://www.w3.org/TR/xhtml1/transitional" class=
9136: "filename">buildlink3.mk</code> files.</p>
1.1 grant 9137:
9138: <p>The first section controls if the dependency on
1.14 xtraeme 9139: <em class="replaceable"><code>pkg</code></em> is added.
9140: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 9141: global list of packages for which dependencies are
9142: added by buildlink3.</p>
9143:
9144: <p>The second section advises pkgsrc that the
1.45 wiz 9145: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9146: class="filename">buildlink3.mk</code> file for
1.14 xtraeme 9147: <em class="replaceable"><code>pkg</code></em> has been
9148: included at some point. <code class=
9149: "varname">BUILDLINK_PACKAGES</code> is the global list
1.45 wiz 9150: of packages for which <code xmlns=
9151: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9152: "filename">buildlink3.mk</code> files have been
9153: included. It must <span class=
9154: "emphasis"><em>always</em></span> be appended to within
1.45 wiz 9155: a <code xmlns=
9156: "http://www.w3.org/TR/xhtml1/transitional" class=
9157: "filename">buildlink3.mk</code> file.</p>
1.1 grant 9158:
9159: <p>The third section is protected from multiple
1.14 xtraeme 9160: inclusion and controls how the dependency on <em class=
9161: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 9162: important variables are set in the section:</p>
9163:
9164: <div class="itemizedlist">
9165: <ul type="disc">
9166: <li>
1.14 xtraeme 9167: <p><code class=
1.72 rillig 9168: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 9169: "replaceable"><code>pkg</code></em></code> is the
9170: actual dependency recorded in the installed
9171: package; this should always be set using
9172: <span><strong class="command">+=</strong></span>
9173: to ensure that we're appending to any
9174: pre-existing list of values. This variable should
9175: be set to the first version of the package that
1.72 rillig 9176: had an API change.</p>
1.1 grant 9177: </li>
9178:
9179: <li>
1.14 xtraeme 9180: <p><code class=
9181: "varname">BUILDLINK_PKGSRCDIR.<em class=
9182: "replaceable"><code>pkg</code></em></code> is the
9183: location of the <em class=
9184: "replaceable"><code>pkg</code></em> pkgsrc
1.47 reed 9185: directory.</p>
1.1 grant 9186: </li>
9187:
9188: <li>
1.14 xtraeme 9189: <p><code class=
9190: "varname">BUILDLINK_DEPMETHOD.<em class=
9191: "replaceable"><code>pkg</code></em></code> (not
9192: shown above) controls whether we use <code class=
9193: "varname">BUILD_DEPENDS</code> or <code class=
9194: "varname">DEPENDS</code> to add the dependency on
9195: <em class="replaceable"><code>pkg</code></em>.
9196: The build dependency is selected by setting
9197: <code class=
9198: "varname">BUILDLINK_DEPMETHOD.<em class=
9199: "replaceable"><code>pkg</code></em></code> to
1.1 grant 9200: “<span class="quote">build</span>”.
9201: By default, the full dependency is used.</p>
9202: </li>
9203:
9204: <li>
1.14 xtraeme 9205: <p><code class=
9206: "varname">BUILDLINK_INCDIRS.<em class=
9207: "replaceable"><code>pkg</code></em></code> and
9208: <code class=
1.67 hubertf 9209: "varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
9210: (not shown above) are lists of subdirectories of
9211: <code xmlns=
1.45 wiz 9212: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9213: "filename">${BUILDLINK_PREFIX.<em class=
9214: "replaceable"><code>pkg</code></em>}</code> to
9215: add to the header and library search paths. These
1.1 grant 9216: default to “<span class=
9217: "quote">include</span>” and
9218: “<span class="quote">lib</span>”
9219: respectively.</p>
9220: </li>
9221:
9222: <li>
1.14 xtraeme 9223: <p><code class=
9224: "varname">BUILDLINK_CPPFLAGS.<em class=
9225: "replaceable"><code>pkg</code></em></code> (not
9226: shown above) is the list of preprocessor flags to
9227: add to <code class="varname">CPPFLAGS</code>,
9228: which are passed on to the configure and build
9229: phases. The “<span class=
9230: "quote">-I</span>” option should be avoided
9231: and instead be handled using <code class=
9232: "varname">BUILDLINK_INCDIRS.<em class=
9233: "replaceable"><code>pkg</code></em></code> as
9234: above.</p>
1.1 grant 9235: </li>
9236: </ul>
9237: </div>
9238:
9239: <p>The following variables are all optionally defined
9240: within this second section (protected against multiple
9241: inclusion) and control which package files are
1.45 wiz 9242: symlinked into <code xmlns=
9243: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9244: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 9245: are transformed during the symlinking:</p>
9246:
9247: <div class="itemizedlist">
9248: <ul type="disc">
9249: <li>
1.14 xtraeme 9250: <p><code class=
9251: "varname">BUILDLINK_FILES.<em class=
9252: "replaceable"><code>pkg</code></em></code> (not
9253: shown above) is a shell glob pattern relative to
1.45 wiz 9254: <code xmlns=
9255: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9256: "filename">${BUILDLINK_PREFIX.<em class=
9257: "replaceable"><code>pkg</code></em>}</code> to be
1.45 wiz 9258: symlinked into <code xmlns=
9259: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9260: "filename">${BUILDLINK_DIR}</code>, e.g.
1.45 wiz 9261: <code xmlns=
9262: "http://www.w3.org/TR/xhtml1/transitional" class=
9263: "filename">include/*.h</code>.</p>
1.1 grant 9264: </li>
9265:
9266: <li>
1.14 xtraeme 9267: <p><code class=
9268: "varname">BUILDLINK_FILES_CMD.<em class=
9269: "replaceable"><code>pkg</code></em></code> (not
9270: shown above) is a shell pipeline that outputs to
1.45 wiz 9271: stdout a list of files relative to <code xmlns=
9272: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9273: "filename">${BUILDLINK_PREFIX.<em class=
9274: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 9275: resulting files are to be symlinked into
1.45 wiz 9276: <code xmlns=
9277: "http://www.w3.org/TR/xhtml1/transitional" class=
9278: "filename">${BUILDLINK_DIR}</code>. By default,
9279: this takes the <code xmlns=
9280: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9281: "filename">+CONTENTS</code> of a <em class=
9282: "replaceable"><code>pkg</code></em> and filters
9283: it through <code class=
9284: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
9285: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 9286: </li>
9287:
9288: <li>
1.14 xtraeme 9289: <p><code class=
9290: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
9291: "replaceable"><code>pkg</code></em></code> (not
9292: shown above) is a filter command that filters
1.45 wiz 9293: <code xmlns=
9294: "http://www.w3.org/TR/xhtml1/transitional" class=
9295: "filename">+CONTENTS</code> input into a list of
9296: files relative to <code xmlns=
9297: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9298: "filename">${BUILDLINK_PREFIX.<em class=
9299: "replaceable"><code>pkg</code></em>}</code> on
9300: stdout. By default for overwrite packages,
9301: <code class=
9302: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
9303: "replaceable"><code>pkg</code></em></code>
1.45 wiz 9304: outputs the contents of the <code xmlns=
9305: "http://www.w3.org/TR/xhtml1/transitional" class=
9306: "filename">include</code> and <code xmlns=
9307: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9308: "filename">lib</code> directories in the package
1.45 wiz 9309: <code xmlns=
9310: "http://www.w3.org/TR/xhtml1/transitional" class=
9311: "filename">+CONTENTS</code>, and for pkgviews
9312: packages, it outputs any libtool archives in
9313: <code xmlns=
9314: "http://www.w3.org/TR/xhtml1/transitional" class=
9315: "filename">lib</code> directories.</p>
1.1 grant 9316: </li>
9317:
9318: <li>
1.14 xtraeme 9319: <p><code class=
9320: "varname">BUILDLINK_TRANSFORM.<em class=
9321: "replaceable"><code>pkg</code></em></code> (not
9322: shown above) is a list of sed arguments used to
1.1 grant 9323: transform the name of the source filename into a
1.14 xtraeme 9324: destination filename, e.g. <span><strong class=
1.1 grant 9325: "command">-e
1.14 xtraeme 9326: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 9327: </li>
9328: </ul>
9329: </div>
9330:
1.45 wiz 9331: <p>The last section includes any <code xmlns=
9332: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9333: "filename">buildlink3.mk</code> needed for <em class=
9334: "replaceable"><code>pkg</code></em>'s library
1.45 wiz 9335: dependencies. Including these <code xmlns=
9336: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9337: "filename">buildlink3.mk</code> files means that the
9338: headers and libraries for these dependencies are also
1.45 wiz 9339: symlinked into <code xmlns=
9340: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9341: "filename">${BUILDLINK_DIR}</code> whenever the
9342: <em class="replaceable"><code>pkg</code></em>
1.45 wiz 9343: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9344: class="filename">buildlink3.mk</code> file is
1.14 xtraeme 9345: included.</p>
1.1 grant 9346: </div>
9347:
1.67 hubertf 9348: <div class="sect2" lang="en">
1.1 grant 9349: <div class="titlepage">
9350: <div>
9351: <div>
1.30 wiz 9352: <h3 class="title"><a name=
1.67 hubertf 9353: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 9354: <code class=
1.72 rillig 9355: "varname">BUILDLINK_API_DEPENDS.<em class=
9356: "replaceable"><code>pkg</code></em></code> in
9357: <code xmlns=
1.45 wiz 9358: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 9359: "filename">buildlink3.mk</code> files</h3>
1.1 grant 9360: </div>
9361: </div>
9362: </div>
9363:
1.72 rillig 9364: <p>The situation that requires increasing the
1.14 xtraeme 9365: dependency listed in <code class=
1.72 rillig 9366: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 9367: "replaceable"><code>pkg</code></em></code> after a
1.72 rillig 9368: package update is when the API or interface to the
9369: header files change.</p>
1.1 grant 9370:
1.72 rillig 9371: <p>In this case, <code class=
9372: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 9373: "replaceable"><code>pkg</code></em></code> should be
9374: adjusted to require at least the new package version.
9375: In some cases, the packages that depend on this new
9376: version may need their <code class=
9377: "varname">PKGREVISION</code>s increased and, if they
1.45 wiz 9378: have <code xmlns=
9379: "http://www.w3.org/TR/xhtml1/transitional" class=
9380: "filename">buildlink3.mk</code> files, their
1.72 rillig 9381: <code class="varname">BUILDLINK_API_DEPENDS.<em class=
1.45 wiz 9382: "replaceable"><code>pkg</code></em></code> adjusted,
1.72 rillig 9383: too. This is needed so pkgsrc will require the correct
9384: package dependency and not settle for an older one when
9385: building the source.</p>
9386:
9387: <p><code class=
9388: "varname">BUILDLINK_ABI_DEPENDS.<em class=
9389: "replaceable"><code>pkg</code></em></code> should be
9390: increased when the binary interface or sonames (major
9391: number of the library version) of any installed shared
9392: libraries change. This is needed so that binary
9393: packages made using it will require the correct package
9394: dependency and not settle for an older one which will
9395: not contain the necessary shared libraries.</p>
9396:
9397: <p>See <a href="#dependencies" title=
9398: "16.1.4. Handling dependencies">Section 16.1.4,
9399: “Handling dependencies”</a> for more
9400: information about dependencies on other packages,
9401: including the <code class=
9402: "varname">BUILDLINK_ABI_DEPENDS</code> and <code class=
9403: "varname">ABI_DEPENDS</code> definitions.</p>
1.1 grant 9404:
9405: <p>Please take careful consideration before adjusting
1.72 rillig 9406: <code class="varname">BUILDLINK_API_DEPENDS.<em class=
9407: "replaceable"><code>pkg</code></em></code> or
9408: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class=
1.14 xtraeme 9409: "replaceable"><code>pkg</code></em></code> as we don't
9410: want to cause unneeded package deletions and rebuilds.
9411: In many cases, new versions of packages work just fine
1.72 rillig 9412: with older dependencies.</p>
9413:
9414: <p>Also it is not needed to set <code class=
9415: "varname">BUILDLINK_ABI_DEPENDS.<em class=
9416: "replaceable"><code>pkg</code></em></code> when it is
9417: identical to <code class=
9418: "varname">BUILDLINK_API_DEPENDS.<em class=
9419: "replaceable"><code>pkg</code></em></code>.</p>
1.1 grant 9420: </div>
9421: </div>
9422:
1.67 hubertf 9423: <div class="sect1" lang="en">
1.1 grant 9424: <div class="titlepage">
9425: <div>
9426: <div>
9427: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9428: "writing-builtin.mk"></a>11.3. Writing
1.45 wiz 9429: <code xmlns=
9430: "http://www.w3.org/TR/xhtml1/transitional" class=
9431: "filename">builtin.mk</code> files</h2>
1.1 grant 9432: </div>
9433: </div>
9434: </div>
9435:
9436: <p>Some packages in pkgsrc install headers and libraries
9437: that coincide with headers and libraries present in the
1.45 wiz 9438: base system. Aside from a <code xmlns=
9439: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9440: "filename">buildlink3.mk</code> file, these packages
1.45 wiz 9441: should also include a <code xmlns=
9442: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9443: "filename">builtin.mk</code> file that includes the
9444: necessary checks to decide whether using the built-in
9445: software or the pkgsrc software is appropriate.</p>
1.1 grant 9446:
9447: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 9448: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 9449:
9450: <div class="orderedlist">
9451: <ol type="1">
9452: <li>
1.14 xtraeme 9453: <p>It should set <code class=
9454: "varname">USE_BUILTIN.<em class=
9455: "replaceable"><code>pkg</code></em></code> to
9456: either “<span class="quote">yes</span>”
9457: or “<span class="quote">no</span>”
9458: after it is included.</p>
1.1 grant 9459: </li>
9460:
9461: <li>
9462: <p>It should <span class=
9463: "emphasis"><em>not</em></span> override any
1.14 xtraeme 9464: <code class="varname">USE_BUILTIN.<em class=
9465: "replaceable"><code>pkg</code></em></code> which is
1.45 wiz 9466: already set before the <code xmlns=
9467: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9468: "filename">builtin.mk</code> file is included.</p>
1.1 grant 9469: </li>
9470:
9471: <li>
9472: <p>It should be written to allow multiple
9473: inclusion. This is <span class=
9474: "emphasis"><em>very</em></span> important and takes
1.45 wiz 9475: careful attention to <code xmlns=
9476: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9477: "filename">Makefile</code> coding.</p>
1.1 grant 9478: </li>
9479: </ol>
9480: </div>
9481:
1.67 hubertf 9482: <div class="sect2" lang="en">
1.1 grant 9483: <div class="titlepage">
9484: <div>
9485: <div>
1.67 hubertf 9486: <h3 class="title"><a name=
1.38 dillo 9487: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.45 wiz 9488: of a <code xmlns=
9489: "http://www.w3.org/TR/xhtml1/transitional" class=
9490: "filename">builtin.mk</code> file</h3>
1.1 grant 9491: </div>
9492: </div>
9493: </div>
9494:
9495: <p>The following is the recommended template for
9496: builtin.mk files:</p>
9497: <pre class="programlisting">
1.51 rillig 9498: .if !defined(IS_BUILTIN.foo)
9499: #
9500: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
9501: # genuinely exists in the system or not.
9502: #
9503: IS_BUILTIN.foo?= no
9504:
9505: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
9506: # version can be determined.
9507: #
9508: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
9509: BUILTIN_PKG.foo?= foo-1.0
9510: . endif
9511: .endif # IS_BUILTIN.foo
9512:
9513: .if !defined(USE_BUILTIN.foo)
9514: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
9515: . if defined(BUILTIN_PKG.foo)
1.72 rillig 9516: . for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
1.51 rillig 9517: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
9518: USE_BUILTIN.foo!= \
9519: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
9520: ${ECHO} "yes"; \
9521: else \
9522: ${ECHO} "no"; \
9523: fi
9524: . endif
9525: . endfor
9526: . endif
9527: .endif # USE_BUILTIN.foo
9528:
9529: CHECK_BUILTIN.foo?= no
9530: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
9531: #
9532: # Here we place code that depends on whether USE_BUILTIN.foo is set to
9533: # "yes" or "no".
9534: #
9535: .endif # CHECK_BUILTIN.foo
1.1 grant 9536: </pre>
9537:
1.14 xtraeme 9538: <p>The first section sets <code class=
9539: "varname">IS_BUILTIN.<em class=
9540: "replaceable"><code>pkg</code></em></code> depending on
9541: if <em class="replaceable"><code>pkg</code></em> really
9542: exists in the base system. This should not be a base
9543: system software with similar functionality to
9544: <em class="replaceable"><code>pkg</code></em>; it
9545: should only be “<span class=
9546: "quote">yes</span>” if the actual package is
9547: included as part of the base system. This variable is
1.45 wiz 9548: only used internally within the <code xmlns=
9549: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9550: "filename">builtin.mk</code> file.</p>
9551:
9552: <p>The second section sets <code class=
9553: "varname">BUILTIN_PKG.<em class=
9554: "replaceable"><code>pkg</code></em></code> to the
9555: version of <em class=
9556: "replaceable"><code>pkg</code></em> in the base system
9557: if it exists (if <code class=
9558: "varname">IS_BUILTIN.<em class=
9559: "replaceable"><code>pkg</code></em></code> is
1.1 grant 9560: “<span class="quote">yes</span>”). This
1.14 xtraeme 9561: variable is only used internally within the
1.45 wiz 9562: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9563: class="filename">builtin.mk</code> file.</p>
1.1 grant 9564:
1.14 xtraeme 9565: <p>The third section sets <code class=
9566: "varname">USE_BUILTIN.<em class=
9567: "replaceable"><code>pkg</code></em></code> and is
9568: <span class="emphasis"><em>required</em></span> in all
1.45 wiz 9569: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9570: class="filename">builtin.mk</code> files. The code in
9571: this section must make the determination whether the
9572: built-in software is adequate to satisfy the
9573: dependencies listed in <code class=
1.72 rillig 9574: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 9575: "replaceable"><code>pkg</code></em></code>. This is
9576: typically done by comparing <code class=
9577: "varname">BUILTIN_PKG.<em class=
9578: "replaceable"><code>pkg</code></em></code> against each
9579: of the dependencies in <code class=
1.72 rillig 9580: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 9581: "replaceable"><code>pkg</code></em></code>.
9582: <code class="varname">USE_BUILTIN.<em class=
9583: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 9584: "emphasis"><em>must</em></span> be set to the correct
1.45 wiz 9585: value by the end of the <code xmlns=
9586: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9587: "filename">builtin.mk</code> file. Note that
9588: <code class="varname">USE_BUILTIN.<em class=
9589: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 9590: “<span class="quote">yes</span>” even if
1.14 xtraeme 9591: <code class="varname">IS_BUILTIN.<em class=
9592: "replaceable"><code>pkg</code></em></code> is
1.1 grant 9593: “<span class="quote">no</span>” because we
9594: may make the determination that the built-in version of
9595: the software is similar enough to be used as a
9596: replacement.</p>
9597:
1.14 xtraeme 9598: <p>The last section is guarded by <code class=
9599: "varname">CHECK_BUILTIN.<em class=
9600: "replaceable"><code>pkg</code></em></code>, and
9601: includes code that uses the value of <code class=
9602: "varname">USE_BUILTIN.<em class=
9603: "replaceable"><code>pkg</code></em></code> set in the
9604: previous section. This typically includes, e.g., adding
1.1 grant 9605: additional dependency restrictions and listing
1.45 wiz 9606: additional files to symlink into <code xmlns=
9607: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9608: "filename">${BUILDLINK_DIR}</code> (via <code class=
9609: "varname">BUILDLINK_FILES.<em class=
9610: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 9611: </div>
9612:
1.67 hubertf 9613: <div class="sect2" lang="en">
1.1 grant 9614: <div class="titlepage">
9615: <div>
9616: <div>
1.30 wiz 9617: <h3 class="title"><a name=
1.38 dillo 9618: "native-or-pkgsrc-preference"></a>11.3.2. Global
1.30 wiz 9619: preferences for native or pkgsrc software</h3>
1.1 grant 9620: </div>
9621: </div>
9622: </div>
9623:
9624: <p>When building packages, it's possible to choose
9625: whether to set a global preference for using either the
9626: built-in (native) version or the pkgsrc version of
9627: software to satisfy a dependency. This is controlled by
1.14 xtraeme 9628: setting <code class="varname">PREFER_PKGSRC</code> and
9629: <code class="varname">PREFER_NATIVE</code>. These
9630: variables take values of either “<span class=
1.1 grant 9631: "quote">yes</span>”, “<span class=
9632: "quote">no</span>”, or a list of packages.
1.14 xtraeme 9633: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
9634: to use the pkgsrc versions of software, while
9635: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
9636: to use the built-in versions. Preferences are
9637: determined by the most specific instance of the package
9638: in either <code class="varname">PREFER_PKGSRC</code> or
9639: <code class="varname">PREFER_NATIVE</code>. If a
9640: package is specified in neither or in both variables,
9641: then <code class="varname">PREFER_PKGSRC</code> has
9642: precedence over <code class=
9643: "varname">PREFER_NATIVE</code>. For example, to require
9644: using pkgsrc versions of software for all but the most
9645: basic bits on a NetBSD system, you can set:</p>
1.1 grant 9646: <pre class="programlisting">
1.51 rillig 9647: PREFER_PKGSRC= yes
9648: PREFER_NATIVE= getopt skey tcp_wrappers
1.1 grant 9649: </pre>
9650:
9651: <p>A package <span class=
1.45 wiz 9652: "emphasis"><em>must</em></span> have a <code xmlns=
9653: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9654: "filename">builtin.mk</code> file to be listed in
9655: <code class="varname">PREFER_NATIVE</code>, otherwise
9656: it is simply ignored in that list.</p>
1.1 grant 9657: </div>
9658: </div>
9659: </div>
9660:
1.67 hubertf 9661: <div class="chapter" lang="en">
1.1 grant 9662: <div class="titlepage">
9663: <div>
9664: <div>
1.67 hubertf 9665: <h2 class="title"><a name=
1.38 dillo 9666: "pkginstall"></a>Chapter 12. The pkginstall
1.35 jmmv 9667: framework</h2>
1.1 grant 9668: </div>
9669: </div>
9670: </div>
9671:
9672: <div class="toc">
9673: <p><b>Table of Contents</b></p>
9674:
9675: <dl>
1.30 wiz 9676: <dt><span class="sect1"><a href=
1.38 dillo 9677: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 9678: directories outside the installation
9679: prefix</a></span></dt>
9680:
9681: <dd>
9682: <dl>
9683: <dt><span class="sect2"><a href=
1.38 dillo 9684: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 9685: manipulation</a></span></dt>
9686:
9687: <dt><span class="sect2"><a href=
1.38 dillo 9688: "#files-outside-prefix">12.1.2. File
1.35 jmmv 9689: manipulation</a></span></dt>
9690: </dl>
9691: </dd>
9692:
1.38 dillo 9693: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 9694: Configuration files</a></span></dt>
9695:
9696: <dd>
9697: <dl>
9698: <dt><span class="sect2"><a href=
1.38 dillo 9699: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 9700: "varname">PKG_SYSCONFDIR</code> is
9701: set</a></span></dt>
9702:
9703: <dt><span class="sect2"><a href=
1.38 dillo 9704: "#conf-files-configure">12.2.2. Telling the
1.47 reed 9705: software where configuration files
1.35 jmmv 9706: are</a></span></dt>
9707:
9708: <dt><span class="sect2"><a href=
1.38 dillo 9709: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 9710: installations</a></span></dt>
9711:
9712: <dt><span class="sect2"><a href=
1.38 dillo 9713: "#conf-files-disable">12.2.4. Disabling handling of
1.35 jmmv 9714: configuration files</a></span></dt>
9715: </dl>
9716: </dd>
9717:
1.38 dillo 9718: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 9719: System startup scripts</a></span></dt>
9720:
9721: <dd>
9722: <dl>
9723: <dt><span class="sect2"><a href=
1.38 dillo 9724: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 9725: of system startup scripts</a></span></dt>
9726: </dl>
9727: </dd>
1.1 grant 9728:
1.30 wiz 9729: <dt><span class="sect1"><a href=
1.38 dillo 9730: "#users-and-groups">12.4. System users and
1.35 jmmv 9731: groups</a></span></dt>
9732:
1.38 dillo 9733: <dt><span class="sect1"><a href="#shells">12.5. System
1.35 jmmv 9734: shells</a></span></dt>
9735:
9736: <dd>
9737: <dl>
9738: <dt><span class="sect2"><a href=
1.65 hubertf 9739: "#shells-disable">12.5.1. Disabling shell
9740: registration</a></span></dt>
9741: </dl>
9742: </dd>
9743:
9744: <dt><span class="sect1"><a href="#fonts">12.6.
9745: Fonts</a></span></dt>
9746:
9747: <dd>
9748: <dl>
9749: <dt><span class="sect2"><a href=
9750: "#fonts-disable">12.6.1. Disabling automatic update
9751: of the fonts databases</a></span></dt>
1.35 jmmv 9752: </dl>
9753: </dd>
1.1 grant 9754: </dl>
9755: </div>
9756:
1.35 jmmv 9757: <p>This chapter describes the framework known as
9758: <code class="literal">pkginstall</code>, whose key features
9759: are:</p>
9760:
9761: <div class="itemizedlist">
9762: <ul type="disc">
9763: <li>
9764: <p>Generic installation and manipulation of
9765: directories and files outside the pkgsrc-handled
9766: tree, <code class="varname">LOCALBASE</code>.</p>
9767: </li>
9768:
9769: <li>
9770: <p>Automatic handling of configuration files during
9771: installation, provided that packages are correctly
9772: designed.</p>
9773: </li>
9774:
9775: <li>
9776: <p>Generation and installation of system startup
9777: scripts.</p>
9778: </li>
9779:
9780: <li>
9781: <p>Registration of system users and groups.</p>
9782: </li>
9783:
9784: <li>
9785: <p>Registration of system shells.</p>
9786: </li>
1.65 hubertf 9787:
9788: <li>
9789: <p>Automatic updating of fonts databases.</p>
9790: </li>
1.35 jmmv 9791: </ul>
9792: </div>
9793:
9794: <p>The following sections inspect each of the above points
1.65 hubertf 9795: in detail.</p>
1.35 jmmv 9796:
9797: <p>You may be thinking that many of the things described
9798: here could be easily done with simple code in the package's
9799: post-installation target (<code class=
9800: "literal">post-install</code>). <span class=
9801: "emphasis"><em>This is incorrect</em></span>, as the code
9802: in them is only executed when building from source.
9803: Machines using binary packages could not benefit from it at
9804: all (as the code itself could be unavailable). Therefore,
9805: the only way to achieve any of the items described above is
9806: by means of the installation scripts, which are
9807: automatically generated by pkginstall.</p>
1.1 grant 9808:
1.67 hubertf 9809: <div class="sect1" lang="en">
1.1 grant 9810: <div class="titlepage">
9811: <div>
9812: <div>
9813: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9814: "files-and-dirs-outside-prefix"></a>12.1. Files
9815: and directories outside the installation
9816: prefix</h2>
1.1 grant 9817: </div>
9818: </div>
9819: </div>
9820:
1.45 wiz 9821: <p>As you already know, the <code xmlns=
9822: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9823: "filename">PLIST</code> file holds a list of files and
9824: directories that belong to a package. The names used in
1.45 wiz 9825: it are relative to the installation prefix (<code xmlns=
9826: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9827: "filename">${PREFIX}</code>), which means that it cannot
9828: register files outside this directory (absolute path
9829: names are not allowed). Despite this restriction, some
9830: packages need to install files outside this location;
1.45 wiz 9831: e.g., under <code xmlns=
9832: "http://www.w3.org/TR/xhtml1/transitional" class=
9833: "filename">${VARBASE}</code> or <code xmlns=
9834: "http://www.w3.org/TR/xhtml1/transitional" class=
9835: "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35 jmmv 9836:
9837: <p>The only way to achieve this is to create such files
9838: during installation time by using the installation
9839: scripts. These scripts can run arbitrary commands, so
9840: they have the potential to create and manage files
1.47 reed 9841: anywhere in the file system. Here is where pkginstall
1.35 jmmv 9842: comes into play: it provides generic scripts to abstract
9843: the manipulation of such files and directories based on
1.45 wiz 9844: variables set in the package's <code xmlns=
9845: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9846: "filename">Makefile</code>. The rest of this section
1.47 reed 9847: describes these variables.</p>
1.1 grant 9848:
1.67 hubertf 9849: <div class="sect2" lang="en">
1.35 jmmv 9850: <div class="titlepage">
1.1 grant 9851: <div>
1.35 jmmv 9852: <div>
1.67 hubertf 9853: <h3 class="title"><a name=
1.63 dillo 9854: "dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 9855: manipulation</h3>
9856: </div>
1.1 grant 9857: </div>
9858: </div>
9859:
1.35 jmmv 9860: <p>The following variables can be set to request the
1.47 reed 9861: creation of directories anywhere in the file
9862: system:</p>
1.27 rillig 9863:
1.35 jmmv 9864: <div class="itemizedlist">
9865: <ul type="disc">
9866: <li>
9867: <p><code class="varname">MAKE_DIRS</code> and
9868: <code class="varname">OWN_DIRS</code> contain a
9869: list of directories that should be created and
9870: should attempt to be destroyed by the
9871: installation scripts. The difference between the
9872: two is that the latter prompts the administrator
9873: to remove any directories that may be left after
9874: deinstallation (because they were not empty),
9875: while the former does not.</p>
9876: </li>
1.1 grant 9877:
1.35 jmmv 9878: <li>
9879: <p><code class="varname">MAKE_DIRS_PERMS</code>
9880: and <code class="varname">OWN_DIRS_PERMS</code>
9881: contain a list of tuples describing which
9882: directories should be created and should attempt
9883: to be destroyed by the installation scripts. Each
9884: tuple holds the following values, separated by
9885: spaces: the directory name, its owner, its group
9886: and its numerical mode. For example:</p>
9887: <pre class="programlisting">
1.51 rillig 9888: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9889: </pre>
1.1 grant 9890:
1.35 jmmv 9891: <p>The difference between the two is exactly the
9892: same as their non-<code class=
9893: "varname">PERMS</code> counterparts.</p>
9894: </li>
9895: </ul>
9896: </div>
9897: </div>
9898:
1.67 hubertf 9899: <div class="sect2" lang="en">
1.35 jmmv 9900: <div class="titlepage">
9901: <div>
9902: <div>
1.67 hubertf 9903: <h3 class="title"><a name=
9904: "files-outside-prefix"></a>12.1.2. File
1.35 jmmv 9905: manipulation</h3>
9906: </div>
9907: </div>
9908: </div>
9909:
9910: <p>Creating non-empty files outside the installation
1.45 wiz 9911: prefix is tricky because the <code xmlns=
9912: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9913: "filename">PLIST</code> forces all files to be inside
9914: it. To overcome this problem, the only solution is to
9915: extract the file in the known place (i.e., inside the
9916: installation prefix) and copy it to the appropriate
9917: location during installation (done by the installation
9918: scripts generated by pkginstall). We will call the
9919: former the <span class="emphasis"><em>master
9920: file</em></span> in the following paragraphs, which
9921: describe the variables that can be used to
9922: automatically and consistently handle files outside the
9923: installation prefix:</p>
9924:
9925: <div class="itemizedlist">
9926: <ul type="disc">
9927: <li>
9928: <p><code class="varname">CONF_FILES</code> and
9929: <code class="varname">SUPPORT_FILES</code> are
9930: pairs of master and target files. During
9931: installation time, the master file is copied to
9932: the target one if and only if the latter does not
9933: exist. Upon deinstallation, the target file is
9934: removed provided that it was not modified by the
9935: installation.</p>
9936:
9937: <p>The difference between the two is that the
9938: latter prompts the administrator to remove any
9939: files that may be left after deinstallation
9940: (because they were not empty), while the former
9941: does not.</p>
9942: </li>
9943:
9944: <li>
9945: <p><code class="varname">CONF_FILES_PERMS</code>
9946: and <code class=
9947: "varname">SUPPORT_FILES_PERMS</code> contain
9948: tuples describing master files as well as their
9949: target locations. For each of them, it also
9950: specifies their owner, their group and their
9951: numeric permissions, in this order. For
9952: example:</p>
9953: <pre class="programlisting">
1.51 rillig 9954: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9955: </pre>
9956:
9957: <p>The difference between the two is exactly the
9958: same as their non-<code class=
9959: "varname">PERMS</code> counterparts.</p>
9960: </li>
9961: </ul>
9962: </div>
9963: </div>
9964: </div>
9965:
1.67 hubertf 9966: <div class="sect1" lang="en">
1.35 jmmv 9967: <div class="titlepage">
9968: <div>
9969: <div>
9970: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9971: "conf-files"></a>12.2. Configuration
9972: files</h2>
1.35 jmmv 9973: </div>
9974: </div>
9975: </div>
9976:
9977: <p>Configuration files are special in the sense that they
9978: are installed in their own specific directory,
9979: <code class="varname">PKG_SYSCONFDIR</code>, and need
9980: special treatment during installation (most of which is
9981: automated by pkginstall). The main concept you must bear
1.36 wiz 9982: in mind is that files marked as configuration files are
1.35 jmmv 9983: automatically copied to the right place (somewhere inside
9984: <code class="varname">PKG_SYSCONFDIR</code>) during
9985: installation <span class="emphasis"><em>if and only
9986: if</em></span> they didn't exist before. Similarly, they
9987: will not be removed if they have local modifications.
1.36 wiz 9988: This ensures that administrators never lose any custom
1.35 jmmv 9989: changes they may have made.</p>
9990:
1.67 hubertf 9991: <div class="sect2" lang="en">
1.35 jmmv 9992: <div class="titlepage">
9993: <div>
9994: <div>
1.67 hubertf 9995: <h3 class="title"><a name=
9996: "conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 9997: <code class="varname">PKG_SYSCONFDIR</code> is
9998: set</h3>
9999: </div>
10000: </div>
10001: </div>
10002:
10003: <p>As said before, the <code class=
10004: "varname">PKG_SYSCONFDIR</code> variable specifies
10005: where configuration files shall be installed. Its
10006: contents are set based upon the following
10007: variables:</p>
10008:
10009: <div class="itemizedlist">
10010: <ul type="disc">
10011: <li>
10012: <p><code class="varname">PKG_SYSCONFBASE</code>:
10013: The configuration's root directory. Defaults to
1.45 wiz 10014: <code xmlns=
10015: "http://www.w3.org/TR/xhtml1/transitional" class=
10016: "filename">${PREFIX}/etc</code> although it may
10017: be overridden by the user to point to his
10018: preferred location (e.g., <code xmlns=
10019: "http://www.w3.org/TR/xhtml1/transitional" class=
10020: "filename">/etc</code>, <code xmlns=
10021: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10022: "filename">/etc/pkg</code>, etc.). Packages must
10023: not use it directly.</p>
10024: </li>
10025:
10026: <li>
10027: <p><code class=
10028: "varname">PKG_SYSCONFSUBDIR</code>: A
10029: subdirectory of <code class=
10030: "varname">PKG_SYSCONFBASE</code> under which the
10031: configuration files for the package being built
10032: shall be installed. The definition of this
10033: variable only makes sense in the package's
1.45 wiz 10034: <code xmlns=
10035: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 10036: "filename">Makefile</code> (i.e., it is not
10037: user-customizable).</p>
1.35 jmmv 10038:
10039: <p>As an example, consider the Apache package,
10040: <a xmlns=
10041: "http://www.w3.org/TR/xhtml1/transitional" href=
10042: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45 wiz 10043: target="_top"><code xmlns="" class=
10044: "filename">www/apache2</code></a>, which places
10045: its configuration files under the <code xmlns=
10046: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10047: "filename">httpd/</code> subdirectory of
10048: <code class="varname">PKG_SYSCONFBASE</code>.
10049: This should be set in the package Makefile.</p>
10050: </li>
10051:
10052: <li>
10053: <p><code class="varname">PKG_SYSCONFVAR</code>:
10054: Specifies the name of the variable that holds
10055: this package's configuration directory (if
10056: different from <code class=
10057: "varname">PKG_SYSCONFBASE</code>). It defaults to
10058: <code class="varname">PKGBASE</code>'s value, and
10059: is always prefixed with <code class=
10060: "literal">PKG_SYSCONFDIR</code>.</p>
10061: </li>
10062:
10063: <li>
10064: <p><code class=
10065: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
10066: Holds the directory where the configuration files
10067: for the package identified by <code class=
10068: "varname">PKG_SYSCONFVAR</code>'s shall be
10069: placed.</p>
10070: </li>
10071: </ul>
10072: </div>
10073:
10074: <p>Based on the above variables, pkginstall determines
10075: the value of <code class=
10076: "varname">PKG_SYSCONFDIR</code>, which is the
10077: <span class="emphasis"><em>only</em></span> variable
10078: that can be used within a package to refer to its
10079: configuration directory. The algorithm used to set its
10080: value is basically the following:</p>
10081:
10082: <div class="orderedlist">
10083: <ol type="1">
10084: <li>
10085: <p>If <code class=
10086: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
10087: is set, its value is used.</p>
10088: </li>
10089:
10090: <li>
10091: <p>If the previous variable is not defined but
10092: <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45 wiz 10093: set in the package's <code xmlns=
10094: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10095: "filename">Makefile</code>, the resulting value
1.45 wiz 10096: is <code xmlns=
10097: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10098: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
10099: </li>
10100:
10101: <li>
1.45 wiz 10102: <p>Otherwise, it is set to <code xmlns=
10103: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10104: "filename">${PKG_SYSCONFBASE}</code>.</p>
10105: </li>
10106: </ol>
10107: </div>
10108:
1.45 wiz 10109: <p>It is worth mentioning that <code xmlns=
10110: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10111: "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45 wiz 10112: added to <code xmlns=
10113: "http://www.w3.org/TR/xhtml1/transitional" class=
10114: "filename">OWN_DIRS</code>. See <a href=
10115: "#dirs-outside-prefix" title=
1.63 dillo 10116: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 10117: “Directory manipulation”</a> what this
10118: means.</p>
10119: </div>
10120:
1.67 hubertf 10121: <div class="sect2" lang="en">
1.35 jmmv 10122: <div class="titlepage">
10123: <div>
10124: <div>
1.67 hubertf 10125: <h3 class="title"><a name=
1.63 dillo 10126: "conf-files-configure"></a>12.2.2. Telling
10127: the software where configuration files are</h3>
1.35 jmmv 10128: </div>
10129: </div>
10130: </div>
10131:
10132: <p>Given that pkgsrc (and users!) expect configuration
10133: files to be in a known place, you need to teach each
1.36 wiz 10134: package where it shall install its files. In some cases
1.35 jmmv 10135: you will have to patch the package Makefiles to achieve
10136: it. If you are lucky, though, it may be as easy as
10137: passing an extra flag to the configuration script; this
1.47 reed 10138: is the case of GNU Autoconf- generated files:</p>
1.35 jmmv 10139: <pre class="programlisting">
1.51 rillig 10140: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35 jmmv 10141: </pre>
10142:
10143: <p>Note that this specifies where the package has to
10144: <span class="emphasis"><em>look for</em></span> its
10145: configuration files, not where they will be originally
10146: installed (although the difference is never explicit,
10147: unfortunately).</p>
10148: </div>
10149:
1.67 hubertf 10150: <div class="sect2" lang="en">
1.35 jmmv 10151: <div class="titlepage">
10152: <div>
10153: <div>
1.67 hubertf 10154: <h3 class="title"><a name=
1.63 dillo 10155: "conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 10156: installations</h3>
10157: </div>
10158: </div>
10159: </div>
10160:
10161: <p>As said before, pkginstall automatically handles
10162: configuration files. This means that <span class=
10163: "strong"><strong>the packages themselves must not touch
1.45 wiz 10164: the contents of <code xmlns=
10165: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10166: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 10167: directly</strong></span>. Bad news is that many
10168: software installation scripts will, out of the box,
10169: mess with the contents of that directory. So what is
10170: the correct procedure to fix this issue?</p>
1.35 jmmv 10171:
10172: <p>You must teach the package (usually by manually
10173: patching it) to install any configuration files under
1.45 wiz 10174: the examples hierarchy, <code xmlns=
10175: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10176: "filename">share/examples/${PKGBASE}/</code>. This way,
1.45 wiz 10177: the <code xmlns=
10178: "http://www.w3.org/TR/xhtml1/transitional" class=
10179: "filename">PLIST</code> registers them and the
10180: administrator always has the original copies
1.35 jmmv 10181: available.</p>
10182:
10183: <p>Once the required configuration files are in place
10184: (i.e., under the examples hierarchy), the pkginstall
10185: framework can use them as master copies during the
1.45 wiz 10186: package installation to update what is in <code xmlns=
10187: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10188: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
10189: the variables <code class="varname">CONF_FILES</code>
10190: and <code class="varname">CONF_FILES_PERMS</code> are
10191: used. Check out <a href="#files-outside-prefix" title=
1.63 dillo 10192: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 10193: “File manipulation”</a> for information
10194: about their syntax and their purpose. Here is an
10195: example, taken from the <a xmlns=
10196: "http://www.w3.org/TR/xhtml1/transitional" href=
10197: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45 wiz 10198: target="_top"><code xmlns="" class=
10199: "filename">mail/mutt</code></a> package:</p>
1.35 jmmv 10200: <pre class="programlisting">
1.51 rillig 10201: EGDIR= ${PREFIX}/share/doc/mutt/samples
10202: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35 jmmv 10203: </pre>
10204:
10205: <p>Note that the <code class="varname">EGDIR</code>
10206: variable is specific to that package and has no meaning
10207: outside it.</p>
10208: </div>
10209:
1.67 hubertf 10210: <div class="sect2" lang="en">
1.35 jmmv 10211: <div class="titlepage">
10212: <div>
10213: <div>
1.67 hubertf 10214: <h3 class="title"><a name=
10215: "conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 10216: handling of configuration files</h3>
10217: </div>
10218: </div>
10219: </div>
10220:
10221: <p>The automatic copying of config files can be toggled
10222: by setting the environment variable <code class=
10223: "varname">PKG_CONFIG</code> prior to package
10224: installation.</p>
10225: </div>
10226: </div>
10227:
1.67 hubertf 10228: <div class="sect1" lang="en">
1.35 jmmv 10229: <div class="titlepage">
10230: <div>
10231: <div>
10232: <h2 class="title" style="clear: both"><a name=
1.63 dillo 10233: "rcd-scripts"></a>12.3. System startup
10234: scripts</h2>
1.35 jmmv 10235: </div>
10236: </div>
10237: </div>
10238:
10239: <p>System startup scripts are special files because they
10240: must be installed in a place known by the underlying OS,
10241: usually outside the installation prefix. Therefore, the
10242: same rules described in <a href=
10243: "#files-and-dirs-outside-prefix" title=
1.38 dillo 10244: "12.1. Files and directories outside the installation prefix">
1.63 dillo 10245: Section 12.1, “Files and directories outside
10246: the installation prefix”</a> apply, and the same
1.35 jmmv 10247: solutions can be used. However, pkginstall provides a
1.36 wiz 10248: special mechanism to handle these files.</p>
1.35 jmmv 10249:
10250: <p>In order to provide system startup scripts, the
10251: package has to:</p>
10252:
10253: <div class="orderedlist">
10254: <ol type="1">
10255: <li>
1.45 wiz 10256: <p>Store the script inside <code xmlns=
10257: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10258: "filename">${FILESDIR}</code>, with the
10259: <code class="literal">.sh</code> suffix appended.
10260: Considering the <a xmlns=
10261: "http://www.w3.org/TR/xhtml1/transitional" href=
10262: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45 wiz 10263: target="_top"><code xmlns="" class=
10264: "filename">print/cups</code></a> package as an
10265: example, it has a <code xmlns=
10266: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10267: "filename">cupsd.sh</code> in its files
10268: directory.</p>
10269: </li>
10270:
10271: <li>
10272: <p>Tell pkginstall to handle it, appending the name
10273: of the script, without its extension, to the
10274: <code class="varname">RCD_SCRIPTS</code> variable.
10275: Continuing the previous example:</p>
10276: <pre class="programlisting">
1.51 rillig 10277: RCD_SCRIPTS+= cupsd
1.35 jmmv 10278: </pre>
10279: </li>
10280: </ol>
10281: </div>
10282:
10283: <p>Once this is done, pkginstall will do the following
10284: steps for each script in an automated fashion:</p>
10285:
10286: <div class="orderedlist">
10287: <ol type="1">
10288: <li>
10289: <p>Process the file found in the files directory
10290: applying all the substitutions described in the
1.45 wiz 10291: <code xmlns=
10292: "http://www.w3.org/TR/xhtml1/transitional" class=
10293: "filename">FILES_SUBST</code> variable.</p>
1.35 jmmv 10294: </li>
10295:
10296: <li>
10297: <p>Copy the script from the files directory to the
1.45 wiz 10298: examples hierarchy, <code xmlns=
10299: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10300: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 10301: Note that this master file must be explicitly
1.45 wiz 10302: registered in the <code xmlns=
10303: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10304: "filename">PLIST</code>.</p>
10305: </li>
10306:
10307: <li>
10308: <p>Add code to the installation scripts to copy the
10309: startup script from the examples hierarchy into the
10310: system-wide startup scripts directory.</p>
10311: </li>
10312: </ol>
10313: </div>
10314:
1.67 hubertf 10315: <div class="sect2" lang="en">
1.35 jmmv 10316: <div class="titlepage">
10317: <div>
10318: <div>
1.67 hubertf 10319: <h3 class="title"><a name=
1.63 dillo 10320: "rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 10321: handling of system startup scripts</h3>
10322: </div>
10323: </div>
10324: </div>
10325:
10326: <p>The automatic copying of config files can be toggled
10327: by setting the environment variable <code class=
10328: "varname">PKG_RCD_SCRIPTS</code> prior to package
10329: installation. Note that the scripts will be always
1.45 wiz 10330: copied inside the examples hierarchy, <code xmlns=
10331: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10332: "filename">${PREFIX}/share/examples/rc.d/</code>, no
10333: matter what the value of this variable is.</p>
10334: </div>
10335: </div>
10336:
1.67 hubertf 10337: <div class="sect1" lang="en">
1.35 jmmv 10338: <div class="titlepage">
10339: <div>
10340: <div>
10341: <h2 class="title" style="clear: both"><a name=
1.63 dillo 10342: "users-and-groups"></a>12.4. System users and
10343: groups</h2>
1.35 jmmv 10344: </div>
10345: </div>
10346: </div>
10347:
10348: <p>If a package needs to create special users and/or
10349: groups during installation, it can do so by using the
10350: pkginstall framework.</p>
10351:
10352: <p>Users can be created by adding entries to the
10353: <code class="varname">PKG_USERS</code> variable. Each
1.72 rillig 10354: entry has the following syntax:</p>
1.35 jmmv 10355: <pre class="programlisting">
1.72 rillig 10356: user:group
1.35 jmmv 10357: </pre>
10358:
1.72 rillig 10359: <p>Further specification of user details may be done by
10360: setting per-user variables. <code class=
10361: "varname">PKG_UID.<em class=
10362: "replaceable"><code>user</code></em></code> is the
10363: numeric UID for the user. <code class=
10364: "varname">PKG_GECOS.<em class=
10365: "replaceable"><code>user</code></em></code> is the user's
10366: description or comment. <code class=
10367: "varname">PKG_HOME.<em class=
10368: "replaceable"><code>user</code></em></code> is the user's
10369: home directory, and defaults to <code xmlns=
10370: "http://www.w3.org/TR/xhtml1/transitional" class=
10371: "filename">/nonexistent</code> if not specified.
10372: <code class="varname">PKG_SHELL.<em class=
10373: "replaceable"><code>user</code></em></code> is the user's
10374: shell, and defaults to <code xmlns=
10375: "http://www.w3.org/TR/xhtml1/transitional" class=
10376: "filename">/sbinno/login</code> if not specified.</p>
10377:
10378: <p>Similarly, groups can be created by adding entries to
10379: the <code class="varname">PKG_GROUPS</code> variable,
10380: whose syntax is:</p>
1.35 jmmv 10381: <pre class="programlisting">
1.72 rillig 10382: group
1.35 jmmv 10383: </pre>
10384:
1.72 rillig 10385: <p>The numeric GID of the group may be set by defining
10386: <code class="varname">PKG_GID.<em class=
10387: "replaceable"><code>group</code></em></code>.</p>
10388:
10389: <p>If a package needs to create the users and groups at
10390: an earlier stage, then it can set <code class=
10391: "varname">USERGROUP_PHASE</code> to either <code class=
10392: "literal">configure</code> or <code class=
10393: "literal">build</code> to indicate the phase before which
10394: the users and groups are created. In this case, the
10395: numeric UIDs and GIDs of the created users and groups are
10396: automatically hardcoded into the final installation
10397: scripts.</p>
1.35 jmmv 10398: </div>
10399:
1.67 hubertf 10400: <div class="sect1" lang="en">
1.35 jmmv 10401: <div class="titlepage">
10402: <div>
10403: <div>
10404: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 10405: "shells"></a>12.5. System shells</h2>
1.35 jmmv 10406: </div>
10407: </div>
10408: </div>
10409:
10410: <p>Packages that install system shells should register
1.45 wiz 10411: them in the shell database, <code xmlns=
10412: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10413: "filename">/etc/shells</code>, to make things easier to
10414: the administrator. This must be done from the
10415: installation scripts to keep binary packages working on
10416: any system. pkginstall provides an easy way to accomplish
10417: this task.</p>
10418:
10419: <p>When a package provides a shell interpreter, it has to
10420: set the <code class="varname">PKG_SHELL</code> variable
10421: to its absolute file name. This will add some hooks to
10422: the installation scripts to handle it. Consider the
10423: following example, taken from <a xmlns=
10424: "http://www.w3.org/TR/xhtml1/transitional" href=
10425: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45 wiz 10426: target="_top"><code xmlns="" class=
10427: "filename">shells/zsh</code></a>:</p>
1.35 jmmv 10428: <pre class="programlisting">
1.51 rillig 10429: PKG_SHELL= ${PREFIX}/bin/zsh
1.35 jmmv 10430: </pre>
10431:
1.67 hubertf 10432: <div class="sect2" lang="en">
1.35 jmmv 10433: <div class="titlepage">
10434: <div>
10435: <div>
1.67 hubertf 10436: <h3 class="title"><a name=
10437: "shells-disable"></a>12.5.1. Disabling shell
1.65 hubertf 10438: registration</h3>
1.35 jmmv 10439: </div>
10440: </div>
10441: </div>
10442:
10443: <p>The automatic registration of shell interpreters can
10444: be disabled by the administrator by setting the
1.45 wiz 10445: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10446: class="filename">PKG_REGISTER_SHELLS</code> environment
10447: variable to <code class="literal">NO</code>.</p>
1.35 jmmv 10448: </div>
10449: </div>
1.65 hubertf 10450:
1.67 hubertf 10451: <div class="sect1" lang="en">
1.65 hubertf 10452: <div class="titlepage">
10453: <div>
10454: <div>
10455: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 10456: "fonts"></a>12.6. Fonts</h2>
1.65 hubertf 10457: </div>
10458: </div>
10459: </div>
10460:
10461: <p>Packages that install X11 fonts should update the
10462: database files that index the fonts within each fonts
10463: directory. This can easily be accomplished within the
10464: pkginstall framework.</p>
10465:
10466: <p>When a package installs X11 fonts, it must list the
10467: directories in which fonts are installed in the
10468: <code class="varname">FONTS_DIRS.<em class=
10469: "replaceable"><code>type</code></em></code> variables,
10470: where <em class="replaceable"><code>type</code></em> can
10471: be one of “<span class="quote">ttf</span>”,
10472: “<span class="quote">type1</span>” or
10473: “<span class="quote">x11</span>”. This will
10474: add hooks to the installation scripts to run the
10475: appropriate commands to update the fonts database files
10476: within each of those directories. For convenience, if the
10477: directory path is relative, it is taken to be relative to
10478: the package's installation prefix. Consider the following
10479: example, taken from <a xmlns=
10480: "http://www.w3.org/TR/xhtml1/transitional" href=
10481: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/dbz-ttf/README.html"
10482: target="_top"><code xmlns="" class=
10483: "filename">fonts/dbz-ttf</code></a>:</p>
10484: <pre class="programlisting">
10485: FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF
10486: </pre>
10487:
1.67 hubertf 10488: <div class="sect2" lang="en">
1.65 hubertf 10489: <div class="titlepage">
10490: <div>
10491: <div>
1.67 hubertf 10492: <h3 class="title"><a name=
10493: "fonts-disable"></a>12.6.1. Disabling
10494: automatic update of the fonts databases</h3>
1.65 hubertf 10495: </div>
10496: </div>
10497: </div>
10498:
10499: <p>The automatic update of fonts databases can be
10500: disabled by the administrator by setting the
10501: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10502: class="filename">PKG_UPDATE_FONTS_DB</code> environment
10503: variable to <code class="literal">NO</code>.</p>
10504: </div>
10505: </div>
1.35 jmmv 10506: </div>
10507:
1.67 hubertf 10508: <div class="chapter" lang="en">
1.35 jmmv 10509: <div class="titlepage">
10510: <div>
10511: <div>
1.67 hubertf 10512: <h2 class="title"><a name=
1.38 dillo 10513: "options"></a>Chapter 13. Options
1.35 jmmv 10514: handling</h2>
10515: </div>
10516: </div>
10517: </div>
10518:
10519: <div class="toc">
10520: <p><b>Table of Contents</b></p>
10521:
10522: <dl>
10523: <dt><span class="sect1"><a href=
1.38 dillo 10524: "#global-default-options">13.1. Global default
1.35 jmmv 10525: options</a></span></dt>
10526:
10527: <dt><span class="sect1"><a href=
1.38 dillo 10528: "#converting-to-options">13.2. Converting packages to
1.45 wiz 10529: use <code xmlns=
10530: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10531: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 10532:
10533: <dt><span class="sect1"><a href="#option-names">13.3.
10534: Option Names</a></span></dt>
1.35 jmmv 10535: </dl>
10536: </div>
10537:
10538: <p>Many packages have the ability to be built to support
1.45 wiz 10539: different sets of features. <code xmlns=
10540: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10541: "filename">bsd.options.mk</code> is a framework in pkgsrc
10542: that provides generic handling of those options that
10543: determine different ways in which the packages can be
10544: built. It's possible for the user to specify exactly which
10545: sets of options will be built into a package or to allow a
10546: set of global default options apply.</p>
10547:
1.67 hubertf 10548: <div class="sect1" lang="en">
1.35 jmmv 10549: <div class="titlepage">
10550: <div>
10551: <div>
10552: <h2 class="title" style="clear: both"><a name=
1.38 dillo 10553: "global-default-options"></a>13.1. Global
1.35 jmmv 10554: default options</h2>
10555: </div>
10556: </div>
10557: </div>
10558:
10559: <p>Global default options are listed in <code class=
10560: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
10561: the options that should be built into every package if
10562: that option is supported. This variable should be set in
1.45 wiz 10563: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10564: class="filename">/etc/mk.conf</code>.</p>
1.35 jmmv 10565: </div>
10566:
1.67 hubertf 10567: <div class="sect1" lang="en">
1.35 jmmv 10568: <div class="titlepage">
10569: <div>
10570: <div>
10571: <h2 class="title" style="clear: both"><a name=
1.38 dillo 10572: "converting-to-options"></a>13.2. Converting
1.45 wiz 10573: packages to use <code xmlns=
10574: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10575: "filename">bsd.options.mk</code></h2>
10576: </div>
10577: </div>
10578: </div>
10579:
1.45 wiz 10580: <p>The following example shows how <code xmlns=
10581: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10582: "filename">bsd.options.mk</code> should be used by the
10583: hypothetical ``wibble'' package, either in the package
1.45 wiz 10584: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10585: class="filename">Makefile</code>, or in a file, e.g.
10586: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10587: class="filename">options.mk</code>, that is included by
10588: the main package <code xmlns=
10589: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10590: "filename">Makefile</code>.</p>
10591: <pre class="programlisting">
1.73 rillig 10592: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
10593: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
10594: PKG_OPTIONS_OPTIONAL_GROUPS= database
10595: PKG_OPTIONS_GROUP.database= mysql pgsql
10596: PKG_SUGGESTED_OPTIONS= wibble-foo
10597: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
10598: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
1.51 rillig 10599:
10600: .include "../../mk/bsd.prefs.mk"
10601:
10602: # this package was previously named wibble2
10603: .if defined(PKG_OPTIONS.wibble2)
1.73 rillig 10604: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
1.51 rillig 10605: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
1.73 rillig 10606: "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR instead."
1.51 rillig 10607: .endif
10608:
10609: .include "../../mk/bsd.options.mk"
10610:
10611: # Package-specific option-handling
10612:
10613: ###
10614: ### FOO support
10615: ###
10616: .if !empty(PKG_OPTIONS:Mwibble-foo)
10617: CONFIGURE_ARGS+= --enable-foo
10618: .endif
10619:
10620: ###
10621: ### LDAP support
10622: ###
10623: .if !empty(PKG_OPTIONS:Mldap)
10624: . include "../../databases/openldap/buildlink3.mk"
10625: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
10626: .endif
10627:
10628: ###
10629: ### database support
10630: ###
10631: .if !empty(PKG_OPTIONS:Mmysql)
10632: . include "../../mk/mysql.buildlink3.mk"
10633: .endif
10634: .if !empty(PKG_OPTIONS:Mpgsql)
10635: . include "../../mk/pgsql.buildlink3.mk"
10636: .endif
1.1 grant 10637: </pre>
10638:
1.28 rillig 10639: <p>The first section contains the information about which
10640: build options are supported by the package, and any
1.1 grant 10641: default options settings if needed.</p>
10642:
10643: <div class="orderedlist">
10644: <ol type="1">
10645: <li>
1.14 xtraeme 10646: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 10647: the name of the <a href=
1.1 grant 10648: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10649: <span class="citerefentry"><span class=
1.27 rillig 10650: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 10651: that the user can set to override the default
1.57 minskim 10652: options. It should be set to PKG_OPTIONS.<em class=
1.63 dillo 10653: "replaceable"><code>pkgbase</code></em>. Do not set
10654: it to PKG_OPTIONS.${PKGBASE}, since <code class=
10655: "varname">PKGBASE</code> is set after <code class=
10656: "varname">PKG_OPTIONS_VAR</code> is used.</p>
1.1 grant 10657: </li>
10658:
10659: <li>
1.14 xtraeme 10660: <p><code class=
10661: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 10662: build options supported by the package.</p>
10663: </li>
10664:
10665: <li>
10666: <p><code class=
10667: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
10668: list of names of groups of mutually exclusive
10669: options. The options in each group are listed in
10670: <code class="varname">PKG_OPTIONS_GROUP.<em class=
10671: "replaceable"><code>groupname</code></em></code>.
10672: The most specific setting of any option from the
10673: group takes precedence over all other options in
10674: the group. Options from the groups will be
10675: automatically added to <code class=
10676: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
10677: </li>
10678:
10679: <li>
10680: <p><code class=
10681: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
10682: like <code class=
10683: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
10684: building the packages will fail if no option from
10685: the group is selected.</p>
1.1 grant 10686: </li>
10687:
10688: <li>
1.27 rillig 10689: <p><code class=
1.44 gdt 10690: "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
10691: list of names of sets of options. At least one
10692: option from each set must be selected. The options
10693: in each set are listed in <code class=
10694: "varname">PKG_OPTIONS_SET.<em class=
10695: "replaceable"><code>setname</code></em></code>.
10696: Options from the sets will be automatically added
10697: to <code class=
10698: "varname">PKG_SUPPORTED_OPTIONS</code>. Building
10699: the package will fail if no option from the set is
10700: selected.</p>
10701: </li>
10702:
10703: <li>
10704: <p><code class=
1.27 rillig 10705: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
10706: build options which are enabled by default.</p>
10707: </li>
10708:
10709: <li>
1.37 dillo 10710: <p><code class=
10711: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
10712: of “<span class="quote"><em class=
1.67 hubertf 10713: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>”
10714: pairs that map legacy <code xmlns=
1.45 wiz 10715: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 10716: "filename">/etc/mk.conf</code> variables to their
10717: option counterparts. Pairs should be added with
10718: “<span class="quote">+=</span>” to keep
10719: the listing of global legacy variables. A warning
10720: will be issued if the user uses a legacy
10721: variable.</p>
10722: </li>
1.1 grant 10723:
1.37 dillo 10724: <li>
10725: <p><code class=
10726: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
10727: of “<span class="quote"><em class=
1.67 hubertf 10728: "replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>”
10729: pairs that map options that have been renamed to
10730: their new counterparts. Pairs should be added with
1.37 dillo 10731: “<span class="quote">+=</span>” to keep
10732: the listing of global legacy options. A warning
10733: will be issued if the user uses a legacy
10734: option.</p>
10735: </li>
1.1 grant 10736:
1.37 dillo 10737: <li>
10738: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
10739: is a list of options implied by deprecated
10740: variables used. This can be used for cases that
10741: neither <code class=
10742: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
10743: <code class=
10744: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
10745: handle, e. g. when <code class=
10746: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 10747: </li>
10748:
10749: <li>
1.37 dillo 10750: <p><code class=
10751: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
10752: a list of warnings about deprecated variables or
10753: options used, and what to use instead.</p>
1.1 grant 10754: </li>
1.28 rillig 10755: </ol>
1.1 grant 10756: </div>
10757:
1.37 dillo 10758: <p>A package should never modify <code class=
10759: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
10760: named in <code class="varname">PKG_OPTIONS_VAR</code>.
10761: These are strictly user-settable. To suggest a default
10762: set of options, use <code class=
10763: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
10764:
1.42 dillo 10765: <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45 wiz 10766: defined before including <code xmlns=
10767: "http://www.w3.org/TR/xhtml1/transitional" class=
1.42 dillo 10768: "filename">bsd.options.mk</code>. If none of <code class=
1.37 dillo 10769: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
10770: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
10771: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47 reed 10772: are defined (as can happen with platform-specific options
1.42 dillo 10773: if none of them is supported on the current platform),
10774: <code class="varname">PKG_OPTIONS</code> is set to the
10775: empty list and the package is otherwise treated as not
10776: using the options framework.</p>
1.37 dillo 10777:
1.45 wiz 10778: <p>After the inclusion of <code xmlns=
10779: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 10780: "filename">bsd.options.mk</code>, the variable
1.28 rillig 10781: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 10782: list of selected build options, properly filtered to
1.28 rillig 10783: remove unsupported and duplicate options.</p>
10784:
1.1 grant 10785: <p>The remaining sections contain the logic that is
1.37 dillo 10786: specific to each option. The correct way to check for an
10787: option is to check whether it is listed in <code class=
10788: "varname">PKG_OPTIONS</code>:</p>
10789: <pre class="programlisting">
1.51 rillig 10790: .if !empty(PKG_OPTIONS:M<em class=
1.37 dillo 10791: "replaceable"><code>option</code></em>)
10792: </pre>
1.48 dillo 10793: </div>
1.37 dillo 10794:
1.67 hubertf 10795: <div class="sect1" lang="en">
1.48 dillo 10796: <div class="titlepage">
10797: <div>
10798: <div>
10799: <h2 class="title" style="clear: both"><a name=
10800: "option-names"></a>13.3. Option Names</h2>
10801: </div>
10802: </div>
10803: </div>
10804:
10805: <p>Options that enable similar features in different
10806: packages (like optional support for a library) should use
10807: a common name in all packages that support it (like the
10808: name of the library). If another package already has an
10809: option with the same meaning, use the same name.</p>
10810:
10811: <p>Options that enable features specific to one package,
10812: where it's unlikely that another (unrelated) package has
10813: the same (or a similar) optional feature, should use a
10814: name prefixed with <code class="varname"><em class=
10815: "replaceable"><code>pkgname</code></em>-</code>.</p>
10816:
10817: <p>If a group of related packages share an optional
10818: feature specific to that group, prefix it with the name
10819: of the “<span class="quote">main</span>”
10820: package (e. g. <code class=
10821: "varname">djbware-errno-hack</code>).</p>
10822:
10823: <p>For new options, add a line to <code xmlns=
10824: "http://www.w3.org/TR/xhtml1/transitional" class=
10825: "filename">mk/defaults/options.description</code>. Lines
10826: have two fields, separated by tab. The first field is the
10827: option name, the second its description. The description
10828: should be a whole sentence (starting with an uppercase
10829: letter and ending with a period) that describes what
10830: enabling the option does. E. g. “<span class=
10831: "quote">Enable ispell support.</span>” The file is
10832: sorted by option names.</p>
1.1 grant 10833: </div>
10834: </div>
10835:
1.67 hubertf 10836: <div class="chapter" lang="en">
1.1 grant 10837: <div class="titlepage">
10838: <div>
10839: <div>
1.67 hubertf 10840: <h2 class="title"><a name=
1.38 dillo 10841: "build"></a>Chapter 14. The build
1.1 grant 10842: process</h2>
10843: </div>
10844: </div>
10845: </div>
10846:
10847: <div class="toc">
10848: <p><b>Table of Contents</b></p>
10849:
10850: <dl>
1.56 rillig 10851: <dt><span class="sect1"><a href="#build.intro">14.1.
10852: Introduction</a></span></dt>
10853:
10854: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 10855: Program location</a></span></dt>
10856:
1.56 rillig 10857: <dt><span class="sect1"><a href=
10858: "#build.builddirs">14.3. Directories used during the
10859: build process</a></span></dt>
10860:
10861: <dt><span class="sect1"><a href="#build.running">14.4.
10862: Running a phase</a></span></dt>
10863:
10864: <dt><span class="sect1"><a href="#build.fetch">14.5.
10865: The <span class="emphasis"><em>fetch</em></span>
10866: phase</a></span></dt>
10867:
10868: <dt><span class="sect1"><a href="#build.checksum">14.6.
10869: The <span class="emphasis"><em>checksum</em></span>
10870: phase</a></span></dt>
10871:
10872: <dt><span class="sect1"><a href="#build.extract">14.7.
10873: The <span class="emphasis"><em>extract</em></span>
10874: phase</a></span></dt>
10875:
10876: <dt><span class="sect1"><a href="#build.patch">14.8.
10877: The <span class="emphasis"><em>patch</em></span>
10878: phase</a></span></dt>
10879:
10880: <dt><span class="sect1"><a href="#build.tools">14.9.
10881: The <span class="emphasis"><em>tools</em></span>
10882: phase</a></span></dt>
10883:
10884: <dt><span class="sect1"><a href="#build.wrapper">14.10.
10885: The <span class="emphasis"><em>wrapper</em></span>
10886: phase</a></span></dt>
1.1 grant 10887:
10888: <dt><span class="sect1"><a href=
1.56 rillig 10889: "#build.configure">14.11. The <span class=
10890: "emphasis"><em>configure</em></span>
10891: phase</a></span></dt>
10892:
10893: <dt><span class="sect1"><a href="#build.build">14.12.
10894: The <span class="emphasis"><em>build</em></span>
10895: phase</a></span></dt>
10896:
10897: <dt><span class="sect1"><a href="#build.test">14.13.
10898: The <span class="emphasis"><em>test</em></span>
10899: phase</a></span></dt>
10900:
10901: <dt><span class="sect1"><a href="#build.install">14.14.
10902: The <span class="emphasis"><em>install</em></span>
10903: phase</a></span></dt>
10904:
10905: <dt><span class="sect1"><a href="#build.package">14.15.
10906: The <span class="emphasis"><em>package</em></span>
10907: phase</a></span></dt>
10908:
10909: <dt><span class="sect1"><a href=
10910: "#build.helpful-targets">14.16. Other helpful
1.1 grant 10911: targets</a></span></dt>
10912: </dl>
10913: </div>
10914:
1.67 hubertf 10915: <div class="sect1" lang="en">
1.56 rillig 10916: <div class="titlepage">
10917: <div>
10918: <div>
10919: <h2 class="title" style="clear: both"><a name=
10920: "build.intro"></a>14.1. Introduction</h2>
10921: </div>
10922: </div>
10923: </div>
10924:
10925: <p>This chapter gives a detailed description on how a
10926: package is built. Building a package is separated into
10927: different <span class="emphasis"><em>phases</em></span>
10928: (for example <code class="varname">fetch</code>,
10929: <code class="varname">build</code>, <code class=
10930: "varname">install</code>), all of which are described in
10931: the following sections. Each phase is splitted into
10932: so-called <span class="emphasis"><em>stages</em></span>,
1.66 rillig 10933: which take the name of the containing phase, prefixed by
1.56 rillig 10934: one of <code class="varname">pre-</code>, <code class=
10935: "varname">do-</code> or <code class=
10936: "varname">post-</code>. (Examples are <code class=
10937: "varname">pre-configure</code>, <code class=
10938: "varname">post-build</code>.) Most of the actual work is
10939: done in the <code class="varname">do-*</code> stages.</p>
10940:
10941: <p>The basic steps for building a program are always the
10942: same. First the program's source (<span class=
10943: "emphasis"><em>distfile</em></span>) must be brought to
1.66 rillig 10944: the local system and then extracted. After any
10945: pkgsrc-specific patches to compile properly are applied,
10946: the software can be configured, then built (usually by
10947: compiling), and finally the generated binaries, etc. can
10948: be put into place on the system.</p>
1.56 rillig 10949: </div>
1.1 grant 10950:
1.67 hubertf 10951: <div class="sect1" lang="en">
1.1 grant 10952: <div class="titlepage">
10953: <div>
10954: <div>
10955: <h2 class="title" style="clear: both"><a name=
1.56 rillig 10956: "build.prefix"></a>14.2. Program location</h2>
1.1 grant 10957: </div>
10958: </div>
10959: </div>
10960:
10961: <p>Before outlining the process performed by the NetBSD
10962: package system in the next section, here's a brief
10963: discussion on where programs are installed, and which
10964: variables influence this.</p>
10965:
1.14 xtraeme 10966: <p>The automatic variable <code class=
10967: "varname">PREFIX</code> indicates where all files of the
10968: final program shall be installed. It is usually set to
1.45 wiz 10969: <code class="varname">LOCALBASE</code> (<code xmlns=
10970: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10971: "filename">/usr/pkg</code>), or <code class=
10972: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 10973: “<span class="quote">cross</span>” category.
1.14 xtraeme 10974: The value of <code class="varname">PREFIX</code> needs to
10975: be put into the various places in the program's source
10976: where paths to these files are encoded. See <a href=
1.1 grant 10977: "#components.patches" title=
1.38 dillo 10978: "8.3. patches/*">Section 8.3,
1.1 grant 10979: “patches/*”</a> and <a href="#fixes.libtool"
10980: title=
1.68 rillig 10981: "16.3.1. Shared libraries - libtool">Section 16.3.1,
1.1 grant 10982: “Shared libraries - libtool”</a> for more
10983: details.</p>
10984:
10985: <p>When choosing which of these variables to use, follow
10986: the following rules:</p>
10987:
10988: <div class="itemizedlist">
10989: <ul type="disc">
10990: <li>
1.14 xtraeme 10991: <p><code class="varname">PREFIX</code> always
10992: points to the location where the current pkg will
10993: be installed. When referring to a pkg's own
1.1 grant 10994: installation path, use “<span class=
10995: "quote">${PREFIX}</span>”.</p>
10996: </li>
10997:
10998: <li>
1.14 xtraeme 10999: <p><code class="varname">LOCALBASE</code> is where
11000: all non-X11 pkgs are installed. If you need to
1.1 grant 11001: construct a -I or -L argument to the compiler to
11002: find includes and libraries installed by another
11003: non-X11 pkg, use “<span class=
11004: "quote">${LOCALBASE}</span>”.</p>
11005: </li>
11006:
11007: <li>
1.14 xtraeme 11008: <p><code class="varname">X11BASE</code> is where
11009: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 11010: installed. When looking for <span class=
11011: "emphasis"><em>standard</em></span> X11 includes
11012: (not those installed by a pkg), use
11013: “<span class=
11014: "quote">${X11BASE}</span>”.</p>
11015: </li>
11016:
11017: <li>
1.47 reed 11018: <p>X11-based packages are special in that they may
11019: be installed in either <code class=
1.14 xtraeme 11020: "varname">X11BASE</code> or <code class=
11021: "varname">LOCALBASE</code>.</p>
1.1 grant 11022:
11023: <p>Usually, X11 packages should be installed under
1.14 xtraeme 11024: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 11025: possible. Note that you will need to include
1.45 wiz 11026: <code xmlns=
11027: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 11028: "filename">../../mk/x11.buildlink3.mk</code> in
11029: them to request the presence of X11 and to get the
11030: right compilation flags.</p>
1.1 grant 11031:
11032: <p>Even though, there are some packages that cannot
1.14 xtraeme 11033: be installed under <code class=
11034: "varname">LOCALBASE</code>: those that come with
1.1 grant 11035: app-defaults files. These packages are special and
1.14 xtraeme 11036: they must be placed under <code class=
11037: "varname">X11BASE</code>. To accomplish this, set
11038: either <code class="varname">USE_X11BASE</code> or
11039: <code class="varname">USE_IMAKE</code> in your
1.1 grant 11040: package.</p>
11041:
1.34 wiz 11042: <p>Some notes: If you need to find includes or
1.14 xtraeme 11043: libraries installed by a pkg that has <code class=
11044: "varname">USE_IMAKE</code> or <code class=
11045: "varname">USE_X11BASE</code> in its pkg
1.45 wiz 11046: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11047: class="filename">Makefile</code>, you need to look
11048: in <span class="emphasis"><em>both</em></span>
11049: <code xmlns=
11050: "http://www.w3.org/TR/xhtml1/transitional" class=
11051: "filename">${X11BASE}</code> and <code xmlns=
11052: "http://www.w3.org/TR/xhtml1/transitional" class=
11053: "filename">${LOCALBASE}</code>. To force
11054: installation of all X11 packages in <code class=
11055: "varname">LOCALBASE</code>, the <a xmlns=
11056: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 11057: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 11058: target="_top"><code xmlns="" class=
11059: "filename">pkgtools/xpkgwedge</code></a> package is
1.34 wiz 11060: enabled by default.</p>
1.1 grant 11061: </li>
11062:
11063: <li>
1.14 xtraeme 11064: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 11065: used to refer to the installed location of an X11
1.14 xtraeme 11066: package. <code class="varname">X11PREFIX</code>
11067: will be set to <code class="varname">X11BASE</code>
11068: if xpkgwedge is not installed, and to <code class=
11069: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 11070: installed.</p>
11071: </li>
11072:
11073: <li>
11074: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 11075: have some packages installed in <code class=
11076: "varname">X11BASE</code> and some in <code class=
11077: "varname">LOCALBASE</code>. To determine the prefix
11078: of an installed package, the <code class=
11079: "varname">EVAL_PREFIX</code> definition can be
11080: used. It takes pairs in the format
11081: “<span class=
1.1 grant 11082: "quote">DIRNAME=<package></span>”, and
1.24 wiz 11083: the <a href=
11084: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
11085: <span class="citerefentry"><span class=
11086: "refentrytitle">make</span>(1)</span></a> variable
11087: <code class="varname">DIRNAME</code> will be set to
11088: the prefix of the installed package
11089: <package>, or “<span class=
1.1 grant 11090: "quote">${X11PREFIX}</span>” if the package
11091: is not installed.</p>
11092:
11093: <p>This is best illustrated by example.</p>
11094:
1.45 wiz 11095: <p>The following lines are taken from <code xmlns=
11096: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11097: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 11098: <pre class="programlisting">
1.51 rillig 11099: EVAL_PREFIX+= GTKDIR=gtk+
1.69 rillig 11100: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE:Q}
11101: CONFIGURE_ARGS+= --with-gtk-prefix=${GTKDIR:Q}
11102: CONFIGURE_ARGS+= --enable-multibyte
1.1 grant 11103: </pre>
11104:
11105: <p>Specific defaults can be defined for the
1.14 xtraeme 11106: packages evaluated using <code class=
11107: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 11108: of the form:</p>
11109: <pre class="programlisting">
1.51 rillig 11110: GTKDIR_DEFAULT= ${LOCALBASE}
1.1 grant 11111: </pre>
11112:
1.14 xtraeme 11113: <p>where <code class="varname">GTKDIR</code>
1.1 grant 11114: corresponds to the first definition in the
1.14 xtraeme 11115: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 11116: </li>
11117:
11118: <li>
1.45 wiz 11119: <p>Within <code xmlns=
11120: "http://www.w3.org/TR/xhtml1/transitional" class=
11121: "filename">${PREFIX}</code>, packages should
11122: install files according to <a href=
1.24 wiz 11123: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
11124: <span class="citerefentry"><span class=
11125: "refentrytitle">hier</span>(7)</span></a>, with the
1.45 wiz 11126: exception that manual pages go into <code xmlns=
11127: "http://www.w3.org/TR/xhtml1/transitional" class=
11128: "filename">${PREFIX}/man</code>, not <code xmlns=
11129: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11130: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 11131: </li>
11132: </ul>
11133: </div>
11134: </div>
11135:
1.67 hubertf 11136: <div class="sect1" lang="en">
1.1 grant 11137: <div class="titlepage">
11138: <div>
11139: <div>
11140: <h2 class="title" style="clear: both"><a name=
1.56 rillig 11141: "build.builddirs"></a>14.3. Directories used
11142: during the build process</h2>
1.1 grant 11143: </div>
11144: </div>
11145: </div>
11146:
1.56 rillig 11147: <p>When building a package, a number of directories is
11148: used to store source files, temporary files,
11149: pkgsrc-internal files, and so on. These directories are
11150: explained here.</p>
11151:
11152: <p>Some of the directory variables contain relative
11153: pathnames. There are two common base directories for
11154: these relative directories: <code class=
11155: "varname">PKGSRCDIR/PKGPATH</code> is used for
11156: directories that are pkgsrc-specific. <code class=
11157: "varname">WRKSRC</code> is used for directories inside
1.66 rillig 11158: the package itself.</p>
1.1 grant 11159:
11160: <div class="variablelist">
11161: <dl>
1.56 rillig 11162: <dt><span class="term"><code class=
1.66 rillig 11163: "varname">PKGSRCDIR</code></span></dt>
1.56 rillig 11164:
11165: <dd>
11166: <p>This is an absolute pathname that points to the
11167: pkgsrc root directory. Generally, you don't need
11168: it.</p>
11169: </dd>
11170:
11171: <dt><span class="term"><code class=
1.66 rillig 11172: "varname">PKGPATH</code></span></dt>
1.1 grant 11173:
11174: <dd>
1.56 rillig 11175: <p>This is a pathname relative to <code class=
11176: "varname">PKGSRCDIR</code> that points to the
11177: current package.</p>
11178: </dd>
11179:
11180: <dt><span class="term"><code class=
1.66 rillig 11181: "varname">WRKDIR</code></span></dt>
1.56 rillig 11182:
11183: <dd>
11184: <p>This is an absolute pathname pointing to the
1.57 minskim 11185: directory where all work takes place. The distfiles
11186: are extraced to this directory. It also contains
11187: temporary directories and log files used by the
11188: various pkgsrc frameworks, like <span class=
11189: "emphasis"><em>buildlink</em></span> or the
11190: <span class=
1.56 rillig 11191: "emphasis"><em>wrappers</em></span>.</p>
11192: </dd>
11193:
11194: <dt><span class="term"><code class=
1.66 rillig 11195: "varname">WRKSRC</code></span></dt>
1.56 rillig 11196:
11197: <dd>
11198: <p>This is an absolute pathname pointing to the
11199: directory where the distfiles are extracted. It is
11200: usually a direct subdirectory of <code class=
11201: "varname">WRKDIR</code>, and often it's the only
1.66 rillig 11202: directory entry that isn't hidden. This variable
11203: may be changed by a package <code xmlns=
11204: "http://www.w3.org/TR/xhtml1/transitional" class=
11205: "filename">Makefile</code>.</p>
1.56 rillig 11206: </dd>
11207: </dl>
11208: </div>
11209: </div>
11210:
1.67 hubertf 11211: <div class="sect1" lang="en">
1.56 rillig 11212: <div class="titlepage">
11213: <div>
11214: <div>
11215: <h2 class="title" style="clear: both"><a name=
11216: "build.running"></a>14.4. Running a phase</h2>
11217: </div>
11218: </div>
11219: </div>
11220:
11221: <p>You can run a particular phase by typing
11222: <span><strong class="command">make phase</strong></span>,
11223: where <span class="emphasis"><em>phase</em></span> is the
11224: name of the phase. This will automatically run all phases
11225: that are required for this phase. The default phase is
11226: <code class="varname">build</code>, that is, when you run
11227: <span><strong class="command">make</strong></span>
11228: without parameters in a package directory, the package
11229: will be built, but not installed.</p>
11230: </div>
11231:
1.67 hubertf 11232: <div class="sect1" lang="en">
1.56 rillig 11233: <div class="titlepage">
11234: <div>
11235: <div>
11236: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11237: "build.fetch"></a>14.5. The <span class=
11238: "emphasis"><em>fetch</em></span> phase</h2>
1.56 rillig 11239: </div>
11240: </div>
11241: </div>
11242:
11243: <p>This will check if the file(s) given in the variables
11244: <code class="varname">DISTFILES</code> and <code class=
11245: "varname">PATCHFILES</code> (as defined in the package's
11246: Makefile) are present on the local system in <code xmlns=
11247: "http://www.w3.org/TR/xhtml1/transitional" class=
11248: "filename">/usr/pkgsrc/distfiles</code>. If they are not
11249: present, an attempt will be made to fetch them using
11250: commands of the form:</p>
11251: <pre class="programlisting">
1.51 rillig 11252: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 grant 11253: </pre>
11254:
1.56 rillig 11255: <p>where ${site} varies through several possibilities in
11256: turn: first, <code class=
11257: "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
11258: sites specified in either <code class=
1.72 rillig 11259: "varname">SITES.file</code> if defined, else <code class=
1.56 rillig 11260: "varname">MASTER_SITES</code> or <code class=
11261: "varname">PATCH_SITES</code>, as applies, then finally
11262: the value of <code class=
11263: "varname">MASTER_SITE_BACKUP</code>. The order of all
11264: except the first can be optionally sorted by the user,
11265: via setting either <code class=
11266: "varname">MASTER_SORT_AWK</code> or <code class=
11267: "varname">MASTER_SORT_REGEX</code>.</p>
11268: </div>
11269:
1.67 hubertf 11270: <div class="sect1" lang="en">
1.56 rillig 11271: <div class="titlepage">
11272: <div>
11273: <div>
11274: <h2 class="title" style="clear: both"><a name=
11275: "build.checksum"></a>14.6. The <span class=
11276: "emphasis"><em>checksum</em></span> phase</h2>
11277: </div>
11278: </div>
11279: </div>
11280:
11281: <p>After the distfile(s) are fetched, their checksum is
11282: generated and compared with the checksums stored in the
11283: distinfo file. If the checksums don't match, the build is
11284: aborted. This is to ensure the same distfile is used for
11285: building, and that the distfile wasn't changed, e.g. by
11286: some malign force, deliberately changed distfiles on the
11287: master distribution site or network lossage.</p>
11288: </div>
11289:
1.67 hubertf 11290: <div class="sect1" lang="en">
1.56 rillig 11291: <div class="titlepage">
11292: <div>
11293: <div>
11294: <h2 class="title" style="clear: both"><a name=
11295: "build.extract"></a>14.7. The <span class=
11296: "emphasis"><em>extract</em></span> phase</h2>
11297: </div>
11298: </div>
11299: </div>
11300:
11301: <p>When the distfiles are present on the local system,
1.69 rillig 11302: they need to be extracted, as they usually come in the
11303: form of some compressed archive format.</p>
11304:
11305: <p>By default, all <code class="varname">DISTFILES</code>
11306: are extracted. If you only need some of them, you can set
11307: the <code class="varname">EXTRACT_ONLY</code> variable to
11308: the list of those files.</p>
11309:
11310: <p>Extracting the files is usually done by a little
11311: program, <code xmlns=
11312: "http://www.w3.org/TR/xhtml1/transitional" class=
11313: "filename">mk/scripts/extract</code>, which already knows
11314: how to extract various archive formats, so most likely
11315: you will not need to change anything here. But if you
11316: need, the following variables may help you:</p>
11317:
11318: <div class="variablelist">
11319: <dl>
11320: <dt><span class="term"><code class=
11321: "varname">EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}</code></span></dt>
11322:
11323: <dd>
11324: <p>Use these variables to override the default
11325: options for an extract command, which are defined
11326: in <code xmlns=
11327: "http://www.w3.org/TR/xhtml1/transitional" class=
11328: "filename">mk/scripts/extract</code>.</p>
11329: </dd>
1.1 grant 11330:
1.69 rillig 11331: <dt><span class="term"><code class=
11332: "varname">EXTRACT_USING</code></span></dt>
1.1 grant 11333:
1.69 rillig 11334: <dd>
11335: <p>This variable can be set to <code class=
11336: "literal">pax</code>, <code class=
11337: "literal">tar</code> or an absolute pathname
11338: pointing to the command with which tar archives
11339: should be extracted.</p>
11340: </dd>
11341: </dl>
11342: </div>
11343:
11344: <p>If the <code xmlns=
1.56 rillig 11345: "http://www.w3.org/TR/xhtml1/transitional" class=
1.69 rillig 11346: "filename">extract</code> program doesn't serve your
11347: needs, you can also override the <code class=
11348: "varname">EXTRACT_CMD</code> variable, which holds the
11349: command used for extracting the files. This command is
11350: executed in the <code xmlns=
11351: "http://www.w3.org/TR/xhtml1/transitional" class=
11352: "filename">${WRKSRC}</code> directory. During execution
11353: of this command, the shell variable <code class=
11354: "varname">extract_file</code> holds the absolute pathname
11355: of the file that is going to be extracted.</p>
11356:
11357: <p>And if that still does not suffice, you can override
11358: the <code class="varname">do-extract</code> target in the
11359: package Makefile.</p>
1.56 rillig 11360: </div>
11361:
1.67 hubertf 11362: <div class="sect1" lang="en">
1.56 rillig 11363: <div class="titlepage">
11364: <div>
11365: <div>
11366: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11367: "build.patch"></a>14.8. The <span class=
11368: "emphasis"><em>patch</em></span> phase</h2>
1.56 rillig 11369: </div>
11370: </div>
11371: </div>
11372:
11373: <p>After extraction, all the patches named by the
11374: <code class="varname">PATCHFILES</code>, those present in
11375: the patches subdirectory of the package as well as in
11376: $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
11377: "http://www.w3.org/TR/xhtml1/transitional" class=
11378: "filename">/usr/local/patches/graphics/png</code>) are
11379: applied. Patchfiles ending in <code xmlns=
11380: "http://www.w3.org/TR/xhtml1/transitional" class=
11381: "filename">.Z</code> or <code xmlns=
11382: "http://www.w3.org/TR/xhtml1/transitional" class=
11383: "filename">.gz</code> are uncompressed before they are
11384: applied, files ending in <code xmlns=
11385: "http://www.w3.org/TR/xhtml1/transitional" class=
11386: "filename">.orig</code> or <code xmlns=
11387: "http://www.w3.org/TR/xhtml1/transitional" class=
11388: "filename">.rej</code> are ignored. Any special options
11389: to <a href=
11390: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
11391: <span class="citerefentry"><span class=
11392: "refentrytitle">patch</span>(1)</span></a> can be handed
11393: in <code class="varname">PATCH_DIST_ARGS</code>. See
11394: <a href="#components.patches" title=
11395: "8.3. patches/*">Section 8.3,
11396: “patches/*”</a> for more details.</p>
11397:
11398: <p>By default <a href=
11399: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
11400: <span class="citerefentry"><span class=
11401: "refentrytitle">patch</span>(1)</span></a> is given
11402: special args to make it fail if the patches apply with
11403: some lines of fuzz. Please fix (regen) the patches so
11404: that they apply cleanly. The rationale behind this is
11405: that patches that don't apply cleanly may end up being
11406: applied in the wrong place, and cause severe harm
11407: there.</p>
11408: </div>
11409:
1.67 hubertf 11410: <div class="sect1" lang="en">
1.56 rillig 11411: <div class="titlepage">
11412: <div>
11413: <div>
11414: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11415: "build.tools"></a>14.9. The <span class=
11416: "emphasis"><em>tools</em></span> phase</h2>
1.56 rillig 11417: </div>
11418: </div>
11419: </div>
11420:
1.68 rillig 11421: <p>This is covered in <a href="#tools" title=
11422: "Chapter 15. Tools needed for building or running">
11423: Chapter 15, <i>Tools needed for building or
11424: running</i></a>.</p>
1.56 rillig 11425: </div>
11426:
1.67 hubertf 11427: <div class="sect1" lang="en">
1.56 rillig 11428: <div class="titlepage">
11429: <div>
11430: <div>
11431: <h2 class="title" style="clear: both"><a name=
11432: "build.wrapper"></a>14.10. The <span class=
11433: "emphasis"><em>wrapper</em></span> phase</h2>
11434: </div>
11435: </div>
11436: </div>
11437:
1.72 rillig 11438: <p>This phase creates wrapper programs for the compilers
11439: and linkers. The following variables can be used to tweak
11440: the wrappers.</p>
11441:
11442: <div class="variablelist">
11443: <dl>
11444: <dt><span class="term"><code class=
11445: "varname">ECHO_WRAPPER_MSG</code></span></dt>
11446:
11447: <dd>
11448: <p>The command used to print progress messages.
11449: Does nothing by default. Set to <code class=
11450: "literal">${ECHO}</code> to see the progress
11451: messages.</p>
11452: </dd>
11453:
11454: <dt><span class="term"><code class=
11455: "varname">WRAPPER_DEBUG</code></span></dt>
11456:
11457: <dd>
11458: <p>This variable can be set to <code class=
11459: "literal">yes</code> (default) or <code class=
11460: "literal">no</code>, depending on whether you want
11461: additional information in the wrapper log file.</p>
11462: </dd>
11463:
11464: <dt><span class="term"><code class=
11465: "varname">WRAPPER_UPDATE_CACHE</code></span></dt>
11466:
11467: <dd>
11468: <p>This variable can be set to <code class=
11469: "literal">yes</code> or <code class=
11470: "literal">no</code>, depending on whether the
11471: wrapper should use its cache, which will improve
11472: the speed. The default value is <code class=
11473: "literal">yes</code>, but is forced to <code class=
11474: "literal">no</code> if the platform does not
11475: support it.</p>
11476: </dd>
11477:
11478: <dt><span class="term"><code class=
11479: "varname">WRAPPER_REORDER_CMDS</code></span></dt>
11480:
11481: <dd>
11482: <p>A list of reordering commands. A reordering
11483: command has the form <code class=
11484: "literal">reorder:l:<em class=
11485: "replaceable"><code>lib1</code></em>:<em class=
11486: "replaceable"><code>lib2</code></em></code>. It
11487: ensures that that <code class=
11488: "literal">-l<em class="replaceable"><code>lib1</code></em></code>
11489: occurs before <code class="literal">-l<em class=
11490: "replaceable"><code>lib2</code></em></code>.</p>
11491: </dd>
11492:
11493: <dt><span class="term"><code class=
11494: "varname">WRAPPER_TRANSFORM_CMDS</code></span></dt>
11495:
11496: <dd>
11497: <p>A list of transformation commands. [TODO:
11498: investigate further]</p>
11499: </dd>
11500: </dl>
11501: </div>
1.56 rillig 11502: </div>
11503:
1.67 hubertf 11504: <div class="sect1" lang="en">
1.56 rillig 11505: <div class="titlepage">
11506: <div>
11507: <div>
11508: <h2 class="title" style="clear: both"><a name=
11509: "build.configure"></a>14.11. The <span class=
11510: "emphasis"><em>configure</em></span> phase</h2>
11511: </div>
11512: </div>
11513: </div>
11514:
11515: <p>Most pieces of software need information on the header
11516: files, system calls, and library routines which are
11517: available on the platform they run on. The process of
11518: determining this information is known as configuration,
11519: and is usually automated. In most cases, a script is
11520: supplied with the distfiles, and its invocation results
11521: in generation of header files, Makefiles, etc.</p>
11522:
11523: <p>If the package contains a configure script, this can
11524: be invoked by setting <code class=
11525: "varname">HAS_CONFIGURE</code> to “<span class=
11526: "quote">yes</span>”. If the configure script is a
11527: GNU autoconf script, you should set <code class=
11528: "varname">GNU_CONFIGURE</code> to “<span class=
11529: "quote">yes</span>” instead. What happens in the
11530: <span class="emphasis"><em>configure</em></span> phase is
11531: roughly:</p>
11532: <pre class="programlisting">
11533: .for d in ${CONFIGURE_DIRS}
11534: cd ${WRKSRC} && cd ${d} && env ${CONFIGURE_ENV} \
11535: ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
11536: .endfor
11537: </pre>
1.1 grant 11538:
1.56 rillig 11539: <p><code class="varname">CONFIGURE_DIRS</code> (default:
11540: “<span class="quote">.</span>”) is a list of
11541: pathnames relative to <code class=
11542: "varname">WRKSRC</code>. In each of these directories,
11543: the configure script is run with the environment
11544: <code class="varname">CONFIGURE_ENV</code> and arguments
11545: <code class="varname">CONFIGURE_ARGS</code>. The
11546: variables <code class="varname">CONFIGURE_ENV</code>,
11547: <code class="varname">CONFIGURE_SCRIPT</code> (default:
11548: “<span class="quote">./configure</span>”) and
11549: <code class="varname">CONFIGURE_ARGS</code> may all be
11550: changed by the package.</p>
1.1 grant 11551:
1.56 rillig 11552: <p>If the program uses an <code xmlns=
11553: "http://www.w3.org/TR/xhtml1/transitional" class=
11554: "filename">Imakefile</code> for configuration, the
11555: appropriate steps can be invoked by setting <code class=
11556: "varname">USE_IMAKE</code> to “<span class=
11557: "quote">yes</span>”. (If you only want the package
11558: installed in <code class="varname">${X11PREFIX}</code>
11559: but xmkmf not being run, set <code class=
11560: "varname">USE_X11BASE</code> instead.)</p>
11561: </div>
1.1 grant 11562:
1.67 hubertf 11563: <div class="sect1" lang="en">
1.56 rillig 11564: <div class="titlepage">
11565: <div>
11566: <div>
11567: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11568: "build.build"></a>14.12. The <span class=
11569: "emphasis"><em>build</em></span> phase</h2>
1.56 rillig 11570: </div>
11571: </div>
1.1 grant 11572: </div>
11573:
1.56 rillig 11574: <p>For building a package, a rough equivalent of the
11575: following code is executed.</p>
1.1 grant 11576: <pre class="programlisting">
1.56 rillig 11577: .for d in ${BUILD_DIRS}
11578: cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \
11579: ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
11580: -f ${MAKEFILE} ${BUILD_TARGET}
11581: .endfor
1.1 grant 11582: </pre>
1.56 rillig 11583:
11584: <p><code class="varname">BUILD_DIRS</code> (default:
11585: “<span class="quote">.</span>”) is a list of
11586: pathnames relative to <code class=
11587: "varname">WRKSRC</code>. In each of these directories,
11588: <code class="varname">MAKE_PROGRAM</code> is run with the
11589: environment <code class="varname">MAKE_ENV</code> and
11590: arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
11591: The variables <code class="varname">MAKE_ENV</code>,
11592: <code class="varname">BUILD_MAKE_FLAGS</code>,
11593: <code class="varname">MAKEFILE</code> and <code class=
11594: "varname">BUILD_TARGET</code> may all be changed by the
11595: package.</p>
11596:
11597: <p>The default value of <code class=
11598: "varname">MAKE_PROGRAM</code> is “<span class=
11599: "quote">gmake</span>” if <code class=
11600: "varname">USE_TOOLS</code> contains “<span class=
11601: "quote">gmake</span>”, “<span class=
11602: "quote">make</span>” otherwise. The default value
11603: of <code class="varname">MAKEFILE</code> is
11604: “<span class="quote">Makefile</span>”, and
11605: <code class="varname">BUILD_TARGET</code> defaults to
11606: “<span class="quote">all</span>”.</p>
11607: </div>
11608:
1.67 hubertf 11609: <div class="sect1" lang="en">
1.56 rillig 11610: <div class="titlepage">
11611: <div>
11612: <div>
11613: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11614: "build.test"></a>14.13. The <span class=
11615: "emphasis"><em>test</em></span> phase</h2>
1.56 rillig 11616: </div>
11617: </div>
11618: </div>
11619:
11620: <p>[TODO]</p>
11621: </div>
11622:
1.67 hubertf 11623: <div class="sect1" lang="en">
1.56 rillig 11624: <div class="titlepage">
11625: <div>
11626: <div>
11627: <h2 class="title" style="clear: both"><a name=
11628: "build.install"></a>14.14. The <span class=
11629: "emphasis"><em>install</em></span> phase</h2>
11630: </div>
11631: </div>
11632: </div>
11633:
11634: <p>Once the build stage has completed, the final step is
11635: to install the software in public directories, so users
1.68 rillig 11636: can access the programs and files.</p>
11637:
11638: <p>In the <span class="emphasis"><em>install</em></span>
11639: phase, a rough equivalent of the following code is
11640: executed. Additionally, before and after this code, much
11641: magic is performed to do consistency checks, registering
11642: the package, and so on.</p>
11643: <pre class="programlisting">
11644: .for d in ${INSTALL_DIRS}
11645: cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \
11646: ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \
11647: -f ${MAKEFILE} ${BUILD_TARGET}
11648: .endfor
11649: </pre>
11650:
11651: <p>The variable's meanings are analogous to the ones in
11652: the <span class="emphasis"><em>build</em></span> phase.
11653: <code class="varname">INSTALL_DIRS</code> defaults to
11654: <code class="varname">BUILD_DIRS</code>. <code class=
11655: "varname">INSTALL_TARGET</code> is “<span class=
11656: "quote">install</span>” by default, plus
11657: “<span class="quote">install.man</span>” if
11658: <code class="varname">USE_IMAKE</code> is defined.</p>
11659:
11660: <p>In the <span class="emphasis"><em>install</em></span>
11661: phase, the following variables are useful. They are all
11662: variations of the <a href=
11663: "http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
11664: <span class="citerefentry"><span class=
11665: "refentrytitle">install</span>(1)</span></a> command that
11666: have the owner, group and permissions preset.
11667: <code class="varname">INSTALL</code> is the plain install
11668: command. The specialized variants, together with their
11669: intended use, are:</p>
11670:
11671: <div class="variablelist">
11672: <dl>
11673: <dt><span class="term"><code class=
11674: "varname">INSTALL_PROGRAM_DIR</code></span></dt>
11675:
11676: <dd>
11677: <p>directories that contain binaries</p>
11678: </dd>
11679:
11680: <dt><span class="term"><code class=
11681: "varname">INSTALL_SCRIPT_DIR</code></span></dt>
11682:
11683: <dd>
11684: <p>directories that contain scripts</p>
11685: </dd>
11686:
11687: <dt><span class="term"><code class=
11688: "varname">INSTALL_LIB_DIR</code></span></dt>
11689:
11690: <dd>
11691: <p>directories that contain shared and static
11692: libraries</p>
11693: </dd>
11694:
11695: <dt><span class="term"><code class=
11696: "varname">INSTALL_DATA_DIR</code></span></dt>
11697:
11698: <dd>
11699: <p>directories that contain data files</p>
11700: </dd>
11701:
11702: <dt><span class="term"><code class=
11703: "varname">INSTALL_MAN_DIR</code></span></dt>
11704:
11705: <dd>
11706: <p>directories that contain man pages</p>
11707: </dd>
11708:
11709: <dt><span class="term"><code class=
11710: "varname">INSTALL_PROGRAM</code></span></dt>
11711:
11712: <dd>
11713: <p>binaries that can be stripped from debugging
11714: symbols</p>
11715: </dd>
11716:
11717: <dt><span class="term"><code class=
11718: "varname">INSTALL_SCRIPT</code></span></dt>
11719:
11720: <dd>
11721: <p>binaries that cannot be stripped</p>
11722: </dd>
11723:
11724: <dt><span class="term"><code class=
11725: "varname">INSTALL_GAME</code></span></dt>
11726:
11727: <dd>
11728: <p>game binaries</p>
11729: </dd>
11730:
11731: <dt><span class="term"><code class=
11732: "varname">INSTALL_LIB</code></span></dt>
11733:
11734: <dd>
11735: <p>shared and static libraries</p>
11736: </dd>
11737:
11738: <dt><span class="term"><code class=
11739: "varname">INSTALL_DATA</code></span></dt>
11740:
11741: <dd>
11742: <p>data files</p>
11743: </dd>
11744:
11745: <dt><span class="term"><code class=
11746: "varname">INSTALL_GAME_DATA</code></span></dt>
11747:
11748: <dd>
11749: <p>data files for games</p>
11750: </dd>
11751:
11752: <dt><span class="term"><code class=
11753: "varname">INSTALL_MAN</code></span></dt>
11754:
11755: <dd>
11756: <p>man pages</p>
11757: </dd>
11758: </dl>
11759: </div>
11760:
11761: <p>Some other variables are:</p>
11762:
11763: <div class="variablelist">
11764: <dl>
11765: <dt><span class="term"><code class=
11766: "varname">INSTALLATION_DIRS</code></span></dt>
11767:
11768: <dd>
11769: <p>A list of directories relative to <code class=
11770: "varname">PREFIX</code> that are created by pkgsrc
11771: at the beginning of the <span class=
11772: "emphasis"><em>install</em></span> phase. If this
11773: variable is set, <code class=
11774: "varname">NO_MTREE</code>=“<span class=
11775: "quote">yes</span>” is assumed, which means
11776: that the package claims to create all needed
11777: directories itself before installing files to it.
11778: Therefore this variable should only be set in
11779: <code xmlns=
11780: "http://www.w3.org/TR/xhtml1/transitional" class=
11781: "filename">Makefile</code>s that are under control
11782: of the package's author.</p>
11783: </dd>
11784: </dl>
11785: </div>
1.56 rillig 11786: </div>
11787:
1.67 hubertf 11788: <div class="sect1" lang="en">
1.56 rillig 11789: <div class="titlepage">
11790: <div>
11791: <div>
11792: <h2 class="title" style="clear: both"><a name=
11793: "build.package"></a>14.15. The <span class=
11794: "emphasis"><em>package</em></span> phase</h2>
11795: </div>
11796: </div>
11797: </div>
11798:
11799: <p>[TODO]</p>
1.1 grant 11800: </div>
11801:
1.67 hubertf 11802: <div class="sect1" lang="en">
1.1 grant 11803: <div class="titlepage">
11804: <div>
11805: <div>
11806: <h2 class="title" style="clear: both"><a name=
1.56 rillig 11807: "build.helpful-targets"></a>14.16. Other
1.1 grant 11808: helpful targets</h2>
11809: </div>
11810: </div>
11811: </div>
11812:
11813: <div class="variablelist">
11814: <dl>
11815: <dt><span class="term">pre/post-*</span></dt>
11816:
11817: <dd>
11818: <p>For any of the main targets described in the
11819: previous section, two auxiliary targets exist with
11820: “<span class="quote">pre-</span>” and
11821: “<span class="quote">post-</span>” used
11822: as a prefix for the main target's name. These
11823: targets are invoked before and after the main
11824: target is called, allowing extra configuration or
11825: installation steps be performed from a package's
11826: Makefile, for example, which a program's configure
11827: script or install target omitted.</p>
11828: </dd>
11829:
11830: <dt><span class="term">do-*</span></dt>
11831:
11832: <dd>
11833: <p>Should one of the main targets do the wrong
11834: thing, and should there be no variable to fix this,
11835: you can redefine it with the do-* target. (Note
11836: that redefining the target itself instead of the
11837: do-* target is a bad idea, as the pre-* and post-*
11838: targets won't be called anymore, etc.) You will not
11839: usually need to do this.</p>
11840: </dd>
11841:
11842: <dt><span class="term">reinstall</span></dt>
11843:
11844: <dd>
1.14 xtraeme 11845: <p>If you did a <span><strong class="command">make
11846: install</strong></span> and you noticed some file
11847: was not installed properly, you can repeat the
1.1 grant 11848: installation with this target, which will ignore
11849: the “<span class="quote">already
11850: installed</span>” flag.</p>
11851: </dd>
11852:
11853: <dt><span class="term">deinstall</span></dt>
11854:
11855: <dd>
1.24 wiz 11856: <p>This target does a <a href=
11857: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11858: <span class="citerefentry"><span class=
11859: "refentrytitle">pkg_delete</span>(1)</span></a> in
11860: the current directory, effectively de-installing
11861: the package. The following variables can be used to
11862: tune the behaviour:</p>
1.1 grant 11863:
11864: <div class="variablelist">
11865: <dl>
1.14 xtraeme 11866: <dt><span class="term"><code class=
11867: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 11868:
11869: <dd>
11870: <p>Add a "-v" to the <a href=
11871: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11872: <span class="citerefentry"><span class=
11873: "refentrytitle">pkg_delete</span>(1)</span></a>
11874: command.</p>
11875: </dd>
11876:
1.14 xtraeme 11877: <dt><span class="term"><code class=
11878: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 11879:
11880: <dd>
11881: <p>Remove all packages that require (depend
11882: on) the given package. This can be used to
11883: remove any packages that may have been pulled
11884: in by a given package, e.g. if
1.14 xtraeme 11885: <span><strong class="command">make deinstall
11886: DEINSTALLDEPENDS=1</strong></span> is done in
1.45 wiz 11887: <code xmlns=
11888: "http://www.w3.org/TR/xhtml1/transitional"
11889: class="filename">pkgsrc/x11/kde</code>, this
11890: is likely to remove whole KDE. Works by
1.1 grant 11891: adding “<span class=
11892: "quote">-R</span>” to the <a href=
11893: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11894: <span class="citerefentry"><span class=
11895: "refentrytitle">pkg_delete</span>(1)</span></a>
11896: command line.</p>
11897: </dd>
11898: </dl>
11899: </div>
11900: </dd>
11901:
11902: <dt><span class="term">update</span></dt>
11903:
11904: <dd>
11905: <p>This target causes the current package to be
11906: updated to the latest version. The package and all
11907: depending packages first get de-installed, then
11908: current versions of the corresponding packages get
11909: compiled and installed. This is similar to manually
11910: noting which packages are currently installed, then
1.14 xtraeme 11911: performing a series of <span><strong class=
11912: "command">make deinstall</strong></span> and
11913: <span><strong class="command">make
11914: install</strong></span> (or whatever <code class=
11915: "varname">UPDATE_TARGET</code> is set to) for these
11916: packages.</p>
1.1 grant 11917:
11918: <p>You can use the “<span class=
11919: "quote">update</span>” target to resume
1.14 xtraeme 11920: package updating in case a previous
11921: <span><strong class="command">make
11922: update</strong></span> was interrupted for some
11923: reason. However, in this case, make sure you don't
11924: call <span><strong class="command">make
11925: clean</strong></span> or otherwise remove the list
11926: of dependent packages in <code class=
1.47 reed 11927: "varname">WRKDIR</code>. Otherwise, you lose the
1.1 grant 11928: ability to automatically update the current package
11929: along with the dependent packages you have
11930: installed.</p>
11931:
1.14 xtraeme 11932: <p>Resuming an interrupted <span><strong class=
11933: "command">make update</strong></span> will only
11934: work as long as the package tree remains unchanged.
11935: If the source code for one of the packages to be
11936: updated has been changed, resuming
11937: <span><strong class="command">make
11938: update</strong></span> will most certainly
11939: fail!</p>
1.1 grant 11940:
11941: <p>The following variables can be used either on
1.45 wiz 11942: the command line or in <code xmlns=
11943: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11944: "filename">/etc/mk.conf</code> to alter the
11945: behaviour of <span><strong class="command">make
11946: update</strong></span>:</p>
1.1 grant 11947:
11948: <div class="variablelist">
11949: <dl>
1.14 xtraeme 11950: <dt><span class="term"><code class=
11951: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 11952:
11953: <dd>
11954: <p>Install target to recursively use for the
11955: updated package and the dependent packages.
1.14 xtraeme 11956: Defaults to <code class=
11957: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 11958: “<span class=
11959: "quote">install</span>” otherwise for
1.14 xtraeme 11960: <span><strong class="command">make
11961: update</strong></span>. e.g.
11962: <span><strong class="command">make update
11963: UPDATE_TARGET=package</strong></span></p>
1.1 grant 11964: </dd>
11965:
1.14 xtraeme 11966: <dt><span class="term"><code class=
11967: "varname">NOCLEAN</code></span></dt>
1.1 grant 11968:
11969: <dd>
11970: <p>Don't clean up after updating. Useful if
11971: you want to leave the work sources of the
11972: updated packages around for inspection or
11973: other purposes. Be sure you eventually clean
11974: up the source tree (see the
11975: “<span class=
11976: "quote">clean-update</span>” target
11977: below) or you may run into troubles with old
11978: source code still lying around on your next
1.14 xtraeme 11979: <span><strong class=
11980: "command">make</strong></span> or
11981: <span><strong class="command">make
11982: update</strong></span>.</p>
1.1 grant 11983: </dd>
11984:
1.14 xtraeme 11985: <dt><span class="term"><code class=
11986: "varname">REINSTALL</code></span></dt>
1.1 grant 11987:
11988: <dd>
11989: <p>Deinstall each package before installing
1.14 xtraeme 11990: (making <code class=
11991: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 11992: necessary if the “<span class=
11993: "quote">clean-update</span>” target
11994: (see below) was called after interrupting a
1.14 xtraeme 11995: running <span><strong class="command">make
11996: update</strong></span>.</p>
1.1 grant 11997: </dd>
11998:
1.14 xtraeme 11999: <dt><span class="term"><code class=
12000: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 12001:
12002: <dd>
12003: <p>Allows you to disable recursion and
12004: hardcode the target for packages. The default
12005: is “<span class=
12006: "quote">update</span>” for the update
12007: target, facilitating a recursive update of
1.14 xtraeme 12008: prerequisite packages. Only set <code class=
12009: "varname">DEPENDS_TARGET</code> if you want
12010: to disable recursive updates. Use
12011: <code class="varname">UPDATE_TARGET</code>
12012: instead to just set a specific target for
12013: each package to be installed during
12014: <span><strong class="command">make
12015: update</strong></span> (see above).</p>
1.1 grant 12016: </dd>
12017: </dl>
12018: </div>
12019: </dd>
12020:
12021: <dt><span class="term">clean-update</span></dt>
12022:
12023: <dd>
12024: <p>Clean the source tree for all packages that
1.14 xtraeme 12025: would get updated if <span><strong class=
12026: "command">make update</strong></span> was called
12027: from the current directory. This target should not
12028: be used if the current package (or any of its
12029: depending packages) have already been de-installed
12030: (e.g., after calling <span><strong class=
12031: "command">make update</strong></span>) or you may
12032: lose some packages you intended to update. As a
12033: rule of thumb: only use this target <span class=
12034: "emphasis"><em>before</em></span> the first time
12035: you run <span><strong class="command">make
12036: update</strong></span> and only if you have a dirty
12037: package tree (e.g., if you used <code class=
12038: "varname">NOCLEAN</code>).</p>
1.1 grant 12039:
1.47 reed 12040: <p>If you are unsure about whether your tree is
12041: clean, you can either perform a
1.14 xtraeme 12042: <span><strong class="command">make
1.47 reed 12043: clean</strong></span> at the top of the tree, or
12044: use the following sequence of commands from the
12045: directory of the package you want to update
12046: (<span class="emphasis"><em>before</em></span>
12047: running <span><strong class="command">make
1.14 xtraeme 12048: update</strong></span> for the first time,
12049: otherwise you lose all the packages you wanted to
12050: update!):</p>
1.1 grant 12051: <pre class="screen">
1.14 xtraeme 12052: <code class="prompt">#</code> <strong class=
12053: "userinput"><code>make clean-update</code></strong>
12054: <code class="prompt">#</code> <strong class=
12055: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
12056: <code class="prompt">#</code> <strong class=
12057: "userinput"><code>make update</code></strong>
1.1 grant 12058: </pre>
12059:
12060: <p>The following variables can be used either on
1.45 wiz 12061: the command line or in <code xmlns=
12062: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12063: "filename">/etc/mk.conf</code> to alter the
12064: behaviour of <span><strong class="command">make
12065: clean-update</strong></span>:</p>
1.1 grant 12066:
12067: <div class="variablelist">
12068: <dl>
1.14 xtraeme 12069: <dt><span class="term"><code class=
12070: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 12071:
12072: <dd>
1.14 xtraeme 12073: <p>After <span><strong class="command">make
12074: clean</strong></span>, do not reconstruct the
12075: list of directories to update for this
12076: package. Only use this if
12077: <span><strong class="command">make
12078: update</strong></span> successfully installed
12079: all packages you wanted to update. Normally,
12080: this is done automatically on
12081: <span><strong class="command">make
12082: update</strong></span>, but may have been
12083: suppressed by the <code class=
12084: "varname">NOCLEAN</code> variable (see
1.1 grant 12085: above).</p>
12086: </dd>
12087: </dl>
12088: </div>
12089: </dd>
12090:
12091: <dt><span class="term">info</span></dt>
12092:
12093: <dd>
12094: <p>This target invokes <a href=
12095: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
12096: <span class="citerefentry"><span class=
12097: "refentrytitle">pkg_info</span>(1)</span></a> for
12098: the current package. You can use this to check
12099: which version of a package is installed.</p>
12100: </dd>
12101:
12102: <dt><span class="term">readme</span></dt>
12103:
12104: <dd>
1.45 wiz 12105: <p>This target generates a <code xmlns=
12106: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12107: "filename">README.html</code> file, which can be
1.1 grant 12108: viewed using a browser such as <a xmlns=
12109: "http://www.w3.org/TR/xhtml1/transitional" href=
12110: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 12111: target="_top"><code xmlns="" class=
12112: "filename">www/mozilla</code></a> or <a xmlns=
1.20 ben 12113: "http://www.w3.org/TR/xhtml1/transitional" href=
12114: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45 wiz 12115: target="_top"><code xmlns="" class=
12116: "filename">www/links</code></a>. The generated
12117: files contain references to any packages which are
12118: in the <code class="varname">PACKAGES</code>
12119: directory on the local host. The generated files
12120: can be made to refer to URLs based on <code class=
1.20 ben 12121: "varname">FTP_PKG_URL_HOST</code> and <code class=
12122: "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45 wiz 12123: wanted to generate <code xmlns=
12124: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 12125: "filename">README.html</code> files which pointed
12126: to binary packages on the local machine, in the
1.45 wiz 12127: directory <code xmlns=
12128: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 12129: "filename">/usr/packages</code>, set <code class=
12130: "varname">FTP_PKG_URL_HOST=file://localhost</code>
12131: and <code class=
12132: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
12133: <code class="varname">${PACKAGES}</code> directory
12134: and its subdirectories will be searched for all the
12135: binary packages.</p>
1.1 grant 12136: </dd>
12137:
12138: <dt><span class="term">readme-all</span></dt>
12139:
12140: <dd>
1.45 wiz 12141: <p>Use this target to create a file <code xmlns=
12142: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12143: "filename">README-all.html</code> which contains a
1.1 grant 12144: list of all packages currently available in the
12145: NetBSD Packages Collection, together with the
12146: category they belong to and a short description.
1.45 wiz 12147: This file is compiled from the <code xmlns=
12148: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12149: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 12150: sure to run this <span class=
1.14 xtraeme 12151: "emphasis"><em>after</em></span> a
12152: <span><strong class="command">make
12153: readme</strong></span>.</p>
1.1 grant 12154: </dd>
12155:
12156: <dt><span class="term">cdrom-readme</span></dt>
12157:
12158: <dd>
12159: <p>This is very much the same as the
12160: “<span class="quote">readme</span>”
12161: target (see above), but is to be used when
12162: generating a pkgsrc tree to be written to a CD-ROM.
1.45 wiz 12163: This target also produces <code xmlns=
12164: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12165: "filename">README.html</code> files, and can be
12166: made to refer to URLs based on <code class=
12167: "varname">CDROM_PKG_URL_HOST</code> and
12168: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 12169: </dd>
12170:
12171: <dt><span class="term">show-distfiles</span></dt>
12172:
12173: <dd>
12174: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 12175: are needed to build the package. (<code class=
12176: "varname">DISTFILES</code> and <code class=
1.45 wiz 12177: "varname">PATCHFILES</code>, but not <code xmlns=
12178: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12179: "filename">patches/*</code>)</p>
1.1 grant 12180: </dd>
12181:
12182: <dt><span class="term">show-downlevel</span></dt>
12183:
12184: <dd>
12185: <p>This target shows nothing if the package is not
12186: installed. If a version of this package is
12187: installed, but is not the version provided in this
12188: version of pkgsrc, then a warning message is
12189: displayed. This target can be used to show which of
12190: your installed packages are downlevel, and so the
12191: old versions can be deleted, and the current ones
12192: added.</p>
12193: </dd>
12194:
12195: <dt><span class="term">show-pkgsrc-dir</span></dt>
12196:
12197: <dd>
12198: <p>This target shows the directory in the pkgsrc
12199: hierarchy from which the package can be built and
12200: installed. This may not be the same directory as
12201: the one from which the package was installed. This
12202: target is intended to be used by people who may
12203: wish to upgrade many packages on a single host, and
12204: can be invoked from the top-level pkgsrc Makefile
12205: by using the “<span class=
12206: "quote">show-host-specific-pkgs</span>”
12207: target.</p>
12208: </dd>
12209:
12210: <dt><span class=
12211: "term">show-installed-depends</span></dt>
12212:
12213: <dd>
12214: <p>This target shows which installed packages match
1.14 xtraeme 12215: the current package's <code class=
12216: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 12217: dependencies are causing build problems.</p>
12218: </dd>
12219:
12220: <dt><span class="term">check-shlibs</span></dt>
12221:
12222: <dd>
12223: <p>After a package is installed, check all its
12224: binaries and (on ELF platforms) shared libraries to
12225: see if they find the shared libs they need. Run by
1.14 xtraeme 12226: default if <code class=
12227: "varname">PKG_DEVELOPER</code> is set in
1.45 wiz 12228: <code xmlns=
12229: "http://www.w3.org/TR/xhtml1/transitional" class=
12230: "filename">/etc/mk.conf</code>.</p>
1.1 grant 12231: </dd>
12232:
12233: <dt><span class="term">print-PLIST</span></dt>
12234:
12235: <dd>
12236: <p>After a “<span class="quote">make
12237: install</span>” from a new or upgraded pkg,
12238: this prints out an attempt to generate a new
1.45 wiz 12239: <code xmlns=
12240: "http://www.w3.org/TR/xhtml1/transitional" class=
12241: "filename">PLIST</code> from a <span><strong class=
12242: "command">find -newer
1.14 xtraeme 12243: work/.extract_done</strong></span>. An attempt is
12244: made to care for shared libs etc., but it is
1.1 grant 12245: <span class="emphasis"><em>strongly</em></span>
12246: recommended to review the result before putting it
1.45 wiz 12247: into <code xmlns=
12248: "http://www.w3.org/TR/xhtml1/transitional" class=
12249: "filename">PLIST</code>. On upgrades, it's useful
12250: to diff the output of this command against an
12251: already existing <code xmlns=
12252: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12253: "filename">PLIST</code> file.</p>
1.1 grant 12254:
1.24 wiz 12255: <p>If the package installs files via <a href=
12256: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
12257: <span class="citerefentry"><span class=
12258: "refentrytitle">tar</span>(1)</span></a> or other
12259: methods that don't update file access times, be
12260: sure to add these files manually to your
1.45 wiz 12261: <code xmlns=
12262: "http://www.w3.org/TR/xhtml1/transitional" class=
12263: "filename">PLIST</code>, as the “<span class=
12264: "quote">find -newer</span>” command used by
12265: this target won't catch them!</p>
1.1 grant 12266:
12267: <p>See <a href="#print-PLIST" title=
1.38 dillo 12268: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 12269: “Tweaking output of <span><strong class=
12270: "command">make
12271: print-PLIST</strong></span>”</a> for more
12272: information on this target.</p>
1.1 grant 12273: </dd>
12274:
12275: <dt><span class="term">bulk-package</span></dt>
12276:
12277: <dd>
12278: <p>Used to do bulk builds. If an appropriate binary
12279: package already exists, no action is taken. If not,
12280: this target will compile, install and package it
1.47 reed 12281: (and its depends, if <code class=
1.14 xtraeme 12282: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 12283: <a href="#binary.configuration" title=
1.38 dillo 12284: "6.3.1. Configuration">Section 6.3.1,
1.47 reed 12285: “Configuration”</a>). After creating
12286: the binary package, the sources, the just-installed
12287: package and its required packages are removed,
1.1 grant 12288: preserving free disk space.</p>
12289:
12290: <p><span class="emphasis"><em>Beware that this
12291: target may deinstall all packages installed on a
12292: system!</em></span></p>
12293: </dd>
12294:
12295: <dt><span class="term">bulk-install</span></dt>
12296:
12297: <dd>
12298: <p>Used during bulk-installs to install required
1.47 reed 12299: packages. If an up-to-date binary package is
1.1 grant 12300: available, it will be installed via <a href=
12301: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
12302: <span class="citerefentry"><span class=
12303: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 12304: not, <span><strong class="command">make
12305: bulk-package</strong></span> will be executed, but
1.47 reed 12306: the installed binary won't be removed.</p>
1.1 grant 12307:
12308: <p>A binary package is considered
1.47 reed 12309: “<span class="quote">up-to-date</span>”
1.1 grant 12310: to be installed via <a href=
12311: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
12312: <span class="citerefentry"><span class=
12313: "refentrytitle">pkg_add</span>(1)</span></a>
12314: if:</p>
12315:
12316: <div class="itemizedlist">
12317: <ul type="disc">
12318: <li>
1.45 wiz 12319: <p>None of the package's files (<code xmlns=
12320: "http://www.w3.org/TR/xhtml1/transitional"
12321: class="filename">Makefile</code>, ...) were
1.14 xtraeme 12322: modified since it was built.</p>
1.1 grant 12323: </li>
12324:
12325: <li>
12326: <p>None of the package's required (binary)
12327: packages were modified since it was
12328: built.</p>
12329: </li>
12330: </ul>
12331: </div>
12332:
12333: <p><span class="emphasis"><em>Beware that this
12334: target may deinstall all packages installed on a
12335: system!</em></span></p>
12336: </dd>
12337: </dl>
12338: </div>
12339: </div>
12340: </div>
12341:
1.67 hubertf 12342: <div class="chapter" lang="en">
1.1 grant 12343: <div class="titlepage">
12344: <div>
12345: <div>
1.67 hubertf 12346: <h2 class="title"><a name=
1.68 rillig 12347: "tools"></a>Chapter 15. Tools needed for
12348: building or running</h2>
12349: </div>
12350: </div>
12351: </div>
12352:
12353: <div class="toc">
12354: <p><b>Table of Contents</b></p>
12355:
12356: <dl>
12357: <dt><span class="sect1"><a href="#pkgsrc-tools">15.1.
12358: Tools for pkgsrc builds</a></span></dt>
12359:
12360: <dt><span class="sect1"><a href="#package-tools">15.2.
12361: Tools needed by packages</a></span></dt>
12362:
12363: <dt><span class="sect1"><a href="#platform-tools">15.3.
12364: Tools provided by platforms</a></span></dt>
12365: </dl>
12366: </div>
12367:
12368: <p>The <code class="varname">USE_TOOLS</code> definition is
12369: used both internally by pkgsrc and also for individual
12370: packages to define what commands are needed for building a
12371: package (like <code class="varname">BUILD_DEPENDS</code>)
12372: or for later run-time of an installed packaged (such as
12373: <code class="varname">DEPENDS</code>). If the native system
12374: provides an adequate tool, then in many cases, a pkgsrc
12375: package will not be used.</p>
12376:
12377: <p>When building a package, the replacement tools are made
12378: available in a directory (as symlinks or wrapper scripts)
12379: that is early in the executable search path. Just like the
12380: buildlink system, this helps with consistent builds.</p>
12381:
12382: <p>A tool may be needed to help build a specific package.
12383: For example, perl, GNU make (gmake) or yacc may be
12384: needed.</p>
12385:
12386: <p>Also a tool may be needed, for example, because the
12387: native system's supplied tool may be inefficient for
12388: building a package with pkgsrc. For example, a package may
12389: need GNU awk, bison (instead of yacc) or a better sed.</p>
12390:
12391: <p>The tools used by a package can be listed by running
12392: <span><strong class="command">make
12393: show-tools</strong></span>.</p>
12394:
12395: <div class="sect1" lang="en">
12396: <div class="titlepage">
12397: <div>
12398: <div>
12399: <h2 class="title" style="clear: both"><a name=
12400: "pkgsrc-tools"></a>15.1. Tools for pkgsrc
12401: builds</h2>
12402: </div>
12403: </div>
12404: </div>
12405:
12406: <p>The default set of tools used by pkgsrc is defined in
12407: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12408: class="filename">bsd.pkg.mk</code>. This includes
12409: standard Unix tools, such as: <span><strong class=
12410: "command">cat</strong></span>, <span><strong class=
12411: "command">awk</strong></span>, <span><strong class=
12412: "command">chmod</strong></span>, <span><strong class=
12413: "command">test</strong></span>, and so on. These can be
12414: seen by running: <span><strong class="command">make
12415: show-var VARNAME=USE_TOOLS</strong></span>.</p>
12416:
12417: <p>If a package needs a specific program to build then
12418: the <code class="varname">USE_TOOLS</code> variable can
12419: be used to define the tools needed.</p>
12420: </div>
12421:
12422: <div class="sect1" lang="en">
12423: <div class="titlepage">
12424: <div>
12425: <div>
12426: <h2 class="title" style="clear: both"><a name=
12427: "package-tools"></a>15.2. Tools needed by
12428: packages</h2>
12429: </div>
12430: </div>
12431: </div>
12432:
12433: <p>In the following examples, the :pkgsrc means to use
12434: the pkgsrc version and not the native version for a build
12435: dependency. And the :run means that it is used for a
12436: run-time dependencies also (and becomes a DEPENDS). The
12437: default is a build dependency which can be set with
12438: :build. (So in this example, it is the same as
12439: gmake:build and pkg-config:build.)</p>
12440: <pre class="programlisting">
12441: USE_TOOLS+= mktemp:pkgsrc
12442: USE_TOOLS+= gmake perl:run pkg-config
12443: </pre>
12444:
12445: <p>When using the tools framework, a <code class=
12446: "varname">TOOLS_PATH.foo</code> variable is defined which
12447: contains the full path to the appropriate tool. For
12448: example, <code class="varname">TOOLS_PATH.bash</code>
12449: could be “<span class=
12450: "quote">/bin/bash</span>” on Linux systems.</p>
12451:
12452: <p>If you always need a pkgsrc version of the tool at
12453: run-time, then just use <code class=
12454: "varname">DEPENDS</code> instead.</p>
12455: </div>
12456:
12457: <div class="sect1" lang="en">
12458: <div class="titlepage">
12459: <div>
12460: <div>
12461: <h2 class="title" style="clear: both"><a name=
12462: "platform-tools"></a>15.3. Tools provided by
12463: platforms</h2>
12464: </div>
12465: </div>
12466: </div>
12467:
12468: <p>When improving or porting pkgsrc to a new platform,
12469: have a look at (or create) the corresponding platform
12470: specific make file fragment under <code xmlns=
12471: "http://www.w3.org/TR/xhtml1/transitional" class=
12472: "filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which
12473: defines the name of the common tools. For example:</p>
12474: <pre class="programlisting">
12475: .if exists(/usr/bin/bzcat)
12476: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
12477: .elif exists(/usr/bin/bzip2)
12478: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
12479: .endif
12480:
12481: TOOLS_PLATFORM.true?= true # shell builtin
12482: </pre>
12483: </div>
12484: </div>
12485:
12486: <div class="chapter" lang="en">
12487: <div class="titlepage">
12488: <div>
12489: <div>
12490: <h2 class="title"><a name=
12491: "fixes"></a>Chapter 16. Making your package
1.55 rillig 12492: work</h2>
1.1 grant 12493: </div>
12494: </div>
12495: </div>
12496:
12497: <div class="toc">
12498: <p><b>Table of Contents</b></p>
12499:
12500: <dl>
1.30 wiz 12501: <dt><span class="sect1"><a href=
1.68 rillig 12502: "#general-operation">16.1. General
1.30 wiz 12503: operation</a></span></dt>
1.1 grant 12504:
12505: <dd>
12506: <dl>
12507: <dt><span class="sect2"><a href=
1.68 rillig 12508: "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30 wiz 12509: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 12510:
12511: <dt><span class="sect2"><a href=
1.68 rillig 12512: "#where-to-install-documentation">16.1.2. Where to
1.31 wiz 12513: install documentation</a></span></dt>
12514:
12515: <dt><span class="sect2"><a href=
1.68 rillig 12516: "#restricted-packages">16.1.3. Restricted
1.1 grant 12517: packages</a></span></dt>
12518:
12519: <dt><span class="sect2"><a href=
1.68 rillig 12520: "#dependencies">16.1.4. Handling
1.1 grant 12521: dependencies</a></span></dt>
12522:
12523: <dt><span class="sect2"><a href=
1.68 rillig 12524: "#conflicts">16.1.5. Handling conflicts with other
1.1 grant 12525: packages</a></span></dt>
12526:
12527: <dt><span class="sect2"><a href=
1.68 rillig 12528: "#not-building-packages">16.1.6. Packages that
1.30 wiz 12529: cannot or should not be built</a></span></dt>
1.1 grant 12530:
12531: <dt><span class="sect2"><a href=
1.68 rillig 12532: "#undeletable-packages">16.1.7. Packages which
1.30 wiz 12533: should not be deleted, once
12534: installed</a></span></dt>
1.1 grant 12535:
12536: <dt><span class="sect2"><a href=
1.68 rillig 12537: "#security-handling">16.1.8. Handling packages with
1.1 grant 12538: security problems</a></span></dt>
12539:
12540: <dt><span class="sect2"><a href=
1.68 rillig 12541: "#compiler-bugs">16.1.9. How to handle compiler
1.1 grant 12542: bugs</a></span></dt>
12543:
12544: <dt><span class="sect2"><a href=
1.68 rillig 12545: "#bumping-pkgrevision">16.1.10. How to handle
1.30 wiz 12546: incrementing versions when fixing an existing
1.1 grant 12547: package</a></span></dt>
12548:
12549: <dt><span class="sect2"><a href=
1.68 rillig 12550: "#portability-of-packages">16.1.11. Portability of
1.1 grant 12551: packages</a></span></dt>
12552: </dl>
12553: </dd>
12554:
1.30 wiz 12555: <dt><span class="sect1"><a href=
1.68 rillig 12556: "#downloading-issues">16.2. Possible downloading
1.30 wiz 12557: issues</a></span></dt>
1.1 grant 12558:
12559: <dd>
12560: <dl>
12561: <dt><span class="sect2"><a href=
1.68 rillig 12562: "#no-plain-download">16.2.1. Packages whose
1.30 wiz 12563: distfiles aren't available for plain
1.1 grant 12564: downloading</a></span></dt>
12565:
12566: <dt><span class="sect2"><a href=
1.68 rillig 12567: "#modified-distfiles-same-name">16.2.2. How to
1.30 wiz 12568: handle modified distfiles with the 'old'
12569: name</a></span></dt>
1.1 grant 12570: </dl>
12571: </dd>
12572:
1.30 wiz 12573: <dt><span class="sect1"><a href=
1.68 rillig 12574: "#configuration-gotchas">16.3. Configuration
1.30 wiz 12575: gotchas</a></span></dt>
1.1 grant 12576:
12577: <dd>
12578: <dl>
12579: <dt><span class="sect2"><a href=
1.68 rillig 12580: "#fixes.libtool">16.3.1. Shared libraries -
1.1 grant 12581: libtool</a></span></dt>
12582:
12583: <dt><span class="sect2"><a href=
1.68 rillig 12584: "#using-libtool">16.3.2. Using libtool on GNU
1.30 wiz 12585: packages that already support
12586: libtool</a></span></dt>
1.1 grant 12587:
12588: <dt><span class="sect2"><a href=
1.68 rillig 12589: "#autoconf-automake">16.3.3. GNU
1.1 grant 12590: Autoconf/Automake</a></span></dt>
12591: </dl>
12592: </dd>
12593:
1.68 rillig 12594: <dt><span class="sect1"><a href="#fixes-build">16.4.
1.55 rillig 12595: Building the package</a></span></dt>
1.1 grant 12596:
12597: <dd>
12598: <dl>
12599: <dt><span class="sect2"><a href=
1.68 rillig 12600: "#cpp-defines">16.4.1. CPP defines</a></span></dt>
1.51 rillig 12601:
1.60 rillig 12602: <dt><span class="sect2"><a href=
1.68 rillig 12603: "#cpp-list-examples">16.4.2. Examples of CPP
1.60 rillig 12604: defines for some platforms</a></span></dt>
12605:
1.68 rillig 12606: <dt><span class="sect2"><a href="#cpp-list">16.4.3.
1.51 rillig 12607: Getting a list of CPP defines</a></span></dt>
1.1 grant 12608: </dl>
12609: </dd>
12610:
1.30 wiz 12611: <dt><span class="sect1"><a href=
1.68 rillig 12612: "#package-specific-actions">16.5. Package specific
1.30 wiz 12613: actions</a></span></dt>
1.1 grant 12614:
12615: <dd>
12616: <dl>
12617: <dt><span class="sect2"><a href=
1.68 rillig 12618: "#user-interaction">16.5.1. User
1.2 hubertf 12619: interaction</a></span></dt>
1.1 grant 12620:
12621: <dt><span class="sect2"><a href=
1.68 rillig 12622: "#handling-licenses">16.5.2. Handling
1.1 grant 12623: licenses</a></span></dt>
12624:
12625: <dt><span class="sect2"><a href=
1.68 rillig 12626: "#installing-score-files">16.5.3. Installing score
1.1 grant 12627: files</a></span></dt>
12628:
12629: <dt><span class="sect2"><a href=
1.68 rillig 12630: "#perl-scripts">16.5.4. Packages containing perl
1.1 grant 12631: scripts</a></span></dt>
12632:
12633: <dt><span class="sect2"><a href=
1.68 rillig 12634: "#hardcoded-paths">16.5.5. Packages with hardcoded
1.30 wiz 12635: paths to other interpreters</a></span></dt>
1.1 grant 12636:
12637: <dt><span class="sect2"><a href=
1.68 rillig 12638: "#perl-modules">16.5.6. Packages installing perl
1.1 grant 12639: modules</a></span></dt>
12640:
12641: <dt><span class="sect2"><a href=
1.68 rillig 12642: "#faq.info-files">16.5.7. Packages installing info
1.1 grant 12643: files</a></span></dt>
12644:
1.68 rillig 12645: <dt><span class="sect2"><a href="#manpages">16.5.8.
1.57 minskim 12646: Packages installing man pages</a></span></dt>
12647:
1.1 grant 12648: <dt><span class="sect2"><a href=
1.68 rillig 12649: "#gconf2-data-files">16.5.9. Packages installing
1.30 wiz 12650: GConf2 data files</a></span></dt>
1.1 grant 12651:
12652: <dt><span class="sect2"><a href=
1.68 rillig 12653: "#scrollkeeper-data-files">16.5.10. Packages
1.30 wiz 12654: installing scrollkeeper data files</a></span></dt>
1.1 grant 12655:
12656: <dt><span class="sect2"><a href=
1.68 rillig 12657: "#x11-fonts">16.5.11. Packages installing X11
1.1 grant 12658: fonts</a></span></dt>
12659:
12660: <dt><span class="sect2"><a href=
1.68 rillig 12661: "#gtk2-modules">16.5.12. Packages installing GTK2
1.1 grant 12662: modules</a></span></dt>
12663:
12664: <dt><span class="sect2"><a href=
1.68 rillig 12665: "#sgml-xml-data">16.5.13. Packages installing SGML
1.30 wiz 12666: or XML data</a></span></dt>
1.1 grant 12667:
12668: <dt><span class="sect2"><a href=
1.68 rillig 12669: "#mime-database">16.5.14. Packages installing
1.1 grant 12670: extensions to the MIME database</a></span></dt>
12671:
12672: <dt><span class="sect2"><a href=
1.68 rillig 12673: "#intltool">16.5.15. Packages using
1.1 grant 12674: intltool</a></span></dt>
1.18 xtraeme 12675:
12676: <dt><span class="sect2"><a href=
1.68 rillig 12677: "#startup-scripts">16.5.16. Packages installing
1.30 wiz 12678: startup scripts</a></span></dt>
1.57 minskim 12679:
12680: <dt><span class="sect2"><a href=
1.68 rillig 12681: "#tex-packages">16.5.17. Packages installing TeX
1.57 minskim 12682: modules</a></span></dt>
1.1 grant 12683: </dl>
12684: </dd>
12685:
1.30 wiz 12686: <dt><span class="sect1"><a href=
1.68 rillig 12687: "#feedback-to-author">16.6. Feedback to the
1.30 wiz 12688: author</a></span></dt>
1.1 grant 12689: </dl>
12690: </div>
12691:
1.67 hubertf 12692: <div class="sect1" lang="en">
1.1 grant 12693: <div class="titlepage">
12694: <div>
12695: <div>
12696: <h2 class="title" style="clear: both"><a name=
1.68 rillig 12697: "general-operation"></a>16.1. General
1.1 grant 12698: operation</h2>
12699: </div>
12700: </div>
12701: </div>
12702:
1.67 hubertf 12703: <div class="sect2" lang="en">
1.1 grant 12704: <div class="titlepage">
12705: <div>
12706: <div>
1.30 wiz 12707: <h3 class="title"><a name=
1.68 rillig 12708: "pulling-vars-from-etc-mk.conf"></a>16.1.1. How
1.30 wiz 12709: to pull in variables from /etc/mk.conf</h3>
1.1 grant 12710: </div>
12711: </div>
12712: </div>
12713:
12714: <p>The problem with package-defined variables that can
1.14 xtraeme 12715: be overridden via <code class="varname">MAKECONF</code>
1.45 wiz 12716: or <code xmlns=
12717: "http://www.w3.org/TR/xhtml1/transitional" class=
12718: "filename">/etc/mk.conf</code> is that <a href=
1.1 grant 12719: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
12720: <span class="citerefentry"><span class=
12721: "refentrytitle">make</span>(1)</span></a> expands a
1.47 reed 12722: variable as it is used, but evaluates preprocessor-like
1.1 grant 12723: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 12724: So, to use any variable (which may be set in
1.45 wiz 12725: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12726: class="filename">/etc/mk.conf</code>) in one of the
12727: .if* statements, the file <code xmlns=
12728: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12729: "filename">/etc/mk.conf</code> must be included before
1.1 grant 12730: that .if* statement.</p>
12731:
1.47 reed 12732: <p>Rather than having a number of ad-hoc ways of
1.45 wiz 12733: including <code xmlns=
12734: "http://www.w3.org/TR/xhtml1/transitional" class=
12735: "filename">/etc/mk.conf</code>, should it exist, or
12736: <code class="varname">MAKECONF</code>, should it exist,
12737: include the <code xmlns=
12738: "http://www.w3.org/TR/xhtml1/transitional" class=
12739: "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
12740: package Makefile before any preprocessor-like .if,
12741: .ifdef, or .ifndef statements:</p>
1.1 grant 12742: <pre class="programlisting">
1.51 rillig 12743: .include "../../mk/bsd.prefs.mk"
12744:
1.1 grant 12745: .if defined(USE_MENUS)
1.51 rillig 12746: # ...
1.1 grant 12747: .endif
12748: </pre>
12749:
1.14 xtraeme 12750: <p>If you wish to set the <code class=
1.45 wiz 12751: "varname">CFLAGS</code> variable in <code xmlns=
12752: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 12753: "filename">/etc/mk.conf</code>, please make sure to
1.1 grant 12754: use:</p>
12755: <pre class="programlisting">
1.51 rillig 12756: CFLAGS+= -your -flags
1.1 grant 12757: </pre>
12758:
1.14 xtraeme 12759: <p>Using <code class="varname">CFLAGS=</code> (i.e.
12760: without the “<span class="quote">+</span>”)
12761: may lead to problems with packages that need to add
12762: their own flags. Also, you may want to take a look at
12763: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 12764: href=
12765: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 12766: target="_top"><code xmlns="" class=
12767: "filename">devel/cpuflags</code></a> package if you're
1.20 ben 12768: interested in optimization for the current CPU.</p>
1.1 grant 12769: </div>
12770:
1.67 hubertf 12771: <div class="sect2" lang="en">
1.1 grant 12772: <div class="titlepage">
12773: <div>
12774: <div>
1.31 wiz 12775: <h3 class="title"><a name=
1.68 rillig 12776: "where-to-install-documentation"></a>16.1.2. Where
1.31 wiz 12777: to install documentation</h3>
12778: </div>
12779: </div>
12780: </div>
12781:
1.45 wiz 12782: <p>Documentation should be installed into <code xmlns=
12783: "http://www.w3.org/TR/xhtml1/transitional" class=
1.31 wiz 12784: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45 wiz 12785: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12786: class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
12787: (the latter includes the version number of the
12788: package).</p>
1.31 wiz 12789: </div>
12790:
1.67 hubertf 12791: <div class="sect2" lang="en">
1.31 wiz 12792: <div class="titlepage">
12793: <div>
12794: <div>
1.67 hubertf 12795: <h3 class="title"><a name=
1.68 rillig 12796: "restricted-packages"></a>16.1.3. Restricted
1.1 grant 12797: packages</h3>
12798: </div>
12799: </div>
12800: </div>
12801:
12802: <p>Some licenses restrict how software may be
12803: re-distributed. In order to satisfy these restrictions,
12804: the package system defines five make variables that can
12805: be set to note these restrictions:</p>
12806:
12807: <div class="itemizedlist">
12808: <ul type="disc">
12809: <li>
1.14 xtraeme 12810: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 12811:
12812: <p>This variable should be set whenever a
12813: restriction exists (regardless of its kind). Set
12814: this variable to a string containing the reason
12815: for the restriction.</p>
12816: </li>
12817:
12818: <li>
1.14 xtraeme 12819: <p><code class=
12820: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 12821:
12822: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 12823: variable to <code class=
12824: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 12825: package may not be included on a CD-ROM.</p>
12826: </li>
12827:
12828: <li>
1.14 xtraeme 12829: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 12830:
12831: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 12832: Set this variable to <code class=
12833: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 12834: package may not not be made available on the
12835: Internet.</p>
12836: </li>
12837:
12838: <li>
1.14 xtraeme 12839: <p><code class=
12840: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 12841:
12842: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 12843: this variable to <code class=
12844: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 12845: of the source code or other distfile(s) is not
12846: allowed on CD-ROMs.</p>
12847: </li>
12848:
12849: <li>
1.14 xtraeme 12850: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 12851:
12852: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 12853: variable to <code class=
12854: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 12855: of the source code or other distfile(s) via the
12856: Internet is not allowed.</p>
12857: </li>
12858: </ul>
12859: </div>
12860:
1.14 xtraeme 12861: <p>Please note that the use of <code class=
12862: "varname">NO_PACKAGE</code>, <code class=
12863: "varname">IGNORE</code>, <code class=
12864: "varname">NO_CDROM</code>, or other generic make
1.1 grant 12865: variables to denote restrictions is deprecated, because
12866: they unconditionally prevent users from generating
12867: binary packages!</p>
12868: </div>
12869:
1.67 hubertf 12870: <div class="sect2" lang="en">
1.1 grant 12871: <div class="titlepage">
12872: <div>
12873: <div>
1.67 hubertf 12874: <h3 class="title"><a name=
1.68 rillig 12875: "dependencies"></a>16.1.4. Handling
1.1 grant 12876: dependencies</h3>
12877: </div>
12878: </div>
12879: </div>
12880:
12881: <p>Your package may depend on some other package being
12882: present - and there are various ways of expressing this
1.14 xtraeme 12883: dependency. pkgsrc supports the <code class=
12884: "varname">BUILD_DEPENDS</code> and <code class=
1.47 reed 12885: "varname">DEPENDS</code> definitions, the <code class=
12886: "varname">USE_TOOLS</code> definition, as well as
1.45 wiz 12887: dependencies via <code xmlns=
12888: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12889: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 12890: way to handle dependencies, and which uses the
12891: variables named above. See <a href="#buildlink" title=
1.38 dillo 12892: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 12893: <i>Buildlink methodology</i></a> for more
12894: information.</p>
12895:
12896: <p>The basic difference between the two variables is as
1.14 xtraeme 12897: follows: The <code class="varname">DEPENDS</code>
1.1 grant 12898: definition registers that pre-requisite in the binary
12899: package so it will be pulled in when the binary package
1.14 xtraeme 12900: is later installed, whilst the <code class=
12901: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 12902: marking a dependency that is only needed for building
12903: the package.</p>
12904:
12905: <p>This means that if you only need a package present
12906: whilst you are building, it should be noted as a
1.14 xtraeme 12907: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 12908:
1.14 xtraeme 12909: <p>The format for a <code class=
12910: "varname">BUILD_DEPENDS</code> and a <code class=
12911: "varname">DEPENDS</code> definition is:</p>
1.1 grant 12912: <pre class="programlisting">
1.51 rillig 12913: <pre-req-package-name>:../../<category>/<pre-req-package>
1.1 grant 12914: </pre>
12915:
12916: <p>Please note that the “<span class=
12917: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 12918: any of the wildcard version numbers recognized by
1.1 grant 12919: <a href=
12920: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
12921: <span class="citerefentry"><span class=
12922: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
12923:
12924: <div class="orderedlist">
12925: <ol type="1">
12926: <li>
12927: <p>If your package needs another package's
12928: binaries or libraries to build or run, and if
1.45 wiz 12929: that package has a <code xmlns=
12930: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12931: "filename">buildlink3.mk</code> file available,
12932: use it:</p>
1.1 grant 12933: <pre class="programlisting">
12934: .include "../../graphics/jpeg/buildlink3.mk"
12935: </pre>
12936: </li>
12937:
12938: <li>
12939: <p>If your package needs to use another package
1.45 wiz 12940: to build itself and there is no <code xmlns=
12941: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12942: "filename">buildlink3.mk</code> file available,
12943: use the <code class=
12944: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 12945: <pre class="programlisting">
1.51 rillig 12946: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1 grant 12947: </pre>
12948: </li>
12949:
12950: <li>
12951: <p>If your package needs a library with which to
1.45 wiz 12952: link and again there is no <code xmlns=
12953: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12954: "filename">buildlink3.mk</code> file available,
12955: this is specified using the <code class=
1.71 wiz 12956: "varname">DEPENDS</code> definition. For
12957: example:</p>
1.1 grant 12958: <pre class="programlisting">
1.51 rillig 12959: DEPENDS+= xpm-3.4j:../../graphics/xpm
1.1 grant 12960: </pre>
12961:
12962: <p>You can also use wildcards in package
12963: dependences:</p>
12964: <pre class="programlisting">
1.51 rillig 12965: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
1.1 grant 12966: </pre>
12967:
12968: <p>Note that such wildcard dependencies are
12969: retained when creating binary packages. The
12970: dependency is checked when installing the binary
12971: package and any package which matches the pattern
12972: will be used. Wildcard dependencies should be
12973: used with care.</p>
12974:
12975: <p>The “<span class=
12976: "quote">-[0-9]*</span>” should be used
12977: instead of “<span class=
12978: "quote">-*</span>” to avoid potentially
12979: ambiguous matches such as “<span class=
12980: "quote">tk-postgresql</span>” matching a
12981: “<span class="quote">tk-*</span>”
1.14 xtraeme 12982: <code class="varname">DEPENDS</code>.</p>
1.1 grant 12983:
12984: <p>Wildcards can also be used to specify that a
12985: package will only build against a certain minimum
12986: version of a pre-requisite:</p>
12987: <pre class="programlisting">
1.51 rillig 12988: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
1.1 grant 12989: </pre>
12990:
12991: <p>This means that the package will build against
12992: version 3.5.4 of the tiff library or newer. Such
12993: a dependency may be warranted if, for example,
12994: the API of the library has changed with version
12995: 3.5.4 and a package would not compile against an
12996: earlier version of tiff.</p>
12997:
12998: <p>Please note that such dependencies should only
12999: be updated if a package requires a newer
13000: pre-requisite, but not to denote recommendations
1.72 rillig 13001: such as ABI changes that do not prevent a package
13002: from building correctly. Such recommendations can
13003: be expressed using <code class=
13004: "varname">ABI_DEPENDS</code>:</p>
1.1 grant 13005: <pre class="programlisting">
1.72 rillig 13006: ABI_DEPENDS+= tiff>=3.6.1:../../graphics/tiff
1.1 grant 13007: </pre>
13008:
1.14 xtraeme 13009: <p>In addition to the above <code class=
13010: "varname">DEPENDS</code> line, this denotes that
1.1 grant 13011: while a package will build against
13012: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 13013: recommended. <code class=
1.72 rillig 13014: "varname">ABI_DEPENDS</code> entries will be
1.14 xtraeme 13015: turned into dependencies unless explicitly
13016: ignored (in which case a warning will be
1.36 wiz 13017: printed).</p>
13018:
1.72 rillig 13019: <p>To ignore these ABI dependency recommendations
13020: and just use the required <code class=
1.36 wiz 13021: "varname">DEPENDS</code>, set <code class=
1.72 rillig 13022: "varname">USE_ABI_DEPENDS=NO</code>. This may
1.36 wiz 13023: make it easier and faster to update packages
13024: built using pkgsrc, since older compatible
13025: dependencies can continue to be used. This is
13026: useful for people who watch their rebuilds very
13027: carefully; it is not very good as a
13028: general-purpose hammer. If you use it, you need
13029: to be mindful of possible ABI changes, including
13030: those from the underlying OS.</p>
13031:
13032: <p>Packages that are built with recommendations
13033: ignored may not be uploaded to ftp.NetBSD.org by
13034: developers and should not be used across
13035: different systems that may have different
13036: versions of binary packages installed.</p>
1.1 grant 13037:
13038: <p>For security fixes, please update the package
1.72 rillig 13039: vulnerabilities file. See <a href=
13040: "#security-handling" title=
1.68 rillig 13041: "16.1.8. Handling packages with security problems">
13042: Section 16.1.8, “Handling packages
1.67 hubertf 13043: with security problems”</a> for more
1.1 grant 13044: information.</p>
13045: </li>
13046:
13047: <li>
13048: <p>If your package needs some executable to be
1.17 sketch 13049: able to run correctly and if there's no
1.45 wiz 13050: <code xmlns=
13051: "http://www.w3.org/TR/xhtml1/transitional" class=
13052: "filename">buildlink3.mk</code> file, this is
13053: specified using the <code class=
1.14 xtraeme 13054: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 13055: "http://www.w3.org/TR/xhtml1/transitional" href=
13056: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 13057: target="_top"><code xmlns="" class=
13058: "filename">print/lyx</code></a> package needs to
13059: be able to execute the latex binary from the
13060: teTeX package when it runs, and that is
13061: specified:</p>
1.1 grant 13062: <pre class="programlisting">
1.51 rillig 13063: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
1.1 grant 13064: </pre>
13065:
13066: <p>The comment about wildcard dependencies from
13067: previous paragraph applies here, too.</p>
13068: </li>
13069: </ol>
13070: </div>
13071:
13072: <p>If your package needs files from another package to
1.71 wiz 13073: build, add the relevant distribution files to
13074: <code class="varname">DISTFILES</code>, so they will be
13075: extracted automatically. See the <a xmlns=
1.1 grant 13076: "http://www.w3.org/TR/xhtml1/transitional" href=
1.71 wiz 13077: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript/README.html"
1.45 wiz 13078: target="_top"><code xmlns="" class=
1.71 wiz 13079: "filename">print/ghostscript</code></a> package for an
13080: example. (It relies on the jpeg sources being present
13081: in source form during the build.)</p>
1.1 grant 13082:
1.14 xtraeme 13083: <p>Please also note the <code class=
13084: "varname">BUILD_USES_MSGFMT</code> and <code class=
13085: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
13086: which are provided as convenience definitions. The
1.24 wiz 13087: former works out whether <a href=
13088: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
13089: <span class="citerefentry"><span class=
13090: "refentrytitle">msgfmt</span>(1)</span></a> is part of
13091: the base system, and, if it isn't, installs the
13092: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
13093: href=
1.1 grant 13094: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45 wiz 13095: target="_top"><code xmlns="" class=
13096: "filename">devel/gettext</code></a> package. The latter
1.20 ben 13097: adds a build dependency on either an installed version
13098: of an older gettext package, or if it isn't, installs
13099: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
13100: href=
13101: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45 wiz 13102: target="_top"><code xmlns="" class=
13103: "filename">devel/gettext-m4</code></a> package.</p>
1.1 grant 13104: </div>
13105:
1.67 hubertf 13106: <div class="sect2" lang="en">
1.1 grant 13107: <div class="titlepage">
13108: <div>
13109: <div>
1.67 hubertf 13110: <h3 class="title"><a name=
1.68 rillig 13111: "conflicts"></a>16.1.5. Handling conflicts
1.1 grant 13112: with other packages</h3>
13113: </div>
13114: </div>
13115: </div>
13116:
13117: <p>Your package may conflict with other packages a user
13118: might already have installed on his system, e.g. if
13119: your package installs the same set of files like
13120: another package in our pkgsrc tree.</p>
13121:
1.14 xtraeme 13122: <p>In this case you can set <code class=
1.47 reed 13123: "varname">CONFLICTS</code> to a space-separated list of
1.1 grant 13124: packages (including version string) your package
13125: conflicts with.</p>
13126:
1.47 reed 13127: <p>For example, <a xmlns=
1.1 grant 13128: "http://www.w3.org/TR/xhtml1/transitional" href=
13129: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45 wiz 13130: target="_top"><code xmlns="" class=
13131: "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20 ben 13132: "http://www.w3.org/TR/xhtml1/transitional" href=
13133: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45 wiz 13134: target="_top"><code xmlns="" class=
1.47 reed 13135: "filename">x11/Xaw-Xpm</code></a> install the same
13136: shared library, thus you set in <code xmlns=
1.45 wiz 13137: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 13138: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 13139: <pre class="programlisting">
1.51 rillig 13140: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 grant 13141: </pre>
13142:
1.45 wiz 13143: <p>and in <code xmlns=
13144: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13145: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 13146: <pre class="programlisting">
1.51 rillig 13147: CONFLICTS= Xaw3d-[0-9]*
1.1 grant 13148: </pre>
13149:
13150: <p>Packages will automatically conflict with other
13151: packages with the name prefix and a different version
13152: string. “<span class=
13153: "quote">Xaw3d-1.5</span>” e.g. will automatically
13154: conflict with the older version “<span class=
13155: "quote">Xaw3d-1.3</span>”.</p>
13156: </div>
13157:
1.67 hubertf 13158: <div class="sect2" lang="en">
1.1 grant 13159: <div class="titlepage">
13160: <div>
13161: <div>
1.67 hubertf 13162: <h3 class="title"><a name=
1.68 rillig 13163: "not-building-packages"></a>16.1.6. Packages
1.30 wiz 13164: that cannot or should not be built</h3>
1.1 grant 13165: </div>
13166: </div>
13167: </div>
13168:
13169: <p>There are several reasons why a package might be
13170: instructed to not build under certain circumstances. If
13171: the package builds and runs on most platforms, the
1.14 xtraeme 13172: exceptions should be noted with <code class=
13173: "varname">NOT_FOR_PLATFORM</code>. If the package
13174: builds and runs on a small handful of platforms, set
13175: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45 wiz 13176: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
13177: <code class="varname">NOT_FOR_PLATFORM</code> are OS
13178: triples (OS-version-platform) that can use glob-style
13179: wildcards.</p>
13180:
13181: <p>If the package should be skipped (for example,
13182: because it provides functionality already provided by
13183: the system), set <code class=
1.14 xtraeme 13184: "varname">PKG_SKIP_REASON</code> to a descriptive
13185: message. If the package should fail because some
13186: preconditions are not met, set <code class=
13187: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 13188: message.</p>
13189: </div>
13190:
1.67 hubertf 13191: <div class="sect2" lang="en">
1.1 grant 13192: <div class="titlepage">
13193: <div>
13194: <div>
1.67 hubertf 13195: <h3 class="title"><a name=
1.68 rillig 13196: "undeletable-packages"></a>16.1.7. Packages
1.30 wiz 13197: which should not be deleted, once installed</h3>
1.1 grant 13198: </div>
13199: </div>
13200: </div>
13201:
13202: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 13203: has been installed, the <code class=
13204: "varname">PKG_PRESERVE</code> definition should be set
13205: in the package Makefile. This will be carried into any
1.1 grant 13206: binary package that is made from this pkgsrc entry. A
13207: “<span class="quote">preserved</span>”
13208: package will not be deleted using <a href=
13209: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
13210: <span class="citerefentry"><span class=
13211: "refentrytitle">pkg_delete</span>(1)</span></a> unless
13212: the “<span class="quote">-f</span>” option
13213: is used.</p>
13214: </div>
13215:
1.67 hubertf 13216: <div class="sect2" lang="en">
1.1 grant 13217: <div class="titlepage">
13218: <div>
13219: <div>
1.67 hubertf 13220: <h3 class="title"><a name=
1.68 rillig 13221: "security-handling"></a>16.1.8. Handling
1.1 grant 13222: packages with security problems</h3>
13223: </div>
13224: </div>
13225: </div>
13226:
13227: <p>When a vulnerability is found, this should be noted
1.45 wiz 13228: in <code xmlns=
13229: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13230: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43 wiz 13231: and after committing that file, use
13232: <span><strong class="command">make
13233: upload</strong></span> in the same directory to update
13234: the file on ftp.NetBSD.org.</p>
13235:
13236: <p>After fixing the vulnerability by a patch, its
13237: <code class="varname">PKGREVISION</code> should be
13238: increased (this is of course not necessary if the
13239: problem is fixed by using a newer release of the
1.72 rillig 13240: software).</p>
1.1 grant 13241:
13242: <p>Also, if the fix should be applied to the stable
13243: pkgsrc branch, be sure to submit a pullup request!</p>
1.43 wiz 13244:
13245: <p>Binary packages already on ftp.NetBSD.org will be
13246: handled semi-automatically by a weekly cron job.</p>
1.1 grant 13247: </div>
13248:
1.67 hubertf 13249: <div class="sect2" lang="en">
1.1 grant 13250: <div class="titlepage">
13251: <div>
13252: <div>
1.67 hubertf 13253: <h3 class="title"><a name=
1.68 rillig 13254: "compiler-bugs"></a>16.1.9. How to handle
1.1 grant 13255: compiler bugs</h3>
13256: </div>
13257: </div>
13258: </div>
13259:
13260: <p>Some source files trigger bugs in the compiler,
13261: based on combinations of compiler version and
13262: architecture and almost always relation to optimisation
13263: being enabled. Common symptoms are gcc internal errors
13264: or never finishing compiling a file.</p>
13265:
1.47 reed 13266: <p>Typically, a workaround involves testing the
1.14 xtraeme 13267: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 13268: version, disabling optimisation for that
1.14 xtraeme 13269: file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45 wiz 13270: combination, and documenting it in <code xmlns=
13271: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13272: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 13273: number of examples!</p>
13274: </div>
13275:
1.67 hubertf 13276: <div class="sect2" lang="en">
1.1 grant 13277: <div class="titlepage">
13278: <div>
13279: <div>
1.67 hubertf 13280: <h3 class="title"><a name=
1.68 rillig 13281: "bumping-pkgrevision"></a>16.1.10. How to
1.30 wiz 13282: handle incrementing versions when fixing an
13283: existing package</h3>
1.1 grant 13284: </div>
13285: </div>
13286: </div>
13287:
13288: <p>When making fixes to an existing package it can be
1.14 xtraeme 13289: useful to change the version number in <code class=
13290: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 13291: future versions by the original author, a
13292: “<span class="quote">nb1</span>”,
13293: “<span class="quote">nb2</span>”, ...
13294: suffix can be used on package versions by setting
1.14 xtraeme 13295: <code class="varname">PKGREVISION=1</code> (2, ...).
13296: The “<span class="quote">nb</span>” is
13297: treated like a “<span class=
13298: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 13299: <pre class="programlisting">
1.51 rillig 13300: DISTNAME= foo-17.42
13301: PKGREVISION= 9
1.1 grant 13302: </pre>
13303:
1.14 xtraeme 13304: <p>will result in a <code class=
13305: "varname">PKGNAME</code> of “<span class=
1.1 grant 13306: "quote">foo-17.42nb9</span>”.</p>
13307:
13308: <p>When a new release of the package is released, the
1.14 xtraeme 13309: <code class="varname">PKGREVISION</code> should be
1.47 reed 13310: removed, e.g. on a new minor release of the above
1.14 xtraeme 13311: package, things should be like:</p>
1.1 grant 13312: <pre class="programlisting">
1.51 rillig 13313: DISTNAME= foo-17.43
1.1 grant 13314: </pre>
13315: </div>
13316:
1.67 hubertf 13317: <div class="sect2" lang="en">
1.1 grant 13318: <div class="titlepage">
13319: <div>
13320: <div>
1.30 wiz 13321: <h3 class="title"><a name=
1.68 rillig 13322: "portability-of-packages"></a>16.1.11. Portability
1.30 wiz 13323: of packages</h3>
1.1 grant 13324: </div>
13325: </div>
13326: </div>
13327:
13328: <p>One appealing feature of pkgsrc is that it runs on
13329: many different platforms. As a result, it is important
13330: to ensure, where possible, that packages in pkgsrc are
13331: portable. There are some particular details you should
13332: pay attention to while working on pkgsrc.</p>
13333:
1.67 hubertf 13334: <div class="sect3" lang="en">
1.1 grant 13335: <div class="titlepage">
13336: <div>
13337: <div>
1.67 hubertf 13338: <h4 class="title"><a name=
1.68 rillig 13339: "install-scripts"></a>16.1.11.1. ${INSTALL},
1.1 grant 13340: ${INSTALL_DATA_DIR}, ...</h4>
13341: </div>
13342: </div>
13343: </div>
13344:
1.14 xtraeme 13345: <p>The BSD-compatible <span><strong class=
13346: "command">install</strong></span> supplied with some
1.1 grant 13347: operating systems will not perform more than one
13348: operation at a time. As such, you should call
13349: “<span class="quote">${INSTALL}</span>”,
13350: etc. like this:</p>
13351: <pre class="programlisting">
1.51 rillig 13352: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
13353: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1 grant 13354: </pre>
13355: </div>
13356: </div>
13357: </div>
13358:
1.67 hubertf 13359: <div class="sect1" lang="en">
1.1 grant 13360: <div class="titlepage">
13361: <div>
13362: <div>
13363: <h2 class="title" style="clear: both"><a name=
1.68 rillig 13364: "downloading-issues"></a>16.2. Possible
1.1 grant 13365: downloading issues</h2>
13366: </div>
13367: </div>
13368: </div>
13369:
1.67 hubertf 13370: <div class="sect2" lang="en">
1.1 grant 13371: <div class="titlepage">
13372: <div>
13373: <div>
1.67 hubertf 13374: <h3 class="title"><a name=
1.68 rillig 13375: "no-plain-download"></a>16.2.1. Packages
1.30 wiz 13376: whose distfiles aren't available for plain
1.1 grant 13377: downloading</h3>
13378: </div>
13379: </div>
13380: </div>
13381:
13382: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 13383: set <code class="varname">DYNAMIC_MASTER_SITES</code>
13384: and a <span><strong class="command">make
1.45 wiz 13385: fetch</strong></span> will call <code xmlns=
13386: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13387: "filename">files/getsite.sh</code> with the name of
13388: each file to download as an argument, expecting it to
13389: output the URL of the directory from which to download
13390: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
13391: href=
1.1 grant 13392: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45 wiz 13393: target="_top"><code xmlns="" class=
13394: "filename">graphics/ns-cult3d</code></a> is an example
13395: of this usage.</p>
1.1 grant 13396:
13397: <p>If the download can't be automated, because the user
13398: must submit personal information to apply for a
13399: password, or must pay for the source, or whatever, you
1.74 ! rillig 13400: can set <code class="varname">FETCH_MESSAGE</code> to a
! 13401: list of lines that are displayed to the user before
! 13402: aborting the build. Example:</p>
! 13403: <pre class="programlisting">
! 13404: FETCH_MESSAGE= "Please download the files"
! 13405: FETCH_MESSAGE+= " "${DISTFILES:Q}
! 13406: FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
! 13407: </pre>
1.1 grant 13408: </div>
13409:
1.67 hubertf 13410: <div class="sect2" lang="en">
1.1 grant 13411: <div class="titlepage">
13412: <div>
13413: <div>
1.30 wiz 13414: <h3 class="title"><a name=
1.68 rillig 13415: "modified-distfiles-same-name"></a>16.2.2. How
1.30 wiz 13416: to handle modified distfiles with the 'old'
13417: name</h3>
1.1 grant 13418: </div>
13419: </div>
13420: </div>
13421:
13422: <p>Sometimes authors of a software package make some
13423: modifications after the software was released, and they
13424: put up a new distfile without changing the package's
13425: version number. If a package is already in pkgsrc at
1.32 wiz 13426: that time, the checksum will no longer match. The
13427: contents of the new distfile should be compared against
13428: the old one before changing anything, to make sure the
13429: distfile was really updated on purpose, and that no
13430: trojan horse or so crept in. Then, the correct way to
13431: work around this is to set <code class=
13432: "varname">DIST_SUBDIR</code> to a unique directory
13433: name, usually based on <code class=
13434: "varname">PKGNAME_NOREV</code>. In case this happens
13435: more often, <code class="varname">PKGNAME</code> can be
1.45 wiz 13436: used (thus including the <code xmlns=
13437: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 13438: "filename">nbX</code> suffix) or a date stamp can be
13439: appended, like <code class=
13440: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45 wiz 13441: forget regenerating the <code xmlns=
13442: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 13443: "filename">distinfo</code> file after that, since it
13444: contains the <code class="varname">DIST_SUBDIR</code>
13445: path in the filenames. Furthermore, a mail to the
13446: package's authors seems appropriate telling them that
13447: changing distfiles after releases without changing the
13448: file names is not good practice.</p>
1.1 grant 13449: </div>
13450: </div>
13451:
1.67 hubertf 13452: <div class="sect1" lang="en">
1.1 grant 13453: <div class="titlepage">
13454: <div>
13455: <div>
13456: <h2 class="title" style="clear: both"><a name=
1.68 rillig 13457: "configuration-gotchas"></a>16.3. Configuration
1.1 grant 13458: gotchas</h2>
13459: </div>
13460: </div>
13461: </div>
13462:
1.67 hubertf 13463: <div class="sect2" lang="en">
1.1 grant 13464: <div class="titlepage">
13465: <div>
13466: <div>
1.67 hubertf 13467: <h3 class="title"><a name=
1.68 rillig 13468: "fixes.libtool"></a>16.3.1. Shared libraries
1.1 grant 13469: - libtool</h3>
13470: </div>
13471: </div>
13472: </div>
13473:
13474: <p>pkgsrc supports many different machines, with
13475: different object formats like a.out and ELF, and
13476: varying abilities to do shared library and dynamic
13477: loading at all. To accompany this, varying commands and
13478: options have to be passed to the compiler, linker, etc.
13479: to get the Right Thing, which can be pretty annoying
13480: especially if you don't have all the machines at your
13481: hand to test things. The <a xmlns=
13482: "http://www.w3.org/TR/xhtml1/transitional" href=
13483: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45 wiz 13484: target="_top"><code xmlns="" class=
13485: "filename">devel/libtool</code></a> pkg can help here,
13486: as it just “<span class=
13487: "quote">knows</span>” how to build both static
13488: and dynamic libraries from a set of source files, thus
1.47 reed 13489: being platform-independent.</p>
1.1 grant 13490:
13491: <p>Here's how to use libtool in a pkg in seven simple
13492: steps:</p>
13493:
13494: <div class="orderedlist">
13495: <ol type="1">
13496: <li>
1.14 xtraeme 13497: <p>Add <code class=
13498: "varname">USE_LIBTOOL=yes</code> to the package
13499: Makefile.</p>
1.1 grant 13500: </li>
13501:
13502: <li>
13503: <p>For library objects, use “<span class=
13504: "quote">${LIBTOOL} --mode=compile
13505: ${CC}</span>” in place of
13506: “<span class="quote">${CC}</span>”.
13507: You could even add it to the definition of
1.14 xtraeme 13508: <code class="varname">CC</code>, if only
13509: libraries are being built in a given Makefile.
13510: This one command will build both PIC and non-PIC
13511: library objects, so you need not have separate
13512: shared and non-shared library rules.</p>
1.1 grant 13513: </li>
13514:
13515: <li>
13516: <p>For the linking of the library, remove any
13517: “<span class="quote">ar</span>”,
13518: “<span class="quote">ranlib</span>”,
13519: and “<span class="quote">ld
13520: -Bshareable</span>” commands, and instead
13521: use:</p>
13522: <pre class="programlisting">
1.51 rillig 13523: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
13524: -rpath ${PREFIX}/lib -version-info major:minor
1.1 grant 13525: </pre>
13526:
13527: <p>Note that the library is changed to have a
1.45 wiz 13528: <code xmlns=
13529: "http://www.w3.org/TR/xhtml1/transitional" class=
13530: "filename">.la</code> extension, and the objects
13531: are changed to have a <code xmlns=
13532: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13533: "filename">.lo</code> extension. Change
13534: <code class="varname">OBJS</code> as necessary.
13535: This automatically creates all of the
1.45 wiz 13536: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13537: class="filename">.a</code>, <code xmlns=
13538: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13539: "filename">.so.major.minor</code>, and ELF
13540: symlinks (if necessary) in the build directory.
13541: Be sure to include “<span class=
1.1 grant 13542: "quote">-version-info</span>”, especially
13543: when major and minor are zero, as libtool will
13544: otherwise strip off the shared library
13545: version.</p>
13546:
13547: <p>From the libtool manual:</p>
13548: <pre class="programlisting">
1.51 rillig 13549: So, libtool library versions are described by three integers:
1.1 grant 13550:
1.51 rillig 13551: CURRENT
13552: The most recent interface number that this library implements.
1.1 grant 13553:
1.51 rillig 13554: REVISION
13555: The implementation number of the CURRENT interface.
1.1 grant 13556:
1.51 rillig 13557: AGE
13558: The difference between the newest and oldest interfaces that
13559: this library implements. In other words, the library implements
13560: all the interface numbers in the range from number `CURRENT -
13561: AGE' to `CURRENT'.
1.68 rillig 13562:
1.51 rillig 13563: If two libraries have identical CURRENT and AGE numbers, then the
13564: dynamic linker chooses the library with the greater REVISION number.
1.1 grant 13565: </pre>
13566:
13567: <p>The “<span class=
13568: "quote">-release</span>” option will
13569: produce different results for a.out and ELF
13570: (excluding symlinks) in only one case. An ELF
13571: library of the form “<span class=
13572: "quote">libfoo-release.so.<span class=
13573: "emphasis"><em>x</em></span>.<span class=
13574: "emphasis"><em>y</em></span></span>” will
13575: have a symlink of “<span class=
13576: "quote">libfoo.so.<span class=
13577: "emphasis"><em>x</em></span>.<span class=
13578: "emphasis"><em>y</em></span></span>” on an
13579: a.out platform. This is handled
13580: automatically.</p>
13581:
13582: <p>The “<span class="quote">-rpath
13583: argument</span>” is the install directory
13584: of the library being built.</p>
13585:
1.45 wiz 13586: <p>In the <code xmlns=
13587: "http://www.w3.org/TR/xhtml1/transitional" class=
13588: "filename">PLIST</code>, include only the
13589: <code xmlns=
13590: "http://www.w3.org/TR/xhtml1/transitional" class=
1.19 hubertf 13591: "filename">.la</code> file, the other files will
13592: be added automatically.</p>
1.1 grant 13593: </li>
13594:
13595: <li>
1.45 wiz 13596: <p>When linking shared object (<code xmlns=
13597: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13598: "filename">.so</code>) files, i.e. files that are
1.24 wiz 13599: loaded via <a href=
13600: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
13601: <span class="citerefentry"><span class=
13602: "refentrytitle">dlopen</span>(3)</span></a>, NOT
13603: shared libraries, use “<span class=
13604: "quote">-module -avoid-version</span>” to
13605: prevent them getting version tacked on.</p>
1.1 grant 13606:
1.45 wiz 13607: <p>The <code xmlns=
13608: "http://www.w3.org/TR/xhtml1/transitional" class=
13609: "filename">PLIST</code> file gets the
13610: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13611: class="filename">foo.so</code> entry.</p>
1.1 grant 13612: </li>
13613:
13614: <li>
13615: <p>When linking programs that depend on these
13616: libraries <span class=
13617: "emphasis"><em>before</em></span> they are
13618: installed, preface the <a href=
13619: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
13620: <span class="citerefentry"><span class=
13621: "refentrytitle">cc</span>(1)</span></a> or
13622: <a href=
13623: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
13624: <span class="citerefentry"><span class=
13625: "refentrytitle">ld</span>(1)</span></a> line with
13626: “<span class="quote">${LIBTOOL}
13627: --mode=link</span>”, and it will find the
13628: correct libraries (static or shared), but please
13629: be aware that libtool will not allow you to
13630: specify a relative path in -L (such as
13631: “<span class=
13632: "quote">-L../somelib</span>”), because it
13633: expects you to change that argument to be the
1.45 wiz 13634: <code xmlns=
13635: "http://www.w3.org/TR/xhtml1/transitional" class=
13636: "filename">.la</code> file. e.g.</p>
1.1 grant 13637: <pre class="programlisting">
1.51 rillig 13638: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1 grant 13639: </pre>
13640:
13641: <p>should be changed to:</p>
13642: <pre class="programlisting">
1.51 rillig 13643: ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14 xtraeme 13644: "replaceable"><code>someprog</code></em> <em class=
13645: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 13646: </pre>
13647:
13648: <p>and it will do the right thing with the
13649: libraries.</p>
13650: </li>
13651:
13652: <li>
13653: <p>When installing libraries, preface the
13654: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
13655: <span class="citerefentry"><span class=
13656: "refentrytitle">install</span>(1)</span></a> or
13657: <a href=
13658: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
13659: <span class="citerefentry"><span class=
13660: "refentrytitle">cp</span>(1)</span></a> command
13661: with “<span class="quote">${LIBTOOL}
13662: --mode=install</span>”, and change the
1.45 wiz 13663: library name to <code xmlns=
13664: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13665: "filename">.la</code>. e.g.</p>
1.1 grant 13666: <pre class="programlisting">
1.51 rillig 13667: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 grant 13668: </pre>
13669:
1.45 wiz 13670: <p>This will install the static <code xmlns=
13671: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13672: "filename">.a</code>, shared library, any needed
1.1 grant 13673: symlinks, and run <a href=
13674: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
13675: <span class="citerefentry"><span class=
13676: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
13677: </li>
13678:
13679: <li>
1.45 wiz 13680: <p>In your <code xmlns=
13681: "http://www.w3.org/TR/xhtml1/transitional" class=
13682: "filename">PLIST</code>, include only the
13683: <code xmlns=
13684: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 13685: "filename">.la</code> file (this is a change from
13686: previous behaviour).</p>
1.1 grant 13687: </li>
13688: </ol>
13689: </div>
13690: </div>
13691:
1.67 hubertf 13692: <div class="sect2" lang="en">
1.1 grant 13693: <div class="titlepage">
13694: <div>
13695: <div>
1.67 hubertf 13696: <h3 class="title"><a name=
1.68 rillig 13697: "using-libtool"></a>16.3.2. Using libtool on
1.30 wiz 13698: GNU packages that already support libtool</h3>
1.1 grant 13699: </div>
13700: </div>
13701: </div>
13702:
1.14 xtraeme 13703: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
13704: the package Makefile. This will override the package's
13705: own libtool in most cases. For older libtool using
1.1 grant 13706: packages, libtool is made by ltconfig script during the
13707: do-configure step; you can check the libtool script
1.14 xtraeme 13708: location by doing <span><strong class="command">make
13709: configure; find work*/ -name
13710: libtool</strong></span>.</p>
13711:
13712: <p><code class="varname">LIBTOOL_OVERRIDE</code>
13713: specifies which libtool scripts, relative to
13714: <code class="varname">WRKSRC</code>, to override. By
13715: default, it is set to “<span class=
13716: "quote">libtool */libtool */*/libtool</span>”. If
13717: this does not match the location of the package's
13718: libtool script(s), set it as appropriate.</p>
1.13 hubertf 13719:
1.45 wiz 13720: <p>If you do not need <code xmlns=
13721: "http://www.w3.org/TR/xhtml1/transitional" class=
13722: "filename">*.a</code> static libraries built and
13723: installed, then use <code class=
13724: "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1 grant 13725:
1.47 reed 13726: <p>If your package makes use of the
13727: platform-independent library for loading dynamic shared
13728: objects, that comes with libtool (libltdl), you should
13729: include devel/libltdl/buildlink3.mk.</p>
1.1 grant 13730:
13731: <p>Some packages use libtool incorrectly so that the
13732: package may not work or build in some circumstances.
13733: Some of the more common errors are:</p>
13734:
13735: <div class="itemizedlist">
13736: <ul type="disc">
13737: <li>
13738: <p>The inclusion of a shared object (-module) as
13739: a dependent library in an executable or library.
13740: This in itself isn't a problem if one of two
13741: things has been done:</p>
13742:
13743: <div class="orderedlist">
13744: <ol type="1">
13745: <li>
13746: <p>The shared object is named correctly,
1.45 wiz 13747: i.e. <code xmlns=
13748: "http://www.w3.org/TR/xhtml1/transitional"
13749: class="filename">libfoo.la</code>, not
13750: <code xmlns=
13751: "http://www.w3.org/TR/xhtml1/transitional"
13752: class="filename">foo.la</code></p>
1.1 grant 13753: </li>
13754:
13755: <li>
13756: <p>The -dlopen option is used when linking
13757: an executable.</p>
13758: </li>
13759: </ol>
13760: </div>
13761: </li>
13762:
13763: <li>
13764: <p>The use of libltdl without the correct calls
13765: to initialisation routines. The function
13766: lt_dlinit() should be called and the macro
1.14 xtraeme 13767: <code class=
13768: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 13769: included in executables.</p>
13770: </li>
13771: </ul>
13772: </div>
13773: </div>
13774:
1.67 hubertf 13775: <div class="sect2" lang="en">
1.1 grant 13776: <div class="titlepage">
13777: <div>
13778: <div>
1.67 hubertf 13779: <h3 class="title"><a name=
1.68 rillig 13780: "autoconf-automake"></a>16.3.3. GNU
1.1 grant 13781: Autoconf/Automake</h3>
13782: </div>
13783: </div>
13784: </div>
13785:
13786: <p>If a package needs GNU autoconf or automake to be
13787: executed to regenerate the configure script and
13788: Makefile.in makefile templates, then they should be
1.35 jmmv 13789: executed in a pre-configure target.</p>
1.1 grant 13790:
13791: <p>For packages that need only autoconf:</p>
13792: <pre class="programlisting">
1.51 rillig 13793: AUTOCONF_REQD= 2.50 # if default version is not good enough
13794: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
13795: ...
1.1 grant 13796:
1.51 rillig 13797: pre-configure:
13798: cd ${WRKSRC}; autoconf
1.1 grant 13799:
1.51 rillig 13800: ...
1.1 grant 13801: </pre>
13802:
13803: <p>and for packages that need automake and
13804: autoconf:</p>
13805: <pre class="programlisting">
1.51 rillig 13806: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
13807: USE_TOOLS+= automake # use "automake14" for automake-1.4
13808: ...
1.1 grant 13809:
1.51 rillig 13810: pre-configure:
13811: cd ${WRKSRC}; \
13812: aclocal; autoheader; \
13813: automake -a --foreign -i; autoconf
13814:
13815: ...
1.1 grant 13816: </pre>
13817:
13818: <p>Packages which use GNU Automake will almost
1.35 jmmv 13819: certainly require GNU Make.</p>
1.1 grant 13820:
13821: <p>There are times when the configure process makes
13822: additional changes to the generated files, which then
13823: causes the build process to try to re-execute the
13824: automake sequence. This is prevented by touching
13825: various files in the configure stage. If this causes
1.14 xtraeme 13826: problems with your package you can set <code class=
13827: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 13828: Makefile.</p>
13829: </div>
13830: </div>
13831:
1.67 hubertf 13832: <div class="sect1" lang="en">
1.1 grant 13833: <div class="titlepage">
13834: <div>
13835: <div>
13836: <h2 class="title" style="clear: both"><a name=
1.68 rillig 13837: "fixes-build"></a>16.4. Building the
1.55 rillig 13838: package</h2>
1.1 grant 13839: </div>
13840: </div>
13841: </div>
13842:
1.67 hubertf 13843: <div class="sect2" lang="en">
1.1 grant 13844: <div class="titlepage">
13845: <div>
13846: <div>
1.67 hubertf 13847: <h3 class="title"><a name=
1.68 rillig 13848: "cpp-defines"></a>16.4.1. CPP defines</h3>
1.1 grant 13849: </div>
13850: </div>
13851: </div>
13852:
1.55 rillig 13853: <p>Sometimes you need to compile different code
13854: depending on the target platform. The C preprocessor
13855: has a set of predefined macros that can be queried by
13856: using <code class="varname">#ifdef FOO</code> or
13857: <code class="varname">#if defined(FOO)</code>. Among
13858: these macros are usually ones that describe the target
13859: CPU and operating system. Depending of which of the
13860: macros are defined, you can write code that uses
1.61 rillig 13861: features unique to a specific platform. Generally you
13862: should rather use the GNU autotools (automake,
13863: autoconf, etc.) to check for specific features (like
13864: the existence of a header file, a function or a
13865: library), but sometimes this is not possible or
13866: desired.</p>
13867:
13868: <p>In that case you can use the predefined macros below
13869: to configure your code to the platform it runs on.
13870: Almost every operating system, hardware architecture
13871: and compiler has its own macro. For example, if the
13872: macros <code class="varname">__GNUC__</code>,
13873: <code class="varname">__i386__</code> and <code class=
1.55 rillig 13874: "varname">__NetBSD__</code> are all defined, you know
1.61 rillig 13875: that you are using NetBSD on an i386 compatible CPU,
13876: and your compiler is GCC.</p>
1.55 rillig 13877:
1.67 hubertf 13878: <div class="sect3" lang="en">
1.55 rillig 13879: <div class="titlepage">
13880: <div>
13881: <div>
13882: <h4 class="title"><a name=
1.68 rillig 13883: "fixes-build-cpp-opsys"></a>16.4.1.1. CPP
1.55 rillig 13884: defines for operating systems</h4>
13885: </div>
13886: </div>
13887: </div>
13888:
13889: <p>To distinguish between 4.4 BSD-derived systems and
13890: the rest of the world, you should use the following
13891: code.</p>
13892: <pre class="programlisting">
1.51 rillig 13893: #include <sys/param.h>
1.55 rillig 13894: #if (defined(BSD) && BSD >= 199306)
1.60 rillig 13895: /* BSD-specific code goes here */
1.55 rillig 13896: #else
1.60 rillig 13897: /* non-BSD-specific code goes here */
1.55 rillig 13898: #endif
1.1 grant 13899: </pre>
13900:
1.55 rillig 13901: <p>If this distinction is not fine enough, you can
13902: also use the following defines.</p>
13903: <pre class="programlisting">
13904: FreeBSD __FreeBSD__
1.56 rillig 13905: DragonFly __DragonFly__
1.57 minskim 13906: Interix __INTERIX
1.55 rillig 13907: Linux linux, __linux, __linux__
13908: NetBSD __NetBSD__
13909: OpenBSD __OpenBSD__
1.60 rillig 13910: Solaris sun, __sun
1.1 grant 13911: </pre>
1.55 rillig 13912: </div>
1.1 grant 13913:
1.67 hubertf 13914: <div class="sect3" lang="en">
1.55 rillig 13915: <div class="titlepage">
13916: <div>
13917: <div>
1.67 hubertf 13918: <h4 class="title"><a name=
1.68 rillig 13919: "fixes-build-cpp-cpu"></a>16.4.1.2. CPP
1.55 rillig 13920: defines for CPUs</h4>
13921: </div>
13922: </div>
13923: </div>
13924: <pre class="programlisting">
13925: i386 i386, __i386, __i386__
13926: MIPS __mips
13927: SPARC sparc, __sparc
13928: </pre>
13929: </div>
13930:
1.67 hubertf 13931: <div class="sect3" lang="en">
1.55 rillig 13932: <div class="titlepage">
13933: <div>
13934: <div>
13935: <h4 class="title"><a name=
1.68 rillig 13936: "fixes-build-cpp-compiler"></a>16.4.1.3. CPP
1.55 rillig 13937: defines for compilers</h4>
13938: </div>
13939: </div>
13940: </div>
13941: <pre class="programlisting">
13942: GCC __GNUC__ (major version), __GNUC_MINOR__
1.60 rillig 13943: SunPro __SUNPRO_C (0x570 for version 5.7)
1.55 rillig 13944: </pre>
13945: </div>
1.1 grant 13946: </div>
1.51 rillig 13947:
1.67 hubertf 13948: <div class="sect2" lang="en">
1.51 rillig 13949: <div class="titlepage">
13950: <div>
13951: <div>
1.67 hubertf 13952: <h3 class="title"><a name=
1.68 rillig 13953: "cpp-list-examples"></a>16.4.2. Examples of
1.60 rillig 13954: CPP defines for some platforms</h3>
13955: </div>
13956: </div>
13957: </div>
13958:
13959: <p>The list of the CPP identification macros for
13960: hardware and operating system may depend on the
13961: compiler that is used. The following list contains some
13962: examples that may help you to choose the right ones.
13963: For example, if you want to conditionally compile code
13964: on Solaris, don't use <code class=
13965: "varname">__sun__</code>, as the SunPro compiler does
13966: not define it. Use <code class="varname">__sun</code>
13967: instead.</p>
13968:
13969: <div class="variablelist">
13970: <dl>
1.61 rillig 13971: <dt><span class="term">GCC 3.3.3 + SuSE Linux 9.1 +
13972: i386</span></dt>
13973:
13974: <dd>
1.62 rillig 13975: <p>__ELF__, __gnu_linux__, __i386, __i386__,
1.61 rillig 13976: __linux, __linux__, __unix, __unix__, i386,
13977: linux, unix.</p>
13978: </dd>
13979:
13980: <dt><span class="term">GCC 2.95 + NetBSD 1.6.2 +
13981: i386</span></dt>
13982:
13983: <dd>
1.62 rillig 13984: <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61 rillig 13985: i386.</p>
13986: </dd>
13987:
13988: <dt><span class="term">GCC 3.3.3 + NetBSD 2.0 +
13989: i386</span></dt>
1.60 rillig 13990:
13991: <dd>
1.62 rillig 13992: <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61 rillig 13993: i386.</p>
1.60 rillig 13994: </dd>
13995:
13996: <dt><span class="term">GCC 4 + Solaris 8 +
13997: SPARC</span></dt>
13998:
13999: <dd>
14000: <p>__ELF__, __sparc, __sparc__, __sun, __sun__,
14001: __SVR4, __svr4__, __unix, __unix__, sparc, sun,
14002: unix.</p>
14003: </dd>
1.61 rillig 14004:
14005: <dt><span class="term">SunPro 5.7 + Solaris 8 +
14006: SPARC</span></dt>
14007:
14008: <dd>
14009: <p>__SVR4, __sparc, __sun, __unix, sparc, sun,
14010: unix.</p>
14011: </dd>
1.60 rillig 14012: </dl>
14013: </div>
14014: </div>
14015:
1.67 hubertf 14016: <div class="sect2" lang="en">
1.60 rillig 14017: <div class="titlepage">
14018: <div>
14019: <div>
1.67 hubertf 14020: <h3 class="title"><a name=
1.68 rillig 14021: "cpp-list"></a>16.4.3. Getting a list of CPP
1.51 rillig 14022: defines</h3>
14023: </div>
14024: </div>
14025: </div>
14026:
1.60 rillig 14027: <p>If your system uses the GNU C Compiler, you can get
14028: a list of symbols that are defined by default, e.g. to
14029: identify the platform, with the following command:</p>
1.51 rillig 14030: <pre class="programlisting">
14031: gcc -E -dM - < /dev/null
14032: </pre>
1.60 rillig 14033:
14034: <p>On other systems you may get the list by using the
14035: system's syscall trace utility (ktrace, truss, strace)
14036: to have a look which arguments are passed to the actual
14037: compiler.</p>
1.51 rillig 14038: </div>
1.1 grant 14039: </div>
14040:
1.67 hubertf 14041: <div class="sect1" lang="en">
1.1 grant 14042: <div class="titlepage">
14043: <div>
14044: <div>
14045: <h2 class="title" style="clear: both"><a name=
1.68 rillig 14046: "package-specific-actions"></a>16.5. Package
1.1 grant 14047: specific actions</h2>
14048: </div>
14049: </div>
14050: </div>
14051:
1.67 hubertf 14052: <div class="sect2" lang="en">
1.1 grant 14053: <div class="titlepage">
14054: <div>
14055: <div>
1.67 hubertf 14056: <h3 class="title"><a name=
1.68 rillig 14057: "user-interaction"></a>16.5.1. User
1.2 hubertf 14058: interaction</h3>
1.1 grant 14059: </div>
14060: </div>
14061: </div>
14062:
14063: <p>Occasionally, packages require interaction from the
14064: user, and this can be in a number of ways:</p>
14065:
14066: <div class="itemizedlist">
14067: <ul type="disc">
14068: <li>
14069: <p>help in fetching the distfiles</p>
14070: </li>
14071:
14072: <li>
14073: <p>help to configure the package before it is
14074: built</p>
14075: </li>
14076:
14077: <li>
14078: <p>help during the build process</p>
14079: </li>
14080:
14081: <li>
14082: <p>help during the installation of a package</p>
14083: </li>
14084: </ul>
14085: </div>
14086:
1.14 xtraeme 14087: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 14088: definition is provided to notify the pkgsrc mechanism
14089: of an interactive stage which will be needed, and this
1.45 wiz 14090: should be set in the package's <code xmlns=
14091: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 14092: "filename">Makefile</code>, e.g.:</p>
1.1 grant 14093: <pre class="programlisting">
1.51 rillig 14094: INTERACTIVE_STAGE= build
1.1 grant 14095: </pre>
14096:
14097: <p>Multiple interactive stages can be specified:</p>
14098: <pre class="programlisting">
1.51 rillig 14099: INTERACTIVE_STAGE= configure install
1.1 grant 14100: </pre>
14101: </div>
14102:
1.67 hubertf 14103: <div class="sect2" lang="en">
1.1 grant 14104: <div class="titlepage">
14105: <div>
14106: <div>
1.67 hubertf 14107: <h3 class="title"><a name=
1.68 rillig 14108: "handling-licenses"></a>16.5.2. Handling
1.1 grant 14109: licenses</h3>
14110: </div>
14111: </div>
14112: </div>
14113:
1.44 gdt 14114: <p>A package may be covered by a license which the user
14115: has or has not agreed to accept. For these cases,
14116: pkgsrc contains a mechanism to note that a package is
14117: covered by a particular license, and the package cannot
14118: be built unless the user has accepted the license.
14119: (Installation of binary packages are not currently
14120: subject to this mechanism.) Packages with licenses that
14121: are either Open Source according to the Open Source
14122: Initiative or Free according to the Free Software
14123: Foundation will not be marked with a license tag.
14124: Packages with licenses that have not been determined to
14125: meet either definition will be marked with a license
14126: tag referring to the license. This will prevent
14127: building unless pkgsrc is informed that the license is
14128: acceptable, and enables displaying the license.</p>
14129:
14130: <p>The license tag mechanism is intended to address
14131: copyright-related issues surrounding building,
14132: installing and using a package, and not to address
14133: redistribution issues (see <code class=
14134: "varname">RESTRICTED</code> and <code class=
14135: "varname">NO_SRC_ON_FTP</code>, etc.). However, the
14136: above definition of licenses for which tags are not
14137: needed implies that packages with redistribution
14138: restrictions should have tags.</p>
14139:
14140: <p>Denoting that a package is covered by a particular
1.45 wiz 14141: license is done by placing the license in <code xmlns=
14142: "http://www.w3.org/TR/xhtml1/transitional" class=
1.44 gdt 14143: "filename">pkgsrc/licenses</code> and setting the
14144: <code class="varname">LICENSE</code> variable to a
14145: string identifying the license, e.g. in <a xmlns=
1.14 xtraeme 14146: "http://www.w3.org/TR/xhtml1/transitional" href=
1.44 gdt 14147: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45 wiz 14148: target="_top"><code xmlns="" class=
14149: "filename">graphics/xv</code></a>:</p>
1.1 grant 14150: <pre class="programlisting">
1.51 rillig 14151: LICENSE= xv-license
1.1 grant 14152: </pre>
14153:
14154: <p>When trying to build, the user will get a notice
1.44 gdt 14155: that the package is covered by a license which has not
14156: been accepted:</p>
1.1 grant 14157: <pre class="programlisting">
1.51 rillig 14158: <code class="prompt">%</code> <strong class=
1.14 xtraeme 14159: "userinput"><code>make</code></strong>
1.51 rillig 14160: ===> xv-3.10anb9 has an unacceptable license: xv-license.
14161: ===> To view the license, enter "/usr/bin/make show-license".
14162: ===> To indicate acceptance, add this line to your /etc/mk.conf:
14163: ===> ACCEPTABLE_LICENSES+=xv-license
14164: *** Error code 1
1.1 grant 14165: </pre>
14166:
1.14 xtraeme 14167: <p>The license can be viewed with <span><strong class=
14168: "command">make show-license</strong></span>, and if it
14169: is considered appropriate, the line printed above can
1.45 wiz 14170: be added to <code xmlns=
14171: "http://www.w3.org/TR/xhtml1/transitional" class=
14172: "filename">/etc/mk.conf</code> to indicate acceptance
14173: of the particular license:</p>
1.1 grant 14174: <pre class="programlisting">
1.51 rillig 14175: ACCEPTABLE_LICENSES+=xv-license
1.1 grant 14176: </pre>
14177:
14178: <p>When adding a package with a new license, the
1.45 wiz 14179: license text should be added to <code xmlns=
14180: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14181: "filename">pkgsrc/licenses</code> for displaying. A
14182: list of known licenses can be seen in this directory as
14183: well as by looking at the list of (commented out)
14184: <code class="varname">ACCEPTABLE_LICENSES</code>
1.45 wiz 14185: variable settings in <code xmlns=
14186: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14187: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 14188:
1.44 gdt 14189: <p>The use of <code class=
14190: "varname">LICENSE=shareware</code>, <code class=
14191: "varname">LICENSE=no-commercial-use</code>, and similar
14192: language is deprecated because it does not crisply
14193: refer to a particular license text. Another problem
14194: with such usage is that it does not enable a user to
14195: denote acceptance of the license for a single package
14196: without accepting the same license text for another
14197: package. In particular, this can be inappropriate when
14198: e.g. one accepts a particular license to indicate to
14199: pkgsrc that a fee has been paid.</p>
1.1 grant 14200: </div>
14201:
1.67 hubertf 14202: <div class="sect2" lang="en">
1.1 grant 14203: <div class="titlepage">
14204: <div>
14205: <div>
1.30 wiz 14206: <h3 class="title"><a name=
1.68 rillig 14207: "installing-score-files"></a>16.5.3. Installing
1.30 wiz 14208: score files</h3>
1.1 grant 14209: </div>
14210: </div>
14211: </div>
14212:
14213: <p>Certain packages, most of them in the games
14214: category, install a score file that allows all users on
14215: the system to record their highscores. In order for
14216: this to work, the binaries need to be installed setgid
14217: and the score files owned by the appropriate group
14218: and/or owner (traditionally the "games" user/group).
14219: The following variables, documented in more detail in
1.45 wiz 14220: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14221: class="filename">mk/defaults/mk.conf</code>, control
14222: this behaviour: <code class=
1.14 xtraeme 14223: "varname">SETGIDGAME</code>, <code class=
14224: "varname">GAMEDATAMODE</code>, <code class=
14225: "varname">GAMEGRP</code>, <code class=
14226: "varname">GAMEMODE</code>, <code class=
14227: "varname">GAMEOWN</code>.</p>
1.1 grant 14228:
14229: <p>Note that per default, setgid installation of games
1.14 xtraeme 14230: is disabled; setting <code class=
14231: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 14232: variables accordingly.</p>
14233:
14234: <p>A package should therefor never hard code file
1.14 xtraeme 14235: ownership or access permissions but rely on
14236: <code class="varname">INSTALL_GAME</code> and
14237: <code class="varname">INSTALL_GAME_DATA</code> to set
14238: these correctly.</p>
1.1 grant 14239: </div>
14240:
1.67 hubertf 14241: <div class="sect2" lang="en">
1.1 grant 14242: <div class="titlepage">
14243: <div>
14244: <div>
1.67 hubertf 14245: <h3 class="title"><a name=
1.68 rillig 14246: "perl-scripts"></a>16.5.4. Packages
1.30 wiz 14247: containing perl scripts</h3>
1.1 grant 14248: </div>
14249: </div>
14250: </div>
14251:
14252: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 14253: set <code class="varname">REPLACE_PERL</code> to ensure
14254: that the proper interpreter path is set. <code class=
14255: "varname">REPLACE_PERL</code> should contain a list of
14256: scripts, relative to <code class=
14257: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 14258: </div>
14259:
1.67 hubertf 14260: <div class="sect2" lang="en">
1.1 grant 14261: <div class="titlepage">
14262: <div>
14263: <div>
1.67 hubertf 14264: <h3 class="title"><a name=
1.68 rillig 14265: "hardcoded-paths"></a>16.5.5. Packages with
1.1 grant 14266: hardcoded paths to other interpreters</h3>
14267: </div>
14268: </div>
14269: </div>
14270:
14271: <p>Your package may also contain scripts with hardcoded
14272: paths to other interpreters besides (or as well as)
14273: perl. To correct the full pathname to the script
14274: interpreter, you need to set the following definitions
1.45 wiz 14275: in your <code xmlns=
14276: "http://www.w3.org/TR/xhtml1/transitional" class=
14277: "filename">Makefile</code> (we shall use
14278: <span><strong class="command">tclsh</strong></span> in
14279: this example):</p>
1.1 grant 14280: <pre class="programlisting">
1.51 rillig 14281: REPLACE_INTERPRETER+= tcl
1.71 wiz 14282: REPLACE.tcl.old= .*/bin/tclsh
14283: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
14284: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
1.51 rillig 14285: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1 grant 14286: </pre>
1.71 wiz 14287:
14288: <div class="note" style=
14289: "margin-left: 0.5in; margin-right: 0.5in;">
14290: <h3 class="title">Note</h3>
14291:
14292: <p>Before March 2006, these variables were called
14293: <code class="varname">_REPLACE.*</code> and
14294: <code class="varname">_REPLACE_FILES.*</code>.</p>
14295: </div>
1.1 grant 14296: </div>
14297:
1.67 hubertf 14298: <div class="sect2" lang="en">
1.1 grant 14299: <div class="titlepage">
14300: <div>
14301: <div>
1.67 hubertf 14302: <h3 class="title"><a name=
1.68 rillig 14303: "perl-modules"></a>16.5.6. Packages
1.30 wiz 14304: installing perl modules</h3>
1.1 grant 14305: </div>
14306: </div>
14307: </div>
14308:
14309: <p>Makefiles of packages providing perl5 modules should
1.45 wiz 14310: include the Makefile fragment <code xmlns=
14311: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14312: "filename">../../lang/perl5/module.mk</code>. It
14313: provides a <span><strong class=
14314: "command">do-configure</strong></span> target for the
14315: standard perl configuration for such modules as well as
14316: various hooks to tune this configuration. See comments
14317: in this file for details.</p>
1.1 grant 14318:
14319: <p>Perl5 modules will install into different places
14320: depending on the version of perl used during the build
14321: process. To address this, pkgsrc will append lines to
1.45 wiz 14322: the <code xmlns=
14323: "http://www.w3.org/TR/xhtml1/transitional" class=
14324: "filename">PLIST</code> corresponding to the files
14325: listed in the installed <code xmlns=
14326: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14327: "filename">.packlist</code> file generated by most
14328: perl5 modules. This is invoked by defining <code class=
14329: "varname">PERL5_PACKLIST</code> to a space-separated
14330: list of paths to packlist files, e.g.:</p>
1.1 grant 14331: <pre class="programlisting">
1.51 rillig 14332: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1 grant 14333: </pre>
14334:
1.14 xtraeme 14335: <p>The variables <code class=
14336: "varname">PERL5_SITELIB</code>, <code class=
14337: "varname">PERL5_SITEARCH</code>, and <code class=
14338: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 14339: locations in which perl5 modules may be installed, and
14340: may be used by perl5 packages that don't have a
14341: packlist. These three variables are also substituted
1.45 wiz 14342: for in the <code xmlns=
14343: "http://www.w3.org/TR/xhtml1/transitional" class=
14344: "filename">PLIST</code>.</p>
1.1 grant 14345: </div>
14346:
1.67 hubertf 14347: <div class="sect2" lang="en">
1.1 grant 14348: <div class="titlepage">
14349: <div>
14350: <div>
1.67 hubertf 14351: <h3 class="title"><a name=
1.68 rillig 14352: "faq.info-files"></a>16.5.7. Packages
1.1 grant 14353: installing info files</h3>
14354: </div>
14355: </div>
14356: </div>
14357:
14358: <p>Some packages install info files or use the
14359: “<span class="quote">makeinfo</span>” or
14360: “<span class="quote">install-info</span>”
1.72 rillig 14361: commands. <code class="varname">INFO_FILES</code>
14362: should be defined in the package Makefile so that
14363: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14364: class="filename">INSTALL</code> and <code xmlns=
1.45 wiz 14365: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14366: "filename">DEINSTALL</code> scripts will be generated
14367: to handle registration of the info files in the Info
1.1 grant 14368: directory file. The “<span class=
14369: "quote">install-info</span>” command used for the
14370: info files registration is either provided by the
14371: system, or by a special purpose package automatically
14372: added as dependency if needed.</p>
14373:
1.72 rillig 14374: <p><code class="varname">PKGINFODIR</code> is the
14375: directory under <code xmlns=
14376: "http://www.w3.org/TR/xhtml1/transitional" class=
14377: "filename">${PREFIX}</code> where info files are
14378: primarily located. <code class=
14379: "varname">PKGINFODIR</code> defaults to
14380: “<span class="quote">info</span>” and can
14381: be overridden by the user.</p>
14382:
14383: <p>The info files for the package should be listed in
14384: the package <code xmlns=
14385: "http://www.w3.org/TR/xhtml1/transitional" class=
14386: "filename">PLIST</code>; however any split info files
14387: need not be listed.</p>
14388:
1.1 grant 14389: <p>A package which needs the “<span class=
14390: "quote">makeinfo</span>” command at build time
1.72 rillig 14391: must add “<span class=
14392: "quote">makeinfo</span>” to <code class=
14393: "varname">USE_TOOLS</code> in its Makefile. If a
1.1 grant 14394: minimum version of the “<span class=
14395: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 14396: should be noted with the <code class=
14397: "varname">TEXINFO_REQD</code> variable in the package
1.45 wiz 14398: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14399: class="filename">Makefile</code>. By default, a minimum
14400: version of 3.12 is required. If the system does not
14401: provide a <span><strong class=
1.14 xtraeme 14402: "command">makeinfo</strong></span> command or if it
14403: does not match the required minimum, a build dependency
14404: on the <a xmlns=
14405: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 14406: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45 wiz 14407: target="_top"><code xmlns="" class=
14408: "filename">devel/gtexinfo</code></a> package will be
1.20 ben 14409: added automatically.</p>
1.1 grant 14410:
14411: <p>The build and installation process of the software
14412: provided by the package should not use the
1.14 xtraeme 14413: <span><strong class=
14414: "command">install-info</strong></span> command as the
14415: registration of info files is the task of the package
1.45 wiz 14416: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14417: class="filename">INSTALL</code> script, and it must use
14418: the appropriate <span><strong class=
1.14 xtraeme 14419: "command">makeinfo</strong></span> command.</p>
1.1 grant 14420:
1.47 reed 14421: <p>To achieve this goal, the pkgsrc infrastructure
1.14 xtraeme 14422: creates overriding scripts for the <span><strong class=
14423: "command">install-info</strong></span> and
14424: <span><strong class="command">makeinfo</strong></span>
14425: commands in a directory listed early in <code class=
14426: "varname">PATH</code>.</p>
1.1 grant 14427:
1.14 xtraeme 14428: <p>The script overriding <span><strong class=
14429: "command">install-info</strong></span> has no effect
14430: except the logging of a message. The script overriding
14431: <span><strong class="command">makeinfo</strong></span>
14432: logs a message and according to the value of
1.72 rillig 14433: <code class="varname">TEXINFO_REQD</code> either runs
1.14 xtraeme 14434: the appropriate <span><strong class=
14435: "command">makeinfo</strong></span> command or exit on
14436: error.</p>
1.1 grant 14437: </div>
14438:
1.67 hubertf 14439: <div class="sect2" lang="en">
1.57 minskim 14440: <div class="titlepage">
14441: <div>
14442: <div>
1.67 hubertf 14443: <h3 class="title"><a name=
1.68 rillig 14444: "manpages"></a>16.5.8. Packages installing
1.57 minskim 14445: man pages</h3>
14446: </div>
14447: </div>
14448: </div>
14449:
14450: <p>Many packages install manual pages. The man pages
14451: are installed under <code class=
14452: "varname">${PREFIX}/${PKGMANDIR}</code> which is
14453: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14454: class="filename">/usr/pkg/man</code> by default.
14455: <code class="varname">PKGMANDIR</code> defaults to
14456: “<span class="quote">man</span>”. For
14457: example, you can set <code class=
14458: "varname">PKGMANDIR</code> to “<span class=
14459: "quote">share/man</span>” to have man pages
14460: install under <code xmlns=
14461: "http://www.w3.org/TR/xhtml1/transitional" class=
14462: "filename">/usr/pkg/share/man/</code> by default.</p>
14463:
14464: <div class="note" style=
14465: "margin-left: 0.5in; margin-right: 0.5in;">
14466: <h3 class="title">Note</h3>
14467:
14468: <p>The support for a custom <code class=
14469: "varname">PKGMANDIR</code> is not complete.</p>
14470: </div>
14471:
14472: <p>The <code xmlns=
14473: "http://www.w3.org/TR/xhtml1/transitional" class=
14474: "filename">PLIST</code> files can just use <code xmlns=
14475: "http://www.w3.org/TR/xhtml1/transitional" class=
14476: "filename">man/</code> as the top level directory for
14477: the man page file entries and the pkgsrc framework will
14478: convert as needed.</p>
14479:
14480: <p>Packages that are configured with <code class=
14481: "varname">GNU_CONFIGURE</code> set as
14482: “<span class="quote">yes</span>”, by
14483: default will use the <code xmlns=
14484: "http://www.w3.org/TR/xhtml1/transitional" class=
14485: "filename">./configure</code> --mandir switch to set
14486: where the man pages should be installed. The path is
14487: <code class="varname">GNU_CONFIGURE_MANDIR</code> which
14488: defaults to <code class=
14489: "varname">${PREFIX}/${PKGMANDIR}</code>.</p>
14490:
14491: <p>Packages that use <code class=
14492: "varname">GNU_CONFIGURE</code> but do not use --mandir,
14493: can set <code class=
14494: "varname">CONFIGURE_HAS_MANDIR</code> to
14495: “<span class="quote">no</span>”. Or if the
14496: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14497: class="filename">./configure</code> script uses a
14498: non-standard use of --mandir, you can set <code class=
14499: "varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
14500:
14501: <p>See <a href="#manpage-compression" title=
14502: "10.5. Man page compression">Section 10.5,
14503: “Man page compression”</a> for information
14504: on installation of compressed manual pages.</p>
14505: </div>
14506:
1.67 hubertf 14507: <div class="sect2" lang="en">
1.1 grant 14508: <div class="titlepage">
14509: <div>
14510: <div>
1.67 hubertf 14511: <h3 class="title"><a name=
1.68 rillig 14512: "gconf2-data-files"></a>16.5.9. Packages
1.30 wiz 14513: installing GConf2 data files</h3>
1.1 grant 14514: </div>
14515: </div>
14516: </div>
14517:
1.45 wiz 14518: <p>If a package installs <code xmlns=
14519: "http://www.w3.org/TR/xhtml1/transitional" class=
14520: "filename">.schemas</code> or <code xmlns=
14521: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14522: "filename">.entries</code> files, used by GConf2, you
1.1 grant 14523: need to take some extra steps to make sure they get
14524: registered in the database:</p>
14525:
14526: <div class="orderedlist">
14527: <ol type="1">
14528: <li>
1.45 wiz 14529: <p>Include <code xmlns=
14530: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14531: "filename">../../devel/GConf2/schemas.mk</code>
1.45 wiz 14532: instead of its <code xmlns=
14533: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14534: "filename">buildlink3.mk</code> file. This takes
1.1 grant 14535: care of rebuilding the GConf2 database at
14536: installation and deinstallation time, and tells
14537: the package where to install GConf2 data files
14538: using some standard configure arguments. It also
14539: disallows any access to the database directly
14540: from the package.</p>
14541: </li>
14542:
14543: <li>
14544: <p>Ensure that the package installs its
1.45 wiz 14545: <code xmlns=
14546: "http://www.w3.org/TR/xhtml1/transitional" class=
14547: "filename">.schemas</code> files under
14548: <code xmlns=
14549: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14550: "filename">${PREFIX}/share/gconf/schemas</code>.
1.45 wiz 14551: If they get installed under <code xmlns=
14552: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14553: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 14554: manually patch the package.</p>
14555: </li>
14556:
14557: <li>
14558: <p>Check the PLIST and remove any entries under
14559: the etc/gconf directory, as they will be handled
14560: automatically. See <a href="#faq.conf" title=
1.38 dillo 14561: "7.14. How do I change the location of configuration files?">
14562: Section 7.14, “How do I change the
1.35 jmmv 14563: location of configuration files?”</a> for
14564: more information.</p>
1.1 grant 14565: </li>
14566:
14567: <li>
1.14 xtraeme 14568: <p>Define the <code class=
14569: "varname">GCONF2_SCHEMAS</code> variable in your
1.45 wiz 14570: <code xmlns=
14571: "http://www.w3.org/TR/xhtml1/transitional" class=
14572: "filename">Makefile</code> with a list of all
14573: <code xmlns=
14574: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14575: "filename">.schemas</code> files installed by the
14576: package, if any. Names must not contain any
14577: directories in them.</p>
1.1 grant 14578: </li>
14579:
14580: <li>
1.14 xtraeme 14581: <p>Define the <code class=
14582: "varname">GCONF2_ENTRIES</code> variable in your
1.45 wiz 14583: <code xmlns=
14584: "http://www.w3.org/TR/xhtml1/transitional" class=
14585: "filename">Makefile</code> with a list of all
14586: <code xmlns=
14587: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14588: "filename">.entries</code> files installed by the
14589: package, if any. Names must not contain any
14590: directories in them.</p>
1.1 grant 14591: </li>
14592: </ol>
14593: </div>
14594: </div>
14595:
1.67 hubertf 14596: <div class="sect2" lang="en">
1.1 grant 14597: <div class="titlepage">
14598: <div>
14599: <div>
1.30 wiz 14600: <h3 class="title"><a name=
1.68 rillig 14601: "scrollkeeper-data-files"></a>16.5.10. Packages
1.30 wiz 14602: installing scrollkeeper data files</h3>
1.1 grant 14603: </div>
14604: </div>
14605: </div>
14606:
1.45 wiz 14607: <p>If a package installs <code xmlns=
14608: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14609: "filename">.omf</code> files, used by scrollkeeper, you
14610: need to take some extra steps to make sure they get
14611: registered in the database:</p>
1.1 grant 14612:
14613: <div class="orderedlist">
14614: <ol type="1">
14615: <li>
1.45 wiz 14616: <p>Include <code xmlns=
14617: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14618: "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45 wiz 14619: instead of its <code xmlns=
14620: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14621: "filename">buildlink3.mk</code> file. This takes
1.1 grant 14622: care of rebuilding the scrollkeeper database at
14623: installation and deinstallation time, and
14624: disallows any access to it directly from the
14625: package.</p>
14626: </li>
14627:
14628: <li>
14629: <p>Check the PLIST and remove any entries under
1.45 wiz 14630: the <code xmlns=
14631: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14632: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 14633: as they will be handled automatically.</p>
14634: </li>
14635:
14636: <li>
1.45 wiz 14637: <p>Remove the <code xmlns=
14638: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14639: "filename">share/omf</code> directory from the
14640: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 14641: </li>
14642: </ol>
14643: </div>
14644: </div>
14645:
1.67 hubertf 14646: <div class="sect2" lang="en">
1.1 grant 14647: <div class="titlepage">
14648: <div>
14649: <div>
1.67 hubertf 14650: <h3 class="title"><a name=
1.68 rillig 14651: "x11-fonts"></a>16.5.11. Packages installing
1.1 grant 14652: X11 fonts</h3>
14653: </div>
14654: </div>
14655: </div>
14656:
14657: <p>If a package installs font files, you will need to
14658: rebuild the fonts database in the directory where they
14659: get installed at installation and deinstallation time.
1.65 hubertf 14660: This can be automatically done by using the pkginstall
14661: framework.</p>
1.1 grant 14662:
1.65 hubertf 14663: <p>You can list the directories where fonts are
14664: installed in the <code class=
14665: "varname">FONTS_DIRS.<em class=
14666: "replaceable"><code>type</code></em></code> variables,
14667: where <em class="replaceable"><code>type</code></em>
14668: can be one of “<span class=
14669: "quote">ttf</span>”, “<span class=
14670: "quote">type1</span>” or “<span class=
14671: "quote">x11</span>”. Also make sure that the
14672: database file <code xmlns=
1.45 wiz 14673: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14674: "filename">fonts.dir</code> is not listed in the
1.1 grant 14675: PLIST.</p>
14676:
14677: <p>Note that you should not create new directories for
14678: fonts; instead use the standard ones to avoid that the
14679: user needs to manually configure his X server to find
14680: them.</p>
14681: </div>
14682:
1.67 hubertf 14683: <div class="sect2" lang="en">
1.1 grant 14684: <div class="titlepage">
14685: <div>
14686: <div>
1.67 hubertf 14687: <h3 class="title"><a name=
1.68 rillig 14688: "gtk2-modules"></a>16.5.12. Packages
1.30 wiz 14689: installing GTK2 modules</h3>
1.1 grant 14690: </div>
14691: </div>
14692: </div>
14693:
1.47 reed 14694: <p>If a package installs GTK2 immodules or loaders, you
1.1 grant 14695: need to take some extra steps to get them registered in
14696: the GTK2 database properly:</p>
14697:
14698: <div class="orderedlist">
14699: <ol type="1">
14700: <li>
1.45 wiz 14701: <p>Include <code xmlns=
14702: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14703: "filename">../../x11/gtk2/modules.mk</code>
1.45 wiz 14704: instead of its <code xmlns=
14705: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14706: "filename">buildlink3.mk</code> file. This takes
14707: care of rebuilding the database at installation
14708: and deinstallation time.</p>
1.1 grant 14709: </li>
14710:
14711: <li>
1.14 xtraeme 14712: <p>Set <code class=
14713: "varname">GTK2_IMMODULES=YES</code> if your
14714: package installs GTK2 immodules.</p>
1.1 grant 14715: </li>
14716:
14717: <li>
1.14 xtraeme 14718: <p>Set <code class=
14719: "varname">GTK2_LOADERS=YES</code> if your package
14720: installs GTK2 loaders.</p>
1.1 grant 14721: </li>
14722:
14723: <li>
1.47 reed 14724: <p>Patch the package to not touch any of the GTK2
1.1 grant 14725: databases directly. These are:</p>
14726:
14727: <div class="itemizedlist">
14728: <ul type="disc">
14729: <li>
1.45 wiz 14730: <p><code xmlns=
14731: "http://www.w3.org/TR/xhtml1/transitional"
14732: class=
1.14 xtraeme 14733: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 14734: </li>
14735:
14736: <li>
1.45 wiz 14737: <p><code xmlns=
14738: "http://www.w3.org/TR/xhtml1/transitional"
14739: class=
1.14 xtraeme 14740: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 14741: </li>
14742: </ul>
14743: </div>
14744: </li>
14745:
14746: <li>
14747: <p>Check the PLIST and remove any entries under
1.45 wiz 14748: the <code xmlns=
14749: "http://www.w3.org/TR/xhtml1/transitional" class=
14750: "filename">libdata/gtk-2.0</code> directory, as
14751: they will be handled automatically.</p>
1.1 grant 14752: </li>
14753: </ol>
14754: </div>
14755: </div>
14756:
1.67 hubertf 14757: <div class="sect2" lang="en">
1.1 grant 14758: <div class="titlepage">
14759: <div>
14760: <div>
1.67 hubertf 14761: <h3 class="title"><a name=
1.68 rillig 14762: "sgml-xml-data"></a>16.5.13. Packages
1.30 wiz 14763: installing SGML or XML data</h3>
1.1 grant 14764: </div>
14765: </div>
14766: </div>
14767:
14768: <p>If a package installs SGML or XML data files that
14769: need to be registered in system-wide catalogs (like
14770: DTDs, sub-catalogs, etc.), you need to take some extra
14771: steps:</p>
14772:
14773: <div class="orderedlist">
14774: <ol type="1">
14775: <li>
1.45 wiz 14776: <p>Include <code xmlns=
14777: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14778: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45 wiz 14779: in your <code xmlns=
14780: "http://www.w3.org/TR/xhtml1/transitional" class=
14781: "filename">Makefile</code>, which takes care of
14782: registering those files in system-wide catalogs
14783: at installation and deinstallation time.</p>
1.1 grant 14784: </li>
14785:
14786: <li>
1.14 xtraeme 14787: <p>Set <code class="varname">SGML_CATALOGS</code>
14788: to the full path of any SGML catalogs installed
14789: by the package.</p>
1.1 grant 14790: </li>
14791:
14792: <li>
1.14 xtraeme 14793: <p>Set <code class="varname">XML_CATALOGS</code>
14794: to the full path of any XML catalogs installed by
1.1 grant 14795: the package.</p>
14796: </li>
14797:
14798: <li>
1.14 xtraeme 14799: <p>Set <code class="varname">SGML_ENTRIES</code>
14800: to individual entries to be added to the SGML
1.1 grant 14801: catalog. These come in groups of three strings;
14802: see xmlcatmgr(1) for more information
14803: (specifically, arguments recognized by the 'add'
14804: action). Note that you will normally not use this
14805: variable.</p>
14806: </li>
14807:
14808: <li>
1.14 xtraeme 14809: <p>Set <code class="varname">XML_ENTRIES</code>
14810: to individual entries to be added to the XML
1.1 grant 14811: catalog. These come in groups of three strings;
14812: see xmlcatmgr(1) for more information
14813: (specifically, arguments recognized by the 'add'
14814: action). Note that you will normally not use this
14815: variable.</p>
14816: </li>
14817: </ol>
14818: </div>
14819: </div>
14820:
1.67 hubertf 14821: <div class="sect2" lang="en">
1.1 grant 14822: <div class="titlepage">
14823: <div>
14824: <div>
1.67 hubertf 14825: <h3 class="title"><a name=
1.68 rillig 14826: "mime-database"></a>16.5.14. Packages
1.30 wiz 14827: installing extensions to the MIME database</h3>
1.1 grant 14828: </div>
14829: </div>
14830: </div>
14831:
14832: <p>If a package provides extensions to the MIME
1.45 wiz 14833: database by installing <code xmlns=
14834: "http://www.w3.org/TR/xhtml1/transitional" class=
14835: "filename">.xml</code> files inside <code xmlns=
14836: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14837: "filename">${PREFIX}/share/mime/packages</code>, you
14838: need to take some extra steps to ensure that the
14839: database is kept consistent with respect to these new
14840: files:</p>
1.1 grant 14841:
14842: <div class="orderedlist">
14843: <ol type="1">
14844: <li>
1.45 wiz 14845: <p>Include <code xmlns=
14846: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14847: "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45 wiz 14848: (avoid using the <code xmlns=
14849: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14850: "filename">buildlink3.mk</code> file from this
14851: same directory, which is reserved for inclusion
1.45 wiz 14852: from other <code xmlns=
14853: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14854: "filename">buildlink3.mk</code> files). It takes
14855: care of rebuilding the MIME database at
14856: installation and deinstallation time, and
14857: disallows any access to it directly from the
1.1 grant 14858: package.</p>
14859: </li>
14860:
14861: <li>
14862: <p>Check the PLIST and remove any entries under
1.45 wiz 14863: the <code xmlns=
14864: "http://www.w3.org/TR/xhtml1/transitional" class=
14865: "filename">share/mime</code> directory,
14866: <span class="emphasis"><em>except</em></span> for
14867: files saved under <code xmlns=
14868: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14869: "filename">share/mime/packages</code>. The former
1.1 grant 14870: are handled automatically by the
1.47 reed 14871: update-mime-database program, but the latter are
1.1 grant 14872: package-dependent and must be removed by the
14873: package that installed them in the first
14874: place.</p>
14875: </li>
14876:
14877: <li>
1.45 wiz 14878: <p>Remove any <code xmlns=
14879: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14880: "filename">share/mime/*</code> directories from
14881: the PLIST. They will be handled by the
1.1 grant 14882: shared-mime-info package.</p>
14883: </li>
14884: </ol>
14885: </div>
14886: </div>
14887:
1.67 hubertf 14888: <div class="sect2" lang="en">
1.1 grant 14889: <div class="titlepage">
14890: <div>
14891: <div>
1.67 hubertf 14892: <h3 class="title"><a name=
1.68 rillig 14893: "intltool"></a>16.5.15. Packages using
1.1 grant 14894: intltool</h3>
14895: </div>
14896: </div>
14897: </div>
14898:
14899: <p>If a package uses intltool during its build, include
1.45 wiz 14900: the <code xmlns=
14901: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14902: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 14903: file, which forces it to use the intltool package
14904: provided by pkgsrc, instead of the one bundled with the
14905: distribution file.</p>
14906:
14907: <p>This tracks intltool's build-time dependencies and
14908: uses the latest available version; this way, the
14909: package benefits of any bug fixes that may have
14910: appeared since it was released.</p>
14911: </div>
1.18 xtraeme 14912:
1.67 hubertf 14913: <div class="sect2" lang="en">
1.18 xtraeme 14914: <div class="titlepage">
14915: <div>
14916: <div>
1.67 hubertf 14917: <h3 class="title"><a name=
1.68 rillig 14918: "startup-scripts"></a>16.5.16. Packages
1.30 wiz 14919: installing startup scripts</h3>
1.18 xtraeme 14920: </div>
14921: </div>
14922: </div>
14923:
14924: <p>If a package contains a rc.d script, it won't be
14925: copied into the startup directory by default, but you
14926: can enable it, by adding the option <code class=
1.45 wiz 14927: "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
14928: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 14929: "filename">/etc/mk.conf</code>. This option will copy
1.45 wiz 14930: the scripts into <code xmlns=
14931: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 14932: "filename">/etc/rc.d</code> when a package is
14933: installed, and it will automatically remove the scripts
14934: when the package is deinstalled.</p>
14935: </div>
1.57 minskim 14936:
1.67 hubertf 14937: <div class="sect2" lang="en">
1.57 minskim 14938: <div class="titlepage">
14939: <div>
14940: <div>
1.67 hubertf 14941: <h3 class="title"><a name=
1.68 rillig 14942: "tex-packages"></a>16.5.17. Packages
1.57 minskim 14943: installing TeX modules</h3>
14944: </div>
14945: </div>
14946: </div>
14947:
14948: <p>If a package installs TeX packages into the texmf
14949: tree, the <code xmlns=
14950: "http://www.w3.org/TR/xhtml1/transitional" class=
14951: "filename">ls-R</code> database of the tree needs to be
14952: updated.</p>
14953:
14954: <div class="note" style=
14955: "margin-left: 0.5in; margin-right: 0.5in;">
14956: <h3 class="title">Note</h3>
14957:
14958: <p>Except the main TeX packages such as teTeX-texmf,
14959: packages should install files into <code class=
14960: "varname">PKG_LOCALTEXMFPREFIX</code>, not
14961: <code class="varname">PKG_TEXMFPREFIX</code>.</p>
14962: </div>
14963:
14964: <div class="orderedlist">
14965: <ol type="1">
14966: <li>
14967: <p>Include <code xmlns=
14968: "http://www.w3.org/TR/xhtml1/transitional" class=
14969: "filename">../../print/teTeX/module.mk</code>
14970: instead of <code xmlns=
14971: "http://www.w3.org/TR/xhtml1/transitional" class=
14972: "filename">../../mk/tex.buildlink3.mk</code>.
14973: This takes care of rebuilding the <code xmlns=
14974: "http://www.w3.org/TR/xhtml1/transitional" class=
14975: "filename">ls-R</code> database at installation
14976: and deinstallation time.</p>
14977: </li>
14978:
14979: <li>
14980: <p>If your package installs files into a texmf
14981: tree other than the one at <code class=
14982: "varname">PKG_LOCALTEXMFPREFIX</code>, set
14983: <code class="varname">TEXMFDIRS</code> to the
14984: list of all texmf trees that need database
14985: update.</p>
1.64 kim 14986:
14987: <p>If your package also installs font map files
14988: that need to be registered using
14989: <span><strong class=
14990: "command">updmap</strong></span>, set
14991: <code class="varname">TEX_FONTMAPS</code> to the
14992: list of all such font map files. Then
14993: <span><strong class=
14994: "command">updmap</strong></span> will be run
14995: automatically at installation/deinstallation to
14996: enable/disable font map files for TeX output
14997: drivers.</p>
1.57 minskim 14998: </li>
14999:
15000: <li>
15001: <p>Make sure that none of <code xmlns=
15002: "http://www.w3.org/TR/xhtml1/transitional" class=
15003: "filename">ls-R</code> databases are included in
15004: <code xmlns=
15005: "http://www.w3.org/TR/xhtml1/transitional" class=
15006: "filename">PLIST</code>, as they will be removed
15007: only by the teTeX-bin package.</p>
15008: </li>
15009: </ol>
15010: </div>
15011: </div>
1.1 grant 15012: </div>
15013:
1.67 hubertf 15014: <div class="sect1" lang="en">
1.1 grant 15015: <div class="titlepage">
15016: <div>
15017: <div>
15018: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15019: "feedback-to-author"></a>16.6. Feedback to the
1.30 wiz 15020: author</h2>
1.1 grant 15021: </div>
15022: </div>
15023: </div>
15024:
15025: <p>If you have found any bugs in the package you make
15026: available, if you had to do special steps to make it run
15027: under NetBSD or if you enhanced the software in various
15028: other ways, be sure to report these changes back to the
15029: original author of the program! With that kind of
15030: support, the next release of the program can incorporate
15031: these fixes, and people not using the NetBSD packages
15032: system can win from your efforts.</p>
15033:
15034: <p>Support the idea of free software!</p>
15035: </div>
15036: </div>
15037:
1.67 hubertf 15038: <div class="chapter" lang="en">
1.1 grant 15039: <div class="titlepage">
15040: <div>
15041: <div>
1.67 hubertf 15042: <h2 class="title"><a name=
1.68 rillig 15043: "debug"></a>Chapter 17. Debugging</h2>
1.1 grant 15044: </div>
15045: </div>
15046: </div>
15047:
15048: <p>To check out all the gotchas when building a package,
15049: here are the steps that I do in order to get a package
15050: working. Please note this is basically the same as what was
15051: explained in the previous sections, only with some
15052: debugging aids.</p>
15053:
15054: <div class="itemizedlist">
15055: <ul type="disc">
15056: <li>
1.14 xtraeme 15057: <p>Be sure to set <code class=
1.45 wiz 15058: "varname">PKG_DEVELOPER=1</code> in <code xmlns=
15059: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15060: "filename">/etc/mk.conf</code></p>
1.1 grant 15061: </li>
15062:
15063: <li>
15064: <p>Install <a xmlns=
15065: "http://www.w3.org/TR/xhtml1/transitional" href=
15066: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 15067: target="_top"><code xmlns="" class=
15068: "filename">pkgtools/url2pkg</code></a>, create a
1.20 ben 15069: directory for a new package, change into it, then run
15070: <span><strong class=
15071: "command">url2pkg</strong></span>:</p>
1.1 grant 15072: <pre class="screen">
1.14 xtraeme 15073: <code class="prompt">%</code> <strong class=
15074: "userinput"><code>mkdir /usr/pkgsrc/<em class=
15075: "replaceable"><code>category</code></em>/<em class=
15076: "replaceable"><code>examplepkg</code></em></code></strong>
15077: <code class="prompt">%</code> <strong class=
15078: "userinput"><code>cd /usr/pkgsrc/<em class=
15079: "replaceable"><code>category</code></em>/<em class=
15080: "replaceable"><code>examplepkg</code></em></code></strong>
15081: <code class="prompt">%</code> <strong class=
15082: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 15083: </pre>
15084: </li>
15085:
15086: <li>
1.45 wiz 15087: <p>Edit the <code xmlns=
15088: "http://www.w3.org/TR/xhtml1/transitional" class=
15089: "filename">Makefile</code> as requested.</p>
1.1 grant 15090: </li>
15091:
15092: <li>
1.45 wiz 15093: <p>Fill in the <code xmlns=
15094: "http://www.w3.org/TR/xhtml1/transitional" class=
15095: "filename">DESCR</code> file</p>
1.1 grant 15096: </li>
15097:
15098: <li>
1.14 xtraeme 15099: <p>Run <span><strong class="command">make
15100: configure</strong></span></p>
1.1 grant 15101: </li>
15102:
15103: <li>
15104: <p>Add any dependencies glimpsed from documentation
1.45 wiz 15105: and the configure step to the package's <code xmlns=
15106: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15107: "filename">Makefile</code>.</p>
1.1 grant 15108: </li>
15109:
15110: <li>
15111: <p>Make the package compile, doing multiple rounds
15112: of</p>
15113: <pre class="screen">
1.14 xtraeme 15114: <code class="prompt">%</code> <strong class=
15115: "userinput"><code>make</code></strong>
15116: <code class="prompt">%</code> <strong class=
15117: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
15118: <code class="prompt">%</code> <strong class=
15119: "userinput"><code>mkpatches</code></strong>
15120: <code class="prompt">%</code> <strong class=
15121: "userinput"><code>patchdiff</code></strong>
15122: <code class="prompt">%</code> <strong class=
15123: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
15124: <code class="prompt">%</code> <strong class=
15125: "userinput"><code>make mps</code></strong>
15126: <code class="prompt">%</code> <strong class=
15127: "userinput"><code>make clean</code></strong>
1.1 grant 15128: </pre>
15129:
15130: <p>Doing as non-root user will ensure that no files
15131: are modified that shouldn't be, especially during the
1.14 xtraeme 15132: build phase. <span><strong class=
15133: "command">mkpatches</strong></span>,
15134: <span><strong class=
15135: "command">patchdiff</strong></span> and
15136: <span><strong class="command">pkgvi</strong></span>
15137: are from the <a xmlns=
1.1 grant 15138: "http://www.w3.org/TR/xhtml1/transitional" href=
15139: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 15140: target="_top"><code xmlns="" class=
15141: "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1 grant 15142: </li>
15143:
15144: <li>
1.45 wiz 15145: <p>Look at the <code xmlns=
15146: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15147: "filename">Makefile</code>, fix if necessary; see
15148: <a href="#components.Makefile" title=
1.38 dillo 15149: "8.1. Makefile">Section 8.1,
1.45 wiz 15150: “<code xmlns=
15151: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15152: "filename">Makefile</code>”</a>.</p>
1.1 grant 15153: </li>
15154:
15155: <li>
1.45 wiz 15156: <p>Generate a <code xmlns=
15157: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15158: "filename">PLIST</code>:</p>
1.1 grant 15159: <pre class="screen">
1.14 xtraeme 15160: <code class="prompt">#</code> <strong class=
15161: "userinput"><code>make install</code></strong>
15162: <code class="prompt">#</code> <strong class=
15163: "userinput"><code>make print-PLIST >PLIST</code></strong>
15164: <code class="prompt">#</code> <strong class=
15165: "userinput"><code>make deinstall</code></strong>
15166: <code class="prompt">#</code> <strong class=
15167: "userinput"><code>make install</code></strong>
15168: <code class="prompt">#</code> <strong class=
15169: "userinput"><code>make deinstall</code></strong>
1.1 grant 15170: </pre>
15171:
1.45 wiz 15172: <p>You usually need to be <code xmlns=
15173: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15174: "username">root</code> to do this. Look if there are
1.1 grant 15175: any files left:</p>
15176: <pre class="screen">
1.14 xtraeme 15177: <code class="prompt">#</code> <strong class=
15178: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 15179: </pre>
15180:
15181: <p>If this reveals any files that are missing in
1.45 wiz 15182: <code xmlns=
15183: "http://www.w3.org/TR/xhtml1/transitional" class=
15184: "filename">PLIST</code>, add them.</p>
1.1 grant 15185: </li>
15186:
15187: <li>
1.45 wiz 15188: <p>Now that the <code xmlns=
15189: "http://www.w3.org/TR/xhtml1/transitional" class=
15190: "filename">PLIST</code> is OK, install the package
15191: again and make a binary package:</p>
1.1 grant 15192: <pre class="screen">
1.14 xtraeme 15193: <code class="prompt">#</code> <strong class=
15194: "userinput"><code>make reinstall</code></strong>
15195: <code class="prompt">#</code> <strong class=
15196: "userinput"><code>make package</code></strong>
1.1 grant 15197: </pre>
15198: </li>
15199:
15200: <li>
15201: <p>Delete the installed package:</p>
15202: <pre class="screen">
1.14 xtraeme 15203: <code class="prompt">#</code> <strong class=
15204: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 15205: </pre>
15206: </li>
15207:
15208: <li>
1.14 xtraeme 15209: <p>Repeat the above <span><strong class=
15210: "command">make print-PLIST</strong></span> command,
15211: which shouldn't find anything now:</p>
1.1 grant 15212: <pre class="screen">
1.14 xtraeme 15213: <code class="prompt">#</code> <strong class=
15214: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 15215: </pre>
15216: </li>
15217:
15218: <li>
15219: <p>Reinstall the binary package:</p>
15220: <pre class="screen">
1.14 xtraeme 15221: <code class="prompt">#</code> <strong class=
15222: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 15223: </pre>
15224: </li>
15225:
15226: <li>
15227: <p>Play with it. Make sure everything works.</p>
15228: </li>
15229:
15230: <li>
1.14 xtraeme 15231: <p>Run <span><strong class=
15232: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 15233: "http://www.w3.org/TR/xhtml1/transitional" href=
15234: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 15235: target="_top"><code xmlns="" class=
15236: "filename">pkgtools/pkglint</code></a>, and fix the
1.20 ben 15237: problems it reports:</p>
1.1 grant 15238: <pre class="screen">
1.14 xtraeme 15239: <code class="prompt">#</code> <strong class=
15240: "userinput"><code>pkglint</code></strong>
1.1 grant 15241: </pre>
15242: </li>
15243:
15244: <li>
15245: <p>Submit (or commit, if you have cvs access); see
15246: <a href="#submit" title=
1.68 rillig 15247: "Chapter 18. Submitting and Committing">Chapter 18,
1.1 grant 15248: <i>Submitting and Committing</i></a>.</p>
15249: </li>
15250: </ul>
15251: </div>
15252: </div>
15253:
1.67 hubertf 15254: <div class="chapter" lang="en">
1.1 grant 15255: <div class="titlepage">
15256: <div>
15257: <div>
1.67 hubertf 15258: <h2 class="title"><a name=
1.68 rillig 15259: "submit"></a>Chapter 18. Submitting and
1.1 grant 15260: Committing</h2>
15261: </div>
15262: </div>
15263: </div>
15264:
15265: <div class="toc">
15266: <p><b>Table of Contents</b></p>
15267:
15268: <dl>
1.30 wiz 15269: <dt><span class="sect1"><a href=
1.74 ! rillig 15270: "#submitting-binary-packages">18.1. Submitting binary
1.30 wiz 15271: packages</a></span></dt>
1.1 grant 15272:
1.30 wiz 15273: <dt><span class="sect1"><a href=
1.74 ! rillig 15274: "#submitting-your-package">18.2. Submitting source
! 15275: packages (for non-NetBSD-developers)</a></span></dt>
! 15276:
! 15277: <dt><span class="sect1"><a href=
! 15278: "#general-notes-for-changes">18.3. General notes when
1.41 wiz 15279: adding, updating, or removing packages</a></span></dt>
15280:
15281: <dt><span class="sect1"><a href=
1.74 ! rillig 15282: "#committing-importing">18.4. Committing: Importing a
1.30 wiz 15283: package into CVS</a></span></dt>
1.1 grant 15284:
1.30 wiz 15285: <dt><span class="sect1"><a href=
1.74 ! rillig 15286: "#updating-package">18.5. Updating a package to a newer
1.30 wiz 15287: version</a></span></dt>
1.1 grant 15288:
1.74 ! rillig 15289: <dt><span class="sect1"><a href="#moving-package">18.6.
1.2 hubertf 15290: Moving a package in pkgsrc</a></span></dt>
1.1 grant 15291: </dl>
15292: </div>
15293:
1.67 hubertf 15294: <div class="sect1" lang="en">
1.1 grant 15295: <div class="titlepage">
15296: <div>
15297: <div>
15298: <h2 class="title" style="clear: both"><a name=
1.74 ! rillig 15299: "submitting-binary-packages"></a>18.1. Submitting
! 15300: binary packages</h2>
1.1 grant 15301: </div>
15302: </div>
15303: </div>
15304:
1.74 ! rillig 15305: <p>Our policy is that we accept binaries only from pkgsrc
! 15306: developers to guarantee that the packages don't contain
! 15307: any trojan horses etc. This is not to annoy anyone but
! 15308: rather to protect our users! You're still free to put up
! 15309: your home-made binary packages and tell the world where
! 15310: to get them. NetBSD developers doing bulk builds and
! 15311: wanting to upload them please see <a href="#bulk-upload"
! 15312: title=
! 15313: "6.3.8. Uploading results of a bulk build">Section 6.3.8,
! 15314: “Uploading results of a bulk build”</a>.</p>
! 15315: </div>
1.1 grant 15316:
1.74 ! rillig 15317: <div class="sect1" lang="en">
! 15318: <div class="titlepage">
! 15319: <div>
! 15320: <div>
! 15321: <h2 class="title" style="clear: both"><a name=
! 15322: "submitting-your-package"></a>18.2. Submitting
! 15323: source packages (for non-NetBSD-developers)</h2>
! 15324: </div>
! 15325: </div>
! 15326: </div>
1.1 grant 15327:
1.74 ! rillig 15328: <p>First, check that your package is complete, compiles
! 15329: and runs well; see <a href="#debug" title=
! 15330: "Chapter 17. Debugging">Chapter 17,
! 15331: <i>Debugging</i></a> and the rest of this document. Next,
! 15332: generate an uuencoded gzipped <a href=
! 15333: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
! 15334: <span class="citerefentry"><span class=
! 15335: "refentrytitle">tar</span>(1)</span></a> archive,
! 15336: preferably with all files in a single directory. Finally,
! 15337: <span><strong class="command">send-pr</strong></span>
! 15338: with category “<span class=
! 15339: "quote">pkg</span>”, a synopsis which includes the
! 15340: package name and version number, a short description of
! 15341: your package (contents of the COMMENT variable or DESCR
! 15342: file are OK) and attach the archive to your PR.</p>
! 15343:
! 15344: <p>If you want to submit several packages, please send a
! 15345: separate PR for each one, it's easier for us to track
! 15346: things that way.</p>
! 15347:
! 15348: <p>Alternatively, you can also import new packages into
! 15349: pkgsrc-wip (“<span class="quote">pkgsrc
! 15350: work-in-progress</span>”); see the homepage at
! 15351: <a href="http://pkgsrc-wip.sourceforge.net/" target=
! 15352: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
! 15353: details.</p>
1.1 grant 15354: </div>
15355:
1.67 hubertf 15356: <div class="sect1" lang="en">
1.1 grant 15357: <div class="titlepage">
15358: <div>
15359: <div>
15360: <h2 class="title" style="clear: both"><a name=
1.74 ! rillig 15361: "general-notes-for-changes"></a>18.3. General
1.41 wiz 15362: notes when adding, updating, or removing
15363: packages</h2>
15364: </div>
15365: </div>
15366: </div>
15367:
15368: <p>Please note all package additions, updates, moves, and
1.45 wiz 15369: removals in <code xmlns=
15370: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15371: "filename">pkgsrc/doc/CHANGES</code>. It's very important
15372: to keep this file up to date and conforming to the
15373: existing format, because it will be used by scripts to
15374: automatically update pages on <a href=
15375: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45 wiz 15376: and other sites. Additionally, check the <code xmlns=
15377: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15378: "filename">pkgsrc/doc/TODO</code> file and remove the
15379: entry for the package you updated or removed, in case it
15380: was mentioned there.</p>
15381:
1.71 wiz 15382: <p>When the <code class="varname">PKGREVISION</code> of a
15383: package is bumped, the change should appear in
15384: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
15385: class="filename">pkgsrc/doc/CHANGES</code> if it is
15386: security related or otherwise relevant. Mass bumps that
15387: result from a dependency being updated should not be
15388: mentioned. In all other cases it's the developer's
15389: decision.</p>
15390:
1.41 wiz 15391: <p>There is a make target that helps in creating proper
1.45 wiz 15392: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
15393: class="filename">CHANGES</code> entries:
1.41 wiz 15394: <span><strong class="command">make
15395: changes-entry</strong></span>. It uses the optional
15396: <code class="varname">CTYPE</code> and <code class=
15397: "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45 wiz 15398: usage is to first make sure that your <code xmlns=
15399: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15400: "filename">CHANGES</code> file is up-to-date (to avoid
15401: having to resolve conflicts later-on) and then to
15402: <span><strong class="command">cd</strong></span> to the
15403: package directory. For package updates,
15404: <span><strong class="command">make
15405: changes-entry</strong></span> is enough. For new
15406: packages, or package moves or removals, set the
15407: <code class="varname">CTYPE</code> variable on the
15408: command line to "Added", "Moved", or "Removed". You can
15409: set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45 wiz 15410: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
15411: class="filename">/etc/mk.conf</code> if your local login
15412: name is not the same as your NetBSD login name. Don't
15413: forget to commit the changes to <code xmlns=
15414: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15415: "filename">pkgsrc/doc/CHANGES</code>!</p>
15416: </div>
15417:
1.67 hubertf 15418: <div class="sect1" lang="en">
1.41 wiz 15419: <div class="titlepage">
15420: <div>
15421: <div>
15422: <h2 class="title" style="clear: both"><a name=
1.74 ! rillig 15423: "committing-importing"></a>18.4. Committing:
1.30 wiz 15424: Importing a package into CVS</h2>
1.1 grant 15425: </div>
15426: </div>
15427: </div>
15428:
15429: <p>This section is only of interest for pkgsrc developers
15430: with write access to the pkgsrc repository. Please
15431: remember that cvs imports files relative to the current
15432: working directory, and that the pathname that you give
1.14 xtraeme 15433: the <span><strong class="command">cvs
15434: import</strong></span> command is so that it knows where
15435: to place the files in the repository. Newly created
15436: packages should be imported with a vendor tag of
15437: “<span class="quote">TNF</span>” and a
15438: release tag of “<span class=
15439: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 15440: <pre class="programlisting">
1.51 rillig 15441: <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
15442: <code class=
15443: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1 grant 15444: </pre>
15445:
15446: <p>Remember to move the directory from which you imported
15447: out of the way, or cvs will complain the next time you
15448: “<span class="quote">cvs update</span>” your
15449: source tree. Also don't forget to add the new package to
1.45 wiz 15450: the category's <code xmlns=
15451: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15452: "filename">Makefile</code>.</p>
1.1 grant 15453:
15454: <p>The commit message of the initial import should
1.45 wiz 15455: include part of the <code xmlns=
15456: "http://www.w3.org/TR/xhtml1/transitional" class=
15457: "filename">DESCR</code> file, so people reading the
15458: mailing lists know what the package is/does.</p>
1.1 grant 15459:
15460: <p>For new packages, “<span class="quote">cvs
15461: import</span>” is preferred to “<span class=
15462: "quote">cvs add</span>” because the former gets
15463: everything with a single command, and provides a
15464: consistent tag.</p>
15465: </div>
15466:
1.67 hubertf 15467: <div class="sect1" lang="en">
1.1 grant 15468: <div class="titlepage">
15469: <div>
15470: <div>
15471: <h2 class="title" style="clear: both"><a name=
1.74 ! rillig 15472: "updating-package"></a>18.5. Updating a
1.30 wiz 15473: package to a newer version</h2>
1.1 grant 15474: </div>
15475: </div>
15476: </div>
15477:
15478: <p>Please always put a concise, appropriate and relevant
15479: summary of the changes between old and new versions into
15480: the commit log when updating a package. There are various
15481: reasons for this:</p>
15482:
15483: <div class="itemizedlist">
15484: <ul type="disc">
15485: <li>
15486: <p>A URL is volatile, and can change over time. It
15487: may go away completely or its information may be
15488: overwritten by newer information.</p>
15489: </li>
15490:
15491: <li>
15492: <p>Having the change information between old and
15493: new versions in our CVS repository is very useful
15494: for people who use either cvs or anoncvs.</p>
15495: </li>
15496:
15497: <li>
15498: <p>Having the change information between old and
15499: new versions in our CVS repository is very useful
15500: for people who read the pkgsrc-changes mailing
15501: list, so that they can make tactical decisions
15502: about when to upgrade the package.</p>
15503: </li>
15504: </ul>
15505: </div>
15506:
1.18 xtraeme 15507: <p>Please also recognize that, just because a new version
1.1 grant 15508: of a package has been released, it should not
15509: automatically be upgraded in the CVS repository. We
15510: prefer to be conservative in the packages that are
15511: included in pkgsrc - development or beta packages are not
15512: really the best thing for most places in which pkgsrc is
15513: used. Please use your judgement about what should go into
15514: pkgsrc, and bear in mind that stability is to be
15515: preferred above new and possibly untested features.</p>
15516: </div>
15517:
1.67 hubertf 15518: <div class="sect1" lang="en">
1.1 grant 15519: <div class="titlepage">
15520: <div>
15521: <div>
15522: <h2 class="title" style="clear: both"><a name=
1.74 ! rillig 15523: "moving-package"></a>18.6. Moving a package in
1.30 wiz 15524: pkgsrc</h2>
1.1 grant 15525: </div>
15526: </div>
15527: </div>
15528:
15529: <div class="orderedlist">
15530: <ol type="1">
15531: <li>
15532: <p>Make a copy of the directory somewhere else.</p>
15533: </li>
15534:
15535: <li>
15536: <p>Remove all CVS dirs.</p>
15537:
15538: <p>Alternatively to the first two steps you can
15539: also do:</p>
15540: <pre class="screen">
1.14 xtraeme 15541: <code class="prompt">%</code> <strong class=
15542: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 15543: </pre>
15544:
15545: <p>and use that for further work.</p>
15546: </li>
15547:
15548: <li>
1.14 xtraeme 15549: <p>Fix <code class="varname">CATEGORIES</code> and
15550: any <code class="varname">DEPENDS</code> paths that
15551: just did “<span class=
1.1 grant 15552: "quote">../package</span>” instead of
15553: “<span class=
15554: "quote">../../category/package</span>”.</p>
15555: </li>
15556:
15557: <li>
1.14 xtraeme 15558: <p><span><strong class="command">cvs
15559: import</strong></span> the modified package in the
15560: new place.</p>
1.1 grant 15561: </li>
15562:
15563: <li>
15564: <p>Check if any package depends on it:</p>
15565: <pre class="screen">
1.14 xtraeme 15566: <code class="prompt">%</code> <strong class=
15567: "userinput"><code>cd /usr/pkgsrc</code></strong>
15568: <code class="prompt">%</code> <strong class=
15569: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 15570: </pre>
15571: </li>
15572:
15573: <li>
15574: <p>Fix paths in packages from step 5 to point to
15575: new location.</p>
15576: </li>
15577:
15578: <li>
1.14 xtraeme 15579: <p><span><strong class="command">cvs rm
15580: (-f)</strong></span> the package at the old
15581: location.</p>
1.1 grant 15582: </li>
15583:
15584: <li>
1.45 wiz 15585: <p>Remove from <code xmlns=
15586: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15587: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 15588: </li>
15589:
15590: <li>
1.45 wiz 15591: <p>Add to <code xmlns=
15592: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15593: "filename">newcategory/Makefile</code>.</p>
1.1 grant 15594: </li>
15595:
15596: <li>
15597: <p>Commit the changed and removed files:</p>
15598: <pre class="screen">
1.14 xtraeme 15599: <code class="prompt">%</code> <strong class=
15600: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 15601: </pre>
15602:
15603: <p>(and any packages from step 5, of course).</p>
15604: </li>
15605: </ol>
15606: </div>
15607: </div>
15608: </div>
1.69 rillig 15609:
15610: <div class="chapter" lang="en">
15611: <div class="titlepage">
15612: <div>
15613: <div>
15614: <h2 class="title"><a name=
1.72 rillig 15615: "devfaq"></a>Chapter 19. Frequently Asked
15616: Questions</h2>
15617: </div>
15618: </div>
15619: </div>
15620:
15621: <p>This section contains the answers to questions that may
15622: arise when you are writing a package. If you don't find
15623: your question answered here, first have a look in the other
15624: chapters, and if you still don't have the answer, ask on
15625: the <code class="literal">pkgsrc-users</code> mailing
15626: list.</p>
15627:
15628: <div class="qandaset">
15629: <dl>
1.74 ! rillig 15630: <dt>19.1. <a href="#id2654583">What is the difference
1.72 rillig 15631: between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?</a></dt>
15632:
1.74 ! rillig 15633: <dt>19.2. <a href="#id2654619">What is the difference
1.72 rillig 15634: between MAKE, GMAKE and MAKE_PROGRAM?</a></dt>
15635:
1.74 ! rillig 15636: <dt>19.3. <a href="#id2654658">What is the difference
1.72 rillig 15637: between CC, PKG_CC and PKGSRC_COMPILER?</a></dt>
15638:
1.74 ! rillig 15639: <dt>19.4. <a href="#id2654763">What is the difference
1.72 rillig 15640: between BUILDLINK_LDFLAGS, BUILDLINK_LDADD and
15641: BUILDLINK_LIBS?</a></dt>
15642:
1.74 ! rillig 15643: <dt>19.5. <a href="#id2654781">Why does make show-var
1.72 rillig 15644: VARNAME=BUILDLINK_PREFIX.foo say it's empty?</a></dt>
15645: </dl>
15646:
15647: <table border="0" summary="Q and A Set">
15648: <col align="left" width="1%" />
15649:
15650: <tbody>
15651: <tr class="question">
15652: <td align="left" valign="top"><a name=
1.74 ! rillig 15653: "id2654583"></a><a name=
! 15654: "id2654584"></a><b>19.1.</b></td>
1.72 rillig 15655:
15656: <td align="left" valign="top">
15657: <p>What is the difference between <code class=
15658: "varname">MAKEFLAGS</code>, <code class=
15659: "varname">.MAKEFLAGS</code> and <code class=
15660: "varname">MAKE_FLAGS</code>?</p>
15661: </td>
15662: </tr>
15663:
15664: <tr class="answer">
15665: <td align="left" valign="top"></td>
15666:
15667: <td align="left" valign="top">
15668: <p><code class="varname">MAKEFLAGS</code> are the
15669: flags passed to the pkgsrc-internal invocations
15670: of <a href=
15671: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
15672: <span class="citerefentry"><span class=
15673: "refentrytitle">make</span>(1)</span></a>, while
15674: <code class="varname">MAKE_FLAGS</code> are the
15675: flags that are passed to the <code class=
15676: "varname">MAKE_PROGRAM</code> when building the
15677: package. [FIXME: What is .MAKEFLAGS for?]</p>
15678: </td>
15679: </tr>
15680:
15681: <tr class="question">
15682: <td align="left" valign="top"><a name=
1.74 ! rillig 15683: "id2654619"></a><a name=
! 15684: "id2654620"></a><b>19.2.</b></td>
1.72 rillig 15685:
15686: <td align="left" valign="top">
15687: <p>What is the difference between <code class=
15688: "varname">MAKE</code>, <code class=
15689: "varname">GMAKE</code> and <code class=
15690: "varname">MAKE_PROGRAM</code>?</p>
15691: </td>
15692: </tr>
15693:
15694: <tr class="answer">
15695: <td align="left" valign="top"></td>
15696:
15697: <td align="left" valign="top">
15698: <p><code class="varname">MAKE</code> is the path
15699: to the <a href=
15700: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
15701: <span class="citerefentry"><span class=
15702: "refentrytitle">make</span>(1)</span></a> program
15703: that is used in the pkgsrc infrastructure.
15704: <code class="varname">GMAKE</code> is the path to
15705: GNU Make, but you need to say <code class=
15706: "varname">USE_TOOLS+=gmake</code> to use that.
15707: <code class="varname">MAKE_PROGRAM</code> is the
15708: path to the Make program that is used for
15709: building the package.</p>
15710: </td>
15711: </tr>
15712:
15713: <tr class="question">
15714: <td align="left" valign="top"><a name=
1.74 ! rillig 15715: "id2654658"></a><a name=
! 15716: "id2654659"></a><b>19.3.</b></td>
1.72 rillig 15717:
15718: <td align="left" valign="top">
15719: <p>What is the difference between <code class=
15720: "varname">CC</code>, <code class=
15721: "varname">PKG_CC</code> and <code class=
15722: "varname">PKGSRC_COMPILER</code>?</p>
15723: </td>
15724: </tr>
15725:
15726: <tr class="answer">
15727: <td align="left" valign="top"></td>
15728:
15729: <td align="left" valign="top">
15730: <p><code class="varname">CC</code> is the path to
15731: the real C compiler, which can be configured by
15732: the pkgsrc user. <code class=
15733: "varname">PKG_CC</code> is the path to the
15734: compiler wrapper. <code class=
15735: "varname">PKGSRC_COMPILER</code> is <span class=
15736: "emphasis"><em>not</em></span> a path to a
15737: compiler, but the type of compiler that should be
15738: used. See <code xmlns=
15739: "http://www.w3.org/TR/xhtml1/transitional" class=
15740: "filename">mk/compiler.mk</code> for more
15741: information about the latter variable.</p>
15742: </td>
15743: </tr>
15744:
15745: <tr class="question">
15746: <td align="left" valign="top"><a name=
1.74 ! rillig 15747: "id2654763"></a><a name=
! 15748: "id2654764"></a><b>19.4.</b></td>
1.72 rillig 15749:
15750: <td align="left" valign="top">
15751: <p>What is the difference between <code class=
15752: "varname">BUILDLINK_LDFLAGS</code>, <code class=
15753: "varname">BUILDLINK_LDADD</code> and <code class=
15754: "varname">BUILDLINK_LIBS</code>?</p>
15755: </td>
15756: </tr>
15757:
15758: <tr class="answer">
15759: <td align="left" valign="top"></td>
15760:
15761: <td align="left" valign="top">
15762: <p>[FIXME]</p>
15763: </td>
15764: </tr>
15765:
15766: <tr class="question">
15767: <td align="left" valign="top"><a name=
1.74 ! rillig 15768: "id2654781"></a><a name=
! 15769: "id2654782"></a><b>19.5.</b></td>
1.72 rillig 15770:
15771: <td align="left" valign="top">
15772: <p>Why does <span><strong class="command">make
15773: show-var VARNAME=BUILDLINK_PREFIX.<em class=
15774: "replaceable"><code>foo</code></em></strong></span>
15775: say it's empty?</p>
15776: </td>
15777: </tr>
15778:
15779: <tr class="answer">
15780: <td align="left" valign="top"></td>
15781:
15782: <td align="left" valign="top">
15783: <p>For optimization reasons, some variables are
15784: only available in the “<span class=
15785: "quote">wrapper</span>” phase and later. To
15786: “<span class="quote">simulate</span>”
15787: the wrapper phase, append <span><strong class=
15788: "command">PKG_PHASE=wrapper</strong></span> to
15789: the above command.</p>
15790: </td>
15791: </tr>
15792: </tbody>
15793: </table>
15794: </div>
15795: </div>
15796: </div>
15797:
15798: <div class="part" lang="en">
15799: <div class="titlepage">
15800: <div>
15801: <div>
15802: <h1 class="title"><a name=
15803: "infrastructure"></a>Part III. The pkgsrc
1.73 rillig 15804: infrastructure internals</h1>
1.72 rillig 15805: </div>
15806: </div>
15807: </div>
15808:
1.73 rillig 15809: <div class="partintro" lang="en">
15810: <p>This part of the guide deals with everything from the
15811: infrastructure that is behind the interfaces described in
15812: the developer's guide. A casual package maintainer should
15813: not need anything from this part.</p>
15814:
15815: <div class="toc">
15816: <p><b>Table of Contents</b></p>
15817:
15818: <dl>
15819: <dt><span class="chapter"><a href="#infr.design">20.
15820: Design of the pkgsrc infrastructure</a></span></dt>
15821:
15822: <dd>
15823: <dl>
15824: <dt><span class="sect1"><a href="#infr.var">20.1.
15825: Variable evaluation</a></span></dt>
15826:
15827: <dd>
15828: <dl>
15829: <dt><span class="sect2"><a href=
15830: "#infr.var.load">20.1.1. At load
15831: time</a></span></dt>
15832:
15833: <dt><span class="sect2"><a href=
15834: "#infr.var.run">20.1.2. At
15835: runtime</a></span></dt>
15836: </dl>
15837: </dd>
15838:
15839: <dt><span class="sect1"><a href=
15840: "#infr.design.intf">20.2. Designing interfaces for
15841: Makefile fragments</a></span></dt>
15842:
15843: <dd>
15844: <dl>
15845: <dt><span class="sect2"><a href=
15846: "#infr.design.intf.proc">20.2.1. Procedures
15847: with parameters</a></span></dt>
15848:
15849: <dt><span class="sect2"><a href=
15850: "#infr.design.intf.action">20.2.2. Actions
15851: taken on behalf of parameters</a></span></dt>
15852: </dl>
15853: </dd>
15854: </dl>
15855: </dd>
15856:
15857: <dt><span class="chapter"><a href="#regression">21.
15858: Regression tests</a></span></dt>
15859:
15860: <dd>
15861: <dl>
15862: <dt><span class="sect1"><a href=
15863: "#regression.descr">21.1. The regression tests
15864: framework</a></span></dt>
15865:
15866: <dt><span class="sect1"><a href=
15867: "#regression.run">21.2. Running the regression
15868: tests</a></span></dt>
15869:
15870: <dt><span class="sect1"><a href=
15871: "#regression.new">21.3. Adding a new regression
15872: test</a></span></dt>
15873:
15874: <dd>
15875: <dl>
15876: <dt><span class="sect2"><a href=
15877: "#regression.fun.override">21.3.1. Overridable
15878: functions</a></span></dt>
15879:
15880: <dt><span class="sect2"><a href=
15881: "#regression.fun.helper">21.3.2. Helper
15882: functions</a></span></dt>
15883: </dl>
15884: </dd>
15885: </dl>
15886: </dd>
15887:
15888: <dt><span class="chapter"><a href="#porting">22.
15889: Porting pkgsrc</a></span></dt>
15890:
15891: <dd>
15892: <dl>
15893: <dt><span class="sect1"><a href=
15894: "#porting.opsys">22.1. Porting pkgsrc to a new
15895: operating system</a></span></dt>
15896:
15897: <dt><span class="sect1"><a href=
15898: "#porting.compiler">22.2. Adding support for a new
15899: compiler</a></span></dt>
15900: </dl>
15901: </dd>
15902: </dl>
15903: </div>
15904: </div>
15905:
15906: <div class="chapter" lang="en">
15907: <div class="titlepage">
15908: <div>
15909: <div>
15910: <h2 class="title"><a name=
15911: "infr.design"></a>Chapter 20. Design of the
15912: pkgsrc infrastructure</h2>
15913: </div>
15914: </div>
15915: </div>
15916:
15917: <div class="toc">
15918: <p><b>Table of Contents</b></p>
15919:
15920: <dl>
15921: <dt><span class="sect1"><a href="#infr.var">20.1.
15922: Variable evaluation</a></span></dt>
15923:
15924: <dd>
15925: <dl>
15926: <dt><span class="sect2"><a href=
15927: "#infr.var.load">20.1.1. At load
15928: time</a></span></dt>
15929:
15930: <dt><span class="sect2"><a href=
15931: "#infr.var.run">20.1.2. At runtime</a></span></dt>
15932: </dl>
15933: </dd>
15934:
15935: <dt><span class="sect1"><a href=
15936: "#infr.design.intf">20.2. Designing interfaces for
15937: Makefile fragments</a></span></dt>
15938:
15939: <dd>
15940: <dl>
15941: <dt><span class="sect2"><a href=
15942: "#infr.design.intf.proc">20.2.1. Procedures with
15943: parameters</a></span></dt>
15944:
15945: <dt><span class="sect2"><a href=
15946: "#infr.design.intf.action">20.2.2. Actions taken on
15947: behalf of parameters</a></span></dt>
15948: </dl>
15949: </dd>
15950: </dl>
15951: </div>
15952:
15953: <p>The pkgsrc infrastructure consists of many small
15954: Makefile fragments. Each such fragment needs a properly
15955: specified interface. This chapter explains how such an
15956: interface looks like.</p>
15957:
15958: <div class="sect1" lang="en">
15959: <div class="titlepage">
15960: <div>
15961: <div>
15962: <h2 class="title" style="clear: both"><a name=
15963: "infr.var"></a>20.1. Variable evaluation</h2>
15964: </div>
15965: </div>
15966: </div>
15967:
15968: <div class="sect2" lang="en">
15969: <div class="titlepage">
15970: <div>
15971: <div>
15972: <h3 class="title"><a name=
15973: "infr.var.load"></a>20.1.1. At load
15974: time</h3>
15975: </div>
15976: </div>
15977: </div>
15978:
15979: <p>Variable evaluation takes place either at load time
15980: or at runtime, depending on the context in which they
15981: occur. The contexts where variables are evaluated at
15982: load time are:</p>
15983:
15984: <div class="itemizedlist">
15985: <ul type="disc">
15986: <li>
15987: <p>The right hand side of the <code class=
15988: "literal">:=</code> and <code class=
15989: "literal">!=</code> operators,</p>
15990: </li>
15991:
15992: <li>
15993: <p>Make directives like <code class=
15994: "literal">.if</code> or <code class=
15995: "literal">.for</code>,</p>
15996: </li>
15997:
15998: <li>
15999: <p>Dependency lines.</p>
16000: </li>
16001: </ul>
16002: </div>
16003:
16004: <p>A special exception are references to the iteration
16005: variables of <code class="literal">.for</code> loops,
16006: which are expanded inline, no matter in which context
16007: they appear.</p>
16008:
16009: <p>As the values of variables may change during load
16010: time, care must be taken not to evaluate them by
16011: accident. Typical examples for variables that should
16012: not be evaluated at load time are <code class=
16013: "varname">DEPENDS</code> and <code class=
16014: "varname">CONFIGURE_ARGS</code>. To make the effect
16015: more clear, here is an example:</p>
16016: <pre class="programlisting">
16017: CONFIGURE_ARGS= # none
16018: CFLAGS= -O
16019: CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
16020:
16021: CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
16022:
16023: CFLAGS+= -Wall
16024:
16025: </pre>
16026:
16027: <p>This code shows how the use of the <code class=
16028: "literal">:=</code> operator can quickly lead to
16029: unexpected results. The first paragraph is fairly
16030: common code. The second paragraph evaluates the
16031: <code class="varname">CONFIGURE_ARGS</code> variable,
16032: which results in <code class=
16033: "literal">CFLAGS=-O</code>. In the third paragraph, the
16034: <code class="literal">-Wall</code> is appended to the
16035: <code class="varname">CFLAGS</code>, but this addition
16036: will not appear in <code class=
16037: "varname">CONFIGURE_ARGS</code>. In actual code, the
16038: three paragraphs from above typically occur in
16039: completely unrelated files.</p>
16040: </div>
1.72 rillig 16041:
1.73 rillig 16042: <div class="sect2" lang="en">
16043: <div class="titlepage">
16044: <div>
16045: <div>
16046: <h3 class="title"><a name=
16047: "infr.var.run"></a>20.1.2. At runtime</h3>
16048: </div>
16049: </div>
16050: </div>
1.72 rillig 16051:
1.73 rillig 16052: <p>After all the files have been loaded, the values of
16053: the variables cannot be changed anymore. Variables that
16054: are used in the shell commands are expanded at this
16055: point.</p>
16056: </div>
16057: </div>
1.72 rillig 16058:
1.73 rillig 16059: <div class="sect1" lang="en">
16060: <div class="titlepage">
16061: <div>
16062: <div>
16063: <h2 class="title" style="clear: both"><a name=
16064: "infr.design.intf"></a>20.2. Designing
16065: interfaces for Makefile fragments</h2>
16066: </div>
16067: </div>
16068: </div>
1.72 rillig 16069:
1.73 rillig 16070: <p>Most of the <code xmlns=
16071: "http://www.w3.org/TR/xhtml1/transitional" class=
16072: "filename">.mk</code> files fall into one of the
16073: following classes. Cases where a file falls into more
16074: than one class should be avoided as it often leads to
16075: subtle bugs.</p>
1.72 rillig 16076:
1.73 rillig 16077: <div class="sect2" lang="en">
16078: <div class="titlepage">
16079: <div>
16080: <div>
16081: <h3 class="title"><a name=
16082: "infr.design.intf.proc"></a>20.2.1. Procedures
16083: with parameters</h3>
16084: </div>
16085: </div>
16086: </div>
1.72 rillig 16087:
1.73 rillig 16088: <p>In a traditional imperative programming language
16089: some of the <code xmlns=
16090: "http://www.w3.org/TR/xhtml1/transitional" class=
16091: "filename">.mk</code> files could be described as
16092: procedures. They take some input parameters
16093: and—after inclusion—provide a result in
16094: output parameters. Since all variables in <code xmlns=
16095: "http://www.w3.org/TR/xhtml1/transitional" class=
16096: "filename">Makefile</code>s have global scope care must
16097: be taken not to use parameter names that have already
16098: another meaning. For example, <code class=
16099: "varname">PKGNAME</code> is a bad choice for a
16100: parameter name.</p>
16101:
16102: <p>Procedures are completely evaluated at preprocessing
16103: time. That is, when calling a procedure all input
16104: parameters must be completely resolvable. For example,
16105: <code class="varname">CONFIGURE_ARGS</code> should
16106: never be an input parameter since it is very likely
16107: that further text will be added after calling the
16108: procedure, which would effectively apply the procedure
16109: to only a part of the variable. Also, references to
16110: other variables wit will be modified after calling the
16111: procedure.</p>
16112:
16113: <p>A procedure can declare its output parameters either
16114: as suitable for use in preprocessing directives or as
16115: only available at runtime. The latter alternative is
16116: for variables that contain references to other runtime
16117: variables.</p>
16118:
16119: <p>Procedures shall be written such that it is possible
16120: to call the procedure more than once. That is, the file
16121: must not contain multiple-inclusion guards.</p>
16122:
16123: <p>Examples for procedures are <code xmlns=
16124: "http://www.w3.org/TR/xhtml1/transitional" class=
16125: "filename">mk/bsd.options.mk</code> and <code xmlns=
16126: "http://www.w3.org/TR/xhtml1/transitional" class=
16127: "filename">mk/buildlink3/bsd.builtin.mk</code>. To
16128: express that the parameters are evaluated at load time,
16129: they should be assigned using the <code class=
16130: "literal">:=</code> operator, which should be used only
16131: for this purpose.</p>
16132: </div>
1.72 rillig 16133:
1.73 rillig 16134: <div class="sect2" lang="en">
16135: <div class="titlepage">
16136: <div>
16137: <div>
16138: <h3 class="title"><a name=
16139: "infr.design.intf.action"></a>20.2.2. Actions
16140: taken on behalf of parameters</h3>
16141: </div>
16142: </div>
16143: </div>
1.72 rillig 16144:
1.73 rillig 16145: <p>Action files take some input parameters and may
16146: define runtime variables. They shall not define
16147: loadtime variables. There are action files that are
16148: included implicitly by the pkgsrc infrastructure, while
16149: other must be included explicitly.</p>
1.72 rillig 16150:
1.73 rillig 16151: <p>An example for action files is <code xmlns=
16152: "http://www.w3.org/TR/xhtml1/transitional" class=
16153: "filename">mk/subst.mk</code>.</p>
16154: </div>
16155: </div>
1.72 rillig 16156: </div>
16157:
16158: <div class="chapter" lang="en">
16159: <div class="titlepage">
16160: <div>
16161: <div>
16162: <h2 class="title"><a name=
1.73 rillig 16163: "regression"></a>Chapter 21. Regression
1.72 rillig 16164: tests</h2>
16165: </div>
16166: </div>
16167: </div>
16168:
16169: <div class="toc">
16170: <p><b>Table of Contents</b></p>
16171:
16172: <dl>
16173: <dt><span class="sect1"><a href=
1.73 rillig 16174: "#regression.descr">21.1. The regression tests
1.72 rillig 16175: framework</a></span></dt>
16176:
1.73 rillig 16177: <dt><span class="sect1"><a href="#regression.run">21.2.
1.72 rillig 16178: Running the regression tests</a></span></dt>
16179:
1.73 rillig 16180: <dt><span class="sect1"><a href="#regression.new">21.3.
1.72 rillig 16181: Adding a new regression test</a></span></dt>
16182:
16183: <dd>
16184: <dl>
16185: <dt><span class="sect2"><a href=
1.73 rillig 16186: "#regression.fun.override">21.3.1. Overridable
1.72 rillig 16187: functions</a></span></dt>
16188:
16189: <dt><span class="sect2"><a href=
1.73 rillig 16190: "#regression.fun.helper">21.3.2. Helper
1.72 rillig 16191: functions</a></span></dt>
16192: </dl>
16193: </dd>
16194: </dl>
16195: </div>
16196:
16197: <p>The pkgsrc infrastructure consists of a large codebase,
16198: and there are many corners where every little bit of a file
16199: is well thought out, making pkgsrc likely to fail as soon
16200: as anything is changed near those parts. To prevent most
16201: changes from breaking anything, a suite of regression tests
16202: should go along with every important part of the pkgsrc
16203: infrastructure. This chapter describes how regression tests
16204: work in pkgsrc and how you can add new tests.</p>
16205:
16206: <div class="sect1" lang="en">
16207: <div class="titlepage">
16208: <div>
16209: <div>
16210: <h2 class="title" style="clear: both"><a name=
1.73 rillig 16211: "regression.descr"></a>21.1. The regression
1.72 rillig 16212: tests framework</h2>
16213: </div>
16214: </div>
16215: </div>
16216: </div>
16217:
16218: <div class="sect1" lang="en">
16219: <div class="titlepage">
16220: <div>
16221: <div>
16222: <h2 class="title" style="clear: both"><a name=
1.73 rillig 16223: "regression.run"></a>21.2. Running the
1.72 rillig 16224: regression tests</h2>
16225: </div>
16226: </div>
16227: </div>
16228:
16229: <p>You first need to install the <a xmlns=
16230: "http://www.w3.org/TR/xhtml1/transitional" href=
16231: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_regress/README.html"
16232: target="_top"><code xmlns="" class=
16233: "filename">pkgtools/pkg_regress</code></a> package, which
16234: provides the <span><strong class=
16235: "command">pkg_regress</strong></span> command. Then you
16236: can simply run that command, which will run all tests in
16237: the <code xmlns=
16238: "http://www.w3.org/TR/xhtml1/transitional" class=
16239: "filename">regress</code> category.</p>
16240: </div>
16241:
16242: <div class="sect1" lang="en">
16243: <div class="titlepage">
16244: <div>
16245: <div>
16246: <h2 class="title" style="clear: both"><a name=
1.73 rillig 16247: "regression.new"></a>21.3. Adding a new
1.72 rillig 16248: regression test</h2>
16249: </div>
16250: </div>
16251: </div>
16252:
16253: <p>Every directory in the <code xmlns=
16254: "http://www.w3.org/TR/xhtml1/transitional" class=
16255: "filename">regress</code> category that contains a file
16256: called <code xmlns=
16257: "http://www.w3.org/TR/xhtml1/transitional" class=
16258: "filename">spec</code> is considered a regression test.
16259: This file is a shell program that is included by the
16260: <span><strong class="command">pkg_regress</strong></span>
16261: command. The following functions can be overridden to
16262: suit your needs.</p>
16263:
16264: <div class="sect2" lang="en">
16265: <div class="titlepage">
16266: <div>
16267: <div>
16268: <h3 class="title"><a name=
1.73 rillig 16269: "regression.fun.override"></a>21.3.1. Overridable
1.72 rillig 16270: functions</h3>
16271: </div>
16272: </div>
16273: </div>
16274:
16275: <p>These functions do not take any parameters. They are
16276: all called in “<span class="quote">set
16277: -e</span>” mode, so you should be careful to
16278: check the exitcodes of any commands you run in the
16279: test.</p>
16280:
16281: <div class="variablelist">
16282: <dl>
16283: <dt><span class="term"><code class=
16284: "varname">do_setup()</code></span></dt>
16285:
16286: <dd>
16287: <p>This function prepares the environment for the
16288: test. By default it does nothing.</p>
16289: </dd>
16290:
16291: <dt><span class="term"><code class=
16292: "varname">do_test()</code></span></dt>
16293:
16294: <dd>
16295: <p>This function runs the actual test. By
16296: default, it calls <code class=
16297: "varname">TEST_MAKE</code> with the arguments
16298: <code class="varname">MAKEARGS_TEST</code> and
16299: writes its output including error messages into
16300: the file <code class=
16301: "varname">TEST_OUTFILE</code>.</p>
16302: </dd>
16303:
16304: <dt><span class="term"><code class=
16305: "varname">check_result()</code></span></dt>
16306:
16307: <dd>
16308: <p>This function is run after the test and is
16309: typically used to compare the actual output from
16310: the one that is expected. It can make use of the
16311: various helper functions from the next
16312: section.</p>
16313: </dd>
16314:
16315: <dt><span class="term"><code class=
16316: "varname">do_cleanup()</code></span></dt>
16317:
16318: <dd>
16319: <p>This function cleans everything up after the
16320: test has been run. By default it does
16321: nothing.</p>
16322: </dd>
16323: </dl>
16324: </div>
16325: </div>
16326:
16327: <div class="sect2" lang="en">
16328: <div class="titlepage">
16329: <div>
16330: <div>
16331: <h3 class="title"><a name=
1.73 rillig 16332: "regression.fun.helper"></a>21.3.2. Helper
1.72 rillig 16333: functions</h3>
16334: </div>
16335: </div>
16336: </div>
16337:
16338: <div class="variablelist">
16339: <dl>
16340: <dt><span class="term"><code class=
16341: "varname">exit_status(expected)</code></span></dt>
16342:
16343: <dd>
16344: <p>This function compares the exitcode of the
16345: <span><strong class=
16346: "command">do_test()</strong></span> function with
16347: its first parameter. If they differ, the test
16348: will fail.</p>
16349: </dd>
16350:
16351: <dt><span class="term"><code class=
16352: "varname">output_require(regex...)</code></span></dt>
16353:
16354: <dd>
16355: <p>This function checks for each of its
16356: parameters if the output from
16357: <span><strong class="command">do_test()</strong></span>
16358: matches the extended regular expression. If it
16359: does not, the test will fail.</p>
16360: </dd>
16361:
16362: <dt><span class="term"><code class=
16363: "varname">output_prohibit(regex...)</code></span></dt>
16364:
16365: <dd>
16366: <p>This function checks for each of its
16367: parameters if the output from
16368: <span><strong class="command">do_test()</strong></span>
16369: does <span class="emphasis"><em>not</em></span>
16370: match the extended regular expression. If any of
16371: the regular expressions matches, the test will
16372: fail.</p>
16373: </dd>
16374: </dl>
16375: </div>
16376: </div>
16377: </div>
16378: </div>
16379:
16380: <div class="chapter" lang="en">
16381: <div class="titlepage">
16382: <div>
16383: <div>
16384: <h2 class="title"><a name=
1.73 rillig 16385: "porting"></a>Chapter 22. Porting
1.69 rillig 16386: pkgsrc</h2>
16387: </div>
16388: </div>
16389: </div>
16390:
16391: <div class="toc">
16392: <p><b>Table of Contents</b></p>
16393:
16394: <dl>
1.73 rillig 16395: <dt><span class="sect1"><a href="#porting.opsys">22.1.
1.69 rillig 16396: Porting pkgsrc to a new operating
16397: system</a></span></dt>
16398:
16399: <dt><span class="sect1"><a href=
1.73 rillig 16400: "#porting.compiler">22.2. Adding support for a new
1.69 rillig 16401: compiler</a></span></dt>
16402: </dl>
16403: </div>
16404:
16405: <p>The pkgsrc system has already been ported to many
16406: operating systems, hardware architectures and compilers.
16407: This chapter explains the necessary steps to make pkgsrc
16408: even more portable.</p>
16409:
16410: <div class="sect1" lang="en">
16411: <div class="titlepage">
16412: <div>
16413: <div>
16414: <h2 class="title" style="clear: both"><a name=
1.73 rillig 16415: "porting.opsys"></a>22.1. Porting pkgsrc to a
1.69 rillig 16416: new operating system</h2>
16417: </div>
16418: </div>
16419: </div>
16420:
16421: <p>To port pkgsrc to a new operating system (called
16422: <code class="literal">MyOS</code> in this example), you
16423: need to touch the following files:</p>
16424:
16425: <div class="variablelist">
16426: <dl>
16427: <dt><span class="term"><code xmlns=
16428: "http://www.w3.org/TR/xhtml1/transitional" class=
16429: "filename">bootstrap/mods/mk/<em class=
16430: "replaceable"><code>MyOS</code></em>.sys.mk</code></span></dt>
16431:
16432: <dd>
16433: <p>This file contains some basic definitions, for
16434: example the name of the C compiler.</p>
16435: </dd>
16436:
16437: <dt><span class="term"><code xmlns=
16438: "http://www.w3.org/TR/xhtml1/transitional" class=
16439: "filename">mk/bsd.prefs.mk</code></span></dt>
16440:
16441: <dd>
16442: <p>Insert code that defines the variables
16443: <code class="varname">OPSYS</code>, <code class=
16444: "varname">OS_VERSION</code>, <code class=
16445: "varname">LOWER_OS_VERSION</code>, <code class=
16446: "varname">LOWER_VENDOR</code>, <code class=
16447: "varname">MACHINE_ARCH</code>, <code class=
16448: "varname">OBJECT_FMT</code>, <code class=
16449: "varname">APPEND_ELF</code>, and the other
16450: variables that appear in this file.</p>
16451: </dd>
16452:
16453: <dt><span class="term"><code xmlns=
16454: "http://www.w3.org/TR/xhtml1/transitional" class=
16455: "filename">mk/platform/MyOS.mk</code></span></dt>
16456:
16457: <dd>
16458: <p>This file contains the platform-specific
16459: definitions that are used by pkgsrc. Start by
16460: copying one of the other files and edit it to your
16461: needs.</p>
16462: </dd>
16463:
16464: <dt><span class="term"><code xmlns=
16465: "http://www.w3.org/TR/xhtml1/transitional" class=
16466: "filename">mk/platform/MyOS.pkg.dist</code></span></dt>
16467:
16468: <dd>
16469: <p>This file contains a list of directories,
16470: together with their permission bits and ownership.
16471: These directories will be created automatically
16472: with every package that does not explicitly set
16473: <code class="varname">NO_MTREE</code>. There have
16474: been some discussions about whether this file is
16475: needed at all, but with no result.</p>
16476: </dd>
16477:
16478: <dt><span class="term"><code xmlns=
16479: "http://www.w3.org/TR/xhtml1/transitional" class=
16480: "filename">mk/platform/MyOS.x11.dist</code></span></dt>
16481:
16482: <dd>
16483: <p>Just copy one of the pre-existing x11.dist files
16484: to your <code xmlns=
16485: "http://www.w3.org/TR/xhtml1/transitional" class=
16486: "filename"><em class=
16487: "replaceable"><code>MyOS</code></em>.x11.dist</code>.</p>
16488: </dd>
16489:
16490: <dt><span class="term"><code xmlns=
16491: "http://www.w3.org/TR/xhtml1/transitional" class=
16492: "filename">mk/tools/bootstrap.mk</code></span></dt>
16493:
16494: <dd>
16495: <p>On some operating systems, the tools that are
16496: provided with the base system are not good enough
16497: for pkgsrc. For example, there are many versions of
16498: <a href=
16499: "http://netbsd.gw.com/cgi-bin/man-cgi?sed+1+NetBSD-current">
16500: <span class="citerefentry"><span class=
16501: "refentrytitle">sed</span>(1)</span></a> that have
16502: a narrow limit on the line length they can process.
16503: Therefore pkgsrc brings its own tools, which can be
16504: enabled here.</p>
16505: </dd>
16506:
16507: <dt><span class="term"><code xmlns=
16508: "http://www.w3.org/TR/xhtml1/transitional" class=
16509: "filename">mk/tools/<em class=
16510: "replaceable"><code>MyOS</code></em>.mk</code></span></dt>
16511:
16512: <dd>
16513: <p>This file defines the paths to all the tools
16514: that are needed by one or the other package in
16515: pkgsrc, as well as by pkgsrc itself. Find out where
16516: these tools are on your platform and add them.</p>
16517: </dd>
16518: </dl>
16519: </div>
16520:
16521: <p>Now, you should be able to build some basic packages,
16522: like <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
16523: href=
16524: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/perl5/README.html"
16525: target="_top"><code xmlns="" class=
16526: "filename">lang/perl5</code></a>, <a xmlns=
16527: "http://www.w3.org/TR/xhtml1/transitional" href=
16528: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/bash/README.html"
16529: target="_top"><code xmlns="" class=
16530: "filename">shells/bash</code></a>.</p>
16531: </div>
16532:
16533: <div class="sect1" lang="en">
16534: <div class="titlepage">
16535: <div>
16536: <div>
16537: <h2 class="title" style="clear: both"><a name=
1.73 rillig 16538: "porting.compiler"></a>22.2. Adding support
1.69 rillig 16539: for a new compiler</h2>
16540: </div>
16541: </div>
16542: </div>
16543:
16544: <p>TODO</p>
16545: </div>
16546: </div>
1.1 grant 16547: </div>
16548:
1.67 hubertf 16549: <div class="appendix" lang="en">
1.1 grant 16550: <div class="titlepage">
16551: <div>
16552: <div>
1.67 hubertf 16553: <h2 class="title"><a name=
1.46 gdt 16554: "examples"></a>Appendix A. A simple example
1.1 grant 16555: package: bison</h2>
16556: </div>
16557: </div>
16558: </div>
16559:
16560: <div class="toc">
16561: <p><b>Table of Contents</b></p>
16562:
16563: <dl>
1.46 gdt 16564: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 16565: files</a></span></dt>
16566:
16567: <dd>
16568: <dl>
1.30 wiz 16569: <dt><span class="sect2"><a href=
1.46 gdt 16570: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 16571:
1.30 wiz 16572: <dt><span class="sect2"><a href=
1.46 gdt 16573: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 16574:
1.30 wiz 16575: <dt><span class="sect2"><a href=
1.46 gdt 16576: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 16577:
1.30 wiz 16578: <dt><span class="sect2"><a href=
1.46 gdt 16579: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 16580: package with <span><strong class=
1.14 xtraeme 16581: "command">pkglint</strong></span></a></span></dt>
1.1 grant 16582: </dl>
16583: </dd>
16584:
1.46 gdt 16585: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 16586: Steps for building, installing, packaging</a></span></dt>
1.1 grant 16587: </dl>
16588: </div>
16589:
16590: <p>We checked to find a piece of software that wasn't in the
16591: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 16592: would want to have <span><strong class=
16593: "command">bison</strong></span> when Berkeley
16594: <span><strong class="command">yacc</strong></span> is already
16595: present in the tree is beyond us, but it's useful for the
16596: purposes of this exercise.</p>
1.1 grant 16597:
1.67 hubertf 16598: <div class="sect1" lang="en">
1.1 grant 16599: <div class="titlepage">
16600: <div>
16601: <div>
16602: <h2 class="title" style="clear: both"><a name=
1.46 gdt 16603: "example-files"></a>A.1. files</h2>
1.1 grant 16604: </div>
16605: </div>
16606: </div>
16607:
1.67 hubertf 16608: <div class="sect2" lang="en">
1.1 grant 16609: <div class="titlepage">
16610: <div>
16611: <div>
1.67 hubertf 16612: <h3 class="title"><a name=
1.46 gdt 16613: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 16614: </div>
16615: </div>
16616: </div>
16617: <pre class="programlisting">
1.51 rillig 16618: # $NetBSD$
16619: #
1.1 grant 16620:
1.51 rillig 16621: DISTNAME= bison-1.25
16622: CATEGORIES= devel
16623: MASTER_SITES= ${MASTER_SITE_GNU}
1.1 grant 16624:
1.51 rillig 16625: MAINTAINER= thorpej@NetBSD.org
16626: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
16627: COMMENT= GNU yacc clone
1.1 grant 16628:
1.51 rillig 16629: GNU_CONFIGURE= yes
16630: INFO_FILES= bison.info
1.1 grant 16631:
1.51 rillig 16632: .include "../../mk/bsd.pkg.mk"
1.1 grant 16633: </pre>
16634: </div>
16635:
1.67 hubertf 16636: <div class="sect2" lang="en">
1.1 grant 16637: <div class="titlepage">
16638: <div>
16639: <div>
1.67 hubertf 16640: <h3 class="title"><a name=
1.46 gdt 16641: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 16642: </div>
16643: </div>
16644: </div>
16645: <pre class="programlisting">
1.51 rillig 16646: GNU version of yacc. Can make re-entrant parsers, and numerous other
16647: improvements. Why you would want this when Berkeley <a href=
1.1 grant 16648: "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 16649: of the NetBSD source tree is beyond me.
1.1 grant 16650: </pre>
16651: </div>
16652:
1.67 hubertf 16653: <div class="sect2" lang="en">
1.1 grant 16654: <div class="titlepage">
16655: <div>
16656: <div>
1.67 hubertf 16657: <h3 class="title"><a name=
1.46 gdt 16658: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 16659: </div>
16660: </div>
16661: </div>
16662: <pre class="programlisting">
1.51 rillig 16663: @comment $NetBSD$
16664: bin/bison
16665: man/man1/bison.1.gz
16666: share/bison.simple
16667: share/bison.hairy
1.1 grant 16668: </pre>
16669: </div>
16670:
1.67 hubertf 16671: <div class="sect2" lang="en">
1.1 grant 16672: <div class="titlepage">
16673: <div>
16674: <div>
1.30 wiz 16675: <h3 class="title"><a name=
1.46 gdt 16676: "checking-package-with-pkglint"></a>A.1.4. Checking
1.30 wiz 16677: a package with <span><strong class=
1.14 xtraeme 16678: "command">pkglint</strong></span></h3>
1.1 grant 16679: </div>
16680: </div>
16681: </div>
16682:
16683: <p>The NetBSD package system comes with <a xmlns=
16684: "http://www.w3.org/TR/xhtml1/transitional" href=
16685: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 16686: target="_top"><code xmlns="" class=
16687: "filename">pkgtools/pkglint</code></a> which helps to
16688: check the contents of these files. After installation it
16689: is quite easy to use, just change to the directory of the
1.20 ben 16690: package you wish to examine and execute
16691: <span><strong class=
16692: "command">pkglint</strong></span>:</p>
1.1 grant 16693: <pre class="screen">
1.14 xtraeme 16694: <code class="prompt">$</code> <strong class=
16695: "userinput"><code>pkglint</code></strong>
1.1 grant 16696: looks fine.
16697: </pre>
16698:
16699: <p>Depending on the supplied command line arguments (see
1.60 rillig 16700: pkglint(1)), more checks will be performed. Use e.g.
16701: <span><strong class="command">pkglint -Call
16702: -Wall</strong></span> for a very thorough check.</p>
1.1 grant 16703: </div>
16704: </div>
16705:
1.67 hubertf 16706: <div class="sect1" lang="en">
1.1 grant 16707: <div class="titlepage">
16708: <div>
16709: <div>
16710: <h2 class="title" style="clear: both"><a name=
1.46 gdt 16711: "steps-for-b-i-p"></a>A.2. Steps for building,
1.30 wiz 16712: installing, packaging</h2>
1.1 grant 16713: </div>
16714: </div>
16715: </div>
16716:
16717: <p>Create the directory where the package lives, plus any
16718: auxiliary directories:</p>
16719: <pre class="screen">
1.14 xtraeme 16720: <code class="prompt">#</code> <strong class=
16721: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
16722: <code class="prompt">#</code> <strong class=
16723: "userinput"><code>mkdir bison</code></strong>
16724: <code class="prompt">#</code> <strong class=
16725: "userinput"><code>cd bison</code></strong>
16726: <code class="prompt">#</code> <strong class=
16727: "userinput"><code>mkdir patches</code></strong>
1.1 grant 16728: </pre>
16729:
1.45 wiz 16730: <p>Create <code xmlns=
16731: "http://www.w3.org/TR/xhtml1/transitional" class=
16732: "filename">Makefile</code>, <code xmlns=
16733: "http://www.w3.org/TR/xhtml1/transitional" class=
16734: "filename">DESCR</code> and <code xmlns=
16735: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16736: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 16737: "Chapter 8. Package components - files, directories and contents">
1.67 hubertf 16738: Chapter 8, <i>Package components - files, directories
16739: and contents</i></a>) then continue with fetching the
1.1 grant 16740: distfile:</p>
16741: <pre class="screen">
1.14 xtraeme 16742: <code class="prompt">#</code> <strong class=
16743: "userinput"><code>make fetch</code></strong>
1.1 grant 16744: >> bison-1.25.tar.gz doesn't seem to exist on this system.
16745: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
16746: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
16747: ftp: Error retrieving file: 500 Internal error
16748:
16749: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
16750: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
16751: ftp: Error retrieving file: 500 Internal error
16752:
16753: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
16754: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
16755: Successfully retrieved file.
16756: </pre>
16757:
1.45 wiz 16758: <p>Generate the checksum of the distfile into <code xmlns=
16759: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16760: "filename">distinfo</code>:</p>
1.1 grant 16761: <pre class="screen">
1.14 xtraeme 16762: <code class="prompt">#</code> <strong class=
16763: "userinput"><code>make makesum</code></strong>
1.1 grant 16764: </pre>
16765:
16766: <p>Now compile:</p>
16767: <pre class="screen">
1.14 xtraeme 16768: <code class="prompt">#</code> <strong class=
16769: "userinput"><code>make</code></strong>
1.1 grant 16770: >> Checksum OK for bison-1.25.tar.gz.
16771: ===> Extracting for bison-1.25
16772: ===> Patching for bison-1.25
16773: ===> Ignoring empty patch directory
16774: ===> Configuring for bison-1.25
16775: creating cache ./config.cache
16776: checking for gcc... cc
16777: checking whether we are using GNU C... yes
16778: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
16779: checking how to run the C preprocessor... cc -E
16780: checking for minix/config.h... no
16781: checking for POSIXized ISC... no
16782: checking whether cross-compiling... no
16783: checking for ANSI C header files... yes
16784: checking for string.h... yes
16785: checking for stdlib.h... yes
16786: checking for memory.h... yes
16787: checking for working const... yes
16788: checking for working alloca.h... no
16789: checking for alloca... yes
16790: checking for strerror... yes
16791: updating cache ./config.cache
16792: creating ./config.status
16793: creating Makefile
16794: ===> Building for bison-1.25
16795: 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
16796: 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
16797: 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
16798: 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
16799: 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 16800: 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 16801: 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
16802: 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
16803: 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
16804: 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
16805: 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
16806: 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
16807: 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
16808: 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
16809: 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
16810: 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
16811: 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
16812: 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
16813: 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
16814: 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
16815: 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
16816: 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
16817: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
16818: rm -f bison.s1
16819: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
16820: </pre>
16821:
16822: <p>Everything seems OK, so install the files:</p>
16823: <pre class="screen">
1.14 xtraeme 16824: <code class="prompt">#</code> <strong class=
16825: "userinput"><code>make install</code></strong>
1.1 grant 16826: >> Checksum OK for bison-1.25.tar.gz.
16827: ===> Installing for bison-1.25
16828: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
16829: rm -f /usr/pkg/bin/bison
16830: cd /usr/pkg/share; rm -f bison.simple bison.hairy
16831: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
16832: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
16833: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
16834: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
16835: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
16836: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
16837: ===> Registering installation for bison-1.25
16838: </pre>
16839:
16840: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 16841: remove it with <span><strong class="command">pkg_delete
16842: bison</strong></span>. Should you decide that you want a
16843: binary package, do this now:</p>
1.1 grant 16844: <pre class="screen">
1.14 xtraeme 16845: <code class="prompt">#</code> <strong class=
16846: "userinput"><code>make package</code></strong>
1.1 grant 16847: >> Checksum OK for bison-1.25.tar.gz.
16848: ===> Building package for bison-1.25
16849: Creating package bison-1.25.tgz
16850: Registering depends:.
16851: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
16852: </pre>
16853:
16854: <p>Now that you don't need the source and object files any
16855: more, clean up:</p>
16856: <pre class="screen">
1.14 xtraeme 16857: <code class="prompt">#</code> <strong class=
16858: "userinput"><code>make clean</code></strong>
1.1 grant 16859: ===> Cleaning for bison-1.25
16860: </pre>
16861: </div>
16862: </div>
16863:
1.67 hubertf 16864: <div class="appendix" lang="en">
1.1 grant 16865: <div class="titlepage">
16866: <div>
16867: <div>
1.67 hubertf 16868: <h2 class="title"><a name=
1.46 gdt 16869: "logs"></a>Appendix B. Build logs</h2>
1.1 grant 16870: </div>
16871: </div>
16872: </div>
16873:
16874: <div class="toc">
16875: <p><b>Table of Contents</b></p>
16876:
16877: <dl>
1.46 gdt 16878: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 16879: Building figlet</a></span></dt>
16880:
1.46 gdt 16881: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 16882: Packaging figlet</a></span></dt>
16883: </dl>
16884: </div>
16885:
1.67 hubertf 16886: <div class="sect1" lang="en">
1.1 grant 16887: <div class="titlepage">
16888: <div>
16889: <div>
16890: <h2 class="title" style="clear: both"><a name=
1.46 gdt 16891: "logs.building"></a>B.1. Building figlet</h2>
1.1 grant 16892: </div>
16893: </div>
16894: </div>
16895: <pre class="screen">
1.14 xtraeme 16896: <code class="prompt">#</code> <strong class=
16897: "userinput"><code>make</code></strong>
1.1 grant 16898: ===> Checking for vulnerabilities in figlet-2.2.1nb2
16899: => figlet221.tar.gz doesn't seem to exist on this system.
16900: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
16901: => [172219 bytes]
16902: Connected to ftp.plig.net.
16903: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
16904: 331 Guest login ok, send your complete e-mail address as password.
16905: 230-You are user #5 of 500 simultaneous users allowed.
16906: 230-
1.68 rillig 16907: 230- ___ _ _ _
16908: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
1.1 grant 16909: 230- | _| _| . |_| . | | | . |_| . | _| . |
16910: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
16911: 230- |_| |_| |___| |___|
16912: 230-
16913: 230-** Welcome to ftp.plig.org **
16914: 230-
16915: 230-Please note that all transfers from this FTP site are logged. If you
16916: 230-do not like this, please disconnect now.
16917: 230-
16918: 230-This arhive is available via
16919: 230-
16920: 230-HTTP: http://ftp.plig.org/
16921: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
16922: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
16923: 230-
16924: 230-Please email comments, bug reports and requests for packages to be
1.68 rillig 16925: 230-mirrored to ftp-admin@plig.org.
1.1 grant 16926: 230-
16927: 230-
16928: 230 Logged in anonymously.
16929: Remote system type is UNIX.
16930: Using binary mode to transfer files.
16931: 200 Type okay.
16932: 250 "/pub" is new cwd.
16933: 250-"/pub/figlet" is new cwd.
16934: 250-
16935: 250-Welcome to the figlet archive at ftp.figlet.org
1.68 rillig 16936: 250-
1.1 grant 16937: 250- ftp://ftp.figlet.org/pub/figlet/
16938: 250-
16939: 250-The official FIGlet web page is:
16940: 250- http://www.figlet.org/
16941: 250-
16942: 250-If you have questions, please mailto:info@figlet.org. If you want to
16943: 250-contribute a font or something else, you can email us.
1.68 rillig 16944: 250
1.1 grant 16945: 250 "/pub/figlet/program" is new cwd.
16946: 250 "/pub/figlet/program/unix" is new cwd.
16947: local: figlet221.tar.gz remote: figlet221.tar.gz
16948: 502 Unimplemented command.
16949: 227 Entering Passive Mode (195,40,6,41,246,104)
16950: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
16951: 38% |************** | 65800 64.16 KB/s 00:01 ETA
16952: 226 Transfer completed.
16953: 172219 bytes received in 00:02 (75.99 KB/s)
16954: 221 Goodbye.
16955: => Checksum OK for figlet221.tar.gz.
16956: ===> Extracting for figlet-2.2.1nb2
16957: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
16958: ===> Patching for figlet-2.2.1nb2
16959: ===> Applying pkgsrc patches for figlet-2.2.1nb2
16960: ===> Overriding tools for figlet-2.2.1nb2
16961: ===> Creating toolchain wrappers for figlet-2.2.1nb2
16962: ===> Configuring for figlet-2.2.1nb2
16963: ===> Building for figlet-2.2.1nb2
16964: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
16965: chmod a+x figlet
16966: gcc -O2 -o chkfont chkfont.c
16967: => Unwrapping files-to-be-installed.
1.14 xtraeme 16968: <code class="prompt">#</code>
16969: <code class="prompt">#</code> <strong class=
16970: "userinput"><code>make install</code></strong>
1.1 grant 16971: ===> Checking for vulnerabilities in figlet-2.2.1nb2
16972: ===> Installing for figlet-2.2.1nb2
16973: install -d -o root -g wheel -m 755 /usr/pkg/bin
16974: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
16975: mkdir -p /usr/pkg/share/figlet
16976: cp figlet /usr/pkg/bin
16977: cp chkfont /usr/pkg/bin
16978: chmod 555 figlist showfigfonts
16979: cp figlist /usr/pkg/bin
16980: cp showfigfonts /usr/pkg/bin
16981: cp fonts/*.flf /usr/pkg/share/figlet
16982: cp fonts/*.flc /usr/pkg/share/figlet
16983: cp figlet.6 /usr/pkg/man/man6
16984: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 16985: <code class="prompt">#</code>
1.1 grant 16986: </pre>
16987: </div>
16988:
1.67 hubertf 16989: <div class="sect1" lang="en">
1.1 grant 16990: <div class="titlepage">
16991: <div>
16992: <div>
16993: <h2 class="title" style="clear: both"><a name=
1.46 gdt 16994: "logs.package"></a>B.2. Packaging figlet</h2>
1.1 grant 16995: </div>
16996: </div>
16997: </div>
16998: <pre class="screen">
1.14 xtraeme 16999: <code class="prompt">#</code> <strong class=
17000: "userinput"><code>make package</code></strong>
1.1 grant 17001: ===> Checking for vulnerabilities in figlet-2.2.1nb2
17002: ===> Packaging figlet-2.2.1nb2
17003: ===> Building binary package for figlet-2.2.1nb2
17004: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
17005: Using SrcDir value of /usr/pkg
1.68 rillig 17006: Registering depends:.
1.14 xtraeme 17007: <code class="prompt">#</code>
1.1 grant 17008: </pre>
17009: </div>
17010: </div>
17011:
1.67 hubertf 17012: <div class="appendix" lang="en">
1.1 grant 17013: <div class="titlepage">
17014: <div>
17015: <div>
1.67 hubertf 17016: <h2 class="title"><a name=
1.46 gdt 17017: "ftp-layout"></a>Appendix C. Layout of the
1.1 grant 17018: FTP server's package archive</h2>
17019: </div>
17020: </div>
17021: </div>
17022:
17023: <p>Layout for precompiled binary packages on
17024: ftp.NetBSD.org:</p>
17025: <pre class="programlisting">
1.51 rillig 17026: /pub/NetBSD/packages/
17027: distfiles/
1.1 grant 17028:
1.51 rillig 17029: # Unpacked pkgsrc trees
17030: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
17031: pkgsrc-2003Q4 -> N/A
17032: pkgsrc-2004Q1/pkgsrc
17033:
17034: # pkgsrc archives
17035: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
17036: pkgsrc-2003Q4.tar.gz -> N/A
17037: pkgsrc-2004Q1.tar.gz -> N/A
17038:
17039: # Per pkgsrc-release/OS-release/arch package archives
17040: pkgsrc-2003Q4/
17041: NetBSD-1.6.2/
17042: i386/
17043: All/
17044: archivers/
17045: foo -> ../All/foo
17046: ...
17047: pkgsrc-2004Q1/
17048: NetBSD-1.6.2/
17049: i386/
17050: All/
17051: ...
17052: NetBSD-2.0/
17053: i386/
17054: All/
17055: ...
17056: SunOS-5.9/
17057: sparc/
17058: All/
17059: ...
17060: x86/
17061: All/
17062: ...
17063:
17064: # Per os-release package archive convenience links
17065: NetBSD-1.6.2 -> 1.6.2
17066: 1.6.2/
17067: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
17068: m68k/
17069: All/
17070: archivers/
17071: foo -> ../All/foo
17072: ...
17073: amiga -> m68k
17074: atari -> m68k
17075: ...
17076:
17077: 2.0 -> NetBSD-2.0 # backward compat, historic
17078: NetBSD-2.0/
17079: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
17080: SunOS-5.9/
17081: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
17082: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1 grant 17083: </pre>
17084:
17085: <p>To create:</p>
17086:
17087: <div class="orderedlist">
17088: <ol type="1">
17089: <li>
17090: <p>Run bulk build, see <a href="#bulkbuild" title=
1.67 hubertf 17091: "6.3. Doing a bulk build of all packages">Section 6.3,
17092: “Doing a bulk build of all
1.1 grant 17093: packages”</a></p>
17094: </li>
17095:
17096: <li>
17097: <p>Upload /usr/pkgsrc/packages to</p>
17098: <pre class="programlisting">
17099: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51 rillig 17100: pkgsrc-2004Q4/\ # pkgsrc-branch
17101: `uname -s`-`uname -r`/\ # OS & version
17102: `uname -p` # architecture
1.1 grant 17103: </pre>
17104: </li>
17105:
17106: <li>
1.14 xtraeme 17107: <p>If necessary, create a symlink <span><strong class=
17108: "command">ln -s `uname -m` `uname -p`</strong></span>
17109: (amiga -> m68k, ...)</p>
1.1 grant 17110: </li>
17111: </ol>
17112: </div>
17113: </div>
1.2 hubertf 17114:
1.67 hubertf 17115: <div class="appendix" lang="en">
1.2 hubertf 17116: <div class="titlepage">
17117: <div>
17118: <div>
1.67 hubertf 17119: <h2 class="title"><a name=
1.46 gdt 17120: "editing"></a>Appendix D. Editing guidelines
1.2 hubertf 17121: for the pkgsrc guide</h2>
17122: </div>
17123: </div>
17124: </div>
17125:
17126: <div class="toc">
17127: <p><b>Table of Contents</b></p>
17128:
17129: <dl>
1.46 gdt 17130: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 17131: Targets</a></span></dt>
17132:
1.46 gdt 17133: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 17134: Procedure</a></span></dt>
17135: </dl>
17136: </div>
17137:
17138: <p>This section contains information on editing the pkgsrc
17139: guide itself.</p>
17140:
1.67 hubertf 17141: <div class="sect1" lang="en">
1.2 hubertf 17142: <div class="titlepage">
17143: <div>
17144: <div>
17145: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 17146: "targets"></a>D.1. Targets</h2>
1.2 hubertf 17147: </div>
17148: </div>
17149: </div>
17150:
1.45 wiz 17151: <p>The pkgsrc guide's source code is stored in <code xmlns=
17152: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17153: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 17154: are created from it:</p>
17155:
17156: <div class="itemizedlist">
17157: <ul type="disc">
17158: <li>
1.45 wiz 17159: <p><code xmlns=
17160: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 17161: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 17162: </li>
17163:
17164: <li>
1.45 wiz 17165: <p><code xmlns=
17166: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17167: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 17168: </li>
17169:
17170: <li>
1.45 wiz 17171: <p><code xmlns=
17172: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17173: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 17174: the documentation on the NetBSD website will be built
17175: from pkgsrc and kept up to date on the web server
17176: itself. This means you <span class=
17177: "emphasis"><em>must</em></span> make sure that your
17178: changes haven't broken the build!</p>
17179: </li>
1.6 hubertf 17180:
17181: <li>
1.45 wiz 17182: <p><code xmlns=
17183: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17184: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 17185: PDF version of the pkgsrc guide.</p>
17186: </li>
17187:
17188: <li>
1.45 wiz 17189: <p><code xmlns=
17190: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17191: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 17192: PostScript version of the pkgsrc guide.</p>
17193: </li>
1.2 hubertf 17194: </ul>
17195: </div>
17196: </div>
17197:
1.67 hubertf 17198: <div class="sect1" lang="en">
1.2 hubertf 17199: <div class="titlepage">
17200: <div>
17201: <div>
17202: <h2 class="title" style="clear: both"><a name=
1.46 gdt 17203: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 17204: </div>
17205: </div>
17206: </div>
17207:
17208: <p>The procedure to edit the pkgsrc guide is:</p>
17209:
17210: <div class="itemizedlist">
17211: <ul type="disc">
17212: <li>
1.6 hubertf 17213: <p>Make sure you have the packages needed to
17214: re-generate the pkgsrc guide (and other XML-based
17215: NetBSD documentation) installed. These are
1.11 ben 17216: “<span class="quote">netbsd-doc</span>”
1.47 reed 17217: for creating the ASCII and HTML versions, and
1.6 hubertf 17218: “<span class=
1.47 reed 17219: "quote">netbsd-doc-print</span>” for the
17220: PostScript and PDF versions. You will need both
1.6 hubertf 17221: packages installed, to make sure documentation is
17222: consistent across all formats. The packages can be
1.45 wiz 17223: found in <code xmlns=
17224: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17225: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45 wiz 17226: <code xmlns=
17227: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17228: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 17229: </li>
17230:
17231: <li>
1.45 wiz 17232: <p>Edit the XML file(s) in <code xmlns=
17233: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17234: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 17235: </li>
17236:
17237: <li>
1.14 xtraeme 17238: <p>Run <span><strong class="command">make extract
17239: && make do-lint</strong></span> in
1.45 wiz 17240: <code xmlns=
17241: "http://www.w3.org/TR/xhtml1/transitional" class=
17242: "filename">pkgsrc/doc/guide</code> to check the XML
17243: syntax, and fix it if needed.</p>
1.4 hubertf 17244: </li>
17245:
17246: <li>
1.14 xtraeme 17247: <p>Run <span><strong class=
1.45 wiz 17248: "command">make</strong></span> in <code xmlns=
17249: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17250: "filename">pkgsrc/doc/guide</code> to build the HTML
17251: and ASCII version.</p>
1.2 hubertf 17252: </li>
17253:
17254: <li>
1.14 xtraeme 17255: <p>If all is well, run <span><strong class=
17256: "command">make install-doc</strong></span> to put the
1.45 wiz 17257: generated files into <code xmlns=
17258: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17259: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 17260: </li>
17261:
17262: <li>
1.14 xtraeme 17263: <p><span><strong class="command">cvs commit
17264: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 17265: </li>
17266:
17267: <li>
1.14 xtraeme 17268: <p><span><strong class="command">cvs commit -m
17269: re-generate
17270: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 17271: </li>
1.4 hubertf 17272:
17273: <li>
17274: <p>Until the webserver on www.NetBSD.org is really
17275: updated automatically to pick up changes to the
1.14 xtraeme 17276: pkgsrc guide automatically, also run
1.18 xtraeme 17277: <span><strong class="command">make install-htdocs
1.14 xtraeme 17278: HTDOCSDIR=../../../htdocs</strong></span> (or
17279: similar, adjust <code class=
17280: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 17281: </li>
17282:
17283: <li>
1.14 xtraeme 17284: <p><span><strong class="command">cvs commit
17285: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 17286: </li>
1.2 hubertf 17287: </ul>
17288: </div>
17289: </div>
17290: </div>
1.1 grant 17291: </div>
17292: </body>
17293: </html>
CVSweb <webmaster@jp.NetBSD.org>