Annotation of pkgsrc/doc/pkgsrc.html, revision 1.33
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.30 wiz 69: <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.7
70: 2005/05/24 12:39:00 wiz 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.1 grant 353: Configuration files handling and
354: placement</a></span></dt>
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.25 rillig 543: <dt><span class="chapter"><a href="#options">11.
1.1 grant 544: Options handling</a></span></dt>
545:
546: <dd>
547: <dl>
1.30 wiz 548: <dt><span class="sect1"><a href=
549: "#global-default-options">11.1. Global default
550: options</a></span></dt>
1.1 grant 551:
1.30 wiz 552: <dt><span class="sect1"><a href=
553: "#converting-to-options">11.2. Converting packages
554: to use <code class=
1.14 xtraeme 555: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 556: </dl>
557: </dd>
558:
1.25 rillig 559: <dt><span class="chapter"><a href="#build">12. The
1.1 grant 560: build process</a></span></dt>
561:
562: <dd>
563: <dl>
564: <dt><span class="sect1"><a href=
1.25 rillig 565: "#build.prefix">12.1. Program
1.1 grant 566: location</a></span></dt>
567:
1.30 wiz 568: <dt><span class="sect1"><a href=
569: "#main-targets">12.2. Main targets</a></span></dt>
1.1 grant 570:
571: <dt><span class="sect1"><a href=
1.25 rillig 572: "#build.helpful-targets">12.3. Other helpful
1.1 grant 573: targets</a></span></dt>
574: </dl>
575: </dd>
576:
1.25 rillig 577: <dt><span class="chapter"><a href="#fixes">13. Notes on
1.1 grant 578: fixes for packages</a></span></dt>
579:
580: <dd>
581: <dl>
1.30 wiz 582: <dt><span class="sect1"><a href=
583: "#general-operation">13.1. General
584: operation</a></span></dt>
1.1 grant 585:
586: <dd>
587: <dl>
588: <dt><span class="sect2"><a href=
1.30 wiz 589: "#pulling-vars-from-etc-mk.conf">13.1.1. How to
590: pull in variables from
591: /etc/mk.conf</a></span></dt>
1.1 grant 592:
593: <dt><span class="sect2"><a href=
1.31 wiz 594: "#where-to-install-documentation">13.1.2. Where
595: to install documentation</a></span></dt>
596:
597: <dt><span class="sect2"><a href=
598: "#restricted-packages">13.1.3. Restricted
1.1 grant 599: packages</a></span></dt>
600:
601: <dt><span class="sect2"><a href=
1.31 wiz 602: "#dependencies">13.1.4. Handling
1.1 grant 603: dependencies</a></span></dt>
604:
605: <dt><span class="sect2"><a href=
1.31 wiz 606: "#conflicts">13.1.5. Handling conflicts with
1.1 grant 607: other packages</a></span></dt>
608:
609: <dt><span class="sect2"><a href=
1.31 wiz 610: "#not-building-packages">13.1.6. Packages that
1.30 wiz 611: cannot or should not be built</a></span></dt>
1.1 grant 612:
613: <dt><span class="sect2"><a href=
1.31 wiz 614: "#undeletable-packages">13.1.7. Packages which
1.30 wiz 615: should not be deleted, once
616: installed</a></span></dt>
1.1 grant 617:
618: <dt><span class="sect2"><a href=
1.31 wiz 619: "#security-handling">13.1.8. Handling packages
1.1 grant 620: with security problems</a></span></dt>
621:
622: <dt><span class="sect2"><a href=
1.31 wiz 623: "#compiler-bugs">13.1.9. How to handle compiler
1.1 grant 624: bugs</a></span></dt>
625:
626: <dt><span class="sect2"><a href=
1.31 wiz 627: "#bumping-pkgrevision">13.1.10. How to handle
1.30 wiz 628: incrementing versions when fixing an existing
1.1 grant 629: package</a></span></dt>
630:
631: <dt><span class="sect2"><a href=
1.31 wiz 632: "#portability-of-packages">13.1.11. Portability
1.30 wiz 633: of packages</a></span></dt>
1.1 grant 634: </dl>
635: </dd>
636:
1.30 wiz 637: <dt><span class="sect1"><a href=
638: "#downloading-issues">13.2. Possible downloading
639: issues</a></span></dt>
1.1 grant 640:
641: <dd>
642: <dl>
643: <dt><span class="sect2"><a href=
1.30 wiz 644: "#no-plain-download">13.2.1. Packages whose
645: distfiles aren't available for plain
1.1 grant 646: downloading</a></span></dt>
647:
648: <dt><span class="sect2"><a href=
1.30 wiz 649: "#modified-distfiles-same-name">13.2.2. How to
650: handle modified distfiles with the 'old'
651: name</a></span></dt>
1.1 grant 652: </dl>
653: </dd>
654:
1.30 wiz 655: <dt><span class="sect1"><a href=
656: "#configuration-gotchas">13.3. Configuration
657: gotchas</a></span></dt>
1.1 grant 658:
659: <dd>
660: <dl>
661: <dt><span class="sect2"><a href=
1.25 rillig 662: "#fixes.libtool">13.3.1. Shared libraries -
1.1 grant 663: libtool</a></span></dt>
664:
665: <dt><span class="sect2"><a href=
1.30 wiz 666: "#using-libtool">13.3.2. Using libtool on GNU
1.1 grant 667: packages that already support
668: libtool</a></span></dt>
669:
670: <dt><span class="sect2"><a href=
1.30 wiz 671: "#autoconf-automake">13.3.3. GNU
1.1 grant 672: Autoconf/Automake</a></span></dt>
673: </dl>
674: </dd>
675:
1.30 wiz 676: <dt><span class="sect1"><a href=
677: "#building-considerations">13.4. Building
678: considerations</a></span></dt>
1.1 grant 679:
680: <dd>
681: <dl>
682: <dt><span class="sect2"><a href=
1.30 wiz 683: "#cpp-defines">13.4.1. CPP
1.1 grant 684: defines</a></span></dt>
685: </dl>
686: </dd>
687:
1.30 wiz 688: <dt><span class="sect1"><a href=
689: "#package-specific-actions">13.5. Package specific
690: actions</a></span></dt>
1.1 grant 691:
692: <dd>
693: <dl>
694: <dt><span class="sect2"><a href=
1.30 wiz 695: "#package-configuration-files">13.5.1. Package
696: configuration files</a></span></dt>
1.1 grant 697:
698: <dt><span class="sect2"><a href=
1.30 wiz 699: "#user-interaction">13.5.2. User
1.2 hubertf 700: interaction</a></span></dt>
1.1 grant 701:
702: <dt><span class="sect2"><a href=
1.30 wiz 703: "#handling-licenses">13.5.3. Handling
1.1 grant 704: licenses</a></span></dt>
705:
706: <dt><span class="sect2"><a href=
1.30 wiz 707: "#creating-accounts">13.5.4. Creating an
708: account from a package</a></span></dt>
1.1 grant 709:
710: <dt><span class="sect2"><a href=
1.30 wiz 711: "#installing-score-files">13.5.5. Installing
712: score files</a></span></dt>
1.1 grant 713:
714: <dt><span class="sect2"><a href=
1.30 wiz 715: "#login-shells">13.5.6. Packages providing
716: login shells</a></span></dt>
1.1 grant 717:
718: <dt><span class="sect2"><a href=
1.30 wiz 719: "#perl-scripts">13.5.7. Packages containing
720: perl scripts</a></span></dt>
1.1 grant 721:
722: <dt><span class="sect2"><a href=
1.30 wiz 723: "#hardcoded-paths">13.5.8. Packages with
724: hardcoded paths to other
725: interpreters</a></span></dt>
1.1 grant 726:
727: <dt><span class="sect2"><a href=
1.30 wiz 728: "#perl-modules">13.5.9. Packages installing
729: perl modules</a></span></dt>
1.1 grant 730:
731: <dt><span class="sect2"><a href=
1.25 rillig 732: "#faq.info-files">13.5.10. Packages installing
1.1 grant 733: info files</a></span></dt>
734:
735: <dt><span class="sect2"><a href=
1.30 wiz 736: "#gconf2-data-files">13.5.11. Packages
737: installing GConf2 data files</a></span></dt>
1.1 grant 738:
739: <dt><span class="sect2"><a href=
1.30 wiz 740: "#scrollkeeper-data-files">13.5.12. Packages
741: installing scrollkeeper data
742: files</a></span></dt>
1.1 grant 743:
744: <dt><span class="sect2"><a href=
1.30 wiz 745: "#x11-fonts">13.5.13. Packages installing X11
1.1 grant 746: fonts</a></span></dt>
747:
748: <dt><span class="sect2"><a href=
1.30 wiz 749: "#gtk2-modules">13.5.14. Packages installing
750: GTK2 modules</a></span></dt>
1.1 grant 751:
752: <dt><span class="sect2"><a href=
1.30 wiz 753: "#sgml-xml-data">13.5.15. Packages installing
754: SGML or XML data</a></span></dt>
1.1 grant 755:
756: <dt><span class="sect2"><a href=
1.30 wiz 757: "#mime-database">13.5.16. Packages installing
1.1 grant 758: extensions to the MIME database</a></span></dt>
759:
760: <dt><span class="sect2"><a href=
1.30 wiz 761: "#intltool">13.5.17. Packages using
1.1 grant 762: intltool</a></span></dt>
1.18 xtraeme 763:
764: <dt><span class="sect2"><a href=
1.30 wiz 765: "#startup-scripts">13.5.18. Packages installing
1.18 xtraeme 766: startup scripts</a></span></dt>
1.1 grant 767: </dl>
768: </dd>
769:
1.30 wiz 770: <dt><span class="sect1"><a href=
771: "#feedback-to-author">13.6. Feedback to the
772: author</a></span></dt>
1.1 grant 773: </dl>
774: </dd>
775:
1.25 rillig 776: <dt><span class="chapter"><a href="#debug">14.
1.1 grant 777: Debugging</a></span></dt>
778:
1.25 rillig 779: <dt><span class="chapter"><a href="#submit">15.
1.1 grant 780: Submitting and Committing</a></span></dt>
781:
782: <dd>
783: <dl>
1.30 wiz 784: <dt><span class="sect1"><a href=
785: "#submitting-your-package">15.1. Submitting your
786: packages</a></span></dt>
1.1 grant 787:
1.30 wiz 788: <dt><span class="sect1"><a href=
789: "#committing-importing">15.2. Committing: Importing
790: a package into CVS</a></span></dt>
1.1 grant 791:
1.30 wiz 792: <dt><span class="sect1"><a href=
793: "#updating-package">15.3. Updating a package to a
794: newer version</a></span></dt>
1.1 grant 795:
1.30 wiz 796: <dt><span class="sect1"><a href=
797: "#moving-package">15.4. Moving a package in
798: pkgsrc</a></span></dt>
1.1 grant 799: </dl>
800: </dd>
801: </dl>
802: </dd>
803:
804: <dt><span class="appendix"><a href="#examples">A. A simple
805: example package: bison</a></span></dt>
806:
807: <dd>
808: <dl>
1.30 wiz 809: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 810: files</a></span></dt>
811:
812: <dd>
813: <dl>
1.30 wiz 814: <dt><span class="sect2"><a href=
815: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 816:
1.30 wiz 817: <dt><span class="sect2"><a href=
818: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 819:
1.30 wiz 820: <dt><span class="sect2"><a href=
821: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 822:
1.30 wiz 823: <dt><span class="sect2"><a href=
824: "#checking-package-with-pkglint">A.1.4. Checking a
825: package with <span><strong class=
1.14 xtraeme 826: "command">pkglint</strong></span></a></span></dt>
1.1 grant 827: </dl>
828: </dd>
829:
1.30 wiz 830: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
831: Steps for building, installing,
832: packaging</a></span></dt>
1.1 grant 833: </dl>
834: </dd>
835:
836: <dt><span class="appendix"><a href="#logs">B. Build
837: logs</a></span></dt>
838:
839: <dd>
840: <dl>
841: <dt><span class="sect1"><a href="#logs.building">B.1.
842: Building figlet</a></span></dt>
843:
844: <dt><span class="sect1"><a href="#logs.package">B.2.
845: Packaging figlet</a></span></dt>
846: </dl>
847: </dd>
848:
849: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
850: of the FTP server's package archive</a></span></dt>
1.2 hubertf 851:
852: <dt><span class="appendix"><a href="#editing">D. Editing
853: guidelines for the pkgsrc guide</a></span></dt>
854:
855: <dd>
856: <dl>
1.30 wiz 857: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 858: Targets</a></span></dt>
859:
1.30 wiz 860: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 861: Procedure</a></span></dt>
862: </dl>
863: </dd>
1.1 grant 864: </dl>
865: </div>
866:
867: <div class="chapter" lang="en" xml:lang="en">
868: <div class="titlepage">
869: <div>
870: <div>
871: <h2 class="title"><a name="introduction" id=
872: "introduction"></a>Chapter 1. Introduction</h2>
873: </div>
874: </div>
875: </div>
876:
877: <div class="toc">
878: <p><b>Table of Contents</b></p>
879:
880: <dl>
1.30 wiz 881: <dt><span class="sect1"><a href=
882: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 883:
884: <dt><span class="sect1"><a href="#overview">1.2.
885: Overview</a></span></dt>
886:
887: <dt><span class="sect1"><a href="#terminology">1.3.
888: Terminology</a></span></dt>
889:
890: <dt><span class="sect1"><a href="#typography">1.4.
891: Typography</a></span></dt>
892: </dl>
893: </div>
894:
895: <div class="sect1" lang="en" xml:lang="en">
896: <div class="titlepage">
897: <div>
898: <div>
899: <h2 class="title" style="clear: both"><a name=
1.30 wiz 900: "introduction-section" id=
901: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 902: </div>
903: </div>
904: </div>
905:
906: <p>There is a lot of software freely available for Unix
907: based systems, which usually runs on NetBSD and other
908: Unix-flavoured systems, too, sometimes with some
909: modifications. The NetBSD Packages Collection (pkgsrc)
910: incorporates any such changes necessary to make that
911: software run, and makes the installation (and
912: de-installation) of the software package easy by means of a
913: single command.</p>
914:
915: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 916: the <span><strong class="command">pkg_*</strong></span>
917: tools so that installation and de-installation, printing of
918: an inventory of all installed packages and retrieval of
919: one-line comments or more verbose descriptions are all
920: simple.</p>
1.1 grant 921:
922: <p>pkgsrc currently contains several thousand packages,
923: including:</p>
924:
925: <div class="itemizedlist">
926: <ul type="disc">
927: <li>
928: <p><a xmlns=
929: "http://www.w3.org/TR/xhtml1/transitional" href=
930: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.20 ben 931: class="pkgname">www/apache</a> - The Apache web
932: server</p>
1.1 grant 933: </li>
934:
935: <li>
936: <p><a xmlns=
937: "http://www.w3.org/TR/xhtml1/transitional" href=
938: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 939: class="pkgname">www/mozilla</a> - The Mozilla web
940: browser</p>
1.1 grant 941: </li>
942:
943: <li>
944: <p><a xmlns=
945: "http://www.w3.org/TR/xhtml1/transitional" href=
946: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.20 ben 947: class="pkgname">meta-pkgs/gnome</a> - The GNOME
948: Desktop Environment</p>
1.1 grant 949: </li>
950:
951: <li>
952: <p><a xmlns=
953: "http://www.w3.org/TR/xhtml1/transitional" href=
954: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.20 ben 955: class="pkgname">meta-pkgs/kde3</a> - The K Desktop
956: Environment</p>
1.1 grant 957: </li>
958: </ul>
959: </div>
960:
961: <p>...just to name a few.</p>
962:
963: <p>pkgsrc has built-in support for handling varying
964: dependencies, such as pthreads and X11, and extended
965: features such as IPv6 support on a range of platforms.</p>
966:
967: <p>pkgsrc was derived from FreeBSD's ports system, and
968: initially developed for NetBSD only. Since then, pkgsrc has
969: grown a lot, and now supports the following platforms:</p>
970:
971: <div class="itemizedlist">
972: <ul type="disc">
973: <li>
974: <p><a href="http://developer.apple.com/darwin/"
975: target="_top">Darwin</a> (<a href=
976: "http://www.apple.com/macosx/" target="_top">Mac OS
977: X</a>)</p>
978: </li>
979:
980: <li>
1.3 hubertf 981: <p><a href="http://www.DragonFlyBSD.org/" target=
982: "_top">DragonFlyBSD</a></p>
983: </li>
984:
985: <li>
1.1 grant 986: <p><a href="http://www.FreeBSD.org/" target=
987: "_top">FreeBSD</a></p>
988: </li>
989:
990: <li>
1.3 hubertf 991: <p>Microsoft Windows, via <a href=
992: "http://www.microsoft.com/windows/sfu/" target=
993: "_top">Interix</a></p>
1.1 grant 994: </li>
995:
996: <li>
997: <p><a href="http://www.sgi.com/software/irix6.5/"
998: target="_top">IRIX</a></p>
999: </li>
1000:
1001: <li>
1002: <p><a href="http://www.linux.org/" target=
1003: "_top">Linux</a></p>
1004: </li>
1005:
1006: <li>
1007: <p><a href="http://www.NetBSD.org/" target=
1008: "_top">NetBSD</a> (of course)</p>
1009: </li>
1010:
1011: <li>
1.17 sketch 1012: <p><a href="http://h30097.www3.hp.com/" target=
1013: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1014: </li>
1015:
1016: <li>
1.1 grant 1017: <p><a href="http://www.openbsd.org/" target=
1018: "_top">OpenBSD</a></p>
1019: </li>
1020:
1021: <li>
1022: <p><a href="http://www.sun.com/solaris/" target=
1023: "_top">Solaris</a></p>
1024: </li>
1025: </ul>
1026: </div>
1027: </div>
1028:
1029: <div class="sect1" lang="en" xml:lang="en">
1030: <div class="titlepage">
1031: <div>
1032: <div>
1033: <h2 class="title" style="clear: both"><a name=
1034: "overview" id="overview"></a>1.2. Overview</h2>
1035: </div>
1036: </div>
1037: </div>
1038:
1039: <p>This document is divided into two parts. The first,
1040: <a href="#users-guide" title=
1.2 hubertf 1041: "Part I. The pkgsrc user's guide">The pkgsrc
1042: user's guide</a>, describes how one can use one of the
1043: packages in the Package Collection, either by installing a
1044: precompiled binary package, or by building one's own copy
1045: using the NetBSD package system. The second part, <a href=
1.1 grant 1046: "#developers-guide" title=
1.2 hubertf 1047: "Part II. The pkgsrc developer's guide">The
1048: pkgsrc developer's guide</a>, explains how to prepare a
1049: package so it can be easily built by other NetBSD users
1050: without knowing about the package's building details.</p>
1.1 grant 1051:
1052: <p>This document is available in various formats:</p>
1053:
1054: <div class="itemizedlist">
1055: <ul type="disc">
1056: <li>
1057: <p><a href="index.html" target="_top">HTML</a></p>
1058: </li>
1059:
1060: <li>
1061: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1062: </li>
1063:
1064: <li>
1065: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1066: </li>
1067:
1068: <li>
1069: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1070: </li>
1071: </ul>
1072: </div>
1073: </div>
1074:
1075: <div class="sect1" lang="en" xml:lang="en">
1076: <div class="titlepage">
1077: <div>
1078: <div>
1079: <h2 class="title" style="clear: both"><a name=
1080: "terminology" id=
1081: "terminology"></a>1.3. Terminology</h2>
1082: </div>
1083: </div>
1084: </div>
1085:
1086: <p>There has been a lot of talk about “<span class=
1087: "quote">ports</span>”, “<span class=
1088: "quote">packages</span>”, etc. so far. Here is a
1089: description of all the terminology used within this
1090: document.</p>
1091:
1092: <div class="variablelist">
1093: <dl>
1094: <dt><span class="term">Package</span></dt>
1095:
1096: <dd>
1097: <p>A set of files and building instructions that
1098: describe what's necessary to build a certain piece of
1099: software using pkgsrc. Packages are traditionally
1.14 xtraeme 1100: stored under <code class=
1101: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1102: </dd>
1103:
1104: <dt><span class="term">The NetBSD package
1105: system</span></dt>
1106:
1107: <dd>
1108: <p>This is the former name of “<span class=
1109: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1110: NetBSD operating system and can be bootstrapped to
1111: run on non-NetBSD operating systems as well. It
1112: handles building (compiling), installing, and
1113: removing of packages.</p>
1.1 grant 1114: </dd>
1115:
1116: <dt><span class="term">Distfile</span></dt>
1117:
1118: <dd>
1119: <p>This term describes the file or files that are
1120: provided by the author of the piece of software to
1121: distribute his work. All the changes necessary to
1122: build on NetBSD are reflected in the corresponding
1123: package. Usually the distfile is in the form of a
1124: compressed tar-archive, but other types are possible,
1.14 xtraeme 1125: too. Distfiles are usually stored below <code class=
1126: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1127: </dd>
1128:
1129: <dt><span class="term">Port</span></dt>
1130:
1131: <dd>
1132: <p>This is the term used by FreeBSD and OpenBSD
1133: people for what we call a package. In NetBSD
1134: terminology, “<span class=
1135: "quote">port</span>” refers to a different
1136: architecture.</p>
1137: </dd>
1138:
1139: <dt><span class="term">Precompiled/binary
1140: package</span></dt>
1141:
1142: <dd>
1143: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1144: distfile and stuffed together in a single
1145: <code class="filename">.tgz</code> file so it can be
1146: installed on machines of the same machine
1147: architecture without the need to recompile. Packages
1148: are usually generated in <code class=
1149: "filename">/usr/pkgsrc/packages</code>; there is also
1150: an archive on <a href=
1.1 grant 1151: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1152: "_top">ftp.NetBSD.org</a>.</p>
1153:
1154: <p>Sometimes, this is referred to by the term
1155: “<span class="quote">package</span>” too,
1156: especially in the context of precompiled
1157: packages.</p>
1158: </dd>
1159:
1160: <dt><span class="term">Program</span></dt>
1161:
1162: <dd>
1163: <p>The piece of software to be installed which will
1164: be constructed from all the files in the Distfile by
1165: the actions defined in the corresponding package.</p>
1166: </dd>
1167: </dl>
1168: </div>
1169: </div>
1170:
1171: <div class="sect1" lang="en" xml:lang="en">
1172: <div class="titlepage">
1173: <div>
1174: <div>
1175: <h2 class="title" style="clear: both"><a name=
1176: "typography" id=
1177: "typography"></a>1.4. Typography</h2>
1178: </div>
1179: </div>
1180: </div>
1181:
1182: <p>When giving examples for commands, shell prompts are
1183: used to show if the command should/can be issued as root,
1184: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1185: privileges are sufficient. We use a <code class=
1186: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1187: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1188: assuming they use the C-shell or tcsh.</p>
1.1 grant 1189: </div>
1190: </div>
1191:
1192: <div class="part" lang="en" xml:lang="en">
1193: <div class="titlepage">
1194: <div>
1195: <div>
1196: <h1 class="title"><a name="users-guide" id=
1.2 hubertf 1197: "users-guide"></a>The pkgsrc user's guide</h1>
1.1 grant 1198: </div>
1199: </div>
1200: </div>
1201:
1202: <div class="toc">
1203: <p><b>Table of Contents</b></p>
1204:
1205: <dl>
1206: <dt><span class="chapter"><a href="#getting">2. Where to
1207: get pkgsrc</a></span></dt>
1208:
1209: <dd>
1210: <dl>
1.30 wiz 1211: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1212: As tar file</a></span></dt>
1.1 grant 1213:
1.30 wiz 1214: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1215: SUP</a></span></dt>
1216:
1.30 wiz 1217: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1218: CVS</a></span></dt>
1219: </dl>
1220: </dd>
1221:
1222: <dt><span class="chapter"><a href="#platforms">3. Using
1223: pkgsrc on systems other than NetBSD</a></span></dt>
1224:
1225: <dd>
1226: <dl>
1.30 wiz 1227: <dt><span class="sect1"><a href=
1228: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1229: pkgsrc</a></span></dt>
1.1 grant 1230:
1.30 wiz 1231: <dt><span class="sect1"><a href=
1232: "#platform-specific-notes">3.2. Platform specific
1233: notes</a></span></dt>
1.1 grant 1234:
1235: <dd>
1236: <dl>
1.30 wiz 1237: <dt><span class="sect2"><a href="#darwin">3.2.1.
1238: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1239:
1.30 wiz 1240: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1241: FreeBSD</a></span></dt>
1.22 tv 1242:
1.30 wiz 1243: <dt><span class="sect2"><a href="#interix">3.2.3.
1244: Interix</a></span></dt>
1.1 grant 1245:
1.30 wiz 1246: <dt><span class="sect2"><a href="#irix">3.2.4.
1247: IRIX</a></span></dt>
1.1 grant 1248:
1.30 wiz 1249: <dt><span class="sect2"><a href="#linux">3.2.5.
1250: Linux</a></span></dt>
1.1 grant 1251:
1.30 wiz 1252: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1253: OpenBSD</a></span></dt>
1.1 grant 1254:
1.30 wiz 1255: <dt><span class="sect2"><a href="#solaris">3.2.7.
1256: Solaris</a></span></dt>
1.1 grant 1257: </dl>
1258: </dd>
1259: </dl>
1260: </dd>
1261:
1262: <dt><span class="chapter"><a href="#using">4. Using
1263: pkgsrc</a></span></dt>
1264:
1265: <dd>
1266: <dl>
1267: <dt><span class="sect1"><a href=
1268: "#getting-started">4.1. Working with binary
1269: packages</a></span></dt>
1270:
1271: <dd>
1272: <dl>
1273: <dt><span class="sect2"><a href=
1.30 wiz 1274: "#where-to-get-binary-packages">4.1.1. Where to
1275: get binary packages</a></span></dt>
1.1 grant 1276:
1277: <dt><span class="sect2"><a href=
1.30 wiz 1278: "#how-to-use-binary-packages">4.1.2. How to use
1279: binary packages</a></span></dt>
1.1 grant 1280:
1281: <dt><span class="sect2"><a href=
1.30 wiz 1282: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1283: warning</a></span></dt>
1284: </dl>
1285: </dd>
1286:
1.30 wiz 1287: <dt><span class="sect1"><a href=
1288: "#building-packages-from-source">4.2. Building
1289: packages from source</a></span></dt>
1.1 grant 1290:
1291: <dd>
1292: <dl>
1293: <dt><span class="sect2"><a href=
1.30 wiz 1294: "#requirements">4.2.1.
1295: Requirements</a></span></dt>
1.1 grant 1296:
1297: <dt><span class="sect2"><a href=
1.30 wiz 1298: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1299: distfiles</a></span></dt>
1300:
1301: <dt><span class="sect2"><a href=
1.30 wiz 1302: "#how-to-build-and-install">4.2.3. How to build
1303: and install</a></span></dt>
1.1 grant 1304:
1305: <dt><span class="sect2"><a href=
1.30 wiz 1306: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1307: compiler</a></span></dt>
1308: </dl>
1309: </dd>
1310: </dl>
1311: </dd>
1312:
1313: <dt><span class="chapter"><a href="#binary">5. Creating
1314: binary packages</a></span></dt>
1315:
1316: <dd>
1317: <dl>
1.30 wiz 1318: <dt><span class="sect1"><a href=
1319: "#building-a-single-binary-package">5.1. Building a
1320: single binary package</a></span></dt>
1.1 grant 1321:
1.30 wiz 1322: <dt><span class="sect1"><a href=
1323: "#settings-for-creationg-of-binary-packages">5.2.
1.1 grant 1324: Settings for creation of binary
1325: packages</a></span></dt>
1326:
1327: <dt><span class="sect1"><a href="#bulkbuild">5.3.
1328: Doing a bulk build of all packages</a></span></dt>
1329:
1330: <dd>
1331: <dl>
1332: <dt><span class="sect2"><a href=
1333: "#binary.configuration">5.3.1.
1334: Configuration</a></span></dt>
1335:
1336: <dt><span class="sect2"><a href=
1.30 wiz 1337: "#other-environmental-considerations">5.3.2.
1338: Other environmental
1.1 grant 1339: considerations</a></span></dt>
1340:
1341: <dt><span class="sect2"><a href=
1.30 wiz 1342: "#operation">5.3.3. Operation</a></span></dt>
1.1 grant 1343:
1344: <dt><span class="sect2"><a href=
1.30 wiz 1345: "#what-it-does">5.3.4. What it
1346: does</a></span></dt>
1.1 grant 1347:
1348: <dt><span class="sect2"><a href=
1.30 wiz 1349: "#disk-space-requirements">5.3.5. Disk space
1.1 grant 1350: requirements</a></span></dt>
1351:
1352: <dt><span class="sect2"><a href=
1.30 wiz 1353: "#setting-up-a-sandbox">5.3.6. Setting up a
1354: sandbox for chroot'ed builds</a></span></dt>
1.1 grant 1355:
1356: <dt><span class="sect2"><a href=
1.30 wiz 1357: "#building-a-partial-set">5.3.7. Building a
1358: partial set of packages</a></span></dt>
1.13 hubertf 1359:
1360: <dt><span class="sect2"><a href=
1361: "#bulk-upload">5.3.8. Uploading results of a bulk
1362: build</a></span></dt>
1.1 grant 1363: </dl>
1364: </dd>
1365:
1.30 wiz 1366: <dt><span class="sect1"><a href=
1367: "#creating-cdroms">5.4. Creating a multiple CD-ROM
1368: packages collection</a></span></dt>
1.1 grant 1369:
1370: <dd>
1371: <dl>
1372: <dt><span class="sect2"><a href=
1.30 wiz 1373: "#cdpack-example">5.4.1. Example of
1.1 grant 1374: cdpack</a></span></dt>
1375: </dl>
1376: </dd>
1377: </dl>
1378: </dd>
1379:
1380: <dt><span class="chapter"><a href="#faq">6. Frequently
1381: Asked Questions</a></span></dt>
1382:
1383: <dd>
1384: <dl>
1.30 wiz 1385: <dt><span class="sect1"><a href=
1386: "#mailing-list-pointers">6.1. Are there any mailing
1387: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1388:
1.30 wiz 1389: <dt><span class="sect1"><a href="#pkgviews-docs">6.2.
1.1 grant 1390: Where's the pkgviews documentation?</a></span></dt>
1391:
1.5 hubertf 1392: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 1393: Utilities for package management
1394: (pkgtools)</a></span></dt>
1395:
1.30 wiz 1396: <dt><span class="sect1"><a href=
1397: "#non-root-pkgsrc">6.4. How to use pkgsrc as
1398: non-root</a></span></dt>
1.1 grant 1399:
1.30 wiz 1400: <dt><span class="sect1"><a href=
1401: "#resume-transfers">6.5. How to resume transfers when
1402: fetching distfiles?</a></span></dt>
1.14 xtraeme 1403:
1.30 wiz 1404: <dt><span class="sect1"><a href=
1405: "#XFree86-from-pkgsrc">6.6. How can I install/use
1406: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1407:
1.30 wiz 1408: <dt><span class="sect1"><a href=
1409: "#x.org-from-pkgsrc">6.7. How can I install/use X.org
1410: from pkgsrc?</a></span></dt>
1.1 grant 1411:
1.30 wiz 1412: <dt><span class="sect1"><a href=
1413: "#fetch-behind-firewall">6.8. How to fetch files from
1414: behind a firewall</a></span></dt>
1.1 grant 1415:
1.30 wiz 1416: <dt><span class="sect1"><a href="#passive-ftp">6.9.
1417: How do I tell <span><strong class="command">make
1.14 xtraeme 1418: fetch</strong></span> to do passive
1.1 grant 1419: FTP?</a></span></dt>
1420:
1.30 wiz 1421: <dt><span class="sect1"><a href=
1422: "#fetching-all-distfiles">6.10. How to fetch all
1423: distfiles at once</a></span></dt>
1.1 grant 1424:
1.30 wiz 1425: <dt><span class="sect1"><a href=
1426: "#tmac.andoc-missing">6.11. What does
1427: “<span class="quote">Don't know how to make
1428: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1429: mean?</a></span></dt>
1.13 hubertf 1430:
1.30 wiz 1431: <dt><span class="sect1"><a href=
1432: "#bsd.own.mk-missing">6.12. What does
1433: “<span class="quote">Could not find
1.14 xtraeme 1434: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1435:
1.30 wiz 1436: <dt><span class="sect1"><a href=
1437: "#using-sudo-with-pkgsrc">6.13. Using 'sudo' with
1438: pkgsrc</a></span></dt>
1.1 grant 1439:
1.14 xtraeme 1440: <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1 grant 1441: Configuration files handling and
1442: placement</a></span></dt>
1443:
1444: <dt><span class="sect1"><a href=
1.14 xtraeme 1445: "#audit-packages">6.15. Automated security
1.1 grant 1446: checks</a></span></dt>
1447: </dl>
1448: </dd>
1449: </dl>
1450: </div>
1451:
1452: <div class="chapter" lang="en" xml:lang="en">
1453: <div class="titlepage">
1454: <div>
1455: <div>
1456: <h2 class="title"><a name="getting" id=
1457: "getting"></a>Chapter 2. Where to get
1458: pkgsrc</h2>
1459: </div>
1460: </div>
1461: </div>
1462:
1463: <div class="toc">
1464: <p><b>Table of Contents</b></p>
1465:
1466: <dl>
1.30 wiz 1467: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1468: tar file</a></span></dt>
1469:
1.30 wiz 1470: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1471: SUP</a></span></dt>
1472:
1.30 wiz 1473: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1474: CVS</a></span></dt>
1475: </dl>
1476: </div>
1477:
1478: <p>There are three ways to get pkgsrc. Either as a tar
1479: file, via SUP, or via CVS. All three ways are described
1480: here.</p>
1481:
1482: <div class="sect1" lang="en" xml:lang="en">
1483: <div class="titlepage">
1484: <div>
1485: <div>
1486: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1487: "as-tar-file" id="as-tar-file"></a>2.1. As tar
1.1 grant 1488: file</h2>
1489: </div>
1490: </div>
1491: </div>
1492:
1493: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1494: file from <a href=
1.11 ben 1495: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1496: target="_top">ftp.NetBSD.org</a> and unpack it into
1497: <code class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1498: </div>
1499:
1500: <div class="sect1" lang="en" xml:lang="en">
1501: <div class="titlepage">
1502: <div>
1503: <div>
1504: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1505: "via-sup" id="via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1506: </div>
1507: </div>
1508: </div>
1509:
1510: <p>As an alternative to the tar file, you can get pkgsrc
1511: via the Software Update Protocol, SUP. To do so, make
1512: sure your supfile has a line</p>
1513: <pre class="programlisting">
1514: release=pkgsrc
1515: </pre>
1516:
1.14 xtraeme 1517: <p>in it, see the examples in <code class=
1518: "filename">/usr/share/examples/supfiles</code>, and that
1519: the <code class="filename">/usr/pkgsrc</code> directory
1520: exists. Then, simply run <span><strong class=
1521: "command">sup -v <em class=
1522: "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1523: </div>
1524:
1525: <div class="sect1" lang="en" xml:lang="en">
1526: <div class="titlepage">
1527: <div>
1528: <div>
1529: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1530: "via-cvs" id="via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1531: </div>
1532: </div>
1533: </div>
1534:
1535: <p>To get pkgsrc via CVS, make sure you have
1536: “<span class="quote">cvs</span>” installed.
1.27 rillig 1537: To do an initial (full) checkout of pkgsrc, do the
1538: following steps:</p>
1.1 grant 1539: <pre class="screen">
1.14 xtraeme 1540: <code class="prompt">%</code> <strong class=
1541: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1542: <code class="prompt">%</code> <strong class=
1543: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1544: <code class="prompt">%</code> <strong class=
1545: "userinput"><code>cd /usr</code></strong>
1546: <code class="prompt">%</code> <strong class=
1547: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1548: </pre>
1549:
1550: <p>This will create the <code class=
1551: "filename">pkgsrc</code> directory in your <code class=
1552: "filename">/usr</code>, and all the package source will
1553: be stored under <code class=
1554: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1555: initial checkout, make sure you have <code class=
1556: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1557: <pre class="screen">
1.14 xtraeme 1558: <code class="prompt">%</code> <strong class=
1559: "userinput"><code>cd /usr/pkgsrc</code></strong>
1560: <code class="prompt">%</code> <strong class=
1561: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1562: </pre>
1563:
1564: <p>Please also note that it is possible to have multiple
1565: copies of the pkgsrc hierarchy in use at any one time -
1566: all work is done relatively within the pkgsrc tree.</p>
1567: </div>
1568: </div>
1569:
1570: <div class="chapter" lang="en" xml:lang="en">
1571: <div class="titlepage">
1572: <div>
1573: <div>
1574: <h2 class="title"><a name="platforms" id=
1575: "platforms"></a>Chapter 3. Using pkgsrc on
1576: systems other than NetBSD</h2>
1577: </div>
1578: </div>
1579: </div>
1580:
1581: <div class="toc">
1582: <p><b>Table of Contents</b></p>
1583:
1584: <dl>
1.30 wiz 1585: <dt><span class="sect1"><a href=
1586: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1587: pkgsrc</a></span></dt>
1.1 grant 1588:
1.30 wiz 1589: <dt><span class="sect1"><a href=
1590: "#platform-specific-notes">3.2. Platform specific
1591: notes</a></span></dt>
1.1 grant 1592:
1593: <dd>
1594: <dl>
1.30 wiz 1595: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1596: Darwin (Mac OS X)</a></span></dt>
1597:
1.30 wiz 1598: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1599: FreeBSD</a></span></dt>
1600:
1.30 wiz 1601: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1602: Interix</a></span></dt>
1603:
1.30 wiz 1604: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1605: IRIX</a></span></dt>
1606:
1.30 wiz 1607: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1608: Linux</a></span></dt>
1609:
1.30 wiz 1610: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1611: OpenBSD</a></span></dt>
1612:
1.30 wiz 1613: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1614: Solaris</a></span></dt>
1615: </dl>
1616: </dd>
1617: </dl>
1618: </div>
1619:
1620: <div class="sect1" lang="en" xml:lang="en">
1621: <div class="titlepage">
1622: <div>
1623: <div>
1624: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1625: "bootstrapping-pkgsrc" id=
1626: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
1627: pkgsrc</h2>
1.1 grant 1628: </div>
1629: </div>
1630: </div>
1631:
1.27 rillig 1632: <p>For operating systems other than NetBSD, we provide a
1.1 grant 1633: bootstrap kit to build the required tools to use pkgsrc
1634: on your platform. Besides support for native NetBSD,
1635: pkgsrc and the bootstrap kit have support for the
1636: following operating systems:</p>
1637:
1638: <div class="itemizedlist">
1639: <ul type="disc">
1640: <li>
1641: <p>Darwin (Mac OS X)</p>
1642: </li>
1643:
1644: <li>
1.16 grant 1645: <p>DragonFlyBSD</p>
1646: </li>
1647:
1648: <li>
1.1 grant 1649: <p>FreeBSD</p>
1650: </li>
1651:
1652: <li>
1653: <p>Interix (Windows 2000, XP, 2003)</p>
1654: </li>
1655:
1656: <li>
1657: <p>IRIX</p>
1658: </li>
1659:
1660: <li>
1661: <p>Linux</p>
1662: </li>
1663:
1664: <li>
1665: <p>OpenBSD</p>
1666: </li>
1667:
1668: <li>
1669: <p>Solaris</p>
1670: </li>
1.16 grant 1671:
1672: <li>
1673: <p>Tru64 (Digital UNIX/OSF1)</p>
1674: </li>
1.1 grant 1675: </ul>
1676: </div>
1677:
1678: <p>Support for other platforms is under development.</p>
1679:
1680: <p>Installing the bootstrap kit should be as simple
1681: as:</p>
1682: <pre class="screen">
1.14 xtraeme 1683: <code class="prompt">#</code> <strong class=
1684: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1685: <code class="prompt">#</code> <strong class=
1686: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1687: <code class="prompt">#</code> <strong class=
1688: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1689: </pre>
1690:
1691: <p>See <a href="#getting" title=
1692: "Chapter 2. Where to get pkgsrc">Chapter 2,
1693: <i>Where to get pkgsrc</i></a> for other ways to get
1.14 xtraeme 1694: pkgsrc before bootstrapping. The given
1695: <span><strong class="command">bootstrap</strong></span>
1696: command will use the defaults of <code class=
1697: "filename">/usr/pkg</code> for the <span class=
1698: "emphasis"><em>prefix</em></span> where programs will be
1699: installed in, and <code class=
1700: "filename">/var/db/pkg</code> for the package database
1.27 rillig 1701: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 1702: However, these can also be set using command-line
1.27 rillig 1703: arguments.</p>
1.1 grant 1704:
1705: <p>Binary packages for the pkgsrc tools and an initial
1706: set of packages is available for supported platforms. An
1707: up-to-date list of these can be found on <a href=
1708: "http://www.pkgsrc.org/" target=
1709: "_top">www.pkgsrc.org</a>.</p>
1710: </div>
1711:
1712: <div class="sect1" lang="en" xml:lang="en">
1713: <div class="titlepage">
1714: <div>
1715: <div>
1716: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1717: "platform-specific-notes" id=
1718: "platform-specific-notes"></a>3.2. Platform
1.1 grant 1719: specific notes</h2>
1720: </div>
1721: </div>
1722: </div>
1723:
1724: <p>Here are some platform-specific notes you should be
1725: aware of.</p>
1726:
1727: <div class="sect2" lang="en" xml:lang="en">
1728: <div class="titlepage">
1729: <div>
1730: <div>
1.30 wiz 1731: <h3 class="title"><a name="darwin" id=
1732: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 1733: </div>
1734: </div>
1735: </div>
1736:
1737: <p>Darwin 5.x and 6.x are supported. There are two
1738: methods of using pkgsrc on Mac OS X, by using a
1739: <a href="#platform.osx-image" title=
1740: "3.2.1.1. Using a disk image">disk image</a>, or a
1741: <a href="#platform.osx-ufs" title=
1742: "3.2.1.2. Using a UFS partition">UFS
1743: partition</a>.</p>
1744:
1745: <p>Before you start, you will need to download and
1746: install the Mac OS X Developer Tools from Apple's
1747: Developer Connection. See <a href=
1748: "http://developer.apple.com/macosx/" target=
1749: "_top">http://developer.apple.com/macosx/</a> for
1750: details. Also, make sure you install X11 for Mac OS X
1751: and the X11 SDK from <a href=
1752: "http://www.apple.com/macosx/x11/download/" target=
1753: "_top">http://www.apple.com/macosx/x11/download/</a> if
1754: you intend to build packages that use the X11 Window
1755: System.</p>
1756:
1757: <p>If you already have a UFS partition, or have a spare
1758: partition that you can format as UFS, it is recommended
1759: to use that instead of the disk image. It'll be
1760: somewhat faster and will mount automatically at boot
1761: time, where you must manually mount a disk image.</p>
1762:
1763: <div class="note" style=
1764: "margin-left: 0.5in; margin-right: 0.5in;">
1765: <h3 class="title">Note</h3>
1766:
1767: <p>You cannot use a HFS+ file system for pkgsrc,
1768: because pkgsrc currently requires the filesystem to
1769: be case-sensitive, and HFS+ is not.</p>
1770: </div>
1771:
1772: <div class="sect3" lang="en" xml:lang="en">
1773: <div class="titlepage">
1774: <div>
1775: <div>
1776: <h4 class="title"><a name="platform.osx-image"
1777: id="platform.osx-image"></a>3.2.1.1. Using
1778: a disk image</h4>
1779: </div>
1780: </div>
1781: </div>
1782:
1783: <p>Create the disk image:</p>
1784: <pre class="screen">
1.14 xtraeme 1785: <code class="prompt">#</code> <strong class=
1786: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1787: <code class="prompt">#</code> <strong class=
1788: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
1789: <code class="prompt">#</code> <strong class=
1790: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
1791: <code class="prompt">#</code> <strong class=
1792: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 1793: </pre>
1794:
1795: <p>That's it!</p>
1796: </div>
1797:
1798: <div class="sect3" lang="en" xml:lang="en">
1799: <div class="titlepage">
1800: <div>
1801: <div>
1802: <h4 class="title"><a name="platform.osx-ufs"
1803: id="platform.osx-ufs"></a>3.2.1.2. Using a
1804: UFS partition</h4>
1805: </div>
1806: </div>
1807: </div>
1808:
1.14 xtraeme 1809: <p>By default, <code class="filename">/usr</code>
1810: will be on your root file system, normally HFS+. It
1811: is possible to use the default <span class=
1812: "emphasis"><em>prefix</em></span> of <code class=
1813: "filename">/usr/pkg</code> by symlinking <code class=
1814: "filename">/usr/pkg</code> to a directory on a UFS
1815: file system. Obviously, another symlink is required
1816: if you want to place the package database directory
1817: outside the <span class=
1818: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 1819: <pre class="screen">
1.14 xtraeme 1820: <code class="prompt">#</code> <strong class=
1.22 tv 1821: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1 grant 1822: </pre>
1823:
1824: <p>If you created your partitions at the time of
1825: installing Mac OS X and formatted the target
1826: partition as UFS, it should automatically mount on
1.14 xtraeme 1827: <code class="filename">/Volumes/<volume
1828: name></code> when the machine boots. If you are
1.1 grant 1829: (re)formatting a partition as UFS, you need to ensure
1830: that the partition map correctly reflects
1831: “<span class="quote">Apple_UFS</span>”
1832: and not “<span class=
1833: "quote">Apple_HFS</span>”.</p>
1834:
1835: <p>The problem is that none of the disk tools will
1836: let you touch a disk that is booted from. You can
1837: unmount the partition, but even if you newfs it, the
1838: partition type will be incorrect and the automounter
1839: won't mount it. It can be mounted manually, but it
1840: won't appear in Finder.</p>
1841:
1842: <p>You'll need to boot off of the OS X Installation
1843: (User) CD. When the Installation program starts, go
1844: up to the menu and select Disk Utility. Now, you will
1845: be able to select the partition you want to be UFS,
1846: and Format it Apple UFS. Quit the Disk Utility, quit
1847: the installer which will reboot your machine. The new
1848: UFS file system will appear in Finder.</p>
1849:
1850: <p>Be aware that the permissions on the new file
1851: system will be writable by root only.</p>
1852:
1853: <p>This note is as of 10.2 (Jaguar) and applies to
1854: earlier versions. Hopefully Apple will fix Disk
1855: Utility in 10.3 (Panther).</p>
1856: </div>
1857: </div>
1858:
1859: <div class="sect2" lang="en" xml:lang="en">
1860: <div class="titlepage">
1861: <div>
1862: <div>
1.30 wiz 1863: <h3 class="title"><a name="freebsd" id=
1864: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 1865: </div>
1866: </div>
1867: </div>
1868:
1869: <p>FreeBSD 4.7 and 5.0 have been tested and are
1870: supported, other versions may work.</p>
1871:
1872: <p>Care should be taken so that the tools that this kit
1873: installs do not conflict with the FreeBSD userland
1874: tools. There are several steps:</p>
1875:
1876: <div class="orderedlist">
1877: <ol type="1">
1878: <li>
1879: <p>FreeBSD stores its ports pkg database in
1.14 xtraeme 1880: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 1881: therefore recommended that you choose a different
1.14 xtraeme 1882: location (e.g. <code class=
1883: "filename">/usr/pkgdb</code>) by using the
1.1 grant 1884: --pkgdbdir option to the bootstrap script.</p>
1885: </li>
1886:
1887: <li>
1888: <p>If you do not intend to use the FreeBSD ports
1889: tools, it's probably a good idea to move them out
1890: of the way to avoid confusion, e.g.</p>
1891: <pre class="screen">
1.14 xtraeme 1892: <code class="prompt">#</code> <strong class=
1893: "userinput"><code>cd /usr/sbin</code></strong>
1894: <code class="prompt">#</code> <strong class=
1895: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
1896: <code class="prompt">#</code> <strong class=
1897: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
1898: <code class="prompt">#</code> <strong class=
1899: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
1900: <code class="prompt">#</code> <strong class=
1901: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 1902: </pre>
1903: </li>
1904:
1905: <li>
1.14 xtraeme 1906: <p>An example <code class=
1907: "filename">/etc/mk.conf</code> file will be
1908: placed in <code class=
1909: "filename">/etc/mk.conf.example</code> file when
1910: you use the bootstrap script.</p>
1.1 grant 1911: </li>
1912: </ol>
1913: </div>
1914: </div>
1915:
1916: <div class="sect2" lang="en" xml:lang="en">
1917: <div class="titlepage">
1918: <div>
1919: <div>
1.30 wiz 1920: <h3 class="title"><a name="interix" id=
1921: "interix"></a>3.2.3. Interix</h3>
1.1 grant 1922: </div>
1923: </div>
1924: </div>
1925:
1926: <p>Interix is a POSIX compatible subsystem for the
1927: Windows NT kernel, providing a Unix-like environment
1928: with a tighter kernel integration than available with
1929: Cygwin. It is part of the Windows Services for Unix
1930: package, available for free for any licensed copy of
1.22 tv 1931: Windows 2000, XP (not including XP Home), or 2003. SFU
1932: can be downloaded from <a href=
1933: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 1934: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
1935:
1936: <p>Services for Unix 3.5, current as of this writing,
1937: has been tested. 3.0 or 3.1 may work, but are not
1938: officially supported. (The main difference in 3.0/3.1
1939: is lack of pthreads.)</p>
1940:
1941: <div class="sect3" lang="en" xml:lang="en">
1942: <div class="titlepage">
1943: <div>
1944: <div>
1945: <h4 class="title"><a name=
1946: "platform.interix-sfu-install" id=
1947: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 1948: installing Interix/SFU</h4>
1.1 grant 1949: </div>
1950: </div>
1951: </div>
1952:
1953: <p>At an absolute minimum, the following packages
1954: must be installed from the Windows Services for Unix
1955: 3.5 distribution in order to use pkgsrc:</p>
1956:
1957: <div class="itemizedlist">
1958: <ul type="disc">
1959: <li>
1960: <p>Utilities -> Base Utilities</p>
1961: </li>
1962:
1963: <li>
1964: <p>Interix GNU Components -> (all)</p>
1965: </li>
1966:
1967: <li>
1968: <p>Remote Connectivity</p>
1969: </li>
1970:
1971: <li>
1972: <p>Interix SDK</p>
1973: </li>
1974: </ul>
1975: </div>
1976:
1977: <p>When using pkgsrc on Interix, DO NOT install the
1978: Utilities subcomponent "UNIX Perl". That is Perl 5.6
1979: without shared module support, installed to
1980: /usr/local, and will only cause confusion. Instead,
1981: install Perl 5.8 from pkgsrc (or from a binary
1982: package).</p>
1983:
1984: <p>The Remote Connectivity subcomponent "Windows
1985: Remote Shell Service" does not need to be installed,
1986: but Remote Connectivity itself should be installed in
1987: order to have a working inetd.</p>
1988:
1989: <p>Finally, during installation you may be asked
1990: whether to enable setuid behavior for Interix
1991: programs, and whether to make pathnames default to
1992: case-sensitive. Setuid should be enabled, and
1993: case-sensitivity MUST be enabled. (Without
1994: case-sensitivity, a large number of packages
1995: including perl will not build.)</p>
1996: </div>
1997:
1998: <div class="sect3" lang="en" xml:lang="en">
1999: <div class="titlepage">
2000: <div>
2001: <div>
2002: <h4 class="title"><a name=
2003: "platform.interix-sfu-postinstall" id=
2004: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2005: to do if Interix/SFU is already installed</h4>
2006: </div>
2007: </div>
2008: </div>
2009:
2010: <p>If SFU is already installed and you wish to alter
2011: these settings to work with pkgsrc, note the
2012: following things.</p>
2013:
2014: <div class="itemizedlist">
2015: <ul type="disc">
2016: <li>
2017: <p>To uninstall UNIX Perl, use Add/Remove
2018: Programs, select Microsoft Windows Services for
2019: UNIX, then click Change. In the installer,
2020: choose Add or Remove, then uncheck
2021: Utilities->UNIX Perl.</p>
2022: </li>
2023:
2024: <li>
2025: <p>To enable case-sensitivity for the
2026: filesystem, run REGEDIT.EXE, and change the
2027: following registry key:</p>
2028:
2029: <p>
2030: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2031: Manager\kernel</p>
2032:
2033: <p>Set the DWORD value "obcaseinsensitive" to
2034: 0; then reboot.</p>
2035: </li>
2036:
2037: <li>
2038: <p>To enable setuid binaries (optional), run
2039: REGEDIT.EXE, and change the following registry
2040: key:</p>
2041:
2042: <p>
2043: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2044: for UNIX</p>
2045:
2046: <p>Set the DWORD value "EnableSetuidBinaries"
2047: to 1; then reboot.</p>
2048: </li>
2049: </ul>
2050: </div>
2051: </div>
2052:
2053: <div class="sect3" lang="en" xml:lang="en">
2054: <div class="titlepage">
2055: <div>
2056: <div>
2057: <h4 class="title"><a name=
2058: "platform.interix-notes" id=
2059: "platform.interix-notes"></a>3.2.3.3. Important
2060: notes for using pkgsrc</h4>
2061: </div>
2062: </div>
2063: </div>
2064:
2065: <p>The package imanager (either the pkgsrc "su" user,
2066: or the user running "pkg_add") must be a member of
2067: the local Administrators group. Such a user must also
2068: be used to run the bootstrap. This is slightly
2069: relaxed from the normal pkgsrc requirement of
2070: "root".</p>
2071:
2072: <p>The package manager should use a umask of 002.
2073: "make install" will automatically complain if this is
2074: not the case. This ensures that directories written
2075: in /var/db/pkg are Administrators-group
2076: writeable.</p>
2077:
2078: <p>The popular Interix binary packages from
2079: http://www.interopsystems.com/ use an older version
2080: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2081: used in conjunction with pkgsrc. If you choose to use
2082: them at the same time as the pkgsrc packages, ensure
2083: that you use the proper pkg_* tools for each type of
2084: binary package.</p>
1.22 tv 2085:
2086: <p>The TERM setting used for DOS-type console windows
2087: (including those invoked by the csh and ksh startup
2088: shortcuts) is "interix". Most systems don't have a
2089: termcap/terminfo entry for it, but the following
2090: .termcap entry provides adequate emulation in most
2091: cases:</p>
2092: <pre class="programlisting">
2093: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
2094: </pre>
1.1 grant 2095: </div>
2096: </div>
2097:
2098: <div class="sect2" lang="en" xml:lang="en">
2099: <div class="titlepage">
2100: <div>
2101: <div>
1.30 wiz 2102: <h3 class="title"><a name="irix" id=
2103: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2104: </div>
2105: </div>
2106: </div>
2107:
2108: <p>You will need a working C compiler, either gcc or
2109: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2110: the <code class="varname">CC</code> environment
2111: variable according to your preference. If you do not
2112: have a license for the MIPSpro compiler suite, you can
1.1 grant 2113: download a gcc tardist file from <a href=
2114: "http://freeware.sgi.com/" target=
2115: "_top">http://freeware.sgi.com/</a>.</p>
2116:
2117: <p>Please note that you will need IRIX 6.5.17 or
2118: higher, as this is the earliest version of IRIX
1.24 wiz 2119: providing support for <a href=
2120: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2121: <span class="citerefentry"><span class=
2122: "refentrytitle">if_indextoname</span>(3)</span></a>,
2123: <a href=
2124: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2125: <span class="citerefentry"><span class=
2126: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2127: etc.</p>
1.1 grant 2128:
1.27 rillig 2129: <p>At this point in time, pkgsrc only supports one ABI
2130: at a time. That is, you can not switch between the old
2131: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2132: you start out using "abi=n32", that's what all your
2133: packages will be built with.</p>
1.1 grant 2134:
2135: <p>Therefore, please make sure that you have no
1.14 xtraeme 2136: conflicting <code class="varname">CFLAGS</code> in your
2137: environment or the <code class=
2138: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2139: that you do not try to link n32 object files with lib64
1.14 xtraeme 2140: or vice versa. Check your <code class=
2141: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2142:
2143: <p>If you have the actual pkgsrc tree mounted via NFS
2144: from a different host, please make sure to set
1.14 xtraeme 2145: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2146: directory, as it appears that IRIX linker occasionally
2147: runs into issues when trying to link over a network
2148: mounted filesystem.</p>
2149:
2150: <p>The bootstrapping process should set all the right
2151: options for programs such as imake(1), but you may want
2152: to set some options depending on your local setup.
1.14 xtraeme 2153: Please see <code class=
2154: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2155: course, your compiler's man pages for details.</p>
1.22 tv 2156:
2157: <p>If you are using SGI's MIPSPro compiler, please
2158: set</p>
2159: <pre class="programlisting">
2160: PKGSRC_COMPILER=mipspro
2161: </pre>
2162:
2163: <p>in <code class="filename">/etc/mk.conf</code>.
2164: Otherwise, pkgsrc will assume you are using gcc and may
2165: end up passing invalid flags to the compiler. Note that
2166: bootstrap should create an appropriate <code class=
2167: "filename">mk.conf.example</code> by default.</p>
2168:
2169: <p>If you have both the MIPSPro compiler chain
2170: installed as well as gcc, but want to make sure that
2171: MIPRPro is used, please set your <code class=
2172: "varname">PATH</code> to <span class=
2173: "emphasis"><em>not</em></span> include the location of
2174: gcc (often <code class=
2175: "filename">/usr/freeware/bin</code>), and (important)
2176: pass the '--preserve-path' flag.</p>
1.1 grant 2177: </div>
2178:
2179: <div class="sect2" lang="en" xml:lang="en">
2180: <div class="titlepage">
2181: <div>
2182: <div>
1.30 wiz 2183: <h3 class="title"><a name="linux" id=
2184: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2185: </div>
2186: </div>
2187: </div>
2188:
2189: <p>Some versions of Linux (for example Debian
2190: GNU/Linux) need either libtermcap or libcurses
2191: (libncurses). Installing the distributions
2192: libncurses-dev package (or equivalent) should fix the
2193: problem.</p>
2194:
2195: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2196: and icc (Intel C++ Compiler). gcc is the default. icc
2197: 8.0 and 8.1 on i386 have been tested.</p>
2198:
2199: <p>To bootstrap using icc, assuming the default icc
2200: installation directory:</p>
2201: <pre class="programlisting">
2202: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2203: ac_cv___attribute__=yes ./bootstrap
2204: </pre>
2205:
2206: <div class="note" style=
2207: "margin-left: 0.5in; margin-right: 0.5in;">
2208: <h3 class="title">Note</h3>
2209:
2210: <p>icc 8.1 needs the `-i-static' argument instead of
2211: -static-libcxa.</p>
2212: </div>
2213:
2214: <p>icc supports __attribute__, but the GNU configure
2215: test uses a nested function, which icc does not
2216: support. #undef'ing __attribute__ has the unfortunate
2217: side-effect of breaking many of the Linux header files,
2218: which cannot be compiled properly without
2219: __attribute__. The test must be overridden so that
2220: __attribute__ is assumed supported by the compiler.</p>
2221:
2222: <p>After bootstrapping, you should set <code class=
2223: "varname">PKGSRC_COMPILER</code> in <code class=
2224: "filename">/etc/mk.conf</code>:</p>
2225: <pre class="programlisting">
2226: PKGSRC_COMPILER=icc
2227: </pre>
2228:
2229: <p>The default installation directory for icc is
2230: <code class="filename">/opt/intel_cc_80</code>, which
2231: is also the pkgsrc default. If you have installed it
2232: into a different directory, set <code class=
2233: "varname">ICCBASE</code> in <code class=
2234: "filename">/etc/mk.conf</code>:</p>
2235: <pre class="programlisting">
2236: ICCBASE=/opt/icc
2237: </pre>
2238:
2239: <p>pkgsrc uses the static linking method of the runtime
2240: libraries provided by icc, so binaries can be run on
2241: other systems which do not have the shared libraries
2242: installed.</p>
2243:
2244: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2245: the <a href=
2246: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2247: <span class="citerefentry"><span class=
2248: "refentrytitle">ld</span>(1)</span></a> command run
2249: when linking a C++ shared library and records it,
2250: throwing away the -Bstatic and -Bdynamic options
2251: interspersed between the libraries. This means that
2252: libtool-linked C++ shared libraries will have a runtime
2253: dependency on the icc libraries until this is fixed in
2254: libtool.</p>
1.22 tv 2255: </div>
2256:
2257: <div class="sect2" lang="en" xml:lang="en">
2258: <div class="titlepage">
2259: <div>
2260: <div>
1.30 wiz 2261: <h3 class="title"><a name="openbsd" id=
2262: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2263: </div>
2264: </div>
2265: </div>
2266:
2267: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2268:
2269: <p>Care should be taken so that the tools that this kit
2270: installs do not conflict with the OpenBSD userland
2271: tools. There are several steps:</p>
2272:
2273: <div class="orderedlist">
2274: <ol type="1">
2275: <li>
2276: <p>OpenBSD stores its ports pkg database in
1.14 xtraeme 2277: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 2278: therefore recommended that you choose a different
1.14 xtraeme 2279: location (e.g. <code class=
2280: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2281: --pkgdbdir option to the bootstrap script.</p>
2282: </li>
2283:
2284: <li>
2285: <p>If you do not intend to use the OpenBSD ports
2286: tools, it's probably a good idea to move them out
2287: of the way to avoid confusion, e.g.</p>
2288: <pre class="screen">
1.14 xtraeme 2289: <code class="prompt">#</code> <strong class=
2290: "userinput"><code>cd /usr/sbin</code></strong>
2291: <code class="prompt">#</code> <strong class=
2292: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2293: <code class="prompt">#</code> <strong class=
2294: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2295: <code class="prompt">#</code> <strong class=
2296: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2297: <code class="prompt">#</code> <strong class=
2298: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2299: </pre>
2300: </li>
2301:
2302: <li>
1.14 xtraeme 2303: <p>An example <code class=
2304: "filename">/etc/mk.conf</code> file will be
2305: placed in <code class=
2306: "filename">/etc/mk.conf.example</code> file when
2307: you use the bootstrap script. OpenBSD's make
2308: program uses <code class=
2309: "filename">/etc/mk.conf</code> as well. You can
1.1 grant 2310: work around this by enclosing all the pkgsrc
2311: specific parts of the file with:</p>
2312: <pre class="programlisting">
2313: .ifdef BSD_PKG_MK
1.11 ben 2314: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1 grant 2315: .else
2316: # OpenBSD stuff
2317: .endif
2318: </pre>
2319: </li>
2320: </ol>
2321: </div>
2322: </div>
2323:
2324: <div class="sect2" lang="en" xml:lang="en">
2325: <div class="titlepage">
2326: <div>
2327: <div>
1.30 wiz 2328: <h3 class="title"><a name="solaris" id=
2329: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2330: </div>
2331: </div>
2332: </div>
2333:
2334: <p>Solaris 2.6 through 9 are supported on both x86 and
2335: sparc. You will need a working C compiler. Both gcc
2336: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2337:
2338: <p>The following packages are required on Solaris 8 for
2339: the bootstrap process and to build packages.</p>
2340:
2341: <div class="itemizedlist">
2342: <ul type="disc">
2343: <li>
2344: <p>SUNWsprot</p>
2345: </li>
2346:
2347: <li>
2348: <p>SUNWarc</p>
2349: </li>
2350:
2351: <li>
2352: <p>SUNWbtool</p>
2353: </li>
2354:
2355: <li>
2356: <p>SUNWtoo</p>
2357: </li>
2358:
2359: <li>
2360: <p>SUNWlibm</p>
2361: </li>
2362: </ul>
2363: </div>
2364:
2365: <p>Please note the use of GNU binutils on Solaris is
2366: <span class="emphasis"><em>not</em></span>
2367: supported.</p>
2368:
2369: <div class="sect3" lang="en" xml:lang="en">
2370: <div class="titlepage">
2371: <div>
2372: <div>
1.30 wiz 2373: <h4 class="title"><a name="solaris-gcc-note"
2374: id="solaris-gcc-note"></a>3.2.7.1. If you
2375: are using gcc</h4>
1.1 grant 2376: </div>
2377: </div>
2378: </div>
2379:
2380: <p>It makes life much simpler if you only use the
2381: same gcc consistently for building all packages.</p>
2382:
2383: <p>It is recommended that an external gcc be used
2384: only for bootstrapping, then either build gcc from
2385: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2386: href=
2387: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.20 ben 2388: class="pkgname">lang/gcc</a> or install a binary gcc
2389: package, then remove gcc used during
2390: bootstrapping.</p>
1.1 grant 2391:
2392: <p>Binary packages of gcc can be found through
2393: <a href=
2394: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2395: target=
2396: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2397: </div>
2398:
2399: <div class="sect3" lang="en" xml:lang="en">
2400: <div class="titlepage">
2401: <div>
2402: <div>
1.30 wiz 2403: <h4 class="title"><a name=
2404: "solaris-sun-workshop-note" id=
2405: "solaris-sun-workshop-note"></a>3.2.7.2. If
2406: you are using Sun WorkShop</h4>
1.1 grant 2407: </div>
2408: </div>
2409: </div>
2410:
2411: <p>You will need at least the following packages
2412: installed (from WorkShop 5.0)</p>
2413:
2414: <div class="itemizedlist">
2415: <ul type="disc">
2416: <li>
2417: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2418: </li>
2419:
2420: <li>
2421: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2422: </li>
2423:
2424: <li>
2425: <p>SPROild - Sun WorkShop Incremental
2426: Linker</p>
2427: </li>
2428:
2429: <li>
2430: <p>SPROlang - Sun WorkShop Compilers common
2431: components</p>
2432: </li>
2433: </ul>
2434: </div>
2435:
1.14 xtraeme 2436: <p>You should set <code class="varname">CC</code>,
2437: <code class="varname">CXX</code> and optionally,
2438: <code class="varname">CPP</code> in <code class=
2439: "filename">/etc/mk.conf</code>, eg.</p>
1.1 grant 2440: <pre class="programlisting">
1.27 rillig 2441: CC= cc
1.1 grant 2442: CXX= CC
2443: CPP= /usr/ccs/lib/cpp
2444: </pre>
2445:
2446: <p>You may also want to build 64-bit binaries,
2447: eg.</p>
2448: <pre class="programlisting">
2449: CFLAGS= -xtarget=ultra -xarch=v9
2450: </pre>
2451:
2452: <p>Whichever compiler you use, please ensure the
2453: compiler tools and your $prefix are in your
1.14 xtraeme 2454: <code class="varname">PATH</code>. This includes
2455: <code class="filename">/usr/ccs/{bin,lib}</code> and
2456: eg. <code class=
2457: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2458: </div>
2459: </div>
2460: </div>
2461: </div>
2462:
2463: <div class="chapter" lang="en" xml:lang="en">
2464: <div class="titlepage">
2465: <div>
2466: <div>
2467: <h2 class="title"><a name="using" id=
2468: "using"></a>Chapter 4. Using pkgsrc</h2>
2469: </div>
2470: </div>
2471: </div>
2472:
2473: <div class="toc">
2474: <p><b>Table of Contents</b></p>
2475:
2476: <dl>
2477: <dt><span class="sect1"><a href="#getting-started">4.1.
2478: Working with binary packages</a></span></dt>
2479:
2480: <dd>
2481: <dl>
1.30 wiz 2482: <dt><span class="sect2"><a href=
2483: "#where-to-get-binary-packages">4.1.1. Where to get
2484: binary packages</a></span></dt>
1.1 grant 2485:
1.30 wiz 2486: <dt><span class="sect2"><a href=
2487: "#how-to-use-binary-packages">4.1.2. How to use
2488: binary packages</a></span></dt>
1.1 grant 2489:
1.30 wiz 2490: <dt><span class="sect2"><a href=
2491: "#a-word-of-warning">4.1.3. A word of
2492: warning</a></span></dt>
1.1 grant 2493: </dl>
2494: </dd>
2495:
1.30 wiz 2496: <dt><span class="sect1"><a href=
2497: "#building-packages-from-source">4.2. Building packages
2498: from source</a></span></dt>
1.1 grant 2499:
2500: <dd>
2501: <dl>
1.30 wiz 2502: <dt><span class="sect2"><a href=
2503: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 2504:
1.30 wiz 2505: <dt><span class="sect2"><a href=
2506: "#fetching-distfiles">4.2.2. Fetching
2507: distfiles</a></span></dt>
1.1 grant 2508:
1.30 wiz 2509: <dt><span class="sect2"><a href=
2510: "#how-to-build-and-install">4.2.3. How to build and
2511: install</a></span></dt>
1.1 grant 2512:
1.30 wiz 2513: <dt><span class="sect2"><a href=
2514: "#selecting-the-compiler">4.2.4. Selecting the
2515: compiler</a></span></dt>
1.1 grant 2516: </dl>
2517: </dd>
2518: </dl>
2519: </div>
2520:
2521: <div class="sect1" lang="en" xml:lang="en">
2522: <div class="titlepage">
2523: <div>
2524: <div>
2525: <h2 class="title" style="clear: both"><a name=
2526: "getting-started" id=
2527: "getting-started"></a>4.1. Working with binary
2528: packages</h2>
2529: </div>
2530: </div>
2531: </div>
2532:
2533: <p>This section describes how to find, retrieve and
2534: install a precompiled binary package that someone else
2535: already prepared for your type of machine.</p>
2536:
2537: <div class="sect2" lang="en" xml:lang="en">
2538: <div class="titlepage">
2539: <div>
2540: <div>
1.30 wiz 2541: <h3 class="title"><a name=
2542: "where-to-get-binary-packages" id=
2543: "where-to-get-binary-packages"></a>4.1.1. Where
2544: to get binary packages</h3>
1.1 grant 2545: </div>
2546: </div>
2547: </div>
2548:
2549: <p>Precompiled packages are stored on ftp.NetBSD.org
1.14 xtraeme 2550: and its mirrors in the directory <code class=
1.27 rillig 2551: "filename">/pub/NetBSD/packages/<OSVERSION>/<ARCH>/</code>
2552: for anonymous FTP access. <code class=
2553: "varname">OSVERSION</code> is the NetBSD version
2554: (<span><strong class="command">uname
2555: -r</strong></span>), <code class="varname">ARCH</code>
2556: is the architecture (<span><strong class=
2557: "command">uname -p</strong></span>). In that directory,
2558: there is a subdirectory for each category plus a
2559: subdirectory <code class="filename">All</code> which
2560: includes the actual binaries in <code class=
2561: "filename">.tgz</code> files. The category
2562: subdirectories use symbolic links to those files (this
2563: is the same directory layout as in <code class=
1.14 xtraeme 2564: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2565:
2566: <p>This same directory layout applies for CDROM
2567: distributions, only that the directory may be rooted
1.14 xtraeme 2568: somewhere else, probably somewhere below <code class=
2569: "filename">/cdrom</code>. Please consult your CDROMs
1.1 grant 2570: documentation for the exact location.</p>
2571: </div>
2572:
2573: <div class="sect2" lang="en" xml:lang="en">
2574: <div class="titlepage">
2575: <div>
2576: <div>
1.30 wiz 2577: <h3 class="title"><a name=
2578: "how-to-use-binary-packages" id=
2579: "how-to-use-binary-packages"></a>4.1.2. How
2580: to use binary packages</h3>
1.1 grant 2581: </div>
2582: </div>
2583: </div>
2584:
2585: <p>If you have the files on a CDROM or downloaded them
1.23 wiz 2586: to your hard disk, you can install them with the
1.27 rillig 2587: following command (be sure to <span><strong class=
1.14 xtraeme 2588: "command">su</strong></span> to root first):</p>
1.1 grant 2589: <pre class="screen">
1.14 xtraeme 2590: <code class="prompt">#</code> <strong class=
2591: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 2592: </pre>
2593:
2594: <p>If you have FTP access and you don't want to
2595: download the packages via FTP prior to installation,
1.14 xtraeme 2596: you can do this automatically by giving
2597: <span><strong class="command">pkg_add</strong></span>
2598: an FTP URL:</p>
1.1 grant 2599: <pre class="screen">
1.14 xtraeme 2600: <code class="prompt">#</code> <strong class=
1.27 rillig 2601: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 2602: </pre>
2603:
1.27 rillig 2604: <p>Note that any prerequisite packages needed to run
2605: the package in question will be installed, too,
1.1 grant 2606: assuming they are present where you install from.</p>
2607:
1.23 wiz 2608: <p>To save some typing, you can set the <code class=
2609: "varname">PKG_PATH</code> environment variable to a
2610: semicolon separated list of paths (including remote
2611: URLs); trailing slashes are not allowed.</p>
2612:
2613: <p>Additionally to the <code class=
2614: "filename">All</code> directory there exists a
2615: <code class="filename">vulnerable</code> directory to
2616: which binary packages with known vulnerabilities are
2617: moved, since removing them could cause missing
2618: dependencies. To use these packages, add the
2619: <code class="filename">vulnerable</code> directory to
2620: your <code class="varname">PKG_PATH</code>. However,
2621: you should run <a xmlns=
2622: "http://www.w3.org/TR/xhtml1/transitional" href=
2623: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
2624: class="pkgname">security/audit-packages</a> regularly,
2625: and especially after installing new packages, and
2626: verify that the vulnerabilities are acceptable for your
2627: configuration. An example <code class=
2628: "varname">PKG_PATH</code> would be: <code class=
1.27 rillig 2629: "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 2630: Please note that semicolon (';') is a shell
2631: meta-character, so you'll probably have to quote
2632: it.</p>
2633:
1.1 grant 2634: <p>After you've installed packages, be sure to have
1.27 rillig 2635: <code class="filename">/usr/pkg/bin</code> and
2636: <code class="filename">/usr/pkg/sbin</code> in your
1.14 xtraeme 2637: <code class="varname">PATH</code> so you can actually
2638: start the just installed program.</p>
1.1 grant 2639: </div>
2640:
2641: <div class="sect2" lang="en" xml:lang="en">
2642: <div class="titlepage">
2643: <div>
2644: <div>
1.30 wiz 2645: <h3 class="title"><a name="a-word-of-warning" id=
2646: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 2647: warning</h3>
2648: </div>
2649: </div>
2650: </div>
2651:
2652: <p>Please pay very careful attention to the warnings
2653: expressed in the <a href=
2654: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2655: <span class="citerefentry"><span class=
2656: "refentrytitle">pkg_add</span>(1)</span></a> manual
2657: page about the inherent dangers of installing binary
2658: packages which you did not create yourself, and the
2659: security holes that can be introduced onto your system
2660: by indiscriminate adding of such files.</p>
2661: </div>
2662: </div>
2663:
2664: <div class="sect1" lang="en" xml:lang="en">
2665: <div class="titlepage">
2666: <div>
2667: <div>
2668: <h2 class="title" style="clear: both"><a name=
1.30 wiz 2669: "building-packages-from-source" id=
2670: "building-packages-from-source"></a>4.2. Building
1.1 grant 2671: packages from source</h2>
2672: </div>
2673: </div>
2674: </div>
2675:
2676: <p>This assumes that the package is already in pkgsrc. If
2677: it is not, see <a href="#developers-guide" title=
1.2 hubertf 2678: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 2679: “The pkgsrc developer's guide”</a> for
2680: instructions how to create your own packages.</p>
1.1 grant 2681:
2682: <div class="sect2" lang="en" xml:lang="en">
2683: <div class="titlepage">
2684: <div>
2685: <div>
1.30 wiz 2686: <h3 class="title"><a name="requirements" id=
2687: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 2688: </div>
2689: </div>
2690: </div>
2691:
2692: <p>To build packages from source on a NetBSD system the
2693: “<span class="quote">comp</span>” and the
2694: “<span class="quote">text</span>”
2695: distribution sets must be installed. If you want to
2696: build X11 related packages the “<span class=
2697: "quote">xbase</span>” and “<span class=
2698: "quote">xcomp</span>” distribution sets are
2699: required, too.</p>
2700: </div>
2701:
2702: <div class="sect2" lang="en" xml:lang="en">
2703: <div class="titlepage">
2704: <div>
2705: <div>
1.30 wiz 2706: <h3 class="title"><a name="fetching-distfiles"
2707: id="fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 2708: distfiles</h3>
2709: </div>
2710: </div>
2711: </div>
2712:
1.27 rillig 2713: <p>The first step for building a package is downloading
2714: the distfiles (i.e. the unmodified source). If they
2715: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 2716: automatically.</p>
2717:
2718: <p>You can overwrite some of the major distribution
2719: sites to fit to sites that are close to your own. Have
1.14 xtraeme 2720: a look at <code class=
2721: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 2722: some examples — in particular, look for the
1.14 xtraeme 2723: <code class="varname">MASTER_SORT</code>, <code class=
2724: "varname">MASTER_SORT_REGEX</code> and <code class=
2725: "varname">INET_COUNTRY</code> definitions. This may
2726: save some of your bandwidth and time.</p>
1.1 grant 2727:
2728: <p>You can change these settings either in your shell's
2729: environment, or, if you want to keep the settings, by
1.14 xtraeme 2730: editing the <code class="filename">/etc/mk.conf</code>
1.1 grant 2731: file, and adding the definitions there.</p>
2732:
2733: <p>If you don't have a permanent Internet connection
2734: and you want to know which files to download,
1.14 xtraeme 2735: <span><strong class="command">make
2736: fetch-list</strong></span> will tell you what you'll
2737: need. Put these distfiles into <code class=
2738: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 2739: </div>
2740:
2741: <div class="sect2" lang="en" xml:lang="en">
2742: <div class="titlepage">
2743: <div>
2744: <div>
1.30 wiz 2745: <h3 class="title"><a name=
2746: "how-to-build-and-install" id=
2747: "how-to-build-and-install"></a>4.2.3. How to
2748: build and install</h3>
1.1 grant 2749: </div>
2750: </div>
2751: </div>
2752:
2753: <p>Assuming that the distfile has been fetched (see
2754: previous section), become root and change into the
1.14 xtraeme 2755: relevant directory and running <span><strong class=
2756: "command">make</strong></span>. For example, type</p>
1.1 grant 2757: <pre class="screen">
1.14 xtraeme 2758: <code class="prompt">%</code> <strong class=
2759: "userinput"><code>cd misc/figlet</code></strong>
2760: <code class="prompt">%</code> <strong class=
2761: "userinput"><code>make</code></strong>
1.1 grant 2762: </pre>
2763:
2764: <p>at the shell prompt to build the various components
2765: of the package, and</p>
2766: <pre class="screen">
1.14 xtraeme 2767: <code class="prompt">#</code> <strong class=
2768: "userinput"><code>make install</code></strong>
1.1 grant 2769: </pre>
2770:
2771: <p>to install the various components into the correct
2772: places on your system. Installing the package on your
2773: system requires you to be root. However, pkgsrc has a
2774: <span class="emphasis"><em>just-in-time-su</em></span>
2775: feature, which allows you to only become root for the
2776: actual installation step</p>
2777:
2778: <p>Taking the figlet utility as an example, we can
2779: install it on our system by building as shown in
2780: <a href="#logs" title=
2781: "Appendix B. Build logs">Appendix B, <i>Build
2782: logs</i></a>.</p>
2783:
2784: <p>The program is installed under the default root of
1.14 xtraeme 2785: the packages tree - <code class=
2786: "filename">/usr/pkg</code>. Should this not conform to
2787: your tastes, set the <code class=
2788: "varname">LOCALBASE</code> variable in your
1.1 grant 2789: environment, and it will use that value as the root of
1.14 xtraeme 2790: your packages tree. So, to use <code class=
2791: "filename">/usr/local</code>, set <code class=
2792: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 2793: environment. Please note that you should use a
2794: directory which is dedicated to packages and not shared
1.14 xtraeme 2795: with other programs (ie, do not try and use
2796: <code class="varname">LOCALBASE=/usr</code>). Also, you
2797: should not try to add any of your own files or
2798: directories (such as <code class=
2799: "filename">src/</code>, <code class=
2800: "filename">obj/</code>, or <code class=
2801: "filename">pkgsrc/</code>) below the <code class=
2802: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 2803: possible conflicts between programs and other files
2804: installed by the package system and whatever else may
2805: have been installed there.</p>
2806:
1.14 xtraeme 2807: <p>Some packages look in <code class=
2808: "filename">/etc/mk.conf</code> to alter some
1.1 grant 2809: configuration options at build time. Have a look at
1.14 xtraeme 2810: <code class=
2811: "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
2812: overview of what will be set there by default.
2813: Environment variables such as <code class=
2814: "varname">LOCALBASE</code> can be set in <code class=
2815: "filename">/etc/mk.conf</code> to save having to
2816: remember to set them each time you want to use
2817: pkgsrc.</p>
1.1 grant 2818:
2819: <p>Occasionally, people want to “<span class=
2820: "quote">look under the covers</span>” to see what
2821: is going on when a package is building or being
2822: installed. This may be for debugging purposes, or out
2823: of simple curiosity. A number of utility values have
2824: been added to help with this.</p>
2825:
2826: <div class="orderedlist">
2827: <ol type="1">
2828: <li>
2829: <p>If you invoke the <a href=
2830: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2831: <span class="citerefentry"><span class=
2832: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 2833: with <code class=
2834: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
2835: amount of information will be displayed. For
2836: example,</p>
1.1 grant 2837: <pre class="screen">
1.14 xtraeme 2838: <strong class=
2839: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 2840: </pre>
2841:
2842: <p>will show all the commands that are invoked,
2843: up to and including the “<span class=
2844: "quote">patch</span>” stage.</p>
2845: </li>
2846:
2847: <li>
2848: <p>If you want to know the value of a certain
1.22 tv 2849: <a href=
2850: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2851: <span class="citerefentry"><span class=
2852: "refentrytitle">make</span>(1)</span></a>
2853: definition, then the <code class=
1.14 xtraeme 2854: "varname">VARNAME</code> definition should be
2855: used, in conjunction with the show-var target.
2856: e.g. to show the expansion of the <a href=
1.1 grant 2857: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2858: <span class="citerefentry"><span class=
2859: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 2860: variable <code class=
1.22 tv 2861: "varname">LOCALBASE</code>:</p>
1.1 grant 2862: <pre class="screen">
1.14 xtraeme 2863: <code class="prompt">%</code> <strong class=
2864: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 2865: /usr/pkg
1.14 xtraeme 2866: <code class="prompt">%</code>
1.1 grant 2867:
2868: </pre>
2869: </li>
2870: </ol>
2871: </div>
2872:
2873: <p>If you want to install a binary package that you've
2874: either created yourself (see next section), that you
2875: put into pkgsrc/packages manually or that is located on
1.8 wiz 2876: a remote FTP server, you can use the "bin-install"
1.1 grant 2877: target. This target will install a binary package - if
2878: available - via <a href=
2879: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2880: <span class="citerefentry"><span class=
2881: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 2882: <span><strong class="command">make
2883: package</strong></span>. The list of remote FTP sites
2884: searched is kept in the variable <code class=
2885: "varname">BINPKG_SITES</code>, which defaults to
2886: ftp.NetBSD.org. Any flags that should be added to
2887: <a href=
1.1 grant 2888: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2889: <span class="citerefentry"><span class=
2890: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 2891: into <code class="varname">BIN_INSTALL_FLAGS</code>.
2892: See <code class=
2893: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
2894: details.</p>
1.1 grant 2895:
2896: <p>A final word of warning: If you setup a system that
1.14 xtraeme 2897: has a non-standard setting for <code class=
2898: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 2899: any packages are installed, as you can not use several
2900: directories for the same purpose. Doing so will result
2901: in pkgsrc not being able to properly detect your
2902: installed packages, and fail miserably. Note also that
2903: precompiled binary packages are usually built with the
1.14 xtraeme 2904: default <code class="varname">LOCALBASE</code> of
2905: <code class="filename">/usr/pkg</code>, and that you
2906: should <span class="emphasis"><em>not</em></span>
2907: install any if you use a non-standard <code class=
2908: "varname">LOCALBASE</code>.</p>
1.1 grant 2909: </div>
2910:
2911: <div class="sect2" lang="en" xml:lang="en">
2912: <div class="titlepage">
2913: <div>
2914: <div>
1.30 wiz 2915: <h3 class="title"><a name=
2916: "selecting-the-compiler" id=
2917: "selecting-the-compiler"></a>4.2.4. Selecting
2918: the compiler</h3>
1.1 grant 2919: </div>
2920: </div>
2921: </div>
2922:
2923: <p>By default, pkgsrc will use GCC to build packages.
2924: This may be overridden by setting the following
2925: variables in /etc/mk.conf:</p>
2926:
2927: <div class="variablelist">
2928: <dl>
1.14 xtraeme 2929: <dt><span class="term"><code class=
2930: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 2931:
2932: <dd>
2933: <p>This is a list of values specifying the chain
2934: of compilers to invoke when building packages.
2935: Valid values are:</p>
2936:
2937: <div class="itemizedlist">
2938: <ul type="disc">
2939: <li>
1.14 xtraeme 2940: <p><code class="varname">distcc</code>:
1.1 grant 2941: distributed C/C++ (chainable)</p>
2942: </li>
2943:
2944: <li>
1.14 xtraeme 2945: <p><code class="varname">ccache</code>:
1.1 grant 2946: compiler cache (chainable)</p>
2947: </li>
2948:
2949: <li>
1.14 xtraeme 2950: <p><code class="varname">gcc</code>: GNU
2951: C/C++ Compiler</p>
1.1 grant 2952: </li>
2953:
2954: <li>
1.14 xtraeme 2955: <p><code class="varname">mipspro</code>:
1.1 grant 2956: Silicon Graphics, Inc. MIPSpro
2957: (n32/n64)</p>
2958: </li>
2959:
2960: <li>
1.14 xtraeme 2961: <p><code class="varname">mipspro</code>:
1.1 grant 2962: Silicon Graphics, Inc. MIPSpro (o32)</p>
2963: </li>
2964:
2965: <li>
1.14 xtraeme 2966: <p><code class="varname">sunpro</code>:
1.1 grant 2967: Microsystems, Inc. WorkShip/Forte/Sun ONE
2968: Studio</p>
2969: </li>
2970: </ul>
2971: </div>
2972:
2973: <p>The default is “<span class=
1.14 xtraeme 2974: "quote"><code class=
2975: "varname">gcc</code></span>”. You can use
2976: <code class="varname">ccache</code> and/or
2977: <code class="varname">distcc</code> with an
2978: appropriate <code class=
2979: "varname">PKGSRC_COMPILER</code> setting, e.g.
2980: “<span class="quote"><code class=
2981: "varname">ccache gcc</code></span>”. This
1.1 grant 2982: variable should always be terminated with a value
2983: for a real compiler.</p>
2984: </dd>
2985:
1.14 xtraeme 2986: <dt><span class="term"><code class=
2987: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 2988:
2989: <dd>
2990: <p>This specifies the minimum version of GCC to
2991: use when building packages. If the system GCC
2992: doesn't satisfy this requirement, then pkgsrc
2993: will build and install one of the GCC packages to
2994: use instead.</p>
2995: </dd>
2996: </dl>
2997: </div>
2998: </div>
2999: </div>
3000: </div>
3001:
3002: <div class="chapter" lang="en" xml:lang="en">
3003: <div class="titlepage">
3004: <div>
3005: <div>
3006: <h2 class="title"><a name="binary" id=
3007: "binary"></a>Chapter 5. Creating binary
3008: packages</h2>
3009: </div>
3010: </div>
3011: </div>
3012:
3013: <div class="toc">
3014: <p><b>Table of Contents</b></p>
3015:
3016: <dl>
1.30 wiz 3017: <dt><span class="sect1"><a href=
3018: "#building-a-single-binary-package">5.1. Building a
3019: single binary package</a></span></dt>
1.1 grant 3020:
1.30 wiz 3021: <dt><span class="sect1"><a href=
3022: "#settings-for-creationg-of-binary-packages">5.2.
1.1 grant 3023: Settings for creation of binary
3024: packages</a></span></dt>
3025:
3026: <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
3027: a bulk build of all packages</a></span></dt>
3028:
3029: <dd>
3030: <dl>
3031: <dt><span class="sect2"><a href=
3032: "#binary.configuration">5.3.1.
3033: Configuration</a></span></dt>
3034:
1.30 wiz 3035: <dt><span class="sect2"><a href=
3036: "#other-environmental-considerations">5.3.2. Other
3037: environmental considerations</a></span></dt>
1.1 grant 3038:
1.30 wiz 3039: <dt><span class="sect2"><a href="#operation">5.3.3.
1.1 grant 3040: Operation</a></span></dt>
3041:
1.30 wiz 3042: <dt><span class="sect2"><a href=
3043: "#what-it-does">5.3.4. What it does</a></span></dt>
1.1 grant 3044:
1.30 wiz 3045: <dt><span class="sect2"><a href=
3046: "#disk-space-requirements">5.3.5. Disk space
3047: requirements</a></span></dt>
1.1 grant 3048:
1.30 wiz 3049: <dt><span class="sect2"><a href=
3050: "#setting-up-a-sandbox">5.3.6. Setting up a sandbox
3051: for chroot'ed builds</a></span></dt>
1.1 grant 3052:
1.30 wiz 3053: <dt><span class="sect2"><a href=
3054: "#building-a-partial-set">5.3.7. Building a partial
3055: set of packages</a></span></dt>
1.13 hubertf 3056:
3057: <dt><span class="sect2"><a href=
3058: "#bulk-upload">5.3.8. Uploading results of a bulk
3059: build</a></span></dt>
1.1 grant 3060: </dl>
3061: </dd>
3062:
1.30 wiz 3063: <dt><span class="sect1"><a href="#creating-cdroms">5.4.
1.1 grant 3064: Creating a multiple CD-ROM packages
3065: collection</a></span></dt>
3066:
3067: <dd>
3068: <dl>
1.30 wiz 3069: <dt><span class="sect2"><a href=
3070: "#cdpack-example">5.4.1. Example of
3071: cdpack</a></span></dt>
1.1 grant 3072: </dl>
3073: </dd>
3074: </dl>
3075: </div>
3076:
3077: <div class="sect1" lang="en" xml:lang="en">
3078: <div class="titlepage">
3079: <div>
3080: <div>
3081: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3082: "building-a-single-binary-package" id=
3083: "building-a-single-binary-package"></a>5.1. Building
3084: a single binary package</h2>
1.1 grant 3085: </div>
3086: </div>
3087: </div>
3088:
3089: <p>Once you have built and installed a package, you can
3090: create a <span class="emphasis"><em>binary
3091: package</em></span> which can be installed on another
3092: system with <a href=
3093: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3094: <span class="citerefentry"><span class=
3095: "refentrytitle">pkg_add</span>(1)</span></a> This saves
3096: having to build the same package on a group of hosts and
3097: wasting CPU time. It also provides a simple means for
3098: others to install your package, should you distribute
3099: it.</p>
3100:
3101: <p>To create a binary package, change into the
1.14 xtraeme 3102: appropriate directory in pkgsrc, and run
3103: <span><strong class="command">make
3104: package</strong></span>:</p>
1.1 grant 3105: <pre class="screen">
1.14 xtraeme 3106: <code class="prompt">#</code> <strong class=
3107: "userinput"><code>cd misc/figlet</code></strong>
3108: <code class="prompt">#</code> <strong class=
3109: "userinput"><code>make package</code></strong>
1.1 grant 3110: </pre>
3111:
3112: <p>This will build and install your package (if not
3113: already done), and then build a binary package from what
1.14 xtraeme 3114: was installed. You can then use the <span><strong class=
3115: "command">pkg_*</strong></span> tools to manipulate it.
3116: Binary packages are created by default in <code class=
3117: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 3118: gzipped tar file. See <a href="#logs.package" title=
3119: "B.2. Packaging figlet">Section B.2,
3120: “Packaging figlet”</a> for a continuation of
3121: the above <a xmlns=
3122: "http://www.w3.org/TR/xhtml1/transitional" href=
3123: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.20 ben 3124: class="pkgname">misc/figlet</a> example.</p>
1.1 grant 3125:
3126: <p>See <a href="#submit" title=
1.25 rillig 3127: "Chapter 15. Submitting and Committing">Chapter
3128: 15, <i>Submitting and Committing</i></a> for information
1.1 grant 3129: on how to submit such a binary package.</p>
3130: </div>
3131:
3132: <div class="sect1" lang="en" xml:lang="en">
3133: <div class="titlepage">
3134: <div>
3135: <div>
3136: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3137: "settings-for-creationg-of-binary-packages" id=
3138: "settings-for-creationg-of-binary-packages"></a>5.2. Settings
1.1 grant 3139: for creation of binary packages</h2>
3140: </div>
3141: </div>
3142: </div>
3143:
3144: <p>See <a href="#build.helpful-targets" title=
1.25 rillig 3145: "12.3. Other helpful targets">Section 12.3,
1.1 grant 3146: “Other helpful targets”</a>.</p>
3147: </div>
3148:
3149: <div class="sect1" lang="en" xml:lang="en">
3150: <div class="titlepage">
3151: <div>
3152: <div>
3153: <h2 class="title" style="clear: both"><a name=
3154: "bulkbuild" id="bulkbuild"></a>5.3. Doing a
3155: bulk build of all packages</h2>
3156: </div>
3157: </div>
3158: </div>
3159:
3160: <p>If you want to get a full set of precompiled binary
3161: packages, this section describes how to get them. Beware
3162: that the bulk build will remove all currently installed
1.23 wiz 3163: packages from your system! Having an FTP server
3164: configured either on the machine doing the bulk builds or
3165: on a nearby NFS server can help to make the packages
3166: available to everyone. See <a href=
1.1 grant 3167: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
3168: <span class="citerefentry"><span class=
3169: "refentrytitle">ftpd</span>(8)</span></a> for more
3170: information. If you use a remote NFS server's storage, be
3171: sure to not actually compile on NFS storage, as this
3172: slows things down a lot.</p>
3173:
3174: <div class="sect2" lang="en" xml:lang="en">
3175: <div class="titlepage">
3176: <div>
3177: <div>
3178: <h3 class="title"><a name="binary.configuration"
3179: id=
3180: "binary.configuration"></a>5.3.1. Configuration</h3>
3181: </div>
3182: </div>
3183: </div>
3184:
3185: <div class="sect3" lang="en" xml:lang="en">
3186: <div class="titlepage">
3187: <div>
3188: <div>
3189: <h4 class="title"><a name="binary.mk.conf" id=
3190: "binary.mk.conf"></a>5.3.1.1. /etc/mk.conf</h4>
3191: </div>
3192: </div>
3193: </div>
3194:
1.23 wiz 3195: <p>You may want to set variables in <code class=
1.14 xtraeme 3196: "filename">/etc/mk.conf</code>. Look at <code class=
3197: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 3198: details of the default settings. You will want to
1.14 xtraeme 3199: ensure that <code class=
3200: "varname">ACCEPTABLE_LICENSES</code> meet your local
3201: policy. As used in this example, <code class=
3202: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 3203: "emphasis"><em>all</em></span> licenses.</p>
3204: <pre class="programlisting">
3205: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
3206: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
3207: BSDSRCDIR= /usr/src
3208: BSDXSRCDIR= /usr/xsrc # for x11/xservers
3209: OBJHOSTNAME?= yes # use work.`hostname`
3210: FAILOVER_FETCH= yes # insist on the correct checksum
3211: PKG_DEVELOPER?= yes
3212: _ACCEPTABLE= yes
3213: </pre>
3214: </div>
3215:
3216: <div class="sect3" lang="en" xml:lang="en">
3217: <div class="titlepage">
3218: <div>
3219: <div>
1.30 wiz 3220: <h4 class="title"><a name="build.conf" id=
3221: "build.conf"></a>5.3.1.2. <code class=
1.14 xtraeme 3222: "filename">build.conf</code></h4>
1.1 grant 3223: </div>
3224: </div>
3225: </div>
3226:
1.14 xtraeme 3227: <p>In <code class="filename">pkgsrc/mk/bulk</code>,
3228: copy <code class="filename">build.conf-example</code>
3229: to <code class="filename">build.conf</code> and edit
3230: it, following the comments in that file. This is the
1.1 grant 3231: config file that determines where log files are
3232: generated after the build, where to mail the build
1.23 wiz 3233: report to, where your pkgsrc tree is located and the
3234: user to which user to <a href=
1.1 grant 3235: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
3236: <span class="citerefentry"><span class=
1.23 wiz 3237: "refentrytitle">su</span>(8)</span></a> to do a
1.14 xtraeme 3238: <span><strong class="command">cvs
3239: update</strong></span>.</p>
1.1 grant 3240: </div>
3241:
3242: <div class="sect3" lang="en" xml:lang="en">
3243: <div class="titlepage">
3244: <div>
3245: <div>
1.30 wiz 3246: <h4 class="title"><a name="pre-build.local" id=
3247: "pre-build.local"></a>5.3.1.3. <code class="filename">
3248: pre-build.local</code></h4>
1.1 grant 3249: </div>
3250: </div>
3251: </div>
3252:
3253: <p>It is possible to configure the bulk build to
3254: perform certain site specific tasks at the end of the
1.14 xtraeme 3255: pre-build stage. If the file <code class=
3256: "filename">pre-build.local</code> exists in
1.23 wiz 3257: <code class="filename">/usr/pkgsrc/mk/bulk</code>, it
1.24 wiz 3258: will be executed (as a <a href=
3259: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
3260: <span class="citerefentry"><span class=
3261: "refentrytitle">sh</span>(1)</span></a> script) at
3262: the end of the usual pre-build stage. An example use
3263: of <code class="filename">pre-build.local</code> is
3264: to have the line:</p>
1.1 grant 3265: <pre class="screen">
1.14 xtraeme 3266: <code class="prompt">#</code> <strong class=
3267: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 3268: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 3269: </pre>
3270:
3271: <p>to prevent the system from trying to build a
3272: particular package which requires nearly 3 GB of disk
3273: space.</p>
3274: </div>
3275: </div>
3276:
3277: <div class="sect2" lang="en" xml:lang="en">
3278: <div class="titlepage">
3279: <div>
3280: <div>
1.30 wiz 3281: <h3 class="title"><a name=
3282: "other-environmental-considerations" id=
3283: "other-environmental-considerations"></a>5.3.2. Other
3284: environmental considerations</h3>
1.1 grant 3285: </div>
3286: </div>
3287: </div>
3288:
1.14 xtraeme 3289: <p>As <code class="filename">/usr/pkg</code> will be
1.1 grant 3290: completely deleted at the start of bulk builds, make
3291: sure your login shell is placed somewhere else. Either
1.14 xtraeme 3292: drop it into <code class=
3293: "filename">/usr/local/bin</code> (and adjust your login
3294: shell in the passwd file), or (re-)install it via
3295: <a href=
1.1 grant 3296: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3297: <span class="citerefentry"><span class=
3298: "refentrytitle">pkg_add</span>(1)</span></a> from
1.14 xtraeme 3299: <code class="filename">/etc/rc.local</code>, so you can
1.1 grant 3300: login after a reboot (remember that your current
3301: process won't die if the package is removed, you just
3302: can't start any new instances of the shell any more).
3303: Also, if you use NetBSD earlier than 1.5, or you still
3304: want to use the pkgsrc version of ssh for some reason,
3305: be sure to install ssh before starting it from
1.14 xtraeme 3306: <code class="filename">rc.local</code>:</p>
1.1 grant 3307: <pre class="programlisting">
3308: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
3309: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
3310: /usr/pkg/etc/rc.d/sshd
3311: fi
3312: </pre>
3313:
3314: <p>Not doing so will result in you being not able to
3315: log in via ssh after the bulk build is finished or if
3316: the machine gets rebooted or crashes. You have been
3317: warned! :)</p>
3318: </div>
3319:
3320: <div class="sect2" lang="en" xml:lang="en">
3321: <div class="titlepage">
3322: <div>
3323: <div>
1.30 wiz 3324: <h3 class="title"><a name="operation" id=
3325: "operation"></a>5.3.3. Operation</h3>
1.1 grant 3326: </div>
3327: </div>
3328: </div>
3329:
3330: <p>Make sure you don't need any of the packages still
3331: installed.</p>
3332:
3333: <div class="warning" style=
3334: "margin-left: 0.5in; margin-right: 0.5in;">
3335: <h3 class="title">Warning</h3>
3336:
3337: <p>During the bulk build, <span class=
3338: "emphasis"><em>all packages will be
3339: removed!</em></span></p>
3340: </div>
3341:
3342: <p>Be sure to remove all other things that might
3343: interfere with builds, like some libs installed in
1.14 xtraeme 3344: <code class="filename">/usr/local</code>, etc. then
3345: become root and type:</p>
1.1 grant 3346: <pre class="screen">
1.14 xtraeme 3347: <code class="prompt">#</code> <strong class=
3348: "userinput"><code>cd /usr/pkgsrc</code></strong>
3349: <code class="prompt">#</code> <strong class=
3350: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 3351: </pre>
3352:
3353: <p>If for some reason your last build didn't complete
3354: (power failure, system panic, ...), you can continue it
3355: by running:</p>
3356: <pre class="screen">
1.14 xtraeme 3357: <code class="prompt">#</code> <strong class=
3358: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 3359: </pre>
3360:
3361: <p>At the end of the bulk build, you will get a summary
3362: via mail, and find build logs in the directory
1.14 xtraeme 3363: specified by <code class="varname">FTP</code> in the
3364: <code class="filename">build.conf</code> file.</p>
1.1 grant 3365: </div>
3366:
3367: <div class="sect2" lang="en" xml:lang="en">
3368: <div class="titlepage">
3369: <div>
3370: <div>
1.30 wiz 3371: <h3 class="title"><a name="what-it-does" id=
3372: "what-it-does"></a>5.3.4. What it does</h3>
1.1 grant 3373: </div>
3374: </div>
3375: </div>
3376:
3377: <p>The bulk builds consist of three steps:</p>
3378:
3379: <div class="variablelist">
3380: <dl>
3381: <dt><span class="term">1. pre-build</span></dt>
3382:
3383: <dd>
3384: <p>The script updates your pkgsrc tree via
3385: (anon)cvs, then cleans out any broken distfiles,
3386: and removes all packages installed.</p>
3387: </dd>
3388:
3389: <dt><span class="term">2. the bulk
3390: build</span></dt>
3391:
3392: <dd>
3393: <p>This is basically “<span class=
3394: "quote">make bulk-package</span>” with an
3395: optimised order in which packages will be built.
3396: Packages that don't require other packages will
3397: be built first, and packages with many
3398: dependencies will be built later.</p>
3399: </dd>
3400:
3401: <dt><span class="term">3. post-build</span></dt>
3402:
3403: <dd>
3404: <p>Generates a report that's placed in the
1.14 xtraeme 3405: directory specified in the <code class=
3406: "filename">build.conf</code> file named
3407: <code class="filename">broken.html</code>, a
3408: short version of that report will also be mailed
3409: to the build's admin.</p>
1.1 grant 3410: </dd>
3411: </dl>
3412: </div>
3413:
3414: <p>During the build, a list of broken packages will be
1.14 xtraeme 3415: compiled in <code class=
3416: "filename">/usr/pkgsrc/.broken</code> (or <code class=
3417: "filename">.../.broken.${MACHINE}</code> if
3418: <code class="varname">OBJMACHINE</code> is set),
3419: individual build logs of broken builds can be found in
3420: the package's directory. These files are used by the
3421: bulk-targets to mark broken builds to not waste time
3422: trying to rebuild them, and they can be used to debug
3423: these broken package builds later.</p>
1.1 grant 3424: </div>
3425:
3426: <div class="sect2" lang="en" xml:lang="en">
3427: <div class="titlepage">
3428: <div>
3429: <div>
1.30 wiz 3430: <h3 class="title"><a name=
3431: "disk-space-requirements" id=
3432: "disk-space-requirements"></a>5.3.5. Disk
3433: space requirements</h3>
1.1 grant 3434: </div>
3435: </div>
3436: </div>
3437:
3438: <p>Currently, roughly the following requirements are
3439: valid for NetBSD 2.0/i386:</p>
3440:
3441: <div class="itemizedlist">
3442: <ul type="disc">
3443: <li>
3444: <p>10 GB - distfiles (NFS ok)</p>
3445: </li>
3446:
3447: <li>
3448: <p>8 GB - full set of all binaries (NFS ok)</p>
3449: </li>
3450:
3451: <li>
3452: <p>5 GB - temp space for compiling (local disk
3453: recommended)</p>
3454: </li>
3455: </ul>
3456: </div>
3457:
3458: <p>Note that all pkgs will be de-installed as soon as
3459: they are turned into a binary package, and that sources
3460: are removed, so there is no excessively huge demand to
3461: disk space. Afterwards, if the package is needed again,
3462: it will be installed via <a href=
3463: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3464: <span class="citerefentry"><span class=
3465: "refentrytitle">pkg_add</span>(1)</span></a> instead of
3466: building again, so there are no cycles wasted by
3467: recompiling.</p>
3468: </div>
3469:
3470: <div class="sect2" lang="en" xml:lang="en">
3471: <div class="titlepage">
3472: <div>
3473: <div>
1.30 wiz 3474: <h3 class="title"><a name="setting-up-a-sandbox"
3475: id="setting-up-a-sandbox"></a>5.3.6. Setting
3476: up a sandbox for chroot'ed builds</h3>
1.1 grant 3477: </div>
3478: </div>
3479: </div>
3480:
1.12 agc 3481: <p>If you don't want all the packages nuked from a
3482: machine (rendering it useless for anything but pkg
1.23 wiz 3483: compiling), there is the possibility of doing the
3484: package bulk build inside a chroot environment.</p>
1.12 agc 3485:
3486: <p>The first step is to set up a chroot sandbox, e.g.
1.14 xtraeme 3487: <code class="filename">/usr/sandbox</code>. This can be
1.12 agc 3488: done by using null mounts, or manually.</p>
3489:
1.14 xtraeme 3490: <p>There is a shell script called <code class=
3491: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
3492: set up the sandbox environment using null mounts. It
3493: will also create a script called <code class=
3494: "filename">sandbox</code> in the root of the sandbox
1.12 agc 3495: environment, which will allow the null mounts to be
1.14 xtraeme 3496: activated using the <span><strong class=
3497: "command">sandbox mount</strong></span> command and
3498: deactivated using the <span><strong class=
3499: "command">sandbox umount</strong></span> command.</p>
1.12 agc 3500:
3501: <p>To set up a sandbox environment by hand, after
3502: extracting all the sets from a NetBSD installation or
1.14 xtraeme 3503: doing a <span><strong class="command">make distribution
3504: DESTDIR=/usr/sandbox</strong></span> in <code class=
3505: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 3506: items are present and properly configured:</p>
1.1 grant 3507:
3508: <div class="procedure">
3509: <ol type="1">
3510: <li>
3511: <p>Kernel</p>
3512: <pre class="screen">
1.14 xtraeme 3513: <code class="prompt">#</code> <strong class=
3514: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 3515: </pre>
3516: </li>
3517:
3518: <li>
1.14 xtraeme 3519: <p><code class="filename">/dev/*</code></p>
1.1 grant 3520: <pre class="screen">
1.14 xtraeme 3521: <code class="prompt">#</code> <strong class=
3522: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 3523: </pre>
3524: </li>
3525:
3526: <li>
1.14 xtraeme 3527: <p><code class="filename">/etc/resolv.conf</code>
1.1 grant 3528: (for <a xmlns=
3529: "http://www.w3.org/TR/xhtml1/transitional" href=
3530: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20 ben 3531: class="pkgname">security/smtpd</a> and mail):</p>
1.1 grant 3532: <pre class="screen">
1.14 xtraeme 3533: <code class="prompt">#</code> <strong class=
3534: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 3535: </pre>
3536: </li>
3537:
3538: <li>
3539: <p>Working(!) mail config (hostname,
3540: sendmail.cf):</p>
3541: <pre class="screen">
1.14 xtraeme 3542: <code class="prompt">#</code> <strong class=
3543: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 3544: </pre>
3545: </li>
3546:
3547: <li>
1.14 xtraeme 3548: <p><code class="filename">/etc/localtime</code>
3549: (for <a xmlns=
1.1 grant 3550: "http://www.w3.org/TR/xhtml1/transitional" href=
3551: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20 ben 3552: class="pkgname">security/smtpd</a>):</p>
1.1 grant 3553: <pre class="screen">
1.14 xtraeme 3554: <code class="prompt">#</code> <strong class=
3555: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 3556: </pre>
3557: </li>
3558:
3559: <li>
1.14 xtraeme 3560: <p><code class="filename">/usr/src</code> (system
1.1 grant 3561: sources, for <a xmlns=
3562: "http://www.w3.org/TR/xhtml1/transitional" href=
3563: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.20 ben 3564: class="pkgname">sysutils/aperture</a>, <a xmlns=
3565: "http://www.w3.org/TR/xhtml1/transitional" href=
3566: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
3567: class="pkgname">net/ppp-mppe</a>):</p>
1.1 grant 3568: <pre class="screen">
1.14 xtraeme 3569: <code class="prompt">#</code> <strong class=
3570: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
3571: <code class="prompt">#</code> <strong class=
1.23 wiz 3572: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 3573: </pre>
3574: </li>
3575:
3576: <li>
1.14 xtraeme 3577: <p>Create <code class=
3578: "filename">/var/db/pkg</code> (not part of
3579: default install):</p>
1.1 grant 3580: <pre class="screen">
1.14 xtraeme 3581: <code class="prompt">#</code> <strong class=
3582: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 3583: </pre>
3584: </li>
3585:
3586: <li>
1.14 xtraeme 3587: <p>Create <code class="filename">/usr/pkg</code>
3588: (not part of default install):</p>
1.1 grant 3589: <pre class="screen">
1.14 xtraeme 3590: <code class="prompt">#</code> <strong class=
3591: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 3592: </pre>
3593: </li>
3594:
3595: <li>
1.14 xtraeme 3596: <p>Checkout pkgsrc via cvs into <code class=
3597: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 3598: <pre class="screen">
1.14 xtraeme 3599: <code class="prompt">#</code> <strong class=
3600: "userinput"><code>cd /usr/sandbox/usr</code></strong>
3601: <code class="prompt">#</code> <strong class=
3602: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 3603: </pre>
3604:
3605: <p>Do not mount/link this to the copy of your
3606: pkgsrc tree you do development in, as this will
3607: likely cause problems!</p>
3608: </li>
3609:
3610: <li>
1.14 xtraeme 3611: <p>Make <code class=
3612: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
3613: and <code class="filename">.../distfiles</code>
3614: point somewhere appropriate. NFS- and/or
3615: nullfs-mounts may come in handy!</p>
1.1 grant 3616: </li>
3617:
3618: <li>
1.14 xtraeme 3619: <p>Edit <code class=
3620: "filename">/etc/mk.conf</code>, see <a href=
3621: "#binary.mk.conf" title=
1.1 grant 3622: "5.3.1.1. /etc/mk.conf">Section 5.3.1.1,
3623: “/etc/mk.conf”</a>.</p>
3624: </li>
3625:
3626: <li>
1.14 xtraeme 3627: <p>Adjust <code class=
3628: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 3629: needs.</p>
3630: </li>
3631:
3632: <li>
1.14 xtraeme 3633: <p>If you have set <code class=
3634: "varname">CVS_USER</code> in <code class=
3635: "filename">build.conf</code>, make sure that
3636: account exists and can do a <span><strong class=
3637: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 3638: properly!</p>
3639: </li>
3640: </ol>
3641: </div>
3642:
3643: <p>When the chroot sandbox is setup, you can start the
3644: build with the following steps:</p>
3645: <pre class="screen">
1.14 xtraeme 3646: <code class="prompt">#</code> <strong class=
3647: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
3648: <code class="prompt">#</code> <strong class=
3649: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 3650: </pre>
3651:
3652: <p>This will just jump inside the sandbox and start
3653: building. At the end of the build, mail will be sent
3654: with the results of the build. Created binary pkgs will
1.14 xtraeme 3655: be in <code class=
3656: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 3657: (wherever that points/mounts to/from).</p>
3658: </div>
3659:
3660: <div class="sect2" lang="en" xml:lang="en">
3661: <div class="titlepage">
3662: <div>
3663: <div>
1.30 wiz 3664: <h3 class="title"><a name=
3665: "building-a-partial-set" id=
3666: "building-a-partial-set"></a>5.3.7. Building
3667: a partial set of packages</h3>
1.1 grant 3668: </div>
3669: </div>
3670: </div>
3671:
3672: <p>In addition to building a complete set of all
1.14 xtraeme 3673: packages in pkgsrc, the <code class=
3674: "filename">pkgsrc/mk/bulk/build</code> script may be
3675: used to build a subset of the packages contained in
3676: pkgsrc. By setting defining <code class=
3677: "varname">SPECIFIC_PKGS</code> in <code class=
3678: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 3679:
3680: <div class="itemizedlist">
3681: <ul type="disc">
3682: <li>
3683: <p>SITE_SPECIFIC_PKGS</p>
3684: </li>
3685:
3686: <li>
3687: <p>HOST_SPECIFIC_PKGS</p>
3688: </li>
3689:
3690: <li>
3691: <p>GROUP_SPECIFIC_PKGS</p>
3692: </li>
3693:
3694: <li>
3695: <p>USER_SPECIFIC_PKGS</p>
3696: </li>
3697: </ul>
3698: </div>
3699:
3700: <p>will define the set of packages which should be
3701: built. The bulk build code will also include any
3702: packages which are needed as dependencies for the
3703: explicitly listed packages.</p>
3704:
3705: <p>One use of this is to do a bulk build with
1.14 xtraeme 3706: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 3707: sandbox periodically to have a complete set of the
3708: binary packages needed for your site available without
3709: the overhead of building extra packages that are not
3710: needed.</p>
3711: </div>
1.13 hubertf 3712:
3713: <div class="sect2" lang="en" xml:lang="en">
3714: <div class="titlepage">
3715: <div>
3716: <div>
3717: <h3 class="title"><a name="bulk-upload" id=
3718: "bulk-upload"></a>5.3.8. Uploading results
3719: of a bulk build</h3>
3720: </div>
3721: </div>
3722: </div>
3723:
3724: <p>This section describes how pkgsrc developers can
3725: upload binary pkgs built by bulk builds to
3726: ftp.NetBSD.org.</p>
3727:
1.17 sketch 3728: <p>If you would like to automatically create checksum
3729: files for the binary packages you intend to upload,
3730: remember to set <code class="varname">MKSUMS=yes</code>
3731: in your <code class=
3732: "filename">mk/bulk/build.conf</code>.</p>
3733:
3734: <p>If you would like to PGP sign the checksum files
3735: (highly recommended!), remember to set <code class=
3736: "varname">SIGN_AS=username@NetBSD.org</code> in your
3737: <code class="filename">mk/bulk/build.conf</code>. This
1.23 wiz 3738: will prompt you for your GPG password to sign the files
1.17 sketch 3739: before uploading everything.</p>
3740:
3741: <p>Then, make sure that you have <code class=
1.14 xtraeme 3742: "varname">RSYNC_DST</code> set properly in your
3743: <code class="filename">mk/bulk/build.conf</code> file,
3744: i.e. adjust it to something like one of the
3745: following:</p>
1.13 hubertf 3746: <pre class="screen">
3747: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3748: </pre>
3749:
1.23 wiz 3750: <p>Please use appropviate values for "pkgsrc-200xQy",
1.13 hubertf 3751: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 3752: ftp.NetBSD.org is different from <code class=
3753: "varname">CVS_USER</code>, write your login directly
3754: into the variable, e.g. my local account is "feyrer",
3755: but for my login "hubertf", I use:</p>
1.13 hubertf 3756: <pre class="screen">
3757: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3758: </pre>
3759:
1.14 xtraeme 3760: <p>A separate <code class="filename">upload</code>
1.13 hubertf 3761: directory is used here to allow "closing" the directory
3762: during upload. To do so, run the following command on
3763: ftp.NetBSD.org next:</p>
3764: <pre class="screen">
1.14 xtraeme 3765: nbftp% <strong class=
3766: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 3767: </pre>
3768:
1.14 xtraeme 3769: <p>Please note that <code class=
3770: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 3771: appropriate for packages for the NetBSD operating
3772: system. Binary packages for other operating systems
1.14 xtraeme 3773: should go into <code class=
3774: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 3775:
3776: <p>Before uploading the binary pkgs, ssh authentication
1.23 wiz 3777: needs to be set up. This example shows how to setup
1.13 hubertf 3778: temporary keys for the root account <span class=
3779: "emphasis"><em>inside the sandbox</em></span> (assuming
3780: that no keys should be present there usually):</p>
3781: <pre class="screen">
1.14 xtraeme 3782: <code class="prompt">#</code> <strong class=
3783: "userinput"><code>chroot /usr/sandbox</code></strong>
3784: chroot-<code class="prompt">#</code> <strong class=
3785: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
3786: chroot-<code class="prompt">#</code> <strong class=
3787: "userinput"><code>ssh-keygen -t dsa</code></strong>
3788: chroot-<code class="prompt">#</code> <strong class=
3789: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 3790: </pre>
3791:
1.14 xtraeme 3792: <p>Now take the output of <code class=
3793: "filename">id-dsa.pub</code> and append it to your
3794: <code class="filename">~/.ssh/authorized_keys</code>
1.17 sketch 3795: file on ftp.NetBSD.org. You can remove the key after
1.14 xtraeme 3796: the upload is done!</p>
1.13 hubertf 3797:
3798: <p>Next, test if your ssh connection really works:</p>
3799: <pre class="screen">
1.14 xtraeme 3800: chroot-<code class="prompt">#</code> <strong class=
3801: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 3802: </pre>
3803:
3804: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
3805:
3806: <p>Now after all this works, you can exit the sandbox
3807: and start the upload:</p>
3808: <pre class="screen">
1.14 xtraeme 3809: chroot-<code class="prompt">#</code> <strong class=
3810: "userinput"><code>exit</code></strong>
3811: <code class="prompt">#</code> <strong class=
3812: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
3813: <code class="prompt">#</code> <strong class=
3814: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 3815: </pre>
3816:
3817: <p>The upload process may take quite some time. Use
1.24 wiz 3818: <a href=
3819: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
3820: <span class="citerefentry"><span class=
3821: "refentrytitle">ls</span>(1)</span></a> or <a href=
3822: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
3823: <span class="citerefentry"><span class=
3824: "refentrytitle">du</span>(1)</span></a> on the FTP
3825: server to monitor progress of the upload. The upload
3826: script will take care of not uploading restricted
3827: packages and putting vulnerable packages into the
3828: <code class="filename">vulnerable</code>
3829: subdirectory.</p>
1.13 hubertf 3830:
3831: <p>After the upload has ended, first thing is to revoke
3832: ssh access:</p>
3833: <pre class="screen">
1.14 xtraeme 3834: nbftp% <strong class=
3835: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 3836: Gdd:x!
3837: </pre>
3838:
3839: <p>Use whatever is needed to remove the key you've
3840: entered before! Last, move the uploaded packages out of
1.14 xtraeme 3841: the <code class="filename">upload</code> directory to
3842: have them accessible to everyone:</p>
1.13 hubertf 3843: <pre class="screen">
1.14 xtraeme 3844: nbftp% <strong class=
3845: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
3846: nbftp% <strong class=
3847: "userinput"><code>mv upload/* .</code></strong>
3848: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
3849: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 3850: </pre>
3851: </div>
1.1 grant 3852: </div>
3853:
3854: <div class="sect1" lang="en" xml:lang="en">
3855: <div class="titlepage">
3856: <div>
3857: <div>
3858: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3859: "creating-cdroms" id=
3860: "creating-cdroms"></a>5.4. Creating a multiple
3861: CD-ROM packages collection</h2>
1.1 grant 3862: </div>
3863: </div>
3864: </div>
3865:
3866: <p>After your pkgsrc bulk-build has completed, you may
3867: wish to create a CD-ROM set of the resulting binary
3868: packages to assist in installing packages on other
3869: machines. The <a xmlns=
3870: "http://www.w3.org/TR/xhtml1/transitional" href=
3871: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.20 ben 3872: class="pkgname">pkgtools/cdpack</a> package provides a
3873: simple tool for creating the ISO 9660 images.
3874: <span><strong class="command">cdpack</strong></span>
3875: arranges the packages on the CD-ROMs in a way that keeps
3876: all the dependencies for given package on the same CD as
3877: that package.</p>
1.1 grant 3878:
3879: <div class="sect2" lang="en" xml:lang="en">
3880: <div class="titlepage">
3881: <div>
3882: <div>
1.30 wiz 3883: <h3 class="title"><a name="cdpack-example" id=
3884: "cdpack-example"></a>5.4.1. Example of
1.1 grant 3885: cdpack</h3>
3886: </div>
3887: </div>
3888: </div>
3889:
3890: <p>Complete documentation for cdpack is found in the
3891: cdpack(1) manpage. The following short example assumes
1.14 xtraeme 3892: that the binary packages are left in <code class=
3893: "filename">/usr/pkgsrc/packages/All</code> and that
3894: sufficient disk space exists in <code class=
3895: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 3896: <pre class="screen">
1.14 xtraeme 3897: <code class="prompt">#</code> <strong class=
3898: "userinput"><code>mkdir /u2/images</code></strong>
3899: <code class="prompt">#</code> <strong class=
3900: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
3901: <code class="prompt">#</code> <strong class=
3902: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 3903: </pre>
3904:
3905: <p>If you wish to include a common set of files
1.14 xtraeme 3906: (<code class="filename">COPYRIGHT</code>, <code class=
3907: "filename">README</code>, etc.) on each CD in the
1.1 grant 3908: collection, then you need to create a directory which
3909: contains these files. e.g.</p>
3910: <pre class="screen">
1.14 xtraeme 3911: <code class="prompt">#</code> <strong class=
3912: "userinput"><code>mkdir /tmp/common</code></strong>
3913: <code class="prompt">#</code> <strong class=
3914: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
3915: <code class="prompt">#</code> <strong class=
3916: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
3917: <code class="prompt">#</code> <strong class=
3918: "userinput"><code>mkdir /tmp/common/bin</code></strong>
3919: <code class="prompt">#</code> <strong class=
3920: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
3921: <code class="prompt">#</code> <strong class=
3922: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
3923: <code class="prompt">#</code> <strong class=
3924: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 3925: </pre>
3926:
3927: <p>Now create the images:</p>
3928: <pre class="screen">
1.14 xtraeme 3929: <code class="prompt">#</code> <strong class=
3930: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 3931: </pre>
3932:
1.14 xtraeme 3933: <p>Each image will contain <code class=
3934: "filename">README</code>, <code class=
3935: "filename">COPYING</code>, and <code class=
3936: "filename">bin/myscript</code> in their root
1.1 grant 3937: directories.</p>
3938: </div>
3939: </div>
3940: </div>
3941:
3942: <div class="chapter" lang="en" xml:lang="en">
3943: <div class="titlepage">
3944: <div>
3945: <div>
3946: <h2 class="title"><a name="faq" id=
3947: "faq"></a>Chapter 6. Frequently Asked
3948: Questions</h2>
3949: </div>
3950: </div>
3951: </div>
3952:
3953: <div class="toc">
3954: <p><b>Table of Contents</b></p>
3955:
3956: <dl>
1.30 wiz 3957: <dt><span class="sect1"><a href=
3958: "#mailing-list-pointers">6.1. Are there any mailing
3959: lists for pkg-related discussion?</a></span></dt>
1.1 grant 3960:
1.30 wiz 3961: <dt><span class="sect1"><a href="#pkgviews-docs">6.2.
1.1 grant 3962: Where's the pkgviews documentation?</a></span></dt>
3963:
1.5 hubertf 3964: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 3965: Utilities for package management
3966: (pkgtools)</a></span></dt>
3967:
1.30 wiz 3968: <dt><span class="sect1"><a href="#non-root-pkgsrc">6.4.
3969: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 3970:
1.30 wiz 3971: <dt><span class="sect1"><a href=
3972: "#resume-transfers">6.5. How to resume transfers when
3973: fetching distfiles?</a></span></dt>
1.14 xtraeme 3974:
1.30 wiz 3975: <dt><span class="sect1"><a href=
3976: "#XFree86-from-pkgsrc">6.6. How can I install/use
3977: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 3978:
1.30 wiz 3979: <dt><span class="sect1"><a href=
3980: "#x.org-from-pkgsrc">6.7. How can I install/use X.org
3981: from pkgsrc?</a></span></dt>
1.1 grant 3982:
1.30 wiz 3983: <dt><span class="sect1"><a href=
3984: "#fetch-behind-firewall">6.8. How to fetch files from
3985: behind a firewall</a></span></dt>
1.1 grant 3986:
1.30 wiz 3987: <dt><span class="sect1"><a href="#passive-ftp">6.9. How
1.14 xtraeme 3988: do I tell <span><strong class="command">make
3989: fetch</strong></span> to do passive
3990: FTP?</a></span></dt>
1.1 grant 3991:
1.30 wiz 3992: <dt><span class="sect1"><a href=
3993: "#fetching-all-distfiles">6.10. How to fetch all
3994: distfiles at once</a></span></dt>
1.1 grant 3995:
1.30 wiz 3996: <dt><span class="sect1"><a href=
3997: "#tmac.andoc-missing">6.11. What does
3998: “<span class="quote">Don't know how to make
1.14 xtraeme 3999: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 4000: mean?</a></span></dt>
4001:
1.30 wiz 4002: <dt><span class="sect1"><a href=
4003: "#bsd.own.mk-missing">6.12. What does
4004: “<span class="quote">Could not find
1.14 xtraeme 4005: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 4006:
1.30 wiz 4007: <dt><span class="sect1"><a href=
4008: "#using-sudo-with-pkgsrc">6.13. Using 'sudo' with
4009: pkgsrc</a></span></dt>
1.1 grant 4010:
1.14 xtraeme 4011: <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1 grant 4012: Configuration files handling and
4013: placement</a></span></dt>
4014:
1.14 xtraeme 4015: <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1 grant 4016: Automated security checks</a></span></dt>
4017: </dl>
4018: </div>
4019:
4020: <p>This section contains hints, tips & tricks on
4021: special things in pkgsrc that we didn't find a better place
4022: for in the previous chapters, and it contains items for
4023: both pkgsrc users and developers.</p>
4024:
4025: <div class="sect1" lang="en" xml:lang="en">
4026: <div class="titlepage">
4027: <div>
4028: <div>
4029: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4030: "mailing-list-pointers" id=
4031: "mailing-list-pointers"></a>6.1. Are there any
4032: mailing lists for pkg-related discussion?</h2>
1.1 grant 4033: </div>
4034: </div>
4035: </div>
4036:
1.18 xtraeme 4037: <p>The following mailing lists may be of interest to
4038: pkgsrc users:</p>
4039:
4040: <div class="itemizedlist">
4041: <ul type="disc">
4042: <li>
4043: <p><a href=
4044: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.20 ben 4045: target="_top">pkgsrc-bugs</a> -- a list where
4046: problem reports related to pkgsrc are sent and
4047: discussed</p>
1.18 xtraeme 4048: </li>
4049:
4050: <li>
4051: <p><a href=
4052: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.20 ben 4053: target="_top">pkgsrc-bulk</a> -- a list where the
4054: results of pkgsrc bulk builds are sent and
4055: discussed</p>
1.18 xtraeme 4056: </li>
4057:
4058: <li>
4059: <p><a href=
4060: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.20 ben 4061: target="_top">pkgsrc-changes</a> -- a list where
4062: all commit messages to pkgsrc are sent</p>
1.18 xtraeme 4063: </li>
4064:
4065: <li>
4066: <p><a href=
4067: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.20 ben 4068: target="_top">tech-pkg</a> -- a general discussion
4069: list for all things related to pkgsrc</p>
1.18 xtraeme 4070: </li>
4071: </ul>
4072: </div>
4073:
4074: <p>To subscribe, do:</p>
1.1 grant 4075: <pre class="programlisting">
1.18 xtraeme 4076: <code class="prompt">%</code> echo subscribe <em class=
4077: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 4078: </pre>
4079:
1.18 xtraeme 4080: <p>Archives for all these mailing lists are available
4081: from <a href="http://mail-index.NetBSD.org/" target=
4082: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 4083: </div>
4084:
4085: <div class="sect1" lang="en" xml:lang="en">
4086: <div class="titlepage">
4087: <div>
4088: <div>
4089: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4090: "pkgviews-docs" id=
4091: "pkgviews-docs"></a>6.2. Where's the pkgviews
4092: documentation?</h2>
1.1 grant 4093: </div>
4094: </div>
4095: </div>
4096:
4097: <p>Pkgviews is tightly integrated with buildlink. You can
1.14 xtraeme 4098: find a pkgviews User's guide in <code class=
4099: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 4100: </div>
4101:
4102: <div class="sect1" lang="en" xml:lang="en">
4103: <div class="titlepage">
4104: <div>
4105: <div>
4106: <h2 class="title" style="clear: both"><a name=
1.5 hubertf 4107: "faq-pkgtools" id=
4108: "faq-pkgtools"></a>6.3. Utilities for package
4109: management (pkgtools)</h2>
1.1 grant 4110: </div>
4111: </div>
4112: </div>
4113:
1.14 xtraeme 4114: <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1 grant 4115: directory pkgtools contains a number of useful utilities
4116: for both users and developers of pkgsrc. This section
4117: attempts only to make the reader aware of the utilities
4118: and when they might be useful, and not to duplicate the
4119: documentation that comes with each package.</p>
4120:
4121: <p>Utilities used by pkgsrc (automatically installed when
4122: needed):</p>
4123:
4124: <div class="itemizedlist">
4125: <ul type="disc">
4126: <li>
4127: <p><a xmlns=
4128: "http://www.w3.org/TR/xhtml1/transitional" href=
4129: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.20 ben 4130: class="pkgname">pkgtools/x11-links</a>: symlinks
4131: for use by buildlink</p>
1.1 grant 4132: </li>
4133: </ul>
4134: </div>
4135:
4136: <p>OS tool augmentation (automatically installed when
4137: needed):</p>
4138:
4139: <div class="itemizedlist">
4140: <ul type="disc">
4141: <li>
4142: <p><a xmlns=
4143: "http://www.w3.org/TR/xhtml1/transitional" href=
4144: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20 ben 4145: class="pkgname">pkgtools/digest</a>: calculates
1.27 rillig 4146: various kinds of checksums (including SHA1)</p>
1.1 grant 4147: </li>
4148:
4149: <li>
4150: <p><a xmlns=
4151: "http://www.w3.org/TR/xhtml1/transitional" href=
4152: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.27 rillig 4153: class="pkgname">pkgtools/libnbcompat</a>:
4154: compatibility library for pkgsrc tools</p>
1.1 grant 4155: </li>
4156:
4157: <li>
4158: <p><a xmlns=
4159: "http://www.w3.org/TR/xhtml1/transitional" href=
4160: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.20 ben 4161: class="pkgname">pkgtools/mtree</a>: installed on
4162: non-BSD systems due to lack of native mtree</p>
1.1 grant 4163: </li>
4164:
4165: <li>
4166: <p><a xmlns=
4167: "http://www.w3.org/TR/xhtml1/transitional" href=
4168: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4169: class="pkgname">pkgtools/pkg_install</a>:
4170: up-to-date replacement for /usr/sbin/pkg_install,
4171: or for use on operating systems where pkg_install
4172: is not present</p>
1.1 grant 4173: </li>
4174: </ul>
4175: </div>
4176:
4177: <p>Utilities used by pkgsrc (not automatically
4178: installed):</p>
4179:
4180: <div class="itemizedlist">
4181: <ul type="disc">
4182: <li>
4183: <p><a xmlns=
4184: "http://www.w3.org/TR/xhtml1/transitional" href=
4185: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.20 ben 4186: class="pkgname">pkgtools/pkg_tarup</a>: create a
4187: binary package from an already-installed package.
1.27 rillig 4188: used by <span><strong class="command">make
4189: replace</strong></span> to save the old package</p>
1.1 grant 4190: </li>
4191:
4192: <li>
4193: <p><a xmlns=
4194: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 4195: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.20 ben 4196: class="pkgname">pkgtools/dfdisk</a>: adds extra
4197: functionality to pkgsrc, allowing it to fetch
4198: distfiles from multiple locations. It currently
4199: supports the following methods: multiple CD-ROMs
4200: and network FTP/HTTP connections.</p>
1.5 hubertf 4201: </li>
4202:
4203: <li>
4204: <p><a xmlns=
4205: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4206: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20 ben 4207: class="pkgname">pkgtools/xpkgwedge</a>: put X11
4208: packages someplace else (enabled by default)</p>
1.1 grant 4209: </li>
1.5 hubertf 4210:
4211: <li>
4212: <p><a xmlns=
4213: "http://www.w3.org/TR/xhtml1/transitional" href=
4214: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20 ben 4215: class="pkgname">devel/cpuflags</a>: will determine
4216: the best compiler flags to optimise code for your
4217: current CPU and compiler.</p>
1.5 hubertf 4218: </li>
1.1 grant 4219: </ul>
4220: </div>
4221:
4222: <p>Utilities for keeping track of installed packages,
4223: being up to date, etc:</p>
4224:
4225: <div class="itemizedlist">
4226: <ul type="disc">
4227: <li>
4228: <p><a xmlns=
4229: "http://www.w3.org/TR/xhtml1/transitional" href=
4230: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.27 rillig 4231: class="pkgname">pkgtools/pkg_chk</a>: reports on
4232: packages whose installed versions do not match the
4233: latest pkgsrc entries</p>
1.1 grant 4234: </li>
4235:
4236: <li>
4237: <p><a xmlns=
4238: "http://www.w3.org/TR/xhtml1/transitional" href=
4239: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.20 ben 4240: class="pkgname">pkgtools/pkgdep</a>: makes
4241: dependency graphs of packages, to aid in choosing a
4242: strategy for updating</p>
1.1 grant 4243: </li>
4244:
4245: <li>
4246: <p><a xmlns=
4247: "http://www.w3.org/TR/xhtml1/transitional" href=
4248: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.27 rillig 4249: class="pkgname">pkgtools/pkgdepgraph</a>: makes
4250: graphs from the output of <a xmlns=
4251: "http://www.w3.org/TR/xhtml1/transitional" href=
4252: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
4253: class="pkgname">pkgtools/pkgdep</a> (uses
4254: graphviz)</p>
1.1 grant 4255: </li>
4256:
4257: <li>
4258: <p><a xmlns=
4259: "http://www.w3.org/TR/xhtml1/transitional" href=
4260: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.27 rillig 4261: class="pkgname">pkgtools/pkglint</a>: the
4262: pkglint(1) program checks a pkgsrc entry for
4263: errors, lintpkgsrc(1) does various checks on the
4264: complete pkgsrc system.</p>
1.1 grant 4265: </li>
4266:
4267: <li>
4268: <p><a xmlns=
4269: "http://www.w3.org/TR/xhtml1/transitional" href=
4270: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.20 ben 4271: class="pkgname">pkgtools/pkgsurvey</a>: report what
4272: packages you have installed</p>
1.1 grant 4273: </li>
4274: </ul>
4275: </div>
4276:
4277: <p>Utilities for people maintaining or creating
4278: individual packages:</p>
4279:
4280: <div class="itemizedlist">
4281: <ul type="disc">
4282: <li>
4283: <p><a xmlns=
4284: "http://www.w3.org/TR/xhtml1/transitional" href=
4285: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 4286: class="pkgname">pkgtools/pkgdiff</a>: automate
4287: making and maintaining patches for a package
4288: (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1 grant 4289: </li>
4290:
4291: <li>
4292: <p><a xmlns=
4293: "http://www.w3.org/TR/xhtml1/transitional" href=
4294: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.20 ben 4295: class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
4296: "http://www.w3.org/TR/xhtml1/transitional" href=
4297: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
4298: class="pkgname">pkgtools/url2pkg</a>: aids in
4299: converting to pkgsrc</p>
1.1 grant 4300: </li>
4301:
4302: <li>
4303: <p><a xmlns=
4304: "http://www.w3.org/TR/xhtml1/transitional" href=
4305: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.20 ben 4306: class="pkgname">pkgtools/gensolpkg</a>: convert
4307: pkgsrc to a Solaris package</p>
1.1 grant 4308: </li>
4309: </ul>
4310: </div>
4311:
4312: <p>Utilities for people maintaining pkgsrc (or more
4313: obscure pkg utilities)</p>
4314:
4315: <div class="itemizedlist">
4316: <ul type="disc">
4317: <li>
4318: <p><a xmlns=
4319: "http://www.w3.org/TR/xhtml1/transitional" href=
4320: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.20 ben 4321: class="pkgname">pkgtools/pkgconflict</a>: find
4322: packages that conflict but aren't marked as
4323: such</p>
1.1 grant 4324: </li>
4325:
4326: <li>
4327: <p><a xmlns=
4328: "http://www.w3.org/TR/xhtml1/transitional" href=
4329: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.20 ben 4330: class="pkgname">pkgtools/pkg_comp</a>: build
4331: packages in a chrooted area</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/libkver/README.html"
1.20 ben 4338: class="pkgname">pkgtools/libkver</a>: spoof kernel
4339: version for chrooted cross builds</p>
1.1 grant 4340: </li>
4341: </ul>
4342: </div>
4343: </div>
4344:
4345: <div class="sect1" lang="en" xml:lang="en">
4346: <div class="titlepage">
4347: <div>
4348: <div>
4349: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4350: "non-root-pkgsrc" id=
4351: "non-root-pkgsrc"></a>6.4. How to use pkgsrc
4352: as non-root</h2>
1.1 grant 4353: </div>
4354: </div>
4355: </div>
4356:
4357: <p>If you want to use pkgsrc as non-root user, you can
4358: set some variables to make pkgsrc work under these
1.33 ! jmmv 4359: conditions. At the very least, you need to set
! 4360: <code class="varname">UNPRIVILEGED</code> to
! 4361: “<span class="quote">yes</span>”; this will
! 4362: turn on unprivileged mode and set multiple related
! 4363: variables to allow installation of packages as
! 4364: non-root.</p>
! 4365:
! 4366: <p>In case the defaults are not enough, you may want to
! 4367: tune some other variables used. For example, if the
! 4368: automatic user/group detection leads to incorrect values
! 4369: (or not the ones you would like to use), you can change
! 4370: them by setting <code class=
! 4371: "varname">UNPRIVILEGED_USER</code> and <code class=
! 4372: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
! 4373:
! 4374: <p>As regards bootstrapping, please note that the
! 4375: <span><strong class="command">bootstrap</strong></span>
! 4376: script will ease non-root configuration when given the
! 4377: “<span class=
! 4378: "quote">--ignore-user-check</span>” flag, as it
! 4379: will choose and use multiple default directories under
! 4380: <code class="filename">~/pkg</code> as the installation
! 4381: targets. These directories can be overriden by the
! 4382: “<span class="quote">--prefix</span>” flag
! 4383: provided by the script, as well as some others that allow
! 4384: finer tuning of the tree layout.</p>
1.14 xtraeme 4385: </div>
4386:
4387: <div class="sect1" lang="en" xml:lang="en">
4388: <div class="titlepage">
4389: <div>
4390: <div>
4391: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4392: "resume-transfers" id=
4393: "resume-transfers"></a>6.5. How to resume
4394: transfers when fetching distfiles?</h2>
1.14 xtraeme 4395: </div>
4396: </div>
4397: </div>
4398:
1.15 xtraeme 4399: <p>By default resuming transfers in pkgsrc is disabled,
4400: but you can enable this feature by adding the option
4401: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
4402: into <code class="filename">/etc/mk.conf</code>. If,
4403: during a fetch step, an incomplete distfile is found,
4404: pkgsrc will try to resume it.</p>
4405:
4406: <p>You can also use a different program than the default
1.24 wiz 4407: <a href=
4408: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
4409: <span class="citerefentry"><span class=
4410: "refentrytitle">ftp</span>(1)</span></a> by changing the
4411: <code class="varname">FETCH_CMD</code> variable. Don't
4412: forget to set <code class=
4413: "varname">FETCH_RESUME_ARGS</code> and <code class=
4414: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
4415: default values.</p>
1.14 xtraeme 4416:
4417: <p>For example, if you want to use <code class=
4418: "filename">wget</code> to resume downloads, you'll have
4419: to use something like:</p>
4420: <pre class="programlisting">
4421: FETCH_CMD=wget
4422: FETCH_BEFORE_ARGS=--passive-ftp
4423: FETCH_RESUME_ARGS=-c
4424: FETCH_OUTPUT_ARGS=-O
4425:
4426: </pre>
1.1 grant 4427: </div>
4428:
4429: <div class="sect1" lang="en" xml:lang="en">
4430: <div class="titlepage">
4431: <div>
4432: <div>
4433: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4434: "XFree86-from-pkgsrc" id=
4435: "XFree86-from-pkgsrc"></a>6.6. How can I
1.1 grant 4436: install/use XFree86 from pkgsrc?</h2>
4437: </div>
4438: </div>
4439: </div>
4440:
4441: <p>If you want to use XFree86 from pkgsrc instead of your
1.14 xtraeme 4442: system's own X11 (<code class=
4443: "filename">/usr/X11R6</code>, <code class=
4444: "filename">/usr/openwin</code>, ...), you will have to
4445: add the following line into <code class=
1.15 xtraeme 4446: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4447: <pre class="programlisting">
4448: X11_TYPE=XFree86
4449:
4450: </pre>
4451: </div>
4452:
4453: <div class="sect1" lang="en" xml:lang="en">
4454: <div class="titlepage">
4455: <div>
4456: <div>
4457: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4458: "x.org-from-pkgsrc" id=
4459: "x.org-from-pkgsrc"></a>6.7. How can I
1.1 grant 4460: install/use X.org from pkgsrc?</h2>
4461: </div>
4462: </div>
4463: </div>
4464:
4465: <p>If you want to use X.org from pkgsrc instead of your
1.14 xtraeme 4466: system's own X11 (<code class=
4467: "filename">/usr/X11R6</code>, <code class=
4468: "filename">/usr/openwin</code>, ...) you will have to add
4469: the following line into <code class=
1.15 xtraeme 4470: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4471: <pre class="programlisting">
4472: X11_TYPE=xorg
4473:
4474: </pre>
4475: </div>
4476:
4477: <div class="sect1" lang="en" xml:lang="en">
4478: <div class="titlepage">
4479: <div>
4480: <div>
4481: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4482: "fetch-behind-firewall" id=
4483: "fetch-behind-firewall"></a>6.8. How to fetch
4484: files from behind a firewall</h2>
1.1 grant 4485: </div>
4486: </div>
4487: </div>
4488:
4489: <p>If you are sitting behind a firewall which does not
4490: allow direct connections to Internet hosts (i.e.
4491: non-NAT), you may specify the relevant proxy hosts. This
4492: is done using an environment variable in the form of a
4493: URL e.g. in Amdahl, the machine “<span class=
4494: "quote">orpheus.amdahl.com</span>” is one of the
4495: firewalls, and it uses port 80 as the proxy port number.
4496: So the proxy environment variables are:</p>
4497: <pre class="programlisting">
4498: ftp_proxy=ftp://orpheus.amdahl.com:80/
4499: http_proxy=http://orpheus.amdahl.com:80/
4500: </pre>
4501: </div>
4502:
4503: <div class="sect1" lang="en" xml:lang="en">
4504: <div class="titlepage">
4505: <div>
4506: <div>
4507: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4508: "passive-ftp" id="passive-ftp"></a>6.9. How do
4509: I tell <span><strong class="command">make
1.14 xtraeme 4510: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 4511: </div>
4512: </div>
4513: </div>
4514:
4515: <p>This depends on which utility is used to retrieve
1.14 xtraeme 4516: distfiles. From <code class="filename">bsd.pkg.mk</code>,
4517: <code class="varname">FETCH_CMD</code> is assigned the
4518: first available command from the following list:</p>
1.1 grant 4519: <pre class="programlisting">
4520: ${LOCALBASE}/bin/ftp
4521: /usr/bin/ftp
4522: </pre>
4523:
4524: <p>On a default NetBSD installation, this will be
1.14 xtraeme 4525: <code class="filename">/usr/bin/ftp</code>, which
1.1 grant 4526: automatically tries passive connections first, and falls
4527: back to active connections if the server refuses to do
4528: passive. For the other tools, add the following to your
1.14 xtraeme 4529: <code class="filename">/etc/mk.conf</code> file:
4530: <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 4531:
1.14 xtraeme 4532: <p>Having that option present will prevent <code class=
4533: "filename">/usr/bin/ftp</code> from falling back to
4534: active transfers.</p>
1.1 grant 4535: </div>
4536:
4537: <div class="sect1" lang="en" xml:lang="en">
4538: <div class="titlepage">
4539: <div>
4540: <div>
4541: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4542: "fetching-all-distfiles" id=
4543: "fetching-all-distfiles"></a>6.10. How to
1.1 grant 4544: fetch all distfiles at once</h2>
4545: </div>
4546: </div>
4547: </div>
4548:
4549: <p>You would like to download all the distfiles in a
4550: single batch from work or university, where you can't run
1.14 xtraeme 4551: a <span><strong class="command">make
4552: fetch</strong></span>. There is an archive of distfiles
4553: on <a href=
1.1 grant 4554: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
4555: target="_top">ftp.NetBSD.org</a>, but downloading the
4556: entire directory may not be appropriate.</p>
4557:
1.14 xtraeme 4558: <p>The answer here is to do a <span><strong class=
4559: "command">make fetch-list</strong></span> in <code class=
4560: "filename">/usr/pkgsrc</code> or one of it's
1.1 grant 4561: subdirectories, carry the resulting list to your machine
1.23 wiz 4562: at work/school and use it there. If you don't have a
1.24 wiz 4563: NetBSD-compatible <a href=
4564: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
4565: <span class="citerefentry"><span class=
4566: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
4567: at work, don't forget to set <code class=
4568: "varname">FETCH_CMD</code> to something that fetches a
4569: URL:</p>
1.1 grant 4570:
4571: <p>At home:</p>
4572: <pre class="screen">
1.14 xtraeme 4573: <code class="prompt">%</code> <strong class=
4574: "userinput"><code>cd /usr/pkgsrc</code></strong>
4575: <code class="prompt">%</code> <strong class=
4576: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
4577: <code class="prompt">%</code> <strong class=
4578: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 4579: </pre>
4580:
4581: <p>At work:</p>
4582: <pre class="screen">
1.14 xtraeme 4583: <code class="prompt">%</code> <strong class=
4584: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 4585: </pre>
4586:
1.14 xtraeme 4587: <p>then tar up <code class=
4588: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 4589:
4590: <p>If you have a machine running NetBSD, and you want to
4591: get <span class="emphasis"><em>all</em></span> distfiles
4592: (even ones that aren't for your machine architecture),
4593: you can do so by using the above-mentioned
1.14 xtraeme 4594: <span><strong class="command">make
4595: fetch-list</strong></span> approach, or fetch the
4596: distfiles directly by running:</p>
1.1 grant 4597: <pre class="screen">
1.14 xtraeme 4598: <code class="prompt">%</code> <strong class=
4599: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 4600: </pre>
4601:
1.14 xtraeme 4602: <p>If you even decide to ignore <code class=
4603: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
4604: can get everything by running:</p>
1.1 grant 4605: <pre class="screen">
1.14 xtraeme 4606: <code class="prompt">%</code> <strong class=
4607: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 4608: </pre>
4609: </div>
4610:
4611: <div class="sect1" lang="en" xml:lang="en">
4612: <div class="titlepage">
4613: <div>
4614: <div>
4615: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4616: "tmac.andoc-missing" id=
4617: "tmac.andoc-missing"></a>6.11. What does
1.1 grant 4618: “<span class="quote">Don't know how to make
4619: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
4620: </div>
4621: </div>
4622: </div>
4623:
4624: <p>When compiling the <a xmlns=
4625: "http://www.w3.org/TR/xhtml1/transitional" href=
4626: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4627: class="pkgname">pkgtools/pkg_install</a> package, you get
4628: the error from make that it doesn't know how to make
4629: <code class="filename">/usr/share/tmac/tmac.andoc</code>?
4630: This indicates that you don't have installed the
1.23 wiz 4631: “<span class="quote">text</span>” set (nroff,
4632: ...) from the NetBSD base distribution on your machine.
4633: It is recommended to do that to format manpages.</p>
1.1 grant 4634:
4635: <p>In the case of the <a xmlns=
4636: "http://www.w3.org/TR/xhtml1/transitional" href=
4637: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4638: class="pkgname">pkgtools/pkg_install</a> package, you can
4639: get away with setting <code class=
4640: "varname">NOMAN=YES</code> either in the environment or
4641: in <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 4642: </div>
4643:
4644: <div class="sect1" lang="en" xml:lang="en">
4645: <div class="titlepage">
4646: <div>
4647: <div>
4648: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4649: "bsd.own.mk-missing" id=
4650: "bsd.own.mk-missing"></a>6.12. What does
1.1 grant 4651: “<span class="quote">Could not find
4652: bsd.own.mk</span>” mean?</h2>
4653: </div>
4654: </div>
4655: </div>
4656:
1.14 xtraeme 4657: <p>You didn't install the compiler set, <code class=
4658: "filename">comp.tgz</code>, when you installed your
4659: NetBSD machine. Please get it and install it, by
4660: extracting it in <code class="filename">/</code>:</p>
1.1 grant 4661: <pre class="screen">
1.14 xtraeme 4662: <code class="prompt">#</code> <strong class=
4663: "userinput"><code>cd /</code></strong>
4664: <code class="prompt">#</code> <strong class=
4665: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 4666: </pre>
4667:
1.14 xtraeme 4668: <p><code class="filename">comp.tgz</code> is part of
4669: every NetBSD release. Get the one that corresponds to
4670: your release (determine via <span><strong class=
4671: "command">uname -r</strong></span>).</p>
1.1 grant 4672: </div>
4673:
4674: <div class="sect1" lang="en" xml:lang="en">
4675: <div class="titlepage">
4676: <div>
4677: <div>
4678: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4679: "using-sudo-with-pkgsrc" id=
4680: "using-sudo-with-pkgsrc"></a>6.13. Using
1.1 grant 4681: 'sudo' with pkgsrc</h2>
4682: </div>
4683: </div>
4684: </div>
4685:
4686: <p>When installing packages as non-root user and using
1.24 wiz 4687: the just-in-time <a href=
4688: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
4689: <span class="citerefentry"><span class=
4690: "refentrytitle">su</span>(1)</span></a> feature of
4691: pkgsrc, it can become annoying to type in the root
4692: password for each required package installed. To avoid
4693: this, the sudo package can be used, which does password
4694: caching over a limited time. To use it, install sudo
4695: (either as binary package or from <a xmlns=
4696: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4697: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.20 ben 4698: class="pkgname">security/sudo</a>) and then put the
4699: following into your <code class=
4700: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4701: <pre class="programlisting">
1.23 wiz 4702: .if exists(${LOCALBASE}/bin/sudo)
4703: SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
1.1 grant 4704: .endif
4705:
4706: </pre>
4707: </div>
4708:
4709: <div class="sect1" lang="en" xml:lang="en">
4710: <div class="titlepage">
4711: <div>
4712: <div>
4713: <h2 class="title" style="clear: both"><a name=
4714: "faq.conf" id=
1.14 xtraeme 4715: "faq.conf"></a>6.14. Configuration files
1.1 grant 4716: handling and placement</h2>
4717: </div>
4718: </div>
4719: </div>
4720:
1.14 xtraeme 4721: <p>The global variable <code class=
4722: "varname">PKG_SYSCONFBASE</code> (and some others) can be
4723: set by the system administrator in <code class=
4724: "filename">/etc/mk.conf</code> to define the place where
1.1 grant 4725: configuration files get installed. Therefore, packages
4726: must be adapted to support this feature. Keep in mind
4727: that you should only install files that are strictly
4728: necessary in the configuration directory, files that can
1.14 xtraeme 4729: go to <code class="filename">$PREFIX/share</code> should
4730: go there.</p>
1.1 grant 4731:
4732: <p>We will take a look at available variables first
1.14 xtraeme 4733: (<code class="filename">bsd.pkg.mk</code> contains more
4734: information). <code class="varname">PKG_SYSCONFDIR</code>
4735: is where the configuration files for a package may be
4736: found (that is, the full path, e.g. <code class=
4737: "filename">/etc</code> or <code class=
4738: "filename">/usr/pkg/etc</code>). This value may be
1.1 grant 4739: customized in various ways:</p>
4740:
4741: <div class="orderedlist">
4742: <ol type="1">
4743: <li>
1.14 xtraeme 4744: <p><code class="varname">PKG_SYSCONFBASE</code> is
4745: the main config directory under which all package
1.1 grant 4746: configuration files are to be found. Users will
1.14 xtraeme 4747: typically want to set it to <code class=
4748: "filename">/etc</code>, or accept the default
4749: location of <code class=
4750: "filename">$PREFIX/etc</code>.</p>
1.1 grant 4751: </li>
4752:
4753: <li>
1.14 xtraeme 4754: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
4755: is the subdirectory of <code class=
4756: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 4757: configuration files for a particular package may be
1.14 xtraeme 4758: found. Defaults to <code class=
4759: "varname">${SYSCONFBASE}</code>.</p>
1.1 grant 4760: </li>
4761:
4762: <li>
1.14 xtraeme 4763: <p><code class="varname">PKG_SYSCONFVAR</code> is
4764: the special suffix used to distinguish any
4765: overriding values for a particular package (see
4766: next item). It defaults to <code class=
4767: "varname">${PKGBASE}</code>, but for a collection
4768: of related packages that should all have the same
4769: <code class="varname">PKG_SYSCONFDIR</code> value,
4770: it can be set in each of the package Makefiles to a
4771: common value.</p>
1.1 grant 4772: </li>
4773:
4774: <li>
1.14 xtraeme 4775: <p><code class=
4776: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
4777: overrides the value of <code class=
4778: "varname">${PKG_SYSCONFDIR}</code> for packages
4779: with the same value for <code class=
4780: "varname">PKG_SYSCONFVAR</code>.</p>
1.1 grant 4781:
4782: <p>As an example, all the various KDE packages may
1.14 xtraeme 4783: want to set <code class=
4784: "varname">PKG_SYSCONFVAR</code> to
4785: “<span class="quote">kde</span>” so
4786: admins can set <code class=
4787: "varname">PKG_SYSCONFDIR.kde</code> in <code class=
4788: "filename">/etc/mk.conf</code> to define where to
1.1 grant 4789: install KDE config files.</p>
4790: </li>
4791: </ol>
4792: </div>
4793:
4794: <p>Programs' configuration directory should be defined
4795: during the configure stage. Packages that use GNU
4796: autoconf can usually do this by using the
4797: “<span class="quote">--sysconfdir</span>”
4798: parameter, but this brings some problems as we will see
4799: now. When you change this pathname in packages, you
4800: should not allow them to install files in that directory
4801: directly. Instead they need to install those files under
1.14 xtraeme 4802: <code class="filename">share/examples/${PKGNAME}</code>
4803: so <code class="filename">PLIST</code> can register
4804: them.</p>
1.1 grant 4805:
4806: <p>Once you have the required configuration files in
1.14 xtraeme 4807: place (under the <code class=
4808: "filename">share/examples</code> directory) the variable
4809: <code class="varname">CONF_FILES</code> should be set to
4810: copy them into <code class=
4811: "varname">PKG_SYSCONFDIR</code>. The contents of this
4812: variable is formed by pairs of filenames; the first
1.1 grant 4813: element of the pair specifies the file inside the
1.14 xtraeme 4814: examples directory (registered by <code class=
4815: "filename">PLIST</code>) and the second element specifies
1.1 grant 4816: the target file. This is done this way to allow binary
4817: packages to place files in the right directory using
1.14 xtraeme 4818: <code class="filename">INSTALL</code>/<code class=
4819: "filename">DEINSTALL</code> scripts which are created
4820: automatically. The package <code class=
4821: "filename">Makefile</code> must also set <code class=
4822: "varname">USE_PKGINSTALL=YES</code> to use these
1.1 grant 4823: automatically generated scripts. The automatic copying of
4824: config files can be toggled by setting the environment
1.14 xtraeme 4825: variable <code class="varname">PKG_CONFIG</code> prior to
1.1 grant 4826: package installation.</p>
4827:
4828: <p>Here is an example, taken from mail/mutt/Makefile:</p>
4829: <pre class="programlisting">
4830: EGDIR= ${PREFIX}/share/doc/mutt/samples
4831: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
4832: </pre>
4833:
4834: <p>As you can see, this package installs configuration
1.14 xtraeme 4835: files inside <code class="varname">EGDIR</code>, which
4836: are registered by <code class="filename">PLIST</code>.
4837: After that, the variable <code class=
4838: "varname">CONF_FILES</code> lists the installed file
4839: first and then the target file. Users will also get an
4840: automatic message when files are installed using this
4841: method.</p>
1.1 grant 4842: </div>
4843:
4844: <div class="sect1" lang="en" xml:lang="en">
4845: <div class="titlepage">
4846: <div>
4847: <div>
4848: <h2 class="title" style="clear: both"><a name=
4849: "audit-packages" id=
1.14 xtraeme 4850: "audit-packages"></a>6.15. Automated security
1.1 grant 4851: checks</h2>
4852: </div>
4853: </div>
4854: </div>
4855:
4856: <p>Please be aware that there can often be bugs in
4857: third-party software, and some of these bugs can leave a
4858: machine vulnerable to exploitation by attackers. In an
4859: effort to lessen the exposure, the NetBSD packages team
4860: maintains a database of known-exploits to packages which
4861: have at one time been included in pkgsrc. The database
4862: can be downloaded automatically, and a security audit of
4863: all packages installed on a system can take place. To do
4864: this, install the <a xmlns=
4865: "http://www.w3.org/TR/xhtml1/transitional" href=
4866: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.20 ben 4867: class="pkgname">security/audit-packages</a> package. It
4868: has two components:</p>
1.1 grant 4869:
4870: <div class="orderedlist">
4871: <ol type="1">
4872: <li>
4873: <p>“<span class=
4874: "quote">download-vulnerability-list</span>”,
4875: an easy way to download a list of the security
4876: vulnerabilities information. This list is kept up
4877: to date by the NetBSD security officer and the
4878: NetBSD packages team, and is distributed from the
4879: NetBSD ftp server:</p>
4880:
4881: <p><a href=
4882: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 4883: target=
4884: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 4885: </li>
4886:
4887: <li>
4888: <p>“<span class=
4889: "quote">audit-packages</span>”, an easy way
4890: to audit the current machine, checking each
4891: vulnerability which is known. If a vulnerable
4892: package is installed, it will be shown by output to
4893: stdout, including a description of the type of
4894: vulnerability, and a URL containing more
4895: information.</p>
4896: </li>
4897: </ol>
4898: </div>
4899:
1.23 wiz 4900: <p>Use of the <a xmlns=
4901: "http://www.w3.org/TR/xhtml1/transitional" href=
4902: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
4903: class="pkgname">security/audit-packages</a> package is
4904: strongly recommended! After “<span class=
4905: "quote">audit-packages</span>” is installed, please
4906: read the package's message, which you can get by running
4907: <strong class="userinput"><code>pkg_info -D
4908: audit-package</code></strong>.</p>
1.1 grant 4909: </div>
4910: </div>
4911: </div>
4912:
4913: <div class="part" lang="en" xml:lang="en">
4914: <div class="titlepage">
4915: <div>
4916: <div>
4917: <h1 class="title"><a name="developers-guide" id=
1.2 hubertf 4918: "developers-guide"></a>The pkgsrc developer's
4919: guide</h1>
1.1 grant 4920: </div>
4921: </div>
4922: </div>
4923:
4924: <div class="toc">
4925: <p><b>Table of Contents</b></p>
4926:
4927: <dl>
1.27 rillig 4928: <dt><span class="chapter"><a href="#components">7.
4929: Package components - files, directories and
4930: contents</a></span></dt>
4931:
4932: <dd>
4933: <dl>
4934: <dt><span class="sect1"><a href=
4935: "#components.Makefile">7.1. <code class=
4936: "filename">Makefile</code></a></span></dt>
4937:
4938: <dt><span class="sect1"><a href=
4939: "#components.distinfo">7.2. <code class=
4940: "filename">distinfo</code></a></span></dt>
4941:
4942: <dt><span class="sect1"><a href=
4943: "#components.patches">7.3. patches/*</a></span></dt>
4944:
1.30 wiz 4945: <dt><span class="sect1"><a href=
4946: "#other-mandatory-files">7.4. Other mandatory
4947: files</a></span></dt>
1.27 rillig 4948:
4949: <dt><span class="sect1"><a href=
4950: "#components.optional">7.5. Optional
4951: files</a></span></dt>
4952:
1.30 wiz 4953: <dt><span class="sect1"><a href="#work-dir">7.6.
1.27 rillig 4954: <code class="filename">work*</code></a></span></dt>
4955:
1.30 wiz 4956: <dt><span class="sect1"><a href="#files-dir">7.7.
1.27 rillig 4957: <code class="filename">files/*</code></a></span></dt>
4958: </dl>
4959: </dd>
4960:
4961: <dt><span class="chapter"><a href="#makefile">8.
1.25 rillig 4962: Programming in <code class=
4963: "filename">Makefile</code>s</a></span></dt>
4964:
4965: <dd>
4966: <dl>
4967: <dt><span class="sect1"><a href=
1.27 rillig 4968: "#makefile.variables">8.1. <code class=
1.25 rillig 4969: "filename">Makefile</code> variables</a></span></dt>
4970:
1.27 rillig 4971: <dd>
4972: <dl>
4973: <dt><span class="sect2"><a href=
4974: "#makefile.variables.names">8.1.1. Naming
4975: conventions</a></span></dt>
4976: </dl>
4977: </dd>
4978:
4979: <dt><span class="sect1"><a href="#makefile.code">8.2.
1.25 rillig 4980: Code snippets</a></span></dt>
4981:
4982: <dd>
4983: <dl>
4984: <dt><span class="sect2"><a href=
1.30 wiz 4985: "#adding-to-list">8.2.1. Adding things to a
1.25 rillig 4986: list</a></span></dt>
4987:
4988: <dt><span class="sect2"><a href=
1.30 wiz 4989: "#converting-internal-to-external">8.2.2.
4990: Converting an internal list into an external
4991: list</a></span></dt>
1.25 rillig 4992:
4993: <dt><span class="sect2"><a href=
1.30 wiz 4994: "#passing-variable-to-shell">8.2.3. Passing
4995: variables to a shell command</a></span></dt>
1.27 rillig 4996:
4997: <dt><span class="sect2"><a href=
1.30 wiz 4998: "#quoting-guideline">8.2.4. Quoting
1.27 rillig 4999: guideline</a></span></dt>
5000:
5001: <dt><span class="sect2"><a href=
1.30 wiz 5002: "#bsd-make-bug-workaround">8.2.5. Workaround for
5003: a bug in BSD Make</a></span></dt>
1.25 rillig 5004: </dl>
5005: </dd>
5006: </dl>
5007: </dd>
5008:
5009: <dt><span class="chapter"><a href="#plist">9. PLIST
1.1 grant 5010: issues</a></span></dt>
5011:
5012: <dd>
5013: <dl>
1.30 wiz 5014: <dt><span class="sect1"><a href="#rcs-id">9.1. RCS
1.1 grant 5015: ID</a></span></dt>
5016:
1.30 wiz 5017: <dt><span class="sect1"><a href=
5018: "#automatic-plist-generation">9.2. Semi-automatic
5019: <code class="filename">PLIST</code>
1.14 xtraeme 5020: generation</a></span></dt>
1.1 grant 5021:
1.25 rillig 5022: <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14 xtraeme 5023: Tweaking output of <span><strong class="command">make
5024: print-PLIST</strong></span></a></span></dt>
1.1 grant 5025:
1.25 rillig 5026: <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1 grant 5027: Variable substitution in PLIST</a></span></dt>
5028:
1.30 wiz 5029: <dt><span class="sect1"><a href=
5030: "#manpage-compression">9.5.
1.1 grant 5031: Manpage-compression</a></span></dt>
5032:
1.30 wiz 5033: <dt><span class="sect1"><a href=
5034: "#using-PLIST_SRC">9.6. Changing PLIST source with
5035: <code class=
1.14 xtraeme 5036: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5037:
1.30 wiz 5038: <dt><span class="sect1"><a href=
5039: "#platform-specific-plist">9.7. Platform specific and
5040: differing PLISTs</a></span></dt>
1.1 grant 5041:
5042: <dt><span class="sect1"><a href=
1.25 rillig 5043: "#faq.common-dirs">9.8. Sharing directories between
1.1 grant 5044: packages</a></span></dt>
5045: </dl>
5046: </dd>
5047:
1.25 rillig 5048: <dt><span class="chapter"><a href="#buildlink">10.
1.1 grant 5049: Buildlink methodology</a></span></dt>
5050:
5051: <dd>
5052: <dl>
1.30 wiz 5053: <dt><span class="sect1"><a href=
5054: "#converting-to-buildlink3">10.1. Converting packages
5055: to use buildlink3</a></span></dt>
1.1 grant 5056:
1.30 wiz 5057: <dt><span class="sect1"><a href=
5058: "#creating-buildlink3.mk">10.2. Writing <code class=
5059: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 5060:
5061: <dd>
5062: <dl>
5063: <dt><span class="sect2"><a href=
1.30 wiz 5064: "#anatomy-of-bl3">10.2.1. Anatomy of a
5065: buildlink3.mk file</a></span></dt>
1.1 grant 5066:
5067: <dt><span class="sect2"><a href=
1.30 wiz 5068: "#updating-buildlink-depends">10.2.2. Updating
5069: <code class=
5070: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
5071: <code>pkg</code></em></code> in <code class=
5072: "filename">buildlink3.mk</code>
1.1 grant 5073: files</a></span></dt>
5074: </dl>
5075: </dd>
5076:
1.30 wiz 5077: <dt><span class="sect1"><a href=
5078: "#writing-builtin.mk">10.3. Writing <code class=
5079: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 5080:
5081: <dd>
5082: <dl>
5083: <dt><span class="sect2"><a href=
1.30 wiz 5084: "#anatomy-of-builtin.mk">10.3.1. Anatomy of a
5085: <code class="filename">builtin.mk</code>
5086: file</a></span></dt>
1.1 grant 5087:
5088: <dt><span class="sect2"><a href=
1.30 wiz 5089: "#native-or-pkgsrc-preference">10.3.2. Global
5090: preferences for native or pkgsrc
5091: software</a></span></dt>
1.1 grant 5092: </dl>
5093: </dd>
5094: </dl>
5095: </dd>
5096:
1.25 rillig 5097: <dt><span class="chapter"><a href="#options">11. Options
1.1 grant 5098: handling</a></span></dt>
5099:
5100: <dd>
5101: <dl>
1.30 wiz 5102: <dt><span class="sect1"><a href=
5103: "#global-default-options">11.1. Global default
5104: options</a></span></dt>
1.1 grant 5105:
1.30 wiz 5106: <dt><span class="sect1"><a href=
5107: "#converting-to-options">11.2. Converting packages to
5108: use <code class=
1.14 xtraeme 5109: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 5110: </dl>
5111: </dd>
5112:
1.25 rillig 5113: <dt><span class="chapter"><a href="#build">12. The build
1.1 grant 5114: process</a></span></dt>
5115:
5116: <dd>
5117: <dl>
1.25 rillig 5118: <dt><span class="sect1"><a href="#build.prefix">12.1.
1.1 grant 5119: Program location</a></span></dt>
5120:
1.30 wiz 5121: <dt><span class="sect1"><a href="#main-targets">12.2.
1.1 grant 5122: Main targets</a></span></dt>
5123:
5124: <dt><span class="sect1"><a href=
1.25 rillig 5125: "#build.helpful-targets">12.3. Other helpful
1.1 grant 5126: targets</a></span></dt>
5127: </dl>
5128: </dd>
5129:
1.25 rillig 5130: <dt><span class="chapter"><a href="#fixes">13. Notes on
1.1 grant 5131: fixes for packages</a></span></dt>
5132:
5133: <dd>
5134: <dl>
1.30 wiz 5135: <dt><span class="sect1"><a href=
5136: "#general-operation">13.1. General
5137: operation</a></span></dt>
1.1 grant 5138:
5139: <dd>
5140: <dl>
5141: <dt><span class="sect2"><a href=
1.30 wiz 5142: "#pulling-vars-from-etc-mk.conf">13.1.1. How to
5143: pull in variables from
5144: /etc/mk.conf</a></span></dt>
1.1 grant 5145:
5146: <dt><span class="sect2"><a href=
1.31 wiz 5147: "#where-to-install-documentation">13.1.2. Where
5148: to install documentation</a></span></dt>
5149:
5150: <dt><span class="sect2"><a href=
5151: "#restricted-packages">13.1.3. Restricted
1.1 grant 5152: packages</a></span></dt>
5153:
5154: <dt><span class="sect2"><a href=
1.31 wiz 5155: "#dependencies">13.1.4. Handling
1.1 grant 5156: dependencies</a></span></dt>
5157:
5158: <dt><span class="sect2"><a href=
1.31 wiz 5159: "#conflicts">13.1.5. Handling conflicts with
1.1 grant 5160: other packages</a></span></dt>
5161:
5162: <dt><span class="sect2"><a href=
1.31 wiz 5163: "#not-building-packages">13.1.6. Packages that
1.30 wiz 5164: cannot or should not be built</a></span></dt>
1.1 grant 5165:
5166: <dt><span class="sect2"><a href=
1.31 wiz 5167: "#undeletable-packages">13.1.7. Packages which
1.30 wiz 5168: should not be deleted, once
5169: installed</a></span></dt>
1.1 grant 5170:
5171: <dt><span class="sect2"><a href=
1.31 wiz 5172: "#security-handling">13.1.8. Handling packages
1.1 grant 5173: with security problems</a></span></dt>
5174:
5175: <dt><span class="sect2"><a href=
1.31 wiz 5176: "#compiler-bugs">13.1.9. How to handle compiler
1.1 grant 5177: bugs</a></span></dt>
5178:
5179: <dt><span class="sect2"><a href=
1.31 wiz 5180: "#bumping-pkgrevision">13.1.10. How to handle
1.30 wiz 5181: incrementing versions when fixing an existing
1.1 grant 5182: package</a></span></dt>
5183:
5184: <dt><span class="sect2"><a href=
1.31 wiz 5185: "#portability-of-packages">13.1.11. Portability
1.30 wiz 5186: of packages</a></span></dt>
1.1 grant 5187: </dl>
5188: </dd>
5189:
1.30 wiz 5190: <dt><span class="sect1"><a href=
5191: "#downloading-issues">13.2. Possible downloading
5192: issues</a></span></dt>
1.1 grant 5193:
5194: <dd>
5195: <dl>
5196: <dt><span class="sect2"><a href=
1.30 wiz 5197: "#no-plain-download">13.2.1. Packages whose
5198: distfiles aren't available for plain
1.1 grant 5199: downloading</a></span></dt>
5200:
5201: <dt><span class="sect2"><a href=
1.30 wiz 5202: "#modified-distfiles-same-name">13.2.2. How to
5203: handle modified distfiles with the 'old'
5204: name</a></span></dt>
1.1 grant 5205: </dl>
5206: </dd>
5207:
1.30 wiz 5208: <dt><span class="sect1"><a href=
5209: "#configuration-gotchas">13.3. Configuration
5210: gotchas</a></span></dt>
1.1 grant 5211:
5212: <dd>
5213: <dl>
5214: <dt><span class="sect2"><a href=
1.25 rillig 5215: "#fixes.libtool">13.3.1. Shared libraries -
1.1 grant 5216: libtool</a></span></dt>
5217:
5218: <dt><span class="sect2"><a href=
1.30 wiz 5219: "#using-libtool">13.3.2. Using libtool on GNU
1.1 grant 5220: packages that already support
5221: libtool</a></span></dt>
5222:
5223: <dt><span class="sect2"><a href=
1.30 wiz 5224: "#autoconf-automake">13.3.3. GNU
1.1 grant 5225: Autoconf/Automake</a></span></dt>
5226: </dl>
5227: </dd>
5228:
1.30 wiz 5229: <dt><span class="sect1"><a href=
5230: "#building-considerations">13.4. Building
5231: considerations</a></span></dt>
1.1 grant 5232:
5233: <dd>
5234: <dl>
5235: <dt><span class="sect2"><a href=
1.30 wiz 5236: "#cpp-defines">13.4.1. CPP
5237: defines</a></span></dt>
1.1 grant 5238: </dl>
5239: </dd>
5240:
1.30 wiz 5241: <dt><span class="sect1"><a href=
5242: "#package-specific-actions">13.5. Package specific
5243: actions</a></span></dt>
1.1 grant 5244:
5245: <dd>
5246: <dl>
5247: <dt><span class="sect2"><a href=
1.30 wiz 5248: "#package-configuration-files">13.5.1. Package
5249: configuration files</a></span></dt>
1.1 grant 5250:
5251: <dt><span class="sect2"><a href=
1.30 wiz 5252: "#user-interaction">13.5.2. User
1.2 hubertf 5253: interaction</a></span></dt>
1.1 grant 5254:
5255: <dt><span class="sect2"><a href=
1.30 wiz 5256: "#handling-licenses">13.5.3. Handling
1.1 grant 5257: licenses</a></span></dt>
5258:
5259: <dt><span class="sect2"><a href=
1.30 wiz 5260: "#creating-accounts">13.5.4. Creating an account
5261: from a package</a></span></dt>
1.1 grant 5262:
5263: <dt><span class="sect2"><a href=
1.30 wiz 5264: "#installing-score-files">13.5.5. Installing
5265: score files</a></span></dt>
1.1 grant 5266:
5267: <dt><span class="sect2"><a href=
1.30 wiz 5268: "#login-shells">13.5.6. Packages providing login
1.1 grant 5269: shells</a></span></dt>
5270:
5271: <dt><span class="sect2"><a href=
1.30 wiz 5272: "#perl-scripts">13.5.7. Packages containing perl
1.1 grant 5273: scripts</a></span></dt>
5274:
5275: <dt><span class="sect2"><a href=
1.30 wiz 5276: "#hardcoded-paths">13.5.8. Packages with
5277: hardcoded paths to other
5278: interpreters</a></span></dt>
1.1 grant 5279:
5280: <dt><span class="sect2"><a href=
1.30 wiz 5281: "#perl-modules">13.5.9. Packages installing perl
1.1 grant 5282: modules</a></span></dt>
5283:
5284: <dt><span class="sect2"><a href=
1.25 rillig 5285: "#faq.info-files">13.5.10. Packages installing
1.1 grant 5286: info files</a></span></dt>
5287:
5288: <dt><span class="sect2"><a href=
1.30 wiz 5289: "#gconf2-data-files">13.5.11. Packages installing
5290: GConf2 data files</a></span></dt>
1.1 grant 5291:
5292: <dt><span class="sect2"><a href=
1.30 wiz 5293: "#scrollkeeper-data-files">13.5.12. Packages
5294: installing scrollkeeper data
5295: files</a></span></dt>
1.1 grant 5296:
5297: <dt><span class="sect2"><a href=
1.30 wiz 5298: "#x11-fonts">13.5.13. Packages installing X11
1.1 grant 5299: fonts</a></span></dt>
5300:
5301: <dt><span class="sect2"><a href=
1.30 wiz 5302: "#gtk2-modules">13.5.14. Packages installing GTK2
1.1 grant 5303: modules</a></span></dt>
5304:
5305: <dt><span class="sect2"><a href=
1.30 wiz 5306: "#sgml-xml-data">13.5.15. Packages installing
5307: SGML or XML data</a></span></dt>
1.1 grant 5308:
5309: <dt><span class="sect2"><a href=
1.30 wiz 5310: "#mime-database">13.5.16. Packages installing
1.1 grant 5311: extensions to the MIME database</a></span></dt>
5312:
5313: <dt><span class="sect2"><a href=
1.30 wiz 5314: "#intltool">13.5.17. Packages using
1.1 grant 5315: intltool</a></span></dt>
1.18 xtraeme 5316:
5317: <dt><span class="sect2"><a href=
1.30 wiz 5318: "#startup-scripts">13.5.18. Packages installing
5319: startup scripts</a></span></dt>
1.1 grant 5320: </dl>
5321: </dd>
5322:
1.30 wiz 5323: <dt><span class="sect1"><a href=
5324: "#feedback-to-author">13.6. Feedback to the
5325: author</a></span></dt>
1.1 grant 5326: </dl>
5327: </dd>
5328:
1.25 rillig 5329: <dt><span class="chapter"><a href="#debug">14.
1.1 grant 5330: Debugging</a></span></dt>
5331:
1.25 rillig 5332: <dt><span class="chapter"><a href="#submit">15.
1.1 grant 5333: Submitting and Committing</a></span></dt>
5334:
5335: <dd>
5336: <dl>
1.30 wiz 5337: <dt><span class="sect1"><a href=
5338: "#submitting-your-package">15.1. Submitting your
5339: packages</a></span></dt>
1.1 grant 5340:
1.30 wiz 5341: <dt><span class="sect1"><a href=
5342: "#committing-importing">15.2. Committing: Importing a
5343: package into CVS</a></span></dt>
1.1 grant 5344:
1.30 wiz 5345: <dt><span class="sect1"><a href=
5346: "#updating-package">15.3. Updating a package to a
5347: newer version</a></span></dt>
1.1 grant 5348:
1.30 wiz 5349: <dt><span class="sect1"><a href=
5350: "#moving-package">15.4. Moving a package in
5351: pkgsrc</a></span></dt>
1.1 grant 5352: </dl>
5353: </dd>
5354: </dl>
5355: </div>
5356:
5357: <div class="chapter" lang="en" xml:lang="en">
5358: <div class="titlepage">
5359: <div>
5360: <div>
1.27 rillig 5361: <h2 class="title"><a name="components" id=
5362: "components"></a>Chapter 7. Package
5363: components - files, directories and contents</h2>
1.25 rillig 5364: </div>
5365: </div>
5366: </div>
5367:
5368: <div class="toc">
5369: <p><b>Table of Contents</b></p>
5370:
5371: <dl>
5372: <dt><span class="sect1"><a href=
1.27 rillig 5373: "#components.Makefile">7.1. <code class=
5374: "filename">Makefile</code></a></span></dt>
5375:
5376: <dt><span class="sect1"><a href=
5377: "#components.distinfo">7.2. <code class=
5378: "filename">distinfo</code></a></span></dt>
5379:
5380: <dt><span class="sect1"><a href=
5381: "#components.patches">7.3. patches/*</a></span></dt>
1.25 rillig 5382:
1.30 wiz 5383: <dt><span class="sect1"><a href=
5384: "#other-mandatory-files">7.4. Other mandatory
5385: files</a></span></dt>
1.25 rillig 5386:
1.27 rillig 5387: <dt><span class="sect1"><a href=
5388: "#components.optional">7.5. Optional
5389: files</a></span></dt>
1.25 rillig 5390:
1.30 wiz 5391: <dt><span class="sect1"><a href="#work-dir">7.6.
1.27 rillig 5392: <code class="filename">work*</code></a></span></dt>
1.25 rillig 5393:
1.30 wiz 5394: <dt><span class="sect1"><a href="#files-dir">7.7.
1.27 rillig 5395: <code class="filename">files/*</code></a></span></dt>
1.25 rillig 5396: </dl>
5397: </div>
5398:
1.27 rillig 5399: <p>Whenever you're preparing a package, there are a number
5400: of files involved which are described in the following
5401: sections.</p>
1.25 rillig 5402:
5403: <div class="sect1" lang="en" xml:lang="en">
5404: <div class="titlepage">
5405: <div>
5406: <div>
5407: <h2 class="title" style="clear: both"><a name=
1.27 rillig 5408: "components.Makefile" id=
5409: "components.Makefile"></a>7.1. <code class=
5410: "filename">Makefile</code></h2>
1.25 rillig 5411: </div>
5412: </div>
5413: </div>
5414:
1.27 rillig 5415: <p>Building, installation and creation of a binary
5416: package are all controlled by the package's <code class=
5417: "filename">Makefile</code>. The <code class=
5418: "filename">Makefile</code> describes various things about
5419: a package, for example from where to get it, how to
5420: configure, build, and install it.</p>
5421:
5422: <p>A package <code class="filename">Makefile</code>
5423: contains several sections that describe the package.</p>
1.25 rillig 5424:
1.27 rillig 5425: <p>In the first section there are the following
5426: variables, which should appear exactly in the order given
5427: here.</p>
1.25 rillig 5428:
5429: <div class="itemizedlist">
5430: <ul type="disc">
5431: <li>
1.27 rillig 5432: <p><code class="varname">DISTNAME</code> is the
5433: basename of the distribution file to be downloaded
5434: from the package's website.</p>
5435: </li>
5436:
5437: <li>
5438: <p><code class="varname">PKGNAME</code> is the name
5439: of the package, as used by pkgsrc. You only need to
5440: provide it if it differs from DISTNAME. Usually it
5441: is the directory name together with the version
5442: number. It must match the regular expression
5443: <code class=
5444: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
5445: that is, it starts with a letter or digit, and
5446: contains only letters, digits, dashes, underscores,
5447: dots and plus signs.</p>
1.25 rillig 5448: </li>
5449:
5450: <li>
1.27 rillig 5451: <p><code class="varname">CATEGORIES</code> is a
5452: list of categories which the package fits in. You
5453: can choose any of the top-level directories of
5454: pkgsrc for it.</p>
1.25 rillig 5455: </li>
5456:
5457: <li>
1.27 rillig 5458: <p><code class="varname">MASTER_SITES</code> is a
5459: list of URLs where the distribution files can be
5460: downloaded. Each URL must end with a slash.</p>
1.25 rillig 5461: </li>
5462: </ul>
5463: </div>
5464:
1.27 rillig 5465: <p>The second section contains the following
5466: variables.</p>
1.25 rillig 5467:
1.27 rillig 5468: <div class="itemizedlist">
5469: <ul type="disc">
5470: <li>
5471: <p><code class="varname">MAINTAINER</code> is the
5472: mail address of the package's maintainer, which is
5473: the person you can contact when the package does
5474: not work.</p>
5475: </li>
1.25 rillig 5476:
1.27 rillig 5477: <li>
5478: <p><code class="varname">HOMEPAGE</code> is a URL
5479: where users can find more information about the
1.23 wiz 5480: package.</p>
5481: </li>
1.1 grant 5482:
1.23 wiz 5483: <li>
5484: <p><code class="varname">COMMENT</code> is a
5485: one-line comment about the purpose of the
5486: package.</p>
5487: </li>
5488: </ul>
5489: </div>
1.1 grant 5490:
1.14 xtraeme 5491: <p>The <code class="varname">MASTER_SITES</code> may be
5492: set to one of the predefined sites:</p>
1.1 grant 5493: <pre class="programlisting">
5494: ${MASTER_SITE_APACHE}
1.27 rillig 5495: ${MASTER_SITE_BACKUP}
5496: ${MASTER_SITE_CYGWIN}
1.1 grant 5497: ${MASTER_SITE_DEBIAN}
1.27 rillig 5498: ${MASTER_SITE_FREEBSD}
5499: ${MASTER_SITE_FREEBSD_LOCAL}
1.1 grant 5500: ${MASTER_SITE_GNOME}
5501: ${MASTER_SITE_GNU}
5502: ${MASTER_SITE_GNUSTEP}
1.9 dillo 5503: ${MASTER_SITE_IFARCHIVE}
1.1 grant 5504: ${MASTER_SITE_MOZILLA}
1.27 rillig 5505: ${MASTER_SITE_OPENOFFICE}
1.1 grant 5506: ${MASTER_SITE_PERL_CPAN}
1.27 rillig 5507: ${MASTER_SITE_R_CRAN}
1.1 grant 5508: ${MASTER_SITE_SOURCEFORGE}
5509: ${MASTER_SITE_SUNSITE}
5510: ${MASTER_SITE_SUSE}
5511: ${MASTER_SITE_TEX_CTAN}
5512: ${MASTER_SITE_XCONTRIB}
1.27 rillig 5513: ${MASTER_SITE_XEMACS}
5514:
1.1 grant 5515: </pre>
5516:
5517: <p>If one of these predefined sites is chosen, you may
5518: require the ability to specify a subdirectory of that
5519: site. Since these macros may expand to more than one
5520: actual site, you <span class=
5521: "emphasis"><em>must</em></span> use the following
5522: construct to specify a subdirectory:</p>
5523: <pre class="programlisting">
5524: ${MASTER_SITE_GNU:=subdirectory/name/}
5525: ${MASTER_SITE_SOURCEFORGE:=project_name/}
5526: </pre>
5527:
5528: <p>Note the trailing slash after the subdirectory
5529: name.</p>
5530:
5531: <div class="note" style=
5532: "margin-left: 0.5in; margin-right: 0.5in;">
5533: <h3 class="title">Note</h3>
5534:
1.14 xtraeme 5535: <p><code class="varname">MASTER_SITE_SUBDIR</code> has
5536: been deprecated and <span class="emphasis"><em>should
5537: no longer be used</em></span>.</p>
1.1 grant 5538: </div>
5539:
1.14 xtraeme 5540: <p>If the package has multiple <code class=
5541: "varname">DISTFILES</code> or multiple <code class=
5542: "varname">PATCHFILES</code> from different sites, set
5543: <code class="varname">SITES_foo</code> to a list of URI's
1.1 grant 5544: where file “<span class="quote">foo</span>”
5545: may be found. “<span class=
5546: "quote">foo</span>” includes the suffix, e.g.</p>
5547: <pre class="programlisting">
5548: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
5549: DISTFILES+= foo-file.tar.gz
5550: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
5551: http://www.somewhereelse.com/mirror/somehow/
5552: </pre>
5553:
1.14 xtraeme 5554: <p>Note that the normal default setting of <code class=
5555: "varname">DISTFILES</code> must be made explicit if you
1.1 grant 5556: want to add to it (rather than replace it), as you
5557: usually would.</p>
5558:
5559: <p>Currently the following values are available for
1.14 xtraeme 5560: <code class="varname">CATEGORIES</code>. If more than one
5561: is used, they need to be separated by spaces:</p>
1.1 grant 5562: <pre class="programlisting">
5563: archivers cross geography meta-pkgs security
5564: audio databases graphics misc shells
5565: benchmarks devel ham multimedia sysutils
5566: biology editors inputmethod net textproc
5567: cad emulators lang news time
5568: chat finance mail parallel wm
5569: comms fonts math pkgtools www
5570: converters games mbone print x11
5571: </pre>
5572:
5573: <p>Please pay attention to the following gotchas:</p>
5574:
5575: <div class="itemizedlist">
5576: <ul type="disc">
5577: <li>
1.14 xtraeme 5578: <p>Add <code class="varname">MANCOMPRESSED</code>
5579: if manpages are installed in compressed form by the
5580: package; see comment in <code class=
5581: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 5582: </li>
5583:
5584: <li>
1.14 xtraeme 5585: <p>Replace <code class="filename">/usr/local</code>
1.1 grant 5586: with “<span class=
5587: "quote">${PREFIX}</span>” in all files (see
5588: patches, below).</p>
5589: </li>
5590:
5591: <li>
5592: <p>If the package installs any info files, see
5593: <a href="#faq.info-files" title=
1.25 rillig 5594: "13.5.10. Packages installing info files">Section
5595: 13.5.10, “Packages installing info
1.1 grant 5596: files”</a>.</p>
5597: </li>
5598:
5599: <li>
1.14 xtraeme 5600: <p>Set <code class="varname">MAINTAINER</code> to
5601: be yourself. If you really can't maintain the
5602: package for future updates, set it to <code class=
1.1 grant 5603: "email"><<a href=
1.14 xtraeme 5604: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.1 grant 5605: </li>
5606:
5607: <li>
5608: <p>If a home page for the software in question
1.14 xtraeme 5609: exists, add the variable <code class=
5610: "varname">HOMEPAGE</code> right after <code class=
5611: "varname">MAINTAINER</code>. The value of this
1.1 grant 5612: variable should be the URL for the home page.</p>
5613: </li>
5614:
5615: <li>
1.14 xtraeme 5616: <p>Be sure to set the <code class=
5617: "varname">COMMENT</code> variable to a short
1.1 grant 5618: description of the package, not containing the
5619: pkg's name.</p>
5620: </li>
5621: </ul>
5622: </div>
5623: </div>
5624:
5625: <div class="sect1" lang="en" xml:lang="en">
5626: <div class="titlepage">
5627: <div>
5628: <div>
5629: <h2 class="title" style="clear: both"><a name=
5630: "components.distinfo" id=
1.27 rillig 5631: "components.distinfo"></a>7.2. <code class=
1.14 xtraeme 5632: "filename">distinfo</code></h2>
1.1 grant 5633: </div>
5634: </div>
5635: </div>
5636:
5637: <p>Most important, the mandatory message digest, or
5638: checksum, of all the distfiles needed for the package to
5639: compile, confirming they match the original file
5640: distributed by the author. This ensures that the distfile
5641: retrieved from the Internet has not been corrupted during
5642: transfer or altered by a malign force to introduce a
1.14 xtraeme 5643: security hole. It is generated using the
5644: <span><strong class="command">make
5645: makesum</strong></span> command. The digest algorithm
5646: used was, at one stage, md5, but that was felt lacking
5647: compared to sha1, and so sha1 is now the default
1.1 grant 5648: algorithm. The distfile size is also generated and stored
5649: in new distinfo files. The <a xmlns=
5650: "http://www.w3.org/TR/xhtml1/transitional" href=
5651: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20 ben 5652: class="pkgname">pkgtools/digest</a> utility calculates
5653: all of the digests in the distinfo file, and it provides
5654: various different algorithms. At the current time, the
5655: algorithms provided are: <span class=
5656: "emphasis"><em>md5</em></span>, <span class=
5657: "emphasis"><em>rmd160</em></span>, <span class=
5658: "emphasis"><em>sha1</em></span>, <span class=
5659: "emphasis"><em>sha256</em></span>, <span class=
5660: "emphasis"><em>sha384</em></span> and <span class=
5661: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 5662:
5663: <p>Some packages have different sets of distfiles on a
5664: per architecture basis, for example <a xmlns=
5665: "http://www.w3.org/TR/xhtml1/transitional" href=
5666: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.20 ben 5667: class="pkgname">www/navigator</a>). These are kept in the
5668: same distinfo file and care should be taken when
5669: upgrading such a package to ensure distfile information
5670: is not lost.</p>
1.1 grant 5671:
5672: <p>The message digest/checksum for all the official
1.14 xtraeme 5673: patches found in the <code class=
5674: "filename">patches/</code> directory (see <a href=
5675: "#components.patches" title=
1.27 rillig 5676: "7.3. patches/*">Section 7.3,
1.1 grant 5677: “patches/*”</a>) for the package is also
1.14 xtraeme 5678: stored in the <code class="filename">distinfo</code>
5679: file. This is a message digest/checksum of all lines in
5680: the patch file except the NetBSD RCS Id. This file is
5681: generated by invoking <span><strong class="command">make
5682: makepatchsum</strong></span> (or <span><strong class=
5683: "command">make mps</strong></span> if you're in a
5684: hurry).</p>
1.1 grant 5685: </div>
5686:
5687: <div class="sect1" lang="en" xml:lang="en">
5688: <div class="titlepage">
5689: <div>
5690: <div>
5691: <h2 class="title" style="clear: both"><a name=
5692: "components.patches" id=
1.27 rillig 5693: "components.patches"></a>7.3. patches/*</h2>
1.1 grant 5694: </div>
5695: </div>
5696: </div>
5697:
5698: <p>This directory contains files that are used by the
5699: <a href=
5700: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
5701: <span class="citerefentry"><span class=
5702: "refentrytitle">patch</span>(1)</span></a> command to
5703: modify the sources as distributed in the distribution
5704: file into a form that will compile and run perfectly on
5705: NetBSD. The files are applied successively in alphabetic
5706: order (as returned by a shell “<span class=
5707: "quote">patches/patch-*</span>” glob expansion), so
1.14 xtraeme 5708: <code class="filename">patch-aa</code> is applied before
5709: <code class="filename">patch-ab</code>, etc.</p>
1.1 grant 5710:
1.14 xtraeme 5711: <p>The <code class="filename">patch-*</code> files should
5712: be in <span><strong class="command">diff
5713: -bu</strong></span> format, and apply without a fuzz to
5714: avoid problems. (To force patches to apply with fuzz you
5715: can set <code class=
5716: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 5717: not put changes for more than one file into a single
5718: patch-file, as this will make future modifications more
5719: difficult.</p>
5720:
5721: <p>Similar, a file should be patched at most once, not
5722: several times by several different patches. If a file
5723: needs several patches, they should be combined into one
5724: file.</p>
5725:
5726: <p>One important thing to mention is to pay attention
5727: that no RCS IDs get stored in the patch files, as these
5728: will cause problems when later checked into the NetBSD
1.14 xtraeme 5729: CVS tree. Use the <span><strong class=
5730: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 5731: "http://www.w3.org/TR/xhtml1/transitional" href=
5732: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 5733: class="pkgname">pkgtools/pkgdiff</a> package to avoid
5734: these problems.</p>
1.1 grant 5735:
5736: <p>For even more automation, we recommend using
1.14 xtraeme 5737: <span><strong class="command">mkpatches</strong></span>
5738: from the same package to make a whole set of patches. You
5739: just have to backup files before you edit them to
5740: <code class="filename">filename.orig</code>, e.g. with
5741: <span><strong class="command">cp -p filename
5742: filename.orig</strong></span> or, easier, by using
5743: <span><strong class="command">pkgvi</strong></span> again
5744: from the same package. If you upgrade a package this way,
5745: you can easily compare the new set of patches with the
5746: previously existing one with <span><strong class=
5747: "command">patchdiff</strong></span>.</p>
1.1 grant 5748:
5749: <p>When you have finished a package, remember to generate
5750: the checksums for the patch files by using the
1.14 xtraeme 5751: <span><strong class="command">make
5752: makepatchsum</strong></span> command, see <a href=
5753: "#components.distinfo" title=
1.27 rillig 5754: "7.2. distinfo">Section 7.2,
1.14 xtraeme 5755: “<code class="filename">distinfo</code>”</a>.</p>
1.1 grant 5756:
5757: <p>Patch files that are distributed by the author or
1.14 xtraeme 5758: other maintainers can be listed in <code class=
5759: "varname">$PATCHFILES</code>.</p>
1.1 grant 5760:
5761: <p>If it is desired to store any patches that should not
5762: be committed into pkgsrc, they can be kept outside the
1.14 xtraeme 5763: pkgsrc tree in the <code class=
5764: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 5765: tree there is expected to have the same
5766: “<span class="quote">category/package</span>”
5767: structure as pkgsrc, and patches are expected to be
1.14 xtraeme 5768: stored inside these dirs (also known as <code class=
5769: "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
5770: you want to keep a private patch for <code class=
5771: "filename">pkgsrc/graphics/png</code>, keep it in
5772: <code class=
5773: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
5774: files in the named directory are expected to be patch
1.1 grant 5775: files, and <span class="emphasis"><em>they are applied
5776: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 5777: </div>
5778:
5779: <div class="sect1" lang="en" xml:lang="en">
5780: <div class="titlepage">
5781: <div>
5782: <div>
5783: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5784: "other-mandatory-files" id=
5785: "other-mandatory-files"></a>7.4. Other
1.27 rillig 5786: mandatory files</h2>
5787: </div>
5788: </div>
5789: </div>
5790:
5791: <div class="variablelist">
5792: <dl>
5793: <dt><span class="term"><code class=
5794: "filename">DESCR</code></span></dt>
5795:
5796: <dd>
5797: <p>A multi-line description of the piece of
5798: software. This should include any credits where
5799: they are due. Please bear in mind that others do
5800: not share your sense of humour (or spelling
5801: idiosyncrasies), and that others will read
5802: everything that you write here.</p>
5803: </dd>
5804:
5805: <dt><span class="term"><code class=
5806: "filename">PLIST</code></span></dt>
5807:
5808: <dd>
5809: <p>This file governs the files that are installed
5810: on your system: all the binaries, manual pages,
5811: etc. There are other directives which may be
5812: entered in this file, to control the creation and
5813: deletion of directories, and the location of
5814: inserted files. See <a href="#plist" title=
5815: "Chapter 9. PLIST issues">Chapter 9,
5816: <i>PLIST issues</i></a> for more information.</p>
5817: </dd>
5818: </dl>
5819: </div>
5820: </div>
5821:
5822: <div class="sect1" lang="en" xml:lang="en">
5823: <div class="titlepage">
5824: <div>
5825: <div>
5826: <h2 class="title" style="clear: both"><a name=
5827: "components.optional" id=
5828: "components.optional"></a>7.5. Optional
5829: files</h2>
5830: </div>
5831: </div>
5832: </div>
5833:
5834: <div class="variablelist">
5835: <dl>
5836: <dt><span class="term"><code class=
5837: "filename">INSTALL</code></span></dt>
5838:
5839: <dd>
5840: <p>This shell script is invoked twice by <a href=
5841: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5842: <span class="citerefentry"><span class=
5843: "refentrytitle">pkg_add</span>(1)</span></a>. First
5844: time after package extraction and before files are
5845: moved in place, the second time after the files to
5846: install are moved in place. This can be used to do
5847: any custom procedures not possible with @exec
5848: commands in <code class="filename">PLIST</code>.
5849: See <a href=
5850: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5851: <span class="citerefentry"><span class=
5852: "refentrytitle">pkg_add</span>(1)</span></a> and
5853: <a href=
5854: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5855: <span class="citerefentry"><span class=
5856: "refentrytitle">pkg_create</span>(1)</span></a> for
5857: more information.</p>
5858: </dd>
5859:
5860: <dt><span class="term"><code class=
5861: "filename">DEINSTALL</code></span></dt>
5862:
5863: <dd>
5864: <p>This script is executed before and after any
5865: files are removed. It is this script's
5866: responsibility to clean up any additional messy
5867: details around the package's installation, since
5868: all pkg_delete knows is how to delete the files
5869: created in the original distribution. See <a href=
5870: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
5871: <span class="citerefentry"><span class=
5872: "refentrytitle">pkg_delete</span>(1)</span></a> and
5873: <a href=
5874: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5875: <span class="citerefentry"><span class=
5876: "refentrytitle">pkg_create</span>(1)</span></a> for
5877: more information.</p>
5878: </dd>
5879:
5880: <dt><span class="term"><code class=
5881: "filename">MESSAGE</code></span></dt>
5882:
5883: <dd>
5884: <p>Display this file after installation of the
5885: package. Useful for things like legal notices on
5886: almost-free software and hints for updating config
5887: files after installing modules for apache, PHP etc.
5888: Please note that you can modify variables in it
5889: easily by using <code class=
5890: "varname">MESSAGE_SUBST</code> in the package's
5891: <code class="filename">Makefile</code>:</p>
5892: <pre class="programlisting">
5893: MESSAGE_SUBST+= SOMEVAR="somevalue"
5894: </pre>
5895:
5896: <p>replaces "${SOMEVAR}" with “<span class=
5897: "quote">somevalue</span>” in <code class=
5898: "filename">MESSAGE</code>.</p>
5899: </dd>
5900: </dl>
5901: </div>
5902: </div>
5903:
5904: <div class="sect1" lang="en" xml:lang="en">
5905: <div class="titlepage">
5906: <div>
5907: <div>
5908: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5909: "work-dir" id="work-dir"></a>7.6. <code class=
1.27 rillig 5910: "filename">work*</code></h2>
5911: </div>
5912: </div>
5913: </div>
5914:
5915: <p>When you type <span><strong class=
5916: "command">make</strong></span> the distribution files are
5917: unpacked into this directory. It can be removed by
5918: running <span><strong class="command">make
5919: clean</strong></span>. Besides the sources, this
5920: directory is also used to keep various timestamp
5921: files.</p>
5922:
5923: <p>If a package doesn't create a subdirectory for itself
5924: (like GNU software does, for instance), but extracts
5925: itself in the current directory, you should set
5926: <code class="varname">WRKSRC</code> accordingly, e.g.
5927: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
5928: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
5929: class="pkgname">editors/sam</a> again, but the quick
5930: answer is:</p>
5931: <pre class="programlisting">
5932: WRKSRC= ${WRKDIR}
5933: </pre>
5934:
5935: <p>Please note that the old <code class=
5936: "varname">NO_WRKSUBDIR</code> has been deprecated and
5937: should not be used. Also, if your package doesn't create
5938: a subdir with the name of <code class=
5939: "varname">DISTNAME</code> but some different name, set
5940: <code class="varname">WRKSRC</code> to point to the
5941: proper name in <code class="filename">${WRKDIR}</code>.
5942: See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5943: href=
5944: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
5945: class="pkgname">lang/tcl</a> and <a xmlns=
5946: "http://www.w3.org/TR/xhtml1/transitional" href=
5947: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
5948: class="pkgname">x11/tk</a> for examples, and here is
5949: another one:</p>
5950: <pre class="programlisting">
5951: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
5952: </pre>
5953:
5954: <p>The name of the working directory created by pkgsrc is
5955: <code class="filename">work</code> by default. If the
5956: same pkgsrc tree should be used on several different
5957: platforms, the variable <code class=
5958: "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
5959: attach the platform to the directory name, e.g.
5960: <code class="filename">work.i386</code> or <code class=
5961: "filename">work.sparc</code>.</p>
5962: </div>
5963:
5964: <div class="sect1" lang="en" xml:lang="en">
5965: <div class="titlepage">
5966: <div>
5967: <div>
5968: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5969: "files-dir" id=
5970: "files-dir"></a>7.7. <code class=
1.27 rillig 5971: "filename">files/*</code></h2>
5972: </div>
5973: </div>
5974: </div>
5975:
5976: <p>If you have any files that you wish to be placed in
5977: the package prior to configuration or building, you could
5978: place these files here and use a “<span class=
5979: "quote">${CP}</span>” command in the
5980: “<span class="quote">pre-configure</span>”
5981: target to achieve this. Alternatively, you could simply
5982: diff the file against <code class=
5983: "filename">/dev/null</code> and use the patch mechanism
5984: to manage the creation of this file.</p>
5985: </div>
5986: </div>
5987:
5988: <div class="chapter" lang="en" xml:lang="en">
5989: <div class="titlepage">
5990: <div>
5991: <div>
5992: <h2 class="title"><a name="makefile" id=
5993: "makefile"></a>Chapter 8. Programming in
5994: <code class="filename">Makefile</code>s</h2>
5995: </div>
5996: </div>
5997: </div>
5998:
5999: <div class="toc">
6000: <p><b>Table of Contents</b></p>
6001:
6002: <dl>
6003: <dt><span class="sect1"><a href=
6004: "#makefile.variables">8.1. <code class=
6005: "filename">Makefile</code> variables</a></span></dt>
6006:
6007: <dd>
6008: <dl>
6009: <dt><span class="sect2"><a href=
6010: "#makefile.variables.names">8.1.1. Naming
6011: conventions</a></span></dt>
6012: </dl>
6013: </dd>
6014:
6015: <dt><span class="sect1"><a href="#makefile.code">8.2.
6016: Code snippets</a></span></dt>
6017:
6018: <dd>
6019: <dl>
1.30 wiz 6020: <dt><span class="sect2"><a href=
6021: "#adding-to-list">8.2.1. Adding things to a
6022: list</a></span></dt>
1.27 rillig 6023:
1.30 wiz 6024: <dt><span class="sect2"><a href=
6025: "#converting-internal-to-external">8.2.2.
1.27 rillig 6026: Converting an internal list into an external
6027: list</a></span></dt>
6028:
1.30 wiz 6029: <dt><span class="sect2"><a href=
6030: "#passing-variable-to-shell">8.2.3. Passing
6031: variables to a shell command</a></span></dt>
1.27 rillig 6032:
1.30 wiz 6033: <dt><span class="sect2"><a href=
6034: "#quoting-guideline">8.2.4. Quoting
6035: guideline</a></span></dt>
1.27 rillig 6036:
1.30 wiz 6037: <dt><span class="sect2"><a href=
6038: "#bsd-make-bug-workaround">8.2.5. Workaround for a
6039: bug in BSD Make</a></span></dt>
1.27 rillig 6040: </dl>
6041: </dd>
6042: </dl>
6043: </div>
6044:
6045: <p>Pkgsrc consists of many <code class=
6046: "filename">Makefile</code> fragments, each of which forms a
6047: well-defined part of the pkgsrc system. Using the <a href=
6048: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6049: <span class="citerefentry"><span class=
6050: "refentrytitle">make</span>(1)</span></a> system as a
6051: programming language for a big system like pkgsrc requires
6052: some discipline to keep the code correct and
6053: understandable.</p>
6054:
6055: <p>The basic ingredients for <code class=
6056: "filename">Makefile</code> programming are variables (which
6057: are actually macros) and shell commands. Among these shell
6058: commands may even be more complex ones like <a href=
6059: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
6060: <span class="citerefentry"><span class=
6061: "refentrytitle">awk</span>(1)</span></a> programs. To make
6062: sure that every shell command runs as intended it is
6063: necessary to quote all variables correctly when they are
6064: used.</p>
6065:
6066: <p>This chapter describes some patterns, that appear quite
6067: often in <code class="filename">Makefile</code>s, including
6068: the pitfalls that come along with them.</p>
6069:
6070: <div class="sect1" lang="en" xml:lang="en">
6071: <div class="titlepage">
6072: <div>
6073: <div>
6074: <h2 class="title" style="clear: both"><a name=
6075: "makefile.variables" id=
6076: "makefile.variables"></a>8.1. <code class=
6077: "filename">Makefile</code> variables</h2>
6078: </div>
6079: </div>
6080: </div>
6081:
6082: <p><code class="filename">Makefile</code> variables
6083: contain strings that can be processed using the five
6084: operators ``='', ``+='', ``?='', ``:='', and ``!='',
6085: which are described in the <a href=
6086: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6087: <span class="citerefentry"><span class=
6088: "refentrytitle">make</span>(1)</span></a> man page.</p>
6089:
6090: <p>When a variable's value is parsed from a <code class=
6091: "filename">Makefile</code>, the hash character ``#'' and
6092: the backslash character ``\'' are handled specially. If a
6093: backslash is followed by a newline, any whitespace
6094: immediately in front of the backslash, the backslash, the
6095: newline, and any whitespace immediately behind the
6096: newline are replaced with a single space. A backspace
6097: character and an immediately following hash character are
6098: replaced with a single hash character. Otherwise the
6099: backslash is passed as is. In a variable assignment, any
6100: hash character that is not preceded by a backslash starts
6101: a comment that continues upto the end of the logical
6102: line.</p>
6103:
6104: <p><span class="emphasis"><em>Note:</em></span> Because
6105: of this parsing algorithm the only way to create a
6106: variable consisting of a single backslash is using the
6107: ``!='' operator, for example: <code class=
6108: "varname">BACKSLASH!=echo "\\"</code>.</p>
6109:
6110: <p>So far for defining variables. The other thing you can
6111: do with variables is evaluating them. A variable is
6112: evaluated when it is part of the right side of the ``:=''
6113: or the ``!='' operator, or directly before executing a
6114: shell command which the variable is part of. In all other
6115: cases <a href=
6116: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6117: <span class="citerefentry"><span class=
6118: "refentrytitle">make</span>(1)</span></a> performs lazy
6119: evaluation, that is, variables are not evaluated until
6120: there's no other way. The ``modifiers'' mentioned in the
6121: man page also evaluate the variable.</p>
6122:
6123: <p>Some of the modifiers split the string into words and
6124: then operate on the words, others operate on the string
6125: as a whole. When a string is splitted into words, it is
6126: splitted as you would expect it from <a href=
6127: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
6128: <span class="citerefentry"><span class=
6129: "refentrytitle">sh</span>(1)</span></a>.</p>
6130:
6131: <p>No rule without exception—the
6132: <span><strong class="command">.for</strong></span> loop
6133: does not follow the shell quoting rules but splits at
6134: sequences of whitespace.</p>
6135:
6136: <p>There are several types of variables that should be
6137: handled differently. Strings and two types of lists.</p>
6138:
6139: <div class="itemizedlist">
6140: <ul type="disc">
6141: <li>
6142: <p><span class="emphasis"><em>Strings</em></span>
6143: can contain arbitrary characters. Nevertheless you
6144: should restrict yourself to only using printable
6145: characters. Examples are <code class=
6146: "varname">PREFIX</code> and <code class=
6147: "varname">COMMENT</code>.</p>
6148: </li>
6149:
6150: <li>
6151: <p><span class="emphasis"><em>Internal
6152: lists</em></span> are lists that are never exported
6153: to any shell command. Their elements are separated
6154: by whitespace. Therefore the elements themselves
6155: cannot have embedded whitespace. Any other
6156: characters are allowed. Internal lists can be used
6157: in <span><strong class=
6158: "command">.for</strong></span> loops. Examples are
6159: <code class="varname">DEPENDS</code> and
6160: <code class="varname">BUILD_DEPENDS</code>.</p>
6161: </li>
6162:
6163: <li>
6164: <p><span class="emphasis"><em>External
6165: lists</em></span> are lists that may be exported to
6166: a shell command. Their elements can contain any
6167: characters, including whitespace. That's why they
6168: cannot be used in <span><strong class=
6169: "command">.for</strong></span> loops. Examples are
6170: <code class="varname">DISTFILES</code> and
6171: <code class="varname">MASTER_SITES</code>.</p>
6172: </li>
6173: </ul>
6174: </div>
6175:
6176: <div class="sect2" lang="en" xml:lang="en">
6177: <div class="titlepage">
6178: <div>
6179: <div>
6180: <h3 class="title"><a name=
6181: "makefile.variables.names" id=
6182: "makefile.variables.names"></a>8.1.1. Naming
6183: conventions</h3>
6184: </div>
6185: </div>
6186: </div>
6187:
6188: <div class="itemizedlist">
6189: <ul type="disc">
6190: <li>
6191: <p>All variable names starting with an underscore
6192: are reserved for use by the pkgsrc
6193: infrastructure. They shall not be used by package
6194: <code class="filename">Makefile</code>s.</p>
6195: </li>
6196:
6197: <li>
6198: <p>In <span><strong class=
6199: "command">.for</strong></span> loops you should
6200: use lowercase variable names for the iteration
6201: variables.</p>
6202: </li>
6203:
6204: <li>
6205: <p>All list variables should have a ``plural''
6206: name, e.g. <code class=
6207: "varname">PKG_OPTIONS</code> or <code class=
6208: "varname">DISTFILES</code>.</p>
6209: </li>
6210: </ul>
6211: </div>
6212: </div>
6213: </div>
6214:
6215: <div class="sect1" lang="en" xml:lang="en">
6216: <div class="titlepage">
6217: <div>
6218: <div>
6219: <h2 class="title" style="clear: both"><a name=
6220: "makefile.code" id=
6221: "makefile.code"></a>8.2. Code snippets</h2>
6222: </div>
6223: </div>
6224: </div>
6225:
6226: <p>This section presents you with some code snippets you
6227: should use in your own code. If you don't find anything
6228: appropriate here, you should test your code and add it
6229: here.</p>
6230:
6231: <div class="sect2" lang="en" xml:lang="en">
6232: <div class="titlepage">
6233: <div>
6234: <div>
1.30 wiz 6235: <h3 class="title"><a name="adding-to-list" id=
6236: "adding-to-list"></a>8.2.1. Adding things to
6237: a list</h3>
1.27 rillig 6238: </div>
6239: </div>
6240: </div>
6241: <pre class="programlisting">
6242: STRING= foo * bar `date`
6243: INT_LIST= # empty
6244: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
6245: EXT_LIST= # empty
6246: ANOTHER_EXT_LIST= a=b c=d
6247:
6248: INT_LIST+= ${STRING} # 1
6249: INT_LIST+= ${ANOTHER_INT_LIST} # 2
6250: EXT_LIST+= ${STRING:Q} # 3
6251: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
6252:
6253: </pre>
6254:
6255: <p>When you add a string to an external list (example
6256: 3), it must be quoted. In all other cases, you must not
6257: add a quoting level. You must not merge internal and
6258: external lists, unless you are sure that all entries
6259: are correctly interpreted in both lists.</p>
6260: </div>
6261:
6262: <div class="sect2" lang="en" xml:lang="en">
6263: <div class="titlepage">
6264: <div>
6265: <div>
1.30 wiz 6266: <h3 class="title"><a name=
6267: "converting-internal-to-external" id=
6268: "converting-internal-to-external"></a>8.2.2. Converting
6269: an internal list into an external list</h3>
1.27 rillig 6270: </div>
6271: </div>
6272: </div>
6273: <pre class="programlisting">
6274: EXT_LIST= # empty
6275: .for i in ${INT_LIST}
6276: EXT_LIST+= ${i:Q}""
6277: .endfor
6278:
6279: </pre>
6280:
6281: <p>This code converts the internal list <code class=
6282: "varname">INT_LIST</code> into the external list
6283: <code class="varname">EXT_LIST</code>. As the elements
6284: of an internal list are unquoted they must be quoted
6285: here. The reason for appending <code class=
6286: "varname">""</code> is explained below.</p>
6287: </div>
1.1 grant 6288:
1.27 rillig 6289: <div class="sect2" lang="en" xml:lang="en">
6290: <div class="titlepage">
1.1 grant 6291: <div>
1.27 rillig 6292: <div>
1.30 wiz 6293: <h3 class="title"><a name=
6294: "passing-variable-to-shell" id=
6295: "passing-variable-to-shell"></a>8.2.3. Passing
6296: variables to a shell command</h3>
1.27 rillig 6297: </div>
1.1 grant 6298: </div>
6299: </div>
1.27 rillig 6300: <pre class="programlisting">
6301: STRING= foo bar < > * `date` $$HOME ' "
6302: EXT_LIST= string=${STRING:Q} x=second\ item
6303:
6304: all:
6305: echo ${STRING} # 1
6306: echo "${STRING}" # 2
6307: echo "${STRING:Q}" # 3
6308: echo ${STRING:Q} # 4
6309: echo x${STRING:Q} | sed 1s,.,, # 5
6310: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
6311:
6312: </pre>
6313:
6314: <p>Example 1 leads to a syntax error in the shell, as
6315: the characters are just copied.</p>
6316:
6317: <p>Example 2 leads to a syntax error too, and if you
6318: leave out the last " character from <code class=
6319: "varname">${STRING}</code>, <a href=
6320: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
6321: <span class="citerefentry"><span class=
6322: "refentrytitle">date</span>(1)</span></a> will be
6323: executed. The <code class="varname">$HOME</code> shell
6324: variable would be evaluated, too.</p>
6325:
6326: <p>Example 3 outputs each space character preceded by a
6327: backslash (or not), depending on the implementation of
6328: the <a href=
6329: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6330: <span class="citerefentry"><span class=
6331: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 6332:
1.27 rillig 6333: <p>Example 4 handles correctly every string that does
6334: not start with a dash. In that case, the result depends
6335: on the implementation of the <a href=
6336: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6337: <span class="citerefentry"><span class=
6338: "refentrytitle">echo</span>(1)</span></a> command. As
6339: long as you can guarantee that your input does not
6340: start with a dash this form is appropriate.</p>
1.1 grant 6341:
1.27 rillig 6342: <p>Example 5 handles even the case of a leading dash
6343: correctly.</p>
1.1 grant 6344:
1.27 rillig 6345: <p>The <code class="varname">EXT_LIST</code> does not
6346: need to be quoted because the quoting has already be
6347: done when adding elements to the list.</p>
1.1 grant 6348:
1.27 rillig 6349: <p>As internal lists shall not be passed to the shell,
6350: there is no example for it.</p>
1.1 grant 6351: </div>
6352:
1.27 rillig 6353: <div class="sect2" lang="en" xml:lang="en">
6354: <div class="titlepage">
1.1 grant 6355: <div>
1.27 rillig 6356: <div>
1.30 wiz 6357: <h3 class="title"><a name="quoting-guideline" id=
6358: "quoting-guideline"></a>8.2.4. Quoting
1.27 rillig 6359: guideline</h3>
6360: </div>
1.1 grant 6361: </div>
6362: </div>
6363:
1.27 rillig 6364: <p>There are many possible sources of wrongly quoted
6365: variables. This section lists some of the commonly
6366: known ones.</p>
1.1 grant 6367:
1.27 rillig 6368: <div class="itemizedlist">
6369: <ul type="disc">
6370: <li>
6371: <p>Whenever you use the value of a list, think
6372: about what happens to leading or trailing
6373: whitespace. If the list is a well-formed shell
6374: expression you can apply the <code class=
6375: "varname">:M*</code> modifier to strip leading
6376: and trailing whitespace from each word. The
6377: <code class="varname">:M</code> operator first
6378: splits its argument according to the rules of the
6379: shell, and then creates a new list consisting of
6380: all words that match the shell glob expression
6381: <code class="varname">*</code>, that is: all. One
6382: class of situations where this is needed is when
6383: adding a variable like <code class=
6384: "varname">CPPFLAGS</code> to <code class=
6385: "varname">CONFIGURE_ARGS</code>. If the configure
6386: script invokes other configure scripts it strips
6387: the leading and trailing whitespace from the
6388: variable and then passes it to the other
6389: configure scripts. But these configure scripts
6390: expect the (child) <code class=
6391: "varname">CPPFLAGS</code> variable to be the same
6392: as the parent <code class=
6393: "varname">CPPFLAGS</code>. That's why we better
6394: pass the <code class="varname">CPPFLAGS</code>
6395: value properly trimmed. And here is how we do
6396: it:</p>
6397: <pre class="programlisting">
6398: CPPFLAGS= # empty
6399: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
6400: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 grant 6401:
1.27 rillig 6402: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 grant 6403:
1.27 rillig 6404: all:
6405: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
6406: echo x${CONFIGURE_ARGS}x # properly trimmed
6407:
6408: </pre>
6409: </li>
1.1 grant 6410:
1.27 rillig 6411: <li>
6412: <p>The example above contains one bug: The
6413: <code class="varname">${PREFIX}</code> is a
6414: properly quoted shell expression, but there is
6415: the C compiler after it, which also expects a
6416: properly quoted string (this time in C syntax).
6417: The version above is therefore only correct if
6418: <code class="varname">${PREFIX}</code> does not
6419: have embedded backslashes or double quotes. If
6420: you want to allow these, you have to add another
6421: layer of quoting to each variable that is used as
6422: a C string literal. You cannot use the
6423: <code class="varname">:Q</code> operator for it,
6424: as this operator only works for the shell.</p>
6425: </li>
1.1 grant 6426:
1.27 rillig 6427: <li>
6428: <p>Whenever a variable can be empty the
6429: <code class="varname">:Q</code> operator can have
6430: surprising results. Here are two completely
6431: different cases which can be solved with the same
6432: trick.</p>
6433: <pre class="programlisting">
6434: EMPTY= # empty
6435: empty_test:
6436: for i in a ${EMPTY:Q} c; do \
6437: echo "$$i"; \
6438: done
6439:
6440: for_test:
6441: .for i in a:\ a:\test.txt
6442: echo ${i:Q}
6443: echo "foo"
6444: .endfor
6445:
1.1 grant 6446: </pre>
6447:
1.27 rillig 6448: <p>The first example will only print two of the
6449: three lines we might have expected. This is
6450: because <code class="varname">${EMPTY:Q}</code>
6451: expands to the empty string, which the shell
6452: cannot see. The workaround is to write
6453: <code class="varname">${EMPTY:Q}""</code>. This
6454: pattern can be often found as <code class=
6455: "varname">${TEST} -z ${VAR:Q}</code> or as
6456: <code class="varname">${TEST} -f
6457: ${FNAME:Q}</code> (both of these are wrong).</p>
6458:
6459: <p>The second example will only print three lines
6460: instead of four. The first line looks like
6461: <code class="varname">a:\ echo foo</code>. This
6462: is because the backslash of the value
6463: <code class="varname">a:\</code> is interpreted
6464: as a line-continuation by <a href=
6465: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6466: <span class="citerefentry"><span class=
6467: "refentrytitle">make</span>(1)</span></a>, which
6468: makes the second line the arguments of the
6469: <a href=
6470: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6471: <span class="citerefentry"><span class=
6472: "refentrytitle">echo</span>(1)</span></a> command
6473: from the first line. To avoid this, write
6474: <code class="varname">${i:Q}""</code>.</p>
6475: </li>
6476: </ul>
6477: </div>
1.1 grant 6478: </div>
6479:
1.27 rillig 6480: <div class="sect2" lang="en" xml:lang="en">
6481: <div class="titlepage">
1.1 grant 6482: <div>
1.27 rillig 6483: <div>
1.30 wiz 6484: <h3 class="title"><a name=
6485: "bsd-make-bug-workaround" id=
6486: "bsd-make-bug-workaround"></a>8.2.5. Workaround
6487: for a bug in BSD Make</h3>
1.27 rillig 6488: </div>
1.1 grant 6489: </div>
6490: </div>
6491:
1.27 rillig 6492: <p>The pkgsrc bmake program does not handle the
6493: following assignment correctly. In case <code class=
6494: "varname">_othervar_</code> contains a ``-'' character,
6495: one of the closing braces is included in <code class=
6496: "varname">${VAR}</code> after this code executes.</p>
6497: <pre class="programlisting">
6498: VAR:= ${VAR:N${_othervar_:C/-//}}
6499:
1.1 grant 6500: </pre>
6501:
1.27 rillig 6502: <p>For a more complex code snippet and a workaround,
6503: see the package <a xmlns=
6504: "http://www.w3.org/TR/xhtml1/transitional" href=
6505: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
6506: class="pkgname">regress/make-quoting</a>, testcase
6507: <code class="varname">bug1</code>.</p>
1.1 grant 6508: </div>
6509: </div>
6510: </div>
6511:
6512: <div class="chapter" lang="en" xml:lang="en">
6513: <div class="titlepage">
6514: <div>
6515: <div>
6516: <h2 class="title"><a name="plist" id=
1.25 rillig 6517: "plist"></a>Chapter 9. PLIST issues</h2>
1.1 grant 6518: </div>
6519: </div>
6520: </div>
6521:
6522: <div class="toc">
6523: <p><b>Table of Contents</b></p>
6524:
6525: <dl>
1.30 wiz 6526: <dt><span class="sect1"><a href="#rcs-id">9.1. RCS
1.1 grant 6527: ID</a></span></dt>
6528:
1.30 wiz 6529: <dt><span class="sect1"><a href=
6530: "#automatic-plist-generation">9.2. Semi-automatic
6531: <code class="filename">PLIST</code>
1.14 xtraeme 6532: generation</a></span></dt>
1.1 grant 6533:
1.25 rillig 6534: <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14 xtraeme 6535: Tweaking output of <span><strong class="command">make
6536: print-PLIST</strong></span></a></span></dt>
1.1 grant 6537:
1.25 rillig 6538: <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1 grant 6539: Variable substitution in PLIST</a></span></dt>
6540:
1.30 wiz 6541: <dt><span class="sect1"><a href=
6542: "#manpage-compression">9.5.
1.1 grant 6543: Manpage-compression</a></span></dt>
6544:
1.30 wiz 6545: <dt><span class="sect1"><a href="#using-PLIST_SRC">9.6.
1.14 xtraeme 6546: Changing PLIST source with <code class=
6547: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 6548:
1.30 wiz 6549: <dt><span class="sect1"><a href=
6550: "#platform-specific-plist">9.7. Platform specific and
6551: differing PLISTs</a></span></dt>
1.1 grant 6552:
1.25 rillig 6553: <dt><span class="sect1"><a href="#faq.common-dirs">9.8.
1.1 grant 6554: Sharing directories between packages</a></span></dt>
6555: </dl>
6556: </div>
6557:
1.14 xtraeme 6558: <p>The <code class="filename">PLIST</code> file contains a
1.1 grant 6559: package's “<span class="quote">packing
6560: list</span>”, i.e. a list of files that belong to the
1.14 xtraeme 6561: package (relative to the <code class=
6562: "filename">${PREFIX}</code> directory it's been installed
6563: in) plus some additional statements - see the <a href=
1.1 grant 6564: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6565: <span class="citerefentry"><span class=
6566: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
6567: a full list. This chapter addresses some issues that need
1.14 xtraeme 6568: attention when dealing with the <code class=
6569: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 6570:
6571: <div class="sect1" lang="en" xml:lang="en">
6572: <div class="titlepage">
6573: <div>
6574: <div>
6575: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6576: "rcs-id" id="rcs-id"></a>9.1. RCS ID</h2>
1.1 grant 6577: </div>
6578: </div>
6579: </div>
6580:
6581: <p>Be sure to add a RCS ID line as the first thing in any
1.14 xtraeme 6582: <code class="filename">PLIST</code> file you write:</p>
1.1 grant 6583: <pre class="programlisting">
1.17 sketch 6584: @comment $NetBSD$
1.1 grant 6585: </pre>
6586: </div>
6587:
6588: <div class="sect1" lang="en" xml:lang="en">
6589: <div class="titlepage">
6590: <div>
6591: <div>
6592: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6593: "automatic-plist-generation" id=
6594: "automatic-plist-generation"></a>9.2. Semi-automatic
1.14 xtraeme 6595: <code class="filename">PLIST</code> generation</h2>
1.1 grant 6596: </div>
6597: </div>
6598: </div>
6599:
1.14 xtraeme 6600: <p>You can use the <span><strong class="command">make
6601: print-PLIST</strong></span> command to output a PLIST
6602: that matches any new files since the package was
6603: extracted. See <a href="#build.helpful-targets" title=
1.25 rillig 6604: "12.3. Other helpful targets">Section 12.3,
1.1 grant 6605: “Other helpful targets”</a> for more
6606: information on this target.</p>
6607: </div>
6608:
6609: <div class="sect1" lang="en" xml:lang="en">
6610: <div class="titlepage">
6611: <div>
6612: <div>
6613: <h2 class="title" style="clear: both"><a name=
6614: "print-PLIST" id=
1.25 rillig 6615: "print-PLIST"></a>9.3. Tweaking output of
1.14 xtraeme 6616: <span><strong class="command">make
6617: print-PLIST</strong></span></h2>
1.1 grant 6618: </div>
6619: </div>
6620: </div>
6621:
6622: <p>If you have used any of the *-dirs packages, as
6623: explained in <a href="#faq.common-dirs" title=
1.25 rillig 6624: "9.8. Sharing directories between packages">Section 9.8,
1.1 grant 6625: “Sharing directories between packages”</a>,
1.14 xtraeme 6626: you may have noticed that <span><strong class=
6627: "command">make print-PLIST</strong></span> outputs a set
6628: of <code class="varname">@comment</code>s instead of real
6629: <code class="varname">@dirrm</code> lines. You can also
6630: do this for specific directories and files, so that the
6631: results of that command are very close to reality. This
6632: helps <span class="emphasis"><em>a lot</em></span> during
6633: the update of packages.</p>
6634:
6635: <p>The <code class="varname">PRINT_PLIST_AWK</code>
6636: variable takes a set of AWK patterns and actions that are
6637: used to filter the output of print-PLIST. You can
6638: <span class="emphasis"><em>append</em></span> any chunk
6639: of AWK scripting you like to it, but be careful with
1.1 grant 6640: quoting.</p>
6641:
1.14 xtraeme 6642: <p>For example, to get all files inside the <code class=
6643: "filename">libdata/foo</code> directory removed from the
1.1 grant 6644: resulting PLIST:</p>
6645: <pre class="programlisting">
6646: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
6647:
6648: </pre>
6649:
1.14 xtraeme 6650: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 6651: lines referring to a specific (shared) directory
1.14 xtraeme 6652: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 6653: <pre class="programlisting">
6654: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
6655:
6656: </pre>
6657: </div>
6658:
6659: <div class="sect1" lang="en" xml:lang="en">
6660: <div class="titlepage">
6661: <div>
6662: <div>
6663: <h2 class="title" style="clear: both"><a name=
1.25 rillig 6664: "plist.misc" id="plist.misc"></a>9.4. Variable
1.1 grant 6665: substitution in PLIST</h2>
6666: </div>
6667: </div>
6668: </div>
6669:
6670: <p>A number of variables are substituted automatically in
6671: PLISTs when a package is installed on a system. This
6672: includes the following variables:</p>
6673:
6674: <div class="variablelist">
6675: <dl>
1.14 xtraeme 6676: <dt><span class="term"><code class=
6677: "varname">${MACHINE_ARCH}</code>, <code class=
6678: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 6679:
6680: <dd>
6681: <p>Some packages like emacs and perl embed
6682: information about which architecture they were
6683: built on into the pathnames where they install
6684: their file. To handle this case, PLIST will be
6685: preprocessed before actually used, and the symbol
1.14 xtraeme 6686: “<span class="quote"><code class=
6687: "varname">${MACHINE_ARCH}</code></span>” will
6688: be replaced by what <span><strong class=
6689: "command">uname -p</strong></span> gives. The same
6690: is done if the string <code class=
6691: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
6692: PLIST somewhere - use this on packages that have
6693: GNU autoconf created configure scripts.</p>
1.1 grant 6694:
6695: <div class="note" style=
6696: "margin-left: 0.5in; margin-right: 0.5in;">
6697: <h3 class="title">Legacy note</h3>
6698:
6699: <p>There used to be a symbol “<span class=
1.14 xtraeme 6700: "quote"><code class=
6701: "varname">$ARCH</code></span>” that was
6702: replaced by the output of <span><strong class=
6703: "command">uname -m</strong></span>, but that's no
1.1 grant 6704: longer supported and has been removed.</p>
6705: </div>
6706: </dd>
6707:
1.14 xtraeme 6708: <dt><span class="term"><code class=
6709: "varname">${OPSYS}</code>, <code class=
6710: "varname">${LOWER_OPSYS}</code>, <code class=
6711: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 6712:
6713: <dd>
6714: <p>Some packages want to embed the OS name and
6715: version into some paths. To do this, use these
1.14 xtraeme 6716: variables in the <code class=
6717: "filename">PLIST</code>:</p>
1.1 grant 6718:
6719: <div class="itemizedlist">
6720: <ul type="disc">
6721: <li>
1.14 xtraeme 6722: <p><code class="varname">${OPSYS}</code> -
6723: output of “<span class=
6724: "quote"><span><strong class="command">uname
6725: -s</strong></span></span>”</p>
1.1 grant 6726: </li>
6727:
6728: <li>
1.14 xtraeme 6729: <p><code class=
6730: "varname">${LOWER_OPSYS}</code> - lowercase
6731: common name (eg. “<span class=
6732: "quote">solaris</span>”)</p>
1.1 grant 6733: </li>
6734:
6735: <li>
1.14 xtraeme 6736: <p><code class="varname">${OS_VERSION}</code>
6737: - “<span class=
6738: "quote"><span><strong class="command">uname
6739: -r</strong></span></span>”</p>
1.1 grant 6740: </li>
6741: </ul>
6742: </div>
6743: </dd>
6744:
1.14 xtraeme 6745: <dt><span class="term"><code class=
6746: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 6747:
6748: <dd>
6749: <p>Packages that install locale files should list
6750: them in the PLIST as “<span class=
6751: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
6752: instead of “<span class=
6753: "quote">share/locale/de/LC_MESSAGES/...</span>”.
6754: This properly handles the fact that different
6755: operating systems expect locale files to be either
1.14 xtraeme 6756: in <code class="filename">share</code> or
6757: <code class="filename">lib</code> by default.</p>
1.1 grant 6758: </dd>
6759: </dl>
6760: </div>
6761:
6762: <p>For a complete list of values which are replaced by
1.14 xtraeme 6763: default, please look in <code class=
6764: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 6765: "emphasis"><em>PLIST_SUBST</em></span>).</p>
6766:
6767: <p>If you want to change other variables not listed
6768: above, you can add variables and their expansions to this
1.14 xtraeme 6769: variable in the following way, similar to <code class=
6770: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 6771: "#components.optional" title=
1.27 rillig 6772: "7.5. Optional files">Section 7.5,
1.1 grant 6773: “Optional files”</a>):</p>
6774: <pre class="programlisting">
6775: PLIST_SUBST+= SOMEVAR="somevalue"
6776: </pre>
6777:
6778: <p>This replaces all occurrences of “<span class=
6779: "quote">${SOMEVAR}</span>” in the PLIST with
6780: “<span class="quote">somevalue</span>”.</p>
6781: </div>
6782:
6783: <div class="sect1" lang="en" xml:lang="en">
6784: <div class="titlepage">
6785: <div>
6786: <div>
6787: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6788: "manpage-compression" id=
6789: "manpage-compression"></a>9.5. Manpage-compression</h2>
1.1 grant 6790: </div>
6791: </div>
6792: </div>
6793:
6794: <p>Manpages should be installed in compressed form if
1.14 xtraeme 6795: <code class="varname">MANZ</code> is set (in <code class=
6796: "filename">bsd.own.mk</code>), and uncompressed
6797: otherwise. To handle this in the <code class=
6798: "filename">PLIST</code> file, the suffix
6799: “<span class="quote">.gz</span>” is
6800: appended/removed automatically for manpages according to
6801: <code class="varname">MANZ</code> and <code class=
6802: "varname">MANCOMPRESSED</code> being set or not, see
6803: above for details. This modification of the <code class=
6804: "filename">PLIST</code> file is done on a copy of it, not
6805: <code class="filename">PLIST</code> itself.</p>
1.1 grant 6806: </div>
6807:
6808: <div class="sect1" lang="en" xml:lang="en">
6809: <div class="titlepage">
6810: <div>
6811: <div>
6812: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6813: "using-PLIST_SRC" id=
6814: "using-PLIST_SRC"></a>9.6. Changing PLIST
6815: source with <code class=
1.14 xtraeme 6816: "varname">PLIST_SRC</code></h2>
1.1 grant 6817: </div>
6818: </div>
6819: </div>
6820:
1.14 xtraeme 6821: <p>To use one or more files as source for the
6822: <code class="filename">PLIST</code> used in generating
6823: the binary package, set the variable <code class=
6824: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 6825: The files are later concatenated using <a href=
6826: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
6827: <span class="citerefentry"><span class=
6828: "refentrytitle">cat</span>(1)</span></a>, and order of
6829: things is important.</p>
1.1 grant 6830: </div>
6831:
6832: <div class="sect1" lang="en" xml:lang="en">
6833: <div class="titlepage">
6834: <div>
6835: <div>
6836: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6837: "platform-specific-plist" id=
6838: "platform-specific-plist"></a>9.7. Platform
1.1 grant 6839: specific and differing PLISTs</h2>
6840: </div>
6841: </div>
6842: </div>
6843:
6844: <p>Some packages decide to install a different set of
6845: files based on the operating system being used. These
6846: differences can be automatically handled by using the
6847: following files:</p>
6848:
6849: <div class="itemizedlist">
6850: <ul type="disc">
6851: <li>
1.14 xtraeme 6852: <p><code class="filename">PLIST.common</code></p>
1.1 grant 6853: </li>
6854:
6855: <li>
1.14 xtraeme 6856: <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1 grant 6857: </li>
6858:
6859: <li>
1.14 xtraeme 6860: <p><code class=
1.21 ben 6861: "filename">PLIST.${MACHINE_ARCH}</code></p>
6862: </li>
6863:
6864: <li>
6865: <p><code class=
6866: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
6867: </li>
6868:
6869: <li>
6870: <p><code class=
1.14 xtraeme 6871: "filename">PLIST.common_end</code></p>
1.1 grant 6872: </li>
6873: </ul>
6874: </div>
6875: </div>
6876:
6877: <div class="sect1" lang="en" xml:lang="en">
6878: <div class="titlepage">
6879: <div>
6880: <div>
6881: <h2 class="title" style="clear: both"><a name=
6882: "faq.common-dirs" id=
1.25 rillig 6883: "faq.common-dirs"></a>9.8. Sharing directories
1.1 grant 6884: between packages</h2>
6885: </div>
6886: </div>
6887: </div>
6888:
6889: <p>A “<span class="quote">shared
6890: directory</span>” is a directory where multiple
6891: (and unrelated) packages install files. These directories
6892: are problematic because you have to add special tricks in
6893: the PLIST to conditionally remove them, or have some
6894: centralized package handle them.</p>
6895:
6896: <p>Within pkgsrc, you'll find both approaches. If a
6897: directory is shared by a few unrelated packages, it's
6898: often not worth to add an extra package to remove it.
6899: Therefore, one simply does:</p>
6900: <pre class="programlisting">
6901: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
6902:
6903: </pre>
6904:
6905: <p>in the PLISTs of all affected packages, instead of the
6906: regular "@dirrm" line.</p>
6907:
6908: <p>However, if the directory is shared across many
6909: packages, two different solutions are available:</p>
6910:
6911: <div class="orderedlist">
6912: <ol type="1">
6913: <li>
6914: <p>If the packages have a common dependency, the
6915: directory can be removed in that. For example, see
6916: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
6917: href=
6918: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20 ben 6919: class="pkgname">textproc/scrollkeeper</a>, which
6920: removes the shared directory <code class=
6921: "filename">share/omf</code>.</p>
1.1 grant 6922: </li>
6923:
6924: <li>
6925: <p>If the packages using the directory are not
6926: related at all (they have no common dependencies),
6927: a *-dirs package is used.</p>
6928: </li>
6929: </ol>
6930: </div>
6931:
6932: <p>From now on, we'll discuss the second solution. To get
6933: an idea of the *-dirs packages available, issue:</p>
6934: <pre class="programlisting">
1.14 xtraeme 6935: <code class="prompt">%</code> cd .../pkgsrc
6936: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 6937:
6938: </pre>
6939:
6940: <p>Their use from other packages is very simple. The
1.14 xtraeme 6941: <code class="varname">USE_DIRS</code> variable takes a
6942: list of package names (without the “<span class=
1.1 grant 6943: "quote">-dirs</span>” part) together with the
6944: required version number (always pick the latest one when
6945: writting new packages).</p>
6946:
6947: <p>For example, if a package installs files under
1.14 xtraeme 6948: <code class="filename">share/applications</code>, it
6949: should have the following line in it:</p>
1.1 grant 6950: <pre class="programlisting">
6951: USE_DIRS+= xdg-1.1
6952:
6953: </pre>
6954:
1.14 xtraeme 6955: <p>After regenerating the PLIST using
6956: <span><strong class="command">make
6957: print-PLIST</strong></span>, you should get the right
6958: (commented out) lines.</p>
1.1 grant 6959:
1.14 xtraeme 6960: <p>Note that, even if your package is using <code class=
6961: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 6962: *-x11-dirs packages. Just specify the name without that
1.14 xtraeme 6963: part and pkgsrc (in particular, <code class=
6964: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 6965: </div>
6966: </div>
6967:
6968: <div class="chapter" lang="en" xml:lang="en">
6969: <div class="titlepage">
6970: <div>
6971: <div>
6972: <h2 class="title"><a name="buildlink" id=
1.25 rillig 6973: "buildlink"></a>Chapter 10. Buildlink
1.1 grant 6974: methodology</h2>
6975: </div>
6976: </div>
6977: </div>
6978:
6979: <div class="toc">
6980: <p><b>Table of Contents</b></p>
6981:
6982: <dl>
1.30 wiz 6983: <dt><span class="sect1"><a href=
6984: "#converting-to-buildlink3">10.1. Converting packages
6985: to use buildlink3</a></span></dt>
1.1 grant 6986:
1.30 wiz 6987: <dt><span class="sect1"><a href=
6988: "#creating-buildlink3.mk">10.2. Writing <code class=
6989: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 6990:
6991: <dd>
6992: <dl>
1.25 rillig 6993: <dt><span class="sect2"><a href=
1.30 wiz 6994: "#anatomy-of-bl3">10.2.1. Anatomy of a
6995: buildlink3.mk file</a></span></dt>
1.1 grant 6996:
1.25 rillig 6997: <dt><span class="sect2"><a href=
1.30 wiz 6998: "#updating-buildlink-depends">10.2.2. Updating
6999: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 7000: "replaceable"><code>pkg</code></em></code> in
7001: <code class="filename">buildlink3.mk</code>
1.1 grant 7002: files</a></span></dt>
7003: </dl>
7004: </dd>
7005:
1.30 wiz 7006: <dt><span class="sect1"><a href=
7007: "#writing-builtin.mk">10.3. Writing <code class=
7008: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 7009:
7010: <dd>
7011: <dl>
1.25 rillig 7012: <dt><span class="sect2"><a href=
1.30 wiz 7013: "#anatomy-of-builtin.mk">10.3.1. Anatomy of a
7014: <code class="filename">builtin.mk</code>
7015: file</a></span></dt>
1.1 grant 7016:
1.25 rillig 7017: <dt><span class="sect2"><a href=
1.30 wiz 7018: "#native-or-pkgsrc-preference">10.3.2. Global
7019: preferences for native or pkgsrc
7020: software</a></span></dt>
1.1 grant 7021: </dl>
7022: </dd>
7023: </dl>
7024: </div>
7025:
7026: <p>Buildlink is a framework in pkgsrc that controls what
7027: headers and libraries are seen by a package's configure and
7028: build processes. This is implemented in a two step
7029: process:</p>
7030:
7031: <div class="orderedlist">
7032: <ol type="1">
7033: <li>
7034: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 7035: into <code class="varname">BUILDLINK_DIR</code>,
7036: which by default is a subdirectory of <code class=
7037: "varname">WRKDIR</code>.</p>
1.1 grant 7038: </li>
7039:
7040: <li>
7041: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 7042: the normal compiler tools that translate <code class=
7043: "option">-I${LOCALBASE}/include</code> and
7044: <code class="option">-L${LOCALBASE}/lib</code> into
7045: references to <code class=
7046: "varname">BUILDLINK_DIR</code>. The wrapper scripts
7047: also make native compiler on some operating systems
7048: look like GCC, so that packages that expect GCC won't
7049: require modifications to build with those native
7050: compilers.</p>
1.1 grant 7051: </li>
7052: </ol>
7053: </div>
7054:
7055: <p>This normalizes the environment in which a package is
7056: built so that the package may be built consistently despite
7057: what other software may be installed. Please note that the
1.14 xtraeme 7058: normal system header and library paths, e.g. <code class=
7059: "filename">/usr/include</code>, <code class=
7060: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 7061: buildlink3 is designed to insulate the package build from
7062: non-system-supplied software.</p>
7063:
7064: <div class="sect1" lang="en" xml:lang="en">
7065: <div class="titlepage">
7066: <div>
7067: <div>
7068: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7069: "converting-to-buildlink3" id=
7070: "converting-to-buildlink3"></a>10.1. Converting
7071: packages to use buildlink3</h2>
1.1 grant 7072: </div>
7073: </div>
7074: </div>
7075:
7076: <p>The process of converting packages to use the
7077: buildlink3 framework (“<span class=
7078: "quote">bl3ifying</span>”) is fairly
7079: straightforward. The things to keep in mind are:</p>
7080:
7081: <div class="orderedlist">
7082: <ol type="1">
7083: <li>
7084: <p>Ensure that the build always calls the wrapper
7085: scripts instead of the actual toolchain. Some
7086: packages are tricky, and the only way to know for
1.14 xtraeme 7087: sure is the check <code class=
7088: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 7089: wrappers are being invoked.</p>
7090: </li>
7091:
7092: <li>
1.14 xtraeme 7093: <p>Don't override <code class=
7094: "varname">PREFIX</code> from within the package
7095: Makefile, e.g. Java VMs, standalone shells, etc.,
7096: because the code to symlink files into <code class=
7097: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 7098: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 7099: <em class=
7100: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 7101: </li>
7102:
7103: <li>
7104: <p>Remember that <span class=
1.14 xtraeme 7105: "emphasis"><em>only</em></span> the <code class=
7106: "filename">buildlink3.mk</code> files that you list
1.1 grant 7107: in a package's Makefile are added as dependencies
7108: for that package.</p>
7109: </li>
7110: </ol>
7111: </div>
7112:
7113: <p>If a dependency on a particular package is required
7114: for its libraries and headers, then we replace:</p>
7115: <pre class="programlisting">
1.27 rillig 7116: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 7117: </pre>
7118:
7119: <p>with</p>
7120: <pre class="programlisting">
7121: .include "../../category/foo/buildlink3.mk"
7122: </pre>
7123:
1.14 xtraeme 7124: <p>There are several <code class=
7125: "filename">buildlink3.mk</code> files in <code class=
7126: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 7127: issues:</p>
7128:
7129: <div class="itemizedlist">
7130: <ul type="disc">
7131: <li>
1.14 xtraeme 7132: <p><code class="filename">bdb.buildlink3.mk</code>
1.1 grant 7133: chooses either the native or a pkgsrc Berkeley DB
1.14 xtraeme 7134: implementation based on the values of <code class=
7135: "varname">BDB_ACCEPTED</code> and <code class=
7136: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 7137: </li>
7138:
7139: <li>
1.14 xtraeme 7140: <p><code class=
7141: "filename">curses.buildlink3.mk</code> If the
7142: system comes with neither Curses nor NCurses, this
7143: will take care to install the <a xmlns=
7144: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 7145: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20 ben 7146: class="pkgname">devel/ncurses</a> package.</p>
1.1 grant 7147: </li>
7148:
7149: <li>
1.14 xtraeme 7150: <p><code class="filename">krb5.buildlink3.mk</code>
7151: uses the value of <code class=
7152: "varname">KRB5_ACCEPTED</code> to choose between
1.1 grant 7153: adding a dependency on Heimdal or MIT-krb5 for
7154: packages that require a Kerberos 5
7155: implementation.</p>
7156: </li>
7157:
7158: <li>
1.14 xtraeme 7159: <p><code class=
7160: "filename">motif.buildlink3.mk</code> checks for a
7161: system-provided Motif installation or adds a
7162: dependency on <a xmlns=
1.1 grant 7163: "http://www.w3.org/TR/xhtml1/transitional" href=
7164: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20 ben 7165: class="pkgname">x11/lesstif</a> or <a xmlns=
7166: "http://www.w3.org/TR/xhtml1/transitional" href=
7167: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
7168: class="pkgname">x11/openmotif</a>;</p>
1.1 grant 7169: </li>
7170:
7171: <li>
1.14 xtraeme 7172: <p><code class=
7173: "filename">ossaudio.buildlink3.mk</code> defines
7174: several variables that may be used by packages that
7175: use the Open Sound System (OSS) API;</p>
1.1 grant 7176: </li>
7177:
7178: <li>
1.14 xtraeme 7179: <p><code class=
7180: "filename">pgsql.buildlink3.mk</code> will accept
7181: either Postgres 7.3 or 7.4, whichever is found
7182: installed. See the file for more information.</p>
1.1 grant 7183: </li>
7184:
7185: <li>
1.14 xtraeme 7186: <p><code class=
7187: "filename">pthread.buildlink3.mk</code> uses the
7188: value of <code class="varname">PTHREAD_OPTS</code>
7189: and checks for native pthreads or adds a dependency
7190: on <a xmlns=
1.1 grant 7191: "http://www.w3.org/TR/xhtml1/transitional" href=
7192: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20 ben 7193: class="pkgname">devel/pth</a> as needed;</p>
1.1 grant 7194: </li>
7195:
7196: <li>
1.14 xtraeme 7197: <p><code class="filename">xaw.buildlink3.mk</code>
7198: uses the value of <code class=
7199: "varname">XAW_TYPE</code> to choose a particular
7200: Athena widgets library.</p>
1.1 grant 7201: </li>
7202: </ul>
7203: </div>
7204:
1.14 xtraeme 7205: <p>The comments in those <code class=
7206: "filename">buildlink3.mk</code> files provide a more
1.1 grant 7207: complete description of how to use them properly.</p>
7208: </div>
7209:
7210: <div class="sect1" lang="en" xml:lang="en">
7211: <div class="titlepage">
7212: <div>
7213: <div>
7214: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7215: "creating-buildlink3.mk" id=
7216: "creating-buildlink3.mk"></a>10.2. Writing
1.14 xtraeme 7217: <code class="filename">buildlink3.mk</code>
7218: files</h2>
1.1 grant 7219: </div>
7220: </div>
7221: </div>
7222:
1.14 xtraeme 7223: <p>A package's <code class=
7224: "filename">buildlink3.mk</code> file is included by
7225: Makefiles to indicate the need to compile and link
7226: against header files and libraries provided by the
7227: package. A <code class="filename">buildlink3.mk</code>
7228: file should always provide enough information to add the
7229: correct type of dependency relationship and include any
7230: other <code class="filename">buildlink3.mk</code> files
7231: that it needs to find headers and libraries that it needs
7232: in turn.</p>
1.1 grant 7233:
1.14 xtraeme 7234: <p>To generate an initial <code class=
7235: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 7236: Rene Hexel's <a xmlns=
7237: "http://www.w3.org/TR/xhtml1/transitional" href=
7238: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20 ben 7239: class="pkgname">pkgtools/createbuildlink</a> package is
7240: highly recommended. For most packages, the following
7241: command will generate a good starting point for
7242: <code class="filename">buildlink3.mk</code> files:</p>
1.1 grant 7243: <pre class="screen">
1.14 xtraeme 7244: <code class="prompt">%</code> <strong class=
7245: "userinput"><code>cd pkgsrc/<em class=
7246: "replaceable"><code>category</code></em>/<em class=
7247: "replaceable"><code>pkgdir</code></em>
7248: <code class=
7249: "prompt">%</code> createbuildlink -3 >buildlink3.mk</code></strong>
1.1 grant 7250: </pre>
7251:
7252: <div class="sect2" lang="en" xml:lang="en">
7253: <div class="titlepage">
7254: <div>
7255: <div>
1.30 wiz 7256: <h3 class="title"><a name="anatomy-of-bl3" id=
7257: "anatomy-of-bl3"></a>10.2.1. Anatomy of a
1.25 rillig 7258: buildlink3.mk file</h3>
1.1 grant 7259: </div>
7260: </div>
7261: </div>
7262:
1.14 xtraeme 7263: <p>The following real-life example <code class=
7264: "filename">buildlink3.mk</code> is taken from
7265: <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 7266: <pre class="programlisting">
1.17 sketch 7267: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 7268:
7269: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
7270: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
7271:
7272: .if !empty(BUILDLINK_DEPTH:M+)
7273: BUILDLINK_DEPENDS+= tiff
7274: .endif
7275:
7276: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
7277: BUILDLINK_PACKAGES+= tiff
7278:
7279: .if !empty(TIFF_BUILDLINK3_MK:M+)
7280: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
7281: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
7282: .endif # TIFF_BUILDLINK3_MK
7283:
7284: .include "../../devel/zlib/buildlink3.mk"
7285: .include "../../graphics/jpeg/buildlink3.mk"
7286:
7287: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
7288: </pre>
7289:
1.14 xtraeme 7290: <p>The header and footer manipulate <code class=
7291: "varname">BUILDLINK_DEPTH</code>, which is common
7292: across all <code class="filename">buildlink3.mk</code>
7293: files and is used to track at what depth we are
7294: including <code class="filename">buildlink3.mk</code>
7295: files.</p>
1.1 grant 7296:
7297: <p>The first section controls if the dependency on
1.14 xtraeme 7298: <em class="replaceable"><code>pkg</code></em> is added.
7299: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 7300: global list of packages for which dependencies are
7301: added by buildlink3.</p>
7302:
7303: <p>The second section advises pkgsrc that the
1.14 xtraeme 7304: <code class="filename">buildlink3.mk</code> file for
7305: <em class="replaceable"><code>pkg</code></em> has been
7306: included at some point. <code class=
7307: "varname">BUILDLINK_PACKAGES</code> is the global list
7308: of packages for which <code class=
7309: "filename">buildlink3.mk</code> files have been
7310: included. It must <span class=
7311: "emphasis"><em>always</em></span> be appended to within
7312: a <code class="filename">buildlink3.mk</code> file.</p>
1.1 grant 7313:
7314: <p>The third section is protected from multiple
1.14 xtraeme 7315: inclusion and controls how the dependency on <em class=
7316: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 7317: important variables are set in the section:</p>
7318:
7319: <div class="itemizedlist">
7320: <ul type="disc">
7321: <li>
1.14 xtraeme 7322: <p><code class=
7323: "varname">BUILDLINK_DEPENDS.<em class=
7324: "replaceable"><code>pkg</code></em></code> is the
7325: actual dependency recorded in the installed
7326: package; this should always be set using
7327: <span><strong class="command">+=</strong></span>
7328: to ensure that we're appending to any
7329: pre-existing list of values. This variable should
7330: be set to the first version of the package that
7331: had the last change in the major number of a
7332: shared library or that had a major API
7333: change.</p>
1.1 grant 7334: </li>
7335:
7336: <li>
1.14 xtraeme 7337: <p><code class=
7338: "varname">BUILDLINK_PKGSRCDIR.<em class=
7339: "replaceable"><code>pkg</code></em></code> is the
7340: location of the <em class=
7341: "replaceable"><code>pkg</code></em> pkgsrc
1.1 grant 7342: directory;</p>
7343: </li>
7344:
7345: <li>
1.14 xtraeme 7346: <p><code class=
7347: "varname">BUILDLINK_DEPMETHOD.<em class=
7348: "replaceable"><code>pkg</code></em></code> (not
7349: shown above) controls whether we use <code class=
7350: "varname">BUILD_DEPENDS</code> or <code class=
7351: "varname">DEPENDS</code> to add the dependency on
7352: <em class="replaceable"><code>pkg</code></em>.
7353: The build dependency is selected by setting
7354: <code class=
7355: "varname">BUILDLINK_DEPMETHOD.<em class=
7356: "replaceable"><code>pkg</code></em></code> to
1.1 grant 7357: “<span class="quote">build</span>”.
7358: By default, the full dependency is used.</p>
7359: </li>
7360:
7361: <li>
1.14 xtraeme 7362: <p><code class=
7363: "varname">BUILDLINK_INCDIRS.<em class=
7364: "replaceable"><code>pkg</code></em></code> and
7365: <code class=
7366: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
7367: <code>pkg</code></em></code> (not shown above)
7368: are lists of subdirectories of <code class=
7369: "filename">${BUILDLINK_PREFIX.<em class=
7370: "replaceable"><code>pkg</code></em>}</code> to
7371: add to the header and library search paths. These
1.1 grant 7372: default to “<span class=
7373: "quote">include</span>” and
7374: “<span class="quote">lib</span>”
7375: respectively.</p>
7376: </li>
7377:
7378: <li>
1.14 xtraeme 7379: <p><code class=
7380: "varname">BUILDLINK_CPPFLAGS.<em class=
7381: "replaceable"><code>pkg</code></em></code> (not
7382: shown above) is the list of preprocessor flags to
7383: add to <code class="varname">CPPFLAGS</code>,
7384: which are passed on to the configure and build
7385: phases. The “<span class=
7386: "quote">-I</span>” option should be avoided
7387: and instead be handled using <code class=
7388: "varname">BUILDLINK_INCDIRS.<em class=
7389: "replaceable"><code>pkg</code></em></code> as
7390: above.</p>
1.1 grant 7391: </li>
7392: </ul>
7393: </div>
7394:
7395: <p>The following variables are all optionally defined
7396: within this second section (protected against multiple
7397: inclusion) and control which package files are
1.14 xtraeme 7398: symlinked into <code class=
7399: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 7400: are transformed during the symlinking:</p>
7401:
7402: <div class="itemizedlist">
7403: <ul type="disc">
7404: <li>
1.14 xtraeme 7405: <p><code class=
7406: "varname">BUILDLINK_FILES.<em class=
7407: "replaceable"><code>pkg</code></em></code> (not
7408: shown above) is a shell glob pattern relative to
7409: <code class=
7410: "filename">${BUILDLINK_PREFIX.<em class=
7411: "replaceable"><code>pkg</code></em>}</code> to be
7412: symlinked into <code class=
7413: "filename">${BUILDLINK_DIR}</code>, e.g.
7414: <code class="filename">include/*.h</code>.</p>
1.1 grant 7415: </li>
7416:
7417: <li>
1.14 xtraeme 7418: <p><code class=
7419: "varname">BUILDLINK_FILES_CMD.<em class=
7420: "replaceable"><code>pkg</code></em></code> (not
7421: shown above) is a shell pipeline that outputs to
7422: stdout a list of files relative to <code class=
7423: "filename">${BUILDLINK_PREFIX.<em class=
7424: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 7425: resulting files are to be symlinked into
1.14 xtraeme 7426: <code class="filename">${BUILDLINK_DIR}</code>.
7427: By default, this takes the <code class=
7428: "filename">+CONTENTS</code> of a <em class=
7429: "replaceable"><code>pkg</code></em> and filters
7430: it through <code class=
7431: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
7432: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 7433: </li>
7434:
7435: <li>
1.14 xtraeme 7436: <p><code class=
7437: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
7438: "replaceable"><code>pkg</code></em></code> (not
7439: shown above) is a filter command that filters
7440: <code class="filename">+CONTENTS</code> input
7441: into a list of files relative to <code class=
7442: "filename">${BUILDLINK_PREFIX.<em class=
7443: "replaceable"><code>pkg</code></em>}</code> on
7444: stdout. By default for overwrite packages,
7445: <code class=
7446: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
7447: "replaceable"><code>pkg</code></em></code>
7448: outputs the contents of the <code class=
7449: "filename">include</code> and <code class=
7450: "filename">lib</code> directories in the package
7451: <code class="filename">+CONTENTS</code>, and for
7452: pkgviews packages, it outputs any libtool
7453: archives in <code class="filename">lib</code>
1.1 grant 7454: directories.</p>
7455: </li>
7456:
7457: <li>
1.14 xtraeme 7458: <p><code class=
7459: "varname">BUILDLINK_TRANSFORM.<em class=
7460: "replaceable"><code>pkg</code></em></code> (not
7461: shown above) is a list of sed arguments used to
1.1 grant 7462: transform the name of the source filename into a
1.14 xtraeme 7463: destination filename, e.g. <span><strong class=
1.1 grant 7464: "command">-e
1.14 xtraeme 7465: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 7466: </li>
7467: </ul>
7468: </div>
7469:
1.14 xtraeme 7470: <p>The last section includes any <code class=
7471: "filename">buildlink3.mk</code> needed for <em class=
7472: "replaceable"><code>pkg</code></em>'s library
7473: dependencies. Including these <code class=
7474: "filename">buildlink3.mk</code> files means that the
7475: headers and libraries for these dependencies are also
7476: symlinked into <code class=
7477: "filename">${BUILDLINK_DIR}</code> whenever the
7478: <em class="replaceable"><code>pkg</code></em>
7479: <code class="filename">buildlink3.mk</code> file is
7480: included.</p>
1.1 grant 7481: </div>
7482:
7483: <div class="sect2" lang="en" xml:lang="en">
7484: <div class="titlepage">
7485: <div>
7486: <div>
1.30 wiz 7487: <h3 class="title"><a name=
7488: "updating-buildlink-depends" id=
7489: "updating-buildlink-depends"></a>10.2.2. Updating
7490: <code class=
7491: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
7492: <code>pkg</code></em></code> in <code class=
7493: "filename">buildlink3.mk</code> files</h3>
1.1 grant 7494: </div>
7495: </div>
7496: </div>
7497:
7498: <p>There are two situations that require increasing the
1.14 xtraeme 7499: dependency listed in <code class=
7500: "varname">BUILDLINK_DEPENDS.<em class=
7501: "replaceable"><code>pkg</code></em></code> after a
7502: package update:</p>
1.1 grant 7503:
7504: <div class="orderedlist">
7505: <ol type="1">
7506: <li>
7507: <p>if the sonames (major number of the library
7508: version) of any installed shared libraries
7509: change;</p>
7510: </li>
7511:
7512: <li>
7513: <p>if the API or interface to the header files
7514: change.</p>
7515: </li>
7516: </ol>
7517: </div>
7518:
1.14 xtraeme 7519: <p>In these cases, <code class=
7520: "varname">BUILDLINK_DEPENDS.<em class=
7521: "replaceable"><code>pkg</code></em></code> should be
7522: adjusted to require at least the new package version.
7523: In some cases, the packages that depend on this new
7524: version may need their <code class=
7525: "varname">PKGREVISION</code>s increased and, if they
7526: have <code class="filename">buildlink3.mk</code> files,
7527: their <code class=
7528: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
7529: pkg</code></em></code> adjusted, too. This is needed so
7530: that binary packages made using it will require the
7531: correct package dependency and not settle for an older
7532: one which will not contain the necessary shared
7533: libraries.</p>
1.1 grant 7534:
7535: <p>Please take careful consideration before adjusting
1.14 xtraeme 7536: <code class="varname">BUILDLINK_DEPENDS.<em class=
7537: "replaceable"><code>pkg</code></em></code> as we don't
7538: want to cause unneeded package deletions and rebuilds.
7539: In many cases, new versions of packages work just fine
7540: with older dependencies. See <a href="#dependencies"
1.31 wiz 7541: title="13.1.4. Handling dependencies">Section
7542: 13.1.4, “Handling dependencies”</a> and
1.14 xtraeme 7543: <a href="#buildlink" title=
1.25 rillig 7544: "Chapter 10. Buildlink methodology">Chapter
7545: 10, <i>Buildlink methodology</i></a> for more
7546: information about dependencies on other packages,
7547: including the <code class=
7548: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
7549: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 7550: </div>
7551: </div>
7552:
7553: <div class="sect1" lang="en" xml:lang="en">
7554: <div class="titlepage">
7555: <div>
7556: <div>
7557: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7558: "writing-builtin.mk" id=
7559: "writing-builtin.mk"></a>10.3. Writing
1.14 xtraeme 7560: <code class="filename">builtin.mk</code> files</h2>
1.1 grant 7561: </div>
7562: </div>
7563: </div>
7564:
7565: <p>Some packages in pkgsrc install headers and libraries
7566: that coincide with headers and libraries present in the
1.14 xtraeme 7567: base system. Aside from a <code class=
7568: "filename">buildlink3.mk</code> file, these packages
7569: should also include a <code class=
7570: "filename">builtin.mk</code> file that includes the
7571: necessary checks to decide whether using the built-in
7572: software or the pkgsrc software is appropriate.</p>
1.1 grant 7573:
7574: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 7575: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 7576:
7577: <div class="orderedlist">
7578: <ol type="1">
7579: <li>
1.14 xtraeme 7580: <p>It should set <code class=
7581: "varname">USE_BUILTIN.<em class=
7582: "replaceable"><code>pkg</code></em></code> to
7583: either “<span class="quote">yes</span>”
7584: or “<span class="quote">no</span>”
7585: after it is included.</p>
1.1 grant 7586: </li>
7587:
7588: <li>
7589: <p>It should <span class=
7590: "emphasis"><em>not</em></span> override any
1.14 xtraeme 7591: <code class="varname">USE_BUILTIN.<em class=
7592: "replaceable"><code>pkg</code></em></code> which is
7593: already set before the <code class=
7594: "filename">builtin.mk</code> file is included.</p>
1.1 grant 7595: </li>
7596:
7597: <li>
7598: <p>It should be written to allow multiple
7599: inclusion. This is <span class=
7600: "emphasis"><em>very</em></span> important and takes
1.14 xtraeme 7601: careful attention to <code class=
7602: "filename">Makefile</code> coding.</p>
1.1 grant 7603: </li>
7604: </ol>
7605: </div>
7606:
7607: <div class="sect2" lang="en" xml:lang="en">
7608: <div class="titlepage">
7609: <div>
7610: <div>
1.30 wiz 7611: <h3 class="title"><a name="anatomy-of-builtin.mk"
7612: id=
7613: "anatomy-of-builtin.mk"></a>10.3.1. Anatomy
7614: of a <code class="filename">builtin.mk</code>
1.14 xtraeme 7615: file</h3>
1.1 grant 7616: </div>
7617: </div>
7618: </div>
7619:
7620: <p>The following is the recommended template for
7621: builtin.mk files:</p>
7622: <pre class="programlisting">
7623: .if !defined(IS_BUILTIN.foo)
7624: #
7625: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
7626: # genuinely exists in the system or not.
7627: #
7628: IS_BUILTIN.foo?= no
7629:
7630: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
7631: # version can be determined.
7632: #
7633: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
7634: BUILTIN_PKG.foo?= foo-1.0
7635: . endif
7636: .endif # IS_BUILTIN.foo
7637:
7638: .if !defined(USE_BUILTIN.foo)
7639: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
7640: . if defined(BUILTIN_PKG.foo)
7641: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
7642: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
7643: USE_BUILTIN.foo!= \
7644: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
7645: ${ECHO} "yes"; \
7646: else \
7647: ${ECHO} "no"; \
7648: fi
7649: . endif
7650: . endfor
7651: . endif
7652: .endif # USE_BUILTIN.foo
7653:
7654: CHECK_BUILTIN.foo?= no
7655: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
7656: #
7657: # Here we place code that depends on whether USE_BUILTIN.foo is set to
7658: # "yes" or "no".
7659: #
7660: .endif # CHECK_BUILTIN.foo
7661:
7662: </pre>
7663:
1.14 xtraeme 7664: <p>The first section sets <code class=
7665: "varname">IS_BUILTIN.<em class=
7666: "replaceable"><code>pkg</code></em></code> depending on
7667: if <em class="replaceable"><code>pkg</code></em> really
7668: exists in the base system. This should not be a base
7669: system software with similar functionality to
7670: <em class="replaceable"><code>pkg</code></em>; it
7671: should only be “<span class=
7672: "quote">yes</span>” if the actual package is
7673: included as part of the base system. This variable is
7674: only used internally within the <code class=
7675: "filename">builtin.mk</code> file.</p>
7676:
7677: <p>The second section sets <code class=
7678: "varname">BUILTIN_PKG.<em class=
7679: "replaceable"><code>pkg</code></em></code> to the
7680: version of <em class=
7681: "replaceable"><code>pkg</code></em> in the base system
7682: if it exists (if <code class=
7683: "varname">IS_BUILTIN.<em class=
7684: "replaceable"><code>pkg</code></em></code> is
1.1 grant 7685: “<span class="quote">yes</span>”). This
1.14 xtraeme 7686: variable is only used internally within the
7687: <code class="filename">builtin.mk</code> file.</p>
1.1 grant 7688:
1.14 xtraeme 7689: <p>The third section sets <code class=
7690: "varname">USE_BUILTIN.<em class=
7691: "replaceable"><code>pkg</code></em></code> and is
7692: <span class="emphasis"><em>required</em></span> in all
7693: <code class="filename">builtin.mk</code> files. The
7694: code in this section must make the determination
7695: whether the built-in software is adequate to satisfy
7696: the dependencies listed in <code class=
7697: "varname">BUILDLINK_DEPENDS.<em class=
7698: "replaceable"><code>pkg</code></em></code>. This is
7699: typically done by comparing <code class=
7700: "varname">BUILTIN_PKG.<em class=
7701: "replaceable"><code>pkg</code></em></code> against each
7702: of the dependencies in <code class=
7703: "varname">BUILDLINK_DEPENDS.<em class=
7704: "replaceable"><code>pkg</code></em></code>.
7705: <code class="varname">USE_BUILTIN.<em class=
7706: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 7707: "emphasis"><em>must</em></span> be set to the correct
1.14 xtraeme 7708: value by the end of the <code class=
7709: "filename">builtin.mk</code> file. Note that
7710: <code class="varname">USE_BUILTIN.<em class=
7711: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 7712: “<span class="quote">yes</span>” even if
1.14 xtraeme 7713: <code class="varname">IS_BUILTIN.<em class=
7714: "replaceable"><code>pkg</code></em></code> is
1.1 grant 7715: “<span class="quote">no</span>” because we
7716: may make the determination that the built-in version of
7717: the software is similar enough to be used as a
7718: replacement.</p>
7719:
1.14 xtraeme 7720: <p>The last section is guarded by <code class=
7721: "varname">CHECK_BUILTIN.<em class=
7722: "replaceable"><code>pkg</code></em></code>, and
7723: includes code that uses the value of <code class=
7724: "varname">USE_BUILTIN.<em class=
7725: "replaceable"><code>pkg</code></em></code> set in the
7726: previous section. This typically includes, e.g., adding
1.1 grant 7727: additional dependency restrictions and listing
1.14 xtraeme 7728: additional files to symlink into <code class=
7729: "filename">${BUILDLINK_DIR}</code> (via <code class=
7730: "varname">BUILDLINK_FILES.<em class=
7731: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 7732: </div>
7733:
7734: <div class="sect2" lang="en" xml:lang="en">
7735: <div class="titlepage">
7736: <div>
7737: <div>
1.30 wiz 7738: <h3 class="title"><a name=
7739: "native-or-pkgsrc-preference" id=
7740: "native-or-pkgsrc-preference"></a>10.3.2. Global
7741: preferences for native or pkgsrc software</h3>
1.1 grant 7742: </div>
7743: </div>
7744: </div>
7745:
7746: <p>When building packages, it's possible to choose
7747: whether to set a global preference for using either the
7748: built-in (native) version or the pkgsrc version of
7749: software to satisfy a dependency. This is controlled by
1.14 xtraeme 7750: setting <code class="varname">PREFER_PKGSRC</code> and
7751: <code class="varname">PREFER_NATIVE</code>. These
7752: variables take values of either “<span class=
1.1 grant 7753: "quote">yes</span>”, “<span class=
7754: "quote">no</span>”, or a list of packages.
1.14 xtraeme 7755: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
7756: to use the pkgsrc versions of software, while
7757: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
7758: to use the built-in versions. Preferences are
7759: determined by the most specific instance of the package
7760: in either <code class="varname">PREFER_PKGSRC</code> or
7761: <code class="varname">PREFER_NATIVE</code>. If a
7762: package is specified in neither or in both variables,
7763: then <code class="varname">PREFER_PKGSRC</code> has
7764: precedence over <code class=
7765: "varname">PREFER_NATIVE</code>. For example, to require
7766: using pkgsrc versions of software for all but the most
7767: basic bits on a NetBSD system, you can set:</p>
1.1 grant 7768: <pre class="programlisting">
7769: PREFER_PKGSRC= yes
7770: PREFER_NATIVE= getopt skey tcp_wrappers
7771:
7772: </pre>
7773:
7774: <p>A package <span class=
1.14 xtraeme 7775: "emphasis"><em>must</em></span> have a <code class=
7776: "filename">builtin.mk</code> file to be listed in
7777: <code class="varname">PREFER_NATIVE</code>, otherwise
7778: it is simply ignored in that list.</p>
1.1 grant 7779: </div>
7780: </div>
7781: </div>
7782:
7783: <div class="chapter" lang="en" xml:lang="en">
7784: <div class="titlepage">
7785: <div>
7786: <div>
7787: <h2 class="title"><a name="options" id=
1.25 rillig 7788: "options"></a>Chapter 11. Options
1.1 grant 7789: handling</h2>
7790: </div>
7791: </div>
7792: </div>
7793:
7794: <div class="toc">
7795: <p><b>Table of Contents</b></p>
7796:
7797: <dl>
1.30 wiz 7798: <dt><span class="sect1"><a href=
7799: "#global-default-options">11.1. Global default
7800: options</a></span></dt>
1.1 grant 7801:
1.30 wiz 7802: <dt><span class="sect1"><a href=
7803: "#converting-to-options">11.2. Converting packages to
7804: use <code class=
1.14 xtraeme 7805: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 7806: </dl>
7807: </div>
7808:
7809: <p>Many packages have the ability to be built to support
1.14 xtraeme 7810: different sets of features. <code class=
7811: "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1 grant 7812: that provides generic handling of those options that
7813: determine different ways in which the packages can be
7814: built. It's possible for the user to specify exactly which
7815: sets of options will be built into a package or to allow a
7816: set of global default options apply.</p>
7817:
7818: <div class="sect1" lang="en" xml:lang="en">
7819: <div class="titlepage">
7820: <div>
7821: <div>
7822: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7823: "global-default-options" id=
7824: "global-default-options"></a>11.1. Global
1.1 grant 7825: default options</h2>
7826: </div>
7827: </div>
7828: </div>
7829:
1.14 xtraeme 7830: <p>Global default options are listed in <code class=
7831: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1 grant 7832: the options that should be built into every package if
7833: that option is supported. This variable should be set in
1.14 xtraeme 7834: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 7835: </div>
7836:
7837: <div class="sect1" lang="en" xml:lang="en">
7838: <div class="titlepage">
7839: <div>
7840: <div>
7841: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7842: "converting-to-options" id=
7843: "converting-to-options"></a>11.2. Converting
7844: packages to use <code class=
1.14 xtraeme 7845: "filename">bsd.options.mk</code></h2>
1.1 grant 7846: </div>
7847: </div>
7848: </div>
7849:
1.14 xtraeme 7850: <p>The following example shows how <code class=
1.27 rillig 7851: "filename">bsd.options.mk</code> should be used by the
7852: hypothetical ``wibble'' package, either in the package
7853: <code class="filename">Makefile</code>, or in a file,
7854: e.g. <code class="filename">options.mk</code>, that is
7855: included by the main package <code class=
1.14 xtraeme 7856: "filename">Makefile</code>.</p>
1.1 grant 7857: <pre class="programlisting">
7858: # Global and legacy options
7859: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
7860: PKG_SUPPORTED_OPTIONS= ldap sasl
1.27 rillig 7861: PKG_SUGGESTED_OPTIONS= sasl
7862: PKG_OPTION_LEGACY_VARS= WIBBLE_USE_OPENLDAP:ldap USE_SASL2:sasl
7863:
1.1 grant 7864: .include "../../mk/bsd.options.mk"
7865:
7866: # Package-specific option-handling
7867:
7868: ###
7869: ### LDAP support
7870: ###
7871: .if !empty(PKG_OPTIONS:Mldap)
7872: . include "../../databases/openldap/buildlink3.mk"
7873: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
7874: .endif
7875:
7876: ###
7877: ### SASL authentication
7878: ###
7879: .if !empty(PKG_OPTIONS:Msasl)
7880: . include "../../security/cyrus-sasl2/buildlink3.mk"
7881: CONFIGURE_ARGS+= --enable-sasl=${BUILDLINK_PREFIX.sasl}
7882: .endif
7883:
7884: </pre>
7885:
1.28 rillig 7886: <p>The first section contains the information about which
7887: build options are supported by the package, and any
1.1 grant 7888: default options settings if needed.</p>
7889:
7890: <div class="orderedlist">
7891: <ol type="1">
7892: <li>
1.14 xtraeme 7893: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 7894: the name of the <a href=
1.1 grant 7895: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7896: <span class="citerefentry"><span class=
1.27 rillig 7897: "refentrytitle">make</span>(1)</span></a> variable
7898: that contains the options the user wishes to
7899: select. The recommended value is
7900: “<span class="quote">PKG_OPTIONS.<em class=
1.14 xtraeme 7901: "replaceable"><code>pkg</code></em></span>”
7902: but any package-specific value may be used. This
1.1 grant 7903: variable should be set in a package Makefile.</p>
7904: </li>
7905:
7906: <li>
1.14 xtraeme 7907: <p><code class=
7908: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
7909: build options supported by the package. This
7910: variable should be set in a package Makefile.</p>
1.1 grant 7911: </li>
7912:
7913: <li>
1.27 rillig 7914: <p><code class=
7915: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
7916: build options which are enabled by default.</p>
7917: </li>
7918:
7919: <li>
1.14 xtraeme 7920: <p><code class="varname">${PKG_OPTIONS_VAR}</code>
1.27 rillig 7921: (the variable named in <code class=
7922: "varname">PKG_OPTIONS_VAR</code>) lists the
7923: selected build options and overrides any default
7924: options given in <code class=
1.14 xtraeme 7925: "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1 grant 7926: options begin with a “<span class=
7927: "quote">-</span>”, then that option is always
7928: removed from the selected build options, e.g.</p>
7929: <pre class="programlisting">
7930: PKG_DEFAULT_OPTIONS= kerberos ldap sasl
7931: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
7932: WIBBLE_OPTIONS= ${PKG_DEFAULT_OPTIONS} -sasl
1.28 rillig 7933: # leads to PKG_OPTIONS = kerberos ldap
1.1 grant 7934:
7935: </pre>
7936:
7937: <p>or</p>
7938: <pre class="programlisting">
7939: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
7940: WIBBLE_OPTIONS= kerberos -ldap ldap
1.28 rillig 7941: # leads to PKG_OPTIONS = kerberos
1.1 grant 7942:
7943: </pre>
7944:
1.14 xtraeme 7945: <p>This variable should be set in <code class=
7946: "filename">/etc/mk.conf</code>.</p>
1.1 grant 7947: </li>
7948:
7949: <li>
1.28 rillig 7950: <p>The <code class=
7951: "varname">PKG_OPTIONS_LEGACY_VARS</code> is only
7952: needed if you are converting a package that had its
7953: own ad-hoc options handling to use <code class=
7954: "filename">bsd.options.mk</code>. It converts
7955: global or legacy options variables into an
7956: equivalent <code class=
7957: "varname">PKG_OPTIONS.<em class=
7958: "replaceable"><code>pkg</code></em></code>
7959: value.</p>
1.1 grant 7960: </li>
1.28 rillig 7961: </ol>
1.1 grant 7962: </div>
7963:
1.28 rillig 7964: <p>After the inclusion of bsd.options.mk, the variable
7965: <code class="varname">PKG_OPTIONS</code> contains the
7966: list of the selected build options, properly filtered to
7967: remove unsupported and duplicate options.</p>
7968:
1.1 grant 7969: <p>The remaining sections contain the logic that is
7970: specific to each option. There should be a check for
1.14 xtraeme 7971: every option listed in <code class=
7972: "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
7973: be clear documentation on what turning on the option will
7974: do in the comments preceding each section. The correct
7975: way to check for an option is to check whether it is
7976: listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1 grant 7977: </div>
7978: </div>
7979:
7980: <div class="chapter" lang="en" xml:lang="en">
7981: <div class="titlepage">
7982: <div>
7983: <div>
7984: <h2 class="title"><a name="build" id=
1.25 rillig 7985: "build"></a>Chapter 12. The build
1.1 grant 7986: process</h2>
7987: </div>
7988: </div>
7989: </div>
7990:
7991: <div class="toc">
7992: <p><b>Table of Contents</b></p>
7993:
7994: <dl>
1.25 rillig 7995: <dt><span class="sect1"><a href="#build.prefix">12.1.
1.1 grant 7996: Program location</a></span></dt>
7997:
1.30 wiz 7998: <dt><span class="sect1"><a href="#main-targets">12.2.
7999: Main targets</a></span></dt>
1.1 grant 8000:
8001: <dt><span class="sect1"><a href=
1.25 rillig 8002: "#build.helpful-targets">12.3. Other helpful
1.1 grant 8003: targets</a></span></dt>
8004: </dl>
8005: </div>
8006:
8007: <p>The basic steps for building a program are always the
8008: same. First the program's source (<span class=
8009: "emphasis"><em>distfile</em></span>) must be brought to the
8010: local system and then extracted. After any patches to
8011: compile properly on NetBSD are applied, the software can be
8012: configured, then built (usually by compiling), and finally
8013: the generated binaries, etc. can be put into place on the
8014: system. These are exactly the steps performed by the NetBSD
8015: package system, which is implemented as a series of targets
1.14 xtraeme 8016: in a central Makefile, <code class=
8017: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 8018:
8019: <div class="sect1" lang="en" xml:lang="en">
8020: <div class="titlepage">
8021: <div>
8022: <div>
8023: <h2 class="title" style="clear: both"><a name=
8024: "build.prefix" id=
1.25 rillig 8025: "build.prefix"></a>12.1. Program location</h2>
1.1 grant 8026: </div>
8027: </div>
8028: </div>
8029:
8030: <p>Before outlining the process performed by the NetBSD
8031: package system in the next section, here's a brief
8032: discussion on where programs are installed, and which
8033: variables influence this.</p>
8034:
1.14 xtraeme 8035: <p>The automatic variable <code class=
8036: "varname">PREFIX</code> indicates where all files of the
8037: final program shall be installed. It is usually set to
8038: <code class="varname">LOCALBASE</code> (<code class=
8039: "filename">/usr/pkg</code>), or <code class=
8040: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 8041: “<span class="quote">cross</span>” category.
1.14 xtraeme 8042: The value of <code class="varname">PREFIX</code> needs to
8043: be put into the various places in the program's source
8044: where paths to these files are encoded. See <a href=
1.1 grant 8045: "#components.patches" title=
1.27 rillig 8046: "7.3. patches/*">Section 7.3,
1.1 grant 8047: “patches/*”</a> and <a href="#fixes.libtool"
8048: title=
1.25 rillig 8049: "13.3.1. Shared libraries - libtool">Section 13.3.1,
1.1 grant 8050: “Shared libraries - libtool”</a> for more
8051: details.</p>
8052:
8053: <p>When choosing which of these variables to use, follow
8054: the following rules:</p>
8055:
8056: <div class="itemizedlist">
8057: <ul type="disc">
8058: <li>
1.14 xtraeme 8059: <p><code class="varname">PREFIX</code> always
8060: points to the location where the current pkg will
8061: be installed. When referring to a pkg's own
1.1 grant 8062: installation path, use “<span class=
8063: "quote">${PREFIX}</span>”.</p>
8064: </li>
8065:
8066: <li>
1.14 xtraeme 8067: <p><code class="varname">LOCALBASE</code> is where
8068: all non-X11 pkgs are installed. If you need to
1.1 grant 8069: construct a -I or -L argument to the compiler to
8070: find includes and libraries installed by another
8071: non-X11 pkg, use “<span class=
8072: "quote">${LOCALBASE}</span>”.</p>
8073: </li>
8074:
8075: <li>
1.14 xtraeme 8076: <p><code class="varname">X11BASE</code> is where
8077: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 8078: installed. When looking for <span class=
8079: "emphasis"><em>standard</em></span> X11 includes
8080: (not those installed by a pkg), use
8081: “<span class=
8082: "quote">${X11BASE}</span>”.</p>
8083: </li>
8084:
8085: <li>
8086: <p>X11 based are special in that they may be
1.14 xtraeme 8087: installed in either <code class=
8088: "varname">X11BASE</code> or <code class=
8089: "varname">LOCALBASE</code>.</p>
1.1 grant 8090:
8091: <p>Usually, X11 packages should be installed under
1.14 xtraeme 8092: <code class="varname">LOCALBASE</code> whenever
8093: possible. Note that you will need to set
8094: <code class="varname">USE_X11</code> in them to
8095: request the presence of X11 and to get the right
8096: compilation flags.</p>
1.1 grant 8097:
8098: <p>Even though, there are some packages that cannot
1.14 xtraeme 8099: be installed under <code class=
8100: "varname">LOCALBASE</code>: those that come with
1.1 grant 8101: app-defaults files. These packages are special and
1.14 xtraeme 8102: they must be placed under <code class=
8103: "varname">X11BASE</code>. To accomplish this, set
8104: either <code class="varname">USE_X11BASE</code> or
8105: <code class="varname">USE_IMAKE</code> in your
1.1 grant 8106: package.</p>
8107:
1.14 xtraeme 8108: <p>Some notes: <code class="varname">USE_X11</code>
8109: and <code class="varname">USE_X11BASE</code> are
8110: mutually exclusive. If you need to find includes or
8111: libraries installed by a pkg that has <code class=
8112: "varname">USE_IMAKE</code> or <code class=
8113: "varname">USE_X11BASE</code> in its pkg
8114: <code class="filename">Makefile</code>, you need to
8115: use <span class="emphasis"><em>both</em></span>
8116: <code class="filename">${X11BASE}</code> and
8117: <code class="filename">${LOCALBASE}</code>. To
8118: force installation of all X11 packages in
8119: <code class="varname">LOCALBASE</code>, the
8120: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8121: href=
1.1 grant 8122: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20 ben 8123: class="pkgname">pkgtools/xpkgwedge</a> is enabled
8124: by default.</p>
1.1 grant 8125: </li>
8126:
8127: <li>
1.14 xtraeme 8128: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 8129: used to refer to the installed location of an X11
1.14 xtraeme 8130: package. <code class="varname">X11PREFIX</code>
8131: will be set to <code class="varname">X11BASE</code>
8132: if xpkgwedge is not installed, and to <code class=
8133: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 8134: installed.</p>
8135: </li>
8136:
8137: <li>
8138: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 8139: have some packages installed in <code class=
8140: "varname">X11BASE</code> and some in <code class=
8141: "varname">LOCALBASE</code>. To determine the prefix
8142: of an installed package, the <code class=
8143: "varname">EVAL_PREFIX</code> definition can be
8144: used. It takes pairs in the format
8145: “<span class=
1.1 grant 8146: "quote">DIRNAME=<package></span>”, and
1.24 wiz 8147: the <a href=
8148: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8149: <span class="citerefentry"><span class=
8150: "refentrytitle">make</span>(1)</span></a> variable
8151: <code class="varname">DIRNAME</code> will be set to
8152: the prefix of the installed package
8153: <package>, or “<span class=
1.1 grant 8154: "quote">${X11PREFIX}</span>” if the package
8155: is not installed.</p>
8156:
8157: <p>This is best illustrated by example.</p>
8158:
1.14 xtraeme 8159: <p>The following lines are taken from <code class=
8160: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 8161: <pre class="programlisting">
1.14 xtraeme 8162: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 8163: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
8164: --with-gtk-prefix="${GTKDIR}" \
8165: --enable-multibyte
8166: </pre>
8167:
8168: <p>Specific defaults can be defined for the
1.14 xtraeme 8169: packages evaluated using <code class=
8170: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 8171: of the form:</p>
8172: <pre class="programlisting">
8173: GTKDIR_DEFAULT= ${LOCALBASE}
8174: </pre>
8175:
1.14 xtraeme 8176: <p>where <code class="varname">GTKDIR</code>
1.1 grant 8177: corresponds to the first definition in the
1.14 xtraeme 8178: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 8179: </li>
8180:
8181: <li>
1.14 xtraeme 8182: <p>Within <code class="filename">${PREFIX}</code>,
1.24 wiz 8183: packages should install files according to <a href=
8184: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
8185: <span class="citerefentry"><span class=
8186: "refentrytitle">hier</span>(7)</span></a>, with the
8187: exception that manual pages go into <code class=
8188: "filename">${PREFIX}/man</code>, not <code class=
1.14 xtraeme 8189: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 8190: </li>
8191: </ul>
8192: </div>
8193: </div>
8194:
8195: <div class="sect1" lang="en" xml:lang="en">
8196: <div class="titlepage">
8197: <div>
8198: <div>
8199: <h2 class="title" style="clear: both"><a name=
1.30 wiz 8200: "main-targets" id=
8201: "main-targets"></a>12.2. Main targets</h2>
1.1 grant 8202: </div>
8203: </div>
8204: </div>
8205:
8206: <p>The main targets used during the build process defined
1.14 xtraeme 8207: in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 8208:
8209: <div class="variablelist">
8210: <dl>
8211: <dt><span class="term">fetch</span></dt>
8212:
8213: <dd>
8214: <p>This will check if the file(s) given in the
1.14 xtraeme 8215: variables <code class="varname">DISTFILES</code>
8216: and <code class="varname">PATCHFILES</code> (as
8217: defined in the package's Makefile) are present on
8218: the local system in <code class=
8219: "filename">/usr/pkgsrc/distfiles</code>. If they
8220: are not present, an attempt will be made to fetch
8221: them using commands of the form:</p>
1.1 grant 8222: <pre class="programlisting">
8223: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
8224: </pre>
8225:
8226: <p>where ${site} varies through several
1.14 xtraeme 8227: possibilities in turn: first, <code class=
8228: "varname">MASTER_SITE_OVERRIDE</code> is tried,
8229: then the sites specified in either <code class=
8230: "varname">SITES_file</code> if defined, else
8231: <code class="varname">MASTER_SITES</code> or
8232: <code class="varname">PATCH_SITES</code>, as
8233: applies, then finally the value of <code class=
8234: "varname">MASTER_SITE_BACKUP</code>. The order of
8235: all except the first can be optionally sorted by
8236: the user, via setting either <code class=
8237: "varname">MASTER_SORT_AWK</code> or <code class=
8238: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 8239: </dd>
8240:
8241: <dt><span class="term">checksum</span></dt>
8242:
8243: <dd>
8244: <p>After the distfile(s) are fetched, their
8245: checksum is generated and compared with the
8246: checksums stored in the distinfo file. If the
8247: checksums don't match, the build is aborted. This
8248: is to ensure the same distfile is used for
8249: building, and that the distfile wasn't changed,
8250: e.g. by some malign force, deliberately changed
8251: distfiles on the master distribution site or
8252: network lossage.</p>
8253: </dd>
8254:
8255: <dt><span class="term">extract</span></dt>
8256:
8257: <dd>
8258: <p>When the distfiles are present on the local
8259: system, they need to be extracted, as they are
8260: usually in the form of some compressed archive
1.14 xtraeme 8261: format, most commonly <code class=
8262: "filename">.tar.gz</code>.</p>
1.1 grant 8263:
8264: <p>If only some of the distfiles need to be
8265: uncompressed, the files to be uncompressed should
1.14 xtraeme 8266: be put into <code class=
8267: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 8268:
1.14 xtraeme 8269: <p>If the distfiles are not in <code class=
8270: "filename">.tar.gz</code> format, they can be
8271: extracted by setting either <code class=
8272: "varname">EXTRACT_SUFX</code>, or <code class=
8273: "varname">EXTRACT_CMD</code>, <code class=
8274: "varname">EXTRACT_BEFORE_ARGS</code> and
8275: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
8276: the former case, pkgsrc knows how to extract a
8277: number of suffixes (<code class=
8278: "filename">.tar.gz</code>, <code class=
8279: "filename">.tgz</code>, <code class=
8280: "filename">.tar.gz2</code>, <code class=
8281: "filename">.tbz</code>, <code class=
8282: "filename">.tar.Z</code>, <code class=
8283: "filename">.tar</code>, <code class=
8284: "filename">.shar.gz</code>, <code class=
8285: "filename">.shar.bz2</code>, <code class=
8286: "filename">.shar.Z</code>, <code class=
8287: "filename">.shar</code>, <code class=
8288: "filename">.Z</code>, <code class=
8289: "filename">.bz2</code> and <code class=
8290: "filename">.gz</code>; see the definition of the
8291: various <code class="varname">DECOMPRESS_CMD</code>
8292: variables <code class="filename">bsd.pkg.mk</code>
8293: for a complete list). Here's an example on how to
8294: use the other variables for a program that comes
8295: with a compressed shell archive whose name ends in
8296: <code class="filename">.msg.gz</code>:</p>
1.1 grant 8297: <pre class="programlisting">
8298: EXTRACT_SUFX= .msg.gz
8299: EXTRACT_CMD= zcat
8300: EXTRACT_BEFORE_ARGS=
8301: EXTRACT_AFTER_ARGS= |sh
8302: </pre>
8303: </dd>
8304:
8305: <dt><span class="term">patch</span></dt>
8306:
8307: <dd>
8308: <p>After extraction, all the patches named by the
1.14 xtraeme 8309: <code class="varname">PATCHFILES</code>, those
8310: present in the patches subdirectory of the package
8311: as well as in $LOCALPATCHES/$PKGPATH (e.g.
8312: <code class=
8313: "filename">/usr/local/patches/graphics/png</code>)
8314: are applied. Patchfiles ending in <code class=
8315: "filename">.Z</code> or <code class=
8316: "filename">.gz</code> are uncompressed before they
8317: are applied, files ending in <code class=
8318: "filename">.orig</code> or <code class=
8319: "filename">.rej</code> are ignored. Any special
1.24 wiz 8320: options to <a href=
8321: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
8322: <span class="citerefentry"><span class=
8323: "refentrytitle">patch</span>(1)</span></a> can be
8324: handed in <code class=
1.14 xtraeme 8325: "varname">PATCH_DIST_ARGS</code>. See <a href=
8326: "#components.patches" title=
1.27 rillig 8327: "7.3. patches/*">Section 7.3,
1.1 grant 8328: “patches/*”</a> for more details.</p>
8329:
1.24 wiz 8330: <p>By default <a href=
8331: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
8332: <span class="citerefentry"><span class=
8333: "refentrytitle">patch</span>(1)</span></a> is given
8334: special args to make it fail if the patches apply
8335: with some lines of fuzz. Please fix (regen) the
8336: patches so that they apply cleanly. The rationale
8337: behind this is that patches that don't apply
8338: cleanly may end up being applied in the wrong
8339: place, and cause severe harm there.</p>
1.1 grant 8340: </dd>
8341:
8342: <dt><span class="term">configure</span></dt>
8343:
8344: <dd>
8345: <p>Most pieces of software need information on the
8346: header files, system calls, and library routines
8347: which are available in NetBSD. This is the process
8348: known as configuration, and is usually automated.
8349: In most cases, a script is supplied with the
8350: source, and its invocation results in generation of
8351: header files, Makefiles, etc.</p>
8352:
8353: <p>If the program's distfile contains its own
8354: configure script, this can be invoked by setting
1.14 xtraeme 8355: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 8356: configure script is a GNU autoconf script,
1.14 xtraeme 8357: <code class="varname">GNU_CONFIGURE</code> should
8358: be specified instead. In either case, any arguments
8359: to the configure script can be specified in the
8360: <code class="varname">CONFIGURE_ARGS</code>
8361: variable, and the configure script's name can be
8362: set in <code class=
8363: "varname">CONFIGURE_SCRIPT</code> if it differs
8364: from the default “<span class=
1.1 grant 8365: "quote">configure</span>”. Here's an example
8366: from the <a xmlns=
8367: "http://www.w3.org/TR/xhtml1/transitional" href=
8368: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20 ben 8369: class="pkgname">sysutils/top</a> package:</p>
1.1 grant 8370: <pre class="programlisting">
8371: HAS_CONFIGURE= yes
8372: CONFIGURE_SCRIPT= Configure
8373: CONFIGURE_ARGS+= netbsd13
8374: </pre>
8375:
8376: <p>If the program uses an Imakefile for
8377: configuration, the appropriate steps can be invoked
1.14 xtraeme 8378: by setting <code class="varname">USE_IMAKE</code>
8379: to “<span class="quote">YES</span>”.
8380: (If you only want the package installed in
8381: <code class="varname">$X11PREFIX</code> but xmkmf
8382: not being run, set <code class=
8383: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 8384: </dd>
8385:
8386: <dt><span class="term">build</span></dt>
8387:
8388: <dd>
8389: <p>Once configuration has taken place, the software
1.14 xtraeme 8390: will be built by invoking <code class=
8391: "varname">$MAKE_PROGRAM</code> on <code class=
8392: "varname">$MAKEFILE</code> with <code class=
8393: "varname">$BUILD_TARGET</code> as the target to
8394: build. The default <code class=
8395: "varname">MAKE_PROGRAM</code> is
8396: “<span class="quote">gmake</span>” if
1.29 rillig 8397: <code class="varname">USE_TOOLS</code> contains
8398: “<span class="quote">gmake</span>”,
1.1 grant 8399: “<span class="quote">make</span>”
1.14 xtraeme 8400: otherwise. <code class="varname">MAKEFILE</code> is
8401: set to “<span class=
1.1 grant 8402: "quote">Makefile</span>” by default, and
1.14 xtraeme 8403: <code class="varname">BUILD_TARGET</code> defaults
8404: to “<span class="quote">all</span>”.
8405: Any of these variables can be set in the package's
1.1 grant 8406: Makefile to change the default build process.</p>
8407: </dd>
8408:
8409: <dt><span class="term">install</span></dt>
8410:
8411: <dd>
8412: <p>Once the build stage has completed, the final
8413: step is to install the software in public
8414: directories, so users can access the programs and
1.14 xtraeme 8415: files. As in the build-target, <code class=
8416: "varname">$MAKE_PROGRAM</code> is invoked on
8417: <code class="varname">$MAKEFILE</code> here, but
8418: with the <code class=
8419: "varname">$INSTALL_TARGET</code> instead, the
8420: latter defaulting to “<span class=
8421: "quote">install</span>” (plus
8422: “<span class=
8423: "quote">install.man</span>”, if <code class=
8424: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 8425: </dd>
8426: </dl>
8427: </div>
8428:
8429: <p>If no target is specified, the default is
8430: “<span class="quote">build</span>”. If a
8431: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 8432: e.g. <span><strong class="command">make
8433: build</strong></span> will also perform the equivalent
8434: of:</p>
1.1 grant 8435: <pre class="programlisting">
8436: make fetch
8437: make checksum
8438: make extract
8439: make patch
8440: make configure
8441: make build
8442: </pre>
8443: </div>
8444:
8445: <div class="sect1" lang="en" xml:lang="en">
8446: <div class="titlepage">
8447: <div>
8448: <div>
8449: <h2 class="title" style="clear: both"><a name=
8450: "build.helpful-targets" id=
1.25 rillig 8451: "build.helpful-targets"></a>12.3. Other
1.1 grant 8452: helpful targets</h2>
8453: </div>
8454: </div>
8455: </div>
8456:
8457: <div class="variablelist">
8458: <dl>
8459: <dt><span class="term">pre/post-*</span></dt>
8460:
8461: <dd>
8462: <p>For any of the main targets described in the
8463: previous section, two auxiliary targets exist with
8464: “<span class="quote">pre-</span>” and
8465: “<span class="quote">post-</span>” used
8466: as a prefix for the main target's name. These
8467: targets are invoked before and after the main
8468: target is called, allowing extra configuration or
8469: installation steps be performed from a package's
8470: Makefile, for example, which a program's configure
8471: script or install target omitted.</p>
8472: </dd>
8473:
8474: <dt><span class="term">do-*</span></dt>
8475:
8476: <dd>
8477: <p>Should one of the main targets do the wrong
8478: thing, and should there be no variable to fix this,
8479: you can redefine it with the do-* target. (Note
8480: that redefining the target itself instead of the
8481: do-* target is a bad idea, as the pre-* and post-*
8482: targets won't be called anymore, etc.) You will not
8483: usually need to do this.</p>
8484: </dd>
8485:
8486: <dt><span class="term">reinstall</span></dt>
8487:
8488: <dd>
1.14 xtraeme 8489: <p>If you did a <span><strong class="command">make
8490: install</strong></span> and you noticed some file
8491: was not installed properly, you can repeat the
1.1 grant 8492: installation with this target, which will ignore
8493: the “<span class="quote">already
8494: installed</span>” flag.</p>
8495: </dd>
8496:
8497: <dt><span class="term">deinstall</span></dt>
8498:
8499: <dd>
1.24 wiz 8500: <p>This target does a <a href=
8501: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8502: <span class="citerefentry"><span class=
8503: "refentrytitle">pkg_delete</span>(1)</span></a> in
8504: the current directory, effectively de-installing
8505: the package. The following variables can be used to
8506: tune the behaviour:</p>
1.1 grant 8507:
8508: <div class="variablelist">
8509: <dl>
1.14 xtraeme 8510: <dt><span class="term"><code class=
8511: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 8512:
8513: <dd>
8514: <p>Add a "-v" to the <a href=
8515: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8516: <span class="citerefentry"><span class=
8517: "refentrytitle">pkg_delete</span>(1)</span></a>
8518: command.</p>
8519: </dd>
8520:
1.14 xtraeme 8521: <dt><span class="term"><code class=
8522: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 8523:
8524: <dd>
8525: <p>Remove all packages that require (depend
8526: on) the given package. This can be used to
8527: remove any packages that may have been pulled
8528: in by a given package, e.g. if
1.14 xtraeme 8529: <span><strong class="command">make deinstall
8530: DEINSTALLDEPENDS=1</strong></span> is done in
8531: <code class="filename">pkgsrc/x11/kde</code>,
1.1 grant 8532: this is likely to remove whole KDE. Works by
8533: adding “<span class=
8534: "quote">-R</span>” to the <a href=
8535: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8536: <span class="citerefentry"><span class=
8537: "refentrytitle">pkg_delete</span>(1)</span></a>
8538: command line.</p>
8539: </dd>
8540: </dl>
8541: </div>
8542: </dd>
8543:
8544: <dt><span class="term">update</span></dt>
8545:
8546: <dd>
8547: <p>This target causes the current package to be
8548: updated to the latest version. The package and all
8549: depending packages first get de-installed, then
8550: current versions of the corresponding packages get
8551: compiled and installed. This is similar to manually
8552: noting which packages are currently installed, then
1.14 xtraeme 8553: performing a series of <span><strong class=
8554: "command">make deinstall</strong></span> and
8555: <span><strong class="command">make
8556: install</strong></span> (or whatever <code class=
8557: "varname">UPDATE_TARGET</code> is set to) for these
8558: packages.</p>
1.1 grant 8559:
8560: <p>You can use the “<span class=
8561: "quote">update</span>” target to resume
1.14 xtraeme 8562: package updating in case a previous
8563: <span><strong class="command">make
8564: update</strong></span> was interrupted for some
8565: reason. However, in this case, make sure you don't
8566: call <span><strong class="command">make
8567: clean</strong></span> or otherwise remove the list
8568: of dependent packages in <code class=
8569: "varname">WRKDIR</code>. Otherwise you lose the
1.1 grant 8570: ability to automatically update the current package
8571: along with the dependent packages you have
8572: installed.</p>
8573:
1.14 xtraeme 8574: <p>Resuming an interrupted <span><strong class=
8575: "command">make update</strong></span> will only
8576: work as long as the package tree remains unchanged.
8577: If the source code for one of the packages to be
8578: updated has been changed, resuming
8579: <span><strong class="command">make
8580: update</strong></span> will most certainly
8581: fail!</p>
1.1 grant 8582:
8583: <p>The following variables can be used either on
1.14 xtraeme 8584: the command line or in <code class=
8585: "filename">/etc/mk.conf</code> to alter the
8586: behaviour of <span><strong class="command">make
8587: update</strong></span>:</p>
1.1 grant 8588:
8589: <div class="variablelist">
8590: <dl>
1.14 xtraeme 8591: <dt><span class="term"><code class=
8592: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 8593:
8594: <dd>
8595: <p>Install target to recursively use for the
8596: updated package and the dependent packages.
1.14 xtraeme 8597: Defaults to <code class=
8598: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 8599: “<span class=
8600: "quote">install</span>” otherwise for
1.14 xtraeme 8601: <span><strong class="command">make
8602: update</strong></span>. e.g.
8603: <span><strong class="command">make update
8604: UPDATE_TARGET=package</strong></span></p>
1.1 grant 8605: </dd>
8606:
1.14 xtraeme 8607: <dt><span class="term"><code class=
8608: "varname">NOCLEAN</code></span></dt>
1.1 grant 8609:
8610: <dd>
8611: <p>Don't clean up after updating. Useful if
8612: you want to leave the work sources of the
8613: updated packages around for inspection or
8614: other purposes. Be sure you eventually clean
8615: up the source tree (see the
8616: “<span class=
8617: "quote">clean-update</span>” target
8618: below) or you may run into troubles with old
8619: source code still lying around on your next
1.14 xtraeme 8620: <span><strong class=
8621: "command">make</strong></span> or
8622: <span><strong class="command">make
8623: update</strong></span>.</p>
1.1 grant 8624: </dd>
8625:
1.14 xtraeme 8626: <dt><span class="term"><code class=
8627: "varname">REINSTALL</code></span></dt>
1.1 grant 8628:
8629: <dd>
8630: <p>Deinstall each package before installing
1.14 xtraeme 8631: (making <code class=
8632: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 8633: necessary if the “<span class=
8634: "quote">clean-update</span>” target
8635: (see below) was called after interrupting a
1.14 xtraeme 8636: running <span><strong class="command">make
8637: update</strong></span>.</p>
1.1 grant 8638: </dd>
8639:
1.14 xtraeme 8640: <dt><span class="term"><code class=
8641: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 8642:
8643: <dd>
8644: <p>Allows you to disable recursion and
8645: hardcode the target for packages. The default
8646: is “<span class=
8647: "quote">update</span>” for the update
8648: target, facilitating a recursive update of
1.14 xtraeme 8649: prerequisite packages. Only set <code class=
8650: "varname">DEPENDS_TARGET</code> if you want
8651: to disable recursive updates. Use
8652: <code class="varname">UPDATE_TARGET</code>
8653: instead to just set a specific target for
8654: each package to be installed during
8655: <span><strong class="command">make
8656: update</strong></span> (see above).</p>
1.1 grant 8657: </dd>
8658: </dl>
8659: </div>
8660: </dd>
8661:
8662: <dt><span class="term">clean-update</span></dt>
8663:
8664: <dd>
8665: <p>Clean the source tree for all packages that
1.14 xtraeme 8666: would get updated if <span><strong class=
8667: "command">make update</strong></span> was called
8668: from the current directory. This target should not
8669: be used if the current package (or any of its
8670: depending packages) have already been de-installed
8671: (e.g., after calling <span><strong class=
8672: "command">make update</strong></span>) or you may
8673: lose some packages you intended to update. As a
8674: rule of thumb: only use this target <span class=
8675: "emphasis"><em>before</em></span> the first time
8676: you run <span><strong class="command">make
8677: update</strong></span> and only if you have a dirty
8678: package tree (e.g., if you used <code class=
8679: "varname">NOCLEAN</code>).</p>
1.1 grant 8680:
8681: <p>If you unsure about whether your tree is clean
1.14 xtraeme 8682: you can either perform a <span><strong class=
8683: "command">make clean</strong></span> at the top of
8684: the tree, or use the following sequence of commands
1.1 grant 8685: from the directory of the package you want to
8686: update (<span class=
8687: "emphasis"><em>before</em></span> running
1.14 xtraeme 8688: <span><strong class="command">make
8689: update</strong></span> for the first time,
8690: otherwise you lose all the packages you wanted to
8691: update!):</p>
1.1 grant 8692: <pre class="screen">
1.14 xtraeme 8693: <code class="prompt">#</code> <strong class=
8694: "userinput"><code>make clean-update</code></strong>
8695: <code class="prompt">#</code> <strong class=
8696: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
8697: <code class="prompt">#</code> <strong class=
8698: "userinput"><code>make update</code></strong>
1.1 grant 8699: </pre>
8700:
8701: <p>The following variables can be used either on
1.14 xtraeme 8702: the command line or in <code class=
8703: "filename">/etc/mk.conf</code> to alter the
8704: behaviour of <span><strong class="command">make
8705: clean-update</strong></span>:</p>
1.1 grant 8706:
8707: <div class="variablelist">
8708: <dl>
1.14 xtraeme 8709: <dt><span class="term"><code class=
8710: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 8711:
8712: <dd>
1.14 xtraeme 8713: <p>After <span><strong class="command">make
8714: clean</strong></span>, do not reconstruct the
8715: list of directories to update for this
8716: package. Only use this if
8717: <span><strong class="command">make
8718: update</strong></span> successfully installed
8719: all packages you wanted to update. Normally,
8720: this is done automatically on
8721: <span><strong class="command">make
8722: update</strong></span>, but may have been
8723: suppressed by the <code class=
8724: "varname">NOCLEAN</code> variable (see
1.1 grant 8725: above).</p>
8726: </dd>
8727: </dl>
8728: </div>
8729: </dd>
8730:
8731: <dt><span class="term">info</span></dt>
8732:
8733: <dd>
8734: <p>This target invokes <a href=
8735: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
8736: <span class="citerefentry"><span class=
8737: "refentrytitle">pkg_info</span>(1)</span></a> for
8738: the current package. You can use this to check
8739: which version of a package is installed.</p>
8740: </dd>
8741:
8742: <dt><span class="term">readme</span></dt>
8743:
8744: <dd>
1.14 xtraeme 8745: <p>This target generates a <code class=
8746: "filename">README.html</code> file, which can be
1.1 grant 8747: viewed using a browser such as <a xmlns=
8748: "http://www.w3.org/TR/xhtml1/transitional" href=
8749: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 8750: class="pkgname">www/mozilla</a> or <a xmlns=
8751: "http://www.w3.org/TR/xhtml1/transitional" href=
8752: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
8753: class="pkgname">www/links</a>. The generated files
8754: contain references to any packages which are in the
8755: <code class="varname">PACKAGES</code> directory on
8756: the local host. The generated files can be made to
8757: refer to URLs based on <code class=
8758: "varname">FTP_PKG_URL_HOST</code> and <code class=
8759: "varname">FTP_PKG_URL_DIR</code>. For example, if I
8760: wanted to generate <code class=
8761: "filename">README.html</code> files which pointed
8762: to binary packages on the local machine, in the
8763: directory <code class=
8764: "filename">/usr/packages</code>, set <code class=
8765: "varname">FTP_PKG_URL_HOST=file://localhost</code>
8766: and <code class=
8767: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
8768: <code class="varname">${PACKAGES}</code> directory
8769: and its subdirectories will be searched for all the
8770: binary packages.</p>
1.1 grant 8771: </dd>
8772:
8773: <dt><span class="term">readme-all</span></dt>
8774:
8775: <dd>
1.14 xtraeme 8776: <p>Use this target to create a file <code class=
8777: "filename">README-all.html</code> which contains a
1.1 grant 8778: list of all packages currently available in the
8779: NetBSD Packages Collection, together with the
8780: category they belong to and a short description.
1.14 xtraeme 8781: This file is compiled from the <code class=
8782: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 8783: sure to run this <span class=
1.14 xtraeme 8784: "emphasis"><em>after</em></span> a
8785: <span><strong class="command">make
8786: readme</strong></span>.</p>
1.1 grant 8787: </dd>
8788:
8789: <dt><span class="term">cdrom-readme</span></dt>
8790:
8791: <dd>
8792: <p>This is very much the same as the
8793: “<span class="quote">readme</span>”
8794: target (see above), but is to be used when
8795: generating a pkgsrc tree to be written to a CD-ROM.
1.14 xtraeme 8796: This target also produces <code class=
8797: "filename">README.html</code> files, and can be
8798: made to refer to URLs based on <code class=
8799: "varname">CDROM_PKG_URL_HOST</code> and
8800: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 8801: </dd>
8802:
8803: <dt><span class="term">show-distfiles</span></dt>
8804:
8805: <dd>
8806: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 8807: are needed to build the package. (<code class=
8808: "varname">DISTFILES</code> and <code class=
8809: "varname">PATCHFILES</code>, but not <code class=
8810: "filename">patches/*</code>)</p>
1.1 grant 8811: </dd>
8812:
8813: <dt><span class="term">show-downlevel</span></dt>
8814:
8815: <dd>
8816: <p>This target shows nothing if the package is not
8817: installed. If a version of this package is
8818: installed, but is not the version provided in this
8819: version of pkgsrc, then a warning message is
8820: displayed. This target can be used to show which of
8821: your installed packages are downlevel, and so the
8822: old versions can be deleted, and the current ones
8823: added.</p>
8824: </dd>
8825:
8826: <dt><span class="term">show-pkgsrc-dir</span></dt>
8827:
8828: <dd>
8829: <p>This target shows the directory in the pkgsrc
8830: hierarchy from which the package can be built and
8831: installed. This may not be the same directory as
8832: the one from which the package was installed. This
8833: target is intended to be used by people who may
8834: wish to upgrade many packages on a single host, and
8835: can be invoked from the top-level pkgsrc Makefile
8836: by using the “<span class=
8837: "quote">show-host-specific-pkgs</span>”
8838: target.</p>
8839: </dd>
8840:
8841: <dt><span class=
8842: "term">show-installed-depends</span></dt>
8843:
8844: <dd>
8845: <p>This target shows which installed packages match
1.14 xtraeme 8846: the current package's <code class=
8847: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 8848: dependencies are causing build problems.</p>
8849: </dd>
8850:
8851: <dt><span class="term">check-shlibs</span></dt>
8852:
8853: <dd>
8854: <p>After a package is installed, check all its
8855: binaries and (on ELF platforms) shared libraries to
8856: see if they find the shared libs they need. Run by
1.14 xtraeme 8857: default if <code class=
8858: "varname">PKG_DEVELOPER</code> is set in
8859: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 8860: </dd>
8861:
8862: <dt><span class="term">print-PLIST</span></dt>
8863:
8864: <dd>
8865: <p>After a “<span class="quote">make
8866: install</span>” from a new or upgraded pkg,
8867: this prints out an attempt to generate a new
1.14 xtraeme 8868: <code class="filename">PLIST</code> from a
8869: <span><strong class="command">find -newer
8870: work/.extract_done</strong></span>. An attempt is
8871: made to care for shared libs etc., but it is
1.1 grant 8872: <span class="emphasis"><em>strongly</em></span>
8873: recommended to review the result before putting it
1.14 xtraeme 8874: into <code class="filename">PLIST</code>. On
8875: upgrades, it's useful to diff the output of this
8876: command against an already existing <code class=
8877: "filename">PLIST</code> file.</p>
1.1 grant 8878:
1.24 wiz 8879: <p>If the package installs files via <a href=
8880: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
8881: <span class="citerefentry"><span class=
8882: "refentrytitle">tar</span>(1)</span></a> or other
8883: methods that don't update file access times, be
8884: sure to add these files manually to your
1.14 xtraeme 8885: <code class="filename">PLIST</code>, as the
1.1 grant 8886: “<span class="quote">find
8887: -newer</span>” command used by this target
8888: won't catch them!</p>
8889:
8890: <p>See <a href="#print-PLIST" title=
1.25 rillig 8891: "9.3. Tweaking output of make print-PLIST">Section 9.3,
1.14 xtraeme 8892: “Tweaking output of <span><strong class=
8893: "command">make
8894: print-PLIST</strong></span>”</a> for more
8895: information on this target.</p>
1.1 grant 8896: </dd>
8897:
8898: <dt><span class="term">bulk-package</span></dt>
8899:
8900: <dd>
8901: <p>Used to do bulk builds. If an appropriate binary
8902: package already exists, no action is taken. If not,
8903: this target will compile, install and package it
1.14 xtraeme 8904: (and it's depends, if <code class=
8905: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 8906: <a href="#binary.configuration" title=
8907: "5.3.1. Configuration">Section 5.3.1,
8908: “Configuration”</a>. After creating the
8909: binary package, the sources, the just-installed
8910: package and it's required packages are removed,
8911: preserving free disk space.</p>
8912:
8913: <p><span class="emphasis"><em>Beware that this
8914: target may deinstall all packages installed on a
8915: system!</em></span></p>
8916: </dd>
8917:
8918: <dt><span class="term">bulk-install</span></dt>
8919:
8920: <dd>
8921: <p>Used during bulk-installs to install required
8922: packages. If an upto-date binary package is
8923: available, it will be installed via <a href=
8924: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
8925: <span class="citerefentry"><span class=
8926: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 8927: not, <span><strong class="command">make
8928: bulk-package</strong></span> will be executed, but
8929: the installed binary not be removed.</p>
1.1 grant 8930:
8931: <p>A binary package is considered
8932: “<span class="quote">upto-date</span>”
8933: to be installed via <a href=
8934: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
8935: <span class="citerefentry"><span class=
8936: "refentrytitle">pkg_add</span>(1)</span></a>
8937: if:</p>
8938:
8939: <div class="itemizedlist">
8940: <ul type="disc">
8941: <li>
1.14 xtraeme 8942: <p>None of the package's files (<code class=
8943: "filename">Makefile</code>, ...) were
8944: modified since it was built.</p>
1.1 grant 8945: </li>
8946:
8947: <li>
8948: <p>None of the package's required (binary)
8949: packages were modified since it was
8950: built.</p>
8951: </li>
8952: </ul>
8953: </div>
8954:
8955: <p><span class="emphasis"><em>Beware that this
8956: target may deinstall all packages installed on a
8957: system!</em></span></p>
8958: </dd>
8959: </dl>
8960: </div>
8961: </div>
8962: </div>
8963:
8964: <div class="chapter" lang="en" xml:lang="en">
8965: <div class="titlepage">
8966: <div>
8967: <div>
8968: <h2 class="title"><a name="fixes" id=
1.25 rillig 8969: "fixes"></a>Chapter 13. Notes on fixes for
1.1 grant 8970: packages</h2>
8971: </div>
8972: </div>
8973: </div>
8974:
8975: <div class="toc">
8976: <p><b>Table of Contents</b></p>
8977:
8978: <dl>
1.30 wiz 8979: <dt><span class="sect1"><a href=
8980: "#general-operation">13.1. General
8981: operation</a></span></dt>
1.1 grant 8982:
8983: <dd>
8984: <dl>
8985: <dt><span class="sect2"><a href=
1.30 wiz 8986: "#pulling-vars-from-etc-mk.conf">13.1.1. How to
8987: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 8988:
8989: <dt><span class="sect2"><a href=
1.31 wiz 8990: "#where-to-install-documentation">13.1.2. Where to
8991: install documentation</a></span></dt>
8992:
8993: <dt><span class="sect2"><a href=
8994: "#restricted-packages">13.1.3. Restricted
1.1 grant 8995: packages</a></span></dt>
8996:
8997: <dt><span class="sect2"><a href=
1.31 wiz 8998: "#dependencies">13.1.4. Handling
1.1 grant 8999: dependencies</a></span></dt>
9000:
9001: <dt><span class="sect2"><a href=
1.31 wiz 9002: "#conflicts">13.1.5. Handling conflicts with other
1.1 grant 9003: packages</a></span></dt>
9004:
9005: <dt><span class="sect2"><a href=
1.31 wiz 9006: "#not-building-packages">13.1.6. Packages that
1.30 wiz 9007: cannot or should not be built</a></span></dt>
1.1 grant 9008:
9009: <dt><span class="sect2"><a href=
1.31 wiz 9010: "#undeletable-packages">13.1.7. Packages which
1.30 wiz 9011: should not be deleted, once
9012: installed</a></span></dt>
1.1 grant 9013:
9014: <dt><span class="sect2"><a href=
1.31 wiz 9015: "#security-handling">13.1.8. Handling packages with
1.1 grant 9016: security problems</a></span></dt>
9017:
9018: <dt><span class="sect2"><a href=
1.31 wiz 9019: "#compiler-bugs">13.1.9. How to handle compiler
1.1 grant 9020: bugs</a></span></dt>
9021:
9022: <dt><span class="sect2"><a href=
1.31 wiz 9023: "#bumping-pkgrevision">13.1.10. How to handle
1.30 wiz 9024: incrementing versions when fixing an existing
1.1 grant 9025: package</a></span></dt>
9026:
9027: <dt><span class="sect2"><a href=
1.31 wiz 9028: "#portability-of-packages">13.1.11. Portability of
1.1 grant 9029: packages</a></span></dt>
9030: </dl>
9031: </dd>
9032:
1.30 wiz 9033: <dt><span class="sect1"><a href=
9034: "#downloading-issues">13.2. Possible downloading
9035: issues</a></span></dt>
1.1 grant 9036:
9037: <dd>
9038: <dl>
9039: <dt><span class="sect2"><a href=
1.30 wiz 9040: "#no-plain-download">13.2.1. Packages whose
9041: distfiles aren't available for plain
1.1 grant 9042: downloading</a></span></dt>
9043:
9044: <dt><span class="sect2"><a href=
1.30 wiz 9045: "#modified-distfiles-same-name">13.2.2. How to
9046: handle modified distfiles with the 'old'
9047: name</a></span></dt>
1.1 grant 9048: </dl>
9049: </dd>
9050:
1.30 wiz 9051: <dt><span class="sect1"><a href=
9052: "#configuration-gotchas">13.3. Configuration
9053: gotchas</a></span></dt>
1.1 grant 9054:
9055: <dd>
9056: <dl>
9057: <dt><span class="sect2"><a href=
1.25 rillig 9058: "#fixes.libtool">13.3.1. Shared libraries -
1.1 grant 9059: libtool</a></span></dt>
9060:
9061: <dt><span class="sect2"><a href=
1.30 wiz 9062: "#using-libtool">13.3.2. Using libtool on GNU
9063: packages that already support
9064: libtool</a></span></dt>
1.1 grant 9065:
9066: <dt><span class="sect2"><a href=
1.30 wiz 9067: "#autoconf-automake">13.3.3. GNU
1.1 grant 9068: Autoconf/Automake</a></span></dt>
9069: </dl>
9070: </dd>
9071:
1.30 wiz 9072: <dt><span class="sect1"><a href=
9073: "#building-considerations">13.4. Building
9074: considerations</a></span></dt>
1.1 grant 9075:
9076: <dd>
9077: <dl>
9078: <dt><span class="sect2"><a href=
1.30 wiz 9079: "#cpp-defines">13.4.1. CPP defines</a></span></dt>
1.1 grant 9080: </dl>
9081: </dd>
9082:
1.30 wiz 9083: <dt><span class="sect1"><a href=
9084: "#package-specific-actions">13.5. Package specific
9085: actions</a></span></dt>
1.1 grant 9086:
9087: <dd>
9088: <dl>
9089: <dt><span class="sect2"><a href=
1.30 wiz 9090: "#package-configuration-files">13.5.1. Package
9091: configuration files</a></span></dt>
1.1 grant 9092:
9093: <dt><span class="sect2"><a href=
1.30 wiz 9094: "#user-interaction">13.5.2. User
1.2 hubertf 9095: interaction</a></span></dt>
1.1 grant 9096:
9097: <dt><span class="sect2"><a href=
1.30 wiz 9098: "#handling-licenses">13.5.3. Handling
1.1 grant 9099: licenses</a></span></dt>
9100:
9101: <dt><span class="sect2"><a href=
1.30 wiz 9102: "#creating-accounts">13.5.4. Creating an account
9103: from a package</a></span></dt>
1.1 grant 9104:
9105: <dt><span class="sect2"><a href=
1.30 wiz 9106: "#installing-score-files">13.5.5. Installing score
1.1 grant 9107: files</a></span></dt>
9108:
9109: <dt><span class="sect2"><a href=
1.30 wiz 9110: "#login-shells">13.5.6. Packages providing login
1.1 grant 9111: shells</a></span></dt>
9112:
9113: <dt><span class="sect2"><a href=
1.30 wiz 9114: "#perl-scripts">13.5.7. Packages containing perl
1.1 grant 9115: scripts</a></span></dt>
9116:
9117: <dt><span class="sect2"><a href=
1.30 wiz 9118: "#hardcoded-paths">13.5.8. Packages with hardcoded
9119: paths to other interpreters</a></span></dt>
1.1 grant 9120:
9121: <dt><span class="sect2"><a href=
1.30 wiz 9122: "#perl-modules">13.5.9. Packages installing perl
1.1 grant 9123: modules</a></span></dt>
9124:
9125: <dt><span class="sect2"><a href=
1.25 rillig 9126: "#faq.info-files">13.5.10. Packages installing info
1.1 grant 9127: files</a></span></dt>
9128:
9129: <dt><span class="sect2"><a href=
1.30 wiz 9130: "#gconf2-data-files">13.5.11. Packages installing
9131: GConf2 data files</a></span></dt>
1.1 grant 9132:
9133: <dt><span class="sect2"><a href=
1.30 wiz 9134: "#scrollkeeper-data-files">13.5.12. Packages
9135: installing scrollkeeper data files</a></span></dt>
1.1 grant 9136:
9137: <dt><span class="sect2"><a href=
1.30 wiz 9138: "#x11-fonts">13.5.13. Packages installing X11
1.1 grant 9139: fonts</a></span></dt>
9140:
9141: <dt><span class="sect2"><a href=
1.30 wiz 9142: "#gtk2-modules">13.5.14. Packages installing GTK2
1.1 grant 9143: modules</a></span></dt>
9144:
9145: <dt><span class="sect2"><a href=
1.30 wiz 9146: "#sgml-xml-data">13.5.15. Packages installing SGML
9147: or XML data</a></span></dt>
1.1 grant 9148:
9149: <dt><span class="sect2"><a href=
1.30 wiz 9150: "#mime-database">13.5.16. Packages installing
1.1 grant 9151: extensions to the MIME database</a></span></dt>
9152:
9153: <dt><span class="sect2"><a href=
1.30 wiz 9154: "#intltool">13.5.17. Packages using
1.1 grant 9155: intltool</a></span></dt>
1.18 xtraeme 9156:
9157: <dt><span class="sect2"><a href=
1.30 wiz 9158: "#startup-scripts">13.5.18. Packages installing
9159: startup scripts</a></span></dt>
1.1 grant 9160: </dl>
9161: </dd>
9162:
1.30 wiz 9163: <dt><span class="sect1"><a href=
9164: "#feedback-to-author">13.6. Feedback to the
9165: author</a></span></dt>
1.1 grant 9166: </dl>
9167: </div>
9168:
9169: <div class="sect1" lang="en" xml:lang="en">
9170: <div class="titlepage">
9171: <div>
9172: <div>
9173: <h2 class="title" style="clear: both"><a name=
1.30 wiz 9174: "general-operation" id=
9175: "general-operation"></a>13.1. General
1.1 grant 9176: operation</h2>
9177: </div>
9178: </div>
9179: </div>
9180:
9181: <div class="sect2" lang="en" xml:lang="en">
9182: <div class="titlepage">
9183: <div>
9184: <div>
1.30 wiz 9185: <h3 class="title"><a name=
9186: "pulling-vars-from-etc-mk.conf" id=
9187: "pulling-vars-from-etc-mk.conf"></a>13.1.1. How
9188: to pull in variables from /etc/mk.conf</h3>
1.1 grant 9189: </div>
9190: </div>
9191: </div>
9192:
9193: <p>The problem with package-defined variables that can
1.14 xtraeme 9194: be overridden via <code class="varname">MAKECONF</code>
9195: or <code class="filename">/etc/mk.conf</code> is that
9196: <a href=
1.1 grant 9197: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9198: <span class="citerefentry"><span class=
9199: "refentrytitle">make</span>(1)</span></a> expands a
9200: variable as it is used, but evaluates preprocessor like
9201: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 9202: So, to use any variable (which may be set in
9203: <code class="filename">/etc/mk.conf</code>) in one of
9204: the .if* statements, the file <code class=
9205: "filename">/etc/mk.conf</code> must be included before
1.1 grant 9206: that .if* statement.</p>
9207:
9208: <p>Rather than have a number of ad-hoc ways of
1.14 xtraeme 9209: including <code class="filename">/etc/mk.conf</code>,
9210: should it exist, or <code class=
9211: "varname">MAKECONF</code>, should it exist, include the
9212: <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
9213: file in the package Makefile before any
9214: preprocessor-like .if, .ifdef, or .ifndef
9215: statements:</p>
1.1 grant 9216: <pre class="programlisting">
9217: .include "../../mk/bsd.prefs.mk"
9218:
9219: .if defined(USE_MENUS)
9220: ...
9221: .endif
9222: </pre>
9223:
1.14 xtraeme 9224: <p>If you wish to set the <code class=
9225: "varname">CFLAGS</code> variable in <code class=
9226: "filename">/etc/mk.conf</code> please make sure to
1.1 grant 9227: use:</p>
9228: <pre class="programlisting">
9229: CFLAGS+= -your -flags
9230: </pre>
9231:
1.14 xtraeme 9232: <p>Using <code class="varname">CFLAGS=</code> (i.e.
9233: without the “<span class="quote">+</span>”)
9234: may lead to problems with packages that need to add
9235: their own flags. Also, you may want to take a look at
9236: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 9237: href=
9238: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20 ben 9239: class="pkgname">devel/cpuflags</a> package if you're
9240: interested in optimization for the current CPU.</p>
1.1 grant 9241: </div>
9242:
9243: <div class="sect2" lang="en" xml:lang="en">
9244: <div class="titlepage">
9245: <div>
9246: <div>
1.31 wiz 9247: <h3 class="title"><a name=
9248: "where-to-install-documentation" id=
9249: "where-to-install-documentation"></a>13.1.2. Where
9250: to install documentation</h3>
9251: </div>
9252: </div>
9253: </div>
9254:
9255: <p>Documentation should be installed into <code class=
9256: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
9257: <code class=
9258: "filename">${PREFIX}/share/doc/${PKGNAME}</code> (the
9259: latter includes the version number of the package).</p>
9260: </div>
9261:
9262: <div class="sect2" lang="en" xml:lang="en">
9263: <div class="titlepage">
9264: <div>
9265: <div>
1.30 wiz 9266: <h3 class="title"><a name="restricted-packages"
9267: id=
1.31 wiz 9268: "restricted-packages"></a>13.1.3. Restricted
1.1 grant 9269: packages</h3>
9270: </div>
9271: </div>
9272: </div>
9273:
9274: <p>Some licenses restrict how software may be
9275: re-distributed. In order to satisfy these restrictions,
9276: the package system defines five make variables that can
9277: be set to note these restrictions:</p>
9278:
9279: <div class="itemizedlist">
9280: <ul type="disc">
9281: <li>
1.14 xtraeme 9282: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 9283:
9284: <p>This variable should be set whenever a
9285: restriction exists (regardless of its kind). Set
9286: this variable to a string containing the reason
9287: for the restriction.</p>
9288: </li>
9289:
9290: <li>
1.14 xtraeme 9291: <p><code class=
9292: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 9293:
9294: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 9295: variable to <code class=
9296: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 9297: package may not be included on a CD-ROM.</p>
9298: </li>
9299:
9300: <li>
1.14 xtraeme 9301: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 9302:
9303: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 9304: Set this variable to <code class=
9305: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 9306: package may not not be made available on the
9307: Internet.</p>
9308: </li>
9309:
9310: <li>
1.14 xtraeme 9311: <p><code class=
9312: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 9313:
9314: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 9315: this variable to <code class=
9316: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 9317: of the source code or other distfile(s) is not
9318: allowed on CD-ROMs.</p>
9319: </li>
9320:
9321: <li>
1.14 xtraeme 9322: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 9323:
9324: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 9325: variable to <code class=
9326: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 9327: of the source code or other distfile(s) via the
9328: Internet is not allowed.</p>
9329: </li>
9330: </ul>
9331: </div>
9332:
1.14 xtraeme 9333: <p>Please note that the use of <code class=
9334: "varname">NO_PACKAGE</code>, <code class=
9335: "varname">IGNORE</code>, <code class=
9336: "varname">NO_CDROM</code>, or other generic make
1.1 grant 9337: variables to denote restrictions is deprecated, because
9338: they unconditionally prevent users from generating
9339: binary packages!</p>
9340: </div>
9341:
9342: <div class="sect2" lang="en" xml:lang="en">
9343: <div class="titlepage">
9344: <div>
9345: <div>
9346: <h3 class="title"><a name="dependencies" id=
1.31 wiz 9347: "dependencies"></a>13.1.4. Handling
1.1 grant 9348: dependencies</h3>
9349: </div>
9350: </div>
9351: </div>
9352:
9353: <p>Your package may depend on some other package being
9354: present - and there are various ways of expressing this
1.14 xtraeme 9355: dependency. pkgsrc supports the <code class=
9356: "varname">BUILD_DEPENDS</code> and <code class=
9357: "varname">DEPENDS</code> definitions, as well as
9358: dependencies via <code class=
9359: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 9360: way to handle dependencies, and which uses the
9361: variables named above. See <a href="#buildlink" title=
1.25 rillig 9362: "Chapter 10. Buildlink methodology">Chapter 10,
1.1 grant 9363: <i>Buildlink methodology</i></a> for more
9364: information.</p>
9365:
9366: <p>The basic difference between the two variables is as
1.14 xtraeme 9367: follows: The <code class="varname">DEPENDS</code>
1.1 grant 9368: definition registers that pre-requisite in the binary
9369: package so it will be pulled in when the binary package
1.14 xtraeme 9370: is later installed, whilst the <code class=
9371: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 9372: marking a dependency that is only needed for building
9373: the package.</p>
9374:
9375: <p>This means that if you only need a package present
9376: whilst you are building, it should be noted as a
1.14 xtraeme 9377: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 9378:
1.14 xtraeme 9379: <p>The format for a <code class=
9380: "varname">BUILD_DEPENDS</code> and a <code class=
9381: "varname">DEPENDS</code> definition is:</p>
1.1 grant 9382: <pre class="programlisting">
9383: <pre-req-package-name>:../../<category>/<pre-req-package>
9384: </pre>
9385:
9386: <p>Please note that the “<span class=
9387: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 9388: any of the wildcard version numbers recognized by
1.1 grant 9389: <a href=
9390: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
9391: <span class="citerefentry"><span class=
9392: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
9393:
9394: <div class="orderedlist">
9395: <ol type="1">
9396: <li>
9397: <p>If your package needs another package's
9398: binaries or libraries to build or run, and if
1.14 xtraeme 9399: that package has a <code class=
9400: "filename">buildlink3.mk</code> file available,
9401: use it:</p>
1.1 grant 9402: <pre class="programlisting">
9403: .include "../../graphics/jpeg/buildlink3.mk"
9404:
9405: </pre>
9406: </li>
9407:
9408: <li>
9409: <p>If your package needs to use another package
1.14 xtraeme 9410: to build itself and there is no <code class=
9411: "filename">buildlink3.mk</code> file available,
9412: use the <code class=
9413: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 9414: <pre class="programlisting">
9415: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
9416: </pre>
9417: </li>
9418:
9419: <li>
9420: <p>If your package needs a library with which to
1.14 xtraeme 9421: link and again there is no <code class=
9422: "filename">buildlink3.mk</code> file available,
9423: this is specified using the <code class=
9424: "varname">DEPENDS</code> definition. An example
9425: of this is the <a xmlns=
1.1 grant 9426: "http://www.w3.org/TR/xhtml1/transitional" href=
9427: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 9428: class="pkgname">print/lyx</a> package, which uses
9429: the xpm library, version 3.4j to build:</p>
1.1 grant 9430: <pre class="programlisting">
9431: DEPENDS+= xpm-3.4j:../../graphics/xpm
9432: </pre>
9433:
9434: <p>You can also use wildcards in package
9435: dependences:</p>
9436: <pre class="programlisting">
9437: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
9438: </pre>
9439:
9440: <p>Note that such wildcard dependencies are
9441: retained when creating binary packages. The
9442: dependency is checked when installing the binary
9443: package and any package which matches the pattern
9444: will be used. Wildcard dependencies should be
9445: used with care.</p>
9446:
9447: <p>The “<span class=
9448: "quote">-[0-9]*</span>” should be used
9449: instead of “<span class=
9450: "quote">-*</span>” to avoid potentially
9451: ambiguous matches such as “<span class=
9452: "quote">tk-postgresql</span>” matching a
9453: “<span class="quote">tk-*</span>”
1.14 xtraeme 9454: <code class="varname">DEPENDS</code>.</p>
1.1 grant 9455:
9456: <p>Wildcards can also be used to specify that a
9457: package will only build against a certain minimum
9458: version of a pre-requisite:</p>
9459: <pre class="programlisting">
9460: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
9461: </pre>
9462:
9463: <p>This means that the package will build against
9464: version 3.5.4 of the tiff library or newer. Such
9465: a dependency may be warranted if, for example,
9466: the API of the library has changed with version
9467: 3.5.4 and a package would not compile against an
9468: earlier version of tiff.</p>
9469:
9470: <p>Please note that such dependencies should only
9471: be updated if a package requires a newer
9472: pre-requisite, but not to denote recommendations
9473: such as security updates or ABI changes that do
9474: not prevent a package from building correctly.
9475: Such recommendations can be expressed using
1.14 xtraeme 9476: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 9477: <pre class="programlisting">
9478: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
9479: </pre>
9480:
1.14 xtraeme 9481: <p>In addition to the above <code class=
9482: "varname">DEPENDS</code> line, this denotes that
1.1 grant 9483: while a package will build against
9484: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 9485: recommended. <code class=
9486: "varname">RECOMMENDED</code> entries will be
9487: turned into dependencies unless explicitly
9488: ignored (in which case a warning will be
9489: printed). Packages that are built with
1.1 grant 9490: recommendations ignored may not be uploaded to
9491: ftp.NetBSD.org by developers and should not be
9492: used across different systems that may have
9493: different versions of binary packages
9494: installed.</p>
9495:
9496: <p>For security fixes, please update the package
9497: vulnerabilities file as well as setting
1.14 xtraeme 9498: <code class="varname">RECOMMENDED</code>, see
1.1 grant 9499: <a href="#security-handling" title=
1.31 wiz 9500: "13.1.8. Handling packages with security problems">
9501: Section 13.1.8, “Handling packages with
1.1 grant 9502: security problems”</a> for more
9503: information.</p>
9504: </li>
9505:
9506: <li>
9507: <p>If your package needs some executable to be
1.17 sketch 9508: able to run correctly and if there's no
1.14 xtraeme 9509: <code class="filename">buildlink3.mk</code> file,
9510: this is specified using the <code class=
9511: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 9512: "http://www.w3.org/TR/xhtml1/transitional" href=
9513: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 9514: class="pkgname">print/lyx</a> package needs to be
9515: able to execute the latex binary from the teTeX
9516: package when it runs, and that is specified:</p>
1.1 grant 9517: <pre class="programlisting">
9518: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
9519: </pre>
9520:
9521: <p>The comment about wildcard dependencies from
9522: previous paragraph applies here, too.</p>
9523: </li>
9524: </ol>
9525: </div>
9526:
9527: <p>If your package needs files from another package to
9528: build, see the first part of the “<span class=
9529: "quote">do-configure</span>” target <a xmlns=
9530: "http://www.w3.org/TR/xhtml1/transitional" href=
9531: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20 ben 9532: class="pkgname">print/ghostscript5</a> package (it
9533: relies on the jpeg sources being present in source form
9534: during the build):</p>
1.1 grant 9535: <pre class="programlisting">
9536: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
9537: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
9538: fi
9539: </pre>
9540:
9541: <p>If you build any other packages that way, please
9542: make sure the working files are deleted too when this
9543: package's working files are cleaned up. The easiest way
9544: to do so is by adding a pre-clean target:</p>
9545: <pre class="programlisting">
9546: pre-clean:
9547: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
9548: </pre>
9549:
1.14 xtraeme 9550: <p>Please also note the <code class=
9551: "varname">BUILD_USES_MSGFMT</code> and <code class=
9552: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
9553: which are provided as convenience definitions. The
1.24 wiz 9554: former works out whether <a href=
9555: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
9556: <span class="citerefentry"><span class=
9557: "refentrytitle">msgfmt</span>(1)</span></a> is part of
9558: the base system, and, if it isn't, installs the
9559: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9560: href=
1.1 grant 9561: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20 ben 9562: class="pkgname">devel/gettext</a> package. The latter
9563: adds a build dependency on either an installed version
9564: of an older gettext package, or if it isn't, installs
9565: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9566: href=
9567: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
9568: class="pkgname">devel/gettext-m4</a> package.</p>
1.1 grant 9569: </div>
9570:
9571: <div class="sect2" lang="en" xml:lang="en">
9572: <div class="titlepage">
9573: <div>
9574: <div>
1.30 wiz 9575: <h3 class="title"><a name="conflicts" id=
1.31 wiz 9576: "conflicts"></a>13.1.5. Handling conflicts
1.1 grant 9577: with other packages</h3>
9578: </div>
9579: </div>
9580: </div>
9581:
9582: <p>Your package may conflict with other packages a user
9583: might already have installed on his system, e.g. if
9584: your package installs the same set of files like
9585: another package in our pkgsrc tree.</p>
9586:
1.14 xtraeme 9587: <p>In this case you can set <code class=
9588: "varname">CONFLICTS</code> to a space separated list of
1.1 grant 9589: packages (including version string) your package
9590: conflicts with.</p>
9591:
9592: <p>For example <a xmlns=
9593: "http://www.w3.org/TR/xhtml1/transitional" href=
9594: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20 ben 9595: class="pkgname">x11/Xaw3d</a> and <a xmlns=
9596: "http://www.w3.org/TR/xhtml1/transitional" href=
9597: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
9598: class="pkgname">x11/Xaw-Xpm</a> install provide the
9599: same shared library, thus you set in <code class=
9600: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 9601: <pre class="programlisting">
9602: CONFLICTS= Xaw-Xpm-[0-9]*
9603: </pre>
9604:
1.14 xtraeme 9605: <p>and in <code class=
9606: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 9607: <pre class="programlisting">
9608: CONFLICTS= Xaw3d-[0-9]*
9609: </pre>
9610:
9611: <p>Packages will automatically conflict with other
9612: packages with the name prefix and a different version
9613: string. “<span class=
9614: "quote">Xaw3d-1.5</span>” e.g. will automatically
9615: conflict with the older version “<span class=
9616: "quote">Xaw3d-1.3</span>”.</p>
9617: </div>
9618:
9619: <div class="sect2" lang="en" xml:lang="en">
9620: <div class="titlepage">
9621: <div>
9622: <div>
1.30 wiz 9623: <h3 class="title"><a name="not-building-packages"
9624: id=
1.31 wiz 9625: "not-building-packages"></a>13.1.6. Packages
1.30 wiz 9626: that cannot or should not be built</h3>
1.1 grant 9627: </div>
9628: </div>
9629: </div>
9630:
9631: <p>There are several reasons why a package might be
9632: instructed to not build under certain circumstances. If
9633: the package builds and runs on most platforms, the
1.14 xtraeme 9634: exceptions should be noted with <code class=
9635: "varname">NOT_FOR_PLATFORM</code>. If the package
9636: builds and runs on a small handful of platforms, set
9637: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
9638: If the package should be skipped (for example, because
9639: it provides functionality already provided by the
9640: system), set <code class=
9641: "varname">PKG_SKIP_REASON</code> to a descriptive
9642: message. If the package should fail because some
9643: preconditions are not met, set <code class=
9644: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 9645: message.</p>
9646:
1.14 xtraeme 9647: <p><code class="varname">IGNORE</code> is deprecated
1.1 grant 9648: because it didn't provide enough information to
9649: determine whether the build should fail.</p>
9650: </div>
9651:
9652: <div class="sect2" lang="en" xml:lang="en">
9653: <div class="titlepage">
9654: <div>
9655: <div>
1.30 wiz 9656: <h3 class="title"><a name="undeletable-packages"
9657: id=
1.31 wiz 9658: "undeletable-packages"></a>13.1.7. Packages
1.30 wiz 9659: which should not be deleted, once installed</h3>
1.1 grant 9660: </div>
9661: </div>
9662: </div>
9663:
9664: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 9665: has been installed, the <code class=
9666: "varname">PKG_PRESERVE</code> definition should be set
9667: in the package Makefile. This will be carried into any
1.1 grant 9668: binary package that is made from this pkgsrc entry. A
9669: “<span class="quote">preserved</span>”
9670: package will not be deleted using <a href=
9671: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
9672: <span class="citerefentry"><span class=
9673: "refentrytitle">pkg_delete</span>(1)</span></a> unless
9674: the “<span class="quote">-f</span>” option
9675: is used.</p>
9676: </div>
9677:
9678: <div class="sect2" lang="en" xml:lang="en">
9679: <div class="titlepage">
9680: <div>
9681: <div>
9682: <h3 class="title"><a name="security-handling" id=
1.31 wiz 9683: "security-handling"></a>13.1.8. Handling
1.1 grant 9684: packages with security problems</h3>
9685: </div>
9686: </div>
9687: </div>
9688:
9689: <p>When a vulnerability is found, this should be noted
1.14 xtraeme 9690: in <code class=
9691: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1 grant 9692: and after the commit of that file, it should be copied
1.14 xtraeme 9693: to both <code class=
9694: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
9695: and <code class=
9696: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
9697: on ftp.NetBSD.org using <code class=
9698: "filename">localsrc/security/advisories/Makefile</code>.
9699: In addition, if a <code class=
9700: "filename">buildlink3.mk</code> file exists for an
9701: affected package, bumping <code class=
9702: "varname">PKGREVISION</code> and creating a
9703: corresponding <code class=
9704: "varname">BUILDLINK_RECOMMENDED.<em class=
9705: "replaceable"><code>pkg</code></em></code> entry should
9706: be considered. See <a href="#buildlink" title=
1.25 rillig 9707: "Chapter 10. Buildlink methodology">Chapter 10,
1.1 grant 9708: <i>Buildlink methodology</i></a> for more information
1.14 xtraeme 9709: about writing <code class=
9710: "filename">buildlink3.mk</code> files and <code class=
9711: "varname">BUILDLINK_*</code> definitions.</p>
1.1 grant 9712:
9713: <p>Also, if the fix should be applied to the stable
9714: pkgsrc branch, be sure to submit a pullup request!</p>
9715: </div>
9716:
9717: <div class="sect2" lang="en" xml:lang="en">
9718: <div class="titlepage">
9719: <div>
9720: <div>
1.30 wiz 9721: <h3 class="title"><a name="compiler-bugs" id=
1.31 wiz 9722: "compiler-bugs"></a>13.1.9. How to handle
1.1 grant 9723: compiler bugs</h3>
9724: </div>
9725: </div>
9726: </div>
9727:
9728: <p>Some source files trigger bugs in the compiler,
9729: based on combinations of compiler version and
9730: architecture and almost always relation to optimisation
9731: being enabled. Common symptoms are gcc internal errors
9732: or never finishing compiling a file.</p>
9733:
9734: <p>Typically a workaround involves testing the
1.14 xtraeme 9735: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 9736: version, disabling optimisation for that
1.14 xtraeme 9737: file/<code class="varname">MACHINE_ARCH</code>/compiler
9738: combination, and documenting it in <code class=
9739: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 9740: number of examples!</p>
9741: </div>
9742:
9743: <div class="sect2" lang="en" xml:lang="en">
9744: <div class="titlepage">
9745: <div>
9746: <div>
1.30 wiz 9747: <h3 class="title"><a name="bumping-pkgrevision"
1.31 wiz 9748: id="bumping-pkgrevision"></a>13.1.10. How to
1.30 wiz 9749: handle incrementing versions when fixing an
9750: existing package</h3>
1.1 grant 9751: </div>
9752: </div>
9753: </div>
9754:
9755: <p>When making fixes to an existing package it can be
1.14 xtraeme 9756: useful to change the version number in <code class=
9757: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 9758: future versions by the original author, a
9759: “<span class="quote">nb1</span>”,
9760: “<span class="quote">nb2</span>”, ...
9761: suffix can be used on package versions by setting
1.14 xtraeme 9762: <code class="varname">PKGREVISION=1</code> (2, ...).
9763: The “<span class="quote">nb</span>” is
9764: treated like a “<span class=
9765: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 9766: <pre class="programlisting">
9767: DISTNAME= foo-17.42
9768: PKGREVISION= 9
9769: </pre>
9770:
1.14 xtraeme 9771: <p>will result in a <code class=
9772: "varname">PKGNAME</code> of “<span class=
1.1 grant 9773: "quote">foo-17.42nb9</span>”.</p>
9774:
9775: <p>When a new release of the package is released, the
1.14 xtraeme 9776: <code class="varname">PKGREVISION</code> should be
9777: removed. e.g. on a new minor release of the above
9778: package, things should be like:</p>
1.1 grant 9779: <pre class="programlisting">
9780: DISTNAME= foo-17.43
9781: </pre>
9782: </div>
9783:
9784: <div class="sect2" lang="en" xml:lang="en">
9785: <div class="titlepage">
9786: <div>
9787: <div>
1.30 wiz 9788: <h3 class="title"><a name=
9789: "portability-of-packages" id=
1.31 wiz 9790: "portability-of-packages"></a>13.1.11. Portability
1.30 wiz 9791: of packages</h3>
1.1 grant 9792: </div>
9793: </div>
9794: </div>
9795:
9796: <p>One appealing feature of pkgsrc is that it runs on
9797: many different platforms. As a result, it is important
9798: to ensure, where possible, that packages in pkgsrc are
9799: portable. There are some particular details you should
9800: pay attention to while working on pkgsrc.</p>
9801:
9802: <div class="sect3" lang="en" xml:lang="en">
9803: <div class="titlepage">
9804: <div>
9805: <div>
1.30 wiz 9806: <h4 class="title"><a name="install-scripts" id=
1.31 wiz 9807: "install-scripts"></a>13.1.11.1. ${INSTALL},
1.1 grant 9808: ${INSTALL_DATA_DIR}, ...</h4>
9809: </div>
9810: </div>
9811: </div>
9812:
1.14 xtraeme 9813: <p>The BSD-compatible <span><strong class=
9814: "command">install</strong></span> supplied with some
1.1 grant 9815: operating systems will not perform more than one
9816: operation at a time. As such, you should call
9817: “<span class="quote">${INSTALL}</span>”,
9818: etc. like this:</p>
9819: <pre class="programlisting">
9820: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
9821: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
9822: </pre>
9823: </div>
9824: </div>
9825: </div>
9826:
9827: <div class="sect1" lang="en" xml:lang="en">
9828: <div class="titlepage">
9829: <div>
9830: <div>
9831: <h2 class="title" style="clear: both"><a name=
1.30 wiz 9832: "downloading-issues" id=
9833: "downloading-issues"></a>13.2. Possible
1.1 grant 9834: downloading issues</h2>
9835: </div>
9836: </div>
9837: </div>
9838:
9839: <div class="sect2" lang="en" xml:lang="en">
9840: <div class="titlepage">
9841: <div>
9842: <div>
1.30 wiz 9843: <h3 class="title"><a name="no-plain-download" id=
9844: "no-plain-download"></a>13.2.1. Packages
9845: whose distfiles aren't available for plain
1.1 grant 9846: downloading</h3>
9847: </div>
9848: </div>
9849: </div>
9850:
9851: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 9852: set <code class="varname">DYNAMIC_MASTER_SITES</code>
9853: and a <span><strong class="command">make
9854: fetch</strong></span> will call <code class=
9855: "filename">files/getsite.sh</code> with the name of
9856: each file to download as an argument, expecting it to
9857: output the URL of the directory from which to download
9858: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9859: href=
1.1 grant 9860: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20 ben 9861: class="pkgname">graphics/ns-cult3d</a> is an example of
9862: this usage.</p>
1.1 grant 9863:
9864: <p>If the download can't be automated, because the user
9865: must submit personal information to apply for a
9866: password, or must pay for the source, or whatever, you
1.14 xtraeme 9867: can set <code class="varname">_FETCH_MESSAGE</code> to
9868: a macro which displays a message explaining the
9869: situation. <code class="varname">_FETCH_MESSAGE</code>
9870: must be executable shell commands, not just a message.
9871: (Generally, it executes <code class=
9872: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 9873: following packages use this: <a xmlns=
9874: "http://www.w3.org/TR/xhtml1/transitional" href=
9875: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20 ben 9876: class="pkgname">audio/realplayer</a>, <a xmlns=
9877: "http://www.w3.org/TR/xhtml1/transitional" href=
9878: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
9879: class="pkgname">cad/simian</a>, <a xmlns=
9880: "http://www.w3.org/TR/xhtml1/transitional" href=
9881: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
9882: class="pkgname">devel/ipv6socket</a>, <a xmlns=
9883: "http://www.w3.org/TR/xhtml1/transitional" href=
9884: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
9885: class="pkgname">emulators/vmware-module</a>, <a xmlns=
9886: "http://www.w3.org/TR/xhtml1/transitional" href=
9887: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
9888: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
9889: "http://www.w3.org/TR/xhtml1/transitional" href=
9890: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
9891: class="pkgname">sysutils/storage-manager</a>, <a xmlns=
9892: "http://www.w3.org/TR/xhtml1/transitional" href=
9893: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
9894: class="pkgname">www/ap-aolserver</a>, <a xmlns=
9895: "http://www.w3.org/TR/xhtml1/transitional" href=
9896: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
9897: class="pkgname">www/openacs</a>. Try to be consistent
9898: with them.</p>
1.1 grant 9899: </div>
9900:
9901: <div class="sect2" lang="en" xml:lang="en">
9902: <div class="titlepage">
9903: <div>
9904: <div>
1.30 wiz 9905: <h3 class="title"><a name=
9906: "modified-distfiles-same-name" id=
9907: "modified-distfiles-same-name"></a>13.2.2. How
9908: to handle modified distfiles with the 'old'
9909: name</h3>
1.1 grant 9910: </div>
9911: </div>
9912: </div>
9913:
9914: <p>Sometimes authors of a software package make some
9915: modifications after the software was released, and they
9916: put up a new distfile without changing the package's
9917: version number. If a package is already in pkgsrc at
1.32 wiz 9918: that time, the checksum will no longer match. The
9919: contents of the new distfile should be compared against
9920: the old one before changing anything, to make sure the
9921: distfile was really updated on purpose, and that no
9922: trojan horse or so crept in. Then, the correct way to
9923: work around this is to set <code class=
9924: "varname">DIST_SUBDIR</code> to a unique directory
9925: name, usually based on <code class=
9926: "varname">PKGNAME_NOREV</code>. In case this happens
9927: more often, <code class="varname">PKGNAME</code> can be
9928: used (thus including the <code class=
9929: "filename">nbX</code> suffix) or a date stamp can be
9930: appended, like <code class=
9931: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
9932: forget regenerating the <code class=
9933: "filename">distinfo</code> file after that, since it
9934: contains the <code class="varname">DIST_SUBDIR</code>
9935: path in the filenames. Furthermore, a mail to the
9936: package's authors seems appropriate telling them that
9937: changing distfiles after releases without changing the
9938: file names is not good practice.</p>
1.1 grant 9939: </div>
9940: </div>
9941:
9942: <div class="sect1" lang="en" xml:lang="en">
9943: <div class="titlepage">
9944: <div>
9945: <div>
9946: <h2 class="title" style="clear: both"><a name=
1.30 wiz 9947: "configuration-gotchas" id=
9948: "configuration-gotchas"></a>13.3. Configuration
1.1 grant 9949: gotchas</h2>
9950: </div>
9951: </div>
9952: </div>
9953:
9954: <div class="sect2" lang="en" xml:lang="en">
9955: <div class="titlepage">
9956: <div>
9957: <div>
9958: <h3 class="title"><a name="fixes.libtool" id=
1.25 rillig 9959: "fixes.libtool"></a>13.3.1. Shared libraries
1.1 grant 9960: - libtool</h3>
9961: </div>
9962: </div>
9963: </div>
9964:
9965: <p>pkgsrc supports many different machines, with
9966: different object formats like a.out and ELF, and
9967: varying abilities to do shared library and dynamic
9968: loading at all. To accompany this, varying commands and
9969: options have to be passed to the compiler, linker, etc.
9970: to get the Right Thing, which can be pretty annoying
9971: especially if you don't have all the machines at your
9972: hand to test things. The <a xmlns=
9973: "http://www.w3.org/TR/xhtml1/transitional" href=
9974: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20 ben 9975: class="pkgname">devel/libtool</a> pkg can help here, as
9976: it just “<span class="quote">knows</span>”
9977: how to build both static and dynamic libraries from a
9978: set of source files, thus being platform
9979: independent.</p>
1.1 grant 9980:
9981: <p>Here's how to use libtool in a pkg in seven simple
9982: steps:</p>
9983:
9984: <div class="orderedlist">
9985: <ol type="1">
9986: <li>
1.14 xtraeme 9987: <p>Add <code class=
9988: "varname">USE_LIBTOOL=yes</code> to the package
9989: Makefile.</p>
1.1 grant 9990: </li>
9991:
9992: <li>
9993: <p>For library objects, use “<span class=
9994: "quote">${LIBTOOL} --mode=compile
9995: ${CC}</span>” in place of
9996: “<span class="quote">${CC}</span>”.
9997: You could even add it to the definition of
1.14 xtraeme 9998: <code class="varname">CC</code>, if only
9999: libraries are being built in a given Makefile.
10000: This one command will build both PIC and non-PIC
10001: library objects, so you need not have separate
10002: shared and non-shared library rules.</p>
1.1 grant 10003: </li>
10004:
10005: <li>
10006: <p>For the linking of the library, remove any
10007: “<span class="quote">ar</span>”,
10008: “<span class="quote">ranlib</span>”,
10009: and “<span class="quote">ld
10010: -Bshareable</span>” commands, and instead
10011: use:</p>
10012: <pre class="programlisting">
10013: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
10014: </pre>
10015:
10016: <p>Note that the library is changed to have a
1.14 xtraeme 10017: <code class="filename">.la</code> extension, and
10018: the objects are changed to have a <code class=
10019: "filename">.lo</code> extension. Change
10020: <code class="varname">OBJS</code> as necessary.
10021: This automatically creates all of the
10022: <code class="filename">.a</code>, <code class=
10023: "filename">.so.major.minor</code>, and ELF
10024: symlinks (if necessary) in the build directory.
10025: Be sure to include “<span class=
1.1 grant 10026: "quote">-version-info</span>”, especially
10027: when major and minor are zero, as libtool will
10028: otherwise strip off the shared library
10029: version.</p>
10030:
10031: <p>From the libtool manual:</p>
10032: <pre class="programlisting">
10033: So, libtool library versions are described by three integers:
10034:
10035: CURRENT
10036: The most recent interface number that this library implements.
10037:
10038: REVISION
10039: The implementation number of the CURRENT interface.
10040:
10041: AGE
10042: The difference between the newest and oldest interfaces that this
10043: library implements. In other words, the library implements all the
10044: interface numbers in the range from number `CURRENT - AGE' to
10045: `CURRENT'.
10046:
10047: If two libraries have identical CURRENT and AGE numbers, then the
10048: dynamic linker chooses the library with the greater REVISION number.
10049: </pre>
10050:
10051: <p>The “<span class=
10052: "quote">-release</span>” option will
10053: produce different results for a.out and ELF
10054: (excluding symlinks) in only one case. An ELF
10055: library of the form “<span class=
10056: "quote">libfoo-release.so.<span class=
10057: "emphasis"><em>x</em></span>.<span class=
10058: "emphasis"><em>y</em></span></span>” will
10059: have a symlink of “<span class=
10060: "quote">libfoo.so.<span class=
10061: "emphasis"><em>x</em></span>.<span class=
10062: "emphasis"><em>y</em></span></span>” on an
10063: a.out platform. This is handled
10064: automatically.</p>
10065:
10066: <p>The “<span class="quote">-rpath
10067: argument</span>” is the install directory
10068: of the library being built.</p>
10069:
1.14 xtraeme 10070: <p>In the <code class="filename">PLIST</code>,
1.19 hubertf 10071: include only the <code class=
10072: "filename">.la</code> file, the other files will
10073: be added automatically.</p>
1.1 grant 10074: </li>
10075:
10076: <li>
1.14 xtraeme 10077: <p>When linking shared object (<code class=
10078: "filename">.so</code>) files, i.e. files that are
1.24 wiz 10079: loaded via <a href=
10080: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
10081: <span class="citerefentry"><span class=
10082: "refentrytitle">dlopen</span>(3)</span></a>, NOT
10083: shared libraries, use “<span class=
10084: "quote">-module -avoid-version</span>” to
10085: prevent them getting version tacked on.</p>
1.1 grant 10086:
1.14 xtraeme 10087: <p>The <code class="filename">PLIST</code> file
10088: gets the <code class="filename">foo.so</code>
10089: entry.</p>
1.1 grant 10090: </li>
10091:
10092: <li>
10093: <p>When linking programs that depend on these
10094: libraries <span class=
10095: "emphasis"><em>before</em></span> they are
10096: installed, preface the <a href=
10097: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
10098: <span class="citerefentry"><span class=
10099: "refentrytitle">cc</span>(1)</span></a> or
10100: <a href=
10101: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
10102: <span class="citerefentry"><span class=
10103: "refentrytitle">ld</span>(1)</span></a> line with
10104: “<span class="quote">${LIBTOOL}
10105: --mode=link</span>”, and it will find the
10106: correct libraries (static or shared), but please
10107: be aware that libtool will not allow you to
10108: specify a relative path in -L (such as
10109: “<span class=
10110: "quote">-L../somelib</span>”), because it
10111: expects you to change that argument to be the
1.14 xtraeme 10112: <code class="filename">.la</code> file. e.g.</p>
1.1 grant 10113: <pre class="programlisting">
10114: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
10115: </pre>
10116:
10117: <p>should be changed to:</p>
10118: <pre class="programlisting">
1.14 xtraeme 10119: ${LIBTOOL} --mode=link ${CC} -o <em class=
10120: "replaceable"><code>someprog</code></em> <em class=
10121: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 10122: </pre>
10123:
10124: <p>and it will do the right thing with the
10125: libraries.</p>
10126: </li>
10127:
10128: <li>
10129: <p>When installing libraries, preface the
10130: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
10131: <span class="citerefentry"><span class=
10132: "refentrytitle">install</span>(1)</span></a> or
10133: <a href=
10134: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
10135: <span class="citerefentry"><span class=
10136: "refentrytitle">cp</span>(1)</span></a> command
10137: with “<span class="quote">${LIBTOOL}
10138: --mode=install</span>”, and change the
1.14 xtraeme 10139: library name to <code class=
10140: "filename">.la</code>. e.g.</p>
1.1 grant 10141: <pre class="programlisting">
10142: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
10143: </pre>
10144:
1.14 xtraeme 10145: <p>This will install the static <code class=
10146: "filename">.a</code>, shared library, any needed
1.1 grant 10147: symlinks, and run <a href=
10148: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
10149: <span class="citerefentry"><span class=
10150: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
10151: </li>
10152:
10153: <li>
1.14 xtraeme 10154: <p>In your <code class="filename">PLIST</code>,
1.23 wiz 10155: include only the <code class=
10156: "filename">.la</code> file (this is a change from
10157: previous behaviour).</p>
1.1 grant 10158: </li>
10159: </ol>
10160: </div>
10161: </div>
10162:
10163: <div class="sect2" lang="en" xml:lang="en">
10164: <div class="titlepage">
10165: <div>
10166: <div>
1.30 wiz 10167: <h3 class="title"><a name="using-libtool" id=
10168: "using-libtool"></a>13.3.2. Using libtool on
10169: GNU packages that already support libtool</h3>
1.1 grant 10170: </div>
10171: </div>
10172: </div>
10173:
1.14 xtraeme 10174: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
10175: the package Makefile. This will override the package's
10176: own libtool in most cases. For older libtool using
1.1 grant 10177: packages, libtool is made by ltconfig script during the
10178: do-configure step; you can check the libtool script
1.14 xtraeme 10179: location by doing <span><strong class="command">make
10180: configure; find work*/ -name
10181: libtool</strong></span>.</p>
10182:
10183: <p><code class="varname">LIBTOOL_OVERRIDE</code>
10184: specifies which libtool scripts, relative to
10185: <code class="varname">WRKSRC</code>, to override. By
10186: default, it is set to “<span class=
10187: "quote">libtool */libtool */*/libtool</span>”. If
10188: this does not match the location of the package's
10189: libtool script(s), set it as appropriate.</p>
1.13 hubertf 10190:
1.14 xtraeme 10191: <p>If you do not need <code class="filename">*.a</code>
1.1 grant 10192: static libraries built and installed, then use
1.14 xtraeme 10193: <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1 grant 10194: instead.</p>
10195:
10196: <p>If your package makes use of the platform
10197: independent library for loading dynamic shared objects,
10198: that comes with libtool (libltdl), you should include
1.22 tv 10199: devel/libltdl/buildlink3.mk.</p>
1.1 grant 10200:
10201: <p>Some packages use libtool incorrectly so that the
10202: package may not work or build in some circumstances.
10203: Some of the more common errors are:</p>
10204:
10205: <div class="itemizedlist">
10206: <ul type="disc">
10207: <li>
10208: <p>The inclusion of a shared object (-module) as
10209: a dependent library in an executable or library.
10210: This in itself isn't a problem if one of two
10211: things has been done:</p>
10212:
10213: <div class="orderedlist">
10214: <ol type="1">
10215: <li>
10216: <p>The shared object is named correctly,
1.14 xtraeme 10217: i.e. <code class=
10218: "filename">libfoo.la</code>, not
10219: <code class="filename">foo.la</code></p>
1.1 grant 10220: </li>
10221:
10222: <li>
10223: <p>The -dlopen option is used when linking
10224: an executable.</p>
10225: </li>
10226: </ol>
10227: </div>
10228: </li>
10229:
10230: <li>
10231: <p>The use of libltdl without the correct calls
10232: to initialisation routines. The function
10233: lt_dlinit() should be called and the macro
1.14 xtraeme 10234: <code class=
10235: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 10236: included in executables.</p>
10237: </li>
10238: </ul>
10239: </div>
10240: </div>
10241:
10242: <div class="sect2" lang="en" xml:lang="en">
10243: <div class="titlepage">
10244: <div>
10245: <div>
1.30 wiz 10246: <h3 class="title"><a name="autoconf-automake" id=
10247: "autoconf-automake"></a>13.3.3. GNU
1.1 grant 10248: Autoconf/Automake</h3>
10249: </div>
10250: </div>
10251: </div>
10252:
10253: <p>If a package needs GNU autoconf or automake to be
10254: executed to regenerate the configure script and
10255: Makefile.in makefile templates, then they should be
10256: executed in a pre-configure target. Two Makefile
1.14 xtraeme 10257: fragments are provided in <code class=
10258: "filename">pkgsrc/mk/autoconf.mk</code> and
10259: <code class="filename">pkgsrc/mk/automake.mk</code> to
10260: help dealing with these tools. See comments in these
10261: files for details.</p>
1.1 grant 10262:
10263: <p>For packages that need only autoconf:</p>
10264: <pre class="programlisting">
10265: AUTOCONF_REQD= 2.50 # if default version is not good enough
10266: ...
10267:
10268: pre-configure:
10269: cd ${WRKSRC}; ${AUTOCONF}
10270:
10271: ...
10272: .include "../../mk/autoconf.mk"
10273: </pre>
10274:
10275: <p>and for packages that need automake and
10276: autoconf:</p>
10277: <pre class="programlisting">
10278: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
10279: ...
10280:
10281: pre-configure:
10282: cd ${WRKSRC}; \
10283: ${ACLOCAL}; \
10284: ${AUTOHEADER}; \
10285: ${AUTOMAKE} -a --foreign -i; \
10286: ${AUTOCONF}
10287:
10288: ...
10289: .include "../mk/automake.mk"
10290: </pre>
10291:
10292: <p>Packages which use GNU Automake will almost
10293: certainly require GNU Make, but that's automatically
1.14 xtraeme 10294: provided for you in <code class=
10295: "filename">mk/automake.mk</code>.</p>
1.1 grant 10296:
10297: <p>There are times when the configure process makes
10298: additional changes to the generated files, which then
10299: causes the build process to try to re-execute the
10300: automake sequence. This is prevented by touching
10301: various files in the configure stage. If this causes
1.14 xtraeme 10302: problems with your package you can set <code class=
10303: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 10304: Makefile.</p>
10305: </div>
10306: </div>
10307:
10308: <div class="sect1" lang="en" xml:lang="en">
10309: <div class="titlepage">
10310: <div>
10311: <div>
10312: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10313: "building-considerations" id=
10314: "building-considerations"></a>13.4. Building
1.1 grant 10315: considerations</h2>
10316: </div>
10317: </div>
10318: </div>
10319:
10320: <div class="sect2" lang="en" xml:lang="en">
10321: <div class="titlepage">
10322: <div>
10323: <div>
1.30 wiz 10324: <h3 class="title"><a name="cpp-defines" id=
10325: "cpp-defines"></a>13.4.1. CPP defines</h3>
1.1 grant 10326: </div>
10327: </div>
10328: </div>
10329:
10330: <p>To port an application to NetBSD, it's usually
10331: necessary for the compiler to be able to judge the
10332: system on which it's compiling, and we use definitions
10333: so that the C pre-processor can do this.</p>
10334:
10335: <p>To test whether you are working on a 4.4 BSD-derived
10336: system, you should use the BSD definition, which is
1.14 xtraeme 10337: defined in <code class=
10338: "filename"><sys/param.h></code> on said
1.1 grant 10339: systems.</p>
10340: <pre class="programlisting">
10341: #include <sys/param.h>
10342: </pre>
10343:
10344: <p>and then you can surround the BSD-specific parts of
10345: your package's C/C++ code using this conditional:</p>
10346: <pre class="programlisting">
10347: #if (defined(BSD) && BSD >= 199306)
10348: ...
10349: #endif
10350: </pre>
10351:
10352: <p>Please use the “<span class=
10353: "quote">__NetBSD__</span>” definition sparingly -
10354: it should only apply to features of NetBSD that are not
10355: present in other 4.4-lite derived BSDs.</p>
10356: </div>
10357: </div>
10358:
10359: <div class="sect1" lang="en" xml:lang="en">
10360: <div class="titlepage">
10361: <div>
10362: <div>
10363: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10364: "package-specific-actions" id=
10365: "package-specific-actions"></a>13.5. Package
1.1 grant 10366: specific actions</h2>
10367: </div>
10368: </div>
10369: </div>
10370:
10371: <div class="sect2" lang="en" xml:lang="en">
10372: <div class="titlepage">
10373: <div>
10374: <div>
1.30 wiz 10375: <h3 class="title"><a name=
10376: "package-configuration-files" id=
10377: "package-configuration-files"></a>13.5.1. Package
1.1 grant 10378: configuration files</h3>
10379: </div>
10380: </div>
10381: </div>
10382:
10383: <p>Packages should be taught to look for their
1.14 xtraeme 10384: configuration files in <code class=
10385: "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1 grant 10386: through to the configure and build processes.
1.14 xtraeme 10387: <code class="varname">PKG_SYSCONFDIR</code> may be
1.1 grant 10388: customized in various ways by setting other make
10389: variables:</p>
10390:
10391: <div class="itemizedlist">
10392: <ul type="disc">
10393: <li>
1.14 xtraeme 10394: <p><code class="varname">PKG_SYSCONFBASE</code>
10395: is the main config directory under which all
10396: package configuration files are to be found. This
10397: defaults to <code class=
10398: "filename">${PREFIX}/etc</code>, but may be
10399: overridden in <code class=
10400: "filename">/etc/mk.conf</code>.</p>
1.1 grant 10401: </li>
10402:
10403: <li>
1.14 xtraeme 10404: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
10405: is the subdirectory of <code class=
10406: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 10407: configuration files for a particular package may
10408: be found, e.g. the Apache configuration files may
1.14 xtraeme 10409: all be found under the <code class=
10410: "filename">httpd/</code> subdirectory of
10411: <code class="varname">${PKG_SYSCONFBASE}</code>.
10412: This should be set in the package Makefile.</p>
1.1 grant 10413: </li>
10414:
10415: <li>
1.14 xtraeme 10416: <p>By default, <code class=
10417: "varname">PKG_SYSCONFDIR</code> is set to
10418: <code class=
10419: "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
10420: but this may be overridden by setting
10421: <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
10422: for a particular package, where <code class=
10423: "varname">PKG_SYSCONFVAR</code> defaults to
10424: <code class="varname">${PKGBASE}</code>. This is
10425: not meant to be set by a package Makefile, but is
1.1 grant 10426: reserved for users who wish to override the
1.14 xtraeme 10427: <code class="varname">PKG_SYSCONFDIR</code>
10428: setting for a particular package with a special
1.1 grant 10429: location.</p>
10430: </li>
10431: </ul>
10432: </div>
10433:
10434: <p>The only variables that users should customize are
1.14 xtraeme 10435: <code class="varname">PKG_SYSCONFBASE</code> and
10436: <code class=
10437: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
10438: Users will typically want to set <code class=
10439: "varname">PKG_SYSCONFBASE</code> to <code class=
10440: "filename">/etc</code>, or to accept the default
10441: location of <code class=
10442: "filename">${PREFIX}/etc</code>.</p>
1.1 grant 10443: </div>
10444:
10445: <div class="sect2" lang="en" xml:lang="en">
10446: <div class="titlepage">
10447: <div>
10448: <div>
1.30 wiz 10449: <h3 class="title"><a name="user-interaction" id=
10450: "user-interaction"></a>13.5.2. User
1.2 hubertf 10451: interaction</h3>
1.1 grant 10452: </div>
10453: </div>
10454: </div>
10455:
10456: <p>Occasionally, packages require interaction from the
10457: user, and this can be in a number of ways:</p>
10458:
10459: <div class="itemizedlist">
10460: <ul type="disc">
10461: <li>
10462: <p>help in fetching the distfiles</p>
10463: </li>
10464:
10465: <li>
10466: <p>help to configure the package before it is
10467: built</p>
10468: </li>
10469:
10470: <li>
10471: <p>help during the build process</p>
10472: </li>
10473:
10474: <li>
10475: <p>help during the installation of a package</p>
10476: </li>
10477: </ul>
10478: </div>
10479:
1.14 xtraeme 10480: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 10481: definition is provided to notify the pkgsrc mechanism
10482: of an interactive stage which will be needed, and this
1.14 xtraeme 10483: should be set in the package's <code class=
10484: "filename">Makefile</code>. e.g.</p>
1.1 grant 10485: <pre class="programlisting">
10486: INTERACTIVE_STAGE= build
10487: </pre>
10488:
10489: <p>Multiple interactive stages can be specified:</p>
10490: <pre class="programlisting">
10491: INTERACTIVE_STAGE= configure install
10492: </pre>
10493: </div>
10494:
10495: <div class="sect2" lang="en" xml:lang="en">
10496: <div class="titlepage">
10497: <div>
10498: <div>
1.30 wiz 10499: <h3 class="title"><a name="handling-licenses" id=
10500: "handling-licenses"></a>13.5.3. Handling
1.1 grant 10501: licenses</h3>
10502: </div>
10503: </div>
10504: </div>
10505:
10506: <p>A package may underly a license which the user has
10507: or has not agreed to accept. Usually, packages that
10508: underly well-known Open Source licenses (e.g. the GNU
10509: Public License, GPL) won't have any special license
10510: tags added in pkgsrc which require special action by
10511: the user of such packages, but there are quite a number
10512: of other licenses out there that pkgsrc users may not
10513: be able to follow, for whatever reasons. For these
10514: cases, pkgsrc contains a mechanism to note that a
10515: package underlies a certain license, and the user has
10516: to accept the license before the package can be
10517: installed.</p>
10518:
10519: <p>Placing a certain package under a certain license
1.14 xtraeme 10520: works by setting the <code class=
10521: "varname">LICENSE</code> variable to a string
10522: identifying the license, e.g. in <a xmlns=
10523: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10524: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20 ben 10525: class="pkgname">graphics/graphviz</a>:</p>
1.1 grant 10526: <pre class="programlisting">
10527: LICENSE= graphviz-license
10528: </pre>
10529:
10530: <p>When trying to build, the user will get a notice
10531: that the package underlies a license which he hasn't
10532: accepted (yet):</p>
10533: <pre class="programlisting">
1.14 xtraeme 10534: <code class="prompt">%</code> <strong class=
10535: "userinput"><code>make</code></strong>
1.1 grant 10536: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
10537: ===> To build this package, add this line to your /etc/mk.conf:
10538: ===> ACCEPTABLE_LICENSES+=graphviz-license
10539: ===> To view the license, enter "/usr/bin/make show-license".
10540: *** Error code 1
10541: </pre>
10542:
1.14 xtraeme 10543: <p>The license can be viewed with <span><strong class=
10544: "command">make show-license</strong></span>, and if it
10545: is considered appropriate, the line printed above can
10546: be added to <code class="filename">/etc/mk.conf</code>
10547: to indicate acceptance of the particular license:</p>
1.1 grant 10548: <pre class="programlisting">
10549: ACCEPTABLE_LICENSES+=graphviz-license
10550: </pre>
10551:
10552: <p>When adding a package with a new license, the
1.14 xtraeme 10553: license text should be added to <code class=
10554: "filename">pkgsrc/licenses</code> for displaying. A
10555: list of known licenses can be seen in this directory as
10556: well as by looking at the list of (commented out)
10557: <code class="varname">ACCEPTABLE_LICENSES</code>
10558: variable settings in <code class=
10559: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 10560:
1.17 sketch 10561: <p>If there is a <span class=
1.1 grant 10562: "emphasis"><em>really</em></span> pressing need to
10563: accept all licenses at once, like when trying to
10564: download or mirror all distfiles or doing a bulk build
10565: to test if all packages in pkgsrc build, this can be
1.14 xtraeme 10566: done by setting <code class=
10567: "varname">_ACCEPTABLE=yes</code>.</p>
1.1 grant 10568: </div>
10569:
10570: <div class="sect2" lang="en" xml:lang="en">
10571: <div class="titlepage">
10572: <div>
10573: <div>
1.30 wiz 10574: <h3 class="title"><a name="creating-accounts" id=
10575: "creating-accounts"></a>13.5.4. Creating an
10576: account from a package</h3>
1.1 grant 10577: </div>
10578: </div>
10579: </div>
10580:
10581: <p>There are two make variables used to control the
10582: creation of package-specific groups and users at
1.14 xtraeme 10583: pre-install time. The first is <code class=
10584: "varname">PKG_GROUPS</code>, which is a list of
1.1 grant 10585: group[:groupid] elements, where the groupid is
1.14 xtraeme 10586: optional. The second is <code class=
10587: "varname">PKG_USERS</code>, which is a list of elements
1.1 grant 10588: of the form:</p>
10589: <pre class="programlisting">
10590: user:group[:[userid][:[description][:[home][:shell]]]]
10591: </pre>
10592:
10593: <p>where only the user and group are required, the rest
10594: being optional. A simple example is:</p>
10595: <pre class="programlisting">
10596: PKG_GROUPS= foogroup
10597: PKG_USERS= foouser:foogroup
10598: </pre>
10599:
10600: <p>A more complex example is that creates two groups
10601: and two users is:</p>
10602: <pre class="programlisting">
10603: PKG_GROUPS= group1 group2:1005
10604: PKG_USERS= first:group1::First\\ User \
10605: second:group2::Second\\ User:/home/second:${SH}
10606: </pre>
10607:
10608: <p>By default, a new user will have home directory
1.14 xtraeme 10609: <code class="filename">/nonexistent</code>, and login
10610: shell <code class="filename">/sbin/nologin</code>
10611: unless they are specified as part of the user
10612: element.</p>
1.1 grant 10613:
1.14 xtraeme 10614: <p>The package <code class="filename">Makefile</code>
10615: must also set <code class=
10616: "varname">USE_PKGINSTALL=YES</code>. This will cause
10617: the users and groups to be created at pre-install time,
10618: and the admin will be prompted to remove them at
10619: post-deinstall time. Automatic creation of the users
10620: and groups can be toggled on and off by setting the
10621: <code class="varname">PKG_CREATE_USERGROUP</code>
10622: variable prior to package installation.</p>
1.1 grant 10623: </div>
10624:
10625: <div class="sect2" lang="en" xml:lang="en">
10626: <div class="titlepage">
10627: <div>
10628: <div>
1.30 wiz 10629: <h3 class="title"><a name=
10630: "installing-score-files" id=
10631: "installing-score-files"></a>13.5.5. Installing
10632: score files</h3>
1.1 grant 10633: </div>
10634: </div>
10635: </div>
10636:
10637: <p>Certain packages, most of them in the games
10638: category, install a score file that allows all users on
10639: the system to record their highscores. In order for
10640: this to work, the binaries need to be installed setgid
10641: and the score files owned by the appropriate group
10642: and/or owner (traditionally the "games" user/group).
10643: The following variables, documented in more detail in
1.14 xtraeme 10644: <code class="filename">mk/defaults/mk.conf</code>,
10645: control this behaviour: <code class=
10646: "varname">SETGIDGAME</code>, <code class=
10647: "varname">GAMEDATAMODE</code>, <code class=
10648: "varname">GAMEGRP</code>, <code class=
10649: "varname">GAMEMODE</code>, <code class=
10650: "varname">GAMEOWN</code>.</p>
1.1 grant 10651:
10652: <p>Note that per default, setgid installation of games
1.14 xtraeme 10653: is disabled; setting <code class=
10654: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 10655: variables accordingly.</p>
10656:
10657: <p>A package should therefor never hard code file
1.14 xtraeme 10658: ownership or access permissions but rely on
10659: <code class="varname">INSTALL_GAME</code> and
10660: <code class="varname">INSTALL_GAME_DATA</code> to set
10661: these correctly.</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="login-shells" id=
10669: "login-shells"></a>13.5.6. Packages
10670: providing login shells</h3>
1.1 grant 10671: </div>
10672: </div>
10673: </div>
10674:
10675: <p>If the purpose of the package is to provide a login
1.14 xtraeme 10676: shell, the variable <code class=
10677: "varname">PKG_SHELL</code> should contain the full
10678: pathname of the shell executable installed by this
10679: package. The package <code class=
10680: "filename">Makefile</code> must also set <code class=
10681: "varname">USE_PKGINSTALL=YES</code> to use the
10682: automatically generated <code class=
10683: "filename">INSTALL</code>/<code class=
10684: "filename">DEINSTALL</code> scripts.</p>
1.1 grant 10685:
10686: <p>An example taken from shells/zsh:</p>
10687: <pre class="programlisting">
10688: USE_PKGINSTALL= YES
10689: PKG_SHELL= ${PREFIX}/bin/zsh
10690: </pre>
10691:
1.14 xtraeme 10692: <p>The shell is registered into <code class=
10693: "filename">/etc/shells</code> file automatically in the
10694: post-install target by the generated <code class=
10695: "filename">INSTALL</code> script and removed in the
10696: deinstall target by the <code class=
10697: "filename">DEINSTALL</code> script.</p>
1.1 grant 10698: </div>
10699:
10700: <div class="sect2" lang="en" xml:lang="en">
10701: <div class="titlepage">
10702: <div>
10703: <div>
1.30 wiz 10704: <h3 class="title"><a name="perl-scripts" id=
10705: "perl-scripts"></a>13.5.7. Packages
10706: containing perl scripts</h3>
1.1 grant 10707: </div>
10708: </div>
10709: </div>
10710:
10711: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 10712: set <code class="varname">REPLACE_PERL</code> to ensure
10713: that the proper interpreter path is set. <code class=
10714: "varname">REPLACE_PERL</code> should contain a list of
10715: scripts, relative to <code class=
10716: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 10717: </div>
10718:
10719: <div class="sect2" lang="en" xml:lang="en">
10720: <div class="titlepage">
10721: <div>
10722: <div>
1.30 wiz 10723: <h3 class="title"><a name="hardcoded-paths" id=
10724: "hardcoded-paths"></a>13.5.8. Packages with
1.1 grant 10725: hardcoded paths to other interpreters</h3>
10726: </div>
10727: </div>
10728: </div>
10729:
10730: <p>Your package may also contain scripts with hardcoded
10731: paths to other interpreters besides (or as well as)
10732: perl. To correct the full pathname to the script
10733: interpreter, you need to set the following definitions
1.14 xtraeme 10734: in your <code class="filename">Makefile</code> (we
10735: shall use <span><strong class=
10736: "command">tclsh</strong></span> in this example):</p>
1.1 grant 10737: <pre class="programlisting">
10738: REPLACE_INTERPRETER+= tcl
10739: _REPLACE.tcl.old= .*/bin/tclsh
10740: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
10741: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
10742: relative to ${WRKSRC}, just as in REPLACE_PERL
10743: </pre>
10744: </div>
10745:
10746: <div class="sect2" lang="en" xml:lang="en">
10747: <div class="titlepage">
10748: <div>
10749: <div>
1.30 wiz 10750: <h3 class="title"><a name="perl-modules" id=
10751: "perl-modules"></a>13.5.9. Packages
10752: installing perl modules</h3>
1.1 grant 10753: </div>
10754: </div>
10755: </div>
10756:
10757: <p>Makefiles of packages providing perl5 modules should
1.14 xtraeme 10758: include the Makefile fragment <code class=
10759: "filename">../../lang/perl5/module.mk</code>. It
10760: provides a <span><strong class=
10761: "command">do-configure</strong></span> target for the
10762: standard perl configuration for such modules as well as
10763: various hooks to tune this configuration. See comments
10764: in this file for details.</p>
1.1 grant 10765:
10766: <p>Perl5 modules will install into different places
10767: depending on the version of perl used during the build
10768: process. To address this, pkgsrc will append lines to
1.14 xtraeme 10769: the <code class="filename">PLIST</code> corresponding
10770: to the files listed in the installed <code class=
10771: "filename">.packlist</code> file generated by most
10772: perl5 modules. This is invoked by defining <code class=
10773: "varname">PERL5_PACKLIST</code> to a space-separated
10774: list of paths to packlist files, e.g.:</p>
1.1 grant 10775: <pre class="programlisting">
10776: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
10777: </pre>
10778:
1.14 xtraeme 10779: <p>The variables <code class=
10780: "varname">PERL5_SITELIB</code>, <code class=
10781: "varname">PERL5_SITEARCH</code>, and <code class=
10782: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 10783: locations in which perl5 modules may be installed, and
10784: may be used by perl5 packages that don't have a
10785: packlist. These three variables are also substituted
1.14 xtraeme 10786: for in the <code class="filename">PLIST</code>.</p>
1.1 grant 10787: </div>
10788:
10789: <div class="sect2" lang="en" xml:lang="en">
10790: <div class="titlepage">
10791: <div>
10792: <div>
10793: <h3 class="title"><a name="faq.info-files" id=
1.25 rillig 10794: "faq.info-files"></a>13.5.10. Packages
1.1 grant 10795: installing info files</h3>
10796: </div>
10797: </div>
10798: </div>
10799:
10800: <p>Some packages install info files or use the
10801: “<span class="quote">makeinfo</span>” or
10802: “<span class="quote">install-info</span>”
10803: commands. Each of the info files:</p>
10804:
10805: <div class="itemizedlist">
10806: <ul type="disc">
10807: <li>
10808: <p>is considered to be installed in the directory
1.14 xtraeme 10809: <code class=
10810: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 10811: </li>
10812:
10813: <li>
10814: <p>is registered in the Info directory file
1.14 xtraeme 10815: <code class=
10816: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 10817: </li>
10818:
10819: <li>
10820: <p>and must be listed as a filename in the
1.14 xtraeme 10821: <code class="varname">INFO_FILES</code> variable
10822: in the package Makefile.</p>
1.1 grant 10823: </li>
10824: </ul>
10825: </div>
10826:
1.14 xtraeme 10827: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 10828: “<span class="quote">info</span>” and can
1.14 xtraeme 10829: be overridden in the package Makefile. <code class=
10830: "filename">INSTALL</code> and <code class=
10831: "filename">DEINSTALL</code> scripts will be generated
10832: to handle registration of the info files in the Info
1.1 grant 10833: directory file. The “<span class=
10834: "quote">install-info</span>” command used for the
10835: info files registration is either provided by the
10836: system, or by a special purpose package automatically
10837: added as dependency if needed.</p>
10838:
10839: <p>A package which needs the “<span class=
10840: "quote">makeinfo</span>” command at build time
1.14 xtraeme 10841: must define the variable <code class=
10842: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 10843: minimum version of the “<span class=
10844: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 10845: should be noted with the <code class=
10846: "varname">TEXINFO_REQD</code> variable in the package
10847: <code class="filename">Makefile</code>. By default, a
1.1 grant 10848: minimum version of 3.12 is required. If the system does
1.14 xtraeme 10849: not provide a <span><strong class=
10850: "command">makeinfo</strong></span> command or if it
10851: does not match the required minimum, a build dependency
10852: on the <a xmlns=
10853: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10854: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20 ben 10855: class="pkgname">devel/gtexinfo</a> package will be
10856: added automatically.</p>
1.1 grant 10857:
10858: <p>The build and installation process of the software
10859: provided by the package should not use the
1.14 xtraeme 10860: <span><strong class=
10861: "command">install-info</strong></span> command as the
10862: registration of info files is the task of the package
10863: <code class="filename">INSTALL</code> script, and it
10864: must use the appropriate <span><strong class=
10865: "command">makeinfo</strong></span> command.</p>
1.1 grant 10866:
10867: <p>To achieve this goal the pkgsrc infrastructure
1.14 xtraeme 10868: creates overriding scripts for the <span><strong class=
10869: "command">install-info</strong></span> and
10870: <span><strong class="command">makeinfo</strong></span>
10871: commands in a directory listed early in <code class=
10872: "varname">PATH</code>.</p>
1.1 grant 10873:
1.14 xtraeme 10874: <p>The script overriding <span><strong class=
10875: "command">install-info</strong></span> has no effect
10876: except the logging of a message. The script overriding
10877: <span><strong class="command">makeinfo</strong></span>
10878: logs a message and according to the value of
10879: <code class="varname">USE_MAKEINFO</code> and
10880: <code class="varname">TEXINFO_REQD</code> either run
10881: the appropriate <span><strong class=
10882: "command">makeinfo</strong></span> command or exit on
10883: error.</p>
1.1 grant 10884: </div>
10885:
10886: <div class="sect2" lang="en" xml:lang="en">
10887: <div class="titlepage">
10888: <div>
10889: <div>
1.30 wiz 10890: <h3 class="title"><a name="gconf2-data-files" id=
10891: "gconf2-data-files"></a>13.5.11. Packages
10892: installing GConf2 data files</h3>
1.1 grant 10893: </div>
10894: </div>
10895: </div>
10896:
1.14 xtraeme 10897: <p>If a package installs <code class=
10898: "filename">.schemas</code> or <code class=
10899: "filename">.entries</code> files, used by GConf2, you
1.1 grant 10900: need to take some extra steps to make sure they get
10901: registered in the database:</p>
10902:
10903: <div class="orderedlist">
10904: <ol type="1">
10905: <li>
1.14 xtraeme 10906: <p>Include <code class=
10907: "filename">../../devel/GConf2/schemas.mk</code>
10908: instead of its <code class=
10909: "filename">buildlink3.mk</code> file. This takes
1.1 grant 10910: care of rebuilding the GConf2 database at
10911: installation and deinstallation time, and tells
10912: the package where to install GConf2 data files
10913: using some standard configure arguments. It also
10914: disallows any access to the database directly
10915: from the package.</p>
10916: </li>
10917:
10918: <li>
10919: <p>Ensure that the package installs its
1.14 xtraeme 10920: <code class="filename">.schemas</code> files
10921: under <code class=
10922: "filename">${PREFIX}/share/gconf/schemas</code>.
10923: If they get installed under <code class=
10924: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 10925: manually patch the package.</p>
10926: </li>
10927:
10928: <li>
10929: <p>Check the PLIST and remove any entries under
10930: the etc/gconf directory, as they will be handled
10931: automatically. See <a href="#faq.conf" title=
1.14 xtraeme 10932: "6.14. Configuration files handling and placement">
10933: Section 6.14, “Configuration files
1.1 grant 10934: handling and placement”</a> for more
10935: information.</p>
10936: </li>
10937:
10938: <li>
1.14 xtraeme 10939: <p>Define the <code class=
10940: "varname">GCONF2_SCHEMAS</code> variable in your
10941: <code class="filename">Makefile</code> with a
10942: list of all <code class=
10943: "filename">.schemas</code> files installed by the
10944: package, if any. Names must not contain any
10945: directories in them.</p>
1.1 grant 10946: </li>
10947:
10948: <li>
1.14 xtraeme 10949: <p>Define the <code class=
10950: "varname">GCONF2_ENTRIES</code> variable in your
10951: <code class="filename">Makefile</code> with a
10952: list of all <code class=
10953: "filename">.entries</code> files installed by the
10954: package, if any. Names must not contain any
10955: directories in them.</p>
1.1 grant 10956: </li>
10957: </ol>
10958: </div>
10959: </div>
10960:
10961: <div class="sect2" lang="en" xml:lang="en">
10962: <div class="titlepage">
10963: <div>
10964: <div>
1.30 wiz 10965: <h3 class="title"><a name=
10966: "scrollkeeper-data-files" id=
10967: "scrollkeeper-data-files"></a>13.5.12. Packages
10968: installing scrollkeeper data files</h3>
1.1 grant 10969: </div>
10970: </div>
10971: </div>
10972:
1.14 xtraeme 10973: <p>If a package installs <code class=
10974: "filename">.omf</code> files, used by scrollkeeper, you
10975: need to take some extra steps to make sure they get
10976: registered in the database:</p>
1.1 grant 10977:
10978: <div class="orderedlist">
10979: <ol type="1">
10980: <li>
1.14 xtraeme 10981: <p>Include <code class=
10982: "filename">../../textproc/scrollkeeper/omf.mk</code>
10983: instead of its <code class=
10984: "filename">buildlink3.mk</code> file. This takes
1.1 grant 10985: care of rebuilding the scrollkeeper database at
10986: installation and deinstallation time, and
10987: disallows any access to it directly from the
10988: package.</p>
10989: </li>
10990:
10991: <li>
10992: <p>Check the PLIST and remove any entries under
1.14 xtraeme 10993: the <code class=
10994: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 10995: as they will be handled automatically.</p>
10996: </li>
10997:
10998: <li>
1.14 xtraeme 10999: <p>Remove the <code class=
11000: "filename">share/omf</code> directory from the
11001: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 11002: </li>
11003: </ol>
11004: </div>
11005: </div>
11006:
11007: <div class="sect2" lang="en" xml:lang="en">
11008: <div class="titlepage">
11009: <div>
11010: <div>
1.30 wiz 11011: <h3 class="title"><a name="x11-fonts" id=
11012: "x11-fonts"></a>13.5.13. Packages installing
1.1 grant 11013: X11 fonts</h3>
11014: </div>
11015: </div>
11016: </div>
11017:
11018: <p>If a package installs font files, you will need to
11019: rebuild the fonts database in the directory where they
11020: get installed at installation and deinstallation time.
1.14 xtraeme 11021: This can be automatically done by using <code class=
11022: "filename">mk/fonts.mk</code>, which you need to
11023: include in your <code class=
11024: "filename">Makefile</code>.</p>
1.1 grant 11025:
11026: <p>When the file is included, you can list the
1.14 xtraeme 11027: directories where fonts are installed in the
11028: <code class="varname">FONTS_<em class=
11029: "replaceable"><code>type</code></em>_DIRS</code>
11030: variables, where <em class=
11031: "replaceable"><code>type</code></em> can be one of
11032: “<span class="quote">TTF</span>”,
1.1 grant 11033: “<span class="quote">TYPE1</span>” or
11034: “<span class="quote">X11</span>”. Also make
1.14 xtraeme 11035: sure that the database file <code class=
11036: "filename">fonts.dir</code> is not listed in the
1.1 grant 11037: PLIST.</p>
11038:
11039: <p>Note that you should not create new directories for
11040: fonts; instead use the standard ones to avoid that the
11041: user needs to manually configure his X server to find
11042: them.</p>
11043: </div>
11044:
11045: <div class="sect2" lang="en" xml:lang="en">
11046: <div class="titlepage">
11047: <div>
11048: <div>
1.30 wiz 11049: <h3 class="title"><a name="gtk2-modules" id=
11050: "gtk2-modules"></a>13.5.14. Packages
11051: installing GTK2 modules</h3>
1.1 grant 11052: </div>
11053: </div>
11054: </div>
11055:
11056: <p>If a package installs gtk2 immodules or loaders, you
11057: need to take some extra steps to get them registered in
11058: the GTK2 database properly:</p>
11059:
11060: <div class="orderedlist">
11061: <ol type="1">
11062: <li>
1.14 xtraeme 11063: <p>Include <code class=
11064: "filename">../../x11/gtk2/modules.mk</code>
11065: instead of its <code class=
11066: "filename">buildlink3.mk</code> file. This takes
11067: care of rebuilding the database at installation
11068: and deinstallation time.</p>
1.1 grant 11069: </li>
11070:
11071: <li>
1.14 xtraeme 11072: <p>Set <code class=
11073: "varname">GTK2_IMMODULES=YES</code> if your
11074: package installs GTK2 immodules.</p>
1.1 grant 11075: </li>
11076:
11077: <li>
1.14 xtraeme 11078: <p>Set <code class=
11079: "varname">GTK2_LOADERS=YES</code> if your package
11080: installs GTK2 loaders.</p>
1.1 grant 11081: </li>
11082:
11083: <li>
11084: <p>Patch the package to not touch any of the gtk2
11085: databases directly. These are:</p>
11086:
11087: <div class="itemizedlist">
11088: <ul type="disc">
11089: <li>
1.14 xtraeme 11090: <p><code class=
11091: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 11092: </li>
11093:
11094: <li>
1.14 xtraeme 11095: <p><code class=
11096: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 11097: </li>
11098: </ul>
11099: </div>
11100: </li>
11101:
11102: <li>
11103: <p>Check the PLIST and remove any entries under
1.14 xtraeme 11104: the <code class="filename">libdata/gtk-2.0</code>
1.1 grant 11105: directory, as they will be handled
11106: automatically.</p>
11107: </li>
11108: </ol>
11109: </div>
11110: </div>
11111:
11112: <div class="sect2" lang="en" xml:lang="en">
11113: <div class="titlepage">
11114: <div>
11115: <div>
1.30 wiz 11116: <h3 class="title"><a name="sgml-xml-data" id=
11117: "sgml-xml-data"></a>13.5.15. Packages
11118: installing SGML or XML data</h3>
1.1 grant 11119: </div>
11120: </div>
11121: </div>
11122:
11123: <p>If a package installs SGML or XML data files that
11124: need to be registered in system-wide catalogs (like
11125: DTDs, sub-catalogs, etc.), you need to take some extra
11126: steps:</p>
11127:
11128: <div class="orderedlist">
11129: <ol type="1">
11130: <li>
1.14 xtraeme 11131: <p>Include <code class=
11132: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
11133: in your <code class="filename">Makefile</code>,
11134: which takes care of registering those files in
1.1 grant 11135: system-wide catalogs at installation and
11136: deinstallation time.</p>
11137: </li>
11138:
11139: <li>
1.14 xtraeme 11140: <p>Set <code class="varname">SGML_CATALOGS</code>
11141: to the full path of any SGML catalogs installed
11142: by the package.</p>
1.1 grant 11143: </li>
11144:
11145: <li>
1.14 xtraeme 11146: <p>Set <code class="varname">XML_CATALOGS</code>
11147: to the full path of any XML catalogs installed by
1.1 grant 11148: the package.</p>
11149: </li>
11150:
11151: <li>
1.14 xtraeme 11152: <p>Set <code class="varname">SGML_ENTRIES</code>
11153: to individual entries to be added to the SGML
1.1 grant 11154: catalog. These come in groups of three strings;
11155: see xmlcatmgr(1) for more information
11156: (specifically, arguments recognized by the 'add'
11157: action). Note that you will normally not use this
11158: variable.</p>
11159: </li>
11160:
11161: <li>
1.14 xtraeme 11162: <p>Set <code class="varname">XML_ENTRIES</code>
11163: to individual entries to be added to the XML
1.1 grant 11164: catalog. These come in groups of three strings;
11165: see xmlcatmgr(1) for more information
11166: (specifically, arguments recognized by the 'add'
11167: action). Note that you will normally not use this
11168: variable.</p>
11169: </li>
11170: </ol>
11171: </div>
11172: </div>
11173:
11174: <div class="sect2" lang="en" xml:lang="en">
11175: <div class="titlepage">
11176: <div>
11177: <div>
1.30 wiz 11178: <h3 class="title"><a name="mime-database" id=
11179: "mime-database"></a>13.5.16. Packages
11180: installing extensions to the MIME database</h3>
1.1 grant 11181: </div>
11182: </div>
11183: </div>
11184:
11185: <p>If a package provides extensions to the MIME
1.14 xtraeme 11186: database by installing <code class=
11187: "filename">.xml</code> files inside <code class=
11188: "filename">${PREFIX}/share/mime/packages</code>, you
11189: need to take some extra steps to ensure that the
11190: database is kept consistent with respect to these new
11191: files:</p>
1.1 grant 11192:
11193: <div class="orderedlist">
11194: <ol type="1">
11195: <li>
1.14 xtraeme 11196: <p>Include <code class=
11197: "filename">../../databases/shared-mime-info/mimedb.mk</code>
11198: (avoid using the <code class=
11199: "filename">buildlink3.mk</code> file from this
11200: same directory, which is reserved for inclusion
11201: from other <code class=
11202: "filename">buildlink3.mk</code> files). It takes
11203: care of rebuilding the MIME database at
11204: installation and deinstallation time, and
11205: disallows any access to it directly from the
1.1 grant 11206: package.</p>
11207: </li>
11208:
11209: <li>
11210: <p>Check the PLIST and remove any entries under
1.14 xtraeme 11211: the <code class="filename">share/mime</code>
1.1 grant 11212: directory, <span class=
11213: "emphasis"><em>except</em></span> for files saved
1.14 xtraeme 11214: under <code class=
11215: "filename">share/mime/packages</code>. The former
1.1 grant 11216: are handled automatically by the
11217: update-mime-database program, but the later are
11218: package-dependent and must be removed by the
11219: package that installed them in the first
11220: place.</p>
11221: </li>
11222:
11223: <li>
1.14 xtraeme 11224: <p>Remove any <code class=
11225: "filename">share/mime/*</code> directories from
11226: the PLIST. They will be handled by the
1.1 grant 11227: shared-mime-info package.</p>
11228: </li>
11229: </ol>
11230: </div>
11231: </div>
11232:
11233: <div class="sect2" lang="en" xml:lang="en">
11234: <div class="titlepage">
11235: <div>
11236: <div>
1.30 wiz 11237: <h3 class="title"><a name="intltool" id=
11238: "intltool"></a>13.5.17. Packages using
1.1 grant 11239: intltool</h3>
11240: </div>
11241: </div>
11242: </div>
11243:
11244: <p>If a package uses intltool during its build, include
1.14 xtraeme 11245: the <code class=
11246: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 11247: file, which forces it to use the intltool package
11248: provided by pkgsrc, instead of the one bundled with the
11249: distribution file.</p>
11250:
11251: <p>This tracks intltool's build-time dependencies and
11252: uses the latest available version; this way, the
11253: package benefits of any bug fixes that may have
11254: appeared since it was released.</p>
11255: </div>
1.18 xtraeme 11256:
11257: <div class="sect2" lang="en" xml:lang="en">
11258: <div class="titlepage">
11259: <div>
11260: <div>
1.30 wiz 11261: <h3 class="title"><a name="startup-scripts" id=
11262: "startup-scripts"></a>13.5.18. Packages
11263: installing startup scripts</h3>
1.18 xtraeme 11264: </div>
11265: </div>
11266: </div>
11267:
11268: <p>If a package contains a rc.d script, it won't be
11269: copied into the startup directory by default, but you
11270: can enable it, by adding the option <code class=
11271: "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
11272: "filename">/etc/mk.conf</code>. This option will copy
11273: the scripts into <code class=
11274: "filename">/etc/rc.d</code> when a package is
11275: installed, and it will automatically remove the scripts
11276: when the package is deinstalled.</p>
11277: </div>
1.1 grant 11278: </div>
11279:
11280: <div class="sect1" lang="en" xml:lang="en">
11281: <div class="titlepage">
11282: <div>
11283: <div>
11284: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11285: "feedback-to-author" id=
11286: "feedback-to-author"></a>13.6. Feedback to the
11287: author</h2>
1.1 grant 11288: </div>
11289: </div>
11290: </div>
11291:
11292: <p>If you have found any bugs in the package you make
11293: available, if you had to do special steps to make it run
11294: under NetBSD or if you enhanced the software in various
11295: other ways, be sure to report these changes back to the
11296: original author of the program! With that kind of
11297: support, the next release of the program can incorporate
11298: these fixes, and people not using the NetBSD packages
11299: system can win from your efforts.</p>
11300:
11301: <p>Support the idea of free software!</p>
11302: </div>
11303: </div>
11304:
11305: <div class="chapter" lang="en" xml:lang="en">
11306: <div class="titlepage">
11307: <div>
11308: <div>
11309: <h2 class="title"><a name="debug" id=
1.25 rillig 11310: "debug"></a>Chapter 14. Debugging</h2>
1.1 grant 11311: </div>
11312: </div>
11313: </div>
11314:
11315: <p>To check out all the gotchas when building a package,
11316: here are the steps that I do in order to get a package
11317: working. Please note this is basically the same as what was
11318: explained in the previous sections, only with some
11319: debugging aids.</p>
11320:
11321: <div class="itemizedlist">
11322: <ul type="disc">
11323: <li>
1.14 xtraeme 11324: <p>Be sure to set <code class=
11325: "varname">PKG_DEVELOPER=1</code> in <code class=
11326: "filename">/etc/mk.conf</code></p>
1.1 grant 11327: </li>
11328:
11329: <li>
11330: <p>Install <a xmlns=
11331: "http://www.w3.org/TR/xhtml1/transitional" href=
11332: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20 ben 11333: class="pkgname">pkgtools/url2pkg</a>, create a
11334: directory for a new package, change into it, then run
11335: <span><strong class=
11336: "command">url2pkg</strong></span>:</p>
1.1 grant 11337: <pre class="screen">
1.14 xtraeme 11338: <code class="prompt">%</code> <strong class=
11339: "userinput"><code>mkdir /usr/pkgsrc/<em class=
11340: "replaceable"><code>category</code></em>/<em class=
11341: "replaceable"><code>examplepkg</code></em></code></strong>
11342: <code class="prompt">%</code> <strong class=
11343: "userinput"><code>cd /usr/pkgsrc/<em class=
11344: "replaceable"><code>category</code></em>/<em class=
11345: "replaceable"><code>examplepkg</code></em></code></strong>
11346: <code class="prompt">%</code> <strong class=
11347: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 11348: </pre>
11349: </li>
11350:
11351: <li>
1.14 xtraeme 11352: <p>Edit the <code class="filename">Makefile</code> as
1.1 grant 11353: requested.</p>
11354: </li>
11355:
11356: <li>
1.14 xtraeme 11357: <p>Fill in the <code class="filename">DESCR</code>
1.1 grant 11358: file</p>
11359: </li>
11360:
11361: <li>
1.14 xtraeme 11362: <p>Run <span><strong class="command">make
11363: configure</strong></span></p>
1.1 grant 11364: </li>
11365:
11366: <li>
11367: <p>Add any dependencies glimpsed from documentation
1.14 xtraeme 11368: and the configure step to the package's <code class=
11369: "filename">Makefile</code>.</p>
1.1 grant 11370: </li>
11371:
11372: <li>
11373: <p>Make the package compile, doing multiple rounds
11374: of</p>
11375: <pre class="screen">
1.14 xtraeme 11376: <code class="prompt">%</code> <strong class=
11377: "userinput"><code>make</code></strong>
11378: <code class="prompt">%</code> <strong class=
11379: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
11380: <code class="prompt">%</code> <strong class=
11381: "userinput"><code>mkpatches</code></strong>
11382: <code class="prompt">%</code> <strong class=
11383: "userinput"><code>patchdiff</code></strong>
11384: <code class="prompt">%</code> <strong class=
11385: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
11386: <code class="prompt">%</code> <strong class=
11387: "userinput"><code>make mps</code></strong>
11388: <code class="prompt">%</code> <strong class=
11389: "userinput"><code>make clean</code></strong>
1.1 grant 11390: </pre>
11391:
11392: <p>Doing as non-root user will ensure that no files
11393: are modified that shouldn't be, especially during the
1.14 xtraeme 11394: build phase. <span><strong class=
11395: "command">mkpatches</strong></span>,
11396: <span><strong class=
11397: "command">patchdiff</strong></span> and
11398: <span><strong class="command">pkgvi</strong></span>
11399: are from the <a xmlns=
1.1 grant 11400: "http://www.w3.org/TR/xhtml1/transitional" href=
11401: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 11402: class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1 grant 11403: </li>
11404:
11405: <li>
1.14 xtraeme 11406: <p>Look at the <code class=
11407: "filename">Makefile</code>, fix if necessary; see
11408: <a href="#components.Makefile" title=
1.27 rillig 11409: "7.1. Makefile">Section 7.1,
1.14 xtraeme 11410: “<code class=
11411: "filename">Makefile</code>”</a>.</p>
1.1 grant 11412: </li>
11413:
11414: <li>
1.14 xtraeme 11415: <p>Generate a <code class=
11416: "filename">PLIST</code>:</p>
1.1 grant 11417: <pre class="screen">
1.14 xtraeme 11418: <code class="prompt">#</code> <strong class=
11419: "userinput"><code>make install</code></strong>
11420: <code class="prompt">#</code> <strong class=
11421: "userinput"><code>make print-PLIST >PLIST</code></strong>
11422: <code class="prompt">#</code> <strong class=
11423: "userinput"><code>make deinstall</code></strong>
11424: <code class="prompt">#</code> <strong class=
11425: "userinput"><code>make install</code></strong>
11426: <code class="prompt">#</code> <strong class=
11427: "userinput"><code>make deinstall</code></strong>
1.1 grant 11428: </pre>
11429:
1.14 xtraeme 11430: <p>You usually need to be <code class=
11431: "username">root</code> to do this. Look if there are
1.1 grant 11432: any files left:</p>
11433: <pre class="screen">
1.14 xtraeme 11434: <code class="prompt">#</code> <strong class=
11435: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 11436: </pre>
11437:
11438: <p>If this reveals any files that are missing in
1.14 xtraeme 11439: <code class="filename">PLIST</code>, add them.</p>
1.1 grant 11440: </li>
11441:
11442: <li>
1.14 xtraeme 11443: <p>Now that the <code class="filename">PLIST</code>
11444: is OK, install the package again and make a binary
1.1 grant 11445: package:</p>
11446: <pre class="screen">
1.14 xtraeme 11447: <code class="prompt">#</code> <strong class=
11448: "userinput"><code>make reinstall</code></strong>
11449: <code class="prompt">#</code> <strong class=
11450: "userinput"><code>make package</code></strong>
1.1 grant 11451: </pre>
11452: </li>
11453:
11454: <li>
11455: <p>Delete the installed package:</p>
11456: <pre class="screen">
1.14 xtraeme 11457: <code class="prompt">#</code> <strong class=
11458: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 11459: </pre>
11460: </li>
11461:
11462: <li>
1.14 xtraeme 11463: <p>Repeat the above <span><strong class=
11464: "command">make print-PLIST</strong></span> command,
11465: which shouldn't find anything now:</p>
1.1 grant 11466: <pre class="screen">
1.14 xtraeme 11467: <code class="prompt">#</code> <strong class=
11468: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 11469: </pre>
11470: </li>
11471:
11472: <li>
11473: <p>Reinstall the binary package:</p>
11474: <pre class="screen">
1.14 xtraeme 11475: <code class="prompt">#</code> <strong class=
11476: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 11477: </pre>
11478: </li>
11479:
11480: <li>
11481: <p>Play with it. Make sure everything works.</p>
11482: </li>
11483:
11484: <li>
1.14 xtraeme 11485: <p>Run <span><strong class=
11486: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 11487: "http://www.w3.org/TR/xhtml1/transitional" href=
11488: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 11489: class="pkgname">pkgtools/pkglint</a>, and fix the
11490: problems it reports:</p>
1.1 grant 11491: <pre class="screen">
1.14 xtraeme 11492: <code class="prompt">#</code> <strong class=
11493: "userinput"><code>pkglint</code></strong>
1.1 grant 11494: </pre>
11495: </li>
11496:
11497: <li>
11498: <p>Submit (or commit, if you have cvs access); see
11499: <a href="#submit" title=
1.25 rillig 11500: "Chapter 15. Submitting and Committing">Chapter 15,
1.1 grant 11501: <i>Submitting and Committing</i></a>.</p>
11502: </li>
11503: </ul>
11504: </div>
11505: </div>
11506:
11507: <div class="chapter" lang="en" xml:lang="en">
11508: <div class="titlepage">
11509: <div>
11510: <div>
11511: <h2 class="title"><a name="submit" id=
1.25 rillig 11512: "submit"></a>Chapter 15. Submitting and
1.1 grant 11513: Committing</h2>
11514: </div>
11515: </div>
11516: </div>
11517:
11518: <div class="toc">
11519: <p><b>Table of Contents</b></p>
11520:
11521: <dl>
1.30 wiz 11522: <dt><span class="sect1"><a href=
11523: "#submitting-your-package">15.1. Submitting your
11524: packages</a></span></dt>
1.1 grant 11525:
1.30 wiz 11526: <dt><span class="sect1"><a href=
11527: "#committing-importing">15.2. Committing: Importing a
11528: package into CVS</a></span></dt>
1.1 grant 11529:
1.30 wiz 11530: <dt><span class="sect1"><a href=
11531: "#updating-package">15.3. Updating a package to a newer
11532: version</a></span></dt>
1.1 grant 11533:
1.30 wiz 11534: <dt><span class="sect1"><a href="#moving-package">15.4.
1.2 hubertf 11535: Moving a package in pkgsrc</a></span></dt>
1.1 grant 11536: </dl>
11537: </div>
11538:
11539: <div class="sect1" lang="en" xml:lang="en">
11540: <div class="titlepage">
11541: <div>
11542: <div>
11543: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11544: "submitting-your-package" id=
11545: "submitting-your-package"></a>15.1. Submitting
11546: your packages</h2>
1.1 grant 11547: </div>
11548: </div>
11549: </div>
11550:
11551: <p>You have to separate between binary and
11552: “<span class="quote">normal</span>” (source)
11553: packages here:</p>
11554:
11555: <div class="itemizedlist">
11556: <ul type="disc">
11557: <li>
11558: <p>precompiled binary packages</p>
11559:
11560: <p>Our policy is that we accept binaries only from
11561: pkgsrc developers to guarantee that the packages
11562: don't contain any trojan horses etc. This is not to
1.13 hubertf 11563: annoy anyone but rather to protect our users!
1.1 grant 11564: You're still free to put up your home-made binary
1.13 hubertf 11565: packages and tell the world where to get them.
11566: NetBSD developers doing bulk builds and wanting to
11567: upload them please see <a href="#bulk-upload"
11568: title="5.3.8. Uploading results of a bulk build">
11569: Section 5.3.8, “Uploading results of a
11570: bulk build”</a>.</p>
1.1 grant 11571: </li>
11572:
11573: <li>
11574: <p>packages</p>
11575:
11576: <p>First, check that your package is complete,
11577: compiles and runs well; see <a href="#debug" title=
1.25 rillig 11578: "Chapter 14. Debugging">Chapter 14,
1.1 grant 11579: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 11580: Next, generate an uuencoded gzipped <a href=
11581: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
11582: <span class="citerefentry"><span class=
11583: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 11584: preferably with all files in a single directory.
1.14 xtraeme 11585: Finally, <span><strong class=
11586: "command">send-pr</strong></span> with category
1.1 grant 11587: “<span class="quote">pkg</span>”, a
11588: synopsis which includes the package name and
11589: version number, a short description of your package
11590: (contents of the COMMENT variable or DESCR file are
11591: OK) and attach the archive to your PR.</p>
11592:
11593: <p>If you want to submit several packages, please
11594: send a separate PR for each one, it's easier for us
11595: to track things that way.</p>
11596:
11597: <p>Alternatively, you can also import new packages
11598: into pkgsrc-wip (“<span class="quote">pkgsrc
11599: work-in-progress</span>”); see the homepage
11600: at <a href="http://pkgsrc-wip.sourceforge.net/"
11601: target=
11602: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
11603: details.</p>
11604: </li>
11605: </ul>
11606: </div>
11607: </div>
11608:
11609: <div class="sect1" lang="en" xml:lang="en">
11610: <div class="titlepage">
11611: <div>
11612: <div>
11613: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11614: "committing-importing" id=
11615: "committing-importing"></a>15.2. Committing:
11616: Importing a package into CVS</h2>
1.1 grant 11617: </div>
11618: </div>
11619: </div>
11620:
11621: <p>This section is only of interest for pkgsrc developers
11622: with write access to the pkgsrc repository. Please
11623: remember that cvs imports files relative to the current
11624: working directory, and that the pathname that you give
1.14 xtraeme 11625: the <span><strong class="command">cvs
11626: import</strong></span> command is so that it knows where
11627: to place the files in the repository. Newly created
11628: packages should be imported with a vendor tag of
11629: “<span class="quote">TNF</span>” and a
11630: release tag of “<span class=
11631: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 11632: <pre class="programlisting">
11633: % cd .../pkgsrc/category/pkgname
11634: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
11635: </pre>
11636:
11637: <p>Remember to move the directory from which you imported
11638: out of the way, or cvs will complain the next time you
11639: “<span class="quote">cvs update</span>” your
11640: source tree. Also don't forget to add the new package to
1.14 xtraeme 11641: the category's <code class=
11642: "filename">Makefile</code>.</p>
1.1 grant 11643:
11644: <p>The commit message of the initial import should
1.14 xtraeme 11645: include part of the <code class="filename">DESCR</code>
11646: file, so people reading the mailing lists know what the
11647: package is/does.</p>
1.1 grant 11648:
11649: <p>Please note all package updates/additions in
1.14 xtraeme 11650: <code class="filename">pkgsrc/doc/CHANGES</code>. It's
11651: very important to keep this file up to date and
11652: conforming to the existing format, because it will be
11653: used by scripts to automatically update pages on <a href=
1.1 grant 11654: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
11655: and other sites. Additionally, check the pkgsrc/doc/TODO
11656: file and remove the entry for the package you updated, in
11657: case it was mentioned there.</p>
11658:
11659: <p>For new packages, “<span class="quote">cvs
11660: import</span>” is preferred to “<span class=
11661: "quote">cvs add</span>” because the former gets
11662: everything with a single command, and provides a
11663: consistent tag.</p>
11664: </div>
11665:
11666: <div class="sect1" lang="en" xml:lang="en">
11667: <div class="titlepage">
11668: <div>
11669: <div>
11670: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11671: "updating-package" id=
11672: "updating-package"></a>15.3. Updating a
11673: package to a newer version</h2>
1.1 grant 11674: </div>
11675: </div>
11676: </div>
11677:
11678: <p>Please always put a concise, appropriate and relevant
11679: summary of the changes between old and new versions into
11680: the commit log when updating a package. There are various
11681: reasons for this:</p>
11682:
11683: <div class="itemizedlist">
11684: <ul type="disc">
11685: <li>
11686: <p>A URL is volatile, and can change over time. It
11687: may go away completely or its information may be
11688: overwritten by newer information.</p>
11689: </li>
11690:
11691: <li>
11692: <p>Having the change information between old and
11693: new versions in our CVS repository is very useful
11694: for people who use either cvs or anoncvs.</p>
11695: </li>
11696:
11697: <li>
11698: <p>Having the change information between old and
11699: new versions in our CVS repository is very useful
11700: for people who read the pkgsrc-changes mailing
11701: list, so that they can make tactical decisions
11702: about when to upgrade the package.</p>
11703: </li>
11704: </ul>
11705: </div>
11706:
1.18 xtraeme 11707: <p>Please also recognize that, just because a new version
1.1 grant 11708: of a package has been released, it should not
11709: automatically be upgraded in the CVS repository. We
11710: prefer to be conservative in the packages that are
11711: included in pkgsrc - development or beta packages are not
11712: really the best thing for most places in which pkgsrc is
11713: used. Please use your judgement about what should go into
11714: pkgsrc, and bear in mind that stability is to be
11715: preferred above new and possibly untested features.</p>
11716: </div>
11717:
11718: <div class="sect1" lang="en" xml:lang="en">
11719: <div class="titlepage">
11720: <div>
11721: <div>
11722: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11723: "moving-package" id=
11724: "moving-package"></a>15.4. Moving a package in
11725: pkgsrc</h2>
1.1 grant 11726: </div>
11727: </div>
11728: </div>
11729:
11730: <div class="orderedlist">
11731: <ol type="1">
11732: <li>
11733: <p>Make a copy of the directory somewhere else.</p>
11734: </li>
11735:
11736: <li>
11737: <p>Remove all CVS dirs.</p>
11738:
11739: <p>Alternatively to the first two steps you can
11740: also do:</p>
11741: <pre class="screen">
1.14 xtraeme 11742: <code class="prompt">%</code> <strong class=
11743: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 11744: </pre>
11745:
11746: <p>and use that for further work.</p>
11747: </li>
11748:
11749: <li>
1.14 xtraeme 11750: <p>Fix <code class="varname">CATEGORIES</code> and
11751: any <code class="varname">DEPENDS</code> paths that
11752: just did “<span class=
1.1 grant 11753: "quote">../package</span>” instead of
11754: “<span class=
11755: "quote">../../category/package</span>”.</p>
11756: </li>
11757:
11758: <li>
1.14 xtraeme 11759: <p><span><strong class="command">cvs
11760: import</strong></span> the modified package in the
11761: new place.</p>
1.1 grant 11762: </li>
11763:
11764: <li>
11765: <p>Check if any package depends on it:</p>
11766: <pre class="screen">
1.14 xtraeme 11767: <code class="prompt">%</code> <strong class=
11768: "userinput"><code>cd /usr/pkgsrc</code></strong>
11769: <code class="prompt">%</code> <strong class=
11770: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 11771: </pre>
11772: </li>
11773:
11774: <li>
11775: <p>Fix paths in packages from step 5 to point to
11776: new location.</p>
11777: </li>
11778:
11779: <li>
1.14 xtraeme 11780: <p><span><strong class="command">cvs rm
11781: (-f)</strong></span> the package at the old
11782: location.</p>
1.1 grant 11783: </li>
11784:
11785: <li>
1.14 xtraeme 11786: <p>Remove from <code class=
11787: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 11788: </li>
11789:
11790: <li>
1.14 xtraeme 11791: <p>Add to <code class=
11792: "filename">newcategory/Makefile</code>.</p>
1.1 grant 11793: </li>
11794:
11795: <li>
11796: <p>Commit the changed and removed files:</p>
11797: <pre class="screen">
1.14 xtraeme 11798: <code class="prompt">%</code> <strong class=
11799: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 11800: </pre>
11801:
11802: <p>(and any packages from step 5, of course).</p>
11803: </li>
11804: </ol>
11805: </div>
11806: </div>
11807: </div>
11808: </div>
11809:
11810: <div class="appendix" lang="en" xml:lang="en">
11811: <div class="titlepage">
11812: <div>
11813: <div>
11814: <h2 class="title"><a name="examples" id=
11815: "examples"></a>Appendix A. A simple example
11816: package: bison</h2>
11817: </div>
11818: </div>
11819: </div>
11820:
11821: <div class="toc">
11822: <p><b>Table of Contents</b></p>
11823:
11824: <dl>
1.30 wiz 11825: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 11826: files</a></span></dt>
11827:
11828: <dd>
11829: <dl>
1.30 wiz 11830: <dt><span class="sect2"><a href=
11831: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 11832:
1.30 wiz 11833: <dt><span class="sect2"><a href=
11834: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 11835:
1.30 wiz 11836: <dt><span class="sect2"><a href=
11837: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 11838:
1.30 wiz 11839: <dt><span class="sect2"><a href=
11840: "#checking-package-with-pkglint">A.1.4. Checking a
11841: package with <span><strong class=
1.14 xtraeme 11842: "command">pkglint</strong></span></a></span></dt>
1.1 grant 11843: </dl>
11844: </dd>
11845:
1.30 wiz 11846: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
11847: Steps for building, installing, packaging</a></span></dt>
1.1 grant 11848: </dl>
11849: </div>
11850:
11851: <p>We checked to find a piece of software that wasn't in the
11852: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 11853: would want to have <span><strong class=
11854: "command">bison</strong></span> when Berkeley
11855: <span><strong class="command">yacc</strong></span> is already
11856: present in the tree is beyond us, but it's useful for the
11857: purposes of this exercise.</p>
1.1 grant 11858:
11859: <div class="sect1" lang="en" xml:lang="en">
11860: <div class="titlepage">
11861: <div>
11862: <div>
11863: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11864: "example-files" id=
11865: "example-files"></a>A.1. files</h2>
1.1 grant 11866: </div>
11867: </div>
11868: </div>
11869:
11870: <div class="sect2" lang="en" xml:lang="en">
11871: <div class="titlepage">
11872: <div>
11873: <div>
1.30 wiz 11874: <h3 class="title"><a name="example-Makefile" id=
11875: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 11876: </div>
11877: </div>
11878: </div>
11879: <pre class="programlisting">
1.17 sketch 11880: # $NetBSD$
1.1 grant 11881: #
11882:
11883: DISTNAME= bison-1.25
11884: CATEGORIES= devel
11885: MASTER_SITES= ${MASTER_SITE_GNU}
11886:
11887: MAINTAINER= thorpej@NetBSD.org
11888: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
11889: COMMENT= GNU yacc clone
11890:
11891: GNU_CONFIGURE= yes
11892: INFO_FILES= bison.info
11893:
11894: .include "../../mk/bsd.pkg.mk"
11895: </pre>
11896: </div>
11897:
11898: <div class="sect2" lang="en" xml:lang="en">
11899: <div class="titlepage">
11900: <div>
11901: <div>
1.30 wiz 11902: <h3 class="title"><a name="example-descr" id=
11903: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 11904: </div>
11905: </div>
11906: </div>
11907: <pre class="programlisting">
11908: GNU version of yacc. Can make re-entrant parsers, and numerous other
11909: improvements. Why you would want this when Berkeley <a href=
11910: "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
11911: of the NetBSD source tree is beyond me.
11912: </pre>
11913: </div>
11914:
11915: <div class="sect2" lang="en" xml:lang="en">
11916: <div class="titlepage">
11917: <div>
11918: <div>
1.30 wiz 11919: <h3 class="title"><a name="example-plist" id=
11920: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 11921: </div>
11922: </div>
11923: </div>
11924: <pre class="programlisting">
1.17 sketch 11925: @comment $NetBSD$
1.1 grant 11926: bin/bison
11927: man/man1/bison.1.gz
11928: share/bison.simple
11929: share/bison.hairy
11930: </pre>
11931: </div>
11932:
11933: <div class="sect2" lang="en" xml:lang="en">
11934: <div class="titlepage">
11935: <div>
11936: <div>
1.30 wiz 11937: <h3 class="title"><a name=
11938: "checking-package-with-pkglint" id=
11939: "checking-package-with-pkglint"></a>A.1.4. Checking
11940: a package with <span><strong class=
1.14 xtraeme 11941: "command">pkglint</strong></span></h3>
1.1 grant 11942: </div>
11943: </div>
11944: </div>
11945:
11946: <p>The NetBSD package system comes with <a xmlns=
11947: "http://www.w3.org/TR/xhtml1/transitional" href=
11948: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 11949: class="pkgname">pkgtools/pkglint</a> which helps to check
11950: the contents of these files. After installation it is
11951: quite easy to use, just change to the directory of the
11952: package you wish to examine and execute
11953: <span><strong class=
11954: "command">pkglint</strong></span>:</p>
1.1 grant 11955: <pre class="screen">
1.14 xtraeme 11956: <code class="prompt">$</code> <strong class=
11957: "userinput"><code>pkglint</code></strong>
1.1 grant 11958: looks fine.
11959: </pre>
11960:
11961: <p>Depending on the supplied command line arguments (see
11962: pkglint(1)) more verbose checks will be performed. Use
1.14 xtraeme 11963: e.g. <span><strong class="command">pkglint
11964: -v</strong></span> for a very verbose check.</p>
1.1 grant 11965: </div>
11966: </div>
11967:
11968: <div class="sect1" lang="en" xml:lang="en">
11969: <div class="titlepage">
11970: <div>
11971: <div>
11972: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11973: "steps-for-b-i-p" id=
11974: "steps-for-b-i-p"></a>A.2. Steps for building,
11975: installing, packaging</h2>
1.1 grant 11976: </div>
11977: </div>
11978: </div>
11979:
11980: <p>Create the directory where the package lives, plus any
11981: auxiliary directories:</p>
11982: <pre class="screen">
1.14 xtraeme 11983: <code class="prompt">#</code> <strong class=
11984: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
11985: <code class="prompt">#</code> <strong class=
11986: "userinput"><code>mkdir bison</code></strong>
11987: <code class="prompt">#</code> <strong class=
11988: "userinput"><code>cd bison</code></strong>
11989: <code class="prompt">#</code> <strong class=
11990: "userinput"><code>mkdir patches</code></strong>
1.1 grant 11991: </pre>
11992:
1.14 xtraeme 11993: <p>Create <code class="filename">Makefile</code>,
11994: <code class="filename">DESCR</code> and <code class=
11995: "filename">PLIST</code> (see <a href="#components" title=
1.27 rillig 11996: "Chapter 7. Package components - files, directories and contents">
11997: Chapter 7, <i>Package components - files, directories and
1.1 grant 11998: contents</i></a>) then continue with fetching the
11999: distfile:</p>
12000: <pre class="screen">
1.14 xtraeme 12001: <code class="prompt">#</code> <strong class=
12002: "userinput"><code>make fetch</code></strong>
1.1 grant 12003: >> bison-1.25.tar.gz doesn't seem to exist on this system.
12004: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
12005: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
12006: ftp: Error retrieving file: 500 Internal error
12007:
12008: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
12009: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
12010: ftp: Error retrieving file: 500 Internal error
12011:
12012: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
12013: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
12014: Successfully retrieved file.
12015: </pre>
12016:
1.14 xtraeme 12017: <p>Generate the checksum of the distfile into <code class=
12018: "filename">distinfo</code>:</p>
1.1 grant 12019: <pre class="screen">
1.14 xtraeme 12020: <code class="prompt">#</code> <strong class=
12021: "userinput"><code>make makesum</code></strong>
1.1 grant 12022: </pre>
12023:
12024: <p>Now compile:</p>
12025: <pre class="screen">
1.14 xtraeme 12026: <code class="prompt">#</code> <strong class=
12027: "userinput"><code>make</code></strong>
1.1 grant 12028: >> Checksum OK for bison-1.25.tar.gz.
12029: ===> Extracting for bison-1.25
12030: ===> Patching for bison-1.25
12031: ===> Ignoring empty patch directory
12032: ===> Configuring for bison-1.25
12033: creating cache ./config.cache
12034: checking for gcc... cc
12035: checking whether we are using GNU C... yes
12036: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
12037: checking how to run the C preprocessor... cc -E
12038: checking for minix/config.h... no
12039: checking for POSIXized ISC... no
12040: checking whether cross-compiling... no
12041: checking for ANSI C header files... yes
12042: checking for string.h... yes
12043: checking for stdlib.h... yes
12044: checking for memory.h... yes
12045: checking for working const... yes
12046: checking for working alloca.h... no
12047: checking for alloca... yes
12048: checking for strerror... yes
12049: updating cache ./config.cache
12050: creating ./config.status
12051: creating Makefile
12052: ===> Building for bison-1.25
12053: 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
12054: 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
12055: 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
12056: 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
12057: 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
12058: 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
12059: 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
12060: 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
12061: 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
12062: 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
12063: 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
12064: 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
12065: 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
12066: 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
12067: 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
12068: 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
12069: 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
12070: 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
12071: 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
12072: 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
12073: 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
12074: 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
12075: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
12076: rm -f bison.s1
12077: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
12078: </pre>
12079:
12080: <p>Everything seems OK, so install the files:</p>
12081: <pre class="screen">
1.14 xtraeme 12082: <code class="prompt">#</code> <strong class=
12083: "userinput"><code>make install</code></strong>
1.1 grant 12084: >> Checksum OK for bison-1.25.tar.gz.
12085: ===> Installing for bison-1.25
12086: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
12087: rm -f /usr/pkg/bin/bison
12088: cd /usr/pkg/share; rm -f bison.simple bison.hairy
12089: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
12090: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
12091: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
12092: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
12093: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
12094: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
12095: ===> Registering installation for bison-1.25
12096: </pre>
12097:
12098: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 12099: remove it with <span><strong class="command">pkg_delete
12100: bison</strong></span>. Should you decide that you want a
12101: binary package, do this now:</p>
1.1 grant 12102: <pre class="screen">
1.14 xtraeme 12103: <code class="prompt">#</code> <strong class=
12104: "userinput"><code>make package</code></strong>
1.1 grant 12105: >> Checksum OK for bison-1.25.tar.gz.
12106: ===> Building package for bison-1.25
12107: Creating package bison-1.25.tgz
12108: Registering depends:.
12109: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
12110: </pre>
12111:
12112: <p>Now that you don't need the source and object files any
12113: more, clean up:</p>
12114: <pre class="screen">
1.14 xtraeme 12115: <code class="prompt">#</code> <strong class=
12116: "userinput"><code>make clean</code></strong>
1.1 grant 12117: ===> Cleaning for bison-1.25
12118: </pre>
12119: </div>
12120: </div>
12121:
12122: <div class="appendix" lang="en" xml:lang="en">
12123: <div class="titlepage">
12124: <div>
12125: <div>
12126: <h2 class="title"><a name="logs" id=
12127: "logs"></a>Appendix B. Build logs</h2>
12128: </div>
12129: </div>
12130: </div>
12131:
12132: <div class="toc">
12133: <p><b>Table of Contents</b></p>
12134:
12135: <dl>
12136: <dt><span class="sect1"><a href="#logs.building">B.1.
12137: Building figlet</a></span></dt>
12138:
12139: <dt><span class="sect1"><a href="#logs.package">B.2.
12140: Packaging figlet</a></span></dt>
12141: </dl>
12142: </div>
12143:
12144: <div class="sect1" lang="en" xml:lang="en">
12145: <div class="titlepage">
12146: <div>
12147: <div>
12148: <h2 class="title" style="clear: both"><a name=
12149: "logs.building" id=
12150: "logs.building"></a>B.1. Building figlet</h2>
12151: </div>
12152: </div>
12153: </div>
12154: <pre class="screen">
1.14 xtraeme 12155: <code class="prompt">#</code> <strong class=
12156: "userinput"><code>make</code></strong>
1.1 grant 12157: ===> Checking for vulnerabilities in figlet-2.2.1nb2
12158: => figlet221.tar.gz doesn't seem to exist on this system.
12159: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
12160: => [172219 bytes]
12161: Connected to ftp.plig.net.
12162: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
12163: 331 Guest login ok, send your complete e-mail address as password.
12164: 230-You are user #5 of 500 simultaneous users allowed.
12165: 230-
12166: 230- ___ _ _ _
12167: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
12168: 230- | _| _| . |_| . | | | . |_| . | _| . |
12169: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
12170: 230- |_| |_| |___| |___|
12171: 230-
12172: 230-** Welcome to ftp.plig.org **
12173: 230-
12174: 230-Please note that all transfers from this FTP site are logged. If you
12175: 230-do not like this, please disconnect now.
12176: 230-
12177: 230-This arhive is available via
12178: 230-
12179: 230-HTTP: http://ftp.plig.org/
12180: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
12181: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
12182: 230-
12183: 230-Please email comments, bug reports and requests for packages to be
12184: 230-mirrored to ftp-admin@plig.org.
12185: 230-
12186: 230-
12187: 230 Logged in anonymously.
12188: Remote system type is UNIX.
12189: Using binary mode to transfer files.
12190: 200 Type okay.
12191: 250 "/pub" is new cwd.
12192: 250-"/pub/figlet" is new cwd.
12193: 250-
12194: 250-Welcome to the figlet archive at ftp.figlet.org
12195: 250-
12196: 250- ftp://ftp.figlet.org/pub/figlet/
12197: 250-
12198: 250-The official FIGlet web page is:
12199: 250- http://www.figlet.org/
12200: 250-
12201: 250-If you have questions, please mailto:info@figlet.org. If you want to
12202: 250-contribute a font or something else, you can email us.
12203: 250
12204: 250 "/pub/figlet/program" is new cwd.
12205: 250 "/pub/figlet/program/unix" is new cwd.
12206: local: figlet221.tar.gz remote: figlet221.tar.gz
12207: 502 Unimplemented command.
12208: 227 Entering Passive Mode (195,40,6,41,246,104)
12209: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
12210: 38% |************** | 65800 64.16 KB/s 00:01 ETA
12211: 226 Transfer completed.
12212: 172219 bytes received in 00:02 (75.99 KB/s)
12213: 221 Goodbye.
12214: => Checksum OK for figlet221.tar.gz.
12215: ===> Extracting for figlet-2.2.1nb2
12216: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
12217: ===> Patching for figlet-2.2.1nb2
12218: ===> Applying pkgsrc patches for figlet-2.2.1nb2
12219: ===> Overriding tools for figlet-2.2.1nb2
12220: ===> Creating toolchain wrappers for figlet-2.2.1nb2
12221: ===> Configuring for figlet-2.2.1nb2
12222: ===> Building for figlet-2.2.1nb2
12223: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
12224: chmod a+x figlet
12225: gcc -O2 -o chkfont chkfont.c
12226: => Unwrapping files-to-be-installed.
1.14 xtraeme 12227: <code class="prompt">#</code>
12228: <code class="prompt">#</code> <strong class=
12229: "userinput"><code>make install</code></strong>
1.1 grant 12230: ===> Checking for vulnerabilities in figlet-2.2.1nb2
12231: ===> Installing for figlet-2.2.1nb2
12232: install -d -o root -g wheel -m 755 /usr/pkg/bin
12233: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
12234: mkdir -p /usr/pkg/share/figlet
12235: cp figlet /usr/pkg/bin
12236: cp chkfont /usr/pkg/bin
12237: chmod 555 figlist showfigfonts
12238: cp figlist /usr/pkg/bin
12239: cp showfigfonts /usr/pkg/bin
12240: cp fonts/*.flf /usr/pkg/share/figlet
12241: cp fonts/*.flc /usr/pkg/share/figlet
12242: cp figlet.6 /usr/pkg/man/man6
12243: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 12244: <code class="prompt">#</code>
1.1 grant 12245: </pre>
12246: </div>
12247:
12248: <div class="sect1" lang="en" xml:lang="en">
12249: <div class="titlepage">
12250: <div>
12251: <div>
12252: <h2 class="title" style="clear: both"><a name=
12253: "logs.package" id=
12254: "logs.package"></a>B.2. Packaging figlet</h2>
12255: </div>
12256: </div>
12257: </div>
12258: <pre class="screen">
1.14 xtraeme 12259: <code class="prompt">#</code> <strong class=
12260: "userinput"><code>make package</code></strong>
1.1 grant 12261: ===> Checking for vulnerabilities in figlet-2.2.1nb2
12262: ===> Packaging figlet-2.2.1nb2
12263: ===> Building binary package for figlet-2.2.1nb2
12264: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
12265: Using SrcDir value of /usr/pkg
12266: Registering depends:.
1.14 xtraeme 12267: <code class="prompt">#</code>
1.1 grant 12268: </pre>
12269: </div>
12270: </div>
12271:
12272: <div class="appendix" lang="en" xml:lang="en">
12273: <div class="titlepage">
12274: <div>
12275: <div>
12276: <h2 class="title"><a name="ftp-layout" id=
12277: "ftp-layout"></a>Appendix C. Layout of the
12278: FTP server's package archive</h2>
12279: </div>
12280: </div>
12281: </div>
12282:
12283: <p>Layout for precompiled binary packages on
12284: ftp.NetBSD.org:</p>
12285: <pre class="programlisting">
12286: /pub/NetBSD/packages/
12287: distfiles/
12288:
12289: # Unpacked pkgsrc trees
12290: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
12291: pkgsrc-2003Q4 -> N/A
12292: pkgsrc-2004Q1/pkgsrc
12293:
12294: # pkgsrc archives
12295: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
12296: pkgsrc-2003Q4.tar.gz -> N/A
12297: pkgsrc-2004Q1.tar.gz -> N/A
12298:
12299: # Per pkgsrc-release/OS-release/arch package archives
12300: pkgsrc-2003Q4/
12301: NetBSD-1.6.2/
12302: i386/
12303: All/
12304: archivers/
12305: foo -> ../All/foo
12306: ...
12307: pkgsrc-2004Q1/
12308: NetBSD-1.6.2/
12309: i386/
12310: All/
12311: ...
12312: NetBSD-2.0/
12313: i386/
12314: All/
12315: ...
12316: SunOS-5.9/
12317: sparc/
12318: All/
12319: ...
12320: x86/
12321: All/
12322: ...
12323:
12324: # Per os-release package archive convenience links
12325: NetBSD-1.6.2 -> 1.6.2
12326: 1.6.2/
12327: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
12328: m68k/
12329: All/
12330: archivers/
12331: foo -> ../All/foo
12332: ...
12333: amiga -> m68k
12334: atari -> m68k
12335: ...
12336:
12337: 2.0 -> NetBSD-2.0 # backward compat, historic
12338: NetBSD-2.0/
12339: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
12340: SunOS-5.9/
12341: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
12342: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
12343:
12344: </pre>
12345:
12346: <p>To create:</p>
12347:
12348: <div class="orderedlist">
12349: <ol type="1">
12350: <li>
12351: <p>Run bulk build, see <a href="#bulkbuild" title=
12352: "5.3. Doing a bulk build of all packages">Section
12353: 5.3, “Doing a bulk build of all
12354: packages”</a></p>
12355: </li>
12356:
12357: <li>
12358: <p>Upload /usr/pkgsrc/packages to</p>
12359: <pre class="programlisting">
12360: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13 hubertf 12361: pkgsrc-2004Q4/\ # pkgsrc-branch
1.1 grant 12362: `uname -s`-`uname -r`/ # OS & version
12363: `uname -p` # architecture
12364:
12365: </pre>
12366: </li>
12367:
12368: <li>
1.14 xtraeme 12369: <p>If necessary, create a symlink <span><strong class=
12370: "command">ln -s `uname -m` `uname -p`</strong></span>
12371: (amiga -> m68k, ...)</p>
1.1 grant 12372: </li>
12373: </ol>
12374: </div>
12375: </div>
1.2 hubertf 12376:
12377: <div class="appendix" lang="en" xml:lang="en">
12378: <div class="titlepage">
12379: <div>
12380: <div>
12381: <h2 class="title"><a name="editing" id=
12382: "editing"></a>Appendix D. Editing guidelines
12383: for the pkgsrc guide</h2>
12384: </div>
12385: </div>
12386: </div>
12387:
12388: <div class="toc">
12389: <p><b>Table of Contents</b></p>
12390:
12391: <dl>
1.30 wiz 12392: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 12393: Targets</a></span></dt>
12394:
1.30 wiz 12395: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 12396: Procedure</a></span></dt>
12397: </dl>
12398: </div>
12399:
12400: <p>This section contains information on editing the pkgsrc
12401: guide itself.</p>
12402:
12403: <div class="sect1" lang="en" xml:lang="en">
12404: <div class="titlepage">
12405: <div>
12406: <div>
12407: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12408: "targets" id="targets"></a>D.1. Targets</h2>
1.2 hubertf 12409: </div>
12410: </div>
12411: </div>
12412:
1.14 xtraeme 12413: <p>The pkgsrc guide's source code is stored in <code class=
12414: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 12415: are created from it:</p>
12416:
12417: <div class="itemizedlist">
12418: <ul type="disc">
12419: <li>
1.14 xtraeme 12420: <p><code class=
1.23 wiz 12421: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 12422: </li>
12423:
12424: <li>
1.14 xtraeme 12425: <p><code class=
12426: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 12427: </li>
12428:
12429: <li>
1.14 xtraeme 12430: <p><code class=
12431: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 12432: the documentation on the NetBSD website will be built
12433: from pkgsrc and kept up to date on the web server
12434: itself. This means you <span class=
12435: "emphasis"><em>must</em></span> make sure that your
12436: changes haven't broken the build!</p>
12437: </li>
1.6 hubertf 12438:
12439: <li>
1.14 xtraeme 12440: <p><code class=
12441: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 12442: PDF version of the pkgsrc guide.</p>
12443: </li>
12444:
12445: <li>
1.14 xtraeme 12446: <p><code class=
12447: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 12448: PostScript version of the pkgsrc guide.</p>
12449: </li>
1.2 hubertf 12450: </ul>
12451: </div>
12452: </div>
12453:
12454: <div class="sect1" lang="en" xml:lang="en">
12455: <div class="titlepage">
12456: <div>
12457: <div>
12458: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12459: "procedure" id=
12460: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 12461: </div>
12462: </div>
12463: </div>
12464:
12465: <p>The procedure to edit the pkgsrc guide is:</p>
12466:
12467: <div class="itemizedlist">
12468: <ul type="disc">
12469: <li>
1.6 hubertf 12470: <p>Make sure you have the packages needed to
12471: re-generate the pkgsrc guide (and other XML-based
12472: NetBSD documentation) installed. These are
1.11 ben 12473: “<span class="quote">netbsd-doc</span>”
1.6 hubertf 12474: for creating the ASCII- and HTML-version, and
12475: “<span class=
1.11 ben 12476: "quote">netbsd-doc-print</span>”for the
1.6 hubertf 12477: PostScript- and PDF version. You will need both
12478: packages installed, to make sure documentation is
12479: consistent across all formats. The packages can be
1.14 xtraeme 12480: found in <code class=
12481: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
12482: <code class=
12483: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 12484: </li>
12485:
12486: <li>
1.14 xtraeme 12487: <p>Edit the XML file(s) in <code class=
12488: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 12489: </li>
12490:
12491: <li>
1.14 xtraeme 12492: <p>Run <span><strong class="command">make extract
12493: && make do-lint</strong></span> in
12494: <code class="filename">pkgsrc/doc/guide</code> to
12495: check the XML syntax, and fix it if needed.</p>
1.4 hubertf 12496: </li>
12497:
12498: <li>
1.14 xtraeme 12499: <p>Run <span><strong class=
12500: "command">make</strong></span> in <code class=
12501: "filename">pkgsrc/doc/guide</code> to build the HTML
12502: and ASCII version.</p>
1.2 hubertf 12503: </li>
12504:
12505: <li>
1.14 xtraeme 12506: <p>If all is well, run <span><strong class=
12507: "command">make install-doc</strong></span> to put the
12508: generated files into <code class=
12509: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 12510: </li>
12511:
12512: <li>
1.14 xtraeme 12513: <p><span><strong class="command">cvs commit
12514: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 12515: </li>
12516:
12517: <li>
1.14 xtraeme 12518: <p><span><strong class="command">cvs commit -m
12519: re-generate
12520: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 12521: </li>
1.4 hubertf 12522:
12523: <li>
12524: <p>Until the webserver on www.NetBSD.org is really
12525: updated automatically to pick up changes to the
1.14 xtraeme 12526: pkgsrc guide automatically, also run
1.18 xtraeme 12527: <span><strong class="command">make install-htdocs
1.14 xtraeme 12528: HTDOCSDIR=../../../htdocs</strong></span> (or
12529: similar, adjust <code class=
12530: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 12531: </li>
12532:
12533: <li>
1.14 xtraeme 12534: <p><span><strong class="command">cvs commit
12535: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 12536: </li>
1.2 hubertf 12537: </ul>
12538: </div>
12539: </div>
12540: </div>
1.1 grant 12541: </div>
12542: </body>
12543: </html>
CVSweb <webmaster@jp.NetBSD.org>