Annotation of pkgsrc/doc/pkgsrc.html, revision 1.13
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.13 ! 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=
1.13 ! hubertf 11: "DocBook XSL Stylesheets V1.65.0" />
1.1 grant 12: <meta name="description" content=
13: "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
14: </head>
15:
16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
17: alink="#0000FF">
18: <div class="book" lang="en" xml:lang="en">
19: <div class="titlepage">
20: <div>
21: <div>
1.13 ! 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">
1.13 ! hubertf 40: <p><tt class="email"><<a href=
! 41: "mailto:agc@NetBSD.org">agc@NetBSD.org</a>></tt></p>
1.1 grant 42: </div>
43: </div>
44: </div>
45:
46: <div class="author">
47: <h3 class="author"><span class=
48: "firstname">Hubert</span> <span class=
49: "surname">Feyrer</span></h3>
50:
51: <div class="affiliation">
52: <div class="address">
1.13 ! hubertf 53: <p><tt class="email"><<a href=
! 54: "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>></tt></p>
1.1 grant 55: </div>
56: </div>
57: </div>
1.2 hubertf 58:
1.3 hubertf 59: <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1 grant 60: </div>
61: </div>
62:
63: <div>
64: <p class="copyright">Copyright © 1994-2004 The
65: NetBSD Foundation, Inc</p>
66: </div>
67:
68: <div>
1.3 hubertf 69: <p class="pubdate">$NetBSD: pkgsrc.xml,v 1.3 2004/10/22
70: 00:24:48 hubertf Exp $</p>
1.1 grant 71: </div>
72:
73: <div>
74: <div class="abstract">
75: <p class="title"><b>Abstract</b></p>
76:
77: <p>Information about using the NetBSD package system
78: (pkgsrc) from both a user view for installing packages
79: as well as from a pkgsrc developers' view for creating
80: new packages.</p>
81: </div>
82: </div>
83: </div>
84: <hr />
85: </div>
86:
87: <div class="toc">
88: <p><b>Table of Contents</b></p>
89:
90: <dl>
91: <dt><span class="chapter"><a href="#introduction">1.
92: Introduction</a></span></dt>
93:
94: <dd>
95: <dl>
1.13 ! 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.13 ! hubertf 120: <dt><span class="sect1"><a href="#id2495052">2.1.
1.1 grant 121: As tar file</a></span></dt>
122:
1.13 ! hubertf 123: <dt><span class="sect1"><a href="#id2495068">2.2.
1.1 grant 124: Via SUP</a></span></dt>
125:
1.13 ! hubertf 126: <dt><span class="sect1"><a href="#id2495100">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.13 ! hubertf 136: <dt><span class="sect1"><a href="#id2495210">3.1.
1.1 grant 137: Bootstrapping pkgsrc</a></span></dt>
138:
1.13 ! hubertf 139: <dt><span class="sect1"><a href="#id2495317">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.13 ! hubertf 145: "#id2495323">3.2.1. Darwin (Mac OS
1.1 grant 146: X)</a></span></dt>
147:
148: <dt><span class="sect2"><a href=
1.13 ! hubertf 149: "#id2495622">3.2.2. FreeBSD</a></span></dt>
1.1 grant 150:
151: <dt><span class="sect2"><a href=
1.13 ! hubertf 152: "#id2496270">3.2.3. Interix</a></span></dt>
1.1 grant 153:
154: <dt><span class="sect2"><a href=
1.13 ! hubertf 155: "#id2496361">3.2.4. IRIX</a></span></dt>
1.1 grant 156:
157: <dt><span class="sect2"><a href=
1.13 ! hubertf 158: "#id2496478">3.2.5. OpenBSD</a></span></dt>
1.1 grant 159:
160: <dt><span class="sect2"><a href=
1.13 ! hubertf 161: "#id2496659">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.13 ! hubertf 179: "#id2496864">4.1.1. Where to get binary
1.1 grant 180: packages</a></span></dt>
181:
182: <dt><span class="sect2"><a href=
1.13 ! hubertf 183: "#id2496904">4.1.2. How to use binary
1.1 grant 184: packages</a></span></dt>
185:
186: <dt><span class="sect2"><a href=
1.13 ! hubertf 187: "#id2497038">4.1.3. A word of
1.1 grant 188: warning</a></span></dt>
189: </dl>
190: </dd>
191:
1.13 ! hubertf 192: <dt><span class="sect1"><a href="#id2497050">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.13 ! hubertf 198: "#id2497128">4.2.1.
1.1 grant 199: Requirements</a></span></dt>
200:
201: <dt><span class="sect2"><a href=
1.13 ! hubertf 202: "#id2497148">4.2.2. Fetching
1.1 grant 203: distfiles</a></span></dt>
204:
205: <dt><span class="sect2"><a href=
1.13 ! hubertf 206: "#id2497201">4.2.3. How to build and
1.1 grant 207: install</a></span></dt>
208:
209: <dt><span class="sect2"><a href=
1.13 ! hubertf 210: "#id2498132">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.13 ! hubertf 222: <dt><span class="sect1"><a href="#id2563003">5.1.
1.1 grant 223: Building a single binary package</a></span></dt>
224:
1.13 ! hubertf 225: <dt><span class="sect1"><a href="#id2563081">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.13 ! hubertf 239: "#id2563289">5.3.2. Other environmental
1.1 grant 240: considerations</a></span></dt>
241:
242: <dt><span class="sect2"><a href=
1.13 ! hubertf 243: "#id2563330">5.3.3. Operation</a></span></dt>
1.1 grant 244:
245: <dt><span class="sect2"><a href=
1.13 ! hubertf 246: "#id2563467">5.3.4. What it
1.1 grant 247: does</a></span></dt>
248:
249: <dt><span class="sect2"><a href=
1.13 ! hubertf 250: "#id2563524">5.3.5. Disk space
1.1 grant 251: requirements</a></span></dt>
252:
253: <dt><span class="sect2"><a href=
1.13 ! hubertf 254: "#id2563550">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.13 ! hubertf 258: "#id2563943">5.3.7. Building a partial set of
1.1 grant 259: packages</a></span></dt>
1.13 ! hubertf 260:
! 261: <dt><span class="sect2"><a href=
! 262: "#bulk-upload">5.3.8. Uploading results of a
! 263: bulk build</a></span></dt>
1.1 grant 264: </dl>
265: </dd>
266:
1.13 ! hubertf 267: <dt><span class="sect1"><a href="#id2564359">5.4.
1.1 grant 268: Creating a multiple CD-ROM packages
269: collection</a></span></dt>
270:
271: <dd>
272: <dl>
273: <dt><span class="sect2"><a href=
1.13 ! hubertf 274: "#id2564442">5.4.1. Example of
1.1 grant 275: cdpack</a></span></dt>
276: </dl>
277: </dd>
278: </dl>
279: </dd>
280:
281: <dt><span class="chapter"><a href="#faq">6. Frequently
282: Asked Questions</a></span></dt>
283:
284: <dd>
285: <dl>
1.13 ! hubertf 286: <dt><span class="sect1"><a href="#id2564634">6.1.
1.1 grant 287: Is there a mailing list for pkg-related
288: discussion?</a></span></dt>
289:
1.13 ! hubertf 290: <dt><span class="sect1"><a href="#id2564801">6.2.
1.1 grant 291: Where's the pkgviews documentation?</a></span></dt>
292:
1.5 hubertf 293: <dt><span class="sect1"><a href=
294: "#faq-pkgtools">6.3. Utilities for package
295: management (pkgtools)</a></span></dt>
1.1 grant 296:
1.13 ! hubertf 297: <dt><span class="sect1"><a href="#id2564985">6.4.
1.1 grant 298: How to use pkgsrc as non-root</a></span></dt>
299:
1.13 ! hubertf 300: <dt><span class="sect1"><a href="#id2564997">6.5.
1.1 grant 301: How can I install/use XFree86 from
302: pkgsrc?</a></span></dt>
303:
1.13 ! hubertf 304: <dt><span class="sect1"><a href="#id2565025">6.6.
1.1 grant 305: How can I install/use X.org from
306: pkgsrc?</a></span></dt>
307:
1.13 ! hubertf 308: <dt><span class="sect1"><a href="#id2565121">6.7.
1.1 grant 309: How to fetch files from behind a
310: firewall</a></span></dt>
311:
1.13 ! hubertf 312: <dt><span class="sect1"><a href="#id2565134">6.8.
! 313: How do I tell make fetch to do passive
1.1 grant 314: FTP?</a></span></dt>
315:
1.13 ! hubertf 316: <dt><span class="sect1"><a href="#id2565186">6.9.
1.1 grant 317: How to fetch all distfiles at once</a></span></dt>
318:
1.13 ! hubertf 319: <dt><span class="sect1"><a href="#id2565325">6.10.
! 320: What does Don't know how to make
! 321: /usr/share/tmac/tmac.andoc mean?</a></span></dt>
! 322:
! 323: <dt><span class="sect1"><a href="#id2565364">6.11.
! 324: What does Could not find bsd.own.mk
1.7 wiz 325: mean?</a></span></dt>
1.1 grant 326:
1.13 ! hubertf 327: <dt><span class="sect1"><a href="#id2565490">6.12.
1.1 grant 328: Using 'sudo' with pkgsrc</a></span></dt>
329:
330: <dt><span class="sect1"><a href="#faq.conf">6.13.
331: Configuration files handling and
332: placement</a></span></dt>
333:
334: <dt><span class="sect1"><a href=
335: "#audit-packages">6.14. Automated security
336: checks</a></span></dt>
337: </dl>
338: </dd>
339: </dl>
340: </dd>
341:
1.2 hubertf 342: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 343: pkgsrc developer's guide</a></span></dt>
344:
345: <dd>
346: <dl>
347: <dt><span class="chapter"><a href="#components">7.
348: Package components - files, directories and
349: contents</a></span></dt>
350:
351: <dd>
352: <dl>
353: <dt><span class="sect1"><a href=
1.13 ! hubertf 354: "#components.Makefile">7.1.
! 355: Makefile</a></span></dt>
1.1 grant 356:
357: <dt><span class="sect1"><a href=
1.13 ! hubertf 358: "#components.distinfo">7.2.
! 359: distinfo</a></span></dt>
1.1 grant 360:
361: <dt><span class="sect1"><a href=
362: "#components.patches">7.3.
363: patches/*</a></span></dt>
364:
1.13 ! hubertf 365: <dt><span class="sect1"><a href="#id2566535">7.4.
1.1 grant 366: Other mandatory files</a></span></dt>
367:
368: <dt><span class="sect1"><a href=
369: "#components.optional">7.5. Optional
370: files</a></span></dt>
371:
1.13 ! hubertf 372: <dt><span class="sect1"><a href="#id2566729">7.6.
! 373: work*</a></span></dt>
1.1 grant 374:
1.13 ! hubertf 375: <dt><span class="sect1"><a href="#id2566817">7.7.
! 376: files/*</a></span></dt>
1.1 grant 377: </dl>
378: </dd>
379:
380: <dt><span class="chapter"><a href="#plist">8. PLIST
381: issues</a></span></dt>
382:
383: <dd>
384: <dl>
1.13 ! hubertf 385: <dt><span class="sect1"><a href="#id2566871">8.1.
1.1 grant 386: RCS ID</a></span></dt>
387:
1.13 ! hubertf 388: <dt><span class="sect1"><a href="#id2566886">8.2.
! 389: Semi-automatic PLIST generation</a></span></dt>
1.1 grant 390:
391: <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.13 ! hubertf 392: Tweaking output of make print-PLIST</a></span></dt>
1.1 grant 393:
394: <dt><span class="sect1"><a href="#plist.misc">8.4.
395: Variable substitution in PLIST</a></span></dt>
396:
1.13 ! hubertf 397: <dt><span class="sect1"><a href="#id2567139">8.5.
1.1 grant 398: Manpage-compression</a></span></dt>
399:
1.13 ! hubertf 400: <dt><span class="sect1"><a href="#id2567249">8.6.
! 401: Changing PLIST source with
! 402: PLIST_SRC</a></span></dt>
1.1 grant 403:
1.13 ! hubertf 404: <dt><span class="sect1"><a href="#id2567266">8.7.
1.1 grant 405: Platform specific and differing
406: PLISTs</a></span></dt>
407:
408: <dt><span class="sect1"><a href=
409: "#faq.common-dirs">8.8. Sharing directories between
410: packages</a></span></dt>
411: </dl>
412: </dd>
413:
414: <dt><span class="chapter"><a href="#buildlink">9.
415: Buildlink methodology</a></span></dt>
416:
417: <dd>
418: <dl>
1.13 ! hubertf 419: <dt><span class="sect1"><a href="#id2567742">9.1.
1.1 grant 420: Converting packages to use
421: buildlink3</a></span></dt>
422:
1.13 ! hubertf 423: <dt><span class="sect1"><a href="#id2567933">9.2.
! 424: Writing buildlink3.mk files</a></span></dt>
1.1 grant 425:
426: <dd>
427: <dl>
428: <dt><span class="sect2"><a href=
1.13 ! hubertf 429: "#id2568003">9.2.1. Anatomy of a buildlink3.mk
1.1 grant 430: file</a></span></dt>
431:
432: <dt><span class="sect2"><a href=
1.13 ! hubertf 433: "#id2568375">9.2.2. Updating
! 434: BUILDLINK_DEPENDS.pkg in buildlink3.mk
1.1 grant 435: files</a></span></dt>
436: </dl>
437: </dd>
438:
1.13 ! hubertf 439: <dt><span class="sect1"><a href="#id2568590">9.3.
! 440: Writing builtin.mk files</a></span></dt>
1.1 grant 441:
442: <dd>
443: <dl>
444: <dt><span class="sect2"><a href=
1.13 ! hubertf 445: "#id2568672">9.3.1. Anatomy of a builtin.mk
1.1 grant 446: file</a></span></dt>
447:
448: <dt><span class="sect2"><a href=
1.13 ! hubertf 449: "#id2568899">9.3.2. Global preferences for
1.1 grant 450: native or pkgsrc software</a></span></dt>
451: </dl>
452: </dd>
453: </dl>
454: </dd>
455:
456: <dt><span class="chapter"><a href="#options">10.
457: Options handling</a></span></dt>
458:
459: <dd>
460: <dl>
1.13 ! hubertf 461: <dt><span class="sect1"><a href="#id2568971">10.1.
1.1 grant 462: Global default options</a></span></dt>
463:
1.13 ! hubertf 464: <dt><span class="sect1"><a href="#id2568986">10.2.
! 465: Converting packages to use
! 466: bsd.options.mk</a></span></dt>
1.1 grant 467: </dl>
468: </dd>
469:
470: <dt><span class="chapter"><a href="#build">11. The
471: build process</a></span></dt>
472:
473: <dd>
474: <dl>
475: <dt><span class="sect1"><a href=
476: "#build.prefix">11.1. Program
477: location</a></span></dt>
478:
1.13 ! hubertf 479: <dt><span class="sect1"><a href="#id2569662">11.2.
1.1 grant 480: Main targets</a></span></dt>
481:
482: <dt><span class="sect1"><a href=
483: "#build.helpful-targets">11.3. Other helpful
484: targets</a></span></dt>
485: </dl>
486: </dd>
487:
488: <dt><span class="chapter"><a href="#fixes">12. Notes on
489: fixes for packages</a></span></dt>
490:
491: <dd>
492: <dl>
1.13 ! hubertf 493: <dt><span class="sect1"><a href="#id2571063">12.1.
1.1 grant 494: General operation</a></span></dt>
495:
496: <dd>
497: <dl>
498: <dt><span class="sect2"><a href=
1.13 ! hubertf 499: "#id2571066">12.1.1. How to pull in variables
1.1 grant 500: from /etc/mk.conf</a></span></dt>
501:
502: <dt><span class="sect2"><a href=
1.13 ! hubertf 503: "#id2571149">12.1.2. Restricted
1.1 grant 504: packages</a></span></dt>
505:
506: <dt><span class="sect2"><a href=
507: "#dependencies">12.1.3. Handling
508: dependencies</a></span></dt>
509:
510: <dt><span class="sect2"><a href=
1.13 ! hubertf 511: "#id2571733">12.1.4. Handling conflicts with
1.1 grant 512: other packages</a></span></dt>
513:
514: <dt><span class="sect2"><a href=
1.13 ! hubertf 515: "#id2571851">12.1.5. Packages that cannot or
1.1 grant 516: should not be built</a></span></dt>
517:
518: <dt><span class="sect2"><a href=
1.13 ! hubertf 519: "#id2571877">12.1.6. Packages which should not
1.1 grant 520: be deleted, once installed</a></span></dt>
521:
522: <dt><span class="sect2"><a href=
523: "#security-handling">12.1.7. Handling packages
524: with security problems</a></span></dt>
525:
526: <dt><span class="sect2"><a href=
1.13 ! hubertf 527: "#id2571969">12.1.8. How to handle compiler
1.1 grant 528: bugs</a></span></dt>
529:
530: <dt><span class="sect2"><a href=
1.13 ! hubertf 531: "#id2571991">12.1.9. How to handle incrementing
1.1 grant 532: versions when fixing an existing
533: package</a></span></dt>
534:
535: <dt><span class="sect2"><a href=
1.13 ! hubertf 536: "#id2572108">12.1.10. Portability of
1.1 grant 537: packages</a></span></dt>
538: </dl>
539: </dd>
540:
1.13 ! hubertf 541: <dt><span class="sect1"><a href="#id2572133">12.2.
1.1 grant 542: Possible downloading issues</a></span></dt>
543:
544: <dd>
545: <dl>
546: <dt><span class="sect2"><a href=
1.13 ! hubertf 547: "#id2572136">12.2.1. Packages whose distfiles
1.1 grant 548: aren't available for plain
549: downloading</a></span></dt>
550:
551: <dt><span class="sect2"><a href=
1.13 ! hubertf 552: "#id2572267">12.2.2. How to handle modified
1.1 grant 553: distfiles with the 'old' name</a></span></dt>
554: </dl>
555: </dd>
556:
1.13 ! hubertf 557: <dt><span class="sect1"><a href="#id2572279">12.3.
1.1 grant 558: Configuration gotchas</a></span></dt>
559:
560: <dd>
561: <dl>
562: <dt><span class="sect2"><a href=
563: "#fixes.libtool">12.3.1. Shared libraries -
564: libtool</a></span></dt>
565:
566: <dt><span class="sect2"><a href=
1.13 ! hubertf 567: "#id2572618">12.3.2. Using libtool on GNU
1.1 grant 568: packages that already support
569: libtool</a></span></dt>
570:
571: <dt><span class="sect2"><a href=
1.13 ! hubertf 572: "#id2572702">12.3.3. GNU
1.1 grant 573: Autoconf/Automake</a></span></dt>
574: </dl>
575: </dd>
576:
1.13 ! hubertf 577: <dt><span class="sect1"><a href="#id2572747">12.4.
1.1 grant 578: Building considerations</a></span></dt>
579:
580: <dd>
581: <dl>
582: <dt><span class="sect2"><a href=
1.13 ! hubertf 583: "#id2572750">12.4.1. CPP
1.1 grant 584: defines</a></span></dt>
585: </dl>
586: </dd>
587:
1.13 ! hubertf 588: <dt><span class="sect1"><a href="#id2572780">12.5.
1.1 grant 589: Package specific actions</a></span></dt>
590:
591: <dd>
592: <dl>
593: <dt><span class="sect2"><a href=
1.13 ! hubertf 594: "#id2572784">12.5.1. Package configuration
1.1 grant 595: files</a></span></dt>
596:
597: <dt><span class="sect2"><a href=
1.13 ! hubertf 598: "#id2573022">12.5.2. User
1.2 hubertf 599: interaction</a></span></dt>
1.1 grant 600:
601: <dt><span class="sect2"><a href=
1.13 ! hubertf 602: "#id2573136">12.5.3. Handling
1.1 grant 603: licenses</a></span></dt>
604:
605: <dt><span class="sect2"><a href=
1.13 ! hubertf 606: "#id2573287">12.5.4. Creating an account from a
1.1 grant 607: package</a></span></dt>
608:
609: <dt><span class="sect2"><a href=
1.13 ! hubertf 610: "#id2573349">12.5.5. Installing score
1.1 grant 611: files</a></span></dt>
612:
613: <dt><span class="sect2"><a href=
1.13 ! hubertf 614: "#id2573393">12.5.6. Packages providing login
1.1 grant 615: shells</a></span></dt>
616:
617: <dt><span class="sect2"><a href=
1.13 ! hubertf 618: "#id2573518">12.5.7. Packages containing perl
1.1 grant 619: scripts</a></span></dt>
620:
621: <dt><span class="sect2"><a href=
1.13 ! hubertf 622: "#id2573537">12.5.8. Packages with hardcoded
1.1 grant 623: paths to other interpreters</a></span></dt>
624:
625: <dt><span class="sect2"><a href=
1.13 ! hubertf 626: "#id2573558">12.5.9. Packages installing perl
1.1 grant 627: modules</a></span></dt>
628:
629: <dt><span class="sect2"><a href=
630: "#faq.info-files">12.5.10. Packages installing
631: info files</a></span></dt>
632:
633: <dt><span class="sect2"><a href=
1.13 ! hubertf 634: "#id2573778">12.5.11. Packages installing
1.1 grant 635: GConf2 data files</a></span></dt>
636:
637: <dt><span class="sect2"><a href=
1.13 ! hubertf 638: "#id2573946">12.5.12. Packages installing
1.1 grant 639: scrollkeeper data files</a></span></dt>
640:
641: <dt><span class="sect2"><a href=
1.13 ! hubertf 642: "#id2573997">12.5.13. Packages installing X11
1.1 grant 643: fonts</a></span></dt>
644:
645: <dt><span class="sect2"><a href=
1.13 ! hubertf 646: "#id2574044">12.5.14. Packages installing GTK2
1.1 grant 647: modules</a></span></dt>
648:
649: <dt><span class="sect2"><a href=
1.13 ! hubertf 650: "#id2574114">12.5.15. Packages installing SGML
1.1 grant 651: or XML data</a></span></dt>
652:
653: <dt><span class="sect2"><a href=
1.13 ! hubertf 654: "#id2574234">12.5.16. Packages installing
1.1 grant 655: extensions to the MIME database</a></span></dt>
656:
657: <dt><span class="sect2"><a href=
1.13 ! hubertf 658: "#id2574305">12.5.17. Packages using
1.1 grant 659: intltool</a></span></dt>
660: </dl>
661: </dd>
662:
1.13 ! hubertf 663: <dt><span class="sect1"><a href="#id2574318">12.6.
1.1 grant 664: Feedback to the author</a></span></dt>
665: </dl>
666: </dd>
667:
668: <dt><span class="chapter"><a href="#debug">13.
669: Debugging</a></span></dt>
670:
671: <dt><span class="chapter"><a href="#submit">14.
672: Submitting and Committing</a></span></dt>
673:
674: <dd>
675: <dl>
1.13 ! hubertf 676: <dt><span class="sect1"><a href="#id2574849">14.1.
1.1 grant 677: Submitting your packages</a></span></dt>
678:
1.13 ! hubertf 679: <dt><span class="sect1"><a href="#id2575036">14.2.
1.1 grant 680: Committing: Importing a package into
681: CVS</a></span></dt>
682:
1.13 ! hubertf 683: <dt><span class="sect1"><a href="#id2575168">14.3.
1.2 hubertf 684: Updating a package to a newer
685: version</a></span></dt>
1.1 grant 686:
1.13 ! hubertf 687: <dt><span class="sect1"><a href="#id2575187">14.4.
1.2 hubertf 688: Moving a package in pkgsrc</a></span></dt>
1.1 grant 689: </dl>
690: </dd>
691: </dl>
692: </dd>
693:
694: <dt><span class="appendix"><a href="#examples">A. A simple
695: example package: bison</a></span></dt>
696:
697: <dd>
698: <dl>
1.13 ! hubertf 699: <dt><span class="sect1"><a href="#id2575345">A.1.
1.1 grant 700: files</a></span></dt>
701:
702: <dd>
703: <dl>
1.13 ! hubertf 704: <dt><span class="sect2"><a href="#id2575348">A.1.1.
1.1 grant 705: Makefile</a></span></dt>
706:
1.13 ! hubertf 707: <dt><span class="sect2"><a href="#id2575355">A.1.2.
1.1 grant 708: DESCR</a></span></dt>
709:
1.13 ! hubertf 710: <dt><span class="sect2"><a href="#id2575370">A.1.3.
1.1 grant 711: PLIST</a></span></dt>
712:
1.13 ! hubertf 713: <dt><span class="sect2"><a href="#id2575378">A.1.4.
! 714: Checking a package with pkglint</a></span></dt>
1.1 grant 715: </dl>
716: </dd>
717:
1.13 ! hubertf 718: <dt><span class="sect1"><a href="#id2575418">A.2. Steps
1.1 grant 719: for building, installing, packaging</a></span></dt>
720: </dl>
721: </dd>
722:
723: <dt><span class="appendix"><a href="#logs">B. Build
724: logs</a></span></dt>
725:
726: <dd>
727: <dl>
728: <dt><span class="sect1"><a href="#logs.building">B.1.
729: Building figlet</a></span></dt>
730:
731: <dt><span class="sect1"><a href="#logs.package">B.2.
732: Packaging figlet</a></span></dt>
733: </dl>
734: </dd>
735:
736: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
737: of the FTP server's package archive</a></span></dt>
1.2 hubertf 738:
739: <dt><span class="appendix"><a href="#editing">D. Editing
740: guidelines for the pkgsrc guide</a></span></dt>
741:
742: <dd>
743: <dl>
1.13 ! hubertf 744: <dt><span class="sect1"><a href="#id2576133">D.1.
1.2 hubertf 745: Targets</a></span></dt>
746:
1.13 ! hubertf 747: <dt><span class="sect1"><a href="#id2576408">D.2.
1.2 hubertf 748: Procedure</a></span></dt>
749: </dl>
750: </dd>
1.1 grant 751: </dl>
752: </div>
753:
754: <div class="chapter" lang="en" xml:lang="en">
755: <div class="titlepage">
756: <div>
757: <div>
758: <h2 class="title"><a name="introduction" id=
759: "introduction"></a>Chapter 1. Introduction</h2>
760: </div>
761: </div>
762: </div>
763:
764: <div class="toc">
765: <p><b>Table of Contents</b></p>
766:
767: <dl>
1.13 ! hubertf 768: <dt><span class="sect1"><a href="#id2494406">1.1.
1.1 grant 769: Introduction</a></span></dt>
770:
771: <dt><span class="sect1"><a href="#overview">1.2.
772: Overview</a></span></dt>
773:
774: <dt><span class="sect1"><a href="#terminology">1.3.
775: Terminology</a></span></dt>
776:
777: <dt><span class="sect1"><a href="#typography">1.4.
778: Typography</a></span></dt>
779: </dl>
780: </div>
781:
782: <div class="sect1" lang="en" xml:lang="en">
783: <div class="titlepage">
784: <div>
785: <div>
786: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 787: "id2494406" id=
! 788: "id2494406"></a>1.1. Introduction</h2>
1.1 grant 789: </div>
790: </div>
791: </div>
792:
793: <p>There is a lot of software freely available for Unix
794: based systems, which usually runs on NetBSD and other
795: Unix-flavoured systems, too, sometimes with some
796: modifications. The NetBSD Packages Collection (pkgsrc)
797: incorporates any such changes necessary to make that
798: software run, and makes the installation (and
799: de-installation) of the software package easy by means of a
800: single command.</p>
801:
802: <p>Once the software has been built, it is manipulated with
1.13 ! hubertf 803: the <span><b class="command">pkg_*</b></span> tools so that
! 804: installation and de-installation, printing of an inventory
! 805: of all installed packages and retrieval of one-line
! 806: comments or more verbose descriptions are all simple.</p>
1.1 grant 807:
808: <p>pkgsrc currently contains several thousand packages,
809: including:</p>
810:
811: <div class="itemizedlist">
812: <ul type="disc">
813: <li>
814: <p><a xmlns=
815: "http://www.w3.org/TR/xhtml1/transitional" href=
816: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.13 ! hubertf 817: class="pkgname">www/apache</a> - The Apache web
! 818: server</p>
1.1 grant 819: </li>
820:
821: <li>
822: <p><a xmlns=
823: "http://www.w3.org/TR/xhtml1/transitional" href=
824: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.13 ! hubertf 825: class="pkgname">www/mozilla</a> - The Mozilla web
! 826: browser</p>
1.1 grant 827: </li>
828:
829: <li>
830: <p><a xmlns=
831: "http://www.w3.org/TR/xhtml1/transitional" href=
832: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.13 ! hubertf 833: class="pkgname">meta-pkgs/gnome</a> - The GNOME
! 834: Desktop Environment</p>
1.1 grant 835: </li>
836:
837: <li>
838: <p><a xmlns=
839: "http://www.w3.org/TR/xhtml1/transitional" href=
840: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.13 ! hubertf 841: class="pkgname">meta-pkgs/kde3</a> - The K Desktop
! 842: Environment</p>
1.1 grant 843: </li>
844: </ul>
845: </div>
846:
847: <p>...just to name a few.</p>
848:
849: <p>pkgsrc has built-in support for handling varying
850: dependencies, such as pthreads and X11, and extended
851: features such as IPv6 support on a range of platforms.</p>
852:
853: <p>pkgsrc was derived from FreeBSD's ports system, and
854: initially developed for NetBSD only. Since then, pkgsrc has
855: grown a lot, and now supports the following platforms:</p>
856:
857: <div class="itemizedlist">
858: <ul type="disc">
859: <li>
860: <p><a href="http://developer.apple.com/darwin/"
861: target="_top">Darwin</a> (<a href=
862: "http://www.apple.com/macosx/" target="_top">Mac OS
863: X</a>)</p>
864: </li>
865:
866: <li>
1.3 hubertf 867: <p><a href="http://www.DragonFlyBSD.org/" target=
868: "_top">DragonFlyBSD</a></p>
869: </li>
870:
871: <li>
1.1 grant 872: <p><a href="http://www.FreeBSD.org/" target=
873: "_top">FreeBSD</a></p>
874: </li>
875:
876: <li>
1.3 hubertf 877: <p>Microsoft Windows, via <a href=
878: "http://www.microsoft.com/windows/sfu/" target=
879: "_top">Interix</a></p>
1.1 grant 880: </li>
881:
882: <li>
883: <p><a href="http://www.sgi.com/software/irix6.5/"
884: target="_top">IRIX</a></p>
885: </li>
886:
887: <li>
888: <p><a href="http://www.linux.org/" target=
889: "_top">Linux</a></p>
890: </li>
891:
892: <li>
893: <p><a href="http://www.NetBSD.org/" target=
894: "_top">NetBSD</a> (of course)</p>
895: </li>
896:
897: <li>
898: <p><a href="http://www.openbsd.org/" target=
899: "_top">OpenBSD</a></p>
900: </li>
901:
902: <li>
903: <p><a href="http://www.sun.com/solaris/" target=
904: "_top">Solaris</a></p>
905: </li>
906: </ul>
907: </div>
908: </div>
909:
910: <div class="sect1" lang="en" xml:lang="en">
911: <div class="titlepage">
912: <div>
913: <div>
914: <h2 class="title" style="clear: both"><a name=
915: "overview" id="overview"></a>1.2. Overview</h2>
916: </div>
917: </div>
918: </div>
919:
920: <p>This document is divided into two parts. The first,
921: <a href="#users-guide" title=
1.2 hubertf 922: "Part I. The pkgsrc user's guide">The pkgsrc
923: user's guide</a>, describes how one can use one of the
924: packages in the Package Collection, either by installing a
925: precompiled binary package, or by building one's own copy
926: using the NetBSD package system. The second part, <a href=
1.1 grant 927: "#developers-guide" title=
1.2 hubertf 928: "Part II. The pkgsrc developer's guide">The
929: pkgsrc developer's guide</a>, explains how to prepare a
930: package so it can be easily built by other NetBSD users
931: without knowing about the package's building details.</p>
1.1 grant 932:
933: <p>This document is available in various formats:</p>
934:
935: <div class="itemizedlist">
936: <ul type="disc">
937: <li>
938: <p><a href="index.html" target="_top">HTML</a></p>
939: </li>
940:
941: <li>
942: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
943: </li>
944:
945: <li>
946: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
947: </li>
948:
949: <li>
950: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
951: </li>
952: </ul>
953: </div>
954: </div>
955:
956: <div class="sect1" lang="en" xml:lang="en">
957: <div class="titlepage">
958: <div>
959: <div>
960: <h2 class="title" style="clear: both"><a name=
961: "terminology" id=
962: "terminology"></a>1.3. Terminology</h2>
963: </div>
964: </div>
965: </div>
966:
967: <p>There has been a lot of talk about “<span class=
968: "quote">ports</span>”, “<span class=
969: "quote">packages</span>”, etc. so far. Here is a
970: description of all the terminology used within this
971: document.</p>
972:
973: <div class="variablelist">
974: <dl>
975: <dt><span class="term">Package</span></dt>
976:
977: <dd>
978: <p>A set of files and building instructions that
979: describe what's necessary to build a certain piece of
980: software using pkgsrc. Packages are traditionally
1.13 ! hubertf 981: stored under <tt class=
! 982: "filename">/usr/pkgsrc</tt>.</p>
1.1 grant 983: </dd>
984:
985: <dt><span class="term">The NetBSD package
986: system</span></dt>
987:
988: <dd>
989: <p>This is the former name of “<span class=
990: "quote">pkgsrc</span>”. It is part of the
991: NetBSD operating system and can be bootstrap to run
992: on non-NetBSD operating systems as well. It handles
993: building (compiling), installing, and removing of
994: packages.</p>
995: </dd>
996:
997: <dt><span class="term">Distfile</span></dt>
998:
999: <dd>
1000: <p>This term describes the file or files that are
1001: provided by the author of the piece of software to
1002: distribute his work. All the changes necessary to
1003: build on NetBSD are reflected in the corresponding
1004: package. Usually the distfile is in the form of a
1005: compressed tar-archive, but other types are possible,
1.13 ! hubertf 1006: too. Distfiles are usually stored below <tt class=
! 1007: "filename">/usr/pkgsrc/distfiles</tt>.</p>
1.1 grant 1008: </dd>
1009:
1010: <dt><span class="term">Port</span></dt>
1011:
1012: <dd>
1013: <p>This is the term used by FreeBSD and OpenBSD
1014: people for what we call a package. In NetBSD
1015: terminology, “<span class=
1016: "quote">port</span>” refers to a different
1017: architecture.</p>
1018: </dd>
1019:
1020: <dt><span class="term">Precompiled/binary
1021: package</span></dt>
1022:
1023: <dd>
1024: <p>A set of binaries built with pkgsrc from a
1.13 ! hubertf 1025: distfile and stuffed together in a single <tt class=
! 1026: "filename">.tgz</tt> file so it can be installed on
! 1027: machines of the same machine architecture without the
! 1028: need to recompile. Packages are usually generated in
! 1029: <tt class="filename">/usr/pkgsrc/packages</tt>; there
! 1030: is also an archive on <a href=
1.1 grant 1031: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1032: "_top">ftp.NetBSD.org</a>.</p>
1033:
1034: <p>Sometimes, this is referred to by the term
1035: “<span class="quote">package</span>” too,
1036: especially in the context of precompiled
1037: packages.</p>
1038: </dd>
1039:
1040: <dt><span class="term">Program</span></dt>
1041:
1042: <dd>
1043: <p>The piece of software to be installed which will
1044: be constructed from all the files in the Distfile by
1045: the actions defined in the corresponding package.</p>
1046: </dd>
1047: </dl>
1048: </div>
1049: </div>
1050:
1051: <div class="sect1" lang="en" xml:lang="en">
1052: <div class="titlepage">
1053: <div>
1054: <div>
1055: <h2 class="title" style="clear: both"><a name=
1056: "typography" id=
1057: "typography"></a>1.4. Typography</h2>
1058: </div>
1059: </div>
1060: </div>
1061:
1062: <p>When giving examples for commands, shell prompts are
1063: used to show if the command should/can be issued as root,
1064: or if “<span class="quote">normal</span>” user
1.13 ! hubertf 1065: privileges are sufficient. We use a <tt class=
! 1066: "prompt">#</tt> for root's shell prompt, and a <tt class=
! 1067: "prompt">$</tt> for users' shell prompt, assuming they use
! 1068: the C-shell or tcsh.</p>
1.1 grant 1069: </div>
1070: </div>
1071:
1072: <div class="part" lang="en" xml:lang="en">
1073: <div class="titlepage">
1074: <div>
1075: <div>
1076: <h1 class="title"><a name="users-guide" id=
1.2 hubertf 1077: "users-guide"></a>The pkgsrc user's guide</h1>
1.1 grant 1078: </div>
1079: </div>
1080: </div>
1081:
1082: <div class="toc">
1083: <p><b>Table of Contents</b></p>
1084:
1085: <dl>
1086: <dt><span class="chapter"><a href="#getting">2. Where to
1087: get pkgsrc</a></span></dt>
1088:
1089: <dd>
1090: <dl>
1.13 ! hubertf 1091: <dt><span class="sect1"><a href="#id2495052">2.1. As
1.1 grant 1092: tar file</a></span></dt>
1093:
1.13 ! hubertf 1094: <dt><span class="sect1"><a href="#id2495068">2.2. Via
1.1 grant 1095: SUP</a></span></dt>
1096:
1.13 ! hubertf 1097: <dt><span class="sect1"><a href="#id2495100">2.3. Via
1.1 grant 1098: CVS</a></span></dt>
1099: </dl>
1100: </dd>
1101:
1102: <dt><span class="chapter"><a href="#platforms">3. Using
1103: pkgsrc on systems other than NetBSD</a></span></dt>
1104:
1105: <dd>
1106: <dl>
1.13 ! hubertf 1107: <dt><span class="sect1"><a href="#id2495210">3.1.
1.1 grant 1108: Bootstrapping pkgsrc</a></span></dt>
1109:
1.13 ! hubertf 1110: <dt><span class="sect1"><a href="#id2495317">3.2.
1.1 grant 1111: Platform specific notes</a></span></dt>
1112:
1113: <dd>
1114: <dl>
1115: <dt><span class="sect2"><a href=
1.13 ! hubertf 1116: "#id2495323">3.2.1. Darwin (Mac OS
1.1 grant 1117: X)</a></span></dt>
1118:
1119: <dt><span class="sect2"><a href=
1.13 ! hubertf 1120: "#id2495622">3.2.2. FreeBSD</a></span></dt>
1.1 grant 1121:
1122: <dt><span class="sect2"><a href=
1.13 ! hubertf 1123: "#id2496270">3.2.3. Interix</a></span></dt>
1.1 grant 1124:
1125: <dt><span class="sect2"><a href=
1.13 ! hubertf 1126: "#id2496361">3.2.4. IRIX</a></span></dt>
1.1 grant 1127:
1128: <dt><span class="sect2"><a href=
1.13 ! hubertf 1129: "#id2496478">3.2.5. OpenBSD</a></span></dt>
1.1 grant 1130:
1131: <dt><span class="sect2"><a href=
1.13 ! hubertf 1132: "#id2496659">3.2.6. Solaris</a></span></dt>
1.1 grant 1133: </dl>
1134: </dd>
1135: </dl>
1136: </dd>
1137:
1138: <dt><span class="chapter"><a href="#using">4. Using
1139: pkgsrc</a></span></dt>
1140:
1141: <dd>
1142: <dl>
1143: <dt><span class="sect1"><a href=
1144: "#getting-started">4.1. Working with binary
1145: packages</a></span></dt>
1146:
1147: <dd>
1148: <dl>
1149: <dt><span class="sect2"><a href=
1.13 ! hubertf 1150: "#id2496864">4.1.1. Where to get binary
1.1 grant 1151: packages</a></span></dt>
1152:
1153: <dt><span class="sect2"><a href=
1.13 ! hubertf 1154: "#id2496904">4.1.2. How to use binary
1.1 grant 1155: packages</a></span></dt>
1156:
1157: <dt><span class="sect2"><a href=
1.13 ! hubertf 1158: "#id2497038">4.1.3. A word of
1.1 grant 1159: warning</a></span></dt>
1160: </dl>
1161: </dd>
1162:
1.13 ! hubertf 1163: <dt><span class="sect1"><a href="#id2497050">4.2.
1.1 grant 1164: Building packages from source</a></span></dt>
1165:
1166: <dd>
1167: <dl>
1168: <dt><span class="sect2"><a href=
1.13 ! hubertf 1169: "#id2497128">4.2.1. Requirements</a></span></dt>
1.1 grant 1170:
1171: <dt><span class="sect2"><a href=
1.13 ! hubertf 1172: "#id2497148">4.2.2. Fetching
1.1 grant 1173: distfiles</a></span></dt>
1174:
1175: <dt><span class="sect2"><a href=
1.13 ! hubertf 1176: "#id2497201">4.2.3. How to build and
1.1 grant 1177: install</a></span></dt>
1178:
1179: <dt><span class="sect2"><a href=
1.13 ! hubertf 1180: "#id2498132">4.2.4. Selecting the
1.1 grant 1181: compiler</a></span></dt>
1182: </dl>
1183: </dd>
1184: </dl>
1185: </dd>
1186:
1187: <dt><span class="chapter"><a href="#binary">5. Creating
1188: binary packages</a></span></dt>
1189:
1190: <dd>
1191: <dl>
1.13 ! hubertf 1192: <dt><span class="sect1"><a href="#id2563003">5.1.
1.1 grant 1193: Building a single binary package</a></span></dt>
1194:
1.13 ! hubertf 1195: <dt><span class="sect1"><a href="#id2563081">5.2.
1.1 grant 1196: Settings for creation of binary
1197: packages</a></span></dt>
1198:
1199: <dt><span class="sect1"><a href="#bulkbuild">5.3.
1200: Doing a bulk build of all packages</a></span></dt>
1201:
1202: <dd>
1203: <dl>
1204: <dt><span class="sect2"><a href=
1205: "#binary.configuration">5.3.1.
1206: Configuration</a></span></dt>
1207:
1208: <dt><span class="sect2"><a href=
1.13 ! hubertf 1209: "#id2563289">5.3.2. Other environmental
1.1 grant 1210: considerations</a></span></dt>
1211:
1212: <dt><span class="sect2"><a href=
1.13 ! hubertf 1213: "#id2563330">5.3.3. Operation</a></span></dt>
1.1 grant 1214:
1215: <dt><span class="sect2"><a href=
1.13 ! hubertf 1216: "#id2563467">5.3.4. What it does</a></span></dt>
1.1 grant 1217:
1218: <dt><span class="sect2"><a href=
1.13 ! hubertf 1219: "#id2563524">5.3.5. Disk space
1.1 grant 1220: requirements</a></span></dt>
1221:
1222: <dt><span class="sect2"><a href=
1.13 ! hubertf 1223: "#id2563550">5.3.6. Setting up a sandbox for
1.1 grant 1224: chroot'ed builds</a></span></dt>
1225:
1226: <dt><span class="sect2"><a href=
1.13 ! hubertf 1227: "#id2563943">5.3.7. Building a partial set of
1.1 grant 1228: packages</a></span></dt>
1.13 ! hubertf 1229:
! 1230: <dt><span class="sect2"><a href=
! 1231: "#bulk-upload">5.3.8. Uploading results of a bulk
! 1232: build</a></span></dt>
1.1 grant 1233: </dl>
1234: </dd>
1235:
1.13 ! hubertf 1236: <dt><span class="sect1"><a href="#id2564359">5.4.
1.1 grant 1237: Creating a multiple CD-ROM packages
1238: collection</a></span></dt>
1239:
1240: <dd>
1241: <dl>
1242: <dt><span class="sect2"><a href=
1.13 ! hubertf 1243: "#id2564442">5.4.1. Example of
1.1 grant 1244: cdpack</a></span></dt>
1245: </dl>
1246: </dd>
1247: </dl>
1248: </dd>
1249:
1250: <dt><span class="chapter"><a href="#faq">6. Frequently
1251: Asked Questions</a></span></dt>
1252:
1253: <dd>
1254: <dl>
1.13 ! hubertf 1255: <dt><span class="sect1"><a href="#id2564634">6.1. Is
1.1 grant 1256: there a mailing list for pkg-related
1257: discussion?</a></span></dt>
1258:
1.13 ! hubertf 1259: <dt><span class="sect1"><a href="#id2564801">6.2.
1.1 grant 1260: Where's the pkgviews documentation?</a></span></dt>
1261:
1.5 hubertf 1262: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 1263: Utilities for package management
1264: (pkgtools)</a></span></dt>
1265:
1.13 ! hubertf 1266: <dt><span class="sect1"><a href="#id2564985">6.4. How
1.1 grant 1267: to use pkgsrc as non-root</a></span></dt>
1268:
1.13 ! hubertf 1269: <dt><span class="sect1"><a href="#id2564997">6.5. How
1.1 grant 1270: can I install/use XFree86 from
1271: pkgsrc?</a></span></dt>
1272:
1.13 ! hubertf 1273: <dt><span class="sect1"><a href="#id2565025">6.6. How
1.1 grant 1274: can I install/use X.org from pkgsrc?</a></span></dt>
1275:
1.13 ! hubertf 1276: <dt><span class="sect1"><a href="#id2565121">6.7. How
1.1 grant 1277: to fetch files from behind a firewall</a></span></dt>
1278:
1.13 ! hubertf 1279: <dt><span class="sect1"><a href="#id2565134">6.8. How
! 1280: do I tell make fetch to do passive
1.1 grant 1281: FTP?</a></span></dt>
1282:
1.13 ! hubertf 1283: <dt><span class="sect1"><a href="#id2565186">6.9. How
1.1 grant 1284: to fetch all distfiles at once</a></span></dt>
1285:
1.13 ! hubertf 1286: <dt><span class="sect1"><a href="#id2565325">6.10.
! 1287: What does Don't know how to make
! 1288: /usr/share/tmac/tmac.andoc mean?</a></span></dt>
! 1289:
! 1290: <dt><span class="sect1"><a href="#id2565364">6.11.
! 1291: What does Could not find bsd.own.mk
1.7 wiz 1292: mean?</a></span></dt>
1.1 grant 1293:
1.13 ! hubertf 1294: <dt><span class="sect1"><a href="#id2565490">6.12.
1.1 grant 1295: Using 'sudo' with pkgsrc</a></span></dt>
1296:
1297: <dt><span class="sect1"><a href="#faq.conf">6.13.
1298: Configuration files handling and
1299: placement</a></span></dt>
1300:
1301: <dt><span class="sect1"><a href=
1302: "#audit-packages">6.14. Automated security
1303: checks</a></span></dt>
1304: </dl>
1305: </dd>
1306: </dl>
1307: </div>
1308:
1309: <div class="chapter" lang="en" xml:lang="en">
1310: <div class="titlepage">
1311: <div>
1312: <div>
1313: <h2 class="title"><a name="getting" id=
1314: "getting"></a>Chapter 2. Where to get
1315: pkgsrc</h2>
1316: </div>
1317: </div>
1318: </div>
1319:
1320: <div class="toc">
1321: <p><b>Table of Contents</b></p>
1322:
1323: <dl>
1.13 ! hubertf 1324: <dt><span class="sect1"><a href="#id2495052">2.1. As
1.1 grant 1325: tar file</a></span></dt>
1326:
1.13 ! hubertf 1327: <dt><span class="sect1"><a href="#id2495068">2.2. Via
1.1 grant 1328: SUP</a></span></dt>
1329:
1.13 ! hubertf 1330: <dt><span class="sect1"><a href="#id2495100">2.3. Via
1.1 grant 1331: CVS</a></span></dt>
1332: </dl>
1333: </div>
1334:
1335: <p>There are three ways to get pkgsrc. Either as a tar
1336: file, via SUP, or via CVS. All three ways are described
1337: here.</p>
1338:
1339: <div class="sect1" lang="en" xml:lang="en">
1340: <div class="titlepage">
1341: <div>
1342: <div>
1343: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 1344: "id2495052" id="id2495052"></a>2.1. As tar
1.1 grant 1345: file</h2>
1346: </div>
1347: </div>
1348: </div>
1349:
1350: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1351: file from <a href=
1.11 ben 1352: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.13 ! hubertf 1353: target="_top">ftp.NetBSD.org</a> and unpack it into
! 1354: <tt class="filename">/usr/pkgsrc</tt>.</p>
1.1 grant 1355: </div>
1356:
1357: <div class="sect1" lang="en" xml:lang="en">
1358: <div class="titlepage">
1359: <div>
1360: <div>
1361: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 1362: "id2495068" id="id2495068"></a>2.2. Via
1.1 grant 1363: SUP</h2>
1364: </div>
1365: </div>
1366: </div>
1367:
1368: <p>As an alternative to the tar file, you can get pkgsrc
1369: via the Software Update Protocol, SUP. To do so, make
1370: sure your supfile has a line</p>
1371: <pre class="programlisting">
1372: release=pkgsrc
1373: </pre>
1374:
1.13 ! hubertf 1375: <p>in it, see the examples in <tt class=
! 1376: "filename">/usr/share/examples/supfiles</tt>, and that
! 1377: the <tt class="filename">/usr/pkgsrc</tt> directory
! 1378: exists. Then, simply run <span><b class="command">sup -v
! 1379: <i class=
! 1380: "replaceable"><tt>/path/to/your/supfile</tt></i></b></span>.</p>
1.1 grant 1381: </div>
1382:
1383: <div class="sect1" lang="en" xml:lang="en">
1384: <div class="titlepage">
1385: <div>
1386: <div>
1387: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 1388: "id2495100" id="id2495100"></a>2.3. Via
1.1 grant 1389: CVS</h2>
1390: </div>
1391: </div>
1392: </div>
1393:
1394: <p>To get pkgsrc via CVS, make sure you have
1395: “<span class="quote">cvs</span>” installed.
1396: If not present on your system, it can be found as
1397: precompiled binary on ftp.NetBSD.org. To do an initial
1398: (full) checkout of pkgsrc, do the following steps:</p>
1399: <pre class="screen">
1.13 ! hubertf 1400: <tt class="prompt">%</tt> <b class=
! 1401: "userinput"><tt>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</tt></b>
! 1402: <tt class="prompt">%</tt> <b class=
! 1403: "userinput"><tt>setenv CVS_RSH ssh</tt></b>
! 1404: <tt class="prompt">%</tt> <b class="userinput"><tt>cd /usr</tt></b>
! 1405: <tt class="prompt">%</tt> <b class=
! 1406: "userinput"><tt>cvs checkout -P pkgsrc</tt></b>
! 1407: </pre>
! 1408:
! 1409: <p>This will create the <tt class="filename">pkgsrc</tt>
! 1410: directory in your <tt class="filename">/usr</tt>, and all
! 1411: the package source will be stored under <tt class=
! 1412: "filename">/usr/pkgsrc</tt>. To update pkgsrc after the
! 1413: initial checkout, make sure you have <tt class=
! 1414: "varname">CVS_RSH</tt> set as above, then do:</p>
1.1 grant 1415: <pre class="screen">
1.13 ! hubertf 1416: <tt class="prompt">%</tt> <b class=
! 1417: "userinput"><tt>cd /usr/pkgsrc</tt></b>
! 1418: <tt class="prompt">%</tt> <b class=
! 1419: "userinput"><tt>cvs -q update -dP</tt></b>
1.1 grant 1420: </pre>
1421:
1422: <p>Please also note that it is possible to have multiple
1423: copies of the pkgsrc hierarchy in use at any one time -
1424: all work is done relatively within the pkgsrc tree.</p>
1425: </div>
1426: </div>
1427:
1428: <div class="chapter" lang="en" xml:lang="en">
1429: <div class="titlepage">
1430: <div>
1431: <div>
1432: <h2 class="title"><a name="platforms" id=
1433: "platforms"></a>Chapter 3. Using pkgsrc on
1434: systems other than NetBSD</h2>
1435: </div>
1436: </div>
1437: </div>
1438:
1439: <div class="toc">
1440: <p><b>Table of Contents</b></p>
1441:
1442: <dl>
1.13 ! hubertf 1443: <dt><span class="sect1"><a href="#id2495210">3.1.
1.1 grant 1444: Bootstrapping pkgsrc</a></span></dt>
1445:
1.13 ! hubertf 1446: <dt><span class="sect1"><a href="#id2495317">3.2.
1.1 grant 1447: Platform specific notes</a></span></dt>
1448:
1449: <dd>
1450: <dl>
1.13 ! hubertf 1451: <dt><span class="sect2"><a href="#id2495323">3.2.1.
1.1 grant 1452: Darwin (Mac OS X)</a></span></dt>
1453:
1.13 ! hubertf 1454: <dt><span class="sect2"><a href="#id2495622">3.2.2.
1.1 grant 1455: FreeBSD</a></span></dt>
1456:
1.13 ! hubertf 1457: <dt><span class="sect2"><a href="#id2496270">3.2.3.
1.1 grant 1458: Interix</a></span></dt>
1459:
1.13 ! hubertf 1460: <dt><span class="sect2"><a href="#id2496361">3.2.4.
1.1 grant 1461: IRIX</a></span></dt>
1462:
1.13 ! hubertf 1463: <dt><span class="sect2"><a href="#id2496478">3.2.5.
1.1 grant 1464: OpenBSD</a></span></dt>
1465:
1.13 ! hubertf 1466: <dt><span class="sect2"><a href="#id2496659">3.2.6.
1.1 grant 1467: Solaris</a></span></dt>
1468: </dl>
1469: </dd>
1470: </dl>
1471: </div>
1472:
1473: <div class="sect1" lang="en" xml:lang="en">
1474: <div class="titlepage">
1475: <div>
1476: <div>
1477: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 1478: "id2495210" id=
! 1479: "id2495210"></a>3.1. Bootstrapping pkgsrc</h2>
1.1 grant 1480: </div>
1481: </div>
1482: </div>
1483:
1484: <p>For Operating Systems other than NetBSD, we provide a
1485: bootstrap kit to build the required tools to use pkgsrc
1486: on your platform. Besides support for native NetBSD,
1487: pkgsrc and the bootstrap kit have support for the
1488: following operating systems:</p>
1489:
1490: <div class="itemizedlist">
1491: <ul type="disc">
1492: <li>
1493: <p>Darwin (Mac OS X)</p>
1494: </li>
1495:
1496: <li>
1497: <p>FreeBSD</p>
1498: </li>
1499:
1500: <li>
1501: <p>Interix (Windows 2000, XP, 2003)</p>
1502: </li>
1503:
1504: <li>
1505: <p>IRIX</p>
1506: </li>
1507:
1508: <li>
1509: <p>Linux</p>
1510: </li>
1511:
1512: <li>
1513: <p>OpenBSD</p>
1514: </li>
1515:
1516: <li>
1517: <p>Solaris</p>
1518: </li>
1519: </ul>
1520: </div>
1521:
1522: <p>Support for other platforms is under development.</p>
1523:
1524: <p>Installing the bootstrap kit should be as simple
1525: as:</p>
1526: <pre class="screen">
1.13 ! hubertf 1527: <tt class="prompt">#</tt> <b class=
! 1528: "userinput"><tt>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</tt></b>
! 1529: <tt class="prompt">#</tt> <b class=
! 1530: "userinput"><tt>cd pkgsrc/bootstrap</tt></b>
! 1531: <tt class="prompt">#</tt> <b class=
! 1532: "userinput"><tt>./bootstrap</tt></b>
1.1 grant 1533: </pre>
1534:
1535: <p>See <a href="#getting" title=
1536: "Chapter 2. Where to get pkgsrc">Chapter 2,
1537: <i>Where to get pkgsrc</i></a> for other ways to get
1.13 ! hubertf 1538: pkgsrc before bootstrapping. The given <span><b class=
! 1539: "command">bootstrap</b></span> command will use the
! 1540: defaults of <tt class="filename">/usr/pkg</tt> for the
! 1541: <span class="emphasis"><em>prefix</em></span> where
! 1542: programs will be installed in, and <tt class=
! 1543: "filename">/var/db/pkg</tt> for the package database
1.1 grant 1544: directory where pkgsrc will do it's internal bookkeeping.
1545: However, these can also be set using command-line
1546: parameters.</p>
1547:
1548: <p>Binary packages for the pkgsrc tools and an initial
1549: set of packages is available for supported platforms. An
1550: up-to-date list of these can be found on <a href=
1551: "http://www.pkgsrc.org/" target=
1552: "_top">www.pkgsrc.org</a>.</p>
1553: </div>
1554:
1555: <div class="sect1" lang="en" xml:lang="en">
1556: <div class="titlepage">
1557: <div>
1558: <div>
1559: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 1560: "id2495317" id="id2495317"></a>3.2. Platform
1.1 grant 1561: specific notes</h2>
1562: </div>
1563: </div>
1564: </div>
1565:
1566: <p>Here are some platform-specific notes you should be
1567: aware of.</p>
1568:
1569: <div class="sect2" lang="en" xml:lang="en">
1570: <div class="titlepage">
1571: <div>
1572: <div>
1.13 ! hubertf 1573: <h3 class="title"><a name="id2495323" id=
! 1574: "id2495323"></a>3.2.1. Darwin (Mac OS
1.1 grant 1575: X)</h3>
1576: </div>
1577: </div>
1578: </div>
1579:
1580: <p>Darwin 5.x and 6.x are supported. There are two
1581: methods of using pkgsrc on Mac OS X, by using a
1582: <a href="#platform.osx-image" title=
1583: "3.2.1.1. Using a disk image">disk image</a>, or a
1584: <a href="#platform.osx-ufs" title=
1585: "3.2.1.2. Using a UFS partition">UFS
1586: partition</a>.</p>
1587:
1588: <p>Before you start, you will need to download and
1589: install the Mac OS X Developer Tools from Apple's
1590: Developer Connection. See <a href=
1591: "http://developer.apple.com/macosx/" target=
1592: "_top">http://developer.apple.com/macosx/</a> for
1593: details. Also, make sure you install X11 for Mac OS X
1594: and the X11 SDK from <a href=
1595: "http://www.apple.com/macosx/x11/download/" target=
1596: "_top">http://www.apple.com/macosx/x11/download/</a> if
1597: you intend to build packages that use the X11 Window
1598: System.</p>
1599:
1600: <p>If you already have a UFS partition, or have a spare
1601: partition that you can format as UFS, it is recommended
1602: to use that instead of the disk image. It'll be
1603: somewhat faster and will mount automatically at boot
1604: time, where you must manually mount a disk image.</p>
1605:
1606: <div class="note" style=
1607: "margin-left: 0.5in; margin-right: 0.5in;">
1608: <h3 class="title">Note</h3>
1609:
1610: <p>You cannot use a HFS+ file system for pkgsrc,
1611: because pkgsrc currently requires the filesystem to
1612: be case-sensitive, and HFS+ is not.</p>
1613: </div>
1614:
1615: <div class="sect3" lang="en" xml:lang="en">
1616: <div class="titlepage">
1617: <div>
1618: <div>
1619: <h4 class="title"><a name="platform.osx-image"
1620: id="platform.osx-image"></a>3.2.1.1. Using
1621: a disk image</h4>
1622: </div>
1623: </div>
1624: </div>
1625:
1626: <p>Create the disk image:</p>
1627: <pre class="screen">
1.13 ! hubertf 1628: <tt class="prompt">#</tt> <b class=
! 1629: "userinput"><tt>cd pkgsrc/bootstrap</tt></b>
! 1630: <tt class="prompt">#</tt> <b class=
! 1631: "userinput"><tt>./ufsdiskimage create ~/Documents/NetBSD 512</tt></b> # megabytes - season to taste
! 1632: <tt class="prompt">#</tt> <b class=
! 1633: "userinput"><tt>./ufsdiskimage mount ~/Documents/NetBSD</tt></b>
! 1634: <tt class="prompt">#</tt> <b class=
! 1635: "userinput"><tt>sudo chown `id -u`:`id -g` /Volumes/NetBSD</tt></b>
1.1 grant 1636: </pre>
1637:
1638: <p>That's it!</p>
1639: </div>
1640:
1641: <div class="sect3" lang="en" xml:lang="en">
1642: <div class="titlepage">
1643: <div>
1644: <div>
1645: <h4 class="title"><a name="platform.osx-ufs"
1646: id="platform.osx-ufs"></a>3.2.1.2. Using a
1647: UFS partition</h4>
1648: </div>
1649: </div>
1650: </div>
1651:
1.13 ! hubertf 1652: <p>By default, <tt class="filename">/usr</tt> will be
! 1653: on your root file system, normally HFS+. It is
! 1654: possible to use the default <span class=
! 1655: "emphasis"><em>prefix</em></span> of <tt class=
! 1656: "filename">/usr/pkg</tt> by symlinking <tt class=
! 1657: "filename">/usr/pkg</tt> to a directory on a UFS file
! 1658: system. Obviously, another symlink is required if you
! 1659: want to place the package database directory outside
! 1660: the <span class="emphasis"><em>prefix</em></span>.
! 1661: e.g.</p>
1.1 grant 1662: <pre class="screen">
1.13 ! hubertf 1663: <tt class="prompt">#</tt> <b class=
! 1664: "userinput"><tt>./bootstrap --pkgdbdir=/usr/pkg/pkgdb --pkgsrcdir=/Volumes/ufs/pkgsrc</tt></b>
1.1 grant 1665: </pre>
1666:
1667: <p>If you created your partitions at the time of
1668: installing Mac OS X and formatted the target
1669: partition as UFS, it should automatically mount on
1.13 ! hubertf 1670: <tt class="filename">/Volumes/<volume
! 1671: name></tt> when the machine boots. If you are
1.1 grant 1672: (re)formatting a partition as UFS, you need to ensure
1673: that the partition map correctly reflects
1674: “<span class="quote">Apple_UFS</span>”
1675: and not “<span class=
1676: "quote">Apple_HFS</span>”.</p>
1677:
1678: <p>The problem is that none of the disk tools will
1679: let you touch a disk that is booted from. You can
1680: unmount the partition, but even if you newfs it, the
1681: partition type will be incorrect and the automounter
1682: won't mount it. It can be mounted manually, but it
1683: won't appear in Finder.</p>
1684:
1685: <p>You'll need to boot off of the OS X Installation
1686: (User) CD. When the Installation program starts, go
1687: up to the menu and select Disk Utility. Now, you will
1688: be able to select the partition you want to be UFS,
1689: and Format it Apple UFS. Quit the Disk Utility, quit
1690: the installer which will reboot your machine. The new
1691: UFS file system will appear in Finder.</p>
1692:
1693: <p>Be aware that the permissions on the new file
1694: system will be writable by root only.</p>
1695:
1696: <p>This note is as of 10.2 (Jaguar) and applies to
1697: earlier versions. Hopefully Apple will fix Disk
1698: Utility in 10.3 (Panther).</p>
1699: </div>
1700: </div>
1701:
1702: <div class="sect2" lang="en" xml:lang="en">
1703: <div class="titlepage">
1704: <div>
1705: <div>
1.13 ! hubertf 1706: <h3 class="title"><a name="id2495622" id=
! 1707: "id2495622"></a>3.2.2. FreeBSD</h3>
1.1 grant 1708: </div>
1709: </div>
1710: </div>
1711:
1712: <p>FreeBSD 4.7 and 5.0 have been tested and are
1713: supported, other versions may work.</p>
1714:
1715: <p>Care should be taken so that the tools that this kit
1716: installs do not conflict with the FreeBSD userland
1717: tools. There are several steps:</p>
1718:
1719: <div class="orderedlist">
1720: <ol type="1">
1721: <li>
1722: <p>FreeBSD stores its ports pkg database in
1.13 ! hubertf 1723: <tt class="filename">/var/db/pkg</tt>. It is
1.1 grant 1724: therefore recommended that you choose a different
1.13 ! hubertf 1725: location (e.g. <tt class=
! 1726: "filename">/usr/pkgdb</tt>) by using the
1.1 grant 1727: --pkgdbdir option to the bootstrap script.</p>
1728: </li>
1729:
1730: <li>
1731: <p>If you do not intend to use the FreeBSD ports
1732: tools, it's probably a good idea to move them out
1733: of the way to avoid confusion, e.g.</p>
1734: <pre class="screen">
1.13 ! hubertf 1735: <tt class="prompt">#</tt> <b class=
! 1736: "userinput"><tt>cd /usr/sbin</tt></b>
! 1737: <tt class="prompt">#</tt> <b class=
! 1738: "userinput"><tt>mv pkg_add pkg_add.orig</tt></b>
! 1739: <tt class="prompt">#</tt> <b class=
! 1740: "userinput"><tt>mv pkg_create pkg_create.orig</tt></b>
! 1741: <tt class="prompt">#</tt> <b class=
! 1742: "userinput"><tt>mv pkg_delete pkg_delete.orig</tt></b>
! 1743: <tt class="prompt">#</tt> <b class=
! 1744: "userinput"><tt>mv pkg_info pkg_info.orig</tt></b>
1.1 grant 1745: </pre>
1746: </li>
1747:
1748: <li>
1.13 ! hubertf 1749: <p>An example <tt class=
! 1750: "filename">/etc/mk.conf</tt> file will be placed
! 1751: in <tt class="filename">/etc/mk.conf.example</tt>
! 1752: file when you use the bootstrap script.</p>
1.1 grant 1753: </li>
1754: </ol>
1755: </div>
1756: </div>
1757:
1758: <div class="sect2" lang="en" xml:lang="en">
1759: <div class="titlepage">
1760: <div>
1761: <div>
1.13 ! hubertf 1762: <h3 class="title"><a name="id2496270" id=
! 1763: "id2496270"></a>3.2.3. Interix</h3>
1.1 grant 1764: </div>
1765: </div>
1766: </div>
1767:
1768: <p>Interix is a POSIX compatible subsystem for the
1769: Windows NT kernel, providing a Unix-like environment
1770: with a tighter kernel integration than available with
1771: Cygwin. It is part of the Windows Services for Unix
1772: package, available for free for any licensed copy of
1773: Windows 2000, XP, or 2003. SFU can be downloaded from
1774: <a href="http://www.microsoft.com/windows/sfu/" target=
1775: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
1776:
1777: <p>Services for Unix 3.5, current as of this writing,
1778: has been tested. 3.0 or 3.1 may work, but are not
1779: officially supported. (The main difference in 3.0/3.1
1780: is lack of pthreads.)</p>
1781:
1782: <div class="sect3" lang="en" xml:lang="en">
1783: <div class="titlepage">
1784: <div>
1785: <div>
1786: <h4 class="title"><a name=
1787: "platform.interix-sfu-install" id=
1788: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 1789: installing Interix/SFU</h4>
1.1 grant 1790: </div>
1791: </div>
1792: </div>
1793:
1794: <p>At an absolute minimum, the following packages
1795: must be installed from the Windows Services for Unix
1796: 3.5 distribution in order to use pkgsrc:</p>
1797:
1798: <div class="itemizedlist">
1799: <ul type="disc">
1800: <li>
1801: <p>Utilities -> Base Utilities</p>
1802: </li>
1803:
1804: <li>
1805: <p>Interix GNU Components -> (all)</p>
1806: </li>
1807:
1808: <li>
1809: <p>Remote Connectivity</p>
1810: </li>
1811:
1812: <li>
1813: <p>Interix SDK</p>
1814: </li>
1815: </ul>
1816: </div>
1817:
1818: <p>When using pkgsrc on Interix, DO NOT install the
1819: Utilities subcomponent "UNIX Perl". That is Perl 5.6
1820: without shared module support, installed to
1821: /usr/local, and will only cause confusion. Instead,
1822: install Perl 5.8 from pkgsrc (or from a binary
1823: package).</p>
1824:
1825: <p>The Remote Connectivity subcomponent "Windows
1826: Remote Shell Service" does not need to be installed,
1827: but Remote Connectivity itself should be installed in
1828: order to have a working inetd.</p>
1829:
1830: <p>Finally, during installation you may be asked
1831: whether to enable setuid behavior for Interix
1832: programs, and whether to make pathnames default to
1833: case-sensitive. Setuid should be enabled, and
1834: case-sensitivity MUST be enabled. (Without
1835: case-sensitivity, a large number of packages
1836: including perl will not build.)</p>
1837: </div>
1838:
1839: <div class="sect3" lang="en" xml:lang="en">
1840: <div class="titlepage">
1841: <div>
1842: <div>
1843: <h4 class="title"><a name=
1844: "platform.interix-sfu-postinstall" id=
1845: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
1846: to do if Interix/SFU is already installed</h4>
1847: </div>
1848: </div>
1849: </div>
1850:
1851: <p>If SFU is already installed and you wish to alter
1852: these settings to work with pkgsrc, note the
1853: following things.</p>
1854:
1855: <div class="itemizedlist">
1856: <ul type="disc">
1857: <li>
1858: <p>To uninstall UNIX Perl, use Add/Remove
1859: Programs, select Microsoft Windows Services for
1860: UNIX, then click Change. In the installer,
1861: choose Add or Remove, then uncheck
1862: Utilities->UNIX Perl.</p>
1863: </li>
1864:
1865: <li>
1866: <p>To enable case-sensitivity for the
1867: filesystem, run REGEDIT.EXE, and change the
1868: following registry key:</p>
1869:
1870: <p>
1871: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
1872: Manager\kernel</p>
1873:
1874: <p>Set the DWORD value "obcaseinsensitive" to
1875: 0; then reboot.</p>
1876: </li>
1877:
1878: <li>
1879: <p>To enable setuid binaries (optional), run
1880: REGEDIT.EXE, and change the following registry
1881: key:</p>
1882:
1883: <p>
1884: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
1885: for UNIX</p>
1886:
1887: <p>Set the DWORD value "EnableSetuidBinaries"
1888: to 1; then reboot.</p>
1889: </li>
1890: </ul>
1891: </div>
1892: </div>
1893:
1894: <div class="sect3" lang="en" xml:lang="en">
1895: <div class="titlepage">
1896: <div>
1897: <div>
1898: <h4 class="title"><a name=
1899: "platform.interix-notes" id=
1900: "platform.interix-notes"></a>3.2.3.3. Important
1901: notes for using pkgsrc</h4>
1902: </div>
1903: </div>
1904: </div>
1905:
1906: <p>The package imanager (either the pkgsrc "su" user,
1907: or the user running "pkg_add") must be a member of
1908: the local Administrators group. Such a user must also
1909: be used to run the bootstrap. This is slightly
1910: relaxed from the normal pkgsrc requirement of
1911: "root".</p>
1912:
1913: <p>The package manager should use a umask of 002.
1914: "make install" will automatically complain if this is
1915: not the case. This ensures that directories written
1916: in /var/db/pkg are Administrators-group
1917: writeable.</p>
1918:
1919: <p>The popular Interix binary packages from
1920: http://www.interopsystems.com/ use an older version
1921: of pkgsrc's pkg_* tools. Ideally, these should NOT be
1922: used in conjunction with pkgsrc. If you choose to use
1923: them at the same time as the pkgsrc packages, ensure
1924: that you use the proper pkg_* tools for each type of
1925: binary package.</p>
1926: </div>
1927: </div>
1928:
1929: <div class="sect2" lang="en" xml:lang="en">
1930: <div class="titlepage">
1931: <div>
1932: <div>
1.13 ! hubertf 1933: <h3 class="title"><a name="id2496361" id=
! 1934: "id2496361"></a>3.2.4. IRIX</h3>
1.1 grant 1935: </div>
1936: </div>
1937: </div>
1938:
1939: <p>You will need a working C compiler, either gcc or
1940: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.13 ! hubertf 1941: the <tt class="varname">CC</tt> environment variable
! 1942: according to your preference. If you do not have a
! 1943: license for the MIPSpro compiler suite, you can
1.1 grant 1944: download a gcc tardist file from <a href=
1945: "http://freeware.sgi.com/" target=
1946: "_top">http://freeware.sgi.com/</a>.</p>
1947:
1948: <p>Please note that you will need IRIX 6.5.17 or
1949: higher, as this is the earliest version of IRIX
1950: providing support for if_indextoname(3),
1951: if_nametoindex(3), etc.</p>
1952:
1953: <p>At this point in time, pkgsrc only supports one ABI.
1954: That is, you can not switch between the old 32-bit ABI,
1955: the new 32-bit ABI and the 64-bit ABI. If you start out
1956: using "abi=n32", that's what all your packages will be
1957: built with.</p>
1958:
1959: <p>Therefore, please make sure that you have no
1.13 ! hubertf 1960: conflicting <tt class="varname">CFLAGS</tt> in your
! 1961: environment or the <tt class=
! 1962: "filename">/etc/mk.conf</tt>. Particularly, make sure
1.1 grant 1963: that you do not try to link n32 object files with lib64
1.13 ! hubertf 1964: or vice versa. Check your <tt class=
! 1965: "filename">/etc/compiler.defaults</tt>!</p>
1.1 grant 1966:
1967: <p>If you have the actual pkgsrc tree mounted via NFS
1968: from a different host, please make sure to set
1.13 ! hubertf 1969: <tt class="varname">WRKOBJDIR</tt> to a local
1.1 grant 1970: directory, as it appears that IRIX linker occasionally
1971: runs into issues when trying to link over a network
1972: mounted filesystem.</p>
1973:
1974: <p>The bootstrapping process should set all the right
1975: options for programs such as imake(1), but you may want
1976: to set some options depending on your local setup.
1.13 ! hubertf 1977: Please see <tt class=
! 1978: "filename">pkgsrc/mk/defaults/mk.conf</tt> and, of
1.1 grant 1979: course, your compilers man pages for details.</p>
1980: </div>
1981:
1982: <div class="sect2" lang="en" xml:lang="en">
1983: <div class="titlepage">
1984: <div>
1985: <div>
1.13 ! hubertf 1986: <h3 class="title"><a name="id2496478" id=
! 1987: "id2496478"></a>3.2.5. OpenBSD</h3>
1.1 grant 1988: </div>
1989: </div>
1990: </div>
1991:
1992: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
1993:
1994: <p>Care should be taken so that the tools that this kit
1995: installs do not conflict with the OpenBSD userland
1996: tools. There are several steps:</p>
1997:
1998: <div class="orderedlist">
1999: <ol type="1">
2000: <li>
2001: <p>OpenBSD stores its ports pkg database in
1.13 ! hubertf 2002: <tt class="filename">/var/db/pkg</tt>. It is
1.1 grant 2003: therefore recommended that you choose a different
1.13 ! hubertf 2004: location (e.g. <tt class=
! 2005: "filename">/usr/pkgdb</tt>) by using the
1.1 grant 2006: --pkgdbdir option to the bootstrap script.</p>
2007: </li>
2008:
2009: <li>
2010: <p>If you do not intend to use the OpenBSD ports
2011: tools, it's probably a good idea to move them out
2012: of the way to avoid confusion, e.g.</p>
2013: <pre class="screen">
1.13 ! hubertf 2014: <tt class="prompt">#</tt> <b class=
! 2015: "userinput"><tt>cd /usr/sbin</tt></b>
! 2016: <tt class="prompt">#</tt> <b class=
! 2017: "userinput"><tt>mv pkg_add pkg_add.orig</tt></b>
! 2018: <tt class="prompt">#</tt> <b class=
! 2019: "userinput"><tt>mv pkg_create pkg_create.orig</tt></b>
! 2020: <tt class="prompt">#</tt> <b class=
! 2021: "userinput"><tt>mv pkg_delete pkg_delete.orig</tt></b>
! 2022: <tt class="prompt">#</tt> <b class=
! 2023: "userinput"><tt>mv pkg_info pkg_info.orig</tt></b>
1.1 grant 2024: </pre>
2025: </li>
2026:
2027: <li>
1.13 ! hubertf 2028: <p>An example <tt class=
! 2029: "filename">/etc/mk.conf</tt> file will be placed
! 2030: in <tt class="filename">/etc/mk.conf.example</tt>
! 2031: file when you use the bootstrap script. OpenBSD's
! 2032: make program uses <tt class=
! 2033: "filename">/etc/mk.conf</tt> as well. You can
1.1 grant 2034: work around this by enclosing all the pkgsrc
2035: specific parts of the file with:</p>
2036: <pre class="programlisting">
2037: .ifdef BSD_PKG_MK
1.11 ben 2038: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1 grant 2039: .else
2040: # OpenBSD stuff
2041: .endif
2042: </pre>
2043: </li>
2044: </ol>
2045: </div>
2046: </div>
2047:
2048: <div class="sect2" lang="en" xml:lang="en">
2049: <div class="titlepage">
2050: <div>
2051: <div>
1.13 ! hubertf 2052: <h3 class="title"><a name="id2496659" id=
! 2053: "id2496659"></a>3.2.6. Solaris</h3>
1.1 grant 2054: </div>
2055: </div>
2056: </div>
2057:
2058: <p>Solaris 2.6 through 9 are supported on both x86 and
2059: sparc. You will need a working C compiler. Both gcc
2060: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2061:
2062: <p>The following packages are required on Solaris 8 for
2063: the bootstrap process and to build packages.</p>
2064:
2065: <div class="itemizedlist">
2066: <ul type="disc">
2067: <li>
2068: <p>SUNWsprot</p>
2069: </li>
2070:
2071: <li>
2072: <p>SUNWarc</p>
2073: </li>
2074:
2075: <li>
2076: <p>SUNWbtool</p>
2077: </li>
2078:
2079: <li>
2080: <p>SUNWtoo</p>
2081: </li>
2082:
2083: <li>
2084: <p>SUNWlibm</p>
2085: </li>
2086: </ul>
2087: </div>
2088:
2089: <p>Please note the use of GNU binutils on Solaris is
2090: <span class="emphasis"><em>not</em></span>
2091: supported.</p>
2092:
2093: <div class="sect3" lang="en" xml:lang="en">
2094: <div class="titlepage">
2095: <div>
2096: <div>
1.13 ! hubertf 2097: <h4 class="title"><a name="id2496690" id=
! 2098: "id2496690"></a>3.2.6.1. If you are using
1.1 grant 2099: gcc</h4>
2100: </div>
2101: </div>
2102: </div>
2103:
2104: <p>It makes life much simpler if you only use the
2105: same gcc consistently for building all packages.</p>
2106:
2107: <p>It is recommended that an external gcc be used
2108: only for bootstrapping, then either build gcc from
2109: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2110: href=
2111: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.13 ! hubertf 2112: class="pkgname">lang/gcc</a> or install a binary
! 2113: gcc package, then remove gcc used during
! 2114: bootstrapping.</p>
1.1 grant 2115:
2116: <p>Binary packages of gcc can be found through
2117: <a href=
2118: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.13 ! hubertf 2119: target=
! 2120: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2121: </div>
2122:
2123: <div class="sect3" lang="en" xml:lang="en">
2124: <div class="titlepage">
2125: <div>
2126: <div>
1.13 ! hubertf 2127: <h4 class="title"><a name="id2496711" id=
! 2128: "id2496711"></a>3.2.6.2. If you are using
1.1 grant 2129: Sun WorkShop</h4>
2130: </div>
2131: </div>
2132: </div>
2133:
2134: <p>You will need at least the following packages
2135: installed (from WorkShop 5.0)</p>
2136:
2137: <div class="itemizedlist">
2138: <ul type="disc">
2139: <li>
2140: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2141: </li>
2142:
2143: <li>
2144: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2145: </li>
2146:
2147: <li>
2148: <p>SPROild - Sun WorkShop Incremental
2149: Linker</p>
2150: </li>
2151:
2152: <li>
2153: <p>SPROlang - Sun WorkShop Compilers common
2154: components</p>
2155: </li>
2156: </ul>
2157: </div>
2158:
1.13 ! hubertf 2159: <p>You should set <tt class="varname">CC</tt>,
! 2160: <tt class="varname">CXX</tt> and optionally,
! 2161: <tt class="varname">CPP</tt> in <tt class=
! 2162: "filename">/etc/mk.conf</tt>, eg.</p>
1.1 grant 2163: <pre class="programlisting">
2164: CC= cc
2165: CXX= CC
2166: CPP= /usr/ccs/lib/cpp
2167: </pre>
2168:
2169: <p>You may also want to build 64-bit binaries,
2170: eg.</p>
2171: <pre class="programlisting">
2172: CFLAGS= -xtarget=ultra -xarch=v9
2173: </pre>
2174:
2175: <p>Whichever compiler you use, please ensure the
2176: compiler tools and your $prefix are in your
1.13 ! hubertf 2177: <tt class="varname">PATH</tt>. This includes
! 2178: <tt class="filename">/usr/ccs/{bin,lib}</tt> and eg.
! 2179: <tt class="filename">/usr/pkg/{bin,sbin}</tt>.</p>
1.1 grant 2180: </div>
2181: </div>
2182: </div>
2183: </div>
2184:
2185: <div class="chapter" lang="en" xml:lang="en">
2186: <div class="titlepage">
2187: <div>
2188: <div>
2189: <h2 class="title"><a name="using" id=
2190: "using"></a>Chapter 4. Using pkgsrc</h2>
2191: </div>
2192: </div>
2193: </div>
2194:
2195: <div class="toc">
2196: <p><b>Table of Contents</b></p>
2197:
2198: <dl>
2199: <dt><span class="sect1"><a href="#getting-started">4.1.
2200: Working with binary packages</a></span></dt>
2201:
2202: <dd>
2203: <dl>
1.13 ! hubertf 2204: <dt><span class="sect2"><a href="#id2496864">4.1.1.
1.1 grant 2205: Where to get binary packages</a></span></dt>
2206:
1.13 ! hubertf 2207: <dt><span class="sect2"><a href="#id2496904">4.1.2.
1.1 grant 2208: How to use binary packages</a></span></dt>
2209:
1.13 ! hubertf 2210: <dt><span class="sect2"><a href="#id2497038">4.1.3.
1.1 grant 2211: A word of warning</a></span></dt>
2212: </dl>
2213: </dd>
2214:
1.13 ! hubertf 2215: <dt><span class="sect1"><a href="#id2497050">4.2.
1.1 grant 2216: Building packages from source</a></span></dt>
2217:
2218: <dd>
2219: <dl>
1.13 ! hubertf 2220: <dt><span class="sect2"><a href="#id2497128">4.2.1.
1.1 grant 2221: Requirements</a></span></dt>
2222:
1.13 ! hubertf 2223: <dt><span class="sect2"><a href="#id2497148">4.2.2.
1.1 grant 2224: Fetching distfiles</a></span></dt>
2225:
1.13 ! hubertf 2226: <dt><span class="sect2"><a href="#id2497201">4.2.3.
1.1 grant 2227: How to build and install</a></span></dt>
2228:
1.13 ! hubertf 2229: <dt><span class="sect2"><a href="#id2498132">4.2.4.
1.1 grant 2230: Selecting the compiler</a></span></dt>
2231: </dl>
2232: </dd>
2233: </dl>
2234: </div>
2235:
2236: <div class="sect1" lang="en" xml:lang="en">
2237: <div class="titlepage">
2238: <div>
2239: <div>
2240: <h2 class="title" style="clear: both"><a name=
2241: "getting-started" id=
2242: "getting-started"></a>4.1. Working with binary
2243: packages</h2>
2244: </div>
2245: </div>
2246: </div>
2247:
2248: <p>This section describes how to find, retrieve and
2249: install a precompiled binary package that someone else
2250: already prepared for your type of machine.</p>
2251:
2252: <div class="sect2" lang="en" xml:lang="en">
2253: <div class="titlepage">
2254: <div>
2255: <div>
1.13 ! hubertf 2256: <h3 class="title"><a name="id2496864" id=
! 2257: "id2496864"></a>4.1.1. Where to get binary
1.1 grant 2258: packages</h3>
2259: </div>
2260: </div>
2261: </div>
2262:
2263: <p>Precompiled packages are stored on ftp.NetBSD.org
1.13 ! hubertf 2264: and its mirrors in the directory <tt class=
! 2265: "filename">/pub/NetBSD/packages</tt> for anonymous FTP
! 2266: access. Please pick the right subdirectory there as
! 2267: indicated by <span><b class="command">uname
! 2268: -p</b></span>. In that directory, there is a
1.1 grant 2269: subdirectory for each category plus a subdirectory
1.13 ! hubertf 2270: <tt class="filename">All</tt> which includes the actual
! 2271: binaries in <tt class="filename">.tgz</tt> files. The
! 2272: category subdirectories use symbolic links to those
! 2273: files (this is the same directory layout as in
! 2274: <tt class="filename">/usr/pkgsrc/packages</tt>).</p>
1.1 grant 2275:
2276: <p>This same directory layout applies for CDROM
2277: distributions, only that the directory may be rooted
1.13 ! hubertf 2278: somewhere else, probably somewhere below <tt class=
! 2279: "filename">/cdrom</tt>. Please consult your CDROMs
1.1 grant 2280: documentation for the exact location.</p>
2281: </div>
2282:
2283: <div class="sect2" lang="en" xml:lang="en">
2284: <div class="titlepage">
2285: <div>
2286: <div>
1.13 ! hubertf 2287: <h3 class="title"><a name="id2496904" id=
! 2288: "id2496904"></a>4.1.2. How to use binary
1.1 grant 2289: packages</h3>
2290: </div>
2291: </div>
2292: </div>
2293:
2294: <p>If you have the files on a CDROM or downloaded them
2295: to your hard disk, youcan install them with the
1.13 ! hubertf 2296: following command (be sure to<span><b class=
! 2297: "command">su</b></span> to root first):</p>
1.1 grant 2298: <pre class="screen">
1.13 ! hubertf 2299: <tt class="prompt">#</tt> <b class=
! 2300: "userinput"><tt>pkg_add /path/to/package.tgz</tt></b>
1.1 grant 2301: </pre>
2302:
2303: <p>If you have FTP access and you don't want to
2304: download the packages via FTP prior to installation,
1.13 ! hubertf 2305: you can do this automatically by giving <span><b class=
! 2306: "command">pkg_add</b></span> an FTP URL:</p>
1.1 grant 2307: <pre class="screen">
1.13 ! hubertf 2308: <tt class="prompt">#</tt> <b class=
! 2309: "userinput"><tt>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSvers>/<arch>/All/package.tgz</tt></b>
1.1 grant 2310: </pre>
2311:
2312: <p>If there is any doubt, the uname utility can be used
2313: to determine the <OSvers>, and <arch> by
1.13 ! hubertf 2314: running <span><b class="command">uname
! 2315: -rp</b></span>.</p>
1.1 grant 2316:
2317: <p>Also note that any prerequisite packages needed to
2318: run the package in question will be installed, too,
2319: assuming they are present where you install from.</p>
2320:
2321: <p>After you've installed packages, be sure to have
1.13 ! hubertf 2322: <tt class="filename">/usr/pkg/bin</tt> in your
! 2323: <tt class="varname">PATH</tt> so you can actually start
! 2324: the just installed program.</p>
1.1 grant 2325: </div>
2326:
2327: <div class="sect2" lang="en" xml:lang="en">
2328: <div class="titlepage">
2329: <div>
2330: <div>
1.13 ! hubertf 2331: <h3 class="title"><a name="id2497038" id=
! 2332: "id2497038"></a>4.1.3. A word of
1.1 grant 2333: warning</h3>
2334: </div>
2335: </div>
2336: </div>
2337:
2338: <p>Please pay very careful attention to the warnings
2339: expressed in the <a href=
2340: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2341: <span class="citerefentry"><span class=
2342: "refentrytitle">pkg_add</span>(1)</span></a> manual
2343: page about the inherent dangers of installing binary
2344: packages which you did not create yourself, and the
2345: security holes that can be introduced onto your system
2346: by indiscriminate adding of such files.</p>
2347: </div>
2348: </div>
2349:
2350: <div class="sect1" lang="en" xml:lang="en">
2351: <div class="titlepage">
2352: <div>
2353: <div>
2354: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 2355: "id2497050" id="id2497050"></a>4.2. Building
1.1 grant 2356: packages from source</h2>
2357: </div>
2358: </div>
2359: </div>
2360:
2361: <p>This assumes that the package is already in pkgsrc. If
2362: it is not, see <a href="#developers-guide" title=
1.2 hubertf 2363: "Part II. The pkgsrc developer's guide">Part II,
2364: “The pkgsrc developer's guide”</a>.</p>
1.1 grant 2365:
2366: <div class="sect2" lang="en" xml:lang="en">
2367: <div class="titlepage">
2368: <div>
2369: <div>
1.13 ! hubertf 2370: <h3 class="title"><a name="id2497128" id=
! 2371: "id2497128"></a>4.2.1. Requirements</h3>
1.1 grant 2372: </div>
2373: </div>
2374: </div>
2375:
2376: <p>To build packages from source on a NetBSD system the
2377: “<span class="quote">comp</span>” and the
2378: “<span class="quote">text</span>”
2379: distribution sets must be installed. If you want to
2380: build X11 related packages the “<span class=
2381: "quote">xbase</span>” and “<span class=
2382: "quote">xcomp</span>” distribution sets are
2383: required, too.</p>
2384: </div>
2385:
2386: <div class="sect2" lang="en" xml:lang="en">
2387: <div class="titlepage">
2388: <div>
2389: <div>
1.13 ! hubertf 2390: <h3 class="title"><a name="id2497148" id=
! 2391: "id2497148"></a>4.2.2. Fetching
1.1 grant 2392: distfiles</h3>
2393: </div>
2394: </div>
2395: </div>
2396:
2397: <p>The distfile (i.e. the unmodified source) must exist
2398: on your system for the packages system to be able to
2399: build it. If it does not exist, pkgsrc will use
2400: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
2401: <span class="citerefentry"><span class=
2402: "refentrytitle">ftp</span>(1)</span></a> to fetch it
2403: automatically.</p>
2404:
2405: <p>You can overwrite some of the major distribution
2406: sites to fit to sites that are close to your own. Have
1.13 ! hubertf 2407: a look at <tt class=
! 2408: "filename">pkgsrc/mk/defaults/mk.conf</tt> to find some
! 2409: examples - in particular, look for the <tt class=
! 2410: "varname">MASTER_SORT</tt>, <tt class=
! 2411: "varname">MASTER_SORT_REGEX</tt> and <tt class=
! 2412: "varname">INET_COUNTRY</tt> definitions. This may save
! 2413: some of your bandwidth and time.</p>
1.1 grant 2414:
2415: <p>You can change these settings either in your shell's
2416: environment, or, if you want to keep the settings, by
1.13 ! hubertf 2417: editing the <tt class="filename">/etc/mk.conf</tt>
1.1 grant 2418: file, and adding the definitions there.</p>
2419:
2420: <p>If you don't have a permanent Internet connection
2421: and you want to know which files to download,
1.13 ! hubertf 2422: <span><b class="command">make fetch-list</b></span>
! 2423: will tell you what you'll need. Put these distfiles
! 2424: into <tt class=
! 2425: "filename">/usr/pkgsrc/distfiles</tt>.</p>
1.1 grant 2426: </div>
2427:
2428: <div class="sect2" lang="en" xml:lang="en">
2429: <div class="titlepage">
2430: <div>
2431: <div>
1.13 ! hubertf 2432: <h3 class="title"><a name="id2497201" id=
! 2433: "id2497201"></a>4.2.3. How to build and
1.1 grant 2434: install</h3>
2435: </div>
2436: </div>
2437: </div>
2438:
2439: <p>Assuming that the distfile has been fetched (see
2440: previous section), become root and change into the
1.13 ! hubertf 2441: relevant directory and running <span><b class=
! 2442: "command">make</b></span>. For example, type</p>
1.1 grant 2443: <pre class="screen">
1.13 ! hubertf 2444: <tt class="prompt">%</tt> <b class=
! 2445: "userinput"><tt>cd misc/figlet</tt></b>
! 2446: <tt class="prompt">%</tt> <b class="userinput"><tt>make</tt></b>
1.1 grant 2447: </pre>
2448:
2449: <p>at the shell prompt to build the various components
2450: of the package, and</p>
2451: <pre class="screen">
1.13 ! hubertf 2452: <tt class="prompt">#</tt> <b class=
! 2453: "userinput"><tt>make install</tt></b>
1.1 grant 2454: </pre>
2455:
2456: <p>to install the various components into the correct
2457: places on your system. Installing the package on your
2458: system requires you to be root. However, pkgsrc has a
2459: <span class="emphasis"><em>just-in-time-su</em></span>
2460: feature, which allows you to only become root for the
2461: actual installation step</p>
2462:
2463: <p>Taking the figlet utility as an example, we can
2464: install it on our system by building as shown in
2465: <a href="#logs" title=
2466: "Appendix B. Build logs">Appendix B, <i>Build
2467: logs</i></a>.</p>
2468:
2469: <p>The program is installed under the default root of
1.13 ! hubertf 2470: the packages tree - <tt class="filename">/usr/pkg</tt>.
! 2471: Should this not conform to your tastes, set the
! 2472: <tt class="varname">LOCALBASE</tt> variable in your
1.1 grant 2473: environment, and it will use that value as the root of
1.13 ! hubertf 2474: your packages tree. So, to use <tt class=
! 2475: "filename">/usr/local</tt>, set <tt class=
! 2476: "varname">LOCALBASE=/usr/local</tt> in your
1.1 grant 2477: environment. Please note that you should use a
2478: directory which is dedicated to packages and not shared
1.13 ! hubertf 2479: with other programs (ie, do not try and use <tt class=
! 2480: "varname">LOCALBASE=/usr</tt>). Also, you should not
! 2481: try to add any of your own files or directories (such
! 2482: as <tt class="filename">src/</tt>, <tt class=
! 2483: "filename">obj/</tt>, or <tt class=
! 2484: "filename">pkgsrc/</tt>) below the <tt class=
! 2485: "varname">LOCALBASE</tt> tree. This is to prevent
1.1 grant 2486: possible conflicts between programs and other files
2487: installed by the package system and whatever else may
2488: have been installed there.</p>
2489:
1.13 ! hubertf 2490: <p>Some packages look in <tt class=
! 2491: "filename">/etc/mk.conf</tt> to alter some
1.1 grant 2492: configuration options at build time. Have a look at
1.13 ! hubertf 2493: <tt class="filename">pkgsrc/mk/defaults/mk.conf</tt> to
! 2494: get an overview of what will be set there by default.
! 2495: Environment variables such as <tt class=
! 2496: "varname">LOCALBASE</tt> can be set in <tt class=
! 2497: "filename">/etc/mk.conf</tt> to save having to remember
! 2498: to set them each time you want to use pkgsrc.</p>
1.1 grant 2499:
2500: <p>Occasionally, people want to “<span class=
2501: "quote">look under the covers</span>” to see what
2502: is going on when a package is building or being
2503: installed. This may be for debugging purposes, or out
2504: of simple curiosity. A number of utility values have
2505: been added to help with this.</p>
2506:
2507: <div class="orderedlist">
2508: <ol type="1">
2509: <li>
2510: <p>If you invoke the <a href=
2511: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2512: <span class="citerefentry"><span class=
2513: "refentrytitle">make</span>(1)</span></a> command
1.13 ! hubertf 2514: with <tt class="varname">PKG_DEBUG_LEVEL=2</tt>,
! 2515: then a huge amount of information will be
! 2516: displayed. For example,</p>
1.1 grant 2517: <pre class="screen">
1.13 ! hubertf 2518: <b class="userinput"><tt>make patch PKG_DEBUG_LEVEL=2</tt></b>
1.1 grant 2519: </pre>
2520:
2521: <p>will show all the commands that are invoked,
2522: up to and including the “<span class=
2523: "quote">patch</span>” stage.</p>
2524: </li>
2525:
2526: <li>
2527: <p>If you want to know the value of a certain
1.13 ! hubertf 2528: make(1) definition, then the <tt class=
! 2529: "varname">VARNAME</tt> definition should be used,
! 2530: in conjunction with the show-var target. e.g. to
! 2531: show the expansion of the <a href=
1.1 grant 2532: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2533: <span class="citerefentry"><span class=
2534: "refentrytitle">make</span>(1)</span></a>
1.13 ! hubertf 2535: variable <tt class="varname">DISTFILES</tt>:</p>
1.1 grant 2536: <pre class="screen">
1.13 ! hubertf 2537: <tt class="prompt">%</tt> <b class=
! 2538: "userinput"><tt>make show-var VARNAME=LOCALBASE</tt></b>
1.1 grant 2539: /usr/pkg
1.13 ! hubertf 2540: <tt class="prompt">%</tt>
1.1 grant 2541:
2542: </pre>
2543: </li>
2544: </ol>
2545: </div>
2546:
2547: <p>If you want to install a binary package that you've
2548: either created yourself (see next section), that you
2549: put into pkgsrc/packages manually or that is located on
1.8 wiz 2550: a remote FTP server, you can use the "bin-install"
1.1 grant 2551: target. This target will install a binary package - if
2552: available - via <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>, else do a
1.13 ! hubertf 2556: <span><b class="command">make package</b></span>. The
! 2557: list of remote FTP sites searched is kept in the
! 2558: variable <tt class="varname">BINPKG_SITES</tt>, which
! 2559: defaults to ftp.NetBSD.org. Any flags that should be
! 2560: added to <a href=
1.1 grant 2561: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2562: <span class="citerefentry"><span class=
2563: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.13 ! hubertf 2564: into <tt class="varname">BIN_INSTALL_FLAGS</tt>. See
! 2565: <tt class="filename">pkgsrc/mk/defaults/mk.conf</tt>
! 2566: for more details.</p>
1.1 grant 2567:
2568: <p>A final word of warning: If you setup a system that
1.13 ! hubertf 2569: has a non-standard setting for <tt class=
! 2570: "varname">LOCALBASE</tt>, be sure to set that before
1.1 grant 2571: any packages are installed, as you can not use several
2572: directories for the same purpose. Doing so will result
2573: in pkgsrc not being able to properly detect your
2574: installed packages, and fail miserably. Note also that
2575: precompiled binary packages are usually built with the
1.13 ! hubertf 2576: default <tt class="varname">LOCALBASE</tt> of
! 2577: <tt class="filename">/usr/pkg</tt>, and that you should
! 2578: <span class="emphasis"><em>not</em></span> install any
! 2579: if you use a non-standard <tt class=
! 2580: "varname">LOCALBASE</tt>.</p>
1.1 grant 2581: </div>
2582:
2583: <div class="sect2" lang="en" xml:lang="en">
2584: <div class="titlepage">
2585: <div>
2586: <div>
1.13 ! hubertf 2587: <h3 class="title"><a name="id2498132" id=
! 2588: "id2498132"></a>4.2.4. Selecting the
1.1 grant 2589: compiler</h3>
2590: </div>
2591: </div>
2592: </div>
2593:
2594: <p>By default, pkgsrc will use GCC to build packages.
2595: This may be overridden by setting the following
2596: variables in /etc/mk.conf:</p>
2597:
2598: <div class="variablelist">
2599: <dl>
1.13 ! hubertf 2600: <dt><span class="term"><tt class=
! 2601: "varname">PKGSRC_COMPILER</tt>:</span></dt>
1.1 grant 2602:
2603: <dd>
2604: <p>This is a list of values specifying the chain
2605: of compilers to invoke when building packages.
2606: Valid values are:</p>
2607:
2608: <div class="itemizedlist">
2609: <ul type="disc">
2610: <li>
1.13 ! hubertf 2611: <p><tt class="varname">distcc</tt>:
1.1 grant 2612: distributed C/C++ (chainable)</p>
2613: </li>
2614:
2615: <li>
1.13 ! hubertf 2616: <p><tt class="varname">ccache</tt>:
1.1 grant 2617: compiler cache (chainable)</p>
2618: </li>
2619:
2620: <li>
1.13 ! hubertf 2621: <p><tt class="varname">gcc</tt>: GNU C/C++
! 2622: Compiler</p>
1.1 grant 2623: </li>
2624:
2625: <li>
1.13 ! hubertf 2626: <p><tt class="varname">mipspro</tt>:
1.1 grant 2627: Silicon Graphics, Inc. MIPSpro
2628: (n32/n64)</p>
2629: </li>
2630:
2631: <li>
1.13 ! hubertf 2632: <p><tt class="varname">mipspro</tt>:
1.1 grant 2633: Silicon Graphics, Inc. MIPSpro (o32)</p>
2634: </li>
2635:
2636: <li>
1.13 ! hubertf 2637: <p><tt class="varname">sunpro</tt>:
1.1 grant 2638: Microsystems, Inc. WorkShip/Forte/Sun ONE
2639: Studio</p>
2640: </li>
2641: </ul>
2642: </div>
2643:
2644: <p>The default is “<span class=
1.13 ! hubertf 2645: "quote"><tt class=
! 2646: "varname">gcc</tt></span>”. You can use
! 2647: <tt class="varname">ccache</tt> and/or <tt class=
! 2648: "varname">distcc</tt> with an appropriate
! 2649: <tt class="varname">PKGSRC_COMPILER</tt> setting,
! 2650: e.g. “<span class="quote"><tt class=
! 2651: "varname">ccache gcc</tt></span>”. This
1.1 grant 2652: variable should always be terminated with a value
2653: for a real compiler.</p>
2654: </dd>
2655:
1.13 ! hubertf 2656: <dt><span class="term"><tt class=
! 2657: "varname">GCC_REQD</tt>:</span></dt>
1.1 grant 2658:
2659: <dd>
2660: <p>This specifies the minimum version of GCC to
2661: use when building packages. If the system GCC
2662: doesn't satisfy this requirement, then pkgsrc
2663: will build and install one of the GCC packages to
2664: use instead.</p>
2665: </dd>
2666: </dl>
2667: </div>
2668: </div>
2669: </div>
2670: </div>
2671:
2672: <div class="chapter" lang="en" xml:lang="en">
2673: <div class="titlepage">
2674: <div>
2675: <div>
2676: <h2 class="title"><a name="binary" id=
2677: "binary"></a>Chapter 5. Creating binary
2678: packages</h2>
2679: </div>
2680: </div>
2681: </div>
2682:
2683: <div class="toc">
2684: <p><b>Table of Contents</b></p>
2685:
2686: <dl>
1.13 ! hubertf 2687: <dt><span class="sect1"><a href="#id2563003">5.1.
1.1 grant 2688: Building a single binary package</a></span></dt>
2689:
1.13 ! hubertf 2690: <dt><span class="sect1"><a href="#id2563081">5.2.
1.1 grant 2691: Settings for creation of binary
2692: packages</a></span></dt>
2693:
2694: <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
2695: a bulk build of all packages</a></span></dt>
2696:
2697: <dd>
2698: <dl>
2699: <dt><span class="sect2"><a href=
2700: "#binary.configuration">5.3.1.
2701: Configuration</a></span></dt>
2702:
1.13 ! hubertf 2703: <dt><span class="sect2"><a href="#id2563289">5.3.2.
1.1 grant 2704: Other environmental considerations</a></span></dt>
2705:
1.13 ! hubertf 2706: <dt><span class="sect2"><a href="#id2563330">5.3.3.
1.1 grant 2707: Operation</a></span></dt>
2708:
1.13 ! hubertf 2709: <dt><span class="sect2"><a href="#id2563467">5.3.4.
1.1 grant 2710: What it does</a></span></dt>
2711:
1.13 ! hubertf 2712: <dt><span class="sect2"><a href="#id2563524">5.3.5.
1.1 grant 2713: Disk space requirements</a></span></dt>
2714:
1.13 ! hubertf 2715: <dt><span class="sect2"><a href="#id2563550">5.3.6.
1.1 grant 2716: Setting up a sandbox for chroot'ed
2717: builds</a></span></dt>
2718:
1.13 ! hubertf 2719: <dt><span class="sect2"><a href="#id2563943">5.3.7.
1.1 grant 2720: Building a partial set of packages</a></span></dt>
1.13 ! hubertf 2721:
! 2722: <dt><span class="sect2"><a href=
! 2723: "#bulk-upload">5.3.8. Uploading results of a bulk
! 2724: build</a></span></dt>
1.1 grant 2725: </dl>
2726: </dd>
2727:
1.13 ! hubertf 2728: <dt><span class="sect1"><a href="#id2564359">5.4.
1.1 grant 2729: Creating a multiple CD-ROM packages
2730: collection</a></span></dt>
2731:
2732: <dd>
2733: <dl>
1.13 ! hubertf 2734: <dt><span class="sect2"><a href="#id2564442">5.4.1.
1.1 grant 2735: Example of cdpack</a></span></dt>
2736: </dl>
2737: </dd>
2738: </dl>
2739: </div>
2740:
2741: <div class="sect1" lang="en" xml:lang="en">
2742: <div class="titlepage">
2743: <div>
2744: <div>
2745: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 2746: "id2563003" id="id2563003"></a>5.1. Building a
1.1 grant 2747: single binary package</h2>
2748: </div>
2749: </div>
2750: </div>
2751:
2752: <p>Once you have built and installed a package, you can
2753: create a <span class="emphasis"><em>binary
2754: package</em></span> which can be installed on another
2755: system with <a href=
2756: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2757: <span class="citerefentry"><span class=
2758: "refentrytitle">pkg_add</span>(1)</span></a> This saves
2759: having to build the same package on a group of hosts and
2760: wasting CPU time. It also provides a simple means for
2761: others to install your package, should you distribute
2762: it.</p>
2763:
2764: <p>To create a binary package, change into the
1.13 ! hubertf 2765: appropriate directory in pkgsrc, and run <span><b class=
! 2766: "command">make package</b></span>:</p>
1.1 grant 2767: <pre class="screen">
1.13 ! hubertf 2768: <tt class="prompt">#</tt> <b class=
! 2769: "userinput"><tt>cd misc/figlet</tt></b>
! 2770: <tt class="prompt">#</tt> <b class=
! 2771: "userinput"><tt>make package</tt></b>
1.1 grant 2772: </pre>
2773:
2774: <p>This will build and install your package (if not
2775: already done), and then build a binary package from what
1.13 ! hubertf 2776: was installed. You can then use the <span><b class=
! 2777: "command">pkg_*</b></span> tools to manipulate it. Binary
! 2778: packages are created by default in <tt class=
! 2779: "filename">/usr/pkgsrc/packages</tt>, in the form of a
1.1 grant 2780: gzipped tar file. See <a href="#logs.package" title=
2781: "B.2. Packaging figlet">Section B.2,
2782: “Packaging figlet”</a> for a continuation of
2783: the above <a xmlns=
2784: "http://www.w3.org/TR/xhtml1/transitional" href=
2785: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.13 ! hubertf 2786: class="pkgname">misc/figlet</a> example.</p>
1.1 grant 2787:
2788: <p>See <a href="#submit" title=
2789: "Chapter 14. Submitting and Committing">Chapter
2790: 14, <i>Submitting and Committing</i></a> for information
2791: on how to submit such a binary package.</p>
2792: </div>
2793:
2794: <div class="sect1" lang="en" xml:lang="en">
2795: <div class="titlepage">
2796: <div>
2797: <div>
2798: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 2799: "id2563081" id="id2563081"></a>5.2. Settings
1.1 grant 2800: for creation of binary packages</h2>
2801: </div>
2802: </div>
2803: </div>
2804:
2805: <p>See <a href="#build.helpful-targets" title=
2806: "11.3. Other helpful targets">Section 11.3,
2807: “Other helpful targets”</a>.</p>
2808: </div>
2809:
2810: <div class="sect1" lang="en" xml:lang="en">
2811: <div class="titlepage">
2812: <div>
2813: <div>
2814: <h2 class="title" style="clear: both"><a name=
2815: "bulkbuild" id="bulkbuild"></a>5.3. Doing a
2816: bulk build of all packages</h2>
2817: </div>
2818: </div>
2819: </div>
2820:
2821: <p>If you want to get a full set of precompiled binary
2822: packages, this section describes how to get them. Beware
2823: that the bulk build will remove all currently installed
2824: packages from your system! Having a FTP server configured
2825: either on the machine doing the bulk builds or on a
2826: nearby NFS server can help to make the packages available
2827: to everyone. See <a href=
2828: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
2829: <span class="citerefentry"><span class=
2830: "refentrytitle">ftpd</span>(8)</span></a> for more
2831: information. If you use a remote NFS server's storage, be
2832: sure to not actually compile on NFS storage, as this
2833: slows things down a lot.</p>
2834:
2835: <div class="sect2" lang="en" xml:lang="en">
2836: <div class="titlepage">
2837: <div>
2838: <div>
2839: <h3 class="title"><a name="binary.configuration"
2840: id=
2841: "binary.configuration"></a>5.3.1. Configuration</h3>
2842: </div>
2843: </div>
2844: </div>
2845:
2846: <div class="sect3" lang="en" xml:lang="en">
2847: <div class="titlepage">
2848: <div>
2849: <div>
2850: <h4 class="title"><a name="binary.mk.conf" id=
2851: "binary.mk.conf"></a>5.3.1.1. /etc/mk.conf</h4>
2852: </div>
2853: </div>
2854: </div>
2855:
1.13 ! hubertf 2856: <p>You may want to set things in <tt class=
! 2857: "filename">/etc/mk.conf</tt>. Look at <tt class=
! 2858: "filename">pkgsrc/mk/defaults/mk.conf</tt> for
1.1 grant 2859: details of the default settings. You will want to
1.13 ! hubertf 2860: ensure that <tt class=
! 2861: "varname">ACCEPTABLE_LICENSES</tt> meet your local
! 2862: policy. As used in this example, <tt class=
! 2863: "varname">_ACCEPTABLE=yes</tt> accepts <span class=
1.1 grant 2864: "emphasis"><em>all</em></span> licenses.</p>
2865: <pre class="programlisting">
2866: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
2867: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
2868: BSDSRCDIR= /usr/src
2869: BSDXSRCDIR= /usr/xsrc # for x11/xservers
2870: OBJHOSTNAME?= yes # use work.`hostname`
2871: FAILOVER_FETCH= yes # insist on the correct checksum
2872: PKG_DEVELOPER?= yes
2873: _ACCEPTABLE= yes
2874: </pre>
2875: </div>
2876:
2877: <div class="sect3" lang="en" xml:lang="en">
2878: <div class="titlepage">
2879: <div>
2880: <div>
1.13 ! hubertf 2881: <h4 class="title"><a name="id2563145" id=
! 2882: "id2563145"></a>5.3.1.2. <tt class=
! 2883: "filename">build.conf</tt></h4>
1.1 grant 2884: </div>
2885: </div>
2886: </div>
2887:
1.13 ! hubertf 2888: <p>In <tt class="filename">pkgsrc/mk/bulk</tt>, copy
! 2889: <tt class="filename">build.conf-example</tt> to
! 2890: <tt class="filename">build.conf</tt> and edit it,
! 2891: following the comments in that file. This is the
1.1 grant 2892: config file that determines where log files are
2893: generated after the build, where to mail the build
2894: report to, where your pkgsrc tree is located and
2895: which user to <a href=
2896: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
2897: <span class="citerefentry"><span class=
2898: "refentrytitle">su</span>(8)</span></a> to to do a
1.13 ! hubertf 2899: <span><b class="command">cvs update</b></span>.</p>
1.1 grant 2900: </div>
2901:
2902: <div class="sect3" lang="en" xml:lang="en">
2903: <div class="titlepage">
2904: <div>
2905: <div>
1.13 ! hubertf 2906: <h4 class="title"><a name="id2563181" id=
! 2907: "id2563181"></a>5.3.1.3. <tt class=
! 2908: "filename">pre-build.local</tt></h4>
1.1 grant 2909: </div>
2910: </div>
2911: </div>
2912:
2913: <p>It is possible to configure the bulk build to
2914: perform certain site specific tasks at the end of the
1.13 ! hubertf 2915: pre-build stage. If the file <tt class=
! 2916: "filename">pre-build.local</tt> exists in <tt class=
! 2917: "filename">/usr/pkgsrc/mk/bulk</tt> it will be
! 2918: executed (as a sh(1) script) at the end of the usual
! 2919: pre-build stage. An example use of <tt class=
! 2920: "filename">pre-build.local</tt> is to have the
! 2921: line:</p>
1.1 grant 2922: <pre class="screen">
1.13 ! hubertf 2923: <tt class="prompt">#</tt> <b class=
! 2924: "userinput"><tt>echo "I do not have enough disk space to build this pig." \
! 2925: > pkgsrc/games/crafty-book-enormous/$BROKENF</tt></b>
1.1 grant 2926: </pre>
2927:
2928: <p>to prevent the system from trying to build a
2929: particular package which requires nearly 3 GB of disk
2930: space.</p>
2931: </div>
2932: </div>
2933:
2934: <div class="sect2" lang="en" xml:lang="en">
2935: <div class="titlepage">
2936: <div>
2937: <div>
1.13 ! hubertf 2938: <h3 class="title"><a name="id2563289" id=
! 2939: "id2563289"></a>5.3.2. Other environmental
1.1 grant 2940: considerations</h3>
2941: </div>
2942: </div>
2943: </div>
2944:
1.13 ! hubertf 2945: <p>As <tt class="filename">/usr/pkg</tt> will be
1.1 grant 2946: completely deleted at the start of bulk builds, make
2947: sure your login shell is placed somewhere else. Either
1.13 ! hubertf 2948: drop it into <tt class="filename">/usr/local/bin</tt>
! 2949: (and adjust your login shell in the passwd file), or
! 2950: (re-)install it via <a href=
1.1 grant 2951: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2952: <span class="citerefentry"><span class=
2953: "refentrytitle">pkg_add</span>(1)</span></a> from
1.13 ! hubertf 2954: <tt class="filename">/etc/rc.local</tt>, so you can
1.1 grant 2955: login after a reboot (remember that your current
2956: process won't die if the package is removed, you just
2957: can't start any new instances of the shell any more).
2958: Also, if you use NetBSD earlier than 1.5, or you still
2959: want to use the pkgsrc version of ssh for some reason,
2960: be sure to install ssh before starting it from
1.13 ! hubertf 2961: <tt class="filename">rc.local</tt>:</p>
1.1 grant 2962: <pre class="programlisting">
2963: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
2964: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
2965: /usr/pkg/etc/rc.d/sshd
2966: fi
2967: </pre>
2968:
2969: <p>Not doing so will result in you being not able to
2970: log in via ssh after the bulk build is finished or if
2971: the machine gets rebooted or crashes. You have been
2972: warned! :)</p>
2973: </div>
2974:
2975: <div class="sect2" lang="en" xml:lang="en">
2976: <div class="titlepage">
2977: <div>
2978: <div>
1.13 ! hubertf 2979: <h3 class="title"><a name="id2563330" id=
! 2980: "id2563330"></a>5.3.3. Operation</h3>
1.1 grant 2981: </div>
2982: </div>
2983: </div>
2984:
2985: <p>Make sure you don't need any of the packages still
2986: installed.</p>
2987:
2988: <div class="warning" style=
2989: "margin-left: 0.5in; margin-right: 0.5in;">
2990: <h3 class="title">Warning</h3>
2991:
2992: <p>During the bulk build, <span class=
2993: "emphasis"><em>all packages will be
2994: removed!</em></span></p>
2995: </div>
2996:
2997: <p>Be sure to remove all other things that might
2998: interfere with builds, like some libs installed in
1.13 ! hubertf 2999: <tt class="filename">/usr/local</tt>, etc. then become
! 3000: root and type:</p>
1.1 grant 3001: <pre class="screen">
1.13 ! hubertf 3002: <tt class="prompt">#</tt> <b class=
! 3003: "userinput"><tt>cd /usr/pkgsrc</tt></b>
! 3004: <tt class="prompt">#</tt> <b class=
! 3005: "userinput"><tt>sh mk/bulk/build</tt></b>
1.1 grant 3006: </pre>
3007:
3008: <p>If for some reason your last build didn't complete
3009: (power failure, system panic, ...), you can continue it
3010: by running:</p>
3011: <pre class="screen">
1.13 ! hubertf 3012: <tt class="prompt">#</tt> <b class=
! 3013: "userinput"><tt>sh mk/bulk/build restart</tt></b>
1.1 grant 3014: </pre>
3015:
3016: <p>At the end of the bulk build, you will get a summary
3017: via mail, and find build logs in the directory
1.13 ! hubertf 3018: specified by <tt class="varname">FTP</tt> in the
! 3019: <tt class="filename">build.conf</tt> file.</p>
1.1 grant 3020: </div>
3021:
3022: <div class="sect2" lang="en" xml:lang="en">
3023: <div class="titlepage">
3024: <div>
3025: <div>
1.13 ! hubertf 3026: <h3 class="title"><a name="id2563467" id=
! 3027: "id2563467"></a>5.3.4. What it does</h3>
1.1 grant 3028: </div>
3029: </div>
3030: </div>
3031:
3032: <p>The bulk builds consist of three steps:</p>
3033:
3034: <div class="variablelist">
3035: <dl>
3036: <dt><span class="term">1. pre-build</span></dt>
3037:
3038: <dd>
3039: <p>The script updates your pkgsrc tree via
3040: (anon)cvs, then cleans out any broken distfiles,
3041: and removes all packages installed.</p>
3042: </dd>
3043:
3044: <dt><span class="term">2. the bulk
3045: build</span></dt>
3046:
3047: <dd>
3048: <p>This is basically “<span class=
3049: "quote">make bulk-package</span>” with an
3050: optimised order in which packages will be built.
3051: Packages that don't require other packages will
3052: be built first, and packages with many
3053: dependencies will be built later.</p>
3054: </dd>
3055:
3056: <dt><span class="term">3. post-build</span></dt>
3057:
3058: <dd>
3059: <p>Generates a report that's placed in the
1.13 ! hubertf 3060: directory specified in the <tt class=
! 3061: "filename">build.conf</tt> file named <tt class=
! 3062: "filename">broken.html</tt>, a short version of
! 3063: that report will also be mailed to the build's
! 3064: admin.</p>
1.1 grant 3065: </dd>
3066: </dl>
3067: </div>
3068:
3069: <p>During the build, a list of broken packages will be
1.13 ! hubertf 3070: compiled in <tt class=
! 3071: "filename">/usr/pkgsrc/.broken</tt> (or <tt class=
! 3072: "filename">.../.broken.${MACHINE}</tt> if <tt class=
! 3073: "varname">OBJMACHINE</tt> is set), individual build
! 3074: logs of broken builds can be found in the package's
! 3075: directory. These files are used by the bulk-targets to
! 3076: mark broken builds to not waste time trying to rebuild
! 3077: them, and they can be used to debug these broken
! 3078: package builds later.</p>
1.1 grant 3079: </div>
3080:
3081: <div class="sect2" lang="en" xml:lang="en">
3082: <div class="titlepage">
3083: <div>
3084: <div>
1.13 ! hubertf 3085: <h3 class="title"><a name="id2563524" id=
! 3086: "id2563524"></a>5.3.5. Disk space
1.1 grant 3087: requirements</h3>
3088: </div>
3089: </div>
3090: </div>
3091:
3092: <p>Currently, roughly the following requirements are
3093: valid for NetBSD 2.0/i386:</p>
3094:
3095: <div class="itemizedlist">
3096: <ul type="disc">
3097: <li>
3098: <p>10 GB - distfiles (NFS ok)</p>
3099: </li>
3100:
3101: <li>
3102: <p>8 GB - full set of all binaries (NFS ok)</p>
3103: </li>
3104:
3105: <li>
3106: <p>5 GB - temp space for compiling (local disk
3107: recommended)</p>
3108: </li>
3109: </ul>
3110: </div>
3111:
3112: <p>Note that all pkgs will be de-installed as soon as
3113: they are turned into a binary package, and that sources
3114: are removed, so there is no excessively huge demand to
3115: disk space. Afterwards, if the package is needed again,
3116: it will be installed via <a href=
3117: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3118: <span class="citerefentry"><span class=
3119: "refentrytitle">pkg_add</span>(1)</span></a> instead of
3120: building again, so there are no cycles wasted by
3121: recompiling.</p>
3122: </div>
3123:
3124: <div class="sect2" lang="en" xml:lang="en">
3125: <div class="titlepage">
3126: <div>
3127: <div>
1.13 ! hubertf 3128: <h3 class="title"><a name="id2563550" id=
! 3129: "id2563550"></a>5.3.6. Setting up a sandbox
1.1 grant 3130: for chroot'ed builds</h3>
3131: </div>
3132: </div>
3133: </div>
3134:
1.12 agc 3135: <p>If you don't want all the packages nuked from a
3136: machine (rendering it useless for anything but pkg
3137: compiling), there is the possibility of doing the pkg
3138: bulk build inside a chroot environment.</p>
3139:
3140: <p>The first step is to set up a chroot sandbox, e.g.
1.13 ! hubertf 3141: <tt class="filename">/usr/sandbox</tt>. This can be
1.12 agc 3142: done by using null mounts, or manually.</p>
3143:
1.13 ! hubertf 3144: <p>There is a shell script called <tt class=
! 3145: "filename">pkgsrc/mk/bulk/mksandbox</tt> which will set
! 3146: up the sandbox environment using null mounts. It will
! 3147: also create a script called <tt class=
! 3148: "filename">sandbox</tt> in the root of the sandbox
1.12 agc 3149: environment, which will allow the null mounts to be
1.13 ! hubertf 3150: activated using the <span><b class="command">sandbox
! 3151: mount</b></span> command and deactivated using the
! 3152: <span><b class="command">sandbox umount</b></span>
! 3153: command.</p>
1.12 agc 3154:
3155: <p>To set up a sandbox environment by hand, after
3156: extracting all the sets from a NetBSD installation or
1.13 ! hubertf 3157: doing a <span><b class="command">make distribution
! 3158: DESTDIR=/usr/sandbox</b></span> in <tt class=
! 3159: "filename">/usr/src/etc</tt>, be sure the following
1.7 wiz 3160: items are present and properly configured:</p>
1.1 grant 3161:
3162: <div class="procedure">
3163: <ol type="1">
3164: <li>
3165: <p>Kernel</p>
3166: <pre class="screen">
1.13 ! hubertf 3167: <tt class="prompt">#</tt> <b class=
! 3168: "userinput"><tt>cp /netbsd /usr/sandbox</tt></b>
1.1 grant 3169: </pre>
3170: </li>
3171:
3172: <li>
1.13 ! hubertf 3173: <p><tt class="filename">/dev/*</tt></p>
1.1 grant 3174: <pre class="screen">
1.13 ! hubertf 3175: <tt class="prompt">#</tt> <b class=
! 3176: "userinput"><tt>cd /usr/sandbox/dev ; sh MAKEDEV all</tt></b>
1.1 grant 3177: </pre>
3178: </li>
3179:
3180: <li>
1.13 ! hubertf 3181: <p><tt class="filename">/etc/resolv.conf</tt>
1.1 grant 3182: (for <a xmlns=
3183: "http://www.w3.org/TR/xhtml1/transitional" href=
3184: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.13 ! hubertf 3185: class="pkgname">security/smtpd</a> and
! 3186: mail):</p>
1.1 grant 3187: <pre class="screen">
1.13 ! hubertf 3188: <tt class="prompt">#</tt> <b class=
! 3189: "userinput"><tt>cp /etc/resolv.conf /usr/sandbox/etc</tt></b>
1.1 grant 3190: </pre>
3191: </li>
3192:
3193: <li>
3194: <p>Working(!) mail config (hostname,
3195: sendmail.cf):</p>
3196: <pre class="screen">
1.13 ! hubertf 3197: <tt class="prompt">#</tt> <b class=
! 3198: "userinput"><tt>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</tt></b>
1.1 grant 3199: </pre>
3200: </li>
3201:
3202: <li>
1.13 ! hubertf 3203: <p><tt class="filename">/etc/localtime</tt> (for
! 3204: <a xmlns=
1.1 grant 3205: "http://www.w3.org/TR/xhtml1/transitional" href=
3206: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.13 ! hubertf 3207: class="pkgname">security/smtpd</a>):</p>
1.1 grant 3208: <pre class="screen">
1.13 ! hubertf 3209: <tt class="prompt">#</tt> <b class=
! 3210: "userinput"><tt>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</tt></b>
1.1 grant 3211: </pre>
3212: </li>
3213:
3214: <li>
1.13 ! hubertf 3215: <p><tt class="filename">/usr/src</tt> (system
1.1 grant 3216: sources, for <a xmlns=
3217: "http://www.w3.org/TR/xhtml1/transitional" href=
3218: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.13 ! hubertf 3219: class="pkgname">sysutils/aperture</a>,
! 3220: <a xmlns=
! 3221: "http://www.w3.org/TR/xhtml1/transitional"
! 3222: href=
! 3223: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
! 3224: class="pkgname">net/ppp-mppe</a>):</p>
1.1 grant 3225: <pre class="screen">
1.13 ! hubertf 3226: <tt class="prompt">#</tt> <b class=
! 3227: "userinput"><tt>ln -s ../disk1/cvs .</tt></b>
! 3228: <tt class="prompt">#</tt> <b class=
! 3229: "userinput"><tt>ln -s cvs/src-1.6 src</tt></b>
1.1 grant 3230: </pre>
3231: </li>
3232:
3233: <li>
1.13 ! hubertf 3234: <p>Create <tt class="filename">/var/db/pkg</tt>
! 3235: (not part of default install):</p>
1.1 grant 3236: <pre class="screen">
1.13 ! hubertf 3237: <tt class="prompt">#</tt> <b class=
! 3238: "userinput"><tt>mkdir /usr/sandbox/var/db/pkg</tt></b>
1.1 grant 3239: </pre>
3240: </li>
3241:
3242: <li>
1.13 ! hubertf 3243: <p>Create <tt class="filename">/usr/pkg</tt> (not
! 3244: part of default install):</p>
1.1 grant 3245: <pre class="screen">
1.13 ! hubertf 3246: <tt class="prompt">#</tt> <b class=
! 3247: "userinput"><tt>mkdir /usr/sandbox/usr/pkg</tt></b>
1.1 grant 3248: </pre>
3249: </li>
3250:
3251: <li>
1.13 ! hubertf 3252: <p>Checkout pkgsrc via cvs into <tt class=
! 3253: "filename">/usr/sandbox/usr/pkgsrc</tt>:</p>
1.1 grant 3254: <pre class="screen">
1.13 ! hubertf 3255: <tt class="prompt">#</tt> <b class=
! 3256: "userinput"><tt>cd /usr/sandbox/usr</tt></b>
! 3257: <tt class="prompt">#</tt> <b class=
! 3258: "userinput"><tt>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</tt></b>
1.1 grant 3259: </pre>
3260:
3261: <p>Do not mount/link this to the copy of your
3262: pkgsrc tree you do development in, as this will
3263: likely cause problems!</p>
3264: </li>
3265:
3266: <li>
1.13 ! hubertf 3267: <p>Make <tt class=
! 3268: "filename">/usr/sandbox/usr/pkgsrc/packages</tt>
! 3269: and <tt class="filename">.../distfiles</tt> point
! 3270: somewhere appropriate. NFS- and/or nullfs-mounts
! 3271: may come in handy!</p>
1.1 grant 3272: </li>
3273:
3274: <li>
1.13 ! hubertf 3275: <p>Edit <tt class="filename">/etc/mk.conf</tt>,
! 3276: see <a href="#binary.mk.conf" title=
1.1 grant 3277: "5.3.1.1. /etc/mk.conf">Section 5.3.1.1,
3278: “/etc/mk.conf”</a>.</p>
3279: </li>
3280:
3281: <li>
1.13 ! hubertf 3282: <p>Adjust <tt class=
! 3283: "filename">mk/bulk/build.conf</tt> to suit your
1.1 grant 3284: needs.</p>
3285: </li>
3286:
3287: <li>
1.13 ! hubertf 3288: <p>If you have set <tt class=
! 3289: "varname">CVS_USER</tt> in <tt class=
! 3290: "filename">build.conf</tt>, make sure that
! 3291: account exists and can do a <span><b class=
! 3292: "command">cvs ${CVS_FLAGS} update</b></span>
1.1 grant 3293: properly!</p>
3294: </li>
3295: </ol>
3296: </div>
3297:
3298: <p>When the chroot sandbox is setup, you can start the
3299: build with the following steps:</p>
3300: <pre class="screen">
1.13 ! hubertf 3301: <tt class="prompt">#</tt> <b class=
! 3302: "userinput"><tt>cd /usr/sandbox/usr/pkgsrc</tt></b>
! 3303: <tt class="prompt">#</tt> <b class=
! 3304: "userinput"><tt>sh mk/bulk/do-sandbox-build</tt></b>
1.1 grant 3305: </pre>
3306:
3307: <p>This will just jump inside the sandbox and start
3308: building. At the end of the build, mail will be sent
3309: with the results of the build. Created binary pkgs will
1.13 ! hubertf 3310: be in <tt class=
! 3311: "filename">/usr/sandbox/usr/pkgsrc/packages</tt>
1.1 grant 3312: (wherever that points/mounts to/from).</p>
3313: </div>
3314:
3315: <div class="sect2" lang="en" xml:lang="en">
3316: <div class="titlepage">
3317: <div>
3318: <div>
1.13 ! hubertf 3319: <h3 class="title"><a name="id2563943" id=
! 3320: "id2563943"></a>5.3.7. Building a partial
1.1 grant 3321: set of packages</h3>
3322: </div>
3323: </div>
3324: </div>
3325:
3326: <p>In addition to building a complete set of all
1.13 ! hubertf 3327: packages in pkgsrc, the <tt class=
! 3328: "filename">pkgsrc/mk/bulk/build</tt> script may be used
! 3329: to build a subset of the packages contained in pkgsrc.
! 3330: By setting defining <tt class=
! 3331: "varname">SPECIFIC_PKGS</tt> in <tt class=
! 3332: "filename">/etc/mk.conf</tt>, the variables</p>
1.1 grant 3333:
3334: <div class="itemizedlist">
3335: <ul type="disc">
3336: <li>
3337: <p>SITE_SPECIFIC_PKGS</p>
3338: </li>
3339:
3340: <li>
3341: <p>HOST_SPECIFIC_PKGS</p>
3342: </li>
3343:
3344: <li>
3345: <p>GROUP_SPECIFIC_PKGS</p>
3346: </li>
3347:
3348: <li>
3349: <p>USER_SPECIFIC_PKGS</p>
3350: </li>
3351: </ul>
3352: </div>
3353:
3354: <p>will define the set of packages which should be
3355: built. The bulk build code will also include any
3356: packages which are needed as dependencies for the
3357: explicitly listed packages.</p>
3358:
3359: <p>One use of this is to do a bulk build with
1.13 ! hubertf 3360: <tt class="varname">SPECIFIC_PKGS</tt> in a chroot
1.1 grant 3361: sandbox periodically to have a complete set of the
3362: binary packages needed for your site available without
3363: the overhead of building extra packages that are not
3364: needed.</p>
3365: </div>
1.13 ! hubertf 3366:
! 3367: <div class="sect2" lang="en" xml:lang="en">
! 3368: <div class="titlepage">
! 3369: <div>
! 3370: <div>
! 3371: <h3 class="title"><a name="bulk-upload" id=
! 3372: "bulk-upload"></a>5.3.8. Uploading results
! 3373: of a bulk build</h3>
! 3374: </div>
! 3375: </div>
! 3376: </div>
! 3377:
! 3378: <p>This section describes how pkgsrc developers can
! 3379: upload binary pkgs built by bulk builds to
! 3380: ftp.NetBSD.org.</p>
! 3381:
! 3382: <p>First, make sure that you have <tt class=
! 3383: "varname">RSYNC_DST</tt> set properly in your
! 3384: <tt class="filename">mk/bulk/build.conf</tt> file, i.e.
! 3385: adjust it to something like one of the following:</p>
! 3386: <pre class="screen">
! 3387: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
! 3388: </pre>
! 3389:
! 3390: <p>Please use appropviate values for "pkgsrc-200xQ4",
! 3391: "NetBSD-a.b.c" and "arch" here. If your login on
! 3392: ftp.NetBSD.org is different from <tt class=
! 3393: "varname">CVS_USER</tt>, write your login directly into
! 3394: the variable, e.g. my local account is "feyrer", but
! 3395: for my login "hubertf", I use:</p>
! 3396: <pre class="screen">
! 3397: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
! 3398: </pre>
! 3399:
! 3400: <p>A separate <tt class="filename">upload</tt>
! 3401: directory is used here to allow "closing" the directory
! 3402: during upload. To do so, run the following command on
! 3403: ftp.NetBSD.org next:</p>
! 3404: <pre class="screen">
! 3405: nbftp% <b class=
! 3406: "userinput"><tt>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</tt></b>
! 3407: </pre>
! 3408:
! 3409: <p>Please note that <tt class=
! 3410: "filename">/pub/NetBSD/packages</tt> is only
! 3411: appropriate for packages for the NetBSD operating
! 3412: system. Binary packages for other operating systems
! 3413: should go into <tt class=
! 3414: "filename">/pub/pkgsrc</tt>.</p>
! 3415:
! 3416: <p>Before uploading the binary pkgs, ssh authentication
! 3417: needs to be setup next. This example shows how to setup
! 3418: temporary keys for the root account <span class=
! 3419: "emphasis"><em>inside the sandbox</em></span> (assuming
! 3420: that no keys should be present there usually):</p>
! 3421: <pre class="screen">
! 3422: <tt class="prompt">#</tt> <b class=
! 3423: "userinput"><tt>chroot /usr/sandbox</tt></b>
! 3424: chroot-<tt class="prompt">#</tt> <b class=
! 3425: "userinput"><tt>rm $HOME/.ssh/id-dsa*</tt></b>
! 3426: chroot-<tt class="prompt">#</tt> <b class=
! 3427: "userinput"><tt>ssh-keygen -t dsa</tt></b>
! 3428: chroot-<tt class="prompt">#</tt> <b class=
! 3429: "userinput"><tt>cat $HOME/.ssh/id-dsa.pub</tt></b>
! 3430: </pre>
! 3431:
! 3432: <p>Now take the output of <tt class=
! 3433: "filename">id-dsa.pub</tt> and append it to your
! 3434: <tt class="filename">~/.ssh/authorized_keys</tt> file
! 3435: on ftp.netBSD.org. You can remove the key after the
! 3436: upload is done!</p>
! 3437:
! 3438: <p>Next, test if your ssh connection really works:</p>
! 3439: <pre class="screen">
! 3440: chroot-<tt class="prompt">#</tt> <b class=
! 3441: "userinput"><tt>ssh ftp.NetBSD.org date</tt></b>
! 3442: </pre>
! 3443:
! 3444: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
! 3445:
! 3446: <p>Now after all this works, you can exit the sandbox
! 3447: and start the upload:</p>
! 3448: <pre class="screen">
! 3449: chroot-<tt class="prompt">#</tt> <b class=
! 3450: "userinput"><tt>exit</tt></b>
! 3451: <tt class="prompt">#</tt> <b class=
! 3452: "userinput"><tt>cd /usr/sandbox/usr/pkgsrc</tt></b>
! 3453: <tt class="prompt">#</tt> <b class=
! 3454: "userinput"><tt>sh mk/bulk/do-sandbox-upload</tt></b>
! 3455: </pre>
! 3456:
! 3457: <p>The upload process may take quite some time. Use
! 3458: "ls" or "du" on the FTP server to monitor progress of
! 3459: the upload.</p>
! 3460:
! 3461: <p>After the upload has ended, first thing is to revoke
! 3462: ssh access:</p>
! 3463: <pre class="screen">
! 3464: nbftp% <b class="userinput"><tt>vi ~/.ssh/authorized_keys</tt></b>
! 3465: Gdd:x!
! 3466: </pre>
! 3467:
! 3468: <p>Use whatever is needed to remove the key you've
! 3469: entered before! Last, move the uploaded packages out of
! 3470: the <tt class="filename">upload</tt> directory to have
! 3471: them accessible to everyone:</p>
! 3472: <pre class="screen">
! 3473: nbftp% <b class=
! 3474: "userinput"><tt>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</tt></b>
! 3475: nbftp% <b class="userinput"><tt>mv upload/* .</tt></b>
! 3476: nbftp% <b class="userinput"><tt>rmdir upload</tt></b>
! 3477: nbftp% <b class="userinput"><tt>chmod 755 .</tt></b>
! 3478: </pre>
! 3479: </div>
1.1 grant 3480: </div>
3481:
3482: <div class="sect1" lang="en" xml:lang="en">
3483: <div class="titlepage">
3484: <div>
3485: <div>
3486: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 3487: "id2564359" id="id2564359"></a>5.4. Creating a
1.1 grant 3488: multiple CD-ROM packages collection</h2>
3489: </div>
3490: </div>
3491: </div>
3492:
3493: <p>After your pkgsrc bulk-build has completed, you may
3494: wish to create a CD-ROM set of the resulting binary
3495: packages to assist in installing packages on other
3496: machines. The <a xmlns=
3497: "http://www.w3.org/TR/xhtml1/transitional" href=
3498: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.13 ! hubertf 3499: class="pkgname">pkgtools/cdpack</a> package provides a
! 3500: simple tool for creating the ISO 9660 images.
! 3501: <span><b class="command">cdpack</b></span> arranges
! 3502: the packages on the CD-ROMs in a way that keeps all
! 3503: the dependencies for given package on the same CD as
! 3504: that package.</p>
1.1 grant 3505:
3506: <div class="sect2" lang="en" xml:lang="en">
3507: <div class="titlepage">
3508: <div>
3509: <div>
1.13 ! hubertf 3510: <h3 class="title"><a name="id2564442" id=
! 3511: "id2564442"></a>5.4.1. Example of
1.1 grant 3512: cdpack</h3>
3513: </div>
3514: </div>
3515: </div>
3516:
3517: <p>Complete documentation for cdpack is found in the
3518: cdpack(1) manpage. The following short example assumes
1.13 ! hubertf 3519: that the binary packages are left in <tt class=
! 3520: "filename">/usr/pkgsrc/packages/All</tt> and that
! 3521: sufficient disk space exists in <tt class=
! 3522: "filename">/u2</tt> to hold the ISO 9660 images.</p>
1.1 grant 3523: <pre class="screen">
1.13 ! hubertf 3524: <tt class="prompt">#</tt> <b class=
! 3525: "userinput"><tt>mkdir /u2/images</tt></b>
! 3526: <tt class="prompt">#</tt> <b class=
! 3527: "userinput"><tt>pkg_add /usr/pkgsrc/packages/All/cdpack</tt></b>
! 3528: <tt class="prompt">#</tt> <b class=
! 3529: "userinput"><tt>cdpack /usr/pkgsrc/packages/All /u2/images</tt></b>
1.1 grant 3530: </pre>
3531:
3532: <p>If you wish to include a common set of files
1.13 ! hubertf 3533: (<tt class="filename">COPYRIGHT</tt>, <tt class=
! 3534: "filename">README</tt>, etc.) on each CD in the
1.1 grant 3535: collection, then you need to create a directory which
3536: contains these files. e.g.</p>
3537: <pre class="screen">
1.13 ! hubertf 3538: <tt class="prompt">#</tt> <b class=
! 3539: "userinput"><tt>mkdir /tmp/common</tt></b>
! 3540: <tt class="prompt">#</tt> <b class=
! 3541: "userinput"><tt>echo "This is a README" > /tmp/common/README</tt></b>
! 3542: <tt class="prompt">#</tt> <b class=
! 3543: "userinput"><tt>echo "Another file" > /tmp/common/COPYING</tt></b>
! 3544: <tt class="prompt">#</tt> <b class=
! 3545: "userinput"><tt>mkdir /tmp/common/bin</tt></b>
! 3546: <tt class="prompt">#</tt> <b class=
! 3547: "userinput"><tt>echo "#!/bin/sh" > /tmp/common/bin/myscript</tt></b>
! 3548: <tt class="prompt">#</tt> <b class=
! 3549: "userinput"><tt>echo "echo Hello world" >> /tmp/common/bin/myscript</tt></b>
! 3550: <tt class="prompt">#</tt> <b class=
! 3551: "userinput"><tt>chmod 755 /tmp/common/bin/myscript</tt></b>
1.1 grant 3552: </pre>
3553:
3554: <p>Now create the images:</p>
3555: <pre class="screen">
1.13 ! hubertf 3556: <tt class="prompt">#</tt> <b class=
! 3557: "userinput"><tt>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</tt></b>
1.1 grant 3558: </pre>
3559:
1.13 ! hubertf 3560: <p>Each image will contain <tt class=
! 3561: "filename">README</tt>, <tt class=
! 3562: "filename">COPYING</tt>, and <tt class=
! 3563: "filename">bin/myscript</tt> in their root
1.1 grant 3564: directories.</p>
3565: </div>
3566: </div>
3567: </div>
3568:
3569: <div class="chapter" lang="en" xml:lang="en">
3570: <div class="titlepage">
3571: <div>
3572: <div>
3573: <h2 class="title"><a name="faq" id=
3574: "faq"></a>Chapter 6. Frequently Asked
3575: Questions</h2>
3576: </div>
3577: </div>
3578: </div>
3579:
3580: <div class="toc">
3581: <p><b>Table of Contents</b></p>
3582:
3583: <dl>
1.13 ! hubertf 3584: <dt><span class="sect1"><a href="#id2564634">6.1. Is
1.1 grant 3585: there a mailing list for pkg-related
3586: discussion?</a></span></dt>
3587:
1.13 ! hubertf 3588: <dt><span class="sect1"><a href="#id2564801">6.2.
1.1 grant 3589: Where's the pkgviews documentation?</a></span></dt>
3590:
1.5 hubertf 3591: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 3592: Utilities for package management
3593: (pkgtools)</a></span></dt>
3594:
1.13 ! hubertf 3595: <dt><span class="sect1"><a href="#id2564985">6.4. How
1.1 grant 3596: to use pkgsrc as non-root</a></span></dt>
3597:
1.13 ! hubertf 3598: <dt><span class="sect1"><a href="#id2564997">6.5. How
1.1 grant 3599: can I install/use XFree86 from pkgsrc?</a></span></dt>
3600:
1.13 ! hubertf 3601: <dt><span class="sect1"><a href="#id2565025">6.6. How
1.1 grant 3602: can I install/use X.org from pkgsrc?</a></span></dt>
3603:
1.13 ! hubertf 3604: <dt><span class="sect1"><a href="#id2565121">6.7. How
1.1 grant 3605: to fetch files from behind a firewall</a></span></dt>
3606:
1.13 ! hubertf 3607: <dt><span class="sect1"><a href="#id2565134">6.8. How
! 3608: do I tell make fetch to do passive FTP?</a></span></dt>
1.1 grant 3609:
1.13 ! hubertf 3610: <dt><span class="sect1"><a href="#id2565186">6.9. How
1.1 grant 3611: to fetch all distfiles at once</a></span></dt>
3612:
1.13 ! hubertf 3613: <dt><span class="sect1"><a href="#id2565325">6.10. What
! 3614: does Don't know how to make /usr/share/tmac/tmac.andoc
1.1 grant 3615: mean?</a></span></dt>
3616:
1.13 ! hubertf 3617: <dt><span class="sect1"><a href="#id2565364">6.11. What
! 3618: does Could not find bsd.own.mk mean?</a></span></dt>
1.1 grant 3619:
1.13 ! hubertf 3620: <dt><span class="sect1"><a href="#id2565490">6.12.
1.1 grant 3621: Using 'sudo' with pkgsrc</a></span></dt>
3622:
3623: <dt><span class="sect1"><a href="#faq.conf">6.13.
3624: Configuration files handling and
3625: placement</a></span></dt>
3626:
3627: <dt><span class="sect1"><a href="#audit-packages">6.14.
3628: Automated security checks</a></span></dt>
3629: </dl>
3630: </div>
3631:
3632: <p>This section contains hints, tips & tricks on
3633: special things in pkgsrc that we didn't find a better place
3634: for in the previous chapters, and it contains items for
3635: both pkgsrc users and developers.</p>
3636:
3637: <div class="sect1" lang="en" xml:lang="en">
3638: <div class="titlepage">
3639: <div>
3640: <div>
3641: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 3642: "id2564634" id="id2564634"></a>6.1. Is there a
1.1 grant 3643: mailing list for pkg-related discussion?</h2>
3644: </div>
3645: </div>
3646: </div>
3647:
1.13 ! hubertf 3648: <p>Yes, <tt class="email"><<a href=
! 3649: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></tt>
1.1 grant 3650: is the list for discussing package related issues. To
3651: subscribe do:</p>
3652: <pre class="programlisting">
1.13 ! hubertf 3653: <tt class=
! 3654: "prompt">%</tt> echo subscribe tech-pkg | mail majordomo@NetBSD.org
1.1 grant 3655: </pre>
3656:
3657: <p>An archive of the list is available at <a href=
3658: "http://mail-index.NetBSD.org/tech-pkg/" target=
3659: "_top">http://mail-index.NetBSD.org/tech-pkg/</a>.</p>
3660: </div>
3661:
3662: <div class="sect1" lang="en" xml:lang="en">
3663: <div class="titlepage">
3664: <div>
3665: <div>
3666: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 3667: "id2564801" id="id2564801"></a>6.2. Where's
1.1 grant 3668: the pkgviews documentation?</h2>
3669: </div>
3670: </div>
3671: </div>
3672:
3673: <p>Pkgviews is tightly integrated with buildlink. You can
1.13 ! hubertf 3674: find a pkgviews User's guide in <tt class=
! 3675: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</tt>.</p>
1.1 grant 3676: </div>
3677:
3678: <div class="sect1" lang="en" xml:lang="en">
3679: <div class="titlepage">
3680: <div>
3681: <div>
3682: <h2 class="title" style="clear: both"><a name=
1.5 hubertf 3683: "faq-pkgtools" id=
3684: "faq-pkgtools"></a>6.3. Utilities for package
3685: management (pkgtools)</h2>
1.1 grant 3686: </div>
3687: </div>
3688: </div>
3689:
1.13 ! hubertf 3690: <p>The <tt class="filename">pkgsrc/pkgtools</tt>
1.1 grant 3691: directory pkgtools contains a number of useful utilities
3692: for both users and developers of pkgsrc. This section
3693: attempts only to make the reader aware of the utilities
3694: and when they might be useful, and not to duplicate the
3695: documentation that comes with each package.</p>
3696:
3697: <p>Utilities used by pkgsrc (automatically installed when
3698: needed):</p>
3699:
3700: <div class="itemizedlist">
3701: <ul type="disc">
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/x11-links/README.html"
1.13 ! hubertf 3706: class="pkgname">pkgtools/x11-links</a>: symlinks
! 3707: for use by buildlink</p>
1.1 grant 3708: </li>
3709: </ul>
3710: </div>
3711:
3712: <p>OS tool augmentation (automatically installed when
3713: needed):</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/digest/README.html"
1.13 ! hubertf 3721: class="pkgname">pkgtools/digest</a>: calculates
! 3722: SHA1 checksums (and other kinds)</p>
1.1 grant 3723: </li>
3724:
3725: <li>
3726: <p><a xmlns=
3727: "http://www.w3.org/TR/xhtml1/transitional" href=
3728: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.13 ! hubertf 3729: class="pkgname">pkgtools/libnbcompat</a>: compat
! 3730: library for pkg tools</p>
1.1 grant 3731: </li>
3732:
3733: <li>
3734: <p><a xmlns=
3735: "http://www.w3.org/TR/xhtml1/transitional" href=
3736: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.13 ! hubertf 3737: class="pkgname">pkgtools/mtree</a>: installed on
! 3738: non-BSD systems due to lack of native mtree</p>
1.1 grant 3739: </li>
3740:
3741: <li>
3742: <p><a xmlns=
3743: "http://www.w3.org/TR/xhtml1/transitional" href=
3744: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.13 ! hubertf 3745: class="pkgname">pkgtools/pkg_install</a>:
! 3746: up-to-date replacement for
! 3747: /usr/sbin/pkg_install, or for use on operating
! 3748: systems where pkg_install is not present</p>
1.1 grant 3749: </li>
3750: </ul>
3751: </div>
3752:
3753: <p>Utilities used by pkgsrc (not automatically
3754: installed):</p>
3755:
3756: <div class="itemizedlist">
3757: <ul type="disc">
3758: <li>
3759: <p><a xmlns=
3760: "http://www.w3.org/TR/xhtml1/transitional" href=
3761: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.13 ! hubertf 3762: class="pkgname">pkgtools/pkg_tarup</a>: create a
! 3763: binary package from an already-installed
! 3764: package. used by 'make replace' to save the old
! 3765: package</p>
1.1 grant 3766: </li>
3767:
3768: <li>
3769: <p><a xmlns=
3770: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 3771: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.13 ! hubertf 3772: class="pkgname">pkgtools/dfdisk</a>: adds extra
! 3773: functionality to pkgsrc, allowing it to fetch
! 3774: distfiles from multiple locations. It currently
! 3775: supports the following methods: multiple CD-ROMs
! 3776: and network FTP/HTTP connections.</p>
1.5 hubertf 3777: </li>
3778:
3779: <li>
3780: <p><a xmlns=
3781: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 3782: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.13 ! hubertf 3783: class="pkgname">pkgtools/xpkgwedge</a>: put X11
! 3784: packages someplace else (enabled by default)</p>
1.1 grant 3785: </li>
1.5 hubertf 3786:
3787: <li>
3788: <p><a xmlns=
3789: "http://www.w3.org/TR/xhtml1/transitional" href=
3790: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.13 ! hubertf 3791: class="pkgname">devel/cpuflags</a>: will
! 3792: determine the best compiler flags to optimise
! 3793: code for your current CPU and compiler.</p>
1.5 hubertf 3794: </li>
1.1 grant 3795: </ul>
3796: </div>
3797:
3798: <p>Utilities for keeping track of installed packages,
3799: being up to date, etc:</p>
3800:
3801: <div class="itemizedlist">
3802: <ul type="disc">
3803: <li>
3804: <p><a xmlns=
3805: "http://www.w3.org/TR/xhtml1/transitional" href=
3806: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.13 ! hubertf 3807: class="pkgname">pkgtools/pkg_chk</a>: installs
! 3808: pkg_chk, which reports on packages whose
! 3809: installed versions do not match the latest
! 3810: pkgsrc entries</p>
1.1 grant 3811: </li>
3812:
3813: <li>
3814: <p><a xmlns=
3815: "http://www.w3.org/TR/xhtml1/transitional" href=
3816: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.13 ! hubertf 3817: class="pkgname">pkgtools/pkgdep</a>: makes
! 3818: dependency graphs of packages, to aid in
! 3819: choosing a strategy for updating</p>
1.1 grant 3820: </li>
3821:
3822: <li>
3823: <p><a xmlns=
3824: "http://www.w3.org/TR/xhtml1/transitional" href=
3825: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.13 ! hubertf 3826: class="pkgname">pkgtools/pkgdepgraph</a>: make
! 3827: graph from above (uses graphviz)</p>
1.1 grant 3828: </li>
3829:
3830: <li>
3831: <p><a xmlns=
3832: "http://www.w3.org/TR/xhtml1/transitional" href=
3833: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.13 ! hubertf 3834: class="pkgname">pkgtools/pkglint</a>: This
! 3835: provides two distinct abilities: check a pkgsrc
! 3836: entry for correctness (pkglint) check for and
! 3837: remove out-of-date distfiles and binary packages
! 3838: (lintpkgsrc)</p>
1.1 grant 3839: </li>
3840:
3841: <li>
3842: <p><a xmlns=
3843: "http://www.w3.org/TR/xhtml1/transitional" href=
3844: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.13 ! hubertf 3845: class="pkgname">pkgtools/pkgsurvey</a>: report
! 3846: what packages you have installed</p>
1.1 grant 3847: </li>
3848: </ul>
3849: </div>
3850:
3851: <p>Utilities for people maintaining or creating
3852: individual packages:</p>
3853:
3854: <div class="itemizedlist">
3855: <ul type="disc">
3856: <li>
3857: <p><a xmlns=
3858: "http://www.w3.org/TR/xhtml1/transitional" href=
3859: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.13 ! hubertf 3860: class="pkgname">pkgtools/pkgdiff</a>: automate
! 3861: making and maintaining patches for a package
! 3862: (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1 grant 3863: </li>
3864:
3865: <li>
3866: <p><a xmlns=
3867: "http://www.w3.org/TR/xhtml1/transitional" href=
3868: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.13 ! hubertf 3869: class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
! 3870: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3871: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
! 3872: class="pkgname">pkgtools/url2pkg</a>: aids in
! 3873: converting to pkgsrc</p>
1.1 grant 3874: </li>
3875:
3876: <li>
3877: <p><a xmlns=
3878: "http://www.w3.org/TR/xhtml1/transitional" href=
3879: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.13 ! hubertf 3880: class="pkgname">pkgtools/gensolpkg</a>: convert
! 3881: pkgsrc to a Solaris package</p>
1.1 grant 3882: </li>
3883: </ul>
3884: </div>
3885:
3886: <p>Utilities for people maintaining pkgsrc (or more
3887: obscure pkg utilities)</p>
3888:
3889: <div class="itemizedlist">
3890: <ul type="disc">
3891: <li>
3892: <p><a xmlns=
3893: "http://www.w3.org/TR/xhtml1/transitional" href=
3894: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.13 ! hubertf 3895: class="pkgname">pkgtools/pkgconflict</a>: find
! 3896: packages that conflict but aren't marked as
! 3897: such</p>
1.1 grant 3898: </li>
3899:
3900: <li>
3901: <p><a xmlns=
3902: "http://www.w3.org/TR/xhtml1/transitional" href=
3903: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.13 ! hubertf 3904: class="pkgname">pkgtools/pkg_comp</a>: build
! 3905: packages in a chrooted area</p>
1.1 grant 3906: </li>
3907:
3908: <li>
3909: <p><a xmlns=
3910: "http://www.w3.org/TR/xhtml1/transitional" href=
3911: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.13 ! hubertf 3912: class="pkgname">pkgtools/libkver</a>: spoof
! 3913: kernel version for chrooted cross builds</p>
1.1 grant 3914: </li>
3915: </ul>
3916: </div>
3917: </div>
3918:
3919: <div class="sect1" lang="en" xml:lang="en">
3920: <div class="titlepage">
3921: <div>
3922: <div>
3923: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 3924: "id2564985" id="id2564985"></a>6.4. How to use
1.1 grant 3925: pkgsrc as non-root</h2>
3926: </div>
3927: </div>
3928: </div>
3929:
3930: <p>If you want to use pkgsrc as non-root user, you can
3931: set some variables to make pkgsrc work under these
3932: conditions. Please see <a href=
3933: "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.13 ! hubertf 3934: target="_top">this message</a> for more details.</p>
1.1 grant 3935: </div>
3936:
3937: <div class="sect1" lang="en" xml:lang="en">
3938: <div class="titlepage">
3939: <div>
3940: <div>
3941: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 3942: "id2564997" id="id2564997"></a>6.5. How can I
1.1 grant 3943: install/use XFree86 from pkgsrc?</h2>
3944: </div>
3945: </div>
3946: </div>
3947:
3948: <p>If you want to use XFree86 from pkgsrc instead of your
1.13 ! hubertf 3949: system's own X11 (<tt class="filename">/usr/X11R6</tt>,
! 3950: <tt class="filename">/usr/openwin</tt>, ...), you will
! 3951: have to add the following lines into <tt class=
! 3952: "filename">mk.conf</tt>:</p>
1.1 grant 3953: <pre class="programlisting">
3954: X11_TYPE=XFree86
3955:
3956: </pre>
3957: </div>
3958:
3959: <div class="sect1" lang="en" xml:lang="en">
3960: <div class="titlepage">
3961: <div>
3962: <div>
3963: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 3964: "id2565025" id="id2565025"></a>6.6. How can I
1.1 grant 3965: install/use X.org from pkgsrc?</h2>
3966: </div>
3967: </div>
3968: </div>
3969:
3970: <p>If you want to use X.org from pkgsrc instead of your
1.13 ! hubertf 3971: system's own X11 (<tt class="filename">/usr/X11R6</tt>,
! 3972: <tt class="filename">/usr/openwin</tt>, ...) you will
! 3973: have to add the following lines into <tt class=
! 3974: "filename">mk.conf</tt>:</p>
1.1 grant 3975: <pre class="programlisting">
3976: X11_TYPE=xorg
3977:
3978: </pre>
3979: </div>
3980:
3981: <div class="sect1" lang="en" xml:lang="en">
3982: <div class="titlepage">
3983: <div>
3984: <div>
3985: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 3986: "id2565121" id="id2565121"></a>6.7. How to
1.1 grant 3987: fetch files from behind a firewall</h2>
3988: </div>
3989: </div>
3990: </div>
3991:
3992: <p>If you are sitting behind a firewall which does not
3993: allow direct connections to Internet hosts (i.e.
3994: non-NAT), you may specify the relevant proxy hosts. This
3995: is done using an environment variable in the form of a
3996: URL e.g. in Amdahl, the machine “<span class=
3997: "quote">orpheus.amdahl.com</span>” is one of the
3998: firewalls, and it uses port 80 as the proxy port number.
3999: So the proxy environment variables are:</p>
4000: <pre class="programlisting">
4001: ftp_proxy=ftp://orpheus.amdahl.com:80/
4002: http_proxy=http://orpheus.amdahl.com:80/
4003: </pre>
4004: </div>
4005:
4006: <div class="sect1" lang="en" xml:lang="en">
4007: <div class="titlepage">
4008: <div>
4009: <div>
4010: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 4011: "id2565134" id="id2565134"></a>6.8. How do I
! 4012: tell <span><b class="command">make fetch</b></span>
! 4013: to do passive FTP?</h2>
1.1 grant 4014: </div>
4015: </div>
4016: </div>
4017:
4018: <p>This depends on which utility is used to retrieve
1.13 ! hubertf 4019: distfiles. From <tt class="filename">bsd.pkg.mk</tt>,
! 4020: <tt class="varname">FETCH_CMD</tt> is assigned the first
! 4021: available command from the following list:</p>
1.1 grant 4022: <pre class="programlisting">
4023: ${LOCALBASE}/bin/ftp
4024: /usr/bin/ftp
4025: </pre>
4026:
4027: <p>On a default NetBSD installation, this will be
1.13 ! hubertf 4028: <tt class="filename">/usr/bin/ftp</tt>, which
1.1 grant 4029: automatically tries passive connections first, and falls
4030: back to active connections if the server refuses to do
4031: passive. For the other tools, add the following to your
1.13 ! hubertf 4032: <tt class="filename">/etc/mk.conf</tt> file: <tt class=
! 4033: "varname">PASSIVE_FETCH=1</tt>.</p>
1.1 grant 4034:
1.13 ! hubertf 4035: <p>Having that option present will prevent <tt class=
! 4036: "filename">/usr/bin/ftp</tt> from falling back to active
! 4037: transfers.</p>
1.1 grant 4038: </div>
4039:
4040: <div class="sect1" lang="en" xml:lang="en">
4041: <div class="titlepage">
4042: <div>
4043: <div>
4044: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 4045: "id2565186" id="id2565186"></a>6.9. How to
1.1 grant 4046: fetch all distfiles at once</h2>
4047: </div>
4048: </div>
4049: </div>
4050:
4051: <p>You would like to download all the distfiles in a
4052: single batch from work or university, where you can't run
1.13 ! hubertf 4053: a <span><b class="command">make fetch</b></span>. There
! 4054: is an archive of distfiles on <a href=
1.1 grant 4055: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
4056: target="_top">ftp.NetBSD.org</a>, but downloading the
4057: entire directory may not be appropriate.</p>
4058:
1.13 ! hubertf 4059: <p>The answer here is to do a <span><b class=
! 4060: "command">make fetch-list</b></span> in <tt class=
! 4061: "filename">/usr/pkgsrc</tt> or one of it's
1.1 grant 4062: subdirectories, carry the resulting list to your machine
4063: at work/school and use it there If you don't have a
4064: NetBSD-compatible ftp(1) (like lukemftp) at work, don't
1.13 ! hubertf 4065: forget to set <tt class="varname">FETCH_CMD</tt> to
1.1 grant 4066: something that fetches a URL:</p>
4067:
4068: <p>At home:</p>
4069: <pre class="screen">
1.13 ! hubertf 4070: <tt class="prompt">%</tt> <b class=
! 4071: "userinput"><tt>cd /usr/pkgsrc</tt></b>
! 4072: <tt class="prompt">%</tt> <b class=
! 4073: "userinput"><tt>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</tt></b>
! 4074: <tt class="prompt">%</tt> <b class=
! 4075: "userinput"><tt>scp /tmp/fetch.sh work:/tmp</tt></b>
1.1 grant 4076: </pre>
4077:
4078: <p>At work:</p>
4079: <pre class="screen">
1.13 ! hubertf 4080: <tt class="prompt">%</tt> <b class=
! 4081: "userinput"><tt>sh /tmp/fetch.sh</tt></b>
1.1 grant 4082: </pre>
4083:
1.13 ! hubertf 4084: <p>then tar up <tt class="filename">/tmp/distfiles</tt>
! 4085: and take it home.</p>
1.1 grant 4086:
4087: <p>If you have a machine running NetBSD, and you want to
4088: get <span class="emphasis"><em>all</em></span> distfiles
4089: (even ones that aren't for your machine architecture),
4090: you can do so by using the above-mentioned
1.13 ! hubertf 4091: <span><b class="command">make fetch-list</b></span>
! 4092: approach, or fetch the distfiles directly by running:</p>
1.1 grant 4093: <pre class="screen">
1.13 ! hubertf 4094: <tt class="prompt">%</tt> <b class=
! 4095: "userinput"><tt>make mirror-distfiles</tt></b>
1.1 grant 4096: </pre>
4097:
1.13 ! hubertf 4098: <p>If you even decide to ignore <tt class=
! 4099: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</tt>, then you can
! 4100: get everything by running:</p>
1.1 grant 4101: <pre class="screen">
1.13 ! hubertf 4102: <tt class="prompt">%</tt> <b class=
! 4103: "userinput"><tt>make fetch NO_SKIP=yes</tt></b>
1.1 grant 4104: </pre>
4105: </div>
4106:
4107: <div class="sect1" lang="en" xml:lang="en">
4108: <div class="titlepage">
4109: <div>
4110: <div>
4111: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 4112: "id2565325" id="id2565325"></a>6.10. What does
1.1 grant 4113: “<span class="quote">Don't know how to make
4114: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
4115: </div>
4116: </div>
4117: </div>
4118:
4119: <p>When compiling the <a xmlns=
4120: "http://www.w3.org/TR/xhtml1/transitional" href=
4121: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.13 ! hubertf 4122: class="pkgname">pkgtools/pkg_install</a> package, you
! 4123: get the error from make that it doesn't know how to
! 4124: make <tt class=
! 4125: "filename">/usr/share/tmac/tmac.andoc</tt>? This
! 4126: indicates that you don't have installed the
! 4127: “<span class="quote">text</span>” set on
! 4128: your machine (nroff, ...). It is recommended to do
! 4129: that to format manpages.</p>
1.1 grant 4130:
4131: <p>In the case of the <a xmlns=
4132: "http://www.w3.org/TR/xhtml1/transitional" href=
4133: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.13 ! hubertf 4134: class="pkgname">pkgtools/pkg_install</a> package, you
! 4135: can get away with setting <tt class=
! 4136: "varname">NOMAN=YES</tt> either in the environment or
! 4137: in <tt class="filename">/etc/mk.conf</tt>.</p>
1.1 grant 4138: </div>
4139:
4140: <div class="sect1" lang="en" xml:lang="en">
4141: <div class="titlepage">
4142: <div>
4143: <div>
4144: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 4145: "id2565364" id="id2565364"></a>6.11. What does
1.1 grant 4146: “<span class="quote">Could not find
4147: bsd.own.mk</span>” mean?</h2>
4148: </div>
4149: </div>
4150: </div>
4151:
1.13 ! hubertf 4152: <p>You didn't install the compiler set, <tt class=
! 4153: "filename">comp.tgz</tt>, when you installed your NetBSD
! 4154: machine. Please get it and install it, by extracting it
! 4155: in <tt class="filename">/</tt>:</p>
1.1 grant 4156: <pre class="screen">
1.13 ! hubertf 4157: <tt class="prompt">#</tt> <b class="userinput"><tt>cd /</tt></b>
! 4158: <tt class="prompt">#</tt> <b class=
! 4159: "userinput"><tt>tar --unlink -zxvpf .../comp.tgz</tt></b>
1.1 grant 4160: </pre>
4161:
1.13 ! hubertf 4162: <p><tt class="filename">comp.tgz</tt> is part of every
! 4163: NetBSD release. Get the one that corresponds to your
! 4164: release (determine via <span><b class="command">uname
! 4165: -r</b></span>).</p>
1.1 grant 4166: </div>
4167:
4168: <div class="sect1" lang="en" xml:lang="en">
4169: <div class="titlepage">
4170: <div>
4171: <div>
4172: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 4173: "id2565490" id="id2565490"></a>6.12. Using
1.1 grant 4174: 'sudo' with pkgsrc</h2>
4175: </div>
4176: </div>
4177: </div>
4178:
4179: <p>When installing packages as non-root user and using
4180: the just-in-time su(1) feature of pkgsrc, it can become
4181: annoying to type in the root password for each required
4182: package installed. To avoid this, the sudo package can be
4183: used, which does password caching over a limited time. To
4184: use it, install sudo (either as binary package or from
4185: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
4186: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.13 ! hubertf 4187: class="pkgname">security/sudo</a>) and then put the
! 4188: following into your <tt class=
! 4189: "filename">/etc/mk.conf</tt>:</p>
1.1 grant 4190: <pre class="programlisting">
4191: .if exists(/usr/pkg/bin/sudo)
4192: SU_CMD=/usr/pkg/bin/sudo /bin/sh -c
4193: .endif
4194:
4195: </pre>
4196: </div>
4197:
4198: <div class="sect1" lang="en" xml:lang="en">
4199: <div class="titlepage">
4200: <div>
4201: <div>
4202: <h2 class="title" style="clear: both"><a name=
4203: "faq.conf" id=
4204: "faq.conf"></a>6.13. Configuration files
4205: handling and placement</h2>
4206: </div>
4207: </div>
4208: </div>
4209:
1.13 ! hubertf 4210: <p>The global variable <tt class=
! 4211: "varname">PKG_SYSCONFBASE</tt> (and some others) can be
! 4212: set by the system administrator in <tt class=
! 4213: "filename">/etc/mk.conf</tt> to define the place where
1.1 grant 4214: configuration files get installed. Therefore, packages
4215: must be adapted to support this feature. Keep in mind
4216: that you should only install files that are strictly
4217: necessary in the configuration directory, files that can
1.13 ! hubertf 4218: go to <tt class="filename">$PREFIX/share</tt> should go
! 4219: there.</p>
1.1 grant 4220:
4221: <p>We will take a look at available variables first
1.13 ! hubertf 4222: (<tt class="filename">bsd.pkg.mk</tt> contains more
! 4223: information). <tt class="varname">PKG_SYSCONFDIR</tt> is
! 4224: where the configuration files for a package may be found
! 4225: (that is, the full path, e.g. <tt class=
! 4226: "filename">/etc</tt> or <tt class=
! 4227: "filename">/usr/pkg/etc</tt>). This value may be
1.1 grant 4228: customized in various ways:</p>
4229:
4230: <div class="orderedlist">
4231: <ol type="1">
4232: <li>
1.13 ! hubertf 4233: <p><tt class="varname">PKG_SYSCONFBASE</tt> is the
! 4234: main config directory under which all package
1.1 grant 4235: configuration files are to be found. Users will
1.13 ! hubertf 4236: typically want to set it to <tt class=
! 4237: "filename">/etc</tt>, or accept the default
! 4238: location of <tt class=
! 4239: "filename">$PREFIX/etc</tt>.</p>
1.1 grant 4240: </li>
4241:
4242: <li>
1.13 ! hubertf 4243: <p><tt class="varname">PKG_SYSCONFSUBDIR</tt> is
! 4244: the subdirectory of <tt class=
! 4245: "varname">PKG_SYSCONFBASE</tt> under which the
1.1 grant 4246: configuration files for a particular package may be
1.13 ! hubertf 4247: found. Defaults to <tt class=
! 4248: "varname">${SYSCONFBASE}</tt>.</p>
1.1 grant 4249: </li>
4250:
4251: <li>
1.13 ! hubertf 4252: <p><tt class="varname">PKG_SYSCONFVAR</tt> is the
! 4253: special suffix used to distinguish any overriding
! 4254: values for a particular package (see next item). It
! 4255: defaults to <tt class="varname">${PKGBASE}</tt>,
! 4256: but for a collection of related packages that
! 4257: should all have the same <tt class=
! 4258: "varname">PKG_SYSCONFDIR</tt> value, it can be set
! 4259: in each of the package Makefiles to a common
! 4260: value.</p>
1.1 grant 4261: </li>
4262:
4263: <li>
1.13 ! hubertf 4264: <p><tt class=
! 4265: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</tt>
! 4266: overrides the value of <tt class=
! 4267: "varname">${PKG_SYSCONFDIR}</tt> for packages with
! 4268: the same value for <tt class=
! 4269: "varname">PKG_SYSCONFVAR</tt>.</p>
1.1 grant 4270:
4271: <p>As an example, all the various KDE packages may
1.13 ! hubertf 4272: want to set <tt class="varname">PKG_SYSCONFVAR</tt>
! 4273: to “<span class="quote">kde</span>” so
! 4274: admins can set <tt class=
! 4275: "varname">PKG_SYSCONFDIR.kde</tt> in <tt class=
! 4276: "filename">/etc/mk.conf</tt> to define where to
1.1 grant 4277: install KDE config files.</p>
4278: </li>
4279: </ol>
4280: </div>
4281:
4282: <p>Programs' configuration directory should be defined
4283: during the configure stage. Packages that use GNU
4284: autoconf can usually do this by using the
4285: “<span class="quote">--sysconfdir</span>”
4286: parameter, but this brings some problems as we will see
4287: now. When you change this pathname in packages, you
4288: should not allow them to install files in that directory
4289: directly. Instead they need to install those files under
1.13 ! hubertf 4290: <tt class="filename">share/examples/${PKGNAME}</tt> so
! 4291: <tt class="filename">PLIST</tt> can register them.</p>
1.1 grant 4292:
4293: <p>Once you have the required configuration files in
1.13 ! hubertf 4294: place (under the <tt class="filename">share/examples</tt>
! 4295: directory) the variable <tt class=
! 4296: "varname">CONF_FILES</tt> should be set to copy them into
! 4297: <tt class="varname">PKG_SYSCONFDIR</tt>. The contents of
! 4298: this variable is formed by pairs of filenames; the first
1.1 grant 4299: element of the pair specifies the file inside the
1.13 ! hubertf 4300: examples directory (registered by <tt class=
! 4301: "filename">PLIST</tt>) and the second element specifies
1.1 grant 4302: the target file. This is done this way to allow binary
4303: packages to place files in the right directory using
1.13 ! hubertf 4304: <tt class="filename">INSTALL</tt>/<tt class=
! 4305: "filename">DEINSTALL</tt> scripts which are created
! 4306: automatically. The package <tt class=
! 4307: "filename">Makefile</tt> must also set <tt class=
! 4308: "varname">USE_PKGINSTALL=YES</tt> to use these
1.1 grant 4309: automatically generated scripts. The automatic copying of
4310: config files can be toggled by setting the environment
1.13 ! hubertf 4311: variable <tt class="varname">PKG_CONFIG</tt> prior to
1.1 grant 4312: package installation.</p>
4313:
4314: <p>Here is an example, taken from mail/mutt/Makefile:</p>
4315: <pre class="programlisting">
4316: EGDIR= ${PREFIX}/share/doc/mutt/samples
4317: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
4318: </pre>
4319:
4320: <p>As you can see, this package installs configuration
1.13 ! hubertf 4321: files inside <tt class="varname">EGDIR</tt>, which are
! 4322: registered by <tt class="filename">PLIST</tt>. After
! 4323: that, the variable <tt class="varname">CONF_FILES</tt>
! 4324: lists the installed file first and then the target file.
! 4325: Users will also get an automatic message when files are
! 4326: installed using this method.</p>
1.1 grant 4327: </div>
4328:
4329: <div class="sect1" lang="en" xml:lang="en">
4330: <div class="titlepage">
4331: <div>
4332: <div>
4333: <h2 class="title" style="clear: both"><a name=
4334: "audit-packages" id=
4335: "audit-packages"></a>6.14. Automated security
4336: checks</h2>
4337: </div>
4338: </div>
4339: </div>
4340:
4341: <p>Please be aware that there can often be bugs in
4342: third-party software, and some of these bugs can leave a
4343: machine vulnerable to exploitation by attackers. In an
4344: effort to lessen the exposure, the NetBSD packages team
4345: maintains a database of known-exploits to packages which
4346: have at one time been included in pkgsrc. The database
4347: can be downloaded automatically, and a security audit of
4348: all packages installed on a system can take place. To do
4349: this, install the <a xmlns=
4350: "http://www.w3.org/TR/xhtml1/transitional" href=
4351: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.13 ! hubertf 4352: class="pkgname">security/audit-packages</a> package.
! 4353: It has two components:</p>
1.1 grant 4354:
4355: <div class="orderedlist">
4356: <ol type="1">
4357: <li>
4358: <p>“<span class=
4359: "quote">download-vulnerability-list</span>”,
4360: an easy way to download a list of the security
4361: vulnerabilities information. This list is kept up
4362: to date by the NetBSD security officer and the
4363: NetBSD packages team, and is distributed from the
4364: NetBSD ftp server:</p>
4365:
4366: <p><a href=
4367: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.13 ! hubertf 4368: target=
! 4369: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 4370: </li>
4371:
4372: <li>
4373: <p>“<span class=
4374: "quote">audit-packages</span>”, an easy way
4375: to audit the current machine, checking each
4376: vulnerability which is known. If a vulnerable
4377: package is installed, it will be shown by output to
4378: stdout, including a description of the type of
4379: vulnerability, and a URL containing more
4380: information.</p>
4381: </li>
4382: </ol>
4383: </div>
4384:
4385: <p>Use of the audit-packages package is strongly
4386: recommended!</p>
4387:
4388: <p>The following message is displayed as part of the
4389: audit-packages installation procedure:</p>
4390: <pre class="screen">
4391: ===========================================================================
1.11 ben 4392: $NetBSD: faq.xml,v 1.2 2004/11/20 13:25:22 hubertf Exp $
1.1 grant 4393:
4394: You may wish to have the vulnerabilities file downloaded daily so that
4395: it remains current. This may be done by adding an appropriate entry
4396: to the root users crontab(5) entry. For example the entry
4397:
4398: # download vulnerabilities file
4399: 0 3 * * * ${PREFIX}/sbin/download-vulnerability-list >/dev/null 2>&1
4400:
4401: will update the vulnerability list every day at 3AM. You may wish to do
4402: this more often than once a day.
4403:
4404: In addition, you may wish to run the package audit from the daily
4405: security script. This may be accomplished by adding the following
4406: lines to /etc/security.local
4407:
4408: if [ -x ${PREFIX}/sbin/audit-packages ]; then
4409: ${PREFIX}/sbin/audit-packages
4410: fi
4411:
4412: ===========================================================================
4413:
4414: </pre>
4415: </div>
4416: </div>
4417: </div>
4418:
4419: <div class="part" lang="en" xml:lang="en">
4420: <div class="titlepage">
4421: <div>
4422: <div>
4423: <h1 class="title"><a name="developers-guide" id=
1.2 hubertf 4424: "developers-guide"></a>The pkgsrc developer's
4425: guide</h1>
1.1 grant 4426: </div>
4427: </div>
4428: </div>
4429:
4430: <div class="toc">
4431: <p><b>Table of Contents</b></p>
4432:
4433: <dl>
4434: <dt><span class="chapter"><a href="#components">7.
4435: Package components - files, directories and
4436: contents</a></span></dt>
4437:
4438: <dd>
4439: <dl>
4440: <dt><span class="sect1"><a href=
1.13 ! hubertf 4441: "#components.Makefile">7.1. Makefile</a></span></dt>
1.1 grant 4442:
4443: <dt><span class="sect1"><a href=
1.13 ! hubertf 4444: "#components.distinfo">7.2. distinfo</a></span></dt>
1.1 grant 4445:
4446: <dt><span class="sect1"><a href=
4447: "#components.patches">7.3. patches/*</a></span></dt>
4448:
1.13 ! hubertf 4449: <dt><span class="sect1"><a href="#id2566535">7.4.
1.1 grant 4450: Other mandatory files</a></span></dt>
4451:
4452: <dt><span class="sect1"><a href=
4453: "#components.optional">7.5. Optional
4454: files</a></span></dt>
4455:
1.13 ! hubertf 4456: <dt><span class="sect1"><a href="#id2566729">7.6.
! 4457: work*</a></span></dt>
1.1 grant 4458:
1.13 ! hubertf 4459: <dt><span class="sect1"><a href="#id2566817">7.7.
! 4460: files/*</a></span></dt>
1.1 grant 4461: </dl>
4462: </dd>
4463:
4464: <dt><span class="chapter"><a href="#plist">8. PLIST
4465: issues</a></span></dt>
4466:
4467: <dd>
4468: <dl>
1.13 ! hubertf 4469: <dt><span class="sect1"><a href="#id2566871">8.1. RCS
1.1 grant 4470: ID</a></span></dt>
4471:
1.13 ! hubertf 4472: <dt><span class="sect1"><a href="#id2566886">8.2.
! 4473: Semi-automatic PLIST generation</a></span></dt>
1.1 grant 4474:
4475: <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.13 ! hubertf 4476: Tweaking output of make print-PLIST</a></span></dt>
1.1 grant 4477:
4478: <dt><span class="sect1"><a href="#plist.misc">8.4.
4479: Variable substitution in PLIST</a></span></dt>
4480:
1.13 ! hubertf 4481: <dt><span class="sect1"><a href="#id2567139">8.5.
1.1 grant 4482: Manpage-compression</a></span></dt>
4483:
1.13 ! hubertf 4484: <dt><span class="sect1"><a href="#id2567249">8.6.
! 4485: Changing PLIST source with PLIST_SRC</a></span></dt>
1.1 grant 4486:
1.13 ! hubertf 4487: <dt><span class="sect1"><a href="#id2567266">8.7.
1.1 grant 4488: Platform specific and differing
4489: PLISTs</a></span></dt>
4490:
4491: <dt><span class="sect1"><a href=
4492: "#faq.common-dirs">8.8. Sharing directories between
4493: packages</a></span></dt>
4494: </dl>
4495: </dd>
4496:
4497: <dt><span class="chapter"><a href="#buildlink">9.
4498: Buildlink methodology</a></span></dt>
4499:
4500: <dd>
4501: <dl>
1.13 ! hubertf 4502: <dt><span class="sect1"><a href="#id2567742">9.1.
1.1 grant 4503: Converting packages to use buildlink3</a></span></dt>
4504:
1.13 ! hubertf 4505: <dt><span class="sect1"><a href="#id2567933">9.2.
! 4506: Writing buildlink3.mk files</a></span></dt>
1.1 grant 4507:
4508: <dd>
4509: <dl>
4510: <dt><span class="sect2"><a href=
1.13 ! hubertf 4511: "#id2568003">9.2.1. Anatomy of a buildlink3.mk
1.1 grant 4512: file</a></span></dt>
4513:
4514: <dt><span class="sect2"><a href=
1.13 ! hubertf 4515: "#id2568375">9.2.2. Updating
! 4516: BUILDLINK_DEPENDS.pkg in buildlink3.mk
1.1 grant 4517: files</a></span></dt>
4518: </dl>
4519: </dd>
4520:
1.13 ! hubertf 4521: <dt><span class="sect1"><a href="#id2568590">9.3.
! 4522: Writing builtin.mk files</a></span></dt>
1.1 grant 4523:
4524: <dd>
4525: <dl>
4526: <dt><span class="sect2"><a href=
1.13 ! hubertf 4527: "#id2568672">9.3.1. Anatomy of a builtin.mk
! 4528: file</a></span></dt>
1.1 grant 4529:
4530: <dt><span class="sect2"><a href=
1.13 ! hubertf 4531: "#id2568899">9.3.2. Global preferences for native
1.1 grant 4532: or pkgsrc software</a></span></dt>
4533: </dl>
4534: </dd>
4535: </dl>
4536: </dd>
4537:
4538: <dt><span class="chapter"><a href="#options">10. Options
4539: handling</a></span></dt>
4540:
4541: <dd>
4542: <dl>
1.13 ! hubertf 4543: <dt><span class="sect1"><a href="#id2568971">10.1.
1.1 grant 4544: Global default options</a></span></dt>
4545:
1.13 ! hubertf 4546: <dt><span class="sect1"><a href="#id2568986">10.2.
! 4547: Converting packages to use
! 4548: bsd.options.mk</a></span></dt>
1.1 grant 4549: </dl>
4550: </dd>
4551:
4552: <dt><span class="chapter"><a href="#build">11. The build
4553: process</a></span></dt>
4554:
4555: <dd>
4556: <dl>
4557: <dt><span class="sect1"><a href="#build.prefix">11.1.
4558: Program location</a></span></dt>
4559:
1.13 ! hubertf 4560: <dt><span class="sect1"><a href="#id2569662">11.2.
1.1 grant 4561: Main targets</a></span></dt>
4562:
4563: <dt><span class="sect1"><a href=
4564: "#build.helpful-targets">11.3. Other helpful
4565: targets</a></span></dt>
4566: </dl>
4567: </dd>
4568:
4569: <dt><span class="chapter"><a href="#fixes">12. Notes on
4570: fixes for packages</a></span></dt>
4571:
4572: <dd>
4573: <dl>
1.13 ! hubertf 4574: <dt><span class="sect1"><a href="#id2571063">12.1.
1.1 grant 4575: General operation</a></span></dt>
4576:
4577: <dd>
4578: <dl>
4579: <dt><span class="sect2"><a href=
1.13 ! hubertf 4580: "#id2571066">12.1.1. How to pull in variables
1.1 grant 4581: from /etc/mk.conf</a></span></dt>
4582:
4583: <dt><span class="sect2"><a href=
1.13 ! hubertf 4584: "#id2571149">12.1.2. Restricted
1.1 grant 4585: packages</a></span></dt>
4586:
4587: <dt><span class="sect2"><a href=
4588: "#dependencies">12.1.3. Handling
4589: dependencies</a></span></dt>
4590:
4591: <dt><span class="sect2"><a href=
1.13 ! hubertf 4592: "#id2571733">12.1.4. Handling conflicts with
1.1 grant 4593: other packages</a></span></dt>
4594:
4595: <dt><span class="sect2"><a href=
1.13 ! hubertf 4596: "#id2571851">12.1.5. Packages that cannot or
1.1 grant 4597: should not be built</a></span></dt>
4598:
4599: <dt><span class="sect2"><a href=
1.13 ! hubertf 4600: "#id2571877">12.1.6. Packages which should not be
1.1 grant 4601: deleted, once installed</a></span></dt>
4602:
4603: <dt><span class="sect2"><a href=
4604: "#security-handling">12.1.7. Handling packages
4605: with security problems</a></span></dt>
4606:
4607: <dt><span class="sect2"><a href=
1.13 ! hubertf 4608: "#id2571969">12.1.8. How to handle compiler
1.1 grant 4609: bugs</a></span></dt>
4610:
4611: <dt><span class="sect2"><a href=
1.13 ! hubertf 4612: "#id2571991">12.1.9. How to handle incrementing
1.1 grant 4613: versions when fixing an existing
4614: package</a></span></dt>
4615:
4616: <dt><span class="sect2"><a href=
1.13 ! hubertf 4617: "#id2572108">12.1.10. Portability of
1.1 grant 4618: packages</a></span></dt>
4619: </dl>
4620: </dd>
4621:
1.13 ! hubertf 4622: <dt><span class="sect1"><a href="#id2572133">12.2.
1.1 grant 4623: Possible downloading issues</a></span></dt>
4624:
4625: <dd>
4626: <dl>
4627: <dt><span class="sect2"><a href=
1.13 ! hubertf 4628: "#id2572136">12.2.1. Packages whose distfiles
1.1 grant 4629: aren't available for plain
4630: downloading</a></span></dt>
4631:
4632: <dt><span class="sect2"><a href=
1.13 ! hubertf 4633: "#id2572267">12.2.2. How to handle modified
1.1 grant 4634: distfiles with the 'old' name</a></span></dt>
4635: </dl>
4636: </dd>
4637:
1.13 ! hubertf 4638: <dt><span class="sect1"><a href="#id2572279">12.3.
1.1 grant 4639: Configuration gotchas</a></span></dt>
4640:
4641: <dd>
4642: <dl>
4643: <dt><span class="sect2"><a href=
4644: "#fixes.libtool">12.3.1. Shared libraries -
4645: libtool</a></span></dt>
4646:
4647: <dt><span class="sect2"><a href=
1.13 ! hubertf 4648: "#id2572618">12.3.2. Using libtool on GNU
1.1 grant 4649: packages that already support
4650: libtool</a></span></dt>
4651:
4652: <dt><span class="sect2"><a href=
1.13 ! hubertf 4653: "#id2572702">12.3.3. GNU
1.1 grant 4654: Autoconf/Automake</a></span></dt>
4655: </dl>
4656: </dd>
4657:
1.13 ! hubertf 4658: <dt><span class="sect1"><a href="#id2572747">12.4.
1.1 grant 4659: Building considerations</a></span></dt>
4660:
4661: <dd>
4662: <dl>
4663: <dt><span class="sect2"><a href=
1.13 ! hubertf 4664: "#id2572750">12.4.1. CPP defines</a></span></dt>
1.1 grant 4665: </dl>
4666: </dd>
4667:
1.13 ! hubertf 4668: <dt><span class="sect1"><a href="#id2572780">12.5.
1.1 grant 4669: Package specific actions</a></span></dt>
4670:
4671: <dd>
4672: <dl>
4673: <dt><span class="sect2"><a href=
1.13 ! hubertf 4674: "#id2572784">12.5.1. Package configuration
1.1 grant 4675: files</a></span></dt>
4676:
4677: <dt><span class="sect2"><a href=
1.13 ! hubertf 4678: "#id2573022">12.5.2. User
1.2 hubertf 4679: interaction</a></span></dt>
1.1 grant 4680:
4681: <dt><span class="sect2"><a href=
1.13 ! hubertf 4682: "#id2573136">12.5.3. Handling
1.1 grant 4683: licenses</a></span></dt>
4684:
4685: <dt><span class="sect2"><a href=
1.13 ! hubertf 4686: "#id2573287">12.5.4. Creating an account from a
1.1 grant 4687: package</a></span></dt>
4688:
4689: <dt><span class="sect2"><a href=
1.13 ! hubertf 4690: "#id2573349">12.5.5. Installing score
1.1 grant 4691: files</a></span></dt>
4692:
4693: <dt><span class="sect2"><a href=
1.13 ! hubertf 4694: "#id2573393">12.5.6. Packages providing login
1.1 grant 4695: shells</a></span></dt>
4696:
4697: <dt><span class="sect2"><a href=
1.13 ! hubertf 4698: "#id2573518">12.5.7. Packages containing perl
1.1 grant 4699: scripts</a></span></dt>
4700:
4701: <dt><span class="sect2"><a href=
1.13 ! hubertf 4702: "#id2573537">12.5.8. Packages with hardcoded
1.1 grant 4703: paths to other interpreters</a></span></dt>
4704:
4705: <dt><span class="sect2"><a href=
1.13 ! hubertf 4706: "#id2573558">12.5.9. Packages installing perl
1.1 grant 4707: modules</a></span></dt>
4708:
4709: <dt><span class="sect2"><a href=
4710: "#faq.info-files">12.5.10. Packages installing
4711: info files</a></span></dt>
4712:
4713: <dt><span class="sect2"><a href=
1.13 ! hubertf 4714: "#id2573778">12.5.11. Packages installing GConf2
1.1 grant 4715: data files</a></span></dt>
4716:
4717: <dt><span class="sect2"><a href=
1.13 ! hubertf 4718: "#id2573946">12.5.12. Packages installing
1.1 grant 4719: scrollkeeper data files</a></span></dt>
4720:
4721: <dt><span class="sect2"><a href=
1.13 ! hubertf 4722: "#id2573997">12.5.13. Packages installing X11
1.1 grant 4723: fonts</a></span></dt>
4724:
4725: <dt><span class="sect2"><a href=
1.13 ! hubertf 4726: "#id2574044">12.5.14. Packages installing GTK2
1.1 grant 4727: modules</a></span></dt>
4728:
4729: <dt><span class="sect2"><a href=
1.13 ! hubertf 4730: "#id2574114">12.5.15. Packages installing SGML or
1.1 grant 4731: XML data</a></span></dt>
4732:
4733: <dt><span class="sect2"><a href=
1.13 ! hubertf 4734: "#id2574234">12.5.16. Packages installing
1.1 grant 4735: extensions to the MIME database</a></span></dt>
4736:
4737: <dt><span class="sect2"><a href=
1.13 ! hubertf 4738: "#id2574305">12.5.17. Packages using
1.1 grant 4739: intltool</a></span></dt>
4740: </dl>
4741: </dd>
4742:
1.13 ! hubertf 4743: <dt><span class="sect1"><a href="#id2574318">12.6.
1.1 grant 4744: Feedback to the author</a></span></dt>
4745: </dl>
4746: </dd>
4747:
4748: <dt><span class="chapter"><a href="#debug">13.
4749: Debugging</a></span></dt>
4750:
4751: <dt><span class="chapter"><a href="#submit">14.
4752: Submitting and Committing</a></span></dt>
4753:
4754: <dd>
4755: <dl>
1.13 ! hubertf 4756: <dt><span class="sect1"><a href="#id2574849">14.1.
1.1 grant 4757: Submitting your packages</a></span></dt>
4758:
1.13 ! hubertf 4759: <dt><span class="sect1"><a href="#id2575036">14.2.
1.1 grant 4760: Committing: Importing a package into
4761: CVS</a></span></dt>
4762:
1.13 ! hubertf 4763: <dt><span class="sect1"><a href="#id2575168">14.3.
1.2 hubertf 4764: Updating a package to a newer version</a></span></dt>
1.1 grant 4765:
1.13 ! hubertf 4766: <dt><span class="sect1"><a href="#id2575187">14.4.
1.2 hubertf 4767: Moving a package in pkgsrc</a></span></dt>
1.1 grant 4768: </dl>
4769: </dd>
4770: </dl>
4771: </div>
4772:
4773: <div class="chapter" lang="en" xml:lang="en">
4774: <div class="titlepage">
4775: <div>
4776: <div>
4777: <h2 class="title"><a name="components" id=
4778: "components"></a>Chapter 7. Package
4779: components - files, directories and contents</h2>
4780: </div>
4781: </div>
4782: </div>
4783:
4784: <div class="toc">
4785: <p><b>Table of Contents</b></p>
4786:
4787: <dl>
4788: <dt><span class="sect1"><a href=
1.13 ! hubertf 4789: "#components.Makefile">7.1. Makefile</a></span></dt>
1.1 grant 4790:
4791: <dt><span class="sect1"><a href=
1.13 ! hubertf 4792: "#components.distinfo">7.2. distinfo</a></span></dt>
1.1 grant 4793:
4794: <dt><span class="sect1"><a href=
4795: "#components.patches">7.3. patches/*</a></span></dt>
4796:
1.13 ! hubertf 4797: <dt><span class="sect1"><a href="#id2566535">7.4. Other
1.1 grant 4798: mandatory files</a></span></dt>
4799:
4800: <dt><span class="sect1"><a href=
4801: "#components.optional">7.5. Optional
4802: files</a></span></dt>
4803:
1.13 ! hubertf 4804: <dt><span class="sect1"><a href="#id2566729">7.6.
! 4805: work*</a></span></dt>
1.1 grant 4806:
1.13 ! hubertf 4807: <dt><span class="sect1"><a href="#id2566817">7.7.
! 4808: files/*</a></span></dt>
1.1 grant 4809: </dl>
4810: </div>
4811:
4812: <p>Whenever you're preparing a package, there are a number
4813: of files involved which are described in the following
4814: sections.</p>
4815:
4816: <div class="sect1" lang="en" xml:lang="en">
4817: <div class="titlepage">
4818: <div>
4819: <div>
4820: <h2 class="title" style="clear: both"><a name=
4821: "components.Makefile" id=
1.13 ! hubertf 4822: "components.Makefile"></a>7.1. <tt class=
! 4823: "filename">Makefile</tt></h2>
1.1 grant 4824: </div>
4825: </div>
4826: </div>
4827:
4828: <p>Building, installation and creation of a binary
1.13 ! hubertf 4829: package are all controlled by the package's <tt class=
! 4830: "filename">Makefile</tt>.</p>
1.1 grant 4831:
1.13 ! hubertf 4832: <p>There is a <tt class="filename">Makefile</tt> for each
! 4833: package. This file includes the standard <tt class=
! 4834: "filename">bsd.pkg.mk</tt> file (referenced as <tt class=
! 4835: "filename">../../mk/bsd.pkg.mk</tt>), which sets all the
! 4836: definitions and actions necessary for the package to
! 4837: compile and install itself. The mandatory variables are
! 4838: the <tt class="varname">DISTNAME</tt> which specifies the
! 4839: base name of the distribution file to be downloaded from
! 4840: the site on the Internet, <tt class=
! 4841: "varname">MASTER_SITES</tt> which specifies that site,
! 4842: <tt class="varname">CATEGORIES</tt> which denotes the
! 4843: categories into which the package falls, <tt class=
! 4844: "varname">PKGNAME</tt> which is the name of the package,
! 4845: the <tt class="varname">MAINTAINER</tt>'s name, and the
! 4846: <tt class="varname">COMMENT</tt> variable, which should
! 4847: contain a one-line description of the package (the
! 4848: package name should not appear, it will be added
! 4849: automatically). The maintainer variable is there so that
! 4850: anyone who quibbles with the (always completely correct)
! 4851: decisions taken by the guy who maintains the package can
! 4852: complain vigorously, or send chocolate as a sign of
! 4853: appreciation.</p>
1.1 grant 4854:
1.13 ! hubertf 4855: <p>The <tt class="varname">MASTER_SITES</tt> may be set
! 4856: to one of the predefined sites:</p>
1.1 grant 4857: <pre class="programlisting">
4858: ${MASTER_SITE_APACHE}
4859: ${MASTER_SITE_DEBIAN}
4860: ${MASTER_SITE_GNOME}
4861: ${MASTER_SITE_GNU}
4862: ${MASTER_SITE_GNUSTEP}
1.9 dillo 4863: ${MASTER_SITE_IFARCHIVE}
1.1 grant 4864: ${MASTER_SITE_MOZILLA}
4865: ${MASTER_SITE_PERL_CPAN}
4866: ${MASTER_SITE_SOURCEFORGE}
4867: ${MASTER_SITE_SUNSITE}
4868: ${MASTER_SITE_R_CRAN}
4869: ${MASTER_SITE_SUSE}
4870: ${MASTER_SITE_TEX_CTAN}
4871: ${MASTER_SITE_XCONTRIB}
4872: ${MASTER_SITE_XEMACS}
4873: </pre>
4874:
4875: <p>If one of these predefined sites is chosen, you may
4876: require the ability to specify a subdirectory of that
4877: site. Since these macros may expand to more than one
4878: actual site, you <span class=
4879: "emphasis"><em>must</em></span> use the following
4880: construct to specify a subdirectory:</p>
4881: <pre class="programlisting">
4882: ${MASTER_SITE_GNU:=subdirectory/name/}
4883: ${MASTER_SITE_SOURCEFORGE:=project_name/}
4884: </pre>
4885:
4886: <p>Note the trailing slash after the subdirectory
4887: name.</p>
4888:
4889: <div class="note" style=
4890: "margin-left: 0.5in; margin-right: 0.5in;">
4891: <h3 class="title">Note</h3>
4892:
1.13 ! hubertf 4893: <p><tt class="varname">MASTER_SITE_SUBDIR</tt> has been
! 4894: deprecated and <span class="emphasis"><em>should no
! 4895: longer be used</em></span>.</p>
1.1 grant 4896: </div>
4897:
1.13 ! hubertf 4898: <p>If the package has multiple <tt class=
! 4899: "varname">DISTFILES</tt> or multiple <tt class=
! 4900: "varname">PATCHFILES</tt> from different sites, set
! 4901: <tt class="varname">SITES_foo</tt> to a list of URI's
1.1 grant 4902: where file “<span class="quote">foo</span>”
4903: may be found. “<span class=
4904: "quote">foo</span>” includes the suffix, e.g.</p>
4905: <pre class="programlisting">
4906: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
4907: DISTFILES+= foo-file.tar.gz
4908: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
4909: http://www.somewhereelse.com/mirror/somehow/
4910: </pre>
4911:
1.13 ! hubertf 4912: <p>Note that the normal default setting of <tt class=
! 4913: "varname">DISTFILES</tt> must be made explicit if you
1.1 grant 4914: want to add to it (rather than replace it), as you
4915: usually would.</p>
4916:
4917: <p>Currently the following values are available for
1.13 ! hubertf 4918: <tt class="varname">CATEGORIES</tt>. If more than one is
! 4919: used, they need to be separated by spaces:</p>
1.1 grant 4920: <pre class="programlisting">
4921: archivers cross geography meta-pkgs security
4922: audio databases graphics misc shells
4923: benchmarks devel ham multimedia sysutils
4924: biology editors inputmethod net textproc
4925: cad emulators lang news time
4926: chat finance mail parallel wm
4927: comms fonts math pkgtools www
4928: converters games mbone print x11
4929: </pre>
4930:
4931: <p>Please pay attention to the following gotchas:</p>
4932:
4933: <div class="itemizedlist">
4934: <ul type="disc">
4935: <li>
1.13 ! hubertf 4936: <p>Add <tt class="varname">MANCOMPRESSED</tt> if
! 4937: manpages are installed in compressed form by the
! 4938: package; see comment in <tt class=
! 4939: "filename">bsd.pkg.mk</tt>.</p>
1.1 grant 4940: </li>
4941:
4942: <li>
1.13 ! hubertf 4943: <p>Replace <tt class="filename">/usr/local</tt>
1.1 grant 4944: with “<span class=
4945: "quote">${PREFIX}</span>” in all files (see
4946: patches, below).</p>
4947: </li>
4948:
4949: <li>
4950: <p>If the package installs any info files, see
4951: <a href="#faq.info-files" title=
4952: "12.5.10. Packages installing info files">Section
4953: 12.5.10, “Packages installing info
4954: files”</a>.</p>
4955: </li>
4956:
4957: <li>
1.13 ! hubertf 4958: <p>Set <tt class="varname">MAINTAINER</tt> to be
! 4959: yourself. If you really can't maintain the package
! 4960: for future updates, set it to <tt class=
1.1 grant 4961: "email"><<a href=
1.13 ! hubertf 4962: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></tt>.</p>
1.1 grant 4963: </li>
4964:
4965: <li>
4966: <p>If a home page for the software in question
1.13 ! hubertf 4967: exists, add the variable <tt class=
! 4968: "varname">HOMEPAGE</tt> right after <tt class=
! 4969: "varname">MAINTAINER</tt>. The value of this
1.1 grant 4970: variable should be the URL for the home page.</p>
4971: </li>
4972:
4973: <li>
1.13 ! hubertf 4974: <p>Be sure to set the <tt class=
! 4975: "varname">COMMENT</tt> variable to a short
1.1 grant 4976: description of the package, not containing the
4977: pkg's name.</p>
4978: </li>
4979: </ul>
4980: </div>
4981: </div>
4982:
4983: <div class="sect1" lang="en" xml:lang="en">
4984: <div class="titlepage">
4985: <div>
4986: <div>
4987: <h2 class="title" style="clear: both"><a name=
4988: "components.distinfo" id=
1.13 ! hubertf 4989: "components.distinfo"></a>7.2. <tt class=
! 4990: "filename">distinfo</tt></h2>
1.1 grant 4991: </div>
4992: </div>
4993: </div>
4994:
4995: <p>Most important, the mandatory message digest, or
4996: checksum, of all the distfiles needed for the package to
4997: compile, confirming they match the original file
4998: distributed by the author. This ensures that the distfile
4999: retrieved from the Internet has not been corrupted during
5000: transfer or altered by a malign force to introduce a
1.13 ! hubertf 5001: security hole. It is generated using the <span><b class=
! 5002: "command">make makesum</b></span> command. The digest
! 5003: algorithm used was, at one stage, md5, but that was felt
! 5004: lacking compared to sha1, and so sha1 is now the default
1.1 grant 5005: algorithm. The distfile size is also generated and stored
5006: in new distinfo files. The <a xmlns=
5007: "http://www.w3.org/TR/xhtml1/transitional" href=
5008: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.13 ! hubertf 5009: class="pkgname">pkgtools/digest</a> utility calculates
! 5010: all of the digests in the distinfo file, and it
! 5011: provides various different algorithms. At the current
! 5012: time, the algorithms provided are: <span class=
! 5013: "emphasis"><em>md5</em></span>, <span class=
! 5014: "emphasis"><em>rmd160</em></span>, <span class=
! 5015: "emphasis"><em>sha1</em></span>, <span class=
! 5016: "emphasis"><em>sha256</em></span>, <span class=
! 5017: "emphasis"><em>sha384</em></span> and <span class=
! 5018: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 5019:
5020: <p>Some packages have different sets of distfiles on a
5021: per architecture basis, for example <a xmlns=
5022: "http://www.w3.org/TR/xhtml1/transitional" href=
5023: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.13 ! hubertf 5024: class="pkgname">www/navigator</a>). These are kept in
! 5025: the same distinfo file and care should be taken when
! 5026: upgrading such a package to ensure distfile
! 5027: information is not lost.</p>
1.1 grant 5028:
5029: <p>The message digest/checksum for all the official
1.13 ! hubertf 5030: patches found in the <tt class="filename">patches/</tt>
! 5031: directory (see <a href="#components.patches" title=
1.1 grant 5032: "7.3. patches/*">Section 7.3,
5033: “patches/*”</a>) for the package is also
1.13 ! hubertf 5034: stored in the <tt class="filename">distinfo</tt> file.
! 5035: This is a message digest/checksum of all lines in the
! 5036: patch file except the NetBSD RCS Id. This file is
! 5037: generated by invoking <span><b class="command">make
! 5038: makepatchsum</b></span> (or <span><b class="command">make
! 5039: mps</b></span> if you're in a hurry).</p>
1.1 grant 5040: </div>
5041:
5042: <div class="sect1" lang="en" xml:lang="en">
5043: <div class="titlepage">
5044: <div>
5045: <div>
5046: <h2 class="title" style="clear: both"><a name=
5047: "components.patches" id=
5048: "components.patches"></a>7.3. patches/*</h2>
5049: </div>
5050: </div>
5051: </div>
5052:
5053: <p>This directory contains files that are used by the
5054: <a href=
5055: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
5056: <span class="citerefentry"><span class=
5057: "refentrytitle">patch</span>(1)</span></a> command to
5058: modify the sources as distributed in the distribution
5059: file into a form that will compile and run perfectly on
5060: NetBSD. The files are applied successively in alphabetic
5061: order (as returned by a shell “<span class=
5062: "quote">patches/patch-*</span>” glob expansion), so
1.13 ! hubertf 5063: <tt class="filename">patch-aa</tt> is applied before
! 5064: <tt class="filename">patch-ab</tt>, etc.</p>
1.1 grant 5065:
1.13 ! hubertf 5066: <p>The <tt class="filename">patch-*</tt> files should be
! 5067: in <span><b class="command">diff -bu</b></span> format,
! 5068: and apply without a fuzz to avoid problems. (To force
! 5069: patches to apply with fuzz you can set <tt class=
! 5070: "varname">PATCH_FUZZ_FACTOR=-F2</tt>). Furthermore, do
1.1 grant 5071: not put changes for more than one file into a single
5072: patch-file, as this will make future modifications more
5073: difficult.</p>
5074:
5075: <p>Similar, a file should be patched at most once, not
5076: several times by several different patches. If a file
5077: needs several patches, they should be combined into one
5078: file.</p>
5079:
5080: <p>One important thing to mention is to pay attention
5081: that no RCS IDs get stored in the patch files, as these
5082: will cause problems when later checked into the NetBSD
1.13 ! hubertf 5083: CVS tree. Use the <span><b class=
! 5084: "command">pkgdiff</b></span> from the <a xmlns=
1.1 grant 5085: "http://www.w3.org/TR/xhtml1/transitional" href=
5086: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.13 ! hubertf 5087: class="pkgname">pkgtools/pkgdiff</a> package to avoid
! 5088: these problems.</p>
1.1 grant 5089:
5090: <p>For even more automation, we recommend using
1.13 ! hubertf 5091: <span><b class="command">mkpatches</b></span> from the
! 5092: same package to make a whole set of patches. You just
! 5093: have to backup files before you edit them to <tt class=
! 5094: "filename">filename.orig</tt>, e.g. with <span><b class=
! 5095: "command">cp -p filename filename.orig</b></span> or,
! 5096: easier, by using <span><b class=
! 5097: "command">pkgvi</b></span> again from the same package.
! 5098: If you upgrade a package this way, you can easily compare
! 5099: the new set of patches with the previously existing one
! 5100: with <span><b class="command">patchdiff</b></span>.</p>
1.1 grant 5101:
5102: <p>When you have finished a package, remember to generate
5103: the checksums for the patch files by using the
1.13 ! hubertf 5104: <span><b class="command">make makepatchsum</b></span>
! 5105: command, see <a href="#components.distinfo" title=
1.5 hubertf 5106: "7.2. distinfo">Section 7.2,
1.13 ! hubertf 5107: “distinfo”</a>.</p>
1.1 grant 5108:
5109: <p>Patch files that are distributed by the author or
1.13 ! hubertf 5110: other maintainers can be listed in <tt class=
! 5111: "varname">$PATCHFILES</tt>.</p>
1.1 grant 5112:
5113: <p>If it is desired to store any patches that should not
5114: be committed into pkgsrc, they can be kept outside the
1.13 ! hubertf 5115: pkgsrc tree in the <tt class=
! 5116: "filename">$LOCALPATCHES</tt> directory. The directory
1.1 grant 5117: tree there is expected to have the same
5118: “<span class="quote">category/package</span>”
5119: structure as pkgsrc, and patches are expected to be
1.13 ! hubertf 5120: stored inside these dirs (also known as <tt class=
! 5121: "filename">$LOCALPATCHES/$PKGPATH</tt>). For example if
! 5122: you want to keep a private patch for <tt class=
! 5123: "filename">pkgsrc/graphics/png</tt>, keep it in
! 5124: <tt class="filename">$LOCALPATCHES/graphics/png/mypatch</tt>.
! 5125: All files in the named directory are expected to be patch
1.1 grant 5126: files, and <span class="emphasis"><em>they are applied
5127: after pkgsrc patches are applied</em></span>.</p>
5128: </div>
5129:
5130: <div class="sect1" lang="en" xml:lang="en">
5131: <div class="titlepage">
5132: <div>
5133: <div>
5134: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 5135: "id2566535" id="id2566535"></a>7.4. Other
1.1 grant 5136: mandatory files</h2>
5137: </div>
5138: </div>
5139: </div>
5140:
5141: <div class="variablelist">
5142: <dl>
1.13 ! hubertf 5143: <dt><span class="term"><tt class=
! 5144: "filename">DESCR</tt></span></dt>
1.1 grant 5145:
5146: <dd>
5147: <p>A multi-line description of the piece of
5148: software. This should include any credits where
5149: they are due. Please bear in mind that others do
5150: not share your sense of humour (or spelling
5151: idiosyncrasies), and that others will read
5152: everything that you write here.</p>
5153: </dd>
5154:
1.13 ! hubertf 5155: <dt><span class="term"><tt class=
! 5156: "filename">PLIST</tt></span></dt>
1.1 grant 5157:
5158: <dd>
5159: <p>This file governs the files that are installed
5160: on your system: all the binaries, manual pages,
5161: etc. There are other directives which may be
5162: entered in this file, to control the creation and
5163: deletion of directories, and the location of
5164: inserted files. See <a href="#plist" title=
5165: "Chapter 8. PLIST issues">Chapter 8,
5166: <i>PLIST issues</i></a> for more information.</p>
5167: </dd>
5168: </dl>
5169: </div>
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=
5177: "components.optional" id=
5178: "components.optional"></a>7.5. Optional
5179: files</h2>
5180: </div>
5181: </div>
5182: </div>
5183:
5184: <div class="variablelist">
5185: <dl>
1.13 ! hubertf 5186: <dt><span class="term"><tt class=
! 5187: "filename">INSTALL</tt></span></dt>
1.1 grant 5188:
5189: <dd>
5190: <p>This shell script is invoked twice by <a href=
5191: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5192: <span class="citerefentry"><span class=
5193: "refentrytitle">pkg_add</span>(1)</span></a>. First
5194: time after package extraction and before files are
5195: moved in place, the second time after the files to
5196: install are moved in place. This can be used to do
5197: any custom procedures not possible with @exec
1.13 ! hubertf 5198: commands in <tt class="filename">PLIST</tt>. See
! 5199: <a href=
1.1 grant 5200: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5201: <span class="citerefentry"><span class=
5202: "refentrytitle">pkg_add</span>(1)</span></a> and
5203: <a href=
5204: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5205: <span class="citerefentry"><span class=
5206: "refentrytitle">pkg_create</span>(1)</span></a> for
5207: more information.</p>
5208: </dd>
5209:
1.13 ! hubertf 5210: <dt><span class="term"><tt class=
! 5211: "filename">DEINSTALL</tt></span></dt>
1.1 grant 5212:
5213: <dd>
5214: <p>This script is executed before and after any
5215: files are removed. It is this script's
5216: responsibility to clean up any additional messy
5217: details around the package's installation, since
5218: all pkg_delete knows is how to delete the files
5219: created in the original distribution. See <a href=
5220: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
5221: <span class="citerefentry"><span class=
5222: "refentrytitle">pkg_delete</span>(1)</span></a> and
5223: <a href=
5224: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5225: <span class="citerefentry"><span class=
5226: "refentrytitle">pkg_create</span>(1)</span></a> for
5227: more information.</p>
5228: </dd>
5229:
1.13 ! hubertf 5230: <dt><span class="term"><tt class=
! 5231: "filename">MESSAGE</tt></span></dt>
1.1 grant 5232:
5233: <dd>
5234: <p>Display this file after installation of the
5235: package. Useful for things like legal notices on
5236: almost-free software and hints for updating config
5237: files after installing modules for apache, PHP etc.
5238: Please note that you can modify variables in it
1.13 ! hubertf 5239: easily by using <tt class=
! 5240: "varname">MESSAGE_SUBST</tt> in the package's
! 5241: <tt class="filename">Makefile</tt>:</p>
1.1 grant 5242: <pre class="programlisting">
5243: MESSAGE_SUBST+= SOMEVAR="somevalue"
5244: </pre>
5245:
5246: <p>replaces "${SOMEVAR}" with “<span class=
1.13 ! hubertf 5247: "quote">somevalue</span>” in <tt class=
! 5248: "filename">MESSAGE</tt>.</p>
1.1 grant 5249: </dd>
5250: </dl>
5251: </div>
5252: </div>
5253:
5254: <div class="sect1" lang="en" xml:lang="en">
5255: <div class="titlepage">
5256: <div>
5257: <div>
5258: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 5259: "id2566729" id="id2566729"></a>7.6. <tt class=
! 5260: "filename">work*</tt></h2>
1.1 grant 5261: </div>
5262: </div>
5263: </div>
5264:
1.13 ! hubertf 5265: <p>When you type <span><b class="command">make</b></span>
! 5266: the distribution files are unpacked into this directory.
! 5267: It can be removed by running <span><b class=
! 5268: "command">make clean</b></span>. Besides the sources,
! 5269: this directory is also used to keep various timestamp
1.1 grant 5270: files.</p>
5271:
5272: <p>If a package doesn't create a subdirectory for itself
5273: (like GNU software does, for instance), but extracts
5274: itself in the current directory, you should set
1.13 ! hubertf 5275: <tt class="varname">WRKSRC</tt> accordingly, e.g.
1.1 grant 5276: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
5277: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.13 ! hubertf 5278: class="pkgname">editors/sam</a> again, but the quick
! 5279: answer is:</p>
1.1 grant 5280: <pre class="programlisting">
5281: WRKSRC= ${WRKDIR}
5282: </pre>
5283:
1.13 ! hubertf 5284: <p>Please note that the old <tt class=
! 5285: "varname">NO_WRKSUBDIR</tt> has been deprecated and
1.1 grant 5286: should not be used. Also, if your package doesn't create
1.13 ! hubertf 5287: a subdir with the name of <tt class=
! 5288: "varname">DISTNAME</tt> but some different name, set
! 5289: <tt class="varname">WRKSRC</tt> to point to the proper
! 5290: name in <tt class="filename">${WRKDIR}</tt>. See
! 5291: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5292: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.13 ! hubertf 5293: class="pkgname">lang/tcl</a> and <a xmlns=
! 5294: "http://www.w3.org/TR/xhtml1/transitional" href=
! 5295: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
! 5296: class="pkgname">x11/tk</a> for examples, and here is
! 5297: another one:</p>
1.1 grant 5298: <pre class="programlisting">
5299: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
5300: </pre>
5301:
5302: <p>The name of the working directory created by pkgsrc is
1.13 ! hubertf 5303: <tt class="filename">work</tt> by default. If the same
! 5304: pkgsrc tree should be used on several different
! 5305: platforms, the variable <tt class=
! 5306: "varname">OBJMACHINE</tt> can be set in /etc/mk.conf to
1.1 grant 5307: attach the platform to the directory name, e.g.
1.13 ! hubertf 5308: <tt class="filename">work.i386</tt> or <tt class=
! 5309: "filename">work.sparc</tt>.</p>
1.1 grant 5310: </div>
5311:
5312: <div class="sect1" lang="en" xml:lang="en">
5313: <div class="titlepage">
5314: <div>
5315: <div>
5316: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 5317: "id2566817" id="id2566817"></a>7.7. <tt class=
! 5318: "filename">files/*</tt></h2>
1.1 grant 5319: </div>
5320: </div>
5321: </div>
5322:
5323: <p>If you have any files that you wish to be placed in
5324: the package prior to configuration or building, you could
5325: place these files here and use a “<span class=
5326: "quote">${CP}</span>” command in the
5327: “<span class="quote">pre-configure</span>”
5328: target to achieve this. Alternatively, you could simply
1.13 ! hubertf 5329: diff the file against <tt class="filename">/dev/null</tt>
! 5330: and use the patch mechanism to manage the creation of
! 5331: this file.</p>
1.1 grant 5332: </div>
5333: </div>
5334:
5335: <div class="chapter" lang="en" xml:lang="en">
5336: <div class="titlepage">
5337: <div>
5338: <div>
5339: <h2 class="title"><a name="plist" id=
5340: "plist"></a>Chapter 8. PLIST issues</h2>
5341: </div>
5342: </div>
5343: </div>
5344:
5345: <div class="toc">
5346: <p><b>Table of Contents</b></p>
5347:
5348: <dl>
1.13 ! hubertf 5349: <dt><span class="sect1"><a href="#id2566871">8.1. RCS
1.1 grant 5350: ID</a></span></dt>
5351:
1.13 ! hubertf 5352: <dt><span class="sect1"><a href="#id2566886">8.2.
! 5353: Semi-automatic PLIST generation</a></span></dt>
1.1 grant 5354:
5355: <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.13 ! hubertf 5356: Tweaking output of make print-PLIST</a></span></dt>
1.1 grant 5357:
5358: <dt><span class="sect1"><a href="#plist.misc">8.4.
5359: Variable substitution in PLIST</a></span></dt>
5360:
1.13 ! hubertf 5361: <dt><span class="sect1"><a href="#id2567139">8.5.
1.1 grant 5362: Manpage-compression</a></span></dt>
5363:
1.13 ! hubertf 5364: <dt><span class="sect1"><a href="#id2567249">8.6.
! 5365: Changing PLIST source with PLIST_SRC</a></span></dt>
1.1 grant 5366:
1.13 ! hubertf 5367: <dt><span class="sect1"><a href="#id2567266">8.7.
1.1 grant 5368: Platform specific and differing PLISTs</a></span></dt>
5369:
5370: <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
5371: Sharing directories between packages</a></span></dt>
5372: </dl>
5373: </div>
5374:
1.13 ! hubertf 5375: <p>The <tt class="filename">PLIST</tt> file contains a
1.1 grant 5376: package's “<span class="quote">packing
5377: list</span>”, i.e. a list of files that belong to the
1.13 ! hubertf 5378: package (relative to the <tt class=
! 5379: "filename">${PREFIX}</tt> directory it's been installed in)
! 5380: plus some additional statements - see the <a href=
1.1 grant 5381: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5382: <span class="citerefentry"><span class=
5383: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
5384: a full list. This chapter addresses some issues that need
1.13 ! hubertf 5385: attention when dealing with the <tt class=
! 5386: "filename">PLIST</tt> file (or files, see below!).</p>
1.1 grant 5387:
5388: <div class="sect1" lang="en" xml:lang="en">
5389: <div class="titlepage">
5390: <div>
5391: <div>
5392: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 5393: "id2566871" id="id2566871"></a>8.1. RCS
1.1 grant 5394: ID</h2>
5395: </div>
5396: </div>
5397: </div>
5398:
5399: <p>Be sure to add a RCS ID line as the first thing in any
1.13 ! hubertf 5400: <tt class="filename">PLIST</tt> file you write:</p>
1.1 grant 5401: <pre class="programlisting">
1.11 ben 5402: @comment $NetBSD$
1.1 grant 5403: </pre>
5404: </div>
5405:
5406: <div class="sect1" lang="en" xml:lang="en">
5407: <div class="titlepage">
5408: <div>
5409: <div>
5410: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 5411: "id2566886" id=
! 5412: "id2566886"></a>8.2. Semi-automatic <tt class=
! 5413: "filename">PLIST</tt> generation</h2>
1.1 grant 5414: </div>
5415: </div>
5416: </div>
5417:
1.13 ! hubertf 5418: <p>You can use the <span><b class="command">make
! 5419: print-PLIST</b></span> command to output a PLIST that
! 5420: matches any new files since the package was extracted.
! 5421: See <a href="#build.helpful-targets" title=
1.1 grant 5422: "11.3. Other helpful targets">Section 11.3,
5423: “Other helpful targets”</a> for more
5424: information on this target.</p>
5425: </div>
5426:
5427: <div class="sect1" lang="en" xml:lang="en">
5428: <div class="titlepage">
5429: <div>
5430: <div>
5431: <h2 class="title" style="clear: both"><a name=
5432: "print-PLIST" id=
5433: "print-PLIST"></a>8.3. Tweaking output of
1.13 ! hubertf 5434: <span><b class="command">make
! 5435: print-PLIST</b></span></h2>
1.1 grant 5436: </div>
5437: </div>
5438: </div>
5439:
5440: <p>If you have used any of the *-dirs packages, as
5441: explained in <a href="#faq.common-dirs" title=
5442: "8.8. Sharing directories between packages">Section 8.8,
5443: “Sharing directories between packages”</a>,
1.13 ! hubertf 5444: you may have noticed that <span><b class="command">make
! 5445: print-PLIST</b></span> outputs a set of <tt class=
! 5446: "varname">@comment</tt>s instead of real <tt class=
! 5447: "varname">@dirrm</tt> lines. You can also do this for
! 5448: specific directories and files, so that the results of
! 5449: that command are very close to reality. This helps
! 5450: <span class="emphasis"><em>a lot</em></span> during the
! 5451: update of packages.</p>
! 5452:
! 5453: <p>The <tt class="varname">PRINT_PLIST_AWK</tt> variable
! 5454: takes a set of AWK patterns and actions that are used to
! 5455: filter the output of print-PLIST. You can <span class=
! 5456: "emphasis"><em>append</em></span> any chunk of AWK
! 5457: scripting you like to it, but be careful with
1.1 grant 5458: quoting.</p>
5459:
1.13 ! hubertf 5460: <p>For example, to get all files inside the <tt class=
! 5461: "filename">libdata/foo</tt> directory removed from the
1.1 grant 5462: resulting PLIST:</p>
5463: <pre class="programlisting">
5464: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
5465:
5466: </pre>
5467:
1.13 ! hubertf 5468: <p>And to get all the <tt class="varname">@dirrm</tt>
1.1 grant 5469: lines referring to a specific (shared) directory
1.13 ! hubertf 5470: converted to <tt class="varname">@comment</tt>s:</p>
1.1 grant 5471: <pre class="programlisting">
5472: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
5473:
5474: </pre>
5475: </div>
5476:
5477: <div class="sect1" lang="en" xml:lang="en">
5478: <div class="titlepage">
5479: <div>
5480: <div>
5481: <h2 class="title" style="clear: both"><a name=
5482: "plist.misc" id="plist.misc"></a>8.4. Variable
5483: substitution in PLIST</h2>
5484: </div>
5485: </div>
5486: </div>
5487:
5488: <p>A number of variables are substituted automatically in
5489: PLISTs when a package is installed on a system. This
5490: includes the following variables:</p>
5491:
5492: <div class="variablelist">
5493: <dl>
1.13 ! hubertf 5494: <dt><span class="term"><tt class=
! 5495: "varname">${MACHINE_ARCH}</tt>, <tt class=
! 5496: "varname">${MACHINE_GNU_ARCH}</tt></span></dt>
1.1 grant 5497:
5498: <dd>
5499: <p>Some packages like emacs and perl embed
5500: information about which architecture they were
5501: built on into the pathnames where they install
5502: their file. To handle this case, PLIST will be
5503: preprocessed before actually used, and the symbol
1.13 ! hubertf 5504: “<span class="quote"><tt class=
! 5505: "varname">${MACHINE_ARCH}</tt></span>” will
! 5506: be replaced by what <span><b class="command">uname
! 5507: -p</b></span> gives. The same is done if the string
! 5508: <tt class="varname">${MACHINE_GNU_ARCH}</tt> is
! 5509: embedded in PLIST somewhere - use this on packages
! 5510: that have GNU autoconf created configure
! 5511: scripts.</p>
1.1 grant 5512:
5513: <div class="note" style=
5514: "margin-left: 0.5in; margin-right: 0.5in;">
5515: <h3 class="title">Legacy note</h3>
5516:
5517: <p>There used to be a symbol “<span class=
1.13 ! hubertf 5518: "quote"><tt class=
! 5519: "varname">$ARCH</tt></span>” that was
! 5520: replaced by the output of <span><b class=
! 5521: "command">uname -m</b></span>, but that's no
1.1 grant 5522: longer supported and has been removed.</p>
5523: </div>
5524: </dd>
5525:
1.13 ! hubertf 5526: <dt><span class="term"><tt class=
! 5527: "varname">${OPSYS}</tt>, <tt class=
! 5528: "varname">${LOWER_OPSYS}</tt>, <tt class=
! 5529: "varname">${OS_VERSION}</tt></span></dt>
1.1 grant 5530:
5531: <dd>
5532: <p>Some packages want to embed the OS name and
5533: version into some paths. To do this, use these
1.13 ! hubertf 5534: variables in the <tt class=
! 5535: "filename">PLIST</tt>:</p>
1.1 grant 5536:
5537: <div class="itemizedlist">
5538: <ul type="disc">
5539: <li>
1.13 ! hubertf 5540: <p><tt class="varname">${OPSYS}</tt> - output
! 5541: of “<span class="quote"><span><b class=
! 5542: "command">uname
! 5543: -s</b></span></span>”</p>
1.1 grant 5544: </li>
5545:
5546: <li>
1.13 ! hubertf 5547: <p><tt class="varname">${LOWER_OPSYS}</tt> -
! 5548: lowercase common name (eg.
! 5549: “<span class="quote">solaris</span>”)</p>
1.1 grant 5550: </li>
5551:
5552: <li>
1.13 ! hubertf 5553: <p><tt class="varname">${OS_VERSION}</tt> -
! 5554: “<span class="quote"><span><b class=
! 5555: "command">uname
! 5556: -r</b></span></span>”</p>
1.1 grant 5557: </li>
5558: </ul>
5559: </div>
5560: </dd>
5561:
1.13 ! hubertf 5562: <dt><span class="term"><tt class=
! 5563: "varname">${PKGLOCALEDIR}</tt></span></dt>
1.1 grant 5564:
5565: <dd>
5566: <p>Packages that install locale files should list
5567: them in the PLIST as “<span class=
5568: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
5569: instead of “<span class=
5570: "quote">share/locale/de/LC_MESSAGES/...</span>”.
5571: This properly handles the fact that different
5572: operating systems expect locale files to be either
1.13 ! hubertf 5573: in <tt class="filename">share</tt> or <tt class=
! 5574: "filename">lib</tt> by default.</p>
1.1 grant 5575: </dd>
5576: </dl>
5577: </div>
5578:
5579: <p>For a complete list of values which are replaced by
1.13 ! hubertf 5580: default, please look in <tt class=
! 5581: "filename">bsd.pkg.mk</tt> (and search for <span class=
1.1 grant 5582: "emphasis"><em>PLIST_SUBST</em></span>).</p>
5583:
5584: <p>If you want to change other variables not listed
5585: above, you can add variables and their expansions to this
1.13 ! hubertf 5586: variable in the following way, similar to <tt class=
! 5587: "varname">MESSAGE_SUBST</tt> (see <a href=
1.1 grant 5588: "#components.optional" title=
5589: "7.5. Optional files">Section 7.5,
5590: “Optional files”</a>):</p>
5591: <pre class="programlisting">
5592: PLIST_SUBST+= SOMEVAR="somevalue"
5593: </pre>
5594:
5595: <p>This replaces all occurrences of “<span class=
5596: "quote">${SOMEVAR}</span>” in the PLIST with
5597: “<span class="quote">somevalue</span>”.</p>
5598: </div>
5599:
5600: <div class="sect1" lang="en" xml:lang="en">
5601: <div class="titlepage">
5602: <div>
5603: <div>
5604: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 5605: "id2567139" id=
! 5606: "id2567139"></a>8.5. Manpage-compression</h2>
1.1 grant 5607: </div>
5608: </div>
5609: </div>
5610:
5611: <p>Manpages should be installed in compressed form if
1.13 ! hubertf 5612: <tt class="varname">MANZ</tt> is set (in <tt class=
! 5613: "filename">bsd.own.mk</tt>), and uncompressed otherwise.
! 5614: To handle this in the <tt class="filename">PLIST</tt>
! 5615: file, the suffix “<span class=
! 5616: "quote">.gz</span>” is appended/removed
! 5617: automatically for manpages according to <tt class=
! 5618: "varname">MANZ</tt> and <tt class=
! 5619: "varname">MANCOMPRESSED</tt> being set or not, see above
! 5620: for details. This modification of the <tt class=
! 5621: "filename">PLIST</tt> file is done on a copy of it, not
! 5622: <tt class="filename">PLIST</tt> itself.</p>
1.1 grant 5623: </div>
5624:
5625: <div class="sect1" lang="en" xml:lang="en">
5626: <div class="titlepage">
5627: <div>
5628: <div>
5629: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 5630: "id2567249" id="id2567249"></a>8.6. Changing
! 5631: PLIST source with <tt class=
! 5632: "varname">PLIST_SRC</tt></h2>
1.1 grant 5633: </div>
5634: </div>
5635: </div>
5636:
1.13 ! hubertf 5637: <p>To use one or more files as source for the <tt class=
! 5638: "filename">PLIST</tt> used in generating the binary
! 5639: package, set the variable <tt class=
! 5640: "varname">PLIST_SRC</tt> to the names of that file(s).
1.1 grant 5641: The files are later concatenated using cat(1), and order
5642: of things is important.</p>
5643: </div>
5644:
5645: <div class="sect1" lang="en" xml:lang="en">
5646: <div class="titlepage">
5647: <div>
5648: <div>
5649: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 5650: "id2567266" id="id2567266"></a>8.7. Platform
1.1 grant 5651: specific and differing PLISTs</h2>
5652: </div>
5653: </div>
5654: </div>
5655:
5656: <p>Some packages decide to install a different set of
5657: files based on the operating system being used. These
5658: differences can be automatically handled by using the
5659: following files:</p>
5660:
5661: <div class="itemizedlist">
5662: <ul type="disc">
5663: <li>
1.13 ! hubertf 5664: <p><tt class="filename">PLIST.common</tt></p>
1.1 grant 5665: </li>
5666:
5667: <li>
1.13 ! hubertf 5668: <p><tt class="filename">PLIST.${OPSYS}</tt></p>
1.1 grant 5669: </li>
5670:
5671: <li>
1.13 ! hubertf 5672: <p><tt class="filename">PLIST.common_end</tt></p>
1.1 grant 5673: </li>
5674: </ul>
5675: </div>
5676:
1.13 ! hubertf 5677: <p>If <tt class="filename">PLIST.${OPSYS}</tt> exists,
! 5678: these files are used instead of <tt class=
! 5679: "filename">PLIST</tt>. This allows packages which behave
! 5680: in this way to be handled gracefully. Manually overriding
! 5681: <tt class="varname">PLIST_SRC</tt> for other more exotic
! 5682: uses is also possible.</p>
1.1 grant 5683: </div>
5684:
5685: <div class="sect1" lang="en" xml:lang="en">
5686: <div class="titlepage">
5687: <div>
5688: <div>
5689: <h2 class="title" style="clear: both"><a name=
5690: "faq.common-dirs" id=
5691: "faq.common-dirs"></a>8.8. Sharing directories
5692: between packages</h2>
5693: </div>
5694: </div>
5695: </div>
5696:
5697: <p>A “<span class="quote">shared
5698: directory</span>” is a directory where multiple
5699: (and unrelated) packages install files. These directories
5700: are problematic because you have to add special tricks in
5701: the PLIST to conditionally remove them, or have some
5702: centralized package handle them.</p>
5703:
5704: <p>Within pkgsrc, you'll find both approaches. If a
5705: directory is shared by a few unrelated packages, it's
5706: often not worth to add an extra package to remove it.
5707: Therefore, one simply does:</p>
5708: <pre class="programlisting">
5709: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
5710:
5711: </pre>
5712:
5713: <p>in the PLISTs of all affected packages, instead of the
5714: regular "@dirrm" line.</p>
5715:
5716: <p>However, if the directory is shared across many
5717: packages, two different solutions are available:</p>
5718:
5719: <div class="orderedlist">
5720: <ol type="1">
5721: <li>
5722: <p>If the packages have a common dependency, the
5723: directory can be removed in that. For example, see
5724: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5725: href=
5726: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.13 ! hubertf 5727: class="pkgname">textproc/scrollkeeper</a>, which
! 5728: removes the shared directory <tt class=
! 5729: "filename">share/omf</tt>.</p>
1.1 grant 5730: </li>
5731:
5732: <li>
5733: <p>If the packages using the directory are not
5734: related at all (they have no common dependencies),
5735: a *-dirs package is used.</p>
5736: </li>
5737: </ol>
5738: </div>
5739:
5740: <p>From now on, we'll discuss the second solution. To get
5741: an idea of the *-dirs packages available, issue:</p>
5742: <pre class="programlisting">
1.13 ! hubertf 5743: <tt class="prompt">%</tt> cd .../pkgsrc
! 5744: <tt class="prompt">%</tt> ls -d */*-dirs
1.1 grant 5745:
5746: </pre>
5747:
5748: <p>Their use from other packages is very simple. The
1.13 ! hubertf 5749: <tt class="varname">USE_DIRS</tt> variable takes a list
! 5750: of package names (without the “<span class=
1.1 grant 5751: "quote">-dirs</span>” part) together with the
5752: required version number (always pick the latest one when
5753: writting new packages).</p>
5754:
5755: <p>For example, if a package installs files under
1.13 ! hubertf 5756: <tt class="filename">share/applications</tt>, it should
! 5757: have the following line in it:</p>
1.1 grant 5758: <pre class="programlisting">
5759: USE_DIRS+= xdg-1.1
5760:
5761: </pre>
5762:
1.13 ! hubertf 5763: <p>After regenerating the PLIST using <span><b class=
! 5764: "command">make print-PLIST</b></span>, you should get the
! 5765: right (commented out) lines.</p>
1.1 grant 5766:
1.13 ! hubertf 5767: <p>Note that, even if your package is using <tt class=
! 5768: "filename">$X11BASE</tt>, it must not depend on the
1.1 grant 5769: *-x11-dirs packages. Just specify the name without that
1.13 ! hubertf 5770: part and pkgsrc (in particular, <tt class=
! 5771: "filename">mk/dirs.mk</tt>) will take care of it.</p>
1.1 grant 5772: </div>
5773: </div>
5774:
5775: <div class="chapter" lang="en" xml:lang="en">
5776: <div class="titlepage">
5777: <div>
5778: <div>
5779: <h2 class="title"><a name="buildlink" id=
5780: "buildlink"></a>Chapter 9. Buildlink
5781: methodology</h2>
5782: </div>
5783: </div>
5784: </div>
5785:
5786: <div class="toc">
5787: <p><b>Table of Contents</b></p>
5788:
5789: <dl>
1.13 ! hubertf 5790: <dt><span class="sect1"><a href="#id2567742">9.1.
1.1 grant 5791: Converting packages to use buildlink3</a></span></dt>
5792:
1.13 ! hubertf 5793: <dt><span class="sect1"><a href="#id2567933">9.2.
! 5794: Writing buildlink3.mk files</a></span></dt>
1.1 grant 5795:
5796: <dd>
5797: <dl>
1.13 ! hubertf 5798: <dt><span class="sect2"><a href="#id2568003">9.2.1.
1.1 grant 5799: Anatomy of a buildlink3.mk file</a></span></dt>
5800:
1.13 ! hubertf 5801: <dt><span class="sect2"><a href="#id2568375">9.2.2.
! 5802: Updating BUILDLINK_DEPENDS.pkg in buildlink3.mk
1.1 grant 5803: files</a></span></dt>
5804: </dl>
5805: </dd>
5806:
1.13 ! hubertf 5807: <dt><span class="sect1"><a href="#id2568590">9.3.
! 5808: Writing builtin.mk files</a></span></dt>
1.1 grant 5809:
5810: <dd>
5811: <dl>
1.13 ! hubertf 5812: <dt><span class="sect2"><a href="#id2568672">9.3.1.
! 5813: Anatomy of a builtin.mk file</a></span></dt>
1.1 grant 5814:
1.13 ! hubertf 5815: <dt><span class="sect2"><a href="#id2568899">9.3.2.
1.1 grant 5816: Global preferences for native or pkgsrc
5817: software</a></span></dt>
5818: </dl>
5819: </dd>
5820: </dl>
5821: </div>
5822:
5823: <p>Buildlink is a framework in pkgsrc that controls what
5824: headers and libraries are seen by a package's configure and
5825: build processes. This is implemented in a two step
5826: process:</p>
5827:
5828: <div class="orderedlist">
5829: <ol type="1">
5830: <li>
5831: <p>Symlink headers and libraries for dependencies
1.13 ! hubertf 5832: into <tt class="varname">BUILDLINK_DIR</tt>, which by
! 5833: default is a subdirectory of <tt class=
! 5834: "varname">WRKDIR</tt>.</p>
1.1 grant 5835: </li>
5836:
5837: <li>
5838: <p>Create wrapper scripts that are used in place of
1.13 ! hubertf 5839: the normal compiler tools that translate <tt class=
! 5840: "option">-I${LOCALBASE}/include</tt> and <tt class=
! 5841: "option">-L${LOCALBASE}/lib</tt> into references to
! 5842: <tt class="varname">BUILDLINK_DIR</tt>. The wrapper
! 5843: scripts also make native compiler on some operating
! 5844: systems look like GCC, so that packages that expect
! 5845: GCC won't require modifications to build with those
! 5846: native compilers.</p>
1.1 grant 5847: </li>
5848: </ol>
5849: </div>
5850:
5851: <p>This normalizes the environment in which a package is
5852: built so that the package may be built consistently despite
5853: what other software may be installed. Please note that the
1.13 ! hubertf 5854: normal system header and library paths, e.g. <tt class=
! 5855: "filename">/usr/include</tt>, <tt class=
! 5856: "filename">/usr/lib</tt>, etc., are always searched --
1.1 grant 5857: buildlink3 is designed to insulate the package build from
5858: non-system-supplied software.</p>
5859:
5860: <div class="sect1" lang="en" xml:lang="en">
5861: <div class="titlepage">
5862: <div>
5863: <div>
5864: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 5865: "id2567742" id="id2567742"></a>9.1. Converting
1.1 grant 5866: packages to use buildlink3</h2>
5867: </div>
5868: </div>
5869: </div>
5870:
5871: <p>The process of converting packages to use the
5872: buildlink3 framework (“<span class=
5873: "quote">bl3ifying</span>”) is fairly
5874: straightforward. The things to keep in mind are:</p>
5875:
5876: <div class="orderedlist">
5877: <ol type="1">
5878: <li>
1.13 ! hubertf 5879: <p>Set <tt class="varname">USE_BUILDLINK3</tt> to
! 5880: “<span class="quote">yes</span>”.</p>
1.1 grant 5881: </li>
5882:
5883: <li>
5884: <p>Ensure that the build always calls the wrapper
5885: scripts instead of the actual toolchain. Some
5886: packages are tricky, and the only way to know for
1.13 ! hubertf 5887: sure is the check <tt class=
! 5888: "filename">${WRKDIR}/.work.log</tt> to see if the
1.1 grant 5889: wrappers are being invoked.</p>
5890: </li>
5891:
5892: <li>
1.13 ! hubertf 5893: <p>Don't override <tt class="varname">PREFIX</tt>
! 5894: from within the package Makefile, e.g. Java VMs,
! 5895: standalone shells, etc., because the code to
! 5896: symlink files into <tt class=
! 5897: "filename">${BUILDLINK_DIR}</tt> looks for files
1.1 grant 5898: relative to “<span class="quote">pkg_info -qp
1.13 ! hubertf 5899: <i class=
! 5900: "replaceable"><tt>pkgname</tt></i></span>”.</p>
1.1 grant 5901: </li>
5902:
5903: <li>
5904: <p>Remember that <span class=
1.13 ! hubertf 5905: "emphasis"><em>only</em></span> the <tt class=
! 5906: "filename">buildlink3.mk</tt> files that you list
1.1 grant 5907: in a package's Makefile are added as dependencies
5908: for that package.</p>
5909: </li>
5910: </ol>
5911: </div>
5912:
5913: <p>If a dependency on a particular package is required
5914: for its libraries and headers, then we replace:</p>
5915: <pre class="programlisting">
5916: DEPENDS+= foo>=1.1.0:../../category/foo
5917: </pre>
5918:
5919: <p>with</p>
5920: <pre class="programlisting">
5921: .include "../../category/foo/buildlink3.mk"
5922: </pre>
5923:
1.13 ! hubertf 5924: <p>There are several <tt class=
! 5925: "filename">buildlink3.mk</tt> files in <tt class=
! 5926: "filename">pkgsrc/mk</tt> that handle special package
1.1 grant 5927: issues:</p>
5928:
5929: <div class="itemizedlist">
5930: <ul type="disc">
5931: <li>
1.13 ! hubertf 5932: <p><tt class="filename">bdb.buildlink3.mk</tt>
1.1 grant 5933: chooses either the native or a pkgsrc Berkeley DB
1.13 ! hubertf 5934: implementation based on the values of <tt class=
! 5935: "varname">BDB_ACCEPTED</tt> and <tt class=
! 5936: "varname">BDB_DEFAULT</tt>.</p>
1.1 grant 5937: </li>
5938:
5939: <li>
1.13 ! hubertf 5940: <p><tt class="filename">curses.buildlink3.mk</tt>
! 5941: If the system comes with neither Curses nor
! 5942: NCurses, this will take care to install the
! 5943: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 5944: href=
1.1 grant 5945: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.13 ! hubertf 5946: class="pkgname">devel/ncurses</a> package.</p>
1.1 grant 5947: </li>
5948:
5949: <li>
1.13 ! hubertf 5950: <p><tt class="filename">krb5.buildlink3.mk</tt>
! 5951: uses the value of <tt class=
! 5952: "varname">KRB5_ACCEPTED</tt> to choose between
1.1 grant 5953: adding a dependency on Heimdal or MIT-krb5 for
5954: packages that require a Kerberos 5
5955: implementation.</p>
5956: </li>
5957:
5958: <li>
1.13 ! hubertf 5959: <p><tt class="filename">motif.buildlink3.mk</tt>
! 5960: checks for a system-provided Motif installation or
! 5961: adds a dependency on <a xmlns=
1.1 grant 5962: "http://www.w3.org/TR/xhtml1/transitional" href=
5963: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.13 ! hubertf 5964: class="pkgname">x11/lesstif</a> or <a xmlns=
! 5965: "http://www.w3.org/TR/xhtml1/transitional" href=
! 5966: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
! 5967: class="pkgname">x11/openmotif</a>;</p>
1.1 grant 5968: </li>
5969:
5970: <li>
1.13 ! hubertf 5971: <p><tt class="filename">ossaudio.buildlink3.mk</tt>
! 5972: defines several variables that may be used by
! 5973: packages that use the Open Sound System (OSS)
! 5974: API;</p>
1.1 grant 5975: </li>
5976:
5977: <li>
1.13 ! hubertf 5978: <p><tt class="filename">pgsql.buildlink3.mk</tt>
! 5979: will accept either Postgres 7.3 or 7.4, whichever
! 5980: is found installed. See the file for more
! 5981: information.</p>
1.1 grant 5982: </li>
5983:
5984: <li>
1.13 ! hubertf 5985: <p><tt class="filename">pthread.buildlink3.mk</tt>
! 5986: uses the value of <tt class=
! 5987: "varname">PTHREAD_OPTS</tt> and checks for native
! 5988: pthreads or adds a dependency on <a xmlns=
1.1 grant 5989: "http://www.w3.org/TR/xhtml1/transitional" href=
5990: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.13 ! hubertf 5991: class="pkgname">devel/pth</a> as needed;</p>
1.1 grant 5992: </li>
5993:
5994: <li>
1.13 ! hubertf 5995: <p><tt class="filename">xaw.buildlink3.mk</tt> uses
! 5996: the value of <tt class="varname">XAW_TYPE</tt> to
! 5997: choose a particular Athena widgets library.</p>
1.1 grant 5998: </li>
5999: </ul>
6000: </div>
6001:
1.13 ! hubertf 6002: <p>The comments in those <tt class=
! 6003: "filename">buildlink3.mk</tt> files provide a more
1.1 grant 6004: complete description of how to use them properly.</p>
6005: </div>
6006:
6007: <div class="sect1" lang="en" xml:lang="en">
6008: <div class="titlepage">
6009: <div>
6010: <div>
6011: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 6012: "id2567933" id="id2567933"></a>9.2. Writing
! 6013: <tt class="filename">buildlink3.mk</tt> files</h2>
1.1 grant 6014: </div>
6015: </div>
6016: </div>
6017:
1.13 ! hubertf 6018: <p>A package's <tt class="filename">buildlink3.mk</tt>
! 6019: file is included by Makefiles to indicate the need to
! 6020: compile and link against header files and libraries
! 6021: provided by the package. A <tt class=
! 6022: "filename">buildlink3.mk</tt> file should always provide
! 6023: enough information to add the correct type of dependency
! 6024: relationship and include any other <tt class=
! 6025: "filename">buildlink3.mk</tt> files that it needs to find
! 6026: headers and libraries that it needs in turn.</p>
1.1 grant 6027:
1.13 ! hubertf 6028: <p>To generate an initial <tt class=
! 6029: "filename">buildlink3.mk</tt> file for further editing,
1.1 grant 6030: Rene Hexel's <a xmlns=
6031: "http://www.w3.org/TR/xhtml1/transitional" href=
6032: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.13 ! hubertf 6033: class="pkgname">pkgtools/createbuildlink</a> package
! 6034: is highly recommended. For most packages, the
! 6035: following command will generate a good starting point
! 6036: for <tt class="filename">buildlink3.mk</tt> files:</p>
1.1 grant 6037: <pre class="screen">
1.13 ! hubertf 6038: <tt class="prompt">%</tt> <b class=
! 6039: "userinput"><tt>cd pkgsrc/<i class=
! 6040: "replaceable"><tt>category</tt></i>/<i class=
! 6041: "replaceable"><tt>pkgdir</tt></i>
! 6042: <tt class=
! 6043: "prompt">%</tt> createbuildlink -3 >buildlink3.mk</tt></b>
1.1 grant 6044: </pre>
6045:
6046: <div class="sect2" lang="en" xml:lang="en">
6047: <div class="titlepage">
6048: <div>
6049: <div>
1.13 ! hubertf 6050: <h3 class="title"><a name="id2568003" id=
! 6051: "id2568003"></a>9.2.1. Anatomy of a buildlink3.mk
1.1 grant 6052: file</h3>
6053: </div>
6054: </div>
6055: </div>
6056:
1.13 ! hubertf 6057: <p>The following real-life example <tt class=
! 6058: "filename">buildlink3.mk</tt> is taken from <tt class=
! 6059: "filename">pkgsrc/graphics/tiff</tt>:</p>
1.1 grant 6060: <pre class="programlisting">
1.11 ben 6061: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 6062:
6063: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
6064: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
6065:
6066: .if !empty(BUILDLINK_DEPTH:M+)
6067: BUILDLINK_DEPENDS+= tiff
6068: .endif
6069:
6070: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
6071: BUILDLINK_PACKAGES+= tiff
6072:
6073: .if !empty(TIFF_BUILDLINK3_MK:M+)
6074: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
6075: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
6076: .endif # TIFF_BUILDLINK3_MK
6077:
6078: .include "../../devel/zlib/buildlink3.mk"
6079: .include "../../graphics/jpeg/buildlink3.mk"
6080:
6081: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
6082: </pre>
6083:
1.13 ! hubertf 6084: <p>The header and footer manipulate <tt class=
! 6085: "varname">BUILDLINK_DEPTH</tt>, which is common across
! 6086: all <tt class="filename">buildlink3.mk</tt> files and
! 6087: is used to track at what depth we are including
! 6088: <tt class="filename">buildlink3.mk</tt> files.</p>
1.1 grant 6089:
6090: <p>The first section controls if the dependency on
1.13 ! hubertf 6091: <i class="replaceable"><tt>pkg</tt></i> is added.
! 6092: <tt class="varname">BUILDLINK_DEPENDS</tt> is the
1.1 grant 6093: global list of packages for which dependencies are
6094: added by buildlink3.</p>
6095:
6096: <p>The second section advises pkgsrc that the
1.13 ! hubertf 6097: <tt class="filename">buildlink3.mk</tt> file for
! 6098: <i class="replaceable"><tt>pkg</tt></i> has been
! 6099: included at some point. <tt class=
! 6100: "varname">BUILDLINK_PACKAGES</tt> is the global list of
! 6101: packages for which <tt class=
! 6102: "filename">buildlink3.mk</tt> files have been included.
! 6103: It must <span class="emphasis"><em>always</em></span>
! 6104: be appended to within a <tt class=
! 6105: "filename">buildlink3.mk</tt> file.</p>
1.1 grant 6106:
6107: <p>The third section is protected from multiple
1.13 ! hubertf 6108: inclusion and controls how the dependency on <i class=
! 6109: "replaceable"><tt>pkg</tt></i> is added. Several
1.1 grant 6110: important variables are set in the section:</p>
6111:
6112: <div class="itemizedlist">
6113: <ul type="disc">
6114: <li>
1.13 ! hubertf 6115: <p><tt class=
! 6116: "varname">BUILDLINK_DEPENDS.<i class="replaceable">
! 6117: <tt>pkg</tt></i></tt> is the actual dependency
! 6118: recorded in the installed package; this should
! 6119: always be set using <span><b class=
! 6120: "command">+=</b></span> to ensure that we're
! 6121: appending to any pre-existing list of values.
! 6122: This variable should be set to the first version
! 6123: of the package that had the last change in the
! 6124: major number of a shared library or that had a
! 6125: major API change.</p>
1.1 grant 6126: </li>
6127:
6128: <li>
1.13 ! hubertf 6129: <p><tt class=
! 6130: "varname">BUILDLINK_PKGSRCDIR.<i class=
! 6131: "replaceable"><tt>pkg</tt></i></tt> is the
! 6132: location of the <i class=
! 6133: "replaceable"><tt>pkg</tt></i> pkgsrc
1.1 grant 6134: directory;</p>
6135: </li>
6136:
6137: <li>
1.13 ! hubertf 6138: <p><tt class=
! 6139: "varname">BUILDLINK_DEPMETHOD.<i class=
! 6140: "replaceable"><tt>pkg</tt></i></tt> (not shown
! 6141: above) controls whether we use <tt class=
! 6142: "varname">BUILD_DEPENDS</tt> or <tt class=
! 6143: "varname">DEPENDS</tt> to add the dependency on
! 6144: <i class="replaceable"><tt>pkg</tt></i>. The
! 6145: build dependency is selected by setting
! 6146: <tt class="varname">BUILDLINK_DEPMETHOD.<i class=
! 6147: "replaceable"><tt>pkg</tt></i></tt> to
1.1 grant 6148: “<span class="quote">build</span>”.
6149: By default, the full dependency is used.</p>
6150: </li>
6151:
6152: <li>
1.13 ! hubertf 6153: <p><tt class=
! 6154: "varname">BUILDLINK_INCDIRS.<i class="replaceable">
! 6155: <tt>pkg</tt></i></tt> and <tt class=
! 6156: "varname">BUILDLINK_LIBDIRS.<i class=
! 6157: "replaceable"><tt>pkg</tt></i></tt> (not shown
! 6158: above) are lists of subdirectories of <tt class=
! 6159: "filename">${BUILDLINK_PREFIX.<i class=
! 6160: "replaceable"><tt>pkg</tt></i>}</tt> to add to
! 6161: the header and library search paths. These
1.1 grant 6162: default to “<span class=
6163: "quote">include</span>” and
6164: “<span class="quote">lib</span>”
6165: respectively.</p>
6166: </li>
6167:
6168: <li>
1.13 ! hubertf 6169: <p><tt class=
! 6170: "varname">BUILDLINK_CPPFLAGS.<i class=
! 6171: "replaceable"><tt>pkg</tt></i></tt> (not shown
! 6172: above) is the list of preprocessor flags to add
! 6173: to <tt class="varname">CPPFLAGS</tt>, which are
! 6174: passed on to the configure and build phases. The
! 6175: “<span class="quote">-I</span>”
! 6176: option should be avoided and instead be handled
! 6177: using <tt class=
! 6178: "varname">BUILDLINK_INCDIRS.<i class=
! 6179: "replaceable"><tt>pkg</tt></i></tt> as above.</p>
1.1 grant 6180: </li>
6181: </ul>
6182: </div>
6183:
6184: <p>The following variables are all optionally defined
6185: within this second section (protected against multiple
6186: inclusion) and control which package files are
1.13 ! hubertf 6187: symlinked into <tt class=
! 6188: "filename">${BUILDLINK_DIR}</tt> and how their names
1.1 grant 6189: are transformed during the symlinking:</p>
6190:
6191: <div class="itemizedlist">
6192: <ul type="disc">
6193: <li>
1.13 ! hubertf 6194: <p><tt class="varname">BUILDLINK_FILES.<i class=
! 6195: "replaceable"><tt>pkg</tt></i></tt> (not shown
! 6196: above) is a shell glob pattern relative to
! 6197: <tt class="filename">${BUILDLINK_PREFIX.<i class=
! 6198: "replaceable"><tt>pkg</tt></i>}</tt> to be
! 6199: symlinked into <tt class=
! 6200: "filename">${BUILDLINK_DIR}</tt>, e.g. <tt class=
! 6201: "filename">include/*.h</tt>.</p>
1.1 grant 6202: </li>
6203:
6204: <li>
1.13 ! hubertf 6205: <p><tt class=
! 6206: "varname">BUILDLINK_FILES_CMD.<i class=
! 6207: "replaceable"><tt>pkg</tt></i></tt> (not shown
! 6208: above) is a shell pipeline that outputs to stdout
! 6209: a list of files relative to <tt class=
! 6210: "filename">${BUILDLINK_PREFIX.<i class=
! 6211: "replaceable"><tt>pkg</tt></i>}</tt>. The
1.1 grant 6212: resulting files are to be symlinked into
1.13 ! hubertf 6213: <tt class="filename">${BUILDLINK_DIR}</tt>. By
! 6214: default, this takes the <tt class=
! 6215: "filename">+CONTENTS</tt> of a <i class=
! 6216: "replaceable"><tt>pkg</tt></i> and filters it
! 6217: through <tt class=
! 6218: "varname">${BUILDLINK_CONTENTS_FILTER.<i class=
! 6219: "replaceable"><tt>pkg</tt></i>}</tt>.</p>
1.1 grant 6220: </li>
6221:
6222: <li>
1.13 ! hubertf 6223: <p><tt class=
! 6224: "varname">BUILDLINK_CONTENTS_FILTER.<i class=
! 6225: "replaceable"><tt>pkg</tt></i></tt> (not shown
! 6226: above) is a filter command that filters
! 6227: <tt class="filename">+CONTENTS</tt> input into a
! 6228: list of files relative to <tt class=
! 6229: "filename">${BUILDLINK_PREFIX.<i class=
! 6230: "replaceable"><tt>pkg</tt></i>}</tt> on stdout.
! 6231: By default for overwrite packages, <tt class=
! 6232: "varname">BUILDLINK_CONTENTS_FILTER.<i class=
! 6233: "replaceable"><tt>pkg</tt></i></tt> outputs the
! 6234: contents of the <tt class="filename">include</tt>
! 6235: and <tt class="filename">lib</tt> directories in
! 6236: the package <tt class="filename">+CONTENTS</tt>,
! 6237: and for pkgviews packages, it outputs any libtool
! 6238: archives in <tt class="filename">lib</tt>
1.1 grant 6239: directories.</p>
6240: </li>
6241:
6242: <li>
1.13 ! hubertf 6243: <p><tt class=
! 6244: "varname">BUILDLINK_TRANSFORM.<i class=
! 6245: "replaceable"><tt>pkg</tt></i></tt> (not shown
! 6246: above) is a list of sed arguments used to
1.1 grant 6247: transform the name of the source filename into a
1.13 ! hubertf 6248: destination filename, e.g. <span><b class=
1.1 grant 6249: "command">-e
1.13 ! hubertf 6250: "s|/curses.h|/ncurses.h|g"</b></span>.</p>
1.1 grant 6251: </li>
6252: </ul>
6253: </div>
6254:
1.13 ! hubertf 6255: <p>The last section includes any <tt class=
! 6256: "filename">buildlink3.mk</tt> needed for <i class=
! 6257: "replaceable"><tt>pkg</tt></i>'s library dependencies.
! 6258: Including these <tt class="filename">buildlink3.mk</tt>
! 6259: files means that the headers and libraries for these
! 6260: dependencies are also symlinked into <tt class=
! 6261: "filename">${BUILDLINK_DIR}</tt> whenever the <i class=
! 6262: "replaceable"><tt>pkg</tt></i> <tt class=
! 6263: "filename">buildlink3.mk</tt> file is included.</p>
1.1 grant 6264: </div>
6265:
6266: <div class="sect2" lang="en" xml:lang="en">
6267: <div class="titlepage">
6268: <div>
6269: <div>
1.13 ! hubertf 6270: <h3 class="title"><a name="id2568375" id=
! 6271: "id2568375"></a>9.2.2. Updating <tt class=
! 6272: "varname">BUILDLINK_DEPENDS.<i class=
! 6273: "replaceable"><tt>pkg</tt></i></tt> in <tt class=
! 6274: "filename">buildlink3.mk</tt> files</h3>
1.1 grant 6275: </div>
6276: </div>
6277: </div>
6278:
6279: <p>There are two situations that require increasing the
1.13 ! hubertf 6280: dependency listed in <tt class=
! 6281: "varname">BUILDLINK_DEPENDS.<i class=
! 6282: "replaceable"><tt>pkg</tt></i></tt> after a package
! 6283: update:</p>
1.1 grant 6284:
6285: <div class="orderedlist">
6286: <ol type="1">
6287: <li>
6288: <p>if the sonames (major number of the library
6289: version) of any installed shared libraries
6290: change;</p>
6291: </li>
6292:
6293: <li>
6294: <p>if the API or interface to the header files
6295: change.</p>
6296: </li>
6297: </ol>
6298: </div>
6299:
1.13 ! hubertf 6300: <p>In these cases, <tt class=
! 6301: "varname">BUILDLINK_DEPENDS.<i class=
! 6302: "replaceable"><tt>pkg</tt></i></tt> should be adjusted
! 6303: to require at least the new package version. In some
! 6304: cases, the packages that depend on this new version may
! 6305: need their <tt class="varname">PKGREVISION</tt>s
! 6306: increased and, if they have <tt class=
! 6307: "filename">buildlink3.mk</tt> files, their <tt class=
! 6308: "varname">BUILDLINK_DEPENDS.<i class=
! 6309: "replaceable"><tt>pkg</tt></i></tt> adjusted, too. This
! 6310: is needed so that binary packages made using it will
! 6311: require the correct package dependency and not settle
! 6312: for an older one which will not contain the necessary
! 6313: shared libraries.</p>
1.1 grant 6314:
6315: <p>Please take careful consideration before adjusting
1.13 ! hubertf 6316: <tt class="varname">BUILDLINK_DEPENDS.<i class=
! 6317: "replaceable"><tt>pkg</tt></i></tt> as we don't want to
! 6318: cause unneeded package deletions and rebuilds. In many
! 6319: cases, new versions of packages work just fine with
! 6320: older dependencies. See <a href="#dependencies" title=
! 6321: "12.1.3. Handling dependencies">Section 12.1.3,
! 6322: “Handling dependencies”</a> and <a href=
! 6323: "#buildlink" title=
1.1 grant 6324: "Chapter 9. Buildlink methodology">Chapter 9,
6325: <i>Buildlink methodology</i></a> for more information
6326: about dependencies on other packages, including the
1.13 ! hubertf 6327: <tt class="varname">BUILDLINK_RECOMMENDED</tt> and
! 6328: <tt class="varname">RECOMMENDED</tt> definitions.</p>
1.1 grant 6329: </div>
6330: </div>
6331:
6332: <div class="sect1" lang="en" xml:lang="en">
6333: <div class="titlepage">
6334: <div>
6335: <div>
6336: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 6337: "id2568590" id="id2568590"></a>9.3. Writing
! 6338: <tt class="filename">builtin.mk</tt> files</h2>
1.1 grant 6339: </div>
6340: </div>
6341: </div>
6342:
6343: <p>Some packages in pkgsrc install headers and libraries
6344: that coincide with headers and libraries present in the
1.13 ! hubertf 6345: base system. Aside from a <tt class=
! 6346: "filename">buildlink3.mk</tt> file, these packages should
! 6347: also include a <tt class="filename">builtin.mk</tt> file
! 6348: that includes the necessary checks to decide whether
! 6349: using the built-in software or the pkgsrc software is
! 6350: appropriate.</p>
1.1 grant 6351:
6352: <p>The only requirements of a builtin.mk file for
1.13 ! hubertf 6353: <i class="replaceable"><tt>pkg</tt></i> are:</p>
1.1 grant 6354:
6355: <div class="orderedlist">
6356: <ol type="1">
6357: <li>
1.13 ! hubertf 6358: <p>It should set <tt class=
! 6359: "varname">USE_BUILTIN.<i class=
! 6360: "replaceable"><tt>pkg</tt></i></tt> to either
! 6361: “<span class="quote">yes</span>” or
! 6362: “<span class="quote">no</span>” after
! 6363: it is included.</p>
1.1 grant 6364: </li>
6365:
6366: <li>
6367: <p>It should <span class=
6368: "emphasis"><em>not</em></span> override any
1.13 ! hubertf 6369: <tt class="varname">USE_BUILTIN.<i class=
! 6370: "replaceable"><tt>pkg</tt></i></tt> which is
! 6371: already set before the <tt class=
! 6372: "filename">builtin.mk</tt> file is included.</p>
1.1 grant 6373: </li>
6374:
6375: <li>
6376: <p>It should be written to allow multiple
6377: inclusion. This is <span class=
6378: "emphasis"><em>very</em></span> important and takes
1.13 ! hubertf 6379: careful attention to <tt class=
! 6380: "filename">Makefile</tt> coding.</p>
1.1 grant 6381: </li>
6382: </ol>
6383: </div>
6384:
6385: <div class="sect2" lang="en" xml:lang="en">
6386: <div class="titlepage">
6387: <div>
6388: <div>
1.13 ! hubertf 6389: <h3 class="title"><a name="id2568672" id=
! 6390: "id2568672"></a>9.3.1. Anatomy of a
! 6391: <tt class="filename">builtin.mk</tt> file</h3>
1.1 grant 6392: </div>
6393: </div>
6394: </div>
6395:
6396: <p>The following is the recommended template for
6397: builtin.mk files:</p>
6398: <pre class="programlisting">
6399: .if !defined(IS_BUILTIN.foo)
6400: #
6401: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
6402: # genuinely exists in the system or not.
6403: #
6404: IS_BUILTIN.foo?= no
6405:
6406: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
6407: # version can be determined.
6408: #
6409: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
6410: BUILTIN_PKG.foo?= foo-1.0
6411: . endif
6412: .endif # IS_BUILTIN.foo
6413:
6414: .if !defined(USE_BUILTIN.foo)
6415: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
6416: . if defined(BUILTIN_PKG.foo)
6417: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
6418: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
6419: USE_BUILTIN.foo!= \
6420: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
6421: ${ECHO} "yes"; \
6422: else \
6423: ${ECHO} "no"; \
6424: fi
6425: . endif
6426: . endfor
6427: . endif
6428: .endif # USE_BUILTIN.foo
6429:
6430: CHECK_BUILTIN.foo?= no
6431: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
6432: #
6433: # Here we place code that depends on whether USE_BUILTIN.foo is set to
6434: # "yes" or "no".
6435: #
6436: .endif # CHECK_BUILTIN.foo
6437:
6438: </pre>
6439:
1.13 ! hubertf 6440: <p>The first section sets <tt class=
! 6441: "varname">IS_BUILTIN.<i class=
! 6442: "replaceable"><tt>pkg</tt></i></tt> depending on if
! 6443: <i class="replaceable"><tt>pkg</tt></i> really exists
! 6444: in the base system. This should not be a base system
! 6445: software with similar functionality to <i class=
! 6446: "replaceable"><tt>pkg</tt></i>; it should only be
! 6447: “<span class="quote">yes</span>” if the
! 6448: actual package is included as part of the base system.
! 6449: This variable is only used internally within the
! 6450: <tt class="filename">builtin.mk</tt> file.</p>
! 6451:
! 6452: <p>The second section sets <tt class=
! 6453: "varname">BUILTIN_PKG.<i class=
! 6454: "replaceable"><tt>pkg</tt></i></tt> to the version of
! 6455: <i class="replaceable"><tt>pkg</tt></i> in the base
! 6456: system if it exists (if <tt class=
! 6457: "varname">IS_BUILTIN.<i class=
! 6458: "replaceable"><tt>pkg</tt></i></tt> is
1.1 grant 6459: “<span class="quote">yes</span>”). This
1.13 ! hubertf 6460: variable is only used internally within the <tt class=
! 6461: "filename">builtin.mk</tt> file.</p>
1.1 grant 6462:
1.13 ! hubertf 6463: <p>The third section sets <tt class=
! 6464: "varname">USE_BUILTIN.<i class=
! 6465: "replaceable"><tt>pkg</tt></i></tt> and is <span class=
! 6466: "emphasis"><em>required</em></span> in all <tt class=
! 6467: "filename">builtin.mk</tt> files. The code in this
! 6468: section must make the determination whether the
! 6469: built-in software is adequate to satisfy the
! 6470: dependencies listed in <tt class=
! 6471: "varname">BUILDLINK_DEPENDS.<i class=
! 6472: "replaceable"><tt>pkg</tt></i></tt>. This is typically
! 6473: done by comparing <tt class=
! 6474: "varname">BUILTIN_PKG.<i class=
! 6475: "replaceable"><tt>pkg</tt></i></tt> against each of the
! 6476: dependencies in <tt class=
! 6477: "varname">BUILDLINK_DEPENDS.<i class=
! 6478: "replaceable"><tt>pkg</tt></i></tt>. <tt class=
! 6479: "varname">USE_BUILTIN.<i class=
! 6480: "replaceable"><tt>pkg</tt></i></tt> <span class=
1.1 grant 6481: "emphasis"><em>must</em></span> be set to the correct
1.13 ! hubertf 6482: value by the end of the <tt class=
! 6483: "filename">builtin.mk</tt> file. Note that <tt class=
! 6484: "varname">USE_BUILTIN.<i class=
! 6485: "replaceable"><tt>pkg</tt></i></tt> may be
1.1 grant 6486: “<span class="quote">yes</span>” even if
1.13 ! hubertf 6487: <tt class="varname">IS_BUILTIN.<i class=
! 6488: "replaceable"><tt>pkg</tt></i></tt> is
1.1 grant 6489: “<span class="quote">no</span>” because we
6490: may make the determination that the built-in version of
6491: the software is similar enough to be used as a
6492: replacement.</p>
6493:
1.13 ! hubertf 6494: <p>The last section is guarded by <tt class=
! 6495: "varname">CHECK_BUILTIN.<i class=
! 6496: "replaceable"><tt>pkg</tt></i></tt>, and includes code
! 6497: that uses the value of <tt class=
! 6498: "varname">USE_BUILTIN.<i class=
! 6499: "replaceable"><tt>pkg</tt></i></tt> set in the previous
! 6500: section. This typically includes, e.g., adding
1.1 grant 6501: additional dependency restrictions and listing
1.13 ! hubertf 6502: additional files to symlink into <tt class=
! 6503: "filename">${BUILDLINK_DIR}</tt> (via <tt class=
! 6504: "varname">BUILDLINK_FILES.<i class=
! 6505: "replaceable"><tt>pkg</tt></i></tt>).</p>
1.1 grant 6506: </div>
6507:
6508: <div class="sect2" lang="en" xml:lang="en">
6509: <div class="titlepage">
6510: <div>
6511: <div>
1.13 ! hubertf 6512: <h3 class="title"><a name="id2568899" id=
! 6513: "id2568899"></a>9.3.2. Global preferences
1.1 grant 6514: for native or pkgsrc software</h3>
6515: </div>
6516: </div>
6517: </div>
6518:
6519: <p>When building packages, it's possible to choose
6520: whether to set a global preference for using either the
6521: built-in (native) version or the pkgsrc version of
6522: software to satisfy a dependency. This is controlled by
1.13 ! hubertf 6523: setting <tt class="varname">PREFER_PKGSRC</tt> and
! 6524: <tt class="varname">PREFER_NATIVE</tt>. These variables
! 6525: take values of either “<span class=
1.1 grant 6526: "quote">yes</span>”, “<span class=
6527: "quote">no</span>”, or a list of packages.
1.13 ! hubertf 6528: <tt class="varname">PREFER_PKGSRC</tt> tells pkgsrc to
! 6529: use the pkgsrc versions of software, while <tt class=
! 6530: "varname">PREFER_NATIVE</tt> tells pkgsrc to use the
! 6531: built-in versions. Preferences are determined by the
! 6532: most specific instance of the package in either
! 6533: <tt class="varname">PREFER_PKGSRC</tt> or <tt class=
! 6534: "varname">PREFER_NATIVE</tt>. If a package is specified
! 6535: in neither or in both variables, then <tt class=
! 6536: "varname">PREFER_PKGSRC</tt> has precedence over
! 6537: <tt class="varname">PREFER_NATIVE</tt>. For example, to
! 6538: require using pkgsrc versions of software for all but
! 6539: the most basic bits on a NetBSD system, you can
! 6540: set:</p>
1.1 grant 6541: <pre class="programlisting">
6542: PREFER_PKGSRC= yes
6543: PREFER_NATIVE= getopt skey tcp_wrappers
6544:
6545: </pre>
6546:
6547: <p>A package <span class=
1.13 ! hubertf 6548: "emphasis"><em>must</em></span> have a <tt class=
! 6549: "filename">builtin.mk</tt> file to be listed in
! 6550: <tt class="varname">PREFER_NATIVE</tt>, otherwise it is
! 6551: simply ignored in that list.</p>
1.1 grant 6552: </div>
6553: </div>
6554: </div>
6555:
6556: <div class="chapter" lang="en" xml:lang="en">
6557: <div class="titlepage">
6558: <div>
6559: <div>
6560: <h2 class="title"><a name="options" id=
6561: "options"></a>Chapter 10. Options
6562: handling</h2>
6563: </div>
6564: </div>
6565: </div>
6566:
6567: <div class="toc">
6568: <p><b>Table of Contents</b></p>
6569:
6570: <dl>
1.13 ! hubertf 6571: <dt><span class="sect1"><a href="#id2568971">10.1.
1.1 grant 6572: Global default options</a></span></dt>
6573:
1.13 ! hubertf 6574: <dt><span class="sect1"><a href="#id2568986">10.2.
! 6575: Converting packages to use
! 6576: bsd.options.mk</a></span></dt>
1.1 grant 6577: </dl>
6578: </div>
6579:
6580: <p>Many packages have the ability to be built to support
1.13 ! hubertf 6581: different sets of features. <tt class=
! 6582: "filename">bsd.options.mk</tt> is a framework in pkgsrc
1.1 grant 6583: that provides generic handling of those options that
6584: determine different ways in which the packages can be
6585: built. It's possible for the user to specify exactly which
6586: sets of options will be built into a package or to allow a
6587: set of global default options apply.</p>
6588:
6589: <div class="sect1" lang="en" xml:lang="en">
6590: <div class="titlepage">
6591: <div>
6592: <div>
6593: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 6594: "id2568971" id="id2568971"></a>10.1. Global
1.1 grant 6595: default options</h2>
6596: </div>
6597: </div>
6598: </div>
6599:
1.13 ! hubertf 6600: <p>Global default options are listed in <tt class=
! 6601: "varname">PKG_DEFAULT_OPTIONS</tt>, which is a list of
1.1 grant 6602: the options that should be built into every package if
6603: that option is supported. This variable should be set in
1.13 ! hubertf 6604: <tt class="filename">/etc/mk.conf</tt>.</p>
1.1 grant 6605: </div>
6606:
6607: <div class="sect1" lang="en" xml:lang="en">
6608: <div class="titlepage">
6609: <div>
6610: <div>
6611: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 6612: "id2568986" id=
! 6613: "id2568986"></a>10.2. Converting packages to
! 6614: use <tt class="filename">bsd.options.mk</tt></h2>
1.1 grant 6615: </div>
6616: </div>
6617: </div>
6618:
1.13 ! hubertf 6619: <p>The following example shows how <tt class=
! 6620: "filename">bsd.options.mk</tt> should be use in a package
! 6621: <tt class="filename">Makefile</tt>, or in a file, e.g.
! 6622: <tt class="filename">options.mk</tt>, that is included by
! 6623: the main package <tt class="filename">Makefile</tt>.</p>
1.1 grant 6624: <pre class="programlisting">
6625: # Global and legacy options
6626: .if defined(WIBBLE_USE_OPENLDAP) && !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
6627: PKG_DEFAULT_OPTIONS+= ldap
6628: .endif
6629: .if defined(USE_SASL2) && !empty(USE_SASL2:M[yY][eE][sS])
6630: PKG_DEFAULT_OPTIONS+= sasl
6631: .endif
6632:
6633: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
6634: PKG_SUPPORTED_OPTIONS= ldap sasl
6635: #
6636: # Default options for "wibble" package.
6637: #
6638: .if !defined(PKG_OPTIONS.wibble)
6639: PKG_DEFAULT_OPTIONS+= sasl
6640: endif
6641: .include "../../mk/bsd.options.mk"
6642:
6643: # Package-specific option-handling
6644:
6645: ###
6646: ### LDAP support
6647: ###
6648: .if !empty(PKG_OPTIONS:Mldap)
6649: . include "../../databases/openldap/buildlink3.mk"
6650: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
6651: .endif
6652:
6653: ###
6654: ### SASL authentication
6655: ###
6656: .if !empty(PKG_OPTIONS:Msasl)
6657: . include "../../security/cyrus-sasl2/buildlink3.mk"
6658: CONFIGURE_ARGS+= --enable-sasl=${BUILDLINK_PREFIX.sasl}
6659: .endif
6660:
6661: </pre>
6662:
6663: <p>The first section only exists if you are converting a
6664: package that had its own ad-hoc options handling to use
1.13 ! hubertf 6665: <tt class="filename">bsd.options.mk</tt>. It converts
1.1 grant 6666: global or legacy options variables into an equivalent
1.13 ! hubertf 6667: <tt class="varname">PKG_OPTIONS.<i class=
! 6668: "replaceable"><tt>pkg</tt></i></tt> value. These sections
! 6669: will be removed over time as the old options are in turn
! 6670: deprecated and removed.</p>
1.1 grant 6671:
6672: <p>The second section contains the information about
6673: which build options are supported by the package, and any
6674: default options settings if needed.</p>
6675:
6676: <div class="orderedlist">
6677: <ol type="1">
6678: <li>
1.13 ! hubertf 6679: <p><tt class="varname">PKG_OPTIONS_VAR</tt> is a
! 6680: list of the name of the <a href=
1.1 grant 6681: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6682: <span class="citerefentry"><span class=
6683: "refentrytitle">make</span>(1)</span></a> variables
6684: that contain the options the user wishes to select.
6685: The recommended value is “<span class=
1.13 ! hubertf 6686: "quote">PKG_OPTIONS.<i class=
! 6687: "replaceable"><tt>pkg</tt></i></span>” but
! 6688: any package-specific value may be used. This
1.1 grant 6689: variable should be set in a package Makefile.</p>
6690: </li>
6691:
6692: <li>
1.13 ! hubertf 6693: <p><tt class="varname">PKG_SUPPORTED_OPTIONS</tt>
! 6694: is a list of build options supported by the
! 6695: package. This variable should be set in a package
! 6696: Makefile.</p>
1.1 grant 6697: </li>
6698:
6699: <li>
1.13 ! hubertf 6700: <p><tt class="varname">${PKG_OPTIONS_VAR}</tt> (the
! 6701: variables named in <tt class=
! 6702: "varname">PKG_OPTIONS_VAR</tt>) are variables that
! 6703: list the selected build options and override any
! 6704: default options given in <tt class=
! 6705: "varname">PKG_DEFAULT_OPTIONS</tt>. If any of the
1.1 grant 6706: options begin with a “<span class=
6707: "quote">-</span>”, then that option is always
6708: removed from the selected build options, e.g.</p>
6709: <pre class="programlisting">
6710: PKG_DEFAULT_OPTIONS= kerberos ldap sasl
6711: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
6712: WIBBLE_OPTIONS= ${PKG_DEFAULT_OPTIONS} -sasl
6713: # implies PKG_OPTIONS == "kerberos ldap"
6714:
6715: </pre>
6716:
6717: <p>or</p>
6718: <pre class="programlisting">
6719: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
6720: WIBBLE_OPTIONS= kerberos -ldap ldap
6721: # implies PKG_OPTIONS == "kerberos"
6722:
6723: </pre>
6724:
1.13 ! hubertf 6725: <p>This variable should be set in <tt class=
! 6726: "filename">/etc/mk.conf</tt>.</p>
1.1 grant 6727: </li>
6728: </ol>
6729: </div>
6730:
6731: <p>After the inclusion of bsd.options.mk, the following
6732: variables are set:</p>
6733:
6734: <div class="itemizedlist">
6735: <ul type="disc">
6736: <li>
1.13 ! hubertf 6737: <p><tt class="varname">PKG_OPTIONS</tt> contains
! 6738: the list of the selected build options, properly
! 6739: filtered to remove unsupported and duplicate
! 6740: options.</p>
1.1 grant 6741: </li>
6742: </ul>
6743: </div>
6744:
6745: <p>The remaining sections contain the logic that is
6746: specific to each option. There should be a check for
1.13 ! hubertf 6747: every option listed in <tt class=
! 6748: "varname">PKG_SUPPORTED_OPTIONS</tt>, and there should be
! 6749: clear documentation on what turning on the option will do
! 6750: in the comments preceding each section. The correct way
! 6751: to check for an option is to check whether it is listed
! 6752: in <tt class="varname">PKG_OPTIONS</tt>.</p>
1.1 grant 6753: </div>
6754: </div>
6755:
6756: <div class="chapter" lang="en" xml:lang="en">
6757: <div class="titlepage">
6758: <div>
6759: <div>
6760: <h2 class="title"><a name="build" id=
6761: "build"></a>Chapter 11. The build
6762: process</h2>
6763: </div>
6764: </div>
6765: </div>
6766:
6767: <div class="toc">
6768: <p><b>Table of Contents</b></p>
6769:
6770: <dl>
6771: <dt><span class="sect1"><a href="#build.prefix">11.1.
6772: Program location</a></span></dt>
6773:
1.13 ! hubertf 6774: <dt><span class="sect1"><a href="#id2569662">11.2. Main
1.1 grant 6775: targets</a></span></dt>
6776:
6777: <dt><span class="sect1"><a href=
6778: "#build.helpful-targets">11.3. Other helpful
6779: targets</a></span></dt>
6780: </dl>
6781: </div>
6782:
6783: <p>The basic steps for building a program are always the
6784: same. First the program's source (<span class=
6785: "emphasis"><em>distfile</em></span>) must be brought to the
6786: local system and then extracted. After any patches to
6787: compile properly on NetBSD are applied, the software can be
6788: configured, then built (usually by compiling), and finally
6789: the generated binaries, etc. can be put into place on the
6790: system. These are exactly the steps performed by the NetBSD
6791: package system, which is implemented as a series of targets
1.13 ! hubertf 6792: in a central Makefile, <tt class=
! 6793: "filename">pkgsrc/mk/bsd.pkg.mk</tt>.</p>
1.1 grant 6794:
6795: <div class="sect1" lang="en" xml:lang="en">
6796: <div class="titlepage">
6797: <div>
6798: <div>
6799: <h2 class="title" style="clear: both"><a name=
6800: "build.prefix" id=
6801: "build.prefix"></a>11.1. Program location</h2>
6802: </div>
6803: </div>
6804: </div>
6805:
6806: <p>Before outlining the process performed by the NetBSD
6807: package system in the next section, here's a brief
6808: discussion on where programs are installed, and which
6809: variables influence this.</p>
6810:
1.13 ! hubertf 6811: <p>The automatic variable <tt class="varname">PREFIX</tt>
! 6812: indicates where all files of the final program shall be
! 6813: installed. It is usually set to <tt class=
! 6814: "varname">LOCALBASE</tt> (<tt class=
! 6815: "filename">/usr/pkg</tt>), or <tt class=
! 6816: "varname">CROSSBASE</tt> for pkgs in the
1.1 grant 6817: “<span class="quote">cross</span>” category.
1.13 ! hubertf 6818: The value of <tt class="varname">PREFIX</tt> needs to be
! 6819: put into the various places in the program's source where
! 6820: paths to these files are encoded. See <a href=
1.1 grant 6821: "#components.patches" title=
6822: "7.3. patches/*">Section 7.3,
6823: “patches/*”</a> and <a href="#fixes.libtool"
6824: title=
6825: "12.3.1. Shared libraries - libtool">Section 12.3.1,
6826: “Shared libraries - libtool”</a> for more
6827: details.</p>
6828:
6829: <p>When choosing which of these variables to use, follow
6830: the following rules:</p>
6831:
6832: <div class="itemizedlist">
6833: <ul type="disc">
6834: <li>
1.13 ! hubertf 6835: <p><tt class="varname">PREFIX</tt> always points to
! 6836: the location where the current pkg will be
! 6837: installed. When referring to a pkg's own
1.1 grant 6838: installation path, use “<span class=
6839: "quote">${PREFIX}</span>”.</p>
6840: </li>
6841:
6842: <li>
1.13 ! hubertf 6843: <p><tt class="varname">LOCALBASE</tt> is where all
! 6844: non-X11 pkgs are installed. If you need to
1.1 grant 6845: construct a -I or -L argument to the compiler to
6846: find includes and libraries installed by another
6847: non-X11 pkg, use “<span class=
6848: "quote">${LOCALBASE}</span>”.</p>
6849: </li>
6850:
6851: <li>
1.13 ! hubertf 6852: <p><tt class="varname">X11BASE</tt> is where the
! 6853: actual X11 distribution (from xsrc, etc.) is
1.1 grant 6854: installed. When looking for <span class=
6855: "emphasis"><em>standard</em></span> X11 includes
6856: (not those installed by a pkg), use
6857: “<span class=
6858: "quote">${X11BASE}</span>”.</p>
6859: </li>
6860:
6861: <li>
6862: <p>X11 based are special in that they may be
1.13 ! hubertf 6863: installed in either <tt class=
! 6864: "varname">X11BASE</tt> or <tt class=
! 6865: "varname">LOCALBASE</tt>.</p>
1.1 grant 6866:
6867: <p>Usually, X11 packages should be installed under
1.13 ! hubertf 6868: <tt class="varname">LOCALBASE</tt> whenever
! 6869: possible. Note that you will need to set <tt class=
! 6870: "varname">USE_X11</tt> in them to request the
! 6871: presence of X11 and to get the right compilation
! 6872: flags.</p>
1.1 grant 6873:
6874: <p>Even though, there are some packages that cannot
1.13 ! hubertf 6875: be installed under <tt class=
! 6876: "varname">LOCALBASE</tt>: those that come with
1.1 grant 6877: app-defaults files. These packages are special and
1.13 ! hubertf 6878: they must be placed under <tt class=
! 6879: "varname">X11BASE</tt>. To accomplish this, set
! 6880: either <tt class="varname">USE_X11BASE</tt> or
! 6881: <tt class="varname">USE_IMAKE</tt> in your
1.1 grant 6882: package.</p>
6883:
1.13 ! hubertf 6884: <p>Some notes: <tt class="varname">USE_X11</tt> and
! 6885: <tt class="varname">USE_X11BASE</tt> are mutually
! 6886: exclusive. If you need to find includes or
! 6887: libraries installed by a pkg that has <tt class=
! 6888: "varname">USE_IMAKE</tt> or <tt class=
! 6889: "varname">USE_X11BASE</tt> in its pkg <tt class=
! 6890: "filename">Makefile</tt>, you need to use
! 6891: <span class="emphasis"><em>both</em></span>
! 6892: <tt class="filename">${X11BASE}</tt> and <tt class=
! 6893: "filename">${LOCALBASE}</tt>. To force installation
! 6894: of all X11 packages in <tt class=
! 6895: "varname">LOCALBASE</tt>, the <a xmlns=
! 6896: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 6897: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.13 ! hubertf 6898: class="pkgname">pkgtools/xpkgwedge</a> is
! 6899: enabled by default.</p>
1.1 grant 6900: </li>
6901:
6902: <li>
1.13 ! hubertf 6903: <p><tt class="varname">X11PREFIX</tt> should be
1.1 grant 6904: used to refer to the installed location of an X11
1.13 ! hubertf 6905: package. <tt class="varname">X11PREFIX</tt> will be
! 6906: set to <tt class="varname">X11BASE</tt> if
! 6907: xpkgwedge is not installed, and to <tt class=
! 6908: "varname">LOCALBASE</tt> if xpkgwedge is
1.1 grant 6909: installed.</p>
6910: </li>
6911:
6912: <li>
6913: <p>If xpkgwedge is installed, it is possible to
1.13 ! hubertf 6914: have some packages installed in <tt class=
! 6915: "varname">X11BASE</tt> and some in <tt class=
! 6916: "varname">LOCALBASE</tt>. To determine the prefix
! 6917: of an installed package, the <tt class=
! 6918: "varname">EVAL_PREFIX</tt> definition can be used.
! 6919: It takes pairs in the format “<span class=
1.1 grant 6920: "quote">DIRNAME=<package></span>”, and
1.13 ! hubertf 6921: the make(1) variable <tt class=
! 6922: "varname">DIRNAME</tt> will be set to the prefix of
! 6923: the installed package <package>, or
1.1 grant 6924: “<span class=
6925: "quote">${X11PREFIX}</span>” if the package
6926: is not installed.</p>
6927:
6928: <p>This is best illustrated by example.</p>
6929:
1.13 ! hubertf 6930: <p>The following lines are taken from <tt class=
! 6931: "filename">pkgsrc/wm/scwm/Makefile</tt>:</p>
1.1 grant 6932: <pre class="programlisting">
1.13 ! hubertf 6933: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 6934: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
6935: --with-gtk-prefix="${GTKDIR}" \
6936: --enable-multibyte
6937: </pre>
6938:
6939: <p>Specific defaults can be defined for the
1.13 ! hubertf 6940: packages evaluated using <tt class=
! 6941: "varname">EVAL_PREFIX</tt>, by using a definition
1.1 grant 6942: of the form:</p>
6943: <pre class="programlisting">
6944: GTKDIR_DEFAULT= ${LOCALBASE}
6945: </pre>
6946:
1.13 ! hubertf 6947: <p>where <tt class="varname">GTKDIR</tt>
1.1 grant 6948: corresponds to the first definition in the
1.13 ! hubertf 6949: <tt class="varname">EVAL_PREFIX</tt> pair.</p>
1.1 grant 6950: </li>
6951:
6952: <li>
1.13 ! hubertf 6953: <p>Within <tt class="filename">${PREFIX}</tt>,
1.1 grant 6954: packages should install files according to hier(7),
6955: with the exception that manual pages go into
1.13 ! hubertf 6956: <tt class="filename">${PREFIX}/man</tt>, not
! 6957: <tt class="filename">${PREFIX}/share/man</tt>.</p>
1.1 grant 6958: </li>
6959: </ul>
6960: </div>
6961: </div>
6962:
6963: <div class="sect1" lang="en" xml:lang="en">
6964: <div class="titlepage">
6965: <div>
6966: <div>
6967: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 6968: "id2569662" id="id2569662"></a>11.2. Main
1.1 grant 6969: targets</h2>
6970: </div>
6971: </div>
6972: </div>
6973:
6974: <p>The main targets used during the build process defined
1.13 ! hubertf 6975: in <tt class="filename">bsd.pkg.mk</tt> are:</p>
1.1 grant 6976:
6977: <div class="variablelist">
6978: <dl>
6979: <dt><span class="term">fetch</span></dt>
6980:
6981: <dd>
6982: <p>This will check if the file(s) given in the
1.13 ! hubertf 6983: variables <tt class="varname">DISTFILES</tt> and
! 6984: <tt class="varname">PATCHFILES</tt> (as defined in
! 6985: the package's Makefile) are present on the local
! 6986: system in <tt class=
! 6987: "filename">/usr/pkgsrc/distfiles</tt>. If they are
! 6988: not present, an attempt will be made to fetch them
! 6989: using commands of the form:</p>
1.1 grant 6990: <pre class="programlisting">
6991: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
6992: </pre>
6993:
6994: <p>where ${site} varies through several
1.13 ! hubertf 6995: possibilities in turn: first, <tt class=
! 6996: "varname">MASTER_SITE_OVERRIDE</tt> is tried, then
! 6997: the sites specified in either <tt class=
! 6998: "varname">SITES_file</tt> if defined, else
! 6999: <tt class="varname">MASTER_SITES</tt> or <tt class=
! 7000: "varname">PATCH_SITES</tt>, as applies, then
! 7001: finally the value of <tt class=
! 7002: "varname">MASTER_SITE_BACKUP</tt>. The order of all
! 7003: except the first can be optionally sorted by the
! 7004: user, via setting either <tt class=
! 7005: "varname">MASTER_SORT_AWK</tt> or <tt class=
! 7006: "varname">MASTER_SORT_REGEX</tt>.</p>
1.1 grant 7007: </dd>
7008:
7009: <dt><span class="term">checksum</span></dt>
7010:
7011: <dd>
7012: <p>After the distfile(s) are fetched, their
7013: checksum is generated and compared with the
7014: checksums stored in the distinfo file. If the
7015: checksums don't match, the build is aborted. This
7016: is to ensure the same distfile is used for
7017: building, and that the distfile wasn't changed,
7018: e.g. by some malign force, deliberately changed
7019: distfiles on the master distribution site or
7020: network lossage.</p>
7021: </dd>
7022:
7023: <dt><span class="term">extract</span></dt>
7024:
7025: <dd>
7026: <p>When the distfiles are present on the local
7027: system, they need to be extracted, as they are
7028: usually in the form of some compressed archive
1.13 ! hubertf 7029: format, most commonly <tt class=
! 7030: "filename">.tar.gz</tt>.</p>
1.1 grant 7031:
7032: <p>If only some of the distfiles need to be
7033: uncompressed, the files to be uncompressed should
1.13 ! hubertf 7034: be put into <tt class=
! 7035: "varname">EXTRACT_ONLY</tt>.</p>
1.1 grant 7036:
1.13 ! hubertf 7037: <p>If the distfiles are not in <tt class=
! 7038: "filename">.tar.gz</tt> format, they can be
! 7039: extracted by setting either <tt class=
! 7040: "varname">EXTRACT_SUFX</tt>, or <tt class=
! 7041: "varname">EXTRACT_CMD</tt>, <tt class=
! 7042: "varname">EXTRACT_BEFORE_ARGS</tt> and <tt class=
! 7043: "varname">EXTRACT_AFTER_ARGS</tt>. In the former
! 7044: case, pkgsrc knows how to extract a number of
! 7045: suffixes (<tt class="filename">.tar.gz</tt>,
! 7046: <tt class="filename">.tgz</tt>, <tt class=
! 7047: "filename">.tar.gz2</tt>, <tt class=
! 7048: "filename">.tbz</tt>, <tt class=
! 7049: "filename">.tar.Z</tt>, <tt class=
! 7050: "filename">.tar</tt>, <tt class=
! 7051: "filename">.shar.gz</tt>, <tt class=
! 7052: "filename">.shar.bz2</tt>, <tt class=
! 7053: "filename">.shar.Z</tt>, <tt class=
! 7054: "filename">.shar</tt>, <tt class=
! 7055: "filename">.Z</tt>, <tt class="filename">.bz2</tt>
! 7056: and <tt class="filename">.gz</tt>; see the
! 7057: definition of the various <tt class=
! 7058: "varname">DECOMPRESS_CMD</tt> variables <tt class=
! 7059: "filename">bsd.pkg.mk</tt> for a complete list).
! 7060: Here's an example on how to use the other variables
! 7061: for a program that comes with a compressed shell
! 7062: archive whose name ends in <tt class=
! 7063: "filename">.msg.gz</tt>:</p>
1.1 grant 7064: <pre class="programlisting">
7065: EXTRACT_SUFX= .msg.gz
7066: EXTRACT_CMD= zcat
7067: EXTRACT_BEFORE_ARGS=
7068: EXTRACT_AFTER_ARGS= |sh
7069: </pre>
7070: </dd>
7071:
7072: <dt><span class="term">patch</span></dt>
7073:
7074: <dd>
7075: <p>After extraction, all the patches named by the
1.13 ! hubertf 7076: <tt class="varname">PATCHFILES</tt>, those present
! 7077: in the patches subdirectory of the package as well
! 7078: as in $LOCALPATCHES/$PKGPATH (e.g. <tt class=
! 7079: "filename">/usr/local/patches/graphics/png</tt>)
! 7080: are applied. Patchfiles ending in <tt class=
! 7081: "filename">.Z</tt> or <tt class="filename">.gz</tt>
! 7082: are uncompressed before they are applied, files
! 7083: ending in <tt class="filename">.orig</tt> or
! 7084: <tt class="filename">.rej</tt> are ignored. Any
! 7085: special options to patch(1) can be handed in
! 7086: <tt class="varname">PATCH_DIST_ARGS</tt>. See
! 7087: <a href="#components.patches" title=
1.1 grant 7088: "7.3. patches/*">Section 7.3,
7089: “patches/*”</a> for more details.</p>
7090:
7091: <p>By default patch(1) is given special args to
7092: make it fail if the patches apply with some lines
7093: of fuzz. Please fix (regen) the patches so that
7094: they apply cleanly. The rationale behind this is
7095: that patches that don't apply cleanly may end up
7096: being applied in the wrong place, and cause severe
7097: harm there.</p>
7098: </dd>
7099:
7100: <dt><span class="term">configure</span></dt>
7101:
7102: <dd>
7103: <p>Most pieces of software need information on the
7104: header files, system calls, and library routines
7105: which are available in NetBSD. This is the process
7106: known as configuration, and is usually automated.
7107: In most cases, a script is supplied with the
7108: source, and its invocation results in generation of
7109: header files, Makefiles, etc.</p>
7110:
7111: <p>If the program's distfile contains its own
7112: configure script, this can be invoked by setting
1.13 ! hubertf 7113: <tt class="varname">HAS_CONFIGURE</tt>. If the
1.1 grant 7114: configure script is a GNU autoconf script,
1.13 ! hubertf 7115: <tt class="varname">GNU_CONFIGURE</tt> should be
! 7116: specified instead. In either case, any arguments to
! 7117: the configure script can be specified in the
! 7118: <tt class="varname">CONFIGURE_ARGS</tt> variable,
! 7119: and the configure script's name can be set in
! 7120: <tt class="varname">CONFIGURE_SCRIPT</tt> if it
! 7121: differs from the default “<span class=
1.1 grant 7122: "quote">configure</span>”. Here's an example
7123: from the <a xmlns=
7124: "http://www.w3.org/TR/xhtml1/transitional" href=
7125: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.13 ! hubertf 7126: class="pkgname">sysutils/top</a> package:</p>
1.1 grant 7127: <pre class="programlisting">
7128: HAS_CONFIGURE= yes
7129: CONFIGURE_SCRIPT= Configure
7130: CONFIGURE_ARGS+= netbsd13
7131: </pre>
7132:
7133: <p>If the program uses an Imakefile for
7134: configuration, the appropriate steps can be invoked
1.13 ! hubertf 7135: by setting <tt class="varname">USE_IMAKE</tt> to
! 7136: “<span class="quote">YES</span>”. (If
! 7137: you only want the package installed in <tt class=
! 7138: "varname">$X11PREFIX</tt> but xmkmf not being run,
! 7139: set <tt class="varname">USE_X11BASE</tt>
! 7140: instead!)</p>
1.1 grant 7141: </dd>
7142:
7143: <dt><span class="term">build</span></dt>
7144:
7145: <dd>
7146: <p>Once configuration has taken place, the software
1.13 ! hubertf 7147: will be built by invoking <tt class=
! 7148: "varname">$MAKE_PROGRAM</tt> on <tt class=
! 7149: "varname">$MAKEFILE</tt> with <tt class=
! 7150: "varname">$BUILD_TARGET</tt> as the target to
! 7151: build. The default <tt class=
! 7152: "varname">MAKE_PROGRAM</tt> is “<span class=
! 7153: "quote">gmake</span>” if <tt class=
! 7154: "varname">USE_GNU_TOOLS</tt> contains
1.7 wiz 7155: “<span class="quote">make</span>”,
1.1 grant 7156: “<span class="quote">make</span>”
1.13 ! hubertf 7157: otherwise. <tt class="varname">MAKEFILE</tt> is set
! 7158: to “<span class=
1.1 grant 7159: "quote">Makefile</span>” by default, and
1.13 ! hubertf 7160: <tt class="varname">BUILD_TARGET</tt> defaults to
! 7161: “<span class="quote">all</span>”. Any
! 7162: of these variables can be set in the package's
1.1 grant 7163: Makefile to change the default build process.</p>
7164: </dd>
7165:
7166: <dt><span class="term">install</span></dt>
7167:
7168: <dd>
7169: <p>Once the build stage has completed, the final
7170: step is to install the software in public
7171: directories, so users can access the programs and
1.13 ! hubertf 7172: files. As in the build-target, <tt class=
! 7173: "varname">$MAKE_PROGRAM</tt> is invoked on
! 7174: <tt class="varname">$MAKEFILE</tt> here, but with
! 7175: the <tt class="varname">$INSTALL_TARGET</tt>
! 7176: instead, the latter defaulting to
! 7177: “<span class="quote">install</span>”
! 7178: (plus “<span class=
! 7179: "quote">install.man</span>”, if <tt class=
! 7180: "varname">USE_IMAKE</tt> is set).</p>
1.1 grant 7181: </dd>
7182: </dl>
7183: </div>
7184:
7185: <p>If no target is specified, the default is
7186: “<span class="quote">build</span>”. If a
7187: subsequent stage is requested, all prior stages are made:
1.13 ! hubertf 7188: e.g. <span><b class="command">make build</b></span> will
! 7189: also perform the equivalent of:</p>
1.1 grant 7190: <pre class="programlisting">
7191: make fetch
7192: make checksum
7193: make extract
7194: make patch
7195: make configure
7196: make build
7197: </pre>
7198: </div>
7199:
7200: <div class="sect1" lang="en" xml:lang="en">
7201: <div class="titlepage">
7202: <div>
7203: <div>
7204: <h2 class="title" style="clear: both"><a name=
7205: "build.helpful-targets" id=
7206: "build.helpful-targets"></a>11.3. Other
7207: helpful targets</h2>
7208: </div>
7209: </div>
7210: </div>
7211:
7212: <div class="variablelist">
7213: <dl>
7214: <dt><span class="term">pre/post-*</span></dt>
7215:
7216: <dd>
7217: <p>For any of the main targets described in the
7218: previous section, two auxiliary targets exist with
7219: “<span class="quote">pre-</span>” and
7220: “<span class="quote">post-</span>” used
7221: as a prefix for the main target's name. These
7222: targets are invoked before and after the main
7223: target is called, allowing extra configuration or
7224: installation steps be performed from a package's
7225: Makefile, for example, which a program's configure
7226: script or install target omitted.</p>
7227: </dd>
7228:
7229: <dt><span class="term">do-*</span></dt>
7230:
7231: <dd>
7232: <p>Should one of the main targets do the wrong
7233: thing, and should there be no variable to fix this,
7234: you can redefine it with the do-* target. (Note
7235: that redefining the target itself instead of the
7236: do-* target is a bad idea, as the pre-* and post-*
7237: targets won't be called anymore, etc.) You will not
7238: usually need to do this.</p>
7239: </dd>
7240:
7241: <dt><span class="term">reinstall</span></dt>
7242:
7243: <dd>
1.13 ! hubertf 7244: <p>If you did a <span><b class="command">make
! 7245: install</b></span> and you noticed some file was
! 7246: not installed properly, you can repeat the
1.1 grant 7247: installation with this target, which will ignore
7248: the “<span class="quote">already
7249: installed</span>” flag.</p>
7250: </dd>
7251:
7252: <dt><span class="term">deinstall</span></dt>
7253:
7254: <dd>
7255: <p>This target does a pkg_delete(1) in the current
7256: directory, effectively de-installing the package.
7257: The following variables can be used to tune the
7258: behaviour:</p>
7259:
7260: <div class="variablelist">
7261: <dl>
1.13 ! hubertf 7262: <dt><span class="term"><tt class=
! 7263: "varname">PKG_VERBOSE</tt></span></dt>
1.1 grant 7264:
7265: <dd>
7266: <p>Add a "-v" to the <a href=
7267: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7268: <span class="citerefentry"><span class=
7269: "refentrytitle">pkg_delete</span>(1)</span></a>
7270: command.</p>
7271: </dd>
7272:
1.13 ! hubertf 7273: <dt><span class="term"><tt class=
! 7274: "varname">DEINSTALLDEPENDS</tt></span></dt>
1.1 grant 7275:
7276: <dd>
7277: <p>Remove all packages that require (depend
7278: on) the given package. This can be used to
7279: remove any packages that may have been pulled
7280: in by a given package, e.g. if
1.13 ! hubertf 7281: <span><b class="command">make deinstall
! 7282: DEINSTALLDEPENDS=1</b></span> is done in
! 7283: <tt class="filename">pkgsrc/x11/kde</tt>,
1.1 grant 7284: this is likely to remove whole KDE. Works by
7285: adding “<span class=
7286: "quote">-R</span>” to the <a href=
7287: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7288: <span class="citerefentry"><span class=
7289: "refentrytitle">pkg_delete</span>(1)</span></a>
7290: command line.</p>
7291: </dd>
7292: </dl>
7293: </div>
7294: </dd>
7295:
7296: <dt><span class="term">update</span></dt>
7297:
7298: <dd>
7299: <p>This target causes the current package to be
7300: updated to the latest version. The package and all
7301: depending packages first get de-installed, then
7302: current versions of the corresponding packages get
7303: compiled and installed. This is similar to manually
7304: noting which packages are currently installed, then
1.13 ! hubertf 7305: performing a series of <span><b class=
! 7306: "command">make deinstall</b></span> and
! 7307: <span><b class="command">make install</b></span>
! 7308: (or whatever <tt class="varname">UPDATE_TARGET</tt>
! 7309: is set to) for these packages.</p>
1.1 grant 7310:
7311: <p>You can use the “<span class=
7312: "quote">update</span>” target to resume
1.13 ! hubertf 7313: package updating in case a previous <span><b class=
! 7314: "command">make update</b></span> was interrupted
! 7315: for some reason. However, in this case, make sure
! 7316: you don't call <span><b class="command">make
! 7317: clean</b></span> or otherwise remove the list of
! 7318: dependent packages in <tt class=
! 7319: "varname">WRKDIR</tt>. Otherwise you lose the
1.1 grant 7320: ability to automatically update the current package
7321: along with the dependent packages you have
7322: installed.</p>
7323:
1.13 ! hubertf 7324: <p>Resuming an interrupted <span><b class=
! 7325: "command">make update</b></span> will only work as
! 7326: long as the package tree remains unchanged. If the
! 7327: source code for one of the packages to be updated
! 7328: has been changed, resuming <span><b class=
! 7329: "command">make update</b></span> will most
! 7330: certainly fail!</p>
1.1 grant 7331:
7332: <p>The following variables can be used either on
1.13 ! hubertf 7333: the command line or in <tt class=
! 7334: "filename">/etc/mk.conf</tt> to alter the behaviour
! 7335: of <span><b class="command">make
! 7336: update</b></span>:</p>
1.1 grant 7337:
7338: <div class="variablelist">
7339: <dl>
1.13 ! hubertf 7340: <dt><span class="term"><tt class=
! 7341: "varname">UPDATE_TARGET</tt></span></dt>
1.1 grant 7342:
7343: <dd>
7344: <p>Install target to recursively use for the
7345: updated package and the dependent packages.
1.13 ! hubertf 7346: Defaults to <tt class=
! 7347: "varname">DEPENDS_TARGET</tt> if set,
1.1 grant 7348: “<span class=
7349: "quote">install</span>” otherwise for
1.13 ! hubertf 7350: <span><b class="command">make
! 7351: update</b></span>. e.g. <span><b class=
! 7352: "command">make update
! 7353: UPDATE_TARGET=package</b></span></p>
1.1 grant 7354: </dd>
7355:
1.13 ! hubertf 7356: <dt><span class="term"><tt class=
! 7357: "varname">NOCLEAN</tt></span></dt>
1.1 grant 7358:
7359: <dd>
7360: <p>Don't clean up after updating. Useful if
7361: you want to leave the work sources of the
7362: updated packages around for inspection or
7363: other purposes. Be sure you eventually clean
7364: up the source tree (see the
7365: “<span class=
7366: "quote">clean-update</span>” target
7367: below) or you may run into troubles with old
7368: source code still lying around on your next
1.13 ! hubertf 7369: <span><b class="command">make</b></span> or
! 7370: <span><b class="command">make
! 7371: update</b></span>.</p>
1.1 grant 7372: </dd>
7373:
1.13 ! hubertf 7374: <dt><span class="term"><tt class=
! 7375: "varname">REINSTALL</tt></span></dt>
1.1 grant 7376:
7377: <dd>
7378: <p>Deinstall each package before installing
1.13 ! hubertf 7379: (making <tt class=
! 7380: "varname">DEPENDS_TARGET</tt>). This may be
1.1 grant 7381: necessary if the “<span class=
7382: "quote">clean-update</span>” target
7383: (see below) was called after interrupting a
1.13 ! hubertf 7384: running <span><b class="command">make
! 7385: update</b></span>.</p>
1.1 grant 7386: </dd>
7387:
1.13 ! hubertf 7388: <dt><span class="term"><tt class=
! 7389: "varname">DEPENDS_TARGET</tt></span></dt>
1.1 grant 7390:
7391: <dd>
7392: <p>Allows you to disable recursion and
7393: hardcode the target for packages. The default
7394: is “<span class=
7395: "quote">update</span>” for the update
7396: target, facilitating a recursive update of
1.13 ! hubertf 7397: prerequisite packages. Only set <tt class=
! 7398: "varname">DEPENDS_TARGET</tt> if you want to
! 7399: disable recursive updates. Use <tt class=
! 7400: "varname">UPDATE_TARGET</tt> instead to just
! 7401: set a specific target for each package to be
! 7402: installed during <span><b class=
! 7403: "command">make update</b></span> (see
! 7404: above).</p>
1.1 grant 7405: </dd>
7406: </dl>
7407: </div>
7408: </dd>
7409:
7410: <dt><span class="term">clean-update</span></dt>
7411:
7412: <dd>
7413: <p>Clean the source tree for all packages that
1.13 ! hubertf 7414: would get updated if <span><b class="command">make
! 7415: update</b></span> was called from the current
! 7416: directory. This target should not be used if the
! 7417: current package (or any of its depending packages)
! 7418: have already been de-installed (e.g., after calling
! 7419: <span><b class="command">make update</b></span>) or
! 7420: you may lose some packages you intended to update.
! 7421: As a rule of thumb: only use this target
! 7422: <span class="emphasis"><em>before</em></span> the
! 7423: first time you run <span><b class="command">make
! 7424: update</b></span> and only if you have a dirty
! 7425: package tree (e.g., if you used <tt class=
! 7426: "varname">NOCLEAN</tt>).</p>
1.1 grant 7427:
7428: <p>If you unsure about whether your tree is clean
1.13 ! hubertf 7429: you can either perform a <span><b class=
! 7430: "command">make clean</b></span> at the top of the
! 7431: tree, or use the following sequence of commands
1.1 grant 7432: from the directory of the package you want to
7433: update (<span class=
7434: "emphasis"><em>before</em></span> running
1.13 ! hubertf 7435: <span><b class="command">make update</b></span> for
! 7436: the first time, otherwise you lose all the packages
! 7437: you wanted to update!):</p>
1.1 grant 7438: <pre class="screen">
1.13 ! hubertf 7439: <tt class="prompt">#</tt> <b class=
! 7440: "userinput"><tt>make clean-update</tt></b>
! 7441: <tt class="prompt">#</tt> <b class=
! 7442: "userinput"><tt>make clean CLEANDEPENDS=YES</tt></b>
! 7443: <tt class="prompt">#</tt> <b class=
! 7444: "userinput"><tt>make update</tt></b>
1.1 grant 7445: </pre>
7446:
7447: <p>The following variables can be used either on
1.13 ! hubertf 7448: the command line or in <tt class=
! 7449: "filename">/etc/mk.conf</tt> to alter the behaviour
! 7450: of <span><b class="command">make
! 7451: clean-update</b></span>:</p>
1.1 grant 7452:
7453: <div class="variablelist">
7454: <dl>
1.13 ! hubertf 7455: <dt><span class="term"><tt class=
! 7456: "varname">CLEAR_DIRLIST</tt></span></dt>
1.1 grant 7457:
7458: <dd>
1.13 ! hubertf 7459: <p>After <span><b class="command">make
! 7460: clean</b></span>, do not reconstruct the list
! 7461: of directories to update for this package.
! 7462: Only use this if <span><b class=
! 7463: "command">make update</b></span> successfully
! 7464: installed all packages you wanted to update.
! 7465: Normally, this is done automatically on
! 7466: <span><b class="command">make
! 7467: update</b></span>, but may have been
! 7468: suppressed by the <tt class=
! 7469: "varname">NOCLEAN</tt> variable (see
1.1 grant 7470: above).</p>
7471: </dd>
7472: </dl>
7473: </div>
7474: </dd>
7475:
7476: <dt><span class="term">info</span></dt>
7477:
7478: <dd>
7479: <p>This target invokes <a href=
7480: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
7481: <span class="citerefentry"><span class=
7482: "refentrytitle">pkg_info</span>(1)</span></a> for
7483: the current package. You can use this to check
7484: which version of a package is installed.</p>
7485: </dd>
7486:
7487: <dt><span class="term">readme</span></dt>
7488:
7489: <dd>
1.13 ! hubertf 7490: <p>This target generates a <tt class=
! 7491: "filename">README.html</tt> file, which can be
1.1 grant 7492: viewed using a browser such as <a xmlns=
7493: "http://www.w3.org/TR/xhtml1/transitional" href=
7494: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.13 ! hubertf 7495: class="pkgname">www/mozilla</a> or <a xmlns=
! 7496: "http://www.w3.org/TR/xhtml1/transitional" href=
! 7497: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
! 7498: class="pkgname">www/links</a>. The generated
! 7499: files contain references to any packages which
! 7500: are in the <tt class="varname">PACKAGES</tt>
! 7501: directory on the local host. The generated files
! 7502: can be made to refer to URLs based on <tt class=
! 7503: "varname">FTP_PKG_URL_HOST</tt> and <tt class=
! 7504: "varname">FTP_PKG_URL_DIR</tt>. For example, if
! 7505: I wanted to generate <tt class=
! 7506: "filename">README.html</tt> files which pointed
! 7507: to binary packages on the local machine, in the
! 7508: directory <tt class=
! 7509: "filename">/usr/packages</tt>, set <tt class=
! 7510: "varname">FTP_PKG_URL_HOST=file://localhost</tt>
! 7511: and <tt class=
! 7512: "varname">FTP_PKG_URL_DIR=/usr/packages</tt>.
! 7513: The <tt class="varname">${PACKAGES}</tt>
! 7514: directory and its subdirectories will be
! 7515: searched for all the binary packages.</p>
1.1 grant 7516: </dd>
7517:
7518: <dt><span class="term">readme-all</span></dt>
7519:
7520: <dd>
1.13 ! hubertf 7521: <p>Use this target to create a file <tt class=
! 7522: "filename">README-all.html</tt> which contains a
1.1 grant 7523: list of all packages currently available in the
7524: NetBSD Packages Collection, together with the
7525: category they belong to and a short description.
1.13 ! hubertf 7526: This file is compiled from the <tt class=
! 7527: "filename">pkgsrc/*/README.html</tt> files, so be
1.1 grant 7528: sure to run this <span class=
1.13 ! hubertf 7529: "emphasis"><em>after</em></span> a <span><b class=
! 7530: "command">make readme</b></span>.</p>
1.1 grant 7531: </dd>
7532:
7533: <dt><span class="term">cdrom-readme</span></dt>
7534:
7535: <dd>
7536: <p>This is very much the same as the
7537: “<span class="quote">readme</span>”
7538: target (see above), but is to be used when
7539: generating a pkgsrc tree to be written to a CD-ROM.
1.13 ! hubertf 7540: This target also produces <tt class=
! 7541: "filename">README.html</tt> files, and can be made
! 7542: to refer to URLs based on <tt class=
! 7543: "varname">CDROM_PKG_URL_HOST</tt> and <tt class=
! 7544: "varname">CDROM_PKG_URL_DIR</tt>.</p>
1.1 grant 7545: </dd>
7546:
7547: <dt><span class="term">show-distfiles</span></dt>
7548:
7549: <dd>
7550: <p>This target shows which distfiles and patchfiles
1.13 ! hubertf 7551: are needed to build the package. (<tt class=
! 7552: "varname">DISTFILES</tt> and <tt class=
! 7553: "varname">PATCHFILES</tt>, but not <tt class=
! 7554: "filename">patches/*</tt>)</p>
1.1 grant 7555: </dd>
7556:
7557: <dt><span class="term">show-downlevel</span></dt>
7558:
7559: <dd>
7560: <p>This target shows nothing if the package is not
7561: installed. If a version of this package is
7562: installed, but is not the version provided in this
7563: version of pkgsrc, then a warning message is
7564: displayed. This target can be used to show which of
7565: your installed packages are downlevel, and so the
7566: old versions can be deleted, and the current ones
7567: added.</p>
7568: </dd>
7569:
7570: <dt><span class="term">show-pkgsrc-dir</span></dt>
7571:
7572: <dd>
7573: <p>This target shows the directory in the pkgsrc
7574: hierarchy from which the package can be built and
7575: installed. This may not be the same directory as
7576: the one from which the package was installed. This
7577: target is intended to be used by people who may
7578: wish to upgrade many packages on a single host, and
7579: can be invoked from the top-level pkgsrc Makefile
7580: by using the “<span class=
7581: "quote">show-host-specific-pkgs</span>”
7582: target.</p>
7583: </dd>
7584:
7585: <dt><span class=
7586: "term">show-installed-depends</span></dt>
7587:
7588: <dd>
7589: <p>This target shows which installed packages match
1.13 ! hubertf 7590: the current package's <tt class=
! 7591: "varname">DEPENDS</tt>. Useful if out of date
1.1 grant 7592: dependencies are causing build problems.</p>
7593: </dd>
7594:
7595: <dt><span class="term">check-shlibs</span></dt>
7596:
7597: <dd>
7598: <p>After a package is installed, check all its
7599: binaries and (on ELF platforms) shared libraries to
7600: see if they find the shared libs they need. Run by
1.13 ! hubertf 7601: default if <tt class="varname">PKG_DEVELOPER</tt>
! 7602: is set in <tt class=
! 7603: "filename">/etc/mk.conf</tt>.</p>
1.1 grant 7604: </dd>
7605:
7606: <dt><span class="term">print-PLIST</span></dt>
7607:
7608: <dd>
7609: <p>After a “<span class="quote">make
7610: install</span>” from a new or upgraded pkg,
7611: this prints out an attempt to generate a new
1.13 ! hubertf 7612: <tt class="filename">PLIST</tt> from a
! 7613: <span><b class="command">find -newer
! 7614: work/.extract_done</b></span>. An attempt is made
! 7615: to care for shared libs etc., but it is
1.1 grant 7616: <span class="emphasis"><em>strongly</em></span>
7617: recommended to review the result before putting it
1.13 ! hubertf 7618: into <tt class="filename">PLIST</tt>. On upgrades,
! 7619: it's useful to diff the output of this command
! 7620: against an already existing <tt class=
! 7621: "filename">PLIST</tt> file.</p>
1.1 grant 7622:
7623: <p>If the package installs files via tar(1) or
7624: other methods that don't update file access times,
7625: be sure to add these files manually to your
1.13 ! hubertf 7626: <tt class="filename">PLIST</tt>, as the
1.1 grant 7627: “<span class="quote">find
7628: -newer</span>” command used by this target
7629: won't catch them!</p>
7630:
7631: <p>See <a href="#print-PLIST" title=
7632: "8.3. Tweaking output of make print-PLIST">Section 8.3,
1.13 ! hubertf 7633: “Tweaking output of make
! 7634: print-PLIST”</a> for more information on this
! 7635: target.</p>
1.1 grant 7636: </dd>
7637:
7638: <dt><span class="term">bulk-package</span></dt>
7639:
7640: <dd>
7641: <p>Used to do bulk builds. If an appropriate binary
7642: package already exists, no action is taken. If not,
7643: this target will compile, install and package it
1.13 ! hubertf 7644: (and it's depends, if <tt class=
! 7645: "varname">PKG_DEPENDS</tt> is set properly. See
1.1 grant 7646: <a href="#binary.configuration" title=
7647: "5.3.1. Configuration">Section 5.3.1,
7648: “Configuration”</a>. After creating the
7649: binary package, the sources, the just-installed
7650: package and it's required packages are removed,
7651: preserving free disk space.</p>
7652:
7653: <p><span class="emphasis"><em>Beware that this
7654: target may deinstall all packages installed on a
7655: system!</em></span></p>
7656: </dd>
7657:
7658: <dt><span class="term">bulk-install</span></dt>
7659:
7660: <dd>
7661: <p>Used during bulk-installs to install required
7662: packages. If an upto-date binary package is
7663: available, it will be installed via <a href=
7664: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7665: <span class="citerefentry"><span class=
7666: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.13 ! hubertf 7667: not, <span><b class="command">make
! 7668: bulk-package</b></span> will be executed, but the
! 7669: installed binary not be removed.</p>
1.1 grant 7670:
7671: <p>A binary package is considered
7672: “<span class="quote">upto-date</span>”
7673: to be installed via <a href=
7674: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7675: <span class="citerefentry"><span class=
7676: "refentrytitle">pkg_add</span>(1)</span></a>
7677: if:</p>
7678:
7679: <div class="itemizedlist">
7680: <ul type="disc">
7681: <li>
1.13 ! hubertf 7682: <p>None of the package's files (<tt class=
! 7683: "filename">Makefile</tt>, ...) were modified
! 7684: since it was built.</p>
1.1 grant 7685: </li>
7686:
7687: <li>
7688: <p>None of the package's required (binary)
7689: packages were modified since it was
7690: built.</p>
7691: </li>
7692: </ul>
7693: </div>
7694:
7695: <p><span class="emphasis"><em>Beware that this
7696: target may deinstall all packages installed on a
7697: system!</em></span></p>
7698: </dd>
7699: </dl>
7700: </div>
7701: </div>
7702: </div>
7703:
7704: <div class="chapter" lang="en" xml:lang="en">
7705: <div class="titlepage">
7706: <div>
7707: <div>
7708: <h2 class="title"><a name="fixes" id=
7709: "fixes"></a>Chapter 12. Notes on fixes for
7710: packages</h2>
7711: </div>
7712: </div>
7713: </div>
7714:
7715: <div class="toc">
7716: <p><b>Table of Contents</b></p>
7717:
7718: <dl>
1.13 ! hubertf 7719: <dt><span class="sect1"><a href="#id2571063">12.1.
1.1 grant 7720: General operation</a></span></dt>
7721:
7722: <dd>
7723: <dl>
7724: <dt><span class="sect2"><a href=
1.13 ! hubertf 7725: "#id2571066">12.1.1. How to pull in variables from
1.1 grant 7726: /etc/mk.conf</a></span></dt>
7727:
7728: <dt><span class="sect2"><a href=
1.13 ! hubertf 7729: "#id2571149">12.1.2. Restricted
1.1 grant 7730: packages</a></span></dt>
7731:
7732: <dt><span class="sect2"><a href=
7733: "#dependencies">12.1.3. Handling
7734: dependencies</a></span></dt>
7735:
7736: <dt><span class="sect2"><a href=
1.13 ! hubertf 7737: "#id2571733">12.1.4. Handling conflicts with other
1.1 grant 7738: packages</a></span></dt>
7739:
7740: <dt><span class="sect2"><a href=
1.13 ! hubertf 7741: "#id2571851">12.1.5. Packages that cannot or should
1.1 grant 7742: not be built</a></span></dt>
7743:
7744: <dt><span class="sect2"><a href=
1.13 ! hubertf 7745: "#id2571877">12.1.6. Packages which should not be
1.1 grant 7746: deleted, once installed</a></span></dt>
7747:
7748: <dt><span class="sect2"><a href=
7749: "#security-handling">12.1.7. Handling packages with
7750: security problems</a></span></dt>
7751:
7752: <dt><span class="sect2"><a href=
1.13 ! hubertf 7753: "#id2571969">12.1.8. How to handle compiler
1.1 grant 7754: bugs</a></span></dt>
7755:
7756: <dt><span class="sect2"><a href=
1.13 ! hubertf 7757: "#id2571991">12.1.9. How to handle incrementing
1.1 grant 7758: versions when fixing an existing
7759: package</a></span></dt>
7760:
7761: <dt><span class="sect2"><a href=
1.13 ! hubertf 7762: "#id2572108">12.1.10. Portability of
1.1 grant 7763: packages</a></span></dt>
7764: </dl>
7765: </dd>
7766:
1.13 ! hubertf 7767: <dt><span class="sect1"><a href="#id2572133">12.2.
1.1 grant 7768: Possible downloading issues</a></span></dt>
7769:
7770: <dd>
7771: <dl>
7772: <dt><span class="sect2"><a href=
1.13 ! hubertf 7773: "#id2572136">12.2.1. Packages whose distfiles
1.1 grant 7774: aren't available for plain
7775: downloading</a></span></dt>
7776:
7777: <dt><span class="sect2"><a href=
1.13 ! hubertf 7778: "#id2572267">12.2.2. How to handle modified
1.1 grant 7779: distfiles with the 'old' name</a></span></dt>
7780: </dl>
7781: </dd>
7782:
1.13 ! hubertf 7783: <dt><span class="sect1"><a href="#id2572279">12.3.
1.1 grant 7784: Configuration gotchas</a></span></dt>
7785:
7786: <dd>
7787: <dl>
7788: <dt><span class="sect2"><a href=
7789: "#fixes.libtool">12.3.1. Shared libraries -
7790: libtool</a></span></dt>
7791:
7792: <dt><span class="sect2"><a href=
1.13 ! hubertf 7793: "#id2572618">12.3.2. Using libtool on GNU packages
1.1 grant 7794: that already support libtool</a></span></dt>
7795:
7796: <dt><span class="sect2"><a href=
1.13 ! hubertf 7797: "#id2572702">12.3.3. GNU
1.1 grant 7798: Autoconf/Automake</a></span></dt>
7799: </dl>
7800: </dd>
7801:
1.13 ! hubertf 7802: <dt><span class="sect1"><a href="#id2572747">12.4.
1.1 grant 7803: Building considerations</a></span></dt>
7804:
7805: <dd>
7806: <dl>
7807: <dt><span class="sect2"><a href=
1.13 ! hubertf 7808: "#id2572750">12.4.1. CPP defines</a></span></dt>
1.1 grant 7809: </dl>
7810: </dd>
7811:
1.13 ! hubertf 7812: <dt><span class="sect1"><a href="#id2572780">12.5.
1.1 grant 7813: Package specific actions</a></span></dt>
7814:
7815: <dd>
7816: <dl>
7817: <dt><span class="sect2"><a href=
1.13 ! hubertf 7818: "#id2572784">12.5.1. Package configuration
1.1 grant 7819: files</a></span></dt>
7820:
7821: <dt><span class="sect2"><a href=
1.13 ! hubertf 7822: "#id2573022">12.5.2. User
1.2 hubertf 7823: interaction</a></span></dt>
1.1 grant 7824:
7825: <dt><span class="sect2"><a href=
1.13 ! hubertf 7826: "#id2573136">12.5.3. Handling
1.1 grant 7827: licenses</a></span></dt>
7828:
7829: <dt><span class="sect2"><a href=
1.13 ! hubertf 7830: "#id2573287">12.5.4. Creating an account from a
1.1 grant 7831: package</a></span></dt>
7832:
7833: <dt><span class="sect2"><a href=
1.13 ! hubertf 7834: "#id2573349">12.5.5. Installing score
1.1 grant 7835: files</a></span></dt>
7836:
7837: <dt><span class="sect2"><a href=
1.13 ! hubertf 7838: "#id2573393">12.5.6. Packages providing login
1.1 grant 7839: shells</a></span></dt>
7840:
7841: <dt><span class="sect2"><a href=
1.13 ! hubertf 7842: "#id2573518">12.5.7. Packages containing perl
1.1 grant 7843: scripts</a></span></dt>
7844:
7845: <dt><span class="sect2"><a href=
1.13 ! hubertf 7846: "#id2573537">12.5.8. Packages with hardcoded paths
1.1 grant 7847: to other interpreters</a></span></dt>
7848:
7849: <dt><span class="sect2"><a href=
1.13 ! hubertf 7850: "#id2573558">12.5.9. Packages installing perl
1.1 grant 7851: modules</a></span></dt>
7852:
7853: <dt><span class="sect2"><a href=
7854: "#faq.info-files">12.5.10. Packages installing info
7855: files</a></span></dt>
7856:
7857: <dt><span class="sect2"><a href=
1.13 ! hubertf 7858: "#id2573778">12.5.11. Packages installing GConf2
1.1 grant 7859: data files</a></span></dt>
7860:
7861: <dt><span class="sect2"><a href=
1.13 ! hubertf 7862: "#id2573946">12.5.12. Packages installing
1.1 grant 7863: scrollkeeper data files</a></span></dt>
7864:
7865: <dt><span class="sect2"><a href=
1.13 ! hubertf 7866: "#id2573997">12.5.13. Packages installing X11
1.1 grant 7867: fonts</a></span></dt>
7868:
7869: <dt><span class="sect2"><a href=
1.13 ! hubertf 7870: "#id2574044">12.5.14. Packages installing GTK2
1.1 grant 7871: modules</a></span></dt>
7872:
7873: <dt><span class="sect2"><a href=
1.13 ! hubertf 7874: "#id2574114">12.5.15. Packages installing SGML or
1.1 grant 7875: XML data</a></span></dt>
7876:
7877: <dt><span class="sect2"><a href=
1.13 ! hubertf 7878: "#id2574234">12.5.16. Packages installing
1.1 grant 7879: extensions to the MIME database</a></span></dt>
7880:
7881: <dt><span class="sect2"><a href=
1.13 ! hubertf 7882: "#id2574305">12.5.17. Packages using
1.1 grant 7883: intltool</a></span></dt>
7884: </dl>
7885: </dd>
7886:
1.13 ! hubertf 7887: <dt><span class="sect1"><a href="#id2574318">12.6.
1.1 grant 7888: Feedback to the author</a></span></dt>
7889: </dl>
7890: </div>
7891:
7892: <div class="sect1" lang="en" xml:lang="en">
7893: <div class="titlepage">
7894: <div>
7895: <div>
7896: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 7897: "id2571063" id="id2571063"></a>12.1. General
1.1 grant 7898: operation</h2>
7899: </div>
7900: </div>
7901: </div>
7902:
7903: <div class="sect2" lang="en" xml:lang="en">
7904: <div class="titlepage">
7905: <div>
7906: <div>
1.13 ! hubertf 7907: <h3 class="title"><a name="id2571066" id=
! 7908: "id2571066"></a>12.1.1. How to pull in
1.1 grant 7909: variables from /etc/mk.conf</h3>
7910: </div>
7911: </div>
7912: </div>
7913:
7914: <p>The problem with package-defined variables that can
1.13 ! hubertf 7915: be overridden via <tt class="varname">MAKECONF</tt> or
! 7916: <tt class="filename">/etc/mk.conf</tt> is that <a href=
1.1 grant 7917: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7918: <span class="citerefentry"><span class=
7919: "refentrytitle">make</span>(1)</span></a> expands a
7920: variable as it is used, but evaluates preprocessor like
7921: statements (.if, .ifdef and .ifndef) as they are read.
1.13 ! hubertf 7922: So, to use any variable (which may be set in <tt class=
! 7923: "filename">/etc/mk.conf</tt>) in one of the .if*
! 7924: statements, the file <tt class=
! 7925: "filename">/etc/mk.conf</tt> must be included before
1.1 grant 7926: that .if* statement.</p>
7927:
7928: <p>Rather than have a number of ad-hoc ways of
1.13 ! hubertf 7929: including <tt class="filename">/etc/mk.conf</tt>,
! 7930: should it exist, or <tt class="varname">MAKECONF</tt>,
! 7931: should it exist, include the <tt class=
! 7932: "filename">pkgsrc/mk/bsd.prefs.mk</tt> file in the
! 7933: package Makefile before any preprocessor-like .if,
! 7934: .ifdef, or .ifndef statements:</p>
1.1 grant 7935: <pre class="programlisting">
7936: .include "../../mk/bsd.prefs.mk"
7937:
7938: .if defined(USE_MENUS)
7939: ...
7940: .endif
7941: </pre>
7942:
1.13 ! hubertf 7943: <p>If you wish to set the <tt class=
! 7944: "varname">CFLAGS</tt> variable in <tt class=
! 7945: "filename">/etc/mk.conf</tt> please make sure to
1.1 grant 7946: use:</p>
7947: <pre class="programlisting">
7948: CFLAGS+= -your -flags
7949: </pre>
7950:
1.13 ! hubertf 7951: <p>Using <tt class="varname">CFLAGS=</tt> (i.e. without
! 7952: the “<span class="quote">+</span>”) may
! 7953: lead to problems with packages that need to add their
! 7954: own flags. Also, you may want to take a look at the
! 7955: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 7956: href=
7957: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.13 ! hubertf 7958: class="pkgname">devel/cpuflags</a> package if you're
! 7959: interested in optimization for the current CPU.</p>
1.1 grant 7960: </div>
7961:
7962: <div class="sect2" lang="en" xml:lang="en">
7963: <div class="titlepage">
7964: <div>
7965: <div>
1.13 ! hubertf 7966: <h3 class="title"><a name="id2571149" id=
! 7967: "id2571149"></a>12.1.2. Restricted
1.1 grant 7968: packages</h3>
7969: </div>
7970: </div>
7971: </div>
7972:
7973: <p>Some licenses restrict how software may be
7974: re-distributed. In order to satisfy these restrictions,
7975: the package system defines five make variables that can
7976: be set to note these restrictions:</p>
7977:
7978: <div class="itemizedlist">
7979: <ul type="disc">
7980: <li>
1.13 ! hubertf 7981: <p><tt class="varname">RESTRICTED</tt></p>
1.1 grant 7982:
7983: <p>This variable should be set whenever a
7984: restriction exists (regardless of its kind). Set
7985: this variable to a string containing the reason
7986: for the restriction.</p>
7987: </li>
7988:
7989: <li>
1.13 ! hubertf 7990: <p><tt class="varname">NO_BIN_ON_CDROM</tt></p>
1.1 grant 7991:
7992: <p>Binaries may not be placed on CD-ROM. Set this
1.13 ! hubertf 7993: variable to <tt class=
! 7994: "varname">${RESTRICTED}</tt> whenever a binary
1.1 grant 7995: package may not be included on a CD-ROM.</p>
7996: </li>
7997:
7998: <li>
1.13 ! hubertf 7999: <p><tt class="varname">NO_BIN_ON_FTP</tt></p>
1.1 grant 8000:
8001: <p>Binaries may not be placed on an FTP server.
1.13 ! hubertf 8002: Set this variable to <tt class=
! 8003: "varname">${RESTRICTED}</tt> whenever a binary
1.1 grant 8004: package may not not be made available on the
8005: Internet.</p>
8006: </li>
8007:
8008: <li>
1.13 ! hubertf 8009: <p><tt class="varname">NO_SRC_ON_CDROM</tt></p>
1.1 grant 8010:
8011: <p>Distfiles may not be placed on CD-ROM. Set
1.13 ! hubertf 8012: this variable to <tt class=
! 8013: "varname">${RESTRICTED}</tt> if re-distribution
1.1 grant 8014: of the source code or other distfile(s) is not
8015: allowed on CD-ROMs.</p>
8016: </li>
8017:
8018: <li>
1.13 ! hubertf 8019: <p><tt class="varname">NO_SRC_ON_FTP</tt></p>
1.1 grant 8020:
8021: <p>Distfiles may not be placed on FTP. Set this
1.13 ! hubertf 8022: variable to <tt class=
! 8023: "varname">${RESTRICTED}</tt> if re-distribution
1.1 grant 8024: of the source code or other distfile(s) via the
8025: Internet is not allowed.</p>
8026: </li>
8027: </ul>
8028: </div>
8029:
1.13 ! hubertf 8030: <p>Please note that the use of <tt class=
! 8031: "varname">NO_PACKAGE</tt>, <tt class=
! 8032: "varname">IGNORE</tt>, <tt class=
! 8033: "varname">NO_CDROM</tt>, or other generic make
1.1 grant 8034: variables to denote restrictions is deprecated, because
8035: they unconditionally prevent users from generating
8036: binary packages!</p>
8037: </div>
8038:
8039: <div class="sect2" lang="en" xml:lang="en">
8040: <div class="titlepage">
8041: <div>
8042: <div>
8043: <h3 class="title"><a name="dependencies" id=
8044: "dependencies"></a>12.1.3. Handling
8045: dependencies</h3>
8046: </div>
8047: </div>
8048: </div>
8049:
8050: <p>Your package may depend on some other package being
8051: present - and there are various ways of expressing this
1.13 ! hubertf 8052: dependency. pkgsrc supports the <tt class=
! 8053: "varname">BUILD_DEPENDS</tt> and <tt class=
! 8054: "varname">DEPENDS</tt> definitions, as well as
! 8055: dependencies via <tt class=
! 8056: "filename">buildlink3.mk</tt>, which is the preferred
1.1 grant 8057: way to handle dependencies, and which uses the
8058: variables named above. See <a href="#buildlink" title=
8059: "Chapter 9. Buildlink methodology">Chapter 9,
8060: <i>Buildlink methodology</i></a> for more
8061: information.</p>
8062:
8063: <p>The basic difference between the two variables is as
1.13 ! hubertf 8064: follows: The <tt class="varname">DEPENDS</tt>
1.1 grant 8065: definition registers that pre-requisite in the binary
8066: package so it will be pulled in when the binary package
1.13 ! hubertf 8067: is later installed, whilst the <tt class=
! 8068: "varname">BUILD_DEPENDS</tt> definition does not,
1.1 grant 8069: marking a dependency that is only needed for building
8070: the package.</p>
8071:
8072: <p>This means that if you only need a package present
8073: whilst you are building, it should be noted as a
1.13 ! hubertf 8074: <tt class="varname">BUILD_DEPENDS</tt>.</p>
1.1 grant 8075:
1.13 ! hubertf 8076: <p>The format for a <tt class=
! 8077: "varname">BUILD_DEPENDS</tt> and a <tt class=
! 8078: "varname">DEPENDS</tt> definition is:</p>
1.1 grant 8079: <pre class="programlisting">
8080: <pre-req-package-name>:../../<category>/<pre-req-package>
8081: </pre>
8082:
8083: <p>Please note that the “<span class=
8084: "quote">pre-req-package-name</span>” may include
8085: any of the wildcard version numbers recognised by
8086: <a href=
8087: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
8088: <span class="citerefentry"><span class=
8089: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
8090:
8091: <div class="orderedlist">
8092: <ol type="1">
8093: <li>
8094: <p>If your package needs another package's
8095: binaries or libraries to build or run, and if
1.13 ! hubertf 8096: that package has a <tt class=
! 8097: "filename">buildlink3.mk</tt> file available, use
! 8098: it:</p>
1.1 grant 8099: <pre class="programlisting">
8100: .include "../../graphics/jpeg/buildlink3.mk"
8101:
8102: </pre>
8103: </li>
8104:
8105: <li>
8106: <p>If your package needs to use another package
1.13 ! hubertf 8107: to build itself and there is no <tt class=
! 8108: "filename">buildlink3.mk</tt> file available, use
! 8109: the <tt class="varname">BUILD_DEPENDS</tt>
! 8110: definition:</p>
1.1 grant 8111: <pre class="programlisting">
8112: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
8113: </pre>
8114: </li>
8115:
8116: <li>
8117: <p>If your package needs a library with which to
1.13 ! hubertf 8118: link and again there is no <tt class=
! 8119: "filename">buildlink3.mk</tt> file available,
! 8120: this is specified using the <tt class=
! 8121: "varname">DEPENDS</tt> definition. An example of
! 8122: this is the <a xmlns=
1.1 grant 8123: "http://www.w3.org/TR/xhtml1/transitional" href=
8124: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.13 ! hubertf 8125: class="pkgname">print/lyx</a> package, which
! 8126: uses the xpm library, version 3.4j to
! 8127: build:</p>
1.1 grant 8128: <pre class="programlisting">
8129: DEPENDS+= xpm-3.4j:../../graphics/xpm
8130: </pre>
8131:
8132: <p>You can also use wildcards in package
8133: dependences:</p>
8134: <pre class="programlisting">
8135: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
8136: </pre>
8137:
8138: <p>Note that such wildcard dependencies are
8139: retained when creating binary packages. The
8140: dependency is checked when installing the binary
8141: package and any package which matches the pattern
8142: will be used. Wildcard dependencies should be
8143: used with care.</p>
8144:
8145: <p>The “<span class=
8146: "quote">-[0-9]*</span>” should be used
8147: instead of “<span class=
8148: "quote">-*</span>” to avoid potentially
8149: ambiguous matches such as “<span class=
8150: "quote">tk-postgresql</span>” matching a
8151: “<span class="quote">tk-*</span>”
1.13 ! hubertf 8152: <tt class="varname">DEPENDS</tt>.</p>
1.1 grant 8153:
8154: <p>Wildcards can also be used to specify that a
8155: package will only build against a certain minimum
8156: version of a pre-requisite:</p>
8157: <pre class="programlisting">
8158: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
8159: </pre>
8160:
8161: <p>This means that the package will build against
8162: version 3.5.4 of the tiff library or newer. Such
8163: a dependency may be warranted if, for example,
8164: the API of the library has changed with version
8165: 3.5.4 and a package would not compile against an
8166: earlier version of tiff.</p>
8167:
8168: <p>Please note that such dependencies should only
8169: be updated if a package requires a newer
8170: pre-requisite, but not to denote recommendations
8171: such as security updates or ABI changes that do
8172: not prevent a package from building correctly.
8173: Such recommendations can be expressed using
1.13 ! hubertf 8174: <tt class="varname">RECOMMENDED</tt>:</p>
1.1 grant 8175: <pre class="programlisting">
8176: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
8177: </pre>
8178:
1.13 ! hubertf 8179: <p>In addition to the above <tt class=
! 8180: "varname">DEPENDS</tt> line, this denotes that
1.1 grant 8181: while a package will build against
8182: tiff>=3.5.4, at least version 3.6.1 is
1.13 ! hubertf 8183: recommended. <tt class="varname">RECOMMENDED</tt>
! 8184: entries will be turned into dependencies unless
! 8185: explicitly ignored (in which case a warning will
! 8186: be printed). Packages that are built with
1.1 grant 8187: recommendations ignored may not be uploaded to
8188: ftp.NetBSD.org by developers and should not be
8189: used across different systems that may have
8190: different versions of binary packages
8191: installed.</p>
8192:
8193: <p>For security fixes, please update the package
8194: vulnerabilities file as well as setting
1.13 ! hubertf 8195: <tt class="varname">RECOMMENDED</tt>, see
1.1 grant 8196: <a href="#security-handling" title=
8197: "12.1.7. Handling packages with security problems">
8198: Section 12.1.7, “Handling packages with
8199: security problems”</a> for more
8200: information.</p>
8201: </li>
8202:
8203: <li>
8204: <p>If your package needs some executable to be
8205: able to run correctly and if there's agail no
1.13 ! hubertf 8206: <tt class="filename">buildlink3.mk</tt> file,
! 8207: this is specified using the <tt class=
! 8208: "varname">DEPENDS</tt> variable. The <a xmlns=
1.1 grant 8209: "http://www.w3.org/TR/xhtml1/transitional" href=
8210: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.13 ! hubertf 8211: class="pkgname">print/lyx</a> package needs to
! 8212: be able to execute the latex binary from the
! 8213: teTeX package when it runs, and that is
! 8214: specified:</p>
1.1 grant 8215: <pre class="programlisting">
8216: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
8217: </pre>
8218:
8219: <p>The comment about wildcard dependencies from
8220: previous paragraph applies here, too.</p>
8221: </li>
8222: </ol>
8223: </div>
8224:
8225: <p>If your package needs files from another package to
8226: build, see the first part of the “<span class=
8227: "quote">do-configure</span>” target <a xmlns=
8228: "http://www.w3.org/TR/xhtml1/transitional" href=
8229: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.13 ! hubertf 8230: class="pkgname">print/ghostscript5</a> package (it
! 8231: relies on the jpeg sources being present in source
! 8232: form during the build):</p>
1.1 grant 8233: <pre class="programlisting">
8234: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
8235: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
8236: fi
8237: </pre>
8238:
8239: <p>If you build any other packages that way, please
8240: make sure the working files are deleted too when this
8241: package's working files are cleaned up. The easiest way
8242: to do so is by adding a pre-clean target:</p>
8243: <pre class="programlisting">
8244: pre-clean:
8245: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
8246: </pre>
8247:
1.13 ! hubertf 8248: <p>Please also note the <tt class=
! 8249: "varname">BUILD_USES_MSGFMT</tt> and <tt class=
! 8250: "varname">BUILD_USES_GETTEXT_M4</tt> definitions, which
! 8251: are provided as convenience definitions. The former
! 8252: works out whether msgfmt(1) is part of the base system,
! 8253: and, if it isn't, installs the <a xmlns=
1.1 grant 8254: "http://www.w3.org/TR/xhtml1/transitional" href=
8255: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.13 ! hubertf 8256: class="pkgname">devel/gettext</a> package. The
! 8257: latter adds a build dependency on either an
! 8258: installed version of an older gettext package, or if
! 8259: it isn't, installs the <a xmlns=
! 8260: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8261: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
! 8262: class="pkgname">devel/gettext-m4</a> package.</p>
1.1 grant 8263: </div>
8264:
8265: <div class="sect2" lang="en" xml:lang="en">
8266: <div class="titlepage">
8267: <div>
8268: <div>
1.13 ! hubertf 8269: <h3 class="title"><a name="id2571733" id=
! 8270: "id2571733"></a>12.1.4. Handling conflicts
1.1 grant 8271: with other packages</h3>
8272: </div>
8273: </div>
8274: </div>
8275:
8276: <p>Your package may conflict with other packages a user
8277: might already have installed on his system, e.g. if
8278: your package installs the same set of files like
8279: another package in our pkgsrc tree.</p>
8280:
1.13 ! hubertf 8281: <p>In this case you can set <tt class=
! 8282: "varname">CONFLICTS</tt> to a space separated list of
1.1 grant 8283: packages (including version string) your package
8284: conflicts with.</p>
8285:
8286: <p>For example <a xmlns=
8287: "http://www.w3.org/TR/xhtml1/transitional" href=
8288: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.13 ! hubertf 8289: class="pkgname">x11/Xaw3d</a> and <a xmlns=
! 8290: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8291: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
! 8292: class="pkgname">x11/Xaw-Xpm</a> install provide the
! 8293: same shared library, thus you set in <tt class=
! 8294: "filename">pkgsrc/x11/Xaw3d/Makefile</tt>:</p>
1.1 grant 8295: <pre class="programlisting">
8296: CONFLICTS= Xaw-Xpm-[0-9]*
8297: </pre>
8298:
1.13 ! hubertf 8299: <p>and in <tt class=
! 8300: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</tt>:</p>
1.1 grant 8301: <pre class="programlisting">
8302: CONFLICTS= Xaw3d-[0-9]*
8303: </pre>
8304:
8305: <p>Packages will automatically conflict with other
8306: packages with the name prefix and a different version
8307: string. “<span class=
8308: "quote">Xaw3d-1.5</span>” e.g. will automatically
8309: conflict with the older version “<span class=
8310: "quote">Xaw3d-1.3</span>”.</p>
8311: </div>
8312:
8313: <div class="sect2" lang="en" xml:lang="en">
8314: <div class="titlepage">
8315: <div>
8316: <div>
1.13 ! hubertf 8317: <h3 class="title"><a name="id2571851" id=
! 8318: "id2571851"></a>12.1.5. Packages that cannot
1.1 grant 8319: or should not be built</h3>
8320: </div>
8321: </div>
8322: </div>
8323:
8324: <p>There are several reasons why a package might be
8325: instructed to not build under certain circumstances. If
8326: the package builds and runs on most platforms, the
1.13 ! hubertf 8327: exceptions should be noted with <tt class=
! 8328: "varname">NOT_FOR_PLATFORM</tt>. If the package builds
! 8329: and runs on a small handful of platforms, set
! 8330: <tt class="varname">ONLY_FOR_PLATFORM</tt> instead. If
! 8331: the package should be skipped (for example, because it
! 8332: provides functionality already provided by the system),
! 8333: set <tt class="varname">PKG_SKIP_REASON</tt> to a
! 8334: descriptive message. If the package should fail because
! 8335: some preconditions are not met, set <tt class=
! 8336: "varname">PKG_FAIL_REASON</tt> to a descriptive
1.1 grant 8337: message.</p>
8338:
1.13 ! hubertf 8339: <p><tt class="varname">IGNORE</tt> is deprecated
1.1 grant 8340: because it didn't provide enough information to
8341: determine whether the build should fail.</p>
8342: </div>
8343:
8344: <div class="sect2" lang="en" xml:lang="en">
8345: <div class="titlepage">
8346: <div>
8347: <div>
1.13 ! hubertf 8348: <h3 class="title"><a name="id2571877" id=
! 8349: "id2571877"></a>12.1.6. Packages which
1.1 grant 8350: should not be deleted, once installed</h3>
8351: </div>
8352: </div>
8353: </div>
8354:
8355: <p>To ensure that a package may not be deleted, once it
1.13 ! hubertf 8356: has been installed, the <tt class=
! 8357: "varname">PKG_PRESERVE</tt> definition should be set in
! 8358: the package Makefile. This will be carried into any
1.1 grant 8359: binary package that is made from this pkgsrc entry. A
8360: “<span class="quote">preserved</span>”
8361: package will not be deleted using <a href=
8362: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8363: <span class="citerefentry"><span class=
8364: "refentrytitle">pkg_delete</span>(1)</span></a> unless
8365: the “<span class="quote">-f</span>” option
8366: is used.</p>
8367: </div>
8368:
8369: <div class="sect2" lang="en" xml:lang="en">
8370: <div class="titlepage">
8371: <div>
8372: <div>
8373: <h3 class="title"><a name="security-handling" id=
8374: "security-handling"></a>12.1.7. Handling
8375: packages with security problems</h3>
8376: </div>
8377: </div>
8378: </div>
8379:
8380: <p>When a vulnerability is found, this should be noted
1.13 ! hubertf 8381: in <tt class=
! 8382: "filename">localsrc/security/advisories/pkg-vulnerabilities</tt>,
1.1 grant 8383: and after the commit of that file, it should be copied
1.13 ! hubertf 8384: to both <tt class=
! 8385: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</tt>
! 8386: and <tt class=
! 8387: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</tt>
! 8388: on ftp.NetBSD.org using <tt class=
! 8389: "filename">localsrc/security/advisories/Makefile</tt>.
! 8390: In addition, if a <tt class=
! 8391: "filename">buildlink3.mk</tt> file exists for an
! 8392: affected package, bumping <tt class=
! 8393: "varname">PKGREVISION</tt> and creating a corresponding
! 8394: <tt class="varname">BUILDLINK_RECOMMENDED.<i class=
! 8395: "replaceable"><tt>pkg</tt></i></tt> entry should be
! 8396: considered. See <a href="#buildlink" title=
1.1 grant 8397: "Chapter 9. Buildlink methodology">Chapter 9,
8398: <i>Buildlink methodology</i></a> for more information
1.13 ! hubertf 8399: about writing <tt class="filename">buildlink3.mk</tt>
! 8400: files and <tt class="varname">BUILDLINK_*</tt>
! 8401: definitions.</p>
1.1 grant 8402:
8403: <p>Also, if the fix should be applied to the stable
8404: pkgsrc branch, be sure to submit a pullup request!</p>
8405: </div>
8406:
8407: <div class="sect2" lang="en" xml:lang="en">
8408: <div class="titlepage">
8409: <div>
8410: <div>
1.13 ! hubertf 8411: <h3 class="title"><a name="id2571969" id=
! 8412: "id2571969"></a>12.1.8. How to handle
1.1 grant 8413: compiler bugs</h3>
8414: </div>
8415: </div>
8416: </div>
8417:
8418: <p>Some source files trigger bugs in the compiler,
8419: based on combinations of compiler version and
8420: architecture and almost always relation to optimisation
8421: being enabled. Common symptoms are gcc internal errors
8422: or never finishing compiling a file.</p>
8423:
8424: <p>Typically a workaround involves testing the
1.13 ! hubertf 8425: <tt class="varname">MACHINE_ARCH</tt> and compiler
1.1 grant 8426: version, disabling optimisation for that
1.13 ! hubertf 8427: file/<tt class="varname">MACHINE_ARCH</tt>/compiler
! 8428: combination, and documenting it in <tt class=
! 8429: "filename">pkgsrc/doc/HACKS</tt>. See that file for a
1.1 grant 8430: number of examples!</p>
8431: </div>
8432:
8433: <div class="sect2" lang="en" xml:lang="en">
8434: <div class="titlepage">
8435: <div>
8436: <div>
1.13 ! hubertf 8437: <h3 class="title"><a name="id2571991" id=
! 8438: "id2571991"></a>12.1.9. How to handle
1.1 grant 8439: incrementing versions when fixing an existing
8440: package</h3>
8441: </div>
8442: </div>
8443: </div>
8444:
8445: <p>When making fixes to an existing package it can be
1.13 ! hubertf 8446: useful to change the version number in <tt class=
! 8447: "varname">PKGNAME</tt>. To avoid conflicting with
1.1 grant 8448: future versions by the original author, a
8449: “<span class="quote">nb1</span>”,
8450: “<span class="quote">nb2</span>”, ...
8451: suffix can be used on package versions by setting
1.13 ! hubertf 8452: <tt class="varname">PKGREVISION=1</tt> (2, ...). The
! 8453: “<span class="quote">nb</span>” is treated
! 8454: like a “<span class="quote">.</span>” by
! 8455: the pkg tools. e.g.</p>
1.1 grant 8456: <pre class="programlisting">
8457: DISTNAME= foo-17.42
8458: PKGREVISION= 9
8459: </pre>
8460:
1.13 ! hubertf 8461: <p>will result in a <tt class="varname">PKGNAME</tt> of
! 8462: “<span class=
1.1 grant 8463: "quote">foo-17.42nb9</span>”.</p>
8464:
8465: <p>When a new release of the package is released, the
1.13 ! hubertf 8466: <tt class="varname">PKGREVISION</tt> should be removed.
! 8467: e.g. on a new minor release of the above package,
! 8468: things should be like:</p>
1.1 grant 8469: <pre class="programlisting">
8470: DISTNAME= foo-17.43
8471: </pre>
8472: </div>
8473:
8474: <div class="sect2" lang="en" xml:lang="en">
8475: <div class="titlepage">
8476: <div>
8477: <div>
1.13 ! hubertf 8478: <h3 class="title"><a name="id2572108" id=
! 8479: "id2572108"></a>12.1.10. Portability of
1.1 grant 8480: packages</h3>
8481: </div>
8482: </div>
8483: </div>
8484:
8485: <p>One appealing feature of pkgsrc is that it runs on
8486: many different platforms. As a result, it is important
8487: to ensure, where possible, that packages in pkgsrc are
8488: portable. There are some particular details you should
8489: pay attention to while working on pkgsrc.</p>
8490:
8491: <div class="sect3" lang="en" xml:lang="en">
8492: <div class="titlepage">
8493: <div>
8494: <div>
1.13 ! hubertf 8495: <h4 class="title"><a name="id2572114" id=
! 8496: "id2572114"></a>12.1.10.1. ${INSTALL},
1.1 grant 8497: ${INSTALL_DATA_DIR}, ...</h4>
8498: </div>
8499: </div>
8500: </div>
8501:
1.13 ! hubertf 8502: <p>The BSD-compatible <span><b class=
! 8503: "command">install</b></span> supplied with some
1.1 grant 8504: operating systems will not perform more than one
8505: operation at a time. As such, you should call
8506: “<span class="quote">${INSTALL}</span>”,
8507: etc. like this:</p>
8508: <pre class="programlisting">
8509: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
8510: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
8511: </pre>
8512: </div>
8513: </div>
8514: </div>
8515:
8516: <div class="sect1" lang="en" xml:lang="en">
8517: <div class="titlepage">
8518: <div>
8519: <div>
8520: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 8521: "id2572133" id="id2572133"></a>12.2. Possible
1.1 grant 8522: downloading issues</h2>
8523: </div>
8524: </div>
8525: </div>
8526:
8527: <div class="sect2" lang="en" xml:lang="en">
8528: <div class="titlepage">
8529: <div>
8530: <div>
1.13 ! hubertf 8531: <h3 class="title"><a name="id2572136" id=
! 8532: "id2572136"></a>12.2.1. Packages whose
1.1 grant 8533: distfiles aren't available for plain
8534: downloading</h3>
8535: </div>
8536: </div>
8537: </div>
8538:
8539: <p>If you need to download from a dynamic URL you can
1.13 ! hubertf 8540: set <tt class="varname">DYNAMIC_MASTER_SITES</tt> and a
! 8541: <span><b class="command">make fetch</b></span> will
! 8542: call <tt class="filename">files/getsite.sh</tt> with
! 8543: the name of each file to download as an argument,
! 8544: expecting it to output the URL of the directory from
! 8545: which to download it. <a xmlns=
! 8546: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 8547: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.13 ! hubertf 8548: class="pkgname">graphics/ns-cult3d</a> is an example
! 8549: of this usage.</p>
1.1 grant 8550:
8551: <p>If the download can't be automated, because the user
8552: must submit personal information to apply for a
8553: password, or must pay for the source, or whatever, you
1.13 ! hubertf 8554: can set <tt class="varname">_FETCH_MESSAGE</tt> to a
! 8555: macro which displays a message explaining the
! 8556: situation. <tt class="varname">_FETCH_MESSAGE</tt> must
! 8557: be executable shell commands, not just a message.
! 8558: (Generally, it executes <tt class=
! 8559: "varname">${ECHO}</tt>). As of this writing, the
1.1 grant 8560: following packages use this: <a xmlns=
8561: "http://www.w3.org/TR/xhtml1/transitional" href=
8562: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.13 ! hubertf 8563: class="pkgname">audio/realplayer</a>, <a xmlns=
! 8564: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8565: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
! 8566: class="pkgname">cad/simian</a>, <a xmlns=
! 8567: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8568: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
! 8569: class="pkgname">devel/ipv6socket</a>, <a xmlns=
! 8570: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8571: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
! 8572: class="pkgname">emulators/vmware-module</a>,
! 8573: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 8574: href=
! 8575: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
! 8576: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
! 8577: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8578: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
! 8579: class="pkgname">sysutils/storage-manager</a>,
! 8580: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 8581: href=
! 8582: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
! 8583: class="pkgname">www/ap-aolserver</a>, <a xmlns=
! 8584: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8585: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
! 8586: class="pkgname">www/openacs</a>. Try to be
! 8587: consistent with them.</p>
1.1 grant 8588: </div>
8589:
8590: <div class="sect2" lang="en" xml:lang="en">
8591: <div class="titlepage">
8592: <div>
8593: <div>
1.13 ! hubertf 8594: <h3 class="title"><a name="id2572267" id=
! 8595: "id2572267"></a>12.2.2. How to handle
1.1 grant 8596: modified distfiles with the 'old' name</h3>
8597: </div>
8598: </div>
8599: </div>
8600:
8601: <p>Sometimes authors of a software package make some
8602: modifications after the software was released, and they
8603: put up a new distfile without changing the package's
8604: version number. If a package is already in pkgsrc at
8605: that time, the md5 checksum will no longer match. The
8606: correct way to work around this is to update the
8607: package's md5 checksum to match the package on the
8608: master site (beware, any mirrors may not be up to date
8609: yet!), and to remove the old distfile from
1.13 ! hubertf 8610: ftp.NetBSD.org's <tt class=
! 8611: "filename">/pub/NetBSD/packages/distfiles</tt>
1.1 grant 8612: directory. Furthermore, a mail to the package's author
8613: seems appropriate making sure the distfile was really
8614: updated on purpose, and that no trojan horse or so
8615: crept in.</p>
8616: </div>
8617: </div>
8618:
8619: <div class="sect1" lang="en" xml:lang="en">
8620: <div class="titlepage">
8621: <div>
8622: <div>
8623: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 8624: "id2572279" id=
! 8625: "id2572279"></a>12.3. Configuration
1.1 grant 8626: gotchas</h2>
8627: </div>
8628: </div>
8629: </div>
8630:
8631: <div class="sect2" lang="en" xml:lang="en">
8632: <div class="titlepage">
8633: <div>
8634: <div>
8635: <h3 class="title"><a name="fixes.libtool" id=
8636: "fixes.libtool"></a>12.3.1. Shared libraries
8637: - libtool</h3>
8638: </div>
8639: </div>
8640: </div>
8641:
8642: <p>pkgsrc supports many different machines, with
8643: different object formats like a.out and ELF, and
8644: varying abilities to do shared library and dynamic
8645: loading at all. To accompany this, varying commands and
8646: options have to be passed to the compiler, linker, etc.
8647: to get the Right Thing, which can be pretty annoying
8648: especially if you don't have all the machines at your
8649: hand to test things. The <a xmlns=
8650: "http://www.w3.org/TR/xhtml1/transitional" href=
8651: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.13 ! hubertf 8652: class="pkgname">devel/libtool</a> pkg can help here,
! 8653: as it just “<span class=
! 8654: "quote">knows</span>” how to build both static
! 8655: and dynamic libraries from a set of source files,
! 8656: thus being platform independent.</p>
1.1 grant 8657:
8658: <p>Here's how to use libtool in a pkg in seven simple
8659: steps:</p>
8660:
8661: <div class="orderedlist">
8662: <ol type="1">
8663: <li>
1.13 ! hubertf 8664: <p>Add <tt class="varname">USE_LIBTOOL=yes</tt>
! 8665: to the package Makefile.</p>
1.1 grant 8666: </li>
8667:
8668: <li>
8669: <p>For library objects, use “<span class=
8670: "quote">${LIBTOOL} --mode=compile
8671: ${CC}</span>” in place of
8672: “<span class="quote">${CC}</span>”.
8673: You could even add it to the definition of
1.13 ! hubertf 8674: <tt class="varname">CC</tt>, if only libraries
! 8675: are being built in a given Makefile. This one
! 8676: command will build both PIC and non-PIC library
! 8677: objects, so you need not have separate shared and
! 8678: non-shared library rules.</p>
1.1 grant 8679: </li>
8680:
8681: <li>
8682: <p>For the linking of the library, remove any
8683: “<span class="quote">ar</span>”,
8684: “<span class="quote">ranlib</span>”,
8685: and “<span class="quote">ld
8686: -Bshareable</span>” commands, and instead
8687: use:</p>
8688: <pre class="programlisting">
8689: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
8690: </pre>
8691:
8692: <p>Note that the library is changed to have a
1.13 ! hubertf 8693: <tt class="filename">.la</tt> extension, and the
! 8694: objects are changed to have a <tt class=
! 8695: "filename">.lo</tt> extension. Change <tt class=
! 8696: "varname">OBJS</tt> as necessary. This
! 8697: automatically creates all of the <tt class=
! 8698: "filename">.a</tt>, <tt class=
! 8699: "filename">.so.major.minor</tt>, and ELF symlinks
! 8700: (if necessary) in the build directory. Be sure to
! 8701: include “<span class=
1.1 grant 8702: "quote">-version-info</span>”, especially
8703: when major and minor are zero, as libtool will
8704: otherwise strip off the shared library
8705: version.</p>
8706:
8707: <p>From the libtool manual:</p>
8708: <pre class="programlisting">
8709: So, libtool library versions are described by three integers:
8710:
8711: CURRENT
8712: The most recent interface number that this library implements.
8713:
8714: REVISION
8715: The implementation number of the CURRENT interface.
8716:
8717: AGE
8718: The difference between the newest and oldest interfaces that this
8719: library implements. In other words, the library implements all the
8720: interface numbers in the range from number `CURRENT - AGE' to
8721: `CURRENT'.
8722:
8723: If two libraries have identical CURRENT and AGE numbers, then the
8724: dynamic linker chooses the library with the greater REVISION number.
8725: </pre>
8726:
8727: <p>The “<span class=
8728: "quote">-release</span>” option will
8729: produce different results for a.out and ELF
8730: (excluding symlinks) in only one case. An ELF
8731: library of the form “<span class=
8732: "quote">libfoo-release.so.<span class=
8733: "emphasis"><em>x</em></span>.<span class=
8734: "emphasis"><em>y</em></span></span>” will
8735: have a symlink of “<span class=
8736: "quote">libfoo.so.<span class=
8737: "emphasis"><em>x</em></span>.<span class=
8738: "emphasis"><em>y</em></span></span>” on an
8739: a.out platform. This is handled
8740: automatically.</p>
8741:
8742: <p>The “<span class="quote">-rpath
8743: argument</span>” is the install directory
8744: of the library being built.</p>
8745:
1.13 ! hubertf 8746: <p>In the <tt class="filename">PLIST</tt>,
! 8747: include all of the <tt class="filename">.a</tt>,
! 8748: <tt class="filename">.la</tt>, and <tt class=
! 8749: "filename">.so</tt>, <tt class=
! 8750: "filename">.so.<i class=
! 8751: "replaceable"><tt>major</tt></i></tt> and
! 8752: <tt class="filename">.so.<i class=
! 8753: "replaceable"><tt>major</tt></i>.<i class=
! 8754: "replaceable"><tt>minor</tt></i></tt> files.</p>
1.1 grant 8755: </li>
8756:
8757: <li>
1.13 ! hubertf 8758: <p>When linking shared object (<tt class=
! 8759: "filename">.so</tt>) files, i.e. files that are
1.1 grant 8760: loaded via dlopen(3), NOT shared libraries, use
8761: “<span class="quote">-module
8762: -avoid-version</span>” to prevent them
8763: getting version tacked on.</p>
8764:
1.13 ! hubertf 8765: <p>The <tt class="filename">PLIST</tt> file gets
! 8766: the <tt class="filename">foo.so</tt> entry.</p>
1.1 grant 8767: </li>
8768:
8769: <li>
8770: <p>When linking programs that depend on these
8771: libraries <span class=
8772: "emphasis"><em>before</em></span> they are
8773: installed, preface the <a href=
8774: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
8775: <span class="citerefentry"><span class=
8776: "refentrytitle">cc</span>(1)</span></a> or
8777: <a href=
8778: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
8779: <span class="citerefentry"><span class=
8780: "refentrytitle">ld</span>(1)</span></a> line with
8781: “<span class="quote">${LIBTOOL}
8782: --mode=link</span>”, and it will find the
8783: correct libraries (static or shared), but please
8784: be aware that libtool will not allow you to
8785: specify a relative path in -L (such as
8786: “<span class=
8787: "quote">-L../somelib</span>”), because it
8788: expects you to change that argument to be the
1.13 ! hubertf 8789: <tt class="filename">.la</tt> file. e.g.</p>
1.1 grant 8790: <pre class="programlisting">
8791: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
8792: </pre>
8793:
8794: <p>should be changed to:</p>
8795: <pre class="programlisting">
1.13 ! hubertf 8796: ${LIBTOOL} --mode=link ${CC} -o <i class=
! 8797: "replaceable"><tt>someprog</tt></i> <i class=
! 8798: "replaceable"><tt>../somelib/somelib.la</tt></i>
1.1 grant 8799: </pre>
8800:
8801: <p>and it will do the right thing with the
8802: libraries.</p>
8803: </li>
8804:
8805: <li>
8806: <p>When installing libraries, preface the
8807: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
8808: <span class="citerefentry"><span class=
8809: "refentrytitle">install</span>(1)</span></a> or
8810: <a href=
8811: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
8812: <span class="citerefentry"><span class=
8813: "refentrytitle">cp</span>(1)</span></a> command
8814: with “<span class="quote">${LIBTOOL}
8815: --mode=install</span>”, and change the
1.13 ! hubertf 8816: library name to <tt class="filename">.la</tt>.
! 8817: e.g.</p>
1.1 grant 8818: <pre class="programlisting">
8819: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
8820: </pre>
8821:
1.13 ! hubertf 8822: <p>This will install the static <tt class=
! 8823: "filename">.a</tt>, shared library, any needed
1.1 grant 8824: symlinks, and run <a href=
8825: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
8826: <span class="citerefentry"><span class=
8827: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
8828: </li>
8829:
8830: <li>
1.13 ! hubertf 8831: <p>In your <tt class="filename">PLIST</tt>,
! 8832: include all of the <tt class="filename">.a</tt>,
! 8833: <tt class="filename">.la</tt>, and <tt class=
! 8834: "filename">.so</tt>, <tt class=
! 8835: "filename">.so.CURRENT</tt> and <tt class=
! 8836: "filename">.so.CURRENT.REVISION</tt> files (this
! 8837: is a change from the previous behaviour).</p>
1.1 grant 8838: </li>
8839: </ol>
8840: </div>
8841: </div>
8842:
8843: <div class="sect2" lang="en" xml:lang="en">
8844: <div class="titlepage">
8845: <div>
8846: <div>
1.13 ! hubertf 8847: <h3 class="title"><a name="id2572618" id=
! 8848: "id2572618"></a>12.3.2. Using libtool on GNU
1.1 grant 8849: packages that already support libtool</h3>
8850: </div>
8851: </div>
8852: </div>
8853:
1.13 ! hubertf 8854: <p>Add <tt class="varname">USE_LIBTOOL=yes</tt> to the
! 8855: package Makefile. This will override the package's own
! 8856: libtool in most cases. For older libtool using
1.1 grant 8857: packages, libtool is made by ltconfig script during the
8858: do-configure step; you can check the libtool script
1.13 ! hubertf 8859: location by doing <span><b class="command">make
! 8860: configure; find work*/ -name libtool</b></span>.</p>
1.1 grant 8861:
1.13 ! hubertf 8862: <p><tt class="varname">LIBTOOL_OVERRIDE</tt> specifies
! 8863: which libtool scripts, relative to <tt class=
! 8864: "varname">WRKSRC</tt>, to override. By default, it is
! 8865: set to “<span class="quote">libtool */libtool
! 8866: */*/libtool</span>”. If this does not match the
! 8867: location of the package's libtool script(s), set it as
! 8868: appropriate.</p>
! 8869:
! 8870: <p>If you do not need <tt class="filename">*.a</tt>
1.1 grant 8871: static libraries built and installed, then use
1.13 ! hubertf 8872: <tt class="varname">SHLIBTOOL_OVERRIDE</tt>
1.1 grant 8873: instead.</p>
8874:
8875: <p>If your package makes use of the platform
8876: independent library for loading dynamic shared objects,
8877: that comes with libtool (libltdl), you should include
1.13 ! hubertf 8878: the libtool buildlink3.mk (and set <tt class=
! 8879: "varname">USE_BUILDLINK3=YES</tt>).</p>
1.1 grant 8880:
8881: <p>Some packages use libtool incorrectly so that the
8882: package may not work or build in some circumstances.
8883: Some of the more common errors are:</p>
8884:
8885: <div class="itemizedlist">
8886: <ul type="disc">
8887: <li>
8888: <p>The inclusion of a shared object (-module) as
8889: a dependent library in an executable or library.
8890: This in itself isn't a problem if one of two
8891: things has been done:</p>
8892:
8893: <div class="orderedlist">
8894: <ol type="1">
8895: <li>
8896: <p>The shared object is named correctly,
1.13 ! hubertf 8897: i.e. <tt class="filename">libfoo.la</tt>,
! 8898: not <tt class="filename">foo.la</tt></p>
1.1 grant 8899: </li>
8900:
8901: <li>
8902: <p>The -dlopen option is used when linking
8903: an executable.</p>
8904: </li>
8905: </ol>
8906: </div>
8907: </li>
8908:
8909: <li>
8910: <p>The use of libltdl without the correct calls
8911: to initialisation routines. The function
8912: lt_dlinit() should be called and the macro
1.13 ! hubertf 8913: <tt class=
! 8914: "varname">LTDL_SET_PRELOADED_SYMBOLS</tt>
1.1 grant 8915: included in executables.</p>
8916: </li>
8917: </ul>
8918: </div>
8919: </div>
8920:
8921: <div class="sect2" lang="en" xml:lang="en">
8922: <div class="titlepage">
8923: <div>
8924: <div>
1.13 ! hubertf 8925: <h3 class="title"><a name="id2572702" id=
! 8926: "id2572702"></a>12.3.3. GNU
1.1 grant 8927: Autoconf/Automake</h3>
8928: </div>
8929: </div>
8930: </div>
8931:
8932: <p>If a package needs GNU autoconf or automake to be
8933: executed to regenerate the configure script and
8934: Makefile.in makefile templates, then they should be
8935: executed in a pre-configure target. Two Makefile
1.13 ! hubertf 8936: fragments are provided in <tt class=
! 8937: "filename">pkgsrc/mk/autoconf.mk</tt> and <tt class=
! 8938: "filename">pkgsrc/mk/automake.mk</tt> to help dealing
! 8939: with these tools. See comments in these files for
! 8940: details.</p>
1.1 grant 8941:
8942: <p>For packages that need only autoconf:</p>
8943: <pre class="programlisting">
8944: AUTOCONF_REQD= 2.50 # if default version is not good enough
8945: ...
8946:
8947: pre-configure:
8948: cd ${WRKSRC}; ${AUTOCONF}
8949:
8950: ...
8951: .include "../../mk/autoconf.mk"
8952: </pre>
8953:
8954: <p>and for packages that need automake and
8955: autoconf:</p>
8956: <pre class="programlisting">
8957: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
8958: ...
8959:
8960: pre-configure:
8961: cd ${WRKSRC}; \
8962: ${ACLOCAL}; \
8963: ${AUTOHEADER}; \
8964: ${AUTOMAKE} -a --foreign -i; \
8965: ${AUTOCONF}
8966:
8967: ...
8968: .include "../mk/automake.mk"
8969: </pre>
8970:
8971: <p>Packages which use GNU Automake will almost
8972: certainly require GNU Make, but that's automatically
1.13 ! hubertf 8973: provided for you in <tt class=
! 8974: "filename">mk/automake.mk</tt>.</p>
1.1 grant 8975:
8976: <p>There are times when the configure process makes
8977: additional changes to the generated files, which then
8978: causes the build process to try to re-execute the
8979: automake sequence. This is prevented by touching
8980: various files in the configure stage. If this causes
1.13 ! hubertf 8981: problems with your package you can set <tt class=
! 8982: "varname">AUTOMAKE_OVERRIDE=NO</tt> in the package
1.1 grant 8983: Makefile.</p>
8984: </div>
8985: </div>
8986:
8987: <div class="sect1" lang="en" xml:lang="en">
8988: <div class="titlepage">
8989: <div>
8990: <div>
8991: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 8992: "id2572747" id="id2572747"></a>12.4. Building
1.1 grant 8993: considerations</h2>
8994: </div>
8995: </div>
8996: </div>
8997:
8998: <div class="sect2" lang="en" xml:lang="en">
8999: <div class="titlepage">
9000: <div>
9001: <div>
1.13 ! hubertf 9002: <h3 class="title"><a name="id2572750" id=
! 9003: "id2572750"></a>12.4.1. CPP defines</h3>
1.1 grant 9004: </div>
9005: </div>
9006: </div>
9007:
9008: <p>To port an application to NetBSD, it's usually
9009: necessary for the compiler to be able to judge the
9010: system on which it's compiling, and we use definitions
9011: so that the C pre-processor can do this.</p>
9012:
9013: <p>To test whether you are working on a 4.4 BSD-derived
9014: system, you should use the BSD definition, which is
1.13 ! hubertf 9015: defined in <tt class=
! 9016: "filename"><sys/param.h></tt> on said
1.1 grant 9017: systems.</p>
9018: <pre class="programlisting">
9019: #include <sys/param.h>
9020: </pre>
9021:
9022: <p>and then you can surround the BSD-specific parts of
9023: your package's C/C++ code using this conditional:</p>
9024: <pre class="programlisting">
9025: #if (defined(BSD) && BSD >= 199306)
9026: ...
9027: #endif
9028: </pre>
9029:
9030: <p>Please use the “<span class=
9031: "quote">__NetBSD__</span>” definition sparingly -
9032: it should only apply to features of NetBSD that are not
9033: present in other 4.4-lite derived BSDs.</p>
9034: </div>
9035: </div>
9036:
9037: <div class="sect1" lang="en" xml:lang="en">
9038: <div class="titlepage">
9039: <div>
9040: <div>
9041: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 9042: "id2572780" id="id2572780"></a>12.5. Package
1.1 grant 9043: specific actions</h2>
9044: </div>
9045: </div>
9046: </div>
9047:
9048: <div class="sect2" lang="en" xml:lang="en">
9049: <div class="titlepage">
9050: <div>
9051: <div>
1.13 ! hubertf 9052: <h3 class="title"><a name="id2572784" id=
! 9053: "id2572784"></a>12.5.1. Package
1.1 grant 9054: configuration files</h3>
9055: </div>
9056: </div>
9057: </div>
9058:
9059: <p>Packages should be taught to look for their
1.13 ! hubertf 9060: configuration files in <tt class=
! 9061: "varname">${PKG_SYSCONFDIR}</tt>, which is passed
1.1 grant 9062: through to the configure and build processes.
1.13 ! hubertf 9063: <tt class="varname">PKG_SYSCONFDIR</tt> may be
1.1 grant 9064: customized in various ways by setting other make
9065: variables:</p>
9066:
9067: <div class="itemizedlist">
9068: <ul type="disc">
9069: <li>
1.13 ! hubertf 9070: <p><tt class="varname">PKG_SYSCONFBASE</tt> is
! 9071: the main config directory under which all package
! 9072: configuration files are to be found. This
! 9073: defaults to <tt class=
! 9074: "filename">${PREFIX}/etc</tt>, but may be
! 9075: overridden in <tt class=
! 9076: "filename">/etc/mk.conf</tt>.</p>
1.1 grant 9077: </li>
9078:
9079: <li>
1.13 ! hubertf 9080: <p><tt class="varname">PKG_SYSCONFSUBDIR</tt> is
! 9081: the subdirectory of <tt class=
! 9082: "varname">PKG_SYSCONFBASE</tt> under which the
1.1 grant 9083: configuration files for a particular package may
9084: be found, e.g. the Apache configuration files may
1.13 ! hubertf 9085: all be found under the <tt class=
! 9086: "filename">httpd/</tt> subdirectory of <tt class=
! 9087: "varname">${PKG_SYSCONFBASE}</tt>. This should be
! 9088: set in the package Makefile.</p>
1.1 grant 9089: </li>
9090:
9091: <li>
1.13 ! hubertf 9092: <p>By default, <tt class=
! 9093: "varname">PKG_SYSCONFDIR</tt> is set to
! 9094: <tt class="varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</tt>,
! 9095: but this may be overridden by setting <tt class=
! 9096: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</tt>
! 9097: for a particular package, where <tt class=
! 9098: "varname">PKG_SYSCONFVAR</tt> defaults to
! 9099: <tt class="varname">${PKGBASE}</tt>. This is not
! 9100: meant to be set by a package Makefile, but is
1.1 grant 9101: reserved for users who wish to override the
1.13 ! hubertf 9102: <tt class="varname">PKG_SYSCONFDIR</tt> setting
! 9103: for a particular package with a special
1.1 grant 9104: location.</p>
9105: </li>
9106: </ul>
9107: </div>
9108:
9109: <p>The only variables that users should customize are
1.13 ! hubertf 9110: <tt class="varname">PKG_SYSCONFBASE</tt> and <tt class=
! 9111: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</tt>. Users
! 9112: will typically want to set <tt class=
! 9113: "varname">PKG_SYSCONFBASE</tt> to <tt class=
! 9114: "filename">/etc</tt>, or to accept the default location
! 9115: of <tt class="filename">${PREFIX}/etc</tt>.</p>
1.1 grant 9116: </div>
9117:
9118: <div class="sect2" lang="en" xml:lang="en">
9119: <div class="titlepage">
9120: <div>
9121: <div>
1.13 ! hubertf 9122: <h3 class="title"><a name="id2573022" id=
! 9123: "id2573022"></a>12.5.2. User
1.2 hubertf 9124: interaction</h3>
1.1 grant 9125: </div>
9126: </div>
9127: </div>
9128:
9129: <p>Occasionally, packages require interaction from the
9130: user, and this can be in a number of ways:</p>
9131:
9132: <div class="itemizedlist">
9133: <ul type="disc">
9134: <li>
9135: <p>help in fetching the distfiles</p>
9136: </li>
9137:
9138: <li>
9139: <p>help to configure the package before it is
9140: built</p>
9141: </li>
9142:
9143: <li>
9144: <p>help during the build process</p>
9145: </li>
9146:
9147: <li>
9148: <p>help during the installation of a package</p>
9149: </li>
9150: </ul>
9151: </div>
9152:
1.13 ! hubertf 9153: <p>The <tt class="varname">INTERACTIVE_STAGE</tt>
1.1 grant 9154: definition is provided to notify the pkgsrc mechanism
9155: of an interactive stage which will be needed, and this
1.13 ! hubertf 9156: should be set in the package's <tt class=
! 9157: "filename">Makefile</tt>. e.g.</p>
1.1 grant 9158: <pre class="programlisting">
9159: INTERACTIVE_STAGE= build
9160: </pre>
9161:
9162: <p>Multiple interactive stages can be specified:</p>
9163: <pre class="programlisting">
9164: INTERACTIVE_STAGE= configure install
9165: </pre>
9166: </div>
9167:
9168: <div class="sect2" lang="en" xml:lang="en">
9169: <div class="titlepage">
9170: <div>
9171: <div>
1.13 ! hubertf 9172: <h3 class="title"><a name="id2573136" id=
! 9173: "id2573136"></a>12.5.3. Handling
1.1 grant 9174: licenses</h3>
9175: </div>
9176: </div>
9177: </div>
9178:
9179: <p>A package may underly a license which the user has
9180: or has not agreed to accept. Usually, packages that
9181: underly well-known Open Source licenses (e.g. the GNU
9182: Public License, GPL) won't have any special license
9183: tags added in pkgsrc which require special action by
9184: the user of such packages, but there are quite a number
9185: of other licenses out there that pkgsrc users may not
9186: be able to follow, for whatever reasons. For these
9187: cases, pkgsrc contains a mechanism to note that a
9188: package underlies a certain license, and the user has
9189: to accept the license before the package can be
9190: installed.</p>
9191:
9192: <p>Placing a certain package under a certain license
1.13 ! hubertf 9193: works by setting the <tt class="varname">LICENSE</tt>
! 9194: variable to a string identifying the license, e.g. in
! 9195: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 9196: href=
1.1 grant 9197: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.13 ! hubertf 9198: class="pkgname">graphics/graphviz</a>:</p>
1.1 grant 9199: <pre class="programlisting">
9200: LICENSE= graphviz-license
9201: </pre>
9202:
9203: <p>When trying to build, the user will get a notice
9204: that the package underlies a license which he hasn't
9205: accepted (yet):</p>
9206: <pre class="programlisting">
1.13 ! hubertf 9207: <tt class="prompt">%</tt> <b class="userinput"><tt>make</tt></b>
1.1 grant 9208: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
9209: ===> To build this package, add this line to your /etc/mk.conf:
9210: ===> ACCEPTABLE_LICENSES+=graphviz-license
9211: ===> To view the license, enter "/usr/bin/make show-license".
9212: *** Error code 1
9213: </pre>
9214:
1.13 ! hubertf 9215: <p>The license can be viewed with <span><b class=
! 9216: "command">make show-license</b></span>, and if it is
! 9217: considered appropriate, the line printed above can be
! 9218: added to <tt class="filename">/etc/mk.conf</tt> to
! 9219: indicate acceptance of the particular license:</p>
1.1 grant 9220: <pre class="programlisting">
9221: ACCEPTABLE_LICENSES+=graphviz-license
9222: </pre>
9223:
9224: <p>When adding a package with a new license, the
1.13 ! hubertf 9225: license text should be added to <tt class=
! 9226: "filename">pkgsrc/licenses</tt> for displaying. A list
! 9227: of known licenses can be seen in this directory as well
! 9228: as by looking at the list of (commented out) <tt class=
! 9229: "varname">ACCEPTABLE_LICENSES</tt> variable settings in
! 9230: <tt class=
! 9231: "filename">pkgsrc/mk/defaults/mk.conf</tt>.</p>
1.1 grant 9232:
9233: <p>Is there is a <span class=
9234: "emphasis"><em>really</em></span> pressing need to
9235: accept all licenses at once, like when trying to
9236: download or mirror all distfiles or doing a bulk build
9237: to test if all packages in pkgsrc build, this can be
1.13 ! hubertf 9238: done by setting <tt class=
! 9239: "varname">_ACCEPTABLE=yes</tt>.</p>
1.1 grant 9240: </div>
9241:
9242: <div class="sect2" lang="en" xml:lang="en">
9243: <div class="titlepage">
9244: <div>
9245: <div>
1.13 ! hubertf 9246: <h3 class="title"><a name="id2573287" id=
! 9247: "id2573287"></a>12.5.4. Creating an account
1.1 grant 9248: from a package</h3>
9249: </div>
9250: </div>
9251: </div>
9252:
9253: <p>There are two make variables used to control the
9254: creation of package-specific groups and users at
1.13 ! hubertf 9255: pre-install time. The first is <tt class=
! 9256: "varname">PKG_GROUPS</tt>, which is a list of
1.1 grant 9257: group[:groupid] elements, where the groupid is
1.13 ! hubertf 9258: optional. The second is <tt class=
! 9259: "varname">PKG_USERS</tt>, which is a list of elements
1.1 grant 9260: of the form:</p>
9261: <pre class="programlisting">
9262: user:group[:[userid][:[description][:[home][:shell]]]]
9263: </pre>
9264:
9265: <p>where only the user and group are required, the rest
9266: being optional. A simple example is:</p>
9267: <pre class="programlisting">
9268: PKG_GROUPS= foogroup
9269: PKG_USERS= foouser:foogroup
9270: </pre>
9271:
9272: <p>A more complex example is that creates two groups
9273: and two users is:</p>
9274: <pre class="programlisting">
9275: PKG_GROUPS= group1 group2:1005
9276: PKG_USERS= first:group1::First\\ User \
9277: second:group2::Second\\ User:/home/second:${SH}
9278: </pre>
9279:
9280: <p>By default, a new user will have home directory
1.13 ! hubertf 9281: <tt class="filename">/nonexistent</tt>, and login shell
! 9282: <tt class="filename">/sbin/nologin</tt> unless they are
! 9283: specified as part of the user element.</p>
1.1 grant 9284:
1.13 ! hubertf 9285: <p>The package <tt class="filename">Makefile</tt> must
! 9286: also set <tt class="varname">USE_PKGINSTALL=YES</tt>.
! 9287: This will cause the users and groups to be created at
! 9288: pre-install time, and the admin will be prompted to
! 9289: remove them at post-deinstall time. Automatic creation
! 9290: of the users and groups can be toggled on and off by
! 9291: setting the <tt class=
! 9292: "varname">PKG_CREATE_USERGROUP</tt> variable prior to
! 9293: package installation.</p>
1.1 grant 9294: </div>
9295:
9296: <div class="sect2" lang="en" xml:lang="en">
9297: <div class="titlepage">
9298: <div>
9299: <div>
1.13 ! hubertf 9300: <h3 class="title"><a name="id2573349" id=
! 9301: "id2573349"></a>12.5.5. Installing score
1.1 grant 9302: files</h3>
9303: </div>
9304: </div>
9305: </div>
9306:
9307: <p>Certain packages, most of them in the games
9308: category, install a score file that allows all users on
9309: the system to record their highscores. In order for
9310: this to work, the binaries need to be installed setgid
9311: and the score files owned by the appropriate group
9312: and/or owner (traditionally the "games" user/group).
9313: The following variables, documented in more detail in
1.13 ! hubertf 9314: <tt class="filename">mk/defaults/mk.conf</tt>, control
! 9315: this behaviour: <tt class="varname">SETGIDGAME</tt>,
! 9316: <tt class="varname">GAMEDATAMODE</tt>, <tt class=
! 9317: "varname">GAMEGRP</tt>, <tt class=
! 9318: "varname">GAMEMODE</tt>, <tt class=
! 9319: "varname">GAMEOWN</tt>.</p>
1.1 grant 9320:
9321: <p>Note that per default, setgid installation of games
1.13 ! hubertf 9322: is disabled; setting <tt class=
! 9323: "varname">SETGIDGAME=YES</tt> will set all the other
1.1 grant 9324: variables accordingly.</p>
9325:
9326: <p>A package should therefor never hard code file
1.13 ! hubertf 9327: ownership or access permissions but rely on <tt class=
! 9328: "varname">INSTALL_GAME</tt> and <tt class=
! 9329: "varname">INSTALL_GAME_DATA</tt> to set these
! 9330: correctly.</p>
1.1 grant 9331: </div>
9332:
9333: <div class="sect2" lang="en" xml:lang="en">
9334: <div class="titlepage">
9335: <div>
9336: <div>
1.13 ! hubertf 9337: <h3 class="title"><a name="id2573393" id=
! 9338: "id2573393"></a>12.5.6. Packages providing
1.1 grant 9339: login shells</h3>
9340: </div>
9341: </div>
9342: </div>
9343:
9344: <p>If the purpose of the package is to provide a login
1.13 ! hubertf 9345: shell, the variable <tt class="varname">PKG_SHELL</tt>
! 9346: should contain the full pathname of the shell
! 9347: executable installed by this package. The package
! 9348: <tt class="filename">Makefile</tt> must also set
! 9349: <tt class="varname">USE_PKGINSTALL=YES</tt> to use the
! 9350: automatically generated <tt class=
! 9351: "filename">INSTALL</tt>/<tt class=
! 9352: "filename">DEINSTALL</tt> scripts.</p>
1.1 grant 9353:
9354: <p>An example taken from shells/zsh:</p>
9355: <pre class="programlisting">
9356: USE_PKGINSTALL= YES
9357: PKG_SHELL= ${PREFIX}/bin/zsh
9358: </pre>
9359:
1.13 ! hubertf 9360: <p>The shell is registered into <tt class=
! 9361: "filename">/etc/shells</tt> file automatically in the
! 9362: post-install target by the generated <tt class=
! 9363: "filename">INSTALL</tt> script and removed in the
! 9364: deinstall target by the <tt class=
! 9365: "filename">DEINSTALL</tt> script.</p>
1.1 grant 9366: </div>
9367:
9368: <div class="sect2" lang="en" xml:lang="en">
9369: <div class="titlepage">
9370: <div>
9371: <div>
1.13 ! hubertf 9372: <h3 class="title"><a name="id2573518" id=
! 9373: "id2573518"></a>12.5.7. Packages containing
1.1 grant 9374: perl scripts</h3>
9375: </div>
9376: </div>
9377: </div>
9378:
9379: <p>If your package contains interpreted perl scripts,
1.13 ! hubertf 9380: set <tt class="varname">REPLACE_PERL</tt> to ensure
! 9381: that the proper interpreter path is set. <tt class=
! 9382: "varname">REPLACE_PERL</tt> should contain a list of
! 9383: scripts, relative to <tt class="varname">WRKSRC</tt>,
! 9384: that you want adjusted.</p>
1.1 grant 9385: </div>
9386:
9387: <div class="sect2" lang="en" xml:lang="en">
9388: <div class="titlepage">
9389: <div>
9390: <div>
1.13 ! hubertf 9391: <h3 class="title"><a name="id2573537" id=
! 9392: "id2573537"></a>12.5.8. Packages with
1.1 grant 9393: hardcoded paths to other interpreters</h3>
9394: </div>
9395: </div>
9396: </div>
9397:
9398: <p>Your package may also contain scripts with hardcoded
9399: paths to other interpreters besides (or as well as)
9400: perl. To correct the full pathname to the script
9401: interpreter, you need to set the following definitions
1.13 ! hubertf 9402: in your <tt class="filename">Makefile</tt> (we shall
! 9403: use <span><b class="command">tclsh</b></span> in this
! 9404: example):</p>
1.1 grant 9405: <pre class="programlisting">
9406: REPLACE_INTERPRETER+= tcl
9407: _REPLACE.tcl.old= .*/bin/tclsh
9408: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
9409: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
9410: relative to ${WRKSRC}, just as in REPLACE_PERL
9411: </pre>
9412: </div>
9413:
9414: <div class="sect2" lang="en" xml:lang="en">
9415: <div class="titlepage">
9416: <div>
9417: <div>
1.13 ! hubertf 9418: <h3 class="title"><a name="id2573558" id=
! 9419: "id2573558"></a>12.5.9. Packages installing
1.1 grant 9420: perl modules</h3>
9421: </div>
9422: </div>
9423: </div>
9424:
9425: <p>Makefiles of packages providing perl5 modules should
1.13 ! hubertf 9426: include the Makefile fragment <tt class=
! 9427: "filename">../../lang/perl5/module.mk</tt>. It provides
! 9428: a <span><b class="command">do-configure</b></span>
! 9429: target for the standard perl configuration for such
! 9430: modules as well as various hooks to tune this
! 9431: configuration. See comments in this file for
! 9432: details.</p>
1.1 grant 9433:
9434: <p>Perl5 modules will install into different places
9435: depending on the version of perl used during the build
9436: process. To address this, pkgsrc will append lines to
1.13 ! hubertf 9437: the <tt class="filename">PLIST</tt> corresponding to
! 9438: the files listed in the installed <tt class=
! 9439: "filename">.packlist</tt> file generated by most perl5
! 9440: modules. This is invoked by defining <tt class=
! 9441: "varname">PERL5_PACKLIST</tt> to a space-separated list
! 9442: of paths to packlist files, e.g.:</p>
1.1 grant 9443: <pre class="programlisting">
9444: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
9445: </pre>
9446:
1.13 ! hubertf 9447: <p>The variables <tt class=
! 9448: "varname">PERL5_SITELIB</tt>, <tt class=
! 9449: "varname">PERL5_SITEARCH</tt>, and <tt class=
! 9450: "varname">PERL5_ARCHLIB</tt> represent the three
1.1 grant 9451: locations in which perl5 modules may be installed, and
9452: may be used by perl5 packages that don't have a
9453: packlist. These three variables are also substituted
1.13 ! hubertf 9454: for in the <tt class="filename">PLIST</tt>.</p>
1.1 grant 9455: </div>
9456:
9457: <div class="sect2" lang="en" xml:lang="en">
9458: <div class="titlepage">
9459: <div>
9460: <div>
9461: <h3 class="title"><a name="faq.info-files" id=
9462: "faq.info-files"></a>12.5.10. Packages
9463: installing info files</h3>
9464: </div>
9465: </div>
9466: </div>
9467:
9468: <p>Some packages install info files or use the
9469: “<span class="quote">makeinfo</span>” or
9470: “<span class="quote">install-info</span>”
9471: commands. Each of the info files:</p>
9472:
9473: <div class="itemizedlist">
9474: <ul type="disc">
9475: <li>
9476: <p>is considered to be installed in the directory
1.13 ! hubertf 9477: <tt class=
! 9478: "filename">${PREFIX}/${INFO_DIR}</tt>,</p>
1.1 grant 9479: </li>
9480:
9481: <li>
9482: <p>is registered in the Info directory file
1.13 ! hubertf 9483: <tt class=
! 9484: "filename">${PREFIX}/${INFO_DIR}/dir</tt>,</p>
1.1 grant 9485: </li>
9486:
9487: <li>
9488: <p>and must be listed as a filename in the
1.13 ! hubertf 9489: <tt class="varname">INFO_FILES</tt> variable in
! 9490: the package Makefile.</p>
1.1 grant 9491: </li>
9492: </ul>
9493: </div>
9494:
1.13 ! hubertf 9495: <p><tt class="varname">INFO_DIR</tt> defaults to
1.1 grant 9496: “<span class="quote">info</span>” and can
1.13 ! hubertf 9497: be overridden in the package Makefile. <tt class=
! 9498: "filename">INSTALL</tt> and <tt class=
! 9499: "filename">DEINSTALL</tt> scripts will be generated to
! 9500: handle registration of the info files in the Info
1.1 grant 9501: directory file. The “<span class=
9502: "quote">install-info</span>” command used for the
9503: info files registration is either provided by the
9504: system, or by a special purpose package automatically
9505: added as dependency if needed.</p>
9506:
9507: <p>A package which needs the “<span class=
9508: "quote">makeinfo</span>” command at build time
1.13 ! hubertf 9509: must define the variable <tt class=
! 9510: "varname">USE_MAKEINFO</tt> in its Makefile. If a
1.1 grant 9511: minimum version of the “<span class=
9512: "quote">makeinfo</span>” command is needed it
1.13 ! hubertf 9513: should be noted with the <tt class=
! 9514: "varname">TEXINFO_REQD</tt> variable in the package
! 9515: <tt class="filename">Makefile</tt>. By default, a
1.1 grant 9516: minimum version of 3.12 is required. If the system does
1.13 ! hubertf 9517: not provide a <span><b class=
! 9518: "command">makeinfo</b></span> command or if it does not
! 9519: match the required minimum, a build dependency on the
! 9520: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 9521: href=
1.1 grant 9522: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.13 ! hubertf 9523: class="pkgname">devel/gtexinfo</a> package will be
! 9524: added automatically.</p>
1.1 grant 9525:
9526: <p>The build and installation process of the software
9527: provided by the package should not use the
1.13 ! hubertf 9528: <span><b class="command">install-info</b></span>
! 9529: command as the registration of info files is the task
! 9530: of the package <tt class="filename">INSTALL</tt>
! 9531: script, and it must use the appropriate <span><b class=
! 9532: "command">makeinfo</b></span> command.</p>
1.1 grant 9533:
9534: <p>To achieve this goal the pkgsrc infrastructure
1.13 ! hubertf 9535: creates overriding scripts for the <span><b class=
! 9536: "command">install-info</b></span> and <span><b class=
! 9537: "command">makeinfo</b></span> commands in a directory
! 9538: listed early in <tt class="varname">PATH</tt>.</p>
1.1 grant 9539:
1.13 ! hubertf 9540: <p>The script overriding <span><b class=
! 9541: "command">install-info</b></span> has no effect except
! 9542: the logging of a message. The script overriding
! 9543: <span><b class="command">makeinfo</b></span> logs a
! 9544: message and according to the value of <tt class=
! 9545: "varname">USE_MAKEINFO</tt> and <tt class=
! 9546: "varname">TEXINFO_REQD</tt> either run the appropriate
! 9547: <span><b class="command">makeinfo</b></span> command or
! 9548: exit on error.</p>
1.1 grant 9549: </div>
9550:
9551: <div class="sect2" lang="en" xml:lang="en">
9552: <div class="titlepage">
9553: <div>
9554: <div>
1.13 ! hubertf 9555: <h3 class="title"><a name="id2573778" id=
! 9556: "id2573778"></a>12.5.11. Packages installing
1.1 grant 9557: GConf2 data files</h3>
9558: </div>
9559: </div>
9560: </div>
9561:
1.13 ! hubertf 9562: <p>If a package installs <tt class=
! 9563: "filename">.schemas</tt> or <tt class=
! 9564: "filename">.entries</tt> files, used by GConf2, you
1.1 grant 9565: need to take some extra steps to make sure they get
9566: registered in the database:</p>
9567:
9568: <div class="orderedlist">
9569: <ol type="1">
9570: <li>
1.13 ! hubertf 9571: <p>Include <tt class=
! 9572: "filename">../../devel/GConf2/schemas.mk</tt>
! 9573: instead of its <tt class=
! 9574: "filename">buildlink3.mk</tt> file. This takes
1.1 grant 9575: care of rebuilding the GConf2 database at
9576: installation and deinstallation time, and tells
9577: the package where to install GConf2 data files
9578: using some standard configure arguments. It also
9579: disallows any access to the database directly
9580: from the package.</p>
9581: </li>
9582:
9583: <li>
9584: <p>Ensure that the package installs its
1.13 ! hubertf 9585: <tt class="filename">.schemas</tt> files under
! 9586: <tt class=
! 9587: "filename">${PREFIX}/share/gconf/schemas</tt>. If
! 9588: they get installed under <tt class=
! 9589: "filename">${PREFIX}/etc</tt>, you will need to
1.1 grant 9590: manually patch the package.</p>
9591: </li>
9592:
9593: <li>
9594: <p>Check the PLIST and remove any entries under
9595: the etc/gconf directory, as they will be handled
9596: automatically. See <a href="#faq.conf" title=
9597: "6.13. Configuration files handling and placement">
9598: Section 6.13, “Configuration files
9599: handling and placement”</a> for more
9600: information.</p>
9601: </li>
9602:
9603: <li>
1.13 ! hubertf 9604: <p>Define the <tt class=
! 9605: "varname">GCONF2_SCHEMAS</tt> variable in your
! 9606: <tt class="filename">Makefile</tt> with a list of
! 9607: all <tt class="filename">.schemas</tt> files
! 9608: installed by the package, if any. Names must not
! 9609: contain any directories in them.</p>
1.1 grant 9610: </li>
9611:
9612: <li>
1.13 ! hubertf 9613: <p>Define the <tt class=
! 9614: "varname">GCONF2_ENTRIES</tt> variable in your
! 9615: <tt class="filename">Makefile</tt> with a list of
! 9616: all <tt class="filename">.entries</tt> files
! 9617: installed by the package, if any. Names must not
! 9618: contain any directories in them.</p>
1.1 grant 9619: </li>
9620: </ol>
9621: </div>
9622: </div>
9623:
9624: <div class="sect2" lang="en" xml:lang="en">
9625: <div class="titlepage">
9626: <div>
9627: <div>
1.13 ! hubertf 9628: <h3 class="title"><a name="id2573946" id=
! 9629: "id2573946"></a>12.5.12. Packages installing
1.1 grant 9630: scrollkeeper data files</h3>
9631: </div>
9632: </div>
9633: </div>
9634:
1.13 ! hubertf 9635: <p>If a package installs <tt class="filename">.omf</tt>
! 9636: files, used by scrollkeeper, you need to take some
! 9637: extra steps to make sure they get registered in the
! 9638: database:</p>
1.1 grant 9639:
9640: <div class="orderedlist">
9641: <ol type="1">
9642: <li>
1.13 ! hubertf 9643: <p>Include <tt class=
! 9644: "filename">../../textproc/scrollkeeper/omf.mk</tt>
! 9645: instead of its <tt class=
! 9646: "filename">buildlink3.mk</tt> file. This takes
1.1 grant 9647: care of rebuilding the scrollkeeper database at
9648: installation and deinstallation time, and
9649: disallows any access to it directly from the
9650: package.</p>
9651: </li>
9652:
9653: <li>
9654: <p>Check the PLIST and remove any entries under
1.13 ! hubertf 9655: the <tt class=
! 9656: "filename">libdata/scrollkeeper</tt> directory,
1.1 grant 9657: as they will be handled automatically.</p>
9658: </li>
9659:
9660: <li>
1.13 ! hubertf 9661: <p>Remove the <tt class="filename">share/omf</tt>
! 9662: directory from the PLIST. It will be handled by
! 9663: scrollkeeper.</p>
1.1 grant 9664: </li>
9665: </ol>
9666: </div>
9667: </div>
9668:
9669: <div class="sect2" lang="en" xml:lang="en">
9670: <div class="titlepage">
9671: <div>
9672: <div>
1.13 ! hubertf 9673: <h3 class="title"><a name="id2573997" id=
! 9674: "id2573997"></a>12.5.13. Packages installing
1.1 grant 9675: X11 fonts</h3>
9676: </div>
9677: </div>
9678: </div>
9679:
9680: <p>If a package installs font files, you will need to
9681: rebuild the fonts database in the directory where they
9682: get installed at installation and deinstallation time.
1.13 ! hubertf 9683: This can be automatically done by using <tt class=
! 9684: "filename">mk/fonts.mk</tt>, which you need to include
! 9685: in your <tt class="filename">Makefile</tt>.</p>
1.1 grant 9686:
9687: <p>When the file is included, you can list the
1.13 ! hubertf 9688: directories where fonts are installed in the <tt class=
! 9689: "varname">FONTS_<i class=
! 9690: "replaceable"><tt>type</tt></i>_DIRS</tt> variables,
! 9691: where <i class="replaceable"><tt>type</tt></i> can be
! 9692: one of “<span class="quote">TTF</span>”,
1.1 grant 9693: “<span class="quote">TYPE1</span>” or
9694: “<span class="quote">X11</span>”. Also make
1.13 ! hubertf 9695: sure that the database file <tt class=
! 9696: "filename">fonts.dir</tt> is not listed in the
1.1 grant 9697: PLIST.</p>
9698:
9699: <p>Note that you should not create new directories for
9700: fonts; instead use the standard ones to avoid that the
9701: user needs to manually configure his X server to find
9702: them.</p>
9703: </div>
9704:
9705: <div class="sect2" lang="en" xml:lang="en">
9706: <div class="titlepage">
9707: <div>
9708: <div>
1.13 ! hubertf 9709: <h3 class="title"><a name="id2574044" id=
! 9710: "id2574044"></a>12.5.14. Packages installing
1.1 grant 9711: GTK2 modules</h3>
9712: </div>
9713: </div>
9714: </div>
9715:
9716: <p>If a package installs gtk2 immodules or loaders, you
9717: need to take some extra steps to get them registered in
9718: the GTK2 database properly:</p>
9719:
9720: <div class="orderedlist">
9721: <ol type="1">
9722: <li>
1.13 ! hubertf 9723: <p>Include <tt class=
! 9724: "filename">../../x11/gtk2/modules.mk</tt> instead
! 9725: of its <tt class="filename">buildlink3.mk</tt>
! 9726: file. This takes care of rebuilding the database
! 9727: at installation and deinstallation time.</p>
1.1 grant 9728: </li>
9729:
9730: <li>
1.13 ! hubertf 9731: <p>Set <tt class=
! 9732: "varname">GTK2_IMMODULES=YES</tt> if your package
! 9733: installs GTK2 immodules.</p>
1.1 grant 9734: </li>
9735:
9736: <li>
1.13 ! hubertf 9737: <p>Set <tt class="varname">GTK2_LOADERS=YES</tt>
! 9738: if your package installs GTK2 loaders.</p>
1.1 grant 9739: </li>
9740:
9741: <li>
9742: <p>Patch the package to not touch any of the gtk2
9743: databases directly. These are:</p>
9744:
9745: <div class="itemizedlist">
9746: <ul type="disc">
9747: <li>
1.13 ! hubertf 9748: <p><tt class=
! 9749: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</tt></p>
1.1 grant 9750: </li>
9751:
9752: <li>
1.13 ! hubertf 9753: <p><tt class=
! 9754: "filename">libdata/gtk-2.0/gtk.immodules</tt></p>
1.1 grant 9755: </li>
9756: </ul>
9757: </div>
9758: </li>
9759:
9760: <li>
9761: <p>Check the PLIST and remove any entries under
1.13 ! hubertf 9762: the <tt class="filename">libdata/gtk-2.0</tt>
1.1 grant 9763: directory, as they will be handled
9764: automatically.</p>
9765: </li>
9766: </ol>
9767: </div>
9768: </div>
9769:
9770: <div class="sect2" lang="en" xml:lang="en">
9771: <div class="titlepage">
9772: <div>
9773: <div>
1.13 ! hubertf 9774: <h3 class="title"><a name="id2574114" id=
! 9775: "id2574114"></a>12.5.15. Packages installing
1.1 grant 9776: SGML or XML data</h3>
9777: </div>
9778: </div>
9779: </div>
9780:
9781: <p>If a package installs SGML or XML data files that
9782: need to be registered in system-wide catalogs (like
9783: DTDs, sub-catalogs, etc.), you need to take some extra
9784: steps:</p>
9785:
9786: <div class="orderedlist">
9787: <ol type="1">
9788: <li>
1.13 ! hubertf 9789: <p>Include <tt class=
! 9790: "filename">../../textproc/xmlcatmgr/catalogs.mk</tt>
! 9791: in your <tt class="filename">Makefile</tt>, which
! 9792: takes care of registering those files in
1.1 grant 9793: system-wide catalogs at installation and
9794: deinstallation time.</p>
9795: </li>
9796:
9797: <li>
1.13 ! hubertf 9798: <p>Set <tt class="varname">SGML_CATALOGS</tt> to
! 9799: the full path of any SGML catalogs installed by
! 9800: the package.</p>
1.1 grant 9801: </li>
9802:
9803: <li>
1.13 ! hubertf 9804: <p>Set <tt class="varname">XML_CATALOGS</tt> to
! 9805: the full path of any XML catalogs installed by
1.1 grant 9806: the package.</p>
9807: </li>
9808:
9809: <li>
1.13 ! hubertf 9810: <p>Set <tt class="varname">SGML_ENTRIES</tt> to
! 9811: individual entries to be added to the SGML
1.1 grant 9812: catalog. These come in groups of three strings;
9813: see xmlcatmgr(1) for more information
9814: (specifically, arguments recognized by the 'add'
9815: action). Note that you will normally not use this
9816: variable.</p>
9817: </li>
9818:
9819: <li>
1.13 ! hubertf 9820: <p>Set <tt class="varname">XML_ENTRIES</tt> to
! 9821: individual entries to be added to the XML
1.1 grant 9822: catalog. These come in groups of three strings;
9823: see xmlcatmgr(1) for more information
9824: (specifically, arguments recognized by the 'add'
9825: action). Note that you will normally not use this
9826: variable.</p>
9827: </li>
9828: </ol>
9829: </div>
9830: </div>
9831:
9832: <div class="sect2" lang="en" xml:lang="en">
9833: <div class="titlepage">
9834: <div>
9835: <div>
1.13 ! hubertf 9836: <h3 class="title"><a name="id2574234" id=
! 9837: "id2574234"></a>12.5.16. Packages installing
1.1 grant 9838: extensions to the MIME database</h3>
9839: </div>
9840: </div>
9841: </div>
9842:
9843: <p>If a package provides extensions to the MIME
1.13 ! hubertf 9844: database by installing <tt class="filename">.xml</tt>
! 9845: files inside <tt class=
! 9846: "filename">${PREFIX}/share/mime/packages</tt>, you need
! 9847: to take some extra steps to ensure that the database is
! 9848: kept consistent with respect to these new files:</p>
1.1 grant 9849:
9850: <div class="orderedlist">
9851: <ol type="1">
9852: <li>
1.13 ! hubertf 9853: <p>Include <tt class=
! 9854: "filename">../../databases/shared-mime-info/mimedb.mk</tt>
! 9855: (avoid using the <tt class=
! 9856: "filename">buildlink3.mk</tt> file from this same
! 9857: directory, which is reserved for inclusion from
! 9858: other <tt class="filename">buildlink3.mk</tt>
! 9859: files). It takes care of rebuilding the MIME
! 9860: database at installation and deinstallation time,
! 9861: and disallows any access to it directly from the
1.1 grant 9862: package.</p>
9863: </li>
9864:
9865: <li>
9866: <p>Check the PLIST and remove any entries under
1.13 ! hubertf 9867: the <tt class="filename">share/mime</tt>
1.1 grant 9868: directory, <span class=
9869: "emphasis"><em>except</em></span> for files saved
1.13 ! hubertf 9870: under <tt class=
! 9871: "filename">share/mime/packages</tt>. The former
1.1 grant 9872: are handled automatically by the
9873: update-mime-database program, but the later are
9874: package-dependent and must be removed by the
9875: package that installed them in the first
9876: place.</p>
9877: </li>
9878:
9879: <li>
1.13 ! hubertf 9880: <p>Remove any <tt class=
! 9881: "filename">share/mime/*</tt> directories from the
! 9882: PLIST. They will be handled by the
1.1 grant 9883: shared-mime-info package.</p>
9884: </li>
9885: </ol>
9886: </div>
9887: </div>
9888:
9889: <div class="sect2" lang="en" xml:lang="en">
9890: <div class="titlepage">
9891: <div>
9892: <div>
1.13 ! hubertf 9893: <h3 class="title"><a name="id2574305" id=
! 9894: "id2574305"></a>12.5.17. Packages using
1.1 grant 9895: intltool</h3>
9896: </div>
9897: </div>
9898: </div>
9899:
9900: <p>If a package uses intltool during its build, include
1.13 ! hubertf 9901: the <tt class=
! 9902: "filename">../../textproc/intltool/buildlink3.mk</tt>
1.1 grant 9903: file, which forces it to use the intltool package
9904: provided by pkgsrc, instead of the one bundled with the
9905: distribution file.</p>
9906:
9907: <p>This tracks intltool's build-time dependencies and
9908: uses the latest available version; this way, the
9909: package benefits of any bug fixes that may have
9910: appeared since it was released.</p>
9911: </div>
9912: </div>
9913:
9914: <div class="sect1" lang="en" xml:lang="en">
9915: <div class="titlepage">
9916: <div>
9917: <div>
9918: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 9919: "id2574318" id="id2574318"></a>12.6. Feedback
1.1 grant 9920: to the author</h2>
9921: </div>
9922: </div>
9923: </div>
9924:
9925: <p>If you have found any bugs in the package you make
9926: available, if you had to do special steps to make it run
9927: under NetBSD or if you enhanced the software in various
9928: other ways, be sure to report these changes back to the
9929: original author of the program! With that kind of
9930: support, the next release of the program can incorporate
9931: these fixes, and people not using the NetBSD packages
9932: system can win from your efforts.</p>
9933:
9934: <p>Support the idea of free software!</p>
9935: </div>
9936: </div>
9937:
9938: <div class="chapter" lang="en" xml:lang="en">
9939: <div class="titlepage">
9940: <div>
9941: <div>
9942: <h2 class="title"><a name="debug" id=
9943: "debug"></a>Chapter 13. Debugging</h2>
9944: </div>
9945: </div>
9946: </div>
9947:
9948: <p>To check out all the gotchas when building a package,
9949: here are the steps that I do in order to get a package
9950: working. Please note this is basically the same as what was
9951: explained in the previous sections, only with some
9952: debugging aids.</p>
9953:
9954: <div class="itemizedlist">
9955: <ul type="disc">
9956: <li>
1.13 ! hubertf 9957: <p>Be sure to set <tt class=
! 9958: "varname">PKG_DEVELOPER=1</tt> in <tt class=
! 9959: "filename">/etc/mk.conf</tt></p>
1.1 grant 9960: </li>
9961:
9962: <li>
9963: <p>Install <a xmlns=
9964: "http://www.w3.org/TR/xhtml1/transitional" href=
9965: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.13 ! hubertf 9966: class="pkgname">pkgtools/url2pkg</a>, create a
! 9967: directory for a new package, change into it, then
! 9968: run <span><b class=
! 9969: "command">url2pkg</b></span>:</p>
1.1 grant 9970: <pre class="screen">
1.13 ! hubertf 9971: <tt class="prompt">%</tt> <b class=
! 9972: "userinput"><tt>mkdir /usr/pkgsrc/<i class=
! 9973: "replaceable"><tt>category</tt></i>/<i class=
! 9974: "replaceable"><tt>examplepkg</tt></i></tt></b>
! 9975: <tt class="prompt">%</tt> <b class=
! 9976: "userinput"><tt>cd /usr/pkgsrc/<i class=
! 9977: "replaceable"><tt>category</tt></i>/<i class=
! 9978: "replaceable"><tt>examplepkg</tt></i></tt></b>
! 9979: <tt class="prompt">%</tt> <b class=
! 9980: "userinput"><tt>url2pkg http://www.example.com/path/to/distfile.tar.gz</tt></b>
1.1 grant 9981: </pre>
9982: </li>
9983:
9984: <li>
1.13 ! hubertf 9985: <p>Edit the <tt class="filename">Makefile</tt> as
1.1 grant 9986: requested.</p>
9987: </li>
9988:
9989: <li>
1.13 ! hubertf 9990: <p>Fill in the <tt class="filename">DESCR</tt>
1.1 grant 9991: file</p>
9992: </li>
9993:
9994: <li>
1.13 ! hubertf 9995: <p>Run <span><b class="command">make
! 9996: configure</b></span></p>
1.1 grant 9997: </li>
9998:
9999: <li>
10000: <p>Add any dependencies glimpsed from documentation
1.13 ! hubertf 10001: and the configure step to the package's <tt class=
! 10002: "filename">Makefile</tt>.</p>
1.1 grant 10003: </li>
10004:
10005: <li>
10006: <p>Make the package compile, doing multiple rounds
10007: of</p>
10008: <pre class="screen">
1.13 ! hubertf 10009: <tt class="prompt">%</tt> <b class="userinput"><tt>make</tt></b>
! 10010: <tt class="prompt">%</tt> <b class=
! 10011: "userinput"><tt>pkgvi ${WRKSRC}/some/file/that/does/not/compile</tt></b>
! 10012: <tt class="prompt">%</tt> <b class=
! 10013: "userinput"><tt>mkpatches</tt></b>
! 10014: <tt class="prompt">%</tt> <b class=
! 10015: "userinput"><tt>patchdiff</tt></b>
! 10016: <tt class="prompt">%</tt> <b class=
! 10017: "userinput"><tt>mv ${WRKDIR}/.newpatches/* patches</tt></b>
! 10018: <tt class="prompt">%</tt> <b class=
! 10019: "userinput"><tt>make mps</tt></b>
! 10020: <tt class="prompt">%</tt> <b class=
! 10021: "userinput"><tt>make clean</tt></b>
1.1 grant 10022: </pre>
10023:
10024: <p>Doing as non-root user will ensure that no files
10025: are modified that shouldn't be, especially during the
1.13 ! hubertf 10026: build phase. <span><b class=
! 10027: "command">mkpatches</b></span>, <span><b class=
! 10028: "command">patchdiff</b></span> and <span><b class=
! 10029: "command">pkgvi</b></span> are from the <a xmlns=
1.1 grant 10030: "http://www.w3.org/TR/xhtml1/transitional" href=
10031: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.13 ! hubertf 10032: class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1 grant 10033: </li>
10034:
10035: <li>
1.13 ! hubertf 10036: <p>Look at the <tt class="filename">Makefile</tt>,
! 10037: fix if necessary; see <a href="#components.Makefile"
! 10038: title="7.1. Makefile">Section 7.1,
! 10039: “Makefile”</a>.</p>
1.1 grant 10040: </li>
10041:
10042: <li>
1.13 ! hubertf 10043: <p>Generate a <tt class="filename">PLIST</tt>:</p>
1.1 grant 10044: <pre class="screen">
1.13 ! hubertf 10045: <tt class="prompt">#</tt> <b class=
! 10046: "userinput"><tt>make install</tt></b>
! 10047: <tt class="prompt">#</tt> <b class=
! 10048: "userinput"><tt>make print-PLIST >PLIST</tt></b>
! 10049: <tt class="prompt">#</tt> <b class=
! 10050: "userinput"><tt>make deinstall</tt></b>
! 10051: <tt class="prompt">#</tt> <b class=
! 10052: "userinput"><tt>make install</tt></b>
! 10053: <tt class="prompt">#</tt> <b class=
! 10054: "userinput"><tt>make deinstall</tt></b>
1.1 grant 10055: </pre>
10056:
1.13 ! hubertf 10057: <p>You usually need to be <tt class=
! 10058: "username">root</tt> to do this. Look if there are
1.1 grant 10059: any files left:</p>
10060: <pre class="screen">
1.13 ! hubertf 10061: <tt class="prompt">#</tt> <b class=
! 10062: "userinput"><tt>make print-PLIST</tt></b>
1.1 grant 10063: </pre>
10064:
10065: <p>If this reveals any files that are missing in
1.13 ! hubertf 10066: <tt class="filename">PLIST</tt>, add them.</p>
1.1 grant 10067: </li>
10068:
10069: <li>
1.13 ! hubertf 10070: <p>Now that the <tt class="filename">PLIST</tt> is
! 10071: OK, install the package again and make a binary
1.1 grant 10072: package:</p>
10073: <pre class="screen">
1.13 ! hubertf 10074: <tt class="prompt">#</tt> <b class=
! 10075: "userinput"><tt>make reinstall</tt></b>
! 10076: <tt class="prompt">#</tt> <b class=
! 10077: "userinput"><tt>make package</tt></b>
1.1 grant 10078: </pre>
10079: </li>
10080:
10081: <li>
10082: <p>Delete the installed package:</p>
10083: <pre class="screen">
1.13 ! hubertf 10084: <tt class="prompt">#</tt> <b class=
! 10085: "userinput"><tt>pkg_delete blub</tt></b>
1.1 grant 10086: </pre>
10087: </li>
10088:
10089: <li>
1.13 ! hubertf 10090: <p>Repeat the above <span><b class="command">make
! 10091: print-PLIST</b></span> command, which shouldn't find
! 10092: anything now:</p>
1.1 grant 10093: <pre class="screen">
1.13 ! hubertf 10094: <tt class="prompt">#</tt> <b class=
! 10095: "userinput"><tt>make print-PLIST</tt></b>
1.1 grant 10096: </pre>
10097: </li>
10098:
10099: <li>
10100: <p>Reinstall the binary package:</p>
10101: <pre class="screen">
1.13 ! hubertf 10102: <tt class="prompt">#</tt> <b class=
! 10103: "userinput"><tt>pkgadd .../blub.tgz</tt></b>
1.1 grant 10104: </pre>
10105: </li>
10106:
10107: <li>
10108: <p>Play with it. Make sure everything works.</p>
10109: </li>
10110:
10111: <li>
1.13 ! hubertf 10112: <p>Run <span><b class="command">pkglint</b></span>
! 10113: from <a xmlns=
1.1 grant 10114: "http://www.w3.org/TR/xhtml1/transitional" href=
10115: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.13 ! hubertf 10116: class="pkgname">pkgtools/pkglint</a>, and fix the
! 10117: problems it reports:</p>
1.1 grant 10118: <pre class="screen">
1.13 ! hubertf 10119: <tt class="prompt">#</tt> <b class="userinput"><tt>pkglint</tt></b>
1.1 grant 10120: </pre>
10121: </li>
10122:
10123: <li>
10124: <p>Submit (or commit, if you have cvs access); see
10125: <a href="#submit" title=
10126: "Chapter 14. Submitting and Committing">Chapter 14,
10127: <i>Submitting and Committing</i></a>.</p>
10128: </li>
10129: </ul>
10130: </div>
10131: </div>
10132:
10133: <div class="chapter" lang="en" xml:lang="en">
10134: <div class="titlepage">
10135: <div>
10136: <div>
10137: <h2 class="title"><a name="submit" id=
10138: "submit"></a>Chapter 14. Submitting and
10139: Committing</h2>
10140: </div>
10141: </div>
10142: </div>
10143:
10144: <div class="toc">
10145: <p><b>Table of Contents</b></p>
10146:
10147: <dl>
1.13 ! hubertf 10148: <dt><span class="sect1"><a href="#id2574849">14.1.
1.1 grant 10149: Submitting your packages</a></span></dt>
10150:
1.13 ! hubertf 10151: <dt><span class="sect1"><a href="#id2575036">14.2.
1.1 grant 10152: Committing: Importing a package into
10153: CVS</a></span></dt>
10154:
1.13 ! hubertf 10155: <dt><span class="sect1"><a href="#id2575168">14.3.
1.2 hubertf 10156: Updating a package to a newer version</a></span></dt>
1.1 grant 10157:
1.13 ! hubertf 10158: <dt><span class="sect1"><a href="#id2575187">14.4.
1.2 hubertf 10159: Moving a package in pkgsrc</a></span></dt>
1.1 grant 10160: </dl>
10161: </div>
10162:
10163: <div class="sect1" lang="en" xml:lang="en">
10164: <div class="titlepage">
10165: <div>
10166: <div>
10167: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 10168: "id2574849" id=
! 10169: "id2574849"></a>14.1. Submitting your
1.1 grant 10170: packages</h2>
10171: </div>
10172: </div>
10173: </div>
10174:
10175: <p>You have to separate between binary and
10176: “<span class="quote">normal</span>” (source)
10177: packages here:</p>
10178:
10179: <div class="itemizedlist">
10180: <ul type="disc">
10181: <li>
10182: <p>precompiled binary packages</p>
10183:
10184: <p>Our policy is that we accept binaries only from
10185: pkgsrc developers to guarantee that the packages
10186: don't contain any trojan horses etc. This is not to
1.13 ! hubertf 10187: annoy anyone but rather to protect our users!
1.1 grant 10188: You're still free to put up your home-made binary
1.13 ! hubertf 10189: packages and tell the world where to get them.
! 10190: NetBSD developers doing bulk builds and wanting to
! 10191: upload them please see <a href="#bulk-upload"
! 10192: title="5.3.8. Uploading results of a bulk build">
! 10193: Section 5.3.8, “Uploading results of a
! 10194: bulk build”</a>.</p>
1.1 grant 10195: </li>
10196:
10197: <li>
10198: <p>packages</p>
10199:
10200: <p>First, check that your package is complete,
10201: compiles and runs well; see <a href="#debug" title=
10202: "Chapter 13. Debugging">Chapter 13,
10203: <i>Debugging</i></a> and the rest of this document.
10204: Next, generate an uuencoded gzipped tar(1) archive,
10205: preferably with all files in a single directory.
1.13 ! hubertf 10206: Finally, <span><b class=
! 10207: "command">send-pr</b></span> with category
1.1 grant 10208: “<span class="quote">pkg</span>”, a
10209: synopsis which includes the package name and
10210: version number, a short description of your package
10211: (contents of the COMMENT variable or DESCR file are
10212: OK) and attach the archive to your PR.</p>
10213:
10214: <p>If you want to submit several packages, please
10215: send a separate PR for each one, it's easier for us
10216: to track things that way.</p>
10217:
10218: <p>Alternatively, you can also import new packages
10219: into pkgsrc-wip (“<span class="quote">pkgsrc
10220: work-in-progress</span>”); see the homepage
10221: at <a href="http://pkgsrc-wip.sourceforge.net/"
10222: target=
10223: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
10224: details.</p>
10225: </li>
10226: </ul>
10227: </div>
10228: </div>
10229:
10230: <div class="sect1" lang="en" xml:lang="en">
10231: <div class="titlepage">
10232: <div>
10233: <div>
10234: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 10235: "id2575036" id=
! 10236: "id2575036"></a>14.2. Committing: Importing a
1.1 grant 10237: package into CVS</h2>
10238: </div>
10239: </div>
10240: </div>
10241:
10242: <p>This section is only of interest for pkgsrc developers
10243: with write access to the pkgsrc repository. Please
10244: remember that cvs imports files relative to the current
10245: working directory, and that the pathname that you give
1.13 ! hubertf 10246: the <span><b class="command">cvs import</b></span>
! 10247: command is so that it knows where to place the files in
! 10248: the repository. Newly created packages should be imported
! 10249: with a vendor tag of “<span class=
! 10250: "quote">TNF</span>” and a release tag of
! 10251: “<span class="quote">pkgsrc-base</span>”,
! 10252: e.g:</p>
1.1 grant 10253: <pre class="programlisting">
10254: % cd .../pkgsrc/category/pkgname
10255: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
10256: </pre>
10257:
10258: <p>Remember to move the directory from which you imported
10259: out of the way, or cvs will complain the next time you
10260: “<span class="quote">cvs update</span>” your
10261: source tree. Also don't forget to add the new package to
1.13 ! hubertf 10262: the category's <tt class="filename">Makefile</tt>.</p>
1.1 grant 10263:
10264: <p>The commit message of the initial import should
1.13 ! hubertf 10265: include part of the <tt class="filename">DESCR</tt> file,
! 10266: so people reading the mailing lists know what the package
! 10267: is/does.</p>
1.1 grant 10268:
10269: <p>Please note all package updates/additions in
1.13 ! hubertf 10270: <tt class="filename">pkgsrc/doc/CHANGES</tt>. It's very
! 10271: important to keep this file up to date and conforming to
! 10272: the existing format, because it will be used by scripts
! 10273: to automatically update pages on <a href=
1.1 grant 10274: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
10275: and other sites. Additionally, check the pkgsrc/doc/TODO
10276: file and remove the entry for the package you updated, in
10277: case it was mentioned there.</p>
10278:
10279: <p>For new packages, “<span class="quote">cvs
10280: import</span>” is preferred to “<span class=
10281: "quote">cvs add</span>” because the former gets
10282: everything with a single command, and provides a
10283: consistent tag.</p>
10284: </div>
10285:
10286: <div class="sect1" lang="en" xml:lang="en">
10287: <div class="titlepage">
10288: <div>
10289: <div>
10290: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 10291: "id2575168" id="id2575168"></a>14.3. Updating
1.2 hubertf 10292: a package to a newer version</h2>
1.1 grant 10293: </div>
10294: </div>
10295: </div>
10296:
10297: <p>Please always put a concise, appropriate and relevant
10298: summary of the changes between old and new versions into
10299: the commit log when updating a package. There are various
10300: reasons for this:</p>
10301:
10302: <div class="itemizedlist">
10303: <ul type="disc">
10304: <li>
10305: <p>A URL is volatile, and can change over time. It
10306: may go away completely or its information may be
10307: overwritten by newer information.</p>
10308: </li>
10309:
10310: <li>
10311: <p>Having the change information between old and
10312: new versions in our CVS repository is very useful
10313: for people who use either cvs or anoncvs.</p>
10314: </li>
10315:
10316: <li>
10317: <p>Having the change information between old and
10318: new versions in our CVS repository is very useful
10319: for people who read the pkgsrc-changes mailing
10320: list, so that they can make tactical decisions
10321: about when to upgrade the package.</p>
10322: </li>
10323: </ul>
10324: </div>
10325:
10326: <p>Please also recognise that, just because a new version
10327: of a package has been released, it should not
10328: automatically be upgraded in the CVS repository. We
10329: prefer to be conservative in the packages that are
10330: included in pkgsrc - development or beta packages are not
10331: really the best thing for most places in which pkgsrc is
10332: used. Please use your judgement about what should go into
10333: pkgsrc, and bear in mind that stability is to be
10334: preferred above new and possibly untested features.</p>
10335: </div>
10336:
10337: <div class="sect1" lang="en" xml:lang="en">
10338: <div class="titlepage">
10339: <div>
10340: <div>
10341: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 10342: "id2575187" id="id2575187"></a>14.4. Moving a
1.2 hubertf 10343: package in pkgsrc</h2>
1.1 grant 10344: </div>
10345: </div>
10346: </div>
10347:
10348: <div class="orderedlist">
10349: <ol type="1">
10350: <li>
10351: <p>Make a copy of the directory somewhere else.</p>
10352: </li>
10353:
10354: <li>
10355: <p>Remove all CVS dirs.</p>
10356:
10357: <p>Alternatively to the first two steps you can
10358: also do:</p>
10359: <pre class="screen">
1.13 ! hubertf 10360: <tt class="prompt">%</tt> <b class=
! 10361: "userinput"><tt>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</tt></b>
1.1 grant 10362: </pre>
10363:
10364: <p>and use that for further work.</p>
10365: </li>
10366:
10367: <li>
1.13 ! hubertf 10368: <p>Fix <tt class="varname">CATEGORIES</tt> and any
! 10369: <tt class="varname">DEPENDS</tt> paths that just
! 10370: did “<span class=
1.1 grant 10371: "quote">../package</span>” instead of
10372: “<span class=
10373: "quote">../../category/package</span>”.</p>
10374: </li>
10375:
10376: <li>
1.13 ! hubertf 10377: <p><span><b class="command">cvs import</b></span>
! 10378: the modified package in the new place.</p>
1.1 grant 10379: </li>
10380:
10381: <li>
10382: <p>Check if any package depends on it:</p>
10383: <pre class="screen">
1.13 ! hubertf 10384: <tt class="prompt">%</tt> <b class=
! 10385: "userinput"><tt>cd /usr/pkgsrc</tt></b>
! 10386: <tt class="prompt">%</tt> <b class=
! 10387: "userinput"><tt>grep /package */*/Makefile* */*/buildlink*</tt></b>
1.1 grant 10388: </pre>
10389: </li>
10390:
10391: <li>
10392: <p>Fix paths in packages from step 5 to point to
10393: new location.</p>
10394: </li>
10395:
10396: <li>
1.13 ! hubertf 10397: <p><span><b class="command">cvs rm (-f)</b></span>
! 10398: the package at the old location.</p>
1.1 grant 10399: </li>
10400:
10401: <li>
1.13 ! hubertf 10402: <p>Remove from <tt class=
! 10403: "filename">oldcategory/Makefile</tt>.</p>
1.1 grant 10404: </li>
10405:
10406: <li>
1.13 ! hubertf 10407: <p>Add to <tt class=
! 10408: "filename">newcategory/Makefile</tt>.</p>
1.1 grant 10409: </li>
10410:
10411: <li>
10412: <p>Commit the changed and removed files:</p>
10413: <pre class="screen">
1.13 ! hubertf 10414: <tt class="prompt">%</tt> <b class=
! 10415: "userinput"><tt>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</tt></b>
1.1 grant 10416: </pre>
10417:
10418: <p>(and any packages from step 5, of course).</p>
10419: </li>
10420: </ol>
10421: </div>
10422: </div>
10423: </div>
10424: </div>
10425:
10426: <div class="appendix" lang="en" xml:lang="en">
10427: <div class="titlepage">
10428: <div>
10429: <div>
10430: <h2 class="title"><a name="examples" id=
10431: "examples"></a>Appendix A. A simple example
10432: package: bison</h2>
10433: </div>
10434: </div>
10435: </div>
10436:
10437: <div class="toc">
10438: <p><b>Table of Contents</b></p>
10439:
10440: <dl>
1.13 ! hubertf 10441: <dt><span class="sect1"><a href="#id2575345">A.1.
1.1 grant 10442: files</a></span></dt>
10443:
10444: <dd>
10445: <dl>
1.13 ! hubertf 10446: <dt><span class="sect2"><a href="#id2575348">A.1.1.
1.1 grant 10447: Makefile</a></span></dt>
10448:
1.13 ! hubertf 10449: <dt><span class="sect2"><a href="#id2575355">A.1.2.
1.1 grant 10450: DESCR</a></span></dt>
10451:
1.13 ! hubertf 10452: <dt><span class="sect2"><a href="#id2575370">A.1.3.
1.1 grant 10453: PLIST</a></span></dt>
10454:
1.13 ! hubertf 10455: <dt><span class="sect2"><a href="#id2575378">A.1.4.
! 10456: Checking a package with pkglint</a></span></dt>
1.1 grant 10457: </dl>
10458: </dd>
10459:
1.13 ! hubertf 10460: <dt><span class="sect1"><a href="#id2575418">A.2. Steps
1.1 grant 10461: for building, installing, packaging</a></span></dt>
10462: </dl>
10463: </div>
10464:
10465: <p>We checked to find a piece of software that wasn't in the
10466: packages collection, and picked GNU bison. Quite why someone
1.13 ! hubertf 10467: would want to have <span><b class="command">bison</b></span>
! 10468: when Berkeley <span><b class="command">yacc</b></span> is
! 10469: already present in the tree is beyond us, but it's useful for
! 10470: the purposes of this exercise.</p>
1.1 grant 10471:
10472: <div class="sect1" lang="en" xml:lang="en">
10473: <div class="titlepage">
10474: <div>
10475: <div>
10476: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 10477: "id2575345" id="id2575345"></a>A.1. files</h2>
1.1 grant 10478: </div>
10479: </div>
10480: </div>
10481:
10482: <div class="sect2" lang="en" xml:lang="en">
10483: <div class="titlepage">
10484: <div>
10485: <div>
1.13 ! hubertf 10486: <h3 class="title"><a name="id2575348" id=
! 10487: "id2575348"></a>A.1.1. Makefile</h3>
1.1 grant 10488: </div>
10489: </div>
10490: </div>
10491: <pre class="programlisting">
1.11 ben 10492: # $NetBSD$
1.1 grant 10493: #
10494:
10495: DISTNAME= bison-1.25
10496: CATEGORIES= devel
10497: MASTER_SITES= ${MASTER_SITE_GNU}
10498:
10499: MAINTAINER= thorpej@NetBSD.org
10500: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
10501: COMMENT= GNU yacc clone
10502:
10503: GNU_CONFIGURE= yes
10504: INFO_FILES= bison.info
10505:
10506: .include "../../mk/bsd.pkg.mk"
10507: </pre>
10508: </div>
10509:
10510: <div class="sect2" lang="en" xml:lang="en">
10511: <div class="titlepage">
10512: <div>
10513: <div>
1.13 ! hubertf 10514: <h3 class="title"><a name="id2575355" id=
! 10515: "id2575355"></a>A.1.2. DESCR</h3>
1.1 grant 10516: </div>
10517: </div>
10518: </div>
10519: <pre class="programlisting">
10520: GNU version of yacc. Can make re-entrant parsers, and numerous other
10521: improvements. Why you would want this when Berkeley <a href=
10522: "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
10523: of the NetBSD source tree is beyond me.
10524: </pre>
10525: </div>
10526:
10527: <div class="sect2" lang="en" xml:lang="en">
10528: <div class="titlepage">
10529: <div>
10530: <div>
1.13 ! hubertf 10531: <h3 class="title"><a name="id2575370" id=
! 10532: "id2575370"></a>A.1.3. PLIST</h3>
1.1 grant 10533: </div>
10534: </div>
10535: </div>
10536: <pre class="programlisting">
1.11 ben 10537: @comment $NetBSD$
1.1 grant 10538: bin/bison
10539: man/man1/bison.1.gz
10540: share/bison.simple
10541: share/bison.hairy
10542: </pre>
10543: </div>
10544:
10545: <div class="sect2" lang="en" xml:lang="en">
10546: <div class="titlepage">
10547: <div>
10548: <div>
1.13 ! hubertf 10549: <h3 class="title"><a name="id2575378" id=
! 10550: "id2575378"></a>A.1.4. Checking a package with
! 10551: <span><b class="command">pkglint</b></span></h3>
1.1 grant 10552: </div>
10553: </div>
10554: </div>
10555:
10556: <p>The NetBSD package system comes with <a xmlns=
10557: "http://www.w3.org/TR/xhtml1/transitional" href=
10558: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.13 ! hubertf 10559: class="pkgname">pkgtools/pkglint</a> which helps to
! 10560: check the contents of these files. After installation
! 10561: it is quite easy to use, just change to the directory
! 10562: of the package you wish to examine and execute
! 10563: <span><b class="command">pkglint</b></span>:</p>
1.1 grant 10564: <pre class="screen">
1.13 ! hubertf 10565: <tt class="prompt">$</tt> <b class="userinput"><tt>pkglint</tt></b>
1.1 grant 10566: OK: checking ./DESCR.
10567: OK: checking Makefile.
10568: OK: checking distinfo.
10569: OK: checking patches/patch-aa.
10570: looks fine.
10571: </pre>
10572:
10573: <p>Depending on the supplied command line arguments (see
10574: pkglint(1)) more verbose checks will be performed. Use
1.13 ! hubertf 10575: e.g. <span><b class="command">pkglint -v</b></span> for a
! 10576: very verbose check.</p>
1.1 grant 10577: </div>
10578: </div>
10579:
10580: <div class="sect1" lang="en" xml:lang="en">
10581: <div class="titlepage">
10582: <div>
10583: <div>
10584: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 10585: "id2575418" id="id2575418"></a>A.2. Steps for
1.1 grant 10586: building, installing, packaging</h2>
10587: </div>
10588: </div>
10589: </div>
10590:
10591: <p>Create the directory where the package lives, plus any
10592: auxiliary directories:</p>
10593: <pre class="screen">
1.13 ! hubertf 10594: <tt class="prompt">#</tt> <b class=
! 10595: "userinput"><tt>cd /usr/pkgsrc/lang</tt></b>
! 10596: <tt class="prompt">#</tt> <b class=
! 10597: "userinput"><tt>mkdir bison</tt></b>
! 10598: <tt class="prompt">#</tt> <b class=
! 10599: "userinput"><tt>cd bison</tt></b>
! 10600: <tt class="prompt">#</tt> <b class=
! 10601: "userinput"><tt>mkdir patches</tt></b>
1.1 grant 10602: </pre>
10603:
1.13 ! hubertf 10604: <p>Create <tt class="filename">Makefile</tt>, <tt class=
! 10605: "filename">DESCR</tt> and <tt class="filename">PLIST</tt>
! 10606: (see <a href="#components" title=
1.1 grant 10607: "Chapter 7. Package components - files, directories and contents">
10608: Chapter 7, <i>Package components - files, directories and
10609: contents</i></a>) then continue with fetching the
10610: distfile:</p>
10611: <pre class="screen">
1.13 ! hubertf 10612: <tt class="prompt">#</tt> <b class=
! 10613: "userinput"><tt>make fetch</tt></b>
1.1 grant 10614: >> bison-1.25.tar.gz doesn't seem to exist on this system.
10615: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
10616: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10617: ftp: Error retrieving file: 500 Internal error
10618:
10619: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
10620: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10621: ftp: Error retrieving file: 500 Internal error
10622:
10623: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
10624: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10625: Successfully retrieved file.
10626: </pre>
10627:
1.13 ! hubertf 10628: <p>Generate the checksum of the distfile into <tt class=
! 10629: "filename">distinfo</tt>:</p>
1.1 grant 10630: <pre class="screen">
1.13 ! hubertf 10631: <tt class="prompt">#</tt> <b class=
! 10632: "userinput"><tt>make makesum</tt></b>
1.1 grant 10633: </pre>
10634:
10635: <p>Now compile:</p>
10636: <pre class="screen">
1.13 ! hubertf 10637: <tt class="prompt">#</tt> <b class="userinput"><tt>make</tt></b>
1.1 grant 10638: >> Checksum OK for bison-1.25.tar.gz.
10639: ===> Extracting for bison-1.25
10640: ===> Patching for bison-1.25
10641: ===> Ignoring empty patch directory
10642: ===> Configuring for bison-1.25
10643: creating cache ./config.cache
10644: checking for gcc... cc
10645: checking whether we are using GNU C... yes
10646: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
10647: checking how to run the C preprocessor... cc -E
10648: checking for minix/config.h... no
10649: checking for POSIXized ISC... no
10650: checking whether cross-compiling... no
10651: checking for ANSI C header files... yes
10652: checking for string.h... yes
10653: checking for stdlib.h... yes
10654: checking for memory.h... yes
10655: checking for working const... yes
10656: checking for working alloca.h... no
10657: checking for alloca... yes
10658: checking for strerror... yes
10659: updating cache ./config.cache
10660: creating ./config.status
10661: creating Makefile
10662: ===> Building for bison-1.25
10663: 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
10664: 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
10665: 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
10666: 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
10667: 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
10668: 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
10669: 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
10670: 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
10671: 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
10672: 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
10673: 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
10674: 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
10675: 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
10676: 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
10677: 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
10678: 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
10679: 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
10680: 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
10681: 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
10682: 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
10683: 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
10684: 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
10685: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
10686: rm -f bison.s1
10687: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
10688: </pre>
10689:
10690: <p>Everything seems OK, so install the files:</p>
10691: <pre class="screen">
1.13 ! hubertf 10692: <tt class="prompt">#</tt> <b class=
! 10693: "userinput"><tt>make install</tt></b>
1.1 grant 10694: >> Checksum OK for bison-1.25.tar.gz.
10695: ===> Installing for bison-1.25
10696: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
10697: rm -f /usr/pkg/bin/bison
10698: cd /usr/pkg/share; rm -f bison.simple bison.hairy
10699: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
10700: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
10701: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
10702: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
10703: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
10704: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
10705: ===> Registering installation for bison-1.25
10706: </pre>
10707:
10708: <p>You can now use bison, and also - if you decide so -
1.13 ! hubertf 10709: remove it with <span><b class="command">pkg_delete
! 10710: bison</b></span>. Should you decide that you want a binary
! 10711: package, do this now:</p>
1.1 grant 10712: <pre class="screen">
1.13 ! hubertf 10713: <tt class="prompt">#</tt> <b class=
! 10714: "userinput"><tt>make package</tt></b>
1.1 grant 10715: >> Checksum OK for bison-1.25.tar.gz.
10716: ===> Building package for bison-1.25
10717: Creating package bison-1.25.tgz
10718: Registering depends:.
10719: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
10720: </pre>
10721:
10722: <p>Now that you don't need the source and object files any
10723: more, clean up:</p>
10724: <pre class="screen">
1.13 ! hubertf 10725: <tt class="prompt">#</tt> <b class=
! 10726: "userinput"><tt>make clean</tt></b>
1.1 grant 10727: ===> Cleaning for bison-1.25
10728: </pre>
10729: </div>
10730: </div>
10731:
10732: <div class="appendix" lang="en" xml:lang="en">
10733: <div class="titlepage">
10734: <div>
10735: <div>
10736: <h2 class="title"><a name="logs" id=
10737: "logs"></a>Appendix B. Build logs</h2>
10738: </div>
10739: </div>
10740: </div>
10741:
10742: <div class="toc">
10743: <p><b>Table of Contents</b></p>
10744:
10745: <dl>
10746: <dt><span class="sect1"><a href="#logs.building">B.1.
10747: Building figlet</a></span></dt>
10748:
10749: <dt><span class="sect1"><a href="#logs.package">B.2.
10750: Packaging figlet</a></span></dt>
10751: </dl>
10752: </div>
10753:
10754: <div class="sect1" lang="en" xml:lang="en">
10755: <div class="titlepage">
10756: <div>
10757: <div>
10758: <h2 class="title" style="clear: both"><a name=
10759: "logs.building" id=
10760: "logs.building"></a>B.1. Building figlet</h2>
10761: </div>
10762: </div>
10763: </div>
10764: <pre class="screen">
1.13 ! hubertf 10765: <tt class="prompt">#</tt> <b class="userinput"><tt>make</tt></b>
1.1 grant 10766: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10767: => figlet221.tar.gz doesn't seem to exist on this system.
10768: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
10769: => [172219 bytes]
10770: Connected to ftp.plig.net.
10771: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
10772: 331 Guest login ok, send your complete e-mail address as password.
10773: 230-You are user #5 of 500 simultaneous users allowed.
10774: 230-
10775: 230- ___ _ _ _
10776: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
10777: 230- | _| _| . |_| . | | | . |_| . | _| . |
10778: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
10779: 230- |_| |_| |___| |___|
10780: 230-
10781: 230-** Welcome to ftp.plig.org **
10782: 230-
10783: 230-Please note that all transfers from this FTP site are logged. If you
10784: 230-do not like this, please disconnect now.
10785: 230-
10786: 230-This arhive is available via
10787: 230-
10788: 230-HTTP: http://ftp.plig.org/
10789: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
10790: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
10791: 230-
10792: 230-Please email comments, bug reports and requests for packages to be
10793: 230-mirrored to ftp-admin@plig.org.
10794: 230-
10795: 230-
10796: 230 Logged in anonymously.
10797: Remote system type is UNIX.
10798: Using binary mode to transfer files.
10799: 200 Type okay.
10800: 250 "/pub" is new cwd.
10801: 250-"/pub/figlet" is new cwd.
10802: 250-
10803: 250-Welcome to the figlet archive at ftp.figlet.org
10804: 250-
10805: 250- ftp://ftp.figlet.org/pub/figlet/
10806: 250-
10807: 250-The official FIGlet web page is:
10808: 250- http://www.figlet.org/
10809: 250-
10810: 250-If you have questions, please mailto:info@figlet.org. If you want to
10811: 250-contribute a font or something else, you can email us.
10812: 250
10813: 250 "/pub/figlet/program" is new cwd.
10814: 250 "/pub/figlet/program/unix" is new cwd.
10815: local: figlet221.tar.gz remote: figlet221.tar.gz
10816: 502 Unimplemented command.
10817: 227 Entering Passive Mode (195,40,6,41,246,104)
10818: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
10819: 38% |************** | 65800 64.16 KB/s 00:01 ETA
10820: 226 Transfer completed.
10821: 172219 bytes received in 00:02 (75.99 KB/s)
10822: 221 Goodbye.
10823: => Checksum OK for figlet221.tar.gz.
10824: ===> Extracting for figlet-2.2.1nb2
10825: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
10826: ===> Patching for figlet-2.2.1nb2
10827: ===> Applying pkgsrc patches for figlet-2.2.1nb2
10828: ===> Overriding tools for figlet-2.2.1nb2
10829: ===> Creating toolchain wrappers for figlet-2.2.1nb2
10830: ===> Configuring for figlet-2.2.1nb2
10831: ===> Building for figlet-2.2.1nb2
10832: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
10833: chmod a+x figlet
10834: gcc -O2 -o chkfont chkfont.c
10835: => Unwrapping files-to-be-installed.
1.13 ! hubertf 10836: <tt class="prompt">#</tt>
! 10837: <tt class="prompt">#</tt> <b class=
! 10838: "userinput"><tt>make install</tt></b>
1.1 grant 10839: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10840: ===> Installing for figlet-2.2.1nb2
10841: install -d -o root -g wheel -m 755 /usr/pkg/bin
10842: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
10843: mkdir -p /usr/pkg/share/figlet
10844: cp figlet /usr/pkg/bin
10845: cp chkfont /usr/pkg/bin
10846: chmod 555 figlist showfigfonts
10847: cp figlist /usr/pkg/bin
10848: cp showfigfonts /usr/pkg/bin
10849: cp fonts/*.flf /usr/pkg/share/figlet
10850: cp fonts/*.flc /usr/pkg/share/figlet
10851: cp figlet.6 /usr/pkg/man/man6
10852: ===> Registering installation for figlet-2.2.1nb2
1.13 ! hubertf 10853: <tt class="prompt">#</tt>
1.1 grant 10854: </pre>
10855: </div>
10856:
10857: <div class="sect1" lang="en" xml:lang="en">
10858: <div class="titlepage">
10859: <div>
10860: <div>
10861: <h2 class="title" style="clear: both"><a name=
10862: "logs.package" id=
10863: "logs.package"></a>B.2. Packaging figlet</h2>
10864: </div>
10865: </div>
10866: </div>
10867: <pre class="screen">
1.13 ! hubertf 10868: <tt class="prompt">#</tt> <b class=
! 10869: "userinput"><tt>make package</tt></b>
1.1 grant 10870: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10871: ===> Packaging figlet-2.2.1nb2
10872: ===> Building binary package for figlet-2.2.1nb2
10873: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
10874: Using SrcDir value of /usr/pkg
10875: Registering depends:.
1.13 ! hubertf 10876: <tt class="prompt">#</tt>
1.1 grant 10877: </pre>
10878: </div>
10879: </div>
10880:
10881: <div class="appendix" lang="en" xml:lang="en">
10882: <div class="titlepage">
10883: <div>
10884: <div>
10885: <h2 class="title"><a name="ftp-layout" id=
10886: "ftp-layout"></a>Appendix C. Layout of the
10887: FTP server's package archive</h2>
10888: </div>
10889: </div>
10890: </div>
10891:
10892: <p>Layout for precompiled binary packages on
10893: ftp.NetBSD.org:</p>
10894: <pre class="programlisting">
10895: /pub/NetBSD/packages/
10896: distfiles/
10897:
10898: # Unpacked pkgsrc trees
10899: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
10900: pkgsrc-2003Q4 -> N/A
10901: pkgsrc-2004Q1/pkgsrc
10902:
10903: # pkgsrc archives
10904: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
10905: pkgsrc-2003Q4.tar.gz -> N/A
10906: pkgsrc-2004Q1.tar.gz -> N/A
10907:
10908: # Per pkgsrc-release/OS-release/arch package archives
10909: pkgsrc-2003Q4/
10910: NetBSD-1.6.2/
10911: i386/
10912: All/
10913: archivers/
10914: foo -> ../All/foo
10915: ...
10916: pkgsrc-2004Q1/
10917: NetBSD-1.6.2/
10918: i386/
10919: All/
10920: ...
10921: NetBSD-2.0/
10922: i386/
10923: All/
10924: ...
10925: SunOS-5.9/
10926: sparc/
10927: All/
10928: ...
10929: x86/
10930: All/
10931: ...
10932:
10933: # Per os-release package archive convenience links
10934: NetBSD-1.6.2 -> 1.6.2
10935: 1.6.2/
10936: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
10937: m68k/
10938: All/
10939: archivers/
10940: foo -> ../All/foo
10941: ...
10942: amiga -> m68k
10943: atari -> m68k
10944: ...
10945:
10946: 2.0 -> NetBSD-2.0 # backward compat, historic
10947: NetBSD-2.0/
10948: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
10949: SunOS-5.9/
10950: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
10951: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
10952:
10953: </pre>
10954:
10955: <p>To create:</p>
10956:
10957: <div class="orderedlist">
10958: <ol type="1">
10959: <li>
10960: <p>Run bulk build, see <a href="#bulkbuild" title=
10961: "5.3. Doing a bulk build of all packages">Section
10962: 5.3, “Doing a bulk build of all
10963: packages”</a></p>
10964: </li>
10965:
10966: <li>
10967: <p>Upload /usr/pkgsrc/packages to</p>
10968: <pre class="programlisting">
10969: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13 ! hubertf 10970: pkgsrc-2004Q4/\ # pkgsrc-branch
1.1 grant 10971: `uname -s`-`uname -r`/ # OS & version
10972: `uname -p` # architecture
10973:
10974: </pre>
10975: </li>
10976:
10977: <li>
1.13 ! hubertf 10978: <p>If necessary, create a symlink <span><b class=
! 10979: "command">ln -s `uname -m` `uname -p`</b></span> (amiga
! 10980: -> m68k, ...)</p>
1.1 grant 10981: </li>
10982: </ol>
10983: </div>
10984: </div>
1.2 hubertf 10985:
10986: <div class="appendix" lang="en" xml:lang="en">
10987: <div class="titlepage">
10988: <div>
10989: <div>
10990: <h2 class="title"><a name="editing" id=
10991: "editing"></a>Appendix D. Editing guidelines
10992: for the pkgsrc guide</h2>
10993: </div>
10994: </div>
10995: </div>
10996:
10997: <div class="toc">
10998: <p><b>Table of Contents</b></p>
10999:
11000: <dl>
1.13 ! hubertf 11001: <dt><span class="sect1"><a href="#id2576133">D.1.
1.2 hubertf 11002: Targets</a></span></dt>
11003:
1.13 ! hubertf 11004: <dt><span class="sect1"><a href="#id2576408">D.2.
1.2 hubertf 11005: Procedure</a></span></dt>
11006: </dl>
11007: </div>
11008:
11009: <p>This section contains information on editing the pkgsrc
11010: guide itself.</p>
11011:
11012: <div class="sect1" lang="en" xml:lang="en">
11013: <div class="titlepage">
11014: <div>
11015: <div>
11016: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 11017: "id2576133" id="id2576133"></a>D.1. Targets</h2>
1.2 hubertf 11018: </div>
11019: </div>
11020: </div>
11021:
1.13 ! hubertf 11022: <p>The pkgsrc guide's source code is stored in <tt class=
! 11023: "filename">pkgsrc/doc/guide/files</tt>, and several files
1.2 hubertf 11024: are created from it:</p>
11025:
11026: <div class="itemizedlist">
11027: <ul type="disc">
11028: <li>
1.13 ! hubertf 11029: <p><tt class="filename">pkgsrc/doc/pkgsrc.txt</tt>,
! 11030: which replaces <tt class=
! 11031: "filename">pkgsrc/Packages.txt</tt></p>
1.2 hubertf 11032: </li>
11033:
11034: <li>
1.13 ! hubertf 11035: <p><tt class=
! 11036: "filename">pkgsrc/doc/pkgsrc.html</tt></p>
1.2 hubertf 11037: </li>
11038:
11039: <li>
1.13 ! hubertf 11040: <p><tt class=
! 11041: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</tt>:
1.2 hubertf 11042: the documentation on the NetBSD website will be built
11043: from pkgsrc and kept up to date on the web server
11044: itself. This means you <span class=
11045: "emphasis"><em>must</em></span> make sure that your
11046: changes haven't broken the build!</p>
11047: </li>
1.6 hubertf 11048:
11049: <li>
1.13 ! hubertf 11050: <p><tt class=
! 11051: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</tt>:
1.6 hubertf 11052: PDF version of the pkgsrc guide.</p>
11053: </li>
11054:
11055: <li>
1.13 ! hubertf 11056: <p><tt class=
! 11057: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</tt>:
1.6 hubertf 11058: PostScript version of the pkgsrc guide.</p>
11059: </li>
1.2 hubertf 11060: </ul>
11061: </div>
11062: </div>
11063:
11064: <div class="sect1" lang="en" xml:lang="en">
11065: <div class="titlepage">
11066: <div>
11067: <div>
11068: <h2 class="title" style="clear: both"><a name=
1.13 ! hubertf 11069: "id2576408" id=
! 11070: "id2576408"></a>D.2. Procedure</h2>
1.2 hubertf 11071: </div>
11072: </div>
11073: </div>
11074:
11075: <p>The procedure to edit the pkgsrc guide is:</p>
11076:
11077: <div class="itemizedlist">
11078: <ul type="disc">
11079: <li>
1.6 hubertf 11080: <p>Make sure you have the packages needed to
11081: re-generate the pkgsrc guide (and other XML-based
11082: NetBSD documentation) installed. These are
1.11 ben 11083: “<span class="quote">netbsd-doc</span>”
1.6 hubertf 11084: for creating the ASCII- and HTML-version, and
11085: “<span class=
1.11 ben 11086: "quote">netbsd-doc-print</span>”for the
1.6 hubertf 11087: PostScript- and PDF version. You will need both
11088: packages installed, to make sure documentation is
11089: consistent across all formats. The packages can be
1.13 ! hubertf 11090: found in <tt class=
! 11091: "filename">pkgsrc/meta-pkgs/netbsd-doc</tt> and
! 11092: <tt class=
! 11093: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</tt>.</p>
1.6 hubertf 11094: </li>
11095:
11096: <li>
1.13 ! hubertf 11097: <p>Edit the XML file(s) in <tt class=
! 11098: "filename">pkgsrc/doc/guide/files</tt>.</p>
1.2 hubertf 11099: </li>
11100:
11101: <li>
1.13 ! hubertf 11102: <p>Run <span><b class="command">make extract
! 11103: && make do-lint</b></span> in <tt class=
! 11104: "filename">pkgsrc/doc/guide</tt> to check the XML
! 11105: syntax, and fix it if needed.</p>
1.4 hubertf 11106: </li>
11107:
11108: <li>
1.13 ! hubertf 11109: <p>Run <span><b class="command">make</b></span> in
! 11110: <tt class="filename">pkgsrc/doc/guide</tt> to build
! 11111: the HTML and ASCII version.</p>
1.2 hubertf 11112: </li>
11113:
11114: <li>
1.13 ! hubertf 11115: <p>If all is well, run <span><b class="command">make
! 11116: install-doc</b></span> to put the generated files
! 11117: into <tt class="filename">pkgsrc/doc</tt>.</p>
1.2 hubertf 11118: </li>
11119:
11120: <li>
1.13 ! hubertf 11121: <p><span><b class="command">cvs commit
! 11122: pkgsrc/doc/guide/files</b></span></p>
1.2 hubertf 11123: </li>
11124:
11125: <li>
1.13 ! hubertf 11126: <p><span><b class="command">cvs commit -m re-generate
! 11127: pkgsrc/doc/pkgsrc.{html,txt}</b></span></p>
1.2 hubertf 11128: </li>
1.4 hubertf 11129:
11130: <li>
11131: <p>Until the webserver on www.NetBSD.org is really
11132: updated automatically to pick up changes to the
1.13 ! hubertf 11133: pkgsrc guide automatically, also run <span><b class=
! 11134: "command">make install-htdoc
! 11135: HTDOCSDIR=../../../htdocs</b></span> (or similar,
! 11136: adjust <tt class="varname">HTDOCSDIR</tt>!).</p>
1.4 hubertf 11137: </li>
11138:
11139: <li>
1.13 ! hubertf 11140: <p><span><b class="command">cvs commit
! 11141: htdocs/Documentation/pkgsrc</b></span></p>
1.4 hubertf 11142: </li>
1.2 hubertf 11143: </ul>
11144: </div>
11145: </div>
11146: </div>
1.1 grant 11147: </div>
11148: </body>
11149: </html>
CVSweb <webmaster@jp.NetBSD.org>