Annotation of pkgsrc/doc/pkgsrc.html, revision 1.32
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
4359: conditions. Please see <a href=
4360: "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.20 ben 4361: target="_top">this message</a> for more details.</p>
1.14 xtraeme 4362: </div>
4363:
4364: <div class="sect1" lang="en" xml:lang="en">
4365: <div class="titlepage">
4366: <div>
4367: <div>
4368: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4369: "resume-transfers" id=
4370: "resume-transfers"></a>6.5. How to resume
4371: transfers when fetching distfiles?</h2>
1.14 xtraeme 4372: </div>
4373: </div>
4374: </div>
4375:
1.15 xtraeme 4376: <p>By default resuming transfers in pkgsrc is disabled,
4377: but you can enable this feature by adding the option
4378: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
4379: into <code class="filename">/etc/mk.conf</code>. If,
4380: during a fetch step, an incomplete distfile is found,
4381: pkgsrc will try to resume it.</p>
4382:
4383: <p>You can also use a different program than the default
1.24 wiz 4384: <a href=
4385: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
4386: <span class="citerefentry"><span class=
4387: "refentrytitle">ftp</span>(1)</span></a> by changing the
4388: <code class="varname">FETCH_CMD</code> variable. Don't
4389: forget to set <code class=
4390: "varname">FETCH_RESUME_ARGS</code> and <code class=
4391: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
4392: default values.</p>
1.14 xtraeme 4393:
4394: <p>For example, if you want to use <code class=
4395: "filename">wget</code> to resume downloads, you'll have
4396: to use something like:</p>
4397: <pre class="programlisting">
4398: FETCH_CMD=wget
4399: FETCH_BEFORE_ARGS=--passive-ftp
4400: FETCH_RESUME_ARGS=-c
4401: FETCH_OUTPUT_ARGS=-O
4402:
4403: </pre>
1.1 grant 4404: </div>
4405:
4406: <div class="sect1" lang="en" xml:lang="en">
4407: <div class="titlepage">
4408: <div>
4409: <div>
4410: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4411: "XFree86-from-pkgsrc" id=
4412: "XFree86-from-pkgsrc"></a>6.6. How can I
1.1 grant 4413: install/use XFree86 from pkgsrc?</h2>
4414: </div>
4415: </div>
4416: </div>
4417:
4418: <p>If you want to use XFree86 from pkgsrc instead of your
1.14 xtraeme 4419: system's own X11 (<code class=
4420: "filename">/usr/X11R6</code>, <code class=
4421: "filename">/usr/openwin</code>, ...), you will have to
4422: add the following line into <code class=
1.15 xtraeme 4423: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4424: <pre class="programlisting">
4425: X11_TYPE=XFree86
4426:
4427: </pre>
4428: </div>
4429:
4430: <div class="sect1" lang="en" xml:lang="en">
4431: <div class="titlepage">
4432: <div>
4433: <div>
4434: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4435: "x.org-from-pkgsrc" id=
4436: "x.org-from-pkgsrc"></a>6.7. How can I
1.1 grant 4437: install/use X.org from pkgsrc?</h2>
4438: </div>
4439: </div>
4440: </div>
4441:
4442: <p>If you want to use X.org from pkgsrc instead of your
1.14 xtraeme 4443: system's own X11 (<code class=
4444: "filename">/usr/X11R6</code>, <code class=
4445: "filename">/usr/openwin</code>, ...) you will have to add
4446: the following line into <code class=
1.15 xtraeme 4447: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4448: <pre class="programlisting">
4449: X11_TYPE=xorg
4450:
4451: </pre>
4452: </div>
4453:
4454: <div class="sect1" lang="en" xml:lang="en">
4455: <div class="titlepage">
4456: <div>
4457: <div>
4458: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4459: "fetch-behind-firewall" id=
4460: "fetch-behind-firewall"></a>6.8. How to fetch
4461: files from behind a firewall</h2>
1.1 grant 4462: </div>
4463: </div>
4464: </div>
4465:
4466: <p>If you are sitting behind a firewall which does not
4467: allow direct connections to Internet hosts (i.e.
4468: non-NAT), you may specify the relevant proxy hosts. This
4469: is done using an environment variable in the form of a
4470: URL e.g. in Amdahl, the machine “<span class=
4471: "quote">orpheus.amdahl.com</span>” is one of the
4472: firewalls, and it uses port 80 as the proxy port number.
4473: So the proxy environment variables are:</p>
4474: <pre class="programlisting">
4475: ftp_proxy=ftp://orpheus.amdahl.com:80/
4476: http_proxy=http://orpheus.amdahl.com:80/
4477: </pre>
4478: </div>
4479:
4480: <div class="sect1" lang="en" xml:lang="en">
4481: <div class="titlepage">
4482: <div>
4483: <div>
4484: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4485: "passive-ftp" id="passive-ftp"></a>6.9. How do
4486: I tell <span><strong class="command">make
1.14 xtraeme 4487: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 4488: </div>
4489: </div>
4490: </div>
4491:
4492: <p>This depends on which utility is used to retrieve
1.14 xtraeme 4493: distfiles. From <code class="filename">bsd.pkg.mk</code>,
4494: <code class="varname">FETCH_CMD</code> is assigned the
4495: first available command from the following list:</p>
1.1 grant 4496: <pre class="programlisting">
4497: ${LOCALBASE}/bin/ftp
4498: /usr/bin/ftp
4499: </pre>
4500:
4501: <p>On a default NetBSD installation, this will be
1.14 xtraeme 4502: <code class="filename">/usr/bin/ftp</code>, which
1.1 grant 4503: automatically tries passive connections first, and falls
4504: back to active connections if the server refuses to do
4505: passive. For the other tools, add the following to your
1.14 xtraeme 4506: <code class="filename">/etc/mk.conf</code> file:
4507: <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 4508:
1.14 xtraeme 4509: <p>Having that option present will prevent <code class=
4510: "filename">/usr/bin/ftp</code> from falling back to
4511: active transfers.</p>
1.1 grant 4512: </div>
4513:
4514: <div class="sect1" lang="en" xml:lang="en">
4515: <div class="titlepage">
4516: <div>
4517: <div>
4518: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4519: "fetching-all-distfiles" id=
4520: "fetching-all-distfiles"></a>6.10. How to
1.1 grant 4521: fetch all distfiles at once</h2>
4522: </div>
4523: </div>
4524: </div>
4525:
4526: <p>You would like to download all the distfiles in a
4527: single batch from work or university, where you can't run
1.14 xtraeme 4528: a <span><strong class="command">make
4529: fetch</strong></span>. There is an archive of distfiles
4530: on <a href=
1.1 grant 4531: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
4532: target="_top">ftp.NetBSD.org</a>, but downloading the
4533: entire directory may not be appropriate.</p>
4534:
1.14 xtraeme 4535: <p>The answer here is to do a <span><strong class=
4536: "command">make fetch-list</strong></span> in <code class=
4537: "filename">/usr/pkgsrc</code> or one of it's
1.1 grant 4538: subdirectories, carry the resulting list to your machine
1.23 wiz 4539: at work/school and use it there. If you don't have a
1.24 wiz 4540: NetBSD-compatible <a href=
4541: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
4542: <span class="citerefentry"><span class=
4543: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
4544: at work, don't forget to set <code class=
4545: "varname">FETCH_CMD</code> to something that fetches a
4546: URL:</p>
1.1 grant 4547:
4548: <p>At home:</p>
4549: <pre class="screen">
1.14 xtraeme 4550: <code class="prompt">%</code> <strong class=
4551: "userinput"><code>cd /usr/pkgsrc</code></strong>
4552: <code class="prompt">%</code> <strong class=
4553: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
4554: <code class="prompt">%</code> <strong class=
4555: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 4556: </pre>
4557:
4558: <p>At work:</p>
4559: <pre class="screen">
1.14 xtraeme 4560: <code class="prompt">%</code> <strong class=
4561: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 4562: </pre>
4563:
1.14 xtraeme 4564: <p>then tar up <code class=
4565: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 4566:
4567: <p>If you have a machine running NetBSD, and you want to
4568: get <span class="emphasis"><em>all</em></span> distfiles
4569: (even ones that aren't for your machine architecture),
4570: you can do so by using the above-mentioned
1.14 xtraeme 4571: <span><strong class="command">make
4572: fetch-list</strong></span> approach, or fetch the
4573: distfiles directly by running:</p>
1.1 grant 4574: <pre class="screen">
1.14 xtraeme 4575: <code class="prompt">%</code> <strong class=
4576: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 4577: </pre>
4578:
1.14 xtraeme 4579: <p>If you even decide to ignore <code class=
4580: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
4581: can get everything by running:</p>
1.1 grant 4582: <pre class="screen">
1.14 xtraeme 4583: <code class="prompt">%</code> <strong class=
4584: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 4585: </pre>
4586: </div>
4587:
4588: <div class="sect1" lang="en" xml:lang="en">
4589: <div class="titlepage">
4590: <div>
4591: <div>
4592: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4593: "tmac.andoc-missing" id=
4594: "tmac.andoc-missing"></a>6.11. What does
1.1 grant 4595: “<span class="quote">Don't know how to make
4596: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
4597: </div>
4598: </div>
4599: </div>
4600:
4601: <p>When compiling the <a xmlns=
4602: "http://www.w3.org/TR/xhtml1/transitional" href=
4603: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4604: class="pkgname">pkgtools/pkg_install</a> package, you get
4605: the error from make that it doesn't know how to make
4606: <code class="filename">/usr/share/tmac/tmac.andoc</code>?
4607: This indicates that you don't have installed the
1.23 wiz 4608: “<span class="quote">text</span>” set (nroff,
4609: ...) from the NetBSD base distribution on your machine.
4610: It is recommended to do that to format manpages.</p>
1.1 grant 4611:
4612: <p>In the case of the <a xmlns=
4613: "http://www.w3.org/TR/xhtml1/transitional" href=
4614: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4615: class="pkgname">pkgtools/pkg_install</a> package, you can
4616: get away with setting <code class=
4617: "varname">NOMAN=YES</code> either in the environment or
4618: in <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 4619: </div>
4620:
4621: <div class="sect1" lang="en" xml:lang="en">
4622: <div class="titlepage">
4623: <div>
4624: <div>
4625: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4626: "bsd.own.mk-missing" id=
4627: "bsd.own.mk-missing"></a>6.12. What does
1.1 grant 4628: “<span class="quote">Could not find
4629: bsd.own.mk</span>” mean?</h2>
4630: </div>
4631: </div>
4632: </div>
4633:
1.14 xtraeme 4634: <p>You didn't install the compiler set, <code class=
4635: "filename">comp.tgz</code>, when you installed your
4636: NetBSD machine. Please get it and install it, by
4637: extracting it in <code class="filename">/</code>:</p>
1.1 grant 4638: <pre class="screen">
1.14 xtraeme 4639: <code class="prompt">#</code> <strong class=
4640: "userinput"><code>cd /</code></strong>
4641: <code class="prompt">#</code> <strong class=
4642: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 4643: </pre>
4644:
1.14 xtraeme 4645: <p><code class="filename">comp.tgz</code> is part of
4646: every NetBSD release. Get the one that corresponds to
4647: your release (determine via <span><strong class=
4648: "command">uname -r</strong></span>).</p>
1.1 grant 4649: </div>
4650:
4651: <div class="sect1" lang="en" xml:lang="en">
4652: <div class="titlepage">
4653: <div>
4654: <div>
4655: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4656: "using-sudo-with-pkgsrc" id=
4657: "using-sudo-with-pkgsrc"></a>6.13. Using
1.1 grant 4658: 'sudo' with pkgsrc</h2>
4659: </div>
4660: </div>
4661: </div>
4662:
4663: <p>When installing packages as non-root user and using
1.24 wiz 4664: the just-in-time <a href=
4665: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
4666: <span class="citerefentry"><span class=
4667: "refentrytitle">su</span>(1)</span></a> feature of
4668: pkgsrc, it can become annoying to type in the root
4669: password for each required package installed. To avoid
4670: this, the sudo package can be used, which does password
4671: caching over a limited time. To use it, install sudo
4672: (either as binary package or from <a xmlns=
4673: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4674: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.20 ben 4675: class="pkgname">security/sudo</a>) and then put the
4676: following into your <code class=
4677: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4678: <pre class="programlisting">
1.23 wiz 4679: .if exists(${LOCALBASE}/bin/sudo)
4680: SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
1.1 grant 4681: .endif
4682:
4683: </pre>
4684: </div>
4685:
4686: <div class="sect1" lang="en" xml:lang="en">
4687: <div class="titlepage">
4688: <div>
4689: <div>
4690: <h2 class="title" style="clear: both"><a name=
4691: "faq.conf" id=
1.14 xtraeme 4692: "faq.conf"></a>6.14. Configuration files
1.1 grant 4693: handling and placement</h2>
4694: </div>
4695: </div>
4696: </div>
4697:
1.14 xtraeme 4698: <p>The global variable <code class=
4699: "varname">PKG_SYSCONFBASE</code> (and some others) can be
4700: set by the system administrator in <code class=
4701: "filename">/etc/mk.conf</code> to define the place where
1.1 grant 4702: configuration files get installed. Therefore, packages
4703: must be adapted to support this feature. Keep in mind
4704: that you should only install files that are strictly
4705: necessary in the configuration directory, files that can
1.14 xtraeme 4706: go to <code class="filename">$PREFIX/share</code> should
4707: go there.</p>
1.1 grant 4708:
4709: <p>We will take a look at available variables first
1.14 xtraeme 4710: (<code class="filename">bsd.pkg.mk</code> contains more
4711: information). <code class="varname">PKG_SYSCONFDIR</code>
4712: is where the configuration files for a package may be
4713: found (that is, the full path, e.g. <code class=
4714: "filename">/etc</code> or <code class=
4715: "filename">/usr/pkg/etc</code>). This value may be
1.1 grant 4716: customized in various ways:</p>
4717:
4718: <div class="orderedlist">
4719: <ol type="1">
4720: <li>
1.14 xtraeme 4721: <p><code class="varname">PKG_SYSCONFBASE</code> is
4722: the main config directory under which all package
1.1 grant 4723: configuration files are to be found. Users will
1.14 xtraeme 4724: typically want to set it to <code class=
4725: "filename">/etc</code>, or accept the default
4726: location of <code class=
4727: "filename">$PREFIX/etc</code>.</p>
1.1 grant 4728: </li>
4729:
4730: <li>
1.14 xtraeme 4731: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
4732: is the subdirectory of <code class=
4733: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 4734: configuration files for a particular package may be
1.14 xtraeme 4735: found. Defaults to <code class=
4736: "varname">${SYSCONFBASE}</code>.</p>
1.1 grant 4737: </li>
4738:
4739: <li>
1.14 xtraeme 4740: <p><code class="varname">PKG_SYSCONFVAR</code> is
4741: the special suffix used to distinguish any
4742: overriding values for a particular package (see
4743: next item). It defaults to <code class=
4744: "varname">${PKGBASE}</code>, but for a collection
4745: of related packages that should all have the same
4746: <code class="varname">PKG_SYSCONFDIR</code> value,
4747: it can be set in each of the package Makefiles to a
4748: common value.</p>
1.1 grant 4749: </li>
4750:
4751: <li>
1.14 xtraeme 4752: <p><code class=
4753: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
4754: overrides the value of <code class=
4755: "varname">${PKG_SYSCONFDIR}</code> for packages
4756: with the same value for <code class=
4757: "varname">PKG_SYSCONFVAR</code>.</p>
1.1 grant 4758:
4759: <p>As an example, all the various KDE packages may
1.14 xtraeme 4760: want to set <code class=
4761: "varname">PKG_SYSCONFVAR</code> to
4762: “<span class="quote">kde</span>” so
4763: admins can set <code class=
4764: "varname">PKG_SYSCONFDIR.kde</code> in <code class=
4765: "filename">/etc/mk.conf</code> to define where to
1.1 grant 4766: install KDE config files.</p>
4767: </li>
4768: </ol>
4769: </div>
4770:
4771: <p>Programs' configuration directory should be defined
4772: during the configure stage. Packages that use GNU
4773: autoconf can usually do this by using the
4774: “<span class="quote">--sysconfdir</span>”
4775: parameter, but this brings some problems as we will see
4776: now. When you change this pathname in packages, you
4777: should not allow them to install files in that directory
4778: directly. Instead they need to install those files under
1.14 xtraeme 4779: <code class="filename">share/examples/${PKGNAME}</code>
4780: so <code class="filename">PLIST</code> can register
4781: them.</p>
1.1 grant 4782:
4783: <p>Once you have the required configuration files in
1.14 xtraeme 4784: place (under the <code class=
4785: "filename">share/examples</code> directory) the variable
4786: <code class="varname">CONF_FILES</code> should be set to
4787: copy them into <code class=
4788: "varname">PKG_SYSCONFDIR</code>. The contents of this
4789: variable is formed by pairs of filenames; the first
1.1 grant 4790: element of the pair specifies the file inside the
1.14 xtraeme 4791: examples directory (registered by <code class=
4792: "filename">PLIST</code>) and the second element specifies
1.1 grant 4793: the target file. This is done this way to allow binary
4794: packages to place files in the right directory using
1.14 xtraeme 4795: <code class="filename">INSTALL</code>/<code class=
4796: "filename">DEINSTALL</code> scripts which are created
4797: automatically. The package <code class=
4798: "filename">Makefile</code> must also set <code class=
4799: "varname">USE_PKGINSTALL=YES</code> to use these
1.1 grant 4800: automatically generated scripts. The automatic copying of
4801: config files can be toggled by setting the environment
1.14 xtraeme 4802: variable <code class="varname">PKG_CONFIG</code> prior to
1.1 grant 4803: package installation.</p>
4804:
4805: <p>Here is an example, taken from mail/mutt/Makefile:</p>
4806: <pre class="programlisting">
4807: EGDIR= ${PREFIX}/share/doc/mutt/samples
4808: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
4809: </pre>
4810:
4811: <p>As you can see, this package installs configuration
1.14 xtraeme 4812: files inside <code class="varname">EGDIR</code>, which
4813: are registered by <code class="filename">PLIST</code>.
4814: After that, the variable <code class=
4815: "varname">CONF_FILES</code> lists the installed file
4816: first and then the target file. Users will also get an
4817: automatic message when files are installed using this
4818: method.</p>
1.1 grant 4819: </div>
4820:
4821: <div class="sect1" lang="en" xml:lang="en">
4822: <div class="titlepage">
4823: <div>
4824: <div>
4825: <h2 class="title" style="clear: both"><a name=
4826: "audit-packages" id=
1.14 xtraeme 4827: "audit-packages"></a>6.15. Automated security
1.1 grant 4828: checks</h2>
4829: </div>
4830: </div>
4831: </div>
4832:
4833: <p>Please be aware that there can often be bugs in
4834: third-party software, and some of these bugs can leave a
4835: machine vulnerable to exploitation by attackers. In an
4836: effort to lessen the exposure, the NetBSD packages team
4837: maintains a database of known-exploits to packages which
4838: have at one time been included in pkgsrc. The database
4839: can be downloaded automatically, and a security audit of
4840: all packages installed on a system can take place. To do
4841: this, install the <a xmlns=
4842: "http://www.w3.org/TR/xhtml1/transitional" href=
4843: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.20 ben 4844: class="pkgname">security/audit-packages</a> package. It
4845: has two components:</p>
1.1 grant 4846:
4847: <div class="orderedlist">
4848: <ol type="1">
4849: <li>
4850: <p>“<span class=
4851: "quote">download-vulnerability-list</span>”,
4852: an easy way to download a list of the security
4853: vulnerabilities information. This list is kept up
4854: to date by the NetBSD security officer and the
4855: NetBSD packages team, and is distributed from the
4856: NetBSD ftp server:</p>
4857:
4858: <p><a href=
4859: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 4860: target=
4861: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 4862: </li>
4863:
4864: <li>
4865: <p>“<span class=
4866: "quote">audit-packages</span>”, an easy way
4867: to audit the current machine, checking each
4868: vulnerability which is known. If a vulnerable
4869: package is installed, it will be shown by output to
4870: stdout, including a description of the type of
4871: vulnerability, and a URL containing more
4872: information.</p>
4873: </li>
4874: </ol>
4875: </div>
4876:
1.23 wiz 4877: <p>Use of the <a xmlns=
4878: "http://www.w3.org/TR/xhtml1/transitional" href=
4879: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
4880: class="pkgname">security/audit-packages</a> package is
4881: strongly recommended! After “<span class=
4882: "quote">audit-packages</span>” is installed, please
4883: read the package's message, which you can get by running
4884: <strong class="userinput"><code>pkg_info -D
4885: audit-package</code></strong>.</p>
1.1 grant 4886: </div>
4887: </div>
4888: </div>
4889:
4890: <div class="part" lang="en" xml:lang="en">
4891: <div class="titlepage">
4892: <div>
4893: <div>
4894: <h1 class="title"><a name="developers-guide" id=
1.2 hubertf 4895: "developers-guide"></a>The pkgsrc developer's
4896: guide</h1>
1.1 grant 4897: </div>
4898: </div>
4899: </div>
4900:
4901: <div class="toc">
4902: <p><b>Table of Contents</b></p>
4903:
4904: <dl>
1.27 rillig 4905: <dt><span class="chapter"><a href="#components">7.
4906: Package components - files, directories and
4907: contents</a></span></dt>
4908:
4909: <dd>
4910: <dl>
4911: <dt><span class="sect1"><a href=
4912: "#components.Makefile">7.1. <code class=
4913: "filename">Makefile</code></a></span></dt>
4914:
4915: <dt><span class="sect1"><a href=
4916: "#components.distinfo">7.2. <code class=
4917: "filename">distinfo</code></a></span></dt>
4918:
4919: <dt><span class="sect1"><a href=
4920: "#components.patches">7.3. patches/*</a></span></dt>
4921:
1.30 wiz 4922: <dt><span class="sect1"><a href=
4923: "#other-mandatory-files">7.4. Other mandatory
4924: files</a></span></dt>
1.27 rillig 4925:
4926: <dt><span class="sect1"><a href=
4927: "#components.optional">7.5. Optional
4928: files</a></span></dt>
4929:
1.30 wiz 4930: <dt><span class="sect1"><a href="#work-dir">7.6.
1.27 rillig 4931: <code class="filename">work*</code></a></span></dt>
4932:
1.30 wiz 4933: <dt><span class="sect1"><a href="#files-dir">7.7.
1.27 rillig 4934: <code class="filename">files/*</code></a></span></dt>
4935: </dl>
4936: </dd>
4937:
4938: <dt><span class="chapter"><a href="#makefile">8.
1.25 rillig 4939: Programming in <code class=
4940: "filename">Makefile</code>s</a></span></dt>
4941:
4942: <dd>
4943: <dl>
4944: <dt><span class="sect1"><a href=
1.27 rillig 4945: "#makefile.variables">8.1. <code class=
1.25 rillig 4946: "filename">Makefile</code> variables</a></span></dt>
4947:
1.27 rillig 4948: <dd>
4949: <dl>
4950: <dt><span class="sect2"><a href=
4951: "#makefile.variables.names">8.1.1. Naming
4952: conventions</a></span></dt>
4953: </dl>
4954: </dd>
4955:
4956: <dt><span class="sect1"><a href="#makefile.code">8.2.
1.25 rillig 4957: Code snippets</a></span></dt>
4958:
4959: <dd>
4960: <dl>
4961: <dt><span class="sect2"><a href=
1.30 wiz 4962: "#adding-to-list">8.2.1. Adding things to a
1.25 rillig 4963: list</a></span></dt>
4964:
4965: <dt><span class="sect2"><a href=
1.30 wiz 4966: "#converting-internal-to-external">8.2.2.
4967: Converting an internal list into an external
4968: list</a></span></dt>
1.25 rillig 4969:
4970: <dt><span class="sect2"><a href=
1.30 wiz 4971: "#passing-variable-to-shell">8.2.3. Passing
4972: variables to a shell command</a></span></dt>
1.27 rillig 4973:
4974: <dt><span class="sect2"><a href=
1.30 wiz 4975: "#quoting-guideline">8.2.4. Quoting
1.27 rillig 4976: guideline</a></span></dt>
4977:
4978: <dt><span class="sect2"><a href=
1.30 wiz 4979: "#bsd-make-bug-workaround">8.2.5. Workaround for
4980: a bug in BSD Make</a></span></dt>
1.25 rillig 4981: </dl>
4982: </dd>
4983: </dl>
4984: </dd>
4985:
4986: <dt><span class="chapter"><a href="#plist">9. PLIST
1.1 grant 4987: issues</a></span></dt>
4988:
4989: <dd>
4990: <dl>
1.30 wiz 4991: <dt><span class="sect1"><a href="#rcs-id">9.1. RCS
1.1 grant 4992: ID</a></span></dt>
4993:
1.30 wiz 4994: <dt><span class="sect1"><a href=
4995: "#automatic-plist-generation">9.2. Semi-automatic
4996: <code class="filename">PLIST</code>
1.14 xtraeme 4997: generation</a></span></dt>
1.1 grant 4998:
1.25 rillig 4999: <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14 xtraeme 5000: Tweaking output of <span><strong class="command">make
5001: print-PLIST</strong></span></a></span></dt>
1.1 grant 5002:
1.25 rillig 5003: <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1 grant 5004: Variable substitution in PLIST</a></span></dt>
5005:
1.30 wiz 5006: <dt><span class="sect1"><a href=
5007: "#manpage-compression">9.5.
1.1 grant 5008: Manpage-compression</a></span></dt>
5009:
1.30 wiz 5010: <dt><span class="sect1"><a href=
5011: "#using-PLIST_SRC">9.6. Changing PLIST source with
5012: <code class=
1.14 xtraeme 5013: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5014:
1.30 wiz 5015: <dt><span class="sect1"><a href=
5016: "#platform-specific-plist">9.7. Platform specific and
5017: differing PLISTs</a></span></dt>
1.1 grant 5018:
5019: <dt><span class="sect1"><a href=
1.25 rillig 5020: "#faq.common-dirs">9.8. Sharing directories between
1.1 grant 5021: packages</a></span></dt>
5022: </dl>
5023: </dd>
5024:
1.25 rillig 5025: <dt><span class="chapter"><a href="#buildlink">10.
1.1 grant 5026: Buildlink methodology</a></span></dt>
5027:
5028: <dd>
5029: <dl>
1.30 wiz 5030: <dt><span class="sect1"><a href=
5031: "#converting-to-buildlink3">10.1. Converting packages
5032: to use buildlink3</a></span></dt>
1.1 grant 5033:
1.30 wiz 5034: <dt><span class="sect1"><a href=
5035: "#creating-buildlink3.mk">10.2. Writing <code class=
5036: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 5037:
5038: <dd>
5039: <dl>
5040: <dt><span class="sect2"><a href=
1.30 wiz 5041: "#anatomy-of-bl3">10.2.1. Anatomy of a
5042: buildlink3.mk file</a></span></dt>
1.1 grant 5043:
5044: <dt><span class="sect2"><a href=
1.30 wiz 5045: "#updating-buildlink-depends">10.2.2. Updating
5046: <code class=
5047: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
5048: <code>pkg</code></em></code> in <code class=
5049: "filename">buildlink3.mk</code>
1.1 grant 5050: files</a></span></dt>
5051: </dl>
5052: </dd>
5053:
1.30 wiz 5054: <dt><span class="sect1"><a href=
5055: "#writing-builtin.mk">10.3. Writing <code class=
5056: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 5057:
5058: <dd>
5059: <dl>
5060: <dt><span class="sect2"><a href=
1.30 wiz 5061: "#anatomy-of-builtin.mk">10.3.1. Anatomy of a
5062: <code class="filename">builtin.mk</code>
5063: file</a></span></dt>
1.1 grant 5064:
5065: <dt><span class="sect2"><a href=
1.30 wiz 5066: "#native-or-pkgsrc-preference">10.3.2. Global
5067: preferences for native or pkgsrc
5068: software</a></span></dt>
1.1 grant 5069: </dl>
5070: </dd>
5071: </dl>
5072: </dd>
5073:
1.25 rillig 5074: <dt><span class="chapter"><a href="#options">11. Options
1.1 grant 5075: handling</a></span></dt>
5076:
5077: <dd>
5078: <dl>
1.30 wiz 5079: <dt><span class="sect1"><a href=
5080: "#global-default-options">11.1. Global default
5081: options</a></span></dt>
1.1 grant 5082:
1.30 wiz 5083: <dt><span class="sect1"><a href=
5084: "#converting-to-options">11.2. Converting packages to
5085: use <code class=
1.14 xtraeme 5086: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 5087: </dl>
5088: </dd>
5089:
1.25 rillig 5090: <dt><span class="chapter"><a href="#build">12. The build
1.1 grant 5091: process</a></span></dt>
5092:
5093: <dd>
5094: <dl>
1.25 rillig 5095: <dt><span class="sect1"><a href="#build.prefix">12.1.
1.1 grant 5096: Program location</a></span></dt>
5097:
1.30 wiz 5098: <dt><span class="sect1"><a href="#main-targets">12.2.
1.1 grant 5099: Main targets</a></span></dt>
5100:
5101: <dt><span class="sect1"><a href=
1.25 rillig 5102: "#build.helpful-targets">12.3. Other helpful
1.1 grant 5103: targets</a></span></dt>
5104: </dl>
5105: </dd>
5106:
1.25 rillig 5107: <dt><span class="chapter"><a href="#fixes">13. Notes on
1.1 grant 5108: fixes for packages</a></span></dt>
5109:
5110: <dd>
5111: <dl>
1.30 wiz 5112: <dt><span class="sect1"><a href=
5113: "#general-operation">13.1. General
5114: operation</a></span></dt>
1.1 grant 5115:
5116: <dd>
5117: <dl>
5118: <dt><span class="sect2"><a href=
1.30 wiz 5119: "#pulling-vars-from-etc-mk.conf">13.1.1. How to
5120: pull in variables from
5121: /etc/mk.conf</a></span></dt>
1.1 grant 5122:
5123: <dt><span class="sect2"><a href=
1.31 wiz 5124: "#where-to-install-documentation">13.1.2. Where
5125: to install documentation</a></span></dt>
5126:
5127: <dt><span class="sect2"><a href=
5128: "#restricted-packages">13.1.3. Restricted
1.1 grant 5129: packages</a></span></dt>
5130:
5131: <dt><span class="sect2"><a href=
1.31 wiz 5132: "#dependencies">13.1.4. Handling
1.1 grant 5133: dependencies</a></span></dt>
5134:
5135: <dt><span class="sect2"><a href=
1.31 wiz 5136: "#conflicts">13.1.5. Handling conflicts with
1.1 grant 5137: other packages</a></span></dt>
5138:
5139: <dt><span class="sect2"><a href=
1.31 wiz 5140: "#not-building-packages">13.1.6. Packages that
1.30 wiz 5141: cannot or should not be built</a></span></dt>
1.1 grant 5142:
5143: <dt><span class="sect2"><a href=
1.31 wiz 5144: "#undeletable-packages">13.1.7. Packages which
1.30 wiz 5145: should not be deleted, once
5146: installed</a></span></dt>
1.1 grant 5147:
5148: <dt><span class="sect2"><a href=
1.31 wiz 5149: "#security-handling">13.1.8. Handling packages
1.1 grant 5150: with security problems</a></span></dt>
5151:
5152: <dt><span class="sect2"><a href=
1.31 wiz 5153: "#compiler-bugs">13.1.9. How to handle compiler
1.1 grant 5154: bugs</a></span></dt>
5155:
5156: <dt><span class="sect2"><a href=
1.31 wiz 5157: "#bumping-pkgrevision">13.1.10. How to handle
1.30 wiz 5158: incrementing versions when fixing an existing
1.1 grant 5159: package</a></span></dt>
5160:
5161: <dt><span class="sect2"><a href=
1.31 wiz 5162: "#portability-of-packages">13.1.11. Portability
1.30 wiz 5163: of packages</a></span></dt>
1.1 grant 5164: </dl>
5165: </dd>
5166:
1.30 wiz 5167: <dt><span class="sect1"><a href=
5168: "#downloading-issues">13.2. Possible downloading
5169: issues</a></span></dt>
1.1 grant 5170:
5171: <dd>
5172: <dl>
5173: <dt><span class="sect2"><a href=
1.30 wiz 5174: "#no-plain-download">13.2.1. Packages whose
5175: distfiles aren't available for plain
1.1 grant 5176: downloading</a></span></dt>
5177:
5178: <dt><span class="sect2"><a href=
1.30 wiz 5179: "#modified-distfiles-same-name">13.2.2. How to
5180: handle modified distfiles with the 'old'
5181: name</a></span></dt>
1.1 grant 5182: </dl>
5183: </dd>
5184:
1.30 wiz 5185: <dt><span class="sect1"><a href=
5186: "#configuration-gotchas">13.3. Configuration
5187: gotchas</a></span></dt>
1.1 grant 5188:
5189: <dd>
5190: <dl>
5191: <dt><span class="sect2"><a href=
1.25 rillig 5192: "#fixes.libtool">13.3.1. Shared libraries -
1.1 grant 5193: libtool</a></span></dt>
5194:
5195: <dt><span class="sect2"><a href=
1.30 wiz 5196: "#using-libtool">13.3.2. Using libtool on GNU
1.1 grant 5197: packages that already support
5198: libtool</a></span></dt>
5199:
5200: <dt><span class="sect2"><a href=
1.30 wiz 5201: "#autoconf-automake">13.3.3. GNU
1.1 grant 5202: Autoconf/Automake</a></span></dt>
5203: </dl>
5204: </dd>
5205:
1.30 wiz 5206: <dt><span class="sect1"><a href=
5207: "#building-considerations">13.4. Building
5208: considerations</a></span></dt>
1.1 grant 5209:
5210: <dd>
5211: <dl>
5212: <dt><span class="sect2"><a href=
1.30 wiz 5213: "#cpp-defines">13.4.1. CPP
5214: defines</a></span></dt>
1.1 grant 5215: </dl>
5216: </dd>
5217:
1.30 wiz 5218: <dt><span class="sect1"><a href=
5219: "#package-specific-actions">13.5. Package specific
5220: actions</a></span></dt>
1.1 grant 5221:
5222: <dd>
5223: <dl>
5224: <dt><span class="sect2"><a href=
1.30 wiz 5225: "#package-configuration-files">13.5.1. Package
5226: configuration files</a></span></dt>
1.1 grant 5227:
5228: <dt><span class="sect2"><a href=
1.30 wiz 5229: "#user-interaction">13.5.2. User
1.2 hubertf 5230: interaction</a></span></dt>
1.1 grant 5231:
5232: <dt><span class="sect2"><a href=
1.30 wiz 5233: "#handling-licenses">13.5.3. Handling
1.1 grant 5234: licenses</a></span></dt>
5235:
5236: <dt><span class="sect2"><a href=
1.30 wiz 5237: "#creating-accounts">13.5.4. Creating an account
5238: from a package</a></span></dt>
1.1 grant 5239:
5240: <dt><span class="sect2"><a href=
1.30 wiz 5241: "#installing-score-files">13.5.5. Installing
5242: score files</a></span></dt>
1.1 grant 5243:
5244: <dt><span class="sect2"><a href=
1.30 wiz 5245: "#login-shells">13.5.6. Packages providing login
1.1 grant 5246: shells</a></span></dt>
5247:
5248: <dt><span class="sect2"><a href=
1.30 wiz 5249: "#perl-scripts">13.5.7. Packages containing perl
1.1 grant 5250: scripts</a></span></dt>
5251:
5252: <dt><span class="sect2"><a href=
1.30 wiz 5253: "#hardcoded-paths">13.5.8. Packages with
5254: hardcoded paths to other
5255: interpreters</a></span></dt>
1.1 grant 5256:
5257: <dt><span class="sect2"><a href=
1.30 wiz 5258: "#perl-modules">13.5.9. Packages installing perl
1.1 grant 5259: modules</a></span></dt>
5260:
5261: <dt><span class="sect2"><a href=
1.25 rillig 5262: "#faq.info-files">13.5.10. Packages installing
1.1 grant 5263: info files</a></span></dt>
5264:
5265: <dt><span class="sect2"><a href=
1.30 wiz 5266: "#gconf2-data-files">13.5.11. Packages installing
5267: GConf2 data files</a></span></dt>
1.1 grant 5268:
5269: <dt><span class="sect2"><a href=
1.30 wiz 5270: "#scrollkeeper-data-files">13.5.12. Packages
5271: installing scrollkeeper data
5272: files</a></span></dt>
1.1 grant 5273:
5274: <dt><span class="sect2"><a href=
1.30 wiz 5275: "#x11-fonts">13.5.13. Packages installing X11
1.1 grant 5276: fonts</a></span></dt>
5277:
5278: <dt><span class="sect2"><a href=
1.30 wiz 5279: "#gtk2-modules">13.5.14. Packages installing GTK2
1.1 grant 5280: modules</a></span></dt>
5281:
5282: <dt><span class="sect2"><a href=
1.30 wiz 5283: "#sgml-xml-data">13.5.15. Packages installing
5284: SGML or XML data</a></span></dt>
1.1 grant 5285:
5286: <dt><span class="sect2"><a href=
1.30 wiz 5287: "#mime-database">13.5.16. Packages installing
1.1 grant 5288: extensions to the MIME database</a></span></dt>
5289:
5290: <dt><span class="sect2"><a href=
1.30 wiz 5291: "#intltool">13.5.17. Packages using
1.1 grant 5292: intltool</a></span></dt>
1.18 xtraeme 5293:
5294: <dt><span class="sect2"><a href=
1.30 wiz 5295: "#startup-scripts">13.5.18. Packages installing
5296: startup scripts</a></span></dt>
1.1 grant 5297: </dl>
5298: </dd>
5299:
1.30 wiz 5300: <dt><span class="sect1"><a href=
5301: "#feedback-to-author">13.6. Feedback to the
5302: author</a></span></dt>
1.1 grant 5303: </dl>
5304: </dd>
5305:
1.25 rillig 5306: <dt><span class="chapter"><a href="#debug">14.
1.1 grant 5307: Debugging</a></span></dt>
5308:
1.25 rillig 5309: <dt><span class="chapter"><a href="#submit">15.
1.1 grant 5310: Submitting and Committing</a></span></dt>
5311:
5312: <dd>
5313: <dl>
1.30 wiz 5314: <dt><span class="sect1"><a href=
5315: "#submitting-your-package">15.1. Submitting your
5316: packages</a></span></dt>
1.1 grant 5317:
1.30 wiz 5318: <dt><span class="sect1"><a href=
5319: "#committing-importing">15.2. Committing: Importing a
5320: package into CVS</a></span></dt>
1.1 grant 5321:
1.30 wiz 5322: <dt><span class="sect1"><a href=
5323: "#updating-package">15.3. Updating a package to a
5324: newer version</a></span></dt>
1.1 grant 5325:
1.30 wiz 5326: <dt><span class="sect1"><a href=
5327: "#moving-package">15.4. Moving a package in
5328: pkgsrc</a></span></dt>
1.1 grant 5329: </dl>
5330: </dd>
5331: </dl>
5332: </div>
5333:
5334: <div class="chapter" lang="en" xml:lang="en">
5335: <div class="titlepage">
5336: <div>
5337: <div>
1.27 rillig 5338: <h2 class="title"><a name="components" id=
5339: "components"></a>Chapter 7. Package
5340: components - files, directories and contents</h2>
1.25 rillig 5341: </div>
5342: </div>
5343: </div>
5344:
5345: <div class="toc">
5346: <p><b>Table of Contents</b></p>
5347:
5348: <dl>
5349: <dt><span class="sect1"><a href=
1.27 rillig 5350: "#components.Makefile">7.1. <code class=
5351: "filename">Makefile</code></a></span></dt>
5352:
5353: <dt><span class="sect1"><a href=
5354: "#components.distinfo">7.2. <code class=
5355: "filename">distinfo</code></a></span></dt>
5356:
5357: <dt><span class="sect1"><a href=
5358: "#components.patches">7.3. patches/*</a></span></dt>
1.25 rillig 5359:
1.30 wiz 5360: <dt><span class="sect1"><a href=
5361: "#other-mandatory-files">7.4. Other mandatory
5362: files</a></span></dt>
1.25 rillig 5363:
1.27 rillig 5364: <dt><span class="sect1"><a href=
5365: "#components.optional">7.5. Optional
5366: files</a></span></dt>
1.25 rillig 5367:
1.30 wiz 5368: <dt><span class="sect1"><a href="#work-dir">7.6.
1.27 rillig 5369: <code class="filename">work*</code></a></span></dt>
1.25 rillig 5370:
1.30 wiz 5371: <dt><span class="sect1"><a href="#files-dir">7.7.
1.27 rillig 5372: <code class="filename">files/*</code></a></span></dt>
1.25 rillig 5373: </dl>
5374: </div>
5375:
1.27 rillig 5376: <p>Whenever you're preparing a package, there are a number
5377: of files involved which are described in the following
5378: sections.</p>
1.25 rillig 5379:
5380: <div class="sect1" lang="en" xml:lang="en">
5381: <div class="titlepage">
5382: <div>
5383: <div>
5384: <h2 class="title" style="clear: both"><a name=
1.27 rillig 5385: "components.Makefile" id=
5386: "components.Makefile"></a>7.1. <code class=
5387: "filename">Makefile</code></h2>
1.25 rillig 5388: </div>
5389: </div>
5390: </div>
5391:
1.27 rillig 5392: <p>Building, installation and creation of a binary
5393: package are all controlled by the package's <code class=
5394: "filename">Makefile</code>. The <code class=
5395: "filename">Makefile</code> describes various things about
5396: a package, for example from where to get it, how to
5397: configure, build, and install it.</p>
5398:
5399: <p>A package <code class="filename">Makefile</code>
5400: contains several sections that describe the package.</p>
1.25 rillig 5401:
1.27 rillig 5402: <p>In the first section there are the following
5403: variables, which should appear exactly in the order given
5404: here.</p>
1.25 rillig 5405:
5406: <div class="itemizedlist">
5407: <ul type="disc">
5408: <li>
1.27 rillig 5409: <p><code class="varname">DISTNAME</code> is the
5410: basename of the distribution file to be downloaded
5411: from the package's website.</p>
5412: </li>
5413:
5414: <li>
5415: <p><code class="varname">PKGNAME</code> is the name
5416: of the package, as used by pkgsrc. You only need to
5417: provide it if it differs from DISTNAME. Usually it
5418: is the directory name together with the version
5419: number. It must match the regular expression
5420: <code class=
5421: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
5422: that is, it starts with a letter or digit, and
5423: contains only letters, digits, dashes, underscores,
5424: dots and plus signs.</p>
1.25 rillig 5425: </li>
5426:
5427: <li>
1.27 rillig 5428: <p><code class="varname">CATEGORIES</code> is a
5429: list of categories which the package fits in. You
5430: can choose any of the top-level directories of
5431: pkgsrc for it.</p>
1.25 rillig 5432: </li>
5433:
5434: <li>
1.27 rillig 5435: <p><code class="varname">MASTER_SITES</code> is a
5436: list of URLs where the distribution files can be
5437: downloaded. Each URL must end with a slash.</p>
1.25 rillig 5438: </li>
5439: </ul>
5440: </div>
5441:
1.27 rillig 5442: <p>The second section contains the following
5443: variables.</p>
1.25 rillig 5444:
1.27 rillig 5445: <div class="itemizedlist">
5446: <ul type="disc">
5447: <li>
5448: <p><code class="varname">MAINTAINER</code> is the
5449: mail address of the package's maintainer, which is
5450: the person you can contact when the package does
5451: not work.</p>
5452: </li>
1.25 rillig 5453:
1.27 rillig 5454: <li>
5455: <p><code class="varname">HOMEPAGE</code> is a URL
5456: where users can find more information about the
1.23 wiz 5457: package.</p>
5458: </li>
1.1 grant 5459:
1.23 wiz 5460: <li>
5461: <p><code class="varname">COMMENT</code> is a
5462: one-line comment about the purpose of the
5463: package.</p>
5464: </li>
5465: </ul>
5466: </div>
1.1 grant 5467:
1.14 xtraeme 5468: <p>The <code class="varname">MASTER_SITES</code> may be
5469: set to one of the predefined sites:</p>
1.1 grant 5470: <pre class="programlisting">
5471: ${MASTER_SITE_APACHE}
1.27 rillig 5472: ${MASTER_SITE_BACKUP}
5473: ${MASTER_SITE_CYGWIN}
1.1 grant 5474: ${MASTER_SITE_DEBIAN}
1.27 rillig 5475: ${MASTER_SITE_FREEBSD}
5476: ${MASTER_SITE_FREEBSD_LOCAL}
1.1 grant 5477: ${MASTER_SITE_GNOME}
5478: ${MASTER_SITE_GNU}
5479: ${MASTER_SITE_GNUSTEP}
1.9 dillo 5480: ${MASTER_SITE_IFARCHIVE}
1.1 grant 5481: ${MASTER_SITE_MOZILLA}
1.27 rillig 5482: ${MASTER_SITE_OPENOFFICE}
1.1 grant 5483: ${MASTER_SITE_PERL_CPAN}
1.27 rillig 5484: ${MASTER_SITE_R_CRAN}
1.1 grant 5485: ${MASTER_SITE_SOURCEFORGE}
5486: ${MASTER_SITE_SUNSITE}
5487: ${MASTER_SITE_SUSE}
5488: ${MASTER_SITE_TEX_CTAN}
5489: ${MASTER_SITE_XCONTRIB}
1.27 rillig 5490: ${MASTER_SITE_XEMACS}
5491:
1.1 grant 5492: </pre>
5493:
5494: <p>If one of these predefined sites is chosen, you may
5495: require the ability to specify a subdirectory of that
5496: site. Since these macros may expand to more than one
5497: actual site, you <span class=
5498: "emphasis"><em>must</em></span> use the following
5499: construct to specify a subdirectory:</p>
5500: <pre class="programlisting">
5501: ${MASTER_SITE_GNU:=subdirectory/name/}
5502: ${MASTER_SITE_SOURCEFORGE:=project_name/}
5503: </pre>
5504:
5505: <p>Note the trailing slash after the subdirectory
5506: name.</p>
5507:
5508: <div class="note" style=
5509: "margin-left: 0.5in; margin-right: 0.5in;">
5510: <h3 class="title">Note</h3>
5511:
1.14 xtraeme 5512: <p><code class="varname">MASTER_SITE_SUBDIR</code> has
5513: been deprecated and <span class="emphasis"><em>should
5514: no longer be used</em></span>.</p>
1.1 grant 5515: </div>
5516:
1.14 xtraeme 5517: <p>If the package has multiple <code class=
5518: "varname">DISTFILES</code> or multiple <code class=
5519: "varname">PATCHFILES</code> from different sites, set
5520: <code class="varname">SITES_foo</code> to a list of URI's
1.1 grant 5521: where file “<span class="quote">foo</span>”
5522: may be found. “<span class=
5523: "quote">foo</span>” includes the suffix, e.g.</p>
5524: <pre class="programlisting">
5525: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
5526: DISTFILES+= foo-file.tar.gz
5527: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
5528: http://www.somewhereelse.com/mirror/somehow/
5529: </pre>
5530:
1.14 xtraeme 5531: <p>Note that the normal default setting of <code class=
5532: "varname">DISTFILES</code> must be made explicit if you
1.1 grant 5533: want to add to it (rather than replace it), as you
5534: usually would.</p>
5535:
5536: <p>Currently the following values are available for
1.14 xtraeme 5537: <code class="varname">CATEGORIES</code>. If more than one
5538: is used, they need to be separated by spaces:</p>
1.1 grant 5539: <pre class="programlisting">
5540: archivers cross geography meta-pkgs security
5541: audio databases graphics misc shells
5542: benchmarks devel ham multimedia sysutils
5543: biology editors inputmethod net textproc
5544: cad emulators lang news time
5545: chat finance mail parallel wm
5546: comms fonts math pkgtools www
5547: converters games mbone print x11
5548: </pre>
5549:
5550: <p>Please pay attention to the following gotchas:</p>
5551:
5552: <div class="itemizedlist">
5553: <ul type="disc">
5554: <li>
1.14 xtraeme 5555: <p>Add <code class="varname">MANCOMPRESSED</code>
5556: if manpages are installed in compressed form by the
5557: package; see comment in <code class=
5558: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 5559: </li>
5560:
5561: <li>
1.14 xtraeme 5562: <p>Replace <code class="filename">/usr/local</code>
1.1 grant 5563: with “<span class=
5564: "quote">${PREFIX}</span>” in all files (see
5565: patches, below).</p>
5566: </li>
5567:
5568: <li>
5569: <p>If the package installs any info files, see
5570: <a href="#faq.info-files" title=
1.25 rillig 5571: "13.5.10. Packages installing info files">Section
5572: 13.5.10, “Packages installing info
1.1 grant 5573: files”</a>.</p>
5574: </li>
5575:
5576: <li>
1.14 xtraeme 5577: <p>Set <code class="varname">MAINTAINER</code> to
5578: be yourself. If you really can't maintain the
5579: package for future updates, set it to <code class=
1.1 grant 5580: "email"><<a href=
1.14 xtraeme 5581: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.1 grant 5582: </li>
5583:
5584: <li>
5585: <p>If a home page for the software in question
1.14 xtraeme 5586: exists, add the variable <code class=
5587: "varname">HOMEPAGE</code> right after <code class=
5588: "varname">MAINTAINER</code>. The value of this
1.1 grant 5589: variable should be the URL for the home page.</p>
5590: </li>
5591:
5592: <li>
1.14 xtraeme 5593: <p>Be sure to set the <code class=
5594: "varname">COMMENT</code> variable to a short
1.1 grant 5595: description of the package, not containing the
5596: pkg's name.</p>
5597: </li>
5598: </ul>
5599: </div>
5600: </div>
5601:
5602: <div class="sect1" lang="en" xml:lang="en">
5603: <div class="titlepage">
5604: <div>
5605: <div>
5606: <h2 class="title" style="clear: both"><a name=
5607: "components.distinfo" id=
1.27 rillig 5608: "components.distinfo"></a>7.2. <code class=
1.14 xtraeme 5609: "filename">distinfo</code></h2>
1.1 grant 5610: </div>
5611: </div>
5612: </div>
5613:
5614: <p>Most important, the mandatory message digest, or
5615: checksum, of all the distfiles needed for the package to
5616: compile, confirming they match the original file
5617: distributed by the author. This ensures that the distfile
5618: retrieved from the Internet has not been corrupted during
5619: transfer or altered by a malign force to introduce a
1.14 xtraeme 5620: security hole. It is generated using the
5621: <span><strong class="command">make
5622: makesum</strong></span> command. The digest algorithm
5623: used was, at one stage, md5, but that was felt lacking
5624: compared to sha1, and so sha1 is now the default
1.1 grant 5625: algorithm. The distfile size is also generated and stored
5626: in new distinfo files. The <a xmlns=
5627: "http://www.w3.org/TR/xhtml1/transitional" href=
5628: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20 ben 5629: class="pkgname">pkgtools/digest</a> utility calculates
5630: all of the digests in the distinfo file, and it provides
5631: various different algorithms. At the current time, the
5632: algorithms provided are: <span class=
5633: "emphasis"><em>md5</em></span>, <span class=
5634: "emphasis"><em>rmd160</em></span>, <span class=
5635: "emphasis"><em>sha1</em></span>, <span class=
5636: "emphasis"><em>sha256</em></span>, <span class=
5637: "emphasis"><em>sha384</em></span> and <span class=
5638: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 5639:
5640: <p>Some packages have different sets of distfiles on a
5641: per architecture basis, for example <a xmlns=
5642: "http://www.w3.org/TR/xhtml1/transitional" href=
5643: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.20 ben 5644: class="pkgname">www/navigator</a>). These are kept in the
5645: same distinfo file and care should be taken when
5646: upgrading such a package to ensure distfile information
5647: is not lost.</p>
1.1 grant 5648:
5649: <p>The message digest/checksum for all the official
1.14 xtraeme 5650: patches found in the <code class=
5651: "filename">patches/</code> directory (see <a href=
5652: "#components.patches" title=
1.27 rillig 5653: "7.3. patches/*">Section 7.3,
1.1 grant 5654: “patches/*”</a>) for the package is also
1.14 xtraeme 5655: stored in the <code class="filename">distinfo</code>
5656: file. This is a message digest/checksum of all lines in
5657: the patch file except the NetBSD RCS Id. This file is
5658: generated by invoking <span><strong class="command">make
5659: makepatchsum</strong></span> (or <span><strong class=
5660: "command">make mps</strong></span> if you're in a
5661: hurry).</p>
1.1 grant 5662: </div>
5663:
5664: <div class="sect1" lang="en" xml:lang="en">
5665: <div class="titlepage">
5666: <div>
5667: <div>
5668: <h2 class="title" style="clear: both"><a name=
5669: "components.patches" id=
1.27 rillig 5670: "components.patches"></a>7.3. patches/*</h2>
1.1 grant 5671: </div>
5672: </div>
5673: </div>
5674:
5675: <p>This directory contains files that are used by the
5676: <a href=
5677: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
5678: <span class="citerefentry"><span class=
5679: "refentrytitle">patch</span>(1)</span></a> command to
5680: modify the sources as distributed in the distribution
5681: file into a form that will compile and run perfectly on
5682: NetBSD. The files are applied successively in alphabetic
5683: order (as returned by a shell “<span class=
5684: "quote">patches/patch-*</span>” glob expansion), so
1.14 xtraeme 5685: <code class="filename">patch-aa</code> is applied before
5686: <code class="filename">patch-ab</code>, etc.</p>
1.1 grant 5687:
1.14 xtraeme 5688: <p>The <code class="filename">patch-*</code> files should
5689: be in <span><strong class="command">diff
5690: -bu</strong></span> format, and apply without a fuzz to
5691: avoid problems. (To force patches to apply with fuzz you
5692: can set <code class=
5693: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 5694: not put changes for more than one file into a single
5695: patch-file, as this will make future modifications more
5696: difficult.</p>
5697:
5698: <p>Similar, a file should be patched at most once, not
5699: several times by several different patches. If a file
5700: needs several patches, they should be combined into one
5701: file.</p>
5702:
5703: <p>One important thing to mention is to pay attention
5704: that no RCS IDs get stored in the patch files, as these
5705: will cause problems when later checked into the NetBSD
1.14 xtraeme 5706: CVS tree. Use the <span><strong class=
5707: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 5708: "http://www.w3.org/TR/xhtml1/transitional" href=
5709: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 5710: class="pkgname">pkgtools/pkgdiff</a> package to avoid
5711: these problems.</p>
1.1 grant 5712:
5713: <p>For even more automation, we recommend using
1.14 xtraeme 5714: <span><strong class="command">mkpatches</strong></span>
5715: from the same package to make a whole set of patches. You
5716: just have to backup files before you edit them to
5717: <code class="filename">filename.orig</code>, e.g. with
5718: <span><strong class="command">cp -p filename
5719: filename.orig</strong></span> or, easier, by using
5720: <span><strong class="command">pkgvi</strong></span> again
5721: from the same package. If you upgrade a package this way,
5722: you can easily compare the new set of patches with the
5723: previously existing one with <span><strong class=
5724: "command">patchdiff</strong></span>.</p>
1.1 grant 5725:
5726: <p>When you have finished a package, remember to generate
5727: the checksums for the patch files by using the
1.14 xtraeme 5728: <span><strong class="command">make
5729: makepatchsum</strong></span> command, see <a href=
5730: "#components.distinfo" title=
1.27 rillig 5731: "7.2. distinfo">Section 7.2,
1.14 xtraeme 5732: “<code class="filename">distinfo</code>”</a>.</p>
1.1 grant 5733:
5734: <p>Patch files that are distributed by the author or
1.14 xtraeme 5735: other maintainers can be listed in <code class=
5736: "varname">$PATCHFILES</code>.</p>
1.1 grant 5737:
5738: <p>If it is desired to store any patches that should not
5739: be committed into pkgsrc, they can be kept outside the
1.14 xtraeme 5740: pkgsrc tree in the <code class=
5741: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 5742: tree there is expected to have the same
5743: “<span class="quote">category/package</span>”
5744: structure as pkgsrc, and patches are expected to be
1.14 xtraeme 5745: stored inside these dirs (also known as <code class=
5746: "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
5747: you want to keep a private patch for <code class=
5748: "filename">pkgsrc/graphics/png</code>, keep it in
5749: <code class=
5750: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
5751: files in the named directory are expected to be patch
1.1 grant 5752: files, and <span class="emphasis"><em>they are applied
5753: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 5754: </div>
5755:
5756: <div class="sect1" lang="en" xml:lang="en">
5757: <div class="titlepage">
5758: <div>
5759: <div>
5760: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5761: "other-mandatory-files" id=
5762: "other-mandatory-files"></a>7.4. Other
1.27 rillig 5763: mandatory files</h2>
5764: </div>
5765: </div>
5766: </div>
5767:
5768: <div class="variablelist">
5769: <dl>
5770: <dt><span class="term"><code class=
5771: "filename">DESCR</code></span></dt>
5772:
5773: <dd>
5774: <p>A multi-line description of the piece of
5775: software. This should include any credits where
5776: they are due. Please bear in mind that others do
5777: not share your sense of humour (or spelling
5778: idiosyncrasies), and that others will read
5779: everything that you write here.</p>
5780: </dd>
5781:
5782: <dt><span class="term"><code class=
5783: "filename">PLIST</code></span></dt>
5784:
5785: <dd>
5786: <p>This file governs the files that are installed
5787: on your system: all the binaries, manual pages,
5788: etc. There are other directives which may be
5789: entered in this file, to control the creation and
5790: deletion of directories, and the location of
5791: inserted files. See <a href="#plist" title=
5792: "Chapter 9. PLIST issues">Chapter 9,
5793: <i>PLIST issues</i></a> for more information.</p>
5794: </dd>
5795: </dl>
5796: </div>
5797: </div>
5798:
5799: <div class="sect1" lang="en" xml:lang="en">
5800: <div class="titlepage">
5801: <div>
5802: <div>
5803: <h2 class="title" style="clear: both"><a name=
5804: "components.optional" id=
5805: "components.optional"></a>7.5. Optional
5806: files</h2>
5807: </div>
5808: </div>
5809: </div>
5810:
5811: <div class="variablelist">
5812: <dl>
5813: <dt><span class="term"><code class=
5814: "filename">INSTALL</code></span></dt>
5815:
5816: <dd>
5817: <p>This shell script is invoked twice by <a href=
5818: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5819: <span class="citerefentry"><span class=
5820: "refentrytitle">pkg_add</span>(1)</span></a>. First
5821: time after package extraction and before files are
5822: moved in place, the second time after the files to
5823: install are moved in place. This can be used to do
5824: any custom procedures not possible with @exec
5825: commands in <code class="filename">PLIST</code>.
5826: See <a href=
5827: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5828: <span class="citerefentry"><span class=
5829: "refentrytitle">pkg_add</span>(1)</span></a> and
5830: <a href=
5831: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5832: <span class="citerefentry"><span class=
5833: "refentrytitle">pkg_create</span>(1)</span></a> for
5834: more information.</p>
5835: </dd>
5836:
5837: <dt><span class="term"><code class=
5838: "filename">DEINSTALL</code></span></dt>
5839:
5840: <dd>
5841: <p>This script is executed before and after any
5842: files are removed. It is this script's
5843: responsibility to clean up any additional messy
5844: details around the package's installation, since
5845: all pkg_delete knows is how to delete the files
5846: created in the original distribution. See <a href=
5847: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
5848: <span class="citerefentry"><span class=
5849: "refentrytitle">pkg_delete</span>(1)</span></a> and
5850: <a href=
5851: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5852: <span class="citerefentry"><span class=
5853: "refentrytitle">pkg_create</span>(1)</span></a> for
5854: more information.</p>
5855: </dd>
5856:
5857: <dt><span class="term"><code class=
5858: "filename">MESSAGE</code></span></dt>
5859:
5860: <dd>
5861: <p>Display this file after installation of the
5862: package. Useful for things like legal notices on
5863: almost-free software and hints for updating config
5864: files after installing modules for apache, PHP etc.
5865: Please note that you can modify variables in it
5866: easily by using <code class=
5867: "varname">MESSAGE_SUBST</code> in the package's
5868: <code class="filename">Makefile</code>:</p>
5869: <pre class="programlisting">
5870: MESSAGE_SUBST+= SOMEVAR="somevalue"
5871: </pre>
5872:
5873: <p>replaces "${SOMEVAR}" with “<span class=
5874: "quote">somevalue</span>” in <code class=
5875: "filename">MESSAGE</code>.</p>
5876: </dd>
5877: </dl>
5878: </div>
5879: </div>
5880:
5881: <div class="sect1" lang="en" xml:lang="en">
5882: <div class="titlepage">
5883: <div>
5884: <div>
5885: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5886: "work-dir" id="work-dir"></a>7.6. <code class=
1.27 rillig 5887: "filename">work*</code></h2>
5888: </div>
5889: </div>
5890: </div>
5891:
5892: <p>When you type <span><strong class=
5893: "command">make</strong></span> the distribution files are
5894: unpacked into this directory. It can be removed by
5895: running <span><strong class="command">make
5896: clean</strong></span>. Besides the sources, this
5897: directory is also used to keep various timestamp
5898: files.</p>
5899:
5900: <p>If a package doesn't create a subdirectory for itself
5901: (like GNU software does, for instance), but extracts
5902: itself in the current directory, you should set
5903: <code class="varname">WRKSRC</code> accordingly, e.g.
5904: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
5905: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
5906: class="pkgname">editors/sam</a> again, but the quick
5907: answer is:</p>
5908: <pre class="programlisting">
5909: WRKSRC= ${WRKDIR}
5910: </pre>
5911:
5912: <p>Please note that the old <code class=
5913: "varname">NO_WRKSUBDIR</code> has been deprecated and
5914: should not be used. Also, if your package doesn't create
5915: a subdir with the name of <code class=
5916: "varname">DISTNAME</code> but some different name, set
5917: <code class="varname">WRKSRC</code> to point to the
5918: proper name in <code class="filename">${WRKDIR}</code>.
5919: See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5920: href=
5921: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
5922: class="pkgname">lang/tcl</a> and <a xmlns=
5923: "http://www.w3.org/TR/xhtml1/transitional" href=
5924: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
5925: class="pkgname">x11/tk</a> for examples, and here is
5926: another one:</p>
5927: <pre class="programlisting">
5928: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
5929: </pre>
5930:
5931: <p>The name of the working directory created by pkgsrc is
5932: <code class="filename">work</code> by default. If the
5933: same pkgsrc tree should be used on several different
5934: platforms, the variable <code class=
5935: "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
5936: attach the platform to the directory name, e.g.
5937: <code class="filename">work.i386</code> or <code class=
5938: "filename">work.sparc</code>.</p>
5939: </div>
5940:
5941: <div class="sect1" lang="en" xml:lang="en">
5942: <div class="titlepage">
5943: <div>
5944: <div>
5945: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5946: "files-dir" id=
5947: "files-dir"></a>7.7. <code class=
1.27 rillig 5948: "filename">files/*</code></h2>
5949: </div>
5950: </div>
5951: </div>
5952:
5953: <p>If you have any files that you wish to be placed in
5954: the package prior to configuration or building, you could
5955: place these files here and use a “<span class=
5956: "quote">${CP}</span>” command in the
5957: “<span class="quote">pre-configure</span>”
5958: target to achieve this. Alternatively, you could simply
5959: diff the file against <code class=
5960: "filename">/dev/null</code> and use the patch mechanism
5961: to manage the creation of this file.</p>
5962: </div>
5963: </div>
5964:
5965: <div class="chapter" lang="en" xml:lang="en">
5966: <div class="titlepage">
5967: <div>
5968: <div>
5969: <h2 class="title"><a name="makefile" id=
5970: "makefile"></a>Chapter 8. Programming in
5971: <code class="filename">Makefile</code>s</h2>
5972: </div>
5973: </div>
5974: </div>
5975:
5976: <div class="toc">
5977: <p><b>Table of Contents</b></p>
5978:
5979: <dl>
5980: <dt><span class="sect1"><a href=
5981: "#makefile.variables">8.1. <code class=
5982: "filename">Makefile</code> variables</a></span></dt>
5983:
5984: <dd>
5985: <dl>
5986: <dt><span class="sect2"><a href=
5987: "#makefile.variables.names">8.1.1. Naming
5988: conventions</a></span></dt>
5989: </dl>
5990: </dd>
5991:
5992: <dt><span class="sect1"><a href="#makefile.code">8.2.
5993: Code snippets</a></span></dt>
5994:
5995: <dd>
5996: <dl>
1.30 wiz 5997: <dt><span class="sect2"><a href=
5998: "#adding-to-list">8.2.1. Adding things to a
5999: list</a></span></dt>
1.27 rillig 6000:
1.30 wiz 6001: <dt><span class="sect2"><a href=
6002: "#converting-internal-to-external">8.2.2.
1.27 rillig 6003: Converting an internal list into an external
6004: list</a></span></dt>
6005:
1.30 wiz 6006: <dt><span class="sect2"><a href=
6007: "#passing-variable-to-shell">8.2.3. Passing
6008: variables to a shell command</a></span></dt>
1.27 rillig 6009:
1.30 wiz 6010: <dt><span class="sect2"><a href=
6011: "#quoting-guideline">8.2.4. Quoting
6012: guideline</a></span></dt>
1.27 rillig 6013:
1.30 wiz 6014: <dt><span class="sect2"><a href=
6015: "#bsd-make-bug-workaround">8.2.5. Workaround for a
6016: bug in BSD Make</a></span></dt>
1.27 rillig 6017: </dl>
6018: </dd>
6019: </dl>
6020: </div>
6021:
6022: <p>Pkgsrc consists of many <code class=
6023: "filename">Makefile</code> fragments, each of which forms a
6024: well-defined part of the pkgsrc system. Using the <a href=
6025: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6026: <span class="citerefentry"><span class=
6027: "refentrytitle">make</span>(1)</span></a> system as a
6028: programming language for a big system like pkgsrc requires
6029: some discipline to keep the code correct and
6030: understandable.</p>
6031:
6032: <p>The basic ingredients for <code class=
6033: "filename">Makefile</code> programming are variables (which
6034: are actually macros) and shell commands. Among these shell
6035: commands may even be more complex ones like <a href=
6036: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
6037: <span class="citerefentry"><span class=
6038: "refentrytitle">awk</span>(1)</span></a> programs. To make
6039: sure that every shell command runs as intended it is
6040: necessary to quote all variables correctly when they are
6041: used.</p>
6042:
6043: <p>This chapter describes some patterns, that appear quite
6044: often in <code class="filename">Makefile</code>s, including
6045: the pitfalls that come along with them.</p>
6046:
6047: <div class="sect1" lang="en" xml:lang="en">
6048: <div class="titlepage">
6049: <div>
6050: <div>
6051: <h2 class="title" style="clear: both"><a name=
6052: "makefile.variables" id=
6053: "makefile.variables"></a>8.1. <code class=
6054: "filename">Makefile</code> variables</h2>
6055: </div>
6056: </div>
6057: </div>
6058:
6059: <p><code class="filename">Makefile</code> variables
6060: contain strings that can be processed using the five
6061: operators ``='', ``+='', ``?='', ``:='', and ``!='',
6062: which are described in the <a href=
6063: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6064: <span class="citerefentry"><span class=
6065: "refentrytitle">make</span>(1)</span></a> man page.</p>
6066:
6067: <p>When a variable's value is parsed from a <code class=
6068: "filename">Makefile</code>, the hash character ``#'' and
6069: the backslash character ``\'' are handled specially. If a
6070: backslash is followed by a newline, any whitespace
6071: immediately in front of the backslash, the backslash, the
6072: newline, and any whitespace immediately behind the
6073: newline are replaced with a single space. A backspace
6074: character and an immediately following hash character are
6075: replaced with a single hash character. Otherwise the
6076: backslash is passed as is. In a variable assignment, any
6077: hash character that is not preceded by a backslash starts
6078: a comment that continues upto the end of the logical
6079: line.</p>
6080:
6081: <p><span class="emphasis"><em>Note:</em></span> Because
6082: of this parsing algorithm the only way to create a
6083: variable consisting of a single backslash is using the
6084: ``!='' operator, for example: <code class=
6085: "varname">BACKSLASH!=echo "\\"</code>.</p>
6086:
6087: <p>So far for defining variables. The other thing you can
6088: do with variables is evaluating them. A variable is
6089: evaluated when it is part of the right side of the ``:=''
6090: or the ``!='' operator, or directly before executing a
6091: shell command which the variable is part of. In all other
6092: cases <a href=
6093: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6094: <span class="citerefentry"><span class=
6095: "refentrytitle">make</span>(1)</span></a> performs lazy
6096: evaluation, that is, variables are not evaluated until
6097: there's no other way. The ``modifiers'' mentioned in the
6098: man page also evaluate the variable.</p>
6099:
6100: <p>Some of the modifiers split the string into words and
6101: then operate on the words, others operate on the string
6102: as a whole. When a string is splitted into words, it is
6103: splitted as you would expect it from <a href=
6104: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
6105: <span class="citerefentry"><span class=
6106: "refentrytitle">sh</span>(1)</span></a>.</p>
6107:
6108: <p>No rule without exception—the
6109: <span><strong class="command">.for</strong></span> loop
6110: does not follow the shell quoting rules but splits at
6111: sequences of whitespace.</p>
6112:
6113: <p>There are several types of variables that should be
6114: handled differently. Strings and two types of lists.</p>
6115:
6116: <div class="itemizedlist">
6117: <ul type="disc">
6118: <li>
6119: <p><span class="emphasis"><em>Strings</em></span>
6120: can contain arbitrary characters. Nevertheless you
6121: should restrict yourself to only using printable
6122: characters. Examples are <code class=
6123: "varname">PREFIX</code> and <code class=
6124: "varname">COMMENT</code>.</p>
6125: </li>
6126:
6127: <li>
6128: <p><span class="emphasis"><em>Internal
6129: lists</em></span> are lists that are never exported
6130: to any shell command. Their elements are separated
6131: by whitespace. Therefore the elements themselves
6132: cannot have embedded whitespace. Any other
6133: characters are allowed. Internal lists can be used
6134: in <span><strong class=
6135: "command">.for</strong></span> loops. Examples are
6136: <code class="varname">DEPENDS</code> and
6137: <code class="varname">BUILD_DEPENDS</code>.</p>
6138: </li>
6139:
6140: <li>
6141: <p><span class="emphasis"><em>External
6142: lists</em></span> are lists that may be exported to
6143: a shell command. Their elements can contain any
6144: characters, including whitespace. That's why they
6145: cannot be used in <span><strong class=
6146: "command">.for</strong></span> loops. Examples are
6147: <code class="varname">DISTFILES</code> and
6148: <code class="varname">MASTER_SITES</code>.</p>
6149: </li>
6150: </ul>
6151: </div>
6152:
6153: <div class="sect2" lang="en" xml:lang="en">
6154: <div class="titlepage">
6155: <div>
6156: <div>
6157: <h3 class="title"><a name=
6158: "makefile.variables.names" id=
6159: "makefile.variables.names"></a>8.1.1. Naming
6160: conventions</h3>
6161: </div>
6162: </div>
6163: </div>
6164:
6165: <div class="itemizedlist">
6166: <ul type="disc">
6167: <li>
6168: <p>All variable names starting with an underscore
6169: are reserved for use by the pkgsrc
6170: infrastructure. They shall not be used by package
6171: <code class="filename">Makefile</code>s.</p>
6172: </li>
6173:
6174: <li>
6175: <p>In <span><strong class=
6176: "command">.for</strong></span> loops you should
6177: use lowercase variable names for the iteration
6178: variables.</p>
6179: </li>
6180:
6181: <li>
6182: <p>All list variables should have a ``plural''
6183: name, e.g. <code class=
6184: "varname">PKG_OPTIONS</code> or <code class=
6185: "varname">DISTFILES</code>.</p>
6186: </li>
6187: </ul>
6188: </div>
6189: </div>
6190: </div>
6191:
6192: <div class="sect1" lang="en" xml:lang="en">
6193: <div class="titlepage">
6194: <div>
6195: <div>
6196: <h2 class="title" style="clear: both"><a name=
6197: "makefile.code" id=
6198: "makefile.code"></a>8.2. Code snippets</h2>
6199: </div>
6200: </div>
6201: </div>
6202:
6203: <p>This section presents you with some code snippets you
6204: should use in your own code. If you don't find anything
6205: appropriate here, you should test your code and add it
6206: here.</p>
6207:
6208: <div class="sect2" lang="en" xml:lang="en">
6209: <div class="titlepage">
6210: <div>
6211: <div>
1.30 wiz 6212: <h3 class="title"><a name="adding-to-list" id=
6213: "adding-to-list"></a>8.2.1. Adding things to
6214: a list</h3>
1.27 rillig 6215: </div>
6216: </div>
6217: </div>
6218: <pre class="programlisting">
6219: STRING= foo * bar `date`
6220: INT_LIST= # empty
6221: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
6222: EXT_LIST= # empty
6223: ANOTHER_EXT_LIST= a=b c=d
6224:
6225: INT_LIST+= ${STRING} # 1
6226: INT_LIST+= ${ANOTHER_INT_LIST} # 2
6227: EXT_LIST+= ${STRING:Q} # 3
6228: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
6229:
6230: </pre>
6231:
6232: <p>When you add a string to an external list (example
6233: 3), it must be quoted. In all other cases, you must not
6234: add a quoting level. You must not merge internal and
6235: external lists, unless you are sure that all entries
6236: are correctly interpreted in both lists.</p>
6237: </div>
6238:
6239: <div class="sect2" lang="en" xml:lang="en">
6240: <div class="titlepage">
6241: <div>
6242: <div>
1.30 wiz 6243: <h3 class="title"><a name=
6244: "converting-internal-to-external" id=
6245: "converting-internal-to-external"></a>8.2.2. Converting
6246: an internal list into an external list</h3>
1.27 rillig 6247: </div>
6248: </div>
6249: </div>
6250: <pre class="programlisting">
6251: EXT_LIST= # empty
6252: .for i in ${INT_LIST}
6253: EXT_LIST+= ${i:Q}""
6254: .endfor
6255:
6256: </pre>
6257:
6258: <p>This code converts the internal list <code class=
6259: "varname">INT_LIST</code> into the external list
6260: <code class="varname">EXT_LIST</code>. As the elements
6261: of an internal list are unquoted they must be quoted
6262: here. The reason for appending <code class=
6263: "varname">""</code> is explained below.</p>
6264: </div>
1.1 grant 6265:
1.27 rillig 6266: <div class="sect2" lang="en" xml:lang="en">
6267: <div class="titlepage">
1.1 grant 6268: <div>
1.27 rillig 6269: <div>
1.30 wiz 6270: <h3 class="title"><a name=
6271: "passing-variable-to-shell" id=
6272: "passing-variable-to-shell"></a>8.2.3. Passing
6273: variables to a shell command</h3>
1.27 rillig 6274: </div>
1.1 grant 6275: </div>
6276: </div>
1.27 rillig 6277: <pre class="programlisting">
6278: STRING= foo bar < > * `date` $$HOME ' "
6279: EXT_LIST= string=${STRING:Q} x=second\ item
6280:
6281: all:
6282: echo ${STRING} # 1
6283: echo "${STRING}" # 2
6284: echo "${STRING:Q}" # 3
6285: echo ${STRING:Q} # 4
6286: echo x${STRING:Q} | sed 1s,.,, # 5
6287: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
6288:
6289: </pre>
6290:
6291: <p>Example 1 leads to a syntax error in the shell, as
6292: the characters are just copied.</p>
6293:
6294: <p>Example 2 leads to a syntax error too, and if you
6295: leave out the last " character from <code class=
6296: "varname">${STRING}</code>, <a href=
6297: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
6298: <span class="citerefentry"><span class=
6299: "refentrytitle">date</span>(1)</span></a> will be
6300: executed. The <code class="varname">$HOME</code> shell
6301: variable would be evaluated, too.</p>
6302:
6303: <p>Example 3 outputs each space character preceded by a
6304: backslash (or not), depending on the implementation of
6305: the <a href=
6306: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6307: <span class="citerefentry"><span class=
6308: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 6309:
1.27 rillig 6310: <p>Example 4 handles correctly every string that does
6311: not start with a dash. In that case, the result depends
6312: on the implementation of the <a href=
6313: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6314: <span class="citerefentry"><span class=
6315: "refentrytitle">echo</span>(1)</span></a> command. As
6316: long as you can guarantee that your input does not
6317: start with a dash this form is appropriate.</p>
1.1 grant 6318:
1.27 rillig 6319: <p>Example 5 handles even the case of a leading dash
6320: correctly.</p>
1.1 grant 6321:
1.27 rillig 6322: <p>The <code class="varname">EXT_LIST</code> does not
6323: need to be quoted because the quoting has already be
6324: done when adding elements to the list.</p>
1.1 grant 6325:
1.27 rillig 6326: <p>As internal lists shall not be passed to the shell,
6327: there is no example for it.</p>
1.1 grant 6328: </div>
6329:
1.27 rillig 6330: <div class="sect2" lang="en" xml:lang="en">
6331: <div class="titlepage">
1.1 grant 6332: <div>
1.27 rillig 6333: <div>
1.30 wiz 6334: <h3 class="title"><a name="quoting-guideline" id=
6335: "quoting-guideline"></a>8.2.4. Quoting
1.27 rillig 6336: guideline</h3>
6337: </div>
1.1 grant 6338: </div>
6339: </div>
6340:
1.27 rillig 6341: <p>There are many possible sources of wrongly quoted
6342: variables. This section lists some of the commonly
6343: known ones.</p>
1.1 grant 6344:
1.27 rillig 6345: <div class="itemizedlist">
6346: <ul type="disc">
6347: <li>
6348: <p>Whenever you use the value of a list, think
6349: about what happens to leading or trailing
6350: whitespace. If the list is a well-formed shell
6351: expression you can apply the <code class=
6352: "varname">:M*</code> modifier to strip leading
6353: and trailing whitespace from each word. The
6354: <code class="varname">:M</code> operator first
6355: splits its argument according to the rules of the
6356: shell, and then creates a new list consisting of
6357: all words that match the shell glob expression
6358: <code class="varname">*</code>, that is: all. One
6359: class of situations where this is needed is when
6360: adding a variable like <code class=
6361: "varname">CPPFLAGS</code> to <code class=
6362: "varname">CONFIGURE_ARGS</code>. If the configure
6363: script invokes other configure scripts it strips
6364: the leading and trailing whitespace from the
6365: variable and then passes it to the other
6366: configure scripts. But these configure scripts
6367: expect the (child) <code class=
6368: "varname">CPPFLAGS</code> variable to be the same
6369: as the parent <code class=
6370: "varname">CPPFLAGS</code>. That's why we better
6371: pass the <code class="varname">CPPFLAGS</code>
6372: value properly trimmed. And here is how we do
6373: it:</p>
6374: <pre class="programlisting">
6375: CPPFLAGS= # empty
6376: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
6377: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 grant 6378:
1.27 rillig 6379: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 grant 6380:
1.27 rillig 6381: all:
6382: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
6383: echo x${CONFIGURE_ARGS}x # properly trimmed
6384:
6385: </pre>
6386: </li>
1.1 grant 6387:
1.27 rillig 6388: <li>
6389: <p>The example above contains one bug: The
6390: <code class="varname">${PREFIX}</code> is a
6391: properly quoted shell expression, but there is
6392: the C compiler after it, which also expects a
6393: properly quoted string (this time in C syntax).
6394: The version above is therefore only correct if
6395: <code class="varname">${PREFIX}</code> does not
6396: have embedded backslashes or double quotes. If
6397: you want to allow these, you have to add another
6398: layer of quoting to each variable that is used as
6399: a C string literal. You cannot use the
6400: <code class="varname">:Q</code> operator for it,
6401: as this operator only works for the shell.</p>
6402: </li>
1.1 grant 6403:
1.27 rillig 6404: <li>
6405: <p>Whenever a variable can be empty the
6406: <code class="varname">:Q</code> operator can have
6407: surprising results. Here are two completely
6408: different cases which can be solved with the same
6409: trick.</p>
6410: <pre class="programlisting">
6411: EMPTY= # empty
6412: empty_test:
6413: for i in a ${EMPTY:Q} c; do \
6414: echo "$$i"; \
6415: done
6416:
6417: for_test:
6418: .for i in a:\ a:\test.txt
6419: echo ${i:Q}
6420: echo "foo"
6421: .endfor
6422:
1.1 grant 6423: </pre>
6424:
1.27 rillig 6425: <p>The first example will only print two of the
6426: three lines we might have expected. This is
6427: because <code class="varname">${EMPTY:Q}</code>
6428: expands to the empty string, which the shell
6429: cannot see. The workaround is to write
6430: <code class="varname">${EMPTY:Q}""</code>. This
6431: pattern can be often found as <code class=
6432: "varname">${TEST} -z ${VAR:Q}</code> or as
6433: <code class="varname">${TEST} -f
6434: ${FNAME:Q}</code> (both of these are wrong).</p>
6435:
6436: <p>The second example will only print three lines
6437: instead of four. The first line looks like
6438: <code class="varname">a:\ echo foo</code>. This
6439: is because the backslash of the value
6440: <code class="varname">a:\</code> is interpreted
6441: as a line-continuation by <a href=
6442: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6443: <span class="citerefentry"><span class=
6444: "refentrytitle">make</span>(1)</span></a>, which
6445: makes the second line the arguments of the
6446: <a href=
6447: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6448: <span class="citerefentry"><span class=
6449: "refentrytitle">echo</span>(1)</span></a> command
6450: from the first line. To avoid this, write
6451: <code class="varname">${i:Q}""</code>.</p>
6452: </li>
6453: </ul>
6454: </div>
1.1 grant 6455: </div>
6456:
1.27 rillig 6457: <div class="sect2" lang="en" xml:lang="en">
6458: <div class="titlepage">
1.1 grant 6459: <div>
1.27 rillig 6460: <div>
1.30 wiz 6461: <h3 class="title"><a name=
6462: "bsd-make-bug-workaround" id=
6463: "bsd-make-bug-workaround"></a>8.2.5. Workaround
6464: for a bug in BSD Make</h3>
1.27 rillig 6465: </div>
1.1 grant 6466: </div>
6467: </div>
6468:
1.27 rillig 6469: <p>The pkgsrc bmake program does not handle the
6470: following assignment correctly. In case <code class=
6471: "varname">_othervar_</code> contains a ``-'' character,
6472: one of the closing braces is included in <code class=
6473: "varname">${VAR}</code> after this code executes.</p>
6474: <pre class="programlisting">
6475: VAR:= ${VAR:N${_othervar_:C/-//}}
6476:
1.1 grant 6477: </pre>
6478:
1.27 rillig 6479: <p>For a more complex code snippet and a workaround,
6480: see the package <a xmlns=
6481: "http://www.w3.org/TR/xhtml1/transitional" href=
6482: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
6483: class="pkgname">regress/make-quoting</a>, testcase
6484: <code class="varname">bug1</code>.</p>
1.1 grant 6485: </div>
6486: </div>
6487: </div>
6488:
6489: <div class="chapter" lang="en" xml:lang="en">
6490: <div class="titlepage">
6491: <div>
6492: <div>
6493: <h2 class="title"><a name="plist" id=
1.25 rillig 6494: "plist"></a>Chapter 9. PLIST issues</h2>
1.1 grant 6495: </div>
6496: </div>
6497: </div>
6498:
6499: <div class="toc">
6500: <p><b>Table of Contents</b></p>
6501:
6502: <dl>
1.30 wiz 6503: <dt><span class="sect1"><a href="#rcs-id">9.1. RCS
1.1 grant 6504: ID</a></span></dt>
6505:
1.30 wiz 6506: <dt><span class="sect1"><a href=
6507: "#automatic-plist-generation">9.2. Semi-automatic
6508: <code class="filename">PLIST</code>
1.14 xtraeme 6509: generation</a></span></dt>
1.1 grant 6510:
1.25 rillig 6511: <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14 xtraeme 6512: Tweaking output of <span><strong class="command">make
6513: print-PLIST</strong></span></a></span></dt>
1.1 grant 6514:
1.25 rillig 6515: <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1 grant 6516: Variable substitution in PLIST</a></span></dt>
6517:
1.30 wiz 6518: <dt><span class="sect1"><a href=
6519: "#manpage-compression">9.5.
1.1 grant 6520: Manpage-compression</a></span></dt>
6521:
1.30 wiz 6522: <dt><span class="sect1"><a href="#using-PLIST_SRC">9.6.
1.14 xtraeme 6523: Changing PLIST source with <code class=
6524: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 6525:
1.30 wiz 6526: <dt><span class="sect1"><a href=
6527: "#platform-specific-plist">9.7. Platform specific and
6528: differing PLISTs</a></span></dt>
1.1 grant 6529:
1.25 rillig 6530: <dt><span class="sect1"><a href="#faq.common-dirs">9.8.
1.1 grant 6531: Sharing directories between packages</a></span></dt>
6532: </dl>
6533: </div>
6534:
1.14 xtraeme 6535: <p>The <code class="filename">PLIST</code> file contains a
1.1 grant 6536: package's “<span class="quote">packing
6537: list</span>”, i.e. a list of files that belong to the
1.14 xtraeme 6538: package (relative to the <code class=
6539: "filename">${PREFIX}</code> directory it's been installed
6540: in) plus some additional statements - see the <a href=
1.1 grant 6541: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6542: <span class="citerefentry"><span class=
6543: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
6544: a full list. This chapter addresses some issues that need
1.14 xtraeme 6545: attention when dealing with the <code class=
6546: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 6547:
6548: <div class="sect1" lang="en" xml:lang="en">
6549: <div class="titlepage">
6550: <div>
6551: <div>
6552: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6553: "rcs-id" id="rcs-id"></a>9.1. RCS ID</h2>
1.1 grant 6554: </div>
6555: </div>
6556: </div>
6557:
6558: <p>Be sure to add a RCS ID line as the first thing in any
1.14 xtraeme 6559: <code class="filename">PLIST</code> file you write:</p>
1.1 grant 6560: <pre class="programlisting">
1.17 sketch 6561: @comment $NetBSD$
1.1 grant 6562: </pre>
6563: </div>
6564:
6565: <div class="sect1" lang="en" xml:lang="en">
6566: <div class="titlepage">
6567: <div>
6568: <div>
6569: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6570: "automatic-plist-generation" id=
6571: "automatic-plist-generation"></a>9.2. Semi-automatic
1.14 xtraeme 6572: <code class="filename">PLIST</code> generation</h2>
1.1 grant 6573: </div>
6574: </div>
6575: </div>
6576:
1.14 xtraeme 6577: <p>You can use the <span><strong class="command">make
6578: print-PLIST</strong></span> command to output a PLIST
6579: that matches any new files since the package was
6580: extracted. See <a href="#build.helpful-targets" title=
1.25 rillig 6581: "12.3. Other helpful targets">Section 12.3,
1.1 grant 6582: “Other helpful targets”</a> for more
6583: information on this target.</p>
6584: </div>
6585:
6586: <div class="sect1" lang="en" xml:lang="en">
6587: <div class="titlepage">
6588: <div>
6589: <div>
6590: <h2 class="title" style="clear: both"><a name=
6591: "print-PLIST" id=
1.25 rillig 6592: "print-PLIST"></a>9.3. Tweaking output of
1.14 xtraeme 6593: <span><strong class="command">make
6594: print-PLIST</strong></span></h2>
1.1 grant 6595: </div>
6596: </div>
6597: </div>
6598:
6599: <p>If you have used any of the *-dirs packages, as
6600: explained in <a href="#faq.common-dirs" title=
1.25 rillig 6601: "9.8. Sharing directories between packages">Section 9.8,
1.1 grant 6602: “Sharing directories between packages”</a>,
1.14 xtraeme 6603: you may have noticed that <span><strong class=
6604: "command">make print-PLIST</strong></span> outputs a set
6605: of <code class="varname">@comment</code>s instead of real
6606: <code class="varname">@dirrm</code> lines. You can also
6607: do this for specific directories and files, so that the
6608: results of that command are very close to reality. This
6609: helps <span class="emphasis"><em>a lot</em></span> during
6610: the update of packages.</p>
6611:
6612: <p>The <code class="varname">PRINT_PLIST_AWK</code>
6613: variable takes a set of AWK patterns and actions that are
6614: used to filter the output of print-PLIST. You can
6615: <span class="emphasis"><em>append</em></span> any chunk
6616: of AWK scripting you like to it, but be careful with
1.1 grant 6617: quoting.</p>
6618:
1.14 xtraeme 6619: <p>For example, to get all files inside the <code class=
6620: "filename">libdata/foo</code> directory removed from the
1.1 grant 6621: resulting PLIST:</p>
6622: <pre class="programlisting">
6623: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
6624:
6625: </pre>
6626:
1.14 xtraeme 6627: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 6628: lines referring to a specific (shared) directory
1.14 xtraeme 6629: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 6630: <pre class="programlisting">
6631: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
6632:
6633: </pre>
6634: </div>
6635:
6636: <div class="sect1" lang="en" xml:lang="en">
6637: <div class="titlepage">
6638: <div>
6639: <div>
6640: <h2 class="title" style="clear: both"><a name=
1.25 rillig 6641: "plist.misc" id="plist.misc"></a>9.4. Variable
1.1 grant 6642: substitution in PLIST</h2>
6643: </div>
6644: </div>
6645: </div>
6646:
6647: <p>A number of variables are substituted automatically in
6648: PLISTs when a package is installed on a system. This
6649: includes the following variables:</p>
6650:
6651: <div class="variablelist">
6652: <dl>
1.14 xtraeme 6653: <dt><span class="term"><code class=
6654: "varname">${MACHINE_ARCH}</code>, <code class=
6655: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 6656:
6657: <dd>
6658: <p>Some packages like emacs and perl embed
6659: information about which architecture they were
6660: built on into the pathnames where they install
6661: their file. To handle this case, PLIST will be
6662: preprocessed before actually used, and the symbol
1.14 xtraeme 6663: “<span class="quote"><code class=
6664: "varname">${MACHINE_ARCH}</code></span>” will
6665: be replaced by what <span><strong class=
6666: "command">uname -p</strong></span> gives. The same
6667: is done if the string <code class=
6668: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
6669: PLIST somewhere - use this on packages that have
6670: GNU autoconf created configure scripts.</p>
1.1 grant 6671:
6672: <div class="note" style=
6673: "margin-left: 0.5in; margin-right: 0.5in;">
6674: <h3 class="title">Legacy note</h3>
6675:
6676: <p>There used to be a symbol “<span class=
1.14 xtraeme 6677: "quote"><code class=
6678: "varname">$ARCH</code></span>” that was
6679: replaced by the output of <span><strong class=
6680: "command">uname -m</strong></span>, but that's no
1.1 grant 6681: longer supported and has been removed.</p>
6682: </div>
6683: </dd>
6684:
1.14 xtraeme 6685: <dt><span class="term"><code class=
6686: "varname">${OPSYS}</code>, <code class=
6687: "varname">${LOWER_OPSYS}</code>, <code class=
6688: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 6689:
6690: <dd>
6691: <p>Some packages want to embed the OS name and
6692: version into some paths. To do this, use these
1.14 xtraeme 6693: variables in the <code class=
6694: "filename">PLIST</code>:</p>
1.1 grant 6695:
6696: <div class="itemizedlist">
6697: <ul type="disc">
6698: <li>
1.14 xtraeme 6699: <p><code class="varname">${OPSYS}</code> -
6700: output of “<span class=
6701: "quote"><span><strong class="command">uname
6702: -s</strong></span></span>”</p>
1.1 grant 6703: </li>
6704:
6705: <li>
1.14 xtraeme 6706: <p><code class=
6707: "varname">${LOWER_OPSYS}</code> - lowercase
6708: common name (eg. “<span class=
6709: "quote">solaris</span>”)</p>
1.1 grant 6710: </li>
6711:
6712: <li>
1.14 xtraeme 6713: <p><code class="varname">${OS_VERSION}</code>
6714: - “<span class=
6715: "quote"><span><strong class="command">uname
6716: -r</strong></span></span>”</p>
1.1 grant 6717: </li>
6718: </ul>
6719: </div>
6720: </dd>
6721:
1.14 xtraeme 6722: <dt><span class="term"><code class=
6723: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 6724:
6725: <dd>
6726: <p>Packages that install locale files should list
6727: them in the PLIST as “<span class=
6728: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
6729: instead of “<span class=
6730: "quote">share/locale/de/LC_MESSAGES/...</span>”.
6731: This properly handles the fact that different
6732: operating systems expect locale files to be either
1.14 xtraeme 6733: in <code class="filename">share</code> or
6734: <code class="filename">lib</code> by default.</p>
1.1 grant 6735: </dd>
6736: </dl>
6737: </div>
6738:
6739: <p>For a complete list of values which are replaced by
1.14 xtraeme 6740: default, please look in <code class=
6741: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 6742: "emphasis"><em>PLIST_SUBST</em></span>).</p>
6743:
6744: <p>If you want to change other variables not listed
6745: above, you can add variables and their expansions to this
1.14 xtraeme 6746: variable in the following way, similar to <code class=
6747: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 6748: "#components.optional" title=
1.27 rillig 6749: "7.5. Optional files">Section 7.5,
1.1 grant 6750: “Optional files”</a>):</p>
6751: <pre class="programlisting">
6752: PLIST_SUBST+= SOMEVAR="somevalue"
6753: </pre>
6754:
6755: <p>This replaces all occurrences of “<span class=
6756: "quote">${SOMEVAR}</span>” in the PLIST with
6757: “<span class="quote">somevalue</span>”.</p>
6758: </div>
6759:
6760: <div class="sect1" lang="en" xml:lang="en">
6761: <div class="titlepage">
6762: <div>
6763: <div>
6764: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6765: "manpage-compression" id=
6766: "manpage-compression"></a>9.5. Manpage-compression</h2>
1.1 grant 6767: </div>
6768: </div>
6769: </div>
6770:
6771: <p>Manpages should be installed in compressed form if
1.14 xtraeme 6772: <code class="varname">MANZ</code> is set (in <code class=
6773: "filename">bsd.own.mk</code>), and uncompressed
6774: otherwise. To handle this in the <code class=
6775: "filename">PLIST</code> file, the suffix
6776: “<span class="quote">.gz</span>” is
6777: appended/removed automatically for manpages according to
6778: <code class="varname">MANZ</code> and <code class=
6779: "varname">MANCOMPRESSED</code> being set or not, see
6780: above for details. This modification of the <code class=
6781: "filename">PLIST</code> file is done on a copy of it, not
6782: <code class="filename">PLIST</code> itself.</p>
1.1 grant 6783: </div>
6784:
6785: <div class="sect1" lang="en" xml:lang="en">
6786: <div class="titlepage">
6787: <div>
6788: <div>
6789: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6790: "using-PLIST_SRC" id=
6791: "using-PLIST_SRC"></a>9.6. Changing PLIST
6792: source with <code class=
1.14 xtraeme 6793: "varname">PLIST_SRC</code></h2>
1.1 grant 6794: </div>
6795: </div>
6796: </div>
6797:
1.14 xtraeme 6798: <p>To use one or more files as source for the
6799: <code class="filename">PLIST</code> used in generating
6800: the binary package, set the variable <code class=
6801: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 6802: The files are later concatenated using <a href=
6803: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
6804: <span class="citerefentry"><span class=
6805: "refentrytitle">cat</span>(1)</span></a>, and order of
6806: things is important.</p>
1.1 grant 6807: </div>
6808:
6809: <div class="sect1" lang="en" xml:lang="en">
6810: <div class="titlepage">
6811: <div>
6812: <div>
6813: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6814: "platform-specific-plist" id=
6815: "platform-specific-plist"></a>9.7. Platform
1.1 grant 6816: specific and differing PLISTs</h2>
6817: </div>
6818: </div>
6819: </div>
6820:
6821: <p>Some packages decide to install a different set of
6822: files based on the operating system being used. These
6823: differences can be automatically handled by using the
6824: following files:</p>
6825:
6826: <div class="itemizedlist">
6827: <ul type="disc">
6828: <li>
1.14 xtraeme 6829: <p><code class="filename">PLIST.common</code></p>
1.1 grant 6830: </li>
6831:
6832: <li>
1.14 xtraeme 6833: <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1 grant 6834: </li>
6835:
6836: <li>
1.14 xtraeme 6837: <p><code class=
1.21 ben 6838: "filename">PLIST.${MACHINE_ARCH}</code></p>
6839: </li>
6840:
6841: <li>
6842: <p><code class=
6843: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
6844: </li>
6845:
6846: <li>
6847: <p><code class=
1.14 xtraeme 6848: "filename">PLIST.common_end</code></p>
1.1 grant 6849: </li>
6850: </ul>
6851: </div>
6852: </div>
6853:
6854: <div class="sect1" lang="en" xml:lang="en">
6855: <div class="titlepage">
6856: <div>
6857: <div>
6858: <h2 class="title" style="clear: both"><a name=
6859: "faq.common-dirs" id=
1.25 rillig 6860: "faq.common-dirs"></a>9.8. Sharing directories
1.1 grant 6861: between packages</h2>
6862: </div>
6863: </div>
6864: </div>
6865:
6866: <p>A “<span class="quote">shared
6867: directory</span>” is a directory where multiple
6868: (and unrelated) packages install files. These directories
6869: are problematic because you have to add special tricks in
6870: the PLIST to conditionally remove them, or have some
6871: centralized package handle them.</p>
6872:
6873: <p>Within pkgsrc, you'll find both approaches. If a
6874: directory is shared by a few unrelated packages, it's
6875: often not worth to add an extra package to remove it.
6876: Therefore, one simply does:</p>
6877: <pre class="programlisting">
6878: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
6879:
6880: </pre>
6881:
6882: <p>in the PLISTs of all affected packages, instead of the
6883: regular "@dirrm" line.</p>
6884:
6885: <p>However, if the directory is shared across many
6886: packages, two different solutions are available:</p>
6887:
6888: <div class="orderedlist">
6889: <ol type="1">
6890: <li>
6891: <p>If the packages have a common dependency, the
6892: directory can be removed in that. For example, see
6893: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
6894: href=
6895: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20 ben 6896: class="pkgname">textproc/scrollkeeper</a>, which
6897: removes the shared directory <code class=
6898: "filename">share/omf</code>.</p>
1.1 grant 6899: </li>
6900:
6901: <li>
6902: <p>If the packages using the directory are not
6903: related at all (they have no common dependencies),
6904: a *-dirs package is used.</p>
6905: </li>
6906: </ol>
6907: </div>
6908:
6909: <p>From now on, we'll discuss the second solution. To get
6910: an idea of the *-dirs packages available, issue:</p>
6911: <pre class="programlisting">
1.14 xtraeme 6912: <code class="prompt">%</code> cd .../pkgsrc
6913: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 6914:
6915: </pre>
6916:
6917: <p>Their use from other packages is very simple. The
1.14 xtraeme 6918: <code class="varname">USE_DIRS</code> variable takes a
6919: list of package names (without the “<span class=
1.1 grant 6920: "quote">-dirs</span>” part) together with the
6921: required version number (always pick the latest one when
6922: writting new packages).</p>
6923:
6924: <p>For example, if a package installs files under
1.14 xtraeme 6925: <code class="filename">share/applications</code>, it
6926: should have the following line in it:</p>
1.1 grant 6927: <pre class="programlisting">
6928: USE_DIRS+= xdg-1.1
6929:
6930: </pre>
6931:
1.14 xtraeme 6932: <p>After regenerating the PLIST using
6933: <span><strong class="command">make
6934: print-PLIST</strong></span>, you should get the right
6935: (commented out) lines.</p>
1.1 grant 6936:
1.14 xtraeme 6937: <p>Note that, even if your package is using <code class=
6938: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 6939: *-x11-dirs packages. Just specify the name without that
1.14 xtraeme 6940: part and pkgsrc (in particular, <code class=
6941: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 6942: </div>
6943: </div>
6944:
6945: <div class="chapter" lang="en" xml:lang="en">
6946: <div class="titlepage">
6947: <div>
6948: <div>
6949: <h2 class="title"><a name="buildlink" id=
1.25 rillig 6950: "buildlink"></a>Chapter 10. Buildlink
1.1 grant 6951: methodology</h2>
6952: </div>
6953: </div>
6954: </div>
6955:
6956: <div class="toc">
6957: <p><b>Table of Contents</b></p>
6958:
6959: <dl>
1.30 wiz 6960: <dt><span class="sect1"><a href=
6961: "#converting-to-buildlink3">10.1. Converting packages
6962: to use buildlink3</a></span></dt>
1.1 grant 6963:
1.30 wiz 6964: <dt><span class="sect1"><a href=
6965: "#creating-buildlink3.mk">10.2. Writing <code class=
6966: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 6967:
6968: <dd>
6969: <dl>
1.25 rillig 6970: <dt><span class="sect2"><a href=
1.30 wiz 6971: "#anatomy-of-bl3">10.2.1. Anatomy of a
6972: buildlink3.mk file</a></span></dt>
1.1 grant 6973:
1.25 rillig 6974: <dt><span class="sect2"><a href=
1.30 wiz 6975: "#updating-buildlink-depends">10.2.2. Updating
6976: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 6977: "replaceable"><code>pkg</code></em></code> in
6978: <code class="filename">buildlink3.mk</code>
1.1 grant 6979: files</a></span></dt>
6980: </dl>
6981: </dd>
6982:
1.30 wiz 6983: <dt><span class="sect1"><a href=
6984: "#writing-builtin.mk">10.3. Writing <code class=
6985: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 6986:
6987: <dd>
6988: <dl>
1.25 rillig 6989: <dt><span class="sect2"><a href=
1.30 wiz 6990: "#anatomy-of-builtin.mk">10.3.1. Anatomy of a
6991: <code class="filename">builtin.mk</code>
6992: file</a></span></dt>
1.1 grant 6993:
1.25 rillig 6994: <dt><span class="sect2"><a href=
1.30 wiz 6995: "#native-or-pkgsrc-preference">10.3.2. Global
6996: preferences for native or pkgsrc
6997: software</a></span></dt>
1.1 grant 6998: </dl>
6999: </dd>
7000: </dl>
7001: </div>
7002:
7003: <p>Buildlink is a framework in pkgsrc that controls what
7004: headers and libraries are seen by a package's configure and
7005: build processes. This is implemented in a two step
7006: process:</p>
7007:
7008: <div class="orderedlist">
7009: <ol type="1">
7010: <li>
7011: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 7012: into <code class="varname">BUILDLINK_DIR</code>,
7013: which by default is a subdirectory of <code class=
7014: "varname">WRKDIR</code>.</p>
1.1 grant 7015: </li>
7016:
7017: <li>
7018: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 7019: the normal compiler tools that translate <code class=
7020: "option">-I${LOCALBASE}/include</code> and
7021: <code class="option">-L${LOCALBASE}/lib</code> into
7022: references to <code class=
7023: "varname">BUILDLINK_DIR</code>. The wrapper scripts
7024: also make native compiler on some operating systems
7025: look like GCC, so that packages that expect GCC won't
7026: require modifications to build with those native
7027: compilers.</p>
1.1 grant 7028: </li>
7029: </ol>
7030: </div>
7031:
7032: <p>This normalizes the environment in which a package is
7033: built so that the package may be built consistently despite
7034: what other software may be installed. Please note that the
1.14 xtraeme 7035: normal system header and library paths, e.g. <code class=
7036: "filename">/usr/include</code>, <code class=
7037: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 7038: buildlink3 is designed to insulate the package build from
7039: non-system-supplied software.</p>
7040:
7041: <div class="sect1" lang="en" xml:lang="en">
7042: <div class="titlepage">
7043: <div>
7044: <div>
7045: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7046: "converting-to-buildlink3" id=
7047: "converting-to-buildlink3"></a>10.1. Converting
7048: packages to use buildlink3</h2>
1.1 grant 7049: </div>
7050: </div>
7051: </div>
7052:
7053: <p>The process of converting packages to use the
7054: buildlink3 framework (“<span class=
7055: "quote">bl3ifying</span>”) is fairly
7056: straightforward. The things to keep in mind are:</p>
7057:
7058: <div class="orderedlist">
7059: <ol type="1">
7060: <li>
7061: <p>Ensure that the build always calls the wrapper
7062: scripts instead of the actual toolchain. Some
7063: packages are tricky, and the only way to know for
1.14 xtraeme 7064: sure is the check <code class=
7065: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 7066: wrappers are being invoked.</p>
7067: </li>
7068:
7069: <li>
1.14 xtraeme 7070: <p>Don't override <code class=
7071: "varname">PREFIX</code> from within the package
7072: Makefile, e.g. Java VMs, standalone shells, etc.,
7073: because the code to symlink files into <code class=
7074: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 7075: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 7076: <em class=
7077: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 7078: </li>
7079:
7080: <li>
7081: <p>Remember that <span class=
1.14 xtraeme 7082: "emphasis"><em>only</em></span> the <code class=
7083: "filename">buildlink3.mk</code> files that you list
1.1 grant 7084: in a package's Makefile are added as dependencies
7085: for that package.</p>
7086: </li>
7087: </ol>
7088: </div>
7089:
7090: <p>If a dependency on a particular package is required
7091: for its libraries and headers, then we replace:</p>
7092: <pre class="programlisting">
1.27 rillig 7093: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 7094: </pre>
7095:
7096: <p>with</p>
7097: <pre class="programlisting">
7098: .include "../../category/foo/buildlink3.mk"
7099: </pre>
7100:
1.14 xtraeme 7101: <p>There are several <code class=
7102: "filename">buildlink3.mk</code> files in <code class=
7103: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 7104: issues:</p>
7105:
7106: <div class="itemizedlist">
7107: <ul type="disc">
7108: <li>
1.14 xtraeme 7109: <p><code class="filename">bdb.buildlink3.mk</code>
1.1 grant 7110: chooses either the native or a pkgsrc Berkeley DB
1.14 xtraeme 7111: implementation based on the values of <code class=
7112: "varname">BDB_ACCEPTED</code> and <code class=
7113: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 7114: </li>
7115:
7116: <li>
1.14 xtraeme 7117: <p><code class=
7118: "filename">curses.buildlink3.mk</code> If the
7119: system comes with neither Curses nor NCurses, this
7120: will take care to install the <a xmlns=
7121: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 7122: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20 ben 7123: class="pkgname">devel/ncurses</a> package.</p>
1.1 grant 7124: </li>
7125:
7126: <li>
1.14 xtraeme 7127: <p><code class="filename">krb5.buildlink3.mk</code>
7128: uses the value of <code class=
7129: "varname">KRB5_ACCEPTED</code> to choose between
1.1 grant 7130: adding a dependency on Heimdal or MIT-krb5 for
7131: packages that require a Kerberos 5
7132: implementation.</p>
7133: </li>
7134:
7135: <li>
1.14 xtraeme 7136: <p><code class=
7137: "filename">motif.buildlink3.mk</code> checks for a
7138: system-provided Motif installation or adds a
7139: dependency on <a xmlns=
1.1 grant 7140: "http://www.w3.org/TR/xhtml1/transitional" href=
7141: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20 ben 7142: class="pkgname">x11/lesstif</a> or <a xmlns=
7143: "http://www.w3.org/TR/xhtml1/transitional" href=
7144: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
7145: class="pkgname">x11/openmotif</a>;</p>
1.1 grant 7146: </li>
7147:
7148: <li>
1.14 xtraeme 7149: <p><code class=
7150: "filename">ossaudio.buildlink3.mk</code> defines
7151: several variables that may be used by packages that
7152: use the Open Sound System (OSS) API;</p>
1.1 grant 7153: </li>
7154:
7155: <li>
1.14 xtraeme 7156: <p><code class=
7157: "filename">pgsql.buildlink3.mk</code> will accept
7158: either Postgres 7.3 or 7.4, whichever is found
7159: installed. See the file for more information.</p>
1.1 grant 7160: </li>
7161:
7162: <li>
1.14 xtraeme 7163: <p><code class=
7164: "filename">pthread.buildlink3.mk</code> uses the
7165: value of <code class="varname">PTHREAD_OPTS</code>
7166: and checks for native pthreads or adds a dependency
7167: on <a xmlns=
1.1 grant 7168: "http://www.w3.org/TR/xhtml1/transitional" href=
7169: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20 ben 7170: class="pkgname">devel/pth</a> as needed;</p>
1.1 grant 7171: </li>
7172:
7173: <li>
1.14 xtraeme 7174: <p><code class="filename">xaw.buildlink3.mk</code>
7175: uses the value of <code class=
7176: "varname">XAW_TYPE</code> to choose a particular
7177: Athena widgets library.</p>
1.1 grant 7178: </li>
7179: </ul>
7180: </div>
7181:
1.14 xtraeme 7182: <p>The comments in those <code class=
7183: "filename">buildlink3.mk</code> files provide a more
1.1 grant 7184: complete description of how to use them properly.</p>
7185: </div>
7186:
7187: <div class="sect1" lang="en" xml:lang="en">
7188: <div class="titlepage">
7189: <div>
7190: <div>
7191: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7192: "creating-buildlink3.mk" id=
7193: "creating-buildlink3.mk"></a>10.2. Writing
1.14 xtraeme 7194: <code class="filename">buildlink3.mk</code>
7195: files</h2>
1.1 grant 7196: </div>
7197: </div>
7198: </div>
7199:
1.14 xtraeme 7200: <p>A package's <code class=
7201: "filename">buildlink3.mk</code> file is included by
7202: Makefiles to indicate the need to compile and link
7203: against header files and libraries provided by the
7204: package. A <code class="filename">buildlink3.mk</code>
7205: file should always provide enough information to add the
7206: correct type of dependency relationship and include any
7207: other <code class="filename">buildlink3.mk</code> files
7208: that it needs to find headers and libraries that it needs
7209: in turn.</p>
1.1 grant 7210:
1.14 xtraeme 7211: <p>To generate an initial <code class=
7212: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 7213: Rene Hexel's <a xmlns=
7214: "http://www.w3.org/TR/xhtml1/transitional" href=
7215: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20 ben 7216: class="pkgname">pkgtools/createbuildlink</a> package is
7217: highly recommended. For most packages, the following
7218: command will generate a good starting point for
7219: <code class="filename">buildlink3.mk</code> files:</p>
1.1 grant 7220: <pre class="screen">
1.14 xtraeme 7221: <code class="prompt">%</code> <strong class=
7222: "userinput"><code>cd pkgsrc/<em class=
7223: "replaceable"><code>category</code></em>/<em class=
7224: "replaceable"><code>pkgdir</code></em>
7225: <code class=
7226: "prompt">%</code> createbuildlink -3 >buildlink3.mk</code></strong>
1.1 grant 7227: </pre>
7228:
7229: <div class="sect2" lang="en" xml:lang="en">
7230: <div class="titlepage">
7231: <div>
7232: <div>
1.30 wiz 7233: <h3 class="title"><a name="anatomy-of-bl3" id=
7234: "anatomy-of-bl3"></a>10.2.1. Anatomy of a
1.25 rillig 7235: buildlink3.mk file</h3>
1.1 grant 7236: </div>
7237: </div>
7238: </div>
7239:
1.14 xtraeme 7240: <p>The following real-life example <code class=
7241: "filename">buildlink3.mk</code> is taken from
7242: <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 7243: <pre class="programlisting">
1.17 sketch 7244: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 7245:
7246: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
7247: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
7248:
7249: .if !empty(BUILDLINK_DEPTH:M+)
7250: BUILDLINK_DEPENDS+= tiff
7251: .endif
7252:
7253: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
7254: BUILDLINK_PACKAGES+= tiff
7255:
7256: .if !empty(TIFF_BUILDLINK3_MK:M+)
7257: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
7258: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
7259: .endif # TIFF_BUILDLINK3_MK
7260:
7261: .include "../../devel/zlib/buildlink3.mk"
7262: .include "../../graphics/jpeg/buildlink3.mk"
7263:
7264: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
7265: </pre>
7266:
1.14 xtraeme 7267: <p>The header and footer manipulate <code class=
7268: "varname">BUILDLINK_DEPTH</code>, which is common
7269: across all <code class="filename">buildlink3.mk</code>
7270: files and is used to track at what depth we are
7271: including <code class="filename">buildlink3.mk</code>
7272: files.</p>
1.1 grant 7273:
7274: <p>The first section controls if the dependency on
1.14 xtraeme 7275: <em class="replaceable"><code>pkg</code></em> is added.
7276: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 7277: global list of packages for which dependencies are
7278: added by buildlink3.</p>
7279:
7280: <p>The second section advises pkgsrc that the
1.14 xtraeme 7281: <code class="filename">buildlink3.mk</code> file for
7282: <em class="replaceable"><code>pkg</code></em> has been
7283: included at some point. <code class=
7284: "varname">BUILDLINK_PACKAGES</code> is the global list
7285: of packages for which <code class=
7286: "filename">buildlink3.mk</code> files have been
7287: included. It must <span class=
7288: "emphasis"><em>always</em></span> be appended to within
7289: a <code class="filename">buildlink3.mk</code> file.</p>
1.1 grant 7290:
7291: <p>The third section is protected from multiple
1.14 xtraeme 7292: inclusion and controls how the dependency on <em class=
7293: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 7294: important variables are set in the section:</p>
7295:
7296: <div class="itemizedlist">
7297: <ul type="disc">
7298: <li>
1.14 xtraeme 7299: <p><code class=
7300: "varname">BUILDLINK_DEPENDS.<em class=
7301: "replaceable"><code>pkg</code></em></code> is the
7302: actual dependency recorded in the installed
7303: package; this should always be set using
7304: <span><strong class="command">+=</strong></span>
7305: to ensure that we're appending to any
7306: pre-existing list of values. This variable should
7307: be set to the first version of the package that
7308: had the last change in the major number of a
7309: shared library or that had a major API
7310: change.</p>
1.1 grant 7311: </li>
7312:
7313: <li>
1.14 xtraeme 7314: <p><code class=
7315: "varname">BUILDLINK_PKGSRCDIR.<em class=
7316: "replaceable"><code>pkg</code></em></code> is the
7317: location of the <em class=
7318: "replaceable"><code>pkg</code></em> pkgsrc
1.1 grant 7319: directory;</p>
7320: </li>
7321:
7322: <li>
1.14 xtraeme 7323: <p><code class=
7324: "varname">BUILDLINK_DEPMETHOD.<em class=
7325: "replaceable"><code>pkg</code></em></code> (not
7326: shown above) controls whether we use <code class=
7327: "varname">BUILD_DEPENDS</code> or <code class=
7328: "varname">DEPENDS</code> to add the dependency on
7329: <em class="replaceable"><code>pkg</code></em>.
7330: The build dependency is selected by setting
7331: <code class=
7332: "varname">BUILDLINK_DEPMETHOD.<em class=
7333: "replaceable"><code>pkg</code></em></code> to
1.1 grant 7334: “<span class="quote">build</span>”.
7335: By default, the full dependency is used.</p>
7336: </li>
7337:
7338: <li>
1.14 xtraeme 7339: <p><code class=
7340: "varname">BUILDLINK_INCDIRS.<em class=
7341: "replaceable"><code>pkg</code></em></code> and
7342: <code class=
7343: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
7344: <code>pkg</code></em></code> (not shown above)
7345: are lists of subdirectories of <code class=
7346: "filename">${BUILDLINK_PREFIX.<em class=
7347: "replaceable"><code>pkg</code></em>}</code> to
7348: add to the header and library search paths. These
1.1 grant 7349: default to “<span class=
7350: "quote">include</span>” and
7351: “<span class="quote">lib</span>”
7352: respectively.</p>
7353: </li>
7354:
7355: <li>
1.14 xtraeme 7356: <p><code class=
7357: "varname">BUILDLINK_CPPFLAGS.<em class=
7358: "replaceable"><code>pkg</code></em></code> (not
7359: shown above) is the list of preprocessor flags to
7360: add to <code class="varname">CPPFLAGS</code>,
7361: which are passed on to the configure and build
7362: phases. The “<span class=
7363: "quote">-I</span>” option should be avoided
7364: and instead be handled using <code class=
7365: "varname">BUILDLINK_INCDIRS.<em class=
7366: "replaceable"><code>pkg</code></em></code> as
7367: above.</p>
1.1 grant 7368: </li>
7369: </ul>
7370: </div>
7371:
7372: <p>The following variables are all optionally defined
7373: within this second section (protected against multiple
7374: inclusion) and control which package files are
1.14 xtraeme 7375: symlinked into <code class=
7376: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 7377: are transformed during the symlinking:</p>
7378:
7379: <div class="itemizedlist">
7380: <ul type="disc">
7381: <li>
1.14 xtraeme 7382: <p><code class=
7383: "varname">BUILDLINK_FILES.<em class=
7384: "replaceable"><code>pkg</code></em></code> (not
7385: shown above) is a shell glob pattern relative to
7386: <code class=
7387: "filename">${BUILDLINK_PREFIX.<em class=
7388: "replaceable"><code>pkg</code></em>}</code> to be
7389: symlinked into <code class=
7390: "filename">${BUILDLINK_DIR}</code>, e.g.
7391: <code class="filename">include/*.h</code>.</p>
1.1 grant 7392: </li>
7393:
7394: <li>
1.14 xtraeme 7395: <p><code class=
7396: "varname">BUILDLINK_FILES_CMD.<em class=
7397: "replaceable"><code>pkg</code></em></code> (not
7398: shown above) is a shell pipeline that outputs to
7399: stdout a list of files relative to <code class=
7400: "filename">${BUILDLINK_PREFIX.<em class=
7401: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 7402: resulting files are to be symlinked into
1.14 xtraeme 7403: <code class="filename">${BUILDLINK_DIR}</code>.
7404: By default, this takes the <code class=
7405: "filename">+CONTENTS</code> of a <em class=
7406: "replaceable"><code>pkg</code></em> and filters
7407: it through <code class=
7408: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
7409: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 7410: </li>
7411:
7412: <li>
1.14 xtraeme 7413: <p><code class=
7414: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
7415: "replaceable"><code>pkg</code></em></code> (not
7416: shown above) is a filter command that filters
7417: <code class="filename">+CONTENTS</code> input
7418: into a list of files relative to <code class=
7419: "filename">${BUILDLINK_PREFIX.<em class=
7420: "replaceable"><code>pkg</code></em>}</code> on
7421: stdout. By default for overwrite packages,
7422: <code class=
7423: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
7424: "replaceable"><code>pkg</code></em></code>
7425: outputs the contents of the <code class=
7426: "filename">include</code> and <code class=
7427: "filename">lib</code> directories in the package
7428: <code class="filename">+CONTENTS</code>, and for
7429: pkgviews packages, it outputs any libtool
7430: archives in <code class="filename">lib</code>
1.1 grant 7431: directories.</p>
7432: </li>
7433:
7434: <li>
1.14 xtraeme 7435: <p><code class=
7436: "varname">BUILDLINK_TRANSFORM.<em class=
7437: "replaceable"><code>pkg</code></em></code> (not
7438: shown above) is a list of sed arguments used to
1.1 grant 7439: transform the name of the source filename into a
1.14 xtraeme 7440: destination filename, e.g. <span><strong class=
1.1 grant 7441: "command">-e
1.14 xtraeme 7442: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 7443: </li>
7444: </ul>
7445: </div>
7446:
1.14 xtraeme 7447: <p>The last section includes any <code class=
7448: "filename">buildlink3.mk</code> needed for <em class=
7449: "replaceable"><code>pkg</code></em>'s library
7450: dependencies. Including these <code class=
7451: "filename">buildlink3.mk</code> files means that the
7452: headers and libraries for these dependencies are also
7453: symlinked into <code class=
7454: "filename">${BUILDLINK_DIR}</code> whenever the
7455: <em class="replaceable"><code>pkg</code></em>
7456: <code class="filename">buildlink3.mk</code> file is
7457: included.</p>
1.1 grant 7458: </div>
7459:
7460: <div class="sect2" lang="en" xml:lang="en">
7461: <div class="titlepage">
7462: <div>
7463: <div>
1.30 wiz 7464: <h3 class="title"><a name=
7465: "updating-buildlink-depends" id=
7466: "updating-buildlink-depends"></a>10.2.2. Updating
7467: <code class=
7468: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
7469: <code>pkg</code></em></code> in <code class=
7470: "filename">buildlink3.mk</code> files</h3>
1.1 grant 7471: </div>
7472: </div>
7473: </div>
7474:
7475: <p>There are two situations that require increasing the
1.14 xtraeme 7476: dependency listed in <code class=
7477: "varname">BUILDLINK_DEPENDS.<em class=
7478: "replaceable"><code>pkg</code></em></code> after a
7479: package update:</p>
1.1 grant 7480:
7481: <div class="orderedlist">
7482: <ol type="1">
7483: <li>
7484: <p>if the sonames (major number of the library
7485: version) of any installed shared libraries
7486: change;</p>
7487: </li>
7488:
7489: <li>
7490: <p>if the API or interface to the header files
7491: change.</p>
7492: </li>
7493: </ol>
7494: </div>
7495:
1.14 xtraeme 7496: <p>In these cases, <code class=
7497: "varname">BUILDLINK_DEPENDS.<em class=
7498: "replaceable"><code>pkg</code></em></code> should be
7499: adjusted to require at least the new package version.
7500: In some cases, the packages that depend on this new
7501: version may need their <code class=
7502: "varname">PKGREVISION</code>s increased and, if they
7503: have <code class="filename">buildlink3.mk</code> files,
7504: their <code class=
7505: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
7506: pkg</code></em></code> adjusted, too. This is needed so
7507: that binary packages made using it will require the
7508: correct package dependency and not settle for an older
7509: one which will not contain the necessary shared
7510: libraries.</p>
1.1 grant 7511:
7512: <p>Please take careful consideration before adjusting
1.14 xtraeme 7513: <code class="varname">BUILDLINK_DEPENDS.<em class=
7514: "replaceable"><code>pkg</code></em></code> as we don't
7515: want to cause unneeded package deletions and rebuilds.
7516: In many cases, new versions of packages work just fine
7517: with older dependencies. See <a href="#dependencies"
1.31 wiz 7518: title="13.1.4. Handling dependencies">Section
7519: 13.1.4, “Handling dependencies”</a> and
1.14 xtraeme 7520: <a href="#buildlink" title=
1.25 rillig 7521: "Chapter 10. Buildlink methodology">Chapter
7522: 10, <i>Buildlink methodology</i></a> for more
7523: information about dependencies on other packages,
7524: including the <code class=
7525: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
7526: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 7527: </div>
7528: </div>
7529:
7530: <div class="sect1" lang="en" xml:lang="en">
7531: <div class="titlepage">
7532: <div>
7533: <div>
7534: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7535: "writing-builtin.mk" id=
7536: "writing-builtin.mk"></a>10.3. Writing
1.14 xtraeme 7537: <code class="filename">builtin.mk</code> files</h2>
1.1 grant 7538: </div>
7539: </div>
7540: </div>
7541:
7542: <p>Some packages in pkgsrc install headers and libraries
7543: that coincide with headers and libraries present in the
1.14 xtraeme 7544: base system. Aside from a <code class=
7545: "filename">buildlink3.mk</code> file, these packages
7546: should also include a <code class=
7547: "filename">builtin.mk</code> file that includes the
7548: necessary checks to decide whether using the built-in
7549: software or the pkgsrc software is appropriate.</p>
1.1 grant 7550:
7551: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 7552: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 7553:
7554: <div class="orderedlist">
7555: <ol type="1">
7556: <li>
1.14 xtraeme 7557: <p>It should set <code class=
7558: "varname">USE_BUILTIN.<em class=
7559: "replaceable"><code>pkg</code></em></code> to
7560: either “<span class="quote">yes</span>”
7561: or “<span class="quote">no</span>”
7562: after it is included.</p>
1.1 grant 7563: </li>
7564:
7565: <li>
7566: <p>It should <span class=
7567: "emphasis"><em>not</em></span> override any
1.14 xtraeme 7568: <code class="varname">USE_BUILTIN.<em class=
7569: "replaceable"><code>pkg</code></em></code> which is
7570: already set before the <code class=
7571: "filename">builtin.mk</code> file is included.</p>
1.1 grant 7572: </li>
7573:
7574: <li>
7575: <p>It should be written to allow multiple
7576: inclusion. This is <span class=
7577: "emphasis"><em>very</em></span> important and takes
1.14 xtraeme 7578: careful attention to <code class=
7579: "filename">Makefile</code> coding.</p>
1.1 grant 7580: </li>
7581: </ol>
7582: </div>
7583:
7584: <div class="sect2" lang="en" xml:lang="en">
7585: <div class="titlepage">
7586: <div>
7587: <div>
1.30 wiz 7588: <h3 class="title"><a name="anatomy-of-builtin.mk"
7589: id=
7590: "anatomy-of-builtin.mk"></a>10.3.1. Anatomy
7591: of a <code class="filename">builtin.mk</code>
1.14 xtraeme 7592: file</h3>
1.1 grant 7593: </div>
7594: </div>
7595: </div>
7596:
7597: <p>The following is the recommended template for
7598: builtin.mk files:</p>
7599: <pre class="programlisting">
7600: .if !defined(IS_BUILTIN.foo)
7601: #
7602: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
7603: # genuinely exists in the system or not.
7604: #
7605: IS_BUILTIN.foo?= no
7606:
7607: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
7608: # version can be determined.
7609: #
7610: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
7611: BUILTIN_PKG.foo?= foo-1.0
7612: . endif
7613: .endif # IS_BUILTIN.foo
7614:
7615: .if !defined(USE_BUILTIN.foo)
7616: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
7617: . if defined(BUILTIN_PKG.foo)
7618: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
7619: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
7620: USE_BUILTIN.foo!= \
7621: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
7622: ${ECHO} "yes"; \
7623: else \
7624: ${ECHO} "no"; \
7625: fi
7626: . endif
7627: . endfor
7628: . endif
7629: .endif # USE_BUILTIN.foo
7630:
7631: CHECK_BUILTIN.foo?= no
7632: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
7633: #
7634: # Here we place code that depends on whether USE_BUILTIN.foo is set to
7635: # "yes" or "no".
7636: #
7637: .endif # CHECK_BUILTIN.foo
7638:
7639: </pre>
7640:
1.14 xtraeme 7641: <p>The first section sets <code class=
7642: "varname">IS_BUILTIN.<em class=
7643: "replaceable"><code>pkg</code></em></code> depending on
7644: if <em class="replaceable"><code>pkg</code></em> really
7645: exists in the base system. This should not be a base
7646: system software with similar functionality to
7647: <em class="replaceable"><code>pkg</code></em>; it
7648: should only be “<span class=
7649: "quote">yes</span>” if the actual package is
7650: included as part of the base system. This variable is
7651: only used internally within the <code class=
7652: "filename">builtin.mk</code> file.</p>
7653:
7654: <p>The second section sets <code class=
7655: "varname">BUILTIN_PKG.<em class=
7656: "replaceable"><code>pkg</code></em></code> to the
7657: version of <em class=
7658: "replaceable"><code>pkg</code></em> in the base system
7659: if it exists (if <code class=
7660: "varname">IS_BUILTIN.<em class=
7661: "replaceable"><code>pkg</code></em></code> is
1.1 grant 7662: “<span class="quote">yes</span>”). This
1.14 xtraeme 7663: variable is only used internally within the
7664: <code class="filename">builtin.mk</code> file.</p>
1.1 grant 7665:
1.14 xtraeme 7666: <p>The third section sets <code class=
7667: "varname">USE_BUILTIN.<em class=
7668: "replaceable"><code>pkg</code></em></code> and is
7669: <span class="emphasis"><em>required</em></span> in all
7670: <code class="filename">builtin.mk</code> files. The
7671: code in this section must make the determination
7672: whether the built-in software is adequate to satisfy
7673: the dependencies listed in <code class=
7674: "varname">BUILDLINK_DEPENDS.<em class=
7675: "replaceable"><code>pkg</code></em></code>. This is
7676: typically done by comparing <code class=
7677: "varname">BUILTIN_PKG.<em class=
7678: "replaceable"><code>pkg</code></em></code> against each
7679: of the dependencies in <code class=
7680: "varname">BUILDLINK_DEPENDS.<em class=
7681: "replaceable"><code>pkg</code></em></code>.
7682: <code class="varname">USE_BUILTIN.<em class=
7683: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 7684: "emphasis"><em>must</em></span> be set to the correct
1.14 xtraeme 7685: value by the end of the <code class=
7686: "filename">builtin.mk</code> file. Note that
7687: <code class="varname">USE_BUILTIN.<em class=
7688: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 7689: “<span class="quote">yes</span>” even if
1.14 xtraeme 7690: <code class="varname">IS_BUILTIN.<em class=
7691: "replaceable"><code>pkg</code></em></code> is
1.1 grant 7692: “<span class="quote">no</span>” because we
7693: may make the determination that the built-in version of
7694: the software is similar enough to be used as a
7695: replacement.</p>
7696:
1.14 xtraeme 7697: <p>The last section is guarded by <code class=
7698: "varname">CHECK_BUILTIN.<em class=
7699: "replaceable"><code>pkg</code></em></code>, and
7700: includes code that uses the value of <code class=
7701: "varname">USE_BUILTIN.<em class=
7702: "replaceable"><code>pkg</code></em></code> set in the
7703: previous section. This typically includes, e.g., adding
1.1 grant 7704: additional dependency restrictions and listing
1.14 xtraeme 7705: additional files to symlink into <code class=
7706: "filename">${BUILDLINK_DIR}</code> (via <code class=
7707: "varname">BUILDLINK_FILES.<em class=
7708: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 7709: </div>
7710:
7711: <div class="sect2" lang="en" xml:lang="en">
7712: <div class="titlepage">
7713: <div>
7714: <div>
1.30 wiz 7715: <h3 class="title"><a name=
7716: "native-or-pkgsrc-preference" id=
7717: "native-or-pkgsrc-preference"></a>10.3.2. Global
7718: preferences for native or pkgsrc software</h3>
1.1 grant 7719: </div>
7720: </div>
7721: </div>
7722:
7723: <p>When building packages, it's possible to choose
7724: whether to set a global preference for using either the
7725: built-in (native) version or the pkgsrc version of
7726: software to satisfy a dependency. This is controlled by
1.14 xtraeme 7727: setting <code class="varname">PREFER_PKGSRC</code> and
7728: <code class="varname">PREFER_NATIVE</code>. These
7729: variables take values of either “<span class=
1.1 grant 7730: "quote">yes</span>”, “<span class=
7731: "quote">no</span>”, or a list of packages.
1.14 xtraeme 7732: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
7733: to use the pkgsrc versions of software, while
7734: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
7735: to use the built-in versions. Preferences are
7736: determined by the most specific instance of the package
7737: in either <code class="varname">PREFER_PKGSRC</code> or
7738: <code class="varname">PREFER_NATIVE</code>. If a
7739: package is specified in neither or in both variables,
7740: then <code class="varname">PREFER_PKGSRC</code> has
7741: precedence over <code class=
7742: "varname">PREFER_NATIVE</code>. For example, to require
7743: using pkgsrc versions of software for all but the most
7744: basic bits on a NetBSD system, you can set:</p>
1.1 grant 7745: <pre class="programlisting">
7746: PREFER_PKGSRC= yes
7747: PREFER_NATIVE= getopt skey tcp_wrappers
7748:
7749: </pre>
7750:
7751: <p>A package <span class=
1.14 xtraeme 7752: "emphasis"><em>must</em></span> have a <code class=
7753: "filename">builtin.mk</code> file to be listed in
7754: <code class="varname">PREFER_NATIVE</code>, otherwise
7755: it is simply ignored in that list.</p>
1.1 grant 7756: </div>
7757: </div>
7758: </div>
7759:
7760: <div class="chapter" lang="en" xml:lang="en">
7761: <div class="titlepage">
7762: <div>
7763: <div>
7764: <h2 class="title"><a name="options" id=
1.25 rillig 7765: "options"></a>Chapter 11. Options
1.1 grant 7766: handling</h2>
7767: </div>
7768: </div>
7769: </div>
7770:
7771: <div class="toc">
7772: <p><b>Table of Contents</b></p>
7773:
7774: <dl>
1.30 wiz 7775: <dt><span class="sect1"><a href=
7776: "#global-default-options">11.1. Global default
7777: options</a></span></dt>
1.1 grant 7778:
1.30 wiz 7779: <dt><span class="sect1"><a href=
7780: "#converting-to-options">11.2. Converting packages to
7781: use <code class=
1.14 xtraeme 7782: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 7783: </dl>
7784: </div>
7785:
7786: <p>Many packages have the ability to be built to support
1.14 xtraeme 7787: different sets of features. <code class=
7788: "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1 grant 7789: that provides generic handling of those options that
7790: determine different ways in which the packages can be
7791: built. It's possible for the user to specify exactly which
7792: sets of options will be built into a package or to allow a
7793: set of global default options apply.</p>
7794:
7795: <div class="sect1" lang="en" xml:lang="en">
7796: <div class="titlepage">
7797: <div>
7798: <div>
7799: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7800: "global-default-options" id=
7801: "global-default-options"></a>11.1. Global
1.1 grant 7802: default options</h2>
7803: </div>
7804: </div>
7805: </div>
7806:
1.14 xtraeme 7807: <p>Global default options are listed in <code class=
7808: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1 grant 7809: the options that should be built into every package if
7810: that option is supported. This variable should be set in
1.14 xtraeme 7811: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 7812: </div>
7813:
7814: <div class="sect1" lang="en" xml:lang="en">
7815: <div class="titlepage">
7816: <div>
7817: <div>
7818: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7819: "converting-to-options" id=
7820: "converting-to-options"></a>11.2. Converting
7821: packages to use <code class=
1.14 xtraeme 7822: "filename">bsd.options.mk</code></h2>
1.1 grant 7823: </div>
7824: </div>
7825: </div>
7826:
1.14 xtraeme 7827: <p>The following example shows how <code class=
1.27 rillig 7828: "filename">bsd.options.mk</code> should be used by the
7829: hypothetical ``wibble'' package, either in the package
7830: <code class="filename">Makefile</code>, or in a file,
7831: e.g. <code class="filename">options.mk</code>, that is
7832: included by the main package <code class=
1.14 xtraeme 7833: "filename">Makefile</code>.</p>
1.1 grant 7834: <pre class="programlisting">
7835: # Global and legacy options
7836: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
7837: PKG_SUPPORTED_OPTIONS= ldap sasl
1.27 rillig 7838: PKG_SUGGESTED_OPTIONS= sasl
7839: PKG_OPTION_LEGACY_VARS= WIBBLE_USE_OPENLDAP:ldap USE_SASL2:sasl
7840:
1.1 grant 7841: .include "../../mk/bsd.options.mk"
7842:
7843: # Package-specific option-handling
7844:
7845: ###
7846: ### LDAP support
7847: ###
7848: .if !empty(PKG_OPTIONS:Mldap)
7849: . include "../../databases/openldap/buildlink3.mk"
7850: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
7851: .endif
7852:
7853: ###
7854: ### SASL authentication
7855: ###
7856: .if !empty(PKG_OPTIONS:Msasl)
7857: . include "../../security/cyrus-sasl2/buildlink3.mk"
7858: CONFIGURE_ARGS+= --enable-sasl=${BUILDLINK_PREFIX.sasl}
7859: .endif
7860:
7861: </pre>
7862:
1.28 rillig 7863: <p>The first section contains the information about which
7864: build options are supported by the package, and any
1.1 grant 7865: default options settings if needed.</p>
7866:
7867: <div class="orderedlist">
7868: <ol type="1">
7869: <li>
1.14 xtraeme 7870: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 7871: the name of the <a href=
1.1 grant 7872: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7873: <span class="citerefentry"><span class=
1.27 rillig 7874: "refentrytitle">make</span>(1)</span></a> variable
7875: that contains the options the user wishes to
7876: select. The recommended value is
7877: “<span class="quote">PKG_OPTIONS.<em class=
1.14 xtraeme 7878: "replaceable"><code>pkg</code></em></span>”
7879: but any package-specific value may be used. This
1.1 grant 7880: variable should be set in a package Makefile.</p>
7881: </li>
7882:
7883: <li>
1.14 xtraeme 7884: <p><code class=
7885: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
7886: build options supported by the package. This
7887: variable should be set in a package Makefile.</p>
1.1 grant 7888: </li>
7889:
7890: <li>
1.27 rillig 7891: <p><code class=
7892: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
7893: build options which are enabled by default.</p>
7894: </li>
7895:
7896: <li>
1.14 xtraeme 7897: <p><code class="varname">${PKG_OPTIONS_VAR}</code>
1.27 rillig 7898: (the variable named in <code class=
7899: "varname">PKG_OPTIONS_VAR</code>) lists the
7900: selected build options and overrides any default
7901: options given in <code class=
1.14 xtraeme 7902: "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1 grant 7903: options begin with a “<span class=
7904: "quote">-</span>”, then that option is always
7905: removed from the selected build options, e.g.</p>
7906: <pre class="programlisting">
7907: PKG_DEFAULT_OPTIONS= kerberos ldap sasl
7908: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
7909: WIBBLE_OPTIONS= ${PKG_DEFAULT_OPTIONS} -sasl
1.28 rillig 7910: # leads to PKG_OPTIONS = kerberos ldap
1.1 grant 7911:
7912: </pre>
7913:
7914: <p>or</p>
7915: <pre class="programlisting">
7916: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
7917: WIBBLE_OPTIONS= kerberos -ldap ldap
1.28 rillig 7918: # leads to PKG_OPTIONS = kerberos
1.1 grant 7919:
7920: </pre>
7921:
1.14 xtraeme 7922: <p>This variable should be set in <code class=
7923: "filename">/etc/mk.conf</code>.</p>
1.1 grant 7924: </li>
7925:
7926: <li>
1.28 rillig 7927: <p>The <code class=
7928: "varname">PKG_OPTIONS_LEGACY_VARS</code> is only
7929: needed if you are converting a package that had its
7930: own ad-hoc options handling to use <code class=
7931: "filename">bsd.options.mk</code>. It converts
7932: global or legacy options variables into an
7933: equivalent <code class=
7934: "varname">PKG_OPTIONS.<em class=
7935: "replaceable"><code>pkg</code></em></code>
7936: value.</p>
1.1 grant 7937: </li>
1.28 rillig 7938: </ol>
1.1 grant 7939: </div>
7940:
1.28 rillig 7941: <p>After the inclusion of bsd.options.mk, the variable
7942: <code class="varname">PKG_OPTIONS</code> contains the
7943: list of the selected build options, properly filtered to
7944: remove unsupported and duplicate options.</p>
7945:
1.1 grant 7946: <p>The remaining sections contain the logic that is
7947: specific to each option. There should be a check for
1.14 xtraeme 7948: every option listed in <code class=
7949: "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
7950: be clear documentation on what turning on the option will
7951: do in the comments preceding each section. The correct
7952: way to check for an option is to check whether it is
7953: listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1 grant 7954: </div>
7955: </div>
7956:
7957: <div class="chapter" lang="en" xml:lang="en">
7958: <div class="titlepage">
7959: <div>
7960: <div>
7961: <h2 class="title"><a name="build" id=
1.25 rillig 7962: "build"></a>Chapter 12. The build
1.1 grant 7963: process</h2>
7964: </div>
7965: </div>
7966: </div>
7967:
7968: <div class="toc">
7969: <p><b>Table of Contents</b></p>
7970:
7971: <dl>
1.25 rillig 7972: <dt><span class="sect1"><a href="#build.prefix">12.1.
1.1 grant 7973: Program location</a></span></dt>
7974:
1.30 wiz 7975: <dt><span class="sect1"><a href="#main-targets">12.2.
7976: Main targets</a></span></dt>
1.1 grant 7977:
7978: <dt><span class="sect1"><a href=
1.25 rillig 7979: "#build.helpful-targets">12.3. Other helpful
1.1 grant 7980: targets</a></span></dt>
7981: </dl>
7982: </div>
7983:
7984: <p>The basic steps for building a program are always the
7985: same. First the program's source (<span class=
7986: "emphasis"><em>distfile</em></span>) must be brought to the
7987: local system and then extracted. After any patches to
7988: compile properly on NetBSD are applied, the software can be
7989: configured, then built (usually by compiling), and finally
7990: the generated binaries, etc. can be put into place on the
7991: system. These are exactly the steps performed by the NetBSD
7992: package system, which is implemented as a series of targets
1.14 xtraeme 7993: in a central Makefile, <code class=
7994: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 7995:
7996: <div class="sect1" lang="en" xml:lang="en">
7997: <div class="titlepage">
7998: <div>
7999: <div>
8000: <h2 class="title" style="clear: both"><a name=
8001: "build.prefix" id=
1.25 rillig 8002: "build.prefix"></a>12.1. Program location</h2>
1.1 grant 8003: </div>
8004: </div>
8005: </div>
8006:
8007: <p>Before outlining the process performed by the NetBSD
8008: package system in the next section, here's a brief
8009: discussion on where programs are installed, and which
8010: variables influence this.</p>
8011:
1.14 xtraeme 8012: <p>The automatic variable <code class=
8013: "varname">PREFIX</code> indicates where all files of the
8014: final program shall be installed. It is usually set to
8015: <code class="varname">LOCALBASE</code> (<code class=
8016: "filename">/usr/pkg</code>), or <code class=
8017: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 8018: “<span class="quote">cross</span>” category.
1.14 xtraeme 8019: The value of <code class="varname">PREFIX</code> needs to
8020: be put into the various places in the program's source
8021: where paths to these files are encoded. See <a href=
1.1 grant 8022: "#components.patches" title=
1.27 rillig 8023: "7.3. patches/*">Section 7.3,
1.1 grant 8024: “patches/*”</a> and <a href="#fixes.libtool"
8025: title=
1.25 rillig 8026: "13.3.1. Shared libraries - libtool">Section 13.3.1,
1.1 grant 8027: “Shared libraries - libtool”</a> for more
8028: details.</p>
8029:
8030: <p>When choosing which of these variables to use, follow
8031: the following rules:</p>
8032:
8033: <div class="itemizedlist">
8034: <ul type="disc">
8035: <li>
1.14 xtraeme 8036: <p><code class="varname">PREFIX</code> always
8037: points to the location where the current pkg will
8038: be installed. When referring to a pkg's own
1.1 grant 8039: installation path, use “<span class=
8040: "quote">${PREFIX}</span>”.</p>
8041: </li>
8042:
8043: <li>
1.14 xtraeme 8044: <p><code class="varname">LOCALBASE</code> is where
8045: all non-X11 pkgs are installed. If you need to
1.1 grant 8046: construct a -I or -L argument to the compiler to
8047: find includes and libraries installed by another
8048: non-X11 pkg, use “<span class=
8049: "quote">${LOCALBASE}</span>”.</p>
8050: </li>
8051:
8052: <li>
1.14 xtraeme 8053: <p><code class="varname">X11BASE</code> is where
8054: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 8055: installed. When looking for <span class=
8056: "emphasis"><em>standard</em></span> X11 includes
8057: (not those installed by a pkg), use
8058: “<span class=
8059: "quote">${X11BASE}</span>”.</p>
8060: </li>
8061:
8062: <li>
8063: <p>X11 based are special in that they may be
1.14 xtraeme 8064: installed in either <code class=
8065: "varname">X11BASE</code> or <code class=
8066: "varname">LOCALBASE</code>.</p>
1.1 grant 8067:
8068: <p>Usually, X11 packages should be installed under
1.14 xtraeme 8069: <code class="varname">LOCALBASE</code> whenever
8070: possible. Note that you will need to set
8071: <code class="varname">USE_X11</code> in them to
8072: request the presence of X11 and to get the right
8073: compilation flags.</p>
1.1 grant 8074:
8075: <p>Even though, there are some packages that cannot
1.14 xtraeme 8076: be installed under <code class=
8077: "varname">LOCALBASE</code>: those that come with
1.1 grant 8078: app-defaults files. These packages are special and
1.14 xtraeme 8079: they must be placed under <code class=
8080: "varname">X11BASE</code>. To accomplish this, set
8081: either <code class="varname">USE_X11BASE</code> or
8082: <code class="varname">USE_IMAKE</code> in your
1.1 grant 8083: package.</p>
8084:
1.14 xtraeme 8085: <p>Some notes: <code class="varname">USE_X11</code>
8086: and <code class="varname">USE_X11BASE</code> are
8087: mutually exclusive. If you need to find includes or
8088: libraries installed by a pkg that has <code class=
8089: "varname">USE_IMAKE</code> or <code class=
8090: "varname">USE_X11BASE</code> in its pkg
8091: <code class="filename">Makefile</code>, you need to
8092: use <span class="emphasis"><em>both</em></span>
8093: <code class="filename">${X11BASE}</code> and
8094: <code class="filename">${LOCALBASE}</code>. To
8095: force installation of all X11 packages in
8096: <code class="varname">LOCALBASE</code>, the
8097: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8098: href=
1.1 grant 8099: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20 ben 8100: class="pkgname">pkgtools/xpkgwedge</a> is enabled
8101: by default.</p>
1.1 grant 8102: </li>
8103:
8104: <li>
1.14 xtraeme 8105: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 8106: used to refer to the installed location of an X11
1.14 xtraeme 8107: package. <code class="varname">X11PREFIX</code>
8108: will be set to <code class="varname">X11BASE</code>
8109: if xpkgwedge is not installed, and to <code class=
8110: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 8111: installed.</p>
8112: </li>
8113:
8114: <li>
8115: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 8116: have some packages installed in <code class=
8117: "varname">X11BASE</code> and some in <code class=
8118: "varname">LOCALBASE</code>. To determine the prefix
8119: of an installed package, the <code class=
8120: "varname">EVAL_PREFIX</code> definition can be
8121: used. It takes pairs in the format
8122: “<span class=
1.1 grant 8123: "quote">DIRNAME=<package></span>”, and
1.24 wiz 8124: the <a href=
8125: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8126: <span class="citerefentry"><span class=
8127: "refentrytitle">make</span>(1)</span></a> variable
8128: <code class="varname">DIRNAME</code> will be set to
8129: the prefix of the installed package
8130: <package>, or “<span class=
1.1 grant 8131: "quote">${X11PREFIX}</span>” if the package
8132: is not installed.</p>
8133:
8134: <p>This is best illustrated by example.</p>
8135:
1.14 xtraeme 8136: <p>The following lines are taken from <code class=
8137: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 8138: <pre class="programlisting">
1.14 xtraeme 8139: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 8140: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
8141: --with-gtk-prefix="${GTKDIR}" \
8142: --enable-multibyte
8143: </pre>
8144:
8145: <p>Specific defaults can be defined for the
1.14 xtraeme 8146: packages evaluated using <code class=
8147: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 8148: of the form:</p>
8149: <pre class="programlisting">
8150: GTKDIR_DEFAULT= ${LOCALBASE}
8151: </pre>
8152:
1.14 xtraeme 8153: <p>where <code class="varname">GTKDIR</code>
1.1 grant 8154: corresponds to the first definition in the
1.14 xtraeme 8155: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 8156: </li>
8157:
8158: <li>
1.14 xtraeme 8159: <p>Within <code class="filename">${PREFIX}</code>,
1.24 wiz 8160: packages should install files according to <a href=
8161: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
8162: <span class="citerefentry"><span class=
8163: "refentrytitle">hier</span>(7)</span></a>, with the
8164: exception that manual pages go into <code class=
8165: "filename">${PREFIX}/man</code>, not <code class=
1.14 xtraeme 8166: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 8167: </li>
8168: </ul>
8169: </div>
8170: </div>
8171:
8172: <div class="sect1" lang="en" xml:lang="en">
8173: <div class="titlepage">
8174: <div>
8175: <div>
8176: <h2 class="title" style="clear: both"><a name=
1.30 wiz 8177: "main-targets" id=
8178: "main-targets"></a>12.2. Main targets</h2>
1.1 grant 8179: </div>
8180: </div>
8181: </div>
8182:
8183: <p>The main targets used during the build process defined
1.14 xtraeme 8184: in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 8185:
8186: <div class="variablelist">
8187: <dl>
8188: <dt><span class="term">fetch</span></dt>
8189:
8190: <dd>
8191: <p>This will check if the file(s) given in the
1.14 xtraeme 8192: variables <code class="varname">DISTFILES</code>
8193: and <code class="varname">PATCHFILES</code> (as
8194: defined in the package's Makefile) are present on
8195: the local system in <code class=
8196: "filename">/usr/pkgsrc/distfiles</code>. If they
8197: are not present, an attempt will be made to fetch
8198: them using commands of the form:</p>
1.1 grant 8199: <pre class="programlisting">
8200: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
8201: </pre>
8202:
8203: <p>where ${site} varies through several
1.14 xtraeme 8204: possibilities in turn: first, <code class=
8205: "varname">MASTER_SITE_OVERRIDE</code> is tried,
8206: then the sites specified in either <code class=
8207: "varname">SITES_file</code> if defined, else
8208: <code class="varname">MASTER_SITES</code> or
8209: <code class="varname">PATCH_SITES</code>, as
8210: applies, then finally the value of <code class=
8211: "varname">MASTER_SITE_BACKUP</code>. The order of
8212: all except the first can be optionally sorted by
8213: the user, via setting either <code class=
8214: "varname">MASTER_SORT_AWK</code> or <code class=
8215: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 8216: </dd>
8217:
8218: <dt><span class="term">checksum</span></dt>
8219:
8220: <dd>
8221: <p>After the distfile(s) are fetched, their
8222: checksum is generated and compared with the
8223: checksums stored in the distinfo file. If the
8224: checksums don't match, the build is aborted. This
8225: is to ensure the same distfile is used for
8226: building, and that the distfile wasn't changed,
8227: e.g. by some malign force, deliberately changed
8228: distfiles on the master distribution site or
8229: network lossage.</p>
8230: </dd>
8231:
8232: <dt><span class="term">extract</span></dt>
8233:
8234: <dd>
8235: <p>When the distfiles are present on the local
8236: system, they need to be extracted, as they are
8237: usually in the form of some compressed archive
1.14 xtraeme 8238: format, most commonly <code class=
8239: "filename">.tar.gz</code>.</p>
1.1 grant 8240:
8241: <p>If only some of the distfiles need to be
8242: uncompressed, the files to be uncompressed should
1.14 xtraeme 8243: be put into <code class=
8244: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 8245:
1.14 xtraeme 8246: <p>If the distfiles are not in <code class=
8247: "filename">.tar.gz</code> format, they can be
8248: extracted by setting either <code class=
8249: "varname">EXTRACT_SUFX</code>, or <code class=
8250: "varname">EXTRACT_CMD</code>, <code class=
8251: "varname">EXTRACT_BEFORE_ARGS</code> and
8252: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
8253: the former case, pkgsrc knows how to extract a
8254: number of suffixes (<code class=
8255: "filename">.tar.gz</code>, <code class=
8256: "filename">.tgz</code>, <code class=
8257: "filename">.tar.gz2</code>, <code class=
8258: "filename">.tbz</code>, <code class=
8259: "filename">.tar.Z</code>, <code class=
8260: "filename">.tar</code>, <code class=
8261: "filename">.shar.gz</code>, <code class=
8262: "filename">.shar.bz2</code>, <code class=
8263: "filename">.shar.Z</code>, <code class=
8264: "filename">.shar</code>, <code class=
8265: "filename">.Z</code>, <code class=
8266: "filename">.bz2</code> and <code class=
8267: "filename">.gz</code>; see the definition of the
8268: various <code class="varname">DECOMPRESS_CMD</code>
8269: variables <code class="filename">bsd.pkg.mk</code>
8270: for a complete list). Here's an example on how to
8271: use the other variables for a program that comes
8272: with a compressed shell archive whose name ends in
8273: <code class="filename">.msg.gz</code>:</p>
1.1 grant 8274: <pre class="programlisting">
8275: EXTRACT_SUFX= .msg.gz
8276: EXTRACT_CMD= zcat
8277: EXTRACT_BEFORE_ARGS=
8278: EXTRACT_AFTER_ARGS= |sh
8279: </pre>
8280: </dd>
8281:
8282: <dt><span class="term">patch</span></dt>
8283:
8284: <dd>
8285: <p>After extraction, all the patches named by the
1.14 xtraeme 8286: <code class="varname">PATCHFILES</code>, those
8287: present in the patches subdirectory of the package
8288: as well as in $LOCALPATCHES/$PKGPATH (e.g.
8289: <code class=
8290: "filename">/usr/local/patches/graphics/png</code>)
8291: are applied. Patchfiles ending in <code class=
8292: "filename">.Z</code> or <code class=
8293: "filename">.gz</code> are uncompressed before they
8294: are applied, files ending in <code class=
8295: "filename">.orig</code> or <code class=
8296: "filename">.rej</code> are ignored. Any special
1.24 wiz 8297: options to <a href=
8298: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
8299: <span class="citerefentry"><span class=
8300: "refentrytitle">patch</span>(1)</span></a> can be
8301: handed in <code class=
1.14 xtraeme 8302: "varname">PATCH_DIST_ARGS</code>. See <a href=
8303: "#components.patches" title=
1.27 rillig 8304: "7.3. patches/*">Section 7.3,
1.1 grant 8305: “patches/*”</a> for more details.</p>
8306:
1.24 wiz 8307: <p>By default <a href=
8308: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
8309: <span class="citerefentry"><span class=
8310: "refentrytitle">patch</span>(1)</span></a> is given
8311: special args to make it fail if the patches apply
8312: with some lines of fuzz. Please fix (regen) the
8313: patches so that they apply cleanly. The rationale
8314: behind this is that patches that don't apply
8315: cleanly may end up being applied in the wrong
8316: place, and cause severe harm there.</p>
1.1 grant 8317: </dd>
8318:
8319: <dt><span class="term">configure</span></dt>
8320:
8321: <dd>
8322: <p>Most pieces of software need information on the
8323: header files, system calls, and library routines
8324: which are available in NetBSD. This is the process
8325: known as configuration, and is usually automated.
8326: In most cases, a script is supplied with the
8327: source, and its invocation results in generation of
8328: header files, Makefiles, etc.</p>
8329:
8330: <p>If the program's distfile contains its own
8331: configure script, this can be invoked by setting
1.14 xtraeme 8332: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 8333: configure script is a GNU autoconf script,
1.14 xtraeme 8334: <code class="varname">GNU_CONFIGURE</code> should
8335: be specified instead. In either case, any arguments
8336: to the configure script can be specified in the
8337: <code class="varname">CONFIGURE_ARGS</code>
8338: variable, and the configure script's name can be
8339: set in <code class=
8340: "varname">CONFIGURE_SCRIPT</code> if it differs
8341: from the default “<span class=
1.1 grant 8342: "quote">configure</span>”. Here's an example
8343: from the <a xmlns=
8344: "http://www.w3.org/TR/xhtml1/transitional" href=
8345: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20 ben 8346: class="pkgname">sysutils/top</a> package:</p>
1.1 grant 8347: <pre class="programlisting">
8348: HAS_CONFIGURE= yes
8349: CONFIGURE_SCRIPT= Configure
8350: CONFIGURE_ARGS+= netbsd13
8351: </pre>
8352:
8353: <p>If the program uses an Imakefile for
8354: configuration, the appropriate steps can be invoked
1.14 xtraeme 8355: by setting <code class="varname">USE_IMAKE</code>
8356: to “<span class="quote">YES</span>”.
8357: (If you only want the package installed in
8358: <code class="varname">$X11PREFIX</code> but xmkmf
8359: not being run, set <code class=
8360: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 8361: </dd>
8362:
8363: <dt><span class="term">build</span></dt>
8364:
8365: <dd>
8366: <p>Once configuration has taken place, the software
1.14 xtraeme 8367: will be built by invoking <code class=
8368: "varname">$MAKE_PROGRAM</code> on <code class=
8369: "varname">$MAKEFILE</code> with <code class=
8370: "varname">$BUILD_TARGET</code> as the target to
8371: build. The default <code class=
8372: "varname">MAKE_PROGRAM</code> is
8373: “<span class="quote">gmake</span>” if
1.29 rillig 8374: <code class="varname">USE_TOOLS</code> contains
8375: “<span class="quote">gmake</span>”,
1.1 grant 8376: “<span class="quote">make</span>”
1.14 xtraeme 8377: otherwise. <code class="varname">MAKEFILE</code> is
8378: set to “<span class=
1.1 grant 8379: "quote">Makefile</span>” by default, and
1.14 xtraeme 8380: <code class="varname">BUILD_TARGET</code> defaults
8381: to “<span class="quote">all</span>”.
8382: Any of these variables can be set in the package's
1.1 grant 8383: Makefile to change the default build process.</p>
8384: </dd>
8385:
8386: <dt><span class="term">install</span></dt>
8387:
8388: <dd>
8389: <p>Once the build stage has completed, the final
8390: step is to install the software in public
8391: directories, so users can access the programs and
1.14 xtraeme 8392: files. As in the build-target, <code class=
8393: "varname">$MAKE_PROGRAM</code> is invoked on
8394: <code class="varname">$MAKEFILE</code> here, but
8395: with the <code class=
8396: "varname">$INSTALL_TARGET</code> instead, the
8397: latter defaulting to “<span class=
8398: "quote">install</span>” (plus
8399: “<span class=
8400: "quote">install.man</span>”, if <code class=
8401: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 8402: </dd>
8403: </dl>
8404: </div>
8405:
8406: <p>If no target is specified, the default is
8407: “<span class="quote">build</span>”. If a
8408: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 8409: e.g. <span><strong class="command">make
8410: build</strong></span> will also perform the equivalent
8411: of:</p>
1.1 grant 8412: <pre class="programlisting">
8413: make fetch
8414: make checksum
8415: make extract
8416: make patch
8417: make configure
8418: make build
8419: </pre>
8420: </div>
8421:
8422: <div class="sect1" lang="en" xml:lang="en">
8423: <div class="titlepage">
8424: <div>
8425: <div>
8426: <h2 class="title" style="clear: both"><a name=
8427: "build.helpful-targets" id=
1.25 rillig 8428: "build.helpful-targets"></a>12.3. Other
1.1 grant 8429: helpful targets</h2>
8430: </div>
8431: </div>
8432: </div>
8433:
8434: <div class="variablelist">
8435: <dl>
8436: <dt><span class="term">pre/post-*</span></dt>
8437:
8438: <dd>
8439: <p>For any of the main targets described in the
8440: previous section, two auxiliary targets exist with
8441: “<span class="quote">pre-</span>” and
8442: “<span class="quote">post-</span>” used
8443: as a prefix for the main target's name. These
8444: targets are invoked before and after the main
8445: target is called, allowing extra configuration or
8446: installation steps be performed from a package's
8447: Makefile, for example, which a program's configure
8448: script or install target omitted.</p>
8449: </dd>
8450:
8451: <dt><span class="term">do-*</span></dt>
8452:
8453: <dd>
8454: <p>Should one of the main targets do the wrong
8455: thing, and should there be no variable to fix this,
8456: you can redefine it with the do-* target. (Note
8457: that redefining the target itself instead of the
8458: do-* target is a bad idea, as the pre-* and post-*
8459: targets won't be called anymore, etc.) You will not
8460: usually need to do this.</p>
8461: </dd>
8462:
8463: <dt><span class="term">reinstall</span></dt>
8464:
8465: <dd>
1.14 xtraeme 8466: <p>If you did a <span><strong class="command">make
8467: install</strong></span> and you noticed some file
8468: was not installed properly, you can repeat the
1.1 grant 8469: installation with this target, which will ignore
8470: the “<span class="quote">already
8471: installed</span>” flag.</p>
8472: </dd>
8473:
8474: <dt><span class="term">deinstall</span></dt>
8475:
8476: <dd>
1.24 wiz 8477: <p>This target does a <a href=
8478: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8479: <span class="citerefentry"><span class=
8480: "refentrytitle">pkg_delete</span>(1)</span></a> in
8481: the current directory, effectively de-installing
8482: the package. The following variables can be used to
8483: tune the behaviour:</p>
1.1 grant 8484:
8485: <div class="variablelist">
8486: <dl>
1.14 xtraeme 8487: <dt><span class="term"><code class=
8488: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 8489:
8490: <dd>
8491: <p>Add a "-v" to the <a href=
8492: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8493: <span class="citerefentry"><span class=
8494: "refentrytitle">pkg_delete</span>(1)</span></a>
8495: command.</p>
8496: </dd>
8497:
1.14 xtraeme 8498: <dt><span class="term"><code class=
8499: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 8500:
8501: <dd>
8502: <p>Remove all packages that require (depend
8503: on) the given package. This can be used to
8504: remove any packages that may have been pulled
8505: in by a given package, e.g. if
1.14 xtraeme 8506: <span><strong class="command">make deinstall
8507: DEINSTALLDEPENDS=1</strong></span> is done in
8508: <code class="filename">pkgsrc/x11/kde</code>,
1.1 grant 8509: this is likely to remove whole KDE. Works by
8510: adding “<span class=
8511: "quote">-R</span>” to the <a href=
8512: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8513: <span class="citerefentry"><span class=
8514: "refentrytitle">pkg_delete</span>(1)</span></a>
8515: command line.</p>
8516: </dd>
8517: </dl>
8518: </div>
8519: </dd>
8520:
8521: <dt><span class="term">update</span></dt>
8522:
8523: <dd>
8524: <p>This target causes the current package to be
8525: updated to the latest version. The package and all
8526: depending packages first get de-installed, then
8527: current versions of the corresponding packages get
8528: compiled and installed. This is similar to manually
8529: noting which packages are currently installed, then
1.14 xtraeme 8530: performing a series of <span><strong class=
8531: "command">make deinstall</strong></span> and
8532: <span><strong class="command">make
8533: install</strong></span> (or whatever <code class=
8534: "varname">UPDATE_TARGET</code> is set to) for these
8535: packages.</p>
1.1 grant 8536:
8537: <p>You can use the “<span class=
8538: "quote">update</span>” target to resume
1.14 xtraeme 8539: package updating in case a previous
8540: <span><strong class="command">make
8541: update</strong></span> was interrupted for some
8542: reason. However, in this case, make sure you don't
8543: call <span><strong class="command">make
8544: clean</strong></span> or otherwise remove the list
8545: of dependent packages in <code class=
8546: "varname">WRKDIR</code>. Otherwise you lose the
1.1 grant 8547: ability to automatically update the current package
8548: along with the dependent packages you have
8549: installed.</p>
8550:
1.14 xtraeme 8551: <p>Resuming an interrupted <span><strong class=
8552: "command">make update</strong></span> will only
8553: work as long as the package tree remains unchanged.
8554: If the source code for one of the packages to be
8555: updated has been changed, resuming
8556: <span><strong class="command">make
8557: update</strong></span> will most certainly
8558: fail!</p>
1.1 grant 8559:
8560: <p>The following variables can be used either on
1.14 xtraeme 8561: the command line or in <code class=
8562: "filename">/etc/mk.conf</code> to alter the
8563: behaviour of <span><strong class="command">make
8564: update</strong></span>:</p>
1.1 grant 8565:
8566: <div class="variablelist">
8567: <dl>
1.14 xtraeme 8568: <dt><span class="term"><code class=
8569: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 8570:
8571: <dd>
8572: <p>Install target to recursively use for the
8573: updated package and the dependent packages.
1.14 xtraeme 8574: Defaults to <code class=
8575: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 8576: “<span class=
8577: "quote">install</span>” otherwise for
1.14 xtraeme 8578: <span><strong class="command">make
8579: update</strong></span>. e.g.
8580: <span><strong class="command">make update
8581: UPDATE_TARGET=package</strong></span></p>
1.1 grant 8582: </dd>
8583:
1.14 xtraeme 8584: <dt><span class="term"><code class=
8585: "varname">NOCLEAN</code></span></dt>
1.1 grant 8586:
8587: <dd>
8588: <p>Don't clean up after updating. Useful if
8589: you want to leave the work sources of the
8590: updated packages around for inspection or
8591: other purposes. Be sure you eventually clean
8592: up the source tree (see the
8593: “<span class=
8594: "quote">clean-update</span>” target
8595: below) or you may run into troubles with old
8596: source code still lying around on your next
1.14 xtraeme 8597: <span><strong class=
8598: "command">make</strong></span> or
8599: <span><strong class="command">make
8600: update</strong></span>.</p>
1.1 grant 8601: </dd>
8602:
1.14 xtraeme 8603: <dt><span class="term"><code class=
8604: "varname">REINSTALL</code></span></dt>
1.1 grant 8605:
8606: <dd>
8607: <p>Deinstall each package before installing
1.14 xtraeme 8608: (making <code class=
8609: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 8610: necessary if the “<span class=
8611: "quote">clean-update</span>” target
8612: (see below) was called after interrupting a
1.14 xtraeme 8613: running <span><strong class="command">make
8614: update</strong></span>.</p>
1.1 grant 8615: </dd>
8616:
1.14 xtraeme 8617: <dt><span class="term"><code class=
8618: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 8619:
8620: <dd>
8621: <p>Allows you to disable recursion and
8622: hardcode the target for packages. The default
8623: is “<span class=
8624: "quote">update</span>” for the update
8625: target, facilitating a recursive update of
1.14 xtraeme 8626: prerequisite packages. Only set <code class=
8627: "varname">DEPENDS_TARGET</code> if you want
8628: to disable recursive updates. Use
8629: <code class="varname">UPDATE_TARGET</code>
8630: instead to just set a specific target for
8631: each package to be installed during
8632: <span><strong class="command">make
8633: update</strong></span> (see above).</p>
1.1 grant 8634: </dd>
8635: </dl>
8636: </div>
8637: </dd>
8638:
8639: <dt><span class="term">clean-update</span></dt>
8640:
8641: <dd>
8642: <p>Clean the source tree for all packages that
1.14 xtraeme 8643: would get updated if <span><strong class=
8644: "command">make update</strong></span> was called
8645: from the current directory. This target should not
8646: be used if the current package (or any of its
8647: depending packages) have already been de-installed
8648: (e.g., after calling <span><strong class=
8649: "command">make update</strong></span>) or you may
8650: lose some packages you intended to update. As a
8651: rule of thumb: only use this target <span class=
8652: "emphasis"><em>before</em></span> the first time
8653: you run <span><strong class="command">make
8654: update</strong></span> and only if you have a dirty
8655: package tree (e.g., if you used <code class=
8656: "varname">NOCLEAN</code>).</p>
1.1 grant 8657:
8658: <p>If you unsure about whether your tree is clean
1.14 xtraeme 8659: you can either perform a <span><strong class=
8660: "command">make clean</strong></span> at the top of
8661: the tree, or use the following sequence of commands
1.1 grant 8662: from the directory of the package you want to
8663: update (<span class=
8664: "emphasis"><em>before</em></span> running
1.14 xtraeme 8665: <span><strong class="command">make
8666: update</strong></span> for the first time,
8667: otherwise you lose all the packages you wanted to
8668: update!):</p>
1.1 grant 8669: <pre class="screen">
1.14 xtraeme 8670: <code class="prompt">#</code> <strong class=
8671: "userinput"><code>make clean-update</code></strong>
8672: <code class="prompt">#</code> <strong class=
8673: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
8674: <code class="prompt">#</code> <strong class=
8675: "userinput"><code>make update</code></strong>
1.1 grant 8676: </pre>
8677:
8678: <p>The following variables can be used either on
1.14 xtraeme 8679: the command line or in <code class=
8680: "filename">/etc/mk.conf</code> to alter the
8681: behaviour of <span><strong class="command">make
8682: clean-update</strong></span>:</p>
1.1 grant 8683:
8684: <div class="variablelist">
8685: <dl>
1.14 xtraeme 8686: <dt><span class="term"><code class=
8687: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 8688:
8689: <dd>
1.14 xtraeme 8690: <p>After <span><strong class="command">make
8691: clean</strong></span>, do not reconstruct the
8692: list of directories to update for this
8693: package. Only use this if
8694: <span><strong class="command">make
8695: update</strong></span> successfully installed
8696: all packages you wanted to update. Normally,
8697: this is done automatically on
8698: <span><strong class="command">make
8699: update</strong></span>, but may have been
8700: suppressed by the <code class=
8701: "varname">NOCLEAN</code> variable (see
1.1 grant 8702: above).</p>
8703: </dd>
8704: </dl>
8705: </div>
8706: </dd>
8707:
8708: <dt><span class="term">info</span></dt>
8709:
8710: <dd>
8711: <p>This target invokes <a href=
8712: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
8713: <span class="citerefentry"><span class=
8714: "refentrytitle">pkg_info</span>(1)</span></a> for
8715: the current package. You can use this to check
8716: which version of a package is installed.</p>
8717: </dd>
8718:
8719: <dt><span class="term">readme</span></dt>
8720:
8721: <dd>
1.14 xtraeme 8722: <p>This target generates a <code class=
8723: "filename">README.html</code> file, which can be
1.1 grant 8724: viewed using a browser such as <a xmlns=
8725: "http://www.w3.org/TR/xhtml1/transitional" href=
8726: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 8727: class="pkgname">www/mozilla</a> or <a xmlns=
8728: "http://www.w3.org/TR/xhtml1/transitional" href=
8729: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
8730: class="pkgname">www/links</a>. The generated files
8731: contain references to any packages which are in the
8732: <code class="varname">PACKAGES</code> directory on
8733: the local host. The generated files can be made to
8734: refer to URLs based on <code class=
8735: "varname">FTP_PKG_URL_HOST</code> and <code class=
8736: "varname">FTP_PKG_URL_DIR</code>. For example, if I
8737: wanted to generate <code class=
8738: "filename">README.html</code> files which pointed
8739: to binary packages on the local machine, in the
8740: directory <code class=
8741: "filename">/usr/packages</code>, set <code class=
8742: "varname">FTP_PKG_URL_HOST=file://localhost</code>
8743: and <code class=
8744: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
8745: <code class="varname">${PACKAGES}</code> directory
8746: and its subdirectories will be searched for all the
8747: binary packages.</p>
1.1 grant 8748: </dd>
8749:
8750: <dt><span class="term">readme-all</span></dt>
8751:
8752: <dd>
1.14 xtraeme 8753: <p>Use this target to create a file <code class=
8754: "filename">README-all.html</code> which contains a
1.1 grant 8755: list of all packages currently available in the
8756: NetBSD Packages Collection, together with the
8757: category they belong to and a short description.
1.14 xtraeme 8758: This file is compiled from the <code class=
8759: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 8760: sure to run this <span class=
1.14 xtraeme 8761: "emphasis"><em>after</em></span> a
8762: <span><strong class="command">make
8763: readme</strong></span>.</p>
1.1 grant 8764: </dd>
8765:
8766: <dt><span class="term">cdrom-readme</span></dt>
8767:
8768: <dd>
8769: <p>This is very much the same as the
8770: “<span class="quote">readme</span>”
8771: target (see above), but is to be used when
8772: generating a pkgsrc tree to be written to a CD-ROM.
1.14 xtraeme 8773: This target also produces <code class=
8774: "filename">README.html</code> files, and can be
8775: made to refer to URLs based on <code class=
8776: "varname">CDROM_PKG_URL_HOST</code> and
8777: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 8778: </dd>
8779:
8780: <dt><span class="term">show-distfiles</span></dt>
8781:
8782: <dd>
8783: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 8784: are needed to build the package. (<code class=
8785: "varname">DISTFILES</code> and <code class=
8786: "varname">PATCHFILES</code>, but not <code class=
8787: "filename">patches/*</code>)</p>
1.1 grant 8788: </dd>
8789:
8790: <dt><span class="term">show-downlevel</span></dt>
8791:
8792: <dd>
8793: <p>This target shows nothing if the package is not
8794: installed. If a version of this package is
8795: installed, but is not the version provided in this
8796: version of pkgsrc, then a warning message is
8797: displayed. This target can be used to show which of
8798: your installed packages are downlevel, and so the
8799: old versions can be deleted, and the current ones
8800: added.</p>
8801: </dd>
8802:
8803: <dt><span class="term">show-pkgsrc-dir</span></dt>
8804:
8805: <dd>
8806: <p>This target shows the directory in the pkgsrc
8807: hierarchy from which the package can be built and
8808: installed. This may not be the same directory as
8809: the one from which the package was installed. This
8810: target is intended to be used by people who may
8811: wish to upgrade many packages on a single host, and
8812: can be invoked from the top-level pkgsrc Makefile
8813: by using the “<span class=
8814: "quote">show-host-specific-pkgs</span>”
8815: target.</p>
8816: </dd>
8817:
8818: <dt><span class=
8819: "term">show-installed-depends</span></dt>
8820:
8821: <dd>
8822: <p>This target shows which installed packages match
1.14 xtraeme 8823: the current package's <code class=
8824: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 8825: dependencies are causing build problems.</p>
8826: </dd>
8827:
8828: <dt><span class="term">check-shlibs</span></dt>
8829:
8830: <dd>
8831: <p>After a package is installed, check all its
8832: binaries and (on ELF platforms) shared libraries to
8833: see if they find the shared libs they need. Run by
1.14 xtraeme 8834: default if <code class=
8835: "varname">PKG_DEVELOPER</code> is set in
8836: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 8837: </dd>
8838:
8839: <dt><span class="term">print-PLIST</span></dt>
8840:
8841: <dd>
8842: <p>After a “<span class="quote">make
8843: install</span>” from a new or upgraded pkg,
8844: this prints out an attempt to generate a new
1.14 xtraeme 8845: <code class="filename">PLIST</code> from a
8846: <span><strong class="command">find -newer
8847: work/.extract_done</strong></span>. An attempt is
8848: made to care for shared libs etc., but it is
1.1 grant 8849: <span class="emphasis"><em>strongly</em></span>
8850: recommended to review the result before putting it
1.14 xtraeme 8851: into <code class="filename">PLIST</code>. On
8852: upgrades, it's useful to diff the output of this
8853: command against an already existing <code class=
8854: "filename">PLIST</code> file.</p>
1.1 grant 8855:
1.24 wiz 8856: <p>If the package installs files via <a href=
8857: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
8858: <span class="citerefentry"><span class=
8859: "refentrytitle">tar</span>(1)</span></a> or other
8860: methods that don't update file access times, be
8861: sure to add these files manually to your
1.14 xtraeme 8862: <code class="filename">PLIST</code>, as the
1.1 grant 8863: “<span class="quote">find
8864: -newer</span>” command used by this target
8865: won't catch them!</p>
8866:
8867: <p>See <a href="#print-PLIST" title=
1.25 rillig 8868: "9.3. Tweaking output of make print-PLIST">Section 9.3,
1.14 xtraeme 8869: “Tweaking output of <span><strong class=
8870: "command">make
8871: print-PLIST</strong></span>”</a> for more
8872: information on this target.</p>
1.1 grant 8873: </dd>
8874:
8875: <dt><span class="term">bulk-package</span></dt>
8876:
8877: <dd>
8878: <p>Used to do bulk builds. If an appropriate binary
8879: package already exists, no action is taken. If not,
8880: this target will compile, install and package it
1.14 xtraeme 8881: (and it's depends, if <code class=
8882: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 8883: <a href="#binary.configuration" title=
8884: "5.3.1. Configuration">Section 5.3.1,
8885: “Configuration”</a>. After creating the
8886: binary package, the sources, the just-installed
8887: package and it's required packages are removed,
8888: preserving free disk space.</p>
8889:
8890: <p><span class="emphasis"><em>Beware that this
8891: target may deinstall all packages installed on a
8892: system!</em></span></p>
8893: </dd>
8894:
8895: <dt><span class="term">bulk-install</span></dt>
8896:
8897: <dd>
8898: <p>Used during bulk-installs to install required
8899: packages. If an upto-date binary package is
8900: available, it will be installed via <a href=
8901: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
8902: <span class="citerefentry"><span class=
8903: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 8904: not, <span><strong class="command">make
8905: bulk-package</strong></span> will be executed, but
8906: the installed binary not be removed.</p>
1.1 grant 8907:
8908: <p>A binary package is considered
8909: “<span class="quote">upto-date</span>”
8910: to be installed via <a href=
8911: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
8912: <span class="citerefentry"><span class=
8913: "refentrytitle">pkg_add</span>(1)</span></a>
8914: if:</p>
8915:
8916: <div class="itemizedlist">
8917: <ul type="disc">
8918: <li>
1.14 xtraeme 8919: <p>None of the package's files (<code class=
8920: "filename">Makefile</code>, ...) were
8921: modified since it was built.</p>
1.1 grant 8922: </li>
8923:
8924: <li>
8925: <p>None of the package's required (binary)
8926: packages were modified since it was
8927: built.</p>
8928: </li>
8929: </ul>
8930: </div>
8931:
8932: <p><span class="emphasis"><em>Beware that this
8933: target may deinstall all packages installed on a
8934: system!</em></span></p>
8935: </dd>
8936: </dl>
8937: </div>
8938: </div>
8939: </div>
8940:
8941: <div class="chapter" lang="en" xml:lang="en">
8942: <div class="titlepage">
8943: <div>
8944: <div>
8945: <h2 class="title"><a name="fixes" id=
1.25 rillig 8946: "fixes"></a>Chapter 13. Notes on fixes for
1.1 grant 8947: packages</h2>
8948: </div>
8949: </div>
8950: </div>
8951:
8952: <div class="toc">
8953: <p><b>Table of Contents</b></p>
8954:
8955: <dl>
1.30 wiz 8956: <dt><span class="sect1"><a href=
8957: "#general-operation">13.1. General
8958: operation</a></span></dt>
1.1 grant 8959:
8960: <dd>
8961: <dl>
8962: <dt><span class="sect2"><a href=
1.30 wiz 8963: "#pulling-vars-from-etc-mk.conf">13.1.1. How to
8964: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 8965:
8966: <dt><span class="sect2"><a href=
1.31 wiz 8967: "#where-to-install-documentation">13.1.2. Where to
8968: install documentation</a></span></dt>
8969:
8970: <dt><span class="sect2"><a href=
8971: "#restricted-packages">13.1.3. Restricted
1.1 grant 8972: packages</a></span></dt>
8973:
8974: <dt><span class="sect2"><a href=
1.31 wiz 8975: "#dependencies">13.1.4. Handling
1.1 grant 8976: dependencies</a></span></dt>
8977:
8978: <dt><span class="sect2"><a href=
1.31 wiz 8979: "#conflicts">13.1.5. Handling conflicts with other
1.1 grant 8980: packages</a></span></dt>
8981:
8982: <dt><span class="sect2"><a href=
1.31 wiz 8983: "#not-building-packages">13.1.6. Packages that
1.30 wiz 8984: cannot or should not be built</a></span></dt>
1.1 grant 8985:
8986: <dt><span class="sect2"><a href=
1.31 wiz 8987: "#undeletable-packages">13.1.7. Packages which
1.30 wiz 8988: should not be deleted, once
8989: installed</a></span></dt>
1.1 grant 8990:
8991: <dt><span class="sect2"><a href=
1.31 wiz 8992: "#security-handling">13.1.8. Handling packages with
1.1 grant 8993: security problems</a></span></dt>
8994:
8995: <dt><span class="sect2"><a href=
1.31 wiz 8996: "#compiler-bugs">13.1.9. How to handle compiler
1.1 grant 8997: bugs</a></span></dt>
8998:
8999: <dt><span class="sect2"><a href=
1.31 wiz 9000: "#bumping-pkgrevision">13.1.10. How to handle
1.30 wiz 9001: incrementing versions when fixing an existing
1.1 grant 9002: package</a></span></dt>
9003:
9004: <dt><span class="sect2"><a href=
1.31 wiz 9005: "#portability-of-packages">13.1.11. Portability of
1.1 grant 9006: packages</a></span></dt>
9007: </dl>
9008: </dd>
9009:
1.30 wiz 9010: <dt><span class="sect1"><a href=
9011: "#downloading-issues">13.2. Possible downloading
9012: issues</a></span></dt>
1.1 grant 9013:
9014: <dd>
9015: <dl>
9016: <dt><span class="sect2"><a href=
1.30 wiz 9017: "#no-plain-download">13.2.1. Packages whose
9018: distfiles aren't available for plain
1.1 grant 9019: downloading</a></span></dt>
9020:
9021: <dt><span class="sect2"><a href=
1.30 wiz 9022: "#modified-distfiles-same-name">13.2.2. How to
9023: handle modified distfiles with the 'old'
9024: name</a></span></dt>
1.1 grant 9025: </dl>
9026: </dd>
9027:
1.30 wiz 9028: <dt><span class="sect1"><a href=
9029: "#configuration-gotchas">13.3. Configuration
9030: gotchas</a></span></dt>
1.1 grant 9031:
9032: <dd>
9033: <dl>
9034: <dt><span class="sect2"><a href=
1.25 rillig 9035: "#fixes.libtool">13.3.1. Shared libraries -
1.1 grant 9036: libtool</a></span></dt>
9037:
9038: <dt><span class="sect2"><a href=
1.30 wiz 9039: "#using-libtool">13.3.2. Using libtool on GNU
9040: packages that already support
9041: libtool</a></span></dt>
1.1 grant 9042:
9043: <dt><span class="sect2"><a href=
1.30 wiz 9044: "#autoconf-automake">13.3.3. GNU
1.1 grant 9045: Autoconf/Automake</a></span></dt>
9046: </dl>
9047: </dd>
9048:
1.30 wiz 9049: <dt><span class="sect1"><a href=
9050: "#building-considerations">13.4. Building
9051: considerations</a></span></dt>
1.1 grant 9052:
9053: <dd>
9054: <dl>
9055: <dt><span class="sect2"><a href=
1.30 wiz 9056: "#cpp-defines">13.4.1. CPP defines</a></span></dt>
1.1 grant 9057: </dl>
9058: </dd>
9059:
1.30 wiz 9060: <dt><span class="sect1"><a href=
9061: "#package-specific-actions">13.5. Package specific
9062: actions</a></span></dt>
1.1 grant 9063:
9064: <dd>
9065: <dl>
9066: <dt><span class="sect2"><a href=
1.30 wiz 9067: "#package-configuration-files">13.5.1. Package
9068: configuration files</a></span></dt>
1.1 grant 9069:
9070: <dt><span class="sect2"><a href=
1.30 wiz 9071: "#user-interaction">13.5.2. User
1.2 hubertf 9072: interaction</a></span></dt>
1.1 grant 9073:
9074: <dt><span class="sect2"><a href=
1.30 wiz 9075: "#handling-licenses">13.5.3. Handling
1.1 grant 9076: licenses</a></span></dt>
9077:
9078: <dt><span class="sect2"><a href=
1.30 wiz 9079: "#creating-accounts">13.5.4. Creating an account
9080: from a package</a></span></dt>
1.1 grant 9081:
9082: <dt><span class="sect2"><a href=
1.30 wiz 9083: "#installing-score-files">13.5.5. Installing score
1.1 grant 9084: files</a></span></dt>
9085:
9086: <dt><span class="sect2"><a href=
1.30 wiz 9087: "#login-shells">13.5.6. Packages providing login
1.1 grant 9088: shells</a></span></dt>
9089:
9090: <dt><span class="sect2"><a href=
1.30 wiz 9091: "#perl-scripts">13.5.7. Packages containing perl
1.1 grant 9092: scripts</a></span></dt>
9093:
9094: <dt><span class="sect2"><a href=
1.30 wiz 9095: "#hardcoded-paths">13.5.8. Packages with hardcoded
9096: paths to other interpreters</a></span></dt>
1.1 grant 9097:
9098: <dt><span class="sect2"><a href=
1.30 wiz 9099: "#perl-modules">13.5.9. Packages installing perl
1.1 grant 9100: modules</a></span></dt>
9101:
9102: <dt><span class="sect2"><a href=
1.25 rillig 9103: "#faq.info-files">13.5.10. Packages installing info
1.1 grant 9104: files</a></span></dt>
9105:
9106: <dt><span class="sect2"><a href=
1.30 wiz 9107: "#gconf2-data-files">13.5.11. Packages installing
9108: GConf2 data files</a></span></dt>
1.1 grant 9109:
9110: <dt><span class="sect2"><a href=
1.30 wiz 9111: "#scrollkeeper-data-files">13.5.12. Packages
9112: installing scrollkeeper data files</a></span></dt>
1.1 grant 9113:
9114: <dt><span class="sect2"><a href=
1.30 wiz 9115: "#x11-fonts">13.5.13. Packages installing X11
1.1 grant 9116: fonts</a></span></dt>
9117:
9118: <dt><span class="sect2"><a href=
1.30 wiz 9119: "#gtk2-modules">13.5.14. Packages installing GTK2
1.1 grant 9120: modules</a></span></dt>
9121:
9122: <dt><span class="sect2"><a href=
1.30 wiz 9123: "#sgml-xml-data">13.5.15. Packages installing SGML
9124: or XML data</a></span></dt>
1.1 grant 9125:
9126: <dt><span class="sect2"><a href=
1.30 wiz 9127: "#mime-database">13.5.16. Packages installing
1.1 grant 9128: extensions to the MIME database</a></span></dt>
9129:
9130: <dt><span class="sect2"><a href=
1.30 wiz 9131: "#intltool">13.5.17. Packages using
1.1 grant 9132: intltool</a></span></dt>
1.18 xtraeme 9133:
9134: <dt><span class="sect2"><a href=
1.30 wiz 9135: "#startup-scripts">13.5.18. Packages installing
9136: startup scripts</a></span></dt>
1.1 grant 9137: </dl>
9138: </dd>
9139:
1.30 wiz 9140: <dt><span class="sect1"><a href=
9141: "#feedback-to-author">13.6. Feedback to the
9142: author</a></span></dt>
1.1 grant 9143: </dl>
9144: </div>
9145:
9146: <div class="sect1" lang="en" xml:lang="en">
9147: <div class="titlepage">
9148: <div>
9149: <div>
9150: <h2 class="title" style="clear: both"><a name=
1.30 wiz 9151: "general-operation" id=
9152: "general-operation"></a>13.1. General
1.1 grant 9153: operation</h2>
9154: </div>
9155: </div>
9156: </div>
9157:
9158: <div class="sect2" lang="en" xml:lang="en">
9159: <div class="titlepage">
9160: <div>
9161: <div>
1.30 wiz 9162: <h3 class="title"><a name=
9163: "pulling-vars-from-etc-mk.conf" id=
9164: "pulling-vars-from-etc-mk.conf"></a>13.1.1. How
9165: to pull in variables from /etc/mk.conf</h3>
1.1 grant 9166: </div>
9167: </div>
9168: </div>
9169:
9170: <p>The problem with package-defined variables that can
1.14 xtraeme 9171: be overridden via <code class="varname">MAKECONF</code>
9172: or <code class="filename">/etc/mk.conf</code> is that
9173: <a href=
1.1 grant 9174: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9175: <span class="citerefentry"><span class=
9176: "refentrytitle">make</span>(1)</span></a> expands a
9177: variable as it is used, but evaluates preprocessor like
9178: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 9179: So, to use any variable (which may be set in
9180: <code class="filename">/etc/mk.conf</code>) in one of
9181: the .if* statements, the file <code class=
9182: "filename">/etc/mk.conf</code> must be included before
1.1 grant 9183: that .if* statement.</p>
9184:
9185: <p>Rather than have a number of ad-hoc ways of
1.14 xtraeme 9186: including <code class="filename">/etc/mk.conf</code>,
9187: should it exist, or <code class=
9188: "varname">MAKECONF</code>, should it exist, include the
9189: <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
9190: file in the package Makefile before any
9191: preprocessor-like .if, .ifdef, or .ifndef
9192: statements:</p>
1.1 grant 9193: <pre class="programlisting">
9194: .include "../../mk/bsd.prefs.mk"
9195:
9196: .if defined(USE_MENUS)
9197: ...
9198: .endif
9199: </pre>
9200:
1.14 xtraeme 9201: <p>If you wish to set the <code class=
9202: "varname">CFLAGS</code> variable in <code class=
9203: "filename">/etc/mk.conf</code> please make sure to
1.1 grant 9204: use:</p>
9205: <pre class="programlisting">
9206: CFLAGS+= -your -flags
9207: </pre>
9208:
1.14 xtraeme 9209: <p>Using <code class="varname">CFLAGS=</code> (i.e.
9210: without the “<span class="quote">+</span>”)
9211: may lead to problems with packages that need to add
9212: their own flags. Also, you may want to take a look at
9213: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 9214: href=
9215: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20 ben 9216: class="pkgname">devel/cpuflags</a> package if you're
9217: interested in optimization for the current CPU.</p>
1.1 grant 9218: </div>
9219:
9220: <div class="sect2" lang="en" xml:lang="en">
9221: <div class="titlepage">
9222: <div>
9223: <div>
1.31 wiz 9224: <h3 class="title"><a name=
9225: "where-to-install-documentation" id=
9226: "where-to-install-documentation"></a>13.1.2. Where
9227: to install documentation</h3>
9228: </div>
9229: </div>
9230: </div>
9231:
9232: <p>Documentation should be installed into <code class=
9233: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
9234: <code class=
9235: "filename">${PREFIX}/share/doc/${PKGNAME}</code> (the
9236: latter includes the version number of the package).</p>
9237: </div>
9238:
9239: <div class="sect2" lang="en" xml:lang="en">
9240: <div class="titlepage">
9241: <div>
9242: <div>
1.30 wiz 9243: <h3 class="title"><a name="restricted-packages"
9244: id=
1.31 wiz 9245: "restricted-packages"></a>13.1.3. Restricted
1.1 grant 9246: packages</h3>
9247: </div>
9248: </div>
9249: </div>
9250:
9251: <p>Some licenses restrict how software may be
9252: re-distributed. In order to satisfy these restrictions,
9253: the package system defines five make variables that can
9254: be set to note these restrictions:</p>
9255:
9256: <div class="itemizedlist">
9257: <ul type="disc">
9258: <li>
1.14 xtraeme 9259: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 9260:
9261: <p>This variable should be set whenever a
9262: restriction exists (regardless of its kind). Set
9263: this variable to a string containing the reason
9264: for the restriction.</p>
9265: </li>
9266:
9267: <li>
1.14 xtraeme 9268: <p><code class=
9269: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 9270:
9271: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 9272: variable to <code class=
9273: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 9274: package may not be included on a CD-ROM.</p>
9275: </li>
9276:
9277: <li>
1.14 xtraeme 9278: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 9279:
9280: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 9281: Set this variable to <code class=
9282: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 9283: package may not not be made available on the
9284: Internet.</p>
9285: </li>
9286:
9287: <li>
1.14 xtraeme 9288: <p><code class=
9289: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 9290:
9291: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 9292: this variable to <code class=
9293: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 9294: of the source code or other distfile(s) is not
9295: allowed on CD-ROMs.</p>
9296: </li>
9297:
9298: <li>
1.14 xtraeme 9299: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 9300:
9301: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 9302: variable to <code class=
9303: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 9304: of the source code or other distfile(s) via the
9305: Internet is not allowed.</p>
9306: </li>
9307: </ul>
9308: </div>
9309:
1.14 xtraeme 9310: <p>Please note that the use of <code class=
9311: "varname">NO_PACKAGE</code>, <code class=
9312: "varname">IGNORE</code>, <code class=
9313: "varname">NO_CDROM</code>, or other generic make
1.1 grant 9314: variables to denote restrictions is deprecated, because
9315: they unconditionally prevent users from generating
9316: binary packages!</p>
9317: </div>
9318:
9319: <div class="sect2" lang="en" xml:lang="en">
9320: <div class="titlepage">
9321: <div>
9322: <div>
9323: <h3 class="title"><a name="dependencies" id=
1.31 wiz 9324: "dependencies"></a>13.1.4. Handling
1.1 grant 9325: dependencies</h3>
9326: </div>
9327: </div>
9328: </div>
9329:
9330: <p>Your package may depend on some other package being
9331: present - and there are various ways of expressing this
1.14 xtraeme 9332: dependency. pkgsrc supports the <code class=
9333: "varname">BUILD_DEPENDS</code> and <code class=
9334: "varname">DEPENDS</code> definitions, as well as
9335: dependencies via <code class=
9336: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 9337: way to handle dependencies, and which uses the
9338: variables named above. See <a href="#buildlink" title=
1.25 rillig 9339: "Chapter 10. Buildlink methodology">Chapter 10,
1.1 grant 9340: <i>Buildlink methodology</i></a> for more
9341: information.</p>
9342:
9343: <p>The basic difference between the two variables is as
1.14 xtraeme 9344: follows: The <code class="varname">DEPENDS</code>
1.1 grant 9345: definition registers that pre-requisite in the binary
9346: package so it will be pulled in when the binary package
1.14 xtraeme 9347: is later installed, whilst the <code class=
9348: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 9349: marking a dependency that is only needed for building
9350: the package.</p>
9351:
9352: <p>This means that if you only need a package present
9353: whilst you are building, it should be noted as a
1.14 xtraeme 9354: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 9355:
1.14 xtraeme 9356: <p>The format for a <code class=
9357: "varname">BUILD_DEPENDS</code> and a <code class=
9358: "varname">DEPENDS</code> definition is:</p>
1.1 grant 9359: <pre class="programlisting">
9360: <pre-req-package-name>:../../<category>/<pre-req-package>
9361: </pre>
9362:
9363: <p>Please note that the “<span class=
9364: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 9365: any of the wildcard version numbers recognized by
1.1 grant 9366: <a href=
9367: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
9368: <span class="citerefentry"><span class=
9369: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
9370:
9371: <div class="orderedlist">
9372: <ol type="1">
9373: <li>
9374: <p>If your package needs another package's
9375: binaries or libraries to build or run, and if
1.14 xtraeme 9376: that package has a <code class=
9377: "filename">buildlink3.mk</code> file available,
9378: use it:</p>
1.1 grant 9379: <pre class="programlisting">
9380: .include "../../graphics/jpeg/buildlink3.mk"
9381:
9382: </pre>
9383: </li>
9384:
9385: <li>
9386: <p>If your package needs to use another package
1.14 xtraeme 9387: to build itself and there is no <code class=
9388: "filename">buildlink3.mk</code> file available,
9389: use the <code class=
9390: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 9391: <pre class="programlisting">
9392: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
9393: </pre>
9394: </li>
9395:
9396: <li>
9397: <p>If your package needs a library with which to
1.14 xtraeme 9398: link and again there is no <code class=
9399: "filename">buildlink3.mk</code> file available,
9400: this is specified using the <code class=
9401: "varname">DEPENDS</code> definition. An example
9402: of this is the <a xmlns=
1.1 grant 9403: "http://www.w3.org/TR/xhtml1/transitional" href=
9404: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 9405: class="pkgname">print/lyx</a> package, which uses
9406: the xpm library, version 3.4j to build:</p>
1.1 grant 9407: <pre class="programlisting">
9408: DEPENDS+= xpm-3.4j:../../graphics/xpm
9409: </pre>
9410:
9411: <p>You can also use wildcards in package
9412: dependences:</p>
9413: <pre class="programlisting">
9414: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
9415: </pre>
9416:
9417: <p>Note that such wildcard dependencies are
9418: retained when creating binary packages. The
9419: dependency is checked when installing the binary
9420: package and any package which matches the pattern
9421: will be used. Wildcard dependencies should be
9422: used with care.</p>
9423:
9424: <p>The “<span class=
9425: "quote">-[0-9]*</span>” should be used
9426: instead of “<span class=
9427: "quote">-*</span>” to avoid potentially
9428: ambiguous matches such as “<span class=
9429: "quote">tk-postgresql</span>” matching a
9430: “<span class="quote">tk-*</span>”
1.14 xtraeme 9431: <code class="varname">DEPENDS</code>.</p>
1.1 grant 9432:
9433: <p>Wildcards can also be used to specify that a
9434: package will only build against a certain minimum
9435: version of a pre-requisite:</p>
9436: <pre class="programlisting">
9437: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
9438: </pre>
9439:
9440: <p>This means that the package will build against
9441: version 3.5.4 of the tiff library or newer. Such
9442: a dependency may be warranted if, for example,
9443: the API of the library has changed with version
9444: 3.5.4 and a package would not compile against an
9445: earlier version of tiff.</p>
9446:
9447: <p>Please note that such dependencies should only
9448: be updated if a package requires a newer
9449: pre-requisite, but not to denote recommendations
9450: such as security updates or ABI changes that do
9451: not prevent a package from building correctly.
9452: Such recommendations can be expressed using
1.14 xtraeme 9453: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 9454: <pre class="programlisting">
9455: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
9456: </pre>
9457:
1.14 xtraeme 9458: <p>In addition to the above <code class=
9459: "varname">DEPENDS</code> line, this denotes that
1.1 grant 9460: while a package will build against
9461: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 9462: recommended. <code class=
9463: "varname">RECOMMENDED</code> entries will be
9464: turned into dependencies unless explicitly
9465: ignored (in which case a warning will be
9466: printed). Packages that are built with
1.1 grant 9467: recommendations ignored may not be uploaded to
9468: ftp.NetBSD.org by developers and should not be
9469: used across different systems that may have
9470: different versions of binary packages
9471: installed.</p>
9472:
9473: <p>For security fixes, please update the package
9474: vulnerabilities file as well as setting
1.14 xtraeme 9475: <code class="varname">RECOMMENDED</code>, see
1.1 grant 9476: <a href="#security-handling" title=
1.31 wiz 9477: "13.1.8. Handling packages with security problems">
9478: Section 13.1.8, “Handling packages with
1.1 grant 9479: security problems”</a> for more
9480: information.</p>
9481: </li>
9482:
9483: <li>
9484: <p>If your package needs some executable to be
1.17 sketch 9485: able to run correctly and if there's no
1.14 xtraeme 9486: <code class="filename">buildlink3.mk</code> file,
9487: this is specified using the <code class=
9488: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 9489: "http://www.w3.org/TR/xhtml1/transitional" href=
9490: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 9491: class="pkgname">print/lyx</a> package needs to be
9492: able to execute the latex binary from the teTeX
9493: package when it runs, and that is specified:</p>
1.1 grant 9494: <pre class="programlisting">
9495: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
9496: </pre>
9497:
9498: <p>The comment about wildcard dependencies from
9499: previous paragraph applies here, too.</p>
9500: </li>
9501: </ol>
9502: </div>
9503:
9504: <p>If your package needs files from another package to
9505: build, see the first part of the “<span class=
9506: "quote">do-configure</span>” target <a xmlns=
9507: "http://www.w3.org/TR/xhtml1/transitional" href=
9508: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20 ben 9509: class="pkgname">print/ghostscript5</a> package (it
9510: relies on the jpeg sources being present in source form
9511: during the build):</p>
1.1 grant 9512: <pre class="programlisting">
9513: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
9514: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
9515: fi
9516: </pre>
9517:
9518: <p>If you build any other packages that way, please
9519: make sure the working files are deleted too when this
9520: package's working files are cleaned up. The easiest way
9521: to do so is by adding a pre-clean target:</p>
9522: <pre class="programlisting">
9523: pre-clean:
9524: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
9525: </pre>
9526:
1.14 xtraeme 9527: <p>Please also note the <code class=
9528: "varname">BUILD_USES_MSGFMT</code> and <code class=
9529: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
9530: which are provided as convenience definitions. The
1.24 wiz 9531: former works out whether <a href=
9532: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
9533: <span class="citerefentry"><span class=
9534: "refentrytitle">msgfmt</span>(1)</span></a> is part of
9535: the base system, and, if it isn't, installs the
9536: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9537: href=
1.1 grant 9538: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20 ben 9539: class="pkgname">devel/gettext</a> package. The latter
9540: adds a build dependency on either an installed version
9541: of an older gettext package, or if it isn't, installs
9542: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9543: href=
9544: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
9545: class="pkgname">devel/gettext-m4</a> package.</p>
1.1 grant 9546: </div>
9547:
9548: <div class="sect2" lang="en" xml:lang="en">
9549: <div class="titlepage">
9550: <div>
9551: <div>
1.30 wiz 9552: <h3 class="title"><a name="conflicts" id=
1.31 wiz 9553: "conflicts"></a>13.1.5. Handling conflicts
1.1 grant 9554: with other packages</h3>
9555: </div>
9556: </div>
9557: </div>
9558:
9559: <p>Your package may conflict with other packages a user
9560: might already have installed on his system, e.g. if
9561: your package installs the same set of files like
9562: another package in our pkgsrc tree.</p>
9563:
1.14 xtraeme 9564: <p>In this case you can set <code class=
9565: "varname">CONFLICTS</code> to a space separated list of
1.1 grant 9566: packages (including version string) your package
9567: conflicts with.</p>
9568:
9569: <p>For example <a xmlns=
9570: "http://www.w3.org/TR/xhtml1/transitional" href=
9571: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20 ben 9572: class="pkgname">x11/Xaw3d</a> and <a xmlns=
9573: "http://www.w3.org/TR/xhtml1/transitional" href=
9574: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
9575: class="pkgname">x11/Xaw-Xpm</a> install provide the
9576: same shared library, thus you set in <code class=
9577: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 9578: <pre class="programlisting">
9579: CONFLICTS= Xaw-Xpm-[0-9]*
9580: </pre>
9581:
1.14 xtraeme 9582: <p>and in <code class=
9583: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 9584: <pre class="programlisting">
9585: CONFLICTS= Xaw3d-[0-9]*
9586: </pre>
9587:
9588: <p>Packages will automatically conflict with other
9589: packages with the name prefix and a different version
9590: string. “<span class=
9591: "quote">Xaw3d-1.5</span>” e.g. will automatically
9592: conflict with the older version “<span class=
9593: "quote">Xaw3d-1.3</span>”.</p>
9594: </div>
9595:
9596: <div class="sect2" lang="en" xml:lang="en">
9597: <div class="titlepage">
9598: <div>
9599: <div>
1.30 wiz 9600: <h3 class="title"><a name="not-building-packages"
9601: id=
1.31 wiz 9602: "not-building-packages"></a>13.1.6. Packages
1.30 wiz 9603: that cannot or should not be built</h3>
1.1 grant 9604: </div>
9605: </div>
9606: </div>
9607:
9608: <p>There are several reasons why a package might be
9609: instructed to not build under certain circumstances. If
9610: the package builds and runs on most platforms, the
1.14 xtraeme 9611: exceptions should be noted with <code class=
9612: "varname">NOT_FOR_PLATFORM</code>. If the package
9613: builds and runs on a small handful of platforms, set
9614: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
9615: If the package should be skipped (for example, because
9616: it provides functionality already provided by the
9617: system), set <code class=
9618: "varname">PKG_SKIP_REASON</code> to a descriptive
9619: message. If the package should fail because some
9620: preconditions are not met, set <code class=
9621: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 9622: message.</p>
9623:
1.14 xtraeme 9624: <p><code class="varname">IGNORE</code> is deprecated
1.1 grant 9625: because it didn't provide enough information to
9626: determine whether the build should fail.</p>
9627: </div>
9628:
9629: <div class="sect2" lang="en" xml:lang="en">
9630: <div class="titlepage">
9631: <div>
9632: <div>
1.30 wiz 9633: <h3 class="title"><a name="undeletable-packages"
9634: id=
1.31 wiz 9635: "undeletable-packages"></a>13.1.7. Packages
1.30 wiz 9636: which should not be deleted, once installed</h3>
1.1 grant 9637: </div>
9638: </div>
9639: </div>
9640:
9641: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 9642: has been installed, the <code class=
9643: "varname">PKG_PRESERVE</code> definition should be set
9644: in the package Makefile. This will be carried into any
1.1 grant 9645: binary package that is made from this pkgsrc entry. A
9646: “<span class="quote">preserved</span>”
9647: package will not be deleted using <a href=
9648: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
9649: <span class="citerefentry"><span class=
9650: "refentrytitle">pkg_delete</span>(1)</span></a> unless
9651: the “<span class="quote">-f</span>” option
9652: is used.</p>
9653: </div>
9654:
9655: <div class="sect2" lang="en" xml:lang="en">
9656: <div class="titlepage">
9657: <div>
9658: <div>
9659: <h3 class="title"><a name="security-handling" id=
1.31 wiz 9660: "security-handling"></a>13.1.8. Handling
1.1 grant 9661: packages with security problems</h3>
9662: </div>
9663: </div>
9664: </div>
9665:
9666: <p>When a vulnerability is found, this should be noted
1.14 xtraeme 9667: in <code class=
9668: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1 grant 9669: and after the commit of that file, it should be copied
1.14 xtraeme 9670: to both <code class=
9671: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
9672: and <code class=
9673: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
9674: on ftp.NetBSD.org using <code class=
9675: "filename">localsrc/security/advisories/Makefile</code>.
9676: In addition, if a <code class=
9677: "filename">buildlink3.mk</code> file exists for an
9678: affected package, bumping <code class=
9679: "varname">PKGREVISION</code> and creating a
9680: corresponding <code class=
9681: "varname">BUILDLINK_RECOMMENDED.<em class=
9682: "replaceable"><code>pkg</code></em></code> entry should
9683: be considered. See <a href="#buildlink" title=
1.25 rillig 9684: "Chapter 10. Buildlink methodology">Chapter 10,
1.1 grant 9685: <i>Buildlink methodology</i></a> for more information
1.14 xtraeme 9686: about writing <code class=
9687: "filename">buildlink3.mk</code> files and <code class=
9688: "varname">BUILDLINK_*</code> definitions.</p>
1.1 grant 9689:
9690: <p>Also, if the fix should be applied to the stable
9691: pkgsrc branch, be sure to submit a pullup request!</p>
9692: </div>
9693:
9694: <div class="sect2" lang="en" xml:lang="en">
9695: <div class="titlepage">
9696: <div>
9697: <div>
1.30 wiz 9698: <h3 class="title"><a name="compiler-bugs" id=
1.31 wiz 9699: "compiler-bugs"></a>13.1.9. How to handle
1.1 grant 9700: compiler bugs</h3>
9701: </div>
9702: </div>
9703: </div>
9704:
9705: <p>Some source files trigger bugs in the compiler,
9706: based on combinations of compiler version and
9707: architecture and almost always relation to optimisation
9708: being enabled. Common symptoms are gcc internal errors
9709: or never finishing compiling a file.</p>
9710:
9711: <p>Typically a workaround involves testing the
1.14 xtraeme 9712: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 9713: version, disabling optimisation for that
1.14 xtraeme 9714: file/<code class="varname">MACHINE_ARCH</code>/compiler
9715: combination, and documenting it in <code class=
9716: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 9717: number of examples!</p>
9718: </div>
9719:
9720: <div class="sect2" lang="en" xml:lang="en">
9721: <div class="titlepage">
9722: <div>
9723: <div>
1.30 wiz 9724: <h3 class="title"><a name="bumping-pkgrevision"
1.31 wiz 9725: id="bumping-pkgrevision"></a>13.1.10. How to
1.30 wiz 9726: handle incrementing versions when fixing an
9727: existing package</h3>
1.1 grant 9728: </div>
9729: </div>
9730: </div>
9731:
9732: <p>When making fixes to an existing package it can be
1.14 xtraeme 9733: useful to change the version number in <code class=
9734: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 9735: future versions by the original author, a
9736: “<span class="quote">nb1</span>”,
9737: “<span class="quote">nb2</span>”, ...
9738: suffix can be used on package versions by setting
1.14 xtraeme 9739: <code class="varname">PKGREVISION=1</code> (2, ...).
9740: The “<span class="quote">nb</span>” is
9741: treated like a “<span class=
9742: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 9743: <pre class="programlisting">
9744: DISTNAME= foo-17.42
9745: PKGREVISION= 9
9746: </pre>
9747:
1.14 xtraeme 9748: <p>will result in a <code class=
9749: "varname">PKGNAME</code> of “<span class=
1.1 grant 9750: "quote">foo-17.42nb9</span>”.</p>
9751:
9752: <p>When a new release of the package is released, the
1.14 xtraeme 9753: <code class="varname">PKGREVISION</code> should be
9754: removed. e.g. on a new minor release of the above
9755: package, things should be like:</p>
1.1 grant 9756: <pre class="programlisting">
9757: DISTNAME= foo-17.43
9758: </pre>
9759: </div>
9760:
9761: <div class="sect2" lang="en" xml:lang="en">
9762: <div class="titlepage">
9763: <div>
9764: <div>
1.30 wiz 9765: <h3 class="title"><a name=
9766: "portability-of-packages" id=
1.31 wiz 9767: "portability-of-packages"></a>13.1.11. Portability
1.30 wiz 9768: of packages</h3>
1.1 grant 9769: </div>
9770: </div>
9771: </div>
9772:
9773: <p>One appealing feature of pkgsrc is that it runs on
9774: many different platforms. As a result, it is important
9775: to ensure, where possible, that packages in pkgsrc are
9776: portable. There are some particular details you should
9777: pay attention to while working on pkgsrc.</p>
9778:
9779: <div class="sect3" lang="en" xml:lang="en">
9780: <div class="titlepage">
9781: <div>
9782: <div>
1.30 wiz 9783: <h4 class="title"><a name="install-scripts" id=
1.31 wiz 9784: "install-scripts"></a>13.1.11.1. ${INSTALL},
1.1 grant 9785: ${INSTALL_DATA_DIR}, ...</h4>
9786: </div>
9787: </div>
9788: </div>
9789:
1.14 xtraeme 9790: <p>The BSD-compatible <span><strong class=
9791: "command">install</strong></span> supplied with some
1.1 grant 9792: operating systems will not perform more than one
9793: operation at a time. As such, you should call
9794: “<span class="quote">${INSTALL}</span>”,
9795: etc. like this:</p>
9796: <pre class="programlisting">
9797: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
9798: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
9799: </pre>
9800: </div>
9801: </div>
9802: </div>
9803:
9804: <div class="sect1" lang="en" xml:lang="en">
9805: <div class="titlepage">
9806: <div>
9807: <div>
9808: <h2 class="title" style="clear: both"><a name=
1.30 wiz 9809: "downloading-issues" id=
9810: "downloading-issues"></a>13.2. Possible
1.1 grant 9811: downloading issues</h2>
9812: </div>
9813: </div>
9814: </div>
9815:
9816: <div class="sect2" lang="en" xml:lang="en">
9817: <div class="titlepage">
9818: <div>
9819: <div>
1.30 wiz 9820: <h3 class="title"><a name="no-plain-download" id=
9821: "no-plain-download"></a>13.2.1. Packages
9822: whose distfiles aren't available for plain
1.1 grant 9823: downloading</h3>
9824: </div>
9825: </div>
9826: </div>
9827:
9828: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 9829: set <code class="varname">DYNAMIC_MASTER_SITES</code>
9830: and a <span><strong class="command">make
9831: fetch</strong></span> will call <code class=
9832: "filename">files/getsite.sh</code> with the name of
9833: each file to download as an argument, expecting it to
9834: output the URL of the directory from which to download
9835: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9836: href=
1.1 grant 9837: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20 ben 9838: class="pkgname">graphics/ns-cult3d</a> is an example of
9839: this usage.</p>
1.1 grant 9840:
9841: <p>If the download can't be automated, because the user
9842: must submit personal information to apply for a
9843: password, or must pay for the source, or whatever, you
1.14 xtraeme 9844: can set <code class="varname">_FETCH_MESSAGE</code> to
9845: a macro which displays a message explaining the
9846: situation. <code class="varname">_FETCH_MESSAGE</code>
9847: must be executable shell commands, not just a message.
9848: (Generally, it executes <code class=
9849: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 9850: following packages use this: <a xmlns=
9851: "http://www.w3.org/TR/xhtml1/transitional" href=
9852: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20 ben 9853: class="pkgname">audio/realplayer</a>, <a xmlns=
9854: "http://www.w3.org/TR/xhtml1/transitional" href=
9855: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
9856: class="pkgname">cad/simian</a>, <a xmlns=
9857: "http://www.w3.org/TR/xhtml1/transitional" href=
9858: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
9859: class="pkgname">devel/ipv6socket</a>, <a xmlns=
9860: "http://www.w3.org/TR/xhtml1/transitional" href=
9861: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
9862: class="pkgname">emulators/vmware-module</a>, <a xmlns=
9863: "http://www.w3.org/TR/xhtml1/transitional" href=
9864: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
9865: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
9866: "http://www.w3.org/TR/xhtml1/transitional" href=
9867: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
9868: class="pkgname">sysutils/storage-manager</a>, <a xmlns=
9869: "http://www.w3.org/TR/xhtml1/transitional" href=
9870: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
9871: class="pkgname">www/ap-aolserver</a>, <a xmlns=
9872: "http://www.w3.org/TR/xhtml1/transitional" href=
9873: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
9874: class="pkgname">www/openacs</a>. Try to be consistent
9875: with them.</p>
1.1 grant 9876: </div>
9877:
9878: <div class="sect2" lang="en" xml:lang="en">
9879: <div class="titlepage">
9880: <div>
9881: <div>
1.30 wiz 9882: <h3 class="title"><a name=
9883: "modified-distfiles-same-name" id=
9884: "modified-distfiles-same-name"></a>13.2.2. How
9885: to handle modified distfiles with the 'old'
9886: name</h3>
1.1 grant 9887: </div>
9888: </div>
9889: </div>
9890:
9891: <p>Sometimes authors of a software package make some
9892: modifications after the software was released, and they
9893: put up a new distfile without changing the package's
9894: version number. If a package is already in pkgsrc at
1.32 ! wiz 9895: that time, the checksum will no longer match. The
! 9896: contents of the new distfile should be compared against
! 9897: the old one before changing anything, to make sure the
! 9898: distfile was really updated on purpose, and that no
! 9899: trojan horse or so crept in. Then, the correct way to
! 9900: work around this is to set <code class=
! 9901: "varname">DIST_SUBDIR</code> to a unique directory
! 9902: name, usually based on <code class=
! 9903: "varname">PKGNAME_NOREV</code>. In case this happens
! 9904: more often, <code class="varname">PKGNAME</code> can be
! 9905: used (thus including the <code class=
! 9906: "filename">nbX</code> suffix) or a date stamp can be
! 9907: appended, like <code class=
! 9908: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
! 9909: forget regenerating the <code class=
! 9910: "filename">distinfo</code> file after that, since it
! 9911: contains the <code class="varname">DIST_SUBDIR</code>
! 9912: path in the filenames. Furthermore, a mail to the
! 9913: package's authors seems appropriate telling them that
! 9914: changing distfiles after releases without changing the
! 9915: file names is not good practice.</p>
1.1 grant 9916: </div>
9917: </div>
9918:
9919: <div class="sect1" lang="en" xml:lang="en">
9920: <div class="titlepage">
9921: <div>
9922: <div>
9923: <h2 class="title" style="clear: both"><a name=
1.30 wiz 9924: "configuration-gotchas" id=
9925: "configuration-gotchas"></a>13.3. Configuration
1.1 grant 9926: gotchas</h2>
9927: </div>
9928: </div>
9929: </div>
9930:
9931: <div class="sect2" lang="en" xml:lang="en">
9932: <div class="titlepage">
9933: <div>
9934: <div>
9935: <h3 class="title"><a name="fixes.libtool" id=
1.25 rillig 9936: "fixes.libtool"></a>13.3.1. Shared libraries
1.1 grant 9937: - libtool</h3>
9938: </div>
9939: </div>
9940: </div>
9941:
9942: <p>pkgsrc supports many different machines, with
9943: different object formats like a.out and ELF, and
9944: varying abilities to do shared library and dynamic
9945: loading at all. To accompany this, varying commands and
9946: options have to be passed to the compiler, linker, etc.
9947: to get the Right Thing, which can be pretty annoying
9948: especially if you don't have all the machines at your
9949: hand to test things. The <a xmlns=
9950: "http://www.w3.org/TR/xhtml1/transitional" href=
9951: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20 ben 9952: class="pkgname">devel/libtool</a> pkg can help here, as
9953: it just “<span class="quote">knows</span>”
9954: how to build both static and dynamic libraries from a
9955: set of source files, thus being platform
9956: independent.</p>
1.1 grant 9957:
9958: <p>Here's how to use libtool in a pkg in seven simple
9959: steps:</p>
9960:
9961: <div class="orderedlist">
9962: <ol type="1">
9963: <li>
1.14 xtraeme 9964: <p>Add <code class=
9965: "varname">USE_LIBTOOL=yes</code> to the package
9966: Makefile.</p>
1.1 grant 9967: </li>
9968:
9969: <li>
9970: <p>For library objects, use “<span class=
9971: "quote">${LIBTOOL} --mode=compile
9972: ${CC}</span>” in place of
9973: “<span class="quote">${CC}</span>”.
9974: You could even add it to the definition of
1.14 xtraeme 9975: <code class="varname">CC</code>, if only
9976: libraries are being built in a given Makefile.
9977: This one command will build both PIC and non-PIC
9978: library objects, so you need not have separate
9979: shared and non-shared library rules.</p>
1.1 grant 9980: </li>
9981:
9982: <li>
9983: <p>For the linking of the library, remove any
9984: “<span class="quote">ar</span>”,
9985: “<span class="quote">ranlib</span>”,
9986: and “<span class="quote">ld
9987: -Bshareable</span>” commands, and instead
9988: use:</p>
9989: <pre class="programlisting">
9990: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
9991: </pre>
9992:
9993: <p>Note that the library is changed to have a
1.14 xtraeme 9994: <code class="filename">.la</code> extension, and
9995: the objects are changed to have a <code class=
9996: "filename">.lo</code> extension. Change
9997: <code class="varname">OBJS</code> as necessary.
9998: This automatically creates all of the
9999: <code class="filename">.a</code>, <code class=
10000: "filename">.so.major.minor</code>, and ELF
10001: symlinks (if necessary) in the build directory.
10002: Be sure to include “<span class=
1.1 grant 10003: "quote">-version-info</span>”, especially
10004: when major and minor are zero, as libtool will
10005: otherwise strip off the shared library
10006: version.</p>
10007:
10008: <p>From the libtool manual:</p>
10009: <pre class="programlisting">
10010: So, libtool library versions are described by three integers:
10011:
10012: CURRENT
10013: The most recent interface number that this library implements.
10014:
10015: REVISION
10016: The implementation number of the CURRENT interface.
10017:
10018: AGE
10019: The difference between the newest and oldest interfaces that this
10020: library implements. In other words, the library implements all the
10021: interface numbers in the range from number `CURRENT - AGE' to
10022: `CURRENT'.
10023:
10024: If two libraries have identical CURRENT and AGE numbers, then the
10025: dynamic linker chooses the library with the greater REVISION number.
10026: </pre>
10027:
10028: <p>The “<span class=
10029: "quote">-release</span>” option will
10030: produce different results for a.out and ELF
10031: (excluding symlinks) in only one case. An ELF
10032: library of the form “<span class=
10033: "quote">libfoo-release.so.<span class=
10034: "emphasis"><em>x</em></span>.<span class=
10035: "emphasis"><em>y</em></span></span>” will
10036: have a symlink of “<span class=
10037: "quote">libfoo.so.<span class=
10038: "emphasis"><em>x</em></span>.<span class=
10039: "emphasis"><em>y</em></span></span>” on an
10040: a.out platform. This is handled
10041: automatically.</p>
10042:
10043: <p>The “<span class="quote">-rpath
10044: argument</span>” is the install directory
10045: of the library being built.</p>
10046:
1.14 xtraeme 10047: <p>In the <code class="filename">PLIST</code>,
1.19 hubertf 10048: include only the <code class=
10049: "filename">.la</code> file, the other files will
10050: be added automatically.</p>
1.1 grant 10051: </li>
10052:
10053: <li>
1.14 xtraeme 10054: <p>When linking shared object (<code class=
10055: "filename">.so</code>) files, i.e. files that are
1.24 wiz 10056: loaded via <a href=
10057: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
10058: <span class="citerefentry"><span class=
10059: "refentrytitle">dlopen</span>(3)</span></a>, NOT
10060: shared libraries, use “<span class=
10061: "quote">-module -avoid-version</span>” to
10062: prevent them getting version tacked on.</p>
1.1 grant 10063:
1.14 xtraeme 10064: <p>The <code class="filename">PLIST</code> file
10065: gets the <code class="filename">foo.so</code>
10066: entry.</p>
1.1 grant 10067: </li>
10068:
10069: <li>
10070: <p>When linking programs that depend on these
10071: libraries <span class=
10072: "emphasis"><em>before</em></span> they are
10073: installed, preface the <a href=
10074: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
10075: <span class="citerefentry"><span class=
10076: "refentrytitle">cc</span>(1)</span></a> or
10077: <a href=
10078: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
10079: <span class="citerefentry"><span class=
10080: "refentrytitle">ld</span>(1)</span></a> line with
10081: “<span class="quote">${LIBTOOL}
10082: --mode=link</span>”, and it will find the
10083: correct libraries (static or shared), but please
10084: be aware that libtool will not allow you to
10085: specify a relative path in -L (such as
10086: “<span class=
10087: "quote">-L../somelib</span>”), because it
10088: expects you to change that argument to be the
1.14 xtraeme 10089: <code class="filename">.la</code> file. e.g.</p>
1.1 grant 10090: <pre class="programlisting">
10091: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
10092: </pre>
10093:
10094: <p>should be changed to:</p>
10095: <pre class="programlisting">
1.14 xtraeme 10096: ${LIBTOOL} --mode=link ${CC} -o <em class=
10097: "replaceable"><code>someprog</code></em> <em class=
10098: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 10099: </pre>
10100:
10101: <p>and it will do the right thing with the
10102: libraries.</p>
10103: </li>
10104:
10105: <li>
10106: <p>When installing libraries, preface the
10107: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
10108: <span class="citerefentry"><span class=
10109: "refentrytitle">install</span>(1)</span></a> or
10110: <a href=
10111: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
10112: <span class="citerefentry"><span class=
10113: "refentrytitle">cp</span>(1)</span></a> command
10114: with “<span class="quote">${LIBTOOL}
10115: --mode=install</span>”, and change the
1.14 xtraeme 10116: library name to <code class=
10117: "filename">.la</code>. e.g.</p>
1.1 grant 10118: <pre class="programlisting">
10119: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
10120: </pre>
10121:
1.14 xtraeme 10122: <p>This will install the static <code class=
10123: "filename">.a</code>, shared library, any needed
1.1 grant 10124: symlinks, and run <a href=
10125: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
10126: <span class="citerefentry"><span class=
10127: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
10128: </li>
10129:
10130: <li>
1.14 xtraeme 10131: <p>In your <code class="filename">PLIST</code>,
1.23 wiz 10132: include only the <code class=
10133: "filename">.la</code> file (this is a change from
10134: previous behaviour).</p>
1.1 grant 10135: </li>
10136: </ol>
10137: </div>
10138: </div>
10139:
10140: <div class="sect2" lang="en" xml:lang="en">
10141: <div class="titlepage">
10142: <div>
10143: <div>
1.30 wiz 10144: <h3 class="title"><a name="using-libtool" id=
10145: "using-libtool"></a>13.3.2. Using libtool on
10146: GNU packages that already support libtool</h3>
1.1 grant 10147: </div>
10148: </div>
10149: </div>
10150:
1.14 xtraeme 10151: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
10152: the package Makefile. This will override the package's
10153: own libtool in most cases. For older libtool using
1.1 grant 10154: packages, libtool is made by ltconfig script during the
10155: do-configure step; you can check the libtool script
1.14 xtraeme 10156: location by doing <span><strong class="command">make
10157: configure; find work*/ -name
10158: libtool</strong></span>.</p>
10159:
10160: <p><code class="varname">LIBTOOL_OVERRIDE</code>
10161: specifies which libtool scripts, relative to
10162: <code class="varname">WRKSRC</code>, to override. By
10163: default, it is set to “<span class=
10164: "quote">libtool */libtool */*/libtool</span>”. If
10165: this does not match the location of the package's
10166: libtool script(s), set it as appropriate.</p>
1.13 hubertf 10167:
1.14 xtraeme 10168: <p>If you do not need <code class="filename">*.a</code>
1.1 grant 10169: static libraries built and installed, then use
1.14 xtraeme 10170: <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1 grant 10171: instead.</p>
10172:
10173: <p>If your package makes use of the platform
10174: independent library for loading dynamic shared objects,
10175: that comes with libtool (libltdl), you should include
1.22 tv 10176: devel/libltdl/buildlink3.mk.</p>
1.1 grant 10177:
10178: <p>Some packages use libtool incorrectly so that the
10179: package may not work or build in some circumstances.
10180: Some of the more common errors are:</p>
10181:
10182: <div class="itemizedlist">
10183: <ul type="disc">
10184: <li>
10185: <p>The inclusion of a shared object (-module) as
10186: a dependent library in an executable or library.
10187: This in itself isn't a problem if one of two
10188: things has been done:</p>
10189:
10190: <div class="orderedlist">
10191: <ol type="1">
10192: <li>
10193: <p>The shared object is named correctly,
1.14 xtraeme 10194: i.e. <code class=
10195: "filename">libfoo.la</code>, not
10196: <code class="filename">foo.la</code></p>
1.1 grant 10197: </li>
10198:
10199: <li>
10200: <p>The -dlopen option is used when linking
10201: an executable.</p>
10202: </li>
10203: </ol>
10204: </div>
10205: </li>
10206:
10207: <li>
10208: <p>The use of libltdl without the correct calls
10209: to initialisation routines. The function
10210: lt_dlinit() should be called and the macro
1.14 xtraeme 10211: <code class=
10212: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 10213: included in executables.</p>
10214: </li>
10215: </ul>
10216: </div>
10217: </div>
10218:
10219: <div class="sect2" lang="en" xml:lang="en">
10220: <div class="titlepage">
10221: <div>
10222: <div>
1.30 wiz 10223: <h3 class="title"><a name="autoconf-automake" id=
10224: "autoconf-automake"></a>13.3.3. GNU
1.1 grant 10225: Autoconf/Automake</h3>
10226: </div>
10227: </div>
10228: </div>
10229:
10230: <p>If a package needs GNU autoconf or automake to be
10231: executed to regenerate the configure script and
10232: Makefile.in makefile templates, then they should be
10233: executed in a pre-configure target. Two Makefile
1.14 xtraeme 10234: fragments are provided in <code class=
10235: "filename">pkgsrc/mk/autoconf.mk</code> and
10236: <code class="filename">pkgsrc/mk/automake.mk</code> to
10237: help dealing with these tools. See comments in these
10238: files for details.</p>
1.1 grant 10239:
10240: <p>For packages that need only autoconf:</p>
10241: <pre class="programlisting">
10242: AUTOCONF_REQD= 2.50 # if default version is not good enough
10243: ...
10244:
10245: pre-configure:
10246: cd ${WRKSRC}; ${AUTOCONF}
10247:
10248: ...
10249: .include "../../mk/autoconf.mk"
10250: </pre>
10251:
10252: <p>and for packages that need automake and
10253: autoconf:</p>
10254: <pre class="programlisting">
10255: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
10256: ...
10257:
10258: pre-configure:
10259: cd ${WRKSRC}; \
10260: ${ACLOCAL}; \
10261: ${AUTOHEADER}; \
10262: ${AUTOMAKE} -a --foreign -i; \
10263: ${AUTOCONF}
10264:
10265: ...
10266: .include "../mk/automake.mk"
10267: </pre>
10268:
10269: <p>Packages which use GNU Automake will almost
10270: certainly require GNU Make, but that's automatically
1.14 xtraeme 10271: provided for you in <code class=
10272: "filename">mk/automake.mk</code>.</p>
1.1 grant 10273:
10274: <p>There are times when the configure process makes
10275: additional changes to the generated files, which then
10276: causes the build process to try to re-execute the
10277: automake sequence. This is prevented by touching
10278: various files in the configure stage. If this causes
1.14 xtraeme 10279: problems with your package you can set <code class=
10280: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 10281: Makefile.</p>
10282: </div>
10283: </div>
10284:
10285: <div class="sect1" lang="en" xml:lang="en">
10286: <div class="titlepage">
10287: <div>
10288: <div>
10289: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10290: "building-considerations" id=
10291: "building-considerations"></a>13.4. Building
1.1 grant 10292: considerations</h2>
10293: </div>
10294: </div>
10295: </div>
10296:
10297: <div class="sect2" lang="en" xml:lang="en">
10298: <div class="titlepage">
10299: <div>
10300: <div>
1.30 wiz 10301: <h3 class="title"><a name="cpp-defines" id=
10302: "cpp-defines"></a>13.4.1. CPP defines</h3>
1.1 grant 10303: </div>
10304: </div>
10305: </div>
10306:
10307: <p>To port an application to NetBSD, it's usually
10308: necessary for the compiler to be able to judge the
10309: system on which it's compiling, and we use definitions
10310: so that the C pre-processor can do this.</p>
10311:
10312: <p>To test whether you are working on a 4.4 BSD-derived
10313: system, you should use the BSD definition, which is
1.14 xtraeme 10314: defined in <code class=
10315: "filename"><sys/param.h></code> on said
1.1 grant 10316: systems.</p>
10317: <pre class="programlisting">
10318: #include <sys/param.h>
10319: </pre>
10320:
10321: <p>and then you can surround the BSD-specific parts of
10322: your package's C/C++ code using this conditional:</p>
10323: <pre class="programlisting">
10324: #if (defined(BSD) && BSD >= 199306)
10325: ...
10326: #endif
10327: </pre>
10328:
10329: <p>Please use the “<span class=
10330: "quote">__NetBSD__</span>” definition sparingly -
10331: it should only apply to features of NetBSD that are not
10332: present in other 4.4-lite derived BSDs.</p>
10333: </div>
10334: </div>
10335:
10336: <div class="sect1" lang="en" xml:lang="en">
10337: <div class="titlepage">
10338: <div>
10339: <div>
10340: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10341: "package-specific-actions" id=
10342: "package-specific-actions"></a>13.5. Package
1.1 grant 10343: specific actions</h2>
10344: </div>
10345: </div>
10346: </div>
10347:
10348: <div class="sect2" lang="en" xml:lang="en">
10349: <div class="titlepage">
10350: <div>
10351: <div>
1.30 wiz 10352: <h3 class="title"><a name=
10353: "package-configuration-files" id=
10354: "package-configuration-files"></a>13.5.1. Package
1.1 grant 10355: configuration files</h3>
10356: </div>
10357: </div>
10358: </div>
10359:
10360: <p>Packages should be taught to look for their
1.14 xtraeme 10361: configuration files in <code class=
10362: "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1 grant 10363: through to the configure and build processes.
1.14 xtraeme 10364: <code class="varname">PKG_SYSCONFDIR</code> may be
1.1 grant 10365: customized in various ways by setting other make
10366: variables:</p>
10367:
10368: <div class="itemizedlist">
10369: <ul type="disc">
10370: <li>
1.14 xtraeme 10371: <p><code class="varname">PKG_SYSCONFBASE</code>
10372: is the main config directory under which all
10373: package configuration files are to be found. This
10374: defaults to <code class=
10375: "filename">${PREFIX}/etc</code>, but may be
10376: overridden in <code class=
10377: "filename">/etc/mk.conf</code>.</p>
1.1 grant 10378: </li>
10379:
10380: <li>
1.14 xtraeme 10381: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
10382: is the subdirectory of <code class=
10383: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 10384: configuration files for a particular package may
10385: be found, e.g. the Apache configuration files may
1.14 xtraeme 10386: all be found under the <code class=
10387: "filename">httpd/</code> subdirectory of
10388: <code class="varname">${PKG_SYSCONFBASE}</code>.
10389: This should be set in the package Makefile.</p>
1.1 grant 10390: </li>
10391:
10392: <li>
1.14 xtraeme 10393: <p>By default, <code class=
10394: "varname">PKG_SYSCONFDIR</code> is set to
10395: <code class=
10396: "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
10397: but this may be overridden by setting
10398: <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
10399: for a particular package, where <code class=
10400: "varname">PKG_SYSCONFVAR</code> defaults to
10401: <code class="varname">${PKGBASE}</code>. This is
10402: not meant to be set by a package Makefile, but is
1.1 grant 10403: reserved for users who wish to override the
1.14 xtraeme 10404: <code class="varname">PKG_SYSCONFDIR</code>
10405: setting for a particular package with a special
1.1 grant 10406: location.</p>
10407: </li>
10408: </ul>
10409: </div>
10410:
10411: <p>The only variables that users should customize are
1.14 xtraeme 10412: <code class="varname">PKG_SYSCONFBASE</code> and
10413: <code class=
10414: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
10415: Users will typically want to set <code class=
10416: "varname">PKG_SYSCONFBASE</code> to <code class=
10417: "filename">/etc</code>, or to accept the default
10418: location of <code class=
10419: "filename">${PREFIX}/etc</code>.</p>
1.1 grant 10420: </div>
10421:
10422: <div class="sect2" lang="en" xml:lang="en">
10423: <div class="titlepage">
10424: <div>
10425: <div>
1.30 wiz 10426: <h3 class="title"><a name="user-interaction" id=
10427: "user-interaction"></a>13.5.2. User
1.2 hubertf 10428: interaction</h3>
1.1 grant 10429: </div>
10430: </div>
10431: </div>
10432:
10433: <p>Occasionally, packages require interaction from the
10434: user, and this can be in a number of ways:</p>
10435:
10436: <div class="itemizedlist">
10437: <ul type="disc">
10438: <li>
10439: <p>help in fetching the distfiles</p>
10440: </li>
10441:
10442: <li>
10443: <p>help to configure the package before it is
10444: built</p>
10445: </li>
10446:
10447: <li>
10448: <p>help during the build process</p>
10449: </li>
10450:
10451: <li>
10452: <p>help during the installation of a package</p>
10453: </li>
10454: </ul>
10455: </div>
10456:
1.14 xtraeme 10457: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 10458: definition is provided to notify the pkgsrc mechanism
10459: of an interactive stage which will be needed, and this
1.14 xtraeme 10460: should be set in the package's <code class=
10461: "filename">Makefile</code>. e.g.</p>
1.1 grant 10462: <pre class="programlisting">
10463: INTERACTIVE_STAGE= build
10464: </pre>
10465:
10466: <p>Multiple interactive stages can be specified:</p>
10467: <pre class="programlisting">
10468: INTERACTIVE_STAGE= configure install
10469: </pre>
10470: </div>
10471:
10472: <div class="sect2" lang="en" xml:lang="en">
10473: <div class="titlepage">
10474: <div>
10475: <div>
1.30 wiz 10476: <h3 class="title"><a name="handling-licenses" id=
10477: "handling-licenses"></a>13.5.3. Handling
1.1 grant 10478: licenses</h3>
10479: </div>
10480: </div>
10481: </div>
10482:
10483: <p>A package may underly a license which the user has
10484: or has not agreed to accept. Usually, packages that
10485: underly well-known Open Source licenses (e.g. the GNU
10486: Public License, GPL) won't have any special license
10487: tags added in pkgsrc which require special action by
10488: the user of such packages, but there are quite a number
10489: of other licenses out there that pkgsrc users may not
10490: be able to follow, for whatever reasons. For these
10491: cases, pkgsrc contains a mechanism to note that a
10492: package underlies a certain license, and the user has
10493: to accept the license before the package can be
10494: installed.</p>
10495:
10496: <p>Placing a certain package under a certain license
1.14 xtraeme 10497: works by setting the <code class=
10498: "varname">LICENSE</code> variable to a string
10499: identifying the license, e.g. in <a xmlns=
10500: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10501: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20 ben 10502: class="pkgname">graphics/graphviz</a>:</p>
1.1 grant 10503: <pre class="programlisting">
10504: LICENSE= graphviz-license
10505: </pre>
10506:
10507: <p>When trying to build, the user will get a notice
10508: that the package underlies a license which he hasn't
10509: accepted (yet):</p>
10510: <pre class="programlisting">
1.14 xtraeme 10511: <code class="prompt">%</code> <strong class=
10512: "userinput"><code>make</code></strong>
1.1 grant 10513: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
10514: ===> To build this package, add this line to your /etc/mk.conf:
10515: ===> ACCEPTABLE_LICENSES+=graphviz-license
10516: ===> To view the license, enter "/usr/bin/make show-license".
10517: *** Error code 1
10518: </pre>
10519:
1.14 xtraeme 10520: <p>The license can be viewed with <span><strong class=
10521: "command">make show-license</strong></span>, and if it
10522: is considered appropriate, the line printed above can
10523: be added to <code class="filename">/etc/mk.conf</code>
10524: to indicate acceptance of the particular license:</p>
1.1 grant 10525: <pre class="programlisting">
10526: ACCEPTABLE_LICENSES+=graphviz-license
10527: </pre>
10528:
10529: <p>When adding a package with a new license, the
1.14 xtraeme 10530: license text should be added to <code class=
10531: "filename">pkgsrc/licenses</code> for displaying. A
10532: list of known licenses can be seen in this directory as
10533: well as by looking at the list of (commented out)
10534: <code class="varname">ACCEPTABLE_LICENSES</code>
10535: variable settings in <code class=
10536: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 10537:
1.17 sketch 10538: <p>If there is a <span class=
1.1 grant 10539: "emphasis"><em>really</em></span> pressing need to
10540: accept all licenses at once, like when trying to
10541: download or mirror all distfiles or doing a bulk build
10542: to test if all packages in pkgsrc build, this can be
1.14 xtraeme 10543: done by setting <code class=
10544: "varname">_ACCEPTABLE=yes</code>.</p>
1.1 grant 10545: </div>
10546:
10547: <div class="sect2" lang="en" xml:lang="en">
10548: <div class="titlepage">
10549: <div>
10550: <div>
1.30 wiz 10551: <h3 class="title"><a name="creating-accounts" id=
10552: "creating-accounts"></a>13.5.4. Creating an
10553: account from a package</h3>
1.1 grant 10554: </div>
10555: </div>
10556: </div>
10557:
10558: <p>There are two make variables used to control the
10559: creation of package-specific groups and users at
1.14 xtraeme 10560: pre-install time. The first is <code class=
10561: "varname">PKG_GROUPS</code>, which is a list of
1.1 grant 10562: group[:groupid] elements, where the groupid is
1.14 xtraeme 10563: optional. The second is <code class=
10564: "varname">PKG_USERS</code>, which is a list of elements
1.1 grant 10565: of the form:</p>
10566: <pre class="programlisting">
10567: user:group[:[userid][:[description][:[home][:shell]]]]
10568: </pre>
10569:
10570: <p>where only the user and group are required, the rest
10571: being optional. A simple example is:</p>
10572: <pre class="programlisting">
10573: PKG_GROUPS= foogroup
10574: PKG_USERS= foouser:foogroup
10575: </pre>
10576:
10577: <p>A more complex example is that creates two groups
10578: and two users is:</p>
10579: <pre class="programlisting">
10580: PKG_GROUPS= group1 group2:1005
10581: PKG_USERS= first:group1::First\\ User \
10582: second:group2::Second\\ User:/home/second:${SH}
10583: </pre>
10584:
10585: <p>By default, a new user will have home directory
1.14 xtraeme 10586: <code class="filename">/nonexistent</code>, and login
10587: shell <code class="filename">/sbin/nologin</code>
10588: unless they are specified as part of the user
10589: element.</p>
1.1 grant 10590:
1.14 xtraeme 10591: <p>The package <code class="filename">Makefile</code>
10592: must also set <code class=
10593: "varname">USE_PKGINSTALL=YES</code>. This will cause
10594: the users and groups to be created at pre-install time,
10595: and the admin will be prompted to remove them at
10596: post-deinstall time. Automatic creation of the users
10597: and groups can be toggled on and off by setting the
10598: <code class="varname">PKG_CREATE_USERGROUP</code>
10599: variable prior to package installation.</p>
1.1 grant 10600: </div>
10601:
10602: <div class="sect2" lang="en" xml:lang="en">
10603: <div class="titlepage">
10604: <div>
10605: <div>
1.30 wiz 10606: <h3 class="title"><a name=
10607: "installing-score-files" id=
10608: "installing-score-files"></a>13.5.5. Installing
10609: score files</h3>
1.1 grant 10610: </div>
10611: </div>
10612: </div>
10613:
10614: <p>Certain packages, most of them in the games
10615: category, install a score file that allows all users on
10616: the system to record their highscores. In order for
10617: this to work, the binaries need to be installed setgid
10618: and the score files owned by the appropriate group
10619: and/or owner (traditionally the "games" user/group).
10620: The following variables, documented in more detail in
1.14 xtraeme 10621: <code class="filename">mk/defaults/mk.conf</code>,
10622: control this behaviour: <code class=
10623: "varname">SETGIDGAME</code>, <code class=
10624: "varname">GAMEDATAMODE</code>, <code class=
10625: "varname">GAMEGRP</code>, <code class=
10626: "varname">GAMEMODE</code>, <code class=
10627: "varname">GAMEOWN</code>.</p>
1.1 grant 10628:
10629: <p>Note that per default, setgid installation of games
1.14 xtraeme 10630: is disabled; setting <code class=
10631: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 10632: variables accordingly.</p>
10633:
10634: <p>A package should therefor never hard code file
1.14 xtraeme 10635: ownership or access permissions but rely on
10636: <code class="varname">INSTALL_GAME</code> and
10637: <code class="varname">INSTALL_GAME_DATA</code> to set
10638: these correctly.</p>
1.1 grant 10639: </div>
10640:
10641: <div class="sect2" lang="en" xml:lang="en">
10642: <div class="titlepage">
10643: <div>
10644: <div>
1.30 wiz 10645: <h3 class="title"><a name="login-shells" id=
10646: "login-shells"></a>13.5.6. Packages
10647: providing login shells</h3>
1.1 grant 10648: </div>
10649: </div>
10650: </div>
10651:
10652: <p>If the purpose of the package is to provide a login
1.14 xtraeme 10653: shell, the variable <code class=
10654: "varname">PKG_SHELL</code> should contain the full
10655: pathname of the shell executable installed by this
10656: package. The package <code class=
10657: "filename">Makefile</code> must also set <code class=
10658: "varname">USE_PKGINSTALL=YES</code> to use the
10659: automatically generated <code class=
10660: "filename">INSTALL</code>/<code class=
10661: "filename">DEINSTALL</code> scripts.</p>
1.1 grant 10662:
10663: <p>An example taken from shells/zsh:</p>
10664: <pre class="programlisting">
10665: USE_PKGINSTALL= YES
10666: PKG_SHELL= ${PREFIX}/bin/zsh
10667: </pre>
10668:
1.14 xtraeme 10669: <p>The shell is registered into <code class=
10670: "filename">/etc/shells</code> file automatically in the
10671: post-install target by the generated <code class=
10672: "filename">INSTALL</code> script and removed in the
10673: deinstall target by the <code class=
10674: "filename">DEINSTALL</code> script.</p>
1.1 grant 10675: </div>
10676:
10677: <div class="sect2" lang="en" xml:lang="en">
10678: <div class="titlepage">
10679: <div>
10680: <div>
1.30 wiz 10681: <h3 class="title"><a name="perl-scripts" id=
10682: "perl-scripts"></a>13.5.7. Packages
10683: containing perl scripts</h3>
1.1 grant 10684: </div>
10685: </div>
10686: </div>
10687:
10688: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 10689: set <code class="varname">REPLACE_PERL</code> to ensure
10690: that the proper interpreter path is set. <code class=
10691: "varname">REPLACE_PERL</code> should contain a list of
10692: scripts, relative to <code class=
10693: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 10694: </div>
10695:
10696: <div class="sect2" lang="en" xml:lang="en">
10697: <div class="titlepage">
10698: <div>
10699: <div>
1.30 wiz 10700: <h3 class="title"><a name="hardcoded-paths" id=
10701: "hardcoded-paths"></a>13.5.8. Packages with
1.1 grant 10702: hardcoded paths to other interpreters</h3>
10703: </div>
10704: </div>
10705: </div>
10706:
10707: <p>Your package may also contain scripts with hardcoded
10708: paths to other interpreters besides (or as well as)
10709: perl. To correct the full pathname to the script
10710: interpreter, you need to set the following definitions
1.14 xtraeme 10711: in your <code class="filename">Makefile</code> (we
10712: shall use <span><strong class=
10713: "command">tclsh</strong></span> in this example):</p>
1.1 grant 10714: <pre class="programlisting">
10715: REPLACE_INTERPRETER+= tcl
10716: _REPLACE.tcl.old= .*/bin/tclsh
10717: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
10718: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
10719: relative to ${WRKSRC}, just as in REPLACE_PERL
10720: </pre>
10721: </div>
10722:
10723: <div class="sect2" lang="en" xml:lang="en">
10724: <div class="titlepage">
10725: <div>
10726: <div>
1.30 wiz 10727: <h3 class="title"><a name="perl-modules" id=
10728: "perl-modules"></a>13.5.9. Packages
10729: installing perl modules</h3>
1.1 grant 10730: </div>
10731: </div>
10732: </div>
10733:
10734: <p>Makefiles of packages providing perl5 modules should
1.14 xtraeme 10735: include the Makefile fragment <code class=
10736: "filename">../../lang/perl5/module.mk</code>. It
10737: provides a <span><strong class=
10738: "command">do-configure</strong></span> target for the
10739: standard perl configuration for such modules as well as
10740: various hooks to tune this configuration. See comments
10741: in this file for details.</p>
1.1 grant 10742:
10743: <p>Perl5 modules will install into different places
10744: depending on the version of perl used during the build
10745: process. To address this, pkgsrc will append lines to
1.14 xtraeme 10746: the <code class="filename">PLIST</code> corresponding
10747: to the files listed in the installed <code class=
10748: "filename">.packlist</code> file generated by most
10749: perl5 modules. This is invoked by defining <code class=
10750: "varname">PERL5_PACKLIST</code> to a space-separated
10751: list of paths to packlist files, e.g.:</p>
1.1 grant 10752: <pre class="programlisting">
10753: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
10754: </pre>
10755:
1.14 xtraeme 10756: <p>The variables <code class=
10757: "varname">PERL5_SITELIB</code>, <code class=
10758: "varname">PERL5_SITEARCH</code>, and <code class=
10759: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 10760: locations in which perl5 modules may be installed, and
10761: may be used by perl5 packages that don't have a
10762: packlist. These three variables are also substituted
1.14 xtraeme 10763: for in the <code class="filename">PLIST</code>.</p>
1.1 grant 10764: </div>
10765:
10766: <div class="sect2" lang="en" xml:lang="en">
10767: <div class="titlepage">
10768: <div>
10769: <div>
10770: <h3 class="title"><a name="faq.info-files" id=
1.25 rillig 10771: "faq.info-files"></a>13.5.10. Packages
1.1 grant 10772: installing info files</h3>
10773: </div>
10774: </div>
10775: </div>
10776:
10777: <p>Some packages install info files or use the
10778: “<span class="quote">makeinfo</span>” or
10779: “<span class="quote">install-info</span>”
10780: commands. Each of the info files:</p>
10781:
10782: <div class="itemizedlist">
10783: <ul type="disc">
10784: <li>
10785: <p>is considered to be installed in the directory
1.14 xtraeme 10786: <code class=
10787: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 10788: </li>
10789:
10790: <li>
10791: <p>is registered in the Info directory file
1.14 xtraeme 10792: <code class=
10793: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 10794: </li>
10795:
10796: <li>
10797: <p>and must be listed as a filename in the
1.14 xtraeme 10798: <code class="varname">INFO_FILES</code> variable
10799: in the package Makefile.</p>
1.1 grant 10800: </li>
10801: </ul>
10802: </div>
10803:
1.14 xtraeme 10804: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 10805: “<span class="quote">info</span>” and can
1.14 xtraeme 10806: be overridden in the package Makefile. <code class=
10807: "filename">INSTALL</code> and <code class=
10808: "filename">DEINSTALL</code> scripts will be generated
10809: to handle registration of the info files in the Info
1.1 grant 10810: directory file. The “<span class=
10811: "quote">install-info</span>” command used for the
10812: info files registration is either provided by the
10813: system, or by a special purpose package automatically
10814: added as dependency if needed.</p>
10815:
10816: <p>A package which needs the “<span class=
10817: "quote">makeinfo</span>” command at build time
1.14 xtraeme 10818: must define the variable <code class=
10819: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 10820: minimum version of the “<span class=
10821: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 10822: should be noted with the <code class=
10823: "varname">TEXINFO_REQD</code> variable in the package
10824: <code class="filename">Makefile</code>. By default, a
1.1 grant 10825: minimum version of 3.12 is required. If the system does
1.14 xtraeme 10826: not provide a <span><strong class=
10827: "command">makeinfo</strong></span> command or if it
10828: does not match the required minimum, a build dependency
10829: on the <a xmlns=
10830: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10831: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20 ben 10832: class="pkgname">devel/gtexinfo</a> package will be
10833: added automatically.</p>
1.1 grant 10834:
10835: <p>The build and installation process of the software
10836: provided by the package should not use the
1.14 xtraeme 10837: <span><strong class=
10838: "command">install-info</strong></span> command as the
10839: registration of info files is the task of the package
10840: <code class="filename">INSTALL</code> script, and it
10841: must use the appropriate <span><strong class=
10842: "command">makeinfo</strong></span> command.</p>
1.1 grant 10843:
10844: <p>To achieve this goal the pkgsrc infrastructure
1.14 xtraeme 10845: creates overriding scripts for the <span><strong class=
10846: "command">install-info</strong></span> and
10847: <span><strong class="command">makeinfo</strong></span>
10848: commands in a directory listed early in <code class=
10849: "varname">PATH</code>.</p>
1.1 grant 10850:
1.14 xtraeme 10851: <p>The script overriding <span><strong class=
10852: "command">install-info</strong></span> has no effect
10853: except the logging of a message. The script overriding
10854: <span><strong class="command">makeinfo</strong></span>
10855: logs a message and according to the value of
10856: <code class="varname">USE_MAKEINFO</code> and
10857: <code class="varname">TEXINFO_REQD</code> either run
10858: the appropriate <span><strong class=
10859: "command">makeinfo</strong></span> command or exit on
10860: error.</p>
1.1 grant 10861: </div>
10862:
10863: <div class="sect2" lang="en" xml:lang="en">
10864: <div class="titlepage">
10865: <div>
10866: <div>
1.30 wiz 10867: <h3 class="title"><a name="gconf2-data-files" id=
10868: "gconf2-data-files"></a>13.5.11. Packages
10869: installing GConf2 data files</h3>
1.1 grant 10870: </div>
10871: </div>
10872: </div>
10873:
1.14 xtraeme 10874: <p>If a package installs <code class=
10875: "filename">.schemas</code> or <code class=
10876: "filename">.entries</code> files, used by GConf2, you
1.1 grant 10877: need to take some extra steps to make sure they get
10878: registered in the database:</p>
10879:
10880: <div class="orderedlist">
10881: <ol type="1">
10882: <li>
1.14 xtraeme 10883: <p>Include <code class=
10884: "filename">../../devel/GConf2/schemas.mk</code>
10885: instead of its <code class=
10886: "filename">buildlink3.mk</code> file. This takes
1.1 grant 10887: care of rebuilding the GConf2 database at
10888: installation and deinstallation time, and tells
10889: the package where to install GConf2 data files
10890: using some standard configure arguments. It also
10891: disallows any access to the database directly
10892: from the package.</p>
10893: </li>
10894:
10895: <li>
10896: <p>Ensure that the package installs its
1.14 xtraeme 10897: <code class="filename">.schemas</code> files
10898: under <code class=
10899: "filename">${PREFIX}/share/gconf/schemas</code>.
10900: If they get installed under <code class=
10901: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 10902: manually patch the package.</p>
10903: </li>
10904:
10905: <li>
10906: <p>Check the PLIST and remove any entries under
10907: the etc/gconf directory, as they will be handled
10908: automatically. See <a href="#faq.conf" title=
1.14 xtraeme 10909: "6.14. Configuration files handling and placement">
10910: Section 6.14, “Configuration files
1.1 grant 10911: handling and placement”</a> for more
10912: information.</p>
10913: </li>
10914:
10915: <li>
1.14 xtraeme 10916: <p>Define the <code class=
10917: "varname">GCONF2_SCHEMAS</code> variable in your
10918: <code class="filename">Makefile</code> with a
10919: list of all <code class=
10920: "filename">.schemas</code> files installed by the
10921: package, if any. Names must not contain any
10922: directories in them.</p>
1.1 grant 10923: </li>
10924:
10925: <li>
1.14 xtraeme 10926: <p>Define the <code class=
10927: "varname">GCONF2_ENTRIES</code> variable in your
10928: <code class="filename">Makefile</code> with a
10929: list of all <code class=
10930: "filename">.entries</code> files installed by the
10931: package, if any. Names must not contain any
10932: directories in them.</p>
1.1 grant 10933: </li>
10934: </ol>
10935: </div>
10936: </div>
10937:
10938: <div class="sect2" lang="en" xml:lang="en">
10939: <div class="titlepage">
10940: <div>
10941: <div>
1.30 wiz 10942: <h3 class="title"><a name=
10943: "scrollkeeper-data-files" id=
10944: "scrollkeeper-data-files"></a>13.5.12. Packages
10945: installing scrollkeeper data files</h3>
1.1 grant 10946: </div>
10947: </div>
10948: </div>
10949:
1.14 xtraeme 10950: <p>If a package installs <code class=
10951: "filename">.omf</code> files, used by scrollkeeper, you
10952: need to take some extra steps to make sure they get
10953: registered in the database:</p>
1.1 grant 10954:
10955: <div class="orderedlist">
10956: <ol type="1">
10957: <li>
1.14 xtraeme 10958: <p>Include <code class=
10959: "filename">../../textproc/scrollkeeper/omf.mk</code>
10960: instead of its <code class=
10961: "filename">buildlink3.mk</code> file. This takes
1.1 grant 10962: care of rebuilding the scrollkeeper database at
10963: installation and deinstallation time, and
10964: disallows any access to it directly from the
10965: package.</p>
10966: </li>
10967:
10968: <li>
10969: <p>Check the PLIST and remove any entries under
1.14 xtraeme 10970: the <code class=
10971: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 10972: as they will be handled automatically.</p>
10973: </li>
10974:
10975: <li>
1.14 xtraeme 10976: <p>Remove the <code class=
10977: "filename">share/omf</code> directory from the
10978: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 10979: </li>
10980: </ol>
10981: </div>
10982: </div>
10983:
10984: <div class="sect2" lang="en" xml:lang="en">
10985: <div class="titlepage">
10986: <div>
10987: <div>
1.30 wiz 10988: <h3 class="title"><a name="x11-fonts" id=
10989: "x11-fonts"></a>13.5.13. Packages installing
1.1 grant 10990: X11 fonts</h3>
10991: </div>
10992: </div>
10993: </div>
10994:
10995: <p>If a package installs font files, you will need to
10996: rebuild the fonts database in the directory where they
10997: get installed at installation and deinstallation time.
1.14 xtraeme 10998: This can be automatically done by using <code class=
10999: "filename">mk/fonts.mk</code>, which you need to
11000: include in your <code class=
11001: "filename">Makefile</code>.</p>
1.1 grant 11002:
11003: <p>When the file is included, you can list the
1.14 xtraeme 11004: directories where fonts are installed in the
11005: <code class="varname">FONTS_<em class=
11006: "replaceable"><code>type</code></em>_DIRS</code>
11007: variables, where <em class=
11008: "replaceable"><code>type</code></em> can be one of
11009: “<span class="quote">TTF</span>”,
1.1 grant 11010: “<span class="quote">TYPE1</span>” or
11011: “<span class="quote">X11</span>”. Also make
1.14 xtraeme 11012: sure that the database file <code class=
11013: "filename">fonts.dir</code> is not listed in the
1.1 grant 11014: PLIST.</p>
11015:
11016: <p>Note that you should not create new directories for
11017: fonts; instead use the standard ones to avoid that the
11018: user needs to manually configure his X server to find
11019: them.</p>
11020: </div>
11021:
11022: <div class="sect2" lang="en" xml:lang="en">
11023: <div class="titlepage">
11024: <div>
11025: <div>
1.30 wiz 11026: <h3 class="title"><a name="gtk2-modules" id=
11027: "gtk2-modules"></a>13.5.14. Packages
11028: installing GTK2 modules</h3>
1.1 grant 11029: </div>
11030: </div>
11031: </div>
11032:
11033: <p>If a package installs gtk2 immodules or loaders, you
11034: need to take some extra steps to get them registered in
11035: the GTK2 database properly:</p>
11036:
11037: <div class="orderedlist">
11038: <ol type="1">
11039: <li>
1.14 xtraeme 11040: <p>Include <code class=
11041: "filename">../../x11/gtk2/modules.mk</code>
11042: instead of its <code class=
11043: "filename">buildlink3.mk</code> file. This takes
11044: care of rebuilding the database at installation
11045: and deinstallation time.</p>
1.1 grant 11046: </li>
11047:
11048: <li>
1.14 xtraeme 11049: <p>Set <code class=
11050: "varname">GTK2_IMMODULES=YES</code> if your
11051: package installs GTK2 immodules.</p>
1.1 grant 11052: </li>
11053:
11054: <li>
1.14 xtraeme 11055: <p>Set <code class=
11056: "varname">GTK2_LOADERS=YES</code> if your package
11057: installs GTK2 loaders.</p>
1.1 grant 11058: </li>
11059:
11060: <li>
11061: <p>Patch the package to not touch any of the gtk2
11062: databases directly. These are:</p>
11063:
11064: <div class="itemizedlist">
11065: <ul type="disc">
11066: <li>
1.14 xtraeme 11067: <p><code class=
11068: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 11069: </li>
11070:
11071: <li>
1.14 xtraeme 11072: <p><code class=
11073: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 11074: </li>
11075: </ul>
11076: </div>
11077: </li>
11078:
11079: <li>
11080: <p>Check the PLIST and remove any entries under
1.14 xtraeme 11081: the <code class="filename">libdata/gtk-2.0</code>
1.1 grant 11082: directory, as they will be handled
11083: automatically.</p>
11084: </li>
11085: </ol>
11086: </div>
11087: </div>
11088:
11089: <div class="sect2" lang="en" xml:lang="en">
11090: <div class="titlepage">
11091: <div>
11092: <div>
1.30 wiz 11093: <h3 class="title"><a name="sgml-xml-data" id=
11094: "sgml-xml-data"></a>13.5.15. Packages
11095: installing SGML or XML data</h3>
1.1 grant 11096: </div>
11097: </div>
11098: </div>
11099:
11100: <p>If a package installs SGML or XML data files that
11101: need to be registered in system-wide catalogs (like
11102: DTDs, sub-catalogs, etc.), you need to take some extra
11103: steps:</p>
11104:
11105: <div class="orderedlist">
11106: <ol type="1">
11107: <li>
1.14 xtraeme 11108: <p>Include <code class=
11109: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
11110: in your <code class="filename">Makefile</code>,
11111: which takes care of registering those files in
1.1 grant 11112: system-wide catalogs at installation and
11113: deinstallation time.</p>
11114: </li>
11115:
11116: <li>
1.14 xtraeme 11117: <p>Set <code class="varname">SGML_CATALOGS</code>
11118: to the full path of any SGML catalogs installed
11119: by the package.</p>
1.1 grant 11120: </li>
11121:
11122: <li>
1.14 xtraeme 11123: <p>Set <code class="varname">XML_CATALOGS</code>
11124: to the full path of any XML catalogs installed by
1.1 grant 11125: the package.</p>
11126: </li>
11127:
11128: <li>
1.14 xtraeme 11129: <p>Set <code class="varname">SGML_ENTRIES</code>
11130: to individual entries to be added to the SGML
1.1 grant 11131: catalog. These come in groups of three strings;
11132: see xmlcatmgr(1) for more information
11133: (specifically, arguments recognized by the 'add'
11134: action). Note that you will normally not use this
11135: variable.</p>
11136: </li>
11137:
11138: <li>
1.14 xtraeme 11139: <p>Set <code class="varname">XML_ENTRIES</code>
11140: to individual entries to be added to the XML
1.1 grant 11141: catalog. These come in groups of three strings;
11142: see xmlcatmgr(1) for more information
11143: (specifically, arguments recognized by the 'add'
11144: action). Note that you will normally not use this
11145: variable.</p>
11146: </li>
11147: </ol>
11148: </div>
11149: </div>
11150:
11151: <div class="sect2" lang="en" xml:lang="en">
11152: <div class="titlepage">
11153: <div>
11154: <div>
1.30 wiz 11155: <h3 class="title"><a name="mime-database" id=
11156: "mime-database"></a>13.5.16. Packages
11157: installing extensions to the MIME database</h3>
1.1 grant 11158: </div>
11159: </div>
11160: </div>
11161:
11162: <p>If a package provides extensions to the MIME
1.14 xtraeme 11163: database by installing <code class=
11164: "filename">.xml</code> files inside <code class=
11165: "filename">${PREFIX}/share/mime/packages</code>, you
11166: need to take some extra steps to ensure that the
11167: database is kept consistent with respect to these new
11168: files:</p>
1.1 grant 11169:
11170: <div class="orderedlist">
11171: <ol type="1">
11172: <li>
1.14 xtraeme 11173: <p>Include <code class=
11174: "filename">../../databases/shared-mime-info/mimedb.mk</code>
11175: (avoid using the <code class=
11176: "filename">buildlink3.mk</code> file from this
11177: same directory, which is reserved for inclusion
11178: from other <code class=
11179: "filename">buildlink3.mk</code> files). It takes
11180: care of rebuilding the MIME database at
11181: installation and deinstallation time, and
11182: disallows any access to it directly from the
1.1 grant 11183: package.</p>
11184: </li>
11185:
11186: <li>
11187: <p>Check the PLIST and remove any entries under
1.14 xtraeme 11188: the <code class="filename">share/mime</code>
1.1 grant 11189: directory, <span class=
11190: "emphasis"><em>except</em></span> for files saved
1.14 xtraeme 11191: under <code class=
11192: "filename">share/mime/packages</code>. The former
1.1 grant 11193: are handled automatically by the
11194: update-mime-database program, but the later are
11195: package-dependent and must be removed by the
11196: package that installed them in the first
11197: place.</p>
11198: </li>
11199:
11200: <li>
1.14 xtraeme 11201: <p>Remove any <code class=
11202: "filename">share/mime/*</code> directories from
11203: the PLIST. They will be handled by the
1.1 grant 11204: shared-mime-info package.</p>
11205: </li>
11206: </ol>
11207: </div>
11208: </div>
11209:
11210: <div class="sect2" lang="en" xml:lang="en">
11211: <div class="titlepage">
11212: <div>
11213: <div>
1.30 wiz 11214: <h3 class="title"><a name="intltool" id=
11215: "intltool"></a>13.5.17. Packages using
1.1 grant 11216: intltool</h3>
11217: </div>
11218: </div>
11219: </div>
11220:
11221: <p>If a package uses intltool during its build, include
1.14 xtraeme 11222: the <code class=
11223: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 11224: file, which forces it to use the intltool package
11225: provided by pkgsrc, instead of the one bundled with the
11226: distribution file.</p>
11227:
11228: <p>This tracks intltool's build-time dependencies and
11229: uses the latest available version; this way, the
11230: package benefits of any bug fixes that may have
11231: appeared since it was released.</p>
11232: </div>
1.18 xtraeme 11233:
11234: <div class="sect2" lang="en" xml:lang="en">
11235: <div class="titlepage">
11236: <div>
11237: <div>
1.30 wiz 11238: <h3 class="title"><a name="startup-scripts" id=
11239: "startup-scripts"></a>13.5.18. Packages
11240: installing startup scripts</h3>
1.18 xtraeme 11241: </div>
11242: </div>
11243: </div>
11244:
11245: <p>If a package contains a rc.d script, it won't be
11246: copied into the startup directory by default, but you
11247: can enable it, by adding the option <code class=
11248: "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
11249: "filename">/etc/mk.conf</code>. This option will copy
11250: the scripts into <code class=
11251: "filename">/etc/rc.d</code> when a package is
11252: installed, and it will automatically remove the scripts
11253: when the package is deinstalled.</p>
11254: </div>
1.1 grant 11255: </div>
11256:
11257: <div class="sect1" lang="en" xml:lang="en">
11258: <div class="titlepage">
11259: <div>
11260: <div>
11261: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11262: "feedback-to-author" id=
11263: "feedback-to-author"></a>13.6. Feedback to the
11264: author</h2>
1.1 grant 11265: </div>
11266: </div>
11267: </div>
11268:
11269: <p>If you have found any bugs in the package you make
11270: available, if you had to do special steps to make it run
11271: under NetBSD or if you enhanced the software in various
11272: other ways, be sure to report these changes back to the
11273: original author of the program! With that kind of
11274: support, the next release of the program can incorporate
11275: these fixes, and people not using the NetBSD packages
11276: system can win from your efforts.</p>
11277:
11278: <p>Support the idea of free software!</p>
11279: </div>
11280: </div>
11281:
11282: <div class="chapter" lang="en" xml:lang="en">
11283: <div class="titlepage">
11284: <div>
11285: <div>
11286: <h2 class="title"><a name="debug" id=
1.25 rillig 11287: "debug"></a>Chapter 14. Debugging</h2>
1.1 grant 11288: </div>
11289: </div>
11290: </div>
11291:
11292: <p>To check out all the gotchas when building a package,
11293: here are the steps that I do in order to get a package
11294: working. Please note this is basically the same as what was
11295: explained in the previous sections, only with some
11296: debugging aids.</p>
11297:
11298: <div class="itemizedlist">
11299: <ul type="disc">
11300: <li>
1.14 xtraeme 11301: <p>Be sure to set <code class=
11302: "varname">PKG_DEVELOPER=1</code> in <code class=
11303: "filename">/etc/mk.conf</code></p>
1.1 grant 11304: </li>
11305:
11306: <li>
11307: <p>Install <a xmlns=
11308: "http://www.w3.org/TR/xhtml1/transitional" href=
11309: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20 ben 11310: class="pkgname">pkgtools/url2pkg</a>, create a
11311: directory for a new package, change into it, then run
11312: <span><strong class=
11313: "command">url2pkg</strong></span>:</p>
1.1 grant 11314: <pre class="screen">
1.14 xtraeme 11315: <code class="prompt">%</code> <strong class=
11316: "userinput"><code>mkdir /usr/pkgsrc/<em class=
11317: "replaceable"><code>category</code></em>/<em class=
11318: "replaceable"><code>examplepkg</code></em></code></strong>
11319: <code class="prompt">%</code> <strong class=
11320: "userinput"><code>cd /usr/pkgsrc/<em class=
11321: "replaceable"><code>category</code></em>/<em class=
11322: "replaceable"><code>examplepkg</code></em></code></strong>
11323: <code class="prompt">%</code> <strong class=
11324: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 11325: </pre>
11326: </li>
11327:
11328: <li>
1.14 xtraeme 11329: <p>Edit the <code class="filename">Makefile</code> as
1.1 grant 11330: requested.</p>
11331: </li>
11332:
11333: <li>
1.14 xtraeme 11334: <p>Fill in the <code class="filename">DESCR</code>
1.1 grant 11335: file</p>
11336: </li>
11337:
11338: <li>
1.14 xtraeme 11339: <p>Run <span><strong class="command">make
11340: configure</strong></span></p>
1.1 grant 11341: </li>
11342:
11343: <li>
11344: <p>Add any dependencies glimpsed from documentation
1.14 xtraeme 11345: and the configure step to the package's <code class=
11346: "filename">Makefile</code>.</p>
1.1 grant 11347: </li>
11348:
11349: <li>
11350: <p>Make the package compile, doing multiple rounds
11351: of</p>
11352: <pre class="screen">
1.14 xtraeme 11353: <code class="prompt">%</code> <strong class=
11354: "userinput"><code>make</code></strong>
11355: <code class="prompt">%</code> <strong class=
11356: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
11357: <code class="prompt">%</code> <strong class=
11358: "userinput"><code>mkpatches</code></strong>
11359: <code class="prompt">%</code> <strong class=
11360: "userinput"><code>patchdiff</code></strong>
11361: <code class="prompt">%</code> <strong class=
11362: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
11363: <code class="prompt">%</code> <strong class=
11364: "userinput"><code>make mps</code></strong>
11365: <code class="prompt">%</code> <strong class=
11366: "userinput"><code>make clean</code></strong>
1.1 grant 11367: </pre>
11368:
11369: <p>Doing as non-root user will ensure that no files
11370: are modified that shouldn't be, especially during the
1.14 xtraeme 11371: build phase. <span><strong class=
11372: "command">mkpatches</strong></span>,
11373: <span><strong class=
11374: "command">patchdiff</strong></span> and
11375: <span><strong class="command">pkgvi</strong></span>
11376: are from the <a xmlns=
1.1 grant 11377: "http://www.w3.org/TR/xhtml1/transitional" href=
11378: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 11379: class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1 grant 11380: </li>
11381:
11382: <li>
1.14 xtraeme 11383: <p>Look at the <code class=
11384: "filename">Makefile</code>, fix if necessary; see
11385: <a href="#components.Makefile" title=
1.27 rillig 11386: "7.1. Makefile">Section 7.1,
1.14 xtraeme 11387: “<code class=
11388: "filename">Makefile</code>”</a>.</p>
1.1 grant 11389: </li>
11390:
11391: <li>
1.14 xtraeme 11392: <p>Generate a <code class=
11393: "filename">PLIST</code>:</p>
1.1 grant 11394: <pre class="screen">
1.14 xtraeme 11395: <code class="prompt">#</code> <strong class=
11396: "userinput"><code>make install</code></strong>
11397: <code class="prompt">#</code> <strong class=
11398: "userinput"><code>make print-PLIST >PLIST</code></strong>
11399: <code class="prompt">#</code> <strong class=
11400: "userinput"><code>make deinstall</code></strong>
11401: <code class="prompt">#</code> <strong class=
11402: "userinput"><code>make install</code></strong>
11403: <code class="prompt">#</code> <strong class=
11404: "userinput"><code>make deinstall</code></strong>
1.1 grant 11405: </pre>
11406:
1.14 xtraeme 11407: <p>You usually need to be <code class=
11408: "username">root</code> to do this. Look if there are
1.1 grant 11409: any files left:</p>
11410: <pre class="screen">
1.14 xtraeme 11411: <code class="prompt">#</code> <strong class=
11412: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 11413: </pre>
11414:
11415: <p>If this reveals any files that are missing in
1.14 xtraeme 11416: <code class="filename">PLIST</code>, add them.</p>
1.1 grant 11417: </li>
11418:
11419: <li>
1.14 xtraeme 11420: <p>Now that the <code class="filename">PLIST</code>
11421: is OK, install the package again and make a binary
1.1 grant 11422: package:</p>
11423: <pre class="screen">
1.14 xtraeme 11424: <code class="prompt">#</code> <strong class=
11425: "userinput"><code>make reinstall</code></strong>
11426: <code class="prompt">#</code> <strong class=
11427: "userinput"><code>make package</code></strong>
1.1 grant 11428: </pre>
11429: </li>
11430:
11431: <li>
11432: <p>Delete the installed package:</p>
11433: <pre class="screen">
1.14 xtraeme 11434: <code class="prompt">#</code> <strong class=
11435: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 11436: </pre>
11437: </li>
11438:
11439: <li>
1.14 xtraeme 11440: <p>Repeat the above <span><strong class=
11441: "command">make print-PLIST</strong></span> command,
11442: which shouldn't find anything now:</p>
1.1 grant 11443: <pre class="screen">
1.14 xtraeme 11444: <code class="prompt">#</code> <strong class=
11445: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 11446: </pre>
11447: </li>
11448:
11449: <li>
11450: <p>Reinstall the binary package:</p>
11451: <pre class="screen">
1.14 xtraeme 11452: <code class="prompt">#</code> <strong class=
11453: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 11454: </pre>
11455: </li>
11456:
11457: <li>
11458: <p>Play with it. Make sure everything works.</p>
11459: </li>
11460:
11461: <li>
1.14 xtraeme 11462: <p>Run <span><strong class=
11463: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 11464: "http://www.w3.org/TR/xhtml1/transitional" href=
11465: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 11466: class="pkgname">pkgtools/pkglint</a>, and fix the
11467: problems it reports:</p>
1.1 grant 11468: <pre class="screen">
1.14 xtraeme 11469: <code class="prompt">#</code> <strong class=
11470: "userinput"><code>pkglint</code></strong>
1.1 grant 11471: </pre>
11472: </li>
11473:
11474: <li>
11475: <p>Submit (or commit, if you have cvs access); see
11476: <a href="#submit" title=
1.25 rillig 11477: "Chapter 15. Submitting and Committing">Chapter 15,
1.1 grant 11478: <i>Submitting and Committing</i></a>.</p>
11479: </li>
11480: </ul>
11481: </div>
11482: </div>
11483:
11484: <div class="chapter" lang="en" xml:lang="en">
11485: <div class="titlepage">
11486: <div>
11487: <div>
11488: <h2 class="title"><a name="submit" id=
1.25 rillig 11489: "submit"></a>Chapter 15. Submitting and
1.1 grant 11490: Committing</h2>
11491: </div>
11492: </div>
11493: </div>
11494:
11495: <div class="toc">
11496: <p><b>Table of Contents</b></p>
11497:
11498: <dl>
1.30 wiz 11499: <dt><span class="sect1"><a href=
11500: "#submitting-your-package">15.1. Submitting your
11501: packages</a></span></dt>
1.1 grant 11502:
1.30 wiz 11503: <dt><span class="sect1"><a href=
11504: "#committing-importing">15.2. Committing: Importing a
11505: package into CVS</a></span></dt>
1.1 grant 11506:
1.30 wiz 11507: <dt><span class="sect1"><a href=
11508: "#updating-package">15.3. Updating a package to a newer
11509: version</a></span></dt>
1.1 grant 11510:
1.30 wiz 11511: <dt><span class="sect1"><a href="#moving-package">15.4.
1.2 hubertf 11512: Moving a package in pkgsrc</a></span></dt>
1.1 grant 11513: </dl>
11514: </div>
11515:
11516: <div class="sect1" lang="en" xml:lang="en">
11517: <div class="titlepage">
11518: <div>
11519: <div>
11520: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11521: "submitting-your-package" id=
11522: "submitting-your-package"></a>15.1. Submitting
11523: your packages</h2>
1.1 grant 11524: </div>
11525: </div>
11526: </div>
11527:
11528: <p>You have to separate between binary and
11529: “<span class="quote">normal</span>” (source)
11530: packages here:</p>
11531:
11532: <div class="itemizedlist">
11533: <ul type="disc">
11534: <li>
11535: <p>precompiled binary packages</p>
11536:
11537: <p>Our policy is that we accept binaries only from
11538: pkgsrc developers to guarantee that the packages
11539: don't contain any trojan horses etc. This is not to
1.13 hubertf 11540: annoy anyone but rather to protect our users!
1.1 grant 11541: You're still free to put up your home-made binary
1.13 hubertf 11542: packages and tell the world where to get them.
11543: NetBSD developers doing bulk builds and wanting to
11544: upload them please see <a href="#bulk-upload"
11545: title="5.3.8. Uploading results of a bulk build">
11546: Section 5.3.8, “Uploading results of a
11547: bulk build”</a>.</p>
1.1 grant 11548: </li>
11549:
11550: <li>
11551: <p>packages</p>
11552:
11553: <p>First, check that your package is complete,
11554: compiles and runs well; see <a href="#debug" title=
1.25 rillig 11555: "Chapter 14. Debugging">Chapter 14,
1.1 grant 11556: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 11557: Next, generate an uuencoded gzipped <a href=
11558: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
11559: <span class="citerefentry"><span class=
11560: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 11561: preferably with all files in a single directory.
1.14 xtraeme 11562: Finally, <span><strong class=
11563: "command">send-pr</strong></span> with category
1.1 grant 11564: “<span class="quote">pkg</span>”, a
11565: synopsis which includes the package name and
11566: version number, a short description of your package
11567: (contents of the COMMENT variable or DESCR file are
11568: OK) and attach the archive to your PR.</p>
11569:
11570: <p>If you want to submit several packages, please
11571: send a separate PR for each one, it's easier for us
11572: to track things that way.</p>
11573:
11574: <p>Alternatively, you can also import new packages
11575: into pkgsrc-wip (“<span class="quote">pkgsrc
11576: work-in-progress</span>”); see the homepage
11577: at <a href="http://pkgsrc-wip.sourceforge.net/"
11578: target=
11579: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
11580: details.</p>
11581: </li>
11582: </ul>
11583: </div>
11584: </div>
11585:
11586: <div class="sect1" lang="en" xml:lang="en">
11587: <div class="titlepage">
11588: <div>
11589: <div>
11590: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11591: "committing-importing" id=
11592: "committing-importing"></a>15.2. Committing:
11593: Importing a package into CVS</h2>
1.1 grant 11594: </div>
11595: </div>
11596: </div>
11597:
11598: <p>This section is only of interest for pkgsrc developers
11599: with write access to the pkgsrc repository. Please
11600: remember that cvs imports files relative to the current
11601: working directory, and that the pathname that you give
1.14 xtraeme 11602: the <span><strong class="command">cvs
11603: import</strong></span> command is so that it knows where
11604: to place the files in the repository. Newly created
11605: packages should be imported with a vendor tag of
11606: “<span class="quote">TNF</span>” and a
11607: release tag of “<span class=
11608: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 11609: <pre class="programlisting">
11610: % cd .../pkgsrc/category/pkgname
11611: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
11612: </pre>
11613:
11614: <p>Remember to move the directory from which you imported
11615: out of the way, or cvs will complain the next time you
11616: “<span class="quote">cvs update</span>” your
11617: source tree. Also don't forget to add the new package to
1.14 xtraeme 11618: the category's <code class=
11619: "filename">Makefile</code>.</p>
1.1 grant 11620:
11621: <p>The commit message of the initial import should
1.14 xtraeme 11622: include part of the <code class="filename">DESCR</code>
11623: file, so people reading the mailing lists know what the
11624: package is/does.</p>
1.1 grant 11625:
11626: <p>Please note all package updates/additions in
1.14 xtraeme 11627: <code class="filename">pkgsrc/doc/CHANGES</code>. It's
11628: very important to keep this file up to date and
11629: conforming to the existing format, because it will be
11630: used by scripts to automatically update pages on <a href=
1.1 grant 11631: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
11632: and other sites. Additionally, check the pkgsrc/doc/TODO
11633: file and remove the entry for the package you updated, in
11634: case it was mentioned there.</p>
11635:
11636: <p>For new packages, “<span class="quote">cvs
11637: import</span>” is preferred to “<span class=
11638: "quote">cvs add</span>” because the former gets
11639: everything with a single command, and provides a
11640: consistent tag.</p>
11641: </div>
11642:
11643: <div class="sect1" lang="en" xml:lang="en">
11644: <div class="titlepage">
11645: <div>
11646: <div>
11647: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11648: "updating-package" id=
11649: "updating-package"></a>15.3. Updating a
11650: package to a newer version</h2>
1.1 grant 11651: </div>
11652: </div>
11653: </div>
11654:
11655: <p>Please always put a concise, appropriate and relevant
11656: summary of the changes between old and new versions into
11657: the commit log when updating a package. There are various
11658: reasons for this:</p>
11659:
11660: <div class="itemizedlist">
11661: <ul type="disc">
11662: <li>
11663: <p>A URL is volatile, and can change over time. It
11664: may go away completely or its information may be
11665: overwritten by newer information.</p>
11666: </li>
11667:
11668: <li>
11669: <p>Having the change information between old and
11670: new versions in our CVS repository is very useful
11671: for people who use either cvs or anoncvs.</p>
11672: </li>
11673:
11674: <li>
11675: <p>Having the change information between old and
11676: new versions in our CVS repository is very useful
11677: for people who read the pkgsrc-changes mailing
11678: list, so that they can make tactical decisions
11679: about when to upgrade the package.</p>
11680: </li>
11681: </ul>
11682: </div>
11683:
1.18 xtraeme 11684: <p>Please also recognize that, just because a new version
1.1 grant 11685: of a package has been released, it should not
11686: automatically be upgraded in the CVS repository. We
11687: prefer to be conservative in the packages that are
11688: included in pkgsrc - development or beta packages are not
11689: really the best thing for most places in which pkgsrc is
11690: used. Please use your judgement about what should go into
11691: pkgsrc, and bear in mind that stability is to be
11692: preferred above new and possibly untested features.</p>
11693: </div>
11694:
11695: <div class="sect1" lang="en" xml:lang="en">
11696: <div class="titlepage">
11697: <div>
11698: <div>
11699: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11700: "moving-package" id=
11701: "moving-package"></a>15.4. Moving a package in
11702: pkgsrc</h2>
1.1 grant 11703: </div>
11704: </div>
11705: </div>
11706:
11707: <div class="orderedlist">
11708: <ol type="1">
11709: <li>
11710: <p>Make a copy of the directory somewhere else.</p>
11711: </li>
11712:
11713: <li>
11714: <p>Remove all CVS dirs.</p>
11715:
11716: <p>Alternatively to the first two steps you can
11717: also do:</p>
11718: <pre class="screen">
1.14 xtraeme 11719: <code class="prompt">%</code> <strong class=
11720: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 11721: </pre>
11722:
11723: <p>and use that for further work.</p>
11724: </li>
11725:
11726: <li>
1.14 xtraeme 11727: <p>Fix <code class="varname">CATEGORIES</code> and
11728: any <code class="varname">DEPENDS</code> paths that
11729: just did “<span class=
1.1 grant 11730: "quote">../package</span>” instead of
11731: “<span class=
11732: "quote">../../category/package</span>”.</p>
11733: </li>
11734:
11735: <li>
1.14 xtraeme 11736: <p><span><strong class="command">cvs
11737: import</strong></span> the modified package in the
11738: new place.</p>
1.1 grant 11739: </li>
11740:
11741: <li>
11742: <p>Check if any package depends on it:</p>
11743: <pre class="screen">
1.14 xtraeme 11744: <code class="prompt">%</code> <strong class=
11745: "userinput"><code>cd /usr/pkgsrc</code></strong>
11746: <code class="prompt">%</code> <strong class=
11747: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 11748: </pre>
11749: </li>
11750:
11751: <li>
11752: <p>Fix paths in packages from step 5 to point to
11753: new location.</p>
11754: </li>
11755:
11756: <li>
1.14 xtraeme 11757: <p><span><strong class="command">cvs rm
11758: (-f)</strong></span> the package at the old
11759: location.</p>
1.1 grant 11760: </li>
11761:
11762: <li>
1.14 xtraeme 11763: <p>Remove from <code class=
11764: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 11765: </li>
11766:
11767: <li>
1.14 xtraeme 11768: <p>Add to <code class=
11769: "filename">newcategory/Makefile</code>.</p>
1.1 grant 11770: </li>
11771:
11772: <li>
11773: <p>Commit the changed and removed files:</p>
11774: <pre class="screen">
1.14 xtraeme 11775: <code class="prompt">%</code> <strong class=
11776: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 11777: </pre>
11778:
11779: <p>(and any packages from step 5, of course).</p>
11780: </li>
11781: </ol>
11782: </div>
11783: </div>
11784: </div>
11785: </div>
11786:
11787: <div class="appendix" lang="en" xml:lang="en">
11788: <div class="titlepage">
11789: <div>
11790: <div>
11791: <h2 class="title"><a name="examples" id=
11792: "examples"></a>Appendix A. A simple example
11793: package: bison</h2>
11794: </div>
11795: </div>
11796: </div>
11797:
11798: <div class="toc">
11799: <p><b>Table of Contents</b></p>
11800:
11801: <dl>
1.30 wiz 11802: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 11803: files</a></span></dt>
11804:
11805: <dd>
11806: <dl>
1.30 wiz 11807: <dt><span class="sect2"><a href=
11808: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 11809:
1.30 wiz 11810: <dt><span class="sect2"><a href=
11811: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 11812:
1.30 wiz 11813: <dt><span class="sect2"><a href=
11814: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 11815:
1.30 wiz 11816: <dt><span class="sect2"><a href=
11817: "#checking-package-with-pkglint">A.1.4. Checking a
11818: package with <span><strong class=
1.14 xtraeme 11819: "command">pkglint</strong></span></a></span></dt>
1.1 grant 11820: </dl>
11821: </dd>
11822:
1.30 wiz 11823: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
11824: Steps for building, installing, packaging</a></span></dt>
1.1 grant 11825: </dl>
11826: </div>
11827:
11828: <p>We checked to find a piece of software that wasn't in the
11829: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 11830: would want to have <span><strong class=
11831: "command">bison</strong></span> when Berkeley
11832: <span><strong class="command">yacc</strong></span> is already
11833: present in the tree is beyond us, but it's useful for the
11834: purposes of this exercise.</p>
1.1 grant 11835:
11836: <div class="sect1" lang="en" xml:lang="en">
11837: <div class="titlepage">
11838: <div>
11839: <div>
11840: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11841: "example-files" id=
11842: "example-files"></a>A.1. files</h2>
1.1 grant 11843: </div>
11844: </div>
11845: </div>
11846:
11847: <div class="sect2" lang="en" xml:lang="en">
11848: <div class="titlepage">
11849: <div>
11850: <div>
1.30 wiz 11851: <h3 class="title"><a name="example-Makefile" id=
11852: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 11853: </div>
11854: </div>
11855: </div>
11856: <pre class="programlisting">
1.17 sketch 11857: # $NetBSD$
1.1 grant 11858: #
11859:
11860: DISTNAME= bison-1.25
11861: CATEGORIES= devel
11862: MASTER_SITES= ${MASTER_SITE_GNU}
11863:
11864: MAINTAINER= thorpej@NetBSD.org
11865: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
11866: COMMENT= GNU yacc clone
11867:
11868: GNU_CONFIGURE= yes
11869: INFO_FILES= bison.info
11870:
11871: .include "../../mk/bsd.pkg.mk"
11872: </pre>
11873: </div>
11874:
11875: <div class="sect2" lang="en" xml:lang="en">
11876: <div class="titlepage">
11877: <div>
11878: <div>
1.30 wiz 11879: <h3 class="title"><a name="example-descr" id=
11880: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 11881: </div>
11882: </div>
11883: </div>
11884: <pre class="programlisting">
11885: GNU version of yacc. Can make re-entrant parsers, and numerous other
11886: improvements. Why you would want this when Berkeley <a href=
11887: "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
11888: of the NetBSD source tree is beyond me.
11889: </pre>
11890: </div>
11891:
11892: <div class="sect2" lang="en" xml:lang="en">
11893: <div class="titlepage">
11894: <div>
11895: <div>
1.30 wiz 11896: <h3 class="title"><a name="example-plist" id=
11897: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 11898: </div>
11899: </div>
11900: </div>
11901: <pre class="programlisting">
1.17 sketch 11902: @comment $NetBSD$
1.1 grant 11903: bin/bison
11904: man/man1/bison.1.gz
11905: share/bison.simple
11906: share/bison.hairy
11907: </pre>
11908: </div>
11909:
11910: <div class="sect2" lang="en" xml:lang="en">
11911: <div class="titlepage">
11912: <div>
11913: <div>
1.30 wiz 11914: <h3 class="title"><a name=
11915: "checking-package-with-pkglint" id=
11916: "checking-package-with-pkglint"></a>A.1.4. Checking
11917: a package with <span><strong class=
1.14 xtraeme 11918: "command">pkglint</strong></span></h3>
1.1 grant 11919: </div>
11920: </div>
11921: </div>
11922:
11923: <p>The NetBSD package system comes with <a xmlns=
11924: "http://www.w3.org/TR/xhtml1/transitional" href=
11925: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 11926: class="pkgname">pkgtools/pkglint</a> which helps to check
11927: the contents of these files. After installation it is
11928: quite easy to use, just change to the directory of the
11929: package you wish to examine and execute
11930: <span><strong class=
11931: "command">pkglint</strong></span>:</p>
1.1 grant 11932: <pre class="screen">
1.14 xtraeme 11933: <code class="prompt">$</code> <strong class=
11934: "userinput"><code>pkglint</code></strong>
1.1 grant 11935: looks fine.
11936: </pre>
11937:
11938: <p>Depending on the supplied command line arguments (see
11939: pkglint(1)) more verbose checks will be performed. Use
1.14 xtraeme 11940: e.g. <span><strong class="command">pkglint
11941: -v</strong></span> for a very verbose check.</p>
1.1 grant 11942: </div>
11943: </div>
11944:
11945: <div class="sect1" lang="en" xml:lang="en">
11946: <div class="titlepage">
11947: <div>
11948: <div>
11949: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11950: "steps-for-b-i-p" id=
11951: "steps-for-b-i-p"></a>A.2. Steps for building,
11952: installing, packaging</h2>
1.1 grant 11953: </div>
11954: </div>
11955: </div>
11956:
11957: <p>Create the directory where the package lives, plus any
11958: auxiliary directories:</p>
11959: <pre class="screen">
1.14 xtraeme 11960: <code class="prompt">#</code> <strong class=
11961: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
11962: <code class="prompt">#</code> <strong class=
11963: "userinput"><code>mkdir bison</code></strong>
11964: <code class="prompt">#</code> <strong class=
11965: "userinput"><code>cd bison</code></strong>
11966: <code class="prompt">#</code> <strong class=
11967: "userinput"><code>mkdir patches</code></strong>
1.1 grant 11968: </pre>
11969:
1.14 xtraeme 11970: <p>Create <code class="filename">Makefile</code>,
11971: <code class="filename">DESCR</code> and <code class=
11972: "filename">PLIST</code> (see <a href="#components" title=
1.27 rillig 11973: "Chapter 7. Package components - files, directories and contents">
11974: Chapter 7, <i>Package components - files, directories and
1.1 grant 11975: contents</i></a>) then continue with fetching the
11976: distfile:</p>
11977: <pre class="screen">
1.14 xtraeme 11978: <code class="prompt">#</code> <strong class=
11979: "userinput"><code>make fetch</code></strong>
1.1 grant 11980: >> bison-1.25.tar.gz doesn't seem to exist on this system.
11981: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
11982: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
11983: ftp: Error retrieving file: 500 Internal error
11984:
11985: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
11986: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
11987: ftp: Error retrieving file: 500 Internal error
11988:
11989: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
11990: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
11991: Successfully retrieved file.
11992: </pre>
11993:
1.14 xtraeme 11994: <p>Generate the checksum of the distfile into <code class=
11995: "filename">distinfo</code>:</p>
1.1 grant 11996: <pre class="screen">
1.14 xtraeme 11997: <code class="prompt">#</code> <strong class=
11998: "userinput"><code>make makesum</code></strong>
1.1 grant 11999: </pre>
12000:
12001: <p>Now compile:</p>
12002: <pre class="screen">
1.14 xtraeme 12003: <code class="prompt">#</code> <strong class=
12004: "userinput"><code>make</code></strong>
1.1 grant 12005: >> Checksum OK for bison-1.25.tar.gz.
12006: ===> Extracting for bison-1.25
12007: ===> Patching for bison-1.25
12008: ===> Ignoring empty patch directory
12009: ===> Configuring for bison-1.25
12010: creating cache ./config.cache
12011: checking for gcc... cc
12012: checking whether we are using GNU C... yes
12013: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
12014: checking how to run the C preprocessor... cc -E
12015: checking for minix/config.h... no
12016: checking for POSIXized ISC... no
12017: checking whether cross-compiling... no
12018: checking for ANSI C header files... yes
12019: checking for string.h... yes
12020: checking for stdlib.h... yes
12021: checking for memory.h... yes
12022: checking for working const... yes
12023: checking for working alloca.h... no
12024: checking for alloca... yes
12025: checking for strerror... yes
12026: updating cache ./config.cache
12027: creating ./config.status
12028: creating Makefile
12029: ===> Building for bison-1.25
12030: 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
12031: 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
12032: 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
12033: 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
12034: 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
12035: 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
12036: 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
12037: 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
12038: 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
12039: 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
12040: 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
12041: 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
12042: 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
12043: 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
12044: 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
12045: 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
12046: 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
12047: 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
12048: 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
12049: 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
12050: 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
12051: 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
12052: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
12053: rm -f bison.s1
12054: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
12055: </pre>
12056:
12057: <p>Everything seems OK, so install the files:</p>
12058: <pre class="screen">
1.14 xtraeme 12059: <code class="prompt">#</code> <strong class=
12060: "userinput"><code>make install</code></strong>
1.1 grant 12061: >> Checksum OK for bison-1.25.tar.gz.
12062: ===> Installing for bison-1.25
12063: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
12064: rm -f /usr/pkg/bin/bison
12065: cd /usr/pkg/share; rm -f bison.simple bison.hairy
12066: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
12067: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
12068: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
12069: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
12070: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
12071: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
12072: ===> Registering installation for bison-1.25
12073: </pre>
12074:
12075: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 12076: remove it with <span><strong class="command">pkg_delete
12077: bison</strong></span>. Should you decide that you want a
12078: binary package, do this now:</p>
1.1 grant 12079: <pre class="screen">
1.14 xtraeme 12080: <code class="prompt">#</code> <strong class=
12081: "userinput"><code>make package</code></strong>
1.1 grant 12082: >> Checksum OK for bison-1.25.tar.gz.
12083: ===> Building package for bison-1.25
12084: Creating package bison-1.25.tgz
12085: Registering depends:.
12086: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
12087: </pre>
12088:
12089: <p>Now that you don't need the source and object files any
12090: more, clean up:</p>
12091: <pre class="screen">
1.14 xtraeme 12092: <code class="prompt">#</code> <strong class=
12093: "userinput"><code>make clean</code></strong>
1.1 grant 12094: ===> Cleaning for bison-1.25
12095: </pre>
12096: </div>
12097: </div>
12098:
12099: <div class="appendix" lang="en" xml:lang="en">
12100: <div class="titlepage">
12101: <div>
12102: <div>
12103: <h2 class="title"><a name="logs" id=
12104: "logs"></a>Appendix B. Build logs</h2>
12105: </div>
12106: </div>
12107: </div>
12108:
12109: <div class="toc">
12110: <p><b>Table of Contents</b></p>
12111:
12112: <dl>
12113: <dt><span class="sect1"><a href="#logs.building">B.1.
12114: Building figlet</a></span></dt>
12115:
12116: <dt><span class="sect1"><a href="#logs.package">B.2.
12117: Packaging figlet</a></span></dt>
12118: </dl>
12119: </div>
12120:
12121: <div class="sect1" lang="en" xml:lang="en">
12122: <div class="titlepage">
12123: <div>
12124: <div>
12125: <h2 class="title" style="clear: both"><a name=
12126: "logs.building" id=
12127: "logs.building"></a>B.1. Building figlet</h2>
12128: </div>
12129: </div>
12130: </div>
12131: <pre class="screen">
1.14 xtraeme 12132: <code class="prompt">#</code> <strong class=
12133: "userinput"><code>make</code></strong>
1.1 grant 12134: ===> Checking for vulnerabilities in figlet-2.2.1nb2
12135: => figlet221.tar.gz doesn't seem to exist on this system.
12136: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
12137: => [172219 bytes]
12138: Connected to ftp.plig.net.
12139: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
12140: 331 Guest login ok, send your complete e-mail address as password.
12141: 230-You are user #5 of 500 simultaneous users allowed.
12142: 230-
12143: 230- ___ _ _ _
12144: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
12145: 230- | _| _| . |_| . | | | . |_| . | _| . |
12146: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
12147: 230- |_| |_| |___| |___|
12148: 230-
12149: 230-** Welcome to ftp.plig.org **
12150: 230-
12151: 230-Please note that all transfers from this FTP site are logged. If you
12152: 230-do not like this, please disconnect now.
12153: 230-
12154: 230-This arhive is available via
12155: 230-
12156: 230-HTTP: http://ftp.plig.org/
12157: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
12158: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
12159: 230-
12160: 230-Please email comments, bug reports and requests for packages to be
12161: 230-mirrored to ftp-admin@plig.org.
12162: 230-
12163: 230-
12164: 230 Logged in anonymously.
12165: Remote system type is UNIX.
12166: Using binary mode to transfer files.
12167: 200 Type okay.
12168: 250 "/pub" is new cwd.
12169: 250-"/pub/figlet" is new cwd.
12170: 250-
12171: 250-Welcome to the figlet archive at ftp.figlet.org
12172: 250-
12173: 250- ftp://ftp.figlet.org/pub/figlet/
12174: 250-
12175: 250-The official FIGlet web page is:
12176: 250- http://www.figlet.org/
12177: 250-
12178: 250-If you have questions, please mailto:info@figlet.org. If you want to
12179: 250-contribute a font or something else, you can email us.
12180: 250
12181: 250 "/pub/figlet/program" is new cwd.
12182: 250 "/pub/figlet/program/unix" is new cwd.
12183: local: figlet221.tar.gz remote: figlet221.tar.gz
12184: 502 Unimplemented command.
12185: 227 Entering Passive Mode (195,40,6,41,246,104)
12186: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
12187: 38% |************** | 65800 64.16 KB/s 00:01 ETA
12188: 226 Transfer completed.
12189: 172219 bytes received in 00:02 (75.99 KB/s)
12190: 221 Goodbye.
12191: => Checksum OK for figlet221.tar.gz.
12192: ===> Extracting for figlet-2.2.1nb2
12193: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
12194: ===> Patching for figlet-2.2.1nb2
12195: ===> Applying pkgsrc patches for figlet-2.2.1nb2
12196: ===> Overriding tools for figlet-2.2.1nb2
12197: ===> Creating toolchain wrappers for figlet-2.2.1nb2
12198: ===> Configuring for figlet-2.2.1nb2
12199: ===> Building for figlet-2.2.1nb2
12200: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
12201: chmod a+x figlet
12202: gcc -O2 -o chkfont chkfont.c
12203: => Unwrapping files-to-be-installed.
1.14 xtraeme 12204: <code class="prompt">#</code>
12205: <code class="prompt">#</code> <strong class=
12206: "userinput"><code>make install</code></strong>
1.1 grant 12207: ===> Checking for vulnerabilities in figlet-2.2.1nb2
12208: ===> Installing for figlet-2.2.1nb2
12209: install -d -o root -g wheel -m 755 /usr/pkg/bin
12210: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
12211: mkdir -p /usr/pkg/share/figlet
12212: cp figlet /usr/pkg/bin
12213: cp chkfont /usr/pkg/bin
12214: chmod 555 figlist showfigfonts
12215: cp figlist /usr/pkg/bin
12216: cp showfigfonts /usr/pkg/bin
12217: cp fonts/*.flf /usr/pkg/share/figlet
12218: cp fonts/*.flc /usr/pkg/share/figlet
12219: cp figlet.6 /usr/pkg/man/man6
12220: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 12221: <code class="prompt">#</code>
1.1 grant 12222: </pre>
12223: </div>
12224:
12225: <div class="sect1" lang="en" xml:lang="en">
12226: <div class="titlepage">
12227: <div>
12228: <div>
12229: <h2 class="title" style="clear: both"><a name=
12230: "logs.package" id=
12231: "logs.package"></a>B.2. Packaging figlet</h2>
12232: </div>
12233: </div>
12234: </div>
12235: <pre class="screen">
1.14 xtraeme 12236: <code class="prompt">#</code> <strong class=
12237: "userinput"><code>make package</code></strong>
1.1 grant 12238: ===> Checking for vulnerabilities in figlet-2.2.1nb2
12239: ===> Packaging figlet-2.2.1nb2
12240: ===> Building binary package for figlet-2.2.1nb2
12241: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
12242: Using SrcDir value of /usr/pkg
12243: Registering depends:.
1.14 xtraeme 12244: <code class="prompt">#</code>
1.1 grant 12245: </pre>
12246: </div>
12247: </div>
12248:
12249: <div class="appendix" lang="en" xml:lang="en">
12250: <div class="titlepage">
12251: <div>
12252: <div>
12253: <h2 class="title"><a name="ftp-layout" id=
12254: "ftp-layout"></a>Appendix C. Layout of the
12255: FTP server's package archive</h2>
12256: </div>
12257: </div>
12258: </div>
12259:
12260: <p>Layout for precompiled binary packages on
12261: ftp.NetBSD.org:</p>
12262: <pre class="programlisting">
12263: /pub/NetBSD/packages/
12264: distfiles/
12265:
12266: # Unpacked pkgsrc trees
12267: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
12268: pkgsrc-2003Q4 -> N/A
12269: pkgsrc-2004Q1/pkgsrc
12270:
12271: # pkgsrc archives
12272: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
12273: pkgsrc-2003Q4.tar.gz -> N/A
12274: pkgsrc-2004Q1.tar.gz -> N/A
12275:
12276: # Per pkgsrc-release/OS-release/arch package archives
12277: pkgsrc-2003Q4/
12278: NetBSD-1.6.2/
12279: i386/
12280: All/
12281: archivers/
12282: foo -> ../All/foo
12283: ...
12284: pkgsrc-2004Q1/
12285: NetBSD-1.6.2/
12286: i386/
12287: All/
12288: ...
12289: NetBSD-2.0/
12290: i386/
12291: All/
12292: ...
12293: SunOS-5.9/
12294: sparc/
12295: All/
12296: ...
12297: x86/
12298: All/
12299: ...
12300:
12301: # Per os-release package archive convenience links
12302: NetBSD-1.6.2 -> 1.6.2
12303: 1.6.2/
12304: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
12305: m68k/
12306: All/
12307: archivers/
12308: foo -> ../All/foo
12309: ...
12310: amiga -> m68k
12311: atari -> m68k
12312: ...
12313:
12314: 2.0 -> NetBSD-2.0 # backward compat, historic
12315: NetBSD-2.0/
12316: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
12317: SunOS-5.9/
12318: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
12319: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
12320:
12321: </pre>
12322:
12323: <p>To create:</p>
12324:
12325: <div class="orderedlist">
12326: <ol type="1">
12327: <li>
12328: <p>Run bulk build, see <a href="#bulkbuild" title=
12329: "5.3. Doing a bulk build of all packages">Section
12330: 5.3, “Doing a bulk build of all
12331: packages”</a></p>
12332: </li>
12333:
12334: <li>
12335: <p>Upload /usr/pkgsrc/packages to</p>
12336: <pre class="programlisting">
12337: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13 hubertf 12338: pkgsrc-2004Q4/\ # pkgsrc-branch
1.1 grant 12339: `uname -s`-`uname -r`/ # OS & version
12340: `uname -p` # architecture
12341:
12342: </pre>
12343: </li>
12344:
12345: <li>
1.14 xtraeme 12346: <p>If necessary, create a symlink <span><strong class=
12347: "command">ln -s `uname -m` `uname -p`</strong></span>
12348: (amiga -> m68k, ...)</p>
1.1 grant 12349: </li>
12350: </ol>
12351: </div>
12352: </div>
1.2 hubertf 12353:
12354: <div class="appendix" lang="en" xml:lang="en">
12355: <div class="titlepage">
12356: <div>
12357: <div>
12358: <h2 class="title"><a name="editing" id=
12359: "editing"></a>Appendix D. Editing guidelines
12360: for the pkgsrc guide</h2>
12361: </div>
12362: </div>
12363: </div>
12364:
12365: <div class="toc">
12366: <p><b>Table of Contents</b></p>
12367:
12368: <dl>
1.30 wiz 12369: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 12370: Targets</a></span></dt>
12371:
1.30 wiz 12372: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 12373: Procedure</a></span></dt>
12374: </dl>
12375: </div>
12376:
12377: <p>This section contains information on editing the pkgsrc
12378: guide itself.</p>
12379:
12380: <div class="sect1" lang="en" xml:lang="en">
12381: <div class="titlepage">
12382: <div>
12383: <div>
12384: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12385: "targets" id="targets"></a>D.1. Targets</h2>
1.2 hubertf 12386: </div>
12387: </div>
12388: </div>
12389:
1.14 xtraeme 12390: <p>The pkgsrc guide's source code is stored in <code class=
12391: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 12392: are created from it:</p>
12393:
12394: <div class="itemizedlist">
12395: <ul type="disc">
12396: <li>
1.14 xtraeme 12397: <p><code class=
1.23 wiz 12398: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 12399: </li>
12400:
12401: <li>
1.14 xtraeme 12402: <p><code class=
12403: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 12404: </li>
12405:
12406: <li>
1.14 xtraeme 12407: <p><code class=
12408: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 12409: the documentation on the NetBSD website will be built
12410: from pkgsrc and kept up to date on the web server
12411: itself. This means you <span class=
12412: "emphasis"><em>must</em></span> make sure that your
12413: changes haven't broken the build!</p>
12414: </li>
1.6 hubertf 12415:
12416: <li>
1.14 xtraeme 12417: <p><code class=
12418: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 12419: PDF version of the pkgsrc guide.</p>
12420: </li>
12421:
12422: <li>
1.14 xtraeme 12423: <p><code class=
12424: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 12425: PostScript version of the pkgsrc guide.</p>
12426: </li>
1.2 hubertf 12427: </ul>
12428: </div>
12429: </div>
12430:
12431: <div class="sect1" lang="en" xml:lang="en">
12432: <div class="titlepage">
12433: <div>
12434: <div>
12435: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12436: "procedure" id=
12437: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 12438: </div>
12439: </div>
12440: </div>
12441:
12442: <p>The procedure to edit the pkgsrc guide is:</p>
12443:
12444: <div class="itemizedlist">
12445: <ul type="disc">
12446: <li>
1.6 hubertf 12447: <p>Make sure you have the packages needed to
12448: re-generate the pkgsrc guide (and other XML-based
12449: NetBSD documentation) installed. These are
1.11 ben 12450: “<span class="quote">netbsd-doc</span>”
1.6 hubertf 12451: for creating the ASCII- and HTML-version, and
12452: “<span class=
1.11 ben 12453: "quote">netbsd-doc-print</span>”for the
1.6 hubertf 12454: PostScript- and PDF version. You will need both
12455: packages installed, to make sure documentation is
12456: consistent across all formats. The packages can be
1.14 xtraeme 12457: found in <code class=
12458: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
12459: <code class=
12460: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 12461: </li>
12462:
12463: <li>
1.14 xtraeme 12464: <p>Edit the XML file(s) in <code class=
12465: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 12466: </li>
12467:
12468: <li>
1.14 xtraeme 12469: <p>Run <span><strong class="command">make extract
12470: && make do-lint</strong></span> in
12471: <code class="filename">pkgsrc/doc/guide</code> to
12472: check the XML syntax, and fix it if needed.</p>
1.4 hubertf 12473: </li>
12474:
12475: <li>
1.14 xtraeme 12476: <p>Run <span><strong class=
12477: "command">make</strong></span> in <code class=
12478: "filename">pkgsrc/doc/guide</code> to build the HTML
12479: and ASCII version.</p>
1.2 hubertf 12480: </li>
12481:
12482: <li>
1.14 xtraeme 12483: <p>If all is well, run <span><strong class=
12484: "command">make install-doc</strong></span> to put the
12485: generated files into <code class=
12486: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 12487: </li>
12488:
12489: <li>
1.14 xtraeme 12490: <p><span><strong class="command">cvs commit
12491: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 12492: </li>
12493:
12494: <li>
1.14 xtraeme 12495: <p><span><strong class="command">cvs commit -m
12496: re-generate
12497: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 12498: </li>
1.4 hubertf 12499:
12500: <li>
12501: <p>Until the webserver on www.NetBSD.org is really
12502: updated automatically to pick up changes to the
1.14 xtraeme 12503: pkgsrc guide automatically, also run
1.18 xtraeme 12504: <span><strong class="command">make install-htdocs
1.14 xtraeme 12505: HTDOCSDIR=../../../htdocs</strong></span> (or
12506: similar, adjust <code class=
12507: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 12508: </li>
12509:
12510: <li>
1.14 xtraeme 12511: <p><span><strong class="command">cvs commit
12512: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 12513: </li>
1.2 hubertf 12514: </ul>
12515: </div>
12516: </div>
12517: </div>
1.1 grant 12518: </div>
12519: </body>
12520: </html>
CVSweb <webmaster@jp.NetBSD.org>