Annotation of pkgsrc/doc/pkgsrc.html, revision 1.21
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.20 ben 11: "DocBook XSL Stylesheets V1.68.1" />
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.20 ben 22: <h1 class="title"><a name="id2550988" id=
23: "id2550988"></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:
68: <div>
1.3 hubertf 69: <p class="pubdate">$NetBSD: pkgsrc.xml,v 1.3 2004/10/22
70: 00:24:48 hubertf 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.20 ben 96: <dt><span class="sect1"><a href="#id2516957">1.1.
1.1 grant 97: Introduction</a></span></dt>
98:
99: <dt><span class="sect1"><a href="#overview">1.2.
100: Overview</a></span></dt>
101:
102: <dt><span class="sect1"><a href="#terminology">1.3.
103: Terminology</a></span></dt>
104:
105: <dt><span class="sect1"><a href="#typography">1.4.
106: Typography</a></span></dt>
107: </dl>
108: </dd>
109:
1.2 hubertf 110: <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1 grant 111: user's guide</a></span></dt>
112:
113: <dd>
114: <dl>
115: <dt><span class="chapter"><a href="#getting">2. Where
116: to get pkgsrc</a></span></dt>
117:
118: <dd>
119: <dl>
1.20 ben 120: <dt><span class="sect1"><a href="#id2517611">2.1.
1.1 grant 121: As tar file</a></span></dt>
122:
1.20 ben 123: <dt><span class="sect1"><a href="#id2517627">2.2.
1.1 grant 124: Via SUP</a></span></dt>
125:
1.20 ben 126: <dt><span class="sect1"><a href="#id2517659">2.3.
1.1 grant 127: Via CVS</a></span></dt>
128: </dl>
129: </dd>
130:
131: <dt><span class="chapter"><a href="#platforms">3. Using
132: pkgsrc on systems other than NetBSD</a></span></dt>
133:
134: <dd>
135: <dl>
1.20 ben 136: <dt><span class="sect1"><a href="#id2517769">3.1.
1.1 grant 137: Bootstrapping pkgsrc</a></span></dt>
138:
1.20 ben 139: <dt><span class="sect1"><a href="#id2518019">3.2.
1.1 grant 140: Platform specific notes</a></span></dt>
141:
142: <dd>
143: <dl>
144: <dt><span class="sect2"><a href=
1.20 ben 145: "#id2518025">3.2.1. Darwin (Mac OS
1.1 grant 146: X)</a></span></dt>
147:
148: <dt><span class="sect2"><a href=
1.20 ben 149: "#id2518187">3.2.2. FreeBSD</a></span></dt>
1.1 grant 150:
151: <dt><span class="sect2"><a href=
1.20 ben 152: "#id2518768">3.2.3. Interix</a></span></dt>
1.1 grant 153:
154: <dt><span class="sect2"><a href=
1.20 ben 155: "#id2518926">3.2.4. IRIX</a></span></dt>
1.1 grant 156:
157: <dt><span class="sect2"><a href=
1.20 ben 158: "#id2519044">3.2.5. OpenBSD</a></span></dt>
1.1 grant 159:
160: <dt><span class="sect2"><a href=
1.20 ben 161: "#id2519156">3.2.6. Solaris</a></span></dt>
1.1 grant 162: </dl>
163: </dd>
164: </dl>
165: </dd>
166:
167: <dt><span class="chapter"><a href="#using">4. Using
168: pkgsrc</a></span></dt>
169:
170: <dd>
171: <dl>
172: <dt><span class="sect1"><a href=
173: "#getting-started">4.1. Working with binary
174: packages</a></span></dt>
175:
176: <dd>
177: <dl>
178: <dt><span class="sect2"><a href=
1.20 ben 179: "#id2519292">4.1.1. Where to get binary
1.1 grant 180: packages</a></span></dt>
181:
182: <dt><span class="sect2"><a href=
1.20 ben 183: "#id2519333">4.1.2. How to use binary
1.1 grant 184: packages</a></span></dt>
185:
186: <dt><span class="sect2"><a href=
1.20 ben 187: "#id2519467">4.1.3. A word of
1.1 grant 188: warning</a></span></dt>
189: </dl>
190: </dd>
191:
1.20 ben 192: <dt><span class="sect1"><a href="#id2519479">4.2.
1.1 grant 193: Building packages from source</a></span></dt>
194:
195: <dd>
196: <dl>
197: <dt><span class="sect2"><a href=
1.20 ben 198: "#id2519489">4.2.1.
1.1 grant 199: Requirements</a></span></dt>
200:
201: <dt><span class="sect2"><a href=
1.20 ben 202: "#id2519509">4.2.2. Fetching
1.1 grant 203: distfiles</a></span></dt>
204:
205: <dt><span class="sect2"><a href=
1.20 ben 206: "#id2519561">4.2.3. How to build and
1.1 grant 207: install</a></span></dt>
208:
209: <dt><span class="sect2"><a href=
1.20 ben 210: "#id2520288">4.2.4. Selecting the
1.1 grant 211: compiler</a></span></dt>
212: </dl>
213: </dd>
214: </dl>
215: </dd>
216:
217: <dt><span class="chapter"><a href="#binary">5. Creating
218: binary packages</a></span></dt>
219:
220: <dd>
221: <dl>
1.20 ben 222: <dt><span class="sect1"><a href="#id2520374">5.1.
1.1 grant 223: Building a single binary package</a></span></dt>
224:
1.20 ben 225: <dt><span class="sect1"><a href="#id2585578">5.2.
1.1 grant 226: Settings for creation of binary
227: packages</a></span></dt>
228:
229: <dt><span class="sect1"><a href="#bulkbuild">5.3.
230: Doing a bulk build of all packages</a></span></dt>
231:
232: <dd>
233: <dl>
234: <dt><span class="sect2"><a href=
235: "#binary.configuration">5.3.1.
236: Configuration</a></span></dt>
237:
238: <dt><span class="sect2"><a href=
1.20 ben 239: "#id2585786">5.3.2. Other environmental
1.1 grant 240: considerations</a></span></dt>
241:
242: <dt><span class="sect2"><a href=
1.20 ben 243: "#id2585827">5.3.3. Operation</a></span></dt>
1.1 grant 244:
245: <dt><span class="sect2"><a href=
1.20 ben 246: "#id2585964">5.3.4. What it
1.1 grant 247: does</a></span></dt>
248:
249: <dt><span class="sect2"><a href=
1.20 ben 250: "#id2586021">5.3.5. Disk space
1.1 grant 251: requirements</a></span></dt>
252:
253: <dt><span class="sect2"><a href=
1.20 ben 254: "#id2586048">5.3.6. Setting up a sandbox for
1.1 grant 255: chroot'ed builds</a></span></dt>
256:
257: <dt><span class="sect2"><a href=
1.20 ben 258: "#id2586508">5.3.7. Building a partial set of
1.1 grant 259: packages</a></span></dt>
1.13 hubertf 260:
261: <dt><span class="sect2"><a href=
262: "#bulk-upload">5.3.8. Uploading results of a
263: bulk build</a></span></dt>
1.1 grant 264: </dl>
265: </dd>
266:
1.20 ben 267: <dt><span class="sect1"><a href="#id2586946">5.4.
1.1 grant 268: Creating a multiple CD-ROM packages
269: collection</a></span></dt>
270:
271: <dd>
272: <dl>
273: <dt><span class="sect2"><a href=
1.20 ben 274: "#id2586961">5.4.1. Example of
1.1 grant 275: cdpack</a></span></dt>
276: </dl>
277: </dd>
278: </dl>
279: </dd>
280:
281: <dt><span class="chapter"><a href="#faq">6. Frequently
282: Asked Questions</a></span></dt>
283:
284: <dd>
285: <dl>
1.20 ben 286: <dt><span class="sect1"><a href="#id2587153">6.1.
1.18 xtraeme 287: Are there any mailing lists for pkg-related
1.1 grant 288: discussion?</a></span></dt>
289:
1.20 ben 290: <dt><span class="sect1"><a href="#id2587355">6.2.
1.1 grant 291: Where's the pkgviews documentation?</a></span></dt>
292:
1.5 hubertf 293: <dt><span class="sect1"><a href=
294: "#faq-pkgtools">6.3. Utilities for package
295: management (pkgtools)</a></span></dt>
1.1 grant 296:
1.20 ben 297: <dt><span class="sect1"><a href="#id2587540">6.4.
1.1 grant 298: How to use pkgsrc as non-root</a></span></dt>
299:
1.20 ben 300: <dt><span class="sect1"><a href="#id2587552">6.5.
1.15 xtraeme 301: How to resume transfers when fetching
302: distfiles?</a></span></dt>
1.14 xtraeme 303:
1.20 ben 304: <dt><span class="sect1"><a href="#id2587594">6.6.
1.1 grant 305: How can I install/use XFree86 from
306: pkgsrc?</a></span></dt>
307:
1.20 ben 308: <dt><span class="sect1"><a href="#id2587622">6.7.
1.1 grant 309: How can I install/use X.org from
310: pkgsrc?</a></span></dt>
311:
1.20 ben 312: <dt><span class="sect1"><a href="#id2587650">6.8.
1.1 grant 313: How to fetch files from behind a
314: firewall</a></span></dt>
315:
1.20 ben 316: <dt><span class="sect1"><a href="#id2587664">6.9.
1.14 xtraeme 317: How do I tell <span><strong class="command">make
318: fetch</strong></span> to do passive
1.1 grant 319: FTP?</a></span></dt>
320:
1.20 ben 321: <dt><span class="sect1"><a href="#id2587715">6.10.
1.1 grant 322: How to fetch all distfiles at once</a></span></dt>
323:
1.20 ben 324: <dt><span class="sect1"><a href="#id2587923">6.11.
1.14 xtraeme 325: What does “<span class="quote">Don't know how
326: to make /usr/share/tmac/tmac.andoc</span>”
327: mean?</a></span></dt>
1.13 hubertf 328:
1.20 ben 329: <dt><span class="sect1"><a href="#id2587961">6.12.
1.14 xtraeme 330: What does “<span class="quote">Could not find
331: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 332:
1.20 ben 333: <dt><span class="sect1"><a href="#id2588087">6.13.
1.1 grant 334: Using 'sudo' with pkgsrc</a></span></dt>
335:
1.14 xtraeme 336: <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1 grant 337: Configuration files handling and
338: placement</a></span></dt>
339:
340: <dt><span class="sect1"><a href=
1.14 xtraeme 341: "#audit-packages">6.15. Automated security
1.1 grant 342: checks</a></span></dt>
343: </dl>
344: </dd>
345: </dl>
346: </dd>
347:
1.2 hubertf 348: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 349: pkgsrc developer's guide</a></span></dt>
350:
351: <dd>
352: <dl>
353: <dt><span class="chapter"><a href="#components">7.
354: Package components - files, directories and
355: contents</a></span></dt>
356:
357: <dd>
358: <dl>
359: <dt><span class="sect1"><a href=
1.14 xtraeme 360: "#components.Makefile">7.1. <code class=
361: "filename">Makefile</code></a></span></dt>
1.1 grant 362:
363: <dt><span class="sect1"><a href=
1.14 xtraeme 364: "#components.distinfo">7.2. <code class=
365: "filename">distinfo</code></a></span></dt>
1.1 grant 366:
367: <dt><span class="sect1"><a href=
368: "#components.patches">7.3.
369: patches/*</a></span></dt>
370:
1.20 ben 371: <dt><span class="sect1"><a href="#id2589201">7.4.
1.1 grant 372: Other mandatory files</a></span></dt>
373:
374: <dt><span class="sect1"><a href=
375: "#components.optional">7.5. Optional
376: files</a></span></dt>
377:
1.20 ben 378: <dt><span class="sect1"><a href="#id2589326">7.6.
1.14 xtraeme 379: <code class="filename">work*</code></a></span></dt>
1.1 grant 380:
1.20 ben 381: <dt><span class="sect1"><a href="#id2589482">7.7.
1.14 xtraeme 382: <code class=
383: "filename">files/*</code></a></span></dt>
1.1 grant 384: </dl>
385: </dd>
386:
387: <dt><span class="chapter"><a href="#plist">8. PLIST
388: issues</a></span></dt>
389:
390: <dd>
391: <dl>
1.20 ben 392: <dt><span class="sect1"><a href="#id2589537">8.1.
1.1 grant 393: RCS ID</a></span></dt>
394:
1.20 ben 395: <dt><span class="sect1"><a href="#id2589552">8.2.
1.14 xtraeme 396: Semi-automatic <code class="filename">PLIST</code>
397: generation</a></span></dt>
1.1 grant 398:
399: <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14 xtraeme 400: Tweaking output of <span><strong class=
401: "command">make
402: print-PLIST</strong></span></a></span></dt>
1.1 grant 403:
404: <dt><span class="sect1"><a href="#plist.misc">8.4.
405: Variable substitution in PLIST</a></span></dt>
406:
1.20 ben 407: <dt><span class="sect1"><a href="#id2589941">8.5.
1.1 grant 408: Manpage-compression</a></span></dt>
409:
1.20 ben 410: <dt><span class="sect1"><a href="#id2589982">8.6.
1.14 xtraeme 411: Changing PLIST source with <code class=
412: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 413:
1.20 ben 414: <dt><span class="sect1"><a href="#id2590000">8.7.
1.1 grant 415: Platform specific and differing
416: PLISTs</a></span></dt>
417:
418: <dt><span class="sect1"><a href=
419: "#faq.common-dirs">8.8. Sharing directories between
420: packages</a></span></dt>
421: </dl>
422: </dd>
423:
424: <dt><span class="chapter"><a href="#buildlink">9.
425: Buildlink methodology</a></span></dt>
426:
427: <dd>
428: <dl>
1.21 ! ben 429: <dt><span class="sect1"><a href="#id2590334">9.1.
1.1 grant 430: Converting packages to use
431: buildlink3</a></span></dt>
432:
1.21 ! ben 433: <dt><span class="sect1"><a href="#id2590525">9.2.
1.14 xtraeme 434: Writing <code class="filename">buildlink3.mk</code>
435: files</a></span></dt>
1.1 grant 436:
437: <dd>
438: <dl>
439: <dt><span class="sect2"><a href=
1.21 ! ben 440: "#id2590595">9.2.1. Anatomy of a buildlink3.mk
1.1 grant 441: file</a></span></dt>
442:
443: <dt><span class="sect2"><a href=
1.21 ! ben 444: "#id2591035">9.2.2. Updating <code class=
1.14 xtraeme 445: "varname">BUILDLINK_DEPENDS.<em class=
446: "replaceable"><code>pkg</code></em></code> in
447: <code class="filename">buildlink3.mk</code>
1.1 grant 448: files</a></span></dt>
449: </dl>
450: </dd>
451:
1.21 ! ben 452: <dt><span class="sect1"><a href="#id2591182">9.3.
1.14 xtraeme 453: Writing <code class="filename">builtin.mk</code>
454: files</a></span></dt>
1.1 grant 455:
456: <dd>
457: <dl>
458: <dt><span class="sect2"><a href=
1.21 ! ben 459: "#id2591400">9.3.1. Anatomy of a <code class=
1.14 xtraeme 460: "filename">builtin.mk</code>
1.1 grant 461: file</a></span></dt>
462:
463: <dt><span class="sect2"><a href=
1.21 ! ben 464: "#id2591627">9.3.2. Global preferences for
1.1 grant 465: native or pkgsrc software</a></span></dt>
466: </dl>
467: </dd>
468: </dl>
469: </dd>
470:
471: <dt><span class="chapter"><a href="#options">10.
472: Options handling</a></span></dt>
473:
474: <dd>
475: <dl>
1.21 ! ben 476: <dt><span class="sect1"><a href="#id2591700">10.1.
1.1 grant 477: Global default options</a></span></dt>
478:
1.21 ! ben 479: <dt><span class="sect1"><a href="#id2591715">10.2.
1.14 xtraeme 480: Converting packages to use <code class=
481: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 482: </dl>
483: </dd>
484:
485: <dt><span class="chapter"><a href="#build">11. The
486: build process</a></span></dt>
487:
488: <dd>
489: <dl>
490: <dt><span class="sect1"><a href=
491: "#build.prefix">11.1. Program
492: location</a></span></dt>
493:
1.21 ! ben 494: <dt><span class="sect1"><a href="#id2592323">11.2.
1.1 grant 495: Main targets</a></span></dt>
496:
497: <dt><span class="sect1"><a href=
498: "#build.helpful-targets">11.3. Other helpful
499: targets</a></span></dt>
500: </dl>
501: </dd>
502:
503: <dt><span class="chapter"><a href="#fixes">12. Notes on
504: fixes for packages</a></span></dt>
505:
506: <dd>
507: <dl>
1.21 ! ben 508: <dt><span class="sect1"><a href="#id2593723">12.1.
1.1 grant 509: General operation</a></span></dt>
510:
511: <dd>
512: <dl>
513: <dt><span class="sect2"><a href=
1.21 ! ben 514: "#id2593726">12.1.1. How to pull in variables
1.1 grant 515: from /etc/mk.conf</a></span></dt>
516:
517: <dt><span class="sect2"><a href=
1.21 ! ben 518: "#id2593878">12.1.2. Restricted
1.1 grant 519: packages</a></span></dt>
520:
521: <dt><span class="sect2"><a href=
522: "#dependencies">12.1.3. Handling
523: dependencies</a></span></dt>
524:
525: <dt><span class="sect2"><a href=
1.21 ! ben 526: "#id2594393">12.1.4. Handling conflicts with
1.1 grant 527: other packages</a></span></dt>
528:
529: <dt><span class="sect2"><a href=
1.21 ! ben 530: "#id2594443">12.1.5. Packages that cannot or
1.1 grant 531: should not be built</a></span></dt>
532:
533: <dt><span class="sect2"><a href=
1.21 ! ben 534: "#id2594469">12.1.6. Packages which should not
1.1 grant 535: be deleted, once installed</a></span></dt>
536:
537: <dt><span class="sect2"><a href=
538: "#security-handling">12.1.7. Handling packages
539: with security problems</a></span></dt>
540:
541: <dt><span class="sect2"><a href=
1.21 ! ben 542: "#id2594629">12.1.8. How to handle compiler
1.1 grant 543: bugs</a></span></dt>
544:
545: <dt><span class="sect2"><a href=
1.21 ! ben 546: "#id2594651">12.1.9. How to handle incrementing
1.1 grant 547: versions when fixing an existing
548: package</a></span></dt>
549:
550: <dt><span class="sect2"><a href=
1.21 ! ben 551: "#id2594700">12.1.10. Portability of
1.1 grant 552: packages</a></span></dt>
553: </dl>
554: </dd>
555:
1.21 ! ben 556: <dt><span class="sect1"><a href="#id2594725">12.2.
1.1 grant 557: Possible downloading issues</a></span></dt>
558:
559: <dd>
560: <dl>
561: <dt><span class="sect2"><a href=
1.21 ! ben 562: "#id2594728">12.2.1. Packages whose distfiles
1.1 grant 563: aren't available for plain
564: downloading</a></span></dt>
565:
566: <dt><span class="sect2"><a href=
1.21 ! ben 567: "#id2594791">12.2.2. How to handle modified
1.1 grant 568: distfiles with the 'old' name</a></span></dt>
569: </dl>
570: </dd>
571:
1.21 ! ben 572: <dt><span class="sect1"><a href="#id2594803">12.3.
1.1 grant 573: Configuration gotchas</a></span></dt>
574:
575: <dd>
576: <dl>
577: <dt><span class="sect2"><a href=
578: "#fixes.libtool">12.3.1. Shared libraries -
579: libtool</a></span></dt>
580:
581: <dt><span class="sect2"><a href=
1.21 ! ben 582: "#id2595250">12.3.2. Using libtool on GNU
1.1 grant 583: packages that already support
584: libtool</a></span></dt>
585:
586: <dt><span class="sect2"><a href=
1.21 ! ben 587: "#id2595334">12.3.3. GNU
1.1 grant 588: Autoconf/Automake</a></span></dt>
589: </dl>
590: </dd>
591:
1.21 ! ben 592: <dt><span class="sect1"><a href="#id2595379">12.4.
1.1 grant 593: Building considerations</a></span></dt>
594:
595: <dd>
596: <dl>
597: <dt><span class="sect2"><a href=
1.21 ! ben 598: "#id2595382">12.4.1. CPP
1.1 grant 599: defines</a></span></dt>
600: </dl>
601: </dd>
602:
1.21 ! ben 603: <dt><span class="sect1"><a href="#id2595412">12.5.
1.1 grant 604: Package specific actions</a></span></dt>
605:
606: <dd>
607: <dl>
608: <dt><span class="sect2"><a href=
1.21 ! ben 609: "#id2595415">12.5.1. Package configuration
1.1 grant 610: files</a></span></dt>
611:
612: <dt><span class="sect2"><a href=
1.21 ! ben 613: "#id2595722">12.5.2. User
1.2 hubertf 614: interaction</a></span></dt>
1.1 grant 615:
616: <dt><span class="sect2"><a href=
1.21 ! ben 617: "#id2595767">12.5.3. Handling
1.1 grant 618: licenses</a></span></dt>
619:
620: <dt><span class="sect2"><a href=
1.21 ! ben 621: "#id2595918">12.5.4. Creating an account from a
1.1 grant 622: package</a></span></dt>
623:
624: <dt><span class="sect2"><a href=
1.21 ! ben 625: "#id2595980">12.5.5. Installing score
1.1 grant 626: files</a></span></dt>
627:
628: <dt><span class="sect2"><a href=
1.21 ! ben 629: "#id2596024">12.5.6. Packages providing login
1.1 grant 630: shells</a></span></dt>
631:
632: <dt><span class="sect2"><a href=
1.21 ! ben 633: "#id2596082">12.5.7. Packages containing perl
1.1 grant 634: scripts</a></span></dt>
635:
636: <dt><span class="sect2"><a href=
1.21 ! ben 637: "#id2596100">12.5.8. Packages with hardcoded
1.1 grant 638: paths to other interpreters</a></span></dt>
639:
640: <dt><span class="sect2"><a href=
1.21 ! ben 641: "#id2596121">12.5.9. Packages installing perl
1.1 grant 642: modules</a></span></dt>
643:
644: <dt><span class="sect2"><a href=
645: "#faq.info-files">12.5.10. Packages installing
646: info files</a></span></dt>
647:
648: <dt><span class="sect2"><a href=
1.21 ! ben 649: "#id2596341">12.5.11. Packages installing
1.1 grant 650: GConf2 data files</a></span></dt>
651:
652: <dt><span class="sect2"><a href=
1.21 ! ben 653: "#id2596441">12.5.12. Packages installing
1.1 grant 654: scrollkeeper data files</a></span></dt>
655:
656: <dt><span class="sect2"><a href=
1.21 ! ben 657: "#id2596561">12.5.13. Packages installing X11
1.1 grant 658: fonts</a></span></dt>
659:
660: <dt><span class="sect2"><a href=
1.21 ! ben 661: "#id2596608">12.5.14. Packages installing GTK2
1.1 grant 662: modules</a></span></dt>
663:
664: <dt><span class="sect2"><a href=
1.21 ! ben 665: "#id2596745">12.5.15. Packages installing SGML
1.1 grant 666: or XML data</a></span></dt>
667:
668: <dt><span class="sect2"><a href=
1.21 ! ben 669: "#id2596797">12.5.16. Packages installing
1.1 grant 670: extensions to the MIME database</a></span></dt>
671:
672: <dt><span class="sect2"><a href=
1.21 ! ben 673: "#id2597004">12.5.17. Packages using
1.1 grant 674: intltool</a></span></dt>
1.18 xtraeme 675:
676: <dt><span class="sect2"><a href=
1.21 ! ben 677: "#id2597018">12.5.18. Packages installing
1.18 xtraeme 678: startup scripts</a></span></dt>
1.1 grant 679: </dl>
680: </dd>
681:
1.21 ! ben 682: <dt><span class="sect1"><a href="#id2597040">12.6.
1.1 grant 683: Feedback to the author</a></span></dt>
684: </dl>
685: </dd>
686:
687: <dt><span class="chapter"><a href="#debug">13.
688: Debugging</a></span></dt>
689:
690: <dt><span class="chapter"><a href="#submit">14.
691: Submitting and Committing</a></span></dt>
692:
693: <dd>
694: <dl>
1.21 ! ben 695: <dt><span class="sect1"><a href="#id2597570">14.1.
1.1 grant 696: Submitting your packages</a></span></dt>
697:
1.21 ! ben 698: <dt><span class="sect1"><a href="#id2597621">14.2.
1.1 grant 699: Committing: Importing a package into
700: CVS</a></span></dt>
701:
1.21 ! ben 702: <dt><span class="sect1"><a href="#id2597752">14.3.
1.2 hubertf 703: Updating a package to a newer
704: version</a></span></dt>
1.1 grant 705:
1.21 ! ben 706: <dt><span class="sect1"><a href="#id2597771">14.4.
1.2 hubertf 707: Moving a package in pkgsrc</a></span></dt>
1.1 grant 708: </dl>
709: </dd>
710: </dl>
711: </dd>
712:
713: <dt><span class="appendix"><a href="#examples">A. A simple
714: example package: bison</a></span></dt>
715:
716: <dd>
717: <dl>
1.21 ! ben 718: <dt><span class="sect1"><a href="#id2597997">A.1.
1.1 grant 719: files</a></span></dt>
720:
721: <dd>
722: <dl>
1.21 ! ben 723: <dt><span class="sect2"><a href="#id2598001">A.1.1.
1.1 grant 724: Makefile</a></span></dt>
725:
1.21 ! ben 726: <dt><span class="sect2"><a href="#id2598008">A.1.2.
1.1 grant 727: DESCR</a></span></dt>
728:
1.21 ! ben 729: <dt><span class="sect2"><a href="#id2598023">A.1.3.
1.1 grant 730: PLIST</a></span></dt>
731:
1.21 ! ben 732: <dt><span class="sect2"><a href="#id2598030">A.1.4.
1.14 xtraeme 733: Checking a package with <span><strong class=
734: "command">pkglint</strong></span></a></span></dt>
1.1 grant 735: </dl>
736: </dd>
737:
1.21 ! ben 738: <dt><span class="sect1"><a href="#id2598071">A.2. Steps
1.1 grant 739: for building, installing, packaging</a></span></dt>
740: </dl>
741: </dd>
742:
743: <dt><span class="appendix"><a href="#logs">B. Build
744: logs</a></span></dt>
745:
746: <dd>
747: <dl>
748: <dt><span class="sect1"><a href="#logs.building">B.1.
749: Building figlet</a></span></dt>
750:
751: <dt><span class="sect1"><a href="#logs.package">B.2.
752: Packaging figlet</a></span></dt>
753: </dl>
754: </dd>
755:
756: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
757: of the FTP server's package archive</a></span></dt>
1.2 hubertf 758:
759: <dt><span class="appendix"><a href="#editing">D. Editing
760: guidelines for the pkgsrc guide</a></span></dt>
761:
762: <dd>
763: <dl>
1.21 ! ben 764: <dt><span class="sect1"><a href="#id2598922">D.1.
1.2 hubertf 765: Targets</a></span></dt>
766:
1.21 ! ben 767: <dt><span class="sect1"><a href="#id2599129">D.2.
1.2 hubertf 768: Procedure</a></span></dt>
769: </dl>
770: </dd>
1.1 grant 771: </dl>
772: </div>
773:
774: <div class="chapter" lang="en" xml:lang="en">
775: <div class="titlepage">
776: <div>
777: <div>
778: <h2 class="title"><a name="introduction" id=
779: "introduction"></a>Chapter 1. Introduction</h2>
780: </div>
781: </div>
782: </div>
783:
784: <div class="toc">
785: <p><b>Table of Contents</b></p>
786:
787: <dl>
1.20 ben 788: <dt><span class="sect1"><a href="#id2516957">1.1.
1.1 grant 789: Introduction</a></span></dt>
790:
791: <dt><span class="sect1"><a href="#overview">1.2.
792: Overview</a></span></dt>
793:
794: <dt><span class="sect1"><a href="#terminology">1.3.
795: Terminology</a></span></dt>
796:
797: <dt><span class="sect1"><a href="#typography">1.4.
798: Typography</a></span></dt>
799: </dl>
800: </div>
801:
802: <div class="sect1" lang="en" xml:lang="en">
803: <div class="titlepage">
804: <div>
805: <div>
806: <h2 class="title" style="clear: both"><a name=
1.20 ben 807: "id2516957" id=
808: "id2516957"></a>1.1. Introduction</h2>
1.1 grant 809: </div>
810: </div>
811: </div>
812:
813: <p>There is a lot of software freely available for Unix
814: based systems, which usually runs on NetBSD and other
815: Unix-flavoured systems, too, sometimes with some
816: modifications. The NetBSD Packages Collection (pkgsrc)
817: incorporates any such changes necessary to make that
818: software run, and makes the installation (and
819: de-installation) of the software package easy by means of a
820: single command.</p>
821:
822: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 823: the <span><strong class="command">pkg_*</strong></span>
824: tools so that installation and de-installation, printing of
825: an inventory of all installed packages and retrieval of
826: one-line comments or more verbose descriptions are all
827: simple.</p>
1.1 grant 828:
829: <p>pkgsrc currently contains several thousand packages,
830: including:</p>
831:
832: <div class="itemizedlist">
833: <ul type="disc">
834: <li>
835: <p><a xmlns=
836: "http://www.w3.org/TR/xhtml1/transitional" href=
837: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.20 ben 838: class="pkgname">www/apache</a> - The Apache web
839: server</p>
1.1 grant 840: </li>
841:
842: <li>
843: <p><a xmlns=
844: "http://www.w3.org/TR/xhtml1/transitional" href=
845: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 846: class="pkgname">www/mozilla</a> - The Mozilla web
847: browser</p>
1.1 grant 848: </li>
849:
850: <li>
851: <p><a xmlns=
852: "http://www.w3.org/TR/xhtml1/transitional" href=
853: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.20 ben 854: class="pkgname">meta-pkgs/gnome</a> - The GNOME
855: Desktop Environment</p>
1.1 grant 856: </li>
857:
858: <li>
859: <p><a xmlns=
860: "http://www.w3.org/TR/xhtml1/transitional" href=
861: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.20 ben 862: class="pkgname">meta-pkgs/kde3</a> - The K Desktop
863: Environment</p>
1.1 grant 864: </li>
865: </ul>
866: </div>
867:
868: <p>...just to name a few.</p>
869:
870: <p>pkgsrc has built-in support for handling varying
871: dependencies, such as pthreads and X11, and extended
872: features such as IPv6 support on a range of platforms.</p>
873:
874: <p>pkgsrc was derived from FreeBSD's ports system, and
875: initially developed for NetBSD only. Since then, pkgsrc has
876: grown a lot, and now supports the following platforms:</p>
877:
878: <div class="itemizedlist">
879: <ul type="disc">
880: <li>
881: <p><a href="http://developer.apple.com/darwin/"
882: target="_top">Darwin</a> (<a href=
883: "http://www.apple.com/macosx/" target="_top">Mac OS
884: X</a>)</p>
885: </li>
886:
887: <li>
1.3 hubertf 888: <p><a href="http://www.DragonFlyBSD.org/" target=
889: "_top">DragonFlyBSD</a></p>
890: </li>
891:
892: <li>
1.1 grant 893: <p><a href="http://www.FreeBSD.org/" target=
894: "_top">FreeBSD</a></p>
895: </li>
896:
897: <li>
1.3 hubertf 898: <p>Microsoft Windows, via <a href=
899: "http://www.microsoft.com/windows/sfu/" target=
900: "_top">Interix</a></p>
1.1 grant 901: </li>
902:
903: <li>
904: <p><a href="http://www.sgi.com/software/irix6.5/"
905: target="_top">IRIX</a></p>
906: </li>
907:
908: <li>
909: <p><a href="http://www.linux.org/" target=
910: "_top">Linux</a></p>
911: </li>
912:
913: <li>
914: <p><a href="http://www.NetBSD.org/" target=
915: "_top">NetBSD</a> (of course)</p>
916: </li>
917:
918: <li>
1.17 sketch 919: <p><a href="http://h30097.www3.hp.com/" target=
920: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
921: </li>
922:
923: <li>
1.1 grant 924: <p><a href="http://www.openbsd.org/" target=
925: "_top">OpenBSD</a></p>
926: </li>
927:
928: <li>
929: <p><a href="http://www.sun.com/solaris/" target=
930: "_top">Solaris</a></p>
931: </li>
932: </ul>
933: </div>
934: </div>
935:
936: <div class="sect1" lang="en" xml:lang="en">
937: <div class="titlepage">
938: <div>
939: <div>
940: <h2 class="title" style="clear: both"><a name=
941: "overview" id="overview"></a>1.2. Overview</h2>
942: </div>
943: </div>
944: </div>
945:
946: <p>This document is divided into two parts. The first,
947: <a href="#users-guide" title=
1.2 hubertf 948: "Part I. The pkgsrc user's guide">The pkgsrc
949: user's guide</a>, describes how one can use one of the
950: packages in the Package Collection, either by installing a
951: precompiled binary package, or by building one's own copy
952: using the NetBSD package system. The second part, <a href=
1.1 grant 953: "#developers-guide" title=
1.2 hubertf 954: "Part II. The pkgsrc developer's guide">The
955: pkgsrc developer's guide</a>, explains how to prepare a
956: package so it can be easily built by other NetBSD users
957: without knowing about the package's building details.</p>
1.1 grant 958:
959: <p>This document is available in various formats:</p>
960:
961: <div class="itemizedlist">
962: <ul type="disc">
963: <li>
964: <p><a href="index.html" target="_top">HTML</a></p>
965: </li>
966:
967: <li>
968: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
969: </li>
970:
971: <li>
972: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
973: </li>
974:
975: <li>
976: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
977: </li>
978: </ul>
979: </div>
980: </div>
981:
982: <div class="sect1" lang="en" xml:lang="en">
983: <div class="titlepage">
984: <div>
985: <div>
986: <h2 class="title" style="clear: both"><a name=
987: "terminology" id=
988: "terminology"></a>1.3. Terminology</h2>
989: </div>
990: </div>
991: </div>
992:
993: <p>There has been a lot of talk about “<span class=
994: "quote">ports</span>”, “<span class=
995: "quote">packages</span>”, etc. so far. Here is a
996: description of all the terminology used within this
997: document.</p>
998:
999: <div class="variablelist">
1000: <dl>
1001: <dt><span class="term">Package</span></dt>
1002:
1003: <dd>
1004: <p>A set of files and building instructions that
1005: describe what's necessary to build a certain piece of
1006: software using pkgsrc. Packages are traditionally
1.14 xtraeme 1007: stored under <code class=
1008: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1009: </dd>
1010:
1011: <dt><span class="term">The NetBSD package
1012: system</span></dt>
1013:
1014: <dd>
1015: <p>This is the former name of “<span class=
1016: "quote">pkgsrc</span>”. It is part of the
1017: NetBSD operating system and can be bootstrap to run
1018: on non-NetBSD operating systems as well. It handles
1019: building (compiling), installing, and removing of
1020: packages.</p>
1021: </dd>
1022:
1023: <dt><span class="term">Distfile</span></dt>
1024:
1025: <dd>
1026: <p>This term describes the file or files that are
1027: provided by the author of the piece of software to
1028: distribute his work. All the changes necessary to
1029: build on NetBSD are reflected in the corresponding
1030: package. Usually the distfile is in the form of a
1031: compressed tar-archive, but other types are possible,
1.14 xtraeme 1032: too. Distfiles are usually stored below <code class=
1033: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1034: </dd>
1035:
1036: <dt><span class="term">Port</span></dt>
1037:
1038: <dd>
1039: <p>This is the term used by FreeBSD and OpenBSD
1040: people for what we call a package. In NetBSD
1041: terminology, “<span class=
1042: "quote">port</span>” refers to a different
1043: architecture.</p>
1044: </dd>
1045:
1046: <dt><span class="term">Precompiled/binary
1047: package</span></dt>
1048:
1049: <dd>
1050: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1051: distfile and stuffed together in a single
1052: <code class="filename">.tgz</code> file so it can be
1053: installed on machines of the same machine
1054: architecture without the need to recompile. Packages
1055: are usually generated in <code class=
1056: "filename">/usr/pkgsrc/packages</code>; there is also
1057: an archive on <a href=
1.1 grant 1058: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1059: "_top">ftp.NetBSD.org</a>.</p>
1060:
1061: <p>Sometimes, this is referred to by the term
1062: “<span class="quote">package</span>” too,
1063: especially in the context of precompiled
1064: packages.</p>
1065: </dd>
1066:
1067: <dt><span class="term">Program</span></dt>
1068:
1069: <dd>
1070: <p>The piece of software to be installed which will
1071: be constructed from all the files in the Distfile by
1072: the actions defined in the corresponding package.</p>
1073: </dd>
1074: </dl>
1075: </div>
1076: </div>
1077:
1078: <div class="sect1" lang="en" xml:lang="en">
1079: <div class="titlepage">
1080: <div>
1081: <div>
1082: <h2 class="title" style="clear: both"><a name=
1083: "typography" id=
1084: "typography"></a>1.4. Typography</h2>
1085: </div>
1086: </div>
1087: </div>
1088:
1089: <p>When giving examples for commands, shell prompts are
1090: used to show if the command should/can be issued as root,
1091: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1092: privileges are sufficient. We use a <code class=
1093: "prompt">#</code> for root's shell prompt, and a
1094: <code class="prompt">$</code> for users' shell prompt,
1095: assuming they use the C-shell or tcsh.</p>
1.1 grant 1096: </div>
1097: </div>
1098:
1099: <div class="part" lang="en" xml:lang="en">
1100: <div class="titlepage">
1101: <div>
1102: <div>
1103: <h1 class="title"><a name="users-guide" id=
1.2 hubertf 1104: "users-guide"></a>The pkgsrc user's guide</h1>
1.1 grant 1105: </div>
1106: </div>
1107: </div>
1108:
1109: <div class="toc">
1110: <p><b>Table of Contents</b></p>
1111:
1112: <dl>
1113: <dt><span class="chapter"><a href="#getting">2. Where to
1114: get pkgsrc</a></span></dt>
1115:
1116: <dd>
1117: <dl>
1.20 ben 1118: <dt><span class="sect1"><a href="#id2517611">2.1. As
1.1 grant 1119: tar file</a></span></dt>
1120:
1.20 ben 1121: <dt><span class="sect1"><a href="#id2517627">2.2. Via
1.1 grant 1122: SUP</a></span></dt>
1123:
1.20 ben 1124: <dt><span class="sect1"><a href="#id2517659">2.3. Via
1.1 grant 1125: CVS</a></span></dt>
1126: </dl>
1127: </dd>
1128:
1129: <dt><span class="chapter"><a href="#platforms">3. Using
1130: pkgsrc on systems other than NetBSD</a></span></dt>
1131:
1132: <dd>
1133: <dl>
1.20 ben 1134: <dt><span class="sect1"><a href="#id2517769">3.1.
1.1 grant 1135: Bootstrapping pkgsrc</a></span></dt>
1136:
1.20 ben 1137: <dt><span class="sect1"><a href="#id2518019">3.2.
1.1 grant 1138: Platform specific notes</a></span></dt>
1139:
1140: <dd>
1141: <dl>
1142: <dt><span class="sect2"><a href=
1.20 ben 1143: "#id2518025">3.2.1. Darwin (Mac OS
1.1 grant 1144: X)</a></span></dt>
1145:
1146: <dt><span class="sect2"><a href=
1.20 ben 1147: "#id2518187">3.2.2. FreeBSD</a></span></dt>
1.1 grant 1148:
1149: <dt><span class="sect2"><a href=
1.20 ben 1150: "#id2518768">3.2.3. Interix</a></span></dt>
1.1 grant 1151:
1152: <dt><span class="sect2"><a href=
1.20 ben 1153: "#id2518926">3.2.4. IRIX</a></span></dt>
1.1 grant 1154:
1155: <dt><span class="sect2"><a href=
1.20 ben 1156: "#id2519044">3.2.5. OpenBSD</a></span></dt>
1.1 grant 1157:
1158: <dt><span class="sect2"><a href=
1.20 ben 1159: "#id2519156">3.2.6. Solaris</a></span></dt>
1.1 grant 1160: </dl>
1161: </dd>
1162: </dl>
1163: </dd>
1164:
1165: <dt><span class="chapter"><a href="#using">4. Using
1166: pkgsrc</a></span></dt>
1167:
1168: <dd>
1169: <dl>
1170: <dt><span class="sect1"><a href=
1171: "#getting-started">4.1. Working with binary
1172: packages</a></span></dt>
1173:
1174: <dd>
1175: <dl>
1176: <dt><span class="sect2"><a href=
1.20 ben 1177: "#id2519292">4.1.1. Where to get binary
1.1 grant 1178: packages</a></span></dt>
1179:
1180: <dt><span class="sect2"><a href=
1.20 ben 1181: "#id2519333">4.1.2. How to use binary
1.1 grant 1182: packages</a></span></dt>
1183:
1184: <dt><span class="sect2"><a href=
1.20 ben 1185: "#id2519467">4.1.3. A word of
1.1 grant 1186: warning</a></span></dt>
1187: </dl>
1188: </dd>
1189:
1.20 ben 1190: <dt><span class="sect1"><a href="#id2519479">4.2.
1.1 grant 1191: Building packages from source</a></span></dt>
1192:
1193: <dd>
1194: <dl>
1195: <dt><span class="sect2"><a href=
1.20 ben 1196: "#id2519489">4.2.1. Requirements</a></span></dt>
1.1 grant 1197:
1198: <dt><span class="sect2"><a href=
1.20 ben 1199: "#id2519509">4.2.2. Fetching
1.1 grant 1200: distfiles</a></span></dt>
1201:
1202: <dt><span class="sect2"><a href=
1.20 ben 1203: "#id2519561">4.2.3. How to build and
1.1 grant 1204: install</a></span></dt>
1205:
1206: <dt><span class="sect2"><a href=
1.20 ben 1207: "#id2520288">4.2.4. Selecting the
1.1 grant 1208: compiler</a></span></dt>
1209: </dl>
1210: </dd>
1211: </dl>
1212: </dd>
1213:
1214: <dt><span class="chapter"><a href="#binary">5. Creating
1215: binary packages</a></span></dt>
1216:
1217: <dd>
1218: <dl>
1.20 ben 1219: <dt><span class="sect1"><a href="#id2520374">5.1.
1.1 grant 1220: Building a single binary package</a></span></dt>
1221:
1.20 ben 1222: <dt><span class="sect1"><a href="#id2585578">5.2.
1.1 grant 1223: Settings for creation of binary
1224: packages</a></span></dt>
1225:
1226: <dt><span class="sect1"><a href="#bulkbuild">5.3.
1227: Doing a bulk build of all packages</a></span></dt>
1228:
1229: <dd>
1230: <dl>
1231: <dt><span class="sect2"><a href=
1232: "#binary.configuration">5.3.1.
1233: Configuration</a></span></dt>
1234:
1235: <dt><span class="sect2"><a href=
1.20 ben 1236: "#id2585786">5.3.2. Other environmental
1.1 grant 1237: considerations</a></span></dt>
1238:
1239: <dt><span class="sect2"><a href=
1.20 ben 1240: "#id2585827">5.3.3. Operation</a></span></dt>
1.1 grant 1241:
1242: <dt><span class="sect2"><a href=
1.20 ben 1243: "#id2585964">5.3.4. What it does</a></span></dt>
1.1 grant 1244:
1245: <dt><span class="sect2"><a href=
1.20 ben 1246: "#id2586021">5.3.5. Disk space
1.1 grant 1247: requirements</a></span></dt>
1248:
1249: <dt><span class="sect2"><a href=
1.20 ben 1250: "#id2586048">5.3.6. Setting up a sandbox for
1.1 grant 1251: chroot'ed builds</a></span></dt>
1252:
1253: <dt><span class="sect2"><a href=
1.20 ben 1254: "#id2586508">5.3.7. Building a partial set of
1.1 grant 1255: packages</a></span></dt>
1.13 hubertf 1256:
1257: <dt><span class="sect2"><a href=
1258: "#bulk-upload">5.3.8. Uploading results of a bulk
1259: build</a></span></dt>
1.1 grant 1260: </dl>
1261: </dd>
1262:
1.20 ben 1263: <dt><span class="sect1"><a href="#id2586946">5.4.
1.1 grant 1264: Creating a multiple CD-ROM packages
1265: collection</a></span></dt>
1266:
1267: <dd>
1268: <dl>
1269: <dt><span class="sect2"><a href=
1.20 ben 1270: "#id2586961">5.4.1. Example of
1.1 grant 1271: cdpack</a></span></dt>
1272: </dl>
1273: </dd>
1274: </dl>
1275: </dd>
1276:
1277: <dt><span class="chapter"><a href="#faq">6. Frequently
1278: Asked Questions</a></span></dt>
1279:
1280: <dd>
1281: <dl>
1.20 ben 1282: <dt><span class="sect1"><a href="#id2587153">6.1. Are
1.18 xtraeme 1283: there any mailing lists for pkg-related
1.1 grant 1284: discussion?</a></span></dt>
1285:
1.20 ben 1286: <dt><span class="sect1"><a href="#id2587355">6.2.
1.1 grant 1287: Where's the pkgviews documentation?</a></span></dt>
1288:
1.5 hubertf 1289: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 1290: Utilities for package management
1291: (pkgtools)</a></span></dt>
1292:
1.20 ben 1293: <dt><span class="sect1"><a href="#id2587540">6.4. How
1.1 grant 1294: to use pkgsrc as non-root</a></span></dt>
1295:
1.20 ben 1296: <dt><span class="sect1"><a href="#id2587552">6.5. How
1.15 xtraeme 1297: to resume transfers when fetching
1298: distfiles?</a></span></dt>
1.14 xtraeme 1299:
1.20 ben 1300: <dt><span class="sect1"><a href="#id2587594">6.6. How
1.1 grant 1301: can I install/use XFree86 from
1302: pkgsrc?</a></span></dt>
1303:
1.20 ben 1304: <dt><span class="sect1"><a href="#id2587622">6.7. How
1.1 grant 1305: can I install/use X.org from pkgsrc?</a></span></dt>
1306:
1.20 ben 1307: <dt><span class="sect1"><a href="#id2587650">6.8. How
1.1 grant 1308: to fetch files from behind a firewall</a></span></dt>
1309:
1.20 ben 1310: <dt><span class="sect1"><a href="#id2587664">6.9. How
1.14 xtraeme 1311: do I tell <span><strong class="command">make
1312: fetch</strong></span> to do passive
1.1 grant 1313: FTP?</a></span></dt>
1314:
1.20 ben 1315: <dt><span class="sect1"><a href="#id2587715">6.10.
1.14 xtraeme 1316: How to fetch all distfiles at once</a></span></dt>
1.1 grant 1317:
1.20 ben 1318: <dt><span class="sect1"><a href="#id2587923">6.11.
1.14 xtraeme 1319: What does “<span class="quote">Don't know how
1320: to make /usr/share/tmac/tmac.andoc</span>”
1321: mean?</a></span></dt>
1.13 hubertf 1322:
1.20 ben 1323: <dt><span class="sect1"><a href="#id2587961">6.12.
1.14 xtraeme 1324: What does “<span class="quote">Could not find
1325: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1326:
1.20 ben 1327: <dt><span class="sect1"><a href="#id2588087">6.13.
1.1 grant 1328: Using 'sudo' with pkgsrc</a></span></dt>
1329:
1.14 xtraeme 1330: <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1 grant 1331: Configuration files handling and
1332: placement</a></span></dt>
1333:
1334: <dt><span class="sect1"><a href=
1.14 xtraeme 1335: "#audit-packages">6.15. Automated security
1.1 grant 1336: checks</a></span></dt>
1337: </dl>
1338: </dd>
1339: </dl>
1340: </div>
1341:
1342: <div class="chapter" lang="en" xml:lang="en">
1343: <div class="titlepage">
1344: <div>
1345: <div>
1346: <h2 class="title"><a name="getting" id=
1347: "getting"></a>Chapter 2. Where to get
1348: pkgsrc</h2>
1349: </div>
1350: </div>
1351: </div>
1352:
1353: <div class="toc">
1354: <p><b>Table of Contents</b></p>
1355:
1356: <dl>
1.20 ben 1357: <dt><span class="sect1"><a href="#id2517611">2.1. As
1.1 grant 1358: tar file</a></span></dt>
1359:
1.20 ben 1360: <dt><span class="sect1"><a href="#id2517627">2.2. Via
1.1 grant 1361: SUP</a></span></dt>
1362:
1.20 ben 1363: <dt><span class="sect1"><a href="#id2517659">2.3. Via
1.1 grant 1364: CVS</a></span></dt>
1365: </dl>
1366: </div>
1367:
1368: <p>There are three ways to get pkgsrc. Either as a tar
1369: file, via SUP, or via CVS. All three ways are described
1370: here.</p>
1371:
1372: <div class="sect1" lang="en" xml:lang="en">
1373: <div class="titlepage">
1374: <div>
1375: <div>
1376: <h2 class="title" style="clear: both"><a name=
1.20 ben 1377: "id2517611" id="id2517611"></a>2.1. As tar
1.1 grant 1378: file</h2>
1379: </div>
1380: </div>
1381: </div>
1382:
1383: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1384: file from <a href=
1.11 ben 1385: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1386: target="_top">ftp.NetBSD.org</a> and unpack it into
1387: <code class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1388: </div>
1389:
1390: <div class="sect1" lang="en" xml:lang="en">
1391: <div class="titlepage">
1392: <div>
1393: <div>
1394: <h2 class="title" style="clear: both"><a name=
1.20 ben 1395: "id2517627" id="id2517627"></a>2.2. Via
1.1 grant 1396: SUP</h2>
1397: </div>
1398: </div>
1399: </div>
1400:
1401: <p>As an alternative to the tar file, you can get pkgsrc
1402: via the Software Update Protocol, SUP. To do so, make
1403: sure your supfile has a line</p>
1404: <pre class="programlisting">
1405: release=pkgsrc
1406: </pre>
1407:
1.14 xtraeme 1408: <p>in it, see the examples in <code class=
1409: "filename">/usr/share/examples/supfiles</code>, and that
1410: the <code class="filename">/usr/pkgsrc</code> directory
1411: exists. Then, simply run <span><strong class=
1412: "command">sup -v <em class=
1413: "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1414: </div>
1415:
1416: <div class="sect1" lang="en" xml:lang="en">
1417: <div class="titlepage">
1418: <div>
1419: <div>
1420: <h2 class="title" style="clear: both"><a name=
1.20 ben 1421: "id2517659" id="id2517659"></a>2.3. Via
1.1 grant 1422: CVS</h2>
1423: </div>
1424: </div>
1425: </div>
1426:
1427: <p>To get pkgsrc via CVS, make sure you have
1428: “<span class="quote">cvs</span>” installed.
1429: If not present on your system, it can be found as
1430: precompiled binary on ftp.NetBSD.org. To do an initial
1431: (full) checkout of pkgsrc, do the following steps:</p>
1432: <pre class="screen">
1.14 xtraeme 1433: <code class="prompt">%</code> <strong class=
1434: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1435: <code class="prompt">%</code> <strong class=
1436: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1437: <code class="prompt">%</code> <strong class=
1438: "userinput"><code>cd /usr</code></strong>
1439: <code class="prompt">%</code> <strong class=
1440: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1441: </pre>
1442:
1443: <p>This will create the <code class=
1444: "filename">pkgsrc</code> directory in your <code class=
1445: "filename">/usr</code>, and all the package source will
1446: be stored under <code class=
1447: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1448: initial checkout, make sure you have <code class=
1449: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1450: <pre class="screen">
1.14 xtraeme 1451: <code class="prompt">%</code> <strong class=
1452: "userinput"><code>cd /usr/pkgsrc</code></strong>
1453: <code class="prompt">%</code> <strong class=
1454: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1455: </pre>
1456:
1457: <p>Please also note that it is possible to have multiple
1458: copies of the pkgsrc hierarchy in use at any one time -
1459: all work is done relatively within the pkgsrc tree.</p>
1460: </div>
1461: </div>
1462:
1463: <div class="chapter" lang="en" xml:lang="en">
1464: <div class="titlepage">
1465: <div>
1466: <div>
1467: <h2 class="title"><a name="platforms" id=
1468: "platforms"></a>Chapter 3. Using pkgsrc on
1469: systems other than NetBSD</h2>
1470: </div>
1471: </div>
1472: </div>
1473:
1474: <div class="toc">
1475: <p><b>Table of Contents</b></p>
1476:
1477: <dl>
1.20 ben 1478: <dt><span class="sect1"><a href="#id2517769">3.1.
1.1 grant 1479: Bootstrapping pkgsrc</a></span></dt>
1480:
1.20 ben 1481: <dt><span class="sect1"><a href="#id2518019">3.2.
1.1 grant 1482: Platform specific notes</a></span></dt>
1483:
1484: <dd>
1485: <dl>
1.20 ben 1486: <dt><span class="sect2"><a href="#id2518025">3.2.1.
1.1 grant 1487: Darwin (Mac OS X)</a></span></dt>
1488:
1.20 ben 1489: <dt><span class="sect2"><a href="#id2518187">3.2.2.
1.1 grant 1490: FreeBSD</a></span></dt>
1491:
1.20 ben 1492: <dt><span class="sect2"><a href="#id2518768">3.2.3.
1.1 grant 1493: Interix</a></span></dt>
1494:
1.20 ben 1495: <dt><span class="sect2"><a href="#id2518926">3.2.4.
1.1 grant 1496: IRIX</a></span></dt>
1497:
1.20 ben 1498: <dt><span class="sect2"><a href="#id2519044">3.2.5.
1.1 grant 1499: OpenBSD</a></span></dt>
1500:
1.20 ben 1501: <dt><span class="sect2"><a href="#id2519156">3.2.6.
1.1 grant 1502: Solaris</a></span></dt>
1503: </dl>
1504: </dd>
1505: </dl>
1506: </div>
1507:
1508: <div class="sect1" lang="en" xml:lang="en">
1509: <div class="titlepage">
1510: <div>
1511: <div>
1512: <h2 class="title" style="clear: both"><a name=
1.20 ben 1513: "id2517769" id=
1514: "id2517769"></a>3.1. Bootstrapping pkgsrc</h2>
1.1 grant 1515: </div>
1516: </div>
1517: </div>
1518:
1519: <p>For Operating Systems other than NetBSD, we provide a
1520: bootstrap kit to build the required tools to use pkgsrc
1521: on your platform. Besides support for native NetBSD,
1522: pkgsrc and the bootstrap kit have support for the
1523: following operating systems:</p>
1524:
1525: <div class="itemizedlist">
1526: <ul type="disc">
1527: <li>
1528: <p>Darwin (Mac OS X)</p>
1529: </li>
1530:
1531: <li>
1.16 grant 1532: <p>DragonFlyBSD</p>
1533: </li>
1534:
1535: <li>
1.1 grant 1536: <p>FreeBSD</p>
1537: </li>
1538:
1539: <li>
1540: <p>Interix (Windows 2000, XP, 2003)</p>
1541: </li>
1542:
1543: <li>
1544: <p>IRIX</p>
1545: </li>
1546:
1547: <li>
1548: <p>Linux</p>
1549: </li>
1550:
1551: <li>
1552: <p>OpenBSD</p>
1553: </li>
1554:
1555: <li>
1556: <p>Solaris</p>
1557: </li>
1.16 grant 1558:
1559: <li>
1560: <p>Tru64 (Digital UNIX/OSF1)</p>
1561: </li>
1.1 grant 1562: </ul>
1563: </div>
1564:
1565: <p>Support for other platforms is under development.</p>
1566:
1567: <p>Installing the bootstrap kit should be as simple
1568: as:</p>
1569: <pre class="screen">
1.14 xtraeme 1570: <code class="prompt">#</code> <strong class=
1571: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1572: <code class="prompt">#</code> <strong class=
1573: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1574: <code class="prompt">#</code> <strong class=
1575: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1576: </pre>
1577:
1578: <p>See <a href="#getting" title=
1579: "Chapter 2. Where to get pkgsrc">Chapter 2,
1580: <i>Where to get pkgsrc</i></a> for other ways to get
1.14 xtraeme 1581: pkgsrc before bootstrapping. The given
1582: <span><strong class="command">bootstrap</strong></span>
1583: command will use the defaults of <code class=
1584: "filename">/usr/pkg</code> for the <span class=
1585: "emphasis"><em>prefix</em></span> where programs will be
1586: installed in, and <code class=
1587: "filename">/var/db/pkg</code> for the package database
1.1 grant 1588: directory where pkgsrc will do it's internal bookkeeping.
1589: However, these can also be set using command-line
1590: parameters.</p>
1591:
1592: <p>Binary packages for the pkgsrc tools and an initial
1593: set of packages is available for supported platforms. An
1594: up-to-date list of these can be found on <a href=
1595: "http://www.pkgsrc.org/" target=
1596: "_top">www.pkgsrc.org</a>.</p>
1597: </div>
1598:
1599: <div class="sect1" lang="en" xml:lang="en">
1600: <div class="titlepage">
1601: <div>
1602: <div>
1603: <h2 class="title" style="clear: both"><a name=
1.20 ben 1604: "id2518019" id="id2518019"></a>3.2. Platform
1.1 grant 1605: specific notes</h2>
1606: </div>
1607: </div>
1608: </div>
1609:
1610: <p>Here are some platform-specific notes you should be
1611: aware of.</p>
1612:
1613: <div class="sect2" lang="en" xml:lang="en">
1614: <div class="titlepage">
1615: <div>
1616: <div>
1.20 ben 1617: <h3 class="title"><a name="id2518025" id=
1618: "id2518025"></a>3.2.1. Darwin (Mac OS
1.1 grant 1619: X)</h3>
1620: </div>
1621: </div>
1622: </div>
1623:
1624: <p>Darwin 5.x and 6.x are supported. There are two
1625: methods of using pkgsrc on Mac OS X, by using a
1626: <a href="#platform.osx-image" title=
1627: "3.2.1.1. Using a disk image">disk image</a>, or a
1628: <a href="#platform.osx-ufs" title=
1629: "3.2.1.2. Using a UFS partition">UFS
1630: partition</a>.</p>
1631:
1632: <p>Before you start, you will need to download and
1633: install the Mac OS X Developer Tools from Apple's
1634: Developer Connection. See <a href=
1635: "http://developer.apple.com/macosx/" target=
1636: "_top">http://developer.apple.com/macosx/</a> for
1637: details. Also, make sure you install X11 for Mac OS X
1638: and the X11 SDK from <a href=
1639: "http://www.apple.com/macosx/x11/download/" target=
1640: "_top">http://www.apple.com/macosx/x11/download/</a> if
1641: you intend to build packages that use the X11 Window
1642: System.</p>
1643:
1644: <p>If you already have a UFS partition, or have a spare
1645: partition that you can format as UFS, it is recommended
1646: to use that instead of the disk image. It'll be
1647: somewhat faster and will mount automatically at boot
1648: time, where you must manually mount a disk image.</p>
1649:
1650: <div class="note" style=
1651: "margin-left: 0.5in; margin-right: 0.5in;">
1652: <h3 class="title">Note</h3>
1653:
1654: <p>You cannot use a HFS+ file system for pkgsrc,
1655: because pkgsrc currently requires the filesystem to
1656: be case-sensitive, and HFS+ is not.</p>
1657: </div>
1658:
1659: <div class="sect3" lang="en" xml:lang="en">
1660: <div class="titlepage">
1661: <div>
1662: <div>
1663: <h4 class="title"><a name="platform.osx-image"
1664: id="platform.osx-image"></a>3.2.1.1. Using
1665: a disk image</h4>
1666: </div>
1667: </div>
1668: </div>
1669:
1670: <p>Create the disk image:</p>
1671: <pre class="screen">
1.14 xtraeme 1672: <code class="prompt">#</code> <strong class=
1673: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1674: <code class="prompt">#</code> <strong class=
1675: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
1676: <code class="prompt">#</code> <strong class=
1677: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
1678: <code class="prompt">#</code> <strong class=
1679: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 1680: </pre>
1681:
1682: <p>That's it!</p>
1683: </div>
1684:
1685: <div class="sect3" lang="en" xml:lang="en">
1686: <div class="titlepage">
1687: <div>
1688: <div>
1689: <h4 class="title"><a name="platform.osx-ufs"
1690: id="platform.osx-ufs"></a>3.2.1.2. Using a
1691: UFS partition</h4>
1692: </div>
1693: </div>
1694: </div>
1695:
1.14 xtraeme 1696: <p>By default, <code class="filename">/usr</code>
1697: will be on your root file system, normally HFS+. It
1698: is possible to use the default <span class=
1699: "emphasis"><em>prefix</em></span> of <code class=
1700: "filename">/usr/pkg</code> by symlinking <code class=
1701: "filename">/usr/pkg</code> to a directory on a UFS
1702: file system. Obviously, another symlink is required
1703: if you want to place the package database directory
1704: outside the <span class=
1705: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 1706: <pre class="screen">
1.14 xtraeme 1707: <code class="prompt">#</code> <strong class=
1708: "userinput"><code>./bootstrap --pkgdbdir=/usr/pkg/pkgdb --pkgsrcdir=/Volumes/ufs/pkgsrc</code></strong>
1.1 grant 1709: </pre>
1710:
1711: <p>If you created your partitions at the time of
1712: installing Mac OS X and formatted the target
1713: partition as UFS, it should automatically mount on
1.14 xtraeme 1714: <code class="filename">/Volumes/<volume
1715: name></code> when the machine boots. If you are
1.1 grant 1716: (re)formatting a partition as UFS, you need to ensure
1717: that the partition map correctly reflects
1718: “<span class="quote">Apple_UFS</span>”
1719: and not “<span class=
1720: "quote">Apple_HFS</span>”.</p>
1721:
1722: <p>The problem is that none of the disk tools will
1723: let you touch a disk that is booted from. You can
1724: unmount the partition, but even if you newfs it, the
1725: partition type will be incorrect and the automounter
1726: won't mount it. It can be mounted manually, but it
1727: won't appear in Finder.</p>
1728:
1729: <p>You'll need to boot off of the OS X Installation
1730: (User) CD. When the Installation program starts, go
1731: up to the menu and select Disk Utility. Now, you will
1732: be able to select the partition you want to be UFS,
1733: and Format it Apple UFS. Quit the Disk Utility, quit
1734: the installer which will reboot your machine. The new
1735: UFS file system will appear in Finder.</p>
1736:
1737: <p>Be aware that the permissions on the new file
1738: system will be writable by root only.</p>
1739:
1740: <p>This note is as of 10.2 (Jaguar) and applies to
1741: earlier versions. Hopefully Apple will fix Disk
1742: Utility in 10.3 (Panther).</p>
1743: </div>
1744: </div>
1745:
1746: <div class="sect2" lang="en" xml:lang="en">
1747: <div class="titlepage">
1748: <div>
1749: <div>
1.20 ben 1750: <h3 class="title"><a name="id2518187" id=
1751: "id2518187"></a>3.2.2. FreeBSD</h3>
1.1 grant 1752: </div>
1753: </div>
1754: </div>
1755:
1756: <p>FreeBSD 4.7 and 5.0 have been tested and are
1757: supported, other versions may work.</p>
1758:
1759: <p>Care should be taken so that the tools that this kit
1760: installs do not conflict with the FreeBSD userland
1761: tools. There are several steps:</p>
1762:
1763: <div class="orderedlist">
1764: <ol type="1">
1765: <li>
1766: <p>FreeBSD stores its ports pkg database in
1.14 xtraeme 1767: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 1768: therefore recommended that you choose a different
1.14 xtraeme 1769: location (e.g. <code class=
1770: "filename">/usr/pkgdb</code>) by using the
1.1 grant 1771: --pkgdbdir option to the bootstrap script.</p>
1772: </li>
1773:
1774: <li>
1775: <p>If you do not intend to use the FreeBSD ports
1776: tools, it's probably a good idea to move them out
1777: of the way to avoid confusion, e.g.</p>
1778: <pre class="screen">
1.14 xtraeme 1779: <code class="prompt">#</code> <strong class=
1780: "userinput"><code>cd /usr/sbin</code></strong>
1781: <code class="prompt">#</code> <strong class=
1782: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
1783: <code class="prompt">#</code> <strong class=
1784: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
1785: <code class="prompt">#</code> <strong class=
1786: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
1787: <code class="prompt">#</code> <strong class=
1788: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 1789: </pre>
1790: </li>
1791:
1792: <li>
1.14 xtraeme 1793: <p>An example <code class=
1794: "filename">/etc/mk.conf</code> file will be
1795: placed in <code class=
1796: "filename">/etc/mk.conf.example</code> file when
1797: you use the bootstrap script.</p>
1.1 grant 1798: </li>
1799: </ol>
1800: </div>
1801: </div>
1802:
1803: <div class="sect2" lang="en" xml:lang="en">
1804: <div class="titlepage">
1805: <div>
1806: <div>
1.20 ben 1807: <h3 class="title"><a name="id2518768" id=
1808: "id2518768"></a>3.2.3. Interix</h3>
1.1 grant 1809: </div>
1810: </div>
1811: </div>
1812:
1813: <p>Interix is a POSIX compatible subsystem for the
1814: Windows NT kernel, providing a Unix-like environment
1815: with a tighter kernel integration than available with
1816: Cygwin. It is part of the Windows Services for Unix
1817: package, available for free for any licensed copy of
1.20 ben 1818: Windows 2000, XP, or 2003. SFU can be downloaded from
1819: <a href="http://www.microsoft.com/windows/sfu/" target=
1.1 grant 1820: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
1821:
1822: <p>Services for Unix 3.5, current as of this writing,
1823: has been tested. 3.0 or 3.1 may work, but are not
1824: officially supported. (The main difference in 3.0/3.1
1825: is lack of pthreads.)</p>
1826:
1827: <div class="sect3" lang="en" xml:lang="en">
1828: <div class="titlepage">
1829: <div>
1830: <div>
1831: <h4 class="title"><a name=
1832: "platform.interix-sfu-install" id=
1833: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 1834: installing Interix/SFU</h4>
1.1 grant 1835: </div>
1836: </div>
1837: </div>
1838:
1839: <p>At an absolute minimum, the following packages
1840: must be installed from the Windows Services for Unix
1841: 3.5 distribution in order to use pkgsrc:</p>
1842:
1843: <div class="itemizedlist">
1844: <ul type="disc">
1845: <li>
1846: <p>Utilities -> Base Utilities</p>
1847: </li>
1848:
1849: <li>
1850: <p>Interix GNU Components -> (all)</p>
1851: </li>
1852:
1853: <li>
1854: <p>Remote Connectivity</p>
1855: </li>
1856:
1857: <li>
1858: <p>Interix SDK</p>
1859: </li>
1860: </ul>
1861: </div>
1862:
1863: <p>When using pkgsrc on Interix, DO NOT install the
1864: Utilities subcomponent "UNIX Perl". That is Perl 5.6
1865: without shared module support, installed to
1866: /usr/local, and will only cause confusion. Instead,
1867: install Perl 5.8 from pkgsrc (or from a binary
1868: package).</p>
1869:
1870: <p>The Remote Connectivity subcomponent "Windows
1871: Remote Shell Service" does not need to be installed,
1872: but Remote Connectivity itself should be installed in
1873: order to have a working inetd.</p>
1874:
1875: <p>Finally, during installation you may be asked
1876: whether to enable setuid behavior for Interix
1877: programs, and whether to make pathnames default to
1878: case-sensitive. Setuid should be enabled, and
1879: case-sensitivity MUST be enabled. (Without
1880: case-sensitivity, a large number of packages
1881: including perl will not build.)</p>
1882: </div>
1883:
1884: <div class="sect3" lang="en" xml:lang="en">
1885: <div class="titlepage">
1886: <div>
1887: <div>
1888: <h4 class="title"><a name=
1889: "platform.interix-sfu-postinstall" id=
1890: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
1891: to do if Interix/SFU is already installed</h4>
1892: </div>
1893: </div>
1894: </div>
1895:
1896: <p>If SFU is already installed and you wish to alter
1897: these settings to work with pkgsrc, note the
1898: following things.</p>
1899:
1900: <div class="itemizedlist">
1901: <ul type="disc">
1902: <li>
1903: <p>To uninstall UNIX Perl, use Add/Remove
1904: Programs, select Microsoft Windows Services for
1905: UNIX, then click Change. In the installer,
1906: choose Add or Remove, then uncheck
1907: Utilities->UNIX Perl.</p>
1908: </li>
1909:
1910: <li>
1911: <p>To enable case-sensitivity for the
1912: filesystem, run REGEDIT.EXE, and change the
1913: following registry key:</p>
1914:
1915: <p>
1916: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
1917: Manager\kernel</p>
1918:
1919: <p>Set the DWORD value "obcaseinsensitive" to
1920: 0; then reboot.</p>
1921: </li>
1922:
1923: <li>
1924: <p>To enable setuid binaries (optional), run
1925: REGEDIT.EXE, and change the following registry
1926: key:</p>
1927:
1928: <p>
1929: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
1930: for UNIX</p>
1931:
1932: <p>Set the DWORD value "EnableSetuidBinaries"
1933: to 1; then reboot.</p>
1934: </li>
1935: </ul>
1936: </div>
1937: </div>
1938:
1939: <div class="sect3" lang="en" xml:lang="en">
1940: <div class="titlepage">
1941: <div>
1942: <div>
1943: <h4 class="title"><a name=
1944: "platform.interix-notes" id=
1945: "platform.interix-notes"></a>3.2.3.3. Important
1946: notes for using pkgsrc</h4>
1947: </div>
1948: </div>
1949: </div>
1950:
1951: <p>The package imanager (either the pkgsrc "su" user,
1952: or the user running "pkg_add") must be a member of
1953: the local Administrators group. Such a user must also
1954: be used to run the bootstrap. This is slightly
1955: relaxed from the normal pkgsrc requirement of
1956: "root".</p>
1957:
1958: <p>The package manager should use a umask of 002.
1959: "make install" will automatically complain if this is
1960: not the case. This ensures that directories written
1961: in /var/db/pkg are Administrators-group
1962: writeable.</p>
1963:
1964: <p>The popular Interix binary packages from
1965: http://www.interopsystems.com/ use an older version
1966: of pkgsrc's pkg_* tools. Ideally, these should NOT be
1967: used in conjunction with pkgsrc. If you choose to use
1968: them at the same time as the pkgsrc packages, ensure
1969: that you use the proper pkg_* tools for each type of
1970: binary package.</p>
1971: </div>
1972: </div>
1973:
1974: <div class="sect2" lang="en" xml:lang="en">
1975: <div class="titlepage">
1976: <div>
1977: <div>
1.20 ben 1978: <h3 class="title"><a name="id2518926" id=
1979: "id2518926"></a>3.2.4. IRIX</h3>
1.1 grant 1980: </div>
1981: </div>
1982: </div>
1983:
1984: <p>You will need a working C compiler, either gcc or
1985: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 1986: the <code class="varname">CC</code> environment
1987: variable according to your preference. If you do not
1988: have a license for the MIPSpro compiler suite, you can
1.1 grant 1989: download a gcc tardist file from <a href=
1990: "http://freeware.sgi.com/" target=
1991: "_top">http://freeware.sgi.com/</a>.</p>
1992:
1993: <p>Please note that you will need IRIX 6.5.17 or
1994: higher, as this is the earliest version of IRIX
1995: providing support for if_indextoname(3),
1996: if_nametoindex(3), etc.</p>
1997:
1998: <p>At this point in time, pkgsrc only supports one ABI.
1999: That is, you can not switch between the old 32-bit ABI,
2000: the new 32-bit ABI and the 64-bit ABI. If you start out
2001: using "abi=n32", that's what all your packages will be
2002: built with.</p>
2003:
2004: <p>Therefore, please make sure that you have no
1.14 xtraeme 2005: conflicting <code class="varname">CFLAGS</code> in your
2006: environment or the <code class=
2007: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2008: that you do not try to link n32 object files with lib64
1.14 xtraeme 2009: or vice versa. Check your <code class=
2010: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2011:
2012: <p>If you have the actual pkgsrc tree mounted via NFS
2013: from a different host, please make sure to set
1.14 xtraeme 2014: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2015: directory, as it appears that IRIX linker occasionally
2016: runs into issues when trying to link over a network
2017: mounted filesystem.</p>
2018:
2019: <p>The bootstrapping process should set all the right
2020: options for programs such as imake(1), but you may want
2021: to set some options depending on your local setup.
1.14 xtraeme 2022: Please see <code class=
2023: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.1 grant 2024: course, your compilers man pages for details.</p>
2025: </div>
2026:
2027: <div class="sect2" lang="en" xml:lang="en">
2028: <div class="titlepage">
2029: <div>
2030: <div>
1.20 ben 2031: <h3 class="title"><a name="id2519044" id=
2032: "id2519044"></a>3.2.5. OpenBSD</h3>
1.1 grant 2033: </div>
2034: </div>
2035: </div>
2036:
2037: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2038:
2039: <p>Care should be taken so that the tools that this kit
2040: installs do not conflict with the OpenBSD userland
2041: tools. There are several steps:</p>
2042:
2043: <div class="orderedlist">
2044: <ol type="1">
2045: <li>
2046: <p>OpenBSD stores its ports pkg database in
1.14 xtraeme 2047: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 2048: therefore recommended that you choose a different
1.14 xtraeme 2049: location (e.g. <code class=
2050: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2051: --pkgdbdir option to the bootstrap script.</p>
2052: </li>
2053:
2054: <li>
2055: <p>If you do not intend to use the OpenBSD ports
2056: tools, it's probably a good idea to move them out
2057: of the way to avoid confusion, e.g.</p>
2058: <pre class="screen">
1.14 xtraeme 2059: <code class="prompt">#</code> <strong class=
2060: "userinput"><code>cd /usr/sbin</code></strong>
2061: <code class="prompt">#</code> <strong class=
2062: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2063: <code class="prompt">#</code> <strong class=
2064: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2065: <code class="prompt">#</code> <strong class=
2066: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2067: <code class="prompt">#</code> <strong class=
2068: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2069: </pre>
2070: </li>
2071:
2072: <li>
1.14 xtraeme 2073: <p>An example <code class=
2074: "filename">/etc/mk.conf</code> file will be
2075: placed in <code class=
2076: "filename">/etc/mk.conf.example</code> file when
2077: you use the bootstrap script. OpenBSD's make
2078: program uses <code class=
2079: "filename">/etc/mk.conf</code> as well. You can
1.1 grant 2080: work around this by enclosing all the pkgsrc
2081: specific parts of the file with:</p>
2082: <pre class="programlisting">
2083: .ifdef BSD_PKG_MK
1.11 ben 2084: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1 grant 2085: .else
2086: # OpenBSD stuff
2087: .endif
2088: </pre>
2089: </li>
2090: </ol>
2091: </div>
2092: </div>
2093:
2094: <div class="sect2" lang="en" xml:lang="en">
2095: <div class="titlepage">
2096: <div>
2097: <div>
1.20 ben 2098: <h3 class="title"><a name="id2519156" id=
2099: "id2519156"></a>3.2.6. Solaris</h3>
1.1 grant 2100: </div>
2101: </div>
2102: </div>
2103:
2104: <p>Solaris 2.6 through 9 are supported on both x86 and
2105: sparc. You will need a working C compiler. Both gcc
2106: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2107:
2108: <p>The following packages are required on Solaris 8 for
2109: the bootstrap process and to build packages.</p>
2110:
2111: <div class="itemizedlist">
2112: <ul type="disc">
2113: <li>
2114: <p>SUNWsprot</p>
2115: </li>
2116:
2117: <li>
2118: <p>SUNWarc</p>
2119: </li>
2120:
2121: <li>
2122: <p>SUNWbtool</p>
2123: </li>
2124:
2125: <li>
2126: <p>SUNWtoo</p>
2127: </li>
2128:
2129: <li>
2130: <p>SUNWlibm</p>
2131: </li>
2132: </ul>
2133: </div>
2134:
2135: <p>Please note the use of GNU binutils on Solaris is
2136: <span class="emphasis"><em>not</em></span>
2137: supported.</p>
2138:
2139: <div class="sect3" lang="en" xml:lang="en">
2140: <div class="titlepage">
2141: <div>
2142: <div>
1.20 ben 2143: <h4 class="title"><a name="id2519187" id=
2144: "id2519187"></a>3.2.6.1. If you are using
1.1 grant 2145: gcc</h4>
2146: </div>
2147: </div>
2148: </div>
2149:
2150: <p>It makes life much simpler if you only use the
2151: same gcc consistently for building all packages.</p>
2152:
2153: <p>It is recommended that an external gcc be used
2154: only for bootstrapping, then either build gcc from
2155: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2156: href=
2157: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.20 ben 2158: class="pkgname">lang/gcc</a> or install a binary gcc
2159: package, then remove gcc used during
2160: bootstrapping.</p>
1.1 grant 2161:
2162: <p>Binary packages of gcc can be found through
2163: <a href=
2164: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2165: target=
2166: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2167: </div>
2168:
2169: <div class="sect3" lang="en" xml:lang="en">
2170: <div class="titlepage">
2171: <div>
2172: <div>
1.20 ben 2173: <h4 class="title"><a name="id2519208" id=
2174: "id2519208"></a>3.2.6.2. If you are using
1.1 grant 2175: Sun WorkShop</h4>
2176: </div>
2177: </div>
2178: </div>
2179:
2180: <p>You will need at least the following packages
2181: installed (from WorkShop 5.0)</p>
2182:
2183: <div class="itemizedlist">
2184: <ul type="disc">
2185: <li>
2186: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2187: </li>
2188:
2189: <li>
2190: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2191: </li>
2192:
2193: <li>
2194: <p>SPROild - Sun WorkShop Incremental
2195: Linker</p>
2196: </li>
2197:
2198: <li>
2199: <p>SPROlang - Sun WorkShop Compilers common
2200: components</p>
2201: </li>
2202: </ul>
2203: </div>
2204:
1.14 xtraeme 2205: <p>You should set <code class="varname">CC</code>,
2206: <code class="varname">CXX</code> and optionally,
2207: <code class="varname">CPP</code> in <code class=
2208: "filename">/etc/mk.conf</code>, eg.</p>
1.1 grant 2209: <pre class="programlisting">
2210: CC= cc
2211: CXX= CC
2212: CPP= /usr/ccs/lib/cpp
2213: </pre>
2214:
2215: <p>You may also want to build 64-bit binaries,
2216: eg.</p>
2217: <pre class="programlisting">
2218: CFLAGS= -xtarget=ultra -xarch=v9
2219: </pre>
2220:
2221: <p>Whichever compiler you use, please ensure the
2222: compiler tools and your $prefix are in your
1.14 xtraeme 2223: <code class="varname">PATH</code>. This includes
2224: <code class="filename">/usr/ccs/{bin,lib}</code> and
2225: eg. <code class=
2226: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2227: </div>
2228: </div>
2229: </div>
2230: </div>
2231:
2232: <div class="chapter" lang="en" xml:lang="en">
2233: <div class="titlepage">
2234: <div>
2235: <div>
2236: <h2 class="title"><a name="using" id=
2237: "using"></a>Chapter 4. Using pkgsrc</h2>
2238: </div>
2239: </div>
2240: </div>
2241:
2242: <div class="toc">
2243: <p><b>Table of Contents</b></p>
2244:
2245: <dl>
2246: <dt><span class="sect1"><a href="#getting-started">4.1.
2247: Working with binary packages</a></span></dt>
2248:
2249: <dd>
2250: <dl>
1.20 ben 2251: <dt><span class="sect2"><a href="#id2519292">4.1.1.
1.1 grant 2252: Where to get binary packages</a></span></dt>
2253:
1.20 ben 2254: <dt><span class="sect2"><a href="#id2519333">4.1.2.
1.1 grant 2255: How to use binary packages</a></span></dt>
2256:
1.20 ben 2257: <dt><span class="sect2"><a href="#id2519467">4.1.3.
1.1 grant 2258: A word of warning</a></span></dt>
2259: </dl>
2260: </dd>
2261:
1.20 ben 2262: <dt><span class="sect1"><a href="#id2519479">4.2.
1.1 grant 2263: Building packages from source</a></span></dt>
2264:
2265: <dd>
2266: <dl>
1.20 ben 2267: <dt><span class="sect2"><a href="#id2519489">4.2.1.
1.1 grant 2268: Requirements</a></span></dt>
2269:
1.20 ben 2270: <dt><span class="sect2"><a href="#id2519509">4.2.2.
1.1 grant 2271: Fetching distfiles</a></span></dt>
2272:
1.20 ben 2273: <dt><span class="sect2"><a href="#id2519561">4.2.3.
1.1 grant 2274: How to build and install</a></span></dt>
2275:
1.20 ben 2276: <dt><span class="sect2"><a href="#id2520288">4.2.4.
1.1 grant 2277: Selecting the compiler</a></span></dt>
2278: </dl>
2279: </dd>
2280: </dl>
2281: </div>
2282:
2283: <div class="sect1" lang="en" xml:lang="en">
2284: <div class="titlepage">
2285: <div>
2286: <div>
2287: <h2 class="title" style="clear: both"><a name=
2288: "getting-started" id=
2289: "getting-started"></a>4.1. Working with binary
2290: packages</h2>
2291: </div>
2292: </div>
2293: </div>
2294:
2295: <p>This section describes how to find, retrieve and
2296: install a precompiled binary package that someone else
2297: already prepared for your type of machine.</p>
2298:
2299: <div class="sect2" lang="en" xml:lang="en">
2300: <div class="titlepage">
2301: <div>
2302: <div>
1.20 ben 2303: <h3 class="title"><a name="id2519292" id=
2304: "id2519292"></a>4.1.1. Where to get binary
1.1 grant 2305: packages</h3>
2306: </div>
2307: </div>
2308: </div>
2309:
2310: <p>Precompiled packages are stored on ftp.NetBSD.org
1.14 xtraeme 2311: and its mirrors in the directory <code class=
2312: "filename">/pub/NetBSD/packages</code> for anonymous
2313: FTP access. Please pick the right subdirectory there as
2314: indicated by <span><strong class="command">uname
2315: -p</strong></span>. In that directory, there is a
1.1 grant 2316: subdirectory for each category plus a subdirectory
1.14 xtraeme 2317: <code class="filename">All</code> which includes the
2318: actual binaries in <code class="filename">.tgz</code>
2319: files. The category subdirectories use symbolic links
2320: to those files (this is the same directory layout as in
2321: <code class=
2322: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2323:
2324: <p>This same directory layout applies for CDROM
2325: distributions, only that the directory may be rooted
1.14 xtraeme 2326: somewhere else, probably somewhere below <code class=
2327: "filename">/cdrom</code>. Please consult your CDROMs
1.1 grant 2328: documentation for the exact location.</p>
2329: </div>
2330:
2331: <div class="sect2" lang="en" xml:lang="en">
2332: <div class="titlepage">
2333: <div>
2334: <div>
1.20 ben 2335: <h3 class="title"><a name="id2519333" id=
2336: "id2519333"></a>4.1.2. How to use binary
1.1 grant 2337: packages</h3>
2338: </div>
2339: </div>
2340: </div>
2341:
2342: <p>If you have the files on a CDROM or downloaded them
2343: to your hard disk, youcan install them with the
1.14 xtraeme 2344: following command (be sure to<span><strong class=
2345: "command">su</strong></span> to root first):</p>
1.1 grant 2346: <pre class="screen">
1.14 xtraeme 2347: <code class="prompt">#</code> <strong class=
2348: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 2349: </pre>
2350:
2351: <p>If you have FTP access and you don't want to
2352: download the packages via FTP prior to installation,
1.14 xtraeme 2353: you can do this automatically by giving
2354: <span><strong class="command">pkg_add</strong></span>
2355: an FTP URL:</p>
1.1 grant 2356: <pre class="screen">
1.14 xtraeme 2357: <code class="prompt">#</code> <strong class=
2358: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSvers>/<arch>/All/package.tgz</code></strong>
1.1 grant 2359: </pre>
2360:
2361: <p>If there is any doubt, the uname utility can be used
2362: to determine the <OSvers>, and <arch> by
1.14 xtraeme 2363: running <span><strong class="command">uname
2364: -rp</strong></span>.</p>
1.1 grant 2365:
2366: <p>Also note that any prerequisite packages needed to
2367: run the package in question will be installed, too,
2368: assuming they are present where you install from.</p>
2369:
2370: <p>After you've installed packages, be sure to have
1.14 xtraeme 2371: <code class="filename">/usr/pkg/bin</code> in your
2372: <code class="varname">PATH</code> so you can actually
2373: start the just installed program.</p>
1.1 grant 2374: </div>
2375:
2376: <div class="sect2" lang="en" xml:lang="en">
2377: <div class="titlepage">
2378: <div>
2379: <div>
1.20 ben 2380: <h3 class="title"><a name="id2519467" id=
2381: "id2519467"></a>4.1.3. A word of
1.1 grant 2382: warning</h3>
2383: </div>
2384: </div>
2385: </div>
2386:
2387: <p>Please pay very careful attention to the warnings
2388: expressed in the <a href=
2389: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2390: <span class="citerefentry"><span class=
2391: "refentrytitle">pkg_add</span>(1)</span></a> manual
2392: page about the inherent dangers of installing binary
2393: packages which you did not create yourself, and the
2394: security holes that can be introduced onto your system
2395: by indiscriminate adding of such files.</p>
2396: </div>
2397: </div>
2398:
2399: <div class="sect1" lang="en" xml:lang="en">
2400: <div class="titlepage">
2401: <div>
2402: <div>
2403: <h2 class="title" style="clear: both"><a name=
1.20 ben 2404: "id2519479" id="id2519479"></a>4.2. Building
1.1 grant 2405: packages from source</h2>
2406: </div>
2407: </div>
2408: </div>
2409:
2410: <p>This assumes that the package is already in pkgsrc. If
2411: it is not, see <a href="#developers-guide" title=
1.2 hubertf 2412: "Part II. The pkgsrc developer's guide">Part II,
2413: “The pkgsrc developer's guide”</a>.</p>
1.1 grant 2414:
2415: <div class="sect2" lang="en" xml:lang="en">
2416: <div class="titlepage">
2417: <div>
2418: <div>
1.20 ben 2419: <h3 class="title"><a name="id2519489" id=
2420: "id2519489"></a>4.2.1. Requirements</h3>
1.1 grant 2421: </div>
2422: </div>
2423: </div>
2424:
2425: <p>To build packages from source on a NetBSD system the
2426: “<span class="quote">comp</span>” and the
2427: “<span class="quote">text</span>”
2428: distribution sets must be installed. If you want to
2429: build X11 related packages the “<span class=
2430: "quote">xbase</span>” and “<span class=
2431: "quote">xcomp</span>” distribution sets are
2432: required, too.</p>
2433: </div>
2434:
2435: <div class="sect2" lang="en" xml:lang="en">
2436: <div class="titlepage">
2437: <div>
2438: <div>
1.20 ben 2439: <h3 class="title"><a name="id2519509" id=
2440: "id2519509"></a>4.2.2. Fetching
1.1 grant 2441: distfiles</h3>
2442: </div>
2443: </div>
2444: </div>
2445:
2446: <p>The distfile (i.e. the unmodified source) must exist
2447: on your system for the packages system to be able to
2448: build it. If it does not exist, pkgsrc will use
2449: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
2450: <span class="citerefentry"><span class=
2451: "refentrytitle">ftp</span>(1)</span></a> to fetch it
2452: automatically.</p>
2453:
2454: <p>You can overwrite some of the major distribution
2455: sites to fit to sites that are close to your own. Have
1.14 xtraeme 2456: a look at <code class=
2457: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
2458: some examples - in particular, look for the
2459: <code class="varname">MASTER_SORT</code>, <code class=
2460: "varname">MASTER_SORT_REGEX</code> and <code class=
2461: "varname">INET_COUNTRY</code> definitions. This may
2462: save some of your bandwidth and time.</p>
1.1 grant 2463:
2464: <p>You can change these settings either in your shell's
2465: environment, or, if you want to keep the settings, by
1.14 xtraeme 2466: editing the <code class="filename">/etc/mk.conf</code>
1.1 grant 2467: file, and adding the definitions there.</p>
2468:
2469: <p>If you don't have a permanent Internet connection
2470: and you want to know which files to download,
1.14 xtraeme 2471: <span><strong class="command">make
2472: fetch-list</strong></span> will tell you what you'll
2473: need. Put these distfiles into <code class=
2474: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 2475: </div>
2476:
2477: <div class="sect2" lang="en" xml:lang="en">
2478: <div class="titlepage">
2479: <div>
2480: <div>
1.20 ben 2481: <h3 class="title"><a name="id2519561" id=
2482: "id2519561"></a>4.2.3. How to build and
1.1 grant 2483: install</h3>
2484: </div>
2485: </div>
2486: </div>
2487:
2488: <p>Assuming that the distfile has been fetched (see
2489: previous section), become root and change into the
1.14 xtraeme 2490: relevant directory and running <span><strong class=
2491: "command">make</strong></span>. For example, type</p>
1.1 grant 2492: <pre class="screen">
1.14 xtraeme 2493: <code class="prompt">%</code> <strong class=
2494: "userinput"><code>cd misc/figlet</code></strong>
2495: <code class="prompt">%</code> <strong class=
2496: "userinput"><code>make</code></strong>
1.1 grant 2497: </pre>
2498:
2499: <p>at the shell prompt to build the various components
2500: of the package, and</p>
2501: <pre class="screen">
1.14 xtraeme 2502: <code class="prompt">#</code> <strong class=
2503: "userinput"><code>make install</code></strong>
1.1 grant 2504: </pre>
2505:
2506: <p>to install the various components into the correct
2507: places on your system. Installing the package on your
2508: system requires you to be root. However, pkgsrc has a
2509: <span class="emphasis"><em>just-in-time-su</em></span>
2510: feature, which allows you to only become root for the
2511: actual installation step</p>
2512:
2513: <p>Taking the figlet utility as an example, we can
2514: install it on our system by building as shown in
2515: <a href="#logs" title=
2516: "Appendix B. Build logs">Appendix B, <i>Build
2517: logs</i></a>.</p>
2518:
2519: <p>The program is installed under the default root of
1.14 xtraeme 2520: the packages tree - <code class=
2521: "filename">/usr/pkg</code>. Should this not conform to
2522: your tastes, set the <code class=
2523: "varname">LOCALBASE</code> variable in your
1.1 grant 2524: environment, and it will use that value as the root of
1.14 xtraeme 2525: your packages tree. So, to use <code class=
2526: "filename">/usr/local</code>, set <code class=
2527: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 2528: environment. Please note that you should use a
2529: directory which is dedicated to packages and not shared
1.14 xtraeme 2530: with other programs (ie, do not try and use
2531: <code class="varname">LOCALBASE=/usr</code>). Also, you
2532: should not try to add any of your own files or
2533: directories (such as <code class=
2534: "filename">src/</code>, <code class=
2535: "filename">obj/</code>, or <code class=
2536: "filename">pkgsrc/</code>) below the <code class=
2537: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 2538: possible conflicts between programs and other files
2539: installed by the package system and whatever else may
2540: have been installed there.</p>
2541:
1.14 xtraeme 2542: <p>Some packages look in <code class=
2543: "filename">/etc/mk.conf</code> to alter some
1.1 grant 2544: configuration options at build time. Have a look at
1.14 xtraeme 2545: <code class=
2546: "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
2547: overview of what will be set there by default.
2548: Environment variables such as <code class=
2549: "varname">LOCALBASE</code> can be set in <code class=
2550: "filename">/etc/mk.conf</code> to save having to
2551: remember to set them each time you want to use
2552: pkgsrc.</p>
1.1 grant 2553:
2554: <p>Occasionally, people want to “<span class=
2555: "quote">look under the covers</span>” to see what
2556: is going on when a package is building or being
2557: installed. This may be for debugging purposes, or out
2558: of simple curiosity. A number of utility values have
2559: been added to help with this.</p>
2560:
2561: <div class="orderedlist">
2562: <ol type="1">
2563: <li>
2564: <p>If you invoke the <a href=
2565: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2566: <span class="citerefentry"><span class=
2567: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 2568: with <code class=
2569: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
2570: amount of information will be displayed. For
2571: example,</p>
1.1 grant 2572: <pre class="screen">
1.14 xtraeme 2573: <strong class=
2574: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 2575: </pre>
2576:
2577: <p>will show all the commands that are invoked,
2578: up to and including the “<span class=
2579: "quote">patch</span>” stage.</p>
2580: </li>
2581:
2582: <li>
2583: <p>If you want to know the value of a certain
1.14 xtraeme 2584: make(1) definition, then the <code class=
2585: "varname">VARNAME</code> definition should be
2586: used, in conjunction with the show-var target.
2587: e.g. to show the expansion of the <a href=
1.1 grant 2588: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2589: <span class="citerefentry"><span class=
2590: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 2591: variable <code class=
2592: "varname">DISTFILES</code>:</p>
1.1 grant 2593: <pre class="screen">
1.14 xtraeme 2594: <code class="prompt">%</code> <strong class=
2595: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 2596: /usr/pkg
1.14 xtraeme 2597: <code class="prompt">%</code>
1.1 grant 2598:
2599: </pre>
2600: </li>
2601: </ol>
2602: </div>
2603:
2604: <p>If you want to install a binary package that you've
2605: either created yourself (see next section), that you
2606: put into pkgsrc/packages manually or that is located on
1.8 wiz 2607: a remote FTP server, you can use the "bin-install"
1.1 grant 2608: target. This target will install a binary package - if
2609: available - via <a href=
2610: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2611: <span class="citerefentry"><span class=
2612: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 2613: <span><strong class="command">make
2614: package</strong></span>. The list of remote FTP sites
2615: searched is kept in the variable <code class=
2616: "varname">BINPKG_SITES</code>, which defaults to
2617: ftp.NetBSD.org. Any flags that should be added to
2618: <a href=
1.1 grant 2619: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2620: <span class="citerefentry"><span class=
2621: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 2622: into <code class="varname">BIN_INSTALL_FLAGS</code>.
2623: See <code class=
2624: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
2625: details.</p>
1.1 grant 2626:
2627: <p>A final word of warning: If you setup a system that
1.14 xtraeme 2628: has a non-standard setting for <code class=
2629: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 2630: any packages are installed, as you can not use several
2631: directories for the same purpose. Doing so will result
2632: in pkgsrc not being able to properly detect your
2633: installed packages, and fail miserably. Note also that
2634: precompiled binary packages are usually built with the
1.14 xtraeme 2635: default <code class="varname">LOCALBASE</code> of
2636: <code class="filename">/usr/pkg</code>, and that you
2637: should <span class="emphasis"><em>not</em></span>
2638: install any if you use a non-standard <code class=
2639: "varname">LOCALBASE</code>.</p>
1.1 grant 2640: </div>
2641:
2642: <div class="sect2" lang="en" xml:lang="en">
2643: <div class="titlepage">
2644: <div>
2645: <div>
1.20 ben 2646: <h3 class="title"><a name="id2520288" id=
2647: "id2520288"></a>4.2.4. Selecting the
1.1 grant 2648: compiler</h3>
2649: </div>
2650: </div>
2651: </div>
2652:
2653: <p>By default, pkgsrc will use GCC to build packages.
2654: This may be overridden by setting the following
2655: variables in /etc/mk.conf:</p>
2656:
2657: <div class="variablelist">
2658: <dl>
1.14 xtraeme 2659: <dt><span class="term"><code class=
2660: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 2661:
2662: <dd>
2663: <p>This is a list of values specifying the chain
2664: of compilers to invoke when building packages.
2665: Valid values are:</p>
2666:
2667: <div class="itemizedlist">
2668: <ul type="disc">
2669: <li>
1.14 xtraeme 2670: <p><code class="varname">distcc</code>:
1.1 grant 2671: distributed C/C++ (chainable)</p>
2672: </li>
2673:
2674: <li>
1.14 xtraeme 2675: <p><code class="varname">ccache</code>:
1.1 grant 2676: compiler cache (chainable)</p>
2677: </li>
2678:
2679: <li>
1.14 xtraeme 2680: <p><code class="varname">gcc</code>: GNU
2681: C/C++ Compiler</p>
1.1 grant 2682: </li>
2683:
2684: <li>
1.14 xtraeme 2685: <p><code class="varname">mipspro</code>:
1.1 grant 2686: Silicon Graphics, Inc. MIPSpro
2687: (n32/n64)</p>
2688: </li>
2689:
2690: <li>
1.14 xtraeme 2691: <p><code class="varname">mipspro</code>:
1.1 grant 2692: Silicon Graphics, Inc. MIPSpro (o32)</p>
2693: </li>
2694:
2695: <li>
1.14 xtraeme 2696: <p><code class="varname">sunpro</code>:
1.1 grant 2697: Microsystems, Inc. WorkShip/Forte/Sun ONE
2698: Studio</p>
2699: </li>
2700: </ul>
2701: </div>
2702:
2703: <p>The default is “<span class=
1.14 xtraeme 2704: "quote"><code class=
2705: "varname">gcc</code></span>”. You can use
2706: <code class="varname">ccache</code> and/or
2707: <code class="varname">distcc</code> with an
2708: appropriate <code class=
2709: "varname">PKGSRC_COMPILER</code> setting, e.g.
2710: “<span class="quote"><code class=
2711: "varname">ccache gcc</code></span>”. This
1.1 grant 2712: variable should always be terminated with a value
2713: for a real compiler.</p>
2714: </dd>
2715:
1.14 xtraeme 2716: <dt><span class="term"><code class=
2717: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 2718:
2719: <dd>
2720: <p>This specifies the minimum version of GCC to
2721: use when building packages. If the system GCC
2722: doesn't satisfy this requirement, then pkgsrc
2723: will build and install one of the GCC packages to
2724: use instead.</p>
2725: </dd>
2726: </dl>
2727: </div>
2728: </div>
2729: </div>
2730: </div>
2731:
2732: <div class="chapter" lang="en" xml:lang="en">
2733: <div class="titlepage">
2734: <div>
2735: <div>
2736: <h2 class="title"><a name="binary" id=
2737: "binary"></a>Chapter 5. Creating binary
2738: packages</h2>
2739: </div>
2740: </div>
2741: </div>
2742:
2743: <div class="toc">
2744: <p><b>Table of Contents</b></p>
2745:
2746: <dl>
1.20 ben 2747: <dt><span class="sect1"><a href="#id2520374">5.1.
1.1 grant 2748: Building a single binary package</a></span></dt>
2749:
1.20 ben 2750: <dt><span class="sect1"><a href="#id2585578">5.2.
1.1 grant 2751: Settings for creation of binary
2752: packages</a></span></dt>
2753:
2754: <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
2755: a bulk build of all packages</a></span></dt>
2756:
2757: <dd>
2758: <dl>
2759: <dt><span class="sect2"><a href=
2760: "#binary.configuration">5.3.1.
2761: Configuration</a></span></dt>
2762:
1.20 ben 2763: <dt><span class="sect2"><a href="#id2585786">5.3.2.
1.1 grant 2764: Other environmental considerations</a></span></dt>
2765:
1.20 ben 2766: <dt><span class="sect2"><a href="#id2585827">5.3.3.
1.1 grant 2767: Operation</a></span></dt>
2768:
1.20 ben 2769: <dt><span class="sect2"><a href="#id2585964">5.3.4.
1.1 grant 2770: What it does</a></span></dt>
2771:
1.20 ben 2772: <dt><span class="sect2"><a href="#id2586021">5.3.5.
1.1 grant 2773: Disk space requirements</a></span></dt>
2774:
1.20 ben 2775: <dt><span class="sect2"><a href="#id2586048">5.3.6.
1.1 grant 2776: Setting up a sandbox for chroot'ed
2777: builds</a></span></dt>
2778:
1.20 ben 2779: <dt><span class="sect2"><a href="#id2586508">5.3.7.
1.1 grant 2780: Building a partial set of packages</a></span></dt>
1.13 hubertf 2781:
2782: <dt><span class="sect2"><a href=
2783: "#bulk-upload">5.3.8. Uploading results of a bulk
2784: build</a></span></dt>
1.1 grant 2785: </dl>
2786: </dd>
2787:
1.20 ben 2788: <dt><span class="sect1"><a href="#id2586946">5.4.
1.1 grant 2789: Creating a multiple CD-ROM packages
2790: collection</a></span></dt>
2791:
2792: <dd>
2793: <dl>
1.20 ben 2794: <dt><span class="sect2"><a href="#id2586961">5.4.1.
1.1 grant 2795: Example of cdpack</a></span></dt>
2796: </dl>
2797: </dd>
2798: </dl>
2799: </div>
2800:
2801: <div class="sect1" lang="en" xml:lang="en">
2802: <div class="titlepage">
2803: <div>
2804: <div>
2805: <h2 class="title" style="clear: both"><a name=
1.20 ben 2806: "id2520374" id="id2520374"></a>5.1. Building a
1.1 grant 2807: single binary package</h2>
2808: </div>
2809: </div>
2810: </div>
2811:
2812: <p>Once you have built and installed a package, you can
2813: create a <span class="emphasis"><em>binary
2814: package</em></span> which can be installed on another
2815: system with <a href=
2816: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2817: <span class="citerefentry"><span class=
2818: "refentrytitle">pkg_add</span>(1)</span></a> This saves
2819: having to build the same package on a group of hosts and
2820: wasting CPU time. It also provides a simple means for
2821: others to install your package, should you distribute
2822: it.</p>
2823:
2824: <p>To create a binary package, change into the
1.14 xtraeme 2825: appropriate directory in pkgsrc, and run
2826: <span><strong class="command">make
2827: package</strong></span>:</p>
1.1 grant 2828: <pre class="screen">
1.14 xtraeme 2829: <code class="prompt">#</code> <strong class=
2830: "userinput"><code>cd misc/figlet</code></strong>
2831: <code class="prompt">#</code> <strong class=
2832: "userinput"><code>make package</code></strong>
1.1 grant 2833: </pre>
2834:
2835: <p>This will build and install your package (if not
2836: already done), and then build a binary package from what
1.14 xtraeme 2837: was installed. You can then use the <span><strong class=
2838: "command">pkg_*</strong></span> tools to manipulate it.
2839: Binary packages are created by default in <code class=
2840: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 2841: gzipped tar file. See <a href="#logs.package" title=
2842: "B.2. Packaging figlet">Section B.2,
2843: “Packaging figlet”</a> for a continuation of
2844: the above <a xmlns=
2845: "http://www.w3.org/TR/xhtml1/transitional" href=
2846: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.20 ben 2847: class="pkgname">misc/figlet</a> example.</p>
1.1 grant 2848:
2849: <p>See <a href="#submit" title=
2850: "Chapter 14. Submitting and Committing">Chapter
2851: 14, <i>Submitting and Committing</i></a> for information
2852: on how to submit such a binary package.</p>
2853: </div>
2854:
2855: <div class="sect1" lang="en" xml:lang="en">
2856: <div class="titlepage">
2857: <div>
2858: <div>
2859: <h2 class="title" style="clear: both"><a name=
1.20 ben 2860: "id2585578" id="id2585578"></a>5.2. Settings
1.1 grant 2861: for creation of binary packages</h2>
2862: </div>
2863: </div>
2864: </div>
2865:
2866: <p>See <a href="#build.helpful-targets" title=
2867: "11.3. Other helpful targets">Section 11.3,
2868: “Other helpful targets”</a>.</p>
2869: </div>
2870:
2871: <div class="sect1" lang="en" xml:lang="en">
2872: <div class="titlepage">
2873: <div>
2874: <div>
2875: <h2 class="title" style="clear: both"><a name=
2876: "bulkbuild" id="bulkbuild"></a>5.3. Doing a
2877: bulk build of all packages</h2>
2878: </div>
2879: </div>
2880: </div>
2881:
2882: <p>If you want to get a full set of precompiled binary
2883: packages, this section describes how to get them. Beware
2884: that the bulk build will remove all currently installed
2885: packages from your system! Having a FTP server configured
2886: either on the machine doing the bulk builds or on a
2887: nearby NFS server can help to make the packages available
2888: to everyone. See <a href=
2889: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
2890: <span class="citerefentry"><span class=
2891: "refentrytitle">ftpd</span>(8)</span></a> for more
2892: information. If you use a remote NFS server's storage, be
2893: sure to not actually compile on NFS storage, as this
2894: slows things down a lot.</p>
2895:
2896: <div class="sect2" lang="en" xml:lang="en">
2897: <div class="titlepage">
2898: <div>
2899: <div>
2900: <h3 class="title"><a name="binary.configuration"
2901: id=
2902: "binary.configuration"></a>5.3.1. Configuration</h3>
2903: </div>
2904: </div>
2905: </div>
2906:
2907: <div class="sect3" lang="en" xml:lang="en">
2908: <div class="titlepage">
2909: <div>
2910: <div>
2911: <h4 class="title"><a name="binary.mk.conf" id=
2912: "binary.mk.conf"></a>5.3.1.1. /etc/mk.conf</h4>
2913: </div>
2914: </div>
2915: </div>
2916:
1.14 xtraeme 2917: <p>You may want to set things in <code class=
2918: "filename">/etc/mk.conf</code>. Look at <code class=
2919: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 2920: details of the default settings. You will want to
1.14 xtraeme 2921: ensure that <code class=
2922: "varname">ACCEPTABLE_LICENSES</code> meet your local
2923: policy. As used in this example, <code class=
2924: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 2925: "emphasis"><em>all</em></span> licenses.</p>
2926: <pre class="programlisting">
2927: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
2928: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
2929: BSDSRCDIR= /usr/src
2930: BSDXSRCDIR= /usr/xsrc # for x11/xservers
2931: OBJHOSTNAME?= yes # use work.`hostname`
2932: FAILOVER_FETCH= yes # insist on the correct checksum
2933: PKG_DEVELOPER?= yes
2934: _ACCEPTABLE= yes
2935: </pre>
2936: </div>
2937:
2938: <div class="sect3" lang="en" xml:lang="en">
2939: <div class="titlepage">
2940: <div>
2941: <div>
1.20 ben 2942: <h4 class="title"><a name="id2585642" id=
2943: "id2585642"></a>5.3.1.2. <code class=
1.14 xtraeme 2944: "filename">build.conf</code></h4>
1.1 grant 2945: </div>
2946: </div>
2947: </div>
2948:
1.14 xtraeme 2949: <p>In <code class="filename">pkgsrc/mk/bulk</code>,
2950: copy <code class="filename">build.conf-example</code>
2951: to <code class="filename">build.conf</code> and edit
2952: it, following the comments in that file. This is the
1.1 grant 2953: config file that determines where log files are
2954: generated after the build, where to mail the build
2955: report to, where your pkgsrc tree is located and
2956: which user to <a href=
2957: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
2958: <span class="citerefentry"><span class=
2959: "refentrytitle">su</span>(8)</span></a> to to do a
1.14 xtraeme 2960: <span><strong class="command">cvs
2961: update</strong></span>.</p>
1.1 grant 2962: </div>
2963:
2964: <div class="sect3" lang="en" xml:lang="en">
2965: <div class="titlepage">
2966: <div>
2967: <div>
1.20 ben 2968: <h4 class="title"><a name="id2585747" id=
2969: "id2585747"></a>5.3.1.3. <code class=
1.14 xtraeme 2970: "filename">pre-build.local</code></h4>
1.1 grant 2971: </div>
2972: </div>
2973: </div>
2974:
2975: <p>It is possible to configure the bulk build to
2976: perform certain site specific tasks at the end of the
1.14 xtraeme 2977: pre-build stage. If the file <code class=
2978: "filename">pre-build.local</code> exists in
2979: <code class="filename">/usr/pkgsrc/mk/bulk</code> it
2980: will be executed (as a sh(1) script) at the end of
2981: the usual pre-build stage. An example use of
2982: <code class="filename">pre-build.local</code> is to
2983: have the line:</p>
1.1 grant 2984: <pre class="screen">
1.14 xtraeme 2985: <code class="prompt">#</code> <strong class=
2986: "userinput"><code>echo "I do not have enough disk space to build this pig." \
2987: > pkgsrc/games/crafty-book-enormous/$BROKENF</code></strong>
1.1 grant 2988: </pre>
2989:
2990: <p>to prevent the system from trying to build a
2991: particular package which requires nearly 3 GB of disk
2992: space.</p>
2993: </div>
2994: </div>
2995:
2996: <div class="sect2" lang="en" xml:lang="en">
2997: <div class="titlepage">
2998: <div>
2999: <div>
1.20 ben 3000: <h3 class="title"><a name="id2585786" id=
3001: "id2585786"></a>5.3.2. Other environmental
1.1 grant 3002: considerations</h3>
3003: </div>
3004: </div>
3005: </div>
3006:
1.14 xtraeme 3007: <p>As <code class="filename">/usr/pkg</code> will be
1.1 grant 3008: completely deleted at the start of bulk builds, make
3009: sure your login shell is placed somewhere else. Either
1.14 xtraeme 3010: drop it into <code class=
3011: "filename">/usr/local/bin</code> (and adjust your login
3012: shell in the passwd file), or (re-)install it via
3013: <a href=
1.1 grant 3014: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3015: <span class="citerefentry"><span class=
3016: "refentrytitle">pkg_add</span>(1)</span></a> from
1.14 xtraeme 3017: <code class="filename">/etc/rc.local</code>, so you can
1.1 grant 3018: login after a reboot (remember that your current
3019: process won't die if the package is removed, you just
3020: can't start any new instances of the shell any more).
3021: Also, if you use NetBSD earlier than 1.5, or you still
3022: want to use the pkgsrc version of ssh for some reason,
3023: be sure to install ssh before starting it from
1.14 xtraeme 3024: <code class="filename">rc.local</code>:</p>
1.1 grant 3025: <pre class="programlisting">
3026: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
3027: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
3028: /usr/pkg/etc/rc.d/sshd
3029: fi
3030: </pre>
3031:
3032: <p>Not doing so will result in you being not able to
3033: log in via ssh after the bulk build is finished or if
3034: the machine gets rebooted or crashes. You have been
3035: warned! :)</p>
3036: </div>
3037:
3038: <div class="sect2" lang="en" xml:lang="en">
3039: <div class="titlepage">
3040: <div>
3041: <div>
1.20 ben 3042: <h3 class="title"><a name="id2585827" id=
3043: "id2585827"></a>5.3.3. Operation</h3>
1.1 grant 3044: </div>
3045: </div>
3046: </div>
3047:
3048: <p>Make sure you don't need any of the packages still
3049: installed.</p>
3050:
3051: <div class="warning" style=
3052: "margin-left: 0.5in; margin-right: 0.5in;">
3053: <h3 class="title">Warning</h3>
3054:
3055: <p>During the bulk build, <span class=
3056: "emphasis"><em>all packages will be
3057: removed!</em></span></p>
3058: </div>
3059:
3060: <p>Be sure to remove all other things that might
3061: interfere with builds, like some libs installed in
1.14 xtraeme 3062: <code class="filename">/usr/local</code>, etc. then
3063: become root and type:</p>
1.1 grant 3064: <pre class="screen">
1.14 xtraeme 3065: <code class="prompt">#</code> <strong class=
3066: "userinput"><code>cd /usr/pkgsrc</code></strong>
3067: <code class="prompt">#</code> <strong class=
3068: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 3069: </pre>
3070:
3071: <p>If for some reason your last build didn't complete
3072: (power failure, system panic, ...), you can continue it
3073: by running:</p>
3074: <pre class="screen">
1.14 xtraeme 3075: <code class="prompt">#</code> <strong class=
3076: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 3077: </pre>
3078:
3079: <p>At the end of the bulk build, you will get a summary
3080: via mail, and find build logs in the directory
1.14 xtraeme 3081: specified by <code class="varname">FTP</code> in the
3082: <code class="filename">build.conf</code> file.</p>
1.1 grant 3083: </div>
3084:
3085: <div class="sect2" lang="en" xml:lang="en">
3086: <div class="titlepage">
3087: <div>
3088: <div>
1.20 ben 3089: <h3 class="title"><a name="id2585964" id=
3090: "id2585964"></a>5.3.4. What it does</h3>
1.1 grant 3091: </div>
3092: </div>
3093: </div>
3094:
3095: <p>The bulk builds consist of three steps:</p>
3096:
3097: <div class="variablelist">
3098: <dl>
3099: <dt><span class="term">1. pre-build</span></dt>
3100:
3101: <dd>
3102: <p>The script updates your pkgsrc tree via
3103: (anon)cvs, then cleans out any broken distfiles,
3104: and removes all packages installed.</p>
3105: </dd>
3106:
3107: <dt><span class="term">2. the bulk
3108: build</span></dt>
3109:
3110: <dd>
3111: <p>This is basically “<span class=
3112: "quote">make bulk-package</span>” with an
3113: optimised order in which packages will be built.
3114: Packages that don't require other packages will
3115: be built first, and packages with many
3116: dependencies will be built later.</p>
3117: </dd>
3118:
3119: <dt><span class="term">3. post-build</span></dt>
3120:
3121: <dd>
3122: <p>Generates a report that's placed in the
1.14 xtraeme 3123: directory specified in the <code class=
3124: "filename">build.conf</code> file named
3125: <code class="filename">broken.html</code>, a
3126: short version of that report will also be mailed
3127: to the build's admin.</p>
1.1 grant 3128: </dd>
3129: </dl>
3130: </div>
3131:
3132: <p>During the build, a list of broken packages will be
1.14 xtraeme 3133: compiled in <code class=
3134: "filename">/usr/pkgsrc/.broken</code> (or <code class=
3135: "filename">.../.broken.${MACHINE}</code> if
3136: <code class="varname">OBJMACHINE</code> is set),
3137: individual build logs of broken builds can be found in
3138: the package's directory. These files are used by the
3139: bulk-targets to mark broken builds to not waste time
3140: trying to rebuild them, and they can be used to debug
3141: these broken package builds later.</p>
1.1 grant 3142: </div>
3143:
3144: <div class="sect2" lang="en" xml:lang="en">
3145: <div class="titlepage">
3146: <div>
3147: <div>
1.20 ben 3148: <h3 class="title"><a name="id2586021" id=
3149: "id2586021"></a>5.3.5. Disk space
1.1 grant 3150: requirements</h3>
3151: </div>
3152: </div>
3153: </div>
3154:
3155: <p>Currently, roughly the following requirements are
3156: valid for NetBSD 2.0/i386:</p>
3157:
3158: <div class="itemizedlist">
3159: <ul type="disc">
3160: <li>
3161: <p>10 GB - distfiles (NFS ok)</p>
3162: </li>
3163:
3164: <li>
3165: <p>8 GB - full set of all binaries (NFS ok)</p>
3166: </li>
3167:
3168: <li>
3169: <p>5 GB - temp space for compiling (local disk
3170: recommended)</p>
3171: </li>
3172: </ul>
3173: </div>
3174:
3175: <p>Note that all pkgs will be de-installed as soon as
3176: they are turned into a binary package, and that sources
3177: are removed, so there is no excessively huge demand to
3178: disk space. Afterwards, if the package is needed again,
3179: it will be installed via <a href=
3180: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3181: <span class="citerefentry"><span class=
3182: "refentrytitle">pkg_add</span>(1)</span></a> instead of
3183: building again, so there are no cycles wasted by
3184: recompiling.</p>
3185: </div>
3186:
3187: <div class="sect2" lang="en" xml:lang="en">
3188: <div class="titlepage">
3189: <div>
3190: <div>
1.20 ben 3191: <h3 class="title"><a name="id2586048" id=
3192: "id2586048"></a>5.3.6. Setting up a sandbox
1.1 grant 3193: for chroot'ed builds</h3>
3194: </div>
3195: </div>
3196: </div>
3197:
1.12 agc 3198: <p>If you don't want all the packages nuked from a
3199: machine (rendering it useless for anything but pkg
3200: compiling), there is the possibility of doing the pkg
3201: bulk build inside a chroot environment.</p>
3202:
3203: <p>The first step is to set up a chroot sandbox, e.g.
1.14 xtraeme 3204: <code class="filename">/usr/sandbox</code>. This can be
1.12 agc 3205: done by using null mounts, or manually.</p>
3206:
1.14 xtraeme 3207: <p>There is a shell script called <code class=
3208: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
3209: set up the sandbox environment using null mounts. It
3210: will also create a script called <code class=
3211: "filename">sandbox</code> in the root of the sandbox
1.12 agc 3212: environment, which will allow the null mounts to be
1.14 xtraeme 3213: activated using the <span><strong class=
3214: "command">sandbox mount</strong></span> command and
3215: deactivated using the <span><strong class=
3216: "command">sandbox umount</strong></span> command.</p>
1.12 agc 3217:
3218: <p>To set up a sandbox environment by hand, after
3219: extracting all the sets from a NetBSD installation or
1.14 xtraeme 3220: doing a <span><strong class="command">make distribution
3221: DESTDIR=/usr/sandbox</strong></span> in <code class=
3222: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 3223: items are present and properly configured:</p>
1.1 grant 3224:
3225: <div class="procedure">
3226: <ol type="1">
3227: <li>
3228: <p>Kernel</p>
3229: <pre class="screen">
1.14 xtraeme 3230: <code class="prompt">#</code> <strong class=
3231: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 3232: </pre>
3233: </li>
3234:
3235: <li>
1.14 xtraeme 3236: <p><code class="filename">/dev/*</code></p>
1.1 grant 3237: <pre class="screen">
1.14 xtraeme 3238: <code class="prompt">#</code> <strong class=
3239: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 3240: </pre>
3241: </li>
3242:
3243: <li>
1.14 xtraeme 3244: <p><code class="filename">/etc/resolv.conf</code>
1.1 grant 3245: (for <a xmlns=
3246: "http://www.w3.org/TR/xhtml1/transitional" href=
3247: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20 ben 3248: class="pkgname">security/smtpd</a> and mail):</p>
1.1 grant 3249: <pre class="screen">
1.14 xtraeme 3250: <code class="prompt">#</code> <strong class=
3251: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 3252: </pre>
3253: </li>
3254:
3255: <li>
3256: <p>Working(!) mail config (hostname,
3257: sendmail.cf):</p>
3258: <pre class="screen">
1.14 xtraeme 3259: <code class="prompt">#</code> <strong class=
3260: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 3261: </pre>
3262: </li>
3263:
3264: <li>
1.14 xtraeme 3265: <p><code class="filename">/etc/localtime</code>
3266: (for <a xmlns=
1.1 grant 3267: "http://www.w3.org/TR/xhtml1/transitional" href=
3268: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20 ben 3269: class="pkgname">security/smtpd</a>):</p>
1.1 grant 3270: <pre class="screen">
1.14 xtraeme 3271: <code class="prompt">#</code> <strong class=
3272: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 3273: </pre>
3274: </li>
3275:
3276: <li>
1.14 xtraeme 3277: <p><code class="filename">/usr/src</code> (system
1.1 grant 3278: sources, for <a xmlns=
3279: "http://www.w3.org/TR/xhtml1/transitional" href=
3280: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.20 ben 3281: class="pkgname">sysutils/aperture</a>, <a xmlns=
3282: "http://www.w3.org/TR/xhtml1/transitional" href=
3283: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
3284: class="pkgname">net/ppp-mppe</a>):</p>
1.1 grant 3285: <pre class="screen">
1.14 xtraeme 3286: <code class="prompt">#</code> <strong class=
3287: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
3288: <code class="prompt">#</code> <strong class=
3289: "userinput"><code>ln -s cvs/src-1.6 src</code></strong>
1.1 grant 3290: </pre>
3291: </li>
3292:
3293: <li>
1.14 xtraeme 3294: <p>Create <code class=
3295: "filename">/var/db/pkg</code> (not part of
3296: default install):</p>
1.1 grant 3297: <pre class="screen">
1.14 xtraeme 3298: <code class="prompt">#</code> <strong class=
3299: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 3300: </pre>
3301: </li>
3302:
3303: <li>
1.14 xtraeme 3304: <p>Create <code class="filename">/usr/pkg</code>
3305: (not part of default install):</p>
1.1 grant 3306: <pre class="screen">
1.14 xtraeme 3307: <code class="prompt">#</code> <strong class=
3308: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 3309: </pre>
3310: </li>
3311:
3312: <li>
1.14 xtraeme 3313: <p>Checkout pkgsrc via cvs into <code class=
3314: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 3315: <pre class="screen">
1.14 xtraeme 3316: <code class="prompt">#</code> <strong class=
3317: "userinput"><code>cd /usr/sandbox/usr</code></strong>
3318: <code class="prompt">#</code> <strong class=
3319: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 3320: </pre>
3321:
3322: <p>Do not mount/link this to the copy of your
3323: pkgsrc tree you do development in, as this will
3324: likely cause problems!</p>
3325: </li>
3326:
3327: <li>
1.14 xtraeme 3328: <p>Make <code class=
3329: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
3330: and <code class="filename">.../distfiles</code>
3331: point somewhere appropriate. NFS- and/or
3332: nullfs-mounts may come in handy!</p>
1.1 grant 3333: </li>
3334:
3335: <li>
1.14 xtraeme 3336: <p>Edit <code class=
3337: "filename">/etc/mk.conf</code>, see <a href=
3338: "#binary.mk.conf" title=
1.1 grant 3339: "5.3.1.1. /etc/mk.conf">Section 5.3.1.1,
3340: “/etc/mk.conf”</a>.</p>
3341: </li>
3342:
3343: <li>
1.14 xtraeme 3344: <p>Adjust <code class=
3345: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 3346: needs.</p>
3347: </li>
3348:
3349: <li>
1.14 xtraeme 3350: <p>If you have set <code class=
3351: "varname">CVS_USER</code> in <code class=
3352: "filename">build.conf</code>, make sure that
3353: account exists and can do a <span><strong class=
3354: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 3355: properly!</p>
3356: </li>
3357: </ol>
3358: </div>
3359:
3360: <p>When the chroot sandbox is setup, you can start the
3361: build with the following steps:</p>
3362: <pre class="screen">
1.14 xtraeme 3363: <code class="prompt">#</code> <strong class=
3364: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
3365: <code class="prompt">#</code> <strong class=
3366: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 3367: </pre>
3368:
3369: <p>This will just jump inside the sandbox and start
3370: building. At the end of the build, mail will be sent
3371: with the results of the build. Created binary pkgs will
1.14 xtraeme 3372: be in <code class=
3373: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 3374: (wherever that points/mounts to/from).</p>
3375: </div>
3376:
3377: <div class="sect2" lang="en" xml:lang="en">
3378: <div class="titlepage">
3379: <div>
3380: <div>
1.20 ben 3381: <h3 class="title"><a name="id2586508" id=
3382: "id2586508"></a>5.3.7. Building a partial
1.1 grant 3383: set of packages</h3>
3384: </div>
3385: </div>
3386: </div>
3387:
3388: <p>In addition to building a complete set of all
1.14 xtraeme 3389: packages in pkgsrc, the <code class=
3390: "filename">pkgsrc/mk/bulk/build</code> script may be
3391: used to build a subset of the packages contained in
3392: pkgsrc. By setting defining <code class=
3393: "varname">SPECIFIC_PKGS</code> in <code class=
3394: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 3395:
3396: <div class="itemizedlist">
3397: <ul type="disc">
3398: <li>
3399: <p>SITE_SPECIFIC_PKGS</p>
3400: </li>
3401:
3402: <li>
3403: <p>HOST_SPECIFIC_PKGS</p>
3404: </li>
3405:
3406: <li>
3407: <p>GROUP_SPECIFIC_PKGS</p>
3408: </li>
3409:
3410: <li>
3411: <p>USER_SPECIFIC_PKGS</p>
3412: </li>
3413: </ul>
3414: </div>
3415:
3416: <p>will define the set of packages which should be
3417: built. The bulk build code will also include any
3418: packages which are needed as dependencies for the
3419: explicitly listed packages.</p>
3420:
3421: <p>One use of this is to do a bulk build with
1.14 xtraeme 3422: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 3423: sandbox periodically to have a complete set of the
3424: binary packages needed for your site available without
3425: the overhead of building extra packages that are not
3426: needed.</p>
3427: </div>
1.13 hubertf 3428:
3429: <div class="sect2" lang="en" xml:lang="en">
3430: <div class="titlepage">
3431: <div>
3432: <div>
3433: <h3 class="title"><a name="bulk-upload" id=
3434: "bulk-upload"></a>5.3.8. Uploading results
3435: of a bulk build</h3>
3436: </div>
3437: </div>
3438: </div>
3439:
3440: <p>This section describes how pkgsrc developers can
3441: upload binary pkgs built by bulk builds to
3442: ftp.NetBSD.org.</p>
3443:
1.17 sketch 3444: <p>If you would like to automatically create checksum
3445: files for the binary packages you intend to upload,
3446: remember to set <code class="varname">MKSUMS=yes</code>
3447: in your <code class=
3448: "filename">mk/bulk/build.conf</code>.</p>
3449:
3450: <p>If you would like to PGP sign the checksum files
3451: (highly recommended!), remember to set <code class=
3452: "varname">SIGN_AS=username@NetBSD.org</code> in your
3453: <code class="filename">mk/bulk/build.conf</code>. This
3454: will prompt you for your gpg password to sign the files
3455: before uploading everything.</p>
3456:
3457: <p>Then, make sure that you have <code class=
1.14 xtraeme 3458: "varname">RSYNC_DST</code> set properly in your
3459: <code class="filename">mk/bulk/build.conf</code> file,
3460: i.e. adjust it to something like one of the
3461: following:</p>
1.13 hubertf 3462: <pre class="screen">
3463: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3464: </pre>
3465:
3466: <p>Please use appropviate values for "pkgsrc-200xQ4",
3467: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 3468: ftp.NetBSD.org is different from <code class=
3469: "varname">CVS_USER</code>, write your login directly
3470: into the variable, e.g. my local account is "feyrer",
3471: but for my login "hubertf", I use:</p>
1.13 hubertf 3472: <pre class="screen">
3473: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3474: </pre>
3475:
1.14 xtraeme 3476: <p>A separate <code class="filename">upload</code>
1.13 hubertf 3477: directory is used here to allow "closing" the directory
3478: during upload. To do so, run the following command on
3479: ftp.NetBSD.org next:</p>
3480: <pre class="screen">
1.14 xtraeme 3481: nbftp% <strong class=
3482: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 3483: </pre>
3484:
1.14 xtraeme 3485: <p>Please note that <code class=
3486: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 3487: appropriate for packages for the NetBSD operating
3488: system. Binary packages for other operating systems
1.14 xtraeme 3489: should go into <code class=
3490: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 3491:
3492: <p>Before uploading the binary pkgs, ssh authentication
3493: needs to be setup next. This example shows how to setup
3494: temporary keys for the root account <span class=
3495: "emphasis"><em>inside the sandbox</em></span> (assuming
3496: that no keys should be present there usually):</p>
3497: <pre class="screen">
1.14 xtraeme 3498: <code class="prompt">#</code> <strong class=
3499: "userinput"><code>chroot /usr/sandbox</code></strong>
3500: chroot-<code class="prompt">#</code> <strong class=
3501: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
3502: chroot-<code class="prompt">#</code> <strong class=
3503: "userinput"><code>ssh-keygen -t dsa</code></strong>
3504: chroot-<code class="prompt">#</code> <strong class=
3505: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 3506: </pre>
3507:
1.14 xtraeme 3508: <p>Now take the output of <code class=
3509: "filename">id-dsa.pub</code> and append it to your
3510: <code class="filename">~/.ssh/authorized_keys</code>
1.17 sketch 3511: file on ftp.NetBSD.org. You can remove the key after
1.14 xtraeme 3512: the upload is done!</p>
1.13 hubertf 3513:
3514: <p>Next, test if your ssh connection really works:</p>
3515: <pre class="screen">
1.14 xtraeme 3516: chroot-<code class="prompt">#</code> <strong class=
3517: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 3518: </pre>
3519:
3520: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
3521:
3522: <p>Now after all this works, you can exit the sandbox
3523: and start the upload:</p>
3524: <pre class="screen">
1.14 xtraeme 3525: chroot-<code class="prompt">#</code> <strong class=
3526: "userinput"><code>exit</code></strong>
3527: <code class="prompt">#</code> <strong class=
3528: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
3529: <code class="prompt">#</code> <strong class=
3530: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 3531: </pre>
3532:
3533: <p>The upload process may take quite some time. Use
3534: "ls" or "du" on the FTP server to monitor progress of
3535: the upload.</p>
3536:
3537: <p>After the upload has ended, first thing is to revoke
3538: ssh access:</p>
3539: <pre class="screen">
1.14 xtraeme 3540: nbftp% <strong class=
3541: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 3542: Gdd:x!
3543: </pre>
3544:
3545: <p>Use whatever is needed to remove the key you've
3546: entered before! Last, move the uploaded packages out of
1.14 xtraeme 3547: the <code class="filename">upload</code> directory to
3548: have them accessible to everyone:</p>
1.13 hubertf 3549: <pre class="screen">
1.14 xtraeme 3550: nbftp% <strong class=
3551: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
3552: nbftp% <strong class=
3553: "userinput"><code>mv upload/* .</code></strong>
3554: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
3555: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 3556: </pre>
3557: </div>
1.1 grant 3558: </div>
3559:
3560: <div class="sect1" lang="en" xml:lang="en">
3561: <div class="titlepage">
3562: <div>
3563: <div>
3564: <h2 class="title" style="clear: both"><a name=
1.20 ben 3565: "id2586946" id="id2586946"></a>5.4. Creating a
1.1 grant 3566: multiple CD-ROM packages collection</h2>
3567: </div>
3568: </div>
3569: </div>
3570:
3571: <p>After your pkgsrc bulk-build has completed, you may
3572: wish to create a CD-ROM set of the resulting binary
3573: packages to assist in installing packages on other
3574: machines. The <a xmlns=
3575: "http://www.w3.org/TR/xhtml1/transitional" href=
3576: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.20 ben 3577: class="pkgname">pkgtools/cdpack</a> package provides a
3578: simple tool for creating the ISO 9660 images.
3579: <span><strong class="command">cdpack</strong></span>
3580: arranges the packages on the CD-ROMs in a way that keeps
3581: all the dependencies for given package on the same CD as
3582: that package.</p>
1.1 grant 3583:
3584: <div class="sect2" lang="en" xml:lang="en">
3585: <div class="titlepage">
3586: <div>
3587: <div>
1.20 ben 3588: <h3 class="title"><a name="id2586961" id=
3589: "id2586961"></a>5.4.1. Example of
1.1 grant 3590: cdpack</h3>
3591: </div>
3592: </div>
3593: </div>
3594:
3595: <p>Complete documentation for cdpack is found in the
3596: cdpack(1) manpage. The following short example assumes
1.14 xtraeme 3597: that the binary packages are left in <code class=
3598: "filename">/usr/pkgsrc/packages/All</code> and that
3599: sufficient disk space exists in <code class=
3600: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 3601: <pre class="screen">
1.14 xtraeme 3602: <code class="prompt">#</code> <strong class=
3603: "userinput"><code>mkdir /u2/images</code></strong>
3604: <code class="prompt">#</code> <strong class=
3605: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
3606: <code class="prompt">#</code> <strong class=
3607: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 3608: </pre>
3609:
3610: <p>If you wish to include a common set of files
1.14 xtraeme 3611: (<code class="filename">COPYRIGHT</code>, <code class=
3612: "filename">README</code>, etc.) on each CD in the
1.1 grant 3613: collection, then you need to create a directory which
3614: contains these files. e.g.</p>
3615: <pre class="screen">
1.14 xtraeme 3616: <code class="prompt">#</code> <strong class=
3617: "userinput"><code>mkdir /tmp/common</code></strong>
3618: <code class="prompt">#</code> <strong class=
3619: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
3620: <code class="prompt">#</code> <strong class=
3621: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
3622: <code class="prompt">#</code> <strong class=
3623: "userinput"><code>mkdir /tmp/common/bin</code></strong>
3624: <code class="prompt">#</code> <strong class=
3625: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
3626: <code class="prompt">#</code> <strong class=
3627: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
3628: <code class="prompt">#</code> <strong class=
3629: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 3630: </pre>
3631:
3632: <p>Now create the images:</p>
3633: <pre class="screen">
1.14 xtraeme 3634: <code class="prompt">#</code> <strong class=
3635: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 3636: </pre>
3637:
1.14 xtraeme 3638: <p>Each image will contain <code class=
3639: "filename">README</code>, <code class=
3640: "filename">COPYING</code>, and <code class=
3641: "filename">bin/myscript</code> in their root
1.1 grant 3642: directories.</p>
3643: </div>
3644: </div>
3645: </div>
3646:
3647: <div class="chapter" lang="en" xml:lang="en">
3648: <div class="titlepage">
3649: <div>
3650: <div>
3651: <h2 class="title"><a name="faq" id=
3652: "faq"></a>Chapter 6. Frequently Asked
3653: Questions</h2>
3654: </div>
3655: </div>
3656: </div>
3657:
3658: <div class="toc">
3659: <p><b>Table of Contents</b></p>
3660:
3661: <dl>
1.20 ben 3662: <dt><span class="sect1"><a href="#id2587153">6.1. Are
1.18 xtraeme 3663: there any mailing lists for pkg-related
1.1 grant 3664: discussion?</a></span></dt>
3665:
1.20 ben 3666: <dt><span class="sect1"><a href="#id2587355">6.2.
1.1 grant 3667: Where's the pkgviews documentation?</a></span></dt>
3668:
1.5 hubertf 3669: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 3670: Utilities for package management
3671: (pkgtools)</a></span></dt>
3672:
1.20 ben 3673: <dt><span class="sect1"><a href="#id2587540">6.4. How
1.1 grant 3674: to use pkgsrc as non-root</a></span></dt>
3675:
1.20 ben 3676: <dt><span class="sect1"><a href="#id2587552">6.5. How
1.15 xtraeme 3677: to resume transfers when fetching
3678: distfiles?</a></span></dt>
1.14 xtraeme 3679:
1.20 ben 3680: <dt><span class="sect1"><a href="#id2587594">6.6. How
1.1 grant 3681: can I install/use XFree86 from pkgsrc?</a></span></dt>
3682:
1.20 ben 3683: <dt><span class="sect1"><a href="#id2587622">6.7. How
1.1 grant 3684: can I install/use X.org from pkgsrc?</a></span></dt>
3685:
1.20 ben 3686: <dt><span class="sect1"><a href="#id2587650">6.8. How
1.1 grant 3687: to fetch files from behind a firewall</a></span></dt>
3688:
1.20 ben 3689: <dt><span class="sect1"><a href="#id2587664">6.9. How
1.14 xtraeme 3690: do I tell <span><strong class="command">make
3691: fetch</strong></span> to do passive
3692: FTP?</a></span></dt>
1.1 grant 3693:
1.20 ben 3694: <dt><span class="sect1"><a href="#id2587715">6.10. How
1.1 grant 3695: to fetch all distfiles at once</a></span></dt>
3696:
1.20 ben 3697: <dt><span class="sect1"><a href="#id2587923">6.11. What
1.14 xtraeme 3698: does “<span class="quote">Don't know how to make
3699: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 3700: mean?</a></span></dt>
3701:
1.20 ben 3702: <dt><span class="sect1"><a href="#id2587961">6.12. What
1.14 xtraeme 3703: does “<span class="quote">Could not find
3704: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 3705:
1.20 ben 3706: <dt><span class="sect1"><a href="#id2588087">6.13.
1.1 grant 3707: Using 'sudo' with pkgsrc</a></span></dt>
3708:
1.14 xtraeme 3709: <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1 grant 3710: Configuration files handling and
3711: placement</a></span></dt>
3712:
1.14 xtraeme 3713: <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1 grant 3714: Automated security checks</a></span></dt>
3715: </dl>
3716: </div>
3717:
3718: <p>This section contains hints, tips & tricks on
3719: special things in pkgsrc that we didn't find a better place
3720: for in the previous chapters, and it contains items for
3721: both pkgsrc users and developers.</p>
3722:
3723: <div class="sect1" lang="en" xml:lang="en">
3724: <div class="titlepage">
3725: <div>
3726: <div>
3727: <h2 class="title" style="clear: both"><a name=
1.20 ben 3728: "id2587153" id="id2587153"></a>6.1. Are there
1.18 xtraeme 3729: any mailing lists for pkg-related discussion?</h2>
1.1 grant 3730: </div>
3731: </div>
3732: </div>
3733:
1.18 xtraeme 3734: <p>The following mailing lists may be of interest to
3735: pkgsrc users:</p>
3736:
3737: <div class="itemizedlist">
3738: <ul type="disc">
3739: <li>
3740: <p><a href=
3741: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.20 ben 3742: target="_top">pkgsrc-bugs</a> -- a list where
3743: problem reports related to pkgsrc are sent and
3744: discussed</p>
1.18 xtraeme 3745: </li>
3746:
3747: <li>
3748: <p><a href=
3749: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.20 ben 3750: target="_top">pkgsrc-bulk</a> -- a list where the
3751: results of pkgsrc bulk builds are sent and
3752: discussed</p>
1.18 xtraeme 3753: </li>
3754:
3755: <li>
3756: <p><a href=
3757: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.20 ben 3758: target="_top">pkgsrc-changes</a> -- a list where
3759: all commit messages to pkgsrc are sent</p>
1.18 xtraeme 3760: </li>
3761:
3762: <li>
3763: <p><a href=
3764: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.20 ben 3765: target="_top">tech-pkg</a> -- a general discussion
3766: list for all things related to pkgsrc</p>
1.18 xtraeme 3767: </li>
3768: </ul>
3769: </div>
3770:
3771: <p>To subscribe, do:</p>
1.1 grant 3772: <pre class="programlisting">
1.18 xtraeme 3773: <code class="prompt">%</code> echo subscribe <em class=
3774: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 3775: </pre>
3776:
1.18 xtraeme 3777: <p>Archives for all these mailing lists are available
3778: from <a href="http://mail-index.NetBSD.org/" target=
3779: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 3780: </div>
3781:
3782: <div class="sect1" lang="en" xml:lang="en">
3783: <div class="titlepage">
3784: <div>
3785: <div>
3786: <h2 class="title" style="clear: both"><a name=
1.20 ben 3787: "id2587355" id="id2587355"></a>6.2. Where's
1.1 grant 3788: the pkgviews documentation?</h2>
3789: </div>
3790: </div>
3791: </div>
3792:
3793: <p>Pkgviews is tightly integrated with buildlink. You can
1.14 xtraeme 3794: find a pkgviews User's guide in <code class=
3795: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 3796: </div>
3797:
3798: <div class="sect1" lang="en" xml:lang="en">
3799: <div class="titlepage">
3800: <div>
3801: <div>
3802: <h2 class="title" style="clear: both"><a name=
1.5 hubertf 3803: "faq-pkgtools" id=
3804: "faq-pkgtools"></a>6.3. Utilities for package
3805: management (pkgtools)</h2>
1.1 grant 3806: </div>
3807: </div>
3808: </div>
3809:
1.14 xtraeme 3810: <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1 grant 3811: directory pkgtools contains a number of useful utilities
3812: for both users and developers of pkgsrc. This section
3813: attempts only to make the reader aware of the utilities
3814: and when they might be useful, and not to duplicate the
3815: documentation that comes with each package.</p>
3816:
3817: <p>Utilities used by pkgsrc (automatically installed when
3818: needed):</p>
3819:
3820: <div class="itemizedlist">
3821: <ul type="disc">
3822: <li>
3823: <p><a xmlns=
3824: "http://www.w3.org/TR/xhtml1/transitional" href=
3825: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.20 ben 3826: class="pkgname">pkgtools/x11-links</a>: symlinks
3827: for use by buildlink</p>
1.1 grant 3828: </li>
3829: </ul>
3830: </div>
3831:
3832: <p>OS tool augmentation (automatically installed when
3833: needed):</p>
3834:
3835: <div class="itemizedlist">
3836: <ul type="disc">
3837: <li>
3838: <p><a xmlns=
3839: "http://www.w3.org/TR/xhtml1/transitional" href=
3840: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20 ben 3841: class="pkgname">pkgtools/digest</a>: calculates
3842: SHA1 checksums (and other kinds)</p>
1.1 grant 3843: </li>
3844:
3845: <li>
3846: <p><a xmlns=
3847: "http://www.w3.org/TR/xhtml1/transitional" href=
3848: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.20 ben 3849: class="pkgname">pkgtools/libnbcompat</a>: compat
3850: library for pkg tools</p>
1.1 grant 3851: </li>
3852:
3853: <li>
3854: <p><a xmlns=
3855: "http://www.w3.org/TR/xhtml1/transitional" href=
3856: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.20 ben 3857: class="pkgname">pkgtools/mtree</a>: installed on
3858: non-BSD systems due to lack of native mtree</p>
1.1 grant 3859: </li>
3860:
3861: <li>
3862: <p><a xmlns=
3863: "http://www.w3.org/TR/xhtml1/transitional" href=
3864: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 3865: class="pkgname">pkgtools/pkg_install</a>:
3866: up-to-date replacement for /usr/sbin/pkg_install,
3867: or for use on operating systems where pkg_install
3868: is not present</p>
1.1 grant 3869: </li>
3870: </ul>
3871: </div>
3872:
3873: <p>Utilities used by pkgsrc (not automatically
3874: installed):</p>
3875:
3876: <div class="itemizedlist">
3877: <ul type="disc">
3878: <li>
3879: <p><a xmlns=
3880: "http://www.w3.org/TR/xhtml1/transitional" href=
3881: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.20 ben 3882: class="pkgname">pkgtools/pkg_tarup</a>: create a
3883: binary package from an already-installed package.
3884: used by 'make replace' to save the old package</p>
1.1 grant 3885: </li>
3886:
3887: <li>
3888: <p><a xmlns=
3889: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 3890: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.20 ben 3891: class="pkgname">pkgtools/dfdisk</a>: adds extra
3892: functionality to pkgsrc, allowing it to fetch
3893: distfiles from multiple locations. It currently
3894: supports the following methods: multiple CD-ROMs
3895: and network FTP/HTTP connections.</p>
1.5 hubertf 3896: </li>
3897:
3898: <li>
3899: <p><a xmlns=
3900: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 3901: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20 ben 3902: class="pkgname">pkgtools/xpkgwedge</a>: put X11
3903: packages someplace else (enabled by default)</p>
1.1 grant 3904: </li>
1.5 hubertf 3905:
3906: <li>
3907: <p><a xmlns=
3908: "http://www.w3.org/TR/xhtml1/transitional" href=
3909: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20 ben 3910: class="pkgname">devel/cpuflags</a>: will determine
3911: the best compiler flags to optimise code for your
3912: current CPU and compiler.</p>
1.5 hubertf 3913: </li>
1.1 grant 3914: </ul>
3915: </div>
3916:
3917: <p>Utilities for keeping track of installed packages,
3918: being up to date, etc:</p>
3919:
3920: <div class="itemizedlist">
3921: <ul type="disc">
3922: <li>
3923: <p><a xmlns=
3924: "http://www.w3.org/TR/xhtml1/transitional" href=
3925: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.20 ben 3926: class="pkgname">pkgtools/pkg_chk</a>: installs
3927: pkg_chk, which reports on packages whose installed
3928: versions do not match the latest pkgsrc entries</p>
1.1 grant 3929: </li>
3930:
3931: <li>
3932: <p><a xmlns=
3933: "http://www.w3.org/TR/xhtml1/transitional" href=
3934: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.20 ben 3935: class="pkgname">pkgtools/pkgdep</a>: makes
3936: dependency graphs of packages, to aid in choosing a
3937: strategy for updating</p>
1.1 grant 3938: </li>
3939:
3940: <li>
3941: <p><a xmlns=
3942: "http://www.w3.org/TR/xhtml1/transitional" href=
3943: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.20 ben 3944: class="pkgname">pkgtools/pkgdepgraph</a>: make
3945: graph from above (uses graphviz)</p>
1.1 grant 3946: </li>
3947:
3948: <li>
3949: <p><a xmlns=
3950: "http://www.w3.org/TR/xhtml1/transitional" href=
3951: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 3952: class="pkgname">pkgtools/pkglint</a>: This provides
3953: two distinct abilities: check a pkgsrc entry for
3954: correctness (pkglint) check for and remove
3955: out-of-date distfiles and binary packages
3956: (lintpkgsrc)</p>
1.1 grant 3957: </li>
3958:
3959: <li>
3960: <p><a xmlns=
3961: "http://www.w3.org/TR/xhtml1/transitional" href=
3962: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.20 ben 3963: class="pkgname">pkgtools/pkgsurvey</a>: report what
3964: packages you have installed</p>
1.1 grant 3965: </li>
3966: </ul>
3967: </div>
3968:
3969: <p>Utilities for people maintaining or creating
3970: individual packages:</p>
3971:
3972: <div class="itemizedlist">
3973: <ul type="disc">
3974: <li>
3975: <p><a xmlns=
3976: "http://www.w3.org/TR/xhtml1/transitional" href=
3977: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 3978: class="pkgname">pkgtools/pkgdiff</a>: automate
3979: making and maintaining patches for a package
3980: (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1 grant 3981: </li>
3982:
3983: <li>
3984: <p><a xmlns=
3985: "http://www.w3.org/TR/xhtml1/transitional" href=
3986: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.20 ben 3987: class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
3988: "http://www.w3.org/TR/xhtml1/transitional" href=
3989: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
3990: class="pkgname">pkgtools/url2pkg</a>: aids in
3991: converting to pkgsrc</p>
1.1 grant 3992: </li>
3993:
3994: <li>
3995: <p><a xmlns=
3996: "http://www.w3.org/TR/xhtml1/transitional" href=
3997: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.20 ben 3998: class="pkgname">pkgtools/gensolpkg</a>: convert
3999: pkgsrc to a Solaris package</p>
1.1 grant 4000: </li>
4001: </ul>
4002: </div>
4003:
4004: <p>Utilities for people maintaining pkgsrc (or more
4005: obscure pkg utilities)</p>
4006:
4007: <div class="itemizedlist">
4008: <ul type="disc">
4009: <li>
4010: <p><a xmlns=
4011: "http://www.w3.org/TR/xhtml1/transitional" href=
4012: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.20 ben 4013: class="pkgname">pkgtools/pkgconflict</a>: find
4014: packages that conflict but aren't marked as
4015: such</p>
1.1 grant 4016: </li>
4017:
4018: <li>
4019: <p><a xmlns=
4020: "http://www.w3.org/TR/xhtml1/transitional" href=
4021: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.20 ben 4022: class="pkgname">pkgtools/pkg_comp</a>: build
4023: packages in a chrooted area</p>
1.1 grant 4024: </li>
4025:
4026: <li>
4027: <p><a xmlns=
4028: "http://www.w3.org/TR/xhtml1/transitional" href=
4029: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.20 ben 4030: class="pkgname">pkgtools/libkver</a>: spoof kernel
4031: version for chrooted cross builds</p>
1.1 grant 4032: </li>
4033: </ul>
4034: </div>
4035: </div>
4036:
4037: <div class="sect1" lang="en" xml:lang="en">
4038: <div class="titlepage">
4039: <div>
4040: <div>
4041: <h2 class="title" style="clear: both"><a name=
1.20 ben 4042: "id2587540" id="id2587540"></a>6.4. How to use
1.1 grant 4043: pkgsrc as non-root</h2>
4044: </div>
4045: </div>
4046: </div>
4047:
4048: <p>If you want to use pkgsrc as non-root user, you can
4049: set some variables to make pkgsrc work under these
4050: conditions. Please see <a href=
4051: "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.20 ben 4052: target="_top">this message</a> for more details.</p>
1.14 xtraeme 4053: </div>
4054:
4055: <div class="sect1" lang="en" xml:lang="en">
4056: <div class="titlepage">
4057: <div>
4058: <div>
4059: <h2 class="title" style="clear: both"><a name=
1.20 ben 4060: "id2587552" id="id2587552"></a>6.5. How to
1.15 xtraeme 4061: resume transfers when fetching distfiles?</h2>
1.14 xtraeme 4062: </div>
4063: </div>
4064: </div>
4065:
1.15 xtraeme 4066: <p>By default resuming transfers in pkgsrc is disabled,
4067: but you can enable this feature by adding the option
4068: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
4069: into <code class="filename">/etc/mk.conf</code>. If,
4070: during a fetch step, an incomplete distfile is found,
4071: pkgsrc will try to resume it.</p>
4072:
4073: <p>You can also use a different program than the default
4074: ftp(1) by changing the <code class=
4075: "varname">FETCH_CMD</code> variable. Don't forget to set
4076: <code class="varname">FETCH_RESUME_ARGS</code> and
4077: <code class="varname">FETCH_OUTPUT_ARGS</code> if you are
4078: not using default values.</p>
1.14 xtraeme 4079:
4080: <p>For example, if you want to use <code class=
4081: "filename">wget</code> to resume downloads, you'll have
4082: to use something like:</p>
4083: <pre class="programlisting">
4084: FETCH_CMD=wget
4085: .if defined(FETCH_CMD) && ${FETCH_CMD} == "wget"
4086: FETCH_BEFORE_ARGS=--passive-ftp
4087: FETCH_RESUME_ARGS=-c
4088: FETCH_OUTPUT_ARGS=-O
4089: .endif
4090:
4091: </pre>
1.1 grant 4092: </div>
4093:
4094: <div class="sect1" lang="en" xml:lang="en">
4095: <div class="titlepage">
4096: <div>
4097: <div>
4098: <h2 class="title" style="clear: both"><a name=
1.20 ben 4099: "id2587594" id="id2587594"></a>6.6. How can I
1.1 grant 4100: install/use XFree86 from pkgsrc?</h2>
4101: </div>
4102: </div>
4103: </div>
4104:
4105: <p>If you want to use XFree86 from pkgsrc instead of your
1.14 xtraeme 4106: system's own X11 (<code class=
4107: "filename">/usr/X11R6</code>, <code class=
4108: "filename">/usr/openwin</code>, ...), you will have to
4109: add the following line into <code class=
1.15 xtraeme 4110: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4111: <pre class="programlisting">
4112: X11_TYPE=XFree86
4113:
4114: </pre>
4115: </div>
4116:
4117: <div class="sect1" lang="en" xml:lang="en">
4118: <div class="titlepage">
4119: <div>
4120: <div>
4121: <h2 class="title" style="clear: both"><a name=
1.20 ben 4122: "id2587622" id="id2587622"></a>6.7. How can I
1.1 grant 4123: install/use X.org from pkgsrc?</h2>
4124: </div>
4125: </div>
4126: </div>
4127:
4128: <p>If you want to use X.org from pkgsrc instead of your
1.14 xtraeme 4129: system's own X11 (<code class=
4130: "filename">/usr/X11R6</code>, <code class=
4131: "filename">/usr/openwin</code>, ...) you will have to add
4132: the following line into <code class=
1.15 xtraeme 4133: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4134: <pre class="programlisting">
4135: X11_TYPE=xorg
4136:
4137: </pre>
4138: </div>
4139:
4140: <div class="sect1" lang="en" xml:lang="en">
4141: <div class="titlepage">
4142: <div>
4143: <div>
4144: <h2 class="title" style="clear: both"><a name=
1.20 ben 4145: "id2587650" id="id2587650"></a>6.8. How to
1.1 grant 4146: fetch files from behind a firewall</h2>
4147: </div>
4148: </div>
4149: </div>
4150:
4151: <p>If you are sitting behind a firewall which does not
4152: allow direct connections to Internet hosts (i.e.
4153: non-NAT), you may specify the relevant proxy hosts. This
4154: is done using an environment variable in the form of a
4155: URL e.g. in Amdahl, the machine “<span class=
4156: "quote">orpheus.amdahl.com</span>” is one of the
4157: firewalls, and it uses port 80 as the proxy port number.
4158: So the proxy environment variables are:</p>
4159: <pre class="programlisting">
4160: ftp_proxy=ftp://orpheus.amdahl.com:80/
4161: http_proxy=http://orpheus.amdahl.com:80/
4162: </pre>
4163: </div>
4164:
4165: <div class="sect1" lang="en" xml:lang="en">
4166: <div class="titlepage">
4167: <div>
4168: <div>
4169: <h2 class="title" style="clear: both"><a name=
1.20 ben 4170: "id2587664" id="id2587664"></a>6.9. How do I
1.14 xtraeme 4171: tell <span><strong class="command">make
4172: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 4173: </div>
4174: </div>
4175: </div>
4176:
4177: <p>This depends on which utility is used to retrieve
1.14 xtraeme 4178: distfiles. From <code class="filename">bsd.pkg.mk</code>,
4179: <code class="varname">FETCH_CMD</code> is assigned the
4180: first available command from the following list:</p>
1.1 grant 4181: <pre class="programlisting">
4182: ${LOCALBASE}/bin/ftp
4183: /usr/bin/ftp
4184: </pre>
4185:
4186: <p>On a default NetBSD installation, this will be
1.14 xtraeme 4187: <code class="filename">/usr/bin/ftp</code>, which
1.1 grant 4188: automatically tries passive connections first, and falls
4189: back to active connections if the server refuses to do
4190: passive. For the other tools, add the following to your
1.14 xtraeme 4191: <code class="filename">/etc/mk.conf</code> file:
4192: <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 4193:
1.14 xtraeme 4194: <p>Having that option present will prevent <code class=
4195: "filename">/usr/bin/ftp</code> from falling back to
4196: active transfers.</p>
1.1 grant 4197: </div>
4198:
4199: <div class="sect1" lang="en" xml:lang="en">
4200: <div class="titlepage">
4201: <div>
4202: <div>
4203: <h2 class="title" style="clear: both"><a name=
1.20 ben 4204: "id2587715" id="id2587715"></a>6.10. How to
1.1 grant 4205: fetch all distfiles at once</h2>
4206: </div>
4207: </div>
4208: </div>
4209:
4210: <p>You would like to download all the distfiles in a
4211: single batch from work or university, where you can't run
1.14 xtraeme 4212: a <span><strong class="command">make
4213: fetch</strong></span>. There is an archive of distfiles
4214: on <a href=
1.1 grant 4215: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
4216: target="_top">ftp.NetBSD.org</a>, but downloading the
4217: entire directory may not be appropriate.</p>
4218:
1.14 xtraeme 4219: <p>The answer here is to do a <span><strong class=
4220: "command">make fetch-list</strong></span> in <code class=
4221: "filename">/usr/pkgsrc</code> or one of it's
1.1 grant 4222: subdirectories, carry the resulting list to your machine
4223: at work/school and use it there If you don't have a
4224: NetBSD-compatible ftp(1) (like lukemftp) at work, don't
1.14 xtraeme 4225: forget to set <code class="varname">FETCH_CMD</code> to
1.1 grant 4226: something that fetches a URL:</p>
4227:
4228: <p>At home:</p>
4229: <pre class="screen">
1.14 xtraeme 4230: <code class="prompt">%</code> <strong class=
4231: "userinput"><code>cd /usr/pkgsrc</code></strong>
4232: <code class="prompt">%</code> <strong class=
4233: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
4234: <code class="prompt">%</code> <strong class=
4235: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 4236: </pre>
4237:
4238: <p>At work:</p>
4239: <pre class="screen">
1.14 xtraeme 4240: <code class="prompt">%</code> <strong class=
4241: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 4242: </pre>
4243:
1.14 xtraeme 4244: <p>then tar up <code class=
4245: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 4246:
4247: <p>If you have a machine running NetBSD, and you want to
4248: get <span class="emphasis"><em>all</em></span> distfiles
4249: (even ones that aren't for your machine architecture),
4250: you can do so by using the above-mentioned
1.14 xtraeme 4251: <span><strong class="command">make
4252: fetch-list</strong></span> approach, or fetch the
4253: distfiles directly by running:</p>
1.1 grant 4254: <pre class="screen">
1.14 xtraeme 4255: <code class="prompt">%</code> <strong class=
4256: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 4257: </pre>
4258:
1.14 xtraeme 4259: <p>If you even decide to ignore <code class=
4260: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
4261: can get everything by running:</p>
1.1 grant 4262: <pre class="screen">
1.14 xtraeme 4263: <code class="prompt">%</code> <strong class=
4264: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 4265: </pre>
4266: </div>
4267:
4268: <div class="sect1" lang="en" xml:lang="en">
4269: <div class="titlepage">
4270: <div>
4271: <div>
4272: <h2 class="title" style="clear: both"><a name=
1.20 ben 4273: "id2587923" id="id2587923"></a>6.11. What does
1.1 grant 4274: “<span class="quote">Don't know how to make
4275: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
4276: </div>
4277: </div>
4278: </div>
4279:
4280: <p>When compiling the <a xmlns=
4281: "http://www.w3.org/TR/xhtml1/transitional" href=
4282: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4283: class="pkgname">pkgtools/pkg_install</a> package, you get
4284: the error from make that it doesn't know how to make
4285: <code class="filename">/usr/share/tmac/tmac.andoc</code>?
4286: This indicates that you don't have installed the
4287: “<span class="quote">text</span>” set on your
4288: machine (nroff, ...). It is recommended to do that to
4289: format manpages.</p>
1.1 grant 4290:
4291: <p>In the case of the <a xmlns=
4292: "http://www.w3.org/TR/xhtml1/transitional" href=
4293: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4294: class="pkgname">pkgtools/pkg_install</a> package, you can
4295: get away with setting <code class=
4296: "varname">NOMAN=YES</code> either in the environment or
4297: in <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 4298: </div>
4299:
4300: <div class="sect1" lang="en" xml:lang="en">
4301: <div class="titlepage">
4302: <div>
4303: <div>
4304: <h2 class="title" style="clear: both"><a name=
1.20 ben 4305: "id2587961" id="id2587961"></a>6.12. What does
1.1 grant 4306: “<span class="quote">Could not find
4307: bsd.own.mk</span>” mean?</h2>
4308: </div>
4309: </div>
4310: </div>
4311:
1.14 xtraeme 4312: <p>You didn't install the compiler set, <code class=
4313: "filename">comp.tgz</code>, when you installed your
4314: NetBSD machine. Please get it and install it, by
4315: extracting it in <code class="filename">/</code>:</p>
1.1 grant 4316: <pre class="screen">
1.14 xtraeme 4317: <code class="prompt">#</code> <strong class=
4318: "userinput"><code>cd /</code></strong>
4319: <code class="prompt">#</code> <strong class=
4320: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 4321: </pre>
4322:
1.14 xtraeme 4323: <p><code class="filename">comp.tgz</code> is part of
4324: every NetBSD release. Get the one that corresponds to
4325: your release (determine via <span><strong class=
4326: "command">uname -r</strong></span>).</p>
1.1 grant 4327: </div>
4328:
4329: <div class="sect1" lang="en" xml:lang="en">
4330: <div class="titlepage">
4331: <div>
4332: <div>
4333: <h2 class="title" style="clear: both"><a name=
1.20 ben 4334: "id2588087" id="id2588087"></a>6.13. Using
1.1 grant 4335: 'sudo' with pkgsrc</h2>
4336: </div>
4337: </div>
4338: </div>
4339:
4340: <p>When installing packages as non-root user and using
4341: the just-in-time su(1) feature of pkgsrc, it can become
4342: annoying to type in the root password for each required
4343: package installed. To avoid this, the sudo package can be
4344: used, which does password caching over a limited time. To
4345: use it, install sudo (either as binary package or from
4346: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
4347: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.20 ben 4348: class="pkgname">security/sudo</a>) and then put the
4349: following into your <code class=
4350: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4351: <pre class="programlisting">
4352: .if exists(/usr/pkg/bin/sudo)
4353: SU_CMD=/usr/pkg/bin/sudo /bin/sh -c
4354: .endif
4355:
4356: </pre>
4357: </div>
4358:
4359: <div class="sect1" lang="en" xml:lang="en">
4360: <div class="titlepage">
4361: <div>
4362: <div>
4363: <h2 class="title" style="clear: both"><a name=
4364: "faq.conf" id=
1.14 xtraeme 4365: "faq.conf"></a>6.14. Configuration files
1.1 grant 4366: handling and placement</h2>
4367: </div>
4368: </div>
4369: </div>
4370:
1.14 xtraeme 4371: <p>The global variable <code class=
4372: "varname">PKG_SYSCONFBASE</code> (and some others) can be
4373: set by the system administrator in <code class=
4374: "filename">/etc/mk.conf</code> to define the place where
1.1 grant 4375: configuration files get installed. Therefore, packages
4376: must be adapted to support this feature. Keep in mind
4377: that you should only install files that are strictly
4378: necessary in the configuration directory, files that can
1.14 xtraeme 4379: go to <code class="filename">$PREFIX/share</code> should
4380: go there.</p>
1.1 grant 4381:
4382: <p>We will take a look at available variables first
1.14 xtraeme 4383: (<code class="filename">bsd.pkg.mk</code> contains more
4384: information). <code class="varname">PKG_SYSCONFDIR</code>
4385: is where the configuration files for a package may be
4386: found (that is, the full path, e.g. <code class=
4387: "filename">/etc</code> or <code class=
4388: "filename">/usr/pkg/etc</code>). This value may be
1.1 grant 4389: customized in various ways:</p>
4390:
4391: <div class="orderedlist">
4392: <ol type="1">
4393: <li>
1.14 xtraeme 4394: <p><code class="varname">PKG_SYSCONFBASE</code> is
4395: the main config directory under which all package
1.1 grant 4396: configuration files are to be found. Users will
1.14 xtraeme 4397: typically want to set it to <code class=
4398: "filename">/etc</code>, or accept the default
4399: location of <code class=
4400: "filename">$PREFIX/etc</code>.</p>
1.1 grant 4401: </li>
4402:
4403: <li>
1.14 xtraeme 4404: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
4405: is the subdirectory of <code class=
4406: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 4407: configuration files for a particular package may be
1.14 xtraeme 4408: found. Defaults to <code class=
4409: "varname">${SYSCONFBASE}</code>.</p>
1.1 grant 4410: </li>
4411:
4412: <li>
1.14 xtraeme 4413: <p><code class="varname">PKG_SYSCONFVAR</code> is
4414: the special suffix used to distinguish any
4415: overriding values for a particular package (see
4416: next item). It defaults to <code class=
4417: "varname">${PKGBASE}</code>, but for a collection
4418: of related packages that should all have the same
4419: <code class="varname">PKG_SYSCONFDIR</code> value,
4420: it can be set in each of the package Makefiles to a
4421: common value.</p>
1.1 grant 4422: </li>
4423:
4424: <li>
1.14 xtraeme 4425: <p><code class=
4426: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
4427: overrides the value of <code class=
4428: "varname">${PKG_SYSCONFDIR}</code> for packages
4429: with the same value for <code class=
4430: "varname">PKG_SYSCONFVAR</code>.</p>
1.1 grant 4431:
4432: <p>As an example, all the various KDE packages may
1.14 xtraeme 4433: want to set <code class=
4434: "varname">PKG_SYSCONFVAR</code> to
4435: “<span class="quote">kde</span>” so
4436: admins can set <code class=
4437: "varname">PKG_SYSCONFDIR.kde</code> in <code class=
4438: "filename">/etc/mk.conf</code> to define where to
1.1 grant 4439: install KDE config files.</p>
4440: </li>
4441: </ol>
4442: </div>
4443:
4444: <p>Programs' configuration directory should be defined
4445: during the configure stage. Packages that use GNU
4446: autoconf can usually do this by using the
4447: “<span class="quote">--sysconfdir</span>”
4448: parameter, but this brings some problems as we will see
4449: now. When you change this pathname in packages, you
4450: should not allow them to install files in that directory
4451: directly. Instead they need to install those files under
1.14 xtraeme 4452: <code class="filename">share/examples/${PKGNAME}</code>
4453: so <code class="filename">PLIST</code> can register
4454: them.</p>
1.1 grant 4455:
4456: <p>Once you have the required configuration files in
1.14 xtraeme 4457: place (under the <code class=
4458: "filename">share/examples</code> directory) the variable
4459: <code class="varname">CONF_FILES</code> should be set to
4460: copy them into <code class=
4461: "varname">PKG_SYSCONFDIR</code>. The contents of this
4462: variable is formed by pairs of filenames; the first
1.1 grant 4463: element of the pair specifies the file inside the
1.14 xtraeme 4464: examples directory (registered by <code class=
4465: "filename">PLIST</code>) and the second element specifies
1.1 grant 4466: the target file. This is done this way to allow binary
4467: packages to place files in the right directory using
1.14 xtraeme 4468: <code class="filename">INSTALL</code>/<code class=
4469: "filename">DEINSTALL</code> scripts which are created
4470: automatically. The package <code class=
4471: "filename">Makefile</code> must also set <code class=
4472: "varname">USE_PKGINSTALL=YES</code> to use these
1.1 grant 4473: automatically generated scripts. The automatic copying of
4474: config files can be toggled by setting the environment
1.14 xtraeme 4475: variable <code class="varname">PKG_CONFIG</code> prior to
1.1 grant 4476: package installation.</p>
4477:
4478: <p>Here is an example, taken from mail/mutt/Makefile:</p>
4479: <pre class="programlisting">
4480: EGDIR= ${PREFIX}/share/doc/mutt/samples
4481: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
4482: </pre>
4483:
4484: <p>As you can see, this package installs configuration
1.14 xtraeme 4485: files inside <code class="varname">EGDIR</code>, which
4486: are registered by <code class="filename">PLIST</code>.
4487: After that, the variable <code class=
4488: "varname">CONF_FILES</code> lists the installed file
4489: first and then the target file. Users will also get an
4490: automatic message when files are installed using this
4491: method.</p>
1.1 grant 4492: </div>
4493:
4494: <div class="sect1" lang="en" xml:lang="en">
4495: <div class="titlepage">
4496: <div>
4497: <div>
4498: <h2 class="title" style="clear: both"><a name=
4499: "audit-packages" id=
1.14 xtraeme 4500: "audit-packages"></a>6.15. Automated security
1.1 grant 4501: checks</h2>
4502: </div>
4503: </div>
4504: </div>
4505:
4506: <p>Please be aware that there can often be bugs in
4507: third-party software, and some of these bugs can leave a
4508: machine vulnerable to exploitation by attackers. In an
4509: effort to lessen the exposure, the NetBSD packages team
4510: maintains a database of known-exploits to packages which
4511: have at one time been included in pkgsrc. The database
4512: can be downloaded automatically, and a security audit of
4513: all packages installed on a system can take place. To do
4514: this, install the <a xmlns=
4515: "http://www.w3.org/TR/xhtml1/transitional" href=
4516: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.20 ben 4517: class="pkgname">security/audit-packages</a> package. It
4518: has two components:</p>
1.1 grant 4519:
4520: <div class="orderedlist">
4521: <ol type="1">
4522: <li>
4523: <p>“<span class=
4524: "quote">download-vulnerability-list</span>”,
4525: an easy way to download a list of the security
4526: vulnerabilities information. This list is kept up
4527: to date by the NetBSD security officer and the
4528: NetBSD packages team, and is distributed from the
4529: NetBSD ftp server:</p>
4530:
4531: <p><a href=
4532: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 4533: target=
4534: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 4535: </li>
4536:
4537: <li>
4538: <p>“<span class=
4539: "quote">audit-packages</span>”, an easy way
4540: to audit the current machine, checking each
4541: vulnerability which is known. If a vulnerable
4542: package is installed, it will be shown by output to
4543: stdout, including a description of the type of
4544: vulnerability, and a URL containing more
4545: information.</p>
4546: </li>
4547: </ol>
4548: </div>
4549:
4550: <p>Use of the audit-packages package is strongly
4551: recommended!</p>
4552:
4553: <p>The following message is displayed as part of the
4554: audit-packages installation procedure:</p>
4555: <pre class="screen">
4556: ===========================================================================
1.18 xtraeme 4557: $NetBSD: faq.xml,v 1.5 2005/02/24 14:24:32 jschauma Exp $
1.1 grant 4558:
4559: You may wish to have the vulnerabilities file downloaded daily so that
4560: it remains current. This may be done by adding an appropriate entry
4561: to the root users crontab(5) entry. For example the entry
4562:
4563: # download vulnerabilities file
4564: 0 3 * * * ${PREFIX}/sbin/download-vulnerability-list >/dev/null 2>&1
4565:
4566: will update the vulnerability list every day at 3AM. You may wish to do
4567: this more often than once a day.
4568:
4569: In addition, you may wish to run the package audit from the daily
4570: security script. This may be accomplished by adding the following
4571: lines to /etc/security.local
4572:
4573: if [ -x ${PREFIX}/sbin/audit-packages ]; then
4574: ${PREFIX}/sbin/audit-packages
4575: fi
4576:
4577: ===========================================================================
4578:
4579: </pre>
4580: </div>
4581: </div>
4582: </div>
4583:
4584: <div class="part" lang="en" xml:lang="en">
4585: <div class="titlepage">
4586: <div>
4587: <div>
4588: <h1 class="title"><a name="developers-guide" id=
1.2 hubertf 4589: "developers-guide"></a>The pkgsrc developer's
4590: guide</h1>
1.1 grant 4591: </div>
4592: </div>
4593: </div>
4594:
4595: <div class="toc">
4596: <p><b>Table of Contents</b></p>
4597:
4598: <dl>
4599: <dt><span class="chapter"><a href="#components">7.
4600: Package components - files, directories and
4601: contents</a></span></dt>
4602:
4603: <dd>
4604: <dl>
4605: <dt><span class="sect1"><a href=
1.14 xtraeme 4606: "#components.Makefile">7.1. <code class=
4607: "filename">Makefile</code></a></span></dt>
1.1 grant 4608:
4609: <dt><span class="sect1"><a href=
1.14 xtraeme 4610: "#components.distinfo">7.2. <code class=
4611: "filename">distinfo</code></a></span></dt>
1.1 grant 4612:
4613: <dt><span class="sect1"><a href=
4614: "#components.patches">7.3. patches/*</a></span></dt>
4615:
1.20 ben 4616: <dt><span class="sect1"><a href="#id2589201">7.4.
1.1 grant 4617: Other mandatory files</a></span></dt>
4618:
4619: <dt><span class="sect1"><a href=
4620: "#components.optional">7.5. Optional
4621: files</a></span></dt>
4622:
1.20 ben 4623: <dt><span class="sect1"><a href="#id2589326">7.6.
1.14 xtraeme 4624: <code class="filename">work*</code></a></span></dt>
1.1 grant 4625:
1.20 ben 4626: <dt><span class="sect1"><a href="#id2589482">7.7.
1.14 xtraeme 4627: <code class="filename">files/*</code></a></span></dt>
1.1 grant 4628: </dl>
4629: </dd>
4630:
4631: <dt><span class="chapter"><a href="#plist">8. PLIST
4632: issues</a></span></dt>
4633:
4634: <dd>
4635: <dl>
1.20 ben 4636: <dt><span class="sect1"><a href="#id2589537">8.1. RCS
1.1 grant 4637: ID</a></span></dt>
4638:
1.20 ben 4639: <dt><span class="sect1"><a href="#id2589552">8.2.
1.14 xtraeme 4640: Semi-automatic <code class="filename">PLIST</code>
4641: generation</a></span></dt>
1.1 grant 4642:
4643: <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14 xtraeme 4644: Tweaking output of <span><strong class="command">make
4645: print-PLIST</strong></span></a></span></dt>
1.1 grant 4646:
4647: <dt><span class="sect1"><a href="#plist.misc">8.4.
4648: Variable substitution in PLIST</a></span></dt>
4649:
1.20 ben 4650: <dt><span class="sect1"><a href="#id2589941">8.5.
1.1 grant 4651: Manpage-compression</a></span></dt>
4652:
1.20 ben 4653: <dt><span class="sect1"><a href="#id2589982">8.6.
1.14 xtraeme 4654: Changing PLIST source with <code class=
4655: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 4656:
1.20 ben 4657: <dt><span class="sect1"><a href="#id2590000">8.7.
1.1 grant 4658: Platform specific and differing
4659: PLISTs</a></span></dt>
4660:
4661: <dt><span class="sect1"><a href=
4662: "#faq.common-dirs">8.8. Sharing directories between
4663: packages</a></span></dt>
4664: </dl>
4665: </dd>
4666:
4667: <dt><span class="chapter"><a href="#buildlink">9.
4668: Buildlink methodology</a></span></dt>
4669:
4670: <dd>
4671: <dl>
1.21 ! ben 4672: <dt><span class="sect1"><a href="#id2590334">9.1.
1.1 grant 4673: Converting packages to use buildlink3</a></span></dt>
4674:
1.21 ! ben 4675: <dt><span class="sect1"><a href="#id2590525">9.2.
1.14 xtraeme 4676: Writing <code class="filename">buildlink3.mk</code>
4677: files</a></span></dt>
1.1 grant 4678:
4679: <dd>
4680: <dl>
4681: <dt><span class="sect2"><a href=
1.21 ! ben 4682: "#id2590595">9.2.1. Anatomy of a buildlink3.mk
1.1 grant 4683: file</a></span></dt>
4684:
4685: <dt><span class="sect2"><a href=
1.21 ! ben 4686: "#id2591035">9.2.2. Updating <code class=
1.14 xtraeme 4687: "varname">BUILDLINK_DEPENDS.<em class=
4688: "replaceable"><code>pkg</code></em></code> in
4689: <code class="filename">buildlink3.mk</code>
1.1 grant 4690: files</a></span></dt>
4691: </dl>
4692: </dd>
4693:
1.21 ! ben 4694: <dt><span class="sect1"><a href="#id2591182">9.3.
1.14 xtraeme 4695: Writing <code class="filename">builtin.mk</code>
4696: files</a></span></dt>
1.1 grant 4697:
4698: <dd>
4699: <dl>
4700: <dt><span class="sect2"><a href=
1.21 ! ben 4701: "#id2591400">9.3.1. Anatomy of a <code class=
1.14 xtraeme 4702: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 4703:
4704: <dt><span class="sect2"><a href=
1.21 ! ben 4705: "#id2591627">9.3.2. Global preferences for native
1.1 grant 4706: or pkgsrc software</a></span></dt>
4707: </dl>
4708: </dd>
4709: </dl>
4710: </dd>
4711:
4712: <dt><span class="chapter"><a href="#options">10. Options
4713: handling</a></span></dt>
4714:
4715: <dd>
4716: <dl>
1.21 ! ben 4717: <dt><span class="sect1"><a href="#id2591700">10.1.
1.1 grant 4718: Global default options</a></span></dt>
4719:
1.21 ! ben 4720: <dt><span class="sect1"><a href="#id2591715">10.2.
1.14 xtraeme 4721: Converting packages to use <code class=
4722: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 4723: </dl>
4724: </dd>
4725:
4726: <dt><span class="chapter"><a href="#build">11. The build
4727: process</a></span></dt>
4728:
4729: <dd>
4730: <dl>
4731: <dt><span class="sect1"><a href="#build.prefix">11.1.
4732: Program location</a></span></dt>
4733:
1.21 ! ben 4734: <dt><span class="sect1"><a href="#id2592323">11.2.
1.1 grant 4735: Main targets</a></span></dt>
4736:
4737: <dt><span class="sect1"><a href=
4738: "#build.helpful-targets">11.3. Other helpful
4739: targets</a></span></dt>
4740: </dl>
4741: </dd>
4742:
4743: <dt><span class="chapter"><a href="#fixes">12. Notes on
4744: fixes for packages</a></span></dt>
4745:
4746: <dd>
4747: <dl>
1.21 ! ben 4748: <dt><span class="sect1"><a href="#id2593723">12.1.
1.1 grant 4749: General operation</a></span></dt>
4750:
4751: <dd>
4752: <dl>
4753: <dt><span class="sect2"><a href=
1.21 ! ben 4754: "#id2593726">12.1.1. How to pull in variables
1.1 grant 4755: from /etc/mk.conf</a></span></dt>
4756:
4757: <dt><span class="sect2"><a href=
1.21 ! ben 4758: "#id2593878">12.1.2. Restricted
1.1 grant 4759: packages</a></span></dt>
4760:
4761: <dt><span class="sect2"><a href=
4762: "#dependencies">12.1.3. Handling
4763: dependencies</a></span></dt>
4764:
4765: <dt><span class="sect2"><a href=
1.21 ! ben 4766: "#id2594393">12.1.4. Handling conflicts with
1.1 grant 4767: other packages</a></span></dt>
4768:
4769: <dt><span class="sect2"><a href=
1.21 ! ben 4770: "#id2594443">12.1.5. Packages that cannot or
1.1 grant 4771: should not be built</a></span></dt>
4772:
4773: <dt><span class="sect2"><a href=
1.21 ! ben 4774: "#id2594469">12.1.6. Packages which should not be
1.1 grant 4775: deleted, once installed</a></span></dt>
4776:
4777: <dt><span class="sect2"><a href=
4778: "#security-handling">12.1.7. Handling packages
4779: with security problems</a></span></dt>
4780:
4781: <dt><span class="sect2"><a href=
1.21 ! ben 4782: "#id2594629">12.1.8. How to handle compiler
1.1 grant 4783: bugs</a></span></dt>
4784:
4785: <dt><span class="sect2"><a href=
1.21 ! ben 4786: "#id2594651">12.1.9. How to handle incrementing
1.1 grant 4787: versions when fixing an existing
4788: package</a></span></dt>
4789:
4790: <dt><span class="sect2"><a href=
1.21 ! ben 4791: "#id2594700">12.1.10. Portability of
1.1 grant 4792: packages</a></span></dt>
4793: </dl>
4794: </dd>
4795:
1.21 ! ben 4796: <dt><span class="sect1"><a href="#id2594725">12.2.
1.1 grant 4797: Possible downloading issues</a></span></dt>
4798:
4799: <dd>
4800: <dl>
4801: <dt><span class="sect2"><a href=
1.21 ! ben 4802: "#id2594728">12.2.1. Packages whose distfiles
1.1 grant 4803: aren't available for plain
4804: downloading</a></span></dt>
4805:
4806: <dt><span class="sect2"><a href=
1.21 ! ben 4807: "#id2594791">12.2.2. How to handle modified
1.1 grant 4808: distfiles with the 'old' name</a></span></dt>
4809: </dl>
4810: </dd>
4811:
1.21 ! ben 4812: <dt><span class="sect1"><a href="#id2594803">12.3.
1.1 grant 4813: Configuration gotchas</a></span></dt>
4814:
4815: <dd>
4816: <dl>
4817: <dt><span class="sect2"><a href=
4818: "#fixes.libtool">12.3.1. Shared libraries -
4819: libtool</a></span></dt>
4820:
4821: <dt><span class="sect2"><a href=
1.21 ! ben 4822: "#id2595250">12.3.2. Using libtool on GNU
1.1 grant 4823: packages that already support
4824: libtool</a></span></dt>
4825:
4826: <dt><span class="sect2"><a href=
1.21 ! ben 4827: "#id2595334">12.3.3. GNU
1.1 grant 4828: Autoconf/Automake</a></span></dt>
4829: </dl>
4830: </dd>
4831:
1.21 ! ben 4832: <dt><span class="sect1"><a href="#id2595379">12.4.
1.1 grant 4833: Building considerations</a></span></dt>
4834:
4835: <dd>
4836: <dl>
4837: <dt><span class="sect2"><a href=
1.21 ! ben 4838: "#id2595382">12.4.1. CPP defines</a></span></dt>
1.1 grant 4839: </dl>
4840: </dd>
4841:
1.21 ! ben 4842: <dt><span class="sect1"><a href="#id2595412">12.5.
1.1 grant 4843: Package specific actions</a></span></dt>
4844:
4845: <dd>
4846: <dl>
4847: <dt><span class="sect2"><a href=
1.21 ! ben 4848: "#id2595415">12.5.1. Package configuration
1.1 grant 4849: files</a></span></dt>
4850:
4851: <dt><span class="sect2"><a href=
1.21 ! ben 4852: "#id2595722">12.5.2. User
1.2 hubertf 4853: interaction</a></span></dt>
1.1 grant 4854:
4855: <dt><span class="sect2"><a href=
1.21 ! ben 4856: "#id2595767">12.5.3. Handling
1.1 grant 4857: licenses</a></span></dt>
4858:
4859: <dt><span class="sect2"><a href=
1.21 ! ben 4860: "#id2595918">12.5.4. Creating an account from a
1.1 grant 4861: package</a></span></dt>
4862:
4863: <dt><span class="sect2"><a href=
1.21 ! ben 4864: "#id2595980">12.5.5. Installing score
1.1 grant 4865: files</a></span></dt>
4866:
4867: <dt><span class="sect2"><a href=
1.21 ! ben 4868: "#id2596024">12.5.6. Packages providing login
1.1 grant 4869: shells</a></span></dt>
4870:
4871: <dt><span class="sect2"><a href=
1.21 ! ben 4872: "#id2596082">12.5.7. Packages containing perl
1.1 grant 4873: scripts</a></span></dt>
4874:
4875: <dt><span class="sect2"><a href=
1.21 ! ben 4876: "#id2596100">12.5.8. Packages with hardcoded
1.1 grant 4877: paths to other interpreters</a></span></dt>
4878:
4879: <dt><span class="sect2"><a href=
1.21 ! ben 4880: "#id2596121">12.5.9. Packages installing perl
1.1 grant 4881: modules</a></span></dt>
4882:
4883: <dt><span class="sect2"><a href=
4884: "#faq.info-files">12.5.10. Packages installing
4885: info files</a></span></dt>
4886:
4887: <dt><span class="sect2"><a href=
1.21 ! ben 4888: "#id2596341">12.5.11. Packages installing GConf2
1.1 grant 4889: data files</a></span></dt>
4890:
4891: <dt><span class="sect2"><a href=
1.21 ! ben 4892: "#id2596441">12.5.12. Packages installing
1.1 grant 4893: scrollkeeper data files</a></span></dt>
4894:
4895: <dt><span class="sect2"><a href=
1.21 ! ben 4896: "#id2596561">12.5.13. Packages installing X11
1.1 grant 4897: fonts</a></span></dt>
4898:
4899: <dt><span class="sect2"><a href=
1.21 ! ben 4900: "#id2596608">12.5.14. Packages installing GTK2
1.1 grant 4901: modules</a></span></dt>
4902:
4903: <dt><span class="sect2"><a href=
1.21 ! ben 4904: "#id2596745">12.5.15. Packages installing SGML or
1.1 grant 4905: XML data</a></span></dt>
4906:
4907: <dt><span class="sect2"><a href=
1.21 ! ben 4908: "#id2596797">12.5.16. Packages installing
1.1 grant 4909: extensions to the MIME database</a></span></dt>
4910:
4911: <dt><span class="sect2"><a href=
1.21 ! ben 4912: "#id2597004">12.5.17. Packages using
1.1 grant 4913: intltool</a></span></dt>
1.18 xtraeme 4914:
4915: <dt><span class="sect2"><a href=
1.21 ! ben 4916: "#id2597018">12.5.18. Packages installing startup
1.18 xtraeme 4917: scripts</a></span></dt>
1.1 grant 4918: </dl>
4919: </dd>
4920:
1.21 ! ben 4921: <dt><span class="sect1"><a href="#id2597040">12.6.
1.1 grant 4922: Feedback to the author</a></span></dt>
4923: </dl>
4924: </dd>
4925:
4926: <dt><span class="chapter"><a href="#debug">13.
4927: Debugging</a></span></dt>
4928:
4929: <dt><span class="chapter"><a href="#submit">14.
4930: Submitting and Committing</a></span></dt>
4931:
4932: <dd>
4933: <dl>
1.21 ! ben 4934: <dt><span class="sect1"><a href="#id2597570">14.1.
1.1 grant 4935: Submitting your packages</a></span></dt>
4936:
1.21 ! ben 4937: <dt><span class="sect1"><a href="#id2597621">14.2.
1.1 grant 4938: Committing: Importing a package into
4939: CVS</a></span></dt>
4940:
1.21 ! ben 4941: <dt><span class="sect1"><a href="#id2597752">14.3.
1.2 hubertf 4942: Updating a package to a newer version</a></span></dt>
1.1 grant 4943:
1.21 ! ben 4944: <dt><span class="sect1"><a href="#id2597771">14.4.
1.2 hubertf 4945: Moving a package in pkgsrc</a></span></dt>
1.1 grant 4946: </dl>
4947: </dd>
4948: </dl>
4949: </div>
4950:
4951: <div class="chapter" lang="en" xml:lang="en">
4952: <div class="titlepage">
4953: <div>
4954: <div>
4955: <h2 class="title"><a name="components" id=
4956: "components"></a>Chapter 7. Package
4957: components - files, directories and contents</h2>
4958: </div>
4959: </div>
4960: </div>
4961:
4962: <div class="toc">
4963: <p><b>Table of Contents</b></p>
4964:
4965: <dl>
4966: <dt><span class="sect1"><a href=
1.14 xtraeme 4967: "#components.Makefile">7.1. <code class=
4968: "filename">Makefile</code></a></span></dt>
1.1 grant 4969:
4970: <dt><span class="sect1"><a href=
1.14 xtraeme 4971: "#components.distinfo">7.2. <code class=
4972: "filename">distinfo</code></a></span></dt>
1.1 grant 4973:
4974: <dt><span class="sect1"><a href=
4975: "#components.patches">7.3. patches/*</a></span></dt>
4976:
1.20 ben 4977: <dt><span class="sect1"><a href="#id2589201">7.4. Other
1.1 grant 4978: mandatory files</a></span></dt>
4979:
4980: <dt><span class="sect1"><a href=
4981: "#components.optional">7.5. Optional
4982: files</a></span></dt>
4983:
1.20 ben 4984: <dt><span class="sect1"><a href="#id2589326">7.6.
1.14 xtraeme 4985: <code class="filename">work*</code></a></span></dt>
1.1 grant 4986:
1.20 ben 4987: <dt><span class="sect1"><a href="#id2589482">7.7.
1.14 xtraeme 4988: <code class="filename">files/*</code></a></span></dt>
1.1 grant 4989: </dl>
4990: </div>
4991:
4992: <p>Whenever you're preparing a package, there are a number
4993: of files involved which are described in the following
4994: sections.</p>
4995:
4996: <div class="sect1" lang="en" xml:lang="en">
4997: <div class="titlepage">
4998: <div>
4999: <div>
5000: <h2 class="title" style="clear: both"><a name=
5001: "components.Makefile" id=
1.14 xtraeme 5002: "components.Makefile"></a>7.1. <code class=
5003: "filename">Makefile</code></h2>
1.1 grant 5004: </div>
5005: </div>
5006: </div>
5007:
5008: <p>Building, installation and creation of a binary
1.14 xtraeme 5009: package are all controlled by the package's <code class=
5010: "filename">Makefile</code>.</p>
1.1 grant 5011:
1.14 xtraeme 5012: <p>There is a <code class="filename">Makefile</code> for
5013: each package. This file includes the standard
5014: <code class="filename">bsd.pkg.mk</code> file (referenced
5015: as <code class="filename">../../mk/bsd.pkg.mk</code>),
5016: which sets all the definitions and actions necessary for
5017: the package to compile and install itself. The mandatory
5018: variables are the <code class="varname">DISTNAME</code>
5019: which specifies the base name of the distribution file to
5020: be downloaded from the site on the Internet, <code class=
5021: "varname">MASTER_SITES</code> which specifies that site,
5022: <code class="varname">CATEGORIES</code> which denotes the
5023: categories into which the package falls, <code class=
5024: "varname">PKGNAME</code> which is the name of the
5025: package, the <code class="varname">MAINTAINER</code>'s
5026: name, and the <code class="varname">COMMENT</code>
5027: variable, which should contain a one-line description of
5028: the package (the package name should not appear, it will
5029: be added automatically). The maintainer variable is there
5030: so that anyone who quibbles with the (always completely
5031: correct) decisions taken by the guy who maintains the
5032: package can complain vigorously, or send chocolate as a
5033: sign of appreciation.</p>
1.1 grant 5034:
1.14 xtraeme 5035: <p>The <code class="varname">MASTER_SITES</code> may be
5036: set to one of the predefined sites:</p>
1.1 grant 5037: <pre class="programlisting">
5038: ${MASTER_SITE_APACHE}
5039: ${MASTER_SITE_DEBIAN}
5040: ${MASTER_SITE_GNOME}
5041: ${MASTER_SITE_GNU}
5042: ${MASTER_SITE_GNUSTEP}
1.9 dillo 5043: ${MASTER_SITE_IFARCHIVE}
1.1 grant 5044: ${MASTER_SITE_MOZILLA}
5045: ${MASTER_SITE_PERL_CPAN}
5046: ${MASTER_SITE_SOURCEFORGE}
5047: ${MASTER_SITE_SUNSITE}
5048: ${MASTER_SITE_R_CRAN}
5049: ${MASTER_SITE_SUSE}
5050: ${MASTER_SITE_TEX_CTAN}
5051: ${MASTER_SITE_XCONTRIB}
5052: ${MASTER_SITE_XEMACS}
5053: </pre>
5054:
5055: <p>If one of these predefined sites is chosen, you may
5056: require the ability to specify a subdirectory of that
5057: site. Since these macros may expand to more than one
5058: actual site, you <span class=
5059: "emphasis"><em>must</em></span> use the following
5060: construct to specify a subdirectory:</p>
5061: <pre class="programlisting">
5062: ${MASTER_SITE_GNU:=subdirectory/name/}
5063: ${MASTER_SITE_SOURCEFORGE:=project_name/}
5064: </pre>
5065:
5066: <p>Note the trailing slash after the subdirectory
5067: name.</p>
5068:
5069: <div class="note" style=
5070: "margin-left: 0.5in; margin-right: 0.5in;">
5071: <h3 class="title">Note</h3>
5072:
1.14 xtraeme 5073: <p><code class="varname">MASTER_SITE_SUBDIR</code> has
5074: been deprecated and <span class="emphasis"><em>should
5075: no longer be used</em></span>.</p>
1.1 grant 5076: </div>
5077:
1.14 xtraeme 5078: <p>If the package has multiple <code class=
5079: "varname">DISTFILES</code> or multiple <code class=
5080: "varname">PATCHFILES</code> from different sites, set
5081: <code class="varname">SITES_foo</code> to a list of URI's
1.1 grant 5082: where file “<span class="quote">foo</span>”
5083: may be found. “<span class=
5084: "quote">foo</span>” includes the suffix, e.g.</p>
5085: <pre class="programlisting">
5086: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
5087: DISTFILES+= foo-file.tar.gz
5088: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
5089: http://www.somewhereelse.com/mirror/somehow/
5090: </pre>
5091:
1.14 xtraeme 5092: <p>Note that the normal default setting of <code class=
5093: "varname">DISTFILES</code> must be made explicit if you
1.1 grant 5094: want to add to it (rather than replace it), as you
5095: usually would.</p>
5096:
5097: <p>Currently the following values are available for
1.14 xtraeme 5098: <code class="varname">CATEGORIES</code>. If more than one
5099: is used, they need to be separated by spaces:</p>
1.1 grant 5100: <pre class="programlisting">
5101: archivers cross geography meta-pkgs security
5102: audio databases graphics misc shells
5103: benchmarks devel ham multimedia sysutils
5104: biology editors inputmethod net textproc
5105: cad emulators lang news time
5106: chat finance mail parallel wm
5107: comms fonts math pkgtools www
5108: converters games mbone print x11
5109: </pre>
5110:
5111: <p>Please pay attention to the following gotchas:</p>
5112:
5113: <div class="itemizedlist">
5114: <ul type="disc">
5115: <li>
1.14 xtraeme 5116: <p>Add <code class="varname">MANCOMPRESSED</code>
5117: if manpages are installed in compressed form by the
5118: package; see comment in <code class=
5119: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 5120: </li>
5121:
5122: <li>
1.14 xtraeme 5123: <p>Replace <code class="filename">/usr/local</code>
1.1 grant 5124: with “<span class=
5125: "quote">${PREFIX}</span>” in all files (see
5126: patches, below).</p>
5127: </li>
5128:
5129: <li>
5130: <p>If the package installs any info files, see
5131: <a href="#faq.info-files" title=
5132: "12.5.10. Packages installing info files">Section
5133: 12.5.10, “Packages installing info
5134: files”</a>.</p>
5135: </li>
5136:
5137: <li>
1.14 xtraeme 5138: <p>Set <code class="varname">MAINTAINER</code> to
5139: be yourself. If you really can't maintain the
5140: package for future updates, set it to <code class=
1.1 grant 5141: "email"><<a href=
1.14 xtraeme 5142: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.1 grant 5143: </li>
5144:
5145: <li>
5146: <p>If a home page for the software in question
1.14 xtraeme 5147: exists, add the variable <code class=
5148: "varname">HOMEPAGE</code> right after <code class=
5149: "varname">MAINTAINER</code>. The value of this
1.1 grant 5150: variable should be the URL for the home page.</p>
5151: </li>
5152:
5153: <li>
1.14 xtraeme 5154: <p>Be sure to set the <code class=
5155: "varname">COMMENT</code> variable to a short
1.1 grant 5156: description of the package, not containing the
5157: pkg's name.</p>
5158: </li>
5159: </ul>
5160: </div>
5161: </div>
5162:
5163: <div class="sect1" lang="en" xml:lang="en">
5164: <div class="titlepage">
5165: <div>
5166: <div>
5167: <h2 class="title" style="clear: both"><a name=
5168: "components.distinfo" id=
1.14 xtraeme 5169: "components.distinfo"></a>7.2. <code class=
5170: "filename">distinfo</code></h2>
1.1 grant 5171: </div>
5172: </div>
5173: </div>
5174:
5175: <p>Most important, the mandatory message digest, or
5176: checksum, of all the distfiles needed for the package to
5177: compile, confirming they match the original file
5178: distributed by the author. This ensures that the distfile
5179: retrieved from the Internet has not been corrupted during
5180: transfer or altered by a malign force to introduce a
1.14 xtraeme 5181: security hole. It is generated using the
5182: <span><strong class="command">make
5183: makesum</strong></span> command. The digest algorithm
5184: used was, at one stage, md5, but that was felt lacking
5185: compared to sha1, and so sha1 is now the default
1.1 grant 5186: algorithm. The distfile size is also generated and stored
5187: in new distinfo files. The <a xmlns=
5188: "http://www.w3.org/TR/xhtml1/transitional" href=
5189: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20 ben 5190: class="pkgname">pkgtools/digest</a> utility calculates
5191: all of the digests in the distinfo file, and it provides
5192: various different algorithms. At the current time, the
5193: algorithms provided are: <span class=
5194: "emphasis"><em>md5</em></span>, <span class=
5195: "emphasis"><em>rmd160</em></span>, <span class=
5196: "emphasis"><em>sha1</em></span>, <span class=
5197: "emphasis"><em>sha256</em></span>, <span class=
5198: "emphasis"><em>sha384</em></span> and <span class=
5199: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 5200:
5201: <p>Some packages have different sets of distfiles on a
5202: per architecture basis, for example <a xmlns=
5203: "http://www.w3.org/TR/xhtml1/transitional" href=
5204: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.20 ben 5205: class="pkgname">www/navigator</a>). These are kept in the
5206: same distinfo file and care should be taken when
5207: upgrading such a package to ensure distfile information
5208: is not lost.</p>
1.1 grant 5209:
5210: <p>The message digest/checksum for all the official
1.14 xtraeme 5211: patches found in the <code class=
5212: "filename">patches/</code> directory (see <a href=
5213: "#components.patches" title=
1.1 grant 5214: "7.3. patches/*">Section 7.3,
5215: “patches/*”</a>) for the package is also
1.14 xtraeme 5216: stored in the <code class="filename">distinfo</code>
5217: file. This is a message digest/checksum of all lines in
5218: the patch file except the NetBSD RCS Id. This file is
5219: generated by invoking <span><strong class="command">make
5220: makepatchsum</strong></span> (or <span><strong class=
5221: "command">make mps</strong></span> if you're in a
5222: hurry).</p>
1.1 grant 5223: </div>
5224:
5225: <div class="sect1" lang="en" xml:lang="en">
5226: <div class="titlepage">
5227: <div>
5228: <div>
5229: <h2 class="title" style="clear: both"><a name=
5230: "components.patches" id=
5231: "components.patches"></a>7.3. patches/*</h2>
5232: </div>
5233: </div>
5234: </div>
5235:
5236: <p>This directory contains files that are used by the
5237: <a href=
5238: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
5239: <span class="citerefentry"><span class=
5240: "refentrytitle">patch</span>(1)</span></a> command to
5241: modify the sources as distributed in the distribution
5242: file into a form that will compile and run perfectly on
5243: NetBSD. The files are applied successively in alphabetic
5244: order (as returned by a shell “<span class=
5245: "quote">patches/patch-*</span>” glob expansion), so
1.14 xtraeme 5246: <code class="filename">patch-aa</code> is applied before
5247: <code class="filename">patch-ab</code>, etc.</p>
1.1 grant 5248:
1.14 xtraeme 5249: <p>The <code class="filename">patch-*</code> files should
5250: be in <span><strong class="command">diff
5251: -bu</strong></span> format, and apply without a fuzz to
5252: avoid problems. (To force patches to apply with fuzz you
5253: can set <code class=
5254: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 5255: not put changes for more than one file into a single
5256: patch-file, as this will make future modifications more
5257: difficult.</p>
5258:
5259: <p>Similar, a file should be patched at most once, not
5260: several times by several different patches. If a file
5261: needs several patches, they should be combined into one
5262: file.</p>
5263:
5264: <p>One important thing to mention is to pay attention
5265: that no RCS IDs get stored in the patch files, as these
5266: will cause problems when later checked into the NetBSD
1.14 xtraeme 5267: CVS tree. Use the <span><strong class=
5268: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 5269: "http://www.w3.org/TR/xhtml1/transitional" href=
5270: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 5271: class="pkgname">pkgtools/pkgdiff</a> package to avoid
5272: these problems.</p>
1.1 grant 5273:
5274: <p>For even more automation, we recommend using
1.14 xtraeme 5275: <span><strong class="command">mkpatches</strong></span>
5276: from the same package to make a whole set of patches. You
5277: just have to backup files before you edit them to
5278: <code class="filename">filename.orig</code>, e.g. with
5279: <span><strong class="command">cp -p filename
5280: filename.orig</strong></span> or, easier, by using
5281: <span><strong class="command">pkgvi</strong></span> again
5282: from the same package. If you upgrade a package this way,
5283: you can easily compare the new set of patches with the
5284: previously existing one with <span><strong class=
5285: "command">patchdiff</strong></span>.</p>
1.1 grant 5286:
5287: <p>When you have finished a package, remember to generate
5288: the checksums for the patch files by using the
1.14 xtraeme 5289: <span><strong class="command">make
5290: makepatchsum</strong></span> command, see <a href=
5291: "#components.distinfo" title=
1.5 hubertf 5292: "7.2. distinfo">Section 7.2,
1.14 xtraeme 5293: “<code class="filename">distinfo</code>”</a>.</p>
1.1 grant 5294:
5295: <p>Patch files that are distributed by the author or
1.14 xtraeme 5296: other maintainers can be listed in <code class=
5297: "varname">$PATCHFILES</code>.</p>
1.1 grant 5298:
5299: <p>If it is desired to store any patches that should not
5300: be committed into pkgsrc, they can be kept outside the
1.14 xtraeme 5301: pkgsrc tree in the <code class=
5302: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 5303: tree there is expected to have the same
5304: “<span class="quote">category/package</span>”
5305: structure as pkgsrc, and patches are expected to be
1.14 xtraeme 5306: stored inside these dirs (also known as <code class=
5307: "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
5308: you want to keep a private patch for <code class=
5309: "filename">pkgsrc/graphics/png</code>, keep it in
5310: <code class=
5311: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
5312: files in the named directory are expected to be patch
1.1 grant 5313: files, and <span class="emphasis"><em>they are applied
5314: after pkgsrc patches are applied</em></span>.</p>
5315: </div>
5316:
5317: <div class="sect1" lang="en" xml:lang="en">
5318: <div class="titlepage">
5319: <div>
5320: <div>
5321: <h2 class="title" style="clear: both"><a name=
1.20 ben 5322: "id2589201" id="id2589201"></a>7.4. Other
1.1 grant 5323: mandatory files</h2>
5324: </div>
5325: </div>
5326: </div>
5327:
5328: <div class="variablelist">
5329: <dl>
1.14 xtraeme 5330: <dt><span class="term"><code class=
5331: "filename">DESCR</code></span></dt>
1.1 grant 5332:
5333: <dd>
5334: <p>A multi-line description of the piece of
5335: software. This should include any credits where
5336: they are due. Please bear in mind that others do
5337: not share your sense of humour (or spelling
5338: idiosyncrasies), and that others will read
5339: everything that you write here.</p>
5340: </dd>
5341:
1.14 xtraeme 5342: <dt><span class="term"><code class=
5343: "filename">PLIST</code></span></dt>
1.1 grant 5344:
5345: <dd>
5346: <p>This file governs the files that are installed
5347: on your system: all the binaries, manual pages,
5348: etc. There are other directives which may be
5349: entered in this file, to control the creation and
5350: deletion of directories, and the location of
5351: inserted files. See <a href="#plist" title=
5352: "Chapter 8. PLIST issues">Chapter 8,
5353: <i>PLIST issues</i></a> for more information.</p>
5354: </dd>
5355: </dl>
5356: </div>
5357: </div>
5358:
5359: <div class="sect1" lang="en" xml:lang="en">
5360: <div class="titlepage">
5361: <div>
5362: <div>
5363: <h2 class="title" style="clear: both"><a name=
5364: "components.optional" id=
5365: "components.optional"></a>7.5. Optional
5366: files</h2>
5367: </div>
5368: </div>
5369: </div>
5370:
5371: <div class="variablelist">
5372: <dl>
1.14 xtraeme 5373: <dt><span class="term"><code class=
5374: "filename">INSTALL</code></span></dt>
1.1 grant 5375:
5376: <dd>
5377: <p>This shell script is invoked twice by <a href=
5378: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5379: <span class="citerefentry"><span class=
5380: "refentrytitle">pkg_add</span>(1)</span></a>. First
5381: time after package extraction and before files are
5382: moved in place, the second time after the files to
5383: install are moved in place. This can be used to do
5384: any custom procedures not possible with @exec
1.14 xtraeme 5385: commands in <code class="filename">PLIST</code>.
5386: See <a href=
1.1 grant 5387: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5388: <span class="citerefentry"><span class=
5389: "refentrytitle">pkg_add</span>(1)</span></a> and
5390: <a href=
5391: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5392: <span class="citerefentry"><span class=
5393: "refentrytitle">pkg_create</span>(1)</span></a> for
5394: more information.</p>
5395: </dd>
5396:
1.14 xtraeme 5397: <dt><span class="term"><code class=
5398: "filename">DEINSTALL</code></span></dt>
1.1 grant 5399:
5400: <dd>
5401: <p>This script is executed before and after any
5402: files are removed. It is this script's
5403: responsibility to clean up any additional messy
5404: details around the package's installation, since
5405: all pkg_delete knows is how to delete the files
5406: created in the original distribution. See <a href=
5407: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
5408: <span class="citerefentry"><span class=
5409: "refentrytitle">pkg_delete</span>(1)</span></a> and
5410: <a href=
5411: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5412: <span class="citerefentry"><span class=
5413: "refentrytitle">pkg_create</span>(1)</span></a> for
5414: more information.</p>
5415: </dd>
5416:
1.14 xtraeme 5417: <dt><span class="term"><code class=
5418: "filename">MESSAGE</code></span></dt>
1.1 grant 5419:
5420: <dd>
5421: <p>Display this file after installation of the
5422: package. Useful for things like legal notices on
5423: almost-free software and hints for updating config
5424: files after installing modules for apache, PHP etc.
5425: Please note that you can modify variables in it
1.14 xtraeme 5426: easily by using <code class=
5427: "varname">MESSAGE_SUBST</code> in the package's
5428: <code class="filename">Makefile</code>:</p>
1.1 grant 5429: <pre class="programlisting">
5430: MESSAGE_SUBST+= SOMEVAR="somevalue"
5431: </pre>
5432:
5433: <p>replaces "${SOMEVAR}" with “<span class=
1.14 xtraeme 5434: "quote">somevalue</span>” in <code class=
5435: "filename">MESSAGE</code>.</p>
1.1 grant 5436: </dd>
5437: </dl>
5438: </div>
5439: </div>
5440:
5441: <div class="sect1" lang="en" xml:lang="en">
5442: <div class="titlepage">
5443: <div>
5444: <div>
5445: <h2 class="title" style="clear: both"><a name=
1.20 ben 5446: "id2589326" id=
5447: "id2589326"></a>7.6. <code class=
1.14 xtraeme 5448: "filename">work*</code></h2>
1.1 grant 5449: </div>
5450: </div>
5451: </div>
5452:
1.14 xtraeme 5453: <p>When you type <span><strong class=
5454: "command">make</strong></span> the distribution files are
5455: unpacked into this directory. It can be removed by
5456: running <span><strong class="command">make
5457: clean</strong></span>. Besides the sources, this
5458: directory is also used to keep various timestamp
1.1 grant 5459: files.</p>
5460:
5461: <p>If a package doesn't create a subdirectory for itself
5462: (like GNU software does, for instance), but extracts
5463: itself in the current directory, you should set
1.14 xtraeme 5464: <code class="varname">WRKSRC</code> accordingly, e.g.
1.1 grant 5465: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
5466: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.20 ben 5467: class="pkgname">editors/sam</a> again, but the quick
5468: answer is:</p>
1.1 grant 5469: <pre class="programlisting">
5470: WRKSRC= ${WRKDIR}
5471: </pre>
5472:
1.14 xtraeme 5473: <p>Please note that the old <code class=
5474: "varname">NO_WRKSUBDIR</code> has been deprecated and
1.1 grant 5475: should not be used. Also, if your package doesn't create
1.14 xtraeme 5476: a subdir with the name of <code class=
5477: "varname">DISTNAME</code> but some different name, set
5478: <code class="varname">WRKSRC</code> to point to the
5479: proper name in <code class="filename">${WRKDIR}</code>.
5480: See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5481: href=
1.1 grant 5482: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.20 ben 5483: class="pkgname">lang/tcl</a> and <a xmlns=
5484: "http://www.w3.org/TR/xhtml1/transitional" href=
5485: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
5486: class="pkgname">x11/tk</a> for examples, and here is
5487: another one:</p>
1.1 grant 5488: <pre class="programlisting">
5489: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
5490: </pre>
5491:
5492: <p>The name of the working directory created by pkgsrc is
1.14 xtraeme 5493: <code class="filename">work</code> by default. If the
5494: same pkgsrc tree should be used on several different
5495: platforms, the variable <code class=
5496: "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
1.1 grant 5497: attach the platform to the directory name, e.g.
1.14 xtraeme 5498: <code class="filename">work.i386</code> or <code class=
5499: "filename">work.sparc</code>.</p>
1.1 grant 5500: </div>
5501:
5502: <div class="sect1" lang="en" xml:lang="en">
5503: <div class="titlepage">
5504: <div>
5505: <div>
5506: <h2 class="title" style="clear: both"><a name=
1.20 ben 5507: "id2589482" id=
5508: "id2589482"></a>7.7. <code class=
1.14 xtraeme 5509: "filename">files/*</code></h2>
1.1 grant 5510: </div>
5511: </div>
5512: </div>
5513:
5514: <p>If you have any files that you wish to be placed in
5515: the package prior to configuration or building, you could
5516: place these files here and use a “<span class=
5517: "quote">${CP}</span>” command in the
5518: “<span class="quote">pre-configure</span>”
5519: target to achieve this. Alternatively, you could simply
1.14 xtraeme 5520: diff the file against <code class=
5521: "filename">/dev/null</code> and use the patch mechanism
5522: to manage the creation of this file.</p>
1.1 grant 5523: </div>
5524: </div>
5525:
5526: <div class="chapter" lang="en" xml:lang="en">
5527: <div class="titlepage">
5528: <div>
5529: <div>
5530: <h2 class="title"><a name="plist" id=
5531: "plist"></a>Chapter 8. PLIST issues</h2>
5532: </div>
5533: </div>
5534: </div>
5535:
5536: <div class="toc">
5537: <p><b>Table of Contents</b></p>
5538:
5539: <dl>
1.20 ben 5540: <dt><span class="sect1"><a href="#id2589537">8.1. RCS
1.1 grant 5541: ID</a></span></dt>
5542:
1.20 ben 5543: <dt><span class="sect1"><a href="#id2589552">8.2.
1.14 xtraeme 5544: Semi-automatic <code class="filename">PLIST</code>
5545: generation</a></span></dt>
1.1 grant 5546:
5547: <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14 xtraeme 5548: Tweaking output of <span><strong class="command">make
5549: print-PLIST</strong></span></a></span></dt>
1.1 grant 5550:
5551: <dt><span class="sect1"><a href="#plist.misc">8.4.
5552: Variable substitution in PLIST</a></span></dt>
5553:
1.20 ben 5554: <dt><span class="sect1"><a href="#id2589941">8.5.
1.1 grant 5555: Manpage-compression</a></span></dt>
5556:
1.20 ben 5557: <dt><span class="sect1"><a href="#id2589982">8.6.
1.14 xtraeme 5558: Changing PLIST source with <code class=
5559: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5560:
1.20 ben 5561: <dt><span class="sect1"><a href="#id2590000">8.7.
1.1 grant 5562: Platform specific and differing PLISTs</a></span></dt>
5563:
5564: <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
5565: Sharing directories between packages</a></span></dt>
5566: </dl>
5567: </div>
5568:
1.14 xtraeme 5569: <p>The <code class="filename">PLIST</code> file contains a
1.1 grant 5570: package's “<span class="quote">packing
5571: list</span>”, i.e. a list of files that belong to the
1.14 xtraeme 5572: package (relative to the <code class=
5573: "filename">${PREFIX}</code> directory it's been installed
5574: in) plus some additional statements - see the <a href=
1.1 grant 5575: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5576: <span class="citerefentry"><span class=
5577: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
5578: a full list. This chapter addresses some issues that need
1.14 xtraeme 5579: attention when dealing with the <code class=
5580: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 5581:
5582: <div class="sect1" lang="en" xml:lang="en">
5583: <div class="titlepage">
5584: <div>
5585: <div>
5586: <h2 class="title" style="clear: both"><a name=
1.20 ben 5587: "id2589537" id="id2589537"></a>8.1. RCS
1.1 grant 5588: ID</h2>
5589: </div>
5590: </div>
5591: </div>
5592:
5593: <p>Be sure to add a RCS ID line as the first thing in any
1.14 xtraeme 5594: <code class="filename">PLIST</code> file you write:</p>
1.1 grant 5595: <pre class="programlisting">
1.17 sketch 5596: @comment $NetBSD$
1.1 grant 5597: </pre>
5598: </div>
5599:
5600: <div class="sect1" lang="en" xml:lang="en">
5601: <div class="titlepage">
5602: <div>
5603: <div>
5604: <h2 class="title" style="clear: both"><a name=
1.20 ben 5605: "id2589552" id=
5606: "id2589552"></a>8.2. Semi-automatic
1.14 xtraeme 5607: <code class="filename">PLIST</code> generation</h2>
1.1 grant 5608: </div>
5609: </div>
5610: </div>
5611:
1.14 xtraeme 5612: <p>You can use the <span><strong class="command">make
5613: print-PLIST</strong></span> command to output a PLIST
5614: that matches any new files since the package was
5615: extracted. See <a href="#build.helpful-targets" title=
1.1 grant 5616: "11.3. Other helpful targets">Section 11.3,
5617: “Other helpful targets”</a> for more
5618: information on this target.</p>
5619: </div>
5620:
5621: <div class="sect1" lang="en" xml:lang="en">
5622: <div class="titlepage">
5623: <div>
5624: <div>
5625: <h2 class="title" style="clear: both"><a name=
5626: "print-PLIST" id=
5627: "print-PLIST"></a>8.3. Tweaking output of
1.14 xtraeme 5628: <span><strong class="command">make
5629: print-PLIST</strong></span></h2>
1.1 grant 5630: </div>
5631: </div>
5632: </div>
5633:
5634: <p>If you have used any of the *-dirs packages, as
5635: explained in <a href="#faq.common-dirs" title=
5636: "8.8. Sharing directories between packages">Section 8.8,
5637: “Sharing directories between packages”</a>,
1.14 xtraeme 5638: you may have noticed that <span><strong class=
5639: "command">make print-PLIST</strong></span> outputs a set
5640: of <code class="varname">@comment</code>s instead of real
5641: <code class="varname">@dirrm</code> lines. You can also
5642: do this for specific directories and files, so that the
5643: results of that command are very close to reality. This
5644: helps <span class="emphasis"><em>a lot</em></span> during
5645: the update of packages.</p>
5646:
5647: <p>The <code class="varname">PRINT_PLIST_AWK</code>
5648: variable takes a set of AWK patterns and actions that are
5649: used to filter the output of print-PLIST. You can
5650: <span class="emphasis"><em>append</em></span> any chunk
5651: of AWK scripting you like to it, but be careful with
1.1 grant 5652: quoting.</p>
5653:
1.14 xtraeme 5654: <p>For example, to get all files inside the <code class=
5655: "filename">libdata/foo</code> directory removed from the
1.1 grant 5656: resulting PLIST:</p>
5657: <pre class="programlisting">
5658: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
5659:
5660: </pre>
5661:
1.14 xtraeme 5662: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 5663: lines referring to a specific (shared) directory
1.14 xtraeme 5664: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 5665: <pre class="programlisting">
5666: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
5667:
5668: </pre>
5669: </div>
5670:
5671: <div class="sect1" lang="en" xml:lang="en">
5672: <div class="titlepage">
5673: <div>
5674: <div>
5675: <h2 class="title" style="clear: both"><a name=
5676: "plist.misc" id="plist.misc"></a>8.4. Variable
5677: substitution in PLIST</h2>
5678: </div>
5679: </div>
5680: </div>
5681:
5682: <p>A number of variables are substituted automatically in
5683: PLISTs when a package is installed on a system. This
5684: includes the following variables:</p>
5685:
5686: <div class="variablelist">
5687: <dl>
1.14 xtraeme 5688: <dt><span class="term"><code class=
5689: "varname">${MACHINE_ARCH}</code>, <code class=
5690: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 5691:
5692: <dd>
5693: <p>Some packages like emacs and perl embed
5694: information about which architecture they were
5695: built on into the pathnames where they install
5696: their file. To handle this case, PLIST will be
5697: preprocessed before actually used, and the symbol
1.14 xtraeme 5698: “<span class="quote"><code class=
5699: "varname">${MACHINE_ARCH}</code></span>” will
5700: be replaced by what <span><strong class=
5701: "command">uname -p</strong></span> gives. The same
5702: is done if the string <code class=
5703: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
5704: PLIST somewhere - use this on packages that have
5705: GNU autoconf created configure scripts.</p>
1.1 grant 5706:
5707: <div class="note" style=
5708: "margin-left: 0.5in; margin-right: 0.5in;">
5709: <h3 class="title">Legacy note</h3>
5710:
5711: <p>There used to be a symbol “<span class=
1.14 xtraeme 5712: "quote"><code class=
5713: "varname">$ARCH</code></span>” that was
5714: replaced by the output of <span><strong class=
5715: "command">uname -m</strong></span>, but that's no
1.1 grant 5716: longer supported and has been removed.</p>
5717: </div>
5718: </dd>
5719:
1.14 xtraeme 5720: <dt><span class="term"><code class=
5721: "varname">${OPSYS}</code>, <code class=
5722: "varname">${LOWER_OPSYS}</code>, <code class=
5723: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 5724:
5725: <dd>
5726: <p>Some packages want to embed the OS name and
5727: version into some paths. To do this, use these
1.14 xtraeme 5728: variables in the <code class=
5729: "filename">PLIST</code>:</p>
1.1 grant 5730:
5731: <div class="itemizedlist">
5732: <ul type="disc">
5733: <li>
1.14 xtraeme 5734: <p><code class="varname">${OPSYS}</code> -
5735: output of “<span class=
5736: "quote"><span><strong class="command">uname
5737: -s</strong></span></span>”</p>
1.1 grant 5738: </li>
5739:
5740: <li>
1.14 xtraeme 5741: <p><code class=
5742: "varname">${LOWER_OPSYS}</code> - lowercase
5743: common name (eg. “<span class=
5744: "quote">solaris</span>”)</p>
1.1 grant 5745: </li>
5746:
5747: <li>
1.14 xtraeme 5748: <p><code class="varname">${OS_VERSION}</code>
5749: - “<span class=
5750: "quote"><span><strong class="command">uname
5751: -r</strong></span></span>”</p>
1.1 grant 5752: </li>
5753: </ul>
5754: </div>
5755: </dd>
5756:
1.14 xtraeme 5757: <dt><span class="term"><code class=
5758: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 5759:
5760: <dd>
5761: <p>Packages that install locale files should list
5762: them in the PLIST as “<span class=
5763: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
5764: instead of “<span class=
5765: "quote">share/locale/de/LC_MESSAGES/...</span>”.
5766: This properly handles the fact that different
5767: operating systems expect locale files to be either
1.14 xtraeme 5768: in <code class="filename">share</code> or
5769: <code class="filename">lib</code> by default.</p>
1.1 grant 5770: </dd>
5771: </dl>
5772: </div>
5773:
5774: <p>For a complete list of values which are replaced by
1.14 xtraeme 5775: default, please look in <code class=
5776: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 5777: "emphasis"><em>PLIST_SUBST</em></span>).</p>
5778:
5779: <p>If you want to change other variables not listed
5780: above, you can add variables and their expansions to this
1.14 xtraeme 5781: variable in the following way, similar to <code class=
5782: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 5783: "#components.optional" title=
5784: "7.5. Optional files">Section 7.5,
5785: “Optional files”</a>):</p>
5786: <pre class="programlisting">
5787: PLIST_SUBST+= SOMEVAR="somevalue"
5788: </pre>
5789:
5790: <p>This replaces all occurrences of “<span class=
5791: "quote">${SOMEVAR}</span>” in the PLIST with
5792: “<span class="quote">somevalue</span>”.</p>
5793: </div>
5794:
5795: <div class="sect1" lang="en" xml:lang="en">
5796: <div class="titlepage">
5797: <div>
5798: <div>
5799: <h2 class="title" style="clear: both"><a name=
1.20 ben 5800: "id2589941" id=
5801: "id2589941"></a>8.5. Manpage-compression</h2>
1.1 grant 5802: </div>
5803: </div>
5804: </div>
5805:
5806: <p>Manpages should be installed in compressed form if
1.14 xtraeme 5807: <code class="varname">MANZ</code> is set (in <code class=
5808: "filename">bsd.own.mk</code>), and uncompressed
5809: otherwise. To handle this in the <code class=
5810: "filename">PLIST</code> file, the suffix
5811: “<span class="quote">.gz</span>” is
5812: appended/removed automatically for manpages according to
5813: <code class="varname">MANZ</code> and <code class=
5814: "varname">MANCOMPRESSED</code> being set or not, see
5815: above for details. This modification of the <code class=
5816: "filename">PLIST</code> file is done on a copy of it, not
5817: <code class="filename">PLIST</code> itself.</p>
1.1 grant 5818: </div>
5819:
5820: <div class="sect1" lang="en" xml:lang="en">
5821: <div class="titlepage">
5822: <div>
5823: <div>
5824: <h2 class="title" style="clear: both"><a name=
1.20 ben 5825: "id2589982" id="id2589982"></a>8.6. Changing
1.14 xtraeme 5826: PLIST source with <code class=
5827: "varname">PLIST_SRC</code></h2>
1.1 grant 5828: </div>
5829: </div>
5830: </div>
5831:
1.14 xtraeme 5832: <p>To use one or more files as source for the
5833: <code class="filename">PLIST</code> used in generating
5834: the binary package, set the variable <code class=
5835: "varname">PLIST_SRC</code> to the names of that file(s).
1.1 grant 5836: The files are later concatenated using cat(1), and order
5837: of things is important.</p>
5838: </div>
5839:
5840: <div class="sect1" lang="en" xml:lang="en">
5841: <div class="titlepage">
5842: <div>
5843: <div>
5844: <h2 class="title" style="clear: both"><a name=
1.20 ben 5845: "id2590000" id="id2590000"></a>8.7. Platform
1.1 grant 5846: specific and differing PLISTs</h2>
5847: </div>
5848: </div>
5849: </div>
5850:
5851: <p>Some packages decide to install a different set of
5852: files based on the operating system being used. These
5853: differences can be automatically handled by using the
5854: following files:</p>
5855:
5856: <div class="itemizedlist">
5857: <ul type="disc">
5858: <li>
1.14 xtraeme 5859: <p><code class="filename">PLIST.common</code></p>
1.1 grant 5860: </li>
5861:
5862: <li>
1.14 xtraeme 5863: <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1 grant 5864: </li>
5865:
5866: <li>
1.14 xtraeme 5867: <p><code class=
1.21 ! ben 5868: "filename">PLIST.${MACHINE_ARCH}</code></p>
! 5869: </li>
! 5870:
! 5871: <li>
! 5872: <p><code class=
! 5873: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
! 5874: </li>
! 5875:
! 5876: <li>
! 5877: <p><code class=
1.14 xtraeme 5878: "filename">PLIST.common_end</code></p>
1.1 grant 5879: </li>
5880: </ul>
5881: </div>
5882: </div>
5883:
5884: <div class="sect1" lang="en" xml:lang="en">
5885: <div class="titlepage">
5886: <div>
5887: <div>
5888: <h2 class="title" style="clear: both"><a name=
5889: "faq.common-dirs" id=
5890: "faq.common-dirs"></a>8.8. Sharing directories
5891: between packages</h2>
5892: </div>
5893: </div>
5894: </div>
5895:
5896: <p>A “<span class="quote">shared
5897: directory</span>” is a directory where multiple
5898: (and unrelated) packages install files. These directories
5899: are problematic because you have to add special tricks in
5900: the PLIST to conditionally remove them, or have some
5901: centralized package handle them.</p>
5902:
5903: <p>Within pkgsrc, you'll find both approaches. If a
5904: directory is shared by a few unrelated packages, it's
5905: often not worth to add an extra package to remove it.
5906: Therefore, one simply does:</p>
5907: <pre class="programlisting">
5908: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
5909:
5910: </pre>
5911:
5912: <p>in the PLISTs of all affected packages, instead of the
5913: regular "@dirrm" line.</p>
5914:
5915: <p>However, if the directory is shared across many
5916: packages, two different solutions are available:</p>
5917:
5918: <div class="orderedlist">
5919: <ol type="1">
5920: <li>
5921: <p>If the packages have a common dependency, the
5922: directory can be removed in that. For example, see
5923: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5924: href=
5925: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20 ben 5926: class="pkgname">textproc/scrollkeeper</a>, which
5927: removes the shared directory <code class=
5928: "filename">share/omf</code>.</p>
1.1 grant 5929: </li>
5930:
5931: <li>
5932: <p>If the packages using the directory are not
5933: related at all (they have no common dependencies),
5934: a *-dirs package is used.</p>
5935: </li>
5936: </ol>
5937: </div>
5938:
5939: <p>From now on, we'll discuss the second solution. To get
5940: an idea of the *-dirs packages available, issue:</p>
5941: <pre class="programlisting">
1.14 xtraeme 5942: <code class="prompt">%</code> cd .../pkgsrc
5943: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 5944:
5945: </pre>
5946:
5947: <p>Their use from other packages is very simple. The
1.14 xtraeme 5948: <code class="varname">USE_DIRS</code> variable takes a
5949: list of package names (without the “<span class=
1.1 grant 5950: "quote">-dirs</span>” part) together with the
5951: required version number (always pick the latest one when
5952: writting new packages).</p>
5953:
5954: <p>For example, if a package installs files under
1.14 xtraeme 5955: <code class="filename">share/applications</code>, it
5956: should have the following line in it:</p>
1.1 grant 5957: <pre class="programlisting">
5958: USE_DIRS+= xdg-1.1
5959:
5960: </pre>
5961:
1.14 xtraeme 5962: <p>After regenerating the PLIST using
5963: <span><strong class="command">make
5964: print-PLIST</strong></span>, you should get the right
5965: (commented out) lines.</p>
1.1 grant 5966:
1.14 xtraeme 5967: <p>Note that, even if your package is using <code class=
5968: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 5969: *-x11-dirs packages. Just specify the name without that
1.14 xtraeme 5970: part and pkgsrc (in particular, <code class=
5971: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 5972: </div>
5973: </div>
5974:
5975: <div class="chapter" lang="en" xml:lang="en">
5976: <div class="titlepage">
5977: <div>
5978: <div>
5979: <h2 class="title"><a name="buildlink" id=
5980: "buildlink"></a>Chapter 9. Buildlink
5981: methodology</h2>
5982: </div>
5983: </div>
5984: </div>
5985:
5986: <div class="toc">
5987: <p><b>Table of Contents</b></p>
5988:
5989: <dl>
1.21 ! ben 5990: <dt><span class="sect1"><a href="#id2590334">9.1.
1.1 grant 5991: Converting packages to use buildlink3</a></span></dt>
5992:
1.21 ! ben 5993: <dt><span class="sect1"><a href="#id2590525">9.2.
1.14 xtraeme 5994: Writing <code class="filename">buildlink3.mk</code>
5995: files</a></span></dt>
1.1 grant 5996:
5997: <dd>
5998: <dl>
1.21 ! ben 5999: <dt><span class="sect2"><a href="#id2590595">9.2.1.
1.1 grant 6000: Anatomy of a buildlink3.mk file</a></span></dt>
6001:
1.21 ! ben 6002: <dt><span class="sect2"><a href="#id2591035">9.2.2.
1.14 xtraeme 6003: Updating <code class=
6004: "varname">BUILDLINK_DEPENDS.<em class=
6005: "replaceable"><code>pkg</code></em></code> in
6006: <code class="filename">buildlink3.mk</code>
1.1 grant 6007: files</a></span></dt>
6008: </dl>
6009: </dd>
6010:
1.21 ! ben 6011: <dt><span class="sect1"><a href="#id2591182">9.3.
1.14 xtraeme 6012: Writing <code class="filename">builtin.mk</code>
6013: files</a></span></dt>
1.1 grant 6014:
6015: <dd>
6016: <dl>
1.21 ! ben 6017: <dt><span class="sect2"><a href="#id2591400">9.3.1.
1.14 xtraeme 6018: Anatomy of a <code class=
6019: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 6020:
1.21 ! ben 6021: <dt><span class="sect2"><a href="#id2591627">9.3.2.
1.1 grant 6022: Global preferences for native or pkgsrc
6023: software</a></span></dt>
6024: </dl>
6025: </dd>
6026: </dl>
6027: </div>
6028:
6029: <p>Buildlink is a framework in pkgsrc that controls what
6030: headers and libraries are seen by a package's configure and
6031: build processes. This is implemented in a two step
6032: process:</p>
6033:
6034: <div class="orderedlist">
6035: <ol type="1">
6036: <li>
6037: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 6038: into <code class="varname">BUILDLINK_DIR</code>,
6039: which by default is a subdirectory of <code class=
6040: "varname">WRKDIR</code>.</p>
1.1 grant 6041: </li>
6042:
6043: <li>
6044: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 6045: the normal compiler tools that translate <code class=
6046: "option">-I${LOCALBASE}/include</code> and
6047: <code class="option">-L${LOCALBASE}/lib</code> into
6048: references to <code class=
6049: "varname">BUILDLINK_DIR</code>. The wrapper scripts
6050: also make native compiler on some operating systems
6051: look like GCC, so that packages that expect GCC won't
6052: require modifications to build with those native
6053: compilers.</p>
1.1 grant 6054: </li>
6055: </ol>
6056: </div>
6057:
6058: <p>This normalizes the environment in which a package is
6059: built so that the package may be built consistently despite
6060: what other software may be installed. Please note that the
1.14 xtraeme 6061: normal system header and library paths, e.g. <code class=
6062: "filename">/usr/include</code>, <code class=
6063: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 6064: buildlink3 is designed to insulate the package build from
6065: non-system-supplied software.</p>
6066:
6067: <div class="sect1" lang="en" xml:lang="en">
6068: <div class="titlepage">
6069: <div>
6070: <div>
6071: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 6072: "id2590334" id="id2590334"></a>9.1. Converting
1.1 grant 6073: packages to use buildlink3</h2>
6074: </div>
6075: </div>
6076: </div>
6077:
6078: <p>The process of converting packages to use the
6079: buildlink3 framework (“<span class=
6080: "quote">bl3ifying</span>”) is fairly
6081: straightforward. The things to keep in mind are:</p>
6082:
6083: <div class="orderedlist">
6084: <ol type="1">
6085: <li>
1.14 xtraeme 6086: <p>Set <code class="varname">USE_BUILDLINK3</code>
6087: to “<span class=
6088: "quote">yes</span>”.</p>
1.1 grant 6089: </li>
6090:
6091: <li>
6092: <p>Ensure that the build always calls the wrapper
6093: scripts instead of the actual toolchain. Some
6094: packages are tricky, and the only way to know for
1.14 xtraeme 6095: sure is the check <code class=
6096: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 6097: wrappers are being invoked.</p>
6098: </li>
6099:
6100: <li>
1.14 xtraeme 6101: <p>Don't override <code class=
6102: "varname">PREFIX</code> from within the package
6103: Makefile, e.g. Java VMs, standalone shells, etc.,
6104: because the code to symlink files into <code class=
6105: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 6106: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 6107: <em class=
6108: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 6109: </li>
6110:
6111: <li>
6112: <p>Remember that <span class=
1.14 xtraeme 6113: "emphasis"><em>only</em></span> the <code class=
6114: "filename">buildlink3.mk</code> files that you list
1.1 grant 6115: in a package's Makefile are added as dependencies
6116: for that package.</p>
6117: </li>
6118: </ol>
6119: </div>
6120:
6121: <p>If a dependency on a particular package is required
6122: for its libraries and headers, then we replace:</p>
6123: <pre class="programlisting">
6124: DEPENDS+= foo>=1.1.0:../../category/foo
6125: </pre>
6126:
6127: <p>with</p>
6128: <pre class="programlisting">
6129: .include "../../category/foo/buildlink3.mk"
6130: </pre>
6131:
1.14 xtraeme 6132: <p>There are several <code class=
6133: "filename">buildlink3.mk</code> files in <code class=
6134: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 6135: issues:</p>
6136:
6137: <div class="itemizedlist">
6138: <ul type="disc">
6139: <li>
1.14 xtraeme 6140: <p><code class="filename">bdb.buildlink3.mk</code>
1.1 grant 6141: chooses either the native or a pkgsrc Berkeley DB
1.14 xtraeme 6142: implementation based on the values of <code class=
6143: "varname">BDB_ACCEPTED</code> and <code class=
6144: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 6145: </li>
6146:
6147: <li>
1.14 xtraeme 6148: <p><code class=
6149: "filename">curses.buildlink3.mk</code> If the
6150: system comes with neither Curses nor NCurses, this
6151: will take care to install the <a xmlns=
6152: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 6153: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20 ben 6154: class="pkgname">devel/ncurses</a> package.</p>
1.1 grant 6155: </li>
6156:
6157: <li>
1.14 xtraeme 6158: <p><code class="filename">krb5.buildlink3.mk</code>
6159: uses the value of <code class=
6160: "varname">KRB5_ACCEPTED</code> to choose between
1.1 grant 6161: adding a dependency on Heimdal or MIT-krb5 for
6162: packages that require a Kerberos 5
6163: implementation.</p>
6164: </li>
6165:
6166: <li>
1.14 xtraeme 6167: <p><code class=
6168: "filename">motif.buildlink3.mk</code> checks for a
6169: system-provided Motif installation or adds a
6170: dependency on <a xmlns=
1.1 grant 6171: "http://www.w3.org/TR/xhtml1/transitional" href=
6172: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20 ben 6173: class="pkgname">x11/lesstif</a> or <a xmlns=
6174: "http://www.w3.org/TR/xhtml1/transitional" href=
6175: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
6176: class="pkgname">x11/openmotif</a>;</p>
1.1 grant 6177: </li>
6178:
6179: <li>
1.14 xtraeme 6180: <p><code class=
6181: "filename">ossaudio.buildlink3.mk</code> defines
6182: several variables that may be used by packages that
6183: use the Open Sound System (OSS) API;</p>
1.1 grant 6184: </li>
6185:
6186: <li>
1.14 xtraeme 6187: <p><code class=
6188: "filename">pgsql.buildlink3.mk</code> will accept
6189: either Postgres 7.3 or 7.4, whichever is found
6190: installed. See the file for more information.</p>
1.1 grant 6191: </li>
6192:
6193: <li>
1.14 xtraeme 6194: <p><code class=
6195: "filename">pthread.buildlink3.mk</code> uses the
6196: value of <code class="varname">PTHREAD_OPTS</code>
6197: and checks for native pthreads or adds a dependency
6198: on <a xmlns=
1.1 grant 6199: "http://www.w3.org/TR/xhtml1/transitional" href=
6200: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20 ben 6201: class="pkgname">devel/pth</a> as needed;</p>
1.1 grant 6202: </li>
6203:
6204: <li>
1.14 xtraeme 6205: <p><code class="filename">xaw.buildlink3.mk</code>
6206: uses the value of <code class=
6207: "varname">XAW_TYPE</code> to choose a particular
6208: Athena widgets library.</p>
1.1 grant 6209: </li>
6210: </ul>
6211: </div>
6212:
1.14 xtraeme 6213: <p>The comments in those <code class=
6214: "filename">buildlink3.mk</code> files provide a more
1.1 grant 6215: complete description of how to use them properly.</p>
6216: </div>
6217:
6218: <div class="sect1" lang="en" xml:lang="en">
6219: <div class="titlepage">
6220: <div>
6221: <div>
6222: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 6223: "id2590525" id="id2590525"></a>9.2. Writing
1.14 xtraeme 6224: <code class="filename">buildlink3.mk</code>
6225: files</h2>
1.1 grant 6226: </div>
6227: </div>
6228: </div>
6229:
1.14 xtraeme 6230: <p>A package's <code class=
6231: "filename">buildlink3.mk</code> file is included by
6232: Makefiles to indicate the need to compile and link
6233: against header files and libraries provided by the
6234: package. A <code class="filename">buildlink3.mk</code>
6235: file should always provide enough information to add the
6236: correct type of dependency relationship and include any
6237: other <code class="filename">buildlink3.mk</code> files
6238: that it needs to find headers and libraries that it needs
6239: in turn.</p>
1.1 grant 6240:
1.14 xtraeme 6241: <p>To generate an initial <code class=
6242: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 6243: Rene Hexel's <a xmlns=
6244: "http://www.w3.org/TR/xhtml1/transitional" href=
6245: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20 ben 6246: class="pkgname">pkgtools/createbuildlink</a> package is
6247: highly recommended. For most packages, the following
6248: command will generate a good starting point for
6249: <code class="filename">buildlink3.mk</code> files:</p>
1.1 grant 6250: <pre class="screen">
1.14 xtraeme 6251: <code class="prompt">%</code> <strong class=
6252: "userinput"><code>cd pkgsrc/<em class=
6253: "replaceable"><code>category</code></em>/<em class=
6254: "replaceable"><code>pkgdir</code></em>
6255: <code class=
6256: "prompt">%</code> createbuildlink -3 >buildlink3.mk</code></strong>
1.1 grant 6257: </pre>
6258:
6259: <div class="sect2" lang="en" xml:lang="en">
6260: <div class="titlepage">
6261: <div>
6262: <div>
1.21 ! ben 6263: <h3 class="title"><a name="id2590595" id=
! 6264: "id2590595"></a>9.2.1. Anatomy of a buildlink3.mk
1.1 grant 6265: file</h3>
6266: </div>
6267: </div>
6268: </div>
6269:
1.14 xtraeme 6270: <p>The following real-life example <code class=
6271: "filename">buildlink3.mk</code> is taken from
6272: <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 6273: <pre class="programlisting">
1.17 sketch 6274: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 6275:
6276: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
6277: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
6278:
6279: .if !empty(BUILDLINK_DEPTH:M+)
6280: BUILDLINK_DEPENDS+= tiff
6281: .endif
6282:
6283: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
6284: BUILDLINK_PACKAGES+= tiff
6285:
6286: .if !empty(TIFF_BUILDLINK3_MK:M+)
6287: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
6288: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
6289: .endif # TIFF_BUILDLINK3_MK
6290:
6291: .include "../../devel/zlib/buildlink3.mk"
6292: .include "../../graphics/jpeg/buildlink3.mk"
6293:
6294: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
6295: </pre>
6296:
1.14 xtraeme 6297: <p>The header and footer manipulate <code class=
6298: "varname">BUILDLINK_DEPTH</code>, which is common
6299: across all <code class="filename">buildlink3.mk</code>
6300: files and is used to track at what depth we are
6301: including <code class="filename">buildlink3.mk</code>
6302: files.</p>
1.1 grant 6303:
6304: <p>The first section controls if the dependency on
1.14 xtraeme 6305: <em class="replaceable"><code>pkg</code></em> is added.
6306: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 6307: global list of packages for which dependencies are
6308: added by buildlink3.</p>
6309:
6310: <p>The second section advises pkgsrc that the
1.14 xtraeme 6311: <code class="filename">buildlink3.mk</code> file for
6312: <em class="replaceable"><code>pkg</code></em> has been
6313: included at some point. <code class=
6314: "varname">BUILDLINK_PACKAGES</code> is the global list
6315: of packages for which <code class=
6316: "filename">buildlink3.mk</code> files have been
6317: included. It must <span class=
6318: "emphasis"><em>always</em></span> be appended to within
6319: a <code class="filename">buildlink3.mk</code> file.</p>
1.1 grant 6320:
6321: <p>The third section is protected from multiple
1.14 xtraeme 6322: inclusion and controls how the dependency on <em class=
6323: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 6324: important variables are set in the section:</p>
6325:
6326: <div class="itemizedlist">
6327: <ul type="disc">
6328: <li>
1.14 xtraeme 6329: <p><code class=
6330: "varname">BUILDLINK_DEPENDS.<em class=
6331: "replaceable"><code>pkg</code></em></code> is the
6332: actual dependency recorded in the installed
6333: package; this should always be set using
6334: <span><strong class="command">+=</strong></span>
6335: to ensure that we're appending to any
6336: pre-existing list of values. This variable should
6337: be set to the first version of the package that
6338: had the last change in the major number of a
6339: shared library or that had a major API
6340: change.</p>
1.1 grant 6341: </li>
6342:
6343: <li>
1.14 xtraeme 6344: <p><code class=
6345: "varname">BUILDLINK_PKGSRCDIR.<em class=
6346: "replaceable"><code>pkg</code></em></code> is the
6347: location of the <em class=
6348: "replaceable"><code>pkg</code></em> pkgsrc
1.1 grant 6349: directory;</p>
6350: </li>
6351:
6352: <li>
1.14 xtraeme 6353: <p><code class=
6354: "varname">BUILDLINK_DEPMETHOD.<em class=
6355: "replaceable"><code>pkg</code></em></code> (not
6356: shown above) controls whether we use <code class=
6357: "varname">BUILD_DEPENDS</code> or <code class=
6358: "varname">DEPENDS</code> to add the dependency on
6359: <em class="replaceable"><code>pkg</code></em>.
6360: The build dependency is selected by setting
6361: <code class=
6362: "varname">BUILDLINK_DEPMETHOD.<em class=
6363: "replaceable"><code>pkg</code></em></code> to
1.1 grant 6364: “<span class="quote">build</span>”.
6365: By default, the full dependency is used.</p>
6366: </li>
6367:
6368: <li>
1.14 xtraeme 6369: <p><code class=
6370: "varname">BUILDLINK_INCDIRS.<em class=
6371: "replaceable"><code>pkg</code></em></code> and
6372: <code class=
6373: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
6374: <code>pkg</code></em></code> (not shown above)
6375: are lists of subdirectories of <code class=
6376: "filename">${BUILDLINK_PREFIX.<em class=
6377: "replaceable"><code>pkg</code></em>}</code> to
6378: add to the header and library search paths. These
1.1 grant 6379: default to “<span class=
6380: "quote">include</span>” and
6381: “<span class="quote">lib</span>”
6382: respectively.</p>
6383: </li>
6384:
6385: <li>
1.14 xtraeme 6386: <p><code class=
6387: "varname">BUILDLINK_CPPFLAGS.<em class=
6388: "replaceable"><code>pkg</code></em></code> (not
6389: shown above) is the list of preprocessor flags to
6390: add to <code class="varname">CPPFLAGS</code>,
6391: which are passed on to the configure and build
6392: phases. The “<span class=
6393: "quote">-I</span>” option should be avoided
6394: and instead be handled using <code class=
6395: "varname">BUILDLINK_INCDIRS.<em class=
6396: "replaceable"><code>pkg</code></em></code> as
6397: above.</p>
1.1 grant 6398: </li>
6399: </ul>
6400: </div>
6401:
6402: <p>The following variables are all optionally defined
6403: within this second section (protected against multiple
6404: inclusion) and control which package files are
1.14 xtraeme 6405: symlinked into <code class=
6406: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 6407: are transformed during the symlinking:</p>
6408:
6409: <div class="itemizedlist">
6410: <ul type="disc">
6411: <li>
1.14 xtraeme 6412: <p><code class=
6413: "varname">BUILDLINK_FILES.<em class=
6414: "replaceable"><code>pkg</code></em></code> (not
6415: shown above) is a shell glob pattern relative to
6416: <code class=
6417: "filename">${BUILDLINK_PREFIX.<em class=
6418: "replaceable"><code>pkg</code></em>}</code> to be
6419: symlinked into <code class=
6420: "filename">${BUILDLINK_DIR}</code>, e.g.
6421: <code class="filename">include/*.h</code>.</p>
1.1 grant 6422: </li>
6423:
6424: <li>
1.14 xtraeme 6425: <p><code class=
6426: "varname">BUILDLINK_FILES_CMD.<em class=
6427: "replaceable"><code>pkg</code></em></code> (not
6428: shown above) is a shell pipeline that outputs to
6429: stdout a list of files relative to <code class=
6430: "filename">${BUILDLINK_PREFIX.<em class=
6431: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 6432: resulting files are to be symlinked into
1.14 xtraeme 6433: <code class="filename">${BUILDLINK_DIR}</code>.
6434: By default, this takes the <code class=
6435: "filename">+CONTENTS</code> of a <em class=
6436: "replaceable"><code>pkg</code></em> and filters
6437: it through <code class=
6438: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
6439: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 6440: </li>
6441:
6442: <li>
1.14 xtraeme 6443: <p><code class=
6444: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
6445: "replaceable"><code>pkg</code></em></code> (not
6446: shown above) is a filter command that filters
6447: <code class="filename">+CONTENTS</code> input
6448: into a list of files relative to <code class=
6449: "filename">${BUILDLINK_PREFIX.<em class=
6450: "replaceable"><code>pkg</code></em>}</code> on
6451: stdout. By default for overwrite packages,
6452: <code class=
6453: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
6454: "replaceable"><code>pkg</code></em></code>
6455: outputs the contents of the <code class=
6456: "filename">include</code> and <code class=
6457: "filename">lib</code> directories in the package
6458: <code class="filename">+CONTENTS</code>, and for
6459: pkgviews packages, it outputs any libtool
6460: archives in <code class="filename">lib</code>
1.1 grant 6461: directories.</p>
6462: </li>
6463:
6464: <li>
1.14 xtraeme 6465: <p><code class=
6466: "varname">BUILDLINK_TRANSFORM.<em class=
6467: "replaceable"><code>pkg</code></em></code> (not
6468: shown above) is a list of sed arguments used to
1.1 grant 6469: transform the name of the source filename into a
1.14 xtraeme 6470: destination filename, e.g. <span><strong class=
1.1 grant 6471: "command">-e
1.14 xtraeme 6472: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 6473: </li>
6474: </ul>
6475: </div>
6476:
1.14 xtraeme 6477: <p>The last section includes any <code class=
6478: "filename">buildlink3.mk</code> needed for <em class=
6479: "replaceable"><code>pkg</code></em>'s library
6480: dependencies. Including these <code class=
6481: "filename">buildlink3.mk</code> files means that the
6482: headers and libraries for these dependencies are also
6483: symlinked into <code class=
6484: "filename">${BUILDLINK_DIR}</code> whenever the
6485: <em class="replaceable"><code>pkg</code></em>
6486: <code class="filename">buildlink3.mk</code> file is
6487: included.</p>
1.1 grant 6488: </div>
6489:
6490: <div class="sect2" lang="en" xml:lang="en">
6491: <div class="titlepage">
6492: <div>
6493: <div>
1.21 ! ben 6494: <h3 class="title"><a name="id2591035" id=
! 6495: "id2591035"></a>9.2.2. Updating <code class=
1.14 xtraeme 6496: "varname">BUILDLINK_DEPENDS.<em class=
6497: "replaceable"><code>pkg</code></em></code> in
6498: <code class="filename">buildlink3.mk</code>
6499: files</h3>
1.1 grant 6500: </div>
6501: </div>
6502: </div>
6503:
6504: <p>There are two situations that require increasing the
1.14 xtraeme 6505: dependency listed in <code class=
6506: "varname">BUILDLINK_DEPENDS.<em class=
6507: "replaceable"><code>pkg</code></em></code> after a
6508: package update:</p>
1.1 grant 6509:
6510: <div class="orderedlist">
6511: <ol type="1">
6512: <li>
6513: <p>if the sonames (major number of the library
6514: version) of any installed shared libraries
6515: change;</p>
6516: </li>
6517:
6518: <li>
6519: <p>if the API or interface to the header files
6520: change.</p>
6521: </li>
6522: </ol>
6523: </div>
6524:
1.14 xtraeme 6525: <p>In these cases, <code class=
6526: "varname">BUILDLINK_DEPENDS.<em class=
6527: "replaceable"><code>pkg</code></em></code> should be
6528: adjusted to require at least the new package version.
6529: In some cases, the packages that depend on this new
6530: version may need their <code class=
6531: "varname">PKGREVISION</code>s increased and, if they
6532: have <code class="filename">buildlink3.mk</code> files,
6533: their <code class=
6534: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
6535: pkg</code></em></code> adjusted, too. This is needed so
6536: that binary packages made using it will require the
6537: correct package dependency and not settle for an older
6538: one which will not contain the necessary shared
6539: libraries.</p>
1.1 grant 6540:
6541: <p>Please take careful consideration before adjusting
1.14 xtraeme 6542: <code class="varname">BUILDLINK_DEPENDS.<em class=
6543: "replaceable"><code>pkg</code></em></code> as we don't
6544: want to cause unneeded package deletions and rebuilds.
6545: In many cases, new versions of packages work just fine
6546: with older dependencies. See <a href="#dependencies"
6547: title="12.1.3. Handling dependencies">Section
6548: 12.1.3, “Handling dependencies”</a> and
6549: <a href="#buildlink" title=
1.1 grant 6550: "Chapter 9. Buildlink methodology">Chapter 9,
6551: <i>Buildlink methodology</i></a> for more information
6552: about dependencies on other packages, including the
1.14 xtraeme 6553: <code class="varname">BUILDLINK_RECOMMENDED</code> and
6554: <code class="varname">RECOMMENDED</code>
6555: definitions.</p>
1.1 grant 6556: </div>
6557: </div>
6558:
6559: <div class="sect1" lang="en" xml:lang="en">
6560: <div class="titlepage">
6561: <div>
6562: <div>
6563: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 6564: "id2591182" id="id2591182"></a>9.3. Writing
1.14 xtraeme 6565: <code class="filename">builtin.mk</code> files</h2>
1.1 grant 6566: </div>
6567: </div>
6568: </div>
6569:
6570: <p>Some packages in pkgsrc install headers and libraries
6571: that coincide with headers and libraries present in the
1.14 xtraeme 6572: base system. Aside from a <code class=
6573: "filename">buildlink3.mk</code> file, these packages
6574: should also include a <code class=
6575: "filename">builtin.mk</code> file that includes the
6576: necessary checks to decide whether using the built-in
6577: software or the pkgsrc software is appropriate.</p>
1.1 grant 6578:
6579: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 6580: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 6581:
6582: <div class="orderedlist">
6583: <ol type="1">
6584: <li>
1.14 xtraeme 6585: <p>It should set <code class=
6586: "varname">USE_BUILTIN.<em class=
6587: "replaceable"><code>pkg</code></em></code> to
6588: either “<span class="quote">yes</span>”
6589: or “<span class="quote">no</span>”
6590: after it is included.</p>
1.1 grant 6591: </li>
6592:
6593: <li>
6594: <p>It should <span class=
6595: "emphasis"><em>not</em></span> override any
1.14 xtraeme 6596: <code class="varname">USE_BUILTIN.<em class=
6597: "replaceable"><code>pkg</code></em></code> which is
6598: already set before the <code class=
6599: "filename">builtin.mk</code> file is included.</p>
1.1 grant 6600: </li>
6601:
6602: <li>
6603: <p>It should be written to allow multiple
6604: inclusion. This is <span class=
6605: "emphasis"><em>very</em></span> important and takes
1.14 xtraeme 6606: careful attention to <code class=
6607: "filename">Makefile</code> coding.</p>
1.1 grant 6608: </li>
6609: </ol>
6610: </div>
6611:
6612: <div class="sect2" lang="en" xml:lang="en">
6613: <div class="titlepage">
6614: <div>
6615: <div>
1.21 ! ben 6616: <h3 class="title"><a name="id2591400" id=
! 6617: "id2591400"></a>9.3.1. Anatomy of a
1.14 xtraeme 6618: <code class="filename">builtin.mk</code>
6619: file</h3>
1.1 grant 6620: </div>
6621: </div>
6622: </div>
6623:
6624: <p>The following is the recommended template for
6625: builtin.mk files:</p>
6626: <pre class="programlisting">
6627: .if !defined(IS_BUILTIN.foo)
6628: #
6629: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
6630: # genuinely exists in the system or not.
6631: #
6632: IS_BUILTIN.foo?= no
6633:
6634: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
6635: # version can be determined.
6636: #
6637: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
6638: BUILTIN_PKG.foo?= foo-1.0
6639: . endif
6640: .endif # IS_BUILTIN.foo
6641:
6642: .if !defined(USE_BUILTIN.foo)
6643: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
6644: . if defined(BUILTIN_PKG.foo)
6645: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
6646: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
6647: USE_BUILTIN.foo!= \
6648: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
6649: ${ECHO} "yes"; \
6650: else \
6651: ${ECHO} "no"; \
6652: fi
6653: . endif
6654: . endfor
6655: . endif
6656: .endif # USE_BUILTIN.foo
6657:
6658: CHECK_BUILTIN.foo?= no
6659: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
6660: #
6661: # Here we place code that depends on whether USE_BUILTIN.foo is set to
6662: # "yes" or "no".
6663: #
6664: .endif # CHECK_BUILTIN.foo
6665:
6666: </pre>
6667:
1.14 xtraeme 6668: <p>The first section sets <code class=
6669: "varname">IS_BUILTIN.<em class=
6670: "replaceable"><code>pkg</code></em></code> depending on
6671: if <em class="replaceable"><code>pkg</code></em> really
6672: exists in the base system. This should not be a base
6673: system software with similar functionality to
6674: <em class="replaceable"><code>pkg</code></em>; it
6675: should only be “<span class=
6676: "quote">yes</span>” if the actual package is
6677: included as part of the base system. This variable is
6678: only used internally within the <code class=
6679: "filename">builtin.mk</code> file.</p>
6680:
6681: <p>The second section sets <code class=
6682: "varname">BUILTIN_PKG.<em class=
6683: "replaceable"><code>pkg</code></em></code> to the
6684: version of <em class=
6685: "replaceable"><code>pkg</code></em> in the base system
6686: if it exists (if <code class=
6687: "varname">IS_BUILTIN.<em class=
6688: "replaceable"><code>pkg</code></em></code> is
1.1 grant 6689: “<span class="quote">yes</span>”). This
1.14 xtraeme 6690: variable is only used internally within the
6691: <code class="filename">builtin.mk</code> file.</p>
1.1 grant 6692:
1.14 xtraeme 6693: <p>The third section sets <code class=
6694: "varname">USE_BUILTIN.<em class=
6695: "replaceable"><code>pkg</code></em></code> and is
6696: <span class="emphasis"><em>required</em></span> in all
6697: <code class="filename">builtin.mk</code> files. The
6698: code in this section must make the determination
6699: whether the built-in software is adequate to satisfy
6700: the dependencies listed in <code class=
6701: "varname">BUILDLINK_DEPENDS.<em class=
6702: "replaceable"><code>pkg</code></em></code>. This is
6703: typically done by comparing <code class=
6704: "varname">BUILTIN_PKG.<em class=
6705: "replaceable"><code>pkg</code></em></code> against each
6706: of the dependencies in <code class=
6707: "varname">BUILDLINK_DEPENDS.<em class=
6708: "replaceable"><code>pkg</code></em></code>.
6709: <code class="varname">USE_BUILTIN.<em class=
6710: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 6711: "emphasis"><em>must</em></span> be set to the correct
1.14 xtraeme 6712: value by the end of the <code class=
6713: "filename">builtin.mk</code> file. Note that
6714: <code class="varname">USE_BUILTIN.<em class=
6715: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 6716: “<span class="quote">yes</span>” even if
1.14 xtraeme 6717: <code class="varname">IS_BUILTIN.<em class=
6718: "replaceable"><code>pkg</code></em></code> is
1.1 grant 6719: “<span class="quote">no</span>” because we
6720: may make the determination that the built-in version of
6721: the software is similar enough to be used as a
6722: replacement.</p>
6723:
1.14 xtraeme 6724: <p>The last section is guarded by <code class=
6725: "varname">CHECK_BUILTIN.<em class=
6726: "replaceable"><code>pkg</code></em></code>, and
6727: includes code that uses the value of <code class=
6728: "varname">USE_BUILTIN.<em class=
6729: "replaceable"><code>pkg</code></em></code> set in the
6730: previous section. This typically includes, e.g., adding
1.1 grant 6731: additional dependency restrictions and listing
1.14 xtraeme 6732: additional files to symlink into <code class=
6733: "filename">${BUILDLINK_DIR}</code> (via <code class=
6734: "varname">BUILDLINK_FILES.<em class=
6735: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 6736: </div>
6737:
6738: <div class="sect2" lang="en" xml:lang="en">
6739: <div class="titlepage">
6740: <div>
6741: <div>
1.21 ! ben 6742: <h3 class="title"><a name="id2591627" id=
! 6743: "id2591627"></a>9.3.2. Global preferences
1.1 grant 6744: for native or pkgsrc software</h3>
6745: </div>
6746: </div>
6747: </div>
6748:
6749: <p>When building packages, it's possible to choose
6750: whether to set a global preference for using either the
6751: built-in (native) version or the pkgsrc version of
6752: software to satisfy a dependency. This is controlled by
1.14 xtraeme 6753: setting <code class="varname">PREFER_PKGSRC</code> and
6754: <code class="varname">PREFER_NATIVE</code>. These
6755: variables take values of either “<span class=
1.1 grant 6756: "quote">yes</span>”, “<span class=
6757: "quote">no</span>”, or a list of packages.
1.14 xtraeme 6758: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
6759: to use the pkgsrc versions of software, while
6760: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
6761: to use the built-in versions. Preferences are
6762: determined by the most specific instance of the package
6763: in either <code class="varname">PREFER_PKGSRC</code> or
6764: <code class="varname">PREFER_NATIVE</code>. If a
6765: package is specified in neither or in both variables,
6766: then <code class="varname">PREFER_PKGSRC</code> has
6767: precedence over <code class=
6768: "varname">PREFER_NATIVE</code>. For example, to require
6769: using pkgsrc versions of software for all but the most
6770: basic bits on a NetBSD system, you can set:</p>
1.1 grant 6771: <pre class="programlisting">
6772: PREFER_PKGSRC= yes
6773: PREFER_NATIVE= getopt skey tcp_wrappers
6774:
6775: </pre>
6776:
6777: <p>A package <span class=
1.14 xtraeme 6778: "emphasis"><em>must</em></span> have a <code class=
6779: "filename">builtin.mk</code> file to be listed in
6780: <code class="varname">PREFER_NATIVE</code>, otherwise
6781: it is simply ignored in that list.</p>
1.1 grant 6782: </div>
6783: </div>
6784: </div>
6785:
6786: <div class="chapter" lang="en" xml:lang="en">
6787: <div class="titlepage">
6788: <div>
6789: <div>
6790: <h2 class="title"><a name="options" id=
6791: "options"></a>Chapter 10. Options
6792: handling</h2>
6793: </div>
6794: </div>
6795: </div>
6796:
6797: <div class="toc">
6798: <p><b>Table of Contents</b></p>
6799:
6800: <dl>
1.21 ! ben 6801: <dt><span class="sect1"><a href="#id2591700">10.1.
1.1 grant 6802: Global default options</a></span></dt>
6803:
1.21 ! ben 6804: <dt><span class="sect1"><a href="#id2591715">10.2.
1.14 xtraeme 6805: Converting packages to use <code class=
6806: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 6807: </dl>
6808: </div>
6809:
6810: <p>Many packages have the ability to be built to support
1.14 xtraeme 6811: different sets of features. <code class=
6812: "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1 grant 6813: that provides generic handling of those options that
6814: determine different ways in which the packages can be
6815: built. It's possible for the user to specify exactly which
6816: sets of options will be built into a package or to allow a
6817: set of global default options apply.</p>
6818:
6819: <div class="sect1" lang="en" xml:lang="en">
6820: <div class="titlepage">
6821: <div>
6822: <div>
6823: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 6824: "id2591700" id="id2591700"></a>10.1. Global
1.1 grant 6825: default options</h2>
6826: </div>
6827: </div>
6828: </div>
6829:
1.14 xtraeme 6830: <p>Global default options are listed in <code class=
6831: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1 grant 6832: the options that should be built into every package if
6833: that option is supported. This variable should be set in
1.14 xtraeme 6834: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 6835: </div>
6836:
6837: <div class="sect1" lang="en" xml:lang="en">
6838: <div class="titlepage">
6839: <div>
6840: <div>
6841: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 6842: "id2591715" id=
! 6843: "id2591715"></a>10.2. Converting packages to
1.14 xtraeme 6844: use <code class=
6845: "filename">bsd.options.mk</code></h2>
1.1 grant 6846: </div>
6847: </div>
6848: </div>
6849:
1.14 xtraeme 6850: <p>The following example shows how <code class=
6851: "filename">bsd.options.mk</code> should be use in a
6852: package <code class="filename">Makefile</code>, or in a
6853: file, e.g. <code class="filename">options.mk</code>, that
6854: is included by the main package <code class=
6855: "filename">Makefile</code>.</p>
1.1 grant 6856: <pre class="programlisting">
6857: # Global and legacy options
6858: .if defined(WIBBLE_USE_OPENLDAP) && !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
6859: PKG_DEFAULT_OPTIONS+= ldap
6860: .endif
6861: .if defined(USE_SASL2) && !empty(USE_SASL2:M[yY][eE][sS])
6862: PKG_DEFAULT_OPTIONS+= sasl
6863: .endif
6864:
6865: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
6866: PKG_SUPPORTED_OPTIONS= ldap sasl
6867: #
6868: # Default options for "wibble" package.
6869: #
6870: .if !defined(PKG_OPTIONS.wibble)
6871: PKG_DEFAULT_OPTIONS+= sasl
6872: endif
6873: .include "../../mk/bsd.options.mk"
6874:
6875: # Package-specific option-handling
6876:
6877: ###
6878: ### LDAP support
6879: ###
6880: .if !empty(PKG_OPTIONS:Mldap)
6881: . include "../../databases/openldap/buildlink3.mk"
6882: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
6883: .endif
6884:
6885: ###
6886: ### SASL authentication
6887: ###
6888: .if !empty(PKG_OPTIONS:Msasl)
6889: . include "../../security/cyrus-sasl2/buildlink3.mk"
6890: CONFIGURE_ARGS+= --enable-sasl=${BUILDLINK_PREFIX.sasl}
6891: .endif
6892:
6893: </pre>
6894:
6895: <p>The first section only exists if you are converting a
6896: package that had its own ad-hoc options handling to use
1.14 xtraeme 6897: <code class="filename">bsd.options.mk</code>. It converts
1.1 grant 6898: global or legacy options variables into an equivalent
1.14 xtraeme 6899: <code class="varname">PKG_OPTIONS.<em class=
6900: "replaceable"><code>pkg</code></em></code> value. These
6901: sections will be removed over time as the old options are
6902: in turn deprecated and removed.</p>
1.1 grant 6903:
6904: <p>The second section contains the information about
6905: which build options are supported by the package, and any
6906: default options settings if needed.</p>
6907:
6908: <div class="orderedlist">
6909: <ol type="1">
6910: <li>
1.14 xtraeme 6911: <p><code class="varname">PKG_OPTIONS_VAR</code> is
6912: a list of the name of the <a href=
1.1 grant 6913: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6914: <span class="citerefentry"><span class=
6915: "refentrytitle">make</span>(1)</span></a> variables
6916: that contain the options the user wishes to select.
6917: The recommended value is “<span class=
1.14 xtraeme 6918: "quote">PKG_OPTIONS.<em class=
6919: "replaceable"><code>pkg</code></em></span>”
6920: but any package-specific value may be used. This
1.1 grant 6921: variable should be set in a package Makefile.</p>
6922: </li>
6923:
6924: <li>
1.14 xtraeme 6925: <p><code class=
6926: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
6927: build options supported by the package. This
6928: variable should be set in a package Makefile.</p>
1.1 grant 6929: </li>
6930:
6931: <li>
1.14 xtraeme 6932: <p><code class="varname">${PKG_OPTIONS_VAR}</code>
6933: (the variables named in <code class=
6934: "varname">PKG_OPTIONS_VAR</code>) are variables
6935: that list the selected build options and override
6936: any default options given in <code class=
6937: "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1 grant 6938: options begin with a “<span class=
6939: "quote">-</span>”, then that option is always
6940: removed from the selected build options, e.g.</p>
6941: <pre class="programlisting">
6942: PKG_DEFAULT_OPTIONS= kerberos ldap sasl
6943: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
6944: WIBBLE_OPTIONS= ${PKG_DEFAULT_OPTIONS} -sasl
6945: # implies PKG_OPTIONS == "kerberos ldap"
6946:
6947: </pre>
6948:
6949: <p>or</p>
6950: <pre class="programlisting">
6951: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
6952: WIBBLE_OPTIONS= kerberos -ldap ldap
6953: # implies PKG_OPTIONS == "kerberos"
6954:
6955: </pre>
6956:
1.14 xtraeme 6957: <p>This variable should be set in <code class=
6958: "filename">/etc/mk.conf</code>.</p>
1.1 grant 6959: </li>
6960: </ol>
6961: </div>
6962:
6963: <p>After the inclusion of bsd.options.mk, the following
6964: variables are set:</p>
6965:
6966: <div class="itemizedlist">
6967: <ul type="disc">
6968: <li>
1.14 xtraeme 6969: <p><code class="varname">PKG_OPTIONS</code>
6970: contains the list of the selected build options,
6971: properly filtered to remove unsupported and
6972: duplicate options.</p>
1.1 grant 6973: </li>
6974: </ul>
6975: </div>
6976:
6977: <p>The remaining sections contain the logic that is
6978: specific to each option. There should be a check for
1.14 xtraeme 6979: every option listed in <code class=
6980: "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
6981: be clear documentation on what turning on the option will
6982: do in the comments preceding each section. The correct
6983: way to check for an option is to check whether it is
6984: listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1 grant 6985: </div>
6986: </div>
6987:
6988: <div class="chapter" lang="en" xml:lang="en">
6989: <div class="titlepage">
6990: <div>
6991: <div>
6992: <h2 class="title"><a name="build" id=
6993: "build"></a>Chapter 11. The build
6994: process</h2>
6995: </div>
6996: </div>
6997: </div>
6998:
6999: <div class="toc">
7000: <p><b>Table of Contents</b></p>
7001:
7002: <dl>
7003: <dt><span class="sect1"><a href="#build.prefix">11.1.
7004: Program location</a></span></dt>
7005:
1.21 ! ben 7006: <dt><span class="sect1"><a href="#id2592323">11.2. Main
1.1 grant 7007: targets</a></span></dt>
7008:
7009: <dt><span class="sect1"><a href=
7010: "#build.helpful-targets">11.3. Other helpful
7011: targets</a></span></dt>
7012: </dl>
7013: </div>
7014:
7015: <p>The basic steps for building a program are always the
7016: same. First the program's source (<span class=
7017: "emphasis"><em>distfile</em></span>) must be brought to the
7018: local system and then extracted. After any patches to
7019: compile properly on NetBSD are applied, the software can be
7020: configured, then built (usually by compiling), and finally
7021: the generated binaries, etc. can be put into place on the
7022: system. These are exactly the steps performed by the NetBSD
7023: package system, which is implemented as a series of targets
1.14 xtraeme 7024: in a central Makefile, <code class=
7025: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 7026:
7027: <div class="sect1" lang="en" xml:lang="en">
7028: <div class="titlepage">
7029: <div>
7030: <div>
7031: <h2 class="title" style="clear: both"><a name=
7032: "build.prefix" id=
7033: "build.prefix"></a>11.1. Program location</h2>
7034: </div>
7035: </div>
7036: </div>
7037:
7038: <p>Before outlining the process performed by the NetBSD
7039: package system in the next section, here's a brief
7040: discussion on where programs are installed, and which
7041: variables influence this.</p>
7042:
1.14 xtraeme 7043: <p>The automatic variable <code class=
7044: "varname">PREFIX</code> indicates where all files of the
7045: final program shall be installed. It is usually set to
7046: <code class="varname">LOCALBASE</code> (<code class=
7047: "filename">/usr/pkg</code>), or <code class=
7048: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 7049: “<span class="quote">cross</span>” category.
1.14 xtraeme 7050: The value of <code class="varname">PREFIX</code> needs to
7051: be put into the various places in the program's source
7052: where paths to these files are encoded. See <a href=
1.1 grant 7053: "#components.patches" title=
7054: "7.3. patches/*">Section 7.3,
7055: “patches/*”</a> and <a href="#fixes.libtool"
7056: title=
7057: "12.3.1. Shared libraries - libtool">Section 12.3.1,
7058: “Shared libraries - libtool”</a> for more
7059: details.</p>
7060:
7061: <p>When choosing which of these variables to use, follow
7062: the following rules:</p>
7063:
7064: <div class="itemizedlist">
7065: <ul type="disc">
7066: <li>
1.14 xtraeme 7067: <p><code class="varname">PREFIX</code> always
7068: points to the location where the current pkg will
7069: be installed. When referring to a pkg's own
1.1 grant 7070: installation path, use “<span class=
7071: "quote">${PREFIX}</span>”.</p>
7072: </li>
7073:
7074: <li>
1.14 xtraeme 7075: <p><code class="varname">LOCALBASE</code> is where
7076: all non-X11 pkgs are installed. If you need to
1.1 grant 7077: construct a -I or -L argument to the compiler to
7078: find includes and libraries installed by another
7079: non-X11 pkg, use “<span class=
7080: "quote">${LOCALBASE}</span>”.</p>
7081: </li>
7082:
7083: <li>
1.14 xtraeme 7084: <p><code class="varname">X11BASE</code> is where
7085: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 7086: installed. When looking for <span class=
7087: "emphasis"><em>standard</em></span> X11 includes
7088: (not those installed by a pkg), use
7089: “<span class=
7090: "quote">${X11BASE}</span>”.</p>
7091: </li>
7092:
7093: <li>
7094: <p>X11 based are special in that they may be
1.14 xtraeme 7095: installed in either <code class=
7096: "varname">X11BASE</code> or <code class=
7097: "varname">LOCALBASE</code>.</p>
1.1 grant 7098:
7099: <p>Usually, X11 packages should be installed under
1.14 xtraeme 7100: <code class="varname">LOCALBASE</code> whenever
7101: possible. Note that you will need to set
7102: <code class="varname">USE_X11</code> in them to
7103: request the presence of X11 and to get the right
7104: compilation flags.</p>
1.1 grant 7105:
7106: <p>Even though, there are some packages that cannot
1.14 xtraeme 7107: be installed under <code class=
7108: "varname">LOCALBASE</code>: those that come with
1.1 grant 7109: app-defaults files. These packages are special and
1.14 xtraeme 7110: they must be placed under <code class=
7111: "varname">X11BASE</code>. To accomplish this, set
7112: either <code class="varname">USE_X11BASE</code> or
7113: <code class="varname">USE_IMAKE</code> in your
1.1 grant 7114: package.</p>
7115:
1.14 xtraeme 7116: <p>Some notes: <code class="varname">USE_X11</code>
7117: and <code class="varname">USE_X11BASE</code> are
7118: mutually exclusive. If you need to find includes or
7119: libraries installed by a pkg that has <code class=
7120: "varname">USE_IMAKE</code> or <code class=
7121: "varname">USE_X11BASE</code> in its pkg
7122: <code class="filename">Makefile</code>, you need to
7123: use <span class="emphasis"><em>both</em></span>
7124: <code class="filename">${X11BASE}</code> and
7125: <code class="filename">${LOCALBASE}</code>. To
7126: force installation of all X11 packages in
7127: <code class="varname">LOCALBASE</code>, the
7128: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
7129: href=
1.1 grant 7130: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20 ben 7131: class="pkgname">pkgtools/xpkgwedge</a> is enabled
7132: by default.</p>
1.1 grant 7133: </li>
7134:
7135: <li>
1.14 xtraeme 7136: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 7137: used to refer to the installed location of an X11
1.14 xtraeme 7138: package. <code class="varname">X11PREFIX</code>
7139: will be set to <code class="varname">X11BASE</code>
7140: if xpkgwedge is not installed, and to <code class=
7141: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 7142: installed.</p>
7143: </li>
7144:
7145: <li>
7146: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 7147: have some packages installed in <code class=
7148: "varname">X11BASE</code> and some in <code class=
7149: "varname">LOCALBASE</code>. To determine the prefix
7150: of an installed package, the <code class=
7151: "varname">EVAL_PREFIX</code> definition can be
7152: used. It takes pairs in the format
7153: “<span class=
1.1 grant 7154: "quote">DIRNAME=<package></span>”, and
1.14 xtraeme 7155: the make(1) variable <code class=
7156: "varname">DIRNAME</code> will be set to the prefix
7157: of the installed package <package>, or
1.1 grant 7158: “<span class=
7159: "quote">${X11PREFIX}</span>” if the package
7160: is not installed.</p>
7161:
7162: <p>This is best illustrated by example.</p>
7163:
1.14 xtraeme 7164: <p>The following lines are taken from <code class=
7165: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 7166: <pre class="programlisting">
1.14 xtraeme 7167: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 7168: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
7169: --with-gtk-prefix="${GTKDIR}" \
7170: --enable-multibyte
7171: </pre>
7172:
7173: <p>Specific defaults can be defined for the
1.14 xtraeme 7174: packages evaluated using <code class=
7175: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 7176: of the form:</p>
7177: <pre class="programlisting">
7178: GTKDIR_DEFAULT= ${LOCALBASE}
7179: </pre>
7180:
1.14 xtraeme 7181: <p>where <code class="varname">GTKDIR</code>
1.1 grant 7182: corresponds to the first definition in the
1.14 xtraeme 7183: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 7184: </li>
7185:
7186: <li>
1.14 xtraeme 7187: <p>Within <code class="filename">${PREFIX}</code>,
1.1 grant 7188: packages should install files according to hier(7),
7189: with the exception that manual pages go into
1.14 xtraeme 7190: <code class="filename">${PREFIX}/man</code>, not
7191: <code class=
7192: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 7193: </li>
7194: </ul>
7195: </div>
7196: </div>
7197:
7198: <div class="sect1" lang="en" xml:lang="en">
7199: <div class="titlepage">
7200: <div>
7201: <div>
7202: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 7203: "id2592323" id="id2592323"></a>11.2. Main
1.1 grant 7204: targets</h2>
7205: </div>
7206: </div>
7207: </div>
7208:
7209: <p>The main targets used during the build process defined
1.14 xtraeme 7210: in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 7211:
7212: <div class="variablelist">
7213: <dl>
7214: <dt><span class="term">fetch</span></dt>
7215:
7216: <dd>
7217: <p>This will check if the file(s) given in the
1.14 xtraeme 7218: variables <code class="varname">DISTFILES</code>
7219: and <code class="varname">PATCHFILES</code> (as
7220: defined in the package's Makefile) are present on
7221: the local system in <code class=
7222: "filename">/usr/pkgsrc/distfiles</code>. If they
7223: are not present, an attempt will be made to fetch
7224: them using commands of the form:</p>
1.1 grant 7225: <pre class="programlisting">
7226: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
7227: </pre>
7228:
7229: <p>where ${site} varies through several
1.14 xtraeme 7230: possibilities in turn: first, <code class=
7231: "varname">MASTER_SITE_OVERRIDE</code> is tried,
7232: then the sites specified in either <code class=
7233: "varname">SITES_file</code> if defined, else
7234: <code class="varname">MASTER_SITES</code> or
7235: <code class="varname">PATCH_SITES</code>, as
7236: applies, then finally the value of <code class=
7237: "varname">MASTER_SITE_BACKUP</code>. The order of
7238: all except the first can be optionally sorted by
7239: the user, via setting either <code class=
7240: "varname">MASTER_SORT_AWK</code> or <code class=
7241: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 7242: </dd>
7243:
7244: <dt><span class="term">checksum</span></dt>
7245:
7246: <dd>
7247: <p>After the distfile(s) are fetched, their
7248: checksum is generated and compared with the
7249: checksums stored in the distinfo file. If the
7250: checksums don't match, the build is aborted. This
7251: is to ensure the same distfile is used for
7252: building, and that the distfile wasn't changed,
7253: e.g. by some malign force, deliberately changed
7254: distfiles on the master distribution site or
7255: network lossage.</p>
7256: </dd>
7257:
7258: <dt><span class="term">extract</span></dt>
7259:
7260: <dd>
7261: <p>When the distfiles are present on the local
7262: system, they need to be extracted, as they are
7263: usually in the form of some compressed archive
1.14 xtraeme 7264: format, most commonly <code class=
7265: "filename">.tar.gz</code>.</p>
1.1 grant 7266:
7267: <p>If only some of the distfiles need to be
7268: uncompressed, the files to be uncompressed should
1.14 xtraeme 7269: be put into <code class=
7270: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 7271:
1.14 xtraeme 7272: <p>If the distfiles are not in <code class=
7273: "filename">.tar.gz</code> format, they can be
7274: extracted by setting either <code class=
7275: "varname">EXTRACT_SUFX</code>, or <code class=
7276: "varname">EXTRACT_CMD</code>, <code class=
7277: "varname">EXTRACT_BEFORE_ARGS</code> and
7278: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
7279: the former case, pkgsrc knows how to extract a
7280: number of suffixes (<code class=
7281: "filename">.tar.gz</code>, <code class=
7282: "filename">.tgz</code>, <code class=
7283: "filename">.tar.gz2</code>, <code class=
7284: "filename">.tbz</code>, <code class=
7285: "filename">.tar.Z</code>, <code class=
7286: "filename">.tar</code>, <code class=
7287: "filename">.shar.gz</code>, <code class=
7288: "filename">.shar.bz2</code>, <code class=
7289: "filename">.shar.Z</code>, <code class=
7290: "filename">.shar</code>, <code class=
7291: "filename">.Z</code>, <code class=
7292: "filename">.bz2</code> and <code class=
7293: "filename">.gz</code>; see the definition of the
7294: various <code class="varname">DECOMPRESS_CMD</code>
7295: variables <code class="filename">bsd.pkg.mk</code>
7296: for a complete list). Here's an example on how to
7297: use the other variables for a program that comes
7298: with a compressed shell archive whose name ends in
7299: <code class="filename">.msg.gz</code>:</p>
1.1 grant 7300: <pre class="programlisting">
7301: EXTRACT_SUFX= .msg.gz
7302: EXTRACT_CMD= zcat
7303: EXTRACT_BEFORE_ARGS=
7304: EXTRACT_AFTER_ARGS= |sh
7305: </pre>
7306: </dd>
7307:
7308: <dt><span class="term">patch</span></dt>
7309:
7310: <dd>
7311: <p>After extraction, all the patches named by the
1.14 xtraeme 7312: <code class="varname">PATCHFILES</code>, those
7313: present in the patches subdirectory of the package
7314: as well as in $LOCALPATCHES/$PKGPATH (e.g.
7315: <code class=
7316: "filename">/usr/local/patches/graphics/png</code>)
7317: are applied. Patchfiles ending in <code class=
7318: "filename">.Z</code> or <code class=
7319: "filename">.gz</code> are uncompressed before they
7320: are applied, files ending in <code class=
7321: "filename">.orig</code> or <code class=
7322: "filename">.rej</code> are ignored. Any special
7323: options to patch(1) can be handed in <code class=
7324: "varname">PATCH_DIST_ARGS</code>. See <a href=
7325: "#components.patches" title=
1.1 grant 7326: "7.3. patches/*">Section 7.3,
7327: “patches/*”</a> for more details.</p>
7328:
7329: <p>By default patch(1) is given special args to
7330: make it fail if the patches apply with some lines
7331: of fuzz. Please fix (regen) the patches so that
7332: they apply cleanly. The rationale behind this is
7333: that patches that don't apply cleanly may end up
7334: being applied in the wrong place, and cause severe
7335: harm there.</p>
7336: </dd>
7337:
7338: <dt><span class="term">configure</span></dt>
7339:
7340: <dd>
7341: <p>Most pieces of software need information on the
7342: header files, system calls, and library routines
7343: which are available in NetBSD. This is the process
7344: known as configuration, and is usually automated.
7345: In most cases, a script is supplied with the
7346: source, and its invocation results in generation of
7347: header files, Makefiles, etc.</p>
7348:
7349: <p>If the program's distfile contains its own
7350: configure script, this can be invoked by setting
1.14 xtraeme 7351: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 7352: configure script is a GNU autoconf script,
1.14 xtraeme 7353: <code class="varname">GNU_CONFIGURE</code> should
7354: be specified instead. In either case, any arguments
7355: to the configure script can be specified in the
7356: <code class="varname">CONFIGURE_ARGS</code>
7357: variable, and the configure script's name can be
7358: set in <code class=
7359: "varname">CONFIGURE_SCRIPT</code> if it differs
7360: from the default “<span class=
1.1 grant 7361: "quote">configure</span>”. Here's an example
7362: from the <a xmlns=
7363: "http://www.w3.org/TR/xhtml1/transitional" href=
7364: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20 ben 7365: class="pkgname">sysutils/top</a> package:</p>
1.1 grant 7366: <pre class="programlisting">
7367: HAS_CONFIGURE= yes
7368: CONFIGURE_SCRIPT= Configure
7369: CONFIGURE_ARGS+= netbsd13
7370: </pre>
7371:
7372: <p>If the program uses an Imakefile for
7373: configuration, the appropriate steps can be invoked
1.14 xtraeme 7374: by setting <code class="varname">USE_IMAKE</code>
7375: to “<span class="quote">YES</span>”.
7376: (If you only want the package installed in
7377: <code class="varname">$X11PREFIX</code> but xmkmf
7378: not being run, set <code class=
7379: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 7380: </dd>
7381:
7382: <dt><span class="term">build</span></dt>
7383:
7384: <dd>
7385: <p>Once configuration has taken place, the software
1.14 xtraeme 7386: will be built by invoking <code class=
7387: "varname">$MAKE_PROGRAM</code> on <code class=
7388: "varname">$MAKEFILE</code> with <code class=
7389: "varname">$BUILD_TARGET</code> as the target to
7390: build. The default <code class=
7391: "varname">MAKE_PROGRAM</code> is
7392: “<span class="quote">gmake</span>” if
7393: <code class="varname">USE_GNU_TOOLS</code> contains
1.7 wiz 7394: “<span class="quote">make</span>”,
1.1 grant 7395: “<span class="quote">make</span>”
1.14 xtraeme 7396: otherwise. <code class="varname">MAKEFILE</code> is
7397: set to “<span class=
1.1 grant 7398: "quote">Makefile</span>” by default, and
1.14 xtraeme 7399: <code class="varname">BUILD_TARGET</code> defaults
7400: to “<span class="quote">all</span>”.
7401: Any of these variables can be set in the package's
1.1 grant 7402: Makefile to change the default build process.</p>
7403: </dd>
7404:
7405: <dt><span class="term">install</span></dt>
7406:
7407: <dd>
7408: <p>Once the build stage has completed, the final
7409: step is to install the software in public
7410: directories, so users can access the programs and
1.14 xtraeme 7411: files. As in the build-target, <code class=
7412: "varname">$MAKE_PROGRAM</code> is invoked on
7413: <code class="varname">$MAKEFILE</code> here, but
7414: with the <code class=
7415: "varname">$INSTALL_TARGET</code> instead, the
7416: latter defaulting to “<span class=
7417: "quote">install</span>” (plus
7418: “<span class=
7419: "quote">install.man</span>”, if <code class=
7420: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 7421: </dd>
7422: </dl>
7423: </div>
7424:
7425: <p>If no target is specified, the default is
7426: “<span class="quote">build</span>”. If a
7427: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 7428: e.g. <span><strong class="command">make
7429: build</strong></span> will also perform the equivalent
7430: of:</p>
1.1 grant 7431: <pre class="programlisting">
7432: make fetch
7433: make checksum
7434: make extract
7435: make patch
7436: make configure
7437: make build
7438: </pre>
7439: </div>
7440:
7441: <div class="sect1" lang="en" xml:lang="en">
7442: <div class="titlepage">
7443: <div>
7444: <div>
7445: <h2 class="title" style="clear: both"><a name=
7446: "build.helpful-targets" id=
7447: "build.helpful-targets"></a>11.3. Other
7448: helpful targets</h2>
7449: </div>
7450: </div>
7451: </div>
7452:
7453: <div class="variablelist">
7454: <dl>
7455: <dt><span class="term">pre/post-*</span></dt>
7456:
7457: <dd>
7458: <p>For any of the main targets described in the
7459: previous section, two auxiliary targets exist with
7460: “<span class="quote">pre-</span>” and
7461: “<span class="quote">post-</span>” used
7462: as a prefix for the main target's name. These
7463: targets are invoked before and after the main
7464: target is called, allowing extra configuration or
7465: installation steps be performed from a package's
7466: Makefile, for example, which a program's configure
7467: script or install target omitted.</p>
7468: </dd>
7469:
7470: <dt><span class="term">do-*</span></dt>
7471:
7472: <dd>
7473: <p>Should one of the main targets do the wrong
7474: thing, and should there be no variable to fix this,
7475: you can redefine it with the do-* target. (Note
7476: that redefining the target itself instead of the
7477: do-* target is a bad idea, as the pre-* and post-*
7478: targets won't be called anymore, etc.) You will not
7479: usually need to do this.</p>
7480: </dd>
7481:
7482: <dt><span class="term">reinstall</span></dt>
7483:
7484: <dd>
1.14 xtraeme 7485: <p>If you did a <span><strong class="command">make
7486: install</strong></span> and you noticed some file
7487: was not installed properly, you can repeat the
1.1 grant 7488: installation with this target, which will ignore
7489: the “<span class="quote">already
7490: installed</span>” flag.</p>
7491: </dd>
7492:
7493: <dt><span class="term">deinstall</span></dt>
7494:
7495: <dd>
7496: <p>This target does a pkg_delete(1) in the current
7497: directory, effectively de-installing the package.
7498: The following variables can be used to tune the
7499: behaviour:</p>
7500:
7501: <div class="variablelist">
7502: <dl>
1.14 xtraeme 7503: <dt><span class="term"><code class=
7504: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 7505:
7506: <dd>
7507: <p>Add a "-v" to the <a href=
7508: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7509: <span class="citerefentry"><span class=
7510: "refentrytitle">pkg_delete</span>(1)</span></a>
7511: command.</p>
7512: </dd>
7513:
1.14 xtraeme 7514: <dt><span class="term"><code class=
7515: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 7516:
7517: <dd>
7518: <p>Remove all packages that require (depend
7519: on) the given package. This can be used to
7520: remove any packages that may have been pulled
7521: in by a given package, e.g. if
1.14 xtraeme 7522: <span><strong class="command">make deinstall
7523: DEINSTALLDEPENDS=1</strong></span> is done in
7524: <code class="filename">pkgsrc/x11/kde</code>,
1.1 grant 7525: this is likely to remove whole KDE. Works by
7526: adding “<span class=
7527: "quote">-R</span>” to the <a href=
7528: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7529: <span class="citerefentry"><span class=
7530: "refentrytitle">pkg_delete</span>(1)</span></a>
7531: command line.</p>
7532: </dd>
7533: </dl>
7534: </div>
7535: </dd>
7536:
7537: <dt><span class="term">update</span></dt>
7538:
7539: <dd>
7540: <p>This target causes the current package to be
7541: updated to the latest version. The package and all
7542: depending packages first get de-installed, then
7543: current versions of the corresponding packages get
7544: compiled and installed. This is similar to manually
7545: noting which packages are currently installed, then
1.14 xtraeme 7546: performing a series of <span><strong class=
7547: "command">make deinstall</strong></span> and
7548: <span><strong class="command">make
7549: install</strong></span> (or whatever <code class=
7550: "varname">UPDATE_TARGET</code> is set to) for these
7551: packages.</p>
1.1 grant 7552:
7553: <p>You can use the “<span class=
7554: "quote">update</span>” target to resume
1.14 xtraeme 7555: package updating in case a previous
7556: <span><strong class="command">make
7557: update</strong></span> was interrupted for some
7558: reason. However, in this case, make sure you don't
7559: call <span><strong class="command">make
7560: clean</strong></span> or otherwise remove the list
7561: of dependent packages in <code class=
7562: "varname">WRKDIR</code>. Otherwise you lose the
1.1 grant 7563: ability to automatically update the current package
7564: along with the dependent packages you have
7565: installed.</p>
7566:
1.14 xtraeme 7567: <p>Resuming an interrupted <span><strong class=
7568: "command">make update</strong></span> will only
7569: work as long as the package tree remains unchanged.
7570: If the source code for one of the packages to be
7571: updated has been changed, resuming
7572: <span><strong class="command">make
7573: update</strong></span> will most certainly
7574: fail!</p>
1.1 grant 7575:
7576: <p>The following variables can be used either on
1.14 xtraeme 7577: the command line or in <code class=
7578: "filename">/etc/mk.conf</code> to alter the
7579: behaviour of <span><strong class="command">make
7580: update</strong></span>:</p>
1.1 grant 7581:
7582: <div class="variablelist">
7583: <dl>
1.14 xtraeme 7584: <dt><span class="term"><code class=
7585: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 7586:
7587: <dd>
7588: <p>Install target to recursively use for the
7589: updated package and the dependent packages.
1.14 xtraeme 7590: Defaults to <code class=
7591: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 7592: “<span class=
7593: "quote">install</span>” otherwise for
1.14 xtraeme 7594: <span><strong class="command">make
7595: update</strong></span>. e.g.
7596: <span><strong class="command">make update
7597: UPDATE_TARGET=package</strong></span></p>
1.1 grant 7598: </dd>
7599:
1.14 xtraeme 7600: <dt><span class="term"><code class=
7601: "varname">NOCLEAN</code></span></dt>
1.1 grant 7602:
7603: <dd>
7604: <p>Don't clean up after updating. Useful if
7605: you want to leave the work sources of the
7606: updated packages around for inspection or
7607: other purposes. Be sure you eventually clean
7608: up the source tree (see the
7609: “<span class=
7610: "quote">clean-update</span>” target
7611: below) or you may run into troubles with old
7612: source code still lying around on your next
1.14 xtraeme 7613: <span><strong class=
7614: "command">make</strong></span> or
7615: <span><strong class="command">make
7616: update</strong></span>.</p>
1.1 grant 7617: </dd>
7618:
1.14 xtraeme 7619: <dt><span class="term"><code class=
7620: "varname">REINSTALL</code></span></dt>
1.1 grant 7621:
7622: <dd>
7623: <p>Deinstall each package before installing
1.14 xtraeme 7624: (making <code class=
7625: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 7626: necessary if the “<span class=
7627: "quote">clean-update</span>” target
7628: (see below) was called after interrupting a
1.14 xtraeme 7629: running <span><strong class="command">make
7630: update</strong></span>.</p>
1.1 grant 7631: </dd>
7632:
1.14 xtraeme 7633: <dt><span class="term"><code class=
7634: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 7635:
7636: <dd>
7637: <p>Allows you to disable recursion and
7638: hardcode the target for packages. The default
7639: is “<span class=
7640: "quote">update</span>” for the update
7641: target, facilitating a recursive update of
1.14 xtraeme 7642: prerequisite packages. Only set <code class=
7643: "varname">DEPENDS_TARGET</code> if you want
7644: to disable recursive updates. Use
7645: <code class="varname">UPDATE_TARGET</code>
7646: instead to just set a specific target for
7647: each package to be installed during
7648: <span><strong class="command">make
7649: update</strong></span> (see above).</p>
1.1 grant 7650: </dd>
7651: </dl>
7652: </div>
7653: </dd>
7654:
7655: <dt><span class="term">clean-update</span></dt>
7656:
7657: <dd>
7658: <p>Clean the source tree for all packages that
1.14 xtraeme 7659: would get updated if <span><strong class=
7660: "command">make update</strong></span> was called
7661: from the current directory. This target should not
7662: be used if the current package (or any of its
7663: depending packages) have already been de-installed
7664: (e.g., after calling <span><strong class=
7665: "command">make update</strong></span>) or you may
7666: lose some packages you intended to update. As a
7667: rule of thumb: only use this target <span class=
7668: "emphasis"><em>before</em></span> the first time
7669: you run <span><strong class="command">make
7670: update</strong></span> and only if you have a dirty
7671: package tree (e.g., if you used <code class=
7672: "varname">NOCLEAN</code>).</p>
1.1 grant 7673:
7674: <p>If you unsure about whether your tree is clean
1.14 xtraeme 7675: you can either perform a <span><strong class=
7676: "command">make clean</strong></span> at the top of
7677: the tree, or use the following sequence of commands
1.1 grant 7678: from the directory of the package you want to
7679: update (<span class=
7680: "emphasis"><em>before</em></span> running
1.14 xtraeme 7681: <span><strong class="command">make
7682: update</strong></span> for the first time,
7683: otherwise you lose all the packages you wanted to
7684: update!):</p>
1.1 grant 7685: <pre class="screen">
1.14 xtraeme 7686: <code class="prompt">#</code> <strong class=
7687: "userinput"><code>make clean-update</code></strong>
7688: <code class="prompt">#</code> <strong class=
7689: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
7690: <code class="prompt">#</code> <strong class=
7691: "userinput"><code>make update</code></strong>
1.1 grant 7692: </pre>
7693:
7694: <p>The following variables can be used either on
1.14 xtraeme 7695: the command line or in <code class=
7696: "filename">/etc/mk.conf</code> to alter the
7697: behaviour of <span><strong class="command">make
7698: clean-update</strong></span>:</p>
1.1 grant 7699:
7700: <div class="variablelist">
7701: <dl>
1.14 xtraeme 7702: <dt><span class="term"><code class=
7703: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 7704:
7705: <dd>
1.14 xtraeme 7706: <p>After <span><strong class="command">make
7707: clean</strong></span>, do not reconstruct the
7708: list of directories to update for this
7709: package. Only use this if
7710: <span><strong class="command">make
7711: update</strong></span> successfully installed
7712: all packages you wanted to update. Normally,
7713: this is done automatically on
7714: <span><strong class="command">make
7715: update</strong></span>, but may have been
7716: suppressed by the <code class=
7717: "varname">NOCLEAN</code> variable (see
1.1 grant 7718: above).</p>
7719: </dd>
7720: </dl>
7721: </div>
7722: </dd>
7723:
7724: <dt><span class="term">info</span></dt>
7725:
7726: <dd>
7727: <p>This target invokes <a href=
7728: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
7729: <span class="citerefentry"><span class=
7730: "refentrytitle">pkg_info</span>(1)</span></a> for
7731: the current package. You can use this to check
7732: which version of a package is installed.</p>
7733: </dd>
7734:
7735: <dt><span class="term">readme</span></dt>
7736:
7737: <dd>
1.14 xtraeme 7738: <p>This target generates a <code class=
7739: "filename">README.html</code> file, which can be
1.1 grant 7740: viewed using a browser such as <a xmlns=
7741: "http://www.w3.org/TR/xhtml1/transitional" href=
7742: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 7743: class="pkgname">www/mozilla</a> or <a xmlns=
7744: "http://www.w3.org/TR/xhtml1/transitional" href=
7745: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
7746: class="pkgname">www/links</a>. The generated files
7747: contain references to any packages which are in the
7748: <code class="varname">PACKAGES</code> directory on
7749: the local host. The generated files can be made to
7750: refer to URLs based on <code class=
7751: "varname">FTP_PKG_URL_HOST</code> and <code class=
7752: "varname">FTP_PKG_URL_DIR</code>. For example, if I
7753: wanted to generate <code class=
7754: "filename">README.html</code> files which pointed
7755: to binary packages on the local machine, in the
7756: directory <code class=
7757: "filename">/usr/packages</code>, set <code class=
7758: "varname">FTP_PKG_URL_HOST=file://localhost</code>
7759: and <code class=
7760: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
7761: <code class="varname">${PACKAGES}</code> directory
7762: and its subdirectories will be searched for all the
7763: binary packages.</p>
1.1 grant 7764: </dd>
7765:
7766: <dt><span class="term">readme-all</span></dt>
7767:
7768: <dd>
1.14 xtraeme 7769: <p>Use this target to create a file <code class=
7770: "filename">README-all.html</code> which contains a
1.1 grant 7771: list of all packages currently available in the
7772: NetBSD Packages Collection, together with the
7773: category they belong to and a short description.
1.14 xtraeme 7774: This file is compiled from the <code class=
7775: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 7776: sure to run this <span class=
1.14 xtraeme 7777: "emphasis"><em>after</em></span> a
7778: <span><strong class="command">make
7779: readme</strong></span>.</p>
1.1 grant 7780: </dd>
7781:
7782: <dt><span class="term">cdrom-readme</span></dt>
7783:
7784: <dd>
7785: <p>This is very much the same as the
7786: “<span class="quote">readme</span>”
7787: target (see above), but is to be used when
7788: generating a pkgsrc tree to be written to a CD-ROM.
1.14 xtraeme 7789: This target also produces <code class=
7790: "filename">README.html</code> files, and can be
7791: made to refer to URLs based on <code class=
7792: "varname">CDROM_PKG_URL_HOST</code> and
7793: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 7794: </dd>
7795:
7796: <dt><span class="term">show-distfiles</span></dt>
7797:
7798: <dd>
7799: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 7800: are needed to build the package. (<code class=
7801: "varname">DISTFILES</code> and <code class=
7802: "varname">PATCHFILES</code>, but not <code class=
7803: "filename">patches/*</code>)</p>
1.1 grant 7804: </dd>
7805:
7806: <dt><span class="term">show-downlevel</span></dt>
7807:
7808: <dd>
7809: <p>This target shows nothing if the package is not
7810: installed. If a version of this package is
7811: installed, but is not the version provided in this
7812: version of pkgsrc, then a warning message is
7813: displayed. This target can be used to show which of
7814: your installed packages are downlevel, and so the
7815: old versions can be deleted, and the current ones
7816: added.</p>
7817: </dd>
7818:
7819: <dt><span class="term">show-pkgsrc-dir</span></dt>
7820:
7821: <dd>
7822: <p>This target shows the directory in the pkgsrc
7823: hierarchy from which the package can be built and
7824: installed. This may not be the same directory as
7825: the one from which the package was installed. This
7826: target is intended to be used by people who may
7827: wish to upgrade many packages on a single host, and
7828: can be invoked from the top-level pkgsrc Makefile
7829: by using the “<span class=
7830: "quote">show-host-specific-pkgs</span>”
7831: target.</p>
7832: </dd>
7833:
7834: <dt><span class=
7835: "term">show-installed-depends</span></dt>
7836:
7837: <dd>
7838: <p>This target shows which installed packages match
1.14 xtraeme 7839: the current package's <code class=
7840: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 7841: dependencies are causing build problems.</p>
7842: </dd>
7843:
7844: <dt><span class="term">check-shlibs</span></dt>
7845:
7846: <dd>
7847: <p>After a package is installed, check all its
7848: binaries and (on ELF platforms) shared libraries to
7849: see if they find the shared libs they need. Run by
1.14 xtraeme 7850: default if <code class=
7851: "varname">PKG_DEVELOPER</code> is set in
7852: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 7853: </dd>
7854:
7855: <dt><span class="term">print-PLIST</span></dt>
7856:
7857: <dd>
7858: <p>After a “<span class="quote">make
7859: install</span>” from a new or upgraded pkg,
7860: this prints out an attempt to generate a new
1.14 xtraeme 7861: <code class="filename">PLIST</code> from a
7862: <span><strong class="command">find -newer
7863: work/.extract_done</strong></span>. An attempt is
7864: made to care for shared libs etc., but it is
1.1 grant 7865: <span class="emphasis"><em>strongly</em></span>
7866: recommended to review the result before putting it
1.14 xtraeme 7867: into <code class="filename">PLIST</code>. On
7868: upgrades, it's useful to diff the output of this
7869: command against an already existing <code class=
7870: "filename">PLIST</code> file.</p>
1.1 grant 7871:
7872: <p>If the package installs files via tar(1) or
7873: other methods that don't update file access times,
7874: be sure to add these files manually to your
1.14 xtraeme 7875: <code class="filename">PLIST</code>, as the
1.1 grant 7876: “<span class="quote">find
7877: -newer</span>” command used by this target
7878: won't catch them!</p>
7879:
7880: <p>See <a href="#print-PLIST" title=
7881: "8.3. Tweaking output of make print-PLIST">Section 8.3,
1.14 xtraeme 7882: “Tweaking output of <span><strong class=
7883: "command">make
7884: print-PLIST</strong></span>”</a> for more
7885: information on this target.</p>
1.1 grant 7886: </dd>
7887:
7888: <dt><span class="term">bulk-package</span></dt>
7889:
7890: <dd>
7891: <p>Used to do bulk builds. If an appropriate binary
7892: package already exists, no action is taken. If not,
7893: this target will compile, install and package it
1.14 xtraeme 7894: (and it's depends, if <code class=
7895: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 7896: <a href="#binary.configuration" title=
7897: "5.3.1. Configuration">Section 5.3.1,
7898: “Configuration”</a>. After creating the
7899: binary package, the sources, the just-installed
7900: package and it's required packages are removed,
7901: preserving free disk space.</p>
7902:
7903: <p><span class="emphasis"><em>Beware that this
7904: target may deinstall all packages installed on a
7905: system!</em></span></p>
7906: </dd>
7907:
7908: <dt><span class="term">bulk-install</span></dt>
7909:
7910: <dd>
7911: <p>Used during bulk-installs to install required
7912: packages. If an upto-date binary package is
7913: available, it will be installed via <a href=
7914: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7915: <span class="citerefentry"><span class=
7916: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 7917: not, <span><strong class="command">make
7918: bulk-package</strong></span> will be executed, but
7919: the installed binary not be removed.</p>
1.1 grant 7920:
7921: <p>A binary package is considered
7922: “<span class="quote">upto-date</span>”
7923: to be installed via <a href=
7924: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7925: <span class="citerefentry"><span class=
7926: "refentrytitle">pkg_add</span>(1)</span></a>
7927: if:</p>
7928:
7929: <div class="itemizedlist">
7930: <ul type="disc">
7931: <li>
1.14 xtraeme 7932: <p>None of the package's files (<code class=
7933: "filename">Makefile</code>, ...) were
7934: modified since it was built.</p>
1.1 grant 7935: </li>
7936:
7937: <li>
7938: <p>None of the package's required (binary)
7939: packages were modified since it was
7940: built.</p>
7941: </li>
7942: </ul>
7943: </div>
7944:
7945: <p><span class="emphasis"><em>Beware that this
7946: target may deinstall all packages installed on a
7947: system!</em></span></p>
7948: </dd>
7949: </dl>
7950: </div>
7951: </div>
7952: </div>
7953:
7954: <div class="chapter" lang="en" xml:lang="en">
7955: <div class="titlepage">
7956: <div>
7957: <div>
7958: <h2 class="title"><a name="fixes" id=
7959: "fixes"></a>Chapter 12. Notes on fixes for
7960: packages</h2>
7961: </div>
7962: </div>
7963: </div>
7964:
7965: <div class="toc">
7966: <p><b>Table of Contents</b></p>
7967:
7968: <dl>
1.21 ! ben 7969: <dt><span class="sect1"><a href="#id2593723">12.1.
1.1 grant 7970: General operation</a></span></dt>
7971:
7972: <dd>
7973: <dl>
7974: <dt><span class="sect2"><a href=
1.21 ! ben 7975: "#id2593726">12.1.1. How to pull in variables from
1.1 grant 7976: /etc/mk.conf</a></span></dt>
7977:
7978: <dt><span class="sect2"><a href=
1.21 ! ben 7979: "#id2593878">12.1.2. Restricted
1.1 grant 7980: packages</a></span></dt>
7981:
7982: <dt><span class="sect2"><a href=
7983: "#dependencies">12.1.3. Handling
7984: dependencies</a></span></dt>
7985:
7986: <dt><span class="sect2"><a href=
1.21 ! ben 7987: "#id2594393">12.1.4. Handling conflicts with other
1.1 grant 7988: packages</a></span></dt>
7989:
7990: <dt><span class="sect2"><a href=
1.21 ! ben 7991: "#id2594443">12.1.5. Packages that cannot or should
1.1 grant 7992: not be built</a></span></dt>
7993:
7994: <dt><span class="sect2"><a href=
1.21 ! ben 7995: "#id2594469">12.1.6. Packages which should not be
1.1 grant 7996: deleted, once installed</a></span></dt>
7997:
7998: <dt><span class="sect2"><a href=
7999: "#security-handling">12.1.7. Handling packages with
8000: security problems</a></span></dt>
8001:
8002: <dt><span class="sect2"><a href=
1.21 ! ben 8003: "#id2594629">12.1.8. How to handle compiler
1.1 grant 8004: bugs</a></span></dt>
8005:
8006: <dt><span class="sect2"><a href=
1.21 ! ben 8007: "#id2594651">12.1.9. How to handle incrementing
1.1 grant 8008: versions when fixing an existing
8009: package</a></span></dt>
8010:
8011: <dt><span class="sect2"><a href=
1.21 ! ben 8012: "#id2594700">12.1.10. Portability of
1.1 grant 8013: packages</a></span></dt>
8014: </dl>
8015: </dd>
8016:
1.21 ! ben 8017: <dt><span class="sect1"><a href="#id2594725">12.2.
1.1 grant 8018: Possible downloading issues</a></span></dt>
8019:
8020: <dd>
8021: <dl>
8022: <dt><span class="sect2"><a href=
1.21 ! ben 8023: "#id2594728">12.2.1. Packages whose distfiles
1.1 grant 8024: aren't available for plain
8025: downloading</a></span></dt>
8026:
8027: <dt><span class="sect2"><a href=
1.21 ! ben 8028: "#id2594791">12.2.2. How to handle modified
1.1 grant 8029: distfiles with the 'old' name</a></span></dt>
8030: </dl>
8031: </dd>
8032:
1.21 ! ben 8033: <dt><span class="sect1"><a href="#id2594803">12.3.
1.1 grant 8034: Configuration gotchas</a></span></dt>
8035:
8036: <dd>
8037: <dl>
8038: <dt><span class="sect2"><a href=
8039: "#fixes.libtool">12.3.1. Shared libraries -
8040: libtool</a></span></dt>
8041:
8042: <dt><span class="sect2"><a href=
1.21 ! ben 8043: "#id2595250">12.3.2. Using libtool on GNU packages
1.1 grant 8044: that already support libtool</a></span></dt>
8045:
8046: <dt><span class="sect2"><a href=
1.21 ! ben 8047: "#id2595334">12.3.3. GNU
1.1 grant 8048: Autoconf/Automake</a></span></dt>
8049: </dl>
8050: </dd>
8051:
1.21 ! ben 8052: <dt><span class="sect1"><a href="#id2595379">12.4.
1.1 grant 8053: Building considerations</a></span></dt>
8054:
8055: <dd>
8056: <dl>
8057: <dt><span class="sect2"><a href=
1.21 ! ben 8058: "#id2595382">12.4.1. CPP defines</a></span></dt>
1.1 grant 8059: </dl>
8060: </dd>
8061:
1.21 ! ben 8062: <dt><span class="sect1"><a href="#id2595412">12.5.
1.1 grant 8063: Package specific actions</a></span></dt>
8064:
8065: <dd>
8066: <dl>
8067: <dt><span class="sect2"><a href=
1.21 ! ben 8068: "#id2595415">12.5.1. Package configuration
1.1 grant 8069: files</a></span></dt>
8070:
8071: <dt><span class="sect2"><a href=
1.21 ! ben 8072: "#id2595722">12.5.2. User
1.2 hubertf 8073: interaction</a></span></dt>
1.1 grant 8074:
8075: <dt><span class="sect2"><a href=
1.21 ! ben 8076: "#id2595767">12.5.3. Handling
1.1 grant 8077: licenses</a></span></dt>
8078:
8079: <dt><span class="sect2"><a href=
1.21 ! ben 8080: "#id2595918">12.5.4. Creating an account from a
1.1 grant 8081: package</a></span></dt>
8082:
8083: <dt><span class="sect2"><a href=
1.21 ! ben 8084: "#id2595980">12.5.5. Installing score
1.1 grant 8085: files</a></span></dt>
8086:
8087: <dt><span class="sect2"><a href=
1.21 ! ben 8088: "#id2596024">12.5.6. Packages providing login
1.1 grant 8089: shells</a></span></dt>
8090:
8091: <dt><span class="sect2"><a href=
1.21 ! ben 8092: "#id2596082">12.5.7. Packages containing perl
1.1 grant 8093: scripts</a></span></dt>
8094:
8095: <dt><span class="sect2"><a href=
1.21 ! ben 8096: "#id2596100">12.5.8. Packages with hardcoded paths
1.1 grant 8097: to other interpreters</a></span></dt>
8098:
8099: <dt><span class="sect2"><a href=
1.21 ! ben 8100: "#id2596121">12.5.9. Packages installing perl
1.1 grant 8101: modules</a></span></dt>
8102:
8103: <dt><span class="sect2"><a href=
8104: "#faq.info-files">12.5.10. Packages installing info
8105: files</a></span></dt>
8106:
8107: <dt><span class="sect2"><a href=
1.21 ! ben 8108: "#id2596341">12.5.11. Packages installing GConf2
1.1 grant 8109: data files</a></span></dt>
8110:
8111: <dt><span class="sect2"><a href=
1.21 ! ben 8112: "#id2596441">12.5.12. Packages installing
1.1 grant 8113: scrollkeeper data files</a></span></dt>
8114:
8115: <dt><span class="sect2"><a href=
1.21 ! ben 8116: "#id2596561">12.5.13. Packages installing X11
1.1 grant 8117: fonts</a></span></dt>
8118:
8119: <dt><span class="sect2"><a href=
1.21 ! ben 8120: "#id2596608">12.5.14. Packages installing GTK2
1.1 grant 8121: modules</a></span></dt>
8122:
8123: <dt><span class="sect2"><a href=
1.21 ! ben 8124: "#id2596745">12.5.15. Packages installing SGML or
1.1 grant 8125: XML data</a></span></dt>
8126:
8127: <dt><span class="sect2"><a href=
1.21 ! ben 8128: "#id2596797">12.5.16. Packages installing
1.1 grant 8129: extensions to the MIME database</a></span></dt>
8130:
8131: <dt><span class="sect2"><a href=
1.21 ! ben 8132: "#id2597004">12.5.17. Packages using
1.1 grant 8133: intltool</a></span></dt>
1.18 xtraeme 8134:
8135: <dt><span class="sect2"><a href=
1.21 ! ben 8136: "#id2597018">12.5.18. Packages installing startup
1.18 xtraeme 8137: scripts</a></span></dt>
1.1 grant 8138: </dl>
8139: </dd>
8140:
1.21 ! ben 8141: <dt><span class="sect1"><a href="#id2597040">12.6.
1.1 grant 8142: Feedback to the author</a></span></dt>
8143: </dl>
8144: </div>
8145:
8146: <div class="sect1" lang="en" xml:lang="en">
8147: <div class="titlepage">
8148: <div>
8149: <div>
8150: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 8151: "id2593723" id="id2593723"></a>12.1. General
1.1 grant 8152: operation</h2>
8153: </div>
8154: </div>
8155: </div>
8156:
8157: <div class="sect2" lang="en" xml:lang="en">
8158: <div class="titlepage">
8159: <div>
8160: <div>
1.21 ! ben 8161: <h3 class="title"><a name="id2593726" id=
! 8162: "id2593726"></a>12.1.1. How to pull in
1.1 grant 8163: variables from /etc/mk.conf</h3>
8164: </div>
8165: </div>
8166: </div>
8167:
8168: <p>The problem with package-defined variables that can
1.14 xtraeme 8169: be overridden via <code class="varname">MAKECONF</code>
8170: or <code class="filename">/etc/mk.conf</code> is that
8171: <a href=
1.1 grant 8172: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8173: <span class="citerefentry"><span class=
8174: "refentrytitle">make</span>(1)</span></a> expands a
8175: variable as it is used, but evaluates preprocessor like
8176: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 8177: So, to use any variable (which may be set in
8178: <code class="filename">/etc/mk.conf</code>) in one of
8179: the .if* statements, the file <code class=
8180: "filename">/etc/mk.conf</code> must be included before
1.1 grant 8181: that .if* statement.</p>
8182:
8183: <p>Rather than have a number of ad-hoc ways of
1.14 xtraeme 8184: including <code class="filename">/etc/mk.conf</code>,
8185: should it exist, or <code class=
8186: "varname">MAKECONF</code>, should it exist, include the
8187: <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
8188: file in the package Makefile before any
8189: preprocessor-like .if, .ifdef, or .ifndef
8190: statements:</p>
1.1 grant 8191: <pre class="programlisting">
8192: .include "../../mk/bsd.prefs.mk"
8193:
8194: .if defined(USE_MENUS)
8195: ...
8196: .endif
8197: </pre>
8198:
1.14 xtraeme 8199: <p>If you wish to set the <code class=
8200: "varname">CFLAGS</code> variable in <code class=
8201: "filename">/etc/mk.conf</code> please make sure to
1.1 grant 8202: use:</p>
8203: <pre class="programlisting">
8204: CFLAGS+= -your -flags
8205: </pre>
8206:
1.14 xtraeme 8207: <p>Using <code class="varname">CFLAGS=</code> (i.e.
8208: without the “<span class="quote">+</span>”)
8209: may lead to problems with packages that need to add
8210: their own flags. Also, you may want to take a look at
8211: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 8212: href=
8213: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20 ben 8214: class="pkgname">devel/cpuflags</a> package if you're
8215: interested in optimization for the current CPU.</p>
1.1 grant 8216: </div>
8217:
8218: <div class="sect2" lang="en" xml:lang="en">
8219: <div class="titlepage">
8220: <div>
8221: <div>
1.21 ! ben 8222: <h3 class="title"><a name="id2593878" id=
! 8223: "id2593878"></a>12.1.2. Restricted
1.1 grant 8224: packages</h3>
8225: </div>
8226: </div>
8227: </div>
8228:
8229: <p>Some licenses restrict how software may be
8230: re-distributed. In order to satisfy these restrictions,
8231: the package system defines five make variables that can
8232: be set to note these restrictions:</p>
8233:
8234: <div class="itemizedlist">
8235: <ul type="disc">
8236: <li>
1.14 xtraeme 8237: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 8238:
8239: <p>This variable should be set whenever a
8240: restriction exists (regardless of its kind). Set
8241: this variable to a string containing the reason
8242: for the restriction.</p>
8243: </li>
8244:
8245: <li>
1.14 xtraeme 8246: <p><code class=
8247: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 8248:
8249: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 8250: variable to <code class=
8251: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 8252: package may not be included on a CD-ROM.</p>
8253: </li>
8254:
8255: <li>
1.14 xtraeme 8256: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 8257:
8258: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 8259: Set this variable to <code class=
8260: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 8261: package may not not be made available on the
8262: Internet.</p>
8263: </li>
8264:
8265: <li>
1.14 xtraeme 8266: <p><code class=
8267: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 8268:
8269: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 8270: this variable to <code class=
8271: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 8272: of the source code or other distfile(s) is not
8273: allowed on CD-ROMs.</p>
8274: </li>
8275:
8276: <li>
1.14 xtraeme 8277: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 8278:
8279: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 8280: variable to <code class=
8281: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 8282: of the source code or other distfile(s) via the
8283: Internet is not allowed.</p>
8284: </li>
8285: </ul>
8286: </div>
8287:
1.14 xtraeme 8288: <p>Please note that the use of <code class=
8289: "varname">NO_PACKAGE</code>, <code class=
8290: "varname">IGNORE</code>, <code class=
8291: "varname">NO_CDROM</code>, or other generic make
1.1 grant 8292: variables to denote restrictions is deprecated, because
8293: they unconditionally prevent users from generating
8294: binary packages!</p>
8295: </div>
8296:
8297: <div class="sect2" lang="en" xml:lang="en">
8298: <div class="titlepage">
8299: <div>
8300: <div>
8301: <h3 class="title"><a name="dependencies" id=
8302: "dependencies"></a>12.1.3. Handling
8303: dependencies</h3>
8304: </div>
8305: </div>
8306: </div>
8307:
8308: <p>Your package may depend on some other package being
8309: present - and there are various ways of expressing this
1.14 xtraeme 8310: dependency. pkgsrc supports the <code class=
8311: "varname">BUILD_DEPENDS</code> and <code class=
8312: "varname">DEPENDS</code> definitions, as well as
8313: dependencies via <code class=
8314: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 8315: way to handle dependencies, and which uses the
8316: variables named above. See <a href="#buildlink" title=
8317: "Chapter 9. Buildlink methodology">Chapter 9,
8318: <i>Buildlink methodology</i></a> for more
8319: information.</p>
8320:
8321: <p>The basic difference between the two variables is as
1.14 xtraeme 8322: follows: The <code class="varname">DEPENDS</code>
1.1 grant 8323: definition registers that pre-requisite in the binary
8324: package so it will be pulled in when the binary package
1.14 xtraeme 8325: is later installed, whilst the <code class=
8326: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 8327: marking a dependency that is only needed for building
8328: the package.</p>
8329:
8330: <p>This means that if you only need a package present
8331: whilst you are building, it should be noted as a
1.14 xtraeme 8332: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 8333:
1.14 xtraeme 8334: <p>The format for a <code class=
8335: "varname">BUILD_DEPENDS</code> and a <code class=
8336: "varname">DEPENDS</code> definition is:</p>
1.1 grant 8337: <pre class="programlisting">
8338: <pre-req-package-name>:../../<category>/<pre-req-package>
8339: </pre>
8340:
8341: <p>Please note that the “<span class=
8342: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 8343: any of the wildcard version numbers recognized by
1.1 grant 8344: <a href=
8345: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
8346: <span class="citerefentry"><span class=
8347: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
8348:
8349: <div class="orderedlist">
8350: <ol type="1">
8351: <li>
8352: <p>If your package needs another package's
8353: binaries or libraries to build or run, and if
1.14 xtraeme 8354: that package has a <code class=
8355: "filename">buildlink3.mk</code> file available,
8356: use it:</p>
1.1 grant 8357: <pre class="programlisting">
8358: .include "../../graphics/jpeg/buildlink3.mk"
8359:
8360: </pre>
8361: </li>
8362:
8363: <li>
8364: <p>If your package needs to use another package
1.14 xtraeme 8365: to build itself and there is no <code class=
8366: "filename">buildlink3.mk</code> file available,
8367: use the <code class=
8368: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 8369: <pre class="programlisting">
8370: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
8371: </pre>
8372: </li>
8373:
8374: <li>
8375: <p>If your package needs a library with which to
1.14 xtraeme 8376: link and again there is no <code class=
8377: "filename">buildlink3.mk</code> file available,
8378: this is specified using the <code class=
8379: "varname">DEPENDS</code> definition. An example
8380: of this is the <a xmlns=
1.1 grant 8381: "http://www.w3.org/TR/xhtml1/transitional" href=
8382: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 8383: class="pkgname">print/lyx</a> package, which uses
8384: the xpm library, version 3.4j to build:</p>
1.1 grant 8385: <pre class="programlisting">
8386: DEPENDS+= xpm-3.4j:../../graphics/xpm
8387: </pre>
8388:
8389: <p>You can also use wildcards in package
8390: dependences:</p>
8391: <pre class="programlisting">
8392: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
8393: </pre>
8394:
8395: <p>Note that such wildcard dependencies are
8396: retained when creating binary packages. The
8397: dependency is checked when installing the binary
8398: package and any package which matches the pattern
8399: will be used. Wildcard dependencies should be
8400: used with care.</p>
8401:
8402: <p>The “<span class=
8403: "quote">-[0-9]*</span>” should be used
8404: instead of “<span class=
8405: "quote">-*</span>” to avoid potentially
8406: ambiguous matches such as “<span class=
8407: "quote">tk-postgresql</span>” matching a
8408: “<span class="quote">tk-*</span>”
1.14 xtraeme 8409: <code class="varname">DEPENDS</code>.</p>
1.1 grant 8410:
8411: <p>Wildcards can also be used to specify that a
8412: package will only build against a certain minimum
8413: version of a pre-requisite:</p>
8414: <pre class="programlisting">
8415: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
8416: </pre>
8417:
8418: <p>This means that the package will build against
8419: version 3.5.4 of the tiff library or newer. Such
8420: a dependency may be warranted if, for example,
8421: the API of the library has changed with version
8422: 3.5.4 and a package would not compile against an
8423: earlier version of tiff.</p>
8424:
8425: <p>Please note that such dependencies should only
8426: be updated if a package requires a newer
8427: pre-requisite, but not to denote recommendations
8428: such as security updates or ABI changes that do
8429: not prevent a package from building correctly.
8430: Such recommendations can be expressed using
1.14 xtraeme 8431: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 8432: <pre class="programlisting">
8433: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
8434: </pre>
8435:
1.14 xtraeme 8436: <p>In addition to the above <code class=
8437: "varname">DEPENDS</code> line, this denotes that
1.1 grant 8438: while a package will build against
8439: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 8440: recommended. <code class=
8441: "varname">RECOMMENDED</code> entries will be
8442: turned into dependencies unless explicitly
8443: ignored (in which case a warning will be
8444: printed). Packages that are built with
1.1 grant 8445: recommendations ignored may not be uploaded to
8446: ftp.NetBSD.org by developers and should not be
8447: used across different systems that may have
8448: different versions of binary packages
8449: installed.</p>
8450:
8451: <p>For security fixes, please update the package
8452: vulnerabilities file as well as setting
1.14 xtraeme 8453: <code class="varname">RECOMMENDED</code>, see
1.1 grant 8454: <a href="#security-handling" title=
8455: "12.1.7. Handling packages with security problems">
8456: Section 12.1.7, “Handling packages with
8457: security problems”</a> for more
8458: information.</p>
8459: </li>
8460:
8461: <li>
8462: <p>If your package needs some executable to be
1.17 sketch 8463: able to run correctly and if there's no
1.14 xtraeme 8464: <code class="filename">buildlink3.mk</code> file,
8465: this is specified using the <code class=
8466: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 8467: "http://www.w3.org/TR/xhtml1/transitional" href=
8468: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 8469: class="pkgname">print/lyx</a> package needs to be
8470: able to execute the latex binary from the teTeX
8471: package when it runs, and that is specified:</p>
1.1 grant 8472: <pre class="programlisting">
8473: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
8474: </pre>
8475:
8476: <p>The comment about wildcard dependencies from
8477: previous paragraph applies here, too.</p>
8478: </li>
8479: </ol>
8480: </div>
8481:
8482: <p>If your package needs files from another package to
8483: build, see the first part of the “<span class=
8484: "quote">do-configure</span>” target <a xmlns=
8485: "http://www.w3.org/TR/xhtml1/transitional" href=
8486: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20 ben 8487: class="pkgname">print/ghostscript5</a> package (it
8488: relies on the jpeg sources being present in source form
8489: during the build):</p>
1.1 grant 8490: <pre class="programlisting">
8491: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
8492: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
8493: fi
8494: </pre>
8495:
8496: <p>If you build any other packages that way, please
8497: make sure the working files are deleted too when this
8498: package's working files are cleaned up. The easiest way
8499: to do so is by adding a pre-clean target:</p>
8500: <pre class="programlisting">
8501: pre-clean:
8502: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
8503: </pre>
8504:
1.14 xtraeme 8505: <p>Please also note the <code class=
8506: "varname">BUILD_USES_MSGFMT</code> and <code class=
8507: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
8508: which are provided as convenience definitions. The
8509: former works out whether msgfmt(1) is part of the base
8510: system, and, if it isn't, installs the <a xmlns=
1.1 grant 8511: "http://www.w3.org/TR/xhtml1/transitional" href=
8512: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20 ben 8513: class="pkgname">devel/gettext</a> package. The latter
8514: adds a build dependency on either an installed version
8515: of an older gettext package, or if it isn't, installs
8516: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8517: href=
8518: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
8519: class="pkgname">devel/gettext-m4</a> package.</p>
1.1 grant 8520: </div>
8521:
8522: <div class="sect2" lang="en" xml:lang="en">
8523: <div class="titlepage">
8524: <div>
8525: <div>
1.21 ! ben 8526: <h3 class="title"><a name="id2594393" id=
! 8527: "id2594393"></a>12.1.4. Handling conflicts
1.1 grant 8528: with other packages</h3>
8529: </div>
8530: </div>
8531: </div>
8532:
8533: <p>Your package may conflict with other packages a user
8534: might already have installed on his system, e.g. if
8535: your package installs the same set of files like
8536: another package in our pkgsrc tree.</p>
8537:
1.14 xtraeme 8538: <p>In this case you can set <code class=
8539: "varname">CONFLICTS</code> to a space separated list of
1.1 grant 8540: packages (including version string) your package
8541: conflicts with.</p>
8542:
8543: <p>For example <a xmlns=
8544: "http://www.w3.org/TR/xhtml1/transitional" href=
8545: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20 ben 8546: class="pkgname">x11/Xaw3d</a> and <a xmlns=
8547: "http://www.w3.org/TR/xhtml1/transitional" href=
8548: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
8549: class="pkgname">x11/Xaw-Xpm</a> install provide the
8550: same shared library, thus you set in <code class=
8551: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 8552: <pre class="programlisting">
8553: CONFLICTS= Xaw-Xpm-[0-9]*
8554: </pre>
8555:
1.14 xtraeme 8556: <p>and in <code class=
8557: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 8558: <pre class="programlisting">
8559: CONFLICTS= Xaw3d-[0-9]*
8560: </pre>
8561:
8562: <p>Packages will automatically conflict with other
8563: packages with the name prefix and a different version
8564: string. “<span class=
8565: "quote">Xaw3d-1.5</span>” e.g. will automatically
8566: conflict with the older version “<span class=
8567: "quote">Xaw3d-1.3</span>”.</p>
8568: </div>
8569:
8570: <div class="sect2" lang="en" xml:lang="en">
8571: <div class="titlepage">
8572: <div>
8573: <div>
1.21 ! ben 8574: <h3 class="title"><a name="id2594443" id=
! 8575: "id2594443"></a>12.1.5. Packages that cannot
1.1 grant 8576: or should not be built</h3>
8577: </div>
8578: </div>
8579: </div>
8580:
8581: <p>There are several reasons why a package might be
8582: instructed to not build under certain circumstances. If
8583: the package builds and runs on most platforms, the
1.14 xtraeme 8584: exceptions should be noted with <code class=
8585: "varname">NOT_FOR_PLATFORM</code>. If the package
8586: builds and runs on a small handful of platforms, set
8587: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
8588: If the package should be skipped (for example, because
8589: it provides functionality already provided by the
8590: system), set <code class=
8591: "varname">PKG_SKIP_REASON</code> to a descriptive
8592: message. If the package should fail because some
8593: preconditions are not met, set <code class=
8594: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 8595: message.</p>
8596:
1.14 xtraeme 8597: <p><code class="varname">IGNORE</code> is deprecated
1.1 grant 8598: because it didn't provide enough information to
8599: determine whether the build should fail.</p>
8600: </div>
8601:
8602: <div class="sect2" lang="en" xml:lang="en">
8603: <div class="titlepage">
8604: <div>
8605: <div>
1.21 ! ben 8606: <h3 class="title"><a name="id2594469" id=
! 8607: "id2594469"></a>12.1.6. Packages which
1.1 grant 8608: should not be deleted, once installed</h3>
8609: </div>
8610: </div>
8611: </div>
8612:
8613: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 8614: has been installed, the <code class=
8615: "varname">PKG_PRESERVE</code> definition should be set
8616: in the package Makefile. This will be carried into any
1.1 grant 8617: binary package that is made from this pkgsrc entry. A
8618: “<span class="quote">preserved</span>”
8619: package will not be deleted using <a href=
8620: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8621: <span class="citerefentry"><span class=
8622: "refentrytitle">pkg_delete</span>(1)</span></a> unless
8623: the “<span class="quote">-f</span>” option
8624: is used.</p>
8625: </div>
8626:
8627: <div class="sect2" lang="en" xml:lang="en">
8628: <div class="titlepage">
8629: <div>
8630: <div>
8631: <h3 class="title"><a name="security-handling" id=
8632: "security-handling"></a>12.1.7. Handling
8633: packages with security problems</h3>
8634: </div>
8635: </div>
8636: </div>
8637:
8638: <p>When a vulnerability is found, this should be noted
1.14 xtraeme 8639: in <code class=
8640: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1 grant 8641: and after the commit of that file, it should be copied
1.14 xtraeme 8642: to both <code class=
8643: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
8644: and <code class=
8645: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
8646: on ftp.NetBSD.org using <code class=
8647: "filename">localsrc/security/advisories/Makefile</code>.
8648: In addition, if a <code class=
8649: "filename">buildlink3.mk</code> file exists for an
8650: affected package, bumping <code class=
8651: "varname">PKGREVISION</code> and creating a
8652: corresponding <code class=
8653: "varname">BUILDLINK_RECOMMENDED.<em class=
8654: "replaceable"><code>pkg</code></em></code> entry should
8655: be considered. See <a href="#buildlink" title=
1.1 grant 8656: "Chapter 9. Buildlink methodology">Chapter 9,
8657: <i>Buildlink methodology</i></a> for more information
1.14 xtraeme 8658: about writing <code class=
8659: "filename">buildlink3.mk</code> files and <code class=
8660: "varname">BUILDLINK_*</code> definitions.</p>
1.1 grant 8661:
8662: <p>Also, if the fix should be applied to the stable
8663: pkgsrc branch, be sure to submit a pullup request!</p>
8664: </div>
8665:
8666: <div class="sect2" lang="en" xml:lang="en">
8667: <div class="titlepage">
8668: <div>
8669: <div>
1.21 ! ben 8670: <h3 class="title"><a name="id2594629" id=
! 8671: "id2594629"></a>12.1.8. How to handle
1.1 grant 8672: compiler bugs</h3>
8673: </div>
8674: </div>
8675: </div>
8676:
8677: <p>Some source files trigger bugs in the compiler,
8678: based on combinations of compiler version and
8679: architecture and almost always relation to optimisation
8680: being enabled. Common symptoms are gcc internal errors
8681: or never finishing compiling a file.</p>
8682:
8683: <p>Typically a workaround involves testing the
1.14 xtraeme 8684: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 8685: version, disabling optimisation for that
1.14 xtraeme 8686: file/<code class="varname">MACHINE_ARCH</code>/compiler
8687: combination, and documenting it in <code class=
8688: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 8689: number of examples!</p>
8690: </div>
8691:
8692: <div class="sect2" lang="en" xml:lang="en">
8693: <div class="titlepage">
8694: <div>
8695: <div>
1.21 ! ben 8696: <h3 class="title"><a name="id2594651" id=
! 8697: "id2594651"></a>12.1.9. How to handle
1.1 grant 8698: incrementing versions when fixing an existing
8699: package</h3>
8700: </div>
8701: </div>
8702: </div>
8703:
8704: <p>When making fixes to an existing package it can be
1.14 xtraeme 8705: useful to change the version number in <code class=
8706: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 8707: future versions by the original author, a
8708: “<span class="quote">nb1</span>”,
8709: “<span class="quote">nb2</span>”, ...
8710: suffix can be used on package versions by setting
1.14 xtraeme 8711: <code class="varname">PKGREVISION=1</code> (2, ...).
8712: The “<span class="quote">nb</span>” is
8713: treated like a “<span class=
8714: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 8715: <pre class="programlisting">
8716: DISTNAME= foo-17.42
8717: PKGREVISION= 9
8718: </pre>
8719:
1.14 xtraeme 8720: <p>will result in a <code class=
8721: "varname">PKGNAME</code> of “<span class=
1.1 grant 8722: "quote">foo-17.42nb9</span>”.</p>
8723:
8724: <p>When a new release of the package is released, the
1.14 xtraeme 8725: <code class="varname">PKGREVISION</code> should be
8726: removed. e.g. on a new minor release of the above
8727: package, things should be like:</p>
1.1 grant 8728: <pre class="programlisting">
8729: DISTNAME= foo-17.43
8730: </pre>
8731: </div>
8732:
8733: <div class="sect2" lang="en" xml:lang="en">
8734: <div class="titlepage">
8735: <div>
8736: <div>
1.21 ! ben 8737: <h3 class="title"><a name="id2594700" id=
! 8738: "id2594700"></a>12.1.10. Portability of
1.1 grant 8739: packages</h3>
8740: </div>
8741: </div>
8742: </div>
8743:
8744: <p>One appealing feature of pkgsrc is that it runs on
8745: many different platforms. As a result, it is important
8746: to ensure, where possible, that packages in pkgsrc are
8747: portable. There are some particular details you should
8748: pay attention to while working on pkgsrc.</p>
8749:
8750: <div class="sect3" lang="en" xml:lang="en">
8751: <div class="titlepage">
8752: <div>
8753: <div>
1.21 ! ben 8754: <h4 class="title"><a name="id2594706" id=
! 8755: "id2594706"></a>12.1.10.1. ${INSTALL},
1.1 grant 8756: ${INSTALL_DATA_DIR}, ...</h4>
8757: </div>
8758: </div>
8759: </div>
8760:
1.14 xtraeme 8761: <p>The BSD-compatible <span><strong class=
8762: "command">install</strong></span> supplied with some
1.1 grant 8763: operating systems will not perform more than one
8764: operation at a time. As such, you should call
8765: “<span class="quote">${INSTALL}</span>”,
8766: etc. like this:</p>
8767: <pre class="programlisting">
8768: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
8769: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
8770: </pre>
8771: </div>
8772: </div>
8773: </div>
8774:
8775: <div class="sect1" lang="en" xml:lang="en">
8776: <div class="titlepage">
8777: <div>
8778: <div>
8779: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 8780: "id2594725" id="id2594725"></a>12.2. Possible
1.1 grant 8781: downloading issues</h2>
8782: </div>
8783: </div>
8784: </div>
8785:
8786: <div class="sect2" lang="en" xml:lang="en">
8787: <div class="titlepage">
8788: <div>
8789: <div>
1.21 ! ben 8790: <h3 class="title"><a name="id2594728" id=
! 8791: "id2594728"></a>12.2.1. Packages whose
1.1 grant 8792: distfiles aren't available for plain
8793: downloading</h3>
8794: </div>
8795: </div>
8796: </div>
8797:
8798: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 8799: set <code class="varname">DYNAMIC_MASTER_SITES</code>
8800: and a <span><strong class="command">make
8801: fetch</strong></span> will call <code class=
8802: "filename">files/getsite.sh</code> with the name of
8803: each file to download as an argument, expecting it to
8804: output the URL of the directory from which to download
8805: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8806: href=
1.1 grant 8807: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20 ben 8808: class="pkgname">graphics/ns-cult3d</a> is an example of
8809: this usage.</p>
1.1 grant 8810:
8811: <p>If the download can't be automated, because the user
8812: must submit personal information to apply for a
8813: password, or must pay for the source, or whatever, you
1.14 xtraeme 8814: can set <code class="varname">_FETCH_MESSAGE</code> to
8815: a macro which displays a message explaining the
8816: situation. <code class="varname">_FETCH_MESSAGE</code>
8817: must be executable shell commands, not just a message.
8818: (Generally, it executes <code class=
8819: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 8820: following packages use this: <a xmlns=
8821: "http://www.w3.org/TR/xhtml1/transitional" href=
8822: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20 ben 8823: class="pkgname">audio/realplayer</a>, <a xmlns=
8824: "http://www.w3.org/TR/xhtml1/transitional" href=
8825: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
8826: class="pkgname">cad/simian</a>, <a xmlns=
8827: "http://www.w3.org/TR/xhtml1/transitional" href=
8828: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
8829: class="pkgname">devel/ipv6socket</a>, <a xmlns=
8830: "http://www.w3.org/TR/xhtml1/transitional" href=
8831: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
8832: class="pkgname">emulators/vmware-module</a>, <a xmlns=
8833: "http://www.w3.org/TR/xhtml1/transitional" href=
8834: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
8835: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
8836: "http://www.w3.org/TR/xhtml1/transitional" href=
8837: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
8838: class="pkgname">sysutils/storage-manager</a>, <a xmlns=
8839: "http://www.w3.org/TR/xhtml1/transitional" href=
8840: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
8841: class="pkgname">www/ap-aolserver</a>, <a xmlns=
8842: "http://www.w3.org/TR/xhtml1/transitional" href=
8843: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
8844: class="pkgname">www/openacs</a>. Try to be consistent
8845: with them.</p>
1.1 grant 8846: </div>
8847:
8848: <div class="sect2" lang="en" xml:lang="en">
8849: <div class="titlepage">
8850: <div>
8851: <div>
1.21 ! ben 8852: <h3 class="title"><a name="id2594791" id=
! 8853: "id2594791"></a>12.2.2. How to handle
1.1 grant 8854: modified distfiles with the 'old' name</h3>
8855: </div>
8856: </div>
8857: </div>
8858:
8859: <p>Sometimes authors of a software package make some
8860: modifications after the software was released, and they
8861: put up a new distfile without changing the package's
8862: version number. If a package is already in pkgsrc at
8863: that time, the md5 checksum will no longer match. The
8864: correct way to work around this is to update the
8865: package's md5 checksum to match the package on the
8866: master site (beware, any mirrors may not be up to date
8867: yet!), and to remove the old distfile from
1.14 xtraeme 8868: ftp.NetBSD.org's <code class=
8869: "filename">/pub/NetBSD/packages/distfiles</code>
1.1 grant 8870: directory. Furthermore, a mail to the package's author
8871: seems appropriate making sure the distfile was really
8872: updated on purpose, and that no trojan horse or so
8873: crept in.</p>
8874: </div>
8875: </div>
8876:
8877: <div class="sect1" lang="en" xml:lang="en">
8878: <div class="titlepage">
8879: <div>
8880: <div>
8881: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 8882: "id2594803" id=
! 8883: "id2594803"></a>12.3. Configuration
1.1 grant 8884: gotchas</h2>
8885: </div>
8886: </div>
8887: </div>
8888:
8889: <div class="sect2" lang="en" xml:lang="en">
8890: <div class="titlepage">
8891: <div>
8892: <div>
8893: <h3 class="title"><a name="fixes.libtool" id=
8894: "fixes.libtool"></a>12.3.1. Shared libraries
8895: - libtool</h3>
8896: </div>
8897: </div>
8898: </div>
8899:
8900: <p>pkgsrc supports many different machines, with
8901: different object formats like a.out and ELF, and
8902: varying abilities to do shared library and dynamic
8903: loading at all. To accompany this, varying commands and
8904: options have to be passed to the compiler, linker, etc.
8905: to get the Right Thing, which can be pretty annoying
8906: especially if you don't have all the machines at your
8907: hand to test things. The <a xmlns=
8908: "http://www.w3.org/TR/xhtml1/transitional" href=
8909: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20 ben 8910: class="pkgname">devel/libtool</a> pkg can help here, as
8911: it just “<span class="quote">knows</span>”
8912: how to build both static and dynamic libraries from a
8913: set of source files, thus being platform
8914: independent.</p>
1.1 grant 8915:
8916: <p>Here's how to use libtool in a pkg in seven simple
8917: steps:</p>
8918:
8919: <div class="orderedlist">
8920: <ol type="1">
8921: <li>
1.14 xtraeme 8922: <p>Add <code class=
8923: "varname">USE_LIBTOOL=yes</code> to the package
8924: Makefile.</p>
1.1 grant 8925: </li>
8926:
8927: <li>
8928: <p>For library objects, use “<span class=
8929: "quote">${LIBTOOL} --mode=compile
8930: ${CC}</span>” in place of
8931: “<span class="quote">${CC}</span>”.
8932: You could even add it to the definition of
1.14 xtraeme 8933: <code class="varname">CC</code>, if only
8934: libraries are being built in a given Makefile.
8935: This one command will build both PIC and non-PIC
8936: library objects, so you need not have separate
8937: shared and non-shared library rules.</p>
1.1 grant 8938: </li>
8939:
8940: <li>
8941: <p>For the linking of the library, remove any
8942: “<span class="quote">ar</span>”,
8943: “<span class="quote">ranlib</span>”,
8944: and “<span class="quote">ld
8945: -Bshareable</span>” commands, and instead
8946: use:</p>
8947: <pre class="programlisting">
8948: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
8949: </pre>
8950:
8951: <p>Note that the library is changed to have a
1.14 xtraeme 8952: <code class="filename">.la</code> extension, and
8953: the objects are changed to have a <code class=
8954: "filename">.lo</code> extension. Change
8955: <code class="varname">OBJS</code> as necessary.
8956: This automatically creates all of the
8957: <code class="filename">.a</code>, <code class=
8958: "filename">.so.major.minor</code>, and ELF
8959: symlinks (if necessary) in the build directory.
8960: Be sure to include “<span class=
1.1 grant 8961: "quote">-version-info</span>”, especially
8962: when major and minor are zero, as libtool will
8963: otherwise strip off the shared library
8964: version.</p>
8965:
8966: <p>From the libtool manual:</p>
8967: <pre class="programlisting">
8968: So, libtool library versions are described by three integers:
8969:
8970: CURRENT
8971: The most recent interface number that this library implements.
8972:
8973: REVISION
8974: The implementation number of the CURRENT interface.
8975:
8976: AGE
8977: The difference between the newest and oldest interfaces that this
8978: library implements. In other words, the library implements all the
8979: interface numbers in the range from number `CURRENT - AGE' to
8980: `CURRENT'.
8981:
8982: If two libraries have identical CURRENT and AGE numbers, then the
8983: dynamic linker chooses the library with the greater REVISION number.
8984: </pre>
8985:
8986: <p>The “<span class=
8987: "quote">-release</span>” option will
8988: produce different results for a.out and ELF
8989: (excluding symlinks) in only one case. An ELF
8990: library of the form “<span class=
8991: "quote">libfoo-release.so.<span class=
8992: "emphasis"><em>x</em></span>.<span class=
8993: "emphasis"><em>y</em></span></span>” will
8994: have a symlink of “<span class=
8995: "quote">libfoo.so.<span class=
8996: "emphasis"><em>x</em></span>.<span class=
8997: "emphasis"><em>y</em></span></span>” on an
8998: a.out platform. This is handled
8999: automatically.</p>
9000:
9001: <p>The “<span class="quote">-rpath
9002: argument</span>” is the install directory
9003: of the library being built.</p>
9004:
1.14 xtraeme 9005: <p>In the <code class="filename">PLIST</code>,
1.19 hubertf 9006: include only the <code class=
9007: "filename">.la</code> file, the other files will
9008: be added automatically.</p>
1.1 grant 9009: </li>
9010:
9011: <li>
1.14 xtraeme 9012: <p>When linking shared object (<code class=
9013: "filename">.so</code>) files, i.e. files that are
1.1 grant 9014: loaded via dlopen(3), NOT shared libraries, use
9015: “<span class="quote">-module
9016: -avoid-version</span>” to prevent them
9017: getting version tacked on.</p>
9018:
1.14 xtraeme 9019: <p>The <code class="filename">PLIST</code> file
9020: gets the <code class="filename">foo.so</code>
9021: entry.</p>
1.1 grant 9022: </li>
9023:
9024: <li>
9025: <p>When linking programs that depend on these
9026: libraries <span class=
9027: "emphasis"><em>before</em></span> they are
9028: installed, preface the <a href=
9029: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
9030: <span class="citerefentry"><span class=
9031: "refentrytitle">cc</span>(1)</span></a> or
9032: <a href=
9033: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
9034: <span class="citerefentry"><span class=
9035: "refentrytitle">ld</span>(1)</span></a> line with
9036: “<span class="quote">${LIBTOOL}
9037: --mode=link</span>”, and it will find the
9038: correct libraries (static or shared), but please
9039: be aware that libtool will not allow you to
9040: specify a relative path in -L (such as
9041: “<span class=
9042: "quote">-L../somelib</span>”), because it
9043: expects you to change that argument to be the
1.14 xtraeme 9044: <code class="filename">.la</code> file. e.g.</p>
1.1 grant 9045: <pre class="programlisting">
9046: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
9047: </pre>
9048:
9049: <p>should be changed to:</p>
9050: <pre class="programlisting">
1.14 xtraeme 9051: ${LIBTOOL} --mode=link ${CC} -o <em class=
9052: "replaceable"><code>someprog</code></em> <em class=
9053: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 9054: </pre>
9055:
9056: <p>and it will do the right thing with the
9057: libraries.</p>
9058: </li>
9059:
9060: <li>
9061: <p>When installing libraries, preface the
9062: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
9063: <span class="citerefentry"><span class=
9064: "refentrytitle">install</span>(1)</span></a> or
9065: <a href=
9066: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
9067: <span class="citerefentry"><span class=
9068: "refentrytitle">cp</span>(1)</span></a> command
9069: with “<span class="quote">${LIBTOOL}
9070: --mode=install</span>”, and change the
1.14 xtraeme 9071: library name to <code class=
9072: "filename">.la</code>. e.g.</p>
1.1 grant 9073: <pre class="programlisting">
9074: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
9075: </pre>
9076:
1.14 xtraeme 9077: <p>This will install the static <code class=
9078: "filename">.a</code>, shared library, any needed
1.1 grant 9079: symlinks, and run <a href=
9080: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
9081: <span class="citerefentry"><span class=
9082: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
9083: </li>
9084:
9085: <li>
1.14 xtraeme 9086: <p>In your <code class="filename">PLIST</code>,
9087: include all of the <code class=
9088: "filename">.a</code>, <code class=
9089: "filename">.la</code>, and <code class=
9090: "filename">.so</code>, <code class=
9091: "filename">.so.CURRENT</code> and <code class=
9092: "filename">.so.CURRENT.REVISION</code> files
9093: (this is a change from the previous
9094: behaviour).</p>
1.1 grant 9095: </li>
9096: </ol>
9097: </div>
9098: </div>
9099:
9100: <div class="sect2" lang="en" xml:lang="en">
9101: <div class="titlepage">
9102: <div>
9103: <div>
1.21 ! ben 9104: <h3 class="title"><a name="id2595250" id=
! 9105: "id2595250"></a>12.3.2. Using libtool on GNU
1.1 grant 9106: packages that already support libtool</h3>
9107: </div>
9108: </div>
9109: </div>
9110:
1.14 xtraeme 9111: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
9112: the package Makefile. This will override the package's
9113: own libtool in most cases. For older libtool using
1.1 grant 9114: packages, libtool is made by ltconfig script during the
9115: do-configure step; you can check the libtool script
1.14 xtraeme 9116: location by doing <span><strong class="command">make
9117: configure; find work*/ -name
9118: libtool</strong></span>.</p>
9119:
9120: <p><code class="varname">LIBTOOL_OVERRIDE</code>
9121: specifies which libtool scripts, relative to
9122: <code class="varname">WRKSRC</code>, to override. By
9123: default, it is set to “<span class=
9124: "quote">libtool */libtool */*/libtool</span>”. If
9125: this does not match the location of the package's
9126: libtool script(s), set it as appropriate.</p>
1.13 hubertf 9127:
1.14 xtraeme 9128: <p>If you do not need <code class="filename">*.a</code>
1.1 grant 9129: static libraries built and installed, then use
1.14 xtraeme 9130: <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1 grant 9131: instead.</p>
9132:
9133: <p>If your package makes use of the platform
9134: independent library for loading dynamic shared objects,
9135: that comes with libtool (libltdl), you should include
1.14 xtraeme 9136: the libtool buildlink3.mk (and set <code class=
9137: "varname">USE_BUILDLINK3=YES</code>).</p>
1.1 grant 9138:
9139: <p>Some packages use libtool incorrectly so that the
9140: package may not work or build in some circumstances.
9141: Some of the more common errors are:</p>
9142:
9143: <div class="itemizedlist">
9144: <ul type="disc">
9145: <li>
9146: <p>The inclusion of a shared object (-module) as
9147: a dependent library in an executable or library.
9148: This in itself isn't a problem if one of two
9149: things has been done:</p>
9150:
9151: <div class="orderedlist">
9152: <ol type="1">
9153: <li>
9154: <p>The shared object is named correctly,
1.14 xtraeme 9155: i.e. <code class=
9156: "filename">libfoo.la</code>, not
9157: <code class="filename">foo.la</code></p>
1.1 grant 9158: </li>
9159:
9160: <li>
9161: <p>The -dlopen option is used when linking
9162: an executable.</p>
9163: </li>
9164: </ol>
9165: </div>
9166: </li>
9167:
9168: <li>
9169: <p>The use of libltdl without the correct calls
9170: to initialisation routines. The function
9171: lt_dlinit() should be called and the macro
1.14 xtraeme 9172: <code class=
9173: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 9174: included in executables.</p>
9175: </li>
9176: </ul>
9177: </div>
9178: </div>
9179:
9180: <div class="sect2" lang="en" xml:lang="en">
9181: <div class="titlepage">
9182: <div>
9183: <div>
1.21 ! ben 9184: <h3 class="title"><a name="id2595334" id=
! 9185: "id2595334"></a>12.3.3. GNU
1.1 grant 9186: Autoconf/Automake</h3>
9187: </div>
9188: </div>
9189: </div>
9190:
9191: <p>If a package needs GNU autoconf or automake to be
9192: executed to regenerate the configure script and
9193: Makefile.in makefile templates, then they should be
9194: executed in a pre-configure target. Two Makefile
1.14 xtraeme 9195: fragments are provided in <code class=
9196: "filename">pkgsrc/mk/autoconf.mk</code> and
9197: <code class="filename">pkgsrc/mk/automake.mk</code> to
9198: help dealing with these tools. See comments in these
9199: files for details.</p>
1.1 grant 9200:
9201: <p>For packages that need only autoconf:</p>
9202: <pre class="programlisting">
9203: AUTOCONF_REQD= 2.50 # if default version is not good enough
9204: ...
9205:
9206: pre-configure:
9207: cd ${WRKSRC}; ${AUTOCONF}
9208:
9209: ...
9210: .include "../../mk/autoconf.mk"
9211: </pre>
9212:
9213: <p>and for packages that need automake and
9214: autoconf:</p>
9215: <pre class="programlisting">
9216: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
9217: ...
9218:
9219: pre-configure:
9220: cd ${WRKSRC}; \
9221: ${ACLOCAL}; \
9222: ${AUTOHEADER}; \
9223: ${AUTOMAKE} -a --foreign -i; \
9224: ${AUTOCONF}
9225:
9226: ...
9227: .include "../mk/automake.mk"
9228: </pre>
9229:
9230: <p>Packages which use GNU Automake will almost
9231: certainly require GNU Make, but that's automatically
1.14 xtraeme 9232: provided for you in <code class=
9233: "filename">mk/automake.mk</code>.</p>
1.1 grant 9234:
9235: <p>There are times when the configure process makes
9236: additional changes to the generated files, which then
9237: causes the build process to try to re-execute the
9238: automake sequence. This is prevented by touching
9239: various files in the configure stage. If this causes
1.14 xtraeme 9240: problems with your package you can set <code class=
9241: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 9242: Makefile.</p>
9243: </div>
9244: </div>
9245:
9246: <div class="sect1" lang="en" xml:lang="en">
9247: <div class="titlepage">
9248: <div>
9249: <div>
9250: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 9251: "id2595379" id="id2595379"></a>12.4. Building
1.1 grant 9252: considerations</h2>
9253: </div>
9254: </div>
9255: </div>
9256:
9257: <div class="sect2" lang="en" xml:lang="en">
9258: <div class="titlepage">
9259: <div>
9260: <div>
1.21 ! ben 9261: <h3 class="title"><a name="id2595382" id=
! 9262: "id2595382"></a>12.4.1. CPP defines</h3>
1.1 grant 9263: </div>
9264: </div>
9265: </div>
9266:
9267: <p>To port an application to NetBSD, it's usually
9268: necessary for the compiler to be able to judge the
9269: system on which it's compiling, and we use definitions
9270: so that the C pre-processor can do this.</p>
9271:
9272: <p>To test whether you are working on a 4.4 BSD-derived
9273: system, you should use the BSD definition, which is
1.14 xtraeme 9274: defined in <code class=
9275: "filename"><sys/param.h></code> on said
1.1 grant 9276: systems.</p>
9277: <pre class="programlisting">
9278: #include <sys/param.h>
9279: </pre>
9280:
9281: <p>and then you can surround the BSD-specific parts of
9282: your package's C/C++ code using this conditional:</p>
9283: <pre class="programlisting">
9284: #if (defined(BSD) && BSD >= 199306)
9285: ...
9286: #endif
9287: </pre>
9288:
9289: <p>Please use the “<span class=
9290: "quote">__NetBSD__</span>” definition sparingly -
9291: it should only apply to features of NetBSD that are not
9292: present in other 4.4-lite derived BSDs.</p>
9293: </div>
9294: </div>
9295:
9296: <div class="sect1" lang="en" xml:lang="en">
9297: <div class="titlepage">
9298: <div>
9299: <div>
9300: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 9301: "id2595412" id="id2595412"></a>12.5. Package
1.1 grant 9302: specific actions</h2>
9303: </div>
9304: </div>
9305: </div>
9306:
9307: <div class="sect2" lang="en" xml:lang="en">
9308: <div class="titlepage">
9309: <div>
9310: <div>
1.21 ! ben 9311: <h3 class="title"><a name="id2595415" id=
! 9312: "id2595415"></a>12.5.1. Package
1.1 grant 9313: configuration files</h3>
9314: </div>
9315: </div>
9316: </div>
9317:
9318: <p>Packages should be taught to look for their
1.14 xtraeme 9319: configuration files in <code class=
9320: "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1 grant 9321: through to the configure and build processes.
1.14 xtraeme 9322: <code class="varname">PKG_SYSCONFDIR</code> may be
1.1 grant 9323: customized in various ways by setting other make
9324: variables:</p>
9325:
9326: <div class="itemizedlist">
9327: <ul type="disc">
9328: <li>
1.14 xtraeme 9329: <p><code class="varname">PKG_SYSCONFBASE</code>
9330: is the main config directory under which all
9331: package configuration files are to be found. This
9332: defaults to <code class=
9333: "filename">${PREFIX}/etc</code>, but may be
9334: overridden in <code class=
9335: "filename">/etc/mk.conf</code>.</p>
1.1 grant 9336: </li>
9337:
9338: <li>
1.14 xtraeme 9339: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
9340: is the subdirectory of <code class=
9341: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 9342: configuration files for a particular package may
9343: be found, e.g. the Apache configuration files may
1.14 xtraeme 9344: all be found under the <code class=
9345: "filename">httpd/</code> subdirectory of
9346: <code class="varname">${PKG_SYSCONFBASE}</code>.
9347: This should be set in the package Makefile.</p>
1.1 grant 9348: </li>
9349:
9350: <li>
1.14 xtraeme 9351: <p>By default, <code class=
9352: "varname">PKG_SYSCONFDIR</code> is set to
9353: <code class=
9354: "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
9355: but this may be overridden by setting
9356: <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9357: for a particular package, where <code class=
9358: "varname">PKG_SYSCONFVAR</code> defaults to
9359: <code class="varname">${PKGBASE}</code>. This is
9360: not meant to be set by a package Makefile, but is
1.1 grant 9361: reserved for users who wish to override the
1.14 xtraeme 9362: <code class="varname">PKG_SYSCONFDIR</code>
9363: setting for a particular package with a special
1.1 grant 9364: location.</p>
9365: </li>
9366: </ul>
9367: </div>
9368:
9369: <p>The only variables that users should customize are
1.14 xtraeme 9370: <code class="varname">PKG_SYSCONFBASE</code> and
9371: <code class=
9372: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
9373: Users will typically want to set <code class=
9374: "varname">PKG_SYSCONFBASE</code> to <code class=
9375: "filename">/etc</code>, or to accept the default
9376: location of <code class=
9377: "filename">${PREFIX}/etc</code>.</p>
1.1 grant 9378: </div>
9379:
9380: <div class="sect2" lang="en" xml:lang="en">
9381: <div class="titlepage">
9382: <div>
9383: <div>
1.21 ! ben 9384: <h3 class="title"><a name="id2595722" id=
! 9385: "id2595722"></a>12.5.2. User
1.2 hubertf 9386: interaction</h3>
1.1 grant 9387: </div>
9388: </div>
9389: </div>
9390:
9391: <p>Occasionally, packages require interaction from the
9392: user, and this can be in a number of ways:</p>
9393:
9394: <div class="itemizedlist">
9395: <ul type="disc">
9396: <li>
9397: <p>help in fetching the distfiles</p>
9398: </li>
9399:
9400: <li>
9401: <p>help to configure the package before it is
9402: built</p>
9403: </li>
9404:
9405: <li>
9406: <p>help during the build process</p>
9407: </li>
9408:
9409: <li>
9410: <p>help during the installation of a package</p>
9411: </li>
9412: </ul>
9413: </div>
9414:
1.14 xtraeme 9415: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 9416: definition is provided to notify the pkgsrc mechanism
9417: of an interactive stage which will be needed, and this
1.14 xtraeme 9418: should be set in the package's <code class=
9419: "filename">Makefile</code>. e.g.</p>
1.1 grant 9420: <pre class="programlisting">
9421: INTERACTIVE_STAGE= build
9422: </pre>
9423:
9424: <p>Multiple interactive stages can be specified:</p>
9425: <pre class="programlisting">
9426: INTERACTIVE_STAGE= configure install
9427: </pre>
9428: </div>
9429:
9430: <div class="sect2" lang="en" xml:lang="en">
9431: <div class="titlepage">
9432: <div>
9433: <div>
1.21 ! ben 9434: <h3 class="title"><a name="id2595767" id=
! 9435: "id2595767"></a>12.5.3. Handling
1.1 grant 9436: licenses</h3>
9437: </div>
9438: </div>
9439: </div>
9440:
9441: <p>A package may underly a license which the user has
9442: or has not agreed to accept. Usually, packages that
9443: underly well-known Open Source licenses (e.g. the GNU
9444: Public License, GPL) won't have any special license
9445: tags added in pkgsrc which require special action by
9446: the user of such packages, but there are quite a number
9447: of other licenses out there that pkgsrc users may not
9448: be able to follow, for whatever reasons. For these
9449: cases, pkgsrc contains a mechanism to note that a
9450: package underlies a certain license, and the user has
9451: to accept the license before the package can be
9452: installed.</p>
9453:
9454: <p>Placing a certain package under a certain license
1.14 xtraeme 9455: works by setting the <code class=
9456: "varname">LICENSE</code> variable to a string
9457: identifying the license, e.g. in <a xmlns=
9458: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 9459: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20 ben 9460: class="pkgname">graphics/graphviz</a>:</p>
1.1 grant 9461: <pre class="programlisting">
9462: LICENSE= graphviz-license
9463: </pre>
9464:
9465: <p>When trying to build, the user will get a notice
9466: that the package underlies a license which he hasn't
9467: accepted (yet):</p>
9468: <pre class="programlisting">
1.14 xtraeme 9469: <code class="prompt">%</code> <strong class=
9470: "userinput"><code>make</code></strong>
1.1 grant 9471: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
9472: ===> To build this package, add this line to your /etc/mk.conf:
9473: ===> ACCEPTABLE_LICENSES+=graphviz-license
9474: ===> To view the license, enter "/usr/bin/make show-license".
9475: *** Error code 1
9476: </pre>
9477:
1.14 xtraeme 9478: <p>The license can be viewed with <span><strong class=
9479: "command">make show-license</strong></span>, and if it
9480: is considered appropriate, the line printed above can
9481: be added to <code class="filename">/etc/mk.conf</code>
9482: to indicate acceptance of the particular license:</p>
1.1 grant 9483: <pre class="programlisting">
9484: ACCEPTABLE_LICENSES+=graphviz-license
9485: </pre>
9486:
9487: <p>When adding a package with a new license, the
1.14 xtraeme 9488: license text should be added to <code class=
9489: "filename">pkgsrc/licenses</code> for displaying. A
9490: list of known licenses can be seen in this directory as
9491: well as by looking at the list of (commented out)
9492: <code class="varname">ACCEPTABLE_LICENSES</code>
9493: variable settings in <code class=
9494: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 9495:
1.17 sketch 9496: <p>If there is a <span class=
1.1 grant 9497: "emphasis"><em>really</em></span> pressing need to
9498: accept all licenses at once, like when trying to
9499: download or mirror all distfiles or doing a bulk build
9500: to test if all packages in pkgsrc build, this can be
1.14 xtraeme 9501: done by setting <code class=
9502: "varname">_ACCEPTABLE=yes</code>.</p>
1.1 grant 9503: </div>
9504:
9505: <div class="sect2" lang="en" xml:lang="en">
9506: <div class="titlepage">
9507: <div>
9508: <div>
1.21 ! ben 9509: <h3 class="title"><a name="id2595918" id=
! 9510: "id2595918"></a>12.5.4. Creating an account
1.1 grant 9511: from a package</h3>
9512: </div>
9513: </div>
9514: </div>
9515:
9516: <p>There are two make variables used to control the
9517: creation of package-specific groups and users at
1.14 xtraeme 9518: pre-install time. The first is <code class=
9519: "varname">PKG_GROUPS</code>, which is a list of
1.1 grant 9520: group[:groupid] elements, where the groupid is
1.14 xtraeme 9521: optional. The second is <code class=
9522: "varname">PKG_USERS</code>, which is a list of elements
1.1 grant 9523: of the form:</p>
9524: <pre class="programlisting">
9525: user:group[:[userid][:[description][:[home][:shell]]]]
9526: </pre>
9527:
9528: <p>where only the user and group are required, the rest
9529: being optional. A simple example is:</p>
9530: <pre class="programlisting">
9531: PKG_GROUPS= foogroup
9532: PKG_USERS= foouser:foogroup
9533: </pre>
9534:
9535: <p>A more complex example is that creates two groups
9536: and two users is:</p>
9537: <pre class="programlisting">
9538: PKG_GROUPS= group1 group2:1005
9539: PKG_USERS= first:group1::First\\ User \
9540: second:group2::Second\\ User:/home/second:${SH}
9541: </pre>
9542:
9543: <p>By default, a new user will have home directory
1.14 xtraeme 9544: <code class="filename">/nonexistent</code>, and login
9545: shell <code class="filename">/sbin/nologin</code>
9546: unless they are specified as part of the user
9547: element.</p>
1.1 grant 9548:
1.14 xtraeme 9549: <p>The package <code class="filename">Makefile</code>
9550: must also set <code class=
9551: "varname">USE_PKGINSTALL=YES</code>. This will cause
9552: the users and groups to be created at pre-install time,
9553: and the admin will be prompted to remove them at
9554: post-deinstall time. Automatic creation of the users
9555: and groups can be toggled on and off by setting the
9556: <code class="varname">PKG_CREATE_USERGROUP</code>
9557: variable prior to package installation.</p>
1.1 grant 9558: </div>
9559:
9560: <div class="sect2" lang="en" xml:lang="en">
9561: <div class="titlepage">
9562: <div>
9563: <div>
1.21 ! ben 9564: <h3 class="title"><a name="id2595980" id=
! 9565: "id2595980"></a>12.5.5. Installing score
1.1 grant 9566: files</h3>
9567: </div>
9568: </div>
9569: </div>
9570:
9571: <p>Certain packages, most of them in the games
9572: category, install a score file that allows all users on
9573: the system to record their highscores. In order for
9574: this to work, the binaries need to be installed setgid
9575: and the score files owned by the appropriate group
9576: and/or owner (traditionally the "games" user/group).
9577: The following variables, documented in more detail in
1.14 xtraeme 9578: <code class="filename">mk/defaults/mk.conf</code>,
9579: control this behaviour: <code class=
9580: "varname">SETGIDGAME</code>, <code class=
9581: "varname">GAMEDATAMODE</code>, <code class=
9582: "varname">GAMEGRP</code>, <code class=
9583: "varname">GAMEMODE</code>, <code class=
9584: "varname">GAMEOWN</code>.</p>
1.1 grant 9585:
9586: <p>Note that per default, setgid installation of games
1.14 xtraeme 9587: is disabled; setting <code class=
9588: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 9589: variables accordingly.</p>
9590:
9591: <p>A package should therefor never hard code file
1.14 xtraeme 9592: ownership or access permissions but rely on
9593: <code class="varname">INSTALL_GAME</code> and
9594: <code class="varname">INSTALL_GAME_DATA</code> to set
9595: these correctly.</p>
1.1 grant 9596: </div>
9597:
9598: <div class="sect2" lang="en" xml:lang="en">
9599: <div class="titlepage">
9600: <div>
9601: <div>
1.21 ! ben 9602: <h3 class="title"><a name="id2596024" id=
! 9603: "id2596024"></a>12.5.6. Packages providing
1.1 grant 9604: login shells</h3>
9605: </div>
9606: </div>
9607: </div>
9608:
9609: <p>If the purpose of the package is to provide a login
1.14 xtraeme 9610: shell, the variable <code class=
9611: "varname">PKG_SHELL</code> should contain the full
9612: pathname of the shell executable installed by this
9613: package. The package <code class=
9614: "filename">Makefile</code> must also set <code class=
9615: "varname">USE_PKGINSTALL=YES</code> to use the
9616: automatically generated <code class=
9617: "filename">INSTALL</code>/<code class=
9618: "filename">DEINSTALL</code> scripts.</p>
1.1 grant 9619:
9620: <p>An example taken from shells/zsh:</p>
9621: <pre class="programlisting">
9622: USE_PKGINSTALL= YES
9623: PKG_SHELL= ${PREFIX}/bin/zsh
9624: </pre>
9625:
1.14 xtraeme 9626: <p>The shell is registered into <code class=
9627: "filename">/etc/shells</code> file automatically in the
9628: post-install target by the generated <code class=
9629: "filename">INSTALL</code> script and removed in the
9630: deinstall target by the <code class=
9631: "filename">DEINSTALL</code> script.</p>
1.1 grant 9632: </div>
9633:
9634: <div class="sect2" lang="en" xml:lang="en">
9635: <div class="titlepage">
9636: <div>
9637: <div>
1.21 ! ben 9638: <h3 class="title"><a name="id2596082" id=
! 9639: "id2596082"></a>12.5.7. Packages containing
1.1 grant 9640: perl scripts</h3>
9641: </div>
9642: </div>
9643: </div>
9644:
9645: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 9646: set <code class="varname">REPLACE_PERL</code> to ensure
9647: that the proper interpreter path is set. <code class=
9648: "varname">REPLACE_PERL</code> should contain a list of
9649: scripts, relative to <code class=
9650: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 9651: </div>
9652:
9653: <div class="sect2" lang="en" xml:lang="en">
9654: <div class="titlepage">
9655: <div>
9656: <div>
1.21 ! ben 9657: <h3 class="title"><a name="id2596100" id=
! 9658: "id2596100"></a>12.5.8. Packages with
1.1 grant 9659: hardcoded paths to other interpreters</h3>
9660: </div>
9661: </div>
9662: </div>
9663:
9664: <p>Your package may also contain scripts with hardcoded
9665: paths to other interpreters besides (or as well as)
9666: perl. To correct the full pathname to the script
9667: interpreter, you need to set the following definitions
1.14 xtraeme 9668: in your <code class="filename">Makefile</code> (we
9669: shall use <span><strong class=
9670: "command">tclsh</strong></span> in this example):</p>
1.1 grant 9671: <pre class="programlisting">
9672: REPLACE_INTERPRETER+= tcl
9673: _REPLACE.tcl.old= .*/bin/tclsh
9674: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
9675: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
9676: relative to ${WRKSRC}, just as in REPLACE_PERL
9677: </pre>
9678: </div>
9679:
9680: <div class="sect2" lang="en" xml:lang="en">
9681: <div class="titlepage">
9682: <div>
9683: <div>
1.21 ! ben 9684: <h3 class="title"><a name="id2596121" id=
! 9685: "id2596121"></a>12.5.9. Packages installing
1.1 grant 9686: perl modules</h3>
9687: </div>
9688: </div>
9689: </div>
9690:
9691: <p>Makefiles of packages providing perl5 modules should
1.14 xtraeme 9692: include the Makefile fragment <code class=
9693: "filename">../../lang/perl5/module.mk</code>. It
9694: provides a <span><strong class=
9695: "command">do-configure</strong></span> target for the
9696: standard perl configuration for such modules as well as
9697: various hooks to tune this configuration. See comments
9698: in this file for details.</p>
1.1 grant 9699:
9700: <p>Perl5 modules will install into different places
9701: depending on the version of perl used during the build
9702: process. To address this, pkgsrc will append lines to
1.14 xtraeme 9703: the <code class="filename">PLIST</code> corresponding
9704: to the files listed in the installed <code class=
9705: "filename">.packlist</code> file generated by most
9706: perl5 modules. This is invoked by defining <code class=
9707: "varname">PERL5_PACKLIST</code> to a space-separated
9708: list of paths to packlist files, e.g.:</p>
1.1 grant 9709: <pre class="programlisting">
9710: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
9711: </pre>
9712:
1.14 xtraeme 9713: <p>The variables <code class=
9714: "varname">PERL5_SITELIB</code>, <code class=
9715: "varname">PERL5_SITEARCH</code>, and <code class=
9716: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 9717: locations in which perl5 modules may be installed, and
9718: may be used by perl5 packages that don't have a
9719: packlist. These three variables are also substituted
1.14 xtraeme 9720: for in the <code class="filename">PLIST</code>.</p>
1.1 grant 9721: </div>
9722:
9723: <div class="sect2" lang="en" xml:lang="en">
9724: <div class="titlepage">
9725: <div>
9726: <div>
9727: <h3 class="title"><a name="faq.info-files" id=
9728: "faq.info-files"></a>12.5.10. Packages
9729: installing info files</h3>
9730: </div>
9731: </div>
9732: </div>
9733:
9734: <p>Some packages install info files or use the
9735: “<span class="quote">makeinfo</span>” or
9736: “<span class="quote">install-info</span>”
9737: commands. Each of the info files:</p>
9738:
9739: <div class="itemizedlist">
9740: <ul type="disc">
9741: <li>
9742: <p>is considered to be installed in the directory
1.14 xtraeme 9743: <code class=
9744: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 9745: </li>
9746:
9747: <li>
9748: <p>is registered in the Info directory file
1.14 xtraeme 9749: <code class=
9750: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 9751: </li>
9752:
9753: <li>
9754: <p>and must be listed as a filename in the
1.14 xtraeme 9755: <code class="varname">INFO_FILES</code> variable
9756: in the package Makefile.</p>
1.1 grant 9757: </li>
9758: </ul>
9759: </div>
9760:
1.14 xtraeme 9761: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 9762: “<span class="quote">info</span>” and can
1.14 xtraeme 9763: be overridden in the package Makefile. <code class=
9764: "filename">INSTALL</code> and <code class=
9765: "filename">DEINSTALL</code> scripts will be generated
9766: to handle registration of the info files in the Info
1.1 grant 9767: directory file. The “<span class=
9768: "quote">install-info</span>” command used for the
9769: info files registration is either provided by the
9770: system, or by a special purpose package automatically
9771: added as dependency if needed.</p>
9772:
9773: <p>A package which needs the “<span class=
9774: "quote">makeinfo</span>” command at build time
1.14 xtraeme 9775: must define the variable <code class=
9776: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 9777: minimum version of the “<span class=
9778: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 9779: should be noted with the <code class=
9780: "varname">TEXINFO_REQD</code> variable in the package
9781: <code class="filename">Makefile</code>. By default, a
1.1 grant 9782: minimum version of 3.12 is required. If the system does
1.14 xtraeme 9783: not provide a <span><strong class=
9784: "command">makeinfo</strong></span> command or if it
9785: does not match the required minimum, a build dependency
9786: on the <a xmlns=
9787: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 9788: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20 ben 9789: class="pkgname">devel/gtexinfo</a> package will be
9790: added automatically.</p>
1.1 grant 9791:
9792: <p>The build and installation process of the software
9793: provided by the package should not use the
1.14 xtraeme 9794: <span><strong class=
9795: "command">install-info</strong></span> command as the
9796: registration of info files is the task of the package
9797: <code class="filename">INSTALL</code> script, and it
9798: must use the appropriate <span><strong class=
9799: "command">makeinfo</strong></span> command.</p>
1.1 grant 9800:
9801: <p>To achieve this goal the pkgsrc infrastructure
1.14 xtraeme 9802: creates overriding scripts for the <span><strong class=
9803: "command">install-info</strong></span> and
9804: <span><strong class="command">makeinfo</strong></span>
9805: commands in a directory listed early in <code class=
9806: "varname">PATH</code>.</p>
1.1 grant 9807:
1.14 xtraeme 9808: <p>The script overriding <span><strong class=
9809: "command">install-info</strong></span> has no effect
9810: except the logging of a message. The script overriding
9811: <span><strong class="command">makeinfo</strong></span>
9812: logs a message and according to the value of
9813: <code class="varname">USE_MAKEINFO</code> and
9814: <code class="varname">TEXINFO_REQD</code> either run
9815: the appropriate <span><strong class=
9816: "command">makeinfo</strong></span> command or exit on
9817: error.</p>
1.1 grant 9818: </div>
9819:
9820: <div class="sect2" lang="en" xml:lang="en">
9821: <div class="titlepage">
9822: <div>
9823: <div>
1.21 ! ben 9824: <h3 class="title"><a name="id2596341" id=
! 9825: "id2596341"></a>12.5.11. Packages installing
1.1 grant 9826: GConf2 data files</h3>
9827: </div>
9828: </div>
9829: </div>
9830:
1.14 xtraeme 9831: <p>If a package installs <code class=
9832: "filename">.schemas</code> or <code class=
9833: "filename">.entries</code> files, used by GConf2, you
1.1 grant 9834: need to take some extra steps to make sure they get
9835: registered in the database:</p>
9836:
9837: <div class="orderedlist">
9838: <ol type="1">
9839: <li>
1.14 xtraeme 9840: <p>Include <code class=
9841: "filename">../../devel/GConf2/schemas.mk</code>
9842: instead of its <code class=
9843: "filename">buildlink3.mk</code> file. This takes
1.1 grant 9844: care of rebuilding the GConf2 database at
9845: installation and deinstallation time, and tells
9846: the package where to install GConf2 data files
9847: using some standard configure arguments. It also
9848: disallows any access to the database directly
9849: from the package.</p>
9850: </li>
9851:
9852: <li>
9853: <p>Ensure that the package installs its
1.14 xtraeme 9854: <code class="filename">.schemas</code> files
9855: under <code class=
9856: "filename">${PREFIX}/share/gconf/schemas</code>.
9857: If they get installed under <code class=
9858: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 9859: manually patch the package.</p>
9860: </li>
9861:
9862: <li>
9863: <p>Check the PLIST and remove any entries under
9864: the etc/gconf directory, as they will be handled
9865: automatically. See <a href="#faq.conf" title=
1.14 xtraeme 9866: "6.14. Configuration files handling and placement">
9867: Section 6.14, “Configuration files
1.1 grant 9868: handling and placement”</a> for more
9869: information.</p>
9870: </li>
9871:
9872: <li>
1.14 xtraeme 9873: <p>Define the <code class=
9874: "varname">GCONF2_SCHEMAS</code> variable in your
9875: <code class="filename">Makefile</code> with a
9876: list of all <code class=
9877: "filename">.schemas</code> files installed by the
9878: package, if any. Names must not contain any
9879: directories in them.</p>
1.1 grant 9880: </li>
9881:
9882: <li>
1.14 xtraeme 9883: <p>Define the <code class=
9884: "varname">GCONF2_ENTRIES</code> variable in your
9885: <code class="filename">Makefile</code> with a
9886: list of all <code class=
9887: "filename">.entries</code> files installed by the
9888: package, if any. Names must not contain any
9889: directories in them.</p>
1.1 grant 9890: </li>
9891: </ol>
9892: </div>
9893: </div>
9894:
9895: <div class="sect2" lang="en" xml:lang="en">
9896: <div class="titlepage">
9897: <div>
9898: <div>
1.21 ! ben 9899: <h3 class="title"><a name="id2596441" id=
! 9900: "id2596441"></a>12.5.12. Packages installing
1.1 grant 9901: scrollkeeper data files</h3>
9902: </div>
9903: </div>
9904: </div>
9905:
1.14 xtraeme 9906: <p>If a package installs <code class=
9907: "filename">.omf</code> files, used by scrollkeeper, you
9908: need to take some extra steps to make sure they get
9909: registered in the database:</p>
1.1 grant 9910:
9911: <div class="orderedlist">
9912: <ol type="1">
9913: <li>
1.14 xtraeme 9914: <p>Include <code class=
9915: "filename">../../textproc/scrollkeeper/omf.mk</code>
9916: instead of its <code class=
9917: "filename">buildlink3.mk</code> file. This takes
1.1 grant 9918: care of rebuilding the scrollkeeper database at
9919: installation and deinstallation time, and
9920: disallows any access to it directly from the
9921: package.</p>
9922: </li>
9923:
9924: <li>
9925: <p>Check the PLIST and remove any entries under
1.14 xtraeme 9926: the <code class=
9927: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 9928: as they will be handled automatically.</p>
9929: </li>
9930:
9931: <li>
1.14 xtraeme 9932: <p>Remove the <code class=
9933: "filename">share/omf</code> directory from the
9934: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 9935: </li>
9936: </ol>
9937: </div>
9938: </div>
9939:
9940: <div class="sect2" lang="en" xml:lang="en">
9941: <div class="titlepage">
9942: <div>
9943: <div>
1.21 ! ben 9944: <h3 class="title"><a name="id2596561" id=
! 9945: "id2596561"></a>12.5.13. Packages installing
1.1 grant 9946: X11 fonts</h3>
9947: </div>
9948: </div>
9949: </div>
9950:
9951: <p>If a package installs font files, you will need to
9952: rebuild the fonts database in the directory where they
9953: get installed at installation and deinstallation time.
1.14 xtraeme 9954: This can be automatically done by using <code class=
9955: "filename">mk/fonts.mk</code>, which you need to
9956: include in your <code class=
9957: "filename">Makefile</code>.</p>
1.1 grant 9958:
9959: <p>When the file is included, you can list the
1.14 xtraeme 9960: directories where fonts are installed in the
9961: <code class="varname">FONTS_<em class=
9962: "replaceable"><code>type</code></em>_DIRS</code>
9963: variables, where <em class=
9964: "replaceable"><code>type</code></em> can be one of
9965: “<span class="quote">TTF</span>”,
1.1 grant 9966: “<span class="quote">TYPE1</span>” or
9967: “<span class="quote">X11</span>”. Also make
1.14 xtraeme 9968: sure that the database file <code class=
9969: "filename">fonts.dir</code> is not listed in the
1.1 grant 9970: PLIST.</p>
9971:
9972: <p>Note that you should not create new directories for
9973: fonts; instead use the standard ones to avoid that the
9974: user needs to manually configure his X server to find
9975: them.</p>
9976: </div>
9977:
9978: <div class="sect2" lang="en" xml:lang="en">
9979: <div class="titlepage">
9980: <div>
9981: <div>
1.21 ! ben 9982: <h3 class="title"><a name="id2596608" id=
! 9983: "id2596608"></a>12.5.14. Packages installing
1.1 grant 9984: GTK2 modules</h3>
9985: </div>
9986: </div>
9987: </div>
9988:
9989: <p>If a package installs gtk2 immodules or loaders, you
9990: need to take some extra steps to get them registered in
9991: the GTK2 database properly:</p>
9992:
9993: <div class="orderedlist">
9994: <ol type="1">
9995: <li>
1.14 xtraeme 9996: <p>Include <code class=
9997: "filename">../../x11/gtk2/modules.mk</code>
9998: instead of its <code class=
9999: "filename">buildlink3.mk</code> file. This takes
10000: care of rebuilding the database at installation
10001: and deinstallation time.</p>
1.1 grant 10002: </li>
10003:
10004: <li>
1.14 xtraeme 10005: <p>Set <code class=
10006: "varname">GTK2_IMMODULES=YES</code> if your
10007: package installs GTK2 immodules.</p>
1.1 grant 10008: </li>
10009:
10010: <li>
1.14 xtraeme 10011: <p>Set <code class=
10012: "varname">GTK2_LOADERS=YES</code> if your package
10013: installs GTK2 loaders.</p>
1.1 grant 10014: </li>
10015:
10016: <li>
10017: <p>Patch the package to not touch any of the gtk2
10018: databases directly. These are:</p>
10019:
10020: <div class="itemizedlist">
10021: <ul type="disc">
10022: <li>
1.14 xtraeme 10023: <p><code class=
10024: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 10025: </li>
10026:
10027: <li>
1.14 xtraeme 10028: <p><code class=
10029: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 10030: </li>
10031: </ul>
10032: </div>
10033: </li>
10034:
10035: <li>
10036: <p>Check the PLIST and remove any entries under
1.14 xtraeme 10037: the <code class="filename">libdata/gtk-2.0</code>
1.1 grant 10038: directory, as they will be handled
10039: automatically.</p>
10040: </li>
10041: </ol>
10042: </div>
10043: </div>
10044:
10045: <div class="sect2" lang="en" xml:lang="en">
10046: <div class="titlepage">
10047: <div>
10048: <div>
1.21 ! ben 10049: <h3 class="title"><a name="id2596745" id=
! 10050: "id2596745"></a>12.5.15. Packages installing
1.1 grant 10051: SGML or XML data</h3>
10052: </div>
10053: </div>
10054: </div>
10055:
10056: <p>If a package installs SGML or XML data files that
10057: need to be registered in system-wide catalogs (like
10058: DTDs, sub-catalogs, etc.), you need to take some extra
10059: steps:</p>
10060:
10061: <div class="orderedlist">
10062: <ol type="1">
10063: <li>
1.14 xtraeme 10064: <p>Include <code class=
10065: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
10066: in your <code class="filename">Makefile</code>,
10067: which takes care of registering those files in
1.1 grant 10068: system-wide catalogs at installation and
10069: deinstallation time.</p>
10070: </li>
10071:
10072: <li>
1.14 xtraeme 10073: <p>Set <code class="varname">SGML_CATALOGS</code>
10074: to the full path of any SGML catalogs installed
10075: by the package.</p>
1.1 grant 10076: </li>
10077:
10078: <li>
1.14 xtraeme 10079: <p>Set <code class="varname">XML_CATALOGS</code>
10080: to the full path of any XML catalogs installed by
1.1 grant 10081: the package.</p>
10082: </li>
10083:
10084: <li>
1.14 xtraeme 10085: <p>Set <code class="varname">SGML_ENTRIES</code>
10086: to individual entries to be added to the SGML
1.1 grant 10087: catalog. These come in groups of three strings;
10088: see xmlcatmgr(1) for more information
10089: (specifically, arguments recognized by the 'add'
10090: action). Note that you will normally not use this
10091: variable.</p>
10092: </li>
10093:
10094: <li>
1.14 xtraeme 10095: <p>Set <code class="varname">XML_ENTRIES</code>
10096: to individual entries to be added to the XML
1.1 grant 10097: catalog. These come in groups of three strings;
10098: see xmlcatmgr(1) for more information
10099: (specifically, arguments recognized by the 'add'
10100: action). Note that you will normally not use this
10101: variable.</p>
10102: </li>
10103: </ol>
10104: </div>
10105: </div>
10106:
10107: <div class="sect2" lang="en" xml:lang="en">
10108: <div class="titlepage">
10109: <div>
10110: <div>
1.21 ! ben 10111: <h3 class="title"><a name="id2596797" id=
! 10112: "id2596797"></a>12.5.16. Packages installing
1.1 grant 10113: extensions to the MIME database</h3>
10114: </div>
10115: </div>
10116: </div>
10117:
10118: <p>If a package provides extensions to the MIME
1.14 xtraeme 10119: database by installing <code class=
10120: "filename">.xml</code> files inside <code class=
10121: "filename">${PREFIX}/share/mime/packages</code>, you
10122: need to take some extra steps to ensure that the
10123: database is kept consistent with respect to these new
10124: files:</p>
1.1 grant 10125:
10126: <div class="orderedlist">
10127: <ol type="1">
10128: <li>
1.14 xtraeme 10129: <p>Include <code class=
10130: "filename">../../databases/shared-mime-info/mimedb.mk</code>
10131: (avoid using the <code class=
10132: "filename">buildlink3.mk</code> file from this
10133: same directory, which is reserved for inclusion
10134: from other <code class=
10135: "filename">buildlink3.mk</code> files). It takes
10136: care of rebuilding the MIME database at
10137: installation and deinstallation time, and
10138: disallows any access to it directly from the
1.1 grant 10139: package.</p>
10140: </li>
10141:
10142: <li>
10143: <p>Check the PLIST and remove any entries under
1.14 xtraeme 10144: the <code class="filename">share/mime</code>
1.1 grant 10145: directory, <span class=
10146: "emphasis"><em>except</em></span> for files saved
1.14 xtraeme 10147: under <code class=
10148: "filename">share/mime/packages</code>. The former
1.1 grant 10149: are handled automatically by the
10150: update-mime-database program, but the later are
10151: package-dependent and must be removed by the
10152: package that installed them in the first
10153: place.</p>
10154: </li>
10155:
10156: <li>
1.14 xtraeme 10157: <p>Remove any <code class=
10158: "filename">share/mime/*</code> directories from
10159: the PLIST. They will be handled by the
1.1 grant 10160: shared-mime-info package.</p>
10161: </li>
10162: </ol>
10163: </div>
10164: </div>
10165:
10166: <div class="sect2" lang="en" xml:lang="en">
10167: <div class="titlepage">
10168: <div>
10169: <div>
1.21 ! ben 10170: <h3 class="title"><a name="id2597004" id=
! 10171: "id2597004"></a>12.5.17. Packages using
1.1 grant 10172: intltool</h3>
10173: </div>
10174: </div>
10175: </div>
10176:
10177: <p>If a package uses intltool during its build, include
1.14 xtraeme 10178: the <code class=
10179: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 10180: file, which forces it to use the intltool package
10181: provided by pkgsrc, instead of the one bundled with the
10182: distribution file.</p>
10183:
10184: <p>This tracks intltool's build-time dependencies and
10185: uses the latest available version; this way, the
10186: package benefits of any bug fixes that may have
10187: appeared since it was released.</p>
10188: </div>
1.18 xtraeme 10189:
10190: <div class="sect2" lang="en" xml:lang="en">
10191: <div class="titlepage">
10192: <div>
10193: <div>
1.21 ! ben 10194: <h3 class="title"><a name="id2597018" id=
! 10195: "id2597018"></a>12.5.18. Packages installing
1.18 xtraeme 10196: startup scripts</h3>
10197: </div>
10198: </div>
10199: </div>
10200:
10201: <p>If a package contains a rc.d script, it won't be
10202: copied into the startup directory by default, but you
10203: can enable it, by adding the option <code class=
10204: "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
10205: "filename">/etc/mk.conf</code>. This option will copy
10206: the scripts into <code class=
10207: "filename">/etc/rc.d</code> when a package is
10208: installed, and it will automatically remove the scripts
10209: when the package is deinstalled.</p>
10210: </div>
1.1 grant 10211: </div>
10212:
10213: <div class="sect1" lang="en" xml:lang="en">
10214: <div class="titlepage">
10215: <div>
10216: <div>
10217: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 10218: "id2597040" id="id2597040"></a>12.6. Feedback
1.1 grant 10219: to the author</h2>
10220: </div>
10221: </div>
10222: </div>
10223:
10224: <p>If you have found any bugs in the package you make
10225: available, if you had to do special steps to make it run
10226: under NetBSD or if you enhanced the software in various
10227: other ways, be sure to report these changes back to the
10228: original author of the program! With that kind of
10229: support, the next release of the program can incorporate
10230: these fixes, and people not using the NetBSD packages
10231: system can win from your efforts.</p>
10232:
10233: <p>Support the idea of free software!</p>
10234: </div>
10235: </div>
10236:
10237: <div class="chapter" lang="en" xml:lang="en">
10238: <div class="titlepage">
10239: <div>
10240: <div>
10241: <h2 class="title"><a name="debug" id=
10242: "debug"></a>Chapter 13. Debugging</h2>
10243: </div>
10244: </div>
10245: </div>
10246:
10247: <p>To check out all the gotchas when building a package,
10248: here are the steps that I do in order to get a package
10249: working. Please note this is basically the same as what was
10250: explained in the previous sections, only with some
10251: debugging aids.</p>
10252:
10253: <div class="itemizedlist">
10254: <ul type="disc">
10255: <li>
1.14 xtraeme 10256: <p>Be sure to set <code class=
10257: "varname">PKG_DEVELOPER=1</code> in <code class=
10258: "filename">/etc/mk.conf</code></p>
1.1 grant 10259: </li>
10260:
10261: <li>
10262: <p>Install <a xmlns=
10263: "http://www.w3.org/TR/xhtml1/transitional" href=
10264: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20 ben 10265: class="pkgname">pkgtools/url2pkg</a>, create a
10266: directory for a new package, change into it, then run
10267: <span><strong class=
10268: "command">url2pkg</strong></span>:</p>
1.1 grant 10269: <pre class="screen">
1.14 xtraeme 10270: <code class="prompt">%</code> <strong class=
10271: "userinput"><code>mkdir /usr/pkgsrc/<em class=
10272: "replaceable"><code>category</code></em>/<em class=
10273: "replaceable"><code>examplepkg</code></em></code></strong>
10274: <code class="prompt">%</code> <strong class=
10275: "userinput"><code>cd /usr/pkgsrc/<em class=
10276: "replaceable"><code>category</code></em>/<em class=
10277: "replaceable"><code>examplepkg</code></em></code></strong>
10278: <code class="prompt">%</code> <strong class=
10279: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 10280: </pre>
10281: </li>
10282:
10283: <li>
1.14 xtraeme 10284: <p>Edit the <code class="filename">Makefile</code> as
1.1 grant 10285: requested.</p>
10286: </li>
10287:
10288: <li>
1.14 xtraeme 10289: <p>Fill in the <code class="filename">DESCR</code>
1.1 grant 10290: file</p>
10291: </li>
10292:
10293: <li>
1.14 xtraeme 10294: <p>Run <span><strong class="command">make
10295: configure</strong></span></p>
1.1 grant 10296: </li>
10297:
10298: <li>
10299: <p>Add any dependencies glimpsed from documentation
1.14 xtraeme 10300: and the configure step to the package's <code class=
10301: "filename">Makefile</code>.</p>
1.1 grant 10302: </li>
10303:
10304: <li>
10305: <p>Make the package compile, doing multiple rounds
10306: of</p>
10307: <pre class="screen">
1.14 xtraeme 10308: <code class="prompt">%</code> <strong class=
10309: "userinput"><code>make</code></strong>
10310: <code class="prompt">%</code> <strong class=
10311: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
10312: <code class="prompt">%</code> <strong class=
10313: "userinput"><code>mkpatches</code></strong>
10314: <code class="prompt">%</code> <strong class=
10315: "userinput"><code>patchdiff</code></strong>
10316: <code class="prompt">%</code> <strong class=
10317: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
10318: <code class="prompt">%</code> <strong class=
10319: "userinput"><code>make mps</code></strong>
10320: <code class="prompt">%</code> <strong class=
10321: "userinput"><code>make clean</code></strong>
1.1 grant 10322: </pre>
10323:
10324: <p>Doing as non-root user will ensure that no files
10325: are modified that shouldn't be, especially during the
1.14 xtraeme 10326: build phase. <span><strong class=
10327: "command">mkpatches</strong></span>,
10328: <span><strong class=
10329: "command">patchdiff</strong></span> and
10330: <span><strong class="command">pkgvi</strong></span>
10331: are from the <a xmlns=
1.1 grant 10332: "http://www.w3.org/TR/xhtml1/transitional" href=
10333: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 10334: class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1 grant 10335: </li>
10336:
10337: <li>
1.14 xtraeme 10338: <p>Look at the <code class=
10339: "filename">Makefile</code>, fix if necessary; see
10340: <a href="#components.Makefile" title=
10341: "7.1. Makefile">Section 7.1,
10342: “<code class=
10343: "filename">Makefile</code>”</a>.</p>
1.1 grant 10344: </li>
10345:
10346: <li>
1.14 xtraeme 10347: <p>Generate a <code class=
10348: "filename">PLIST</code>:</p>
1.1 grant 10349: <pre class="screen">
1.14 xtraeme 10350: <code class="prompt">#</code> <strong class=
10351: "userinput"><code>make install</code></strong>
10352: <code class="prompt">#</code> <strong class=
10353: "userinput"><code>make print-PLIST >PLIST</code></strong>
10354: <code class="prompt">#</code> <strong class=
10355: "userinput"><code>make deinstall</code></strong>
10356: <code class="prompt">#</code> <strong class=
10357: "userinput"><code>make install</code></strong>
10358: <code class="prompt">#</code> <strong class=
10359: "userinput"><code>make deinstall</code></strong>
1.1 grant 10360: </pre>
10361:
1.14 xtraeme 10362: <p>You usually need to be <code class=
10363: "username">root</code> to do this. Look if there are
1.1 grant 10364: any files left:</p>
10365: <pre class="screen">
1.14 xtraeme 10366: <code class="prompt">#</code> <strong class=
10367: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 10368: </pre>
10369:
10370: <p>If this reveals any files that are missing in
1.14 xtraeme 10371: <code class="filename">PLIST</code>, add them.</p>
1.1 grant 10372: </li>
10373:
10374: <li>
1.14 xtraeme 10375: <p>Now that the <code class="filename">PLIST</code>
10376: is OK, install the package again and make a binary
1.1 grant 10377: package:</p>
10378: <pre class="screen">
1.14 xtraeme 10379: <code class="prompt">#</code> <strong class=
10380: "userinput"><code>make reinstall</code></strong>
10381: <code class="prompt">#</code> <strong class=
10382: "userinput"><code>make package</code></strong>
1.1 grant 10383: </pre>
10384: </li>
10385:
10386: <li>
10387: <p>Delete the installed package:</p>
10388: <pre class="screen">
1.14 xtraeme 10389: <code class="prompt">#</code> <strong class=
10390: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 10391: </pre>
10392: </li>
10393:
10394: <li>
1.14 xtraeme 10395: <p>Repeat the above <span><strong class=
10396: "command">make print-PLIST</strong></span> command,
10397: which shouldn't find anything now:</p>
1.1 grant 10398: <pre class="screen">
1.14 xtraeme 10399: <code class="prompt">#</code> <strong class=
10400: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 10401: </pre>
10402: </li>
10403:
10404: <li>
10405: <p>Reinstall the binary package:</p>
10406: <pre class="screen">
1.14 xtraeme 10407: <code class="prompt">#</code> <strong class=
10408: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 10409: </pre>
10410: </li>
10411:
10412: <li>
10413: <p>Play with it. Make sure everything works.</p>
10414: </li>
10415:
10416: <li>
1.14 xtraeme 10417: <p>Run <span><strong class=
10418: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 10419: "http://www.w3.org/TR/xhtml1/transitional" href=
10420: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 10421: class="pkgname">pkgtools/pkglint</a>, and fix the
10422: problems it reports:</p>
1.1 grant 10423: <pre class="screen">
1.14 xtraeme 10424: <code class="prompt">#</code> <strong class=
10425: "userinput"><code>pkglint</code></strong>
1.1 grant 10426: </pre>
10427: </li>
10428:
10429: <li>
10430: <p>Submit (or commit, if you have cvs access); see
10431: <a href="#submit" title=
10432: "Chapter 14. Submitting and Committing">Chapter 14,
10433: <i>Submitting and Committing</i></a>.</p>
10434: </li>
10435: </ul>
10436: </div>
10437: </div>
10438:
10439: <div class="chapter" lang="en" xml:lang="en">
10440: <div class="titlepage">
10441: <div>
10442: <div>
10443: <h2 class="title"><a name="submit" id=
10444: "submit"></a>Chapter 14. Submitting and
10445: Committing</h2>
10446: </div>
10447: </div>
10448: </div>
10449:
10450: <div class="toc">
10451: <p><b>Table of Contents</b></p>
10452:
10453: <dl>
1.21 ! ben 10454: <dt><span class="sect1"><a href="#id2597570">14.1.
1.1 grant 10455: Submitting your packages</a></span></dt>
10456:
1.21 ! ben 10457: <dt><span class="sect1"><a href="#id2597621">14.2.
1.1 grant 10458: Committing: Importing a package into
10459: CVS</a></span></dt>
10460:
1.21 ! ben 10461: <dt><span class="sect1"><a href="#id2597752">14.3.
1.2 hubertf 10462: Updating a package to a newer version</a></span></dt>
1.1 grant 10463:
1.21 ! ben 10464: <dt><span class="sect1"><a href="#id2597771">14.4.
1.2 hubertf 10465: Moving a package in pkgsrc</a></span></dt>
1.1 grant 10466: </dl>
10467: </div>
10468:
10469: <div class="sect1" lang="en" xml:lang="en">
10470: <div class="titlepage">
10471: <div>
10472: <div>
10473: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 10474: "id2597570" id=
! 10475: "id2597570"></a>14.1. Submitting your
1.1 grant 10476: packages</h2>
10477: </div>
10478: </div>
10479: </div>
10480:
10481: <p>You have to separate between binary and
10482: “<span class="quote">normal</span>” (source)
10483: packages here:</p>
10484:
10485: <div class="itemizedlist">
10486: <ul type="disc">
10487: <li>
10488: <p>precompiled binary packages</p>
10489:
10490: <p>Our policy is that we accept binaries only from
10491: pkgsrc developers to guarantee that the packages
10492: don't contain any trojan horses etc. This is not to
1.13 hubertf 10493: annoy anyone but rather to protect our users!
1.1 grant 10494: You're still free to put up your home-made binary
1.13 hubertf 10495: packages and tell the world where to get them.
10496: NetBSD developers doing bulk builds and wanting to
10497: upload them please see <a href="#bulk-upload"
10498: title="5.3.8. Uploading results of a bulk build">
10499: Section 5.3.8, “Uploading results of a
10500: bulk build”</a>.</p>
1.1 grant 10501: </li>
10502:
10503: <li>
10504: <p>packages</p>
10505:
10506: <p>First, check that your package is complete,
10507: compiles and runs well; see <a href="#debug" title=
10508: "Chapter 13. Debugging">Chapter 13,
10509: <i>Debugging</i></a> and the rest of this document.
10510: Next, generate an uuencoded gzipped tar(1) archive,
10511: preferably with all files in a single directory.
1.14 xtraeme 10512: Finally, <span><strong class=
10513: "command">send-pr</strong></span> with category
1.1 grant 10514: “<span class="quote">pkg</span>”, a
10515: synopsis which includes the package name and
10516: version number, a short description of your package
10517: (contents of the COMMENT variable or DESCR file are
10518: OK) and attach the archive to your PR.</p>
10519:
10520: <p>If you want to submit several packages, please
10521: send a separate PR for each one, it's easier for us
10522: to track things that way.</p>
10523:
10524: <p>Alternatively, you can also import new packages
10525: into pkgsrc-wip (“<span class="quote">pkgsrc
10526: work-in-progress</span>”); see the homepage
10527: at <a href="http://pkgsrc-wip.sourceforge.net/"
10528: target=
10529: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
10530: details.</p>
10531: </li>
10532: </ul>
10533: </div>
10534: </div>
10535:
10536: <div class="sect1" lang="en" xml:lang="en">
10537: <div class="titlepage">
10538: <div>
10539: <div>
10540: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 10541: "id2597621" id=
! 10542: "id2597621"></a>14.2. Committing: Importing a
1.1 grant 10543: package into CVS</h2>
10544: </div>
10545: </div>
10546: </div>
10547:
10548: <p>This section is only of interest for pkgsrc developers
10549: with write access to the pkgsrc repository. Please
10550: remember that cvs imports files relative to the current
10551: working directory, and that the pathname that you give
1.14 xtraeme 10552: the <span><strong class="command">cvs
10553: import</strong></span> command is so that it knows where
10554: to place the files in the repository. Newly created
10555: packages should be imported with a vendor tag of
10556: “<span class="quote">TNF</span>” and a
10557: release tag of “<span class=
10558: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 10559: <pre class="programlisting">
10560: % cd .../pkgsrc/category/pkgname
10561: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
10562: </pre>
10563:
10564: <p>Remember to move the directory from which you imported
10565: out of the way, or cvs will complain the next time you
10566: “<span class="quote">cvs update</span>” your
10567: source tree. Also don't forget to add the new package to
1.14 xtraeme 10568: the category's <code class=
10569: "filename">Makefile</code>.</p>
1.1 grant 10570:
10571: <p>The commit message of the initial import should
1.14 xtraeme 10572: include part of the <code class="filename">DESCR</code>
10573: file, so people reading the mailing lists know what the
10574: package is/does.</p>
1.1 grant 10575:
10576: <p>Please note all package updates/additions in
1.14 xtraeme 10577: <code class="filename">pkgsrc/doc/CHANGES</code>. It's
10578: very important to keep this file up to date and
10579: conforming to the existing format, because it will be
10580: used by scripts to automatically update pages on <a href=
1.1 grant 10581: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
10582: and other sites. Additionally, check the pkgsrc/doc/TODO
10583: file and remove the entry for the package you updated, in
10584: case it was mentioned there.</p>
10585:
10586: <p>For new packages, “<span class="quote">cvs
10587: import</span>” is preferred to “<span class=
10588: "quote">cvs add</span>” because the former gets
10589: everything with a single command, and provides a
10590: consistent tag.</p>
10591: </div>
10592:
10593: <div class="sect1" lang="en" xml:lang="en">
10594: <div class="titlepage">
10595: <div>
10596: <div>
10597: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 10598: "id2597752" id="id2597752"></a>14.3. Updating
1.2 hubertf 10599: a package to a newer version</h2>
1.1 grant 10600: </div>
10601: </div>
10602: </div>
10603:
10604: <p>Please always put a concise, appropriate and relevant
10605: summary of the changes between old and new versions into
10606: the commit log when updating a package. There are various
10607: reasons for this:</p>
10608:
10609: <div class="itemizedlist">
10610: <ul type="disc">
10611: <li>
10612: <p>A URL is volatile, and can change over time. It
10613: may go away completely or its information may be
10614: overwritten by newer information.</p>
10615: </li>
10616:
10617: <li>
10618: <p>Having the change information between old and
10619: new versions in our CVS repository is very useful
10620: for people who use either cvs or anoncvs.</p>
10621: </li>
10622:
10623: <li>
10624: <p>Having the change information between old and
10625: new versions in our CVS repository is very useful
10626: for people who read the pkgsrc-changes mailing
10627: list, so that they can make tactical decisions
10628: about when to upgrade the package.</p>
10629: </li>
10630: </ul>
10631: </div>
10632:
1.18 xtraeme 10633: <p>Please also recognize that, just because a new version
1.1 grant 10634: of a package has been released, it should not
10635: automatically be upgraded in the CVS repository. We
10636: prefer to be conservative in the packages that are
10637: included in pkgsrc - development or beta packages are not
10638: really the best thing for most places in which pkgsrc is
10639: used. Please use your judgement about what should go into
10640: pkgsrc, and bear in mind that stability is to be
10641: preferred above new and possibly untested features.</p>
10642: </div>
10643:
10644: <div class="sect1" lang="en" xml:lang="en">
10645: <div class="titlepage">
10646: <div>
10647: <div>
10648: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 10649: "id2597771" id="id2597771"></a>14.4. Moving a
1.2 hubertf 10650: package in pkgsrc</h2>
1.1 grant 10651: </div>
10652: </div>
10653: </div>
10654:
10655: <div class="orderedlist">
10656: <ol type="1">
10657: <li>
10658: <p>Make a copy of the directory somewhere else.</p>
10659: </li>
10660:
10661: <li>
10662: <p>Remove all CVS dirs.</p>
10663:
10664: <p>Alternatively to the first two steps you can
10665: also do:</p>
10666: <pre class="screen">
1.14 xtraeme 10667: <code class="prompt">%</code> <strong class=
10668: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 10669: </pre>
10670:
10671: <p>and use that for further work.</p>
10672: </li>
10673:
10674: <li>
1.14 xtraeme 10675: <p>Fix <code class="varname">CATEGORIES</code> and
10676: any <code class="varname">DEPENDS</code> paths that
10677: just did “<span class=
1.1 grant 10678: "quote">../package</span>” instead of
10679: “<span class=
10680: "quote">../../category/package</span>”.</p>
10681: </li>
10682:
10683: <li>
1.14 xtraeme 10684: <p><span><strong class="command">cvs
10685: import</strong></span> the modified package in the
10686: new place.</p>
1.1 grant 10687: </li>
10688:
10689: <li>
10690: <p>Check if any package depends on it:</p>
10691: <pre class="screen">
1.14 xtraeme 10692: <code class="prompt">%</code> <strong class=
10693: "userinput"><code>cd /usr/pkgsrc</code></strong>
10694: <code class="prompt">%</code> <strong class=
10695: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 10696: </pre>
10697: </li>
10698:
10699: <li>
10700: <p>Fix paths in packages from step 5 to point to
10701: new location.</p>
10702: </li>
10703:
10704: <li>
1.14 xtraeme 10705: <p><span><strong class="command">cvs rm
10706: (-f)</strong></span> the package at the old
10707: location.</p>
1.1 grant 10708: </li>
10709:
10710: <li>
1.14 xtraeme 10711: <p>Remove from <code class=
10712: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 10713: </li>
10714:
10715: <li>
1.14 xtraeme 10716: <p>Add to <code class=
10717: "filename">newcategory/Makefile</code>.</p>
1.1 grant 10718: </li>
10719:
10720: <li>
10721: <p>Commit the changed and removed files:</p>
10722: <pre class="screen">
1.14 xtraeme 10723: <code class="prompt">%</code> <strong class=
10724: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 10725: </pre>
10726:
10727: <p>(and any packages from step 5, of course).</p>
10728: </li>
10729: </ol>
10730: </div>
10731: </div>
10732: </div>
10733: </div>
10734:
10735: <div class="appendix" lang="en" xml:lang="en">
10736: <div class="titlepage">
10737: <div>
10738: <div>
10739: <h2 class="title"><a name="examples" id=
10740: "examples"></a>Appendix A. A simple example
10741: package: bison</h2>
10742: </div>
10743: </div>
10744: </div>
10745:
10746: <div class="toc">
10747: <p><b>Table of Contents</b></p>
10748:
10749: <dl>
1.21 ! ben 10750: <dt><span class="sect1"><a href="#id2597997">A.1.
1.1 grant 10751: files</a></span></dt>
10752:
10753: <dd>
10754: <dl>
1.21 ! ben 10755: <dt><span class="sect2"><a href="#id2598001">A.1.1.
1.1 grant 10756: Makefile</a></span></dt>
10757:
1.21 ! ben 10758: <dt><span class="sect2"><a href="#id2598008">A.1.2.
1.1 grant 10759: DESCR</a></span></dt>
10760:
1.21 ! ben 10761: <dt><span class="sect2"><a href="#id2598023">A.1.3.
1.1 grant 10762: PLIST</a></span></dt>
10763:
1.21 ! ben 10764: <dt><span class="sect2"><a href="#id2598030">A.1.4.
1.14 xtraeme 10765: Checking a package with <span><strong class=
10766: "command">pkglint</strong></span></a></span></dt>
1.1 grant 10767: </dl>
10768: </dd>
10769:
1.21 ! ben 10770: <dt><span class="sect1"><a href="#id2598071">A.2. Steps
1.1 grant 10771: for building, installing, packaging</a></span></dt>
10772: </dl>
10773: </div>
10774:
10775: <p>We checked to find a piece of software that wasn't in the
10776: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 10777: would want to have <span><strong class=
10778: "command">bison</strong></span> when Berkeley
10779: <span><strong class="command">yacc</strong></span> is already
10780: present in the tree is beyond us, but it's useful for the
10781: purposes of this exercise.</p>
1.1 grant 10782:
10783: <div class="sect1" lang="en" xml:lang="en">
10784: <div class="titlepage">
10785: <div>
10786: <div>
10787: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 10788: "id2597997" id="id2597997"></a>A.1. files</h2>
1.1 grant 10789: </div>
10790: </div>
10791: </div>
10792:
10793: <div class="sect2" lang="en" xml:lang="en">
10794: <div class="titlepage">
10795: <div>
10796: <div>
1.21 ! ben 10797: <h3 class="title"><a name="id2598001" id=
! 10798: "id2598001"></a>A.1.1. Makefile</h3>
1.1 grant 10799: </div>
10800: </div>
10801: </div>
10802: <pre class="programlisting">
1.17 sketch 10803: # $NetBSD$
1.1 grant 10804: #
10805:
10806: DISTNAME= bison-1.25
10807: CATEGORIES= devel
10808: MASTER_SITES= ${MASTER_SITE_GNU}
10809:
10810: MAINTAINER= thorpej@NetBSD.org
10811: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
10812: COMMENT= GNU yacc clone
10813:
10814: GNU_CONFIGURE= yes
10815: INFO_FILES= bison.info
10816:
10817: .include "../../mk/bsd.pkg.mk"
10818: </pre>
10819: </div>
10820:
10821: <div class="sect2" lang="en" xml:lang="en">
10822: <div class="titlepage">
10823: <div>
10824: <div>
1.21 ! ben 10825: <h3 class="title"><a name="id2598008" id=
! 10826: "id2598008"></a>A.1.2. DESCR</h3>
1.1 grant 10827: </div>
10828: </div>
10829: </div>
10830: <pre class="programlisting">
10831: GNU version of yacc. Can make re-entrant parsers, and numerous other
10832: improvements. Why you would want this when Berkeley <a href=
10833: "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
10834: of the NetBSD source tree is beyond me.
10835: </pre>
10836: </div>
10837:
10838: <div class="sect2" lang="en" xml:lang="en">
10839: <div class="titlepage">
10840: <div>
10841: <div>
1.21 ! ben 10842: <h3 class="title"><a name="id2598023" id=
! 10843: "id2598023"></a>A.1.3. PLIST</h3>
1.1 grant 10844: </div>
10845: </div>
10846: </div>
10847: <pre class="programlisting">
1.17 sketch 10848: @comment $NetBSD$
1.1 grant 10849: bin/bison
10850: man/man1/bison.1.gz
10851: share/bison.simple
10852: share/bison.hairy
10853: </pre>
10854: </div>
10855:
10856: <div class="sect2" lang="en" xml:lang="en">
10857: <div class="titlepage">
10858: <div>
10859: <div>
1.21 ! ben 10860: <h3 class="title"><a name="id2598030" id=
! 10861: "id2598030"></a>A.1.4. Checking a package with
1.14 xtraeme 10862: <span><strong class=
10863: "command">pkglint</strong></span></h3>
1.1 grant 10864: </div>
10865: </div>
10866: </div>
10867:
10868: <p>The NetBSD package system comes with <a xmlns=
10869: "http://www.w3.org/TR/xhtml1/transitional" href=
10870: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 10871: class="pkgname">pkgtools/pkglint</a> which helps to check
10872: the contents of these files. After installation it is
10873: quite easy to use, just change to the directory of the
10874: package you wish to examine and execute
10875: <span><strong class=
10876: "command">pkglint</strong></span>:</p>
1.1 grant 10877: <pre class="screen">
1.14 xtraeme 10878: <code class="prompt">$</code> <strong class=
10879: "userinput"><code>pkglint</code></strong>
1.1 grant 10880: OK: checking ./DESCR.
10881: OK: checking Makefile.
10882: OK: checking distinfo.
10883: OK: checking patches/patch-aa.
10884: looks fine.
10885: </pre>
10886:
10887: <p>Depending on the supplied command line arguments (see
10888: pkglint(1)) more verbose checks will be performed. Use
1.14 xtraeme 10889: e.g. <span><strong class="command">pkglint
10890: -v</strong></span> for a very verbose check.</p>
1.1 grant 10891: </div>
10892: </div>
10893:
10894: <div class="sect1" lang="en" xml:lang="en">
10895: <div class="titlepage">
10896: <div>
10897: <div>
10898: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 10899: "id2598071" id="id2598071"></a>A.2. Steps for
1.1 grant 10900: building, installing, packaging</h2>
10901: </div>
10902: </div>
10903: </div>
10904:
10905: <p>Create the directory where the package lives, plus any
10906: auxiliary directories:</p>
10907: <pre class="screen">
1.14 xtraeme 10908: <code class="prompt">#</code> <strong class=
10909: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
10910: <code class="prompt">#</code> <strong class=
10911: "userinput"><code>mkdir bison</code></strong>
10912: <code class="prompt">#</code> <strong class=
10913: "userinput"><code>cd bison</code></strong>
10914: <code class="prompt">#</code> <strong class=
10915: "userinput"><code>mkdir patches</code></strong>
1.1 grant 10916: </pre>
10917:
1.14 xtraeme 10918: <p>Create <code class="filename">Makefile</code>,
10919: <code class="filename">DESCR</code> and <code class=
10920: "filename">PLIST</code> (see <a href="#components" title=
1.1 grant 10921: "Chapter 7. Package components - files, directories and contents">
10922: Chapter 7, <i>Package components - files, directories and
10923: contents</i></a>) then continue with fetching the
10924: distfile:</p>
10925: <pre class="screen">
1.14 xtraeme 10926: <code class="prompt">#</code> <strong class=
10927: "userinput"><code>make fetch</code></strong>
1.1 grant 10928: >> bison-1.25.tar.gz doesn't seem to exist on this system.
10929: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
10930: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10931: ftp: Error retrieving file: 500 Internal error
10932:
10933: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
10934: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10935: ftp: Error retrieving file: 500 Internal error
10936:
10937: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
10938: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10939: Successfully retrieved file.
10940: </pre>
10941:
1.14 xtraeme 10942: <p>Generate the checksum of the distfile into <code class=
10943: "filename">distinfo</code>:</p>
1.1 grant 10944: <pre class="screen">
1.14 xtraeme 10945: <code class="prompt">#</code> <strong class=
10946: "userinput"><code>make makesum</code></strong>
1.1 grant 10947: </pre>
10948:
10949: <p>Now compile:</p>
10950: <pre class="screen">
1.14 xtraeme 10951: <code class="prompt">#</code> <strong class=
10952: "userinput"><code>make</code></strong>
1.1 grant 10953: >> Checksum OK for bison-1.25.tar.gz.
10954: ===> Extracting for bison-1.25
10955: ===> Patching for bison-1.25
10956: ===> Ignoring empty patch directory
10957: ===> Configuring for bison-1.25
10958: creating cache ./config.cache
10959: checking for gcc... cc
10960: checking whether we are using GNU C... yes
10961: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
10962: checking how to run the C preprocessor... cc -E
10963: checking for minix/config.h... no
10964: checking for POSIXized ISC... no
10965: checking whether cross-compiling... no
10966: checking for ANSI C header files... yes
10967: checking for string.h... yes
10968: checking for stdlib.h... yes
10969: checking for memory.h... yes
10970: checking for working const... yes
10971: checking for working alloca.h... no
10972: checking for alloca... yes
10973: checking for strerror... yes
10974: updating cache ./config.cache
10975: creating ./config.status
10976: creating Makefile
10977: ===> Building for bison-1.25
10978: 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
10979: 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
10980: 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
10981: 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
10982: 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
10983: 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
10984: 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
10985: 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
10986: 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
10987: 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
10988: 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
10989: 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
10990: 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
10991: 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
10992: 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
10993: 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
10994: 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
10995: 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
10996: 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
10997: 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
10998: 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
10999: 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
11000: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
11001: rm -f bison.s1
11002: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
11003: </pre>
11004:
11005: <p>Everything seems OK, so install the files:</p>
11006: <pre class="screen">
1.14 xtraeme 11007: <code class="prompt">#</code> <strong class=
11008: "userinput"><code>make install</code></strong>
1.1 grant 11009: >> Checksum OK for bison-1.25.tar.gz.
11010: ===> Installing for bison-1.25
11011: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
11012: rm -f /usr/pkg/bin/bison
11013: cd /usr/pkg/share; rm -f bison.simple bison.hairy
11014: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
11015: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
11016: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
11017: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
11018: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
11019: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
11020: ===> Registering installation for bison-1.25
11021: </pre>
11022:
11023: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 11024: remove it with <span><strong class="command">pkg_delete
11025: bison</strong></span>. Should you decide that you want a
11026: binary package, do this now:</p>
1.1 grant 11027: <pre class="screen">
1.14 xtraeme 11028: <code class="prompt">#</code> <strong class=
11029: "userinput"><code>make package</code></strong>
1.1 grant 11030: >> Checksum OK for bison-1.25.tar.gz.
11031: ===> Building package for bison-1.25
11032: Creating package bison-1.25.tgz
11033: Registering depends:.
11034: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
11035: </pre>
11036:
11037: <p>Now that you don't need the source and object files any
11038: more, clean up:</p>
11039: <pre class="screen">
1.14 xtraeme 11040: <code class="prompt">#</code> <strong class=
11041: "userinput"><code>make clean</code></strong>
1.1 grant 11042: ===> Cleaning for bison-1.25
11043: </pre>
11044: </div>
11045: </div>
11046:
11047: <div class="appendix" lang="en" xml:lang="en">
11048: <div class="titlepage">
11049: <div>
11050: <div>
11051: <h2 class="title"><a name="logs" id=
11052: "logs"></a>Appendix B. Build logs</h2>
11053: </div>
11054: </div>
11055: </div>
11056:
11057: <div class="toc">
11058: <p><b>Table of Contents</b></p>
11059:
11060: <dl>
11061: <dt><span class="sect1"><a href="#logs.building">B.1.
11062: Building figlet</a></span></dt>
11063:
11064: <dt><span class="sect1"><a href="#logs.package">B.2.
11065: Packaging figlet</a></span></dt>
11066: </dl>
11067: </div>
11068:
11069: <div class="sect1" lang="en" xml:lang="en">
11070: <div class="titlepage">
11071: <div>
11072: <div>
11073: <h2 class="title" style="clear: both"><a name=
11074: "logs.building" id=
11075: "logs.building"></a>B.1. Building figlet</h2>
11076: </div>
11077: </div>
11078: </div>
11079: <pre class="screen">
1.14 xtraeme 11080: <code class="prompt">#</code> <strong class=
11081: "userinput"><code>make</code></strong>
1.1 grant 11082: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11083: => figlet221.tar.gz doesn't seem to exist on this system.
11084: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
11085: => [172219 bytes]
11086: Connected to ftp.plig.net.
11087: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
11088: 331 Guest login ok, send your complete e-mail address as password.
11089: 230-You are user #5 of 500 simultaneous users allowed.
11090: 230-
11091: 230- ___ _ _ _
11092: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
11093: 230- | _| _| . |_| . | | | . |_| . | _| . |
11094: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
11095: 230- |_| |_| |___| |___|
11096: 230-
11097: 230-** Welcome to ftp.plig.org **
11098: 230-
11099: 230-Please note that all transfers from this FTP site are logged. If you
11100: 230-do not like this, please disconnect now.
11101: 230-
11102: 230-This arhive is available via
11103: 230-
11104: 230-HTTP: http://ftp.plig.org/
11105: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
11106: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
11107: 230-
11108: 230-Please email comments, bug reports and requests for packages to be
11109: 230-mirrored to ftp-admin@plig.org.
11110: 230-
11111: 230-
11112: 230 Logged in anonymously.
11113: Remote system type is UNIX.
11114: Using binary mode to transfer files.
11115: 200 Type okay.
11116: 250 "/pub" is new cwd.
11117: 250-"/pub/figlet" is new cwd.
11118: 250-
11119: 250-Welcome to the figlet archive at ftp.figlet.org
11120: 250-
11121: 250- ftp://ftp.figlet.org/pub/figlet/
11122: 250-
11123: 250-The official FIGlet web page is:
11124: 250- http://www.figlet.org/
11125: 250-
11126: 250-If you have questions, please mailto:info@figlet.org. If you want to
11127: 250-contribute a font or something else, you can email us.
11128: 250
11129: 250 "/pub/figlet/program" is new cwd.
11130: 250 "/pub/figlet/program/unix" is new cwd.
11131: local: figlet221.tar.gz remote: figlet221.tar.gz
11132: 502 Unimplemented command.
11133: 227 Entering Passive Mode (195,40,6,41,246,104)
11134: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
11135: 38% |************** | 65800 64.16 KB/s 00:01 ETA
11136: 226 Transfer completed.
11137: 172219 bytes received in 00:02 (75.99 KB/s)
11138: 221 Goodbye.
11139: => Checksum OK for figlet221.tar.gz.
11140: ===> Extracting for figlet-2.2.1nb2
11141: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
11142: ===> Patching for figlet-2.2.1nb2
11143: ===> Applying pkgsrc patches for figlet-2.2.1nb2
11144: ===> Overriding tools for figlet-2.2.1nb2
11145: ===> Creating toolchain wrappers for figlet-2.2.1nb2
11146: ===> Configuring for figlet-2.2.1nb2
11147: ===> Building for figlet-2.2.1nb2
11148: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
11149: chmod a+x figlet
11150: gcc -O2 -o chkfont chkfont.c
11151: => Unwrapping files-to-be-installed.
1.14 xtraeme 11152: <code class="prompt">#</code>
11153: <code class="prompt">#</code> <strong class=
11154: "userinput"><code>make install</code></strong>
1.1 grant 11155: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11156: ===> Installing for figlet-2.2.1nb2
11157: install -d -o root -g wheel -m 755 /usr/pkg/bin
11158: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
11159: mkdir -p /usr/pkg/share/figlet
11160: cp figlet /usr/pkg/bin
11161: cp chkfont /usr/pkg/bin
11162: chmod 555 figlist showfigfonts
11163: cp figlist /usr/pkg/bin
11164: cp showfigfonts /usr/pkg/bin
11165: cp fonts/*.flf /usr/pkg/share/figlet
11166: cp fonts/*.flc /usr/pkg/share/figlet
11167: cp figlet.6 /usr/pkg/man/man6
11168: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 11169: <code class="prompt">#</code>
1.1 grant 11170: </pre>
11171: </div>
11172:
11173: <div class="sect1" lang="en" xml:lang="en">
11174: <div class="titlepage">
11175: <div>
11176: <div>
11177: <h2 class="title" style="clear: both"><a name=
11178: "logs.package" id=
11179: "logs.package"></a>B.2. Packaging figlet</h2>
11180: </div>
11181: </div>
11182: </div>
11183: <pre class="screen">
1.14 xtraeme 11184: <code class="prompt">#</code> <strong class=
11185: "userinput"><code>make package</code></strong>
1.1 grant 11186: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11187: ===> Packaging figlet-2.2.1nb2
11188: ===> Building binary package for figlet-2.2.1nb2
11189: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
11190: Using SrcDir value of /usr/pkg
11191: Registering depends:.
1.14 xtraeme 11192: <code class="prompt">#</code>
1.1 grant 11193: </pre>
11194: </div>
11195: </div>
11196:
11197: <div class="appendix" lang="en" xml:lang="en">
11198: <div class="titlepage">
11199: <div>
11200: <div>
11201: <h2 class="title"><a name="ftp-layout" id=
11202: "ftp-layout"></a>Appendix C. Layout of the
11203: FTP server's package archive</h2>
11204: </div>
11205: </div>
11206: </div>
11207:
11208: <p>Layout for precompiled binary packages on
11209: ftp.NetBSD.org:</p>
11210: <pre class="programlisting">
11211: /pub/NetBSD/packages/
11212: distfiles/
11213:
11214: # Unpacked pkgsrc trees
11215: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
11216: pkgsrc-2003Q4 -> N/A
11217: pkgsrc-2004Q1/pkgsrc
11218:
11219: # pkgsrc archives
11220: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
11221: pkgsrc-2003Q4.tar.gz -> N/A
11222: pkgsrc-2004Q1.tar.gz -> N/A
11223:
11224: # Per pkgsrc-release/OS-release/arch package archives
11225: pkgsrc-2003Q4/
11226: NetBSD-1.6.2/
11227: i386/
11228: All/
11229: archivers/
11230: foo -> ../All/foo
11231: ...
11232: pkgsrc-2004Q1/
11233: NetBSD-1.6.2/
11234: i386/
11235: All/
11236: ...
11237: NetBSD-2.0/
11238: i386/
11239: All/
11240: ...
11241: SunOS-5.9/
11242: sparc/
11243: All/
11244: ...
11245: x86/
11246: All/
11247: ...
11248:
11249: # Per os-release package archive convenience links
11250: NetBSD-1.6.2 -> 1.6.2
11251: 1.6.2/
11252: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
11253: m68k/
11254: All/
11255: archivers/
11256: foo -> ../All/foo
11257: ...
11258: amiga -> m68k
11259: atari -> m68k
11260: ...
11261:
11262: 2.0 -> NetBSD-2.0 # backward compat, historic
11263: NetBSD-2.0/
11264: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
11265: SunOS-5.9/
11266: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
11267: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
11268:
11269: </pre>
11270:
11271: <p>To create:</p>
11272:
11273: <div class="orderedlist">
11274: <ol type="1">
11275: <li>
11276: <p>Run bulk build, see <a href="#bulkbuild" title=
11277: "5.3. Doing a bulk build of all packages">Section
11278: 5.3, “Doing a bulk build of all
11279: packages”</a></p>
11280: </li>
11281:
11282: <li>
11283: <p>Upload /usr/pkgsrc/packages to</p>
11284: <pre class="programlisting">
11285: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13 hubertf 11286: pkgsrc-2004Q4/\ # pkgsrc-branch
1.1 grant 11287: `uname -s`-`uname -r`/ # OS & version
11288: `uname -p` # architecture
11289:
11290: </pre>
11291: </li>
11292:
11293: <li>
1.14 xtraeme 11294: <p>If necessary, create a symlink <span><strong class=
11295: "command">ln -s `uname -m` `uname -p`</strong></span>
11296: (amiga -> m68k, ...)</p>
1.1 grant 11297: </li>
11298: </ol>
11299: </div>
11300: </div>
1.2 hubertf 11301:
11302: <div class="appendix" lang="en" xml:lang="en">
11303: <div class="titlepage">
11304: <div>
11305: <div>
11306: <h2 class="title"><a name="editing" id=
11307: "editing"></a>Appendix D. Editing guidelines
11308: for the pkgsrc guide</h2>
11309: </div>
11310: </div>
11311: </div>
11312:
11313: <div class="toc">
11314: <p><b>Table of Contents</b></p>
11315:
11316: <dl>
1.21 ! ben 11317: <dt><span class="sect1"><a href="#id2598922">D.1.
1.2 hubertf 11318: Targets</a></span></dt>
11319:
1.21 ! ben 11320: <dt><span class="sect1"><a href="#id2599129">D.2.
1.2 hubertf 11321: Procedure</a></span></dt>
11322: </dl>
11323: </div>
11324:
11325: <p>This section contains information on editing the pkgsrc
11326: guide itself.</p>
11327:
11328: <div class="sect1" lang="en" xml:lang="en">
11329: <div class="titlepage">
11330: <div>
11331: <div>
11332: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 11333: "id2598922" id="id2598922"></a>D.1. Targets</h2>
1.2 hubertf 11334: </div>
11335: </div>
11336: </div>
11337:
1.14 xtraeme 11338: <p>The pkgsrc guide's source code is stored in <code class=
11339: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 11340: are created from it:</p>
11341:
11342: <div class="itemizedlist">
11343: <ul type="disc">
11344: <li>
1.14 xtraeme 11345: <p><code class=
11346: "filename">pkgsrc/doc/pkgsrc.txt</code>, which
11347: replaces <code class=
11348: "filename">pkgsrc/Packages.txt</code></p>
1.2 hubertf 11349: </li>
11350:
11351: <li>
1.14 xtraeme 11352: <p><code class=
11353: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 11354: </li>
11355:
11356: <li>
1.14 xtraeme 11357: <p><code class=
11358: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 11359: the documentation on the NetBSD website will be built
11360: from pkgsrc and kept up to date on the web server
11361: itself. This means you <span class=
11362: "emphasis"><em>must</em></span> make sure that your
11363: changes haven't broken the build!</p>
11364: </li>
1.6 hubertf 11365:
11366: <li>
1.14 xtraeme 11367: <p><code class=
11368: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 11369: PDF version of the pkgsrc guide.</p>
11370: </li>
11371:
11372: <li>
1.14 xtraeme 11373: <p><code class=
11374: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 11375: PostScript version of the pkgsrc guide.</p>
11376: </li>
1.2 hubertf 11377: </ul>
11378: </div>
11379: </div>
11380:
11381: <div class="sect1" lang="en" xml:lang="en">
11382: <div class="titlepage">
11383: <div>
11384: <div>
11385: <h2 class="title" style="clear: both"><a name=
1.21 ! ben 11386: "id2599129" id=
! 11387: "id2599129"></a>D.2. Procedure</h2>
1.2 hubertf 11388: </div>
11389: </div>
11390: </div>
11391:
11392: <p>The procedure to edit the pkgsrc guide is:</p>
11393:
11394: <div class="itemizedlist">
11395: <ul type="disc">
11396: <li>
1.6 hubertf 11397: <p>Make sure you have the packages needed to
11398: re-generate the pkgsrc guide (and other XML-based
11399: NetBSD documentation) installed. These are
1.11 ben 11400: “<span class="quote">netbsd-doc</span>”
1.6 hubertf 11401: for creating the ASCII- and HTML-version, and
11402: “<span class=
1.11 ben 11403: "quote">netbsd-doc-print</span>”for the
1.6 hubertf 11404: PostScript- and PDF version. You will need both
11405: packages installed, to make sure documentation is
11406: consistent across all formats. The packages can be
1.14 xtraeme 11407: found in <code class=
11408: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
11409: <code class=
11410: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 11411: </li>
11412:
11413: <li>
1.14 xtraeme 11414: <p>Edit the XML file(s) in <code class=
11415: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 11416: </li>
11417:
11418: <li>
1.14 xtraeme 11419: <p>Run <span><strong class="command">make extract
11420: && make do-lint</strong></span> in
11421: <code class="filename">pkgsrc/doc/guide</code> to
11422: check the XML syntax, and fix it if needed.</p>
1.4 hubertf 11423: </li>
11424:
11425: <li>
1.14 xtraeme 11426: <p>Run <span><strong class=
11427: "command">make</strong></span> in <code class=
11428: "filename">pkgsrc/doc/guide</code> to build the HTML
11429: and ASCII version.</p>
1.2 hubertf 11430: </li>
11431:
11432: <li>
1.14 xtraeme 11433: <p>If all is well, run <span><strong class=
11434: "command">make install-doc</strong></span> to put the
11435: generated files into <code class=
11436: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 11437: </li>
11438:
11439: <li>
1.14 xtraeme 11440: <p><span><strong class="command">cvs commit
11441: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 11442: </li>
11443:
11444: <li>
1.14 xtraeme 11445: <p><span><strong class="command">cvs commit -m
11446: re-generate
11447: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 11448: </li>
1.4 hubertf 11449:
11450: <li>
11451: <p>Until the webserver on www.NetBSD.org is really
11452: updated automatically to pick up changes to the
1.14 xtraeme 11453: pkgsrc guide automatically, also run
1.18 xtraeme 11454: <span><strong class="command">make install-htdocs
1.14 xtraeme 11455: HTDOCSDIR=../../../htdocs</strong></span> (or
11456: similar, adjust <code class=
11457: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 11458: </li>
11459:
11460: <li>
1.14 xtraeme 11461: <p><span><strong class="command">cvs commit
11462: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 11463: </li>
1.2 hubertf 11464: </ul>
11465: </div>
11466: </div>
11467: </div>
1.1 grant 11468: </div>
11469: </body>
11470: </html>
CVSweb <webmaster@jp.NetBSD.org>