Annotation of pkgsrc/doc/pkgsrc.html, revision 1.5
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.2 hubertf 4: "HTML Tidy for NetBSD (vers 1st October 2003), 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=
11: "DocBook XSL Stylesheets V1.65.0" />
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.2 hubertf 22: <h1 class="title"><a name="id2526935" id=
23: "id2526935"></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">
40: <p><tt class="email"><<a href=
41: "mailto:agc@NetBSD.org">agc@NetBSD.org</a>></tt></p>
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">
53: <p><tt class="email"><<a href=
54: "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>></tt></p>
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.2 hubertf 96: <dt><span class="sect1"><a href="#id2494406">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.3 hubertf 120: <dt><span class="sect1"><a href="#id2495052">2.1.
1.1 grant 121: As tar file</a></span></dt>
122:
1.3 hubertf 123: <dt><span class="sect1"><a href="#id2495069">2.2.
1.1 grant 124: Via SUP</a></span></dt>
125:
1.3 hubertf 126: <dt><span class="sect1"><a href="#id2495101">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.3 hubertf 136: <dt><span class="sect1"><a href="#id2495211">3.1.
1.1 grant 137: Bootstrapping pkgsrc</a></span></dt>
138:
1.3 hubertf 139: <dt><span class="sect1"><a href="#id2495318">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.3 hubertf 145: "#id2495324">3.2.1. Darwin (Mac OS
1.1 grant 146: X)</a></span></dt>
147:
148: <dt><span class="sect2"><a href=
1.3 hubertf 149: "#id2495623">3.2.2. FreeBSD</a></span></dt>
1.1 grant 150:
151: <dt><span class="sect2"><a href=
1.3 hubertf 152: "#id2496272">3.2.3. Interix</a></span></dt>
1.1 grant 153:
154: <dt><span class="sect2"><a href=
1.3 hubertf 155: "#id2496362">3.2.4. IRIX</a></span></dt>
1.1 grant 156:
157: <dt><span class="sect2"><a href=
1.3 hubertf 158: "#id2496480">3.2.5. OpenBSD</a></span></dt>
1.1 grant 159:
160: <dt><span class="sect2"><a href=
1.3 hubertf 161: "#id2496660">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.3 hubertf 179: "#id2496865">4.1.1. Where to get binary
1.1 grant 180: packages</a></span></dt>
181:
182: <dt><span class="sect2"><a href=
1.3 hubertf 183: "#id2496905">4.1.2. How to use binary
1.1 grant 184: packages</a></span></dt>
185:
186: <dt><span class="sect2"><a href=
1.3 hubertf 187: "#id2497040">4.1.3. A word of
1.1 grant 188: warning</a></span></dt>
189: </dl>
190: </dd>
191:
1.3 hubertf 192: <dt><span class="sect1"><a href="#id2497051">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.3 hubertf 198: "#id2497129">4.2.1.
1.1 grant 199: Requirements</a></span></dt>
200:
201: <dt><span class="sect2"><a href=
1.3 hubertf 202: "#id2497149">4.2.2. Fetching
1.1 grant 203: distfiles</a></span></dt>
204:
205: <dt><span class="sect2"><a href=
1.3 hubertf 206: "#id2497202">4.2.3. How to build and
1.1 grant 207: install</a></span></dt>
208:
209: <dt><span class="sect2"><a href=
1.3 hubertf 210: "#id2498133">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.3 hubertf 222: <dt><span class="sect1"><a href="#id2563004">5.1.
1.1 grant 223: Building a single binary package</a></span></dt>
224:
1.3 hubertf 225: <dt><span class="sect1"><a href="#id2563082">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.3 hubertf 239: "#id2563222">5.3.2. Other environmental
1.1 grant 240: considerations</a></span></dt>
241:
242: <dt><span class="sect2"><a href=
1.3 hubertf 243: "#id2563262">5.3.3. Operation</a></span></dt>
1.1 grant 244:
245: <dt><span class="sect2"><a href=
1.3 hubertf 246: "#id2563469">5.3.4. What it
1.1 grant 247: does</a></span></dt>
248:
249: <dt><span class="sect2"><a href=
1.3 hubertf 250: "#id2563526">5.3.5. Disk space
1.1 grant 251: requirements</a></span></dt>
252:
253: <dt><span class="sect2"><a href=
1.3 hubertf 254: "#id2563553">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.3 hubertf 258: "#id2563916">5.3.7. Building a partial set of
1.1 grant 259: packages</a></span></dt>
260: </dl>
261: </dd>
262:
1.3 hubertf 263: <dt><span class="sect1"><a href="#id2564027">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.3 hubertf 270: "#id2564042">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.3 hubertf 282: <dt><span class="sect1"><a href="#id2564301">6.1.
1.1 grant 283: Is there a mailing list for pkg-related
284: discussion?</a></span></dt>
285:
1.3 hubertf 286: <dt><span class="sect1"><a href="#id2564331">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.5 ! hubertf 293: <dt><span class="sect1"><a href="#id2564584">6.4.
1.1 grant 294: How to use pkgsrc as non-root</a></span></dt>
295:
1.5 ! hubertf 296: <dt><span class="sect1"><a href="#id2564596">6.5.
1.1 grant 297: How can I install/use XFree86 from
298: pkgsrc?</a></span></dt>
299:
1.5 ! hubertf 300: <dt><span class="sect1"><a href="#id2564624">6.6.
1.1 grant 301: How can I install/use X.org from
302: pkgsrc?</a></span></dt>
303:
1.5 ! hubertf 304: <dt><span class="sect1"><a href="#id2564651">6.7.
1.1 grant 305: How to fetch files from behind a
306: firewall</a></span></dt>
307:
1.5 ! hubertf 308: <dt><span class="sect1"><a href="#id2564665">6.8.
1.1 grant 309: How do I tell make fetch to do passive
310: FTP?</a></span></dt>
311:
1.5 ! hubertf 312: <dt><span class="sect1"><a href="#id2564785">6.9.
1.1 grant 313: How to fetch all distfiles at once</a></span></dt>
314:
1.5 ! hubertf 315: <dt><span class="sect1"><a href="#id2564993">6.10.
1.1 grant 316: What does Don't know how to make
317: /usr/share/tmac/tmac.andoc mean?</a></span></dt>
318:
1.5 ! hubertf 319: <dt><span class="sect1"><a href="#id2565031">6.11.
1.1 grant 320: What does Could not find bsd.own.mk
321: mean?</a></span></dt>
322:
1.5 ! hubertf 323: <dt><span class="sect1"><a href="#id2565089">6.12.
1.1 grant 324: Using 'sudo' with pkgsrc</a></span></dt>
325:
326: <dt><span class="sect1"><a href="#faq.conf">6.13.
327: Configuration files handling and
328: placement</a></span></dt>
329:
330: <dt><span class="sect1"><a href=
331: "#audit-packages">6.14. Automated security
332: checks</a></span></dt>
333: </dl>
334: </dd>
335: </dl>
336: </dd>
337:
1.2 hubertf 338: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 339: pkgsrc developer's guide</a></span></dt>
340:
341: <dd>
342: <dl>
343: <dt><span class="chapter"><a href="#components">7.
344: Package components - files, directories and
345: contents</a></span></dt>
346:
347: <dd>
348: <dl>
349: <dt><span class="sect1"><a href=
350: "#components.Makefile">7.1.
351: Makefile</a></span></dt>
352:
353: <dt><span class="sect1"><a href=
354: "#components.distinfo">7.2.
355: distinfo</a></span></dt>
356:
357: <dt><span class="sect1"><a href=
358: "#components.patches">7.3.
359: patches/*</a></span></dt>
360:
1.5 ! hubertf 361: <dt><span class="sect1"><a href="#id2566134">7.4.
1.1 grant 362: Other mandatory files</a></span></dt>
363:
364: <dt><span class="sect1"><a href=
365: "#components.optional">7.5. Optional
366: files</a></span></dt>
367:
1.5 ! hubertf 368: <dt><span class="sect1"><a href="#id2566396">7.6.
1.1 grant 369: work*</a></span></dt>
370:
1.5 ! hubertf 371: <dt><span class="sect1"><a href="#id2566484">7.7.
1.1 grant 372: files/*</a></span></dt>
373: </dl>
374: </dd>
375:
376: <dt><span class="chapter"><a href="#plist">8. PLIST
377: issues</a></span></dt>
378:
379: <dd>
380: <dl>
1.5 ! hubertf 381: <dt><span class="sect1"><a href="#id2566538">8.1.
1.1 grant 382: RCS ID</a></span></dt>
383:
1.5 ! hubertf 384: <dt><span class="sect1"><a href="#id2566621">8.2.
1.1 grant 385: Semi-automatic PLIST generation</a></span></dt>
386:
387: <dt><span class="sect1"><a href="#print-PLIST">8.3.
388: Tweaking output of make print-PLIST</a></span></dt>
389:
390: <dt><span class="sect1"><a href="#plist.misc">8.4.
391: Variable substitution in PLIST</a></span></dt>
392:
1.5 ! hubertf 393: <dt><span class="sect1"><a href="#id2566874">8.5.
1.1 grant 394: Manpage-compression</a></span></dt>
395:
1.5 ! hubertf 396: <dt><span class="sect1"><a href="#id2566916">8.6.
1.1 grant 397: Changing PLIST source with
398: PLIST_SRC</a></span></dt>
399:
1.5 ! hubertf 400: <dt><span class="sect1"><a href="#id2566933">8.7.
1.1 grant 401: Platform specific and differing
402: PLISTs</a></span></dt>
403:
404: <dt><span class="sect1"><a href=
405: "#faq.common-dirs">8.8. Sharing directories between
406: packages</a></span></dt>
407: </dl>
408: </dd>
409:
410: <dt><span class="chapter"><a href="#buildlink">9.
411: Buildlink methodology</a></span></dt>
412:
413: <dd>
414: <dl>
1.5 ! hubertf 415: <dt><span class="sect1"><a href="#id2567137">9.1.
1.1 grant 416: Converting packages to use
417: buildlink3</a></span></dt>
418:
1.5 ! hubertf 419: <dt><span class="sect1"><a href="#id2567532">9.2.
1.1 grant 420: Writing buildlink3.mk files</a></span></dt>
421:
422: <dd>
423: <dl>
424: <dt><span class="sect2"><a href=
1.5 ! hubertf 425: "#id2567670">9.2.1. Anatomy of a buildlink3.mk
1.1 grant 426: file</a></span></dt>
427:
428: <dt><span class="sect2"><a href=
1.5 ! hubertf 429: "#id2568110">9.2.2. Updating
1.1 grant 430: BUILDLINK_DEPENDS.pkg in buildlink3.mk
431: files</a></span></dt>
432: </dl>
433: </dd>
434:
1.5 ! hubertf 435: <dt><span class="sect1"><a href="#id2568189">9.3.
1.1 grant 436: Writing builtin.mk files</a></span></dt>
437:
438: <dd>
439: <dl>
440: <dt><span class="sect2"><a href=
1.5 ! hubertf 441: "#id2568270">9.3.1. Anatomy of a builtin.mk
1.1 grant 442: file</a></span></dt>
443:
444: <dt><span class="sect2"><a href=
1.5 ! hubertf 445: "#id2568566">9.3.2. Global preferences for
1.1 grant 446: native or pkgsrc software</a></span></dt>
447: </dl>
448: </dd>
449: </dl>
450: </dd>
451:
452: <dt><span class="chapter"><a href="#options">10.
453: Options handling</a></span></dt>
454:
455: <dd>
456: <dl>
1.5 ! hubertf 457: <dt><span class="sect1"><a href="#id2568638">10.1.
1.1 grant 458: Global default options</a></span></dt>
459:
1.5 ! hubertf 460: <dt><span class="sect1"><a href="#id2568653">10.2.
1.1 grant 461: Converting packages to use
462: bsd.options.mk</a></span></dt>
463: </dl>
464: </dd>
465:
466: <dt><span class="chapter"><a href="#build">11. The
467: build process</a></span></dt>
468:
469: <dd>
470: <dl>
471: <dt><span class="sect1"><a href=
472: "#build.prefix">11.1. Program
473: location</a></span></dt>
474:
1.5 ! hubertf 475: <dt><span class="sect1"><a href="#id2569330">11.2.
1.1 grant 476: Main targets</a></span></dt>
477:
478: <dt><span class="sect1"><a href=
479: "#build.helpful-targets">11.3. Other helpful
480: targets</a></span></dt>
481: </dl>
482: </dd>
483:
484: <dt><span class="chapter"><a href="#fixes">12. Notes on
485: fixes for packages</a></span></dt>
486:
487: <dd>
488: <dl>
1.5 ! hubertf 489: <dt><span class="sect1"><a href="#id2570795">12.1.
1.1 grant 490: General operation</a></span></dt>
491:
492: <dd>
493: <dl>
494: <dt><span class="sect2"><a href=
1.5 ! hubertf 495: "#id2570798">12.1.1. How to pull in variables
1.1 grant 496: from /etc/mk.conf</a></span></dt>
497:
498: <dt><span class="sect2"><a href=
1.5 ! hubertf 499: "#id2570882">12.1.2. Restricted
1.1 grant 500: packages</a></span></dt>
501:
502: <dt><span class="sect2"><a href=
503: "#dependencies">12.1.3. Handling
504: dependencies</a></span></dt>
505:
506: <dt><span class="sect2"><a href=
1.5 ! hubertf 507: "#id2571260">12.1.4. Handling conflicts with
1.1 grant 508: other packages</a></span></dt>
509:
510: <dt><span class="sect2"><a href=
1.5 ! hubertf 511: "#id2571447">12.1.5. Packages that cannot or
1.1 grant 512: should not be built</a></span></dt>
513:
514: <dt><span class="sect2"><a href=
1.5 ! hubertf 515: "#id2571473">12.1.6. Packages which should not
1.1 grant 516: be deleted, once installed</a></span></dt>
517:
518: <dt><span class="sect2"><a href=
519: "#security-handling">12.1.7. Handling packages
520: with security problems</a></span></dt>
521:
522: <dt><span class="sect2"><a href=
1.5 ! hubertf 523: "#id2571564">12.1.8. How to handle compiler
1.1 grant 524: bugs</a></span></dt>
525:
526: <dt><span class="sect2"><a href=
1.5 ! hubertf 527: "#id2571587">12.1.9. How to handle incrementing
1.1 grant 528: versions when fixing an existing
529: package</a></span></dt>
530:
531: <dt><span class="sect2"><a href=
1.5 ! hubertf 532: "#id2571704">12.1.10. Portability of
1.1 grant 533: packages</a></span></dt>
534: </dl>
535: </dd>
536:
1.5 ! hubertf 537: <dt><span class="sect1"><a href="#id2571729">12.2.
1.1 grant 538: Possible downloading issues</a></span></dt>
539:
540: <dd>
541: <dl>
542: <dt><span class="sect2"><a href=
1.5 ! hubertf 543: "#id2571732">12.2.1. Packages whose distfiles
1.1 grant 544: aren't available for plain
545: downloading</a></span></dt>
546:
547: <dt><span class="sect2"><a href=
1.5 ! hubertf 548: "#id2571795">12.2.2. How to handle modified
1.1 grant 549: distfiles with the 'old' name</a></span></dt>
550: </dl>
551: </dd>
552:
1.5 ! hubertf 553: <dt><span class="sect1"><a href="#id2571806">12.3.
1.1 grant 554: Configuration gotchas</a></span></dt>
555:
556: <dd>
557: <dl>
558: <dt><span class="sect2"><a href=
559: "#fixes.libtool">12.3.1. Shared libraries -
560: libtool</a></span></dt>
561:
562: <dt><span class="sect2"><a href=
1.5 ! hubertf 563: "#id2572350">12.3.2. Using libtool on GNU
1.1 grant 564: packages that already support
565: libtool</a></span></dt>
566:
567: <dt><span class="sect2"><a href=
1.5 ! hubertf 568: "#id2572435">12.3.3. GNU
1.1 grant 569: Autoconf/Automake</a></span></dt>
570: </dl>
571: </dd>
572:
1.5 ! hubertf 573: <dt><span class="sect1"><a href="#id2572480">12.4.
1.1 grant 574: Building considerations</a></span></dt>
575:
576: <dd>
577: <dl>
578: <dt><span class="sect2"><a href=
1.5 ! hubertf 579: "#id2572483">12.4.1. CPP
1.1 grant 580: defines</a></span></dt>
581: </dl>
582: </dd>
583:
1.5 ! hubertf 584: <dt><span class="sect1"><a href="#id2572513">12.5.
1.1 grant 585: Package specific actions</a></span></dt>
586:
587: <dd>
588: <dl>
589: <dt><span class="sect2"><a href=
1.5 ! hubertf 590: "#id2572516">12.5.1. Package configuration
1.1 grant 591: files</a></span></dt>
592:
593: <dt><span class="sect2"><a href=
1.5 ! hubertf 594: "#id2572618">12.5.2. User
1.2 hubertf 595: interaction</a></span></dt>
1.1 grant 596:
597: <dt><span class="sect2"><a href=
1.5 ! hubertf 598: "#id2572663">12.5.3. Handling
1.1 grant 599: licenses</a></span></dt>
600:
601: <dt><span class="sect2"><a href=
1.5 ! hubertf 602: "#id2572746">12.5.4. Creating an account from a
1.1 grant 603: package</a></span></dt>
604:
605: <dt><span class="sect2"><a href=
1.5 ! hubertf 606: "#id2572876">12.5.5. Installing score
1.1 grant 607: files</a></span></dt>
608:
609: <dt><span class="sect2"><a href=
1.5 ! hubertf 610: "#id2573057">12.5.6. Packages providing login
1.1 grant 611: shells</a></span></dt>
612:
613: <dt><span class="sect2"><a href=
1.5 ! hubertf 614: "#id2573182">12.5.7. Packages containing perl
1.1 grant 615: scripts</a></span></dt>
616:
617: <dt><span class="sect2"><a href=
1.5 ! hubertf 618: "#id2573201">12.5.8. Packages with hardcoded
1.1 grant 619: paths to other interpreters</a></span></dt>
620:
621: <dt><span class="sect2"><a href=
1.5 ! hubertf 622: "#id2573222">12.5.9. Packages installing perl
1.1 grant 623: modules</a></span></dt>
624:
625: <dt><span class="sect2"><a href=
626: "#faq.info-files">12.5.10. Packages installing
627: info files</a></span></dt>
628:
629: <dt><span class="sect2"><a href=
1.5 ! hubertf 630: "#id2573442">12.5.11. Packages installing
1.1 grant 631: GConf2 data files</a></span></dt>
632:
633: <dt><span class="sect2"><a href=
1.5 ! hubertf 634: "#id2573610">12.5.12. Packages installing
1.1 grant 635: scrollkeeper data files</a></span></dt>
636:
637: <dt><span class="sect2"><a href=
1.5 ! hubertf 638: "#id2573661">12.5.13. Packages installing X11
1.1 grant 639: fonts</a></span></dt>
640:
641: <dt><span class="sect2"><a href=
1.5 ! hubertf 642: "#id2573708">12.5.14. Packages installing GTK2
1.1 grant 643: modules</a></span></dt>
644:
645: <dt><span class="sect2"><a href=
1.5 ! hubertf 646: "#id2573778">12.5.15. Packages installing SGML
1.1 grant 647: or XML data</a></span></dt>
648:
649: <dt><span class="sect2"><a href=
1.5 ! hubertf 650: "#id2573830">12.5.16. Packages installing
1.1 grant 651: extensions to the MIME database</a></span></dt>
652:
653: <dt><span class="sect2"><a href=
1.5 ! hubertf 654: "#id2573969">12.5.17. Packages using
1.1 grant 655: intltool</a></span></dt>
656: </dl>
657: </dd>
658:
1.5 ! hubertf 659: <dt><span class="sect1"><a href="#id2573982">12.6.
1.1 grant 660: Feedback to the author</a></span></dt>
661: </dl>
662: </dd>
663:
664: <dt><span class="chapter"><a href="#debug">13.
665: Debugging</a></span></dt>
666:
667: <dt><span class="chapter"><a href="#submit">14.
668: Submitting and Committing</a></span></dt>
669:
670: <dd>
671: <dl>
1.5 ! hubertf 672: <dt><span class="sect1"><a href="#id2574444">14.1.
1.1 grant 673: Submitting your packages</a></span></dt>
674:
1.5 ! hubertf 675: <dt><span class="sect1"><a href="#id2574491">14.2.
1.1 grant 676: Committing: Importing a package into
677: CVS</a></span></dt>
678:
1.5 ! hubertf 679: <dt><span class="sect1"><a href="#id2574691">14.3.
1.2 hubertf 680: Updating a package to a newer
681: version</a></span></dt>
1.1 grant 682:
1.5 ! hubertf 683: <dt><span class="sect1"><a href="#id2574710">14.4.
1.2 hubertf 684: Moving a package in pkgsrc</a></span></dt>
1.1 grant 685: </dl>
686: </dd>
687: </dl>
688: </dd>
689:
690: <dt><span class="appendix"><a href="#examples">A. A simple
691: example package: bison</a></span></dt>
692:
693: <dd>
694: <dl>
1.5 ! hubertf 695: <dt><span class="sect1"><a href="#id2575004">A.1.
1.1 grant 696: files</a></span></dt>
697:
698: <dd>
699: <dl>
1.5 ! hubertf 700: <dt><span class="sect2"><a href="#id2575008">A.1.1.
1.1 grant 701: Makefile</a></span></dt>
702:
1.5 ! hubertf 703: <dt><span class="sect2"><a href="#id2575015">A.1.2.
1.1 grant 704: DESCR</a></span></dt>
705:
1.5 ! hubertf 706: <dt><span class="sect2"><a href="#id2575030">A.1.3.
1.1 grant 707: PLIST</a></span></dt>
708:
1.5 ! hubertf 709: <dt><span class="sect2"><a href="#id2575037">A.1.4.
1.1 grant 710: Checking a package with pkglint</a></span></dt>
711: </dl>
712: </dd>
713:
1.5 ! hubertf 714: <dt><span class="sect1"><a href="#id2575078">A.2. Steps
1.1 grant 715: for building, installing, packaging</a></span></dt>
716: </dl>
717: </dd>
718:
719: <dt><span class="appendix"><a href="#logs">B. Build
720: logs</a></span></dt>
721:
722: <dd>
723: <dl>
724: <dt><span class="sect1"><a href="#logs.building">B.1.
725: Building figlet</a></span></dt>
726:
727: <dt><span class="sect1"><a href="#logs.package">B.2.
728: Packaging figlet</a></span></dt>
729: </dl>
730: </dd>
731:
732: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
733: of the FTP server's package archive</a></span></dt>
1.2 hubertf 734:
735: <dt><span class="appendix"><a href="#editing">D. Editing
736: guidelines for the pkgsrc guide</a></span></dt>
737:
738: <dd>
739: <dl>
1.5 ! hubertf 740: <dt><span class="sect1"><a href="#id2575861">D.1.
1.2 hubertf 741: Targets</a></span></dt>
742:
1.5 ! hubertf 743: <dt><span class="sect1"><a href="#id2576046">D.2.
1.2 hubertf 744: Procedure</a></span></dt>
745: </dl>
746: </dd>
1.1 grant 747: </dl>
748: </div>
749:
750: <div class="chapter" lang="en" xml:lang="en">
751: <div class="titlepage">
752: <div>
753: <div>
754: <h2 class="title"><a name="introduction" id=
755: "introduction"></a>Chapter 1. Introduction</h2>
756: </div>
757: </div>
758: </div>
759:
760: <div class="toc">
761: <p><b>Table of Contents</b></p>
762:
763: <dl>
1.2 hubertf 764: <dt><span class="sect1"><a href="#id2494406">1.1.
1.1 grant 765: Introduction</a></span></dt>
766:
767: <dt><span class="sect1"><a href="#overview">1.2.
768: Overview</a></span></dt>
769:
770: <dt><span class="sect1"><a href="#terminology">1.3.
771: Terminology</a></span></dt>
772:
773: <dt><span class="sect1"><a href="#typography">1.4.
774: Typography</a></span></dt>
775: </dl>
776: </div>
777:
778: <div class="sect1" lang="en" xml:lang="en">
779: <div class="titlepage">
780: <div>
781: <div>
782: <h2 class="title" style="clear: both"><a name=
1.2 hubertf 783: "id2494406" id=
784: "id2494406"></a>1.1. Introduction</h2>
1.1 grant 785: </div>
786: </div>
787: </div>
788:
789: <p>There is a lot of software freely available for Unix
790: based systems, which usually runs on NetBSD and other
791: Unix-flavoured systems, too, sometimes with some
792: modifications. The NetBSD Packages Collection (pkgsrc)
793: incorporates any such changes necessary to make that
794: software run, and makes the installation (and
795: de-installation) of the software package easy by means of a
796: single command.</p>
797:
798: <p>Once the software has been built, it is manipulated with
799: the <span><b class="command">pkg_*</b></span> tools so that
800: installation and de-installation, printing of an inventory
801: of all installed packages and retrieval of one-line
802: comments or more verbose descriptions are all simple.</p>
803:
804: <p>pkgsrc currently contains several thousand packages,
805: including:</p>
806:
807: <div class="itemizedlist">
808: <ul type="disc">
809: <li>
810: <p><a xmlns=
811: "http://www.w3.org/TR/xhtml1/transitional" href=
812: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.2 hubertf 813: class="pkgname">www/apache</a> - The Apache web
814: server</p>
1.1 grant 815: </li>
816:
817: <li>
818: <p><a xmlns=
819: "http://www.w3.org/TR/xhtml1/transitional" href=
820: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.2 hubertf 821: class="pkgname">www/mozilla</a> - The Mozilla web
822: browser</p>
1.1 grant 823: </li>
824:
825: <li>
826: <p><a xmlns=
827: "http://www.w3.org/TR/xhtml1/transitional" href=
828: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.2 hubertf 829: class="pkgname">meta-pkgs/gnome</a> - The GNOME
830: Desktop Environment</p>
1.1 grant 831: </li>
832:
833: <li>
834: <p><a xmlns=
835: "http://www.w3.org/TR/xhtml1/transitional" href=
836: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.2 hubertf 837: class="pkgname">meta-pkgs/kde3</a> - The K Desktop
838: Environment</p>
1.1 grant 839: </li>
840: </ul>
841: </div>
842:
843: <p>...just to name a few.</p>
844:
845: <p>pkgsrc has built-in support for handling varying
846: dependencies, such as pthreads and X11, and extended
847: features such as IPv6 support on a range of platforms.</p>
848:
849: <p>pkgsrc was derived from FreeBSD's ports system, and
850: initially developed for NetBSD only. Since then, pkgsrc has
851: grown a lot, and now supports the following platforms:</p>
852:
853: <div class="itemizedlist">
854: <ul type="disc">
855: <li>
856: <p><a href="http://developer.apple.com/darwin/"
857: target="_top">Darwin</a> (<a href=
858: "http://www.apple.com/macosx/" target="_top">Mac OS
859: X</a>)</p>
860: </li>
861:
862: <li>
1.3 hubertf 863: <p><a href="http://www.DragonFlyBSD.org/" target=
864: "_top">DragonFlyBSD</a></p>
865: </li>
866:
867: <li>
1.1 grant 868: <p><a href="http://www.FreeBSD.org/" target=
869: "_top">FreeBSD</a></p>
870: </li>
871:
872: <li>
1.3 hubertf 873: <p>Microsoft Windows, via <a href=
874: "http://www.microsoft.com/windows/sfu/" target=
875: "_top">Interix</a></p>
1.1 grant 876: </li>
877:
878: <li>
879: <p><a href="http://www.sgi.com/software/irix6.5/"
880: target="_top">IRIX</a></p>
881: </li>
882:
883: <li>
884: <p><a href="http://www.linux.org/" target=
885: "_top">Linux</a></p>
886: </li>
887:
888: <li>
889: <p><a href="http://www.NetBSD.org/" target=
890: "_top">NetBSD</a> (of course)</p>
891: </li>
892:
893: <li>
894: <p><a href="http://www.openbsd.org/" target=
895: "_top">OpenBSD</a></p>
896: </li>
897:
898: <li>
899: <p><a href="http://www.sun.com/solaris/" target=
900: "_top">Solaris</a></p>
901: </li>
902: </ul>
903: </div>
904: </div>
905:
906: <div class="sect1" lang="en" xml:lang="en">
907: <div class="titlepage">
908: <div>
909: <div>
910: <h2 class="title" style="clear: both"><a name=
911: "overview" id="overview"></a>1.2. Overview</h2>
912: </div>
913: </div>
914: </div>
915:
916: <p>This document is divided into two parts. The first,
917: <a href="#users-guide" title=
1.2 hubertf 918: "Part I. The pkgsrc user's guide">The pkgsrc
919: user's guide</a>, describes how one can use one of the
920: packages in the Package Collection, either by installing a
921: precompiled binary package, or by building one's own copy
922: using the NetBSD package system. The second part, <a href=
1.1 grant 923: "#developers-guide" title=
1.2 hubertf 924: "Part II. The pkgsrc developer's guide">The
925: pkgsrc developer's guide</a>, explains how to prepare a
926: package so it can be easily built by other NetBSD users
927: without knowing about the package's building details.</p>
1.1 grant 928:
929: <p>This document is available in various formats:</p>
930:
931: <div class="itemizedlist">
932: <ul type="disc">
933: <li>
934: <p><a href="index.html" target="_top">HTML</a></p>
935: </li>
936:
937: <li>
938: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
939: </li>
940:
941: <li>
942: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
943: </li>
944:
945: <li>
946: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
947: </li>
948: </ul>
949: </div>
950: </div>
951:
952: <div class="sect1" lang="en" xml:lang="en">
953: <div class="titlepage">
954: <div>
955: <div>
956: <h2 class="title" style="clear: both"><a name=
957: "terminology" id=
958: "terminology"></a>1.3. Terminology</h2>
959: </div>
960: </div>
961: </div>
962:
963: <p>There has been a lot of talk about “<span class=
964: "quote">ports</span>”, “<span class=
965: "quote">packages</span>”, etc. so far. Here is a
966: description of all the terminology used within this
967: document.</p>
968:
969: <div class="variablelist">
970: <dl>
971: <dt><span class="term">Package</span></dt>
972:
973: <dd>
974: <p>A set of files and building instructions that
975: describe what's necessary to build a certain piece of
976: software using pkgsrc. Packages are traditionally
977: stored under <tt class=
978: "filename">/usr/pkgsrc</tt>.</p>
979: </dd>
980:
981: <dt><span class="term">The NetBSD package
982: system</span></dt>
983:
984: <dd>
985: <p>This is the former name of “<span class=
986: "quote">pkgsrc</span>”. It is part of the
987: NetBSD operating system and can be bootstrap to run
988: on non-NetBSD operating systems as well. It handles
989: building (compiling), installing, and removing of
990: packages.</p>
991: </dd>
992:
993: <dt><span class="term">Distfile</span></dt>
994:
995: <dd>
996: <p>This term describes the file or files that are
997: provided by the author of the piece of software to
998: distribute his work. All the changes necessary to
999: build on NetBSD are reflected in the corresponding
1000: package. Usually the distfile is in the form of a
1001: compressed tar-archive, but other types are possible,
1002: too. Distfiles are usually stored below <tt class=
1003: "filename">/usr/pkgsrc/distfiles</tt>.</p>
1004: </dd>
1005:
1006: <dt><span class="term">Port</span></dt>
1007:
1008: <dd>
1009: <p>This is the term used by FreeBSD and OpenBSD
1010: people for what we call a package. In NetBSD
1011: terminology, “<span class=
1012: "quote">port</span>” refers to a different
1013: architecture.</p>
1014: </dd>
1015:
1016: <dt><span class="term">Precompiled/binary
1017: package</span></dt>
1018:
1019: <dd>
1020: <p>A set of binaries built with pkgsrc from a
1021: distfile and stuffed together in a single <tt class=
1022: "filename">.tgz</tt> file so it can be installed on
1023: machines of the same machine architecture without the
1024: need to recompile. Packages are usually generated in
1025: <tt class="filename">/usr/pkgsrc/packages</tt>; there
1026: is also an archive on <a href=
1027: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1028: "_top">ftp.NetBSD.org</a>.</p>
1029:
1030: <p>Sometimes, this is referred to by the term
1031: “<span class="quote">package</span>” too,
1032: especially in the context of precompiled
1033: packages.</p>
1034: </dd>
1035:
1036: <dt><span class="term">Program</span></dt>
1037:
1038: <dd>
1039: <p>The piece of software to be installed which will
1040: be constructed from all the files in the Distfile by
1041: the actions defined in the corresponding package.</p>
1042: </dd>
1043: </dl>
1044: </div>
1045: </div>
1046:
1047: <div class="sect1" lang="en" xml:lang="en">
1048: <div class="titlepage">
1049: <div>
1050: <div>
1051: <h2 class="title" style="clear: both"><a name=
1052: "typography" id=
1053: "typography"></a>1.4. Typography</h2>
1054: </div>
1055: </div>
1056: </div>
1057:
1058: <p>When giving examples for commands, shell prompts are
1059: used to show if the command should/can be issued as root,
1060: or if “<span class="quote">normal</span>” user
1061: privileges are sufficient. We use a <tt class=
1062: "prompt">#</tt> for root's shell prompt, and a <tt class=
1063: "prompt">$</tt> for users' shell prompt, assuming they use
1064: the C-shell or tcsh.</p>
1065: </div>
1066: </div>
1067:
1068: <div class="part" lang="en" xml:lang="en">
1069: <div class="titlepage">
1070: <div>
1071: <div>
1072: <h1 class="title"><a name="users-guide" id=
1.2 hubertf 1073: "users-guide"></a>The pkgsrc user's guide</h1>
1.1 grant 1074: </div>
1075: </div>
1076: </div>
1077:
1078: <div class="toc">
1079: <p><b>Table of Contents</b></p>
1080:
1081: <dl>
1082: <dt><span class="chapter"><a href="#getting">2. Where to
1083: get pkgsrc</a></span></dt>
1084:
1085: <dd>
1086: <dl>
1.3 hubertf 1087: <dt><span class="sect1"><a href="#id2495052">2.1. As
1.1 grant 1088: tar file</a></span></dt>
1089:
1.3 hubertf 1090: <dt><span class="sect1"><a href="#id2495069">2.2. Via
1.1 grant 1091: SUP</a></span></dt>
1092:
1.3 hubertf 1093: <dt><span class="sect1"><a href="#id2495101">2.3. Via
1.1 grant 1094: CVS</a></span></dt>
1095: </dl>
1096: </dd>
1097:
1098: <dt><span class="chapter"><a href="#platforms">3. Using
1099: pkgsrc on systems other than NetBSD</a></span></dt>
1100:
1101: <dd>
1102: <dl>
1.3 hubertf 1103: <dt><span class="sect1"><a href="#id2495211">3.1.
1.1 grant 1104: Bootstrapping pkgsrc</a></span></dt>
1105:
1.3 hubertf 1106: <dt><span class="sect1"><a href="#id2495318">3.2.
1.1 grant 1107: Platform specific notes</a></span></dt>
1108:
1109: <dd>
1110: <dl>
1111: <dt><span class="sect2"><a href=
1.3 hubertf 1112: "#id2495324">3.2.1. Darwin (Mac OS
1.1 grant 1113: X)</a></span></dt>
1114:
1115: <dt><span class="sect2"><a href=
1.3 hubertf 1116: "#id2495623">3.2.2. FreeBSD</a></span></dt>
1.1 grant 1117:
1118: <dt><span class="sect2"><a href=
1.3 hubertf 1119: "#id2496272">3.2.3. Interix</a></span></dt>
1.1 grant 1120:
1121: <dt><span class="sect2"><a href=
1.3 hubertf 1122: "#id2496362">3.2.4. IRIX</a></span></dt>
1.1 grant 1123:
1124: <dt><span class="sect2"><a href=
1.3 hubertf 1125: "#id2496480">3.2.5. OpenBSD</a></span></dt>
1.1 grant 1126:
1127: <dt><span class="sect2"><a href=
1.3 hubertf 1128: "#id2496660">3.2.6. Solaris</a></span></dt>
1.1 grant 1129: </dl>
1130: </dd>
1131: </dl>
1132: </dd>
1133:
1134: <dt><span class="chapter"><a href="#using">4. Using
1135: pkgsrc</a></span></dt>
1136:
1137: <dd>
1138: <dl>
1139: <dt><span class="sect1"><a href=
1140: "#getting-started">4.1. Working with binary
1141: packages</a></span></dt>
1142:
1143: <dd>
1144: <dl>
1145: <dt><span class="sect2"><a href=
1.3 hubertf 1146: "#id2496865">4.1.1. Where to get binary
1.1 grant 1147: packages</a></span></dt>
1148:
1149: <dt><span class="sect2"><a href=
1.3 hubertf 1150: "#id2496905">4.1.2. How to use binary
1.1 grant 1151: packages</a></span></dt>
1152:
1153: <dt><span class="sect2"><a href=
1.3 hubertf 1154: "#id2497040">4.1.3. A word of
1.1 grant 1155: warning</a></span></dt>
1156: </dl>
1157: </dd>
1158:
1.3 hubertf 1159: <dt><span class="sect1"><a href="#id2497051">4.2.
1.1 grant 1160: Building packages from source</a></span></dt>
1161:
1162: <dd>
1163: <dl>
1164: <dt><span class="sect2"><a href=
1.3 hubertf 1165: "#id2497129">4.2.1. Requirements</a></span></dt>
1.1 grant 1166:
1167: <dt><span class="sect2"><a href=
1.3 hubertf 1168: "#id2497149">4.2.2. Fetching
1.1 grant 1169: distfiles</a></span></dt>
1170:
1171: <dt><span class="sect2"><a href=
1.3 hubertf 1172: "#id2497202">4.2.3. How to build and
1.1 grant 1173: install</a></span></dt>
1174:
1175: <dt><span class="sect2"><a href=
1.3 hubertf 1176: "#id2498133">4.2.4. Selecting the
1.1 grant 1177: compiler</a></span></dt>
1178: </dl>
1179: </dd>
1180: </dl>
1181: </dd>
1182:
1183: <dt><span class="chapter"><a href="#binary">5. Creating
1184: binary packages</a></span></dt>
1185:
1186: <dd>
1187: <dl>
1.3 hubertf 1188: <dt><span class="sect1"><a href="#id2563004">5.1.
1.1 grant 1189: Building a single binary package</a></span></dt>
1190:
1.3 hubertf 1191: <dt><span class="sect1"><a href="#id2563082">5.2.
1.1 grant 1192: Settings for creation of binary
1193: packages</a></span></dt>
1194:
1195: <dt><span class="sect1"><a href="#bulkbuild">5.3.
1196: Doing a bulk build of all packages</a></span></dt>
1197:
1198: <dd>
1199: <dl>
1200: <dt><span class="sect2"><a href=
1201: "#binary.configuration">5.3.1.
1202: Configuration</a></span></dt>
1203:
1204: <dt><span class="sect2"><a href=
1.3 hubertf 1205: "#id2563222">5.3.2. Other environmental
1.1 grant 1206: considerations</a></span></dt>
1207:
1208: <dt><span class="sect2"><a href=
1.3 hubertf 1209: "#id2563262">5.3.3. Operation</a></span></dt>
1.1 grant 1210:
1211: <dt><span class="sect2"><a href=
1.3 hubertf 1212: "#id2563469">5.3.4. What it does</a></span></dt>
1.1 grant 1213:
1214: <dt><span class="sect2"><a href=
1.3 hubertf 1215: "#id2563526">5.3.5. Disk space
1.1 grant 1216: requirements</a></span></dt>
1217:
1218: <dt><span class="sect2"><a href=
1.3 hubertf 1219: "#id2563553">5.3.6. Setting up a sandbox for
1.1 grant 1220: chroot'ed builds</a></span></dt>
1221:
1222: <dt><span class="sect2"><a href=
1.3 hubertf 1223: "#id2563916">5.3.7. Building a partial set of
1.1 grant 1224: packages</a></span></dt>
1225: </dl>
1226: </dd>
1227:
1.3 hubertf 1228: <dt><span class="sect1"><a href="#id2564027">5.4.
1.1 grant 1229: Creating a multiple CD-ROM packages
1230: collection</a></span></dt>
1231:
1232: <dd>
1233: <dl>
1234: <dt><span class="sect2"><a href=
1.3 hubertf 1235: "#id2564042">5.4.1. Example of
1.1 grant 1236: cdpack</a></span></dt>
1237: </dl>
1238: </dd>
1239: </dl>
1240: </dd>
1241:
1242: <dt><span class="chapter"><a href="#faq">6. Frequently
1243: Asked Questions</a></span></dt>
1244:
1245: <dd>
1246: <dl>
1.3 hubertf 1247: <dt><span class="sect1"><a href="#id2564301">6.1. Is
1.1 grant 1248: there a mailing list for pkg-related
1249: discussion?</a></span></dt>
1250:
1.3 hubertf 1251: <dt><span class="sect1"><a href="#id2564331">6.2.
1.1 grant 1252: Where's the pkgviews documentation?</a></span></dt>
1253:
1.5 ! hubertf 1254: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 1255: Utilities for package management
1256: (pkgtools)</a></span></dt>
1257:
1.5 ! hubertf 1258: <dt><span class="sect1"><a href="#id2564584">6.4. How
1.1 grant 1259: to use pkgsrc as non-root</a></span></dt>
1260:
1.5 ! hubertf 1261: <dt><span class="sect1"><a href="#id2564596">6.5. How
1.1 grant 1262: can I install/use XFree86 from
1263: pkgsrc?</a></span></dt>
1264:
1.5 ! hubertf 1265: <dt><span class="sect1"><a href="#id2564624">6.6. How
1.1 grant 1266: can I install/use X.org from pkgsrc?</a></span></dt>
1267:
1.5 ! hubertf 1268: <dt><span class="sect1"><a href="#id2564651">6.7. How
1.1 grant 1269: to fetch files from behind a firewall</a></span></dt>
1270:
1.5 ! hubertf 1271: <dt><span class="sect1"><a href="#id2564665">6.8. How
1.1 grant 1272: do I tell make fetch to do passive
1273: FTP?</a></span></dt>
1274:
1.5 ! hubertf 1275: <dt><span class="sect1"><a href="#id2564785">6.9. How
1.1 grant 1276: to fetch all distfiles at once</a></span></dt>
1277:
1.5 ! hubertf 1278: <dt><span class="sect1"><a href="#id2564993">6.10.
1.1 grant 1279: What does Don't know how to make
1280: /usr/share/tmac/tmac.andoc mean?</a></span></dt>
1281:
1.5 ! hubertf 1282: <dt><span class="sect1"><a href="#id2565031">6.11.
1.1 grant 1283: What does Could not find bsd.own.mk
1284: mean?</a></span></dt>
1285:
1.5 ! hubertf 1286: <dt><span class="sect1"><a href="#id2565089">6.12.
1.1 grant 1287: Using 'sudo' with pkgsrc</a></span></dt>
1288:
1289: <dt><span class="sect1"><a href="#faq.conf">6.13.
1290: Configuration files handling and
1291: placement</a></span></dt>
1292:
1293: <dt><span class="sect1"><a href=
1294: "#audit-packages">6.14. Automated security
1295: checks</a></span></dt>
1296: </dl>
1297: </dd>
1298: </dl>
1299: </div>
1300:
1301: <div class="chapter" lang="en" xml:lang="en">
1302: <div class="titlepage">
1303: <div>
1304: <div>
1305: <h2 class="title"><a name="getting" id=
1306: "getting"></a>Chapter 2. Where to get
1307: pkgsrc</h2>
1308: </div>
1309: </div>
1310: </div>
1311:
1312: <div class="toc">
1313: <p><b>Table of Contents</b></p>
1314:
1315: <dl>
1.3 hubertf 1316: <dt><span class="sect1"><a href="#id2495052">2.1. As
1.1 grant 1317: tar file</a></span></dt>
1318:
1.3 hubertf 1319: <dt><span class="sect1"><a href="#id2495069">2.2. Via
1.1 grant 1320: SUP</a></span></dt>
1321:
1.3 hubertf 1322: <dt><span class="sect1"><a href="#id2495101">2.3. Via
1.1 grant 1323: CVS</a></span></dt>
1324: </dl>
1325: </div>
1326:
1327: <p>There are three ways to get pkgsrc. Either as a tar
1328: file, via SUP, or via CVS. All three ways are described
1329: here.</p>
1330:
1331: <div class="sect1" lang="en" xml:lang="en">
1332: <div class="titlepage">
1333: <div>
1334: <div>
1335: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 1336: "id2495052" id="id2495052"></a>2.1. As tar
1.1 grant 1337: file</h2>
1338: </div>
1339: </div>
1340: </div>
1341:
1342: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1343: file from <a href=
1344: "ftp://ftp.NetBSD.org/pub/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.2 hubertf 1345: target="_top">ftp.NetBSD.org</a> and unpack it into
1346: <tt class="filename">/usr/pkgsrc</tt>.</p>
1.1 grant 1347: </div>
1348:
1349: <div class="sect1" lang="en" xml:lang="en">
1350: <div class="titlepage">
1351: <div>
1352: <div>
1353: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 1354: "id2495069" id="id2495069"></a>2.2. Via
1.1 grant 1355: SUP</h2>
1356: </div>
1357: </div>
1358: </div>
1359:
1360: <p>As an alternative to the tar file, you can get pkgsrc
1361: via the Software Update Protocol, SUP. To do so, make
1362: sure your supfile has a line</p>
1363: <pre class="programlisting">
1364: release=pkgsrc
1365: </pre>
1366:
1367: <p>in it, see the examples in <tt class=
1368: "filename">/usr/share/examples/supfiles</tt>, and that
1369: the <tt class="filename">/usr/pkgsrc</tt> directory
1370: exists. Then, simply run <span><b class="command">sup -v
1371: <i class=
1372: "replaceable"><tt>/path/to/your/supfile</tt></i></b></span>.</p>
1373: </div>
1374:
1375: <div class="sect1" lang="en" xml:lang="en">
1376: <div class="titlepage">
1377: <div>
1378: <div>
1379: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 1380: "id2495101" id="id2495101"></a>2.3. Via
1.1 grant 1381: CVS</h2>
1382: </div>
1383: </div>
1384: </div>
1385:
1386: <p>To get pkgsrc via CVS, make sure you have
1387: “<span class="quote">cvs</span>” installed.
1388: If not present on your system, it can be found as
1389: precompiled binary on ftp.NetBSD.org. To do an initial
1390: (full) checkout of pkgsrc, do the following steps:</p>
1391: <pre class="screen">
1392: <tt class="prompt">%</tt> <b class=
1393: "userinput"><tt>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</tt></b>
1394: <tt class="prompt">%</tt> <b class=
1395: "userinput"><tt>setenv CVS_RSH ssh</tt></b>
1396: <tt class="prompt">%</tt> <b class="userinput"><tt>cd /usr</tt></b>
1397: <tt class="prompt">%</tt> <b class=
1398: "userinput"><tt>cvs checkout -P pkgsrc</tt></b>
1399: </pre>
1400:
1401: <p>This will create the <tt class="filename">pkgsrc</tt>
1402: directory in your <tt class="filename">/usr</tt>, and all
1403: the package source will be stored under <tt class=
1404: "filename">/usr/pkgsrc</tt>. To update pkgsrc after the
1405: initial checkout, make sure you have <tt class=
1406: "varname">CVS_RSH</tt> set as above, then do:</p>
1407: <pre class="screen">
1408: <tt class="prompt">%</tt> <b class=
1409: "userinput"><tt>cd /usr/pkgsrc</tt></b>
1410: <tt class="prompt">%</tt> <b class=
1411: "userinput"><tt>cvs -q update -dP</tt></b>
1412: </pre>
1413:
1414: <p>Please also note that it is possible to have multiple
1415: copies of the pkgsrc hierarchy in use at any one time -
1416: all work is done relatively within the pkgsrc tree.</p>
1417: </div>
1418: </div>
1419:
1420: <div class="chapter" lang="en" xml:lang="en">
1421: <div class="titlepage">
1422: <div>
1423: <div>
1424: <h2 class="title"><a name="platforms" id=
1425: "platforms"></a>Chapter 3. Using pkgsrc on
1426: systems other than NetBSD</h2>
1427: </div>
1428: </div>
1429: </div>
1430:
1431: <div class="toc">
1432: <p><b>Table of Contents</b></p>
1433:
1434: <dl>
1.3 hubertf 1435: <dt><span class="sect1"><a href="#id2495211">3.1.
1.1 grant 1436: Bootstrapping pkgsrc</a></span></dt>
1437:
1.3 hubertf 1438: <dt><span class="sect1"><a href="#id2495318">3.2.
1.1 grant 1439: Platform specific notes</a></span></dt>
1440:
1441: <dd>
1442: <dl>
1.3 hubertf 1443: <dt><span class="sect2"><a href="#id2495324">3.2.1.
1.1 grant 1444: Darwin (Mac OS X)</a></span></dt>
1445:
1.3 hubertf 1446: <dt><span class="sect2"><a href="#id2495623">3.2.2.
1.1 grant 1447: FreeBSD</a></span></dt>
1448:
1.3 hubertf 1449: <dt><span class="sect2"><a href="#id2496272">3.2.3.
1.1 grant 1450: Interix</a></span></dt>
1451:
1.3 hubertf 1452: <dt><span class="sect2"><a href="#id2496362">3.2.4.
1.1 grant 1453: IRIX</a></span></dt>
1454:
1.3 hubertf 1455: <dt><span class="sect2"><a href="#id2496480">3.2.5.
1.1 grant 1456: OpenBSD</a></span></dt>
1457:
1.3 hubertf 1458: <dt><span class="sect2"><a href="#id2496660">3.2.6.
1.1 grant 1459: Solaris</a></span></dt>
1460: </dl>
1461: </dd>
1462: </dl>
1463: </div>
1464:
1465: <div class="sect1" lang="en" xml:lang="en">
1466: <div class="titlepage">
1467: <div>
1468: <div>
1469: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 1470: "id2495211" id=
1471: "id2495211"></a>3.1. Bootstrapping pkgsrc</h2>
1.1 grant 1472: </div>
1473: </div>
1474: </div>
1475:
1476: <p>For Operating Systems other than NetBSD, we provide a
1477: bootstrap kit to build the required tools to use pkgsrc
1478: on your platform. Besides support for native NetBSD,
1479: pkgsrc and the bootstrap kit have support for the
1480: following operating systems:</p>
1481:
1482: <div class="itemizedlist">
1483: <ul type="disc">
1484: <li>
1485: <p>Darwin (Mac OS X)</p>
1486: </li>
1487:
1488: <li>
1489: <p>FreeBSD</p>
1490: </li>
1491:
1492: <li>
1493: <p>Interix (Windows 2000, XP, 2003)</p>
1494: </li>
1495:
1496: <li>
1497: <p>IRIX</p>
1498: </li>
1499:
1500: <li>
1501: <p>Linux</p>
1502: </li>
1503:
1504: <li>
1505: <p>OpenBSD</p>
1506: </li>
1507:
1508: <li>
1509: <p>Solaris</p>
1510: </li>
1511: </ul>
1512: </div>
1513:
1514: <p>Support for other platforms is under development.</p>
1515:
1516: <p>Installing the bootstrap kit should be as simple
1517: as:</p>
1518: <pre class="screen">
1519: <tt class="prompt">#</tt> <b class=
1520: "userinput"><tt>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</tt></b>
1521: <tt class="prompt">#</tt> <b class=
1522: "userinput"><tt>cd pkgsrc/bootstrap</tt></b>
1523: <tt class="prompt">#</tt> <b class=
1524: "userinput"><tt>./bootstrap</tt></b>
1525: </pre>
1526:
1527: <p>See <a href="#getting" title=
1528: "Chapter 2. Where to get pkgsrc">Chapter 2,
1529: <i>Where to get pkgsrc</i></a> for other ways to get
1530: pkgsrc before bootstrapping. The given <span><b class=
1531: "command">bootstrap</b></span> command will use the
1532: defaults of <tt class="filename">/usr/pkg</tt> for the
1533: <span class="emphasis"><em>prefix</em></span> where
1534: programs will be installed in, and <tt class=
1535: "filename">/var/db/pkg</tt> for the package database
1536: directory where pkgsrc will do it's internal bookkeeping.
1537: However, these can also be set using command-line
1538: parameters.</p>
1539:
1540: <p>Binary packages for the pkgsrc tools and an initial
1541: set of packages is available for supported platforms. An
1542: up-to-date list of these can be found on <a href=
1543: "http://www.pkgsrc.org/" target=
1544: "_top">www.pkgsrc.org</a>.</p>
1545: </div>
1546:
1547: <div class="sect1" lang="en" xml:lang="en">
1548: <div class="titlepage">
1549: <div>
1550: <div>
1551: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 1552: "id2495318" id="id2495318"></a>3.2. Platform
1.1 grant 1553: specific notes</h2>
1554: </div>
1555: </div>
1556: </div>
1557:
1558: <p>Here are some platform-specific notes you should be
1559: aware of.</p>
1560:
1561: <div class="sect2" lang="en" xml:lang="en">
1562: <div class="titlepage">
1563: <div>
1564: <div>
1.3 hubertf 1565: <h3 class="title"><a name="id2495324" id=
1566: "id2495324"></a>3.2.1. Darwin (Mac OS
1.1 grant 1567: X)</h3>
1568: </div>
1569: </div>
1570: </div>
1571:
1572: <p>Darwin 5.x and 6.x are supported. There are two
1573: methods of using pkgsrc on Mac OS X, by using a
1574: <a href="#platform.osx-image" title=
1575: "3.2.1.1. Using a disk image">disk image</a>, or a
1576: <a href="#platform.osx-ufs" title=
1577: "3.2.1.2. Using a UFS partition">UFS
1578: partition</a>.</p>
1579:
1580: <p>Before you start, you will need to download and
1581: install the Mac OS X Developer Tools from Apple's
1582: Developer Connection. See <a href=
1583: "http://developer.apple.com/macosx/" target=
1584: "_top">http://developer.apple.com/macosx/</a> for
1585: details. Also, make sure you install X11 for Mac OS X
1586: and the X11 SDK from <a href=
1587: "http://www.apple.com/macosx/x11/download/" target=
1588: "_top">http://www.apple.com/macosx/x11/download/</a> if
1589: you intend to build packages that use the X11 Window
1590: System.</p>
1591:
1592: <p>If you already have a UFS partition, or have a spare
1593: partition that you can format as UFS, it is recommended
1594: to use that instead of the disk image. It'll be
1595: somewhat faster and will mount automatically at boot
1596: time, where you must manually mount a disk image.</p>
1597:
1598: <div class="note" style=
1599: "margin-left: 0.5in; margin-right: 0.5in;">
1600: <h3 class="title">Note</h3>
1601:
1602: <p>You cannot use a HFS+ file system for pkgsrc,
1603: because pkgsrc currently requires the filesystem to
1604: be case-sensitive, and HFS+ is not.</p>
1605: </div>
1606:
1607: <div class="sect3" lang="en" xml:lang="en">
1608: <div class="titlepage">
1609: <div>
1610: <div>
1611: <h4 class="title"><a name="platform.osx-image"
1612: id="platform.osx-image"></a>3.2.1.1. Using
1613: a disk image</h4>
1614: </div>
1615: </div>
1616: </div>
1617:
1618: <p>Create the disk image:</p>
1619: <pre class="screen">
1620: <tt class="prompt">#</tt> <b class=
1621: "userinput"><tt>cd pkgsrc/bootstrap</tt></b>
1622: <tt class="prompt">#</tt> <b class=
1623: "userinput"><tt>./ufsdiskimage create ~/Documents/NetBSD 512</tt></b> # megabytes - season to taste
1624: <tt class="prompt">#</tt> <b class=
1625: "userinput"><tt>./ufsdiskimage mount ~/Documents/NetBSD</tt></b>
1626: <tt class="prompt">#</tt> <b class=
1627: "userinput"><tt>sudo chown `id -u`:`id -g` /Volumes/NetBSD</tt></b>
1628: </pre>
1629:
1630: <p>That's it!</p>
1631: </div>
1632:
1633: <div class="sect3" lang="en" xml:lang="en">
1634: <div class="titlepage">
1635: <div>
1636: <div>
1637: <h4 class="title"><a name="platform.osx-ufs"
1638: id="platform.osx-ufs"></a>3.2.1.2. Using a
1639: UFS partition</h4>
1640: </div>
1641: </div>
1642: </div>
1643:
1644: <p>By default, <tt class="filename">/usr</tt> will be
1645: on your root file system, normally HFS+. It is
1646: possible to use the default <span class=
1647: "emphasis"><em>prefix</em></span> of <tt class=
1648: "filename">/usr/pkg</tt> by symlinking <tt class=
1649: "filename">/usr/pkg</tt> to a directory on a UFS file
1650: system. Obviously, another symlink is required if you
1651: want to place the package database directory outside
1652: the <span class="emphasis"><em>prefix</em></span>.
1653: e.g.</p>
1654: <pre class="screen">
1655: <tt class="prompt">#</tt> <b class=
1656: "userinput"><tt>./bootstrap --pkgdbdir=/usr/pkg/pkgdb --pkgsrcdir=/Volumes/ufs/pkgsrc</tt></b>
1657: </pre>
1658:
1659: <p>If you created your partitions at the time of
1660: installing Mac OS X and formatted the target
1661: partition as UFS, it should automatically mount on
1662: <tt class="filename">/Volumes/<volume
1663: name></tt> when the machine boots. If you are
1664: (re)formatting a partition as UFS, you need to ensure
1665: that the partition map correctly reflects
1666: “<span class="quote">Apple_UFS</span>”
1667: and not “<span class=
1668: "quote">Apple_HFS</span>”.</p>
1669:
1670: <p>The problem is that none of the disk tools will
1671: let you touch a disk that is booted from. You can
1672: unmount the partition, but even if you newfs it, the
1673: partition type will be incorrect and the automounter
1674: won't mount it. It can be mounted manually, but it
1675: won't appear in Finder.</p>
1676:
1677: <p>You'll need to boot off of the OS X Installation
1678: (User) CD. When the Installation program starts, go
1679: up to the menu and select Disk Utility. Now, you will
1680: be able to select the partition you want to be UFS,
1681: and Format it Apple UFS. Quit the Disk Utility, quit
1682: the installer which will reboot your machine. The new
1683: UFS file system will appear in Finder.</p>
1684:
1685: <p>Be aware that the permissions on the new file
1686: system will be writable by root only.</p>
1687:
1688: <p>This note is as of 10.2 (Jaguar) and applies to
1689: earlier versions. Hopefully Apple will fix Disk
1690: Utility in 10.3 (Panther).</p>
1691: </div>
1692: </div>
1693:
1694: <div class="sect2" lang="en" xml:lang="en">
1695: <div class="titlepage">
1696: <div>
1697: <div>
1.3 hubertf 1698: <h3 class="title"><a name="id2495623" id=
1699: "id2495623"></a>3.2.2. FreeBSD</h3>
1.1 grant 1700: </div>
1701: </div>
1702: </div>
1703:
1704: <p>FreeBSD 4.7 and 5.0 have been tested and are
1705: supported, other versions may work.</p>
1706:
1707: <p>Care should be taken so that the tools that this kit
1708: installs do not conflict with the FreeBSD userland
1709: tools. There are several steps:</p>
1710:
1711: <div class="orderedlist">
1712: <ol type="1">
1713: <li>
1714: <p>FreeBSD stores its ports pkg database in
1715: <tt class="filename">/var/db/pkg</tt>. It is
1716: therefore recommended that you choose a different
1717: location (e.g. <tt class=
1718: "filename">/usr/pkgdb</tt>) by using the
1719: --pkgdbdir option to the bootstrap script.</p>
1720: </li>
1721:
1722: <li>
1723: <p>If you do not intend to use the FreeBSD ports
1724: tools, it's probably a good idea to move them out
1725: of the way to avoid confusion, e.g.</p>
1726: <pre class="screen">
1727: <tt class="prompt">#</tt> <b class=
1728: "userinput"><tt>cd /usr/sbin</tt></b>
1729: <tt class="prompt">#</tt> <b class=
1730: "userinput"><tt>mv pkg_add pkg_add.orig</tt></b>
1731: <tt class="prompt">#</tt> <b class=
1732: "userinput"><tt>mv pkg_create pkg_create.orig</tt></b>
1733: <tt class="prompt">#</tt> <b class=
1734: "userinput"><tt>mv pkg_delete pkg_delete.orig</tt></b>
1735: <tt class="prompt">#</tt> <b class=
1736: "userinput"><tt>mv pkg_info pkg_info.orig</tt></b>
1737: </pre>
1738: </li>
1739:
1740: <li>
1741: <p>An example <tt class=
1742: "filename">/etc/mk.conf</tt> file will be placed
1743: in <tt class="filename">/etc/mk.conf.example</tt>
1744: file when you use the bootstrap script.</p>
1745: </li>
1746: </ol>
1747: </div>
1748: </div>
1749:
1750: <div class="sect2" lang="en" xml:lang="en">
1751: <div class="titlepage">
1752: <div>
1753: <div>
1.3 hubertf 1754: <h3 class="title"><a name="id2496272" id=
1755: "id2496272"></a>3.2.3. Interix</h3>
1.1 grant 1756: </div>
1757: </div>
1758: </div>
1759:
1760: <p>Interix is a POSIX compatible subsystem for the
1761: Windows NT kernel, providing a Unix-like environment
1762: with a tighter kernel integration than available with
1763: Cygwin. It is part of the Windows Services for Unix
1764: package, available for free for any licensed copy of
1765: Windows 2000, XP, or 2003. SFU can be downloaded from
1766: <a href="http://www.microsoft.com/windows/sfu/" target=
1767: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
1768:
1769: <p>Services for Unix 3.5, current as of this writing,
1770: has been tested. 3.0 or 3.1 may work, but are not
1771: officially supported. (The main difference in 3.0/3.1
1772: is lack of pthreads.)</p>
1773:
1774: <div class="sect3" lang="en" xml:lang="en">
1775: <div class="titlepage">
1776: <div>
1777: <div>
1778: <h4 class="title"><a name=
1779: "platform.interix-sfu-install" id=
1780: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 1781: installing Interix/SFU</h4>
1.1 grant 1782: </div>
1783: </div>
1784: </div>
1785:
1786: <p>At an absolute minimum, the following packages
1787: must be installed from the Windows Services for Unix
1788: 3.5 distribution in order to use pkgsrc:</p>
1789:
1790: <div class="itemizedlist">
1791: <ul type="disc">
1792: <li>
1793: <p>Utilities -> Base Utilities</p>
1794: </li>
1795:
1796: <li>
1797: <p>Interix GNU Components -> (all)</p>
1798: </li>
1799:
1800: <li>
1801: <p>Remote Connectivity</p>
1802: </li>
1803:
1804: <li>
1805: <p>Interix SDK</p>
1806: </li>
1807: </ul>
1808: </div>
1809:
1810: <p>When using pkgsrc on Interix, DO NOT install the
1811: Utilities subcomponent "UNIX Perl". That is Perl 5.6
1812: without shared module support, installed to
1813: /usr/local, and will only cause confusion. Instead,
1814: install Perl 5.8 from pkgsrc (or from a binary
1815: package).</p>
1816:
1817: <p>The Remote Connectivity subcomponent "Windows
1818: Remote Shell Service" does not need to be installed,
1819: but Remote Connectivity itself should be installed in
1820: order to have a working inetd.</p>
1821:
1822: <p>Finally, during installation you may be asked
1823: whether to enable setuid behavior for Interix
1824: programs, and whether to make pathnames default to
1825: case-sensitive. Setuid should be enabled, and
1826: case-sensitivity MUST be enabled. (Without
1827: case-sensitivity, a large number of packages
1828: including perl will not build.)</p>
1829: </div>
1830:
1831: <div class="sect3" lang="en" xml:lang="en">
1832: <div class="titlepage">
1833: <div>
1834: <div>
1835: <h4 class="title"><a name=
1836: "platform.interix-sfu-postinstall" id=
1837: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
1838: to do if Interix/SFU is already installed</h4>
1839: </div>
1840: </div>
1841: </div>
1842:
1843: <p>If SFU is already installed and you wish to alter
1844: these settings to work with pkgsrc, note the
1845: following things.</p>
1846:
1847: <div class="itemizedlist">
1848: <ul type="disc">
1849: <li>
1850: <p>To uninstall UNIX Perl, use Add/Remove
1851: Programs, select Microsoft Windows Services for
1852: UNIX, then click Change. In the installer,
1853: choose Add or Remove, then uncheck
1854: Utilities->UNIX Perl.</p>
1855: </li>
1856:
1857: <li>
1858: <p>To enable case-sensitivity for the
1859: filesystem, run REGEDIT.EXE, and change the
1860: following registry key:</p>
1861:
1862: <p>
1863: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
1864: Manager\kernel</p>
1865:
1866: <p>Set the DWORD value "obcaseinsensitive" to
1867: 0; then reboot.</p>
1868: </li>
1869:
1870: <li>
1871: <p>To enable setuid binaries (optional), run
1872: REGEDIT.EXE, and change the following registry
1873: key:</p>
1874:
1875: <p>
1876: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
1877: for UNIX</p>
1878:
1879: <p>Set the DWORD value "EnableSetuidBinaries"
1880: to 1; then reboot.</p>
1881: </li>
1882: </ul>
1883: </div>
1884: </div>
1885:
1886: <div class="sect3" lang="en" xml:lang="en">
1887: <div class="titlepage">
1888: <div>
1889: <div>
1890: <h4 class="title"><a name=
1891: "platform.interix-notes" id=
1892: "platform.interix-notes"></a>3.2.3.3. Important
1893: notes for using pkgsrc</h4>
1894: </div>
1895: </div>
1896: </div>
1897:
1898: <p>The package imanager (either the pkgsrc "su" user,
1899: or the user running "pkg_add") must be a member of
1900: the local Administrators group. Such a user must also
1901: be used to run the bootstrap. This is slightly
1902: relaxed from the normal pkgsrc requirement of
1903: "root".</p>
1904:
1905: <p>The package manager should use a umask of 002.
1906: "make install" will automatically complain if this is
1907: not the case. This ensures that directories written
1908: in /var/db/pkg are Administrators-group
1909: writeable.</p>
1910:
1911: <p>The popular Interix binary packages from
1912: http://www.interopsystems.com/ use an older version
1913: of pkgsrc's pkg_* tools. Ideally, these should NOT be
1914: used in conjunction with pkgsrc. If you choose to use
1915: them at the same time as the pkgsrc packages, ensure
1916: that you use the proper pkg_* tools for each type of
1917: binary package.</p>
1918: </div>
1919: </div>
1920:
1921: <div class="sect2" lang="en" xml:lang="en">
1922: <div class="titlepage">
1923: <div>
1924: <div>
1.3 hubertf 1925: <h3 class="title"><a name="id2496362" id=
1926: "id2496362"></a>3.2.4. IRIX</h3>
1.1 grant 1927: </div>
1928: </div>
1929: </div>
1930:
1931: <p>You will need a working C compiler, either gcc or
1932: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1933: the <tt class="varname">CC</tt> environment variable
1934: according to your preference. If you do not have a
1935: license for the MIPSpro compiler suite, you can
1936: download a gcc tardist file from <a href=
1937: "http://freeware.sgi.com/" target=
1938: "_top">http://freeware.sgi.com/</a>.</p>
1939:
1940: <p>Please note that you will need IRIX 6.5.17 or
1941: higher, as this is the earliest version of IRIX
1942: providing support for if_indextoname(3),
1943: if_nametoindex(3), etc.</p>
1944:
1945: <p>At this point in time, pkgsrc only supports one ABI.
1946: That is, you can not switch between the old 32-bit ABI,
1947: the new 32-bit ABI and the 64-bit ABI. If you start out
1948: using "abi=n32", that's what all your packages will be
1949: built with.</p>
1950:
1951: <p>Therefore, please make sure that you have no
1952: conflicting <tt class="varname">CFLAGS</tt> in your
1953: environment or the <tt class=
1954: "filename">/etc/mk.conf</tt>. Particularly, make sure
1955: that you do not try to link n32 object files with lib64
1956: or vice versa. Check your <tt class=
1957: "filename">/etc/compiler.defaults</tt>!</p>
1958:
1959: <p>If you have the actual pkgsrc tree mounted via NFS
1960: from a different host, please make sure to set
1961: <tt class="varname">WRKOBJDIR</tt> to a local
1962: directory, as it appears that IRIX linker occasionally
1963: runs into issues when trying to link over a network
1964: mounted filesystem.</p>
1965:
1966: <p>The bootstrapping process should set all the right
1967: options for programs such as imake(1), but you may want
1968: to set some options depending on your local setup.
1969: Please see <tt class=
1970: "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt> and, of
1971: course, your compilers man pages for details.</p>
1972: </div>
1973:
1974: <div class="sect2" lang="en" xml:lang="en">
1975: <div class="titlepage">
1976: <div>
1977: <div>
1.3 hubertf 1978: <h3 class="title"><a name="id2496480" id=
1979: "id2496480"></a>3.2.5. OpenBSD</h3>
1.1 grant 1980: </div>
1981: </div>
1982: </div>
1983:
1984: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
1985:
1986: <p>Care should be taken so that the tools that this kit
1987: installs do not conflict with the OpenBSD userland
1988: tools. There are several steps:</p>
1989:
1990: <div class="orderedlist">
1991: <ol type="1">
1992: <li>
1993: <p>OpenBSD stores its ports pkg database in
1994: <tt class="filename">/var/db/pkg</tt>. It is
1995: therefore recommended that you choose a different
1996: location (e.g. <tt class=
1997: "filename">/usr/pkgdb</tt>) by using the
1998: --pkgdbdir option to the bootstrap script.</p>
1999: </li>
2000:
2001: <li>
2002: <p>If you do not intend to use the OpenBSD ports
2003: tools, it's probably a good idea to move them out
2004: of the way to avoid confusion, e.g.</p>
2005: <pre class="screen">
2006: <tt class="prompt">#</tt> <b class=
2007: "userinput"><tt>cd /usr/sbin</tt></b>
2008: <tt class="prompt">#</tt> <b class=
2009: "userinput"><tt>mv pkg_add pkg_add.orig</tt></b>
2010: <tt class="prompt">#</tt> <b class=
2011: "userinput"><tt>mv pkg_create pkg_create.orig</tt></b>
2012: <tt class="prompt">#</tt> <b class=
2013: "userinput"><tt>mv pkg_delete pkg_delete.orig</tt></b>
2014: <tt class="prompt">#</tt> <b class=
2015: "userinput"><tt>mv pkg_info pkg_info.orig</tt></b>
2016: </pre>
2017: </li>
2018:
2019: <li>
2020: <p>An example <tt class=
2021: "filename">/etc/mk.conf</tt> file will be placed
2022: in <tt class="filename">/etc/mk.conf.example</tt>
2023: file when you use the bootstrap script. OpenBSD's
2024: make program uses <tt class=
2025: "filename">/etc/mk.conf</tt> as well. You can
2026: work around this by enclosing all the pkgsrc
2027: specific parts of the file with:</p>
2028: <pre class="programlisting">
2029: .ifdef BSD_PKG_MK
2030: # pkgsrc stuff, e.g. insert bsd.pkg.defaults.mk or similar here
2031: .else
2032: # OpenBSD stuff
2033: .endif
2034: </pre>
2035: </li>
2036: </ol>
2037: </div>
2038: </div>
2039:
2040: <div class="sect2" lang="en" xml:lang="en">
2041: <div class="titlepage">
2042: <div>
2043: <div>
1.3 hubertf 2044: <h3 class="title"><a name="id2496660" id=
2045: "id2496660"></a>3.2.6. Solaris</h3>
1.1 grant 2046: </div>
2047: </div>
2048: </div>
2049:
2050: <p>Solaris 2.6 through 9 are supported on both x86 and
2051: sparc. You will need a working C compiler. Both gcc
2052: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2053:
2054: <p>The following packages are required on Solaris 8 for
2055: the bootstrap process and to build packages.</p>
2056:
2057: <div class="itemizedlist">
2058: <ul type="disc">
2059: <li>
2060: <p>SUNWsprot</p>
2061: </li>
2062:
2063: <li>
2064: <p>SUNWarc</p>
2065: </li>
2066:
2067: <li>
2068: <p>SUNWbtool</p>
2069: </li>
2070:
2071: <li>
2072: <p>SUNWtoo</p>
2073: </li>
2074:
2075: <li>
2076: <p>SUNWlibm</p>
2077: </li>
2078: </ul>
2079: </div>
2080:
2081: <p>Please note the use of GNU binutils on Solaris is
2082: <span class="emphasis"><em>not</em></span>
2083: supported.</p>
2084:
2085: <div class="sect3" lang="en" xml:lang="en">
2086: <div class="titlepage">
2087: <div>
2088: <div>
1.3 hubertf 2089: <h4 class="title"><a name="id2496691" id=
2090: "id2496691"></a>3.2.6.1. If you are using
1.1 grant 2091: gcc</h4>
2092: </div>
2093: </div>
2094: </div>
2095:
2096: <p>It makes life much simpler if you only use the
2097: same gcc consistently for building all packages.</p>
2098:
2099: <p>It is recommended that an external gcc be used
2100: only for bootstrapping, then either build gcc from
2101: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2102: href=
2103: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.2 hubertf 2104: class="pkgname">lang/gcc</a> or install a binary
2105: gcc package, then remove gcc used during
2106: bootstrapping.</p>
1.1 grant 2107:
2108: <p>Binary packages of gcc can be found through
2109: <a href=
2110: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.2 hubertf 2111: target=
2112: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2113: </div>
2114:
2115: <div class="sect3" lang="en" xml:lang="en">
2116: <div class="titlepage">
2117: <div>
2118: <div>
1.3 hubertf 2119: <h4 class="title"><a name="id2496712" id=
2120: "id2496712"></a>3.2.6.2. If you are using
1.1 grant 2121: Sun WorkShop</h4>
2122: </div>
2123: </div>
2124: </div>
2125:
2126: <p>You will need at least the following packages
2127: installed (from WorkShop 5.0)</p>
2128:
2129: <div class="itemizedlist">
2130: <ul type="disc">
2131: <li>
2132: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2133: </li>
2134:
2135: <li>
2136: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2137: </li>
2138:
2139: <li>
2140: <p>SPROild - Sun WorkShop Incremental
2141: Linker</p>
2142: </li>
2143:
2144: <li>
2145: <p>SPROlang - Sun WorkShop Compilers common
2146: components</p>
2147: </li>
2148: </ul>
2149: </div>
2150:
2151: <p>You should set <tt class="varname">CC</tt>,
2152: <tt class="varname">CXX</tt> and optionally,
2153: <tt class="varname">CPP</tt> in <tt class=
2154: "filename">/etc/mk.conf</tt>, eg.</p>
2155: <pre class="programlisting">
2156: CC= cc
2157: CXX= CC
2158: CPP= /usr/ccs/lib/cpp
2159: </pre>
2160:
2161: <p>You may also want to build 64-bit binaries,
2162: eg.</p>
2163: <pre class="programlisting">
2164: CFLAGS= -xtarget=ultra -xarch=v9
2165: </pre>
2166:
2167: <p>Whichever compiler you use, please ensure the
2168: compiler tools and your $prefix are in your
2169: <tt class="varname">PATH</tt>. This includes
2170: <tt class="filename">/usr/ccs/{bin,lib}</tt> and eg.
2171: <tt class="filename">/usr/pkg/{bin,sbin}</tt>.</p>
2172: </div>
2173: </div>
2174: </div>
2175: </div>
2176:
2177: <div class="chapter" lang="en" xml:lang="en">
2178: <div class="titlepage">
2179: <div>
2180: <div>
2181: <h2 class="title"><a name="using" id=
2182: "using"></a>Chapter 4. Using pkgsrc</h2>
2183: </div>
2184: </div>
2185: </div>
2186:
2187: <div class="toc">
2188: <p><b>Table of Contents</b></p>
2189:
2190: <dl>
2191: <dt><span class="sect1"><a href="#getting-started">4.1.
2192: Working with binary packages</a></span></dt>
2193:
2194: <dd>
2195: <dl>
1.3 hubertf 2196: <dt><span class="sect2"><a href="#id2496865">4.1.1.
1.1 grant 2197: Where to get binary packages</a></span></dt>
2198:
1.3 hubertf 2199: <dt><span class="sect2"><a href="#id2496905">4.1.2.
1.1 grant 2200: How to use binary packages</a></span></dt>
2201:
1.3 hubertf 2202: <dt><span class="sect2"><a href="#id2497040">4.1.3.
1.1 grant 2203: A word of warning</a></span></dt>
2204: </dl>
2205: </dd>
2206:
1.3 hubertf 2207: <dt><span class="sect1"><a href="#id2497051">4.2.
1.1 grant 2208: Building packages from source</a></span></dt>
2209:
2210: <dd>
2211: <dl>
1.3 hubertf 2212: <dt><span class="sect2"><a href="#id2497129">4.2.1.
1.1 grant 2213: Requirements</a></span></dt>
2214:
1.3 hubertf 2215: <dt><span class="sect2"><a href="#id2497149">4.2.2.
1.1 grant 2216: Fetching distfiles</a></span></dt>
2217:
1.3 hubertf 2218: <dt><span class="sect2"><a href="#id2497202">4.2.3.
1.1 grant 2219: How to build and install</a></span></dt>
2220:
1.3 hubertf 2221: <dt><span class="sect2"><a href="#id2498133">4.2.4.
1.1 grant 2222: Selecting the compiler</a></span></dt>
2223: </dl>
2224: </dd>
2225: </dl>
2226: </div>
2227:
2228: <div class="sect1" lang="en" xml:lang="en">
2229: <div class="titlepage">
2230: <div>
2231: <div>
2232: <h2 class="title" style="clear: both"><a name=
2233: "getting-started" id=
2234: "getting-started"></a>4.1. Working with binary
2235: packages</h2>
2236: </div>
2237: </div>
2238: </div>
2239:
2240: <p>This section describes how to find, retrieve and
2241: install a precompiled binary package that someone else
2242: already prepared for your type of machine.</p>
2243:
2244: <div class="sect2" lang="en" xml:lang="en">
2245: <div class="titlepage">
2246: <div>
2247: <div>
1.3 hubertf 2248: <h3 class="title"><a name="id2496865" id=
2249: "id2496865"></a>4.1.1. Where to get binary
1.1 grant 2250: packages</h3>
2251: </div>
2252: </div>
2253: </div>
2254:
2255: <p>Precompiled packages are stored on ftp.NetBSD.org
2256: and its mirrors in the directory <tt class=
2257: "filename">/pub/NetBSD/packages</tt> for anonymous FTP
2258: access. Please pick the right subdirectory there as
2259: indicated by <span><b class="command">uname
2260: -p</b></span>. In that directory, there is a
2261: subdirectory for each category plus a subdirectory
2262: <tt class="filename">All</tt> which includes the actual
2263: binaries in <tt class="filename">.tgz</tt> files. The
2264: category subdirectories use symbolic links to those
2265: files (this is the same directory layout as in
2266: <tt class="filename">/usr/pkgsrc/packages</tt>).</p>
2267:
2268: <p>This same directory layout applies for CDROM
2269: distributions, only that the directory may be rooted
2270: somewhere else, probably somewhere below <tt class=
2271: "filename">/cdrom</tt>. Please consult your CDROMs
2272: documentation for the exact location.</p>
2273: </div>
2274:
2275: <div class="sect2" lang="en" xml:lang="en">
2276: <div class="titlepage">
2277: <div>
2278: <div>
1.3 hubertf 2279: <h3 class="title"><a name="id2496905" id=
2280: "id2496905"></a>4.1.2. How to use binary
1.1 grant 2281: packages</h3>
2282: </div>
2283: </div>
2284: </div>
2285:
2286: <p>If you have the files on a CDROM or downloaded them
2287: to your hard disk, youcan install them with the
2288: following command (be sure to<span><b class=
2289: "command">su</b></span> to root first):</p>
2290: <pre class="screen">
2291: <tt class="prompt">#</tt> <b class=
2292: "userinput"><tt>pkg_add /path/to/package.tgz</tt></b>
2293: </pre>
2294:
2295: <p>If you have FTP access and you don't want to
2296: download the packages via FTP prior to installation,
2297: you can do this automatically by giving <span><b class=
2298: "command">pkg_add</b></span> an FTP URL:</p>
2299: <pre class="screen">
2300: <tt class="prompt">#</tt> <b class=
2301: "userinput"><tt>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSvers>/<arch>/All/package.tgz</tt></b>
2302: </pre>
2303:
2304: <p>If there is any doubt, the uname utility can be used
2305: to determine the <OSvers>, and <arch> by
2306: running <span><b class="command">uname
2307: -rp</b></span>.</p>
2308:
2309: <p>Also note that any prerequisite packages needed to
2310: run the package in question will be installed, too,
2311: assuming they are present where you install from.</p>
2312:
2313: <p>After you've installed packages, be sure to have
2314: <tt class="filename">/usr/pkg/bin</tt> in your
2315: <tt class="varname">PATH</tt> so you can actually start
2316: the just installed program.</p>
2317: </div>
2318:
2319: <div class="sect2" lang="en" xml:lang="en">
2320: <div class="titlepage">
2321: <div>
2322: <div>
1.3 hubertf 2323: <h3 class="title"><a name="id2497040" id=
2324: "id2497040"></a>4.1.3. A word of
1.1 grant 2325: warning</h3>
2326: </div>
2327: </div>
2328: </div>
2329:
2330: <p>Please pay very careful attention to the warnings
2331: expressed in the <a href=
2332: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2333: <span class="citerefentry"><span class=
2334: "refentrytitle">pkg_add</span>(1)</span></a> manual
2335: page about the inherent dangers of installing binary
2336: packages which you did not create yourself, and the
2337: security holes that can be introduced onto your system
2338: by indiscriminate adding of such files.</p>
2339: </div>
2340: </div>
2341:
2342: <div class="sect1" lang="en" xml:lang="en">
2343: <div class="titlepage">
2344: <div>
2345: <div>
2346: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 2347: "id2497051" id="id2497051"></a>4.2. Building
1.1 grant 2348: packages from source</h2>
2349: </div>
2350: </div>
2351: </div>
2352:
2353: <p>This assumes that the package is already in pkgsrc. If
2354: it is not, see <a href="#developers-guide" title=
1.2 hubertf 2355: "Part II. The pkgsrc developer's guide">Part II,
2356: “The pkgsrc developer's guide”</a>.</p>
1.1 grant 2357:
2358: <div class="sect2" lang="en" xml:lang="en">
2359: <div class="titlepage">
2360: <div>
2361: <div>
1.3 hubertf 2362: <h3 class="title"><a name="id2497129" id=
2363: "id2497129"></a>4.2.1. Requirements</h3>
1.1 grant 2364: </div>
2365: </div>
2366: </div>
2367:
2368: <p>To build packages from source on a NetBSD system the
2369: “<span class="quote">comp</span>” and the
2370: “<span class="quote">text</span>”
2371: distribution sets must be installed. If you want to
2372: build X11 related packages the “<span class=
2373: "quote">xbase</span>” and “<span class=
2374: "quote">xcomp</span>” distribution sets are
2375: required, too.</p>
2376: </div>
2377:
2378: <div class="sect2" lang="en" xml:lang="en">
2379: <div class="titlepage">
2380: <div>
2381: <div>
1.3 hubertf 2382: <h3 class="title"><a name="id2497149" id=
2383: "id2497149"></a>4.2.2. Fetching
1.1 grant 2384: distfiles</h3>
2385: </div>
2386: </div>
2387: </div>
2388:
2389: <p>The distfile (i.e. the unmodified source) must exist
2390: on your system for the packages system to be able to
2391: build it. If it does not exist, pkgsrc will use
2392: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
2393: <span class="citerefentry"><span class=
2394: "refentrytitle">ftp</span>(1)</span></a> to fetch it
2395: automatically.</p>
2396:
2397: <p>You can overwrite some of the major distribution
2398: sites to fit to sites that are close to your own. Have
2399: a look at <tt class=
2400: "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt> to find
2401: some examples - in particular, look for the <tt class=
2402: "varname">MASTER_SORT</tt>, <tt class=
2403: "varname">MASTER_SORT_REGEX</tt> and <tt class=
2404: "varname">INET_COUNTRY</tt> definitions. This may save
2405: some of your bandwidth and time.</p>
2406:
2407: <p>You can change these settings either in your shell's
2408: environment, or, if you want to keep the settings, by
2409: editing the <tt class="filename">/etc/mk.conf</tt>
2410: file, and adding the definitions there.</p>
2411:
2412: <p>If you don't have a permanent Internet connection
2413: and you want to know which files to download,
2414: <span><b class="command">make fetch-list</b></span>
2415: will tell you what you'll need. Put these distfiles
2416: into <tt class=
2417: "filename">/usr/pkgsrc/distfiles</tt>.</p>
2418: </div>
2419:
2420: <div class="sect2" lang="en" xml:lang="en">
2421: <div class="titlepage">
2422: <div>
2423: <div>
1.3 hubertf 2424: <h3 class="title"><a name="id2497202" id=
2425: "id2497202"></a>4.2.3. How to build and
1.1 grant 2426: install</h3>
2427: </div>
2428: </div>
2429: </div>
2430:
2431: <p>Assuming that the distfile has been fetched (see
2432: previous section), become root and change into the
2433: relevant directory and running <span><b class=
2434: "command">make</b></span>. For example, type</p>
2435: <pre class="screen">
2436: <tt class="prompt">%</tt> <b class=
2437: "userinput"><tt>cd misc/figlet</tt></b>
2438: <tt class="prompt">%</tt> <b class="userinput"><tt>make</tt></b>
2439: </pre>
2440:
2441: <p>at the shell prompt to build the various components
2442: of the package, and</p>
2443: <pre class="screen">
2444: <tt class="prompt">#</tt> <b class=
2445: "userinput"><tt>make install</tt></b>
2446: </pre>
2447:
2448: <p>to install the various components into the correct
2449: places on your system. Installing the package on your
2450: system requires you to be root. However, pkgsrc has a
2451: <span class="emphasis"><em>just-in-time-su</em></span>
2452: feature, which allows you to only become root for the
2453: actual installation step</p>
2454:
2455: <p>Taking the figlet utility as an example, we can
2456: install it on our system by building as shown in
2457: <a href="#logs" title=
2458: "Appendix B. Build logs">Appendix B, <i>Build
2459: logs</i></a>.</p>
2460:
2461: <p>The program is installed under the default root of
2462: the packages tree - <tt class="filename">/usr/pkg</tt>.
2463: Should this not conform to your tastes, set the
2464: <tt class="varname">LOCALBASE</tt> variable in your
2465: environment, and it will use that value as the root of
2466: your packages tree. So, to use <tt class=
2467: "filename">/usr/local</tt>, set <tt class=
2468: "varname">LOCALBASE=/usr/local</tt> in your
2469: environment. Please note that you should use a
2470: directory which is dedicated to packages and not shared
2471: with other programs (ie, do not try and use <tt class=
2472: "varname">LOCALBASE=/usr</tt>). Also, you should not
2473: try to add any of your own files or directories (such
2474: as <tt class="filename">src/</tt>, <tt class=
2475: "filename">obj/</tt>, or <tt class=
2476: "filename">pkgsrc/</tt>) below the <tt class=
2477: "varname">LOCALBASE</tt> tree. This is to prevent
2478: possible conflicts between programs and other files
2479: installed by the package system and whatever else may
2480: have been installed there.</p>
2481:
2482: <p>Some packages look in <tt class=
2483: "filename">/etc/mk.conf</tt> to alter some
2484: configuration options at build time. Have a look at
2485: <tt class="filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt>
2486: to get an overview of what will be set there by
2487: default. Environment variables such as <tt class=
2488: "varname">LOCALBASE</tt> can be set in <tt class=
2489: "filename">/etc/mk.conf</tt> to save having to remember
2490: to set them each time you want to use pkgsrc.</p>
2491:
2492: <p>Occasionally, people want to “<span class=
2493: "quote">look under the covers</span>” to see what
2494: is going on when a package is building or being
2495: installed. This may be for debugging purposes, or out
2496: of simple curiosity. A number of utility values have
2497: been added to help with this.</p>
2498:
2499: <div class="orderedlist">
2500: <ol type="1">
2501: <li>
2502: <p>If you invoke the <a href=
2503: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2504: <span class="citerefentry"><span class=
2505: "refentrytitle">make</span>(1)</span></a> command
2506: with <tt class="varname">PKG_DEBUG_LEVEL=2</tt>,
2507: then a huge amount of information will be
2508: displayed. For example,</p>
2509: <pre class="screen">
2510: <b class="userinput"><tt>make patch PKG_DEBUG_LEVEL=2</tt></b>
2511: </pre>
2512:
2513: <p>will show all the commands that are invoked,
2514: up to and including the “<span class=
2515: "quote">patch</span>” stage.</p>
2516: </li>
2517:
2518: <li>
2519: <p>If you want to know the value of a certain
2520: make(1) definition, then the <tt class=
2521: "varname">VARNAME</tt> definition should be used,
2522: in conjunction with the show-var target. e.g. to
2523: show the expansion of the <a href=
2524: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2525: <span class="citerefentry"><span class=
2526: "refentrytitle">make</span>(1)</span></a>
2527: variable <tt class="varname">DISTFILES</tt>:</p>
2528: <pre class="screen">
2529: <tt class="prompt">%</tt> <b class=
2530: "userinput"><tt>make show-var VARNAME=LOCALBASE</tt></b>
2531: /usr/pkg
2532: <tt class="prompt">%</tt>
2533:
2534: </pre>
2535: </li>
2536: </ol>
2537: </div>
2538:
2539: <p>If you want to install a binary package that you've
2540: either created yourself (see next section), that you
2541: put into pkgsrc/packages manually or that is located on
2542: a remote FTP server, you can use the the "bin-install"
2543: target. This target will install a binary package - if
2544: available - via <a href=
2545: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2546: <span class="citerefentry"><span class=
2547: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
2548: <span><b class="command">make package</b></span>. The
2549: list of remote FTP sites searched is kept in the
2550: variable <tt class="varname">BINPKG_SITE</tt>, which
2551: defaults to ftp.NetBSD.org. Any flags that should be
2552: added to <a href=
2553: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2554: <span class="citerefentry"><span class=
2555: "refentrytitle">pkg_add</span>(1)</span></a> can be put
2556: into <tt class="varname">BIN_INSTALL_FLAGS</tt>. See
2557: <tt class="filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt>
2558: for more details.</p>
2559:
2560: <p>A final word of warning: If you setup a system that
2561: has a non-standard setting for <tt class=
2562: "varname">LOCALBASE</tt>, be sure to set that before
2563: any packages are installed, as you can not use several
2564: directories for the same purpose. Doing so will result
2565: in pkgsrc not being able to properly detect your
2566: installed packages, and fail miserably. Note also that
2567: precompiled binary packages are usually built with the
2568: default <tt class="varname">LOCALBASE</tt> of
2569: <tt class="filename">/usr/pkg</tt>, and that you should
2570: <span class="emphasis"><em>not</em></span> install any
2571: if you use a non-standard <tt class=
2572: "varname">LOCALBASE</tt>.</p>
2573: </div>
2574:
2575: <div class="sect2" lang="en" xml:lang="en">
2576: <div class="titlepage">
2577: <div>
2578: <div>
1.3 hubertf 2579: <h3 class="title"><a name="id2498133" id=
2580: "id2498133"></a>4.2.4. Selecting the
1.1 grant 2581: compiler</h3>
2582: </div>
2583: </div>
2584: </div>
2585:
2586: <p>By default, pkgsrc will use GCC to build packages.
2587: This may be overridden by setting the following
2588: variables in /etc/mk.conf:</p>
2589:
2590: <div class="variablelist">
2591: <dl>
2592: <dt><span class="term"><tt class=
2593: "varname">PKGSRC_COMPILER</tt>:</span></dt>
2594:
2595: <dd>
2596: <p>This is a list of values specifying the chain
2597: of compilers to invoke when building packages.
2598: Valid values are:</p>
2599:
2600: <div class="itemizedlist">
2601: <ul type="disc">
2602: <li>
2603: <p><tt class="varname">distcc</tt>:
2604: distributed C/C++ (chainable)</p>
2605: </li>
2606:
2607: <li>
2608: <p><tt class="varname">ccache</tt>:
2609: compiler cache (chainable)</p>
2610: </li>
2611:
2612: <li>
2613: <p><tt class="varname">gcc</tt>: GNU C/C++
2614: Compiler</p>
2615: </li>
2616:
2617: <li>
2618: <p><tt class="varname">mipspro</tt>:
2619: Silicon Graphics, Inc. MIPSpro
2620: (n32/n64)</p>
2621: </li>
2622:
2623: <li>
2624: <p><tt class="varname">mipspro</tt>:
2625: Silicon Graphics, Inc. MIPSpro (o32)</p>
2626: </li>
2627:
2628: <li>
2629: <p><tt class="varname">sunpro</tt>:
2630: Microsystems, Inc. WorkShip/Forte/Sun ONE
2631: Studio</p>
2632: </li>
2633: </ul>
2634: </div>
2635:
2636: <p>The default is “<span class=
2637: "quote"><tt class=
2638: "varname">gcc</tt></span>”. You can use
2639: <tt class="varname">ccache</tt> and/or <tt class=
2640: "varname">distcc</tt> with an appropriate
2641: <tt class="varname">PKGSRC_COMPILER</tt> setting,
2642: e.g. “<span class="quote"><tt class=
2643: "varname">ccache gcc</tt></span>”. This
2644: variable should always be terminated with a value
2645: for a real compiler.</p>
2646: </dd>
2647:
2648: <dt><span class="term"><tt class=
2649: "varname">GCC_REQD</tt>:</span></dt>
2650:
2651: <dd>
2652: <p>This specifies the minimum version of GCC to
2653: use when building packages. If the system GCC
2654: doesn't satisfy this requirement, then pkgsrc
2655: will build and install one of the GCC packages to
2656: use instead.</p>
2657: </dd>
2658: </dl>
2659: </div>
2660: </div>
2661: </div>
2662: </div>
2663:
2664: <div class="chapter" lang="en" xml:lang="en">
2665: <div class="titlepage">
2666: <div>
2667: <div>
2668: <h2 class="title"><a name="binary" id=
2669: "binary"></a>Chapter 5. Creating binary
2670: packages</h2>
2671: </div>
2672: </div>
2673: </div>
2674:
2675: <div class="toc">
2676: <p><b>Table of Contents</b></p>
2677:
2678: <dl>
1.3 hubertf 2679: <dt><span class="sect1"><a href="#id2563004">5.1.
1.1 grant 2680: Building a single binary package</a></span></dt>
2681:
1.3 hubertf 2682: <dt><span class="sect1"><a href="#id2563082">5.2.
1.1 grant 2683: Settings for creation of binary
2684: packages</a></span></dt>
2685:
2686: <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
2687: a bulk build of all packages</a></span></dt>
2688:
2689: <dd>
2690: <dl>
2691: <dt><span class="sect2"><a href=
2692: "#binary.configuration">5.3.1.
2693: Configuration</a></span></dt>
2694:
1.3 hubertf 2695: <dt><span class="sect2"><a href="#id2563222">5.3.2.
1.1 grant 2696: Other environmental considerations</a></span></dt>
2697:
1.3 hubertf 2698: <dt><span class="sect2"><a href="#id2563262">5.3.3.
1.1 grant 2699: Operation</a></span></dt>
2700:
1.3 hubertf 2701: <dt><span class="sect2"><a href="#id2563469">5.3.4.
1.1 grant 2702: What it does</a></span></dt>
2703:
1.3 hubertf 2704: <dt><span class="sect2"><a href="#id2563526">5.3.5.
1.1 grant 2705: Disk space requirements</a></span></dt>
2706:
1.3 hubertf 2707: <dt><span class="sect2"><a href="#id2563553">5.3.6.
1.1 grant 2708: Setting up a sandbox for chroot'ed
2709: builds</a></span></dt>
2710:
1.3 hubertf 2711: <dt><span class="sect2"><a href="#id2563916">5.3.7.
1.1 grant 2712: Building a partial set of packages</a></span></dt>
2713: </dl>
2714: </dd>
2715:
1.3 hubertf 2716: <dt><span class="sect1"><a href="#id2564027">5.4.
1.1 grant 2717: Creating a multiple CD-ROM packages
2718: collection</a></span></dt>
2719:
2720: <dd>
2721: <dl>
1.3 hubertf 2722: <dt><span class="sect2"><a href="#id2564042">5.4.1.
1.1 grant 2723: Example of cdpack</a></span></dt>
2724: </dl>
2725: </dd>
2726: </dl>
2727: </div>
2728:
2729: <div class="sect1" lang="en" xml:lang="en">
2730: <div class="titlepage">
2731: <div>
2732: <div>
2733: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 2734: "id2563004" id="id2563004"></a>5.1. Building a
1.1 grant 2735: single binary package</h2>
2736: </div>
2737: </div>
2738: </div>
2739:
2740: <p>Once you have built and installed a package, you can
2741: create a <span class="emphasis"><em>binary
2742: package</em></span> which can be installed on another
2743: system with <a href=
2744: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2745: <span class="citerefentry"><span class=
2746: "refentrytitle">pkg_add</span>(1)</span></a> This saves
2747: having to build the same package on a group of hosts and
2748: wasting CPU time. It also provides a simple means for
2749: others to install your package, should you distribute
2750: it.</p>
2751:
2752: <p>To create a binary package, change into the
2753: appropriate directory in pkgsrc, and run <span><b class=
2754: "command">make package</b></span>:</p>
2755: <pre class="screen">
2756: <tt class="prompt">#</tt> <b class=
2757: "userinput"><tt>cd misc/figlet</tt></b>
2758: <tt class="prompt">#</tt> <b class=
2759: "userinput"><tt>make package</tt></b>
2760: </pre>
2761:
2762: <p>This will build and install your package (if not
2763: already done), and then build a binary package from what
2764: was installed. You can then use the <span><b class=
2765: "command">pkg_*</b></span> tools to manipulate it. Binary
2766: packages are created by default in <tt class=
2767: "filename">/usr/pkgsrc/packages</tt>, in the form of a
2768: gzipped tar file. See <a href="#logs.package" title=
2769: "B.2. Packaging figlet">Section B.2,
2770: “Packaging figlet”</a> for a continuation of
2771: the above <a xmlns=
2772: "http://www.w3.org/TR/xhtml1/transitional" href=
2773: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.2 hubertf 2774: class="pkgname">misc/figlet</a> example.</p>
1.1 grant 2775:
2776: <p>See <a href="#submit" title=
2777: "Chapter 14. Submitting and Committing">Chapter
2778: 14, <i>Submitting and Committing</i></a> for information
2779: on how to submit such a binary package.</p>
2780: </div>
2781:
2782: <div class="sect1" lang="en" xml:lang="en">
2783: <div class="titlepage">
2784: <div>
2785: <div>
2786: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 2787: "id2563082" id="id2563082"></a>5.2. Settings
1.1 grant 2788: for creation of binary packages</h2>
2789: </div>
2790: </div>
2791: </div>
2792:
2793: <p>See <a href="#build.helpful-targets" title=
2794: "11.3. Other helpful targets">Section 11.3,
2795: “Other helpful targets”</a>.</p>
2796: </div>
2797:
2798: <div class="sect1" lang="en" xml:lang="en">
2799: <div class="titlepage">
2800: <div>
2801: <div>
2802: <h2 class="title" style="clear: both"><a name=
2803: "bulkbuild" id="bulkbuild"></a>5.3. Doing a
2804: bulk build of all packages</h2>
2805: </div>
2806: </div>
2807: </div>
2808:
2809: <p>If you want to get a full set of precompiled binary
2810: packages, this section describes how to get them. Beware
2811: that the bulk build will remove all currently installed
2812: packages from your system! Having a FTP server configured
2813: either on the machine doing the bulk builds or on a
2814: nearby NFS server can help to make the packages available
2815: to everyone. See <a href=
2816: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
2817: <span class="citerefentry"><span class=
2818: "refentrytitle">ftpd</span>(8)</span></a> for more
2819: information. If you use a remote NFS server's storage, be
2820: sure to not actually compile on NFS storage, as this
2821: slows things down a lot.</p>
2822:
2823: <div class="sect2" lang="en" xml:lang="en">
2824: <div class="titlepage">
2825: <div>
2826: <div>
2827: <h3 class="title"><a name="binary.configuration"
2828: id=
2829: "binary.configuration"></a>5.3.1. Configuration</h3>
2830: </div>
2831: </div>
2832: </div>
2833:
2834: <div class="sect3" lang="en" xml:lang="en">
2835: <div class="titlepage">
2836: <div>
2837: <div>
2838: <h4 class="title"><a name="binary.mk.conf" id=
2839: "binary.mk.conf"></a>5.3.1.1. /etc/mk.conf</h4>
2840: </div>
2841: </div>
2842: </div>
2843:
2844: <p>You may want to set things in <tt class=
2845: "filename">/etc/mk.conf</tt>. Look at <tt class=
2846: "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt> for
2847: details of the default settings. You will want to
2848: ensure that <tt class=
2849: "varname">ACCEPTABLE_LICENSES</tt> meet your local
2850: policy. As used in this example, <tt class=
2851: "varname">_ACCEPTABLE=yes</tt> accepts <span class=
2852: "emphasis"><em>all</em></span> licenses.</p>
2853: <pre class="programlisting">
2854: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
2855: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
2856: BSDSRCDIR= /usr/src
2857: BSDXSRCDIR= /usr/xsrc # for x11/xservers
2858: OBJHOSTNAME?= yes # use work.`hostname`
2859: FAILOVER_FETCH= yes # insist on the correct checksum
2860: PKG_DEVELOPER?= yes
2861: _ACCEPTABLE= yes
2862: </pre>
2863: </div>
2864:
2865: <div class="sect3" lang="en" xml:lang="en">
2866: <div class="titlepage">
2867: <div>
2868: <div>
1.3 hubertf 2869: <h4 class="title"><a name="id2563146" id=
2870: "id2563146"></a>5.3.1.2. <tt class=
1.1 grant 2871: "filename">build.conf</tt></h4>
2872: </div>
2873: </div>
2874: </div>
2875:
2876: <p>In <tt class="filename">pkgsrc/mk/bulk</tt>, copy
2877: <tt class="filename">build.conf-example</tt> to
2878: <tt class="filename">build.conf</tt> and edit it,
2879: following the comments in that file. This is the
2880: config file that determines where log files are
2881: generated after the build, where to mail the build
2882: report to, where your pkgsrc tree is located and
2883: which user to <a href=
2884: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
2885: <span class="citerefentry"><span class=
2886: "refentrytitle">su</span>(8)</span></a> to to do a
2887: <span><b class="command">cvs update</b></span>.</p>
2888: </div>
2889:
2890: <div class="sect3" lang="en" xml:lang="en">
2891: <div class="titlepage">
2892: <div>
2893: <div>
1.3 hubertf 2894: <h4 class="title"><a name="id2563182" id=
2895: "id2563182"></a>5.3.1.3. <tt class=
1.1 grant 2896: "filename">pre-build.local</tt></h4>
2897: </div>
2898: </div>
2899: </div>
2900:
2901: <p>It is possible to configure the bulk build to
2902: perform certain site specific tasks at the end of the
2903: pre-build stage. If the file <tt class=
2904: "filename">pre-build.local</tt> exists in <tt class=
2905: "filename">/usr/pkgsrc/mk/bulk</tt> it will be
2906: executed (as a sh(1) script) at the end of the usual
2907: pre-build stage. An example use of <tt class=
2908: "filename">pre-build.local</tt> is to have the
2909: line:</p>
2910: <pre class="screen">
2911: <tt class="prompt">#</tt> <b class=
2912: "userinput"><tt>echo "I do not have enough disk space to build this pig." \
2913: > pkgsrc/games/crafty-book-enormous/$BROKENF</tt></b>
2914: </pre>
2915:
2916: <p>to prevent the system from trying to build a
2917: particular package which requires nearly 3 GB of disk
2918: space.</p>
2919: </div>
2920: </div>
2921:
2922: <div class="sect2" lang="en" xml:lang="en">
2923: <div class="titlepage">
2924: <div>
2925: <div>
1.3 hubertf 2926: <h3 class="title"><a name="id2563222" id=
2927: "id2563222"></a>5.3.2. Other environmental
1.1 grant 2928: considerations</h3>
2929: </div>
2930: </div>
2931: </div>
2932:
2933: <p>As <tt class="filename">/usr/pkg</tt> will be
2934: completely deleted at the start of bulk builds, make
2935: sure your login shell is placed somewhere else. Either
2936: drop it into <tt class="filename">/usr/local/bin</tt>
2937: (and adjust your login shell in the passwd file), or
2938: (re-)install it via <a href=
2939: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2940: <span class="citerefentry"><span class=
2941: "refentrytitle">pkg_add</span>(1)</span></a> from
2942: <tt class="filename">/etc/rc.local</tt>, so you can
2943: login after a reboot (remember that your current
2944: process won't die if the package is removed, you just
2945: can't start any new instances of the shell any more).
2946: Also, if you use NetBSD earlier than 1.5, or you still
2947: want to use the pkgsrc version of ssh for some reason,
2948: be sure to install ssh before starting it from
2949: <tt class="filename">rc.local</tt>:</p>
2950: <pre class="programlisting">
2951: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
2952: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
2953: /usr/pkg/etc/rc.d/sshd
2954: fi
2955: </pre>
2956:
2957: <p>Not doing so will result in you being not able to
2958: log in via ssh after the bulk build is finished or if
2959: the machine gets rebooted or crashes. You have been
2960: warned! :)</p>
2961: </div>
2962:
2963: <div class="sect2" lang="en" xml:lang="en">
2964: <div class="titlepage">
2965: <div>
2966: <div>
1.3 hubertf 2967: <h3 class="title"><a name="id2563262" id=
2968: "id2563262"></a>5.3.3. Operation</h3>
1.1 grant 2969: </div>
2970: </div>
2971: </div>
2972:
2973: <p>Make sure you don't need any of the packages still
2974: installed.</p>
2975:
2976: <div class="warning" style=
2977: "margin-left: 0.5in; margin-right: 0.5in;">
2978: <h3 class="title">Warning</h3>
2979:
2980: <p>During the bulk build, <span class=
2981: "emphasis"><em>all packages will be
2982: removed!</em></span></p>
2983: </div>
2984:
2985: <p>Be sure to remove all other things that might
2986: interfere with builds, like some libs installed in
2987: <tt class="filename">/usr/local</tt>, etc. then become
2988: root and type:</p>
2989: <pre class="screen">
2990: <tt class="prompt">#</tt> <b class=
2991: "userinput"><tt>cd /usr/pkgsrc</tt></b>
2992: <tt class="prompt">#</tt> <b class=
2993: "userinput"><tt>sh mk/bulk/build</tt></b>
2994: </pre>
2995:
2996: <p>If for some reason your last build didn't complete
2997: (power failure, system panic, ...), you can continue it
2998: by running:</p>
2999: <pre class="screen">
3000: <tt class="prompt">#</tt> <b class=
3001: "userinput"><tt>sh mk/bulk/build restart</tt></b>
3002: </pre>
3003:
3004: <p>At the end of the bulk build, you will get a summary
3005: via mail, and find build logs in the directory
3006: specified by <tt class="varname">FTP</tt> in the
3007: <tt class="filename">build.conf</tt> file.</p>
3008: </div>
3009:
3010: <div class="sect2" lang="en" xml:lang="en">
3011: <div class="titlepage">
3012: <div>
3013: <div>
1.3 hubertf 3014: <h3 class="title"><a name="id2563469" id=
3015: "id2563469"></a>5.3.4. What it does</h3>
1.1 grant 3016: </div>
3017: </div>
3018: </div>
3019:
3020: <p>The bulk builds consist of three steps:</p>
3021:
3022: <div class="variablelist">
3023: <dl>
3024: <dt><span class="term">1. pre-build</span></dt>
3025:
3026: <dd>
3027: <p>The script updates your pkgsrc tree via
3028: (anon)cvs, then cleans out any broken distfiles,
3029: and removes all packages installed.</p>
3030: </dd>
3031:
3032: <dt><span class="term">2. the bulk
3033: build</span></dt>
3034:
3035: <dd>
3036: <p>This is basically “<span class=
3037: "quote">make bulk-package</span>” with an
3038: optimised order in which packages will be built.
3039: Packages that don't require other packages will
3040: be built first, and packages with many
3041: dependencies will be built later.</p>
3042: </dd>
3043:
3044: <dt><span class="term">3. post-build</span></dt>
3045:
3046: <dd>
3047: <p>Generates a report that's placed in the
3048: directory specified in the <tt class=
3049: "filename">build.conf</tt> file named <tt class=
3050: "filename">broken.html</tt>, a short version of
3051: that report will also be mailed to the build's
3052: admin.</p>
3053: </dd>
3054: </dl>
3055: </div>
3056:
3057: <p>During the build, a list of broken packages will be
3058: compiled in <tt class=
3059: "filename">/usr/pkgsrc/.broken</tt> (or <tt class=
3060: "filename">.../.broken.${MACHINE}</tt> if <tt class=
3061: "varname">OBJMACHINE</tt> is set), individual build
3062: logs of broken builds can be found in the package's
3063: directory. These files are used by the bulk-targets to
3064: mark broken builds to not waste time trying to rebuild
3065: them, and they can be used to debug these broken
3066: package builds later.</p>
3067: </div>
3068:
3069: <div class="sect2" lang="en" xml:lang="en">
3070: <div class="titlepage">
3071: <div>
3072: <div>
1.3 hubertf 3073: <h3 class="title"><a name="id2563526" id=
3074: "id2563526"></a>5.3.5. Disk space
1.1 grant 3075: requirements</h3>
3076: </div>
3077: </div>
3078: </div>
3079:
3080: <p>Currently, roughly the following requirements are
3081: valid for NetBSD 2.0/i386:</p>
3082:
3083: <div class="itemizedlist">
3084: <ul type="disc">
3085: <li>
3086: <p>10 GB - distfiles (NFS ok)</p>
3087: </li>
3088:
3089: <li>
3090: <p>8 GB - full set of all binaries (NFS ok)</p>
3091: </li>
3092:
3093: <li>
3094: <p>5 GB - temp space for compiling (local disk
3095: recommended)</p>
3096: </li>
3097: </ul>
3098: </div>
3099:
3100: <p>Note that all pkgs will be de-installed as soon as
3101: they are turned into a binary package, and that sources
3102: are removed, so there is no excessively huge demand to
3103: disk space. Afterwards, if the package is needed again,
3104: it will be installed via <a href=
3105: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3106: <span class="citerefentry"><span class=
3107: "refentrytitle">pkg_add</span>(1)</span></a> instead of
3108: building again, so there are no cycles wasted by
3109: recompiling.</p>
3110: </div>
3111:
3112: <div class="sect2" lang="en" xml:lang="en">
3113: <div class="titlepage">
3114: <div>
3115: <div>
1.3 hubertf 3116: <h3 class="title"><a name="id2563553" id=
3117: "id2563553"></a>5.3.6. Setting up a sandbox
1.1 grant 3118: for chroot'ed builds</h3>
3119: </div>
3120: </div>
3121: </div>
3122:
3123: <p>If you don't want all the pkgs nuked from a machine
3124: (rendering it useless for anything but pkg compiling),
3125: there is the possibility of doing the pkg bulk build
3126: inside a chroot environment.</p>
3127:
3128: <p>The first step to do so is setting up a chroot
3129: sandbox, e.g. <tt class="filename">/usr/sandbox</tt>.
3130: After extracting all the sets from a NetBSD
3131: installation or doing a <span><b class="command">make
3132: distribution DESTDIR=/usr/sandbox</b></span> in
3133: <tt class="filename">/usr/src/etc</tt>, be sure the
3134: following items are present and properly
3135: configured:</p>
3136:
3137: <div class="procedure">
3138: <ol type="1">
3139: <li>
3140: <p>Kernel</p>
3141: <pre class="screen">
3142: <tt class="prompt">#</tt> <b class=
3143: "userinput"><tt>cp /netbsd /usr/sandbox</tt></b>
3144: </pre>
3145: </li>
3146:
3147: <li>
3148: <p><tt class="filename">/dev/*</tt></p>
3149: <pre class="screen">
3150: <tt class="prompt">#</tt> <b class=
3151: "userinput"><tt>cd /usr/sandbox/dev ; sh MAKEDEV all</tt></b>
3152: </pre>
3153: </li>
3154:
3155: <li>
3156: <p><tt class="filename">/etc/resolv.conf</tt>
3157: (for <a xmlns=
3158: "http://www.w3.org/TR/xhtml1/transitional" href=
3159: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.2 hubertf 3160: class="pkgname">security/smtpd</a> and
3161: mail):</p>
1.1 grant 3162: <pre class="screen">
3163: <tt class="prompt">#</tt> <b class=
3164: "userinput"><tt>cp /etc/resolv.conf /usr/sandbox/etc</tt></b>
3165: </pre>
3166: </li>
3167:
3168: <li>
3169: <p>Working(!) mail config (hostname,
3170: sendmail.cf):</p>
3171: <pre class="screen">
3172: <tt class="prompt">#</tt> <b class=
3173: "userinput"><tt>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</tt></b>
3174: </pre>
3175: </li>
3176:
3177: <li>
3178: <p><tt class="filename">/etc/localtime</tt> (for
3179: <a xmlns=
3180: "http://www.w3.org/TR/xhtml1/transitional" href=
3181: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.2 hubertf 3182: class="pkgname">security/smtpd</a>):</p>
1.1 grant 3183: <pre class="screen">
3184: <tt class="prompt">#</tt> <b class=
3185: "userinput"><tt>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</tt></b>
3186: </pre>
3187: </li>
3188:
3189: <li>
3190: <p><tt class="filename">/usr/src</tt> (system
3191: sources, for <a xmlns=
3192: "http://www.w3.org/TR/xhtml1/transitional" href=
3193: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.2 hubertf 3194: class="pkgname">sysutils/aperture</a>,
3195: <a xmlns=
3196: "http://www.w3.org/TR/xhtml1/transitional"
3197: href=
3198: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
3199: class="pkgname">net/ppp-mppe</a>):</p>
1.1 grant 3200: <pre class="screen">
3201: <tt class="prompt">#</tt> <b class=
3202: "userinput"><tt>ln -s ../disk1/cvs .</tt></b>
3203: <tt class="prompt">#</tt> <b class=
3204: "userinput"><tt>ln -s cvs/src-1.6 src</tt></b>
3205: </pre>
3206: </li>
3207:
3208: <li>
3209: <p>Create <tt class="filename">/var/db/pkg</tt>
3210: (not part of default install):</p>
3211: <pre class="screen">
3212: <tt class="prompt">#</tt> <b class=
3213: "userinput"><tt>mkdir /usr/sandbox/var/db/pkg</tt></b>
3214: </pre>
3215: </li>
3216:
3217: <li>
3218: <p>Create <tt class="filename">/usr/pkg</tt> (not
3219: part of default install):</p>
3220: <pre class="screen">
3221: <tt class="prompt">#</tt> <b class=
3222: "userinput"><tt>mkdir /usr/sandbox/usr/pkg</tt></b>
3223: </pre>
3224: </li>
3225:
3226: <li>
3227: <p>Checkout pkgsrc via cvs into <tt class=
3228: "filename">/usr/sandbox/usr/pkgsrc</tt>:</p>
3229: <pre class="screen">
3230: <tt class="prompt">#</tt> <b class=
3231: "userinput"><tt>cd /usr/sandbox/usr</tt></b>
3232: <tt class="prompt">#</tt> <b class=
3233: "userinput"><tt>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</tt></b>
3234: </pre>
3235:
3236: <p>Do not mount/link this to the copy of your
3237: pkgsrc tree you do development in, as this will
3238: likely cause problems!</p>
3239: </li>
3240:
3241: <li>
3242: <p>Make <tt class=
3243: "filename">/usr/sandbox/usr/pkgsrc/packages</tt>
3244: and <tt class="filename">.../distfiles</tt> point
3245: somewhere appropriate. NFS- and/or nullfs-mounts
3246: may come in handy!</p>
3247: </li>
3248:
3249: <li>
3250: <p>Edit <tt class="filename">/etc/mk.conf</tt>,
3251: see <a href="#binary.mk.conf" title=
3252: "5.3.1.1. /etc/mk.conf">Section 5.3.1.1,
3253: “/etc/mk.conf”</a>.</p>
3254: </li>
3255:
3256: <li>
3257: <p>Adjust <tt class=
3258: "filename">mk/bulk/build.conf</tt> to suit your
3259: needs.</p>
3260: </li>
3261:
3262: <li>
3263: <p>If you have set <tt class=
3264: "varname">CVS_USER</tt> in <tt class=
3265: "filename">build.conf</tt>, make sure that
3266: account exists and can do a <span><b class=
3267: "command">cvs ${CVS_FLAGS} update</b></span>
3268: properly!</p>
3269: </li>
3270: </ol>
3271: </div>
3272:
3273: <p>When the chroot sandbox is setup, you can start the
3274: build with the following steps:</p>
3275: <pre class="screen">
3276: <tt class="prompt">#</tt> <b class=
3277: "userinput"><tt>cd /usr/sandbox/usr/pkgsrc</tt></b>
3278: <tt class="prompt">#</tt> <b class=
3279: "userinput"><tt>sh mk/bulk/do-sandbox-build</tt></b>
3280: </pre>
3281:
3282: <p>This will just jump inside the sandbox and start
3283: building. At the end of the build, mail will be sent
3284: with the results of the build. Created binary pkgs will
3285: be in <tt class=
3286: "filename">/usr/sandbox/usr/pkgsrc/packages</tt>
3287: (wherever that points/mounts to/from).</p>
3288: </div>
3289:
3290: <div class="sect2" lang="en" xml:lang="en">
3291: <div class="titlepage">
3292: <div>
3293: <div>
1.3 hubertf 3294: <h3 class="title"><a name="id2563916" id=
3295: "id2563916"></a>5.3.7. Building a partial
1.1 grant 3296: set of packages</h3>
3297: </div>
3298: </div>
3299: </div>
3300:
3301: <p>In addition to building a complete set of all
3302: packages in pkgsrc, the <tt class=
3303: "filename">pkgsrc/mk/bulk/build</tt> script may be used
3304: to build a subset of the packages contained in pkgsrc.
3305: By setting defining <tt class=
3306: "varname">SPECIFIC_PKGS</tt> in <tt class=
3307: "filename">/etc/mk.conf</tt>, the variables</p>
3308:
3309: <div class="itemizedlist">
3310: <ul type="disc">
3311: <li>
3312: <p>SITE_SPECIFIC_PKGS</p>
3313: </li>
3314:
3315: <li>
3316: <p>HOST_SPECIFIC_PKGS</p>
3317: </li>
3318:
3319: <li>
3320: <p>GROUP_SPECIFIC_PKGS</p>
3321: </li>
3322:
3323: <li>
3324: <p>USER_SPECIFIC_PKGS</p>
3325: </li>
3326: </ul>
3327: </div>
3328:
3329: <p>will define the set of packages which should be
3330: built. The bulk build code will also include any
3331: packages which are needed as dependencies for the
3332: explicitly listed packages.</p>
3333:
3334: <p>One use of this is to do a bulk build with
3335: <tt class="varname">SPECIFIC_PKGS</tt> in a chroot
3336: sandbox periodically to have a complete set of the
3337: binary packages needed for your site available without
3338: the overhead of building extra packages that are not
3339: needed.</p>
3340: </div>
3341: </div>
3342:
3343: <div class="sect1" lang="en" xml:lang="en">
3344: <div class="titlepage">
3345: <div>
3346: <div>
3347: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 3348: "id2564027" id="id2564027"></a>5.4. Creating a
1.1 grant 3349: multiple CD-ROM packages collection</h2>
3350: </div>
3351: </div>
3352: </div>
3353:
3354: <p>After your pkgsrc bulk-build has completed, you may
3355: wish to create a CD-ROM set of the resulting binary
3356: packages to assist in installing packages on other
3357: machines. The <a xmlns=
3358: "http://www.w3.org/TR/xhtml1/transitional" href=
3359: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.2 hubertf 3360: class="pkgname">pkgtools/cdpack</a> package provides a
3361: simple tool for creating the ISO 9660 images.
3362: <span><b class="command">cdpack</b></span> arranges
3363: the packages on the CD-ROMs in a way that keeps all
3364: the dependencies for given package on the same CD as
3365: that package.</p>
1.1 grant 3366:
3367: <div class="sect2" lang="en" xml:lang="en">
3368: <div class="titlepage">
3369: <div>
3370: <div>
1.3 hubertf 3371: <h3 class="title"><a name="id2564042" id=
3372: "id2564042"></a>5.4.1. Example of
1.1 grant 3373: cdpack</h3>
3374: </div>
3375: </div>
3376: </div>
3377:
3378: <p>Complete documentation for cdpack is found in the
3379: cdpack(1) manpage. The following short example assumes
3380: that the binary packages are left in <tt class=
3381: "filename">/usr/pkgsrc/packages/All</tt> and that
3382: sufficient disk space exists in <tt class=
3383: "filename">/u2</tt> to hold the ISO 9660 images.</p>
3384: <pre class="screen">
3385: <tt class="prompt">#</tt> <b class=
3386: "userinput"><tt>mkdir /u2/images</tt></b>
3387: <tt class="prompt">#</tt> <b class=
3388: "userinput"><tt>pkg_add /usr/pkgsrc/packages/All/cdpack</tt></b>
3389: <tt class="prompt">#</tt> <b class=
3390: "userinput"><tt>cdpack /usr/pkgsrc/packages/All /u2/images</tt></b>
3391: </pre>
3392:
3393: <p>If you wish to include a common set of files
3394: (<tt class="filename">COPYRIGHT</tt>, <tt class=
3395: "filename">README</tt>, etc.) on each CD in the
3396: collection, then you need to create a directory which
3397: contains these files. e.g.</p>
3398: <pre class="screen">
3399: <tt class="prompt">#</tt> <b class=
3400: "userinput"><tt>mkdir /tmp/common</tt></b>
3401: <tt class="prompt">#</tt> <b class=
3402: "userinput"><tt>echo "This is a README" > /tmp/common/README</tt></b>
3403: <tt class="prompt">#</tt> <b class=
3404: "userinput"><tt>echo "Another file" > /tmp/common/COPYING</tt></b>
3405: <tt class="prompt">#</tt> <b class=
3406: "userinput"><tt>mkdir /tmp/common/bin</tt></b>
3407: <tt class="prompt">#</tt> <b class=
3408: "userinput"><tt>echo "#!/bin/sh" > /tmp/common/bin/myscript</tt></b>
3409: <tt class="prompt">#</tt> <b class=
3410: "userinput"><tt>echo "echo Hello world" >> /tmp/common/bin/myscript</tt></b>
3411: <tt class="prompt">#</tt> <b class=
3412: "userinput"><tt>chmod 755 /tmp/common/bin/myscript</tt></b>
3413: </pre>
3414:
3415: <p>Now create the images:</p>
3416: <pre class="screen">
3417: <tt class="prompt">#</tt> <b class=
3418: "userinput"><tt>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</tt></b>
3419: </pre>
3420:
3421: <p>Each image will contain <tt class=
3422: "filename">README</tt>, <tt class=
3423: "filename">COPYING</tt>, and <tt class=
3424: "filename">bin/myscript</tt> in their root
3425: directories.</p>
3426: </div>
3427: </div>
3428: </div>
3429:
3430: <div class="chapter" lang="en" xml:lang="en">
3431: <div class="titlepage">
3432: <div>
3433: <div>
3434: <h2 class="title"><a name="faq" id=
3435: "faq"></a>Chapter 6. Frequently Asked
3436: Questions</h2>
3437: </div>
3438: </div>
3439: </div>
3440:
3441: <div class="toc">
3442: <p><b>Table of Contents</b></p>
3443:
3444: <dl>
1.3 hubertf 3445: <dt><span class="sect1"><a href="#id2564301">6.1. Is
1.1 grant 3446: there a mailing list for pkg-related
3447: discussion?</a></span></dt>
3448:
1.3 hubertf 3449: <dt><span class="sect1"><a href="#id2564331">6.2.
1.1 grant 3450: Where's the pkgviews documentation?</a></span></dt>
3451:
1.5 ! hubertf 3452: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 3453: Utilities for package management
3454: (pkgtools)</a></span></dt>
3455:
1.5 ! hubertf 3456: <dt><span class="sect1"><a href="#id2564584">6.4. How
1.1 grant 3457: to use pkgsrc as non-root</a></span></dt>
3458:
1.5 ! hubertf 3459: <dt><span class="sect1"><a href="#id2564596">6.5. How
1.1 grant 3460: can I install/use XFree86 from pkgsrc?</a></span></dt>
3461:
1.5 ! hubertf 3462: <dt><span class="sect1"><a href="#id2564624">6.6. How
1.1 grant 3463: can I install/use X.org from pkgsrc?</a></span></dt>
3464:
1.5 ! hubertf 3465: <dt><span class="sect1"><a href="#id2564651">6.7. How
1.1 grant 3466: to fetch files from behind a firewall</a></span></dt>
3467:
1.5 ! hubertf 3468: <dt><span class="sect1"><a href="#id2564665">6.8. How
1.1 grant 3469: do I tell make fetch to do passive FTP?</a></span></dt>
3470:
1.5 ! hubertf 3471: <dt><span class="sect1"><a href="#id2564785">6.9. How
1.1 grant 3472: to fetch all distfiles at once</a></span></dt>
3473:
1.5 ! hubertf 3474: <dt><span class="sect1"><a href="#id2564993">6.10. What
1.1 grant 3475: does Don't know how to make /usr/share/tmac/tmac.andoc
3476: mean?</a></span></dt>
3477:
1.5 ! hubertf 3478: <dt><span class="sect1"><a href="#id2565031">6.11. What
1.1 grant 3479: does Could not find bsd.own.mk mean?</a></span></dt>
3480:
1.5 ! hubertf 3481: <dt><span class="sect1"><a href="#id2565089">6.12.
1.1 grant 3482: Using 'sudo' with pkgsrc</a></span></dt>
3483:
3484: <dt><span class="sect1"><a href="#faq.conf">6.13.
3485: Configuration files handling and
3486: placement</a></span></dt>
3487:
3488: <dt><span class="sect1"><a href="#audit-packages">6.14.
3489: Automated security checks</a></span></dt>
3490: </dl>
3491: </div>
3492:
3493: <p>This section contains hints, tips & tricks on
3494: special things in pkgsrc that we didn't find a better place
3495: for in the previous chapters, and it contains items for
3496: both pkgsrc users and developers.</p>
3497:
3498: <div class="sect1" lang="en" xml:lang="en">
3499: <div class="titlepage">
3500: <div>
3501: <div>
3502: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 3503: "id2564301" id="id2564301"></a>6.1. Is there a
1.1 grant 3504: mailing list for pkg-related discussion?</h2>
3505: </div>
3506: </div>
3507: </div>
3508:
3509: <p>Yes, <tt class="email"><<a href=
3510: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></tt>
3511: is the list for discussing package related issues. To
3512: subscribe do:</p>
3513: <pre class="programlisting">
3514: <tt class=
3515: "prompt">%</tt> echo subscribe tech-pkg | mail majordomo@NetBSD.org
3516: </pre>
3517:
3518: <p>An archive of the list is available at <a href=
3519: "http://mail-index.NetBSD.org/tech-pkg/" target=
3520: "_top">http://mail-index.NetBSD.org/tech-pkg/</a>.</p>
3521: </div>
3522:
3523: <div class="sect1" lang="en" xml:lang="en">
3524: <div class="titlepage">
3525: <div>
3526: <div>
3527: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 3528: "id2564331" id="id2564331"></a>6.2. Where's
1.1 grant 3529: the pkgviews documentation?</h2>
3530: </div>
3531: </div>
3532: </div>
3533:
3534: <p>Pkgviews is tightly integrated with buildlink. You can
3535: find a pkgviews User's guide in <tt class=
3536: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</tt>.</p>
3537: </div>
3538:
3539: <div class="sect1" lang="en" xml:lang="en">
3540: <div class="titlepage">
3541: <div>
3542: <div>
3543: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 3544: "faq-pkgtools" id=
! 3545: "faq-pkgtools"></a>6.3. Utilities for package
! 3546: management (pkgtools)</h2>
1.1 grant 3547: </div>
3548: </div>
3549: </div>
3550:
3551: <p>The <tt class="filename">pkgsrc/pkgtools</tt>
3552: directory pkgtools contains a number of useful utilities
3553: for both users and developers of pkgsrc. This section
3554: attempts only to make the reader aware of the utilities
3555: and when they might be useful, and not to duplicate the
3556: documentation that comes with each package.</p>
3557:
3558: <p>Utilities used by pkgsrc (automatically installed when
3559: needed):</p>
3560:
3561: <div class="itemizedlist">
3562: <ul type="disc">
3563: <li>
3564: <p><a xmlns=
3565: "http://www.w3.org/TR/xhtml1/transitional" href=
3566: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.2 hubertf 3567: class="pkgname">pkgtools/x11-links</a>: symlinks
3568: for use by buildlink</p>
1.1 grant 3569: </li>
3570: </ul>
3571: </div>
3572:
3573: <p>OS tool augmentation (automatically installed when
3574: needed):</p>
3575:
3576: <div class="itemizedlist">
3577: <ul type="disc">
3578: <li>
3579: <p><a xmlns=
3580: "http://www.w3.org/TR/xhtml1/transitional" href=
3581: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.2 hubertf 3582: class="pkgname">pkgtools/digest</a>: calculates
3583: SHA1 checksums (and other kinds)</p>
1.1 grant 3584: </li>
3585:
3586: <li>
3587: <p><a xmlns=
3588: "http://www.w3.org/TR/xhtml1/transitional" href=
3589: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.2 hubertf 3590: class="pkgname">pkgtools/libnbcompat</a>: compat
3591: library for pkg tools</p>
1.1 grant 3592: </li>
3593:
3594: <li>
3595: <p><a xmlns=
3596: "http://www.w3.org/TR/xhtml1/transitional" href=
3597: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.2 hubertf 3598: class="pkgname">pkgtools/mtree</a>: installed on
3599: non-BSD systems due to lack of native mtree</p>
1.1 grant 3600: </li>
3601:
3602: <li>
3603: <p><a xmlns=
3604: "http://www.w3.org/TR/xhtml1/transitional" href=
3605: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.2 hubertf 3606: class="pkgname">pkgtools/pkg_install</a>:
3607: up-to-date replacement for
3608: /usr/sbin/pkg_install, or for use on operating
3609: systems where pkg_install is not present</p>
1.1 grant 3610: </li>
3611: </ul>
3612: </div>
3613:
3614: <p>Utilities used by pkgsrc (not automatically
3615: installed):</p>
3616:
3617: <div class="itemizedlist">
3618: <ul type="disc">
3619: <li>
3620: <p><a xmlns=
3621: "http://www.w3.org/TR/xhtml1/transitional" href=
3622: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.2 hubertf 3623: class="pkgname">pkgtools/pkg_tarup</a>: create a
3624: binary package from an already-installed
3625: package. used by 'make replace' to save the old
3626: package</p>
1.1 grant 3627: </li>
3628:
3629: <li>
3630: <p><a xmlns=
3631: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 ! hubertf 3632: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
! 3633: class="pkgname">pkgtools/dfdisk</a>: adds extra
! 3634: functionality to pkgsrc, allowing it to fetch
! 3635: distfiles from multiple locations. It currently
! 3636: supports the following methods: multiple CD-ROMs
! 3637: and network FTP/HTTP connections.</p>
! 3638: </li>
! 3639:
! 3640: <li>
! 3641: <p><a xmlns=
! 3642: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 3643: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.2 hubertf 3644: class="pkgname">pkgtools/xpkgwedge</a>: put X11
3645: packages someplace else (enabled by default)</p>
1.1 grant 3646: </li>
1.5 ! hubertf 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/devel/cpuflags/README.html"
! 3652: class="pkgname">devel/cpuflags</a>: will
! 3653: determine the best compiler flags to optimise
! 3654: code for your current CPU and compiler.</p>
! 3655: </li>
1.1 grant 3656: </ul>
3657: </div>
3658:
3659: <p>Utilities for keeping track of installed packages,
3660: being up to date, etc:</p>
3661:
3662: <div class="itemizedlist">
3663: <ul type="disc">
3664: <li>
3665: <p><a xmlns=
3666: "http://www.w3.org/TR/xhtml1/transitional" href=
3667: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.2 hubertf 3668: class="pkgname">pkgtools/pkg_chk</a>: installs
3669: pkg_chk, which reports on packages whose
3670: installed versions do not match the latest
3671: pkgsrc entries</p>
1.1 grant 3672: </li>
3673:
3674: <li>
3675: <p><a xmlns=
3676: "http://www.w3.org/TR/xhtml1/transitional" href=
3677: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.2 hubertf 3678: class="pkgname">pkgtools/pkgdep</a>: makes
3679: dependency graphs of packages, to aid in
3680: choosing a strategy for updating</p>
1.1 grant 3681: </li>
3682:
3683: <li>
3684: <p><a xmlns=
3685: "http://www.w3.org/TR/xhtml1/transitional" href=
3686: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.2 hubertf 3687: class="pkgname">pkgtools/pkgdepgraph</a>: make
3688: graph from above (uses graphviz)</p>
1.1 grant 3689: </li>
3690:
3691: <li>
3692: <p><a xmlns=
3693: "http://www.w3.org/TR/xhtml1/transitional" href=
3694: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.2 hubertf 3695: class="pkgname">pkgtools/pkglint</a>: This
3696: provides two distinct abilities: check a pkgsrc
3697: entry for correctness (pkglint) check for and
3698: remove out-of-date distfiles and binary packages
3699: (lintpkgsrc)</p>
1.1 grant 3700: </li>
3701:
3702: <li>
3703: <p><a xmlns=
3704: "http://www.w3.org/TR/xhtml1/transitional" href=
3705: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.2 hubertf 3706: class="pkgname">pkgtools/pkgsurvey</a>: report
3707: what packages you have installed</p>
1.1 grant 3708: </li>
3709: </ul>
3710: </div>
3711:
3712: <p>Utilities for people maintaining or creating
3713: individual packages:</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/pkgdiff/README.html"
1.2 hubertf 3721: class="pkgname">pkgtools/pkgdiff</a>: automate
3722: making and maintaining patches for a package
3723: (includes pkgdiff, pkgvi, mkpatches, ...)</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/rpm2pkg/README.html"
1.2 hubertf 3730: class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
3731: "http://www.w3.org/TR/xhtml1/transitional" href=
3732: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
3733: class="pkgname">pkgtools/url2pkg</a>: aids in
3734: converting to pkgsrc</p>
1.1 grant 3735: </li>
3736:
3737: <li>
3738: <p><a xmlns=
3739: "http://www.w3.org/TR/xhtml1/transitional" href=
3740: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.2 hubertf 3741: class="pkgname">pkgtools/gensolpkg</a>: convert
3742: pkgsrc to a Solaris package</p>
1.1 grant 3743: </li>
3744: </ul>
3745: </div>
3746:
3747: <p>Utilities for people maintaining pkgsrc (or more
3748: obscure pkg utilities)</p>
3749:
3750: <div class="itemizedlist">
3751: <ul type="disc">
3752: <li>
3753: <p><a xmlns=
3754: "http://www.w3.org/TR/xhtml1/transitional" href=
3755: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.2 hubertf 3756: class="pkgname">pkgtools/pkgconflict</a>: find
3757: packages that conflict but aren't marked as
3758: such</p>
1.1 grant 3759: </li>
3760:
3761: <li>
3762: <p><a xmlns=
3763: "http://www.w3.org/TR/xhtml1/transitional" href=
3764: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.2 hubertf 3765: class="pkgname">pkgtools/pkg_comp</a>: build
3766: packages in a chrooted area</p>
1.1 grant 3767: </li>
3768:
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/libkver/README.html"
1.2 hubertf 3773: class="pkgname">pkgtools/libkver</a>: spoof
3774: kernel version for chrooted cross builds</p>
1.1 grant 3775: </li>
3776: </ul>
3777: </div>
3778: </div>
3779:
3780: <div class="sect1" lang="en" xml:lang="en">
3781: <div class="titlepage">
3782: <div>
3783: <div>
3784: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 3785: "id2564584" id="id2564584"></a>6.4. How to use
1.1 grant 3786: pkgsrc as non-root</h2>
3787: </div>
3788: </div>
3789: </div>
3790:
3791: <p>If you want to use pkgsrc as non-root user, you can
3792: set some variables to make pkgsrc work under these
3793: conditions. Please see <a href=
3794: "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.2 hubertf 3795: target="_top">this message</a> for more details.</p>
1.1 grant 3796: </div>
3797:
3798: <div class="sect1" lang="en" xml:lang="en">
3799: <div class="titlepage">
3800: <div>
3801: <div>
3802: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 3803: "id2564596" id="id2564596"></a>6.5. How can I
1.1 grant 3804: install/use XFree86 from pkgsrc?</h2>
3805: </div>
3806: </div>
3807: </div>
3808:
3809: <p>If you want to use XFree86 from pkgsrc instead of your
3810: system's own X11 (<tt class="filename">/usr/X11R6</tt>,
3811: <tt class="filename">/usr/openwin</tt>, ...), you will
3812: have to add the following lines into <tt class=
3813: "filename">mk.conf</tt>:</p>
3814: <pre class="programlisting">
3815: X11_TYPE=XFree86
3816:
3817: </pre>
3818: </div>
3819:
3820: <div class="sect1" lang="en" xml:lang="en">
3821: <div class="titlepage">
3822: <div>
3823: <div>
3824: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 3825: "id2564624" id="id2564624"></a>6.6. How can I
1.1 grant 3826: install/use X.org from pkgsrc?</h2>
3827: </div>
3828: </div>
3829: </div>
3830:
3831: <p>If you want to use X.org from pkgsrc instead of your
3832: system's own X11 (<tt class="filename">/usr/X11R6</tt>,
3833: <tt class="filename">/usr/openwin</tt>, ...) you will
3834: have to add the following lines into <tt class=
3835: "filename">mk.conf</tt>:</p>
3836: <pre class="programlisting">
3837: X11_TYPE=xorg
3838:
3839: </pre>
3840: </div>
3841:
3842: <div class="sect1" lang="en" xml:lang="en">
3843: <div class="titlepage">
3844: <div>
3845: <div>
3846: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 3847: "id2564651" id="id2564651"></a>6.7. How to
1.1 grant 3848: fetch files from behind a firewall</h2>
3849: </div>
3850: </div>
3851: </div>
3852:
3853: <p>If you are sitting behind a firewall which does not
3854: allow direct connections to Internet hosts (i.e.
3855: non-NAT), you may specify the relevant proxy hosts. This
3856: is done using an environment variable in the form of a
3857: URL e.g. in Amdahl, the machine “<span class=
3858: "quote">orpheus.amdahl.com</span>” is one of the
3859: firewalls, and it uses port 80 as the proxy port number.
3860: So the proxy environment variables are:</p>
3861: <pre class="programlisting">
3862: ftp_proxy=ftp://orpheus.amdahl.com:80/
3863: http_proxy=http://orpheus.amdahl.com:80/
3864: </pre>
3865: </div>
3866:
3867: <div class="sect1" lang="en" xml:lang="en">
3868: <div class="titlepage">
3869: <div>
3870: <div>
3871: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 3872: "id2564665" id="id2564665"></a>6.8. How do I
1.1 grant 3873: tell <span><b class="command">make fetch</b></span>
3874: to do passive FTP?</h2>
3875: </div>
3876: </div>
3877: </div>
3878:
3879: <p>This depends on which utility is used to retrieve
3880: distfiles. From <tt class="filename">bsd.pkg.mk</tt>,
3881: <tt class="varname">FETCH_CMD</tt> is assigned the first
3882: available command from the following list:</p>
3883: <pre class="programlisting">
3884: ${LOCALBASE}/bin/ftp
3885: /usr/bin/ftp
3886: </pre>
3887:
3888: <p>On a default NetBSD installation, this will be
3889: <tt class="filename">/usr/bin/ftp</tt>, which
3890: automatically tries passive connections first, and falls
3891: back to active connections if the server refuses to do
3892: passive. For the other tools, add the following to your
3893: <tt class="filename">/etc/mk.conf</tt> file: <tt class=
3894: "varname">PASSIVE_FETCH=1</tt>.</p>
3895:
3896: <p>Having that option present will prevent <tt class=
3897: "filename">/usr/bin/ftp</tt> from falling back to active
3898: transfers.</p>
3899: </div>
3900:
3901: <div class="sect1" lang="en" xml:lang="en">
3902: <div class="titlepage">
3903: <div>
3904: <div>
3905: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 3906: "id2564785" id="id2564785"></a>6.9. How to
1.1 grant 3907: fetch all distfiles at once</h2>
3908: </div>
3909: </div>
3910: </div>
3911:
3912: <p>You would like to download all the distfiles in a
3913: single batch from work or university, where you can't run
3914: a <span><b class="command">make fetch</b></span>. There
3915: is an archive of distfiles on <a href=
3916: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
3917: target="_top">ftp.NetBSD.org</a>, but downloading the
3918: entire directory may not be appropriate.</p>
3919:
3920: <p>The answer here is to do a <span><b class=
3921: "command">make fetch-list</b></span> in <tt class=
3922: "filename">/usr/pkgsrc</tt> or one of it's
3923: subdirectories, carry the resulting list to your machine
3924: at work/school and use it there If you don't have a
3925: NetBSD-compatible ftp(1) (like lukemftp) at work, don't
3926: forget to set <tt class="varname">FETCH_CMD</tt> to
3927: something that fetches a URL:</p>
3928:
3929: <p>At home:</p>
3930: <pre class="screen">
3931: <tt class="prompt">%</tt> <b class=
3932: "userinput"><tt>cd /usr/pkgsrc</tt></b>
3933: <tt class="prompt">%</tt> <b class=
3934: "userinput"><tt>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</tt></b>
3935: <tt class="prompt">%</tt> <b class=
3936: "userinput"><tt>scp /tmp/fetch.sh work:/tmp</tt></b>
3937: </pre>
3938:
3939: <p>At work:</p>
3940: <pre class="screen">
3941: <tt class="prompt">%</tt> <b class=
3942: "userinput"><tt>sh /tmp/fetch.sh</tt></b>
3943: </pre>
3944:
3945: <p>then tar up <tt class="filename">/tmp/distfiles</tt>
3946: and take it home.</p>
3947:
3948: <p>If you have a machine running NetBSD, and you want to
3949: get <span class="emphasis"><em>all</em></span> distfiles
3950: (even ones that aren't for your machine architecture),
3951: you can do so by using the above-mentioned
3952: <span><b class="command">make fetch-list</b></span>
3953: approach, or fetch the distfiles directly by running:</p>
3954: <pre class="screen">
3955: <tt class="prompt">%</tt> <b class=
3956: "userinput"><tt>make mirror-distfiles</tt></b>
3957: </pre>
3958:
3959: <p>If you even decide to ignore <tt class=
3960: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</tt>, then you can
3961: get everything by running:</p>
3962: <pre class="screen">
3963: <tt class="prompt">%</tt> <b class=
3964: "userinput"><tt>make fetch NO_SKIP=yes</tt></b>
3965: </pre>
3966: </div>
3967:
3968: <div class="sect1" lang="en" xml:lang="en">
3969: <div class="titlepage">
3970: <div>
3971: <div>
3972: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 3973: "id2564993" id="id2564993"></a>6.10. What does
1.1 grant 3974: “<span class="quote">Don't know how to make
3975: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
3976: </div>
3977: </div>
3978: </div>
3979:
3980: <p>When compiling the <a xmlns=
3981: "http://www.w3.org/TR/xhtml1/transitional" href=
3982: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.2 hubertf 3983: class="pkgname">pkgtools/pkg_install</a> package, you
3984: get the error from make that it doesn't know how to
3985: make <tt class=
3986: "filename">/usr/share/tmac/tmac.andoc</tt>? This
3987: indicates that you don't have installed the
3988: “<span class="quote">text</span>” set on
3989: your machine (nroff, ...). It is recommended to do
3990: that to format manpages.</p>
1.1 grant 3991:
3992: <p>In the case of the <a xmlns=
3993: "http://www.w3.org/TR/xhtml1/transitional" href=
3994: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.2 hubertf 3995: class="pkgname">pkgtools/pkg_install</a> package, you
3996: can get away with setting <tt class=
3997: "varname">NOMAN=YES</tt> either in the environment or
3998: in <tt class="filename">/etc/mk.conf</tt>.</p>
1.1 grant 3999: </div>
4000:
4001: <div class="sect1" lang="en" xml:lang="en">
4002: <div class="titlepage">
4003: <div>
4004: <div>
4005: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 4006: "id2565031" id="id2565031"></a>6.11. What does
1.1 grant 4007: “<span class="quote">Could not find
4008: bsd.own.mk</span>” mean?</h2>
4009: </div>
4010: </div>
4011: </div>
4012:
4013: <p>You didn't install the compiler set, <tt class=
4014: "filename">comp.tgz</tt>, when you installed your NetBSD
4015: machine. Please get it and install it, by extracting it
4016: in <tt class="filename">/</tt>:</p>
4017: <pre class="screen">
4018: <tt class="prompt">#</tt> <b class="userinput"><tt>cd /</tt></b>
4019: <tt class="prompt">#</tt> <b class=
4020: "userinput"><tt>tar --unlink -zxvpf .../comp.tgz</tt></b>
4021: </pre>
4022:
4023: <p><tt class="filename">comp.tgz</tt> is part of every
4024: NetBSD release. Get the one that corresponds to your
4025: release (determine via <span><b class="command">uname
4026: -r</b></span>).</p>
4027: </div>
4028:
4029: <div class="sect1" lang="en" xml:lang="en">
4030: <div class="titlepage">
4031: <div>
4032: <div>
4033: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 4034: "id2565089" id="id2565089"></a>6.12. Using
1.1 grant 4035: 'sudo' with pkgsrc</h2>
4036: </div>
4037: </div>
4038: </div>
4039:
4040: <p>When installing packages as non-root user and using
4041: the just-in-time su(1) feature of pkgsrc, it can become
4042: annoying to type in the root password for each required
4043: package installed. To avoid this, the sudo package can be
4044: used, which does password caching over a limited time. To
4045: use it, install sudo (either as binary package or from
4046: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
4047: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.2 hubertf 4048: class="pkgname">security/sudo</a>) and then put the
4049: following into your <tt class=
4050: "filename">/etc/mk.conf</tt>:</p>
1.1 grant 4051: <pre class="programlisting">
4052: .if exists(/usr/pkg/bin/sudo)
4053: SU_CMD=/usr/pkg/bin/sudo /bin/sh -c
4054: .endif
4055:
4056: </pre>
4057: </div>
4058:
4059: <div class="sect1" lang="en" xml:lang="en">
4060: <div class="titlepage">
4061: <div>
4062: <div>
4063: <h2 class="title" style="clear: both"><a name=
4064: "faq.conf" id=
4065: "faq.conf"></a>6.13. Configuration files
4066: handling and placement</h2>
4067: </div>
4068: </div>
4069: </div>
4070:
4071: <p>The global variable <tt class=
4072: "varname">PKG_SYSCONFBASE</tt> (and some others) can be
4073: set by the system administrator in <tt class=
4074: "filename">/etc/mk.conf</tt> to define the place where
4075: configuration files get installed. Therefore, packages
4076: must be adapted to support this feature. Keep in mind
4077: that you should only install files that are strictly
4078: necessary in the configuration directory, files that can
4079: go to <tt class="filename">$PREFIX/share</tt> should go
4080: there.</p>
4081:
4082: <p>We will take a look at available variables first
4083: (<tt class="filename">bsd.pkg.mk</tt> contains more
4084: information). <tt class="varname">PKG_SYSCONFDIR</tt> is
4085: where the configuration files for a package may be found
4086: (that is, the full path, e.g. <tt class=
4087: "filename">/etc</tt> or <tt class=
4088: "filename">/usr/pkg/etc</tt>). This value may be
4089: customized in various ways:</p>
4090:
4091: <div class="orderedlist">
4092: <ol type="1">
4093: <li>
4094: <p><tt class="varname">PKG_SYSCONFBASE</tt> is the
4095: main config directory under which all package
4096: configuration files are to be found. Users will
4097: typically want to set it to <tt class=
4098: "filename">/etc</tt>, or accept the default
4099: location of <tt class=
4100: "filename">$PREFIX/etc</tt>.</p>
4101: </li>
4102:
4103: <li>
4104: <p><tt class="varname">PKG_SYSCONFSUBDIR</tt> is
4105: the subdirectory of <tt class=
4106: "varname">PKG_SYSCONFBASE</tt> under which the
4107: configuration files for a particular package may be
4108: found. Defaults to <tt class=
4109: "varname">${SYSCONFBASE}</tt>.</p>
4110: </li>
4111:
4112: <li>
4113: <p><tt class="varname">PKG_SYSCONFVAR</tt> is the
4114: special suffix used to distinguish any overriding
4115: values for a particular package (see next item). It
4116: defaults to <tt class="varname">${PKGBASE}</tt>,
4117: but for a collection of related packages that
4118: should all have the same <tt class=
4119: "varname">PKG_SYSCONFDIR</tt> value, it can be set
4120: in each of the package Makefiles to a common
4121: value.</p>
4122: </li>
4123:
4124: <li>
4125: <p><tt class=
4126: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</tt>
4127: overrides the value of <tt class=
4128: "varname">${PKG_SYSCONFDIR}</tt> for packages with
4129: the same value for <tt class=
4130: "varname">PKG_SYSCONFVAR</tt>.</p>
4131:
4132: <p>As an example, all the various KDE packages may
4133: want to set <tt class="varname">PKG_SYSCONFVAR</tt>
4134: to “<span class="quote">kde</span>” so
4135: admins can set <tt class=
4136: "varname">PKG_SYSCONFDIR.kde</tt> in <tt class=
4137: "filename">/etc/mk.conf</tt> to define where to
4138: install KDE config files.</p>
4139: </li>
4140: </ol>
4141: </div>
4142:
4143: <p>Programs' configuration directory should be defined
4144: during the configure stage. Packages that use GNU
4145: autoconf can usually do this by using the
4146: “<span class="quote">--sysconfdir</span>”
4147: parameter, but this brings some problems as we will see
4148: now. When you change this pathname in packages, you
4149: should not allow them to install files in that directory
4150: directly. Instead they need to install those files under
4151: <tt class="filename">share/examples/${PKGNAME}</tt> so
4152: <tt class="filename">PLIST</tt> can register them.</p>
4153:
4154: <p>Once you have the required configuration files in
4155: place (under the <tt class="filename">share/examples</tt>
4156: directory) the variable <tt class=
4157: "varname">CONF_FILES</tt> should be set to copy them into
4158: <tt class="varname">PKG_SYSCONFDIR</tt>. The contents of
4159: this variable is formed by pairs of filenames; the first
4160: element of the pair specifies the file inside the
4161: examples directory (registered by <tt class=
4162: "filename">PLIST</tt>) and the second element specifies
4163: the target file. This is done this way to allow binary
4164: packages to place files in the right directory using
4165: <tt class="filename">INSTALL</tt>/<tt class=
4166: "filename">DEINSTALL</tt> scripts which are created
4167: automatically. The package <tt class=
4168: "filename">Makefile</tt> must also set <tt class=
4169: "varname">USE_PKGINSTALL=YES</tt> to use these
4170: automatically generated scripts. The automatic copying of
4171: config files can be toggled by setting the environment
4172: variable <tt class="varname">PKG_CONFIG</tt> prior to
4173: package installation.</p>
4174:
4175: <p>Here is an example, taken from mail/mutt/Makefile:</p>
4176: <pre class="programlisting">
4177: EGDIR= ${PREFIX}/share/doc/mutt/samples
4178: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
4179: </pre>
4180:
4181: <p>As you can see, this package installs configuration
4182: files inside <tt class="varname">EGDIR</tt>, which are
4183: registered by <tt class="filename">PLIST</tt>. After
4184: that, the variable <tt class="varname">CONF_FILES</tt>
4185: lists the installed file first and then the target file.
4186: Users will also get an automatic message when files are
4187: installed using this method.</p>
4188: </div>
4189:
4190: <div class="sect1" lang="en" xml:lang="en">
4191: <div class="titlepage">
4192: <div>
4193: <div>
4194: <h2 class="title" style="clear: both"><a name=
4195: "audit-packages" id=
4196: "audit-packages"></a>6.14. Automated security
4197: checks</h2>
4198: </div>
4199: </div>
4200: </div>
4201:
4202: <p>Please be aware that there can often be bugs in
4203: third-party software, and some of these bugs can leave a
4204: machine vulnerable to exploitation by attackers. In an
4205: effort to lessen the exposure, the NetBSD packages team
4206: maintains a database of known-exploits to packages which
4207: have at one time been included in pkgsrc. The database
4208: can be downloaded automatically, and a security audit of
4209: all packages installed on a system can take place. To do
4210: this, install the <a xmlns=
4211: "http://www.w3.org/TR/xhtml1/transitional" href=
4212: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.2 hubertf 4213: class="pkgname">security/audit-packages</a> package.
4214: It has two components:</p>
1.1 grant 4215:
4216: <div class="orderedlist">
4217: <ol type="1">
4218: <li>
4219: <p>“<span class=
4220: "quote">download-vulnerability-list</span>”,
4221: an easy way to download a list of the security
4222: vulnerabilities information. This list is kept up
4223: to date by the NetBSD security officer and the
4224: NetBSD packages team, and is distributed from the
4225: NetBSD ftp server:</p>
4226:
4227: <p><a href=
4228: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.2 hubertf 4229: target=
4230: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 4231: </li>
4232:
4233: <li>
4234: <p>“<span class=
4235: "quote">audit-packages</span>”, an easy way
4236: to audit the current machine, checking each
4237: vulnerability which is known. If a vulnerable
4238: package is installed, it will be shown by output to
4239: stdout, including a description of the type of
4240: vulnerability, and a URL containing more
4241: information.</p>
4242: </li>
4243: </ol>
4244: </div>
4245:
4246: <p>Use of the audit-packages package is strongly
4247: recommended!</p>
4248:
4249: <p>The following message is displayed as part of the
4250: audit-packages installation procedure:</p>
4251: <pre class="screen">
4252: ===========================================================================
4253: $NetBSD: faq.xml,v 1.1.1.1 2004/10/21 14:27:43 grant Exp $
4254:
4255: You may wish to have the vulnerabilities file downloaded daily so that
4256: it remains current. This may be done by adding an appropriate entry
4257: to the root users crontab(5) entry. For example the entry
4258:
4259: # download vulnerabilities file
4260: 0 3 * * * ${PREFIX}/sbin/download-vulnerability-list >/dev/null 2>&1
4261:
4262: will update the vulnerability list every day at 3AM. You may wish to do
4263: this more often than once a day.
4264:
4265: In addition, you may wish to run the package audit from the daily
4266: security script. This may be accomplished by adding the following
4267: lines to /etc/security.local
4268:
4269: if [ -x ${PREFIX}/sbin/audit-packages ]; then
4270: ${PREFIX}/sbin/audit-packages
4271: fi
4272:
4273: ===========================================================================
4274:
4275: </pre>
4276: </div>
4277: </div>
4278: </div>
4279:
4280: <div class="part" lang="en" xml:lang="en">
4281: <div class="titlepage">
4282: <div>
4283: <div>
4284: <h1 class="title"><a name="developers-guide" id=
1.2 hubertf 4285: "developers-guide"></a>The pkgsrc developer's
4286: guide</h1>
1.1 grant 4287: </div>
4288: </div>
4289: </div>
4290:
4291: <div class="toc">
4292: <p><b>Table of Contents</b></p>
4293:
4294: <dl>
4295: <dt><span class="chapter"><a href="#components">7.
4296: Package components - files, directories and
4297: contents</a></span></dt>
4298:
4299: <dd>
4300: <dl>
4301: <dt><span class="sect1"><a href=
4302: "#components.Makefile">7.1. Makefile</a></span></dt>
4303:
4304: <dt><span class="sect1"><a href=
4305: "#components.distinfo">7.2. distinfo</a></span></dt>
4306:
4307: <dt><span class="sect1"><a href=
4308: "#components.patches">7.3. patches/*</a></span></dt>
4309:
1.5 ! hubertf 4310: <dt><span class="sect1"><a href="#id2566134">7.4.
1.1 grant 4311: Other mandatory files</a></span></dt>
4312:
4313: <dt><span class="sect1"><a href=
4314: "#components.optional">7.5. Optional
4315: files</a></span></dt>
4316:
1.5 ! hubertf 4317: <dt><span class="sect1"><a href="#id2566396">7.6.
1.1 grant 4318: work*</a></span></dt>
4319:
1.5 ! hubertf 4320: <dt><span class="sect1"><a href="#id2566484">7.7.
1.1 grant 4321: files/*</a></span></dt>
4322: </dl>
4323: </dd>
4324:
4325: <dt><span class="chapter"><a href="#plist">8. PLIST
4326: issues</a></span></dt>
4327:
4328: <dd>
4329: <dl>
1.5 ! hubertf 4330: <dt><span class="sect1"><a href="#id2566538">8.1. RCS
1.1 grant 4331: ID</a></span></dt>
4332:
1.5 ! hubertf 4333: <dt><span class="sect1"><a href="#id2566621">8.2.
1.1 grant 4334: Semi-automatic PLIST generation</a></span></dt>
4335:
4336: <dt><span class="sect1"><a href="#print-PLIST">8.3.
4337: Tweaking output of make print-PLIST</a></span></dt>
4338:
4339: <dt><span class="sect1"><a href="#plist.misc">8.4.
4340: Variable substitution in PLIST</a></span></dt>
4341:
1.5 ! hubertf 4342: <dt><span class="sect1"><a href="#id2566874">8.5.
1.1 grant 4343: Manpage-compression</a></span></dt>
4344:
1.5 ! hubertf 4345: <dt><span class="sect1"><a href="#id2566916">8.6.
1.1 grant 4346: Changing PLIST source with PLIST_SRC</a></span></dt>
4347:
1.5 ! hubertf 4348: <dt><span class="sect1"><a href="#id2566933">8.7.
1.1 grant 4349: Platform specific and differing
4350: PLISTs</a></span></dt>
4351:
4352: <dt><span class="sect1"><a href=
4353: "#faq.common-dirs">8.8. Sharing directories between
4354: packages</a></span></dt>
4355: </dl>
4356: </dd>
4357:
4358: <dt><span class="chapter"><a href="#buildlink">9.
4359: Buildlink methodology</a></span></dt>
4360:
4361: <dd>
4362: <dl>
1.5 ! hubertf 4363: <dt><span class="sect1"><a href="#id2567137">9.1.
1.1 grant 4364: Converting packages to use buildlink3</a></span></dt>
4365:
1.5 ! hubertf 4366: <dt><span class="sect1"><a href="#id2567532">9.2.
1.1 grant 4367: Writing buildlink3.mk files</a></span></dt>
4368:
4369: <dd>
4370: <dl>
4371: <dt><span class="sect2"><a href=
1.5 ! hubertf 4372: "#id2567670">9.2.1. Anatomy of a buildlink3.mk
1.1 grant 4373: file</a></span></dt>
4374:
4375: <dt><span class="sect2"><a href=
1.5 ! hubertf 4376: "#id2568110">9.2.2. Updating
1.1 grant 4377: BUILDLINK_DEPENDS.pkg in buildlink3.mk
4378: files</a></span></dt>
4379: </dl>
4380: </dd>
4381:
1.5 ! hubertf 4382: <dt><span class="sect1"><a href="#id2568189">9.3.
1.1 grant 4383: Writing builtin.mk files</a></span></dt>
4384:
4385: <dd>
4386: <dl>
4387: <dt><span class="sect2"><a href=
1.5 ! hubertf 4388: "#id2568270">9.3.1. Anatomy of a builtin.mk
1.1 grant 4389: file</a></span></dt>
4390:
4391: <dt><span class="sect2"><a href=
1.5 ! hubertf 4392: "#id2568566">9.3.2. Global preferences for native
1.1 grant 4393: or pkgsrc software</a></span></dt>
4394: </dl>
4395: </dd>
4396: </dl>
4397: </dd>
4398:
4399: <dt><span class="chapter"><a href="#options">10. Options
4400: handling</a></span></dt>
4401:
4402: <dd>
4403: <dl>
1.5 ! hubertf 4404: <dt><span class="sect1"><a href="#id2568638">10.1.
1.1 grant 4405: Global default options</a></span></dt>
4406:
1.5 ! hubertf 4407: <dt><span class="sect1"><a href="#id2568653">10.2.
1.1 grant 4408: Converting packages to use
4409: bsd.options.mk</a></span></dt>
4410: </dl>
4411: </dd>
4412:
4413: <dt><span class="chapter"><a href="#build">11. The build
4414: process</a></span></dt>
4415:
4416: <dd>
4417: <dl>
4418: <dt><span class="sect1"><a href="#build.prefix">11.1.
4419: Program location</a></span></dt>
4420:
1.5 ! hubertf 4421: <dt><span class="sect1"><a href="#id2569330">11.2.
1.1 grant 4422: Main targets</a></span></dt>
4423:
4424: <dt><span class="sect1"><a href=
4425: "#build.helpful-targets">11.3. Other helpful
4426: targets</a></span></dt>
4427: </dl>
4428: </dd>
4429:
4430: <dt><span class="chapter"><a href="#fixes">12. Notes on
4431: fixes for packages</a></span></dt>
4432:
4433: <dd>
4434: <dl>
1.5 ! hubertf 4435: <dt><span class="sect1"><a href="#id2570795">12.1.
1.1 grant 4436: General operation</a></span></dt>
4437:
4438: <dd>
4439: <dl>
4440: <dt><span class="sect2"><a href=
1.5 ! hubertf 4441: "#id2570798">12.1.1. How to pull in variables
1.1 grant 4442: from /etc/mk.conf</a></span></dt>
4443:
4444: <dt><span class="sect2"><a href=
1.5 ! hubertf 4445: "#id2570882">12.1.2. Restricted
1.1 grant 4446: packages</a></span></dt>
4447:
4448: <dt><span class="sect2"><a href=
4449: "#dependencies">12.1.3. Handling
4450: dependencies</a></span></dt>
4451:
4452: <dt><span class="sect2"><a href=
1.5 ! hubertf 4453: "#id2571260">12.1.4. Handling conflicts with
1.1 grant 4454: other packages</a></span></dt>
4455:
4456: <dt><span class="sect2"><a href=
1.5 ! hubertf 4457: "#id2571447">12.1.5. Packages that cannot or
1.1 grant 4458: should not be built</a></span></dt>
4459:
4460: <dt><span class="sect2"><a href=
1.5 ! hubertf 4461: "#id2571473">12.1.6. Packages which should not be
1.1 grant 4462: deleted, once installed</a></span></dt>
4463:
4464: <dt><span class="sect2"><a href=
4465: "#security-handling">12.1.7. Handling packages
4466: with security problems</a></span></dt>
4467:
4468: <dt><span class="sect2"><a href=
1.5 ! hubertf 4469: "#id2571564">12.1.8. How to handle compiler
1.1 grant 4470: bugs</a></span></dt>
4471:
4472: <dt><span class="sect2"><a href=
1.5 ! hubertf 4473: "#id2571587">12.1.9. How to handle incrementing
1.1 grant 4474: versions when fixing an existing
4475: package</a></span></dt>
4476:
4477: <dt><span class="sect2"><a href=
1.5 ! hubertf 4478: "#id2571704">12.1.10. Portability of
1.1 grant 4479: packages</a></span></dt>
4480: </dl>
4481: </dd>
4482:
1.5 ! hubertf 4483: <dt><span class="sect1"><a href="#id2571729">12.2.
1.1 grant 4484: Possible downloading issues</a></span></dt>
4485:
4486: <dd>
4487: <dl>
4488: <dt><span class="sect2"><a href=
1.5 ! hubertf 4489: "#id2571732">12.2.1. Packages whose distfiles
1.1 grant 4490: aren't available for plain
4491: downloading</a></span></dt>
4492:
4493: <dt><span class="sect2"><a href=
1.5 ! hubertf 4494: "#id2571795">12.2.2. How to handle modified
1.1 grant 4495: distfiles with the 'old' name</a></span></dt>
4496: </dl>
4497: </dd>
4498:
1.5 ! hubertf 4499: <dt><span class="sect1"><a href="#id2571806">12.3.
1.1 grant 4500: Configuration gotchas</a></span></dt>
4501:
4502: <dd>
4503: <dl>
4504: <dt><span class="sect2"><a href=
4505: "#fixes.libtool">12.3.1. Shared libraries -
4506: libtool</a></span></dt>
4507:
4508: <dt><span class="sect2"><a href=
1.5 ! hubertf 4509: "#id2572350">12.3.2. Using libtool on GNU
1.1 grant 4510: packages that already support
4511: libtool</a></span></dt>
4512:
4513: <dt><span class="sect2"><a href=
1.5 ! hubertf 4514: "#id2572435">12.3.3. GNU
1.1 grant 4515: Autoconf/Automake</a></span></dt>
4516: </dl>
4517: </dd>
4518:
1.5 ! hubertf 4519: <dt><span class="sect1"><a href="#id2572480">12.4.
1.1 grant 4520: Building considerations</a></span></dt>
4521:
4522: <dd>
4523: <dl>
4524: <dt><span class="sect2"><a href=
1.5 ! hubertf 4525: "#id2572483">12.4.1. CPP defines</a></span></dt>
1.1 grant 4526: </dl>
4527: </dd>
4528:
1.5 ! hubertf 4529: <dt><span class="sect1"><a href="#id2572513">12.5.
1.1 grant 4530: Package specific actions</a></span></dt>
4531:
4532: <dd>
4533: <dl>
4534: <dt><span class="sect2"><a href=
1.5 ! hubertf 4535: "#id2572516">12.5.1. Package configuration
1.1 grant 4536: files</a></span></dt>
4537:
4538: <dt><span class="sect2"><a href=
1.5 ! hubertf 4539: "#id2572618">12.5.2. User
1.2 hubertf 4540: interaction</a></span></dt>
1.1 grant 4541:
4542: <dt><span class="sect2"><a href=
1.5 ! hubertf 4543: "#id2572663">12.5.3. Handling
1.1 grant 4544: licenses</a></span></dt>
4545:
4546: <dt><span class="sect2"><a href=
1.5 ! hubertf 4547: "#id2572746">12.5.4. Creating an account from a
1.1 grant 4548: package</a></span></dt>
4549:
4550: <dt><span class="sect2"><a href=
1.5 ! hubertf 4551: "#id2572876">12.5.5. Installing score
1.1 grant 4552: files</a></span></dt>
4553:
4554: <dt><span class="sect2"><a href=
1.5 ! hubertf 4555: "#id2573057">12.5.6. Packages providing login
1.1 grant 4556: shells</a></span></dt>
4557:
4558: <dt><span class="sect2"><a href=
1.5 ! hubertf 4559: "#id2573182">12.5.7. Packages containing perl
1.1 grant 4560: scripts</a></span></dt>
4561:
4562: <dt><span class="sect2"><a href=
1.5 ! hubertf 4563: "#id2573201">12.5.8. Packages with hardcoded
1.1 grant 4564: paths to other interpreters</a></span></dt>
4565:
4566: <dt><span class="sect2"><a href=
1.5 ! hubertf 4567: "#id2573222">12.5.9. Packages installing perl
1.1 grant 4568: modules</a></span></dt>
4569:
4570: <dt><span class="sect2"><a href=
4571: "#faq.info-files">12.5.10. Packages installing
4572: info files</a></span></dt>
4573:
4574: <dt><span class="sect2"><a href=
1.5 ! hubertf 4575: "#id2573442">12.5.11. Packages installing GConf2
1.1 grant 4576: data files</a></span></dt>
4577:
4578: <dt><span class="sect2"><a href=
1.5 ! hubertf 4579: "#id2573610">12.5.12. Packages installing
1.1 grant 4580: scrollkeeper data files</a></span></dt>
4581:
4582: <dt><span class="sect2"><a href=
1.5 ! hubertf 4583: "#id2573661">12.5.13. Packages installing X11
1.1 grant 4584: fonts</a></span></dt>
4585:
4586: <dt><span class="sect2"><a href=
1.5 ! hubertf 4587: "#id2573708">12.5.14. Packages installing GTK2
1.1 grant 4588: modules</a></span></dt>
4589:
4590: <dt><span class="sect2"><a href=
1.5 ! hubertf 4591: "#id2573778">12.5.15. Packages installing SGML or
1.1 grant 4592: XML data</a></span></dt>
4593:
4594: <dt><span class="sect2"><a href=
1.5 ! hubertf 4595: "#id2573830">12.5.16. Packages installing
1.1 grant 4596: extensions to the MIME database</a></span></dt>
4597:
4598: <dt><span class="sect2"><a href=
1.5 ! hubertf 4599: "#id2573969">12.5.17. Packages using
1.1 grant 4600: intltool</a></span></dt>
4601: </dl>
4602: </dd>
4603:
1.5 ! hubertf 4604: <dt><span class="sect1"><a href="#id2573982">12.6.
1.1 grant 4605: Feedback to the author</a></span></dt>
4606: </dl>
4607: </dd>
4608:
4609: <dt><span class="chapter"><a href="#debug">13.
4610: Debugging</a></span></dt>
4611:
4612: <dt><span class="chapter"><a href="#submit">14.
4613: Submitting and Committing</a></span></dt>
4614:
4615: <dd>
4616: <dl>
1.5 ! hubertf 4617: <dt><span class="sect1"><a href="#id2574444">14.1.
1.1 grant 4618: Submitting your packages</a></span></dt>
4619:
1.5 ! hubertf 4620: <dt><span class="sect1"><a href="#id2574491">14.2.
1.1 grant 4621: Committing: Importing a package into
4622: CVS</a></span></dt>
4623:
1.5 ! hubertf 4624: <dt><span class="sect1"><a href="#id2574691">14.3.
1.2 hubertf 4625: Updating a package to a newer version</a></span></dt>
1.1 grant 4626:
1.5 ! hubertf 4627: <dt><span class="sect1"><a href="#id2574710">14.4.
1.2 hubertf 4628: Moving a package in pkgsrc</a></span></dt>
1.1 grant 4629: </dl>
4630: </dd>
4631: </dl>
4632: </div>
4633:
4634: <div class="chapter" lang="en" xml:lang="en">
4635: <div class="titlepage">
4636: <div>
4637: <div>
4638: <h2 class="title"><a name="components" id=
4639: "components"></a>Chapter 7. Package
4640: components - files, directories and contents</h2>
4641: </div>
4642: </div>
4643: </div>
4644:
4645: <div class="toc">
4646: <p><b>Table of Contents</b></p>
4647:
4648: <dl>
4649: <dt><span class="sect1"><a href=
4650: "#components.Makefile">7.1. Makefile</a></span></dt>
4651:
4652: <dt><span class="sect1"><a href=
4653: "#components.distinfo">7.2. distinfo</a></span></dt>
4654:
4655: <dt><span class="sect1"><a href=
4656: "#components.patches">7.3. patches/*</a></span></dt>
4657:
1.5 ! hubertf 4658: <dt><span class="sect1"><a href="#id2566134">7.4. Other
1.1 grant 4659: mandatory files</a></span></dt>
4660:
4661: <dt><span class="sect1"><a href=
4662: "#components.optional">7.5. Optional
4663: files</a></span></dt>
4664:
1.5 ! hubertf 4665: <dt><span class="sect1"><a href="#id2566396">7.6.
1.1 grant 4666: work*</a></span></dt>
4667:
1.5 ! hubertf 4668: <dt><span class="sect1"><a href="#id2566484">7.7.
1.1 grant 4669: files/*</a></span></dt>
4670: </dl>
4671: </div>
4672:
4673: <p>Whenever you're preparing a package, there are a number
4674: of files involved which are described in the following
4675: sections.</p>
4676:
4677: <div class="sect1" lang="en" xml:lang="en">
4678: <div class="titlepage">
4679: <div>
4680: <div>
4681: <h2 class="title" style="clear: both"><a name=
4682: "components.Makefile" id=
4683: "components.Makefile"></a>7.1. <tt class=
4684: "filename">Makefile</tt></h2>
4685: </div>
4686: </div>
4687: </div>
4688:
4689: <p>Building, installation and creation of a binary
4690: package are all controlled by the package's <tt class=
4691: "filename">Makefile</tt>.</p>
4692:
4693: <p>There is a <tt class="filename">Makefile</tt> for each
4694: package. This file includes the standard <tt class=
4695: "filename">bsd.pkg.mk</tt> file (referenced as <tt class=
4696: "filename">../../mk/bsd.pkg.mk</tt>), which sets all the
4697: definitions and actions necessary for the package to
4698: compile and install itself. The mandatory variables are
4699: the <tt class="varname">DISTNAME</tt> which specifies the
4700: base name of the distribution file to be downloaded from
4701: the site on the Internet, <tt class=
4702: "varname">MASTER_SITES</tt> which specifies that site,
4703: <tt class="varname">CATEGORIES</tt> which denotes the
4704: categories into which the package falls, <tt class=
4705: "varname">PKGNAME</tt> which is the name of the package,
4706: the <tt class="varname">MAINTAINER</tt>'s name, and the
4707: <tt class="varname">COMMENT</tt> variable, which should
4708: contain a one-line description of the package (the
4709: package name should not appear, it will be added
4710: automatically). The maintainer variable is there so that
4711: anyone who quibbles with the (always completely correct)
4712: decisions taken by the guy who maintains the package can
4713: complain vigorously, or send chocolate as a sign of
4714: appreciation.</p>
4715:
4716: <p>The <tt class="varname">MASTER_SITES</tt> may be set
4717: to one of the predefined sites:</p>
4718: <pre class="programlisting">
4719: ${MASTER_SITE_APACHE}
4720: ${MASTER_SITE_DEBIAN}
4721: ${MASTER_SITE_GNOME}
4722: ${MASTER_SITE_GNU}
4723: ${MASTER_SITE_GNUSTEP}
4724: ${MASTER_SITE_MOZILLA}
4725: ${MASTER_SITE_PERL_CPAN}
4726: ${MASTER_SITE_SOURCEFORGE}
4727: ${MASTER_SITE_SUNSITE}
4728: ${MASTER_SITE_R_CRAN}
4729: ${MASTER_SITE_SUSE}
4730: ${MASTER_SITE_TEX_CTAN}
4731: ${MASTER_SITE_XCONTRIB}
4732: ${MASTER_SITE_XEMACS}
4733: </pre>
4734:
4735: <p>If one of these predefined sites is chosen, you may
4736: require the ability to specify a subdirectory of that
4737: site. Since these macros may expand to more than one
4738: actual site, you <span class=
4739: "emphasis"><em>must</em></span> use the following
4740: construct to specify a subdirectory:</p>
4741: <pre class="programlisting">
4742: ${MASTER_SITE_GNU:=subdirectory/name/}
4743: ${MASTER_SITE_SOURCEFORGE:=project_name/}
4744: </pre>
4745:
4746: <p>Note the trailing slash after the subdirectory
4747: name.</p>
4748:
4749: <div class="note" style=
4750: "margin-left: 0.5in; margin-right: 0.5in;">
4751: <h3 class="title">Note</h3>
4752:
4753: <p><tt class="varname">MASTER_SITE_SUBDIR</tt> has been
4754: deprecated and <span class="emphasis"><em>should no
4755: longer be used</em></span>.</p>
4756: </div>
4757:
4758: <p>If the package has multiple <tt class=
4759: "varname">DISTFILES</tt> or multiple <tt class=
4760: "varname">PATCHFILES</tt> from different sites, set
4761: <tt class="varname">SITES_foo</tt> to a list of URI's
4762: where file “<span class="quote">foo</span>”
4763: may be found. “<span class=
4764: "quote">foo</span>” includes the suffix, e.g.</p>
4765: <pre class="programlisting">
4766: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
4767: DISTFILES+= foo-file.tar.gz
4768: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
4769: http://www.somewhereelse.com/mirror/somehow/
4770: </pre>
4771:
4772: <p>Note that the normal default setting of <tt class=
4773: "varname">DISTFILES</tt> must be made explicit if you
4774: want to add to it (rather than replace it), as you
4775: usually would.</p>
4776:
4777: <p>Currently the following values are available for
4778: <tt class="varname">CATEGORIES</tt>. If more than one is
4779: used, they need to be separated by spaces:</p>
4780: <pre class="programlisting">
4781: archivers cross geography meta-pkgs security
4782: audio databases graphics misc shells
4783: benchmarks devel ham multimedia sysutils
4784: biology editors inputmethod net textproc
4785: cad emulators lang news time
4786: chat finance mail parallel wm
4787: comms fonts math pkgtools www
4788: converters games mbone print x11
4789: </pre>
4790:
4791: <p>Please pay attention to the following gotchas:</p>
4792:
4793: <div class="itemizedlist">
4794: <ul type="disc">
4795: <li>
4796: <p>Add <tt class="varname">MANCOMPRESSED</tt> if
4797: manpages are installed in compressed form by the
4798: package; see comment in <tt class=
4799: "filename">bsd.pkg.mk</tt>.</p>
4800: </li>
4801:
4802: <li>
4803: <p>Replace <tt class="filename">/usr/local</tt>
4804: with “<span class=
4805: "quote">${PREFIX}</span>” in all files (see
4806: patches, below).</p>
4807: </li>
4808:
4809: <li>
4810: <p>If the package installs any info files, see
4811: <a href="#faq.info-files" title=
4812: "12.5.10. Packages installing info files">Section
4813: 12.5.10, “Packages installing info
4814: files”</a>.</p>
4815: </li>
4816:
4817: <li>
4818: <p>Set <tt class="varname">MAINTAINER</tt> to be
4819: yourself. If you really can't maintain the package
4820: for future updates, set it to <tt class=
4821: "email"><<a href=
4822: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></tt>.</p>
4823: </li>
4824:
4825: <li>
4826: <p>If a home page for the software in question
4827: exists, add the variable <tt class=
4828: "varname">HOMEPAGE</tt> right after <tt class=
4829: "varname">MAINTAINER</tt>. The value of this
4830: variable should be the URL for the home page.</p>
4831: </li>
4832:
4833: <li>
4834: <p>Be sure to set the <tt class=
4835: "varname">COMMENT</tt> variable to a short
4836: description of the package, not containing the
4837: pkg's name.</p>
4838: </li>
4839: </ul>
4840: </div>
4841: </div>
4842:
4843: <div class="sect1" lang="en" xml:lang="en">
4844: <div class="titlepage">
4845: <div>
4846: <div>
4847: <h2 class="title" style="clear: both"><a name=
4848: "components.distinfo" id=
4849: "components.distinfo"></a>7.2. <tt class=
4850: "filename">distinfo</tt></h2>
4851: </div>
4852: </div>
4853: </div>
4854:
4855: <p>Most important, the mandatory message digest, or
4856: checksum, of all the distfiles needed for the package to
4857: compile, confirming they match the original file
4858: distributed by the author. This ensures that the distfile
4859: retrieved from the Internet has not been corrupted during
4860: transfer or altered by a malign force to introduce a
4861: security hole. It is generated using the <span><b class=
4862: "command">make makesum</b></span> command. The digest
4863: algorithm used was, at one stage, md5, but that was felt
4864: lacking compared to sha1, and so sha1 is now the default
4865: algorithm. The distfile size is also generated and stored
4866: in new distinfo files. The <a xmlns=
4867: "http://www.w3.org/TR/xhtml1/transitional" href=
4868: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.2 hubertf 4869: class="pkgname">pkgtools/digest</a> utility calculates
4870: all of the digests in the distinfo file, and it
4871: provides various different algorithms. At the current
4872: time, the algorithms provided are: <span class=
4873: "emphasis"><em>md5</em></span>, <span class=
4874: "emphasis"><em>rmd160</em></span>, <span class=
4875: "emphasis"><em>sha1</em></span>, <span class=
4876: "emphasis"><em>sha256</em></span>, <span class=
4877: "emphasis"><em>sha384</em></span> and <span class=
4878: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 4879:
4880: <p>Some packages have different sets of distfiles on a
4881: per architecture basis, for example <a xmlns=
4882: "http://www.w3.org/TR/xhtml1/transitional" href=
4883: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.2 hubertf 4884: class="pkgname">www/navigator</a>). These are kept in
4885: the same distinfo file and care should be taken when
4886: upgrading such a package to ensure distfile
4887: information is not lost.</p>
1.1 grant 4888:
4889: <p>The message digest/checksum for all the official
4890: patches found in the <tt class="filename">patches/</tt>
4891: directory (see <a href="#components.patches" title=
4892: "7.3. patches/*">Section 7.3,
4893: “patches/*”</a>) for the package is also
4894: stored in the <tt class="filename">distinfo</tt> file.
4895: This is a message digest/checksum of all lines in the
4896: patch file except the NetBSD RCS Id. This file is
4897: generated by invoking <span><b class="command">make
4898: makepatchsum</b></span> (or <span><b class="command">make
4899: mps</b></span> if you're in a hurry).</p>
4900: </div>
4901:
4902: <div class="sect1" lang="en" xml:lang="en">
4903: <div class="titlepage">
4904: <div>
4905: <div>
4906: <h2 class="title" style="clear: both"><a name=
4907: "components.patches" id=
4908: "components.patches"></a>7.3. patches/*</h2>
4909: </div>
4910: </div>
4911: </div>
4912:
4913: <p>This directory contains files that are used by the
4914: <a href=
4915: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
4916: <span class="citerefentry"><span class=
4917: "refentrytitle">patch</span>(1)</span></a> command to
4918: modify the sources as distributed in the distribution
4919: file into a form that will compile and run perfectly on
4920: NetBSD. The files are applied successively in alphabetic
4921: order (as returned by a shell “<span class=
4922: "quote">patches/patch-*</span>” glob expansion), so
4923: <tt class="filename">patch-aa</tt> is applied before
4924: <tt class="filename">patch-ab</tt>, etc.</p>
4925:
4926: <p>The <tt class="filename">patch-*</tt> files should be
4927: in <span><b class="command">diff -bu</b></span> format,
4928: and apply without a fuzz to avoid problems. (To force
4929: patches to apply with fuzz you can set <tt class=
4930: "varname">PATCH_FUZZ_FACTOR=-F2</tt>). Furthermore, do
4931: not put changes for more than one file into a single
4932: patch-file, as this will make future modifications more
4933: difficult.</p>
4934:
4935: <p>Similar, a file should be patched at most once, not
4936: several times by several different patches. If a file
4937: needs several patches, they should be combined into one
4938: file.</p>
4939:
4940: <p>One important thing to mention is to pay attention
4941: that no RCS IDs get stored in the patch files, as these
4942: will cause problems when later checked into the NetBSD
4943: CVS tree. Use the <span><b class=
4944: "command">pkgdiff</b></span> from the <a xmlns=
4945: "http://www.w3.org/TR/xhtml1/transitional" href=
4946: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.2 hubertf 4947: class="pkgname">pkgtools/pkgdiff</a> package to avoid
4948: these problems.</p>
1.1 grant 4949:
4950: <p>For even more automation, we recommend using
4951: <span><b class="command">mkpatches</b></span> from the
4952: same package to make a whole set of patches. You just
4953: have to backup files before you edit them to <tt class=
4954: "filename">filename.orig</tt>, e.g. with <span><b class=
4955: "command">cp -p filename filename.orig</b></span> or,
4956: easier, by using <span><b class=
4957: "command">pkgvi</b></span> again from the same package.
4958: If you upgrade a package this way, you can easily compare
4959: the new set of patches with the previously existing one
4960: with <span><b class="command">patchdiff</b></span>.</p>
4961:
4962: <p>When you have finished a package, remember to generate
4963: the checksums for the patch files by using the
4964: <span><b class="command">make makepatchsum</b></span>
4965: command, see <a href="#components.distinfo" title=
1.5 ! hubertf 4966: "7.2. distinfo">Section 7.2,
1.1 grant 4967: “distinfo”</a>.</p>
4968:
4969: <p>Patch files that are distributed by the author or
4970: other maintainers can be listed in <tt class=
4971: "varname">$PATCHFILES</tt>.</p>
4972:
4973: <p>If it is desired to store any patches that should not
4974: be committed into pkgsrc, they can be kept outside the
4975: pkgsrc tree in the <tt class=
4976: "filename">$LOCALPATCHES</tt> directory. The directory
4977: tree there is expected to have the same
4978: “<span class="quote">category/package</span>”
4979: structure as pkgsrc, and patches are expected to be
4980: stored inside these dirs (also known as <tt class=
4981: "filename">$LOCALPATCHES/$PKGPATH</tt>). For example if
4982: you want to keep a private patch for <tt class=
4983: "filename">pkgsrc/graphics/png</tt>, keep it in
4984: <tt class="filename">$LOCALPATCHES/graphics/png/mypatch</tt>.
4985: All files in the named directory are expected to be patch
4986: files, and <span class="emphasis"><em>they are applied
4987: after pkgsrc patches are applied</em></span>.</p>
4988: </div>
4989:
4990: <div class="sect1" lang="en" xml:lang="en">
4991: <div class="titlepage">
4992: <div>
4993: <div>
4994: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 4995: "id2566134" id="id2566134"></a>7.4. Other
1.1 grant 4996: mandatory files</h2>
4997: </div>
4998: </div>
4999: </div>
5000:
5001: <div class="variablelist">
5002: <dl>
5003: <dt><span class="term"><tt class=
5004: "filename">DESCR</tt></span></dt>
5005:
5006: <dd>
5007: <p>A multi-line description of the piece of
5008: software. This should include any credits where
5009: they are due. Please bear in mind that others do
5010: not share your sense of humour (or spelling
5011: idiosyncrasies), and that others will read
5012: everything that you write here.</p>
5013: </dd>
5014:
5015: <dt><span class="term"><tt class=
5016: "filename">PLIST</tt></span></dt>
5017:
5018: <dd>
5019: <p>This file governs the files that are installed
5020: on your system: all the binaries, manual pages,
5021: etc. There are other directives which may be
5022: entered in this file, to control the creation and
5023: deletion of directories, and the location of
5024: inserted files. See <a href="#plist" title=
5025: "Chapter 8. PLIST issues">Chapter 8,
5026: <i>PLIST issues</i></a> for more information.</p>
5027: </dd>
5028: </dl>
5029: </div>
5030: </div>
5031:
5032: <div class="sect1" lang="en" xml:lang="en">
5033: <div class="titlepage">
5034: <div>
5035: <div>
5036: <h2 class="title" style="clear: both"><a name=
5037: "components.optional" id=
5038: "components.optional"></a>7.5. Optional
5039: files</h2>
5040: </div>
5041: </div>
5042: </div>
5043:
5044: <div class="variablelist">
5045: <dl>
5046: <dt><span class="term"><tt class=
5047: "filename">INSTALL</tt></span></dt>
5048:
5049: <dd>
5050: <p>This shell script is invoked twice by <a href=
5051: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5052: <span class="citerefentry"><span class=
5053: "refentrytitle">pkg_add</span>(1)</span></a>. First
5054: time after package extraction and before files are
5055: moved in place, the second time after the files to
5056: install are moved in place. This can be used to do
5057: any custom procedures not possible with @exec
5058: commands in <tt class="filename">PLIST</tt>. See
5059: <a href=
5060: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5061: <span class="citerefentry"><span class=
5062: "refentrytitle">pkg_add</span>(1)</span></a> and
5063: <a href=
5064: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5065: <span class="citerefentry"><span class=
5066: "refentrytitle">pkg_create</span>(1)</span></a> for
5067: more information.</p>
5068: </dd>
5069:
5070: <dt><span class="term"><tt class=
5071: "filename">DEINSTALL</tt></span></dt>
5072:
5073: <dd>
5074: <p>This script is executed before and after any
5075: files are removed. It is this script's
5076: responsibility to clean up any additional messy
5077: details around the package's installation, since
5078: all pkg_delete knows is how to delete the files
5079: created in the original distribution. See <a href=
5080: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
5081: <span class="citerefentry"><span class=
5082: "refentrytitle">pkg_delete</span>(1)</span></a> and
5083: <a href=
5084: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5085: <span class="citerefentry"><span class=
5086: "refentrytitle">pkg_create</span>(1)</span></a> for
5087: more information.</p>
5088: </dd>
5089:
5090: <dt><span class="term"><tt class=
5091: "filename">MESSAGE</tt></span></dt>
5092:
5093: <dd>
5094: <p>Display this file after installation of the
5095: package. Useful for things like legal notices on
5096: almost-free software and hints for updating config
5097: files after installing modules for apache, PHP etc.
5098: Please note that you can modify variables in it
5099: easily by using <tt class=
5100: "varname">MESSAGE_SUBST</tt> in the package's
5101: <tt class="filename">Makefile</tt>:</p>
5102: <pre class="programlisting">
5103: MESSAGE_SUBST+= SOMEVAR="somevalue"
5104: </pre>
5105:
5106: <p>replaces "${SOMEVAR}" with “<span class=
5107: "quote">somevalue</span>” in <tt class=
5108: "filename">MESSAGE</tt>.</p>
5109: </dd>
5110: </dl>
5111: </div>
5112: </div>
5113:
5114: <div class="sect1" lang="en" xml:lang="en">
5115: <div class="titlepage">
5116: <div>
5117: <div>
5118: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 5119: "id2566396" id="id2566396"></a>7.6. <tt class=
1.1 grant 5120: "filename">work*</tt></h2>
5121: </div>
5122: </div>
5123: </div>
5124:
5125: <p>When you type <span><b class="command">make</b></span>
5126: the distribution files are unpacked into this directory.
5127: It can be removed by running <span><b class=
5128: "command">make clean</b></span>. Besides the sources,
5129: this directory is also used to keep various timestamp
5130: files.</p>
5131:
5132: <p>If a package doesn't create a subdirectory for itself
5133: (like GNU software does, for instance), but extracts
5134: itself in the current directory, you should set
5135: <tt class="varname">WRKSRC</tt> accordingly, e.g.
5136: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
5137: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.2 hubertf 5138: class="pkgname">editors/sam</a> again, but the quick
5139: answer is:</p>
1.1 grant 5140: <pre class="programlisting">
5141: WRKSRC= ${WRKDIR}
5142: </pre>
5143:
5144: <p>Please note that the old <tt class=
5145: "varname">NO_WRKSUBDIR</tt> has been deprecated and
5146: should not be used. Also, if your package doesn't create
5147: a subdir with the name of <tt class=
5148: "varname">DISTNAME</tt> but some different name, set
5149: <tt class="varname">WRKSRC</tt> to point to the proper
5150: name in <tt class="filename">${WRKDIR}</tt>. See
5151: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
5152: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.2 hubertf 5153: class="pkgname">lang/tcl</a> and <a xmlns=
5154: "http://www.w3.org/TR/xhtml1/transitional" href=
5155: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
5156: class="pkgname">x11/tk</a> for examples, and here is
5157: another one:</p>
1.1 grant 5158: <pre class="programlisting">
5159: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
5160: </pre>
5161:
5162: <p>The name of the working directory created by pkgsrc is
5163: <tt class="filename">work</tt> by default. If the same
5164: pkgsrc tree should be used on several different
5165: platforms, the variable <tt class=
5166: "varname">OBJMACHINE</tt> can be set in /etc/mk.conf to
5167: attach the platform to the directory name, e.g.
5168: <tt class="filename">work.i386</tt> or <tt class=
5169: "filename">work.sparc</tt>.</p>
5170: </div>
5171:
5172: <div class="sect1" lang="en" xml:lang="en">
5173: <div class="titlepage">
5174: <div>
5175: <div>
5176: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 5177: "id2566484" id="id2566484"></a>7.7. <tt class=
1.1 grant 5178: "filename">files/*</tt></h2>
5179: </div>
5180: </div>
5181: </div>
5182:
5183: <p>If you have any files that you wish to be placed in
5184: the package prior to configuration or building, you could
5185: place these files here and use a “<span class=
5186: "quote">${CP}</span>” command in the
5187: “<span class="quote">pre-configure</span>”
5188: target to achieve this. Alternatively, you could simply
5189: diff the file against <tt class="filename">/dev/null</tt>
5190: and use the patch mechanism to manage the creation of
5191: this file.</p>
5192: </div>
5193: </div>
5194:
5195: <div class="chapter" lang="en" xml:lang="en">
5196: <div class="titlepage">
5197: <div>
5198: <div>
5199: <h2 class="title"><a name="plist" id=
5200: "plist"></a>Chapter 8. PLIST issues</h2>
5201: </div>
5202: </div>
5203: </div>
5204:
5205: <div class="toc">
5206: <p><b>Table of Contents</b></p>
5207:
5208: <dl>
1.5 ! hubertf 5209: <dt><span class="sect1"><a href="#id2566538">8.1. RCS
1.1 grant 5210: ID</a></span></dt>
5211:
1.5 ! hubertf 5212: <dt><span class="sect1"><a href="#id2566621">8.2.
1.1 grant 5213: Semi-automatic PLIST generation</a></span></dt>
5214:
5215: <dt><span class="sect1"><a href="#print-PLIST">8.3.
5216: Tweaking output of make print-PLIST</a></span></dt>
5217:
5218: <dt><span class="sect1"><a href="#plist.misc">8.4.
5219: Variable substitution in PLIST</a></span></dt>
5220:
1.5 ! hubertf 5221: <dt><span class="sect1"><a href="#id2566874">8.5.
1.1 grant 5222: Manpage-compression</a></span></dt>
5223:
1.5 ! hubertf 5224: <dt><span class="sect1"><a href="#id2566916">8.6.
1.1 grant 5225: Changing PLIST source with PLIST_SRC</a></span></dt>
5226:
1.5 ! hubertf 5227: <dt><span class="sect1"><a href="#id2566933">8.7.
1.1 grant 5228: Platform specific and differing PLISTs</a></span></dt>
5229:
5230: <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
5231: Sharing directories between packages</a></span></dt>
5232: </dl>
5233: </div>
5234:
5235: <p>The <tt class="filename">PLIST</tt> file contains a
5236: package's “<span class="quote">packing
5237: list</span>”, i.e. a list of files that belong to the
5238: package (relative to the <tt class=
5239: "filename">${PREFIX}</tt> directory it's been installed in)
5240: plus some additional statements - see the <a href=
5241: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5242: <span class="citerefentry"><span class=
5243: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
5244: a full list. This chapter addresses some issues that need
5245: attention when dealing with the <tt class=
5246: "filename">PLIST</tt> file (or files, see below!).</p>
5247:
5248: <div class="sect1" lang="en" xml:lang="en">
5249: <div class="titlepage">
5250: <div>
5251: <div>
5252: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 5253: "id2566538" id="id2566538"></a>8.1. RCS
1.1 grant 5254: ID</h2>
5255: </div>
5256: </div>
5257: </div>
5258:
5259: <p>Be sure to add a RCS ID line as the first thing in any
5260: <tt class="filename">PLIST</tt> file you write:</p>
5261: <pre class="programlisting">
5262: @comment $NetBSD$
5263: </pre>
5264: </div>
5265:
5266: <div class="sect1" lang="en" xml:lang="en">
5267: <div class="titlepage">
5268: <div>
5269: <div>
5270: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 5271: "id2566621" id=
! 5272: "id2566621"></a>8.2. Semi-automatic <tt class=
1.1 grant 5273: "filename">PLIST</tt> generation</h2>
5274: </div>
5275: </div>
5276: </div>
5277:
5278: <p>You can use the <span><b class="command">make
5279: print-PLIST</b></span> command to output a PLIST that
5280: matches any new files since the package was extracted.
5281: See <a href="#build.helpful-targets" title=
5282: "11.3. Other helpful targets">Section 11.3,
5283: “Other helpful targets”</a> for more
5284: information on this target.</p>
5285: </div>
5286:
5287: <div class="sect1" lang="en" xml:lang="en">
5288: <div class="titlepage">
5289: <div>
5290: <div>
5291: <h2 class="title" style="clear: both"><a name=
5292: "print-PLIST" id=
5293: "print-PLIST"></a>8.3. Tweaking output of
5294: <span><b class="command">make
5295: print-PLIST</b></span></h2>
5296: </div>
5297: </div>
5298: </div>
5299:
5300: <p>If you have used any of the *-dirs packages, as
5301: explained in <a href="#faq.common-dirs" title=
5302: "8.8. Sharing directories between packages">Section 8.8,
5303: “Sharing directories between packages”</a>,
5304: you may have noticed that <span><b class="command">make
5305: print-PLIST</b></span> outputs a set of <tt class=
5306: "varname">@comment</tt>s instead of real <tt class=
5307: "varname">@dirrm</tt> lines. You can also do this for
5308: specific directories and files, so that the results of
5309: that command are very close to reality. This helps
5310: <span class="emphasis"><em>a lot</em></span> during the
5311: update of packages.</p>
5312:
5313: <p>The <tt class="varname">PRINT_PLIST_AWK</tt> variable
5314: takes a set of AWK patterns and actions that are used to
5315: filter the output of print-PLIST. You can <span class=
5316: "emphasis"><em>append</em></span> any chunk of AWK
5317: scripting you like to it, but be careful with
5318: quoting.</p>
5319:
5320: <p>For example, to get all files inside the <tt class=
5321: "filename">libdata/foo</tt> directory removed from the
5322: resulting PLIST:</p>
5323: <pre class="programlisting">
5324: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
5325:
5326: </pre>
5327:
5328: <p>And to get all the <tt class="varname">@dirrm</tt>
5329: lines referring to a specific (shared) directory
5330: converted to <tt class="varname">@comment</tt>s:</p>
5331: <pre class="programlisting">
5332: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
5333:
5334: </pre>
5335: </div>
5336:
5337: <div class="sect1" lang="en" xml:lang="en">
5338: <div class="titlepage">
5339: <div>
5340: <div>
5341: <h2 class="title" style="clear: both"><a name=
5342: "plist.misc" id="plist.misc"></a>8.4. Variable
5343: substitution in PLIST</h2>
5344: </div>
5345: </div>
5346: </div>
5347:
5348: <p>A number of variables are substituted automatically in
5349: PLISTs when a package is installed on a system. This
5350: includes the following variables:</p>
5351:
5352: <div class="variablelist">
5353: <dl>
5354: <dt><span class="term"><tt class=
5355: "varname">${MACHINE_ARCH}</tt>, <tt class=
5356: "varname">${MACHINE_GNU_ARCH}</tt></span></dt>
5357:
5358: <dd>
5359: <p>Some packages like emacs and perl embed
5360: information about which architecture they were
5361: built on into the pathnames where they install
5362: their file. To handle this case, PLIST will be
5363: preprocessed before actually used, and the symbol
5364: “<span class="quote"><tt class=
5365: "varname">${MACHINE_ARCH}</tt></span>” will
5366: be replaced by what <span><b class="command">uname
5367: -p</b></span> gives. The same is done if the string
5368: <tt class="varname">${MACHINE_GNU_ARCH}</tt> is
5369: embedded in PLIST somewhere - use this on packages
5370: that have GNU autoconf created configure
5371: scripts.</p>
5372:
5373: <div class="note" style=
5374: "margin-left: 0.5in; margin-right: 0.5in;">
5375: <h3 class="title">Legacy note</h3>
5376:
5377: <p>There used to be a symbol “<span class=
5378: "quote"><tt class=
5379: "varname">$ARCH</tt></span>” that was
5380: replaced by the output of <span><b class=
5381: "command">uname -m</b></span>, but that's no
5382: longer supported and has been removed.</p>
5383: </div>
5384: </dd>
5385:
5386: <dt><span class="term"><tt class=
5387: "varname">${OPSYS}</tt>, <tt class=
5388: "varname">${LOWER_OPSYS}</tt>, <tt class=
5389: "varname">${OS_VERSION}</tt></span></dt>
5390:
5391: <dd>
5392: <p>Some packages want to embed the OS name and
5393: version into some paths. To do this, use these
5394: variables in the <tt class=
5395: "filename">PLIST</tt>:</p>
5396:
5397: <div class="itemizedlist">
5398: <ul type="disc">
5399: <li>
5400: <p><tt class="varname">${OPSYS}</tt> - output
5401: of “<span class="quote"><span><b class=
5402: "command">uname
5403: -s</b></span></span>”</p>
5404: </li>
5405:
5406: <li>
5407: <p><tt class="varname">${LOWER_OPSYS}</tt> -
5408: lowercase common name (eg.
5409: “<span class="quote">solaris</span>”)</p>
5410: </li>
5411:
5412: <li>
5413: <p><tt class="varname">${OS_VERSION}</tt> -
5414: “<span class="quote"><span><b class=
5415: "command">uname
5416: -r</b></span></span>”</p>
5417: </li>
5418: </ul>
5419: </div>
5420: </dd>
5421:
5422: <dt><span class="term"><tt class=
5423: "varname">${PKGLOCALEDIR}</tt></span></dt>
5424:
5425: <dd>
5426: <p>Packages that install locale files should list
5427: them in the PLIST as “<span class=
5428: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
5429: instead of “<span class=
5430: "quote">share/locale/de/LC_MESSAGES/...</span>”.
5431: This properly handles the fact that different
5432: operating systems expect locale files to be either
5433: in <tt class="filename">share</tt> or <tt class=
5434: "filename">lib</tt> by default.</p>
5435: </dd>
5436: </dl>
5437: </div>
5438:
5439: <p>For a complete list of values which are replaced by
5440: default, please look in <tt class=
5441: "filename">bsd.pkg.mk</tt> (and search for <span class=
5442: "emphasis"><em>PLIST_SUBST</em></span>).</p>
5443:
5444: <p>If you want to change other variables not listed
5445: above, you can add variables and their expansions to this
5446: variable in the following way, similar to <tt class=
5447: "varname">MESSAGE_SUBST</tt> (see <a href=
5448: "#components.optional" title=
5449: "7.5. Optional files">Section 7.5,
5450: “Optional files”</a>):</p>
5451: <pre class="programlisting">
5452: PLIST_SUBST+= SOMEVAR="somevalue"
5453: </pre>
5454:
5455: <p>This replaces all occurrences of “<span class=
5456: "quote">${SOMEVAR}</span>” in the PLIST with
5457: “<span class="quote">somevalue</span>”.</p>
5458: </div>
5459:
5460: <div class="sect1" lang="en" xml:lang="en">
5461: <div class="titlepage">
5462: <div>
5463: <div>
5464: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 5465: "id2566874" id=
! 5466: "id2566874"></a>8.5. Manpage-compression</h2>
1.1 grant 5467: </div>
5468: </div>
5469: </div>
5470:
5471: <p>Manpages should be installed in compressed form if
5472: <tt class="varname">MANZ</tt> is set (in <tt class=
5473: "filename">bsd.own.mk</tt>), and uncompressed otherwise.
5474: To handle this in the <tt class="filename">PLIST</tt>
5475: file, the suffix “<span class=
5476: "quote">.gz</span>” is appended/removed
5477: automatically for manpages according to <tt class=
5478: "varname">MANZ</tt> and <tt class=
5479: "varname">MANCOMPRESSED</tt> being set or not, see above
5480: for details. This modification of the <tt class=
5481: "filename">PLIST</tt> file is done on a copy of it, not
5482: <tt class="filename">PLIST</tt> itself.</p>
5483: </div>
5484:
5485: <div class="sect1" lang="en" xml:lang="en">
5486: <div class="titlepage">
5487: <div>
5488: <div>
5489: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 5490: "id2566916" id="id2566916"></a>8.6. Changing
1.1 grant 5491: PLIST source with <tt class=
5492: "varname">PLIST_SRC</tt></h2>
5493: </div>
5494: </div>
5495: </div>
5496:
5497: <p>To use one or more files as source for the <tt class=
5498: "filename">PLIST</tt> used in generating the binary
5499: package, set the variable <tt class=
5500: "varname">PLIST_SRC</tt> to the names of that file(s).
5501: The files are later concatenated using cat(1), and order
5502: of things is important.</p>
5503: </div>
5504:
5505: <div class="sect1" lang="en" xml:lang="en">
5506: <div class="titlepage">
5507: <div>
5508: <div>
5509: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 5510: "id2566933" id="id2566933"></a>8.7. Platform
1.1 grant 5511: specific and differing PLISTs</h2>
5512: </div>
5513: </div>
5514: </div>
5515:
5516: <p>Some packages decide to install a different set of
5517: files based on the operating system being used. These
5518: differences can be automatically handled by using the
5519: following files:</p>
5520:
5521: <div class="itemizedlist">
5522: <ul type="disc">
5523: <li>
5524: <p><tt class="filename">PLIST.common</tt></p>
5525: </li>
5526:
5527: <li>
5528: <p><tt class="filename">PLIST.${OPSYS}</tt></p>
5529: </li>
5530:
5531: <li>
5532: <p><tt class="filename">PLIST.common_end</tt></p>
5533: </li>
5534: </ul>
5535: </div>
5536:
5537: <p>If <tt class="filename">PLIST.${OPSYS}</tt> exists,
5538: these files are used instead of <tt class=
5539: "filename">PLIST</tt>. This allows packages which behave
5540: in this way to be handled gracefully. Manually overriding
5541: <tt class="varname">PLIST_SRC</tt> for other more exotic
5542: uses is also possible.</p>
5543: </div>
5544:
5545: <div class="sect1" lang="en" xml:lang="en">
5546: <div class="titlepage">
5547: <div>
5548: <div>
5549: <h2 class="title" style="clear: both"><a name=
5550: "faq.common-dirs" id=
5551: "faq.common-dirs"></a>8.8. Sharing directories
5552: between packages</h2>
5553: </div>
5554: </div>
5555: </div>
5556:
5557: <p>A “<span class="quote">shared
5558: directory</span>” is a directory where multiple
5559: (and unrelated) packages install files. These directories
5560: are problematic because you have to add special tricks in
5561: the PLIST to conditionally remove them, or have some
5562: centralized package handle them.</p>
5563:
5564: <p>Within pkgsrc, you'll find both approaches. If a
5565: directory is shared by a few unrelated packages, it's
5566: often not worth to add an extra package to remove it.
5567: Therefore, one simply does:</p>
5568: <pre class="programlisting">
5569: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
5570:
5571: </pre>
5572:
5573: <p>in the PLISTs of all affected packages, instead of the
5574: regular "@dirrm" line.</p>
5575:
5576: <p>However, if the directory is shared across many
5577: packages, two different solutions are available:</p>
5578:
5579: <div class="orderedlist">
5580: <ol type="1">
5581: <li>
5582: <p>If the packages have a common dependency, the
5583: directory can be removed in that. For example, see
5584: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5585: href=
5586: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.2 hubertf 5587: class="pkgname">textproc/scrollkeeper</a>, which
5588: removes the shared directory <tt class=
5589: "filename">share/omf</tt>.</p>
1.1 grant 5590: </li>
5591:
5592: <li>
5593: <p>If the packages using the directory are not
5594: related at all (they have no common dependencies),
5595: a *-dirs package is used.</p>
5596: </li>
5597: </ol>
5598: </div>
5599:
5600: <p>From now on, we'll discuss the second solution. To get
5601: an idea of the *-dirs packages available, issue:</p>
5602: <pre class="programlisting">
5603: <tt class="prompt">%</tt> cd .../pkgsrc
5604: <tt class="prompt">%</tt> ls -d */*-dirs
5605:
5606: </pre>
5607:
5608: <p>Their use from other packages is very simple. The
5609: <tt class="varname">USE_DIRS</tt> variable takes a list
5610: of package names (without the “<span class=
5611: "quote">-dirs</span>” part) together with the
5612: required version number (always pick the latest one when
5613: writting new packages).</p>
5614:
5615: <p>For example, if a package installs files under
5616: <tt class="filename">share/applications</tt>, it should
5617: have the following line in it:</p>
5618: <pre class="programlisting">
5619: USE_DIRS+= xdg-1.1
5620:
5621: </pre>
5622:
5623: <p>After regenerating the PLIST using <span><b class=
5624: "command">make print-PLIST</b></span>, you should get the
5625: right (commented out) lines.</p>
5626:
5627: <p>Note that, even if your package is using <tt class=
5628: "filename">$X11BASE</tt>, it must not depend on the
5629: *-x11-dirs packages. Just specify the name without that
5630: part and pkgsrc (in particular, <tt class=
5631: "filename">mk/dirs.mk</tt>) will take care of it.</p>
5632: </div>
5633: </div>
5634:
5635: <div class="chapter" lang="en" xml:lang="en">
5636: <div class="titlepage">
5637: <div>
5638: <div>
5639: <h2 class="title"><a name="buildlink" id=
5640: "buildlink"></a>Chapter 9. Buildlink
5641: methodology</h2>
5642: </div>
5643: </div>
5644: </div>
5645:
5646: <div class="toc">
5647: <p><b>Table of Contents</b></p>
5648:
5649: <dl>
1.5 ! hubertf 5650: <dt><span class="sect1"><a href="#id2567137">9.1.
1.1 grant 5651: Converting packages to use buildlink3</a></span></dt>
5652:
1.5 ! hubertf 5653: <dt><span class="sect1"><a href="#id2567532">9.2.
1.1 grant 5654: Writing buildlink3.mk files</a></span></dt>
5655:
5656: <dd>
5657: <dl>
1.5 ! hubertf 5658: <dt><span class="sect2"><a href="#id2567670">9.2.1.
1.1 grant 5659: Anatomy of a buildlink3.mk file</a></span></dt>
5660:
1.5 ! hubertf 5661: <dt><span class="sect2"><a href="#id2568110">9.2.2.
1.1 grant 5662: Updating BUILDLINK_DEPENDS.pkg in buildlink3.mk
5663: files</a></span></dt>
5664: </dl>
5665: </dd>
5666:
1.5 ! hubertf 5667: <dt><span class="sect1"><a href="#id2568189">9.3.
1.1 grant 5668: Writing builtin.mk files</a></span></dt>
5669:
5670: <dd>
5671: <dl>
1.5 ! hubertf 5672: <dt><span class="sect2"><a href="#id2568270">9.3.1.
1.1 grant 5673: Anatomy of a builtin.mk file</a></span></dt>
5674:
1.5 ! hubertf 5675: <dt><span class="sect2"><a href="#id2568566">9.3.2.
1.1 grant 5676: Global preferences for native or pkgsrc
5677: software</a></span></dt>
5678: </dl>
5679: </dd>
5680: </dl>
5681: </div>
5682:
5683: <p>Buildlink is a framework in pkgsrc that controls what
5684: headers and libraries are seen by a package's configure and
5685: build processes. This is implemented in a two step
5686: process:</p>
5687:
5688: <div class="orderedlist">
5689: <ol type="1">
5690: <li>
5691: <p>Symlink headers and libraries for dependencies
5692: into <tt class="varname">BUILDLINK_DIR</tt>, which by
5693: default is a subdirectory of <tt class=
5694: "varname">WRKDIR</tt>.</p>
5695: </li>
5696:
5697: <li>
5698: <p>Create wrapper scripts that are used in place of
5699: the normal compiler tools that translate <tt class=
5700: "option">-I${LOCALBASE}/include</tt> and <tt class=
5701: "option">-L${LOCALBASE}/lib</tt> into references to
5702: <tt class="varname">BUILDLINK_DIR</tt>. The wrapper
5703: scripts also make native compiler on some operating
5704: systems look like GCC, so that packages that expect
5705: GCC won't require modifications to build with those
5706: native compilers.</p>
5707: </li>
5708: </ol>
5709: </div>
5710:
5711: <p>This normalizes the environment in which a package is
5712: built so that the package may be built consistently despite
5713: what other software may be installed. Please note that the
5714: normal system header and library paths, e.g. <tt class=
5715: "filename">/usr/include</tt>, <tt class=
5716: "filename">/usr/lib</tt>, etc., are always searched --
5717: buildlink3 is designed to insulate the package build from
5718: non-system-supplied software.</p>
5719:
5720: <div class="sect1" lang="en" xml:lang="en">
5721: <div class="titlepage">
5722: <div>
5723: <div>
5724: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 5725: "id2567137" id="id2567137"></a>9.1. Converting
1.1 grant 5726: packages to use buildlink3</h2>
5727: </div>
5728: </div>
5729: </div>
5730:
5731: <p>The process of converting packages to use the
5732: buildlink3 framework (“<span class=
5733: "quote">bl3ifying</span>”) is fairly
5734: straightforward. The things to keep in mind are:</p>
5735:
5736: <div class="orderedlist">
5737: <ol type="1">
5738: <li>
5739: <p>Set <tt class="varname">USE_BUILDLINK3</tt> to
5740: “<span class="quote">yes</span>”.</p>
5741: </li>
5742:
5743: <li>
5744: <p>Ensure that the build always calls the wrapper
5745: scripts instead of the actual toolchain. Some
5746: packages are tricky, and the only way to know for
5747: sure is the check <tt class=
5748: "filename">${WRKDIR}/.work.log</tt> to see if the
5749: wrappers are being invoked.</p>
5750: </li>
5751:
5752: <li>
5753: <p>Don't override <tt class="varname">PREFIX</tt>
5754: from within the package Makefile, e.g. Java VMs,
5755: standalone shells, etc., because the code to
5756: symlink files into <tt class=
5757: "filename">${BUILDLINK_DIR}</tt> looks for files
5758: relative to “<span class="quote">pkg_info -qp
5759: <i class=
5760: "replaceable"><tt>pkgname</tt></i></span>”.</p>
5761: </li>
5762:
5763: <li>
5764: <p>Remember that <span class=
5765: "emphasis"><em>only</em></span> the <tt class=
5766: "filename">buildlink3.mk</tt> files that you list
5767: in a package's Makefile are added as dependencies
5768: for that package.</p>
5769: </li>
5770: </ol>
5771: </div>
5772:
5773: <p>If a dependency on a particular package is required
5774: for its libraries and headers, then we replace:</p>
5775: <pre class="programlisting">
5776: DEPENDS+= foo>=1.1.0:../../category/foo
5777: </pre>
5778:
5779: <p>with</p>
5780: <pre class="programlisting">
5781: .include "../../category/foo/buildlink3.mk"
5782: </pre>
5783:
5784: <p>There are several <tt class=
5785: "filename">buildlink3.mk</tt> files in <tt class=
5786: "filename">pkgsrc/mk</tt> that handle special package
5787: issues:</p>
5788:
5789: <div class="itemizedlist">
5790: <ul type="disc">
5791: <li>
5792: <p><tt class="filename">bdb.buildlink3.mk</tt>
5793: chooses either the native or a pkgsrc Berkeley DB
5794: implementation based on the values of <tt class=
5795: "varname">BDB_ACCEPTED</tt> and <tt class=
5796: "varname">BDB_DEFAULT</tt>.</p>
5797: </li>
5798:
5799: <li>
5800: <p><tt class="filename">curses.buildlink3.mk</tt>
5801: If the system comes with neither Curses nor
5802: NCurses, this will take care to install the
5803: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5804: href=
5805: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.2 hubertf 5806: class="pkgname">devel/ncurses</a> package.</p>
1.1 grant 5807: </li>
5808:
5809: <li>
5810: <p><tt class="filename">krb5.buildlink3.mk</tt>
5811: uses the value of <tt class=
5812: "varname">KRB5_ACCEPTED</tt> to choose between
5813: adding a dependency on Heimdal or MIT-krb5 for
5814: packages that require a Kerberos 5
5815: implementation.</p>
5816: </li>
5817:
5818: <li>
5819: <p><tt class="filename">motif.buildlink3.mk</tt>
5820: checks for a system-provided Motif installation or
5821: adds a dependency on <a xmlns=
5822: "http://www.w3.org/TR/xhtml1/transitional" href=
5823: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.2 hubertf 5824: class="pkgname">x11/lesstif</a> or <a xmlns=
5825: "http://www.w3.org/TR/xhtml1/transitional" href=
5826: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
5827: class="pkgname">x11/openmotif</a>;</p>
1.1 grant 5828: </li>
5829:
5830: <li>
5831: <p><tt class="filename">ossaudio.buildlink3.mk</tt>
5832: defines several variables that may be used by
5833: packages that use the Open Sound System (OSS)
5834: API;</p>
5835: </li>
5836:
5837: <li>
5838: <p><tt class="filename">pgsql.buildlink3.mk</tt>
5839: will accept either Postgres 7.3 or 7.4, whichever
5840: is found installed. See the file for more
5841: information.</p>
5842: </li>
5843:
5844: <li>
5845: <p><tt class="filename">pthread.buildlink3.mk</tt>
5846: uses the value of <tt class=
5847: "varname">PTHREAD_OPTS</tt> and checks for native
5848: pthreads or adds a dependency on <a xmlns=
5849: "http://www.w3.org/TR/xhtml1/transitional" href=
5850: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.2 hubertf 5851: class="pkgname">devel/pth</a> as needed;</p>
1.1 grant 5852: </li>
5853:
5854: <li>
5855: <p><tt class="filename">xaw.buildlink3.mk</tt> uses
5856: the value of <tt class="varname">XAW_TYPE</tt> to
5857: choose a particular Athena widgets library.</p>
5858: </li>
5859: </ul>
5860: </div>
5861:
5862: <p>The comments in those <tt class=
5863: "filename">buildlink3.mk</tt> files provide a more
5864: complete description of how to use them properly.</p>
5865: </div>
5866:
5867: <div class="sect1" lang="en" xml:lang="en">
5868: <div class="titlepage">
5869: <div>
5870: <div>
5871: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 5872: "id2567532" id="id2567532"></a>9.2. Writing
1.1 grant 5873: <tt class="filename">buildlink3.mk</tt> files</h2>
5874: </div>
5875: </div>
5876: </div>
5877:
5878: <p>A package's <tt class="filename">buildlink3.mk</tt>
5879: file is included by Makefiles to indicate the need to
5880: compile and link against header files and libraries
5881: provided by the package. A <tt class=
5882: "filename">buildlink3.mk</tt> file should always provide
5883: enough information to add the correct type of dependency
5884: relationship and include any other <tt class=
5885: "filename">buildlink3.mk</tt> files that it needs to find
5886: headers and libraries that it needs in turn.</p>
5887:
5888: <p>To generate an initial <tt class=
5889: "filename">buildlink3.mk</tt> file for further editing,
5890: Rene Hexel's <a xmlns=
5891: "http://www.w3.org/TR/xhtml1/transitional" href=
5892: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.2 hubertf 5893: class="pkgname">pkgtools/createbuildlink</a> package
5894: is highly recommended. For most packages, the
5895: following command will generate a good starting point
5896: for <tt class="filename">buildlink3.mk</tt> files:</p>
1.1 grant 5897: <pre class="screen">
5898: <tt class="prompt">%</tt> <b class=
5899: "userinput"><tt>cd pkgsrc/<i class=
5900: "replaceable"><tt>category</tt></i>/<i class=
5901: "replaceable"><tt>pkgdir</tt></i>
5902: <tt class=
5903: "prompt">%</tt> createbuildlink -3 >buildlink3.mk</tt></b>
5904: </pre>
5905:
5906: <div class="sect2" lang="en" xml:lang="en">
5907: <div class="titlepage">
5908: <div>
5909: <div>
1.5 ! hubertf 5910: <h3 class="title"><a name="id2567670" id=
! 5911: "id2567670"></a>9.2.1. Anatomy of a buildlink3.mk
1.1 grant 5912: file</h3>
5913: </div>
5914: </div>
5915: </div>
5916:
5917: <p>The following real-life example <tt class=
5918: "filename">buildlink3.mk</tt> is taken from <tt class=
5919: "filename">pkgsrc/graphics/tiff</tt>:</p>
5920: <pre class="programlisting">
5921: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
5922:
5923: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
5924: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
5925:
5926: .if !empty(BUILDLINK_DEPTH:M+)
5927: BUILDLINK_DEPENDS+= tiff
5928: .endif
5929:
5930: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
5931: BUILDLINK_PACKAGES+= tiff
5932:
5933: .if !empty(TIFF_BUILDLINK3_MK:M+)
5934: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
5935: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
5936: .endif # TIFF_BUILDLINK3_MK
5937:
5938: .include "../../devel/zlib/buildlink3.mk"
5939: .include "../../graphics/jpeg/buildlink3.mk"
5940:
5941: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
5942: </pre>
5943:
5944: <p>The header and footer manipulate <tt class=
5945: "varname">BUILDLINK_DEPTH</tt>, which is common across
5946: all <tt class="filename">buildlink3.mk</tt> files and
5947: is used to track at what depth we are including
5948: <tt class="filename">buildlink3.mk</tt> files.</p>
5949:
5950: <p>The first section controls if the dependency on
5951: <i class="replaceable"><tt>pkg</tt></i> is added.
5952: <tt class="varname">BUILDLINK_DEPENDS</tt> is the
5953: global list of packages for which dependencies are
5954: added by buildlink3.</p>
5955:
5956: <p>The second section advises pkgsrc that the
5957: <tt class="filename">buildlink3.mk</tt> file for
5958: <i class="replaceable"><tt>pkg</tt></i> has been
5959: included at some point. <tt class=
5960: "varname">BUILDLINK_PACKAGES</tt> is the global list of
5961: packages for which <tt class=
5962: "filename">buildlink3.mk</tt> files have been included.
5963: It must <span class="emphasis"><em>always</em></span>
5964: be appended to within a <tt class=
5965: "filename">buildlink3.mk</tt> file.</p>
5966:
5967: <p>The third section is protected from multiple
5968: inclusion and controls how the dependency on <i class=
5969: "replaceable"><tt>pkg</tt></i> is added. Several
5970: important variables are set in the section:</p>
5971:
5972: <div class="itemizedlist">
5973: <ul type="disc">
5974: <li>
5975: <p><tt class=
5976: "varname">BUILDLINK_DEPENDS.<i class="replaceable">
5977: <tt>pkg</tt></i></tt> is the actual dependency
5978: recorded in the installed package; this should
5979: always be set using <span><b class=
5980: "command">+=</b></span> to ensure that we're
5981: appending to any pre-existing list of values.
5982: This variable should be set to the first version
5983: of the package that had the last change in the
5984: major number of a shared library or that had a
5985: major API change.</p>
5986: </li>
5987:
5988: <li>
5989: <p><tt class=
5990: "varname">BUILDLINK_PKGSRCDIR.<i class=
5991: "replaceable"><tt>pkg</tt></i></tt> is the
5992: location of the <i class=
5993: "replaceable"><tt>pkg</tt></i> pkgsrc
5994: directory;</p>
5995: </li>
5996:
5997: <li>
5998: <p><tt class=
5999: "varname">BUILDLINK_DEPMETHOD.<i class=
6000: "replaceable"><tt>pkg</tt></i></tt> (not shown
6001: above) controls whether we use <tt class=
6002: "varname">BUILD_DEPENDS</tt> or <tt class=
6003: "varname">DEPENDS</tt> to add the dependency on
6004: <i class="replaceable"><tt>pkg</tt></i>. The
6005: build dependency is selected by setting
6006: <tt class="varname">BUILDLINK_DEPMETHOD.<i class=
6007: "replaceable"><tt>pkg</tt></i></tt> to
6008: “<span class="quote">build</span>”.
6009: By default, the full dependency is used.</p>
6010: </li>
6011:
6012: <li>
6013: <p><tt class=
6014: "varname">BUILDLINK_INCDIRS.<i class="replaceable">
6015: <tt>pkg</tt></i></tt> and <tt class=
6016: "varname">BUILDLINK_LIBDIRS.<i class=
6017: "replaceable"><tt>pkg</tt></i></tt> (not shown
6018: above) are lists of subdirectories of <tt class=
6019: "filename">${BUILDLINK_PREFIX.<i class=
6020: "replaceable"><tt>pkg</tt></i>}</tt> to add to
6021: the header and library search paths. These
6022: default to “<span class=
6023: "quote">include</span>” and
6024: “<span class="quote">lib</span>”
6025: respectively.</p>
6026: </li>
6027:
6028: <li>
6029: <p><tt class=
6030: "varname">BUILDLINK_CPPFLAGS.<i class=
6031: "replaceable"><tt>pkg</tt></i></tt> (not shown
6032: above) is the list of preprocessor flags to add
6033: to <tt class="varname">CPPFLAGS</tt>, which are
6034: passed on to the configure and build phases. The
6035: “<span class="quote">-I</span>”
6036: option should be avoided and instead be handled
6037: using <tt class=
6038: "varname">BUILDLINK_INCDIRS.<i class=
6039: "replaceable"><tt>pkg</tt></i></tt> as above.</p>
6040: </li>
6041: </ul>
6042: </div>
6043:
6044: <p>The following variables are all optionally defined
6045: within this second section (protected against multiple
6046: inclusion) and control which package files are
6047: symlinked into <tt class=
6048: "filename">${BUILDLINK_DIR}</tt> and how their names
6049: are transformed during the symlinking:</p>
6050:
6051: <div class="itemizedlist">
6052: <ul type="disc">
6053: <li>
6054: <p><tt class="varname">BUILDLINK_FILES.<i class=
6055: "replaceable"><tt>pkg</tt></i></tt> (not shown
6056: above) is a shell glob pattern relative to
6057: <tt class="filename">${BUILDLINK_PREFIX.<i class=
6058: "replaceable"><tt>pkg</tt></i>}</tt> to be
6059: symlinked into <tt class=
6060: "filename">${BUILDLINK_DIR}</tt>, e.g. <tt class=
6061: "filename">include/*.h</tt>.</p>
6062: </li>
6063:
6064: <li>
6065: <p><tt class=
6066: "varname">BUILDLINK_FILES_CMD.<i class=
6067: "replaceable"><tt>pkg</tt></i></tt> (not shown
6068: above) is a shell pipeline that outputs to stdout
6069: a list of files relative to <tt class=
6070: "filename">${BUILDLINK_PREFIX.<i class=
6071: "replaceable"><tt>pkg</tt></i>}</tt>. The
6072: resulting files are to be symlinked into
6073: <tt class="filename">${BUILDLINK_DIR}</tt>. By
6074: default, this takes the <tt class=
6075: "filename">+CONTENTS</tt> of a <i class=
6076: "replaceable"><tt>pkg</tt></i> and filters it
6077: through <tt class=
6078: "varname">${BUILDLINK_CONTENTS_FILTER.<i class=
6079: "replaceable"><tt>pkg</tt></i>}</tt>.</p>
6080: </li>
6081:
6082: <li>
6083: <p><tt class=
6084: "varname">BUILDLINK_CONTENTS_FILTER.<i class=
6085: "replaceable"><tt>pkg</tt></i></tt> (not shown
6086: above) is a filter command that filters
6087: <tt class="filename">+CONTENTS</tt> input into a
6088: list of files relative to <tt class=
6089: "filename">${BUILDLINK_PREFIX.<i class=
6090: "replaceable"><tt>pkg</tt></i>}</tt> on stdout.
6091: By default for overwrite packages, <tt class=
6092: "varname">BUILDLINK_CONTENTS_FILTER.<i class=
6093: "replaceable"><tt>pkg</tt></i></tt> outputs the
6094: contents of the <tt class="filename">include</tt>
6095: and <tt class="filename">lib</tt> directories in
6096: the package <tt class="filename">+CONTENTS</tt>,
6097: and for pkgviews packages, it outputs any libtool
6098: archives in <tt class="filename">lib</tt>
6099: directories.</p>
6100: </li>
6101:
6102: <li>
6103: <p><tt class=
6104: "varname">BUILDLINK_TRANSFORM.<i class=
6105: "replaceable"><tt>pkg</tt></i></tt> (not shown
6106: above) is a list of sed arguments used to
6107: transform the name of the source filename into a
6108: destination filename, e.g. <span><b class=
6109: "command">-e
6110: "s|/curses.h|/ncurses.h|g"</b></span>.</p>
6111: </li>
6112: </ul>
6113: </div>
6114:
6115: <p>The last section includes any <tt class=
6116: "filename">buildlink3.mk</tt> needed for <i class=
6117: "replaceable"><tt>pkg</tt></i>'s library dependencies.
6118: Including these <tt class="filename">buildlink3.mk</tt>
6119: files means that the headers and libraries for these
6120: dependencies are also symlinked into <tt class=
6121: "filename">${BUILDLINK_DIR}</tt> whenever the <i class=
6122: "replaceable"><tt>pkg</tt></i> <tt class=
6123: "filename">buildlink3.mk</tt> file is included.</p>
6124: </div>
6125:
6126: <div class="sect2" lang="en" xml:lang="en">
6127: <div class="titlepage">
6128: <div>
6129: <div>
1.5 ! hubertf 6130: <h3 class="title"><a name="id2568110" id=
! 6131: "id2568110"></a>9.2.2. Updating <tt class=
1.1 grant 6132: "varname">BUILDLINK_DEPENDS.<i class=
6133: "replaceable"><tt>pkg</tt></i></tt> in <tt class=
6134: "filename">buildlink3.mk</tt> files</h3>
6135: </div>
6136: </div>
6137: </div>
6138:
6139: <p>There are two situations that require increasing the
6140: dependency listed in <tt class=
6141: "varname">BUILDLINK_DEPENDS.<i class=
6142: "replaceable"><tt>pkg</tt></i></tt> after a package
6143: update:</p>
6144:
6145: <div class="orderedlist">
6146: <ol type="1">
6147: <li>
6148: <p>if the sonames (major number of the library
6149: version) of any installed shared libraries
6150: change;</p>
6151: </li>
6152:
6153: <li>
6154: <p>if the API or interface to the header files
6155: change.</p>
6156: </li>
6157: </ol>
6158: </div>
6159:
6160: <p>In these cases, <tt class=
6161: "varname">BUILDLINK_DEPENDS.<i class=
6162: "replaceable"><tt>pkg</tt></i></tt> should be adjusted
6163: to require at least the new package version. In some
6164: cases, the packages that depend on this new version may
6165: need their <tt class="varname">PKGREVISION</tt>s
6166: increased and, if they have <tt class=
6167: "filename">buildlink3.mk</tt> files, their <tt class=
6168: "varname">BUILDLINK_DEPENDS.<i class=
6169: "replaceable"><tt>pkg</tt></i></tt> adjusted, too. This
6170: is needed so that binary packages made using it will
6171: require the correct package dependency and not settle
6172: for an older one which will not contain the necessary
6173: shared libraries.</p>
6174:
6175: <p>Please take careful consideration before adjusting
6176: <tt class="varname">BUILDLINK_DEPENDS.<i class=
6177: "replaceable"><tt>pkg</tt></i></tt> as we don't want to
6178: cause unneeded package deletions and rebuilds. In many
6179: cases, new versions of packages work just fine with
6180: older dependencies. See <a href="#dependencies" title=
6181: "12.1.3. Handling dependencies">Section 12.1.3,
6182: “Handling dependencies”</a> and <a href=
6183: "#buildlink" title=
6184: "Chapter 9. Buildlink methodology">Chapter 9,
6185: <i>Buildlink methodology</i></a> for more information
6186: about dependencies on other packages, including the
6187: <tt class="varname">BUILDLINK_RECOMMENDED</tt> and
6188: <tt class="varname">RECOMMENDED</tt> definitions.</p>
6189: </div>
6190: </div>
6191:
6192: <div class="sect1" lang="en" xml:lang="en">
6193: <div class="titlepage">
6194: <div>
6195: <div>
6196: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 6197: "id2568189" id="id2568189"></a>9.3. Writing
1.1 grant 6198: <tt class="filename">builtin.mk</tt> files</h2>
6199: </div>
6200: </div>
6201: </div>
6202:
6203: <p>Some packages in pkgsrc install headers and libraries
6204: that coincide with headers and libraries present in the
6205: base system. Aside from a <tt class=
6206: "filename">buildlink3.mk</tt> file, these packages should
6207: also include a <tt class="filename">builtin.mk</tt> file
6208: that includes the necessary checks to decide whether
6209: using the built-in software or the pkgsrc software is
6210: appropriate.</p>
6211:
6212: <p>The only requirements of a builtin.mk file for
6213: <i class="replaceable"><tt>pkg</tt></i> are:</p>
6214:
6215: <div class="orderedlist">
6216: <ol type="1">
6217: <li>
6218: <p>It should set <tt class=
6219: "varname">USE_BUILTIN.<i class=
6220: "replaceable"><tt>pkg</tt></i></tt> to either
6221: “<span class="quote">yes</span>” or
6222: “<span class="quote">no</span>” after
6223: it is included.</p>
6224: </li>
6225:
6226: <li>
6227: <p>It should <span class=
6228: "emphasis"><em>not</em></span> override any
6229: <tt class="varname">USE_BUILTIN.<i class=
6230: "replaceable"><tt>pkg</tt></i></tt> which is
6231: already set before the <tt class=
6232: "filename">builtin.mk</tt> file is included.</p>
6233: </li>
6234:
6235: <li>
6236: <p>It should be written to allow multiple
6237: inclusion. This is <span class=
6238: "emphasis"><em>very</em></span> important and takes
6239: careful attention to <tt class=
6240: "filename">Makefile</tt> coding.</p>
6241: </li>
6242: </ol>
6243: </div>
6244:
6245: <div class="sect2" lang="en" xml:lang="en">
6246: <div class="titlepage">
6247: <div>
6248: <div>
1.5 ! hubertf 6249: <h3 class="title"><a name="id2568270" id=
! 6250: "id2568270"></a>9.3.1. Anatomy of a
1.1 grant 6251: <tt class="filename">builtin.mk</tt> file</h3>
6252: </div>
6253: </div>
6254: </div>
6255:
6256: <p>The following is the recommended template for
6257: builtin.mk files:</p>
6258: <pre class="programlisting">
6259: .if !defined(IS_BUILTIN.foo)
6260: #
6261: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
6262: # genuinely exists in the system or not.
6263: #
6264: IS_BUILTIN.foo?= no
6265:
6266: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
6267: # version can be determined.
6268: #
6269: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
6270: BUILTIN_PKG.foo?= foo-1.0
6271: . endif
6272: .endif # IS_BUILTIN.foo
6273:
6274: .if !defined(USE_BUILTIN.foo)
6275: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
6276: . if defined(BUILTIN_PKG.foo)
6277: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
6278: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
6279: USE_BUILTIN.foo!= \
6280: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
6281: ${ECHO} "yes"; \
6282: else \
6283: ${ECHO} "no"; \
6284: fi
6285: . endif
6286: . endfor
6287: . endif
6288: .endif # USE_BUILTIN.foo
6289:
6290: CHECK_BUILTIN.foo?= no
6291: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
6292: #
6293: # Here we place code that depends on whether USE_BUILTIN.foo is set to
6294: # "yes" or "no".
6295: #
6296: .endif # CHECK_BUILTIN.foo
6297:
6298: </pre>
6299:
6300: <p>The first section sets <tt class=
6301: "varname">IS_BUILTIN.<i class=
6302: "replaceable"><tt>pkg</tt></i></tt> depending on if
6303: <i class="replaceable"><tt>pkg</tt></i> really exists
6304: in the base system. This should not be a base system
6305: software with similar functionality to <i class=
6306: "replaceable"><tt>pkg</tt></i>; it should only be
6307: “<span class="quote">yes</span>” if the
6308: actual package is included as part of the base system.
6309: This variable is only used internally within the
6310: <tt class="filename">builtin.mk</tt> file.</p>
6311:
6312: <p>The second section sets <tt class=
6313: "varname">BUILTIN_PKG.<i class=
6314: "replaceable"><tt>pkg</tt></i></tt> to the version of
6315: <i class="replaceable"><tt>pkg</tt></i> in the base
6316: system if it exists (if <tt class=
6317: "varname">IS_BUILTIN.<i class=
6318: "replaceable"><tt>pkg</tt></i></tt> is
6319: “<span class="quote">yes</span>”). This
6320: variable is only used internally within the <tt class=
6321: "filename">builtin.mk</tt> file.</p>
6322:
6323: <p>The third section sets <tt class=
6324: "varname">USE_BUILTIN.<i class=
6325: "replaceable"><tt>pkg</tt></i></tt> and is <span class=
6326: "emphasis"><em>required</em></span> in all <tt class=
6327: "filename">builtin.mk</tt> files. The code in this
6328: section must make the determination whether the
6329: built-in software is adequate to satisfy the
6330: dependencies listed in <tt class=
6331: "varname">BUILDLINK_DEPENDS.<i class=
6332: "replaceable"><tt>pkg</tt></i></tt>. This is typically
6333: done by comparing <tt class=
6334: "varname">BUILTIN_PKG.<i class=
6335: "replaceable"><tt>pkg</tt></i></tt> against each of the
6336: dependencies in <tt class=
6337: "varname">BUILDLINK_DEPENDS.<i class=
6338: "replaceable"><tt>pkg</tt></i></tt>. <tt class=
6339: "varname">USE_BUILTIN.<i class=
6340: "replaceable"><tt>pkg</tt></i></tt> <span class=
6341: "emphasis"><em>must</em></span> be set to the correct
6342: value by the end of the <tt class=
6343: "filename">builtin.mk</tt> file. Note that <tt class=
6344: "varname">USE_BUILTIN.<i class=
6345: "replaceable"><tt>pkg</tt></i></tt> may be
6346: “<span class="quote">yes</span>” even if
6347: <tt class="varname">IS_BUILTIN.<i class=
6348: "replaceable"><tt>pkg</tt></i></tt> is
6349: “<span class="quote">no</span>” because we
6350: may make the determination that the built-in version of
6351: the software is similar enough to be used as a
6352: replacement.</p>
6353:
6354: <p>The last section is guarded by <tt class=
6355: "varname">CHECK_BUILTIN.<i class=
6356: "replaceable"><tt>pkg</tt></i></tt>, and includes code
6357: that uses the value of <tt class=
6358: "varname">USE_BUILTIN.<i class=
6359: "replaceable"><tt>pkg</tt></i></tt> set in the previous
6360: section. This typically includes, e.g., adding
6361: additional dependency restrictions and listing
6362: additional files to symlink into <tt class=
6363: "filename">${BUILDLINK_DIR}</tt> (via <tt class=
6364: "varname">BUILDLINK_FILES.<i class=
6365: "replaceable"><tt>pkg</tt></i></tt>).</p>
6366: </div>
6367:
6368: <div class="sect2" lang="en" xml:lang="en">
6369: <div class="titlepage">
6370: <div>
6371: <div>
1.5 ! hubertf 6372: <h3 class="title"><a name="id2568566" id=
! 6373: "id2568566"></a>9.3.2. Global preferences
1.1 grant 6374: for native or pkgsrc software</h3>
6375: </div>
6376: </div>
6377: </div>
6378:
6379: <p>When building packages, it's possible to choose
6380: whether to set a global preference for using either the
6381: built-in (native) version or the pkgsrc version of
6382: software to satisfy a dependency. This is controlled by
6383: setting <tt class="varname">PREFER_PKGSRC</tt> and
6384: <tt class="varname">PREFER_NATIVE</tt>. These variables
6385: take values of either “<span class=
6386: "quote">yes</span>”, “<span class=
6387: "quote">no</span>”, or a list of packages.
6388: <tt class="varname">PREFER_PKGSRC</tt> tells pkgsrc to
6389: use the pkgsrc versions of software, while <tt class=
6390: "varname">PREFER_NATIVE</tt> tells pkgsrc to use the
6391: built-in versions. Preferences are determined by the
6392: most specific instance of the package in either
6393: <tt class="varname">PREFER_PKGSRC</tt> or <tt class=
6394: "varname">PREFER_NATIVE</tt>. If a package is specified
6395: in neither or in both variables, then <tt class=
6396: "varname">PREFER_PKGSRC</tt> has precedence over
6397: <tt class="varname">PREFER_NATIVE</tt>. For example, to
6398: require using pkgsrc versions of software for all but
6399: the most basic bits on a NetBSD system, you can
6400: set:</p>
6401: <pre class="programlisting">
6402: PREFER_PKGSRC= yes
6403: PREFER_NATIVE= getopt skey tcp_wrappers
6404:
6405: </pre>
6406:
6407: <p>A package <span class=
6408: "emphasis"><em>must</em></span> have a <tt class=
6409: "filename">builtin.mk</tt> file to be listed in
6410: <tt class="varname">PREFER_NATIVE</tt>, otherwise it is
6411: simply ignored in that list.</p>
6412: </div>
6413: </div>
6414: </div>
6415:
6416: <div class="chapter" lang="en" xml:lang="en">
6417: <div class="titlepage">
6418: <div>
6419: <div>
6420: <h2 class="title"><a name="options" id=
6421: "options"></a>Chapter 10. Options
6422: handling</h2>
6423: </div>
6424: </div>
6425: </div>
6426:
6427: <div class="toc">
6428: <p><b>Table of Contents</b></p>
6429:
6430: <dl>
1.5 ! hubertf 6431: <dt><span class="sect1"><a href="#id2568638">10.1.
1.1 grant 6432: Global default options</a></span></dt>
6433:
1.5 ! hubertf 6434: <dt><span class="sect1"><a href="#id2568653">10.2.
1.1 grant 6435: Converting packages to use
6436: bsd.options.mk</a></span></dt>
6437: </dl>
6438: </div>
6439:
6440: <p>Many packages have the ability to be built to support
6441: different sets of features. <tt class=
6442: "filename">bsd.options.mk</tt> is a framework in pkgsrc
6443: that provides generic handling of those options that
6444: determine different ways in which the packages can be
6445: built. It's possible for the user to specify exactly which
6446: sets of options will be built into a package or to allow a
6447: set of global default options apply.</p>
6448:
6449: <div class="sect1" lang="en" xml:lang="en">
6450: <div class="titlepage">
6451: <div>
6452: <div>
6453: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 6454: "id2568638" id="id2568638"></a>10.1. Global
1.1 grant 6455: default options</h2>
6456: </div>
6457: </div>
6458: </div>
6459:
6460: <p>Global default options are listed in <tt class=
6461: "varname">PKG_DEFAULT_OPTIONS</tt>, which is a list of
6462: the options that should be built into every package if
6463: that option is supported. This variable should be set in
6464: <tt class="filename">/etc/mk.conf</tt>.</p>
6465: </div>
6466:
6467: <div class="sect1" lang="en" xml:lang="en">
6468: <div class="titlepage">
6469: <div>
6470: <div>
6471: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 6472: "id2568653" id=
! 6473: "id2568653"></a>10.2. Converting packages to
1.1 grant 6474: use <tt class="filename">bsd.options.mk</tt></h2>
6475: </div>
6476: </div>
6477: </div>
6478:
6479: <p>The following example shows how <tt class=
6480: "filename">bsd.options.mk</tt> should be use in a package
6481: <tt class="filename">Makefile</tt>, or in a file, e.g.
6482: <tt class="filename">options.mk</tt>, that is included by
6483: the main package <tt class="filename">Makefile</tt>.</p>
6484: <pre class="programlisting">
6485: # Global and legacy options
6486: .if defined(WIBBLE_USE_OPENLDAP) && !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
6487: PKG_DEFAULT_OPTIONS+= ldap
6488: .endif
6489: .if defined(USE_SASL2) && !empty(USE_SASL2:M[yY][eE][sS])
6490: PKG_DEFAULT_OPTIONS+= sasl
6491: .endif
6492:
6493: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
6494: PKG_SUPPORTED_OPTIONS= ldap sasl
6495: #
6496: # Default options for "wibble" package.
6497: #
6498: .if !defined(PKG_OPTIONS.wibble)
6499: PKG_DEFAULT_OPTIONS+= sasl
6500: endif
6501: .include "../../mk/bsd.options.mk"
6502:
6503: # Package-specific option-handling
6504:
6505: ###
6506: ### LDAP support
6507: ###
6508: .if !empty(PKG_OPTIONS:Mldap)
6509: . include "../../databases/openldap/buildlink3.mk"
6510: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
6511: .endif
6512:
6513: ###
6514: ### SASL authentication
6515: ###
6516: .if !empty(PKG_OPTIONS:Msasl)
6517: . include "../../security/cyrus-sasl2/buildlink3.mk"
6518: CONFIGURE_ARGS+= --enable-sasl=${BUILDLINK_PREFIX.sasl}
6519: .endif
6520:
6521: </pre>
6522:
6523: <p>The first section only exists if you are converting a
6524: package that had its own ad-hoc options handling to use
6525: <tt class="filename">bsd.options.mk</tt>. It converts
6526: global or legacy options variables into an equivalent
6527: <tt class="varname">PKG_OPTIONS.<i class=
6528: "replaceable"><tt>pkg</tt></i></tt> value. These sections
6529: will be removed over time as the old options are in turn
6530: deprecated and removed.</p>
6531:
6532: <p>The second section contains the information about
6533: which build options are supported by the package, and any
6534: default options settings if needed.</p>
6535:
6536: <div class="orderedlist">
6537: <ol type="1">
6538: <li>
6539: <p><tt class="varname">PKG_OPTIONS_VAR</tt> is a
6540: list of the name of the <a href=
6541: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6542: <span class="citerefentry"><span class=
6543: "refentrytitle">make</span>(1)</span></a> variables
6544: that contain the options the user wishes to select.
6545: The recommended value is “<span class=
6546: "quote">PKG_OPTIONS.<i class=
6547: "replaceable"><tt>pkg</tt></i></span>” but
6548: any package-specific value may be used. This
6549: variable should be set in a package Makefile.</p>
6550: </li>
6551:
6552: <li>
6553: <p><tt class="varname">PKG_SUPPORTED_OPTIONS</tt>
6554: is a list of build options supported by the
6555: package. This variable should be set in a package
6556: Makefile.</p>
6557: </li>
6558:
6559: <li>
6560: <p><tt class="varname">${PKG_OPTIONS_VAR}</tt> (the
6561: variables named in <tt class=
6562: "varname">PKG_OPTIONS_VAR</tt>) are variables that
6563: list the selected build options and override any
6564: default options given in <tt class=
6565: "varname">PKG_DEFAULT_OPTIONS</tt>. If any of the
6566: options begin with a “<span class=
6567: "quote">-</span>”, then that option is always
6568: removed from the selected build options, e.g.</p>
6569: <pre class="programlisting">
6570: PKG_DEFAULT_OPTIONS= kerberos ldap sasl
6571: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
6572: WIBBLE_OPTIONS= ${PKG_DEFAULT_OPTIONS} -sasl
6573: # implies PKG_OPTIONS == "kerberos ldap"
6574:
6575: </pre>
6576:
6577: <p>or</p>
6578: <pre class="programlisting">
6579: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
6580: WIBBLE_OPTIONS= kerberos -ldap ldap
6581: # implies PKG_OPTIONS == "kerberos"
6582:
6583: </pre>
6584:
6585: <p>This variable should be set in <tt class=
6586: "filename">/etc/mk.conf</tt>.</p>
6587: </li>
6588: </ol>
6589: </div>
6590:
6591: <p>After the inclusion of bsd.options.mk, the following
6592: variables are set:</p>
6593:
6594: <div class="itemizedlist">
6595: <ul type="disc">
6596: <li>
6597: <p><tt class="varname">PKG_OPTIONS</tt> contains
6598: the list of the selected build options, properly
6599: filtered to remove unsupported and duplicate
6600: options.</p>
6601: </li>
6602: </ul>
6603: </div>
6604:
6605: <p>The remaining sections contain the logic that is
6606: specific to each option. There should be a check for
6607: every option listed in <tt class=
6608: "varname">PKG_SUPPORTED_OPTIONS</tt>, and there should be
6609: clear documentation on what turning on the option will do
6610: in the comments preceding each section. The correct way
6611: to check for an option is to check whether it is listed
6612: in <tt class="varname">PKG_OPTIONS</tt>.</p>
6613: </div>
6614: </div>
6615:
6616: <div class="chapter" lang="en" xml:lang="en">
6617: <div class="titlepage">
6618: <div>
6619: <div>
6620: <h2 class="title"><a name="build" id=
6621: "build"></a>Chapter 11. The build
6622: process</h2>
6623: </div>
6624: </div>
6625: </div>
6626:
6627: <div class="toc">
6628: <p><b>Table of Contents</b></p>
6629:
6630: <dl>
6631: <dt><span class="sect1"><a href="#build.prefix">11.1.
6632: Program location</a></span></dt>
6633:
1.5 ! hubertf 6634: <dt><span class="sect1"><a href="#id2569330">11.2. Main
1.1 grant 6635: targets</a></span></dt>
6636:
6637: <dt><span class="sect1"><a href=
6638: "#build.helpful-targets">11.3. Other helpful
6639: targets</a></span></dt>
6640: </dl>
6641: </div>
6642:
6643: <p>The basic steps for building a program are always the
6644: same. First the program's source (<span class=
6645: "emphasis"><em>distfile</em></span>) must be brought to the
6646: local system and then extracted. After any patches to
6647: compile properly on NetBSD are applied, the software can be
6648: configured, then built (usually by compiling), and finally
6649: the generated binaries, etc. can be put into place on the
6650: system. These are exactly the steps performed by the NetBSD
6651: package system, which is implemented as a series of targets
6652: in a central Makefile, <tt class=
6653: "filename">pkgsrc/mk/bsd.pkg.mk</tt>.</p>
6654:
6655: <div class="sect1" lang="en" xml:lang="en">
6656: <div class="titlepage">
6657: <div>
6658: <div>
6659: <h2 class="title" style="clear: both"><a name=
6660: "build.prefix" id=
6661: "build.prefix"></a>11.1. Program location</h2>
6662: </div>
6663: </div>
6664: </div>
6665:
6666: <p>Before outlining the process performed by the NetBSD
6667: package system in the next section, here's a brief
6668: discussion on where programs are installed, and which
6669: variables influence this.</p>
6670:
6671: <p>The automatic variable <tt class="varname">PREFIX</tt>
6672: indicates where all files of the final program shall be
6673: installed. It is usually set to <tt class=
6674: "varname">LOCALBASE</tt> (<tt class=
6675: "filename">/usr/pkg</tt>), or <tt class=
6676: "varname">CROSSBASE</tt> for pkgs in the
6677: “<span class="quote">cross</span>” category.
6678: The value of <tt class="varname">PREFIX</tt> needs to be
6679: put into the various places in the program's source where
6680: paths to these files are encoded. See <a href=
6681: "#components.patches" title=
6682: "7.3. patches/*">Section 7.3,
6683: “patches/*”</a> and <a href="#fixes.libtool"
6684: title=
6685: "12.3.1. Shared libraries - libtool">Section 12.3.1,
6686: “Shared libraries - libtool”</a> for more
6687: details.</p>
6688:
6689: <p>When choosing which of these variables to use, follow
6690: the following rules:</p>
6691:
6692: <div class="itemizedlist">
6693: <ul type="disc">
6694: <li>
6695: <p><tt class="varname">PREFIX</tt> always points to
6696: the location where the current pkg will be
6697: installed. When referring to a pkg's own
6698: installation path, use “<span class=
6699: "quote">${PREFIX}</span>”.</p>
6700: </li>
6701:
6702: <li>
6703: <p><tt class="varname">LOCALBASE</tt> is where all
6704: non-X11 pkgs are installed. If you need to
6705: construct a -I or -L argument to the compiler to
6706: find includes and libraries installed by another
6707: non-X11 pkg, use “<span class=
6708: "quote">${LOCALBASE}</span>”.</p>
6709: </li>
6710:
6711: <li>
6712: <p><tt class="varname">X11BASE</tt> is where the
6713: actual X11 distribution (from xsrc, etc.) is
6714: installed. When looking for <span class=
6715: "emphasis"><em>standard</em></span> X11 includes
6716: (not those installed by a pkg), use
6717: “<span class=
6718: "quote">${X11BASE}</span>”.</p>
6719: </li>
6720:
6721: <li>
6722: <p>X11 based are special in that they may be
6723: installed in either <tt class=
6724: "varname">X11BASE</tt> or <tt class=
6725: "varname">LOCALBASE</tt>.</p>
6726:
6727: <p>Usually, X11 packages should be installed under
6728: <tt class="varname">LOCALBASE</tt> whenever
6729: possible. Note that you will need to set <tt class=
6730: "varname">USE_X11</tt> in them to request the
6731: presence of X11 and to get the right compilation
6732: flags.</p>
6733:
6734: <p>Even though, there are some packages that cannot
6735: be installed under <tt class=
6736: "varname">LOCALBASE</tt>: those that come with
6737: app-defaults files. These packages are special and
6738: they must be placed under <tt class=
6739: "varname">X11BASE</tt>. To accomplish this, set
6740: either <tt class="varname">USE_X11BASE</tt> or
6741: <tt class="varname">USE_IMAKE</tt> in your
6742: package.</p>
6743:
6744: <p>Some notes: <tt class="varname">USE_X11</tt> and
6745: <tt class="varname">USE_X11BASE</tt> are mutually
6746: exclusive. If you need to find includes or
6747: libraries installed by a pkg that has <tt class=
6748: "varname">USE_IMAKE</tt> or <tt class=
6749: "varname">USE_X11BASE</tt> in its pkg <tt class=
6750: "filename">Makefile</tt>, you need to use
6751: <span class="emphasis"><em>both</em></span>
6752: <tt class="filename">${X11BASE}</tt> and <tt class=
6753: "filename">${LOCALBASE}</tt>. To force installation
6754: of all X11 packages in <tt class=
6755: "varname">LOCALBASE</tt>, the <a xmlns=
6756: "http://www.w3.org/TR/xhtml1/transitional" href=
6757: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.2 hubertf 6758: class="pkgname">pkgtools/xpkgwedge</a> is
6759: enabled by default.</p>
1.1 grant 6760: </li>
6761:
6762: <li>
6763: <p><tt class="varname">X11PREFIX</tt> should be
6764: used to refer to the installed location of an X11
6765: package. <tt class="varname">X11PREFIX</tt> will be
6766: set to <tt class="varname">X11BASE</tt> if
6767: xpkgwedge is not installed, and to <tt class=
6768: "varname">LOCALBASE</tt> if xpkgwedge is
6769: installed.</p>
6770: </li>
6771:
6772: <li>
6773: <p>If xpkgwedge is installed, it is possible to
6774: have some packages installed in <tt class=
6775: "varname">X11BASE</tt> and some in <tt class=
6776: "varname">LOCALBASE</tt>. To determine the prefix
6777: of an installed package, the <tt class=
6778: "varname">EVAL_PREFIX</tt> definition can be used.
6779: It takes pairs in the format “<span class=
6780: "quote">DIRNAME=<package></span>”, and
6781: the make(1) variable <tt class=
6782: "varname">DIRNAME</tt> will be set to the prefix of
6783: the installed package <package>, or
6784: “<span class=
6785: "quote">${X11PREFIX}</span>” if the package
6786: is not installed.</p>
6787:
6788: <p>This is best illustrated by example.</p>
6789:
6790: <p>The following lines are taken from <tt class=
6791: "filename">pkgsrc/wm/scwm/Makefile</tt>:</p>
6792: <pre class="programlisting">
6793: EVAL_PREFIX+= GTKDIR=gtk+
6794: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
6795: --with-gtk-prefix="${GTKDIR}" \
6796: --enable-multibyte
6797: </pre>
6798:
6799: <p>Specific defaults can be defined for the
6800: packages evaluated using <tt class=
6801: "varname">EVAL_PREFIX</tt>, by using a definition
6802: of the form:</p>
6803: <pre class="programlisting">
6804: GTKDIR_DEFAULT= ${LOCALBASE}
6805: </pre>
6806:
6807: <p>where <tt class="varname">GTKDIR</tt>
6808: corresponds to the first definition in the
6809: <tt class="varname">EVAL_PREFIX</tt> pair.</p>
6810: </li>
6811:
6812: <li>
6813: <p>Within <tt class="filename">${PREFIX}</tt>,
6814: packages should install files according to hier(7),
6815: with the exception that manual pages go into
6816: <tt class="filename">${PREFIX}/man</tt>, not
6817: <tt class="filename">${PREFIX}/share/man</tt>.</p>
6818: </li>
6819: </ul>
6820: </div>
6821: </div>
6822:
6823: <div class="sect1" lang="en" xml:lang="en">
6824: <div class="titlepage">
6825: <div>
6826: <div>
6827: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 6828: "id2569330" id="id2569330"></a>11.2. Main
1.1 grant 6829: targets</h2>
6830: </div>
6831: </div>
6832: </div>
6833:
6834: <p>The main targets used during the build process defined
6835: in <tt class="filename">bsd.pkg.mk</tt> are:</p>
6836:
6837: <div class="variablelist">
6838: <dl>
6839: <dt><span class="term">fetch</span></dt>
6840:
6841: <dd>
6842: <p>This will check if the file(s) given in the
6843: variables <tt class="varname">DISTFILES</tt> and
6844: <tt class="varname">PATCHFILES</tt> (as defined in
6845: the package's Makefile) are present on the local
6846: system in <tt class=
6847: "filename">/usr/pkgsrc/distfiles</tt>. If they are
6848: not present, an attempt will be made to fetch them
6849: using commands of the form:</p>
6850: <pre class="programlisting">
6851: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
6852: </pre>
6853:
6854: <p>where ${site} varies through several
6855: possibilities in turn: first, <tt class=
6856: "varname">MASTER_SITE_OVERRIDE</tt> is tried, then
6857: the sites specified in either <tt class=
6858: "varname">SITES_file</tt> if defined, else
6859: <tt class="varname">MASTER_SITES</tt> or <tt class=
6860: "varname">PATCH_SITES</tt>, as applies, then
6861: finally the value of <tt class=
6862: "varname">MASTER_SITE_BACKUP</tt>. The order of all
6863: except the first can be optionally sorted by the
6864: user, via setting either <tt class=
6865: "varname">MASTER_SORT_AWK</tt> or <tt class=
6866: "varname">MASTER_SORT_REGEX</tt>.</p>
6867: </dd>
6868:
6869: <dt><span class="term">checksum</span></dt>
6870:
6871: <dd>
6872: <p>After the distfile(s) are fetched, their
6873: checksum is generated and compared with the
6874: checksums stored in the distinfo file. If the
6875: checksums don't match, the build is aborted. This
6876: is to ensure the same distfile is used for
6877: building, and that the distfile wasn't changed,
6878: e.g. by some malign force, deliberately changed
6879: distfiles on the master distribution site or
6880: network lossage.</p>
6881: </dd>
6882:
6883: <dt><span class="term">extract</span></dt>
6884:
6885: <dd>
6886: <p>When the distfiles are present on the local
6887: system, they need to be extracted, as they are
6888: usually in the form of some compressed archive
6889: format, most commonly <tt class=
6890: "filename">.tar.gz</tt>.</p>
6891:
6892: <p>If only some of the distfiles need to be
6893: uncompressed, the files to be uncompressed should
6894: be put into <tt class=
6895: "varname">EXTRACT_ONLY</tt>.</p>
6896:
6897: <p>If the distfiles are not in <tt class=
6898: "filename">.tar.gz</tt> format, they can be
6899: extracted by setting either <tt class=
6900: "varname">EXTRACT_SUFX</tt>, or <tt class=
6901: "varname">EXTRACT_CMD</tt>, <tt class=
6902: "varname">EXTRACT_BEFORE_ARGS</tt> and <tt class=
6903: "varname">EXTRACT_AFTER_ARGS</tt>. In the former
6904: case, pkgsrc knows how to extract a number of
6905: suffixes (<tt class="filename">.tar.gz</tt>,
6906: <tt class="filename">.tgz</tt>, <tt class=
6907: "filename">.tar.gz2</tt>, <tt class=
6908: "filename">.tbz</tt>, <tt class=
6909: "filename">.tar.Z</tt>, <tt class=
6910: "filename">.tar</tt>, <tt class=
6911: "filename">.shar.gz</tt>, <tt class=
6912: "filename">.shar.bz2</tt>, <tt class=
6913: "filename">.shar.Z</tt>, <tt class=
6914: "filename">.shar</tt>, <tt class=
6915: "filename">.Z</tt>, <tt class="filename">.bz2</tt>
6916: and <tt class="filename">.gz</tt>; see the
6917: definition of the various <tt class=
6918: "varname">DECOMPRESS_CMD</tt> variables <tt class=
6919: "filename">bsd.pkg.mk</tt> for a complete list).
6920: Here's an example on how to use the other variables
6921: for a program that comes with a compressed shell
6922: archive whose name ends in <tt class=
6923: "filename">.msg.gz</tt>:</p>
6924: <pre class="programlisting">
6925: EXTRACT_SUFX= .msg.gz
6926: EXTRACT_CMD= zcat
6927: EXTRACT_BEFORE_ARGS=
6928: EXTRACT_AFTER_ARGS= |sh
6929: </pre>
6930: </dd>
6931:
6932: <dt><span class="term">patch</span></dt>
6933:
6934: <dd>
6935: <p>After extraction, all the patches named by the
6936: <tt class="varname">PATCHFILES</tt>, those present
6937: in the patches subdirectory of the package as well
6938: as in $LOCALPATCHES/$PKGPATH (e.g. <tt class=
6939: "filename">/usr/local/patches/graphics/png</tt>)
6940: are applied. Patchfiles ending in <tt class=
6941: "filename">.Z</tt> or <tt class="filename">.gz</tt>
6942: are uncompressed before they are applied, files
6943: ending in <tt class="filename">.orig</tt> or
6944: <tt class="filename">.rej</tt> are ignored. Any
6945: special options to patch(1) can be handed in
6946: <tt class="varname">PATCH_DIST_ARGS</tt>. See
6947: <a href="#components.patches" title=
6948: "7.3. patches/*">Section 7.3,
6949: “patches/*”</a> for more details.</p>
6950:
6951: <p>By default patch(1) is given special args to
6952: make it fail if the patches apply with some lines
6953: of fuzz. Please fix (regen) the patches so that
6954: they apply cleanly. The rationale behind this is
6955: that patches that don't apply cleanly may end up
6956: being applied in the wrong place, and cause severe
6957: harm there.</p>
6958: </dd>
6959:
6960: <dt><span class="term">configure</span></dt>
6961:
6962: <dd>
6963: <p>Most pieces of software need information on the
6964: header files, system calls, and library routines
6965: which are available in NetBSD. This is the process
6966: known as configuration, and is usually automated.
6967: In most cases, a script is supplied with the
6968: source, and its invocation results in generation of
6969: header files, Makefiles, etc.</p>
6970:
6971: <p>If the program's distfile contains its own
6972: configure script, this can be invoked by setting
6973: <tt class="varname">HAS_CONFIGURE</tt>. If the
6974: configure script is a GNU autoconf script,
6975: <tt class="varname">GNU_CONFIGURE</tt> should be
6976: specified instead. In either case, any arguments to
6977: the configure script can be specified in the
6978: <tt class="varname">CONFIGURE_ARGS</tt> variable,
6979: and the configure script's name can be set in
6980: <tt class="varname">CONFIGURE_SCRIPT</tt> if it
6981: differs from the default “<span class=
6982: "quote">configure</span>”. Here's an example
6983: from the <a xmlns=
6984: "http://www.w3.org/TR/xhtml1/transitional" href=
6985: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.2 hubertf 6986: class="pkgname">sysutils/top</a> package:</p>
1.1 grant 6987: <pre class="programlisting">
6988: HAS_CONFIGURE= yes
6989: CONFIGURE_SCRIPT= Configure
6990: CONFIGURE_ARGS+= netbsd13
6991: </pre>
6992:
6993: <p>If the program uses an Imakefile for
6994: configuration, the appropriate steps can be invoked
6995: by setting <tt class="varname">USE_IMAKE</tt> to
6996: “<span class="quote">YES</span>”. (If
6997: you only want the package installed in <tt class=
6998: "varname">$X11PREFIX</tt> but xmkmf not being run,
6999: set <tt class="varname">USE_X11BASE</tt>
7000: instead!)</p>
7001: </dd>
7002:
7003: <dt><span class="term">build</span></dt>
7004:
7005: <dd>
7006: <p>Once configuration has taken place, the software
7007: will be built by invoking <tt class=
7008: "varname">$MAKE_PROGRAM</tt> on <tt class=
7009: "varname">$MAKEFILE</tt> with <tt class=
7010: "varname">$ALL_TARGET</tt> as the target to build.
7011: The default <tt class="varname">MAKE_PROGRAM</tt>
7012: is “<span class="quote">gmake</span>”
7013: if <tt class="varname">USE_GMAKE</tt> is set,
7014: “<span class="quote">make</span>”
7015: otherwise. <tt class="varname">MAKEFILE</tt> is set
7016: to “<span class=
7017: "quote">Makefile</span>” by default, and
7018: <tt class="varname">ALL_TARGET</tt> defaults to
7019: “<span class="quote">all</span>”. Any
7020: of these variables can be set in the package's
7021: Makefile to change the default build process.</p>
7022: </dd>
7023:
7024: <dt><span class="term">install</span></dt>
7025:
7026: <dd>
7027: <p>Once the build stage has completed, the final
7028: step is to install the software in public
7029: directories, so users can access the programs and
7030: files. As in the build-target, <tt class=
7031: "varname">$MAKE_PROGRAM</tt> is invoked on
7032: <tt class="varname">$MAKEFILE</tt> here, but with
7033: the <tt class="varname">$INSTALL_TARGET</tt>
7034: instead, the latter defaulting to
7035: “<span class="quote">install</span>”
7036: (plus “<span class=
7037: "quote">install.man</span>”, if <tt class=
7038: "varname">USE_IMAKE</tt> is set).</p>
7039: </dd>
7040: </dl>
7041: </div>
7042:
7043: <p>If no target is specified, the default is
7044: “<span class="quote">build</span>”. If a
7045: subsequent stage is requested, all prior stages are made:
7046: e.g. <span><b class="command">make build</b></span> will
7047: also perform the equivalent of:</p>
7048: <pre class="programlisting">
7049: make fetch
7050: make checksum
7051: make extract
7052: make patch
7053: make configure
7054: make build
7055: </pre>
7056: </div>
7057:
7058: <div class="sect1" lang="en" xml:lang="en">
7059: <div class="titlepage">
7060: <div>
7061: <div>
7062: <h2 class="title" style="clear: both"><a name=
7063: "build.helpful-targets" id=
7064: "build.helpful-targets"></a>11.3. Other
7065: helpful targets</h2>
7066: </div>
7067: </div>
7068: </div>
7069:
7070: <div class="variablelist">
7071: <dl>
7072: <dt><span class="term">pre/post-*</span></dt>
7073:
7074: <dd>
7075: <p>For any of the main targets described in the
7076: previous section, two auxiliary targets exist with
7077: “<span class="quote">pre-</span>” and
7078: “<span class="quote">post-</span>” used
7079: as a prefix for the main target's name. These
7080: targets are invoked before and after the main
7081: target is called, allowing extra configuration or
7082: installation steps be performed from a package's
7083: Makefile, for example, which a program's configure
7084: script or install target omitted.</p>
7085: </dd>
7086:
7087: <dt><span class="term">do-*</span></dt>
7088:
7089: <dd>
7090: <p>Should one of the main targets do the wrong
7091: thing, and should there be no variable to fix this,
7092: you can redefine it with the do-* target. (Note
7093: that redefining the target itself instead of the
7094: do-* target is a bad idea, as the pre-* and post-*
7095: targets won't be called anymore, etc.) You will not
7096: usually need to do this.</p>
7097: </dd>
7098:
7099: <dt><span class="term">reinstall</span></dt>
7100:
7101: <dd>
7102: <p>If you did a <span><b class="command">make
7103: install</b></span> and you noticed some file was
7104: not installed properly, you can repeat the
7105: installation with this target, which will ignore
7106: the “<span class="quote">already
7107: installed</span>” flag.</p>
7108: </dd>
7109:
7110: <dt><span class="term">deinstall</span></dt>
7111:
7112: <dd>
7113: <p>This target does a pkg_delete(1) in the current
7114: directory, effectively de-installing the package.
7115: The following variables can be used to tune the
7116: behaviour:</p>
7117:
7118: <div class="variablelist">
7119: <dl>
7120: <dt><span class="term"><tt class=
7121: "varname">PKG_VERBOSE</tt></span></dt>
7122:
7123: <dd>
7124: <p>Add a "-v" to the <a href=
7125: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7126: <span class="citerefentry"><span class=
7127: "refentrytitle">pkg_delete</span>(1)</span></a>
7128: command.</p>
7129: </dd>
7130:
7131: <dt><span class="term"><tt class=
7132: "varname">DEINSTALLDEPENDS</tt></span></dt>
7133:
7134: <dd>
7135: <p>Remove all packages that require (depend
7136: on) the given package. This can be used to
7137: remove any packages that may have been pulled
7138: in by a given package, e.g. if
7139: <span><b class="command">make deinstall
7140: DEINSTALLDEPENDS=1</b></span> is done in
7141: <tt class="filename">pkgsrc/x11/kde</tt>,
7142: this is likely to remove whole KDE. Works by
7143: adding “<span class=
7144: "quote">-R</span>” to the <a href=
7145: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7146: <span class="citerefentry"><span class=
7147: "refentrytitle">pkg_delete</span>(1)</span></a>
7148: command line.</p>
7149: </dd>
7150: </dl>
7151: </div>
7152: </dd>
7153:
7154: <dt><span class="term">update</span></dt>
7155:
7156: <dd>
7157: <p>This target causes the current package to be
7158: updated to the latest version. The package and all
7159: depending packages first get de-installed, then
7160: current versions of the corresponding packages get
7161: compiled and installed. This is similar to manually
7162: noting which packages are currently installed, then
7163: performing a series of <span><b class=
7164: "command">make deinstall</b></span> and
7165: <span><b class="command">make install</b></span>
7166: (or whatever <tt class="varname">UPDATE_TARGET</tt>
7167: is set to) for these packages.</p>
7168:
7169: <p>You can use the “<span class=
7170: "quote">update</span>” target to resume
7171: package updating in case a previous <span><b class=
7172: "command">make update</b></span> was interrupted
7173: for some reason. However, in this case, make sure
7174: you don't call <span><b class="command">make
7175: clean</b></span> or otherwise remove the list of
7176: dependent packages in <tt class=
7177: "varname">WRKDIR</tt>. Otherwise you lose the
7178: ability to automatically update the current package
7179: along with the dependent packages you have
7180: installed.</p>
7181:
7182: <p>Resuming an interrupted <span><b class=
7183: "command">make update</b></span> will only work as
7184: long as the package tree remains unchanged. If the
7185: source code for one of the packages to be updated
7186: has been changed, resuming <span><b class=
7187: "command">make update</b></span> will most
7188: certainly fail!</p>
7189:
7190: <p>The following variables can be used either on
7191: the command line or in <tt class=
7192: "filename">/etc/mk.conf</tt> to alter the behaviour
7193: of <span><b class="command">make
7194: update</b></span>:</p>
7195:
7196: <div class="variablelist">
7197: <dl>
7198: <dt><span class="term"><tt class=
7199: "varname">UPDATE_TARGET</tt></span></dt>
7200:
7201: <dd>
7202: <p>Install target to recursively use for the
7203: updated package and the dependent packages.
7204: Defaults to <tt class=
7205: "varname">DEPENDS_TARGET</tt> if set,
7206: “<span class=
7207: "quote">install</span>” otherwise for
7208: <span><b class="command">make
7209: update</b></span>. e.g. <span><b class=
7210: "command">make update
7211: UPDATE_TARGET=package</b></span></p>
7212: </dd>
7213:
7214: <dt><span class="term"><tt class=
7215: "varname">NOCLEAN</tt></span></dt>
7216:
7217: <dd>
7218: <p>Don't clean up after updating. Useful if
7219: you want to leave the work sources of the
7220: updated packages around for inspection or
7221: other purposes. Be sure you eventually clean
7222: up the source tree (see the
7223: “<span class=
7224: "quote">clean-update</span>” target
7225: below) or you may run into troubles with old
7226: source code still lying around on your next
7227: <span><b class="command">make</b></span> or
7228: <span><b class="command">make
7229: update</b></span>.</p>
7230: </dd>
7231:
7232: <dt><span class="term"><tt class=
7233: "varname">REINSTALL</tt></span></dt>
7234:
7235: <dd>
7236: <p>Deinstall each package before installing
7237: (making <tt class=
7238: "varname">DEPENDS_TARGET</tt>). This may be
7239: necessary if the “<span class=
7240: "quote">clean-update</span>” target
7241: (see below) was called after interrupting a
7242: running <span><b class="command">make
7243: update</b></span>.</p>
7244: </dd>
7245:
7246: <dt><span class="term"><tt class=
7247: "varname">DEPENDS_TARGET</tt></span></dt>
7248:
7249: <dd>
7250: <p>Allows you to disable recursion and
7251: hardcode the target for packages. The default
7252: is “<span class=
7253: "quote">update</span>” for the update
7254: target, facilitating a recursive update of
7255: prerequisite packages. Only set <tt class=
7256: "varname">DEPENDS_TARGET</tt> if you want to
7257: disable recursive updates. Use <tt class=
7258: "varname">UPDATE_TARGET</tt> instead to just
7259: set a specific target for each package to be
7260: installed during <span><b class=
7261: "command">make update</b></span> (see
7262: above).</p>
7263: </dd>
7264: </dl>
7265: </div>
7266: </dd>
7267:
7268: <dt><span class="term">clean-update</span></dt>
7269:
7270: <dd>
7271: <p>Clean the source tree for all packages that
7272: would get updated if <span><b class="command">make
7273: update</b></span> was called from the current
7274: directory. This target should not be used if the
7275: current package (or any of its depending packages)
7276: have already been de-installed (e.g., after calling
7277: <span><b class="command">make update</b></span>) or
7278: you may lose some packages you intended to update.
7279: As a rule of thumb: only use this target
7280: <span class="emphasis"><em>before</em></span> the
7281: first time you run <span><b class="command">make
7282: update</b></span> and only if you have a dirty
7283: package tree (e.g., if you used <tt class=
7284: "varname">NOCLEAN</tt>).</p>
7285:
7286: <p>If you unsure about whether your tree is clean
7287: you can either perform a <span><b class=
7288: "command">make clean</b></span> at the top of the
7289: tree, or use the following sequence of commands
7290: from the directory of the package you want to
7291: update (<span class=
7292: "emphasis"><em>before</em></span> running
7293: <span><b class="command">make update</b></span> for
7294: the first time, otherwise you lose all the packages
7295: you wanted to update!):</p>
7296: <pre class="screen">
7297: <tt class="prompt">#</tt> <b class=
7298: "userinput"><tt>make clean-update</tt></b>
7299: <tt class="prompt">#</tt> <b class=
7300: "userinput"><tt>make clean CLEANDEPENDS=YES</tt></b>
7301: <tt class="prompt">#</tt> <b class=
7302: "userinput"><tt>make update</tt></b>
7303: </pre>
7304:
7305: <p>The following variables can be used either on
7306: the command line or in <tt class=
7307: "filename">/etc/mk.conf</tt> to alter the behaviour
7308: of <span><b class="command">make
7309: clean-update</b></span>:</p>
7310:
7311: <div class="variablelist">
7312: <dl>
7313: <dt><span class="term"><tt class=
7314: "varname">CLEAR_DIRLIST</tt></span></dt>
7315:
7316: <dd>
7317: <p>After <span><b class="command">make
7318: clean</b></span>, do not reconstruct the list
7319: of directories to update for this package.
7320: Only use this if <span><b class=
7321: "command">make update</b></span> successfully
7322: installed all packages you wanted to update.
7323: Normally, this is done automatically on
7324: <span><b class="command">make
7325: update</b></span>, but may have been
7326: suppressed by the <tt class=
7327: "varname">NOCLEAN</tt> variable (see
7328: above).</p>
7329: </dd>
7330: </dl>
7331: </div>
7332: </dd>
7333:
7334: <dt><span class="term">info</span></dt>
7335:
7336: <dd>
7337: <p>This target invokes <a href=
7338: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
7339: <span class="citerefentry"><span class=
7340: "refentrytitle">pkg_info</span>(1)</span></a> for
7341: the current package. You can use this to check
7342: which version of a package is installed.</p>
7343: </dd>
7344:
7345: <dt><span class="term">readme</span></dt>
7346:
7347: <dd>
7348: <p>This target generates a <tt class=
7349: "filename">README.html</tt> file, which can be
7350: viewed using a browser such as <a xmlns=
7351: "http://www.w3.org/TR/xhtml1/transitional" href=
7352: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.2 hubertf 7353: class="pkgname">www/mozilla</a> or <a xmlns=
7354: "http://www.w3.org/TR/xhtml1/transitional" href=
7355: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
7356: class="pkgname">www/links</a>. The generated
7357: files contain references to any packages which
7358: are in the <tt class="varname">PACKAGES</tt>
7359: directory on the local host. The generated files
7360: can be made to refer to URLs based on <tt class=
7361: "varname">FTP_PKG_URL_HOST</tt> and <tt class=
7362: "varname">FTP_PKG_URL_DIR</tt>. For example, if
7363: I wanted to generate <tt class=
7364: "filename">README.html</tt> files which pointed
7365: to binary packages on the local machine, in the
7366: directory <tt class=
7367: "filename">/usr/packages</tt>, set <tt class=
7368: "varname">FTP_PKG_URL_HOST=file://localhost</tt>
7369: and <tt class=
7370: "varname">FTP_PKG_URL_DIR=/usr/packages</tt>.
7371: The <tt class="varname">${PACKAGES}</tt>
7372: directory and its subdirectories will be
7373: searched for all the binary packages.</p>
1.1 grant 7374: </dd>
7375:
7376: <dt><span class="term">readme-all</span></dt>
7377:
7378: <dd>
7379: <p>Use this target to create a file <tt class=
7380: "filename">README-all.html</tt> which contains a
7381: list of all packages currently available in the
7382: NetBSD Packages Collection, together with the
7383: category they belong to and a short description.
7384: This file is compiled from the <tt class=
7385: "filename">pkgsrc/*/README.html</tt> files, so be
7386: sure to run this <span class=
7387: "emphasis"><em>after</em></span> a <span><b class=
7388: "command">make readme</b></span>.</p>
7389: </dd>
7390:
7391: <dt><span class="term">cdrom-readme</span></dt>
7392:
7393: <dd>
7394: <p>This is very much the same as the
7395: “<span class="quote">readme</span>”
7396: target (see above), but is to be used when
7397: generating a pkgsrc tree to be written to a CD-ROM.
7398: This target also produces <tt class=
7399: "filename">README.html</tt> files, and can be made
7400: to refer to URLs based on <tt class=
7401: "varname">CDROM_PKG_URL_HOST</tt> and <tt class=
7402: "varname">CDROM_PKG_URL_DIR</tt>.</p>
7403: </dd>
7404:
7405: <dt><span class="term">show-distfiles</span></dt>
7406:
7407: <dd>
7408: <p>This target shows which distfiles and patchfiles
7409: are needed to build the package. (<tt class=
7410: "varname">DISTFILES</tt> and <tt class=
7411: "varname">PATCHFILES</tt>, but not <tt class=
7412: "filename">patches/*</tt>)</p>
7413: </dd>
7414:
7415: <dt><span class="term">show-downlevel</span></dt>
7416:
7417: <dd>
7418: <p>This target shows nothing if the package is not
7419: installed. If a version of this package is
7420: installed, but is not the version provided in this
7421: version of pkgsrc, then a warning message is
7422: displayed. This target can be used to show which of
7423: your installed packages are downlevel, and so the
7424: old versions can be deleted, and the current ones
7425: added.</p>
7426: </dd>
7427:
7428: <dt><span class="term">show-pkgsrc-dir</span></dt>
7429:
7430: <dd>
7431: <p>This target shows the directory in the pkgsrc
7432: hierarchy from which the package can be built and
7433: installed. This may not be the same directory as
7434: the one from which the package was installed. This
7435: target is intended to be used by people who may
7436: wish to upgrade many packages on a single host, and
7437: can be invoked from the top-level pkgsrc Makefile
7438: by using the “<span class=
7439: "quote">show-host-specific-pkgs</span>”
7440: target.</p>
7441: </dd>
7442:
7443: <dt><span class=
7444: "term">show-installed-depends</span></dt>
7445:
7446: <dd>
7447: <p>This target shows which installed packages match
7448: the current package's <tt class=
7449: "varname">DEPENDS</tt>. Useful if out of date
7450: dependencies are causing build problems.</p>
7451: </dd>
7452:
7453: <dt><span class="term">check-shlibs</span></dt>
7454:
7455: <dd>
7456: <p>After a package is installed, check all its
7457: binaries and (on ELF platforms) shared libraries to
7458: see if they find the shared libs they need. Run by
7459: default if <tt class="varname">PKG_DEVELOPER</tt>
7460: is set in <tt class=
7461: "filename">/etc/mk.conf</tt>.</p>
7462: </dd>
7463:
7464: <dt><span class="term">print-PLIST</span></dt>
7465:
7466: <dd>
7467: <p>After a “<span class="quote">make
7468: install</span>” from a new or upgraded pkg,
7469: this prints out an attempt to generate a new
7470: <tt class="filename">PLIST</tt> from a
7471: <span><b class="command">find -newer
7472: work/.extract_done</b></span>. An attempt is made
7473: to care for shared libs etc., but it is
7474: <span class="emphasis"><em>strongly</em></span>
7475: recommended to review the result before putting it
7476: into <tt class="filename">PLIST</tt>. On upgrades,
7477: it's useful to diff the output of this command
7478: against an already existing <tt class=
7479: "filename">PLIST</tt> file.</p>
7480:
7481: <p>If the package installs files via tar(1) or
7482: other methods that don't update file access times,
7483: be sure to add these files manually to your
7484: <tt class="filename">PLIST</tt>, as the
7485: “<span class="quote">find
7486: -newer</span>” command used by this target
7487: won't catch them!</p>
7488:
7489: <p>See <a href="#print-PLIST" title=
7490: "8.3. Tweaking output of make print-PLIST">Section 8.3,
7491: “Tweaking output of make
7492: print-PLIST”</a> for more information on this
7493: target.</p>
7494: </dd>
7495:
7496: <dt><span class="term">bulk-package</span></dt>
7497:
7498: <dd>
7499: <p>Used to do bulk builds. If an appropriate binary
7500: package already exists, no action is taken. If not,
7501: this target will compile, install and package it
7502: (and it's depends, if <tt class=
7503: "varname">PKG_DEPENDS</tt> is set properly. See
7504: <a href="#binary.configuration" title=
7505: "5.3.1. Configuration">Section 5.3.1,
7506: “Configuration”</a>. After creating the
7507: binary package, the sources, the just-installed
7508: package and it's required packages are removed,
7509: preserving free disk space.</p>
7510:
7511: <p><span class="emphasis"><em>Beware that this
7512: target may deinstall all packages installed on a
7513: system!</em></span></p>
7514: </dd>
7515:
7516: <dt><span class="term">bulk-install</span></dt>
7517:
7518: <dd>
7519: <p>Used during bulk-installs to install required
7520: packages. If an upto-date binary package is
7521: available, it will be installed via <a href=
7522: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7523: <span class="citerefentry"><span class=
7524: "refentrytitle">pkg_add</span>(1)</span></a>. If
7525: not, <span><b class="command">make
7526: bulk-package</b></span> will be executed, but the
7527: installed binary not be removed.</p>
7528:
7529: <p>A binary package is considered
7530: “<span class="quote">upto-date</span>”
7531: to be installed via <a href=
7532: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7533: <span class="citerefentry"><span class=
7534: "refentrytitle">pkg_add</span>(1)</span></a>
7535: if:</p>
7536:
7537: <div class="itemizedlist">
7538: <ul type="disc">
7539: <li>
7540: <p>None of the package's files (<tt class=
7541: "filename">Makefile</tt>, ...) were modified
7542: since it was built.</p>
7543: </li>
7544:
7545: <li>
7546: <p>None of the package's required (binary)
7547: packages were modified since it was
7548: built.</p>
7549: </li>
7550: </ul>
7551: </div>
7552:
7553: <p><span class="emphasis"><em>Beware that this
7554: target may deinstall all packages installed on a
7555: system!</em></span></p>
7556: </dd>
7557: </dl>
7558: </div>
7559: </div>
7560: </div>
7561:
7562: <div class="chapter" lang="en" xml:lang="en">
7563: <div class="titlepage">
7564: <div>
7565: <div>
7566: <h2 class="title"><a name="fixes" id=
7567: "fixes"></a>Chapter 12. Notes on fixes for
7568: packages</h2>
7569: </div>
7570: </div>
7571: </div>
7572:
7573: <div class="toc">
7574: <p><b>Table of Contents</b></p>
7575:
7576: <dl>
1.5 ! hubertf 7577: <dt><span class="sect1"><a href="#id2570795">12.1.
1.1 grant 7578: General operation</a></span></dt>
7579:
7580: <dd>
7581: <dl>
7582: <dt><span class="sect2"><a href=
1.5 ! hubertf 7583: "#id2570798">12.1.1. How to pull in variables from
1.1 grant 7584: /etc/mk.conf</a></span></dt>
7585:
7586: <dt><span class="sect2"><a href=
1.5 ! hubertf 7587: "#id2570882">12.1.2. Restricted
1.1 grant 7588: packages</a></span></dt>
7589:
7590: <dt><span class="sect2"><a href=
7591: "#dependencies">12.1.3. Handling
7592: dependencies</a></span></dt>
7593:
7594: <dt><span class="sect2"><a href=
1.5 ! hubertf 7595: "#id2571260">12.1.4. Handling conflicts with other
1.1 grant 7596: packages</a></span></dt>
7597:
7598: <dt><span class="sect2"><a href=
1.5 ! hubertf 7599: "#id2571447">12.1.5. Packages that cannot or should
1.1 grant 7600: not be built</a></span></dt>
7601:
7602: <dt><span class="sect2"><a href=
1.5 ! hubertf 7603: "#id2571473">12.1.6. Packages which should not be
1.1 grant 7604: deleted, once installed</a></span></dt>
7605:
7606: <dt><span class="sect2"><a href=
7607: "#security-handling">12.1.7. Handling packages with
7608: security problems</a></span></dt>
7609:
7610: <dt><span class="sect2"><a href=
1.5 ! hubertf 7611: "#id2571564">12.1.8. How to handle compiler
1.1 grant 7612: bugs</a></span></dt>
7613:
7614: <dt><span class="sect2"><a href=
1.5 ! hubertf 7615: "#id2571587">12.1.9. How to handle incrementing
1.1 grant 7616: versions when fixing an existing
7617: package</a></span></dt>
7618:
7619: <dt><span class="sect2"><a href=
1.5 ! hubertf 7620: "#id2571704">12.1.10. Portability of
1.1 grant 7621: packages</a></span></dt>
7622: </dl>
7623: </dd>
7624:
1.5 ! hubertf 7625: <dt><span class="sect1"><a href="#id2571729">12.2.
1.1 grant 7626: Possible downloading issues</a></span></dt>
7627:
7628: <dd>
7629: <dl>
7630: <dt><span class="sect2"><a href=
1.5 ! hubertf 7631: "#id2571732">12.2.1. Packages whose distfiles
1.1 grant 7632: aren't available for plain
7633: downloading</a></span></dt>
7634:
7635: <dt><span class="sect2"><a href=
1.5 ! hubertf 7636: "#id2571795">12.2.2. How to handle modified
1.1 grant 7637: distfiles with the 'old' name</a></span></dt>
7638: </dl>
7639: </dd>
7640:
1.5 ! hubertf 7641: <dt><span class="sect1"><a href="#id2571806">12.3.
1.1 grant 7642: Configuration gotchas</a></span></dt>
7643:
7644: <dd>
7645: <dl>
7646: <dt><span class="sect2"><a href=
7647: "#fixes.libtool">12.3.1. Shared libraries -
7648: libtool</a></span></dt>
7649:
7650: <dt><span class="sect2"><a href=
1.5 ! hubertf 7651: "#id2572350">12.3.2. Using libtool on GNU packages
1.1 grant 7652: that already support libtool</a></span></dt>
7653:
7654: <dt><span class="sect2"><a href=
1.5 ! hubertf 7655: "#id2572435">12.3.3. GNU
1.1 grant 7656: Autoconf/Automake</a></span></dt>
7657: </dl>
7658: </dd>
7659:
1.5 ! hubertf 7660: <dt><span class="sect1"><a href="#id2572480">12.4.
1.1 grant 7661: Building considerations</a></span></dt>
7662:
7663: <dd>
7664: <dl>
7665: <dt><span class="sect2"><a href=
1.5 ! hubertf 7666: "#id2572483">12.4.1. CPP defines</a></span></dt>
1.1 grant 7667: </dl>
7668: </dd>
7669:
1.5 ! hubertf 7670: <dt><span class="sect1"><a href="#id2572513">12.5.
1.1 grant 7671: Package specific actions</a></span></dt>
7672:
7673: <dd>
7674: <dl>
7675: <dt><span class="sect2"><a href=
1.5 ! hubertf 7676: "#id2572516">12.5.1. Package configuration
1.1 grant 7677: files</a></span></dt>
7678:
7679: <dt><span class="sect2"><a href=
1.5 ! hubertf 7680: "#id2572618">12.5.2. User
1.2 hubertf 7681: interaction</a></span></dt>
1.1 grant 7682:
7683: <dt><span class="sect2"><a href=
1.5 ! hubertf 7684: "#id2572663">12.5.3. Handling
1.1 grant 7685: licenses</a></span></dt>
7686:
7687: <dt><span class="sect2"><a href=
1.5 ! hubertf 7688: "#id2572746">12.5.4. Creating an account from a
1.1 grant 7689: package</a></span></dt>
7690:
7691: <dt><span class="sect2"><a href=
1.5 ! hubertf 7692: "#id2572876">12.5.5. Installing score
1.1 grant 7693: files</a></span></dt>
7694:
7695: <dt><span class="sect2"><a href=
1.5 ! hubertf 7696: "#id2573057">12.5.6. Packages providing login
1.1 grant 7697: shells</a></span></dt>
7698:
7699: <dt><span class="sect2"><a href=
1.5 ! hubertf 7700: "#id2573182">12.5.7. Packages containing perl
1.1 grant 7701: scripts</a></span></dt>
7702:
7703: <dt><span class="sect2"><a href=
1.5 ! hubertf 7704: "#id2573201">12.5.8. Packages with hardcoded paths
1.1 grant 7705: to other interpreters</a></span></dt>
7706:
7707: <dt><span class="sect2"><a href=
1.5 ! hubertf 7708: "#id2573222">12.5.9. Packages installing perl
1.1 grant 7709: modules</a></span></dt>
7710:
7711: <dt><span class="sect2"><a href=
7712: "#faq.info-files">12.5.10. Packages installing info
7713: files</a></span></dt>
7714:
7715: <dt><span class="sect2"><a href=
1.5 ! hubertf 7716: "#id2573442">12.5.11. Packages installing GConf2
1.1 grant 7717: data files</a></span></dt>
7718:
7719: <dt><span class="sect2"><a href=
1.5 ! hubertf 7720: "#id2573610">12.5.12. Packages installing
1.1 grant 7721: scrollkeeper data files</a></span></dt>
7722:
7723: <dt><span class="sect2"><a href=
1.5 ! hubertf 7724: "#id2573661">12.5.13. Packages installing X11
1.1 grant 7725: fonts</a></span></dt>
7726:
7727: <dt><span class="sect2"><a href=
1.5 ! hubertf 7728: "#id2573708">12.5.14. Packages installing GTK2
1.1 grant 7729: modules</a></span></dt>
7730:
7731: <dt><span class="sect2"><a href=
1.5 ! hubertf 7732: "#id2573778">12.5.15. Packages installing SGML or
1.1 grant 7733: XML data</a></span></dt>
7734:
7735: <dt><span class="sect2"><a href=
1.5 ! hubertf 7736: "#id2573830">12.5.16. Packages installing
1.1 grant 7737: extensions to the MIME database</a></span></dt>
7738:
7739: <dt><span class="sect2"><a href=
1.5 ! hubertf 7740: "#id2573969">12.5.17. Packages using
1.1 grant 7741: intltool</a></span></dt>
7742: </dl>
7743: </dd>
7744:
1.5 ! hubertf 7745: <dt><span class="sect1"><a href="#id2573982">12.6.
1.1 grant 7746: Feedback to the author</a></span></dt>
7747: </dl>
7748: </div>
7749:
7750: <div class="sect1" lang="en" xml:lang="en">
7751: <div class="titlepage">
7752: <div>
7753: <div>
7754: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 7755: "id2570795" id="id2570795"></a>12.1. General
1.1 grant 7756: operation</h2>
7757: </div>
7758: </div>
7759: </div>
7760:
7761: <div class="sect2" lang="en" xml:lang="en">
7762: <div class="titlepage">
7763: <div>
7764: <div>
1.5 ! hubertf 7765: <h3 class="title"><a name="id2570798" id=
! 7766: "id2570798"></a>12.1.1. How to pull in
1.1 grant 7767: variables from /etc/mk.conf</h3>
7768: </div>
7769: </div>
7770: </div>
7771:
7772: <p>The problem with package-defined variables that can
7773: be overridden via <tt class="varname">MAKECONF</tt> or
7774: <tt class="filename">/etc/mk.conf</tt> is that <a href=
7775: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7776: <span class="citerefentry"><span class=
7777: "refentrytitle">make</span>(1)</span></a> expands a
7778: variable as it is used, but evaluates preprocessor like
7779: statements (.if, .ifdef and .ifndef) as they are read.
7780: So, to use any variable (which may be set in <tt class=
7781: "filename">/etc/mk.conf</tt>) in one of the .if*
7782: statements, the file <tt class=
7783: "filename">/etc/mk.conf</tt> must be included before
7784: that .if* statement.</p>
7785:
7786: <p>Rather than have a number of ad-hoc ways of
7787: including <tt class="filename">/etc/mk.conf</tt>,
7788: should it exist, or <tt class="varname">MAKECONF</tt>,
7789: should it exist, include the <tt class=
7790: "filename">pkgsrc/mk/bsd.prefs.mk</tt> file in the
7791: package Makefile before any preprocessor-like .if,
7792: .ifdef, or .ifndef statements:</p>
7793: <pre class="programlisting">
7794: .include "../../mk/bsd.prefs.mk"
7795:
7796: .if defined(USE_MENUS)
7797: ...
7798: .endif
7799: </pre>
7800:
7801: <p>If you wish to set the <tt class=
7802: "varname">CFLAGS</tt> variable in <tt class=
7803: "filename">/etc/mk.conf</tt> please make sure to
7804: use:</p>
7805: <pre class="programlisting">
7806: CFLAGS+= -your -flags
7807: </pre>
7808:
7809: <p>Using <tt class="varname">CFLAGS=</tt> (i.e. without
7810: the “<span class="quote">+</span>”) may
7811: lead to problems with packages that need to add their
7812: own flags. Also, you may want to take a look at the
7813: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
7814: href=
7815: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.2 hubertf 7816: class="pkgname">devel/cpuflags</a> package if you're
7817: interested in optimization for the current CPU.</p>
1.1 grant 7818: </div>
7819:
7820: <div class="sect2" lang="en" xml:lang="en">
7821: <div class="titlepage">
7822: <div>
7823: <div>
1.5 ! hubertf 7824: <h3 class="title"><a name="id2570882" id=
! 7825: "id2570882"></a>12.1.2. Restricted
1.1 grant 7826: packages</h3>
7827: </div>
7828: </div>
7829: </div>
7830:
7831: <p>Some licenses restrict how software may be
7832: re-distributed. In order to satisfy these restrictions,
7833: the package system defines five make variables that can
7834: be set to note these restrictions:</p>
7835:
7836: <div class="itemizedlist">
7837: <ul type="disc">
7838: <li>
7839: <p><tt class="varname">RESTRICTED</tt></p>
7840:
7841: <p>This variable should be set whenever a
7842: restriction exists (regardless of its kind). Set
7843: this variable to a string containing the reason
7844: for the restriction.</p>
7845: </li>
7846:
7847: <li>
7848: <p><tt class="varname">NO_BIN_ON_CDROM</tt></p>
7849:
7850: <p>Binaries may not be placed on CD-ROM. Set this
7851: variable to <tt class=
7852: "varname">${RESTRICTED}</tt> whenever a binary
7853: package may not be included on a CD-ROM.</p>
7854: </li>
7855:
7856: <li>
7857: <p><tt class="varname">NO_BIN_ON_FTP</tt></p>
7858:
7859: <p>Binaries may not be placed on an FTP server.
7860: Set this variable to <tt class=
7861: "varname">${RESTRICTED}</tt> whenever a binary
7862: package may not not be made available on the
7863: Internet.</p>
7864: </li>
7865:
7866: <li>
7867: <p><tt class="varname">NO_SRC_ON_CDROM</tt></p>
7868:
7869: <p>Distfiles may not be placed on CD-ROM. Set
7870: this variable to <tt class=
7871: "varname">${RESTRICTED}</tt> if re-distribution
7872: of the source code or other distfile(s) is not
7873: allowed on CD-ROMs.</p>
7874: </li>
7875:
7876: <li>
7877: <p><tt class="varname">NO_SRC_ON_FTP</tt></p>
7878:
7879: <p>Distfiles may not be placed on FTP. Set this
7880: variable to <tt class=
7881: "varname">${RESTRICTED}</tt> if re-distribution
7882: of the source code or other distfile(s) via the
7883: Internet is not allowed.</p>
7884: </li>
7885: </ul>
7886: </div>
7887:
7888: <p>Please note that the use of <tt class=
7889: "varname">NO_PACKAGE</tt>, <tt class=
7890: "varname">IGNORE</tt>, <tt class=
7891: "varname">NO_CDROM</tt>, or other generic make
7892: variables to denote restrictions is deprecated, because
7893: they unconditionally prevent users from generating
7894: binary packages!</p>
7895: </div>
7896:
7897: <div class="sect2" lang="en" xml:lang="en">
7898: <div class="titlepage">
7899: <div>
7900: <div>
7901: <h3 class="title"><a name="dependencies" id=
7902: "dependencies"></a>12.1.3. Handling
7903: dependencies</h3>
7904: </div>
7905: </div>
7906: </div>
7907:
7908: <p>Your package may depend on some other package being
7909: present - and there are various ways of expressing this
7910: dependency. pkgsrc supports the <tt class=
7911: "varname">BUILD_DEPENDS</tt> and <tt class=
7912: "varname">DEPENDS</tt> definitions, as well as
7913: dependencies via <tt class=
7914: "filename">buildlink3.mk</tt>, which is the preferred
7915: way to handle dependencies, and which uses the
7916: variables named above. See <a href="#buildlink" title=
7917: "Chapter 9. Buildlink methodology">Chapter 9,
7918: <i>Buildlink methodology</i></a> for more
7919: information.</p>
7920:
7921: <p>The basic difference between the two variables is as
7922: follows: The <tt class="varname">DEPENDS</tt>
7923: definition registers that pre-requisite in the binary
7924: package so it will be pulled in when the binary package
7925: is later installed, whilst the <tt class=
7926: "varname">BUILD_DEPENDS</tt> definition does not,
7927: marking a dependency that is only needed for building
7928: the package.</p>
7929:
7930: <p>This means that if you only need a package present
7931: whilst you are building, it should be noted as a
7932: <tt class="varname">BUILD_DEPENDS</tt>.</p>
7933:
7934: <p>The format for a <tt class=
7935: "varname">BUILD_DEPENDS</tt> and a <tt class=
7936: "varname">DEPENDS</tt> definition is:</p>
7937: <pre class="programlisting">
7938: <pre-req-package-name>:../../<category>/<pre-req-package>
7939: </pre>
7940:
7941: <p>Please note that the “<span class=
7942: "quote">pre-req-package-name</span>” may include
7943: any of the wildcard version numbers recognised by
7944: <a href=
7945: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
7946: <span class="citerefentry"><span class=
7947: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
7948:
7949: <div class="orderedlist">
7950: <ol type="1">
7951: <li>
7952: <p>If your package needs another package's
7953: binaries or libraries to build or run, and if
7954: that package has a <tt class=
7955: "filename">buildlink3.mk</tt> file available, use
7956: it:</p>
7957: <pre class="programlisting">
7958: .include "../../graphics/jpeg/buildlink3.mk"
7959:
7960: </pre>
7961: </li>
7962:
7963: <li>
7964: <p>If your package needs to use another package
7965: to build itself and there is no <tt class=
7966: "filename">buildlink3.mk</tt> file available, use
7967: the <tt class="varname">BUILD_DEPENDS</tt>
7968: definition:</p>
7969: <pre class="programlisting">
7970: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
7971: </pre>
7972: </li>
7973:
7974: <li>
7975: <p>If your package needs a library with which to
7976: link and again there is no <tt class=
7977: "filename">buildlink3.mk</tt> file available,
7978: this is specified using the <tt class=
7979: "varname">DEPENDS</tt> definition. An example of
7980: this is the <a xmlns=
7981: "http://www.w3.org/TR/xhtml1/transitional" href=
7982: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.2 hubertf 7983: class="pkgname">print/lyx</a> package, which
7984: uses the xpm library, version 3.4j to
7985: build:</p>
1.1 grant 7986: <pre class="programlisting">
7987: DEPENDS+= xpm-3.4j:../../graphics/xpm
7988: </pre>
7989:
7990: <p>You can also use wildcards in package
7991: dependences:</p>
7992: <pre class="programlisting">
7993: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
7994: </pre>
7995:
7996: <p>Note that such wildcard dependencies are
7997: retained when creating binary packages. The
7998: dependency is checked when installing the binary
7999: package and any package which matches the pattern
8000: will be used. Wildcard dependencies should be
8001: used with care.</p>
8002:
8003: <p>The “<span class=
8004: "quote">-[0-9]*</span>” should be used
8005: instead of “<span class=
8006: "quote">-*</span>” to avoid potentially
8007: ambiguous matches such as “<span class=
8008: "quote">tk-postgresql</span>” matching a
8009: “<span class="quote">tk-*</span>”
8010: <tt class="varname">DEPENDS</tt>.</p>
8011:
8012: <p>Wildcards can also be used to specify that a
8013: package will only build against a certain minimum
8014: version of a pre-requisite:</p>
8015: <pre class="programlisting">
8016: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
8017: </pre>
8018:
8019: <p>This means that the package will build against
8020: version 3.5.4 of the tiff library or newer. Such
8021: a dependency may be warranted if, for example,
8022: the API of the library has changed with version
8023: 3.5.4 and a package would not compile against an
8024: earlier version of tiff.</p>
8025:
8026: <p>Please note that such dependencies should only
8027: be updated if a package requires a newer
8028: pre-requisite, but not to denote recommendations
8029: such as security updates or ABI changes that do
8030: not prevent a package from building correctly.
8031: Such recommendations can be expressed using
8032: <tt class="varname">RECOMMENDED</tt>:</p>
8033: <pre class="programlisting">
8034: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
8035: </pre>
8036:
8037: <p>In addition to the above <tt class=
8038: "varname">DEPENDS</tt> line, this denotes that
8039: while a package will build against
8040: tiff>=3.5.4, at least version 3.6.1 is
8041: recommended. <tt class="varname">RECOMMENDED</tt>
8042: entries will be turned into dependencies unless
8043: explicitly ignored (in which case a warning will
8044: be printed). Packages that are built with
8045: recommendations ignored may not be uploaded to
8046: ftp.NetBSD.org by developers and should not be
8047: used across different systems that may have
8048: different versions of binary packages
8049: installed.</p>
8050:
8051: <p>For security fixes, please update the package
8052: vulnerabilities file as well as setting
8053: <tt class="varname">RECOMMENDED</tt>, see
8054: <a href="#security-handling" title=
8055: "12.1.7. Handling packages with security problems">
8056: Section 12.1.7, “Handling packages with
8057: security problems”</a> for more
8058: information.</p>
8059: </li>
8060:
8061: <li>
8062: <p>If your package needs some executable to be
8063: able to run correctly and if there's agail no
8064: <tt class="filename">buildlink3.mk</tt> file,
8065: this is specified using the <tt class=
8066: "varname">DEPENDS</tt> variable. The <a xmlns=
8067: "http://www.w3.org/TR/xhtml1/transitional" href=
8068: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.2 hubertf 8069: class="pkgname">print/lyx</a> package needs to
8070: be able to execute the latex binary from the
8071: teTeX package when it runs, and that is
8072: specified:</p>
1.1 grant 8073: <pre class="programlisting">
8074: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
8075: </pre>
8076:
8077: <p>The comment about wildcard dependencies from
8078: previous paragraph applies here, too.</p>
8079: </li>
8080: </ol>
8081: </div>
8082:
8083: <p>If your package needs files from another package to
8084: build, see the first part of the “<span class=
8085: "quote">do-configure</span>” target <a xmlns=
8086: "http://www.w3.org/TR/xhtml1/transitional" href=
8087: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.2 hubertf 8088: class="pkgname">print/ghostscript5</a> package (it
8089: relies on the jpeg sources being present in source
8090: form during the build):</p>
1.1 grant 8091: <pre class="programlisting">
8092: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
8093: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
8094: fi
8095: </pre>
8096:
8097: <p>If you build any other packages that way, please
8098: make sure the working files are deleted too when this
8099: package's working files are cleaned up. The easiest way
8100: to do so is by adding a pre-clean target:</p>
8101: <pre class="programlisting">
8102: pre-clean:
8103: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
8104: </pre>
8105:
8106: <p>Please also note the <tt class=
8107: "varname">BUILD_USES_MSGFMT</tt> and <tt class=
8108: "varname">BUILD_USES_GETTEXT_M4</tt> definitions, which
8109: are provided as convenience definitions. The former
8110: works out whether msgfmt(1) is part of the base system,
8111: and, if it isn't, installs the <a xmlns=
8112: "http://www.w3.org/TR/xhtml1/transitional" href=
8113: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.2 hubertf 8114: class="pkgname">devel/gettext</a> package. The
8115: latter adds a build dependency on either an
8116: installed version of an older gettext package, or if
8117: it isn't, installs the <a xmlns=
8118: "http://www.w3.org/TR/xhtml1/transitional" href=
8119: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
8120: class="pkgname">devel/gettext-m4</a> package.</p>
1.1 grant 8121: </div>
8122:
8123: <div class="sect2" lang="en" xml:lang="en">
8124: <div class="titlepage">
8125: <div>
8126: <div>
1.5 ! hubertf 8127: <h3 class="title"><a name="id2571260" id=
! 8128: "id2571260"></a>12.1.4. Handling conflicts
1.1 grant 8129: with other packages</h3>
8130: </div>
8131: </div>
8132: </div>
8133:
8134: <p>Your package may conflict with other packages a user
8135: might already have installed on his system, e.g. if
8136: your package installs the same set of files like
8137: another package in our pkgsrc tree.</p>
8138:
8139: <p>In this case you can set <tt class=
8140: "varname">CONFLICTS</tt> to a space separated list of
8141: packages (including version string) your package
8142: conflicts with.</p>
8143:
8144: <p>For example <a xmlns=
8145: "http://www.w3.org/TR/xhtml1/transitional" href=
8146: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.2 hubertf 8147: class="pkgname">x11/Xaw3d</a> and <a xmlns=
8148: "http://www.w3.org/TR/xhtml1/transitional" href=
8149: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
8150: class="pkgname">x11/Xaw-Xpm</a> install provide the
8151: same shared library, thus you set in <tt class=
8152: "filename">pkgsrc/x11/Xaw3d/Makefile</tt>:</p>
1.1 grant 8153: <pre class="programlisting">
8154: CONFLICTS= Xaw-Xpm-[0-9]*
8155: </pre>
8156:
8157: <p>and in <tt class=
8158: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</tt>:</p>
8159: <pre class="programlisting">
8160: CONFLICTS= Xaw3d-[0-9]*
8161: </pre>
8162:
8163: <p>Packages will automatically conflict with other
8164: packages with the name prefix and a different version
8165: string. “<span class=
8166: "quote">Xaw3d-1.5</span>” e.g. will automatically
8167: conflict with the older version “<span class=
8168: "quote">Xaw3d-1.3</span>”.</p>
8169: </div>
8170:
8171: <div class="sect2" lang="en" xml:lang="en">
8172: <div class="titlepage">
8173: <div>
8174: <div>
1.5 ! hubertf 8175: <h3 class="title"><a name="id2571447" id=
! 8176: "id2571447"></a>12.1.5. Packages that cannot
1.1 grant 8177: or should not be built</h3>
8178: </div>
8179: </div>
8180: </div>
8181:
8182: <p>There are several reasons why a package might be
8183: instructed to not build under certain circumstances. If
8184: the package builds and runs on most platforms, the
8185: exceptions should be noted with <tt class=
8186: "varname">NOT_FOR_PLATFORM</tt>. If the package builds
8187: and runs on a small handful of platforms, set
8188: <tt class="varname">ONLY_FOR_PLATFORM</tt> instead. If
8189: the package should be skipped (for example, because it
8190: provides functionality already provided by the system),
8191: set <tt class="varname">PKG_SKIP_REASON</tt> to a
8192: descriptive message. If the package should fail because
8193: some preconditions are not met, set <tt class=
8194: "varname">PKG_FAIL_REASON</tt> to a descriptive
8195: message.</p>
8196:
8197: <p><tt class="varname">IGNORE</tt> is deprecated
8198: because it didn't provide enough information to
8199: determine whether the build should fail.</p>
8200: </div>
8201:
8202: <div class="sect2" lang="en" xml:lang="en">
8203: <div class="titlepage">
8204: <div>
8205: <div>
1.5 ! hubertf 8206: <h3 class="title"><a name="id2571473" id=
! 8207: "id2571473"></a>12.1.6. Packages which
1.1 grant 8208: should not be deleted, once installed</h3>
8209: </div>
8210: </div>
8211: </div>
8212:
8213: <p>To ensure that a package may not be deleted, once it
8214: has been installed, the <tt class=
8215: "varname">PKG_PRESERVE</tt> definition should be set in
8216: the package Makefile. This will be carried into any
8217: binary package that is made from this pkgsrc entry. A
8218: “<span class="quote">preserved</span>”
8219: package will not be deleted using <a href=
8220: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8221: <span class="citerefentry"><span class=
8222: "refentrytitle">pkg_delete</span>(1)</span></a> unless
8223: the “<span class="quote">-f</span>” option
8224: is used.</p>
8225: </div>
8226:
8227: <div class="sect2" lang="en" xml:lang="en">
8228: <div class="titlepage">
8229: <div>
8230: <div>
8231: <h3 class="title"><a name="security-handling" id=
8232: "security-handling"></a>12.1.7. Handling
8233: packages with security problems</h3>
8234: </div>
8235: </div>
8236: </div>
8237:
8238: <p>When a vulnerability is found, this should be noted
8239: in <tt class=
8240: "filename">localsrc/security/advisories/pkg-vulnerabilities</tt>,
8241: and after the commit of that file, it should be copied
8242: to both <tt class=
8243: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</tt>
8244: and <tt class=
8245: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</tt>
8246: on ftp.NetBSD.org using <tt class=
8247: "filename">localsrc/security/advisories/Makefile</tt>.
8248: In addition, if a <tt class=
8249: "filename">buildlink3.mk</tt> file exists for an
8250: affected package, bumping <tt class=
8251: "varname">PKGREVISION</tt> and creating a corresponding
8252: <tt class="varname">BUILDLINK_RECOMMENDED.<i class=
8253: "replaceable"><tt>pkg</tt></i></tt> entry should be
8254: considered. See <a href="#buildlink" title=
8255: "Chapter 9. Buildlink methodology">Chapter 9,
8256: <i>Buildlink methodology</i></a> for more information
8257: about writing <tt class="filename">buildlink3.mk</tt>
8258: files and <tt class="varname">BUILDLINK_*</tt>
8259: definitions.</p>
8260:
8261: <p>Also, if the fix should be applied to the stable
8262: pkgsrc branch, be sure to submit a pullup request!</p>
8263: </div>
8264:
8265: <div class="sect2" lang="en" xml:lang="en">
8266: <div class="titlepage">
8267: <div>
8268: <div>
1.5 ! hubertf 8269: <h3 class="title"><a name="id2571564" id=
! 8270: "id2571564"></a>12.1.8. How to handle
1.1 grant 8271: compiler bugs</h3>
8272: </div>
8273: </div>
8274: </div>
8275:
8276: <p>Some source files trigger bugs in the compiler,
8277: based on combinations of compiler version and
8278: architecture and almost always relation to optimisation
8279: being enabled. Common symptoms are gcc internal errors
8280: or never finishing compiling a file.</p>
8281:
8282: <p>Typically a workaround involves testing the
8283: <tt class="varname">MACHINE_ARCH</tt> and compiler
8284: version, disabling optimisation for that
8285: file/<tt class="varname">MACHINE_ARCH</tt>/compiler
8286: combination, and documenting it in <tt class=
8287: "filename">pkgsrc/doc/HACKS</tt>. See that file for a
8288: number of examples!</p>
8289: </div>
8290:
8291: <div class="sect2" lang="en" xml:lang="en">
8292: <div class="titlepage">
8293: <div>
8294: <div>
1.5 ! hubertf 8295: <h3 class="title"><a name="id2571587" id=
! 8296: "id2571587"></a>12.1.9. How to handle
1.1 grant 8297: incrementing versions when fixing an existing
8298: package</h3>
8299: </div>
8300: </div>
8301: </div>
8302:
8303: <p>When making fixes to an existing package it can be
8304: useful to change the version number in <tt class=
8305: "varname">PKGNAME</tt>. To avoid conflicting with
8306: future versions by the original author, a
8307: “<span class="quote">nb1</span>”,
8308: “<span class="quote">nb2</span>”, ...
8309: suffix can be used on package versions by setting
8310: <tt class="varname">PKGREVISION=1</tt> (2, ...). The
8311: “<span class="quote">nb</span>” is treated
8312: like a “<span class="quote">.</span>” by
8313: the pkg tools. e.g.</p>
8314: <pre class="programlisting">
8315: DISTNAME= foo-17.42
8316: PKGREVISION= 9
8317: </pre>
8318:
8319: <p>will result in a <tt class="varname">PKGNAME</tt> of
8320: “<span class=
8321: "quote">foo-17.42nb9</span>”.</p>
8322:
8323: <p>When a new release of the package is released, the
8324: <tt class="varname">PKGREVISION</tt> should be removed.
8325: e.g. on a new minor release of the above package,
8326: things should be like:</p>
8327: <pre class="programlisting">
8328: DISTNAME= foo-17.43
8329: </pre>
8330: </div>
8331:
8332: <div class="sect2" lang="en" xml:lang="en">
8333: <div class="titlepage">
8334: <div>
8335: <div>
1.5 ! hubertf 8336: <h3 class="title"><a name="id2571704" id=
! 8337: "id2571704"></a>12.1.10. Portability of
1.1 grant 8338: packages</h3>
8339: </div>
8340: </div>
8341: </div>
8342:
8343: <p>One appealing feature of pkgsrc is that it runs on
8344: many different platforms. As a result, it is important
8345: to ensure, where possible, that packages in pkgsrc are
8346: portable. There are some particular details you should
8347: pay attention to while working on pkgsrc.</p>
8348:
8349: <div class="sect3" lang="en" xml:lang="en">
8350: <div class="titlepage">
8351: <div>
8352: <div>
1.5 ! hubertf 8353: <h4 class="title"><a name="id2571709" id=
! 8354: "id2571709"></a>12.1.10.1. ${INSTALL},
1.1 grant 8355: ${INSTALL_DATA_DIR}, ...</h4>
8356: </div>
8357: </div>
8358: </div>
8359:
8360: <p>The BSD-compatible <span><b class=
8361: "command">install</b></span> supplied with some
8362: operating systems will not perform more than one
8363: operation at a time. As such, you should call
8364: “<span class="quote">${INSTALL}</span>”,
8365: etc. like this:</p>
8366: <pre class="programlisting">
8367: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
8368: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
8369: </pre>
8370: </div>
8371: </div>
8372: </div>
8373:
8374: <div class="sect1" lang="en" xml:lang="en">
8375: <div class="titlepage">
8376: <div>
8377: <div>
8378: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 8379: "id2571729" id="id2571729"></a>12.2. Possible
1.1 grant 8380: downloading issues</h2>
8381: </div>
8382: </div>
8383: </div>
8384:
8385: <div class="sect2" lang="en" xml:lang="en">
8386: <div class="titlepage">
8387: <div>
8388: <div>
1.5 ! hubertf 8389: <h3 class="title"><a name="id2571732" id=
! 8390: "id2571732"></a>12.2.1. Packages whose
1.1 grant 8391: distfiles aren't available for plain
8392: downloading</h3>
8393: </div>
8394: </div>
8395: </div>
8396:
8397: <p>If you need to download from a dynamic URL you can
8398: set <tt class="varname">DYNAMIC_MASTER_SITES</tt> and a
8399: <span><b class="command">make fetch</b></span> will
8400: call <tt class="filename">files/getsite.sh</tt> with
8401: the name of each file to download as an argument,
8402: expecting it to output the URL of the directory from
8403: which to download it. <a xmlns=
8404: "http://www.w3.org/TR/xhtml1/transitional" href=
8405: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.2 hubertf 8406: class="pkgname">graphics/ns-cult3d</a> is an example
8407: of this usage.</p>
1.1 grant 8408:
8409: <p>If the download can't be automated, because the user
8410: must submit personal information to apply for a
8411: password, or must pay for the source, or whatever, you
8412: can set <tt class="varname">_FETCH_MESSAGE</tt> to a
8413: macro which displays a message explaining the
8414: situation. <tt class="varname">_FETCH_MESSAGE</tt> must
8415: be executable shell commands, not just a message.
8416: (Generally, it executes <tt class=
8417: "varname">${ECHO}</tt>). As of this writing, the
8418: following packages use this: <a xmlns=
8419: "http://www.w3.org/TR/xhtml1/transitional" href=
8420: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.2 hubertf 8421: class="pkgname">audio/realplayer</a>, <a xmlns=
8422: "http://www.w3.org/TR/xhtml1/transitional" href=
8423: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
8424: class="pkgname">cad/simian</a>, <a xmlns=
8425: "http://www.w3.org/TR/xhtml1/transitional" href=
8426: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
8427: class="pkgname">devel/ipv6socket</a>, <a xmlns=
8428: "http://www.w3.org/TR/xhtml1/transitional" href=
8429: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
8430: class="pkgname">emulators/vmware-module</a>,
8431: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8432: href=
8433: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
8434: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
8435: "http://www.w3.org/TR/xhtml1/transitional" href=
8436: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
8437: class="pkgname">sysutils/storage-manager</a>,
8438: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8439: href=
8440: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
8441: class="pkgname">www/ap-aolserver</a>, <a xmlns=
8442: "http://www.w3.org/TR/xhtml1/transitional" href=
8443: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
8444: class="pkgname">www/openacs</a>. Try to be
8445: consistent with them.</p>
1.1 grant 8446: </div>
8447:
8448: <div class="sect2" lang="en" xml:lang="en">
8449: <div class="titlepage">
8450: <div>
8451: <div>
1.5 ! hubertf 8452: <h3 class="title"><a name="id2571795" id=
! 8453: "id2571795"></a>12.2.2. How to handle
1.1 grant 8454: modified distfiles with the 'old' name</h3>
8455: </div>
8456: </div>
8457: </div>
8458:
8459: <p>Sometimes authors of a software package make some
8460: modifications after the software was released, and they
8461: put up a new distfile without changing the package's
8462: version number. If a package is already in pkgsrc at
8463: that time, the md5 checksum will no longer match. The
8464: correct way to work around this is to update the
8465: package's md5 checksum to match the package on the
8466: master site (beware, any mirrors may not be up to date
8467: yet!), and to remove the old distfile from
8468: ftp.NetBSD.org's <tt class=
8469: "filename">/pub/NetBSD/packages/distfiles</tt>
8470: directory. Furthermore, a mail to the package's author
8471: seems appropriate making sure the distfile was really
8472: updated on purpose, and that no trojan horse or so
8473: crept in.</p>
8474: </div>
8475: </div>
8476:
8477: <div class="sect1" lang="en" xml:lang="en">
8478: <div class="titlepage">
8479: <div>
8480: <div>
8481: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 8482: "id2571806" id=
! 8483: "id2571806"></a>12.3. Configuration
1.1 grant 8484: gotchas</h2>
8485: </div>
8486: </div>
8487: </div>
8488:
8489: <div class="sect2" lang="en" xml:lang="en">
8490: <div class="titlepage">
8491: <div>
8492: <div>
8493: <h3 class="title"><a name="fixes.libtool" id=
8494: "fixes.libtool"></a>12.3.1. Shared libraries
8495: - libtool</h3>
8496: </div>
8497: </div>
8498: </div>
8499:
8500: <p>pkgsrc supports many different machines, with
8501: different object formats like a.out and ELF, and
8502: varying abilities to do shared library and dynamic
8503: loading at all. To accompany this, varying commands and
8504: options have to be passed to the compiler, linker, etc.
8505: to get the Right Thing, which can be pretty annoying
8506: especially if you don't have all the machines at your
8507: hand to test things. The <a xmlns=
8508: "http://www.w3.org/TR/xhtml1/transitional" href=
8509: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.2 hubertf 8510: class="pkgname">devel/libtool</a> pkg can help here,
8511: as it just “<span class=
8512: "quote">knows</span>” how to build both static
8513: and dynamic libraries from a set of source files,
8514: thus being platform independent.</p>
1.1 grant 8515:
8516: <p>Here's how to use libtool in a pkg in seven simple
8517: steps:</p>
8518:
8519: <div class="orderedlist">
8520: <ol type="1">
8521: <li>
8522: <p>Add <tt class="varname">USE_LIBTOOL=yes</tt>
8523: to the package Makefile.</p>
8524: </li>
8525:
8526: <li>
8527: <p>For library objects, use “<span class=
8528: "quote">${LIBTOOL} --mode=compile
8529: ${CC}</span>” in place of
8530: “<span class="quote">${CC}</span>”.
8531: You could even add it to the definition of
8532: <tt class="varname">CC</tt>, if only libraries
8533: are being built in a given Makefile. This one
8534: command will build both PIC and non-PIC library
8535: objects, so you need not have separate shared and
8536: non-shared library rules.</p>
8537: </li>
8538:
8539: <li>
8540: <p>For the linking of the library, remove any
8541: “<span class="quote">ar</span>”,
8542: “<span class="quote">ranlib</span>”,
8543: and “<span class="quote">ld
8544: -Bshareable</span>” commands, and instead
8545: use:</p>
8546: <pre class="programlisting">
8547: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
8548: </pre>
8549:
8550: <p>Note that the library is changed to have a
8551: <tt class="filename">.la</tt> extension, and the
8552: objects are changed to have a <tt class=
8553: "filename">.lo</tt> extension. Change <tt class=
8554: "varname">OBJS</tt> as necessary. This
8555: automatically creates all of the <tt class=
8556: "filename">.a</tt>, <tt class=
8557: "filename">.so.major.minor</tt>, and ELF symlinks
8558: (if necessary) in the build directory. Be sure to
8559: include “<span class=
8560: "quote">-version-info</span>”, especially
8561: when major and minor are zero, as libtool will
8562: otherwise strip off the shared library
8563: version.</p>
8564:
8565: <p>From the libtool manual:</p>
8566: <pre class="programlisting">
8567: So, libtool library versions are described by three integers:
8568:
8569: CURRENT
8570: The most recent interface number that this library implements.
8571:
8572: REVISION
8573: The implementation number of the CURRENT interface.
8574:
8575: AGE
8576: The difference between the newest and oldest interfaces that this
8577: library implements. In other words, the library implements all the
8578: interface numbers in the range from number `CURRENT - AGE' to
8579: `CURRENT'.
8580:
8581: If two libraries have identical CURRENT and AGE numbers, then the
8582: dynamic linker chooses the library with the greater REVISION number.
8583: </pre>
8584:
8585: <p>The “<span class=
8586: "quote">-release</span>” option will
8587: produce different results for a.out and ELF
8588: (excluding symlinks) in only one case. An ELF
8589: library of the form “<span class=
8590: "quote">libfoo-release.so.<span class=
8591: "emphasis"><em>x</em></span>.<span class=
8592: "emphasis"><em>y</em></span></span>” will
8593: have a symlink of “<span class=
8594: "quote">libfoo.so.<span class=
8595: "emphasis"><em>x</em></span>.<span class=
8596: "emphasis"><em>y</em></span></span>” on an
8597: a.out platform. This is handled
8598: automatically.</p>
8599:
8600: <p>The “<span class="quote">-rpath
8601: argument</span>” is the install directory
8602: of the library being built.</p>
8603:
8604: <p>In the <tt class="filename">PLIST</tt>,
8605: include all of the <tt class="filename">.a</tt>,
8606: <tt class="filename">.la</tt>, and <tt class=
8607: "filename">.so</tt>, <tt class=
8608: "filename">.so.<i class=
8609: "replaceable"><tt>major</tt></i></tt> and
8610: <tt class="filename">.so.<i class=
8611: "replaceable"><tt>major</tt></i>.<i class=
8612: "replaceable"><tt>minor</tt></i></tt> files.</p>
8613: </li>
8614:
8615: <li>
8616: <p>When linking shared object (<tt class=
8617: "filename">.so</tt>) files, i.e. files that are
8618: loaded via dlopen(3), NOT shared libraries, use
8619: “<span class="quote">-module
8620: -avoid-version</span>” to prevent them
8621: getting version tacked on.</p>
8622:
8623: <p>The <tt class="filename">PLIST</tt> file gets
8624: the <tt class="filename">foo.so</tt> entry.</p>
8625: </li>
8626:
8627: <li>
8628: <p>When linking programs that depend on these
8629: libraries <span class=
8630: "emphasis"><em>before</em></span> they are
8631: installed, preface the <a href=
8632: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
8633: <span class="citerefentry"><span class=
8634: "refentrytitle">cc</span>(1)</span></a> or
8635: <a href=
8636: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
8637: <span class="citerefentry"><span class=
8638: "refentrytitle">ld</span>(1)</span></a> line with
8639: “<span class="quote">${LIBTOOL}
8640: --mode=link</span>”, and it will find the
8641: correct libraries (static or shared), but please
8642: be aware that libtool will not allow you to
8643: specify a relative path in -L (such as
8644: “<span class=
8645: "quote">-L../somelib</span>”), because it
8646: expects you to change that argument to be the
8647: <tt class="filename">.la</tt> file. e.g.</p>
8648: <pre class="programlisting">
8649: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
8650: </pre>
8651:
8652: <p>should be changed to:</p>
8653: <pre class="programlisting">
8654: ${LIBTOOL} --mode=link ${CC} -o <i class=
8655: "replaceable"><tt>someprog</tt></i> <i class=
8656: "replaceable"><tt>../somelib/somelib.la</tt></i>
8657: </pre>
8658:
8659: <p>and it will do the right thing with the
8660: libraries.</p>
8661: </li>
8662:
8663: <li>
8664: <p>When installing libraries, preface the
8665: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
8666: <span class="citerefentry"><span class=
8667: "refentrytitle">install</span>(1)</span></a> or
8668: <a href=
8669: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
8670: <span class="citerefentry"><span class=
8671: "refentrytitle">cp</span>(1)</span></a> command
8672: with “<span class="quote">${LIBTOOL}
8673: --mode=install</span>”, and change the
8674: library name to <tt class="filename">.la</tt>.
8675: e.g.</p>
8676: <pre class="programlisting">
8677: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
8678: </pre>
8679:
8680: <p>This will install the static <tt class=
8681: "filename">.a</tt>, shared library, any needed
8682: symlinks, and run <a href=
8683: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
8684: <span class="citerefentry"><span class=
8685: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
8686: </li>
8687:
8688: <li>
8689: <p>In your <tt class="filename">PLIST</tt>,
8690: include all of the <tt class="filename">.a</tt>,
8691: <tt class="filename">.la</tt>, and <tt class=
8692: "filename">.so</tt>, <tt class=
8693: "filename">.so.CURRENT</tt> and <tt class=
8694: "filename">.so.CURRENT.REVISION</tt> files (this
8695: is a change from the previous behaviour).</p>
8696: </li>
8697: </ol>
8698: </div>
8699: </div>
8700:
8701: <div class="sect2" lang="en" xml:lang="en">
8702: <div class="titlepage">
8703: <div>
8704: <div>
1.5 ! hubertf 8705: <h3 class="title"><a name="id2572350" id=
! 8706: "id2572350"></a>12.3.2. Using libtool on GNU
1.1 grant 8707: packages that already support libtool</h3>
8708: </div>
8709: </div>
8710: </div>
8711:
8712: <p>Add <tt class="varname">USE_LIBTOOL=yes</tt> to the
8713: package Makefile. This will override the package's own
8714: libtool in most cases. For older libtool using
8715: packages, libtool is made by ltconfig script during the
8716: do-configure step; you can check the libtool script
8717: location by doing <span><b class="command">make
8718: configure; find work*/ -name libtool</b></span>.</p>
8719:
8720: <p><tt class="varname">LIBTOOL_OVERRIDE</tt> specifies
8721: which libtool scripts, relative to <tt class=
8722: "varname">WRKSRC</tt>, to override. By default, it is
8723: set to “<span class="quote">libtool */libtool
8724: */*/libtool</span>”. If this does not match the
8725: location of the package's libtool script(s), set it as
8726: appropriate.</p>
8727:
8728: <p>If you do not need <tt class="filename">*.a</tt>
8729: static libraries built and installed, then use
8730: <tt class="varname">SHLIBTOOL_OVERRIDE</tt>
8731: instead.</p>
8732:
8733: <p>If your package makes use of the platform
8734: independent library for loading dynamic shared objects,
8735: that comes with libtool (libltdl), you should include
8736: the libtool buildlink3.mk (and set <tt class=
8737: "varname">USE_BUILDLINK3=YES</tt>).</p>
8738:
8739: <p>Some packages use libtool incorrectly so that the
8740: package may not work or build in some circumstances.
8741: Some of the more common errors are:</p>
8742:
8743: <div class="itemizedlist">
8744: <ul type="disc">
8745: <li>
8746: <p>The inclusion of a shared object (-module) as
8747: a dependent library in an executable or library.
8748: This in itself isn't a problem if one of two
8749: things has been done:</p>
8750:
8751: <div class="orderedlist">
8752: <ol type="1">
8753: <li>
8754: <p>The shared object is named correctly,
8755: i.e. <tt class="filename">libfoo.la</tt>,
8756: not <tt class="filename">foo.la</tt></p>
8757: </li>
8758:
8759: <li>
8760: <p>The -dlopen option is used when linking
8761: an executable.</p>
8762: </li>
8763: </ol>
8764: </div>
8765: </li>
8766:
8767: <li>
8768: <p>The use of libltdl without the correct calls
8769: to initialisation routines. The function
8770: lt_dlinit() should be called and the macro
8771: <tt class=
8772: "varname">LTDL_SET_PRELOADED_SYMBOLS</tt>
8773: included in executables.</p>
8774: </li>
8775: </ul>
8776: </div>
8777: </div>
8778:
8779: <div class="sect2" lang="en" xml:lang="en">
8780: <div class="titlepage">
8781: <div>
8782: <div>
1.5 ! hubertf 8783: <h3 class="title"><a name="id2572435" id=
! 8784: "id2572435"></a>12.3.3. GNU
1.1 grant 8785: Autoconf/Automake</h3>
8786: </div>
8787: </div>
8788: </div>
8789:
8790: <p>If a package needs GNU autoconf or automake to be
8791: executed to regenerate the configure script and
8792: Makefile.in makefile templates, then they should be
8793: executed in a pre-configure target. Two Makefile
8794: fragments are provided in <tt class=
8795: "filename">pkgsrc/mk/autoconf.mk</tt> and <tt class=
8796: "filename">pkgsrc/mk/automake.mk</tt> to help dealing
8797: with these tools. See comments in these files for
8798: details.</p>
8799:
8800: <p>For packages that need only autoconf:</p>
8801: <pre class="programlisting">
8802: AUTOCONF_REQD= 2.50 # if default version is not good enough
8803: ...
8804:
8805: pre-configure:
8806: cd ${WRKSRC}; ${AUTOCONF}
8807:
8808: ...
8809: .include "../../mk/autoconf.mk"
8810: </pre>
8811:
8812: <p>and for packages that need automake and
8813: autoconf:</p>
8814: <pre class="programlisting">
8815: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
8816: ...
8817:
8818: pre-configure:
8819: cd ${WRKSRC}; \
8820: ${ACLOCAL}; \
8821: ${AUTOHEADER}; \
8822: ${AUTOMAKE} -a --foreign -i; \
8823: ${AUTOCONF}
8824:
8825: ...
8826: .include "../mk/automake.mk"
8827: </pre>
8828:
8829: <p>Packages which use GNU Automake will almost
8830: certainly require GNU Make, but that's automatically
8831: provided for you in <tt class=
8832: "filename">mk/automake.mk</tt>.</p>
8833:
8834: <p>There are times when the configure process makes
8835: additional changes to the generated files, which then
8836: causes the build process to try to re-execute the
8837: automake sequence. This is prevented by touching
8838: various files in the configure stage. If this causes
8839: problems with your package you can set <tt class=
8840: "varname">AUTOMAKE_OVERRIDE=NO</tt> in the package
8841: Makefile.</p>
8842: </div>
8843: </div>
8844:
8845: <div class="sect1" lang="en" xml:lang="en">
8846: <div class="titlepage">
8847: <div>
8848: <div>
8849: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 8850: "id2572480" id="id2572480"></a>12.4. Building
1.1 grant 8851: considerations</h2>
8852: </div>
8853: </div>
8854: </div>
8855:
8856: <div class="sect2" lang="en" xml:lang="en">
8857: <div class="titlepage">
8858: <div>
8859: <div>
1.5 ! hubertf 8860: <h3 class="title"><a name="id2572483" id=
! 8861: "id2572483"></a>12.4.1. CPP defines</h3>
1.1 grant 8862: </div>
8863: </div>
8864: </div>
8865:
8866: <p>To port an application to NetBSD, it's usually
8867: necessary for the compiler to be able to judge the
8868: system on which it's compiling, and we use definitions
8869: so that the C pre-processor can do this.</p>
8870:
8871: <p>To test whether you are working on a 4.4 BSD-derived
8872: system, you should use the BSD definition, which is
8873: defined in <tt class=
8874: "filename"><sys/param.h></tt> on said
8875: systems.</p>
8876: <pre class="programlisting">
8877: #include <sys/param.h>
8878: </pre>
8879:
8880: <p>and then you can surround the BSD-specific parts of
8881: your package's C/C++ code using this conditional:</p>
8882: <pre class="programlisting">
8883: #if (defined(BSD) && BSD >= 199306)
8884: ...
8885: #endif
8886: </pre>
8887:
8888: <p>Please use the “<span class=
8889: "quote">__NetBSD__</span>” definition sparingly -
8890: it should only apply to features of NetBSD that are not
8891: present in other 4.4-lite derived BSDs.</p>
8892: </div>
8893: </div>
8894:
8895: <div class="sect1" lang="en" xml:lang="en">
8896: <div class="titlepage">
8897: <div>
8898: <div>
8899: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 8900: "id2572513" id="id2572513"></a>12.5. Package
1.1 grant 8901: specific actions</h2>
8902: </div>
8903: </div>
8904: </div>
8905:
8906: <div class="sect2" lang="en" xml:lang="en">
8907: <div class="titlepage">
8908: <div>
8909: <div>
1.5 ! hubertf 8910: <h3 class="title"><a name="id2572516" id=
! 8911: "id2572516"></a>12.5.1. Package
1.1 grant 8912: configuration files</h3>
8913: </div>
8914: </div>
8915: </div>
8916:
8917: <p>Packages should be taught to look for their
8918: configuration files in <tt class=
8919: "varname">${PKG_SYSCONFDIR}</tt>, which is passed
8920: through to the configure and build processes.
8921: <tt class="varname">PKG_SYSCONFDIR</tt> may be
8922: customized in various ways by setting other make
8923: variables:</p>
8924:
8925: <div class="itemizedlist">
8926: <ul type="disc">
8927: <li>
8928: <p><tt class="varname">PKG_SYSCONFBASE</tt> is
8929: the main config directory under which all package
8930: configuration files are to be found. This
8931: defaults to <tt class=
8932: "filename">${PREFIX}/etc</tt>, but may be
8933: overridden in <tt class=
8934: "filename">/etc/mk.conf</tt>.</p>
8935: </li>
8936:
8937: <li>
8938: <p><tt class="varname">PKG_SYSCONFSUBDIR</tt> is
8939: the subdirectory of <tt class=
8940: "varname">PKG_SYSCONFBASE</tt> under which the
8941: configuration files for a particular package may
8942: be found, e.g. the Apache configuration files may
8943: all be found under the <tt class=
8944: "filename">httpd/</tt> subdirectory of <tt class=
8945: "varname">${PKG_SYSCONFBASE}</tt>. This should be
8946: set in the package Makefile.</p>
8947: </li>
8948:
8949: <li>
8950: <p>By default, <tt class=
8951: "varname">PKG_SYSCONFDIR</tt> is set to
8952: <tt class="varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</tt>,
8953: but this may be overridden by setting <tt class=
8954: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</tt>
8955: for a particular package, where <tt class=
8956: "varname">PKG_SYSCONFVAR</tt> defaults to
8957: <tt class="varname">${PKGBASE}</tt>. This is not
8958: meant to be set by a package Makefile, but is
8959: reserved for users who wish to override the
8960: <tt class="varname">PKG_SYSCONFDIR</tt> setting
8961: for a particular package with a special
8962: location.</p>
8963: </li>
8964: </ul>
8965: </div>
8966:
8967: <p>The only variables that users should customize are
8968: <tt class="varname">PKG_SYSCONFBASE</tt> and <tt class=
8969: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</tt>. Users
8970: will typically want to set <tt class=
8971: "varname">PKG_SYSCONFBASE</tt> to <tt class=
8972: "filename">/etc</tt>, or to accept the default location
8973: of <tt class="filename">${PREFIX}/etc</tt>.</p>
8974: </div>
8975:
8976: <div class="sect2" lang="en" xml:lang="en">
8977: <div class="titlepage">
8978: <div>
8979: <div>
1.5 ! hubertf 8980: <h3 class="title"><a name="id2572618" id=
! 8981: "id2572618"></a>12.5.2. User
1.2 hubertf 8982: interaction</h3>
1.1 grant 8983: </div>
8984: </div>
8985: </div>
8986:
8987: <p>Occasionally, packages require interaction from the
8988: user, and this can be in a number of ways:</p>
8989:
8990: <div class="itemizedlist">
8991: <ul type="disc">
8992: <li>
8993: <p>help in fetching the distfiles</p>
8994: </li>
8995:
8996: <li>
8997: <p>help to configure the package before it is
8998: built</p>
8999: </li>
9000:
9001: <li>
9002: <p>help during the build process</p>
9003: </li>
9004:
9005: <li>
9006: <p>help during the installation of a package</p>
9007: </li>
9008: </ul>
9009: </div>
9010:
9011: <p>The <tt class="varname">INTERACTIVE_STAGE</tt>
9012: definition is provided to notify the pkgsrc mechanism
9013: of an interactive stage which will be needed, and this
9014: should be set in the package's <tt class=
9015: "filename">Makefile</tt>. e.g.</p>
9016: <pre class="programlisting">
9017: INTERACTIVE_STAGE= build
9018: </pre>
9019:
9020: <p>Multiple interactive stages can be specified:</p>
9021: <pre class="programlisting">
9022: INTERACTIVE_STAGE= configure install
9023: </pre>
9024: </div>
9025:
9026: <div class="sect2" lang="en" xml:lang="en">
9027: <div class="titlepage">
9028: <div>
9029: <div>
1.5 ! hubertf 9030: <h3 class="title"><a name="id2572663" id=
! 9031: "id2572663"></a>12.5.3. Handling
1.1 grant 9032: licenses</h3>
9033: </div>
9034: </div>
9035: </div>
9036:
9037: <p>A package may underly a license which the user has
9038: or has not agreed to accept. Usually, packages that
9039: underly well-known Open Source licenses (e.g. the GNU
9040: Public License, GPL) won't have any special license
9041: tags added in pkgsrc which require special action by
9042: the user of such packages, but there are quite a number
9043: of other licenses out there that pkgsrc users may not
9044: be able to follow, for whatever reasons. For these
9045: cases, pkgsrc contains a mechanism to note that a
9046: package underlies a certain license, and the user has
9047: to accept the license before the package can be
9048: installed.</p>
9049:
9050: <p>Placing a certain package under a certain license
9051: works by setting the <tt class="varname">LICENSE</tt>
9052: variable to a string identifying the license, e.g. in
9053: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9054: href=
9055: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.2 hubertf 9056: class="pkgname">graphics/graphviz</a>:</p>
1.1 grant 9057: <pre class="programlisting">
9058: LICENSE= graphviz-license
9059: </pre>
9060:
9061: <p>When trying to build, the user will get a notice
9062: that the package underlies a license which he hasn't
9063: accepted (yet):</p>
9064: <pre class="programlisting">
9065: <tt class="prompt">%</tt> <b class="userinput"><tt>make</tt></b>
9066: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
9067: ===> To build this package, add this line to your /etc/mk.conf:
9068: ===> ACCEPTABLE_LICENSES+=graphviz-license
9069: ===> To view the license, enter "/usr/bin/make show-license".
9070: *** Error code 1
9071: </pre>
9072:
9073: <p>The license can be viewed with <span><b class=
9074: "command">make show-license</b></span>, and if it is
9075: considered appropriate, the line printed above can be
9076: added to <tt class="filename">/etc/mk.conf</tt> to
9077: indicate acceptance of the particular license:</p>
9078: <pre class="programlisting">
9079: ACCEPTABLE_LICENSES+=graphviz-license
9080: </pre>
9081:
9082: <p>When adding a package with a new license, the
9083: license text should be added to <tt class=
9084: "filename">pkgsrc/licenses</tt> for displaying. A list
9085: of known licenses can be seen in this directory as well
9086: as by looking at the list of (commented out) <tt class=
9087: "varname">ACCEPTABLE_LICENSES</tt> variable settings in
9088: <tt class=
9089: "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt>.</p>
9090:
9091: <p>Is there is a <span class=
9092: "emphasis"><em>really</em></span> pressing need to
9093: accept all licenses at once, like when trying to
9094: download or mirror all distfiles or doing a bulk build
9095: to test if all packages in pkgsrc build, this can be
9096: done by setting <tt class=
9097: "varname">_ACCEPTABLE=yes</tt>.</p>
9098: </div>
9099:
9100: <div class="sect2" lang="en" xml:lang="en">
9101: <div class="titlepage">
9102: <div>
9103: <div>
1.5 ! hubertf 9104: <h3 class="title"><a name="id2572746" id=
! 9105: "id2572746"></a>12.5.4. Creating an account
1.1 grant 9106: from a package</h3>
9107: </div>
9108: </div>
9109: </div>
9110:
9111: <p>There are two make variables used to control the
9112: creation of package-specific groups and users at
9113: pre-install time. The first is <tt class=
9114: "varname">PKG_GROUPS</tt>, which is a list of
9115: group[:groupid] elements, where the groupid is
9116: optional. The second is <tt class=
9117: "varname">PKG_USERS</tt>, which is a list of elements
9118: of the form:</p>
9119: <pre class="programlisting">
9120: user:group[:[userid][:[description][:[home][:shell]]]]
9121: </pre>
9122:
9123: <p>where only the user and group are required, the rest
9124: being optional. A simple example is:</p>
9125: <pre class="programlisting">
9126: PKG_GROUPS= foogroup
9127: PKG_USERS= foouser:foogroup
9128: </pre>
9129:
9130: <p>A more complex example is that creates two groups
9131: and two users is:</p>
9132: <pre class="programlisting">
9133: PKG_GROUPS= group1 group2:1005
9134: PKG_USERS= first:group1::First\\ User \
9135: second:group2::Second\\ User:/home/second:${SH}
9136: </pre>
9137:
9138: <p>By default, a new user will have home directory
9139: <tt class="filename">/nonexistent</tt>, and login shell
9140: <tt class="filename">/sbin/nologin</tt> unless they are
9141: specified as part of the user element.</p>
9142:
9143: <p>The package <tt class="filename">Makefile</tt> must
9144: also set <tt class="varname">USE_PKGINSTALL=YES</tt>.
9145: This will cause the users and groups to be created at
9146: pre-install time, and the admin will be prompted to
9147: remove them at post-deinstall time. Automatic creation
9148: of the users and groups can be toggled on and off by
9149: setting the <tt class=
9150: "varname">PKG_CREATE_USERGROUP</tt> variable prior to
9151: package installation.</p>
9152: </div>
9153:
9154: <div class="sect2" lang="en" xml:lang="en">
9155: <div class="titlepage">
9156: <div>
9157: <div>
1.5 ! hubertf 9158: <h3 class="title"><a name="id2572876" id=
! 9159: "id2572876"></a>12.5.5. Installing score
1.1 grant 9160: files</h3>
9161: </div>
9162: </div>
9163: </div>
9164:
9165: <p>Certain packages, most of them in the games
9166: category, install a score file that allows all users on
9167: the system to record their highscores. In order for
9168: this to work, the binaries need to be installed setgid
9169: and the score files owned by the appropriate group
9170: and/or owner (traditionally the "games" user/group).
9171: The following variables, documented in more detail in
9172: <tt class="filename">mk/bsd.pkg.defaults.mk</tt>,
9173: control this behaviour: <tt class=
9174: "varname">SETGIDGAME</tt>, <tt class=
9175: "varname">GAMEDATAMODE</tt>, <tt class=
9176: "varname">GAMEGRP</tt>, <tt class=
9177: "varname">GAMEMODE</tt>, <tt class=
9178: "varname">GAMEOWN</tt>.</p>
9179:
9180: <p>Note that per default, setgid installation of games
9181: is disabled; setting <tt class=
9182: "varname">SETGIDGAME=YES</tt> will set all the other
9183: variables accordingly.</p>
9184:
9185: <p>A package should therefor never hard code file
9186: ownership or access permissions but rely on <tt class=
9187: "varname">INSTALL_GAME</tt> and <tt class=
9188: "varname">INSTALL_GAME_DATA</tt> to set these
9189: correctly.</p>
9190: </div>
9191:
9192: <div class="sect2" lang="en" xml:lang="en">
9193: <div class="titlepage">
9194: <div>
9195: <div>
1.5 ! hubertf 9196: <h3 class="title"><a name="id2573057" id=
! 9197: "id2573057"></a>12.5.6. Packages providing
1.1 grant 9198: login shells</h3>
9199: </div>
9200: </div>
9201: </div>
9202:
9203: <p>If the purpose of the package is to provide a login
9204: shell, the variable <tt class="varname">PKG_SHELL</tt>
9205: should contain the full pathname of the shell
9206: executable installed by this package. The package
9207: <tt class="filename">Makefile</tt> must also set
9208: <tt class="varname">USE_PKGINSTALL=YES</tt> to use the
9209: automatically generated <tt class=
9210: "filename">INSTALL</tt>/<tt class=
9211: "filename">DEINSTALL</tt> scripts.</p>
9212:
9213: <p>An example taken from shells/zsh:</p>
9214: <pre class="programlisting">
9215: USE_PKGINSTALL= YES
9216: PKG_SHELL= ${PREFIX}/bin/zsh
9217: </pre>
9218:
9219: <p>The shell is registered into <tt class=
9220: "filename">/etc/shells</tt> file automatically in the
9221: post-install target by the generated <tt class=
9222: "filename">INSTALL</tt> script and removed in the
9223: deinstall target by the <tt class=
9224: "filename">DEINSTALL</tt> script.</p>
9225: </div>
9226:
9227: <div class="sect2" lang="en" xml:lang="en">
9228: <div class="titlepage">
9229: <div>
9230: <div>
1.5 ! hubertf 9231: <h3 class="title"><a name="id2573182" id=
! 9232: "id2573182"></a>12.5.7. Packages containing
1.1 grant 9233: perl scripts</h3>
9234: </div>
9235: </div>
9236: </div>
9237:
9238: <p>If your package contains interpreted perl scripts,
9239: set <tt class="varname">REPLACE_PERL</tt> to ensure
9240: that the proper interpreter path is set. <tt class=
9241: "varname">REPLACE_PERL</tt> should contain a list of
9242: scripts, relative to <tt class="varname">WRKSRC</tt>,
9243: that you want adjusted.</p>
9244: </div>
9245:
9246: <div class="sect2" lang="en" xml:lang="en">
9247: <div class="titlepage">
9248: <div>
9249: <div>
1.5 ! hubertf 9250: <h3 class="title"><a name="id2573201" id=
! 9251: "id2573201"></a>12.5.8. Packages with
1.1 grant 9252: hardcoded paths to other interpreters</h3>
9253: </div>
9254: </div>
9255: </div>
9256:
9257: <p>Your package may also contain scripts with hardcoded
9258: paths to other interpreters besides (or as well as)
9259: perl. To correct the full pathname to the script
9260: interpreter, you need to set the following definitions
9261: in your <tt class="filename">Makefile</tt> (we shall
9262: use <span><b class="command">tclsh</b></span> in this
9263: example):</p>
9264: <pre class="programlisting">
9265: REPLACE_INTERPRETER+= tcl
9266: _REPLACE.tcl.old= .*/bin/tclsh
9267: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
9268: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
9269: relative to ${WRKSRC}, just as in REPLACE_PERL
9270: </pre>
9271: </div>
9272:
9273: <div class="sect2" lang="en" xml:lang="en">
9274: <div class="titlepage">
9275: <div>
9276: <div>
1.5 ! hubertf 9277: <h3 class="title"><a name="id2573222" id=
! 9278: "id2573222"></a>12.5.9. Packages installing
1.1 grant 9279: perl modules</h3>
9280: </div>
9281: </div>
9282: </div>
9283:
9284: <p>Makefiles of packages providing perl5 modules should
9285: include the Makefile fragment <tt class=
9286: "filename">../../lang/perl5/module.mk</tt>. It provides
9287: a <span><b class="command">do-configure</b></span>
9288: target for the standard perl configuration for such
9289: modules as well as various hooks to tune this
9290: configuration. See comments in this file for
9291: details.</p>
9292:
9293: <p>Perl5 modules will install into different places
9294: depending on the version of perl used during the build
9295: process. To address this, pkgsrc will append lines to
9296: the <tt class="filename">PLIST</tt> corresponding to
9297: the files listed in the installed <tt class=
9298: "filename">.packlist</tt> file generated by most perl5
9299: modules. This is invoked by defining <tt class=
9300: "varname">PERL5_PACKLIST</tt> to a space-separated list
9301: of paths to packlist files, e.g.:</p>
9302: <pre class="programlisting">
9303: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
9304: </pre>
9305:
9306: <p>The variables <tt class=
9307: "varname">PERL5_SITELIB</tt>, <tt class=
9308: "varname">PERL5_SITEARCH</tt>, and <tt class=
9309: "varname">PERL5_ARCHLIB</tt> represent the three
9310: locations in which perl5 modules may be installed, and
9311: may be used by perl5 packages that don't have a
9312: packlist. These three variables are also substituted
9313: for in the <tt class="filename">PLIST</tt>.</p>
9314: </div>
9315:
9316: <div class="sect2" lang="en" xml:lang="en">
9317: <div class="titlepage">
9318: <div>
9319: <div>
9320: <h3 class="title"><a name="faq.info-files" id=
9321: "faq.info-files"></a>12.5.10. Packages
9322: installing info files</h3>
9323: </div>
9324: </div>
9325: </div>
9326:
9327: <p>Some packages install info files or use the
9328: “<span class="quote">makeinfo</span>” or
9329: “<span class="quote">install-info</span>”
9330: commands. Each of the info files:</p>
9331:
9332: <div class="itemizedlist">
9333: <ul type="disc">
9334: <li>
9335: <p>is considered to be installed in the directory
9336: <tt class=
9337: "filename">${PREFIX}/${INFO_DIR}</tt>,</p>
9338: </li>
9339:
9340: <li>
9341: <p>is registered in the Info directory file
9342: <tt class=
9343: "filename">${PREFIX}/${INFO_DIR}/dir</tt>,</p>
9344: </li>
9345:
9346: <li>
9347: <p>and must be listed as a filename in the
9348: <tt class="varname">INFO_FILES</tt> variable in
9349: the package Makefile.</p>
9350: </li>
9351: </ul>
9352: </div>
9353:
9354: <p><tt class="varname">INFO_DIR</tt> defaults to
9355: “<span class="quote">info</span>” and can
9356: be overridden in the package Makefile. <tt class=
9357: "filename">INSTALL</tt> and <tt class=
9358: "filename">DEINSTALL</tt> scripts will be generated to
9359: handle registration of the info files in the Info
9360: directory file. The “<span class=
9361: "quote">install-info</span>” command used for the
9362: info files registration is either provided by the
9363: system, or by a special purpose package automatically
9364: added as dependency if needed.</p>
9365:
9366: <p>A package which needs the “<span class=
9367: "quote">makeinfo</span>” command at build time
9368: must define the variable <tt class=
9369: "varname">USE_MAKEINFO</tt> in its Makefile. If a
9370: minimum version of the “<span class=
9371: "quote">makeinfo</span>” command is needed it
9372: should be noted with the <tt class=
9373: "varname">TEXINFO_REQD</tt> variable in the package
9374: <tt class="filename">Makefile</tt>. By default, a
9375: minimum version of 3.12 is required. If the system does
9376: not provide a <span><b class=
9377: "command">makeinfo</b></span> command or if it does not
9378: match the required minimum, a build dependency on the
9379: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9380: href=
9381: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.2 hubertf 9382: class="pkgname">devel/gtexinfo</a> package will be
9383: added automatically.</p>
1.1 grant 9384:
9385: <p>The build and installation process of the software
9386: provided by the package should not use the
9387: <span><b class="command">install-info</b></span>
9388: command as the registration of info files is the task
9389: of the package <tt class="filename">INSTALL</tt>
9390: script, and it must use the appropriate <span><b class=
9391: "command">makeinfo</b></span> command.</p>
9392:
9393: <p>To achieve this goal the pkgsrc infrastructure
9394: creates overriding scripts for the <span><b class=
9395: "command">install-info</b></span> and <span><b class=
9396: "command">makeinfo</b></span> commands in a directory
9397: listed early in <tt class="varname">PATH</tt>.</p>
9398:
9399: <p>The script overriding <span><b class=
9400: "command">install-info</b></span> has no effect except
9401: the logging of a message. The script overriding
9402: <span><b class="command">makeinfo</b></span> logs a
9403: message and according to the value of <tt class=
9404: "varname">USE_MAKEINFO</tt> and <tt class=
9405: "varname">TEXINFO_REQD</tt> either run the appropriate
9406: <span><b class="command">makeinfo</b></span> command or
9407: exit on error.</p>
9408: </div>
9409:
9410: <div class="sect2" lang="en" xml:lang="en">
9411: <div class="titlepage">
9412: <div>
9413: <div>
1.5 ! hubertf 9414: <h3 class="title"><a name="id2573442" id=
! 9415: "id2573442"></a>12.5.11. Packages installing
1.1 grant 9416: GConf2 data files</h3>
9417: </div>
9418: </div>
9419: </div>
9420:
9421: <p>If a package installs <tt class=
9422: "filename">.schemas</tt> or <tt class=
9423: "filename">.entries</tt> files, used by GConf2, you
9424: need to take some extra steps to make sure they get
9425: registered in the database:</p>
9426:
9427: <div class="orderedlist">
9428: <ol type="1">
9429: <li>
9430: <p>Include <tt class=
9431: "filename">../../devel/GConf2/schemas.mk</tt>
9432: instead of its <tt class=
9433: "filename">buildlink3.mk</tt> file. This takes
9434: care of rebuilding the GConf2 database at
9435: installation and deinstallation time, and tells
9436: the package where to install GConf2 data files
9437: using some standard configure arguments. It also
9438: disallows any access to the database directly
9439: from the package.</p>
9440: </li>
9441:
9442: <li>
9443: <p>Ensure that the package installs its
9444: <tt class="filename">.schemas</tt> files under
9445: <tt class=
9446: "filename">${PREFIX}/share/gconf/schemas</tt>. If
9447: they get installed under <tt class=
9448: "filename">${PREFIX}/etc</tt>, you will need to
9449: manually patch the package.</p>
9450: </li>
9451:
9452: <li>
9453: <p>Check the PLIST and remove any entries under
9454: the etc/gconf directory, as they will be handled
9455: automatically. See <a href="#faq.conf" title=
9456: "6.13. Configuration files handling and placement">
9457: Section 6.13, “Configuration files
9458: handling and placement”</a> for more
9459: information.</p>
9460: </li>
9461:
9462: <li>
9463: <p>Define the <tt class=
9464: "varname">GCONF2_SCHEMAS</tt> variable in your
9465: <tt class="filename">Makefile</tt> with a list of
9466: all <tt class="filename">.schemas</tt> files
9467: installed by the package, if any. Names must not
9468: contain any directories in them.</p>
9469: </li>
9470:
9471: <li>
9472: <p>Define the <tt class=
9473: "varname">GCONF2_ENTRIES</tt> variable in your
9474: <tt class="filename">Makefile</tt> with a list of
9475: all <tt class="filename">.entries</tt> files
9476: installed by the package, if any. Names must not
9477: contain any directories in them.</p>
9478: </li>
9479: </ol>
9480: </div>
9481: </div>
9482:
9483: <div class="sect2" lang="en" xml:lang="en">
9484: <div class="titlepage">
9485: <div>
9486: <div>
1.5 ! hubertf 9487: <h3 class="title"><a name="id2573610" id=
! 9488: "id2573610"></a>12.5.12. Packages installing
1.1 grant 9489: scrollkeeper data files</h3>
9490: </div>
9491: </div>
9492: </div>
9493:
9494: <p>If a package installs <tt class="filename">.omf</tt>
9495: files, used by scrollkeeper, you need to take some
9496: extra steps to make sure they get registered in the
9497: database:</p>
9498:
9499: <div class="orderedlist">
9500: <ol type="1">
9501: <li>
9502: <p>Include <tt class=
9503: "filename">../../textproc/scrollkeeper/omf.mk</tt>
9504: instead of its <tt class=
9505: "filename">buildlink3.mk</tt> file. This takes
9506: care of rebuilding the scrollkeeper database at
9507: installation and deinstallation time, and
9508: disallows any access to it directly from the
9509: package.</p>
9510: </li>
9511:
9512: <li>
9513: <p>Check the PLIST and remove any entries under
9514: the <tt class=
9515: "filename">libdata/scrollkeeper</tt> directory,
9516: as they will be handled automatically.</p>
9517: </li>
9518:
9519: <li>
9520: <p>Remove the <tt class="filename">share/omf</tt>
9521: directory from the PLIST. It will be handled by
9522: scrollkeeper.</p>
9523: </li>
9524: </ol>
9525: </div>
9526: </div>
9527:
9528: <div class="sect2" lang="en" xml:lang="en">
9529: <div class="titlepage">
9530: <div>
9531: <div>
1.5 ! hubertf 9532: <h3 class="title"><a name="id2573661" id=
! 9533: "id2573661"></a>12.5.13. Packages installing
1.1 grant 9534: X11 fonts</h3>
9535: </div>
9536: </div>
9537: </div>
9538:
9539: <p>If a package installs font files, you will need to
9540: rebuild the fonts database in the directory where they
9541: get installed at installation and deinstallation time.
9542: This can be automatically done by using <tt class=
9543: "filename">mk/fonts.mk</tt>, which you need to include
9544: in your <tt class="filename">Makefile</tt>.</p>
9545:
9546: <p>When the file is included, you can list the
9547: directories where fonts are installed in the <tt class=
9548: "varname">FONTS_<i class=
9549: "replaceable"><tt>type</tt></i>_DIRS</tt> variables,
9550: where <i class="replaceable"><tt>type</tt></i> can be
9551: one of “<span class="quote">TTF</span>”,
9552: “<span class="quote">TYPE1</span>” or
9553: “<span class="quote">X11</span>”. Also make
9554: sure that the database file <tt class=
9555: "filename">fonts.dir</tt> is not listed in the
9556: PLIST.</p>
9557:
9558: <p>Note that you should not create new directories for
9559: fonts; instead use the standard ones to avoid that the
9560: user needs to manually configure his X server to find
9561: them.</p>
9562: </div>
9563:
9564: <div class="sect2" lang="en" xml:lang="en">
9565: <div class="titlepage">
9566: <div>
9567: <div>
1.5 ! hubertf 9568: <h3 class="title"><a name="id2573708" id=
! 9569: "id2573708"></a>12.5.14. Packages installing
1.1 grant 9570: GTK2 modules</h3>
9571: </div>
9572: </div>
9573: </div>
9574:
9575: <p>If a package installs gtk2 immodules or loaders, you
9576: need to take some extra steps to get them registered in
9577: the GTK2 database properly:</p>
9578:
9579: <div class="orderedlist">
9580: <ol type="1">
9581: <li>
9582: <p>Include <tt class=
9583: "filename">../../x11/gtk2/modules.mk</tt> instead
9584: of its <tt class="filename">buildlink3.mk</tt>
9585: file. This takes care of rebuilding the database
9586: at installation and deinstallation time.</p>
9587: </li>
9588:
9589: <li>
9590: <p>Set <tt class=
9591: "varname">GTK2_IMMODULES=YES</tt> if your package
9592: installs GTK2 immodules.</p>
9593: </li>
9594:
9595: <li>
9596: <p>Set <tt class="varname">GTK2_LOADERS=YES</tt>
9597: if your package installs GTK2 loaders.</p>
9598: </li>
9599:
9600: <li>
9601: <p>Patch the package to not touch any of the gtk2
9602: databases directly. These are:</p>
9603:
9604: <div class="itemizedlist">
9605: <ul type="disc">
9606: <li>
9607: <p><tt class=
9608: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</tt></p>
9609: </li>
9610:
9611: <li>
9612: <p><tt class=
9613: "filename">libdata/gtk-2.0/gtk.immodules</tt></p>
9614: </li>
9615: </ul>
9616: </div>
9617: </li>
9618:
9619: <li>
9620: <p>Check the PLIST and remove any entries under
9621: the <tt class="filename">libdata/gtk-2.0</tt>
9622: directory, as they will be handled
9623: automatically.</p>
9624: </li>
9625: </ol>
9626: </div>
9627: </div>
9628:
9629: <div class="sect2" lang="en" xml:lang="en">
9630: <div class="titlepage">
9631: <div>
9632: <div>
1.5 ! hubertf 9633: <h3 class="title"><a name="id2573778" id=
! 9634: "id2573778"></a>12.5.15. Packages installing
1.1 grant 9635: SGML or XML data</h3>
9636: </div>
9637: </div>
9638: </div>
9639:
9640: <p>If a package installs SGML or XML data files that
9641: need to be registered in system-wide catalogs (like
9642: DTDs, sub-catalogs, etc.), you need to take some extra
9643: steps:</p>
9644:
9645: <div class="orderedlist">
9646: <ol type="1">
9647: <li>
9648: <p>Include <tt class=
9649: "filename">../../textproc/xmlcatmgr/catalogs.mk</tt>
9650: in your <tt class="filename">Makefile</tt>, which
9651: takes care of registering those files in
9652: system-wide catalogs at installation and
9653: deinstallation time.</p>
9654: </li>
9655:
9656: <li>
9657: <p>Set <tt class="varname">SGML_CATALOGS</tt> to
9658: the full path of any SGML catalogs installed by
9659: the package.</p>
9660: </li>
9661:
9662: <li>
9663: <p>Set <tt class="varname">XML_CATALOGS</tt> to
9664: the full path of any XML catalogs installed by
9665: the package.</p>
9666: </li>
9667:
9668: <li>
9669: <p>Set <tt class="varname">SGML_ENTRIES</tt> to
9670: individual entries to be added to the SGML
9671: catalog. These come in groups of three strings;
9672: see xmlcatmgr(1) for more information
9673: (specifically, arguments recognized by the 'add'
9674: action). Note that you will normally not use this
9675: variable.</p>
9676: </li>
9677:
9678: <li>
9679: <p>Set <tt class="varname">XML_ENTRIES</tt> to
9680: individual entries to be added to the XML
9681: catalog. These come in groups of three strings;
9682: see xmlcatmgr(1) for more information
9683: (specifically, arguments recognized by the 'add'
9684: action). Note that you will normally not use this
9685: variable.</p>
9686: </li>
9687: </ol>
9688: </div>
9689: </div>
9690:
9691: <div class="sect2" lang="en" xml:lang="en">
9692: <div class="titlepage">
9693: <div>
9694: <div>
1.5 ! hubertf 9695: <h3 class="title"><a name="id2573830" id=
! 9696: "id2573830"></a>12.5.16. Packages installing
1.1 grant 9697: extensions to the MIME database</h3>
9698: </div>
9699: </div>
9700: </div>
9701:
9702: <p>If a package provides extensions to the MIME
9703: database by installing <tt class="filename">.xml</tt>
9704: files inside <tt class=
9705: "filename">${PREFIX}/share/mime/packages</tt>, you need
9706: to take some extra steps to ensure that the database is
9707: kept consistent with respect to these new files:</p>
9708:
9709: <div class="orderedlist">
9710: <ol type="1">
9711: <li>
9712: <p>Include <tt class=
9713: "filename">../../databases/shared-mime-info/mimedb.mk</tt>
9714: (avoid using the <tt class=
9715: "filename">buildlink3.mk</tt> file from this same
9716: directory, which is reserved for inclusion from
9717: other <tt class="filename">buildlink3.mk</tt>
9718: files). It takes care of rebuilding the MIME
9719: database at installation and deinstallation time,
9720: and disallows any access to it directly from the
9721: package.</p>
9722: </li>
9723:
9724: <li>
9725: <p>Check the PLIST and remove any entries under
9726: the <tt class="filename">share/mime</tt>
9727: directory, <span class=
9728: "emphasis"><em>except</em></span> for files saved
9729: under <tt class=
9730: "filename">share/mime/packages</tt>. The former
9731: are handled automatically by the
9732: update-mime-database program, but the later are
9733: package-dependent and must be removed by the
9734: package that installed them in the first
9735: place.</p>
9736: </li>
9737:
9738: <li>
9739: <p>Remove any <tt class=
9740: "filename">share/mime/*</tt> directories from the
9741: PLIST. They will be handled by the
9742: shared-mime-info package.</p>
9743: </li>
9744: </ol>
9745: </div>
9746: </div>
9747:
9748: <div class="sect2" lang="en" xml:lang="en">
9749: <div class="titlepage">
9750: <div>
9751: <div>
1.5 ! hubertf 9752: <h3 class="title"><a name="id2573969" id=
! 9753: "id2573969"></a>12.5.17. Packages using
1.1 grant 9754: intltool</h3>
9755: </div>
9756: </div>
9757: </div>
9758:
9759: <p>If a package uses intltool during its build, include
9760: the <tt class=
9761: "filename">../../textproc/intltool/buildlink3.mk</tt>
9762: file, which forces it to use the intltool package
9763: provided by pkgsrc, instead of the one bundled with the
9764: distribution file.</p>
9765:
9766: <p>This tracks intltool's build-time dependencies and
9767: uses the latest available version; this way, the
9768: package benefits of any bug fixes that may have
9769: appeared since it was released.</p>
9770: </div>
9771: </div>
9772:
9773: <div class="sect1" lang="en" xml:lang="en">
9774: <div class="titlepage">
9775: <div>
9776: <div>
9777: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 9778: "id2573982" id="id2573982"></a>12.6. Feedback
1.1 grant 9779: to the author</h2>
9780: </div>
9781: </div>
9782: </div>
9783:
9784: <p>If you have found any bugs in the package you make
9785: available, if you had to do special steps to make it run
9786: under NetBSD or if you enhanced the software in various
9787: other ways, be sure to report these changes back to the
9788: original author of the program! With that kind of
9789: support, the next release of the program can incorporate
9790: these fixes, and people not using the NetBSD packages
9791: system can win from your efforts.</p>
9792:
9793: <p>Support the idea of free software!</p>
9794: </div>
9795: </div>
9796:
9797: <div class="chapter" lang="en" xml:lang="en">
9798: <div class="titlepage">
9799: <div>
9800: <div>
9801: <h2 class="title"><a name="debug" id=
9802: "debug"></a>Chapter 13. Debugging</h2>
9803: </div>
9804: </div>
9805: </div>
9806:
9807: <p>To check out all the gotchas when building a package,
9808: here are the steps that I do in order to get a package
9809: working. Please note this is basically the same as what was
9810: explained in the previous sections, only with some
9811: debugging aids.</p>
9812:
9813: <div class="itemizedlist">
9814: <ul type="disc">
9815: <li>
9816: <p>Be sure to set <tt class=
9817: "varname">PKG_DEVELOPER=1</tt> in <tt class=
9818: "filename">/etc/mk.conf</tt></p>
9819: </li>
9820:
9821: <li>
9822: <p>Install <a xmlns=
9823: "http://www.w3.org/TR/xhtml1/transitional" href=
9824: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.2 hubertf 9825: class="pkgname">pkgtools/url2pkg</a>, create a
9826: directory for a new package, change into it, then
9827: run <span><b class=
9828: "command">url2pkg</b></span>:</p>
1.1 grant 9829: <pre class="screen">
9830: <tt class="prompt">%</tt> <b class=
9831: "userinput"><tt>mkdir /usr/pkgsrc/<i class=
9832: "replaceable"><tt>category</tt></i>/<i class=
9833: "replaceable"><tt>examplepkg</tt></i></tt></b>
9834: <tt class="prompt">%</tt> <b class=
9835: "userinput"><tt>cd /usr/pkgsrc/<i class=
9836: "replaceable"><tt>category</tt></i>/<i class=
9837: "replaceable"><tt>examplepkg</tt></i></tt></b>
9838: <tt class="prompt">%</tt> <b class=
9839: "userinput"><tt>url2pkg http://www.example.com/path/to/distfile.tar.gz</tt></b>
9840: </pre>
9841: </li>
9842:
9843: <li>
9844: <p>Edit the <tt class="filename">Makefile</tt> as
9845: requested.</p>
9846: </li>
9847:
9848: <li>
9849: <p>Fill in the <tt class="filename">DESCR</tt>
9850: file</p>
9851: </li>
9852:
9853: <li>
9854: <p>Run <span><b class="command">make
9855: configure</b></span></p>
9856: </li>
9857:
9858: <li>
9859: <p>Add any dependencies glimpsed from documentation
9860: and the configure step to the package's <tt class=
9861: "filename">Makefile</tt>.</p>
9862: </li>
9863:
9864: <li>
9865: <p>Make the package compile, doing multiple rounds
9866: of</p>
9867: <pre class="screen">
9868: <tt class="prompt">%</tt> <b class="userinput"><tt>make</tt></b>
9869: <tt class="prompt">%</tt> <b class=
9870: "userinput"><tt>pkgvi ${WRKSRC}/some/file/that/does/not/compile</tt></b>
9871: <tt class="prompt">%</tt> <b class=
9872: "userinput"><tt>mkpatches</tt></b>
9873: <tt class="prompt">%</tt> <b class=
9874: "userinput"><tt>patchdiff</tt></b>
9875: <tt class="prompt">%</tt> <b class=
9876: "userinput"><tt>mv ${WRKDIR}/.newpatches/* patches</tt></b>
9877: <tt class="prompt">%</tt> <b class=
9878: "userinput"><tt>make mps</tt></b>
9879: <tt class="prompt">%</tt> <b class=
9880: "userinput"><tt>make clean</tt></b>
9881: </pre>
9882:
9883: <p>Doing as non-root user will ensure that no files
9884: are modified that shouldn't be, especially during the
9885: build phase. <span><b class=
9886: "command">mkpatches</b></span>, <span><b class=
9887: "command">patchdiff</b></span> and <span><b class=
9888: "command">pkgvi</b></span> are from the <a xmlns=
9889: "http://www.w3.org/TR/xhtml1/transitional" href=
9890: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.2 hubertf 9891: class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1 grant 9892: </li>
9893:
9894: <li>
9895: <p>Look at the <tt class="filename">Makefile</tt>,
9896: fix if necessary; see <a href="#components.Makefile"
9897: title="7.1. Makefile">Section 7.1,
9898: “Makefile”</a>.</p>
9899: </li>
9900:
9901: <li>
9902: <p>Generate a <tt class="filename">PLIST</tt>:</p>
9903: <pre class="screen">
9904: <tt class="prompt">#</tt> <b class=
9905: "userinput"><tt>make install</tt></b>
9906: <tt class="prompt">#</tt> <b class=
9907: "userinput"><tt>make print-PLIST >PLIST</tt></b>
9908: <tt class="prompt">#</tt> <b class=
9909: "userinput"><tt>make deinstall</tt></b>
9910: <tt class="prompt">#</tt> <b class=
9911: "userinput"><tt>make install</tt></b>
9912: <tt class="prompt">#</tt> <b class=
9913: "userinput"><tt>make deinstall</tt></b>
9914: </pre>
9915:
9916: <p>You usually need to be <tt class=
9917: "username">root</tt> to do this. Look if there are
9918: any files left:</p>
9919: <pre class="screen">
9920: <tt class="prompt">#</tt> <b class=
9921: "userinput"><tt>make print-PLIST</tt></b>
9922: </pre>
9923:
9924: <p>If this reveals any files that are missing in
9925: <tt class="filename">PLIST</tt>, add them.</p>
9926: </li>
9927:
9928: <li>
9929: <p>Now that the <tt class="filename">PLIST</tt> is
9930: OK, install the package again and make a binary
9931: package:</p>
9932: <pre class="screen">
9933: <tt class="prompt">#</tt> <b class=
9934: "userinput"><tt>make reinstall</tt></b>
9935: <tt class="prompt">#</tt> <b class=
9936: "userinput"><tt>make package</tt></b>
9937: </pre>
9938: </li>
9939:
9940: <li>
9941: <p>Delete the installed package:</p>
9942: <pre class="screen">
9943: <tt class="prompt">#</tt> <b class=
9944: "userinput"><tt>pkg_delete blub</tt></b>
9945: </pre>
9946: </li>
9947:
9948: <li>
9949: <p>Repeat the above <span><b class="command">make
9950: print-PLIST</b></span> command, which shouldn't find
9951: anything now:</p>
9952: <pre class="screen">
9953: <tt class="prompt">#</tt> <b class=
9954: "userinput"><tt>make print-PLIST</tt></b>
9955: </pre>
9956: </li>
9957:
9958: <li>
9959: <p>Reinstall the binary package:</p>
9960: <pre class="screen">
9961: <tt class="prompt">#</tt> <b class=
9962: "userinput"><tt>pkgadd .../blub.tgz</tt></b>
9963: </pre>
9964: </li>
9965:
9966: <li>
9967: <p>Play with it. Make sure everything works.</p>
9968: </li>
9969:
9970: <li>
9971: <p>Run <span><b class="command">pkglint</b></span>
9972: from <a xmlns=
9973: "http://www.w3.org/TR/xhtml1/transitional" href=
9974: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.2 hubertf 9975: class="pkgname">pkgtools/pkglint</a>, and fix the
9976: problems it reports:</p>
1.1 grant 9977: <pre class="screen">
9978: <tt class="prompt">#</tt> <b class="userinput"><tt>pkglint</tt></b>
9979: </pre>
9980: </li>
9981:
9982: <li>
9983: <p>Submit (or commit, if you have cvs access); see
9984: <a href="#submit" title=
9985: "Chapter 14. Submitting and Committing">Chapter 14,
9986: <i>Submitting and Committing</i></a>.</p>
9987: </li>
9988: </ul>
9989: </div>
9990: </div>
9991:
9992: <div class="chapter" lang="en" xml:lang="en">
9993: <div class="titlepage">
9994: <div>
9995: <div>
9996: <h2 class="title"><a name="submit" id=
9997: "submit"></a>Chapter 14. Submitting and
9998: Committing</h2>
9999: </div>
10000: </div>
10001: </div>
10002:
10003: <div class="toc">
10004: <p><b>Table of Contents</b></p>
10005:
10006: <dl>
1.5 ! hubertf 10007: <dt><span class="sect1"><a href="#id2574444">14.1.
1.1 grant 10008: Submitting your packages</a></span></dt>
10009:
1.5 ! hubertf 10010: <dt><span class="sect1"><a href="#id2574491">14.2.
1.1 grant 10011: Committing: Importing a package into
10012: CVS</a></span></dt>
10013:
1.5 ! hubertf 10014: <dt><span class="sect1"><a href="#id2574691">14.3.
1.2 hubertf 10015: Updating a package to a newer version</a></span></dt>
1.1 grant 10016:
1.5 ! hubertf 10017: <dt><span class="sect1"><a href="#id2574710">14.4.
1.2 hubertf 10018: Moving a package in pkgsrc</a></span></dt>
1.1 grant 10019: </dl>
10020: </div>
10021:
10022: <div class="sect1" lang="en" xml:lang="en">
10023: <div class="titlepage">
10024: <div>
10025: <div>
10026: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 10027: "id2574444" id=
! 10028: "id2574444"></a>14.1. Submitting your
1.1 grant 10029: packages</h2>
10030: </div>
10031: </div>
10032: </div>
10033:
10034: <p>You have to separate between binary and
10035: “<span class="quote">normal</span>” (source)
10036: packages here:</p>
10037:
10038: <div class="itemizedlist">
10039: <ul type="disc">
10040: <li>
10041: <p>precompiled binary packages</p>
10042:
10043: <p>Our policy is that we accept binaries only from
10044: pkgsrc developers to guarantee that the packages
10045: don't contain any trojan horses etc. This is not to
10046: piss anyone off but rather to protect our users!
10047: You're still free to put up your home-made binary
10048: packages and tell the world where to get them.</p>
10049: </li>
10050:
10051: <li>
10052: <p>packages</p>
10053:
10054: <p>First, check that your package is complete,
10055: compiles and runs well; see <a href="#debug" title=
10056: "Chapter 13. Debugging">Chapter 13,
10057: <i>Debugging</i></a> and the rest of this document.
10058: Next, generate an uuencoded gzipped tar(1) archive,
10059: preferably with all files in a single directory.
10060: Finally, <span><b class=
10061: "command">send-pr</b></span> with category
10062: “<span class="quote">pkg</span>”, a
10063: synopsis which includes the package name and
10064: version number, a short description of your package
10065: (contents of the COMMENT variable or DESCR file are
10066: OK) and attach the archive to your PR.</p>
10067:
10068: <p>If you want to submit several packages, please
10069: send a separate PR for each one, it's easier for us
10070: to track things that way.</p>
10071:
10072: <p>Alternatively, you can also import new packages
10073: into pkgsrc-wip (“<span class="quote">pkgsrc
10074: work-in-progress</span>”); see the homepage
10075: at <a href="http://pkgsrc-wip.sourceforge.net/"
10076: target=
10077: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
10078: details.</p>
10079: </li>
10080: </ul>
10081: </div>
10082: </div>
10083:
10084: <div class="sect1" lang="en" xml:lang="en">
10085: <div class="titlepage">
10086: <div>
10087: <div>
10088: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 10089: "id2574491" id=
! 10090: "id2574491"></a>14.2. Committing: Importing a
1.1 grant 10091: package into CVS</h2>
10092: </div>
10093: </div>
10094: </div>
10095:
10096: <p>This section is only of interest for pkgsrc developers
10097: with write access to the pkgsrc repository. Please
10098: remember that cvs imports files relative to the current
10099: working directory, and that the pathname that you give
10100: the <span><b class="command">cvs import</b></span>
10101: command is so that it knows where to place the files in
10102: the repository. Newly created packages should be imported
10103: with a vendor tag of “<span class=
10104: "quote">TNF</span>” and a release tag of
10105: “<span class="quote">pkgsrc-base</span>”,
10106: e.g:</p>
10107: <pre class="programlisting">
10108: % cd .../pkgsrc/category/pkgname
10109: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
10110: </pre>
10111:
10112: <p>Remember to move the directory from which you imported
10113: out of the way, or cvs will complain the next time you
10114: “<span class="quote">cvs update</span>” your
10115: source tree. Also don't forget to add the new package to
10116: the category's <tt class="filename">Makefile</tt>.</p>
10117:
10118: <p>The commit message of the initial import should
10119: include part of the <tt class="filename">DESCR</tt> file,
10120: so people reading the mailing lists know what the package
10121: is/does.</p>
10122:
10123: <p>Please note all package updates/additions in
10124: <tt class="filename">pkgsrc/doc/CHANGES</tt>. It's very
10125: important to keep this file up to date and conforming to
10126: the existing format, because it will be used by scripts
10127: to automatically update pages on <a href=
10128: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
10129: and other sites. Additionally, check the pkgsrc/doc/TODO
10130: file and remove the entry for the package you updated, in
10131: case it was mentioned there.</p>
10132:
10133: <p>For new packages, “<span class="quote">cvs
10134: import</span>” is preferred to “<span class=
10135: "quote">cvs add</span>” because the former gets
10136: everything with a single command, and provides a
10137: consistent tag.</p>
10138: </div>
10139:
10140: <div class="sect1" lang="en" xml:lang="en">
10141: <div class="titlepage">
10142: <div>
10143: <div>
10144: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 10145: "id2574691" id="id2574691"></a>14.3. Updating
1.2 hubertf 10146: a package to a newer version</h2>
1.1 grant 10147: </div>
10148: </div>
10149: </div>
10150:
10151: <p>Please always put a concise, appropriate and relevant
10152: summary of the changes between old and new versions into
10153: the commit log when updating a package. There are various
10154: reasons for this:</p>
10155:
10156: <div class="itemizedlist">
10157: <ul type="disc">
10158: <li>
10159: <p>A URL is volatile, and can change over time. It
10160: may go away completely or its information may be
10161: overwritten by newer information.</p>
10162: </li>
10163:
10164: <li>
10165: <p>Having the change information between old and
10166: new versions in our CVS repository is very useful
10167: for people who use either cvs or anoncvs.</p>
10168: </li>
10169:
10170: <li>
10171: <p>Having the change information between old and
10172: new versions in our CVS repository is very useful
10173: for people who read the pkgsrc-changes mailing
10174: list, so that they can make tactical decisions
10175: about when to upgrade the package.</p>
10176: </li>
10177: </ul>
10178: </div>
10179:
10180: <p>Please also recognise that, just because a new version
10181: of a package has been released, it should not
10182: automatically be upgraded in the CVS repository. We
10183: prefer to be conservative in the packages that are
10184: included in pkgsrc - development or beta packages are not
10185: really the best thing for most places in which pkgsrc is
10186: used. Please use your judgement about what should go into
10187: pkgsrc, and bear in mind that stability is to be
10188: preferred above new and possibly untested features.</p>
10189: </div>
10190:
10191: <div class="sect1" lang="en" xml:lang="en">
10192: <div class="titlepage">
10193: <div>
10194: <div>
10195: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 10196: "id2574710" id="id2574710"></a>14.4. Moving a
1.2 hubertf 10197: package in pkgsrc</h2>
1.1 grant 10198: </div>
10199: </div>
10200: </div>
10201:
10202: <div class="orderedlist">
10203: <ol type="1">
10204: <li>
10205: <p>Make a copy of the directory somewhere else.</p>
10206: </li>
10207:
10208: <li>
10209: <p>Remove all CVS dirs.</p>
10210:
10211: <p>Alternatively to the first two steps you can
10212: also do:</p>
10213: <pre class="screen">
10214: <tt class="prompt">%</tt> <b class=
10215: "userinput"><tt>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</tt></b>
10216: </pre>
10217:
10218: <p>and use that for further work.</p>
10219: </li>
10220:
10221: <li>
10222: <p>Fix <tt class="varname">CATEGORIES</tt> and any
10223: <tt class="varname">DEPENDS</tt> paths that just
10224: did “<span class=
10225: "quote">../package</span>” instead of
10226: “<span class=
10227: "quote">../../category/package</span>”.</p>
10228: </li>
10229:
10230: <li>
10231: <p><span><b class="command">cvs import</b></span>
10232: the modified package in the new place.</p>
10233: </li>
10234:
10235: <li>
10236: <p>Check if any package depends on it:</p>
10237: <pre class="screen">
10238: <tt class="prompt">%</tt> <b class=
10239: "userinput"><tt>cd /usr/pkgsrc</tt></b>
10240: <tt class="prompt">%</tt> <b class=
10241: "userinput"><tt>grep /package */*/Makefile* */*/buildlink*</tt></b>
10242: </pre>
10243: </li>
10244:
10245: <li>
10246: <p>Fix paths in packages from step 5 to point to
10247: new location.</p>
10248: </li>
10249:
10250: <li>
10251: <p><span><b class="command">cvs rm (-f)</b></span>
10252: the package at the old location.</p>
10253: </li>
10254:
10255: <li>
10256: <p>Remove from <tt class=
10257: "filename">oldcategory/Makefile</tt>.</p>
10258: </li>
10259:
10260: <li>
10261: <p>Add to <tt class=
10262: "filename">newcategory/Makefile</tt>.</p>
10263: </li>
10264:
10265: <li>
10266: <p>Commit the changed and removed files:</p>
10267: <pre class="screen">
10268: <tt class="prompt">%</tt> <b class=
10269: "userinput"><tt>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</tt></b>
10270: </pre>
10271:
10272: <p>(and any packages from step 5, of course).</p>
10273: </li>
10274: </ol>
10275: </div>
10276: </div>
10277: </div>
10278: </div>
10279:
10280: <div class="appendix" lang="en" xml:lang="en">
10281: <div class="titlepage">
10282: <div>
10283: <div>
10284: <h2 class="title"><a name="examples" id=
10285: "examples"></a>Appendix A. A simple example
10286: package: bison</h2>
10287: </div>
10288: </div>
10289: </div>
10290:
10291: <div class="toc">
10292: <p><b>Table of Contents</b></p>
10293:
10294: <dl>
1.5 ! hubertf 10295: <dt><span class="sect1"><a href="#id2575004">A.1.
1.1 grant 10296: files</a></span></dt>
10297:
10298: <dd>
10299: <dl>
1.5 ! hubertf 10300: <dt><span class="sect2"><a href="#id2575008">A.1.1.
1.1 grant 10301: Makefile</a></span></dt>
10302:
1.5 ! hubertf 10303: <dt><span class="sect2"><a href="#id2575015">A.1.2.
1.1 grant 10304: DESCR</a></span></dt>
10305:
1.5 ! hubertf 10306: <dt><span class="sect2"><a href="#id2575030">A.1.3.
1.1 grant 10307: PLIST</a></span></dt>
10308:
1.5 ! hubertf 10309: <dt><span class="sect2"><a href="#id2575037">A.1.4.
1.1 grant 10310: Checking a package with pkglint</a></span></dt>
10311: </dl>
10312: </dd>
10313:
1.5 ! hubertf 10314: <dt><span class="sect1"><a href="#id2575078">A.2. Steps
1.1 grant 10315: for building, installing, packaging</a></span></dt>
10316: </dl>
10317: </div>
10318:
10319: <p>We checked to find a piece of software that wasn't in the
10320: packages collection, and picked GNU bison. Quite why someone
10321: would want to have <span><b class="command">bison</b></span>
10322: when Berkeley <span><b class="command">yacc</b></span> is
10323: already present in the tree is beyond us, but it's useful for
10324: the purposes of this exercise.</p>
10325:
10326: <div class="sect1" lang="en" xml:lang="en">
10327: <div class="titlepage">
10328: <div>
10329: <div>
10330: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 10331: "id2575004" id="id2575004"></a>A.1. files</h2>
1.1 grant 10332: </div>
10333: </div>
10334: </div>
10335:
10336: <div class="sect2" lang="en" xml:lang="en">
10337: <div class="titlepage">
10338: <div>
10339: <div>
1.5 ! hubertf 10340: <h3 class="title"><a name="id2575008" id=
! 10341: "id2575008"></a>A.1.1. Makefile</h3>
1.1 grant 10342: </div>
10343: </div>
10344: </div>
10345: <pre class="programlisting">
10346: # $NetBSD$
10347: #
10348:
10349: DISTNAME= bison-1.25
10350: CATEGORIES= devel
10351: MASTER_SITES= ${MASTER_SITE_GNU}
10352:
10353: MAINTAINER= thorpej@NetBSD.org
10354: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
10355: COMMENT= GNU yacc clone
10356:
10357: GNU_CONFIGURE= yes
10358: INFO_FILES= bison.info
10359:
10360: .include "../../mk/bsd.pkg.mk"
10361: </pre>
10362: </div>
10363:
10364: <div class="sect2" lang="en" xml:lang="en">
10365: <div class="titlepage">
10366: <div>
10367: <div>
1.5 ! hubertf 10368: <h3 class="title"><a name="id2575015" id=
! 10369: "id2575015"></a>A.1.2. DESCR</h3>
1.1 grant 10370: </div>
10371: </div>
10372: </div>
10373: <pre class="programlisting">
10374: GNU version of yacc. Can make re-entrant parsers, and numerous other
10375: improvements. Why you would want this when Berkeley <a href=
10376: "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
10377: of the NetBSD source tree is beyond me.
10378: </pre>
10379: </div>
10380:
10381: <div class="sect2" lang="en" xml:lang="en">
10382: <div class="titlepage">
10383: <div>
10384: <div>
1.5 ! hubertf 10385: <h3 class="title"><a name="id2575030" id=
! 10386: "id2575030"></a>A.1.3. PLIST</h3>
1.1 grant 10387: </div>
10388: </div>
10389: </div>
10390: <pre class="programlisting">
10391: @comment $NetBSD$
10392: bin/bison
10393: man/man1/bison.1.gz
10394: info/bison.info
10395: info/bison.info-1
10396: info/bison.info-2
10397: info/bison.info-3
10398: info/bison.info-4
10399: info/bison.info-5
10400: share/bison.simple
10401: share/bison.hairy
10402: </pre>
10403: </div>
10404:
10405: <div class="sect2" lang="en" xml:lang="en">
10406: <div class="titlepage">
10407: <div>
10408: <div>
1.5 ! hubertf 10409: <h3 class="title"><a name="id2575037" id=
! 10410: "id2575037"></a>A.1.4. Checking a package with
1.1 grant 10411: <span><b class="command">pkglint</b></span></h3>
10412: </div>
10413: </div>
10414: </div>
10415:
10416: <p>The NetBSD package system comes with <a xmlns=
10417: "http://www.w3.org/TR/xhtml1/transitional" href=
10418: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.2 hubertf 10419: class="pkgname">pkgtools/pkglint</a> which helps to
10420: check the contents of these files. After installation
10421: it is quite easy to use, just change to the directory
10422: of the package you wish to examine and execute
10423: <span><b class="command">pkglint</b></span>:</p>
1.1 grant 10424: <pre class="screen">
10425: <tt class="prompt">$</tt> <b class="userinput"><tt>pkglint</tt></b>
10426: OK: checking ./DESCR.
10427: OK: checking Makefile.
10428: OK: checking distinfo.
10429: OK: checking patches/patch-aa.
10430: looks fine.
10431: </pre>
10432:
10433: <p>Depending on the supplied command line arguments (see
10434: pkglint(1)) more verbose checks will be performed. Use
10435: e.g. <span><b class="command">pkglint -v</b></span> for a
10436: very verbose check.</p>
10437: </div>
10438: </div>
10439:
10440: <div class="sect1" lang="en" xml:lang="en">
10441: <div class="titlepage">
10442: <div>
10443: <div>
10444: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 10445: "id2575078" id="id2575078"></a>A.2. Steps for
1.1 grant 10446: building, installing, packaging</h2>
10447: </div>
10448: </div>
10449: </div>
10450:
10451: <p>Create the directory where the package lives, plus any
10452: auxiliary directories:</p>
10453: <pre class="screen">
10454: <tt class="prompt">#</tt> <b class=
10455: "userinput"><tt>cd /usr/pkgsrc/lang</tt></b>
10456: <tt class="prompt">#</tt> <b class=
10457: "userinput"><tt>mkdir bison</tt></b>
10458: <tt class="prompt">#</tt> <b class=
10459: "userinput"><tt>cd bison</tt></b>
10460: <tt class="prompt">#</tt> <b class=
10461: "userinput"><tt>mkdir patches</tt></b>
10462: </pre>
10463:
10464: <p>Create <tt class="filename">Makefile</tt>, <tt class=
10465: "filename">DESCR</tt> and <tt class="filename">PLIST</tt>
10466: (see <a href="#components" title=
10467: "Chapter 7. Package components - files, directories and contents">
10468: Chapter 7, <i>Package components - files, directories and
10469: contents</i></a>) then continue with fetching the
10470: distfile:</p>
10471: <pre class="screen">
10472: <tt class="prompt">#</tt> <b class=
10473: "userinput"><tt>make fetch</tt></b>
10474: >> bison-1.25.tar.gz doesn't seem to exist on this system.
10475: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
10476: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10477: ftp: Error retrieving file: 500 Internal error
10478:
10479: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
10480: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10481: ftp: Error retrieving file: 500 Internal error
10482:
10483: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
10484: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10485: Successfully retrieved file.
10486: </pre>
10487:
10488: <p>Generate the checksum of the distfile into <tt class=
10489: "filename">distinfo</tt>:</p>
10490: <pre class="screen">
10491: <tt class="prompt">#</tt> <b class=
10492: "userinput"><tt>make makesum</tt></b>
10493: </pre>
10494:
10495: <p>Now compile:</p>
10496: <pre class="screen">
10497: <tt class="prompt">#</tt> <b class="userinput"><tt>make</tt></b>
10498: >> Checksum OK for bison-1.25.tar.gz.
10499: ===> Extracting for bison-1.25
10500: ===> Patching for bison-1.25
10501: ===> Ignoring empty patch directory
10502: ===> Configuring for bison-1.25
10503: creating cache ./config.cache
10504: checking for gcc... cc
10505: checking whether we are using GNU C... yes
10506: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
10507: checking how to run the C preprocessor... cc -E
10508: checking for minix/config.h... no
10509: checking for POSIXized ISC... no
10510: checking whether cross-compiling... no
10511: checking for ANSI C header files... yes
10512: checking for string.h... yes
10513: checking for stdlib.h... yes
10514: checking for memory.h... yes
10515: checking for working const... yes
10516: checking for working alloca.h... no
10517: checking for alloca... yes
10518: checking for strerror... yes
10519: updating cache ./config.cache
10520: creating ./config.status
10521: creating Makefile
10522: ===> Building for bison-1.25
10523: 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
10524: 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
10525: 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
10526: 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
10527: 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
10528: 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
10529: 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
10530: 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
10531: 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
10532: 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
10533: 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
10534: 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
10535: 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
10536: 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
10537: 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
10538: 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
10539: 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
10540: 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
10541: 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
10542: 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
10543: 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
10544: 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
10545: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
10546: rm -f bison.s1
10547: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
10548: </pre>
10549:
10550: <p>Everything seems OK, so install the files:</p>
10551: <pre class="screen">
10552: <tt class="prompt">#</tt> <b class=
10553: "userinput"><tt>make install</tt></b>
10554: >> Checksum OK for bison-1.25.tar.gz.
10555: ===> Installing for bison-1.25
10556: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
10557: rm -f /usr/pkg/bin/bison
10558: cd /usr/pkg/share; rm -f bison.simple bison.hairy
10559: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
10560: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
10561: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
10562: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
10563: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
10564: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
10565: ===> Registering installation for bison-1.25
10566: </pre>
10567:
10568: <p>You can now use bison, and also - if you decide so -
10569: remove it with <span><b class="command">pkg_delete
10570: bison</b></span>. Should you decide that you want a binary
10571: package, do this now:</p>
10572: <pre class="screen">
10573: <tt class="prompt">#</tt> <b class=
10574: "userinput"><tt>make package</tt></b>
10575: >> Checksum OK for bison-1.25.tar.gz.
10576: ===> Building package for bison-1.25
10577: Creating package bison-1.25.tgz
10578: Registering depends:.
10579: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
10580: </pre>
10581:
10582: <p>Now that you don't need the source and object files any
10583: more, clean up:</p>
10584: <pre class="screen">
10585: <tt class="prompt">#</tt> <b class=
10586: "userinput"><tt>make clean</tt></b>
10587: ===> Cleaning for bison-1.25
10588: </pre>
10589: </div>
10590: </div>
10591:
10592: <div class="appendix" lang="en" xml:lang="en">
10593: <div class="titlepage">
10594: <div>
10595: <div>
10596: <h2 class="title"><a name="logs" id=
10597: "logs"></a>Appendix B. Build logs</h2>
10598: </div>
10599: </div>
10600: </div>
10601:
10602: <div class="toc">
10603: <p><b>Table of Contents</b></p>
10604:
10605: <dl>
10606: <dt><span class="sect1"><a href="#logs.building">B.1.
10607: Building figlet</a></span></dt>
10608:
10609: <dt><span class="sect1"><a href="#logs.package">B.2.
10610: Packaging figlet</a></span></dt>
10611: </dl>
10612: </div>
10613:
10614: <div class="sect1" lang="en" xml:lang="en">
10615: <div class="titlepage">
10616: <div>
10617: <div>
10618: <h2 class="title" style="clear: both"><a name=
10619: "logs.building" id=
10620: "logs.building"></a>B.1. Building figlet</h2>
10621: </div>
10622: </div>
10623: </div>
10624: <pre class="screen">
10625: <tt class="prompt">#</tt> <b class="userinput"><tt>make</tt></b>
10626: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10627: => figlet221.tar.gz doesn't seem to exist on this system.
10628: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
10629: => [172219 bytes]
10630: Connected to ftp.plig.net.
10631: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
10632: 331 Guest login ok, send your complete e-mail address as password.
10633: 230-You are user #5 of 500 simultaneous users allowed.
10634: 230-
10635: 230- ___ _ _ _
10636: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
10637: 230- | _| _| . |_| . | | | . |_| . | _| . |
10638: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
10639: 230- |_| |_| |___| |___|
10640: 230-
10641: 230-** Welcome to ftp.plig.org **
10642: 230-
10643: 230-Please note that all transfers from this FTP site are logged. If you
10644: 230-do not like this, please disconnect now.
10645: 230-
10646: 230-This arhive is available via
10647: 230-
10648: 230-HTTP: http://ftp.plig.org/
10649: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
10650: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
10651: 230-
10652: 230-Please email comments, bug reports and requests for packages to be
10653: 230-mirrored to ftp-admin@plig.org.
10654: 230-
10655: 230-
10656: 230 Logged in anonymously.
10657: Remote system type is UNIX.
10658: Using binary mode to transfer files.
10659: 200 Type okay.
10660: 250 "/pub" is new cwd.
10661: 250-"/pub/figlet" is new cwd.
10662: 250-
10663: 250-Welcome to the figlet archive at ftp.figlet.org
10664: 250-
10665: 250- ftp://ftp.figlet.org/pub/figlet/
10666: 250-
10667: 250-The official FIGlet web page is:
10668: 250- http://www.figlet.org/
10669: 250-
10670: 250-If you have questions, please mailto:info@figlet.org. If you want to
10671: 250-contribute a font or something else, you can email us.
10672: 250
10673: 250 "/pub/figlet/program" is new cwd.
10674: 250 "/pub/figlet/program/unix" is new cwd.
10675: local: figlet221.tar.gz remote: figlet221.tar.gz
10676: 502 Unimplemented command.
10677: 227 Entering Passive Mode (195,40,6,41,246,104)
10678: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
10679: 38% |************** | 65800 64.16 KB/s 00:01 ETA
10680: 226 Transfer completed.
10681: 172219 bytes received in 00:02 (75.99 KB/s)
10682: 221 Goodbye.
10683: => Checksum OK for figlet221.tar.gz.
10684: ===> Extracting for figlet-2.2.1nb2
10685: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
10686: ===> Patching for figlet-2.2.1nb2
10687: ===> Applying pkgsrc patches for figlet-2.2.1nb2
10688: ===> Overriding tools for figlet-2.2.1nb2
10689: ===> Creating toolchain wrappers for figlet-2.2.1nb2
10690: ===> Configuring for figlet-2.2.1nb2
10691: ===> Building for figlet-2.2.1nb2
10692: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
10693: chmod a+x figlet
10694: gcc -O2 -o chkfont chkfont.c
10695: => Unwrapping files-to-be-installed.
10696: <tt class="prompt">#</tt>
10697: <tt class="prompt">#</tt> <b class=
10698: "userinput"><tt>make install</tt></b>
10699: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10700: ===> Installing for figlet-2.2.1nb2
10701: install -d -o root -g wheel -m 755 /usr/pkg/bin
10702: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
10703: mkdir -p /usr/pkg/share/figlet
10704: cp figlet /usr/pkg/bin
10705: cp chkfont /usr/pkg/bin
10706: chmod 555 figlist showfigfonts
10707: cp figlist /usr/pkg/bin
10708: cp showfigfonts /usr/pkg/bin
10709: cp fonts/*.flf /usr/pkg/share/figlet
10710: cp fonts/*.flc /usr/pkg/share/figlet
10711: cp figlet.6 /usr/pkg/man/man6
10712: ===> Registering installation for figlet-2.2.1nb2
10713: <tt class="prompt">#</tt>
10714: </pre>
10715: </div>
10716:
10717: <div class="sect1" lang="en" xml:lang="en">
10718: <div class="titlepage">
10719: <div>
10720: <div>
10721: <h2 class="title" style="clear: both"><a name=
10722: "logs.package" id=
10723: "logs.package"></a>B.2. Packaging figlet</h2>
10724: </div>
10725: </div>
10726: </div>
10727: <pre class="screen">
10728: <tt class="prompt">#</tt> <b class=
10729: "userinput"><tt>make package</tt></b>
10730: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10731: ===> Packaging figlet-2.2.1nb2
10732: ===> Building binary package for figlet-2.2.1nb2
10733: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
10734: Using SrcDir value of /usr/pkg
10735: Registering depends:.
10736: <tt class="prompt">#</tt>
10737: </pre>
10738: </div>
10739: </div>
10740:
10741: <div class="appendix" lang="en" xml:lang="en">
10742: <div class="titlepage">
10743: <div>
10744: <div>
10745: <h2 class="title"><a name="ftp-layout" id=
10746: "ftp-layout"></a>Appendix C. Layout of the
10747: FTP server's package archive</h2>
10748: </div>
10749: </div>
10750: </div>
10751:
10752: <p>Layout for precompiled binary packages on
10753: ftp.NetBSD.org:</p>
10754: <pre class="programlisting">
10755: /pub/NetBSD/packages/
10756: distfiles/
10757:
10758: # Unpacked pkgsrc trees
10759: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
10760: pkgsrc-2003Q4 -> N/A
10761: pkgsrc-2004Q1/pkgsrc
10762:
10763: # pkgsrc archives
10764: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
10765: pkgsrc-2003Q4.tar.gz -> N/A
10766: pkgsrc-2004Q1.tar.gz -> N/A
10767:
10768: # Per pkgsrc-release/OS-release/arch package archives
10769: pkgsrc-2003Q4/
10770: NetBSD-1.6.2/
10771: i386/
10772: All/
10773: archivers/
10774: foo -> ../All/foo
10775: ...
10776: pkgsrc-2004Q1/
10777: NetBSD-1.6.2/
10778: i386/
10779: All/
10780: ...
10781: NetBSD-2.0/
10782: i386/
10783: All/
10784: ...
10785: SunOS-5.9/
10786: sparc/
10787: All/
10788: ...
10789: x86/
10790: All/
10791: ...
10792:
10793: # Per os-release package archive convenience links
10794: NetBSD-1.6.2 -> 1.6.2
10795: 1.6.2/
10796: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
10797: m68k/
10798: All/
10799: archivers/
10800: foo -> ../All/foo
10801: ...
10802: amiga -> m68k
10803: atari -> m68k
10804: ...
10805:
10806: 2.0 -> NetBSD-2.0 # backward compat, historic
10807: NetBSD-2.0/
10808: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
10809: SunOS-5.9/
10810: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
10811: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
10812:
10813: </pre>
10814:
10815: <p>To create:</p>
10816:
10817: <div class="orderedlist">
10818: <ol type="1">
10819: <li>
10820: <p>Run bulk build, see <a href="#bulkbuild" title=
10821: "5.3. Doing a bulk build of all packages">Section
10822: 5.3, “Doing a bulk build of all
10823: packages”</a></p>
10824: </li>
10825:
10826: <li>
10827: <p>Upload /usr/pkgsrc/packages to</p>
10828: <pre class="programlisting">
10829: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
10830: pkgsrc-2004Q3/\ # pkgsrc-branch
10831: `uname -s`-`uname -r`/ # OS & version
10832: `uname -p` # architecture
10833:
10834: </pre>
10835: </li>
10836:
10837: <li>
10838: <p>If necessary, create a symlink <span><b class=
10839: "command">ln -s `uname -m` `uname -p`</b></span> (amiga
10840: -> m68k, ...)</p>
10841: </li>
10842: </ol>
10843: </div>
10844: </div>
1.2 hubertf 10845:
10846: <div class="appendix" lang="en" xml:lang="en">
10847: <div class="titlepage">
10848: <div>
10849: <div>
10850: <h2 class="title"><a name="editing" id=
10851: "editing"></a>Appendix D. Editing guidelines
10852: for the pkgsrc guide</h2>
10853: </div>
10854: </div>
10855: </div>
10856:
10857: <div class="toc">
10858: <p><b>Table of Contents</b></p>
10859:
10860: <dl>
1.5 ! hubertf 10861: <dt><span class="sect1"><a href="#id2575861">D.1.
1.2 hubertf 10862: Targets</a></span></dt>
10863:
1.5 ! hubertf 10864: <dt><span class="sect1"><a href="#id2576046">D.2.
1.2 hubertf 10865: Procedure</a></span></dt>
10866: </dl>
10867: </div>
10868:
10869: <p>This section contains information on editing the pkgsrc
10870: guide itself.</p>
10871:
10872: <div class="sect1" lang="en" xml:lang="en">
10873: <div class="titlepage">
10874: <div>
10875: <div>
10876: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 10877: "id2575861" id="id2575861"></a>D.1. Targets</h2>
1.2 hubertf 10878: </div>
10879: </div>
10880: </div>
10881:
10882: <p>The pkgsrc guide's source code is stored in <tt class=
10883: "filename">pkgsrc/doc/guide/files</tt>, and several files
10884: are created from it:</p>
10885:
10886: <div class="itemizedlist">
10887: <ul type="disc">
10888: <li>
10889: <p><tt class="filename">pkgsrc/doc/pkgsrc.txt</tt>,
10890: which replaces <tt class=
10891: "filename">pkgsrc/Packages.txt</tt></p>
10892: </li>
10893:
10894: <li>
10895: <p><tt class=
10896: "filename">pkgsrc/doc/pkgsrc.html</tt></p>
10897: </li>
10898:
10899: <li>
10900: <p><tt class=
10901: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</tt>:
10902: the documentation on the NetBSD website will be built
10903: from pkgsrc and kept up to date on the web server
10904: itself. This means you <span class=
10905: "emphasis"><em>must</em></span> make sure that your
10906: changes haven't broken the build!</p>
10907: </li>
10908: </ul>
10909: </div>
10910: </div>
10911:
10912: <div class="sect1" lang="en" xml:lang="en">
10913: <div class="titlepage">
10914: <div>
10915: <div>
10916: <h2 class="title" style="clear: both"><a name=
1.5 ! hubertf 10917: "id2576046" id=
! 10918: "id2576046"></a>D.2. Procedure</h2>
1.2 hubertf 10919: </div>
10920: </div>
10921: </div>
10922:
10923: <p>The procedure to edit the pkgsrc guide is:</p>
10924:
10925: <div class="itemizedlist">
10926: <ul type="disc">
10927: <li>
10928: <p>Edit the XML file(s) in <tt class=
10929: "filename">pkgsrc/doc/guide/files</tt></p>
10930: </li>
10931:
10932: <li>
1.4 hubertf 10933: <p>Run <span><b class="command">make
10934: do-lint</b></span> in <tt class=
10935: "filename">pkgsrc/doc/guide</tt> to check the XML
10936: syntax, and fix it if needed</p>
10937: </li>
10938:
10939: <li>
1.2 hubertf 10940: <p>Run <span><b class="command">make</b></span> in
10941: <tt class="filename">pkgsrc/doc/guide</tt> to build
10942: the HTML and ASCII version</p>
10943: </li>
10944:
10945: <li>
10946: <p>Run <span><b class="command">make
10947: OUTPUT=pdf</b></span> in <tt class=
10948: "filename">pkgsrc/doc/guide</tt> to build the PDF
1.4 hubertf 10949: version.</p>
1.2 hubertf 10950: </li>
10951:
10952: <li>
10953: <p>If all is well, run <span><b class="command">make
10954: install-doc</b></span> to put the generated files
1.4 hubertf 10955: into <tt class="filename">pkgsrc/doc</tt>.</p>
1.2 hubertf 10956: </li>
10957:
10958: <li>
10959: <p><span><b class="command">cvs commit
10960: pkgsrc/doc/guide/files</b></span></p>
10961: </li>
10962:
10963: <li>
10964: <p><span><b class="command">cvs commit
10965: pkgsrc/doc/pkgsrc.{html,txt}</b></span></p>
10966: </li>
1.4 hubertf 10967:
10968: <li>
10969: <p>Until the webserver on www.NetBSD.org is really
10970: updated automatically to pick up changes to the
10971: pkgsrc guide automatically, also run <span><b class=
10972: "command">make install-htdoc
10973: HTDOCSDIR=../../../htdocs</b></span> (or similar,
10974: adjust <tt class="varname">HTDOCSDIR</tt>!)</p>
10975: </li>
10976:
10977: <li>
10978: <p><span><b class="command">cvs commit
10979: htdocs/Documentation/pkgsrc</b></span></p>
10980: </li>
1.2 hubertf 10981: </ul>
10982: </div>
10983: </div>
10984: </div>
1.1 grant 10985: </div>
10986: </body>
10987: </html>
CVSweb <webmaster@jp.NetBSD.org>