Annotation of pkgsrc/doc/pkgsrc.html, revision 1.12
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.7 wiz 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.7 wiz 11: "DocBook XSL Stylesheets V1.67.0" />
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.12 ! agc 22: <h1 class="title"><a name="id2458390" id=
! 23: "id2458390"></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.7 wiz 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.7 wiz 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.12 ! agc 96: <dt><span class="sect1"><a href="#id2514273">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.12 ! agc 120: <dt><span class="sect1"><a href="#id2514851">2.1.
1.1 grant 121: As tar file</a></span></dt>
122:
1.12 ! agc 123: <dt><span class="sect1"><a href="#id2514867">2.2.
1.1 grant 124: Via SUP</a></span></dt>
125:
1.12 ! agc 126: <dt><span class="sect1"><a href="#id2514967">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.12 ! agc 136: <dt><span class="sect1"><a href="#id2515077">3.1.
1.1 grant 137: Bootstrapping pkgsrc</a></span></dt>
138:
1.12 ! agc 139: <dt><span class="sect1"><a href="#id2515252">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.12 ! agc 145: "#id2515258">3.2.1. Darwin (Mac OS
1.1 grant 146: X)</a></span></dt>
147:
148: <dt><span class="sect2"><a href=
1.12 ! agc 149: "#id2515489">3.2.2. FreeBSD</a></span></dt>
1.1 grant 150:
151: <dt><span class="sect2"><a href=
1.12 ! agc 152: "#id2515659">3.2.3. Interix</a></span></dt>
1.1 grant 153:
154: <dt><span class="sect2"><a href=
1.12 ! agc 155: "#id2515750">3.2.4. IRIX</a></span></dt>
1.1 grant 156:
157: <dt><span class="sect2"><a href=
1.12 ! agc 158: "#id2516277">3.2.5. OpenBSD</a></span></dt>
1.1 grant 159:
160: <dt><span class="sect2"><a href=
1.12 ! agc 161: "#id2516389">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.12 ! agc 179: "#id2516525">4.1.1. Where to get binary
1.1 grant 180: packages</a></span></dt>
181:
182: <dt><span class="sect2"><a href=
1.12 ! agc 183: "#id2516566">4.1.2. How to use binary
1.1 grant 184: packages</a></span></dt>
185:
186: <dt><span class="sect2"><a href=
1.12 ! agc 187: "#id2516700">4.1.3. A word of
1.1 grant 188: warning</a></span></dt>
189: </dl>
190: </dd>
191:
1.12 ! agc 192: <dt><span class="sect1"><a href="#id2516712">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.12 ! agc 198: "#id2516722">4.2.1.
1.1 grant 199: Requirements</a></span></dt>
200:
201: <dt><span class="sect2"><a href=
1.12 ! agc 202: "#id2516742">4.2.2. Fetching
1.1 grant 203: distfiles</a></span></dt>
204:
205: <dt><span class="sect2"><a href=
1.12 ! agc 206: "#id2516862">4.2.3. How to build and
1.1 grant 207: install</a></span></dt>
208:
209: <dt><span class="sect2"><a href=
1.12 ! agc 210: "#id2517179">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.12 ! agc 222: <dt><span class="sect1"><a href="#id2517334">5.1.
1.1 grant 223: Building a single binary package</a></span></dt>
224:
1.12 ! agc 225: <dt><span class="sect1"><a href="#id2517821">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.12 ! agc 239: "#id2517961">5.3.2. Other environmental
1.1 grant 240: considerations</a></span></dt>
241:
242: <dt><span class="sect2"><a href=
1.12 ! agc 243: "#id2518002">5.3.3. Operation</a></span></dt>
1.1 grant 244:
245: <dt><span class="sect2"><a href=
1.12 ! agc 246: "#id2583267">5.3.4. What it
1.1 grant 247: does</a></span></dt>
248:
249: <dt><span class="sect2"><a href=
1.12 ! agc 250: "#id2583392">5.3.5. Disk space
1.1 grant 251: requirements</a></span></dt>
252:
253: <dt><span class="sect2"><a href=
1.12 ! agc 254: "#id2583418">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.12 ! agc 258: "#id2583811">5.3.7. Building a partial set of
1.1 grant 259: packages</a></span></dt>
260: </dl>
261: </dd>
262:
1.12 ! agc 263: <dt><span class="sect1"><a href="#id2583853">5.4.
1.1 grant 264: Creating a multiple CD-ROM packages
265: collection</a></span></dt>
266:
267: <dd>
268: <dl>
269: <dt><span class="sect2"><a href=
1.12 ! agc 270: "#id2583868">5.4.1. Example of
1.1 grant 271: cdpack</a></span></dt>
272: </dl>
273: </dd>
274: </dl>
275: </dd>
276:
277: <dt><span class="chapter"><a href="#faq">6. Frequently
278: Asked Questions</a></span></dt>
279:
280: <dd>
281: <dl>
1.12 ! agc 282: <dt><span class="sect1"><a href="#id2584196">6.1.
1.1 grant 283: Is there a mailing list for pkg-related
284: discussion?</a></span></dt>
285:
1.12 ! agc 286: <dt><span class="sect1"><a href="#id2584226">6.2.
1.1 grant 287: Where's the pkgviews documentation?</a></span></dt>
288:
1.5 hubertf 289: <dt><span class="sect1"><a href=
290: "#faq-pkgtools">6.3. Utilities for package
291: management (pkgtools)</a></span></dt>
1.1 grant 292:
1.12 ! agc 293: <dt><span class="sect1"><a href="#id2584478">6.4.
1.1 grant 294: How to use pkgsrc as non-root</a></span></dt>
295:
1.12 ! agc 296: <dt><span class="sect1"><a href="#id2584490">6.5.
1.1 grant 297: How can I install/use XFree86 from
298: pkgsrc?</a></span></dt>
299:
1.12 ! agc 300: <dt><span class="sect1"><a href="#id2584586">6.6.
1.1 grant 301: How can I install/use X.org from
302: pkgsrc?</a></span></dt>
303:
1.12 ! agc 304: <dt><span class="sect1"><a href="#id2584614">6.7.
1.1 grant 305: How to fetch files from behind a
306: firewall</a></span></dt>
307:
1.12 ! agc 308: <dt><span class="sect1"><a href="#id2584628">6.8.
1.7 wiz 309: How do I tell <span><strong class="command">make
310: fetch</strong></span> to do passive
1.1 grant 311: FTP?</a></span></dt>
312:
1.12 ! agc 313: <dt><span class="sect1"><a href="#id2584747">6.9.
1.1 grant 314: How to fetch all distfiles at once</a></span></dt>
315:
1.12 ! agc 316: <dt><span class="sect1"><a href="#id2584887">6.10.
1.7 wiz 317: What does “<span class="quote">Don't know how
318: to make /usr/share/tmac/tmac.andoc</span>”
319: mean?</a></span></dt>
1.1 grant 320:
1.12 ! agc 321: <dt><span class="sect1"><a href="#id2584925">6.11.
1.7 wiz 322: What does “<span class="quote">Could not find
323: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 324:
1.12 ! agc 325: <dt><span class="sect1"><a href="#id2584983">6.12.
1.1 grant 326: Using 'sudo' with pkgsrc</a></span></dt>
327:
328: <dt><span class="sect1"><a href="#faq.conf">6.13.
329: Configuration files handling and
330: placement</a></span></dt>
331:
332: <dt><span class="sect1"><a href=
333: "#audit-packages">6.14. Automated security
334: checks</a></span></dt>
335: </dl>
336: </dd>
337: </dl>
338: </dd>
339:
1.2 hubertf 340: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 341: pkgsrc developer's guide</a></span></dt>
342:
343: <dd>
344: <dl>
345: <dt><span class="chapter"><a href="#components">7.
346: Package components - files, directories and
347: contents</a></span></dt>
348:
349: <dd>
350: <dl>
351: <dt><span class="sect1"><a href=
1.7 wiz 352: "#components.Makefile">7.1. <code class=
353: "filename">Makefile</code></a></span></dt>
1.1 grant 354:
355: <dt><span class="sect1"><a href=
1.7 wiz 356: "#components.distinfo">7.2. <code class=
357: "filename">distinfo</code></a></span></dt>
1.1 grant 358:
359: <dt><span class="sect1"><a href=
360: "#components.patches">7.3.
361: patches/*</a></span></dt>
362:
1.12 ! agc 363: <dt><span class="sect1"><a href="#id2586097">7.4.
1.1 grant 364: Other mandatory files</a></span></dt>
365:
366: <dt><span class="sect1"><a href=
367: "#components.optional">7.5. Optional
368: files</a></span></dt>
369:
1.12 ! agc 370: <dt><span class="sect1"><a href="#id2586222">7.6.
1.7 wiz 371: <code class="filename">work*</code></a></span></dt>
1.1 grant 372:
1.12 ! agc 373: <dt><span class="sect1"><a href="#id2586310">7.7.
1.7 wiz 374: <code class=
375: "filename">files/*</code></a></span></dt>
1.1 grant 376: </dl>
377: </dd>
378:
379: <dt><span class="chapter"><a href="#plist">8. PLIST
380: issues</a></span></dt>
381:
382: <dd>
383: <dl>
1.12 ! agc 384: <dt><span class="sect1"><a href="#id2586364">8.1.
1.1 grant 385: RCS ID</a></span></dt>
386:
1.12 ! agc 387: <dt><span class="sect1"><a href="#id2586379">8.2.
1.7 wiz 388: Semi-automatic <code class="filename">PLIST</code>
389: generation</a></span></dt>
1.1 grant 390:
391: <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.7 wiz 392: Tweaking output of <span><strong class=
393: "command">make
394: print-PLIST</strong></span></a></span></dt>
1.1 grant 395:
396: <dt><span class="sect1"><a href="#plist.misc">8.4.
397: Variable substitution in PLIST</a></span></dt>
398:
1.12 ! agc 399: <dt><span class="sect1"><a href="#id2586769">8.5.
1.1 grant 400: Manpage-compression</a></span></dt>
401:
1.12 ! agc 402: <dt><span class="sect1"><a href="#id2586810">8.6.
1.7 wiz 403: Changing PLIST source with <code class=
404: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 405:
1.12 ! agc 406: <dt><span class="sect1"><a href="#id2586827">8.7.
1.1 grant 407: Platform specific and differing
408: PLISTs</a></span></dt>
409:
410: <dt><span class="sect1"><a href=
411: "#faq.common-dirs">8.8. Sharing directories between
412: packages</a></span></dt>
413: </dl>
414: </dd>
415:
416: <dt><span class="chapter"><a href="#buildlink">9.
417: Buildlink methodology</a></span></dt>
418:
419: <dd>
420: <dl>
1.12 ! agc 421: <dt><span class="sect1"><a href="#id2587099">9.1.
1.1 grant 422: Converting packages to use
423: buildlink3</a></span></dt>
424:
1.12 ! agc 425: <dt><span class="sect1"><a href="#id2587290">9.2.
1.7 wiz 426: Writing <code class="filename">buildlink3.mk</code>
427: files</a></span></dt>
1.1 grant 428:
429: <dd>
430: <dl>
431: <dt><span class="sect2"><a href=
1.12 ! agc 432: "#id2587496">9.2.1. Anatomy of a buildlink3.mk
1.1 grant 433: file</a></span></dt>
434:
435: <dt><span class="sect2"><a href=
1.12 ! agc 436: "#id2588073">9.2.2. Updating <code class=
1.7 wiz 437: "varname">BUILDLINK_DEPENDS.<em class=
438: "replaceable"><code>pkg</code></em></code> in
439: <code class="filename">buildlink3.mk</code>
1.1 grant 440: files</a></span></dt>
441: </dl>
442: </dd>
443:
1.12 ! agc 444: <dt><span class="sect1"><a href="#id2588152">9.3.
1.7 wiz 445: Writing <code class="filename">builtin.mk</code>
446: files</a></span></dt>
1.1 grant 447:
448: <dd>
449: <dl>
450: <dt><span class="sect2"><a href=
1.12 ! agc 451: "#id2588233">9.3.1. Anatomy of a <code class=
1.7 wiz 452: "filename">builtin.mk</code>
1.1 grant 453: file</a></span></dt>
454:
455: <dt><span class="sect2"><a href=
1.12 ! agc 456: "#id2588392">9.3.2. Global preferences for
1.1 grant 457: native or pkgsrc software</a></span></dt>
458: </dl>
459: </dd>
460: </dl>
461: </dd>
462:
463: <dt><span class="chapter"><a href="#options">10.
464: Options handling</a></span></dt>
465:
466: <dd>
467: <dl>
1.12 ! agc 468: <dt><span class="sect1"><a href="#id2588533">10.1.
1.1 grant 469: Global default options</a></span></dt>
470:
1.12 ! agc 471: <dt><span class="sect1"><a href="#id2588548">10.2.
1.7 wiz 472: Converting packages to use <code class=
473: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 474: </dl>
475: </dd>
476:
477: <dt><span class="chapter"><a href="#build">11. The
478: build process</a></span></dt>
479:
480: <dd>
481: <dl>
482: <dt><span class="sect1"><a href=
483: "#build.prefix">11.1. Program
484: location</a></span></dt>
485:
1.12 ! agc 486: <dt><span class="sect1"><a href="#id2589156">11.2.
1.1 grant 487: Main targets</a></span></dt>
488:
489: <dt><span class="sect1"><a href=
490: "#build.helpful-targets">11.3. Other helpful
491: targets</a></span></dt>
492: </dl>
493: </dd>
494:
495: <dt><span class="chapter"><a href="#fixes">12. Notes on
496: fixes for packages</a></span></dt>
497:
498: <dd>
499: <dl>
1.12 ! agc 500: <dt><span class="sect1"><a href="#id2590556">12.1.
1.1 grant 501: General operation</a></span></dt>
502:
503: <dd>
504: <dl>
505: <dt><span class="sect2"><a href=
1.12 ! agc 506: "#id2590560">12.1.1. How to pull in variables
1.1 grant 507: from /etc/mk.conf</a></span></dt>
508:
509: <dt><span class="sect2"><a href=
1.12 ! agc 510: "#id2590643">12.1.2. Restricted
1.1 grant 511: packages</a></span></dt>
512:
513: <dt><span class="sect2"><a href=
514: "#dependencies">12.1.3. Handling
515: dependencies</a></span></dt>
516:
517: <dt><span class="sect2"><a href=
1.12 ! agc 518: "#id2591226">12.1.4. Handling conflicts with
1.1 grant 519: other packages</a></span></dt>
520:
521: <dt><span class="sect2"><a href=
1.12 ! agc 522: "#id2591276">12.1.5. Packages that cannot or
1.1 grant 523: should not be built</a></span></dt>
524:
525: <dt><span class="sect2"><a href=
1.12 ! agc 526: "#id2591302">12.1.6. Packages which should not
1.1 grant 527: be deleted, once installed</a></span></dt>
528:
529: <dt><span class="sect2"><a href=
530: "#security-handling">12.1.7. Handling packages
531: with security problems</a></span></dt>
532:
533: <dt><span class="sect2"><a href=
1.12 ! agc 534: "#id2591462">12.1.8. How to handle compiler
1.1 grant 535: bugs</a></span></dt>
536:
537: <dt><span class="sect2"><a href=
1.12 ! agc 538: "#id2591484">12.1.9. How to handle incrementing
1.1 grant 539: versions when fixing an existing
540: package</a></span></dt>
541:
542: <dt><span class="sect2"><a href=
1.12 ! agc 543: "#id2591533">12.1.10. Portability of
1.1 grant 544: packages</a></span></dt>
545: </dl>
546: </dd>
547:
1.12 ! agc 548: <dt><span class="sect1"><a href="#id2591626">12.2.
1.1 grant 549: Possible downloading issues</a></span></dt>
550:
551: <dd>
552: <dl>
553: <dt><span class="sect2"><a href=
1.12 ! agc 554: "#id2591629">12.2.1. Packages whose distfiles
1.1 grant 555: aren't available for plain
556: downloading</a></span></dt>
557:
558: <dt><span class="sect2"><a href=
1.12 ! agc 559: "#id2591692">12.2.2. How to handle modified
1.1 grant 560: distfiles with the 'old' name</a></span></dt>
561: </dl>
562: </dd>
563:
1.12 ! agc 564: <dt><span class="sect1"><a href="#id2591704">12.3.
1.1 grant 565: Configuration gotchas</a></span></dt>
566:
567: <dd>
568: <dl>
569: <dt><span class="sect2"><a href=
570: "#fixes.libtool">12.3.1. Shared libraries -
571: libtool</a></span></dt>
572:
573: <dt><span class="sect2"><a href=
1.12 ! agc 574: "#id2592180">12.3.2. Using libtool on GNU
1.1 grant 575: packages that already support
576: libtool</a></span></dt>
577:
578: <dt><span class="sect2"><a href=
1.12 ! agc 579: "#id2592264">12.3.3. GNU
1.1 grant 580: Autoconf/Automake</a></span></dt>
581: </dl>
582: </dd>
583:
1.12 ! agc 584: <dt><span class="sect1"><a href="#id2592309">12.4.
1.1 grant 585: Building considerations</a></span></dt>
586:
587: <dd>
588: <dl>
589: <dt><span class="sect2"><a href=
1.12 ! agc 590: "#id2592312">12.4.1. CPP
1.1 grant 591: defines</a></span></dt>
592: </dl>
593: </dd>
594:
1.12 ! agc 595: <dt><span class="sect1"><a href="#id2592342">12.5.
1.1 grant 596: Package specific actions</a></span></dt>
597:
598: <dd>
599: <dl>
600: <dt><span class="sect2"><a href=
1.12 ! agc 601: "#id2592345">12.5.1. Package configuration
1.1 grant 602: files</a></span></dt>
603:
604: <dt><span class="sect2"><a href=
1.12 ! agc 605: "#id2592516">12.5.2. User
1.2 hubertf 606: interaction</a></span></dt>
1.1 grant 607:
608: <dt><span class="sect2"><a href=
1.12 ! agc 609: "#id2592561">12.5.3. Handling
1.1 grant 610: licenses</a></span></dt>
611:
612: <dt><span class="sect2"><a href=
1.12 ! agc 613: "#id2592644">12.5.4. Creating an account from a
1.1 grant 614: package</a></span></dt>
615:
616: <dt><span class="sect2"><a href=
1.12 ! agc 617: "#id2592774">12.5.5. Installing score
1.1 grant 618: files</a></span></dt>
619:
620: <dt><span class="sect2"><a href=
1.12 ! agc 621: "#id2592818">12.5.6. Packages providing login
1.1 grant 622: shells</a></span></dt>
623:
624: <dt><span class="sect2"><a href=
1.12 ! agc 625: "#id2593012">12.5.7. Packages containing perl
1.1 grant 626: scripts</a></span></dt>
627:
628: <dt><span class="sect2"><a href=
1.12 ! agc 629: "#id2593030">12.5.8. Packages with hardcoded
1.1 grant 630: paths to other interpreters</a></span></dt>
631:
632: <dt><span class="sect2"><a href=
1.12 ! agc 633: "#id2593051">12.5.9. Packages installing perl
1.1 grant 634: modules</a></span></dt>
635:
636: <dt><span class="sect2"><a href=
637: "#faq.info-files">12.5.10. Packages installing
638: info files</a></span></dt>
639:
640: <dt><span class="sect2"><a href=
1.12 ! agc 641: "#id2593408">12.5.11. Packages installing
1.1 grant 642: GConf2 data files</a></span></dt>
643:
644: <dt><span class="sect2"><a href=
1.12 ! agc 645: "#id2593508">12.5.12. Packages installing
1.1 grant 646: scrollkeeper data files</a></span></dt>
647:
648: <dt><span class="sect2"><a href=
1.12 ! agc 649: "#id2593559">12.5.13. Packages installing X11
1.1 grant 650: fonts</a></span></dt>
651:
652: <dt><span class="sect2"><a href=
1.12 ! agc 653: "#id2593606">12.5.14. Packages installing GTK2
1.1 grant 654: modules</a></span></dt>
655:
656: <dt><span class="sect2"><a href=
1.12 ! agc 657: "#id2593675">12.5.15. Packages installing SGML
1.1 grant 658: or XML data</a></span></dt>
659:
660: <dt><span class="sect2"><a href=
1.12 ! agc 661: "#id2593728">12.5.16. Packages installing
1.1 grant 662: extensions to the MIME database</a></span></dt>
663:
664: <dt><span class="sect2"><a href=
1.12 ! agc 665: "#id2593798">12.5.17. Packages using
1.1 grant 666: intltool</a></span></dt>
667: </dl>
668: </dd>
669:
1.12 ! agc 670: <dt><span class="sect1"><a href="#id2593812">12.6.
1.1 grant 671: Feedback to the author</a></span></dt>
672: </dl>
673: </dd>
674:
675: <dt><span class="chapter"><a href="#debug">13.
676: Debugging</a></span></dt>
677:
678: <dt><span class="chapter"><a href="#submit">14.
679: Submitting and Committing</a></span></dt>
680:
681: <dd>
682: <dl>
1.12 ! agc 683: <dt><span class="sect1"><a href="#id2594342">14.1.
1.1 grant 684: Submitting your packages</a></span></dt>
685:
1.12 ! agc 686: <dt><span class="sect1"><a href="#id2594389">14.2.
1.1 grant 687: Committing: Importing a package into
688: CVS</a></span></dt>
689:
1.12 ! agc 690: <dt><span class="sect1"><a href="#id2594520">14.3.
1.2 hubertf 691: Updating a package to a newer
692: version</a></span></dt>
1.1 grant 693:
1.12 ! agc 694: <dt><span class="sect1"><a href="#id2594539">14.4.
1.2 hubertf 695: Moving a package in pkgsrc</a></span></dt>
1.1 grant 696: </dl>
697: </dd>
698: </dl>
699: </dd>
700:
701: <dt><span class="appendix"><a href="#examples">A. A simple
702: example package: bison</a></span></dt>
703:
704: <dd>
705: <dl>
1.12 ! agc 706: <dt><span class="sect1"><a href="#id2594765">A.1.
1.1 grant 707: files</a></span></dt>
708:
709: <dd>
710: <dl>
1.12 ! agc 711: <dt><span class="sect2"><a href="#id2594769">A.1.1.
1.1 grant 712: Makefile</a></span></dt>
713:
1.12 ! agc 714: <dt><span class="sect2"><a href="#id2594776">A.1.2.
1.1 grant 715: DESCR</a></span></dt>
716:
1.12 ! agc 717: <dt><span class="sect2"><a href="#id2594791">A.1.3.
1.1 grant 718: PLIST</a></span></dt>
719:
1.12 ! agc 720: <dt><span class="sect2"><a href="#id2594798">A.1.4.
1.7 wiz 721: Checking a package with <span><strong class=
722: "command">pkglint</strong></span></a></span></dt>
1.1 grant 723: </dl>
724: </dd>
725:
1.12 ! agc 726: <dt><span class="sect1"><a href="#id2594839">A.2. Steps
1.1 grant 727: for building, installing, packaging</a></span></dt>
728: </dl>
729: </dd>
730:
731: <dt><span class="appendix"><a href="#logs">B. Build
732: logs</a></span></dt>
733:
734: <dd>
735: <dl>
736: <dt><span class="sect1"><a href="#logs.building">B.1.
737: Building figlet</a></span></dt>
738:
739: <dt><span class="sect1"><a href="#logs.package">B.2.
740: Packaging figlet</a></span></dt>
741: </dl>
742: </dd>
743:
744: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
745: of the FTP server's package archive</a></span></dt>
1.2 hubertf 746:
747: <dt><span class="appendix"><a href="#editing">D. Editing
748: guidelines for the pkgsrc guide</a></span></dt>
749:
750: <dd>
751: <dl>
1.12 ! agc 752: <dt><span class="sect1"><a href="#id2595758">D.1.
1.2 hubertf 753: Targets</a></span></dt>
754:
1.12 ! agc 755: <dt><span class="sect1"><a href="#id2595829">D.2.
1.2 hubertf 756: Procedure</a></span></dt>
757: </dl>
758: </dd>
1.1 grant 759: </dl>
760: </div>
761:
762: <div class="chapter" lang="en" xml:lang="en">
763: <div class="titlepage">
764: <div>
765: <div>
766: <h2 class="title"><a name="introduction" id=
767: "introduction"></a>Chapter 1. Introduction</h2>
768: </div>
769: </div>
770: </div>
771:
772: <div class="toc">
773: <p><b>Table of Contents</b></p>
774:
775: <dl>
1.12 ! agc 776: <dt><span class="sect1"><a href="#id2514273">1.1.
1.1 grant 777: Introduction</a></span></dt>
778:
779: <dt><span class="sect1"><a href="#overview">1.2.
780: Overview</a></span></dt>
781:
782: <dt><span class="sect1"><a href="#terminology">1.3.
783: Terminology</a></span></dt>
784:
785: <dt><span class="sect1"><a href="#typography">1.4.
786: Typography</a></span></dt>
787: </dl>
788: </div>
789:
790: <div class="sect1" lang="en" xml:lang="en">
791: <div class="titlepage">
792: <div>
793: <div>
794: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 795: "id2514273" id=
! 796: "id2514273"></a>1.1. Introduction</h2>
1.1 grant 797: </div>
798: </div>
799: </div>
800:
801: <p>There is a lot of software freely available for Unix
802: based systems, which usually runs on NetBSD and other
803: Unix-flavoured systems, too, sometimes with some
804: modifications. The NetBSD Packages Collection (pkgsrc)
805: incorporates any such changes necessary to make that
806: software run, and makes the installation (and
807: de-installation) of the software package easy by means of a
808: single command.</p>
809:
810: <p>Once the software has been built, it is manipulated with
1.7 wiz 811: the <span><strong class="command">pkg_*</strong></span>
812: tools so that installation and de-installation, printing of
813: an inventory of all installed packages and retrieval of
814: one-line comments or more verbose descriptions are all
815: simple.</p>
1.1 grant 816:
817: <p>pkgsrc currently contains several thousand packages,
818: including:</p>
819:
820: <div class="itemizedlist">
821: <ul type="disc">
822: <li>
823: <p><a xmlns=
824: "http://www.w3.org/TR/xhtml1/transitional" href=
825: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.7 wiz 826: class="pkgname">www/apache</a> - The Apache web
827: server</p>
1.1 grant 828: </li>
829:
830: <li>
831: <p><a xmlns=
832: "http://www.w3.org/TR/xhtml1/transitional" href=
833: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.7 wiz 834: class="pkgname">www/mozilla</a> - The Mozilla web
835: browser</p>
1.1 grant 836: </li>
837:
838: <li>
839: <p><a xmlns=
840: "http://www.w3.org/TR/xhtml1/transitional" href=
841: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.7 wiz 842: class="pkgname">meta-pkgs/gnome</a> - The GNOME
843: Desktop Environment</p>
1.1 grant 844: </li>
845:
846: <li>
847: <p><a xmlns=
848: "http://www.w3.org/TR/xhtml1/transitional" href=
849: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.7 wiz 850: class="pkgname">meta-pkgs/kde3</a> - The K Desktop
851: Environment</p>
1.1 grant 852: </li>
853: </ul>
854: </div>
855:
856: <p>...just to name a few.</p>
857:
858: <p>pkgsrc has built-in support for handling varying
859: dependencies, such as pthreads and X11, and extended
860: features such as IPv6 support on a range of platforms.</p>
861:
862: <p>pkgsrc was derived from FreeBSD's ports system, and
863: initially developed for NetBSD only. Since then, pkgsrc has
864: grown a lot, and now supports the following platforms:</p>
865:
866: <div class="itemizedlist">
867: <ul type="disc">
868: <li>
869: <p><a href="http://developer.apple.com/darwin/"
870: target="_top">Darwin</a> (<a href=
871: "http://www.apple.com/macosx/" target="_top">Mac OS
872: X</a>)</p>
873: </li>
874:
875: <li>
1.3 hubertf 876: <p><a href="http://www.DragonFlyBSD.org/" target=
877: "_top">DragonFlyBSD</a></p>
878: </li>
879:
880: <li>
1.1 grant 881: <p><a href="http://www.FreeBSD.org/" target=
882: "_top">FreeBSD</a></p>
883: </li>
884:
885: <li>
1.3 hubertf 886: <p>Microsoft Windows, via <a href=
887: "http://www.microsoft.com/windows/sfu/" target=
888: "_top">Interix</a></p>
1.1 grant 889: </li>
890:
891: <li>
892: <p><a href="http://www.sgi.com/software/irix6.5/"
893: target="_top">IRIX</a></p>
894: </li>
895:
896: <li>
897: <p><a href="http://www.linux.org/" target=
898: "_top">Linux</a></p>
899: </li>
900:
901: <li>
902: <p><a href="http://www.NetBSD.org/" target=
903: "_top">NetBSD</a> (of course)</p>
904: </li>
905:
906: <li>
907: <p><a href="http://www.openbsd.org/" target=
908: "_top">OpenBSD</a></p>
909: </li>
910:
911: <li>
912: <p><a href="http://www.sun.com/solaris/" target=
913: "_top">Solaris</a></p>
914: </li>
915: </ul>
916: </div>
917: </div>
918:
919: <div class="sect1" lang="en" xml:lang="en">
920: <div class="titlepage">
921: <div>
922: <div>
923: <h2 class="title" style="clear: both"><a name=
924: "overview" id="overview"></a>1.2. Overview</h2>
925: </div>
926: </div>
927: </div>
928:
929: <p>This document is divided into two parts. The first,
930: <a href="#users-guide" title=
1.2 hubertf 931: "Part I. The pkgsrc user's guide">The pkgsrc
932: user's guide</a>, describes how one can use one of the
933: packages in the Package Collection, either by installing a
934: precompiled binary package, or by building one's own copy
935: using the NetBSD package system. The second part, <a href=
1.1 grant 936: "#developers-guide" title=
1.2 hubertf 937: "Part II. The pkgsrc developer's guide">The
938: pkgsrc developer's guide</a>, explains how to prepare a
939: package so it can be easily built by other NetBSD users
940: without knowing about the package's building details.</p>
1.1 grant 941:
942: <p>This document is available in various formats:</p>
943:
944: <div class="itemizedlist">
945: <ul type="disc">
946: <li>
947: <p><a href="index.html" target="_top">HTML</a></p>
948: </li>
949:
950: <li>
951: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
952: </li>
953:
954: <li>
955: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
956: </li>
957:
958: <li>
959: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
960: </li>
961: </ul>
962: </div>
963: </div>
964:
965: <div class="sect1" lang="en" xml:lang="en">
966: <div class="titlepage">
967: <div>
968: <div>
969: <h2 class="title" style="clear: both"><a name=
970: "terminology" id=
971: "terminology"></a>1.3. Terminology</h2>
972: </div>
973: </div>
974: </div>
975:
976: <p>There has been a lot of talk about “<span class=
977: "quote">ports</span>”, “<span class=
978: "quote">packages</span>”, etc. so far. Here is a
979: description of all the terminology used within this
980: document.</p>
981:
982: <div class="variablelist">
983: <dl>
984: <dt><span class="term">Package</span></dt>
985:
986: <dd>
987: <p>A set of files and building instructions that
988: describe what's necessary to build a certain piece of
989: software using pkgsrc. Packages are traditionally
1.7 wiz 990: stored under <code class=
991: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 992: </dd>
993:
994: <dt><span class="term">The NetBSD package
995: system</span></dt>
996:
997: <dd>
998: <p>This is the former name of “<span class=
999: "quote">pkgsrc</span>”. It is part of the
1000: NetBSD operating system and can be bootstrap to run
1001: on non-NetBSD operating systems as well. It handles
1002: building (compiling), installing, and removing of
1003: packages.</p>
1004: </dd>
1005:
1006: <dt><span class="term">Distfile</span></dt>
1007:
1008: <dd>
1009: <p>This term describes the file or files that are
1010: provided by the author of the piece of software to
1011: distribute his work. All the changes necessary to
1012: build on NetBSD are reflected in the corresponding
1013: package. Usually the distfile is in the form of a
1014: compressed tar-archive, but other types are possible,
1.7 wiz 1015: too. Distfiles are usually stored below <code class=
1016: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1017: </dd>
1018:
1019: <dt><span class="term">Port</span></dt>
1020:
1021: <dd>
1022: <p>This is the term used by FreeBSD and OpenBSD
1023: people for what we call a package. In NetBSD
1024: terminology, “<span class=
1025: "quote">port</span>” refers to a different
1026: architecture.</p>
1027: </dd>
1028:
1029: <dt><span class="term">Precompiled/binary
1030: package</span></dt>
1031:
1032: <dd>
1033: <p>A set of binaries built with pkgsrc from a
1.7 wiz 1034: distfile and stuffed together in a single
1035: <code class="filename">.tgz</code> file so it can be
1036: installed on machines of the same machine
1037: architecture without the need to recompile. Packages
1038: are usually generated in <code class=
1039: "filename">/usr/pkgsrc/packages</code>; there is also
1040: an archive on <a href=
1.1 grant 1041: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1042: "_top">ftp.NetBSD.org</a>.</p>
1043:
1044: <p>Sometimes, this is referred to by the term
1045: “<span class="quote">package</span>” too,
1046: especially in the context of precompiled
1047: packages.</p>
1048: </dd>
1049:
1050: <dt><span class="term">Program</span></dt>
1051:
1052: <dd>
1053: <p>The piece of software to be installed which will
1054: be constructed from all the files in the Distfile by
1055: the actions defined in the corresponding package.</p>
1056: </dd>
1057: </dl>
1058: </div>
1059: </div>
1060:
1061: <div class="sect1" lang="en" xml:lang="en">
1062: <div class="titlepage">
1063: <div>
1064: <div>
1065: <h2 class="title" style="clear: both"><a name=
1066: "typography" id=
1067: "typography"></a>1.4. Typography</h2>
1068: </div>
1069: </div>
1070: </div>
1071:
1072: <p>When giving examples for commands, shell prompts are
1073: used to show if the command should/can be issued as root,
1074: or if “<span class="quote">normal</span>” user
1.7 wiz 1075: privileges are sufficient. We use a <code class=
1076: "prompt">#</code> for root's shell prompt, and a
1077: <code class="prompt">$</code> for users' shell prompt,
1078: assuming they use the C-shell or tcsh.</p>
1.1 grant 1079: </div>
1080: </div>
1081:
1082: <div class="part" lang="en" xml:lang="en">
1083: <div class="titlepage">
1084: <div>
1085: <div>
1086: <h1 class="title"><a name="users-guide" id=
1.2 hubertf 1087: "users-guide"></a>The pkgsrc user's guide</h1>
1.1 grant 1088: </div>
1089: </div>
1090: </div>
1091:
1092: <div class="toc">
1093: <p><b>Table of Contents</b></p>
1094:
1095: <dl>
1096: <dt><span class="chapter"><a href="#getting">2. Where to
1097: get pkgsrc</a></span></dt>
1098:
1099: <dd>
1100: <dl>
1.12 ! agc 1101: <dt><span class="sect1"><a href="#id2514851">2.1. As
1.1 grant 1102: tar file</a></span></dt>
1103:
1.12 ! agc 1104: <dt><span class="sect1"><a href="#id2514867">2.2. Via
1.1 grant 1105: SUP</a></span></dt>
1106:
1.12 ! agc 1107: <dt><span class="sect1"><a href="#id2514967">2.3. Via
1.1 grant 1108: CVS</a></span></dt>
1109: </dl>
1110: </dd>
1111:
1112: <dt><span class="chapter"><a href="#platforms">3. Using
1113: pkgsrc on systems other than NetBSD</a></span></dt>
1114:
1115: <dd>
1116: <dl>
1.12 ! agc 1117: <dt><span class="sect1"><a href="#id2515077">3.1.
1.1 grant 1118: Bootstrapping pkgsrc</a></span></dt>
1119:
1.12 ! agc 1120: <dt><span class="sect1"><a href="#id2515252">3.2.
1.1 grant 1121: Platform specific notes</a></span></dt>
1122:
1123: <dd>
1124: <dl>
1125: <dt><span class="sect2"><a href=
1.12 ! agc 1126: "#id2515258">3.2.1. Darwin (Mac OS
1.1 grant 1127: X)</a></span></dt>
1128:
1129: <dt><span class="sect2"><a href=
1.12 ! agc 1130: "#id2515489">3.2.2. FreeBSD</a></span></dt>
1.1 grant 1131:
1132: <dt><span class="sect2"><a href=
1.12 ! agc 1133: "#id2515659">3.2.3. Interix</a></span></dt>
1.1 grant 1134:
1135: <dt><span class="sect2"><a href=
1.12 ! agc 1136: "#id2515750">3.2.4. IRIX</a></span></dt>
1.1 grant 1137:
1138: <dt><span class="sect2"><a href=
1.12 ! agc 1139: "#id2516277">3.2.5. OpenBSD</a></span></dt>
1.1 grant 1140:
1141: <dt><span class="sect2"><a href=
1.12 ! agc 1142: "#id2516389">3.2.6. Solaris</a></span></dt>
1.1 grant 1143: </dl>
1144: </dd>
1145: </dl>
1146: </dd>
1147:
1148: <dt><span class="chapter"><a href="#using">4. Using
1149: pkgsrc</a></span></dt>
1150:
1151: <dd>
1152: <dl>
1153: <dt><span class="sect1"><a href=
1154: "#getting-started">4.1. Working with binary
1155: packages</a></span></dt>
1156:
1157: <dd>
1158: <dl>
1159: <dt><span class="sect2"><a href=
1.12 ! agc 1160: "#id2516525">4.1.1. Where to get binary
1.1 grant 1161: packages</a></span></dt>
1162:
1163: <dt><span class="sect2"><a href=
1.12 ! agc 1164: "#id2516566">4.1.2. How to use binary
1.1 grant 1165: packages</a></span></dt>
1166:
1167: <dt><span class="sect2"><a href=
1.12 ! agc 1168: "#id2516700">4.1.3. A word of
1.1 grant 1169: warning</a></span></dt>
1170: </dl>
1171: </dd>
1172:
1.12 ! agc 1173: <dt><span class="sect1"><a href="#id2516712">4.2.
1.1 grant 1174: Building packages from source</a></span></dt>
1175:
1176: <dd>
1177: <dl>
1178: <dt><span class="sect2"><a href=
1.12 ! agc 1179: "#id2516722">4.2.1. Requirements</a></span></dt>
1.1 grant 1180:
1181: <dt><span class="sect2"><a href=
1.12 ! agc 1182: "#id2516742">4.2.2. Fetching
1.1 grant 1183: distfiles</a></span></dt>
1184:
1185: <dt><span class="sect2"><a href=
1.12 ! agc 1186: "#id2516862">4.2.3. How to build and
1.1 grant 1187: install</a></span></dt>
1188:
1189: <dt><span class="sect2"><a href=
1.12 ! agc 1190: "#id2517179">4.2.4. Selecting the
1.1 grant 1191: compiler</a></span></dt>
1192: </dl>
1193: </dd>
1194: </dl>
1195: </dd>
1196:
1197: <dt><span class="chapter"><a href="#binary">5. Creating
1198: binary packages</a></span></dt>
1199:
1200: <dd>
1201: <dl>
1.12 ! agc 1202: <dt><span class="sect1"><a href="#id2517334">5.1.
1.1 grant 1203: Building a single binary package</a></span></dt>
1204:
1.12 ! agc 1205: <dt><span class="sect1"><a href="#id2517821">5.2.
1.1 grant 1206: Settings for creation of binary
1207: packages</a></span></dt>
1208:
1209: <dt><span class="sect1"><a href="#bulkbuild">5.3.
1210: Doing a bulk build of all packages</a></span></dt>
1211:
1212: <dd>
1213: <dl>
1214: <dt><span class="sect2"><a href=
1215: "#binary.configuration">5.3.1.
1216: Configuration</a></span></dt>
1217:
1218: <dt><span class="sect2"><a href=
1.12 ! agc 1219: "#id2517961">5.3.2. Other environmental
1.1 grant 1220: considerations</a></span></dt>
1221:
1222: <dt><span class="sect2"><a href=
1.12 ! agc 1223: "#id2518002">5.3.3. Operation</a></span></dt>
1.1 grant 1224:
1225: <dt><span class="sect2"><a href=
1.12 ! agc 1226: "#id2583267">5.3.4. What it does</a></span></dt>
1.1 grant 1227:
1228: <dt><span class="sect2"><a href=
1.12 ! agc 1229: "#id2583392">5.3.5. Disk space
1.1 grant 1230: requirements</a></span></dt>
1231:
1232: <dt><span class="sect2"><a href=
1.12 ! agc 1233: "#id2583418">5.3.6. Setting up a sandbox for
1.1 grant 1234: chroot'ed builds</a></span></dt>
1235:
1236: <dt><span class="sect2"><a href=
1.12 ! agc 1237: "#id2583811">5.3.7. Building a partial set of
1.1 grant 1238: packages</a></span></dt>
1239: </dl>
1240: </dd>
1241:
1.12 ! agc 1242: <dt><span class="sect1"><a href="#id2583853">5.4.
1.1 grant 1243: Creating a multiple CD-ROM packages
1244: collection</a></span></dt>
1245:
1246: <dd>
1247: <dl>
1248: <dt><span class="sect2"><a href=
1.12 ! agc 1249: "#id2583868">5.4.1. Example of
1.1 grant 1250: cdpack</a></span></dt>
1251: </dl>
1252: </dd>
1253: </dl>
1254: </dd>
1255:
1256: <dt><span class="chapter"><a href="#faq">6. Frequently
1257: Asked Questions</a></span></dt>
1258:
1259: <dd>
1260: <dl>
1.12 ! agc 1261: <dt><span class="sect1"><a href="#id2584196">6.1. Is
1.1 grant 1262: there a mailing list for pkg-related
1263: discussion?</a></span></dt>
1264:
1.12 ! agc 1265: <dt><span class="sect1"><a href="#id2584226">6.2.
1.1 grant 1266: Where's the pkgviews documentation?</a></span></dt>
1267:
1.5 hubertf 1268: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 1269: Utilities for package management
1270: (pkgtools)</a></span></dt>
1271:
1.12 ! agc 1272: <dt><span class="sect1"><a href="#id2584478">6.4. How
1.1 grant 1273: to use pkgsrc as non-root</a></span></dt>
1274:
1.12 ! agc 1275: <dt><span class="sect1"><a href="#id2584490">6.5. How
1.1 grant 1276: can I install/use XFree86 from
1277: pkgsrc?</a></span></dt>
1278:
1.12 ! agc 1279: <dt><span class="sect1"><a href="#id2584586">6.6. How
1.1 grant 1280: can I install/use X.org from pkgsrc?</a></span></dt>
1281:
1.12 ! agc 1282: <dt><span class="sect1"><a href="#id2584614">6.7. How
1.1 grant 1283: to fetch files from behind a firewall</a></span></dt>
1284:
1.12 ! agc 1285: <dt><span class="sect1"><a href="#id2584628">6.8. How
1.7 wiz 1286: do I tell <span><strong class="command">make
1287: fetch</strong></span> to do passive
1.1 grant 1288: FTP?</a></span></dt>
1289:
1.12 ! agc 1290: <dt><span class="sect1"><a href="#id2584747">6.9. How
1.1 grant 1291: to fetch all distfiles at once</a></span></dt>
1292:
1.12 ! agc 1293: <dt><span class="sect1"><a href="#id2584887">6.10.
1.7 wiz 1294: What does “<span class="quote">Don't know how
1295: to make /usr/share/tmac/tmac.andoc</span>”
1296: mean?</a></span></dt>
1.1 grant 1297:
1.12 ! agc 1298: <dt><span class="sect1"><a href="#id2584925">6.11.
1.7 wiz 1299: What does “<span class="quote">Could not find
1300: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1301:
1.12 ! agc 1302: <dt><span class="sect1"><a href="#id2584983">6.12.
1.1 grant 1303: Using 'sudo' with pkgsrc</a></span></dt>
1304:
1305: <dt><span class="sect1"><a href="#faq.conf">6.13.
1306: Configuration files handling and
1307: placement</a></span></dt>
1308:
1309: <dt><span class="sect1"><a href=
1310: "#audit-packages">6.14. Automated security
1311: checks</a></span></dt>
1312: </dl>
1313: </dd>
1314: </dl>
1315: </div>
1316:
1317: <div class="chapter" lang="en" xml:lang="en">
1318: <div class="titlepage">
1319: <div>
1320: <div>
1321: <h2 class="title"><a name="getting" id=
1322: "getting"></a>Chapter 2. Where to get
1323: pkgsrc</h2>
1324: </div>
1325: </div>
1326: </div>
1327:
1328: <div class="toc">
1329: <p><b>Table of Contents</b></p>
1330:
1331: <dl>
1.12 ! agc 1332: <dt><span class="sect1"><a href="#id2514851">2.1. As
1.1 grant 1333: tar file</a></span></dt>
1334:
1.12 ! agc 1335: <dt><span class="sect1"><a href="#id2514867">2.2. Via
1.1 grant 1336: SUP</a></span></dt>
1337:
1.12 ! agc 1338: <dt><span class="sect1"><a href="#id2514967">2.3. Via
1.1 grant 1339: CVS</a></span></dt>
1340: </dl>
1341: </div>
1342:
1343: <p>There are three ways to get pkgsrc. Either as a tar
1344: file, via SUP, or via CVS. All three ways are described
1345: here.</p>
1346:
1347: <div class="sect1" lang="en" xml:lang="en">
1348: <div class="titlepage">
1349: <div>
1350: <div>
1351: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 1352: "id2514851" id="id2514851"></a>2.1. As tar
1.1 grant 1353: file</h2>
1354: </div>
1355: </div>
1356: </div>
1357:
1358: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1359: file from <a href=
1.11 ben 1360: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.7 wiz 1361: target="_top">ftp.NetBSD.org</a> and unpack it into
1362: <code class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1363: </div>
1364:
1365: <div class="sect1" lang="en" xml:lang="en">
1366: <div class="titlepage">
1367: <div>
1368: <div>
1369: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 1370: "id2514867" id="id2514867"></a>2.2. Via
1.1 grant 1371: SUP</h2>
1372: </div>
1373: </div>
1374: </div>
1375:
1376: <p>As an alternative to the tar file, you can get pkgsrc
1377: via the Software Update Protocol, SUP. To do so, make
1378: sure your supfile has a line</p>
1379: <pre class="programlisting">
1380: release=pkgsrc
1381: </pre>
1382:
1.7 wiz 1383: <p>in it, see the examples in <code class=
1384: "filename">/usr/share/examples/supfiles</code>, and that
1385: the <code class="filename">/usr/pkgsrc</code> directory
1386: exists. Then, simply run <span><strong class=
1387: "command">sup -v <em class=
1388: "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1389: </div>
1390:
1391: <div class="sect1" lang="en" xml:lang="en">
1392: <div class="titlepage">
1393: <div>
1394: <div>
1395: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 1396: "id2514967" id="id2514967"></a>2.3. Via
1.1 grant 1397: CVS</h2>
1398: </div>
1399: </div>
1400: </div>
1401:
1402: <p>To get pkgsrc via CVS, make sure you have
1403: “<span class="quote">cvs</span>” installed.
1404: If not present on your system, it can be found as
1405: precompiled binary on ftp.NetBSD.org. To do an initial
1406: (full) checkout of pkgsrc, do the following steps:</p>
1407: <pre class="screen">
1.7 wiz 1408: <code class="prompt">%</code> <strong class=
1409: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1410: <code class="prompt">%</code> <strong class=
1411: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1412: <code class="prompt">%</code> <strong class=
1413: "userinput"><code>cd /usr</code></strong>
1414: <code class="prompt">%</code> <strong class=
1415: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1416: </pre>
1417:
1418: <p>This will create the <code class=
1419: "filename">pkgsrc</code> directory in your <code class=
1420: "filename">/usr</code>, and all the package source will
1421: be stored under <code class=
1422: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1423: initial checkout, make sure you have <code class=
1424: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1425: <pre class="screen">
1.7 wiz 1426: <code class="prompt">%</code> <strong class=
1427: "userinput"><code>cd /usr/pkgsrc</code></strong>
1428: <code class="prompt">%</code> <strong class=
1429: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1430: </pre>
1431:
1432: <p>Please also note that it is possible to have multiple
1433: copies of the pkgsrc hierarchy in use at any one time -
1434: all work is done relatively within the pkgsrc tree.</p>
1435: </div>
1436: </div>
1437:
1438: <div class="chapter" lang="en" xml:lang="en">
1439: <div class="titlepage">
1440: <div>
1441: <div>
1442: <h2 class="title"><a name="platforms" id=
1443: "platforms"></a>Chapter 3. Using pkgsrc on
1444: systems other than NetBSD</h2>
1445: </div>
1446: </div>
1447: </div>
1448:
1449: <div class="toc">
1450: <p><b>Table of Contents</b></p>
1451:
1452: <dl>
1.12 ! agc 1453: <dt><span class="sect1"><a href="#id2515077">3.1.
1.1 grant 1454: Bootstrapping pkgsrc</a></span></dt>
1455:
1.12 ! agc 1456: <dt><span class="sect1"><a href="#id2515252">3.2.
1.1 grant 1457: Platform specific notes</a></span></dt>
1458:
1459: <dd>
1460: <dl>
1.12 ! agc 1461: <dt><span class="sect2"><a href="#id2515258">3.2.1.
1.1 grant 1462: Darwin (Mac OS X)</a></span></dt>
1463:
1.12 ! agc 1464: <dt><span class="sect2"><a href="#id2515489">3.2.2.
1.1 grant 1465: FreeBSD</a></span></dt>
1466:
1.12 ! agc 1467: <dt><span class="sect2"><a href="#id2515659">3.2.3.
1.1 grant 1468: Interix</a></span></dt>
1469:
1.12 ! agc 1470: <dt><span class="sect2"><a href="#id2515750">3.2.4.
1.1 grant 1471: IRIX</a></span></dt>
1472:
1.12 ! agc 1473: <dt><span class="sect2"><a href="#id2516277">3.2.5.
1.1 grant 1474: OpenBSD</a></span></dt>
1475:
1.12 ! agc 1476: <dt><span class="sect2"><a href="#id2516389">3.2.6.
1.1 grant 1477: Solaris</a></span></dt>
1478: </dl>
1479: </dd>
1480: </dl>
1481: </div>
1482:
1483: <div class="sect1" lang="en" xml:lang="en">
1484: <div class="titlepage">
1485: <div>
1486: <div>
1487: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 1488: "id2515077" id=
! 1489: "id2515077"></a>3.1. Bootstrapping pkgsrc</h2>
1.1 grant 1490: </div>
1491: </div>
1492: </div>
1493:
1494: <p>For Operating Systems other than NetBSD, we provide a
1495: bootstrap kit to build the required tools to use pkgsrc
1496: on your platform. Besides support for native NetBSD,
1497: pkgsrc and the bootstrap kit have support for the
1498: following operating systems:</p>
1499:
1500: <div class="itemizedlist">
1501: <ul type="disc">
1502: <li>
1503: <p>Darwin (Mac OS X)</p>
1504: </li>
1505:
1506: <li>
1507: <p>FreeBSD</p>
1508: </li>
1509:
1510: <li>
1511: <p>Interix (Windows 2000, XP, 2003)</p>
1512: </li>
1513:
1514: <li>
1515: <p>IRIX</p>
1516: </li>
1517:
1518: <li>
1519: <p>Linux</p>
1520: </li>
1521:
1522: <li>
1523: <p>OpenBSD</p>
1524: </li>
1525:
1526: <li>
1527: <p>Solaris</p>
1528: </li>
1529: </ul>
1530: </div>
1531:
1532: <p>Support for other platforms is under development.</p>
1533:
1534: <p>Installing the bootstrap kit should be as simple
1535: as:</p>
1536: <pre class="screen">
1.7 wiz 1537: <code class="prompt">#</code> <strong class=
1538: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1539: <code class="prompt">#</code> <strong class=
1540: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1541: <code class="prompt">#</code> <strong class=
1542: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1543: </pre>
1544:
1545: <p>See <a href="#getting" title=
1546: "Chapter 2. Where to get pkgsrc">Chapter 2,
1547: <i>Where to get pkgsrc</i></a> for other ways to get
1.7 wiz 1548: pkgsrc before bootstrapping. The given
1549: <span><strong class="command">bootstrap</strong></span>
1550: command will use the defaults of <code class=
1551: "filename">/usr/pkg</code> for the <span class=
1552: "emphasis"><em>prefix</em></span> where programs will be
1553: installed in, and <code class=
1554: "filename">/var/db/pkg</code> for the package database
1.1 grant 1555: directory where pkgsrc will do it's internal bookkeeping.
1556: However, these can also be set using command-line
1557: parameters.</p>
1558:
1559: <p>Binary packages for the pkgsrc tools and an initial
1560: set of packages is available for supported platforms. An
1561: up-to-date list of these can be found on <a href=
1562: "http://www.pkgsrc.org/" target=
1563: "_top">www.pkgsrc.org</a>.</p>
1564: </div>
1565:
1566: <div class="sect1" lang="en" xml:lang="en">
1567: <div class="titlepage">
1568: <div>
1569: <div>
1570: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 1571: "id2515252" id="id2515252"></a>3.2. Platform
1.1 grant 1572: specific notes</h2>
1573: </div>
1574: </div>
1575: </div>
1576:
1577: <p>Here are some platform-specific notes you should be
1578: aware of.</p>
1579:
1580: <div class="sect2" lang="en" xml:lang="en">
1581: <div class="titlepage">
1582: <div>
1583: <div>
1.12 ! agc 1584: <h3 class="title"><a name="id2515258" id=
! 1585: "id2515258"></a>3.2.1. Darwin (Mac OS
1.1 grant 1586: X)</h3>
1587: </div>
1588: </div>
1589: </div>
1590:
1591: <p>Darwin 5.x and 6.x are supported. There are two
1592: methods of using pkgsrc on Mac OS X, by using a
1593: <a href="#platform.osx-image" title=
1594: "3.2.1.1. Using a disk image">disk image</a>, or a
1595: <a href="#platform.osx-ufs" title=
1596: "3.2.1.2. Using a UFS partition">UFS
1597: partition</a>.</p>
1598:
1599: <p>Before you start, you will need to download and
1600: install the Mac OS X Developer Tools from Apple's
1601: Developer Connection. See <a href=
1602: "http://developer.apple.com/macosx/" target=
1603: "_top">http://developer.apple.com/macosx/</a> for
1604: details. Also, make sure you install X11 for Mac OS X
1605: and the X11 SDK from <a href=
1606: "http://www.apple.com/macosx/x11/download/" target=
1607: "_top">http://www.apple.com/macosx/x11/download/</a> if
1608: you intend to build packages that use the X11 Window
1609: System.</p>
1610:
1611: <p>If you already have a UFS partition, or have a spare
1612: partition that you can format as UFS, it is recommended
1613: to use that instead of the disk image. It'll be
1614: somewhat faster and will mount automatically at boot
1615: time, where you must manually mount a disk image.</p>
1616:
1617: <div class="note" style=
1618: "margin-left: 0.5in; margin-right: 0.5in;">
1619: <h3 class="title">Note</h3>
1620:
1621: <p>You cannot use a HFS+ file system for pkgsrc,
1622: because pkgsrc currently requires the filesystem to
1623: be case-sensitive, and HFS+ is not.</p>
1624: </div>
1625:
1626: <div class="sect3" lang="en" xml:lang="en">
1627: <div class="titlepage">
1628: <div>
1629: <div>
1630: <h4 class="title"><a name="platform.osx-image"
1631: id="platform.osx-image"></a>3.2.1.1. Using
1632: a disk image</h4>
1633: </div>
1634: </div>
1635: </div>
1636:
1637: <p>Create the disk image:</p>
1638: <pre class="screen">
1.7 wiz 1639: <code class="prompt">#</code> <strong class=
1640: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1641: <code class="prompt">#</code> <strong class=
1642: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
1643: <code class="prompt">#</code> <strong class=
1644: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
1645: <code class="prompt">#</code> <strong class=
1646: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 1647: </pre>
1648:
1649: <p>That's it!</p>
1650: </div>
1651:
1652: <div class="sect3" lang="en" xml:lang="en">
1653: <div class="titlepage">
1654: <div>
1655: <div>
1656: <h4 class="title"><a name="platform.osx-ufs"
1657: id="platform.osx-ufs"></a>3.2.1.2. Using a
1658: UFS partition</h4>
1659: </div>
1660: </div>
1661: </div>
1662:
1.7 wiz 1663: <p>By default, <code class="filename">/usr</code>
1664: will be on your root file system, normally HFS+. It
1665: is possible to use the default <span class=
1666: "emphasis"><em>prefix</em></span> of <code class=
1667: "filename">/usr/pkg</code> by symlinking <code class=
1668: "filename">/usr/pkg</code> to a directory on a UFS
1669: file system. Obviously, another symlink is required
1670: if you want to place the package database directory
1671: outside the <span class=
1672: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 1673: <pre class="screen">
1.7 wiz 1674: <code class="prompt">#</code> <strong class=
1675: "userinput"><code>./bootstrap --pkgdbdir=/usr/pkg/pkgdb --pkgsrcdir=/Volumes/ufs/pkgsrc</code></strong>
1.1 grant 1676: </pre>
1677:
1678: <p>If you created your partitions at the time of
1679: installing Mac OS X and formatted the target
1680: partition as UFS, it should automatically mount on
1.7 wiz 1681: <code class="filename">/Volumes/<volume
1682: name></code> when the machine boots. If you are
1.1 grant 1683: (re)formatting a partition as UFS, you need to ensure
1684: that the partition map correctly reflects
1685: “<span class="quote">Apple_UFS</span>”
1686: and not “<span class=
1687: "quote">Apple_HFS</span>”.</p>
1688:
1689: <p>The problem is that none of the disk tools will
1690: let you touch a disk that is booted from. You can
1691: unmount the partition, but even if you newfs it, the
1692: partition type will be incorrect and the automounter
1693: won't mount it. It can be mounted manually, but it
1694: won't appear in Finder.</p>
1695:
1696: <p>You'll need to boot off of the OS X Installation
1697: (User) CD. When the Installation program starts, go
1698: up to the menu and select Disk Utility. Now, you will
1699: be able to select the partition you want to be UFS,
1700: and Format it Apple UFS. Quit the Disk Utility, quit
1701: the installer which will reboot your machine. The new
1702: UFS file system will appear in Finder.</p>
1703:
1704: <p>Be aware that the permissions on the new file
1705: system will be writable by root only.</p>
1706:
1707: <p>This note is as of 10.2 (Jaguar) and applies to
1708: earlier versions. Hopefully Apple will fix Disk
1709: Utility in 10.3 (Panther).</p>
1710: </div>
1711: </div>
1712:
1713: <div class="sect2" lang="en" xml:lang="en">
1714: <div class="titlepage">
1715: <div>
1716: <div>
1.12 ! agc 1717: <h3 class="title"><a name="id2515489" id=
! 1718: "id2515489"></a>3.2.2. FreeBSD</h3>
1.1 grant 1719: </div>
1720: </div>
1721: </div>
1722:
1723: <p>FreeBSD 4.7 and 5.0 have been tested and are
1724: supported, other versions may work.</p>
1725:
1726: <p>Care should be taken so that the tools that this kit
1727: installs do not conflict with the FreeBSD userland
1728: tools. There are several steps:</p>
1729:
1730: <div class="orderedlist">
1731: <ol type="1">
1732: <li>
1733: <p>FreeBSD stores its ports pkg database in
1.7 wiz 1734: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 1735: therefore recommended that you choose a different
1.7 wiz 1736: location (e.g. <code class=
1737: "filename">/usr/pkgdb</code>) by using the
1.1 grant 1738: --pkgdbdir option to the bootstrap script.</p>
1739: </li>
1740:
1741: <li>
1742: <p>If you do not intend to use the FreeBSD ports
1743: tools, it's probably a good idea to move them out
1744: of the way to avoid confusion, e.g.</p>
1745: <pre class="screen">
1.7 wiz 1746: <code class="prompt">#</code> <strong class=
1747: "userinput"><code>cd /usr/sbin</code></strong>
1748: <code class="prompt">#</code> <strong class=
1749: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
1750: <code class="prompt">#</code> <strong class=
1751: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
1752: <code class="prompt">#</code> <strong class=
1753: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
1754: <code class="prompt">#</code> <strong class=
1755: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 1756: </pre>
1757: </li>
1758:
1759: <li>
1.7 wiz 1760: <p>An example <code class=
1761: "filename">/etc/mk.conf</code> file will be
1762: placed in <code class=
1763: "filename">/etc/mk.conf.example</code> file when
1764: you use the bootstrap script.</p>
1.1 grant 1765: </li>
1766: </ol>
1767: </div>
1768: </div>
1769:
1770: <div class="sect2" lang="en" xml:lang="en">
1771: <div class="titlepage">
1772: <div>
1773: <div>
1.12 ! agc 1774: <h3 class="title"><a name="id2515659" id=
! 1775: "id2515659"></a>3.2.3. Interix</h3>
1.1 grant 1776: </div>
1777: </div>
1778: </div>
1779:
1780: <p>Interix is a POSIX compatible subsystem for the
1781: Windows NT kernel, providing a Unix-like environment
1782: with a tighter kernel integration than available with
1783: Cygwin. It is part of the Windows Services for Unix
1784: package, available for free for any licensed copy of
1785: Windows 2000, XP, or 2003. SFU can be downloaded from
1786: <a href="http://www.microsoft.com/windows/sfu/" target=
1787: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
1788:
1789: <p>Services for Unix 3.5, current as of this writing,
1790: has been tested. 3.0 or 3.1 may work, but are not
1791: officially supported. (The main difference in 3.0/3.1
1792: is lack of pthreads.)</p>
1793:
1794: <div class="sect3" lang="en" xml:lang="en">
1795: <div class="titlepage">
1796: <div>
1797: <div>
1798: <h4 class="title"><a name=
1799: "platform.interix-sfu-install" id=
1800: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 1801: installing Interix/SFU</h4>
1.1 grant 1802: </div>
1803: </div>
1804: </div>
1805:
1806: <p>At an absolute minimum, the following packages
1807: must be installed from the Windows Services for Unix
1808: 3.5 distribution in order to use pkgsrc:</p>
1809:
1810: <div class="itemizedlist">
1811: <ul type="disc">
1812: <li>
1813: <p>Utilities -> Base Utilities</p>
1814: </li>
1815:
1816: <li>
1817: <p>Interix GNU Components -> (all)</p>
1818: </li>
1819:
1820: <li>
1821: <p>Remote Connectivity</p>
1822: </li>
1823:
1824: <li>
1825: <p>Interix SDK</p>
1826: </li>
1827: </ul>
1828: </div>
1829:
1830: <p>When using pkgsrc on Interix, DO NOT install the
1831: Utilities subcomponent "UNIX Perl". That is Perl 5.6
1832: without shared module support, installed to
1833: /usr/local, and will only cause confusion. Instead,
1834: install Perl 5.8 from pkgsrc (or from a binary
1835: package).</p>
1836:
1837: <p>The Remote Connectivity subcomponent "Windows
1838: Remote Shell Service" does not need to be installed,
1839: but Remote Connectivity itself should be installed in
1840: order to have a working inetd.</p>
1841:
1842: <p>Finally, during installation you may be asked
1843: whether to enable setuid behavior for Interix
1844: programs, and whether to make pathnames default to
1845: case-sensitive. Setuid should be enabled, and
1846: case-sensitivity MUST be enabled. (Without
1847: case-sensitivity, a large number of packages
1848: including perl will not build.)</p>
1849: </div>
1850:
1851: <div class="sect3" lang="en" xml:lang="en">
1852: <div class="titlepage">
1853: <div>
1854: <div>
1855: <h4 class="title"><a name=
1856: "platform.interix-sfu-postinstall" id=
1857: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
1858: to do if Interix/SFU is already installed</h4>
1859: </div>
1860: </div>
1861: </div>
1862:
1863: <p>If SFU is already installed and you wish to alter
1864: these settings to work with pkgsrc, note the
1865: following things.</p>
1866:
1867: <div class="itemizedlist">
1868: <ul type="disc">
1869: <li>
1870: <p>To uninstall UNIX Perl, use Add/Remove
1871: Programs, select Microsoft Windows Services for
1872: UNIX, then click Change. In the installer,
1873: choose Add or Remove, then uncheck
1874: Utilities->UNIX Perl.</p>
1875: </li>
1876:
1877: <li>
1878: <p>To enable case-sensitivity for the
1879: filesystem, run REGEDIT.EXE, and change the
1880: following registry key:</p>
1881:
1882: <p>
1883: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
1884: Manager\kernel</p>
1885:
1886: <p>Set the DWORD value "obcaseinsensitive" to
1887: 0; then reboot.</p>
1888: </li>
1889:
1890: <li>
1891: <p>To enable setuid binaries (optional), run
1892: REGEDIT.EXE, and change the following registry
1893: key:</p>
1894:
1895: <p>
1896: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
1897: for UNIX</p>
1898:
1899: <p>Set the DWORD value "EnableSetuidBinaries"
1900: to 1; then reboot.</p>
1901: </li>
1902: </ul>
1903: </div>
1904: </div>
1905:
1906: <div class="sect3" lang="en" xml:lang="en">
1907: <div class="titlepage">
1908: <div>
1909: <div>
1910: <h4 class="title"><a name=
1911: "platform.interix-notes" id=
1912: "platform.interix-notes"></a>3.2.3.3. Important
1913: notes for using pkgsrc</h4>
1914: </div>
1915: </div>
1916: </div>
1917:
1918: <p>The package imanager (either the pkgsrc "su" user,
1919: or the user running "pkg_add") must be a member of
1920: the local Administrators group. Such a user must also
1921: be used to run the bootstrap. This is slightly
1922: relaxed from the normal pkgsrc requirement of
1923: "root".</p>
1924:
1925: <p>The package manager should use a umask of 002.
1926: "make install" will automatically complain if this is
1927: not the case. This ensures that directories written
1928: in /var/db/pkg are Administrators-group
1929: writeable.</p>
1930:
1931: <p>The popular Interix binary packages from
1932: http://www.interopsystems.com/ use an older version
1933: of pkgsrc's pkg_* tools. Ideally, these should NOT be
1934: used in conjunction with pkgsrc. If you choose to use
1935: them at the same time as the pkgsrc packages, ensure
1936: that you use the proper pkg_* tools for each type of
1937: binary package.</p>
1938: </div>
1939: </div>
1940:
1941: <div class="sect2" lang="en" xml:lang="en">
1942: <div class="titlepage">
1943: <div>
1944: <div>
1.12 ! agc 1945: <h3 class="title"><a name="id2515750" id=
! 1946: "id2515750"></a>3.2.4. IRIX</h3>
1.1 grant 1947: </div>
1948: </div>
1949: </div>
1950:
1951: <p>You will need a working C compiler, either gcc or
1952: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.7 wiz 1953: the <code class="varname">CC</code> environment
1954: variable according to your preference. If you do not
1955: have a license for the MIPSpro compiler suite, you can
1.1 grant 1956: download a gcc tardist file from <a href=
1957: "http://freeware.sgi.com/" target=
1958: "_top">http://freeware.sgi.com/</a>.</p>
1959:
1960: <p>Please note that you will need IRIX 6.5.17 or
1961: higher, as this is the earliest version of IRIX
1962: providing support for if_indextoname(3),
1963: if_nametoindex(3), etc.</p>
1964:
1965: <p>At this point in time, pkgsrc only supports one ABI.
1966: That is, you can not switch between the old 32-bit ABI,
1967: the new 32-bit ABI and the 64-bit ABI. If you start out
1968: using "abi=n32", that's what all your packages will be
1969: built with.</p>
1970:
1971: <p>Therefore, please make sure that you have no
1.7 wiz 1972: conflicting <code class="varname">CFLAGS</code> in your
1973: environment or the <code class=
1974: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 1975: that you do not try to link n32 object files with lib64
1.7 wiz 1976: or vice versa. Check your <code class=
1977: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 1978:
1979: <p>If you have the actual pkgsrc tree mounted via NFS
1980: from a different host, please make sure to set
1.7 wiz 1981: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 1982: directory, as it appears that IRIX linker occasionally
1983: runs into issues when trying to link over a network
1984: mounted filesystem.</p>
1985:
1986: <p>The bootstrapping process should set all the right
1987: options for programs such as imake(1), but you may want
1988: to set some options depending on your local setup.
1.7 wiz 1989: Please see <code class=
1.11 ben 1990: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.1 grant 1991: course, your compilers man pages for details.</p>
1992: </div>
1993:
1994: <div class="sect2" lang="en" xml:lang="en">
1995: <div class="titlepage">
1996: <div>
1997: <div>
1.12 ! agc 1998: <h3 class="title"><a name="id2516277" id=
! 1999: "id2516277"></a>3.2.5. OpenBSD</h3>
1.1 grant 2000: </div>
2001: </div>
2002: </div>
2003:
2004: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2005:
2006: <p>Care should be taken so that the tools that this kit
2007: installs do not conflict with the OpenBSD userland
2008: tools. There are several steps:</p>
2009:
2010: <div class="orderedlist">
2011: <ol type="1">
2012: <li>
2013: <p>OpenBSD stores its ports pkg database in
1.7 wiz 2014: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 2015: therefore recommended that you choose a different
1.7 wiz 2016: location (e.g. <code class=
2017: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2018: --pkgdbdir option to the bootstrap script.</p>
2019: </li>
2020:
2021: <li>
2022: <p>If you do not intend to use the OpenBSD ports
2023: tools, it's probably a good idea to move them out
2024: of the way to avoid confusion, e.g.</p>
2025: <pre class="screen">
1.7 wiz 2026: <code class="prompt">#</code> <strong class=
2027: "userinput"><code>cd /usr/sbin</code></strong>
2028: <code class="prompt">#</code> <strong class=
2029: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2030: <code class="prompt">#</code> <strong class=
2031: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2032: <code class="prompt">#</code> <strong class=
2033: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2034: <code class="prompt">#</code> <strong class=
2035: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2036: </pre>
2037: </li>
2038:
2039: <li>
1.7 wiz 2040: <p>An example <code class=
2041: "filename">/etc/mk.conf</code> file will be
2042: placed in <code class=
2043: "filename">/etc/mk.conf.example</code> file when
2044: you use the bootstrap script. OpenBSD's make
2045: program uses <code class=
2046: "filename">/etc/mk.conf</code> as well. You can
1.1 grant 2047: work around this by enclosing all the pkgsrc
2048: specific parts of the file with:</p>
2049: <pre class="programlisting">
2050: .ifdef BSD_PKG_MK
1.11 ben 2051: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1 grant 2052: .else
2053: # OpenBSD stuff
2054: .endif
2055: </pre>
2056: </li>
2057: </ol>
2058: </div>
2059: </div>
2060:
2061: <div class="sect2" lang="en" xml:lang="en">
2062: <div class="titlepage">
2063: <div>
2064: <div>
1.12 ! agc 2065: <h3 class="title"><a name="id2516389" id=
! 2066: "id2516389"></a>3.2.6. Solaris</h3>
1.1 grant 2067: </div>
2068: </div>
2069: </div>
2070:
2071: <p>Solaris 2.6 through 9 are supported on both x86 and
2072: sparc. You will need a working C compiler. Both gcc
2073: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2074:
2075: <p>The following packages are required on Solaris 8 for
2076: the bootstrap process and to build packages.</p>
2077:
2078: <div class="itemizedlist">
2079: <ul type="disc">
2080: <li>
2081: <p>SUNWsprot</p>
2082: </li>
2083:
2084: <li>
2085: <p>SUNWarc</p>
2086: </li>
2087:
2088: <li>
2089: <p>SUNWbtool</p>
2090: </li>
2091:
2092: <li>
2093: <p>SUNWtoo</p>
2094: </li>
2095:
2096: <li>
2097: <p>SUNWlibm</p>
2098: </li>
2099: </ul>
2100: </div>
2101:
2102: <p>Please note the use of GNU binutils on Solaris is
2103: <span class="emphasis"><em>not</em></span>
2104: supported.</p>
2105:
2106: <div class="sect3" lang="en" xml:lang="en">
2107: <div class="titlepage">
2108: <div>
2109: <div>
1.12 ! agc 2110: <h4 class="title"><a name="id2516420" id=
! 2111: "id2516420"></a>3.2.6.1. If you are using
1.1 grant 2112: gcc</h4>
2113: </div>
2114: </div>
2115: </div>
2116:
2117: <p>It makes life much simpler if you only use the
2118: same gcc consistently for building all packages.</p>
2119:
2120: <p>It is recommended that an external gcc be used
2121: only for bootstrapping, then either build gcc from
2122: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2123: href=
2124: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.7 wiz 2125: class="pkgname">lang/gcc</a> or install a binary gcc
2126: package, then remove gcc used during
2127: bootstrapping.</p>
1.1 grant 2128:
2129: <p>Binary packages of gcc can be found through
2130: <a href=
2131: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.7 wiz 2132: target=
2133: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2134: </div>
2135:
2136: <div class="sect3" lang="en" xml:lang="en">
2137: <div class="titlepage">
2138: <div>
2139: <div>
1.12 ! agc 2140: <h4 class="title"><a name="id2516441" id=
! 2141: "id2516441"></a>3.2.6.2. If you are using
1.1 grant 2142: Sun WorkShop</h4>
2143: </div>
2144: </div>
2145: </div>
2146:
2147: <p>You will need at least the following packages
2148: installed (from WorkShop 5.0)</p>
2149:
2150: <div class="itemizedlist">
2151: <ul type="disc">
2152: <li>
2153: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2154: </li>
2155:
2156: <li>
2157: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2158: </li>
2159:
2160: <li>
2161: <p>SPROild - Sun WorkShop Incremental
2162: Linker</p>
2163: </li>
2164:
2165: <li>
2166: <p>SPROlang - Sun WorkShop Compilers common
2167: components</p>
2168: </li>
2169: </ul>
2170: </div>
2171:
1.7 wiz 2172: <p>You should set <code class="varname">CC</code>,
2173: <code class="varname">CXX</code> and optionally,
2174: <code class="varname">CPP</code> in <code class=
2175: "filename">/etc/mk.conf</code>, eg.</p>
1.1 grant 2176: <pre class="programlisting">
2177: CC= cc
2178: CXX= CC
2179: CPP= /usr/ccs/lib/cpp
2180: </pre>
2181:
2182: <p>You may also want to build 64-bit binaries,
2183: eg.</p>
2184: <pre class="programlisting">
2185: CFLAGS= -xtarget=ultra -xarch=v9
2186: </pre>
2187:
2188: <p>Whichever compiler you use, please ensure the
2189: compiler tools and your $prefix are in your
1.7 wiz 2190: <code class="varname">PATH</code>. This includes
2191: <code class="filename">/usr/ccs/{bin,lib}</code> and
2192: eg. <code class=
2193: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2194: </div>
2195: </div>
2196: </div>
2197: </div>
2198:
2199: <div class="chapter" lang="en" xml:lang="en">
2200: <div class="titlepage">
2201: <div>
2202: <div>
2203: <h2 class="title"><a name="using" id=
2204: "using"></a>Chapter 4. Using pkgsrc</h2>
2205: </div>
2206: </div>
2207: </div>
2208:
2209: <div class="toc">
2210: <p><b>Table of Contents</b></p>
2211:
2212: <dl>
2213: <dt><span class="sect1"><a href="#getting-started">4.1.
2214: Working with binary packages</a></span></dt>
2215:
2216: <dd>
2217: <dl>
1.12 ! agc 2218: <dt><span class="sect2"><a href="#id2516525">4.1.1.
1.1 grant 2219: Where to get binary packages</a></span></dt>
2220:
1.12 ! agc 2221: <dt><span class="sect2"><a href="#id2516566">4.1.2.
1.1 grant 2222: How to use binary packages</a></span></dt>
2223:
1.12 ! agc 2224: <dt><span class="sect2"><a href="#id2516700">4.1.3.
1.1 grant 2225: A word of warning</a></span></dt>
2226: </dl>
2227: </dd>
2228:
1.12 ! agc 2229: <dt><span class="sect1"><a href="#id2516712">4.2.
1.1 grant 2230: Building packages from source</a></span></dt>
2231:
2232: <dd>
2233: <dl>
1.12 ! agc 2234: <dt><span class="sect2"><a href="#id2516722">4.2.1.
1.1 grant 2235: Requirements</a></span></dt>
2236:
1.12 ! agc 2237: <dt><span class="sect2"><a href="#id2516742">4.2.2.
1.1 grant 2238: Fetching distfiles</a></span></dt>
2239:
1.12 ! agc 2240: <dt><span class="sect2"><a href="#id2516862">4.2.3.
1.1 grant 2241: How to build and install</a></span></dt>
2242:
1.12 ! agc 2243: <dt><span class="sect2"><a href="#id2517179">4.2.4.
1.1 grant 2244: Selecting the compiler</a></span></dt>
2245: </dl>
2246: </dd>
2247: </dl>
2248: </div>
2249:
2250: <div class="sect1" lang="en" xml:lang="en">
2251: <div class="titlepage">
2252: <div>
2253: <div>
2254: <h2 class="title" style="clear: both"><a name=
2255: "getting-started" id=
2256: "getting-started"></a>4.1. Working with binary
2257: packages</h2>
2258: </div>
2259: </div>
2260: </div>
2261:
2262: <p>This section describes how to find, retrieve and
2263: install a precompiled binary package that someone else
2264: already prepared for your type of machine.</p>
2265:
2266: <div class="sect2" lang="en" xml:lang="en">
2267: <div class="titlepage">
2268: <div>
2269: <div>
1.12 ! agc 2270: <h3 class="title"><a name="id2516525" id=
! 2271: "id2516525"></a>4.1.1. Where to get binary
1.1 grant 2272: packages</h3>
2273: </div>
2274: </div>
2275: </div>
2276:
2277: <p>Precompiled packages are stored on ftp.NetBSD.org
1.7 wiz 2278: and its mirrors in the directory <code class=
2279: "filename">/pub/NetBSD/packages</code> for anonymous
2280: FTP access. Please pick the right subdirectory there as
2281: indicated by <span><strong class="command">uname
2282: -p</strong></span>. In that directory, there is a
1.1 grant 2283: subdirectory for each category plus a subdirectory
1.7 wiz 2284: <code class="filename">All</code> which includes the
2285: actual binaries in <code class="filename">.tgz</code>
2286: files. The category subdirectories use symbolic links
2287: to those files (this is the same directory layout as in
2288: <code class=
2289: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2290:
2291: <p>This same directory layout applies for CDROM
2292: distributions, only that the directory may be rooted
1.7 wiz 2293: somewhere else, probably somewhere below <code class=
2294: "filename">/cdrom</code>. Please consult your CDROMs
1.1 grant 2295: documentation for the exact location.</p>
2296: </div>
2297:
2298: <div class="sect2" lang="en" xml:lang="en">
2299: <div class="titlepage">
2300: <div>
2301: <div>
1.12 ! agc 2302: <h3 class="title"><a name="id2516566" id=
! 2303: "id2516566"></a>4.1.2. How to use binary
1.1 grant 2304: packages</h3>
2305: </div>
2306: </div>
2307: </div>
2308:
2309: <p>If you have the files on a CDROM or downloaded them
2310: to your hard disk, youcan install them with the
1.7 wiz 2311: following command (be sure to<span><strong class=
2312: "command">su</strong></span> to root first):</p>
1.1 grant 2313: <pre class="screen">
1.7 wiz 2314: <code class="prompt">#</code> <strong class=
2315: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 2316: </pre>
2317:
2318: <p>If you have FTP access and you don't want to
2319: download the packages via FTP prior to installation,
1.7 wiz 2320: you can do this automatically by giving
2321: <span><strong class="command">pkg_add</strong></span>
2322: an FTP URL:</p>
1.1 grant 2323: <pre class="screen">
1.7 wiz 2324: <code class="prompt">#</code> <strong class=
2325: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSvers>/<arch>/All/package.tgz</code></strong>
1.1 grant 2326: </pre>
2327:
2328: <p>If there is any doubt, the uname utility can be used
2329: to determine the <OSvers>, and <arch> by
1.7 wiz 2330: running <span><strong class="command">uname
2331: -rp</strong></span>.</p>
1.1 grant 2332:
2333: <p>Also note that any prerequisite packages needed to
2334: run the package in question will be installed, too,
2335: assuming they are present where you install from.</p>
2336:
2337: <p>After you've installed packages, be sure to have
1.7 wiz 2338: <code class="filename">/usr/pkg/bin</code> in your
2339: <code class="varname">PATH</code> so you can actually
2340: start the just installed program.</p>
1.1 grant 2341: </div>
2342:
2343: <div class="sect2" lang="en" xml:lang="en">
2344: <div class="titlepage">
2345: <div>
2346: <div>
1.12 ! agc 2347: <h3 class="title"><a name="id2516700" id=
! 2348: "id2516700"></a>4.1.3. A word of
1.1 grant 2349: warning</h3>
2350: </div>
2351: </div>
2352: </div>
2353:
2354: <p>Please pay very careful attention to the warnings
2355: expressed in the <a href=
2356: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2357: <span class="citerefentry"><span class=
2358: "refentrytitle">pkg_add</span>(1)</span></a> manual
2359: page about the inherent dangers of installing binary
2360: packages which you did not create yourself, and the
2361: security holes that can be introduced onto your system
2362: by indiscriminate adding of such files.</p>
2363: </div>
2364: </div>
2365:
2366: <div class="sect1" lang="en" xml:lang="en">
2367: <div class="titlepage">
2368: <div>
2369: <div>
2370: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 2371: "id2516712" id="id2516712"></a>4.2. Building
1.1 grant 2372: packages from source</h2>
2373: </div>
2374: </div>
2375: </div>
2376:
2377: <p>This assumes that the package is already in pkgsrc. If
2378: it is not, see <a href="#developers-guide" title=
1.2 hubertf 2379: "Part II. The pkgsrc developer's guide">Part II,
2380: “The pkgsrc developer's guide”</a>.</p>
1.1 grant 2381:
2382: <div class="sect2" lang="en" xml:lang="en">
2383: <div class="titlepage">
2384: <div>
2385: <div>
1.12 ! agc 2386: <h3 class="title"><a name="id2516722" id=
! 2387: "id2516722"></a>4.2.1. Requirements</h3>
1.1 grant 2388: </div>
2389: </div>
2390: </div>
2391:
2392: <p>To build packages from source on a NetBSD system the
2393: “<span class="quote">comp</span>” and the
2394: “<span class="quote">text</span>”
2395: distribution sets must be installed. If you want to
2396: build X11 related packages the “<span class=
2397: "quote">xbase</span>” and “<span class=
2398: "quote">xcomp</span>” distribution sets are
2399: required, too.</p>
2400: </div>
2401:
2402: <div class="sect2" lang="en" xml:lang="en">
2403: <div class="titlepage">
2404: <div>
2405: <div>
1.12 ! agc 2406: <h3 class="title"><a name="id2516742" id=
! 2407: "id2516742"></a>4.2.2. Fetching
1.1 grant 2408: distfiles</h3>
2409: </div>
2410: </div>
2411: </div>
2412:
2413: <p>The distfile (i.e. the unmodified source) must exist
2414: on your system for the packages system to be able to
2415: build it. If it does not exist, pkgsrc will use
2416: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
2417: <span class="citerefentry"><span class=
2418: "refentrytitle">ftp</span>(1)</span></a> to fetch it
2419: automatically.</p>
2420:
2421: <p>You can overwrite some of the major distribution
2422: sites to fit to sites that are close to your own. Have
1.7 wiz 2423: a look at <code class=
1.11 ben 2424: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.7 wiz 2425: some examples - in particular, look for the
2426: <code class="varname">MASTER_SORT</code>, <code class=
2427: "varname">MASTER_SORT_REGEX</code> and <code class=
2428: "varname">INET_COUNTRY</code> definitions. This may
2429: save some of your bandwidth and time.</p>
1.1 grant 2430:
2431: <p>You can change these settings either in your shell's
2432: environment, or, if you want to keep the settings, by
1.7 wiz 2433: editing the <code class="filename">/etc/mk.conf</code>
1.1 grant 2434: file, and adding the definitions there.</p>
2435:
2436: <p>If you don't have a permanent Internet connection
2437: and you want to know which files to download,
1.7 wiz 2438: <span><strong class="command">make
2439: fetch-list</strong></span> will tell you what you'll
2440: need. Put these distfiles into <code class=
2441: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 2442: </div>
2443:
2444: <div class="sect2" lang="en" xml:lang="en">
2445: <div class="titlepage">
2446: <div>
2447: <div>
1.12 ! agc 2448: <h3 class="title"><a name="id2516862" id=
! 2449: "id2516862"></a>4.2.3. How to build and
1.1 grant 2450: install</h3>
2451: </div>
2452: </div>
2453: </div>
2454:
2455: <p>Assuming that the distfile has been fetched (see
2456: previous section), become root and change into the
1.7 wiz 2457: relevant directory and running <span><strong class=
2458: "command">make</strong></span>. For example, type</p>
1.1 grant 2459: <pre class="screen">
1.7 wiz 2460: <code class="prompt">%</code> <strong class=
2461: "userinput"><code>cd misc/figlet</code></strong>
2462: <code class="prompt">%</code> <strong class=
2463: "userinput"><code>make</code></strong>
1.1 grant 2464: </pre>
2465:
2466: <p>at the shell prompt to build the various components
2467: of the package, and</p>
2468: <pre class="screen">
1.7 wiz 2469: <code class="prompt">#</code> <strong class=
2470: "userinput"><code>make install</code></strong>
1.1 grant 2471: </pre>
2472:
2473: <p>to install the various components into the correct
2474: places on your system. Installing the package on your
2475: system requires you to be root. However, pkgsrc has a
2476: <span class="emphasis"><em>just-in-time-su</em></span>
2477: feature, which allows you to only become root for the
2478: actual installation step</p>
2479:
2480: <p>Taking the figlet utility as an example, we can
2481: install it on our system by building as shown in
2482: <a href="#logs" title=
2483: "Appendix B. Build logs">Appendix B, <i>Build
2484: logs</i></a>.</p>
2485:
2486: <p>The program is installed under the default root of
1.7 wiz 2487: the packages tree - <code class=
2488: "filename">/usr/pkg</code>. Should this not conform to
2489: your tastes, set the <code class=
2490: "varname">LOCALBASE</code> variable in your
1.1 grant 2491: environment, and it will use that value as the root of
1.7 wiz 2492: your packages tree. So, to use <code class=
2493: "filename">/usr/local</code>, set <code class=
2494: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 2495: environment. Please note that you should use a
2496: directory which is dedicated to packages and not shared
1.7 wiz 2497: with other programs (ie, do not try and use
2498: <code class="varname">LOCALBASE=/usr</code>). Also, you
2499: should not try to add any of your own files or
2500: directories (such as <code class=
2501: "filename">src/</code>, <code class=
2502: "filename">obj/</code>, or <code class=
2503: "filename">pkgsrc/</code>) below the <code class=
2504: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 2505: possible conflicts between programs and other files
2506: installed by the package system and whatever else may
2507: have been installed there.</p>
2508:
1.7 wiz 2509: <p>Some packages look in <code class=
2510: "filename">/etc/mk.conf</code> to alter some
1.1 grant 2511: configuration options at build time. Have a look at
1.7 wiz 2512: <code class=
1.11 ben 2513: "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
2514: overview of what will be set there by default.
1.7 wiz 2515: Environment variables such as <code class=
2516: "varname">LOCALBASE</code> can be set in <code class=
2517: "filename">/etc/mk.conf</code> to save having to
2518: remember to set them each time you want to use
2519: pkgsrc.</p>
1.1 grant 2520:
2521: <p>Occasionally, people want to “<span class=
2522: "quote">look under the covers</span>” to see what
2523: is going on when a package is building or being
2524: installed. This may be for debugging purposes, or out
2525: of simple curiosity. A number of utility values have
2526: been added to help with this.</p>
2527:
2528: <div class="orderedlist">
2529: <ol type="1">
2530: <li>
2531: <p>If you invoke the <a href=
2532: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2533: <span class="citerefentry"><span class=
2534: "refentrytitle">make</span>(1)</span></a> command
1.7 wiz 2535: with <code class=
2536: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
2537: amount of information will be displayed. For
2538: example,</p>
1.1 grant 2539: <pre class="screen">
1.7 wiz 2540: <strong class=
2541: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 2542: </pre>
2543:
2544: <p>will show all the commands that are invoked,
2545: up to and including the “<span class=
2546: "quote">patch</span>” stage.</p>
2547: </li>
2548:
2549: <li>
2550: <p>If you want to know the value of a certain
1.7 wiz 2551: make(1) definition, then the <code class=
2552: "varname">VARNAME</code> definition should be
2553: used, in conjunction with the show-var target.
2554: e.g. to show the expansion of the <a href=
1.1 grant 2555: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2556: <span class="citerefentry"><span class=
2557: "refentrytitle">make</span>(1)</span></a>
1.7 wiz 2558: variable <code class=
2559: "varname">DISTFILES</code>:</p>
1.1 grant 2560: <pre class="screen">
1.7 wiz 2561: <code class="prompt">%</code> <strong class=
2562: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 2563: /usr/pkg
1.7 wiz 2564: <code class="prompt">%</code>
1.1 grant 2565:
2566: </pre>
2567: </li>
2568: </ol>
2569: </div>
2570:
2571: <p>If you want to install a binary package that you've
2572: either created yourself (see next section), that you
2573: put into pkgsrc/packages manually or that is located on
1.8 wiz 2574: a remote FTP server, you can use the "bin-install"
1.1 grant 2575: target. This target will install a binary package - if
2576: available - via <a href=
2577: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2578: <span class="citerefentry"><span class=
2579: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.7 wiz 2580: <span><strong class="command">make
2581: package</strong></span>. The list of remote FTP sites
2582: searched is kept in the variable <code class=
1.11 ben 2583: "varname">BINPKG_SITES</code>, which defaults to
1.7 wiz 2584: ftp.NetBSD.org. Any flags that should be added to
2585: <a href=
1.1 grant 2586: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2587: <span class="citerefentry"><span class=
2588: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.7 wiz 2589: into <code class="varname">BIN_INSTALL_FLAGS</code>.
2590: See <code class=
1.11 ben 2591: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
2592: details.</p>
1.1 grant 2593:
2594: <p>A final word of warning: If you setup a system that
1.7 wiz 2595: has a non-standard setting for <code class=
2596: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 2597: any packages are installed, as you can not use several
2598: directories for the same purpose. Doing so will result
2599: in pkgsrc not being able to properly detect your
2600: installed packages, and fail miserably. Note also that
2601: precompiled binary packages are usually built with the
1.7 wiz 2602: default <code class="varname">LOCALBASE</code> of
2603: <code class="filename">/usr/pkg</code>, and that you
2604: should <span class="emphasis"><em>not</em></span>
2605: install any if you use a non-standard <code class=
2606: "varname">LOCALBASE</code>.</p>
1.1 grant 2607: </div>
2608:
2609: <div class="sect2" lang="en" xml:lang="en">
2610: <div class="titlepage">
2611: <div>
2612: <div>
1.12 ! agc 2613: <h3 class="title"><a name="id2517179" id=
! 2614: "id2517179"></a>4.2.4. Selecting the
1.1 grant 2615: compiler</h3>
2616: </div>
2617: </div>
2618: </div>
2619:
2620: <p>By default, pkgsrc will use GCC to build packages.
2621: This may be overridden by setting the following
2622: variables in /etc/mk.conf:</p>
2623:
2624: <div class="variablelist">
2625: <dl>
1.7 wiz 2626: <dt><span class="term"><code class=
2627: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 2628:
2629: <dd>
2630: <p>This is a list of values specifying the chain
2631: of compilers to invoke when building packages.
2632: Valid values are:</p>
2633:
2634: <div class="itemizedlist">
2635: <ul type="disc">
2636: <li>
1.7 wiz 2637: <p><code class="varname">distcc</code>:
1.1 grant 2638: distributed C/C++ (chainable)</p>
2639: </li>
2640:
2641: <li>
1.7 wiz 2642: <p><code class="varname">ccache</code>:
1.1 grant 2643: compiler cache (chainable)</p>
2644: </li>
2645:
2646: <li>
1.7 wiz 2647: <p><code class="varname">gcc</code>: GNU
2648: C/C++ Compiler</p>
1.1 grant 2649: </li>
2650:
2651: <li>
1.7 wiz 2652: <p><code class="varname">mipspro</code>:
1.1 grant 2653: Silicon Graphics, Inc. MIPSpro
2654: (n32/n64)</p>
2655: </li>
2656:
2657: <li>
1.7 wiz 2658: <p><code class="varname">mipspro</code>:
1.1 grant 2659: Silicon Graphics, Inc. MIPSpro (o32)</p>
2660: </li>
2661:
2662: <li>
1.7 wiz 2663: <p><code class="varname">sunpro</code>:
1.1 grant 2664: Microsystems, Inc. WorkShip/Forte/Sun ONE
2665: Studio</p>
2666: </li>
2667: </ul>
2668: </div>
2669:
2670: <p>The default is “<span class=
1.7 wiz 2671: "quote"><code class=
2672: "varname">gcc</code></span>”. You can use
2673: <code class="varname">ccache</code> and/or
2674: <code class="varname">distcc</code> with an
2675: appropriate <code class=
2676: "varname">PKGSRC_COMPILER</code> setting, e.g.
2677: “<span class="quote"><code class=
2678: "varname">ccache gcc</code></span>”. This
1.1 grant 2679: variable should always be terminated with a value
2680: for a real compiler.</p>
2681: </dd>
2682:
1.7 wiz 2683: <dt><span class="term"><code class=
2684: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 2685:
2686: <dd>
2687: <p>This specifies the minimum version of GCC to
2688: use when building packages. If the system GCC
2689: doesn't satisfy this requirement, then pkgsrc
2690: will build and install one of the GCC packages to
2691: use instead.</p>
2692: </dd>
2693: </dl>
2694: </div>
2695: </div>
2696: </div>
2697: </div>
2698:
2699: <div class="chapter" lang="en" xml:lang="en">
2700: <div class="titlepage">
2701: <div>
2702: <div>
2703: <h2 class="title"><a name="binary" id=
2704: "binary"></a>Chapter 5. Creating binary
2705: packages</h2>
2706: </div>
2707: </div>
2708: </div>
2709:
2710: <div class="toc">
2711: <p><b>Table of Contents</b></p>
2712:
2713: <dl>
1.12 ! agc 2714: <dt><span class="sect1"><a href="#id2517334">5.1.
1.1 grant 2715: Building a single binary package</a></span></dt>
2716:
1.12 ! agc 2717: <dt><span class="sect1"><a href="#id2517821">5.2.
1.1 grant 2718: Settings for creation of binary
2719: packages</a></span></dt>
2720:
2721: <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
2722: a bulk build of all packages</a></span></dt>
2723:
2724: <dd>
2725: <dl>
2726: <dt><span class="sect2"><a href=
2727: "#binary.configuration">5.3.1.
2728: Configuration</a></span></dt>
2729:
1.12 ! agc 2730: <dt><span class="sect2"><a href="#id2517961">5.3.2.
1.1 grant 2731: Other environmental considerations</a></span></dt>
2732:
1.12 ! agc 2733: <dt><span class="sect2"><a href="#id2518002">5.3.3.
1.1 grant 2734: Operation</a></span></dt>
2735:
1.12 ! agc 2736: <dt><span class="sect2"><a href="#id2583267">5.3.4.
1.1 grant 2737: What it does</a></span></dt>
2738:
1.12 ! agc 2739: <dt><span class="sect2"><a href="#id2583392">5.3.5.
1.1 grant 2740: Disk space requirements</a></span></dt>
2741:
1.12 ! agc 2742: <dt><span class="sect2"><a href="#id2583418">5.3.6.
1.1 grant 2743: Setting up a sandbox for chroot'ed
2744: builds</a></span></dt>
2745:
1.12 ! agc 2746: <dt><span class="sect2"><a href="#id2583811">5.3.7.
1.1 grant 2747: Building a partial set of packages</a></span></dt>
2748: </dl>
2749: </dd>
2750:
1.12 ! agc 2751: <dt><span class="sect1"><a href="#id2583853">5.4.
1.1 grant 2752: Creating a multiple CD-ROM packages
2753: collection</a></span></dt>
2754:
2755: <dd>
2756: <dl>
1.12 ! agc 2757: <dt><span class="sect2"><a href="#id2583868">5.4.1.
1.1 grant 2758: Example of cdpack</a></span></dt>
2759: </dl>
2760: </dd>
2761: </dl>
2762: </div>
2763:
2764: <div class="sect1" lang="en" xml:lang="en">
2765: <div class="titlepage">
2766: <div>
2767: <div>
2768: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 2769: "id2517334" id="id2517334"></a>5.1. Building a
1.1 grant 2770: single binary package</h2>
2771: </div>
2772: </div>
2773: </div>
2774:
2775: <p>Once you have built and installed a package, you can
2776: create a <span class="emphasis"><em>binary
2777: package</em></span> which can be installed on another
2778: system with <a href=
2779: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2780: <span class="citerefentry"><span class=
2781: "refentrytitle">pkg_add</span>(1)</span></a> This saves
2782: having to build the same package on a group of hosts and
2783: wasting CPU time. It also provides a simple means for
2784: others to install your package, should you distribute
2785: it.</p>
2786:
2787: <p>To create a binary package, change into the
1.7 wiz 2788: appropriate directory in pkgsrc, and run
2789: <span><strong class="command">make
2790: package</strong></span>:</p>
1.1 grant 2791: <pre class="screen">
1.7 wiz 2792: <code class="prompt">#</code> <strong class=
2793: "userinput"><code>cd misc/figlet</code></strong>
2794: <code class="prompt">#</code> <strong class=
2795: "userinput"><code>make package</code></strong>
1.1 grant 2796: </pre>
2797:
2798: <p>This will build and install your package (if not
2799: already done), and then build a binary package from what
1.7 wiz 2800: was installed. You can then use the <span><strong class=
2801: "command">pkg_*</strong></span> tools to manipulate it.
2802: Binary packages are created by default in <code class=
2803: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 2804: gzipped tar file. See <a href="#logs.package" title=
2805: "B.2. Packaging figlet">Section B.2,
2806: “Packaging figlet”</a> for a continuation of
2807: the above <a xmlns=
2808: "http://www.w3.org/TR/xhtml1/transitional" href=
2809: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.7 wiz 2810: class="pkgname">misc/figlet</a> example.</p>
1.1 grant 2811:
2812: <p>See <a href="#submit" title=
2813: "Chapter 14. Submitting and Committing">Chapter
2814: 14, <i>Submitting and Committing</i></a> for information
2815: on how to submit such a binary package.</p>
2816: </div>
2817:
2818: <div class="sect1" lang="en" xml:lang="en">
2819: <div class="titlepage">
2820: <div>
2821: <div>
2822: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 2823: "id2517821" id="id2517821"></a>5.2. Settings
1.1 grant 2824: for creation of binary packages</h2>
2825: </div>
2826: </div>
2827: </div>
2828:
2829: <p>See <a href="#build.helpful-targets" title=
2830: "11.3. Other helpful targets">Section 11.3,
2831: “Other helpful targets”</a>.</p>
2832: </div>
2833:
2834: <div class="sect1" lang="en" xml:lang="en">
2835: <div class="titlepage">
2836: <div>
2837: <div>
2838: <h2 class="title" style="clear: both"><a name=
2839: "bulkbuild" id="bulkbuild"></a>5.3. Doing a
2840: bulk build of all packages</h2>
2841: </div>
2842: </div>
2843: </div>
2844:
2845: <p>If you want to get a full set of precompiled binary
2846: packages, this section describes how to get them. Beware
2847: that the bulk build will remove all currently installed
2848: packages from your system! Having a FTP server configured
2849: either on the machine doing the bulk builds or on a
2850: nearby NFS server can help to make the packages available
2851: to everyone. See <a href=
2852: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
2853: <span class="citerefentry"><span class=
2854: "refentrytitle">ftpd</span>(8)</span></a> for more
2855: information. If you use a remote NFS server's storage, be
2856: sure to not actually compile on NFS storage, as this
2857: slows things down a lot.</p>
2858:
2859: <div class="sect2" lang="en" xml:lang="en">
2860: <div class="titlepage">
2861: <div>
2862: <div>
2863: <h3 class="title"><a name="binary.configuration"
2864: id=
2865: "binary.configuration"></a>5.3.1. Configuration</h3>
2866: </div>
2867: </div>
2868: </div>
2869:
2870: <div class="sect3" lang="en" xml:lang="en">
2871: <div class="titlepage">
2872: <div>
2873: <div>
2874: <h4 class="title"><a name="binary.mk.conf" id=
2875: "binary.mk.conf"></a>5.3.1.1. /etc/mk.conf</h4>
2876: </div>
2877: </div>
2878: </div>
2879:
1.7 wiz 2880: <p>You may want to set things in <code class=
2881: "filename">/etc/mk.conf</code>. Look at <code class=
1.11 ben 2882: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 2883: details of the default settings. You will want to
1.7 wiz 2884: ensure that <code class=
2885: "varname">ACCEPTABLE_LICENSES</code> meet your local
2886: policy. As used in this example, <code class=
2887: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 2888: "emphasis"><em>all</em></span> licenses.</p>
2889: <pre class="programlisting">
2890: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
2891: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
2892: BSDSRCDIR= /usr/src
2893: BSDXSRCDIR= /usr/xsrc # for x11/xservers
2894: OBJHOSTNAME?= yes # use work.`hostname`
2895: FAILOVER_FETCH= yes # insist on the correct checksum
2896: PKG_DEVELOPER?= yes
2897: _ACCEPTABLE= yes
2898: </pre>
2899: </div>
2900:
2901: <div class="sect3" lang="en" xml:lang="en">
2902: <div class="titlepage">
2903: <div>
2904: <div>
1.12 ! agc 2905: <h4 class="title"><a name="id2517885" id=
! 2906: "id2517885"></a>5.3.1.2. <code class=
1.7 wiz 2907: "filename">build.conf</code></h4>
1.1 grant 2908: </div>
2909: </div>
2910: </div>
2911:
1.7 wiz 2912: <p>In <code class="filename">pkgsrc/mk/bulk</code>,
2913: copy <code class="filename">build.conf-example</code>
2914: to <code class="filename">build.conf</code> and edit
2915: it, following the comments in that file. This is the
1.1 grant 2916: config file that determines where log files are
2917: generated after the build, where to mail the build
2918: report to, where your pkgsrc tree is located and
2919: which user to <a href=
2920: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
2921: <span class="citerefentry"><span class=
2922: "refentrytitle">su</span>(8)</span></a> to to do a
1.7 wiz 2923: <span><strong class="command">cvs
2924: update</strong></span>.</p>
1.1 grant 2925: </div>
2926:
2927: <div class="sect3" lang="en" xml:lang="en">
2928: <div class="titlepage">
2929: <div>
2930: <div>
1.12 ! agc 2931: <h4 class="title"><a name="id2517922" id=
! 2932: "id2517922"></a>5.3.1.3. <code class=
1.7 wiz 2933: "filename">pre-build.local</code></h4>
1.1 grant 2934: </div>
2935: </div>
2936: </div>
2937:
2938: <p>It is possible to configure the bulk build to
2939: perform certain site specific tasks at the end of the
1.7 wiz 2940: pre-build stage. If the file <code class=
2941: "filename">pre-build.local</code> exists in
2942: <code class="filename">/usr/pkgsrc/mk/bulk</code> it
2943: will be executed (as a sh(1) script) at the end of
2944: the usual pre-build stage. An example use of
2945: <code class="filename">pre-build.local</code> is to
2946: have the line:</p>
1.1 grant 2947: <pre class="screen">
1.7 wiz 2948: <code class="prompt">#</code> <strong class=
2949: "userinput"><code>echo "I do not have enough disk space to build this pig." \
2950: > pkgsrc/games/crafty-book-enormous/$BROKENF</code></strong>
1.1 grant 2951: </pre>
2952:
2953: <p>to prevent the system from trying to build a
2954: particular package which requires nearly 3 GB of disk
2955: space.</p>
2956: </div>
2957: </div>
2958:
2959: <div class="sect2" lang="en" xml:lang="en">
2960: <div class="titlepage">
2961: <div>
2962: <div>
1.12 ! agc 2963: <h3 class="title"><a name="id2517961" id=
! 2964: "id2517961"></a>5.3.2. Other environmental
1.1 grant 2965: considerations</h3>
2966: </div>
2967: </div>
2968: </div>
2969:
1.7 wiz 2970: <p>As <code class="filename">/usr/pkg</code> will be
1.1 grant 2971: completely deleted at the start of bulk builds, make
2972: sure your login shell is placed somewhere else. Either
1.7 wiz 2973: drop it into <code class=
2974: "filename">/usr/local/bin</code> (and adjust your login
2975: shell in the passwd file), or (re-)install it via
2976: <a href=
1.1 grant 2977: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2978: <span class="citerefentry"><span class=
2979: "refentrytitle">pkg_add</span>(1)</span></a> from
1.7 wiz 2980: <code class="filename">/etc/rc.local</code>, so you can
1.1 grant 2981: login after a reboot (remember that your current
2982: process won't die if the package is removed, you just
2983: can't start any new instances of the shell any more).
2984: Also, if you use NetBSD earlier than 1.5, or you still
2985: want to use the pkgsrc version of ssh for some reason,
2986: be sure to install ssh before starting it from
1.7 wiz 2987: <code class="filename">rc.local</code>:</p>
1.1 grant 2988: <pre class="programlisting">
2989: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
2990: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
2991: /usr/pkg/etc/rc.d/sshd
2992: fi
2993: </pre>
2994:
2995: <p>Not doing so will result in you being not able to
2996: log in via ssh after the bulk build is finished or if
2997: the machine gets rebooted or crashes. You have been
2998: warned! :)</p>
2999: </div>
3000:
3001: <div class="sect2" lang="en" xml:lang="en">
3002: <div class="titlepage">
3003: <div>
3004: <div>
1.12 ! agc 3005: <h3 class="title"><a name="id2518002" id=
! 3006: "id2518002"></a>5.3.3. Operation</h3>
1.1 grant 3007: </div>
3008: </div>
3009: </div>
3010:
3011: <p>Make sure you don't need any of the packages still
3012: installed.</p>
3013:
3014: <div class="warning" style=
3015: "margin-left: 0.5in; margin-right: 0.5in;">
3016: <h3 class="title">Warning</h3>
3017:
3018: <p>During the bulk build, <span class=
3019: "emphasis"><em>all packages will be
3020: removed!</em></span></p>
3021: </div>
3022:
3023: <p>Be sure to remove all other things that might
3024: interfere with builds, like some libs installed in
1.7 wiz 3025: <code class="filename">/usr/local</code>, etc. then
3026: become root and type:</p>
1.1 grant 3027: <pre class="screen">
1.7 wiz 3028: <code class="prompt">#</code> <strong class=
3029: "userinput"><code>cd /usr/pkgsrc</code></strong>
3030: <code class="prompt">#</code> <strong class=
3031: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 3032: </pre>
3033:
3034: <p>If for some reason your last build didn't complete
3035: (power failure, system panic, ...), you can continue it
3036: by running:</p>
3037: <pre class="screen">
1.7 wiz 3038: <code class="prompt">#</code> <strong class=
3039: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 3040: </pre>
3041:
3042: <p>At the end of the bulk build, you will get a summary
3043: via mail, and find build logs in the directory
1.7 wiz 3044: specified by <code class="varname">FTP</code> in the
3045: <code class="filename">build.conf</code> file.</p>
1.1 grant 3046: </div>
3047:
3048: <div class="sect2" lang="en" xml:lang="en">
3049: <div class="titlepage">
3050: <div>
3051: <div>
1.12 ! agc 3052: <h3 class="title"><a name="id2583267" id=
! 3053: "id2583267"></a>5.3.4. What it does</h3>
1.1 grant 3054: </div>
3055: </div>
3056: </div>
3057:
3058: <p>The bulk builds consist of three steps:</p>
3059:
3060: <div class="variablelist">
3061: <dl>
3062: <dt><span class="term">1. pre-build</span></dt>
3063:
3064: <dd>
3065: <p>The script updates your pkgsrc tree via
3066: (anon)cvs, then cleans out any broken distfiles,
3067: and removes all packages installed.</p>
3068: </dd>
3069:
3070: <dt><span class="term">2. the bulk
3071: build</span></dt>
3072:
3073: <dd>
3074: <p>This is basically “<span class=
3075: "quote">make bulk-package</span>” with an
3076: optimised order in which packages will be built.
3077: Packages that don't require other packages will
3078: be built first, and packages with many
3079: dependencies will be built later.</p>
3080: </dd>
3081:
3082: <dt><span class="term">3. post-build</span></dt>
3083:
3084: <dd>
3085: <p>Generates a report that's placed in the
1.7 wiz 3086: directory specified in the <code class=
3087: "filename">build.conf</code> file named
3088: <code class="filename">broken.html</code>, a
3089: short version of that report will also be mailed
3090: to the build's admin.</p>
1.1 grant 3091: </dd>
3092: </dl>
3093: </div>
3094:
3095: <p>During the build, a list of broken packages will be
1.7 wiz 3096: compiled in <code class=
3097: "filename">/usr/pkgsrc/.broken</code> (or <code class=
3098: "filename">.../.broken.${MACHINE}</code> if
3099: <code class="varname">OBJMACHINE</code> is set),
3100: individual build logs of broken builds can be found in
3101: the package's directory. These files are used by the
3102: bulk-targets to mark broken builds to not waste time
3103: trying to rebuild them, and they can be used to debug
3104: these broken package builds later.</p>
1.1 grant 3105: </div>
3106:
3107: <div class="sect2" lang="en" xml:lang="en">
3108: <div class="titlepage">
3109: <div>
3110: <div>
1.12 ! agc 3111: <h3 class="title"><a name="id2583392" id=
! 3112: "id2583392"></a>5.3.5. Disk space
1.1 grant 3113: requirements</h3>
3114: </div>
3115: </div>
3116: </div>
3117:
3118: <p>Currently, roughly the following requirements are
3119: valid for NetBSD 2.0/i386:</p>
3120:
3121: <div class="itemizedlist">
3122: <ul type="disc">
3123: <li>
3124: <p>10 GB - distfiles (NFS ok)</p>
3125: </li>
3126:
3127: <li>
3128: <p>8 GB - full set of all binaries (NFS ok)</p>
3129: </li>
3130:
3131: <li>
3132: <p>5 GB - temp space for compiling (local disk
3133: recommended)</p>
3134: </li>
3135: </ul>
3136: </div>
3137:
3138: <p>Note that all pkgs will be de-installed as soon as
3139: they are turned into a binary package, and that sources
3140: are removed, so there is no excessively huge demand to
3141: disk space. Afterwards, if the package is needed again,
3142: it will be installed via <a href=
3143: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3144: <span class="citerefentry"><span class=
3145: "refentrytitle">pkg_add</span>(1)</span></a> instead of
3146: building again, so there are no cycles wasted by
3147: recompiling.</p>
3148: </div>
3149:
3150: <div class="sect2" lang="en" xml:lang="en">
3151: <div class="titlepage">
3152: <div>
3153: <div>
1.12 ! agc 3154: <h3 class="title"><a name="id2583418" id=
! 3155: "id2583418"></a>5.3.6. Setting up a sandbox
1.1 grant 3156: for chroot'ed builds</h3>
3157: </div>
3158: </div>
3159: </div>
3160:
1.12 ! agc 3161: <p>If you don't want all the packages nuked from a
! 3162: machine (rendering it useless for anything but pkg
! 3163: compiling), there is the possibility of doing the pkg
! 3164: bulk build inside a chroot environment.</p>
! 3165:
! 3166: <p>The first step is to set up a chroot sandbox, e.g.
! 3167: <code class="filename">/usr/sandbox</code>. This can be
! 3168: done by using null mounts, or manually.</p>
! 3169:
! 3170: <p>There is a shell script called <code class=
! 3171: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
! 3172: set up the sandbox environment using null mounts. It
! 3173: will also create a script called <code class=
! 3174: "filename">sandbox</code> in the root of the sandbox
! 3175: environment, which will allow the null mounts to be
! 3176: activated using the <span><strong class=
! 3177: "command">sandbox mount</strong></span> command and
! 3178: deactivated using the <span><strong class=
! 3179: "command">sandbox umount</strong></span> command.</p>
! 3180:
! 3181: <p>To set up a sandbox environment by hand, after
! 3182: extracting all the sets from a NetBSD installation or
! 3183: doing a <span><strong class="command">make distribution
1.7 wiz 3184: DESTDIR=/usr/sandbox</strong></span> in <code class=
3185: "filename">/usr/src/etc</code>, be sure the following
3186: items are present and properly configured:</p>
1.1 grant 3187:
3188: <div class="procedure">
3189: <ol type="1">
3190: <li>
3191: <p>Kernel</p>
3192: <pre class="screen">
1.7 wiz 3193: <code class="prompt">#</code> <strong class=
3194: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 3195: </pre>
3196: </li>
3197:
3198: <li>
1.7 wiz 3199: <p><code class="filename">/dev/*</code></p>
1.1 grant 3200: <pre class="screen">
1.7 wiz 3201: <code class="prompt">#</code> <strong class=
3202: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 3203: </pre>
3204: </li>
3205:
3206: <li>
1.7 wiz 3207: <p><code class="filename">/etc/resolv.conf</code>
1.1 grant 3208: (for <a xmlns=
3209: "http://www.w3.org/TR/xhtml1/transitional" href=
3210: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.7 wiz 3211: class="pkgname">security/smtpd</a> and mail):</p>
1.1 grant 3212: <pre class="screen">
1.7 wiz 3213: <code class="prompt">#</code> <strong class=
3214: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 3215: </pre>
3216: </li>
3217:
3218: <li>
3219: <p>Working(!) mail config (hostname,
3220: sendmail.cf):</p>
3221: <pre class="screen">
1.7 wiz 3222: <code class="prompt">#</code> <strong class=
3223: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 3224: </pre>
3225: </li>
3226:
3227: <li>
1.7 wiz 3228: <p><code class="filename">/etc/localtime</code>
3229: (for <a xmlns=
1.1 grant 3230: "http://www.w3.org/TR/xhtml1/transitional" href=
3231: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.7 wiz 3232: class="pkgname">security/smtpd</a>):</p>
1.1 grant 3233: <pre class="screen">
1.7 wiz 3234: <code class="prompt">#</code> <strong class=
3235: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 3236: </pre>
3237: </li>
3238:
3239: <li>
1.7 wiz 3240: <p><code class="filename">/usr/src</code> (system
1.1 grant 3241: sources, for <a xmlns=
3242: "http://www.w3.org/TR/xhtml1/transitional" href=
3243: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.7 wiz 3244: class="pkgname">sysutils/aperture</a>, <a xmlns=
3245: "http://www.w3.org/TR/xhtml1/transitional" href=
3246: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
3247: class="pkgname">net/ppp-mppe</a>):</p>
1.1 grant 3248: <pre class="screen">
1.7 wiz 3249: <code class="prompt">#</code> <strong class=
3250: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
3251: <code class="prompt">#</code> <strong class=
3252: "userinput"><code>ln -s cvs/src-1.6 src</code></strong>
1.1 grant 3253: </pre>
3254: </li>
3255:
3256: <li>
1.7 wiz 3257: <p>Create <code class=
3258: "filename">/var/db/pkg</code> (not part of
3259: default install):</p>
1.1 grant 3260: <pre class="screen">
1.7 wiz 3261: <code class="prompt">#</code> <strong class=
3262: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 3263: </pre>
3264: </li>
3265:
3266: <li>
1.7 wiz 3267: <p>Create <code class="filename">/usr/pkg</code>
3268: (not part of default install):</p>
1.1 grant 3269: <pre class="screen">
1.7 wiz 3270: <code class="prompt">#</code> <strong class=
3271: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 3272: </pre>
3273: </li>
3274:
3275: <li>
1.7 wiz 3276: <p>Checkout pkgsrc via cvs into <code class=
3277: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 3278: <pre class="screen">
1.7 wiz 3279: <code class="prompt">#</code> <strong class=
3280: "userinput"><code>cd /usr/sandbox/usr</code></strong>
3281: <code class="prompt">#</code> <strong class=
3282: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 3283: </pre>
3284:
3285: <p>Do not mount/link this to the copy of your
3286: pkgsrc tree you do development in, as this will
3287: likely cause problems!</p>
3288: </li>
3289:
3290: <li>
1.7 wiz 3291: <p>Make <code class=
3292: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
3293: and <code class="filename">.../distfiles</code>
3294: point somewhere appropriate. NFS- and/or
3295: nullfs-mounts may come in handy!</p>
1.1 grant 3296: </li>
3297:
3298: <li>
1.7 wiz 3299: <p>Edit <code class=
3300: "filename">/etc/mk.conf</code>, see <a href=
3301: "#binary.mk.conf" title=
1.1 grant 3302: "5.3.1.1. /etc/mk.conf">Section 5.3.1.1,
3303: “/etc/mk.conf”</a>.</p>
3304: </li>
3305:
3306: <li>
1.7 wiz 3307: <p>Adjust <code class=
3308: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 3309: needs.</p>
3310: </li>
3311:
3312: <li>
1.7 wiz 3313: <p>If you have set <code class=
3314: "varname">CVS_USER</code> in <code class=
3315: "filename">build.conf</code>, make sure that
3316: account exists and can do a <span><strong class=
3317: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 3318: properly!</p>
3319: </li>
3320: </ol>
3321: </div>
3322:
3323: <p>When the chroot sandbox is setup, you can start the
3324: build with the following steps:</p>
3325: <pre class="screen">
1.7 wiz 3326: <code class="prompt">#</code> <strong class=
3327: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
3328: <code class="prompt">#</code> <strong class=
3329: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 3330: </pre>
3331:
3332: <p>This will just jump inside the sandbox and start
3333: building. At the end of the build, mail will be sent
3334: with the results of the build. Created binary pkgs will
1.7 wiz 3335: be in <code class=
3336: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 3337: (wherever that points/mounts to/from).</p>
3338: </div>
3339:
3340: <div class="sect2" lang="en" xml:lang="en">
3341: <div class="titlepage">
3342: <div>
3343: <div>
1.12 ! agc 3344: <h3 class="title"><a name="id2583811" id=
! 3345: "id2583811"></a>5.3.7. Building a partial
1.1 grant 3346: set of packages</h3>
3347: </div>
3348: </div>
3349: </div>
3350:
3351: <p>In addition to building a complete set of all
1.7 wiz 3352: packages in pkgsrc, the <code class=
3353: "filename">pkgsrc/mk/bulk/build</code> script may be
3354: used to build a subset of the packages contained in
3355: pkgsrc. By setting defining <code class=
3356: "varname">SPECIFIC_PKGS</code> in <code class=
3357: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 3358:
3359: <div class="itemizedlist">
3360: <ul type="disc">
3361: <li>
3362: <p>SITE_SPECIFIC_PKGS</p>
3363: </li>
3364:
3365: <li>
3366: <p>HOST_SPECIFIC_PKGS</p>
3367: </li>
3368:
3369: <li>
3370: <p>GROUP_SPECIFIC_PKGS</p>
3371: </li>
3372:
3373: <li>
3374: <p>USER_SPECIFIC_PKGS</p>
3375: </li>
3376: </ul>
3377: </div>
3378:
3379: <p>will define the set of packages which should be
3380: built. The bulk build code will also include any
3381: packages which are needed as dependencies for the
3382: explicitly listed packages.</p>
3383:
3384: <p>One use of this is to do a bulk build with
1.7 wiz 3385: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 3386: sandbox periodically to have a complete set of the
3387: binary packages needed for your site available without
3388: the overhead of building extra packages that are not
3389: needed.</p>
3390: </div>
3391: </div>
3392:
3393: <div class="sect1" lang="en" xml:lang="en">
3394: <div class="titlepage">
3395: <div>
3396: <div>
3397: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 3398: "id2583853" id="id2583853"></a>5.4. Creating a
1.1 grant 3399: multiple CD-ROM packages collection</h2>
3400: </div>
3401: </div>
3402: </div>
3403:
3404: <p>After your pkgsrc bulk-build has completed, you may
3405: wish to create a CD-ROM set of the resulting binary
3406: packages to assist in installing packages on other
3407: machines. The <a xmlns=
3408: "http://www.w3.org/TR/xhtml1/transitional" href=
3409: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.7 wiz 3410: class="pkgname">pkgtools/cdpack</a> package provides a
3411: simple tool for creating the ISO 9660 images.
3412: <span><strong class="command">cdpack</strong></span>
3413: arranges the packages on the CD-ROMs in a way that keeps
3414: all the dependencies for given package on the same CD as
3415: that package.</p>
1.1 grant 3416:
3417: <div class="sect2" lang="en" xml:lang="en">
3418: <div class="titlepage">
3419: <div>
3420: <div>
1.12 ! agc 3421: <h3 class="title"><a name="id2583868" id=
! 3422: "id2583868"></a>5.4.1. Example of
1.1 grant 3423: cdpack</h3>
3424: </div>
3425: </div>
3426: </div>
3427:
3428: <p>Complete documentation for cdpack is found in the
3429: cdpack(1) manpage. The following short example assumes
1.7 wiz 3430: that the binary packages are left in <code class=
3431: "filename">/usr/pkgsrc/packages/All</code> and that
3432: sufficient disk space exists in <code class=
3433: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 3434: <pre class="screen">
1.7 wiz 3435: <code class="prompt">#</code> <strong class=
3436: "userinput"><code>mkdir /u2/images</code></strong>
3437: <code class="prompt">#</code> <strong class=
3438: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
3439: <code class="prompt">#</code> <strong class=
3440: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 3441: </pre>
3442:
3443: <p>If you wish to include a common set of files
1.7 wiz 3444: (<code class="filename">COPYRIGHT</code>, <code class=
3445: "filename">README</code>, etc.) on each CD in the
1.1 grant 3446: collection, then you need to create a directory which
3447: contains these files. e.g.</p>
3448: <pre class="screen">
1.7 wiz 3449: <code class="prompt">#</code> <strong class=
3450: "userinput"><code>mkdir /tmp/common</code></strong>
3451: <code class="prompt">#</code> <strong class=
3452: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
3453: <code class="prompt">#</code> <strong class=
3454: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
3455: <code class="prompt">#</code> <strong class=
3456: "userinput"><code>mkdir /tmp/common/bin</code></strong>
3457: <code class="prompt">#</code> <strong class=
3458: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
3459: <code class="prompt">#</code> <strong class=
3460: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
3461: <code class="prompt">#</code> <strong class=
3462: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 3463: </pre>
3464:
3465: <p>Now create the images:</p>
3466: <pre class="screen">
1.7 wiz 3467: <code class="prompt">#</code> <strong class=
3468: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 3469: </pre>
3470:
1.7 wiz 3471: <p>Each image will contain <code class=
3472: "filename">README</code>, <code class=
3473: "filename">COPYING</code>, and <code class=
3474: "filename">bin/myscript</code> in their root
1.1 grant 3475: directories.</p>
3476: </div>
3477: </div>
3478: </div>
3479:
3480: <div class="chapter" lang="en" xml:lang="en">
3481: <div class="titlepage">
3482: <div>
3483: <div>
3484: <h2 class="title"><a name="faq" id=
3485: "faq"></a>Chapter 6. Frequently Asked
3486: Questions</h2>
3487: </div>
3488: </div>
3489: </div>
3490:
3491: <div class="toc">
3492: <p><b>Table of Contents</b></p>
3493:
3494: <dl>
1.12 ! agc 3495: <dt><span class="sect1"><a href="#id2584196">6.1. Is
1.1 grant 3496: there a mailing list for pkg-related
3497: discussion?</a></span></dt>
3498:
1.12 ! agc 3499: <dt><span class="sect1"><a href="#id2584226">6.2.
1.1 grant 3500: Where's the pkgviews documentation?</a></span></dt>
3501:
1.5 hubertf 3502: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 3503: Utilities for package management
3504: (pkgtools)</a></span></dt>
3505:
1.12 ! agc 3506: <dt><span class="sect1"><a href="#id2584478">6.4. How
1.1 grant 3507: to use pkgsrc as non-root</a></span></dt>
3508:
1.12 ! agc 3509: <dt><span class="sect1"><a href="#id2584490">6.5. How
1.1 grant 3510: can I install/use XFree86 from pkgsrc?</a></span></dt>
3511:
1.12 ! agc 3512: <dt><span class="sect1"><a href="#id2584586">6.6. How
1.1 grant 3513: can I install/use X.org from pkgsrc?</a></span></dt>
3514:
1.12 ! agc 3515: <dt><span class="sect1"><a href="#id2584614">6.7. How
1.1 grant 3516: to fetch files from behind a firewall</a></span></dt>
3517:
1.12 ! agc 3518: <dt><span class="sect1"><a href="#id2584628">6.8. How
1.7 wiz 3519: do I tell <span><strong class="command">make
3520: fetch</strong></span> to do passive
3521: FTP?</a></span></dt>
1.1 grant 3522:
1.12 ! agc 3523: <dt><span class="sect1"><a href="#id2584747">6.9. How
1.1 grant 3524: to fetch all distfiles at once</a></span></dt>
3525:
1.12 ! agc 3526: <dt><span class="sect1"><a href="#id2584887">6.10. What
1.7 wiz 3527: does “<span class="quote">Don't know how to make
3528: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 3529: mean?</a></span></dt>
3530:
1.12 ! agc 3531: <dt><span class="sect1"><a href="#id2584925">6.11. What
1.7 wiz 3532: does “<span class="quote">Could not find
3533: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 3534:
1.12 ! agc 3535: <dt><span class="sect1"><a href="#id2584983">6.12.
1.1 grant 3536: Using 'sudo' with pkgsrc</a></span></dt>
3537:
3538: <dt><span class="sect1"><a href="#faq.conf">6.13.
3539: Configuration files handling and
3540: placement</a></span></dt>
3541:
3542: <dt><span class="sect1"><a href="#audit-packages">6.14.
3543: Automated security checks</a></span></dt>
3544: </dl>
3545: </div>
3546:
3547: <p>This section contains hints, tips & tricks on
3548: special things in pkgsrc that we didn't find a better place
3549: for in the previous chapters, and it contains items for
3550: both pkgsrc users and developers.</p>
3551:
3552: <div class="sect1" lang="en" xml:lang="en">
3553: <div class="titlepage">
3554: <div>
3555: <div>
3556: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 3557: "id2584196" id="id2584196"></a>6.1. Is there a
1.1 grant 3558: mailing list for pkg-related discussion?</h2>
3559: </div>
3560: </div>
3561: </div>
3562:
1.7 wiz 3563: <p>Yes, <code class="email"><<a href=
3564: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>
1.1 grant 3565: is the list for discussing package related issues. To
3566: subscribe do:</p>
3567: <pre class="programlisting">
1.7 wiz 3568: <code class=
3569: "prompt">%</code> echo subscribe tech-pkg | mail majordomo@NetBSD.org
1.1 grant 3570: </pre>
3571:
3572: <p>An archive of the list is available at <a href=
3573: "http://mail-index.NetBSD.org/tech-pkg/" target=
3574: "_top">http://mail-index.NetBSD.org/tech-pkg/</a>.</p>
3575: </div>
3576:
3577: <div class="sect1" lang="en" xml:lang="en">
3578: <div class="titlepage">
3579: <div>
3580: <div>
3581: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 3582: "id2584226" id="id2584226"></a>6.2. Where's
1.1 grant 3583: the pkgviews documentation?</h2>
3584: </div>
3585: </div>
3586: </div>
3587:
3588: <p>Pkgviews is tightly integrated with buildlink. You can
1.7 wiz 3589: find a pkgviews User's guide in <code class=
3590: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 3591: </div>
3592:
3593: <div class="sect1" lang="en" xml:lang="en">
3594: <div class="titlepage">
3595: <div>
3596: <div>
3597: <h2 class="title" style="clear: both"><a name=
1.5 hubertf 3598: "faq-pkgtools" id=
3599: "faq-pkgtools"></a>6.3. Utilities for package
3600: management (pkgtools)</h2>
1.1 grant 3601: </div>
3602: </div>
3603: </div>
3604:
1.7 wiz 3605: <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1 grant 3606: directory pkgtools contains a number of useful utilities
3607: for both users and developers of pkgsrc. This section
3608: attempts only to make the reader aware of the utilities
3609: and when they might be useful, and not to duplicate the
3610: documentation that comes with each package.</p>
3611:
3612: <p>Utilities used by pkgsrc (automatically installed when
3613: needed):</p>
3614:
3615: <div class="itemizedlist">
3616: <ul type="disc">
3617: <li>
3618: <p><a xmlns=
3619: "http://www.w3.org/TR/xhtml1/transitional" href=
3620: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.7 wiz 3621: class="pkgname">pkgtools/x11-links</a>: symlinks
3622: for use by buildlink</p>
1.1 grant 3623: </li>
3624: </ul>
3625: </div>
3626:
3627: <p>OS tool augmentation (automatically installed when
3628: needed):</p>
3629:
3630: <div class="itemizedlist">
3631: <ul type="disc">
3632: <li>
3633: <p><a xmlns=
3634: "http://www.w3.org/TR/xhtml1/transitional" href=
3635: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.7 wiz 3636: class="pkgname">pkgtools/digest</a>: calculates
3637: SHA1 checksums (and other kinds)</p>
1.1 grant 3638: </li>
3639:
3640: <li>
3641: <p><a xmlns=
3642: "http://www.w3.org/TR/xhtml1/transitional" href=
3643: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.7 wiz 3644: class="pkgname">pkgtools/libnbcompat</a>: compat
3645: library for pkg tools</p>
1.1 grant 3646: </li>
3647:
3648: <li>
3649: <p><a xmlns=
3650: "http://www.w3.org/TR/xhtml1/transitional" href=
3651: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.7 wiz 3652: class="pkgname">pkgtools/mtree</a>: installed on
3653: non-BSD systems due to lack of native mtree</p>
1.1 grant 3654: </li>
3655:
3656: <li>
3657: <p><a xmlns=
3658: "http://www.w3.org/TR/xhtml1/transitional" href=
3659: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.7 wiz 3660: class="pkgname">pkgtools/pkg_install</a>:
3661: up-to-date replacement for /usr/sbin/pkg_install,
3662: or for use on operating systems where pkg_install
3663: is not present</p>
1.1 grant 3664: </li>
3665: </ul>
3666: </div>
3667:
3668: <p>Utilities used by pkgsrc (not automatically
3669: installed):</p>
3670:
3671: <div class="itemizedlist">
3672: <ul type="disc">
3673: <li>
3674: <p><a xmlns=
3675: "http://www.w3.org/TR/xhtml1/transitional" href=
3676: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.7 wiz 3677: class="pkgname">pkgtools/pkg_tarup</a>: create a
3678: binary package from an already-installed package.
3679: used by 'make replace' to save the old package</p>
1.1 grant 3680: </li>
3681:
3682: <li>
3683: <p><a xmlns=
3684: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 3685: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.7 wiz 3686: class="pkgname">pkgtools/dfdisk</a>: adds extra
3687: functionality to pkgsrc, allowing it to fetch
3688: distfiles from multiple locations. It currently
3689: supports the following methods: multiple CD-ROMs
3690: and network FTP/HTTP connections.</p>
1.5 hubertf 3691: </li>
3692:
3693: <li>
3694: <p><a xmlns=
3695: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 3696: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.7 wiz 3697: class="pkgname">pkgtools/xpkgwedge</a>: put X11
3698: packages someplace else (enabled by default)</p>
1.1 grant 3699: </li>
1.5 hubertf 3700:
3701: <li>
3702: <p><a xmlns=
3703: "http://www.w3.org/TR/xhtml1/transitional" href=
3704: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.7 wiz 3705: class="pkgname">devel/cpuflags</a>: will determine
3706: the best compiler flags to optimise code for your
3707: current CPU and compiler.</p>
1.5 hubertf 3708: </li>
1.1 grant 3709: </ul>
3710: </div>
3711:
3712: <p>Utilities for keeping track of installed packages,
3713: being up to date, etc:</p>
3714:
3715: <div class="itemizedlist">
3716: <ul type="disc">
3717: <li>
3718: <p><a xmlns=
3719: "http://www.w3.org/TR/xhtml1/transitional" href=
3720: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.7 wiz 3721: class="pkgname">pkgtools/pkg_chk</a>: installs
3722: pkg_chk, which reports on packages whose installed
3723: versions do not match the latest pkgsrc entries</p>
1.1 grant 3724: </li>
3725:
3726: <li>
3727: <p><a xmlns=
3728: "http://www.w3.org/TR/xhtml1/transitional" href=
3729: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.7 wiz 3730: class="pkgname">pkgtools/pkgdep</a>: makes
3731: dependency graphs of packages, to aid in choosing a
3732: strategy for updating</p>
1.1 grant 3733: </li>
3734:
3735: <li>
3736: <p><a xmlns=
3737: "http://www.w3.org/TR/xhtml1/transitional" href=
3738: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.7 wiz 3739: class="pkgname">pkgtools/pkgdepgraph</a>: make
3740: graph from above (uses graphviz)</p>
1.1 grant 3741: </li>
3742:
3743: <li>
3744: <p><a xmlns=
3745: "http://www.w3.org/TR/xhtml1/transitional" href=
3746: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.7 wiz 3747: class="pkgname">pkgtools/pkglint</a>: This provides
3748: two distinct abilities: check a pkgsrc entry for
3749: correctness (pkglint) check for and remove
3750: out-of-date distfiles and binary packages
3751: (lintpkgsrc)</p>
1.1 grant 3752: </li>
3753:
3754: <li>
3755: <p><a xmlns=
3756: "http://www.w3.org/TR/xhtml1/transitional" href=
3757: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.7 wiz 3758: class="pkgname">pkgtools/pkgsurvey</a>: report what
3759: packages you have installed</p>
1.1 grant 3760: </li>
3761: </ul>
3762: </div>
3763:
3764: <p>Utilities for people maintaining or creating
3765: individual packages:</p>
3766:
3767: <div class="itemizedlist">
3768: <ul type="disc">
3769: <li>
3770: <p><a xmlns=
3771: "http://www.w3.org/TR/xhtml1/transitional" href=
3772: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.7 wiz 3773: class="pkgname">pkgtools/pkgdiff</a>: automate
3774: making and maintaining patches for a package
3775: (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1 grant 3776: </li>
3777:
3778: <li>
3779: <p><a xmlns=
3780: "http://www.w3.org/TR/xhtml1/transitional" href=
3781: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.7 wiz 3782: class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
3783: "http://www.w3.org/TR/xhtml1/transitional" href=
3784: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
3785: class="pkgname">pkgtools/url2pkg</a>: aids in
3786: converting to pkgsrc</p>
1.1 grant 3787: </li>
3788:
3789: <li>
3790: <p><a xmlns=
3791: "http://www.w3.org/TR/xhtml1/transitional" href=
3792: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.7 wiz 3793: class="pkgname">pkgtools/gensolpkg</a>: convert
3794: pkgsrc to a Solaris package</p>
1.1 grant 3795: </li>
3796: </ul>
3797: </div>
3798:
3799: <p>Utilities for people maintaining pkgsrc (or more
3800: obscure pkg utilities)</p>
3801:
3802: <div class="itemizedlist">
3803: <ul type="disc">
3804: <li>
3805: <p><a xmlns=
3806: "http://www.w3.org/TR/xhtml1/transitional" href=
3807: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.7 wiz 3808: class="pkgname">pkgtools/pkgconflict</a>: find
3809: packages that conflict but aren't marked as
3810: such</p>
1.1 grant 3811: </li>
3812:
3813: <li>
3814: <p><a xmlns=
3815: "http://www.w3.org/TR/xhtml1/transitional" href=
3816: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.7 wiz 3817: class="pkgname">pkgtools/pkg_comp</a>: build
3818: packages in a chrooted area</p>
1.1 grant 3819: </li>
3820:
3821: <li>
3822: <p><a xmlns=
3823: "http://www.w3.org/TR/xhtml1/transitional" href=
3824: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.7 wiz 3825: class="pkgname">pkgtools/libkver</a>: spoof kernel
3826: version for chrooted cross builds</p>
1.1 grant 3827: </li>
3828: </ul>
3829: </div>
3830: </div>
3831:
3832: <div class="sect1" lang="en" xml:lang="en">
3833: <div class="titlepage">
3834: <div>
3835: <div>
3836: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 3837: "id2584478" id="id2584478"></a>6.4. How to use
1.1 grant 3838: pkgsrc as non-root</h2>
3839: </div>
3840: </div>
3841: </div>
3842:
3843: <p>If you want to use pkgsrc as non-root user, you can
3844: set some variables to make pkgsrc work under these
3845: conditions. Please see <a href=
3846: "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.7 wiz 3847: target="_top">this message</a> for more details.</p>
1.1 grant 3848: </div>
3849:
3850: <div class="sect1" lang="en" xml:lang="en">
3851: <div class="titlepage">
3852: <div>
3853: <div>
3854: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 3855: "id2584490" id="id2584490"></a>6.5. How can I
1.1 grant 3856: install/use XFree86 from pkgsrc?</h2>
3857: </div>
3858: </div>
3859: </div>
3860:
3861: <p>If you want to use XFree86 from pkgsrc instead of your
1.7 wiz 3862: system's own X11 (<code class=
3863: "filename">/usr/X11R6</code>, <code class=
3864: "filename">/usr/openwin</code>, ...), you will have to
3865: add the following lines into <code class=
3866: "filename">mk.conf</code>:</p>
1.1 grant 3867: <pre class="programlisting">
3868: X11_TYPE=XFree86
3869:
3870: </pre>
3871: </div>
3872:
3873: <div class="sect1" lang="en" xml:lang="en">
3874: <div class="titlepage">
3875: <div>
3876: <div>
3877: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 3878: "id2584586" id="id2584586"></a>6.6. How can I
1.1 grant 3879: install/use X.org from pkgsrc?</h2>
3880: </div>
3881: </div>
3882: </div>
3883:
3884: <p>If you want to use X.org from pkgsrc instead of your
1.7 wiz 3885: system's own X11 (<code class=
3886: "filename">/usr/X11R6</code>, <code class=
3887: "filename">/usr/openwin</code>, ...) you will have to add
3888: the following lines into <code class=
3889: "filename">mk.conf</code>:</p>
1.1 grant 3890: <pre class="programlisting">
3891: X11_TYPE=xorg
3892:
3893: </pre>
3894: </div>
3895:
3896: <div class="sect1" lang="en" xml:lang="en">
3897: <div class="titlepage">
3898: <div>
3899: <div>
3900: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 3901: "id2584614" id="id2584614"></a>6.7. How to
1.1 grant 3902: fetch files from behind a firewall</h2>
3903: </div>
3904: </div>
3905: </div>
3906:
3907: <p>If you are sitting behind a firewall which does not
3908: allow direct connections to Internet hosts (i.e.
3909: non-NAT), you may specify the relevant proxy hosts. This
3910: is done using an environment variable in the form of a
3911: URL e.g. in Amdahl, the machine “<span class=
3912: "quote">orpheus.amdahl.com</span>” is one of the
3913: firewalls, and it uses port 80 as the proxy port number.
3914: So the proxy environment variables are:</p>
3915: <pre class="programlisting">
3916: ftp_proxy=ftp://orpheus.amdahl.com:80/
3917: http_proxy=http://orpheus.amdahl.com:80/
3918: </pre>
3919: </div>
3920:
3921: <div class="sect1" lang="en" xml:lang="en">
3922: <div class="titlepage">
3923: <div>
3924: <div>
3925: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 3926: "id2584628" id="id2584628"></a>6.8. How do I
1.7 wiz 3927: tell <span><strong class="command">make
3928: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 3929: </div>
3930: </div>
3931: </div>
3932:
3933: <p>This depends on which utility is used to retrieve
1.7 wiz 3934: distfiles. From <code class="filename">bsd.pkg.mk</code>,
3935: <code class="varname">FETCH_CMD</code> is assigned the
3936: first available command from the following list:</p>
1.1 grant 3937: <pre class="programlisting">
3938: ${LOCALBASE}/bin/ftp
3939: /usr/bin/ftp
3940: </pre>
3941:
3942: <p>On a default NetBSD installation, this will be
1.7 wiz 3943: <code class="filename">/usr/bin/ftp</code>, which
1.1 grant 3944: automatically tries passive connections first, and falls
3945: back to active connections if the server refuses to do
3946: passive. For the other tools, add the following to your
1.7 wiz 3947: <code class="filename">/etc/mk.conf</code> file:
3948: <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 3949:
1.7 wiz 3950: <p>Having that option present will prevent <code class=
3951: "filename">/usr/bin/ftp</code> from falling back to
3952: active transfers.</p>
1.1 grant 3953: </div>
3954:
3955: <div class="sect1" lang="en" xml:lang="en">
3956: <div class="titlepage">
3957: <div>
3958: <div>
3959: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 3960: "id2584747" id="id2584747"></a>6.9. How to
1.1 grant 3961: fetch all distfiles at once</h2>
3962: </div>
3963: </div>
3964: </div>
3965:
3966: <p>You would like to download all the distfiles in a
3967: single batch from work or university, where you can't run
1.7 wiz 3968: a <span><strong class="command">make
3969: fetch</strong></span>. There is an archive of distfiles
3970: on <a href=
1.1 grant 3971: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
3972: target="_top">ftp.NetBSD.org</a>, but downloading the
3973: entire directory may not be appropriate.</p>
3974:
1.7 wiz 3975: <p>The answer here is to do a <span><strong class=
3976: "command">make fetch-list</strong></span> in <code class=
3977: "filename">/usr/pkgsrc</code> or one of it's
1.1 grant 3978: subdirectories, carry the resulting list to your machine
3979: at work/school and use it there If you don't have a
3980: NetBSD-compatible ftp(1) (like lukemftp) at work, don't
1.7 wiz 3981: forget to set <code class="varname">FETCH_CMD</code> to
1.1 grant 3982: something that fetches a URL:</p>
3983:
3984: <p>At home:</p>
3985: <pre class="screen">
1.7 wiz 3986: <code class="prompt">%</code> <strong class=
3987: "userinput"><code>cd /usr/pkgsrc</code></strong>
3988: <code class="prompt">%</code> <strong class=
3989: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
3990: <code class="prompt">%</code> <strong class=
3991: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 3992: </pre>
3993:
3994: <p>At work:</p>
3995: <pre class="screen">
1.7 wiz 3996: <code class="prompt">%</code> <strong class=
3997: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 3998: </pre>
3999:
1.7 wiz 4000: <p>then tar up <code class=
4001: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 4002:
4003: <p>If you have a machine running NetBSD, and you want to
4004: get <span class="emphasis"><em>all</em></span> distfiles
4005: (even ones that aren't for your machine architecture),
4006: you can do so by using the above-mentioned
1.7 wiz 4007: <span><strong class="command">make
4008: fetch-list</strong></span> approach, or fetch the
4009: distfiles directly by running:</p>
1.1 grant 4010: <pre class="screen">
1.7 wiz 4011: <code class="prompt">%</code> <strong class=
4012: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 4013: </pre>
4014:
1.7 wiz 4015: <p>If you even decide to ignore <code class=
4016: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
4017: can get everything by running:</p>
1.1 grant 4018: <pre class="screen">
1.7 wiz 4019: <code class="prompt">%</code> <strong class=
4020: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 4021: </pre>
4022: </div>
4023:
4024: <div class="sect1" lang="en" xml:lang="en">
4025: <div class="titlepage">
4026: <div>
4027: <div>
4028: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 4029: "id2584887" id="id2584887"></a>6.10. What does
1.1 grant 4030: “<span class="quote">Don't know how to make
4031: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
4032: </div>
4033: </div>
4034: </div>
4035:
4036: <p>When compiling the <a xmlns=
4037: "http://www.w3.org/TR/xhtml1/transitional" href=
4038: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.7 wiz 4039: class="pkgname">pkgtools/pkg_install</a> package, you get
4040: the error from make that it doesn't know how to make
4041: <code class="filename">/usr/share/tmac/tmac.andoc</code>?
4042: This indicates that you don't have installed the
4043: “<span class="quote">text</span>” set on your
4044: machine (nroff, ...). It is recommended to do that to
4045: format manpages.</p>
1.1 grant 4046:
4047: <p>In the case of the <a xmlns=
4048: "http://www.w3.org/TR/xhtml1/transitional" href=
4049: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.7 wiz 4050: class="pkgname">pkgtools/pkg_install</a> package, you can
4051: get away with setting <code class=
4052: "varname">NOMAN=YES</code> either in the environment or
4053: in <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 4054: </div>
4055:
4056: <div class="sect1" lang="en" xml:lang="en">
4057: <div class="titlepage">
4058: <div>
4059: <div>
4060: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 4061: "id2584925" id="id2584925"></a>6.11. What does
1.1 grant 4062: “<span class="quote">Could not find
4063: bsd.own.mk</span>” mean?</h2>
4064: </div>
4065: </div>
4066: </div>
4067:
1.7 wiz 4068: <p>You didn't install the compiler set, <code class=
4069: "filename">comp.tgz</code>, when you installed your
4070: NetBSD machine. Please get it and install it, by
4071: extracting it in <code class="filename">/</code>:</p>
1.1 grant 4072: <pre class="screen">
1.7 wiz 4073: <code class="prompt">#</code> <strong class=
4074: "userinput"><code>cd /</code></strong>
4075: <code class="prompt">#</code> <strong class=
4076: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 4077: </pre>
4078:
1.7 wiz 4079: <p><code class="filename">comp.tgz</code> is part of
4080: every NetBSD release. Get the one that corresponds to
4081: your release (determine via <span><strong class=
4082: "command">uname -r</strong></span>).</p>
1.1 grant 4083: </div>
4084:
4085: <div class="sect1" lang="en" xml:lang="en">
4086: <div class="titlepage">
4087: <div>
4088: <div>
4089: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 4090: "id2584983" id="id2584983"></a>6.12. Using
1.1 grant 4091: 'sudo' with pkgsrc</h2>
4092: </div>
4093: </div>
4094: </div>
4095:
4096: <p>When installing packages as non-root user and using
4097: the just-in-time su(1) feature of pkgsrc, it can become
4098: annoying to type in the root password for each required
4099: package installed. To avoid this, the sudo package can be
4100: used, which does password caching over a limited time. To
4101: use it, install sudo (either as binary package or from
4102: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
4103: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.7 wiz 4104: class="pkgname">security/sudo</a>) and then put the
4105: following into your <code class=
4106: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4107: <pre class="programlisting">
4108: .if exists(/usr/pkg/bin/sudo)
4109: SU_CMD=/usr/pkg/bin/sudo /bin/sh -c
4110: .endif
4111:
4112: </pre>
4113: </div>
4114:
4115: <div class="sect1" lang="en" xml:lang="en">
4116: <div class="titlepage">
4117: <div>
4118: <div>
4119: <h2 class="title" style="clear: both"><a name=
4120: "faq.conf" id=
4121: "faq.conf"></a>6.13. Configuration files
4122: handling and placement</h2>
4123: </div>
4124: </div>
4125: </div>
4126:
1.7 wiz 4127: <p>The global variable <code class=
4128: "varname">PKG_SYSCONFBASE</code> (and some others) can be
4129: set by the system administrator in <code class=
4130: "filename">/etc/mk.conf</code> to define the place where
1.1 grant 4131: configuration files get installed. Therefore, packages
4132: must be adapted to support this feature. Keep in mind
4133: that you should only install files that are strictly
4134: necessary in the configuration directory, files that can
1.7 wiz 4135: go to <code class="filename">$PREFIX/share</code> should
4136: go there.</p>
1.1 grant 4137:
4138: <p>We will take a look at available variables first
1.7 wiz 4139: (<code class="filename">bsd.pkg.mk</code> contains more
4140: information). <code class="varname">PKG_SYSCONFDIR</code>
4141: is where the configuration files for a package may be
4142: found (that is, the full path, e.g. <code class=
4143: "filename">/etc</code> or <code class=
4144: "filename">/usr/pkg/etc</code>). This value may be
1.1 grant 4145: customized in various ways:</p>
4146:
4147: <div class="orderedlist">
4148: <ol type="1">
4149: <li>
1.7 wiz 4150: <p><code class="varname">PKG_SYSCONFBASE</code> is
4151: the main config directory under which all package
1.1 grant 4152: configuration files are to be found. Users will
1.7 wiz 4153: typically want to set it to <code class=
4154: "filename">/etc</code>, or accept the default
4155: location of <code class=
4156: "filename">$PREFIX/etc</code>.</p>
1.1 grant 4157: </li>
4158:
4159: <li>
1.7 wiz 4160: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
4161: is the subdirectory of <code class=
4162: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 4163: configuration files for a particular package may be
1.7 wiz 4164: found. Defaults to <code class=
4165: "varname">${SYSCONFBASE}</code>.</p>
1.1 grant 4166: </li>
4167:
4168: <li>
1.7 wiz 4169: <p><code class="varname">PKG_SYSCONFVAR</code> is
4170: the special suffix used to distinguish any
4171: overriding values for a particular package (see
4172: next item). It defaults to <code class=
4173: "varname">${PKGBASE}</code>, but for a collection
4174: of related packages that should all have the same
4175: <code class="varname">PKG_SYSCONFDIR</code> value,
4176: it can be set in each of the package Makefiles to a
4177: common value.</p>
1.1 grant 4178: </li>
4179:
4180: <li>
1.7 wiz 4181: <p><code class=
4182: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
4183: overrides the value of <code class=
4184: "varname">${PKG_SYSCONFDIR}</code> for packages
4185: with the same value for <code class=
4186: "varname">PKG_SYSCONFVAR</code>.</p>
1.1 grant 4187:
4188: <p>As an example, all the various KDE packages may
1.7 wiz 4189: want to set <code class=
4190: "varname">PKG_SYSCONFVAR</code> to
4191: “<span class="quote">kde</span>” so
4192: admins can set <code class=
4193: "varname">PKG_SYSCONFDIR.kde</code> in <code class=
4194: "filename">/etc/mk.conf</code> to define where to
1.1 grant 4195: install KDE config files.</p>
4196: </li>
4197: </ol>
4198: </div>
4199:
4200: <p>Programs' configuration directory should be defined
4201: during the configure stage. Packages that use GNU
4202: autoconf can usually do this by using the
4203: “<span class="quote">--sysconfdir</span>”
4204: parameter, but this brings some problems as we will see
4205: now. When you change this pathname in packages, you
4206: should not allow them to install files in that directory
4207: directly. Instead they need to install those files under
1.7 wiz 4208: <code class="filename">share/examples/${PKGNAME}</code>
4209: so <code class="filename">PLIST</code> can register
4210: them.</p>
1.1 grant 4211:
4212: <p>Once you have the required configuration files in
1.7 wiz 4213: place (under the <code class=
4214: "filename">share/examples</code> directory) the variable
4215: <code class="varname">CONF_FILES</code> should be set to
4216: copy them into <code class=
4217: "varname">PKG_SYSCONFDIR</code>. The contents of this
4218: variable is formed by pairs of filenames; the first
1.1 grant 4219: element of the pair specifies the file inside the
1.7 wiz 4220: examples directory (registered by <code class=
4221: "filename">PLIST</code>) and the second element specifies
1.1 grant 4222: the target file. This is done this way to allow binary
4223: packages to place files in the right directory using
1.7 wiz 4224: <code class="filename">INSTALL</code>/<code class=
4225: "filename">DEINSTALL</code> scripts which are created
4226: automatically. The package <code class=
4227: "filename">Makefile</code> must also set <code class=
4228: "varname">USE_PKGINSTALL=YES</code> to use these
1.1 grant 4229: automatically generated scripts. The automatic copying of
4230: config files can be toggled by setting the environment
1.7 wiz 4231: variable <code class="varname">PKG_CONFIG</code> prior to
1.1 grant 4232: package installation.</p>
4233:
4234: <p>Here is an example, taken from mail/mutt/Makefile:</p>
4235: <pre class="programlisting">
4236: EGDIR= ${PREFIX}/share/doc/mutt/samples
4237: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
4238: </pre>
4239:
4240: <p>As you can see, this package installs configuration
1.7 wiz 4241: files inside <code class="varname">EGDIR</code>, which
4242: are registered by <code class="filename">PLIST</code>.
4243: After that, the variable <code class=
4244: "varname">CONF_FILES</code> lists the installed file
4245: first and then the target file. Users will also get an
4246: automatic message when files are installed using this
4247: method.</p>
1.1 grant 4248: </div>
4249:
4250: <div class="sect1" lang="en" xml:lang="en">
4251: <div class="titlepage">
4252: <div>
4253: <div>
4254: <h2 class="title" style="clear: both"><a name=
4255: "audit-packages" id=
4256: "audit-packages"></a>6.14. Automated security
4257: checks</h2>
4258: </div>
4259: </div>
4260: </div>
4261:
4262: <p>Please be aware that there can often be bugs in
4263: third-party software, and some of these bugs can leave a
4264: machine vulnerable to exploitation by attackers. In an
4265: effort to lessen the exposure, the NetBSD packages team
4266: maintains a database of known-exploits to packages which
4267: have at one time been included in pkgsrc. The database
4268: can be downloaded automatically, and a security audit of
4269: all packages installed on a system can take place. To do
4270: this, install the <a xmlns=
4271: "http://www.w3.org/TR/xhtml1/transitional" href=
4272: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.7 wiz 4273: class="pkgname">security/audit-packages</a> package. It
4274: has two components:</p>
1.1 grant 4275:
4276: <div class="orderedlist">
4277: <ol type="1">
4278: <li>
4279: <p>“<span class=
4280: "quote">download-vulnerability-list</span>”,
4281: an easy way to download a list of the security
4282: vulnerabilities information. This list is kept up
4283: to date by the NetBSD security officer and the
4284: NetBSD packages team, and is distributed from the
4285: NetBSD ftp server:</p>
4286:
4287: <p><a href=
4288: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.7 wiz 4289: target=
4290: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 4291: </li>
4292:
4293: <li>
4294: <p>“<span class=
4295: "quote">audit-packages</span>”, an easy way
4296: to audit the current machine, checking each
4297: vulnerability which is known. If a vulnerable
4298: package is installed, it will be shown by output to
4299: stdout, including a description of the type of
4300: vulnerability, and a URL containing more
4301: information.</p>
4302: </li>
4303: </ol>
4304: </div>
4305:
4306: <p>Use of the audit-packages package is strongly
4307: recommended!</p>
4308:
4309: <p>The following message is displayed as part of the
4310: audit-packages installation procedure:</p>
4311: <pre class="screen">
4312: ===========================================================================
1.11 ben 4313: $NetBSD: faq.xml,v 1.2 2004/11/20 13:25:22 hubertf Exp $
1.1 grant 4314:
4315: You may wish to have the vulnerabilities file downloaded daily so that
4316: it remains current. This may be done by adding an appropriate entry
4317: to the root users crontab(5) entry. For example the entry
4318:
4319: # download vulnerabilities file
4320: 0 3 * * * ${PREFIX}/sbin/download-vulnerability-list >/dev/null 2>&1
4321:
4322: will update the vulnerability list every day at 3AM. You may wish to do
4323: this more often than once a day.
4324:
4325: In addition, you may wish to run the package audit from the daily
4326: security script. This may be accomplished by adding the following
4327: lines to /etc/security.local
4328:
4329: if [ -x ${PREFIX}/sbin/audit-packages ]; then
4330: ${PREFIX}/sbin/audit-packages
4331: fi
4332:
4333: ===========================================================================
4334:
4335: </pre>
4336: </div>
4337: </div>
4338: </div>
4339:
4340: <div class="part" lang="en" xml:lang="en">
4341: <div class="titlepage">
4342: <div>
4343: <div>
4344: <h1 class="title"><a name="developers-guide" id=
1.2 hubertf 4345: "developers-guide"></a>The pkgsrc developer's
4346: guide</h1>
1.1 grant 4347: </div>
4348: </div>
4349: </div>
4350:
4351: <div class="toc">
4352: <p><b>Table of Contents</b></p>
4353:
4354: <dl>
4355: <dt><span class="chapter"><a href="#components">7.
4356: Package components - files, directories and
4357: contents</a></span></dt>
4358:
4359: <dd>
4360: <dl>
4361: <dt><span class="sect1"><a href=
1.7 wiz 4362: "#components.Makefile">7.1. <code class=
4363: "filename">Makefile</code></a></span></dt>
1.1 grant 4364:
4365: <dt><span class="sect1"><a href=
1.7 wiz 4366: "#components.distinfo">7.2. <code class=
4367: "filename">distinfo</code></a></span></dt>
1.1 grant 4368:
4369: <dt><span class="sect1"><a href=
4370: "#components.patches">7.3. patches/*</a></span></dt>
4371:
1.12 ! agc 4372: <dt><span class="sect1"><a href="#id2586097">7.4.
1.1 grant 4373: Other mandatory files</a></span></dt>
4374:
4375: <dt><span class="sect1"><a href=
4376: "#components.optional">7.5. Optional
4377: files</a></span></dt>
4378:
1.12 ! agc 4379: <dt><span class="sect1"><a href="#id2586222">7.6.
1.7 wiz 4380: <code class="filename">work*</code></a></span></dt>
1.1 grant 4381:
1.12 ! agc 4382: <dt><span class="sect1"><a href="#id2586310">7.7.
1.7 wiz 4383: <code class="filename">files/*</code></a></span></dt>
1.1 grant 4384: </dl>
4385: </dd>
4386:
4387: <dt><span class="chapter"><a href="#plist">8. PLIST
4388: issues</a></span></dt>
4389:
4390: <dd>
4391: <dl>
1.12 ! agc 4392: <dt><span class="sect1"><a href="#id2586364">8.1. RCS
1.1 grant 4393: ID</a></span></dt>
4394:
1.12 ! agc 4395: <dt><span class="sect1"><a href="#id2586379">8.2.
1.7 wiz 4396: Semi-automatic <code class="filename">PLIST</code>
4397: generation</a></span></dt>
1.1 grant 4398:
4399: <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.7 wiz 4400: Tweaking output of <span><strong class="command">make
4401: print-PLIST</strong></span></a></span></dt>
1.1 grant 4402:
4403: <dt><span class="sect1"><a href="#plist.misc">8.4.
4404: Variable substitution in PLIST</a></span></dt>
4405:
1.12 ! agc 4406: <dt><span class="sect1"><a href="#id2586769">8.5.
1.1 grant 4407: Manpage-compression</a></span></dt>
4408:
1.12 ! agc 4409: <dt><span class="sect1"><a href="#id2586810">8.6.
1.7 wiz 4410: Changing PLIST source with <code class=
4411: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 4412:
1.12 ! agc 4413: <dt><span class="sect1"><a href="#id2586827">8.7.
1.1 grant 4414: Platform specific and differing
4415: PLISTs</a></span></dt>
4416:
4417: <dt><span class="sect1"><a href=
4418: "#faq.common-dirs">8.8. Sharing directories between
4419: packages</a></span></dt>
4420: </dl>
4421: </dd>
4422:
4423: <dt><span class="chapter"><a href="#buildlink">9.
4424: Buildlink methodology</a></span></dt>
4425:
4426: <dd>
4427: <dl>
1.12 ! agc 4428: <dt><span class="sect1"><a href="#id2587099">9.1.
1.1 grant 4429: Converting packages to use buildlink3</a></span></dt>
4430:
1.12 ! agc 4431: <dt><span class="sect1"><a href="#id2587290">9.2.
1.7 wiz 4432: Writing <code class="filename">buildlink3.mk</code>
4433: files</a></span></dt>
1.1 grant 4434:
4435: <dd>
4436: <dl>
4437: <dt><span class="sect2"><a href=
1.12 ! agc 4438: "#id2587496">9.2.1. Anatomy of a buildlink3.mk
1.1 grant 4439: file</a></span></dt>
4440:
4441: <dt><span class="sect2"><a href=
1.12 ! agc 4442: "#id2588073">9.2.2. Updating <code class=
1.7 wiz 4443: "varname">BUILDLINK_DEPENDS.<em class=
4444: "replaceable"><code>pkg</code></em></code> in
4445: <code class="filename">buildlink3.mk</code>
1.1 grant 4446: files</a></span></dt>
4447: </dl>
4448: </dd>
4449:
1.12 ! agc 4450: <dt><span class="sect1"><a href="#id2588152">9.3.
1.7 wiz 4451: Writing <code class="filename">builtin.mk</code>
4452: files</a></span></dt>
1.1 grant 4453:
4454: <dd>
4455: <dl>
4456: <dt><span class="sect2"><a href=
1.12 ! agc 4457: "#id2588233">9.3.1. Anatomy of a <code class=
1.7 wiz 4458: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 4459:
4460: <dt><span class="sect2"><a href=
1.12 ! agc 4461: "#id2588392">9.3.2. Global preferences for native
1.1 grant 4462: or pkgsrc software</a></span></dt>
4463: </dl>
4464: </dd>
4465: </dl>
4466: </dd>
4467:
4468: <dt><span class="chapter"><a href="#options">10. Options
4469: handling</a></span></dt>
4470:
4471: <dd>
4472: <dl>
1.12 ! agc 4473: <dt><span class="sect1"><a href="#id2588533">10.1.
1.1 grant 4474: Global default options</a></span></dt>
4475:
1.12 ! agc 4476: <dt><span class="sect1"><a href="#id2588548">10.2.
1.7 wiz 4477: Converting packages to use <code class=
4478: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 4479: </dl>
4480: </dd>
4481:
4482: <dt><span class="chapter"><a href="#build">11. The build
4483: process</a></span></dt>
4484:
4485: <dd>
4486: <dl>
4487: <dt><span class="sect1"><a href="#build.prefix">11.1.
4488: Program location</a></span></dt>
4489:
1.12 ! agc 4490: <dt><span class="sect1"><a href="#id2589156">11.2.
1.1 grant 4491: Main targets</a></span></dt>
4492:
4493: <dt><span class="sect1"><a href=
4494: "#build.helpful-targets">11.3. Other helpful
4495: targets</a></span></dt>
4496: </dl>
4497: </dd>
4498:
4499: <dt><span class="chapter"><a href="#fixes">12. Notes on
4500: fixes for packages</a></span></dt>
4501:
4502: <dd>
4503: <dl>
1.12 ! agc 4504: <dt><span class="sect1"><a href="#id2590556">12.1.
1.1 grant 4505: General operation</a></span></dt>
4506:
4507: <dd>
4508: <dl>
4509: <dt><span class="sect2"><a href=
1.12 ! agc 4510: "#id2590560">12.1.1. How to pull in variables
1.1 grant 4511: from /etc/mk.conf</a></span></dt>
4512:
4513: <dt><span class="sect2"><a href=
1.12 ! agc 4514: "#id2590643">12.1.2. Restricted
1.1 grant 4515: packages</a></span></dt>
4516:
4517: <dt><span class="sect2"><a href=
4518: "#dependencies">12.1.3. Handling
4519: dependencies</a></span></dt>
4520:
4521: <dt><span class="sect2"><a href=
1.12 ! agc 4522: "#id2591226">12.1.4. Handling conflicts with
1.1 grant 4523: other packages</a></span></dt>
4524:
4525: <dt><span class="sect2"><a href=
1.12 ! agc 4526: "#id2591276">12.1.5. Packages that cannot or
1.1 grant 4527: should not be built</a></span></dt>
4528:
4529: <dt><span class="sect2"><a href=
1.12 ! agc 4530: "#id2591302">12.1.6. Packages which should not be
1.1 grant 4531: deleted, once installed</a></span></dt>
4532:
4533: <dt><span class="sect2"><a href=
4534: "#security-handling">12.1.7. Handling packages
4535: with security problems</a></span></dt>
4536:
4537: <dt><span class="sect2"><a href=
1.12 ! agc 4538: "#id2591462">12.1.8. How to handle compiler
1.1 grant 4539: bugs</a></span></dt>
4540:
4541: <dt><span class="sect2"><a href=
1.12 ! agc 4542: "#id2591484">12.1.9. How to handle incrementing
1.1 grant 4543: versions when fixing an existing
4544: package</a></span></dt>
4545:
4546: <dt><span class="sect2"><a href=
1.12 ! agc 4547: "#id2591533">12.1.10. Portability of
1.1 grant 4548: packages</a></span></dt>
4549: </dl>
4550: </dd>
4551:
1.12 ! agc 4552: <dt><span class="sect1"><a href="#id2591626">12.2.
1.1 grant 4553: Possible downloading issues</a></span></dt>
4554:
4555: <dd>
4556: <dl>
4557: <dt><span class="sect2"><a href=
1.12 ! agc 4558: "#id2591629">12.2.1. Packages whose distfiles
1.1 grant 4559: aren't available for plain
4560: downloading</a></span></dt>
4561:
4562: <dt><span class="sect2"><a href=
1.12 ! agc 4563: "#id2591692">12.2.2. How to handle modified
1.1 grant 4564: distfiles with the 'old' name</a></span></dt>
4565: </dl>
4566: </dd>
4567:
1.12 ! agc 4568: <dt><span class="sect1"><a href="#id2591704">12.3.
1.1 grant 4569: Configuration gotchas</a></span></dt>
4570:
4571: <dd>
4572: <dl>
4573: <dt><span class="sect2"><a href=
4574: "#fixes.libtool">12.3.1. Shared libraries -
4575: libtool</a></span></dt>
4576:
4577: <dt><span class="sect2"><a href=
1.12 ! agc 4578: "#id2592180">12.3.2. Using libtool on GNU
1.1 grant 4579: packages that already support
4580: libtool</a></span></dt>
4581:
4582: <dt><span class="sect2"><a href=
1.12 ! agc 4583: "#id2592264">12.3.3. GNU
1.1 grant 4584: Autoconf/Automake</a></span></dt>
4585: </dl>
4586: </dd>
4587:
1.12 ! agc 4588: <dt><span class="sect1"><a href="#id2592309">12.4.
1.1 grant 4589: Building considerations</a></span></dt>
4590:
4591: <dd>
4592: <dl>
4593: <dt><span class="sect2"><a href=
1.12 ! agc 4594: "#id2592312">12.4.1. CPP defines</a></span></dt>
1.1 grant 4595: </dl>
4596: </dd>
4597:
1.12 ! agc 4598: <dt><span class="sect1"><a href="#id2592342">12.5.
1.1 grant 4599: Package specific actions</a></span></dt>
4600:
4601: <dd>
4602: <dl>
4603: <dt><span class="sect2"><a href=
1.12 ! agc 4604: "#id2592345">12.5.1. Package configuration
1.1 grant 4605: files</a></span></dt>
4606:
4607: <dt><span class="sect2"><a href=
1.12 ! agc 4608: "#id2592516">12.5.2. User
1.2 hubertf 4609: interaction</a></span></dt>
1.1 grant 4610:
4611: <dt><span class="sect2"><a href=
1.12 ! agc 4612: "#id2592561">12.5.3. Handling
1.1 grant 4613: licenses</a></span></dt>
4614:
4615: <dt><span class="sect2"><a href=
1.12 ! agc 4616: "#id2592644">12.5.4. Creating an account from a
1.1 grant 4617: package</a></span></dt>
4618:
4619: <dt><span class="sect2"><a href=
1.12 ! agc 4620: "#id2592774">12.5.5. Installing score
1.1 grant 4621: files</a></span></dt>
4622:
4623: <dt><span class="sect2"><a href=
1.12 ! agc 4624: "#id2592818">12.5.6. Packages providing login
1.1 grant 4625: shells</a></span></dt>
4626:
4627: <dt><span class="sect2"><a href=
1.12 ! agc 4628: "#id2593012">12.5.7. Packages containing perl
1.1 grant 4629: scripts</a></span></dt>
4630:
4631: <dt><span class="sect2"><a href=
1.12 ! agc 4632: "#id2593030">12.5.8. Packages with hardcoded
1.1 grant 4633: paths to other interpreters</a></span></dt>
4634:
4635: <dt><span class="sect2"><a href=
1.12 ! agc 4636: "#id2593051">12.5.9. Packages installing perl
1.1 grant 4637: modules</a></span></dt>
4638:
4639: <dt><span class="sect2"><a href=
4640: "#faq.info-files">12.5.10. Packages installing
4641: info files</a></span></dt>
4642:
4643: <dt><span class="sect2"><a href=
1.12 ! agc 4644: "#id2593408">12.5.11. Packages installing GConf2
1.1 grant 4645: data files</a></span></dt>
4646:
4647: <dt><span class="sect2"><a href=
1.12 ! agc 4648: "#id2593508">12.5.12. Packages installing
1.1 grant 4649: scrollkeeper data files</a></span></dt>
4650:
4651: <dt><span class="sect2"><a href=
1.12 ! agc 4652: "#id2593559">12.5.13. Packages installing X11
1.1 grant 4653: fonts</a></span></dt>
4654:
4655: <dt><span class="sect2"><a href=
1.12 ! agc 4656: "#id2593606">12.5.14. Packages installing GTK2
1.1 grant 4657: modules</a></span></dt>
4658:
4659: <dt><span class="sect2"><a href=
1.12 ! agc 4660: "#id2593675">12.5.15. Packages installing SGML or
1.1 grant 4661: XML data</a></span></dt>
4662:
4663: <dt><span class="sect2"><a href=
1.12 ! agc 4664: "#id2593728">12.5.16. Packages installing
1.1 grant 4665: extensions to the MIME database</a></span></dt>
4666:
4667: <dt><span class="sect2"><a href=
1.12 ! agc 4668: "#id2593798">12.5.17. Packages using
1.1 grant 4669: intltool</a></span></dt>
4670: </dl>
4671: </dd>
4672:
1.12 ! agc 4673: <dt><span class="sect1"><a href="#id2593812">12.6.
1.1 grant 4674: Feedback to the author</a></span></dt>
4675: </dl>
4676: </dd>
4677:
4678: <dt><span class="chapter"><a href="#debug">13.
4679: Debugging</a></span></dt>
4680:
4681: <dt><span class="chapter"><a href="#submit">14.
4682: Submitting and Committing</a></span></dt>
4683:
4684: <dd>
4685: <dl>
1.12 ! agc 4686: <dt><span class="sect1"><a href="#id2594342">14.1.
1.1 grant 4687: Submitting your packages</a></span></dt>
4688:
1.12 ! agc 4689: <dt><span class="sect1"><a href="#id2594389">14.2.
1.1 grant 4690: Committing: Importing a package into
4691: CVS</a></span></dt>
4692:
1.12 ! agc 4693: <dt><span class="sect1"><a href="#id2594520">14.3.
1.2 hubertf 4694: Updating a package to a newer version</a></span></dt>
1.1 grant 4695:
1.12 ! agc 4696: <dt><span class="sect1"><a href="#id2594539">14.4.
1.2 hubertf 4697: Moving a package in pkgsrc</a></span></dt>
1.1 grant 4698: </dl>
4699: </dd>
4700: </dl>
4701: </div>
4702:
4703: <div class="chapter" lang="en" xml:lang="en">
4704: <div class="titlepage">
4705: <div>
4706: <div>
4707: <h2 class="title"><a name="components" id=
4708: "components"></a>Chapter 7. Package
4709: components - files, directories and contents</h2>
4710: </div>
4711: </div>
4712: </div>
4713:
4714: <div class="toc">
4715: <p><b>Table of Contents</b></p>
4716:
4717: <dl>
4718: <dt><span class="sect1"><a href=
1.7 wiz 4719: "#components.Makefile">7.1. <code class=
4720: "filename">Makefile</code></a></span></dt>
1.1 grant 4721:
4722: <dt><span class="sect1"><a href=
1.7 wiz 4723: "#components.distinfo">7.2. <code class=
4724: "filename">distinfo</code></a></span></dt>
1.1 grant 4725:
4726: <dt><span class="sect1"><a href=
4727: "#components.patches">7.3. patches/*</a></span></dt>
4728:
1.12 ! agc 4729: <dt><span class="sect1"><a href="#id2586097">7.4. Other
1.1 grant 4730: mandatory files</a></span></dt>
4731:
4732: <dt><span class="sect1"><a href=
4733: "#components.optional">7.5. Optional
4734: files</a></span></dt>
4735:
1.12 ! agc 4736: <dt><span class="sect1"><a href="#id2586222">7.6.
1.7 wiz 4737: <code class="filename">work*</code></a></span></dt>
1.1 grant 4738:
1.12 ! agc 4739: <dt><span class="sect1"><a href="#id2586310">7.7.
1.7 wiz 4740: <code class="filename">files/*</code></a></span></dt>
1.1 grant 4741: </dl>
4742: </div>
4743:
4744: <p>Whenever you're preparing a package, there are a number
4745: of files involved which are described in the following
4746: sections.</p>
4747:
4748: <div class="sect1" lang="en" xml:lang="en">
4749: <div class="titlepage">
4750: <div>
4751: <div>
4752: <h2 class="title" style="clear: both"><a name=
4753: "components.Makefile" id=
1.7 wiz 4754: "components.Makefile"></a>7.1. <code class=
4755: "filename">Makefile</code></h2>
1.1 grant 4756: </div>
4757: </div>
4758: </div>
4759:
4760: <p>Building, installation and creation of a binary
1.7 wiz 4761: package are all controlled by the package's <code class=
4762: "filename">Makefile</code>.</p>
1.1 grant 4763:
1.7 wiz 4764: <p>There is a <code class="filename">Makefile</code> for
4765: each package. This file includes the standard
4766: <code class="filename">bsd.pkg.mk</code> file (referenced
4767: as <code class="filename">../../mk/bsd.pkg.mk</code>),
4768: which sets all the definitions and actions necessary for
4769: the package to compile and install itself. The mandatory
4770: variables are the <code class="varname">DISTNAME</code>
4771: which specifies the base name of the distribution file to
4772: be downloaded from the site on the Internet, <code class=
4773: "varname">MASTER_SITES</code> which specifies that site,
4774: <code class="varname">CATEGORIES</code> which denotes the
4775: categories into which the package falls, <code class=
4776: "varname">PKGNAME</code> which is the name of the
4777: package, the <code class="varname">MAINTAINER</code>'s
4778: name, and the <code class="varname">COMMENT</code>
4779: variable, which should contain a one-line description of
4780: the package (the package name should not appear, it will
4781: be added automatically). The maintainer variable is there
4782: so that anyone who quibbles with the (always completely
4783: correct) decisions taken by the guy who maintains the
4784: package can complain vigorously, or send chocolate as a
4785: sign of appreciation.</p>
1.1 grant 4786:
1.7 wiz 4787: <p>The <code class="varname">MASTER_SITES</code> may be
4788: set to one of the predefined sites:</p>
1.1 grant 4789: <pre class="programlisting">
4790: ${MASTER_SITE_APACHE}
4791: ${MASTER_SITE_DEBIAN}
4792: ${MASTER_SITE_GNOME}
4793: ${MASTER_SITE_GNU}
4794: ${MASTER_SITE_GNUSTEP}
1.9 dillo 4795: ${MASTER_SITE_IFARCHIVE}
1.1 grant 4796: ${MASTER_SITE_MOZILLA}
4797: ${MASTER_SITE_PERL_CPAN}
4798: ${MASTER_SITE_SOURCEFORGE}
4799: ${MASTER_SITE_SUNSITE}
4800: ${MASTER_SITE_R_CRAN}
4801: ${MASTER_SITE_SUSE}
4802: ${MASTER_SITE_TEX_CTAN}
4803: ${MASTER_SITE_XCONTRIB}
4804: ${MASTER_SITE_XEMACS}
4805: </pre>
4806:
4807: <p>If one of these predefined sites is chosen, you may
4808: require the ability to specify a subdirectory of that
4809: site. Since these macros may expand to more than one
4810: actual site, you <span class=
4811: "emphasis"><em>must</em></span> use the following
4812: construct to specify a subdirectory:</p>
4813: <pre class="programlisting">
4814: ${MASTER_SITE_GNU:=subdirectory/name/}
4815: ${MASTER_SITE_SOURCEFORGE:=project_name/}
4816: </pre>
4817:
4818: <p>Note the trailing slash after the subdirectory
4819: name.</p>
4820:
4821: <div class="note" style=
4822: "margin-left: 0.5in; margin-right: 0.5in;">
4823: <h3 class="title">Note</h3>
4824:
1.7 wiz 4825: <p><code class="varname">MASTER_SITE_SUBDIR</code> has
4826: been deprecated and <span class="emphasis"><em>should
4827: no longer be used</em></span>.</p>
1.1 grant 4828: </div>
4829:
1.7 wiz 4830: <p>If the package has multiple <code class=
4831: "varname">DISTFILES</code> or multiple <code class=
4832: "varname">PATCHFILES</code> from different sites, set
4833: <code class="varname">SITES_foo</code> to a list of URI's
1.1 grant 4834: where file “<span class="quote">foo</span>”
4835: may be found. “<span class=
4836: "quote">foo</span>” includes the suffix, e.g.</p>
4837: <pre class="programlisting">
4838: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
4839: DISTFILES+= foo-file.tar.gz
4840: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
4841: http://www.somewhereelse.com/mirror/somehow/
4842: </pre>
4843:
1.7 wiz 4844: <p>Note that the normal default setting of <code class=
4845: "varname">DISTFILES</code> must be made explicit if you
1.1 grant 4846: want to add to it (rather than replace it), as you
4847: usually would.</p>
4848:
4849: <p>Currently the following values are available for
1.7 wiz 4850: <code class="varname">CATEGORIES</code>. If more than one
4851: is used, they need to be separated by spaces:</p>
1.1 grant 4852: <pre class="programlisting">
4853: archivers cross geography meta-pkgs security
4854: audio databases graphics misc shells
4855: benchmarks devel ham multimedia sysutils
4856: biology editors inputmethod net textproc
4857: cad emulators lang news time
4858: chat finance mail parallel wm
4859: comms fonts math pkgtools www
4860: converters games mbone print x11
4861: </pre>
4862:
4863: <p>Please pay attention to the following gotchas:</p>
4864:
4865: <div class="itemizedlist">
4866: <ul type="disc">
4867: <li>
1.7 wiz 4868: <p>Add <code class="varname">MANCOMPRESSED</code>
4869: if manpages are installed in compressed form by the
4870: package; see comment in <code class=
4871: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 4872: </li>
4873:
4874: <li>
1.7 wiz 4875: <p>Replace <code class="filename">/usr/local</code>
1.1 grant 4876: with “<span class=
4877: "quote">${PREFIX}</span>” in all files (see
4878: patches, below).</p>
4879: </li>
4880:
4881: <li>
4882: <p>If the package installs any info files, see
4883: <a href="#faq.info-files" title=
4884: "12.5.10. Packages installing info files">Section
4885: 12.5.10, “Packages installing info
4886: files”</a>.</p>
4887: </li>
4888:
4889: <li>
1.7 wiz 4890: <p>Set <code class="varname">MAINTAINER</code> to
4891: be yourself. If you really can't maintain the
4892: package for future updates, set it to <code class=
1.1 grant 4893: "email"><<a href=
1.7 wiz 4894: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.1 grant 4895: </li>
4896:
4897: <li>
4898: <p>If a home page for the software in question
1.7 wiz 4899: exists, add the variable <code class=
4900: "varname">HOMEPAGE</code> right after <code class=
4901: "varname">MAINTAINER</code>. The value of this
1.1 grant 4902: variable should be the URL for the home page.</p>
4903: </li>
4904:
4905: <li>
1.7 wiz 4906: <p>Be sure to set the <code class=
4907: "varname">COMMENT</code> variable to a short
1.1 grant 4908: description of the package, not containing the
4909: pkg's name.</p>
4910: </li>
4911: </ul>
4912: </div>
4913: </div>
4914:
4915: <div class="sect1" lang="en" xml:lang="en">
4916: <div class="titlepage">
4917: <div>
4918: <div>
4919: <h2 class="title" style="clear: both"><a name=
4920: "components.distinfo" id=
1.7 wiz 4921: "components.distinfo"></a>7.2. <code class=
4922: "filename">distinfo</code></h2>
1.1 grant 4923: </div>
4924: </div>
4925: </div>
4926:
4927: <p>Most important, the mandatory message digest, or
4928: checksum, of all the distfiles needed for the package to
4929: compile, confirming they match the original file
4930: distributed by the author. This ensures that the distfile
4931: retrieved from the Internet has not been corrupted during
4932: transfer or altered by a malign force to introduce a
1.7 wiz 4933: security hole. It is generated using the
4934: <span><strong class="command">make
4935: makesum</strong></span> command. The digest algorithm
4936: used was, at one stage, md5, but that was felt lacking
4937: compared to sha1, and so sha1 is now the default
1.1 grant 4938: algorithm. The distfile size is also generated and stored
4939: in new distinfo files. The <a xmlns=
4940: "http://www.w3.org/TR/xhtml1/transitional" href=
4941: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.7 wiz 4942: class="pkgname">pkgtools/digest</a> utility calculates
4943: all of the digests in the distinfo file, and it provides
4944: various different algorithms. At the current time, the
4945: algorithms provided are: <span class=
4946: "emphasis"><em>md5</em></span>, <span class=
4947: "emphasis"><em>rmd160</em></span>, <span class=
4948: "emphasis"><em>sha1</em></span>, <span class=
4949: "emphasis"><em>sha256</em></span>, <span class=
4950: "emphasis"><em>sha384</em></span> and <span class=
4951: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 4952:
4953: <p>Some packages have different sets of distfiles on a
4954: per architecture basis, for example <a xmlns=
4955: "http://www.w3.org/TR/xhtml1/transitional" href=
4956: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.7 wiz 4957: class="pkgname">www/navigator</a>). These are kept in the
4958: same distinfo file and care should be taken when
4959: upgrading such a package to ensure distfile information
4960: is not lost.</p>
1.1 grant 4961:
4962: <p>The message digest/checksum for all the official
1.7 wiz 4963: patches found in the <code class=
4964: "filename">patches/</code> directory (see <a href=
4965: "#components.patches" title=
1.1 grant 4966: "7.3. patches/*">Section 7.3,
4967: “patches/*”</a>) for the package is also
1.7 wiz 4968: stored in the <code class="filename">distinfo</code>
4969: file. This is a message digest/checksum of all lines in
4970: the patch file except the NetBSD RCS Id. This file is
4971: generated by invoking <span><strong class="command">make
4972: makepatchsum</strong></span> (or <span><strong class=
4973: "command">make mps</strong></span> if you're in a
4974: hurry).</p>
1.1 grant 4975: </div>
4976:
4977: <div class="sect1" lang="en" xml:lang="en">
4978: <div class="titlepage">
4979: <div>
4980: <div>
4981: <h2 class="title" style="clear: both"><a name=
4982: "components.patches" id=
4983: "components.patches"></a>7.3. patches/*</h2>
4984: </div>
4985: </div>
4986: </div>
4987:
4988: <p>This directory contains files that are used by the
4989: <a href=
4990: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
4991: <span class="citerefentry"><span class=
4992: "refentrytitle">patch</span>(1)</span></a> command to
4993: modify the sources as distributed in the distribution
4994: file into a form that will compile and run perfectly on
4995: NetBSD. The files are applied successively in alphabetic
4996: order (as returned by a shell “<span class=
4997: "quote">patches/patch-*</span>” glob expansion), so
1.7 wiz 4998: <code class="filename">patch-aa</code> is applied before
4999: <code class="filename">patch-ab</code>, etc.</p>
1.1 grant 5000:
1.7 wiz 5001: <p>The <code class="filename">patch-*</code> files should
5002: be in <span><strong class="command">diff
5003: -bu</strong></span> format, and apply without a fuzz to
5004: avoid problems. (To force patches to apply with fuzz you
5005: can set <code class=
5006: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 5007: not put changes for more than one file into a single
5008: patch-file, as this will make future modifications more
5009: difficult.</p>
5010:
5011: <p>Similar, a file should be patched at most once, not
5012: several times by several different patches. If a file
5013: needs several patches, they should be combined into one
5014: file.</p>
5015:
5016: <p>One important thing to mention is to pay attention
5017: that no RCS IDs get stored in the patch files, as these
5018: will cause problems when later checked into the NetBSD
1.7 wiz 5019: CVS tree. Use the <span><strong class=
5020: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 5021: "http://www.w3.org/TR/xhtml1/transitional" href=
5022: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.7 wiz 5023: class="pkgname">pkgtools/pkgdiff</a> package to avoid
5024: these problems.</p>
1.1 grant 5025:
5026: <p>For even more automation, we recommend using
1.7 wiz 5027: <span><strong class="command">mkpatches</strong></span>
5028: from the same package to make a whole set of patches. You
5029: just have to backup files before you edit them to
5030: <code class="filename">filename.orig</code>, e.g. with
5031: <span><strong class="command">cp -p filename
5032: filename.orig</strong></span> or, easier, by using
5033: <span><strong class="command">pkgvi</strong></span> again
5034: from the same package. If you upgrade a package this way,
5035: you can easily compare the new set of patches with the
5036: previously existing one with <span><strong class=
5037: "command">patchdiff</strong></span>.</p>
1.1 grant 5038:
5039: <p>When you have finished a package, remember to generate
5040: the checksums for the patch files by using the
1.7 wiz 5041: <span><strong class="command">make
5042: makepatchsum</strong></span> command, see <a href=
5043: "#components.distinfo" title=
1.5 hubertf 5044: "7.2. distinfo">Section 7.2,
1.7 wiz 5045: “<code class="filename">distinfo</code>”</a>.</p>
1.1 grant 5046:
5047: <p>Patch files that are distributed by the author or
1.7 wiz 5048: other maintainers can be listed in <code class=
5049: "varname">$PATCHFILES</code>.</p>
1.1 grant 5050:
5051: <p>If it is desired to store any patches that should not
5052: be committed into pkgsrc, they can be kept outside the
1.7 wiz 5053: pkgsrc tree in the <code class=
5054: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 5055: tree there is expected to have the same
5056: “<span class="quote">category/package</span>”
5057: structure as pkgsrc, and patches are expected to be
1.7 wiz 5058: stored inside these dirs (also known as <code class=
5059: "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
5060: you want to keep a private patch for <code class=
5061: "filename">pkgsrc/graphics/png</code>, keep it in
5062: <code class=
5063: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
5064: files in the named directory are expected to be patch
1.1 grant 5065: files, and <span class="emphasis"><em>they are applied
5066: after pkgsrc patches are applied</em></span>.</p>
5067: </div>
5068:
5069: <div class="sect1" lang="en" xml:lang="en">
5070: <div class="titlepage">
5071: <div>
5072: <div>
5073: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 5074: "id2586097" id="id2586097"></a>7.4. Other
1.1 grant 5075: mandatory files</h2>
5076: </div>
5077: </div>
5078: </div>
5079:
5080: <div class="variablelist">
5081: <dl>
1.7 wiz 5082: <dt><span class="term"><code class=
5083: "filename">DESCR</code></span></dt>
1.1 grant 5084:
5085: <dd>
5086: <p>A multi-line description of the piece of
5087: software. This should include any credits where
5088: they are due. Please bear in mind that others do
5089: not share your sense of humour (or spelling
5090: idiosyncrasies), and that others will read
5091: everything that you write here.</p>
5092: </dd>
5093:
1.7 wiz 5094: <dt><span class="term"><code class=
5095: "filename">PLIST</code></span></dt>
1.1 grant 5096:
5097: <dd>
5098: <p>This file governs the files that are installed
5099: on your system: all the binaries, manual pages,
5100: etc. There are other directives which may be
5101: entered in this file, to control the creation and
5102: deletion of directories, and the location of
5103: inserted files. See <a href="#plist" title=
5104: "Chapter 8. PLIST issues">Chapter 8,
5105: <i>PLIST issues</i></a> for more information.</p>
5106: </dd>
5107: </dl>
5108: </div>
5109: </div>
5110:
5111: <div class="sect1" lang="en" xml:lang="en">
5112: <div class="titlepage">
5113: <div>
5114: <div>
5115: <h2 class="title" style="clear: both"><a name=
5116: "components.optional" id=
5117: "components.optional"></a>7.5. Optional
5118: files</h2>
5119: </div>
5120: </div>
5121: </div>
5122:
5123: <div class="variablelist">
5124: <dl>
1.7 wiz 5125: <dt><span class="term"><code class=
5126: "filename">INSTALL</code></span></dt>
1.1 grant 5127:
5128: <dd>
5129: <p>This shell script is invoked twice by <a href=
5130: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5131: <span class="citerefentry"><span class=
5132: "refentrytitle">pkg_add</span>(1)</span></a>. First
5133: time after package extraction and before files are
5134: moved in place, the second time after the files to
5135: install are moved in place. This can be used to do
5136: any custom procedures not possible with @exec
1.7 wiz 5137: commands in <code class="filename">PLIST</code>.
5138: See <a href=
1.1 grant 5139: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5140: <span class="citerefentry"><span class=
5141: "refentrytitle">pkg_add</span>(1)</span></a> and
5142: <a href=
5143: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5144: <span class="citerefentry"><span class=
5145: "refentrytitle">pkg_create</span>(1)</span></a> for
5146: more information.</p>
5147: </dd>
5148:
1.7 wiz 5149: <dt><span class="term"><code class=
5150: "filename">DEINSTALL</code></span></dt>
1.1 grant 5151:
5152: <dd>
5153: <p>This script is executed before and after any
5154: files are removed. It is this script's
5155: responsibility to clean up any additional messy
5156: details around the package's installation, since
5157: all pkg_delete knows is how to delete the files
5158: created in the original distribution. See <a href=
5159: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
5160: <span class="citerefentry"><span class=
5161: "refentrytitle">pkg_delete</span>(1)</span></a> and
5162: <a href=
5163: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5164: <span class="citerefentry"><span class=
5165: "refentrytitle">pkg_create</span>(1)</span></a> for
5166: more information.</p>
5167: </dd>
5168:
1.7 wiz 5169: <dt><span class="term"><code class=
5170: "filename">MESSAGE</code></span></dt>
1.1 grant 5171:
5172: <dd>
5173: <p>Display this file after installation of the
5174: package. Useful for things like legal notices on
5175: almost-free software and hints for updating config
5176: files after installing modules for apache, PHP etc.
5177: Please note that you can modify variables in it
1.7 wiz 5178: easily by using <code class=
5179: "varname">MESSAGE_SUBST</code> in the package's
5180: <code class="filename">Makefile</code>:</p>
1.1 grant 5181: <pre class="programlisting">
5182: MESSAGE_SUBST+= SOMEVAR="somevalue"
5183: </pre>
5184:
5185: <p>replaces "${SOMEVAR}" with “<span class=
1.7 wiz 5186: "quote">somevalue</span>” in <code class=
5187: "filename">MESSAGE</code>.</p>
1.1 grant 5188: </dd>
5189: </dl>
5190: </div>
5191: </div>
5192:
5193: <div class="sect1" lang="en" xml:lang="en">
5194: <div class="titlepage">
5195: <div>
5196: <div>
5197: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 5198: "id2586222" id=
! 5199: "id2586222"></a>7.6. <code class=
1.7 wiz 5200: "filename">work*</code></h2>
1.1 grant 5201: </div>
5202: </div>
5203: </div>
5204:
1.7 wiz 5205: <p>When you type <span><strong class=
5206: "command">make</strong></span> the distribution files are
5207: unpacked into this directory. It can be removed by
5208: running <span><strong class="command">make
5209: clean</strong></span>. Besides the sources, this
5210: directory is also used to keep various timestamp
1.1 grant 5211: files.</p>
5212:
5213: <p>If a package doesn't create a subdirectory for itself
5214: (like GNU software does, for instance), but extracts
5215: itself in the current directory, you should set
1.7 wiz 5216: <code class="varname">WRKSRC</code> accordingly, e.g.
1.1 grant 5217: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
5218: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.7 wiz 5219: class="pkgname">editors/sam</a> again, but the quick
5220: answer is:</p>
1.1 grant 5221: <pre class="programlisting">
5222: WRKSRC= ${WRKDIR}
5223: </pre>
5224:
1.7 wiz 5225: <p>Please note that the old <code class=
5226: "varname">NO_WRKSUBDIR</code> has been deprecated and
1.1 grant 5227: should not be used. Also, if your package doesn't create
1.7 wiz 5228: a subdir with the name of <code class=
5229: "varname">DISTNAME</code> but some different name, set
5230: <code class="varname">WRKSRC</code> to point to the
5231: proper name in <code class="filename">${WRKDIR}</code>.
5232: See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5233: href=
1.1 grant 5234: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.7 wiz 5235: class="pkgname">lang/tcl</a> and <a xmlns=
5236: "http://www.w3.org/TR/xhtml1/transitional" href=
5237: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
5238: class="pkgname">x11/tk</a> for examples, and here is
5239: another one:</p>
1.1 grant 5240: <pre class="programlisting">
5241: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
5242: </pre>
5243:
5244: <p>The name of the working directory created by pkgsrc is
1.7 wiz 5245: <code class="filename">work</code> by default. If the
5246: same pkgsrc tree should be used on several different
5247: platforms, the variable <code class=
5248: "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
1.1 grant 5249: attach the platform to the directory name, e.g.
1.7 wiz 5250: <code class="filename">work.i386</code> or <code class=
5251: "filename">work.sparc</code>.</p>
1.1 grant 5252: </div>
5253:
5254: <div class="sect1" lang="en" xml:lang="en">
5255: <div class="titlepage">
5256: <div>
5257: <div>
5258: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 5259: "id2586310" id=
! 5260: "id2586310"></a>7.7. <code class=
1.7 wiz 5261: "filename">files/*</code></h2>
1.1 grant 5262: </div>
5263: </div>
5264: </div>
5265:
5266: <p>If you have any files that you wish to be placed in
5267: the package prior to configuration or building, you could
5268: place these files here and use a “<span class=
5269: "quote">${CP}</span>” command in the
5270: “<span class="quote">pre-configure</span>”
5271: target to achieve this. Alternatively, you could simply
1.7 wiz 5272: diff the file against <code class=
5273: "filename">/dev/null</code> and use the patch mechanism
5274: to manage the creation of this file.</p>
1.1 grant 5275: </div>
5276: </div>
5277:
5278: <div class="chapter" lang="en" xml:lang="en">
5279: <div class="titlepage">
5280: <div>
5281: <div>
5282: <h2 class="title"><a name="plist" id=
5283: "plist"></a>Chapter 8. PLIST issues</h2>
5284: </div>
5285: </div>
5286: </div>
5287:
5288: <div class="toc">
5289: <p><b>Table of Contents</b></p>
5290:
5291: <dl>
1.12 ! agc 5292: <dt><span class="sect1"><a href="#id2586364">8.1. RCS
1.1 grant 5293: ID</a></span></dt>
5294:
1.12 ! agc 5295: <dt><span class="sect1"><a href="#id2586379">8.2.
1.7 wiz 5296: Semi-automatic <code class="filename">PLIST</code>
5297: generation</a></span></dt>
1.1 grant 5298:
5299: <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.7 wiz 5300: Tweaking output of <span><strong class="command">make
5301: print-PLIST</strong></span></a></span></dt>
1.1 grant 5302:
5303: <dt><span class="sect1"><a href="#plist.misc">8.4.
5304: Variable substitution in PLIST</a></span></dt>
5305:
1.12 ! agc 5306: <dt><span class="sect1"><a href="#id2586769">8.5.
1.1 grant 5307: Manpage-compression</a></span></dt>
5308:
1.12 ! agc 5309: <dt><span class="sect1"><a href="#id2586810">8.6.
1.7 wiz 5310: Changing PLIST source with <code class=
5311: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5312:
1.12 ! agc 5313: <dt><span class="sect1"><a href="#id2586827">8.7.
1.1 grant 5314: Platform specific and differing PLISTs</a></span></dt>
5315:
5316: <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
5317: Sharing directories between packages</a></span></dt>
5318: </dl>
5319: </div>
5320:
1.7 wiz 5321: <p>The <code class="filename">PLIST</code> file contains a
1.1 grant 5322: package's “<span class="quote">packing
5323: list</span>”, i.e. a list of files that belong to the
1.7 wiz 5324: package (relative to the <code class=
5325: "filename">${PREFIX}</code> directory it's been installed
5326: in) plus some additional statements - see the <a href=
1.1 grant 5327: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5328: <span class="citerefentry"><span class=
5329: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
5330: a full list. This chapter addresses some issues that need
1.7 wiz 5331: attention when dealing with the <code class=
5332: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 5333:
5334: <div class="sect1" lang="en" xml:lang="en">
5335: <div class="titlepage">
5336: <div>
5337: <div>
5338: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 5339: "id2586364" id="id2586364"></a>8.1. RCS
1.1 grant 5340: ID</h2>
5341: </div>
5342: </div>
5343: </div>
5344:
5345: <p>Be sure to add a RCS ID line as the first thing in any
1.7 wiz 5346: <code class="filename">PLIST</code> file you write:</p>
1.1 grant 5347: <pre class="programlisting">
1.11 ben 5348: @comment $NetBSD$
1.1 grant 5349: </pre>
5350: </div>
5351:
5352: <div class="sect1" lang="en" xml:lang="en">
5353: <div class="titlepage">
5354: <div>
5355: <div>
5356: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 5357: "id2586379" id=
! 5358: "id2586379"></a>8.2. Semi-automatic
1.7 wiz 5359: <code class="filename">PLIST</code> generation</h2>
1.1 grant 5360: </div>
5361: </div>
5362: </div>
5363:
1.7 wiz 5364: <p>You can use the <span><strong class="command">make
5365: print-PLIST</strong></span> command to output a PLIST
5366: that matches any new files since the package was
5367: extracted. See <a href="#build.helpful-targets" title=
1.1 grant 5368: "11.3. Other helpful targets">Section 11.3,
5369: “Other helpful targets”</a> for more
5370: information on this target.</p>
5371: </div>
5372:
5373: <div class="sect1" lang="en" xml:lang="en">
5374: <div class="titlepage">
5375: <div>
5376: <div>
5377: <h2 class="title" style="clear: both"><a name=
5378: "print-PLIST" id=
5379: "print-PLIST"></a>8.3. Tweaking output of
1.7 wiz 5380: <span><strong class="command">make
5381: print-PLIST</strong></span></h2>
1.1 grant 5382: </div>
5383: </div>
5384: </div>
5385:
5386: <p>If you have used any of the *-dirs packages, as
5387: explained in <a href="#faq.common-dirs" title=
5388: "8.8. Sharing directories between packages">Section 8.8,
5389: “Sharing directories between packages”</a>,
1.7 wiz 5390: you may have noticed that <span><strong class=
5391: "command">make print-PLIST</strong></span> outputs a set
5392: of <code class="varname">@comment</code>s instead of real
5393: <code class="varname">@dirrm</code> lines. You can also
5394: do this for specific directories and files, so that the
5395: results of that command are very close to reality. This
5396: helps <span class="emphasis"><em>a lot</em></span> during
5397: the update of packages.</p>
5398:
5399: <p>The <code class="varname">PRINT_PLIST_AWK</code>
5400: variable takes a set of AWK patterns and actions that are
5401: used to filter the output of print-PLIST. You can
5402: <span class="emphasis"><em>append</em></span> any chunk
5403: of AWK scripting you like to it, but be careful with
1.1 grant 5404: quoting.</p>
5405:
1.7 wiz 5406: <p>For example, to get all files inside the <code class=
5407: "filename">libdata/foo</code> directory removed from the
1.1 grant 5408: resulting PLIST:</p>
5409: <pre class="programlisting">
5410: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
5411:
5412: </pre>
5413:
1.7 wiz 5414: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 5415: lines referring to a specific (shared) directory
1.7 wiz 5416: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 5417: <pre class="programlisting">
5418: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
5419:
5420: </pre>
5421: </div>
5422:
5423: <div class="sect1" lang="en" xml:lang="en">
5424: <div class="titlepage">
5425: <div>
5426: <div>
5427: <h2 class="title" style="clear: both"><a name=
5428: "plist.misc" id="plist.misc"></a>8.4. Variable
5429: substitution in PLIST</h2>
5430: </div>
5431: </div>
5432: </div>
5433:
5434: <p>A number of variables are substituted automatically in
5435: PLISTs when a package is installed on a system. This
5436: includes the following variables:</p>
5437:
5438: <div class="variablelist">
5439: <dl>
1.7 wiz 5440: <dt><span class="term"><code class=
5441: "varname">${MACHINE_ARCH}</code>, <code class=
5442: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 5443:
5444: <dd>
5445: <p>Some packages like emacs and perl embed
5446: information about which architecture they were
5447: built on into the pathnames where they install
5448: their file. To handle this case, PLIST will be
5449: preprocessed before actually used, and the symbol
1.7 wiz 5450: “<span class="quote"><code class=
5451: "varname">${MACHINE_ARCH}</code></span>” will
5452: be replaced by what <span><strong class=
5453: "command">uname -p</strong></span> gives. The same
5454: is done if the string <code class=
5455: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
5456: PLIST somewhere - use this on packages that have
5457: GNU autoconf created configure scripts.</p>
1.1 grant 5458:
5459: <div class="note" style=
5460: "margin-left: 0.5in; margin-right: 0.5in;">
5461: <h3 class="title">Legacy note</h3>
5462:
5463: <p>There used to be a symbol “<span class=
1.7 wiz 5464: "quote"><code class=
5465: "varname">$ARCH</code></span>” that was
5466: replaced by the output of <span><strong class=
5467: "command">uname -m</strong></span>, but that's no
1.1 grant 5468: longer supported and has been removed.</p>
5469: </div>
5470: </dd>
5471:
1.7 wiz 5472: <dt><span class="term"><code class=
5473: "varname">${OPSYS}</code>, <code class=
5474: "varname">${LOWER_OPSYS}</code>, <code class=
5475: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 5476:
5477: <dd>
5478: <p>Some packages want to embed the OS name and
5479: version into some paths. To do this, use these
1.7 wiz 5480: variables in the <code class=
5481: "filename">PLIST</code>:</p>
1.1 grant 5482:
5483: <div class="itemizedlist">
5484: <ul type="disc">
5485: <li>
1.7 wiz 5486: <p><code class="varname">${OPSYS}</code> -
5487: output of “<span class=
5488: "quote"><span><strong class="command">uname
5489: -s</strong></span></span>”</p>
1.1 grant 5490: </li>
5491:
5492: <li>
1.7 wiz 5493: <p><code class=
5494: "varname">${LOWER_OPSYS}</code> - lowercase
5495: common name (eg. “<span class=
5496: "quote">solaris</span>”)</p>
1.1 grant 5497: </li>
5498:
5499: <li>
1.7 wiz 5500: <p><code class="varname">${OS_VERSION}</code>
5501: - “<span class=
5502: "quote"><span><strong class="command">uname
5503: -r</strong></span></span>”</p>
1.1 grant 5504: </li>
5505: </ul>
5506: </div>
5507: </dd>
5508:
1.7 wiz 5509: <dt><span class="term"><code class=
5510: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 5511:
5512: <dd>
5513: <p>Packages that install locale files should list
5514: them in the PLIST as “<span class=
5515: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
5516: instead of “<span class=
5517: "quote">share/locale/de/LC_MESSAGES/...</span>”.
5518: This properly handles the fact that different
5519: operating systems expect locale files to be either
1.7 wiz 5520: in <code class="filename">share</code> or
5521: <code class="filename">lib</code> by default.</p>
1.1 grant 5522: </dd>
5523: </dl>
5524: </div>
5525:
5526: <p>For a complete list of values which are replaced by
1.7 wiz 5527: default, please look in <code class=
5528: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 5529: "emphasis"><em>PLIST_SUBST</em></span>).</p>
5530:
5531: <p>If you want to change other variables not listed
5532: above, you can add variables and their expansions to this
1.7 wiz 5533: variable in the following way, similar to <code class=
5534: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 5535: "#components.optional" title=
5536: "7.5. Optional files">Section 7.5,
5537: “Optional files”</a>):</p>
5538: <pre class="programlisting">
5539: PLIST_SUBST+= SOMEVAR="somevalue"
5540: </pre>
5541:
5542: <p>This replaces all occurrences of “<span class=
5543: "quote">${SOMEVAR}</span>” in the PLIST with
5544: “<span class="quote">somevalue</span>”.</p>
5545: </div>
5546:
5547: <div class="sect1" lang="en" xml:lang="en">
5548: <div class="titlepage">
5549: <div>
5550: <div>
5551: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 5552: "id2586769" id=
! 5553: "id2586769"></a>8.5. Manpage-compression</h2>
1.1 grant 5554: </div>
5555: </div>
5556: </div>
5557:
5558: <p>Manpages should be installed in compressed form if
1.7 wiz 5559: <code class="varname">MANZ</code> is set (in <code class=
5560: "filename">bsd.own.mk</code>), and uncompressed
5561: otherwise. To handle this in the <code class=
5562: "filename">PLIST</code> file, the suffix
5563: “<span class="quote">.gz</span>” is
5564: appended/removed automatically for manpages according to
5565: <code class="varname">MANZ</code> and <code class=
5566: "varname">MANCOMPRESSED</code> being set or not, see
5567: above for details. This modification of the <code class=
5568: "filename">PLIST</code> file is done on a copy of it, not
5569: <code class="filename">PLIST</code> itself.</p>
1.1 grant 5570: </div>
5571:
5572: <div class="sect1" lang="en" xml:lang="en">
5573: <div class="titlepage">
5574: <div>
5575: <div>
5576: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 5577: "id2586810" id="id2586810"></a>8.6. Changing
1.7 wiz 5578: PLIST source with <code class=
5579: "varname">PLIST_SRC</code></h2>
1.1 grant 5580: </div>
5581: </div>
5582: </div>
5583:
1.7 wiz 5584: <p>To use one or more files as source for the
5585: <code class="filename">PLIST</code> used in generating
5586: the binary package, set the variable <code class=
5587: "varname">PLIST_SRC</code> to the names of that file(s).
1.1 grant 5588: The files are later concatenated using cat(1), and order
5589: of things is important.</p>
5590: </div>
5591:
5592: <div class="sect1" lang="en" xml:lang="en">
5593: <div class="titlepage">
5594: <div>
5595: <div>
5596: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 5597: "id2586827" id="id2586827"></a>8.7. Platform
1.1 grant 5598: specific and differing PLISTs</h2>
5599: </div>
5600: </div>
5601: </div>
5602:
5603: <p>Some packages decide to install a different set of
5604: files based on the operating system being used. These
5605: differences can be automatically handled by using the
5606: following files:</p>
5607:
5608: <div class="itemizedlist">
5609: <ul type="disc">
5610: <li>
1.7 wiz 5611: <p><code class="filename">PLIST.common</code></p>
1.1 grant 5612: </li>
5613:
5614: <li>
1.7 wiz 5615: <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1 grant 5616: </li>
5617:
5618: <li>
1.7 wiz 5619: <p><code class=
5620: "filename">PLIST.common_end</code></p>
1.1 grant 5621: </li>
5622: </ul>
5623: </div>
5624:
1.7 wiz 5625: <p>If <code class="filename">PLIST.${OPSYS}</code>
5626: exists, these files are used instead of <code class=
5627: "filename">PLIST</code>. This allows packages which
5628: behave in this way to be handled gracefully. Manually
5629: overriding <code class="varname">PLIST_SRC</code> for
5630: other more exotic uses is also possible.</p>
1.1 grant 5631: </div>
5632:
5633: <div class="sect1" lang="en" xml:lang="en">
5634: <div class="titlepage">
5635: <div>
5636: <div>
5637: <h2 class="title" style="clear: both"><a name=
5638: "faq.common-dirs" id=
5639: "faq.common-dirs"></a>8.8. Sharing directories
5640: between packages</h2>
5641: </div>
5642: </div>
5643: </div>
5644:
5645: <p>A “<span class="quote">shared
5646: directory</span>” is a directory where multiple
5647: (and unrelated) packages install files. These directories
5648: are problematic because you have to add special tricks in
5649: the PLIST to conditionally remove them, or have some
5650: centralized package handle them.</p>
5651:
5652: <p>Within pkgsrc, you'll find both approaches. If a
5653: directory is shared by a few unrelated packages, it's
5654: often not worth to add an extra package to remove it.
5655: Therefore, one simply does:</p>
5656: <pre class="programlisting">
5657: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
5658:
5659: </pre>
5660:
5661: <p>in the PLISTs of all affected packages, instead of the
5662: regular "@dirrm" line.</p>
5663:
5664: <p>However, if the directory is shared across many
5665: packages, two different solutions are available:</p>
5666:
5667: <div class="orderedlist">
5668: <ol type="1">
5669: <li>
5670: <p>If the packages have a common dependency, the
5671: directory can be removed in that. For example, see
5672: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5673: href=
5674: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.7 wiz 5675: class="pkgname">textproc/scrollkeeper</a>, which
5676: removes the shared directory <code class=
5677: "filename">share/omf</code>.</p>
1.1 grant 5678: </li>
5679:
5680: <li>
5681: <p>If the packages using the directory are not
5682: related at all (they have no common dependencies),
5683: a *-dirs package is used.</p>
5684: </li>
5685: </ol>
5686: </div>
5687:
5688: <p>From now on, we'll discuss the second solution. To get
5689: an idea of the *-dirs packages available, issue:</p>
5690: <pre class="programlisting">
1.7 wiz 5691: <code class="prompt">%</code> cd .../pkgsrc
5692: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 5693:
5694: </pre>
5695:
5696: <p>Their use from other packages is very simple. The
1.7 wiz 5697: <code class="varname">USE_DIRS</code> variable takes a
5698: list of package names (without the “<span class=
1.1 grant 5699: "quote">-dirs</span>” part) together with the
5700: required version number (always pick the latest one when
5701: writting new packages).</p>
5702:
5703: <p>For example, if a package installs files under
1.7 wiz 5704: <code class="filename">share/applications</code>, it
5705: should have the following line in it:</p>
1.1 grant 5706: <pre class="programlisting">
5707: USE_DIRS+= xdg-1.1
5708:
5709: </pre>
5710:
1.7 wiz 5711: <p>After regenerating the PLIST using
5712: <span><strong class="command">make
5713: print-PLIST</strong></span>, you should get the right
5714: (commented out) lines.</p>
1.1 grant 5715:
1.7 wiz 5716: <p>Note that, even if your package is using <code class=
5717: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 5718: *-x11-dirs packages. Just specify the name without that
1.7 wiz 5719: part and pkgsrc (in particular, <code class=
5720: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 5721: </div>
5722: </div>
5723:
5724: <div class="chapter" lang="en" xml:lang="en">
5725: <div class="titlepage">
5726: <div>
5727: <div>
5728: <h2 class="title"><a name="buildlink" id=
5729: "buildlink"></a>Chapter 9. Buildlink
5730: methodology</h2>
5731: </div>
5732: </div>
5733: </div>
5734:
5735: <div class="toc">
5736: <p><b>Table of Contents</b></p>
5737:
5738: <dl>
1.12 ! agc 5739: <dt><span class="sect1"><a href="#id2587099">9.1.
1.1 grant 5740: Converting packages to use buildlink3</a></span></dt>
5741:
1.12 ! agc 5742: <dt><span class="sect1"><a href="#id2587290">9.2.
1.7 wiz 5743: Writing <code class="filename">buildlink3.mk</code>
5744: files</a></span></dt>
1.1 grant 5745:
5746: <dd>
5747: <dl>
1.12 ! agc 5748: <dt><span class="sect2"><a href="#id2587496">9.2.1.
1.1 grant 5749: Anatomy of a buildlink3.mk file</a></span></dt>
5750:
1.12 ! agc 5751: <dt><span class="sect2"><a href="#id2588073">9.2.2.
1.7 wiz 5752: Updating <code class=
5753: "varname">BUILDLINK_DEPENDS.<em class=
5754: "replaceable"><code>pkg</code></em></code> in
5755: <code class="filename">buildlink3.mk</code>
1.1 grant 5756: files</a></span></dt>
5757: </dl>
5758: </dd>
5759:
1.12 ! agc 5760: <dt><span class="sect1"><a href="#id2588152">9.3.
1.7 wiz 5761: Writing <code class="filename">builtin.mk</code>
5762: files</a></span></dt>
1.1 grant 5763:
5764: <dd>
5765: <dl>
1.12 ! agc 5766: <dt><span class="sect2"><a href="#id2588233">9.3.1.
1.7 wiz 5767: Anatomy of a <code class=
5768: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 5769:
1.12 ! agc 5770: <dt><span class="sect2"><a href="#id2588392">9.3.2.
1.1 grant 5771: Global preferences for native or pkgsrc
5772: software</a></span></dt>
5773: </dl>
5774: </dd>
5775: </dl>
5776: </div>
5777:
5778: <p>Buildlink is a framework in pkgsrc that controls what
5779: headers and libraries are seen by a package's configure and
5780: build processes. This is implemented in a two step
5781: process:</p>
5782:
5783: <div class="orderedlist">
5784: <ol type="1">
5785: <li>
5786: <p>Symlink headers and libraries for dependencies
1.7 wiz 5787: into <code class="varname">BUILDLINK_DIR</code>,
5788: which by default is a subdirectory of <code class=
5789: "varname">WRKDIR</code>.</p>
1.1 grant 5790: </li>
5791:
5792: <li>
5793: <p>Create wrapper scripts that are used in place of
1.7 wiz 5794: the normal compiler tools that translate <code class=
5795: "option">-I${LOCALBASE}/include</code> and
5796: <code class="option">-L${LOCALBASE}/lib</code> into
5797: references to <code class=
5798: "varname">BUILDLINK_DIR</code>. The wrapper scripts
5799: also make native compiler on some operating systems
5800: look like GCC, so that packages that expect GCC won't
5801: require modifications to build with those native
5802: compilers.</p>
1.1 grant 5803: </li>
5804: </ol>
5805: </div>
5806:
5807: <p>This normalizes the environment in which a package is
5808: built so that the package may be built consistently despite
5809: what other software may be installed. Please note that the
1.7 wiz 5810: normal system header and library paths, e.g. <code class=
5811: "filename">/usr/include</code>, <code class=
5812: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 5813: buildlink3 is designed to insulate the package build from
5814: non-system-supplied software.</p>
5815:
5816: <div class="sect1" lang="en" xml:lang="en">
5817: <div class="titlepage">
5818: <div>
5819: <div>
5820: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 5821: "id2587099" id="id2587099"></a>9.1. Converting
1.1 grant 5822: packages to use buildlink3</h2>
5823: </div>
5824: </div>
5825: </div>
5826:
5827: <p>The process of converting packages to use the
5828: buildlink3 framework (“<span class=
5829: "quote">bl3ifying</span>”) is fairly
5830: straightforward. The things to keep in mind are:</p>
5831:
5832: <div class="orderedlist">
5833: <ol type="1">
5834: <li>
1.7 wiz 5835: <p>Set <code class="varname">USE_BUILDLINK3</code>
5836: to “<span class=
5837: "quote">yes</span>”.</p>
1.1 grant 5838: </li>
5839:
5840: <li>
5841: <p>Ensure that the build always calls the wrapper
5842: scripts instead of the actual toolchain. Some
5843: packages are tricky, and the only way to know for
1.7 wiz 5844: sure is the check <code class=
5845: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 5846: wrappers are being invoked.</p>
5847: </li>
5848:
5849: <li>
1.7 wiz 5850: <p>Don't override <code class=
5851: "varname">PREFIX</code> from within the package
5852: Makefile, e.g. Java VMs, standalone shells, etc.,
5853: because the code to symlink files into <code class=
5854: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 5855: relative to “<span class="quote">pkg_info -qp
1.7 wiz 5856: <em class=
5857: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 5858: </li>
5859:
5860: <li>
5861: <p>Remember that <span class=
1.7 wiz 5862: "emphasis"><em>only</em></span> the <code class=
5863: "filename">buildlink3.mk</code> files that you list
1.1 grant 5864: in a package's Makefile are added as dependencies
5865: for that package.</p>
5866: </li>
5867: </ol>
5868: </div>
5869:
5870: <p>If a dependency on a particular package is required
5871: for its libraries and headers, then we replace:</p>
5872: <pre class="programlisting">
5873: DEPENDS+= foo>=1.1.0:../../category/foo
5874: </pre>
5875:
5876: <p>with</p>
5877: <pre class="programlisting">
5878: .include "../../category/foo/buildlink3.mk"
5879: </pre>
5880:
1.7 wiz 5881: <p>There are several <code class=
5882: "filename">buildlink3.mk</code> files in <code class=
5883: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 5884: issues:</p>
5885:
5886: <div class="itemizedlist">
5887: <ul type="disc">
5888: <li>
1.7 wiz 5889: <p><code class="filename">bdb.buildlink3.mk</code>
1.1 grant 5890: chooses either the native or a pkgsrc Berkeley DB
1.7 wiz 5891: implementation based on the values of <code class=
5892: "varname">BDB_ACCEPTED</code> and <code class=
5893: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 5894: </li>
5895:
5896: <li>
1.7 wiz 5897: <p><code class=
5898: "filename">curses.buildlink3.mk</code> If the
5899: system comes with neither Curses nor NCurses, this
5900: will take care to install the <a xmlns=
5901: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5902: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.7 wiz 5903: class="pkgname">devel/ncurses</a> package.</p>
1.1 grant 5904: </li>
5905:
5906: <li>
1.7 wiz 5907: <p><code class="filename">krb5.buildlink3.mk</code>
5908: uses the value of <code class=
5909: "varname">KRB5_ACCEPTED</code> to choose between
1.1 grant 5910: adding a dependency on Heimdal or MIT-krb5 for
5911: packages that require a Kerberos 5
5912: implementation.</p>
5913: </li>
5914:
5915: <li>
1.7 wiz 5916: <p><code class=
5917: "filename">motif.buildlink3.mk</code> checks for a
5918: system-provided Motif installation or adds a
5919: dependency on <a xmlns=
1.1 grant 5920: "http://www.w3.org/TR/xhtml1/transitional" href=
5921: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.7 wiz 5922: class="pkgname">x11/lesstif</a> or <a xmlns=
5923: "http://www.w3.org/TR/xhtml1/transitional" href=
5924: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
5925: class="pkgname">x11/openmotif</a>;</p>
1.1 grant 5926: </li>
5927:
5928: <li>
1.7 wiz 5929: <p><code class=
5930: "filename">ossaudio.buildlink3.mk</code> defines
5931: several variables that may be used by packages that
5932: use the Open Sound System (OSS) API;</p>
1.1 grant 5933: </li>
5934:
5935: <li>
1.7 wiz 5936: <p><code class=
5937: "filename">pgsql.buildlink3.mk</code> will accept
5938: either Postgres 7.3 or 7.4, whichever is found
5939: installed. See the file for more information.</p>
1.1 grant 5940: </li>
5941:
5942: <li>
1.7 wiz 5943: <p><code class=
5944: "filename">pthread.buildlink3.mk</code> uses the
5945: value of <code class="varname">PTHREAD_OPTS</code>
5946: and checks for native pthreads or adds a dependency
5947: on <a xmlns=
1.1 grant 5948: "http://www.w3.org/TR/xhtml1/transitional" href=
5949: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.7 wiz 5950: class="pkgname">devel/pth</a> as needed;</p>
1.1 grant 5951: </li>
5952:
5953: <li>
1.7 wiz 5954: <p><code class="filename">xaw.buildlink3.mk</code>
5955: uses the value of <code class=
5956: "varname">XAW_TYPE</code> to choose a particular
5957: Athena widgets library.</p>
1.1 grant 5958: </li>
5959: </ul>
5960: </div>
5961:
1.7 wiz 5962: <p>The comments in those <code class=
5963: "filename">buildlink3.mk</code> files provide a more
1.1 grant 5964: complete description of how to use them properly.</p>
5965: </div>
5966:
5967: <div class="sect1" lang="en" xml:lang="en">
5968: <div class="titlepage">
5969: <div>
5970: <div>
5971: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 5972: "id2587290" id="id2587290"></a>9.2. Writing
1.7 wiz 5973: <code class="filename">buildlink3.mk</code>
5974: files</h2>
1.1 grant 5975: </div>
5976: </div>
5977: </div>
5978:
1.7 wiz 5979: <p>A package's <code class=
5980: "filename">buildlink3.mk</code> file is included by
5981: Makefiles to indicate the need to compile and link
5982: against header files and libraries provided by the
5983: package. A <code class="filename">buildlink3.mk</code>
5984: file should always provide enough information to add the
5985: correct type of dependency relationship and include any
5986: other <code class="filename">buildlink3.mk</code> files
5987: that it needs to find headers and libraries that it needs
5988: in turn.</p>
1.1 grant 5989:
1.7 wiz 5990: <p>To generate an initial <code class=
5991: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 5992: Rene Hexel's <a xmlns=
5993: "http://www.w3.org/TR/xhtml1/transitional" href=
5994: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.7 wiz 5995: class="pkgname">pkgtools/createbuildlink</a> package is
5996: highly recommended. For most packages, the following
5997: command will generate a good starting point for
5998: <code class="filename">buildlink3.mk</code> files:</p>
1.1 grant 5999: <pre class="screen">
1.7 wiz 6000: <code class="prompt">%</code> <strong class=
6001: "userinput"><code>cd pkgsrc/<em class=
6002: "replaceable"><code>category</code></em>/<em class=
6003: "replaceable"><code>pkgdir</code></em>
6004: <code class=
6005: "prompt">%</code> createbuildlink -3 >buildlink3.mk</code></strong>
1.1 grant 6006: </pre>
6007:
6008: <div class="sect2" lang="en" xml:lang="en">
6009: <div class="titlepage">
6010: <div>
6011: <div>
1.12 ! agc 6012: <h3 class="title"><a name="id2587496" id=
! 6013: "id2587496"></a>9.2.1. Anatomy of a buildlink3.mk
1.1 grant 6014: file</h3>
6015: </div>
6016: </div>
6017: </div>
6018:
1.7 wiz 6019: <p>The following real-life example <code class=
6020: "filename">buildlink3.mk</code> is taken from
6021: <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 6022: <pre class="programlisting">
1.11 ben 6023: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 6024:
6025: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
6026: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
6027:
6028: .if !empty(BUILDLINK_DEPTH:M+)
6029: BUILDLINK_DEPENDS+= tiff
6030: .endif
6031:
6032: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
6033: BUILDLINK_PACKAGES+= tiff
6034:
6035: .if !empty(TIFF_BUILDLINK3_MK:M+)
6036: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
6037: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
6038: .endif # TIFF_BUILDLINK3_MK
6039:
6040: .include "../../devel/zlib/buildlink3.mk"
6041: .include "../../graphics/jpeg/buildlink3.mk"
6042:
6043: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
6044: </pre>
6045:
1.7 wiz 6046: <p>The header and footer manipulate <code class=
6047: "varname">BUILDLINK_DEPTH</code>, which is common
6048: across all <code class="filename">buildlink3.mk</code>
6049: files and is used to track at what depth we are
6050: including <code class="filename">buildlink3.mk</code>
6051: files.</p>
1.1 grant 6052:
6053: <p>The first section controls if the dependency on
1.7 wiz 6054: <em class="replaceable"><code>pkg</code></em> is added.
6055: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 6056: global list of packages for which dependencies are
6057: added by buildlink3.</p>
6058:
6059: <p>The second section advises pkgsrc that the
1.7 wiz 6060: <code class="filename">buildlink3.mk</code> file for
6061: <em class="replaceable"><code>pkg</code></em> has been
6062: included at some point. <code class=
6063: "varname">BUILDLINK_PACKAGES</code> is the global list
6064: of packages for which <code class=
6065: "filename">buildlink3.mk</code> files have been
6066: included. It must <span class=
6067: "emphasis"><em>always</em></span> be appended to within
6068: a <code class="filename">buildlink3.mk</code> file.</p>
1.1 grant 6069:
6070: <p>The third section is protected from multiple
1.7 wiz 6071: inclusion and controls how the dependency on <em class=
6072: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 6073: important variables are set in the section:</p>
6074:
6075: <div class="itemizedlist">
6076: <ul type="disc">
6077: <li>
1.7 wiz 6078: <p><code class=
6079: "varname">BUILDLINK_DEPENDS.<em class=
6080: "replaceable"><code>pkg</code></em></code> is the
6081: actual dependency recorded in the installed
6082: package; this should always be set using
6083: <span><strong class="command">+=</strong></span>
6084: to ensure that we're appending to any
6085: pre-existing list of values. This variable should
6086: be set to the first version of the package that
6087: had the last change in the major number of a
6088: shared library or that had a major API
6089: change.</p>
1.1 grant 6090: </li>
6091:
6092: <li>
1.7 wiz 6093: <p><code class=
6094: "varname">BUILDLINK_PKGSRCDIR.<em class=
6095: "replaceable"><code>pkg</code></em></code> is the
6096: location of the <em class=
6097: "replaceable"><code>pkg</code></em> pkgsrc
1.1 grant 6098: directory;</p>
6099: </li>
6100:
6101: <li>
1.7 wiz 6102: <p><code class=
6103: "varname">BUILDLINK_DEPMETHOD.<em class=
6104: "replaceable"><code>pkg</code></em></code> (not
6105: shown above) controls whether we use <code class=
6106: "varname">BUILD_DEPENDS</code> or <code class=
6107: "varname">DEPENDS</code> to add the dependency on
6108: <em class="replaceable"><code>pkg</code></em>.
6109: The build dependency is selected by setting
6110: <code class=
6111: "varname">BUILDLINK_DEPMETHOD.<em class=
6112: "replaceable"><code>pkg</code></em></code> to
1.1 grant 6113: “<span class="quote">build</span>”.
6114: By default, the full dependency is used.</p>
6115: </li>
6116:
6117: <li>
1.7 wiz 6118: <p><code class=
6119: "varname">BUILDLINK_INCDIRS.<em class=
6120: "replaceable"><code>pkg</code></em></code> and
6121: <code class=
6122: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
6123: <code>pkg</code></em></code> (not shown above)
6124: are lists of subdirectories of <code class=
6125: "filename">${BUILDLINK_PREFIX.<em class=
6126: "replaceable"><code>pkg</code></em>}</code> to
6127: add to the header and library search paths. These
1.1 grant 6128: default to “<span class=
6129: "quote">include</span>” and
6130: “<span class="quote">lib</span>”
6131: respectively.</p>
6132: </li>
6133:
6134: <li>
1.7 wiz 6135: <p><code class=
6136: "varname">BUILDLINK_CPPFLAGS.<em class=
6137: "replaceable"><code>pkg</code></em></code> (not
6138: shown above) is the list of preprocessor flags to
6139: add to <code class="varname">CPPFLAGS</code>,
6140: which are passed on to the configure and build
6141: phases. The “<span class=
6142: "quote">-I</span>” option should be avoided
6143: and instead be handled using <code class=
6144: "varname">BUILDLINK_INCDIRS.<em class=
6145: "replaceable"><code>pkg</code></em></code> as
6146: above.</p>
1.1 grant 6147: </li>
6148: </ul>
6149: </div>
6150:
6151: <p>The following variables are all optionally defined
6152: within this second section (protected against multiple
6153: inclusion) and control which package files are
1.7 wiz 6154: symlinked into <code class=
6155: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 6156: are transformed during the symlinking:</p>
6157:
6158: <div class="itemizedlist">
6159: <ul type="disc">
6160: <li>
1.7 wiz 6161: <p><code class=
6162: "varname">BUILDLINK_FILES.<em class=
6163: "replaceable"><code>pkg</code></em></code> (not
6164: shown above) is a shell glob pattern relative to
6165: <code class=
6166: "filename">${BUILDLINK_PREFIX.<em class=
6167: "replaceable"><code>pkg</code></em>}</code> to be
6168: symlinked into <code class=
6169: "filename">${BUILDLINK_DIR}</code>, e.g.
6170: <code class="filename">include/*.h</code>.</p>
1.1 grant 6171: </li>
6172:
6173: <li>
1.7 wiz 6174: <p><code class=
6175: "varname">BUILDLINK_FILES_CMD.<em class=
6176: "replaceable"><code>pkg</code></em></code> (not
6177: shown above) is a shell pipeline that outputs to
6178: stdout a list of files relative to <code class=
6179: "filename">${BUILDLINK_PREFIX.<em class=
6180: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 6181: resulting files are to be symlinked into
1.7 wiz 6182: <code class="filename">${BUILDLINK_DIR}</code>.
6183: By default, this takes the <code class=
6184: "filename">+CONTENTS</code> of a <em class=
6185: "replaceable"><code>pkg</code></em> and filters
6186: it through <code class=
6187: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
6188: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 6189: </li>
6190:
6191: <li>
1.7 wiz 6192: <p><code class=
6193: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
6194: "replaceable"><code>pkg</code></em></code> (not
6195: shown above) is a filter command that filters
6196: <code class="filename">+CONTENTS</code> input
6197: into a list of files relative to <code class=
6198: "filename">${BUILDLINK_PREFIX.<em class=
6199: "replaceable"><code>pkg</code></em>}</code> on
6200: stdout. By default for overwrite packages,
6201: <code class=
6202: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
6203: "replaceable"><code>pkg</code></em></code>
6204: outputs the contents of the <code class=
6205: "filename">include</code> and <code class=
6206: "filename">lib</code> directories in the package
6207: <code class="filename">+CONTENTS</code>, and for
6208: pkgviews packages, it outputs any libtool
6209: archives in <code class="filename">lib</code>
1.1 grant 6210: directories.</p>
6211: </li>
6212:
6213: <li>
1.7 wiz 6214: <p><code class=
6215: "varname">BUILDLINK_TRANSFORM.<em class=
6216: "replaceable"><code>pkg</code></em></code> (not
6217: shown above) is a list of sed arguments used to
1.1 grant 6218: transform the name of the source filename into a
1.7 wiz 6219: destination filename, e.g. <span><strong class=
1.1 grant 6220: "command">-e
1.7 wiz 6221: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 6222: </li>
6223: </ul>
6224: </div>
6225:
1.7 wiz 6226: <p>The last section includes any <code class=
6227: "filename">buildlink3.mk</code> needed for <em class=
6228: "replaceable"><code>pkg</code></em>'s library
6229: dependencies. Including these <code class=
6230: "filename">buildlink3.mk</code> files means that the
6231: headers and libraries for these dependencies are also
6232: symlinked into <code class=
6233: "filename">${BUILDLINK_DIR}</code> whenever the
6234: <em class="replaceable"><code>pkg</code></em>
6235: <code class="filename">buildlink3.mk</code> file is
6236: included.</p>
1.1 grant 6237: </div>
6238:
6239: <div class="sect2" lang="en" xml:lang="en">
6240: <div class="titlepage">
6241: <div>
6242: <div>
1.12 ! agc 6243: <h3 class="title"><a name="id2588073" id=
! 6244: "id2588073"></a>9.2.2. Updating <code class=
1.7 wiz 6245: "varname">BUILDLINK_DEPENDS.<em class=
6246: "replaceable"><code>pkg</code></em></code> in
6247: <code class="filename">buildlink3.mk</code>
6248: files</h3>
1.1 grant 6249: </div>
6250: </div>
6251: </div>
6252:
6253: <p>There are two situations that require increasing the
1.7 wiz 6254: dependency listed in <code class=
6255: "varname">BUILDLINK_DEPENDS.<em class=
6256: "replaceable"><code>pkg</code></em></code> after a
6257: package update:</p>
1.1 grant 6258:
6259: <div class="orderedlist">
6260: <ol type="1">
6261: <li>
6262: <p>if the sonames (major number of the library
6263: version) of any installed shared libraries
6264: change;</p>
6265: </li>
6266:
6267: <li>
6268: <p>if the API or interface to the header files
6269: change.</p>
6270: </li>
6271: </ol>
6272: </div>
6273:
1.7 wiz 6274: <p>In these cases, <code class=
6275: "varname">BUILDLINK_DEPENDS.<em class=
6276: "replaceable"><code>pkg</code></em></code> should be
6277: adjusted to require at least the new package version.
6278: In some cases, the packages that depend on this new
6279: version may need their <code class=
6280: "varname">PKGREVISION</code>s increased and, if they
6281: have <code class="filename">buildlink3.mk</code> files,
6282: their <code class=
6283: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
6284: pkg</code></em></code> adjusted, too. This is needed so
6285: that binary packages made using it will require the
6286: correct package dependency and not settle for an older
6287: one which will not contain the necessary shared
6288: libraries.</p>
1.1 grant 6289:
6290: <p>Please take careful consideration before adjusting
1.7 wiz 6291: <code class="varname">BUILDLINK_DEPENDS.<em class=
6292: "replaceable"><code>pkg</code></em></code> as we don't
6293: want to cause unneeded package deletions and rebuilds.
6294: In many cases, new versions of packages work just fine
6295: with older dependencies. See <a href="#dependencies"
6296: title="12.1.3. Handling dependencies">Section
6297: 12.1.3, “Handling dependencies”</a> and
6298: <a href="#buildlink" title=
1.1 grant 6299: "Chapter 9. Buildlink methodology">Chapter 9,
6300: <i>Buildlink methodology</i></a> for more information
6301: about dependencies on other packages, including the
1.7 wiz 6302: <code class="varname">BUILDLINK_RECOMMENDED</code> and
6303: <code class="varname">RECOMMENDED</code>
6304: definitions.</p>
1.1 grant 6305: </div>
6306: </div>
6307:
6308: <div class="sect1" lang="en" xml:lang="en">
6309: <div class="titlepage">
6310: <div>
6311: <div>
6312: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 6313: "id2588152" id="id2588152"></a>9.3. Writing
1.7 wiz 6314: <code class="filename">builtin.mk</code> files</h2>
1.1 grant 6315: </div>
6316: </div>
6317: </div>
6318:
6319: <p>Some packages in pkgsrc install headers and libraries
6320: that coincide with headers and libraries present in the
1.7 wiz 6321: base system. Aside from a <code class=
6322: "filename">buildlink3.mk</code> file, these packages
6323: should also include a <code class=
6324: "filename">builtin.mk</code> file that includes the
6325: necessary checks to decide whether using the built-in
6326: software or the pkgsrc software is appropriate.</p>
1.1 grant 6327:
6328: <p>The only requirements of a builtin.mk file for
1.7 wiz 6329: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 6330:
6331: <div class="orderedlist">
6332: <ol type="1">
6333: <li>
1.7 wiz 6334: <p>It should set <code class=
6335: "varname">USE_BUILTIN.<em class=
6336: "replaceable"><code>pkg</code></em></code> to
6337: either “<span class="quote">yes</span>”
6338: or “<span class="quote">no</span>”
6339: after it is included.</p>
1.1 grant 6340: </li>
6341:
6342: <li>
6343: <p>It should <span class=
6344: "emphasis"><em>not</em></span> override any
1.7 wiz 6345: <code class="varname">USE_BUILTIN.<em class=
6346: "replaceable"><code>pkg</code></em></code> which is
6347: already set before the <code class=
6348: "filename">builtin.mk</code> file is included.</p>
1.1 grant 6349: </li>
6350:
6351: <li>
6352: <p>It should be written to allow multiple
6353: inclusion. This is <span class=
6354: "emphasis"><em>very</em></span> important and takes
1.7 wiz 6355: careful attention to <code class=
6356: "filename">Makefile</code> coding.</p>
1.1 grant 6357: </li>
6358: </ol>
6359: </div>
6360:
6361: <div class="sect2" lang="en" xml:lang="en">
6362: <div class="titlepage">
6363: <div>
6364: <div>
1.12 ! agc 6365: <h3 class="title"><a name="id2588233" id=
! 6366: "id2588233"></a>9.3.1. Anatomy of a
1.7 wiz 6367: <code class="filename">builtin.mk</code>
6368: file</h3>
1.1 grant 6369: </div>
6370: </div>
6371: </div>
6372:
6373: <p>The following is the recommended template for
6374: builtin.mk files:</p>
6375: <pre class="programlisting">
6376: .if !defined(IS_BUILTIN.foo)
6377: #
6378: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
6379: # genuinely exists in the system or not.
6380: #
6381: IS_BUILTIN.foo?= no
6382:
6383: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
6384: # version can be determined.
6385: #
6386: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
6387: BUILTIN_PKG.foo?= foo-1.0
6388: . endif
6389: .endif # IS_BUILTIN.foo
6390:
6391: .if !defined(USE_BUILTIN.foo)
6392: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
6393: . if defined(BUILTIN_PKG.foo)
6394: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
6395: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
6396: USE_BUILTIN.foo!= \
6397: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
6398: ${ECHO} "yes"; \
6399: else \
6400: ${ECHO} "no"; \
6401: fi
6402: . endif
6403: . endfor
6404: . endif
6405: .endif # USE_BUILTIN.foo
6406:
6407: CHECK_BUILTIN.foo?= no
6408: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
6409: #
6410: # Here we place code that depends on whether USE_BUILTIN.foo is set to
6411: # "yes" or "no".
6412: #
6413: .endif # CHECK_BUILTIN.foo
6414:
6415: </pre>
6416:
1.7 wiz 6417: <p>The first section sets <code class=
6418: "varname">IS_BUILTIN.<em class=
6419: "replaceable"><code>pkg</code></em></code> depending on
6420: if <em class="replaceable"><code>pkg</code></em> really
6421: exists in the base system. This should not be a base
6422: system software with similar functionality to
6423: <em class="replaceable"><code>pkg</code></em>; it
6424: should only be “<span class=
6425: "quote">yes</span>” if the actual package is
6426: included as part of the base system. This variable is
6427: only used internally within the <code class=
6428: "filename">builtin.mk</code> file.</p>
6429:
6430: <p>The second section sets <code class=
6431: "varname">BUILTIN_PKG.<em class=
6432: "replaceable"><code>pkg</code></em></code> to the
6433: version of <em class=
6434: "replaceable"><code>pkg</code></em> in the base system
6435: if it exists (if <code class=
6436: "varname">IS_BUILTIN.<em class=
6437: "replaceable"><code>pkg</code></em></code> is
1.1 grant 6438: “<span class="quote">yes</span>”). This
1.7 wiz 6439: variable is only used internally within the
6440: <code class="filename">builtin.mk</code> file.</p>
1.1 grant 6441:
1.7 wiz 6442: <p>The third section sets <code class=
6443: "varname">USE_BUILTIN.<em class=
6444: "replaceable"><code>pkg</code></em></code> and is
6445: <span class="emphasis"><em>required</em></span> in all
6446: <code class="filename">builtin.mk</code> files. The
6447: code in this section must make the determination
6448: whether the built-in software is adequate to satisfy
6449: the dependencies listed in <code class=
6450: "varname">BUILDLINK_DEPENDS.<em class=
6451: "replaceable"><code>pkg</code></em></code>. This is
6452: typically done by comparing <code class=
6453: "varname">BUILTIN_PKG.<em class=
6454: "replaceable"><code>pkg</code></em></code> against each
6455: of the dependencies in <code class=
6456: "varname">BUILDLINK_DEPENDS.<em class=
6457: "replaceable"><code>pkg</code></em></code>.
6458: <code class="varname">USE_BUILTIN.<em class=
6459: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 6460: "emphasis"><em>must</em></span> be set to the correct
1.7 wiz 6461: value by the end of the <code class=
6462: "filename">builtin.mk</code> file. Note that
6463: <code class="varname">USE_BUILTIN.<em class=
6464: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 6465: “<span class="quote">yes</span>” even if
1.7 wiz 6466: <code class="varname">IS_BUILTIN.<em class=
6467: "replaceable"><code>pkg</code></em></code> is
1.1 grant 6468: “<span class="quote">no</span>” because we
6469: may make the determination that the built-in version of
6470: the software is similar enough to be used as a
6471: replacement.</p>
6472:
1.7 wiz 6473: <p>The last section is guarded by <code class=
6474: "varname">CHECK_BUILTIN.<em class=
6475: "replaceable"><code>pkg</code></em></code>, and
6476: includes code that uses the value of <code class=
6477: "varname">USE_BUILTIN.<em class=
6478: "replaceable"><code>pkg</code></em></code> set in the
6479: previous section. This typically includes, e.g., adding
1.1 grant 6480: additional dependency restrictions and listing
1.7 wiz 6481: additional files to symlink into <code class=
6482: "filename">${BUILDLINK_DIR}</code> (via <code class=
6483: "varname">BUILDLINK_FILES.<em class=
6484: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 6485: </div>
6486:
6487: <div class="sect2" lang="en" xml:lang="en">
6488: <div class="titlepage">
6489: <div>
6490: <div>
1.12 ! agc 6491: <h3 class="title"><a name="id2588392" id=
! 6492: "id2588392"></a>9.3.2. Global preferences
1.1 grant 6493: for native or pkgsrc software</h3>
6494: </div>
6495: </div>
6496: </div>
6497:
6498: <p>When building packages, it's possible to choose
6499: whether to set a global preference for using either the
6500: built-in (native) version or the pkgsrc version of
6501: software to satisfy a dependency. This is controlled by
1.7 wiz 6502: setting <code class="varname">PREFER_PKGSRC</code> and
6503: <code class="varname">PREFER_NATIVE</code>. These
6504: variables take values of either “<span class=
1.1 grant 6505: "quote">yes</span>”, “<span class=
6506: "quote">no</span>”, or a list of packages.
1.7 wiz 6507: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
6508: to use the pkgsrc versions of software, while
6509: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
6510: to use the built-in versions. Preferences are
6511: determined by the most specific instance of the package
6512: in either <code class="varname">PREFER_PKGSRC</code> or
6513: <code class="varname">PREFER_NATIVE</code>. If a
6514: package is specified in neither or in both variables,
6515: then <code class="varname">PREFER_PKGSRC</code> has
6516: precedence over <code class=
6517: "varname">PREFER_NATIVE</code>. For example, to require
6518: using pkgsrc versions of software for all but the most
6519: basic bits on a NetBSD system, you can set:</p>
1.1 grant 6520: <pre class="programlisting">
6521: PREFER_PKGSRC= yes
6522: PREFER_NATIVE= getopt skey tcp_wrappers
6523:
6524: </pre>
6525:
6526: <p>A package <span class=
1.7 wiz 6527: "emphasis"><em>must</em></span> have a <code class=
6528: "filename">builtin.mk</code> file to be listed in
6529: <code class="varname">PREFER_NATIVE</code>, otherwise
6530: it is simply ignored in that list.</p>
1.1 grant 6531: </div>
6532: </div>
6533: </div>
6534:
6535: <div class="chapter" lang="en" xml:lang="en">
6536: <div class="titlepage">
6537: <div>
6538: <div>
6539: <h2 class="title"><a name="options" id=
6540: "options"></a>Chapter 10. Options
6541: handling</h2>
6542: </div>
6543: </div>
6544: </div>
6545:
6546: <div class="toc">
6547: <p><b>Table of Contents</b></p>
6548:
6549: <dl>
1.12 ! agc 6550: <dt><span class="sect1"><a href="#id2588533">10.1.
1.1 grant 6551: Global default options</a></span></dt>
6552:
1.12 ! agc 6553: <dt><span class="sect1"><a href="#id2588548">10.2.
1.7 wiz 6554: Converting packages to use <code class=
6555: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 6556: </dl>
6557: </div>
6558:
6559: <p>Many packages have the ability to be built to support
1.7 wiz 6560: different sets of features. <code class=
6561: "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1 grant 6562: that provides generic handling of those options that
6563: determine different ways in which the packages can be
6564: built. It's possible for the user to specify exactly which
6565: sets of options will be built into a package or to allow a
6566: set of global default options apply.</p>
6567:
6568: <div class="sect1" lang="en" xml:lang="en">
6569: <div class="titlepage">
6570: <div>
6571: <div>
6572: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 6573: "id2588533" id="id2588533"></a>10.1. Global
1.1 grant 6574: default options</h2>
6575: </div>
6576: </div>
6577: </div>
6578:
1.7 wiz 6579: <p>Global default options are listed in <code class=
6580: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1 grant 6581: the options that should be built into every package if
6582: that option is supported. This variable should be set in
1.7 wiz 6583: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 6584: </div>
6585:
6586: <div class="sect1" lang="en" xml:lang="en">
6587: <div class="titlepage">
6588: <div>
6589: <div>
6590: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 6591: "id2588548" id=
! 6592: "id2588548"></a>10.2. Converting packages to
1.7 wiz 6593: use <code class=
6594: "filename">bsd.options.mk</code></h2>
1.1 grant 6595: </div>
6596: </div>
6597: </div>
6598:
1.7 wiz 6599: <p>The following example shows how <code class=
6600: "filename">bsd.options.mk</code> should be use in a
6601: package <code class="filename">Makefile</code>, or in a
6602: file, e.g. <code class="filename">options.mk</code>, that
6603: is included by the main package <code class=
6604: "filename">Makefile</code>.</p>
1.1 grant 6605: <pre class="programlisting">
6606: # Global and legacy options
6607: .if defined(WIBBLE_USE_OPENLDAP) && !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
6608: PKG_DEFAULT_OPTIONS+= ldap
6609: .endif
6610: .if defined(USE_SASL2) && !empty(USE_SASL2:M[yY][eE][sS])
6611: PKG_DEFAULT_OPTIONS+= sasl
6612: .endif
6613:
6614: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
6615: PKG_SUPPORTED_OPTIONS= ldap sasl
6616: #
6617: # Default options for "wibble" package.
6618: #
6619: .if !defined(PKG_OPTIONS.wibble)
6620: PKG_DEFAULT_OPTIONS+= sasl
6621: endif
6622: .include "../../mk/bsd.options.mk"
6623:
6624: # Package-specific option-handling
6625:
6626: ###
6627: ### LDAP support
6628: ###
6629: .if !empty(PKG_OPTIONS:Mldap)
6630: . include "../../databases/openldap/buildlink3.mk"
6631: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
6632: .endif
6633:
6634: ###
6635: ### SASL authentication
6636: ###
6637: .if !empty(PKG_OPTIONS:Msasl)
6638: . include "../../security/cyrus-sasl2/buildlink3.mk"
6639: CONFIGURE_ARGS+= --enable-sasl=${BUILDLINK_PREFIX.sasl}
6640: .endif
6641:
6642: </pre>
6643:
6644: <p>The first section only exists if you are converting a
6645: package that had its own ad-hoc options handling to use
1.7 wiz 6646: <code class="filename">bsd.options.mk</code>. It converts
1.1 grant 6647: global or legacy options variables into an equivalent
1.7 wiz 6648: <code class="varname">PKG_OPTIONS.<em class=
6649: "replaceable"><code>pkg</code></em></code> value. These
6650: sections will be removed over time as the old options are
6651: in turn deprecated and removed.</p>
1.1 grant 6652:
6653: <p>The second section contains the information about
6654: which build options are supported by the package, and any
6655: default options settings if needed.</p>
6656:
6657: <div class="orderedlist">
6658: <ol type="1">
6659: <li>
1.7 wiz 6660: <p><code class="varname">PKG_OPTIONS_VAR</code> is
6661: a list of the name of the <a href=
1.1 grant 6662: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6663: <span class="citerefentry"><span class=
6664: "refentrytitle">make</span>(1)</span></a> variables
6665: that contain the options the user wishes to select.
6666: The recommended value is “<span class=
1.7 wiz 6667: "quote">PKG_OPTIONS.<em class=
6668: "replaceable"><code>pkg</code></em></span>”
6669: but any package-specific value may be used. This
1.1 grant 6670: variable should be set in a package Makefile.</p>
6671: </li>
6672:
6673: <li>
1.7 wiz 6674: <p><code class=
6675: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
6676: build options supported by the package. This
6677: variable should be set in a package Makefile.</p>
1.1 grant 6678: </li>
6679:
6680: <li>
1.7 wiz 6681: <p><code class="varname">${PKG_OPTIONS_VAR}</code>
6682: (the variables named in <code class=
6683: "varname">PKG_OPTIONS_VAR</code>) are variables
6684: that list the selected build options and override
6685: any default options given in <code class=
6686: "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1 grant 6687: options begin with a “<span class=
6688: "quote">-</span>”, then that option is always
6689: removed from the selected build options, e.g.</p>
6690: <pre class="programlisting">
6691: PKG_DEFAULT_OPTIONS= kerberos ldap sasl
6692: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
6693: WIBBLE_OPTIONS= ${PKG_DEFAULT_OPTIONS} -sasl
6694: # implies PKG_OPTIONS == "kerberos ldap"
6695:
6696: </pre>
6697:
6698: <p>or</p>
6699: <pre class="programlisting">
6700: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
6701: WIBBLE_OPTIONS= kerberos -ldap ldap
6702: # implies PKG_OPTIONS == "kerberos"
6703:
6704: </pre>
6705:
1.7 wiz 6706: <p>This variable should be set in <code class=
6707: "filename">/etc/mk.conf</code>.</p>
1.1 grant 6708: </li>
6709: </ol>
6710: </div>
6711:
6712: <p>After the inclusion of bsd.options.mk, the following
6713: variables are set:</p>
6714:
6715: <div class="itemizedlist">
6716: <ul type="disc">
6717: <li>
1.7 wiz 6718: <p><code class="varname">PKG_OPTIONS</code>
6719: contains the list of the selected build options,
6720: properly filtered to remove unsupported and
6721: duplicate options.</p>
1.1 grant 6722: </li>
6723: </ul>
6724: </div>
6725:
6726: <p>The remaining sections contain the logic that is
6727: specific to each option. There should be a check for
1.7 wiz 6728: every option listed in <code class=
6729: "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
6730: be clear documentation on what turning on the option will
6731: do in the comments preceding each section. The correct
6732: way to check for an option is to check whether it is
6733: listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1 grant 6734: </div>
6735: </div>
6736:
6737: <div class="chapter" lang="en" xml:lang="en">
6738: <div class="titlepage">
6739: <div>
6740: <div>
6741: <h2 class="title"><a name="build" id=
6742: "build"></a>Chapter 11. The build
6743: process</h2>
6744: </div>
6745: </div>
6746: </div>
6747:
6748: <div class="toc">
6749: <p><b>Table of Contents</b></p>
6750:
6751: <dl>
6752: <dt><span class="sect1"><a href="#build.prefix">11.1.
6753: Program location</a></span></dt>
6754:
1.12 ! agc 6755: <dt><span class="sect1"><a href="#id2589156">11.2. Main
1.1 grant 6756: targets</a></span></dt>
6757:
6758: <dt><span class="sect1"><a href=
6759: "#build.helpful-targets">11.3. Other helpful
6760: targets</a></span></dt>
6761: </dl>
6762: </div>
6763:
6764: <p>The basic steps for building a program are always the
6765: same. First the program's source (<span class=
6766: "emphasis"><em>distfile</em></span>) must be brought to the
6767: local system and then extracted. After any patches to
6768: compile properly on NetBSD are applied, the software can be
6769: configured, then built (usually by compiling), and finally
6770: the generated binaries, etc. can be put into place on the
6771: system. These are exactly the steps performed by the NetBSD
6772: package system, which is implemented as a series of targets
1.7 wiz 6773: in a central Makefile, <code class=
6774: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 6775:
6776: <div class="sect1" lang="en" xml:lang="en">
6777: <div class="titlepage">
6778: <div>
6779: <div>
6780: <h2 class="title" style="clear: both"><a name=
6781: "build.prefix" id=
6782: "build.prefix"></a>11.1. Program location</h2>
6783: </div>
6784: </div>
6785: </div>
6786:
6787: <p>Before outlining the process performed by the NetBSD
6788: package system in the next section, here's a brief
6789: discussion on where programs are installed, and which
6790: variables influence this.</p>
6791:
1.7 wiz 6792: <p>The automatic variable <code class=
6793: "varname">PREFIX</code> indicates where all files of the
6794: final program shall be installed. It is usually set to
6795: <code class="varname">LOCALBASE</code> (<code class=
6796: "filename">/usr/pkg</code>), or <code class=
6797: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 6798: “<span class="quote">cross</span>” category.
1.7 wiz 6799: The value of <code class="varname">PREFIX</code> needs to
6800: be put into the various places in the program's source
6801: where paths to these files are encoded. See <a href=
1.1 grant 6802: "#components.patches" title=
6803: "7.3. patches/*">Section 7.3,
6804: “patches/*”</a> and <a href="#fixes.libtool"
6805: title=
6806: "12.3.1. Shared libraries - libtool">Section 12.3.1,
6807: “Shared libraries - libtool”</a> for more
6808: details.</p>
6809:
6810: <p>When choosing which of these variables to use, follow
6811: the following rules:</p>
6812:
6813: <div class="itemizedlist">
6814: <ul type="disc">
6815: <li>
1.7 wiz 6816: <p><code class="varname">PREFIX</code> always
6817: points to the location where the current pkg will
6818: be installed. When referring to a pkg's own
1.1 grant 6819: installation path, use “<span class=
6820: "quote">${PREFIX}</span>”.</p>
6821: </li>
6822:
6823: <li>
1.7 wiz 6824: <p><code class="varname">LOCALBASE</code> is where
6825: all non-X11 pkgs are installed. If you need to
1.1 grant 6826: construct a -I or -L argument to the compiler to
6827: find includes and libraries installed by another
6828: non-X11 pkg, use “<span class=
6829: "quote">${LOCALBASE}</span>”.</p>
6830: </li>
6831:
6832: <li>
1.7 wiz 6833: <p><code class="varname">X11BASE</code> is where
6834: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 6835: installed. When looking for <span class=
6836: "emphasis"><em>standard</em></span> X11 includes
6837: (not those installed by a pkg), use
6838: “<span class=
6839: "quote">${X11BASE}</span>”.</p>
6840: </li>
6841:
6842: <li>
6843: <p>X11 based are special in that they may be
1.7 wiz 6844: installed in either <code class=
6845: "varname">X11BASE</code> or <code class=
6846: "varname">LOCALBASE</code>.</p>
1.1 grant 6847:
6848: <p>Usually, X11 packages should be installed under
1.7 wiz 6849: <code class="varname">LOCALBASE</code> whenever
6850: possible. Note that you will need to set
6851: <code class="varname">USE_X11</code> in them to
6852: request the presence of X11 and to get the right
6853: compilation flags.</p>
1.1 grant 6854:
6855: <p>Even though, there are some packages that cannot
1.7 wiz 6856: be installed under <code class=
6857: "varname">LOCALBASE</code>: those that come with
1.1 grant 6858: app-defaults files. These packages are special and
1.7 wiz 6859: they must be placed under <code class=
6860: "varname">X11BASE</code>. To accomplish this, set
6861: either <code class="varname">USE_X11BASE</code> or
6862: <code class="varname">USE_IMAKE</code> in your
1.1 grant 6863: package.</p>
6864:
1.7 wiz 6865: <p>Some notes: <code class="varname">USE_X11</code>
6866: and <code class="varname">USE_X11BASE</code> are
6867: mutually exclusive. If you need to find includes or
6868: libraries installed by a pkg that has <code class=
6869: "varname">USE_IMAKE</code> or <code class=
6870: "varname">USE_X11BASE</code> in its pkg
6871: <code class="filename">Makefile</code>, you need to
6872: use <span class="emphasis"><em>both</em></span>
6873: <code class="filename">${X11BASE}</code> and
6874: <code class="filename">${LOCALBASE}</code>. To
6875: force installation of all X11 packages in
6876: <code class="varname">LOCALBASE</code>, the
6877: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
6878: href=
1.1 grant 6879: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.7 wiz 6880: class="pkgname">pkgtools/xpkgwedge</a> is enabled
6881: by default.</p>
1.1 grant 6882: </li>
6883:
6884: <li>
1.7 wiz 6885: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 6886: used to refer to the installed location of an X11
1.7 wiz 6887: package. <code class="varname">X11PREFIX</code>
6888: will be set to <code class="varname">X11BASE</code>
6889: if xpkgwedge is not installed, and to <code class=
6890: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 6891: installed.</p>
6892: </li>
6893:
6894: <li>
6895: <p>If xpkgwedge is installed, it is possible to
1.7 wiz 6896: have some packages installed in <code class=
6897: "varname">X11BASE</code> and some in <code class=
6898: "varname">LOCALBASE</code>. To determine the prefix
6899: of an installed package, the <code class=
6900: "varname">EVAL_PREFIX</code> definition can be
6901: used. It takes pairs in the format
6902: “<span class=
1.1 grant 6903: "quote">DIRNAME=<package></span>”, and
1.7 wiz 6904: the make(1) variable <code class=
6905: "varname">DIRNAME</code> will be set to the prefix
6906: of the installed package <package>, or
1.1 grant 6907: “<span class=
6908: "quote">${X11PREFIX}</span>” if the package
6909: is not installed.</p>
6910:
6911: <p>This is best illustrated by example.</p>
6912:
1.7 wiz 6913: <p>The following lines are taken from <code class=
6914: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 6915: <pre class="programlisting">
1.7 wiz 6916: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 6917: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
6918: --with-gtk-prefix="${GTKDIR}" \
6919: --enable-multibyte
6920: </pre>
6921:
6922: <p>Specific defaults can be defined for the
1.7 wiz 6923: packages evaluated using <code class=
6924: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 6925: of the form:</p>
6926: <pre class="programlisting">
6927: GTKDIR_DEFAULT= ${LOCALBASE}
6928: </pre>
6929:
1.7 wiz 6930: <p>where <code class="varname">GTKDIR</code>
1.1 grant 6931: corresponds to the first definition in the
1.7 wiz 6932: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 6933: </li>
6934:
6935: <li>
1.7 wiz 6936: <p>Within <code class="filename">${PREFIX}</code>,
1.1 grant 6937: packages should install files according to hier(7),
6938: with the exception that manual pages go into
1.7 wiz 6939: <code class="filename">${PREFIX}/man</code>, not
6940: <code class=
6941: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 6942: </li>
6943: </ul>
6944: </div>
6945: </div>
6946:
6947: <div class="sect1" lang="en" xml:lang="en">
6948: <div class="titlepage">
6949: <div>
6950: <div>
6951: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 6952: "id2589156" id="id2589156"></a>11.2. Main
1.1 grant 6953: targets</h2>
6954: </div>
6955: </div>
6956: </div>
6957:
6958: <p>The main targets used during the build process defined
1.7 wiz 6959: in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 6960:
6961: <div class="variablelist">
6962: <dl>
6963: <dt><span class="term">fetch</span></dt>
6964:
6965: <dd>
6966: <p>This will check if the file(s) given in the
1.7 wiz 6967: variables <code class="varname">DISTFILES</code>
6968: and <code class="varname">PATCHFILES</code> (as
6969: defined in the package's Makefile) are present on
6970: the local system in <code class=
6971: "filename">/usr/pkgsrc/distfiles</code>. If they
6972: are not present, an attempt will be made to fetch
6973: them using commands of the form:</p>
1.1 grant 6974: <pre class="programlisting">
6975: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
6976: </pre>
6977:
6978: <p>where ${site} varies through several
1.7 wiz 6979: possibilities in turn: first, <code class=
6980: "varname">MASTER_SITE_OVERRIDE</code> is tried,
6981: then the sites specified in either <code class=
6982: "varname">SITES_file</code> if defined, else
6983: <code class="varname">MASTER_SITES</code> or
6984: <code class="varname">PATCH_SITES</code>, as
6985: applies, then finally the value of <code class=
6986: "varname">MASTER_SITE_BACKUP</code>. The order of
6987: all except the first can be optionally sorted by
6988: the user, via setting either <code class=
6989: "varname">MASTER_SORT_AWK</code> or <code class=
6990: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 6991: </dd>
6992:
6993: <dt><span class="term">checksum</span></dt>
6994:
6995: <dd>
6996: <p>After the distfile(s) are fetched, their
6997: checksum is generated and compared with the
6998: checksums stored in the distinfo file. If the
6999: checksums don't match, the build is aborted. This
7000: is to ensure the same distfile is used for
7001: building, and that the distfile wasn't changed,
7002: e.g. by some malign force, deliberately changed
7003: distfiles on the master distribution site or
7004: network lossage.</p>
7005: </dd>
7006:
7007: <dt><span class="term">extract</span></dt>
7008:
7009: <dd>
7010: <p>When the distfiles are present on the local
7011: system, they need to be extracted, as they are
7012: usually in the form of some compressed archive
1.7 wiz 7013: format, most commonly <code class=
7014: "filename">.tar.gz</code>.</p>
1.1 grant 7015:
7016: <p>If only some of the distfiles need to be
7017: uncompressed, the files to be uncompressed should
1.7 wiz 7018: be put into <code class=
7019: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 7020:
1.7 wiz 7021: <p>If the distfiles are not in <code class=
7022: "filename">.tar.gz</code> format, they can be
7023: extracted by setting either <code class=
7024: "varname">EXTRACT_SUFX</code>, or <code class=
7025: "varname">EXTRACT_CMD</code>, <code class=
7026: "varname">EXTRACT_BEFORE_ARGS</code> and
7027: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
7028: the former case, pkgsrc knows how to extract a
7029: number of suffixes (<code class=
7030: "filename">.tar.gz</code>, <code class=
7031: "filename">.tgz</code>, <code class=
7032: "filename">.tar.gz2</code>, <code class=
7033: "filename">.tbz</code>, <code class=
7034: "filename">.tar.Z</code>, <code class=
7035: "filename">.tar</code>, <code class=
7036: "filename">.shar.gz</code>, <code class=
7037: "filename">.shar.bz2</code>, <code class=
7038: "filename">.shar.Z</code>, <code class=
7039: "filename">.shar</code>, <code class=
7040: "filename">.Z</code>, <code class=
7041: "filename">.bz2</code> and <code class=
7042: "filename">.gz</code>; see the definition of the
7043: various <code class="varname">DECOMPRESS_CMD</code>
7044: variables <code class="filename">bsd.pkg.mk</code>
7045: for a complete list). Here's an example on how to
7046: use the other variables for a program that comes
7047: with a compressed shell archive whose name ends in
7048: <code class="filename">.msg.gz</code>:</p>
1.1 grant 7049: <pre class="programlisting">
7050: EXTRACT_SUFX= .msg.gz
7051: EXTRACT_CMD= zcat
7052: EXTRACT_BEFORE_ARGS=
7053: EXTRACT_AFTER_ARGS= |sh
7054: </pre>
7055: </dd>
7056:
7057: <dt><span class="term">patch</span></dt>
7058:
7059: <dd>
7060: <p>After extraction, all the patches named by the
1.7 wiz 7061: <code class="varname">PATCHFILES</code>, those
7062: present in the patches subdirectory of the package
7063: as well as in $LOCALPATCHES/$PKGPATH (e.g.
7064: <code class=
7065: "filename">/usr/local/patches/graphics/png</code>)
7066: are applied. Patchfiles ending in <code class=
7067: "filename">.Z</code> or <code class=
7068: "filename">.gz</code> are uncompressed before they
7069: are applied, files ending in <code class=
7070: "filename">.orig</code> or <code class=
7071: "filename">.rej</code> are ignored. Any special
7072: options to patch(1) can be handed in <code class=
7073: "varname">PATCH_DIST_ARGS</code>. See <a href=
7074: "#components.patches" title=
1.1 grant 7075: "7.3. patches/*">Section 7.3,
7076: “patches/*”</a> for more details.</p>
7077:
7078: <p>By default patch(1) is given special args to
7079: make it fail if the patches apply with some lines
7080: of fuzz. Please fix (regen) the patches so that
7081: they apply cleanly. The rationale behind this is
7082: that patches that don't apply cleanly may end up
7083: being applied in the wrong place, and cause severe
7084: harm there.</p>
7085: </dd>
7086:
7087: <dt><span class="term">configure</span></dt>
7088:
7089: <dd>
7090: <p>Most pieces of software need information on the
7091: header files, system calls, and library routines
7092: which are available in NetBSD. This is the process
7093: known as configuration, and is usually automated.
7094: In most cases, a script is supplied with the
7095: source, and its invocation results in generation of
7096: header files, Makefiles, etc.</p>
7097:
7098: <p>If the program's distfile contains its own
7099: configure script, this can be invoked by setting
1.7 wiz 7100: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 7101: configure script is a GNU autoconf script,
1.7 wiz 7102: <code class="varname">GNU_CONFIGURE</code> should
7103: be specified instead. In either case, any arguments
7104: to the configure script can be specified in the
7105: <code class="varname">CONFIGURE_ARGS</code>
7106: variable, and the configure script's name can be
7107: set in <code class=
7108: "varname">CONFIGURE_SCRIPT</code> if it differs
7109: from the default “<span class=
1.1 grant 7110: "quote">configure</span>”. Here's an example
7111: from the <a xmlns=
7112: "http://www.w3.org/TR/xhtml1/transitional" href=
7113: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.7 wiz 7114: class="pkgname">sysutils/top</a> package:</p>
1.1 grant 7115: <pre class="programlisting">
7116: HAS_CONFIGURE= yes
7117: CONFIGURE_SCRIPT= Configure
7118: CONFIGURE_ARGS+= netbsd13
7119: </pre>
7120:
7121: <p>If the program uses an Imakefile for
7122: configuration, the appropriate steps can be invoked
1.7 wiz 7123: by setting <code class="varname">USE_IMAKE</code>
7124: to “<span class="quote">YES</span>”.
7125: (If you only want the package installed in
7126: <code class="varname">$X11PREFIX</code> but xmkmf
7127: not being run, set <code class=
7128: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 7129: </dd>
7130:
7131: <dt><span class="term">build</span></dt>
7132:
7133: <dd>
7134: <p>Once configuration has taken place, the software
1.7 wiz 7135: will be built by invoking <code class=
7136: "varname">$MAKE_PROGRAM</code> on <code class=
7137: "varname">$MAKEFILE</code> with <code class=
1.10 wiz 7138: "varname">$BUILD_TARGET</code> as the target to
1.7 wiz 7139: build. The default <code class=
7140: "varname">MAKE_PROGRAM</code> is
7141: “<span class="quote">gmake</span>” if
7142: <code class="varname">USE_GNU_TOOLS</code> contains
7143: “<span class="quote">make</span>”,
1.1 grant 7144: “<span class="quote">make</span>”
1.7 wiz 7145: otherwise. <code class="varname">MAKEFILE</code> is
7146: set to “<span class=
1.1 grant 7147: "quote">Makefile</span>” by default, and
1.11 ben 7148: <code class="varname">BUILD_TARGET</code> defaults
7149: to “<span class="quote">all</span>”.
7150: Any of these variables can be set in the package's
1.1 grant 7151: Makefile to change the default build process.</p>
7152: </dd>
7153:
7154: <dt><span class="term">install</span></dt>
7155:
7156: <dd>
7157: <p>Once the build stage has completed, the final
7158: step is to install the software in public
7159: directories, so users can access the programs and
1.7 wiz 7160: files. As in the build-target, <code class=
7161: "varname">$MAKE_PROGRAM</code> is invoked on
7162: <code class="varname">$MAKEFILE</code> here, but
7163: with the <code class=
7164: "varname">$INSTALL_TARGET</code> instead, the
7165: latter defaulting to “<span class=
7166: "quote">install</span>” (plus
7167: “<span class=
7168: "quote">install.man</span>”, if <code class=
7169: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 7170: </dd>
7171: </dl>
7172: </div>
7173:
7174: <p>If no target is specified, the default is
7175: “<span class="quote">build</span>”. If a
7176: subsequent stage is requested, all prior stages are made:
1.7 wiz 7177: e.g. <span><strong class="command">make
7178: build</strong></span> will also perform the equivalent
7179: of:</p>
1.1 grant 7180: <pre class="programlisting">
7181: make fetch
7182: make checksum
7183: make extract
7184: make patch
7185: make configure
7186: make build
7187: </pre>
7188: </div>
7189:
7190: <div class="sect1" lang="en" xml:lang="en">
7191: <div class="titlepage">
7192: <div>
7193: <div>
7194: <h2 class="title" style="clear: both"><a name=
7195: "build.helpful-targets" id=
7196: "build.helpful-targets"></a>11.3. Other
7197: helpful targets</h2>
7198: </div>
7199: </div>
7200: </div>
7201:
7202: <div class="variablelist">
7203: <dl>
7204: <dt><span class="term">pre/post-*</span></dt>
7205:
7206: <dd>
7207: <p>For any of the main targets described in the
7208: previous section, two auxiliary targets exist with
7209: “<span class="quote">pre-</span>” and
7210: “<span class="quote">post-</span>” used
7211: as a prefix for the main target's name. These
7212: targets are invoked before and after the main
7213: target is called, allowing extra configuration or
7214: installation steps be performed from a package's
7215: Makefile, for example, which a program's configure
7216: script or install target omitted.</p>
7217: </dd>
7218:
7219: <dt><span class="term">do-*</span></dt>
7220:
7221: <dd>
7222: <p>Should one of the main targets do the wrong
7223: thing, and should there be no variable to fix this,
7224: you can redefine it with the do-* target. (Note
7225: that redefining the target itself instead of the
7226: do-* target is a bad idea, as the pre-* and post-*
7227: targets won't be called anymore, etc.) You will not
7228: usually need to do this.</p>
7229: </dd>
7230:
7231: <dt><span class="term">reinstall</span></dt>
7232:
7233: <dd>
1.7 wiz 7234: <p>If you did a <span><strong class="command">make
7235: install</strong></span> and you noticed some file
7236: was not installed properly, you can repeat the
1.1 grant 7237: installation with this target, which will ignore
7238: the “<span class="quote">already
7239: installed</span>” flag.</p>
7240: </dd>
7241:
7242: <dt><span class="term">deinstall</span></dt>
7243:
7244: <dd>
7245: <p>This target does a pkg_delete(1) in the current
7246: directory, effectively de-installing the package.
7247: The following variables can be used to tune the
7248: behaviour:</p>
7249:
7250: <div class="variablelist">
7251: <dl>
1.7 wiz 7252: <dt><span class="term"><code class=
7253: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 7254:
7255: <dd>
7256: <p>Add a "-v" to the <a href=
7257: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7258: <span class="citerefentry"><span class=
7259: "refentrytitle">pkg_delete</span>(1)</span></a>
7260: command.</p>
7261: </dd>
7262:
1.7 wiz 7263: <dt><span class="term"><code class=
7264: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 7265:
7266: <dd>
7267: <p>Remove all packages that require (depend
7268: on) the given package. This can be used to
7269: remove any packages that may have been pulled
7270: in by a given package, e.g. if
1.7 wiz 7271: <span><strong class="command">make deinstall
7272: DEINSTALLDEPENDS=1</strong></span> is done in
7273: <code class="filename">pkgsrc/x11/kde</code>,
1.1 grant 7274: this is likely to remove whole KDE. Works by
7275: adding “<span class=
7276: "quote">-R</span>” to the <a href=
7277: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7278: <span class="citerefentry"><span class=
7279: "refentrytitle">pkg_delete</span>(1)</span></a>
7280: command line.</p>
7281: </dd>
7282: </dl>
7283: </div>
7284: </dd>
7285:
7286: <dt><span class="term">update</span></dt>
7287:
7288: <dd>
7289: <p>This target causes the current package to be
7290: updated to the latest version. The package and all
7291: depending packages first get de-installed, then
7292: current versions of the corresponding packages get
7293: compiled and installed. This is similar to manually
7294: noting which packages are currently installed, then
1.7 wiz 7295: performing a series of <span><strong class=
7296: "command">make deinstall</strong></span> and
7297: <span><strong class="command">make
7298: install</strong></span> (or whatever <code class=
7299: "varname">UPDATE_TARGET</code> is set to) for these
7300: packages.</p>
1.1 grant 7301:
7302: <p>You can use the “<span class=
7303: "quote">update</span>” target to resume
1.7 wiz 7304: package updating in case a previous
7305: <span><strong class="command">make
7306: update</strong></span> was interrupted for some
7307: reason. However, in this case, make sure you don't
7308: call <span><strong class="command">make
7309: clean</strong></span> or otherwise remove the list
7310: of dependent packages in <code class=
7311: "varname">WRKDIR</code>. Otherwise you lose the
1.1 grant 7312: ability to automatically update the current package
7313: along with the dependent packages you have
7314: installed.</p>
7315:
1.7 wiz 7316: <p>Resuming an interrupted <span><strong class=
7317: "command">make update</strong></span> will only
7318: work as long as the package tree remains unchanged.
7319: If the source code for one of the packages to be
7320: updated has been changed, resuming
7321: <span><strong class="command">make
7322: update</strong></span> will most certainly
7323: fail!</p>
1.1 grant 7324:
7325: <p>The following variables can be used either on
1.7 wiz 7326: the command line or in <code class=
7327: "filename">/etc/mk.conf</code> to alter the
7328: behaviour of <span><strong class="command">make
7329: update</strong></span>:</p>
1.1 grant 7330:
7331: <div class="variablelist">
7332: <dl>
1.7 wiz 7333: <dt><span class="term"><code class=
7334: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 7335:
7336: <dd>
7337: <p>Install target to recursively use for the
7338: updated package and the dependent packages.
1.7 wiz 7339: Defaults to <code class=
7340: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 7341: “<span class=
7342: "quote">install</span>” otherwise for
1.7 wiz 7343: <span><strong class="command">make
7344: update</strong></span>. e.g.
7345: <span><strong class="command">make update
7346: UPDATE_TARGET=package</strong></span></p>
1.1 grant 7347: </dd>
7348:
1.7 wiz 7349: <dt><span class="term"><code class=
7350: "varname">NOCLEAN</code></span></dt>
1.1 grant 7351:
7352: <dd>
7353: <p>Don't clean up after updating. Useful if
7354: you want to leave the work sources of the
7355: updated packages around for inspection or
7356: other purposes. Be sure you eventually clean
7357: up the source tree (see the
7358: “<span class=
7359: "quote">clean-update</span>” target
7360: below) or you may run into troubles with old
7361: source code still lying around on your next
1.7 wiz 7362: <span><strong class=
7363: "command">make</strong></span> or
7364: <span><strong class="command">make
7365: update</strong></span>.</p>
1.1 grant 7366: </dd>
7367:
1.7 wiz 7368: <dt><span class="term"><code class=
7369: "varname">REINSTALL</code></span></dt>
1.1 grant 7370:
7371: <dd>
7372: <p>Deinstall each package before installing
1.7 wiz 7373: (making <code class=
7374: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 7375: necessary if the “<span class=
7376: "quote">clean-update</span>” target
7377: (see below) was called after interrupting a
1.7 wiz 7378: running <span><strong class="command">make
7379: update</strong></span>.</p>
1.1 grant 7380: </dd>
7381:
1.7 wiz 7382: <dt><span class="term"><code class=
7383: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 7384:
7385: <dd>
7386: <p>Allows you to disable recursion and
7387: hardcode the target for packages. The default
7388: is “<span class=
7389: "quote">update</span>” for the update
7390: target, facilitating a recursive update of
1.7 wiz 7391: prerequisite packages. Only set <code class=
7392: "varname">DEPENDS_TARGET</code> if you want
7393: to disable recursive updates. Use
7394: <code class="varname">UPDATE_TARGET</code>
7395: instead to just set a specific target for
7396: each package to be installed during
7397: <span><strong class="command">make
7398: update</strong></span> (see above).</p>
1.1 grant 7399: </dd>
7400: </dl>
7401: </div>
7402: </dd>
7403:
7404: <dt><span class="term">clean-update</span></dt>
7405:
7406: <dd>
7407: <p>Clean the source tree for all packages that
1.7 wiz 7408: would get updated if <span><strong class=
7409: "command">make update</strong></span> was called
7410: from the current directory. This target should not
7411: be used if the current package (or any of its
7412: depending packages) have already been de-installed
7413: (e.g., after calling <span><strong class=
7414: "command">make update</strong></span>) or you may
7415: lose some packages you intended to update. As a
7416: rule of thumb: only use this target <span class=
7417: "emphasis"><em>before</em></span> the first time
7418: you run <span><strong class="command">make
7419: update</strong></span> and only if you have a dirty
7420: package tree (e.g., if you used <code class=
7421: "varname">NOCLEAN</code>).</p>
1.1 grant 7422:
7423: <p>If you unsure about whether your tree is clean
1.7 wiz 7424: you can either perform a <span><strong class=
7425: "command">make clean</strong></span> at the top of
7426: the tree, or use the following sequence of commands
1.1 grant 7427: from the directory of the package you want to
7428: update (<span class=
7429: "emphasis"><em>before</em></span> running
1.7 wiz 7430: <span><strong class="command">make
7431: update</strong></span> for the first time,
7432: otherwise you lose all the packages you wanted to
7433: update!):</p>
1.1 grant 7434: <pre class="screen">
1.7 wiz 7435: <code class="prompt">#</code> <strong class=
7436: "userinput"><code>make clean-update</code></strong>
7437: <code class="prompt">#</code> <strong class=
7438: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
7439: <code class="prompt">#</code> <strong class=
7440: "userinput"><code>make update</code></strong>
1.1 grant 7441: </pre>
7442:
7443: <p>The following variables can be used either on
1.7 wiz 7444: the command line or in <code class=
7445: "filename">/etc/mk.conf</code> to alter the
7446: behaviour of <span><strong class="command">make
7447: clean-update</strong></span>:</p>
1.1 grant 7448:
7449: <div class="variablelist">
7450: <dl>
1.7 wiz 7451: <dt><span class="term"><code class=
7452: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 7453:
7454: <dd>
1.7 wiz 7455: <p>After <span><strong class="command">make
7456: clean</strong></span>, do not reconstruct the
7457: list of directories to update for this
7458: package. Only use this if
7459: <span><strong class="command">make
7460: update</strong></span> successfully installed
7461: all packages you wanted to update. Normally,
7462: this is done automatically on
7463: <span><strong class="command">make
7464: update</strong></span>, but may have been
7465: suppressed by the <code class=
7466: "varname">NOCLEAN</code> variable (see
1.1 grant 7467: above).</p>
7468: </dd>
7469: </dl>
7470: </div>
7471: </dd>
7472:
7473: <dt><span class="term">info</span></dt>
7474:
7475: <dd>
7476: <p>This target invokes <a href=
7477: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
7478: <span class="citerefentry"><span class=
7479: "refentrytitle">pkg_info</span>(1)</span></a> for
7480: the current package. You can use this to check
7481: which version of a package is installed.</p>
7482: </dd>
7483:
7484: <dt><span class="term">readme</span></dt>
7485:
7486: <dd>
1.7 wiz 7487: <p>This target generates a <code class=
7488: "filename">README.html</code> file, which can be
1.1 grant 7489: viewed using a browser such as <a xmlns=
7490: "http://www.w3.org/TR/xhtml1/transitional" href=
7491: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.7 wiz 7492: class="pkgname">www/mozilla</a> or <a xmlns=
7493: "http://www.w3.org/TR/xhtml1/transitional" href=
7494: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
7495: class="pkgname">www/links</a>. The generated files
7496: contain references to any packages which are in the
7497: <code class="varname">PACKAGES</code> directory on
7498: the local host. The generated files can be made to
7499: refer to URLs based on <code class=
7500: "varname">FTP_PKG_URL_HOST</code> and <code class=
7501: "varname">FTP_PKG_URL_DIR</code>. For example, if I
7502: wanted to generate <code class=
7503: "filename">README.html</code> files which pointed
7504: to binary packages on the local machine, in the
7505: directory <code class=
7506: "filename">/usr/packages</code>, set <code class=
7507: "varname">FTP_PKG_URL_HOST=file://localhost</code>
7508: and <code class=
7509: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
7510: <code class="varname">${PACKAGES}</code> directory
7511: and its subdirectories will be searched for all the
7512: binary packages.</p>
1.1 grant 7513: </dd>
7514:
7515: <dt><span class="term">readme-all</span></dt>
7516:
7517: <dd>
1.7 wiz 7518: <p>Use this target to create a file <code class=
7519: "filename">README-all.html</code> which contains a
1.1 grant 7520: list of all packages currently available in the
7521: NetBSD Packages Collection, together with the
7522: category they belong to and a short description.
1.7 wiz 7523: This file is compiled from the <code class=
7524: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 7525: sure to run this <span class=
1.7 wiz 7526: "emphasis"><em>after</em></span> a
7527: <span><strong class="command">make
7528: readme</strong></span>.</p>
1.1 grant 7529: </dd>
7530:
7531: <dt><span class="term">cdrom-readme</span></dt>
7532:
7533: <dd>
7534: <p>This is very much the same as the
7535: “<span class="quote">readme</span>”
7536: target (see above), but is to be used when
7537: generating a pkgsrc tree to be written to a CD-ROM.
1.7 wiz 7538: This target also produces <code class=
7539: "filename">README.html</code> files, and can be
7540: made to refer to URLs based on <code class=
7541: "varname">CDROM_PKG_URL_HOST</code> and
7542: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 7543: </dd>
7544:
7545: <dt><span class="term">show-distfiles</span></dt>
7546:
7547: <dd>
7548: <p>This target shows which distfiles and patchfiles
1.7 wiz 7549: are needed to build the package. (<code class=
7550: "varname">DISTFILES</code> and <code class=
7551: "varname">PATCHFILES</code>, but not <code class=
7552: "filename">patches/*</code>)</p>
1.1 grant 7553: </dd>
7554:
7555: <dt><span class="term">show-downlevel</span></dt>
7556:
7557: <dd>
7558: <p>This target shows nothing if the package is not
7559: installed. If a version of this package is
7560: installed, but is not the version provided in this
7561: version of pkgsrc, then a warning message is
7562: displayed. This target can be used to show which of
7563: your installed packages are downlevel, and so the
7564: old versions can be deleted, and the current ones
7565: added.</p>
7566: </dd>
7567:
7568: <dt><span class="term">show-pkgsrc-dir</span></dt>
7569:
7570: <dd>
7571: <p>This target shows the directory in the pkgsrc
7572: hierarchy from which the package can be built and
7573: installed. This may not be the same directory as
7574: the one from which the package was installed. This
7575: target is intended to be used by people who may
7576: wish to upgrade many packages on a single host, and
7577: can be invoked from the top-level pkgsrc Makefile
7578: by using the “<span class=
7579: "quote">show-host-specific-pkgs</span>”
7580: target.</p>
7581: </dd>
7582:
7583: <dt><span class=
7584: "term">show-installed-depends</span></dt>
7585:
7586: <dd>
7587: <p>This target shows which installed packages match
1.7 wiz 7588: the current package's <code class=
7589: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 7590: dependencies are causing build problems.</p>
7591: </dd>
7592:
7593: <dt><span class="term">check-shlibs</span></dt>
7594:
7595: <dd>
7596: <p>After a package is installed, check all its
7597: binaries and (on ELF platforms) shared libraries to
7598: see if they find the shared libs they need. Run by
1.7 wiz 7599: default if <code class=
7600: "varname">PKG_DEVELOPER</code> is set in
7601: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 7602: </dd>
7603:
7604: <dt><span class="term">print-PLIST</span></dt>
7605:
7606: <dd>
7607: <p>After a “<span class="quote">make
7608: install</span>” from a new or upgraded pkg,
7609: this prints out an attempt to generate a new
1.7 wiz 7610: <code class="filename">PLIST</code> from a
7611: <span><strong class="command">find -newer
7612: work/.extract_done</strong></span>. An attempt is
7613: made to care for shared libs etc., but it is
1.1 grant 7614: <span class="emphasis"><em>strongly</em></span>
7615: recommended to review the result before putting it
1.7 wiz 7616: into <code class="filename">PLIST</code>. On
7617: upgrades, it's useful to diff the output of this
7618: command against an already existing <code class=
7619: "filename">PLIST</code> file.</p>
1.1 grant 7620:
7621: <p>If the package installs files via tar(1) or
7622: other methods that don't update file access times,
7623: be sure to add these files manually to your
1.7 wiz 7624: <code class="filename">PLIST</code>, as the
1.1 grant 7625: “<span class="quote">find
7626: -newer</span>” command used by this target
7627: won't catch them!</p>
7628:
7629: <p>See <a href="#print-PLIST" title=
7630: "8.3. Tweaking output of make print-PLIST">Section 8.3,
1.7 wiz 7631: “Tweaking output of <span><strong class=
7632: "command">make
7633: print-PLIST</strong></span>”</a> for more
7634: information on this target.</p>
1.1 grant 7635: </dd>
7636:
7637: <dt><span class="term">bulk-package</span></dt>
7638:
7639: <dd>
7640: <p>Used to do bulk builds. If an appropriate binary
7641: package already exists, no action is taken. If not,
7642: this target will compile, install and package it
1.7 wiz 7643: (and it's depends, if <code class=
7644: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 7645: <a href="#binary.configuration" title=
7646: "5.3.1. Configuration">Section 5.3.1,
7647: “Configuration”</a>. After creating the
7648: binary package, the sources, the just-installed
7649: package and it's required packages are removed,
7650: preserving free disk space.</p>
7651:
7652: <p><span class="emphasis"><em>Beware that this
7653: target may deinstall all packages installed on a
7654: system!</em></span></p>
7655: </dd>
7656:
7657: <dt><span class="term">bulk-install</span></dt>
7658:
7659: <dd>
7660: <p>Used during bulk-installs to install required
7661: packages. If an upto-date binary package is
7662: available, it will be installed via <a href=
7663: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7664: <span class="citerefentry"><span class=
7665: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.7 wiz 7666: not, <span><strong class="command">make
7667: bulk-package</strong></span> will be executed, but
7668: the installed binary not be removed.</p>
1.1 grant 7669:
7670: <p>A binary package is considered
7671: “<span class="quote">upto-date</span>”
7672: to be installed via <a href=
7673: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7674: <span class="citerefentry"><span class=
7675: "refentrytitle">pkg_add</span>(1)</span></a>
7676: if:</p>
7677:
7678: <div class="itemizedlist">
7679: <ul type="disc">
7680: <li>
1.7 wiz 7681: <p>None of the package's files (<code class=
7682: "filename">Makefile</code>, ...) were
7683: modified since it was built.</p>
1.1 grant 7684: </li>
7685:
7686: <li>
7687: <p>None of the package's required (binary)
7688: packages were modified since it was
7689: built.</p>
7690: </li>
7691: </ul>
7692: </div>
7693:
7694: <p><span class="emphasis"><em>Beware that this
7695: target may deinstall all packages installed on a
7696: system!</em></span></p>
7697: </dd>
7698: </dl>
7699: </div>
7700: </div>
7701: </div>
7702:
7703: <div class="chapter" lang="en" xml:lang="en">
7704: <div class="titlepage">
7705: <div>
7706: <div>
7707: <h2 class="title"><a name="fixes" id=
7708: "fixes"></a>Chapter 12. Notes on fixes for
7709: packages</h2>
7710: </div>
7711: </div>
7712: </div>
7713:
7714: <div class="toc">
7715: <p><b>Table of Contents</b></p>
7716:
7717: <dl>
1.12 ! agc 7718: <dt><span class="sect1"><a href="#id2590556">12.1.
1.1 grant 7719: General operation</a></span></dt>
7720:
7721: <dd>
7722: <dl>
7723: <dt><span class="sect2"><a href=
1.12 ! agc 7724: "#id2590560">12.1.1. How to pull in variables from
1.1 grant 7725: /etc/mk.conf</a></span></dt>
7726:
7727: <dt><span class="sect2"><a href=
1.12 ! agc 7728: "#id2590643">12.1.2. Restricted
1.1 grant 7729: packages</a></span></dt>
7730:
7731: <dt><span class="sect2"><a href=
7732: "#dependencies">12.1.3. Handling
7733: dependencies</a></span></dt>
7734:
7735: <dt><span class="sect2"><a href=
1.12 ! agc 7736: "#id2591226">12.1.4. Handling conflicts with other
1.1 grant 7737: packages</a></span></dt>
7738:
7739: <dt><span class="sect2"><a href=
1.12 ! agc 7740: "#id2591276">12.1.5. Packages that cannot or should
1.1 grant 7741: not be built</a></span></dt>
7742:
7743: <dt><span class="sect2"><a href=
1.12 ! agc 7744: "#id2591302">12.1.6. Packages which should not be
1.1 grant 7745: deleted, once installed</a></span></dt>
7746:
7747: <dt><span class="sect2"><a href=
7748: "#security-handling">12.1.7. Handling packages with
7749: security problems</a></span></dt>
7750:
7751: <dt><span class="sect2"><a href=
1.12 ! agc 7752: "#id2591462">12.1.8. How to handle compiler
1.1 grant 7753: bugs</a></span></dt>
7754:
7755: <dt><span class="sect2"><a href=
1.12 ! agc 7756: "#id2591484">12.1.9. How to handle incrementing
1.1 grant 7757: versions when fixing an existing
7758: package</a></span></dt>
7759:
7760: <dt><span class="sect2"><a href=
1.12 ! agc 7761: "#id2591533">12.1.10. Portability of
1.1 grant 7762: packages</a></span></dt>
7763: </dl>
7764: </dd>
7765:
1.12 ! agc 7766: <dt><span class="sect1"><a href="#id2591626">12.2.
1.1 grant 7767: Possible downloading issues</a></span></dt>
7768:
7769: <dd>
7770: <dl>
7771: <dt><span class="sect2"><a href=
1.12 ! agc 7772: "#id2591629">12.2.1. Packages whose distfiles
1.1 grant 7773: aren't available for plain
7774: downloading</a></span></dt>
7775:
7776: <dt><span class="sect2"><a href=
1.12 ! agc 7777: "#id2591692">12.2.2. How to handle modified
1.1 grant 7778: distfiles with the 'old' name</a></span></dt>
7779: </dl>
7780: </dd>
7781:
1.12 ! agc 7782: <dt><span class="sect1"><a href="#id2591704">12.3.
1.1 grant 7783: Configuration gotchas</a></span></dt>
7784:
7785: <dd>
7786: <dl>
7787: <dt><span class="sect2"><a href=
7788: "#fixes.libtool">12.3.1. Shared libraries -
7789: libtool</a></span></dt>
7790:
7791: <dt><span class="sect2"><a href=
1.12 ! agc 7792: "#id2592180">12.3.2. Using libtool on GNU packages
1.1 grant 7793: that already support libtool</a></span></dt>
7794:
7795: <dt><span class="sect2"><a href=
1.12 ! agc 7796: "#id2592264">12.3.3. GNU
1.1 grant 7797: Autoconf/Automake</a></span></dt>
7798: </dl>
7799: </dd>
7800:
1.12 ! agc 7801: <dt><span class="sect1"><a href="#id2592309">12.4.
1.1 grant 7802: Building considerations</a></span></dt>
7803:
7804: <dd>
7805: <dl>
7806: <dt><span class="sect2"><a href=
1.12 ! agc 7807: "#id2592312">12.4.1. CPP defines</a></span></dt>
1.1 grant 7808: </dl>
7809: </dd>
7810:
1.12 ! agc 7811: <dt><span class="sect1"><a href="#id2592342">12.5.
1.1 grant 7812: Package specific actions</a></span></dt>
7813:
7814: <dd>
7815: <dl>
7816: <dt><span class="sect2"><a href=
1.12 ! agc 7817: "#id2592345">12.5.1. Package configuration
1.1 grant 7818: files</a></span></dt>
7819:
7820: <dt><span class="sect2"><a href=
1.12 ! agc 7821: "#id2592516">12.5.2. User
1.2 hubertf 7822: interaction</a></span></dt>
1.1 grant 7823:
7824: <dt><span class="sect2"><a href=
1.12 ! agc 7825: "#id2592561">12.5.3. Handling
1.1 grant 7826: licenses</a></span></dt>
7827:
7828: <dt><span class="sect2"><a href=
1.12 ! agc 7829: "#id2592644">12.5.4. Creating an account from a
1.1 grant 7830: package</a></span></dt>
7831:
7832: <dt><span class="sect2"><a href=
1.12 ! agc 7833: "#id2592774">12.5.5. Installing score
1.1 grant 7834: files</a></span></dt>
7835:
7836: <dt><span class="sect2"><a href=
1.12 ! agc 7837: "#id2592818">12.5.6. Packages providing login
1.1 grant 7838: shells</a></span></dt>
7839:
7840: <dt><span class="sect2"><a href=
1.12 ! agc 7841: "#id2593012">12.5.7. Packages containing perl
1.1 grant 7842: scripts</a></span></dt>
7843:
7844: <dt><span class="sect2"><a href=
1.12 ! agc 7845: "#id2593030">12.5.8. Packages with hardcoded paths
1.1 grant 7846: to other interpreters</a></span></dt>
7847:
7848: <dt><span class="sect2"><a href=
1.12 ! agc 7849: "#id2593051">12.5.9. Packages installing perl
1.1 grant 7850: modules</a></span></dt>
7851:
7852: <dt><span class="sect2"><a href=
7853: "#faq.info-files">12.5.10. Packages installing info
7854: files</a></span></dt>
7855:
7856: <dt><span class="sect2"><a href=
1.12 ! agc 7857: "#id2593408">12.5.11. Packages installing GConf2
1.1 grant 7858: data files</a></span></dt>
7859:
7860: <dt><span class="sect2"><a href=
1.12 ! agc 7861: "#id2593508">12.5.12. Packages installing
1.1 grant 7862: scrollkeeper data files</a></span></dt>
7863:
7864: <dt><span class="sect2"><a href=
1.12 ! agc 7865: "#id2593559">12.5.13. Packages installing X11
1.1 grant 7866: fonts</a></span></dt>
7867:
7868: <dt><span class="sect2"><a href=
1.12 ! agc 7869: "#id2593606">12.5.14. Packages installing GTK2
1.1 grant 7870: modules</a></span></dt>
7871:
7872: <dt><span class="sect2"><a href=
1.12 ! agc 7873: "#id2593675">12.5.15. Packages installing SGML or
1.1 grant 7874: XML data</a></span></dt>
7875:
7876: <dt><span class="sect2"><a href=
1.12 ! agc 7877: "#id2593728">12.5.16. Packages installing
1.1 grant 7878: extensions to the MIME database</a></span></dt>
7879:
7880: <dt><span class="sect2"><a href=
1.12 ! agc 7881: "#id2593798">12.5.17. Packages using
1.1 grant 7882: intltool</a></span></dt>
7883: </dl>
7884: </dd>
7885:
1.12 ! agc 7886: <dt><span class="sect1"><a href="#id2593812">12.6.
1.1 grant 7887: Feedback to the author</a></span></dt>
7888: </dl>
7889: </div>
7890:
7891: <div class="sect1" lang="en" xml:lang="en">
7892: <div class="titlepage">
7893: <div>
7894: <div>
7895: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 7896: "id2590556" id="id2590556"></a>12.1. General
1.1 grant 7897: operation</h2>
7898: </div>
7899: </div>
7900: </div>
7901:
7902: <div class="sect2" lang="en" xml:lang="en">
7903: <div class="titlepage">
7904: <div>
7905: <div>
1.12 ! agc 7906: <h3 class="title"><a name="id2590560" id=
! 7907: "id2590560"></a>12.1.1. How to pull in
1.1 grant 7908: variables from /etc/mk.conf</h3>
7909: </div>
7910: </div>
7911: </div>
7912:
7913: <p>The problem with package-defined variables that can
1.7 wiz 7914: be overridden via <code class="varname">MAKECONF</code>
7915: or <code class="filename">/etc/mk.conf</code> is that
7916: <a href=
1.1 grant 7917: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7918: <span class="citerefentry"><span class=
7919: "refentrytitle">make</span>(1)</span></a> expands a
7920: variable as it is used, but evaluates preprocessor like
7921: statements (.if, .ifdef and .ifndef) as they are read.
1.7 wiz 7922: So, to use any variable (which may be set in
7923: <code class="filename">/etc/mk.conf</code>) in one of
7924: the .if* statements, the file <code class=
7925: "filename">/etc/mk.conf</code> must be included before
1.1 grant 7926: that .if* statement.</p>
7927:
7928: <p>Rather than have a number of ad-hoc ways of
1.7 wiz 7929: including <code class="filename">/etc/mk.conf</code>,
7930: should it exist, or <code class=
7931: "varname">MAKECONF</code>, should it exist, include the
7932: <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
7933: file in the package Makefile before any
7934: preprocessor-like .if, .ifdef, or .ifndef
7935: statements:</p>
1.1 grant 7936: <pre class="programlisting">
7937: .include "../../mk/bsd.prefs.mk"
7938:
7939: .if defined(USE_MENUS)
7940: ...
7941: .endif
7942: </pre>
7943:
1.7 wiz 7944: <p>If you wish to set the <code class=
7945: "varname">CFLAGS</code> variable in <code class=
7946: "filename">/etc/mk.conf</code> please make sure to
1.1 grant 7947: use:</p>
7948: <pre class="programlisting">
7949: CFLAGS+= -your -flags
7950: </pre>
7951:
1.7 wiz 7952: <p>Using <code class="varname">CFLAGS=</code> (i.e.
7953: without the “<span class="quote">+</span>”)
7954: may lead to problems with packages that need to add
7955: their own flags. Also, you may want to take a look at
7956: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 7957: href=
7958: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.7 wiz 7959: class="pkgname">devel/cpuflags</a> package if you're
7960: interested in optimization for the current CPU.</p>
1.1 grant 7961: </div>
7962:
7963: <div class="sect2" lang="en" xml:lang="en">
7964: <div class="titlepage">
7965: <div>
7966: <div>
1.12 ! agc 7967: <h3 class="title"><a name="id2590643" id=
! 7968: "id2590643"></a>12.1.2. Restricted
1.1 grant 7969: packages</h3>
7970: </div>
7971: </div>
7972: </div>
7973:
7974: <p>Some licenses restrict how software may be
7975: re-distributed. In order to satisfy these restrictions,
7976: the package system defines five make variables that can
7977: be set to note these restrictions:</p>
7978:
7979: <div class="itemizedlist">
7980: <ul type="disc">
7981: <li>
1.7 wiz 7982: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 7983:
7984: <p>This variable should be set whenever a
7985: restriction exists (regardless of its kind). Set
7986: this variable to a string containing the reason
7987: for the restriction.</p>
7988: </li>
7989:
7990: <li>
1.7 wiz 7991: <p><code class=
7992: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 7993:
7994: <p>Binaries may not be placed on CD-ROM. Set this
1.7 wiz 7995: variable to <code class=
7996: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 7997: package may not be included on a CD-ROM.</p>
7998: </li>
7999:
8000: <li>
1.7 wiz 8001: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 8002:
8003: <p>Binaries may not be placed on an FTP server.
1.7 wiz 8004: Set this variable to <code class=
8005: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 8006: package may not not be made available on the
8007: Internet.</p>
8008: </li>
8009:
8010: <li>
1.7 wiz 8011: <p><code class=
8012: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 8013:
8014: <p>Distfiles may not be placed on CD-ROM. Set
1.7 wiz 8015: this variable to <code class=
8016: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 8017: of the source code or other distfile(s) is not
8018: allowed on CD-ROMs.</p>
8019: </li>
8020:
8021: <li>
1.7 wiz 8022: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 8023:
8024: <p>Distfiles may not be placed on FTP. Set this
1.7 wiz 8025: variable to <code class=
8026: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 8027: of the source code or other distfile(s) via the
8028: Internet is not allowed.</p>
8029: </li>
8030: </ul>
8031: </div>
8032:
1.7 wiz 8033: <p>Please note that the use of <code class=
8034: "varname">NO_PACKAGE</code>, <code class=
8035: "varname">IGNORE</code>, <code class=
8036: "varname">NO_CDROM</code>, or other generic make
1.1 grant 8037: variables to denote restrictions is deprecated, because
8038: they unconditionally prevent users from generating
8039: binary packages!</p>
8040: </div>
8041:
8042: <div class="sect2" lang="en" xml:lang="en">
8043: <div class="titlepage">
8044: <div>
8045: <div>
8046: <h3 class="title"><a name="dependencies" id=
8047: "dependencies"></a>12.1.3. Handling
8048: dependencies</h3>
8049: </div>
8050: </div>
8051: </div>
8052:
8053: <p>Your package may depend on some other package being
8054: present - and there are various ways of expressing this
1.7 wiz 8055: dependency. pkgsrc supports the <code class=
8056: "varname">BUILD_DEPENDS</code> and <code class=
8057: "varname">DEPENDS</code> definitions, as well as
8058: dependencies via <code class=
8059: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 8060: way to handle dependencies, and which uses the
8061: variables named above. See <a href="#buildlink" title=
8062: "Chapter 9. Buildlink methodology">Chapter 9,
8063: <i>Buildlink methodology</i></a> for more
8064: information.</p>
8065:
8066: <p>The basic difference between the two variables is as
1.7 wiz 8067: follows: The <code class="varname">DEPENDS</code>
1.1 grant 8068: definition registers that pre-requisite in the binary
8069: package so it will be pulled in when the binary package
1.7 wiz 8070: is later installed, whilst the <code class=
8071: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 8072: marking a dependency that is only needed for building
8073: the package.</p>
8074:
8075: <p>This means that if you only need a package present
8076: whilst you are building, it should be noted as a
1.7 wiz 8077: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 8078:
1.7 wiz 8079: <p>The format for a <code class=
8080: "varname">BUILD_DEPENDS</code> and a <code class=
8081: "varname">DEPENDS</code> definition is:</p>
1.1 grant 8082: <pre class="programlisting">
8083: <pre-req-package-name>:../../<category>/<pre-req-package>
8084: </pre>
8085:
8086: <p>Please note that the “<span class=
8087: "quote">pre-req-package-name</span>” may include
8088: any of the wildcard version numbers recognised by
8089: <a href=
8090: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
8091: <span class="citerefentry"><span class=
8092: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
8093:
8094: <div class="orderedlist">
8095: <ol type="1">
8096: <li>
8097: <p>If your package needs another package's
8098: binaries or libraries to build or run, and if
1.7 wiz 8099: that package has a <code class=
8100: "filename">buildlink3.mk</code> file available,
8101: use it:</p>
1.1 grant 8102: <pre class="programlisting">
8103: .include "../../graphics/jpeg/buildlink3.mk"
8104:
8105: </pre>
8106: </li>
8107:
8108: <li>
8109: <p>If your package needs to use another package
1.7 wiz 8110: to build itself and there is no <code class=
8111: "filename">buildlink3.mk</code> file available,
8112: use the <code class=
8113: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 8114: <pre class="programlisting">
8115: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
8116: </pre>
8117: </li>
8118:
8119: <li>
8120: <p>If your package needs a library with which to
1.7 wiz 8121: link and again there is no <code class=
8122: "filename">buildlink3.mk</code> file available,
8123: this is specified using the <code class=
8124: "varname">DEPENDS</code> definition. An example
8125: of this is the <a xmlns=
1.1 grant 8126: "http://www.w3.org/TR/xhtml1/transitional" href=
8127: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.7 wiz 8128: class="pkgname">print/lyx</a> package, which uses
8129: the xpm library, version 3.4j to build:</p>
1.1 grant 8130: <pre class="programlisting">
8131: DEPENDS+= xpm-3.4j:../../graphics/xpm
8132: </pre>
8133:
8134: <p>You can also use wildcards in package
8135: dependences:</p>
8136: <pre class="programlisting">
8137: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
8138: </pre>
8139:
8140: <p>Note that such wildcard dependencies are
8141: retained when creating binary packages. The
8142: dependency is checked when installing the binary
8143: package and any package which matches the pattern
8144: will be used. Wildcard dependencies should be
8145: used with care.</p>
8146:
8147: <p>The “<span class=
8148: "quote">-[0-9]*</span>” should be used
8149: instead of “<span class=
8150: "quote">-*</span>” to avoid potentially
8151: ambiguous matches such as “<span class=
8152: "quote">tk-postgresql</span>” matching a
8153: “<span class="quote">tk-*</span>”
1.7 wiz 8154: <code class="varname">DEPENDS</code>.</p>
1.1 grant 8155:
8156: <p>Wildcards can also be used to specify that a
8157: package will only build against a certain minimum
8158: version of a pre-requisite:</p>
8159: <pre class="programlisting">
8160: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
8161: </pre>
8162:
8163: <p>This means that the package will build against
8164: version 3.5.4 of the tiff library or newer. Such
8165: a dependency may be warranted if, for example,
8166: the API of the library has changed with version
8167: 3.5.4 and a package would not compile against an
8168: earlier version of tiff.</p>
8169:
8170: <p>Please note that such dependencies should only
8171: be updated if a package requires a newer
8172: pre-requisite, but not to denote recommendations
8173: such as security updates or ABI changes that do
8174: not prevent a package from building correctly.
8175: Such recommendations can be expressed using
1.7 wiz 8176: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 8177: <pre class="programlisting">
8178: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
8179: </pre>
8180:
1.7 wiz 8181: <p>In addition to the above <code class=
8182: "varname">DEPENDS</code> line, this denotes that
1.1 grant 8183: while a package will build against
8184: tiff>=3.5.4, at least version 3.6.1 is
1.7 wiz 8185: recommended. <code class=
8186: "varname">RECOMMENDED</code> entries will be
8187: turned into dependencies unless explicitly
8188: ignored (in which case a warning will be
8189: printed). Packages that are built with
1.1 grant 8190: recommendations ignored may not be uploaded to
8191: ftp.NetBSD.org by developers and should not be
8192: used across different systems that may have
8193: different versions of binary packages
8194: installed.</p>
8195:
8196: <p>For security fixes, please update the package
8197: vulnerabilities file as well as setting
1.7 wiz 8198: <code class="varname">RECOMMENDED</code>, see
1.1 grant 8199: <a href="#security-handling" title=
8200: "12.1.7. Handling packages with security problems">
8201: Section 12.1.7, “Handling packages with
8202: security problems”</a> for more
8203: information.</p>
8204: </li>
8205:
8206: <li>
8207: <p>If your package needs some executable to be
8208: able to run correctly and if there's agail no
1.7 wiz 8209: <code class="filename">buildlink3.mk</code> file,
8210: this is specified using the <code class=
8211: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 8212: "http://www.w3.org/TR/xhtml1/transitional" href=
8213: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.7 wiz 8214: class="pkgname">print/lyx</a> package needs to be
8215: able to execute the latex binary from the teTeX
8216: package when it runs, and that is specified:</p>
1.1 grant 8217: <pre class="programlisting">
8218: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
8219: </pre>
8220:
8221: <p>The comment about wildcard dependencies from
8222: previous paragraph applies here, too.</p>
8223: </li>
8224: </ol>
8225: </div>
8226:
8227: <p>If your package needs files from another package to
8228: build, see the first part of the “<span class=
8229: "quote">do-configure</span>” target <a xmlns=
8230: "http://www.w3.org/TR/xhtml1/transitional" href=
8231: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.7 wiz 8232: class="pkgname">print/ghostscript5</a> package (it
8233: relies on the jpeg sources being present in source form
8234: during the build):</p>
1.1 grant 8235: <pre class="programlisting">
8236: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
8237: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
8238: fi
8239: </pre>
8240:
8241: <p>If you build any other packages that way, please
8242: make sure the working files are deleted too when this
8243: package's working files are cleaned up. The easiest way
8244: to do so is by adding a pre-clean target:</p>
8245: <pre class="programlisting">
8246: pre-clean:
8247: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
8248: </pre>
8249:
1.7 wiz 8250: <p>Please also note the <code class=
8251: "varname">BUILD_USES_MSGFMT</code> and <code class=
8252: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
8253: which are provided as convenience definitions. The
8254: former works out whether msgfmt(1) is part of the base
8255: system, and, if it isn't, installs the <a xmlns=
1.1 grant 8256: "http://www.w3.org/TR/xhtml1/transitional" href=
8257: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.7 wiz 8258: class="pkgname">devel/gettext</a> package. The latter
8259: adds a build dependency on either an installed version
8260: of an older gettext package, or if it isn't, installs
8261: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8262: href=
8263: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
8264: class="pkgname">devel/gettext-m4</a> package.</p>
1.1 grant 8265: </div>
8266:
8267: <div class="sect2" lang="en" xml:lang="en">
8268: <div class="titlepage">
8269: <div>
8270: <div>
1.12 ! agc 8271: <h3 class="title"><a name="id2591226" id=
! 8272: "id2591226"></a>12.1.4. Handling conflicts
1.1 grant 8273: with other packages</h3>
8274: </div>
8275: </div>
8276: </div>
8277:
8278: <p>Your package may conflict with other packages a user
8279: might already have installed on his system, e.g. if
8280: your package installs the same set of files like
8281: another package in our pkgsrc tree.</p>
8282:
1.7 wiz 8283: <p>In this case you can set <code class=
8284: "varname">CONFLICTS</code> to a space separated list of
1.1 grant 8285: packages (including version string) your package
8286: conflicts with.</p>
8287:
8288: <p>For example <a xmlns=
8289: "http://www.w3.org/TR/xhtml1/transitional" href=
8290: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.7 wiz 8291: class="pkgname">x11/Xaw3d</a> and <a xmlns=
8292: "http://www.w3.org/TR/xhtml1/transitional" href=
8293: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
8294: class="pkgname">x11/Xaw-Xpm</a> install provide the
8295: same shared library, thus you set in <code class=
8296: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 8297: <pre class="programlisting">
8298: CONFLICTS= Xaw-Xpm-[0-9]*
8299: </pre>
8300:
1.7 wiz 8301: <p>and in <code class=
8302: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 8303: <pre class="programlisting">
8304: CONFLICTS= Xaw3d-[0-9]*
8305: </pre>
8306:
8307: <p>Packages will automatically conflict with other
8308: packages with the name prefix and a different version
8309: string. “<span class=
8310: "quote">Xaw3d-1.5</span>” e.g. will automatically
8311: conflict with the older version “<span class=
8312: "quote">Xaw3d-1.3</span>”.</p>
8313: </div>
8314:
8315: <div class="sect2" lang="en" xml:lang="en">
8316: <div class="titlepage">
8317: <div>
8318: <div>
1.12 ! agc 8319: <h3 class="title"><a name="id2591276" id=
! 8320: "id2591276"></a>12.1.5. Packages that cannot
1.1 grant 8321: or should not be built</h3>
8322: </div>
8323: </div>
8324: </div>
8325:
8326: <p>There are several reasons why a package might be
8327: instructed to not build under certain circumstances. If
8328: the package builds and runs on most platforms, the
1.7 wiz 8329: exceptions should be noted with <code class=
8330: "varname">NOT_FOR_PLATFORM</code>. If the package
8331: builds and runs on a small handful of platforms, set
8332: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
8333: If the package should be skipped (for example, because
8334: it provides functionality already provided by the
8335: system), set <code class=
8336: "varname">PKG_SKIP_REASON</code> to a descriptive
8337: message. If the package should fail because some
8338: preconditions are not met, set <code class=
8339: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 8340: message.</p>
8341:
1.7 wiz 8342: <p><code class="varname">IGNORE</code> is deprecated
1.1 grant 8343: because it didn't provide enough information to
8344: determine whether the build should fail.</p>
8345: </div>
8346:
8347: <div class="sect2" lang="en" xml:lang="en">
8348: <div class="titlepage">
8349: <div>
8350: <div>
1.12 ! agc 8351: <h3 class="title"><a name="id2591302" id=
! 8352: "id2591302"></a>12.1.6. Packages which
1.1 grant 8353: should not be deleted, once installed</h3>
8354: </div>
8355: </div>
8356: </div>
8357:
8358: <p>To ensure that a package may not be deleted, once it
1.7 wiz 8359: has been installed, the <code class=
8360: "varname">PKG_PRESERVE</code> definition should be set
8361: in the package Makefile. This will be carried into any
1.1 grant 8362: binary package that is made from this pkgsrc entry. A
8363: “<span class="quote">preserved</span>”
8364: package will not be deleted using <a href=
8365: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8366: <span class="citerefentry"><span class=
8367: "refentrytitle">pkg_delete</span>(1)</span></a> unless
8368: the “<span class="quote">-f</span>” option
8369: is used.</p>
8370: </div>
8371:
8372: <div class="sect2" lang="en" xml:lang="en">
8373: <div class="titlepage">
8374: <div>
8375: <div>
8376: <h3 class="title"><a name="security-handling" id=
8377: "security-handling"></a>12.1.7. Handling
8378: packages with security problems</h3>
8379: </div>
8380: </div>
8381: </div>
8382:
8383: <p>When a vulnerability is found, this should be noted
1.7 wiz 8384: in <code class=
8385: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1 grant 8386: and after the commit of that file, it should be copied
1.7 wiz 8387: to both <code class=
8388: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
8389: and <code class=
8390: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
8391: on ftp.NetBSD.org using <code class=
8392: "filename">localsrc/security/advisories/Makefile</code>.
8393: In addition, if a <code class=
8394: "filename">buildlink3.mk</code> file exists for an
8395: affected package, bumping <code class=
8396: "varname">PKGREVISION</code> and creating a
8397: corresponding <code class=
8398: "varname">BUILDLINK_RECOMMENDED.<em class=
8399: "replaceable"><code>pkg</code></em></code> entry should
8400: be considered. See <a href="#buildlink" title=
1.1 grant 8401: "Chapter 9. Buildlink methodology">Chapter 9,
8402: <i>Buildlink methodology</i></a> for more information
1.7 wiz 8403: about writing <code class=
8404: "filename">buildlink3.mk</code> files and <code class=
8405: "varname">BUILDLINK_*</code> definitions.</p>
1.1 grant 8406:
8407: <p>Also, if the fix should be applied to the stable
8408: pkgsrc branch, be sure to submit a pullup request!</p>
8409: </div>
8410:
8411: <div class="sect2" lang="en" xml:lang="en">
8412: <div class="titlepage">
8413: <div>
8414: <div>
1.12 ! agc 8415: <h3 class="title"><a name="id2591462" id=
! 8416: "id2591462"></a>12.1.8. How to handle
1.1 grant 8417: compiler bugs</h3>
8418: </div>
8419: </div>
8420: </div>
8421:
8422: <p>Some source files trigger bugs in the compiler,
8423: based on combinations of compiler version and
8424: architecture and almost always relation to optimisation
8425: being enabled. Common symptoms are gcc internal errors
8426: or never finishing compiling a file.</p>
8427:
8428: <p>Typically a workaround involves testing the
1.7 wiz 8429: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 8430: version, disabling optimisation for that
1.7 wiz 8431: file/<code class="varname">MACHINE_ARCH</code>/compiler
8432: combination, and documenting it in <code class=
8433: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 8434: number of examples!</p>
8435: </div>
8436:
8437: <div class="sect2" lang="en" xml:lang="en">
8438: <div class="titlepage">
8439: <div>
8440: <div>
1.12 ! agc 8441: <h3 class="title"><a name="id2591484" id=
! 8442: "id2591484"></a>12.1.9. How to handle
1.1 grant 8443: incrementing versions when fixing an existing
8444: package</h3>
8445: </div>
8446: </div>
8447: </div>
8448:
8449: <p>When making fixes to an existing package it can be
1.7 wiz 8450: useful to change the version number in <code class=
8451: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 8452: future versions by the original author, a
8453: “<span class="quote">nb1</span>”,
8454: “<span class="quote">nb2</span>”, ...
8455: suffix can be used on package versions by setting
1.7 wiz 8456: <code class="varname">PKGREVISION=1</code> (2, ...).
8457: The “<span class="quote">nb</span>” is
8458: treated like a “<span class=
8459: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 8460: <pre class="programlisting">
8461: DISTNAME= foo-17.42
8462: PKGREVISION= 9
8463: </pre>
8464:
1.7 wiz 8465: <p>will result in a <code class=
8466: "varname">PKGNAME</code> of “<span class=
1.1 grant 8467: "quote">foo-17.42nb9</span>”.</p>
8468:
8469: <p>When a new release of the package is released, the
1.7 wiz 8470: <code class="varname">PKGREVISION</code> should be
8471: removed. e.g. on a new minor release of the above
8472: package, things should be like:</p>
1.1 grant 8473: <pre class="programlisting">
8474: DISTNAME= foo-17.43
8475: </pre>
8476: </div>
8477:
8478: <div class="sect2" lang="en" xml:lang="en">
8479: <div class="titlepage">
8480: <div>
8481: <div>
1.12 ! agc 8482: <h3 class="title"><a name="id2591533" id=
! 8483: "id2591533"></a>12.1.10. Portability of
1.1 grant 8484: packages</h3>
8485: </div>
8486: </div>
8487: </div>
8488:
8489: <p>One appealing feature of pkgsrc is that it runs on
8490: many different platforms. As a result, it is important
8491: to ensure, where possible, that packages in pkgsrc are
8492: portable. There are some particular details you should
8493: pay attention to while working on pkgsrc.</p>
8494:
8495: <div class="sect3" lang="en" xml:lang="en">
8496: <div class="titlepage">
8497: <div>
8498: <div>
1.12 ! agc 8499: <h4 class="title"><a name="id2591607" id=
! 8500: "id2591607"></a>12.1.10.1. ${INSTALL},
1.1 grant 8501: ${INSTALL_DATA_DIR}, ...</h4>
8502: </div>
8503: </div>
8504: </div>
8505:
1.7 wiz 8506: <p>The BSD-compatible <span><strong class=
8507: "command">install</strong></span> supplied with some
1.1 grant 8508: operating systems will not perform more than one
8509: operation at a time. As such, you should call
8510: “<span class="quote">${INSTALL}</span>”,
8511: etc. like this:</p>
8512: <pre class="programlisting">
8513: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
8514: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
8515: </pre>
8516: </div>
8517: </div>
8518: </div>
8519:
8520: <div class="sect1" lang="en" xml:lang="en">
8521: <div class="titlepage">
8522: <div>
8523: <div>
8524: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 8525: "id2591626" id="id2591626"></a>12.2. Possible
1.1 grant 8526: downloading issues</h2>
8527: </div>
8528: </div>
8529: </div>
8530:
8531: <div class="sect2" lang="en" xml:lang="en">
8532: <div class="titlepage">
8533: <div>
8534: <div>
1.12 ! agc 8535: <h3 class="title"><a name="id2591629" id=
! 8536: "id2591629"></a>12.2.1. Packages whose
1.1 grant 8537: distfiles aren't available for plain
8538: downloading</h3>
8539: </div>
8540: </div>
8541: </div>
8542:
8543: <p>If you need to download from a dynamic URL you can
1.7 wiz 8544: set <code class="varname">DYNAMIC_MASTER_SITES</code>
8545: and a <span><strong class="command">make
8546: fetch</strong></span> will call <code class=
8547: "filename">files/getsite.sh</code> with the name of
8548: each file to download as an argument, expecting it to
8549: output the URL of the directory from which to download
8550: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8551: href=
1.1 grant 8552: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.7 wiz 8553: class="pkgname">graphics/ns-cult3d</a> is an example of
8554: this usage.</p>
1.1 grant 8555:
8556: <p>If the download can't be automated, because the user
8557: must submit personal information to apply for a
8558: password, or must pay for the source, or whatever, you
1.7 wiz 8559: can set <code class="varname">_FETCH_MESSAGE</code> to
8560: a macro which displays a message explaining the
8561: situation. <code class="varname">_FETCH_MESSAGE</code>
8562: must be executable shell commands, not just a message.
8563: (Generally, it executes <code class=
8564: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 8565: following packages use this: <a xmlns=
8566: "http://www.w3.org/TR/xhtml1/transitional" href=
8567: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.7 wiz 8568: class="pkgname">audio/realplayer</a>, <a xmlns=
8569: "http://www.w3.org/TR/xhtml1/transitional" href=
8570: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
8571: class="pkgname">cad/simian</a>, <a xmlns=
8572: "http://www.w3.org/TR/xhtml1/transitional" href=
8573: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
8574: class="pkgname">devel/ipv6socket</a>, <a xmlns=
8575: "http://www.w3.org/TR/xhtml1/transitional" href=
8576: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
8577: class="pkgname">emulators/vmware-module</a>, <a xmlns=
8578: "http://www.w3.org/TR/xhtml1/transitional" href=
8579: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
8580: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
8581: "http://www.w3.org/TR/xhtml1/transitional" href=
8582: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
8583: class="pkgname">sysutils/storage-manager</a>, <a xmlns=
8584: "http://www.w3.org/TR/xhtml1/transitional" href=
8585: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
8586: class="pkgname">www/ap-aolserver</a>, <a xmlns=
8587: "http://www.w3.org/TR/xhtml1/transitional" href=
8588: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
8589: class="pkgname">www/openacs</a>. Try to be consistent
8590: with them.</p>
1.1 grant 8591: </div>
8592:
8593: <div class="sect2" lang="en" xml:lang="en">
8594: <div class="titlepage">
8595: <div>
8596: <div>
1.12 ! agc 8597: <h3 class="title"><a name="id2591692" id=
! 8598: "id2591692"></a>12.2.2. How to handle
1.1 grant 8599: modified distfiles with the 'old' name</h3>
8600: </div>
8601: </div>
8602: </div>
8603:
8604: <p>Sometimes authors of a software package make some
8605: modifications after the software was released, and they
8606: put up a new distfile without changing the package's
8607: version number. If a package is already in pkgsrc at
8608: that time, the md5 checksum will no longer match. The
8609: correct way to work around this is to update the
8610: package's md5 checksum to match the package on the
8611: master site (beware, any mirrors may not be up to date
8612: yet!), and to remove the old distfile from
1.7 wiz 8613: ftp.NetBSD.org's <code class=
8614: "filename">/pub/NetBSD/packages/distfiles</code>
1.1 grant 8615: directory. Furthermore, a mail to the package's author
8616: seems appropriate making sure the distfile was really
8617: updated on purpose, and that no trojan horse or so
8618: crept in.</p>
8619: </div>
8620: </div>
8621:
8622: <div class="sect1" lang="en" xml:lang="en">
8623: <div class="titlepage">
8624: <div>
8625: <div>
8626: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 8627: "id2591704" id=
! 8628: "id2591704"></a>12.3. Configuration
1.1 grant 8629: gotchas</h2>
8630: </div>
8631: </div>
8632: </div>
8633:
8634: <div class="sect2" lang="en" xml:lang="en">
8635: <div class="titlepage">
8636: <div>
8637: <div>
8638: <h3 class="title"><a name="fixes.libtool" id=
8639: "fixes.libtool"></a>12.3.1. Shared libraries
8640: - libtool</h3>
8641: </div>
8642: </div>
8643: </div>
8644:
8645: <p>pkgsrc supports many different machines, with
8646: different object formats like a.out and ELF, and
8647: varying abilities to do shared library and dynamic
8648: loading at all. To accompany this, varying commands and
8649: options have to be passed to the compiler, linker, etc.
8650: to get the Right Thing, which can be pretty annoying
8651: especially if you don't have all the machines at your
8652: hand to test things. The <a xmlns=
8653: "http://www.w3.org/TR/xhtml1/transitional" href=
8654: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.7 wiz 8655: class="pkgname">devel/libtool</a> pkg can help here, as
8656: it just “<span class="quote">knows</span>”
8657: how to build both static and dynamic libraries from a
8658: set of source files, thus being platform
8659: independent.</p>
1.1 grant 8660:
8661: <p>Here's how to use libtool in a pkg in seven simple
8662: steps:</p>
8663:
8664: <div class="orderedlist">
8665: <ol type="1">
8666: <li>
1.7 wiz 8667: <p>Add <code class=
8668: "varname">USE_LIBTOOL=yes</code> to the package
8669: Makefile.</p>
1.1 grant 8670: </li>
8671:
8672: <li>
8673: <p>For library objects, use “<span class=
8674: "quote">${LIBTOOL} --mode=compile
8675: ${CC}</span>” in place of
8676: “<span class="quote">${CC}</span>”.
8677: You could even add it to the definition of
1.7 wiz 8678: <code class="varname">CC</code>, if only
8679: libraries are being built in a given Makefile.
8680: This one command will build both PIC and non-PIC
8681: library objects, so you need not have separate
8682: shared and non-shared library rules.</p>
1.1 grant 8683: </li>
8684:
8685: <li>
8686: <p>For the linking of the library, remove any
8687: “<span class="quote">ar</span>”,
8688: “<span class="quote">ranlib</span>”,
8689: and “<span class="quote">ld
8690: -Bshareable</span>” commands, and instead
8691: use:</p>
8692: <pre class="programlisting">
8693: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
8694: </pre>
8695:
8696: <p>Note that the library is changed to have a
1.7 wiz 8697: <code class="filename">.la</code> extension, and
8698: the objects are changed to have a <code class=
8699: "filename">.lo</code> extension. Change
8700: <code class="varname">OBJS</code> as necessary.
8701: This automatically creates all of the
8702: <code class="filename">.a</code>, <code class=
8703: "filename">.so.major.minor</code>, and ELF
8704: symlinks (if necessary) in the build directory.
8705: Be sure to include “<span class=
1.1 grant 8706: "quote">-version-info</span>”, especially
8707: when major and minor are zero, as libtool will
8708: otherwise strip off the shared library
8709: version.</p>
8710:
8711: <p>From the libtool manual:</p>
8712: <pre class="programlisting">
8713: So, libtool library versions are described by three integers:
8714:
8715: CURRENT
8716: The most recent interface number that this library implements.
8717:
8718: REVISION
8719: The implementation number of the CURRENT interface.
8720:
8721: AGE
8722: The difference between the newest and oldest interfaces that this
8723: library implements. In other words, the library implements all the
8724: interface numbers in the range from number `CURRENT - AGE' to
8725: `CURRENT'.
8726:
8727: If two libraries have identical CURRENT and AGE numbers, then the
8728: dynamic linker chooses the library with the greater REVISION number.
8729: </pre>
8730:
8731: <p>The “<span class=
8732: "quote">-release</span>” option will
8733: produce different results for a.out and ELF
8734: (excluding symlinks) in only one case. An ELF
8735: library of the form “<span class=
8736: "quote">libfoo-release.so.<span class=
8737: "emphasis"><em>x</em></span>.<span class=
8738: "emphasis"><em>y</em></span></span>” will
8739: have a symlink of “<span class=
8740: "quote">libfoo.so.<span class=
8741: "emphasis"><em>x</em></span>.<span class=
8742: "emphasis"><em>y</em></span></span>” on an
8743: a.out platform. This is handled
8744: automatically.</p>
8745:
8746: <p>The “<span class="quote">-rpath
8747: argument</span>” is the install directory
8748: of the library being built.</p>
8749:
1.7 wiz 8750: <p>In the <code class="filename">PLIST</code>,
8751: include all of the <code class=
8752: "filename">.a</code>, <code class=
8753: "filename">.la</code>, and <code class=
8754: "filename">.so</code>, <code class=
8755: "filename">.so.<em class=
8756: "replaceable"><code>major</code></em></code> and
8757: <code class="filename">.so.<em class=
8758: "replaceable"><code>major</code></em>.<em class=
8759: "replaceable"><code>minor</code></em></code>
8760: files.</p>
1.1 grant 8761: </li>
8762:
8763: <li>
1.7 wiz 8764: <p>When linking shared object (<code class=
8765: "filename">.so</code>) files, i.e. files that are
1.1 grant 8766: loaded via dlopen(3), NOT shared libraries, use
8767: “<span class="quote">-module
8768: -avoid-version</span>” to prevent them
8769: getting version tacked on.</p>
8770:
1.7 wiz 8771: <p>The <code class="filename">PLIST</code> file
8772: gets the <code class="filename">foo.so</code>
8773: entry.</p>
1.1 grant 8774: </li>
8775:
8776: <li>
8777: <p>When linking programs that depend on these
8778: libraries <span class=
8779: "emphasis"><em>before</em></span> they are
8780: installed, preface the <a href=
8781: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
8782: <span class="citerefentry"><span class=
8783: "refentrytitle">cc</span>(1)</span></a> or
8784: <a href=
8785: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
8786: <span class="citerefentry"><span class=
8787: "refentrytitle">ld</span>(1)</span></a> line with
8788: “<span class="quote">${LIBTOOL}
8789: --mode=link</span>”, and it will find the
8790: correct libraries (static or shared), but please
8791: be aware that libtool will not allow you to
8792: specify a relative path in -L (such as
8793: “<span class=
8794: "quote">-L../somelib</span>”), because it
8795: expects you to change that argument to be the
1.7 wiz 8796: <code class="filename">.la</code> file. e.g.</p>
1.1 grant 8797: <pre class="programlisting">
8798: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
8799: </pre>
8800:
8801: <p>should be changed to:</p>
8802: <pre class="programlisting">
1.7 wiz 8803: ${LIBTOOL} --mode=link ${CC} -o <em class=
8804: "replaceable"><code>someprog</code></em> <em class=
8805: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 8806: </pre>
8807:
8808: <p>and it will do the right thing with the
8809: libraries.</p>
8810: </li>
8811:
8812: <li>
8813: <p>When installing libraries, preface the
8814: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
8815: <span class="citerefentry"><span class=
8816: "refentrytitle">install</span>(1)</span></a> or
8817: <a href=
8818: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
8819: <span class="citerefentry"><span class=
8820: "refentrytitle">cp</span>(1)</span></a> command
8821: with “<span class="quote">${LIBTOOL}
8822: --mode=install</span>”, and change the
1.7 wiz 8823: library name to <code class=
8824: "filename">.la</code>. e.g.</p>
1.1 grant 8825: <pre class="programlisting">
8826: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
8827: </pre>
8828:
1.7 wiz 8829: <p>This will install the static <code class=
8830: "filename">.a</code>, shared library, any needed
1.1 grant 8831: symlinks, and run <a href=
8832: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
8833: <span class="citerefentry"><span class=
8834: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
8835: </li>
8836:
8837: <li>
1.7 wiz 8838: <p>In your <code class="filename">PLIST</code>,
8839: include all of the <code class=
8840: "filename">.a</code>, <code class=
8841: "filename">.la</code>, and <code class=
8842: "filename">.so</code>, <code class=
8843: "filename">.so.CURRENT</code> and <code class=
8844: "filename">.so.CURRENT.REVISION</code> files
8845: (this is a change from the previous
8846: behaviour).</p>
1.1 grant 8847: </li>
8848: </ol>
8849: </div>
8850: </div>
8851:
8852: <div class="sect2" lang="en" xml:lang="en">
8853: <div class="titlepage">
8854: <div>
8855: <div>
1.12 ! agc 8856: <h3 class="title"><a name="id2592180" id=
! 8857: "id2592180"></a>12.3.2. Using libtool on GNU
1.1 grant 8858: packages that already support libtool</h3>
8859: </div>
8860: </div>
8861: </div>
8862:
1.7 wiz 8863: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
8864: the package Makefile. This will override the package's
8865: own libtool in most cases. For older libtool using
1.1 grant 8866: packages, libtool is made by ltconfig script during the
8867: do-configure step; you can check the libtool script
1.7 wiz 8868: location by doing <span><strong class="command">make
8869: configure; find work*/ -name
8870: libtool</strong></span>.</p>
8871:
8872: <p><code class="varname">LIBTOOL_OVERRIDE</code>
8873: specifies which libtool scripts, relative to
8874: <code class="varname">WRKSRC</code>, to override. By
8875: default, it is set to “<span class=
8876: "quote">libtool */libtool */*/libtool</span>”. If
8877: this does not match the location of the package's
8878: libtool script(s), set it as appropriate.</p>
1.1 grant 8879:
1.7 wiz 8880: <p>If you do not need <code class="filename">*.a</code>
1.1 grant 8881: static libraries built and installed, then use
1.7 wiz 8882: <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1 grant 8883: instead.</p>
8884:
8885: <p>If your package makes use of the platform
8886: independent library for loading dynamic shared objects,
8887: that comes with libtool (libltdl), you should include
1.7 wiz 8888: the libtool buildlink3.mk (and set <code class=
8889: "varname">USE_BUILDLINK3=YES</code>).</p>
1.1 grant 8890:
8891: <p>Some packages use libtool incorrectly so that the
8892: package may not work or build in some circumstances.
8893: Some of the more common errors are:</p>
8894:
8895: <div class="itemizedlist">
8896: <ul type="disc">
8897: <li>
8898: <p>The inclusion of a shared object (-module) as
8899: a dependent library in an executable or library.
8900: This in itself isn't a problem if one of two
8901: things has been done:</p>
8902:
8903: <div class="orderedlist">
8904: <ol type="1">
8905: <li>
8906: <p>The shared object is named correctly,
1.7 wiz 8907: i.e. <code class=
8908: "filename">libfoo.la</code>, not
8909: <code class="filename">foo.la</code></p>
1.1 grant 8910: </li>
8911:
8912: <li>
8913: <p>The -dlopen option is used when linking
8914: an executable.</p>
8915: </li>
8916: </ol>
8917: </div>
8918: </li>
8919:
8920: <li>
8921: <p>The use of libltdl without the correct calls
8922: to initialisation routines. The function
8923: lt_dlinit() should be called and the macro
1.7 wiz 8924: <code class=
8925: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 8926: included in executables.</p>
8927: </li>
8928: </ul>
8929: </div>
8930: </div>
8931:
8932: <div class="sect2" lang="en" xml:lang="en">
8933: <div class="titlepage">
8934: <div>
8935: <div>
1.12 ! agc 8936: <h3 class="title"><a name="id2592264" id=
! 8937: "id2592264"></a>12.3.3. GNU
1.1 grant 8938: Autoconf/Automake</h3>
8939: </div>
8940: </div>
8941: </div>
8942:
8943: <p>If a package needs GNU autoconf or automake to be
8944: executed to regenerate the configure script and
8945: Makefile.in makefile templates, then they should be
8946: executed in a pre-configure target. Two Makefile
1.7 wiz 8947: fragments are provided in <code class=
8948: "filename">pkgsrc/mk/autoconf.mk</code> and
8949: <code class="filename">pkgsrc/mk/automake.mk</code> to
8950: help dealing with these tools. See comments in these
8951: files for details.</p>
1.1 grant 8952:
8953: <p>For packages that need only autoconf:</p>
8954: <pre class="programlisting">
8955: AUTOCONF_REQD= 2.50 # if default version is not good enough
8956: ...
8957:
8958: pre-configure:
8959: cd ${WRKSRC}; ${AUTOCONF}
8960:
8961: ...
8962: .include "../../mk/autoconf.mk"
8963: </pre>
8964:
8965: <p>and for packages that need automake and
8966: autoconf:</p>
8967: <pre class="programlisting">
8968: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
8969: ...
8970:
8971: pre-configure:
8972: cd ${WRKSRC}; \
8973: ${ACLOCAL}; \
8974: ${AUTOHEADER}; \
8975: ${AUTOMAKE} -a --foreign -i; \
8976: ${AUTOCONF}
8977:
8978: ...
8979: .include "../mk/automake.mk"
8980: </pre>
8981:
8982: <p>Packages which use GNU Automake will almost
8983: certainly require GNU Make, but that's automatically
1.7 wiz 8984: provided for you in <code class=
8985: "filename">mk/automake.mk</code>.</p>
1.1 grant 8986:
8987: <p>There are times when the configure process makes
8988: additional changes to the generated files, which then
8989: causes the build process to try to re-execute the
8990: automake sequence. This is prevented by touching
8991: various files in the configure stage. If this causes
1.7 wiz 8992: problems with your package you can set <code class=
8993: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 8994: Makefile.</p>
8995: </div>
8996: </div>
8997:
8998: <div class="sect1" lang="en" xml:lang="en">
8999: <div class="titlepage">
9000: <div>
9001: <div>
9002: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 9003: "id2592309" id="id2592309"></a>12.4. Building
1.1 grant 9004: considerations</h2>
9005: </div>
9006: </div>
9007: </div>
9008:
9009: <div class="sect2" lang="en" xml:lang="en">
9010: <div class="titlepage">
9011: <div>
9012: <div>
1.12 ! agc 9013: <h3 class="title"><a name="id2592312" id=
! 9014: "id2592312"></a>12.4.1. CPP defines</h3>
1.1 grant 9015: </div>
9016: </div>
9017: </div>
9018:
9019: <p>To port an application to NetBSD, it's usually
9020: necessary for the compiler to be able to judge the
9021: system on which it's compiling, and we use definitions
9022: so that the C pre-processor can do this.</p>
9023:
9024: <p>To test whether you are working on a 4.4 BSD-derived
9025: system, you should use the BSD definition, which is
1.7 wiz 9026: defined in <code class=
9027: "filename"><sys/param.h></code> on said
1.1 grant 9028: systems.</p>
9029: <pre class="programlisting">
9030: #include <sys/param.h>
9031: </pre>
9032:
9033: <p>and then you can surround the BSD-specific parts of
9034: your package's C/C++ code using this conditional:</p>
9035: <pre class="programlisting">
9036: #if (defined(BSD) && BSD >= 199306)
9037: ...
9038: #endif
9039: </pre>
9040:
9041: <p>Please use the “<span class=
9042: "quote">__NetBSD__</span>” definition sparingly -
9043: it should only apply to features of NetBSD that are not
9044: present in other 4.4-lite derived BSDs.</p>
9045: </div>
9046: </div>
9047:
9048: <div class="sect1" lang="en" xml:lang="en">
9049: <div class="titlepage">
9050: <div>
9051: <div>
9052: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 9053: "id2592342" id="id2592342"></a>12.5. Package
1.1 grant 9054: specific actions</h2>
9055: </div>
9056: </div>
9057: </div>
9058:
9059: <div class="sect2" lang="en" xml:lang="en">
9060: <div class="titlepage">
9061: <div>
9062: <div>
1.12 ! agc 9063: <h3 class="title"><a name="id2592345" id=
! 9064: "id2592345"></a>12.5.1. Package
1.1 grant 9065: configuration files</h3>
9066: </div>
9067: </div>
9068: </div>
9069:
9070: <p>Packages should be taught to look for their
1.7 wiz 9071: configuration files in <code class=
9072: "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1 grant 9073: through to the configure and build processes.
1.7 wiz 9074: <code class="varname">PKG_SYSCONFDIR</code> may be
1.1 grant 9075: customized in various ways by setting other make
9076: variables:</p>
9077:
9078: <div class="itemizedlist">
9079: <ul type="disc">
9080: <li>
1.7 wiz 9081: <p><code class="varname">PKG_SYSCONFBASE</code>
9082: is the main config directory under which all
9083: package configuration files are to be found. This
9084: defaults to <code class=
9085: "filename">${PREFIX}/etc</code>, but may be
9086: overridden in <code class=
9087: "filename">/etc/mk.conf</code>.</p>
1.1 grant 9088: </li>
9089:
9090: <li>
1.7 wiz 9091: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
9092: is the subdirectory of <code class=
9093: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 9094: configuration files for a particular package may
9095: be found, e.g. the Apache configuration files may
1.7 wiz 9096: all be found under the <code class=
9097: "filename">httpd/</code> subdirectory of
9098: <code class="varname">${PKG_SYSCONFBASE}</code>.
9099: This should be set in the package Makefile.</p>
1.1 grant 9100: </li>
9101:
9102: <li>
1.7 wiz 9103: <p>By default, <code class=
9104: "varname">PKG_SYSCONFDIR</code> is set to
9105: <code class=
9106: "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
9107: but this may be overridden by setting
9108: <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9109: for a particular package, where <code class=
9110: "varname">PKG_SYSCONFVAR</code> defaults to
9111: <code class="varname">${PKGBASE}</code>. This is
9112: not meant to be set by a package Makefile, but is
1.1 grant 9113: reserved for users who wish to override the
1.7 wiz 9114: <code class="varname">PKG_SYSCONFDIR</code>
9115: setting for a particular package with a special
1.1 grant 9116: location.</p>
9117: </li>
9118: </ul>
9119: </div>
9120:
9121: <p>The only variables that users should customize are
1.7 wiz 9122: <code class="varname">PKG_SYSCONFBASE</code> and
9123: <code class=
9124: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
9125: Users will typically want to set <code class=
9126: "varname">PKG_SYSCONFBASE</code> to <code class=
9127: "filename">/etc</code>, or to accept the default
9128: location of <code class=
9129: "filename">${PREFIX}/etc</code>.</p>
1.1 grant 9130: </div>
9131:
9132: <div class="sect2" lang="en" xml:lang="en">
9133: <div class="titlepage">
9134: <div>
9135: <div>
1.12 ! agc 9136: <h3 class="title"><a name="id2592516" id=
! 9137: "id2592516"></a>12.5.2. User
1.2 hubertf 9138: interaction</h3>
1.1 grant 9139: </div>
9140: </div>
9141: </div>
9142:
9143: <p>Occasionally, packages require interaction from the
9144: user, and this can be in a number of ways:</p>
9145:
9146: <div class="itemizedlist">
9147: <ul type="disc">
9148: <li>
9149: <p>help in fetching the distfiles</p>
9150: </li>
9151:
9152: <li>
9153: <p>help to configure the package before it is
9154: built</p>
9155: </li>
9156:
9157: <li>
9158: <p>help during the build process</p>
9159: </li>
9160:
9161: <li>
9162: <p>help during the installation of a package</p>
9163: </li>
9164: </ul>
9165: </div>
9166:
1.7 wiz 9167: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 9168: definition is provided to notify the pkgsrc mechanism
9169: of an interactive stage which will be needed, and this
1.7 wiz 9170: should be set in the package's <code class=
9171: "filename">Makefile</code>. e.g.</p>
1.1 grant 9172: <pre class="programlisting">
9173: INTERACTIVE_STAGE= build
9174: </pre>
9175:
9176: <p>Multiple interactive stages can be specified:</p>
9177: <pre class="programlisting">
9178: INTERACTIVE_STAGE= configure install
9179: </pre>
9180: </div>
9181:
9182: <div class="sect2" lang="en" xml:lang="en">
9183: <div class="titlepage">
9184: <div>
9185: <div>
1.12 ! agc 9186: <h3 class="title"><a name="id2592561" id=
! 9187: "id2592561"></a>12.5.3. Handling
1.1 grant 9188: licenses</h3>
9189: </div>
9190: </div>
9191: </div>
9192:
9193: <p>A package may underly a license which the user has
9194: or has not agreed to accept. Usually, packages that
9195: underly well-known Open Source licenses (e.g. the GNU
9196: Public License, GPL) won't have any special license
9197: tags added in pkgsrc which require special action by
9198: the user of such packages, but there are quite a number
9199: of other licenses out there that pkgsrc users may not
9200: be able to follow, for whatever reasons. For these
9201: cases, pkgsrc contains a mechanism to note that a
9202: package underlies a certain license, and the user has
9203: to accept the license before the package can be
9204: installed.</p>
9205:
9206: <p>Placing a certain package under a certain license
1.7 wiz 9207: works by setting the <code class=
9208: "varname">LICENSE</code> variable to a string
9209: identifying the license, e.g. in <a xmlns=
9210: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 9211: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.7 wiz 9212: class="pkgname">graphics/graphviz</a>:</p>
1.1 grant 9213: <pre class="programlisting">
9214: LICENSE= graphviz-license
9215: </pre>
9216:
9217: <p>When trying to build, the user will get a notice
9218: that the package underlies a license which he hasn't
9219: accepted (yet):</p>
9220: <pre class="programlisting">
1.7 wiz 9221: <code class="prompt">%</code> <strong class=
9222: "userinput"><code>make</code></strong>
1.1 grant 9223: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
9224: ===> To build this package, add this line to your /etc/mk.conf:
9225: ===> ACCEPTABLE_LICENSES+=graphviz-license
9226: ===> To view the license, enter "/usr/bin/make show-license".
9227: *** Error code 1
9228: </pre>
9229:
1.7 wiz 9230: <p>The license can be viewed with <span><strong class=
9231: "command">make show-license</strong></span>, and if it
9232: is considered appropriate, the line printed above can
9233: be added to <code class="filename">/etc/mk.conf</code>
9234: to indicate acceptance of the particular license:</p>
1.1 grant 9235: <pre class="programlisting">
9236: ACCEPTABLE_LICENSES+=graphviz-license
9237: </pre>
9238:
9239: <p>When adding a package with a new license, the
1.7 wiz 9240: license text should be added to <code class=
9241: "filename">pkgsrc/licenses</code> for displaying. A
9242: list of known licenses can be seen in this directory as
9243: well as by looking at the list of (commented out)
9244: <code class="varname">ACCEPTABLE_LICENSES</code>
9245: variable settings in <code class=
1.11 ben 9246: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 9247:
9248: <p>Is there is a <span class=
9249: "emphasis"><em>really</em></span> pressing need to
9250: accept all licenses at once, like when trying to
9251: download or mirror all distfiles or doing a bulk build
9252: to test if all packages in pkgsrc build, this can be
1.7 wiz 9253: done by setting <code class=
9254: "varname">_ACCEPTABLE=yes</code>.</p>
1.1 grant 9255: </div>
9256:
9257: <div class="sect2" lang="en" xml:lang="en">
9258: <div class="titlepage">
9259: <div>
9260: <div>
1.12 ! agc 9261: <h3 class="title"><a name="id2592644" id=
! 9262: "id2592644"></a>12.5.4. Creating an account
1.1 grant 9263: from a package</h3>
9264: </div>
9265: </div>
9266: </div>
9267:
9268: <p>There are two make variables used to control the
9269: creation of package-specific groups and users at
1.7 wiz 9270: pre-install time. The first is <code class=
9271: "varname">PKG_GROUPS</code>, which is a list of
1.1 grant 9272: group[:groupid] elements, where the groupid is
1.7 wiz 9273: optional. The second is <code class=
9274: "varname">PKG_USERS</code>, which is a list of elements
1.1 grant 9275: of the form:</p>
9276: <pre class="programlisting">
9277: user:group[:[userid][:[description][:[home][:shell]]]]
9278: </pre>
9279:
9280: <p>where only the user and group are required, the rest
9281: being optional. A simple example is:</p>
9282: <pre class="programlisting">
9283: PKG_GROUPS= foogroup
9284: PKG_USERS= foouser:foogroup
9285: </pre>
9286:
9287: <p>A more complex example is that creates two groups
9288: and two users is:</p>
9289: <pre class="programlisting">
9290: PKG_GROUPS= group1 group2:1005
9291: PKG_USERS= first:group1::First\\ User \
9292: second:group2::Second\\ User:/home/second:${SH}
9293: </pre>
9294:
9295: <p>By default, a new user will have home directory
1.7 wiz 9296: <code class="filename">/nonexistent</code>, and login
9297: shell <code class="filename">/sbin/nologin</code>
9298: unless they are specified as part of the user
9299: element.</p>
1.1 grant 9300:
1.7 wiz 9301: <p>The package <code class="filename">Makefile</code>
9302: must also set <code class=
9303: "varname">USE_PKGINSTALL=YES</code>. This will cause
9304: the users and groups to be created at pre-install time,
9305: and the admin will be prompted to remove them at
9306: post-deinstall time. Automatic creation of the users
9307: and groups can be toggled on and off by setting the
9308: <code class="varname">PKG_CREATE_USERGROUP</code>
9309: variable prior to package installation.</p>
1.1 grant 9310: </div>
9311:
9312: <div class="sect2" lang="en" xml:lang="en">
9313: <div class="titlepage">
9314: <div>
9315: <div>
1.12 ! agc 9316: <h3 class="title"><a name="id2592774" id=
! 9317: "id2592774"></a>12.5.5. Installing score
1.1 grant 9318: files</h3>
9319: </div>
9320: </div>
9321: </div>
9322:
9323: <p>Certain packages, most of them in the games
9324: category, install a score file that allows all users on
9325: the system to record their highscores. In order for
9326: this to work, the binaries need to be installed setgid
9327: and the score files owned by the appropriate group
9328: and/or owner (traditionally the "games" user/group).
9329: The following variables, documented in more detail in
1.11 ben 9330: <code class="filename">mk/defaults/mk.conf</code>,
1.7 wiz 9331: control this behaviour: <code class=
9332: "varname">SETGIDGAME</code>, <code class=
9333: "varname">GAMEDATAMODE</code>, <code class=
9334: "varname">GAMEGRP</code>, <code class=
9335: "varname">GAMEMODE</code>, <code class=
9336: "varname">GAMEOWN</code>.</p>
1.1 grant 9337:
9338: <p>Note that per default, setgid installation of games
1.7 wiz 9339: is disabled; setting <code class=
9340: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 9341: variables accordingly.</p>
9342:
9343: <p>A package should therefor never hard code file
1.7 wiz 9344: ownership or access permissions but rely on
9345: <code class="varname">INSTALL_GAME</code> and
9346: <code class="varname">INSTALL_GAME_DATA</code> to set
9347: these correctly.</p>
1.1 grant 9348: </div>
9349:
9350: <div class="sect2" lang="en" xml:lang="en">
9351: <div class="titlepage">
9352: <div>
9353: <div>
1.12 ! agc 9354: <h3 class="title"><a name="id2592818" id=
! 9355: "id2592818"></a>12.5.6. Packages providing
1.1 grant 9356: login shells</h3>
9357: </div>
9358: </div>
9359: </div>
9360:
9361: <p>If the purpose of the package is to provide a login
1.7 wiz 9362: shell, the variable <code class=
9363: "varname">PKG_SHELL</code> should contain the full
9364: pathname of the shell executable installed by this
9365: package. The package <code class=
9366: "filename">Makefile</code> must also set <code class=
9367: "varname">USE_PKGINSTALL=YES</code> to use the
9368: automatically generated <code class=
9369: "filename">INSTALL</code>/<code class=
9370: "filename">DEINSTALL</code> scripts.</p>
1.1 grant 9371:
9372: <p>An example taken from shells/zsh:</p>
9373: <pre class="programlisting">
9374: USE_PKGINSTALL= YES
9375: PKG_SHELL= ${PREFIX}/bin/zsh
9376: </pre>
9377:
1.7 wiz 9378: <p>The shell is registered into <code class=
9379: "filename">/etc/shells</code> file automatically in the
9380: post-install target by the generated <code class=
9381: "filename">INSTALL</code> script and removed in the
9382: deinstall target by the <code class=
9383: "filename">DEINSTALL</code> script.</p>
1.1 grant 9384: </div>
9385:
9386: <div class="sect2" lang="en" xml:lang="en">
9387: <div class="titlepage">
9388: <div>
9389: <div>
1.12 ! agc 9390: <h3 class="title"><a name="id2593012" id=
! 9391: "id2593012"></a>12.5.7. Packages containing
1.1 grant 9392: perl scripts</h3>
9393: </div>
9394: </div>
9395: </div>
9396:
9397: <p>If your package contains interpreted perl scripts,
1.7 wiz 9398: set <code class="varname">REPLACE_PERL</code> to ensure
9399: that the proper interpreter path is set. <code class=
9400: "varname">REPLACE_PERL</code> should contain a list of
9401: scripts, relative to <code class=
9402: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 9403: </div>
9404:
9405: <div class="sect2" lang="en" xml:lang="en">
9406: <div class="titlepage">
9407: <div>
9408: <div>
1.12 ! agc 9409: <h3 class="title"><a name="id2593030" id=
! 9410: "id2593030"></a>12.5.8. Packages with
1.1 grant 9411: hardcoded paths to other interpreters</h3>
9412: </div>
9413: </div>
9414: </div>
9415:
9416: <p>Your package may also contain scripts with hardcoded
9417: paths to other interpreters besides (or as well as)
9418: perl. To correct the full pathname to the script
9419: interpreter, you need to set the following definitions
1.7 wiz 9420: in your <code class="filename">Makefile</code> (we
9421: shall use <span><strong class=
9422: "command">tclsh</strong></span> in this example):</p>
1.1 grant 9423: <pre class="programlisting">
9424: REPLACE_INTERPRETER+= tcl
9425: _REPLACE.tcl.old= .*/bin/tclsh
9426: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
9427: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
9428: relative to ${WRKSRC}, just as in REPLACE_PERL
9429: </pre>
9430: </div>
9431:
9432: <div class="sect2" lang="en" xml:lang="en">
9433: <div class="titlepage">
9434: <div>
9435: <div>
1.12 ! agc 9436: <h3 class="title"><a name="id2593051" id=
! 9437: "id2593051"></a>12.5.9. Packages installing
1.1 grant 9438: perl modules</h3>
9439: </div>
9440: </div>
9441: </div>
9442:
9443: <p>Makefiles of packages providing perl5 modules should
1.7 wiz 9444: include the Makefile fragment <code class=
9445: "filename">../../lang/perl5/module.mk</code>. It
9446: provides a <span><strong class=
9447: "command">do-configure</strong></span> target for the
9448: standard perl configuration for such modules as well as
9449: various hooks to tune this configuration. See comments
9450: in this file for details.</p>
1.1 grant 9451:
9452: <p>Perl5 modules will install into different places
9453: depending on the version of perl used during the build
9454: process. To address this, pkgsrc will append lines to
1.7 wiz 9455: the <code class="filename">PLIST</code> corresponding
9456: to the files listed in the installed <code class=
9457: "filename">.packlist</code> file generated by most
9458: perl5 modules. This is invoked by defining <code class=
9459: "varname">PERL5_PACKLIST</code> to a space-separated
9460: list of paths to packlist files, e.g.:</p>
1.1 grant 9461: <pre class="programlisting">
9462: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
9463: </pre>
9464:
1.7 wiz 9465: <p>The variables <code class=
9466: "varname">PERL5_SITELIB</code>, <code class=
9467: "varname">PERL5_SITEARCH</code>, and <code class=
9468: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 9469: locations in which perl5 modules may be installed, and
9470: may be used by perl5 packages that don't have a
9471: packlist. These three variables are also substituted
1.7 wiz 9472: for in the <code class="filename">PLIST</code>.</p>
1.1 grant 9473: </div>
9474:
9475: <div class="sect2" lang="en" xml:lang="en">
9476: <div class="titlepage">
9477: <div>
9478: <div>
9479: <h3 class="title"><a name="faq.info-files" id=
9480: "faq.info-files"></a>12.5.10. Packages
9481: installing info files</h3>
9482: </div>
9483: </div>
9484: </div>
9485:
9486: <p>Some packages install info files or use the
9487: “<span class="quote">makeinfo</span>” or
9488: “<span class="quote">install-info</span>”
9489: commands. Each of the info files:</p>
9490:
9491: <div class="itemizedlist">
9492: <ul type="disc">
9493: <li>
9494: <p>is considered to be installed in the directory
1.7 wiz 9495: <code class=
9496: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 9497: </li>
9498:
9499: <li>
9500: <p>is registered in the Info directory file
1.7 wiz 9501: <code class=
9502: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 9503: </li>
9504:
9505: <li>
9506: <p>and must be listed as a filename in the
1.7 wiz 9507: <code class="varname">INFO_FILES</code> variable
9508: in the package Makefile.</p>
1.1 grant 9509: </li>
9510: </ul>
9511: </div>
9512:
1.7 wiz 9513: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 9514: “<span class="quote">info</span>” and can
1.7 wiz 9515: be overridden in the package Makefile. <code class=
9516: "filename">INSTALL</code> and <code class=
9517: "filename">DEINSTALL</code> scripts will be generated
9518: to handle registration of the info files in the Info
1.1 grant 9519: directory file. The “<span class=
9520: "quote">install-info</span>” command used for the
9521: info files registration is either provided by the
9522: system, or by a special purpose package automatically
9523: added as dependency if needed.</p>
9524:
9525: <p>A package which needs the “<span class=
9526: "quote">makeinfo</span>” command at build time
1.7 wiz 9527: must define the variable <code class=
9528: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 9529: minimum version of the “<span class=
9530: "quote">makeinfo</span>” command is needed it
1.7 wiz 9531: should be noted with the <code class=
9532: "varname">TEXINFO_REQD</code> variable in the package
9533: <code class="filename">Makefile</code>. By default, a
1.1 grant 9534: minimum version of 3.12 is required. If the system does
1.7 wiz 9535: not provide a <span><strong class=
9536: "command">makeinfo</strong></span> command or if it
9537: does not match the required minimum, a build dependency
9538: on the <a xmlns=
9539: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 9540: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.7 wiz 9541: class="pkgname">devel/gtexinfo</a> package will be
9542: added automatically.</p>
1.1 grant 9543:
9544: <p>The build and installation process of the software
9545: provided by the package should not use the
1.7 wiz 9546: <span><strong class=
9547: "command">install-info</strong></span> command as the
9548: registration of info files is the task of the package
9549: <code class="filename">INSTALL</code> script, and it
9550: must use the appropriate <span><strong class=
9551: "command">makeinfo</strong></span> command.</p>
1.1 grant 9552:
9553: <p>To achieve this goal the pkgsrc infrastructure
1.7 wiz 9554: creates overriding scripts for the <span><strong class=
9555: "command">install-info</strong></span> and
9556: <span><strong class="command">makeinfo</strong></span>
9557: commands in a directory listed early in <code class=
9558: "varname">PATH</code>.</p>
1.1 grant 9559:
1.7 wiz 9560: <p>The script overriding <span><strong class=
9561: "command">install-info</strong></span> has no effect
9562: except the logging of a message. The script overriding
9563: <span><strong class="command">makeinfo</strong></span>
9564: logs a message and according to the value of
9565: <code class="varname">USE_MAKEINFO</code> and
9566: <code class="varname">TEXINFO_REQD</code> either run
9567: the appropriate <span><strong class=
9568: "command">makeinfo</strong></span> command or exit on
9569: error.</p>
1.1 grant 9570: </div>
9571:
9572: <div class="sect2" lang="en" xml:lang="en">
9573: <div class="titlepage">
9574: <div>
9575: <div>
1.12 ! agc 9576: <h3 class="title"><a name="id2593408" id=
! 9577: "id2593408"></a>12.5.11. Packages installing
1.1 grant 9578: GConf2 data files</h3>
9579: </div>
9580: </div>
9581: </div>
9582:
1.7 wiz 9583: <p>If a package installs <code class=
9584: "filename">.schemas</code> or <code class=
9585: "filename">.entries</code> files, used by GConf2, you
1.1 grant 9586: need to take some extra steps to make sure they get
9587: registered in the database:</p>
9588:
9589: <div class="orderedlist">
9590: <ol type="1">
9591: <li>
1.7 wiz 9592: <p>Include <code class=
9593: "filename">../../devel/GConf2/schemas.mk</code>
9594: instead of its <code class=
9595: "filename">buildlink3.mk</code> file. This takes
1.1 grant 9596: care of rebuilding the GConf2 database at
9597: installation and deinstallation time, and tells
9598: the package where to install GConf2 data files
9599: using some standard configure arguments. It also
9600: disallows any access to the database directly
9601: from the package.</p>
9602: </li>
9603:
9604: <li>
9605: <p>Ensure that the package installs its
1.7 wiz 9606: <code class="filename">.schemas</code> files
9607: under <code class=
9608: "filename">${PREFIX}/share/gconf/schemas</code>.
9609: If they get installed under <code class=
9610: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 9611: manually patch the package.</p>
9612: </li>
9613:
9614: <li>
9615: <p>Check the PLIST and remove any entries under
9616: the etc/gconf directory, as they will be handled
9617: automatically. See <a href="#faq.conf" title=
9618: "6.13. Configuration files handling and placement">
9619: Section 6.13, “Configuration files
9620: handling and placement”</a> for more
9621: information.</p>
9622: </li>
9623:
9624: <li>
1.7 wiz 9625: <p>Define the <code class=
9626: "varname">GCONF2_SCHEMAS</code> variable in your
9627: <code class="filename">Makefile</code> with a
9628: list of all <code class=
9629: "filename">.schemas</code> files installed by the
9630: package, if any. Names must not contain any
9631: directories in them.</p>
1.1 grant 9632: </li>
9633:
9634: <li>
1.7 wiz 9635: <p>Define the <code class=
9636: "varname">GCONF2_ENTRIES</code> variable in your
9637: <code class="filename">Makefile</code> with a
9638: list of all <code class=
9639: "filename">.entries</code> files installed by the
9640: package, if any. Names must not contain any
9641: directories in them.</p>
1.1 grant 9642: </li>
9643: </ol>
9644: </div>
9645: </div>
9646:
9647: <div class="sect2" lang="en" xml:lang="en">
9648: <div class="titlepage">
9649: <div>
9650: <div>
1.12 ! agc 9651: <h3 class="title"><a name="id2593508" id=
! 9652: "id2593508"></a>12.5.12. Packages installing
1.1 grant 9653: scrollkeeper data files</h3>
9654: </div>
9655: </div>
9656: </div>
9657:
1.7 wiz 9658: <p>If a package installs <code class=
9659: "filename">.omf</code> files, used by scrollkeeper, you
9660: need to take some extra steps to make sure they get
9661: registered in the database:</p>
1.1 grant 9662:
9663: <div class="orderedlist">
9664: <ol type="1">
9665: <li>
1.7 wiz 9666: <p>Include <code class=
9667: "filename">../../textproc/scrollkeeper/omf.mk</code>
9668: instead of its <code class=
9669: "filename">buildlink3.mk</code> file. This takes
1.1 grant 9670: care of rebuilding the scrollkeeper database at
9671: installation and deinstallation time, and
9672: disallows any access to it directly from the
9673: package.</p>
9674: </li>
9675:
9676: <li>
9677: <p>Check the PLIST and remove any entries under
1.7 wiz 9678: the <code class=
9679: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 9680: as they will be handled automatically.</p>
9681: </li>
9682:
9683: <li>
1.7 wiz 9684: <p>Remove the <code class=
9685: "filename">share/omf</code> directory from the
9686: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 9687: </li>
9688: </ol>
9689: </div>
9690: </div>
9691:
9692: <div class="sect2" lang="en" xml:lang="en">
9693: <div class="titlepage">
9694: <div>
9695: <div>
1.12 ! agc 9696: <h3 class="title"><a name="id2593559" id=
! 9697: "id2593559"></a>12.5.13. Packages installing
1.1 grant 9698: X11 fonts</h3>
9699: </div>
9700: </div>
9701: </div>
9702:
9703: <p>If a package installs font files, you will need to
9704: rebuild the fonts database in the directory where they
9705: get installed at installation and deinstallation time.
1.7 wiz 9706: This can be automatically done by using <code class=
9707: "filename">mk/fonts.mk</code>, which you need to
9708: include in your <code class=
9709: "filename">Makefile</code>.</p>
1.1 grant 9710:
9711: <p>When the file is included, you can list the
1.7 wiz 9712: directories where fonts are installed in the
9713: <code class="varname">FONTS_<em class=
9714: "replaceable"><code>type</code></em>_DIRS</code>
9715: variables, where <em class=
9716: "replaceable"><code>type</code></em> can be one of
9717: “<span class="quote">TTF</span>”,
1.1 grant 9718: “<span class="quote">TYPE1</span>” or
9719: “<span class="quote">X11</span>”. Also make
1.7 wiz 9720: sure that the database file <code class=
9721: "filename">fonts.dir</code> is not listed in the
1.1 grant 9722: PLIST.</p>
9723:
9724: <p>Note that you should not create new directories for
9725: fonts; instead use the standard ones to avoid that the
9726: user needs to manually configure his X server to find
9727: them.</p>
9728: </div>
9729:
9730: <div class="sect2" lang="en" xml:lang="en">
9731: <div class="titlepage">
9732: <div>
9733: <div>
1.12 ! agc 9734: <h3 class="title"><a name="id2593606" id=
! 9735: "id2593606"></a>12.5.14. Packages installing
1.1 grant 9736: GTK2 modules</h3>
9737: </div>
9738: </div>
9739: </div>
9740:
9741: <p>If a package installs gtk2 immodules or loaders, you
9742: need to take some extra steps to get them registered in
9743: the GTK2 database properly:</p>
9744:
9745: <div class="orderedlist">
9746: <ol type="1">
9747: <li>
1.7 wiz 9748: <p>Include <code class=
9749: "filename">../../x11/gtk2/modules.mk</code>
9750: instead of its <code class=
9751: "filename">buildlink3.mk</code> file. This takes
9752: care of rebuilding the database at installation
9753: and deinstallation time.</p>
1.1 grant 9754: </li>
9755:
9756: <li>
1.7 wiz 9757: <p>Set <code class=
9758: "varname">GTK2_IMMODULES=YES</code> if your
9759: package installs GTK2 immodules.</p>
1.1 grant 9760: </li>
9761:
9762: <li>
1.7 wiz 9763: <p>Set <code class=
9764: "varname">GTK2_LOADERS=YES</code> if your package
9765: installs GTK2 loaders.</p>
1.1 grant 9766: </li>
9767:
9768: <li>
9769: <p>Patch the package to not touch any of the gtk2
9770: databases directly. These are:</p>
9771:
9772: <div class="itemizedlist">
9773: <ul type="disc">
9774: <li>
1.7 wiz 9775: <p><code class=
9776: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 9777: </li>
9778:
9779: <li>
1.7 wiz 9780: <p><code class=
9781: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 9782: </li>
9783: </ul>
9784: </div>
9785: </li>
9786:
9787: <li>
9788: <p>Check the PLIST and remove any entries under
1.7 wiz 9789: the <code class="filename">libdata/gtk-2.0</code>
1.1 grant 9790: directory, as they will be handled
9791: automatically.</p>
9792: </li>
9793: </ol>
9794: </div>
9795: </div>
9796:
9797: <div class="sect2" lang="en" xml:lang="en">
9798: <div class="titlepage">
9799: <div>
9800: <div>
1.12 ! agc 9801: <h3 class="title"><a name="id2593675" id=
! 9802: "id2593675"></a>12.5.15. Packages installing
1.1 grant 9803: SGML or XML data</h3>
9804: </div>
9805: </div>
9806: </div>
9807:
9808: <p>If a package installs SGML or XML data files that
9809: need to be registered in system-wide catalogs (like
9810: DTDs, sub-catalogs, etc.), you need to take some extra
9811: steps:</p>
9812:
9813: <div class="orderedlist">
9814: <ol type="1">
9815: <li>
1.7 wiz 9816: <p>Include <code class=
9817: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
9818: in your <code class="filename">Makefile</code>,
9819: which takes care of registering those files in
1.1 grant 9820: system-wide catalogs at installation and
9821: deinstallation time.</p>
9822: </li>
9823:
9824: <li>
1.7 wiz 9825: <p>Set <code class="varname">SGML_CATALOGS</code>
9826: to the full path of any SGML catalogs installed
9827: by the package.</p>
1.1 grant 9828: </li>
9829:
9830: <li>
1.7 wiz 9831: <p>Set <code class="varname">XML_CATALOGS</code>
9832: to the full path of any XML catalogs installed by
1.1 grant 9833: the package.</p>
9834: </li>
9835:
9836: <li>
1.7 wiz 9837: <p>Set <code class="varname">SGML_ENTRIES</code>
9838: to individual entries to be added to the SGML
1.1 grant 9839: catalog. These come in groups of three strings;
9840: see xmlcatmgr(1) for more information
9841: (specifically, arguments recognized by the 'add'
9842: action). Note that you will normally not use this
9843: variable.</p>
9844: </li>
9845:
9846: <li>
1.7 wiz 9847: <p>Set <code class="varname">XML_ENTRIES</code>
9848: to individual entries to be added to the XML
1.1 grant 9849: catalog. These come in groups of three strings;
9850: see xmlcatmgr(1) for more information
9851: (specifically, arguments recognized by the 'add'
9852: action). Note that you will normally not use this
9853: variable.</p>
9854: </li>
9855: </ol>
9856: </div>
9857: </div>
9858:
9859: <div class="sect2" lang="en" xml:lang="en">
9860: <div class="titlepage">
9861: <div>
9862: <div>
1.12 ! agc 9863: <h3 class="title"><a name="id2593728" id=
! 9864: "id2593728"></a>12.5.16. Packages installing
1.1 grant 9865: extensions to the MIME database</h3>
9866: </div>
9867: </div>
9868: </div>
9869:
9870: <p>If a package provides extensions to the MIME
1.7 wiz 9871: database by installing <code class=
9872: "filename">.xml</code> files inside <code class=
9873: "filename">${PREFIX}/share/mime/packages</code>, you
9874: need to take some extra steps to ensure that the
9875: database is kept consistent with respect to these new
9876: files:</p>
1.1 grant 9877:
9878: <div class="orderedlist">
9879: <ol type="1">
9880: <li>
1.7 wiz 9881: <p>Include <code class=
9882: "filename">../../databases/shared-mime-info/mimedb.mk</code>
9883: (avoid using the <code class=
9884: "filename">buildlink3.mk</code> file from this
9885: same directory, which is reserved for inclusion
9886: from other <code class=
9887: "filename">buildlink3.mk</code> files). It takes
9888: care of rebuilding the MIME database at
9889: installation and deinstallation time, and
9890: disallows any access to it directly from the
1.1 grant 9891: package.</p>
9892: </li>
9893:
9894: <li>
9895: <p>Check the PLIST and remove any entries under
1.7 wiz 9896: the <code class="filename">share/mime</code>
1.1 grant 9897: directory, <span class=
9898: "emphasis"><em>except</em></span> for files saved
1.7 wiz 9899: under <code class=
9900: "filename">share/mime/packages</code>. The former
1.1 grant 9901: are handled automatically by the
9902: update-mime-database program, but the later are
9903: package-dependent and must be removed by the
9904: package that installed them in the first
9905: place.</p>
9906: </li>
9907:
9908: <li>
1.7 wiz 9909: <p>Remove any <code class=
9910: "filename">share/mime/*</code> directories from
9911: the PLIST. They will be handled by the
1.1 grant 9912: shared-mime-info package.</p>
9913: </li>
9914: </ol>
9915: </div>
9916: </div>
9917:
9918: <div class="sect2" lang="en" xml:lang="en">
9919: <div class="titlepage">
9920: <div>
9921: <div>
1.12 ! agc 9922: <h3 class="title"><a name="id2593798" id=
! 9923: "id2593798"></a>12.5.17. Packages using
1.1 grant 9924: intltool</h3>
9925: </div>
9926: </div>
9927: </div>
9928:
9929: <p>If a package uses intltool during its build, include
1.7 wiz 9930: the <code class=
9931: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 9932: file, which forces it to use the intltool package
9933: provided by pkgsrc, instead of the one bundled with the
9934: distribution file.</p>
9935:
9936: <p>This tracks intltool's build-time dependencies and
9937: uses the latest available version; this way, the
9938: package benefits of any bug fixes that may have
9939: appeared since it was released.</p>
9940: </div>
9941: </div>
9942:
9943: <div class="sect1" lang="en" xml:lang="en">
9944: <div class="titlepage">
9945: <div>
9946: <div>
9947: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 9948: "id2593812" id="id2593812"></a>12.6. Feedback
1.1 grant 9949: to the author</h2>
9950: </div>
9951: </div>
9952: </div>
9953:
9954: <p>If you have found any bugs in the package you make
9955: available, if you had to do special steps to make it run
9956: under NetBSD or if you enhanced the software in various
9957: other ways, be sure to report these changes back to the
9958: original author of the program! With that kind of
9959: support, the next release of the program can incorporate
9960: these fixes, and people not using the NetBSD packages
9961: system can win from your efforts.</p>
9962:
9963: <p>Support the idea of free software!</p>
9964: </div>
9965: </div>
9966:
9967: <div class="chapter" lang="en" xml:lang="en">
9968: <div class="titlepage">
9969: <div>
9970: <div>
9971: <h2 class="title"><a name="debug" id=
9972: "debug"></a>Chapter 13. Debugging</h2>
9973: </div>
9974: </div>
9975: </div>
9976:
9977: <p>To check out all the gotchas when building a package,
9978: here are the steps that I do in order to get a package
9979: working. Please note this is basically the same as what was
9980: explained in the previous sections, only with some
9981: debugging aids.</p>
9982:
9983: <div class="itemizedlist">
9984: <ul type="disc">
9985: <li>
1.7 wiz 9986: <p>Be sure to set <code class=
9987: "varname">PKG_DEVELOPER=1</code> in <code class=
9988: "filename">/etc/mk.conf</code></p>
1.1 grant 9989: </li>
9990:
9991: <li>
9992: <p>Install <a xmlns=
9993: "http://www.w3.org/TR/xhtml1/transitional" href=
9994: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.7 wiz 9995: class="pkgname">pkgtools/url2pkg</a>, create a
9996: directory for a new package, change into it, then run
9997: <span><strong class=
9998: "command">url2pkg</strong></span>:</p>
1.1 grant 9999: <pre class="screen">
1.7 wiz 10000: <code class="prompt">%</code> <strong class=
10001: "userinput"><code>mkdir /usr/pkgsrc/<em class=
10002: "replaceable"><code>category</code></em>/<em class=
10003: "replaceable"><code>examplepkg</code></em></code></strong>
10004: <code class="prompt">%</code> <strong class=
10005: "userinput"><code>cd /usr/pkgsrc/<em class=
10006: "replaceable"><code>category</code></em>/<em class=
10007: "replaceable"><code>examplepkg</code></em></code></strong>
10008: <code class="prompt">%</code> <strong class=
10009: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 10010: </pre>
10011: </li>
10012:
10013: <li>
1.7 wiz 10014: <p>Edit the <code class="filename">Makefile</code> as
1.1 grant 10015: requested.</p>
10016: </li>
10017:
10018: <li>
1.7 wiz 10019: <p>Fill in the <code class="filename">DESCR</code>
1.1 grant 10020: file</p>
10021: </li>
10022:
10023: <li>
1.7 wiz 10024: <p>Run <span><strong class="command">make
10025: configure</strong></span></p>
1.1 grant 10026: </li>
10027:
10028: <li>
10029: <p>Add any dependencies glimpsed from documentation
1.7 wiz 10030: and the configure step to the package's <code class=
10031: "filename">Makefile</code>.</p>
1.1 grant 10032: </li>
10033:
10034: <li>
10035: <p>Make the package compile, doing multiple rounds
10036: of</p>
10037: <pre class="screen">
1.7 wiz 10038: <code class="prompt">%</code> <strong class=
10039: "userinput"><code>make</code></strong>
10040: <code class="prompt">%</code> <strong class=
10041: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
10042: <code class="prompt">%</code> <strong class=
10043: "userinput"><code>mkpatches</code></strong>
10044: <code class="prompt">%</code> <strong class=
10045: "userinput"><code>patchdiff</code></strong>
10046: <code class="prompt">%</code> <strong class=
10047: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
10048: <code class="prompt">%</code> <strong class=
10049: "userinput"><code>make mps</code></strong>
10050: <code class="prompt">%</code> <strong class=
10051: "userinput"><code>make clean</code></strong>
1.1 grant 10052: </pre>
10053:
10054: <p>Doing as non-root user will ensure that no files
10055: are modified that shouldn't be, especially during the
1.7 wiz 10056: build phase. <span><strong class=
10057: "command">mkpatches</strong></span>,
10058: <span><strong class=
10059: "command">patchdiff</strong></span> and
10060: <span><strong class="command">pkgvi</strong></span>
10061: are from the <a xmlns=
1.1 grant 10062: "http://www.w3.org/TR/xhtml1/transitional" href=
10063: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.7 wiz 10064: class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1 grant 10065: </li>
10066:
10067: <li>
1.7 wiz 10068: <p>Look at the <code class=
10069: "filename">Makefile</code>, fix if necessary; see
10070: <a href="#components.Makefile" title=
10071: "7.1. Makefile">Section 7.1,
10072: “<code class=
10073: "filename">Makefile</code>”</a>.</p>
1.1 grant 10074: </li>
10075:
10076: <li>
1.7 wiz 10077: <p>Generate a <code class=
10078: "filename">PLIST</code>:</p>
1.1 grant 10079: <pre class="screen">
1.7 wiz 10080: <code class="prompt">#</code> <strong class=
10081: "userinput"><code>make install</code></strong>
10082: <code class="prompt">#</code> <strong class=
10083: "userinput"><code>make print-PLIST >PLIST</code></strong>
10084: <code class="prompt">#</code> <strong class=
10085: "userinput"><code>make deinstall</code></strong>
10086: <code class="prompt">#</code> <strong class=
10087: "userinput"><code>make install</code></strong>
10088: <code class="prompt">#</code> <strong class=
10089: "userinput"><code>make deinstall</code></strong>
1.1 grant 10090: </pre>
10091:
1.7 wiz 10092: <p>You usually need to be <code class=
10093: "username">root</code> to do this. Look if there are
1.1 grant 10094: any files left:</p>
10095: <pre class="screen">
1.7 wiz 10096: <code class="prompt">#</code> <strong class=
10097: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 10098: </pre>
10099:
10100: <p>If this reveals any files that are missing in
1.7 wiz 10101: <code class="filename">PLIST</code>, add them.</p>
1.1 grant 10102: </li>
10103:
10104: <li>
1.7 wiz 10105: <p>Now that the <code class="filename">PLIST</code>
10106: is OK, install the package again and make a binary
1.1 grant 10107: package:</p>
10108: <pre class="screen">
1.7 wiz 10109: <code class="prompt">#</code> <strong class=
10110: "userinput"><code>make reinstall</code></strong>
10111: <code class="prompt">#</code> <strong class=
10112: "userinput"><code>make package</code></strong>
1.1 grant 10113: </pre>
10114: </li>
10115:
10116: <li>
10117: <p>Delete the installed package:</p>
10118: <pre class="screen">
1.7 wiz 10119: <code class="prompt">#</code> <strong class=
10120: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 10121: </pre>
10122: </li>
10123:
10124: <li>
1.7 wiz 10125: <p>Repeat the above <span><strong class=
10126: "command">make print-PLIST</strong></span> command,
10127: which shouldn't find anything now:</p>
1.1 grant 10128: <pre class="screen">
1.7 wiz 10129: <code class="prompt">#</code> <strong class=
10130: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 10131: </pre>
10132: </li>
10133:
10134: <li>
10135: <p>Reinstall the binary package:</p>
10136: <pre class="screen">
1.7 wiz 10137: <code class="prompt">#</code> <strong class=
10138: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 10139: </pre>
10140: </li>
10141:
10142: <li>
10143: <p>Play with it. Make sure everything works.</p>
10144: </li>
10145:
10146: <li>
1.7 wiz 10147: <p>Run <span><strong class=
10148: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 10149: "http://www.w3.org/TR/xhtml1/transitional" href=
10150: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.7 wiz 10151: class="pkgname">pkgtools/pkglint</a>, and fix the
10152: problems it reports:</p>
1.1 grant 10153: <pre class="screen">
1.7 wiz 10154: <code class="prompt">#</code> <strong class=
10155: "userinput"><code>pkglint</code></strong>
1.1 grant 10156: </pre>
10157: </li>
10158:
10159: <li>
10160: <p>Submit (or commit, if you have cvs access); see
10161: <a href="#submit" title=
10162: "Chapter 14. Submitting and Committing">Chapter 14,
10163: <i>Submitting and Committing</i></a>.</p>
10164: </li>
10165: </ul>
10166: </div>
10167: </div>
10168:
10169: <div class="chapter" lang="en" xml:lang="en">
10170: <div class="titlepage">
10171: <div>
10172: <div>
10173: <h2 class="title"><a name="submit" id=
10174: "submit"></a>Chapter 14. Submitting and
10175: Committing</h2>
10176: </div>
10177: </div>
10178: </div>
10179:
10180: <div class="toc">
10181: <p><b>Table of Contents</b></p>
10182:
10183: <dl>
1.12 ! agc 10184: <dt><span class="sect1"><a href="#id2594342">14.1.
1.1 grant 10185: Submitting your packages</a></span></dt>
10186:
1.12 ! agc 10187: <dt><span class="sect1"><a href="#id2594389">14.2.
1.1 grant 10188: Committing: Importing a package into
10189: CVS</a></span></dt>
10190:
1.12 ! agc 10191: <dt><span class="sect1"><a href="#id2594520">14.3.
1.2 hubertf 10192: Updating a package to a newer version</a></span></dt>
1.1 grant 10193:
1.12 ! agc 10194: <dt><span class="sect1"><a href="#id2594539">14.4.
1.2 hubertf 10195: Moving a package in pkgsrc</a></span></dt>
1.1 grant 10196: </dl>
10197: </div>
10198:
10199: <div class="sect1" lang="en" xml:lang="en">
10200: <div class="titlepage">
10201: <div>
10202: <div>
10203: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 10204: "id2594342" id=
! 10205: "id2594342"></a>14.1. Submitting your
1.1 grant 10206: packages</h2>
10207: </div>
10208: </div>
10209: </div>
10210:
10211: <p>You have to separate between binary and
10212: “<span class="quote">normal</span>” (source)
10213: packages here:</p>
10214:
10215: <div class="itemizedlist">
10216: <ul type="disc">
10217: <li>
10218: <p>precompiled binary packages</p>
10219:
10220: <p>Our policy is that we accept binaries only from
10221: pkgsrc developers to guarantee that the packages
10222: don't contain any trojan horses etc. This is not to
10223: piss anyone off but rather to protect our users!
10224: You're still free to put up your home-made binary
10225: packages and tell the world where to get them.</p>
10226: </li>
10227:
10228: <li>
10229: <p>packages</p>
10230:
10231: <p>First, check that your package is complete,
10232: compiles and runs well; see <a href="#debug" title=
10233: "Chapter 13. Debugging">Chapter 13,
10234: <i>Debugging</i></a> and the rest of this document.
10235: Next, generate an uuencoded gzipped tar(1) archive,
10236: preferably with all files in a single directory.
1.7 wiz 10237: Finally, <span><strong class=
10238: "command">send-pr</strong></span> with category
1.1 grant 10239: “<span class="quote">pkg</span>”, a
10240: synopsis which includes the package name and
10241: version number, a short description of your package
10242: (contents of the COMMENT variable or DESCR file are
10243: OK) and attach the archive to your PR.</p>
10244:
10245: <p>If you want to submit several packages, please
10246: send a separate PR for each one, it's easier for us
10247: to track things that way.</p>
10248:
10249: <p>Alternatively, you can also import new packages
10250: into pkgsrc-wip (“<span class="quote">pkgsrc
10251: work-in-progress</span>”); see the homepage
10252: at <a href="http://pkgsrc-wip.sourceforge.net/"
10253: target=
10254: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
10255: details.</p>
10256: </li>
10257: </ul>
10258: </div>
10259: </div>
10260:
10261: <div class="sect1" lang="en" xml:lang="en">
10262: <div class="titlepage">
10263: <div>
10264: <div>
10265: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 10266: "id2594389" id=
! 10267: "id2594389"></a>14.2. Committing: Importing a
1.1 grant 10268: package into CVS</h2>
10269: </div>
10270: </div>
10271: </div>
10272:
10273: <p>This section is only of interest for pkgsrc developers
10274: with write access to the pkgsrc repository. Please
10275: remember that cvs imports files relative to the current
10276: working directory, and that the pathname that you give
1.7 wiz 10277: the <span><strong class="command">cvs
10278: import</strong></span> command is so that it knows where
10279: to place the files in the repository. Newly created
10280: packages should be imported with a vendor tag of
10281: “<span class="quote">TNF</span>” and a
10282: release tag of “<span class=
10283: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 10284: <pre class="programlisting">
10285: % cd .../pkgsrc/category/pkgname
10286: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
10287: </pre>
10288:
10289: <p>Remember to move the directory from which you imported
10290: out of the way, or cvs will complain the next time you
10291: “<span class="quote">cvs update</span>” your
10292: source tree. Also don't forget to add the new package to
1.7 wiz 10293: the category's <code class=
10294: "filename">Makefile</code>.</p>
1.1 grant 10295:
10296: <p>The commit message of the initial import should
1.7 wiz 10297: include part of the <code class="filename">DESCR</code>
10298: file, so people reading the mailing lists know what the
10299: package is/does.</p>
1.1 grant 10300:
10301: <p>Please note all package updates/additions in
1.7 wiz 10302: <code class="filename">pkgsrc/doc/CHANGES</code>. It's
10303: very important to keep this file up to date and
10304: conforming to the existing format, because it will be
10305: used by scripts to automatically update pages on <a href=
1.1 grant 10306: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
10307: and other sites. Additionally, check the pkgsrc/doc/TODO
10308: file and remove the entry for the package you updated, in
10309: case it was mentioned there.</p>
10310:
10311: <p>For new packages, “<span class="quote">cvs
10312: import</span>” is preferred to “<span class=
10313: "quote">cvs add</span>” because the former gets
10314: everything with a single command, and provides a
10315: consistent tag.</p>
10316: </div>
10317:
10318: <div class="sect1" lang="en" xml:lang="en">
10319: <div class="titlepage">
10320: <div>
10321: <div>
10322: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 10323: "id2594520" id="id2594520"></a>14.3. Updating
1.2 hubertf 10324: a package to a newer version</h2>
1.1 grant 10325: </div>
10326: </div>
10327: </div>
10328:
10329: <p>Please always put a concise, appropriate and relevant
10330: summary of the changes between old and new versions into
10331: the commit log when updating a package. There are various
10332: reasons for this:</p>
10333:
10334: <div class="itemizedlist">
10335: <ul type="disc">
10336: <li>
10337: <p>A URL is volatile, and can change over time. It
10338: may go away completely or its information may be
10339: overwritten by newer information.</p>
10340: </li>
10341:
10342: <li>
10343: <p>Having the change information between old and
10344: new versions in our CVS repository is very useful
10345: for people who use either cvs or anoncvs.</p>
10346: </li>
10347:
10348: <li>
10349: <p>Having the change information between old and
10350: new versions in our CVS repository is very useful
10351: for people who read the pkgsrc-changes mailing
10352: list, so that they can make tactical decisions
10353: about when to upgrade the package.</p>
10354: </li>
10355: </ul>
10356: </div>
10357:
10358: <p>Please also recognise that, just because a new version
10359: of a package has been released, it should not
10360: automatically be upgraded in the CVS repository. We
10361: prefer to be conservative in the packages that are
10362: included in pkgsrc - development or beta packages are not
10363: really the best thing for most places in which pkgsrc is
10364: used. Please use your judgement about what should go into
10365: pkgsrc, and bear in mind that stability is to be
10366: preferred above new and possibly untested features.</p>
10367: </div>
10368:
10369: <div class="sect1" lang="en" xml:lang="en">
10370: <div class="titlepage">
10371: <div>
10372: <div>
10373: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 10374: "id2594539" id="id2594539"></a>14.4. Moving a
1.2 hubertf 10375: package in pkgsrc</h2>
1.1 grant 10376: </div>
10377: </div>
10378: </div>
10379:
10380: <div class="orderedlist">
10381: <ol type="1">
10382: <li>
10383: <p>Make a copy of the directory somewhere else.</p>
10384: </li>
10385:
10386: <li>
10387: <p>Remove all CVS dirs.</p>
10388:
10389: <p>Alternatively to the first two steps you can
10390: also do:</p>
10391: <pre class="screen">
1.7 wiz 10392: <code class="prompt">%</code> <strong class=
10393: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 10394: </pre>
10395:
10396: <p>and use that for further work.</p>
10397: </li>
10398:
10399: <li>
1.7 wiz 10400: <p>Fix <code class="varname">CATEGORIES</code> and
10401: any <code class="varname">DEPENDS</code> paths that
10402: just did “<span class=
1.1 grant 10403: "quote">../package</span>” instead of
10404: “<span class=
10405: "quote">../../category/package</span>”.</p>
10406: </li>
10407:
10408: <li>
1.7 wiz 10409: <p><span><strong class="command">cvs
10410: import</strong></span> the modified package in the
10411: new place.</p>
1.1 grant 10412: </li>
10413:
10414: <li>
10415: <p>Check if any package depends on it:</p>
10416: <pre class="screen">
1.7 wiz 10417: <code class="prompt">%</code> <strong class=
10418: "userinput"><code>cd /usr/pkgsrc</code></strong>
10419: <code class="prompt">%</code> <strong class=
10420: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 10421: </pre>
10422: </li>
10423:
10424: <li>
10425: <p>Fix paths in packages from step 5 to point to
10426: new location.</p>
10427: </li>
10428:
10429: <li>
1.7 wiz 10430: <p><span><strong class="command">cvs rm
10431: (-f)</strong></span> the package at the old
10432: location.</p>
1.1 grant 10433: </li>
10434:
10435: <li>
1.7 wiz 10436: <p>Remove from <code class=
10437: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 10438: </li>
10439:
10440: <li>
1.7 wiz 10441: <p>Add to <code class=
10442: "filename">newcategory/Makefile</code>.</p>
1.1 grant 10443: </li>
10444:
10445: <li>
10446: <p>Commit the changed and removed files:</p>
10447: <pre class="screen">
1.7 wiz 10448: <code class="prompt">%</code> <strong class=
10449: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 10450: </pre>
10451:
10452: <p>(and any packages from step 5, of course).</p>
10453: </li>
10454: </ol>
10455: </div>
10456: </div>
10457: </div>
10458: </div>
10459:
10460: <div class="appendix" lang="en" xml:lang="en">
10461: <div class="titlepage">
10462: <div>
10463: <div>
10464: <h2 class="title"><a name="examples" id=
10465: "examples"></a>Appendix A. A simple example
10466: package: bison</h2>
10467: </div>
10468: </div>
10469: </div>
10470:
10471: <div class="toc">
10472: <p><b>Table of Contents</b></p>
10473:
10474: <dl>
1.12 ! agc 10475: <dt><span class="sect1"><a href="#id2594765">A.1.
1.1 grant 10476: files</a></span></dt>
10477:
10478: <dd>
10479: <dl>
1.12 ! agc 10480: <dt><span class="sect2"><a href="#id2594769">A.1.1.
1.1 grant 10481: Makefile</a></span></dt>
10482:
1.12 ! agc 10483: <dt><span class="sect2"><a href="#id2594776">A.1.2.
1.1 grant 10484: DESCR</a></span></dt>
10485:
1.12 ! agc 10486: <dt><span class="sect2"><a href="#id2594791">A.1.3.
1.1 grant 10487: PLIST</a></span></dt>
10488:
1.12 ! agc 10489: <dt><span class="sect2"><a href="#id2594798">A.1.4.
1.7 wiz 10490: Checking a package with <span><strong class=
10491: "command">pkglint</strong></span></a></span></dt>
1.1 grant 10492: </dl>
10493: </dd>
10494:
1.12 ! agc 10495: <dt><span class="sect1"><a href="#id2594839">A.2. Steps
1.1 grant 10496: for building, installing, packaging</a></span></dt>
10497: </dl>
10498: </div>
10499:
10500: <p>We checked to find a piece of software that wasn't in the
10501: packages collection, and picked GNU bison. Quite why someone
1.7 wiz 10502: would want to have <span><strong class=
10503: "command">bison</strong></span> when Berkeley
10504: <span><strong class="command">yacc</strong></span> is already
10505: present in the tree is beyond us, but it's useful for the
10506: purposes of this exercise.</p>
1.1 grant 10507:
10508: <div class="sect1" lang="en" xml:lang="en">
10509: <div class="titlepage">
10510: <div>
10511: <div>
10512: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 10513: "id2594765" id="id2594765"></a>A.1. files</h2>
1.1 grant 10514: </div>
10515: </div>
10516: </div>
10517:
10518: <div class="sect2" lang="en" xml:lang="en">
10519: <div class="titlepage">
10520: <div>
10521: <div>
1.12 ! agc 10522: <h3 class="title"><a name="id2594769" id=
! 10523: "id2594769"></a>A.1.1. Makefile</h3>
1.1 grant 10524: </div>
10525: </div>
10526: </div>
10527: <pre class="programlisting">
1.11 ben 10528: # $NetBSD$
1.1 grant 10529: #
10530:
10531: DISTNAME= bison-1.25
10532: CATEGORIES= devel
10533: MASTER_SITES= ${MASTER_SITE_GNU}
10534:
10535: MAINTAINER= thorpej@NetBSD.org
10536: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
10537: COMMENT= GNU yacc clone
10538:
10539: GNU_CONFIGURE= yes
10540: INFO_FILES= bison.info
10541:
10542: .include "../../mk/bsd.pkg.mk"
10543: </pre>
10544: </div>
10545:
10546: <div class="sect2" lang="en" xml:lang="en">
10547: <div class="titlepage">
10548: <div>
10549: <div>
1.12 ! agc 10550: <h3 class="title"><a name="id2594776" id=
! 10551: "id2594776"></a>A.1.2. DESCR</h3>
1.1 grant 10552: </div>
10553: </div>
10554: </div>
10555: <pre class="programlisting">
10556: GNU version of yacc. Can make re-entrant parsers, and numerous other
10557: improvements. Why you would want this when Berkeley <a href=
10558: "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
10559: of the NetBSD source tree is beyond me.
10560: </pre>
10561: </div>
10562:
10563: <div class="sect2" lang="en" xml:lang="en">
10564: <div class="titlepage">
10565: <div>
10566: <div>
1.12 ! agc 10567: <h3 class="title"><a name="id2594791" id=
! 10568: "id2594791"></a>A.1.3. PLIST</h3>
1.1 grant 10569: </div>
10570: </div>
10571: </div>
10572: <pre class="programlisting">
1.11 ben 10573: @comment $NetBSD$
1.1 grant 10574: bin/bison
10575: man/man1/bison.1.gz
10576: share/bison.simple
10577: share/bison.hairy
10578: </pre>
10579: </div>
10580:
10581: <div class="sect2" lang="en" xml:lang="en">
10582: <div class="titlepage">
10583: <div>
10584: <div>
1.12 ! agc 10585: <h3 class="title"><a name="id2594798" id=
! 10586: "id2594798"></a>A.1.4. Checking a package with
1.7 wiz 10587: <span><strong class=
10588: "command">pkglint</strong></span></h3>
1.1 grant 10589: </div>
10590: </div>
10591: </div>
10592:
10593: <p>The NetBSD package system comes with <a xmlns=
10594: "http://www.w3.org/TR/xhtml1/transitional" href=
10595: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.7 wiz 10596: class="pkgname">pkgtools/pkglint</a> which helps to check
10597: the contents of these files. After installation it is
10598: quite easy to use, just change to the directory of the
10599: package you wish to examine and execute
10600: <span><strong class=
10601: "command">pkglint</strong></span>:</p>
1.1 grant 10602: <pre class="screen">
1.7 wiz 10603: <code class="prompt">$</code> <strong class=
10604: "userinput"><code>pkglint</code></strong>
1.1 grant 10605: OK: checking ./DESCR.
10606: OK: checking Makefile.
10607: OK: checking distinfo.
10608: OK: checking patches/patch-aa.
10609: looks fine.
10610: </pre>
10611:
10612: <p>Depending on the supplied command line arguments (see
10613: pkglint(1)) more verbose checks will be performed. Use
1.7 wiz 10614: e.g. <span><strong class="command">pkglint
10615: -v</strong></span> for a very verbose check.</p>
1.1 grant 10616: </div>
10617: </div>
10618:
10619: <div class="sect1" lang="en" xml:lang="en">
10620: <div class="titlepage">
10621: <div>
10622: <div>
10623: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 10624: "id2594839" id="id2594839"></a>A.2. Steps for
1.1 grant 10625: building, installing, packaging</h2>
10626: </div>
10627: </div>
10628: </div>
10629:
10630: <p>Create the directory where the package lives, plus any
10631: auxiliary directories:</p>
10632: <pre class="screen">
1.7 wiz 10633: <code class="prompt">#</code> <strong class=
10634: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
10635: <code class="prompt">#</code> <strong class=
10636: "userinput"><code>mkdir bison</code></strong>
10637: <code class="prompt">#</code> <strong class=
10638: "userinput"><code>cd bison</code></strong>
10639: <code class="prompt">#</code> <strong class=
10640: "userinput"><code>mkdir patches</code></strong>
1.1 grant 10641: </pre>
10642:
1.7 wiz 10643: <p>Create <code class="filename">Makefile</code>,
10644: <code class="filename">DESCR</code> and <code class=
10645: "filename">PLIST</code> (see <a href="#components" title=
1.1 grant 10646: "Chapter 7. Package components - files, directories and contents">
10647: Chapter 7, <i>Package components - files, directories and
10648: contents</i></a>) then continue with fetching the
10649: distfile:</p>
10650: <pre class="screen">
1.7 wiz 10651: <code class="prompt">#</code> <strong class=
10652: "userinput"><code>make fetch</code></strong>
1.1 grant 10653: >> bison-1.25.tar.gz doesn't seem to exist on this system.
10654: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
10655: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10656: ftp: Error retrieving file: 500 Internal error
10657:
10658: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
10659: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10660: ftp: Error retrieving file: 500 Internal error
10661:
10662: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
10663: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10664: Successfully retrieved file.
10665: </pre>
10666:
1.7 wiz 10667: <p>Generate the checksum of the distfile into <code class=
10668: "filename">distinfo</code>:</p>
1.1 grant 10669: <pre class="screen">
1.7 wiz 10670: <code class="prompt">#</code> <strong class=
10671: "userinput"><code>make makesum</code></strong>
1.1 grant 10672: </pre>
10673:
10674: <p>Now compile:</p>
10675: <pre class="screen">
1.7 wiz 10676: <code class="prompt">#</code> <strong class=
10677: "userinput"><code>make</code></strong>
1.1 grant 10678: >> Checksum OK for bison-1.25.tar.gz.
10679: ===> Extracting for bison-1.25
10680: ===> Patching for bison-1.25
10681: ===> Ignoring empty patch directory
10682: ===> Configuring for bison-1.25
10683: creating cache ./config.cache
10684: checking for gcc... cc
10685: checking whether we are using GNU C... yes
10686: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
10687: checking how to run the C preprocessor... cc -E
10688: checking for minix/config.h... no
10689: checking for POSIXized ISC... no
10690: checking whether cross-compiling... no
10691: checking for ANSI C header files... yes
10692: checking for string.h... yes
10693: checking for stdlib.h... yes
10694: checking for memory.h... yes
10695: checking for working const... yes
10696: checking for working alloca.h... no
10697: checking for alloca... yes
10698: checking for strerror... yes
10699: updating cache ./config.cache
10700: creating ./config.status
10701: creating Makefile
10702: ===> Building for bison-1.25
10703: 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
10704: 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
10705: 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
10706: 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
10707: 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
10708: 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
10709: 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
10710: 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
10711: 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
10712: 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
10713: 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
10714: 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
10715: 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
10716: 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
10717: 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
10718: 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
10719: 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
10720: 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
10721: 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
10722: 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
10723: 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
10724: 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
10725: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
10726: rm -f bison.s1
10727: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
10728: </pre>
10729:
10730: <p>Everything seems OK, so install the files:</p>
10731: <pre class="screen">
1.7 wiz 10732: <code class="prompt">#</code> <strong class=
10733: "userinput"><code>make install</code></strong>
1.1 grant 10734: >> Checksum OK for bison-1.25.tar.gz.
10735: ===> Installing for bison-1.25
10736: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
10737: rm -f /usr/pkg/bin/bison
10738: cd /usr/pkg/share; rm -f bison.simple bison.hairy
10739: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
10740: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
10741: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
10742: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
10743: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
10744: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
10745: ===> Registering installation for bison-1.25
10746: </pre>
10747:
10748: <p>You can now use bison, and also - if you decide so -
1.7 wiz 10749: remove it with <span><strong class="command">pkg_delete
10750: bison</strong></span>. Should you decide that you want a
10751: binary package, do this now:</p>
1.1 grant 10752: <pre class="screen">
1.7 wiz 10753: <code class="prompt">#</code> <strong class=
10754: "userinput"><code>make package</code></strong>
1.1 grant 10755: >> Checksum OK for bison-1.25.tar.gz.
10756: ===> Building package for bison-1.25
10757: Creating package bison-1.25.tgz
10758: Registering depends:.
10759: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
10760: </pre>
10761:
10762: <p>Now that you don't need the source and object files any
10763: more, clean up:</p>
10764: <pre class="screen">
1.7 wiz 10765: <code class="prompt">#</code> <strong class=
10766: "userinput"><code>make clean</code></strong>
1.1 grant 10767: ===> Cleaning for bison-1.25
10768: </pre>
10769: </div>
10770: </div>
10771:
10772: <div class="appendix" lang="en" xml:lang="en">
10773: <div class="titlepage">
10774: <div>
10775: <div>
10776: <h2 class="title"><a name="logs" id=
10777: "logs"></a>Appendix B. Build logs</h2>
10778: </div>
10779: </div>
10780: </div>
10781:
10782: <div class="toc">
10783: <p><b>Table of Contents</b></p>
10784:
10785: <dl>
10786: <dt><span class="sect1"><a href="#logs.building">B.1.
10787: Building figlet</a></span></dt>
10788:
10789: <dt><span class="sect1"><a href="#logs.package">B.2.
10790: Packaging figlet</a></span></dt>
10791: </dl>
10792: </div>
10793:
10794: <div class="sect1" lang="en" xml:lang="en">
10795: <div class="titlepage">
10796: <div>
10797: <div>
10798: <h2 class="title" style="clear: both"><a name=
10799: "logs.building" id=
10800: "logs.building"></a>B.1. Building figlet</h2>
10801: </div>
10802: </div>
10803: </div>
10804: <pre class="screen">
1.7 wiz 10805: <code class="prompt">#</code> <strong class=
10806: "userinput"><code>make</code></strong>
1.1 grant 10807: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10808: => figlet221.tar.gz doesn't seem to exist on this system.
10809: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
10810: => [172219 bytes]
10811: Connected to ftp.plig.net.
10812: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
10813: 331 Guest login ok, send your complete e-mail address as password.
10814: 230-You are user #5 of 500 simultaneous users allowed.
10815: 230-
10816: 230- ___ _ _ _
10817: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
10818: 230- | _| _| . |_| . | | | . |_| . | _| . |
10819: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
10820: 230- |_| |_| |___| |___|
10821: 230-
10822: 230-** Welcome to ftp.plig.org **
10823: 230-
10824: 230-Please note that all transfers from this FTP site are logged. If you
10825: 230-do not like this, please disconnect now.
10826: 230-
10827: 230-This arhive is available via
10828: 230-
10829: 230-HTTP: http://ftp.plig.org/
10830: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
10831: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
10832: 230-
10833: 230-Please email comments, bug reports and requests for packages to be
10834: 230-mirrored to ftp-admin@plig.org.
10835: 230-
10836: 230-
10837: 230 Logged in anonymously.
10838: Remote system type is UNIX.
10839: Using binary mode to transfer files.
10840: 200 Type okay.
10841: 250 "/pub" is new cwd.
10842: 250-"/pub/figlet" is new cwd.
10843: 250-
10844: 250-Welcome to the figlet archive at ftp.figlet.org
10845: 250-
10846: 250- ftp://ftp.figlet.org/pub/figlet/
10847: 250-
10848: 250-The official FIGlet web page is:
10849: 250- http://www.figlet.org/
10850: 250-
10851: 250-If you have questions, please mailto:info@figlet.org. If you want to
10852: 250-contribute a font or something else, you can email us.
10853: 250
10854: 250 "/pub/figlet/program" is new cwd.
10855: 250 "/pub/figlet/program/unix" is new cwd.
10856: local: figlet221.tar.gz remote: figlet221.tar.gz
10857: 502 Unimplemented command.
10858: 227 Entering Passive Mode (195,40,6,41,246,104)
10859: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
10860: 38% |************** | 65800 64.16 KB/s 00:01 ETA
10861: 226 Transfer completed.
10862: 172219 bytes received in 00:02 (75.99 KB/s)
10863: 221 Goodbye.
10864: => Checksum OK for figlet221.tar.gz.
10865: ===> Extracting for figlet-2.2.1nb2
10866: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
10867: ===> Patching for figlet-2.2.1nb2
10868: ===> Applying pkgsrc patches for figlet-2.2.1nb2
10869: ===> Overriding tools for figlet-2.2.1nb2
10870: ===> Creating toolchain wrappers for figlet-2.2.1nb2
10871: ===> Configuring for figlet-2.2.1nb2
10872: ===> Building for figlet-2.2.1nb2
10873: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
10874: chmod a+x figlet
10875: gcc -O2 -o chkfont chkfont.c
10876: => Unwrapping files-to-be-installed.
1.7 wiz 10877: <code class="prompt">#</code>
10878: <code class="prompt">#</code> <strong class=
10879: "userinput"><code>make install</code></strong>
1.1 grant 10880: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10881: ===> Installing for figlet-2.2.1nb2
10882: install -d -o root -g wheel -m 755 /usr/pkg/bin
10883: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
10884: mkdir -p /usr/pkg/share/figlet
10885: cp figlet /usr/pkg/bin
10886: cp chkfont /usr/pkg/bin
10887: chmod 555 figlist showfigfonts
10888: cp figlist /usr/pkg/bin
10889: cp showfigfonts /usr/pkg/bin
10890: cp fonts/*.flf /usr/pkg/share/figlet
10891: cp fonts/*.flc /usr/pkg/share/figlet
10892: cp figlet.6 /usr/pkg/man/man6
10893: ===> Registering installation for figlet-2.2.1nb2
1.7 wiz 10894: <code class="prompt">#</code>
1.1 grant 10895: </pre>
10896: </div>
10897:
10898: <div class="sect1" lang="en" xml:lang="en">
10899: <div class="titlepage">
10900: <div>
10901: <div>
10902: <h2 class="title" style="clear: both"><a name=
10903: "logs.package" id=
10904: "logs.package"></a>B.2. Packaging figlet</h2>
10905: </div>
10906: </div>
10907: </div>
10908: <pre class="screen">
1.7 wiz 10909: <code class="prompt">#</code> <strong class=
10910: "userinput"><code>make package</code></strong>
1.1 grant 10911: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10912: ===> Packaging figlet-2.2.1nb2
10913: ===> Building binary package for figlet-2.2.1nb2
10914: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
10915: Using SrcDir value of /usr/pkg
10916: Registering depends:.
1.7 wiz 10917: <code class="prompt">#</code>
1.1 grant 10918: </pre>
10919: </div>
10920: </div>
10921:
10922: <div class="appendix" lang="en" xml:lang="en">
10923: <div class="titlepage">
10924: <div>
10925: <div>
10926: <h2 class="title"><a name="ftp-layout" id=
10927: "ftp-layout"></a>Appendix C. Layout of the
10928: FTP server's package archive</h2>
10929: </div>
10930: </div>
10931: </div>
10932:
10933: <p>Layout for precompiled binary packages on
10934: ftp.NetBSD.org:</p>
10935: <pre class="programlisting">
10936: /pub/NetBSD/packages/
10937: distfiles/
10938:
10939: # Unpacked pkgsrc trees
10940: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
10941: pkgsrc-2003Q4 -> N/A
10942: pkgsrc-2004Q1/pkgsrc
10943:
10944: # pkgsrc archives
10945: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
10946: pkgsrc-2003Q4.tar.gz -> N/A
10947: pkgsrc-2004Q1.tar.gz -> N/A
10948:
10949: # Per pkgsrc-release/OS-release/arch package archives
10950: pkgsrc-2003Q4/
10951: NetBSD-1.6.2/
10952: i386/
10953: All/
10954: archivers/
10955: foo -> ../All/foo
10956: ...
10957: pkgsrc-2004Q1/
10958: NetBSD-1.6.2/
10959: i386/
10960: All/
10961: ...
10962: NetBSD-2.0/
10963: i386/
10964: All/
10965: ...
10966: SunOS-5.9/
10967: sparc/
10968: All/
10969: ...
10970: x86/
10971: All/
10972: ...
10973:
10974: # Per os-release package archive convenience links
10975: NetBSD-1.6.2 -> 1.6.2
10976: 1.6.2/
10977: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
10978: m68k/
10979: All/
10980: archivers/
10981: foo -> ../All/foo
10982: ...
10983: amiga -> m68k
10984: atari -> m68k
10985: ...
10986:
10987: 2.0 -> NetBSD-2.0 # backward compat, historic
10988: NetBSD-2.0/
10989: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
10990: SunOS-5.9/
10991: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
10992: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
10993:
10994: </pre>
10995:
10996: <p>To create:</p>
10997:
10998: <div class="orderedlist">
10999: <ol type="1">
11000: <li>
11001: <p>Run bulk build, see <a href="#bulkbuild" title=
11002: "5.3. Doing a bulk build of all packages">Section
11003: 5.3, “Doing a bulk build of all
11004: packages”</a></p>
11005: </li>
11006:
11007: <li>
11008: <p>Upload /usr/pkgsrc/packages to</p>
11009: <pre class="programlisting">
11010: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
11011: pkgsrc-2004Q3/\ # pkgsrc-branch
11012: `uname -s`-`uname -r`/ # OS & version
11013: `uname -p` # architecture
11014:
11015: </pre>
11016: </li>
11017:
11018: <li>
1.7 wiz 11019: <p>If necessary, create a symlink <span><strong class=
11020: "command">ln -s `uname -m` `uname -p`</strong></span>
11021: (amiga -> m68k, ...)</p>
1.1 grant 11022: </li>
11023: </ol>
11024: </div>
11025: </div>
1.2 hubertf 11026:
11027: <div class="appendix" lang="en" xml:lang="en">
11028: <div class="titlepage">
11029: <div>
11030: <div>
11031: <h2 class="title"><a name="editing" id=
11032: "editing"></a>Appendix D. Editing guidelines
11033: for the pkgsrc guide</h2>
11034: </div>
11035: </div>
11036: </div>
11037:
11038: <div class="toc">
11039: <p><b>Table of Contents</b></p>
11040:
11041: <dl>
1.12 ! agc 11042: <dt><span class="sect1"><a href="#id2595758">D.1.
1.2 hubertf 11043: Targets</a></span></dt>
11044:
1.12 ! agc 11045: <dt><span class="sect1"><a href="#id2595829">D.2.
1.2 hubertf 11046: Procedure</a></span></dt>
11047: </dl>
11048: </div>
11049:
11050: <p>This section contains information on editing the pkgsrc
11051: guide itself.</p>
11052:
11053: <div class="sect1" lang="en" xml:lang="en">
11054: <div class="titlepage">
11055: <div>
11056: <div>
11057: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 11058: "id2595758" id="id2595758"></a>D.1. Targets</h2>
1.2 hubertf 11059: </div>
11060: </div>
11061: </div>
11062:
1.7 wiz 11063: <p>The pkgsrc guide's source code is stored in <code class=
11064: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 11065: are created from it:</p>
11066:
11067: <div class="itemizedlist">
11068: <ul type="disc">
11069: <li>
1.7 wiz 11070: <p><code class=
11071: "filename">pkgsrc/doc/pkgsrc.txt</code>, which
11072: replaces <code class=
11073: "filename">pkgsrc/Packages.txt</code></p>
1.2 hubertf 11074: </li>
11075:
11076: <li>
1.7 wiz 11077: <p><code class=
11078: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 11079: </li>
11080:
11081: <li>
1.7 wiz 11082: <p><code class=
11083: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 11084: the documentation on the NetBSD website will be built
11085: from pkgsrc and kept up to date on the web server
11086: itself. This means you <span class=
11087: "emphasis"><em>must</em></span> make sure that your
11088: changes haven't broken the build!</p>
11089: </li>
1.6 hubertf 11090:
11091: <li>
1.7 wiz 11092: <p><code class=
11093: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 11094: PDF version of the pkgsrc guide.</p>
11095: </li>
11096:
11097: <li>
1.7 wiz 11098: <p><code class=
11099: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 11100: PostScript version of the pkgsrc guide.</p>
11101: </li>
1.2 hubertf 11102: </ul>
11103: </div>
11104: </div>
11105:
11106: <div class="sect1" lang="en" xml:lang="en">
11107: <div class="titlepage">
11108: <div>
11109: <div>
11110: <h2 class="title" style="clear: both"><a name=
1.12 ! agc 11111: "id2595829" id=
! 11112: "id2595829"></a>D.2. Procedure</h2>
1.2 hubertf 11113: </div>
11114: </div>
11115: </div>
11116:
11117: <p>The procedure to edit the pkgsrc guide is:</p>
11118:
11119: <div class="itemizedlist">
11120: <ul type="disc">
11121: <li>
1.6 hubertf 11122: <p>Make sure you have the packages needed to
11123: re-generate the pkgsrc guide (and other XML-based
11124: NetBSD documentation) installed. These are
1.11 ben 11125: “<span class="quote">netbsd-doc</span>”
1.6 hubertf 11126: for creating the ASCII- and HTML-version, and
11127: “<span class=
1.11 ben 11128: "quote">netbsd-doc-print</span>”for the
1.6 hubertf 11129: PostScript- and PDF version. You will need both
11130: packages installed, to make sure documentation is
11131: consistent across all formats. The packages can be
1.7 wiz 11132: found in <code class=
11133: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
11134: <code class=
11135: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 11136: </li>
11137:
11138: <li>
1.7 wiz 11139: <p>Edit the XML file(s) in <code class=
11140: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 11141: </li>
11142:
11143: <li>
1.7 wiz 11144: <p>Run <span><strong class="command">make extract
11145: && make do-lint</strong></span> in
11146: <code class="filename">pkgsrc/doc/guide</code> to
11147: check the XML syntax, and fix it if needed.</p>
1.4 hubertf 11148: </li>
11149:
11150: <li>
1.7 wiz 11151: <p>Run <span><strong class=
11152: "command">make</strong></span> in <code class=
11153: "filename">pkgsrc/doc/guide</code> to build the HTML
11154: and ASCII version.</p>
1.2 hubertf 11155: </li>
11156:
11157: <li>
1.7 wiz 11158: <p>If all is well, run <span><strong class=
11159: "command">make install-doc</strong></span> to put the
11160: generated files into <code class=
11161: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 11162: </li>
11163:
11164: <li>
1.7 wiz 11165: <p><span><strong class="command">cvs commit
11166: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 11167: </li>
11168:
11169: <li>
1.7 wiz 11170: <p><span><strong class="command">cvs commit -m
11171: re-generate
11172: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 11173: </li>
1.4 hubertf 11174:
11175: <li>
11176: <p>Until the webserver on www.NetBSD.org is really
11177: updated automatically to pick up changes to the
1.7 wiz 11178: pkgsrc guide automatically, also run
11179: <span><strong class="command">make install-htdoc
11180: HTDOCSDIR=../../../htdocs</strong></span> (or
11181: similar, adjust <code class=
11182: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 11183: </li>
11184:
11185: <li>
1.7 wiz 11186: <p><span><strong class="command">cvs commit
11187: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 11188: </li>
1.2 hubertf 11189: </ul>
11190: </div>
11191: </div>
11192: </div>
1.1 grant 11193: </div>
11194: </body>
11195: </html>
CVSweb <webmaster@jp.NetBSD.org>