Annotation of pkgsrc/doc/pkgsrc.html, revision 1.20
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.20 ! ben 429: <dt><span class="sect1"><a href="#id2590322">9.1.
1.1 grant 430: Converting packages to use
431: buildlink3</a></span></dt>
432:
1.20 ! ben 433: <dt><span class="sect1"><a href="#id2590513">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.20 ! ben 440: "#id2590582">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.20 ! ben 444: "#id2591022">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.20 ! ben 452: <dt><span class="sect1"><a href="#id2591170">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.20 ! ben 459: "#id2591387">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.20 ! ben 464: "#id2591614">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.20 ! ben 476: <dt><span class="sect1"><a href="#id2591687">10.1.
1.1 grant 477: Global default options</a></span></dt>
478:
1.20 ! ben 479: <dt><span class="sect1"><a href="#id2591702">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.20 ! ben 494: <dt><span class="sect1"><a href="#id2592310">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.20 ! ben 508: <dt><span class="sect1"><a href="#id2593710">12.1.
1.1 grant 509: General operation</a></span></dt>
510:
511: <dd>
512: <dl>
513: <dt><span class="sect2"><a href=
1.20 ! ben 514: "#id2593714">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.20 ! ben 518: "#id2593865">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.20 ! ben 526: "#id2594380">12.1.4. Handling conflicts with
1.1 grant 527: other packages</a></span></dt>
528:
529: <dt><span class="sect2"><a href=
1.20 ! ben 530: "#id2594430">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.20 ! ben 534: "#id2594456">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.20 ! ben 542: "#id2594616">12.1.8. How to handle compiler
1.1 grant 543: bugs</a></span></dt>
544:
545: <dt><span class="sect2"><a href=
1.20 ! ben 546: "#id2594638">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.20 ! ben 551: "#id2594688">12.1.10. Portability of
1.1 grant 552: packages</a></span></dt>
553: </dl>
554: </dd>
555:
1.20 ! ben 556: <dt><span class="sect1"><a href="#id2594712">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.20 ! ben 562: "#id2594715">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.20 ! ben 567: "#id2594778">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.20 ! ben 572: <dt><span class="sect1"><a href="#id2594790">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.20 ! ben 582: "#id2595237">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.20 ! ben 587: "#id2595321">12.3.3. GNU
1.1 grant 588: Autoconf/Automake</a></span></dt>
589: </dl>
590: </dd>
591:
1.20 ! ben 592: <dt><span class="sect1"><a href="#id2595434">12.4.
1.1 grant 593: Building considerations</a></span></dt>
594:
595: <dd>
596: <dl>
597: <dt><span class="sect2"><a href=
1.20 ! ben 598: "#id2595437">12.4.1. CPP
1.1 grant 599: defines</a></span></dt>
600: </dl>
601: </dd>
602:
1.20 ! ben 603: <dt><span class="sect1"><a href="#id2595467">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.20 ! ben 609: "#id2595470">12.5.1. Package configuration
1.1 grant 610: files</a></span></dt>
611:
612: <dt><span class="sect2"><a href=
1.20 ! ben 613: "#id2595709">12.5.2. User
1.2 hubertf 614: interaction</a></span></dt>
1.1 grant 615:
616: <dt><span class="sect2"><a href=
1.20 ! ben 617: "#id2595754">12.5.3. Handling
1.1 grant 618: licenses</a></span></dt>
619:
620: <dt><span class="sect2"><a href=
1.20 ! ben 621: "#id2595906">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.20 ! ben 625: "#id2595968">12.5.5. Installing score
1.1 grant 626: files</a></span></dt>
627:
628: <dt><span class="sect2"><a href=
1.20 ! ben 629: "#id2596011">12.5.6. Packages providing login
1.1 grant 630: shells</a></span></dt>
631:
632: <dt><span class="sect2"><a href=
1.20 ! ben 633: "#id2596069">12.5.7. Packages containing perl
1.1 grant 634: scripts</a></span></dt>
635:
636: <dt><span class="sect2"><a href=
1.20 ! ben 637: "#id2596087">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.20 ! ben 641: "#id2596108">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.20 ! ben 649: "#id2596328">12.5.11. Packages installing
1.1 grant 650: GConf2 data files</a></span></dt>
651:
652: <dt><span class="sect2"><a href=
1.20 ! ben 653: "#id2596428">12.5.12. Packages installing
1.1 grant 654: scrollkeeper data files</a></span></dt>
655:
656: <dt><span class="sect2"><a href=
1.20 ! ben 657: "#id2596548">12.5.13. Packages installing X11
1.1 grant 658: fonts</a></span></dt>
659:
660: <dt><span class="sect2"><a href=
1.20 ! ben 661: "#id2596595">12.5.14. Packages installing GTK2
1.1 grant 662: modules</a></span></dt>
663:
664: <dt><span class="sect2"><a href=
1.20 ! ben 665: "#id2596732">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.20 ! ben 669: "#id2596785">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.20 ! ben 673: "#id2596923">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.20 ! ben 677: "#id2597005">12.5.18. Packages installing
1.18 xtraeme 678: startup scripts</a></span></dt>
1.1 grant 679: </dl>
680: </dd>
681:
1.20 ! ben 682: <dt><span class="sect1"><a href="#id2597027">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.20 ! ben 695: <dt><span class="sect1"><a href="#id2597557">14.1.
1.1 grant 696: Submitting your packages</a></span></dt>
697:
1.20 ! ben 698: <dt><span class="sect1"><a href="#id2597608">14.2.
1.1 grant 699: Committing: Importing a package into
700: CVS</a></span></dt>
701:
1.20 ! ben 702: <dt><span class="sect1"><a href="#id2597671">14.3.
1.2 hubertf 703: Updating a package to a newer
704: version</a></span></dt>
1.1 grant 705:
1.20 ! ben 706: <dt><span class="sect1"><a href="#id2597758">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.20 ! ben 718: <dt><span class="sect1"><a href="#id2597985">A.1.
1.1 grant 719: files</a></span></dt>
720:
721: <dd>
722: <dl>
1.20 ! ben 723: <dt><span class="sect2"><a href="#id2597988">A.1.1.
1.1 grant 724: Makefile</a></span></dt>
725:
1.20 ! ben 726: <dt><span class="sect2"><a href="#id2597995">A.1.2.
1.1 grant 727: DESCR</a></span></dt>
728:
1.20 ! ben 729: <dt><span class="sect2"><a href="#id2598010">A.1.3.
1.1 grant 730: PLIST</a></span></dt>
731:
1.20 ! ben 732: <dt><span class="sect2"><a href="#id2598018">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.20 ! ben 738: <dt><span class="sect1"><a href="#id2598058">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.20 ! ben 764: <dt><span class="sect1"><a href="#id2598909">D.1.
1.2 hubertf 765: Targets</a></span></dt>
766:
1.20 ! ben 767: <dt><span class="sect1"><a href="#id2599116">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.20 ! ben 4672: <dt><span class="sect1"><a href="#id2590322">9.1.
1.1 grant 4673: Converting packages to use buildlink3</a></span></dt>
4674:
1.20 ! ben 4675: <dt><span class="sect1"><a href="#id2590513">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.20 ! ben 4682: "#id2590582">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.20 ! ben 4686: "#id2591022">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.20 ! ben 4694: <dt><span class="sect1"><a href="#id2591170">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.20 ! ben 4701: "#id2591387">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.20 ! ben 4705: "#id2591614">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.20 ! ben 4717: <dt><span class="sect1"><a href="#id2591687">10.1.
1.1 grant 4718: Global default options</a></span></dt>
4719:
1.20 ! ben 4720: <dt><span class="sect1"><a href="#id2591702">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.20 ! ben 4734: <dt><span class="sect1"><a href="#id2592310">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.20 ! ben 4748: <dt><span class="sect1"><a href="#id2593710">12.1.
1.1 grant 4749: General operation</a></span></dt>
4750:
4751: <dd>
4752: <dl>
4753: <dt><span class="sect2"><a href=
1.20 ! ben 4754: "#id2593714">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.20 ! ben 4758: "#id2593865">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.20 ! ben 4766: "#id2594380">12.1.4. Handling conflicts with
1.1 grant 4767: other packages</a></span></dt>
4768:
4769: <dt><span class="sect2"><a href=
1.20 ! ben 4770: "#id2594430">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.20 ! ben 4774: "#id2594456">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.20 ! ben 4782: "#id2594616">12.1.8. How to handle compiler
1.1 grant 4783: bugs</a></span></dt>
4784:
4785: <dt><span class="sect2"><a href=
1.20 ! ben 4786: "#id2594638">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.20 ! ben 4791: "#id2594688">12.1.10. Portability of
1.1 grant 4792: packages</a></span></dt>
4793: </dl>
4794: </dd>
4795:
1.20 ! ben 4796: <dt><span class="sect1"><a href="#id2594712">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.20 ! ben 4802: "#id2594715">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.20 ! ben 4807: "#id2594778">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.20 ! ben 4812: <dt><span class="sect1"><a href="#id2594790">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.20 ! ben 4822: "#id2595237">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.20 ! ben 4827: "#id2595321">12.3.3. GNU
1.1 grant 4828: Autoconf/Automake</a></span></dt>
4829: </dl>
4830: </dd>
4831:
1.20 ! ben 4832: <dt><span class="sect1"><a href="#id2595434">12.4.
1.1 grant 4833: Building considerations</a></span></dt>
4834:
4835: <dd>
4836: <dl>
4837: <dt><span class="sect2"><a href=
1.20 ! ben 4838: "#id2595437">12.4.1. CPP defines</a></span></dt>
1.1 grant 4839: </dl>
4840: </dd>
4841:
1.20 ! ben 4842: <dt><span class="sect1"><a href="#id2595467">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.20 ! ben 4848: "#id2595470">12.5.1. Package configuration
1.1 grant 4849: files</a></span></dt>
4850:
4851: <dt><span class="sect2"><a href=
1.20 ! ben 4852: "#id2595709">12.5.2. User
1.2 hubertf 4853: interaction</a></span></dt>
1.1 grant 4854:
4855: <dt><span class="sect2"><a href=
1.20 ! ben 4856: "#id2595754">12.5.3. Handling
1.1 grant 4857: licenses</a></span></dt>
4858:
4859: <dt><span class="sect2"><a href=
1.20 ! ben 4860: "#id2595906">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.20 ! ben 4864: "#id2595968">12.5.5. Installing score
1.1 grant 4865: files</a></span></dt>
4866:
4867: <dt><span class="sect2"><a href=
1.20 ! ben 4868: "#id2596011">12.5.6. Packages providing login
1.1 grant 4869: shells</a></span></dt>
4870:
4871: <dt><span class="sect2"><a href=
1.20 ! ben 4872: "#id2596069">12.5.7. Packages containing perl
1.1 grant 4873: scripts</a></span></dt>
4874:
4875: <dt><span class="sect2"><a href=
1.20 ! ben 4876: "#id2596087">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.20 ! ben 4880: "#id2596108">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.20 ! ben 4888: "#id2596328">12.5.11. Packages installing GConf2
1.1 grant 4889: data files</a></span></dt>
4890:
4891: <dt><span class="sect2"><a href=
1.20 ! ben 4892: "#id2596428">12.5.12. Packages installing
1.1 grant 4893: scrollkeeper data files</a></span></dt>
4894:
4895: <dt><span class="sect2"><a href=
1.20 ! ben 4896: "#id2596548">12.5.13. Packages installing X11
1.1 grant 4897: fonts</a></span></dt>
4898:
4899: <dt><span class="sect2"><a href=
1.20 ! ben 4900: "#id2596595">12.5.14. Packages installing GTK2
1.1 grant 4901: modules</a></span></dt>
4902:
4903: <dt><span class="sect2"><a href=
1.20 ! ben 4904: "#id2596732">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.20 ! ben 4908: "#id2596785">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.20 ! ben 4912: "#id2596923">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.20 ! ben 4916: "#id2597005">12.5.18. Packages installing startup
1.18 xtraeme 4917: scripts</a></span></dt>
1.1 grant 4918: </dl>
4919: </dd>
4920:
1.20 ! ben 4921: <dt><span class="sect1"><a href="#id2597027">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.20 ! ben 4934: <dt><span class="sect1"><a href="#id2597557">14.1.
1.1 grant 4935: Submitting your packages</a></span></dt>
4936:
1.20 ! ben 4937: <dt><span class="sect1"><a href="#id2597608">14.2.
1.1 grant 4938: Committing: Importing a package into
4939: CVS</a></span></dt>
4940:
1.20 ! ben 4941: <dt><span class="sect1"><a href="#id2597671">14.3.
1.2 hubertf 4942: Updating a package to a newer version</a></span></dt>
1.1 grant 4943:
1.20 ! ben 4944: <dt><span class="sect1"><a href="#id2597758">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=
5868: "filename">PLIST.common_end</code></p>
1.1 grant 5869: </li>
5870: </ul>
5871: </div>
5872: </div>
5873:
5874: <div class="sect1" lang="en" xml:lang="en">
5875: <div class="titlepage">
5876: <div>
5877: <div>
5878: <h2 class="title" style="clear: both"><a name=
5879: "faq.common-dirs" id=
5880: "faq.common-dirs"></a>8.8. Sharing directories
5881: between packages</h2>
5882: </div>
5883: </div>
5884: </div>
5885:
5886: <p>A “<span class="quote">shared
5887: directory</span>” is a directory where multiple
5888: (and unrelated) packages install files. These directories
5889: are problematic because you have to add special tricks in
5890: the PLIST to conditionally remove them, or have some
5891: centralized package handle them.</p>
5892:
5893: <p>Within pkgsrc, you'll find both approaches. If a
5894: directory is shared by a few unrelated packages, it's
5895: often not worth to add an extra package to remove it.
5896: Therefore, one simply does:</p>
5897: <pre class="programlisting">
5898: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
5899:
5900: </pre>
5901:
5902: <p>in the PLISTs of all affected packages, instead of the
5903: regular "@dirrm" line.</p>
5904:
5905: <p>However, if the directory is shared across many
5906: packages, two different solutions are available:</p>
5907:
5908: <div class="orderedlist">
5909: <ol type="1">
5910: <li>
5911: <p>If the packages have a common dependency, the
5912: directory can be removed in that. For example, see
5913: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5914: href=
5915: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20 ! ben 5916: class="pkgname">textproc/scrollkeeper</a>, which
! 5917: removes the shared directory <code class=
! 5918: "filename">share/omf</code>.</p>
1.1 grant 5919: </li>
5920:
5921: <li>
5922: <p>If the packages using the directory are not
5923: related at all (they have no common dependencies),
5924: a *-dirs package is used.</p>
5925: </li>
5926: </ol>
5927: </div>
5928:
5929: <p>From now on, we'll discuss the second solution. To get
5930: an idea of the *-dirs packages available, issue:</p>
5931: <pre class="programlisting">
1.14 xtraeme 5932: <code class="prompt">%</code> cd .../pkgsrc
5933: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 5934:
5935: </pre>
5936:
5937: <p>Their use from other packages is very simple. The
1.14 xtraeme 5938: <code class="varname">USE_DIRS</code> variable takes a
5939: list of package names (without the “<span class=
1.1 grant 5940: "quote">-dirs</span>” part) together with the
5941: required version number (always pick the latest one when
5942: writting new packages).</p>
5943:
5944: <p>For example, if a package installs files under
1.14 xtraeme 5945: <code class="filename">share/applications</code>, it
5946: should have the following line in it:</p>
1.1 grant 5947: <pre class="programlisting">
5948: USE_DIRS+= xdg-1.1
5949:
5950: </pre>
5951:
1.14 xtraeme 5952: <p>After regenerating the PLIST using
5953: <span><strong class="command">make
5954: print-PLIST</strong></span>, you should get the right
5955: (commented out) lines.</p>
1.1 grant 5956:
1.14 xtraeme 5957: <p>Note that, even if your package is using <code class=
5958: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 5959: *-x11-dirs packages. Just specify the name without that
1.14 xtraeme 5960: part and pkgsrc (in particular, <code class=
5961: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 5962: </div>
5963: </div>
5964:
5965: <div class="chapter" lang="en" xml:lang="en">
5966: <div class="titlepage">
5967: <div>
5968: <div>
5969: <h2 class="title"><a name="buildlink" id=
5970: "buildlink"></a>Chapter 9. Buildlink
5971: methodology</h2>
5972: </div>
5973: </div>
5974: </div>
5975:
5976: <div class="toc">
5977: <p><b>Table of Contents</b></p>
5978:
5979: <dl>
1.20 ! ben 5980: <dt><span class="sect1"><a href="#id2590322">9.1.
1.1 grant 5981: Converting packages to use buildlink3</a></span></dt>
5982:
1.20 ! ben 5983: <dt><span class="sect1"><a href="#id2590513">9.2.
1.14 xtraeme 5984: Writing <code class="filename">buildlink3.mk</code>
5985: files</a></span></dt>
1.1 grant 5986:
5987: <dd>
5988: <dl>
1.20 ! ben 5989: <dt><span class="sect2"><a href="#id2590582">9.2.1.
1.1 grant 5990: Anatomy of a buildlink3.mk file</a></span></dt>
5991:
1.20 ! ben 5992: <dt><span class="sect2"><a href="#id2591022">9.2.2.
1.14 xtraeme 5993: Updating <code class=
5994: "varname">BUILDLINK_DEPENDS.<em class=
5995: "replaceable"><code>pkg</code></em></code> in
5996: <code class="filename">buildlink3.mk</code>
1.1 grant 5997: files</a></span></dt>
5998: </dl>
5999: </dd>
6000:
1.20 ! ben 6001: <dt><span class="sect1"><a href="#id2591170">9.3.
1.14 xtraeme 6002: Writing <code class="filename">builtin.mk</code>
6003: files</a></span></dt>
1.1 grant 6004:
6005: <dd>
6006: <dl>
1.20 ! ben 6007: <dt><span class="sect2"><a href="#id2591387">9.3.1.
1.14 xtraeme 6008: Anatomy of a <code class=
6009: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 6010:
1.20 ! ben 6011: <dt><span class="sect2"><a href="#id2591614">9.3.2.
1.1 grant 6012: Global preferences for native or pkgsrc
6013: software</a></span></dt>
6014: </dl>
6015: </dd>
6016: </dl>
6017: </div>
6018:
6019: <p>Buildlink is a framework in pkgsrc that controls what
6020: headers and libraries are seen by a package's configure and
6021: build processes. This is implemented in a two step
6022: process:</p>
6023:
6024: <div class="orderedlist">
6025: <ol type="1">
6026: <li>
6027: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 6028: into <code class="varname">BUILDLINK_DIR</code>,
6029: which by default is a subdirectory of <code class=
6030: "varname">WRKDIR</code>.</p>
1.1 grant 6031: </li>
6032:
6033: <li>
6034: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 6035: the normal compiler tools that translate <code class=
6036: "option">-I${LOCALBASE}/include</code> and
6037: <code class="option">-L${LOCALBASE}/lib</code> into
6038: references to <code class=
6039: "varname">BUILDLINK_DIR</code>. The wrapper scripts
6040: also make native compiler on some operating systems
6041: look like GCC, so that packages that expect GCC won't
6042: require modifications to build with those native
6043: compilers.</p>
1.1 grant 6044: </li>
6045: </ol>
6046: </div>
6047:
6048: <p>This normalizes the environment in which a package is
6049: built so that the package may be built consistently despite
6050: what other software may be installed. Please note that the
1.14 xtraeme 6051: normal system header and library paths, e.g. <code class=
6052: "filename">/usr/include</code>, <code class=
6053: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 6054: buildlink3 is designed to insulate the package build from
6055: non-system-supplied software.</p>
6056:
6057: <div class="sect1" lang="en" xml:lang="en">
6058: <div class="titlepage">
6059: <div>
6060: <div>
6061: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 6062: "id2590322" id="id2590322"></a>9.1. Converting
1.1 grant 6063: packages to use buildlink3</h2>
6064: </div>
6065: </div>
6066: </div>
6067:
6068: <p>The process of converting packages to use the
6069: buildlink3 framework (“<span class=
6070: "quote">bl3ifying</span>”) is fairly
6071: straightforward. The things to keep in mind are:</p>
6072:
6073: <div class="orderedlist">
6074: <ol type="1">
6075: <li>
1.14 xtraeme 6076: <p>Set <code class="varname">USE_BUILDLINK3</code>
6077: to “<span class=
6078: "quote">yes</span>”.</p>
1.1 grant 6079: </li>
6080:
6081: <li>
6082: <p>Ensure that the build always calls the wrapper
6083: scripts instead of the actual toolchain. Some
6084: packages are tricky, and the only way to know for
1.14 xtraeme 6085: sure is the check <code class=
6086: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 6087: wrappers are being invoked.</p>
6088: </li>
6089:
6090: <li>
1.14 xtraeme 6091: <p>Don't override <code class=
6092: "varname">PREFIX</code> from within the package
6093: Makefile, e.g. Java VMs, standalone shells, etc.,
6094: because the code to symlink files into <code class=
6095: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 6096: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 6097: <em class=
6098: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 6099: </li>
6100:
6101: <li>
6102: <p>Remember that <span class=
1.14 xtraeme 6103: "emphasis"><em>only</em></span> the <code class=
6104: "filename">buildlink3.mk</code> files that you list
1.1 grant 6105: in a package's Makefile are added as dependencies
6106: for that package.</p>
6107: </li>
6108: </ol>
6109: </div>
6110:
6111: <p>If a dependency on a particular package is required
6112: for its libraries and headers, then we replace:</p>
6113: <pre class="programlisting">
6114: DEPENDS+= foo>=1.1.0:../../category/foo
6115: </pre>
6116:
6117: <p>with</p>
6118: <pre class="programlisting">
6119: .include "../../category/foo/buildlink3.mk"
6120: </pre>
6121:
1.14 xtraeme 6122: <p>There are several <code class=
6123: "filename">buildlink3.mk</code> files in <code class=
6124: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 6125: issues:</p>
6126:
6127: <div class="itemizedlist">
6128: <ul type="disc">
6129: <li>
1.14 xtraeme 6130: <p><code class="filename">bdb.buildlink3.mk</code>
1.1 grant 6131: chooses either the native or a pkgsrc Berkeley DB
1.14 xtraeme 6132: implementation based on the values of <code class=
6133: "varname">BDB_ACCEPTED</code> and <code class=
6134: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 6135: </li>
6136:
6137: <li>
1.14 xtraeme 6138: <p><code class=
6139: "filename">curses.buildlink3.mk</code> If the
6140: system comes with neither Curses nor NCurses, this
6141: will take care to install the <a xmlns=
6142: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 6143: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20 ! ben 6144: class="pkgname">devel/ncurses</a> package.</p>
1.1 grant 6145: </li>
6146:
6147: <li>
1.14 xtraeme 6148: <p><code class="filename">krb5.buildlink3.mk</code>
6149: uses the value of <code class=
6150: "varname">KRB5_ACCEPTED</code> to choose between
1.1 grant 6151: adding a dependency on Heimdal or MIT-krb5 for
6152: packages that require a Kerberos 5
6153: implementation.</p>
6154: </li>
6155:
6156: <li>
1.14 xtraeme 6157: <p><code class=
6158: "filename">motif.buildlink3.mk</code> checks for a
6159: system-provided Motif installation or adds a
6160: dependency on <a xmlns=
1.1 grant 6161: "http://www.w3.org/TR/xhtml1/transitional" href=
6162: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20 ! ben 6163: class="pkgname">x11/lesstif</a> or <a xmlns=
! 6164: "http://www.w3.org/TR/xhtml1/transitional" href=
! 6165: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
! 6166: class="pkgname">x11/openmotif</a>;</p>
1.1 grant 6167: </li>
6168:
6169: <li>
1.14 xtraeme 6170: <p><code class=
6171: "filename">ossaudio.buildlink3.mk</code> defines
6172: several variables that may be used by packages that
6173: use the Open Sound System (OSS) API;</p>
1.1 grant 6174: </li>
6175:
6176: <li>
1.14 xtraeme 6177: <p><code class=
6178: "filename">pgsql.buildlink3.mk</code> will accept
6179: either Postgres 7.3 or 7.4, whichever is found
6180: installed. See the file for more information.</p>
1.1 grant 6181: </li>
6182:
6183: <li>
1.14 xtraeme 6184: <p><code class=
6185: "filename">pthread.buildlink3.mk</code> uses the
6186: value of <code class="varname">PTHREAD_OPTS</code>
6187: and checks for native pthreads or adds a dependency
6188: on <a xmlns=
1.1 grant 6189: "http://www.w3.org/TR/xhtml1/transitional" href=
6190: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20 ! ben 6191: class="pkgname">devel/pth</a> as needed;</p>
1.1 grant 6192: </li>
6193:
6194: <li>
1.14 xtraeme 6195: <p><code class="filename">xaw.buildlink3.mk</code>
6196: uses the value of <code class=
6197: "varname">XAW_TYPE</code> to choose a particular
6198: Athena widgets library.</p>
1.1 grant 6199: </li>
6200: </ul>
6201: </div>
6202:
1.14 xtraeme 6203: <p>The comments in those <code class=
6204: "filename">buildlink3.mk</code> files provide a more
1.1 grant 6205: complete description of how to use them properly.</p>
6206: </div>
6207:
6208: <div class="sect1" lang="en" xml:lang="en">
6209: <div class="titlepage">
6210: <div>
6211: <div>
6212: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 6213: "id2590513" id="id2590513"></a>9.2. Writing
1.14 xtraeme 6214: <code class="filename">buildlink3.mk</code>
6215: files</h2>
1.1 grant 6216: </div>
6217: </div>
6218: </div>
6219:
1.14 xtraeme 6220: <p>A package's <code class=
6221: "filename">buildlink3.mk</code> file is included by
6222: Makefiles to indicate the need to compile and link
6223: against header files and libraries provided by the
6224: package. A <code class="filename">buildlink3.mk</code>
6225: file should always provide enough information to add the
6226: correct type of dependency relationship and include any
6227: other <code class="filename">buildlink3.mk</code> files
6228: that it needs to find headers and libraries that it needs
6229: in turn.</p>
1.1 grant 6230:
1.14 xtraeme 6231: <p>To generate an initial <code class=
6232: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 6233: Rene Hexel's <a xmlns=
6234: "http://www.w3.org/TR/xhtml1/transitional" href=
6235: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20 ! ben 6236: class="pkgname">pkgtools/createbuildlink</a> package is
! 6237: highly recommended. For most packages, the following
! 6238: command will generate a good starting point for
! 6239: <code class="filename">buildlink3.mk</code> files:</p>
1.1 grant 6240: <pre class="screen">
1.14 xtraeme 6241: <code class="prompt">%</code> <strong class=
6242: "userinput"><code>cd pkgsrc/<em class=
6243: "replaceable"><code>category</code></em>/<em class=
6244: "replaceable"><code>pkgdir</code></em>
6245: <code class=
6246: "prompt">%</code> createbuildlink -3 >buildlink3.mk</code></strong>
1.1 grant 6247: </pre>
6248:
6249: <div class="sect2" lang="en" xml:lang="en">
6250: <div class="titlepage">
6251: <div>
6252: <div>
1.20 ! ben 6253: <h3 class="title"><a name="id2590582" id=
! 6254: "id2590582"></a>9.2.1. Anatomy of a buildlink3.mk
1.1 grant 6255: file</h3>
6256: </div>
6257: </div>
6258: </div>
6259:
1.14 xtraeme 6260: <p>The following real-life example <code class=
6261: "filename">buildlink3.mk</code> is taken from
6262: <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 6263: <pre class="programlisting">
1.17 sketch 6264: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 6265:
6266: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
6267: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
6268:
6269: .if !empty(BUILDLINK_DEPTH:M+)
6270: BUILDLINK_DEPENDS+= tiff
6271: .endif
6272:
6273: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
6274: BUILDLINK_PACKAGES+= tiff
6275:
6276: .if !empty(TIFF_BUILDLINK3_MK:M+)
6277: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
6278: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
6279: .endif # TIFF_BUILDLINK3_MK
6280:
6281: .include "../../devel/zlib/buildlink3.mk"
6282: .include "../../graphics/jpeg/buildlink3.mk"
6283:
6284: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
6285: </pre>
6286:
1.14 xtraeme 6287: <p>The header and footer manipulate <code class=
6288: "varname">BUILDLINK_DEPTH</code>, which is common
6289: across all <code class="filename">buildlink3.mk</code>
6290: files and is used to track at what depth we are
6291: including <code class="filename">buildlink3.mk</code>
6292: files.</p>
1.1 grant 6293:
6294: <p>The first section controls if the dependency on
1.14 xtraeme 6295: <em class="replaceable"><code>pkg</code></em> is added.
6296: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 6297: global list of packages for which dependencies are
6298: added by buildlink3.</p>
6299:
6300: <p>The second section advises pkgsrc that the
1.14 xtraeme 6301: <code class="filename">buildlink3.mk</code> file for
6302: <em class="replaceable"><code>pkg</code></em> has been
6303: included at some point. <code class=
6304: "varname">BUILDLINK_PACKAGES</code> is the global list
6305: of packages for which <code class=
6306: "filename">buildlink3.mk</code> files have been
6307: included. It must <span class=
6308: "emphasis"><em>always</em></span> be appended to within
6309: a <code class="filename">buildlink3.mk</code> file.</p>
1.1 grant 6310:
6311: <p>The third section is protected from multiple
1.14 xtraeme 6312: inclusion and controls how the dependency on <em class=
6313: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 6314: important variables are set in the section:</p>
6315:
6316: <div class="itemizedlist">
6317: <ul type="disc">
6318: <li>
1.14 xtraeme 6319: <p><code class=
6320: "varname">BUILDLINK_DEPENDS.<em class=
6321: "replaceable"><code>pkg</code></em></code> is the
6322: actual dependency recorded in the installed
6323: package; this should always be set using
6324: <span><strong class="command">+=</strong></span>
6325: to ensure that we're appending to any
6326: pre-existing list of values. This variable should
6327: be set to the first version of the package that
6328: had the last change in the major number of a
6329: shared library or that had a major API
6330: change.</p>
1.1 grant 6331: </li>
6332:
6333: <li>
1.14 xtraeme 6334: <p><code class=
6335: "varname">BUILDLINK_PKGSRCDIR.<em class=
6336: "replaceable"><code>pkg</code></em></code> is the
6337: location of the <em class=
6338: "replaceable"><code>pkg</code></em> pkgsrc
1.1 grant 6339: directory;</p>
6340: </li>
6341:
6342: <li>
1.14 xtraeme 6343: <p><code class=
6344: "varname">BUILDLINK_DEPMETHOD.<em class=
6345: "replaceable"><code>pkg</code></em></code> (not
6346: shown above) controls whether we use <code class=
6347: "varname">BUILD_DEPENDS</code> or <code class=
6348: "varname">DEPENDS</code> to add the dependency on
6349: <em class="replaceable"><code>pkg</code></em>.
6350: The build dependency is selected by setting
6351: <code class=
6352: "varname">BUILDLINK_DEPMETHOD.<em class=
6353: "replaceable"><code>pkg</code></em></code> to
1.1 grant 6354: “<span class="quote">build</span>”.
6355: By default, the full dependency is used.</p>
6356: </li>
6357:
6358: <li>
1.14 xtraeme 6359: <p><code class=
6360: "varname">BUILDLINK_INCDIRS.<em class=
6361: "replaceable"><code>pkg</code></em></code> and
6362: <code class=
6363: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
6364: <code>pkg</code></em></code> (not shown above)
6365: are lists of subdirectories of <code class=
6366: "filename">${BUILDLINK_PREFIX.<em class=
6367: "replaceable"><code>pkg</code></em>}</code> to
6368: add to the header and library search paths. These
1.1 grant 6369: default to “<span class=
6370: "quote">include</span>” and
6371: “<span class="quote">lib</span>”
6372: respectively.</p>
6373: </li>
6374:
6375: <li>
1.14 xtraeme 6376: <p><code class=
6377: "varname">BUILDLINK_CPPFLAGS.<em class=
6378: "replaceable"><code>pkg</code></em></code> (not
6379: shown above) is the list of preprocessor flags to
6380: add to <code class="varname">CPPFLAGS</code>,
6381: which are passed on to the configure and build
6382: phases. The “<span class=
6383: "quote">-I</span>” option should be avoided
6384: and instead be handled using <code class=
6385: "varname">BUILDLINK_INCDIRS.<em class=
6386: "replaceable"><code>pkg</code></em></code> as
6387: above.</p>
1.1 grant 6388: </li>
6389: </ul>
6390: </div>
6391:
6392: <p>The following variables are all optionally defined
6393: within this second section (protected against multiple
6394: inclusion) and control which package files are
1.14 xtraeme 6395: symlinked into <code class=
6396: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 6397: are transformed during the symlinking:</p>
6398:
6399: <div class="itemizedlist">
6400: <ul type="disc">
6401: <li>
1.14 xtraeme 6402: <p><code class=
6403: "varname">BUILDLINK_FILES.<em class=
6404: "replaceable"><code>pkg</code></em></code> (not
6405: shown above) is a shell glob pattern relative to
6406: <code class=
6407: "filename">${BUILDLINK_PREFIX.<em class=
6408: "replaceable"><code>pkg</code></em>}</code> to be
6409: symlinked into <code class=
6410: "filename">${BUILDLINK_DIR}</code>, e.g.
6411: <code class="filename">include/*.h</code>.</p>
1.1 grant 6412: </li>
6413:
6414: <li>
1.14 xtraeme 6415: <p><code class=
6416: "varname">BUILDLINK_FILES_CMD.<em class=
6417: "replaceable"><code>pkg</code></em></code> (not
6418: shown above) is a shell pipeline that outputs to
6419: stdout a list of files relative to <code class=
6420: "filename">${BUILDLINK_PREFIX.<em class=
6421: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 6422: resulting files are to be symlinked into
1.14 xtraeme 6423: <code class="filename">${BUILDLINK_DIR}</code>.
6424: By default, this takes the <code class=
6425: "filename">+CONTENTS</code> of a <em class=
6426: "replaceable"><code>pkg</code></em> and filters
6427: it through <code class=
6428: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
6429: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 6430: </li>
6431:
6432: <li>
1.14 xtraeme 6433: <p><code class=
6434: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
6435: "replaceable"><code>pkg</code></em></code> (not
6436: shown above) is a filter command that filters
6437: <code class="filename">+CONTENTS</code> input
6438: into a list of files relative to <code class=
6439: "filename">${BUILDLINK_PREFIX.<em class=
6440: "replaceable"><code>pkg</code></em>}</code> on
6441: stdout. By default for overwrite packages,
6442: <code class=
6443: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
6444: "replaceable"><code>pkg</code></em></code>
6445: outputs the contents of the <code class=
6446: "filename">include</code> and <code class=
6447: "filename">lib</code> directories in the package
6448: <code class="filename">+CONTENTS</code>, and for
6449: pkgviews packages, it outputs any libtool
6450: archives in <code class="filename">lib</code>
1.1 grant 6451: directories.</p>
6452: </li>
6453:
6454: <li>
1.14 xtraeme 6455: <p><code class=
6456: "varname">BUILDLINK_TRANSFORM.<em class=
6457: "replaceable"><code>pkg</code></em></code> (not
6458: shown above) is a list of sed arguments used to
1.1 grant 6459: transform the name of the source filename into a
1.14 xtraeme 6460: destination filename, e.g. <span><strong class=
1.1 grant 6461: "command">-e
1.14 xtraeme 6462: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 6463: </li>
6464: </ul>
6465: </div>
6466:
1.14 xtraeme 6467: <p>The last section includes any <code class=
6468: "filename">buildlink3.mk</code> needed for <em class=
6469: "replaceable"><code>pkg</code></em>'s library
6470: dependencies. Including these <code class=
6471: "filename">buildlink3.mk</code> files means that the
6472: headers and libraries for these dependencies are also
6473: symlinked into <code class=
6474: "filename">${BUILDLINK_DIR}</code> whenever the
6475: <em class="replaceable"><code>pkg</code></em>
6476: <code class="filename">buildlink3.mk</code> file is
6477: included.</p>
1.1 grant 6478: </div>
6479:
6480: <div class="sect2" lang="en" xml:lang="en">
6481: <div class="titlepage">
6482: <div>
6483: <div>
1.20 ! ben 6484: <h3 class="title"><a name="id2591022" id=
! 6485: "id2591022"></a>9.2.2. Updating <code class=
1.14 xtraeme 6486: "varname">BUILDLINK_DEPENDS.<em class=
6487: "replaceable"><code>pkg</code></em></code> in
6488: <code class="filename">buildlink3.mk</code>
6489: files</h3>
1.1 grant 6490: </div>
6491: </div>
6492: </div>
6493:
6494: <p>There are two situations that require increasing the
1.14 xtraeme 6495: dependency listed in <code class=
6496: "varname">BUILDLINK_DEPENDS.<em class=
6497: "replaceable"><code>pkg</code></em></code> after a
6498: package update:</p>
1.1 grant 6499:
6500: <div class="orderedlist">
6501: <ol type="1">
6502: <li>
6503: <p>if the sonames (major number of the library
6504: version) of any installed shared libraries
6505: change;</p>
6506: </li>
6507:
6508: <li>
6509: <p>if the API or interface to the header files
6510: change.</p>
6511: </li>
6512: </ol>
6513: </div>
6514:
1.14 xtraeme 6515: <p>In these cases, <code class=
6516: "varname">BUILDLINK_DEPENDS.<em class=
6517: "replaceable"><code>pkg</code></em></code> should be
6518: adjusted to require at least the new package version.
6519: In some cases, the packages that depend on this new
6520: version may need their <code class=
6521: "varname">PKGREVISION</code>s increased and, if they
6522: have <code class="filename">buildlink3.mk</code> files,
6523: their <code class=
6524: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
6525: pkg</code></em></code> adjusted, too. This is needed so
6526: that binary packages made using it will require the
6527: correct package dependency and not settle for an older
6528: one which will not contain the necessary shared
6529: libraries.</p>
1.1 grant 6530:
6531: <p>Please take careful consideration before adjusting
1.14 xtraeme 6532: <code class="varname">BUILDLINK_DEPENDS.<em class=
6533: "replaceable"><code>pkg</code></em></code> as we don't
6534: want to cause unneeded package deletions and rebuilds.
6535: In many cases, new versions of packages work just fine
6536: with older dependencies. See <a href="#dependencies"
6537: title="12.1.3. Handling dependencies">Section
6538: 12.1.3, “Handling dependencies”</a> and
6539: <a href="#buildlink" title=
1.1 grant 6540: "Chapter 9. Buildlink methodology">Chapter 9,
6541: <i>Buildlink methodology</i></a> for more information
6542: about dependencies on other packages, including the
1.14 xtraeme 6543: <code class="varname">BUILDLINK_RECOMMENDED</code> and
6544: <code class="varname">RECOMMENDED</code>
6545: definitions.</p>
1.1 grant 6546: </div>
6547: </div>
6548:
6549: <div class="sect1" lang="en" xml:lang="en">
6550: <div class="titlepage">
6551: <div>
6552: <div>
6553: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 6554: "id2591170" id="id2591170"></a>9.3. Writing
1.14 xtraeme 6555: <code class="filename">builtin.mk</code> files</h2>
1.1 grant 6556: </div>
6557: </div>
6558: </div>
6559:
6560: <p>Some packages in pkgsrc install headers and libraries
6561: that coincide with headers and libraries present in the
1.14 xtraeme 6562: base system. Aside from a <code class=
6563: "filename">buildlink3.mk</code> file, these packages
6564: should also include a <code class=
6565: "filename">builtin.mk</code> file that includes the
6566: necessary checks to decide whether using the built-in
6567: software or the pkgsrc software is appropriate.</p>
1.1 grant 6568:
6569: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 6570: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 6571:
6572: <div class="orderedlist">
6573: <ol type="1">
6574: <li>
1.14 xtraeme 6575: <p>It should set <code class=
6576: "varname">USE_BUILTIN.<em class=
6577: "replaceable"><code>pkg</code></em></code> to
6578: either “<span class="quote">yes</span>”
6579: or “<span class="quote">no</span>”
6580: after it is included.</p>
1.1 grant 6581: </li>
6582:
6583: <li>
6584: <p>It should <span class=
6585: "emphasis"><em>not</em></span> override any
1.14 xtraeme 6586: <code class="varname">USE_BUILTIN.<em class=
6587: "replaceable"><code>pkg</code></em></code> which is
6588: already set before the <code class=
6589: "filename">builtin.mk</code> file is included.</p>
1.1 grant 6590: </li>
6591:
6592: <li>
6593: <p>It should be written to allow multiple
6594: inclusion. This is <span class=
6595: "emphasis"><em>very</em></span> important and takes
1.14 xtraeme 6596: careful attention to <code class=
6597: "filename">Makefile</code> coding.</p>
1.1 grant 6598: </li>
6599: </ol>
6600: </div>
6601:
6602: <div class="sect2" lang="en" xml:lang="en">
6603: <div class="titlepage">
6604: <div>
6605: <div>
1.20 ! ben 6606: <h3 class="title"><a name="id2591387" id=
! 6607: "id2591387"></a>9.3.1. Anatomy of a
1.14 xtraeme 6608: <code class="filename">builtin.mk</code>
6609: file</h3>
1.1 grant 6610: </div>
6611: </div>
6612: </div>
6613:
6614: <p>The following is the recommended template for
6615: builtin.mk files:</p>
6616: <pre class="programlisting">
6617: .if !defined(IS_BUILTIN.foo)
6618: #
6619: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
6620: # genuinely exists in the system or not.
6621: #
6622: IS_BUILTIN.foo?= no
6623:
6624: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
6625: # version can be determined.
6626: #
6627: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
6628: BUILTIN_PKG.foo?= foo-1.0
6629: . endif
6630: .endif # IS_BUILTIN.foo
6631:
6632: .if !defined(USE_BUILTIN.foo)
6633: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
6634: . if defined(BUILTIN_PKG.foo)
6635: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
6636: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
6637: USE_BUILTIN.foo!= \
6638: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
6639: ${ECHO} "yes"; \
6640: else \
6641: ${ECHO} "no"; \
6642: fi
6643: . endif
6644: . endfor
6645: . endif
6646: .endif # USE_BUILTIN.foo
6647:
6648: CHECK_BUILTIN.foo?= no
6649: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
6650: #
6651: # Here we place code that depends on whether USE_BUILTIN.foo is set to
6652: # "yes" or "no".
6653: #
6654: .endif # CHECK_BUILTIN.foo
6655:
6656: </pre>
6657:
1.14 xtraeme 6658: <p>The first section sets <code class=
6659: "varname">IS_BUILTIN.<em class=
6660: "replaceable"><code>pkg</code></em></code> depending on
6661: if <em class="replaceable"><code>pkg</code></em> really
6662: exists in the base system. This should not be a base
6663: system software with similar functionality to
6664: <em class="replaceable"><code>pkg</code></em>; it
6665: should only be “<span class=
6666: "quote">yes</span>” if the actual package is
6667: included as part of the base system. This variable is
6668: only used internally within the <code class=
6669: "filename">builtin.mk</code> file.</p>
6670:
6671: <p>The second section sets <code class=
6672: "varname">BUILTIN_PKG.<em class=
6673: "replaceable"><code>pkg</code></em></code> to the
6674: version of <em class=
6675: "replaceable"><code>pkg</code></em> in the base system
6676: if it exists (if <code class=
6677: "varname">IS_BUILTIN.<em class=
6678: "replaceable"><code>pkg</code></em></code> is
1.1 grant 6679: “<span class="quote">yes</span>”). This
1.14 xtraeme 6680: variable is only used internally within the
6681: <code class="filename">builtin.mk</code> file.</p>
1.1 grant 6682:
1.14 xtraeme 6683: <p>The third section sets <code class=
6684: "varname">USE_BUILTIN.<em class=
6685: "replaceable"><code>pkg</code></em></code> and is
6686: <span class="emphasis"><em>required</em></span> in all
6687: <code class="filename">builtin.mk</code> files. The
6688: code in this section must make the determination
6689: whether the built-in software is adequate to satisfy
6690: the dependencies listed in <code class=
6691: "varname">BUILDLINK_DEPENDS.<em class=
6692: "replaceable"><code>pkg</code></em></code>. This is
6693: typically done by comparing <code class=
6694: "varname">BUILTIN_PKG.<em class=
6695: "replaceable"><code>pkg</code></em></code> against each
6696: of the dependencies in <code class=
6697: "varname">BUILDLINK_DEPENDS.<em class=
6698: "replaceable"><code>pkg</code></em></code>.
6699: <code class="varname">USE_BUILTIN.<em class=
6700: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 6701: "emphasis"><em>must</em></span> be set to the correct
1.14 xtraeme 6702: value by the end of the <code class=
6703: "filename">builtin.mk</code> file. Note that
6704: <code class="varname">USE_BUILTIN.<em class=
6705: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 6706: “<span class="quote">yes</span>” even if
1.14 xtraeme 6707: <code class="varname">IS_BUILTIN.<em class=
6708: "replaceable"><code>pkg</code></em></code> is
1.1 grant 6709: “<span class="quote">no</span>” because we
6710: may make the determination that the built-in version of
6711: the software is similar enough to be used as a
6712: replacement.</p>
6713:
1.14 xtraeme 6714: <p>The last section is guarded by <code class=
6715: "varname">CHECK_BUILTIN.<em class=
6716: "replaceable"><code>pkg</code></em></code>, and
6717: includes code that uses the value of <code class=
6718: "varname">USE_BUILTIN.<em class=
6719: "replaceable"><code>pkg</code></em></code> set in the
6720: previous section. This typically includes, e.g., adding
1.1 grant 6721: additional dependency restrictions and listing
1.14 xtraeme 6722: additional files to symlink into <code class=
6723: "filename">${BUILDLINK_DIR}</code> (via <code class=
6724: "varname">BUILDLINK_FILES.<em class=
6725: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 6726: </div>
6727:
6728: <div class="sect2" lang="en" xml:lang="en">
6729: <div class="titlepage">
6730: <div>
6731: <div>
1.20 ! ben 6732: <h3 class="title"><a name="id2591614" id=
! 6733: "id2591614"></a>9.3.2. Global preferences
1.1 grant 6734: for native or pkgsrc software</h3>
6735: </div>
6736: </div>
6737: </div>
6738:
6739: <p>When building packages, it's possible to choose
6740: whether to set a global preference for using either the
6741: built-in (native) version or the pkgsrc version of
6742: software to satisfy a dependency. This is controlled by
1.14 xtraeme 6743: setting <code class="varname">PREFER_PKGSRC</code> and
6744: <code class="varname">PREFER_NATIVE</code>. These
6745: variables take values of either “<span class=
1.1 grant 6746: "quote">yes</span>”, “<span class=
6747: "quote">no</span>”, or a list of packages.
1.14 xtraeme 6748: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
6749: to use the pkgsrc versions of software, while
6750: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
6751: to use the built-in versions. Preferences are
6752: determined by the most specific instance of the package
6753: in either <code class="varname">PREFER_PKGSRC</code> or
6754: <code class="varname">PREFER_NATIVE</code>. If a
6755: package is specified in neither or in both variables,
6756: then <code class="varname">PREFER_PKGSRC</code> has
6757: precedence over <code class=
6758: "varname">PREFER_NATIVE</code>. For example, to require
6759: using pkgsrc versions of software for all but the most
6760: basic bits on a NetBSD system, you can set:</p>
1.1 grant 6761: <pre class="programlisting">
6762: PREFER_PKGSRC= yes
6763: PREFER_NATIVE= getopt skey tcp_wrappers
6764:
6765: </pre>
6766:
6767: <p>A package <span class=
1.14 xtraeme 6768: "emphasis"><em>must</em></span> have a <code class=
6769: "filename">builtin.mk</code> file to be listed in
6770: <code class="varname">PREFER_NATIVE</code>, otherwise
6771: it is simply ignored in that list.</p>
1.1 grant 6772: </div>
6773: </div>
6774: </div>
6775:
6776: <div class="chapter" lang="en" xml:lang="en">
6777: <div class="titlepage">
6778: <div>
6779: <div>
6780: <h2 class="title"><a name="options" id=
6781: "options"></a>Chapter 10. Options
6782: handling</h2>
6783: </div>
6784: </div>
6785: </div>
6786:
6787: <div class="toc">
6788: <p><b>Table of Contents</b></p>
6789:
6790: <dl>
1.20 ! ben 6791: <dt><span class="sect1"><a href="#id2591687">10.1.
1.1 grant 6792: Global default options</a></span></dt>
6793:
1.20 ! ben 6794: <dt><span class="sect1"><a href="#id2591702">10.2.
1.14 xtraeme 6795: Converting packages to use <code class=
6796: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 6797: </dl>
6798: </div>
6799:
6800: <p>Many packages have the ability to be built to support
1.14 xtraeme 6801: different sets of features. <code class=
6802: "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1 grant 6803: that provides generic handling of those options that
6804: determine different ways in which the packages can be
6805: built. It's possible for the user to specify exactly which
6806: sets of options will be built into a package or to allow a
6807: set of global default options apply.</p>
6808:
6809: <div class="sect1" lang="en" xml:lang="en">
6810: <div class="titlepage">
6811: <div>
6812: <div>
6813: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 6814: "id2591687" id="id2591687"></a>10.1. Global
1.1 grant 6815: default options</h2>
6816: </div>
6817: </div>
6818: </div>
6819:
1.14 xtraeme 6820: <p>Global default options are listed in <code class=
6821: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1 grant 6822: the options that should be built into every package if
6823: that option is supported. This variable should be set in
1.14 xtraeme 6824: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 6825: </div>
6826:
6827: <div class="sect1" lang="en" xml:lang="en">
6828: <div class="titlepage">
6829: <div>
6830: <div>
6831: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 6832: "id2591702" id=
! 6833: "id2591702"></a>10.2. Converting packages to
1.14 xtraeme 6834: use <code class=
6835: "filename">bsd.options.mk</code></h2>
1.1 grant 6836: </div>
6837: </div>
6838: </div>
6839:
1.14 xtraeme 6840: <p>The following example shows how <code class=
6841: "filename">bsd.options.mk</code> should be use in a
6842: package <code class="filename">Makefile</code>, or in a
6843: file, e.g. <code class="filename">options.mk</code>, that
6844: is included by the main package <code class=
6845: "filename">Makefile</code>.</p>
1.1 grant 6846: <pre class="programlisting">
6847: # Global and legacy options
6848: .if defined(WIBBLE_USE_OPENLDAP) && !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
6849: PKG_DEFAULT_OPTIONS+= ldap
6850: .endif
6851: .if defined(USE_SASL2) && !empty(USE_SASL2:M[yY][eE][sS])
6852: PKG_DEFAULT_OPTIONS+= sasl
6853: .endif
6854:
6855: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
6856: PKG_SUPPORTED_OPTIONS= ldap sasl
6857: #
6858: # Default options for "wibble" package.
6859: #
6860: .if !defined(PKG_OPTIONS.wibble)
6861: PKG_DEFAULT_OPTIONS+= sasl
6862: endif
6863: .include "../../mk/bsd.options.mk"
6864:
6865: # Package-specific option-handling
6866:
6867: ###
6868: ### LDAP support
6869: ###
6870: .if !empty(PKG_OPTIONS:Mldap)
6871: . include "../../databases/openldap/buildlink3.mk"
6872: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
6873: .endif
6874:
6875: ###
6876: ### SASL authentication
6877: ###
6878: .if !empty(PKG_OPTIONS:Msasl)
6879: . include "../../security/cyrus-sasl2/buildlink3.mk"
6880: CONFIGURE_ARGS+= --enable-sasl=${BUILDLINK_PREFIX.sasl}
6881: .endif
6882:
6883: </pre>
6884:
6885: <p>The first section only exists if you are converting a
6886: package that had its own ad-hoc options handling to use
1.14 xtraeme 6887: <code class="filename">bsd.options.mk</code>. It converts
1.1 grant 6888: global or legacy options variables into an equivalent
1.14 xtraeme 6889: <code class="varname">PKG_OPTIONS.<em class=
6890: "replaceable"><code>pkg</code></em></code> value. These
6891: sections will be removed over time as the old options are
6892: in turn deprecated and removed.</p>
1.1 grant 6893:
6894: <p>The second section contains the information about
6895: which build options are supported by the package, and any
6896: default options settings if needed.</p>
6897:
6898: <div class="orderedlist">
6899: <ol type="1">
6900: <li>
1.14 xtraeme 6901: <p><code class="varname">PKG_OPTIONS_VAR</code> is
6902: a list of the name of the <a href=
1.1 grant 6903: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6904: <span class="citerefentry"><span class=
6905: "refentrytitle">make</span>(1)</span></a> variables
6906: that contain the options the user wishes to select.
6907: The recommended value is “<span class=
1.14 xtraeme 6908: "quote">PKG_OPTIONS.<em class=
6909: "replaceable"><code>pkg</code></em></span>”
6910: but any package-specific value may be used. This
1.1 grant 6911: variable should be set in a package Makefile.</p>
6912: </li>
6913:
6914: <li>
1.14 xtraeme 6915: <p><code class=
6916: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
6917: build options supported by the package. This
6918: variable should be set in a package Makefile.</p>
1.1 grant 6919: </li>
6920:
6921: <li>
1.14 xtraeme 6922: <p><code class="varname">${PKG_OPTIONS_VAR}</code>
6923: (the variables named in <code class=
6924: "varname">PKG_OPTIONS_VAR</code>) are variables
6925: that list the selected build options and override
6926: any default options given in <code class=
6927: "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1 grant 6928: options begin with a “<span class=
6929: "quote">-</span>”, then that option is always
6930: removed from the selected build options, e.g.</p>
6931: <pre class="programlisting">
6932: PKG_DEFAULT_OPTIONS= kerberos ldap sasl
6933: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
6934: WIBBLE_OPTIONS= ${PKG_DEFAULT_OPTIONS} -sasl
6935: # implies PKG_OPTIONS == "kerberos ldap"
6936:
6937: </pre>
6938:
6939: <p>or</p>
6940: <pre class="programlisting">
6941: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
6942: WIBBLE_OPTIONS= kerberos -ldap ldap
6943: # implies PKG_OPTIONS == "kerberos"
6944:
6945: </pre>
6946:
1.14 xtraeme 6947: <p>This variable should be set in <code class=
6948: "filename">/etc/mk.conf</code>.</p>
1.1 grant 6949: </li>
6950: </ol>
6951: </div>
6952:
6953: <p>After the inclusion of bsd.options.mk, the following
6954: variables are set:</p>
6955:
6956: <div class="itemizedlist">
6957: <ul type="disc">
6958: <li>
1.14 xtraeme 6959: <p><code class="varname">PKG_OPTIONS</code>
6960: contains the list of the selected build options,
6961: properly filtered to remove unsupported and
6962: duplicate options.</p>
1.1 grant 6963: </li>
6964: </ul>
6965: </div>
6966:
6967: <p>The remaining sections contain the logic that is
6968: specific to each option. There should be a check for
1.14 xtraeme 6969: every option listed in <code class=
6970: "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
6971: be clear documentation on what turning on the option will
6972: do in the comments preceding each section. The correct
6973: way to check for an option is to check whether it is
6974: listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1 grant 6975: </div>
6976: </div>
6977:
6978: <div class="chapter" lang="en" xml:lang="en">
6979: <div class="titlepage">
6980: <div>
6981: <div>
6982: <h2 class="title"><a name="build" id=
6983: "build"></a>Chapter 11. The build
6984: process</h2>
6985: </div>
6986: </div>
6987: </div>
6988:
6989: <div class="toc">
6990: <p><b>Table of Contents</b></p>
6991:
6992: <dl>
6993: <dt><span class="sect1"><a href="#build.prefix">11.1.
6994: Program location</a></span></dt>
6995:
1.20 ! ben 6996: <dt><span class="sect1"><a href="#id2592310">11.2. Main
1.1 grant 6997: targets</a></span></dt>
6998:
6999: <dt><span class="sect1"><a href=
7000: "#build.helpful-targets">11.3. Other helpful
7001: targets</a></span></dt>
7002: </dl>
7003: </div>
7004:
7005: <p>The basic steps for building a program are always the
7006: same. First the program's source (<span class=
7007: "emphasis"><em>distfile</em></span>) must be brought to the
7008: local system and then extracted. After any patches to
7009: compile properly on NetBSD are applied, the software can be
7010: configured, then built (usually by compiling), and finally
7011: the generated binaries, etc. can be put into place on the
7012: system. These are exactly the steps performed by the NetBSD
7013: package system, which is implemented as a series of targets
1.14 xtraeme 7014: in a central Makefile, <code class=
7015: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 7016:
7017: <div class="sect1" lang="en" xml:lang="en">
7018: <div class="titlepage">
7019: <div>
7020: <div>
7021: <h2 class="title" style="clear: both"><a name=
7022: "build.prefix" id=
7023: "build.prefix"></a>11.1. Program location</h2>
7024: </div>
7025: </div>
7026: </div>
7027:
7028: <p>Before outlining the process performed by the NetBSD
7029: package system in the next section, here's a brief
7030: discussion on where programs are installed, and which
7031: variables influence this.</p>
7032:
1.14 xtraeme 7033: <p>The automatic variable <code class=
7034: "varname">PREFIX</code> indicates where all files of the
7035: final program shall be installed. It is usually set to
7036: <code class="varname">LOCALBASE</code> (<code class=
7037: "filename">/usr/pkg</code>), or <code class=
7038: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 7039: “<span class="quote">cross</span>” category.
1.14 xtraeme 7040: The value of <code class="varname">PREFIX</code> needs to
7041: be put into the various places in the program's source
7042: where paths to these files are encoded. See <a href=
1.1 grant 7043: "#components.patches" title=
7044: "7.3. patches/*">Section 7.3,
7045: “patches/*”</a> and <a href="#fixes.libtool"
7046: title=
7047: "12.3.1. Shared libraries - libtool">Section 12.3.1,
7048: “Shared libraries - libtool”</a> for more
7049: details.</p>
7050:
7051: <p>When choosing which of these variables to use, follow
7052: the following rules:</p>
7053:
7054: <div class="itemizedlist">
7055: <ul type="disc">
7056: <li>
1.14 xtraeme 7057: <p><code class="varname">PREFIX</code> always
7058: points to the location where the current pkg will
7059: be installed. When referring to a pkg's own
1.1 grant 7060: installation path, use “<span class=
7061: "quote">${PREFIX}</span>”.</p>
7062: </li>
7063:
7064: <li>
1.14 xtraeme 7065: <p><code class="varname">LOCALBASE</code> is where
7066: all non-X11 pkgs are installed. If you need to
1.1 grant 7067: construct a -I or -L argument to the compiler to
7068: find includes and libraries installed by another
7069: non-X11 pkg, use “<span class=
7070: "quote">${LOCALBASE}</span>”.</p>
7071: </li>
7072:
7073: <li>
1.14 xtraeme 7074: <p><code class="varname">X11BASE</code> is where
7075: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 7076: installed. When looking for <span class=
7077: "emphasis"><em>standard</em></span> X11 includes
7078: (not those installed by a pkg), use
7079: “<span class=
7080: "quote">${X11BASE}</span>”.</p>
7081: </li>
7082:
7083: <li>
7084: <p>X11 based are special in that they may be
1.14 xtraeme 7085: installed in either <code class=
7086: "varname">X11BASE</code> or <code class=
7087: "varname">LOCALBASE</code>.</p>
1.1 grant 7088:
7089: <p>Usually, X11 packages should be installed under
1.14 xtraeme 7090: <code class="varname">LOCALBASE</code> whenever
7091: possible. Note that you will need to set
7092: <code class="varname">USE_X11</code> in them to
7093: request the presence of X11 and to get the right
7094: compilation flags.</p>
1.1 grant 7095:
7096: <p>Even though, there are some packages that cannot
1.14 xtraeme 7097: be installed under <code class=
7098: "varname">LOCALBASE</code>: those that come with
1.1 grant 7099: app-defaults files. These packages are special and
1.14 xtraeme 7100: they must be placed under <code class=
7101: "varname">X11BASE</code>. To accomplish this, set
7102: either <code class="varname">USE_X11BASE</code> or
7103: <code class="varname">USE_IMAKE</code> in your
1.1 grant 7104: package.</p>
7105:
1.14 xtraeme 7106: <p>Some notes: <code class="varname">USE_X11</code>
7107: and <code class="varname">USE_X11BASE</code> are
7108: mutually exclusive. If you need to find includes or
7109: libraries installed by a pkg that has <code class=
7110: "varname">USE_IMAKE</code> or <code class=
7111: "varname">USE_X11BASE</code> in its pkg
7112: <code class="filename">Makefile</code>, you need to
7113: use <span class="emphasis"><em>both</em></span>
7114: <code class="filename">${X11BASE}</code> and
7115: <code class="filename">${LOCALBASE}</code>. To
7116: force installation of all X11 packages in
7117: <code class="varname">LOCALBASE</code>, the
7118: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
7119: href=
1.1 grant 7120: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20 ! ben 7121: class="pkgname">pkgtools/xpkgwedge</a> is enabled
! 7122: by default.</p>
1.1 grant 7123: </li>
7124:
7125: <li>
1.14 xtraeme 7126: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 7127: used to refer to the installed location of an X11
1.14 xtraeme 7128: package. <code class="varname">X11PREFIX</code>
7129: will be set to <code class="varname">X11BASE</code>
7130: if xpkgwedge is not installed, and to <code class=
7131: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 7132: installed.</p>
7133: </li>
7134:
7135: <li>
7136: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 7137: have some packages installed in <code class=
7138: "varname">X11BASE</code> and some in <code class=
7139: "varname">LOCALBASE</code>. To determine the prefix
7140: of an installed package, the <code class=
7141: "varname">EVAL_PREFIX</code> definition can be
7142: used. It takes pairs in the format
7143: “<span class=
1.1 grant 7144: "quote">DIRNAME=<package></span>”, and
1.14 xtraeme 7145: the make(1) variable <code class=
7146: "varname">DIRNAME</code> will be set to the prefix
7147: of the installed package <package>, or
1.1 grant 7148: “<span class=
7149: "quote">${X11PREFIX}</span>” if the package
7150: is not installed.</p>
7151:
7152: <p>This is best illustrated by example.</p>
7153:
1.14 xtraeme 7154: <p>The following lines are taken from <code class=
7155: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 7156: <pre class="programlisting">
1.14 xtraeme 7157: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 7158: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
7159: --with-gtk-prefix="${GTKDIR}" \
7160: --enable-multibyte
7161: </pre>
7162:
7163: <p>Specific defaults can be defined for the
1.14 xtraeme 7164: packages evaluated using <code class=
7165: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 7166: of the form:</p>
7167: <pre class="programlisting">
7168: GTKDIR_DEFAULT= ${LOCALBASE}
7169: </pre>
7170:
1.14 xtraeme 7171: <p>where <code class="varname">GTKDIR</code>
1.1 grant 7172: corresponds to the first definition in the
1.14 xtraeme 7173: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 7174: </li>
7175:
7176: <li>
1.14 xtraeme 7177: <p>Within <code class="filename">${PREFIX}</code>,
1.1 grant 7178: packages should install files according to hier(7),
7179: with the exception that manual pages go into
1.14 xtraeme 7180: <code class="filename">${PREFIX}/man</code>, not
7181: <code class=
7182: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 7183: </li>
7184: </ul>
7185: </div>
7186: </div>
7187:
7188: <div class="sect1" lang="en" xml:lang="en">
7189: <div class="titlepage">
7190: <div>
7191: <div>
7192: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 7193: "id2592310" id="id2592310"></a>11.2. Main
1.1 grant 7194: targets</h2>
7195: </div>
7196: </div>
7197: </div>
7198:
7199: <p>The main targets used during the build process defined
1.14 xtraeme 7200: in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 7201:
7202: <div class="variablelist">
7203: <dl>
7204: <dt><span class="term">fetch</span></dt>
7205:
7206: <dd>
7207: <p>This will check if the file(s) given in the
1.14 xtraeme 7208: variables <code class="varname">DISTFILES</code>
7209: and <code class="varname">PATCHFILES</code> (as
7210: defined in the package's Makefile) are present on
7211: the local system in <code class=
7212: "filename">/usr/pkgsrc/distfiles</code>. If they
7213: are not present, an attempt will be made to fetch
7214: them using commands of the form:</p>
1.1 grant 7215: <pre class="programlisting">
7216: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
7217: </pre>
7218:
7219: <p>where ${site} varies through several
1.14 xtraeme 7220: possibilities in turn: first, <code class=
7221: "varname">MASTER_SITE_OVERRIDE</code> is tried,
7222: then the sites specified in either <code class=
7223: "varname">SITES_file</code> if defined, else
7224: <code class="varname">MASTER_SITES</code> or
7225: <code class="varname">PATCH_SITES</code>, as
7226: applies, then finally the value of <code class=
7227: "varname">MASTER_SITE_BACKUP</code>. The order of
7228: all except the first can be optionally sorted by
7229: the user, via setting either <code class=
7230: "varname">MASTER_SORT_AWK</code> or <code class=
7231: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 7232: </dd>
7233:
7234: <dt><span class="term">checksum</span></dt>
7235:
7236: <dd>
7237: <p>After the distfile(s) are fetched, their
7238: checksum is generated and compared with the
7239: checksums stored in the distinfo file. If the
7240: checksums don't match, the build is aborted. This
7241: is to ensure the same distfile is used for
7242: building, and that the distfile wasn't changed,
7243: e.g. by some malign force, deliberately changed
7244: distfiles on the master distribution site or
7245: network lossage.</p>
7246: </dd>
7247:
7248: <dt><span class="term">extract</span></dt>
7249:
7250: <dd>
7251: <p>When the distfiles are present on the local
7252: system, they need to be extracted, as they are
7253: usually in the form of some compressed archive
1.14 xtraeme 7254: format, most commonly <code class=
7255: "filename">.tar.gz</code>.</p>
1.1 grant 7256:
7257: <p>If only some of the distfiles need to be
7258: uncompressed, the files to be uncompressed should
1.14 xtraeme 7259: be put into <code class=
7260: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 7261:
1.14 xtraeme 7262: <p>If the distfiles are not in <code class=
7263: "filename">.tar.gz</code> format, they can be
7264: extracted by setting either <code class=
7265: "varname">EXTRACT_SUFX</code>, or <code class=
7266: "varname">EXTRACT_CMD</code>, <code class=
7267: "varname">EXTRACT_BEFORE_ARGS</code> and
7268: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
7269: the former case, pkgsrc knows how to extract a
7270: number of suffixes (<code class=
7271: "filename">.tar.gz</code>, <code class=
7272: "filename">.tgz</code>, <code class=
7273: "filename">.tar.gz2</code>, <code class=
7274: "filename">.tbz</code>, <code class=
7275: "filename">.tar.Z</code>, <code class=
7276: "filename">.tar</code>, <code class=
7277: "filename">.shar.gz</code>, <code class=
7278: "filename">.shar.bz2</code>, <code class=
7279: "filename">.shar.Z</code>, <code class=
7280: "filename">.shar</code>, <code class=
7281: "filename">.Z</code>, <code class=
7282: "filename">.bz2</code> and <code class=
7283: "filename">.gz</code>; see the definition of the
7284: various <code class="varname">DECOMPRESS_CMD</code>
7285: variables <code class="filename">bsd.pkg.mk</code>
7286: for a complete list). Here's an example on how to
7287: use the other variables for a program that comes
7288: with a compressed shell archive whose name ends in
7289: <code class="filename">.msg.gz</code>:</p>
1.1 grant 7290: <pre class="programlisting">
7291: EXTRACT_SUFX= .msg.gz
7292: EXTRACT_CMD= zcat
7293: EXTRACT_BEFORE_ARGS=
7294: EXTRACT_AFTER_ARGS= |sh
7295: </pre>
7296: </dd>
7297:
7298: <dt><span class="term">patch</span></dt>
7299:
7300: <dd>
7301: <p>After extraction, all the patches named by the
1.14 xtraeme 7302: <code class="varname">PATCHFILES</code>, those
7303: present in the patches subdirectory of the package
7304: as well as in $LOCALPATCHES/$PKGPATH (e.g.
7305: <code class=
7306: "filename">/usr/local/patches/graphics/png</code>)
7307: are applied. Patchfiles ending in <code class=
7308: "filename">.Z</code> or <code class=
7309: "filename">.gz</code> are uncompressed before they
7310: are applied, files ending in <code class=
7311: "filename">.orig</code> or <code class=
7312: "filename">.rej</code> are ignored. Any special
7313: options to patch(1) can be handed in <code class=
7314: "varname">PATCH_DIST_ARGS</code>. See <a href=
7315: "#components.patches" title=
1.1 grant 7316: "7.3. patches/*">Section 7.3,
7317: “patches/*”</a> for more details.</p>
7318:
7319: <p>By default patch(1) is given special args to
7320: make it fail if the patches apply with some lines
7321: of fuzz. Please fix (regen) the patches so that
7322: they apply cleanly. The rationale behind this is
7323: that patches that don't apply cleanly may end up
7324: being applied in the wrong place, and cause severe
7325: harm there.</p>
7326: </dd>
7327:
7328: <dt><span class="term">configure</span></dt>
7329:
7330: <dd>
7331: <p>Most pieces of software need information on the
7332: header files, system calls, and library routines
7333: which are available in NetBSD. This is the process
7334: known as configuration, and is usually automated.
7335: In most cases, a script is supplied with the
7336: source, and its invocation results in generation of
7337: header files, Makefiles, etc.</p>
7338:
7339: <p>If the program's distfile contains its own
7340: configure script, this can be invoked by setting
1.14 xtraeme 7341: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 7342: configure script is a GNU autoconf script,
1.14 xtraeme 7343: <code class="varname">GNU_CONFIGURE</code> should
7344: be specified instead. In either case, any arguments
7345: to the configure script can be specified in the
7346: <code class="varname">CONFIGURE_ARGS</code>
7347: variable, and the configure script's name can be
7348: set in <code class=
7349: "varname">CONFIGURE_SCRIPT</code> if it differs
7350: from the default “<span class=
1.1 grant 7351: "quote">configure</span>”. Here's an example
7352: from the <a xmlns=
7353: "http://www.w3.org/TR/xhtml1/transitional" href=
7354: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20 ! ben 7355: class="pkgname">sysutils/top</a> package:</p>
1.1 grant 7356: <pre class="programlisting">
7357: HAS_CONFIGURE= yes
7358: CONFIGURE_SCRIPT= Configure
7359: CONFIGURE_ARGS+= netbsd13
7360: </pre>
7361:
7362: <p>If the program uses an Imakefile for
7363: configuration, the appropriate steps can be invoked
1.14 xtraeme 7364: by setting <code class="varname">USE_IMAKE</code>
7365: to “<span class="quote">YES</span>”.
7366: (If you only want the package installed in
7367: <code class="varname">$X11PREFIX</code> but xmkmf
7368: not being run, set <code class=
7369: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 7370: </dd>
7371:
7372: <dt><span class="term">build</span></dt>
7373:
7374: <dd>
7375: <p>Once configuration has taken place, the software
1.14 xtraeme 7376: will be built by invoking <code class=
7377: "varname">$MAKE_PROGRAM</code> on <code class=
7378: "varname">$MAKEFILE</code> with <code class=
7379: "varname">$BUILD_TARGET</code> as the target to
7380: build. The default <code class=
7381: "varname">MAKE_PROGRAM</code> is
7382: “<span class="quote">gmake</span>” if
7383: <code class="varname">USE_GNU_TOOLS</code> contains
1.7 wiz 7384: “<span class="quote">make</span>”,
1.1 grant 7385: “<span class="quote">make</span>”
1.14 xtraeme 7386: otherwise. <code class="varname">MAKEFILE</code> is
7387: set to “<span class=
1.1 grant 7388: "quote">Makefile</span>” by default, and
1.14 xtraeme 7389: <code class="varname">BUILD_TARGET</code> defaults
7390: to “<span class="quote">all</span>”.
7391: Any of these variables can be set in the package's
1.1 grant 7392: Makefile to change the default build process.</p>
7393: </dd>
7394:
7395: <dt><span class="term">install</span></dt>
7396:
7397: <dd>
7398: <p>Once the build stage has completed, the final
7399: step is to install the software in public
7400: directories, so users can access the programs and
1.14 xtraeme 7401: files. As in the build-target, <code class=
7402: "varname">$MAKE_PROGRAM</code> is invoked on
7403: <code class="varname">$MAKEFILE</code> here, but
7404: with the <code class=
7405: "varname">$INSTALL_TARGET</code> instead, the
7406: latter defaulting to “<span class=
7407: "quote">install</span>” (plus
7408: “<span class=
7409: "quote">install.man</span>”, if <code class=
7410: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 7411: </dd>
7412: </dl>
7413: </div>
7414:
7415: <p>If no target is specified, the default is
7416: “<span class="quote">build</span>”. If a
7417: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 7418: e.g. <span><strong class="command">make
7419: build</strong></span> will also perform the equivalent
7420: of:</p>
1.1 grant 7421: <pre class="programlisting">
7422: make fetch
7423: make checksum
7424: make extract
7425: make patch
7426: make configure
7427: make build
7428: </pre>
7429: </div>
7430:
7431: <div class="sect1" lang="en" xml:lang="en">
7432: <div class="titlepage">
7433: <div>
7434: <div>
7435: <h2 class="title" style="clear: both"><a name=
7436: "build.helpful-targets" id=
7437: "build.helpful-targets"></a>11.3. Other
7438: helpful targets</h2>
7439: </div>
7440: </div>
7441: </div>
7442:
7443: <div class="variablelist">
7444: <dl>
7445: <dt><span class="term">pre/post-*</span></dt>
7446:
7447: <dd>
7448: <p>For any of the main targets described in the
7449: previous section, two auxiliary targets exist with
7450: “<span class="quote">pre-</span>” and
7451: “<span class="quote">post-</span>” used
7452: as a prefix for the main target's name. These
7453: targets are invoked before and after the main
7454: target is called, allowing extra configuration or
7455: installation steps be performed from a package's
7456: Makefile, for example, which a program's configure
7457: script or install target omitted.</p>
7458: </dd>
7459:
7460: <dt><span class="term">do-*</span></dt>
7461:
7462: <dd>
7463: <p>Should one of the main targets do the wrong
7464: thing, and should there be no variable to fix this,
7465: you can redefine it with the do-* target. (Note
7466: that redefining the target itself instead of the
7467: do-* target is a bad idea, as the pre-* and post-*
7468: targets won't be called anymore, etc.) You will not
7469: usually need to do this.</p>
7470: </dd>
7471:
7472: <dt><span class="term">reinstall</span></dt>
7473:
7474: <dd>
1.14 xtraeme 7475: <p>If you did a <span><strong class="command">make
7476: install</strong></span> and you noticed some file
7477: was not installed properly, you can repeat the
1.1 grant 7478: installation with this target, which will ignore
7479: the “<span class="quote">already
7480: installed</span>” flag.</p>
7481: </dd>
7482:
7483: <dt><span class="term">deinstall</span></dt>
7484:
7485: <dd>
7486: <p>This target does a pkg_delete(1) in the current
7487: directory, effectively de-installing the package.
7488: The following variables can be used to tune the
7489: behaviour:</p>
7490:
7491: <div class="variablelist">
7492: <dl>
1.14 xtraeme 7493: <dt><span class="term"><code class=
7494: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 7495:
7496: <dd>
7497: <p>Add a "-v" to the <a href=
7498: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7499: <span class="citerefentry"><span class=
7500: "refentrytitle">pkg_delete</span>(1)</span></a>
7501: command.</p>
7502: </dd>
7503:
1.14 xtraeme 7504: <dt><span class="term"><code class=
7505: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 7506:
7507: <dd>
7508: <p>Remove all packages that require (depend
7509: on) the given package. This can be used to
7510: remove any packages that may have been pulled
7511: in by a given package, e.g. if
1.14 xtraeme 7512: <span><strong class="command">make deinstall
7513: DEINSTALLDEPENDS=1</strong></span> is done in
7514: <code class="filename">pkgsrc/x11/kde</code>,
1.1 grant 7515: this is likely to remove whole KDE. Works by
7516: adding “<span class=
7517: "quote">-R</span>” to the <a href=
7518: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7519: <span class="citerefentry"><span class=
7520: "refentrytitle">pkg_delete</span>(1)</span></a>
7521: command line.</p>
7522: </dd>
7523: </dl>
7524: </div>
7525: </dd>
7526:
7527: <dt><span class="term">update</span></dt>
7528:
7529: <dd>
7530: <p>This target causes the current package to be
7531: updated to the latest version. The package and all
7532: depending packages first get de-installed, then
7533: current versions of the corresponding packages get
7534: compiled and installed. This is similar to manually
7535: noting which packages are currently installed, then
1.14 xtraeme 7536: performing a series of <span><strong class=
7537: "command">make deinstall</strong></span> and
7538: <span><strong class="command">make
7539: install</strong></span> (or whatever <code class=
7540: "varname">UPDATE_TARGET</code> is set to) for these
7541: packages.</p>
1.1 grant 7542:
7543: <p>You can use the “<span class=
7544: "quote">update</span>” target to resume
1.14 xtraeme 7545: package updating in case a previous
7546: <span><strong class="command">make
7547: update</strong></span> was interrupted for some
7548: reason. However, in this case, make sure you don't
7549: call <span><strong class="command">make
7550: clean</strong></span> or otherwise remove the list
7551: of dependent packages in <code class=
7552: "varname">WRKDIR</code>. Otherwise you lose the
1.1 grant 7553: ability to automatically update the current package
7554: along with the dependent packages you have
7555: installed.</p>
7556:
1.14 xtraeme 7557: <p>Resuming an interrupted <span><strong class=
7558: "command">make update</strong></span> will only
7559: work as long as the package tree remains unchanged.
7560: If the source code for one of the packages to be
7561: updated has been changed, resuming
7562: <span><strong class="command">make
7563: update</strong></span> will most certainly
7564: fail!</p>
1.1 grant 7565:
7566: <p>The following variables can be used either on
1.14 xtraeme 7567: the command line or in <code class=
7568: "filename">/etc/mk.conf</code> to alter the
7569: behaviour of <span><strong class="command">make
7570: update</strong></span>:</p>
1.1 grant 7571:
7572: <div class="variablelist">
7573: <dl>
1.14 xtraeme 7574: <dt><span class="term"><code class=
7575: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 7576:
7577: <dd>
7578: <p>Install target to recursively use for the
7579: updated package and the dependent packages.
1.14 xtraeme 7580: Defaults to <code class=
7581: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 7582: “<span class=
7583: "quote">install</span>” otherwise for
1.14 xtraeme 7584: <span><strong class="command">make
7585: update</strong></span>. e.g.
7586: <span><strong class="command">make update
7587: UPDATE_TARGET=package</strong></span></p>
1.1 grant 7588: </dd>
7589:
1.14 xtraeme 7590: <dt><span class="term"><code class=
7591: "varname">NOCLEAN</code></span></dt>
1.1 grant 7592:
7593: <dd>
7594: <p>Don't clean up after updating. Useful if
7595: you want to leave the work sources of the
7596: updated packages around for inspection or
7597: other purposes. Be sure you eventually clean
7598: up the source tree (see the
7599: “<span class=
7600: "quote">clean-update</span>” target
7601: below) or you may run into troubles with old
7602: source code still lying around on your next
1.14 xtraeme 7603: <span><strong class=
7604: "command">make</strong></span> or
7605: <span><strong class="command">make
7606: update</strong></span>.</p>
1.1 grant 7607: </dd>
7608:
1.14 xtraeme 7609: <dt><span class="term"><code class=
7610: "varname">REINSTALL</code></span></dt>
1.1 grant 7611:
7612: <dd>
7613: <p>Deinstall each package before installing
1.14 xtraeme 7614: (making <code class=
7615: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 7616: necessary if the “<span class=
7617: "quote">clean-update</span>” target
7618: (see below) was called after interrupting a
1.14 xtraeme 7619: running <span><strong class="command">make
7620: update</strong></span>.</p>
1.1 grant 7621: </dd>
7622:
1.14 xtraeme 7623: <dt><span class="term"><code class=
7624: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 7625:
7626: <dd>
7627: <p>Allows you to disable recursion and
7628: hardcode the target for packages. The default
7629: is “<span class=
7630: "quote">update</span>” for the update
7631: target, facilitating a recursive update of
1.14 xtraeme 7632: prerequisite packages. Only set <code class=
7633: "varname">DEPENDS_TARGET</code> if you want
7634: to disable recursive updates. Use
7635: <code class="varname">UPDATE_TARGET</code>
7636: instead to just set a specific target for
7637: each package to be installed during
7638: <span><strong class="command">make
7639: update</strong></span> (see above).</p>
1.1 grant 7640: </dd>
7641: </dl>
7642: </div>
7643: </dd>
7644:
7645: <dt><span class="term">clean-update</span></dt>
7646:
7647: <dd>
7648: <p>Clean the source tree for all packages that
1.14 xtraeme 7649: would get updated if <span><strong class=
7650: "command">make update</strong></span> was called
7651: from the current directory. This target should not
7652: be used if the current package (or any of its
7653: depending packages) have already been de-installed
7654: (e.g., after calling <span><strong class=
7655: "command">make update</strong></span>) or you may
7656: lose some packages you intended to update. As a
7657: rule of thumb: only use this target <span class=
7658: "emphasis"><em>before</em></span> the first time
7659: you run <span><strong class="command">make
7660: update</strong></span> and only if you have a dirty
7661: package tree (e.g., if you used <code class=
7662: "varname">NOCLEAN</code>).</p>
1.1 grant 7663:
7664: <p>If you unsure about whether your tree is clean
1.14 xtraeme 7665: you can either perform a <span><strong class=
7666: "command">make clean</strong></span> at the top of
7667: the tree, or use the following sequence of commands
1.1 grant 7668: from the directory of the package you want to
7669: update (<span class=
7670: "emphasis"><em>before</em></span> running
1.14 xtraeme 7671: <span><strong class="command">make
7672: update</strong></span> for the first time,
7673: otherwise you lose all the packages you wanted to
7674: update!):</p>
1.1 grant 7675: <pre class="screen">
1.14 xtraeme 7676: <code class="prompt">#</code> <strong class=
7677: "userinput"><code>make clean-update</code></strong>
7678: <code class="prompt">#</code> <strong class=
7679: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
7680: <code class="prompt">#</code> <strong class=
7681: "userinput"><code>make update</code></strong>
1.1 grant 7682: </pre>
7683:
7684: <p>The following variables can be used either on
1.14 xtraeme 7685: the command line or in <code class=
7686: "filename">/etc/mk.conf</code> to alter the
7687: behaviour of <span><strong class="command">make
7688: clean-update</strong></span>:</p>
1.1 grant 7689:
7690: <div class="variablelist">
7691: <dl>
1.14 xtraeme 7692: <dt><span class="term"><code class=
7693: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 7694:
7695: <dd>
1.14 xtraeme 7696: <p>After <span><strong class="command">make
7697: clean</strong></span>, do not reconstruct the
7698: list of directories to update for this
7699: package. Only use this if
7700: <span><strong class="command">make
7701: update</strong></span> successfully installed
7702: all packages you wanted to update. Normally,
7703: this is done automatically on
7704: <span><strong class="command">make
7705: update</strong></span>, but may have been
7706: suppressed by the <code class=
7707: "varname">NOCLEAN</code> variable (see
1.1 grant 7708: above).</p>
7709: </dd>
7710: </dl>
7711: </div>
7712: </dd>
7713:
7714: <dt><span class="term">info</span></dt>
7715:
7716: <dd>
7717: <p>This target invokes <a href=
7718: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
7719: <span class="citerefentry"><span class=
7720: "refentrytitle">pkg_info</span>(1)</span></a> for
7721: the current package. You can use this to check
7722: which version of a package is installed.</p>
7723: </dd>
7724:
7725: <dt><span class="term">readme</span></dt>
7726:
7727: <dd>
1.14 xtraeme 7728: <p>This target generates a <code class=
7729: "filename">README.html</code> file, which can be
1.1 grant 7730: viewed using a browser such as <a xmlns=
7731: "http://www.w3.org/TR/xhtml1/transitional" href=
7732: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ! ben 7733: class="pkgname">www/mozilla</a> or <a xmlns=
! 7734: "http://www.w3.org/TR/xhtml1/transitional" href=
! 7735: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
! 7736: class="pkgname">www/links</a>. The generated files
! 7737: contain references to any packages which are in the
! 7738: <code class="varname">PACKAGES</code> directory on
! 7739: the local host. The generated files can be made to
! 7740: refer to URLs based on <code class=
! 7741: "varname">FTP_PKG_URL_HOST</code> and <code class=
! 7742: "varname">FTP_PKG_URL_DIR</code>. For example, if I
! 7743: wanted to generate <code class=
! 7744: "filename">README.html</code> files which pointed
! 7745: to binary packages on the local machine, in the
! 7746: directory <code class=
! 7747: "filename">/usr/packages</code>, set <code class=
! 7748: "varname">FTP_PKG_URL_HOST=file://localhost</code>
! 7749: and <code class=
! 7750: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
! 7751: <code class="varname">${PACKAGES}</code> directory
! 7752: and its subdirectories will be searched for all the
! 7753: binary packages.</p>
1.1 grant 7754: </dd>
7755:
7756: <dt><span class="term">readme-all</span></dt>
7757:
7758: <dd>
1.14 xtraeme 7759: <p>Use this target to create a file <code class=
7760: "filename">README-all.html</code> which contains a
1.1 grant 7761: list of all packages currently available in the
7762: NetBSD Packages Collection, together with the
7763: category they belong to and a short description.
1.14 xtraeme 7764: This file is compiled from the <code class=
7765: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 7766: sure to run this <span class=
1.14 xtraeme 7767: "emphasis"><em>after</em></span> a
7768: <span><strong class="command">make
7769: readme</strong></span>.</p>
1.1 grant 7770: </dd>
7771:
7772: <dt><span class="term">cdrom-readme</span></dt>
7773:
7774: <dd>
7775: <p>This is very much the same as the
7776: “<span class="quote">readme</span>”
7777: target (see above), but is to be used when
7778: generating a pkgsrc tree to be written to a CD-ROM.
1.14 xtraeme 7779: This target also produces <code class=
7780: "filename">README.html</code> files, and can be
7781: made to refer to URLs based on <code class=
7782: "varname">CDROM_PKG_URL_HOST</code> and
7783: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 7784: </dd>
7785:
7786: <dt><span class="term">show-distfiles</span></dt>
7787:
7788: <dd>
7789: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 7790: are needed to build the package. (<code class=
7791: "varname">DISTFILES</code> and <code class=
7792: "varname">PATCHFILES</code>, but not <code class=
7793: "filename">patches/*</code>)</p>
1.1 grant 7794: </dd>
7795:
7796: <dt><span class="term">show-downlevel</span></dt>
7797:
7798: <dd>
7799: <p>This target shows nothing if the package is not
7800: installed. If a version of this package is
7801: installed, but is not the version provided in this
7802: version of pkgsrc, then a warning message is
7803: displayed. This target can be used to show which of
7804: your installed packages are downlevel, and so the
7805: old versions can be deleted, and the current ones
7806: added.</p>
7807: </dd>
7808:
7809: <dt><span class="term">show-pkgsrc-dir</span></dt>
7810:
7811: <dd>
7812: <p>This target shows the directory in the pkgsrc
7813: hierarchy from which the package can be built and
7814: installed. This may not be the same directory as
7815: the one from which the package was installed. This
7816: target is intended to be used by people who may
7817: wish to upgrade many packages on a single host, and
7818: can be invoked from the top-level pkgsrc Makefile
7819: by using the “<span class=
7820: "quote">show-host-specific-pkgs</span>”
7821: target.</p>
7822: </dd>
7823:
7824: <dt><span class=
7825: "term">show-installed-depends</span></dt>
7826:
7827: <dd>
7828: <p>This target shows which installed packages match
1.14 xtraeme 7829: the current package's <code class=
7830: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 7831: dependencies are causing build problems.</p>
7832: </dd>
7833:
7834: <dt><span class="term">check-shlibs</span></dt>
7835:
7836: <dd>
7837: <p>After a package is installed, check all its
7838: binaries and (on ELF platforms) shared libraries to
7839: see if they find the shared libs they need. Run by
1.14 xtraeme 7840: default if <code class=
7841: "varname">PKG_DEVELOPER</code> is set in
7842: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 7843: </dd>
7844:
7845: <dt><span class="term">print-PLIST</span></dt>
7846:
7847: <dd>
7848: <p>After a “<span class="quote">make
7849: install</span>” from a new or upgraded pkg,
7850: this prints out an attempt to generate a new
1.14 xtraeme 7851: <code class="filename">PLIST</code> from a
7852: <span><strong class="command">find -newer
7853: work/.extract_done</strong></span>. An attempt is
7854: made to care for shared libs etc., but it is
1.1 grant 7855: <span class="emphasis"><em>strongly</em></span>
7856: recommended to review the result before putting it
1.14 xtraeme 7857: into <code class="filename">PLIST</code>. On
7858: upgrades, it's useful to diff the output of this
7859: command against an already existing <code class=
7860: "filename">PLIST</code> file.</p>
1.1 grant 7861:
7862: <p>If the package installs files via tar(1) or
7863: other methods that don't update file access times,
7864: be sure to add these files manually to your
1.14 xtraeme 7865: <code class="filename">PLIST</code>, as the
1.1 grant 7866: “<span class="quote">find
7867: -newer</span>” command used by this target
7868: won't catch them!</p>
7869:
7870: <p>See <a href="#print-PLIST" title=
7871: "8.3. Tweaking output of make print-PLIST">Section 8.3,
1.14 xtraeme 7872: “Tweaking output of <span><strong class=
7873: "command">make
7874: print-PLIST</strong></span>”</a> for more
7875: information on this target.</p>
1.1 grant 7876: </dd>
7877:
7878: <dt><span class="term">bulk-package</span></dt>
7879:
7880: <dd>
7881: <p>Used to do bulk builds. If an appropriate binary
7882: package already exists, no action is taken. If not,
7883: this target will compile, install and package it
1.14 xtraeme 7884: (and it's depends, if <code class=
7885: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 7886: <a href="#binary.configuration" title=
7887: "5.3.1. Configuration">Section 5.3.1,
7888: “Configuration”</a>. After creating the
7889: binary package, the sources, the just-installed
7890: package and it's required packages are removed,
7891: preserving free disk space.</p>
7892:
7893: <p><span class="emphasis"><em>Beware that this
7894: target may deinstall all packages installed on a
7895: system!</em></span></p>
7896: </dd>
7897:
7898: <dt><span class="term">bulk-install</span></dt>
7899:
7900: <dd>
7901: <p>Used during bulk-installs to install required
7902: packages. If an upto-date binary package is
7903: available, it will be installed via <a href=
7904: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7905: <span class="citerefentry"><span class=
7906: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 7907: not, <span><strong class="command">make
7908: bulk-package</strong></span> will be executed, but
7909: the installed binary not be removed.</p>
1.1 grant 7910:
7911: <p>A binary package is considered
7912: “<span class="quote">upto-date</span>”
7913: to 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>
7917: if:</p>
7918:
7919: <div class="itemizedlist">
7920: <ul type="disc">
7921: <li>
1.14 xtraeme 7922: <p>None of the package's files (<code class=
7923: "filename">Makefile</code>, ...) were
7924: modified since it was built.</p>
1.1 grant 7925: </li>
7926:
7927: <li>
7928: <p>None of the package's required (binary)
7929: packages were modified since it was
7930: built.</p>
7931: </li>
7932: </ul>
7933: </div>
7934:
7935: <p><span class="emphasis"><em>Beware that this
7936: target may deinstall all packages installed on a
7937: system!</em></span></p>
7938: </dd>
7939: </dl>
7940: </div>
7941: </div>
7942: </div>
7943:
7944: <div class="chapter" lang="en" xml:lang="en">
7945: <div class="titlepage">
7946: <div>
7947: <div>
7948: <h2 class="title"><a name="fixes" id=
7949: "fixes"></a>Chapter 12. Notes on fixes for
7950: packages</h2>
7951: </div>
7952: </div>
7953: </div>
7954:
7955: <div class="toc">
7956: <p><b>Table of Contents</b></p>
7957:
7958: <dl>
1.20 ! ben 7959: <dt><span class="sect1"><a href="#id2593710">12.1.
1.1 grant 7960: General operation</a></span></dt>
7961:
7962: <dd>
7963: <dl>
7964: <dt><span class="sect2"><a href=
1.20 ! ben 7965: "#id2593714">12.1.1. How to pull in variables from
1.1 grant 7966: /etc/mk.conf</a></span></dt>
7967:
7968: <dt><span class="sect2"><a href=
1.20 ! ben 7969: "#id2593865">12.1.2. Restricted
1.1 grant 7970: packages</a></span></dt>
7971:
7972: <dt><span class="sect2"><a href=
7973: "#dependencies">12.1.3. Handling
7974: dependencies</a></span></dt>
7975:
7976: <dt><span class="sect2"><a href=
1.20 ! ben 7977: "#id2594380">12.1.4. Handling conflicts with other
1.1 grant 7978: packages</a></span></dt>
7979:
7980: <dt><span class="sect2"><a href=
1.20 ! ben 7981: "#id2594430">12.1.5. Packages that cannot or should
1.1 grant 7982: not be built</a></span></dt>
7983:
7984: <dt><span class="sect2"><a href=
1.20 ! ben 7985: "#id2594456">12.1.6. Packages which should not be
1.1 grant 7986: deleted, once installed</a></span></dt>
7987:
7988: <dt><span class="sect2"><a href=
7989: "#security-handling">12.1.7. Handling packages with
7990: security problems</a></span></dt>
7991:
7992: <dt><span class="sect2"><a href=
1.20 ! ben 7993: "#id2594616">12.1.8. How to handle compiler
1.1 grant 7994: bugs</a></span></dt>
7995:
7996: <dt><span class="sect2"><a href=
1.20 ! ben 7997: "#id2594638">12.1.9. How to handle incrementing
1.1 grant 7998: versions when fixing an existing
7999: package</a></span></dt>
8000:
8001: <dt><span class="sect2"><a href=
1.20 ! ben 8002: "#id2594688">12.1.10. Portability of
1.1 grant 8003: packages</a></span></dt>
8004: </dl>
8005: </dd>
8006:
1.20 ! ben 8007: <dt><span class="sect1"><a href="#id2594712">12.2.
1.1 grant 8008: Possible downloading issues</a></span></dt>
8009:
8010: <dd>
8011: <dl>
8012: <dt><span class="sect2"><a href=
1.20 ! ben 8013: "#id2594715">12.2.1. Packages whose distfiles
1.1 grant 8014: aren't available for plain
8015: downloading</a></span></dt>
8016:
8017: <dt><span class="sect2"><a href=
1.20 ! ben 8018: "#id2594778">12.2.2. How to handle modified
1.1 grant 8019: distfiles with the 'old' name</a></span></dt>
8020: </dl>
8021: </dd>
8022:
1.20 ! ben 8023: <dt><span class="sect1"><a href="#id2594790">12.3.
1.1 grant 8024: Configuration gotchas</a></span></dt>
8025:
8026: <dd>
8027: <dl>
8028: <dt><span class="sect2"><a href=
8029: "#fixes.libtool">12.3.1. Shared libraries -
8030: libtool</a></span></dt>
8031:
8032: <dt><span class="sect2"><a href=
1.20 ! ben 8033: "#id2595237">12.3.2. Using libtool on GNU packages
1.1 grant 8034: that already support libtool</a></span></dt>
8035:
8036: <dt><span class="sect2"><a href=
1.20 ! ben 8037: "#id2595321">12.3.3. GNU
1.1 grant 8038: Autoconf/Automake</a></span></dt>
8039: </dl>
8040: </dd>
8041:
1.20 ! ben 8042: <dt><span class="sect1"><a href="#id2595434">12.4.
1.1 grant 8043: Building considerations</a></span></dt>
8044:
8045: <dd>
8046: <dl>
8047: <dt><span class="sect2"><a href=
1.20 ! ben 8048: "#id2595437">12.4.1. CPP defines</a></span></dt>
1.1 grant 8049: </dl>
8050: </dd>
8051:
1.20 ! ben 8052: <dt><span class="sect1"><a href="#id2595467">12.5.
1.1 grant 8053: Package specific actions</a></span></dt>
8054:
8055: <dd>
8056: <dl>
8057: <dt><span class="sect2"><a href=
1.20 ! ben 8058: "#id2595470">12.5.1. Package configuration
1.1 grant 8059: files</a></span></dt>
8060:
8061: <dt><span class="sect2"><a href=
1.20 ! ben 8062: "#id2595709">12.5.2. User
1.2 hubertf 8063: interaction</a></span></dt>
1.1 grant 8064:
8065: <dt><span class="sect2"><a href=
1.20 ! ben 8066: "#id2595754">12.5.3. Handling
1.1 grant 8067: licenses</a></span></dt>
8068:
8069: <dt><span class="sect2"><a href=
1.20 ! ben 8070: "#id2595906">12.5.4. Creating an account from a
1.1 grant 8071: package</a></span></dt>
8072:
8073: <dt><span class="sect2"><a href=
1.20 ! ben 8074: "#id2595968">12.5.5. Installing score
1.1 grant 8075: files</a></span></dt>
8076:
8077: <dt><span class="sect2"><a href=
1.20 ! ben 8078: "#id2596011">12.5.6. Packages providing login
1.1 grant 8079: shells</a></span></dt>
8080:
8081: <dt><span class="sect2"><a href=
1.20 ! ben 8082: "#id2596069">12.5.7. Packages containing perl
1.1 grant 8083: scripts</a></span></dt>
8084:
8085: <dt><span class="sect2"><a href=
1.20 ! ben 8086: "#id2596087">12.5.8. Packages with hardcoded paths
1.1 grant 8087: to other interpreters</a></span></dt>
8088:
8089: <dt><span class="sect2"><a href=
1.20 ! ben 8090: "#id2596108">12.5.9. Packages installing perl
1.1 grant 8091: modules</a></span></dt>
8092:
8093: <dt><span class="sect2"><a href=
8094: "#faq.info-files">12.5.10. Packages installing info
8095: files</a></span></dt>
8096:
8097: <dt><span class="sect2"><a href=
1.20 ! ben 8098: "#id2596328">12.5.11. Packages installing GConf2
1.1 grant 8099: data files</a></span></dt>
8100:
8101: <dt><span class="sect2"><a href=
1.20 ! ben 8102: "#id2596428">12.5.12. Packages installing
1.1 grant 8103: scrollkeeper data files</a></span></dt>
8104:
8105: <dt><span class="sect2"><a href=
1.20 ! ben 8106: "#id2596548">12.5.13. Packages installing X11
1.1 grant 8107: fonts</a></span></dt>
8108:
8109: <dt><span class="sect2"><a href=
1.20 ! ben 8110: "#id2596595">12.5.14. Packages installing GTK2
1.1 grant 8111: modules</a></span></dt>
8112:
8113: <dt><span class="sect2"><a href=
1.20 ! ben 8114: "#id2596732">12.5.15. Packages installing SGML or
1.1 grant 8115: XML data</a></span></dt>
8116:
8117: <dt><span class="sect2"><a href=
1.20 ! ben 8118: "#id2596785">12.5.16. Packages installing
1.1 grant 8119: extensions to the MIME database</a></span></dt>
8120:
8121: <dt><span class="sect2"><a href=
1.20 ! ben 8122: "#id2596923">12.5.17. Packages using
1.1 grant 8123: intltool</a></span></dt>
1.18 xtraeme 8124:
8125: <dt><span class="sect2"><a href=
1.20 ! ben 8126: "#id2597005">12.5.18. Packages installing startup
1.18 xtraeme 8127: scripts</a></span></dt>
1.1 grant 8128: </dl>
8129: </dd>
8130:
1.20 ! ben 8131: <dt><span class="sect1"><a href="#id2597027">12.6.
1.1 grant 8132: Feedback to the author</a></span></dt>
8133: </dl>
8134: </div>
8135:
8136: <div class="sect1" lang="en" xml:lang="en">
8137: <div class="titlepage">
8138: <div>
8139: <div>
8140: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 8141: "id2593710" id="id2593710"></a>12.1. General
1.1 grant 8142: operation</h2>
8143: </div>
8144: </div>
8145: </div>
8146:
8147: <div class="sect2" lang="en" xml:lang="en">
8148: <div class="titlepage">
8149: <div>
8150: <div>
1.20 ! ben 8151: <h3 class="title"><a name="id2593714" id=
! 8152: "id2593714"></a>12.1.1. How to pull in
1.1 grant 8153: variables from /etc/mk.conf</h3>
8154: </div>
8155: </div>
8156: </div>
8157:
8158: <p>The problem with package-defined variables that can
1.14 xtraeme 8159: be overridden via <code class="varname">MAKECONF</code>
8160: or <code class="filename">/etc/mk.conf</code> is that
8161: <a href=
1.1 grant 8162: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8163: <span class="citerefentry"><span class=
8164: "refentrytitle">make</span>(1)</span></a> expands a
8165: variable as it is used, but evaluates preprocessor like
8166: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 8167: So, to use any variable (which may be set in
8168: <code class="filename">/etc/mk.conf</code>) in one of
8169: the .if* statements, the file <code class=
8170: "filename">/etc/mk.conf</code> must be included before
1.1 grant 8171: that .if* statement.</p>
8172:
8173: <p>Rather than have a number of ad-hoc ways of
1.14 xtraeme 8174: including <code class="filename">/etc/mk.conf</code>,
8175: should it exist, or <code class=
8176: "varname">MAKECONF</code>, should it exist, include the
8177: <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
8178: file in the package Makefile before any
8179: preprocessor-like .if, .ifdef, or .ifndef
8180: statements:</p>
1.1 grant 8181: <pre class="programlisting">
8182: .include "../../mk/bsd.prefs.mk"
8183:
8184: .if defined(USE_MENUS)
8185: ...
8186: .endif
8187: </pre>
8188:
1.14 xtraeme 8189: <p>If you wish to set the <code class=
8190: "varname">CFLAGS</code> variable in <code class=
8191: "filename">/etc/mk.conf</code> please make sure to
1.1 grant 8192: use:</p>
8193: <pre class="programlisting">
8194: CFLAGS+= -your -flags
8195: </pre>
8196:
1.14 xtraeme 8197: <p>Using <code class="varname">CFLAGS=</code> (i.e.
8198: without the “<span class="quote">+</span>”)
8199: may lead to problems with packages that need to add
8200: their own flags. Also, you may want to take a look at
8201: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 8202: href=
8203: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20 ! ben 8204: class="pkgname">devel/cpuflags</a> package if you're
! 8205: interested in optimization for the current CPU.</p>
1.1 grant 8206: </div>
8207:
8208: <div class="sect2" lang="en" xml:lang="en">
8209: <div class="titlepage">
8210: <div>
8211: <div>
1.20 ! ben 8212: <h3 class="title"><a name="id2593865" id=
! 8213: "id2593865"></a>12.1.2. Restricted
1.1 grant 8214: packages</h3>
8215: </div>
8216: </div>
8217: </div>
8218:
8219: <p>Some licenses restrict how software may be
8220: re-distributed. In order to satisfy these restrictions,
8221: the package system defines five make variables that can
8222: be set to note these restrictions:</p>
8223:
8224: <div class="itemizedlist">
8225: <ul type="disc">
8226: <li>
1.14 xtraeme 8227: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 8228:
8229: <p>This variable should be set whenever a
8230: restriction exists (regardless of its kind). Set
8231: this variable to a string containing the reason
8232: for the restriction.</p>
8233: </li>
8234:
8235: <li>
1.14 xtraeme 8236: <p><code class=
8237: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 8238:
8239: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 8240: variable to <code class=
8241: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 8242: package may not be included on a CD-ROM.</p>
8243: </li>
8244:
8245: <li>
1.14 xtraeme 8246: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 8247:
8248: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 8249: Set this variable to <code class=
8250: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 8251: package may not not be made available on the
8252: Internet.</p>
8253: </li>
8254:
8255: <li>
1.14 xtraeme 8256: <p><code class=
8257: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 8258:
8259: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 8260: this variable to <code class=
8261: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 8262: of the source code or other distfile(s) is not
8263: allowed on CD-ROMs.</p>
8264: </li>
8265:
8266: <li>
1.14 xtraeme 8267: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 8268:
8269: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 8270: variable to <code class=
8271: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 8272: of the source code or other distfile(s) via the
8273: Internet is not allowed.</p>
8274: </li>
8275: </ul>
8276: </div>
8277:
1.14 xtraeme 8278: <p>Please note that the use of <code class=
8279: "varname">NO_PACKAGE</code>, <code class=
8280: "varname">IGNORE</code>, <code class=
8281: "varname">NO_CDROM</code>, or other generic make
1.1 grant 8282: variables to denote restrictions is deprecated, because
8283: they unconditionally prevent users from generating
8284: binary packages!</p>
8285: </div>
8286:
8287: <div class="sect2" lang="en" xml:lang="en">
8288: <div class="titlepage">
8289: <div>
8290: <div>
8291: <h3 class="title"><a name="dependencies" id=
8292: "dependencies"></a>12.1.3. Handling
8293: dependencies</h3>
8294: </div>
8295: </div>
8296: </div>
8297:
8298: <p>Your package may depend on some other package being
8299: present - and there are various ways of expressing this
1.14 xtraeme 8300: dependency. pkgsrc supports the <code class=
8301: "varname">BUILD_DEPENDS</code> and <code class=
8302: "varname">DEPENDS</code> definitions, as well as
8303: dependencies via <code class=
8304: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 8305: way to handle dependencies, and which uses the
8306: variables named above. See <a href="#buildlink" title=
8307: "Chapter 9. Buildlink methodology">Chapter 9,
8308: <i>Buildlink methodology</i></a> for more
8309: information.</p>
8310:
8311: <p>The basic difference between the two variables is as
1.14 xtraeme 8312: follows: The <code class="varname">DEPENDS</code>
1.1 grant 8313: definition registers that pre-requisite in the binary
8314: package so it will be pulled in when the binary package
1.14 xtraeme 8315: is later installed, whilst the <code class=
8316: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 8317: marking a dependency that is only needed for building
8318: the package.</p>
8319:
8320: <p>This means that if you only need a package present
8321: whilst you are building, it should be noted as a
1.14 xtraeme 8322: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 8323:
1.14 xtraeme 8324: <p>The format for a <code class=
8325: "varname">BUILD_DEPENDS</code> and a <code class=
8326: "varname">DEPENDS</code> definition is:</p>
1.1 grant 8327: <pre class="programlisting">
8328: <pre-req-package-name>:../../<category>/<pre-req-package>
8329: </pre>
8330:
8331: <p>Please note that the “<span class=
8332: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 8333: any of the wildcard version numbers recognized by
1.1 grant 8334: <a href=
8335: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
8336: <span class="citerefentry"><span class=
8337: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
8338:
8339: <div class="orderedlist">
8340: <ol type="1">
8341: <li>
8342: <p>If your package needs another package's
8343: binaries or libraries to build or run, and if
1.14 xtraeme 8344: that package has a <code class=
8345: "filename">buildlink3.mk</code> file available,
8346: use it:</p>
1.1 grant 8347: <pre class="programlisting">
8348: .include "../../graphics/jpeg/buildlink3.mk"
8349:
8350: </pre>
8351: </li>
8352:
8353: <li>
8354: <p>If your package needs to use another package
1.14 xtraeme 8355: to build itself and there is no <code class=
8356: "filename">buildlink3.mk</code> file available,
8357: use the <code class=
8358: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 8359: <pre class="programlisting">
8360: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
8361: </pre>
8362: </li>
8363:
8364: <li>
8365: <p>If your package needs a library with which to
1.14 xtraeme 8366: link and again there is no <code class=
8367: "filename">buildlink3.mk</code> file available,
8368: this is specified using the <code class=
8369: "varname">DEPENDS</code> definition. An example
8370: of this is the <a xmlns=
1.1 grant 8371: "http://www.w3.org/TR/xhtml1/transitional" href=
8372: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ! ben 8373: class="pkgname">print/lyx</a> package, which uses
! 8374: the xpm library, version 3.4j to build:</p>
1.1 grant 8375: <pre class="programlisting">
8376: DEPENDS+= xpm-3.4j:../../graphics/xpm
8377: </pre>
8378:
8379: <p>You can also use wildcards in package
8380: dependences:</p>
8381: <pre class="programlisting">
8382: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
8383: </pre>
8384:
8385: <p>Note that such wildcard dependencies are
8386: retained when creating binary packages. The
8387: dependency is checked when installing the binary
8388: package and any package which matches the pattern
8389: will be used. Wildcard dependencies should be
8390: used with care.</p>
8391:
8392: <p>The “<span class=
8393: "quote">-[0-9]*</span>” should be used
8394: instead of “<span class=
8395: "quote">-*</span>” to avoid potentially
8396: ambiguous matches such as “<span class=
8397: "quote">tk-postgresql</span>” matching a
8398: “<span class="quote">tk-*</span>”
1.14 xtraeme 8399: <code class="varname">DEPENDS</code>.</p>
1.1 grant 8400:
8401: <p>Wildcards can also be used to specify that a
8402: package will only build against a certain minimum
8403: version of a pre-requisite:</p>
8404: <pre class="programlisting">
8405: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
8406: </pre>
8407:
8408: <p>This means that the package will build against
8409: version 3.5.4 of the tiff library or newer. Such
8410: a dependency may be warranted if, for example,
8411: the API of the library has changed with version
8412: 3.5.4 and a package would not compile against an
8413: earlier version of tiff.</p>
8414:
8415: <p>Please note that such dependencies should only
8416: be updated if a package requires a newer
8417: pre-requisite, but not to denote recommendations
8418: such as security updates or ABI changes that do
8419: not prevent a package from building correctly.
8420: Such recommendations can be expressed using
1.14 xtraeme 8421: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 8422: <pre class="programlisting">
8423: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
8424: </pre>
8425:
1.14 xtraeme 8426: <p>In addition to the above <code class=
8427: "varname">DEPENDS</code> line, this denotes that
1.1 grant 8428: while a package will build against
8429: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 8430: recommended. <code class=
8431: "varname">RECOMMENDED</code> entries will be
8432: turned into dependencies unless explicitly
8433: ignored (in which case a warning will be
8434: printed). Packages that are built with
1.1 grant 8435: recommendations ignored may not be uploaded to
8436: ftp.NetBSD.org by developers and should not be
8437: used across different systems that may have
8438: different versions of binary packages
8439: installed.</p>
8440:
8441: <p>For security fixes, please update the package
8442: vulnerabilities file as well as setting
1.14 xtraeme 8443: <code class="varname">RECOMMENDED</code>, see
1.1 grant 8444: <a href="#security-handling" title=
8445: "12.1.7. Handling packages with security problems">
8446: Section 12.1.7, “Handling packages with
8447: security problems”</a> for more
8448: information.</p>
8449: </li>
8450:
8451: <li>
8452: <p>If your package needs some executable to be
1.17 sketch 8453: able to run correctly and if there's no
1.14 xtraeme 8454: <code class="filename">buildlink3.mk</code> file,
8455: this is specified using the <code class=
8456: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 8457: "http://www.w3.org/TR/xhtml1/transitional" href=
8458: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ! ben 8459: class="pkgname">print/lyx</a> package needs to be
! 8460: able to execute the latex binary from the teTeX
! 8461: package when it runs, and that is specified:</p>
1.1 grant 8462: <pre class="programlisting">
8463: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
8464: </pre>
8465:
8466: <p>The comment about wildcard dependencies from
8467: previous paragraph applies here, too.</p>
8468: </li>
8469: </ol>
8470: </div>
8471:
8472: <p>If your package needs files from another package to
8473: build, see the first part of the “<span class=
8474: "quote">do-configure</span>” target <a xmlns=
8475: "http://www.w3.org/TR/xhtml1/transitional" href=
8476: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20 ! ben 8477: class="pkgname">print/ghostscript5</a> package (it
! 8478: relies on the jpeg sources being present in source form
! 8479: during the build):</p>
1.1 grant 8480: <pre class="programlisting">
8481: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
8482: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
8483: fi
8484: </pre>
8485:
8486: <p>If you build any other packages that way, please
8487: make sure the working files are deleted too when this
8488: package's working files are cleaned up. The easiest way
8489: to do so is by adding a pre-clean target:</p>
8490: <pre class="programlisting">
8491: pre-clean:
8492: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
8493: </pre>
8494:
1.14 xtraeme 8495: <p>Please also note the <code class=
8496: "varname">BUILD_USES_MSGFMT</code> and <code class=
8497: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
8498: which are provided as convenience definitions. The
8499: former works out whether msgfmt(1) is part of the base
8500: system, and, if it isn't, installs the <a xmlns=
1.1 grant 8501: "http://www.w3.org/TR/xhtml1/transitional" href=
8502: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20 ! ben 8503: class="pkgname">devel/gettext</a> package. The latter
! 8504: adds a build dependency on either an installed version
! 8505: of an older gettext package, or if it isn't, installs
! 8506: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 8507: href=
! 8508: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
! 8509: class="pkgname">devel/gettext-m4</a> package.</p>
1.1 grant 8510: </div>
8511:
8512: <div class="sect2" lang="en" xml:lang="en">
8513: <div class="titlepage">
8514: <div>
8515: <div>
1.20 ! ben 8516: <h3 class="title"><a name="id2594380" id=
! 8517: "id2594380"></a>12.1.4. Handling conflicts
1.1 grant 8518: with other packages</h3>
8519: </div>
8520: </div>
8521: </div>
8522:
8523: <p>Your package may conflict with other packages a user
8524: might already have installed on his system, e.g. if
8525: your package installs the same set of files like
8526: another package in our pkgsrc tree.</p>
8527:
1.14 xtraeme 8528: <p>In this case you can set <code class=
8529: "varname">CONFLICTS</code> to a space separated list of
1.1 grant 8530: packages (including version string) your package
8531: conflicts with.</p>
8532:
8533: <p>For example <a xmlns=
8534: "http://www.w3.org/TR/xhtml1/transitional" href=
8535: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20 ! ben 8536: class="pkgname">x11/Xaw3d</a> and <a xmlns=
! 8537: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8538: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
! 8539: class="pkgname">x11/Xaw-Xpm</a> install provide the
! 8540: same shared library, thus you set in <code class=
! 8541: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 8542: <pre class="programlisting">
8543: CONFLICTS= Xaw-Xpm-[0-9]*
8544: </pre>
8545:
1.14 xtraeme 8546: <p>and in <code class=
8547: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 8548: <pre class="programlisting">
8549: CONFLICTS= Xaw3d-[0-9]*
8550: </pre>
8551:
8552: <p>Packages will automatically conflict with other
8553: packages with the name prefix and a different version
8554: string. “<span class=
8555: "quote">Xaw3d-1.5</span>” e.g. will automatically
8556: conflict with the older version “<span class=
8557: "quote">Xaw3d-1.3</span>”.</p>
8558: </div>
8559:
8560: <div class="sect2" lang="en" xml:lang="en">
8561: <div class="titlepage">
8562: <div>
8563: <div>
1.20 ! ben 8564: <h3 class="title"><a name="id2594430" id=
! 8565: "id2594430"></a>12.1.5. Packages that cannot
1.1 grant 8566: or should not be built</h3>
8567: </div>
8568: </div>
8569: </div>
8570:
8571: <p>There are several reasons why a package might be
8572: instructed to not build under certain circumstances. If
8573: the package builds and runs on most platforms, the
1.14 xtraeme 8574: exceptions should be noted with <code class=
8575: "varname">NOT_FOR_PLATFORM</code>. If the package
8576: builds and runs on a small handful of platforms, set
8577: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
8578: If the package should be skipped (for example, because
8579: it provides functionality already provided by the
8580: system), set <code class=
8581: "varname">PKG_SKIP_REASON</code> to a descriptive
8582: message. If the package should fail because some
8583: preconditions are not met, set <code class=
8584: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 8585: message.</p>
8586:
1.14 xtraeme 8587: <p><code class="varname">IGNORE</code> is deprecated
1.1 grant 8588: because it didn't provide enough information to
8589: determine whether the build should fail.</p>
8590: </div>
8591:
8592: <div class="sect2" lang="en" xml:lang="en">
8593: <div class="titlepage">
8594: <div>
8595: <div>
1.20 ! ben 8596: <h3 class="title"><a name="id2594456" id=
! 8597: "id2594456"></a>12.1.6. Packages which
1.1 grant 8598: should not be deleted, once installed</h3>
8599: </div>
8600: </div>
8601: </div>
8602:
8603: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 8604: has been installed, the <code class=
8605: "varname">PKG_PRESERVE</code> definition should be set
8606: in the package Makefile. This will be carried into any
1.1 grant 8607: binary package that is made from this pkgsrc entry. A
8608: “<span class="quote">preserved</span>”
8609: package will not be deleted using <a href=
8610: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8611: <span class="citerefentry"><span class=
8612: "refentrytitle">pkg_delete</span>(1)</span></a> unless
8613: the “<span class="quote">-f</span>” option
8614: is used.</p>
8615: </div>
8616:
8617: <div class="sect2" lang="en" xml:lang="en">
8618: <div class="titlepage">
8619: <div>
8620: <div>
8621: <h3 class="title"><a name="security-handling" id=
8622: "security-handling"></a>12.1.7. Handling
8623: packages with security problems</h3>
8624: </div>
8625: </div>
8626: </div>
8627:
8628: <p>When a vulnerability is found, this should be noted
1.14 xtraeme 8629: in <code class=
8630: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1 grant 8631: and after the commit of that file, it should be copied
1.14 xtraeme 8632: to both <code class=
8633: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
8634: and <code class=
8635: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
8636: on ftp.NetBSD.org using <code class=
8637: "filename">localsrc/security/advisories/Makefile</code>.
8638: In addition, if a <code class=
8639: "filename">buildlink3.mk</code> file exists for an
8640: affected package, bumping <code class=
8641: "varname">PKGREVISION</code> and creating a
8642: corresponding <code class=
8643: "varname">BUILDLINK_RECOMMENDED.<em class=
8644: "replaceable"><code>pkg</code></em></code> entry should
8645: be considered. See <a href="#buildlink" title=
1.1 grant 8646: "Chapter 9. Buildlink methodology">Chapter 9,
8647: <i>Buildlink methodology</i></a> for more information
1.14 xtraeme 8648: about writing <code class=
8649: "filename">buildlink3.mk</code> files and <code class=
8650: "varname">BUILDLINK_*</code> definitions.</p>
1.1 grant 8651:
8652: <p>Also, if the fix should be applied to the stable
8653: pkgsrc branch, be sure to submit a pullup request!</p>
8654: </div>
8655:
8656: <div class="sect2" lang="en" xml:lang="en">
8657: <div class="titlepage">
8658: <div>
8659: <div>
1.20 ! ben 8660: <h3 class="title"><a name="id2594616" id=
! 8661: "id2594616"></a>12.1.8. How to handle
1.1 grant 8662: compiler bugs</h3>
8663: </div>
8664: </div>
8665: </div>
8666:
8667: <p>Some source files trigger bugs in the compiler,
8668: based on combinations of compiler version and
8669: architecture and almost always relation to optimisation
8670: being enabled. Common symptoms are gcc internal errors
8671: or never finishing compiling a file.</p>
8672:
8673: <p>Typically a workaround involves testing the
1.14 xtraeme 8674: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 8675: version, disabling optimisation for that
1.14 xtraeme 8676: file/<code class="varname">MACHINE_ARCH</code>/compiler
8677: combination, and documenting it in <code class=
8678: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 8679: number of examples!</p>
8680: </div>
8681:
8682: <div class="sect2" lang="en" xml:lang="en">
8683: <div class="titlepage">
8684: <div>
8685: <div>
1.20 ! ben 8686: <h3 class="title"><a name="id2594638" id=
! 8687: "id2594638"></a>12.1.9. How to handle
1.1 grant 8688: incrementing versions when fixing an existing
8689: package</h3>
8690: </div>
8691: </div>
8692: </div>
8693:
8694: <p>When making fixes to an existing package it can be
1.14 xtraeme 8695: useful to change the version number in <code class=
8696: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 8697: future versions by the original author, a
8698: “<span class="quote">nb1</span>”,
8699: “<span class="quote">nb2</span>”, ...
8700: suffix can be used on package versions by setting
1.14 xtraeme 8701: <code class="varname">PKGREVISION=1</code> (2, ...).
8702: The “<span class="quote">nb</span>” is
8703: treated like a “<span class=
8704: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 8705: <pre class="programlisting">
8706: DISTNAME= foo-17.42
8707: PKGREVISION= 9
8708: </pre>
8709:
1.14 xtraeme 8710: <p>will result in a <code class=
8711: "varname">PKGNAME</code> of “<span class=
1.1 grant 8712: "quote">foo-17.42nb9</span>”.</p>
8713:
8714: <p>When a new release of the package is released, the
1.14 xtraeme 8715: <code class="varname">PKGREVISION</code> should be
8716: removed. e.g. on a new minor release of the above
8717: package, things should be like:</p>
1.1 grant 8718: <pre class="programlisting">
8719: DISTNAME= foo-17.43
8720: </pre>
8721: </div>
8722:
8723: <div class="sect2" lang="en" xml:lang="en">
8724: <div class="titlepage">
8725: <div>
8726: <div>
1.20 ! ben 8727: <h3 class="title"><a name="id2594688" id=
! 8728: "id2594688"></a>12.1.10. Portability of
1.1 grant 8729: packages</h3>
8730: </div>
8731: </div>
8732: </div>
8733:
8734: <p>One appealing feature of pkgsrc is that it runs on
8735: many different platforms. As a result, it is important
8736: to ensure, where possible, that packages in pkgsrc are
8737: portable. There are some particular details you should
8738: pay attention to while working on pkgsrc.</p>
8739:
8740: <div class="sect3" lang="en" xml:lang="en">
8741: <div class="titlepage">
8742: <div>
8743: <div>
1.20 ! ben 8744: <h4 class="title"><a name="id2594693" id=
! 8745: "id2594693"></a>12.1.10.1. ${INSTALL},
1.1 grant 8746: ${INSTALL_DATA_DIR}, ...</h4>
8747: </div>
8748: </div>
8749: </div>
8750:
1.14 xtraeme 8751: <p>The BSD-compatible <span><strong class=
8752: "command">install</strong></span> supplied with some
1.1 grant 8753: operating systems will not perform more than one
8754: operation at a time. As such, you should call
8755: “<span class="quote">${INSTALL}</span>”,
8756: etc. like this:</p>
8757: <pre class="programlisting">
8758: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
8759: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
8760: </pre>
8761: </div>
8762: </div>
8763: </div>
8764:
8765: <div class="sect1" lang="en" xml:lang="en">
8766: <div class="titlepage">
8767: <div>
8768: <div>
8769: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 8770: "id2594712" id="id2594712"></a>12.2. Possible
1.1 grant 8771: downloading issues</h2>
8772: </div>
8773: </div>
8774: </div>
8775:
8776: <div class="sect2" lang="en" xml:lang="en">
8777: <div class="titlepage">
8778: <div>
8779: <div>
1.20 ! ben 8780: <h3 class="title"><a name="id2594715" id=
! 8781: "id2594715"></a>12.2.1. Packages whose
1.1 grant 8782: distfiles aren't available for plain
8783: downloading</h3>
8784: </div>
8785: </div>
8786: </div>
8787:
8788: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 8789: set <code class="varname">DYNAMIC_MASTER_SITES</code>
8790: and a <span><strong class="command">make
8791: fetch</strong></span> will call <code class=
8792: "filename">files/getsite.sh</code> with the name of
8793: each file to download as an argument, expecting it to
8794: output the URL of the directory from which to download
8795: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8796: href=
1.1 grant 8797: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20 ! ben 8798: class="pkgname">graphics/ns-cult3d</a> is an example of
! 8799: this usage.</p>
1.1 grant 8800:
8801: <p>If the download can't be automated, because the user
8802: must submit personal information to apply for a
8803: password, or must pay for the source, or whatever, you
1.14 xtraeme 8804: can set <code class="varname">_FETCH_MESSAGE</code> to
8805: a macro which displays a message explaining the
8806: situation. <code class="varname">_FETCH_MESSAGE</code>
8807: must be executable shell commands, not just a message.
8808: (Generally, it executes <code class=
8809: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 8810: following packages use this: <a xmlns=
8811: "http://www.w3.org/TR/xhtml1/transitional" href=
8812: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20 ! ben 8813: class="pkgname">audio/realplayer</a>, <a xmlns=
! 8814: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8815: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
! 8816: class="pkgname">cad/simian</a>, <a xmlns=
! 8817: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8818: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
! 8819: class="pkgname">devel/ipv6socket</a>, <a xmlns=
! 8820: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8821: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
! 8822: class="pkgname">emulators/vmware-module</a>, <a xmlns=
! 8823: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8824: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
! 8825: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
! 8826: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8827: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
! 8828: class="pkgname">sysutils/storage-manager</a>, <a xmlns=
! 8829: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8830: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
! 8831: class="pkgname">www/ap-aolserver</a>, <a xmlns=
! 8832: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8833: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
! 8834: class="pkgname">www/openacs</a>. Try to be consistent
! 8835: with them.</p>
1.1 grant 8836: </div>
8837:
8838: <div class="sect2" lang="en" xml:lang="en">
8839: <div class="titlepage">
8840: <div>
8841: <div>
1.20 ! ben 8842: <h3 class="title"><a name="id2594778" id=
! 8843: "id2594778"></a>12.2.2. How to handle
1.1 grant 8844: modified distfiles with the 'old' name</h3>
8845: </div>
8846: </div>
8847: </div>
8848:
8849: <p>Sometimes authors of a software package make some
8850: modifications after the software was released, and they
8851: put up a new distfile without changing the package's
8852: version number. If a package is already in pkgsrc at
8853: that time, the md5 checksum will no longer match. The
8854: correct way to work around this is to update the
8855: package's md5 checksum to match the package on the
8856: master site (beware, any mirrors may not be up to date
8857: yet!), and to remove the old distfile from
1.14 xtraeme 8858: ftp.NetBSD.org's <code class=
8859: "filename">/pub/NetBSD/packages/distfiles</code>
1.1 grant 8860: directory. Furthermore, a mail to the package's author
8861: seems appropriate making sure the distfile was really
8862: updated on purpose, and that no trojan horse or so
8863: crept in.</p>
8864: </div>
8865: </div>
8866:
8867: <div class="sect1" lang="en" xml:lang="en">
8868: <div class="titlepage">
8869: <div>
8870: <div>
8871: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 8872: "id2594790" id=
! 8873: "id2594790"></a>12.3. Configuration
1.1 grant 8874: gotchas</h2>
8875: </div>
8876: </div>
8877: </div>
8878:
8879: <div class="sect2" lang="en" xml:lang="en">
8880: <div class="titlepage">
8881: <div>
8882: <div>
8883: <h3 class="title"><a name="fixes.libtool" id=
8884: "fixes.libtool"></a>12.3.1. Shared libraries
8885: - libtool</h3>
8886: </div>
8887: </div>
8888: </div>
8889:
8890: <p>pkgsrc supports many different machines, with
8891: different object formats like a.out and ELF, and
8892: varying abilities to do shared library and dynamic
8893: loading at all. To accompany this, varying commands and
8894: options have to be passed to the compiler, linker, etc.
8895: to get the Right Thing, which can be pretty annoying
8896: especially if you don't have all the machines at your
8897: hand to test things. The <a xmlns=
8898: "http://www.w3.org/TR/xhtml1/transitional" href=
8899: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20 ! ben 8900: class="pkgname">devel/libtool</a> pkg can help here, as
! 8901: it just “<span class="quote">knows</span>”
! 8902: how to build both static and dynamic libraries from a
! 8903: set of source files, thus being platform
! 8904: independent.</p>
1.1 grant 8905:
8906: <p>Here's how to use libtool in a pkg in seven simple
8907: steps:</p>
8908:
8909: <div class="orderedlist">
8910: <ol type="1">
8911: <li>
1.14 xtraeme 8912: <p>Add <code class=
8913: "varname">USE_LIBTOOL=yes</code> to the package
8914: Makefile.</p>
1.1 grant 8915: </li>
8916:
8917: <li>
8918: <p>For library objects, use “<span class=
8919: "quote">${LIBTOOL} --mode=compile
8920: ${CC}</span>” in place of
8921: “<span class="quote">${CC}</span>”.
8922: You could even add it to the definition of
1.14 xtraeme 8923: <code class="varname">CC</code>, if only
8924: libraries are being built in a given Makefile.
8925: This one command will build both PIC and non-PIC
8926: library objects, so you need not have separate
8927: shared and non-shared library rules.</p>
1.1 grant 8928: </li>
8929:
8930: <li>
8931: <p>For the linking of the library, remove any
8932: “<span class="quote">ar</span>”,
8933: “<span class="quote">ranlib</span>”,
8934: and “<span class="quote">ld
8935: -Bshareable</span>” commands, and instead
8936: use:</p>
8937: <pre class="programlisting">
8938: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
8939: </pre>
8940:
8941: <p>Note that the library is changed to have a
1.14 xtraeme 8942: <code class="filename">.la</code> extension, and
8943: the objects are changed to have a <code class=
8944: "filename">.lo</code> extension. Change
8945: <code class="varname">OBJS</code> as necessary.
8946: This automatically creates all of the
8947: <code class="filename">.a</code>, <code class=
8948: "filename">.so.major.minor</code>, and ELF
8949: symlinks (if necessary) in the build directory.
8950: Be sure to include “<span class=
1.1 grant 8951: "quote">-version-info</span>”, especially
8952: when major and minor are zero, as libtool will
8953: otherwise strip off the shared library
8954: version.</p>
8955:
8956: <p>From the libtool manual:</p>
8957: <pre class="programlisting">
8958: So, libtool library versions are described by three integers:
8959:
8960: CURRENT
8961: The most recent interface number that this library implements.
8962:
8963: REVISION
8964: The implementation number of the CURRENT interface.
8965:
8966: AGE
8967: The difference between the newest and oldest interfaces that this
8968: library implements. In other words, the library implements all the
8969: interface numbers in the range from number `CURRENT - AGE' to
8970: `CURRENT'.
8971:
8972: If two libraries have identical CURRENT and AGE numbers, then the
8973: dynamic linker chooses the library with the greater REVISION number.
8974: </pre>
8975:
8976: <p>The “<span class=
8977: "quote">-release</span>” option will
8978: produce different results for a.out and ELF
8979: (excluding symlinks) in only one case. An ELF
8980: library of the form “<span class=
8981: "quote">libfoo-release.so.<span class=
8982: "emphasis"><em>x</em></span>.<span class=
8983: "emphasis"><em>y</em></span></span>” will
8984: have a symlink of “<span class=
8985: "quote">libfoo.so.<span class=
8986: "emphasis"><em>x</em></span>.<span class=
8987: "emphasis"><em>y</em></span></span>” on an
8988: a.out platform. This is handled
8989: automatically.</p>
8990:
8991: <p>The “<span class="quote">-rpath
8992: argument</span>” is the install directory
8993: of the library being built.</p>
8994:
1.14 xtraeme 8995: <p>In the <code class="filename">PLIST</code>,
1.19 hubertf 8996: include only the <code class=
8997: "filename">.la</code> file, the other files will
8998: be added automatically.</p>
1.1 grant 8999: </li>
9000:
9001: <li>
1.14 xtraeme 9002: <p>When linking shared object (<code class=
9003: "filename">.so</code>) files, i.e. files that are
1.1 grant 9004: loaded via dlopen(3), NOT shared libraries, use
9005: “<span class="quote">-module
9006: -avoid-version</span>” to prevent them
9007: getting version tacked on.</p>
9008:
1.14 xtraeme 9009: <p>The <code class="filename">PLIST</code> file
9010: gets the <code class="filename">foo.so</code>
9011: entry.</p>
1.1 grant 9012: </li>
9013:
9014: <li>
9015: <p>When linking programs that depend on these
9016: libraries <span class=
9017: "emphasis"><em>before</em></span> they are
9018: installed, preface the <a href=
9019: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
9020: <span class="citerefentry"><span class=
9021: "refentrytitle">cc</span>(1)</span></a> or
9022: <a href=
9023: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
9024: <span class="citerefentry"><span class=
9025: "refentrytitle">ld</span>(1)</span></a> line with
9026: “<span class="quote">${LIBTOOL}
9027: --mode=link</span>”, and it will find the
9028: correct libraries (static or shared), but please
9029: be aware that libtool will not allow you to
9030: specify a relative path in -L (such as
9031: “<span class=
9032: "quote">-L../somelib</span>”), because it
9033: expects you to change that argument to be the
1.14 xtraeme 9034: <code class="filename">.la</code> file. e.g.</p>
1.1 grant 9035: <pre class="programlisting">
9036: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
9037: </pre>
9038:
9039: <p>should be changed to:</p>
9040: <pre class="programlisting">
1.14 xtraeme 9041: ${LIBTOOL} --mode=link ${CC} -o <em class=
9042: "replaceable"><code>someprog</code></em> <em class=
9043: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 9044: </pre>
9045:
9046: <p>and it will do the right thing with the
9047: libraries.</p>
9048: </li>
9049:
9050: <li>
9051: <p>When installing libraries, preface the
9052: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
9053: <span class="citerefentry"><span class=
9054: "refentrytitle">install</span>(1)</span></a> or
9055: <a href=
9056: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
9057: <span class="citerefentry"><span class=
9058: "refentrytitle">cp</span>(1)</span></a> command
9059: with “<span class="quote">${LIBTOOL}
9060: --mode=install</span>”, and change the
1.14 xtraeme 9061: library name to <code class=
9062: "filename">.la</code>. e.g.</p>
1.1 grant 9063: <pre class="programlisting">
9064: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
9065: </pre>
9066:
1.14 xtraeme 9067: <p>This will install the static <code class=
9068: "filename">.a</code>, shared library, any needed
1.1 grant 9069: symlinks, and run <a href=
9070: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
9071: <span class="citerefentry"><span class=
9072: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
9073: </li>
9074:
9075: <li>
1.14 xtraeme 9076: <p>In your <code class="filename">PLIST</code>,
9077: include all of the <code class=
9078: "filename">.a</code>, <code class=
9079: "filename">.la</code>, and <code class=
9080: "filename">.so</code>, <code class=
9081: "filename">.so.CURRENT</code> and <code class=
9082: "filename">.so.CURRENT.REVISION</code> files
9083: (this is a change from the previous
9084: behaviour).</p>
1.1 grant 9085: </li>
9086: </ol>
9087: </div>
9088: </div>
9089:
9090: <div class="sect2" lang="en" xml:lang="en">
9091: <div class="titlepage">
9092: <div>
9093: <div>
1.20 ! ben 9094: <h3 class="title"><a name="id2595237" id=
! 9095: "id2595237"></a>12.3.2. Using libtool on GNU
1.1 grant 9096: packages that already support libtool</h3>
9097: </div>
9098: </div>
9099: </div>
9100:
1.14 xtraeme 9101: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
9102: the package Makefile. This will override the package's
9103: own libtool in most cases. For older libtool using
1.1 grant 9104: packages, libtool is made by ltconfig script during the
9105: do-configure step; you can check the libtool script
1.14 xtraeme 9106: location by doing <span><strong class="command">make
9107: configure; find work*/ -name
9108: libtool</strong></span>.</p>
9109:
9110: <p><code class="varname">LIBTOOL_OVERRIDE</code>
9111: specifies which libtool scripts, relative to
9112: <code class="varname">WRKSRC</code>, to override. By
9113: default, it is set to “<span class=
9114: "quote">libtool */libtool */*/libtool</span>”. If
9115: this does not match the location of the package's
9116: libtool script(s), set it as appropriate.</p>
1.13 hubertf 9117:
1.14 xtraeme 9118: <p>If you do not need <code class="filename">*.a</code>
1.1 grant 9119: static libraries built and installed, then use
1.14 xtraeme 9120: <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1 grant 9121: instead.</p>
9122:
9123: <p>If your package makes use of the platform
9124: independent library for loading dynamic shared objects,
9125: that comes with libtool (libltdl), you should include
1.14 xtraeme 9126: the libtool buildlink3.mk (and set <code class=
9127: "varname">USE_BUILDLINK3=YES</code>).</p>
1.1 grant 9128:
9129: <p>Some packages use libtool incorrectly so that the
9130: package may not work or build in some circumstances.
9131: Some of the more common errors are:</p>
9132:
9133: <div class="itemizedlist">
9134: <ul type="disc">
9135: <li>
9136: <p>The inclusion of a shared object (-module) as
9137: a dependent library in an executable or library.
9138: This in itself isn't a problem if one of two
9139: things has been done:</p>
9140:
9141: <div class="orderedlist">
9142: <ol type="1">
9143: <li>
9144: <p>The shared object is named correctly,
1.14 xtraeme 9145: i.e. <code class=
9146: "filename">libfoo.la</code>, not
9147: <code class="filename">foo.la</code></p>
1.1 grant 9148: </li>
9149:
9150: <li>
9151: <p>The -dlopen option is used when linking
9152: an executable.</p>
9153: </li>
9154: </ol>
9155: </div>
9156: </li>
9157:
9158: <li>
9159: <p>The use of libltdl without the correct calls
9160: to initialisation routines. The function
9161: lt_dlinit() should be called and the macro
1.14 xtraeme 9162: <code class=
9163: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 9164: included in executables.</p>
9165: </li>
9166: </ul>
9167: </div>
9168: </div>
9169:
9170: <div class="sect2" lang="en" xml:lang="en">
9171: <div class="titlepage">
9172: <div>
9173: <div>
1.20 ! ben 9174: <h3 class="title"><a name="id2595321" id=
! 9175: "id2595321"></a>12.3.3. GNU
1.1 grant 9176: Autoconf/Automake</h3>
9177: </div>
9178: </div>
9179: </div>
9180:
9181: <p>If a package needs GNU autoconf or automake to be
9182: executed to regenerate the configure script and
9183: Makefile.in makefile templates, then they should be
9184: executed in a pre-configure target. Two Makefile
1.14 xtraeme 9185: fragments are provided in <code class=
9186: "filename">pkgsrc/mk/autoconf.mk</code> and
9187: <code class="filename">pkgsrc/mk/automake.mk</code> to
9188: help dealing with these tools. See comments in these
9189: files for details.</p>
1.1 grant 9190:
9191: <p>For packages that need only autoconf:</p>
9192: <pre class="programlisting">
9193: AUTOCONF_REQD= 2.50 # if default version is not good enough
9194: ...
9195:
9196: pre-configure:
9197: cd ${WRKSRC}; ${AUTOCONF}
9198:
9199: ...
9200: .include "../../mk/autoconf.mk"
9201: </pre>
9202:
9203: <p>and for packages that need automake and
9204: autoconf:</p>
9205: <pre class="programlisting">
9206: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
9207: ...
9208:
9209: pre-configure:
9210: cd ${WRKSRC}; \
9211: ${ACLOCAL}; \
9212: ${AUTOHEADER}; \
9213: ${AUTOMAKE} -a --foreign -i; \
9214: ${AUTOCONF}
9215:
9216: ...
9217: .include "../mk/automake.mk"
9218: </pre>
9219:
9220: <p>Packages which use GNU Automake will almost
9221: certainly require GNU Make, but that's automatically
1.14 xtraeme 9222: provided for you in <code class=
9223: "filename">mk/automake.mk</code>.</p>
1.1 grant 9224:
9225: <p>There are times when the configure process makes
9226: additional changes to the generated files, which then
9227: causes the build process to try to re-execute the
9228: automake sequence. This is prevented by touching
9229: various files in the configure stage. If this causes
1.14 xtraeme 9230: problems with your package you can set <code class=
9231: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 9232: Makefile.</p>
9233: </div>
9234: </div>
9235:
9236: <div class="sect1" lang="en" xml:lang="en">
9237: <div class="titlepage">
9238: <div>
9239: <div>
9240: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 9241: "id2595434" id="id2595434"></a>12.4. Building
1.1 grant 9242: considerations</h2>
9243: </div>
9244: </div>
9245: </div>
9246:
9247: <div class="sect2" lang="en" xml:lang="en">
9248: <div class="titlepage">
9249: <div>
9250: <div>
1.20 ! ben 9251: <h3 class="title"><a name="id2595437" id=
! 9252: "id2595437"></a>12.4.1. CPP defines</h3>
1.1 grant 9253: </div>
9254: </div>
9255: </div>
9256:
9257: <p>To port an application to NetBSD, it's usually
9258: necessary for the compiler to be able to judge the
9259: system on which it's compiling, and we use definitions
9260: so that the C pre-processor can do this.</p>
9261:
9262: <p>To test whether you are working on a 4.4 BSD-derived
9263: system, you should use the BSD definition, which is
1.14 xtraeme 9264: defined in <code class=
9265: "filename"><sys/param.h></code> on said
1.1 grant 9266: systems.</p>
9267: <pre class="programlisting">
9268: #include <sys/param.h>
9269: </pre>
9270:
9271: <p>and then you can surround the BSD-specific parts of
9272: your package's C/C++ code using this conditional:</p>
9273: <pre class="programlisting">
9274: #if (defined(BSD) && BSD >= 199306)
9275: ...
9276: #endif
9277: </pre>
9278:
9279: <p>Please use the “<span class=
9280: "quote">__NetBSD__</span>” definition sparingly -
9281: it should only apply to features of NetBSD that are not
9282: present in other 4.4-lite derived BSDs.</p>
9283: </div>
9284: </div>
9285:
9286: <div class="sect1" lang="en" xml:lang="en">
9287: <div class="titlepage">
9288: <div>
9289: <div>
9290: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 9291: "id2595467" id="id2595467"></a>12.5. Package
1.1 grant 9292: specific actions</h2>
9293: </div>
9294: </div>
9295: </div>
9296:
9297: <div class="sect2" lang="en" xml:lang="en">
9298: <div class="titlepage">
9299: <div>
9300: <div>
1.20 ! ben 9301: <h3 class="title"><a name="id2595470" id=
! 9302: "id2595470"></a>12.5.1. Package
1.1 grant 9303: configuration files</h3>
9304: </div>
9305: </div>
9306: </div>
9307:
9308: <p>Packages should be taught to look for their
1.14 xtraeme 9309: configuration files in <code class=
9310: "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1 grant 9311: through to the configure and build processes.
1.14 xtraeme 9312: <code class="varname">PKG_SYSCONFDIR</code> may be
1.1 grant 9313: customized in various ways by setting other make
9314: variables:</p>
9315:
9316: <div class="itemizedlist">
9317: <ul type="disc">
9318: <li>
1.14 xtraeme 9319: <p><code class="varname">PKG_SYSCONFBASE</code>
9320: is the main config directory under which all
9321: package configuration files are to be found. This
9322: defaults to <code class=
9323: "filename">${PREFIX}/etc</code>, but may be
9324: overridden in <code class=
9325: "filename">/etc/mk.conf</code>.</p>
1.1 grant 9326: </li>
9327:
9328: <li>
1.14 xtraeme 9329: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
9330: is the subdirectory of <code class=
9331: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 9332: configuration files for a particular package may
9333: be found, e.g. the Apache configuration files may
1.14 xtraeme 9334: all be found under the <code class=
9335: "filename">httpd/</code> subdirectory of
9336: <code class="varname">${PKG_SYSCONFBASE}</code>.
9337: This should be set in the package Makefile.</p>
1.1 grant 9338: </li>
9339:
9340: <li>
1.14 xtraeme 9341: <p>By default, <code class=
9342: "varname">PKG_SYSCONFDIR</code> is set to
9343: <code class=
9344: "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
9345: but this may be overridden by setting
9346: <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9347: for a particular package, where <code class=
9348: "varname">PKG_SYSCONFVAR</code> defaults to
9349: <code class="varname">${PKGBASE}</code>. This is
9350: not meant to be set by a package Makefile, but is
1.1 grant 9351: reserved for users who wish to override the
1.14 xtraeme 9352: <code class="varname">PKG_SYSCONFDIR</code>
9353: setting for a particular package with a special
1.1 grant 9354: location.</p>
9355: </li>
9356: </ul>
9357: </div>
9358:
9359: <p>The only variables that users should customize are
1.14 xtraeme 9360: <code class="varname">PKG_SYSCONFBASE</code> and
9361: <code class=
9362: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
9363: Users will typically want to set <code class=
9364: "varname">PKG_SYSCONFBASE</code> to <code class=
9365: "filename">/etc</code>, or to accept the default
9366: location of <code class=
9367: "filename">${PREFIX}/etc</code>.</p>
1.1 grant 9368: </div>
9369:
9370: <div class="sect2" lang="en" xml:lang="en">
9371: <div class="titlepage">
9372: <div>
9373: <div>
1.20 ! ben 9374: <h3 class="title"><a name="id2595709" id=
! 9375: "id2595709"></a>12.5.2. User
1.2 hubertf 9376: interaction</h3>
1.1 grant 9377: </div>
9378: </div>
9379: </div>
9380:
9381: <p>Occasionally, packages require interaction from the
9382: user, and this can be in a number of ways:</p>
9383:
9384: <div class="itemizedlist">
9385: <ul type="disc">
9386: <li>
9387: <p>help in fetching the distfiles</p>
9388: </li>
9389:
9390: <li>
9391: <p>help to configure the package before it is
9392: built</p>
9393: </li>
9394:
9395: <li>
9396: <p>help during the build process</p>
9397: </li>
9398:
9399: <li>
9400: <p>help during the installation of a package</p>
9401: </li>
9402: </ul>
9403: </div>
9404:
1.14 xtraeme 9405: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 9406: definition is provided to notify the pkgsrc mechanism
9407: of an interactive stage which will be needed, and this
1.14 xtraeme 9408: should be set in the package's <code class=
9409: "filename">Makefile</code>. e.g.</p>
1.1 grant 9410: <pre class="programlisting">
9411: INTERACTIVE_STAGE= build
9412: </pre>
9413:
9414: <p>Multiple interactive stages can be specified:</p>
9415: <pre class="programlisting">
9416: INTERACTIVE_STAGE= configure install
9417: </pre>
9418: </div>
9419:
9420: <div class="sect2" lang="en" xml:lang="en">
9421: <div class="titlepage">
9422: <div>
9423: <div>
1.20 ! ben 9424: <h3 class="title"><a name="id2595754" id=
! 9425: "id2595754"></a>12.5.3. Handling
1.1 grant 9426: licenses</h3>
9427: </div>
9428: </div>
9429: </div>
9430:
9431: <p>A package may underly a license which the user has
9432: or has not agreed to accept. Usually, packages that
9433: underly well-known Open Source licenses (e.g. the GNU
9434: Public License, GPL) won't have any special license
9435: tags added in pkgsrc which require special action by
9436: the user of such packages, but there are quite a number
9437: of other licenses out there that pkgsrc users may not
9438: be able to follow, for whatever reasons. For these
9439: cases, pkgsrc contains a mechanism to note that a
9440: package underlies a certain license, and the user has
9441: to accept the license before the package can be
9442: installed.</p>
9443:
9444: <p>Placing a certain package under a certain license
1.14 xtraeme 9445: works by setting the <code class=
9446: "varname">LICENSE</code> variable to a string
9447: identifying the license, e.g. in <a xmlns=
9448: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 9449: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20 ! ben 9450: class="pkgname">graphics/graphviz</a>:</p>
1.1 grant 9451: <pre class="programlisting">
9452: LICENSE= graphviz-license
9453: </pre>
9454:
9455: <p>When trying to build, the user will get a notice
9456: that the package underlies a license which he hasn't
9457: accepted (yet):</p>
9458: <pre class="programlisting">
1.14 xtraeme 9459: <code class="prompt">%</code> <strong class=
9460: "userinput"><code>make</code></strong>
1.1 grant 9461: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
9462: ===> To build this package, add this line to your /etc/mk.conf:
9463: ===> ACCEPTABLE_LICENSES+=graphviz-license
9464: ===> To view the license, enter "/usr/bin/make show-license".
9465: *** Error code 1
9466: </pre>
9467:
1.14 xtraeme 9468: <p>The license can be viewed with <span><strong class=
9469: "command">make show-license</strong></span>, and if it
9470: is considered appropriate, the line printed above can
9471: be added to <code class="filename">/etc/mk.conf</code>
9472: to indicate acceptance of the particular license:</p>
1.1 grant 9473: <pre class="programlisting">
9474: ACCEPTABLE_LICENSES+=graphviz-license
9475: </pre>
9476:
9477: <p>When adding a package with a new license, the
1.14 xtraeme 9478: license text should be added to <code class=
9479: "filename">pkgsrc/licenses</code> for displaying. A
9480: list of known licenses can be seen in this directory as
9481: well as by looking at the list of (commented out)
9482: <code class="varname">ACCEPTABLE_LICENSES</code>
9483: variable settings in <code class=
9484: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 9485:
1.17 sketch 9486: <p>If there is a <span class=
1.1 grant 9487: "emphasis"><em>really</em></span> pressing need to
9488: accept all licenses at once, like when trying to
9489: download or mirror all distfiles or doing a bulk build
9490: to test if all packages in pkgsrc build, this can be
1.14 xtraeme 9491: done by setting <code class=
9492: "varname">_ACCEPTABLE=yes</code>.</p>
1.1 grant 9493: </div>
9494:
9495: <div class="sect2" lang="en" xml:lang="en">
9496: <div class="titlepage">
9497: <div>
9498: <div>
1.20 ! ben 9499: <h3 class="title"><a name="id2595906" id=
! 9500: "id2595906"></a>12.5.4. Creating an account
1.1 grant 9501: from a package</h3>
9502: </div>
9503: </div>
9504: </div>
9505:
9506: <p>There are two make variables used to control the
9507: creation of package-specific groups and users at
1.14 xtraeme 9508: pre-install time. The first is <code class=
9509: "varname">PKG_GROUPS</code>, which is a list of
1.1 grant 9510: group[:groupid] elements, where the groupid is
1.14 xtraeme 9511: optional. The second is <code class=
9512: "varname">PKG_USERS</code>, which is a list of elements
1.1 grant 9513: of the form:</p>
9514: <pre class="programlisting">
9515: user:group[:[userid][:[description][:[home][:shell]]]]
9516: </pre>
9517:
9518: <p>where only the user and group are required, the rest
9519: being optional. A simple example is:</p>
9520: <pre class="programlisting">
9521: PKG_GROUPS= foogroup
9522: PKG_USERS= foouser:foogroup
9523: </pre>
9524:
9525: <p>A more complex example is that creates two groups
9526: and two users is:</p>
9527: <pre class="programlisting">
9528: PKG_GROUPS= group1 group2:1005
9529: PKG_USERS= first:group1::First\\ User \
9530: second:group2::Second\\ User:/home/second:${SH}
9531: </pre>
9532:
9533: <p>By default, a new user will have home directory
1.14 xtraeme 9534: <code class="filename">/nonexistent</code>, and login
9535: shell <code class="filename">/sbin/nologin</code>
9536: unless they are specified as part of the user
9537: element.</p>
1.1 grant 9538:
1.14 xtraeme 9539: <p>The package <code class="filename">Makefile</code>
9540: must also set <code class=
9541: "varname">USE_PKGINSTALL=YES</code>. This will cause
9542: the users and groups to be created at pre-install time,
9543: and the admin will be prompted to remove them at
9544: post-deinstall time. Automatic creation of the users
9545: and groups can be toggled on and off by setting the
9546: <code class="varname">PKG_CREATE_USERGROUP</code>
9547: variable prior to package installation.</p>
1.1 grant 9548: </div>
9549:
9550: <div class="sect2" lang="en" xml:lang="en">
9551: <div class="titlepage">
9552: <div>
9553: <div>
1.20 ! ben 9554: <h3 class="title"><a name="id2595968" id=
! 9555: "id2595968"></a>12.5.5. Installing score
1.1 grant 9556: files</h3>
9557: </div>
9558: </div>
9559: </div>
9560:
9561: <p>Certain packages, most of them in the games
9562: category, install a score file that allows all users on
9563: the system to record their highscores. In order for
9564: this to work, the binaries need to be installed setgid
9565: and the score files owned by the appropriate group
9566: and/or owner (traditionally the "games" user/group).
9567: The following variables, documented in more detail in
1.14 xtraeme 9568: <code class="filename">mk/defaults/mk.conf</code>,
9569: control this behaviour: <code class=
9570: "varname">SETGIDGAME</code>, <code class=
9571: "varname">GAMEDATAMODE</code>, <code class=
9572: "varname">GAMEGRP</code>, <code class=
9573: "varname">GAMEMODE</code>, <code class=
9574: "varname">GAMEOWN</code>.</p>
1.1 grant 9575:
9576: <p>Note that per default, setgid installation of games
1.14 xtraeme 9577: is disabled; setting <code class=
9578: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 9579: variables accordingly.</p>
9580:
9581: <p>A package should therefor never hard code file
1.14 xtraeme 9582: ownership or access permissions but rely on
9583: <code class="varname">INSTALL_GAME</code> and
9584: <code class="varname">INSTALL_GAME_DATA</code> to set
9585: these correctly.</p>
1.1 grant 9586: </div>
9587:
9588: <div class="sect2" lang="en" xml:lang="en">
9589: <div class="titlepage">
9590: <div>
9591: <div>
1.20 ! ben 9592: <h3 class="title"><a name="id2596011" id=
! 9593: "id2596011"></a>12.5.6. Packages providing
1.1 grant 9594: login shells</h3>
9595: </div>
9596: </div>
9597: </div>
9598:
9599: <p>If the purpose of the package is to provide a login
1.14 xtraeme 9600: shell, the variable <code class=
9601: "varname">PKG_SHELL</code> should contain the full
9602: pathname of the shell executable installed by this
9603: package. The package <code class=
9604: "filename">Makefile</code> must also set <code class=
9605: "varname">USE_PKGINSTALL=YES</code> to use the
9606: automatically generated <code class=
9607: "filename">INSTALL</code>/<code class=
9608: "filename">DEINSTALL</code> scripts.</p>
1.1 grant 9609:
9610: <p>An example taken from shells/zsh:</p>
9611: <pre class="programlisting">
9612: USE_PKGINSTALL= YES
9613: PKG_SHELL= ${PREFIX}/bin/zsh
9614: </pre>
9615:
1.14 xtraeme 9616: <p>The shell is registered into <code class=
9617: "filename">/etc/shells</code> file automatically in the
9618: post-install target by the generated <code class=
9619: "filename">INSTALL</code> script and removed in the
9620: deinstall target by the <code class=
9621: "filename">DEINSTALL</code> script.</p>
1.1 grant 9622: </div>
9623:
9624: <div class="sect2" lang="en" xml:lang="en">
9625: <div class="titlepage">
9626: <div>
9627: <div>
1.20 ! ben 9628: <h3 class="title"><a name="id2596069" id=
! 9629: "id2596069"></a>12.5.7. Packages containing
1.1 grant 9630: perl scripts</h3>
9631: </div>
9632: </div>
9633: </div>
9634:
9635: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 9636: set <code class="varname">REPLACE_PERL</code> to ensure
9637: that the proper interpreter path is set. <code class=
9638: "varname">REPLACE_PERL</code> should contain a list of
9639: scripts, relative to <code class=
9640: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 9641: </div>
9642:
9643: <div class="sect2" lang="en" xml:lang="en">
9644: <div class="titlepage">
9645: <div>
9646: <div>
1.20 ! ben 9647: <h3 class="title"><a name="id2596087" id=
! 9648: "id2596087"></a>12.5.8. Packages with
1.1 grant 9649: hardcoded paths to other interpreters</h3>
9650: </div>
9651: </div>
9652: </div>
9653:
9654: <p>Your package may also contain scripts with hardcoded
9655: paths to other interpreters besides (or as well as)
9656: perl. To correct the full pathname to the script
9657: interpreter, you need to set the following definitions
1.14 xtraeme 9658: in your <code class="filename">Makefile</code> (we
9659: shall use <span><strong class=
9660: "command">tclsh</strong></span> in this example):</p>
1.1 grant 9661: <pre class="programlisting">
9662: REPLACE_INTERPRETER+= tcl
9663: _REPLACE.tcl.old= .*/bin/tclsh
9664: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
9665: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
9666: relative to ${WRKSRC}, just as in REPLACE_PERL
9667: </pre>
9668: </div>
9669:
9670: <div class="sect2" lang="en" xml:lang="en">
9671: <div class="titlepage">
9672: <div>
9673: <div>
1.20 ! ben 9674: <h3 class="title"><a name="id2596108" id=
! 9675: "id2596108"></a>12.5.9. Packages installing
1.1 grant 9676: perl modules</h3>
9677: </div>
9678: </div>
9679: </div>
9680:
9681: <p>Makefiles of packages providing perl5 modules should
1.14 xtraeme 9682: include the Makefile fragment <code class=
9683: "filename">../../lang/perl5/module.mk</code>. It
9684: provides a <span><strong class=
9685: "command">do-configure</strong></span> target for the
9686: standard perl configuration for such modules as well as
9687: various hooks to tune this configuration. See comments
9688: in this file for details.</p>
1.1 grant 9689:
9690: <p>Perl5 modules will install into different places
9691: depending on the version of perl used during the build
9692: process. To address this, pkgsrc will append lines to
1.14 xtraeme 9693: the <code class="filename">PLIST</code> corresponding
9694: to the files listed in the installed <code class=
9695: "filename">.packlist</code> file generated by most
9696: perl5 modules. This is invoked by defining <code class=
9697: "varname">PERL5_PACKLIST</code> to a space-separated
9698: list of paths to packlist files, e.g.:</p>
1.1 grant 9699: <pre class="programlisting">
9700: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
9701: </pre>
9702:
1.14 xtraeme 9703: <p>The variables <code class=
9704: "varname">PERL5_SITELIB</code>, <code class=
9705: "varname">PERL5_SITEARCH</code>, and <code class=
9706: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 9707: locations in which perl5 modules may be installed, and
9708: may be used by perl5 packages that don't have a
9709: packlist. These three variables are also substituted
1.14 xtraeme 9710: for in the <code class="filename">PLIST</code>.</p>
1.1 grant 9711: </div>
9712:
9713: <div class="sect2" lang="en" xml:lang="en">
9714: <div class="titlepage">
9715: <div>
9716: <div>
9717: <h3 class="title"><a name="faq.info-files" id=
9718: "faq.info-files"></a>12.5.10. Packages
9719: installing info files</h3>
9720: </div>
9721: </div>
9722: </div>
9723:
9724: <p>Some packages install info files or use the
9725: “<span class="quote">makeinfo</span>” or
9726: “<span class="quote">install-info</span>”
9727: commands. Each of the info files:</p>
9728:
9729: <div class="itemizedlist">
9730: <ul type="disc">
9731: <li>
9732: <p>is considered to be installed in the directory
1.14 xtraeme 9733: <code class=
9734: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 9735: </li>
9736:
9737: <li>
9738: <p>is registered in the Info directory file
1.14 xtraeme 9739: <code class=
9740: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 9741: </li>
9742:
9743: <li>
9744: <p>and must be listed as a filename in the
1.14 xtraeme 9745: <code class="varname">INFO_FILES</code> variable
9746: in the package Makefile.</p>
1.1 grant 9747: </li>
9748: </ul>
9749: </div>
9750:
1.14 xtraeme 9751: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 9752: “<span class="quote">info</span>” and can
1.14 xtraeme 9753: be overridden in the package Makefile. <code class=
9754: "filename">INSTALL</code> and <code class=
9755: "filename">DEINSTALL</code> scripts will be generated
9756: to handle registration of the info files in the Info
1.1 grant 9757: directory file. The “<span class=
9758: "quote">install-info</span>” command used for the
9759: info files registration is either provided by the
9760: system, or by a special purpose package automatically
9761: added as dependency if needed.</p>
9762:
9763: <p>A package which needs the “<span class=
9764: "quote">makeinfo</span>” command at build time
1.14 xtraeme 9765: must define the variable <code class=
9766: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 9767: minimum version of the “<span class=
9768: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 9769: should be noted with the <code class=
9770: "varname">TEXINFO_REQD</code> variable in the package
9771: <code class="filename">Makefile</code>. By default, a
1.1 grant 9772: minimum version of 3.12 is required. If the system does
1.14 xtraeme 9773: not provide a <span><strong class=
9774: "command">makeinfo</strong></span> command or if it
9775: does not match the required minimum, a build dependency
9776: on the <a xmlns=
9777: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 9778: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20 ! ben 9779: class="pkgname">devel/gtexinfo</a> package will be
! 9780: added automatically.</p>
1.1 grant 9781:
9782: <p>The build and installation process of the software
9783: provided by the package should not use the
1.14 xtraeme 9784: <span><strong class=
9785: "command">install-info</strong></span> command as the
9786: registration of info files is the task of the package
9787: <code class="filename">INSTALL</code> script, and it
9788: must use the appropriate <span><strong class=
9789: "command">makeinfo</strong></span> command.</p>
1.1 grant 9790:
9791: <p>To achieve this goal the pkgsrc infrastructure
1.14 xtraeme 9792: creates overriding scripts for the <span><strong class=
9793: "command">install-info</strong></span> and
9794: <span><strong class="command">makeinfo</strong></span>
9795: commands in a directory listed early in <code class=
9796: "varname">PATH</code>.</p>
1.1 grant 9797:
1.14 xtraeme 9798: <p>The script overriding <span><strong class=
9799: "command">install-info</strong></span> has no effect
9800: except the logging of a message. The script overriding
9801: <span><strong class="command">makeinfo</strong></span>
9802: logs a message and according to the value of
9803: <code class="varname">USE_MAKEINFO</code> and
9804: <code class="varname">TEXINFO_REQD</code> either run
9805: the appropriate <span><strong class=
9806: "command">makeinfo</strong></span> command or exit on
9807: error.</p>
1.1 grant 9808: </div>
9809:
9810: <div class="sect2" lang="en" xml:lang="en">
9811: <div class="titlepage">
9812: <div>
9813: <div>
1.20 ! ben 9814: <h3 class="title"><a name="id2596328" id=
! 9815: "id2596328"></a>12.5.11. Packages installing
1.1 grant 9816: GConf2 data files</h3>
9817: </div>
9818: </div>
9819: </div>
9820:
1.14 xtraeme 9821: <p>If a package installs <code class=
9822: "filename">.schemas</code> or <code class=
9823: "filename">.entries</code> files, used by GConf2, you
1.1 grant 9824: need to take some extra steps to make sure they get
9825: registered in the database:</p>
9826:
9827: <div class="orderedlist">
9828: <ol type="1">
9829: <li>
1.14 xtraeme 9830: <p>Include <code class=
9831: "filename">../../devel/GConf2/schemas.mk</code>
9832: instead of its <code class=
9833: "filename">buildlink3.mk</code> file. This takes
1.1 grant 9834: care of rebuilding the GConf2 database at
9835: installation and deinstallation time, and tells
9836: the package where to install GConf2 data files
9837: using some standard configure arguments. It also
9838: disallows any access to the database directly
9839: from the package.</p>
9840: </li>
9841:
9842: <li>
9843: <p>Ensure that the package installs its
1.14 xtraeme 9844: <code class="filename">.schemas</code> files
9845: under <code class=
9846: "filename">${PREFIX}/share/gconf/schemas</code>.
9847: If they get installed under <code class=
9848: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 9849: manually patch the package.</p>
9850: </li>
9851:
9852: <li>
9853: <p>Check the PLIST and remove any entries under
9854: the etc/gconf directory, as they will be handled
9855: automatically. See <a href="#faq.conf" title=
1.14 xtraeme 9856: "6.14. Configuration files handling and placement">
9857: Section 6.14, “Configuration files
1.1 grant 9858: handling and placement”</a> for more
9859: information.</p>
9860: </li>
9861:
9862: <li>
1.14 xtraeme 9863: <p>Define the <code class=
9864: "varname">GCONF2_SCHEMAS</code> variable in your
9865: <code class="filename">Makefile</code> with a
9866: list of all <code class=
9867: "filename">.schemas</code> files installed by the
9868: package, if any. Names must not contain any
9869: directories in them.</p>
1.1 grant 9870: </li>
9871:
9872: <li>
1.14 xtraeme 9873: <p>Define the <code class=
9874: "varname">GCONF2_ENTRIES</code> variable in your
9875: <code class="filename">Makefile</code> with a
9876: list of all <code class=
9877: "filename">.entries</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: </ol>
9882: </div>
9883: </div>
9884:
9885: <div class="sect2" lang="en" xml:lang="en">
9886: <div class="titlepage">
9887: <div>
9888: <div>
1.20 ! ben 9889: <h3 class="title"><a name="id2596428" id=
! 9890: "id2596428"></a>12.5.12. Packages installing
1.1 grant 9891: scrollkeeper data files</h3>
9892: </div>
9893: </div>
9894: </div>
9895:
1.14 xtraeme 9896: <p>If a package installs <code class=
9897: "filename">.omf</code> files, used by scrollkeeper, you
9898: need to take some extra steps to make sure they get
9899: registered in the database:</p>
1.1 grant 9900:
9901: <div class="orderedlist">
9902: <ol type="1">
9903: <li>
1.14 xtraeme 9904: <p>Include <code class=
9905: "filename">../../textproc/scrollkeeper/omf.mk</code>
9906: instead of its <code class=
9907: "filename">buildlink3.mk</code> file. This takes
1.1 grant 9908: care of rebuilding the scrollkeeper database at
9909: installation and deinstallation time, and
9910: disallows any access to it directly from the
9911: package.</p>
9912: </li>
9913:
9914: <li>
9915: <p>Check the PLIST and remove any entries under
1.14 xtraeme 9916: the <code class=
9917: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 9918: as they will be handled automatically.</p>
9919: </li>
9920:
9921: <li>
1.14 xtraeme 9922: <p>Remove the <code class=
9923: "filename">share/omf</code> directory from the
9924: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 9925: </li>
9926: </ol>
9927: </div>
9928: </div>
9929:
9930: <div class="sect2" lang="en" xml:lang="en">
9931: <div class="titlepage">
9932: <div>
9933: <div>
1.20 ! ben 9934: <h3 class="title"><a name="id2596548" id=
! 9935: "id2596548"></a>12.5.13. Packages installing
1.1 grant 9936: X11 fonts</h3>
9937: </div>
9938: </div>
9939: </div>
9940:
9941: <p>If a package installs font files, you will need to
9942: rebuild the fonts database in the directory where they
9943: get installed at installation and deinstallation time.
1.14 xtraeme 9944: This can be automatically done by using <code class=
9945: "filename">mk/fonts.mk</code>, which you need to
9946: include in your <code class=
9947: "filename">Makefile</code>.</p>
1.1 grant 9948:
9949: <p>When the file is included, you can list the
1.14 xtraeme 9950: directories where fonts are installed in the
9951: <code class="varname">FONTS_<em class=
9952: "replaceable"><code>type</code></em>_DIRS</code>
9953: variables, where <em class=
9954: "replaceable"><code>type</code></em> can be one of
9955: “<span class="quote">TTF</span>”,
1.1 grant 9956: “<span class="quote">TYPE1</span>” or
9957: “<span class="quote">X11</span>”. Also make
1.14 xtraeme 9958: sure that the database file <code class=
9959: "filename">fonts.dir</code> is not listed in the
1.1 grant 9960: PLIST.</p>
9961:
9962: <p>Note that you should not create new directories for
9963: fonts; instead use the standard ones to avoid that the
9964: user needs to manually configure his X server to find
9965: them.</p>
9966: </div>
9967:
9968: <div class="sect2" lang="en" xml:lang="en">
9969: <div class="titlepage">
9970: <div>
9971: <div>
1.20 ! ben 9972: <h3 class="title"><a name="id2596595" id=
! 9973: "id2596595"></a>12.5.14. Packages installing
1.1 grant 9974: GTK2 modules</h3>
9975: </div>
9976: </div>
9977: </div>
9978:
9979: <p>If a package installs gtk2 immodules or loaders, you
9980: need to take some extra steps to get them registered in
9981: the GTK2 database properly:</p>
9982:
9983: <div class="orderedlist">
9984: <ol type="1">
9985: <li>
1.14 xtraeme 9986: <p>Include <code class=
9987: "filename">../../x11/gtk2/modules.mk</code>
9988: instead of its <code class=
9989: "filename">buildlink3.mk</code> file. This takes
9990: care of rebuilding the database at installation
9991: and deinstallation time.</p>
1.1 grant 9992: </li>
9993:
9994: <li>
1.14 xtraeme 9995: <p>Set <code class=
9996: "varname">GTK2_IMMODULES=YES</code> if your
9997: package installs GTK2 immodules.</p>
1.1 grant 9998: </li>
9999:
10000: <li>
1.14 xtraeme 10001: <p>Set <code class=
10002: "varname">GTK2_LOADERS=YES</code> if your package
10003: installs GTK2 loaders.</p>
1.1 grant 10004: </li>
10005:
10006: <li>
10007: <p>Patch the package to not touch any of the gtk2
10008: databases directly. These are:</p>
10009:
10010: <div class="itemizedlist">
10011: <ul type="disc">
10012: <li>
1.14 xtraeme 10013: <p><code class=
10014: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 10015: </li>
10016:
10017: <li>
1.14 xtraeme 10018: <p><code class=
10019: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 10020: </li>
10021: </ul>
10022: </div>
10023: </li>
10024:
10025: <li>
10026: <p>Check the PLIST and remove any entries under
1.14 xtraeme 10027: the <code class="filename">libdata/gtk-2.0</code>
1.1 grant 10028: directory, as they will be handled
10029: automatically.</p>
10030: </li>
10031: </ol>
10032: </div>
10033: </div>
10034:
10035: <div class="sect2" lang="en" xml:lang="en">
10036: <div class="titlepage">
10037: <div>
10038: <div>
1.20 ! ben 10039: <h3 class="title"><a name="id2596732" id=
! 10040: "id2596732"></a>12.5.15. Packages installing
1.1 grant 10041: SGML or XML data</h3>
10042: </div>
10043: </div>
10044: </div>
10045:
10046: <p>If a package installs SGML or XML data files that
10047: need to be registered in system-wide catalogs (like
10048: DTDs, sub-catalogs, etc.), you need to take some extra
10049: steps:</p>
10050:
10051: <div class="orderedlist">
10052: <ol type="1">
10053: <li>
1.14 xtraeme 10054: <p>Include <code class=
10055: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
10056: in your <code class="filename">Makefile</code>,
10057: which takes care of registering those files in
1.1 grant 10058: system-wide catalogs at installation and
10059: deinstallation time.</p>
10060: </li>
10061:
10062: <li>
1.14 xtraeme 10063: <p>Set <code class="varname">SGML_CATALOGS</code>
10064: to the full path of any SGML catalogs installed
10065: by the package.</p>
1.1 grant 10066: </li>
10067:
10068: <li>
1.14 xtraeme 10069: <p>Set <code class="varname">XML_CATALOGS</code>
10070: to the full path of any XML catalogs installed by
1.1 grant 10071: the package.</p>
10072: </li>
10073:
10074: <li>
1.14 xtraeme 10075: <p>Set <code class="varname">SGML_ENTRIES</code>
10076: to individual entries to be added to the SGML
1.1 grant 10077: catalog. These come in groups of three strings;
10078: see xmlcatmgr(1) for more information
10079: (specifically, arguments recognized by the 'add'
10080: action). Note that you will normally not use this
10081: variable.</p>
10082: </li>
10083:
10084: <li>
1.14 xtraeme 10085: <p>Set <code class="varname">XML_ENTRIES</code>
10086: to individual entries to be added to the XML
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: </ol>
10094: </div>
10095: </div>
10096:
10097: <div class="sect2" lang="en" xml:lang="en">
10098: <div class="titlepage">
10099: <div>
10100: <div>
1.20 ! ben 10101: <h3 class="title"><a name="id2596785" id=
! 10102: "id2596785"></a>12.5.16. Packages installing
1.1 grant 10103: extensions to the MIME database</h3>
10104: </div>
10105: </div>
10106: </div>
10107:
10108: <p>If a package provides extensions to the MIME
1.14 xtraeme 10109: database by installing <code class=
10110: "filename">.xml</code> files inside <code class=
10111: "filename">${PREFIX}/share/mime/packages</code>, you
10112: need to take some extra steps to ensure that the
10113: database is kept consistent with respect to these new
10114: files:</p>
1.1 grant 10115:
10116: <div class="orderedlist">
10117: <ol type="1">
10118: <li>
1.14 xtraeme 10119: <p>Include <code class=
10120: "filename">../../databases/shared-mime-info/mimedb.mk</code>
10121: (avoid using the <code class=
10122: "filename">buildlink3.mk</code> file from this
10123: same directory, which is reserved for inclusion
10124: from other <code class=
10125: "filename">buildlink3.mk</code> files). It takes
10126: care of rebuilding the MIME database at
10127: installation and deinstallation time, and
10128: disallows any access to it directly from the
1.1 grant 10129: package.</p>
10130: </li>
10131:
10132: <li>
10133: <p>Check the PLIST and remove any entries under
1.14 xtraeme 10134: the <code class="filename">share/mime</code>
1.1 grant 10135: directory, <span class=
10136: "emphasis"><em>except</em></span> for files saved
1.14 xtraeme 10137: under <code class=
10138: "filename">share/mime/packages</code>. The former
1.1 grant 10139: are handled automatically by the
10140: update-mime-database program, but the later are
10141: package-dependent and must be removed by the
10142: package that installed them in the first
10143: place.</p>
10144: </li>
10145:
10146: <li>
1.14 xtraeme 10147: <p>Remove any <code class=
10148: "filename">share/mime/*</code> directories from
10149: the PLIST. They will be handled by the
1.1 grant 10150: shared-mime-info package.</p>
10151: </li>
10152: </ol>
10153: </div>
10154: </div>
10155:
10156: <div class="sect2" lang="en" xml:lang="en">
10157: <div class="titlepage">
10158: <div>
10159: <div>
1.20 ! ben 10160: <h3 class="title"><a name="id2596923" id=
! 10161: "id2596923"></a>12.5.17. Packages using
1.1 grant 10162: intltool</h3>
10163: </div>
10164: </div>
10165: </div>
10166:
10167: <p>If a package uses intltool during its build, include
1.14 xtraeme 10168: the <code class=
10169: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 10170: file, which forces it to use the intltool package
10171: provided by pkgsrc, instead of the one bundled with the
10172: distribution file.</p>
10173:
10174: <p>This tracks intltool's build-time dependencies and
10175: uses the latest available version; this way, the
10176: package benefits of any bug fixes that may have
10177: appeared since it was released.</p>
10178: </div>
1.18 xtraeme 10179:
10180: <div class="sect2" lang="en" xml:lang="en">
10181: <div class="titlepage">
10182: <div>
10183: <div>
1.20 ! ben 10184: <h3 class="title"><a name="id2597005" id=
! 10185: "id2597005"></a>12.5.18. Packages installing
1.18 xtraeme 10186: startup scripts</h3>
10187: </div>
10188: </div>
10189: </div>
10190:
10191: <p>If a package contains a rc.d script, it won't be
10192: copied into the startup directory by default, but you
10193: can enable it, by adding the option <code class=
10194: "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
10195: "filename">/etc/mk.conf</code>. This option will copy
10196: the scripts into <code class=
10197: "filename">/etc/rc.d</code> when a package is
10198: installed, and it will automatically remove the scripts
10199: when the package is deinstalled.</p>
10200: </div>
1.1 grant 10201: </div>
10202:
10203: <div class="sect1" lang="en" xml:lang="en">
10204: <div class="titlepage">
10205: <div>
10206: <div>
10207: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 10208: "id2597027" id="id2597027"></a>12.6. Feedback
1.1 grant 10209: to the author</h2>
10210: </div>
10211: </div>
10212: </div>
10213:
10214: <p>If you have found any bugs in the package you make
10215: available, if you had to do special steps to make it run
10216: under NetBSD or if you enhanced the software in various
10217: other ways, be sure to report these changes back to the
10218: original author of the program! With that kind of
10219: support, the next release of the program can incorporate
10220: these fixes, and people not using the NetBSD packages
10221: system can win from your efforts.</p>
10222:
10223: <p>Support the idea of free software!</p>
10224: </div>
10225: </div>
10226:
10227: <div class="chapter" lang="en" xml:lang="en">
10228: <div class="titlepage">
10229: <div>
10230: <div>
10231: <h2 class="title"><a name="debug" id=
10232: "debug"></a>Chapter 13. Debugging</h2>
10233: </div>
10234: </div>
10235: </div>
10236:
10237: <p>To check out all the gotchas when building a package,
10238: here are the steps that I do in order to get a package
10239: working. Please note this is basically the same as what was
10240: explained in the previous sections, only with some
10241: debugging aids.</p>
10242:
10243: <div class="itemizedlist">
10244: <ul type="disc">
10245: <li>
1.14 xtraeme 10246: <p>Be sure to set <code class=
10247: "varname">PKG_DEVELOPER=1</code> in <code class=
10248: "filename">/etc/mk.conf</code></p>
1.1 grant 10249: </li>
10250:
10251: <li>
10252: <p>Install <a xmlns=
10253: "http://www.w3.org/TR/xhtml1/transitional" href=
10254: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20 ! ben 10255: class="pkgname">pkgtools/url2pkg</a>, create a
! 10256: directory for a new package, change into it, then run
! 10257: <span><strong class=
! 10258: "command">url2pkg</strong></span>:</p>
1.1 grant 10259: <pre class="screen">
1.14 xtraeme 10260: <code class="prompt">%</code> <strong class=
10261: "userinput"><code>mkdir /usr/pkgsrc/<em class=
10262: "replaceable"><code>category</code></em>/<em class=
10263: "replaceable"><code>examplepkg</code></em></code></strong>
10264: <code class="prompt">%</code> <strong class=
10265: "userinput"><code>cd /usr/pkgsrc/<em class=
10266: "replaceable"><code>category</code></em>/<em class=
10267: "replaceable"><code>examplepkg</code></em></code></strong>
10268: <code class="prompt">%</code> <strong class=
10269: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 10270: </pre>
10271: </li>
10272:
10273: <li>
1.14 xtraeme 10274: <p>Edit the <code class="filename">Makefile</code> as
1.1 grant 10275: requested.</p>
10276: </li>
10277:
10278: <li>
1.14 xtraeme 10279: <p>Fill in the <code class="filename">DESCR</code>
1.1 grant 10280: file</p>
10281: </li>
10282:
10283: <li>
1.14 xtraeme 10284: <p>Run <span><strong class="command">make
10285: configure</strong></span></p>
1.1 grant 10286: </li>
10287:
10288: <li>
10289: <p>Add any dependencies glimpsed from documentation
1.14 xtraeme 10290: and the configure step to the package's <code class=
10291: "filename">Makefile</code>.</p>
1.1 grant 10292: </li>
10293:
10294: <li>
10295: <p>Make the package compile, doing multiple rounds
10296: of</p>
10297: <pre class="screen">
1.14 xtraeme 10298: <code class="prompt">%</code> <strong class=
10299: "userinput"><code>make</code></strong>
10300: <code class="prompt">%</code> <strong class=
10301: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
10302: <code class="prompt">%</code> <strong class=
10303: "userinput"><code>mkpatches</code></strong>
10304: <code class="prompt">%</code> <strong class=
10305: "userinput"><code>patchdiff</code></strong>
10306: <code class="prompt">%</code> <strong class=
10307: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
10308: <code class="prompt">%</code> <strong class=
10309: "userinput"><code>make mps</code></strong>
10310: <code class="prompt">%</code> <strong class=
10311: "userinput"><code>make clean</code></strong>
1.1 grant 10312: </pre>
10313:
10314: <p>Doing as non-root user will ensure that no files
10315: are modified that shouldn't be, especially during the
1.14 xtraeme 10316: build phase. <span><strong class=
10317: "command">mkpatches</strong></span>,
10318: <span><strong class=
10319: "command">patchdiff</strong></span> and
10320: <span><strong class="command">pkgvi</strong></span>
10321: are from the <a xmlns=
1.1 grant 10322: "http://www.w3.org/TR/xhtml1/transitional" href=
10323: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ! ben 10324: class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1 grant 10325: </li>
10326:
10327: <li>
1.14 xtraeme 10328: <p>Look at the <code class=
10329: "filename">Makefile</code>, fix if necessary; see
10330: <a href="#components.Makefile" title=
10331: "7.1. Makefile">Section 7.1,
10332: “<code class=
10333: "filename">Makefile</code>”</a>.</p>
1.1 grant 10334: </li>
10335:
10336: <li>
1.14 xtraeme 10337: <p>Generate a <code class=
10338: "filename">PLIST</code>:</p>
1.1 grant 10339: <pre class="screen">
1.14 xtraeme 10340: <code class="prompt">#</code> <strong class=
10341: "userinput"><code>make install</code></strong>
10342: <code class="prompt">#</code> <strong class=
10343: "userinput"><code>make print-PLIST >PLIST</code></strong>
10344: <code class="prompt">#</code> <strong class=
10345: "userinput"><code>make deinstall</code></strong>
10346: <code class="prompt">#</code> <strong class=
10347: "userinput"><code>make install</code></strong>
10348: <code class="prompt">#</code> <strong class=
10349: "userinput"><code>make deinstall</code></strong>
1.1 grant 10350: </pre>
10351:
1.14 xtraeme 10352: <p>You usually need to be <code class=
10353: "username">root</code> to do this. Look if there are
1.1 grant 10354: any files left:</p>
10355: <pre class="screen">
1.14 xtraeme 10356: <code class="prompt">#</code> <strong class=
10357: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 10358: </pre>
10359:
10360: <p>If this reveals any files that are missing in
1.14 xtraeme 10361: <code class="filename">PLIST</code>, add them.</p>
1.1 grant 10362: </li>
10363:
10364: <li>
1.14 xtraeme 10365: <p>Now that the <code class="filename">PLIST</code>
10366: is OK, install the package again and make a binary
1.1 grant 10367: package:</p>
10368: <pre class="screen">
1.14 xtraeme 10369: <code class="prompt">#</code> <strong class=
10370: "userinput"><code>make reinstall</code></strong>
10371: <code class="prompt">#</code> <strong class=
10372: "userinput"><code>make package</code></strong>
1.1 grant 10373: </pre>
10374: </li>
10375:
10376: <li>
10377: <p>Delete the installed package:</p>
10378: <pre class="screen">
1.14 xtraeme 10379: <code class="prompt">#</code> <strong class=
10380: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 10381: </pre>
10382: </li>
10383:
10384: <li>
1.14 xtraeme 10385: <p>Repeat the above <span><strong class=
10386: "command">make print-PLIST</strong></span> command,
10387: which shouldn't find anything now:</p>
1.1 grant 10388: <pre class="screen">
1.14 xtraeme 10389: <code class="prompt">#</code> <strong class=
10390: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 10391: </pre>
10392: </li>
10393:
10394: <li>
10395: <p>Reinstall the binary package:</p>
10396: <pre class="screen">
1.14 xtraeme 10397: <code class="prompt">#</code> <strong class=
10398: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 10399: </pre>
10400: </li>
10401:
10402: <li>
10403: <p>Play with it. Make sure everything works.</p>
10404: </li>
10405:
10406: <li>
1.14 xtraeme 10407: <p>Run <span><strong class=
10408: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 10409: "http://www.w3.org/TR/xhtml1/transitional" href=
10410: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ! ben 10411: class="pkgname">pkgtools/pkglint</a>, and fix the
! 10412: problems it reports:</p>
1.1 grant 10413: <pre class="screen">
1.14 xtraeme 10414: <code class="prompt">#</code> <strong class=
10415: "userinput"><code>pkglint</code></strong>
1.1 grant 10416: </pre>
10417: </li>
10418:
10419: <li>
10420: <p>Submit (or commit, if you have cvs access); see
10421: <a href="#submit" title=
10422: "Chapter 14. Submitting and Committing">Chapter 14,
10423: <i>Submitting and Committing</i></a>.</p>
10424: </li>
10425: </ul>
10426: </div>
10427: </div>
10428:
10429: <div class="chapter" lang="en" xml:lang="en">
10430: <div class="titlepage">
10431: <div>
10432: <div>
10433: <h2 class="title"><a name="submit" id=
10434: "submit"></a>Chapter 14. Submitting and
10435: Committing</h2>
10436: </div>
10437: </div>
10438: </div>
10439:
10440: <div class="toc">
10441: <p><b>Table of Contents</b></p>
10442:
10443: <dl>
1.20 ! ben 10444: <dt><span class="sect1"><a href="#id2597557">14.1.
1.1 grant 10445: Submitting your packages</a></span></dt>
10446:
1.20 ! ben 10447: <dt><span class="sect1"><a href="#id2597608">14.2.
1.1 grant 10448: Committing: Importing a package into
10449: CVS</a></span></dt>
10450:
1.20 ! ben 10451: <dt><span class="sect1"><a href="#id2597671">14.3.
1.2 hubertf 10452: Updating a package to a newer version</a></span></dt>
1.1 grant 10453:
1.20 ! ben 10454: <dt><span class="sect1"><a href="#id2597758">14.4.
1.2 hubertf 10455: Moving a package in pkgsrc</a></span></dt>
1.1 grant 10456: </dl>
10457: </div>
10458:
10459: <div class="sect1" lang="en" xml:lang="en">
10460: <div class="titlepage">
10461: <div>
10462: <div>
10463: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 10464: "id2597557" id=
! 10465: "id2597557"></a>14.1. Submitting your
1.1 grant 10466: packages</h2>
10467: </div>
10468: </div>
10469: </div>
10470:
10471: <p>You have to separate between binary and
10472: “<span class="quote">normal</span>” (source)
10473: packages here:</p>
10474:
10475: <div class="itemizedlist">
10476: <ul type="disc">
10477: <li>
10478: <p>precompiled binary packages</p>
10479:
10480: <p>Our policy is that we accept binaries only from
10481: pkgsrc developers to guarantee that the packages
10482: don't contain any trojan horses etc. This is not to
1.13 hubertf 10483: annoy anyone but rather to protect our users!
1.1 grant 10484: You're still free to put up your home-made binary
1.13 hubertf 10485: packages and tell the world where to get them.
10486: NetBSD developers doing bulk builds and wanting to
10487: upload them please see <a href="#bulk-upload"
10488: title="5.3.8. Uploading results of a bulk build">
10489: Section 5.3.8, “Uploading results of a
10490: bulk build”</a>.</p>
1.1 grant 10491: </li>
10492:
10493: <li>
10494: <p>packages</p>
10495:
10496: <p>First, check that your package is complete,
10497: compiles and runs well; see <a href="#debug" title=
10498: "Chapter 13. Debugging">Chapter 13,
10499: <i>Debugging</i></a> and the rest of this document.
10500: Next, generate an uuencoded gzipped tar(1) archive,
10501: preferably with all files in a single directory.
1.14 xtraeme 10502: Finally, <span><strong class=
10503: "command">send-pr</strong></span> with category
1.1 grant 10504: “<span class="quote">pkg</span>”, a
10505: synopsis which includes the package name and
10506: version number, a short description of your package
10507: (contents of the COMMENT variable or DESCR file are
10508: OK) and attach the archive to your PR.</p>
10509:
10510: <p>If you want to submit several packages, please
10511: send a separate PR for each one, it's easier for us
10512: to track things that way.</p>
10513:
10514: <p>Alternatively, you can also import new packages
10515: into pkgsrc-wip (“<span class="quote">pkgsrc
10516: work-in-progress</span>”); see the homepage
10517: at <a href="http://pkgsrc-wip.sourceforge.net/"
10518: target=
10519: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
10520: details.</p>
10521: </li>
10522: </ul>
10523: </div>
10524: </div>
10525:
10526: <div class="sect1" lang="en" xml:lang="en">
10527: <div class="titlepage">
10528: <div>
10529: <div>
10530: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 10531: "id2597608" id=
! 10532: "id2597608"></a>14.2. Committing: Importing a
1.1 grant 10533: package into CVS</h2>
10534: </div>
10535: </div>
10536: </div>
10537:
10538: <p>This section is only of interest for pkgsrc developers
10539: with write access to the pkgsrc repository. Please
10540: remember that cvs imports files relative to the current
10541: working directory, and that the pathname that you give
1.14 xtraeme 10542: the <span><strong class="command">cvs
10543: import</strong></span> command is so that it knows where
10544: to place the files in the repository. Newly created
10545: packages should be imported with a vendor tag of
10546: “<span class="quote">TNF</span>” and a
10547: release tag of “<span class=
10548: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 10549: <pre class="programlisting">
10550: % cd .../pkgsrc/category/pkgname
10551: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
10552: </pre>
10553:
10554: <p>Remember to move the directory from which you imported
10555: out of the way, or cvs will complain the next time you
10556: “<span class="quote">cvs update</span>” your
10557: source tree. Also don't forget to add the new package to
1.14 xtraeme 10558: the category's <code class=
10559: "filename">Makefile</code>.</p>
1.1 grant 10560:
10561: <p>The commit message of the initial import should
1.14 xtraeme 10562: include part of the <code class="filename">DESCR</code>
10563: file, so people reading the mailing lists know what the
10564: package is/does.</p>
1.1 grant 10565:
10566: <p>Please note all package updates/additions in
1.14 xtraeme 10567: <code class="filename">pkgsrc/doc/CHANGES</code>. It's
10568: very important to keep this file up to date and
10569: conforming to the existing format, because it will be
10570: used by scripts to automatically update pages on <a href=
1.1 grant 10571: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
10572: and other sites. Additionally, check the pkgsrc/doc/TODO
10573: file and remove the entry for the package you updated, in
10574: case it was mentioned there.</p>
10575:
10576: <p>For new packages, “<span class="quote">cvs
10577: import</span>” is preferred to “<span class=
10578: "quote">cvs add</span>” because the former gets
10579: everything with a single command, and provides a
10580: consistent tag.</p>
10581: </div>
10582:
10583: <div class="sect1" lang="en" xml:lang="en">
10584: <div class="titlepage">
10585: <div>
10586: <div>
10587: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 10588: "id2597671" id="id2597671"></a>14.3. Updating
1.2 hubertf 10589: a package to a newer version</h2>
1.1 grant 10590: </div>
10591: </div>
10592: </div>
10593:
10594: <p>Please always put a concise, appropriate and relevant
10595: summary of the changes between old and new versions into
10596: the commit log when updating a package. There are various
10597: reasons for this:</p>
10598:
10599: <div class="itemizedlist">
10600: <ul type="disc">
10601: <li>
10602: <p>A URL is volatile, and can change over time. It
10603: may go away completely or its information may be
10604: overwritten by newer information.</p>
10605: </li>
10606:
10607: <li>
10608: <p>Having the change information between old and
10609: new versions in our CVS repository is very useful
10610: for people who use either cvs or anoncvs.</p>
10611: </li>
10612:
10613: <li>
10614: <p>Having the change information between old and
10615: new versions in our CVS repository is very useful
10616: for people who read the pkgsrc-changes mailing
10617: list, so that they can make tactical decisions
10618: about when to upgrade the package.</p>
10619: </li>
10620: </ul>
10621: </div>
10622:
1.18 xtraeme 10623: <p>Please also recognize that, just because a new version
1.1 grant 10624: of a package has been released, it should not
10625: automatically be upgraded in the CVS repository. We
10626: prefer to be conservative in the packages that are
10627: included in pkgsrc - development or beta packages are not
10628: really the best thing for most places in which pkgsrc is
10629: used. Please use your judgement about what should go into
10630: pkgsrc, and bear in mind that stability is to be
10631: preferred above new and possibly untested features.</p>
10632: </div>
10633:
10634: <div class="sect1" lang="en" xml:lang="en">
10635: <div class="titlepage">
10636: <div>
10637: <div>
10638: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 10639: "id2597758" id="id2597758"></a>14.4. Moving a
1.2 hubertf 10640: package in pkgsrc</h2>
1.1 grant 10641: </div>
10642: </div>
10643: </div>
10644:
10645: <div class="orderedlist">
10646: <ol type="1">
10647: <li>
10648: <p>Make a copy of the directory somewhere else.</p>
10649: </li>
10650:
10651: <li>
10652: <p>Remove all CVS dirs.</p>
10653:
10654: <p>Alternatively to the first two steps you can
10655: also do:</p>
10656: <pre class="screen">
1.14 xtraeme 10657: <code class="prompt">%</code> <strong class=
10658: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 10659: </pre>
10660:
10661: <p>and use that for further work.</p>
10662: </li>
10663:
10664: <li>
1.14 xtraeme 10665: <p>Fix <code class="varname">CATEGORIES</code> and
10666: any <code class="varname">DEPENDS</code> paths that
10667: just did “<span class=
1.1 grant 10668: "quote">../package</span>” instead of
10669: “<span class=
10670: "quote">../../category/package</span>”.</p>
10671: </li>
10672:
10673: <li>
1.14 xtraeme 10674: <p><span><strong class="command">cvs
10675: import</strong></span> the modified package in the
10676: new place.</p>
1.1 grant 10677: </li>
10678:
10679: <li>
10680: <p>Check if any package depends on it:</p>
10681: <pre class="screen">
1.14 xtraeme 10682: <code class="prompt">%</code> <strong class=
10683: "userinput"><code>cd /usr/pkgsrc</code></strong>
10684: <code class="prompt">%</code> <strong class=
10685: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 10686: </pre>
10687: </li>
10688:
10689: <li>
10690: <p>Fix paths in packages from step 5 to point to
10691: new location.</p>
10692: </li>
10693:
10694: <li>
1.14 xtraeme 10695: <p><span><strong class="command">cvs rm
10696: (-f)</strong></span> the package at the old
10697: location.</p>
1.1 grant 10698: </li>
10699:
10700: <li>
1.14 xtraeme 10701: <p>Remove from <code class=
10702: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 10703: </li>
10704:
10705: <li>
1.14 xtraeme 10706: <p>Add to <code class=
10707: "filename">newcategory/Makefile</code>.</p>
1.1 grant 10708: </li>
10709:
10710: <li>
10711: <p>Commit the changed and removed files:</p>
10712: <pre class="screen">
1.14 xtraeme 10713: <code class="prompt">%</code> <strong class=
10714: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 10715: </pre>
10716:
10717: <p>(and any packages from step 5, of course).</p>
10718: </li>
10719: </ol>
10720: </div>
10721: </div>
10722: </div>
10723: </div>
10724:
10725: <div class="appendix" lang="en" xml:lang="en">
10726: <div class="titlepage">
10727: <div>
10728: <div>
10729: <h2 class="title"><a name="examples" id=
10730: "examples"></a>Appendix A. A simple example
10731: package: bison</h2>
10732: </div>
10733: </div>
10734: </div>
10735:
10736: <div class="toc">
10737: <p><b>Table of Contents</b></p>
10738:
10739: <dl>
1.20 ! ben 10740: <dt><span class="sect1"><a href="#id2597985">A.1.
1.1 grant 10741: files</a></span></dt>
10742:
10743: <dd>
10744: <dl>
1.20 ! ben 10745: <dt><span class="sect2"><a href="#id2597988">A.1.1.
1.1 grant 10746: Makefile</a></span></dt>
10747:
1.20 ! ben 10748: <dt><span class="sect2"><a href="#id2597995">A.1.2.
1.1 grant 10749: DESCR</a></span></dt>
10750:
1.20 ! ben 10751: <dt><span class="sect2"><a href="#id2598010">A.1.3.
1.1 grant 10752: PLIST</a></span></dt>
10753:
1.20 ! ben 10754: <dt><span class="sect2"><a href="#id2598018">A.1.4.
1.14 xtraeme 10755: Checking a package with <span><strong class=
10756: "command">pkglint</strong></span></a></span></dt>
1.1 grant 10757: </dl>
10758: </dd>
10759:
1.20 ! ben 10760: <dt><span class="sect1"><a href="#id2598058">A.2. Steps
1.1 grant 10761: for building, installing, packaging</a></span></dt>
10762: </dl>
10763: </div>
10764:
10765: <p>We checked to find a piece of software that wasn't in the
10766: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 10767: would want to have <span><strong class=
10768: "command">bison</strong></span> when Berkeley
10769: <span><strong class="command">yacc</strong></span> is already
10770: present in the tree is beyond us, but it's useful for the
10771: purposes of this exercise.</p>
1.1 grant 10772:
10773: <div class="sect1" lang="en" xml:lang="en">
10774: <div class="titlepage">
10775: <div>
10776: <div>
10777: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 10778: "id2597985" id="id2597985"></a>A.1. files</h2>
1.1 grant 10779: </div>
10780: </div>
10781: </div>
10782:
10783: <div class="sect2" lang="en" xml:lang="en">
10784: <div class="titlepage">
10785: <div>
10786: <div>
1.20 ! ben 10787: <h3 class="title"><a name="id2597988" id=
! 10788: "id2597988"></a>A.1.1. Makefile</h3>
1.1 grant 10789: </div>
10790: </div>
10791: </div>
10792: <pre class="programlisting">
1.17 sketch 10793: # $NetBSD$
1.1 grant 10794: #
10795:
10796: DISTNAME= bison-1.25
10797: CATEGORIES= devel
10798: MASTER_SITES= ${MASTER_SITE_GNU}
10799:
10800: MAINTAINER= thorpej@NetBSD.org
10801: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
10802: COMMENT= GNU yacc clone
10803:
10804: GNU_CONFIGURE= yes
10805: INFO_FILES= bison.info
10806:
10807: .include "../../mk/bsd.pkg.mk"
10808: </pre>
10809: </div>
10810:
10811: <div class="sect2" lang="en" xml:lang="en">
10812: <div class="titlepage">
10813: <div>
10814: <div>
1.20 ! ben 10815: <h3 class="title"><a name="id2597995" id=
! 10816: "id2597995"></a>A.1.2. DESCR</h3>
1.1 grant 10817: </div>
10818: </div>
10819: </div>
10820: <pre class="programlisting">
10821: GNU version of yacc. Can make re-entrant parsers, and numerous other
10822: improvements. Why you would want this when Berkeley <a href=
10823: "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
10824: of the NetBSD source tree is beyond me.
10825: </pre>
10826: </div>
10827:
10828: <div class="sect2" lang="en" xml:lang="en">
10829: <div class="titlepage">
10830: <div>
10831: <div>
1.20 ! ben 10832: <h3 class="title"><a name="id2598010" id=
! 10833: "id2598010"></a>A.1.3. PLIST</h3>
1.1 grant 10834: </div>
10835: </div>
10836: </div>
10837: <pre class="programlisting">
1.17 sketch 10838: @comment $NetBSD$
1.1 grant 10839: bin/bison
10840: man/man1/bison.1.gz
10841: share/bison.simple
10842: share/bison.hairy
10843: </pre>
10844: </div>
10845:
10846: <div class="sect2" lang="en" xml:lang="en">
10847: <div class="titlepage">
10848: <div>
10849: <div>
1.20 ! ben 10850: <h3 class="title"><a name="id2598018" id=
! 10851: "id2598018"></a>A.1.4. Checking a package with
1.14 xtraeme 10852: <span><strong class=
10853: "command">pkglint</strong></span></h3>
1.1 grant 10854: </div>
10855: </div>
10856: </div>
10857:
10858: <p>The NetBSD package system comes with <a xmlns=
10859: "http://www.w3.org/TR/xhtml1/transitional" href=
10860: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ! ben 10861: class="pkgname">pkgtools/pkglint</a> which helps to check
! 10862: the contents of these files. After installation it is
! 10863: quite easy to use, just change to the directory of the
! 10864: package you wish to examine and execute
! 10865: <span><strong class=
! 10866: "command">pkglint</strong></span>:</p>
1.1 grant 10867: <pre class="screen">
1.14 xtraeme 10868: <code class="prompt">$</code> <strong class=
10869: "userinput"><code>pkglint</code></strong>
1.1 grant 10870: OK: checking ./DESCR.
10871: OK: checking Makefile.
10872: OK: checking distinfo.
10873: OK: checking patches/patch-aa.
10874: looks fine.
10875: </pre>
10876:
10877: <p>Depending on the supplied command line arguments (see
10878: pkglint(1)) more verbose checks will be performed. Use
1.14 xtraeme 10879: e.g. <span><strong class="command">pkglint
10880: -v</strong></span> for a very verbose check.</p>
1.1 grant 10881: </div>
10882: </div>
10883:
10884: <div class="sect1" lang="en" xml:lang="en">
10885: <div class="titlepage">
10886: <div>
10887: <div>
10888: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 10889: "id2598058" id="id2598058"></a>A.2. Steps for
1.1 grant 10890: building, installing, packaging</h2>
10891: </div>
10892: </div>
10893: </div>
10894:
10895: <p>Create the directory where the package lives, plus any
10896: auxiliary directories:</p>
10897: <pre class="screen">
1.14 xtraeme 10898: <code class="prompt">#</code> <strong class=
10899: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
10900: <code class="prompt">#</code> <strong class=
10901: "userinput"><code>mkdir bison</code></strong>
10902: <code class="prompt">#</code> <strong class=
10903: "userinput"><code>cd bison</code></strong>
10904: <code class="prompt">#</code> <strong class=
10905: "userinput"><code>mkdir patches</code></strong>
1.1 grant 10906: </pre>
10907:
1.14 xtraeme 10908: <p>Create <code class="filename">Makefile</code>,
10909: <code class="filename">DESCR</code> and <code class=
10910: "filename">PLIST</code> (see <a href="#components" title=
1.1 grant 10911: "Chapter 7. Package components - files, directories and contents">
10912: Chapter 7, <i>Package components - files, directories and
10913: contents</i></a>) then continue with fetching the
10914: distfile:</p>
10915: <pre class="screen">
1.14 xtraeme 10916: <code class="prompt">#</code> <strong class=
10917: "userinput"><code>make fetch</code></strong>
1.1 grant 10918: >> bison-1.25.tar.gz doesn't seem to exist on this system.
10919: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
10920: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10921: ftp: Error retrieving file: 500 Internal error
10922:
10923: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
10924: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10925: ftp: Error retrieving file: 500 Internal error
10926:
10927: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
10928: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10929: Successfully retrieved file.
10930: </pre>
10931:
1.14 xtraeme 10932: <p>Generate the checksum of the distfile into <code class=
10933: "filename">distinfo</code>:</p>
1.1 grant 10934: <pre class="screen">
1.14 xtraeme 10935: <code class="prompt">#</code> <strong class=
10936: "userinput"><code>make makesum</code></strong>
1.1 grant 10937: </pre>
10938:
10939: <p>Now compile:</p>
10940: <pre class="screen">
1.14 xtraeme 10941: <code class="prompt">#</code> <strong class=
10942: "userinput"><code>make</code></strong>
1.1 grant 10943: >> Checksum OK for bison-1.25.tar.gz.
10944: ===> Extracting for bison-1.25
10945: ===> Patching for bison-1.25
10946: ===> Ignoring empty patch directory
10947: ===> Configuring for bison-1.25
10948: creating cache ./config.cache
10949: checking for gcc... cc
10950: checking whether we are using GNU C... yes
10951: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
10952: checking how to run the C preprocessor... cc -E
10953: checking for minix/config.h... no
10954: checking for POSIXized ISC... no
10955: checking whether cross-compiling... no
10956: checking for ANSI C header files... yes
10957: checking for string.h... yes
10958: checking for stdlib.h... yes
10959: checking for memory.h... yes
10960: checking for working const... yes
10961: checking for working alloca.h... no
10962: checking for alloca... yes
10963: checking for strerror... yes
10964: updating cache ./config.cache
10965: creating ./config.status
10966: creating Makefile
10967: ===> Building for bison-1.25
10968: 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
10969: 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
10970: 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
10971: 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
10972: 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
10973: 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
10974: 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
10975: 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
10976: 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
10977: 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
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 main.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 nullable.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 output.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 print.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 reader.c
10983: 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
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 symtab.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 warshall.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 version.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 getopt.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 getopt1.c
10989: 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
10990: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
10991: rm -f bison.s1
10992: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
10993: </pre>
10994:
10995: <p>Everything seems OK, so install the files:</p>
10996: <pre class="screen">
1.14 xtraeme 10997: <code class="prompt">#</code> <strong class=
10998: "userinput"><code>make install</code></strong>
1.1 grant 10999: >> Checksum OK for bison-1.25.tar.gz.
11000: ===> Installing for bison-1.25
11001: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
11002: rm -f /usr/pkg/bin/bison
11003: cd /usr/pkg/share; rm -f bison.simple bison.hairy
11004: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
11005: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
11006: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
11007: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
11008: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
11009: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
11010: ===> Registering installation for bison-1.25
11011: </pre>
11012:
11013: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 11014: remove it with <span><strong class="command">pkg_delete
11015: bison</strong></span>. Should you decide that you want a
11016: binary package, do this now:</p>
1.1 grant 11017: <pre class="screen">
1.14 xtraeme 11018: <code class="prompt">#</code> <strong class=
11019: "userinput"><code>make package</code></strong>
1.1 grant 11020: >> Checksum OK for bison-1.25.tar.gz.
11021: ===> Building package for bison-1.25
11022: Creating package bison-1.25.tgz
11023: Registering depends:.
11024: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
11025: </pre>
11026:
11027: <p>Now that you don't need the source and object files any
11028: more, clean up:</p>
11029: <pre class="screen">
1.14 xtraeme 11030: <code class="prompt">#</code> <strong class=
11031: "userinput"><code>make clean</code></strong>
1.1 grant 11032: ===> Cleaning for bison-1.25
11033: </pre>
11034: </div>
11035: </div>
11036:
11037: <div class="appendix" lang="en" xml:lang="en">
11038: <div class="titlepage">
11039: <div>
11040: <div>
11041: <h2 class="title"><a name="logs" id=
11042: "logs"></a>Appendix B. Build logs</h2>
11043: </div>
11044: </div>
11045: </div>
11046:
11047: <div class="toc">
11048: <p><b>Table of Contents</b></p>
11049:
11050: <dl>
11051: <dt><span class="sect1"><a href="#logs.building">B.1.
11052: Building figlet</a></span></dt>
11053:
11054: <dt><span class="sect1"><a href="#logs.package">B.2.
11055: Packaging figlet</a></span></dt>
11056: </dl>
11057: </div>
11058:
11059: <div class="sect1" lang="en" xml:lang="en">
11060: <div class="titlepage">
11061: <div>
11062: <div>
11063: <h2 class="title" style="clear: both"><a name=
11064: "logs.building" id=
11065: "logs.building"></a>B.1. Building figlet</h2>
11066: </div>
11067: </div>
11068: </div>
11069: <pre class="screen">
1.14 xtraeme 11070: <code class="prompt">#</code> <strong class=
11071: "userinput"><code>make</code></strong>
1.1 grant 11072: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11073: => figlet221.tar.gz doesn't seem to exist on this system.
11074: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
11075: => [172219 bytes]
11076: Connected to ftp.plig.net.
11077: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
11078: 331 Guest login ok, send your complete e-mail address as password.
11079: 230-You are user #5 of 500 simultaneous users allowed.
11080: 230-
11081: 230- ___ _ _ _
11082: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
11083: 230- | _| _| . |_| . | | | . |_| . | _| . |
11084: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
11085: 230- |_| |_| |___| |___|
11086: 230-
11087: 230-** Welcome to ftp.plig.org **
11088: 230-
11089: 230-Please note that all transfers from this FTP site are logged. If you
11090: 230-do not like this, please disconnect now.
11091: 230-
11092: 230-This arhive is available via
11093: 230-
11094: 230-HTTP: http://ftp.plig.org/
11095: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
11096: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
11097: 230-
11098: 230-Please email comments, bug reports and requests for packages to be
11099: 230-mirrored to ftp-admin@plig.org.
11100: 230-
11101: 230-
11102: 230 Logged in anonymously.
11103: Remote system type is UNIX.
11104: Using binary mode to transfer files.
11105: 200 Type okay.
11106: 250 "/pub" is new cwd.
11107: 250-"/pub/figlet" is new cwd.
11108: 250-
11109: 250-Welcome to the figlet archive at ftp.figlet.org
11110: 250-
11111: 250- ftp://ftp.figlet.org/pub/figlet/
11112: 250-
11113: 250-The official FIGlet web page is:
11114: 250- http://www.figlet.org/
11115: 250-
11116: 250-If you have questions, please mailto:info@figlet.org. If you want to
11117: 250-contribute a font or something else, you can email us.
11118: 250
11119: 250 "/pub/figlet/program" is new cwd.
11120: 250 "/pub/figlet/program/unix" is new cwd.
11121: local: figlet221.tar.gz remote: figlet221.tar.gz
11122: 502 Unimplemented command.
11123: 227 Entering Passive Mode (195,40,6,41,246,104)
11124: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
11125: 38% |************** | 65800 64.16 KB/s 00:01 ETA
11126: 226 Transfer completed.
11127: 172219 bytes received in 00:02 (75.99 KB/s)
11128: 221 Goodbye.
11129: => Checksum OK for figlet221.tar.gz.
11130: ===> Extracting for figlet-2.2.1nb2
11131: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
11132: ===> Patching for figlet-2.2.1nb2
11133: ===> Applying pkgsrc patches for figlet-2.2.1nb2
11134: ===> Overriding tools for figlet-2.2.1nb2
11135: ===> Creating toolchain wrappers for figlet-2.2.1nb2
11136: ===> Configuring for figlet-2.2.1nb2
11137: ===> Building for figlet-2.2.1nb2
11138: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
11139: chmod a+x figlet
11140: gcc -O2 -o chkfont chkfont.c
11141: => Unwrapping files-to-be-installed.
1.14 xtraeme 11142: <code class="prompt">#</code>
11143: <code class="prompt">#</code> <strong class=
11144: "userinput"><code>make install</code></strong>
1.1 grant 11145: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11146: ===> Installing for figlet-2.2.1nb2
11147: install -d -o root -g wheel -m 755 /usr/pkg/bin
11148: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
11149: mkdir -p /usr/pkg/share/figlet
11150: cp figlet /usr/pkg/bin
11151: cp chkfont /usr/pkg/bin
11152: chmod 555 figlist showfigfonts
11153: cp figlist /usr/pkg/bin
11154: cp showfigfonts /usr/pkg/bin
11155: cp fonts/*.flf /usr/pkg/share/figlet
11156: cp fonts/*.flc /usr/pkg/share/figlet
11157: cp figlet.6 /usr/pkg/man/man6
11158: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 11159: <code class="prompt">#</code>
1.1 grant 11160: </pre>
11161: </div>
11162:
11163: <div class="sect1" lang="en" xml:lang="en">
11164: <div class="titlepage">
11165: <div>
11166: <div>
11167: <h2 class="title" style="clear: both"><a name=
11168: "logs.package" id=
11169: "logs.package"></a>B.2. Packaging figlet</h2>
11170: </div>
11171: </div>
11172: </div>
11173: <pre class="screen">
1.14 xtraeme 11174: <code class="prompt">#</code> <strong class=
11175: "userinput"><code>make package</code></strong>
1.1 grant 11176: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11177: ===> Packaging figlet-2.2.1nb2
11178: ===> Building binary package for figlet-2.2.1nb2
11179: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
11180: Using SrcDir value of /usr/pkg
11181: Registering depends:.
1.14 xtraeme 11182: <code class="prompt">#</code>
1.1 grant 11183: </pre>
11184: </div>
11185: </div>
11186:
11187: <div class="appendix" lang="en" xml:lang="en">
11188: <div class="titlepage">
11189: <div>
11190: <div>
11191: <h2 class="title"><a name="ftp-layout" id=
11192: "ftp-layout"></a>Appendix C. Layout of the
11193: FTP server's package archive</h2>
11194: </div>
11195: </div>
11196: </div>
11197:
11198: <p>Layout for precompiled binary packages on
11199: ftp.NetBSD.org:</p>
11200: <pre class="programlisting">
11201: /pub/NetBSD/packages/
11202: distfiles/
11203:
11204: # Unpacked pkgsrc trees
11205: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
11206: pkgsrc-2003Q4 -> N/A
11207: pkgsrc-2004Q1/pkgsrc
11208:
11209: # pkgsrc archives
11210: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
11211: pkgsrc-2003Q4.tar.gz -> N/A
11212: pkgsrc-2004Q1.tar.gz -> N/A
11213:
11214: # Per pkgsrc-release/OS-release/arch package archives
11215: pkgsrc-2003Q4/
11216: NetBSD-1.6.2/
11217: i386/
11218: All/
11219: archivers/
11220: foo -> ../All/foo
11221: ...
11222: pkgsrc-2004Q1/
11223: NetBSD-1.6.2/
11224: i386/
11225: All/
11226: ...
11227: NetBSD-2.0/
11228: i386/
11229: All/
11230: ...
11231: SunOS-5.9/
11232: sparc/
11233: All/
11234: ...
11235: x86/
11236: All/
11237: ...
11238:
11239: # Per os-release package archive convenience links
11240: NetBSD-1.6.2 -> 1.6.2
11241: 1.6.2/
11242: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
11243: m68k/
11244: All/
11245: archivers/
11246: foo -> ../All/foo
11247: ...
11248: amiga -> m68k
11249: atari -> m68k
11250: ...
11251:
11252: 2.0 -> NetBSD-2.0 # backward compat, historic
11253: NetBSD-2.0/
11254: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
11255: SunOS-5.9/
11256: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
11257: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
11258:
11259: </pre>
11260:
11261: <p>To create:</p>
11262:
11263: <div class="orderedlist">
11264: <ol type="1">
11265: <li>
11266: <p>Run bulk build, see <a href="#bulkbuild" title=
11267: "5.3. Doing a bulk build of all packages">Section
11268: 5.3, “Doing a bulk build of all
11269: packages”</a></p>
11270: </li>
11271:
11272: <li>
11273: <p>Upload /usr/pkgsrc/packages to</p>
11274: <pre class="programlisting">
11275: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13 hubertf 11276: pkgsrc-2004Q4/\ # pkgsrc-branch
1.1 grant 11277: `uname -s`-`uname -r`/ # OS & version
11278: `uname -p` # architecture
11279:
11280: </pre>
11281: </li>
11282:
11283: <li>
1.14 xtraeme 11284: <p>If necessary, create a symlink <span><strong class=
11285: "command">ln -s `uname -m` `uname -p`</strong></span>
11286: (amiga -> m68k, ...)</p>
1.1 grant 11287: </li>
11288: </ol>
11289: </div>
11290: </div>
1.2 hubertf 11291:
11292: <div class="appendix" lang="en" xml:lang="en">
11293: <div class="titlepage">
11294: <div>
11295: <div>
11296: <h2 class="title"><a name="editing" id=
11297: "editing"></a>Appendix D. Editing guidelines
11298: for the pkgsrc guide</h2>
11299: </div>
11300: </div>
11301: </div>
11302:
11303: <div class="toc">
11304: <p><b>Table of Contents</b></p>
11305:
11306: <dl>
1.20 ! ben 11307: <dt><span class="sect1"><a href="#id2598909">D.1.
1.2 hubertf 11308: Targets</a></span></dt>
11309:
1.20 ! ben 11310: <dt><span class="sect1"><a href="#id2599116">D.2.
1.2 hubertf 11311: Procedure</a></span></dt>
11312: </dl>
11313: </div>
11314:
11315: <p>This section contains information on editing the pkgsrc
11316: guide itself.</p>
11317:
11318: <div class="sect1" lang="en" xml:lang="en">
11319: <div class="titlepage">
11320: <div>
11321: <div>
11322: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 11323: "id2598909" id="id2598909"></a>D.1. Targets</h2>
1.2 hubertf 11324: </div>
11325: </div>
11326: </div>
11327:
1.14 xtraeme 11328: <p>The pkgsrc guide's source code is stored in <code class=
11329: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 11330: are created from it:</p>
11331:
11332: <div class="itemizedlist">
11333: <ul type="disc">
11334: <li>
1.14 xtraeme 11335: <p><code class=
11336: "filename">pkgsrc/doc/pkgsrc.txt</code>, which
11337: replaces <code class=
11338: "filename">pkgsrc/Packages.txt</code></p>
1.2 hubertf 11339: </li>
11340:
11341: <li>
1.14 xtraeme 11342: <p><code class=
11343: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 11344: </li>
11345:
11346: <li>
1.14 xtraeme 11347: <p><code class=
11348: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 11349: the documentation on the NetBSD website will be built
11350: from pkgsrc and kept up to date on the web server
11351: itself. This means you <span class=
11352: "emphasis"><em>must</em></span> make sure that your
11353: changes haven't broken the build!</p>
11354: </li>
1.6 hubertf 11355:
11356: <li>
1.14 xtraeme 11357: <p><code class=
11358: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 11359: PDF version of the pkgsrc guide.</p>
11360: </li>
11361:
11362: <li>
1.14 xtraeme 11363: <p><code class=
11364: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 11365: PostScript version of the pkgsrc guide.</p>
11366: </li>
1.2 hubertf 11367: </ul>
11368: </div>
11369: </div>
11370:
11371: <div class="sect1" lang="en" xml:lang="en">
11372: <div class="titlepage">
11373: <div>
11374: <div>
11375: <h2 class="title" style="clear: both"><a name=
1.20 ! ben 11376: "id2599116" id=
! 11377: "id2599116"></a>D.2. Procedure</h2>
1.2 hubertf 11378: </div>
11379: </div>
11380: </div>
11381:
11382: <p>The procedure to edit the pkgsrc guide is:</p>
11383:
11384: <div class="itemizedlist">
11385: <ul type="disc">
11386: <li>
1.6 hubertf 11387: <p>Make sure you have the packages needed to
11388: re-generate the pkgsrc guide (and other XML-based
11389: NetBSD documentation) installed. These are
1.11 ben 11390: “<span class="quote">netbsd-doc</span>”
1.6 hubertf 11391: for creating the ASCII- and HTML-version, and
11392: “<span class=
1.11 ben 11393: "quote">netbsd-doc-print</span>”for the
1.6 hubertf 11394: PostScript- and PDF version. You will need both
11395: packages installed, to make sure documentation is
11396: consistent across all formats. The packages can be
1.14 xtraeme 11397: found in <code class=
11398: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
11399: <code class=
11400: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 11401: </li>
11402:
11403: <li>
1.14 xtraeme 11404: <p>Edit the XML file(s) in <code class=
11405: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 11406: </li>
11407:
11408: <li>
1.14 xtraeme 11409: <p>Run <span><strong class="command">make extract
11410: && make do-lint</strong></span> in
11411: <code class="filename">pkgsrc/doc/guide</code> to
11412: check the XML syntax, and fix it if needed.</p>
1.4 hubertf 11413: </li>
11414:
11415: <li>
1.14 xtraeme 11416: <p>Run <span><strong class=
11417: "command">make</strong></span> in <code class=
11418: "filename">pkgsrc/doc/guide</code> to build the HTML
11419: and ASCII version.</p>
1.2 hubertf 11420: </li>
11421:
11422: <li>
1.14 xtraeme 11423: <p>If all is well, run <span><strong class=
11424: "command">make install-doc</strong></span> to put the
11425: generated files into <code class=
11426: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 11427: </li>
11428:
11429: <li>
1.14 xtraeme 11430: <p><span><strong class="command">cvs commit
11431: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 11432: </li>
11433:
11434: <li>
1.14 xtraeme 11435: <p><span><strong class="command">cvs commit -m
11436: re-generate
11437: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 11438: </li>
1.4 hubertf 11439:
11440: <li>
11441: <p>Until the webserver on www.NetBSD.org is really
11442: updated automatically to pick up changes to the
1.14 xtraeme 11443: pkgsrc guide automatically, also run
1.18 xtraeme 11444: <span><strong class="command">make install-htdocs
1.14 xtraeme 11445: HTDOCSDIR=../../../htdocs</strong></span> (or
11446: similar, adjust <code class=
11447: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 11448: </li>
11449:
11450: <li>
1.14 xtraeme 11451: <p><span><strong class="command">cvs commit
11452: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 11453: </li>
1.2 hubertf 11454: </ul>
11455: </div>
11456: </div>
11457: </div>
1.1 grant 11458: </div>
11459: </body>
11460: </html>
CVSweb <webmaster@jp.NetBSD.org>