Annotation of pkgsrc/doc/pkgsrc.html, revision 1.36
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.20 ben 4: "HTML Tidy for NetBSD (vers 1st August 2004), see www.w3.org" />
1.1 grant 5: <meta http-equiv="Content-Type" content=
6: "text/html; charset=us-ascii" />
7:
8: <title>The pkgsrc guide</title>
9: <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
10: <meta name="generator" content=
1.23 wiz 11: "DocBook XSL Stylesheets VX.X.X" />
1.1 grant 12: <meta name="description" content=
13: "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
14: </head>
15:
16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
17: alink="#0000FF">
18: <div class="book" lang="en" xml:lang="en">
19: <div class="titlepage">
20: <div>
21: <div>
1.30 wiz 22: <h1 class="title"><a name="the-pkgsrc-guide" id=
23: "the-pkgsrc-guide"></a>The pkgsrc guide</h1>
1.1 grant 24: </div>
25:
26: <div>
1.2 hubertf 27: <h2 class="subtitle">Documentation on the NetBSD packages
1.1 grant 28: system</h2>
29: </div>
30:
31: <div>
32: <div class="authorgroup">
33: <div class="author">
34: <h3 class="author"><span class=
35: "firstname">Alistair</span> <span class=
36: "surname">Crooks</span></h3>
37:
38: <div class="affiliation">
39: <div class="address">
1.14 xtraeme 40: <p><code class="email"><<a href=
41: "mailto:agc@NetBSD.org">agc@NetBSD.org</a>></code></p>
1.1 grant 42: </div>
43: </div>
44: </div>
45:
46: <div class="author">
47: <h3 class="author"><span class=
48: "firstname">Hubert</span> <span class=
49: "surname">Feyrer</span></h3>
50:
51: <div class="affiliation">
52: <div class="address">
1.14 xtraeme 53: <p><code class="email"><<a href=
54: "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>></code></p>
1.1 grant 55: </div>
56: </div>
57: </div>
1.2 hubertf 58:
1.3 hubertf 59: <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1 grant 60: </div>
61: </div>
62:
63: <div>
64: <p class="copyright">Copyright © 1994-2004 The
65: NetBSD Foundation, Inc</p>
66: </div>
67:
1.23 wiz 68: <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.36 ! wiz 69: <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.8
! 70: 2005/06/03 12:27:48 jmmv Exp $</p>
1.1 grant 71: </div>
72:
73: <div>
74: <div class="abstract">
75: <p class="title"><b>Abstract</b></p>
76:
77: <p>Information about using the NetBSD package system
78: (pkgsrc) from both a user view for installing packages
79: as well as from a pkgsrc developers' view for creating
80: new packages.</p>
81: </div>
82: </div>
83: </div>
84: <hr />
85: </div>
86:
87: <div class="toc">
88: <p><b>Table of Contents</b></p>
89:
90: <dl>
91: <dt><span class="chapter"><a href="#introduction">1.
92: Introduction</a></span></dt>
93:
94: <dd>
95: <dl>
1.30 wiz 96: <dt><span class="sect1"><a href=
97: "#introduction-section">1.1.
1.1 grant 98: Introduction</a></span></dt>
99:
100: <dt><span class="sect1"><a href="#overview">1.2.
101: Overview</a></span></dt>
102:
103: <dt><span class="sect1"><a href="#terminology">1.3.
104: Terminology</a></span></dt>
105:
106: <dt><span class="sect1"><a href="#typography">1.4.
107: Typography</a></span></dt>
108: </dl>
109: </dd>
110:
1.2 hubertf 111: <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1 grant 112: user's guide</a></span></dt>
113:
114: <dd>
115: <dl>
116: <dt><span class="chapter"><a href="#getting">2. Where
117: to get pkgsrc</a></span></dt>
118:
119: <dd>
120: <dl>
1.30 wiz 121: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1 grant 122: As tar file</a></span></dt>
123:
1.30 wiz 124: <dt><span class="sect1"><a href="#via-sup">2.2. Via
125: SUP</a></span></dt>
1.1 grant 126:
1.30 wiz 127: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
128: CVS</a></span></dt>
1.1 grant 129: </dl>
130: </dd>
131:
132: <dt><span class="chapter"><a href="#platforms">3. Using
133: pkgsrc on systems other than NetBSD</a></span></dt>
134:
135: <dd>
136: <dl>
1.30 wiz 137: <dt><span class="sect1"><a href=
138: "#bootstrapping-pkgsrc">3.1. Bootstrapping
139: pkgsrc</a></span></dt>
1.1 grant 140:
1.30 wiz 141: <dt><span class="sect1"><a href=
142: "#platform-specific-notes">3.2. Platform specific
143: notes</a></span></dt>
1.1 grant 144:
145: <dd>
146: <dl>
147: <dt><span class="sect2"><a href=
1.30 wiz 148: "#darwin">3.2.1. Darwin (Mac OS
1.1 grant 149: X)</a></span></dt>
150:
151: <dt><span class="sect2"><a href=
1.30 wiz 152: "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1 grant 153:
154: <dt><span class="sect2"><a href=
1.30 wiz 155: "#interix">3.2.3. Interix</a></span></dt>
1.1 grant 156:
1.30 wiz 157: <dt><span class="sect2"><a href="#irix">3.2.4.
158: IRIX</a></span></dt>
1.1 grant 159:
1.30 wiz 160: <dt><span class="sect2"><a href="#linux">3.2.5.
161: Linux</a></span></dt>
1.1 grant 162:
163: <dt><span class="sect2"><a href=
1.30 wiz 164: "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22 tv 165:
166: <dt><span class="sect2"><a href=
1.30 wiz 167: "#solaris">3.2.7. Solaris</a></span></dt>
1.1 grant 168: </dl>
169: </dd>
170: </dl>
171: </dd>
172:
173: <dt><span class="chapter"><a href="#using">4. Using
174: pkgsrc</a></span></dt>
175:
176: <dd>
177: <dl>
178: <dt><span class="sect1"><a href=
179: "#getting-started">4.1. Working with binary
180: packages</a></span></dt>
181:
182: <dd>
183: <dl>
184: <dt><span class="sect2"><a href=
1.30 wiz 185: "#where-to-get-binary-packages">4.1.1. Where to
186: get binary packages</a></span></dt>
1.1 grant 187:
188: <dt><span class="sect2"><a href=
1.30 wiz 189: "#how-to-use-binary-packages">4.1.2. How to use
190: binary packages</a></span></dt>
1.1 grant 191:
192: <dt><span class="sect2"><a href=
1.30 wiz 193: "#a-word-of-warning">4.1.3. A word of
1.1 grant 194: warning</a></span></dt>
195: </dl>
196: </dd>
197:
1.30 wiz 198: <dt><span class="sect1"><a href=
199: "#building-packages-from-source">4.2. Building
200: packages from source</a></span></dt>
1.1 grant 201:
202: <dd>
203: <dl>
204: <dt><span class="sect2"><a href=
1.30 wiz 205: "#requirements">4.2.1.
1.1 grant 206: Requirements</a></span></dt>
207:
208: <dt><span class="sect2"><a href=
1.30 wiz 209: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 210: distfiles</a></span></dt>
211:
212: <dt><span class="sect2"><a href=
1.30 wiz 213: "#how-to-build-and-install">4.2.3. How to build
214: and install</a></span></dt>
1.1 grant 215:
216: <dt><span class="sect2"><a href=
1.30 wiz 217: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 218: compiler</a></span></dt>
219: </dl>
220: </dd>
221: </dl>
222: </dd>
223:
224: <dt><span class="chapter"><a href="#binary">5. Creating
225: binary packages</a></span></dt>
226:
227: <dd>
228: <dl>
1.30 wiz 229: <dt><span class="sect1"><a href=
230: "#building-a-single-binary-package">5.1. Building a
231: single binary package</a></span></dt>
1.1 grant 232:
1.30 wiz 233: <dt><span class="sect1"><a href=
234: "#settings-for-creationg-of-binary-packages">5.2.
1.1 grant 235: Settings for creation of binary
236: packages</a></span></dt>
237:
238: <dt><span class="sect1"><a href="#bulkbuild">5.3.
239: Doing a bulk build of all packages</a></span></dt>
240:
241: <dd>
242: <dl>
243: <dt><span class="sect2"><a href=
244: "#binary.configuration">5.3.1.
245: Configuration</a></span></dt>
246:
247: <dt><span class="sect2"><a href=
1.30 wiz 248: "#other-environmental-considerations">5.3.2.
249: Other environmental
1.1 grant 250: considerations</a></span></dt>
251:
252: <dt><span class="sect2"><a href=
1.30 wiz 253: "#operation">5.3.3. Operation</a></span></dt>
1.1 grant 254:
255: <dt><span class="sect2"><a href=
1.30 wiz 256: "#what-it-does">5.3.4. What it
1.1 grant 257: does</a></span></dt>
258:
259: <dt><span class="sect2"><a href=
1.30 wiz 260: "#disk-space-requirements">5.3.5. Disk space
1.1 grant 261: requirements</a></span></dt>
262:
263: <dt><span class="sect2"><a href=
1.30 wiz 264: "#setting-up-a-sandbox">5.3.6. Setting up a
265: sandbox for chroot'ed builds</a></span></dt>
1.1 grant 266:
267: <dt><span class="sect2"><a href=
1.30 wiz 268: "#building-a-partial-set">5.3.7. Building a
269: partial set of packages</a></span></dt>
1.13 hubertf 270:
271: <dt><span class="sect2"><a href=
272: "#bulk-upload">5.3.8. Uploading results of a
273: bulk build</a></span></dt>
1.1 grant 274: </dl>
275: </dd>
276:
1.30 wiz 277: <dt><span class="sect1"><a href=
278: "#creating-cdroms">5.4. Creating a multiple CD-ROM
279: packages collection</a></span></dt>
1.1 grant 280:
281: <dd>
282: <dl>
283: <dt><span class="sect2"><a href=
1.30 wiz 284: "#cdpack-example">5.4.1. Example of
1.1 grant 285: cdpack</a></span></dt>
286: </dl>
287: </dd>
288: </dl>
289: </dd>
290:
291: <dt><span class="chapter"><a href="#faq">6. Frequently
292: Asked Questions</a></span></dt>
293:
294: <dd>
295: <dl>
1.30 wiz 296: <dt><span class="sect1"><a href=
297: "#mailing-list-pointers">6.1. Are there any mailing
298: lists for pkg-related discussion?</a></span></dt>
1.1 grant 299:
1.30 wiz 300: <dt><span class="sect1"><a href=
301: "#pkgviews-docs">6.2. Where's the pkgviews
302: documentation?</a></span></dt>
1.1 grant 303:
1.5 hubertf 304: <dt><span class="sect1"><a href=
305: "#faq-pkgtools">6.3. Utilities for package
306: management (pkgtools)</a></span></dt>
1.1 grant 307:
1.30 wiz 308: <dt><span class="sect1"><a href=
309: "#non-root-pkgsrc">6.4. How to use pkgsrc as
310: non-root</a></span></dt>
311:
312: <dt><span class="sect1"><a href=
313: "#resume-transfers">6.5. How to resume transfers
314: when fetching distfiles?</a></span></dt>
315:
316: <dt><span class="sect1"><a href=
317: "#XFree86-from-pkgsrc">6.6. How can I install/use
318: XFree86 from pkgsrc?</a></span></dt>
319:
320: <dt><span class="sect1"><a href=
321: "#x.org-from-pkgsrc">6.7. How can I install/use
322: X.org from pkgsrc?</a></span></dt>
1.1 grant 323:
1.30 wiz 324: <dt><span class="sect1"><a href=
325: "#fetch-behind-firewall">6.8. How to fetch files
326: from behind a firewall</a></span></dt>
1.1 grant 327:
1.30 wiz 328: <dt><span class="sect1"><a href="#passive-ftp">6.9.
1.14 xtraeme 329: How do I tell <span><strong class="command">make
330: fetch</strong></span> to do passive
1.1 grant 331: FTP?</a></span></dt>
332:
1.30 wiz 333: <dt><span class="sect1"><a href=
334: "#fetching-all-distfiles">6.10. How to fetch all
335: distfiles at once</a></span></dt>
1.1 grant 336:
1.30 wiz 337: <dt><span class="sect1"><a href=
338: "#tmac.andoc-missing">6.11. What does
339: “<span class="quote">Don't know how to make
340: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 341: mean?</a></span></dt>
1.13 hubertf 342:
1.30 wiz 343: <dt><span class="sect1"><a href=
344: "#bsd.own.mk-missing">6.12. What does
345: “<span class="quote">Could not find
1.14 xtraeme 346: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 347:
1.30 wiz 348: <dt><span class="sect1"><a href=
349: "#using-sudo-with-pkgsrc">6.13. Using 'sudo' with
350: pkgsrc</a></span></dt>
1.1 grant 351:
1.14 xtraeme 352: <dt><span class="sect1"><a href="#faq.conf">6.14.
1.35 jmmv 353: How do I change the location of configuration
354: files?</a></span></dt>
1.1 grant 355:
356: <dt><span class="sect1"><a href=
1.14 xtraeme 357: "#audit-packages">6.15. Automated security
1.1 grant 358: checks</a></span></dt>
359: </dl>
360: </dd>
361: </dl>
362: </dd>
363:
1.2 hubertf 364: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 365: pkgsrc developer's guide</a></span></dt>
366:
367: <dd>
368: <dl>
1.27 rillig 369: <dt><span class="chapter"><a href="#components">7.
370: Package components - files, directories and
371: contents</a></span></dt>
372:
373: <dd>
374: <dl>
375: <dt><span class="sect1"><a href=
376: "#components.Makefile">7.1. <code class=
377: "filename">Makefile</code></a></span></dt>
378:
379: <dt><span class="sect1"><a href=
380: "#components.distinfo">7.2. <code class=
381: "filename">distinfo</code></a></span></dt>
382:
383: <dt><span class="sect1"><a href=
384: "#components.patches">7.3.
385: patches/*</a></span></dt>
386:
1.30 wiz 387: <dt><span class="sect1"><a href=
388: "#other-mandatory-files">7.4. Other mandatory
389: files</a></span></dt>
1.27 rillig 390:
391: <dt><span class="sect1"><a href=
392: "#components.optional">7.5. Optional
393: files</a></span></dt>
394:
1.30 wiz 395: <dt><span class="sect1"><a href="#work-dir">7.6.
1.27 rillig 396: <code class="filename">work*</code></a></span></dt>
397:
1.30 wiz 398: <dt><span class="sect1"><a href="#files-dir">7.7.
1.27 rillig 399: <code class=
400: "filename">files/*</code></a></span></dt>
401: </dl>
402: </dd>
403:
404: <dt><span class="chapter"><a href="#makefile">8.
1.25 rillig 405: Programming in <code class=
406: "filename">Makefile</code>s</a></span></dt>
407:
408: <dd>
409: <dl>
410: <dt><span class="sect1"><a href=
1.27 rillig 411: "#makefile.variables">8.1. <code class=
1.25 rillig 412: "filename">Makefile</code>
413: variables</a></span></dt>
414:
1.27 rillig 415: <dd>
416: <dl>
417: <dt><span class="sect2"><a href=
418: "#makefile.variables.names">8.1.1. Naming
419: conventions</a></span></dt>
420: </dl>
421: </dd>
422:
1.25 rillig 423: <dt><span class="sect1"><a href=
1.27 rillig 424: "#makefile.code">8.2. Code snippets</a></span></dt>
1.25 rillig 425:
426: <dd>
427: <dl>
428: <dt><span class="sect2"><a href=
1.30 wiz 429: "#adding-to-list">8.2.1. Adding things to a
1.25 rillig 430: list</a></span></dt>
431:
432: <dt><span class="sect2"><a href=
1.30 wiz 433: "#converting-internal-to-external">8.2.2.
434: Converting an internal list into an external
435: list</a></span></dt>
1.25 rillig 436:
437: <dt><span class="sect2"><a href=
1.30 wiz 438: "#passing-variable-to-shell">8.2.3. Passing
439: variables to a shell command</a></span></dt>
1.27 rillig 440:
441: <dt><span class="sect2"><a href=
1.30 wiz 442: "#quoting-guideline">8.2.4. Quoting
1.27 rillig 443: guideline</a></span></dt>
444:
445: <dt><span class="sect2"><a href=
1.30 wiz 446: "#bsd-make-bug-workaround">8.2.5. Workaround
447: for a bug in BSD Make</a></span></dt>
1.25 rillig 448: </dl>
449: </dd>
450: </dl>
451: </dd>
452:
453: <dt><span class="chapter"><a href="#plist">9. PLIST
1.1 grant 454: issues</a></span></dt>
455:
456: <dd>
457: <dl>
1.30 wiz 458: <dt><span class="sect1"><a href="#rcs-id">9.1. RCS
459: ID</a></span></dt>
1.1 grant 460:
1.30 wiz 461: <dt><span class="sect1"><a href=
462: "#automatic-plist-generation">9.2. Semi-automatic
463: <code class="filename">PLIST</code>
1.14 xtraeme 464: generation</a></span></dt>
1.1 grant 465:
1.25 rillig 466: <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14 xtraeme 467: Tweaking output of <span><strong class=
468: "command">make
469: print-PLIST</strong></span></a></span></dt>
1.1 grant 470:
1.25 rillig 471: <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1 grant 472: Variable substitution in PLIST</a></span></dt>
473:
1.30 wiz 474: <dt><span class="sect1"><a href=
475: "#manpage-compression">9.5.
1.1 grant 476: Manpage-compression</a></span></dt>
477:
1.30 wiz 478: <dt><span class="sect1"><a href=
479: "#using-PLIST_SRC">9.6. Changing PLIST source with
480: <code class=
1.14 xtraeme 481: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 482:
1.30 wiz 483: <dt><span class="sect1"><a href=
484: "#platform-specific-plist">9.7. Platform specific
485: and differing PLISTs</a></span></dt>
1.1 grant 486:
487: <dt><span class="sect1"><a href=
1.25 rillig 488: "#faq.common-dirs">9.8. Sharing directories between
1.1 grant 489: packages</a></span></dt>
490: </dl>
491: </dd>
492:
1.25 rillig 493: <dt><span class="chapter"><a href="#buildlink">10.
1.1 grant 494: Buildlink methodology</a></span></dt>
495:
496: <dd>
497: <dl>
1.30 wiz 498: <dt><span class="sect1"><a href=
499: "#converting-to-buildlink3">10.1. Converting
500: packages to use buildlink3</a></span></dt>
1.1 grant 501:
1.30 wiz 502: <dt><span class="sect1"><a href=
503: "#creating-buildlink3.mk">10.2. Writing
504: <code class="filename">buildlink3.mk</code>
1.14 xtraeme 505: files</a></span></dt>
1.1 grant 506:
507: <dd>
508: <dl>
509: <dt><span class="sect2"><a href=
1.30 wiz 510: "#anatomy-of-bl3">10.2.1. Anatomy of a
511: buildlink3.mk file</a></span></dt>
1.1 grant 512:
513: <dt><span class="sect2"><a href=
1.30 wiz 514: "#updating-buildlink-depends">10.2.2. Updating
515: <code class=
1.14 xtraeme 516: "varname">BUILDLINK_DEPENDS.<em class=
517: "replaceable"><code>pkg</code></em></code> in
518: <code class="filename">buildlink3.mk</code>
1.1 grant 519: files</a></span></dt>
520: </dl>
521: </dd>
522:
1.30 wiz 523: <dt><span class="sect1"><a href=
524: "#writing-builtin.mk">10.3. Writing <code class=
525: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 526:
527: <dd>
528: <dl>
529: <dt><span class="sect2"><a href=
1.30 wiz 530: "#anatomy-of-builtin.mk">10.3.1. Anatomy of a
531: <code class="filename">builtin.mk</code>
1.1 grant 532: file</a></span></dt>
533:
534: <dt><span class="sect2"><a href=
1.30 wiz 535: "#native-or-pkgsrc-preference">10.3.2. Global
536: preferences for native or pkgsrc
537: software</a></span></dt>
1.1 grant 538: </dl>
539: </dd>
540: </dl>
541: </dd>
542:
1.35 jmmv 543: <dt><span class="chapter"><a href="#pkginstall">11. The
544: pkginstall framework</a></span></dt>
545:
546: <dd>
547: <dl>
548: <dt><span class="sect1"><a href=
549: "#files-and-dirs-outside-prefix">11.1. Files and
550: directories outside the installation
551: prefix</a></span></dt>
552:
553: <dd>
554: <dl>
555: <dt><span class="sect2"><a href=
556: "#dirs-outside-prefix">11.1.1. Directory
557: manipulation</a></span></dt>
558:
559: <dt><span class="sect2"><a href=
560: "#files-outside-prefix">11.1.2. File
561: manipulation</a></span></dt>
562: </dl>
563: </dd>
564:
565: <dt><span class="sect1"><a href="#conf-files">11.2.
566: Configuration files</a></span></dt>
567:
568: <dd>
569: <dl>
570: <dt><span class="sect2"><a href=
571: "#conf-files-sysconfdir">11.2.1. How
572: <code class="varname">PKG_SYSCONFDIR</code> is
573: set</a></span></dt>
574:
575: <dt><span class="sect2"><a href=
576: "#conf-files-configure">11.2.2. Telling the
577: software were configuration files
578: are</a></span></dt>
579:
580: <dt><span class="sect2"><a href=
581: "#conf-files-patching">11.2.3. Patching
582: installations</a></span></dt>
583:
584: <dt><span class="sect2"><a href=
585: "#conf-files-disable">11.2.4. Disabling
586: handling of configuration files</a></span></dt>
587: </dl>
588: </dd>
589:
590: <dt><span class="sect1"><a href=
591: "#rcd-scripts">11.3. System startup
592: scripts</a></span></dt>
593:
594: <dd>
595: <dl>
596: <dt><span class="sect2"><a href=
597: "#rcd-scripts-disable">11.3.1. Disabling
598: handling of system startup
599: scripts</a></span></dt>
600: </dl>
601: </dd>
602:
603: <dt><span class="sect1"><a href=
604: "#users-and-groups">11.4. System users and
605: groups</a></span></dt>
606:
607: <dt><span class="sect1"><a href="#shells">11.5.
608: System shells</a></span></dt>
609:
610: <dd>
611: <dl>
612: <dt><span class="sect2"><a href=
613: "#shells-disable">11.5.1. Disabling handling of
614: configuration files</a></span></dt>
615: </dl>
616: </dd>
617: </dl>
618: </dd>
619:
620: <dt><span class="chapter"><a href="#options">12.
1.1 grant 621: Options handling</a></span></dt>
622:
623: <dd>
624: <dl>
1.30 wiz 625: <dt><span class="sect1"><a href=
1.35 jmmv 626: "#global-default-options">12.1. Global default
1.30 wiz 627: options</a></span></dt>
1.1 grant 628:
1.30 wiz 629: <dt><span class="sect1"><a href=
1.35 jmmv 630: "#converting-to-options">12.2. Converting packages
1.30 wiz 631: to use <code class=
1.14 xtraeme 632: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 633: </dl>
634: </dd>
635:
1.35 jmmv 636: <dt><span class="chapter"><a href="#build">13. The
1.1 grant 637: build process</a></span></dt>
638:
639: <dd>
640: <dl>
641: <dt><span class="sect1"><a href=
1.35 jmmv 642: "#build.prefix">13.1. Program
1.1 grant 643: location</a></span></dt>
644:
1.30 wiz 645: <dt><span class="sect1"><a href=
1.35 jmmv 646: "#main-targets">13.2. Main targets</a></span></dt>
1.1 grant 647:
648: <dt><span class="sect1"><a href=
1.35 jmmv 649: "#build.helpful-targets">13.3. Other helpful
1.1 grant 650: targets</a></span></dt>
651: </dl>
652: </dd>
653:
1.35 jmmv 654: <dt><span class="chapter"><a href="#fixes">14. Notes on
1.1 grant 655: fixes for packages</a></span></dt>
656:
657: <dd>
658: <dl>
1.30 wiz 659: <dt><span class="sect1"><a href=
1.35 jmmv 660: "#general-operation">14.1. General
1.30 wiz 661: operation</a></span></dt>
1.1 grant 662:
663: <dd>
664: <dl>
665: <dt><span class="sect2"><a href=
1.35 jmmv 666: "#pulling-vars-from-etc-mk.conf">14.1.1. How to
1.30 wiz 667: pull in variables from
668: /etc/mk.conf</a></span></dt>
1.1 grant 669:
670: <dt><span class="sect2"><a href=
1.35 jmmv 671: "#where-to-install-documentation">14.1.2. Where
1.31 wiz 672: to install documentation</a></span></dt>
673:
674: <dt><span class="sect2"><a href=
1.35 jmmv 675: "#restricted-packages">14.1.3. Restricted
1.1 grant 676: packages</a></span></dt>
677:
678: <dt><span class="sect2"><a href=
1.35 jmmv 679: "#dependencies">14.1.4. Handling
1.1 grant 680: dependencies</a></span></dt>
681:
682: <dt><span class="sect2"><a href=
1.35 jmmv 683: "#conflicts">14.1.5. Handling conflicts with
1.1 grant 684: other packages</a></span></dt>
685:
686: <dt><span class="sect2"><a href=
1.35 jmmv 687: "#not-building-packages">14.1.6. Packages that
1.30 wiz 688: cannot or should not be built</a></span></dt>
1.1 grant 689:
690: <dt><span class="sect2"><a href=
1.35 jmmv 691: "#undeletable-packages">14.1.7. Packages which
1.30 wiz 692: should not be deleted, once
693: installed</a></span></dt>
1.1 grant 694:
695: <dt><span class="sect2"><a href=
1.35 jmmv 696: "#security-handling">14.1.8. Handling packages
1.1 grant 697: with security problems</a></span></dt>
698:
699: <dt><span class="sect2"><a href=
1.35 jmmv 700: "#compiler-bugs">14.1.9. How to handle compiler
1.1 grant 701: bugs</a></span></dt>
702:
703: <dt><span class="sect2"><a href=
1.35 jmmv 704: "#bumping-pkgrevision">14.1.10. How to handle
1.30 wiz 705: incrementing versions when fixing an existing
1.1 grant 706: package</a></span></dt>
707:
708: <dt><span class="sect2"><a href=
1.35 jmmv 709: "#portability-of-packages">14.1.11. Portability
1.30 wiz 710: of packages</a></span></dt>
1.1 grant 711: </dl>
712: </dd>
713:
1.30 wiz 714: <dt><span class="sect1"><a href=
1.35 jmmv 715: "#downloading-issues">14.2. Possible downloading
1.30 wiz 716: issues</a></span></dt>
1.1 grant 717:
718: <dd>
719: <dl>
720: <dt><span class="sect2"><a href=
1.35 jmmv 721: "#no-plain-download">14.2.1. Packages whose
1.30 wiz 722: distfiles aren't available for plain
1.1 grant 723: downloading</a></span></dt>
724:
725: <dt><span class="sect2"><a href=
1.35 jmmv 726: "#modified-distfiles-same-name">14.2.2. How to
1.30 wiz 727: handle modified distfiles with the 'old'
728: name</a></span></dt>
1.1 grant 729: </dl>
730: </dd>
731:
1.30 wiz 732: <dt><span class="sect1"><a href=
1.35 jmmv 733: "#configuration-gotchas">14.3. Configuration
1.30 wiz 734: gotchas</a></span></dt>
1.1 grant 735:
736: <dd>
737: <dl>
738: <dt><span class="sect2"><a href=
1.35 jmmv 739: "#fixes.libtool">14.3.1. Shared libraries -
1.1 grant 740: libtool</a></span></dt>
741:
742: <dt><span class="sect2"><a href=
1.35 jmmv 743: "#using-libtool">14.3.2. Using libtool on GNU
1.1 grant 744: packages that already support
745: libtool</a></span></dt>
746:
747: <dt><span class="sect2"><a href=
1.35 jmmv 748: "#autoconf-automake">14.3.3. GNU
1.1 grant 749: Autoconf/Automake</a></span></dt>
750: </dl>
751: </dd>
752:
1.30 wiz 753: <dt><span class="sect1"><a href=
1.35 jmmv 754: "#building-considerations">14.4. Building
1.30 wiz 755: considerations</a></span></dt>
1.1 grant 756:
757: <dd>
758: <dl>
759: <dt><span class="sect2"><a href=
1.35 jmmv 760: "#cpp-defines">14.4.1. CPP
1.1 grant 761: defines</a></span></dt>
762: </dl>
763: </dd>
764:
1.30 wiz 765: <dt><span class="sect1"><a href=
1.35 jmmv 766: "#package-specific-actions">14.5. Package specific
1.30 wiz 767: actions</a></span></dt>
1.1 grant 768:
769: <dd>
770: <dl>
771: <dt><span class="sect2"><a href=
1.35 jmmv 772: "#user-interaction">14.5.1. User
1.2 hubertf 773: interaction</a></span></dt>
1.1 grant 774:
775: <dt><span class="sect2"><a href=
1.35 jmmv 776: "#handling-licenses">14.5.2. Handling
1.1 grant 777: licenses</a></span></dt>
778:
779: <dt><span class="sect2"><a href=
1.35 jmmv 780: "#installing-score-files">14.5.3. Installing
1.30 wiz 781: score files</a></span></dt>
1.1 grant 782:
783: <dt><span class="sect2"><a href=
1.35 jmmv 784: "#perl-scripts">14.5.4. Packages containing
1.30 wiz 785: perl scripts</a></span></dt>
1.1 grant 786:
787: <dt><span class="sect2"><a href=
1.35 jmmv 788: "#hardcoded-paths">14.5.5. Packages with
1.30 wiz 789: hardcoded paths to other
790: interpreters</a></span></dt>
1.1 grant 791:
792: <dt><span class="sect2"><a href=
1.35 jmmv 793: "#perl-modules">14.5.6. Packages installing
1.30 wiz 794: perl modules</a></span></dt>
1.1 grant 795:
796: <dt><span class="sect2"><a href=
1.35 jmmv 797: "#faq.info-files">14.5.7. Packages installing
1.1 grant 798: info files</a></span></dt>
799:
800: <dt><span class="sect2"><a href=
1.35 jmmv 801: "#gconf2-data-files">14.5.8. Packages
1.30 wiz 802: installing GConf2 data files</a></span></dt>
1.1 grant 803:
804: <dt><span class="sect2"><a href=
1.35 jmmv 805: "#scrollkeeper-data-files">14.5.9. Packages
1.30 wiz 806: installing scrollkeeper data
807: files</a></span></dt>
1.1 grant 808:
809: <dt><span class="sect2"><a href=
1.35 jmmv 810: "#x11-fonts">14.5.10. Packages installing X11
1.1 grant 811: fonts</a></span></dt>
812:
813: <dt><span class="sect2"><a href=
1.35 jmmv 814: "#gtk2-modules">14.5.11. Packages installing
1.30 wiz 815: GTK2 modules</a></span></dt>
1.1 grant 816:
817: <dt><span class="sect2"><a href=
1.35 jmmv 818: "#sgml-xml-data">14.5.12. Packages installing
1.30 wiz 819: SGML or XML data</a></span></dt>
1.1 grant 820:
821: <dt><span class="sect2"><a href=
1.35 jmmv 822: "#mime-database">14.5.13. Packages installing
1.1 grant 823: extensions to the MIME database</a></span></dt>
824:
825: <dt><span class="sect2"><a href=
1.35 jmmv 826: "#intltool">14.5.14. Packages using
1.1 grant 827: intltool</a></span></dt>
1.18 xtraeme 828:
829: <dt><span class="sect2"><a href=
1.35 jmmv 830: "#startup-scripts">14.5.15. Packages installing
1.18 xtraeme 831: startup scripts</a></span></dt>
1.1 grant 832: </dl>
833: </dd>
834:
1.30 wiz 835: <dt><span class="sect1"><a href=
1.35 jmmv 836: "#feedback-to-author">14.6. Feedback to the
1.30 wiz 837: author</a></span></dt>
1.1 grant 838: </dl>
839: </dd>
840:
1.35 jmmv 841: <dt><span class="chapter"><a href="#debug">15.
1.1 grant 842: Debugging</a></span></dt>
843:
1.35 jmmv 844: <dt><span class="chapter"><a href="#submit">16.
1.1 grant 845: Submitting and Committing</a></span></dt>
846:
847: <dd>
848: <dl>
1.30 wiz 849: <dt><span class="sect1"><a href=
1.35 jmmv 850: "#submitting-your-package">16.1. Submitting your
1.30 wiz 851: packages</a></span></dt>
1.1 grant 852:
1.30 wiz 853: <dt><span class="sect1"><a href=
1.35 jmmv 854: "#committing-importing">16.2. Committing: Importing
1.30 wiz 855: a package into CVS</a></span></dt>
1.1 grant 856:
1.30 wiz 857: <dt><span class="sect1"><a href=
1.35 jmmv 858: "#updating-package">16.3. Updating a package to a
1.30 wiz 859: newer version</a></span></dt>
1.1 grant 860:
1.30 wiz 861: <dt><span class="sect1"><a href=
1.35 jmmv 862: "#moving-package">16.4. Moving a package in
1.30 wiz 863: pkgsrc</a></span></dt>
1.1 grant 864: </dl>
865: </dd>
866: </dl>
867: </dd>
868:
869: <dt><span class="appendix"><a href="#examples">A. A simple
870: example package: bison</a></span></dt>
871:
872: <dd>
873: <dl>
1.30 wiz 874: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 875: files</a></span></dt>
876:
877: <dd>
878: <dl>
1.30 wiz 879: <dt><span class="sect2"><a href=
880: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 881:
1.30 wiz 882: <dt><span class="sect2"><a href=
883: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 884:
1.30 wiz 885: <dt><span class="sect2"><a href=
886: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 887:
1.30 wiz 888: <dt><span class="sect2"><a href=
889: "#checking-package-with-pkglint">A.1.4. Checking a
890: package with <span><strong class=
1.14 xtraeme 891: "command">pkglint</strong></span></a></span></dt>
1.1 grant 892: </dl>
893: </dd>
894:
1.30 wiz 895: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
896: Steps for building, installing,
897: packaging</a></span></dt>
1.1 grant 898: </dl>
899: </dd>
900:
901: <dt><span class="appendix"><a href="#logs">B. Build
902: logs</a></span></dt>
903:
904: <dd>
905: <dl>
906: <dt><span class="sect1"><a href="#logs.building">B.1.
907: Building figlet</a></span></dt>
908:
909: <dt><span class="sect1"><a href="#logs.package">B.2.
910: Packaging figlet</a></span></dt>
911: </dl>
912: </dd>
913:
914: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
915: of the FTP server's package archive</a></span></dt>
1.2 hubertf 916:
917: <dt><span class="appendix"><a href="#editing">D. Editing
918: guidelines for the pkgsrc guide</a></span></dt>
919:
920: <dd>
921: <dl>
1.30 wiz 922: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 923: Targets</a></span></dt>
924:
1.30 wiz 925: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 926: Procedure</a></span></dt>
927: </dl>
928: </dd>
1.1 grant 929: </dl>
930: </div>
931:
932: <div class="chapter" lang="en" xml:lang="en">
933: <div class="titlepage">
934: <div>
935: <div>
936: <h2 class="title"><a name="introduction" id=
937: "introduction"></a>Chapter 1. Introduction</h2>
938: </div>
939: </div>
940: </div>
941:
942: <div class="toc">
943: <p><b>Table of Contents</b></p>
944:
945: <dl>
1.30 wiz 946: <dt><span class="sect1"><a href=
947: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 948:
949: <dt><span class="sect1"><a href="#overview">1.2.
950: Overview</a></span></dt>
951:
952: <dt><span class="sect1"><a href="#terminology">1.3.
953: Terminology</a></span></dt>
954:
955: <dt><span class="sect1"><a href="#typography">1.4.
956: Typography</a></span></dt>
957: </dl>
958: </div>
959:
960: <div class="sect1" lang="en" xml:lang="en">
961: <div class="titlepage">
962: <div>
963: <div>
964: <h2 class="title" style="clear: both"><a name=
1.30 wiz 965: "introduction-section" id=
966: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 967: </div>
968: </div>
969: </div>
970:
971: <p>There is a lot of software freely available for Unix
972: based systems, which usually runs on NetBSD and other
973: Unix-flavoured systems, too, sometimes with some
974: modifications. The NetBSD Packages Collection (pkgsrc)
975: incorporates any such changes necessary to make that
976: software run, and makes the installation (and
977: de-installation) of the software package easy by means of a
978: single command.</p>
979:
980: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 981: the <span><strong class="command">pkg_*</strong></span>
982: tools so that installation and de-installation, printing of
983: an inventory of all installed packages and retrieval of
984: one-line comments or more verbose descriptions are all
985: simple.</p>
1.1 grant 986:
987: <p>pkgsrc currently contains several thousand packages,
988: including:</p>
989:
990: <div class="itemizedlist">
991: <ul type="disc">
992: <li>
993: <p><a xmlns=
994: "http://www.w3.org/TR/xhtml1/transitional" href=
995: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.20 ben 996: class="pkgname">www/apache</a> - The Apache web
997: server</p>
1.1 grant 998: </li>
999:
1000: <li>
1001: <p><a xmlns=
1002: "http://www.w3.org/TR/xhtml1/transitional" href=
1003: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 1004: class="pkgname">www/mozilla</a> - The Mozilla web
1005: browser</p>
1.1 grant 1006: </li>
1007:
1008: <li>
1009: <p><a xmlns=
1010: "http://www.w3.org/TR/xhtml1/transitional" href=
1011: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.20 ben 1012: class="pkgname">meta-pkgs/gnome</a> - The GNOME
1013: Desktop Environment</p>
1.1 grant 1014: </li>
1015:
1016: <li>
1017: <p><a xmlns=
1018: "http://www.w3.org/TR/xhtml1/transitional" href=
1019: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.20 ben 1020: class="pkgname">meta-pkgs/kde3</a> - The K Desktop
1021: Environment</p>
1.1 grant 1022: </li>
1023: </ul>
1024: </div>
1025:
1026: <p>...just to name a few.</p>
1027:
1028: <p>pkgsrc has built-in support for handling varying
1029: dependencies, such as pthreads and X11, and extended
1030: features such as IPv6 support on a range of platforms.</p>
1031:
1032: <p>pkgsrc was derived from FreeBSD's ports system, and
1033: initially developed for NetBSD only. Since then, pkgsrc has
1034: grown a lot, and now supports the following platforms:</p>
1035:
1036: <div class="itemizedlist">
1037: <ul type="disc">
1038: <li>
1039: <p><a href="http://developer.apple.com/darwin/"
1040: target="_top">Darwin</a> (<a href=
1041: "http://www.apple.com/macosx/" target="_top">Mac OS
1042: X</a>)</p>
1043: </li>
1044:
1045: <li>
1.3 hubertf 1046: <p><a href="http://www.DragonFlyBSD.org/" target=
1047: "_top">DragonFlyBSD</a></p>
1048: </li>
1049:
1050: <li>
1.1 grant 1051: <p><a href="http://www.FreeBSD.org/" target=
1052: "_top">FreeBSD</a></p>
1053: </li>
1054:
1055: <li>
1.3 hubertf 1056: <p>Microsoft Windows, via <a href=
1057: "http://www.microsoft.com/windows/sfu/" target=
1058: "_top">Interix</a></p>
1.1 grant 1059: </li>
1060:
1061: <li>
1062: <p><a href="http://www.sgi.com/software/irix6.5/"
1063: target="_top">IRIX</a></p>
1064: </li>
1065:
1066: <li>
1067: <p><a href="http://www.linux.org/" target=
1068: "_top">Linux</a></p>
1069: </li>
1070:
1071: <li>
1072: <p><a href="http://www.NetBSD.org/" target=
1073: "_top">NetBSD</a> (of course)</p>
1074: </li>
1075:
1076: <li>
1.17 sketch 1077: <p><a href="http://h30097.www3.hp.com/" target=
1078: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1079: </li>
1080:
1081: <li>
1.1 grant 1082: <p><a href="http://www.openbsd.org/" target=
1083: "_top">OpenBSD</a></p>
1084: </li>
1085:
1086: <li>
1087: <p><a href="http://www.sun.com/solaris/" target=
1088: "_top">Solaris</a></p>
1089: </li>
1090: </ul>
1091: </div>
1092: </div>
1093:
1094: <div class="sect1" lang="en" xml:lang="en">
1095: <div class="titlepage">
1096: <div>
1097: <div>
1098: <h2 class="title" style="clear: both"><a name=
1099: "overview" id="overview"></a>1.2. Overview</h2>
1100: </div>
1101: </div>
1102: </div>
1103:
1104: <p>This document is divided into two parts. The first,
1105: <a href="#users-guide" title=
1.2 hubertf 1106: "Part I. The pkgsrc user's guide">The pkgsrc
1107: user's guide</a>, describes how one can use one of the
1108: packages in the Package Collection, either by installing a
1109: precompiled binary package, or by building one's own copy
1110: using the NetBSD package system. The second part, <a href=
1.1 grant 1111: "#developers-guide" title=
1.2 hubertf 1112: "Part II. The pkgsrc developer's guide">The
1113: pkgsrc developer's guide</a>, explains how to prepare a
1114: package so it can be easily built by other NetBSD users
1115: without knowing about the package's building details.</p>
1.1 grant 1116:
1117: <p>This document is available in various formats:</p>
1118:
1119: <div class="itemizedlist">
1120: <ul type="disc">
1121: <li>
1122: <p><a href="index.html" target="_top">HTML</a></p>
1123: </li>
1124:
1125: <li>
1126: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1127: </li>
1128:
1129: <li>
1130: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1131: </li>
1132:
1133: <li>
1134: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1135: </li>
1136: </ul>
1137: </div>
1138: </div>
1139:
1140: <div class="sect1" lang="en" xml:lang="en">
1141: <div class="titlepage">
1142: <div>
1143: <div>
1144: <h2 class="title" style="clear: both"><a name=
1145: "terminology" id=
1146: "terminology"></a>1.3. Terminology</h2>
1147: </div>
1148: </div>
1149: </div>
1150:
1151: <p>There has been a lot of talk about “<span class=
1152: "quote">ports</span>”, “<span class=
1153: "quote">packages</span>”, etc. so far. Here is a
1154: description of all the terminology used within this
1155: document.</p>
1156:
1157: <div class="variablelist">
1158: <dl>
1159: <dt><span class="term">Package</span></dt>
1160:
1161: <dd>
1162: <p>A set of files and building instructions that
1163: describe what's necessary to build a certain piece of
1164: software using pkgsrc. Packages are traditionally
1.14 xtraeme 1165: stored under <code class=
1166: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1167: </dd>
1168:
1169: <dt><span class="term">The NetBSD package
1170: system</span></dt>
1171:
1172: <dd>
1173: <p>This is the former name of “<span class=
1174: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1175: NetBSD operating system and can be bootstrapped to
1176: run on non-NetBSD operating systems as well. It
1177: handles building (compiling), installing, and
1178: removing of packages.</p>
1.1 grant 1179: </dd>
1180:
1181: <dt><span class="term">Distfile</span></dt>
1182:
1183: <dd>
1184: <p>This term describes the file or files that are
1185: provided by the author of the piece of software to
1186: distribute his work. All the changes necessary to
1187: build on NetBSD are reflected in the corresponding
1188: package. Usually the distfile is in the form of a
1189: compressed tar-archive, but other types are possible,
1.14 xtraeme 1190: too. Distfiles are usually stored below <code class=
1191: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1192: </dd>
1193:
1194: <dt><span class="term">Port</span></dt>
1195:
1196: <dd>
1197: <p>This is the term used by FreeBSD and OpenBSD
1198: people for what we call a package. In NetBSD
1199: terminology, “<span class=
1200: "quote">port</span>” refers to a different
1201: architecture.</p>
1202: </dd>
1203:
1204: <dt><span class="term">Precompiled/binary
1205: package</span></dt>
1206:
1207: <dd>
1208: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1209: distfile and stuffed together in a single
1210: <code class="filename">.tgz</code> file so it can be
1211: installed on machines of the same machine
1212: architecture without the need to recompile. Packages
1213: are usually generated in <code class=
1214: "filename">/usr/pkgsrc/packages</code>; there is also
1215: an archive on <a href=
1.1 grant 1216: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1217: "_top">ftp.NetBSD.org</a>.</p>
1218:
1219: <p>Sometimes, this is referred to by the term
1220: “<span class="quote">package</span>” too,
1221: especially in the context of precompiled
1222: packages.</p>
1223: </dd>
1224:
1225: <dt><span class="term">Program</span></dt>
1226:
1227: <dd>
1228: <p>The piece of software to be installed which will
1229: be constructed from all the files in the Distfile by
1230: the actions defined in the corresponding package.</p>
1231: </dd>
1232: </dl>
1233: </div>
1234: </div>
1235:
1236: <div class="sect1" lang="en" xml:lang="en">
1237: <div class="titlepage">
1238: <div>
1239: <div>
1240: <h2 class="title" style="clear: both"><a name=
1241: "typography" id=
1242: "typography"></a>1.4. Typography</h2>
1243: </div>
1244: </div>
1245: </div>
1246:
1247: <p>When giving examples for commands, shell prompts are
1248: used to show if the command should/can be issued as root,
1249: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1250: privileges are sufficient. We use a <code class=
1251: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1252: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1253: assuming they use the C-shell or tcsh.</p>
1.1 grant 1254: </div>
1255: </div>
1256:
1257: <div class="part" lang="en" xml:lang="en">
1258: <div class="titlepage">
1259: <div>
1260: <div>
1261: <h1 class="title"><a name="users-guide" id=
1.2 hubertf 1262: "users-guide"></a>The pkgsrc user's guide</h1>
1.1 grant 1263: </div>
1264: </div>
1265: </div>
1266:
1267: <div class="toc">
1268: <p><b>Table of Contents</b></p>
1269:
1270: <dl>
1271: <dt><span class="chapter"><a href="#getting">2. Where to
1272: get pkgsrc</a></span></dt>
1273:
1274: <dd>
1275: <dl>
1.30 wiz 1276: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1277: As tar file</a></span></dt>
1.1 grant 1278:
1.30 wiz 1279: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1280: SUP</a></span></dt>
1281:
1.30 wiz 1282: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1283: CVS</a></span></dt>
1284: </dl>
1285: </dd>
1286:
1287: <dt><span class="chapter"><a href="#platforms">3. Using
1288: pkgsrc on systems other than NetBSD</a></span></dt>
1289:
1290: <dd>
1291: <dl>
1.30 wiz 1292: <dt><span class="sect1"><a href=
1293: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1294: pkgsrc</a></span></dt>
1.1 grant 1295:
1.30 wiz 1296: <dt><span class="sect1"><a href=
1297: "#platform-specific-notes">3.2. Platform specific
1298: notes</a></span></dt>
1.1 grant 1299:
1300: <dd>
1301: <dl>
1.30 wiz 1302: <dt><span class="sect2"><a href="#darwin">3.2.1.
1303: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1304:
1.30 wiz 1305: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1306: FreeBSD</a></span></dt>
1.22 tv 1307:
1.30 wiz 1308: <dt><span class="sect2"><a href="#interix">3.2.3.
1309: Interix</a></span></dt>
1.1 grant 1310:
1.30 wiz 1311: <dt><span class="sect2"><a href="#irix">3.2.4.
1312: IRIX</a></span></dt>
1.1 grant 1313:
1.30 wiz 1314: <dt><span class="sect2"><a href="#linux">3.2.5.
1315: Linux</a></span></dt>
1.1 grant 1316:
1.30 wiz 1317: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1318: OpenBSD</a></span></dt>
1.1 grant 1319:
1.30 wiz 1320: <dt><span class="sect2"><a href="#solaris">3.2.7.
1321: Solaris</a></span></dt>
1.1 grant 1322: </dl>
1323: </dd>
1324: </dl>
1325: </dd>
1326:
1327: <dt><span class="chapter"><a href="#using">4. Using
1328: pkgsrc</a></span></dt>
1329:
1330: <dd>
1331: <dl>
1332: <dt><span class="sect1"><a href=
1333: "#getting-started">4.1. Working with binary
1334: packages</a></span></dt>
1335:
1336: <dd>
1337: <dl>
1338: <dt><span class="sect2"><a href=
1.30 wiz 1339: "#where-to-get-binary-packages">4.1.1. Where to
1340: get binary packages</a></span></dt>
1.1 grant 1341:
1342: <dt><span class="sect2"><a href=
1.30 wiz 1343: "#how-to-use-binary-packages">4.1.2. How to use
1344: binary packages</a></span></dt>
1.1 grant 1345:
1346: <dt><span class="sect2"><a href=
1.30 wiz 1347: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1348: warning</a></span></dt>
1349: </dl>
1350: </dd>
1351:
1.30 wiz 1352: <dt><span class="sect1"><a href=
1353: "#building-packages-from-source">4.2. Building
1354: packages from source</a></span></dt>
1.1 grant 1355:
1356: <dd>
1357: <dl>
1358: <dt><span class="sect2"><a href=
1.30 wiz 1359: "#requirements">4.2.1.
1360: Requirements</a></span></dt>
1.1 grant 1361:
1362: <dt><span class="sect2"><a href=
1.30 wiz 1363: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1364: distfiles</a></span></dt>
1365:
1366: <dt><span class="sect2"><a href=
1.30 wiz 1367: "#how-to-build-and-install">4.2.3. How to build
1368: and install</a></span></dt>
1.1 grant 1369:
1370: <dt><span class="sect2"><a href=
1.30 wiz 1371: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1372: compiler</a></span></dt>
1373: </dl>
1374: </dd>
1375: </dl>
1376: </dd>
1377:
1378: <dt><span class="chapter"><a href="#binary">5. Creating
1379: binary packages</a></span></dt>
1380:
1381: <dd>
1382: <dl>
1.30 wiz 1383: <dt><span class="sect1"><a href=
1384: "#building-a-single-binary-package">5.1. Building a
1385: single binary package</a></span></dt>
1.1 grant 1386:
1.30 wiz 1387: <dt><span class="sect1"><a href=
1388: "#settings-for-creationg-of-binary-packages">5.2.
1.1 grant 1389: Settings for creation of binary
1390: packages</a></span></dt>
1391:
1392: <dt><span class="sect1"><a href="#bulkbuild">5.3.
1393: Doing a bulk build of all packages</a></span></dt>
1394:
1395: <dd>
1396: <dl>
1397: <dt><span class="sect2"><a href=
1398: "#binary.configuration">5.3.1.
1399: Configuration</a></span></dt>
1400:
1401: <dt><span class="sect2"><a href=
1.30 wiz 1402: "#other-environmental-considerations">5.3.2.
1403: Other environmental
1.1 grant 1404: considerations</a></span></dt>
1405:
1406: <dt><span class="sect2"><a href=
1.30 wiz 1407: "#operation">5.3.3. Operation</a></span></dt>
1.1 grant 1408:
1409: <dt><span class="sect2"><a href=
1.30 wiz 1410: "#what-it-does">5.3.4. What it
1411: does</a></span></dt>
1.1 grant 1412:
1413: <dt><span class="sect2"><a href=
1.30 wiz 1414: "#disk-space-requirements">5.3.5. Disk space
1.1 grant 1415: requirements</a></span></dt>
1416:
1417: <dt><span class="sect2"><a href=
1.30 wiz 1418: "#setting-up-a-sandbox">5.3.6. Setting up a
1419: sandbox for chroot'ed builds</a></span></dt>
1.1 grant 1420:
1421: <dt><span class="sect2"><a href=
1.30 wiz 1422: "#building-a-partial-set">5.3.7. Building a
1423: partial set of packages</a></span></dt>
1.13 hubertf 1424:
1425: <dt><span class="sect2"><a href=
1426: "#bulk-upload">5.3.8. Uploading results of a bulk
1427: build</a></span></dt>
1.1 grant 1428: </dl>
1429: </dd>
1430:
1.30 wiz 1431: <dt><span class="sect1"><a href=
1432: "#creating-cdroms">5.4. Creating a multiple CD-ROM
1433: packages collection</a></span></dt>
1.1 grant 1434:
1435: <dd>
1436: <dl>
1437: <dt><span class="sect2"><a href=
1.30 wiz 1438: "#cdpack-example">5.4.1. Example of
1.1 grant 1439: cdpack</a></span></dt>
1440: </dl>
1441: </dd>
1442: </dl>
1443: </dd>
1444:
1445: <dt><span class="chapter"><a href="#faq">6. Frequently
1446: Asked Questions</a></span></dt>
1447:
1448: <dd>
1449: <dl>
1.30 wiz 1450: <dt><span class="sect1"><a href=
1451: "#mailing-list-pointers">6.1. Are there any mailing
1452: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1453:
1.30 wiz 1454: <dt><span class="sect1"><a href="#pkgviews-docs">6.2.
1.1 grant 1455: Where's the pkgviews documentation?</a></span></dt>
1456:
1.5 hubertf 1457: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 1458: Utilities for package management
1459: (pkgtools)</a></span></dt>
1460:
1.30 wiz 1461: <dt><span class="sect1"><a href=
1462: "#non-root-pkgsrc">6.4. How to use pkgsrc as
1463: non-root</a></span></dt>
1.1 grant 1464:
1.30 wiz 1465: <dt><span class="sect1"><a href=
1466: "#resume-transfers">6.5. How to resume transfers when
1467: fetching distfiles?</a></span></dt>
1.14 xtraeme 1468:
1.30 wiz 1469: <dt><span class="sect1"><a href=
1470: "#XFree86-from-pkgsrc">6.6. How can I install/use
1471: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1472:
1.30 wiz 1473: <dt><span class="sect1"><a href=
1474: "#x.org-from-pkgsrc">6.7. How can I install/use X.org
1475: from pkgsrc?</a></span></dt>
1.1 grant 1476:
1.30 wiz 1477: <dt><span class="sect1"><a href=
1478: "#fetch-behind-firewall">6.8. How to fetch files from
1479: behind a firewall</a></span></dt>
1.1 grant 1480:
1.30 wiz 1481: <dt><span class="sect1"><a href="#passive-ftp">6.9.
1482: How do I tell <span><strong class="command">make
1.14 xtraeme 1483: fetch</strong></span> to do passive
1.1 grant 1484: FTP?</a></span></dt>
1485:
1.30 wiz 1486: <dt><span class="sect1"><a href=
1487: "#fetching-all-distfiles">6.10. How to fetch all
1488: distfiles at once</a></span></dt>
1.1 grant 1489:
1.30 wiz 1490: <dt><span class="sect1"><a href=
1491: "#tmac.andoc-missing">6.11. What does
1492: “<span class="quote">Don't know how to make
1493: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1494: mean?</a></span></dt>
1.13 hubertf 1495:
1.30 wiz 1496: <dt><span class="sect1"><a href=
1497: "#bsd.own.mk-missing">6.12. What does
1498: “<span class="quote">Could not find
1.14 xtraeme 1499: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1500:
1.30 wiz 1501: <dt><span class="sect1"><a href=
1502: "#using-sudo-with-pkgsrc">6.13. Using 'sudo' with
1503: pkgsrc</a></span></dt>
1.1 grant 1504:
1.35 jmmv 1505: <dt><span class="sect1"><a href="#faq.conf">6.14. How
1506: do I change the location of configuration
1507: files?</a></span></dt>
1.1 grant 1508:
1509: <dt><span class="sect1"><a href=
1.14 xtraeme 1510: "#audit-packages">6.15. Automated security
1.1 grant 1511: checks</a></span></dt>
1512: </dl>
1513: </dd>
1514: </dl>
1515: </div>
1516:
1517: <div class="chapter" lang="en" xml:lang="en">
1518: <div class="titlepage">
1519: <div>
1520: <div>
1521: <h2 class="title"><a name="getting" id=
1522: "getting"></a>Chapter 2. Where to get
1523: pkgsrc</h2>
1524: </div>
1525: </div>
1526: </div>
1527:
1528: <div class="toc">
1529: <p><b>Table of Contents</b></p>
1530:
1531: <dl>
1.30 wiz 1532: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1533: tar file</a></span></dt>
1534:
1.30 wiz 1535: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1536: SUP</a></span></dt>
1537:
1.30 wiz 1538: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1539: CVS</a></span></dt>
1540: </dl>
1541: </div>
1542:
1543: <p>There are three ways to get pkgsrc. Either as a tar
1544: file, via SUP, or via CVS. All three ways are described
1545: here.</p>
1546:
1547: <div class="sect1" lang="en" xml:lang="en">
1548: <div class="titlepage">
1549: <div>
1550: <div>
1551: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1552: "as-tar-file" id="as-tar-file"></a>2.1. As tar
1.1 grant 1553: file</h2>
1554: </div>
1555: </div>
1556: </div>
1557:
1558: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1559: file from <a href=
1.11 ben 1560: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1561: target="_top">ftp.NetBSD.org</a> and unpack it into
1562: <code class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1563: </div>
1564:
1565: <div class="sect1" lang="en" xml:lang="en">
1566: <div class="titlepage">
1567: <div>
1568: <div>
1569: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1570: "via-sup" id="via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1571: </div>
1572: </div>
1573: </div>
1574:
1575: <p>As an alternative to the tar file, you can get pkgsrc
1576: via the Software Update Protocol, SUP. To do so, make
1577: sure your supfile has a line</p>
1578: <pre class="programlisting">
1579: release=pkgsrc
1580: </pre>
1581:
1.14 xtraeme 1582: <p>in it, see the examples in <code class=
1583: "filename">/usr/share/examples/supfiles</code>, and that
1584: the <code class="filename">/usr/pkgsrc</code> directory
1585: exists. Then, simply run <span><strong class=
1586: "command">sup -v <em class=
1587: "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1588: </div>
1589:
1590: <div class="sect1" lang="en" xml:lang="en">
1591: <div class="titlepage">
1592: <div>
1593: <div>
1594: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1595: "via-cvs" id="via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1596: </div>
1597: </div>
1598: </div>
1599:
1600: <p>To get pkgsrc via CVS, make sure you have
1601: “<span class="quote">cvs</span>” installed.
1.27 rillig 1602: To do an initial (full) checkout of pkgsrc, do the
1603: following steps:</p>
1.1 grant 1604: <pre class="screen">
1.14 xtraeme 1605: <code class="prompt">%</code> <strong class=
1606: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1607: <code class="prompt">%</code> <strong class=
1608: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1609: <code class="prompt">%</code> <strong class=
1610: "userinput"><code>cd /usr</code></strong>
1611: <code class="prompt">%</code> <strong class=
1612: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1613: </pre>
1614:
1615: <p>This will create the <code class=
1616: "filename">pkgsrc</code> directory in your <code class=
1617: "filename">/usr</code>, and all the package source will
1618: be stored under <code class=
1619: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1620: initial checkout, make sure you have <code class=
1621: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1622: <pre class="screen">
1.14 xtraeme 1623: <code class="prompt">%</code> <strong class=
1624: "userinput"><code>cd /usr/pkgsrc</code></strong>
1625: <code class="prompt">%</code> <strong class=
1626: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1627: </pre>
1628:
1629: <p>Please also note that it is possible to have multiple
1630: copies of the pkgsrc hierarchy in use at any one time -
1631: all work is done relatively within the pkgsrc tree.</p>
1632: </div>
1633: </div>
1634:
1635: <div class="chapter" lang="en" xml:lang="en">
1636: <div class="titlepage">
1637: <div>
1638: <div>
1639: <h2 class="title"><a name="platforms" id=
1640: "platforms"></a>Chapter 3. Using pkgsrc on
1641: systems other than NetBSD</h2>
1642: </div>
1643: </div>
1644: </div>
1645:
1646: <div class="toc">
1647: <p><b>Table of Contents</b></p>
1648:
1649: <dl>
1.30 wiz 1650: <dt><span class="sect1"><a href=
1651: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1652: pkgsrc</a></span></dt>
1.1 grant 1653:
1.30 wiz 1654: <dt><span class="sect1"><a href=
1655: "#platform-specific-notes">3.2. Platform specific
1656: notes</a></span></dt>
1.1 grant 1657:
1658: <dd>
1659: <dl>
1.30 wiz 1660: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1661: Darwin (Mac OS X)</a></span></dt>
1662:
1.30 wiz 1663: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1664: FreeBSD</a></span></dt>
1665:
1.30 wiz 1666: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1667: Interix</a></span></dt>
1668:
1.30 wiz 1669: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1670: IRIX</a></span></dt>
1671:
1.30 wiz 1672: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1673: Linux</a></span></dt>
1674:
1.30 wiz 1675: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1676: OpenBSD</a></span></dt>
1677:
1.30 wiz 1678: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1679: Solaris</a></span></dt>
1680: </dl>
1681: </dd>
1682: </dl>
1683: </div>
1684:
1685: <div class="sect1" lang="en" xml:lang="en">
1686: <div class="titlepage">
1687: <div>
1688: <div>
1689: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1690: "bootstrapping-pkgsrc" id=
1691: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
1692: pkgsrc</h2>
1.1 grant 1693: </div>
1694: </div>
1695: </div>
1696:
1.27 rillig 1697: <p>For operating systems other than NetBSD, we provide a
1.1 grant 1698: bootstrap kit to build the required tools to use pkgsrc
1699: on your platform. Besides support for native NetBSD,
1700: pkgsrc and the bootstrap kit have support for the
1701: following operating systems:</p>
1702:
1703: <div class="itemizedlist">
1704: <ul type="disc">
1705: <li>
1706: <p>Darwin (Mac OS X)</p>
1707: </li>
1708:
1709: <li>
1.16 grant 1710: <p>DragonFlyBSD</p>
1711: </li>
1712:
1713: <li>
1.1 grant 1714: <p>FreeBSD</p>
1715: </li>
1716:
1717: <li>
1718: <p>Interix (Windows 2000, XP, 2003)</p>
1719: </li>
1720:
1721: <li>
1722: <p>IRIX</p>
1723: </li>
1724:
1725: <li>
1726: <p>Linux</p>
1727: </li>
1728:
1729: <li>
1730: <p>OpenBSD</p>
1731: </li>
1732:
1733: <li>
1734: <p>Solaris</p>
1735: </li>
1.16 grant 1736:
1737: <li>
1738: <p>Tru64 (Digital UNIX/OSF1)</p>
1739: </li>
1.1 grant 1740: </ul>
1741: </div>
1742:
1743: <p>Support for other platforms is under development.</p>
1744:
1745: <p>Installing the bootstrap kit should be as simple
1746: as:</p>
1747: <pre class="screen">
1.14 xtraeme 1748: <code class="prompt">#</code> <strong class=
1749: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1750: <code class="prompt">#</code> <strong class=
1751: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1752: <code class="prompt">#</code> <strong class=
1753: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1754: </pre>
1755:
1756: <p>See <a href="#getting" title=
1757: "Chapter 2. Where to get pkgsrc">Chapter 2,
1758: <i>Where to get pkgsrc</i></a> for other ways to get
1.14 xtraeme 1759: pkgsrc before bootstrapping. The given
1760: <span><strong class="command">bootstrap</strong></span>
1761: command will use the defaults of <code class=
1762: "filename">/usr/pkg</code> for the <span class=
1763: "emphasis"><em>prefix</em></span> where programs will be
1764: installed in, and <code class=
1765: "filename">/var/db/pkg</code> for the package database
1.27 rillig 1766: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 1767: However, these can also be set using command-line
1.27 rillig 1768: arguments.</p>
1.1 grant 1769:
1770: <p>Binary packages for the pkgsrc tools and an initial
1771: set of packages is available for supported platforms. An
1772: up-to-date list of these can be found on <a href=
1773: "http://www.pkgsrc.org/" target=
1774: "_top">www.pkgsrc.org</a>.</p>
1775: </div>
1776:
1777: <div class="sect1" lang="en" xml:lang="en">
1778: <div class="titlepage">
1779: <div>
1780: <div>
1781: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1782: "platform-specific-notes" id=
1783: "platform-specific-notes"></a>3.2. Platform
1.1 grant 1784: specific notes</h2>
1785: </div>
1786: </div>
1787: </div>
1788:
1789: <p>Here are some platform-specific notes you should be
1790: aware of.</p>
1791:
1792: <div class="sect2" lang="en" xml:lang="en">
1793: <div class="titlepage">
1794: <div>
1795: <div>
1.30 wiz 1796: <h3 class="title"><a name="darwin" id=
1797: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 1798: </div>
1799: </div>
1800: </div>
1801:
1802: <p>Darwin 5.x and 6.x are supported. There are two
1803: methods of using pkgsrc on Mac OS X, by using a
1804: <a href="#platform.osx-image" title=
1805: "3.2.1.1. Using a disk image">disk image</a>, or a
1806: <a href="#platform.osx-ufs" title=
1807: "3.2.1.2. Using a UFS partition">UFS
1808: partition</a>.</p>
1809:
1810: <p>Before you start, you will need to download and
1811: install the Mac OS X Developer Tools from Apple's
1812: Developer Connection. See <a href=
1813: "http://developer.apple.com/macosx/" target=
1814: "_top">http://developer.apple.com/macosx/</a> for
1815: details. Also, make sure you install X11 for Mac OS X
1816: and the X11 SDK from <a href=
1817: "http://www.apple.com/macosx/x11/download/" target=
1818: "_top">http://www.apple.com/macosx/x11/download/</a> if
1819: you intend to build packages that use the X11 Window
1820: System.</p>
1821:
1822: <p>If you already have a UFS partition, or have a spare
1823: partition that you can format as UFS, it is recommended
1824: to use that instead of the disk image. It'll be
1825: somewhat faster and will mount automatically at boot
1826: time, where you must manually mount a disk image.</p>
1827:
1828: <div class="note" style=
1829: "margin-left: 0.5in; margin-right: 0.5in;">
1830: <h3 class="title">Note</h3>
1831:
1832: <p>You cannot use a HFS+ file system for pkgsrc,
1833: because pkgsrc currently requires the filesystem to
1834: be case-sensitive, and HFS+ is not.</p>
1835: </div>
1836:
1837: <div class="sect3" lang="en" xml:lang="en">
1838: <div class="titlepage">
1839: <div>
1840: <div>
1841: <h4 class="title"><a name="platform.osx-image"
1842: id="platform.osx-image"></a>3.2.1.1. Using
1843: a disk image</h4>
1844: </div>
1845: </div>
1846: </div>
1847:
1848: <p>Create the disk image:</p>
1849: <pre class="screen">
1.14 xtraeme 1850: <code class="prompt">#</code> <strong class=
1851: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1852: <code class="prompt">#</code> <strong class=
1853: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
1854: <code class="prompt">#</code> <strong class=
1855: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
1856: <code class="prompt">#</code> <strong class=
1857: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 1858: </pre>
1859:
1860: <p>That's it!</p>
1861: </div>
1862:
1863: <div class="sect3" lang="en" xml:lang="en">
1864: <div class="titlepage">
1865: <div>
1866: <div>
1867: <h4 class="title"><a name="platform.osx-ufs"
1868: id="platform.osx-ufs"></a>3.2.1.2. Using a
1869: UFS partition</h4>
1870: </div>
1871: </div>
1872: </div>
1873:
1.14 xtraeme 1874: <p>By default, <code class="filename">/usr</code>
1875: will be on your root file system, normally HFS+. It
1876: is possible to use the default <span class=
1877: "emphasis"><em>prefix</em></span> of <code class=
1878: "filename">/usr/pkg</code> by symlinking <code class=
1879: "filename">/usr/pkg</code> to a directory on a UFS
1880: file system. Obviously, another symlink is required
1881: if you want to place the package database directory
1882: outside the <span class=
1883: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 1884: <pre class="screen">
1.14 xtraeme 1885: <code class="prompt">#</code> <strong class=
1.22 tv 1886: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1 grant 1887: </pre>
1888:
1889: <p>If you created your partitions at the time of
1890: installing Mac OS X and formatted the target
1891: partition as UFS, it should automatically mount on
1.14 xtraeme 1892: <code class="filename">/Volumes/<volume
1893: name></code> when the machine boots. If you are
1.1 grant 1894: (re)formatting a partition as UFS, you need to ensure
1895: that the partition map correctly reflects
1896: “<span class="quote">Apple_UFS</span>”
1897: and not “<span class=
1898: "quote">Apple_HFS</span>”.</p>
1899:
1900: <p>The problem is that none of the disk tools will
1901: let you touch a disk that is booted from. You can
1902: unmount the partition, but even if you newfs it, the
1903: partition type will be incorrect and the automounter
1904: won't mount it. It can be mounted manually, but it
1905: won't appear in Finder.</p>
1906:
1907: <p>You'll need to boot off of the OS X Installation
1908: (User) CD. When the Installation program starts, go
1909: up to the menu and select Disk Utility. Now, you will
1910: be able to select the partition you want to be UFS,
1911: and Format it Apple UFS. Quit the Disk Utility, quit
1912: the installer which will reboot your machine. The new
1913: UFS file system will appear in Finder.</p>
1914:
1915: <p>Be aware that the permissions on the new file
1916: system will be writable by root only.</p>
1917:
1918: <p>This note is as of 10.2 (Jaguar) and applies to
1919: earlier versions. Hopefully Apple will fix Disk
1920: Utility in 10.3 (Panther).</p>
1921: </div>
1922: </div>
1923:
1924: <div class="sect2" lang="en" xml:lang="en">
1925: <div class="titlepage">
1926: <div>
1927: <div>
1.30 wiz 1928: <h3 class="title"><a name="freebsd" id=
1929: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 1930: </div>
1931: </div>
1932: </div>
1933:
1934: <p>FreeBSD 4.7 and 5.0 have been tested and are
1935: supported, other versions may work.</p>
1936:
1937: <p>Care should be taken so that the tools that this kit
1938: installs do not conflict with the FreeBSD userland
1939: tools. There are several steps:</p>
1940:
1941: <div class="orderedlist">
1942: <ol type="1">
1943: <li>
1944: <p>FreeBSD stores its ports pkg database in
1.14 xtraeme 1945: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 1946: therefore recommended that you choose a different
1.14 xtraeme 1947: location (e.g. <code class=
1948: "filename">/usr/pkgdb</code>) by using the
1.1 grant 1949: --pkgdbdir option to the bootstrap script.</p>
1950: </li>
1951:
1952: <li>
1953: <p>If you do not intend to use the FreeBSD ports
1954: tools, it's probably a good idea to move them out
1955: of the way to avoid confusion, e.g.</p>
1956: <pre class="screen">
1.14 xtraeme 1957: <code class="prompt">#</code> <strong class=
1958: "userinput"><code>cd /usr/sbin</code></strong>
1959: <code class="prompt">#</code> <strong class=
1960: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
1961: <code class="prompt">#</code> <strong class=
1962: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
1963: <code class="prompt">#</code> <strong class=
1964: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
1965: <code class="prompt">#</code> <strong class=
1966: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 1967: </pre>
1968: </li>
1969:
1970: <li>
1.14 xtraeme 1971: <p>An example <code class=
1972: "filename">/etc/mk.conf</code> file will be
1973: placed in <code class=
1974: "filename">/etc/mk.conf.example</code> file when
1975: you use the bootstrap script.</p>
1.1 grant 1976: </li>
1977: </ol>
1978: </div>
1979: </div>
1980:
1981: <div class="sect2" lang="en" xml:lang="en">
1982: <div class="titlepage">
1983: <div>
1984: <div>
1.30 wiz 1985: <h3 class="title"><a name="interix" id=
1986: "interix"></a>3.2.3. Interix</h3>
1.1 grant 1987: </div>
1988: </div>
1989: </div>
1990:
1991: <p>Interix is a POSIX compatible subsystem for the
1992: Windows NT kernel, providing a Unix-like environment
1993: with a tighter kernel integration than available with
1994: Cygwin. It is part of the Windows Services for Unix
1995: package, available for free for any licensed copy of
1.22 tv 1996: Windows 2000, XP (not including XP Home), or 2003. SFU
1997: can be downloaded from <a href=
1998: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 1999: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2000:
2001: <p>Services for Unix 3.5, current as of this writing,
2002: has been tested. 3.0 or 3.1 may work, but are not
2003: officially supported. (The main difference in 3.0/3.1
2004: is lack of pthreads.)</p>
2005:
2006: <div class="sect3" lang="en" xml:lang="en">
2007: <div class="titlepage">
2008: <div>
2009: <div>
2010: <h4 class="title"><a name=
2011: "platform.interix-sfu-install" id=
2012: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2013: installing Interix/SFU</h4>
1.1 grant 2014: </div>
2015: </div>
2016: </div>
2017:
2018: <p>At an absolute minimum, the following packages
2019: must be installed from the Windows Services for Unix
2020: 3.5 distribution in order to use pkgsrc:</p>
2021:
2022: <div class="itemizedlist">
2023: <ul type="disc">
2024: <li>
2025: <p>Utilities -> Base Utilities</p>
2026: </li>
2027:
2028: <li>
2029: <p>Interix GNU Components -> (all)</p>
2030: </li>
2031:
2032: <li>
2033: <p>Remote Connectivity</p>
2034: </li>
2035:
2036: <li>
2037: <p>Interix SDK</p>
2038: </li>
2039: </ul>
2040: </div>
2041:
2042: <p>When using pkgsrc on Interix, DO NOT install the
2043: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2044: without shared module support, installed to
2045: /usr/local, and will only cause confusion. Instead,
2046: install Perl 5.8 from pkgsrc (or from a binary
2047: package).</p>
2048:
2049: <p>The Remote Connectivity subcomponent "Windows
2050: Remote Shell Service" does not need to be installed,
2051: but Remote Connectivity itself should be installed in
2052: order to have a working inetd.</p>
2053:
2054: <p>Finally, during installation you may be asked
2055: whether to enable setuid behavior for Interix
2056: programs, and whether to make pathnames default to
2057: case-sensitive. Setuid should be enabled, and
2058: case-sensitivity MUST be enabled. (Without
2059: case-sensitivity, a large number of packages
2060: including perl will not build.)</p>
2061: </div>
2062:
2063: <div class="sect3" lang="en" xml:lang="en">
2064: <div class="titlepage">
2065: <div>
2066: <div>
2067: <h4 class="title"><a name=
2068: "platform.interix-sfu-postinstall" id=
2069: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2070: to do if Interix/SFU is already installed</h4>
2071: </div>
2072: </div>
2073: </div>
2074:
2075: <p>If SFU is already installed and you wish to alter
2076: these settings to work with pkgsrc, note the
2077: following things.</p>
2078:
2079: <div class="itemizedlist">
2080: <ul type="disc">
2081: <li>
2082: <p>To uninstall UNIX Perl, use Add/Remove
2083: Programs, select Microsoft Windows Services for
2084: UNIX, then click Change. In the installer,
2085: choose Add or Remove, then uncheck
2086: Utilities->UNIX Perl.</p>
2087: </li>
2088:
2089: <li>
2090: <p>To enable case-sensitivity for the
2091: filesystem, run REGEDIT.EXE, and change the
2092: following registry key:</p>
2093:
2094: <p>
2095: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2096: Manager\kernel</p>
2097:
2098: <p>Set the DWORD value "obcaseinsensitive" to
2099: 0; then reboot.</p>
2100: </li>
2101:
2102: <li>
2103: <p>To enable setuid binaries (optional), run
2104: REGEDIT.EXE, and change the following registry
2105: key:</p>
2106:
2107: <p>
2108: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2109: for UNIX</p>
2110:
2111: <p>Set the DWORD value "EnableSetuidBinaries"
2112: to 1; then reboot.</p>
2113: </li>
2114: </ul>
2115: </div>
2116: </div>
2117:
2118: <div class="sect3" lang="en" xml:lang="en">
2119: <div class="titlepage">
2120: <div>
2121: <div>
2122: <h4 class="title"><a name=
2123: "platform.interix-notes" id=
2124: "platform.interix-notes"></a>3.2.3.3. Important
2125: notes for using pkgsrc</h4>
2126: </div>
2127: </div>
2128: </div>
2129:
2130: <p>The package imanager (either the pkgsrc "su" user,
2131: or the user running "pkg_add") must be a member of
2132: the local Administrators group. Such a user must also
2133: be used to run the bootstrap. This is slightly
2134: relaxed from the normal pkgsrc requirement of
2135: "root".</p>
2136:
2137: <p>The package manager should use a umask of 002.
2138: "make install" will automatically complain if this is
2139: not the case. This ensures that directories written
2140: in /var/db/pkg are Administrators-group
2141: writeable.</p>
2142:
2143: <p>The popular Interix binary packages from
2144: http://www.interopsystems.com/ use an older version
2145: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2146: used in conjunction with pkgsrc. If you choose to use
2147: them at the same time as the pkgsrc packages, ensure
2148: that you use the proper pkg_* tools for each type of
2149: binary package.</p>
1.22 tv 2150:
2151: <p>The TERM setting used for DOS-type console windows
2152: (including those invoked by the csh and ksh startup
2153: shortcuts) is "interix". Most systems don't have a
2154: termcap/terminfo entry for it, but the following
2155: .termcap entry provides adequate emulation in most
2156: cases:</p>
2157: <pre class="programlisting">
2158: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
2159: </pre>
1.1 grant 2160: </div>
2161: </div>
2162:
2163: <div class="sect2" lang="en" xml:lang="en">
2164: <div class="titlepage">
2165: <div>
2166: <div>
1.30 wiz 2167: <h3 class="title"><a name="irix" id=
2168: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2169: </div>
2170: </div>
2171: </div>
2172:
2173: <p>You will need a working C compiler, either gcc or
2174: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2175: the <code class="varname">CC</code> environment
2176: variable according to your preference. If you do not
2177: have a license for the MIPSpro compiler suite, you can
1.1 grant 2178: download a gcc tardist file from <a href=
2179: "http://freeware.sgi.com/" target=
2180: "_top">http://freeware.sgi.com/</a>.</p>
2181:
2182: <p>Please note that you will need IRIX 6.5.17 or
2183: higher, as this is the earliest version of IRIX
1.24 wiz 2184: providing support for <a href=
2185: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2186: <span class="citerefentry"><span class=
2187: "refentrytitle">if_indextoname</span>(3)</span></a>,
2188: <a href=
2189: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2190: <span class="citerefentry"><span class=
2191: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2192: etc.</p>
1.1 grant 2193:
1.27 rillig 2194: <p>At this point in time, pkgsrc only supports one ABI
2195: at a time. That is, you can not switch between the old
2196: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2197: you start out using "abi=n32", that's what all your
2198: packages will be built with.</p>
1.1 grant 2199:
2200: <p>Therefore, please make sure that you have no
1.14 xtraeme 2201: conflicting <code class="varname">CFLAGS</code> in your
2202: environment or the <code class=
2203: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2204: that you do not try to link n32 object files with lib64
1.14 xtraeme 2205: or vice versa. Check your <code class=
2206: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2207:
2208: <p>If you have the actual pkgsrc tree mounted via NFS
2209: from a different host, please make sure to set
1.14 xtraeme 2210: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2211: directory, as it appears that IRIX linker occasionally
2212: runs into issues when trying to link over a network
2213: mounted filesystem.</p>
2214:
2215: <p>The bootstrapping process should set all the right
2216: options for programs such as imake(1), but you may want
2217: to set some options depending on your local setup.
1.14 xtraeme 2218: Please see <code class=
2219: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2220: course, your compiler's man pages for details.</p>
1.22 tv 2221:
2222: <p>If you are using SGI's MIPSPro compiler, please
2223: set</p>
2224: <pre class="programlisting">
2225: PKGSRC_COMPILER=mipspro
2226: </pre>
2227:
2228: <p>in <code class="filename">/etc/mk.conf</code>.
2229: Otherwise, pkgsrc will assume you are using gcc and may
2230: end up passing invalid flags to the compiler. Note that
2231: bootstrap should create an appropriate <code class=
2232: "filename">mk.conf.example</code> by default.</p>
2233:
2234: <p>If you have both the MIPSPro compiler chain
2235: installed as well as gcc, but want to make sure that
2236: MIPRPro is used, please set your <code class=
2237: "varname">PATH</code> to <span class=
2238: "emphasis"><em>not</em></span> include the location of
2239: gcc (often <code class=
2240: "filename">/usr/freeware/bin</code>), and (important)
2241: pass the '--preserve-path' flag.</p>
1.1 grant 2242: </div>
2243:
2244: <div class="sect2" lang="en" xml:lang="en">
2245: <div class="titlepage">
2246: <div>
2247: <div>
1.30 wiz 2248: <h3 class="title"><a name="linux" id=
2249: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2250: </div>
2251: </div>
2252: </div>
2253:
2254: <p>Some versions of Linux (for example Debian
2255: GNU/Linux) need either libtermcap or libcurses
2256: (libncurses). Installing the distributions
2257: libncurses-dev package (or equivalent) should fix the
2258: problem.</p>
2259:
2260: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2261: and icc (Intel C++ Compiler). gcc is the default. icc
2262: 8.0 and 8.1 on i386 have been tested.</p>
2263:
2264: <p>To bootstrap using icc, assuming the default icc
2265: installation directory:</p>
2266: <pre class="programlisting">
2267: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2268: ac_cv___attribute__=yes ./bootstrap
2269: </pre>
2270:
2271: <div class="note" style=
2272: "margin-left: 0.5in; margin-right: 0.5in;">
2273: <h3 class="title">Note</h3>
2274:
2275: <p>icc 8.1 needs the `-i-static' argument instead of
2276: -static-libcxa.</p>
2277: </div>
2278:
2279: <p>icc supports __attribute__, but the GNU configure
2280: test uses a nested function, which icc does not
2281: support. #undef'ing __attribute__ has the unfortunate
2282: side-effect of breaking many of the Linux header files,
2283: which cannot be compiled properly without
2284: __attribute__. The test must be overridden so that
2285: __attribute__ is assumed supported by the compiler.</p>
2286:
2287: <p>After bootstrapping, you should set <code class=
2288: "varname">PKGSRC_COMPILER</code> in <code class=
2289: "filename">/etc/mk.conf</code>:</p>
2290: <pre class="programlisting">
2291: PKGSRC_COMPILER=icc
2292: </pre>
2293:
2294: <p>The default installation directory for icc is
2295: <code class="filename">/opt/intel_cc_80</code>, which
2296: is also the pkgsrc default. If you have installed it
2297: into a different directory, set <code class=
2298: "varname">ICCBASE</code> in <code class=
2299: "filename">/etc/mk.conf</code>:</p>
2300: <pre class="programlisting">
2301: ICCBASE=/opt/icc
2302: </pre>
2303:
2304: <p>pkgsrc uses the static linking method of the runtime
2305: libraries provided by icc, so binaries can be run on
2306: other systems which do not have the shared libraries
2307: installed.</p>
2308:
2309: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2310: the <a href=
2311: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2312: <span class="citerefentry"><span class=
2313: "refentrytitle">ld</span>(1)</span></a> command run
2314: when linking a C++ shared library and records it,
2315: throwing away the -Bstatic and -Bdynamic options
2316: interspersed between the libraries. This means that
2317: libtool-linked C++ shared libraries will have a runtime
2318: dependency on the icc libraries until this is fixed in
2319: libtool.</p>
1.22 tv 2320: </div>
2321:
2322: <div class="sect2" lang="en" xml:lang="en">
2323: <div class="titlepage">
2324: <div>
2325: <div>
1.30 wiz 2326: <h3 class="title"><a name="openbsd" id=
2327: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2328: </div>
2329: </div>
2330: </div>
2331:
2332: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2333:
2334: <p>Care should be taken so that the tools that this kit
2335: installs do not conflict with the OpenBSD userland
2336: tools. There are several steps:</p>
2337:
2338: <div class="orderedlist">
2339: <ol type="1">
2340: <li>
2341: <p>OpenBSD stores its ports pkg database in
1.14 xtraeme 2342: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 2343: therefore recommended that you choose a different
1.14 xtraeme 2344: location (e.g. <code class=
2345: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2346: --pkgdbdir option to the bootstrap script.</p>
2347: </li>
2348:
2349: <li>
2350: <p>If you do not intend to use the OpenBSD ports
2351: tools, it's probably a good idea to move them out
2352: of the way to avoid confusion, e.g.</p>
2353: <pre class="screen">
1.14 xtraeme 2354: <code class="prompt">#</code> <strong class=
2355: "userinput"><code>cd /usr/sbin</code></strong>
2356: <code class="prompt">#</code> <strong class=
2357: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2358: <code class="prompt">#</code> <strong class=
2359: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2360: <code class="prompt">#</code> <strong class=
2361: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2362: <code class="prompt">#</code> <strong class=
2363: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2364: </pre>
2365: </li>
2366:
2367: <li>
1.14 xtraeme 2368: <p>An example <code class=
2369: "filename">/etc/mk.conf</code> file will be
2370: placed in <code class=
2371: "filename">/etc/mk.conf.example</code> file when
2372: you use the bootstrap script. OpenBSD's make
2373: program uses <code class=
2374: "filename">/etc/mk.conf</code> as well. You can
1.1 grant 2375: work around this by enclosing all the pkgsrc
2376: specific parts of the file with:</p>
2377: <pre class="programlisting">
2378: .ifdef BSD_PKG_MK
1.11 ben 2379: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1 grant 2380: .else
2381: # OpenBSD stuff
2382: .endif
2383: </pre>
2384: </li>
2385: </ol>
2386: </div>
2387: </div>
2388:
2389: <div class="sect2" lang="en" xml:lang="en">
2390: <div class="titlepage">
2391: <div>
2392: <div>
1.30 wiz 2393: <h3 class="title"><a name="solaris" id=
2394: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2395: </div>
2396: </div>
2397: </div>
2398:
2399: <p>Solaris 2.6 through 9 are supported on both x86 and
2400: sparc. You will need a working C compiler. Both gcc
2401: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2402:
2403: <p>The following packages are required on Solaris 8 for
2404: the bootstrap process and to build packages.</p>
2405:
2406: <div class="itemizedlist">
2407: <ul type="disc">
2408: <li>
2409: <p>SUNWsprot</p>
2410: </li>
2411:
2412: <li>
2413: <p>SUNWarc</p>
2414: </li>
2415:
2416: <li>
2417: <p>SUNWbtool</p>
2418: </li>
2419:
2420: <li>
2421: <p>SUNWtoo</p>
2422: </li>
2423:
2424: <li>
2425: <p>SUNWlibm</p>
2426: </li>
2427: </ul>
2428: </div>
2429:
2430: <p>Please note the use of GNU binutils on Solaris is
2431: <span class="emphasis"><em>not</em></span>
2432: supported.</p>
2433:
2434: <div class="sect3" lang="en" xml:lang="en">
2435: <div class="titlepage">
2436: <div>
2437: <div>
1.30 wiz 2438: <h4 class="title"><a name="solaris-gcc-note"
2439: id="solaris-gcc-note"></a>3.2.7.1. If you
2440: are using gcc</h4>
1.1 grant 2441: </div>
2442: </div>
2443: </div>
2444:
2445: <p>It makes life much simpler if you only use the
2446: same gcc consistently for building all packages.</p>
2447:
2448: <p>It is recommended that an external gcc be used
2449: only for bootstrapping, then either build gcc from
2450: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2451: href=
2452: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.20 ben 2453: class="pkgname">lang/gcc</a> or install a binary gcc
2454: package, then remove gcc used during
2455: bootstrapping.</p>
1.1 grant 2456:
2457: <p>Binary packages of gcc can be found through
2458: <a href=
2459: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2460: target=
2461: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2462: </div>
2463:
2464: <div class="sect3" lang="en" xml:lang="en">
2465: <div class="titlepage">
2466: <div>
2467: <div>
1.30 wiz 2468: <h4 class="title"><a name=
2469: "solaris-sun-workshop-note" id=
2470: "solaris-sun-workshop-note"></a>3.2.7.2. If
2471: you are using Sun WorkShop</h4>
1.1 grant 2472: </div>
2473: </div>
2474: </div>
2475:
2476: <p>You will need at least the following packages
2477: installed (from WorkShop 5.0)</p>
2478:
2479: <div class="itemizedlist">
2480: <ul type="disc">
2481: <li>
2482: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2483: </li>
2484:
2485: <li>
2486: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2487: </li>
2488:
2489: <li>
2490: <p>SPROild - Sun WorkShop Incremental
2491: Linker</p>
2492: </li>
2493:
2494: <li>
2495: <p>SPROlang - Sun WorkShop Compilers common
2496: components</p>
2497: </li>
2498: </ul>
2499: </div>
2500:
1.14 xtraeme 2501: <p>You should set <code class="varname">CC</code>,
2502: <code class="varname">CXX</code> and optionally,
2503: <code class="varname">CPP</code> in <code class=
2504: "filename">/etc/mk.conf</code>, eg.</p>
1.1 grant 2505: <pre class="programlisting">
1.27 rillig 2506: CC= cc
1.1 grant 2507: CXX= CC
2508: CPP= /usr/ccs/lib/cpp
2509: </pre>
2510:
2511: <p>You may also want to build 64-bit binaries,
2512: eg.</p>
2513: <pre class="programlisting">
2514: CFLAGS= -xtarget=ultra -xarch=v9
2515: </pre>
2516:
2517: <p>Whichever compiler you use, please ensure the
2518: compiler tools and your $prefix are in your
1.14 xtraeme 2519: <code class="varname">PATH</code>. This includes
2520: <code class="filename">/usr/ccs/{bin,lib}</code> and
2521: eg. <code class=
2522: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2523: </div>
2524: </div>
2525: </div>
2526: </div>
2527:
2528: <div class="chapter" lang="en" xml:lang="en">
2529: <div class="titlepage">
2530: <div>
2531: <div>
2532: <h2 class="title"><a name="using" id=
2533: "using"></a>Chapter 4. Using pkgsrc</h2>
2534: </div>
2535: </div>
2536: </div>
2537:
2538: <div class="toc">
2539: <p><b>Table of Contents</b></p>
2540:
2541: <dl>
2542: <dt><span class="sect1"><a href="#getting-started">4.1.
2543: Working with binary packages</a></span></dt>
2544:
2545: <dd>
2546: <dl>
1.30 wiz 2547: <dt><span class="sect2"><a href=
2548: "#where-to-get-binary-packages">4.1.1. Where to get
2549: binary packages</a></span></dt>
1.1 grant 2550:
1.30 wiz 2551: <dt><span class="sect2"><a href=
2552: "#how-to-use-binary-packages">4.1.2. How to use
2553: binary packages</a></span></dt>
1.1 grant 2554:
1.30 wiz 2555: <dt><span class="sect2"><a href=
2556: "#a-word-of-warning">4.1.3. A word of
2557: warning</a></span></dt>
1.1 grant 2558: </dl>
2559: </dd>
2560:
1.30 wiz 2561: <dt><span class="sect1"><a href=
2562: "#building-packages-from-source">4.2. Building packages
2563: from source</a></span></dt>
1.1 grant 2564:
2565: <dd>
2566: <dl>
1.30 wiz 2567: <dt><span class="sect2"><a href=
2568: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 2569:
1.30 wiz 2570: <dt><span class="sect2"><a href=
2571: "#fetching-distfiles">4.2.2. Fetching
2572: distfiles</a></span></dt>
1.1 grant 2573:
1.30 wiz 2574: <dt><span class="sect2"><a href=
2575: "#how-to-build-and-install">4.2.3. How to build and
2576: install</a></span></dt>
1.1 grant 2577:
1.30 wiz 2578: <dt><span class="sect2"><a href=
2579: "#selecting-the-compiler">4.2.4. Selecting the
2580: compiler</a></span></dt>
1.1 grant 2581: </dl>
2582: </dd>
2583: </dl>
2584: </div>
2585:
2586: <div class="sect1" lang="en" xml:lang="en">
2587: <div class="titlepage">
2588: <div>
2589: <div>
2590: <h2 class="title" style="clear: both"><a name=
2591: "getting-started" id=
2592: "getting-started"></a>4.1. Working with binary
2593: packages</h2>
2594: </div>
2595: </div>
2596: </div>
2597:
2598: <p>This section describes how to find, retrieve and
2599: install a precompiled binary package that someone else
2600: already prepared for your type of machine.</p>
2601:
2602: <div class="sect2" lang="en" xml:lang="en">
2603: <div class="titlepage">
2604: <div>
2605: <div>
1.30 wiz 2606: <h3 class="title"><a name=
2607: "where-to-get-binary-packages" id=
2608: "where-to-get-binary-packages"></a>4.1.1. Where
2609: to get binary packages</h3>
1.1 grant 2610: </div>
2611: </div>
2612: </div>
2613:
2614: <p>Precompiled packages are stored on ftp.NetBSD.org
1.14 xtraeme 2615: and its mirrors in the directory <code class=
1.27 rillig 2616: "filename">/pub/NetBSD/packages/<OSVERSION>/<ARCH>/</code>
2617: for anonymous FTP access. <code class=
2618: "varname">OSVERSION</code> is the NetBSD version
2619: (<span><strong class="command">uname
2620: -r</strong></span>), <code class="varname">ARCH</code>
2621: is the architecture (<span><strong class=
2622: "command">uname -p</strong></span>). In that directory,
2623: there is a subdirectory for each category plus a
2624: subdirectory <code class="filename">All</code> which
2625: includes the actual binaries in <code class=
2626: "filename">.tgz</code> files. The category
2627: subdirectories use symbolic links to those files (this
2628: is the same directory layout as in <code class=
1.14 xtraeme 2629: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2630:
2631: <p>This same directory layout applies for CDROM
2632: distributions, only that the directory may be rooted
1.14 xtraeme 2633: somewhere else, probably somewhere below <code class=
2634: "filename">/cdrom</code>. Please consult your CDROMs
1.1 grant 2635: documentation for the exact location.</p>
2636: </div>
2637:
2638: <div class="sect2" lang="en" xml:lang="en">
2639: <div class="titlepage">
2640: <div>
2641: <div>
1.30 wiz 2642: <h3 class="title"><a name=
2643: "how-to-use-binary-packages" id=
2644: "how-to-use-binary-packages"></a>4.1.2. How
2645: to use binary packages</h3>
1.1 grant 2646: </div>
2647: </div>
2648: </div>
2649:
2650: <p>If you have the files on a CDROM or downloaded them
1.23 wiz 2651: to your hard disk, you can install them with the
1.27 rillig 2652: following command (be sure to <span><strong class=
1.14 xtraeme 2653: "command">su</strong></span> to root first):</p>
1.1 grant 2654: <pre class="screen">
1.14 xtraeme 2655: <code class="prompt">#</code> <strong class=
2656: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 2657: </pre>
2658:
2659: <p>If you have FTP access and you don't want to
2660: download the packages via FTP prior to installation,
1.14 xtraeme 2661: you can do this automatically by giving
2662: <span><strong class="command">pkg_add</strong></span>
2663: an FTP URL:</p>
1.1 grant 2664: <pre class="screen">
1.14 xtraeme 2665: <code class="prompt">#</code> <strong class=
1.27 rillig 2666: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 2667: </pre>
2668:
1.27 rillig 2669: <p>Note that any prerequisite packages needed to run
2670: the package in question will be installed, too,
1.1 grant 2671: assuming they are present where you install from.</p>
2672:
1.23 wiz 2673: <p>To save some typing, you can set the <code class=
2674: "varname">PKG_PATH</code> environment variable to a
2675: semicolon separated list of paths (including remote
2676: URLs); trailing slashes are not allowed.</p>
2677:
2678: <p>Additionally to the <code class=
2679: "filename">All</code> directory there exists a
2680: <code class="filename">vulnerable</code> directory to
2681: which binary packages with known vulnerabilities are
2682: moved, since removing them could cause missing
2683: dependencies. To use these packages, add the
2684: <code class="filename">vulnerable</code> directory to
2685: your <code class="varname">PKG_PATH</code>. However,
2686: you should run <a xmlns=
2687: "http://www.w3.org/TR/xhtml1/transitional" href=
2688: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
2689: class="pkgname">security/audit-packages</a> regularly,
2690: and especially after installing new packages, and
2691: verify that the vulnerabilities are acceptable for your
2692: configuration. An example <code class=
2693: "varname">PKG_PATH</code> would be: <code class=
1.27 rillig 2694: "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 2695: Please note that semicolon (';') is a shell
2696: meta-character, so you'll probably have to quote
2697: it.</p>
2698:
1.1 grant 2699: <p>After you've installed packages, be sure to have
1.27 rillig 2700: <code class="filename">/usr/pkg/bin</code> and
2701: <code class="filename">/usr/pkg/sbin</code> in your
1.14 xtraeme 2702: <code class="varname">PATH</code> so you can actually
2703: start the just installed program.</p>
1.1 grant 2704: </div>
2705:
2706: <div class="sect2" lang="en" xml:lang="en">
2707: <div class="titlepage">
2708: <div>
2709: <div>
1.30 wiz 2710: <h3 class="title"><a name="a-word-of-warning" id=
2711: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 2712: warning</h3>
2713: </div>
2714: </div>
2715: </div>
2716:
2717: <p>Please pay very careful attention to the warnings
2718: expressed in the <a href=
2719: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2720: <span class="citerefentry"><span class=
2721: "refentrytitle">pkg_add</span>(1)</span></a> manual
2722: page about the inherent dangers of installing binary
2723: packages which you did not create yourself, and the
2724: security holes that can be introduced onto your system
2725: by indiscriminate adding of such files.</p>
2726: </div>
2727: </div>
2728:
2729: <div class="sect1" lang="en" xml:lang="en">
2730: <div class="titlepage">
2731: <div>
2732: <div>
2733: <h2 class="title" style="clear: both"><a name=
1.30 wiz 2734: "building-packages-from-source" id=
2735: "building-packages-from-source"></a>4.2. Building
1.1 grant 2736: packages from source</h2>
2737: </div>
2738: </div>
2739: </div>
2740:
2741: <p>This assumes that the package is already in pkgsrc. If
2742: it is not, see <a href="#developers-guide" title=
1.2 hubertf 2743: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 2744: “The pkgsrc developer's guide”</a> for
2745: instructions how to create your own packages.</p>
1.1 grant 2746:
2747: <div class="sect2" lang="en" xml:lang="en">
2748: <div class="titlepage">
2749: <div>
2750: <div>
1.30 wiz 2751: <h3 class="title"><a name="requirements" id=
2752: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 2753: </div>
2754: </div>
2755: </div>
2756:
2757: <p>To build packages from source on a NetBSD system the
2758: “<span class="quote">comp</span>” and the
2759: “<span class="quote">text</span>”
2760: distribution sets must be installed. If you want to
2761: build X11 related packages the “<span class=
2762: "quote">xbase</span>” and “<span class=
2763: "quote">xcomp</span>” distribution sets are
2764: required, too.</p>
2765: </div>
2766:
2767: <div class="sect2" lang="en" xml:lang="en">
2768: <div class="titlepage">
2769: <div>
2770: <div>
1.30 wiz 2771: <h3 class="title"><a name="fetching-distfiles"
2772: id="fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 2773: distfiles</h3>
2774: </div>
2775: </div>
2776: </div>
2777:
1.27 rillig 2778: <p>The first step for building a package is downloading
2779: the distfiles (i.e. the unmodified source). If they
2780: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 2781: automatically.</p>
2782:
2783: <p>You can overwrite some of the major distribution
2784: sites to fit to sites that are close to your own. Have
1.14 xtraeme 2785: a look at <code class=
2786: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 2787: some examples — in particular, look for the
1.14 xtraeme 2788: <code class="varname">MASTER_SORT</code>, <code class=
2789: "varname">MASTER_SORT_REGEX</code> and <code class=
2790: "varname">INET_COUNTRY</code> definitions. This may
2791: save some of your bandwidth and time.</p>
1.1 grant 2792:
2793: <p>You can change these settings either in your shell's
2794: environment, or, if you want to keep the settings, by
1.14 xtraeme 2795: editing the <code class="filename">/etc/mk.conf</code>
1.1 grant 2796: file, and adding the definitions there.</p>
2797:
2798: <p>If you don't have a permanent Internet connection
2799: and you want to know which files to download,
1.14 xtraeme 2800: <span><strong class="command">make
2801: fetch-list</strong></span> will tell you what you'll
2802: need. Put these distfiles into <code class=
2803: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 2804: </div>
2805:
2806: <div class="sect2" lang="en" xml:lang="en">
2807: <div class="titlepage">
2808: <div>
2809: <div>
1.30 wiz 2810: <h3 class="title"><a name=
2811: "how-to-build-and-install" id=
2812: "how-to-build-and-install"></a>4.2.3. How to
2813: build and install</h3>
1.1 grant 2814: </div>
2815: </div>
2816: </div>
2817:
2818: <p>Assuming that the distfile has been fetched (see
2819: previous section), become root and change into the
1.14 xtraeme 2820: relevant directory and running <span><strong class=
2821: "command">make</strong></span>. For example, type</p>
1.1 grant 2822: <pre class="screen">
1.14 xtraeme 2823: <code class="prompt">%</code> <strong class=
2824: "userinput"><code>cd misc/figlet</code></strong>
2825: <code class="prompt">%</code> <strong class=
2826: "userinput"><code>make</code></strong>
1.1 grant 2827: </pre>
2828:
2829: <p>at the shell prompt to build the various components
2830: of the package, and</p>
2831: <pre class="screen">
1.14 xtraeme 2832: <code class="prompt">#</code> <strong class=
2833: "userinput"><code>make install</code></strong>
1.1 grant 2834: </pre>
2835:
2836: <p>to install the various components into the correct
2837: places on your system. Installing the package on your
2838: system requires you to be root. However, pkgsrc has a
2839: <span class="emphasis"><em>just-in-time-su</em></span>
2840: feature, which allows you to only become root for the
2841: actual installation step</p>
2842:
2843: <p>Taking the figlet utility as an example, we can
2844: install it on our system by building as shown in
2845: <a href="#logs" title=
2846: "Appendix B. Build logs">Appendix B, <i>Build
2847: logs</i></a>.</p>
2848:
2849: <p>The program is installed under the default root of
1.14 xtraeme 2850: the packages tree - <code class=
2851: "filename">/usr/pkg</code>. Should this not conform to
2852: your tastes, set the <code class=
2853: "varname">LOCALBASE</code> variable in your
1.1 grant 2854: environment, and it will use that value as the root of
1.14 xtraeme 2855: your packages tree. So, to use <code class=
2856: "filename">/usr/local</code>, set <code class=
2857: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 2858: environment. Please note that you should use a
2859: directory which is dedicated to packages and not shared
1.14 xtraeme 2860: with other programs (ie, do not try and use
2861: <code class="varname">LOCALBASE=/usr</code>). Also, you
2862: should not try to add any of your own files or
2863: directories (such as <code class=
2864: "filename">src/</code>, <code class=
2865: "filename">obj/</code>, or <code class=
2866: "filename">pkgsrc/</code>) below the <code class=
2867: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 2868: possible conflicts between programs and other files
2869: installed by the package system and whatever else may
2870: have been installed there.</p>
2871:
1.14 xtraeme 2872: <p>Some packages look in <code class=
2873: "filename">/etc/mk.conf</code> to alter some
1.1 grant 2874: configuration options at build time. Have a look at
1.14 xtraeme 2875: <code class=
2876: "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
2877: overview of what will be set there by default.
2878: Environment variables such as <code class=
2879: "varname">LOCALBASE</code> can be set in <code class=
2880: "filename">/etc/mk.conf</code> to save having to
2881: remember to set them each time you want to use
2882: pkgsrc.</p>
1.1 grant 2883:
2884: <p>Occasionally, people want to “<span class=
2885: "quote">look under the covers</span>” to see what
2886: is going on when a package is building or being
2887: installed. This may be for debugging purposes, or out
2888: of simple curiosity. A number of utility values have
2889: been added to help with this.</p>
2890:
2891: <div class="orderedlist">
2892: <ol type="1">
2893: <li>
2894: <p>If you invoke the <a href=
2895: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2896: <span class="citerefentry"><span class=
2897: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 2898: with <code class=
2899: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
2900: amount of information will be displayed. For
2901: example,</p>
1.1 grant 2902: <pre class="screen">
1.14 xtraeme 2903: <strong class=
2904: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 2905: </pre>
2906:
2907: <p>will show all the commands that are invoked,
2908: up to and including the “<span class=
2909: "quote">patch</span>” stage.</p>
2910: </li>
2911:
2912: <li>
2913: <p>If you want to know the value of a certain
1.22 tv 2914: <a href=
2915: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2916: <span class="citerefentry"><span class=
2917: "refentrytitle">make</span>(1)</span></a>
2918: definition, then the <code class=
1.14 xtraeme 2919: "varname">VARNAME</code> definition should be
2920: used, in conjunction with the show-var target.
2921: e.g. to show the expansion of the <a href=
1.1 grant 2922: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2923: <span class="citerefentry"><span class=
2924: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 2925: variable <code class=
1.22 tv 2926: "varname">LOCALBASE</code>:</p>
1.1 grant 2927: <pre class="screen">
1.14 xtraeme 2928: <code class="prompt">%</code> <strong class=
2929: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 2930: /usr/pkg
1.14 xtraeme 2931: <code class="prompt">%</code>
1.1 grant 2932:
2933: </pre>
2934: </li>
2935: </ol>
2936: </div>
2937:
2938: <p>If you want to install a binary package that you've
2939: either created yourself (see next section), that you
2940: put into pkgsrc/packages manually or that is located on
1.8 wiz 2941: a remote FTP server, you can use the "bin-install"
1.1 grant 2942: target. This target will install a binary package - if
2943: available - via <a href=
2944: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2945: <span class="citerefentry"><span class=
2946: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 2947: <span><strong class="command">make
2948: package</strong></span>. The list of remote FTP sites
2949: searched is kept in the variable <code class=
2950: "varname">BINPKG_SITES</code>, which defaults to
2951: ftp.NetBSD.org. Any flags that should be added to
2952: <a href=
1.1 grant 2953: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2954: <span class="citerefentry"><span class=
2955: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 2956: into <code class="varname">BIN_INSTALL_FLAGS</code>.
2957: See <code class=
2958: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
2959: details.</p>
1.1 grant 2960:
2961: <p>A final word of warning: If you setup a system that
1.14 xtraeme 2962: has a non-standard setting for <code class=
2963: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 2964: any packages are installed, as you can not use several
2965: directories for the same purpose. Doing so will result
2966: in pkgsrc not being able to properly detect your
2967: installed packages, and fail miserably. Note also that
2968: precompiled binary packages are usually built with the
1.14 xtraeme 2969: default <code class="varname">LOCALBASE</code> of
2970: <code class="filename">/usr/pkg</code>, and that you
2971: should <span class="emphasis"><em>not</em></span>
2972: install any if you use a non-standard <code class=
2973: "varname">LOCALBASE</code>.</p>
1.1 grant 2974: </div>
2975:
2976: <div class="sect2" lang="en" xml:lang="en">
2977: <div class="titlepage">
2978: <div>
2979: <div>
1.30 wiz 2980: <h3 class="title"><a name=
2981: "selecting-the-compiler" id=
2982: "selecting-the-compiler"></a>4.2.4. Selecting
2983: the compiler</h3>
1.1 grant 2984: </div>
2985: </div>
2986: </div>
2987:
2988: <p>By default, pkgsrc will use GCC to build packages.
2989: This may be overridden by setting the following
2990: variables in /etc/mk.conf:</p>
2991:
2992: <div class="variablelist">
2993: <dl>
1.14 xtraeme 2994: <dt><span class="term"><code class=
2995: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 2996:
2997: <dd>
2998: <p>This is a list of values specifying the chain
2999: of compilers to invoke when building packages.
3000: Valid values are:</p>
3001:
3002: <div class="itemizedlist">
3003: <ul type="disc">
3004: <li>
1.14 xtraeme 3005: <p><code class="varname">distcc</code>:
1.1 grant 3006: distributed C/C++ (chainable)</p>
3007: </li>
3008:
3009: <li>
1.14 xtraeme 3010: <p><code class="varname">ccache</code>:
1.1 grant 3011: compiler cache (chainable)</p>
3012: </li>
3013:
3014: <li>
1.14 xtraeme 3015: <p><code class="varname">gcc</code>: GNU
3016: C/C++ Compiler</p>
1.1 grant 3017: </li>
3018:
3019: <li>
1.14 xtraeme 3020: <p><code class="varname">mipspro</code>:
1.1 grant 3021: Silicon Graphics, Inc. MIPSpro
3022: (n32/n64)</p>
3023: </li>
3024:
3025: <li>
1.14 xtraeme 3026: <p><code class="varname">mipspro</code>:
1.1 grant 3027: Silicon Graphics, Inc. MIPSpro (o32)</p>
3028: </li>
3029:
3030: <li>
1.14 xtraeme 3031: <p><code class="varname">sunpro</code>:
1.1 grant 3032: Microsystems, Inc. WorkShip/Forte/Sun ONE
3033: Studio</p>
3034: </li>
3035: </ul>
3036: </div>
3037:
3038: <p>The default is “<span class=
1.14 xtraeme 3039: "quote"><code class=
3040: "varname">gcc</code></span>”. You can use
3041: <code class="varname">ccache</code> and/or
3042: <code class="varname">distcc</code> with an
3043: appropriate <code class=
3044: "varname">PKGSRC_COMPILER</code> setting, e.g.
3045: “<span class="quote"><code class=
3046: "varname">ccache gcc</code></span>”. This
1.1 grant 3047: variable should always be terminated with a value
3048: for a real compiler.</p>
3049: </dd>
3050:
1.14 xtraeme 3051: <dt><span class="term"><code class=
3052: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3053:
3054: <dd>
3055: <p>This specifies the minimum version of GCC to
3056: use when building packages. If the system GCC
3057: doesn't satisfy this requirement, then pkgsrc
3058: will build and install one of the GCC packages to
3059: use instead.</p>
3060: </dd>
3061: </dl>
3062: </div>
3063: </div>
3064: </div>
3065: </div>
3066:
3067: <div class="chapter" lang="en" xml:lang="en">
3068: <div class="titlepage">
3069: <div>
3070: <div>
3071: <h2 class="title"><a name="binary" id=
3072: "binary"></a>Chapter 5. Creating binary
3073: packages</h2>
3074: </div>
3075: </div>
3076: </div>
3077:
3078: <div class="toc">
3079: <p><b>Table of Contents</b></p>
3080:
3081: <dl>
1.30 wiz 3082: <dt><span class="sect1"><a href=
3083: "#building-a-single-binary-package">5.1. Building a
3084: single binary package</a></span></dt>
1.1 grant 3085:
1.30 wiz 3086: <dt><span class="sect1"><a href=
3087: "#settings-for-creationg-of-binary-packages">5.2.
1.1 grant 3088: Settings for creation of binary
3089: packages</a></span></dt>
3090:
3091: <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
3092: a bulk build of all packages</a></span></dt>
3093:
3094: <dd>
3095: <dl>
3096: <dt><span class="sect2"><a href=
3097: "#binary.configuration">5.3.1.
3098: Configuration</a></span></dt>
3099:
1.30 wiz 3100: <dt><span class="sect2"><a href=
3101: "#other-environmental-considerations">5.3.2. Other
3102: environmental considerations</a></span></dt>
1.1 grant 3103:
1.30 wiz 3104: <dt><span class="sect2"><a href="#operation">5.3.3.
1.1 grant 3105: Operation</a></span></dt>
3106:
1.30 wiz 3107: <dt><span class="sect2"><a href=
3108: "#what-it-does">5.3.4. What it does</a></span></dt>
1.1 grant 3109:
1.30 wiz 3110: <dt><span class="sect2"><a href=
3111: "#disk-space-requirements">5.3.5. Disk space
3112: requirements</a></span></dt>
1.1 grant 3113:
1.30 wiz 3114: <dt><span class="sect2"><a href=
3115: "#setting-up-a-sandbox">5.3.6. Setting up a sandbox
3116: for chroot'ed builds</a></span></dt>
1.1 grant 3117:
1.30 wiz 3118: <dt><span class="sect2"><a href=
3119: "#building-a-partial-set">5.3.7. Building a partial
3120: set of packages</a></span></dt>
1.13 hubertf 3121:
3122: <dt><span class="sect2"><a href=
3123: "#bulk-upload">5.3.8. Uploading results of a bulk
3124: build</a></span></dt>
1.1 grant 3125: </dl>
3126: </dd>
3127:
1.30 wiz 3128: <dt><span class="sect1"><a href="#creating-cdroms">5.4.
1.1 grant 3129: Creating a multiple CD-ROM packages
3130: collection</a></span></dt>
3131:
3132: <dd>
3133: <dl>
1.30 wiz 3134: <dt><span class="sect2"><a href=
3135: "#cdpack-example">5.4.1. Example of
3136: cdpack</a></span></dt>
1.1 grant 3137: </dl>
3138: </dd>
3139: </dl>
3140: </div>
3141:
3142: <div class="sect1" lang="en" xml:lang="en">
3143: <div class="titlepage">
3144: <div>
3145: <div>
3146: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3147: "building-a-single-binary-package" id=
3148: "building-a-single-binary-package"></a>5.1. Building
3149: a single binary package</h2>
1.1 grant 3150: </div>
3151: </div>
3152: </div>
3153:
3154: <p>Once you have built and installed a package, you can
3155: create a <span class="emphasis"><em>binary
3156: package</em></span> which can be installed on another
3157: system with <a href=
3158: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3159: <span class="citerefentry"><span class=
3160: "refentrytitle">pkg_add</span>(1)</span></a> This saves
3161: having to build the same package on a group of hosts and
3162: wasting CPU time. It also provides a simple means for
3163: others to install your package, should you distribute
3164: it.</p>
3165:
3166: <p>To create a binary package, change into the
1.14 xtraeme 3167: appropriate directory in pkgsrc, and run
3168: <span><strong class="command">make
3169: package</strong></span>:</p>
1.1 grant 3170: <pre class="screen">
1.14 xtraeme 3171: <code class="prompt">#</code> <strong class=
3172: "userinput"><code>cd misc/figlet</code></strong>
3173: <code class="prompt">#</code> <strong class=
3174: "userinput"><code>make package</code></strong>
1.1 grant 3175: </pre>
3176:
3177: <p>This will build and install your package (if not
3178: already done), and then build a binary package from what
1.14 xtraeme 3179: was installed. You can then use the <span><strong class=
3180: "command">pkg_*</strong></span> tools to manipulate it.
3181: Binary packages are created by default in <code class=
3182: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 3183: gzipped tar file. See <a href="#logs.package" title=
3184: "B.2. Packaging figlet">Section B.2,
3185: “Packaging figlet”</a> for a continuation of
3186: the above <a xmlns=
3187: "http://www.w3.org/TR/xhtml1/transitional" href=
3188: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.20 ben 3189: class="pkgname">misc/figlet</a> example.</p>
1.1 grant 3190:
3191: <p>See <a href="#submit" title=
1.35 jmmv 3192: "Chapter 16. Submitting and Committing">Chapter
3193: 16, <i>Submitting and Committing</i></a> for information
1.1 grant 3194: on how to submit such a binary package.</p>
3195: </div>
3196:
3197: <div class="sect1" lang="en" xml:lang="en">
3198: <div class="titlepage">
3199: <div>
3200: <div>
3201: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3202: "settings-for-creationg-of-binary-packages" id=
3203: "settings-for-creationg-of-binary-packages"></a>5.2. Settings
1.1 grant 3204: for creation of binary packages</h2>
3205: </div>
3206: </div>
3207: </div>
3208:
3209: <p>See <a href="#build.helpful-targets" title=
1.35 jmmv 3210: "13.3. Other helpful targets">Section 13.3,
1.1 grant 3211: “Other helpful targets”</a>.</p>
3212: </div>
3213:
3214: <div class="sect1" lang="en" xml:lang="en">
3215: <div class="titlepage">
3216: <div>
3217: <div>
3218: <h2 class="title" style="clear: both"><a name=
3219: "bulkbuild" id="bulkbuild"></a>5.3. Doing a
3220: bulk build of all packages</h2>
3221: </div>
3222: </div>
3223: </div>
3224:
3225: <p>If you want to get a full set of precompiled binary
3226: packages, this section describes how to get them. Beware
3227: that the bulk build will remove all currently installed
1.23 wiz 3228: packages from your system! Having an FTP server
3229: configured either on the machine doing the bulk builds or
3230: on a nearby NFS server can help to make the packages
3231: available to everyone. See <a href=
1.1 grant 3232: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
3233: <span class="citerefentry"><span class=
3234: "refentrytitle">ftpd</span>(8)</span></a> for more
3235: information. If you use a remote NFS server's storage, be
3236: sure to not actually compile on NFS storage, as this
3237: slows things down a lot.</p>
3238:
3239: <div class="sect2" lang="en" xml:lang="en">
3240: <div class="titlepage">
3241: <div>
3242: <div>
3243: <h3 class="title"><a name="binary.configuration"
3244: id=
3245: "binary.configuration"></a>5.3.1. Configuration</h3>
3246: </div>
3247: </div>
3248: </div>
3249:
3250: <div class="sect3" lang="en" xml:lang="en">
3251: <div class="titlepage">
3252: <div>
3253: <div>
3254: <h4 class="title"><a name="binary.mk.conf" id=
3255: "binary.mk.conf"></a>5.3.1.1. /etc/mk.conf</h4>
3256: </div>
3257: </div>
3258: </div>
3259:
1.23 wiz 3260: <p>You may want to set variables in <code class=
1.14 xtraeme 3261: "filename">/etc/mk.conf</code>. Look at <code class=
3262: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 3263: details of the default settings. You will want to
1.14 xtraeme 3264: ensure that <code class=
3265: "varname">ACCEPTABLE_LICENSES</code> meet your local
3266: policy. As used in this example, <code class=
3267: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 3268: "emphasis"><em>all</em></span> licenses.</p>
3269: <pre class="programlisting">
3270: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
3271: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
3272: BSDSRCDIR= /usr/src
3273: BSDXSRCDIR= /usr/xsrc # for x11/xservers
3274: OBJHOSTNAME?= yes # use work.`hostname`
3275: FAILOVER_FETCH= yes # insist on the correct checksum
3276: PKG_DEVELOPER?= yes
3277: _ACCEPTABLE= yes
3278: </pre>
3279: </div>
3280:
3281: <div class="sect3" lang="en" xml:lang="en">
3282: <div class="titlepage">
3283: <div>
3284: <div>
1.30 wiz 3285: <h4 class="title"><a name="build.conf" id=
3286: "build.conf"></a>5.3.1.2. <code class=
1.14 xtraeme 3287: "filename">build.conf</code></h4>
1.1 grant 3288: </div>
3289: </div>
3290: </div>
3291:
1.14 xtraeme 3292: <p>In <code class="filename">pkgsrc/mk/bulk</code>,
3293: copy <code class="filename">build.conf-example</code>
3294: to <code class="filename">build.conf</code> and edit
3295: it, following the comments in that file. This is the
1.1 grant 3296: config file that determines where log files are
3297: generated after the build, where to mail the build
1.23 wiz 3298: report to, where your pkgsrc tree is located and the
3299: user to which user to <a href=
1.1 grant 3300: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
3301: <span class="citerefentry"><span class=
1.23 wiz 3302: "refentrytitle">su</span>(8)</span></a> to do a
1.14 xtraeme 3303: <span><strong class="command">cvs
3304: update</strong></span>.</p>
1.1 grant 3305: </div>
3306:
3307: <div class="sect3" lang="en" xml:lang="en">
3308: <div class="titlepage">
3309: <div>
3310: <div>
1.30 wiz 3311: <h4 class="title"><a name="pre-build.local" id=
3312: "pre-build.local"></a>5.3.1.3. <code class="filename">
3313: pre-build.local</code></h4>
1.1 grant 3314: </div>
3315: </div>
3316: </div>
3317:
3318: <p>It is possible to configure the bulk build to
3319: perform certain site specific tasks at the end of the
1.14 xtraeme 3320: pre-build stage. If the file <code class=
3321: "filename">pre-build.local</code> exists in
1.23 wiz 3322: <code class="filename">/usr/pkgsrc/mk/bulk</code>, it
1.24 wiz 3323: will be executed (as a <a href=
3324: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
3325: <span class="citerefentry"><span class=
3326: "refentrytitle">sh</span>(1)</span></a> script) at
3327: the end of the usual pre-build stage. An example use
3328: of <code class="filename">pre-build.local</code> is
3329: to have the line:</p>
1.1 grant 3330: <pre class="screen">
1.14 xtraeme 3331: <code class="prompt">#</code> <strong class=
3332: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 3333: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 3334: </pre>
3335:
3336: <p>to prevent the system from trying to build a
3337: particular package which requires nearly 3 GB of disk
3338: space.</p>
3339: </div>
3340: </div>
3341:
3342: <div class="sect2" lang="en" xml:lang="en">
3343: <div class="titlepage">
3344: <div>
3345: <div>
1.30 wiz 3346: <h3 class="title"><a name=
3347: "other-environmental-considerations" id=
3348: "other-environmental-considerations"></a>5.3.2. Other
3349: environmental considerations</h3>
1.1 grant 3350: </div>
3351: </div>
3352: </div>
3353:
1.14 xtraeme 3354: <p>As <code class="filename">/usr/pkg</code> will be
1.1 grant 3355: completely deleted at the start of bulk builds, make
3356: sure your login shell is placed somewhere else. Either
1.14 xtraeme 3357: drop it into <code class=
3358: "filename">/usr/local/bin</code> (and adjust your login
3359: shell in the passwd file), or (re-)install it via
3360: <a href=
1.1 grant 3361: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3362: <span class="citerefentry"><span class=
3363: "refentrytitle">pkg_add</span>(1)</span></a> from
1.14 xtraeme 3364: <code class="filename">/etc/rc.local</code>, so you can
1.1 grant 3365: login after a reboot (remember that your current
3366: process won't die if the package is removed, you just
3367: can't start any new instances of the shell any more).
3368: Also, if you use NetBSD earlier than 1.5, or you still
3369: want to use the pkgsrc version of ssh for some reason,
3370: be sure to install ssh before starting it from
1.14 xtraeme 3371: <code class="filename">rc.local</code>:</p>
1.1 grant 3372: <pre class="programlisting">
3373: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
3374: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
3375: /usr/pkg/etc/rc.d/sshd
3376: fi
3377: </pre>
3378:
3379: <p>Not doing so will result in you being not able to
3380: log in via ssh after the bulk build is finished or if
3381: the machine gets rebooted or crashes. You have been
3382: warned! :)</p>
3383: </div>
3384:
3385: <div class="sect2" lang="en" xml:lang="en">
3386: <div class="titlepage">
3387: <div>
3388: <div>
1.30 wiz 3389: <h3 class="title"><a name="operation" id=
3390: "operation"></a>5.3.3. Operation</h3>
1.1 grant 3391: </div>
3392: </div>
3393: </div>
3394:
3395: <p>Make sure you don't need any of the packages still
3396: installed.</p>
3397:
3398: <div class="warning" style=
3399: "margin-left: 0.5in; margin-right: 0.5in;">
3400: <h3 class="title">Warning</h3>
3401:
3402: <p>During the bulk build, <span class=
3403: "emphasis"><em>all packages will be
3404: removed!</em></span></p>
3405: </div>
3406:
3407: <p>Be sure to remove all other things that might
3408: interfere with builds, like some libs installed in
1.14 xtraeme 3409: <code class="filename">/usr/local</code>, etc. then
3410: become root and type:</p>
1.1 grant 3411: <pre class="screen">
1.14 xtraeme 3412: <code class="prompt">#</code> <strong class=
3413: "userinput"><code>cd /usr/pkgsrc</code></strong>
3414: <code class="prompt">#</code> <strong class=
3415: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 3416: </pre>
3417:
3418: <p>If for some reason your last build didn't complete
3419: (power failure, system panic, ...), you can continue it
3420: by running:</p>
3421: <pre class="screen">
1.14 xtraeme 3422: <code class="prompt">#</code> <strong class=
3423: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 3424: </pre>
3425:
3426: <p>At the end of the bulk build, you will get a summary
3427: via mail, and find build logs in the directory
1.14 xtraeme 3428: specified by <code class="varname">FTP</code> in the
3429: <code class="filename">build.conf</code> file.</p>
1.1 grant 3430: </div>
3431:
3432: <div class="sect2" lang="en" xml:lang="en">
3433: <div class="titlepage">
3434: <div>
3435: <div>
1.30 wiz 3436: <h3 class="title"><a name="what-it-does" id=
3437: "what-it-does"></a>5.3.4. What it does</h3>
1.1 grant 3438: </div>
3439: </div>
3440: </div>
3441:
3442: <p>The bulk builds consist of three steps:</p>
3443:
3444: <div class="variablelist">
3445: <dl>
3446: <dt><span class="term">1. pre-build</span></dt>
3447:
3448: <dd>
3449: <p>The script updates your pkgsrc tree via
3450: (anon)cvs, then cleans out any broken distfiles,
3451: and removes all packages installed.</p>
3452: </dd>
3453:
3454: <dt><span class="term">2. the bulk
3455: build</span></dt>
3456:
3457: <dd>
3458: <p>This is basically “<span class=
3459: "quote">make bulk-package</span>” with an
3460: optimised order in which packages will be built.
3461: Packages that don't require other packages will
3462: be built first, and packages with many
3463: dependencies will be built later.</p>
3464: </dd>
3465:
3466: <dt><span class="term">3. post-build</span></dt>
3467:
3468: <dd>
3469: <p>Generates a report that's placed in the
1.14 xtraeme 3470: directory specified in the <code class=
3471: "filename">build.conf</code> file named
3472: <code class="filename">broken.html</code>, a
3473: short version of that report will also be mailed
3474: to the build's admin.</p>
1.1 grant 3475: </dd>
3476: </dl>
3477: </div>
3478:
3479: <p>During the build, a list of broken packages will be
1.14 xtraeme 3480: compiled in <code class=
3481: "filename">/usr/pkgsrc/.broken</code> (or <code class=
3482: "filename">.../.broken.${MACHINE}</code> if
3483: <code class="varname">OBJMACHINE</code> is set),
3484: individual build logs of broken builds can be found in
3485: the package's directory. These files are used by the
3486: bulk-targets to mark broken builds to not waste time
3487: trying to rebuild them, and they can be used to debug
3488: these broken package builds later.</p>
1.1 grant 3489: </div>
3490:
3491: <div class="sect2" lang="en" xml:lang="en">
3492: <div class="titlepage">
3493: <div>
3494: <div>
1.30 wiz 3495: <h3 class="title"><a name=
3496: "disk-space-requirements" id=
3497: "disk-space-requirements"></a>5.3.5. Disk
3498: space requirements</h3>
1.1 grant 3499: </div>
3500: </div>
3501: </div>
3502:
3503: <p>Currently, roughly the following requirements are
3504: valid for NetBSD 2.0/i386:</p>
3505:
3506: <div class="itemizedlist">
3507: <ul type="disc">
3508: <li>
3509: <p>10 GB - distfiles (NFS ok)</p>
3510: </li>
3511:
3512: <li>
3513: <p>8 GB - full set of all binaries (NFS ok)</p>
3514: </li>
3515:
3516: <li>
3517: <p>5 GB - temp space for compiling (local disk
3518: recommended)</p>
3519: </li>
3520: </ul>
3521: </div>
3522:
3523: <p>Note that all pkgs will be de-installed as soon as
3524: they are turned into a binary package, and that sources
3525: are removed, so there is no excessively huge demand to
3526: disk space. Afterwards, if the package is needed again,
3527: it will be installed via <a href=
3528: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3529: <span class="citerefentry"><span class=
3530: "refentrytitle">pkg_add</span>(1)</span></a> instead of
3531: building again, so there are no cycles wasted by
3532: recompiling.</p>
3533: </div>
3534:
3535: <div class="sect2" lang="en" xml:lang="en">
3536: <div class="titlepage">
3537: <div>
3538: <div>
1.30 wiz 3539: <h3 class="title"><a name="setting-up-a-sandbox"
3540: id="setting-up-a-sandbox"></a>5.3.6. Setting
3541: up a sandbox for chroot'ed builds</h3>
1.1 grant 3542: </div>
3543: </div>
3544: </div>
3545:
1.12 agc 3546: <p>If you don't want all the packages nuked from a
3547: machine (rendering it useless for anything but pkg
1.23 wiz 3548: compiling), there is the possibility of doing the
3549: package bulk build inside a chroot environment.</p>
1.12 agc 3550:
3551: <p>The first step is to set up a chroot sandbox, e.g.
1.14 xtraeme 3552: <code class="filename">/usr/sandbox</code>. This can be
1.12 agc 3553: done by using null mounts, or manually.</p>
3554:
1.14 xtraeme 3555: <p>There is a shell script called <code class=
3556: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
3557: set up the sandbox environment using null mounts. It
3558: will also create a script called <code class=
3559: "filename">sandbox</code> in the root of the sandbox
1.12 agc 3560: environment, which will allow the null mounts to be
1.14 xtraeme 3561: activated using the <span><strong class=
3562: "command">sandbox mount</strong></span> command and
3563: deactivated using the <span><strong class=
3564: "command">sandbox umount</strong></span> command.</p>
1.12 agc 3565:
3566: <p>To set up a sandbox environment by hand, after
3567: extracting all the sets from a NetBSD installation or
1.14 xtraeme 3568: doing a <span><strong class="command">make distribution
3569: DESTDIR=/usr/sandbox</strong></span> in <code class=
3570: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 3571: items are present and properly configured:</p>
1.1 grant 3572:
3573: <div class="procedure">
3574: <ol type="1">
3575: <li>
3576: <p>Kernel</p>
3577: <pre class="screen">
1.14 xtraeme 3578: <code class="prompt">#</code> <strong class=
3579: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 3580: </pre>
3581: </li>
3582:
3583: <li>
1.14 xtraeme 3584: <p><code class="filename">/dev/*</code></p>
1.1 grant 3585: <pre class="screen">
1.14 xtraeme 3586: <code class="prompt">#</code> <strong class=
3587: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 3588: </pre>
3589: </li>
3590:
3591: <li>
1.14 xtraeme 3592: <p><code class="filename">/etc/resolv.conf</code>
1.1 grant 3593: (for <a xmlns=
3594: "http://www.w3.org/TR/xhtml1/transitional" href=
3595: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20 ben 3596: class="pkgname">security/smtpd</a> and mail):</p>
1.1 grant 3597: <pre class="screen">
1.14 xtraeme 3598: <code class="prompt">#</code> <strong class=
3599: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 3600: </pre>
3601: </li>
3602:
3603: <li>
3604: <p>Working(!) mail config (hostname,
3605: sendmail.cf):</p>
3606: <pre class="screen">
1.14 xtraeme 3607: <code class="prompt">#</code> <strong class=
3608: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 3609: </pre>
3610: </li>
3611:
3612: <li>
1.14 xtraeme 3613: <p><code class="filename">/etc/localtime</code>
3614: (for <a xmlns=
1.1 grant 3615: "http://www.w3.org/TR/xhtml1/transitional" href=
3616: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20 ben 3617: class="pkgname">security/smtpd</a>):</p>
1.1 grant 3618: <pre class="screen">
1.14 xtraeme 3619: <code class="prompt">#</code> <strong class=
3620: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 3621: </pre>
3622: </li>
3623:
3624: <li>
1.14 xtraeme 3625: <p><code class="filename">/usr/src</code> (system
1.1 grant 3626: sources, for <a xmlns=
3627: "http://www.w3.org/TR/xhtml1/transitional" href=
3628: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.20 ben 3629: class="pkgname">sysutils/aperture</a>, <a xmlns=
3630: "http://www.w3.org/TR/xhtml1/transitional" href=
3631: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
3632: class="pkgname">net/ppp-mppe</a>):</p>
1.1 grant 3633: <pre class="screen">
1.14 xtraeme 3634: <code class="prompt">#</code> <strong class=
3635: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
3636: <code class="prompt">#</code> <strong class=
1.23 wiz 3637: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 3638: </pre>
3639: </li>
3640:
3641: <li>
1.14 xtraeme 3642: <p>Create <code class=
3643: "filename">/var/db/pkg</code> (not part of
3644: default install):</p>
1.1 grant 3645: <pre class="screen">
1.14 xtraeme 3646: <code class="prompt">#</code> <strong class=
3647: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 3648: </pre>
3649: </li>
3650:
3651: <li>
1.14 xtraeme 3652: <p>Create <code class="filename">/usr/pkg</code>
3653: (not part of default install):</p>
1.1 grant 3654: <pre class="screen">
1.14 xtraeme 3655: <code class="prompt">#</code> <strong class=
3656: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 3657: </pre>
3658: </li>
3659:
3660: <li>
1.14 xtraeme 3661: <p>Checkout pkgsrc via cvs into <code class=
3662: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 3663: <pre class="screen">
1.14 xtraeme 3664: <code class="prompt">#</code> <strong class=
3665: "userinput"><code>cd /usr/sandbox/usr</code></strong>
3666: <code class="prompt">#</code> <strong class=
3667: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 3668: </pre>
3669:
3670: <p>Do not mount/link this to the copy of your
3671: pkgsrc tree you do development in, as this will
3672: likely cause problems!</p>
3673: </li>
3674:
3675: <li>
1.14 xtraeme 3676: <p>Make <code class=
3677: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
3678: and <code class="filename">.../distfiles</code>
3679: point somewhere appropriate. NFS- and/or
3680: nullfs-mounts may come in handy!</p>
1.1 grant 3681: </li>
3682:
3683: <li>
1.14 xtraeme 3684: <p>Edit <code class=
3685: "filename">/etc/mk.conf</code>, see <a href=
3686: "#binary.mk.conf" title=
1.1 grant 3687: "5.3.1.1. /etc/mk.conf">Section 5.3.1.1,
3688: “/etc/mk.conf”</a>.</p>
3689: </li>
3690:
3691: <li>
1.14 xtraeme 3692: <p>Adjust <code class=
3693: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 3694: needs.</p>
3695: </li>
3696:
3697: <li>
1.14 xtraeme 3698: <p>If you have set <code class=
3699: "varname">CVS_USER</code> in <code class=
3700: "filename">build.conf</code>, make sure that
3701: account exists and can do a <span><strong class=
3702: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 3703: properly!</p>
3704: </li>
3705: </ol>
3706: </div>
3707:
3708: <p>When the chroot sandbox is setup, you can start the
3709: build with the following steps:</p>
3710: <pre class="screen">
1.14 xtraeme 3711: <code class="prompt">#</code> <strong class=
3712: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
3713: <code class="prompt">#</code> <strong class=
3714: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 3715: </pre>
3716:
3717: <p>This will just jump inside the sandbox and start
3718: building. At the end of the build, mail will be sent
3719: with the results of the build. Created binary pkgs will
1.14 xtraeme 3720: be in <code class=
3721: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 3722: (wherever that points/mounts to/from).</p>
3723: </div>
3724:
3725: <div class="sect2" lang="en" xml:lang="en">
3726: <div class="titlepage">
3727: <div>
3728: <div>
1.30 wiz 3729: <h3 class="title"><a name=
3730: "building-a-partial-set" id=
3731: "building-a-partial-set"></a>5.3.7. Building
3732: a partial set of packages</h3>
1.1 grant 3733: </div>
3734: </div>
3735: </div>
3736:
3737: <p>In addition to building a complete set of all
1.14 xtraeme 3738: packages in pkgsrc, the <code class=
3739: "filename">pkgsrc/mk/bulk/build</code> script may be
3740: used to build a subset of the packages contained in
3741: pkgsrc. By setting defining <code class=
3742: "varname">SPECIFIC_PKGS</code> in <code class=
3743: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 3744:
3745: <div class="itemizedlist">
3746: <ul type="disc">
3747: <li>
3748: <p>SITE_SPECIFIC_PKGS</p>
3749: </li>
3750:
3751: <li>
3752: <p>HOST_SPECIFIC_PKGS</p>
3753: </li>
3754:
3755: <li>
3756: <p>GROUP_SPECIFIC_PKGS</p>
3757: </li>
3758:
3759: <li>
3760: <p>USER_SPECIFIC_PKGS</p>
3761: </li>
3762: </ul>
3763: </div>
3764:
3765: <p>will define the set of packages which should be
3766: built. The bulk build code will also include any
3767: packages which are needed as dependencies for the
3768: explicitly listed packages.</p>
3769:
3770: <p>One use of this is to do a bulk build with
1.14 xtraeme 3771: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 3772: sandbox periodically to have a complete set of the
3773: binary packages needed for your site available without
3774: the overhead of building extra packages that are not
3775: needed.</p>
3776: </div>
1.13 hubertf 3777:
3778: <div class="sect2" lang="en" xml:lang="en">
3779: <div class="titlepage">
3780: <div>
3781: <div>
3782: <h3 class="title"><a name="bulk-upload" id=
3783: "bulk-upload"></a>5.3.8. Uploading results
3784: of a bulk build</h3>
3785: </div>
3786: </div>
3787: </div>
3788:
3789: <p>This section describes how pkgsrc developers can
3790: upload binary pkgs built by bulk builds to
3791: ftp.NetBSD.org.</p>
3792:
1.17 sketch 3793: <p>If you would like to automatically create checksum
3794: files for the binary packages you intend to upload,
3795: remember to set <code class="varname">MKSUMS=yes</code>
3796: in your <code class=
3797: "filename">mk/bulk/build.conf</code>.</p>
3798:
3799: <p>If you would like to PGP sign the checksum files
3800: (highly recommended!), remember to set <code class=
3801: "varname">SIGN_AS=username@NetBSD.org</code> in your
3802: <code class="filename">mk/bulk/build.conf</code>. This
1.23 wiz 3803: will prompt you for your GPG password to sign the files
1.17 sketch 3804: before uploading everything.</p>
3805:
3806: <p>Then, make sure that you have <code class=
1.14 xtraeme 3807: "varname">RSYNC_DST</code> set properly in your
3808: <code class="filename">mk/bulk/build.conf</code> file,
3809: i.e. adjust it to something like one of the
3810: following:</p>
1.13 hubertf 3811: <pre class="screen">
3812: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3813: </pre>
3814:
1.23 wiz 3815: <p>Please use appropviate values for "pkgsrc-200xQy",
1.13 hubertf 3816: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 3817: ftp.NetBSD.org is different from <code class=
3818: "varname">CVS_USER</code>, write your login directly
3819: into the variable, e.g. my local account is "feyrer",
3820: but for my login "hubertf", I use:</p>
1.13 hubertf 3821: <pre class="screen">
3822: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3823: </pre>
3824:
1.14 xtraeme 3825: <p>A separate <code class="filename">upload</code>
1.13 hubertf 3826: directory is used here to allow "closing" the directory
3827: during upload. To do so, run the following command on
3828: ftp.NetBSD.org next:</p>
3829: <pre class="screen">
1.14 xtraeme 3830: nbftp% <strong class=
3831: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 3832: </pre>
3833:
1.14 xtraeme 3834: <p>Please note that <code class=
3835: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 3836: appropriate for packages for the NetBSD operating
3837: system. Binary packages for other operating systems
1.14 xtraeme 3838: should go into <code class=
3839: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 3840:
3841: <p>Before uploading the binary pkgs, ssh authentication
1.23 wiz 3842: needs to be set up. This example shows how to setup
1.13 hubertf 3843: temporary keys for the root account <span class=
3844: "emphasis"><em>inside the sandbox</em></span> (assuming
3845: that no keys should be present there usually):</p>
3846: <pre class="screen">
1.14 xtraeme 3847: <code class="prompt">#</code> <strong class=
3848: "userinput"><code>chroot /usr/sandbox</code></strong>
3849: chroot-<code class="prompt">#</code> <strong class=
3850: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
3851: chroot-<code class="prompt">#</code> <strong class=
3852: "userinput"><code>ssh-keygen -t dsa</code></strong>
3853: chroot-<code class="prompt">#</code> <strong class=
3854: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 3855: </pre>
3856:
1.14 xtraeme 3857: <p>Now take the output of <code class=
3858: "filename">id-dsa.pub</code> and append it to your
3859: <code class="filename">~/.ssh/authorized_keys</code>
1.17 sketch 3860: file on ftp.NetBSD.org. You can remove the key after
1.14 xtraeme 3861: the upload is done!</p>
1.13 hubertf 3862:
3863: <p>Next, test if your ssh connection really works:</p>
3864: <pre class="screen">
1.14 xtraeme 3865: chroot-<code class="prompt">#</code> <strong class=
3866: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 3867: </pre>
3868:
3869: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
3870:
3871: <p>Now after all this works, you can exit the sandbox
3872: and start the upload:</p>
3873: <pre class="screen">
1.14 xtraeme 3874: chroot-<code class="prompt">#</code> <strong class=
3875: "userinput"><code>exit</code></strong>
3876: <code class="prompt">#</code> <strong class=
3877: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
3878: <code class="prompt">#</code> <strong class=
3879: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 3880: </pre>
3881:
3882: <p>The upload process may take quite some time. Use
1.24 wiz 3883: <a href=
3884: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
3885: <span class="citerefentry"><span class=
3886: "refentrytitle">ls</span>(1)</span></a> or <a href=
3887: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
3888: <span class="citerefentry"><span class=
3889: "refentrytitle">du</span>(1)</span></a> on the FTP
3890: server to monitor progress of the upload. The upload
3891: script will take care of not uploading restricted
3892: packages and putting vulnerable packages into the
3893: <code class="filename">vulnerable</code>
3894: subdirectory.</p>
1.13 hubertf 3895:
3896: <p>After the upload has ended, first thing is to revoke
3897: ssh access:</p>
3898: <pre class="screen">
1.14 xtraeme 3899: nbftp% <strong class=
3900: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 3901: Gdd:x!
3902: </pre>
3903:
3904: <p>Use whatever is needed to remove the key you've
3905: entered before! Last, move the uploaded packages out of
1.14 xtraeme 3906: the <code class="filename">upload</code> directory to
3907: have them accessible to everyone:</p>
1.13 hubertf 3908: <pre class="screen">
1.14 xtraeme 3909: nbftp% <strong class=
3910: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
3911: nbftp% <strong class=
3912: "userinput"><code>mv upload/* .</code></strong>
3913: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
3914: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 3915: </pre>
3916: </div>
1.1 grant 3917: </div>
3918:
3919: <div class="sect1" lang="en" xml:lang="en">
3920: <div class="titlepage">
3921: <div>
3922: <div>
3923: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3924: "creating-cdroms" id=
3925: "creating-cdroms"></a>5.4. Creating a multiple
3926: CD-ROM packages collection</h2>
1.1 grant 3927: </div>
3928: </div>
3929: </div>
3930:
3931: <p>After your pkgsrc bulk-build has completed, you may
3932: wish to create a CD-ROM set of the resulting binary
3933: packages to assist in installing packages on other
3934: machines. The <a xmlns=
3935: "http://www.w3.org/TR/xhtml1/transitional" href=
3936: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.20 ben 3937: class="pkgname">pkgtools/cdpack</a> package provides a
3938: simple tool for creating the ISO 9660 images.
3939: <span><strong class="command">cdpack</strong></span>
3940: arranges the packages on the CD-ROMs in a way that keeps
3941: all the dependencies for given package on the same CD as
3942: that package.</p>
1.1 grant 3943:
3944: <div class="sect2" lang="en" xml:lang="en">
3945: <div class="titlepage">
3946: <div>
3947: <div>
1.30 wiz 3948: <h3 class="title"><a name="cdpack-example" id=
3949: "cdpack-example"></a>5.4.1. Example of
1.1 grant 3950: cdpack</h3>
3951: </div>
3952: </div>
3953: </div>
3954:
3955: <p>Complete documentation for cdpack is found in the
3956: cdpack(1) manpage. The following short example assumes
1.14 xtraeme 3957: that the binary packages are left in <code class=
3958: "filename">/usr/pkgsrc/packages/All</code> and that
3959: sufficient disk space exists in <code class=
3960: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 3961: <pre class="screen">
1.14 xtraeme 3962: <code class="prompt">#</code> <strong class=
3963: "userinput"><code>mkdir /u2/images</code></strong>
3964: <code class="prompt">#</code> <strong class=
3965: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
3966: <code class="prompt">#</code> <strong class=
3967: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 3968: </pre>
3969:
3970: <p>If you wish to include a common set of files
1.14 xtraeme 3971: (<code class="filename">COPYRIGHT</code>, <code class=
3972: "filename">README</code>, etc.) on each CD in the
1.1 grant 3973: collection, then you need to create a directory which
3974: contains these files. e.g.</p>
3975: <pre class="screen">
1.14 xtraeme 3976: <code class="prompt">#</code> <strong class=
3977: "userinput"><code>mkdir /tmp/common</code></strong>
3978: <code class="prompt">#</code> <strong class=
3979: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
3980: <code class="prompt">#</code> <strong class=
3981: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
3982: <code class="prompt">#</code> <strong class=
3983: "userinput"><code>mkdir /tmp/common/bin</code></strong>
3984: <code class="prompt">#</code> <strong class=
3985: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
3986: <code class="prompt">#</code> <strong class=
3987: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
3988: <code class="prompt">#</code> <strong class=
3989: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 3990: </pre>
3991:
3992: <p>Now create the images:</p>
3993: <pre class="screen">
1.14 xtraeme 3994: <code class="prompt">#</code> <strong class=
3995: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 3996: </pre>
3997:
1.14 xtraeme 3998: <p>Each image will contain <code class=
3999: "filename">README</code>, <code class=
4000: "filename">COPYING</code>, and <code class=
4001: "filename">bin/myscript</code> in their root
1.1 grant 4002: directories.</p>
4003: </div>
4004: </div>
4005: </div>
4006:
4007: <div class="chapter" lang="en" xml:lang="en">
4008: <div class="titlepage">
4009: <div>
4010: <div>
4011: <h2 class="title"><a name="faq" id=
4012: "faq"></a>Chapter 6. Frequently Asked
4013: Questions</h2>
4014: </div>
4015: </div>
4016: </div>
4017:
4018: <div class="toc">
4019: <p><b>Table of Contents</b></p>
4020:
4021: <dl>
1.30 wiz 4022: <dt><span class="sect1"><a href=
4023: "#mailing-list-pointers">6.1. Are there any mailing
4024: lists for pkg-related discussion?</a></span></dt>
1.1 grant 4025:
1.30 wiz 4026: <dt><span class="sect1"><a href="#pkgviews-docs">6.2.
1.1 grant 4027: Where's the pkgviews documentation?</a></span></dt>
4028:
1.5 hubertf 4029: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 4030: Utilities for package management
4031: (pkgtools)</a></span></dt>
4032:
1.30 wiz 4033: <dt><span class="sect1"><a href="#non-root-pkgsrc">6.4.
4034: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 4035:
1.30 wiz 4036: <dt><span class="sect1"><a href=
4037: "#resume-transfers">6.5. How to resume transfers when
4038: fetching distfiles?</a></span></dt>
1.14 xtraeme 4039:
1.30 wiz 4040: <dt><span class="sect1"><a href=
4041: "#XFree86-from-pkgsrc">6.6. How can I install/use
4042: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 4043:
1.30 wiz 4044: <dt><span class="sect1"><a href=
4045: "#x.org-from-pkgsrc">6.7. How can I install/use X.org
4046: from pkgsrc?</a></span></dt>
1.1 grant 4047:
1.30 wiz 4048: <dt><span class="sect1"><a href=
4049: "#fetch-behind-firewall">6.8. How to fetch files from
4050: behind a firewall</a></span></dt>
1.1 grant 4051:
1.30 wiz 4052: <dt><span class="sect1"><a href="#passive-ftp">6.9. How
1.14 xtraeme 4053: do I tell <span><strong class="command">make
4054: fetch</strong></span> to do passive
4055: FTP?</a></span></dt>
1.1 grant 4056:
1.30 wiz 4057: <dt><span class="sect1"><a href=
4058: "#fetching-all-distfiles">6.10. How to fetch all
4059: distfiles at once</a></span></dt>
1.1 grant 4060:
1.30 wiz 4061: <dt><span class="sect1"><a href=
4062: "#tmac.andoc-missing">6.11. What does
4063: “<span class="quote">Don't know how to make
1.14 xtraeme 4064: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 4065: mean?</a></span></dt>
4066:
1.30 wiz 4067: <dt><span class="sect1"><a href=
4068: "#bsd.own.mk-missing">6.12. What does
4069: “<span class="quote">Could not find
1.14 xtraeme 4070: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 4071:
1.30 wiz 4072: <dt><span class="sect1"><a href=
4073: "#using-sudo-with-pkgsrc">6.13. Using 'sudo' with
4074: pkgsrc</a></span></dt>
1.1 grant 4075:
1.35 jmmv 4076: <dt><span class="sect1"><a href="#faq.conf">6.14. How
4077: do I change the location of configuration
4078: files?</a></span></dt>
1.1 grant 4079:
1.14 xtraeme 4080: <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1 grant 4081: Automated security checks</a></span></dt>
4082: </dl>
4083: </div>
4084:
4085: <p>This section contains hints, tips & tricks on
4086: special things in pkgsrc that we didn't find a better place
4087: for in the previous chapters, and it contains items for
4088: both pkgsrc users and developers.</p>
4089:
4090: <div class="sect1" lang="en" xml:lang="en">
4091: <div class="titlepage">
4092: <div>
4093: <div>
4094: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4095: "mailing-list-pointers" id=
4096: "mailing-list-pointers"></a>6.1. Are there any
4097: mailing lists for pkg-related discussion?</h2>
1.1 grant 4098: </div>
4099: </div>
4100: </div>
4101:
1.18 xtraeme 4102: <p>The following mailing lists may be of interest to
4103: pkgsrc users:</p>
4104:
4105: <div class="itemizedlist">
4106: <ul type="disc">
4107: <li>
4108: <p><a href=
4109: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34 wiz 4110: target="_top">pkgsrc-bugs</a>: A list where problem
4111: reports related to pkgsrc are sent and
4112: discussed.</p>
1.18 xtraeme 4113: </li>
4114:
4115: <li>
4116: <p><a href=
4117: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 4118: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 4119: results of pkgsrc bulk builds are sent and
1.34 wiz 4120: discussed.</p>
1.18 xtraeme 4121: </li>
4122:
4123: <li>
4124: <p><a href=
4125: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34 wiz 4126: target="_top">pkgsrc-changes</a>: A list where all
4127: commit messages to pkgsrc are sent.</p>
1.18 xtraeme 4128: </li>
4129:
4130: <li>
4131: <p><a href=
4132: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34 wiz 4133: target="_top">tech-pkg</a>: A general discussion
4134: list for all things related to pkgsrc.</p>
1.18 xtraeme 4135: </li>
4136: </ul>
4137: </div>
4138:
4139: <p>To subscribe, do:</p>
1.1 grant 4140: <pre class="programlisting">
1.18 xtraeme 4141: <code class="prompt">%</code> echo subscribe <em class=
4142: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 4143: </pre>
4144:
1.18 xtraeme 4145: <p>Archives for all these mailing lists are available
4146: from <a href="http://mail-index.NetBSD.org/" target=
4147: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 4148: </div>
4149:
4150: <div class="sect1" lang="en" xml:lang="en">
4151: <div class="titlepage">
4152: <div>
4153: <div>
4154: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4155: "pkgviews-docs" id=
4156: "pkgviews-docs"></a>6.2. Where's the pkgviews
4157: documentation?</h2>
1.1 grant 4158: </div>
4159: </div>
4160: </div>
4161:
4162: <p>Pkgviews is tightly integrated with buildlink. You can
1.14 xtraeme 4163: find a pkgviews User's guide in <code class=
4164: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 4165: </div>
4166:
4167: <div class="sect1" lang="en" xml:lang="en">
4168: <div class="titlepage">
4169: <div>
4170: <div>
4171: <h2 class="title" style="clear: both"><a name=
1.5 hubertf 4172: "faq-pkgtools" id=
4173: "faq-pkgtools"></a>6.3. Utilities for package
4174: management (pkgtools)</h2>
1.1 grant 4175: </div>
4176: </div>
4177: </div>
4178:
1.14 xtraeme 4179: <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1 grant 4180: directory pkgtools contains a number of useful utilities
4181: for both users and developers of pkgsrc. This section
4182: attempts only to make the reader aware of the utilities
4183: and when they might be useful, and not to duplicate the
4184: documentation that comes with each package.</p>
4185:
4186: <p>Utilities used by pkgsrc (automatically installed when
4187: needed):</p>
4188:
4189: <div class="itemizedlist">
4190: <ul type="disc">
4191: <li>
4192: <p><a xmlns=
4193: "http://www.w3.org/TR/xhtml1/transitional" href=
4194: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.34 wiz 4195: class="pkgname">pkgtools/x11-links</a>: Symlinks
4196: for use by buildlink.</p>
1.1 grant 4197: </li>
4198: </ul>
4199: </div>
4200:
4201: <p>OS tool augmentation (automatically installed when
4202: needed):</p>
4203:
4204: <div class="itemizedlist">
4205: <ul type="disc">
4206: <li>
4207: <p><a xmlns=
4208: "http://www.w3.org/TR/xhtml1/transitional" href=
4209: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.34 wiz 4210: class="pkgname">pkgtools/digest</a>: Calculates
4211: various kinds of checksums (including SHA1).</p>
1.1 grant 4212: </li>
4213:
4214: <li>
4215: <p><a xmlns=
4216: "http://www.w3.org/TR/xhtml1/transitional" href=
4217: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.27 rillig 4218: class="pkgname">pkgtools/libnbcompat</a>:
1.34 wiz 4219: Compatibility library for pkgsrc tools.</p>
1.1 grant 4220: </li>
4221:
4222: <li>
4223: <p><a xmlns=
4224: "http://www.w3.org/TR/xhtml1/transitional" href=
4225: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.34 wiz 4226: class="pkgname">pkgtools/mtree</a>: Installed on
4227: non-BSD systems due to lack of native mtree.</p>
1.1 grant 4228: </li>
4229:
4230: <li>
4231: <p><a xmlns=
4232: "http://www.w3.org/TR/xhtml1/transitional" href=
4233: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4234: class="pkgname">pkgtools/pkg_install</a>:
1.34 wiz 4235: Up-to-date replacement for <code class=
4236: "filename">/usr/sbin/pkg_install</code>, or for use
4237: on operating systems where pkg_install is not
4238: present.</p>
1.1 grant 4239: </li>
4240: </ul>
4241: </div>
4242:
4243: <p>Utilities used by pkgsrc (not automatically
4244: installed):</p>
4245:
4246: <div class="itemizedlist">
4247: <ul type="disc">
4248: <li>
4249: <p><a xmlns=
4250: "http://www.w3.org/TR/xhtml1/transitional" href=
4251: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.34 wiz 4252: class="pkgname">pkgtools/pkg_tarup</a>: Create a
1.20 ben 4253: binary package from an already-installed package.
1.34 wiz 4254: Used by <span><strong class="command">make
4255: replace</strong></span> to save the old
4256: package.</p>
1.1 grant 4257: </li>
4258:
4259: <li>
4260: <p><a xmlns=
4261: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 4262: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.34 wiz 4263: class="pkgname">pkgtools/dfdisk</a>: Adds extra
1.20 ben 4264: functionality to pkgsrc, allowing it to fetch
4265: distfiles from multiple locations. It currently
4266: supports the following methods: multiple CD-ROMs
4267: and network FTP/HTTP connections.</p>
1.5 hubertf 4268: </li>
4269:
4270: <li>
4271: <p><a xmlns=
4272: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4273: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.34 wiz 4274: class="pkgname">pkgtools/xpkgwedge</a>: Put X11
4275: packages someplace else (enabled by default).</p>
1.1 grant 4276: </li>
1.5 hubertf 4277:
4278: <li>
4279: <p><a xmlns=
4280: "http://www.w3.org/TR/xhtml1/transitional" href=
4281: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.34 wiz 4282: class="pkgname">devel/cpuflags</a>: Determine the
4283: best compiler flags to optimise code for your
1.20 ben 4284: current CPU and compiler.</p>
1.5 hubertf 4285: </li>
1.1 grant 4286: </ul>
4287: </div>
4288:
4289: <p>Utilities for keeping track of installed packages,
4290: being up to date, etc:</p>
4291:
4292: <div class="itemizedlist">
4293: <ul type="disc">
4294: <li>
4295: <p><a xmlns=
4296: "http://www.w3.org/TR/xhtml1/transitional" href=
4297: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.34 wiz 4298: class="pkgname">pkgtools/pkg_chk</a>: Reports on
1.27 rillig 4299: packages whose installed versions do not match the
1.34 wiz 4300: latest pkgsrc entries.</p>
1.1 grant 4301: </li>
4302:
4303: <li>
4304: <p><a xmlns=
4305: "http://www.w3.org/TR/xhtml1/transitional" href=
4306: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.34 wiz 4307: class="pkgname">pkgtools/pkgdep</a>: Makes
1.20 ben 4308: dependency graphs of packages, to aid in choosing a
1.34 wiz 4309: strategy for updating.</p>
1.1 grant 4310: </li>
4311:
4312: <li>
4313: <p><a xmlns=
4314: "http://www.w3.org/TR/xhtml1/transitional" href=
4315: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.34 wiz 4316: class="pkgname">pkgtools/pkgdepgraph</a>: Makes
1.27 rillig 4317: graphs from the output of <a xmlns=
4318: "http://www.w3.org/TR/xhtml1/transitional" href=
4319: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
4320: class="pkgname">pkgtools/pkgdep</a> (uses
1.34 wiz 4321: graphviz).</p>
1.1 grant 4322: </li>
4323:
4324: <li>
4325: <p><a xmlns=
4326: "http://www.w3.org/TR/xhtml1/transitional" href=
4327: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.34 wiz 4328: class="pkgname">pkgtools/pkglint</a>: The
1.27 rillig 4329: pkglint(1) program checks a pkgsrc entry for
4330: errors, lintpkgsrc(1) does various checks on the
4331: complete pkgsrc system.</p>
1.1 grant 4332: </li>
4333:
4334: <li>
4335: <p><a xmlns=
4336: "http://www.w3.org/TR/xhtml1/transitional" href=
4337: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.34 wiz 4338: class="pkgname">pkgtools/pkgsurvey</a>: Report what
4339: packages you have installed.</p>
1.1 grant 4340: </li>
4341: </ul>
4342: </div>
4343:
4344: <p>Utilities for people maintaining or creating
4345: individual packages:</p>
4346:
4347: <div class="itemizedlist">
4348: <ul type="disc">
4349: <li>
4350: <p><a xmlns=
4351: "http://www.w3.org/TR/xhtml1/transitional" href=
4352: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.34 wiz 4353: class="pkgname">pkgtools/pkgdiff</a>: Automate
1.20 ben 4354: making and maintaining patches for a package
1.34 wiz 4355: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 4356: </li>
4357:
4358: <li>
4359: <p><a xmlns=
4360: "http://www.w3.org/TR/xhtml1/transitional" href=
4361: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.20 ben 4362: class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
4363: "http://www.w3.org/TR/xhtml1/transitional" href=
4364: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.34 wiz 4365: class="pkgname">pkgtools/url2pkg</a>: Aids in
4366: converting to pkgsrc.</p>
1.1 grant 4367: </li>
4368:
4369: <li>
4370: <p><a xmlns=
4371: "http://www.w3.org/TR/xhtml1/transitional" href=
4372: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.34 wiz 4373: class="pkgname">pkgtools/gensolpkg</a>: Convert
4374: pkgsrc to a Solaris package.</p>
1.1 grant 4375: </li>
4376: </ul>
4377: </div>
4378:
4379: <p>Utilities for people maintaining pkgsrc (or more
4380: obscure pkg utilities)</p>
4381:
4382: <div class="itemizedlist">
4383: <ul type="disc">
4384: <li>
4385: <p><a xmlns=
4386: "http://www.w3.org/TR/xhtml1/transitional" href=
4387: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.34 wiz 4388: class="pkgname">pkgtools/pkgconflict</a>: Find
1.20 ben 4389: packages that conflict but aren't marked as
1.34 wiz 4390: such.</p>
1.1 grant 4391: </li>
4392:
4393: <li>
4394: <p><a xmlns=
4395: "http://www.w3.org/TR/xhtml1/transitional" href=
4396: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.34 wiz 4397: class="pkgname">pkgtools/pkg_comp</a>: Build
4398: packages in a chrooted area.</p>
1.1 grant 4399: </li>
4400:
4401: <li>
4402: <p><a xmlns=
4403: "http://www.w3.org/TR/xhtml1/transitional" href=
4404: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.34 wiz 4405: class="pkgname">pkgtools/libkver</a>: Spoof kernel
4406: version for chrooted cross builds.</p>
1.1 grant 4407: </li>
4408: </ul>
4409: </div>
4410: </div>
4411:
4412: <div class="sect1" lang="en" xml:lang="en">
4413: <div class="titlepage">
4414: <div>
4415: <div>
4416: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4417: "non-root-pkgsrc" id=
4418: "non-root-pkgsrc"></a>6.4. How to use pkgsrc
4419: as non-root</h2>
1.1 grant 4420: </div>
4421: </div>
4422: </div>
4423:
4424: <p>If you want to use pkgsrc as non-root user, you can
4425: set some variables to make pkgsrc work under these
1.33 jmmv 4426: conditions. At the very least, you need to set
4427: <code class="varname">UNPRIVILEGED</code> to
4428: “<span class="quote">yes</span>”; this will
4429: turn on unprivileged mode and set multiple related
4430: variables to allow installation of packages as
4431: non-root.</p>
4432:
4433: <p>In case the defaults are not enough, you may want to
4434: tune some other variables used. For example, if the
4435: automatic user/group detection leads to incorrect values
4436: (or not the ones you would like to use), you can change
4437: them by setting <code class=
4438: "varname">UNPRIVILEGED_USER</code> and <code class=
4439: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
4440:
4441: <p>As regards bootstrapping, please note that the
4442: <span><strong class="command">bootstrap</strong></span>
4443: script will ease non-root configuration when given the
4444: “<span class=
4445: "quote">--ignore-user-check</span>” flag, as it
4446: will choose and use multiple default directories under
4447: <code class="filename">~/pkg</code> as the installation
4448: targets. These directories can be overriden by the
4449: “<span class="quote">--prefix</span>” flag
4450: provided by the script, as well as some others that allow
4451: finer tuning of the tree layout.</p>
1.14 xtraeme 4452: </div>
4453:
4454: <div class="sect1" lang="en" xml:lang="en">
4455: <div class="titlepage">
4456: <div>
4457: <div>
4458: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4459: "resume-transfers" id=
4460: "resume-transfers"></a>6.5. How to resume
4461: transfers when fetching distfiles?</h2>
1.14 xtraeme 4462: </div>
4463: </div>
4464: </div>
4465:
1.15 xtraeme 4466: <p>By default resuming transfers in pkgsrc is disabled,
4467: but you can enable this feature by adding the option
4468: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
4469: into <code class="filename">/etc/mk.conf</code>. If,
4470: during a fetch step, an incomplete distfile is found,
4471: pkgsrc will try to resume it.</p>
4472:
4473: <p>You can also use a different program than the default
1.24 wiz 4474: <a href=
4475: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
4476: <span class="citerefentry"><span class=
4477: "refentrytitle">ftp</span>(1)</span></a> by changing the
4478: <code class="varname">FETCH_CMD</code> variable. Don't
4479: forget to set <code class=
4480: "varname">FETCH_RESUME_ARGS</code> and <code class=
4481: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
4482: default values.</p>
1.14 xtraeme 4483:
4484: <p>For example, if you want to use <code class=
4485: "filename">wget</code> to resume downloads, you'll have
4486: to use something like:</p>
4487: <pre class="programlisting">
1.34 wiz 4488: FETCH_CMD=wget
4489: FETCH_BEFORE_ARGS=--passive-ftp
4490: FETCH_RESUME_ARGS=-c
4491: FETCH_OUTPUT_ARGS=-O
1.14 xtraeme 4492: </pre>
1.1 grant 4493: </div>
4494:
4495: <div class="sect1" lang="en" xml:lang="en">
4496: <div class="titlepage">
4497: <div>
4498: <div>
4499: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4500: "XFree86-from-pkgsrc" id=
4501: "XFree86-from-pkgsrc"></a>6.6. How can I
1.1 grant 4502: install/use XFree86 from pkgsrc?</h2>
4503: </div>
4504: </div>
4505: </div>
4506:
4507: <p>If you want to use XFree86 from pkgsrc instead of your
1.14 xtraeme 4508: system's own X11 (<code class=
4509: "filename">/usr/X11R6</code>, <code class=
4510: "filename">/usr/openwin</code>, ...), you will have to
4511: add the following line into <code class=
1.15 xtraeme 4512: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4513: <pre class="programlisting">
1.34 wiz 4514: X11_TYPE=XFree86
1.1 grant 4515: </pre>
4516: </div>
4517:
4518: <div class="sect1" lang="en" xml:lang="en">
4519: <div class="titlepage">
4520: <div>
4521: <div>
4522: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4523: "x.org-from-pkgsrc" id=
4524: "x.org-from-pkgsrc"></a>6.7. How can I
1.1 grant 4525: install/use X.org from pkgsrc?</h2>
4526: </div>
4527: </div>
4528: </div>
4529:
4530: <p>If you want to use X.org from pkgsrc instead of your
1.14 xtraeme 4531: system's own X11 (<code class=
4532: "filename">/usr/X11R6</code>, <code class=
4533: "filename">/usr/openwin</code>, ...) you will have to add
4534: the following line into <code class=
1.15 xtraeme 4535: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4536: <pre class="programlisting">
1.34 wiz 4537: X11_TYPE=xorg
1.1 grant 4538: </pre>
4539: </div>
4540:
4541: <div class="sect1" lang="en" xml:lang="en">
4542: <div class="titlepage">
4543: <div>
4544: <div>
4545: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4546: "fetch-behind-firewall" id=
4547: "fetch-behind-firewall"></a>6.8. How to fetch
4548: files from behind a firewall</h2>
1.1 grant 4549: </div>
4550: </div>
4551: </div>
4552:
4553: <p>If you are sitting behind a firewall which does not
4554: allow direct connections to Internet hosts (i.e.
4555: non-NAT), you may specify the relevant proxy hosts. This
4556: is done using an environment variable in the form of a
4557: URL e.g. in Amdahl, the machine “<span class=
4558: "quote">orpheus.amdahl.com</span>” is one of the
4559: firewalls, and it uses port 80 as the proxy port number.
4560: So the proxy environment variables are:</p>
4561: <pre class="programlisting">
1.34 wiz 4562: ftp_proxy=ftp://orpheus.amdahl.com:80/
1.1 grant 4563: http_proxy=http://orpheus.amdahl.com:80/
4564: </pre>
4565: </div>
4566:
4567: <div class="sect1" lang="en" xml:lang="en">
4568: <div class="titlepage">
4569: <div>
4570: <div>
4571: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4572: "passive-ftp" id="passive-ftp"></a>6.9. How do
4573: I tell <span><strong class="command">make
1.14 xtraeme 4574: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 4575: </div>
4576: </div>
4577: </div>
4578:
4579: <p>This depends on which utility is used to retrieve
1.14 xtraeme 4580: distfiles. From <code class="filename">bsd.pkg.mk</code>,
4581: <code class="varname">FETCH_CMD</code> is assigned the
4582: first available command from the following list:</p>
1.34 wiz 4583:
4584: <div class="itemizedlist">
4585: <ul type="disc">
4586: <li>
4587: <p><code class=
4588: "filename">${LOCALBASE}/bin/ftp</code></p>
4589: </li>
4590:
4591: <li>
4592: <p><code class="filename">/usr/bin/ftp</code></p>
4593: </li>
4594: </ul>
4595: </div>
1.1 grant 4596:
4597: <p>On a default NetBSD installation, this will be
1.14 xtraeme 4598: <code class="filename">/usr/bin/ftp</code>, which
1.1 grant 4599: automatically tries passive connections first, and falls
4600: back to active connections if the server refuses to do
4601: passive. For the other tools, add the following to your
1.14 xtraeme 4602: <code class="filename">/etc/mk.conf</code> file:
4603: <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 4604:
1.14 xtraeme 4605: <p>Having that option present will prevent <code class=
4606: "filename">/usr/bin/ftp</code> from falling back to
4607: active transfers.</p>
1.1 grant 4608: </div>
4609:
4610: <div class="sect1" lang="en" xml:lang="en">
4611: <div class="titlepage">
4612: <div>
4613: <div>
4614: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4615: "fetching-all-distfiles" id=
4616: "fetching-all-distfiles"></a>6.10. How to
1.1 grant 4617: fetch all distfiles at once</h2>
4618: </div>
4619: </div>
4620: </div>
4621:
4622: <p>You would like to download all the distfiles in a
4623: single batch from work or university, where you can't run
1.14 xtraeme 4624: a <span><strong class="command">make
4625: fetch</strong></span>. There is an archive of distfiles
4626: on <a href=
1.1 grant 4627: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
4628: target="_top">ftp.NetBSD.org</a>, but downloading the
4629: entire directory may not be appropriate.</p>
4630:
1.14 xtraeme 4631: <p>The answer here is to do a <span><strong class=
4632: "command">make fetch-list</strong></span> in <code class=
4633: "filename">/usr/pkgsrc</code> or one of it's
1.1 grant 4634: subdirectories, carry the resulting list to your machine
1.23 wiz 4635: at work/school and use it there. If you don't have a
1.24 wiz 4636: NetBSD-compatible <a href=
4637: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
4638: <span class="citerefentry"><span class=
4639: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
4640: at work, don't forget to set <code class=
4641: "varname">FETCH_CMD</code> to something that fetches a
4642: URL:</p>
1.1 grant 4643:
4644: <p>At home:</p>
4645: <pre class="screen">
1.14 xtraeme 4646: <code class="prompt">%</code> <strong class=
4647: "userinput"><code>cd /usr/pkgsrc</code></strong>
4648: <code class="prompt">%</code> <strong class=
4649: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
4650: <code class="prompt">%</code> <strong class=
4651: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 4652: </pre>
4653:
4654: <p>At work:</p>
4655: <pre class="screen">
1.14 xtraeme 4656: <code class="prompt">%</code> <strong class=
4657: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 4658: </pre>
4659:
1.14 xtraeme 4660: <p>then tar up <code class=
4661: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 4662:
4663: <p>If you have a machine running NetBSD, and you want to
4664: get <span class="emphasis"><em>all</em></span> distfiles
4665: (even ones that aren't for your machine architecture),
4666: you can do so by using the above-mentioned
1.14 xtraeme 4667: <span><strong class="command">make
4668: fetch-list</strong></span> approach, or fetch the
4669: distfiles directly by running:</p>
1.1 grant 4670: <pre class="screen">
1.14 xtraeme 4671: <code class="prompt">%</code> <strong class=
4672: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 4673: </pre>
4674:
1.14 xtraeme 4675: <p>If you even decide to ignore <code class=
4676: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
4677: can get everything by running:</p>
1.1 grant 4678: <pre class="screen">
1.14 xtraeme 4679: <code class="prompt">%</code> <strong class=
4680: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 4681: </pre>
4682: </div>
4683:
4684: <div class="sect1" lang="en" xml:lang="en">
4685: <div class="titlepage">
4686: <div>
4687: <div>
4688: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4689: "tmac.andoc-missing" id=
4690: "tmac.andoc-missing"></a>6.11. What does
1.1 grant 4691: “<span class="quote">Don't know how to make
4692: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
4693: </div>
4694: </div>
4695: </div>
4696:
4697: <p>When compiling the <a xmlns=
4698: "http://www.w3.org/TR/xhtml1/transitional" href=
4699: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4700: class="pkgname">pkgtools/pkg_install</a> package, you get
4701: the error from make that it doesn't know how to make
4702: <code class="filename">/usr/share/tmac/tmac.andoc</code>?
4703: This indicates that you don't have installed the
1.23 wiz 4704: “<span class="quote">text</span>” set (nroff,
4705: ...) from the NetBSD base distribution on your machine.
4706: It is recommended to do that to format manpages.</p>
1.1 grant 4707:
4708: <p>In the case of the <a xmlns=
4709: "http://www.w3.org/TR/xhtml1/transitional" href=
4710: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4711: class="pkgname">pkgtools/pkg_install</a> package, you can
4712: get away with setting <code class=
4713: "varname">NOMAN=YES</code> either in the environment or
4714: in <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 4715: </div>
4716:
4717: <div class="sect1" lang="en" xml:lang="en">
4718: <div class="titlepage">
4719: <div>
4720: <div>
4721: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4722: "bsd.own.mk-missing" id=
4723: "bsd.own.mk-missing"></a>6.12. What does
1.1 grant 4724: “<span class="quote">Could not find
4725: bsd.own.mk</span>” mean?</h2>
4726: </div>
4727: </div>
4728: </div>
4729:
1.14 xtraeme 4730: <p>You didn't install the compiler set, <code class=
4731: "filename">comp.tgz</code>, when you installed your
4732: NetBSD machine. Please get it and install it, by
4733: extracting it in <code class="filename">/</code>:</p>
1.1 grant 4734: <pre class="screen">
1.14 xtraeme 4735: <code class="prompt">#</code> <strong class=
4736: "userinput"><code>cd /</code></strong>
4737: <code class="prompt">#</code> <strong class=
4738: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 4739: </pre>
4740:
1.14 xtraeme 4741: <p><code class="filename">comp.tgz</code> is part of
4742: every NetBSD release. Get the one that corresponds to
4743: your release (determine via <span><strong class=
4744: "command">uname -r</strong></span>).</p>
1.1 grant 4745: </div>
4746:
4747: <div class="sect1" lang="en" xml:lang="en">
4748: <div class="titlepage">
4749: <div>
4750: <div>
4751: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4752: "using-sudo-with-pkgsrc" id=
4753: "using-sudo-with-pkgsrc"></a>6.13. Using
1.1 grant 4754: 'sudo' with pkgsrc</h2>
4755: </div>
4756: </div>
4757: </div>
4758:
4759: <p>When installing packages as non-root user and using
1.24 wiz 4760: the just-in-time <a href=
4761: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
4762: <span class="citerefentry"><span class=
4763: "refentrytitle">su</span>(1)</span></a> feature of
4764: pkgsrc, it can become annoying to type in the root
4765: password for each required package installed. To avoid
4766: this, the sudo package can be used, which does password
4767: caching over a limited time. To use it, install sudo
4768: (either as binary package or from <a xmlns=
4769: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4770: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.20 ben 4771: class="pkgname">security/sudo</a>) and then put the
4772: following into your <code class=
4773: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4774: <pre class="programlisting">
1.34 wiz 4775: .if exists(${LOCALBASE}/bin/sudo)
4776: SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
4777: .endif
1.1 grant 4778: </pre>
4779: </div>
4780:
4781: <div class="sect1" lang="en" xml:lang="en">
4782: <div class="titlepage">
4783: <div>
4784: <div>
4785: <h2 class="title" style="clear: both"><a name=
1.35 jmmv 4786: "faq.conf" id="faq.conf"></a>6.14. How do I
4787: change the location of configuration files?</h2>
1.1 grant 4788: </div>
4789: </div>
4790: </div>
4791:
1.35 jmmv 4792: <p>As the system administrator, you can choose where
4793: configuration files are installed. The default settings
4794: make all these files go into <code class=
4795: "filename">${PREFIX}/etc</code> or some of its
4796: subdirectories; this may be suboptimal depending on your
4797: expectations (e.g., a read-only, NFS-exported
4798: <code class="varname">PREFIX</code> with a need of
4799: per-machine configuration of the provided packages).</p>
4800:
4801: <p>In order to change the defaults, you can modify the
4802: <code class="varname">PKG_SYSCONFBASE</code> variable (in
4803: <code class="filename">/etc/mk.conf</code>) to point to
4804: your preferred configuration directory; some common
4805: examples include <code class="filename">/etc</code> or
4806: <code class="filename">/etc/pkg</code>.</p>
4807:
4808: <p>Furthermore, you can change this value on a
4809: per-package basis by setting the <code class=
4810: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
4811: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
4812: value usually matches the name of the package you would
4813: like to modify, that is, the contents of <code class=
4814: "varname">PKGBASE</code>.</p>
1.1 grant 4815:
1.35 jmmv 4816: <p>Note that, after changing these settings, you must
4817: rebuild and reinstall any affected packages.</p>
1.1 grant 4818: </div>
4819:
4820: <div class="sect1" lang="en" xml:lang="en">
4821: <div class="titlepage">
4822: <div>
4823: <div>
4824: <h2 class="title" style="clear: both"><a name=
4825: "audit-packages" id=
1.14 xtraeme 4826: "audit-packages"></a>6.15. Automated security
1.1 grant 4827: checks</h2>
4828: </div>
4829: </div>
4830: </div>
4831:
4832: <p>Please be aware that there can often be bugs in
4833: third-party software, and some of these bugs can leave a
4834: machine vulnerable to exploitation by attackers. In an
4835: effort to lessen the exposure, the NetBSD packages team
4836: maintains a database of known-exploits to packages which
4837: have at one time been included in pkgsrc. The database
4838: can be downloaded automatically, and a security audit of
4839: all packages installed on a system can take place. To do
4840: this, install the <a xmlns=
4841: "http://www.w3.org/TR/xhtml1/transitional" href=
4842: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.20 ben 4843: class="pkgname">security/audit-packages</a> package. It
4844: has two components:</p>
1.1 grant 4845:
4846: <div class="orderedlist">
4847: <ol type="1">
4848: <li>
1.34 wiz 4849: <p><span><strong class=
4850: "command">download-vulnerability-list</strong></span>,
1.1 grant 4851: an easy way to download a list of the security
4852: vulnerabilities information. This list is kept up
4853: to date by the NetBSD security officer and the
4854: NetBSD packages team, and is distributed from the
4855: NetBSD ftp server:</p>
4856:
4857: <p><a href=
4858: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 4859: target=
4860: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 4861: </li>
4862:
4863: <li>
1.34 wiz 4864: <p><span><strong class=
4865: "command">audit-packages</strong></span>, an easy
4866: way to audit the current machine, checking each
1.1 grant 4867: vulnerability which is known. If a vulnerable
4868: package is installed, it will be shown by output to
4869: stdout, including a description of the type of
4870: vulnerability, and a URL containing more
4871: information.</p>
4872: </li>
4873: </ol>
4874: </div>
4875:
1.23 wiz 4876: <p>Use of the <a xmlns=
4877: "http://www.w3.org/TR/xhtml1/transitional" href=
4878: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
4879: class="pkgname">security/audit-packages</a> package is
4880: strongly recommended! After “<span class=
4881: "quote">audit-packages</span>” is installed, please
4882: read the package's message, which you can get by running
4883: <strong class="userinput"><code>pkg_info -D
4884: audit-package</code></strong>.</p>
1.1 grant 4885: </div>
4886: </div>
4887: </div>
4888:
4889: <div class="part" lang="en" xml:lang="en">
4890: <div class="titlepage">
4891: <div>
4892: <div>
4893: <h1 class="title"><a name="developers-guide" id=
1.2 hubertf 4894: "developers-guide"></a>The pkgsrc developer's
4895: guide</h1>
1.1 grant 4896: </div>
4897: </div>
4898: </div>
4899:
4900: <div class="toc">
4901: <p><b>Table of Contents</b></p>
4902:
4903: <dl>
1.27 rillig 4904: <dt><span class="chapter"><a href="#components">7.
4905: Package components - files, directories and
4906: contents</a></span></dt>
4907:
4908: <dd>
4909: <dl>
4910: <dt><span class="sect1"><a href=
4911: "#components.Makefile">7.1. <code class=
4912: "filename">Makefile</code></a></span></dt>
4913:
4914: <dt><span class="sect1"><a href=
4915: "#components.distinfo">7.2. <code class=
4916: "filename">distinfo</code></a></span></dt>
4917:
4918: <dt><span class="sect1"><a href=
4919: "#components.patches">7.3. patches/*</a></span></dt>
4920:
1.30 wiz 4921: <dt><span class="sect1"><a href=
4922: "#other-mandatory-files">7.4. Other mandatory
4923: files</a></span></dt>
1.27 rillig 4924:
4925: <dt><span class="sect1"><a href=
4926: "#components.optional">7.5. Optional
4927: files</a></span></dt>
4928:
1.30 wiz 4929: <dt><span class="sect1"><a href="#work-dir">7.6.
1.27 rillig 4930: <code class="filename">work*</code></a></span></dt>
4931:
1.30 wiz 4932: <dt><span class="sect1"><a href="#files-dir">7.7.
1.27 rillig 4933: <code class="filename">files/*</code></a></span></dt>
4934: </dl>
4935: </dd>
4936:
4937: <dt><span class="chapter"><a href="#makefile">8.
1.25 rillig 4938: Programming in <code class=
4939: "filename">Makefile</code>s</a></span></dt>
4940:
4941: <dd>
4942: <dl>
4943: <dt><span class="sect1"><a href=
1.27 rillig 4944: "#makefile.variables">8.1. <code class=
1.25 rillig 4945: "filename">Makefile</code> variables</a></span></dt>
4946:
1.27 rillig 4947: <dd>
4948: <dl>
4949: <dt><span class="sect2"><a href=
4950: "#makefile.variables.names">8.1.1. Naming
4951: conventions</a></span></dt>
4952: </dl>
4953: </dd>
4954:
4955: <dt><span class="sect1"><a href="#makefile.code">8.2.
1.25 rillig 4956: Code snippets</a></span></dt>
4957:
4958: <dd>
4959: <dl>
4960: <dt><span class="sect2"><a href=
1.30 wiz 4961: "#adding-to-list">8.2.1. Adding things to a
1.25 rillig 4962: list</a></span></dt>
4963:
4964: <dt><span class="sect2"><a href=
1.30 wiz 4965: "#converting-internal-to-external">8.2.2.
4966: Converting an internal list into an external
4967: list</a></span></dt>
1.25 rillig 4968:
4969: <dt><span class="sect2"><a href=
1.30 wiz 4970: "#passing-variable-to-shell">8.2.3. Passing
4971: variables to a shell command</a></span></dt>
1.27 rillig 4972:
4973: <dt><span class="sect2"><a href=
1.30 wiz 4974: "#quoting-guideline">8.2.4. Quoting
1.27 rillig 4975: guideline</a></span></dt>
4976:
4977: <dt><span class="sect2"><a href=
1.30 wiz 4978: "#bsd-make-bug-workaround">8.2.5. Workaround for
4979: a bug in BSD Make</a></span></dt>
1.25 rillig 4980: </dl>
4981: </dd>
4982: </dl>
4983: </dd>
4984:
4985: <dt><span class="chapter"><a href="#plist">9. PLIST
1.1 grant 4986: issues</a></span></dt>
4987:
4988: <dd>
4989: <dl>
1.30 wiz 4990: <dt><span class="sect1"><a href="#rcs-id">9.1. RCS
1.1 grant 4991: ID</a></span></dt>
4992:
1.30 wiz 4993: <dt><span class="sect1"><a href=
4994: "#automatic-plist-generation">9.2. Semi-automatic
4995: <code class="filename">PLIST</code>
1.14 xtraeme 4996: generation</a></span></dt>
1.1 grant 4997:
1.25 rillig 4998: <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14 xtraeme 4999: Tweaking output of <span><strong class="command">make
5000: print-PLIST</strong></span></a></span></dt>
1.1 grant 5001:
1.25 rillig 5002: <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1 grant 5003: Variable substitution in PLIST</a></span></dt>
5004:
1.30 wiz 5005: <dt><span class="sect1"><a href=
5006: "#manpage-compression">9.5.
1.1 grant 5007: Manpage-compression</a></span></dt>
5008:
1.30 wiz 5009: <dt><span class="sect1"><a href=
5010: "#using-PLIST_SRC">9.6. Changing PLIST source with
5011: <code class=
1.14 xtraeme 5012: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5013:
1.30 wiz 5014: <dt><span class="sect1"><a href=
5015: "#platform-specific-plist">9.7. Platform specific and
5016: differing PLISTs</a></span></dt>
1.1 grant 5017:
5018: <dt><span class="sect1"><a href=
1.25 rillig 5019: "#faq.common-dirs">9.8. Sharing directories between
1.1 grant 5020: packages</a></span></dt>
5021: </dl>
5022: </dd>
5023:
1.25 rillig 5024: <dt><span class="chapter"><a href="#buildlink">10.
1.1 grant 5025: Buildlink methodology</a></span></dt>
5026:
5027: <dd>
5028: <dl>
1.30 wiz 5029: <dt><span class="sect1"><a href=
5030: "#converting-to-buildlink3">10.1. Converting packages
5031: to use buildlink3</a></span></dt>
1.1 grant 5032:
1.30 wiz 5033: <dt><span class="sect1"><a href=
5034: "#creating-buildlink3.mk">10.2. Writing <code class=
5035: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 5036:
5037: <dd>
5038: <dl>
5039: <dt><span class="sect2"><a href=
1.30 wiz 5040: "#anatomy-of-bl3">10.2.1. Anatomy of a
5041: buildlink3.mk file</a></span></dt>
1.1 grant 5042:
5043: <dt><span class="sect2"><a href=
1.30 wiz 5044: "#updating-buildlink-depends">10.2.2. Updating
5045: <code class=
5046: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
5047: <code>pkg</code></em></code> in <code class=
5048: "filename">buildlink3.mk</code>
1.1 grant 5049: files</a></span></dt>
5050: </dl>
5051: </dd>
5052:
1.30 wiz 5053: <dt><span class="sect1"><a href=
5054: "#writing-builtin.mk">10.3. Writing <code class=
5055: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 5056:
5057: <dd>
5058: <dl>
5059: <dt><span class="sect2"><a href=
1.30 wiz 5060: "#anatomy-of-builtin.mk">10.3.1. Anatomy of a
5061: <code class="filename">builtin.mk</code>
5062: file</a></span></dt>
1.1 grant 5063:
5064: <dt><span class="sect2"><a href=
1.30 wiz 5065: "#native-or-pkgsrc-preference">10.3.2. Global
5066: preferences for native or pkgsrc
5067: software</a></span></dt>
1.1 grant 5068: </dl>
5069: </dd>
5070: </dl>
5071: </dd>
5072:
1.35 jmmv 5073: <dt><span class="chapter"><a href="#pkginstall">11. The
5074: pkginstall framework</a></span></dt>
5075:
5076: <dd>
5077: <dl>
5078: <dt><span class="sect1"><a href=
5079: "#files-and-dirs-outside-prefix">11.1. Files and
5080: directories outside the installation
5081: prefix</a></span></dt>
5082:
5083: <dd>
5084: <dl>
5085: <dt><span class="sect2"><a href=
5086: "#dirs-outside-prefix">11.1.1. Directory
5087: manipulation</a></span></dt>
5088:
5089: <dt><span class="sect2"><a href=
5090: "#files-outside-prefix">11.1.2. File
5091: manipulation</a></span></dt>
5092: </dl>
5093: </dd>
5094:
5095: <dt><span class="sect1"><a href="#conf-files">11.2.
5096: Configuration files</a></span></dt>
5097:
5098: <dd>
5099: <dl>
5100: <dt><span class="sect2"><a href=
5101: "#conf-files-sysconfdir">11.2.1. How <code class=
5102: "varname">PKG_SYSCONFDIR</code> is
5103: set</a></span></dt>
5104:
5105: <dt><span class="sect2"><a href=
5106: "#conf-files-configure">11.2.2. Telling the
5107: software were configuration files
5108: are</a></span></dt>
5109:
5110: <dt><span class="sect2"><a href=
5111: "#conf-files-patching">11.2.3. Patching
5112: installations</a></span></dt>
5113:
5114: <dt><span class="sect2"><a href=
5115: "#conf-files-disable">11.2.4. Disabling handling
5116: of configuration files</a></span></dt>
5117: </dl>
5118: </dd>
5119:
5120: <dt><span class="sect1"><a href="#rcd-scripts">11.3.
5121: System startup scripts</a></span></dt>
5122:
5123: <dd>
5124: <dl>
5125: <dt><span class="sect2"><a href=
5126: "#rcd-scripts-disable">11.3.1. Disabling handling
5127: of system startup scripts</a></span></dt>
5128: </dl>
5129: </dd>
5130:
5131: <dt><span class="sect1"><a href=
5132: "#users-and-groups">11.4. System users and
5133: groups</a></span></dt>
5134:
5135: <dt><span class="sect1"><a href="#shells">11.5.
5136: System shells</a></span></dt>
5137:
5138: <dd>
5139: <dl>
5140: <dt><span class="sect2"><a href=
5141: "#shells-disable">11.5.1. Disabling handling of
5142: configuration files</a></span></dt>
5143: </dl>
5144: </dd>
5145: </dl>
5146: </dd>
5147:
5148: <dt><span class="chapter"><a href="#options">12. Options
1.1 grant 5149: handling</a></span></dt>
5150:
5151: <dd>
5152: <dl>
1.30 wiz 5153: <dt><span class="sect1"><a href=
1.35 jmmv 5154: "#global-default-options">12.1. Global default
1.30 wiz 5155: options</a></span></dt>
1.1 grant 5156:
1.30 wiz 5157: <dt><span class="sect1"><a href=
1.35 jmmv 5158: "#converting-to-options">12.2. Converting packages to
1.30 wiz 5159: use <code class=
1.14 xtraeme 5160: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 5161: </dl>
5162: </dd>
5163:
1.35 jmmv 5164: <dt><span class="chapter"><a href="#build">13. The build
1.1 grant 5165: process</a></span></dt>
5166:
5167: <dd>
5168: <dl>
1.35 jmmv 5169: <dt><span class="sect1"><a href="#build.prefix">13.1.
1.1 grant 5170: Program location</a></span></dt>
5171:
1.35 jmmv 5172: <dt><span class="sect1"><a href="#main-targets">13.2.
1.1 grant 5173: Main targets</a></span></dt>
5174:
5175: <dt><span class="sect1"><a href=
1.35 jmmv 5176: "#build.helpful-targets">13.3. Other helpful
1.1 grant 5177: targets</a></span></dt>
5178: </dl>
5179: </dd>
5180:
1.35 jmmv 5181: <dt><span class="chapter"><a href="#fixes">14. Notes on
1.1 grant 5182: fixes for packages</a></span></dt>
5183:
5184: <dd>
5185: <dl>
1.30 wiz 5186: <dt><span class="sect1"><a href=
1.35 jmmv 5187: "#general-operation">14.1. General
1.30 wiz 5188: operation</a></span></dt>
1.1 grant 5189:
5190: <dd>
5191: <dl>
5192: <dt><span class="sect2"><a href=
1.35 jmmv 5193: "#pulling-vars-from-etc-mk.conf">14.1.1. How to
1.30 wiz 5194: pull in variables from
5195: /etc/mk.conf</a></span></dt>
1.1 grant 5196:
5197: <dt><span class="sect2"><a href=
1.35 jmmv 5198: "#where-to-install-documentation">14.1.2. Where
1.31 wiz 5199: to install documentation</a></span></dt>
5200:
5201: <dt><span class="sect2"><a href=
1.35 jmmv 5202: "#restricted-packages">14.1.3. Restricted
1.1 grant 5203: packages</a></span></dt>
5204:
5205: <dt><span class="sect2"><a href=
1.35 jmmv 5206: "#dependencies">14.1.4. Handling
1.1 grant 5207: dependencies</a></span></dt>
5208:
5209: <dt><span class="sect2"><a href=
1.35 jmmv 5210: "#conflicts">14.1.5. Handling conflicts with
1.1 grant 5211: other packages</a></span></dt>
5212:
5213: <dt><span class="sect2"><a href=
1.35 jmmv 5214: "#not-building-packages">14.1.6. Packages that
1.30 wiz 5215: cannot or should not be built</a></span></dt>
1.1 grant 5216:
5217: <dt><span class="sect2"><a href=
1.35 jmmv 5218: "#undeletable-packages">14.1.7. Packages which
1.30 wiz 5219: should not be deleted, once
5220: installed</a></span></dt>
1.1 grant 5221:
5222: <dt><span class="sect2"><a href=
1.35 jmmv 5223: "#security-handling">14.1.8. Handling packages
1.1 grant 5224: with security problems</a></span></dt>
5225:
5226: <dt><span class="sect2"><a href=
1.35 jmmv 5227: "#compiler-bugs">14.1.9. How to handle compiler
1.1 grant 5228: bugs</a></span></dt>
5229:
5230: <dt><span class="sect2"><a href=
1.35 jmmv 5231: "#bumping-pkgrevision">14.1.10. How to handle
1.30 wiz 5232: incrementing versions when fixing an existing
1.1 grant 5233: package</a></span></dt>
5234:
5235: <dt><span class="sect2"><a href=
1.35 jmmv 5236: "#portability-of-packages">14.1.11. Portability
1.30 wiz 5237: of packages</a></span></dt>
1.1 grant 5238: </dl>
5239: </dd>
5240:
1.30 wiz 5241: <dt><span class="sect1"><a href=
1.35 jmmv 5242: "#downloading-issues">14.2. Possible downloading
1.30 wiz 5243: issues</a></span></dt>
1.1 grant 5244:
5245: <dd>
5246: <dl>
5247: <dt><span class="sect2"><a href=
1.35 jmmv 5248: "#no-plain-download">14.2.1. Packages whose
1.30 wiz 5249: distfiles aren't available for plain
1.1 grant 5250: downloading</a></span></dt>
5251:
5252: <dt><span class="sect2"><a href=
1.35 jmmv 5253: "#modified-distfiles-same-name">14.2.2. How to
1.30 wiz 5254: handle modified distfiles with the 'old'
5255: name</a></span></dt>
1.1 grant 5256: </dl>
5257: </dd>
5258:
1.30 wiz 5259: <dt><span class="sect1"><a href=
1.35 jmmv 5260: "#configuration-gotchas">14.3. Configuration
1.30 wiz 5261: gotchas</a></span></dt>
1.1 grant 5262:
5263: <dd>
5264: <dl>
5265: <dt><span class="sect2"><a href=
1.35 jmmv 5266: "#fixes.libtool">14.3.1. Shared libraries -
1.1 grant 5267: libtool</a></span></dt>
5268:
5269: <dt><span class="sect2"><a href=
1.35 jmmv 5270: "#using-libtool">14.3.2. Using libtool on GNU
1.1 grant 5271: packages that already support
5272: libtool</a></span></dt>
5273:
5274: <dt><span class="sect2"><a href=
1.35 jmmv 5275: "#autoconf-automake">14.3.3. GNU
1.1 grant 5276: Autoconf/Automake</a></span></dt>
5277: </dl>
5278: </dd>
5279:
1.30 wiz 5280: <dt><span class="sect1"><a href=
1.35 jmmv 5281: "#building-considerations">14.4. Building
1.30 wiz 5282: considerations</a></span></dt>
1.1 grant 5283:
5284: <dd>
5285: <dl>
5286: <dt><span class="sect2"><a href=
1.35 jmmv 5287: "#cpp-defines">14.4.1. CPP
1.30 wiz 5288: defines</a></span></dt>
1.1 grant 5289: </dl>
5290: </dd>
5291:
1.30 wiz 5292: <dt><span class="sect1"><a href=
1.35 jmmv 5293: "#package-specific-actions">14.5. Package specific
1.30 wiz 5294: actions</a></span></dt>
1.1 grant 5295:
5296: <dd>
5297: <dl>
5298: <dt><span class="sect2"><a href=
1.35 jmmv 5299: "#user-interaction">14.5.1. User
1.2 hubertf 5300: interaction</a></span></dt>
1.1 grant 5301:
5302: <dt><span class="sect2"><a href=
1.35 jmmv 5303: "#handling-licenses">14.5.2. Handling
1.1 grant 5304: licenses</a></span></dt>
5305:
5306: <dt><span class="sect2"><a href=
1.35 jmmv 5307: "#installing-score-files">14.5.3. Installing
1.30 wiz 5308: score files</a></span></dt>
1.1 grant 5309:
5310: <dt><span class="sect2"><a href=
1.35 jmmv 5311: "#perl-scripts">14.5.4. Packages containing perl
1.1 grant 5312: scripts</a></span></dt>
5313:
5314: <dt><span class="sect2"><a href=
1.35 jmmv 5315: "#hardcoded-paths">14.5.5. Packages with
1.30 wiz 5316: hardcoded paths to other
5317: interpreters</a></span></dt>
1.1 grant 5318:
5319: <dt><span class="sect2"><a href=
1.35 jmmv 5320: "#perl-modules">14.5.6. Packages installing perl
1.1 grant 5321: modules</a></span></dt>
5322:
5323: <dt><span class="sect2"><a href=
1.35 jmmv 5324: "#faq.info-files">14.5.7. Packages installing
1.1 grant 5325: info files</a></span></dt>
5326:
5327: <dt><span class="sect2"><a href=
1.35 jmmv 5328: "#gconf2-data-files">14.5.8. Packages installing
1.30 wiz 5329: GConf2 data files</a></span></dt>
1.1 grant 5330:
5331: <dt><span class="sect2"><a href=
1.35 jmmv 5332: "#scrollkeeper-data-files">14.5.9. Packages
1.30 wiz 5333: installing scrollkeeper data
5334: files</a></span></dt>
1.1 grant 5335:
5336: <dt><span class="sect2"><a href=
1.35 jmmv 5337: "#x11-fonts">14.5.10. Packages installing X11
1.1 grant 5338: fonts</a></span></dt>
5339:
5340: <dt><span class="sect2"><a href=
1.35 jmmv 5341: "#gtk2-modules">14.5.11. Packages installing GTK2
1.1 grant 5342: modules</a></span></dt>
5343:
5344: <dt><span class="sect2"><a href=
1.35 jmmv 5345: "#sgml-xml-data">14.5.12. Packages installing
1.30 wiz 5346: SGML or XML data</a></span></dt>
1.1 grant 5347:
5348: <dt><span class="sect2"><a href=
1.35 jmmv 5349: "#mime-database">14.5.13. Packages installing
1.1 grant 5350: extensions to the MIME database</a></span></dt>
5351:
5352: <dt><span class="sect2"><a href=
1.35 jmmv 5353: "#intltool">14.5.14. Packages using
1.1 grant 5354: intltool</a></span></dt>
1.18 xtraeme 5355:
5356: <dt><span class="sect2"><a href=
1.35 jmmv 5357: "#startup-scripts">14.5.15. Packages installing
1.30 wiz 5358: startup scripts</a></span></dt>
1.1 grant 5359: </dl>
5360: </dd>
5361:
1.30 wiz 5362: <dt><span class="sect1"><a href=
1.35 jmmv 5363: "#feedback-to-author">14.6. Feedback to the
1.30 wiz 5364: author</a></span></dt>
1.1 grant 5365: </dl>
5366: </dd>
5367:
1.35 jmmv 5368: <dt><span class="chapter"><a href="#debug">15.
1.1 grant 5369: Debugging</a></span></dt>
5370:
1.35 jmmv 5371: <dt><span class="chapter"><a href="#submit">16.
1.1 grant 5372: Submitting and Committing</a></span></dt>
5373:
5374: <dd>
5375: <dl>
1.30 wiz 5376: <dt><span class="sect1"><a href=
1.35 jmmv 5377: "#submitting-your-package">16.1. Submitting your
1.30 wiz 5378: packages</a></span></dt>
1.1 grant 5379:
1.30 wiz 5380: <dt><span class="sect1"><a href=
1.35 jmmv 5381: "#committing-importing">16.2. Committing: Importing a
1.30 wiz 5382: package into CVS</a></span></dt>
1.1 grant 5383:
1.30 wiz 5384: <dt><span class="sect1"><a href=
1.35 jmmv 5385: "#updating-package">16.3. Updating a package to a
1.30 wiz 5386: newer version</a></span></dt>
1.1 grant 5387:
1.30 wiz 5388: <dt><span class="sect1"><a href=
1.35 jmmv 5389: "#moving-package">16.4. Moving a package in
1.30 wiz 5390: pkgsrc</a></span></dt>
1.1 grant 5391: </dl>
5392: </dd>
5393: </dl>
5394: </div>
5395:
5396: <div class="chapter" lang="en" xml:lang="en">
5397: <div class="titlepage">
5398: <div>
5399: <div>
1.27 rillig 5400: <h2 class="title"><a name="components" id=
5401: "components"></a>Chapter 7. Package
5402: components - files, directories and contents</h2>
1.25 rillig 5403: </div>
5404: </div>
5405: </div>
5406:
5407: <div class="toc">
5408: <p><b>Table of Contents</b></p>
5409:
5410: <dl>
5411: <dt><span class="sect1"><a href=
1.27 rillig 5412: "#components.Makefile">7.1. <code class=
5413: "filename">Makefile</code></a></span></dt>
5414:
5415: <dt><span class="sect1"><a href=
5416: "#components.distinfo">7.2. <code class=
5417: "filename">distinfo</code></a></span></dt>
5418:
5419: <dt><span class="sect1"><a href=
5420: "#components.patches">7.3. patches/*</a></span></dt>
1.25 rillig 5421:
1.30 wiz 5422: <dt><span class="sect1"><a href=
5423: "#other-mandatory-files">7.4. Other mandatory
5424: files</a></span></dt>
1.25 rillig 5425:
1.27 rillig 5426: <dt><span class="sect1"><a href=
5427: "#components.optional">7.5. Optional
5428: files</a></span></dt>
1.25 rillig 5429:
1.30 wiz 5430: <dt><span class="sect1"><a href="#work-dir">7.6.
1.27 rillig 5431: <code class="filename">work*</code></a></span></dt>
1.25 rillig 5432:
1.30 wiz 5433: <dt><span class="sect1"><a href="#files-dir">7.7.
1.27 rillig 5434: <code class="filename">files/*</code></a></span></dt>
1.25 rillig 5435: </dl>
5436: </div>
5437:
1.27 rillig 5438: <p>Whenever you're preparing a package, there are a number
5439: of files involved which are described in the following
5440: sections.</p>
1.25 rillig 5441:
5442: <div class="sect1" lang="en" xml:lang="en">
5443: <div class="titlepage">
5444: <div>
5445: <div>
5446: <h2 class="title" style="clear: both"><a name=
1.27 rillig 5447: "components.Makefile" id=
5448: "components.Makefile"></a>7.1. <code class=
5449: "filename">Makefile</code></h2>
1.25 rillig 5450: </div>
5451: </div>
5452: </div>
5453:
1.27 rillig 5454: <p>Building, installation and creation of a binary
5455: package are all controlled by the package's <code class=
5456: "filename">Makefile</code>. The <code class=
5457: "filename">Makefile</code> describes various things about
5458: a package, for example from where to get it, how to
5459: configure, build, and install it.</p>
5460:
5461: <p>A package <code class="filename">Makefile</code>
5462: contains several sections that describe the package.</p>
1.25 rillig 5463:
1.27 rillig 5464: <p>In the first section there are the following
5465: variables, which should appear exactly in the order given
5466: here.</p>
1.25 rillig 5467:
5468: <div class="itemizedlist">
5469: <ul type="disc">
5470: <li>
1.27 rillig 5471: <p><code class="varname">DISTNAME</code> is the
5472: basename of the distribution file to be downloaded
5473: from the package's website.</p>
5474: </li>
5475:
5476: <li>
5477: <p><code class="varname">PKGNAME</code> is the name
5478: of the package, as used by pkgsrc. You only need to
5479: provide it if it differs from DISTNAME. Usually it
5480: is the directory name together with the version
5481: number. It must match the regular expression
5482: <code class=
5483: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
5484: that is, it starts with a letter or digit, and
5485: contains only letters, digits, dashes, underscores,
5486: dots and plus signs.</p>
1.25 rillig 5487: </li>
5488:
5489: <li>
1.27 rillig 5490: <p><code class="varname">CATEGORIES</code> is a
5491: list of categories which the package fits in. You
5492: can choose any of the top-level directories of
5493: pkgsrc for it.</p>
1.25 rillig 5494: </li>
5495:
5496: <li>
1.27 rillig 5497: <p><code class="varname">MASTER_SITES</code> is a
5498: list of URLs where the distribution files can be
5499: downloaded. Each URL must end with a slash.</p>
1.25 rillig 5500: </li>
5501: </ul>
5502: </div>
5503:
1.27 rillig 5504: <p>The second section contains the following
5505: variables.</p>
1.25 rillig 5506:
1.27 rillig 5507: <div class="itemizedlist">
5508: <ul type="disc">
5509: <li>
5510: <p><code class="varname">MAINTAINER</code> is the
5511: mail address of the package's maintainer, which is
5512: the person you can contact when the package does
5513: not work.</p>
5514: </li>
1.25 rillig 5515:
1.27 rillig 5516: <li>
5517: <p><code class="varname">HOMEPAGE</code> is a URL
5518: where users can find more information about the
1.23 wiz 5519: package.</p>
5520: </li>
1.1 grant 5521:
1.23 wiz 5522: <li>
5523: <p><code class="varname">COMMENT</code> is a
5524: one-line comment about the purpose of the
5525: package.</p>
5526: </li>
5527: </ul>
5528: </div>
1.1 grant 5529:
1.14 xtraeme 5530: <p>The <code class="varname">MASTER_SITES</code> may be
5531: set to one of the predefined sites:</p>
1.1 grant 5532: <pre class="programlisting">
5533: ${MASTER_SITE_APACHE}
1.27 rillig 5534: ${MASTER_SITE_BACKUP}
5535: ${MASTER_SITE_CYGWIN}
1.1 grant 5536: ${MASTER_SITE_DEBIAN}
1.27 rillig 5537: ${MASTER_SITE_FREEBSD}
5538: ${MASTER_SITE_FREEBSD_LOCAL}
1.1 grant 5539: ${MASTER_SITE_GNOME}
5540: ${MASTER_SITE_GNU}
5541: ${MASTER_SITE_GNUSTEP}
1.9 dillo 5542: ${MASTER_SITE_IFARCHIVE}
1.1 grant 5543: ${MASTER_SITE_MOZILLA}
1.27 rillig 5544: ${MASTER_SITE_OPENOFFICE}
1.1 grant 5545: ${MASTER_SITE_PERL_CPAN}
1.27 rillig 5546: ${MASTER_SITE_R_CRAN}
1.1 grant 5547: ${MASTER_SITE_SOURCEFORGE}
5548: ${MASTER_SITE_SUNSITE}
5549: ${MASTER_SITE_SUSE}
5550: ${MASTER_SITE_TEX_CTAN}
5551: ${MASTER_SITE_XCONTRIB}
1.27 rillig 5552: ${MASTER_SITE_XEMACS}
5553:
1.1 grant 5554: </pre>
5555:
5556: <p>If one of these predefined sites is chosen, you may
5557: require the ability to specify a subdirectory of that
5558: site. Since these macros may expand to more than one
5559: actual site, you <span class=
5560: "emphasis"><em>must</em></span> use the following
5561: construct to specify a subdirectory:</p>
5562: <pre class="programlisting">
5563: ${MASTER_SITE_GNU:=subdirectory/name/}
5564: ${MASTER_SITE_SOURCEFORGE:=project_name/}
5565: </pre>
5566:
5567: <p>Note the trailing slash after the subdirectory
5568: name.</p>
5569:
5570: <div class="note" style=
5571: "margin-left: 0.5in; margin-right: 0.5in;">
5572: <h3 class="title">Note</h3>
5573:
1.14 xtraeme 5574: <p><code class="varname">MASTER_SITE_SUBDIR</code> has
5575: been deprecated and <span class="emphasis"><em>should
5576: no longer be used</em></span>.</p>
1.1 grant 5577: </div>
5578:
1.14 xtraeme 5579: <p>If the package has multiple <code class=
5580: "varname">DISTFILES</code> or multiple <code class=
5581: "varname">PATCHFILES</code> from different sites, set
5582: <code class="varname">SITES_foo</code> to a list of URI's
1.1 grant 5583: where file “<span class="quote">foo</span>”
5584: may be found. “<span class=
5585: "quote">foo</span>” includes the suffix, e.g.</p>
5586: <pre class="programlisting">
5587: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
5588: DISTFILES+= foo-file.tar.gz
5589: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
5590: http://www.somewhereelse.com/mirror/somehow/
5591: </pre>
5592:
1.14 xtraeme 5593: <p>Note that the normal default setting of <code class=
5594: "varname">DISTFILES</code> must be made explicit if you
1.1 grant 5595: want to add to it (rather than replace it), as you
5596: usually would.</p>
5597:
5598: <p>Currently the following values are available for
1.14 xtraeme 5599: <code class="varname">CATEGORIES</code>. If more than one
5600: is used, they need to be separated by spaces:</p>
1.1 grant 5601: <pre class="programlisting">
5602: archivers cross geography meta-pkgs security
5603: audio databases graphics misc shells
5604: benchmarks devel ham multimedia sysutils
5605: biology editors inputmethod net textproc
5606: cad emulators lang news time
5607: chat finance mail parallel wm
5608: comms fonts math pkgtools www
5609: converters games mbone print x11
5610: </pre>
5611:
5612: <p>Please pay attention to the following gotchas:</p>
5613:
5614: <div class="itemizedlist">
5615: <ul type="disc">
5616: <li>
1.14 xtraeme 5617: <p>Add <code class="varname">MANCOMPRESSED</code>
5618: if manpages are installed in compressed form by the
5619: package; see comment in <code class=
5620: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 5621: </li>
5622:
5623: <li>
1.14 xtraeme 5624: <p>Replace <code class="filename">/usr/local</code>
1.1 grant 5625: with “<span class=
5626: "quote">${PREFIX}</span>” in all files (see
5627: patches, below).</p>
5628: </li>
5629:
5630: <li>
5631: <p>If the package installs any info files, see
5632: <a href="#faq.info-files" title=
1.35 jmmv 5633: "14.5.7. Packages installing info files">Section
5634: 14.5.7, “Packages installing info
1.1 grant 5635: files”</a>.</p>
5636: </li>
5637:
5638: <li>
1.14 xtraeme 5639: <p>Set <code class="varname">MAINTAINER</code> to
5640: be yourself. If you really can't maintain the
5641: package for future updates, set it to <code class=
1.1 grant 5642: "email"><<a href=
1.14 xtraeme 5643: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.1 grant 5644: </li>
5645:
5646: <li>
5647: <p>If a home page for the software in question
1.14 xtraeme 5648: exists, add the variable <code class=
5649: "varname">HOMEPAGE</code> right after <code class=
5650: "varname">MAINTAINER</code>. The value of this
1.1 grant 5651: variable should be the URL for the home page.</p>
5652: </li>
5653:
5654: <li>
1.14 xtraeme 5655: <p>Be sure to set the <code class=
5656: "varname">COMMENT</code> variable to a short
1.1 grant 5657: description of the package, not containing the
5658: pkg's name.</p>
5659: </li>
5660: </ul>
5661: </div>
5662: </div>
5663:
5664: <div class="sect1" lang="en" xml:lang="en">
5665: <div class="titlepage">
5666: <div>
5667: <div>
5668: <h2 class="title" style="clear: both"><a name=
5669: "components.distinfo" id=
1.27 rillig 5670: "components.distinfo"></a>7.2. <code class=
1.14 xtraeme 5671: "filename">distinfo</code></h2>
1.1 grant 5672: </div>
5673: </div>
5674: </div>
5675:
5676: <p>Most important, the mandatory message digest, or
5677: checksum, of all the distfiles needed for the package to
5678: compile, confirming they match the original file
5679: distributed by the author. This ensures that the distfile
5680: retrieved from the Internet has not been corrupted during
5681: transfer or altered by a malign force to introduce a
1.14 xtraeme 5682: security hole. It is generated using the
5683: <span><strong class="command">make
5684: makesum</strong></span> command. The digest algorithm
5685: used was, at one stage, md5, but that was felt lacking
5686: compared to sha1, and so sha1 is now the default
1.1 grant 5687: algorithm. The distfile size is also generated and stored
5688: in new distinfo files. The <a xmlns=
5689: "http://www.w3.org/TR/xhtml1/transitional" href=
5690: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20 ben 5691: class="pkgname">pkgtools/digest</a> utility calculates
5692: all of the digests in the distinfo file, and it provides
5693: various different algorithms. At the current time, the
5694: algorithms provided are: <span class=
5695: "emphasis"><em>md5</em></span>, <span class=
5696: "emphasis"><em>rmd160</em></span>, <span class=
5697: "emphasis"><em>sha1</em></span>, <span class=
5698: "emphasis"><em>sha256</em></span>, <span class=
5699: "emphasis"><em>sha384</em></span> and <span class=
5700: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 5701:
5702: <p>Some packages have different sets of distfiles on a
5703: per architecture basis, for example <a xmlns=
5704: "http://www.w3.org/TR/xhtml1/transitional" href=
5705: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.20 ben 5706: class="pkgname">www/navigator</a>). These are kept in the
5707: same distinfo file and care should be taken when
5708: upgrading such a package to ensure distfile information
5709: is not lost.</p>
1.1 grant 5710:
5711: <p>The message digest/checksum for all the official
1.14 xtraeme 5712: patches found in the <code class=
5713: "filename">patches/</code> directory (see <a href=
5714: "#components.patches" title=
1.27 rillig 5715: "7.3. patches/*">Section 7.3,
1.1 grant 5716: “patches/*”</a>) for the package is also
1.14 xtraeme 5717: stored in the <code class="filename">distinfo</code>
5718: file. This is a message digest/checksum of all lines in
5719: the patch file except the NetBSD RCS Id. This file is
5720: generated by invoking <span><strong class="command">make
5721: makepatchsum</strong></span> (or <span><strong class=
5722: "command">make mps</strong></span> if you're in a
5723: hurry).</p>
1.1 grant 5724: </div>
5725:
5726: <div class="sect1" lang="en" xml:lang="en">
5727: <div class="titlepage">
5728: <div>
5729: <div>
5730: <h2 class="title" style="clear: both"><a name=
5731: "components.patches" id=
1.27 rillig 5732: "components.patches"></a>7.3. patches/*</h2>
1.1 grant 5733: </div>
5734: </div>
5735: </div>
5736:
5737: <p>This directory contains files that are used by the
5738: <a href=
5739: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
5740: <span class="citerefentry"><span class=
5741: "refentrytitle">patch</span>(1)</span></a> command to
5742: modify the sources as distributed in the distribution
5743: file into a form that will compile and run perfectly on
5744: NetBSD. The files are applied successively in alphabetic
5745: order (as returned by a shell “<span class=
5746: "quote">patches/patch-*</span>” glob expansion), so
1.14 xtraeme 5747: <code class="filename">patch-aa</code> is applied before
5748: <code class="filename">patch-ab</code>, etc.</p>
1.1 grant 5749:
1.14 xtraeme 5750: <p>The <code class="filename">patch-*</code> files should
5751: be in <span><strong class="command">diff
5752: -bu</strong></span> format, and apply without a fuzz to
5753: avoid problems. (To force patches to apply with fuzz you
5754: can set <code class=
5755: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 5756: not put changes for more than one file into a single
5757: patch-file, as this will make future modifications more
5758: difficult.</p>
5759:
5760: <p>Similar, a file should be patched at most once, not
5761: several times by several different patches. If a file
5762: needs several patches, they should be combined into one
5763: file.</p>
5764:
5765: <p>One important thing to mention is to pay attention
5766: that no RCS IDs get stored in the patch files, as these
5767: will cause problems when later checked into the NetBSD
1.14 xtraeme 5768: CVS tree. Use the <span><strong class=
5769: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 5770: "http://www.w3.org/TR/xhtml1/transitional" href=
5771: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 5772: class="pkgname">pkgtools/pkgdiff</a> package to avoid
5773: these problems.</p>
1.1 grant 5774:
5775: <p>For even more automation, we recommend using
1.14 xtraeme 5776: <span><strong class="command">mkpatches</strong></span>
5777: from the same package to make a whole set of patches. You
5778: just have to backup files before you edit them to
5779: <code class="filename">filename.orig</code>, e.g. with
5780: <span><strong class="command">cp -p filename
5781: filename.orig</strong></span> or, easier, by using
5782: <span><strong class="command">pkgvi</strong></span> again
5783: from the same package. If you upgrade a package this way,
5784: you can easily compare the new set of patches with the
5785: previously existing one with <span><strong class=
5786: "command">patchdiff</strong></span>.</p>
1.1 grant 5787:
5788: <p>When you have finished a package, remember to generate
5789: the checksums for the patch files by using the
1.14 xtraeme 5790: <span><strong class="command">make
5791: makepatchsum</strong></span> command, see <a href=
5792: "#components.distinfo" title=
1.27 rillig 5793: "7.2. distinfo">Section 7.2,
1.14 xtraeme 5794: “<code class="filename">distinfo</code>”</a>.</p>
1.1 grant 5795:
5796: <p>Patch files that are distributed by the author or
1.14 xtraeme 5797: other maintainers can be listed in <code class=
5798: "varname">$PATCHFILES</code>.</p>
1.1 grant 5799:
5800: <p>If it is desired to store any patches that should not
5801: be committed into pkgsrc, they can be kept outside the
1.14 xtraeme 5802: pkgsrc tree in the <code class=
5803: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 5804: tree there is expected to have the same
5805: “<span class="quote">category/package</span>”
5806: structure as pkgsrc, and patches are expected to be
1.14 xtraeme 5807: stored inside these dirs (also known as <code class=
5808: "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
5809: you want to keep a private patch for <code class=
5810: "filename">pkgsrc/graphics/png</code>, keep it in
5811: <code class=
5812: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
5813: files in the named directory are expected to be patch
1.1 grant 5814: files, and <span class="emphasis"><em>they are applied
5815: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 5816: </div>
5817:
5818: <div class="sect1" lang="en" xml:lang="en">
5819: <div class="titlepage">
5820: <div>
5821: <div>
5822: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5823: "other-mandatory-files" id=
5824: "other-mandatory-files"></a>7.4. Other
1.27 rillig 5825: mandatory files</h2>
5826: </div>
5827: </div>
5828: </div>
5829:
5830: <div class="variablelist">
5831: <dl>
5832: <dt><span class="term"><code class=
5833: "filename">DESCR</code></span></dt>
5834:
5835: <dd>
5836: <p>A multi-line description of the piece of
5837: software. This should include any credits where
5838: they are due. Please bear in mind that others do
5839: not share your sense of humour (or spelling
5840: idiosyncrasies), and that others will read
5841: everything that you write here.</p>
5842: </dd>
5843:
5844: <dt><span class="term"><code class=
5845: "filename">PLIST</code></span></dt>
5846:
5847: <dd>
5848: <p>This file governs the files that are installed
5849: on your system: all the binaries, manual pages,
5850: etc. There are other directives which may be
5851: entered in this file, to control the creation and
5852: deletion of directories, and the location of
5853: inserted files. See <a href="#plist" title=
5854: "Chapter 9. PLIST issues">Chapter 9,
5855: <i>PLIST issues</i></a> for more information.</p>
5856: </dd>
5857: </dl>
5858: </div>
5859: </div>
5860:
5861: <div class="sect1" lang="en" xml:lang="en">
5862: <div class="titlepage">
5863: <div>
5864: <div>
5865: <h2 class="title" style="clear: both"><a name=
5866: "components.optional" id=
5867: "components.optional"></a>7.5. Optional
5868: files</h2>
5869: </div>
5870: </div>
5871: </div>
5872:
5873: <div class="variablelist">
5874: <dl>
5875: <dt><span class="term"><code class=
5876: "filename">INSTALL</code></span></dt>
5877:
5878: <dd>
5879: <p>This shell script is invoked twice by <a href=
5880: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5881: <span class="citerefentry"><span class=
5882: "refentrytitle">pkg_add</span>(1)</span></a>. First
5883: time after package extraction and before files are
5884: moved in place, the second time after the files to
5885: install are moved in place. This can be used to do
5886: any custom procedures not possible with @exec
5887: commands in <code class="filename">PLIST</code>.
5888: See <a href=
5889: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5890: <span class="citerefentry"><span class=
5891: "refentrytitle">pkg_add</span>(1)</span></a> and
5892: <a href=
5893: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5894: <span class="citerefentry"><span class=
5895: "refentrytitle">pkg_create</span>(1)</span></a> for
5896: more information.</p>
5897: </dd>
5898:
5899: <dt><span class="term"><code class=
5900: "filename">DEINSTALL</code></span></dt>
5901:
5902: <dd>
5903: <p>This script is executed before and after any
5904: files are removed. It is this script's
5905: responsibility to clean up any additional messy
5906: details around the package's installation, since
5907: all pkg_delete knows is how to delete the files
5908: created in the original distribution. See <a href=
5909: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
5910: <span class="citerefentry"><span class=
5911: "refentrytitle">pkg_delete</span>(1)</span></a> and
5912: <a href=
5913: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5914: <span class="citerefentry"><span class=
5915: "refentrytitle">pkg_create</span>(1)</span></a> for
5916: more information.</p>
5917: </dd>
5918:
5919: <dt><span class="term"><code class=
5920: "filename">MESSAGE</code></span></dt>
5921:
5922: <dd>
5923: <p>Display this file after installation of the
5924: package. Useful for things like legal notices on
5925: almost-free software and hints for updating config
5926: files after installing modules for apache, PHP etc.
5927: Please note that you can modify variables in it
5928: easily by using <code class=
5929: "varname">MESSAGE_SUBST</code> in the package's
5930: <code class="filename">Makefile</code>:</p>
5931: <pre class="programlisting">
5932: MESSAGE_SUBST+= SOMEVAR="somevalue"
5933: </pre>
5934:
5935: <p>replaces "${SOMEVAR}" with “<span class=
5936: "quote">somevalue</span>” in <code class=
5937: "filename">MESSAGE</code>.</p>
5938: </dd>
5939: </dl>
5940: </div>
5941: </div>
5942:
5943: <div class="sect1" lang="en" xml:lang="en">
5944: <div class="titlepage">
5945: <div>
5946: <div>
5947: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5948: "work-dir" id="work-dir"></a>7.6. <code class=
1.27 rillig 5949: "filename">work*</code></h2>
5950: </div>
5951: </div>
5952: </div>
5953:
5954: <p>When you type <span><strong class=
5955: "command">make</strong></span> the distribution files are
5956: unpacked into this directory. It can be removed by
5957: running <span><strong class="command">make
5958: clean</strong></span>. Besides the sources, this
5959: directory is also used to keep various timestamp
5960: files.</p>
5961:
5962: <p>If a package doesn't create a subdirectory for itself
5963: (like GNU software does, for instance), but extracts
5964: itself in the current directory, you should set
5965: <code class="varname">WRKSRC</code> accordingly, e.g.
5966: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
5967: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
5968: class="pkgname">editors/sam</a> again, but the quick
5969: answer is:</p>
5970: <pre class="programlisting">
5971: WRKSRC= ${WRKDIR}
5972: </pre>
5973:
5974: <p>Please note that the old <code class=
5975: "varname">NO_WRKSUBDIR</code> has been deprecated and
5976: should not be used. Also, if your package doesn't create
5977: a subdir with the name of <code class=
5978: "varname">DISTNAME</code> but some different name, set
5979: <code class="varname">WRKSRC</code> to point to the
5980: proper name in <code class="filename">${WRKDIR}</code>.
5981: See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5982: href=
5983: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
5984: class="pkgname">lang/tcl</a> and <a xmlns=
5985: "http://www.w3.org/TR/xhtml1/transitional" href=
5986: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
5987: class="pkgname">x11/tk</a> for examples, and here is
5988: another one:</p>
5989: <pre class="programlisting">
5990: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
5991: </pre>
5992:
5993: <p>The name of the working directory created by pkgsrc is
5994: <code class="filename">work</code> by default. If the
5995: same pkgsrc tree should be used on several different
5996: platforms, the variable <code class=
5997: "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
5998: attach the platform to the directory name, e.g.
5999: <code class="filename">work.i386</code> or <code class=
6000: "filename">work.sparc</code>.</p>
6001: </div>
6002:
6003: <div class="sect1" lang="en" xml:lang="en">
6004: <div class="titlepage">
6005: <div>
6006: <div>
6007: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6008: "files-dir" id=
6009: "files-dir"></a>7.7. <code class=
1.27 rillig 6010: "filename">files/*</code></h2>
6011: </div>
6012: </div>
6013: </div>
6014:
6015: <p>If you have any files that you wish to be placed in
6016: the package prior to configuration or building, you could
6017: place these files here and use a “<span class=
6018: "quote">${CP}</span>” command in the
6019: “<span class="quote">pre-configure</span>”
6020: target to achieve this. Alternatively, you could simply
6021: diff the file against <code class=
6022: "filename">/dev/null</code> and use the patch mechanism
6023: to manage the creation of this file.</p>
6024: </div>
6025: </div>
6026:
6027: <div class="chapter" lang="en" xml:lang="en">
6028: <div class="titlepage">
6029: <div>
6030: <div>
6031: <h2 class="title"><a name="makefile" id=
6032: "makefile"></a>Chapter 8. Programming in
6033: <code class="filename">Makefile</code>s</h2>
6034: </div>
6035: </div>
6036: </div>
6037:
6038: <div class="toc">
6039: <p><b>Table of Contents</b></p>
6040:
6041: <dl>
6042: <dt><span class="sect1"><a href=
6043: "#makefile.variables">8.1. <code class=
6044: "filename">Makefile</code> variables</a></span></dt>
6045:
6046: <dd>
6047: <dl>
6048: <dt><span class="sect2"><a href=
6049: "#makefile.variables.names">8.1.1. Naming
6050: conventions</a></span></dt>
6051: </dl>
6052: </dd>
6053:
6054: <dt><span class="sect1"><a href="#makefile.code">8.2.
6055: Code snippets</a></span></dt>
6056:
6057: <dd>
6058: <dl>
1.30 wiz 6059: <dt><span class="sect2"><a href=
6060: "#adding-to-list">8.2.1. Adding things to a
6061: list</a></span></dt>
1.27 rillig 6062:
1.30 wiz 6063: <dt><span class="sect2"><a href=
6064: "#converting-internal-to-external">8.2.2.
1.27 rillig 6065: Converting an internal list into an external
6066: list</a></span></dt>
6067:
1.30 wiz 6068: <dt><span class="sect2"><a href=
6069: "#passing-variable-to-shell">8.2.3. Passing
6070: variables to a shell command</a></span></dt>
1.27 rillig 6071:
1.30 wiz 6072: <dt><span class="sect2"><a href=
6073: "#quoting-guideline">8.2.4. Quoting
6074: guideline</a></span></dt>
1.27 rillig 6075:
1.30 wiz 6076: <dt><span class="sect2"><a href=
6077: "#bsd-make-bug-workaround">8.2.5. Workaround for a
6078: bug in BSD Make</a></span></dt>
1.27 rillig 6079: </dl>
6080: </dd>
6081: </dl>
6082: </div>
6083:
6084: <p>Pkgsrc consists of many <code class=
6085: "filename">Makefile</code> fragments, each of which forms a
6086: well-defined part of the pkgsrc system. Using the <a href=
6087: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6088: <span class="citerefentry"><span class=
6089: "refentrytitle">make</span>(1)</span></a> system as a
6090: programming language for a big system like pkgsrc requires
6091: some discipline to keep the code correct and
6092: understandable.</p>
6093:
6094: <p>The basic ingredients for <code class=
6095: "filename">Makefile</code> programming are variables (which
6096: are actually macros) and shell commands. Among these shell
6097: commands may even be more complex ones like <a href=
6098: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
6099: <span class="citerefentry"><span class=
6100: "refentrytitle">awk</span>(1)</span></a> programs. To make
6101: sure that every shell command runs as intended it is
6102: necessary to quote all variables correctly when they are
6103: used.</p>
6104:
6105: <p>This chapter describes some patterns, that appear quite
6106: often in <code class="filename">Makefile</code>s, including
6107: the pitfalls that come along with them.</p>
6108:
6109: <div class="sect1" lang="en" xml:lang="en">
6110: <div class="titlepage">
6111: <div>
6112: <div>
6113: <h2 class="title" style="clear: both"><a name=
6114: "makefile.variables" id=
6115: "makefile.variables"></a>8.1. <code class=
6116: "filename">Makefile</code> variables</h2>
6117: </div>
6118: </div>
6119: </div>
6120:
6121: <p><code class="filename">Makefile</code> variables
6122: contain strings that can be processed using the five
6123: operators ``='', ``+='', ``?='', ``:='', and ``!='',
6124: which are described in the <a href=
6125: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6126: <span class="citerefentry"><span class=
6127: "refentrytitle">make</span>(1)</span></a> man page.</p>
6128:
6129: <p>When a variable's value is parsed from a <code class=
6130: "filename">Makefile</code>, the hash character ``#'' and
6131: the backslash character ``\'' are handled specially. If a
6132: backslash is followed by a newline, any whitespace
6133: immediately in front of the backslash, the backslash, the
6134: newline, and any whitespace immediately behind the
6135: newline are replaced with a single space. A backspace
6136: character and an immediately following hash character are
6137: replaced with a single hash character. Otherwise the
6138: backslash is passed as is. In a variable assignment, any
6139: hash character that is not preceded by a backslash starts
6140: a comment that continues upto the end of the logical
6141: line.</p>
6142:
6143: <p><span class="emphasis"><em>Note:</em></span> Because
6144: of this parsing algorithm the only way to create a
6145: variable consisting of a single backslash is using the
6146: ``!='' operator, for example: <code class=
6147: "varname">BACKSLASH!=echo "\\"</code>.</p>
6148:
6149: <p>So far for defining variables. The other thing you can
6150: do with variables is evaluating them. A variable is
6151: evaluated when it is part of the right side of the ``:=''
6152: or the ``!='' operator, or directly before executing a
6153: shell command which the variable is part of. In all other
6154: cases <a href=
6155: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6156: <span class="citerefentry"><span class=
6157: "refentrytitle">make</span>(1)</span></a> performs lazy
6158: evaluation, that is, variables are not evaluated until
6159: there's no other way. The ``modifiers'' mentioned in the
6160: man page also evaluate the variable.</p>
6161:
6162: <p>Some of the modifiers split the string into words and
6163: then operate on the words, others operate on the string
6164: as a whole. When a string is splitted into words, it is
6165: splitted as you would expect it from <a href=
6166: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
6167: <span class="citerefentry"><span class=
6168: "refentrytitle">sh</span>(1)</span></a>.</p>
6169:
6170: <p>No rule without exception—the
6171: <span><strong class="command">.for</strong></span> loop
6172: does not follow the shell quoting rules but splits at
6173: sequences of whitespace.</p>
6174:
6175: <p>There are several types of variables that should be
6176: handled differently. Strings and two types of lists.</p>
6177:
6178: <div class="itemizedlist">
6179: <ul type="disc">
6180: <li>
6181: <p><span class="emphasis"><em>Strings</em></span>
6182: can contain arbitrary characters. Nevertheless you
6183: should restrict yourself to only using printable
6184: characters. Examples are <code class=
6185: "varname">PREFIX</code> and <code class=
6186: "varname">COMMENT</code>.</p>
6187: </li>
6188:
6189: <li>
6190: <p><span class="emphasis"><em>Internal
6191: lists</em></span> are lists that are never exported
6192: to any shell command. Their elements are separated
6193: by whitespace. Therefore the elements themselves
6194: cannot have embedded whitespace. Any other
6195: characters are allowed. Internal lists can be used
6196: in <span><strong class=
6197: "command">.for</strong></span> loops. Examples are
6198: <code class="varname">DEPENDS</code> and
6199: <code class="varname">BUILD_DEPENDS</code>.</p>
6200: </li>
6201:
6202: <li>
6203: <p><span class="emphasis"><em>External
6204: lists</em></span> are lists that may be exported to
6205: a shell command. Their elements can contain any
6206: characters, including whitespace. That's why they
6207: cannot be used in <span><strong class=
6208: "command">.for</strong></span> loops. Examples are
6209: <code class="varname">DISTFILES</code> and
6210: <code class="varname">MASTER_SITES</code>.</p>
6211: </li>
6212: </ul>
6213: </div>
6214:
6215: <div class="sect2" lang="en" xml:lang="en">
6216: <div class="titlepage">
6217: <div>
6218: <div>
6219: <h3 class="title"><a name=
6220: "makefile.variables.names" id=
6221: "makefile.variables.names"></a>8.1.1. Naming
6222: conventions</h3>
6223: </div>
6224: </div>
6225: </div>
6226:
6227: <div class="itemizedlist">
6228: <ul type="disc">
6229: <li>
6230: <p>All variable names starting with an underscore
6231: are reserved for use by the pkgsrc
6232: infrastructure. They shall not be used by package
6233: <code class="filename">Makefile</code>s.</p>
6234: </li>
6235:
6236: <li>
6237: <p>In <span><strong class=
6238: "command">.for</strong></span> loops you should
6239: use lowercase variable names for the iteration
6240: variables.</p>
6241: </li>
6242:
6243: <li>
6244: <p>All list variables should have a ``plural''
6245: name, e.g. <code class=
6246: "varname">PKG_OPTIONS</code> or <code class=
6247: "varname">DISTFILES</code>.</p>
6248: </li>
6249: </ul>
6250: </div>
6251: </div>
6252: </div>
6253:
6254: <div class="sect1" lang="en" xml:lang="en">
6255: <div class="titlepage">
6256: <div>
6257: <div>
6258: <h2 class="title" style="clear: both"><a name=
6259: "makefile.code" id=
6260: "makefile.code"></a>8.2. Code snippets</h2>
6261: </div>
6262: </div>
6263: </div>
6264:
6265: <p>This section presents you with some code snippets you
6266: should use in your own code. If you don't find anything
6267: appropriate here, you should test your code and add it
6268: here.</p>
6269:
6270: <div class="sect2" lang="en" xml:lang="en">
6271: <div class="titlepage">
6272: <div>
6273: <div>
1.30 wiz 6274: <h3 class="title"><a name="adding-to-list" id=
6275: "adding-to-list"></a>8.2.1. Adding things to
6276: a list</h3>
1.27 rillig 6277: </div>
6278: </div>
6279: </div>
6280: <pre class="programlisting">
6281: STRING= foo * bar `date`
6282: INT_LIST= # empty
6283: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
6284: EXT_LIST= # empty
6285: ANOTHER_EXT_LIST= a=b c=d
6286:
6287: INT_LIST+= ${STRING} # 1
6288: INT_LIST+= ${ANOTHER_INT_LIST} # 2
6289: EXT_LIST+= ${STRING:Q} # 3
6290: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
6291:
6292: </pre>
6293:
6294: <p>When you add a string to an external list (example
6295: 3), it must be quoted. In all other cases, you must not
6296: add a quoting level. You must not merge internal and
6297: external lists, unless you are sure that all entries
6298: are correctly interpreted in both lists.</p>
6299: </div>
6300:
6301: <div class="sect2" lang="en" xml:lang="en">
6302: <div class="titlepage">
6303: <div>
6304: <div>
1.30 wiz 6305: <h3 class="title"><a name=
6306: "converting-internal-to-external" id=
6307: "converting-internal-to-external"></a>8.2.2. Converting
6308: an internal list into an external list</h3>
1.27 rillig 6309: </div>
6310: </div>
6311: </div>
6312: <pre class="programlisting">
6313: EXT_LIST= # empty
6314: .for i in ${INT_LIST}
6315: EXT_LIST+= ${i:Q}""
6316: .endfor
6317:
6318: </pre>
6319:
6320: <p>This code converts the internal list <code class=
6321: "varname">INT_LIST</code> into the external list
6322: <code class="varname">EXT_LIST</code>. As the elements
6323: of an internal list are unquoted they must be quoted
6324: here. The reason for appending <code class=
6325: "varname">""</code> is explained below.</p>
6326: </div>
1.1 grant 6327:
1.27 rillig 6328: <div class="sect2" lang="en" xml:lang="en">
6329: <div class="titlepage">
1.1 grant 6330: <div>
1.27 rillig 6331: <div>
1.30 wiz 6332: <h3 class="title"><a name=
6333: "passing-variable-to-shell" id=
6334: "passing-variable-to-shell"></a>8.2.3. Passing
6335: variables to a shell command</h3>
1.27 rillig 6336: </div>
1.1 grant 6337: </div>
6338: </div>
1.27 rillig 6339: <pre class="programlisting">
6340: STRING= foo bar < > * `date` $$HOME ' "
6341: EXT_LIST= string=${STRING:Q} x=second\ item
6342:
6343: all:
6344: echo ${STRING} # 1
6345: echo "${STRING}" # 2
6346: echo "${STRING:Q}" # 3
6347: echo ${STRING:Q} # 4
6348: echo x${STRING:Q} | sed 1s,.,, # 5
6349: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
6350:
6351: </pre>
6352:
6353: <p>Example 1 leads to a syntax error in the shell, as
6354: the characters are just copied.</p>
6355:
6356: <p>Example 2 leads to a syntax error too, and if you
6357: leave out the last " character from <code class=
6358: "varname">${STRING}</code>, <a href=
6359: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
6360: <span class="citerefentry"><span class=
6361: "refentrytitle">date</span>(1)</span></a> will be
6362: executed. The <code class="varname">$HOME</code> shell
6363: variable would be evaluated, too.</p>
6364:
6365: <p>Example 3 outputs each space character preceded by a
6366: backslash (or not), depending on the implementation of
6367: the <a href=
6368: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6369: <span class="citerefentry"><span class=
6370: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 6371:
1.27 rillig 6372: <p>Example 4 handles correctly every string that does
6373: not start with a dash. In that case, the result depends
6374: on the implementation of the <a href=
6375: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6376: <span class="citerefentry"><span class=
6377: "refentrytitle">echo</span>(1)</span></a> command. As
6378: long as you can guarantee that your input does not
6379: start with a dash this form is appropriate.</p>
1.1 grant 6380:
1.27 rillig 6381: <p>Example 5 handles even the case of a leading dash
6382: correctly.</p>
1.1 grant 6383:
1.27 rillig 6384: <p>The <code class="varname">EXT_LIST</code> does not
6385: need to be quoted because the quoting has already be
6386: done when adding elements to the list.</p>
1.1 grant 6387:
1.27 rillig 6388: <p>As internal lists shall not be passed to the shell,
6389: there is no example for it.</p>
1.1 grant 6390: </div>
6391:
1.27 rillig 6392: <div class="sect2" lang="en" xml:lang="en">
6393: <div class="titlepage">
1.1 grant 6394: <div>
1.27 rillig 6395: <div>
1.30 wiz 6396: <h3 class="title"><a name="quoting-guideline" id=
6397: "quoting-guideline"></a>8.2.4. Quoting
1.27 rillig 6398: guideline</h3>
6399: </div>
1.1 grant 6400: </div>
6401: </div>
6402:
1.27 rillig 6403: <p>There are many possible sources of wrongly quoted
6404: variables. This section lists some of the commonly
6405: known ones.</p>
1.1 grant 6406:
1.27 rillig 6407: <div class="itemizedlist">
6408: <ul type="disc">
6409: <li>
6410: <p>Whenever you use the value of a list, think
6411: about what happens to leading or trailing
6412: whitespace. If the list is a well-formed shell
6413: expression you can apply the <code class=
6414: "varname">:M*</code> modifier to strip leading
6415: and trailing whitespace from each word. The
6416: <code class="varname">:M</code> operator first
6417: splits its argument according to the rules of the
6418: shell, and then creates a new list consisting of
6419: all words that match the shell glob expression
6420: <code class="varname">*</code>, that is: all. One
6421: class of situations where this is needed is when
6422: adding a variable like <code class=
6423: "varname">CPPFLAGS</code> to <code class=
6424: "varname">CONFIGURE_ARGS</code>. If the configure
6425: script invokes other configure scripts it strips
6426: the leading and trailing whitespace from the
6427: variable and then passes it to the other
6428: configure scripts. But these configure scripts
6429: expect the (child) <code class=
6430: "varname">CPPFLAGS</code> variable to be the same
6431: as the parent <code class=
6432: "varname">CPPFLAGS</code>. That's why we better
6433: pass the <code class="varname">CPPFLAGS</code>
6434: value properly trimmed. And here is how we do
6435: it:</p>
6436: <pre class="programlisting">
6437: CPPFLAGS= # empty
6438: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
6439: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 grant 6440:
1.27 rillig 6441: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 grant 6442:
1.27 rillig 6443: all:
6444: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
6445: echo x${CONFIGURE_ARGS}x # properly trimmed
6446:
6447: </pre>
6448: </li>
1.1 grant 6449:
1.27 rillig 6450: <li>
6451: <p>The example above contains one bug: The
6452: <code class="varname">${PREFIX}</code> is a
6453: properly quoted shell expression, but there is
6454: the C compiler after it, which also expects a
6455: properly quoted string (this time in C syntax).
6456: The version above is therefore only correct if
6457: <code class="varname">${PREFIX}</code> does not
6458: have embedded backslashes or double quotes. If
6459: you want to allow these, you have to add another
6460: layer of quoting to each variable that is used as
6461: a C string literal. You cannot use the
6462: <code class="varname">:Q</code> operator for it,
6463: as this operator only works for the shell.</p>
6464: </li>
1.1 grant 6465:
1.27 rillig 6466: <li>
6467: <p>Whenever a variable can be empty the
6468: <code class="varname">:Q</code> operator can have
6469: surprising results. Here are two completely
6470: different cases which can be solved with the same
6471: trick.</p>
6472: <pre class="programlisting">
6473: EMPTY= # empty
6474: empty_test:
6475: for i in a ${EMPTY:Q} c; do \
6476: echo "$$i"; \
6477: done
6478:
6479: for_test:
6480: .for i in a:\ a:\test.txt
6481: echo ${i:Q}
6482: echo "foo"
6483: .endfor
6484:
1.1 grant 6485: </pre>
6486:
1.27 rillig 6487: <p>The first example will only print two of the
6488: three lines we might have expected. This is
6489: because <code class="varname">${EMPTY:Q}</code>
6490: expands to the empty string, which the shell
6491: cannot see. The workaround is to write
6492: <code class="varname">${EMPTY:Q}""</code>. This
6493: pattern can be often found as <code class=
6494: "varname">${TEST} -z ${VAR:Q}</code> or as
6495: <code class="varname">${TEST} -f
6496: ${FNAME:Q}</code> (both of these are wrong).</p>
6497:
6498: <p>The second example will only print three lines
6499: instead of four. The first line looks like
6500: <code class="varname">a:\ echo foo</code>. This
6501: is because the backslash of the value
6502: <code class="varname">a:\</code> is interpreted
6503: as a line-continuation by <a href=
6504: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6505: <span class="citerefentry"><span class=
6506: "refentrytitle">make</span>(1)</span></a>, which
6507: makes the second line the arguments of the
6508: <a href=
6509: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6510: <span class="citerefentry"><span class=
6511: "refentrytitle">echo</span>(1)</span></a> command
6512: from the first line. To avoid this, write
6513: <code class="varname">${i:Q}""</code>.</p>
6514: </li>
6515: </ul>
6516: </div>
1.1 grant 6517: </div>
6518:
1.27 rillig 6519: <div class="sect2" lang="en" xml:lang="en">
6520: <div class="titlepage">
1.1 grant 6521: <div>
1.27 rillig 6522: <div>
1.30 wiz 6523: <h3 class="title"><a name=
6524: "bsd-make-bug-workaround" id=
6525: "bsd-make-bug-workaround"></a>8.2.5. Workaround
6526: for a bug in BSD Make</h3>
1.27 rillig 6527: </div>
1.1 grant 6528: </div>
6529: </div>
6530:
1.27 rillig 6531: <p>The pkgsrc bmake program does not handle the
6532: following assignment correctly. In case <code class=
6533: "varname">_othervar_</code> contains a ``-'' character,
6534: one of the closing braces is included in <code class=
6535: "varname">${VAR}</code> after this code executes.</p>
6536: <pre class="programlisting">
6537: VAR:= ${VAR:N${_othervar_:C/-//}}
6538:
1.1 grant 6539: </pre>
6540:
1.27 rillig 6541: <p>For a more complex code snippet and a workaround,
6542: see the package <a xmlns=
6543: "http://www.w3.org/TR/xhtml1/transitional" href=
6544: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
6545: class="pkgname">regress/make-quoting</a>, testcase
6546: <code class="varname">bug1</code>.</p>
1.1 grant 6547: </div>
6548: </div>
6549: </div>
6550:
6551: <div class="chapter" lang="en" xml:lang="en">
6552: <div class="titlepage">
6553: <div>
6554: <div>
6555: <h2 class="title"><a name="plist" id=
1.25 rillig 6556: "plist"></a>Chapter 9. PLIST issues</h2>
1.1 grant 6557: </div>
6558: </div>
6559: </div>
6560:
6561: <div class="toc">
6562: <p><b>Table of Contents</b></p>
6563:
6564: <dl>
1.30 wiz 6565: <dt><span class="sect1"><a href="#rcs-id">9.1. RCS
1.1 grant 6566: ID</a></span></dt>
6567:
1.30 wiz 6568: <dt><span class="sect1"><a href=
6569: "#automatic-plist-generation">9.2. Semi-automatic
6570: <code class="filename">PLIST</code>
1.14 xtraeme 6571: generation</a></span></dt>
1.1 grant 6572:
1.25 rillig 6573: <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14 xtraeme 6574: Tweaking output of <span><strong class="command">make
6575: print-PLIST</strong></span></a></span></dt>
1.1 grant 6576:
1.25 rillig 6577: <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1 grant 6578: Variable substitution in PLIST</a></span></dt>
6579:
1.30 wiz 6580: <dt><span class="sect1"><a href=
6581: "#manpage-compression">9.5.
1.1 grant 6582: Manpage-compression</a></span></dt>
6583:
1.30 wiz 6584: <dt><span class="sect1"><a href="#using-PLIST_SRC">9.6.
1.14 xtraeme 6585: Changing PLIST source with <code class=
6586: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 6587:
1.30 wiz 6588: <dt><span class="sect1"><a href=
6589: "#platform-specific-plist">9.7. Platform specific and
6590: differing PLISTs</a></span></dt>
1.1 grant 6591:
1.25 rillig 6592: <dt><span class="sect1"><a href="#faq.common-dirs">9.8.
1.1 grant 6593: Sharing directories between packages</a></span></dt>
6594: </dl>
6595: </div>
6596:
1.14 xtraeme 6597: <p>The <code class="filename">PLIST</code> file contains a
1.1 grant 6598: package's “<span class="quote">packing
6599: list</span>”, i.e. a list of files that belong to the
1.14 xtraeme 6600: package (relative to the <code class=
6601: "filename">${PREFIX}</code> directory it's been installed
6602: in) plus some additional statements - see the <a href=
1.1 grant 6603: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6604: <span class="citerefentry"><span class=
6605: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
6606: a full list. This chapter addresses some issues that need
1.14 xtraeme 6607: attention when dealing with the <code class=
6608: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 6609:
6610: <div class="sect1" lang="en" xml:lang="en">
6611: <div class="titlepage">
6612: <div>
6613: <div>
6614: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6615: "rcs-id" id="rcs-id"></a>9.1. RCS ID</h2>
1.1 grant 6616: </div>
6617: </div>
6618: </div>
6619:
6620: <p>Be sure to add a RCS ID line as the first thing in any
1.14 xtraeme 6621: <code class="filename">PLIST</code> file you write:</p>
1.1 grant 6622: <pre class="programlisting">
1.17 sketch 6623: @comment $NetBSD$
1.1 grant 6624: </pre>
6625: </div>
6626:
6627: <div class="sect1" lang="en" xml:lang="en">
6628: <div class="titlepage">
6629: <div>
6630: <div>
6631: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6632: "automatic-plist-generation" id=
6633: "automatic-plist-generation"></a>9.2. Semi-automatic
1.14 xtraeme 6634: <code class="filename">PLIST</code> generation</h2>
1.1 grant 6635: </div>
6636: </div>
6637: </div>
6638:
1.14 xtraeme 6639: <p>You can use the <span><strong class="command">make
6640: print-PLIST</strong></span> command to output a PLIST
6641: that matches any new files since the package was
6642: extracted. See <a href="#build.helpful-targets" title=
1.35 jmmv 6643: "13.3. Other helpful targets">Section 13.3,
1.1 grant 6644: “Other helpful targets”</a> for more
6645: information on this target.</p>
6646: </div>
6647:
6648: <div class="sect1" lang="en" xml:lang="en">
6649: <div class="titlepage">
6650: <div>
6651: <div>
6652: <h2 class="title" style="clear: both"><a name=
6653: "print-PLIST" id=
1.25 rillig 6654: "print-PLIST"></a>9.3. Tweaking output of
1.14 xtraeme 6655: <span><strong class="command">make
6656: print-PLIST</strong></span></h2>
1.1 grant 6657: </div>
6658: </div>
6659: </div>
6660:
6661: <p>If you have used any of the *-dirs packages, as
6662: explained in <a href="#faq.common-dirs" title=
1.25 rillig 6663: "9.8. Sharing directories between packages">Section 9.8,
1.1 grant 6664: “Sharing directories between packages”</a>,
1.14 xtraeme 6665: you may have noticed that <span><strong class=
6666: "command">make print-PLIST</strong></span> outputs a set
6667: of <code class="varname">@comment</code>s instead of real
6668: <code class="varname">@dirrm</code> lines. You can also
6669: do this for specific directories and files, so that the
6670: results of that command are very close to reality. This
6671: helps <span class="emphasis"><em>a lot</em></span> during
6672: the update of packages.</p>
6673:
6674: <p>The <code class="varname">PRINT_PLIST_AWK</code>
6675: variable takes a set of AWK patterns and actions that are
6676: used to filter the output of print-PLIST. You can
6677: <span class="emphasis"><em>append</em></span> any chunk
6678: of AWK scripting you like to it, but be careful with
1.1 grant 6679: quoting.</p>
6680:
1.14 xtraeme 6681: <p>For example, to get all files inside the <code class=
6682: "filename">libdata/foo</code> directory removed from the
1.1 grant 6683: resulting PLIST:</p>
6684: <pre class="programlisting">
6685: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
6686:
6687: </pre>
6688:
1.14 xtraeme 6689: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 6690: lines referring to a specific (shared) directory
1.14 xtraeme 6691: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 6692: <pre class="programlisting">
6693: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
6694:
6695: </pre>
6696: </div>
6697:
6698: <div class="sect1" lang="en" xml:lang="en">
6699: <div class="titlepage">
6700: <div>
6701: <div>
6702: <h2 class="title" style="clear: both"><a name=
1.25 rillig 6703: "plist.misc" id="plist.misc"></a>9.4. Variable
1.1 grant 6704: substitution in PLIST</h2>
6705: </div>
6706: </div>
6707: </div>
6708:
6709: <p>A number of variables are substituted automatically in
6710: PLISTs when a package is installed on a system. This
6711: includes the following variables:</p>
6712:
6713: <div class="variablelist">
6714: <dl>
1.14 xtraeme 6715: <dt><span class="term"><code class=
6716: "varname">${MACHINE_ARCH}</code>, <code class=
6717: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 6718:
6719: <dd>
6720: <p>Some packages like emacs and perl embed
6721: information about which architecture they were
6722: built on into the pathnames where they install
6723: their file. To handle this case, PLIST will be
6724: preprocessed before actually used, and the symbol
1.14 xtraeme 6725: “<span class="quote"><code class=
6726: "varname">${MACHINE_ARCH}</code></span>” will
6727: be replaced by what <span><strong class=
6728: "command">uname -p</strong></span> gives. The same
6729: is done if the string <code class=
6730: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
6731: PLIST somewhere - use this on packages that have
6732: GNU autoconf created configure scripts.</p>
1.1 grant 6733:
6734: <div class="note" style=
6735: "margin-left: 0.5in; margin-right: 0.5in;">
6736: <h3 class="title">Legacy note</h3>
6737:
6738: <p>There used to be a symbol “<span class=
1.14 xtraeme 6739: "quote"><code class=
6740: "varname">$ARCH</code></span>” that was
6741: replaced by the output of <span><strong class=
6742: "command">uname -m</strong></span>, but that's no
1.1 grant 6743: longer supported and has been removed.</p>
6744: </div>
6745: </dd>
6746:
1.14 xtraeme 6747: <dt><span class="term"><code class=
6748: "varname">${OPSYS}</code>, <code class=
6749: "varname">${LOWER_OPSYS}</code>, <code class=
6750: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 6751:
6752: <dd>
6753: <p>Some packages want to embed the OS name and
6754: version into some paths. To do this, use these
1.14 xtraeme 6755: variables in the <code class=
6756: "filename">PLIST</code>:</p>
1.1 grant 6757:
6758: <div class="itemizedlist">
6759: <ul type="disc">
6760: <li>
1.14 xtraeme 6761: <p><code class="varname">${OPSYS}</code> -
6762: output of “<span class=
6763: "quote"><span><strong class="command">uname
6764: -s</strong></span></span>”</p>
1.1 grant 6765: </li>
6766:
6767: <li>
1.14 xtraeme 6768: <p><code class=
6769: "varname">${LOWER_OPSYS}</code> - lowercase
6770: common name (eg. “<span class=
6771: "quote">solaris</span>”)</p>
1.1 grant 6772: </li>
6773:
6774: <li>
1.14 xtraeme 6775: <p><code class="varname">${OS_VERSION}</code>
6776: - “<span class=
6777: "quote"><span><strong class="command">uname
6778: -r</strong></span></span>”</p>
1.1 grant 6779: </li>
6780: </ul>
6781: </div>
6782: </dd>
6783:
1.14 xtraeme 6784: <dt><span class="term"><code class=
6785: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 6786:
6787: <dd>
6788: <p>Packages that install locale files should list
6789: them in the PLIST as “<span class=
6790: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
6791: instead of “<span class=
6792: "quote">share/locale/de/LC_MESSAGES/...</span>”.
6793: This properly handles the fact that different
6794: operating systems expect locale files to be either
1.14 xtraeme 6795: in <code class="filename">share</code> or
6796: <code class="filename">lib</code> by default.</p>
1.1 grant 6797: </dd>
6798: </dl>
6799: </div>
6800:
6801: <p>For a complete list of values which are replaced by
1.14 xtraeme 6802: default, please look in <code class=
6803: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 6804: "emphasis"><em>PLIST_SUBST</em></span>).</p>
6805:
6806: <p>If you want to change other variables not listed
6807: above, you can add variables and their expansions to this
1.14 xtraeme 6808: variable in the following way, similar to <code class=
6809: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 6810: "#components.optional" title=
1.27 rillig 6811: "7.5. Optional files">Section 7.5,
1.1 grant 6812: “Optional files”</a>):</p>
6813: <pre class="programlisting">
6814: PLIST_SUBST+= SOMEVAR="somevalue"
6815: </pre>
6816:
6817: <p>This replaces all occurrences of “<span class=
6818: "quote">${SOMEVAR}</span>” in the PLIST with
6819: “<span class="quote">somevalue</span>”.</p>
6820: </div>
6821:
6822: <div class="sect1" lang="en" xml:lang="en">
6823: <div class="titlepage">
6824: <div>
6825: <div>
6826: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6827: "manpage-compression" id=
6828: "manpage-compression"></a>9.5. Manpage-compression</h2>
1.1 grant 6829: </div>
6830: </div>
6831: </div>
6832:
6833: <p>Manpages should be installed in compressed form if
1.14 xtraeme 6834: <code class="varname">MANZ</code> is set (in <code class=
6835: "filename">bsd.own.mk</code>), and uncompressed
6836: otherwise. To handle this in the <code class=
6837: "filename">PLIST</code> file, the suffix
6838: “<span class="quote">.gz</span>” is
6839: appended/removed automatically for manpages according to
6840: <code class="varname">MANZ</code> and <code class=
6841: "varname">MANCOMPRESSED</code> being set or not, see
6842: above for details. This modification of the <code class=
6843: "filename">PLIST</code> file is done on a copy of it, not
6844: <code class="filename">PLIST</code> itself.</p>
1.1 grant 6845: </div>
6846:
6847: <div class="sect1" lang="en" xml:lang="en">
6848: <div class="titlepage">
6849: <div>
6850: <div>
6851: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6852: "using-PLIST_SRC" id=
6853: "using-PLIST_SRC"></a>9.6. Changing PLIST
6854: source with <code class=
1.14 xtraeme 6855: "varname">PLIST_SRC</code></h2>
1.1 grant 6856: </div>
6857: </div>
6858: </div>
6859:
1.14 xtraeme 6860: <p>To use one or more files as source for the
6861: <code class="filename">PLIST</code> used in generating
6862: the binary package, set the variable <code class=
6863: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 6864: The files are later concatenated using <a href=
6865: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
6866: <span class="citerefentry"><span class=
6867: "refentrytitle">cat</span>(1)</span></a>, and order of
6868: things is important.</p>
1.1 grant 6869: </div>
6870:
6871: <div class="sect1" lang="en" xml:lang="en">
6872: <div class="titlepage">
6873: <div>
6874: <div>
6875: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6876: "platform-specific-plist" id=
6877: "platform-specific-plist"></a>9.7. Platform
1.1 grant 6878: specific and differing PLISTs</h2>
6879: </div>
6880: </div>
6881: </div>
6882:
6883: <p>Some packages decide to install a different set of
6884: files based on the operating system being used. These
6885: differences can be automatically handled by using the
6886: following files:</p>
6887:
6888: <div class="itemizedlist">
6889: <ul type="disc">
6890: <li>
1.14 xtraeme 6891: <p><code class="filename">PLIST.common</code></p>
1.1 grant 6892: </li>
6893:
6894: <li>
1.14 xtraeme 6895: <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1 grant 6896: </li>
6897:
6898: <li>
1.14 xtraeme 6899: <p><code class=
1.21 ben 6900: "filename">PLIST.${MACHINE_ARCH}</code></p>
6901: </li>
6902:
6903: <li>
6904: <p><code class=
6905: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
6906: </li>
6907:
6908: <li>
6909: <p><code class=
1.14 xtraeme 6910: "filename">PLIST.common_end</code></p>
1.1 grant 6911: </li>
6912: </ul>
6913: </div>
6914: </div>
6915:
6916: <div class="sect1" lang="en" xml:lang="en">
6917: <div class="titlepage">
6918: <div>
6919: <div>
6920: <h2 class="title" style="clear: both"><a name=
6921: "faq.common-dirs" id=
1.25 rillig 6922: "faq.common-dirs"></a>9.8. Sharing directories
1.1 grant 6923: between packages</h2>
6924: </div>
6925: </div>
6926: </div>
6927:
6928: <p>A “<span class="quote">shared
6929: directory</span>” is a directory where multiple
6930: (and unrelated) packages install files. These directories
6931: are problematic because you have to add special tricks in
6932: the PLIST to conditionally remove them, or have some
6933: centralized package handle them.</p>
6934:
6935: <p>Within pkgsrc, you'll find both approaches. If a
6936: directory is shared by a few unrelated packages, it's
6937: often not worth to add an extra package to remove it.
6938: Therefore, one simply does:</p>
6939: <pre class="programlisting">
6940: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
6941:
6942: </pre>
6943:
6944: <p>in the PLISTs of all affected packages, instead of the
6945: regular "@dirrm" line.</p>
6946:
6947: <p>However, if the directory is shared across many
6948: packages, two different solutions are available:</p>
6949:
6950: <div class="orderedlist">
6951: <ol type="1">
6952: <li>
6953: <p>If the packages have a common dependency, the
6954: directory can be removed in that. For example, see
6955: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
6956: href=
6957: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20 ben 6958: class="pkgname">textproc/scrollkeeper</a>, which
6959: removes the shared directory <code class=
6960: "filename">share/omf</code>.</p>
1.1 grant 6961: </li>
6962:
6963: <li>
6964: <p>If the packages using the directory are not
6965: related at all (they have no common dependencies),
6966: a *-dirs package is used.</p>
6967: </li>
6968: </ol>
6969: </div>
6970:
6971: <p>From now on, we'll discuss the second solution. To get
6972: an idea of the *-dirs packages available, issue:</p>
6973: <pre class="programlisting">
1.14 xtraeme 6974: <code class="prompt">%</code> cd .../pkgsrc
6975: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 6976:
6977: </pre>
6978:
6979: <p>Their use from other packages is very simple. The
1.14 xtraeme 6980: <code class="varname">USE_DIRS</code> variable takes a
6981: list of package names (without the “<span class=
1.1 grant 6982: "quote">-dirs</span>” part) together with the
6983: required version number (always pick the latest one when
1.34 wiz 6984: writing new packages).</p>
1.1 grant 6985:
6986: <p>For example, if a package installs files under
1.14 xtraeme 6987: <code class="filename">share/applications</code>, it
6988: should have the following line in it:</p>
1.1 grant 6989: <pre class="programlisting">
6990: USE_DIRS+= xdg-1.1
6991:
6992: </pre>
6993:
1.14 xtraeme 6994: <p>After regenerating the PLIST using
6995: <span><strong class="command">make
6996: print-PLIST</strong></span>, you should get the right
6997: (commented out) lines.</p>
1.1 grant 6998:
1.14 xtraeme 6999: <p>Note that, even if your package is using <code class=
7000: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 7001: *-x11-dirs packages. Just specify the name without that
1.14 xtraeme 7002: part and pkgsrc (in particular, <code class=
7003: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 7004: </div>
7005: </div>
7006:
7007: <div class="chapter" lang="en" xml:lang="en">
7008: <div class="titlepage">
7009: <div>
7010: <div>
7011: <h2 class="title"><a name="buildlink" id=
1.25 rillig 7012: "buildlink"></a>Chapter 10. Buildlink
1.1 grant 7013: methodology</h2>
7014: </div>
7015: </div>
7016: </div>
7017:
7018: <div class="toc">
7019: <p><b>Table of Contents</b></p>
7020:
7021: <dl>
1.30 wiz 7022: <dt><span class="sect1"><a href=
7023: "#converting-to-buildlink3">10.1. Converting packages
7024: to use buildlink3</a></span></dt>
1.1 grant 7025:
1.30 wiz 7026: <dt><span class="sect1"><a href=
7027: "#creating-buildlink3.mk">10.2. Writing <code class=
7028: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 7029:
7030: <dd>
7031: <dl>
1.25 rillig 7032: <dt><span class="sect2"><a href=
1.30 wiz 7033: "#anatomy-of-bl3">10.2.1. Anatomy of a
7034: buildlink3.mk file</a></span></dt>
1.1 grant 7035:
1.25 rillig 7036: <dt><span class="sect2"><a href=
1.30 wiz 7037: "#updating-buildlink-depends">10.2.2. Updating
7038: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 7039: "replaceable"><code>pkg</code></em></code> in
7040: <code class="filename">buildlink3.mk</code>
1.1 grant 7041: files</a></span></dt>
7042: </dl>
7043: </dd>
7044:
1.30 wiz 7045: <dt><span class="sect1"><a href=
7046: "#writing-builtin.mk">10.3. Writing <code class=
7047: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 7048:
7049: <dd>
7050: <dl>
1.25 rillig 7051: <dt><span class="sect2"><a href=
1.30 wiz 7052: "#anatomy-of-builtin.mk">10.3.1. Anatomy of a
7053: <code class="filename">builtin.mk</code>
7054: file</a></span></dt>
1.1 grant 7055:
1.25 rillig 7056: <dt><span class="sect2"><a href=
1.30 wiz 7057: "#native-or-pkgsrc-preference">10.3.2. Global
7058: preferences for native or pkgsrc
7059: software</a></span></dt>
1.1 grant 7060: </dl>
7061: </dd>
7062: </dl>
7063: </div>
7064:
7065: <p>Buildlink is a framework in pkgsrc that controls what
7066: headers and libraries are seen by a package's configure and
7067: build processes. This is implemented in a two step
7068: process:</p>
7069:
7070: <div class="orderedlist">
7071: <ol type="1">
7072: <li>
7073: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 7074: into <code class="varname">BUILDLINK_DIR</code>,
7075: which by default is a subdirectory of <code class=
7076: "varname">WRKDIR</code>.</p>
1.1 grant 7077: </li>
7078:
7079: <li>
7080: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 7081: the normal compiler tools that translate <code class=
7082: "option">-I${LOCALBASE}/include</code> and
7083: <code class="option">-L${LOCALBASE}/lib</code> into
7084: references to <code class=
7085: "varname">BUILDLINK_DIR</code>. The wrapper scripts
7086: also make native compiler on some operating systems
7087: look like GCC, so that packages that expect GCC won't
7088: require modifications to build with those native
7089: compilers.</p>
1.1 grant 7090: </li>
7091: </ol>
7092: </div>
7093:
7094: <p>This normalizes the environment in which a package is
7095: built so that the package may be built consistently despite
7096: what other software may be installed. Please note that the
1.14 xtraeme 7097: normal system header and library paths, e.g. <code class=
7098: "filename">/usr/include</code>, <code class=
7099: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 7100: buildlink3 is designed to insulate the package build from
7101: non-system-supplied software.</p>
7102:
7103: <div class="sect1" lang="en" xml:lang="en">
7104: <div class="titlepage">
7105: <div>
7106: <div>
7107: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7108: "converting-to-buildlink3" id=
7109: "converting-to-buildlink3"></a>10.1. Converting
7110: packages to use buildlink3</h2>
1.1 grant 7111: </div>
7112: </div>
7113: </div>
7114:
7115: <p>The process of converting packages to use the
7116: buildlink3 framework (“<span class=
7117: "quote">bl3ifying</span>”) is fairly
7118: straightforward. The things to keep in mind are:</p>
7119:
7120: <div class="orderedlist">
7121: <ol type="1">
7122: <li>
7123: <p>Ensure that the build always calls the wrapper
7124: scripts instead of the actual toolchain. Some
7125: packages are tricky, and the only way to know for
1.14 xtraeme 7126: sure is the check <code class=
7127: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 7128: wrappers are being invoked.</p>
7129: </li>
7130:
7131: <li>
1.14 xtraeme 7132: <p>Don't override <code class=
7133: "varname">PREFIX</code> from within the package
7134: Makefile, e.g. Java VMs, standalone shells, etc.,
7135: because the code to symlink files into <code class=
7136: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 7137: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 7138: <em class=
7139: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 7140: </li>
7141:
7142: <li>
7143: <p>Remember that <span class=
1.14 xtraeme 7144: "emphasis"><em>only</em></span> the <code class=
7145: "filename">buildlink3.mk</code> files that you list
1.1 grant 7146: in a package's Makefile are added as dependencies
7147: for that package.</p>
7148: </li>
7149: </ol>
7150: </div>
7151:
7152: <p>If a dependency on a particular package is required
7153: for its libraries and headers, then we replace:</p>
7154: <pre class="programlisting">
1.27 rillig 7155: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 7156: </pre>
7157:
7158: <p>with</p>
7159: <pre class="programlisting">
7160: .include "../../category/foo/buildlink3.mk"
7161: </pre>
7162:
1.14 xtraeme 7163: <p>There are several <code class=
7164: "filename">buildlink3.mk</code> files in <code class=
7165: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 7166: issues:</p>
7167:
7168: <div class="itemizedlist">
7169: <ul type="disc">
7170: <li>
1.14 xtraeme 7171: <p><code class="filename">bdb.buildlink3.mk</code>
1.1 grant 7172: chooses either the native or a pkgsrc Berkeley DB
1.14 xtraeme 7173: implementation based on the values of <code class=
7174: "varname">BDB_ACCEPTED</code> and <code class=
7175: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 7176: </li>
7177:
7178: <li>
1.14 xtraeme 7179: <p><code class=
7180: "filename">curses.buildlink3.mk</code> If the
7181: system comes with neither Curses nor NCurses, this
7182: will take care to install the <a xmlns=
7183: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 7184: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20 ben 7185: class="pkgname">devel/ncurses</a> package.</p>
1.1 grant 7186: </li>
7187:
7188: <li>
1.14 xtraeme 7189: <p><code class="filename">krb5.buildlink3.mk</code>
7190: uses the value of <code class=
7191: "varname">KRB5_ACCEPTED</code> to choose between
1.1 grant 7192: adding a dependency on Heimdal or MIT-krb5 for
7193: packages that require a Kerberos 5
7194: implementation.</p>
7195: </li>
7196:
7197: <li>
1.14 xtraeme 7198: <p><code class=
7199: "filename">motif.buildlink3.mk</code> checks for a
7200: system-provided Motif installation or adds a
7201: dependency on <a xmlns=
1.1 grant 7202: "http://www.w3.org/TR/xhtml1/transitional" href=
7203: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20 ben 7204: class="pkgname">x11/lesstif</a> or <a xmlns=
7205: "http://www.w3.org/TR/xhtml1/transitional" href=
7206: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
7207: class="pkgname">x11/openmotif</a>;</p>
1.1 grant 7208: </li>
7209:
7210: <li>
1.14 xtraeme 7211: <p><code class=
7212: "filename">ossaudio.buildlink3.mk</code> defines
7213: several variables that may be used by packages that
7214: use the Open Sound System (OSS) API;</p>
1.1 grant 7215: </li>
7216:
7217: <li>
1.14 xtraeme 7218: <p><code class=
7219: "filename">pgsql.buildlink3.mk</code> will accept
7220: either Postgres 7.3 or 7.4, whichever is found
7221: installed. See the file for more information.</p>
1.1 grant 7222: </li>
7223:
7224: <li>
1.14 xtraeme 7225: <p><code class=
7226: "filename">pthread.buildlink3.mk</code> uses the
7227: value of <code class="varname">PTHREAD_OPTS</code>
7228: and checks for native pthreads or adds a dependency
7229: on <a xmlns=
1.1 grant 7230: "http://www.w3.org/TR/xhtml1/transitional" href=
7231: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20 ben 7232: class="pkgname">devel/pth</a> as needed;</p>
1.1 grant 7233: </li>
7234:
7235: <li>
1.14 xtraeme 7236: <p><code class="filename">xaw.buildlink3.mk</code>
7237: uses the value of <code class=
7238: "varname">XAW_TYPE</code> to choose a particular
7239: Athena widgets library.</p>
1.1 grant 7240: </li>
7241: </ul>
7242: </div>
7243:
1.14 xtraeme 7244: <p>The comments in those <code class=
7245: "filename">buildlink3.mk</code> files provide a more
1.1 grant 7246: complete description of how to use them properly.</p>
7247: </div>
7248:
7249: <div class="sect1" lang="en" xml:lang="en">
7250: <div class="titlepage">
7251: <div>
7252: <div>
7253: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7254: "creating-buildlink3.mk" id=
7255: "creating-buildlink3.mk"></a>10.2. Writing
1.14 xtraeme 7256: <code class="filename">buildlink3.mk</code>
7257: files</h2>
1.1 grant 7258: </div>
7259: </div>
7260: </div>
7261:
1.14 xtraeme 7262: <p>A package's <code class=
7263: "filename">buildlink3.mk</code> file is included by
7264: Makefiles to indicate the need to compile and link
7265: against header files and libraries provided by the
7266: package. A <code class="filename">buildlink3.mk</code>
7267: file should always provide enough information to add the
7268: correct type of dependency relationship and include any
7269: other <code class="filename">buildlink3.mk</code> files
7270: that it needs to find headers and libraries that it needs
7271: in turn.</p>
1.1 grant 7272:
1.14 xtraeme 7273: <p>To generate an initial <code class=
7274: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 7275: Rene Hexel's <a xmlns=
7276: "http://www.w3.org/TR/xhtml1/transitional" href=
7277: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20 ben 7278: class="pkgname">pkgtools/createbuildlink</a> package is
7279: highly recommended. For most packages, the following
7280: command will generate a good starting point for
7281: <code class="filename">buildlink3.mk</code> files:</p>
1.1 grant 7282: <pre class="screen">
1.14 xtraeme 7283: <code class="prompt">%</code> <strong class=
7284: "userinput"><code>cd pkgsrc/<em class=
7285: "replaceable"><code>category</code></em>/<em class=
7286: "replaceable"><code>pkgdir</code></em>
7287: <code class=
7288: "prompt">%</code> createbuildlink -3 >buildlink3.mk</code></strong>
1.1 grant 7289: </pre>
7290:
7291: <div class="sect2" lang="en" xml:lang="en">
7292: <div class="titlepage">
7293: <div>
7294: <div>
1.30 wiz 7295: <h3 class="title"><a name="anatomy-of-bl3" id=
7296: "anatomy-of-bl3"></a>10.2.1. Anatomy of a
1.25 rillig 7297: buildlink3.mk file</h3>
1.1 grant 7298: </div>
7299: </div>
7300: </div>
7301:
1.14 xtraeme 7302: <p>The following real-life example <code class=
7303: "filename">buildlink3.mk</code> is taken from
7304: <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 7305: <pre class="programlisting">
1.17 sketch 7306: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 7307:
7308: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
7309: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
7310:
7311: .if !empty(BUILDLINK_DEPTH:M+)
7312: BUILDLINK_DEPENDS+= tiff
7313: .endif
7314:
7315: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
7316: BUILDLINK_PACKAGES+= tiff
7317:
7318: .if !empty(TIFF_BUILDLINK3_MK:M+)
7319: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
7320: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
7321: .endif # TIFF_BUILDLINK3_MK
7322:
7323: .include "../../devel/zlib/buildlink3.mk"
7324: .include "../../graphics/jpeg/buildlink3.mk"
7325:
7326: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
7327: </pre>
7328:
1.14 xtraeme 7329: <p>The header and footer manipulate <code class=
7330: "varname">BUILDLINK_DEPTH</code>, which is common
7331: across all <code class="filename">buildlink3.mk</code>
7332: files and is used to track at what depth we are
7333: including <code class="filename">buildlink3.mk</code>
7334: files.</p>
1.1 grant 7335:
7336: <p>The first section controls if the dependency on
1.14 xtraeme 7337: <em class="replaceable"><code>pkg</code></em> is added.
7338: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 7339: global list of packages for which dependencies are
7340: added by buildlink3.</p>
7341:
7342: <p>The second section advises pkgsrc that the
1.14 xtraeme 7343: <code class="filename">buildlink3.mk</code> file for
7344: <em class="replaceable"><code>pkg</code></em> has been
7345: included at some point. <code class=
7346: "varname">BUILDLINK_PACKAGES</code> is the global list
7347: of packages for which <code class=
7348: "filename">buildlink3.mk</code> files have been
7349: included. It must <span class=
7350: "emphasis"><em>always</em></span> be appended to within
7351: a <code class="filename">buildlink3.mk</code> file.</p>
1.1 grant 7352:
7353: <p>The third section is protected from multiple
1.14 xtraeme 7354: inclusion and controls how the dependency on <em class=
7355: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 7356: important variables are set in the section:</p>
7357:
7358: <div class="itemizedlist">
7359: <ul type="disc">
7360: <li>
1.14 xtraeme 7361: <p><code class=
7362: "varname">BUILDLINK_DEPENDS.<em class=
7363: "replaceable"><code>pkg</code></em></code> is the
7364: actual dependency recorded in the installed
7365: package; this should always be set using
7366: <span><strong class="command">+=</strong></span>
7367: to ensure that we're appending to any
7368: pre-existing list of values. This variable should
7369: be set to the first version of the package that
7370: had the last change in the major number of a
7371: shared library or that had a major API
7372: change.</p>
1.1 grant 7373: </li>
7374:
7375: <li>
1.14 xtraeme 7376: <p><code class=
7377: "varname">BUILDLINK_PKGSRCDIR.<em class=
7378: "replaceable"><code>pkg</code></em></code> is the
7379: location of the <em class=
7380: "replaceable"><code>pkg</code></em> pkgsrc
1.1 grant 7381: directory;</p>
7382: </li>
7383:
7384: <li>
1.14 xtraeme 7385: <p><code class=
7386: "varname">BUILDLINK_DEPMETHOD.<em class=
7387: "replaceable"><code>pkg</code></em></code> (not
7388: shown above) controls whether we use <code class=
7389: "varname">BUILD_DEPENDS</code> or <code class=
7390: "varname">DEPENDS</code> to add the dependency on
7391: <em class="replaceable"><code>pkg</code></em>.
7392: The build dependency is selected by setting
7393: <code class=
7394: "varname">BUILDLINK_DEPMETHOD.<em class=
7395: "replaceable"><code>pkg</code></em></code> to
1.1 grant 7396: “<span class="quote">build</span>”.
7397: By default, the full dependency is used.</p>
7398: </li>
7399:
7400: <li>
1.14 xtraeme 7401: <p><code class=
7402: "varname">BUILDLINK_INCDIRS.<em class=
7403: "replaceable"><code>pkg</code></em></code> and
7404: <code class=
7405: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
7406: <code>pkg</code></em></code> (not shown above)
7407: are lists of subdirectories of <code class=
7408: "filename">${BUILDLINK_PREFIX.<em class=
7409: "replaceable"><code>pkg</code></em>}</code> to
7410: add to the header and library search paths. These
1.1 grant 7411: default to “<span class=
7412: "quote">include</span>” and
7413: “<span class="quote">lib</span>”
7414: respectively.</p>
7415: </li>
7416:
7417: <li>
1.14 xtraeme 7418: <p><code class=
7419: "varname">BUILDLINK_CPPFLAGS.<em class=
7420: "replaceable"><code>pkg</code></em></code> (not
7421: shown above) is the list of preprocessor flags to
7422: add to <code class="varname">CPPFLAGS</code>,
7423: which are passed on to the configure and build
7424: phases. The “<span class=
7425: "quote">-I</span>” option should be avoided
7426: and instead be handled using <code class=
7427: "varname">BUILDLINK_INCDIRS.<em class=
7428: "replaceable"><code>pkg</code></em></code> as
7429: above.</p>
1.1 grant 7430: </li>
7431: </ul>
7432: </div>
7433:
7434: <p>The following variables are all optionally defined
7435: within this second section (protected against multiple
7436: inclusion) and control which package files are
1.14 xtraeme 7437: symlinked into <code class=
7438: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 7439: are transformed during the symlinking:</p>
7440:
7441: <div class="itemizedlist">
7442: <ul type="disc">
7443: <li>
1.14 xtraeme 7444: <p><code class=
7445: "varname">BUILDLINK_FILES.<em class=
7446: "replaceable"><code>pkg</code></em></code> (not
7447: shown above) is a shell glob pattern relative to
7448: <code class=
7449: "filename">${BUILDLINK_PREFIX.<em class=
7450: "replaceable"><code>pkg</code></em>}</code> to be
7451: symlinked into <code class=
7452: "filename">${BUILDLINK_DIR}</code>, e.g.
7453: <code class="filename">include/*.h</code>.</p>
1.1 grant 7454: </li>
7455:
7456: <li>
1.14 xtraeme 7457: <p><code class=
7458: "varname">BUILDLINK_FILES_CMD.<em class=
7459: "replaceable"><code>pkg</code></em></code> (not
7460: shown above) is a shell pipeline that outputs to
7461: stdout a list of files relative to <code class=
7462: "filename">${BUILDLINK_PREFIX.<em class=
7463: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 7464: resulting files are to be symlinked into
1.14 xtraeme 7465: <code class="filename">${BUILDLINK_DIR}</code>.
7466: By default, this takes the <code class=
7467: "filename">+CONTENTS</code> of a <em class=
7468: "replaceable"><code>pkg</code></em> and filters
7469: it through <code class=
7470: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
7471: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 7472: </li>
7473:
7474: <li>
1.14 xtraeme 7475: <p><code class=
7476: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
7477: "replaceable"><code>pkg</code></em></code> (not
7478: shown above) is a filter command that filters
7479: <code class="filename">+CONTENTS</code> input
7480: into a list of files relative to <code class=
7481: "filename">${BUILDLINK_PREFIX.<em class=
7482: "replaceable"><code>pkg</code></em>}</code> on
7483: stdout. By default for overwrite packages,
7484: <code class=
7485: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
7486: "replaceable"><code>pkg</code></em></code>
7487: outputs the contents of the <code class=
7488: "filename">include</code> and <code class=
7489: "filename">lib</code> directories in the package
7490: <code class="filename">+CONTENTS</code>, and for
7491: pkgviews packages, it outputs any libtool
7492: archives in <code class="filename">lib</code>
1.1 grant 7493: directories.</p>
7494: </li>
7495:
7496: <li>
1.14 xtraeme 7497: <p><code class=
7498: "varname">BUILDLINK_TRANSFORM.<em class=
7499: "replaceable"><code>pkg</code></em></code> (not
7500: shown above) is a list of sed arguments used to
1.1 grant 7501: transform the name of the source filename into a
1.14 xtraeme 7502: destination filename, e.g. <span><strong class=
1.1 grant 7503: "command">-e
1.14 xtraeme 7504: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 7505: </li>
7506: </ul>
7507: </div>
7508:
1.14 xtraeme 7509: <p>The last section includes any <code class=
7510: "filename">buildlink3.mk</code> needed for <em class=
7511: "replaceable"><code>pkg</code></em>'s library
7512: dependencies. Including these <code class=
7513: "filename">buildlink3.mk</code> files means that the
7514: headers and libraries for these dependencies are also
7515: symlinked into <code class=
7516: "filename">${BUILDLINK_DIR}</code> whenever the
7517: <em class="replaceable"><code>pkg</code></em>
7518: <code class="filename">buildlink3.mk</code> file is
7519: included.</p>
1.1 grant 7520: </div>
7521:
7522: <div class="sect2" lang="en" xml:lang="en">
7523: <div class="titlepage">
7524: <div>
7525: <div>
1.30 wiz 7526: <h3 class="title"><a name=
7527: "updating-buildlink-depends" id=
7528: "updating-buildlink-depends"></a>10.2.2. Updating
7529: <code class=
7530: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
7531: <code>pkg</code></em></code> in <code class=
7532: "filename">buildlink3.mk</code> files</h3>
1.1 grant 7533: </div>
7534: </div>
7535: </div>
7536:
7537: <p>There are two situations that require increasing the
1.14 xtraeme 7538: dependency listed in <code class=
7539: "varname">BUILDLINK_DEPENDS.<em class=
7540: "replaceable"><code>pkg</code></em></code> after a
7541: package update:</p>
1.1 grant 7542:
7543: <div class="orderedlist">
7544: <ol type="1">
7545: <li>
7546: <p>if the sonames (major number of the library
7547: version) of any installed shared libraries
7548: change;</p>
7549: </li>
7550:
7551: <li>
7552: <p>if the API or interface to the header files
7553: change.</p>
7554: </li>
7555: </ol>
7556: </div>
7557:
1.14 xtraeme 7558: <p>In these cases, <code class=
7559: "varname">BUILDLINK_DEPENDS.<em class=
7560: "replaceable"><code>pkg</code></em></code> should be
7561: adjusted to require at least the new package version.
7562: In some cases, the packages that depend on this new
7563: version may need their <code class=
7564: "varname">PKGREVISION</code>s increased and, if they
7565: have <code class="filename">buildlink3.mk</code> files,
7566: their <code class=
7567: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
7568: pkg</code></em></code> adjusted, too. This is needed so
7569: that binary packages made using it will require the
7570: correct package dependency and not settle for an older
7571: one which will not contain the necessary shared
7572: libraries.</p>
1.1 grant 7573:
7574: <p>Please take careful consideration before adjusting
1.14 xtraeme 7575: <code class="varname">BUILDLINK_DEPENDS.<em class=
7576: "replaceable"><code>pkg</code></em></code> as we don't
7577: want to cause unneeded package deletions and rebuilds.
7578: In many cases, new versions of packages work just fine
7579: with older dependencies. See <a href="#dependencies"
1.35 jmmv 7580: title="14.1.4. Handling dependencies">Section
1.36 ! wiz 7581: 14.1.4, “Handling dependencies”</a> for
! 7582: more information about dependencies on other packages,
1.25 rillig 7583: including the <code class=
7584: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
7585: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 7586: </div>
7587: </div>
7588:
7589: <div class="sect1" lang="en" xml:lang="en">
7590: <div class="titlepage">
7591: <div>
7592: <div>
7593: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7594: "writing-builtin.mk" id=
7595: "writing-builtin.mk"></a>10.3. Writing
1.14 xtraeme 7596: <code class="filename">builtin.mk</code> files</h2>
1.1 grant 7597: </div>
7598: </div>
7599: </div>
7600:
7601: <p>Some packages in pkgsrc install headers and libraries
7602: that coincide with headers and libraries present in the
1.14 xtraeme 7603: base system. Aside from a <code class=
7604: "filename">buildlink3.mk</code> file, these packages
7605: should also include a <code class=
7606: "filename">builtin.mk</code> file that includes the
7607: necessary checks to decide whether using the built-in
7608: software or the pkgsrc software is appropriate.</p>
1.1 grant 7609:
7610: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 7611: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 7612:
7613: <div class="orderedlist">
7614: <ol type="1">
7615: <li>
1.14 xtraeme 7616: <p>It should set <code class=
7617: "varname">USE_BUILTIN.<em class=
7618: "replaceable"><code>pkg</code></em></code> to
7619: either “<span class="quote">yes</span>”
7620: or “<span class="quote">no</span>”
7621: after it is included.</p>
1.1 grant 7622: </li>
7623:
7624: <li>
7625: <p>It should <span class=
7626: "emphasis"><em>not</em></span> override any
1.14 xtraeme 7627: <code class="varname">USE_BUILTIN.<em class=
7628: "replaceable"><code>pkg</code></em></code> which is
7629: already set before the <code class=
7630: "filename">builtin.mk</code> file is included.</p>
1.1 grant 7631: </li>
7632:
7633: <li>
7634: <p>It should be written to allow multiple
7635: inclusion. This is <span class=
7636: "emphasis"><em>very</em></span> important and takes
1.14 xtraeme 7637: careful attention to <code class=
7638: "filename">Makefile</code> coding.</p>
1.1 grant 7639: </li>
7640: </ol>
7641: </div>
7642:
7643: <div class="sect2" lang="en" xml:lang="en">
7644: <div class="titlepage">
7645: <div>
7646: <div>
1.30 wiz 7647: <h3 class="title"><a name="anatomy-of-builtin.mk"
7648: id=
7649: "anatomy-of-builtin.mk"></a>10.3.1. Anatomy
7650: of a <code class="filename">builtin.mk</code>
1.14 xtraeme 7651: file</h3>
1.1 grant 7652: </div>
7653: </div>
7654: </div>
7655:
7656: <p>The following is the recommended template for
7657: builtin.mk files:</p>
7658: <pre class="programlisting">
7659: .if !defined(IS_BUILTIN.foo)
7660: #
7661: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
7662: # genuinely exists in the system or not.
7663: #
7664: IS_BUILTIN.foo?= no
7665:
7666: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
7667: # version can be determined.
7668: #
7669: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
7670: BUILTIN_PKG.foo?= foo-1.0
7671: . endif
7672: .endif # IS_BUILTIN.foo
7673:
7674: .if !defined(USE_BUILTIN.foo)
7675: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
7676: . if defined(BUILTIN_PKG.foo)
7677: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
7678: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
7679: USE_BUILTIN.foo!= \
7680: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
7681: ${ECHO} "yes"; \
7682: else \
7683: ${ECHO} "no"; \
7684: fi
7685: . endif
7686: . endfor
7687: . endif
7688: .endif # USE_BUILTIN.foo
7689:
7690: CHECK_BUILTIN.foo?= no
7691: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
7692: #
7693: # Here we place code that depends on whether USE_BUILTIN.foo is set to
7694: # "yes" or "no".
7695: #
7696: .endif # CHECK_BUILTIN.foo
7697:
7698: </pre>
7699:
1.14 xtraeme 7700: <p>The first section sets <code class=
7701: "varname">IS_BUILTIN.<em class=
7702: "replaceable"><code>pkg</code></em></code> depending on
7703: if <em class="replaceable"><code>pkg</code></em> really
7704: exists in the base system. This should not be a base
7705: system software with similar functionality to
7706: <em class="replaceable"><code>pkg</code></em>; it
7707: should only be “<span class=
7708: "quote">yes</span>” if the actual package is
7709: included as part of the base system. This variable is
7710: only used internally within the <code class=
7711: "filename">builtin.mk</code> file.</p>
7712:
7713: <p>The second section sets <code class=
7714: "varname">BUILTIN_PKG.<em class=
7715: "replaceable"><code>pkg</code></em></code> to the
7716: version of <em class=
7717: "replaceable"><code>pkg</code></em> in the base system
7718: if it exists (if <code class=
7719: "varname">IS_BUILTIN.<em class=
7720: "replaceable"><code>pkg</code></em></code> is
1.1 grant 7721: “<span class="quote">yes</span>”). This
1.14 xtraeme 7722: variable is only used internally within the
7723: <code class="filename">builtin.mk</code> file.</p>
1.1 grant 7724:
1.14 xtraeme 7725: <p>The third section sets <code class=
7726: "varname">USE_BUILTIN.<em class=
7727: "replaceable"><code>pkg</code></em></code> and is
7728: <span class="emphasis"><em>required</em></span> in all
7729: <code class="filename">builtin.mk</code> files. The
7730: code in this section must make the determination
7731: whether the built-in software is adequate to satisfy
7732: the dependencies listed in <code class=
7733: "varname">BUILDLINK_DEPENDS.<em class=
7734: "replaceable"><code>pkg</code></em></code>. This is
7735: typically done by comparing <code class=
7736: "varname">BUILTIN_PKG.<em class=
7737: "replaceable"><code>pkg</code></em></code> against each
7738: of the dependencies in <code class=
7739: "varname">BUILDLINK_DEPENDS.<em class=
7740: "replaceable"><code>pkg</code></em></code>.
7741: <code class="varname">USE_BUILTIN.<em class=
7742: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 7743: "emphasis"><em>must</em></span> be set to the correct
1.14 xtraeme 7744: value by the end of the <code class=
7745: "filename">builtin.mk</code> file. Note that
7746: <code class="varname">USE_BUILTIN.<em class=
7747: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 7748: “<span class="quote">yes</span>” even if
1.14 xtraeme 7749: <code class="varname">IS_BUILTIN.<em class=
7750: "replaceable"><code>pkg</code></em></code> is
1.1 grant 7751: “<span class="quote">no</span>” because we
7752: may make the determination that the built-in version of
7753: the software is similar enough to be used as a
7754: replacement.</p>
7755:
1.14 xtraeme 7756: <p>The last section is guarded by <code class=
7757: "varname">CHECK_BUILTIN.<em class=
7758: "replaceable"><code>pkg</code></em></code>, and
7759: includes code that uses the value of <code class=
7760: "varname">USE_BUILTIN.<em class=
7761: "replaceable"><code>pkg</code></em></code> set in the
7762: previous section. This typically includes, e.g., adding
1.1 grant 7763: additional dependency restrictions and listing
1.14 xtraeme 7764: additional files to symlink into <code class=
7765: "filename">${BUILDLINK_DIR}</code> (via <code class=
7766: "varname">BUILDLINK_FILES.<em class=
7767: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 7768: </div>
7769:
7770: <div class="sect2" lang="en" xml:lang="en">
7771: <div class="titlepage">
7772: <div>
7773: <div>
1.30 wiz 7774: <h3 class="title"><a name=
7775: "native-or-pkgsrc-preference" id=
7776: "native-or-pkgsrc-preference"></a>10.3.2. Global
7777: preferences for native or pkgsrc software</h3>
1.1 grant 7778: </div>
7779: </div>
7780: </div>
7781:
7782: <p>When building packages, it's possible to choose
7783: whether to set a global preference for using either the
7784: built-in (native) version or the pkgsrc version of
7785: software to satisfy a dependency. This is controlled by
1.14 xtraeme 7786: setting <code class="varname">PREFER_PKGSRC</code> and
7787: <code class="varname">PREFER_NATIVE</code>. These
7788: variables take values of either “<span class=
1.1 grant 7789: "quote">yes</span>”, “<span class=
7790: "quote">no</span>”, or a list of packages.
1.14 xtraeme 7791: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
7792: to use the pkgsrc versions of software, while
7793: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
7794: to use the built-in versions. Preferences are
7795: determined by the most specific instance of the package
7796: in either <code class="varname">PREFER_PKGSRC</code> or
7797: <code class="varname">PREFER_NATIVE</code>. If a
7798: package is specified in neither or in both variables,
7799: then <code class="varname">PREFER_PKGSRC</code> has
7800: precedence over <code class=
7801: "varname">PREFER_NATIVE</code>. For example, to require
7802: using pkgsrc versions of software for all but the most
7803: basic bits on a NetBSD system, you can set:</p>
1.1 grant 7804: <pre class="programlisting">
7805: PREFER_PKGSRC= yes
7806: PREFER_NATIVE= getopt skey tcp_wrappers
7807:
7808: </pre>
7809:
7810: <p>A package <span class=
1.14 xtraeme 7811: "emphasis"><em>must</em></span> have a <code class=
7812: "filename">builtin.mk</code> file to be listed in
7813: <code class="varname">PREFER_NATIVE</code>, otherwise
7814: it is simply ignored in that list.</p>
1.1 grant 7815: </div>
7816: </div>
7817: </div>
7818:
7819: <div class="chapter" lang="en" xml:lang="en">
7820: <div class="titlepage">
7821: <div>
7822: <div>
1.35 jmmv 7823: <h2 class="title"><a name="pkginstall" id=
7824: "pkginstall"></a>Chapter 11. The pkginstall
7825: framework</h2>
1.1 grant 7826: </div>
7827: </div>
7828: </div>
7829:
7830: <div class="toc">
7831: <p><b>Table of Contents</b></p>
7832:
7833: <dl>
1.30 wiz 7834: <dt><span class="sect1"><a href=
1.35 jmmv 7835: "#files-and-dirs-outside-prefix">11.1. Files and
7836: directories outside the installation
7837: prefix</a></span></dt>
7838:
7839: <dd>
7840: <dl>
7841: <dt><span class="sect2"><a href=
7842: "#dirs-outside-prefix">11.1.1. Directory
7843: manipulation</a></span></dt>
7844:
7845: <dt><span class="sect2"><a href=
7846: "#files-outside-prefix">11.1.2. File
7847: manipulation</a></span></dt>
7848: </dl>
7849: </dd>
7850:
7851: <dt><span class="sect1"><a href="#conf-files">11.2.
7852: Configuration files</a></span></dt>
7853:
7854: <dd>
7855: <dl>
7856: <dt><span class="sect2"><a href=
7857: "#conf-files-sysconfdir">11.2.1. How <code class=
7858: "varname">PKG_SYSCONFDIR</code> is
7859: set</a></span></dt>
7860:
7861: <dt><span class="sect2"><a href=
7862: "#conf-files-configure">11.2.2. Telling the
7863: software were configuration files
7864: are</a></span></dt>
7865:
7866: <dt><span class="sect2"><a href=
7867: "#conf-files-patching">11.2.3. Patching
7868: installations</a></span></dt>
7869:
7870: <dt><span class="sect2"><a href=
7871: "#conf-files-disable">11.2.4. Disabling handling of
7872: configuration files</a></span></dt>
7873: </dl>
7874: </dd>
7875:
7876: <dt><span class="sect1"><a href="#rcd-scripts">11.3.
7877: System startup scripts</a></span></dt>
7878:
7879: <dd>
7880: <dl>
7881: <dt><span class="sect2"><a href=
7882: "#rcd-scripts-disable">11.3.1. Disabling handling
7883: of system startup scripts</a></span></dt>
7884: </dl>
7885: </dd>
1.1 grant 7886:
1.30 wiz 7887: <dt><span class="sect1"><a href=
1.35 jmmv 7888: "#users-and-groups">11.4. System users and
7889: groups</a></span></dt>
7890:
7891: <dt><span class="sect1"><a href="#shells">11.5. System
7892: shells</a></span></dt>
7893:
7894: <dd>
7895: <dl>
7896: <dt><span class="sect2"><a href=
7897: "#shells-disable">11.5.1. Disabling handling of
7898: configuration files</a></span></dt>
7899: </dl>
7900: </dd>
1.1 grant 7901: </dl>
7902: </div>
7903:
1.35 jmmv 7904: <p>This chapter describes the framework known as
7905: <code class="literal">pkginstall</code>, whose key features
7906: are:</p>
7907:
7908: <div class="itemizedlist">
7909: <ul type="disc">
7910: <li>
7911: <p>Generic installation and manipulation of
7912: directories and files outside the pkgsrc-handled
7913: tree, <code class="varname">LOCALBASE</code>.</p>
7914: </li>
7915:
7916: <li>
7917: <p>Automatic handling of configuration files during
7918: installation, provided that packages are correctly
7919: designed.</p>
7920: </li>
7921:
7922: <li>
7923: <p>Generation and installation of system startup
7924: scripts.</p>
7925: </li>
7926:
7927: <li>
7928: <p>Registration of system users and groups.</p>
7929: </li>
7930:
7931: <li>
7932: <p>Registration of system shells.</p>
7933: </li>
7934: </ul>
7935: </div>
7936:
7937: <p>The following sections inspect each of the above points
7938: in detail. Note that, in order to use any of the described
7939: functionalities, you must add the following to your
7940: package's <code class="filename">Makefile</code>:</p>
7941: <pre class="programlisting">
7942: USE_PKGINSTALL=YES
7943: </pre>
7944:
7945: <p>You may be thinking that many of the things described
7946: here could be easily done with simple code in the package's
7947: post-installation target (<code class=
7948: "literal">post-install</code>). <span class=
7949: "emphasis"><em>This is incorrect</em></span>, as the code
7950: in them is only executed when building from source.
7951: Machines using binary packages could not benefit from it at
7952: all (as the code itself could be unavailable). Therefore,
7953: the only way to achieve any of the items described above is
7954: by means of the installation scripts, which are
7955: automatically generated by pkginstall.</p>
1.1 grant 7956:
7957: <div class="sect1" lang="en" xml:lang="en">
7958: <div class="titlepage">
7959: <div>
7960: <div>
7961: <h2 class="title" style="clear: both"><a name=
1.35 jmmv 7962: "files-and-dirs-outside-prefix" id=
7963: "files-and-dirs-outside-prefix"></a>11.1. Files and
7964: directories outside the installation prefix</h2>
1.1 grant 7965: </div>
7966: </div>
7967: </div>
7968:
1.35 jmmv 7969: <p>As you already know, the <code class=
7970: "filename">PLIST</code> file holds a list of files and
7971: directories that belong to a package. The names used in
7972: it are relative to the installation prefix (<code class=
7973: "filename">${PREFIX}</code>), which means that it cannot
7974: register files outside this directory (absolute path
7975: names are not allowed). Despite this restriction, some
7976: packages need to install files outside this location;
7977: e.g., under <code class="filename">${VARBASE}</code> or
7978: <code class="filename">${PKG_SYSCONFDIR}</code>.</p>
7979:
7980: <p>The only way to achieve this is to create such files
7981: during installation time by using the installation
7982: scripts. These scripts can run arbitrary commands, so
7983: they have the potential to create and manage files
7984: anywhere in the filesystem. Here is where pkginstall
7985: comes into play: it provides generic scripts to abstract
7986: the manipulation of such files and directories based on
7987: variables set in the package's <code class=
7988: "filename">Makefile</code>. The rest of this section
7989: describes which these variables are.</p>
1.1 grant 7990:
1.35 jmmv 7991: <div class="sect2" lang="en" xml:lang="en">
7992: <div class="titlepage">
1.1 grant 7993: <div>
1.35 jmmv 7994: <div>
7995: <h3 class="title"><a name="dirs-outside-prefix"
7996: id="dirs-outside-prefix"></a>11.1.1. Directory
7997: manipulation</h3>
7998: </div>
1.1 grant 7999: </div>
8000: </div>
8001:
1.35 jmmv 8002: <p>The following variables can be set to request the
8003: creation of directories anywhere in the filesystem:</p>
1.27 rillig 8004:
1.35 jmmv 8005: <div class="itemizedlist">
8006: <ul type="disc">
8007: <li>
8008: <p><code class="varname">MAKE_DIRS</code> and
8009: <code class="varname">OWN_DIRS</code> contain a
8010: list of directories that should be created and
8011: should attempt to be destroyed by the
8012: installation scripts. The difference between the
8013: two is that the latter prompts the administrator
8014: to remove any directories that may be left after
8015: deinstallation (because they were not empty),
8016: while the former does not.</p>
8017: </li>
1.1 grant 8018:
1.35 jmmv 8019: <li>
8020: <p><code class="varname">MAKE_DIRS_PERMS</code>
8021: and <code class="varname">OWN_DIRS_PERMS</code>
8022: contain a list of tuples describing which
8023: directories should be created and should attempt
8024: to be destroyed by the installation scripts. Each
8025: tuple holds the following values, separated by
8026: spaces: the directory name, its owner, its group
8027: and its numerical mode. For example:</p>
8028: <pre class="programlisting">
8029: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
8030: </pre>
1.1 grant 8031:
1.35 jmmv 8032: <p>The difference between the two is exactly the
8033: same as their non-<code class=
8034: "varname">PERMS</code> counterparts.</p>
8035: </li>
8036: </ul>
8037: </div>
8038: </div>
8039:
8040: <div class="sect2" lang="en" xml:lang="en">
8041: <div class="titlepage">
8042: <div>
8043: <div>
8044: <h3 class="title"><a name="files-outside-prefix"
8045: id="files-outside-prefix"></a>11.1.2. File
8046: manipulation</h3>
8047: </div>
8048: </div>
8049: </div>
8050:
8051: <p>Creating non-empty files outside the installation
8052: prefix is tricky because the <code class=
8053: "filename">PLIST</code> forces all files to be inside
8054: it. To overcome this problem, the only solution is to
8055: extract the file in the known place (i.e., inside the
8056: installation prefix) and copy it to the appropriate
8057: location during installation (done by the installation
8058: scripts generated by pkginstall). We will call the
8059: former the <span class="emphasis"><em>master
8060: file</em></span> in the following paragraphs, which
8061: describe the variables that can be used to
8062: automatically and consistently handle files outside the
8063: installation prefix:</p>
8064:
8065: <div class="itemizedlist">
8066: <ul type="disc">
8067: <li>
8068: <p><code class="varname">CONF_FILES</code> and
8069: <code class="varname">SUPPORT_FILES</code> are
8070: pairs of master and target files. During
8071: installation time, the master file is copied to
8072: the target one if and only if the latter does not
8073: exist. Upon deinstallation, the target file is
8074: removed provided that it was not modified by the
8075: installation.</p>
8076:
8077: <p>The difference between the two is that the
8078: latter prompts the administrator to remove any
8079: files that may be left after deinstallation
8080: (because they were not empty), while the former
8081: does not.</p>
8082: </li>
8083:
8084: <li>
8085: <p><code class="varname">CONF_FILES_PERMS</code>
8086: and <code class=
8087: "varname">SUPPORT_FILES_PERMS</code> contain
8088: tuples describing master files as well as their
8089: target locations. For each of them, it also
8090: specifies their owner, their group and their
8091: numeric permissions, in this order. For
8092: example:</p>
8093: <pre class="programlisting">
8094: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
8095: </pre>
8096:
8097: <p>The difference between the two is exactly the
8098: same as their non-<code class=
8099: "varname">PERMS</code> counterparts.</p>
8100: </li>
8101: </ul>
8102: </div>
8103: </div>
8104: </div>
8105:
8106: <div class="sect1" lang="en" xml:lang="en">
8107: <div class="titlepage">
8108: <div>
8109: <div>
8110: <h2 class="title" style="clear: both"><a name=
8111: "conf-files" id="conf-files"></a>11.2.
8112: Configuration files</h2>
8113: </div>
8114: </div>
8115: </div>
8116:
8117: <p>Configuration files are special in the sense that they
8118: are installed in their own specific directory,
8119: <code class="varname">PKG_SYSCONFDIR</code>, and need
8120: special treatment during installation (most of which is
8121: automated by pkginstall). The main concept you must bear
1.36 ! wiz 8122: in mind is that files marked as configuration files are
1.35 jmmv 8123: automatically copied to the right place (somewhere inside
8124: <code class="varname">PKG_SYSCONFDIR</code>) during
8125: installation <span class="emphasis"><em>if and only
8126: if</em></span> they didn't exist before. Similarly, they
8127: will not be removed if they have local modifications.
1.36 ! wiz 8128: This ensures that administrators never lose any custom
1.35 jmmv 8129: changes they may have made.</p>
8130:
8131: <div class="sect2" lang="en" xml:lang="en">
8132: <div class="titlepage">
8133: <div>
8134: <div>
8135: <h3 class="title"><a name="conf-files-sysconfdir"
8136: id="conf-files-sysconfdir"></a>11.2.1. How
8137: <code class="varname">PKG_SYSCONFDIR</code> is
8138: set</h3>
8139: </div>
8140: </div>
8141: </div>
8142:
8143: <p>As said before, the <code class=
8144: "varname">PKG_SYSCONFDIR</code> variable specifies
8145: where configuration files shall be installed. Its
8146: contents are set based upon the following
8147: variables:</p>
8148:
8149: <div class="itemizedlist">
8150: <ul type="disc">
8151: <li>
8152: <p><code class="varname">PKG_SYSCONFBASE</code>:
8153: The configuration's root directory. Defaults to
8154: <code class="filename">${PREFIX}/etc</code>
1.36 ! wiz 8155: although it may be overridden by the user to
! 8156: point to his preferred location (e.g.,
! 8157: <code class="filename">/etc</code>, <code class=
1.35 jmmv 8158: "filename">/etc/pkg</code>, etc.). Packages must
8159: not use it directly.</p>
8160: </li>
8161:
8162: <li>
8163: <p><code class=
8164: "varname">PKG_SYSCONFSUBDIR</code>: A
8165: subdirectory of <code class=
8166: "varname">PKG_SYSCONFBASE</code> under which the
8167: configuration files for the package being built
8168: shall be installed. The definition of this
8169: variable only makes sense in the package's
8170: <code class="filename">Makefile</code> (i.e., it
8171: is not user customizable).</p>
8172:
8173: <p>As an example, consider the Apache package,
8174: <a xmlns=
8175: "http://www.w3.org/TR/xhtml1/transitional" href=
8176: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
8177: class="pkgname">www/apache2</a>, which places its
8178: configuration files under the <code class=
8179: "filename">httpd/</code> subdirectory of
8180: <code class="varname">PKG_SYSCONFBASE</code>.
8181: This should be set in the package Makefile.</p>
8182: </li>
8183:
8184: <li>
8185: <p><code class="varname">PKG_SYSCONFVAR</code>:
8186: Specifies the name of the variable that holds
8187: this package's configuration directory (if
8188: different from <code class=
8189: "varname">PKG_SYSCONFBASE</code>). It defaults to
8190: <code class="varname">PKGBASE</code>'s value, and
8191: is always prefixed with <code class=
8192: "literal">PKG_SYSCONFDIR</code>.</p>
8193: </li>
8194:
8195: <li>
8196: <p><code class=
8197: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
8198: Holds the directory where the configuration files
8199: for the package identified by <code class=
8200: "varname">PKG_SYSCONFVAR</code>'s shall be
8201: placed.</p>
8202: </li>
8203: </ul>
8204: </div>
8205:
8206: <p>Based on the above variables, pkginstall determines
8207: the value of <code class=
8208: "varname">PKG_SYSCONFDIR</code>, which is the
8209: <span class="emphasis"><em>only</em></span> variable
8210: that can be used within a package to refer to its
8211: configuration directory. The algorithm used to set its
8212: value is basically the following:</p>
8213:
8214: <div class="orderedlist">
8215: <ol type="1">
8216: <li>
8217: <p>If <code class=
8218: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
8219: is set, its value is used.</p>
8220: </li>
8221:
8222: <li>
8223: <p>If the previous variable is not defined but
8224: <code class="varname">PKG_SYSCONFSUBDIR</code> is
8225: set in the package's <code class=
8226: "filename">Makefile</code>, the resulting value
8227: is <code class=
8228: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
8229: </li>
8230:
8231: <li>
8232: <p>Otherwise, it is set to <code class=
8233: "filename">${PKG_SYSCONFBASE}</code>.</p>
8234: </li>
8235: </ol>
8236: </div>
8237:
8238: <p>It is worth mentioning that <code class=
8239: "filename">${PKG_SYSCONFDIR}</code> is automatically
8240: added to <code class="filename">OWN_DIRS</code>. See
8241: <a href="#dirs-outside-prefix" title=
8242: "11.1.1. Directory manipulation">Section 11.1.1,
8243: “Directory manipulation”</a> what this
8244: means.</p>
8245: </div>
8246:
8247: <div class="sect2" lang="en" xml:lang="en">
8248: <div class="titlepage">
8249: <div>
8250: <div>
8251: <h3 class="title"><a name="conf-files-configure"
8252: id="conf-files-configure"></a>11.2.2. Telling the
8253: software were configuration files are</h3>
8254: </div>
8255: </div>
8256: </div>
8257:
8258: <p>Given that pkgsrc (and users!) expect configuration
8259: files to be in a known place, you need to teach each
1.36 ! wiz 8260: package where it shall install its files. In some cases
1.35 jmmv 8261: you will have to patch the package Makefiles to achieve
8262: it. If you are lucky, though, it may be as easy as
8263: passing an extra flag to the configuration script; this
8264: is the case of GNU Autoconf generated files:</p>
8265: <pre class="programlisting">
8266: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
8267: </pre>
8268:
8269: <p>Note that this specifies where the package has to
8270: <span class="emphasis"><em>look for</em></span> its
8271: configuration files, not where they will be originally
8272: installed (although the difference is never explicit,
8273: unfortunately).</p>
8274: </div>
8275:
8276: <div class="sect2" lang="en" xml:lang="en">
8277: <div class="titlepage">
8278: <div>
8279: <div>
8280: <h3 class="title"><a name="conf-files-patching"
8281: id="conf-files-patching"></a>11.2.3. Patching
8282: installations</h3>
8283: </div>
8284: </div>
8285: </div>
8286:
8287: <p>As said before, pkginstall automatically handles
8288: configuration files. This means that <span class=
8289: "strong"><strong>the packages themselves must not touch
8290: the contents of <code class=
8291: "filename">${PKG_SYSCONFDIR}</code>
1.36 ! wiz 8292: directly</strong></span>. Bad news is that many
! 8293: software installation scripts will, out of the box,
! 8294: mess with the contents of that directory. So what is
! 8295: the correct procedure to fix this issue?</p>
1.35 jmmv 8296:
8297: <p>You must teach the package (usually by manually
8298: patching it) to install any configuration files under
8299: the examples hierarchy, <code class=
8300: "filename">share/examples/${PKGBASE}/</code>. This way,
8301: the <code class="filename">PLIST</code> registers them
8302: and the administrator always has the original copies
8303: available.</p>
8304:
8305: <p>Once the required configuration files are in place
8306: (i.e., under the examples hierarchy), the pkginstall
8307: framework can use them as master copies during the
8308: package installation to update what is in <code class=
8309: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
8310: the variables <code class="varname">CONF_FILES</code>
8311: and <code class="varname">CONF_FILES_PERMS</code> are
8312: used. Check out <a href="#files-outside-prefix" title=
8313: "11.1.2. File manipulation">Section 11.1.2,
8314: “File manipulation”</a> for information
8315: about their syntax and their purpose. Here is an
8316: example, taken from the <a xmlns=
8317: "http://www.w3.org/TR/xhtml1/transitional" href=
8318: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
8319: class="pkgname">mail/mutt</a> package:</p>
8320: <pre class="programlisting">
8321: EGDIR= ${PREFIX}/share/doc/mutt/samples
8322: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
8323: </pre>
8324:
8325: <p>Note that the <code class="varname">EGDIR</code>
8326: variable is specific to that package and has no meaning
8327: outside it.</p>
8328: </div>
8329:
8330: <div class="sect2" lang="en" xml:lang="en">
8331: <div class="titlepage">
8332: <div>
8333: <div>
8334: <h3 class="title"><a name="conf-files-disable"
8335: id="conf-files-disable"></a>11.2.4. Disabling
8336: handling of configuration files</h3>
8337: </div>
8338: </div>
8339: </div>
8340:
8341: <p>The automatic copying of config files can be toggled
8342: by setting the environment variable <code class=
8343: "varname">PKG_CONFIG</code> prior to package
8344: installation.</p>
8345: </div>
8346: </div>
8347:
8348: <div class="sect1" lang="en" xml:lang="en">
8349: <div class="titlepage">
8350: <div>
8351: <div>
8352: <h2 class="title" style="clear: both"><a name=
8353: "rcd-scripts" id="rcd-scripts"></a>11.3. System
8354: startup scripts</h2>
8355: </div>
8356: </div>
8357: </div>
8358:
8359: <p>System startup scripts are special files because they
8360: must be installed in a place known by the underlying OS,
8361: usually outside the installation prefix. Therefore, the
8362: same rules described in <a href=
8363: "#files-and-dirs-outside-prefix" title=
8364: "11.1. Files and directories outside the installation prefix">
8365: Section 11.1, “Files and directories outside the
8366: installation prefix”</a> apply, and the same
8367: solutions can be used. However, pkginstall provides a
1.36 ! wiz 8368: special mechanism to handle these files.</p>
1.35 jmmv 8369:
8370: <p>In order to provide system startup scripts, the
8371: package has to:</p>
8372:
8373: <div class="orderedlist">
8374: <ol type="1">
8375: <li>
8376: <p>Store the script inside <code class=
8377: "filename">${FILESDIR}</code>, with the
8378: <code class="literal">.sh</code> suffix appended.
8379: Considering the <a xmlns=
8380: "http://www.w3.org/TR/xhtml1/transitional" href=
8381: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
8382: class="pkgname">print/cups</a> package as an
1.36 ! wiz 8383: example, it has a <code class=
1.35 jmmv 8384: "filename">cupsd.sh</code> in its files
8385: directory.</p>
8386: </li>
8387:
8388: <li>
8389: <p>Tell pkginstall to handle it, appending the name
8390: of the script, without its extension, to the
8391: <code class="varname">RCD_SCRIPTS</code> variable.
8392: Continuing the previous example:</p>
8393: <pre class="programlisting">
8394: RCD_SCRIPTS+= cupsd
8395: </pre>
8396: </li>
8397: </ol>
8398: </div>
8399:
8400: <p>Once this is done, pkginstall will do the following
8401: steps for each script in an automated fashion:</p>
8402:
8403: <div class="orderedlist">
8404: <ol type="1">
8405: <li>
8406: <p>Process the file found in the files directory
8407: applying all the substitutions described in the
8408: <code class="filename">FILES_SUBST</code>
8409: variable.</p>
8410: </li>
8411:
8412: <li>
8413: <p>Copy the script from the files directory to the
8414: examples hierarchy, <code class=
8415: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 ! wiz 8416: Note that this master file must be explicitly
1.35 jmmv 8417: registered in the <code class=
8418: "filename">PLIST</code>.</p>
8419: </li>
8420:
8421: <li>
8422: <p>Add code to the installation scripts to copy the
8423: startup script from the examples hierarchy into the
8424: system-wide startup scripts directory.</p>
8425: </li>
8426: </ol>
8427: </div>
8428:
8429: <div class="sect2" lang="en" xml:lang="en">
8430: <div class="titlepage">
8431: <div>
8432: <div>
8433: <h3 class="title"><a name="rcd-scripts-disable"
8434: id="rcd-scripts-disable"></a>11.3.1. Disabling
8435: handling of system startup scripts</h3>
8436: </div>
8437: </div>
8438: </div>
8439:
8440: <p>The automatic copying of config files can be toggled
8441: by setting the environment variable <code class=
8442: "varname">PKG_RCD_SCRIPTS</code> prior to package
8443: installation. Note that the scripts will be always
8444: copied inside the examples hierarchy, <code class=
8445: "filename">${PREFIX}/share/examples/rc.d/</code>, no
8446: matter what the value of this variable is.</p>
8447: </div>
8448: </div>
8449:
8450: <div class="sect1" lang="en" xml:lang="en">
8451: <div class="titlepage">
8452: <div>
8453: <div>
8454: <h2 class="title" style="clear: both"><a name=
8455: "users-and-groups" id="users-and-groups"></a>11.4.
8456: System users and groups</h2>
8457: </div>
8458: </div>
8459: </div>
8460:
8461: <p>If a package needs to create special users and/or
8462: groups during installation, it can do so by using the
8463: pkginstall framework.</p>
8464:
8465: <p>Users can be created by adding entries to the
8466: <code class="varname">PKG_USERS</code> variable. Each
8467: entry has the following syntax, which mimics <code class=
8468: "filename">/etc/passwd</code>:</p>
8469: <pre class="programlisting">
8470: user:group[:[userid][:[descr][:[home][:shell]]]]
8471: </pre>
8472:
8473: <p>Only the user and group are required; everything else
8474: is optional, but the colons must be in the right places
8475: when specifying optional bits. By default, a new user
8476: will have home directory <code class=
8477: "filename">/nonexistent</code>, and login shell
8478: <code class="filename">/sbin/nologin</code> unless they
8479: are specified as part of the user element. Note that if
8480: the description contains spaces, then spaces should be
8481: double backslash-escaped, as in:</p>
8482: <pre class="programlisting">
8483: foo:foogrp::The\\ Foomister
8484: </pre>
8485:
8486: <p>Similarly, groups can be created using the
8487: <code class="varname">PKG_GROUPS</code> variable, whose
8488: syntax is:</p>
8489: <pre class="programlisting">
8490: group[:groupid]
8491: </pre>
8492:
8493: <p>As before, only the group name is required; the
8494: numeric identifier is optional.</p>
8495: </div>
8496:
8497: <div class="sect1" lang="en" xml:lang="en">
8498: <div class="titlepage">
8499: <div>
8500: <div>
8501: <h2 class="title" style="clear: both"><a name=
8502: "shells" id="shells"></a>11.5. System shells</h2>
8503: </div>
8504: </div>
8505: </div>
8506:
8507: <p>Packages that install system shells should register
8508: them in the shell database, <code class=
8509: "filename">/etc/shells</code>, to make things easier to
8510: the administrator. This must be done from the
8511: installation scripts to keep binary packages working on
8512: any system. pkginstall provides an easy way to accomplish
8513: this task.</p>
8514:
8515: <p>When a package provides a shell interpreter, it has to
8516: set the <code class="varname">PKG_SHELL</code> variable
8517: to its absolute file name. This will add some hooks to
8518: the installation scripts to handle it. Consider the
8519: following example, taken from <a xmlns=
8520: "http://www.w3.org/TR/xhtml1/transitional" href=
8521: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
8522: class="pkgname">shells/zsh</a>:</p>
8523: <pre class="programlisting">
8524: USE_PKGINSTALL= YES
8525: PKG_SHELL= ${PREFIX}/bin/zsh
8526: </pre>
8527:
8528: <div class="sect2" lang="en" xml:lang="en">
8529: <div class="titlepage">
8530: <div>
8531: <div>
8532: <h3 class="title"><a name="shells-disable" id=
8533: "shells-disable"></a>11.5.1. Disabling handling
8534: of configuration files</h3>
8535: </div>
8536: </div>
8537: </div>
8538:
8539: <p>The automatic registration of shell interpreters can
8540: be disabled by the administrator by setting the
8541: <code class="filename">PKG_REGISTER_SHELLS</code>
8542: environment variable to <code class=
8543: "literal">NO</code>.</p>
8544: </div>
8545: </div>
8546: </div>
8547:
8548: <div class="chapter" lang="en" xml:lang="en">
8549: <div class="titlepage">
8550: <div>
8551: <div>
8552: <h2 class="title"><a name="options" id=
8553: "options"></a>Chapter 12. Options
8554: handling</h2>
8555: </div>
8556: </div>
8557: </div>
8558:
8559: <div class="toc">
8560: <p><b>Table of Contents</b></p>
8561:
8562: <dl>
8563: <dt><span class="sect1"><a href=
8564: "#global-default-options">12.1. Global default
8565: options</a></span></dt>
8566:
8567: <dt><span class="sect1"><a href=
8568: "#converting-to-options">12.2. Converting packages to
8569: use <code class=
8570: "filename">bsd.options.mk</code></a></span></dt>
8571: </dl>
8572: </div>
8573:
8574: <p>Many packages have the ability to be built to support
8575: different sets of features. <code class=
8576: "filename">bsd.options.mk</code> is a framework in pkgsrc
8577: that provides generic handling of those options that
8578: determine different ways in which the packages can be
8579: built. It's possible for the user to specify exactly which
8580: sets of options will be built into a package or to allow a
8581: set of global default options apply.</p>
8582:
8583: <div class="sect1" lang="en" xml:lang="en">
8584: <div class="titlepage">
8585: <div>
8586: <div>
8587: <h2 class="title" style="clear: both"><a name=
8588: "global-default-options" id=
8589: "global-default-options"></a>12.1. Global
8590: default options</h2>
8591: </div>
8592: </div>
8593: </div>
8594:
8595: <p>Global default options are listed in <code class=
8596: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
8597: the options that should be built into every package if
8598: that option is supported. This variable should be set in
8599: <code class="filename">/etc/mk.conf</code>.</p>
8600: </div>
8601:
8602: <div class="sect1" lang="en" xml:lang="en">
8603: <div class="titlepage">
8604: <div>
8605: <div>
8606: <h2 class="title" style="clear: both"><a name=
8607: "converting-to-options" id=
8608: "converting-to-options"></a>12.2. Converting
8609: packages to use <code class=
8610: "filename">bsd.options.mk</code></h2>
8611: </div>
8612: </div>
8613: </div>
8614:
8615: <p>The following example shows how <code class=
8616: "filename">bsd.options.mk</code> should be used by the
8617: hypothetical ``wibble'' package, either in the package
8618: <code class="filename">Makefile</code>, or in a file,
8619: e.g. <code class="filename">options.mk</code>, that is
8620: included by the main package <code class=
8621: "filename">Makefile</code>.</p>
8622: <pre class="programlisting">
8623: # Global and legacy options
8624: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
8625: PKG_SUPPORTED_OPTIONS= ldap sasl
8626: PKG_SUGGESTED_OPTIONS= sasl
8627: PKG_OPTION_LEGACY_VARS= WIBBLE_USE_OPENLDAP:ldap USE_SASL2:sasl
8628:
8629: .include "../../mk/bsd.options.mk"
8630:
8631: # Package-specific option-handling
8632:
8633: ###
8634: ### LDAP support
8635: ###
8636: .if !empty(PKG_OPTIONS:Mldap)
8637: . include "../../databases/openldap/buildlink3.mk"
8638: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
8639: .endif
1.1 grant 8640:
8641: ###
8642: ### SASL authentication
8643: ###
8644: .if !empty(PKG_OPTIONS:Msasl)
8645: . include "../../security/cyrus-sasl2/buildlink3.mk"
8646: CONFIGURE_ARGS+= --enable-sasl=${BUILDLINK_PREFIX.sasl}
8647: .endif
8648: </pre>
8649:
1.28 rillig 8650: <p>The first section contains the information about which
8651: build options are supported by the package, and any
1.1 grant 8652: default options settings if needed.</p>
8653:
8654: <div class="orderedlist">
8655: <ol type="1">
8656: <li>
1.14 xtraeme 8657: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 8658: the name of the <a href=
1.1 grant 8659: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8660: <span class="citerefentry"><span class=
1.27 rillig 8661: "refentrytitle">make</span>(1)</span></a> variable
8662: that contains the options the user wishes to
8663: select. The recommended value is
8664: “<span class="quote">PKG_OPTIONS.<em class=
1.14 xtraeme 8665: "replaceable"><code>pkg</code></em></span>”
8666: but any package-specific value may be used. This
1.1 grant 8667: variable should be set in a package Makefile.</p>
8668: </li>
8669:
8670: <li>
1.14 xtraeme 8671: <p><code class=
8672: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
8673: build options supported by the package. This
8674: variable should be set in a package Makefile.</p>
1.1 grant 8675: </li>
8676:
8677: <li>
1.27 rillig 8678: <p><code class=
8679: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
8680: build options which are enabled by default.</p>
8681: </li>
8682:
8683: <li>
1.14 xtraeme 8684: <p><code class="varname">${PKG_OPTIONS_VAR}</code>
1.27 rillig 8685: (the variable named in <code class=
8686: "varname">PKG_OPTIONS_VAR</code>) lists the
8687: selected build options and overrides any default
8688: options given in <code class=
1.14 xtraeme 8689: "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1 grant 8690: options begin with a “<span class=
8691: "quote">-</span>”, then that option is always
8692: removed from the selected build options, e.g.</p>
8693: <pre class="programlisting">
1.36 ! wiz 8694: PKG_DEFAULT_OPTIONS= kerberos ldap sasl
! 8695: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
! 8696: WIBBLE_OPTIONS= ${PKG_DEFAULT_OPTIONS} -sasl
! 8697: # leads to PKG_OPTIONS = kerberos ldap
1.1 grant 8698: </pre>
8699:
8700: <p>or</p>
8701: <pre class="programlisting">
1.36 ! wiz 8702: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
! 8703: WIBBLE_OPTIONS= kerberos -ldap ldap
! 8704: # leads to PKG_OPTIONS = kerberos
1.1 grant 8705: </pre>
8706:
1.14 xtraeme 8707: <p>This variable should be set in <code class=
8708: "filename">/etc/mk.conf</code>.</p>
1.1 grant 8709: </li>
8710:
8711: <li>
1.28 rillig 8712: <p>The <code class=
8713: "varname">PKG_OPTIONS_LEGACY_VARS</code> is only
8714: needed if you are converting a package that had its
8715: own ad-hoc options handling to use <code class=
8716: "filename">bsd.options.mk</code>. It converts
8717: global or legacy options variables into an
8718: equivalent <code class=
8719: "varname">PKG_OPTIONS.<em class=
8720: "replaceable"><code>pkg</code></em></code>
8721: value.</p>
1.1 grant 8722: </li>
1.28 rillig 8723: </ol>
1.1 grant 8724: </div>
8725:
1.28 rillig 8726: <p>After the inclusion of bsd.options.mk, the variable
8727: <code class="varname">PKG_OPTIONS</code> contains the
8728: list of the selected build options, properly filtered to
8729: remove unsupported and duplicate options.</p>
8730:
1.1 grant 8731: <p>The remaining sections contain the logic that is
8732: specific to each option. There should be a check for
1.14 xtraeme 8733: every option listed in <code class=
8734: "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
8735: be clear documentation on what turning on the option will
8736: do in the comments preceding each section. The correct
8737: way to check for an option is to check whether it is
8738: listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1 grant 8739: </div>
8740: </div>
8741:
8742: <div class="chapter" lang="en" xml:lang="en">
8743: <div class="titlepage">
8744: <div>
8745: <div>
8746: <h2 class="title"><a name="build" id=
1.35 jmmv 8747: "build"></a>Chapter 13. The build
1.1 grant 8748: process</h2>
8749: </div>
8750: </div>
8751: </div>
8752:
8753: <div class="toc">
8754: <p><b>Table of Contents</b></p>
8755:
8756: <dl>
1.35 jmmv 8757: <dt><span class="sect1"><a href="#build.prefix">13.1.
1.1 grant 8758: Program location</a></span></dt>
8759:
1.35 jmmv 8760: <dt><span class="sect1"><a href="#main-targets">13.2.
1.30 wiz 8761: Main targets</a></span></dt>
1.1 grant 8762:
8763: <dt><span class="sect1"><a href=
1.35 jmmv 8764: "#build.helpful-targets">13.3. Other helpful
1.1 grant 8765: targets</a></span></dt>
8766: </dl>
8767: </div>
8768:
8769: <p>The basic steps for building a program are always the
8770: same. First the program's source (<span class=
8771: "emphasis"><em>distfile</em></span>) must be brought to the
8772: local system and then extracted. After any patches to
8773: compile properly on NetBSD are applied, the software can be
8774: configured, then built (usually by compiling), and finally
8775: the generated binaries, etc. can be put into place on the
8776: system. These are exactly the steps performed by the NetBSD
8777: package system, which is implemented as a series of targets
1.14 xtraeme 8778: in a central Makefile, <code class=
8779: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 8780:
8781: <div class="sect1" lang="en" xml:lang="en">
8782: <div class="titlepage">
8783: <div>
8784: <div>
8785: <h2 class="title" style="clear: both"><a name=
8786: "build.prefix" id=
1.35 jmmv 8787: "build.prefix"></a>13.1. Program location</h2>
1.1 grant 8788: </div>
8789: </div>
8790: </div>
8791:
8792: <p>Before outlining the process performed by the NetBSD
8793: package system in the next section, here's a brief
8794: discussion on where programs are installed, and which
8795: variables influence this.</p>
8796:
1.14 xtraeme 8797: <p>The automatic variable <code class=
8798: "varname">PREFIX</code> indicates where all files of the
8799: final program shall be installed. It is usually set to
8800: <code class="varname">LOCALBASE</code> (<code class=
8801: "filename">/usr/pkg</code>), or <code class=
8802: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 8803: “<span class="quote">cross</span>” category.
1.14 xtraeme 8804: The value of <code class="varname">PREFIX</code> needs to
8805: be put into the various places in the program's source
8806: where paths to these files are encoded. See <a href=
1.1 grant 8807: "#components.patches" title=
1.27 rillig 8808: "7.3. patches/*">Section 7.3,
1.1 grant 8809: “patches/*”</a> and <a href="#fixes.libtool"
8810: title=
1.35 jmmv 8811: "14.3.1. Shared libraries - libtool">Section 14.3.1,
1.1 grant 8812: “Shared libraries - libtool”</a> for more
8813: details.</p>
8814:
8815: <p>When choosing which of these variables to use, follow
8816: the following rules:</p>
8817:
8818: <div class="itemizedlist">
8819: <ul type="disc">
8820: <li>
1.14 xtraeme 8821: <p><code class="varname">PREFIX</code> always
8822: points to the location where the current pkg will
8823: be installed. When referring to a pkg's own
1.1 grant 8824: installation path, use “<span class=
8825: "quote">${PREFIX}</span>”.</p>
8826: </li>
8827:
8828: <li>
1.14 xtraeme 8829: <p><code class="varname">LOCALBASE</code> is where
8830: all non-X11 pkgs are installed. If you need to
1.1 grant 8831: construct a -I or -L argument to the compiler to
8832: find includes and libraries installed by another
8833: non-X11 pkg, use “<span class=
8834: "quote">${LOCALBASE}</span>”.</p>
8835: </li>
8836:
8837: <li>
1.14 xtraeme 8838: <p><code class="varname">X11BASE</code> is where
8839: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 8840: installed. When looking for <span class=
8841: "emphasis"><em>standard</em></span> X11 includes
8842: (not those installed by a pkg), use
8843: “<span class=
8844: "quote">${X11BASE}</span>”.</p>
8845: </li>
8846:
8847: <li>
8848: <p>X11 based are special in that they may be
1.14 xtraeme 8849: installed in either <code class=
8850: "varname">X11BASE</code> or <code class=
8851: "varname">LOCALBASE</code>.</p>
1.1 grant 8852:
8853: <p>Usually, X11 packages should be installed under
1.14 xtraeme 8854: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 8855: possible. Note that you will need to include
8856: <code class=
8857: "filename">../../mk/x11.buildlink3.mk</code> in
8858: them to request the presence of X11 and to get the
8859: right compilation flags.</p>
1.1 grant 8860:
8861: <p>Even though, there are some packages that cannot
1.14 xtraeme 8862: be installed under <code class=
8863: "varname">LOCALBASE</code>: those that come with
1.1 grant 8864: app-defaults files. These packages are special and
1.14 xtraeme 8865: they must be placed under <code class=
8866: "varname">X11BASE</code>. To accomplish this, set
8867: either <code class="varname">USE_X11BASE</code> or
8868: <code class="varname">USE_IMAKE</code> in your
1.1 grant 8869: package.</p>
8870:
1.34 wiz 8871: <p>Some notes: If you need to find includes or
1.14 xtraeme 8872: libraries installed by a pkg that has <code class=
8873: "varname">USE_IMAKE</code> or <code class=
8874: "varname">USE_X11BASE</code> in its pkg
8875: <code class="filename">Makefile</code>, you need to
1.34 wiz 8876: look in <span class="emphasis"><em>both</em></span>
1.14 xtraeme 8877: <code class="filename">${X11BASE}</code> and
8878: <code class="filename">${LOCALBASE}</code>. To
8879: force installation of all X11 packages in
8880: <code class="varname">LOCALBASE</code>, the
8881: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8882: href=
1.1 grant 8883: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.34 wiz 8884: class="pkgname">pkgtools/xpkgwedge</a> package is
8885: enabled by default.</p>
1.1 grant 8886: </li>
8887:
8888: <li>
1.14 xtraeme 8889: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 8890: used to refer to the installed location of an X11
1.14 xtraeme 8891: package. <code class="varname">X11PREFIX</code>
8892: will be set to <code class="varname">X11BASE</code>
8893: if xpkgwedge is not installed, and to <code class=
8894: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 8895: installed.</p>
8896: </li>
8897:
8898: <li>
8899: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 8900: have some packages installed in <code class=
8901: "varname">X11BASE</code> and some in <code class=
8902: "varname">LOCALBASE</code>. To determine the prefix
8903: of an installed package, the <code class=
8904: "varname">EVAL_PREFIX</code> definition can be
8905: used. It takes pairs in the format
8906: “<span class=
1.1 grant 8907: "quote">DIRNAME=<package></span>”, and
1.24 wiz 8908: the <a href=
8909: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8910: <span class="citerefentry"><span class=
8911: "refentrytitle">make</span>(1)</span></a> variable
8912: <code class="varname">DIRNAME</code> will be set to
8913: the prefix of the installed package
8914: <package>, or “<span class=
1.1 grant 8915: "quote">${X11PREFIX}</span>” if the package
8916: is not installed.</p>
8917:
8918: <p>This is best illustrated by example.</p>
8919:
1.14 xtraeme 8920: <p>The following lines are taken from <code class=
8921: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 8922: <pre class="programlisting">
1.14 xtraeme 8923: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 8924: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
8925: --with-gtk-prefix="${GTKDIR}" \
8926: --enable-multibyte
8927: </pre>
8928:
8929: <p>Specific defaults can be defined for the
1.14 xtraeme 8930: packages evaluated using <code class=
8931: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 8932: of the form:</p>
8933: <pre class="programlisting">
8934: GTKDIR_DEFAULT= ${LOCALBASE}
8935: </pre>
8936:
1.14 xtraeme 8937: <p>where <code class="varname">GTKDIR</code>
1.1 grant 8938: corresponds to the first definition in the
1.14 xtraeme 8939: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 8940: </li>
8941:
8942: <li>
1.14 xtraeme 8943: <p>Within <code class="filename">${PREFIX}</code>,
1.24 wiz 8944: packages should install files according to <a href=
8945: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
8946: <span class="citerefentry"><span class=
8947: "refentrytitle">hier</span>(7)</span></a>, with the
8948: exception that manual pages go into <code class=
8949: "filename">${PREFIX}/man</code>, not <code class=
1.14 xtraeme 8950: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 8951: </li>
8952: </ul>
8953: </div>
8954: </div>
8955:
8956: <div class="sect1" lang="en" xml:lang="en">
8957: <div class="titlepage">
8958: <div>
8959: <div>
8960: <h2 class="title" style="clear: both"><a name=
1.30 wiz 8961: "main-targets" id=
1.35 jmmv 8962: "main-targets"></a>13.2. Main targets</h2>
1.1 grant 8963: </div>
8964: </div>
8965: </div>
8966:
8967: <p>The main targets used during the build process defined
1.14 xtraeme 8968: in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 8969:
8970: <div class="variablelist">
8971: <dl>
8972: <dt><span class="term">fetch</span></dt>
8973:
8974: <dd>
8975: <p>This will check if the file(s) given in the
1.14 xtraeme 8976: variables <code class="varname">DISTFILES</code>
8977: and <code class="varname">PATCHFILES</code> (as
8978: defined in the package's Makefile) are present on
8979: the local system in <code class=
8980: "filename">/usr/pkgsrc/distfiles</code>. If they
8981: are not present, an attempt will be made to fetch
8982: them using commands of the form:</p>
1.1 grant 8983: <pre class="programlisting">
8984: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
8985: </pre>
8986:
8987: <p>where ${site} varies through several
1.14 xtraeme 8988: possibilities in turn: first, <code class=
8989: "varname">MASTER_SITE_OVERRIDE</code> is tried,
8990: then the sites specified in either <code class=
8991: "varname">SITES_file</code> if defined, else
8992: <code class="varname">MASTER_SITES</code> or
8993: <code class="varname">PATCH_SITES</code>, as
8994: applies, then finally the value of <code class=
8995: "varname">MASTER_SITE_BACKUP</code>. The order of
8996: all except the first can be optionally sorted by
8997: the user, via setting either <code class=
8998: "varname">MASTER_SORT_AWK</code> or <code class=
8999: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 9000: </dd>
9001:
9002: <dt><span class="term">checksum</span></dt>
9003:
9004: <dd>
9005: <p>After the distfile(s) are fetched, their
9006: checksum is generated and compared with the
9007: checksums stored in the distinfo file. If the
9008: checksums don't match, the build is aborted. This
9009: is to ensure the same distfile is used for
9010: building, and that the distfile wasn't changed,
9011: e.g. by some malign force, deliberately changed
9012: distfiles on the master distribution site or
9013: network lossage.</p>
9014: </dd>
9015:
9016: <dt><span class="term">extract</span></dt>
9017:
9018: <dd>
9019: <p>When the distfiles are present on the local
9020: system, they need to be extracted, as they are
9021: usually in the form of some compressed archive
1.14 xtraeme 9022: format, most commonly <code class=
9023: "filename">.tar.gz</code>.</p>
1.1 grant 9024:
9025: <p>If only some of the distfiles need to be
9026: uncompressed, the files to be uncompressed should
1.14 xtraeme 9027: be put into <code class=
9028: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 9029:
1.14 xtraeme 9030: <p>If the distfiles are not in <code class=
9031: "filename">.tar.gz</code> format, they can be
9032: extracted by setting either <code class=
9033: "varname">EXTRACT_SUFX</code>, or <code class=
9034: "varname">EXTRACT_CMD</code>, <code class=
9035: "varname">EXTRACT_BEFORE_ARGS</code> and
9036: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
9037: the former case, pkgsrc knows how to extract a
9038: number of suffixes (<code class=
9039: "filename">.tar.gz</code>, <code class=
9040: "filename">.tgz</code>, <code class=
9041: "filename">.tar.gz2</code>, <code class=
9042: "filename">.tbz</code>, <code class=
9043: "filename">.tar.Z</code>, <code class=
9044: "filename">.tar</code>, <code class=
9045: "filename">.shar.gz</code>, <code class=
9046: "filename">.shar.bz2</code>, <code class=
9047: "filename">.shar.Z</code>, <code class=
9048: "filename">.shar</code>, <code class=
9049: "filename">.Z</code>, <code class=
9050: "filename">.bz2</code> and <code class=
9051: "filename">.gz</code>; see the definition of the
9052: various <code class="varname">DECOMPRESS_CMD</code>
9053: variables <code class="filename">bsd.pkg.mk</code>
9054: for a complete list). Here's an example on how to
9055: use the other variables for a program that comes
9056: with a compressed shell archive whose name ends in
9057: <code class="filename">.msg.gz</code>:</p>
1.1 grant 9058: <pre class="programlisting">
9059: EXTRACT_SUFX= .msg.gz
9060: EXTRACT_CMD= zcat
9061: EXTRACT_BEFORE_ARGS=
9062: EXTRACT_AFTER_ARGS= |sh
9063: </pre>
9064: </dd>
9065:
9066: <dt><span class="term">patch</span></dt>
9067:
9068: <dd>
9069: <p>After extraction, all the patches named by the
1.14 xtraeme 9070: <code class="varname">PATCHFILES</code>, those
9071: present in the patches subdirectory of the package
9072: as well as in $LOCALPATCHES/$PKGPATH (e.g.
9073: <code class=
9074: "filename">/usr/local/patches/graphics/png</code>)
9075: are applied. Patchfiles ending in <code class=
9076: "filename">.Z</code> or <code class=
9077: "filename">.gz</code> are uncompressed before they
9078: are applied, files ending in <code class=
9079: "filename">.orig</code> or <code class=
9080: "filename">.rej</code> are ignored. Any special
1.24 wiz 9081: options to <a href=
9082: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
9083: <span class="citerefentry"><span class=
9084: "refentrytitle">patch</span>(1)</span></a> can be
9085: handed in <code class=
1.14 xtraeme 9086: "varname">PATCH_DIST_ARGS</code>. See <a href=
9087: "#components.patches" title=
1.27 rillig 9088: "7.3. patches/*">Section 7.3,
1.1 grant 9089: “patches/*”</a> for more details.</p>
9090:
1.24 wiz 9091: <p>By default <a href=
9092: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
9093: <span class="citerefentry"><span class=
9094: "refentrytitle">patch</span>(1)</span></a> is given
9095: special args to make it fail if the patches apply
9096: with some lines of fuzz. Please fix (regen) the
9097: patches so that they apply cleanly. The rationale
9098: behind this is that patches that don't apply
9099: cleanly may end up being applied in the wrong
9100: place, and cause severe harm there.</p>
1.1 grant 9101: </dd>
9102:
9103: <dt><span class="term">configure</span></dt>
9104:
9105: <dd>
9106: <p>Most pieces of software need information on the
9107: header files, system calls, and library routines
9108: which are available in NetBSD. This is the process
9109: known as configuration, and is usually automated.
9110: In most cases, a script is supplied with the
9111: source, and its invocation results in generation of
9112: header files, Makefiles, etc.</p>
9113:
9114: <p>If the program's distfile contains its own
9115: configure script, this can be invoked by setting
1.14 xtraeme 9116: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 9117: configure script is a GNU autoconf script,
1.14 xtraeme 9118: <code class="varname">GNU_CONFIGURE</code> should
9119: be specified instead. In either case, any arguments
9120: to the configure script can be specified in the
9121: <code class="varname">CONFIGURE_ARGS</code>
9122: variable, and the configure script's name can be
9123: set in <code class=
9124: "varname">CONFIGURE_SCRIPT</code> if it differs
9125: from the default “<span class=
1.1 grant 9126: "quote">configure</span>”. Here's an example
9127: from the <a xmlns=
9128: "http://www.w3.org/TR/xhtml1/transitional" href=
9129: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20 ben 9130: class="pkgname">sysutils/top</a> package:</p>
1.1 grant 9131: <pre class="programlisting">
9132: HAS_CONFIGURE= yes
9133: CONFIGURE_SCRIPT= Configure
9134: CONFIGURE_ARGS+= netbsd13
9135: </pre>
9136:
9137: <p>If the program uses an Imakefile for
9138: configuration, the appropriate steps can be invoked
1.14 xtraeme 9139: by setting <code class="varname">USE_IMAKE</code>
9140: to “<span class="quote">YES</span>”.
9141: (If you only want the package installed in
9142: <code class="varname">$X11PREFIX</code> but xmkmf
9143: not being run, set <code class=
9144: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 9145: </dd>
9146:
9147: <dt><span class="term">build</span></dt>
9148:
9149: <dd>
9150: <p>Once configuration has taken place, the software
1.14 xtraeme 9151: will be built by invoking <code class=
9152: "varname">$MAKE_PROGRAM</code> on <code class=
9153: "varname">$MAKEFILE</code> with <code class=
9154: "varname">$BUILD_TARGET</code> as the target to
9155: build. The default <code class=
9156: "varname">MAKE_PROGRAM</code> is
9157: “<span class="quote">gmake</span>” if
1.29 rillig 9158: <code class="varname">USE_TOOLS</code> contains
9159: “<span class="quote">gmake</span>”,
1.1 grant 9160: “<span class="quote">make</span>”
1.14 xtraeme 9161: otherwise. <code class="varname">MAKEFILE</code> is
9162: set to “<span class=
1.1 grant 9163: "quote">Makefile</span>” by default, and
1.14 xtraeme 9164: <code class="varname">BUILD_TARGET</code> defaults
9165: to “<span class="quote">all</span>”.
9166: Any of these variables can be set in the package's
1.1 grant 9167: Makefile to change the default build process.</p>
9168: </dd>
9169:
9170: <dt><span class="term">install</span></dt>
9171:
9172: <dd>
9173: <p>Once the build stage has completed, the final
9174: step is to install the software in public
9175: directories, so users can access the programs and
1.14 xtraeme 9176: files. As in the build-target, <code class=
9177: "varname">$MAKE_PROGRAM</code> is invoked on
9178: <code class="varname">$MAKEFILE</code> here, but
9179: with the <code class=
9180: "varname">$INSTALL_TARGET</code> instead, the
9181: latter defaulting to “<span class=
9182: "quote">install</span>” (plus
9183: “<span class=
9184: "quote">install.man</span>”, if <code class=
9185: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 9186: </dd>
9187: </dl>
9188: </div>
9189:
9190: <p>If no target is specified, the default is
9191: “<span class="quote">build</span>”. If a
9192: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 9193: e.g. <span><strong class="command">make
9194: build</strong></span> will also perform the equivalent
9195: of:</p>
1.1 grant 9196: <pre class="programlisting">
9197: make fetch
9198: make checksum
9199: make extract
9200: make patch
9201: make configure
9202: make build
9203: </pre>
9204: </div>
9205:
9206: <div class="sect1" lang="en" xml:lang="en">
9207: <div class="titlepage">
9208: <div>
9209: <div>
9210: <h2 class="title" style="clear: both"><a name=
9211: "build.helpful-targets" id=
1.35 jmmv 9212: "build.helpful-targets"></a>13.3. Other
1.1 grant 9213: helpful targets</h2>
9214: </div>
9215: </div>
9216: </div>
9217:
9218: <div class="variablelist">
9219: <dl>
9220: <dt><span class="term">pre/post-*</span></dt>
9221:
9222: <dd>
9223: <p>For any of the main targets described in the
9224: previous section, two auxiliary targets exist with
9225: “<span class="quote">pre-</span>” and
9226: “<span class="quote">post-</span>” used
9227: as a prefix for the main target's name. These
9228: targets are invoked before and after the main
9229: target is called, allowing extra configuration or
9230: installation steps be performed from a package's
9231: Makefile, for example, which a program's configure
9232: script or install target omitted.</p>
9233: </dd>
9234:
9235: <dt><span class="term">do-*</span></dt>
9236:
9237: <dd>
9238: <p>Should one of the main targets do the wrong
9239: thing, and should there be no variable to fix this,
9240: you can redefine it with the do-* target. (Note
9241: that redefining the target itself instead of the
9242: do-* target is a bad idea, as the pre-* and post-*
9243: targets won't be called anymore, etc.) You will not
9244: usually need to do this.</p>
9245: </dd>
9246:
9247: <dt><span class="term">reinstall</span></dt>
9248:
9249: <dd>
1.14 xtraeme 9250: <p>If you did a <span><strong class="command">make
9251: install</strong></span> and you noticed some file
9252: was not installed properly, you can repeat the
1.1 grant 9253: installation with this target, which will ignore
9254: the “<span class="quote">already
9255: installed</span>” flag.</p>
9256: </dd>
9257:
9258: <dt><span class="term">deinstall</span></dt>
9259:
9260: <dd>
1.24 wiz 9261: <p>This target does a <a href=
9262: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
9263: <span class="citerefentry"><span class=
9264: "refentrytitle">pkg_delete</span>(1)</span></a> in
9265: the current directory, effectively de-installing
9266: the package. The following variables can be used to
9267: tune the behaviour:</p>
1.1 grant 9268:
9269: <div class="variablelist">
9270: <dl>
1.14 xtraeme 9271: <dt><span class="term"><code class=
9272: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 9273:
9274: <dd>
9275: <p>Add a "-v" to the <a href=
9276: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
9277: <span class="citerefentry"><span class=
9278: "refentrytitle">pkg_delete</span>(1)</span></a>
9279: command.</p>
9280: </dd>
9281:
1.14 xtraeme 9282: <dt><span class="term"><code class=
9283: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 9284:
9285: <dd>
9286: <p>Remove all packages that require (depend
9287: on) the given package. This can be used to
9288: remove any packages that may have been pulled
9289: in by a given package, e.g. if
1.14 xtraeme 9290: <span><strong class="command">make deinstall
9291: DEINSTALLDEPENDS=1</strong></span> is done in
9292: <code class="filename">pkgsrc/x11/kde</code>,
1.1 grant 9293: this is likely to remove whole KDE. Works by
9294: adding “<span class=
9295: "quote">-R</span>” to the <a href=
9296: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
9297: <span class="citerefentry"><span class=
9298: "refentrytitle">pkg_delete</span>(1)</span></a>
9299: command line.</p>
9300: </dd>
9301: </dl>
9302: </div>
9303: </dd>
9304:
9305: <dt><span class="term">update</span></dt>
9306:
9307: <dd>
9308: <p>This target causes the current package to be
9309: updated to the latest version. The package and all
9310: depending packages first get de-installed, then
9311: current versions of the corresponding packages get
9312: compiled and installed. This is similar to manually
9313: noting which packages are currently installed, then
1.14 xtraeme 9314: performing a series of <span><strong class=
9315: "command">make deinstall</strong></span> and
9316: <span><strong class="command">make
9317: install</strong></span> (or whatever <code class=
9318: "varname">UPDATE_TARGET</code> is set to) for these
9319: packages.</p>
1.1 grant 9320:
9321: <p>You can use the “<span class=
9322: "quote">update</span>” target to resume
1.14 xtraeme 9323: package updating in case a previous
9324: <span><strong class="command">make
9325: update</strong></span> was interrupted for some
9326: reason. However, in this case, make sure you don't
9327: call <span><strong class="command">make
9328: clean</strong></span> or otherwise remove the list
9329: of dependent packages in <code class=
9330: "varname">WRKDIR</code>. Otherwise you lose the
1.1 grant 9331: ability to automatically update the current package
9332: along with the dependent packages you have
9333: installed.</p>
9334:
1.14 xtraeme 9335: <p>Resuming an interrupted <span><strong class=
9336: "command">make update</strong></span> will only
9337: work as long as the package tree remains unchanged.
9338: If the source code for one of the packages to be
9339: updated has been changed, resuming
9340: <span><strong class="command">make
9341: update</strong></span> will most certainly
9342: fail!</p>
1.1 grant 9343:
9344: <p>The following variables can be used either on
1.14 xtraeme 9345: the command line or in <code class=
9346: "filename">/etc/mk.conf</code> to alter the
9347: behaviour of <span><strong class="command">make
9348: update</strong></span>:</p>
1.1 grant 9349:
9350: <div class="variablelist">
9351: <dl>
1.14 xtraeme 9352: <dt><span class="term"><code class=
9353: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 9354:
9355: <dd>
9356: <p>Install target to recursively use for the
9357: updated package and the dependent packages.
1.14 xtraeme 9358: Defaults to <code class=
9359: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 9360: “<span class=
9361: "quote">install</span>” otherwise for
1.14 xtraeme 9362: <span><strong class="command">make
9363: update</strong></span>. e.g.
9364: <span><strong class="command">make update
9365: UPDATE_TARGET=package</strong></span></p>
1.1 grant 9366: </dd>
9367:
1.14 xtraeme 9368: <dt><span class="term"><code class=
9369: "varname">NOCLEAN</code></span></dt>
1.1 grant 9370:
9371: <dd>
9372: <p>Don't clean up after updating. Useful if
9373: you want to leave the work sources of the
9374: updated packages around for inspection or
9375: other purposes. Be sure you eventually clean
9376: up the source tree (see the
9377: “<span class=
9378: "quote">clean-update</span>” target
9379: below) or you may run into troubles with old
9380: source code still lying around on your next
1.14 xtraeme 9381: <span><strong class=
9382: "command">make</strong></span> or
9383: <span><strong class="command">make
9384: update</strong></span>.</p>
1.1 grant 9385: </dd>
9386:
1.14 xtraeme 9387: <dt><span class="term"><code class=
9388: "varname">REINSTALL</code></span></dt>
1.1 grant 9389:
9390: <dd>
9391: <p>Deinstall each package before installing
1.14 xtraeme 9392: (making <code class=
9393: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 9394: necessary if the “<span class=
9395: "quote">clean-update</span>” target
9396: (see below) was called after interrupting a
1.14 xtraeme 9397: running <span><strong class="command">make
9398: update</strong></span>.</p>
1.1 grant 9399: </dd>
9400:
1.14 xtraeme 9401: <dt><span class="term"><code class=
9402: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 9403:
9404: <dd>
9405: <p>Allows you to disable recursion and
9406: hardcode the target for packages. The default
9407: is “<span class=
9408: "quote">update</span>” for the update
9409: target, facilitating a recursive update of
1.14 xtraeme 9410: prerequisite packages. Only set <code class=
9411: "varname">DEPENDS_TARGET</code> if you want
9412: to disable recursive updates. Use
9413: <code class="varname">UPDATE_TARGET</code>
9414: instead to just set a specific target for
9415: each package to be installed during
9416: <span><strong class="command">make
9417: update</strong></span> (see above).</p>
1.1 grant 9418: </dd>
9419: </dl>
9420: </div>
9421: </dd>
9422:
9423: <dt><span class="term">clean-update</span></dt>
9424:
9425: <dd>
9426: <p>Clean the source tree for all packages that
1.14 xtraeme 9427: would get updated if <span><strong class=
9428: "command">make update</strong></span> was called
9429: from the current directory. This target should not
9430: be used if the current package (or any of its
9431: depending packages) have already been de-installed
9432: (e.g., after calling <span><strong class=
9433: "command">make update</strong></span>) or you may
9434: lose some packages you intended to update. As a
9435: rule of thumb: only use this target <span class=
9436: "emphasis"><em>before</em></span> the first time
9437: you run <span><strong class="command">make
9438: update</strong></span> and only if you have a dirty
9439: package tree (e.g., if you used <code class=
9440: "varname">NOCLEAN</code>).</p>
1.1 grant 9441:
9442: <p>If you unsure about whether your tree is clean
1.14 xtraeme 9443: you can either perform a <span><strong class=
9444: "command">make clean</strong></span> at the top of
9445: the tree, or use the following sequence of commands
1.1 grant 9446: from the directory of the package you want to
9447: update (<span class=
9448: "emphasis"><em>before</em></span> running
1.14 xtraeme 9449: <span><strong class="command">make
9450: update</strong></span> for the first time,
9451: otherwise you lose all the packages you wanted to
9452: update!):</p>
1.1 grant 9453: <pre class="screen">
1.14 xtraeme 9454: <code class="prompt">#</code> <strong class=
9455: "userinput"><code>make clean-update</code></strong>
9456: <code class="prompt">#</code> <strong class=
9457: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
9458: <code class="prompt">#</code> <strong class=
9459: "userinput"><code>make update</code></strong>
1.1 grant 9460: </pre>
9461:
9462: <p>The following variables can be used either on
1.14 xtraeme 9463: the command line or in <code class=
9464: "filename">/etc/mk.conf</code> to alter the
9465: behaviour of <span><strong class="command">make
9466: clean-update</strong></span>:</p>
1.1 grant 9467:
9468: <div class="variablelist">
9469: <dl>
1.14 xtraeme 9470: <dt><span class="term"><code class=
9471: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 9472:
9473: <dd>
1.14 xtraeme 9474: <p>After <span><strong class="command">make
9475: clean</strong></span>, do not reconstruct the
9476: list of directories to update for this
9477: package. Only use this if
9478: <span><strong class="command">make
9479: update</strong></span> successfully installed
9480: all packages you wanted to update. Normally,
9481: this is done automatically on
9482: <span><strong class="command">make
9483: update</strong></span>, but may have been
9484: suppressed by the <code class=
9485: "varname">NOCLEAN</code> variable (see
1.1 grant 9486: above).</p>
9487: </dd>
9488: </dl>
9489: </div>
9490: </dd>
9491:
9492: <dt><span class="term">info</span></dt>
9493:
9494: <dd>
9495: <p>This target invokes <a href=
9496: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
9497: <span class="citerefentry"><span class=
9498: "refentrytitle">pkg_info</span>(1)</span></a> for
9499: the current package. You can use this to check
9500: which version of a package is installed.</p>
9501: </dd>
9502:
9503: <dt><span class="term">readme</span></dt>
9504:
9505: <dd>
1.14 xtraeme 9506: <p>This target generates a <code class=
9507: "filename">README.html</code> file, which can be
1.1 grant 9508: viewed using a browser such as <a xmlns=
9509: "http://www.w3.org/TR/xhtml1/transitional" href=
9510: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 9511: class="pkgname">www/mozilla</a> or <a xmlns=
9512: "http://www.w3.org/TR/xhtml1/transitional" href=
9513: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
9514: class="pkgname">www/links</a>. The generated files
9515: contain references to any packages which are in the
9516: <code class="varname">PACKAGES</code> directory on
9517: the local host. The generated files can be made to
9518: refer to URLs based on <code class=
9519: "varname">FTP_PKG_URL_HOST</code> and <code class=
9520: "varname">FTP_PKG_URL_DIR</code>. For example, if I
9521: wanted to generate <code class=
9522: "filename">README.html</code> files which pointed
9523: to binary packages on the local machine, in the
9524: directory <code class=
9525: "filename">/usr/packages</code>, set <code class=
9526: "varname">FTP_PKG_URL_HOST=file://localhost</code>
9527: and <code class=
9528: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
9529: <code class="varname">${PACKAGES}</code> directory
9530: and its subdirectories will be searched for all the
9531: binary packages.</p>
1.1 grant 9532: </dd>
9533:
9534: <dt><span class="term">readme-all</span></dt>
9535:
9536: <dd>
1.14 xtraeme 9537: <p>Use this target to create a file <code class=
9538: "filename">README-all.html</code> which contains a
1.1 grant 9539: list of all packages currently available in the
9540: NetBSD Packages Collection, together with the
9541: category they belong to and a short description.
1.14 xtraeme 9542: This file is compiled from the <code class=
9543: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 9544: sure to run this <span class=
1.14 xtraeme 9545: "emphasis"><em>after</em></span> a
9546: <span><strong class="command">make
9547: readme</strong></span>.</p>
1.1 grant 9548: </dd>
9549:
9550: <dt><span class="term">cdrom-readme</span></dt>
9551:
9552: <dd>
9553: <p>This is very much the same as the
9554: “<span class="quote">readme</span>”
9555: target (see above), but is to be used when
9556: generating a pkgsrc tree to be written to a CD-ROM.
1.14 xtraeme 9557: This target also produces <code class=
9558: "filename">README.html</code> files, and can be
9559: made to refer to URLs based on <code class=
9560: "varname">CDROM_PKG_URL_HOST</code> and
9561: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 9562: </dd>
9563:
9564: <dt><span class="term">show-distfiles</span></dt>
9565:
9566: <dd>
9567: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 9568: are needed to build the package. (<code class=
9569: "varname">DISTFILES</code> and <code class=
9570: "varname">PATCHFILES</code>, but not <code class=
9571: "filename">patches/*</code>)</p>
1.1 grant 9572: </dd>
9573:
9574: <dt><span class="term">show-downlevel</span></dt>
9575:
9576: <dd>
9577: <p>This target shows nothing if the package is not
9578: installed. If a version of this package is
9579: installed, but is not the version provided in this
9580: version of pkgsrc, then a warning message is
9581: displayed. This target can be used to show which of
9582: your installed packages are downlevel, and so the
9583: old versions can be deleted, and the current ones
9584: added.</p>
9585: </dd>
9586:
9587: <dt><span class="term">show-pkgsrc-dir</span></dt>
9588:
9589: <dd>
9590: <p>This target shows the directory in the pkgsrc
9591: hierarchy from which the package can be built and
9592: installed. This may not be the same directory as
9593: the one from which the package was installed. This
9594: target is intended to be used by people who may
9595: wish to upgrade many packages on a single host, and
9596: can be invoked from the top-level pkgsrc Makefile
9597: by using the “<span class=
9598: "quote">show-host-specific-pkgs</span>”
9599: target.</p>
9600: </dd>
9601:
9602: <dt><span class=
9603: "term">show-installed-depends</span></dt>
9604:
9605: <dd>
9606: <p>This target shows which installed packages match
1.14 xtraeme 9607: the current package's <code class=
9608: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 9609: dependencies are causing build problems.</p>
9610: </dd>
9611:
9612: <dt><span class="term">check-shlibs</span></dt>
9613:
9614: <dd>
9615: <p>After a package is installed, check all its
9616: binaries and (on ELF platforms) shared libraries to
9617: see if they find the shared libs they need. Run by
1.14 xtraeme 9618: default if <code class=
9619: "varname">PKG_DEVELOPER</code> is set in
9620: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 9621: </dd>
9622:
9623: <dt><span class="term">print-PLIST</span></dt>
9624:
9625: <dd>
9626: <p>After a “<span class="quote">make
9627: install</span>” from a new or upgraded pkg,
9628: this prints out an attempt to generate a new
1.14 xtraeme 9629: <code class="filename">PLIST</code> from a
9630: <span><strong class="command">find -newer
9631: work/.extract_done</strong></span>. An attempt is
9632: made to care for shared libs etc., but it is
1.1 grant 9633: <span class="emphasis"><em>strongly</em></span>
9634: recommended to review the result before putting it
1.14 xtraeme 9635: into <code class="filename">PLIST</code>. On
9636: upgrades, it's useful to diff the output of this
9637: command against an already existing <code class=
9638: "filename">PLIST</code> file.</p>
1.1 grant 9639:
1.24 wiz 9640: <p>If the package installs files via <a href=
9641: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
9642: <span class="citerefentry"><span class=
9643: "refentrytitle">tar</span>(1)</span></a> or other
9644: methods that don't update file access times, be
9645: sure to add these files manually to your
1.14 xtraeme 9646: <code class="filename">PLIST</code>, as the
1.1 grant 9647: “<span class="quote">find
9648: -newer</span>” command used by this target
9649: won't catch them!</p>
9650:
9651: <p>See <a href="#print-PLIST" title=
1.25 rillig 9652: "9.3. Tweaking output of make print-PLIST">Section 9.3,
1.14 xtraeme 9653: “Tweaking output of <span><strong class=
9654: "command">make
9655: print-PLIST</strong></span>”</a> for more
9656: information on this target.</p>
1.1 grant 9657: </dd>
9658:
9659: <dt><span class="term">bulk-package</span></dt>
9660:
9661: <dd>
9662: <p>Used to do bulk builds. If an appropriate binary
9663: package already exists, no action is taken. If not,
9664: this target will compile, install and package it
1.14 xtraeme 9665: (and it's depends, if <code class=
9666: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 9667: <a href="#binary.configuration" title=
9668: "5.3.1. Configuration">Section 5.3.1,
9669: “Configuration”</a>. After creating the
9670: binary package, the sources, the just-installed
9671: package and it's required packages are removed,
9672: preserving free disk space.</p>
9673:
9674: <p><span class="emphasis"><em>Beware that this
9675: target may deinstall all packages installed on a
9676: system!</em></span></p>
9677: </dd>
9678:
9679: <dt><span class="term">bulk-install</span></dt>
9680:
9681: <dd>
9682: <p>Used during bulk-installs to install required
9683: packages. If an upto-date binary package is
9684: available, it will be installed via <a href=
9685: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
9686: <span class="citerefentry"><span class=
9687: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 9688: not, <span><strong class="command">make
9689: bulk-package</strong></span> will be executed, but
9690: the installed binary not be removed.</p>
1.1 grant 9691:
9692: <p>A binary package is considered
9693: “<span class="quote">upto-date</span>”
9694: to be installed via <a href=
9695: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
9696: <span class="citerefentry"><span class=
9697: "refentrytitle">pkg_add</span>(1)</span></a>
9698: if:</p>
9699:
9700: <div class="itemizedlist">
9701: <ul type="disc">
9702: <li>
1.14 xtraeme 9703: <p>None of the package's files (<code class=
9704: "filename">Makefile</code>, ...) were
9705: modified since it was built.</p>
1.1 grant 9706: </li>
9707:
9708: <li>
9709: <p>None of the package's required (binary)
9710: packages were modified since it was
9711: built.</p>
9712: </li>
9713: </ul>
9714: </div>
9715:
9716: <p><span class="emphasis"><em>Beware that this
9717: target may deinstall all packages installed on a
9718: system!</em></span></p>
9719: </dd>
9720: </dl>
9721: </div>
9722: </div>
9723: </div>
9724:
9725: <div class="chapter" lang="en" xml:lang="en">
9726: <div class="titlepage">
9727: <div>
9728: <div>
9729: <h2 class="title"><a name="fixes" id=
1.35 jmmv 9730: "fixes"></a>Chapter 14. Notes on fixes for
1.1 grant 9731: packages</h2>
9732: </div>
9733: </div>
9734: </div>
9735:
9736: <div class="toc">
9737: <p><b>Table of Contents</b></p>
9738:
9739: <dl>
1.30 wiz 9740: <dt><span class="sect1"><a href=
1.35 jmmv 9741: "#general-operation">14.1. General
1.30 wiz 9742: operation</a></span></dt>
1.1 grant 9743:
9744: <dd>
9745: <dl>
9746: <dt><span class="sect2"><a href=
1.35 jmmv 9747: "#pulling-vars-from-etc-mk.conf">14.1.1. How to
1.30 wiz 9748: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 9749:
9750: <dt><span class="sect2"><a href=
1.35 jmmv 9751: "#where-to-install-documentation">14.1.2. Where to
1.31 wiz 9752: install documentation</a></span></dt>
9753:
9754: <dt><span class="sect2"><a href=
1.35 jmmv 9755: "#restricted-packages">14.1.3. Restricted
1.1 grant 9756: packages</a></span></dt>
9757:
9758: <dt><span class="sect2"><a href=
1.35 jmmv 9759: "#dependencies">14.1.4. Handling
1.1 grant 9760: dependencies</a></span></dt>
9761:
9762: <dt><span class="sect2"><a href=
1.35 jmmv 9763: "#conflicts">14.1.5. Handling conflicts with other
1.1 grant 9764: packages</a></span></dt>
9765:
9766: <dt><span class="sect2"><a href=
1.35 jmmv 9767: "#not-building-packages">14.1.6. Packages that
1.30 wiz 9768: cannot or should not be built</a></span></dt>
1.1 grant 9769:
9770: <dt><span class="sect2"><a href=
1.35 jmmv 9771: "#undeletable-packages">14.1.7. Packages which
1.30 wiz 9772: should not be deleted, once
9773: installed</a></span></dt>
1.1 grant 9774:
9775: <dt><span class="sect2"><a href=
1.35 jmmv 9776: "#security-handling">14.1.8. Handling packages with
1.1 grant 9777: security problems</a></span></dt>
9778:
9779: <dt><span class="sect2"><a href=
1.35 jmmv 9780: "#compiler-bugs">14.1.9. How to handle compiler
1.1 grant 9781: bugs</a></span></dt>
9782:
9783: <dt><span class="sect2"><a href=
1.35 jmmv 9784: "#bumping-pkgrevision">14.1.10. How to handle
1.30 wiz 9785: incrementing versions when fixing an existing
1.1 grant 9786: package</a></span></dt>
9787:
9788: <dt><span class="sect2"><a href=
1.35 jmmv 9789: "#portability-of-packages">14.1.11. Portability of
1.1 grant 9790: packages</a></span></dt>
9791: </dl>
9792: </dd>
9793:
1.30 wiz 9794: <dt><span class="sect1"><a href=
1.35 jmmv 9795: "#downloading-issues">14.2. Possible downloading
1.30 wiz 9796: issues</a></span></dt>
1.1 grant 9797:
9798: <dd>
9799: <dl>
9800: <dt><span class="sect2"><a href=
1.35 jmmv 9801: "#no-plain-download">14.2.1. Packages whose
1.30 wiz 9802: distfiles aren't available for plain
1.1 grant 9803: downloading</a></span></dt>
9804:
9805: <dt><span class="sect2"><a href=
1.35 jmmv 9806: "#modified-distfiles-same-name">14.2.2. How to
1.30 wiz 9807: handle modified distfiles with the 'old'
9808: name</a></span></dt>
1.1 grant 9809: </dl>
9810: </dd>
9811:
1.30 wiz 9812: <dt><span class="sect1"><a href=
1.35 jmmv 9813: "#configuration-gotchas">14.3. Configuration
1.30 wiz 9814: gotchas</a></span></dt>
1.1 grant 9815:
9816: <dd>
9817: <dl>
9818: <dt><span class="sect2"><a href=
1.35 jmmv 9819: "#fixes.libtool">14.3.1. Shared libraries -
1.1 grant 9820: libtool</a></span></dt>
9821:
9822: <dt><span class="sect2"><a href=
1.35 jmmv 9823: "#using-libtool">14.3.2. Using libtool on GNU
1.30 wiz 9824: packages that already support
9825: libtool</a></span></dt>
1.1 grant 9826:
9827: <dt><span class="sect2"><a href=
1.35 jmmv 9828: "#autoconf-automake">14.3.3. GNU
1.1 grant 9829: Autoconf/Automake</a></span></dt>
9830: </dl>
9831: </dd>
9832:
1.30 wiz 9833: <dt><span class="sect1"><a href=
1.35 jmmv 9834: "#building-considerations">14.4. Building
1.30 wiz 9835: considerations</a></span></dt>
1.1 grant 9836:
9837: <dd>
9838: <dl>
9839: <dt><span class="sect2"><a href=
1.35 jmmv 9840: "#cpp-defines">14.4.1. CPP defines</a></span></dt>
1.1 grant 9841: </dl>
9842: </dd>
9843:
1.30 wiz 9844: <dt><span class="sect1"><a href=
1.35 jmmv 9845: "#package-specific-actions">14.5. Package specific
1.30 wiz 9846: actions</a></span></dt>
1.1 grant 9847:
9848: <dd>
9849: <dl>
9850: <dt><span class="sect2"><a href=
1.35 jmmv 9851: "#user-interaction">14.5.1. User
1.2 hubertf 9852: interaction</a></span></dt>
1.1 grant 9853:
9854: <dt><span class="sect2"><a href=
1.35 jmmv 9855: "#handling-licenses">14.5.2. Handling
1.1 grant 9856: licenses</a></span></dt>
9857:
9858: <dt><span class="sect2"><a href=
1.35 jmmv 9859: "#installing-score-files">14.5.3. Installing score
1.1 grant 9860: files</a></span></dt>
9861:
9862: <dt><span class="sect2"><a href=
1.35 jmmv 9863: "#perl-scripts">14.5.4. Packages containing perl
1.1 grant 9864: scripts</a></span></dt>
9865:
9866: <dt><span class="sect2"><a href=
1.35 jmmv 9867: "#hardcoded-paths">14.5.5. Packages with hardcoded
1.30 wiz 9868: paths to other interpreters</a></span></dt>
1.1 grant 9869:
9870: <dt><span class="sect2"><a href=
1.35 jmmv 9871: "#perl-modules">14.5.6. Packages installing perl
1.1 grant 9872: modules</a></span></dt>
9873:
9874: <dt><span class="sect2"><a href=
1.35 jmmv 9875: "#faq.info-files">14.5.7. Packages installing info
1.1 grant 9876: files</a></span></dt>
9877:
9878: <dt><span class="sect2"><a href=
1.35 jmmv 9879: "#gconf2-data-files">14.5.8. Packages installing
1.30 wiz 9880: GConf2 data files</a></span></dt>
1.1 grant 9881:
9882: <dt><span class="sect2"><a href=
1.35 jmmv 9883: "#scrollkeeper-data-files">14.5.9. Packages
1.30 wiz 9884: installing scrollkeeper data files</a></span></dt>
1.1 grant 9885:
9886: <dt><span class="sect2"><a href=
1.35 jmmv 9887: "#x11-fonts">14.5.10. Packages installing X11
1.1 grant 9888: fonts</a></span></dt>
9889:
9890: <dt><span class="sect2"><a href=
1.35 jmmv 9891: "#gtk2-modules">14.5.11. Packages installing GTK2
1.1 grant 9892: modules</a></span></dt>
9893:
9894: <dt><span class="sect2"><a href=
1.35 jmmv 9895: "#sgml-xml-data">14.5.12. Packages installing SGML
1.30 wiz 9896: or XML data</a></span></dt>
1.1 grant 9897:
9898: <dt><span class="sect2"><a href=
1.35 jmmv 9899: "#mime-database">14.5.13. Packages installing
1.1 grant 9900: extensions to the MIME database</a></span></dt>
9901:
9902: <dt><span class="sect2"><a href=
1.35 jmmv 9903: "#intltool">14.5.14. Packages using
1.1 grant 9904: intltool</a></span></dt>
1.18 xtraeme 9905:
9906: <dt><span class="sect2"><a href=
1.35 jmmv 9907: "#startup-scripts">14.5.15. Packages installing
1.30 wiz 9908: startup scripts</a></span></dt>
1.1 grant 9909: </dl>
9910: </dd>
9911:
1.30 wiz 9912: <dt><span class="sect1"><a href=
1.35 jmmv 9913: "#feedback-to-author">14.6. Feedback to the
1.30 wiz 9914: author</a></span></dt>
1.1 grant 9915: </dl>
9916: </div>
9917:
9918: <div class="sect1" lang="en" xml:lang="en">
9919: <div class="titlepage">
9920: <div>
9921: <div>
9922: <h2 class="title" style="clear: both"><a name=
1.30 wiz 9923: "general-operation" id=
1.35 jmmv 9924: "general-operation"></a>14.1. General
1.1 grant 9925: operation</h2>
9926: </div>
9927: </div>
9928: </div>
9929:
9930: <div class="sect2" lang="en" xml:lang="en">
9931: <div class="titlepage">
9932: <div>
9933: <div>
1.30 wiz 9934: <h3 class="title"><a name=
9935: "pulling-vars-from-etc-mk.conf" id=
1.35 jmmv 9936: "pulling-vars-from-etc-mk.conf"></a>14.1.1. How
1.30 wiz 9937: to pull in variables from /etc/mk.conf</h3>
1.1 grant 9938: </div>
9939: </div>
9940: </div>
9941:
9942: <p>The problem with package-defined variables that can
1.14 xtraeme 9943: be overridden via <code class="varname">MAKECONF</code>
9944: or <code class="filename">/etc/mk.conf</code> is that
9945: <a href=
1.1 grant 9946: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9947: <span class="citerefentry"><span class=
9948: "refentrytitle">make</span>(1)</span></a> expands a
9949: variable as it is used, but evaluates preprocessor like
9950: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 9951: So, to use any variable (which may be set in
9952: <code class="filename">/etc/mk.conf</code>) in one of
9953: the .if* statements, the file <code class=
9954: "filename">/etc/mk.conf</code> must be included before
1.1 grant 9955: that .if* statement.</p>
9956:
9957: <p>Rather than have a number of ad-hoc ways of
1.14 xtraeme 9958: including <code class="filename">/etc/mk.conf</code>,
9959: should it exist, or <code class=
9960: "varname">MAKECONF</code>, should it exist, include the
9961: <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
9962: file in the package Makefile before any
9963: preprocessor-like .if, .ifdef, or .ifndef
9964: statements:</p>
1.1 grant 9965: <pre class="programlisting">
9966: .include "../../mk/bsd.prefs.mk"
9967:
9968: .if defined(USE_MENUS)
9969: ...
9970: .endif
9971: </pre>
9972:
1.14 xtraeme 9973: <p>If you wish to set the <code class=
9974: "varname">CFLAGS</code> variable in <code class=
9975: "filename">/etc/mk.conf</code> please make sure to
1.1 grant 9976: use:</p>
9977: <pre class="programlisting">
9978: CFLAGS+= -your -flags
9979: </pre>
9980:
1.14 xtraeme 9981: <p>Using <code class="varname">CFLAGS=</code> (i.e.
9982: without the “<span class="quote">+</span>”)
9983: may lead to problems with packages that need to add
9984: their own flags. Also, you may want to take a look at
9985: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 9986: href=
9987: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20 ben 9988: class="pkgname">devel/cpuflags</a> package if you're
9989: interested in optimization for the current CPU.</p>
1.1 grant 9990: </div>
9991:
9992: <div class="sect2" lang="en" xml:lang="en">
9993: <div class="titlepage">
9994: <div>
9995: <div>
1.31 wiz 9996: <h3 class="title"><a name=
9997: "where-to-install-documentation" id=
1.35 jmmv 9998: "where-to-install-documentation"></a>14.1.2. Where
1.31 wiz 9999: to install documentation</h3>
10000: </div>
10001: </div>
10002: </div>
10003:
10004: <p>Documentation should be installed into <code class=
10005: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
10006: <code class=
10007: "filename">${PREFIX}/share/doc/${PKGNAME}</code> (the
10008: latter includes the version number of the package).</p>
10009: </div>
10010:
10011: <div class="sect2" lang="en" xml:lang="en">
10012: <div class="titlepage">
10013: <div>
10014: <div>
1.30 wiz 10015: <h3 class="title"><a name="restricted-packages"
10016: id=
1.35 jmmv 10017: "restricted-packages"></a>14.1.3. Restricted
1.1 grant 10018: packages</h3>
10019: </div>
10020: </div>
10021: </div>
10022:
10023: <p>Some licenses restrict how software may be
10024: re-distributed. In order to satisfy these restrictions,
10025: the package system defines five make variables that can
10026: be set to note these restrictions:</p>
10027:
10028: <div class="itemizedlist">
10029: <ul type="disc">
10030: <li>
1.14 xtraeme 10031: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 10032:
10033: <p>This variable should be set whenever a
10034: restriction exists (regardless of its kind). Set
10035: this variable to a string containing the reason
10036: for the restriction.</p>
10037: </li>
10038:
10039: <li>
1.14 xtraeme 10040: <p><code class=
10041: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 10042:
10043: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 10044: variable to <code class=
10045: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 10046: package may not be included on a CD-ROM.</p>
10047: </li>
10048:
10049: <li>
1.14 xtraeme 10050: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 10051:
10052: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 10053: Set this variable to <code class=
10054: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 10055: package may not not be made available on the
10056: Internet.</p>
10057: </li>
10058:
10059: <li>
1.14 xtraeme 10060: <p><code class=
10061: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 10062:
10063: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 10064: this variable to <code class=
10065: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 10066: of the source code or other distfile(s) is not
10067: allowed on CD-ROMs.</p>
10068: </li>
10069:
10070: <li>
1.14 xtraeme 10071: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 10072:
10073: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 10074: variable to <code class=
10075: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 10076: of the source code or other distfile(s) via the
10077: Internet is not allowed.</p>
10078: </li>
10079: </ul>
10080: </div>
10081:
1.14 xtraeme 10082: <p>Please note that the use of <code class=
10083: "varname">NO_PACKAGE</code>, <code class=
10084: "varname">IGNORE</code>, <code class=
10085: "varname">NO_CDROM</code>, or other generic make
1.1 grant 10086: variables to denote restrictions is deprecated, because
10087: they unconditionally prevent users from generating
10088: binary packages!</p>
10089: </div>
10090:
10091: <div class="sect2" lang="en" xml:lang="en">
10092: <div class="titlepage">
10093: <div>
10094: <div>
10095: <h3 class="title"><a name="dependencies" id=
1.35 jmmv 10096: "dependencies"></a>14.1.4. Handling
1.1 grant 10097: dependencies</h3>
10098: </div>
10099: </div>
10100: </div>
10101:
10102: <p>Your package may depend on some other package being
10103: present - and there are various ways of expressing this
1.14 xtraeme 10104: dependency. pkgsrc supports the <code class=
10105: "varname">BUILD_DEPENDS</code> and <code class=
10106: "varname">DEPENDS</code> definitions, as well as
10107: dependencies via <code class=
10108: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 10109: way to handle dependencies, and which uses the
10110: variables named above. See <a href="#buildlink" title=
1.25 rillig 10111: "Chapter 10. Buildlink methodology">Chapter 10,
1.1 grant 10112: <i>Buildlink methodology</i></a> for more
10113: information.</p>
10114:
10115: <p>The basic difference between the two variables is as
1.14 xtraeme 10116: follows: The <code class="varname">DEPENDS</code>
1.1 grant 10117: definition registers that pre-requisite in the binary
10118: package so it will be pulled in when the binary package
1.14 xtraeme 10119: is later installed, whilst the <code class=
10120: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 10121: marking a dependency that is only needed for building
10122: the package.</p>
10123:
10124: <p>This means that if you only need a package present
10125: whilst you are building, it should be noted as a
1.14 xtraeme 10126: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 10127:
1.14 xtraeme 10128: <p>The format for a <code class=
10129: "varname">BUILD_DEPENDS</code> and a <code class=
10130: "varname">DEPENDS</code> definition is:</p>
1.1 grant 10131: <pre class="programlisting">
10132: <pre-req-package-name>:../../<category>/<pre-req-package>
10133: </pre>
10134:
10135: <p>Please note that the “<span class=
10136: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 10137: any of the wildcard version numbers recognized by
1.1 grant 10138: <a href=
10139: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
10140: <span class="citerefentry"><span class=
10141: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
10142:
10143: <div class="orderedlist">
10144: <ol type="1">
10145: <li>
10146: <p>If your package needs another package's
10147: binaries or libraries to build or run, and if
1.14 xtraeme 10148: that package has a <code class=
10149: "filename">buildlink3.mk</code> file available,
10150: use it:</p>
1.1 grant 10151: <pre class="programlisting">
10152: .include "../../graphics/jpeg/buildlink3.mk"
10153:
10154: </pre>
10155: </li>
10156:
10157: <li>
10158: <p>If your package needs to use another package
1.14 xtraeme 10159: to build itself and there is no <code class=
10160: "filename">buildlink3.mk</code> file available,
10161: use the <code class=
10162: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 10163: <pre class="programlisting">
10164: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
10165: </pre>
10166: </li>
10167:
10168: <li>
10169: <p>If your package needs a library with which to
1.14 xtraeme 10170: link and again there is no <code class=
10171: "filename">buildlink3.mk</code> file available,
10172: this is specified using the <code class=
10173: "varname">DEPENDS</code> definition. An example
10174: of this is the <a xmlns=
1.1 grant 10175: "http://www.w3.org/TR/xhtml1/transitional" href=
10176: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 10177: class="pkgname">print/lyx</a> package, which uses
10178: the xpm library, version 3.4j to build:</p>
1.1 grant 10179: <pre class="programlisting">
10180: DEPENDS+= xpm-3.4j:../../graphics/xpm
10181: </pre>
10182:
10183: <p>You can also use wildcards in package
10184: dependences:</p>
10185: <pre class="programlisting">
10186: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
10187: </pre>
10188:
10189: <p>Note that such wildcard dependencies are
10190: retained when creating binary packages. The
10191: dependency is checked when installing the binary
10192: package and any package which matches the pattern
10193: will be used. Wildcard dependencies should be
10194: used with care.</p>
10195:
10196: <p>The “<span class=
10197: "quote">-[0-9]*</span>” should be used
10198: instead of “<span class=
10199: "quote">-*</span>” to avoid potentially
10200: ambiguous matches such as “<span class=
10201: "quote">tk-postgresql</span>” matching a
10202: “<span class="quote">tk-*</span>”
1.14 xtraeme 10203: <code class="varname">DEPENDS</code>.</p>
1.1 grant 10204:
10205: <p>Wildcards can also be used to specify that a
10206: package will only build against a certain minimum
10207: version of a pre-requisite:</p>
10208: <pre class="programlisting">
10209: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
10210: </pre>
10211:
10212: <p>This means that the package will build against
10213: version 3.5.4 of the tiff library or newer. Such
10214: a dependency may be warranted if, for example,
10215: the API of the library has changed with version
10216: 3.5.4 and a package would not compile against an
10217: earlier version of tiff.</p>
10218:
10219: <p>Please note that such dependencies should only
10220: be updated if a package requires a newer
10221: pre-requisite, but not to denote recommendations
10222: such as security updates or ABI changes that do
10223: not prevent a package from building correctly.
10224: Such recommendations can be expressed using
1.14 xtraeme 10225: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 10226: <pre class="programlisting">
10227: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
10228: </pre>
10229:
1.14 xtraeme 10230: <p>In addition to the above <code class=
10231: "varname">DEPENDS</code> line, this denotes that
1.1 grant 10232: while a package will build against
10233: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 10234: recommended. <code class=
10235: "varname">RECOMMENDED</code> entries will be
10236: turned into dependencies unless explicitly
10237: ignored (in which case a warning will be
1.36 ! wiz 10238: printed).</p>
! 10239:
! 10240: <p>To ignore these dependency recommendations and
! 10241: just use the required <code class=
! 10242: "varname">DEPENDS</code>, set <code class=
! 10243: "varname">IGNORE_RECOMMENDED=YES</code>. This may
! 10244: make it easier and faster to update packages
! 10245: built using pkgsrc, since older compatible
! 10246: dependencies can continue to be used. This is
! 10247: useful for people who watch their rebuilds very
! 10248: carefully; it is not very good as a
! 10249: general-purpose hammer. If you use it, you need
! 10250: to be mindful of possible ABI changes, including
! 10251: those from the underlying OS.</p>
! 10252:
! 10253: <p>Packages that are built with recommendations
! 10254: ignored may not be uploaded to ftp.NetBSD.org by
! 10255: developers and should not be used across
! 10256: different systems that may have different
! 10257: versions of binary packages installed.</p>
1.1 grant 10258:
10259: <p>For security fixes, please update the package
10260: vulnerabilities file as well as setting
1.14 xtraeme 10261: <code class="varname">RECOMMENDED</code>, see
1.1 grant 10262: <a href="#security-handling" title=
1.35 jmmv 10263: "14.1.8. Handling packages with security problems">
10264: Section 14.1.8, “Handling packages with
1.1 grant 10265: security problems”</a> for more
10266: information.</p>
10267: </li>
10268:
10269: <li>
10270: <p>If your package needs some executable to be
1.17 sketch 10271: able to run correctly and if there's no
1.14 xtraeme 10272: <code class="filename">buildlink3.mk</code> file,
10273: this is specified using the <code class=
10274: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 10275: "http://www.w3.org/TR/xhtml1/transitional" href=
10276: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 10277: class="pkgname">print/lyx</a> package needs to be
10278: able to execute the latex binary from the teTeX
10279: package when it runs, and that is specified:</p>
1.1 grant 10280: <pre class="programlisting">
10281: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
10282: </pre>
10283:
10284: <p>The comment about wildcard dependencies from
10285: previous paragraph applies here, too.</p>
10286: </li>
10287: </ol>
10288: </div>
10289:
10290: <p>If your package needs files from another package to
10291: build, see the first part of the “<span class=
10292: "quote">do-configure</span>” target <a xmlns=
10293: "http://www.w3.org/TR/xhtml1/transitional" href=
10294: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20 ben 10295: class="pkgname">print/ghostscript5</a> package (it
10296: relies on the jpeg sources being present in source form
10297: during the build):</p>
1.1 grant 10298: <pre class="programlisting">
10299: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
10300: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
10301: fi
10302: </pre>
10303:
10304: <p>If you build any other packages that way, please
10305: make sure the working files are deleted too when this
10306: package's working files are cleaned up. The easiest way
10307: to do so is by adding a pre-clean target:</p>
10308: <pre class="programlisting">
10309: pre-clean:
10310: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
10311: </pre>
10312:
1.14 xtraeme 10313: <p>Please also note the <code class=
10314: "varname">BUILD_USES_MSGFMT</code> and <code class=
10315: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
10316: which are provided as convenience definitions. The
1.24 wiz 10317: former works out whether <a href=
10318: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
10319: <span class="citerefentry"><span class=
10320: "refentrytitle">msgfmt</span>(1)</span></a> is part of
10321: the base system, and, if it isn't, installs the
10322: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
10323: href=
1.1 grant 10324: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20 ben 10325: class="pkgname">devel/gettext</a> package. The latter
10326: adds a build dependency on either an installed version
10327: of an older gettext package, or if it isn't, installs
10328: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
10329: href=
10330: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
10331: class="pkgname">devel/gettext-m4</a> package.</p>
1.1 grant 10332: </div>
10333:
10334: <div class="sect2" lang="en" xml:lang="en">
10335: <div class="titlepage">
10336: <div>
10337: <div>
1.30 wiz 10338: <h3 class="title"><a name="conflicts" id=
1.35 jmmv 10339: "conflicts"></a>14.1.5. Handling conflicts
1.1 grant 10340: with other packages</h3>
10341: </div>
10342: </div>
10343: </div>
10344:
10345: <p>Your package may conflict with other packages a user
10346: might already have installed on his system, e.g. if
10347: your package installs the same set of files like
10348: another package in our pkgsrc tree.</p>
10349:
1.14 xtraeme 10350: <p>In this case you can set <code class=
10351: "varname">CONFLICTS</code> to a space separated list of
1.1 grant 10352: packages (including version string) your package
10353: conflicts with.</p>
10354:
10355: <p>For example <a xmlns=
10356: "http://www.w3.org/TR/xhtml1/transitional" href=
10357: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20 ben 10358: class="pkgname">x11/Xaw3d</a> and <a xmlns=
10359: "http://www.w3.org/TR/xhtml1/transitional" href=
10360: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
10361: class="pkgname">x11/Xaw-Xpm</a> install provide the
10362: same shared library, thus you set in <code class=
10363: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 10364: <pre class="programlisting">
10365: CONFLICTS= Xaw-Xpm-[0-9]*
10366: </pre>
10367:
1.14 xtraeme 10368: <p>and in <code class=
10369: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 10370: <pre class="programlisting">
10371: CONFLICTS= Xaw3d-[0-9]*
10372: </pre>
10373:
10374: <p>Packages will automatically conflict with other
10375: packages with the name prefix and a different version
10376: string. “<span class=
10377: "quote">Xaw3d-1.5</span>” e.g. will automatically
10378: conflict with the older version “<span class=
10379: "quote">Xaw3d-1.3</span>”.</p>
10380: </div>
10381:
10382: <div class="sect2" lang="en" xml:lang="en">
10383: <div class="titlepage">
10384: <div>
10385: <div>
1.30 wiz 10386: <h3 class="title"><a name="not-building-packages"
10387: id=
1.35 jmmv 10388: "not-building-packages"></a>14.1.6. Packages
1.30 wiz 10389: that cannot or should not be built</h3>
1.1 grant 10390: </div>
10391: </div>
10392: </div>
10393:
10394: <p>There are several reasons why a package might be
10395: instructed to not build under certain circumstances. If
10396: the package builds and runs on most platforms, the
1.14 xtraeme 10397: exceptions should be noted with <code class=
10398: "varname">NOT_FOR_PLATFORM</code>. If the package
10399: builds and runs on a small handful of platforms, set
10400: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
10401: If the package should be skipped (for example, because
10402: it provides functionality already provided by the
10403: system), set <code class=
10404: "varname">PKG_SKIP_REASON</code> to a descriptive
10405: message. If the package should fail because some
10406: preconditions are not met, set <code class=
10407: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 10408: message.</p>
10409:
1.14 xtraeme 10410: <p><code class="varname">IGNORE</code> is deprecated
1.1 grant 10411: because it didn't provide enough information to
10412: determine whether the build should fail.</p>
10413: </div>
10414:
10415: <div class="sect2" lang="en" xml:lang="en">
10416: <div class="titlepage">
10417: <div>
10418: <div>
1.30 wiz 10419: <h3 class="title"><a name="undeletable-packages"
10420: id=
1.35 jmmv 10421: "undeletable-packages"></a>14.1.7. Packages
1.30 wiz 10422: which should not be deleted, once installed</h3>
1.1 grant 10423: </div>
10424: </div>
10425: </div>
10426:
10427: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 10428: has been installed, the <code class=
10429: "varname">PKG_PRESERVE</code> definition should be set
10430: in the package Makefile. This will be carried into any
1.1 grant 10431: binary package that is made from this pkgsrc entry. A
10432: “<span class="quote">preserved</span>”
10433: package will not be deleted using <a href=
10434: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10435: <span class="citerefentry"><span class=
10436: "refentrytitle">pkg_delete</span>(1)</span></a> unless
10437: the “<span class="quote">-f</span>” option
10438: is used.</p>
10439: </div>
10440:
10441: <div class="sect2" lang="en" xml:lang="en">
10442: <div class="titlepage">
10443: <div>
10444: <div>
10445: <h3 class="title"><a name="security-handling" id=
1.35 jmmv 10446: "security-handling"></a>14.1.8. Handling
1.1 grant 10447: packages with security problems</h3>
10448: </div>
10449: </div>
10450: </div>
10451:
10452: <p>When a vulnerability is found, this should be noted
1.14 xtraeme 10453: in <code class=
10454: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1 grant 10455: and after the commit of that file, it should be copied
1.14 xtraeme 10456: to both <code class=
10457: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
10458: and <code class=
10459: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
10460: on ftp.NetBSD.org using <code class=
10461: "filename">localsrc/security/advisories/Makefile</code>.
10462: In addition, if a <code class=
10463: "filename">buildlink3.mk</code> file exists for an
10464: affected package, bumping <code class=
10465: "varname">PKGREVISION</code> and creating a
10466: corresponding <code class=
10467: "varname">BUILDLINK_RECOMMENDED.<em class=
10468: "replaceable"><code>pkg</code></em></code> entry should
10469: be considered. See <a href="#buildlink" title=
1.25 rillig 10470: "Chapter 10. Buildlink methodology">Chapter 10,
1.1 grant 10471: <i>Buildlink methodology</i></a> for more information
1.14 xtraeme 10472: about writing <code class=
10473: "filename">buildlink3.mk</code> files and <code class=
10474: "varname">BUILDLINK_*</code> definitions.</p>
1.1 grant 10475:
10476: <p>Also, if the fix should be applied to the stable
10477: pkgsrc branch, be sure to submit a pullup request!</p>
10478: </div>
10479:
10480: <div class="sect2" lang="en" xml:lang="en">
10481: <div class="titlepage">
10482: <div>
10483: <div>
1.30 wiz 10484: <h3 class="title"><a name="compiler-bugs" id=
1.35 jmmv 10485: "compiler-bugs"></a>14.1.9. How to handle
1.1 grant 10486: compiler bugs</h3>
10487: </div>
10488: </div>
10489: </div>
10490:
10491: <p>Some source files trigger bugs in the compiler,
10492: based on combinations of compiler version and
10493: architecture and almost always relation to optimisation
10494: being enabled. Common symptoms are gcc internal errors
10495: or never finishing compiling a file.</p>
10496:
10497: <p>Typically a workaround involves testing the
1.14 xtraeme 10498: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 10499: version, disabling optimisation for that
1.14 xtraeme 10500: file/<code class="varname">MACHINE_ARCH</code>/compiler
10501: combination, and documenting it in <code class=
10502: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 10503: number of examples!</p>
10504: </div>
10505:
10506: <div class="sect2" lang="en" xml:lang="en">
10507: <div class="titlepage">
10508: <div>
10509: <div>
1.30 wiz 10510: <h3 class="title"><a name="bumping-pkgrevision"
1.35 jmmv 10511: id="bumping-pkgrevision"></a>14.1.10. How to
1.30 wiz 10512: handle incrementing versions when fixing an
10513: existing package</h3>
1.1 grant 10514: </div>
10515: </div>
10516: </div>
10517:
10518: <p>When making fixes to an existing package it can be
1.14 xtraeme 10519: useful to change the version number in <code class=
10520: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 10521: future versions by the original author, a
10522: “<span class="quote">nb1</span>”,
10523: “<span class="quote">nb2</span>”, ...
10524: suffix can be used on package versions by setting
1.14 xtraeme 10525: <code class="varname">PKGREVISION=1</code> (2, ...).
10526: The “<span class="quote">nb</span>” is
10527: treated like a “<span class=
10528: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 10529: <pre class="programlisting">
10530: DISTNAME= foo-17.42
10531: PKGREVISION= 9
10532: </pre>
10533:
1.14 xtraeme 10534: <p>will result in a <code class=
10535: "varname">PKGNAME</code> of “<span class=
1.1 grant 10536: "quote">foo-17.42nb9</span>”.</p>
10537:
10538: <p>When a new release of the package is released, the
1.14 xtraeme 10539: <code class="varname">PKGREVISION</code> should be
10540: removed. e.g. on a new minor release of the above
10541: package, things should be like:</p>
1.1 grant 10542: <pre class="programlisting">
10543: DISTNAME= foo-17.43
10544: </pre>
10545: </div>
10546:
10547: <div class="sect2" lang="en" xml:lang="en">
10548: <div class="titlepage">
10549: <div>
10550: <div>
1.30 wiz 10551: <h3 class="title"><a name=
10552: "portability-of-packages" id=
1.35 jmmv 10553: "portability-of-packages"></a>14.1.11. Portability
1.30 wiz 10554: of packages</h3>
1.1 grant 10555: </div>
10556: </div>
10557: </div>
10558:
10559: <p>One appealing feature of pkgsrc is that it runs on
10560: many different platforms. As a result, it is important
10561: to ensure, where possible, that packages in pkgsrc are
10562: portable. There are some particular details you should
10563: pay attention to while working on pkgsrc.</p>
10564:
10565: <div class="sect3" lang="en" xml:lang="en">
10566: <div class="titlepage">
10567: <div>
10568: <div>
1.30 wiz 10569: <h4 class="title"><a name="install-scripts" id=
1.35 jmmv 10570: "install-scripts"></a>14.1.11.1. ${INSTALL},
1.1 grant 10571: ${INSTALL_DATA_DIR}, ...</h4>
10572: </div>
10573: </div>
10574: </div>
10575:
1.14 xtraeme 10576: <p>The BSD-compatible <span><strong class=
10577: "command">install</strong></span> supplied with some
1.1 grant 10578: operating systems will not perform more than one
10579: operation at a time. As such, you should call
10580: “<span class="quote">${INSTALL}</span>”,
10581: etc. like this:</p>
10582: <pre class="programlisting">
10583: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
10584: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
10585: </pre>
10586: </div>
10587: </div>
10588: </div>
10589:
10590: <div class="sect1" lang="en" xml:lang="en">
10591: <div class="titlepage">
10592: <div>
10593: <div>
10594: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10595: "downloading-issues" id=
1.35 jmmv 10596: "downloading-issues"></a>14.2. Possible
1.1 grant 10597: downloading issues</h2>
10598: </div>
10599: </div>
10600: </div>
10601:
10602: <div class="sect2" lang="en" xml:lang="en">
10603: <div class="titlepage">
10604: <div>
10605: <div>
1.30 wiz 10606: <h3 class="title"><a name="no-plain-download" id=
1.35 jmmv 10607: "no-plain-download"></a>14.2.1. Packages
1.30 wiz 10608: whose distfiles aren't available for plain
1.1 grant 10609: downloading</h3>
10610: </div>
10611: </div>
10612: </div>
10613:
10614: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 10615: set <code class="varname">DYNAMIC_MASTER_SITES</code>
10616: and a <span><strong class="command">make
10617: fetch</strong></span> will call <code class=
10618: "filename">files/getsite.sh</code> with the name of
10619: each file to download as an argument, expecting it to
10620: output the URL of the directory from which to download
10621: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
10622: href=
1.1 grant 10623: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20 ben 10624: class="pkgname">graphics/ns-cult3d</a> is an example of
10625: this usage.</p>
1.1 grant 10626:
10627: <p>If the download can't be automated, because the user
10628: must submit personal information to apply for a
10629: password, or must pay for the source, or whatever, you
1.14 xtraeme 10630: can set <code class="varname">_FETCH_MESSAGE</code> to
10631: a macro which displays a message explaining the
10632: situation. <code class="varname">_FETCH_MESSAGE</code>
10633: must be executable shell commands, not just a message.
10634: (Generally, it executes <code class=
10635: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 10636: following packages use this: <a xmlns=
10637: "http://www.w3.org/TR/xhtml1/transitional" href=
10638: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20 ben 10639: class="pkgname">audio/realplayer</a>, <a xmlns=
10640: "http://www.w3.org/TR/xhtml1/transitional" href=
10641: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
10642: class="pkgname">cad/simian</a>, <a xmlns=
10643: "http://www.w3.org/TR/xhtml1/transitional" href=
10644: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
10645: class="pkgname">devel/ipv6socket</a>, <a xmlns=
10646: "http://www.w3.org/TR/xhtml1/transitional" href=
10647: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
10648: class="pkgname">emulators/vmware-module</a>, <a xmlns=
10649: "http://www.w3.org/TR/xhtml1/transitional" href=
10650: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
10651: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
10652: "http://www.w3.org/TR/xhtml1/transitional" href=
10653: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
10654: class="pkgname">sysutils/storage-manager</a>, <a xmlns=
10655: "http://www.w3.org/TR/xhtml1/transitional" href=
10656: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
10657: class="pkgname">www/ap-aolserver</a>, <a xmlns=
10658: "http://www.w3.org/TR/xhtml1/transitional" href=
10659: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
10660: class="pkgname">www/openacs</a>. Try to be consistent
10661: with them.</p>
1.1 grant 10662: </div>
10663:
10664: <div class="sect2" lang="en" xml:lang="en">
10665: <div class="titlepage">
10666: <div>
10667: <div>
1.30 wiz 10668: <h3 class="title"><a name=
10669: "modified-distfiles-same-name" id=
1.35 jmmv 10670: "modified-distfiles-same-name"></a>14.2.2. How
1.30 wiz 10671: to handle modified distfiles with the 'old'
10672: name</h3>
1.1 grant 10673: </div>
10674: </div>
10675: </div>
10676:
10677: <p>Sometimes authors of a software package make some
10678: modifications after the software was released, and they
10679: put up a new distfile without changing the package's
10680: version number. If a package is already in pkgsrc at
1.32 wiz 10681: that time, the checksum will no longer match. The
10682: contents of the new distfile should be compared against
10683: the old one before changing anything, to make sure the
10684: distfile was really updated on purpose, and that no
10685: trojan horse or so crept in. Then, the correct way to
10686: work around this is to set <code class=
10687: "varname">DIST_SUBDIR</code> to a unique directory
10688: name, usually based on <code class=
10689: "varname">PKGNAME_NOREV</code>. In case this happens
10690: more often, <code class="varname">PKGNAME</code> can be
10691: used (thus including the <code class=
10692: "filename">nbX</code> suffix) or a date stamp can be
10693: appended, like <code class=
10694: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
10695: forget regenerating the <code class=
10696: "filename">distinfo</code> file after that, since it
10697: contains the <code class="varname">DIST_SUBDIR</code>
10698: path in the filenames. Furthermore, a mail to the
10699: package's authors seems appropriate telling them that
10700: changing distfiles after releases without changing the
10701: file names is not good practice.</p>
1.1 grant 10702: </div>
10703: </div>
10704:
10705: <div class="sect1" lang="en" xml:lang="en">
10706: <div class="titlepage">
10707: <div>
10708: <div>
10709: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10710: "configuration-gotchas" id=
1.35 jmmv 10711: "configuration-gotchas"></a>14.3. Configuration
1.1 grant 10712: gotchas</h2>
10713: </div>
10714: </div>
10715: </div>
10716:
10717: <div class="sect2" lang="en" xml:lang="en">
10718: <div class="titlepage">
10719: <div>
10720: <div>
10721: <h3 class="title"><a name="fixes.libtool" id=
1.35 jmmv 10722: "fixes.libtool"></a>14.3.1. Shared libraries
1.1 grant 10723: - libtool</h3>
10724: </div>
10725: </div>
10726: </div>
10727:
10728: <p>pkgsrc supports many different machines, with
10729: different object formats like a.out and ELF, and
10730: varying abilities to do shared library and dynamic
10731: loading at all. To accompany this, varying commands and
10732: options have to be passed to the compiler, linker, etc.
10733: to get the Right Thing, which can be pretty annoying
10734: especially if you don't have all the machines at your
10735: hand to test things. The <a xmlns=
10736: "http://www.w3.org/TR/xhtml1/transitional" href=
10737: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20 ben 10738: class="pkgname">devel/libtool</a> pkg can help here, as
10739: it just “<span class="quote">knows</span>”
10740: how to build both static and dynamic libraries from a
10741: set of source files, thus being platform
10742: independent.</p>
1.1 grant 10743:
10744: <p>Here's how to use libtool in a pkg in seven simple
10745: steps:</p>
10746:
10747: <div class="orderedlist">
10748: <ol type="1">
10749: <li>
1.14 xtraeme 10750: <p>Add <code class=
10751: "varname">USE_LIBTOOL=yes</code> to the package
10752: Makefile.</p>
1.1 grant 10753: </li>
10754:
10755: <li>
10756: <p>For library objects, use “<span class=
10757: "quote">${LIBTOOL} --mode=compile
10758: ${CC}</span>” in place of
10759: “<span class="quote">${CC}</span>”.
10760: You could even add it to the definition of
1.14 xtraeme 10761: <code class="varname">CC</code>, if only
10762: libraries are being built in a given Makefile.
10763: This one command will build both PIC and non-PIC
10764: library objects, so you need not have separate
10765: shared and non-shared library rules.</p>
1.1 grant 10766: </li>
10767:
10768: <li>
10769: <p>For the linking of the library, remove any
10770: “<span class="quote">ar</span>”,
10771: “<span class="quote">ranlib</span>”,
10772: and “<span class="quote">ld
10773: -Bshareable</span>” commands, and instead
10774: use:</p>
10775: <pre class="programlisting">
10776: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
10777: </pre>
10778:
10779: <p>Note that the library is changed to have a
1.14 xtraeme 10780: <code class="filename">.la</code> extension, and
10781: the objects are changed to have a <code class=
10782: "filename">.lo</code> extension. Change
10783: <code class="varname">OBJS</code> as necessary.
10784: This automatically creates all of the
10785: <code class="filename">.a</code>, <code class=
10786: "filename">.so.major.minor</code>, and ELF
10787: symlinks (if necessary) in the build directory.
10788: Be sure to include “<span class=
1.1 grant 10789: "quote">-version-info</span>”, especially
10790: when major and minor are zero, as libtool will
10791: otherwise strip off the shared library
10792: version.</p>
10793:
10794: <p>From the libtool manual:</p>
10795: <pre class="programlisting">
10796: So, libtool library versions are described by three integers:
10797:
10798: CURRENT
10799: The most recent interface number that this library implements.
10800:
10801: REVISION
10802: The implementation number of the CURRENT interface.
10803:
10804: AGE
10805: The difference between the newest and oldest interfaces that this
10806: library implements. In other words, the library implements all the
10807: interface numbers in the range from number `CURRENT - AGE' to
10808: `CURRENT'.
10809:
10810: If two libraries have identical CURRENT and AGE numbers, then the
10811: dynamic linker chooses the library with the greater REVISION number.
10812: </pre>
10813:
10814: <p>The “<span class=
10815: "quote">-release</span>” option will
10816: produce different results for a.out and ELF
10817: (excluding symlinks) in only one case. An ELF
10818: library of the form “<span class=
10819: "quote">libfoo-release.so.<span class=
10820: "emphasis"><em>x</em></span>.<span class=
10821: "emphasis"><em>y</em></span></span>” will
10822: have a symlink of “<span class=
10823: "quote">libfoo.so.<span class=
10824: "emphasis"><em>x</em></span>.<span class=
10825: "emphasis"><em>y</em></span></span>” on an
10826: a.out platform. This is handled
10827: automatically.</p>
10828:
10829: <p>The “<span class="quote">-rpath
10830: argument</span>” is the install directory
10831: of the library being built.</p>
10832:
1.14 xtraeme 10833: <p>In the <code class="filename">PLIST</code>,
1.19 hubertf 10834: include only the <code class=
10835: "filename">.la</code> file, the other files will
10836: be added automatically.</p>
1.1 grant 10837: </li>
10838:
10839: <li>
1.14 xtraeme 10840: <p>When linking shared object (<code class=
10841: "filename">.so</code>) files, i.e. files that are
1.24 wiz 10842: loaded via <a href=
10843: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
10844: <span class="citerefentry"><span class=
10845: "refentrytitle">dlopen</span>(3)</span></a>, NOT
10846: shared libraries, use “<span class=
10847: "quote">-module -avoid-version</span>” to
10848: prevent them getting version tacked on.</p>
1.1 grant 10849:
1.14 xtraeme 10850: <p>The <code class="filename">PLIST</code> file
10851: gets the <code class="filename">foo.so</code>
10852: entry.</p>
1.1 grant 10853: </li>
10854:
10855: <li>
10856: <p>When linking programs that depend on these
10857: libraries <span class=
10858: "emphasis"><em>before</em></span> they are
10859: installed, preface the <a href=
10860: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
10861: <span class="citerefentry"><span class=
10862: "refentrytitle">cc</span>(1)</span></a> or
10863: <a href=
10864: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
10865: <span class="citerefentry"><span class=
10866: "refentrytitle">ld</span>(1)</span></a> line with
10867: “<span class="quote">${LIBTOOL}
10868: --mode=link</span>”, and it will find the
10869: correct libraries (static or shared), but please
10870: be aware that libtool will not allow you to
10871: specify a relative path in -L (such as
10872: “<span class=
10873: "quote">-L../somelib</span>”), because it
10874: expects you to change that argument to be the
1.14 xtraeme 10875: <code class="filename">.la</code> file. e.g.</p>
1.1 grant 10876: <pre class="programlisting">
10877: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
10878: </pre>
10879:
10880: <p>should be changed to:</p>
10881: <pre class="programlisting">
1.14 xtraeme 10882: ${LIBTOOL} --mode=link ${CC} -o <em class=
10883: "replaceable"><code>someprog</code></em> <em class=
10884: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 10885: </pre>
10886:
10887: <p>and it will do the right thing with the
10888: libraries.</p>
10889: </li>
10890:
10891: <li>
10892: <p>When installing libraries, preface the
10893: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
10894: <span class="citerefentry"><span class=
10895: "refentrytitle">install</span>(1)</span></a> or
10896: <a href=
10897: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
10898: <span class="citerefentry"><span class=
10899: "refentrytitle">cp</span>(1)</span></a> command
10900: with “<span class="quote">${LIBTOOL}
10901: --mode=install</span>”, and change the
1.14 xtraeme 10902: library name to <code class=
10903: "filename">.la</code>. e.g.</p>
1.1 grant 10904: <pre class="programlisting">
10905: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
10906: </pre>
10907:
1.14 xtraeme 10908: <p>This will install the static <code class=
10909: "filename">.a</code>, shared library, any needed
1.1 grant 10910: symlinks, and run <a href=
10911: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
10912: <span class="citerefentry"><span class=
10913: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
10914: </li>
10915:
10916: <li>
1.14 xtraeme 10917: <p>In your <code class="filename">PLIST</code>,
1.23 wiz 10918: include only the <code class=
10919: "filename">.la</code> file (this is a change from
10920: previous behaviour).</p>
1.1 grant 10921: </li>
10922: </ol>
10923: </div>
10924: </div>
10925:
10926: <div class="sect2" lang="en" xml:lang="en">
10927: <div class="titlepage">
10928: <div>
10929: <div>
1.30 wiz 10930: <h3 class="title"><a name="using-libtool" id=
1.35 jmmv 10931: "using-libtool"></a>14.3.2. Using libtool on
1.30 wiz 10932: GNU packages that already support libtool</h3>
1.1 grant 10933: </div>
10934: </div>
10935: </div>
10936:
1.14 xtraeme 10937: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
10938: the package Makefile. This will override the package's
10939: own libtool in most cases. For older libtool using
1.1 grant 10940: packages, libtool is made by ltconfig script during the
10941: do-configure step; you can check the libtool script
1.14 xtraeme 10942: location by doing <span><strong class="command">make
10943: configure; find work*/ -name
10944: libtool</strong></span>.</p>
10945:
10946: <p><code class="varname">LIBTOOL_OVERRIDE</code>
10947: specifies which libtool scripts, relative to
10948: <code class="varname">WRKSRC</code>, to override. By
10949: default, it is set to “<span class=
10950: "quote">libtool */libtool */*/libtool</span>”. If
10951: this does not match the location of the package's
10952: libtool script(s), set it as appropriate.</p>
1.13 hubertf 10953:
1.14 xtraeme 10954: <p>If you do not need <code class="filename">*.a</code>
1.1 grant 10955: static libraries built and installed, then use
1.14 xtraeme 10956: <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1 grant 10957: instead.</p>
10958:
10959: <p>If your package makes use of the platform
10960: independent library for loading dynamic shared objects,
10961: that comes with libtool (libltdl), you should include
1.22 tv 10962: devel/libltdl/buildlink3.mk.</p>
1.1 grant 10963:
10964: <p>Some packages use libtool incorrectly so that the
10965: package may not work or build in some circumstances.
10966: Some of the more common errors are:</p>
10967:
10968: <div class="itemizedlist">
10969: <ul type="disc">
10970: <li>
10971: <p>The inclusion of a shared object (-module) as
10972: a dependent library in an executable or library.
10973: This in itself isn't a problem if one of two
10974: things has been done:</p>
10975:
10976: <div class="orderedlist">
10977: <ol type="1">
10978: <li>
10979: <p>The shared object is named correctly,
1.14 xtraeme 10980: i.e. <code class=
10981: "filename">libfoo.la</code>, not
10982: <code class="filename">foo.la</code></p>
1.1 grant 10983: </li>
10984:
10985: <li>
10986: <p>The -dlopen option is used when linking
10987: an executable.</p>
10988: </li>
10989: </ol>
10990: </div>
10991: </li>
10992:
10993: <li>
10994: <p>The use of libltdl without the correct calls
10995: to initialisation routines. The function
10996: lt_dlinit() should be called and the macro
1.14 xtraeme 10997: <code class=
10998: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 10999: included in executables.</p>
11000: </li>
11001: </ul>
11002: </div>
11003: </div>
11004:
11005: <div class="sect2" lang="en" xml:lang="en">
11006: <div class="titlepage">
11007: <div>
11008: <div>
1.30 wiz 11009: <h3 class="title"><a name="autoconf-automake" id=
1.35 jmmv 11010: "autoconf-automake"></a>14.3.3. GNU
1.1 grant 11011: Autoconf/Automake</h3>
11012: </div>
11013: </div>
11014: </div>
11015:
11016: <p>If a package needs GNU autoconf or automake to be
11017: executed to regenerate the configure script and
11018: Makefile.in makefile templates, then they should be
1.35 jmmv 11019: executed in a pre-configure target.</p>
1.1 grant 11020:
11021: <p>For packages that need only autoconf:</p>
11022: <pre class="programlisting">
1.35 jmmv 11023: AUTOCONF_REQD= 2.50 # if default version is not good enough
11024: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
1.1 grant 11025: ...
11026:
11027: pre-configure:
1.35 jmmv 11028: cd ${WRKSRC}; autoconf
1.1 grant 11029:
11030: ...
11031: </pre>
11032:
11033: <p>and for packages that need automake and
11034: autoconf:</p>
11035: <pre class="programlisting">
1.35 jmmv 11036: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
1.36 ! wiz 11037: USE_TOOLS+= automake # use "automake14" for automake-1.4
1.1 grant 11038: ...
11039:
11040: pre-configure:
11041: cd ${WRKSRC}; \
1.35 jmmv 11042: aclocal; autoheader; \
11043: automake -a --foreign -i; autoconf
1.1 grant 11044:
11045: ...
11046: </pre>
11047:
11048: <p>Packages which use GNU Automake will almost
1.35 jmmv 11049: certainly require GNU Make.</p>
1.1 grant 11050:
11051: <p>There are times when the configure process makes
11052: additional changes to the generated files, which then
11053: causes the build process to try to re-execute the
11054: automake sequence. This is prevented by touching
11055: various files in the configure stage. If this causes
1.14 xtraeme 11056: problems with your package you can set <code class=
11057: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 11058: Makefile.</p>
11059: </div>
11060: </div>
11061:
11062: <div class="sect1" lang="en" xml:lang="en">
11063: <div class="titlepage">
11064: <div>
11065: <div>
11066: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11067: "building-considerations" id=
1.35 jmmv 11068: "building-considerations"></a>14.4. Building
1.1 grant 11069: considerations</h2>
11070: </div>
11071: </div>
11072: </div>
11073:
11074: <div class="sect2" lang="en" xml:lang="en">
11075: <div class="titlepage">
11076: <div>
11077: <div>
1.30 wiz 11078: <h3 class="title"><a name="cpp-defines" id=
1.35 jmmv 11079: "cpp-defines"></a>14.4.1. CPP defines</h3>
1.1 grant 11080: </div>
11081: </div>
11082: </div>
11083:
11084: <p>To port an application to NetBSD, it's usually
11085: necessary for the compiler to be able to judge the
11086: system on which it's compiling, and we use definitions
11087: so that the C pre-processor can do this.</p>
11088:
11089: <p>To test whether you are working on a 4.4 BSD-derived
11090: system, you should use the BSD definition, which is
1.14 xtraeme 11091: defined in <code class=
11092: "filename"><sys/param.h></code> on said
1.1 grant 11093: systems.</p>
11094: <pre class="programlisting">
11095: #include <sys/param.h>
11096: </pre>
11097:
11098: <p>and then you can surround the BSD-specific parts of
11099: your package's C/C++ code using this conditional:</p>
11100: <pre class="programlisting">
11101: #if (defined(BSD) && BSD >= 199306)
11102: ...
11103: #endif
11104: </pre>
11105:
11106: <p>Please use the “<span class=
11107: "quote">__NetBSD__</span>” definition sparingly -
11108: it should only apply to features of NetBSD that are not
11109: present in other 4.4-lite derived BSDs.</p>
11110: </div>
11111: </div>
11112:
11113: <div class="sect1" lang="en" xml:lang="en">
11114: <div class="titlepage">
11115: <div>
11116: <div>
11117: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11118: "package-specific-actions" id=
1.35 jmmv 11119: "package-specific-actions"></a>14.5. Package
1.1 grant 11120: specific actions</h2>
11121: </div>
11122: </div>
11123: </div>
11124:
11125: <div class="sect2" lang="en" xml:lang="en">
11126: <div class="titlepage">
11127: <div>
11128: <div>
1.30 wiz 11129: <h3 class="title"><a name="user-interaction" id=
1.35 jmmv 11130: "user-interaction"></a>14.5.1. User
1.2 hubertf 11131: interaction</h3>
1.1 grant 11132: </div>
11133: </div>
11134: </div>
11135:
11136: <p>Occasionally, packages require interaction from the
11137: user, and this can be in a number of ways:</p>
11138:
11139: <div class="itemizedlist">
11140: <ul type="disc">
11141: <li>
11142: <p>help in fetching the distfiles</p>
11143: </li>
11144:
11145: <li>
11146: <p>help to configure the package before it is
11147: built</p>
11148: </li>
11149:
11150: <li>
11151: <p>help during the build process</p>
11152: </li>
11153:
11154: <li>
11155: <p>help during the installation of a package</p>
11156: </li>
11157: </ul>
11158: </div>
11159:
1.14 xtraeme 11160: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 11161: definition is provided to notify the pkgsrc mechanism
11162: of an interactive stage which will be needed, and this
1.14 xtraeme 11163: should be set in the package's <code class=
11164: "filename">Makefile</code>. e.g.</p>
1.1 grant 11165: <pre class="programlisting">
11166: INTERACTIVE_STAGE= build
11167: </pre>
11168:
11169: <p>Multiple interactive stages can be specified:</p>
11170: <pre class="programlisting">
11171: INTERACTIVE_STAGE= configure install
11172: </pre>
11173: </div>
11174:
11175: <div class="sect2" lang="en" xml:lang="en">
11176: <div class="titlepage">
11177: <div>
11178: <div>
1.30 wiz 11179: <h3 class="title"><a name="handling-licenses" id=
1.35 jmmv 11180: "handling-licenses"></a>14.5.2. Handling
1.1 grant 11181: licenses</h3>
11182: </div>
11183: </div>
11184: </div>
11185:
11186: <p>A package may underly a license which the user has
11187: or has not agreed to accept. Usually, packages that
11188: underly well-known Open Source licenses (e.g. the GNU
11189: Public License, GPL) won't have any special license
11190: tags added in pkgsrc which require special action by
11191: the user of such packages, but there are quite a number
11192: of other licenses out there that pkgsrc users may not
11193: be able to follow, for whatever reasons. For these
11194: cases, pkgsrc contains a mechanism to note that a
11195: package underlies a certain license, and the user has
11196: to accept the license before the package can be
11197: installed.</p>
11198:
11199: <p>Placing a certain package under a certain license
1.14 xtraeme 11200: works by setting the <code class=
11201: "varname">LICENSE</code> variable to a string
11202: identifying the license, e.g. in <a xmlns=
11203: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 11204: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20 ben 11205: class="pkgname">graphics/graphviz</a>:</p>
1.1 grant 11206: <pre class="programlisting">
11207: LICENSE= graphviz-license
11208: </pre>
11209:
11210: <p>When trying to build, the user will get a notice
11211: that the package underlies a license which he hasn't
11212: accepted (yet):</p>
11213: <pre class="programlisting">
1.14 xtraeme 11214: <code class="prompt">%</code> <strong class=
11215: "userinput"><code>make</code></strong>
1.1 grant 11216: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
11217: ===> To build this package, add this line to your /etc/mk.conf:
11218: ===> ACCEPTABLE_LICENSES+=graphviz-license
11219: ===> To view the license, enter "/usr/bin/make show-license".
11220: *** Error code 1
11221: </pre>
11222:
1.14 xtraeme 11223: <p>The license can be viewed with <span><strong class=
11224: "command">make show-license</strong></span>, and if it
11225: is considered appropriate, the line printed above can
11226: be added to <code class="filename">/etc/mk.conf</code>
11227: to indicate acceptance of the particular license:</p>
1.1 grant 11228: <pre class="programlisting">
11229: ACCEPTABLE_LICENSES+=graphviz-license
11230: </pre>
11231:
11232: <p>When adding a package with a new license, the
1.14 xtraeme 11233: license text should be added to <code class=
11234: "filename">pkgsrc/licenses</code> for displaying. A
11235: list of known licenses can be seen in this directory as
11236: well as by looking at the list of (commented out)
11237: <code class="varname">ACCEPTABLE_LICENSES</code>
11238: variable settings in <code class=
11239: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 11240:
1.17 sketch 11241: <p>If there is a <span class=
1.1 grant 11242: "emphasis"><em>really</em></span> pressing need to
11243: accept all licenses at once, like when trying to
11244: download or mirror all distfiles or doing a bulk build
11245: to test if all packages in pkgsrc build, this can be
1.14 xtraeme 11246: done by setting <code class=
11247: "varname">_ACCEPTABLE=yes</code>.</p>
1.1 grant 11248: </div>
11249:
11250: <div class="sect2" lang="en" xml:lang="en">
11251: <div class="titlepage">
11252: <div>
11253: <div>
1.30 wiz 11254: <h3 class="title"><a name=
11255: "installing-score-files" id=
1.35 jmmv 11256: "installing-score-files"></a>14.5.3. Installing
1.30 wiz 11257: score files</h3>
1.1 grant 11258: </div>
11259: </div>
11260: </div>
11261:
11262: <p>Certain packages, most of them in the games
11263: category, install a score file that allows all users on
11264: the system to record their highscores. In order for
11265: this to work, the binaries need to be installed setgid
11266: and the score files owned by the appropriate group
11267: and/or owner (traditionally the "games" user/group).
11268: The following variables, documented in more detail in
1.14 xtraeme 11269: <code class="filename">mk/defaults/mk.conf</code>,
11270: control this behaviour: <code class=
11271: "varname">SETGIDGAME</code>, <code class=
11272: "varname">GAMEDATAMODE</code>, <code class=
11273: "varname">GAMEGRP</code>, <code class=
11274: "varname">GAMEMODE</code>, <code class=
11275: "varname">GAMEOWN</code>.</p>
1.1 grant 11276:
11277: <p>Note that per default, setgid installation of games
1.14 xtraeme 11278: is disabled; setting <code class=
11279: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 11280: variables accordingly.</p>
11281:
11282: <p>A package should therefor never hard code file
1.14 xtraeme 11283: ownership or access permissions but rely on
11284: <code class="varname">INSTALL_GAME</code> and
11285: <code class="varname">INSTALL_GAME_DATA</code> to set
11286: these correctly.</p>
1.1 grant 11287: </div>
11288:
11289: <div class="sect2" lang="en" xml:lang="en">
11290: <div class="titlepage">
11291: <div>
11292: <div>
1.30 wiz 11293: <h3 class="title"><a name="perl-scripts" id=
1.35 jmmv 11294: "perl-scripts"></a>14.5.4. Packages
1.30 wiz 11295: containing perl scripts</h3>
1.1 grant 11296: </div>
11297: </div>
11298: </div>
11299:
11300: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 11301: set <code class="varname">REPLACE_PERL</code> to ensure
11302: that the proper interpreter path is set. <code class=
11303: "varname">REPLACE_PERL</code> should contain a list of
11304: scripts, relative to <code class=
11305: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 11306: </div>
11307:
11308: <div class="sect2" lang="en" xml:lang="en">
11309: <div class="titlepage">
11310: <div>
11311: <div>
1.30 wiz 11312: <h3 class="title"><a name="hardcoded-paths" id=
1.35 jmmv 11313: "hardcoded-paths"></a>14.5.5. Packages with
1.1 grant 11314: hardcoded paths to other interpreters</h3>
11315: </div>
11316: </div>
11317: </div>
11318:
11319: <p>Your package may also contain scripts with hardcoded
11320: paths to other interpreters besides (or as well as)
11321: perl. To correct the full pathname to the script
11322: interpreter, you need to set the following definitions
1.14 xtraeme 11323: in your <code class="filename">Makefile</code> (we
11324: shall use <span><strong class=
11325: "command">tclsh</strong></span> in this example):</p>
1.1 grant 11326: <pre class="programlisting">
11327: REPLACE_INTERPRETER+= tcl
11328: _REPLACE.tcl.old= .*/bin/tclsh
11329: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
11330: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
11331: relative to ${WRKSRC}, just as in REPLACE_PERL
11332: </pre>
11333: </div>
11334:
11335: <div class="sect2" lang="en" xml:lang="en">
11336: <div class="titlepage">
11337: <div>
11338: <div>
1.30 wiz 11339: <h3 class="title"><a name="perl-modules" id=
1.35 jmmv 11340: "perl-modules"></a>14.5.6. Packages
1.30 wiz 11341: installing perl modules</h3>
1.1 grant 11342: </div>
11343: </div>
11344: </div>
11345:
11346: <p>Makefiles of packages providing perl5 modules should
1.14 xtraeme 11347: include the Makefile fragment <code class=
11348: "filename">../../lang/perl5/module.mk</code>. It
11349: provides a <span><strong class=
11350: "command">do-configure</strong></span> target for the
11351: standard perl configuration for such modules as well as
11352: various hooks to tune this configuration. See comments
11353: in this file for details.</p>
1.1 grant 11354:
11355: <p>Perl5 modules will install into different places
11356: depending on the version of perl used during the build
11357: process. To address this, pkgsrc will append lines to
1.14 xtraeme 11358: the <code class="filename">PLIST</code> corresponding
11359: to the files listed in the installed <code class=
11360: "filename">.packlist</code> file generated by most
11361: perl5 modules. This is invoked by defining <code class=
11362: "varname">PERL5_PACKLIST</code> to a space-separated
11363: list of paths to packlist files, e.g.:</p>
1.1 grant 11364: <pre class="programlisting">
11365: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
11366: </pre>
11367:
1.14 xtraeme 11368: <p>The variables <code class=
11369: "varname">PERL5_SITELIB</code>, <code class=
11370: "varname">PERL5_SITEARCH</code>, and <code class=
11371: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 11372: locations in which perl5 modules may be installed, and
11373: may be used by perl5 packages that don't have a
11374: packlist. These three variables are also substituted
1.14 xtraeme 11375: for in the <code class="filename">PLIST</code>.</p>
1.1 grant 11376: </div>
11377:
11378: <div class="sect2" lang="en" xml:lang="en">
11379: <div class="titlepage">
11380: <div>
11381: <div>
11382: <h3 class="title"><a name="faq.info-files" id=
1.35 jmmv 11383: "faq.info-files"></a>14.5.7. Packages
1.1 grant 11384: installing info files</h3>
11385: </div>
11386: </div>
11387: </div>
11388:
11389: <p>Some packages install info files or use the
11390: “<span class="quote">makeinfo</span>” or
11391: “<span class="quote">install-info</span>”
11392: commands. Each of the info files:</p>
11393:
11394: <div class="itemizedlist">
11395: <ul type="disc">
11396: <li>
11397: <p>is considered to be installed in the directory
1.14 xtraeme 11398: <code class=
11399: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 11400: </li>
11401:
11402: <li>
11403: <p>is registered in the Info directory file
1.14 xtraeme 11404: <code class=
11405: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 11406: </li>
11407:
11408: <li>
11409: <p>and must be listed as a filename in the
1.14 xtraeme 11410: <code class="varname">INFO_FILES</code> variable
11411: in the package Makefile.</p>
1.1 grant 11412: </li>
11413: </ul>
11414: </div>
11415:
1.14 xtraeme 11416: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 11417: “<span class="quote">info</span>” and can
1.14 xtraeme 11418: be overridden in the package Makefile. <code class=
11419: "filename">INSTALL</code> and <code class=
11420: "filename">DEINSTALL</code> scripts will be generated
11421: to handle registration of the info files in the Info
1.1 grant 11422: directory file. The “<span class=
11423: "quote">install-info</span>” command used for the
11424: info files registration is either provided by the
11425: system, or by a special purpose package automatically
11426: added as dependency if needed.</p>
11427:
11428: <p>A package which needs the “<span class=
11429: "quote">makeinfo</span>” command at build time
1.14 xtraeme 11430: must define the variable <code class=
11431: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 11432: minimum version of the “<span class=
11433: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 11434: should be noted with the <code class=
11435: "varname">TEXINFO_REQD</code> variable in the package
11436: <code class="filename">Makefile</code>. By default, a
1.1 grant 11437: minimum version of 3.12 is required. If the system does
1.14 xtraeme 11438: not provide a <span><strong class=
11439: "command">makeinfo</strong></span> command or if it
11440: does not match the required minimum, a build dependency
11441: on the <a xmlns=
11442: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 11443: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20 ben 11444: class="pkgname">devel/gtexinfo</a> package will be
11445: added automatically.</p>
1.1 grant 11446:
11447: <p>The build and installation process of the software
11448: provided by the package should not use the
1.14 xtraeme 11449: <span><strong class=
11450: "command">install-info</strong></span> command as the
11451: registration of info files is the task of the package
11452: <code class="filename">INSTALL</code> script, and it
11453: must use the appropriate <span><strong class=
11454: "command">makeinfo</strong></span> command.</p>
1.1 grant 11455:
11456: <p>To achieve this goal the pkgsrc infrastructure
1.14 xtraeme 11457: creates overriding scripts for the <span><strong class=
11458: "command">install-info</strong></span> and
11459: <span><strong class="command">makeinfo</strong></span>
11460: commands in a directory listed early in <code class=
11461: "varname">PATH</code>.</p>
1.1 grant 11462:
1.14 xtraeme 11463: <p>The script overriding <span><strong class=
11464: "command">install-info</strong></span> has no effect
11465: except the logging of a message. The script overriding
11466: <span><strong class="command">makeinfo</strong></span>
11467: logs a message and according to the value of
11468: <code class="varname">USE_MAKEINFO</code> and
11469: <code class="varname">TEXINFO_REQD</code> either run
11470: the appropriate <span><strong class=
11471: "command">makeinfo</strong></span> command or exit on
11472: error.</p>
1.1 grant 11473: </div>
11474:
11475: <div class="sect2" lang="en" xml:lang="en">
11476: <div class="titlepage">
11477: <div>
11478: <div>
1.30 wiz 11479: <h3 class="title"><a name="gconf2-data-files" id=
1.35 jmmv 11480: "gconf2-data-files"></a>14.5.8. Packages
1.30 wiz 11481: installing GConf2 data files</h3>
1.1 grant 11482: </div>
11483: </div>
11484: </div>
11485:
1.14 xtraeme 11486: <p>If a package installs <code class=
11487: "filename">.schemas</code> or <code class=
11488: "filename">.entries</code> files, used by GConf2, you
1.1 grant 11489: need to take some extra steps to make sure they get
11490: registered in the database:</p>
11491:
11492: <div class="orderedlist">
11493: <ol type="1">
11494: <li>
1.14 xtraeme 11495: <p>Include <code class=
11496: "filename">../../devel/GConf2/schemas.mk</code>
11497: instead of its <code class=
11498: "filename">buildlink3.mk</code> file. This takes
1.1 grant 11499: care of rebuilding the GConf2 database at
11500: installation and deinstallation time, and tells
11501: the package where to install GConf2 data files
11502: using some standard configure arguments. It also
11503: disallows any access to the database directly
11504: from the package.</p>
11505: </li>
11506:
11507: <li>
11508: <p>Ensure that the package installs its
1.14 xtraeme 11509: <code class="filename">.schemas</code> files
11510: under <code class=
11511: "filename">${PREFIX}/share/gconf/schemas</code>.
11512: If they get installed under <code class=
11513: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 11514: manually patch the package.</p>
11515: </li>
11516:
11517: <li>
11518: <p>Check the PLIST and remove any entries under
11519: the etc/gconf directory, as they will be handled
11520: automatically. See <a href="#faq.conf" title=
1.35 jmmv 11521: "6.14. How do I change the location of configuration files?">
11522: Section 6.14, “How do I change the
11523: location of configuration files?”</a> for
11524: more information.</p>
1.1 grant 11525: </li>
11526:
11527: <li>
1.14 xtraeme 11528: <p>Define the <code class=
11529: "varname">GCONF2_SCHEMAS</code> variable in your
11530: <code class="filename">Makefile</code> with a
11531: list of all <code class=
11532: "filename">.schemas</code> files installed by the
11533: package, if any. Names must not contain any
11534: directories in them.</p>
1.1 grant 11535: </li>
11536:
11537: <li>
1.14 xtraeme 11538: <p>Define the <code class=
11539: "varname">GCONF2_ENTRIES</code> variable in your
11540: <code class="filename">Makefile</code> with a
11541: list of all <code class=
11542: "filename">.entries</code> files installed by the
11543: package, if any. Names must not contain any
11544: directories in them.</p>
1.1 grant 11545: </li>
11546: </ol>
11547: </div>
11548: </div>
11549:
11550: <div class="sect2" lang="en" xml:lang="en">
11551: <div class="titlepage">
11552: <div>
11553: <div>
1.30 wiz 11554: <h3 class="title"><a name=
11555: "scrollkeeper-data-files" id=
1.35 jmmv 11556: "scrollkeeper-data-files"></a>14.5.9. Packages
1.30 wiz 11557: installing scrollkeeper data files</h3>
1.1 grant 11558: </div>
11559: </div>
11560: </div>
11561:
1.14 xtraeme 11562: <p>If a package installs <code class=
11563: "filename">.omf</code> files, used by scrollkeeper, you
11564: need to take some extra steps to make sure they get
11565: registered in the database:</p>
1.1 grant 11566:
11567: <div class="orderedlist">
11568: <ol type="1">
11569: <li>
1.14 xtraeme 11570: <p>Include <code class=
11571: "filename">../../textproc/scrollkeeper/omf.mk</code>
11572: instead of its <code class=
11573: "filename">buildlink3.mk</code> file. This takes
1.1 grant 11574: care of rebuilding the scrollkeeper database at
11575: installation and deinstallation time, and
11576: disallows any access to it directly from the
11577: package.</p>
11578: </li>
11579:
11580: <li>
11581: <p>Check the PLIST and remove any entries under
1.14 xtraeme 11582: the <code class=
11583: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 11584: as they will be handled automatically.</p>
11585: </li>
11586:
11587: <li>
1.14 xtraeme 11588: <p>Remove the <code class=
11589: "filename">share/omf</code> directory from the
11590: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 11591: </li>
11592: </ol>
11593: </div>
11594: </div>
11595:
11596: <div class="sect2" lang="en" xml:lang="en">
11597: <div class="titlepage">
11598: <div>
11599: <div>
1.30 wiz 11600: <h3 class="title"><a name="x11-fonts" id=
1.35 jmmv 11601: "x11-fonts"></a>14.5.10. Packages installing
1.1 grant 11602: X11 fonts</h3>
11603: </div>
11604: </div>
11605: </div>
11606:
11607: <p>If a package installs font files, you will need to
11608: rebuild the fonts database in the directory where they
11609: get installed at installation and deinstallation time.
1.14 xtraeme 11610: This can be automatically done by using <code class=
11611: "filename">mk/fonts.mk</code>, which you need to
11612: include in your <code class=
11613: "filename">Makefile</code>.</p>
1.1 grant 11614:
11615: <p>When the file is included, you can list the
1.14 xtraeme 11616: directories where fonts are installed in the
11617: <code class="varname">FONTS_<em class=
11618: "replaceable"><code>type</code></em>_DIRS</code>
11619: variables, where <em class=
11620: "replaceable"><code>type</code></em> can be one of
11621: “<span class="quote">TTF</span>”,
1.1 grant 11622: “<span class="quote">TYPE1</span>” or
11623: “<span class="quote">X11</span>”. Also make
1.14 xtraeme 11624: sure that the database file <code class=
11625: "filename">fonts.dir</code> is not listed in the
1.1 grant 11626: PLIST.</p>
11627:
11628: <p>Note that you should not create new directories for
11629: fonts; instead use the standard ones to avoid that the
11630: user needs to manually configure his X server to find
11631: them.</p>
11632: </div>
11633:
11634: <div class="sect2" lang="en" xml:lang="en">
11635: <div class="titlepage">
11636: <div>
11637: <div>
1.30 wiz 11638: <h3 class="title"><a name="gtk2-modules" id=
1.35 jmmv 11639: "gtk2-modules"></a>14.5.11. Packages
1.30 wiz 11640: installing GTK2 modules</h3>
1.1 grant 11641: </div>
11642: </div>
11643: </div>
11644:
11645: <p>If a package installs gtk2 immodules or loaders, you
11646: need to take some extra steps to get them registered in
11647: the GTK2 database properly:</p>
11648:
11649: <div class="orderedlist">
11650: <ol type="1">
11651: <li>
1.14 xtraeme 11652: <p>Include <code class=
11653: "filename">../../x11/gtk2/modules.mk</code>
11654: instead of its <code class=
11655: "filename">buildlink3.mk</code> file. This takes
11656: care of rebuilding the database at installation
11657: and deinstallation time.</p>
1.1 grant 11658: </li>
11659:
11660: <li>
1.14 xtraeme 11661: <p>Set <code class=
11662: "varname">GTK2_IMMODULES=YES</code> if your
11663: package installs GTK2 immodules.</p>
1.1 grant 11664: </li>
11665:
11666: <li>
1.14 xtraeme 11667: <p>Set <code class=
11668: "varname">GTK2_LOADERS=YES</code> if your package
11669: installs GTK2 loaders.</p>
1.1 grant 11670: </li>
11671:
11672: <li>
11673: <p>Patch the package to not touch any of the gtk2
11674: databases directly. These are:</p>
11675:
11676: <div class="itemizedlist">
11677: <ul type="disc">
11678: <li>
1.14 xtraeme 11679: <p><code class=
11680: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 11681: </li>
11682:
11683: <li>
1.14 xtraeme 11684: <p><code class=
11685: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 11686: </li>
11687: </ul>
11688: </div>
11689: </li>
11690:
11691: <li>
11692: <p>Check the PLIST and remove any entries under
1.14 xtraeme 11693: the <code class="filename">libdata/gtk-2.0</code>
1.1 grant 11694: directory, as they will be handled
11695: automatically.</p>
11696: </li>
11697: </ol>
11698: </div>
11699: </div>
11700:
11701: <div class="sect2" lang="en" xml:lang="en">
11702: <div class="titlepage">
11703: <div>
11704: <div>
1.30 wiz 11705: <h3 class="title"><a name="sgml-xml-data" id=
1.35 jmmv 11706: "sgml-xml-data"></a>14.5.12. Packages
1.30 wiz 11707: installing SGML or XML data</h3>
1.1 grant 11708: </div>
11709: </div>
11710: </div>
11711:
11712: <p>If a package installs SGML or XML data files that
11713: need to be registered in system-wide catalogs (like
11714: DTDs, sub-catalogs, etc.), you need to take some extra
11715: steps:</p>
11716:
11717: <div class="orderedlist">
11718: <ol type="1">
11719: <li>
1.14 xtraeme 11720: <p>Include <code class=
11721: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
11722: in your <code class="filename">Makefile</code>,
11723: which takes care of registering those files in
1.1 grant 11724: system-wide catalogs at installation and
11725: deinstallation time.</p>
11726: </li>
11727:
11728: <li>
1.14 xtraeme 11729: <p>Set <code class="varname">SGML_CATALOGS</code>
11730: to the full path of any SGML catalogs installed
11731: by the package.</p>
1.1 grant 11732: </li>
11733:
11734: <li>
1.14 xtraeme 11735: <p>Set <code class="varname">XML_CATALOGS</code>
11736: to the full path of any XML catalogs installed by
1.1 grant 11737: the package.</p>
11738: </li>
11739:
11740: <li>
1.14 xtraeme 11741: <p>Set <code class="varname">SGML_ENTRIES</code>
11742: to individual entries to be added to the SGML
1.1 grant 11743: catalog. These come in groups of three strings;
11744: see xmlcatmgr(1) for more information
11745: (specifically, arguments recognized by the 'add'
11746: action). Note that you will normally not use this
11747: variable.</p>
11748: </li>
11749:
11750: <li>
1.14 xtraeme 11751: <p>Set <code class="varname">XML_ENTRIES</code>
11752: to individual entries to be added to the XML
1.1 grant 11753: catalog. These come in groups of three strings;
11754: see xmlcatmgr(1) for more information
11755: (specifically, arguments recognized by the 'add'
11756: action). Note that you will normally not use this
11757: variable.</p>
11758: </li>
11759: </ol>
11760: </div>
11761: </div>
11762:
11763: <div class="sect2" lang="en" xml:lang="en">
11764: <div class="titlepage">
11765: <div>
11766: <div>
1.30 wiz 11767: <h3 class="title"><a name="mime-database" id=
1.35 jmmv 11768: "mime-database"></a>14.5.13. Packages
1.30 wiz 11769: installing extensions to the MIME database</h3>
1.1 grant 11770: </div>
11771: </div>
11772: </div>
11773:
11774: <p>If a package provides extensions to the MIME
1.14 xtraeme 11775: database by installing <code class=
11776: "filename">.xml</code> files inside <code class=
11777: "filename">${PREFIX}/share/mime/packages</code>, you
11778: need to take some extra steps to ensure that the
11779: database is kept consistent with respect to these new
11780: files:</p>
1.1 grant 11781:
11782: <div class="orderedlist">
11783: <ol type="1">
11784: <li>
1.14 xtraeme 11785: <p>Include <code class=
11786: "filename">../../databases/shared-mime-info/mimedb.mk</code>
11787: (avoid using the <code class=
11788: "filename">buildlink3.mk</code> file from this
11789: same directory, which is reserved for inclusion
11790: from other <code class=
11791: "filename">buildlink3.mk</code> files). It takes
11792: care of rebuilding the MIME database at
11793: installation and deinstallation time, and
11794: disallows any access to it directly from the
1.1 grant 11795: package.</p>
11796: </li>
11797:
11798: <li>
11799: <p>Check the PLIST and remove any entries under
1.14 xtraeme 11800: the <code class="filename">share/mime</code>
1.1 grant 11801: directory, <span class=
11802: "emphasis"><em>except</em></span> for files saved
1.14 xtraeme 11803: under <code class=
11804: "filename">share/mime/packages</code>. The former
1.1 grant 11805: are handled automatically by the
11806: update-mime-database program, but the later are
11807: package-dependent and must be removed by the
11808: package that installed them in the first
11809: place.</p>
11810: </li>
11811:
11812: <li>
1.14 xtraeme 11813: <p>Remove any <code class=
11814: "filename">share/mime/*</code> directories from
11815: the PLIST. They will be handled by the
1.1 grant 11816: shared-mime-info package.</p>
11817: </li>
11818: </ol>
11819: </div>
11820: </div>
11821:
11822: <div class="sect2" lang="en" xml:lang="en">
11823: <div class="titlepage">
11824: <div>
11825: <div>
1.30 wiz 11826: <h3 class="title"><a name="intltool" id=
1.35 jmmv 11827: "intltool"></a>14.5.14. Packages using
1.1 grant 11828: intltool</h3>
11829: </div>
11830: </div>
11831: </div>
11832:
11833: <p>If a package uses intltool during its build, include
1.14 xtraeme 11834: the <code class=
11835: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 11836: file, which forces it to use the intltool package
11837: provided by pkgsrc, instead of the one bundled with the
11838: distribution file.</p>
11839:
11840: <p>This tracks intltool's build-time dependencies and
11841: uses the latest available version; this way, the
11842: package benefits of any bug fixes that may have
11843: appeared since it was released.</p>
11844: </div>
1.18 xtraeme 11845:
11846: <div class="sect2" lang="en" xml:lang="en">
11847: <div class="titlepage">
11848: <div>
11849: <div>
1.30 wiz 11850: <h3 class="title"><a name="startup-scripts" id=
1.35 jmmv 11851: "startup-scripts"></a>14.5.15. Packages
1.30 wiz 11852: installing startup scripts</h3>
1.18 xtraeme 11853: </div>
11854: </div>
11855: </div>
11856:
11857: <p>If a package contains a rc.d script, it won't be
11858: copied into the startup directory by default, but you
11859: can enable it, by adding the option <code class=
11860: "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
11861: "filename">/etc/mk.conf</code>. This option will copy
11862: the scripts into <code class=
11863: "filename">/etc/rc.d</code> when a package is
11864: installed, and it will automatically remove the scripts
11865: when the package is deinstalled.</p>
11866: </div>
1.1 grant 11867: </div>
11868:
11869: <div class="sect1" lang="en" xml:lang="en">
11870: <div class="titlepage">
11871: <div>
11872: <div>
11873: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11874: "feedback-to-author" id=
1.35 jmmv 11875: "feedback-to-author"></a>14.6. Feedback to the
1.30 wiz 11876: author</h2>
1.1 grant 11877: </div>
11878: </div>
11879: </div>
11880:
11881: <p>If you have found any bugs in the package you make
11882: available, if you had to do special steps to make it run
11883: under NetBSD or if you enhanced the software in various
11884: other ways, be sure to report these changes back to the
11885: original author of the program! With that kind of
11886: support, the next release of the program can incorporate
11887: these fixes, and people not using the NetBSD packages
11888: system can win from your efforts.</p>
11889:
11890: <p>Support the idea of free software!</p>
11891: </div>
11892: </div>
11893:
11894: <div class="chapter" lang="en" xml:lang="en">
11895: <div class="titlepage">
11896: <div>
11897: <div>
11898: <h2 class="title"><a name="debug" id=
1.35 jmmv 11899: "debug"></a>Chapter 15. Debugging</h2>
1.1 grant 11900: </div>
11901: </div>
11902: </div>
11903:
11904: <p>To check out all the gotchas when building a package,
11905: here are the steps that I do in order to get a package
11906: working. Please note this is basically the same as what was
11907: explained in the previous sections, only with some
11908: debugging aids.</p>
11909:
11910: <div class="itemizedlist">
11911: <ul type="disc">
11912: <li>
1.14 xtraeme 11913: <p>Be sure to set <code class=
11914: "varname">PKG_DEVELOPER=1</code> in <code class=
11915: "filename">/etc/mk.conf</code></p>
1.1 grant 11916: </li>
11917:
11918: <li>
11919: <p>Install <a xmlns=
11920: "http://www.w3.org/TR/xhtml1/transitional" href=
11921: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20 ben 11922: class="pkgname">pkgtools/url2pkg</a>, create a
11923: directory for a new package, change into it, then run
11924: <span><strong class=
11925: "command">url2pkg</strong></span>:</p>
1.1 grant 11926: <pre class="screen">
1.14 xtraeme 11927: <code class="prompt">%</code> <strong class=
11928: "userinput"><code>mkdir /usr/pkgsrc/<em class=
11929: "replaceable"><code>category</code></em>/<em class=
11930: "replaceable"><code>examplepkg</code></em></code></strong>
11931: <code class="prompt">%</code> <strong class=
11932: "userinput"><code>cd /usr/pkgsrc/<em class=
11933: "replaceable"><code>category</code></em>/<em class=
11934: "replaceable"><code>examplepkg</code></em></code></strong>
11935: <code class="prompt">%</code> <strong class=
11936: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 11937: </pre>
11938: </li>
11939:
11940: <li>
1.14 xtraeme 11941: <p>Edit the <code class="filename">Makefile</code> as
1.1 grant 11942: requested.</p>
11943: </li>
11944:
11945: <li>
1.14 xtraeme 11946: <p>Fill in the <code class="filename">DESCR</code>
1.1 grant 11947: file</p>
11948: </li>
11949:
11950: <li>
1.14 xtraeme 11951: <p>Run <span><strong class="command">make
11952: configure</strong></span></p>
1.1 grant 11953: </li>
11954:
11955: <li>
11956: <p>Add any dependencies glimpsed from documentation
1.14 xtraeme 11957: and the configure step to the package's <code class=
11958: "filename">Makefile</code>.</p>
1.1 grant 11959: </li>
11960:
11961: <li>
11962: <p>Make the package compile, doing multiple rounds
11963: of</p>
11964: <pre class="screen">
1.14 xtraeme 11965: <code class="prompt">%</code> <strong class=
11966: "userinput"><code>make</code></strong>
11967: <code class="prompt">%</code> <strong class=
11968: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
11969: <code class="prompt">%</code> <strong class=
11970: "userinput"><code>mkpatches</code></strong>
11971: <code class="prompt">%</code> <strong class=
11972: "userinput"><code>patchdiff</code></strong>
11973: <code class="prompt">%</code> <strong class=
11974: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
11975: <code class="prompt">%</code> <strong class=
11976: "userinput"><code>make mps</code></strong>
11977: <code class="prompt">%</code> <strong class=
11978: "userinput"><code>make clean</code></strong>
1.1 grant 11979: </pre>
11980:
11981: <p>Doing as non-root user will ensure that no files
11982: are modified that shouldn't be, especially during the
1.14 xtraeme 11983: build phase. <span><strong class=
11984: "command">mkpatches</strong></span>,
11985: <span><strong class=
11986: "command">patchdiff</strong></span> and
11987: <span><strong class="command">pkgvi</strong></span>
11988: are from the <a xmlns=
1.1 grant 11989: "http://www.w3.org/TR/xhtml1/transitional" href=
11990: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 11991: class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1 grant 11992: </li>
11993:
11994: <li>
1.14 xtraeme 11995: <p>Look at the <code class=
11996: "filename">Makefile</code>, fix if necessary; see
11997: <a href="#components.Makefile" title=
1.27 rillig 11998: "7.1. Makefile">Section 7.1,
1.14 xtraeme 11999: “<code class=
12000: "filename">Makefile</code>”</a>.</p>
1.1 grant 12001: </li>
12002:
12003: <li>
1.14 xtraeme 12004: <p>Generate a <code class=
12005: "filename">PLIST</code>:</p>
1.1 grant 12006: <pre class="screen">
1.14 xtraeme 12007: <code class="prompt">#</code> <strong class=
12008: "userinput"><code>make install</code></strong>
12009: <code class="prompt">#</code> <strong class=
12010: "userinput"><code>make print-PLIST >PLIST</code></strong>
12011: <code class="prompt">#</code> <strong class=
12012: "userinput"><code>make deinstall</code></strong>
12013: <code class="prompt">#</code> <strong class=
12014: "userinput"><code>make install</code></strong>
12015: <code class="prompt">#</code> <strong class=
12016: "userinput"><code>make deinstall</code></strong>
1.1 grant 12017: </pre>
12018:
1.14 xtraeme 12019: <p>You usually need to be <code class=
12020: "username">root</code> to do this. Look if there are
1.1 grant 12021: any files left:</p>
12022: <pre class="screen">
1.14 xtraeme 12023: <code class="prompt">#</code> <strong class=
12024: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 12025: </pre>
12026:
12027: <p>If this reveals any files that are missing in
1.14 xtraeme 12028: <code class="filename">PLIST</code>, add them.</p>
1.1 grant 12029: </li>
12030:
12031: <li>
1.14 xtraeme 12032: <p>Now that the <code class="filename">PLIST</code>
12033: is OK, install the package again and make a binary
1.1 grant 12034: package:</p>
12035: <pre class="screen">
1.14 xtraeme 12036: <code class="prompt">#</code> <strong class=
12037: "userinput"><code>make reinstall</code></strong>
12038: <code class="prompt">#</code> <strong class=
12039: "userinput"><code>make package</code></strong>
1.1 grant 12040: </pre>
12041: </li>
12042:
12043: <li>
12044: <p>Delete the installed package:</p>
12045: <pre class="screen">
1.14 xtraeme 12046: <code class="prompt">#</code> <strong class=
12047: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 12048: </pre>
12049: </li>
12050:
12051: <li>
1.14 xtraeme 12052: <p>Repeat the above <span><strong class=
12053: "command">make print-PLIST</strong></span> command,
12054: which shouldn't find anything now:</p>
1.1 grant 12055: <pre class="screen">
1.14 xtraeme 12056: <code class="prompt">#</code> <strong class=
12057: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 12058: </pre>
12059: </li>
12060:
12061: <li>
12062: <p>Reinstall the binary package:</p>
12063: <pre class="screen">
1.14 xtraeme 12064: <code class="prompt">#</code> <strong class=
12065: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 12066: </pre>
12067: </li>
12068:
12069: <li>
12070: <p>Play with it. Make sure everything works.</p>
12071: </li>
12072:
12073: <li>
1.14 xtraeme 12074: <p>Run <span><strong class=
12075: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 12076: "http://www.w3.org/TR/xhtml1/transitional" href=
12077: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 12078: class="pkgname">pkgtools/pkglint</a>, and fix the
12079: problems it reports:</p>
1.1 grant 12080: <pre class="screen">
1.14 xtraeme 12081: <code class="prompt">#</code> <strong class=
12082: "userinput"><code>pkglint</code></strong>
1.1 grant 12083: </pre>
12084: </li>
12085:
12086: <li>
12087: <p>Submit (or commit, if you have cvs access); see
12088: <a href="#submit" title=
1.35 jmmv 12089: "Chapter 16. Submitting and Committing">Chapter 16,
1.1 grant 12090: <i>Submitting and Committing</i></a>.</p>
12091: </li>
12092: </ul>
12093: </div>
12094: </div>
12095:
12096: <div class="chapter" lang="en" xml:lang="en">
12097: <div class="titlepage">
12098: <div>
12099: <div>
12100: <h2 class="title"><a name="submit" id=
1.35 jmmv 12101: "submit"></a>Chapter 16. Submitting and
1.1 grant 12102: Committing</h2>
12103: </div>
12104: </div>
12105: </div>
12106:
12107: <div class="toc">
12108: <p><b>Table of Contents</b></p>
12109:
12110: <dl>
1.30 wiz 12111: <dt><span class="sect1"><a href=
1.35 jmmv 12112: "#submitting-your-package">16.1. Submitting your
1.30 wiz 12113: packages</a></span></dt>
1.1 grant 12114:
1.30 wiz 12115: <dt><span class="sect1"><a href=
1.35 jmmv 12116: "#committing-importing">16.2. Committing: Importing a
1.30 wiz 12117: package into CVS</a></span></dt>
1.1 grant 12118:
1.30 wiz 12119: <dt><span class="sect1"><a href=
1.35 jmmv 12120: "#updating-package">16.3. Updating a package to a newer
1.30 wiz 12121: version</a></span></dt>
1.1 grant 12122:
1.35 jmmv 12123: <dt><span class="sect1"><a href="#moving-package">16.4.
1.2 hubertf 12124: Moving a package in pkgsrc</a></span></dt>
1.1 grant 12125: </dl>
12126: </div>
12127:
12128: <div class="sect1" lang="en" xml:lang="en">
12129: <div class="titlepage">
12130: <div>
12131: <div>
12132: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12133: "submitting-your-package" id=
1.35 jmmv 12134: "submitting-your-package"></a>16.1. Submitting
1.30 wiz 12135: your packages</h2>
1.1 grant 12136: </div>
12137: </div>
12138: </div>
12139:
12140: <p>You have to separate between binary and
12141: “<span class="quote">normal</span>” (source)
12142: packages here:</p>
12143:
12144: <div class="itemizedlist">
12145: <ul type="disc">
12146: <li>
12147: <p>precompiled binary packages</p>
12148:
12149: <p>Our policy is that we accept binaries only from
12150: pkgsrc developers to guarantee that the packages
12151: don't contain any trojan horses etc. This is not to
1.13 hubertf 12152: annoy anyone but rather to protect our users!
1.1 grant 12153: You're still free to put up your home-made binary
1.13 hubertf 12154: packages and tell the world where to get them.
12155: NetBSD developers doing bulk builds and wanting to
12156: upload them please see <a href="#bulk-upload"
12157: title="5.3.8. Uploading results of a bulk build">
12158: Section 5.3.8, “Uploading results of a
12159: bulk build”</a>.</p>
1.1 grant 12160: </li>
12161:
12162: <li>
12163: <p>packages</p>
12164:
12165: <p>First, check that your package is complete,
12166: compiles and runs well; see <a href="#debug" title=
1.35 jmmv 12167: "Chapter 15. Debugging">Chapter 15,
1.1 grant 12168: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 12169: Next, generate an uuencoded gzipped <a href=
12170: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
12171: <span class="citerefentry"><span class=
12172: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 12173: preferably with all files in a single directory.
1.14 xtraeme 12174: Finally, <span><strong class=
12175: "command">send-pr</strong></span> with category
1.1 grant 12176: “<span class="quote">pkg</span>”, a
12177: synopsis which includes the package name and
12178: version number, a short description of your package
12179: (contents of the COMMENT variable or DESCR file are
12180: OK) and attach the archive to your PR.</p>
12181:
12182: <p>If you want to submit several packages, please
12183: send a separate PR for each one, it's easier for us
12184: to track things that way.</p>
12185:
12186: <p>Alternatively, you can also import new packages
12187: into pkgsrc-wip (“<span class="quote">pkgsrc
12188: work-in-progress</span>”); see the homepage
12189: at <a href="http://pkgsrc-wip.sourceforge.net/"
12190: target=
12191: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
12192: details.</p>
12193: </li>
12194: </ul>
12195: </div>
12196: </div>
12197:
12198: <div class="sect1" lang="en" xml:lang="en">
12199: <div class="titlepage">
12200: <div>
12201: <div>
12202: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12203: "committing-importing" id=
1.35 jmmv 12204: "committing-importing"></a>16.2. Committing:
1.30 wiz 12205: Importing a package into CVS</h2>
1.1 grant 12206: </div>
12207: </div>
12208: </div>
12209:
12210: <p>This section is only of interest for pkgsrc developers
12211: with write access to the pkgsrc repository. Please
12212: remember that cvs imports files relative to the current
12213: working directory, and that the pathname that you give
1.14 xtraeme 12214: the <span><strong class="command">cvs
12215: import</strong></span> command is so that it knows where
12216: to place the files in the repository. Newly created
12217: packages should be imported with a vendor tag of
12218: “<span class="quote">TNF</span>” and a
12219: release tag of “<span class=
12220: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 12221: <pre class="programlisting">
12222: % cd .../pkgsrc/category/pkgname
12223: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
12224: </pre>
12225:
12226: <p>Remember to move the directory from which you imported
12227: out of the way, or cvs will complain the next time you
12228: “<span class="quote">cvs update</span>” your
12229: source tree. Also don't forget to add the new package to
1.14 xtraeme 12230: the category's <code class=
12231: "filename">Makefile</code>.</p>
1.1 grant 12232:
12233: <p>The commit message of the initial import should
1.14 xtraeme 12234: include part of the <code class="filename">DESCR</code>
12235: file, so people reading the mailing lists know what the
12236: package is/does.</p>
1.1 grant 12237:
12238: <p>Please note all package updates/additions in
1.14 xtraeme 12239: <code class="filename">pkgsrc/doc/CHANGES</code>. It's
12240: very important to keep this file up to date and
12241: conforming to the existing format, because it will be
12242: used by scripts to automatically update pages on <a href=
1.1 grant 12243: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
12244: and other sites. Additionally, check the pkgsrc/doc/TODO
12245: file and remove the entry for the package you updated, in
12246: case it was mentioned there.</p>
12247:
12248: <p>For new packages, “<span class="quote">cvs
12249: import</span>” is preferred to “<span class=
12250: "quote">cvs add</span>” because the former gets
12251: everything with a single command, and provides a
12252: consistent tag.</p>
12253: </div>
12254:
12255: <div class="sect1" lang="en" xml:lang="en">
12256: <div class="titlepage">
12257: <div>
12258: <div>
12259: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12260: "updating-package" id=
1.35 jmmv 12261: "updating-package"></a>16.3. Updating a
1.30 wiz 12262: package to a newer version</h2>
1.1 grant 12263: </div>
12264: </div>
12265: </div>
12266:
12267: <p>Please always put a concise, appropriate and relevant
12268: summary of the changes between old and new versions into
12269: the commit log when updating a package. There are various
12270: reasons for this:</p>
12271:
12272: <div class="itemizedlist">
12273: <ul type="disc">
12274: <li>
12275: <p>A URL is volatile, and can change over time. It
12276: may go away completely or its information may be
12277: overwritten by newer information.</p>
12278: </li>
12279:
12280: <li>
12281: <p>Having the change information between old and
12282: new versions in our CVS repository is very useful
12283: for people who use either cvs or anoncvs.</p>
12284: </li>
12285:
12286: <li>
12287: <p>Having the change information between old and
12288: new versions in our CVS repository is very useful
12289: for people who read the pkgsrc-changes mailing
12290: list, so that they can make tactical decisions
12291: about when to upgrade the package.</p>
12292: </li>
12293: </ul>
12294: </div>
12295:
1.18 xtraeme 12296: <p>Please also recognize that, just because a new version
1.1 grant 12297: of a package has been released, it should not
12298: automatically be upgraded in the CVS repository. We
12299: prefer to be conservative in the packages that are
12300: included in pkgsrc - development or beta packages are not
12301: really the best thing for most places in which pkgsrc is
12302: used. Please use your judgement about what should go into
12303: pkgsrc, and bear in mind that stability is to be
12304: preferred above new and possibly untested features.</p>
12305: </div>
12306:
12307: <div class="sect1" lang="en" xml:lang="en">
12308: <div class="titlepage">
12309: <div>
12310: <div>
12311: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12312: "moving-package" id=
1.35 jmmv 12313: "moving-package"></a>16.4. Moving a package in
1.30 wiz 12314: pkgsrc</h2>
1.1 grant 12315: </div>
12316: </div>
12317: </div>
12318:
12319: <div class="orderedlist">
12320: <ol type="1">
12321: <li>
12322: <p>Make a copy of the directory somewhere else.</p>
12323: </li>
12324:
12325: <li>
12326: <p>Remove all CVS dirs.</p>
12327:
12328: <p>Alternatively to the first two steps you can
12329: also do:</p>
12330: <pre class="screen">
1.14 xtraeme 12331: <code class="prompt">%</code> <strong class=
12332: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 12333: </pre>
12334:
12335: <p>and use that for further work.</p>
12336: </li>
12337:
12338: <li>
1.14 xtraeme 12339: <p>Fix <code class="varname">CATEGORIES</code> and
12340: any <code class="varname">DEPENDS</code> paths that
12341: just did “<span class=
1.1 grant 12342: "quote">../package</span>” instead of
12343: “<span class=
12344: "quote">../../category/package</span>”.</p>
12345: </li>
12346:
12347: <li>
1.14 xtraeme 12348: <p><span><strong class="command">cvs
12349: import</strong></span> the modified package in the
12350: new place.</p>
1.1 grant 12351: </li>
12352:
12353: <li>
12354: <p>Check if any package depends on it:</p>
12355: <pre class="screen">
1.14 xtraeme 12356: <code class="prompt">%</code> <strong class=
12357: "userinput"><code>cd /usr/pkgsrc</code></strong>
12358: <code class="prompt">%</code> <strong class=
12359: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 12360: </pre>
12361: </li>
12362:
12363: <li>
12364: <p>Fix paths in packages from step 5 to point to
12365: new location.</p>
12366: </li>
12367:
12368: <li>
1.14 xtraeme 12369: <p><span><strong class="command">cvs rm
12370: (-f)</strong></span> the package at the old
12371: location.</p>
1.1 grant 12372: </li>
12373:
12374: <li>
1.14 xtraeme 12375: <p>Remove from <code class=
12376: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 12377: </li>
12378:
12379: <li>
1.14 xtraeme 12380: <p>Add to <code class=
12381: "filename">newcategory/Makefile</code>.</p>
1.1 grant 12382: </li>
12383:
12384: <li>
12385: <p>Commit the changed and removed files:</p>
12386: <pre class="screen">
1.14 xtraeme 12387: <code class="prompt">%</code> <strong class=
12388: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 12389: </pre>
12390:
12391: <p>(and any packages from step 5, of course).</p>
12392: </li>
12393: </ol>
12394: </div>
12395: </div>
12396: </div>
12397: </div>
12398:
12399: <div class="appendix" lang="en" xml:lang="en">
12400: <div class="titlepage">
12401: <div>
12402: <div>
12403: <h2 class="title"><a name="examples" id=
12404: "examples"></a>Appendix A. A simple example
12405: package: bison</h2>
12406: </div>
12407: </div>
12408: </div>
12409:
12410: <div class="toc">
12411: <p><b>Table of Contents</b></p>
12412:
12413: <dl>
1.30 wiz 12414: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 12415: files</a></span></dt>
12416:
12417: <dd>
12418: <dl>
1.30 wiz 12419: <dt><span class="sect2"><a href=
12420: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 12421:
1.30 wiz 12422: <dt><span class="sect2"><a href=
12423: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 12424:
1.30 wiz 12425: <dt><span class="sect2"><a href=
12426: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 12427:
1.30 wiz 12428: <dt><span class="sect2"><a href=
12429: "#checking-package-with-pkglint">A.1.4. Checking a
12430: package with <span><strong class=
1.14 xtraeme 12431: "command">pkglint</strong></span></a></span></dt>
1.1 grant 12432: </dl>
12433: </dd>
12434:
1.30 wiz 12435: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
12436: Steps for building, installing, packaging</a></span></dt>
1.1 grant 12437: </dl>
12438: </div>
12439:
12440: <p>We checked to find a piece of software that wasn't in the
12441: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 12442: would want to have <span><strong class=
12443: "command">bison</strong></span> when Berkeley
12444: <span><strong class="command">yacc</strong></span> is already
12445: present in the tree is beyond us, but it's useful for the
12446: purposes of this exercise.</p>
1.1 grant 12447:
12448: <div class="sect1" lang="en" xml:lang="en">
12449: <div class="titlepage">
12450: <div>
12451: <div>
12452: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12453: "example-files" id=
12454: "example-files"></a>A.1. files</h2>
1.1 grant 12455: </div>
12456: </div>
12457: </div>
12458:
12459: <div class="sect2" lang="en" xml:lang="en">
12460: <div class="titlepage">
12461: <div>
12462: <div>
1.30 wiz 12463: <h3 class="title"><a name="example-Makefile" id=
12464: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 12465: </div>
12466: </div>
12467: </div>
12468: <pre class="programlisting">
1.17 sketch 12469: # $NetBSD$
1.1 grant 12470: #
12471:
12472: DISTNAME= bison-1.25
12473: CATEGORIES= devel
12474: MASTER_SITES= ${MASTER_SITE_GNU}
12475:
12476: MAINTAINER= thorpej@NetBSD.org
12477: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
12478: COMMENT= GNU yacc clone
12479:
12480: GNU_CONFIGURE= yes
12481: INFO_FILES= bison.info
12482:
12483: .include "../../mk/bsd.pkg.mk"
12484: </pre>
12485: </div>
12486:
12487: <div class="sect2" lang="en" xml:lang="en">
12488: <div class="titlepage">
12489: <div>
12490: <div>
1.30 wiz 12491: <h3 class="title"><a name="example-descr" id=
12492: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 12493: </div>
12494: </div>
12495: </div>
12496: <pre class="programlisting">
12497: GNU version of yacc. Can make re-entrant parsers, and numerous other
12498: improvements. Why you would want this when Berkeley <a href=
12499: "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
12500: of the NetBSD source tree is beyond me.
12501: </pre>
12502: </div>
12503:
12504: <div class="sect2" lang="en" xml:lang="en">
12505: <div class="titlepage">
12506: <div>
12507: <div>
1.30 wiz 12508: <h3 class="title"><a name="example-plist" id=
12509: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 12510: </div>
12511: </div>
12512: </div>
12513: <pre class="programlisting">
1.17 sketch 12514: @comment $NetBSD$
1.1 grant 12515: bin/bison
12516: man/man1/bison.1.gz
12517: share/bison.simple
12518: share/bison.hairy
12519: </pre>
12520: </div>
12521:
12522: <div class="sect2" lang="en" xml:lang="en">
12523: <div class="titlepage">
12524: <div>
12525: <div>
1.30 wiz 12526: <h3 class="title"><a name=
12527: "checking-package-with-pkglint" id=
12528: "checking-package-with-pkglint"></a>A.1.4. Checking
12529: a package with <span><strong class=
1.14 xtraeme 12530: "command">pkglint</strong></span></h3>
1.1 grant 12531: </div>
12532: </div>
12533: </div>
12534:
12535: <p>The NetBSD package system comes with <a xmlns=
12536: "http://www.w3.org/TR/xhtml1/transitional" href=
12537: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 12538: class="pkgname">pkgtools/pkglint</a> which helps to check
12539: the contents of these files. After installation it is
12540: quite easy to use, just change to the directory of the
12541: package you wish to examine and execute
12542: <span><strong class=
12543: "command">pkglint</strong></span>:</p>
1.1 grant 12544: <pre class="screen">
1.14 xtraeme 12545: <code class="prompt">$</code> <strong class=
12546: "userinput"><code>pkglint</code></strong>
1.1 grant 12547: looks fine.
12548: </pre>
12549:
12550: <p>Depending on the supplied command line arguments (see
12551: pkglint(1)) more verbose checks will be performed. Use
1.14 xtraeme 12552: e.g. <span><strong class="command">pkglint
12553: -v</strong></span> for a very verbose check.</p>
1.1 grant 12554: </div>
12555: </div>
12556:
12557: <div class="sect1" lang="en" xml:lang="en">
12558: <div class="titlepage">
12559: <div>
12560: <div>
12561: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12562: "steps-for-b-i-p" id=
12563: "steps-for-b-i-p"></a>A.2. Steps for building,
12564: installing, packaging</h2>
1.1 grant 12565: </div>
12566: </div>
12567: </div>
12568:
12569: <p>Create the directory where the package lives, plus any
12570: auxiliary directories:</p>
12571: <pre class="screen">
1.14 xtraeme 12572: <code class="prompt">#</code> <strong class=
12573: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
12574: <code class="prompt">#</code> <strong class=
12575: "userinput"><code>mkdir bison</code></strong>
12576: <code class="prompt">#</code> <strong class=
12577: "userinput"><code>cd bison</code></strong>
12578: <code class="prompt">#</code> <strong class=
12579: "userinput"><code>mkdir patches</code></strong>
1.1 grant 12580: </pre>
12581:
1.14 xtraeme 12582: <p>Create <code class="filename">Makefile</code>,
12583: <code class="filename">DESCR</code> and <code class=
12584: "filename">PLIST</code> (see <a href="#components" title=
1.27 rillig 12585: "Chapter 7. Package components - files, directories and contents">
12586: Chapter 7, <i>Package components - files, directories and
1.1 grant 12587: contents</i></a>) then continue with fetching the
12588: distfile:</p>
12589: <pre class="screen">
1.14 xtraeme 12590: <code class="prompt">#</code> <strong class=
12591: "userinput"><code>make fetch</code></strong>
1.1 grant 12592: >> bison-1.25.tar.gz doesn't seem to exist on this system.
12593: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
12594: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
12595: ftp: Error retrieving file: 500 Internal error
12596:
12597: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
12598: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
12599: ftp: Error retrieving file: 500 Internal error
12600:
12601: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
12602: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
12603: Successfully retrieved file.
12604: </pre>
12605:
1.14 xtraeme 12606: <p>Generate the checksum of the distfile into <code class=
12607: "filename">distinfo</code>:</p>
1.1 grant 12608: <pre class="screen">
1.14 xtraeme 12609: <code class="prompt">#</code> <strong class=
12610: "userinput"><code>make makesum</code></strong>
1.1 grant 12611: </pre>
12612:
12613: <p>Now compile:</p>
12614: <pre class="screen">
1.14 xtraeme 12615: <code class="prompt">#</code> <strong class=
12616: "userinput"><code>make</code></strong>
1.1 grant 12617: >> Checksum OK for bison-1.25.tar.gz.
12618: ===> Extracting for bison-1.25
12619: ===> Patching for bison-1.25
12620: ===> Ignoring empty patch directory
12621: ===> Configuring for bison-1.25
12622: creating cache ./config.cache
12623: checking for gcc... cc
12624: checking whether we are using GNU C... yes
12625: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
12626: checking how to run the C preprocessor... cc -E
12627: checking for minix/config.h... no
12628: checking for POSIXized ISC... no
12629: checking whether cross-compiling... no
12630: checking for ANSI C header files... yes
12631: checking for string.h... yes
12632: checking for stdlib.h... yes
12633: checking for memory.h... yes
12634: checking for working const... yes
12635: checking for working alloca.h... no
12636: checking for alloca... yes
12637: checking for strerror... yes
12638: updating cache ./config.cache
12639: creating ./config.status
12640: creating Makefile
12641: ===> Building for bison-1.25
12642: 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
12643: 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
12644: 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
12645: 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
12646: 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
12647: 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
12648: 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
12649: 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
12650: 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
12651: 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
12652: 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
12653: 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
12654: 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
12655: 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
12656: 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
12657: 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
12658: 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
12659: 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
12660: 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
12661: 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
12662: 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
12663: 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
12664: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
12665: rm -f bison.s1
12666: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
12667: </pre>
12668:
12669: <p>Everything seems OK, so install the files:</p>
12670: <pre class="screen">
1.14 xtraeme 12671: <code class="prompt">#</code> <strong class=
12672: "userinput"><code>make install</code></strong>
1.1 grant 12673: >> Checksum OK for bison-1.25.tar.gz.
12674: ===> Installing for bison-1.25
12675: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
12676: rm -f /usr/pkg/bin/bison
12677: cd /usr/pkg/share; rm -f bison.simple bison.hairy
12678: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
12679: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
12680: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
12681: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
12682: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
12683: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
12684: ===> Registering installation for bison-1.25
12685: </pre>
12686:
12687: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 12688: remove it with <span><strong class="command">pkg_delete
12689: bison</strong></span>. Should you decide that you want a
12690: binary package, do this now:</p>
1.1 grant 12691: <pre class="screen">
1.14 xtraeme 12692: <code class="prompt">#</code> <strong class=
12693: "userinput"><code>make package</code></strong>
1.1 grant 12694: >> Checksum OK for bison-1.25.tar.gz.
12695: ===> Building package for bison-1.25
12696: Creating package bison-1.25.tgz
12697: Registering depends:.
12698: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
12699: </pre>
12700:
12701: <p>Now that you don't need the source and object files any
12702: more, clean up:</p>
12703: <pre class="screen">
1.14 xtraeme 12704: <code class="prompt">#</code> <strong class=
12705: "userinput"><code>make clean</code></strong>
1.1 grant 12706: ===> Cleaning for bison-1.25
12707: </pre>
12708: </div>
12709: </div>
12710:
12711: <div class="appendix" lang="en" xml:lang="en">
12712: <div class="titlepage">
12713: <div>
12714: <div>
12715: <h2 class="title"><a name="logs" id=
12716: "logs"></a>Appendix B. Build logs</h2>
12717: </div>
12718: </div>
12719: </div>
12720:
12721: <div class="toc">
12722: <p><b>Table of Contents</b></p>
12723:
12724: <dl>
12725: <dt><span class="sect1"><a href="#logs.building">B.1.
12726: Building figlet</a></span></dt>
12727:
12728: <dt><span class="sect1"><a href="#logs.package">B.2.
12729: Packaging figlet</a></span></dt>
12730: </dl>
12731: </div>
12732:
12733: <div class="sect1" lang="en" xml:lang="en">
12734: <div class="titlepage">
12735: <div>
12736: <div>
12737: <h2 class="title" style="clear: both"><a name=
12738: "logs.building" id=
12739: "logs.building"></a>B.1. Building figlet</h2>
12740: </div>
12741: </div>
12742: </div>
12743: <pre class="screen">
1.14 xtraeme 12744: <code class="prompt">#</code> <strong class=
12745: "userinput"><code>make</code></strong>
1.1 grant 12746: ===> Checking for vulnerabilities in figlet-2.2.1nb2
12747: => figlet221.tar.gz doesn't seem to exist on this system.
12748: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
12749: => [172219 bytes]
12750: Connected to ftp.plig.net.
12751: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
12752: 331 Guest login ok, send your complete e-mail address as password.
12753: 230-You are user #5 of 500 simultaneous users allowed.
12754: 230-
12755: 230- ___ _ _ _
12756: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
12757: 230- | _| _| . |_| . | | | . |_| . | _| . |
12758: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
12759: 230- |_| |_| |___| |___|
12760: 230-
12761: 230-** Welcome to ftp.plig.org **
12762: 230-
12763: 230-Please note that all transfers from this FTP site are logged. If you
12764: 230-do not like this, please disconnect now.
12765: 230-
12766: 230-This arhive is available via
12767: 230-
12768: 230-HTTP: http://ftp.plig.org/
12769: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
12770: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
12771: 230-
12772: 230-Please email comments, bug reports and requests for packages to be
12773: 230-mirrored to ftp-admin@plig.org.
12774: 230-
12775: 230-
12776: 230 Logged in anonymously.
12777: Remote system type is UNIX.
12778: Using binary mode to transfer files.
12779: 200 Type okay.
12780: 250 "/pub" is new cwd.
12781: 250-"/pub/figlet" is new cwd.
12782: 250-
12783: 250-Welcome to the figlet archive at ftp.figlet.org
12784: 250-
12785: 250- ftp://ftp.figlet.org/pub/figlet/
12786: 250-
12787: 250-The official FIGlet web page is:
12788: 250- http://www.figlet.org/
12789: 250-
12790: 250-If you have questions, please mailto:info@figlet.org. If you want to
12791: 250-contribute a font or something else, you can email us.
12792: 250
12793: 250 "/pub/figlet/program" is new cwd.
12794: 250 "/pub/figlet/program/unix" is new cwd.
12795: local: figlet221.tar.gz remote: figlet221.tar.gz
12796: 502 Unimplemented command.
12797: 227 Entering Passive Mode (195,40,6,41,246,104)
12798: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
12799: 38% |************** | 65800 64.16 KB/s 00:01 ETA
12800: 226 Transfer completed.
12801: 172219 bytes received in 00:02 (75.99 KB/s)
12802: 221 Goodbye.
12803: => Checksum OK for figlet221.tar.gz.
12804: ===> Extracting for figlet-2.2.1nb2
12805: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
12806: ===> Patching for figlet-2.2.1nb2
12807: ===> Applying pkgsrc patches for figlet-2.2.1nb2
12808: ===> Overriding tools for figlet-2.2.1nb2
12809: ===> Creating toolchain wrappers for figlet-2.2.1nb2
12810: ===> Configuring for figlet-2.2.1nb2
12811: ===> Building for figlet-2.2.1nb2
12812: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
12813: chmod a+x figlet
12814: gcc -O2 -o chkfont chkfont.c
12815: => Unwrapping files-to-be-installed.
1.14 xtraeme 12816: <code class="prompt">#</code>
12817: <code class="prompt">#</code> <strong class=
12818: "userinput"><code>make install</code></strong>
1.1 grant 12819: ===> Checking for vulnerabilities in figlet-2.2.1nb2
12820: ===> Installing for figlet-2.2.1nb2
12821: install -d -o root -g wheel -m 755 /usr/pkg/bin
12822: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
12823: mkdir -p /usr/pkg/share/figlet
12824: cp figlet /usr/pkg/bin
12825: cp chkfont /usr/pkg/bin
12826: chmod 555 figlist showfigfonts
12827: cp figlist /usr/pkg/bin
12828: cp showfigfonts /usr/pkg/bin
12829: cp fonts/*.flf /usr/pkg/share/figlet
12830: cp fonts/*.flc /usr/pkg/share/figlet
12831: cp figlet.6 /usr/pkg/man/man6
12832: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 12833: <code class="prompt">#</code>
1.1 grant 12834: </pre>
12835: </div>
12836:
12837: <div class="sect1" lang="en" xml:lang="en">
12838: <div class="titlepage">
12839: <div>
12840: <div>
12841: <h2 class="title" style="clear: both"><a name=
12842: "logs.package" id=
12843: "logs.package"></a>B.2. Packaging figlet</h2>
12844: </div>
12845: </div>
12846: </div>
12847: <pre class="screen">
1.14 xtraeme 12848: <code class="prompt">#</code> <strong class=
12849: "userinput"><code>make package</code></strong>
1.1 grant 12850: ===> Checking for vulnerabilities in figlet-2.2.1nb2
12851: ===> Packaging figlet-2.2.1nb2
12852: ===> Building binary package for figlet-2.2.1nb2
12853: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
12854: Using SrcDir value of /usr/pkg
12855: Registering depends:.
1.14 xtraeme 12856: <code class="prompt">#</code>
1.1 grant 12857: </pre>
12858: </div>
12859: </div>
12860:
12861: <div class="appendix" lang="en" xml:lang="en">
12862: <div class="titlepage">
12863: <div>
12864: <div>
12865: <h2 class="title"><a name="ftp-layout" id=
12866: "ftp-layout"></a>Appendix C. Layout of the
12867: FTP server's package archive</h2>
12868: </div>
12869: </div>
12870: </div>
12871:
12872: <p>Layout for precompiled binary packages on
12873: ftp.NetBSD.org:</p>
12874: <pre class="programlisting">
12875: /pub/NetBSD/packages/
12876: distfiles/
12877:
12878: # Unpacked pkgsrc trees
12879: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
12880: pkgsrc-2003Q4 -> N/A
12881: pkgsrc-2004Q1/pkgsrc
12882:
12883: # pkgsrc archives
12884: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
12885: pkgsrc-2003Q4.tar.gz -> N/A
12886: pkgsrc-2004Q1.tar.gz -> N/A
12887:
12888: # Per pkgsrc-release/OS-release/arch package archives
12889: pkgsrc-2003Q4/
12890: NetBSD-1.6.2/
12891: i386/
12892: All/
12893: archivers/
12894: foo -> ../All/foo
12895: ...
12896: pkgsrc-2004Q1/
12897: NetBSD-1.6.2/
12898: i386/
12899: All/
12900: ...
12901: NetBSD-2.0/
12902: i386/
12903: All/
12904: ...
12905: SunOS-5.9/
12906: sparc/
12907: All/
12908: ...
12909: x86/
12910: All/
12911: ...
12912:
12913: # Per os-release package archive convenience links
12914: NetBSD-1.6.2 -> 1.6.2
12915: 1.6.2/
12916: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
12917: m68k/
12918: All/
12919: archivers/
12920: foo -> ../All/foo
12921: ...
12922: amiga -> m68k
12923: atari -> m68k
12924: ...
12925:
12926: 2.0 -> NetBSD-2.0 # backward compat, historic
12927: NetBSD-2.0/
12928: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
12929: SunOS-5.9/
12930: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
12931: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
12932:
12933: </pre>
12934:
12935: <p>To create:</p>
12936:
12937: <div class="orderedlist">
12938: <ol type="1">
12939: <li>
12940: <p>Run bulk build, see <a href="#bulkbuild" title=
12941: "5.3. Doing a bulk build of all packages">Section
12942: 5.3, “Doing a bulk build of all
12943: packages”</a></p>
12944: </li>
12945:
12946: <li>
12947: <p>Upload /usr/pkgsrc/packages to</p>
12948: <pre class="programlisting">
12949: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13 hubertf 12950: pkgsrc-2004Q4/\ # pkgsrc-branch
1.1 grant 12951: `uname -s`-`uname -r`/ # OS & version
12952: `uname -p` # architecture
12953:
12954: </pre>
12955: </li>
12956:
12957: <li>
1.14 xtraeme 12958: <p>If necessary, create a symlink <span><strong class=
12959: "command">ln -s `uname -m` `uname -p`</strong></span>
12960: (amiga -> m68k, ...)</p>
1.1 grant 12961: </li>
12962: </ol>
12963: </div>
12964: </div>
1.2 hubertf 12965:
12966: <div class="appendix" lang="en" xml:lang="en">
12967: <div class="titlepage">
12968: <div>
12969: <div>
12970: <h2 class="title"><a name="editing" id=
12971: "editing"></a>Appendix D. Editing guidelines
12972: for the pkgsrc guide</h2>
12973: </div>
12974: </div>
12975: </div>
12976:
12977: <div class="toc">
12978: <p><b>Table of Contents</b></p>
12979:
12980: <dl>
1.30 wiz 12981: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 12982: Targets</a></span></dt>
12983:
1.30 wiz 12984: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 12985: Procedure</a></span></dt>
12986: </dl>
12987: </div>
12988:
12989: <p>This section contains information on editing the pkgsrc
12990: guide itself.</p>
12991:
12992: <div class="sect1" lang="en" xml:lang="en">
12993: <div class="titlepage">
12994: <div>
12995: <div>
12996: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12997: "targets" id="targets"></a>D.1. Targets</h2>
1.2 hubertf 12998: </div>
12999: </div>
13000: </div>
13001:
1.14 xtraeme 13002: <p>The pkgsrc guide's source code is stored in <code class=
13003: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 13004: are created from it:</p>
13005:
13006: <div class="itemizedlist">
13007: <ul type="disc">
13008: <li>
1.14 xtraeme 13009: <p><code class=
1.23 wiz 13010: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 13011: </li>
13012:
13013: <li>
1.14 xtraeme 13014: <p><code class=
13015: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 13016: </li>
13017:
13018: <li>
1.14 xtraeme 13019: <p><code class=
13020: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 13021: the documentation on the NetBSD website will be built
13022: from pkgsrc and kept up to date on the web server
13023: itself. This means you <span class=
13024: "emphasis"><em>must</em></span> make sure that your
13025: changes haven't broken the build!</p>
13026: </li>
1.6 hubertf 13027:
13028: <li>
1.14 xtraeme 13029: <p><code class=
13030: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 13031: PDF version of the pkgsrc guide.</p>
13032: </li>
13033:
13034: <li>
1.14 xtraeme 13035: <p><code class=
13036: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 13037: PostScript version of the pkgsrc guide.</p>
13038: </li>
1.2 hubertf 13039: </ul>
13040: </div>
13041: </div>
13042:
13043: <div class="sect1" lang="en" xml:lang="en">
13044: <div class="titlepage">
13045: <div>
13046: <div>
13047: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13048: "procedure" id=
13049: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 13050: </div>
13051: </div>
13052: </div>
13053:
13054: <p>The procedure to edit the pkgsrc guide is:</p>
13055:
13056: <div class="itemizedlist">
13057: <ul type="disc">
13058: <li>
1.6 hubertf 13059: <p>Make sure you have the packages needed to
13060: re-generate the pkgsrc guide (and other XML-based
13061: NetBSD documentation) installed. These are
1.11 ben 13062: “<span class="quote">netbsd-doc</span>”
1.6 hubertf 13063: for creating the ASCII- and HTML-version, and
13064: “<span class=
1.11 ben 13065: "quote">netbsd-doc-print</span>”for the
1.6 hubertf 13066: PostScript- and PDF version. You will need both
13067: packages installed, to make sure documentation is
13068: consistent across all formats. The packages can be
1.14 xtraeme 13069: found in <code class=
13070: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
13071: <code class=
13072: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 13073: </li>
13074:
13075: <li>
1.14 xtraeme 13076: <p>Edit the XML file(s) in <code class=
13077: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 13078: </li>
13079:
13080: <li>
1.14 xtraeme 13081: <p>Run <span><strong class="command">make extract
13082: && make do-lint</strong></span> in
13083: <code class="filename">pkgsrc/doc/guide</code> to
13084: check the XML syntax, and fix it if needed.</p>
1.4 hubertf 13085: </li>
13086:
13087: <li>
1.14 xtraeme 13088: <p>Run <span><strong class=
13089: "command">make</strong></span> in <code class=
13090: "filename">pkgsrc/doc/guide</code> to build the HTML
13091: and ASCII version.</p>
1.2 hubertf 13092: </li>
13093:
13094: <li>
1.14 xtraeme 13095: <p>If all is well, run <span><strong class=
13096: "command">make install-doc</strong></span> to put the
13097: generated files into <code class=
13098: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 13099: </li>
13100:
13101: <li>
1.14 xtraeme 13102: <p><span><strong class="command">cvs commit
13103: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 13104: </li>
13105:
13106: <li>
1.14 xtraeme 13107: <p><span><strong class="command">cvs commit -m
13108: re-generate
13109: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 13110: </li>
1.4 hubertf 13111:
13112: <li>
13113: <p>Until the webserver on www.NetBSD.org is really
13114: updated automatically to pick up changes to the
1.14 xtraeme 13115: pkgsrc guide automatically, also run
1.18 xtraeme 13116: <span><strong class="command">make install-htdocs
1.14 xtraeme 13117: HTDOCSDIR=../../../htdocs</strong></span> (or
13118: similar, adjust <code class=
13119: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 13120: </li>
13121:
13122: <li>
1.14 xtraeme 13123: <p><span><strong class="command">cvs commit
13124: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 13125: </li>
1.2 hubertf 13126: </ul>
13127: </div>
13128: </div>
13129: </div>
1.1 grant 13130: </div>
13131: </body>
13132: </html>
CVSweb <webmaster@jp.NetBSD.org>