Annotation of pkgsrc/doc/pkgsrc.html, revision 1.34
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.34 ! wiz 4045: target="_top">pkgsrc-bugs</a>: A list where problem
! 4046: 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.34 ! wiz 4053: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 4054: results of pkgsrc bulk builds are sent and
1.34 ! wiz 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.34 ! wiz 4061: target="_top">pkgsrc-changes</a>: A list where all
! 4062: 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.34 ! wiz 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.34 ! wiz 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.34 ! wiz 4145: class="pkgname">pkgtools/digest</a>: Calculates
! 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>:
1.34 ! wiz 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.34 ! wiz 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>:
1.34 ! wiz 4170: Up-to-date replacement for <code class=
! 4171: "filename">/usr/sbin/pkg_install</code>, or for use
! 4172: on operating systems where pkg_install is not
! 4173: present.</p>
1.1 grant 4174: </li>
4175: </ul>
4176: </div>
4177:
4178: <p>Utilities used by pkgsrc (not automatically
4179: installed):</p>
4180:
4181: <div class="itemizedlist">
4182: <ul type="disc">
4183: <li>
4184: <p><a xmlns=
4185: "http://www.w3.org/TR/xhtml1/transitional" href=
4186: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.34 ! wiz 4187: class="pkgname">pkgtools/pkg_tarup</a>: Create a
1.20 ben 4188: binary package from an already-installed package.
1.34 ! wiz 4189: Used by <span><strong class="command">make
! 4190: replace</strong></span> to save the old
! 4191: package.</p>
1.1 grant 4192: </li>
4193:
4194: <li>
4195: <p><a xmlns=
4196: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 4197: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.34 ! wiz 4198: class="pkgname">pkgtools/dfdisk</a>: Adds extra
1.20 ben 4199: functionality to pkgsrc, allowing it to fetch
4200: distfiles from multiple locations. It currently
4201: supports the following methods: multiple CD-ROMs
4202: and network FTP/HTTP connections.</p>
1.5 hubertf 4203: </li>
4204:
4205: <li>
4206: <p><a xmlns=
4207: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4208: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.34 ! wiz 4209: class="pkgname">pkgtools/xpkgwedge</a>: Put X11
! 4210: packages someplace else (enabled by default).</p>
1.1 grant 4211: </li>
1.5 hubertf 4212:
4213: <li>
4214: <p><a xmlns=
4215: "http://www.w3.org/TR/xhtml1/transitional" href=
4216: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.34 ! wiz 4217: class="pkgname">devel/cpuflags</a>: Determine the
! 4218: best compiler flags to optimise code for your
1.20 ben 4219: current CPU and compiler.</p>
1.5 hubertf 4220: </li>
1.1 grant 4221: </ul>
4222: </div>
4223:
4224: <p>Utilities for keeping track of installed packages,
4225: being up to date, etc:</p>
4226:
4227: <div class="itemizedlist">
4228: <ul type="disc">
4229: <li>
4230: <p><a xmlns=
4231: "http://www.w3.org/TR/xhtml1/transitional" href=
4232: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.34 ! wiz 4233: class="pkgname">pkgtools/pkg_chk</a>: Reports on
1.27 rillig 4234: packages whose installed versions do not match the
1.34 ! wiz 4235: latest pkgsrc entries.</p>
1.1 grant 4236: </li>
4237:
4238: <li>
4239: <p><a xmlns=
4240: "http://www.w3.org/TR/xhtml1/transitional" href=
4241: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.34 ! wiz 4242: class="pkgname">pkgtools/pkgdep</a>: Makes
1.20 ben 4243: dependency graphs of packages, to aid in choosing a
1.34 ! wiz 4244: strategy for updating.</p>
1.1 grant 4245: </li>
4246:
4247: <li>
4248: <p><a xmlns=
4249: "http://www.w3.org/TR/xhtml1/transitional" href=
4250: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.34 ! wiz 4251: class="pkgname">pkgtools/pkgdepgraph</a>: Makes
1.27 rillig 4252: graphs from the output of <a xmlns=
4253: "http://www.w3.org/TR/xhtml1/transitional" href=
4254: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
4255: class="pkgname">pkgtools/pkgdep</a> (uses
1.34 ! wiz 4256: graphviz).</p>
1.1 grant 4257: </li>
4258:
4259: <li>
4260: <p><a xmlns=
4261: "http://www.w3.org/TR/xhtml1/transitional" href=
4262: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.34 ! wiz 4263: class="pkgname">pkgtools/pkglint</a>: The
1.27 rillig 4264: pkglint(1) program checks a pkgsrc entry for
4265: errors, lintpkgsrc(1) does various checks on the
4266: complete pkgsrc system.</p>
1.1 grant 4267: </li>
4268:
4269: <li>
4270: <p><a xmlns=
4271: "http://www.w3.org/TR/xhtml1/transitional" href=
4272: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.34 ! wiz 4273: class="pkgname">pkgtools/pkgsurvey</a>: Report what
! 4274: packages you have installed.</p>
1.1 grant 4275: </li>
4276: </ul>
4277: </div>
4278:
4279: <p>Utilities for people maintaining or creating
4280: individual packages:</p>
4281:
4282: <div class="itemizedlist">
4283: <ul type="disc">
4284: <li>
4285: <p><a xmlns=
4286: "http://www.w3.org/TR/xhtml1/transitional" href=
4287: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.34 ! wiz 4288: class="pkgname">pkgtools/pkgdiff</a>: Automate
1.20 ben 4289: making and maintaining patches for a package
1.34 ! wiz 4290: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 4291: </li>
4292:
4293: <li>
4294: <p><a xmlns=
4295: "http://www.w3.org/TR/xhtml1/transitional" href=
4296: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.20 ben 4297: class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
4298: "http://www.w3.org/TR/xhtml1/transitional" href=
4299: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.34 ! wiz 4300: class="pkgname">pkgtools/url2pkg</a>: Aids in
! 4301: converting to pkgsrc.</p>
1.1 grant 4302: </li>
4303:
4304: <li>
4305: <p><a xmlns=
4306: "http://www.w3.org/TR/xhtml1/transitional" href=
4307: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.34 ! wiz 4308: class="pkgname">pkgtools/gensolpkg</a>: Convert
! 4309: pkgsrc to a Solaris package.</p>
1.1 grant 4310: </li>
4311: </ul>
4312: </div>
4313:
4314: <p>Utilities for people maintaining pkgsrc (or more
4315: obscure pkg utilities)</p>
4316:
4317: <div class="itemizedlist">
4318: <ul type="disc">
4319: <li>
4320: <p><a xmlns=
4321: "http://www.w3.org/TR/xhtml1/transitional" href=
4322: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.34 ! wiz 4323: class="pkgname">pkgtools/pkgconflict</a>: Find
1.20 ben 4324: packages that conflict but aren't marked as
1.34 ! wiz 4325: such.</p>
1.1 grant 4326: </li>
4327:
4328: <li>
4329: <p><a xmlns=
4330: "http://www.w3.org/TR/xhtml1/transitional" href=
4331: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.34 ! wiz 4332: class="pkgname">pkgtools/pkg_comp</a>: Build
! 4333: packages in a chrooted area.</p>
1.1 grant 4334: </li>
4335:
4336: <li>
4337: <p><a xmlns=
4338: "http://www.w3.org/TR/xhtml1/transitional" href=
4339: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.34 ! wiz 4340: class="pkgname">pkgtools/libkver</a>: Spoof kernel
! 4341: version for chrooted cross builds.</p>
1.1 grant 4342: </li>
4343: </ul>
4344: </div>
4345: </div>
4346:
4347: <div class="sect1" lang="en" xml:lang="en">
4348: <div class="titlepage">
4349: <div>
4350: <div>
4351: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4352: "non-root-pkgsrc" id=
4353: "non-root-pkgsrc"></a>6.4. How to use pkgsrc
4354: as non-root</h2>
1.1 grant 4355: </div>
4356: </div>
4357: </div>
4358:
4359: <p>If you want to use pkgsrc as non-root user, you can
4360: set some variables to make pkgsrc work under these
1.33 jmmv 4361: conditions. At the very least, you need to set
4362: <code class="varname">UNPRIVILEGED</code> to
4363: “<span class="quote">yes</span>”; this will
4364: turn on unprivileged mode and set multiple related
4365: variables to allow installation of packages as
4366: non-root.</p>
4367:
4368: <p>In case the defaults are not enough, you may want to
4369: tune some other variables used. For example, if the
4370: automatic user/group detection leads to incorrect values
4371: (or not the ones you would like to use), you can change
4372: them by setting <code class=
4373: "varname">UNPRIVILEGED_USER</code> and <code class=
4374: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
4375:
4376: <p>As regards bootstrapping, please note that the
4377: <span><strong class="command">bootstrap</strong></span>
4378: script will ease non-root configuration when given the
4379: “<span class=
4380: "quote">--ignore-user-check</span>” flag, as it
4381: will choose and use multiple default directories under
4382: <code class="filename">~/pkg</code> as the installation
4383: targets. These directories can be overriden by the
4384: “<span class="quote">--prefix</span>” flag
4385: provided by the script, as well as some others that allow
4386: finer tuning of the tree layout.</p>
1.14 xtraeme 4387: </div>
4388:
4389: <div class="sect1" lang="en" xml:lang="en">
4390: <div class="titlepage">
4391: <div>
4392: <div>
4393: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4394: "resume-transfers" id=
4395: "resume-transfers"></a>6.5. How to resume
4396: transfers when fetching distfiles?</h2>
1.14 xtraeme 4397: </div>
4398: </div>
4399: </div>
4400:
1.15 xtraeme 4401: <p>By default resuming transfers in pkgsrc is disabled,
4402: but you can enable this feature by adding the option
4403: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
4404: into <code class="filename">/etc/mk.conf</code>. If,
4405: during a fetch step, an incomplete distfile is found,
4406: pkgsrc will try to resume it.</p>
4407:
4408: <p>You can also use a different program than the default
1.24 wiz 4409: <a href=
4410: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
4411: <span class="citerefentry"><span class=
4412: "refentrytitle">ftp</span>(1)</span></a> by changing the
4413: <code class="varname">FETCH_CMD</code> variable. Don't
4414: forget to set <code class=
4415: "varname">FETCH_RESUME_ARGS</code> and <code class=
4416: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
4417: default values.</p>
1.14 xtraeme 4418:
4419: <p>For example, if you want to use <code class=
4420: "filename">wget</code> to resume downloads, you'll have
4421: to use something like:</p>
4422: <pre class="programlisting">
1.34 ! wiz 4423: FETCH_CMD=wget
! 4424: FETCH_BEFORE_ARGS=--passive-ftp
! 4425: FETCH_RESUME_ARGS=-c
! 4426: FETCH_OUTPUT_ARGS=-O
1.14 xtraeme 4427: </pre>
1.1 grant 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: "XFree86-from-pkgsrc" id=
4436: "XFree86-from-pkgsrc"></a>6.6. How can I
1.1 grant 4437: install/use XFree86 from pkgsrc?</h2>
4438: </div>
4439: </div>
4440: </div>
4441:
4442: <p>If you want to use XFree86 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
4446: add the following line into <code class=
1.15 xtraeme 4447: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4448: <pre class="programlisting">
1.34 ! wiz 4449: X11_TYPE=XFree86
1.1 grant 4450: </pre>
4451: </div>
4452:
4453: <div class="sect1" lang="en" xml:lang="en">
4454: <div class="titlepage">
4455: <div>
4456: <div>
4457: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4458: "x.org-from-pkgsrc" id=
4459: "x.org-from-pkgsrc"></a>6.7. How can I
1.1 grant 4460: install/use X.org from pkgsrc?</h2>
4461: </div>
4462: </div>
4463: </div>
4464:
4465: <p>If you want to use X.org from pkgsrc instead of your
1.14 xtraeme 4466: system's own X11 (<code class=
4467: "filename">/usr/X11R6</code>, <code class=
4468: "filename">/usr/openwin</code>, ...) you will have to add
4469: the following line into <code class=
1.15 xtraeme 4470: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4471: <pre class="programlisting">
1.34 ! wiz 4472: X11_TYPE=xorg
1.1 grant 4473: </pre>
4474: </div>
4475:
4476: <div class="sect1" lang="en" xml:lang="en">
4477: <div class="titlepage">
4478: <div>
4479: <div>
4480: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4481: "fetch-behind-firewall" id=
4482: "fetch-behind-firewall"></a>6.8. How to fetch
4483: files from behind a firewall</h2>
1.1 grant 4484: </div>
4485: </div>
4486: </div>
4487:
4488: <p>If you are sitting behind a firewall which does not
4489: allow direct connections to Internet hosts (i.e.
4490: non-NAT), you may specify the relevant proxy hosts. This
4491: is done using an environment variable in the form of a
4492: URL e.g. in Amdahl, the machine “<span class=
4493: "quote">orpheus.amdahl.com</span>” is one of the
4494: firewalls, and it uses port 80 as the proxy port number.
4495: So the proxy environment variables are:</p>
4496: <pre class="programlisting">
1.34 ! wiz 4497: ftp_proxy=ftp://orpheus.amdahl.com:80/
1.1 grant 4498: http_proxy=http://orpheus.amdahl.com:80/
4499: </pre>
4500: </div>
4501:
4502: <div class="sect1" lang="en" xml:lang="en">
4503: <div class="titlepage">
4504: <div>
4505: <div>
4506: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4507: "passive-ftp" id="passive-ftp"></a>6.9. How do
4508: I tell <span><strong class="command">make
1.14 xtraeme 4509: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 4510: </div>
4511: </div>
4512: </div>
4513:
4514: <p>This depends on which utility is used to retrieve
1.14 xtraeme 4515: distfiles. From <code class="filename">bsd.pkg.mk</code>,
4516: <code class="varname">FETCH_CMD</code> is assigned the
4517: first available command from the following list:</p>
1.34 ! wiz 4518:
! 4519: <div class="itemizedlist">
! 4520: <ul type="disc">
! 4521: <li>
! 4522: <p><code class=
! 4523: "filename">${LOCALBASE}/bin/ftp</code></p>
! 4524: </li>
! 4525:
! 4526: <li>
! 4527: <p><code class="filename">/usr/bin/ftp</code></p>
! 4528: </li>
! 4529: </ul>
! 4530: </div>
1.1 grant 4531:
4532: <p>On a default NetBSD installation, this will be
1.14 xtraeme 4533: <code class="filename">/usr/bin/ftp</code>, which
1.1 grant 4534: automatically tries passive connections first, and falls
4535: back to active connections if the server refuses to do
4536: passive. For the other tools, add the following to your
1.14 xtraeme 4537: <code class="filename">/etc/mk.conf</code> file:
4538: <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 4539:
1.14 xtraeme 4540: <p>Having that option present will prevent <code class=
4541: "filename">/usr/bin/ftp</code> from falling back to
4542: active transfers.</p>
1.1 grant 4543: </div>
4544:
4545: <div class="sect1" lang="en" xml:lang="en">
4546: <div class="titlepage">
4547: <div>
4548: <div>
4549: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4550: "fetching-all-distfiles" id=
4551: "fetching-all-distfiles"></a>6.10. How to
1.1 grant 4552: fetch all distfiles at once</h2>
4553: </div>
4554: </div>
4555: </div>
4556:
4557: <p>You would like to download all the distfiles in a
4558: single batch from work or university, where you can't run
1.14 xtraeme 4559: a <span><strong class="command">make
4560: fetch</strong></span>. There is an archive of distfiles
4561: on <a href=
1.1 grant 4562: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
4563: target="_top">ftp.NetBSD.org</a>, but downloading the
4564: entire directory may not be appropriate.</p>
4565:
1.14 xtraeme 4566: <p>The answer here is to do a <span><strong class=
4567: "command">make fetch-list</strong></span> in <code class=
4568: "filename">/usr/pkgsrc</code> or one of it's
1.1 grant 4569: subdirectories, carry the resulting list to your machine
1.23 wiz 4570: at work/school and use it there. If you don't have a
1.24 wiz 4571: NetBSD-compatible <a href=
4572: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
4573: <span class="citerefentry"><span class=
4574: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
4575: at work, don't forget to set <code class=
4576: "varname">FETCH_CMD</code> to something that fetches a
4577: URL:</p>
1.1 grant 4578:
4579: <p>At home:</p>
4580: <pre class="screen">
1.14 xtraeme 4581: <code class="prompt">%</code> <strong class=
4582: "userinput"><code>cd /usr/pkgsrc</code></strong>
4583: <code class="prompt">%</code> <strong class=
4584: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
4585: <code class="prompt">%</code> <strong class=
4586: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 4587: </pre>
4588:
4589: <p>At work:</p>
4590: <pre class="screen">
1.14 xtraeme 4591: <code class="prompt">%</code> <strong class=
4592: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 4593: </pre>
4594:
1.14 xtraeme 4595: <p>then tar up <code class=
4596: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 4597:
4598: <p>If you have a machine running NetBSD, and you want to
4599: get <span class="emphasis"><em>all</em></span> distfiles
4600: (even ones that aren't for your machine architecture),
4601: you can do so by using the above-mentioned
1.14 xtraeme 4602: <span><strong class="command">make
4603: fetch-list</strong></span> approach, or fetch the
4604: distfiles directly by running:</p>
1.1 grant 4605: <pre class="screen">
1.14 xtraeme 4606: <code class="prompt">%</code> <strong class=
4607: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 4608: </pre>
4609:
1.14 xtraeme 4610: <p>If you even decide to ignore <code class=
4611: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
4612: can get everything by running:</p>
1.1 grant 4613: <pre class="screen">
1.14 xtraeme 4614: <code class="prompt">%</code> <strong class=
4615: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 4616: </pre>
4617: </div>
4618:
4619: <div class="sect1" lang="en" xml:lang="en">
4620: <div class="titlepage">
4621: <div>
4622: <div>
4623: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4624: "tmac.andoc-missing" id=
4625: "tmac.andoc-missing"></a>6.11. What does
1.1 grant 4626: “<span class="quote">Don't know how to make
4627: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
4628: </div>
4629: </div>
4630: </div>
4631:
4632: <p>When compiling the <a xmlns=
4633: "http://www.w3.org/TR/xhtml1/transitional" href=
4634: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4635: class="pkgname">pkgtools/pkg_install</a> package, you get
4636: the error from make that it doesn't know how to make
4637: <code class="filename">/usr/share/tmac/tmac.andoc</code>?
4638: This indicates that you don't have installed the
1.23 wiz 4639: “<span class="quote">text</span>” set (nroff,
4640: ...) from the NetBSD base distribution on your machine.
4641: It is recommended to do that to format manpages.</p>
1.1 grant 4642:
4643: <p>In the case of the <a xmlns=
4644: "http://www.w3.org/TR/xhtml1/transitional" href=
4645: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4646: class="pkgname">pkgtools/pkg_install</a> package, you can
4647: get away with setting <code class=
4648: "varname">NOMAN=YES</code> either in the environment or
4649: in <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 4650: </div>
4651:
4652: <div class="sect1" lang="en" xml:lang="en">
4653: <div class="titlepage">
4654: <div>
4655: <div>
4656: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4657: "bsd.own.mk-missing" id=
4658: "bsd.own.mk-missing"></a>6.12. What does
1.1 grant 4659: “<span class="quote">Could not find
4660: bsd.own.mk</span>” mean?</h2>
4661: </div>
4662: </div>
4663: </div>
4664:
1.14 xtraeme 4665: <p>You didn't install the compiler set, <code class=
4666: "filename">comp.tgz</code>, when you installed your
4667: NetBSD machine. Please get it and install it, by
4668: extracting it in <code class="filename">/</code>:</p>
1.1 grant 4669: <pre class="screen">
1.14 xtraeme 4670: <code class="prompt">#</code> <strong class=
4671: "userinput"><code>cd /</code></strong>
4672: <code class="prompt">#</code> <strong class=
4673: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 4674: </pre>
4675:
1.14 xtraeme 4676: <p><code class="filename">comp.tgz</code> is part of
4677: every NetBSD release. Get the one that corresponds to
4678: your release (determine via <span><strong class=
4679: "command">uname -r</strong></span>).</p>
1.1 grant 4680: </div>
4681:
4682: <div class="sect1" lang="en" xml:lang="en">
4683: <div class="titlepage">
4684: <div>
4685: <div>
4686: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4687: "using-sudo-with-pkgsrc" id=
4688: "using-sudo-with-pkgsrc"></a>6.13. Using
1.1 grant 4689: 'sudo' with pkgsrc</h2>
4690: </div>
4691: </div>
4692: </div>
4693:
4694: <p>When installing packages as non-root user and using
1.24 wiz 4695: the just-in-time <a href=
4696: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
4697: <span class="citerefentry"><span class=
4698: "refentrytitle">su</span>(1)</span></a> feature of
4699: pkgsrc, it can become annoying to type in the root
4700: password for each required package installed. To avoid
4701: this, the sudo package can be used, which does password
4702: caching over a limited time. To use it, install sudo
4703: (either as binary package or from <a xmlns=
4704: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4705: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.20 ben 4706: class="pkgname">security/sudo</a>) and then put the
4707: following into your <code class=
4708: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4709: <pre class="programlisting">
1.34 ! wiz 4710: .if exists(${LOCALBASE}/bin/sudo)
! 4711: SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
! 4712: .endif
1.1 grant 4713: </pre>
4714: </div>
4715:
4716: <div class="sect1" lang="en" xml:lang="en">
4717: <div class="titlepage">
4718: <div>
4719: <div>
4720: <h2 class="title" style="clear: both"><a name=
4721: "faq.conf" id=
1.14 xtraeme 4722: "faq.conf"></a>6.14. Configuration files
1.1 grant 4723: handling and placement</h2>
4724: </div>
4725: </div>
4726: </div>
4727:
1.14 xtraeme 4728: <p>The global variable <code class=
4729: "varname">PKG_SYSCONFBASE</code> (and some others) can be
4730: set by the system administrator in <code class=
4731: "filename">/etc/mk.conf</code> to define the place where
1.1 grant 4732: configuration files get installed. Therefore, packages
4733: must be adapted to support this feature. Keep in mind
4734: that you should only install files that are strictly
4735: necessary in the configuration directory, files that can
1.14 xtraeme 4736: go to <code class="filename">$PREFIX/share</code> should
4737: go there.</p>
1.1 grant 4738:
4739: <p>We will take a look at available variables first
1.14 xtraeme 4740: (<code class="filename">bsd.pkg.mk</code> contains more
4741: information). <code class="varname">PKG_SYSCONFDIR</code>
4742: is where the configuration files for a package may be
4743: found (that is, the full path, e.g. <code class=
4744: "filename">/etc</code> or <code class=
4745: "filename">/usr/pkg/etc</code>). This value may be
1.1 grant 4746: customized in various ways:</p>
4747:
4748: <div class="orderedlist">
4749: <ol type="1">
4750: <li>
1.14 xtraeme 4751: <p><code class="varname">PKG_SYSCONFBASE</code> is
4752: the main config directory under which all package
1.1 grant 4753: configuration files are to be found. Users will
1.14 xtraeme 4754: typically want to set it to <code class=
4755: "filename">/etc</code>, or accept the default
4756: location of <code class=
4757: "filename">$PREFIX/etc</code>.</p>
1.1 grant 4758: </li>
4759:
4760: <li>
1.14 xtraeme 4761: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
4762: is the subdirectory of <code class=
4763: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 4764: configuration files for a particular package may be
1.14 xtraeme 4765: found. Defaults to <code class=
4766: "varname">${SYSCONFBASE}</code>.</p>
1.1 grant 4767: </li>
4768:
4769: <li>
1.14 xtraeme 4770: <p><code class="varname">PKG_SYSCONFVAR</code> is
4771: the special suffix used to distinguish any
4772: overriding values for a particular package (see
4773: next item). It defaults to <code class=
4774: "varname">${PKGBASE}</code>, but for a collection
4775: of related packages that should all have the same
4776: <code class="varname">PKG_SYSCONFDIR</code> value,
4777: it can be set in each of the package Makefiles to a
4778: common value.</p>
1.1 grant 4779: </li>
4780:
4781: <li>
1.14 xtraeme 4782: <p><code class=
4783: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
4784: overrides the value of <code class=
4785: "varname">${PKG_SYSCONFDIR}</code> for packages
4786: with the same value for <code class=
4787: "varname">PKG_SYSCONFVAR</code>.</p>
1.1 grant 4788:
4789: <p>As an example, all the various KDE packages may
1.14 xtraeme 4790: want to set <code class=
4791: "varname">PKG_SYSCONFVAR</code> to
4792: “<span class="quote">kde</span>” so
4793: admins can set <code class=
4794: "varname">PKG_SYSCONFDIR.kde</code> in <code class=
4795: "filename">/etc/mk.conf</code> to define where to
1.1 grant 4796: install KDE config files.</p>
4797: </li>
4798: </ol>
4799: </div>
4800:
4801: <p>Programs' configuration directory should be defined
4802: during the configure stage. Packages that use GNU
4803: autoconf can usually do this by using the
4804: “<span class="quote">--sysconfdir</span>”
4805: parameter, but this brings some problems as we will see
4806: now. When you change this pathname in packages, you
4807: should not allow them to install files in that directory
4808: directly. Instead they need to install those files under
1.14 xtraeme 4809: <code class="filename">share/examples/${PKGNAME}</code>
4810: so <code class="filename">PLIST</code> can register
4811: them.</p>
1.1 grant 4812:
4813: <p>Once you have the required configuration files in
1.14 xtraeme 4814: place (under the <code class=
4815: "filename">share/examples</code> directory) the variable
4816: <code class="varname">CONF_FILES</code> should be set to
4817: copy them into <code class=
4818: "varname">PKG_SYSCONFDIR</code>. The contents of this
4819: variable is formed by pairs of filenames; the first
1.1 grant 4820: element of the pair specifies the file inside the
1.14 xtraeme 4821: examples directory (registered by <code class=
4822: "filename">PLIST</code>) and the second element specifies
1.1 grant 4823: the target file. This is done this way to allow binary
4824: packages to place files in the right directory using
1.14 xtraeme 4825: <code class="filename">INSTALL</code>/<code class=
4826: "filename">DEINSTALL</code> scripts which are created
4827: automatically. The package <code class=
4828: "filename">Makefile</code> must also set <code class=
4829: "varname">USE_PKGINSTALL=YES</code> to use these
1.1 grant 4830: automatically generated scripts. The automatic copying of
4831: config files can be toggled by setting the environment
1.14 xtraeme 4832: variable <code class="varname">PKG_CONFIG</code> prior to
1.1 grant 4833: package installation.</p>
4834:
1.34 ! wiz 4835: <p>Here is an example, taken from <code class=
! 4836: "filename">mail/mutt/Makefile</code>:</p>
1.1 grant 4837: <pre class="programlisting">
1.34 ! wiz 4838: EGDIR= ${PREFIX}/share/doc/mutt/samples
1.1 grant 4839: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
4840: </pre>
4841:
4842: <p>As you can see, this package installs configuration
1.14 xtraeme 4843: files inside <code class="varname">EGDIR</code>, which
4844: are registered by <code class="filename">PLIST</code>.
4845: After that, the variable <code class=
4846: "varname">CONF_FILES</code> lists the installed file
4847: first and then the target file. Users will also get an
4848: automatic message when files are installed using this
4849: method.</p>
1.1 grant 4850: </div>
4851:
4852: <div class="sect1" lang="en" xml:lang="en">
4853: <div class="titlepage">
4854: <div>
4855: <div>
4856: <h2 class="title" style="clear: both"><a name=
4857: "audit-packages" id=
1.14 xtraeme 4858: "audit-packages"></a>6.15. Automated security
1.1 grant 4859: checks</h2>
4860: </div>
4861: </div>
4862: </div>
4863:
4864: <p>Please be aware that there can often be bugs in
4865: third-party software, and some of these bugs can leave a
4866: machine vulnerable to exploitation by attackers. In an
4867: effort to lessen the exposure, the NetBSD packages team
4868: maintains a database of known-exploits to packages which
4869: have at one time been included in pkgsrc. The database
4870: can be downloaded automatically, and a security audit of
4871: all packages installed on a system can take place. To do
4872: this, install the <a xmlns=
4873: "http://www.w3.org/TR/xhtml1/transitional" href=
4874: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.20 ben 4875: class="pkgname">security/audit-packages</a> package. It
4876: has two components:</p>
1.1 grant 4877:
4878: <div class="orderedlist">
4879: <ol type="1">
4880: <li>
1.34 ! wiz 4881: <p><span><strong class=
! 4882: "command">download-vulnerability-list</strong></span>,
1.1 grant 4883: an easy way to download a list of the security
4884: vulnerabilities information. This list is kept up
4885: to date by the NetBSD security officer and the
4886: NetBSD packages team, and is distributed from the
4887: NetBSD ftp server:</p>
4888:
4889: <p><a href=
4890: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 4891: target=
4892: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 4893: </li>
4894:
4895: <li>
1.34 ! wiz 4896: <p><span><strong class=
! 4897: "command">audit-packages</strong></span>, an easy
! 4898: way to audit the current machine, checking each
1.1 grant 4899: vulnerability which is known. If a vulnerable
4900: package is installed, it will be shown by output to
4901: stdout, including a description of the type of
4902: vulnerability, and a URL containing more
4903: information.</p>
4904: </li>
4905: </ol>
4906: </div>
4907:
1.23 wiz 4908: <p>Use of the <a xmlns=
4909: "http://www.w3.org/TR/xhtml1/transitional" href=
4910: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
4911: class="pkgname">security/audit-packages</a> package is
4912: strongly recommended! After “<span class=
4913: "quote">audit-packages</span>” is installed, please
4914: read the package's message, which you can get by running
4915: <strong class="userinput"><code>pkg_info -D
4916: audit-package</code></strong>.</p>
1.1 grant 4917: </div>
4918: </div>
4919: </div>
4920:
4921: <div class="part" lang="en" xml:lang="en">
4922: <div class="titlepage">
4923: <div>
4924: <div>
4925: <h1 class="title"><a name="developers-guide" id=
1.2 hubertf 4926: "developers-guide"></a>The pkgsrc developer's
4927: guide</h1>
1.1 grant 4928: </div>
4929: </div>
4930: </div>
4931:
4932: <div class="toc">
4933: <p><b>Table of Contents</b></p>
4934:
4935: <dl>
1.27 rillig 4936: <dt><span class="chapter"><a href="#components">7.
4937: Package components - files, directories and
4938: contents</a></span></dt>
4939:
4940: <dd>
4941: <dl>
4942: <dt><span class="sect1"><a href=
4943: "#components.Makefile">7.1. <code class=
4944: "filename">Makefile</code></a></span></dt>
4945:
4946: <dt><span class="sect1"><a href=
4947: "#components.distinfo">7.2. <code class=
4948: "filename">distinfo</code></a></span></dt>
4949:
4950: <dt><span class="sect1"><a href=
4951: "#components.patches">7.3. patches/*</a></span></dt>
4952:
1.30 wiz 4953: <dt><span class="sect1"><a href=
4954: "#other-mandatory-files">7.4. Other mandatory
4955: files</a></span></dt>
1.27 rillig 4956:
4957: <dt><span class="sect1"><a href=
4958: "#components.optional">7.5. Optional
4959: files</a></span></dt>
4960:
1.30 wiz 4961: <dt><span class="sect1"><a href="#work-dir">7.6.
1.27 rillig 4962: <code class="filename">work*</code></a></span></dt>
4963:
1.30 wiz 4964: <dt><span class="sect1"><a href="#files-dir">7.7.
1.27 rillig 4965: <code class="filename">files/*</code></a></span></dt>
4966: </dl>
4967: </dd>
4968:
4969: <dt><span class="chapter"><a href="#makefile">8.
1.25 rillig 4970: Programming in <code class=
4971: "filename">Makefile</code>s</a></span></dt>
4972:
4973: <dd>
4974: <dl>
4975: <dt><span class="sect1"><a href=
1.27 rillig 4976: "#makefile.variables">8.1. <code class=
1.25 rillig 4977: "filename">Makefile</code> variables</a></span></dt>
4978:
1.27 rillig 4979: <dd>
4980: <dl>
4981: <dt><span class="sect2"><a href=
4982: "#makefile.variables.names">8.1.1. Naming
4983: conventions</a></span></dt>
4984: </dl>
4985: </dd>
4986:
4987: <dt><span class="sect1"><a href="#makefile.code">8.2.
1.25 rillig 4988: Code snippets</a></span></dt>
4989:
4990: <dd>
4991: <dl>
4992: <dt><span class="sect2"><a href=
1.30 wiz 4993: "#adding-to-list">8.2.1. Adding things to a
1.25 rillig 4994: list</a></span></dt>
4995:
4996: <dt><span class="sect2"><a href=
1.30 wiz 4997: "#converting-internal-to-external">8.2.2.
4998: Converting an internal list into an external
4999: list</a></span></dt>
1.25 rillig 5000:
5001: <dt><span class="sect2"><a href=
1.30 wiz 5002: "#passing-variable-to-shell">8.2.3. Passing
5003: variables to a shell command</a></span></dt>
1.27 rillig 5004:
5005: <dt><span class="sect2"><a href=
1.30 wiz 5006: "#quoting-guideline">8.2.4. Quoting
1.27 rillig 5007: guideline</a></span></dt>
5008:
5009: <dt><span class="sect2"><a href=
1.30 wiz 5010: "#bsd-make-bug-workaround">8.2.5. Workaround for
5011: a bug in BSD Make</a></span></dt>
1.25 rillig 5012: </dl>
5013: </dd>
5014: </dl>
5015: </dd>
5016:
5017: <dt><span class="chapter"><a href="#plist">9. PLIST
1.1 grant 5018: issues</a></span></dt>
5019:
5020: <dd>
5021: <dl>
1.30 wiz 5022: <dt><span class="sect1"><a href="#rcs-id">9.1. RCS
1.1 grant 5023: ID</a></span></dt>
5024:
1.30 wiz 5025: <dt><span class="sect1"><a href=
5026: "#automatic-plist-generation">9.2. Semi-automatic
5027: <code class="filename">PLIST</code>
1.14 xtraeme 5028: generation</a></span></dt>
1.1 grant 5029:
1.25 rillig 5030: <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14 xtraeme 5031: Tweaking output of <span><strong class="command">make
5032: print-PLIST</strong></span></a></span></dt>
1.1 grant 5033:
1.25 rillig 5034: <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1 grant 5035: Variable substitution in PLIST</a></span></dt>
5036:
1.30 wiz 5037: <dt><span class="sect1"><a href=
5038: "#manpage-compression">9.5.
1.1 grant 5039: Manpage-compression</a></span></dt>
5040:
1.30 wiz 5041: <dt><span class="sect1"><a href=
5042: "#using-PLIST_SRC">9.6. Changing PLIST source with
5043: <code class=
1.14 xtraeme 5044: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5045:
1.30 wiz 5046: <dt><span class="sect1"><a href=
5047: "#platform-specific-plist">9.7. Platform specific and
5048: differing PLISTs</a></span></dt>
1.1 grant 5049:
5050: <dt><span class="sect1"><a href=
1.25 rillig 5051: "#faq.common-dirs">9.8. Sharing directories between
1.1 grant 5052: packages</a></span></dt>
5053: </dl>
5054: </dd>
5055:
1.25 rillig 5056: <dt><span class="chapter"><a href="#buildlink">10.
1.1 grant 5057: Buildlink methodology</a></span></dt>
5058:
5059: <dd>
5060: <dl>
1.30 wiz 5061: <dt><span class="sect1"><a href=
5062: "#converting-to-buildlink3">10.1. Converting packages
5063: to use buildlink3</a></span></dt>
1.1 grant 5064:
1.30 wiz 5065: <dt><span class="sect1"><a href=
5066: "#creating-buildlink3.mk">10.2. Writing <code class=
5067: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 5068:
5069: <dd>
5070: <dl>
5071: <dt><span class="sect2"><a href=
1.30 wiz 5072: "#anatomy-of-bl3">10.2.1. Anatomy of a
5073: buildlink3.mk file</a></span></dt>
1.1 grant 5074:
5075: <dt><span class="sect2"><a href=
1.30 wiz 5076: "#updating-buildlink-depends">10.2.2. Updating
5077: <code class=
5078: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
5079: <code>pkg</code></em></code> in <code class=
5080: "filename">buildlink3.mk</code>
1.1 grant 5081: files</a></span></dt>
5082: </dl>
5083: </dd>
5084:
1.30 wiz 5085: <dt><span class="sect1"><a href=
5086: "#writing-builtin.mk">10.3. Writing <code class=
5087: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 5088:
5089: <dd>
5090: <dl>
5091: <dt><span class="sect2"><a href=
1.30 wiz 5092: "#anatomy-of-builtin.mk">10.3.1. Anatomy of a
5093: <code class="filename">builtin.mk</code>
5094: file</a></span></dt>
1.1 grant 5095:
5096: <dt><span class="sect2"><a href=
1.30 wiz 5097: "#native-or-pkgsrc-preference">10.3.2. Global
5098: preferences for native or pkgsrc
5099: software</a></span></dt>
1.1 grant 5100: </dl>
5101: </dd>
5102: </dl>
5103: </dd>
5104:
1.25 rillig 5105: <dt><span class="chapter"><a href="#options">11. Options
1.1 grant 5106: handling</a></span></dt>
5107:
5108: <dd>
5109: <dl>
1.30 wiz 5110: <dt><span class="sect1"><a href=
5111: "#global-default-options">11.1. Global default
5112: options</a></span></dt>
1.1 grant 5113:
1.30 wiz 5114: <dt><span class="sect1"><a href=
5115: "#converting-to-options">11.2. Converting packages to
5116: use <code class=
1.14 xtraeme 5117: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 5118: </dl>
5119: </dd>
5120:
1.25 rillig 5121: <dt><span class="chapter"><a href="#build">12. The build
1.1 grant 5122: process</a></span></dt>
5123:
5124: <dd>
5125: <dl>
1.25 rillig 5126: <dt><span class="sect1"><a href="#build.prefix">12.1.
1.1 grant 5127: Program location</a></span></dt>
5128:
1.30 wiz 5129: <dt><span class="sect1"><a href="#main-targets">12.2.
1.1 grant 5130: Main targets</a></span></dt>
5131:
5132: <dt><span class="sect1"><a href=
1.25 rillig 5133: "#build.helpful-targets">12.3. Other helpful
1.1 grant 5134: targets</a></span></dt>
5135: </dl>
5136: </dd>
5137:
1.25 rillig 5138: <dt><span class="chapter"><a href="#fixes">13. Notes on
1.1 grant 5139: fixes for packages</a></span></dt>
5140:
5141: <dd>
5142: <dl>
1.30 wiz 5143: <dt><span class="sect1"><a href=
5144: "#general-operation">13.1. General
5145: operation</a></span></dt>
1.1 grant 5146:
5147: <dd>
5148: <dl>
5149: <dt><span class="sect2"><a href=
1.30 wiz 5150: "#pulling-vars-from-etc-mk.conf">13.1.1. How to
5151: pull in variables from
5152: /etc/mk.conf</a></span></dt>
1.1 grant 5153:
5154: <dt><span class="sect2"><a href=
1.31 wiz 5155: "#where-to-install-documentation">13.1.2. Where
5156: to install documentation</a></span></dt>
5157:
5158: <dt><span class="sect2"><a href=
5159: "#restricted-packages">13.1.3. Restricted
1.1 grant 5160: packages</a></span></dt>
5161:
5162: <dt><span class="sect2"><a href=
1.31 wiz 5163: "#dependencies">13.1.4. Handling
1.1 grant 5164: dependencies</a></span></dt>
5165:
5166: <dt><span class="sect2"><a href=
1.31 wiz 5167: "#conflicts">13.1.5. Handling conflicts with
1.1 grant 5168: other packages</a></span></dt>
5169:
5170: <dt><span class="sect2"><a href=
1.31 wiz 5171: "#not-building-packages">13.1.6. Packages that
1.30 wiz 5172: cannot or should not be built</a></span></dt>
1.1 grant 5173:
5174: <dt><span class="sect2"><a href=
1.31 wiz 5175: "#undeletable-packages">13.1.7. Packages which
1.30 wiz 5176: should not be deleted, once
5177: installed</a></span></dt>
1.1 grant 5178:
5179: <dt><span class="sect2"><a href=
1.31 wiz 5180: "#security-handling">13.1.8. Handling packages
1.1 grant 5181: with security problems</a></span></dt>
5182:
5183: <dt><span class="sect2"><a href=
1.31 wiz 5184: "#compiler-bugs">13.1.9. How to handle compiler
1.1 grant 5185: bugs</a></span></dt>
5186:
5187: <dt><span class="sect2"><a href=
1.31 wiz 5188: "#bumping-pkgrevision">13.1.10. How to handle
1.30 wiz 5189: incrementing versions when fixing an existing
1.1 grant 5190: package</a></span></dt>
5191:
5192: <dt><span class="sect2"><a href=
1.31 wiz 5193: "#portability-of-packages">13.1.11. Portability
1.30 wiz 5194: of packages</a></span></dt>
1.1 grant 5195: </dl>
5196: </dd>
5197:
1.30 wiz 5198: <dt><span class="sect1"><a href=
5199: "#downloading-issues">13.2. Possible downloading
5200: issues</a></span></dt>
1.1 grant 5201:
5202: <dd>
5203: <dl>
5204: <dt><span class="sect2"><a href=
1.30 wiz 5205: "#no-plain-download">13.2.1. Packages whose
5206: distfiles aren't available for plain
1.1 grant 5207: downloading</a></span></dt>
5208:
5209: <dt><span class="sect2"><a href=
1.30 wiz 5210: "#modified-distfiles-same-name">13.2.2. How to
5211: handle modified distfiles with the 'old'
5212: name</a></span></dt>
1.1 grant 5213: </dl>
5214: </dd>
5215:
1.30 wiz 5216: <dt><span class="sect1"><a href=
5217: "#configuration-gotchas">13.3. Configuration
5218: gotchas</a></span></dt>
1.1 grant 5219:
5220: <dd>
5221: <dl>
5222: <dt><span class="sect2"><a href=
1.25 rillig 5223: "#fixes.libtool">13.3.1. Shared libraries -
1.1 grant 5224: libtool</a></span></dt>
5225:
5226: <dt><span class="sect2"><a href=
1.30 wiz 5227: "#using-libtool">13.3.2. Using libtool on GNU
1.1 grant 5228: packages that already support
5229: libtool</a></span></dt>
5230:
5231: <dt><span class="sect2"><a href=
1.30 wiz 5232: "#autoconf-automake">13.3.3. GNU
1.1 grant 5233: Autoconf/Automake</a></span></dt>
5234: </dl>
5235: </dd>
5236:
1.30 wiz 5237: <dt><span class="sect1"><a href=
5238: "#building-considerations">13.4. Building
5239: considerations</a></span></dt>
1.1 grant 5240:
5241: <dd>
5242: <dl>
5243: <dt><span class="sect2"><a href=
1.30 wiz 5244: "#cpp-defines">13.4.1. CPP
5245: defines</a></span></dt>
1.1 grant 5246: </dl>
5247: </dd>
5248:
1.30 wiz 5249: <dt><span class="sect1"><a href=
5250: "#package-specific-actions">13.5. Package specific
5251: actions</a></span></dt>
1.1 grant 5252:
5253: <dd>
5254: <dl>
5255: <dt><span class="sect2"><a href=
1.30 wiz 5256: "#package-configuration-files">13.5.1. Package
5257: configuration files</a></span></dt>
1.1 grant 5258:
5259: <dt><span class="sect2"><a href=
1.30 wiz 5260: "#user-interaction">13.5.2. User
1.2 hubertf 5261: interaction</a></span></dt>
1.1 grant 5262:
5263: <dt><span class="sect2"><a href=
1.30 wiz 5264: "#handling-licenses">13.5.3. Handling
1.1 grant 5265: licenses</a></span></dt>
5266:
5267: <dt><span class="sect2"><a href=
1.30 wiz 5268: "#creating-accounts">13.5.4. Creating an account
5269: from a package</a></span></dt>
1.1 grant 5270:
5271: <dt><span class="sect2"><a href=
1.30 wiz 5272: "#installing-score-files">13.5.5. Installing
5273: score files</a></span></dt>
1.1 grant 5274:
5275: <dt><span class="sect2"><a href=
1.30 wiz 5276: "#login-shells">13.5.6. Packages providing login
1.1 grant 5277: shells</a></span></dt>
5278:
5279: <dt><span class="sect2"><a href=
1.30 wiz 5280: "#perl-scripts">13.5.7. Packages containing perl
1.1 grant 5281: scripts</a></span></dt>
5282:
5283: <dt><span class="sect2"><a href=
1.30 wiz 5284: "#hardcoded-paths">13.5.8. Packages with
5285: hardcoded paths to other
5286: interpreters</a></span></dt>
1.1 grant 5287:
5288: <dt><span class="sect2"><a href=
1.30 wiz 5289: "#perl-modules">13.5.9. Packages installing perl
1.1 grant 5290: modules</a></span></dt>
5291:
5292: <dt><span class="sect2"><a href=
1.25 rillig 5293: "#faq.info-files">13.5.10. Packages installing
1.1 grant 5294: info files</a></span></dt>
5295:
5296: <dt><span class="sect2"><a href=
1.30 wiz 5297: "#gconf2-data-files">13.5.11. Packages installing
5298: GConf2 data files</a></span></dt>
1.1 grant 5299:
5300: <dt><span class="sect2"><a href=
1.30 wiz 5301: "#scrollkeeper-data-files">13.5.12. Packages
5302: installing scrollkeeper data
5303: files</a></span></dt>
1.1 grant 5304:
5305: <dt><span class="sect2"><a href=
1.30 wiz 5306: "#x11-fonts">13.5.13. Packages installing X11
1.1 grant 5307: fonts</a></span></dt>
5308:
5309: <dt><span class="sect2"><a href=
1.30 wiz 5310: "#gtk2-modules">13.5.14. Packages installing GTK2
1.1 grant 5311: modules</a></span></dt>
5312:
5313: <dt><span class="sect2"><a href=
1.30 wiz 5314: "#sgml-xml-data">13.5.15. Packages installing
5315: SGML or XML data</a></span></dt>
1.1 grant 5316:
5317: <dt><span class="sect2"><a href=
1.30 wiz 5318: "#mime-database">13.5.16. Packages installing
1.1 grant 5319: extensions to the MIME database</a></span></dt>
5320:
5321: <dt><span class="sect2"><a href=
1.30 wiz 5322: "#intltool">13.5.17. Packages using
1.1 grant 5323: intltool</a></span></dt>
1.18 xtraeme 5324:
5325: <dt><span class="sect2"><a href=
1.30 wiz 5326: "#startup-scripts">13.5.18. Packages installing
5327: startup scripts</a></span></dt>
1.1 grant 5328: </dl>
5329: </dd>
5330:
1.30 wiz 5331: <dt><span class="sect1"><a href=
5332: "#feedback-to-author">13.6. Feedback to the
5333: author</a></span></dt>
1.1 grant 5334: </dl>
5335: </dd>
5336:
1.25 rillig 5337: <dt><span class="chapter"><a href="#debug">14.
1.1 grant 5338: Debugging</a></span></dt>
5339:
1.25 rillig 5340: <dt><span class="chapter"><a href="#submit">15.
1.1 grant 5341: Submitting and Committing</a></span></dt>
5342:
5343: <dd>
5344: <dl>
1.30 wiz 5345: <dt><span class="sect1"><a href=
5346: "#submitting-your-package">15.1. Submitting your
5347: packages</a></span></dt>
1.1 grant 5348:
1.30 wiz 5349: <dt><span class="sect1"><a href=
5350: "#committing-importing">15.2. Committing: Importing a
5351: package into CVS</a></span></dt>
1.1 grant 5352:
1.30 wiz 5353: <dt><span class="sect1"><a href=
5354: "#updating-package">15.3. Updating a package to a
5355: newer version</a></span></dt>
1.1 grant 5356:
1.30 wiz 5357: <dt><span class="sect1"><a href=
5358: "#moving-package">15.4. Moving a package in
5359: pkgsrc</a></span></dt>
1.1 grant 5360: </dl>
5361: </dd>
5362: </dl>
5363: </div>
5364:
5365: <div class="chapter" lang="en" xml:lang="en">
5366: <div class="titlepage">
5367: <div>
5368: <div>
1.27 rillig 5369: <h2 class="title"><a name="components" id=
5370: "components"></a>Chapter 7. Package
5371: components - files, directories and contents</h2>
1.25 rillig 5372: </div>
5373: </div>
5374: </div>
5375:
5376: <div class="toc">
5377: <p><b>Table of Contents</b></p>
5378:
5379: <dl>
5380: <dt><span class="sect1"><a href=
1.27 rillig 5381: "#components.Makefile">7.1. <code class=
5382: "filename">Makefile</code></a></span></dt>
5383:
5384: <dt><span class="sect1"><a href=
5385: "#components.distinfo">7.2. <code class=
5386: "filename">distinfo</code></a></span></dt>
5387:
5388: <dt><span class="sect1"><a href=
5389: "#components.patches">7.3. patches/*</a></span></dt>
1.25 rillig 5390:
1.30 wiz 5391: <dt><span class="sect1"><a href=
5392: "#other-mandatory-files">7.4. Other mandatory
5393: files</a></span></dt>
1.25 rillig 5394:
1.27 rillig 5395: <dt><span class="sect1"><a href=
5396: "#components.optional">7.5. Optional
5397: files</a></span></dt>
1.25 rillig 5398:
1.30 wiz 5399: <dt><span class="sect1"><a href="#work-dir">7.6.
1.27 rillig 5400: <code class="filename">work*</code></a></span></dt>
1.25 rillig 5401:
1.30 wiz 5402: <dt><span class="sect1"><a href="#files-dir">7.7.
1.27 rillig 5403: <code class="filename">files/*</code></a></span></dt>
1.25 rillig 5404: </dl>
5405: </div>
5406:
1.27 rillig 5407: <p>Whenever you're preparing a package, there are a number
5408: of files involved which are described in the following
5409: sections.</p>
1.25 rillig 5410:
5411: <div class="sect1" lang="en" xml:lang="en">
5412: <div class="titlepage">
5413: <div>
5414: <div>
5415: <h2 class="title" style="clear: both"><a name=
1.27 rillig 5416: "components.Makefile" id=
5417: "components.Makefile"></a>7.1. <code class=
5418: "filename">Makefile</code></h2>
1.25 rillig 5419: </div>
5420: </div>
5421: </div>
5422:
1.27 rillig 5423: <p>Building, installation and creation of a binary
5424: package are all controlled by the package's <code class=
5425: "filename">Makefile</code>. The <code class=
5426: "filename">Makefile</code> describes various things about
5427: a package, for example from where to get it, how to
5428: configure, build, and install it.</p>
5429:
5430: <p>A package <code class="filename">Makefile</code>
5431: contains several sections that describe the package.</p>
1.25 rillig 5432:
1.27 rillig 5433: <p>In the first section there are the following
5434: variables, which should appear exactly in the order given
5435: here.</p>
1.25 rillig 5436:
5437: <div class="itemizedlist">
5438: <ul type="disc">
5439: <li>
1.27 rillig 5440: <p><code class="varname">DISTNAME</code> is the
5441: basename of the distribution file to be downloaded
5442: from the package's website.</p>
5443: </li>
5444:
5445: <li>
5446: <p><code class="varname">PKGNAME</code> is the name
5447: of the package, as used by pkgsrc. You only need to
5448: provide it if it differs from DISTNAME. Usually it
5449: is the directory name together with the version
5450: number. It must match the regular expression
5451: <code class=
5452: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
5453: that is, it starts with a letter or digit, and
5454: contains only letters, digits, dashes, underscores,
5455: dots and plus signs.</p>
1.25 rillig 5456: </li>
5457:
5458: <li>
1.27 rillig 5459: <p><code class="varname">CATEGORIES</code> is a
5460: list of categories which the package fits in. You
5461: can choose any of the top-level directories of
5462: pkgsrc for it.</p>
1.25 rillig 5463: </li>
5464:
5465: <li>
1.27 rillig 5466: <p><code class="varname">MASTER_SITES</code> is a
5467: list of URLs where the distribution files can be
5468: downloaded. Each URL must end with a slash.</p>
1.25 rillig 5469: </li>
5470: </ul>
5471: </div>
5472:
1.27 rillig 5473: <p>The second section contains the following
5474: variables.</p>
1.25 rillig 5475:
1.27 rillig 5476: <div class="itemizedlist">
5477: <ul type="disc">
5478: <li>
5479: <p><code class="varname">MAINTAINER</code> is the
5480: mail address of the package's maintainer, which is
5481: the person you can contact when the package does
5482: not work.</p>
5483: </li>
1.25 rillig 5484:
1.27 rillig 5485: <li>
5486: <p><code class="varname">HOMEPAGE</code> is a URL
5487: where users can find more information about the
1.23 wiz 5488: package.</p>
5489: </li>
1.1 grant 5490:
1.23 wiz 5491: <li>
5492: <p><code class="varname">COMMENT</code> is a
5493: one-line comment about the purpose of the
5494: package.</p>
5495: </li>
5496: </ul>
5497: </div>
1.1 grant 5498:
1.14 xtraeme 5499: <p>The <code class="varname">MASTER_SITES</code> may be
5500: set to one of the predefined sites:</p>
1.1 grant 5501: <pre class="programlisting">
5502: ${MASTER_SITE_APACHE}
1.27 rillig 5503: ${MASTER_SITE_BACKUP}
5504: ${MASTER_SITE_CYGWIN}
1.1 grant 5505: ${MASTER_SITE_DEBIAN}
1.27 rillig 5506: ${MASTER_SITE_FREEBSD}
5507: ${MASTER_SITE_FREEBSD_LOCAL}
1.1 grant 5508: ${MASTER_SITE_GNOME}
5509: ${MASTER_SITE_GNU}
5510: ${MASTER_SITE_GNUSTEP}
1.9 dillo 5511: ${MASTER_SITE_IFARCHIVE}
1.1 grant 5512: ${MASTER_SITE_MOZILLA}
1.27 rillig 5513: ${MASTER_SITE_OPENOFFICE}
1.1 grant 5514: ${MASTER_SITE_PERL_CPAN}
1.27 rillig 5515: ${MASTER_SITE_R_CRAN}
1.1 grant 5516: ${MASTER_SITE_SOURCEFORGE}
5517: ${MASTER_SITE_SUNSITE}
5518: ${MASTER_SITE_SUSE}
5519: ${MASTER_SITE_TEX_CTAN}
5520: ${MASTER_SITE_XCONTRIB}
1.27 rillig 5521: ${MASTER_SITE_XEMACS}
5522:
1.1 grant 5523: </pre>
5524:
5525: <p>If one of these predefined sites is chosen, you may
5526: require the ability to specify a subdirectory of that
5527: site. Since these macros may expand to more than one
5528: actual site, you <span class=
5529: "emphasis"><em>must</em></span> use the following
5530: construct to specify a subdirectory:</p>
5531: <pre class="programlisting">
5532: ${MASTER_SITE_GNU:=subdirectory/name/}
5533: ${MASTER_SITE_SOURCEFORGE:=project_name/}
5534: </pre>
5535:
5536: <p>Note the trailing slash after the subdirectory
5537: name.</p>
5538:
5539: <div class="note" style=
5540: "margin-left: 0.5in; margin-right: 0.5in;">
5541: <h3 class="title">Note</h3>
5542:
1.14 xtraeme 5543: <p><code class="varname">MASTER_SITE_SUBDIR</code> has
5544: been deprecated and <span class="emphasis"><em>should
5545: no longer be used</em></span>.</p>
1.1 grant 5546: </div>
5547:
1.14 xtraeme 5548: <p>If the package has multiple <code class=
5549: "varname">DISTFILES</code> or multiple <code class=
5550: "varname">PATCHFILES</code> from different sites, set
5551: <code class="varname">SITES_foo</code> to a list of URI's
1.1 grant 5552: where file “<span class="quote">foo</span>”
5553: may be found. “<span class=
5554: "quote">foo</span>” includes the suffix, e.g.</p>
5555: <pre class="programlisting">
5556: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
5557: DISTFILES+= foo-file.tar.gz
5558: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
5559: http://www.somewhereelse.com/mirror/somehow/
5560: </pre>
5561:
1.14 xtraeme 5562: <p>Note that the normal default setting of <code class=
5563: "varname">DISTFILES</code> must be made explicit if you
1.1 grant 5564: want to add to it (rather than replace it), as you
5565: usually would.</p>
5566:
5567: <p>Currently the following values are available for
1.14 xtraeme 5568: <code class="varname">CATEGORIES</code>. If more than one
5569: is used, they need to be separated by spaces:</p>
1.1 grant 5570: <pre class="programlisting">
5571: archivers cross geography meta-pkgs security
5572: audio databases graphics misc shells
5573: benchmarks devel ham multimedia sysutils
5574: biology editors inputmethod net textproc
5575: cad emulators lang news time
5576: chat finance mail parallel wm
5577: comms fonts math pkgtools www
5578: converters games mbone print x11
5579: </pre>
5580:
5581: <p>Please pay attention to the following gotchas:</p>
5582:
5583: <div class="itemizedlist">
5584: <ul type="disc">
5585: <li>
1.14 xtraeme 5586: <p>Add <code class="varname">MANCOMPRESSED</code>
5587: if manpages are installed in compressed form by the
5588: package; see comment in <code class=
5589: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 5590: </li>
5591:
5592: <li>
1.14 xtraeme 5593: <p>Replace <code class="filename">/usr/local</code>
1.1 grant 5594: with “<span class=
5595: "quote">${PREFIX}</span>” in all files (see
5596: patches, below).</p>
5597: </li>
5598:
5599: <li>
5600: <p>If the package installs any info files, see
5601: <a href="#faq.info-files" title=
1.25 rillig 5602: "13.5.10. Packages installing info files">Section
5603: 13.5.10, “Packages installing info
1.1 grant 5604: files”</a>.</p>
5605: </li>
5606:
5607: <li>
1.14 xtraeme 5608: <p>Set <code class="varname">MAINTAINER</code> to
5609: be yourself. If you really can't maintain the
5610: package for future updates, set it to <code class=
1.1 grant 5611: "email"><<a href=
1.14 xtraeme 5612: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.1 grant 5613: </li>
5614:
5615: <li>
5616: <p>If a home page for the software in question
1.14 xtraeme 5617: exists, add the variable <code class=
5618: "varname">HOMEPAGE</code> right after <code class=
5619: "varname">MAINTAINER</code>. The value of this
1.1 grant 5620: variable should be the URL for the home page.</p>
5621: </li>
5622:
5623: <li>
1.14 xtraeme 5624: <p>Be sure to set the <code class=
5625: "varname">COMMENT</code> variable to a short
1.1 grant 5626: description of the package, not containing the
5627: pkg's name.</p>
5628: </li>
5629: </ul>
5630: </div>
5631: </div>
5632:
5633: <div class="sect1" lang="en" xml:lang="en">
5634: <div class="titlepage">
5635: <div>
5636: <div>
5637: <h2 class="title" style="clear: both"><a name=
5638: "components.distinfo" id=
1.27 rillig 5639: "components.distinfo"></a>7.2. <code class=
1.14 xtraeme 5640: "filename">distinfo</code></h2>
1.1 grant 5641: </div>
5642: </div>
5643: </div>
5644:
5645: <p>Most important, the mandatory message digest, or
5646: checksum, of all the distfiles needed for the package to
5647: compile, confirming they match the original file
5648: distributed by the author. This ensures that the distfile
5649: retrieved from the Internet has not been corrupted during
5650: transfer or altered by a malign force to introduce a
1.14 xtraeme 5651: security hole. It is generated using the
5652: <span><strong class="command">make
5653: makesum</strong></span> command. The digest algorithm
5654: used was, at one stage, md5, but that was felt lacking
5655: compared to sha1, and so sha1 is now the default
1.1 grant 5656: algorithm. The distfile size is also generated and stored
5657: in new distinfo files. The <a xmlns=
5658: "http://www.w3.org/TR/xhtml1/transitional" href=
5659: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20 ben 5660: class="pkgname">pkgtools/digest</a> utility calculates
5661: all of the digests in the distinfo file, and it provides
5662: various different algorithms. At the current time, the
5663: algorithms provided are: <span class=
5664: "emphasis"><em>md5</em></span>, <span class=
5665: "emphasis"><em>rmd160</em></span>, <span class=
5666: "emphasis"><em>sha1</em></span>, <span class=
5667: "emphasis"><em>sha256</em></span>, <span class=
5668: "emphasis"><em>sha384</em></span> and <span class=
5669: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 5670:
5671: <p>Some packages have different sets of distfiles on a
5672: per architecture basis, for example <a xmlns=
5673: "http://www.w3.org/TR/xhtml1/transitional" href=
5674: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.20 ben 5675: class="pkgname">www/navigator</a>). These are kept in the
5676: same distinfo file and care should be taken when
5677: upgrading such a package to ensure distfile information
5678: is not lost.</p>
1.1 grant 5679:
5680: <p>The message digest/checksum for all the official
1.14 xtraeme 5681: patches found in the <code class=
5682: "filename">patches/</code> directory (see <a href=
5683: "#components.patches" title=
1.27 rillig 5684: "7.3. patches/*">Section 7.3,
1.1 grant 5685: “patches/*”</a>) for the package is also
1.14 xtraeme 5686: stored in the <code class="filename">distinfo</code>
5687: file. This is a message digest/checksum of all lines in
5688: the patch file except the NetBSD RCS Id. This file is
5689: generated by invoking <span><strong class="command">make
5690: makepatchsum</strong></span> (or <span><strong class=
5691: "command">make mps</strong></span> if you're in a
5692: hurry).</p>
1.1 grant 5693: </div>
5694:
5695: <div class="sect1" lang="en" xml:lang="en">
5696: <div class="titlepage">
5697: <div>
5698: <div>
5699: <h2 class="title" style="clear: both"><a name=
5700: "components.patches" id=
1.27 rillig 5701: "components.patches"></a>7.3. patches/*</h2>
1.1 grant 5702: </div>
5703: </div>
5704: </div>
5705:
5706: <p>This directory contains files that are used by the
5707: <a href=
5708: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
5709: <span class="citerefentry"><span class=
5710: "refentrytitle">patch</span>(1)</span></a> command to
5711: modify the sources as distributed in the distribution
5712: file into a form that will compile and run perfectly on
5713: NetBSD. The files are applied successively in alphabetic
5714: order (as returned by a shell “<span class=
5715: "quote">patches/patch-*</span>” glob expansion), so
1.14 xtraeme 5716: <code class="filename">patch-aa</code> is applied before
5717: <code class="filename">patch-ab</code>, etc.</p>
1.1 grant 5718:
1.14 xtraeme 5719: <p>The <code class="filename">patch-*</code> files should
5720: be in <span><strong class="command">diff
5721: -bu</strong></span> format, and apply without a fuzz to
5722: avoid problems. (To force patches to apply with fuzz you
5723: can set <code class=
5724: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 5725: not put changes for more than one file into a single
5726: patch-file, as this will make future modifications more
5727: difficult.</p>
5728:
5729: <p>Similar, a file should be patched at most once, not
5730: several times by several different patches. If a file
5731: needs several patches, they should be combined into one
5732: file.</p>
5733:
5734: <p>One important thing to mention is to pay attention
5735: that no RCS IDs get stored in the patch files, as these
5736: will cause problems when later checked into the NetBSD
1.14 xtraeme 5737: CVS tree. Use the <span><strong class=
5738: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 5739: "http://www.w3.org/TR/xhtml1/transitional" href=
5740: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 5741: class="pkgname">pkgtools/pkgdiff</a> package to avoid
5742: these problems.</p>
1.1 grant 5743:
5744: <p>For even more automation, we recommend using
1.14 xtraeme 5745: <span><strong class="command">mkpatches</strong></span>
5746: from the same package to make a whole set of patches. You
5747: just have to backup files before you edit them to
5748: <code class="filename">filename.orig</code>, e.g. with
5749: <span><strong class="command">cp -p filename
5750: filename.orig</strong></span> or, easier, by using
5751: <span><strong class="command">pkgvi</strong></span> again
5752: from the same package. If you upgrade a package this way,
5753: you can easily compare the new set of patches with the
5754: previously existing one with <span><strong class=
5755: "command">patchdiff</strong></span>.</p>
1.1 grant 5756:
5757: <p>When you have finished a package, remember to generate
5758: the checksums for the patch files by using the
1.14 xtraeme 5759: <span><strong class="command">make
5760: makepatchsum</strong></span> command, see <a href=
5761: "#components.distinfo" title=
1.27 rillig 5762: "7.2. distinfo">Section 7.2,
1.14 xtraeme 5763: “<code class="filename">distinfo</code>”</a>.</p>
1.1 grant 5764:
5765: <p>Patch files that are distributed by the author or
1.14 xtraeme 5766: other maintainers can be listed in <code class=
5767: "varname">$PATCHFILES</code>.</p>
1.1 grant 5768:
5769: <p>If it is desired to store any patches that should not
5770: be committed into pkgsrc, they can be kept outside the
1.14 xtraeme 5771: pkgsrc tree in the <code class=
5772: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 5773: tree there is expected to have the same
5774: “<span class="quote">category/package</span>”
5775: structure as pkgsrc, and patches are expected to be
1.14 xtraeme 5776: stored inside these dirs (also known as <code class=
5777: "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
5778: you want to keep a private patch for <code class=
5779: "filename">pkgsrc/graphics/png</code>, keep it in
5780: <code class=
5781: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
5782: files in the named directory are expected to be patch
1.1 grant 5783: files, and <span class="emphasis"><em>they are applied
5784: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 5785: </div>
5786:
5787: <div class="sect1" lang="en" xml:lang="en">
5788: <div class="titlepage">
5789: <div>
5790: <div>
5791: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5792: "other-mandatory-files" id=
5793: "other-mandatory-files"></a>7.4. Other
1.27 rillig 5794: mandatory files</h2>
5795: </div>
5796: </div>
5797: </div>
5798:
5799: <div class="variablelist">
5800: <dl>
5801: <dt><span class="term"><code class=
5802: "filename">DESCR</code></span></dt>
5803:
5804: <dd>
5805: <p>A multi-line description of the piece of
5806: software. This should include any credits where
5807: they are due. Please bear in mind that others do
5808: not share your sense of humour (or spelling
5809: idiosyncrasies), and that others will read
5810: everything that you write here.</p>
5811: </dd>
5812:
5813: <dt><span class="term"><code class=
5814: "filename">PLIST</code></span></dt>
5815:
5816: <dd>
5817: <p>This file governs the files that are installed
5818: on your system: all the binaries, manual pages,
5819: etc. There are other directives which may be
5820: entered in this file, to control the creation and
5821: deletion of directories, and the location of
5822: inserted files. See <a href="#plist" title=
5823: "Chapter 9. PLIST issues">Chapter 9,
5824: <i>PLIST issues</i></a> for more information.</p>
5825: </dd>
5826: </dl>
5827: </div>
5828: </div>
5829:
5830: <div class="sect1" lang="en" xml:lang="en">
5831: <div class="titlepage">
5832: <div>
5833: <div>
5834: <h2 class="title" style="clear: both"><a name=
5835: "components.optional" id=
5836: "components.optional"></a>7.5. Optional
5837: files</h2>
5838: </div>
5839: </div>
5840: </div>
5841:
5842: <div class="variablelist">
5843: <dl>
5844: <dt><span class="term"><code class=
5845: "filename">INSTALL</code></span></dt>
5846:
5847: <dd>
5848: <p>This shell script is invoked twice by <a href=
5849: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5850: <span class="citerefentry"><span class=
5851: "refentrytitle">pkg_add</span>(1)</span></a>. First
5852: time after package extraction and before files are
5853: moved in place, the second time after the files to
5854: install are moved in place. This can be used to do
5855: any custom procedures not possible with @exec
5856: commands in <code class="filename">PLIST</code>.
5857: See <a href=
5858: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5859: <span class="citerefentry"><span class=
5860: "refentrytitle">pkg_add</span>(1)</span></a> and
5861: <a href=
5862: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5863: <span class="citerefentry"><span class=
5864: "refentrytitle">pkg_create</span>(1)</span></a> for
5865: more information.</p>
5866: </dd>
5867:
5868: <dt><span class="term"><code class=
5869: "filename">DEINSTALL</code></span></dt>
5870:
5871: <dd>
5872: <p>This script is executed before and after any
5873: files are removed. It is this script's
5874: responsibility to clean up any additional messy
5875: details around the package's installation, since
5876: all pkg_delete knows is how to delete the files
5877: created in the original distribution. See <a href=
5878: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
5879: <span class="citerefentry"><span class=
5880: "refentrytitle">pkg_delete</span>(1)</span></a> and
5881: <a href=
5882: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5883: <span class="citerefentry"><span class=
5884: "refentrytitle">pkg_create</span>(1)</span></a> for
5885: more information.</p>
5886: </dd>
5887:
5888: <dt><span class="term"><code class=
5889: "filename">MESSAGE</code></span></dt>
5890:
5891: <dd>
5892: <p>Display this file after installation of the
5893: package. Useful for things like legal notices on
5894: almost-free software and hints for updating config
5895: files after installing modules for apache, PHP etc.
5896: Please note that you can modify variables in it
5897: easily by using <code class=
5898: "varname">MESSAGE_SUBST</code> in the package's
5899: <code class="filename">Makefile</code>:</p>
5900: <pre class="programlisting">
5901: MESSAGE_SUBST+= SOMEVAR="somevalue"
5902: </pre>
5903:
5904: <p>replaces "${SOMEVAR}" with “<span class=
5905: "quote">somevalue</span>” in <code class=
5906: "filename">MESSAGE</code>.</p>
5907: </dd>
5908: </dl>
5909: </div>
5910: </div>
5911:
5912: <div class="sect1" lang="en" xml:lang="en">
5913: <div class="titlepage">
5914: <div>
5915: <div>
5916: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5917: "work-dir" id="work-dir"></a>7.6. <code class=
1.27 rillig 5918: "filename">work*</code></h2>
5919: </div>
5920: </div>
5921: </div>
5922:
5923: <p>When you type <span><strong class=
5924: "command">make</strong></span> the distribution files are
5925: unpacked into this directory. It can be removed by
5926: running <span><strong class="command">make
5927: clean</strong></span>. Besides the sources, this
5928: directory is also used to keep various timestamp
5929: files.</p>
5930:
5931: <p>If a package doesn't create a subdirectory for itself
5932: (like GNU software does, for instance), but extracts
5933: itself in the current directory, you should set
5934: <code class="varname">WRKSRC</code> accordingly, e.g.
5935: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
5936: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
5937: class="pkgname">editors/sam</a> again, but the quick
5938: answer is:</p>
5939: <pre class="programlisting">
5940: WRKSRC= ${WRKDIR}
5941: </pre>
5942:
5943: <p>Please note that the old <code class=
5944: "varname">NO_WRKSUBDIR</code> has been deprecated and
5945: should not be used. Also, if your package doesn't create
5946: a subdir with the name of <code class=
5947: "varname">DISTNAME</code> but some different name, set
5948: <code class="varname">WRKSRC</code> to point to the
5949: proper name in <code class="filename">${WRKDIR}</code>.
5950: See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5951: href=
5952: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
5953: class="pkgname">lang/tcl</a> and <a xmlns=
5954: "http://www.w3.org/TR/xhtml1/transitional" href=
5955: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
5956: class="pkgname">x11/tk</a> for examples, and here is
5957: another one:</p>
5958: <pre class="programlisting">
5959: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
5960: </pre>
5961:
5962: <p>The name of the working directory created by pkgsrc is
5963: <code class="filename">work</code> by default. If the
5964: same pkgsrc tree should be used on several different
5965: platforms, the variable <code class=
5966: "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
5967: attach the platform to the directory name, e.g.
5968: <code class="filename">work.i386</code> or <code class=
5969: "filename">work.sparc</code>.</p>
5970: </div>
5971:
5972: <div class="sect1" lang="en" xml:lang="en">
5973: <div class="titlepage">
5974: <div>
5975: <div>
5976: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5977: "files-dir" id=
5978: "files-dir"></a>7.7. <code class=
1.27 rillig 5979: "filename">files/*</code></h2>
5980: </div>
5981: </div>
5982: </div>
5983:
5984: <p>If you have any files that you wish to be placed in
5985: the package prior to configuration or building, you could
5986: place these files here and use a “<span class=
5987: "quote">${CP}</span>” command in the
5988: “<span class="quote">pre-configure</span>”
5989: target to achieve this. Alternatively, you could simply
5990: diff the file against <code class=
5991: "filename">/dev/null</code> and use the patch mechanism
5992: to manage the creation of this file.</p>
5993: </div>
5994: </div>
5995:
5996: <div class="chapter" lang="en" xml:lang="en">
5997: <div class="titlepage">
5998: <div>
5999: <div>
6000: <h2 class="title"><a name="makefile" id=
6001: "makefile"></a>Chapter 8. Programming in
6002: <code class="filename">Makefile</code>s</h2>
6003: </div>
6004: </div>
6005: </div>
6006:
6007: <div class="toc">
6008: <p><b>Table of Contents</b></p>
6009:
6010: <dl>
6011: <dt><span class="sect1"><a href=
6012: "#makefile.variables">8.1. <code class=
6013: "filename">Makefile</code> variables</a></span></dt>
6014:
6015: <dd>
6016: <dl>
6017: <dt><span class="sect2"><a href=
6018: "#makefile.variables.names">8.1.1. Naming
6019: conventions</a></span></dt>
6020: </dl>
6021: </dd>
6022:
6023: <dt><span class="sect1"><a href="#makefile.code">8.2.
6024: Code snippets</a></span></dt>
6025:
6026: <dd>
6027: <dl>
1.30 wiz 6028: <dt><span class="sect2"><a href=
6029: "#adding-to-list">8.2.1. Adding things to a
6030: list</a></span></dt>
1.27 rillig 6031:
1.30 wiz 6032: <dt><span class="sect2"><a href=
6033: "#converting-internal-to-external">8.2.2.
1.27 rillig 6034: Converting an internal list into an external
6035: list</a></span></dt>
6036:
1.30 wiz 6037: <dt><span class="sect2"><a href=
6038: "#passing-variable-to-shell">8.2.3. Passing
6039: variables to a shell command</a></span></dt>
1.27 rillig 6040:
1.30 wiz 6041: <dt><span class="sect2"><a href=
6042: "#quoting-guideline">8.2.4. Quoting
6043: guideline</a></span></dt>
1.27 rillig 6044:
1.30 wiz 6045: <dt><span class="sect2"><a href=
6046: "#bsd-make-bug-workaround">8.2.5. Workaround for a
6047: bug in BSD Make</a></span></dt>
1.27 rillig 6048: </dl>
6049: </dd>
6050: </dl>
6051: </div>
6052:
6053: <p>Pkgsrc consists of many <code class=
6054: "filename">Makefile</code> fragments, each of which forms a
6055: well-defined part of the pkgsrc system. Using the <a href=
6056: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6057: <span class="citerefentry"><span class=
6058: "refentrytitle">make</span>(1)</span></a> system as a
6059: programming language for a big system like pkgsrc requires
6060: some discipline to keep the code correct and
6061: understandable.</p>
6062:
6063: <p>The basic ingredients for <code class=
6064: "filename">Makefile</code> programming are variables (which
6065: are actually macros) and shell commands. Among these shell
6066: commands may even be more complex ones like <a href=
6067: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
6068: <span class="citerefentry"><span class=
6069: "refentrytitle">awk</span>(1)</span></a> programs. To make
6070: sure that every shell command runs as intended it is
6071: necessary to quote all variables correctly when they are
6072: used.</p>
6073:
6074: <p>This chapter describes some patterns, that appear quite
6075: often in <code class="filename">Makefile</code>s, including
6076: the pitfalls that come along with them.</p>
6077:
6078: <div class="sect1" lang="en" xml:lang="en">
6079: <div class="titlepage">
6080: <div>
6081: <div>
6082: <h2 class="title" style="clear: both"><a name=
6083: "makefile.variables" id=
6084: "makefile.variables"></a>8.1. <code class=
6085: "filename">Makefile</code> variables</h2>
6086: </div>
6087: </div>
6088: </div>
6089:
6090: <p><code class="filename">Makefile</code> variables
6091: contain strings that can be processed using the five
6092: operators ``='', ``+='', ``?='', ``:='', and ``!='',
6093: which are described in the <a href=
6094: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6095: <span class="citerefentry"><span class=
6096: "refentrytitle">make</span>(1)</span></a> man page.</p>
6097:
6098: <p>When a variable's value is parsed from a <code class=
6099: "filename">Makefile</code>, the hash character ``#'' and
6100: the backslash character ``\'' are handled specially. If a
6101: backslash is followed by a newline, any whitespace
6102: immediately in front of the backslash, the backslash, the
6103: newline, and any whitespace immediately behind the
6104: newline are replaced with a single space. A backspace
6105: character and an immediately following hash character are
6106: replaced with a single hash character. Otherwise the
6107: backslash is passed as is. In a variable assignment, any
6108: hash character that is not preceded by a backslash starts
6109: a comment that continues upto the end of the logical
6110: line.</p>
6111:
6112: <p><span class="emphasis"><em>Note:</em></span> Because
6113: of this parsing algorithm the only way to create a
6114: variable consisting of a single backslash is using the
6115: ``!='' operator, for example: <code class=
6116: "varname">BACKSLASH!=echo "\\"</code>.</p>
6117:
6118: <p>So far for defining variables. The other thing you can
6119: do with variables is evaluating them. A variable is
6120: evaluated when it is part of the right side of the ``:=''
6121: or the ``!='' operator, or directly before executing a
6122: shell command which the variable is part of. In all other
6123: cases <a href=
6124: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6125: <span class="citerefentry"><span class=
6126: "refentrytitle">make</span>(1)</span></a> performs lazy
6127: evaluation, that is, variables are not evaluated until
6128: there's no other way. The ``modifiers'' mentioned in the
6129: man page also evaluate the variable.</p>
6130:
6131: <p>Some of the modifiers split the string into words and
6132: then operate on the words, others operate on the string
6133: as a whole. When a string is splitted into words, it is
6134: splitted as you would expect it from <a href=
6135: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
6136: <span class="citerefentry"><span class=
6137: "refentrytitle">sh</span>(1)</span></a>.</p>
6138:
6139: <p>No rule without exception—the
6140: <span><strong class="command">.for</strong></span> loop
6141: does not follow the shell quoting rules but splits at
6142: sequences of whitespace.</p>
6143:
6144: <p>There are several types of variables that should be
6145: handled differently. Strings and two types of lists.</p>
6146:
6147: <div class="itemizedlist">
6148: <ul type="disc">
6149: <li>
6150: <p><span class="emphasis"><em>Strings</em></span>
6151: can contain arbitrary characters. Nevertheless you
6152: should restrict yourself to only using printable
6153: characters. Examples are <code class=
6154: "varname">PREFIX</code> and <code class=
6155: "varname">COMMENT</code>.</p>
6156: </li>
6157:
6158: <li>
6159: <p><span class="emphasis"><em>Internal
6160: lists</em></span> are lists that are never exported
6161: to any shell command. Their elements are separated
6162: by whitespace. Therefore the elements themselves
6163: cannot have embedded whitespace. Any other
6164: characters are allowed. Internal lists can be used
6165: in <span><strong class=
6166: "command">.for</strong></span> loops. Examples are
6167: <code class="varname">DEPENDS</code> and
6168: <code class="varname">BUILD_DEPENDS</code>.</p>
6169: </li>
6170:
6171: <li>
6172: <p><span class="emphasis"><em>External
6173: lists</em></span> are lists that may be exported to
6174: a shell command. Their elements can contain any
6175: characters, including whitespace. That's why they
6176: cannot be used in <span><strong class=
6177: "command">.for</strong></span> loops. Examples are
6178: <code class="varname">DISTFILES</code> and
6179: <code class="varname">MASTER_SITES</code>.</p>
6180: </li>
6181: </ul>
6182: </div>
6183:
6184: <div class="sect2" lang="en" xml:lang="en">
6185: <div class="titlepage">
6186: <div>
6187: <div>
6188: <h3 class="title"><a name=
6189: "makefile.variables.names" id=
6190: "makefile.variables.names"></a>8.1.1. Naming
6191: conventions</h3>
6192: </div>
6193: </div>
6194: </div>
6195:
6196: <div class="itemizedlist">
6197: <ul type="disc">
6198: <li>
6199: <p>All variable names starting with an underscore
6200: are reserved for use by the pkgsrc
6201: infrastructure. They shall not be used by package
6202: <code class="filename">Makefile</code>s.</p>
6203: </li>
6204:
6205: <li>
6206: <p>In <span><strong class=
6207: "command">.for</strong></span> loops you should
6208: use lowercase variable names for the iteration
6209: variables.</p>
6210: </li>
6211:
6212: <li>
6213: <p>All list variables should have a ``plural''
6214: name, e.g. <code class=
6215: "varname">PKG_OPTIONS</code> or <code class=
6216: "varname">DISTFILES</code>.</p>
6217: </li>
6218: </ul>
6219: </div>
6220: </div>
6221: </div>
6222:
6223: <div class="sect1" lang="en" xml:lang="en">
6224: <div class="titlepage">
6225: <div>
6226: <div>
6227: <h2 class="title" style="clear: both"><a name=
6228: "makefile.code" id=
6229: "makefile.code"></a>8.2. Code snippets</h2>
6230: </div>
6231: </div>
6232: </div>
6233:
6234: <p>This section presents you with some code snippets you
6235: should use in your own code. If you don't find anything
6236: appropriate here, you should test your code and add it
6237: here.</p>
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="adding-to-list" id=
6244: "adding-to-list"></a>8.2.1. Adding things to
6245: a list</h3>
1.27 rillig 6246: </div>
6247: </div>
6248: </div>
6249: <pre class="programlisting">
6250: STRING= foo * bar `date`
6251: INT_LIST= # empty
6252: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
6253: EXT_LIST= # empty
6254: ANOTHER_EXT_LIST= a=b c=d
6255:
6256: INT_LIST+= ${STRING} # 1
6257: INT_LIST+= ${ANOTHER_INT_LIST} # 2
6258: EXT_LIST+= ${STRING:Q} # 3
6259: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
6260:
6261: </pre>
6262:
6263: <p>When you add a string to an external list (example
6264: 3), it must be quoted. In all other cases, you must not
6265: add a quoting level. You must not merge internal and
6266: external lists, unless you are sure that all entries
6267: are correctly interpreted in both lists.</p>
6268: </div>
6269:
6270: <div class="sect2" lang="en" xml:lang="en">
6271: <div class="titlepage">
6272: <div>
6273: <div>
1.30 wiz 6274: <h3 class="title"><a name=
6275: "converting-internal-to-external" id=
6276: "converting-internal-to-external"></a>8.2.2. Converting
6277: an internal list into an external list</h3>
1.27 rillig 6278: </div>
6279: </div>
6280: </div>
6281: <pre class="programlisting">
6282: EXT_LIST= # empty
6283: .for i in ${INT_LIST}
6284: EXT_LIST+= ${i:Q}""
6285: .endfor
6286:
6287: </pre>
6288:
6289: <p>This code converts the internal list <code class=
6290: "varname">INT_LIST</code> into the external list
6291: <code class="varname">EXT_LIST</code>. As the elements
6292: of an internal list are unquoted they must be quoted
6293: here. The reason for appending <code class=
6294: "varname">""</code> is explained below.</p>
6295: </div>
1.1 grant 6296:
1.27 rillig 6297: <div class="sect2" lang="en" xml:lang="en">
6298: <div class="titlepage">
1.1 grant 6299: <div>
1.27 rillig 6300: <div>
1.30 wiz 6301: <h3 class="title"><a name=
6302: "passing-variable-to-shell" id=
6303: "passing-variable-to-shell"></a>8.2.3. Passing
6304: variables to a shell command</h3>
1.27 rillig 6305: </div>
1.1 grant 6306: </div>
6307: </div>
1.27 rillig 6308: <pre class="programlisting">
6309: STRING= foo bar < > * `date` $$HOME ' "
6310: EXT_LIST= string=${STRING:Q} x=second\ item
6311:
6312: all:
6313: echo ${STRING} # 1
6314: echo "${STRING}" # 2
6315: echo "${STRING:Q}" # 3
6316: echo ${STRING:Q} # 4
6317: echo x${STRING:Q} | sed 1s,.,, # 5
6318: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
6319:
6320: </pre>
6321:
6322: <p>Example 1 leads to a syntax error in the shell, as
6323: the characters are just copied.</p>
6324:
6325: <p>Example 2 leads to a syntax error too, and if you
6326: leave out the last " character from <code class=
6327: "varname">${STRING}</code>, <a href=
6328: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
6329: <span class="citerefentry"><span class=
6330: "refentrytitle">date</span>(1)</span></a> will be
6331: executed. The <code class="varname">$HOME</code> shell
6332: variable would be evaluated, too.</p>
6333:
6334: <p>Example 3 outputs each space character preceded by a
6335: backslash (or not), depending on the implementation of
6336: the <a href=
6337: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6338: <span class="citerefentry"><span class=
6339: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 6340:
1.27 rillig 6341: <p>Example 4 handles correctly every string that does
6342: not start with a dash. In that case, the result depends
6343: on the implementation of the <a href=
6344: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6345: <span class="citerefentry"><span class=
6346: "refentrytitle">echo</span>(1)</span></a> command. As
6347: long as you can guarantee that your input does not
6348: start with a dash this form is appropriate.</p>
1.1 grant 6349:
1.27 rillig 6350: <p>Example 5 handles even the case of a leading dash
6351: correctly.</p>
1.1 grant 6352:
1.27 rillig 6353: <p>The <code class="varname">EXT_LIST</code> does not
6354: need to be quoted because the quoting has already be
6355: done when adding elements to the list.</p>
1.1 grant 6356:
1.27 rillig 6357: <p>As internal lists shall not be passed to the shell,
6358: there is no example for it.</p>
1.1 grant 6359: </div>
6360:
1.27 rillig 6361: <div class="sect2" lang="en" xml:lang="en">
6362: <div class="titlepage">
1.1 grant 6363: <div>
1.27 rillig 6364: <div>
1.30 wiz 6365: <h3 class="title"><a name="quoting-guideline" id=
6366: "quoting-guideline"></a>8.2.4. Quoting
1.27 rillig 6367: guideline</h3>
6368: </div>
1.1 grant 6369: </div>
6370: </div>
6371:
1.27 rillig 6372: <p>There are many possible sources of wrongly quoted
6373: variables. This section lists some of the commonly
6374: known ones.</p>
1.1 grant 6375:
1.27 rillig 6376: <div class="itemizedlist">
6377: <ul type="disc">
6378: <li>
6379: <p>Whenever you use the value of a list, think
6380: about what happens to leading or trailing
6381: whitespace. If the list is a well-formed shell
6382: expression you can apply the <code class=
6383: "varname">:M*</code> modifier to strip leading
6384: and trailing whitespace from each word. The
6385: <code class="varname">:M</code> operator first
6386: splits its argument according to the rules of the
6387: shell, and then creates a new list consisting of
6388: all words that match the shell glob expression
6389: <code class="varname">*</code>, that is: all. One
6390: class of situations where this is needed is when
6391: adding a variable like <code class=
6392: "varname">CPPFLAGS</code> to <code class=
6393: "varname">CONFIGURE_ARGS</code>. If the configure
6394: script invokes other configure scripts it strips
6395: the leading and trailing whitespace from the
6396: variable and then passes it to the other
6397: configure scripts. But these configure scripts
6398: expect the (child) <code class=
6399: "varname">CPPFLAGS</code> variable to be the same
6400: as the parent <code class=
6401: "varname">CPPFLAGS</code>. That's why we better
6402: pass the <code class="varname">CPPFLAGS</code>
6403: value properly trimmed. And here is how we do
6404: it:</p>
6405: <pre class="programlisting">
6406: CPPFLAGS= # empty
6407: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
6408: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 grant 6409:
1.27 rillig 6410: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 grant 6411:
1.27 rillig 6412: all:
6413: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
6414: echo x${CONFIGURE_ARGS}x # properly trimmed
6415:
6416: </pre>
6417: </li>
1.1 grant 6418:
1.27 rillig 6419: <li>
6420: <p>The example above contains one bug: The
6421: <code class="varname">${PREFIX}</code> is a
6422: properly quoted shell expression, but there is
6423: the C compiler after it, which also expects a
6424: properly quoted string (this time in C syntax).
6425: The version above is therefore only correct if
6426: <code class="varname">${PREFIX}</code> does not
6427: have embedded backslashes or double quotes. If
6428: you want to allow these, you have to add another
6429: layer of quoting to each variable that is used as
6430: a C string literal. You cannot use the
6431: <code class="varname">:Q</code> operator for it,
6432: as this operator only works for the shell.</p>
6433: </li>
1.1 grant 6434:
1.27 rillig 6435: <li>
6436: <p>Whenever a variable can be empty the
6437: <code class="varname">:Q</code> operator can have
6438: surprising results. Here are two completely
6439: different cases which can be solved with the same
6440: trick.</p>
6441: <pre class="programlisting">
6442: EMPTY= # empty
6443: empty_test:
6444: for i in a ${EMPTY:Q} c; do \
6445: echo "$$i"; \
6446: done
6447:
6448: for_test:
6449: .for i in a:\ a:\test.txt
6450: echo ${i:Q}
6451: echo "foo"
6452: .endfor
6453:
1.1 grant 6454: </pre>
6455:
1.27 rillig 6456: <p>The first example will only print two of the
6457: three lines we might have expected. This is
6458: because <code class="varname">${EMPTY:Q}</code>
6459: expands to the empty string, which the shell
6460: cannot see. The workaround is to write
6461: <code class="varname">${EMPTY:Q}""</code>. This
6462: pattern can be often found as <code class=
6463: "varname">${TEST} -z ${VAR:Q}</code> or as
6464: <code class="varname">${TEST} -f
6465: ${FNAME:Q}</code> (both of these are wrong).</p>
6466:
6467: <p>The second example will only print three lines
6468: instead of four. The first line looks like
6469: <code class="varname">a:\ echo foo</code>. This
6470: is because the backslash of the value
6471: <code class="varname">a:\</code> is interpreted
6472: as a line-continuation by <a href=
6473: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6474: <span class="citerefentry"><span class=
6475: "refentrytitle">make</span>(1)</span></a>, which
6476: makes the second line the arguments of the
6477: <a href=
6478: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6479: <span class="citerefentry"><span class=
6480: "refentrytitle">echo</span>(1)</span></a> command
6481: from the first line. To avoid this, write
6482: <code class="varname">${i:Q}""</code>.</p>
6483: </li>
6484: </ul>
6485: </div>
1.1 grant 6486: </div>
6487:
1.27 rillig 6488: <div class="sect2" lang="en" xml:lang="en">
6489: <div class="titlepage">
1.1 grant 6490: <div>
1.27 rillig 6491: <div>
1.30 wiz 6492: <h3 class="title"><a name=
6493: "bsd-make-bug-workaround" id=
6494: "bsd-make-bug-workaround"></a>8.2.5. Workaround
6495: for a bug in BSD Make</h3>
1.27 rillig 6496: </div>
1.1 grant 6497: </div>
6498: </div>
6499:
1.27 rillig 6500: <p>The pkgsrc bmake program does not handle the
6501: following assignment correctly. In case <code class=
6502: "varname">_othervar_</code> contains a ``-'' character,
6503: one of the closing braces is included in <code class=
6504: "varname">${VAR}</code> after this code executes.</p>
6505: <pre class="programlisting">
6506: VAR:= ${VAR:N${_othervar_:C/-//}}
6507:
1.1 grant 6508: </pre>
6509:
1.27 rillig 6510: <p>For a more complex code snippet and a workaround,
6511: see the package <a xmlns=
6512: "http://www.w3.org/TR/xhtml1/transitional" href=
6513: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
6514: class="pkgname">regress/make-quoting</a>, testcase
6515: <code class="varname">bug1</code>.</p>
1.1 grant 6516: </div>
6517: </div>
6518: </div>
6519:
6520: <div class="chapter" lang="en" xml:lang="en">
6521: <div class="titlepage">
6522: <div>
6523: <div>
6524: <h2 class="title"><a name="plist" id=
1.25 rillig 6525: "plist"></a>Chapter 9. PLIST issues</h2>
1.1 grant 6526: </div>
6527: </div>
6528: </div>
6529:
6530: <div class="toc">
6531: <p><b>Table of Contents</b></p>
6532:
6533: <dl>
1.30 wiz 6534: <dt><span class="sect1"><a href="#rcs-id">9.1. RCS
1.1 grant 6535: ID</a></span></dt>
6536:
1.30 wiz 6537: <dt><span class="sect1"><a href=
6538: "#automatic-plist-generation">9.2. Semi-automatic
6539: <code class="filename">PLIST</code>
1.14 xtraeme 6540: generation</a></span></dt>
1.1 grant 6541:
1.25 rillig 6542: <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14 xtraeme 6543: Tweaking output of <span><strong class="command">make
6544: print-PLIST</strong></span></a></span></dt>
1.1 grant 6545:
1.25 rillig 6546: <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1 grant 6547: Variable substitution in PLIST</a></span></dt>
6548:
1.30 wiz 6549: <dt><span class="sect1"><a href=
6550: "#manpage-compression">9.5.
1.1 grant 6551: Manpage-compression</a></span></dt>
6552:
1.30 wiz 6553: <dt><span class="sect1"><a href="#using-PLIST_SRC">9.6.
1.14 xtraeme 6554: Changing PLIST source with <code class=
6555: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 6556:
1.30 wiz 6557: <dt><span class="sect1"><a href=
6558: "#platform-specific-plist">9.7. Platform specific and
6559: differing PLISTs</a></span></dt>
1.1 grant 6560:
1.25 rillig 6561: <dt><span class="sect1"><a href="#faq.common-dirs">9.8.
1.1 grant 6562: Sharing directories between packages</a></span></dt>
6563: </dl>
6564: </div>
6565:
1.14 xtraeme 6566: <p>The <code class="filename">PLIST</code> file contains a
1.1 grant 6567: package's “<span class="quote">packing
6568: list</span>”, i.e. a list of files that belong to the
1.14 xtraeme 6569: package (relative to the <code class=
6570: "filename">${PREFIX}</code> directory it's been installed
6571: in) plus some additional statements - see the <a href=
1.1 grant 6572: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6573: <span class="citerefentry"><span class=
6574: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
6575: a full list. This chapter addresses some issues that need
1.14 xtraeme 6576: attention when dealing with the <code class=
6577: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 6578:
6579: <div class="sect1" lang="en" xml:lang="en">
6580: <div class="titlepage">
6581: <div>
6582: <div>
6583: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6584: "rcs-id" id="rcs-id"></a>9.1. RCS ID</h2>
1.1 grant 6585: </div>
6586: </div>
6587: </div>
6588:
6589: <p>Be sure to add a RCS ID line as the first thing in any
1.14 xtraeme 6590: <code class="filename">PLIST</code> file you write:</p>
1.1 grant 6591: <pre class="programlisting">
1.17 sketch 6592: @comment $NetBSD$
1.1 grant 6593: </pre>
6594: </div>
6595:
6596: <div class="sect1" lang="en" xml:lang="en">
6597: <div class="titlepage">
6598: <div>
6599: <div>
6600: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6601: "automatic-plist-generation" id=
6602: "automatic-plist-generation"></a>9.2. Semi-automatic
1.14 xtraeme 6603: <code class="filename">PLIST</code> generation</h2>
1.1 grant 6604: </div>
6605: </div>
6606: </div>
6607:
1.14 xtraeme 6608: <p>You can use the <span><strong class="command">make
6609: print-PLIST</strong></span> command to output a PLIST
6610: that matches any new files since the package was
6611: extracted. See <a href="#build.helpful-targets" title=
1.25 rillig 6612: "12.3. Other helpful targets">Section 12.3,
1.1 grant 6613: “Other helpful targets”</a> for more
6614: information on this target.</p>
6615: </div>
6616:
6617: <div class="sect1" lang="en" xml:lang="en">
6618: <div class="titlepage">
6619: <div>
6620: <div>
6621: <h2 class="title" style="clear: both"><a name=
6622: "print-PLIST" id=
1.25 rillig 6623: "print-PLIST"></a>9.3. Tweaking output of
1.14 xtraeme 6624: <span><strong class="command">make
6625: print-PLIST</strong></span></h2>
1.1 grant 6626: </div>
6627: </div>
6628: </div>
6629:
6630: <p>If you have used any of the *-dirs packages, as
6631: explained in <a href="#faq.common-dirs" title=
1.25 rillig 6632: "9.8. Sharing directories between packages">Section 9.8,
1.1 grant 6633: “Sharing directories between packages”</a>,
1.14 xtraeme 6634: you may have noticed that <span><strong class=
6635: "command">make print-PLIST</strong></span> outputs a set
6636: of <code class="varname">@comment</code>s instead of real
6637: <code class="varname">@dirrm</code> lines. You can also
6638: do this for specific directories and files, so that the
6639: results of that command are very close to reality. This
6640: helps <span class="emphasis"><em>a lot</em></span> during
6641: the update of packages.</p>
6642:
6643: <p>The <code class="varname">PRINT_PLIST_AWK</code>
6644: variable takes a set of AWK patterns and actions that are
6645: used to filter the output of print-PLIST. You can
6646: <span class="emphasis"><em>append</em></span> any chunk
6647: of AWK scripting you like to it, but be careful with
1.1 grant 6648: quoting.</p>
6649:
1.14 xtraeme 6650: <p>For example, to get all files inside the <code class=
6651: "filename">libdata/foo</code> directory removed from the
1.1 grant 6652: resulting PLIST:</p>
6653: <pre class="programlisting">
6654: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
6655:
6656: </pre>
6657:
1.14 xtraeme 6658: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 6659: lines referring to a specific (shared) directory
1.14 xtraeme 6660: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 6661: <pre class="programlisting">
6662: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
6663:
6664: </pre>
6665: </div>
6666:
6667: <div class="sect1" lang="en" xml:lang="en">
6668: <div class="titlepage">
6669: <div>
6670: <div>
6671: <h2 class="title" style="clear: both"><a name=
1.25 rillig 6672: "plist.misc" id="plist.misc"></a>9.4. Variable
1.1 grant 6673: substitution in PLIST</h2>
6674: </div>
6675: </div>
6676: </div>
6677:
6678: <p>A number of variables are substituted automatically in
6679: PLISTs when a package is installed on a system. This
6680: includes the following variables:</p>
6681:
6682: <div class="variablelist">
6683: <dl>
1.14 xtraeme 6684: <dt><span class="term"><code class=
6685: "varname">${MACHINE_ARCH}</code>, <code class=
6686: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 6687:
6688: <dd>
6689: <p>Some packages like emacs and perl embed
6690: information about which architecture they were
6691: built on into the pathnames where they install
6692: their file. To handle this case, PLIST will be
6693: preprocessed before actually used, and the symbol
1.14 xtraeme 6694: “<span class="quote"><code class=
6695: "varname">${MACHINE_ARCH}</code></span>” will
6696: be replaced by what <span><strong class=
6697: "command">uname -p</strong></span> gives. The same
6698: is done if the string <code class=
6699: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
6700: PLIST somewhere - use this on packages that have
6701: GNU autoconf created configure scripts.</p>
1.1 grant 6702:
6703: <div class="note" style=
6704: "margin-left: 0.5in; margin-right: 0.5in;">
6705: <h3 class="title">Legacy note</h3>
6706:
6707: <p>There used to be a symbol “<span class=
1.14 xtraeme 6708: "quote"><code class=
6709: "varname">$ARCH</code></span>” that was
6710: replaced by the output of <span><strong class=
6711: "command">uname -m</strong></span>, but that's no
1.1 grant 6712: longer supported and has been removed.</p>
6713: </div>
6714: </dd>
6715:
1.14 xtraeme 6716: <dt><span class="term"><code class=
6717: "varname">${OPSYS}</code>, <code class=
6718: "varname">${LOWER_OPSYS}</code>, <code class=
6719: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 6720:
6721: <dd>
6722: <p>Some packages want to embed the OS name and
6723: version into some paths. To do this, use these
1.14 xtraeme 6724: variables in the <code class=
6725: "filename">PLIST</code>:</p>
1.1 grant 6726:
6727: <div class="itemizedlist">
6728: <ul type="disc">
6729: <li>
1.14 xtraeme 6730: <p><code class="varname">${OPSYS}</code> -
6731: output of “<span class=
6732: "quote"><span><strong class="command">uname
6733: -s</strong></span></span>”</p>
1.1 grant 6734: </li>
6735:
6736: <li>
1.14 xtraeme 6737: <p><code class=
6738: "varname">${LOWER_OPSYS}</code> - lowercase
6739: common name (eg. “<span class=
6740: "quote">solaris</span>”)</p>
1.1 grant 6741: </li>
6742:
6743: <li>
1.14 xtraeme 6744: <p><code class="varname">${OS_VERSION}</code>
6745: - “<span class=
6746: "quote"><span><strong class="command">uname
6747: -r</strong></span></span>”</p>
1.1 grant 6748: </li>
6749: </ul>
6750: </div>
6751: </dd>
6752:
1.14 xtraeme 6753: <dt><span class="term"><code class=
6754: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 6755:
6756: <dd>
6757: <p>Packages that install locale files should list
6758: them in the PLIST as “<span class=
6759: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
6760: instead of “<span class=
6761: "quote">share/locale/de/LC_MESSAGES/...</span>”.
6762: This properly handles the fact that different
6763: operating systems expect locale files to be either
1.14 xtraeme 6764: in <code class="filename">share</code> or
6765: <code class="filename">lib</code> by default.</p>
1.1 grant 6766: </dd>
6767: </dl>
6768: </div>
6769:
6770: <p>For a complete list of values which are replaced by
1.14 xtraeme 6771: default, please look in <code class=
6772: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 6773: "emphasis"><em>PLIST_SUBST</em></span>).</p>
6774:
6775: <p>If you want to change other variables not listed
6776: above, you can add variables and their expansions to this
1.14 xtraeme 6777: variable in the following way, similar to <code class=
6778: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 6779: "#components.optional" title=
1.27 rillig 6780: "7.5. Optional files">Section 7.5,
1.1 grant 6781: “Optional files”</a>):</p>
6782: <pre class="programlisting">
6783: PLIST_SUBST+= SOMEVAR="somevalue"
6784: </pre>
6785:
6786: <p>This replaces all occurrences of “<span class=
6787: "quote">${SOMEVAR}</span>” in the PLIST with
6788: “<span class="quote">somevalue</span>”.</p>
6789: </div>
6790:
6791: <div class="sect1" lang="en" xml:lang="en">
6792: <div class="titlepage">
6793: <div>
6794: <div>
6795: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6796: "manpage-compression" id=
6797: "manpage-compression"></a>9.5. Manpage-compression</h2>
1.1 grant 6798: </div>
6799: </div>
6800: </div>
6801:
6802: <p>Manpages should be installed in compressed form if
1.14 xtraeme 6803: <code class="varname">MANZ</code> is set (in <code class=
6804: "filename">bsd.own.mk</code>), and uncompressed
6805: otherwise. To handle this in the <code class=
6806: "filename">PLIST</code> file, the suffix
6807: “<span class="quote">.gz</span>” is
6808: appended/removed automatically for manpages according to
6809: <code class="varname">MANZ</code> and <code class=
6810: "varname">MANCOMPRESSED</code> being set or not, see
6811: above for details. This modification of the <code class=
6812: "filename">PLIST</code> file is done on a copy of it, not
6813: <code class="filename">PLIST</code> itself.</p>
1.1 grant 6814: </div>
6815:
6816: <div class="sect1" lang="en" xml:lang="en">
6817: <div class="titlepage">
6818: <div>
6819: <div>
6820: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6821: "using-PLIST_SRC" id=
6822: "using-PLIST_SRC"></a>9.6. Changing PLIST
6823: source with <code class=
1.14 xtraeme 6824: "varname">PLIST_SRC</code></h2>
1.1 grant 6825: </div>
6826: </div>
6827: </div>
6828:
1.14 xtraeme 6829: <p>To use one or more files as source for the
6830: <code class="filename">PLIST</code> used in generating
6831: the binary package, set the variable <code class=
6832: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 6833: The files are later concatenated using <a href=
6834: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
6835: <span class="citerefentry"><span class=
6836: "refentrytitle">cat</span>(1)</span></a>, and order of
6837: things is important.</p>
1.1 grant 6838: </div>
6839:
6840: <div class="sect1" lang="en" xml:lang="en">
6841: <div class="titlepage">
6842: <div>
6843: <div>
6844: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6845: "platform-specific-plist" id=
6846: "platform-specific-plist"></a>9.7. Platform
1.1 grant 6847: specific and differing PLISTs</h2>
6848: </div>
6849: </div>
6850: </div>
6851:
6852: <p>Some packages decide to install a different set of
6853: files based on the operating system being used. These
6854: differences can be automatically handled by using the
6855: following files:</p>
6856:
6857: <div class="itemizedlist">
6858: <ul type="disc">
6859: <li>
1.14 xtraeme 6860: <p><code class="filename">PLIST.common</code></p>
1.1 grant 6861: </li>
6862:
6863: <li>
1.14 xtraeme 6864: <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1 grant 6865: </li>
6866:
6867: <li>
1.14 xtraeme 6868: <p><code class=
1.21 ben 6869: "filename">PLIST.${MACHINE_ARCH}</code></p>
6870: </li>
6871:
6872: <li>
6873: <p><code class=
6874: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
6875: </li>
6876:
6877: <li>
6878: <p><code class=
1.14 xtraeme 6879: "filename">PLIST.common_end</code></p>
1.1 grant 6880: </li>
6881: </ul>
6882: </div>
6883: </div>
6884:
6885: <div class="sect1" lang="en" xml:lang="en">
6886: <div class="titlepage">
6887: <div>
6888: <div>
6889: <h2 class="title" style="clear: both"><a name=
6890: "faq.common-dirs" id=
1.25 rillig 6891: "faq.common-dirs"></a>9.8. Sharing directories
1.1 grant 6892: between packages</h2>
6893: </div>
6894: </div>
6895: </div>
6896:
6897: <p>A “<span class="quote">shared
6898: directory</span>” is a directory where multiple
6899: (and unrelated) packages install files. These directories
6900: are problematic because you have to add special tricks in
6901: the PLIST to conditionally remove them, or have some
6902: centralized package handle them.</p>
6903:
6904: <p>Within pkgsrc, you'll find both approaches. If a
6905: directory is shared by a few unrelated packages, it's
6906: often not worth to add an extra package to remove it.
6907: Therefore, one simply does:</p>
6908: <pre class="programlisting">
6909: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
6910:
6911: </pre>
6912:
6913: <p>in the PLISTs of all affected packages, instead of the
6914: regular "@dirrm" line.</p>
6915:
6916: <p>However, if the directory is shared across many
6917: packages, two different solutions are available:</p>
6918:
6919: <div class="orderedlist">
6920: <ol type="1">
6921: <li>
6922: <p>If the packages have a common dependency, the
6923: directory can be removed in that. For example, see
6924: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
6925: href=
6926: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20 ben 6927: class="pkgname">textproc/scrollkeeper</a>, which
6928: removes the shared directory <code class=
6929: "filename">share/omf</code>.</p>
1.1 grant 6930: </li>
6931:
6932: <li>
6933: <p>If the packages using the directory are not
6934: related at all (they have no common dependencies),
6935: a *-dirs package is used.</p>
6936: </li>
6937: </ol>
6938: </div>
6939:
6940: <p>From now on, we'll discuss the second solution. To get
6941: an idea of the *-dirs packages available, issue:</p>
6942: <pre class="programlisting">
1.14 xtraeme 6943: <code class="prompt">%</code> cd .../pkgsrc
6944: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 6945:
6946: </pre>
6947:
6948: <p>Their use from other packages is very simple. The
1.14 xtraeme 6949: <code class="varname">USE_DIRS</code> variable takes a
6950: list of package names (without the “<span class=
1.1 grant 6951: "quote">-dirs</span>” part) together with the
6952: required version number (always pick the latest one when
1.34 ! wiz 6953: writing new packages).</p>
1.1 grant 6954:
6955: <p>For example, if a package installs files under
1.14 xtraeme 6956: <code class="filename">share/applications</code>, it
6957: should have the following line in it:</p>
1.1 grant 6958: <pre class="programlisting">
6959: USE_DIRS+= xdg-1.1
6960:
6961: </pre>
6962:
1.14 xtraeme 6963: <p>After regenerating the PLIST using
6964: <span><strong class="command">make
6965: print-PLIST</strong></span>, you should get the right
6966: (commented out) lines.</p>
1.1 grant 6967:
1.14 xtraeme 6968: <p>Note that, even if your package is using <code class=
6969: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 6970: *-x11-dirs packages. Just specify the name without that
1.14 xtraeme 6971: part and pkgsrc (in particular, <code class=
6972: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 6973: </div>
6974: </div>
6975:
6976: <div class="chapter" lang="en" xml:lang="en">
6977: <div class="titlepage">
6978: <div>
6979: <div>
6980: <h2 class="title"><a name="buildlink" id=
1.25 rillig 6981: "buildlink"></a>Chapter 10. Buildlink
1.1 grant 6982: methodology</h2>
6983: </div>
6984: </div>
6985: </div>
6986:
6987: <div class="toc">
6988: <p><b>Table of Contents</b></p>
6989:
6990: <dl>
1.30 wiz 6991: <dt><span class="sect1"><a href=
6992: "#converting-to-buildlink3">10.1. Converting packages
6993: to use buildlink3</a></span></dt>
1.1 grant 6994:
1.30 wiz 6995: <dt><span class="sect1"><a href=
6996: "#creating-buildlink3.mk">10.2. Writing <code class=
6997: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 6998:
6999: <dd>
7000: <dl>
1.25 rillig 7001: <dt><span class="sect2"><a href=
1.30 wiz 7002: "#anatomy-of-bl3">10.2.1. Anatomy of a
7003: buildlink3.mk file</a></span></dt>
1.1 grant 7004:
1.25 rillig 7005: <dt><span class="sect2"><a href=
1.30 wiz 7006: "#updating-buildlink-depends">10.2.2. Updating
7007: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 7008: "replaceable"><code>pkg</code></em></code> in
7009: <code class="filename">buildlink3.mk</code>
1.1 grant 7010: files</a></span></dt>
7011: </dl>
7012: </dd>
7013:
1.30 wiz 7014: <dt><span class="sect1"><a href=
7015: "#writing-builtin.mk">10.3. Writing <code class=
7016: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 7017:
7018: <dd>
7019: <dl>
1.25 rillig 7020: <dt><span class="sect2"><a href=
1.30 wiz 7021: "#anatomy-of-builtin.mk">10.3.1. Anatomy of a
7022: <code class="filename">builtin.mk</code>
7023: file</a></span></dt>
1.1 grant 7024:
1.25 rillig 7025: <dt><span class="sect2"><a href=
1.30 wiz 7026: "#native-or-pkgsrc-preference">10.3.2. Global
7027: preferences for native or pkgsrc
7028: software</a></span></dt>
1.1 grant 7029: </dl>
7030: </dd>
7031: </dl>
7032: </div>
7033:
7034: <p>Buildlink is a framework in pkgsrc that controls what
7035: headers and libraries are seen by a package's configure and
7036: build processes. This is implemented in a two step
7037: process:</p>
7038:
7039: <div class="orderedlist">
7040: <ol type="1">
7041: <li>
7042: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 7043: into <code class="varname">BUILDLINK_DIR</code>,
7044: which by default is a subdirectory of <code class=
7045: "varname">WRKDIR</code>.</p>
1.1 grant 7046: </li>
7047:
7048: <li>
7049: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 7050: the normal compiler tools that translate <code class=
7051: "option">-I${LOCALBASE}/include</code> and
7052: <code class="option">-L${LOCALBASE}/lib</code> into
7053: references to <code class=
7054: "varname">BUILDLINK_DIR</code>. The wrapper scripts
7055: also make native compiler on some operating systems
7056: look like GCC, so that packages that expect GCC won't
7057: require modifications to build with those native
7058: compilers.</p>
1.1 grant 7059: </li>
7060: </ol>
7061: </div>
7062:
7063: <p>This normalizes the environment in which a package is
7064: built so that the package may be built consistently despite
7065: what other software may be installed. Please note that the
1.14 xtraeme 7066: normal system header and library paths, e.g. <code class=
7067: "filename">/usr/include</code>, <code class=
7068: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 7069: buildlink3 is designed to insulate the package build from
7070: non-system-supplied software.</p>
7071:
7072: <div class="sect1" lang="en" xml:lang="en">
7073: <div class="titlepage">
7074: <div>
7075: <div>
7076: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7077: "converting-to-buildlink3" id=
7078: "converting-to-buildlink3"></a>10.1. Converting
7079: packages to use buildlink3</h2>
1.1 grant 7080: </div>
7081: </div>
7082: </div>
7083:
7084: <p>The process of converting packages to use the
7085: buildlink3 framework (“<span class=
7086: "quote">bl3ifying</span>”) is fairly
7087: straightforward. The things to keep in mind are:</p>
7088:
7089: <div class="orderedlist">
7090: <ol type="1">
7091: <li>
7092: <p>Ensure that the build always calls the wrapper
7093: scripts instead of the actual toolchain. Some
7094: packages are tricky, and the only way to know for
1.14 xtraeme 7095: sure is the check <code class=
7096: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 7097: wrappers are being invoked.</p>
7098: </li>
7099:
7100: <li>
1.14 xtraeme 7101: <p>Don't override <code class=
7102: "varname">PREFIX</code> from within the package
7103: Makefile, e.g. Java VMs, standalone shells, etc.,
7104: because the code to symlink files into <code class=
7105: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 7106: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 7107: <em class=
7108: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 7109: </li>
7110:
7111: <li>
7112: <p>Remember that <span class=
1.14 xtraeme 7113: "emphasis"><em>only</em></span> the <code class=
7114: "filename">buildlink3.mk</code> files that you list
1.1 grant 7115: in a package's Makefile are added as dependencies
7116: for that package.</p>
7117: </li>
7118: </ol>
7119: </div>
7120:
7121: <p>If a dependency on a particular package is required
7122: for its libraries and headers, then we replace:</p>
7123: <pre class="programlisting">
1.27 rillig 7124: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 7125: </pre>
7126:
7127: <p>with</p>
7128: <pre class="programlisting">
7129: .include "../../category/foo/buildlink3.mk"
7130: </pre>
7131:
1.14 xtraeme 7132: <p>There are several <code class=
7133: "filename">buildlink3.mk</code> files in <code class=
7134: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 7135: issues:</p>
7136:
7137: <div class="itemizedlist">
7138: <ul type="disc">
7139: <li>
1.14 xtraeme 7140: <p><code class="filename">bdb.buildlink3.mk</code>
1.1 grant 7141: chooses either the native or a pkgsrc Berkeley DB
1.14 xtraeme 7142: implementation based on the values of <code class=
7143: "varname">BDB_ACCEPTED</code> and <code class=
7144: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 7145: </li>
7146:
7147: <li>
1.14 xtraeme 7148: <p><code class=
7149: "filename">curses.buildlink3.mk</code> If the
7150: system comes with neither Curses nor NCurses, this
7151: will take care to install the <a xmlns=
7152: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 7153: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20 ben 7154: class="pkgname">devel/ncurses</a> package.</p>
1.1 grant 7155: </li>
7156:
7157: <li>
1.14 xtraeme 7158: <p><code class="filename">krb5.buildlink3.mk</code>
7159: uses the value of <code class=
7160: "varname">KRB5_ACCEPTED</code> to choose between
1.1 grant 7161: adding a dependency on Heimdal or MIT-krb5 for
7162: packages that require a Kerberos 5
7163: implementation.</p>
7164: </li>
7165:
7166: <li>
1.14 xtraeme 7167: <p><code class=
7168: "filename">motif.buildlink3.mk</code> checks for a
7169: system-provided Motif installation or adds a
7170: dependency on <a xmlns=
1.1 grant 7171: "http://www.w3.org/TR/xhtml1/transitional" href=
7172: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20 ben 7173: class="pkgname">x11/lesstif</a> or <a xmlns=
7174: "http://www.w3.org/TR/xhtml1/transitional" href=
7175: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
7176: class="pkgname">x11/openmotif</a>;</p>
1.1 grant 7177: </li>
7178:
7179: <li>
1.14 xtraeme 7180: <p><code class=
7181: "filename">ossaudio.buildlink3.mk</code> defines
7182: several variables that may be used by packages that
7183: use the Open Sound System (OSS) API;</p>
1.1 grant 7184: </li>
7185:
7186: <li>
1.14 xtraeme 7187: <p><code class=
7188: "filename">pgsql.buildlink3.mk</code> will accept
7189: either Postgres 7.3 or 7.4, whichever is found
7190: installed. See the file for more information.</p>
1.1 grant 7191: </li>
7192:
7193: <li>
1.14 xtraeme 7194: <p><code class=
7195: "filename">pthread.buildlink3.mk</code> uses the
7196: value of <code class="varname">PTHREAD_OPTS</code>
7197: and checks for native pthreads or adds a dependency
7198: on <a xmlns=
1.1 grant 7199: "http://www.w3.org/TR/xhtml1/transitional" href=
7200: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20 ben 7201: class="pkgname">devel/pth</a> as needed;</p>
1.1 grant 7202: </li>
7203:
7204: <li>
1.14 xtraeme 7205: <p><code class="filename">xaw.buildlink3.mk</code>
7206: uses the value of <code class=
7207: "varname">XAW_TYPE</code> to choose a particular
7208: Athena widgets library.</p>
1.1 grant 7209: </li>
7210: </ul>
7211: </div>
7212:
1.14 xtraeme 7213: <p>The comments in those <code class=
7214: "filename">buildlink3.mk</code> files provide a more
1.1 grant 7215: complete description of how to use them properly.</p>
7216: </div>
7217:
7218: <div class="sect1" lang="en" xml:lang="en">
7219: <div class="titlepage">
7220: <div>
7221: <div>
7222: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7223: "creating-buildlink3.mk" id=
7224: "creating-buildlink3.mk"></a>10.2. Writing
1.14 xtraeme 7225: <code class="filename">buildlink3.mk</code>
7226: files</h2>
1.1 grant 7227: </div>
7228: </div>
7229: </div>
7230:
1.14 xtraeme 7231: <p>A package's <code class=
7232: "filename">buildlink3.mk</code> file is included by
7233: Makefiles to indicate the need to compile and link
7234: against header files and libraries provided by the
7235: package. A <code class="filename">buildlink3.mk</code>
7236: file should always provide enough information to add the
7237: correct type of dependency relationship and include any
7238: other <code class="filename">buildlink3.mk</code> files
7239: that it needs to find headers and libraries that it needs
7240: in turn.</p>
1.1 grant 7241:
1.14 xtraeme 7242: <p>To generate an initial <code class=
7243: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 7244: Rene Hexel's <a xmlns=
7245: "http://www.w3.org/TR/xhtml1/transitional" href=
7246: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20 ben 7247: class="pkgname">pkgtools/createbuildlink</a> package is
7248: highly recommended. For most packages, the following
7249: command will generate a good starting point for
7250: <code class="filename">buildlink3.mk</code> files:</p>
1.1 grant 7251: <pre class="screen">
1.14 xtraeme 7252: <code class="prompt">%</code> <strong class=
7253: "userinput"><code>cd pkgsrc/<em class=
7254: "replaceable"><code>category</code></em>/<em class=
7255: "replaceable"><code>pkgdir</code></em>
7256: <code class=
7257: "prompt">%</code> createbuildlink -3 >buildlink3.mk</code></strong>
1.1 grant 7258: </pre>
7259:
7260: <div class="sect2" lang="en" xml:lang="en">
7261: <div class="titlepage">
7262: <div>
7263: <div>
1.30 wiz 7264: <h3 class="title"><a name="anatomy-of-bl3" id=
7265: "anatomy-of-bl3"></a>10.2.1. Anatomy of a
1.25 rillig 7266: buildlink3.mk file</h3>
1.1 grant 7267: </div>
7268: </div>
7269: </div>
7270:
1.14 xtraeme 7271: <p>The following real-life example <code class=
7272: "filename">buildlink3.mk</code> is taken from
7273: <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 7274: <pre class="programlisting">
1.17 sketch 7275: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 7276:
7277: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
7278: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
7279:
7280: .if !empty(BUILDLINK_DEPTH:M+)
7281: BUILDLINK_DEPENDS+= tiff
7282: .endif
7283:
7284: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
7285: BUILDLINK_PACKAGES+= tiff
7286:
7287: .if !empty(TIFF_BUILDLINK3_MK:M+)
7288: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
7289: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
7290: .endif # TIFF_BUILDLINK3_MK
7291:
7292: .include "../../devel/zlib/buildlink3.mk"
7293: .include "../../graphics/jpeg/buildlink3.mk"
7294:
7295: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
7296: </pre>
7297:
1.14 xtraeme 7298: <p>The header and footer manipulate <code class=
7299: "varname">BUILDLINK_DEPTH</code>, which is common
7300: across all <code class="filename">buildlink3.mk</code>
7301: files and is used to track at what depth we are
7302: including <code class="filename">buildlink3.mk</code>
7303: files.</p>
1.1 grant 7304:
7305: <p>The first section controls if the dependency on
1.14 xtraeme 7306: <em class="replaceable"><code>pkg</code></em> is added.
7307: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 7308: global list of packages for which dependencies are
7309: added by buildlink3.</p>
7310:
7311: <p>The second section advises pkgsrc that the
1.14 xtraeme 7312: <code class="filename">buildlink3.mk</code> file for
7313: <em class="replaceable"><code>pkg</code></em> has been
7314: included at some point. <code class=
7315: "varname">BUILDLINK_PACKAGES</code> is the global list
7316: of packages for which <code class=
7317: "filename">buildlink3.mk</code> files have been
7318: included. It must <span class=
7319: "emphasis"><em>always</em></span> be appended to within
7320: a <code class="filename">buildlink3.mk</code> file.</p>
1.1 grant 7321:
7322: <p>The third section is protected from multiple
1.14 xtraeme 7323: inclusion and controls how the dependency on <em class=
7324: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 7325: important variables are set in the section:</p>
7326:
7327: <div class="itemizedlist">
7328: <ul type="disc">
7329: <li>
1.14 xtraeme 7330: <p><code class=
7331: "varname">BUILDLINK_DEPENDS.<em class=
7332: "replaceable"><code>pkg</code></em></code> is the
7333: actual dependency recorded in the installed
7334: package; this should always be set using
7335: <span><strong class="command">+=</strong></span>
7336: to ensure that we're appending to any
7337: pre-existing list of values. This variable should
7338: be set to the first version of the package that
7339: had the last change in the major number of a
7340: shared library or that had a major API
7341: change.</p>
1.1 grant 7342: </li>
7343:
7344: <li>
1.14 xtraeme 7345: <p><code class=
7346: "varname">BUILDLINK_PKGSRCDIR.<em class=
7347: "replaceable"><code>pkg</code></em></code> is the
7348: location of the <em class=
7349: "replaceable"><code>pkg</code></em> pkgsrc
1.1 grant 7350: directory;</p>
7351: </li>
7352:
7353: <li>
1.14 xtraeme 7354: <p><code class=
7355: "varname">BUILDLINK_DEPMETHOD.<em class=
7356: "replaceable"><code>pkg</code></em></code> (not
7357: shown above) controls whether we use <code class=
7358: "varname">BUILD_DEPENDS</code> or <code class=
7359: "varname">DEPENDS</code> to add the dependency on
7360: <em class="replaceable"><code>pkg</code></em>.
7361: The build dependency is selected by setting
7362: <code class=
7363: "varname">BUILDLINK_DEPMETHOD.<em class=
7364: "replaceable"><code>pkg</code></em></code> to
1.1 grant 7365: “<span class="quote">build</span>”.
7366: By default, the full dependency is used.</p>
7367: </li>
7368:
7369: <li>
1.14 xtraeme 7370: <p><code class=
7371: "varname">BUILDLINK_INCDIRS.<em class=
7372: "replaceable"><code>pkg</code></em></code> and
7373: <code class=
7374: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
7375: <code>pkg</code></em></code> (not shown above)
7376: are lists of subdirectories of <code class=
7377: "filename">${BUILDLINK_PREFIX.<em class=
7378: "replaceable"><code>pkg</code></em>}</code> to
7379: add to the header and library search paths. These
1.1 grant 7380: default to “<span class=
7381: "quote">include</span>” and
7382: “<span class="quote">lib</span>”
7383: respectively.</p>
7384: </li>
7385:
7386: <li>
1.14 xtraeme 7387: <p><code class=
7388: "varname">BUILDLINK_CPPFLAGS.<em class=
7389: "replaceable"><code>pkg</code></em></code> (not
7390: shown above) is the list of preprocessor flags to
7391: add to <code class="varname">CPPFLAGS</code>,
7392: which are passed on to the configure and build
7393: phases. The “<span class=
7394: "quote">-I</span>” option should be avoided
7395: and instead be handled using <code class=
7396: "varname">BUILDLINK_INCDIRS.<em class=
7397: "replaceable"><code>pkg</code></em></code> as
7398: above.</p>
1.1 grant 7399: </li>
7400: </ul>
7401: </div>
7402:
7403: <p>The following variables are all optionally defined
7404: within this second section (protected against multiple
7405: inclusion) and control which package files are
1.14 xtraeme 7406: symlinked into <code class=
7407: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 7408: are transformed during the symlinking:</p>
7409:
7410: <div class="itemizedlist">
7411: <ul type="disc">
7412: <li>
1.14 xtraeme 7413: <p><code class=
7414: "varname">BUILDLINK_FILES.<em class=
7415: "replaceable"><code>pkg</code></em></code> (not
7416: shown above) is a shell glob pattern relative to
7417: <code class=
7418: "filename">${BUILDLINK_PREFIX.<em class=
7419: "replaceable"><code>pkg</code></em>}</code> to be
7420: symlinked into <code class=
7421: "filename">${BUILDLINK_DIR}</code>, e.g.
7422: <code class="filename">include/*.h</code>.</p>
1.1 grant 7423: </li>
7424:
7425: <li>
1.14 xtraeme 7426: <p><code class=
7427: "varname">BUILDLINK_FILES_CMD.<em class=
7428: "replaceable"><code>pkg</code></em></code> (not
7429: shown above) is a shell pipeline that outputs to
7430: stdout a list of files relative to <code class=
7431: "filename">${BUILDLINK_PREFIX.<em class=
7432: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 7433: resulting files are to be symlinked into
1.14 xtraeme 7434: <code class="filename">${BUILDLINK_DIR}</code>.
7435: By default, this takes the <code class=
7436: "filename">+CONTENTS</code> of a <em class=
7437: "replaceable"><code>pkg</code></em> and filters
7438: it through <code class=
7439: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
7440: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 7441: </li>
7442:
7443: <li>
1.14 xtraeme 7444: <p><code class=
7445: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
7446: "replaceable"><code>pkg</code></em></code> (not
7447: shown above) is a filter command that filters
7448: <code class="filename">+CONTENTS</code> input
7449: into a list of files relative to <code class=
7450: "filename">${BUILDLINK_PREFIX.<em class=
7451: "replaceable"><code>pkg</code></em>}</code> on
7452: stdout. By default for overwrite packages,
7453: <code class=
7454: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
7455: "replaceable"><code>pkg</code></em></code>
7456: outputs the contents of the <code class=
7457: "filename">include</code> and <code class=
7458: "filename">lib</code> directories in the package
7459: <code class="filename">+CONTENTS</code>, and for
7460: pkgviews packages, it outputs any libtool
7461: archives in <code class="filename">lib</code>
1.1 grant 7462: directories.</p>
7463: </li>
7464:
7465: <li>
1.14 xtraeme 7466: <p><code class=
7467: "varname">BUILDLINK_TRANSFORM.<em class=
7468: "replaceable"><code>pkg</code></em></code> (not
7469: shown above) is a list of sed arguments used to
1.1 grant 7470: transform the name of the source filename into a
1.14 xtraeme 7471: destination filename, e.g. <span><strong class=
1.1 grant 7472: "command">-e
1.14 xtraeme 7473: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 7474: </li>
7475: </ul>
7476: </div>
7477:
1.14 xtraeme 7478: <p>The last section includes any <code class=
7479: "filename">buildlink3.mk</code> needed for <em class=
7480: "replaceable"><code>pkg</code></em>'s library
7481: dependencies. Including these <code class=
7482: "filename">buildlink3.mk</code> files means that the
7483: headers and libraries for these dependencies are also
7484: symlinked into <code class=
7485: "filename">${BUILDLINK_DIR}</code> whenever the
7486: <em class="replaceable"><code>pkg</code></em>
7487: <code class="filename">buildlink3.mk</code> file is
7488: included.</p>
1.1 grant 7489: </div>
7490:
7491: <div class="sect2" lang="en" xml:lang="en">
7492: <div class="titlepage">
7493: <div>
7494: <div>
1.30 wiz 7495: <h3 class="title"><a name=
7496: "updating-buildlink-depends" id=
7497: "updating-buildlink-depends"></a>10.2.2. Updating
7498: <code class=
7499: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
7500: <code>pkg</code></em></code> in <code class=
7501: "filename">buildlink3.mk</code> files</h3>
1.1 grant 7502: </div>
7503: </div>
7504: </div>
7505:
7506: <p>There are two situations that require increasing the
1.14 xtraeme 7507: dependency listed in <code class=
7508: "varname">BUILDLINK_DEPENDS.<em class=
7509: "replaceable"><code>pkg</code></em></code> after a
7510: package update:</p>
1.1 grant 7511:
7512: <div class="orderedlist">
7513: <ol type="1">
7514: <li>
7515: <p>if the sonames (major number of the library
7516: version) of any installed shared libraries
7517: change;</p>
7518: </li>
7519:
7520: <li>
7521: <p>if the API or interface to the header files
7522: change.</p>
7523: </li>
7524: </ol>
7525: </div>
7526:
1.14 xtraeme 7527: <p>In these cases, <code class=
7528: "varname">BUILDLINK_DEPENDS.<em class=
7529: "replaceable"><code>pkg</code></em></code> should be
7530: adjusted to require at least the new package version.
7531: In some cases, the packages that depend on this new
7532: version may need their <code class=
7533: "varname">PKGREVISION</code>s increased and, if they
7534: have <code class="filename">buildlink3.mk</code> files,
7535: their <code class=
7536: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
7537: pkg</code></em></code> adjusted, too. This is needed so
7538: that binary packages made using it will require the
7539: correct package dependency and not settle for an older
7540: one which will not contain the necessary shared
7541: libraries.</p>
1.1 grant 7542:
7543: <p>Please take careful consideration before adjusting
1.14 xtraeme 7544: <code class="varname">BUILDLINK_DEPENDS.<em class=
7545: "replaceable"><code>pkg</code></em></code> as we don't
7546: want to cause unneeded package deletions and rebuilds.
7547: In many cases, new versions of packages work just fine
7548: with older dependencies. See <a href="#dependencies"
1.31 wiz 7549: title="13.1.4. Handling dependencies">Section
7550: 13.1.4, “Handling dependencies”</a> and
1.14 xtraeme 7551: <a href="#buildlink" title=
1.25 rillig 7552: "Chapter 10. Buildlink methodology">Chapter
7553: 10, <i>Buildlink methodology</i></a> for more
7554: information about dependencies on other packages,
7555: including the <code class=
7556: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
7557: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 7558: </div>
7559: </div>
7560:
7561: <div class="sect1" lang="en" xml:lang="en">
7562: <div class="titlepage">
7563: <div>
7564: <div>
7565: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7566: "writing-builtin.mk" id=
7567: "writing-builtin.mk"></a>10.3. Writing
1.14 xtraeme 7568: <code class="filename">builtin.mk</code> files</h2>
1.1 grant 7569: </div>
7570: </div>
7571: </div>
7572:
7573: <p>Some packages in pkgsrc install headers and libraries
7574: that coincide with headers and libraries present in the
1.14 xtraeme 7575: base system. Aside from a <code class=
7576: "filename">buildlink3.mk</code> file, these packages
7577: should also include a <code class=
7578: "filename">builtin.mk</code> file that includes the
7579: necessary checks to decide whether using the built-in
7580: software or the pkgsrc software is appropriate.</p>
1.1 grant 7581:
7582: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 7583: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 7584:
7585: <div class="orderedlist">
7586: <ol type="1">
7587: <li>
1.14 xtraeme 7588: <p>It should set <code class=
7589: "varname">USE_BUILTIN.<em class=
7590: "replaceable"><code>pkg</code></em></code> to
7591: either “<span class="quote">yes</span>”
7592: or “<span class="quote">no</span>”
7593: after it is included.</p>
1.1 grant 7594: </li>
7595:
7596: <li>
7597: <p>It should <span class=
7598: "emphasis"><em>not</em></span> override any
1.14 xtraeme 7599: <code class="varname">USE_BUILTIN.<em class=
7600: "replaceable"><code>pkg</code></em></code> which is
7601: already set before the <code class=
7602: "filename">builtin.mk</code> file is included.</p>
1.1 grant 7603: </li>
7604:
7605: <li>
7606: <p>It should be written to allow multiple
7607: inclusion. This is <span class=
7608: "emphasis"><em>very</em></span> important and takes
1.14 xtraeme 7609: careful attention to <code class=
7610: "filename">Makefile</code> coding.</p>
1.1 grant 7611: </li>
7612: </ol>
7613: </div>
7614:
7615: <div class="sect2" lang="en" xml:lang="en">
7616: <div class="titlepage">
7617: <div>
7618: <div>
1.30 wiz 7619: <h3 class="title"><a name="anatomy-of-builtin.mk"
7620: id=
7621: "anatomy-of-builtin.mk"></a>10.3.1. Anatomy
7622: of a <code class="filename">builtin.mk</code>
1.14 xtraeme 7623: file</h3>
1.1 grant 7624: </div>
7625: </div>
7626: </div>
7627:
7628: <p>The following is the recommended template for
7629: builtin.mk files:</p>
7630: <pre class="programlisting">
7631: .if !defined(IS_BUILTIN.foo)
7632: #
7633: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
7634: # genuinely exists in the system or not.
7635: #
7636: IS_BUILTIN.foo?= no
7637:
7638: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
7639: # version can be determined.
7640: #
7641: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
7642: BUILTIN_PKG.foo?= foo-1.0
7643: . endif
7644: .endif # IS_BUILTIN.foo
7645:
7646: .if !defined(USE_BUILTIN.foo)
7647: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
7648: . if defined(BUILTIN_PKG.foo)
7649: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
7650: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
7651: USE_BUILTIN.foo!= \
7652: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
7653: ${ECHO} "yes"; \
7654: else \
7655: ${ECHO} "no"; \
7656: fi
7657: . endif
7658: . endfor
7659: . endif
7660: .endif # USE_BUILTIN.foo
7661:
7662: CHECK_BUILTIN.foo?= no
7663: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
7664: #
7665: # Here we place code that depends on whether USE_BUILTIN.foo is set to
7666: # "yes" or "no".
7667: #
7668: .endif # CHECK_BUILTIN.foo
7669:
7670: </pre>
7671:
1.14 xtraeme 7672: <p>The first section sets <code class=
7673: "varname">IS_BUILTIN.<em class=
7674: "replaceable"><code>pkg</code></em></code> depending on
7675: if <em class="replaceable"><code>pkg</code></em> really
7676: exists in the base system. This should not be a base
7677: system software with similar functionality to
7678: <em class="replaceable"><code>pkg</code></em>; it
7679: should only be “<span class=
7680: "quote">yes</span>” if the actual package is
7681: included as part of the base system. This variable is
7682: only used internally within the <code class=
7683: "filename">builtin.mk</code> file.</p>
7684:
7685: <p>The second section sets <code class=
7686: "varname">BUILTIN_PKG.<em class=
7687: "replaceable"><code>pkg</code></em></code> to the
7688: version of <em class=
7689: "replaceable"><code>pkg</code></em> in the base system
7690: if it exists (if <code class=
7691: "varname">IS_BUILTIN.<em class=
7692: "replaceable"><code>pkg</code></em></code> is
1.1 grant 7693: “<span class="quote">yes</span>”). This
1.14 xtraeme 7694: variable is only used internally within the
7695: <code class="filename">builtin.mk</code> file.</p>
1.1 grant 7696:
1.14 xtraeme 7697: <p>The third section sets <code class=
7698: "varname">USE_BUILTIN.<em class=
7699: "replaceable"><code>pkg</code></em></code> and is
7700: <span class="emphasis"><em>required</em></span> in all
7701: <code class="filename">builtin.mk</code> files. The
7702: code in this section must make the determination
7703: whether the built-in software is adequate to satisfy
7704: the dependencies listed in <code class=
7705: "varname">BUILDLINK_DEPENDS.<em class=
7706: "replaceable"><code>pkg</code></em></code>. This is
7707: typically done by comparing <code class=
7708: "varname">BUILTIN_PKG.<em class=
7709: "replaceable"><code>pkg</code></em></code> against each
7710: of the dependencies in <code class=
7711: "varname">BUILDLINK_DEPENDS.<em class=
7712: "replaceable"><code>pkg</code></em></code>.
7713: <code class="varname">USE_BUILTIN.<em class=
7714: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 7715: "emphasis"><em>must</em></span> be set to the correct
1.14 xtraeme 7716: value by the end of the <code class=
7717: "filename">builtin.mk</code> file. Note that
7718: <code class="varname">USE_BUILTIN.<em class=
7719: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 7720: “<span class="quote">yes</span>” even if
1.14 xtraeme 7721: <code class="varname">IS_BUILTIN.<em class=
7722: "replaceable"><code>pkg</code></em></code> is
1.1 grant 7723: “<span class="quote">no</span>” because we
7724: may make the determination that the built-in version of
7725: the software is similar enough to be used as a
7726: replacement.</p>
7727:
1.14 xtraeme 7728: <p>The last section is guarded by <code class=
7729: "varname">CHECK_BUILTIN.<em class=
7730: "replaceable"><code>pkg</code></em></code>, and
7731: includes code that uses the value of <code class=
7732: "varname">USE_BUILTIN.<em class=
7733: "replaceable"><code>pkg</code></em></code> set in the
7734: previous section. This typically includes, e.g., adding
1.1 grant 7735: additional dependency restrictions and listing
1.14 xtraeme 7736: additional files to symlink into <code class=
7737: "filename">${BUILDLINK_DIR}</code> (via <code class=
7738: "varname">BUILDLINK_FILES.<em class=
7739: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 7740: </div>
7741:
7742: <div class="sect2" lang="en" xml:lang="en">
7743: <div class="titlepage">
7744: <div>
7745: <div>
1.30 wiz 7746: <h3 class="title"><a name=
7747: "native-or-pkgsrc-preference" id=
7748: "native-or-pkgsrc-preference"></a>10.3.2. Global
7749: preferences for native or pkgsrc software</h3>
1.1 grant 7750: </div>
7751: </div>
7752: </div>
7753:
7754: <p>When building packages, it's possible to choose
7755: whether to set a global preference for using either the
7756: built-in (native) version or the pkgsrc version of
7757: software to satisfy a dependency. This is controlled by
1.14 xtraeme 7758: setting <code class="varname">PREFER_PKGSRC</code> and
7759: <code class="varname">PREFER_NATIVE</code>. These
7760: variables take values of either “<span class=
1.1 grant 7761: "quote">yes</span>”, “<span class=
7762: "quote">no</span>”, or a list of packages.
1.14 xtraeme 7763: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
7764: to use the pkgsrc versions of software, while
7765: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
7766: to use the built-in versions. Preferences are
7767: determined by the most specific instance of the package
7768: in either <code class="varname">PREFER_PKGSRC</code> or
7769: <code class="varname">PREFER_NATIVE</code>. If a
7770: package is specified in neither or in both variables,
7771: then <code class="varname">PREFER_PKGSRC</code> has
7772: precedence over <code class=
7773: "varname">PREFER_NATIVE</code>. For example, to require
7774: using pkgsrc versions of software for all but the most
7775: basic bits on a NetBSD system, you can set:</p>
1.1 grant 7776: <pre class="programlisting">
7777: PREFER_PKGSRC= yes
7778: PREFER_NATIVE= getopt skey tcp_wrappers
7779:
7780: </pre>
7781:
7782: <p>A package <span class=
1.14 xtraeme 7783: "emphasis"><em>must</em></span> have a <code class=
7784: "filename">builtin.mk</code> file to be listed in
7785: <code class="varname">PREFER_NATIVE</code>, otherwise
7786: it is simply ignored in that list.</p>
1.1 grant 7787: </div>
7788: </div>
7789: </div>
7790:
7791: <div class="chapter" lang="en" xml:lang="en">
7792: <div class="titlepage">
7793: <div>
7794: <div>
7795: <h2 class="title"><a name="options" id=
1.25 rillig 7796: "options"></a>Chapter 11. Options
1.1 grant 7797: handling</h2>
7798: </div>
7799: </div>
7800: </div>
7801:
7802: <div class="toc">
7803: <p><b>Table of Contents</b></p>
7804:
7805: <dl>
1.30 wiz 7806: <dt><span class="sect1"><a href=
7807: "#global-default-options">11.1. Global default
7808: options</a></span></dt>
1.1 grant 7809:
1.30 wiz 7810: <dt><span class="sect1"><a href=
7811: "#converting-to-options">11.2. Converting packages to
7812: use <code class=
1.14 xtraeme 7813: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 7814: </dl>
7815: </div>
7816:
7817: <p>Many packages have the ability to be built to support
1.14 xtraeme 7818: different sets of features. <code class=
7819: "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1 grant 7820: that provides generic handling of those options that
7821: determine different ways in which the packages can be
7822: built. It's possible for the user to specify exactly which
7823: sets of options will be built into a package or to allow a
7824: set of global default options apply.</p>
7825:
7826: <div class="sect1" lang="en" xml:lang="en">
7827: <div class="titlepage">
7828: <div>
7829: <div>
7830: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7831: "global-default-options" id=
7832: "global-default-options"></a>11.1. Global
1.1 grant 7833: default options</h2>
7834: </div>
7835: </div>
7836: </div>
7837:
1.14 xtraeme 7838: <p>Global default options are listed in <code class=
7839: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1 grant 7840: the options that should be built into every package if
7841: that option is supported. This variable should be set in
1.14 xtraeme 7842: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 7843: </div>
7844:
7845: <div class="sect1" lang="en" xml:lang="en">
7846: <div class="titlepage">
7847: <div>
7848: <div>
7849: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7850: "converting-to-options" id=
7851: "converting-to-options"></a>11.2. Converting
7852: packages to use <code class=
1.14 xtraeme 7853: "filename">bsd.options.mk</code></h2>
1.1 grant 7854: </div>
7855: </div>
7856: </div>
7857:
1.14 xtraeme 7858: <p>The following example shows how <code class=
1.27 rillig 7859: "filename">bsd.options.mk</code> should be used by the
7860: hypothetical ``wibble'' package, either in the package
7861: <code class="filename">Makefile</code>, or in a file,
7862: e.g. <code class="filename">options.mk</code>, that is
7863: included by the main package <code class=
1.14 xtraeme 7864: "filename">Makefile</code>.</p>
1.1 grant 7865: <pre class="programlisting">
7866: # Global and legacy options
7867: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
7868: PKG_SUPPORTED_OPTIONS= ldap sasl
1.27 rillig 7869: PKG_SUGGESTED_OPTIONS= sasl
7870: PKG_OPTION_LEGACY_VARS= WIBBLE_USE_OPENLDAP:ldap USE_SASL2:sasl
7871:
1.1 grant 7872: .include "../../mk/bsd.options.mk"
7873:
7874: # Package-specific option-handling
7875:
7876: ###
7877: ### LDAP support
7878: ###
7879: .if !empty(PKG_OPTIONS:Mldap)
7880: . include "../../databases/openldap/buildlink3.mk"
7881: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
7882: .endif
7883:
7884: ###
7885: ### SASL authentication
7886: ###
7887: .if !empty(PKG_OPTIONS:Msasl)
7888: . include "../../security/cyrus-sasl2/buildlink3.mk"
7889: CONFIGURE_ARGS+= --enable-sasl=${BUILDLINK_PREFIX.sasl}
7890: .endif
7891:
7892: </pre>
7893:
1.28 rillig 7894: <p>The first section contains the information about which
7895: build options are supported by the package, and any
1.1 grant 7896: default options settings if needed.</p>
7897:
7898: <div class="orderedlist">
7899: <ol type="1">
7900: <li>
1.14 xtraeme 7901: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 7902: the name of the <a href=
1.1 grant 7903: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7904: <span class="citerefentry"><span class=
1.27 rillig 7905: "refentrytitle">make</span>(1)</span></a> variable
7906: that contains the options the user wishes to
7907: select. The recommended value is
7908: “<span class="quote">PKG_OPTIONS.<em class=
1.14 xtraeme 7909: "replaceable"><code>pkg</code></em></span>”
7910: but any package-specific value may be used. This
1.1 grant 7911: variable should be set in a package Makefile.</p>
7912: </li>
7913:
7914: <li>
1.14 xtraeme 7915: <p><code class=
7916: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
7917: build options supported by the package. This
7918: variable should be set in a package Makefile.</p>
1.1 grant 7919: </li>
7920:
7921: <li>
1.27 rillig 7922: <p><code class=
7923: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
7924: build options which are enabled by default.</p>
7925: </li>
7926:
7927: <li>
1.14 xtraeme 7928: <p><code class="varname">${PKG_OPTIONS_VAR}</code>
1.27 rillig 7929: (the variable named in <code class=
7930: "varname">PKG_OPTIONS_VAR</code>) lists the
7931: selected build options and overrides any default
7932: options given in <code class=
1.14 xtraeme 7933: "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1 grant 7934: options begin with a “<span class=
7935: "quote">-</span>”, then that option is always
7936: removed from the selected build options, e.g.</p>
7937: <pre class="programlisting">
7938: PKG_DEFAULT_OPTIONS= kerberos ldap sasl
7939: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
7940: WIBBLE_OPTIONS= ${PKG_DEFAULT_OPTIONS} -sasl
1.28 rillig 7941: # leads to PKG_OPTIONS = kerberos ldap
1.1 grant 7942:
7943: </pre>
7944:
7945: <p>or</p>
7946: <pre class="programlisting">
7947: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
7948: WIBBLE_OPTIONS= kerberos -ldap ldap
1.28 rillig 7949: # leads to PKG_OPTIONS = kerberos
1.1 grant 7950:
7951: </pre>
7952:
1.14 xtraeme 7953: <p>This variable should be set in <code class=
7954: "filename">/etc/mk.conf</code>.</p>
1.1 grant 7955: </li>
7956:
7957: <li>
1.28 rillig 7958: <p>The <code class=
7959: "varname">PKG_OPTIONS_LEGACY_VARS</code> is only
7960: needed if you are converting a package that had its
7961: own ad-hoc options handling to use <code class=
7962: "filename">bsd.options.mk</code>. It converts
7963: global or legacy options variables into an
7964: equivalent <code class=
7965: "varname">PKG_OPTIONS.<em class=
7966: "replaceable"><code>pkg</code></em></code>
7967: value.</p>
1.1 grant 7968: </li>
1.28 rillig 7969: </ol>
1.1 grant 7970: </div>
7971:
1.28 rillig 7972: <p>After the inclusion of bsd.options.mk, the variable
7973: <code class="varname">PKG_OPTIONS</code> contains the
7974: list of the selected build options, properly filtered to
7975: remove unsupported and duplicate options.</p>
7976:
1.1 grant 7977: <p>The remaining sections contain the logic that is
7978: specific to each option. There should be a check for
1.14 xtraeme 7979: every option listed in <code class=
7980: "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
7981: be clear documentation on what turning on the option will
7982: do in the comments preceding each section. The correct
7983: way to check for an option is to check whether it is
7984: listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1 grant 7985: </div>
7986: </div>
7987:
7988: <div class="chapter" lang="en" xml:lang="en">
7989: <div class="titlepage">
7990: <div>
7991: <div>
7992: <h2 class="title"><a name="build" id=
1.25 rillig 7993: "build"></a>Chapter 12. The build
1.1 grant 7994: process</h2>
7995: </div>
7996: </div>
7997: </div>
7998:
7999: <div class="toc">
8000: <p><b>Table of Contents</b></p>
8001:
8002: <dl>
1.25 rillig 8003: <dt><span class="sect1"><a href="#build.prefix">12.1.
1.1 grant 8004: Program location</a></span></dt>
8005:
1.30 wiz 8006: <dt><span class="sect1"><a href="#main-targets">12.2.
8007: Main targets</a></span></dt>
1.1 grant 8008:
8009: <dt><span class="sect1"><a href=
1.25 rillig 8010: "#build.helpful-targets">12.3. Other helpful
1.1 grant 8011: targets</a></span></dt>
8012: </dl>
8013: </div>
8014:
8015: <p>The basic steps for building a program are always the
8016: same. First the program's source (<span class=
8017: "emphasis"><em>distfile</em></span>) must be brought to the
8018: local system and then extracted. After any patches to
8019: compile properly on NetBSD are applied, the software can be
8020: configured, then built (usually by compiling), and finally
8021: the generated binaries, etc. can be put into place on the
8022: system. These are exactly the steps performed by the NetBSD
8023: package system, which is implemented as a series of targets
1.14 xtraeme 8024: in a central Makefile, <code class=
8025: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 8026:
8027: <div class="sect1" lang="en" xml:lang="en">
8028: <div class="titlepage">
8029: <div>
8030: <div>
8031: <h2 class="title" style="clear: both"><a name=
8032: "build.prefix" id=
1.25 rillig 8033: "build.prefix"></a>12.1. Program location</h2>
1.1 grant 8034: </div>
8035: </div>
8036: </div>
8037:
8038: <p>Before outlining the process performed by the NetBSD
8039: package system in the next section, here's a brief
8040: discussion on where programs are installed, and which
8041: variables influence this.</p>
8042:
1.14 xtraeme 8043: <p>The automatic variable <code class=
8044: "varname">PREFIX</code> indicates where all files of the
8045: final program shall be installed. It is usually set to
8046: <code class="varname">LOCALBASE</code> (<code class=
8047: "filename">/usr/pkg</code>), or <code class=
8048: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 8049: “<span class="quote">cross</span>” category.
1.14 xtraeme 8050: The value of <code class="varname">PREFIX</code> needs to
8051: be put into the various places in the program's source
8052: where paths to these files are encoded. See <a href=
1.1 grant 8053: "#components.patches" title=
1.27 rillig 8054: "7.3. patches/*">Section 7.3,
1.1 grant 8055: “patches/*”</a> and <a href="#fixes.libtool"
8056: title=
1.25 rillig 8057: "13.3.1. Shared libraries - libtool">Section 13.3.1,
1.1 grant 8058: “Shared libraries - libtool”</a> for more
8059: details.</p>
8060:
8061: <p>When choosing which of these variables to use, follow
8062: the following rules:</p>
8063:
8064: <div class="itemizedlist">
8065: <ul type="disc">
8066: <li>
1.14 xtraeme 8067: <p><code class="varname">PREFIX</code> always
8068: points to the location where the current pkg will
8069: be installed. When referring to a pkg's own
1.1 grant 8070: installation path, use “<span class=
8071: "quote">${PREFIX}</span>”.</p>
8072: </li>
8073:
8074: <li>
1.14 xtraeme 8075: <p><code class="varname">LOCALBASE</code> is where
8076: all non-X11 pkgs are installed. If you need to
1.1 grant 8077: construct a -I or -L argument to the compiler to
8078: find includes and libraries installed by another
8079: non-X11 pkg, use “<span class=
8080: "quote">${LOCALBASE}</span>”.</p>
8081: </li>
8082:
8083: <li>
1.14 xtraeme 8084: <p><code class="varname">X11BASE</code> is where
8085: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 8086: installed. When looking for <span class=
8087: "emphasis"><em>standard</em></span> X11 includes
8088: (not those installed by a pkg), use
8089: “<span class=
8090: "quote">${X11BASE}</span>”.</p>
8091: </li>
8092:
8093: <li>
8094: <p>X11 based are special in that they may be
1.14 xtraeme 8095: installed in either <code class=
8096: "varname">X11BASE</code> or <code class=
8097: "varname">LOCALBASE</code>.</p>
1.1 grant 8098:
8099: <p>Usually, X11 packages should be installed under
1.14 xtraeme 8100: <code class="varname">LOCALBASE</code> whenever
1.34 ! wiz 8101: possible. Note that you will need to include
! 8102: <code class=
! 8103: "filename">../../mk/x11.buildlink3.mk</code> in
! 8104: them to request the presence of X11 and to get the
! 8105: right compilation flags.</p>
1.1 grant 8106:
8107: <p>Even though, there are some packages that cannot
1.14 xtraeme 8108: be installed under <code class=
8109: "varname">LOCALBASE</code>: those that come with
1.1 grant 8110: app-defaults files. These packages are special and
1.14 xtraeme 8111: they must be placed under <code class=
8112: "varname">X11BASE</code>. To accomplish this, set
8113: either <code class="varname">USE_X11BASE</code> or
8114: <code class="varname">USE_IMAKE</code> in your
1.1 grant 8115: package.</p>
8116:
1.34 ! wiz 8117: <p>Some notes: If you need to find includes or
1.14 xtraeme 8118: libraries installed by a pkg that has <code class=
8119: "varname">USE_IMAKE</code> or <code class=
8120: "varname">USE_X11BASE</code> in its pkg
8121: <code class="filename">Makefile</code>, you need to
1.34 ! wiz 8122: look in <span class="emphasis"><em>both</em></span>
1.14 xtraeme 8123: <code class="filename">${X11BASE}</code> and
8124: <code class="filename">${LOCALBASE}</code>. To
8125: force installation of all X11 packages in
8126: <code class="varname">LOCALBASE</code>, the
8127: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8128: href=
1.1 grant 8129: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.34 ! wiz 8130: class="pkgname">pkgtools/xpkgwedge</a> package is
! 8131: enabled by default.</p>
1.1 grant 8132: </li>
8133:
8134: <li>
1.14 xtraeme 8135: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 8136: used to refer to the installed location of an X11
1.14 xtraeme 8137: package. <code class="varname">X11PREFIX</code>
8138: will be set to <code class="varname">X11BASE</code>
8139: if xpkgwedge is not installed, and to <code class=
8140: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 8141: installed.</p>
8142: </li>
8143:
8144: <li>
8145: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 8146: have some packages installed in <code class=
8147: "varname">X11BASE</code> and some in <code class=
8148: "varname">LOCALBASE</code>. To determine the prefix
8149: of an installed package, the <code class=
8150: "varname">EVAL_PREFIX</code> definition can be
8151: used. It takes pairs in the format
8152: “<span class=
1.1 grant 8153: "quote">DIRNAME=<package></span>”, and
1.24 wiz 8154: the <a href=
8155: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8156: <span class="citerefentry"><span class=
8157: "refentrytitle">make</span>(1)</span></a> variable
8158: <code class="varname">DIRNAME</code> will be set to
8159: the prefix of the installed package
8160: <package>, or “<span class=
1.1 grant 8161: "quote">${X11PREFIX}</span>” if the package
8162: is not installed.</p>
8163:
8164: <p>This is best illustrated by example.</p>
8165:
1.14 xtraeme 8166: <p>The following lines are taken from <code class=
8167: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 8168: <pre class="programlisting">
1.14 xtraeme 8169: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 8170: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
8171: --with-gtk-prefix="${GTKDIR}" \
8172: --enable-multibyte
8173: </pre>
8174:
8175: <p>Specific defaults can be defined for the
1.14 xtraeme 8176: packages evaluated using <code class=
8177: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 8178: of the form:</p>
8179: <pre class="programlisting">
8180: GTKDIR_DEFAULT= ${LOCALBASE}
8181: </pre>
8182:
1.14 xtraeme 8183: <p>where <code class="varname">GTKDIR</code>
1.1 grant 8184: corresponds to the first definition in the
1.14 xtraeme 8185: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 8186: </li>
8187:
8188: <li>
1.14 xtraeme 8189: <p>Within <code class="filename">${PREFIX}</code>,
1.24 wiz 8190: packages should install files according to <a href=
8191: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
8192: <span class="citerefentry"><span class=
8193: "refentrytitle">hier</span>(7)</span></a>, with the
8194: exception that manual pages go into <code class=
8195: "filename">${PREFIX}/man</code>, not <code class=
1.14 xtraeme 8196: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 8197: </li>
8198: </ul>
8199: </div>
8200: </div>
8201:
8202: <div class="sect1" lang="en" xml:lang="en">
8203: <div class="titlepage">
8204: <div>
8205: <div>
8206: <h2 class="title" style="clear: both"><a name=
1.30 wiz 8207: "main-targets" id=
8208: "main-targets"></a>12.2. Main targets</h2>
1.1 grant 8209: </div>
8210: </div>
8211: </div>
8212:
8213: <p>The main targets used during the build process defined
1.14 xtraeme 8214: in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 8215:
8216: <div class="variablelist">
8217: <dl>
8218: <dt><span class="term">fetch</span></dt>
8219:
8220: <dd>
8221: <p>This will check if the file(s) given in the
1.14 xtraeme 8222: variables <code class="varname">DISTFILES</code>
8223: and <code class="varname">PATCHFILES</code> (as
8224: defined in the package's Makefile) are present on
8225: the local system in <code class=
8226: "filename">/usr/pkgsrc/distfiles</code>. If they
8227: are not present, an attempt will be made to fetch
8228: them using commands of the form:</p>
1.1 grant 8229: <pre class="programlisting">
8230: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
8231: </pre>
8232:
8233: <p>where ${site} varies through several
1.14 xtraeme 8234: possibilities in turn: first, <code class=
8235: "varname">MASTER_SITE_OVERRIDE</code> is tried,
8236: then the sites specified in either <code class=
8237: "varname">SITES_file</code> if defined, else
8238: <code class="varname">MASTER_SITES</code> or
8239: <code class="varname">PATCH_SITES</code>, as
8240: applies, then finally the value of <code class=
8241: "varname">MASTER_SITE_BACKUP</code>. The order of
8242: all except the first can be optionally sorted by
8243: the user, via setting either <code class=
8244: "varname">MASTER_SORT_AWK</code> or <code class=
8245: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 8246: </dd>
8247:
8248: <dt><span class="term">checksum</span></dt>
8249:
8250: <dd>
8251: <p>After the distfile(s) are fetched, their
8252: checksum is generated and compared with the
8253: checksums stored in the distinfo file. If the
8254: checksums don't match, the build is aborted. This
8255: is to ensure the same distfile is used for
8256: building, and that the distfile wasn't changed,
8257: e.g. by some malign force, deliberately changed
8258: distfiles on the master distribution site or
8259: network lossage.</p>
8260: </dd>
8261:
8262: <dt><span class="term">extract</span></dt>
8263:
8264: <dd>
8265: <p>When the distfiles are present on the local
8266: system, they need to be extracted, as they are
8267: usually in the form of some compressed archive
1.14 xtraeme 8268: format, most commonly <code class=
8269: "filename">.tar.gz</code>.</p>
1.1 grant 8270:
8271: <p>If only some of the distfiles need to be
8272: uncompressed, the files to be uncompressed should
1.14 xtraeme 8273: be put into <code class=
8274: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 8275:
1.14 xtraeme 8276: <p>If the distfiles are not in <code class=
8277: "filename">.tar.gz</code> format, they can be
8278: extracted by setting either <code class=
8279: "varname">EXTRACT_SUFX</code>, or <code class=
8280: "varname">EXTRACT_CMD</code>, <code class=
8281: "varname">EXTRACT_BEFORE_ARGS</code> and
8282: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
8283: the former case, pkgsrc knows how to extract a
8284: number of suffixes (<code class=
8285: "filename">.tar.gz</code>, <code class=
8286: "filename">.tgz</code>, <code class=
8287: "filename">.tar.gz2</code>, <code class=
8288: "filename">.tbz</code>, <code class=
8289: "filename">.tar.Z</code>, <code class=
8290: "filename">.tar</code>, <code class=
8291: "filename">.shar.gz</code>, <code class=
8292: "filename">.shar.bz2</code>, <code class=
8293: "filename">.shar.Z</code>, <code class=
8294: "filename">.shar</code>, <code class=
8295: "filename">.Z</code>, <code class=
8296: "filename">.bz2</code> and <code class=
8297: "filename">.gz</code>; see the definition of the
8298: various <code class="varname">DECOMPRESS_CMD</code>
8299: variables <code class="filename">bsd.pkg.mk</code>
8300: for a complete list). Here's an example on how to
8301: use the other variables for a program that comes
8302: with a compressed shell archive whose name ends in
8303: <code class="filename">.msg.gz</code>:</p>
1.1 grant 8304: <pre class="programlisting">
8305: EXTRACT_SUFX= .msg.gz
8306: EXTRACT_CMD= zcat
8307: EXTRACT_BEFORE_ARGS=
8308: EXTRACT_AFTER_ARGS= |sh
8309: </pre>
8310: </dd>
8311:
8312: <dt><span class="term">patch</span></dt>
8313:
8314: <dd>
8315: <p>After extraction, all the patches named by the
1.14 xtraeme 8316: <code class="varname">PATCHFILES</code>, those
8317: present in the patches subdirectory of the package
8318: as well as in $LOCALPATCHES/$PKGPATH (e.g.
8319: <code class=
8320: "filename">/usr/local/patches/graphics/png</code>)
8321: are applied. Patchfiles ending in <code class=
8322: "filename">.Z</code> or <code class=
8323: "filename">.gz</code> are uncompressed before they
8324: are applied, files ending in <code class=
8325: "filename">.orig</code> or <code class=
8326: "filename">.rej</code> are ignored. Any special
1.24 wiz 8327: options to <a href=
8328: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
8329: <span class="citerefentry"><span class=
8330: "refentrytitle">patch</span>(1)</span></a> can be
8331: handed in <code class=
1.14 xtraeme 8332: "varname">PATCH_DIST_ARGS</code>. See <a href=
8333: "#components.patches" title=
1.27 rillig 8334: "7.3. patches/*">Section 7.3,
1.1 grant 8335: “patches/*”</a> for more details.</p>
8336:
1.24 wiz 8337: <p>By default <a href=
8338: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
8339: <span class="citerefentry"><span class=
8340: "refentrytitle">patch</span>(1)</span></a> is given
8341: special args to make it fail if the patches apply
8342: with some lines of fuzz. Please fix (regen) the
8343: patches so that they apply cleanly. The rationale
8344: behind this is that patches that don't apply
8345: cleanly may end up being applied in the wrong
8346: place, and cause severe harm there.</p>
1.1 grant 8347: </dd>
8348:
8349: <dt><span class="term">configure</span></dt>
8350:
8351: <dd>
8352: <p>Most pieces of software need information on the
8353: header files, system calls, and library routines
8354: which are available in NetBSD. This is the process
8355: known as configuration, and is usually automated.
8356: In most cases, a script is supplied with the
8357: source, and its invocation results in generation of
8358: header files, Makefiles, etc.</p>
8359:
8360: <p>If the program's distfile contains its own
8361: configure script, this can be invoked by setting
1.14 xtraeme 8362: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 8363: configure script is a GNU autoconf script,
1.14 xtraeme 8364: <code class="varname">GNU_CONFIGURE</code> should
8365: be specified instead. In either case, any arguments
8366: to the configure script can be specified in the
8367: <code class="varname">CONFIGURE_ARGS</code>
8368: variable, and the configure script's name can be
8369: set in <code class=
8370: "varname">CONFIGURE_SCRIPT</code> if it differs
8371: from the default “<span class=
1.1 grant 8372: "quote">configure</span>”. Here's an example
8373: from the <a xmlns=
8374: "http://www.w3.org/TR/xhtml1/transitional" href=
8375: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20 ben 8376: class="pkgname">sysutils/top</a> package:</p>
1.1 grant 8377: <pre class="programlisting">
8378: HAS_CONFIGURE= yes
8379: CONFIGURE_SCRIPT= Configure
8380: CONFIGURE_ARGS+= netbsd13
8381: </pre>
8382:
8383: <p>If the program uses an Imakefile for
8384: configuration, the appropriate steps can be invoked
1.14 xtraeme 8385: by setting <code class="varname">USE_IMAKE</code>
8386: to “<span class="quote">YES</span>”.
8387: (If you only want the package installed in
8388: <code class="varname">$X11PREFIX</code> but xmkmf
8389: not being run, set <code class=
8390: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 8391: </dd>
8392:
8393: <dt><span class="term">build</span></dt>
8394:
8395: <dd>
8396: <p>Once configuration has taken place, the software
1.14 xtraeme 8397: will be built by invoking <code class=
8398: "varname">$MAKE_PROGRAM</code> on <code class=
8399: "varname">$MAKEFILE</code> with <code class=
8400: "varname">$BUILD_TARGET</code> as the target to
8401: build. The default <code class=
8402: "varname">MAKE_PROGRAM</code> is
8403: “<span class="quote">gmake</span>” if
1.29 rillig 8404: <code class="varname">USE_TOOLS</code> contains
8405: “<span class="quote">gmake</span>”,
1.1 grant 8406: “<span class="quote">make</span>”
1.14 xtraeme 8407: otherwise. <code class="varname">MAKEFILE</code> is
8408: set to “<span class=
1.1 grant 8409: "quote">Makefile</span>” by default, and
1.14 xtraeme 8410: <code class="varname">BUILD_TARGET</code> defaults
8411: to “<span class="quote">all</span>”.
8412: Any of these variables can be set in the package's
1.1 grant 8413: Makefile to change the default build process.</p>
8414: </dd>
8415:
8416: <dt><span class="term">install</span></dt>
8417:
8418: <dd>
8419: <p>Once the build stage has completed, the final
8420: step is to install the software in public
8421: directories, so users can access the programs and
1.14 xtraeme 8422: files. As in the build-target, <code class=
8423: "varname">$MAKE_PROGRAM</code> is invoked on
8424: <code class="varname">$MAKEFILE</code> here, but
8425: with the <code class=
8426: "varname">$INSTALL_TARGET</code> instead, the
8427: latter defaulting to “<span class=
8428: "quote">install</span>” (plus
8429: “<span class=
8430: "quote">install.man</span>”, if <code class=
8431: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 8432: </dd>
8433: </dl>
8434: </div>
8435:
8436: <p>If no target is specified, the default is
8437: “<span class="quote">build</span>”. If a
8438: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 8439: e.g. <span><strong class="command">make
8440: build</strong></span> will also perform the equivalent
8441: of:</p>
1.1 grant 8442: <pre class="programlisting">
8443: make fetch
8444: make checksum
8445: make extract
8446: make patch
8447: make configure
8448: make build
8449: </pre>
8450: </div>
8451:
8452: <div class="sect1" lang="en" xml:lang="en">
8453: <div class="titlepage">
8454: <div>
8455: <div>
8456: <h2 class="title" style="clear: both"><a name=
8457: "build.helpful-targets" id=
1.25 rillig 8458: "build.helpful-targets"></a>12.3. Other
1.1 grant 8459: helpful targets</h2>
8460: </div>
8461: </div>
8462: </div>
8463:
8464: <div class="variablelist">
8465: <dl>
8466: <dt><span class="term">pre/post-*</span></dt>
8467:
8468: <dd>
8469: <p>For any of the main targets described in the
8470: previous section, two auxiliary targets exist with
8471: “<span class="quote">pre-</span>” and
8472: “<span class="quote">post-</span>” used
8473: as a prefix for the main target's name. These
8474: targets are invoked before and after the main
8475: target is called, allowing extra configuration or
8476: installation steps be performed from a package's
8477: Makefile, for example, which a program's configure
8478: script or install target omitted.</p>
8479: </dd>
8480:
8481: <dt><span class="term">do-*</span></dt>
8482:
8483: <dd>
8484: <p>Should one of the main targets do the wrong
8485: thing, and should there be no variable to fix this,
8486: you can redefine it with the do-* target. (Note
8487: that redefining the target itself instead of the
8488: do-* target is a bad idea, as the pre-* and post-*
8489: targets won't be called anymore, etc.) You will not
8490: usually need to do this.</p>
8491: </dd>
8492:
8493: <dt><span class="term">reinstall</span></dt>
8494:
8495: <dd>
1.14 xtraeme 8496: <p>If you did a <span><strong class="command">make
8497: install</strong></span> and you noticed some file
8498: was not installed properly, you can repeat the
1.1 grant 8499: installation with this target, which will ignore
8500: the “<span class="quote">already
8501: installed</span>” flag.</p>
8502: </dd>
8503:
8504: <dt><span class="term">deinstall</span></dt>
8505:
8506: <dd>
1.24 wiz 8507: <p>This target does a <a href=
8508: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8509: <span class="citerefentry"><span class=
8510: "refentrytitle">pkg_delete</span>(1)</span></a> in
8511: the current directory, effectively de-installing
8512: the package. The following variables can be used to
8513: tune the behaviour:</p>
1.1 grant 8514:
8515: <div class="variablelist">
8516: <dl>
1.14 xtraeme 8517: <dt><span class="term"><code class=
8518: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 8519:
8520: <dd>
8521: <p>Add a "-v" to the <a href=
8522: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8523: <span class="citerefentry"><span class=
8524: "refentrytitle">pkg_delete</span>(1)</span></a>
8525: command.</p>
8526: </dd>
8527:
1.14 xtraeme 8528: <dt><span class="term"><code class=
8529: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 8530:
8531: <dd>
8532: <p>Remove all packages that require (depend
8533: on) the given package. This can be used to
8534: remove any packages that may have been pulled
8535: in by a given package, e.g. if
1.14 xtraeme 8536: <span><strong class="command">make deinstall
8537: DEINSTALLDEPENDS=1</strong></span> is done in
8538: <code class="filename">pkgsrc/x11/kde</code>,
1.1 grant 8539: this is likely to remove whole KDE. Works by
8540: adding “<span class=
8541: "quote">-R</span>” to the <a href=
8542: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8543: <span class="citerefentry"><span class=
8544: "refentrytitle">pkg_delete</span>(1)</span></a>
8545: command line.</p>
8546: </dd>
8547: </dl>
8548: </div>
8549: </dd>
8550:
8551: <dt><span class="term">update</span></dt>
8552:
8553: <dd>
8554: <p>This target causes the current package to be
8555: updated to the latest version. The package and all
8556: depending packages first get de-installed, then
8557: current versions of the corresponding packages get
8558: compiled and installed. This is similar to manually
8559: noting which packages are currently installed, then
1.14 xtraeme 8560: performing a series of <span><strong class=
8561: "command">make deinstall</strong></span> and
8562: <span><strong class="command">make
8563: install</strong></span> (or whatever <code class=
8564: "varname">UPDATE_TARGET</code> is set to) for these
8565: packages.</p>
1.1 grant 8566:
8567: <p>You can use the “<span class=
8568: "quote">update</span>” target to resume
1.14 xtraeme 8569: package updating in case a previous
8570: <span><strong class="command">make
8571: update</strong></span> was interrupted for some
8572: reason. However, in this case, make sure you don't
8573: call <span><strong class="command">make
8574: clean</strong></span> or otherwise remove the list
8575: of dependent packages in <code class=
8576: "varname">WRKDIR</code>. Otherwise you lose the
1.1 grant 8577: ability to automatically update the current package
8578: along with the dependent packages you have
8579: installed.</p>
8580:
1.14 xtraeme 8581: <p>Resuming an interrupted <span><strong class=
8582: "command">make update</strong></span> will only
8583: work as long as the package tree remains unchanged.
8584: If the source code for one of the packages to be
8585: updated has been changed, resuming
8586: <span><strong class="command">make
8587: update</strong></span> will most certainly
8588: fail!</p>
1.1 grant 8589:
8590: <p>The following variables can be used either on
1.14 xtraeme 8591: the command line or in <code class=
8592: "filename">/etc/mk.conf</code> to alter the
8593: behaviour of <span><strong class="command">make
8594: update</strong></span>:</p>
1.1 grant 8595:
8596: <div class="variablelist">
8597: <dl>
1.14 xtraeme 8598: <dt><span class="term"><code class=
8599: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 8600:
8601: <dd>
8602: <p>Install target to recursively use for the
8603: updated package and the dependent packages.
1.14 xtraeme 8604: Defaults to <code class=
8605: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 8606: “<span class=
8607: "quote">install</span>” otherwise for
1.14 xtraeme 8608: <span><strong class="command">make
8609: update</strong></span>. e.g.
8610: <span><strong class="command">make update
8611: UPDATE_TARGET=package</strong></span></p>
1.1 grant 8612: </dd>
8613:
1.14 xtraeme 8614: <dt><span class="term"><code class=
8615: "varname">NOCLEAN</code></span></dt>
1.1 grant 8616:
8617: <dd>
8618: <p>Don't clean up after updating. Useful if
8619: you want to leave the work sources of the
8620: updated packages around for inspection or
8621: other purposes. Be sure you eventually clean
8622: up the source tree (see the
8623: “<span class=
8624: "quote">clean-update</span>” target
8625: below) or you may run into troubles with old
8626: source code still lying around on your next
1.14 xtraeme 8627: <span><strong class=
8628: "command">make</strong></span> or
8629: <span><strong class="command">make
8630: update</strong></span>.</p>
1.1 grant 8631: </dd>
8632:
1.14 xtraeme 8633: <dt><span class="term"><code class=
8634: "varname">REINSTALL</code></span></dt>
1.1 grant 8635:
8636: <dd>
8637: <p>Deinstall each package before installing
1.14 xtraeme 8638: (making <code class=
8639: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 8640: necessary if the “<span class=
8641: "quote">clean-update</span>” target
8642: (see below) was called after interrupting a
1.14 xtraeme 8643: running <span><strong class="command">make
8644: update</strong></span>.</p>
1.1 grant 8645: </dd>
8646:
1.14 xtraeme 8647: <dt><span class="term"><code class=
8648: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 8649:
8650: <dd>
8651: <p>Allows you to disable recursion and
8652: hardcode the target for packages. The default
8653: is “<span class=
8654: "quote">update</span>” for the update
8655: target, facilitating a recursive update of
1.14 xtraeme 8656: prerequisite packages. Only set <code class=
8657: "varname">DEPENDS_TARGET</code> if you want
8658: to disable recursive updates. Use
8659: <code class="varname">UPDATE_TARGET</code>
8660: instead to just set a specific target for
8661: each package to be installed during
8662: <span><strong class="command">make
8663: update</strong></span> (see above).</p>
1.1 grant 8664: </dd>
8665: </dl>
8666: </div>
8667: </dd>
8668:
8669: <dt><span class="term">clean-update</span></dt>
8670:
8671: <dd>
8672: <p>Clean the source tree for all packages that
1.14 xtraeme 8673: would get updated if <span><strong class=
8674: "command">make update</strong></span> was called
8675: from the current directory. This target should not
8676: be used if the current package (or any of its
8677: depending packages) have already been de-installed
8678: (e.g., after calling <span><strong class=
8679: "command">make update</strong></span>) or you may
8680: lose some packages you intended to update. As a
8681: rule of thumb: only use this target <span class=
8682: "emphasis"><em>before</em></span> the first time
8683: you run <span><strong class="command">make
8684: update</strong></span> and only if you have a dirty
8685: package tree (e.g., if you used <code class=
8686: "varname">NOCLEAN</code>).</p>
1.1 grant 8687:
8688: <p>If you unsure about whether your tree is clean
1.14 xtraeme 8689: you can either perform a <span><strong class=
8690: "command">make clean</strong></span> at the top of
8691: the tree, or use the following sequence of commands
1.1 grant 8692: from the directory of the package you want to
8693: update (<span class=
8694: "emphasis"><em>before</em></span> running
1.14 xtraeme 8695: <span><strong class="command">make
8696: update</strong></span> for the first time,
8697: otherwise you lose all the packages you wanted to
8698: update!):</p>
1.1 grant 8699: <pre class="screen">
1.14 xtraeme 8700: <code class="prompt">#</code> <strong class=
8701: "userinput"><code>make clean-update</code></strong>
8702: <code class="prompt">#</code> <strong class=
8703: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
8704: <code class="prompt">#</code> <strong class=
8705: "userinput"><code>make update</code></strong>
1.1 grant 8706: </pre>
8707:
8708: <p>The following variables can be used either on
1.14 xtraeme 8709: the command line or in <code class=
8710: "filename">/etc/mk.conf</code> to alter the
8711: behaviour of <span><strong class="command">make
8712: clean-update</strong></span>:</p>
1.1 grant 8713:
8714: <div class="variablelist">
8715: <dl>
1.14 xtraeme 8716: <dt><span class="term"><code class=
8717: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 8718:
8719: <dd>
1.14 xtraeme 8720: <p>After <span><strong class="command">make
8721: clean</strong></span>, do not reconstruct the
8722: list of directories to update for this
8723: package. Only use this if
8724: <span><strong class="command">make
8725: update</strong></span> successfully installed
8726: all packages you wanted to update. Normally,
8727: this is done automatically on
8728: <span><strong class="command">make
8729: update</strong></span>, but may have been
8730: suppressed by the <code class=
8731: "varname">NOCLEAN</code> variable (see
1.1 grant 8732: above).</p>
8733: </dd>
8734: </dl>
8735: </div>
8736: </dd>
8737:
8738: <dt><span class="term">info</span></dt>
8739:
8740: <dd>
8741: <p>This target invokes <a href=
8742: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
8743: <span class="citerefentry"><span class=
8744: "refentrytitle">pkg_info</span>(1)</span></a> for
8745: the current package. You can use this to check
8746: which version of a package is installed.</p>
8747: </dd>
8748:
8749: <dt><span class="term">readme</span></dt>
8750:
8751: <dd>
1.14 xtraeme 8752: <p>This target generates a <code class=
8753: "filename">README.html</code> file, which can be
1.1 grant 8754: viewed using a browser such as <a xmlns=
8755: "http://www.w3.org/TR/xhtml1/transitional" href=
8756: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 8757: class="pkgname">www/mozilla</a> or <a xmlns=
8758: "http://www.w3.org/TR/xhtml1/transitional" href=
8759: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
8760: class="pkgname">www/links</a>. The generated files
8761: contain references to any packages which are in the
8762: <code class="varname">PACKAGES</code> directory on
8763: the local host. The generated files can be made to
8764: refer to URLs based on <code class=
8765: "varname">FTP_PKG_URL_HOST</code> and <code class=
8766: "varname">FTP_PKG_URL_DIR</code>. For example, if I
8767: wanted to generate <code class=
8768: "filename">README.html</code> files which pointed
8769: to binary packages on the local machine, in the
8770: directory <code class=
8771: "filename">/usr/packages</code>, set <code class=
8772: "varname">FTP_PKG_URL_HOST=file://localhost</code>
8773: and <code class=
8774: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
8775: <code class="varname">${PACKAGES}</code> directory
8776: and its subdirectories will be searched for all the
8777: binary packages.</p>
1.1 grant 8778: </dd>
8779:
8780: <dt><span class="term">readme-all</span></dt>
8781:
8782: <dd>
1.14 xtraeme 8783: <p>Use this target to create a file <code class=
8784: "filename">README-all.html</code> which contains a
1.1 grant 8785: list of all packages currently available in the
8786: NetBSD Packages Collection, together with the
8787: category they belong to and a short description.
1.14 xtraeme 8788: This file is compiled from the <code class=
8789: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 8790: sure to run this <span class=
1.14 xtraeme 8791: "emphasis"><em>after</em></span> a
8792: <span><strong class="command">make
8793: readme</strong></span>.</p>
1.1 grant 8794: </dd>
8795:
8796: <dt><span class="term">cdrom-readme</span></dt>
8797:
8798: <dd>
8799: <p>This is very much the same as the
8800: “<span class="quote">readme</span>”
8801: target (see above), but is to be used when
8802: generating a pkgsrc tree to be written to a CD-ROM.
1.14 xtraeme 8803: This target also produces <code class=
8804: "filename">README.html</code> files, and can be
8805: made to refer to URLs based on <code class=
8806: "varname">CDROM_PKG_URL_HOST</code> and
8807: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 8808: </dd>
8809:
8810: <dt><span class="term">show-distfiles</span></dt>
8811:
8812: <dd>
8813: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 8814: are needed to build the package. (<code class=
8815: "varname">DISTFILES</code> and <code class=
8816: "varname">PATCHFILES</code>, but not <code class=
8817: "filename">patches/*</code>)</p>
1.1 grant 8818: </dd>
8819:
8820: <dt><span class="term">show-downlevel</span></dt>
8821:
8822: <dd>
8823: <p>This target shows nothing if the package is not
8824: installed. If a version of this package is
8825: installed, but is not the version provided in this
8826: version of pkgsrc, then a warning message is
8827: displayed. This target can be used to show which of
8828: your installed packages are downlevel, and so the
8829: old versions can be deleted, and the current ones
8830: added.</p>
8831: </dd>
8832:
8833: <dt><span class="term">show-pkgsrc-dir</span></dt>
8834:
8835: <dd>
8836: <p>This target shows the directory in the pkgsrc
8837: hierarchy from which the package can be built and
8838: installed. This may not be the same directory as
8839: the one from which the package was installed. This
8840: target is intended to be used by people who may
8841: wish to upgrade many packages on a single host, and
8842: can be invoked from the top-level pkgsrc Makefile
8843: by using the “<span class=
8844: "quote">show-host-specific-pkgs</span>”
8845: target.</p>
8846: </dd>
8847:
8848: <dt><span class=
8849: "term">show-installed-depends</span></dt>
8850:
8851: <dd>
8852: <p>This target shows which installed packages match
1.14 xtraeme 8853: the current package's <code class=
8854: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 8855: dependencies are causing build problems.</p>
8856: </dd>
8857:
8858: <dt><span class="term">check-shlibs</span></dt>
8859:
8860: <dd>
8861: <p>After a package is installed, check all its
8862: binaries and (on ELF platforms) shared libraries to
8863: see if they find the shared libs they need. Run by
1.14 xtraeme 8864: default if <code class=
8865: "varname">PKG_DEVELOPER</code> is set in
8866: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 8867: </dd>
8868:
8869: <dt><span class="term">print-PLIST</span></dt>
8870:
8871: <dd>
8872: <p>After a “<span class="quote">make
8873: install</span>” from a new or upgraded pkg,
8874: this prints out an attempt to generate a new
1.14 xtraeme 8875: <code class="filename">PLIST</code> from a
8876: <span><strong class="command">find -newer
8877: work/.extract_done</strong></span>. An attempt is
8878: made to care for shared libs etc., but it is
1.1 grant 8879: <span class="emphasis"><em>strongly</em></span>
8880: recommended to review the result before putting it
1.14 xtraeme 8881: into <code class="filename">PLIST</code>. On
8882: upgrades, it's useful to diff the output of this
8883: command against an already existing <code class=
8884: "filename">PLIST</code> file.</p>
1.1 grant 8885:
1.24 wiz 8886: <p>If the package installs files via <a href=
8887: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
8888: <span class="citerefentry"><span class=
8889: "refentrytitle">tar</span>(1)</span></a> or other
8890: methods that don't update file access times, be
8891: sure to add these files manually to your
1.14 xtraeme 8892: <code class="filename">PLIST</code>, as the
1.1 grant 8893: “<span class="quote">find
8894: -newer</span>” command used by this target
8895: won't catch them!</p>
8896:
8897: <p>See <a href="#print-PLIST" title=
1.25 rillig 8898: "9.3. Tweaking output of make print-PLIST">Section 9.3,
1.14 xtraeme 8899: “Tweaking output of <span><strong class=
8900: "command">make
8901: print-PLIST</strong></span>”</a> for more
8902: information on this target.</p>
1.1 grant 8903: </dd>
8904:
8905: <dt><span class="term">bulk-package</span></dt>
8906:
8907: <dd>
8908: <p>Used to do bulk builds. If an appropriate binary
8909: package already exists, no action is taken. If not,
8910: this target will compile, install and package it
1.14 xtraeme 8911: (and it's depends, if <code class=
8912: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 8913: <a href="#binary.configuration" title=
8914: "5.3.1. Configuration">Section 5.3.1,
8915: “Configuration”</a>. After creating the
8916: binary package, the sources, the just-installed
8917: package and it's required packages are removed,
8918: preserving free disk space.</p>
8919:
8920: <p><span class="emphasis"><em>Beware that this
8921: target may deinstall all packages installed on a
8922: system!</em></span></p>
8923: </dd>
8924:
8925: <dt><span class="term">bulk-install</span></dt>
8926:
8927: <dd>
8928: <p>Used during bulk-installs to install required
8929: packages. If an upto-date binary package is
8930: available, it will be installed via <a href=
8931: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
8932: <span class="citerefentry"><span class=
8933: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 8934: not, <span><strong class="command">make
8935: bulk-package</strong></span> will be executed, but
8936: the installed binary not be removed.</p>
1.1 grant 8937:
8938: <p>A binary package is considered
8939: “<span class="quote">upto-date</span>”
8940: to be installed via <a href=
8941: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
8942: <span class="citerefentry"><span class=
8943: "refentrytitle">pkg_add</span>(1)</span></a>
8944: if:</p>
8945:
8946: <div class="itemizedlist">
8947: <ul type="disc">
8948: <li>
1.14 xtraeme 8949: <p>None of the package's files (<code class=
8950: "filename">Makefile</code>, ...) were
8951: modified since it was built.</p>
1.1 grant 8952: </li>
8953:
8954: <li>
8955: <p>None of the package's required (binary)
8956: packages were modified since it was
8957: built.</p>
8958: </li>
8959: </ul>
8960: </div>
8961:
8962: <p><span class="emphasis"><em>Beware that this
8963: target may deinstall all packages installed on a
8964: system!</em></span></p>
8965: </dd>
8966: </dl>
8967: </div>
8968: </div>
8969: </div>
8970:
8971: <div class="chapter" lang="en" xml:lang="en">
8972: <div class="titlepage">
8973: <div>
8974: <div>
8975: <h2 class="title"><a name="fixes" id=
1.25 rillig 8976: "fixes"></a>Chapter 13. Notes on fixes for
1.1 grant 8977: packages</h2>
8978: </div>
8979: </div>
8980: </div>
8981:
8982: <div class="toc">
8983: <p><b>Table of Contents</b></p>
8984:
8985: <dl>
1.30 wiz 8986: <dt><span class="sect1"><a href=
8987: "#general-operation">13.1. General
8988: operation</a></span></dt>
1.1 grant 8989:
8990: <dd>
8991: <dl>
8992: <dt><span class="sect2"><a href=
1.30 wiz 8993: "#pulling-vars-from-etc-mk.conf">13.1.1. How to
8994: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 8995:
8996: <dt><span class="sect2"><a href=
1.31 wiz 8997: "#where-to-install-documentation">13.1.2. Where to
8998: install documentation</a></span></dt>
8999:
9000: <dt><span class="sect2"><a href=
9001: "#restricted-packages">13.1.3. Restricted
1.1 grant 9002: packages</a></span></dt>
9003:
9004: <dt><span class="sect2"><a href=
1.31 wiz 9005: "#dependencies">13.1.4. Handling
1.1 grant 9006: dependencies</a></span></dt>
9007:
9008: <dt><span class="sect2"><a href=
1.31 wiz 9009: "#conflicts">13.1.5. Handling conflicts with other
1.1 grant 9010: packages</a></span></dt>
9011:
9012: <dt><span class="sect2"><a href=
1.31 wiz 9013: "#not-building-packages">13.1.6. Packages that
1.30 wiz 9014: cannot or should not be built</a></span></dt>
1.1 grant 9015:
9016: <dt><span class="sect2"><a href=
1.31 wiz 9017: "#undeletable-packages">13.1.7. Packages which
1.30 wiz 9018: should not be deleted, once
9019: installed</a></span></dt>
1.1 grant 9020:
9021: <dt><span class="sect2"><a href=
1.31 wiz 9022: "#security-handling">13.1.8. Handling packages with
1.1 grant 9023: security problems</a></span></dt>
9024:
9025: <dt><span class="sect2"><a href=
1.31 wiz 9026: "#compiler-bugs">13.1.9. How to handle compiler
1.1 grant 9027: bugs</a></span></dt>
9028:
9029: <dt><span class="sect2"><a href=
1.31 wiz 9030: "#bumping-pkgrevision">13.1.10. How to handle
1.30 wiz 9031: incrementing versions when fixing an existing
1.1 grant 9032: package</a></span></dt>
9033:
9034: <dt><span class="sect2"><a href=
1.31 wiz 9035: "#portability-of-packages">13.1.11. Portability of
1.1 grant 9036: packages</a></span></dt>
9037: </dl>
9038: </dd>
9039:
1.30 wiz 9040: <dt><span class="sect1"><a href=
9041: "#downloading-issues">13.2. Possible downloading
9042: issues</a></span></dt>
1.1 grant 9043:
9044: <dd>
9045: <dl>
9046: <dt><span class="sect2"><a href=
1.30 wiz 9047: "#no-plain-download">13.2.1. Packages whose
9048: distfiles aren't available for plain
1.1 grant 9049: downloading</a></span></dt>
9050:
9051: <dt><span class="sect2"><a href=
1.30 wiz 9052: "#modified-distfiles-same-name">13.2.2. How to
9053: handle modified distfiles with the 'old'
9054: name</a></span></dt>
1.1 grant 9055: </dl>
9056: </dd>
9057:
1.30 wiz 9058: <dt><span class="sect1"><a href=
9059: "#configuration-gotchas">13.3. Configuration
9060: gotchas</a></span></dt>
1.1 grant 9061:
9062: <dd>
9063: <dl>
9064: <dt><span class="sect2"><a href=
1.25 rillig 9065: "#fixes.libtool">13.3.1. Shared libraries -
1.1 grant 9066: libtool</a></span></dt>
9067:
9068: <dt><span class="sect2"><a href=
1.30 wiz 9069: "#using-libtool">13.3.2. Using libtool on GNU
9070: packages that already support
9071: libtool</a></span></dt>
1.1 grant 9072:
9073: <dt><span class="sect2"><a href=
1.30 wiz 9074: "#autoconf-automake">13.3.3. GNU
1.1 grant 9075: Autoconf/Automake</a></span></dt>
9076: </dl>
9077: </dd>
9078:
1.30 wiz 9079: <dt><span class="sect1"><a href=
9080: "#building-considerations">13.4. Building
9081: considerations</a></span></dt>
1.1 grant 9082:
9083: <dd>
9084: <dl>
9085: <dt><span class="sect2"><a href=
1.30 wiz 9086: "#cpp-defines">13.4.1. CPP defines</a></span></dt>
1.1 grant 9087: </dl>
9088: </dd>
9089:
1.30 wiz 9090: <dt><span class="sect1"><a href=
9091: "#package-specific-actions">13.5. Package specific
9092: actions</a></span></dt>
1.1 grant 9093:
9094: <dd>
9095: <dl>
9096: <dt><span class="sect2"><a href=
1.30 wiz 9097: "#package-configuration-files">13.5.1. Package
9098: configuration files</a></span></dt>
1.1 grant 9099:
9100: <dt><span class="sect2"><a href=
1.30 wiz 9101: "#user-interaction">13.5.2. User
1.2 hubertf 9102: interaction</a></span></dt>
1.1 grant 9103:
9104: <dt><span class="sect2"><a href=
1.30 wiz 9105: "#handling-licenses">13.5.3. Handling
1.1 grant 9106: licenses</a></span></dt>
9107:
9108: <dt><span class="sect2"><a href=
1.30 wiz 9109: "#creating-accounts">13.5.4. Creating an account
9110: from a package</a></span></dt>
1.1 grant 9111:
9112: <dt><span class="sect2"><a href=
1.30 wiz 9113: "#installing-score-files">13.5.5. Installing score
1.1 grant 9114: files</a></span></dt>
9115:
9116: <dt><span class="sect2"><a href=
1.30 wiz 9117: "#login-shells">13.5.6. Packages providing login
1.1 grant 9118: shells</a></span></dt>
9119:
9120: <dt><span class="sect2"><a href=
1.30 wiz 9121: "#perl-scripts">13.5.7. Packages containing perl
1.1 grant 9122: scripts</a></span></dt>
9123:
9124: <dt><span class="sect2"><a href=
1.30 wiz 9125: "#hardcoded-paths">13.5.8. Packages with hardcoded
9126: paths to other interpreters</a></span></dt>
1.1 grant 9127:
9128: <dt><span class="sect2"><a href=
1.30 wiz 9129: "#perl-modules">13.5.9. Packages installing perl
1.1 grant 9130: modules</a></span></dt>
9131:
9132: <dt><span class="sect2"><a href=
1.25 rillig 9133: "#faq.info-files">13.5.10. Packages installing info
1.1 grant 9134: files</a></span></dt>
9135:
9136: <dt><span class="sect2"><a href=
1.30 wiz 9137: "#gconf2-data-files">13.5.11. Packages installing
9138: GConf2 data files</a></span></dt>
1.1 grant 9139:
9140: <dt><span class="sect2"><a href=
1.30 wiz 9141: "#scrollkeeper-data-files">13.5.12. Packages
9142: installing scrollkeeper data files</a></span></dt>
1.1 grant 9143:
9144: <dt><span class="sect2"><a href=
1.30 wiz 9145: "#x11-fonts">13.5.13. Packages installing X11
1.1 grant 9146: fonts</a></span></dt>
9147:
9148: <dt><span class="sect2"><a href=
1.30 wiz 9149: "#gtk2-modules">13.5.14. Packages installing GTK2
1.1 grant 9150: modules</a></span></dt>
9151:
9152: <dt><span class="sect2"><a href=
1.30 wiz 9153: "#sgml-xml-data">13.5.15. Packages installing SGML
9154: or XML data</a></span></dt>
1.1 grant 9155:
9156: <dt><span class="sect2"><a href=
1.30 wiz 9157: "#mime-database">13.5.16. Packages installing
1.1 grant 9158: extensions to the MIME database</a></span></dt>
9159:
9160: <dt><span class="sect2"><a href=
1.30 wiz 9161: "#intltool">13.5.17. Packages using
1.1 grant 9162: intltool</a></span></dt>
1.18 xtraeme 9163:
9164: <dt><span class="sect2"><a href=
1.30 wiz 9165: "#startup-scripts">13.5.18. Packages installing
9166: startup scripts</a></span></dt>
1.1 grant 9167: </dl>
9168: </dd>
9169:
1.30 wiz 9170: <dt><span class="sect1"><a href=
9171: "#feedback-to-author">13.6. Feedback to the
9172: author</a></span></dt>
1.1 grant 9173: </dl>
9174: </div>
9175:
9176: <div class="sect1" lang="en" xml:lang="en">
9177: <div class="titlepage">
9178: <div>
9179: <div>
9180: <h2 class="title" style="clear: both"><a name=
1.30 wiz 9181: "general-operation" id=
9182: "general-operation"></a>13.1. General
1.1 grant 9183: operation</h2>
9184: </div>
9185: </div>
9186: </div>
9187:
9188: <div class="sect2" lang="en" xml:lang="en">
9189: <div class="titlepage">
9190: <div>
9191: <div>
1.30 wiz 9192: <h3 class="title"><a name=
9193: "pulling-vars-from-etc-mk.conf" id=
9194: "pulling-vars-from-etc-mk.conf"></a>13.1.1. How
9195: to pull in variables from /etc/mk.conf</h3>
1.1 grant 9196: </div>
9197: </div>
9198: </div>
9199:
9200: <p>The problem with package-defined variables that can
1.14 xtraeme 9201: be overridden via <code class="varname">MAKECONF</code>
9202: or <code class="filename">/etc/mk.conf</code> is that
9203: <a href=
1.1 grant 9204: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9205: <span class="citerefentry"><span class=
9206: "refentrytitle">make</span>(1)</span></a> expands a
9207: variable as it is used, but evaluates preprocessor like
9208: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 9209: So, to use any variable (which may be set in
9210: <code class="filename">/etc/mk.conf</code>) in one of
9211: the .if* statements, the file <code class=
9212: "filename">/etc/mk.conf</code> must be included before
1.1 grant 9213: that .if* statement.</p>
9214:
9215: <p>Rather than have a number of ad-hoc ways of
1.14 xtraeme 9216: including <code class="filename">/etc/mk.conf</code>,
9217: should it exist, or <code class=
9218: "varname">MAKECONF</code>, should it exist, include the
9219: <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
9220: file in the package Makefile before any
9221: preprocessor-like .if, .ifdef, or .ifndef
9222: statements:</p>
1.1 grant 9223: <pre class="programlisting">
9224: .include "../../mk/bsd.prefs.mk"
9225:
9226: .if defined(USE_MENUS)
9227: ...
9228: .endif
9229: </pre>
9230:
1.14 xtraeme 9231: <p>If you wish to set the <code class=
9232: "varname">CFLAGS</code> variable in <code class=
9233: "filename">/etc/mk.conf</code> please make sure to
1.1 grant 9234: use:</p>
9235: <pre class="programlisting">
9236: CFLAGS+= -your -flags
9237: </pre>
9238:
1.14 xtraeme 9239: <p>Using <code class="varname">CFLAGS=</code> (i.e.
9240: without the “<span class="quote">+</span>”)
9241: may lead to problems with packages that need to add
9242: their own flags. Also, you may want to take a look at
9243: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 9244: href=
9245: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20 ben 9246: class="pkgname">devel/cpuflags</a> package if you're
9247: interested in optimization for the current CPU.</p>
1.1 grant 9248: </div>
9249:
9250: <div class="sect2" lang="en" xml:lang="en">
9251: <div class="titlepage">
9252: <div>
9253: <div>
1.31 wiz 9254: <h3 class="title"><a name=
9255: "where-to-install-documentation" id=
9256: "where-to-install-documentation"></a>13.1.2. Where
9257: to install documentation</h3>
9258: </div>
9259: </div>
9260: </div>
9261:
9262: <p>Documentation should be installed into <code class=
9263: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
9264: <code class=
9265: "filename">${PREFIX}/share/doc/${PKGNAME}</code> (the
9266: latter includes the version number of the package).</p>
9267: </div>
9268:
9269: <div class="sect2" lang="en" xml:lang="en">
9270: <div class="titlepage">
9271: <div>
9272: <div>
1.30 wiz 9273: <h3 class="title"><a name="restricted-packages"
9274: id=
1.31 wiz 9275: "restricted-packages"></a>13.1.3. Restricted
1.1 grant 9276: packages</h3>
9277: </div>
9278: </div>
9279: </div>
9280:
9281: <p>Some licenses restrict how software may be
9282: re-distributed. In order to satisfy these restrictions,
9283: the package system defines five make variables that can
9284: be set to note these restrictions:</p>
9285:
9286: <div class="itemizedlist">
9287: <ul type="disc">
9288: <li>
1.14 xtraeme 9289: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 9290:
9291: <p>This variable should be set whenever a
9292: restriction exists (regardless of its kind). Set
9293: this variable to a string containing the reason
9294: for the restriction.</p>
9295: </li>
9296:
9297: <li>
1.14 xtraeme 9298: <p><code class=
9299: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 9300:
9301: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 9302: variable to <code class=
9303: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 9304: package may not be included on a CD-ROM.</p>
9305: </li>
9306:
9307: <li>
1.14 xtraeme 9308: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 9309:
9310: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 9311: Set this variable to <code class=
9312: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 9313: package may not not be made available on the
9314: Internet.</p>
9315: </li>
9316:
9317: <li>
1.14 xtraeme 9318: <p><code class=
9319: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 9320:
9321: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 9322: this variable to <code class=
9323: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 9324: of the source code or other distfile(s) is not
9325: allowed on CD-ROMs.</p>
9326: </li>
9327:
9328: <li>
1.14 xtraeme 9329: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 9330:
9331: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 9332: variable to <code class=
9333: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 9334: of the source code or other distfile(s) via the
9335: Internet is not allowed.</p>
9336: </li>
9337: </ul>
9338: </div>
9339:
1.14 xtraeme 9340: <p>Please note that the use of <code class=
9341: "varname">NO_PACKAGE</code>, <code class=
9342: "varname">IGNORE</code>, <code class=
9343: "varname">NO_CDROM</code>, or other generic make
1.1 grant 9344: variables to denote restrictions is deprecated, because
9345: they unconditionally prevent users from generating
9346: binary packages!</p>
9347: </div>
9348:
9349: <div class="sect2" lang="en" xml:lang="en">
9350: <div class="titlepage">
9351: <div>
9352: <div>
9353: <h3 class="title"><a name="dependencies" id=
1.31 wiz 9354: "dependencies"></a>13.1.4. Handling
1.1 grant 9355: dependencies</h3>
9356: </div>
9357: </div>
9358: </div>
9359:
9360: <p>Your package may depend on some other package being
9361: present - and there are various ways of expressing this
1.14 xtraeme 9362: dependency. pkgsrc supports the <code class=
9363: "varname">BUILD_DEPENDS</code> and <code class=
9364: "varname">DEPENDS</code> definitions, as well as
9365: dependencies via <code class=
9366: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 9367: way to handle dependencies, and which uses the
9368: variables named above. See <a href="#buildlink" title=
1.25 rillig 9369: "Chapter 10. Buildlink methodology">Chapter 10,
1.1 grant 9370: <i>Buildlink methodology</i></a> for more
9371: information.</p>
9372:
9373: <p>The basic difference between the two variables is as
1.14 xtraeme 9374: follows: The <code class="varname">DEPENDS</code>
1.1 grant 9375: definition registers that pre-requisite in the binary
9376: package so it will be pulled in when the binary package
1.14 xtraeme 9377: is later installed, whilst the <code class=
9378: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 9379: marking a dependency that is only needed for building
9380: the package.</p>
9381:
9382: <p>This means that if you only need a package present
9383: whilst you are building, it should be noted as a
1.14 xtraeme 9384: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 9385:
1.14 xtraeme 9386: <p>The format for a <code class=
9387: "varname">BUILD_DEPENDS</code> and a <code class=
9388: "varname">DEPENDS</code> definition is:</p>
1.1 grant 9389: <pre class="programlisting">
9390: <pre-req-package-name>:../../<category>/<pre-req-package>
9391: </pre>
9392:
9393: <p>Please note that the “<span class=
9394: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 9395: any of the wildcard version numbers recognized by
1.1 grant 9396: <a href=
9397: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
9398: <span class="citerefentry"><span class=
9399: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
9400:
9401: <div class="orderedlist">
9402: <ol type="1">
9403: <li>
9404: <p>If your package needs another package's
9405: binaries or libraries to build or run, and if
1.14 xtraeme 9406: that package has a <code class=
9407: "filename">buildlink3.mk</code> file available,
9408: use it:</p>
1.1 grant 9409: <pre class="programlisting">
9410: .include "../../graphics/jpeg/buildlink3.mk"
9411:
9412: </pre>
9413: </li>
9414:
9415: <li>
9416: <p>If your package needs to use another package
1.14 xtraeme 9417: to build itself and there is no <code class=
9418: "filename">buildlink3.mk</code> file available,
9419: use the <code class=
9420: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 9421: <pre class="programlisting">
9422: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
9423: </pre>
9424: </li>
9425:
9426: <li>
9427: <p>If your package needs a library with which to
1.14 xtraeme 9428: link and again there is no <code class=
9429: "filename">buildlink3.mk</code> file available,
9430: this is specified using the <code class=
9431: "varname">DEPENDS</code> definition. An example
9432: of this is the <a xmlns=
1.1 grant 9433: "http://www.w3.org/TR/xhtml1/transitional" href=
9434: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 9435: class="pkgname">print/lyx</a> package, which uses
9436: the xpm library, version 3.4j to build:</p>
1.1 grant 9437: <pre class="programlisting">
9438: DEPENDS+= xpm-3.4j:../../graphics/xpm
9439: </pre>
9440:
9441: <p>You can also use wildcards in package
9442: dependences:</p>
9443: <pre class="programlisting">
9444: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
9445: </pre>
9446:
9447: <p>Note that such wildcard dependencies are
9448: retained when creating binary packages. The
9449: dependency is checked when installing the binary
9450: package and any package which matches the pattern
9451: will be used. Wildcard dependencies should be
9452: used with care.</p>
9453:
9454: <p>The “<span class=
9455: "quote">-[0-9]*</span>” should be used
9456: instead of “<span class=
9457: "quote">-*</span>” to avoid potentially
9458: ambiguous matches such as “<span class=
9459: "quote">tk-postgresql</span>” matching a
9460: “<span class="quote">tk-*</span>”
1.14 xtraeme 9461: <code class="varname">DEPENDS</code>.</p>
1.1 grant 9462:
9463: <p>Wildcards can also be used to specify that a
9464: package will only build against a certain minimum
9465: version of a pre-requisite:</p>
9466: <pre class="programlisting">
9467: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
9468: </pre>
9469:
9470: <p>This means that the package will build against
9471: version 3.5.4 of the tiff library or newer. Such
9472: a dependency may be warranted if, for example,
9473: the API of the library has changed with version
9474: 3.5.4 and a package would not compile against an
9475: earlier version of tiff.</p>
9476:
9477: <p>Please note that such dependencies should only
9478: be updated if a package requires a newer
9479: pre-requisite, but not to denote recommendations
9480: such as security updates or ABI changes that do
9481: not prevent a package from building correctly.
9482: Such recommendations can be expressed using
1.14 xtraeme 9483: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 9484: <pre class="programlisting">
9485: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
9486: </pre>
9487:
1.14 xtraeme 9488: <p>In addition to the above <code class=
9489: "varname">DEPENDS</code> line, this denotes that
1.1 grant 9490: while a package will build against
9491: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 9492: recommended. <code class=
9493: "varname">RECOMMENDED</code> entries will be
9494: turned into dependencies unless explicitly
9495: ignored (in which case a warning will be
9496: printed). Packages that are built with
1.1 grant 9497: recommendations ignored may not be uploaded to
9498: ftp.NetBSD.org by developers and should not be
9499: used across different systems that may have
9500: different versions of binary packages
9501: installed.</p>
9502:
9503: <p>For security fixes, please update the package
9504: vulnerabilities file as well as setting
1.14 xtraeme 9505: <code class="varname">RECOMMENDED</code>, see
1.1 grant 9506: <a href="#security-handling" title=
1.31 wiz 9507: "13.1.8. Handling packages with security problems">
9508: Section 13.1.8, “Handling packages with
1.1 grant 9509: security problems”</a> for more
9510: information.</p>
9511: </li>
9512:
9513: <li>
9514: <p>If your package needs some executable to be
1.17 sketch 9515: able to run correctly and if there's no
1.14 xtraeme 9516: <code class="filename">buildlink3.mk</code> file,
9517: this is specified using the <code class=
9518: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 9519: "http://www.w3.org/TR/xhtml1/transitional" href=
9520: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 9521: class="pkgname">print/lyx</a> package needs to be
9522: able to execute the latex binary from the teTeX
9523: package when it runs, and that is specified:</p>
1.1 grant 9524: <pre class="programlisting">
9525: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
9526: </pre>
9527:
9528: <p>The comment about wildcard dependencies from
9529: previous paragraph applies here, too.</p>
9530: </li>
9531: </ol>
9532: </div>
9533:
9534: <p>If your package needs files from another package to
9535: build, see the first part of the “<span class=
9536: "quote">do-configure</span>” target <a xmlns=
9537: "http://www.w3.org/TR/xhtml1/transitional" href=
9538: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20 ben 9539: class="pkgname">print/ghostscript5</a> package (it
9540: relies on the jpeg sources being present in source form
9541: during the build):</p>
1.1 grant 9542: <pre class="programlisting">
9543: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
9544: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
9545: fi
9546: </pre>
9547:
9548: <p>If you build any other packages that way, please
9549: make sure the working files are deleted too when this
9550: package's working files are cleaned up. The easiest way
9551: to do so is by adding a pre-clean target:</p>
9552: <pre class="programlisting">
9553: pre-clean:
9554: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
9555: </pre>
9556:
1.14 xtraeme 9557: <p>Please also note the <code class=
9558: "varname">BUILD_USES_MSGFMT</code> and <code class=
9559: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
9560: which are provided as convenience definitions. The
1.24 wiz 9561: former works out whether <a href=
9562: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
9563: <span class="citerefentry"><span class=
9564: "refentrytitle">msgfmt</span>(1)</span></a> is part of
9565: the base system, and, if it isn't, installs the
9566: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9567: href=
1.1 grant 9568: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20 ben 9569: class="pkgname">devel/gettext</a> package. The latter
9570: adds a build dependency on either an installed version
9571: of an older gettext package, or if it isn't, installs
9572: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9573: href=
9574: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
9575: class="pkgname">devel/gettext-m4</a> package.</p>
1.1 grant 9576: </div>
9577:
9578: <div class="sect2" lang="en" xml:lang="en">
9579: <div class="titlepage">
9580: <div>
9581: <div>
1.30 wiz 9582: <h3 class="title"><a name="conflicts" id=
1.31 wiz 9583: "conflicts"></a>13.1.5. Handling conflicts
1.1 grant 9584: with other packages</h3>
9585: </div>
9586: </div>
9587: </div>
9588:
9589: <p>Your package may conflict with other packages a user
9590: might already have installed on his system, e.g. if
9591: your package installs the same set of files like
9592: another package in our pkgsrc tree.</p>
9593:
1.14 xtraeme 9594: <p>In this case you can set <code class=
9595: "varname">CONFLICTS</code> to a space separated list of
1.1 grant 9596: packages (including version string) your package
9597: conflicts with.</p>
9598:
9599: <p>For example <a xmlns=
9600: "http://www.w3.org/TR/xhtml1/transitional" href=
9601: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20 ben 9602: class="pkgname">x11/Xaw3d</a> and <a xmlns=
9603: "http://www.w3.org/TR/xhtml1/transitional" href=
9604: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
9605: class="pkgname">x11/Xaw-Xpm</a> install provide the
9606: same shared library, thus you set in <code class=
9607: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 9608: <pre class="programlisting">
9609: CONFLICTS= Xaw-Xpm-[0-9]*
9610: </pre>
9611:
1.14 xtraeme 9612: <p>and in <code class=
9613: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 9614: <pre class="programlisting">
9615: CONFLICTS= Xaw3d-[0-9]*
9616: </pre>
9617:
9618: <p>Packages will automatically conflict with other
9619: packages with the name prefix and a different version
9620: string. “<span class=
9621: "quote">Xaw3d-1.5</span>” e.g. will automatically
9622: conflict with the older version “<span class=
9623: "quote">Xaw3d-1.3</span>”.</p>
9624: </div>
9625:
9626: <div class="sect2" lang="en" xml:lang="en">
9627: <div class="titlepage">
9628: <div>
9629: <div>
1.30 wiz 9630: <h3 class="title"><a name="not-building-packages"
9631: id=
1.31 wiz 9632: "not-building-packages"></a>13.1.6. Packages
1.30 wiz 9633: that cannot or should not be built</h3>
1.1 grant 9634: </div>
9635: </div>
9636: </div>
9637:
9638: <p>There are several reasons why a package might be
9639: instructed to not build under certain circumstances. If
9640: the package builds and runs on most platforms, the
1.14 xtraeme 9641: exceptions should be noted with <code class=
9642: "varname">NOT_FOR_PLATFORM</code>. If the package
9643: builds and runs on a small handful of platforms, set
9644: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
9645: If the package should be skipped (for example, because
9646: it provides functionality already provided by the
9647: system), set <code class=
9648: "varname">PKG_SKIP_REASON</code> to a descriptive
9649: message. If the package should fail because some
9650: preconditions are not met, set <code class=
9651: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 9652: message.</p>
9653:
1.14 xtraeme 9654: <p><code class="varname">IGNORE</code> is deprecated
1.1 grant 9655: because it didn't provide enough information to
9656: determine whether the build should fail.</p>
9657: </div>
9658:
9659: <div class="sect2" lang="en" xml:lang="en">
9660: <div class="titlepage">
9661: <div>
9662: <div>
1.30 wiz 9663: <h3 class="title"><a name="undeletable-packages"
9664: id=
1.31 wiz 9665: "undeletable-packages"></a>13.1.7. Packages
1.30 wiz 9666: which should not be deleted, once installed</h3>
1.1 grant 9667: </div>
9668: </div>
9669: </div>
9670:
9671: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 9672: has been installed, the <code class=
9673: "varname">PKG_PRESERVE</code> definition should be set
9674: in the package Makefile. This will be carried into any
1.1 grant 9675: binary package that is made from this pkgsrc entry. A
9676: “<span class="quote">preserved</span>”
9677: package will not be deleted using <a href=
9678: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
9679: <span class="citerefentry"><span class=
9680: "refentrytitle">pkg_delete</span>(1)</span></a> unless
9681: the “<span class="quote">-f</span>” option
9682: is used.</p>
9683: </div>
9684:
9685: <div class="sect2" lang="en" xml:lang="en">
9686: <div class="titlepage">
9687: <div>
9688: <div>
9689: <h3 class="title"><a name="security-handling" id=
1.31 wiz 9690: "security-handling"></a>13.1.8. Handling
1.1 grant 9691: packages with security problems</h3>
9692: </div>
9693: </div>
9694: </div>
9695:
9696: <p>When a vulnerability is found, this should be noted
1.14 xtraeme 9697: in <code class=
9698: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1 grant 9699: and after the commit of that file, it should be copied
1.14 xtraeme 9700: to both <code class=
9701: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
9702: and <code class=
9703: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
9704: on ftp.NetBSD.org using <code class=
9705: "filename">localsrc/security/advisories/Makefile</code>.
9706: In addition, if a <code class=
9707: "filename">buildlink3.mk</code> file exists for an
9708: affected package, bumping <code class=
9709: "varname">PKGREVISION</code> and creating a
9710: corresponding <code class=
9711: "varname">BUILDLINK_RECOMMENDED.<em class=
9712: "replaceable"><code>pkg</code></em></code> entry should
9713: be considered. See <a href="#buildlink" title=
1.25 rillig 9714: "Chapter 10. Buildlink methodology">Chapter 10,
1.1 grant 9715: <i>Buildlink methodology</i></a> for more information
1.14 xtraeme 9716: about writing <code class=
9717: "filename">buildlink3.mk</code> files and <code class=
9718: "varname">BUILDLINK_*</code> definitions.</p>
1.1 grant 9719:
9720: <p>Also, if the fix should be applied to the stable
9721: pkgsrc branch, be sure to submit a pullup request!</p>
9722: </div>
9723:
9724: <div class="sect2" lang="en" xml:lang="en">
9725: <div class="titlepage">
9726: <div>
9727: <div>
1.30 wiz 9728: <h3 class="title"><a name="compiler-bugs" id=
1.31 wiz 9729: "compiler-bugs"></a>13.1.9. How to handle
1.1 grant 9730: compiler bugs</h3>
9731: </div>
9732: </div>
9733: </div>
9734:
9735: <p>Some source files trigger bugs in the compiler,
9736: based on combinations of compiler version and
9737: architecture and almost always relation to optimisation
9738: being enabled. Common symptoms are gcc internal errors
9739: or never finishing compiling a file.</p>
9740:
9741: <p>Typically a workaround involves testing the
1.14 xtraeme 9742: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 9743: version, disabling optimisation for that
1.14 xtraeme 9744: file/<code class="varname">MACHINE_ARCH</code>/compiler
9745: combination, and documenting it in <code class=
9746: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 9747: number of examples!</p>
9748: </div>
9749:
9750: <div class="sect2" lang="en" xml:lang="en">
9751: <div class="titlepage">
9752: <div>
9753: <div>
1.30 wiz 9754: <h3 class="title"><a name="bumping-pkgrevision"
1.31 wiz 9755: id="bumping-pkgrevision"></a>13.1.10. How to
1.30 wiz 9756: handle incrementing versions when fixing an
9757: existing package</h3>
1.1 grant 9758: </div>
9759: </div>
9760: </div>
9761:
9762: <p>When making fixes to an existing package it can be
1.14 xtraeme 9763: useful to change the version number in <code class=
9764: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 9765: future versions by the original author, a
9766: “<span class="quote">nb1</span>”,
9767: “<span class="quote">nb2</span>”, ...
9768: suffix can be used on package versions by setting
1.14 xtraeme 9769: <code class="varname">PKGREVISION=1</code> (2, ...).
9770: The “<span class="quote">nb</span>” is
9771: treated like a “<span class=
9772: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 9773: <pre class="programlisting">
9774: DISTNAME= foo-17.42
9775: PKGREVISION= 9
9776: </pre>
9777:
1.14 xtraeme 9778: <p>will result in a <code class=
9779: "varname">PKGNAME</code> of “<span class=
1.1 grant 9780: "quote">foo-17.42nb9</span>”.</p>
9781:
9782: <p>When a new release of the package is released, the
1.14 xtraeme 9783: <code class="varname">PKGREVISION</code> should be
9784: removed. e.g. on a new minor release of the above
9785: package, things should be like:</p>
1.1 grant 9786: <pre class="programlisting">
9787: DISTNAME= foo-17.43
9788: </pre>
9789: </div>
9790:
9791: <div class="sect2" lang="en" xml:lang="en">
9792: <div class="titlepage">
9793: <div>
9794: <div>
1.30 wiz 9795: <h3 class="title"><a name=
9796: "portability-of-packages" id=
1.31 wiz 9797: "portability-of-packages"></a>13.1.11. Portability
1.30 wiz 9798: of packages</h3>
1.1 grant 9799: </div>
9800: </div>
9801: </div>
9802:
9803: <p>One appealing feature of pkgsrc is that it runs on
9804: many different platforms. As a result, it is important
9805: to ensure, where possible, that packages in pkgsrc are
9806: portable. There are some particular details you should
9807: pay attention to while working on pkgsrc.</p>
9808:
9809: <div class="sect3" lang="en" xml:lang="en">
9810: <div class="titlepage">
9811: <div>
9812: <div>
1.30 wiz 9813: <h4 class="title"><a name="install-scripts" id=
1.31 wiz 9814: "install-scripts"></a>13.1.11.1. ${INSTALL},
1.1 grant 9815: ${INSTALL_DATA_DIR}, ...</h4>
9816: </div>
9817: </div>
9818: </div>
9819:
1.14 xtraeme 9820: <p>The BSD-compatible <span><strong class=
9821: "command">install</strong></span> supplied with some
1.1 grant 9822: operating systems will not perform more than one
9823: operation at a time. As such, you should call
9824: “<span class="quote">${INSTALL}</span>”,
9825: etc. like this:</p>
9826: <pre class="programlisting">
9827: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
9828: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
9829: </pre>
9830: </div>
9831: </div>
9832: </div>
9833:
9834: <div class="sect1" lang="en" xml:lang="en">
9835: <div class="titlepage">
9836: <div>
9837: <div>
9838: <h2 class="title" style="clear: both"><a name=
1.30 wiz 9839: "downloading-issues" id=
9840: "downloading-issues"></a>13.2. Possible
1.1 grant 9841: downloading issues</h2>
9842: </div>
9843: </div>
9844: </div>
9845:
9846: <div class="sect2" lang="en" xml:lang="en">
9847: <div class="titlepage">
9848: <div>
9849: <div>
1.30 wiz 9850: <h3 class="title"><a name="no-plain-download" id=
9851: "no-plain-download"></a>13.2.1. Packages
9852: whose distfiles aren't available for plain
1.1 grant 9853: downloading</h3>
9854: </div>
9855: </div>
9856: </div>
9857:
9858: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 9859: set <code class="varname">DYNAMIC_MASTER_SITES</code>
9860: and a <span><strong class="command">make
9861: fetch</strong></span> will call <code class=
9862: "filename">files/getsite.sh</code> with the name of
9863: each file to download as an argument, expecting it to
9864: output the URL of the directory from which to download
9865: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9866: href=
1.1 grant 9867: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20 ben 9868: class="pkgname">graphics/ns-cult3d</a> is an example of
9869: this usage.</p>
1.1 grant 9870:
9871: <p>If the download can't be automated, because the user
9872: must submit personal information to apply for a
9873: password, or must pay for the source, or whatever, you
1.14 xtraeme 9874: can set <code class="varname">_FETCH_MESSAGE</code> to
9875: a macro which displays a message explaining the
9876: situation. <code class="varname">_FETCH_MESSAGE</code>
9877: must be executable shell commands, not just a message.
9878: (Generally, it executes <code class=
9879: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 9880: following packages use this: <a xmlns=
9881: "http://www.w3.org/TR/xhtml1/transitional" href=
9882: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20 ben 9883: class="pkgname">audio/realplayer</a>, <a xmlns=
9884: "http://www.w3.org/TR/xhtml1/transitional" href=
9885: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
9886: class="pkgname">cad/simian</a>, <a xmlns=
9887: "http://www.w3.org/TR/xhtml1/transitional" href=
9888: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
9889: class="pkgname">devel/ipv6socket</a>, <a xmlns=
9890: "http://www.w3.org/TR/xhtml1/transitional" href=
9891: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
9892: class="pkgname">emulators/vmware-module</a>, <a xmlns=
9893: "http://www.w3.org/TR/xhtml1/transitional" href=
9894: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
9895: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
9896: "http://www.w3.org/TR/xhtml1/transitional" href=
9897: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
9898: class="pkgname">sysutils/storage-manager</a>, <a xmlns=
9899: "http://www.w3.org/TR/xhtml1/transitional" href=
9900: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
9901: class="pkgname">www/ap-aolserver</a>, <a xmlns=
9902: "http://www.w3.org/TR/xhtml1/transitional" href=
9903: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
9904: class="pkgname">www/openacs</a>. Try to be consistent
9905: with them.</p>
1.1 grant 9906: </div>
9907:
9908: <div class="sect2" lang="en" xml:lang="en">
9909: <div class="titlepage">
9910: <div>
9911: <div>
1.30 wiz 9912: <h3 class="title"><a name=
9913: "modified-distfiles-same-name" id=
9914: "modified-distfiles-same-name"></a>13.2.2. How
9915: to handle modified distfiles with the 'old'
9916: name</h3>
1.1 grant 9917: </div>
9918: </div>
9919: </div>
9920:
9921: <p>Sometimes authors of a software package make some
9922: modifications after the software was released, and they
9923: put up a new distfile without changing the package's
9924: version number. If a package is already in pkgsrc at
1.32 wiz 9925: that time, the checksum will no longer match. The
9926: contents of the new distfile should be compared against
9927: the old one before changing anything, to make sure the
9928: distfile was really updated on purpose, and that no
9929: trojan horse or so crept in. Then, the correct way to
9930: work around this is to set <code class=
9931: "varname">DIST_SUBDIR</code> to a unique directory
9932: name, usually based on <code class=
9933: "varname">PKGNAME_NOREV</code>. In case this happens
9934: more often, <code class="varname">PKGNAME</code> can be
9935: used (thus including the <code class=
9936: "filename">nbX</code> suffix) or a date stamp can be
9937: appended, like <code class=
9938: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
9939: forget regenerating the <code class=
9940: "filename">distinfo</code> file after that, since it
9941: contains the <code class="varname">DIST_SUBDIR</code>
9942: path in the filenames. Furthermore, a mail to the
9943: package's authors seems appropriate telling them that
9944: changing distfiles after releases without changing the
9945: file names is not good practice.</p>
1.1 grant 9946: </div>
9947: </div>
9948:
9949: <div class="sect1" lang="en" xml:lang="en">
9950: <div class="titlepage">
9951: <div>
9952: <div>
9953: <h2 class="title" style="clear: both"><a name=
1.30 wiz 9954: "configuration-gotchas" id=
9955: "configuration-gotchas"></a>13.3. Configuration
1.1 grant 9956: gotchas</h2>
9957: </div>
9958: </div>
9959: </div>
9960:
9961: <div class="sect2" lang="en" xml:lang="en">
9962: <div class="titlepage">
9963: <div>
9964: <div>
9965: <h3 class="title"><a name="fixes.libtool" id=
1.25 rillig 9966: "fixes.libtool"></a>13.3.1. Shared libraries
1.1 grant 9967: - libtool</h3>
9968: </div>
9969: </div>
9970: </div>
9971:
9972: <p>pkgsrc supports many different machines, with
9973: different object formats like a.out and ELF, and
9974: varying abilities to do shared library and dynamic
9975: loading at all. To accompany this, varying commands and
9976: options have to be passed to the compiler, linker, etc.
9977: to get the Right Thing, which can be pretty annoying
9978: especially if you don't have all the machines at your
9979: hand to test things. The <a xmlns=
9980: "http://www.w3.org/TR/xhtml1/transitional" href=
9981: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20 ben 9982: class="pkgname">devel/libtool</a> pkg can help here, as
9983: it just “<span class="quote">knows</span>”
9984: how to build both static and dynamic libraries from a
9985: set of source files, thus being platform
9986: independent.</p>
1.1 grant 9987:
9988: <p>Here's how to use libtool in a pkg in seven simple
9989: steps:</p>
9990:
9991: <div class="orderedlist">
9992: <ol type="1">
9993: <li>
1.14 xtraeme 9994: <p>Add <code class=
9995: "varname">USE_LIBTOOL=yes</code> to the package
9996: Makefile.</p>
1.1 grant 9997: </li>
9998:
9999: <li>
10000: <p>For library objects, use “<span class=
10001: "quote">${LIBTOOL} --mode=compile
10002: ${CC}</span>” in place of
10003: “<span class="quote">${CC}</span>”.
10004: You could even add it to the definition of
1.14 xtraeme 10005: <code class="varname">CC</code>, if only
10006: libraries are being built in a given Makefile.
10007: This one command will build both PIC and non-PIC
10008: library objects, so you need not have separate
10009: shared and non-shared library rules.</p>
1.1 grant 10010: </li>
10011:
10012: <li>
10013: <p>For the linking of the library, remove any
10014: “<span class="quote">ar</span>”,
10015: “<span class="quote">ranlib</span>”,
10016: and “<span class="quote">ld
10017: -Bshareable</span>” commands, and instead
10018: use:</p>
10019: <pre class="programlisting">
10020: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
10021: </pre>
10022:
10023: <p>Note that the library is changed to have a
1.14 xtraeme 10024: <code class="filename">.la</code> extension, and
10025: the objects are changed to have a <code class=
10026: "filename">.lo</code> extension. Change
10027: <code class="varname">OBJS</code> as necessary.
10028: This automatically creates all of the
10029: <code class="filename">.a</code>, <code class=
10030: "filename">.so.major.minor</code>, and ELF
10031: symlinks (if necessary) in the build directory.
10032: Be sure to include “<span class=
1.1 grant 10033: "quote">-version-info</span>”, especially
10034: when major and minor are zero, as libtool will
10035: otherwise strip off the shared library
10036: version.</p>
10037:
10038: <p>From the libtool manual:</p>
10039: <pre class="programlisting">
10040: So, libtool library versions are described by three integers:
10041:
10042: CURRENT
10043: The most recent interface number that this library implements.
10044:
10045: REVISION
10046: The implementation number of the CURRENT interface.
10047:
10048: AGE
10049: The difference between the newest and oldest interfaces that this
10050: library implements. In other words, the library implements all the
10051: interface numbers in the range from number `CURRENT - AGE' to
10052: `CURRENT'.
10053:
10054: If two libraries have identical CURRENT and AGE numbers, then the
10055: dynamic linker chooses the library with the greater REVISION number.
10056: </pre>
10057:
10058: <p>The “<span class=
10059: "quote">-release</span>” option will
10060: produce different results for a.out and ELF
10061: (excluding symlinks) in only one case. An ELF
10062: library of the form “<span class=
10063: "quote">libfoo-release.so.<span class=
10064: "emphasis"><em>x</em></span>.<span class=
10065: "emphasis"><em>y</em></span></span>” will
10066: have a symlink of “<span class=
10067: "quote">libfoo.so.<span class=
10068: "emphasis"><em>x</em></span>.<span class=
10069: "emphasis"><em>y</em></span></span>” on an
10070: a.out platform. This is handled
10071: automatically.</p>
10072:
10073: <p>The “<span class="quote">-rpath
10074: argument</span>” is the install directory
10075: of the library being built.</p>
10076:
1.14 xtraeme 10077: <p>In the <code class="filename">PLIST</code>,
1.19 hubertf 10078: include only the <code class=
10079: "filename">.la</code> file, the other files will
10080: be added automatically.</p>
1.1 grant 10081: </li>
10082:
10083: <li>
1.14 xtraeme 10084: <p>When linking shared object (<code class=
10085: "filename">.so</code>) files, i.e. files that are
1.24 wiz 10086: loaded via <a href=
10087: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
10088: <span class="citerefentry"><span class=
10089: "refentrytitle">dlopen</span>(3)</span></a>, NOT
10090: shared libraries, use “<span class=
10091: "quote">-module -avoid-version</span>” to
10092: prevent them getting version tacked on.</p>
1.1 grant 10093:
1.14 xtraeme 10094: <p>The <code class="filename">PLIST</code> file
10095: gets the <code class="filename">foo.so</code>
10096: entry.</p>
1.1 grant 10097: </li>
10098:
10099: <li>
10100: <p>When linking programs that depend on these
10101: libraries <span class=
10102: "emphasis"><em>before</em></span> they are
10103: installed, preface the <a href=
10104: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
10105: <span class="citerefentry"><span class=
10106: "refentrytitle">cc</span>(1)</span></a> or
10107: <a href=
10108: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
10109: <span class="citerefentry"><span class=
10110: "refentrytitle">ld</span>(1)</span></a> line with
10111: “<span class="quote">${LIBTOOL}
10112: --mode=link</span>”, and it will find the
10113: correct libraries (static or shared), but please
10114: be aware that libtool will not allow you to
10115: specify a relative path in -L (such as
10116: “<span class=
10117: "quote">-L../somelib</span>”), because it
10118: expects you to change that argument to be the
1.14 xtraeme 10119: <code class="filename">.la</code> file. e.g.</p>
1.1 grant 10120: <pre class="programlisting">
10121: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
10122: </pre>
10123:
10124: <p>should be changed to:</p>
10125: <pre class="programlisting">
1.14 xtraeme 10126: ${LIBTOOL} --mode=link ${CC} -o <em class=
10127: "replaceable"><code>someprog</code></em> <em class=
10128: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 10129: </pre>
10130:
10131: <p>and it will do the right thing with the
10132: libraries.</p>
10133: </li>
10134:
10135: <li>
10136: <p>When installing libraries, preface the
10137: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
10138: <span class="citerefentry"><span class=
10139: "refentrytitle">install</span>(1)</span></a> or
10140: <a href=
10141: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
10142: <span class="citerefentry"><span class=
10143: "refentrytitle">cp</span>(1)</span></a> command
10144: with “<span class="quote">${LIBTOOL}
10145: --mode=install</span>”, and change the
1.14 xtraeme 10146: library name to <code class=
10147: "filename">.la</code>. e.g.</p>
1.1 grant 10148: <pre class="programlisting">
10149: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
10150: </pre>
10151:
1.14 xtraeme 10152: <p>This will install the static <code class=
10153: "filename">.a</code>, shared library, any needed
1.1 grant 10154: symlinks, and run <a href=
10155: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
10156: <span class="citerefentry"><span class=
10157: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
10158: </li>
10159:
10160: <li>
1.14 xtraeme 10161: <p>In your <code class="filename">PLIST</code>,
1.23 wiz 10162: include only the <code class=
10163: "filename">.la</code> file (this is a change from
10164: previous behaviour).</p>
1.1 grant 10165: </li>
10166: </ol>
10167: </div>
10168: </div>
10169:
10170: <div class="sect2" lang="en" xml:lang="en">
10171: <div class="titlepage">
10172: <div>
10173: <div>
1.30 wiz 10174: <h3 class="title"><a name="using-libtool" id=
10175: "using-libtool"></a>13.3.2. Using libtool on
10176: GNU packages that already support libtool</h3>
1.1 grant 10177: </div>
10178: </div>
10179: </div>
10180:
1.14 xtraeme 10181: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
10182: the package Makefile. This will override the package's
10183: own libtool in most cases. For older libtool using
1.1 grant 10184: packages, libtool is made by ltconfig script during the
10185: do-configure step; you can check the libtool script
1.14 xtraeme 10186: location by doing <span><strong class="command">make
10187: configure; find work*/ -name
10188: libtool</strong></span>.</p>
10189:
10190: <p><code class="varname">LIBTOOL_OVERRIDE</code>
10191: specifies which libtool scripts, relative to
10192: <code class="varname">WRKSRC</code>, to override. By
10193: default, it is set to “<span class=
10194: "quote">libtool */libtool */*/libtool</span>”. If
10195: this does not match the location of the package's
10196: libtool script(s), set it as appropriate.</p>
1.13 hubertf 10197:
1.14 xtraeme 10198: <p>If you do not need <code class="filename">*.a</code>
1.1 grant 10199: static libraries built and installed, then use
1.14 xtraeme 10200: <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1 grant 10201: instead.</p>
10202:
10203: <p>If your package makes use of the platform
10204: independent library for loading dynamic shared objects,
10205: that comes with libtool (libltdl), you should include
1.22 tv 10206: devel/libltdl/buildlink3.mk.</p>
1.1 grant 10207:
10208: <p>Some packages use libtool incorrectly so that the
10209: package may not work or build in some circumstances.
10210: Some of the more common errors are:</p>
10211:
10212: <div class="itemizedlist">
10213: <ul type="disc">
10214: <li>
10215: <p>The inclusion of a shared object (-module) as
10216: a dependent library in an executable or library.
10217: This in itself isn't a problem if one of two
10218: things has been done:</p>
10219:
10220: <div class="orderedlist">
10221: <ol type="1">
10222: <li>
10223: <p>The shared object is named correctly,
1.14 xtraeme 10224: i.e. <code class=
10225: "filename">libfoo.la</code>, not
10226: <code class="filename">foo.la</code></p>
1.1 grant 10227: </li>
10228:
10229: <li>
10230: <p>The -dlopen option is used when linking
10231: an executable.</p>
10232: </li>
10233: </ol>
10234: </div>
10235: </li>
10236:
10237: <li>
10238: <p>The use of libltdl without the correct calls
10239: to initialisation routines. The function
10240: lt_dlinit() should be called and the macro
1.14 xtraeme 10241: <code class=
10242: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 10243: included in executables.</p>
10244: </li>
10245: </ul>
10246: </div>
10247: </div>
10248:
10249: <div class="sect2" lang="en" xml:lang="en">
10250: <div class="titlepage">
10251: <div>
10252: <div>
1.30 wiz 10253: <h3 class="title"><a name="autoconf-automake" id=
10254: "autoconf-automake"></a>13.3.3. GNU
1.1 grant 10255: Autoconf/Automake</h3>
10256: </div>
10257: </div>
10258: </div>
10259:
10260: <p>If a package needs GNU autoconf or automake to be
10261: executed to regenerate the configure script and
10262: Makefile.in makefile templates, then they should be
10263: executed in a pre-configure target. Two Makefile
1.14 xtraeme 10264: fragments are provided in <code class=
10265: "filename">pkgsrc/mk/autoconf.mk</code> and
10266: <code class="filename">pkgsrc/mk/automake.mk</code> to
10267: help dealing with these tools. See comments in these
10268: files for details.</p>
1.1 grant 10269:
10270: <p>For packages that need only autoconf:</p>
10271: <pre class="programlisting">
10272: AUTOCONF_REQD= 2.50 # if default version is not good enough
10273: ...
10274:
10275: pre-configure:
10276: cd ${WRKSRC}; ${AUTOCONF}
10277:
10278: ...
10279: .include "../../mk/autoconf.mk"
10280: </pre>
10281:
10282: <p>and for packages that need automake and
10283: autoconf:</p>
10284: <pre class="programlisting">
10285: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
10286: ...
10287:
10288: pre-configure:
10289: cd ${WRKSRC}; \
10290: ${ACLOCAL}; \
10291: ${AUTOHEADER}; \
10292: ${AUTOMAKE} -a --foreign -i; \
10293: ${AUTOCONF}
10294:
10295: ...
10296: .include "../mk/automake.mk"
10297: </pre>
10298:
10299: <p>Packages which use GNU Automake will almost
10300: certainly require GNU Make, but that's automatically
1.14 xtraeme 10301: provided for you in <code class=
10302: "filename">mk/automake.mk</code>.</p>
1.1 grant 10303:
10304: <p>There are times when the configure process makes
10305: additional changes to the generated files, which then
10306: causes the build process to try to re-execute the
10307: automake sequence. This is prevented by touching
10308: various files in the configure stage. If this causes
1.14 xtraeme 10309: problems with your package you can set <code class=
10310: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 10311: Makefile.</p>
10312: </div>
10313: </div>
10314:
10315: <div class="sect1" lang="en" xml:lang="en">
10316: <div class="titlepage">
10317: <div>
10318: <div>
10319: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10320: "building-considerations" id=
10321: "building-considerations"></a>13.4. Building
1.1 grant 10322: considerations</h2>
10323: </div>
10324: </div>
10325: </div>
10326:
10327: <div class="sect2" lang="en" xml:lang="en">
10328: <div class="titlepage">
10329: <div>
10330: <div>
1.30 wiz 10331: <h3 class="title"><a name="cpp-defines" id=
10332: "cpp-defines"></a>13.4.1. CPP defines</h3>
1.1 grant 10333: </div>
10334: </div>
10335: </div>
10336:
10337: <p>To port an application to NetBSD, it's usually
10338: necessary for the compiler to be able to judge the
10339: system on which it's compiling, and we use definitions
10340: so that the C pre-processor can do this.</p>
10341:
10342: <p>To test whether you are working on a 4.4 BSD-derived
10343: system, you should use the BSD definition, which is
1.14 xtraeme 10344: defined in <code class=
10345: "filename"><sys/param.h></code> on said
1.1 grant 10346: systems.</p>
10347: <pre class="programlisting">
10348: #include <sys/param.h>
10349: </pre>
10350:
10351: <p>and then you can surround the BSD-specific parts of
10352: your package's C/C++ code using this conditional:</p>
10353: <pre class="programlisting">
10354: #if (defined(BSD) && BSD >= 199306)
10355: ...
10356: #endif
10357: </pre>
10358:
10359: <p>Please use the “<span class=
10360: "quote">__NetBSD__</span>” definition sparingly -
10361: it should only apply to features of NetBSD that are not
10362: present in other 4.4-lite derived BSDs.</p>
10363: </div>
10364: </div>
10365:
10366: <div class="sect1" lang="en" xml:lang="en">
10367: <div class="titlepage">
10368: <div>
10369: <div>
10370: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10371: "package-specific-actions" id=
10372: "package-specific-actions"></a>13.5. Package
1.1 grant 10373: specific actions</h2>
10374: </div>
10375: </div>
10376: </div>
10377:
10378: <div class="sect2" lang="en" xml:lang="en">
10379: <div class="titlepage">
10380: <div>
10381: <div>
1.30 wiz 10382: <h3 class="title"><a name=
10383: "package-configuration-files" id=
10384: "package-configuration-files"></a>13.5.1. Package
1.1 grant 10385: configuration files</h3>
10386: </div>
10387: </div>
10388: </div>
10389:
10390: <p>Packages should be taught to look for their
1.14 xtraeme 10391: configuration files in <code class=
10392: "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1 grant 10393: through to the configure and build processes.
1.14 xtraeme 10394: <code class="varname">PKG_SYSCONFDIR</code> may be
1.1 grant 10395: customized in various ways by setting other make
10396: variables:</p>
10397:
10398: <div class="itemizedlist">
10399: <ul type="disc">
10400: <li>
1.14 xtraeme 10401: <p><code class="varname">PKG_SYSCONFBASE</code>
10402: is the main config directory under which all
10403: package configuration files are to be found. This
10404: defaults to <code class=
10405: "filename">${PREFIX}/etc</code>, but may be
10406: overridden in <code class=
10407: "filename">/etc/mk.conf</code>.</p>
1.1 grant 10408: </li>
10409:
10410: <li>
1.14 xtraeme 10411: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
10412: is the subdirectory of <code class=
10413: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 10414: configuration files for a particular package may
10415: be found, e.g. the Apache configuration files may
1.14 xtraeme 10416: all be found under the <code class=
10417: "filename">httpd/</code> subdirectory of
10418: <code class="varname">${PKG_SYSCONFBASE}</code>.
10419: This should be set in the package Makefile.</p>
1.1 grant 10420: </li>
10421:
10422: <li>
1.14 xtraeme 10423: <p>By default, <code class=
10424: "varname">PKG_SYSCONFDIR</code> is set to
10425: <code class=
10426: "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
10427: but this may be overridden by setting
10428: <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
10429: for a particular package, where <code class=
10430: "varname">PKG_SYSCONFVAR</code> defaults to
10431: <code class="varname">${PKGBASE}</code>. This is
10432: not meant to be set by a package Makefile, but is
1.1 grant 10433: reserved for users who wish to override the
1.14 xtraeme 10434: <code class="varname">PKG_SYSCONFDIR</code>
10435: setting for a particular package with a special
1.1 grant 10436: location.</p>
10437: </li>
10438: </ul>
10439: </div>
10440:
10441: <p>The only variables that users should customize are
1.14 xtraeme 10442: <code class="varname">PKG_SYSCONFBASE</code> and
10443: <code class=
10444: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
10445: Users will typically want to set <code class=
10446: "varname">PKG_SYSCONFBASE</code> to <code class=
10447: "filename">/etc</code>, or to accept the default
10448: location of <code class=
10449: "filename">${PREFIX}/etc</code>.</p>
1.1 grant 10450: </div>
10451:
10452: <div class="sect2" lang="en" xml:lang="en">
10453: <div class="titlepage">
10454: <div>
10455: <div>
1.30 wiz 10456: <h3 class="title"><a name="user-interaction" id=
10457: "user-interaction"></a>13.5.2. User
1.2 hubertf 10458: interaction</h3>
1.1 grant 10459: </div>
10460: </div>
10461: </div>
10462:
10463: <p>Occasionally, packages require interaction from the
10464: user, and this can be in a number of ways:</p>
10465:
10466: <div class="itemizedlist">
10467: <ul type="disc">
10468: <li>
10469: <p>help in fetching the distfiles</p>
10470: </li>
10471:
10472: <li>
10473: <p>help to configure the package before it is
10474: built</p>
10475: </li>
10476:
10477: <li>
10478: <p>help during the build process</p>
10479: </li>
10480:
10481: <li>
10482: <p>help during the installation of a package</p>
10483: </li>
10484: </ul>
10485: </div>
10486:
1.14 xtraeme 10487: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 10488: definition is provided to notify the pkgsrc mechanism
10489: of an interactive stage which will be needed, and this
1.14 xtraeme 10490: should be set in the package's <code class=
10491: "filename">Makefile</code>. e.g.</p>
1.1 grant 10492: <pre class="programlisting">
10493: INTERACTIVE_STAGE= build
10494: </pre>
10495:
10496: <p>Multiple interactive stages can be specified:</p>
10497: <pre class="programlisting">
10498: INTERACTIVE_STAGE= configure install
10499: </pre>
10500: </div>
10501:
10502: <div class="sect2" lang="en" xml:lang="en">
10503: <div class="titlepage">
10504: <div>
10505: <div>
1.30 wiz 10506: <h3 class="title"><a name="handling-licenses" id=
10507: "handling-licenses"></a>13.5.3. Handling
1.1 grant 10508: licenses</h3>
10509: </div>
10510: </div>
10511: </div>
10512:
10513: <p>A package may underly a license which the user has
10514: or has not agreed to accept. Usually, packages that
10515: underly well-known Open Source licenses (e.g. the GNU
10516: Public License, GPL) won't have any special license
10517: tags added in pkgsrc which require special action by
10518: the user of such packages, but there are quite a number
10519: of other licenses out there that pkgsrc users may not
10520: be able to follow, for whatever reasons. For these
10521: cases, pkgsrc contains a mechanism to note that a
10522: package underlies a certain license, and the user has
10523: to accept the license before the package can be
10524: installed.</p>
10525:
10526: <p>Placing a certain package under a certain license
1.14 xtraeme 10527: works by setting the <code class=
10528: "varname">LICENSE</code> variable to a string
10529: identifying the license, e.g. in <a xmlns=
10530: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10531: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20 ben 10532: class="pkgname">graphics/graphviz</a>:</p>
1.1 grant 10533: <pre class="programlisting">
10534: LICENSE= graphviz-license
10535: </pre>
10536:
10537: <p>When trying to build, the user will get a notice
10538: that the package underlies a license which he hasn't
10539: accepted (yet):</p>
10540: <pre class="programlisting">
1.14 xtraeme 10541: <code class="prompt">%</code> <strong class=
10542: "userinput"><code>make</code></strong>
1.1 grant 10543: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
10544: ===> To build this package, add this line to your /etc/mk.conf:
10545: ===> ACCEPTABLE_LICENSES+=graphviz-license
10546: ===> To view the license, enter "/usr/bin/make show-license".
10547: *** Error code 1
10548: </pre>
10549:
1.14 xtraeme 10550: <p>The license can be viewed with <span><strong class=
10551: "command">make show-license</strong></span>, and if it
10552: is considered appropriate, the line printed above can
10553: be added to <code class="filename">/etc/mk.conf</code>
10554: to indicate acceptance of the particular license:</p>
1.1 grant 10555: <pre class="programlisting">
10556: ACCEPTABLE_LICENSES+=graphviz-license
10557: </pre>
10558:
10559: <p>When adding a package with a new license, the
1.14 xtraeme 10560: license text should be added to <code class=
10561: "filename">pkgsrc/licenses</code> for displaying. A
10562: list of known licenses can be seen in this directory as
10563: well as by looking at the list of (commented out)
10564: <code class="varname">ACCEPTABLE_LICENSES</code>
10565: variable settings in <code class=
10566: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 10567:
1.17 sketch 10568: <p>If there is a <span class=
1.1 grant 10569: "emphasis"><em>really</em></span> pressing need to
10570: accept all licenses at once, like when trying to
10571: download or mirror all distfiles or doing a bulk build
10572: to test if all packages in pkgsrc build, this can be
1.14 xtraeme 10573: done by setting <code class=
10574: "varname">_ACCEPTABLE=yes</code>.</p>
1.1 grant 10575: </div>
10576:
10577: <div class="sect2" lang="en" xml:lang="en">
10578: <div class="titlepage">
10579: <div>
10580: <div>
1.30 wiz 10581: <h3 class="title"><a name="creating-accounts" id=
10582: "creating-accounts"></a>13.5.4. Creating an
10583: account from a package</h3>
1.1 grant 10584: </div>
10585: </div>
10586: </div>
10587:
10588: <p>There are two make variables used to control the
10589: creation of package-specific groups and users at
1.14 xtraeme 10590: pre-install time. The first is <code class=
10591: "varname">PKG_GROUPS</code>, which is a list of
1.1 grant 10592: group[:groupid] elements, where the groupid is
1.14 xtraeme 10593: optional. The second is <code class=
10594: "varname">PKG_USERS</code>, which is a list of elements
1.1 grant 10595: of the form:</p>
10596: <pre class="programlisting">
10597: user:group[:[userid][:[description][:[home][:shell]]]]
10598: </pre>
10599:
10600: <p>where only the user and group are required, the rest
10601: being optional. A simple example is:</p>
10602: <pre class="programlisting">
10603: PKG_GROUPS= foogroup
10604: PKG_USERS= foouser:foogroup
10605: </pre>
10606:
10607: <p>A more complex example is that creates two groups
10608: and two users is:</p>
10609: <pre class="programlisting">
10610: PKG_GROUPS= group1 group2:1005
10611: PKG_USERS= first:group1::First\\ User \
10612: second:group2::Second\\ User:/home/second:${SH}
10613: </pre>
10614:
10615: <p>By default, a new user will have home directory
1.14 xtraeme 10616: <code class="filename">/nonexistent</code>, and login
10617: shell <code class="filename">/sbin/nologin</code>
10618: unless they are specified as part of the user
10619: element.</p>
1.1 grant 10620:
1.14 xtraeme 10621: <p>The package <code class="filename">Makefile</code>
10622: must also set <code class=
10623: "varname">USE_PKGINSTALL=YES</code>. This will cause
10624: the users and groups to be created at pre-install time,
10625: and the admin will be prompted to remove them at
10626: post-deinstall time. Automatic creation of the users
10627: and groups can be toggled on and off by setting the
10628: <code class="varname">PKG_CREATE_USERGROUP</code>
10629: variable prior to package installation.</p>
1.1 grant 10630: </div>
10631:
10632: <div class="sect2" lang="en" xml:lang="en">
10633: <div class="titlepage">
10634: <div>
10635: <div>
1.30 wiz 10636: <h3 class="title"><a name=
10637: "installing-score-files" id=
10638: "installing-score-files"></a>13.5.5. Installing
10639: score files</h3>
1.1 grant 10640: </div>
10641: </div>
10642: </div>
10643:
10644: <p>Certain packages, most of them in the games
10645: category, install a score file that allows all users on
10646: the system to record their highscores. In order for
10647: this to work, the binaries need to be installed setgid
10648: and the score files owned by the appropriate group
10649: and/or owner (traditionally the "games" user/group).
10650: The following variables, documented in more detail in
1.14 xtraeme 10651: <code class="filename">mk/defaults/mk.conf</code>,
10652: control this behaviour: <code class=
10653: "varname">SETGIDGAME</code>, <code class=
10654: "varname">GAMEDATAMODE</code>, <code class=
10655: "varname">GAMEGRP</code>, <code class=
10656: "varname">GAMEMODE</code>, <code class=
10657: "varname">GAMEOWN</code>.</p>
1.1 grant 10658:
10659: <p>Note that per default, setgid installation of games
1.14 xtraeme 10660: is disabled; setting <code class=
10661: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 10662: variables accordingly.</p>
10663:
10664: <p>A package should therefor never hard code file
1.14 xtraeme 10665: ownership or access permissions but rely on
10666: <code class="varname">INSTALL_GAME</code> and
10667: <code class="varname">INSTALL_GAME_DATA</code> to set
10668: these correctly.</p>
1.1 grant 10669: </div>
10670:
10671: <div class="sect2" lang="en" xml:lang="en">
10672: <div class="titlepage">
10673: <div>
10674: <div>
1.30 wiz 10675: <h3 class="title"><a name="login-shells" id=
10676: "login-shells"></a>13.5.6. Packages
10677: providing login shells</h3>
1.1 grant 10678: </div>
10679: </div>
10680: </div>
10681:
10682: <p>If the purpose of the package is to provide a login
1.14 xtraeme 10683: shell, the variable <code class=
10684: "varname">PKG_SHELL</code> should contain the full
10685: pathname of the shell executable installed by this
10686: package. The package <code class=
10687: "filename">Makefile</code> must also set <code class=
10688: "varname">USE_PKGINSTALL=YES</code> to use the
10689: automatically generated <code class=
10690: "filename">INSTALL</code>/<code class=
10691: "filename">DEINSTALL</code> scripts.</p>
1.1 grant 10692:
10693: <p>An example taken from shells/zsh:</p>
10694: <pre class="programlisting">
10695: USE_PKGINSTALL= YES
10696: PKG_SHELL= ${PREFIX}/bin/zsh
10697: </pre>
10698:
1.14 xtraeme 10699: <p>The shell is registered into <code class=
10700: "filename">/etc/shells</code> file automatically in the
10701: post-install target by the generated <code class=
10702: "filename">INSTALL</code> script and removed in the
10703: deinstall target by the <code class=
10704: "filename">DEINSTALL</code> script.</p>
1.1 grant 10705: </div>
10706:
10707: <div class="sect2" lang="en" xml:lang="en">
10708: <div class="titlepage">
10709: <div>
10710: <div>
1.30 wiz 10711: <h3 class="title"><a name="perl-scripts" id=
10712: "perl-scripts"></a>13.5.7. Packages
10713: containing perl scripts</h3>
1.1 grant 10714: </div>
10715: </div>
10716: </div>
10717:
10718: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 10719: set <code class="varname">REPLACE_PERL</code> to ensure
10720: that the proper interpreter path is set. <code class=
10721: "varname">REPLACE_PERL</code> should contain a list of
10722: scripts, relative to <code class=
10723: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 10724: </div>
10725:
10726: <div class="sect2" lang="en" xml:lang="en">
10727: <div class="titlepage">
10728: <div>
10729: <div>
1.30 wiz 10730: <h3 class="title"><a name="hardcoded-paths" id=
10731: "hardcoded-paths"></a>13.5.8. Packages with
1.1 grant 10732: hardcoded paths to other interpreters</h3>
10733: </div>
10734: </div>
10735: </div>
10736:
10737: <p>Your package may also contain scripts with hardcoded
10738: paths to other interpreters besides (or as well as)
10739: perl. To correct the full pathname to the script
10740: interpreter, you need to set the following definitions
1.14 xtraeme 10741: in your <code class="filename">Makefile</code> (we
10742: shall use <span><strong class=
10743: "command">tclsh</strong></span> in this example):</p>
1.1 grant 10744: <pre class="programlisting">
10745: REPLACE_INTERPRETER+= tcl
10746: _REPLACE.tcl.old= .*/bin/tclsh
10747: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
10748: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
10749: relative to ${WRKSRC}, just as in REPLACE_PERL
10750: </pre>
10751: </div>
10752:
10753: <div class="sect2" lang="en" xml:lang="en">
10754: <div class="titlepage">
10755: <div>
10756: <div>
1.30 wiz 10757: <h3 class="title"><a name="perl-modules" id=
10758: "perl-modules"></a>13.5.9. Packages
10759: installing perl modules</h3>
1.1 grant 10760: </div>
10761: </div>
10762: </div>
10763:
10764: <p>Makefiles of packages providing perl5 modules should
1.14 xtraeme 10765: include the Makefile fragment <code class=
10766: "filename">../../lang/perl5/module.mk</code>. It
10767: provides a <span><strong class=
10768: "command">do-configure</strong></span> target for the
10769: standard perl configuration for such modules as well as
10770: various hooks to tune this configuration. See comments
10771: in this file for details.</p>
1.1 grant 10772:
10773: <p>Perl5 modules will install into different places
10774: depending on the version of perl used during the build
10775: process. To address this, pkgsrc will append lines to
1.14 xtraeme 10776: the <code class="filename">PLIST</code> corresponding
10777: to the files listed in the installed <code class=
10778: "filename">.packlist</code> file generated by most
10779: perl5 modules. This is invoked by defining <code class=
10780: "varname">PERL5_PACKLIST</code> to a space-separated
10781: list of paths to packlist files, e.g.:</p>
1.1 grant 10782: <pre class="programlisting">
10783: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
10784: </pre>
10785:
1.14 xtraeme 10786: <p>The variables <code class=
10787: "varname">PERL5_SITELIB</code>, <code class=
10788: "varname">PERL5_SITEARCH</code>, and <code class=
10789: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 10790: locations in which perl5 modules may be installed, and
10791: may be used by perl5 packages that don't have a
10792: packlist. These three variables are also substituted
1.14 xtraeme 10793: for in the <code class="filename">PLIST</code>.</p>
1.1 grant 10794: </div>
10795:
10796: <div class="sect2" lang="en" xml:lang="en">
10797: <div class="titlepage">
10798: <div>
10799: <div>
10800: <h3 class="title"><a name="faq.info-files" id=
1.25 rillig 10801: "faq.info-files"></a>13.5.10. Packages
1.1 grant 10802: installing info files</h3>
10803: </div>
10804: </div>
10805: </div>
10806:
10807: <p>Some packages install info files or use the
10808: “<span class="quote">makeinfo</span>” or
10809: “<span class="quote">install-info</span>”
10810: commands. Each of the info files:</p>
10811:
10812: <div class="itemizedlist">
10813: <ul type="disc">
10814: <li>
10815: <p>is considered to be installed in the directory
1.14 xtraeme 10816: <code class=
10817: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 10818: </li>
10819:
10820: <li>
10821: <p>is registered in the Info directory file
1.14 xtraeme 10822: <code class=
10823: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 10824: </li>
10825:
10826: <li>
10827: <p>and must be listed as a filename in the
1.14 xtraeme 10828: <code class="varname">INFO_FILES</code> variable
10829: in the package Makefile.</p>
1.1 grant 10830: </li>
10831: </ul>
10832: </div>
10833:
1.14 xtraeme 10834: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 10835: “<span class="quote">info</span>” and can
1.14 xtraeme 10836: be overridden in the package Makefile. <code class=
10837: "filename">INSTALL</code> and <code class=
10838: "filename">DEINSTALL</code> scripts will be generated
10839: to handle registration of the info files in the Info
1.1 grant 10840: directory file. The “<span class=
10841: "quote">install-info</span>” command used for the
10842: info files registration is either provided by the
10843: system, or by a special purpose package automatically
10844: added as dependency if needed.</p>
10845:
10846: <p>A package which needs the “<span class=
10847: "quote">makeinfo</span>” command at build time
1.14 xtraeme 10848: must define the variable <code class=
10849: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 10850: minimum version of the “<span class=
10851: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 10852: should be noted with the <code class=
10853: "varname">TEXINFO_REQD</code> variable in the package
10854: <code class="filename">Makefile</code>. By default, a
1.1 grant 10855: minimum version of 3.12 is required. If the system does
1.14 xtraeme 10856: not provide a <span><strong class=
10857: "command">makeinfo</strong></span> command or if it
10858: does not match the required minimum, a build dependency
10859: on the <a xmlns=
10860: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10861: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20 ben 10862: class="pkgname">devel/gtexinfo</a> package will be
10863: added automatically.</p>
1.1 grant 10864:
10865: <p>The build and installation process of the software
10866: provided by the package should not use the
1.14 xtraeme 10867: <span><strong class=
10868: "command">install-info</strong></span> command as the
10869: registration of info files is the task of the package
10870: <code class="filename">INSTALL</code> script, and it
10871: must use the appropriate <span><strong class=
10872: "command">makeinfo</strong></span> command.</p>
1.1 grant 10873:
10874: <p>To achieve this goal the pkgsrc infrastructure
1.14 xtraeme 10875: creates overriding scripts for the <span><strong class=
10876: "command">install-info</strong></span> and
10877: <span><strong class="command">makeinfo</strong></span>
10878: commands in a directory listed early in <code class=
10879: "varname">PATH</code>.</p>
1.1 grant 10880:
1.14 xtraeme 10881: <p>The script overriding <span><strong class=
10882: "command">install-info</strong></span> has no effect
10883: except the logging of a message. The script overriding
10884: <span><strong class="command">makeinfo</strong></span>
10885: logs a message and according to the value of
10886: <code class="varname">USE_MAKEINFO</code> and
10887: <code class="varname">TEXINFO_REQD</code> either run
10888: the appropriate <span><strong class=
10889: "command">makeinfo</strong></span> command or exit on
10890: error.</p>
1.1 grant 10891: </div>
10892:
10893: <div class="sect2" lang="en" xml:lang="en">
10894: <div class="titlepage">
10895: <div>
10896: <div>
1.30 wiz 10897: <h3 class="title"><a name="gconf2-data-files" id=
10898: "gconf2-data-files"></a>13.5.11. Packages
10899: installing GConf2 data files</h3>
1.1 grant 10900: </div>
10901: </div>
10902: </div>
10903:
1.14 xtraeme 10904: <p>If a package installs <code class=
10905: "filename">.schemas</code> or <code class=
10906: "filename">.entries</code> files, used by GConf2, you
1.1 grant 10907: need to take some extra steps to make sure they get
10908: registered in the database:</p>
10909:
10910: <div class="orderedlist">
10911: <ol type="1">
10912: <li>
1.14 xtraeme 10913: <p>Include <code class=
10914: "filename">../../devel/GConf2/schemas.mk</code>
10915: instead of its <code class=
10916: "filename">buildlink3.mk</code> file. This takes
1.1 grant 10917: care of rebuilding the GConf2 database at
10918: installation and deinstallation time, and tells
10919: the package where to install GConf2 data files
10920: using some standard configure arguments. It also
10921: disallows any access to the database directly
10922: from the package.</p>
10923: </li>
10924:
10925: <li>
10926: <p>Ensure that the package installs its
1.14 xtraeme 10927: <code class="filename">.schemas</code> files
10928: under <code class=
10929: "filename">${PREFIX}/share/gconf/schemas</code>.
10930: If they get installed under <code class=
10931: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 10932: manually patch the package.</p>
10933: </li>
10934:
10935: <li>
10936: <p>Check the PLIST and remove any entries under
10937: the etc/gconf directory, as they will be handled
10938: automatically. See <a href="#faq.conf" title=
1.14 xtraeme 10939: "6.14. Configuration files handling and placement">
10940: Section 6.14, “Configuration files
1.1 grant 10941: handling and placement”</a> for more
10942: information.</p>
10943: </li>
10944:
10945: <li>
1.14 xtraeme 10946: <p>Define the <code class=
10947: "varname">GCONF2_SCHEMAS</code> variable in your
10948: <code class="filename">Makefile</code> with a
10949: list of all <code class=
10950: "filename">.schemas</code> files installed by the
10951: package, if any. Names must not contain any
10952: directories in them.</p>
1.1 grant 10953: </li>
10954:
10955: <li>
1.14 xtraeme 10956: <p>Define the <code class=
10957: "varname">GCONF2_ENTRIES</code> variable in your
10958: <code class="filename">Makefile</code> with a
10959: list of all <code class=
10960: "filename">.entries</code> files installed by the
10961: package, if any. Names must not contain any
10962: directories in them.</p>
1.1 grant 10963: </li>
10964: </ol>
10965: </div>
10966: </div>
10967:
10968: <div class="sect2" lang="en" xml:lang="en">
10969: <div class="titlepage">
10970: <div>
10971: <div>
1.30 wiz 10972: <h3 class="title"><a name=
10973: "scrollkeeper-data-files" id=
10974: "scrollkeeper-data-files"></a>13.5.12. Packages
10975: installing scrollkeeper data files</h3>
1.1 grant 10976: </div>
10977: </div>
10978: </div>
10979:
1.14 xtraeme 10980: <p>If a package installs <code class=
10981: "filename">.omf</code> files, used by scrollkeeper, you
10982: need to take some extra steps to make sure they get
10983: registered in the database:</p>
1.1 grant 10984:
10985: <div class="orderedlist">
10986: <ol type="1">
10987: <li>
1.14 xtraeme 10988: <p>Include <code class=
10989: "filename">../../textproc/scrollkeeper/omf.mk</code>
10990: instead of its <code class=
10991: "filename">buildlink3.mk</code> file. This takes
1.1 grant 10992: care of rebuilding the scrollkeeper database at
10993: installation and deinstallation time, and
10994: disallows any access to it directly from the
10995: package.</p>
10996: </li>
10997:
10998: <li>
10999: <p>Check the PLIST and remove any entries under
1.14 xtraeme 11000: the <code class=
11001: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 11002: as they will be handled automatically.</p>
11003: </li>
11004:
11005: <li>
1.14 xtraeme 11006: <p>Remove the <code class=
11007: "filename">share/omf</code> directory from the
11008: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 11009: </li>
11010: </ol>
11011: </div>
11012: </div>
11013:
11014: <div class="sect2" lang="en" xml:lang="en">
11015: <div class="titlepage">
11016: <div>
11017: <div>
1.30 wiz 11018: <h3 class="title"><a name="x11-fonts" id=
11019: "x11-fonts"></a>13.5.13. Packages installing
1.1 grant 11020: X11 fonts</h3>
11021: </div>
11022: </div>
11023: </div>
11024:
11025: <p>If a package installs font files, you will need to
11026: rebuild the fonts database in the directory where they
11027: get installed at installation and deinstallation time.
1.14 xtraeme 11028: This can be automatically done by using <code class=
11029: "filename">mk/fonts.mk</code>, which you need to
11030: include in your <code class=
11031: "filename">Makefile</code>.</p>
1.1 grant 11032:
11033: <p>When the file is included, you can list the
1.14 xtraeme 11034: directories where fonts are installed in the
11035: <code class="varname">FONTS_<em class=
11036: "replaceable"><code>type</code></em>_DIRS</code>
11037: variables, where <em class=
11038: "replaceable"><code>type</code></em> can be one of
11039: “<span class="quote">TTF</span>”,
1.1 grant 11040: “<span class="quote">TYPE1</span>” or
11041: “<span class="quote">X11</span>”. Also make
1.14 xtraeme 11042: sure that the database file <code class=
11043: "filename">fonts.dir</code> is not listed in the
1.1 grant 11044: PLIST.</p>
11045:
11046: <p>Note that you should not create new directories for
11047: fonts; instead use the standard ones to avoid that the
11048: user needs to manually configure his X server to find
11049: them.</p>
11050: </div>
11051:
11052: <div class="sect2" lang="en" xml:lang="en">
11053: <div class="titlepage">
11054: <div>
11055: <div>
1.30 wiz 11056: <h3 class="title"><a name="gtk2-modules" id=
11057: "gtk2-modules"></a>13.5.14. Packages
11058: installing GTK2 modules</h3>
1.1 grant 11059: </div>
11060: </div>
11061: </div>
11062:
11063: <p>If a package installs gtk2 immodules or loaders, you
11064: need to take some extra steps to get them registered in
11065: the GTK2 database properly:</p>
11066:
11067: <div class="orderedlist">
11068: <ol type="1">
11069: <li>
1.14 xtraeme 11070: <p>Include <code class=
11071: "filename">../../x11/gtk2/modules.mk</code>
11072: instead of its <code class=
11073: "filename">buildlink3.mk</code> file. This takes
11074: care of rebuilding the database at installation
11075: and deinstallation time.</p>
1.1 grant 11076: </li>
11077:
11078: <li>
1.14 xtraeme 11079: <p>Set <code class=
11080: "varname">GTK2_IMMODULES=YES</code> if your
11081: package installs GTK2 immodules.</p>
1.1 grant 11082: </li>
11083:
11084: <li>
1.14 xtraeme 11085: <p>Set <code class=
11086: "varname">GTK2_LOADERS=YES</code> if your package
11087: installs GTK2 loaders.</p>
1.1 grant 11088: </li>
11089:
11090: <li>
11091: <p>Patch the package to not touch any of the gtk2
11092: databases directly. These are:</p>
11093:
11094: <div class="itemizedlist">
11095: <ul type="disc">
11096: <li>
1.14 xtraeme 11097: <p><code class=
11098: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 11099: </li>
11100:
11101: <li>
1.14 xtraeme 11102: <p><code class=
11103: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 11104: </li>
11105: </ul>
11106: </div>
11107: </li>
11108:
11109: <li>
11110: <p>Check the PLIST and remove any entries under
1.14 xtraeme 11111: the <code class="filename">libdata/gtk-2.0</code>
1.1 grant 11112: directory, as they will be handled
11113: automatically.</p>
11114: </li>
11115: </ol>
11116: </div>
11117: </div>
11118:
11119: <div class="sect2" lang="en" xml:lang="en">
11120: <div class="titlepage">
11121: <div>
11122: <div>
1.30 wiz 11123: <h3 class="title"><a name="sgml-xml-data" id=
11124: "sgml-xml-data"></a>13.5.15. Packages
11125: installing SGML or XML data</h3>
1.1 grant 11126: </div>
11127: </div>
11128: </div>
11129:
11130: <p>If a package installs SGML or XML data files that
11131: need to be registered in system-wide catalogs (like
11132: DTDs, sub-catalogs, etc.), you need to take some extra
11133: steps:</p>
11134:
11135: <div class="orderedlist">
11136: <ol type="1">
11137: <li>
1.14 xtraeme 11138: <p>Include <code class=
11139: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
11140: in your <code class="filename">Makefile</code>,
11141: which takes care of registering those files in
1.1 grant 11142: system-wide catalogs at installation and
11143: deinstallation time.</p>
11144: </li>
11145:
11146: <li>
1.14 xtraeme 11147: <p>Set <code class="varname">SGML_CATALOGS</code>
11148: to the full path of any SGML catalogs installed
11149: by the package.</p>
1.1 grant 11150: </li>
11151:
11152: <li>
1.14 xtraeme 11153: <p>Set <code class="varname">XML_CATALOGS</code>
11154: to the full path of any XML catalogs installed by
1.1 grant 11155: the package.</p>
11156: </li>
11157:
11158: <li>
1.14 xtraeme 11159: <p>Set <code class="varname">SGML_ENTRIES</code>
11160: to individual entries to be added to the SGML
1.1 grant 11161: catalog. These come in groups of three strings;
11162: see xmlcatmgr(1) for more information
11163: (specifically, arguments recognized by the 'add'
11164: action). Note that you will normally not use this
11165: variable.</p>
11166: </li>
11167:
11168: <li>
1.14 xtraeme 11169: <p>Set <code class="varname">XML_ENTRIES</code>
11170: to individual entries to be added to the XML
1.1 grant 11171: catalog. These come in groups of three strings;
11172: see xmlcatmgr(1) for more information
11173: (specifically, arguments recognized by the 'add'
11174: action). Note that you will normally not use this
11175: variable.</p>
11176: </li>
11177: </ol>
11178: </div>
11179: </div>
11180:
11181: <div class="sect2" lang="en" xml:lang="en">
11182: <div class="titlepage">
11183: <div>
11184: <div>
1.30 wiz 11185: <h3 class="title"><a name="mime-database" id=
11186: "mime-database"></a>13.5.16. Packages
11187: installing extensions to the MIME database</h3>
1.1 grant 11188: </div>
11189: </div>
11190: </div>
11191:
11192: <p>If a package provides extensions to the MIME
1.14 xtraeme 11193: database by installing <code class=
11194: "filename">.xml</code> files inside <code class=
11195: "filename">${PREFIX}/share/mime/packages</code>, you
11196: need to take some extra steps to ensure that the
11197: database is kept consistent with respect to these new
11198: files:</p>
1.1 grant 11199:
11200: <div class="orderedlist">
11201: <ol type="1">
11202: <li>
1.14 xtraeme 11203: <p>Include <code class=
11204: "filename">../../databases/shared-mime-info/mimedb.mk</code>
11205: (avoid using the <code class=
11206: "filename">buildlink3.mk</code> file from this
11207: same directory, which is reserved for inclusion
11208: from other <code class=
11209: "filename">buildlink3.mk</code> files). It takes
11210: care of rebuilding the MIME database at
11211: installation and deinstallation time, and
11212: disallows any access to it directly from the
1.1 grant 11213: package.</p>
11214: </li>
11215:
11216: <li>
11217: <p>Check the PLIST and remove any entries under
1.14 xtraeme 11218: the <code class="filename">share/mime</code>
1.1 grant 11219: directory, <span class=
11220: "emphasis"><em>except</em></span> for files saved
1.14 xtraeme 11221: under <code class=
11222: "filename">share/mime/packages</code>. The former
1.1 grant 11223: are handled automatically by the
11224: update-mime-database program, but the later are
11225: package-dependent and must be removed by the
11226: package that installed them in the first
11227: place.</p>
11228: </li>
11229:
11230: <li>
1.14 xtraeme 11231: <p>Remove any <code class=
11232: "filename">share/mime/*</code> directories from
11233: the PLIST. They will be handled by the
1.1 grant 11234: shared-mime-info package.</p>
11235: </li>
11236: </ol>
11237: </div>
11238: </div>
11239:
11240: <div class="sect2" lang="en" xml:lang="en">
11241: <div class="titlepage">
11242: <div>
11243: <div>
1.30 wiz 11244: <h3 class="title"><a name="intltool" id=
11245: "intltool"></a>13.5.17. Packages using
1.1 grant 11246: intltool</h3>
11247: </div>
11248: </div>
11249: </div>
11250:
11251: <p>If a package uses intltool during its build, include
1.14 xtraeme 11252: the <code class=
11253: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 11254: file, which forces it to use the intltool package
11255: provided by pkgsrc, instead of the one bundled with the
11256: distribution file.</p>
11257:
11258: <p>This tracks intltool's build-time dependencies and
11259: uses the latest available version; this way, the
11260: package benefits of any bug fixes that may have
11261: appeared since it was released.</p>
11262: </div>
1.18 xtraeme 11263:
11264: <div class="sect2" lang="en" xml:lang="en">
11265: <div class="titlepage">
11266: <div>
11267: <div>
1.30 wiz 11268: <h3 class="title"><a name="startup-scripts" id=
11269: "startup-scripts"></a>13.5.18. Packages
11270: installing startup scripts</h3>
1.18 xtraeme 11271: </div>
11272: </div>
11273: </div>
11274:
11275: <p>If a package contains a rc.d script, it won't be
11276: copied into the startup directory by default, but you
11277: can enable it, by adding the option <code class=
11278: "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
11279: "filename">/etc/mk.conf</code>. This option will copy
11280: the scripts into <code class=
11281: "filename">/etc/rc.d</code> when a package is
11282: installed, and it will automatically remove the scripts
11283: when the package is deinstalled.</p>
11284: </div>
1.1 grant 11285: </div>
11286:
11287: <div class="sect1" lang="en" xml:lang="en">
11288: <div class="titlepage">
11289: <div>
11290: <div>
11291: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11292: "feedback-to-author" id=
11293: "feedback-to-author"></a>13.6. Feedback to the
11294: author</h2>
1.1 grant 11295: </div>
11296: </div>
11297: </div>
11298:
11299: <p>If you have found any bugs in the package you make
11300: available, if you had to do special steps to make it run
11301: under NetBSD or if you enhanced the software in various
11302: other ways, be sure to report these changes back to the
11303: original author of the program! With that kind of
11304: support, the next release of the program can incorporate
11305: these fixes, and people not using the NetBSD packages
11306: system can win from your efforts.</p>
11307:
11308: <p>Support the idea of free software!</p>
11309: </div>
11310: </div>
11311:
11312: <div class="chapter" lang="en" xml:lang="en">
11313: <div class="titlepage">
11314: <div>
11315: <div>
11316: <h2 class="title"><a name="debug" id=
1.25 rillig 11317: "debug"></a>Chapter 14. Debugging</h2>
1.1 grant 11318: </div>
11319: </div>
11320: </div>
11321:
11322: <p>To check out all the gotchas when building a package,
11323: here are the steps that I do in order to get a package
11324: working. Please note this is basically the same as what was
11325: explained in the previous sections, only with some
11326: debugging aids.</p>
11327:
11328: <div class="itemizedlist">
11329: <ul type="disc">
11330: <li>
1.14 xtraeme 11331: <p>Be sure to set <code class=
11332: "varname">PKG_DEVELOPER=1</code> in <code class=
11333: "filename">/etc/mk.conf</code></p>
1.1 grant 11334: </li>
11335:
11336: <li>
11337: <p>Install <a xmlns=
11338: "http://www.w3.org/TR/xhtml1/transitional" href=
11339: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20 ben 11340: class="pkgname">pkgtools/url2pkg</a>, create a
11341: directory for a new package, change into it, then run
11342: <span><strong class=
11343: "command">url2pkg</strong></span>:</p>
1.1 grant 11344: <pre class="screen">
1.14 xtraeme 11345: <code class="prompt">%</code> <strong class=
11346: "userinput"><code>mkdir /usr/pkgsrc/<em class=
11347: "replaceable"><code>category</code></em>/<em class=
11348: "replaceable"><code>examplepkg</code></em></code></strong>
11349: <code class="prompt">%</code> <strong class=
11350: "userinput"><code>cd /usr/pkgsrc/<em class=
11351: "replaceable"><code>category</code></em>/<em class=
11352: "replaceable"><code>examplepkg</code></em></code></strong>
11353: <code class="prompt">%</code> <strong class=
11354: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 11355: </pre>
11356: </li>
11357:
11358: <li>
1.14 xtraeme 11359: <p>Edit the <code class="filename">Makefile</code> as
1.1 grant 11360: requested.</p>
11361: </li>
11362:
11363: <li>
1.14 xtraeme 11364: <p>Fill in the <code class="filename">DESCR</code>
1.1 grant 11365: file</p>
11366: </li>
11367:
11368: <li>
1.14 xtraeme 11369: <p>Run <span><strong class="command">make
11370: configure</strong></span></p>
1.1 grant 11371: </li>
11372:
11373: <li>
11374: <p>Add any dependencies glimpsed from documentation
1.14 xtraeme 11375: and the configure step to the package's <code class=
11376: "filename">Makefile</code>.</p>
1.1 grant 11377: </li>
11378:
11379: <li>
11380: <p>Make the package compile, doing multiple rounds
11381: of</p>
11382: <pre class="screen">
1.14 xtraeme 11383: <code class="prompt">%</code> <strong class=
11384: "userinput"><code>make</code></strong>
11385: <code class="prompt">%</code> <strong class=
11386: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
11387: <code class="prompt">%</code> <strong class=
11388: "userinput"><code>mkpatches</code></strong>
11389: <code class="prompt">%</code> <strong class=
11390: "userinput"><code>patchdiff</code></strong>
11391: <code class="prompt">%</code> <strong class=
11392: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
11393: <code class="prompt">%</code> <strong class=
11394: "userinput"><code>make mps</code></strong>
11395: <code class="prompt">%</code> <strong class=
11396: "userinput"><code>make clean</code></strong>
1.1 grant 11397: </pre>
11398:
11399: <p>Doing as non-root user will ensure that no files
11400: are modified that shouldn't be, especially during the
1.14 xtraeme 11401: build phase. <span><strong class=
11402: "command">mkpatches</strong></span>,
11403: <span><strong class=
11404: "command">patchdiff</strong></span> and
11405: <span><strong class="command">pkgvi</strong></span>
11406: are from the <a xmlns=
1.1 grant 11407: "http://www.w3.org/TR/xhtml1/transitional" href=
11408: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 11409: class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1 grant 11410: </li>
11411:
11412: <li>
1.14 xtraeme 11413: <p>Look at the <code class=
11414: "filename">Makefile</code>, fix if necessary; see
11415: <a href="#components.Makefile" title=
1.27 rillig 11416: "7.1. Makefile">Section 7.1,
1.14 xtraeme 11417: “<code class=
11418: "filename">Makefile</code>”</a>.</p>
1.1 grant 11419: </li>
11420:
11421: <li>
1.14 xtraeme 11422: <p>Generate a <code class=
11423: "filename">PLIST</code>:</p>
1.1 grant 11424: <pre class="screen">
1.14 xtraeme 11425: <code class="prompt">#</code> <strong class=
11426: "userinput"><code>make install</code></strong>
11427: <code class="prompt">#</code> <strong class=
11428: "userinput"><code>make print-PLIST >PLIST</code></strong>
11429: <code class="prompt">#</code> <strong class=
11430: "userinput"><code>make deinstall</code></strong>
11431: <code class="prompt">#</code> <strong class=
11432: "userinput"><code>make install</code></strong>
11433: <code class="prompt">#</code> <strong class=
11434: "userinput"><code>make deinstall</code></strong>
1.1 grant 11435: </pre>
11436:
1.14 xtraeme 11437: <p>You usually need to be <code class=
11438: "username">root</code> to do this. Look if there are
1.1 grant 11439: any files left:</p>
11440: <pre class="screen">
1.14 xtraeme 11441: <code class="prompt">#</code> <strong class=
11442: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 11443: </pre>
11444:
11445: <p>If this reveals any files that are missing in
1.14 xtraeme 11446: <code class="filename">PLIST</code>, add them.</p>
1.1 grant 11447: </li>
11448:
11449: <li>
1.14 xtraeme 11450: <p>Now that the <code class="filename">PLIST</code>
11451: is OK, install the package again and make a binary
1.1 grant 11452: package:</p>
11453: <pre class="screen">
1.14 xtraeme 11454: <code class="prompt">#</code> <strong class=
11455: "userinput"><code>make reinstall</code></strong>
11456: <code class="prompt">#</code> <strong class=
11457: "userinput"><code>make package</code></strong>
1.1 grant 11458: </pre>
11459: </li>
11460:
11461: <li>
11462: <p>Delete the installed package:</p>
11463: <pre class="screen">
1.14 xtraeme 11464: <code class="prompt">#</code> <strong class=
11465: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 11466: </pre>
11467: </li>
11468:
11469: <li>
1.14 xtraeme 11470: <p>Repeat the above <span><strong class=
11471: "command">make print-PLIST</strong></span> command,
11472: which shouldn't find anything now:</p>
1.1 grant 11473: <pre class="screen">
1.14 xtraeme 11474: <code class="prompt">#</code> <strong class=
11475: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 11476: </pre>
11477: </li>
11478:
11479: <li>
11480: <p>Reinstall the binary package:</p>
11481: <pre class="screen">
1.14 xtraeme 11482: <code class="prompt">#</code> <strong class=
11483: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 11484: </pre>
11485: </li>
11486:
11487: <li>
11488: <p>Play with it. Make sure everything works.</p>
11489: </li>
11490:
11491: <li>
1.14 xtraeme 11492: <p>Run <span><strong class=
11493: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 11494: "http://www.w3.org/TR/xhtml1/transitional" href=
11495: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 11496: class="pkgname">pkgtools/pkglint</a>, and fix the
11497: problems it reports:</p>
1.1 grant 11498: <pre class="screen">
1.14 xtraeme 11499: <code class="prompt">#</code> <strong class=
11500: "userinput"><code>pkglint</code></strong>
1.1 grant 11501: </pre>
11502: </li>
11503:
11504: <li>
11505: <p>Submit (or commit, if you have cvs access); see
11506: <a href="#submit" title=
1.25 rillig 11507: "Chapter 15. Submitting and Committing">Chapter 15,
1.1 grant 11508: <i>Submitting and Committing</i></a>.</p>
11509: </li>
11510: </ul>
11511: </div>
11512: </div>
11513:
11514: <div class="chapter" lang="en" xml:lang="en">
11515: <div class="titlepage">
11516: <div>
11517: <div>
11518: <h2 class="title"><a name="submit" id=
1.25 rillig 11519: "submit"></a>Chapter 15. Submitting and
1.1 grant 11520: Committing</h2>
11521: </div>
11522: </div>
11523: </div>
11524:
11525: <div class="toc">
11526: <p><b>Table of Contents</b></p>
11527:
11528: <dl>
1.30 wiz 11529: <dt><span class="sect1"><a href=
11530: "#submitting-your-package">15.1. Submitting your
11531: packages</a></span></dt>
1.1 grant 11532:
1.30 wiz 11533: <dt><span class="sect1"><a href=
11534: "#committing-importing">15.2. Committing: Importing a
11535: package into CVS</a></span></dt>
1.1 grant 11536:
1.30 wiz 11537: <dt><span class="sect1"><a href=
11538: "#updating-package">15.3. Updating a package to a newer
11539: version</a></span></dt>
1.1 grant 11540:
1.30 wiz 11541: <dt><span class="sect1"><a href="#moving-package">15.4.
1.2 hubertf 11542: Moving a package in pkgsrc</a></span></dt>
1.1 grant 11543: </dl>
11544: </div>
11545:
11546: <div class="sect1" lang="en" xml:lang="en">
11547: <div class="titlepage">
11548: <div>
11549: <div>
11550: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11551: "submitting-your-package" id=
11552: "submitting-your-package"></a>15.1. Submitting
11553: your packages</h2>
1.1 grant 11554: </div>
11555: </div>
11556: </div>
11557:
11558: <p>You have to separate between binary and
11559: “<span class="quote">normal</span>” (source)
11560: packages here:</p>
11561:
11562: <div class="itemizedlist">
11563: <ul type="disc">
11564: <li>
11565: <p>precompiled binary packages</p>
11566:
11567: <p>Our policy is that we accept binaries only from
11568: pkgsrc developers to guarantee that the packages
11569: don't contain any trojan horses etc. This is not to
1.13 hubertf 11570: annoy anyone but rather to protect our users!
1.1 grant 11571: You're still free to put up your home-made binary
1.13 hubertf 11572: packages and tell the world where to get them.
11573: NetBSD developers doing bulk builds and wanting to
11574: upload them please see <a href="#bulk-upload"
11575: title="5.3.8. Uploading results of a bulk build">
11576: Section 5.3.8, “Uploading results of a
11577: bulk build”</a>.</p>
1.1 grant 11578: </li>
11579:
11580: <li>
11581: <p>packages</p>
11582:
11583: <p>First, check that your package is complete,
11584: compiles and runs well; see <a href="#debug" title=
1.25 rillig 11585: "Chapter 14. Debugging">Chapter 14,
1.1 grant 11586: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 11587: Next, generate an uuencoded gzipped <a href=
11588: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
11589: <span class="citerefentry"><span class=
11590: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 11591: preferably with all files in a single directory.
1.14 xtraeme 11592: Finally, <span><strong class=
11593: "command">send-pr</strong></span> with category
1.1 grant 11594: “<span class="quote">pkg</span>”, a
11595: synopsis which includes the package name and
11596: version number, a short description of your package
11597: (contents of the COMMENT variable or DESCR file are
11598: OK) and attach the archive to your PR.</p>
11599:
11600: <p>If you want to submit several packages, please
11601: send a separate PR for each one, it's easier for us
11602: to track things that way.</p>
11603:
11604: <p>Alternatively, you can also import new packages
11605: into pkgsrc-wip (“<span class="quote">pkgsrc
11606: work-in-progress</span>”); see the homepage
11607: at <a href="http://pkgsrc-wip.sourceforge.net/"
11608: target=
11609: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
11610: details.</p>
11611: </li>
11612: </ul>
11613: </div>
11614: </div>
11615:
11616: <div class="sect1" lang="en" xml:lang="en">
11617: <div class="titlepage">
11618: <div>
11619: <div>
11620: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11621: "committing-importing" id=
11622: "committing-importing"></a>15.2. Committing:
11623: Importing a package into CVS</h2>
1.1 grant 11624: </div>
11625: </div>
11626: </div>
11627:
11628: <p>This section is only of interest for pkgsrc developers
11629: with write access to the pkgsrc repository. Please
11630: remember that cvs imports files relative to the current
11631: working directory, and that the pathname that you give
1.14 xtraeme 11632: the <span><strong class="command">cvs
11633: import</strong></span> command is so that it knows where
11634: to place the files in the repository. Newly created
11635: packages should be imported with a vendor tag of
11636: “<span class="quote">TNF</span>” and a
11637: release tag of “<span class=
11638: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 11639: <pre class="programlisting">
11640: % cd .../pkgsrc/category/pkgname
11641: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
11642: </pre>
11643:
11644: <p>Remember to move the directory from which you imported
11645: out of the way, or cvs will complain the next time you
11646: “<span class="quote">cvs update</span>” your
11647: source tree. Also don't forget to add the new package to
1.14 xtraeme 11648: the category's <code class=
11649: "filename">Makefile</code>.</p>
1.1 grant 11650:
11651: <p>The commit message of the initial import should
1.14 xtraeme 11652: include part of the <code class="filename">DESCR</code>
11653: file, so people reading the mailing lists know what the
11654: package is/does.</p>
1.1 grant 11655:
11656: <p>Please note all package updates/additions in
1.14 xtraeme 11657: <code class="filename">pkgsrc/doc/CHANGES</code>. It's
11658: very important to keep this file up to date and
11659: conforming to the existing format, because it will be
11660: used by scripts to automatically update pages on <a href=
1.1 grant 11661: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
11662: and other sites. Additionally, check the pkgsrc/doc/TODO
11663: file and remove the entry for the package you updated, in
11664: case it was mentioned there.</p>
11665:
11666: <p>For new packages, “<span class="quote">cvs
11667: import</span>” is preferred to “<span class=
11668: "quote">cvs add</span>” because the former gets
11669: everything with a single command, and provides a
11670: consistent tag.</p>
11671: </div>
11672:
11673: <div class="sect1" lang="en" xml:lang="en">
11674: <div class="titlepage">
11675: <div>
11676: <div>
11677: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11678: "updating-package" id=
11679: "updating-package"></a>15.3. Updating a
11680: package to a newer version</h2>
1.1 grant 11681: </div>
11682: </div>
11683: </div>
11684:
11685: <p>Please always put a concise, appropriate and relevant
11686: summary of the changes between old and new versions into
11687: the commit log when updating a package. There are various
11688: reasons for this:</p>
11689:
11690: <div class="itemizedlist">
11691: <ul type="disc">
11692: <li>
11693: <p>A URL is volatile, and can change over time. It
11694: may go away completely or its information may be
11695: overwritten by newer information.</p>
11696: </li>
11697:
11698: <li>
11699: <p>Having the change information between old and
11700: new versions in our CVS repository is very useful
11701: for people who use either cvs or anoncvs.</p>
11702: </li>
11703:
11704: <li>
11705: <p>Having the change information between old and
11706: new versions in our CVS repository is very useful
11707: for people who read the pkgsrc-changes mailing
11708: list, so that they can make tactical decisions
11709: about when to upgrade the package.</p>
11710: </li>
11711: </ul>
11712: </div>
11713:
1.18 xtraeme 11714: <p>Please also recognize that, just because a new version
1.1 grant 11715: of a package has been released, it should not
11716: automatically be upgraded in the CVS repository. We
11717: prefer to be conservative in the packages that are
11718: included in pkgsrc - development or beta packages are not
11719: really the best thing for most places in which pkgsrc is
11720: used. Please use your judgement about what should go into
11721: pkgsrc, and bear in mind that stability is to be
11722: preferred above new and possibly untested features.</p>
11723: </div>
11724:
11725: <div class="sect1" lang="en" xml:lang="en">
11726: <div class="titlepage">
11727: <div>
11728: <div>
11729: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11730: "moving-package" id=
11731: "moving-package"></a>15.4. Moving a package in
11732: pkgsrc</h2>
1.1 grant 11733: </div>
11734: </div>
11735: </div>
11736:
11737: <div class="orderedlist">
11738: <ol type="1">
11739: <li>
11740: <p>Make a copy of the directory somewhere else.</p>
11741: </li>
11742:
11743: <li>
11744: <p>Remove all CVS dirs.</p>
11745:
11746: <p>Alternatively to the first two steps you can
11747: also do:</p>
11748: <pre class="screen">
1.14 xtraeme 11749: <code class="prompt">%</code> <strong class=
11750: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 11751: </pre>
11752:
11753: <p>and use that for further work.</p>
11754: </li>
11755:
11756: <li>
1.14 xtraeme 11757: <p>Fix <code class="varname">CATEGORIES</code> and
11758: any <code class="varname">DEPENDS</code> paths that
11759: just did “<span class=
1.1 grant 11760: "quote">../package</span>” instead of
11761: “<span class=
11762: "quote">../../category/package</span>”.</p>
11763: </li>
11764:
11765: <li>
1.14 xtraeme 11766: <p><span><strong class="command">cvs
11767: import</strong></span> the modified package in the
11768: new place.</p>
1.1 grant 11769: </li>
11770:
11771: <li>
11772: <p>Check if any package depends on it:</p>
11773: <pre class="screen">
1.14 xtraeme 11774: <code class="prompt">%</code> <strong class=
11775: "userinput"><code>cd /usr/pkgsrc</code></strong>
11776: <code class="prompt">%</code> <strong class=
11777: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 11778: </pre>
11779: </li>
11780:
11781: <li>
11782: <p>Fix paths in packages from step 5 to point to
11783: new location.</p>
11784: </li>
11785:
11786: <li>
1.14 xtraeme 11787: <p><span><strong class="command">cvs rm
11788: (-f)</strong></span> the package at the old
11789: location.</p>
1.1 grant 11790: </li>
11791:
11792: <li>
1.14 xtraeme 11793: <p>Remove from <code class=
11794: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 11795: </li>
11796:
11797: <li>
1.14 xtraeme 11798: <p>Add to <code class=
11799: "filename">newcategory/Makefile</code>.</p>
1.1 grant 11800: </li>
11801:
11802: <li>
11803: <p>Commit the changed and removed files:</p>
11804: <pre class="screen">
1.14 xtraeme 11805: <code class="prompt">%</code> <strong class=
11806: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 11807: </pre>
11808:
11809: <p>(and any packages from step 5, of course).</p>
11810: </li>
11811: </ol>
11812: </div>
11813: </div>
11814: </div>
11815: </div>
11816:
11817: <div class="appendix" lang="en" xml:lang="en">
11818: <div class="titlepage">
11819: <div>
11820: <div>
11821: <h2 class="title"><a name="examples" id=
11822: "examples"></a>Appendix A. A simple example
11823: package: bison</h2>
11824: </div>
11825: </div>
11826: </div>
11827:
11828: <div class="toc">
11829: <p><b>Table of Contents</b></p>
11830:
11831: <dl>
1.30 wiz 11832: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 11833: files</a></span></dt>
11834:
11835: <dd>
11836: <dl>
1.30 wiz 11837: <dt><span class="sect2"><a href=
11838: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 11839:
1.30 wiz 11840: <dt><span class="sect2"><a href=
11841: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 11842:
1.30 wiz 11843: <dt><span class="sect2"><a href=
11844: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 11845:
1.30 wiz 11846: <dt><span class="sect2"><a href=
11847: "#checking-package-with-pkglint">A.1.4. Checking a
11848: package with <span><strong class=
1.14 xtraeme 11849: "command">pkglint</strong></span></a></span></dt>
1.1 grant 11850: </dl>
11851: </dd>
11852:
1.30 wiz 11853: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
11854: Steps for building, installing, packaging</a></span></dt>
1.1 grant 11855: </dl>
11856: </div>
11857:
11858: <p>We checked to find a piece of software that wasn't in the
11859: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 11860: would want to have <span><strong class=
11861: "command">bison</strong></span> when Berkeley
11862: <span><strong class="command">yacc</strong></span> is already
11863: present in the tree is beyond us, but it's useful for the
11864: purposes of this exercise.</p>
1.1 grant 11865:
11866: <div class="sect1" lang="en" xml:lang="en">
11867: <div class="titlepage">
11868: <div>
11869: <div>
11870: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11871: "example-files" id=
11872: "example-files"></a>A.1. files</h2>
1.1 grant 11873: </div>
11874: </div>
11875: </div>
11876:
11877: <div class="sect2" lang="en" xml:lang="en">
11878: <div class="titlepage">
11879: <div>
11880: <div>
1.30 wiz 11881: <h3 class="title"><a name="example-Makefile" id=
11882: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 11883: </div>
11884: </div>
11885: </div>
11886: <pre class="programlisting">
1.17 sketch 11887: # $NetBSD$
1.1 grant 11888: #
11889:
11890: DISTNAME= bison-1.25
11891: CATEGORIES= devel
11892: MASTER_SITES= ${MASTER_SITE_GNU}
11893:
11894: MAINTAINER= thorpej@NetBSD.org
11895: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
11896: COMMENT= GNU yacc clone
11897:
11898: GNU_CONFIGURE= yes
11899: INFO_FILES= bison.info
11900:
11901: .include "../../mk/bsd.pkg.mk"
11902: </pre>
11903: </div>
11904:
11905: <div class="sect2" lang="en" xml:lang="en">
11906: <div class="titlepage">
11907: <div>
11908: <div>
1.30 wiz 11909: <h3 class="title"><a name="example-descr" id=
11910: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 11911: </div>
11912: </div>
11913: </div>
11914: <pre class="programlisting">
11915: GNU version of yacc. Can make re-entrant parsers, and numerous other
11916: improvements. Why you would want this when Berkeley <a href=
11917: "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
11918: of the NetBSD source tree is beyond me.
11919: </pre>
11920: </div>
11921:
11922: <div class="sect2" lang="en" xml:lang="en">
11923: <div class="titlepage">
11924: <div>
11925: <div>
1.30 wiz 11926: <h3 class="title"><a name="example-plist" id=
11927: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 11928: </div>
11929: </div>
11930: </div>
11931: <pre class="programlisting">
1.17 sketch 11932: @comment $NetBSD$
1.1 grant 11933: bin/bison
11934: man/man1/bison.1.gz
11935: share/bison.simple
11936: share/bison.hairy
11937: </pre>
11938: </div>
11939:
11940: <div class="sect2" lang="en" xml:lang="en">
11941: <div class="titlepage">
11942: <div>
11943: <div>
1.30 wiz 11944: <h3 class="title"><a name=
11945: "checking-package-with-pkglint" id=
11946: "checking-package-with-pkglint"></a>A.1.4. Checking
11947: a package with <span><strong class=
1.14 xtraeme 11948: "command">pkglint</strong></span></h3>
1.1 grant 11949: </div>
11950: </div>
11951: </div>
11952:
11953: <p>The NetBSD package system comes with <a xmlns=
11954: "http://www.w3.org/TR/xhtml1/transitional" href=
11955: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 11956: class="pkgname">pkgtools/pkglint</a> which helps to check
11957: the contents of these files. After installation it is
11958: quite easy to use, just change to the directory of the
11959: package you wish to examine and execute
11960: <span><strong class=
11961: "command">pkglint</strong></span>:</p>
1.1 grant 11962: <pre class="screen">
1.14 xtraeme 11963: <code class="prompt">$</code> <strong class=
11964: "userinput"><code>pkglint</code></strong>
1.1 grant 11965: looks fine.
11966: </pre>
11967:
11968: <p>Depending on the supplied command line arguments (see
11969: pkglint(1)) more verbose checks will be performed. Use
1.14 xtraeme 11970: e.g. <span><strong class="command">pkglint
11971: -v</strong></span> for a very verbose check.</p>
1.1 grant 11972: </div>
11973: </div>
11974:
11975: <div class="sect1" lang="en" xml:lang="en">
11976: <div class="titlepage">
11977: <div>
11978: <div>
11979: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11980: "steps-for-b-i-p" id=
11981: "steps-for-b-i-p"></a>A.2. Steps for building,
11982: installing, packaging</h2>
1.1 grant 11983: </div>
11984: </div>
11985: </div>
11986:
11987: <p>Create the directory where the package lives, plus any
11988: auxiliary directories:</p>
11989: <pre class="screen">
1.14 xtraeme 11990: <code class="prompt">#</code> <strong class=
11991: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
11992: <code class="prompt">#</code> <strong class=
11993: "userinput"><code>mkdir bison</code></strong>
11994: <code class="prompt">#</code> <strong class=
11995: "userinput"><code>cd bison</code></strong>
11996: <code class="prompt">#</code> <strong class=
11997: "userinput"><code>mkdir patches</code></strong>
1.1 grant 11998: </pre>
11999:
1.14 xtraeme 12000: <p>Create <code class="filename">Makefile</code>,
12001: <code class="filename">DESCR</code> and <code class=
12002: "filename">PLIST</code> (see <a href="#components" title=
1.27 rillig 12003: "Chapter 7. Package components - files, directories and contents">
12004: Chapter 7, <i>Package components - files, directories and
1.1 grant 12005: contents</i></a>) then continue with fetching the
12006: distfile:</p>
12007: <pre class="screen">
1.14 xtraeme 12008: <code class="prompt">#</code> <strong class=
12009: "userinput"><code>make fetch</code></strong>
1.1 grant 12010: >> bison-1.25.tar.gz doesn't seem to exist on this system.
12011: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
12012: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
12013: ftp: Error retrieving file: 500 Internal error
12014:
12015: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
12016: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
12017: ftp: Error retrieving file: 500 Internal error
12018:
12019: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
12020: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
12021: Successfully retrieved file.
12022: </pre>
12023:
1.14 xtraeme 12024: <p>Generate the checksum of the distfile into <code class=
12025: "filename">distinfo</code>:</p>
1.1 grant 12026: <pre class="screen">
1.14 xtraeme 12027: <code class="prompt">#</code> <strong class=
12028: "userinput"><code>make makesum</code></strong>
1.1 grant 12029: </pre>
12030:
12031: <p>Now compile:</p>
12032: <pre class="screen">
1.14 xtraeme 12033: <code class="prompt">#</code> <strong class=
12034: "userinput"><code>make</code></strong>
1.1 grant 12035: >> Checksum OK for bison-1.25.tar.gz.
12036: ===> Extracting for bison-1.25
12037: ===> Patching for bison-1.25
12038: ===> Ignoring empty patch directory
12039: ===> Configuring for bison-1.25
12040: creating cache ./config.cache
12041: checking for gcc... cc
12042: checking whether we are using GNU C... yes
12043: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
12044: checking how to run the C preprocessor... cc -E
12045: checking for minix/config.h... no
12046: checking for POSIXized ISC... no
12047: checking whether cross-compiling... no
12048: checking for ANSI C header files... yes
12049: checking for string.h... yes
12050: checking for stdlib.h... yes
12051: checking for memory.h... yes
12052: checking for working const... yes
12053: checking for working alloca.h... no
12054: checking for alloca... yes
12055: checking for strerror... yes
12056: updating cache ./config.cache
12057: creating ./config.status
12058: creating Makefile
12059: ===> Building for bison-1.25
12060: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g LR0.c
12061: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g allocate.c
12062: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g closure.c
12063: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g conflicts.c
12064: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g derives.c
12065: 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
12066: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getargs.c
12067: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g gram.c
12068: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lalr.c
12069: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lex.c
12070: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g main.c
12071: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g nullable.c
12072: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g output.c
12073: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g print.c
12074: 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
12075: 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
12076: 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
12077: 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
12078: 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
12079: 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
12080: 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
12081: 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
12082: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
12083: rm -f bison.s1
12084: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
12085: </pre>
12086:
12087: <p>Everything seems OK, so install the files:</p>
12088: <pre class="screen">
1.14 xtraeme 12089: <code class="prompt">#</code> <strong class=
12090: "userinput"><code>make install</code></strong>
1.1 grant 12091: >> Checksum OK for bison-1.25.tar.gz.
12092: ===> Installing for bison-1.25
12093: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
12094: rm -f /usr/pkg/bin/bison
12095: cd /usr/pkg/share; rm -f bison.simple bison.hairy
12096: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
12097: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
12098: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
12099: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
12100: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
12101: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
12102: ===> Registering installation for bison-1.25
12103: </pre>
12104:
12105: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 12106: remove it with <span><strong class="command">pkg_delete
12107: bison</strong></span>. Should you decide that you want a
12108: binary package, do this now:</p>
1.1 grant 12109: <pre class="screen">
1.14 xtraeme 12110: <code class="prompt">#</code> <strong class=
12111: "userinput"><code>make package</code></strong>
1.1 grant 12112: >> Checksum OK for bison-1.25.tar.gz.
12113: ===> Building package for bison-1.25
12114: Creating package bison-1.25.tgz
12115: Registering depends:.
12116: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
12117: </pre>
12118:
12119: <p>Now that you don't need the source and object files any
12120: more, clean up:</p>
12121: <pre class="screen">
1.14 xtraeme 12122: <code class="prompt">#</code> <strong class=
12123: "userinput"><code>make clean</code></strong>
1.1 grant 12124: ===> Cleaning for bison-1.25
12125: </pre>
12126: </div>
12127: </div>
12128:
12129: <div class="appendix" lang="en" xml:lang="en">
12130: <div class="titlepage">
12131: <div>
12132: <div>
12133: <h2 class="title"><a name="logs" id=
12134: "logs"></a>Appendix B. Build logs</h2>
12135: </div>
12136: </div>
12137: </div>
12138:
12139: <div class="toc">
12140: <p><b>Table of Contents</b></p>
12141:
12142: <dl>
12143: <dt><span class="sect1"><a href="#logs.building">B.1.
12144: Building figlet</a></span></dt>
12145:
12146: <dt><span class="sect1"><a href="#logs.package">B.2.
12147: Packaging figlet</a></span></dt>
12148: </dl>
12149: </div>
12150:
12151: <div class="sect1" lang="en" xml:lang="en">
12152: <div class="titlepage">
12153: <div>
12154: <div>
12155: <h2 class="title" style="clear: both"><a name=
12156: "logs.building" id=
12157: "logs.building"></a>B.1. Building figlet</h2>
12158: </div>
12159: </div>
12160: </div>
12161: <pre class="screen">
1.14 xtraeme 12162: <code class="prompt">#</code> <strong class=
12163: "userinput"><code>make</code></strong>
1.1 grant 12164: ===> Checking for vulnerabilities in figlet-2.2.1nb2
12165: => figlet221.tar.gz doesn't seem to exist on this system.
12166: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
12167: => [172219 bytes]
12168: Connected to ftp.plig.net.
12169: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
12170: 331 Guest login ok, send your complete e-mail address as password.
12171: 230-You are user #5 of 500 simultaneous users allowed.
12172: 230-
12173: 230- ___ _ _ _
12174: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
12175: 230- | _| _| . |_| . | | | . |_| . | _| . |
12176: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
12177: 230- |_| |_| |___| |___|
12178: 230-
12179: 230-** Welcome to ftp.plig.org **
12180: 230-
12181: 230-Please note that all transfers from this FTP site are logged. If you
12182: 230-do not like this, please disconnect now.
12183: 230-
12184: 230-This arhive is available via
12185: 230-
12186: 230-HTTP: http://ftp.plig.org/
12187: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
12188: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
12189: 230-
12190: 230-Please email comments, bug reports and requests for packages to be
12191: 230-mirrored to ftp-admin@plig.org.
12192: 230-
12193: 230-
12194: 230 Logged in anonymously.
12195: Remote system type is UNIX.
12196: Using binary mode to transfer files.
12197: 200 Type okay.
12198: 250 "/pub" is new cwd.
12199: 250-"/pub/figlet" is new cwd.
12200: 250-
12201: 250-Welcome to the figlet archive at ftp.figlet.org
12202: 250-
12203: 250- ftp://ftp.figlet.org/pub/figlet/
12204: 250-
12205: 250-The official FIGlet web page is:
12206: 250- http://www.figlet.org/
12207: 250-
12208: 250-If you have questions, please mailto:info@figlet.org. If you want to
12209: 250-contribute a font or something else, you can email us.
12210: 250
12211: 250 "/pub/figlet/program" is new cwd.
12212: 250 "/pub/figlet/program/unix" is new cwd.
12213: local: figlet221.tar.gz remote: figlet221.tar.gz
12214: 502 Unimplemented command.
12215: 227 Entering Passive Mode (195,40,6,41,246,104)
12216: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
12217: 38% |************** | 65800 64.16 KB/s 00:01 ETA
12218: 226 Transfer completed.
12219: 172219 bytes received in 00:02 (75.99 KB/s)
12220: 221 Goodbye.
12221: => Checksum OK for figlet221.tar.gz.
12222: ===> Extracting for figlet-2.2.1nb2
12223: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
12224: ===> Patching for figlet-2.2.1nb2
12225: ===> Applying pkgsrc patches for figlet-2.2.1nb2
12226: ===> Overriding tools for figlet-2.2.1nb2
12227: ===> Creating toolchain wrappers for figlet-2.2.1nb2
12228: ===> Configuring for figlet-2.2.1nb2
12229: ===> Building for figlet-2.2.1nb2
12230: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
12231: chmod a+x figlet
12232: gcc -O2 -o chkfont chkfont.c
12233: => Unwrapping files-to-be-installed.
1.14 xtraeme 12234: <code class="prompt">#</code>
12235: <code class="prompt">#</code> <strong class=
12236: "userinput"><code>make install</code></strong>
1.1 grant 12237: ===> Checking for vulnerabilities in figlet-2.2.1nb2
12238: ===> Installing for figlet-2.2.1nb2
12239: install -d -o root -g wheel -m 755 /usr/pkg/bin
12240: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
12241: mkdir -p /usr/pkg/share/figlet
12242: cp figlet /usr/pkg/bin
12243: cp chkfont /usr/pkg/bin
12244: chmod 555 figlist showfigfonts
12245: cp figlist /usr/pkg/bin
12246: cp showfigfonts /usr/pkg/bin
12247: cp fonts/*.flf /usr/pkg/share/figlet
12248: cp fonts/*.flc /usr/pkg/share/figlet
12249: cp figlet.6 /usr/pkg/man/man6
12250: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 12251: <code class="prompt">#</code>
1.1 grant 12252: </pre>
12253: </div>
12254:
12255: <div class="sect1" lang="en" xml:lang="en">
12256: <div class="titlepage">
12257: <div>
12258: <div>
12259: <h2 class="title" style="clear: both"><a name=
12260: "logs.package" id=
12261: "logs.package"></a>B.2. Packaging figlet</h2>
12262: </div>
12263: </div>
12264: </div>
12265: <pre class="screen">
1.14 xtraeme 12266: <code class="prompt">#</code> <strong class=
12267: "userinput"><code>make package</code></strong>
1.1 grant 12268: ===> Checking for vulnerabilities in figlet-2.2.1nb2
12269: ===> Packaging figlet-2.2.1nb2
12270: ===> Building binary package for figlet-2.2.1nb2
12271: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
12272: Using SrcDir value of /usr/pkg
12273: Registering depends:.
1.14 xtraeme 12274: <code class="prompt">#</code>
1.1 grant 12275: </pre>
12276: </div>
12277: </div>
12278:
12279: <div class="appendix" lang="en" xml:lang="en">
12280: <div class="titlepage">
12281: <div>
12282: <div>
12283: <h2 class="title"><a name="ftp-layout" id=
12284: "ftp-layout"></a>Appendix C. Layout of the
12285: FTP server's package archive</h2>
12286: </div>
12287: </div>
12288: </div>
12289:
12290: <p>Layout for precompiled binary packages on
12291: ftp.NetBSD.org:</p>
12292: <pre class="programlisting">
12293: /pub/NetBSD/packages/
12294: distfiles/
12295:
12296: # Unpacked pkgsrc trees
12297: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
12298: pkgsrc-2003Q4 -> N/A
12299: pkgsrc-2004Q1/pkgsrc
12300:
12301: # pkgsrc archives
12302: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
12303: pkgsrc-2003Q4.tar.gz -> N/A
12304: pkgsrc-2004Q1.tar.gz -> N/A
12305:
12306: # Per pkgsrc-release/OS-release/arch package archives
12307: pkgsrc-2003Q4/
12308: NetBSD-1.6.2/
12309: i386/
12310: All/
12311: archivers/
12312: foo -> ../All/foo
12313: ...
12314: pkgsrc-2004Q1/
12315: NetBSD-1.6.2/
12316: i386/
12317: All/
12318: ...
12319: NetBSD-2.0/
12320: i386/
12321: All/
12322: ...
12323: SunOS-5.9/
12324: sparc/
12325: All/
12326: ...
12327: x86/
12328: All/
12329: ...
12330:
12331: # Per os-release package archive convenience links
12332: NetBSD-1.6.2 -> 1.6.2
12333: 1.6.2/
12334: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
12335: m68k/
12336: All/
12337: archivers/
12338: foo -> ../All/foo
12339: ...
12340: amiga -> m68k
12341: atari -> m68k
12342: ...
12343:
12344: 2.0 -> NetBSD-2.0 # backward compat, historic
12345: NetBSD-2.0/
12346: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
12347: SunOS-5.9/
12348: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
12349: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
12350:
12351: </pre>
12352:
12353: <p>To create:</p>
12354:
12355: <div class="orderedlist">
12356: <ol type="1">
12357: <li>
12358: <p>Run bulk build, see <a href="#bulkbuild" title=
12359: "5.3. Doing a bulk build of all packages">Section
12360: 5.3, “Doing a bulk build of all
12361: packages”</a></p>
12362: </li>
12363:
12364: <li>
12365: <p>Upload /usr/pkgsrc/packages to</p>
12366: <pre class="programlisting">
12367: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13 hubertf 12368: pkgsrc-2004Q4/\ # pkgsrc-branch
1.1 grant 12369: `uname -s`-`uname -r`/ # OS & version
12370: `uname -p` # architecture
12371:
12372: </pre>
12373: </li>
12374:
12375: <li>
1.14 xtraeme 12376: <p>If necessary, create a symlink <span><strong class=
12377: "command">ln -s `uname -m` `uname -p`</strong></span>
12378: (amiga -> m68k, ...)</p>
1.1 grant 12379: </li>
12380: </ol>
12381: </div>
12382: </div>
1.2 hubertf 12383:
12384: <div class="appendix" lang="en" xml:lang="en">
12385: <div class="titlepage">
12386: <div>
12387: <div>
12388: <h2 class="title"><a name="editing" id=
12389: "editing"></a>Appendix D. Editing guidelines
12390: for the pkgsrc guide</h2>
12391: </div>
12392: </div>
12393: </div>
12394:
12395: <div class="toc">
12396: <p><b>Table of Contents</b></p>
12397:
12398: <dl>
1.30 wiz 12399: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 12400: Targets</a></span></dt>
12401:
1.30 wiz 12402: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 12403: Procedure</a></span></dt>
12404: </dl>
12405: </div>
12406:
12407: <p>This section contains information on editing the pkgsrc
12408: guide itself.</p>
12409:
12410: <div class="sect1" lang="en" xml:lang="en">
12411: <div class="titlepage">
12412: <div>
12413: <div>
12414: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12415: "targets" id="targets"></a>D.1. Targets</h2>
1.2 hubertf 12416: </div>
12417: </div>
12418: </div>
12419:
1.14 xtraeme 12420: <p>The pkgsrc guide's source code is stored in <code class=
12421: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 12422: are created from it:</p>
12423:
12424: <div class="itemizedlist">
12425: <ul type="disc">
12426: <li>
1.14 xtraeme 12427: <p><code class=
1.23 wiz 12428: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 12429: </li>
12430:
12431: <li>
1.14 xtraeme 12432: <p><code class=
12433: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 12434: </li>
12435:
12436: <li>
1.14 xtraeme 12437: <p><code class=
12438: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 12439: the documentation on the NetBSD website will be built
12440: from pkgsrc and kept up to date on the web server
12441: itself. This means you <span class=
12442: "emphasis"><em>must</em></span> make sure that your
12443: changes haven't broken the build!</p>
12444: </li>
1.6 hubertf 12445:
12446: <li>
1.14 xtraeme 12447: <p><code class=
12448: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 12449: PDF version of the pkgsrc guide.</p>
12450: </li>
12451:
12452: <li>
1.14 xtraeme 12453: <p><code class=
12454: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 12455: PostScript version of the pkgsrc guide.</p>
12456: </li>
1.2 hubertf 12457: </ul>
12458: </div>
12459: </div>
12460:
12461: <div class="sect1" lang="en" xml:lang="en">
12462: <div class="titlepage">
12463: <div>
12464: <div>
12465: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12466: "procedure" id=
12467: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 12468: </div>
12469: </div>
12470: </div>
12471:
12472: <p>The procedure to edit the pkgsrc guide is:</p>
12473:
12474: <div class="itemizedlist">
12475: <ul type="disc">
12476: <li>
1.6 hubertf 12477: <p>Make sure you have the packages needed to
12478: re-generate the pkgsrc guide (and other XML-based
12479: NetBSD documentation) installed. These are
1.11 ben 12480: “<span class="quote">netbsd-doc</span>”
1.6 hubertf 12481: for creating the ASCII- and HTML-version, and
12482: “<span class=
1.11 ben 12483: "quote">netbsd-doc-print</span>”for the
1.6 hubertf 12484: PostScript- and PDF version. You will need both
12485: packages installed, to make sure documentation is
12486: consistent across all formats. The packages can be
1.14 xtraeme 12487: found in <code class=
12488: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
12489: <code class=
12490: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 12491: </li>
12492:
12493: <li>
1.14 xtraeme 12494: <p>Edit the XML file(s) in <code class=
12495: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 12496: </li>
12497:
12498: <li>
1.14 xtraeme 12499: <p>Run <span><strong class="command">make extract
12500: && make do-lint</strong></span> in
12501: <code class="filename">pkgsrc/doc/guide</code> to
12502: check the XML syntax, and fix it if needed.</p>
1.4 hubertf 12503: </li>
12504:
12505: <li>
1.14 xtraeme 12506: <p>Run <span><strong class=
12507: "command">make</strong></span> in <code class=
12508: "filename">pkgsrc/doc/guide</code> to build the HTML
12509: and ASCII version.</p>
1.2 hubertf 12510: </li>
12511:
12512: <li>
1.14 xtraeme 12513: <p>If all is well, run <span><strong class=
12514: "command">make install-doc</strong></span> to put the
12515: generated files into <code class=
12516: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 12517: </li>
12518:
12519: <li>
1.14 xtraeme 12520: <p><span><strong class="command">cvs commit
12521: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 12522: </li>
12523:
12524: <li>
1.14 xtraeme 12525: <p><span><strong class="command">cvs commit -m
12526: re-generate
12527: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 12528: </li>
1.4 hubertf 12529:
12530: <li>
12531: <p>Until the webserver on www.NetBSD.org is really
12532: updated automatically to pick up changes to the
1.14 xtraeme 12533: pkgsrc guide automatically, also run
1.18 xtraeme 12534: <span><strong class="command">make install-htdocs
1.14 xtraeme 12535: HTDOCSDIR=../../../htdocs</strong></span> (or
12536: similar, adjust <code class=
12537: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 12538: </li>
12539:
12540: <li>
1.14 xtraeme 12541: <p><span><strong class="command">cvs commit
12542: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 12543: </li>
1.2 hubertf 12544: </ul>
12545: </div>
12546: </div>
12547: </div>
1.1 grant 12548: </div>
12549: </body>
12550: </html>
CVSweb <webmaster@jp.NetBSD.org>