Annotation of pkgsrc/doc/pkgsrc.html, revision 1.4
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.2 hubertf 4: "HTML Tidy for NetBSD (vers 1st October 2003), see www.w3.org" />
1.1 grant 5: <meta http-equiv="Content-Type" content=
6: "text/html; charset=us-ascii" />
7:
8: <title>The pkgsrc guide</title>
9: <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
10: <meta name="generator" content=
11: "DocBook XSL Stylesheets V1.65.0" />
12: <meta name="description" content=
13: "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
14: </head>
15:
16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
17: alink="#0000FF">
18: <div class="book" lang="en" xml:lang="en">
19: <div class="titlepage">
20: <div>
21: <div>
1.2 hubertf 22: <h1 class="title"><a name="id2526935" id=
23: "id2526935"></a>The pkgsrc guide</h1>
1.1 grant 24: </div>
25:
26: <div>
1.2 hubertf 27: <h2 class="subtitle">Documentation on the NetBSD packages
1.1 grant 28: system</h2>
29: </div>
30:
31: <div>
32: <div class="authorgroup">
33: <div class="author">
34: <h3 class="author"><span class=
35: "firstname">Alistair</span> <span class=
36: "surname">Crooks</span></h3>
37:
38: <div class="affiliation">
39: <div class="address">
40: <p><tt class="email"><<a href=
41: "mailto:agc@NetBSD.org">agc@NetBSD.org</a>></tt></p>
42: </div>
43: </div>
44: </div>
45:
46: <div class="author">
47: <h3 class="author"><span class=
48: "firstname">Hubert</span> <span class=
49: "surname">Feyrer</span></h3>
50:
51: <div class="affiliation">
52: <div class="address">
53: <p><tt class="email"><<a href=
54: "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>></tt></p>
55: </div>
56: </div>
57: </div>
1.2 hubertf 58:
1.3 hubertf 59: <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1 grant 60: </div>
61: </div>
62:
63: <div>
64: <p class="copyright">Copyright © 1994-2004 The
65: NetBSD Foundation, Inc</p>
66: </div>
67:
68: <div>
1.3 hubertf 69: <p class="pubdate">$NetBSD: pkgsrc.xml,v 1.3 2004/10/22
70: 00:24:48 hubertf Exp $</p>
1.1 grant 71: </div>
72:
73: <div>
74: <div class="abstract">
75: <p class="title"><b>Abstract</b></p>
76:
77: <p>Information about using the NetBSD package system
78: (pkgsrc) from both a user view for installing packages
79: as well as from a pkgsrc developers' view for creating
80: new packages.</p>
81: </div>
82: </div>
83: </div>
84: <hr />
85: </div>
86:
87: <div class="toc">
88: <p><b>Table of Contents</b></p>
89:
90: <dl>
91: <dt><span class="chapter"><a href="#introduction">1.
92: Introduction</a></span></dt>
93:
94: <dd>
95: <dl>
1.2 hubertf 96: <dt><span class="sect1"><a href="#id2494406">1.1.
1.1 grant 97: Introduction</a></span></dt>
98:
99: <dt><span class="sect1"><a href="#overview">1.2.
100: Overview</a></span></dt>
101:
102: <dt><span class="sect1"><a href="#terminology">1.3.
103: Terminology</a></span></dt>
104:
105: <dt><span class="sect1"><a href="#typography">1.4.
106: Typography</a></span></dt>
107: </dl>
108: </dd>
109:
1.2 hubertf 110: <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1 grant 111: user's guide</a></span></dt>
112:
113: <dd>
114: <dl>
115: <dt><span class="chapter"><a href="#getting">2. Where
116: to get pkgsrc</a></span></dt>
117:
118: <dd>
119: <dl>
1.3 hubertf 120: <dt><span class="sect1"><a href="#id2495052">2.1.
1.1 grant 121: As tar file</a></span></dt>
122:
1.3 hubertf 123: <dt><span class="sect1"><a href="#id2495069">2.2.
1.1 grant 124: Via SUP</a></span></dt>
125:
1.3 hubertf 126: <dt><span class="sect1"><a href="#id2495101">2.3.
1.1 grant 127: Via CVS</a></span></dt>
128: </dl>
129: </dd>
130:
131: <dt><span class="chapter"><a href="#platforms">3. Using
132: pkgsrc on systems other than NetBSD</a></span></dt>
133:
134: <dd>
135: <dl>
1.3 hubertf 136: <dt><span class="sect1"><a href="#id2495211">3.1.
1.1 grant 137: Bootstrapping pkgsrc</a></span></dt>
138:
1.3 hubertf 139: <dt><span class="sect1"><a href="#id2495318">3.2.
1.1 grant 140: Platform specific notes</a></span></dt>
141:
142: <dd>
143: <dl>
144: <dt><span class="sect2"><a href=
1.3 hubertf 145: "#id2495324">3.2.1. Darwin (Mac OS
1.1 grant 146: X)</a></span></dt>
147:
148: <dt><span class="sect2"><a href=
1.3 hubertf 149: "#id2495623">3.2.2. FreeBSD</a></span></dt>
1.1 grant 150:
151: <dt><span class="sect2"><a href=
1.3 hubertf 152: "#id2496272">3.2.3. Interix</a></span></dt>
1.1 grant 153:
154: <dt><span class="sect2"><a href=
1.3 hubertf 155: "#id2496362">3.2.4. IRIX</a></span></dt>
1.1 grant 156:
157: <dt><span class="sect2"><a href=
1.3 hubertf 158: "#id2496480">3.2.5. OpenBSD</a></span></dt>
1.1 grant 159:
160: <dt><span class="sect2"><a href=
1.3 hubertf 161: "#id2496660">3.2.6. Solaris</a></span></dt>
1.1 grant 162: </dl>
163: </dd>
164: </dl>
165: </dd>
166:
167: <dt><span class="chapter"><a href="#using">4. Using
168: pkgsrc</a></span></dt>
169:
170: <dd>
171: <dl>
172: <dt><span class="sect1"><a href=
173: "#getting-started">4.1. Working with binary
174: packages</a></span></dt>
175:
176: <dd>
177: <dl>
178: <dt><span class="sect2"><a href=
1.3 hubertf 179: "#id2496865">4.1.1. Where to get binary
1.1 grant 180: packages</a></span></dt>
181:
182: <dt><span class="sect2"><a href=
1.3 hubertf 183: "#id2496905">4.1.2. How to use binary
1.1 grant 184: packages</a></span></dt>
185:
186: <dt><span class="sect2"><a href=
1.3 hubertf 187: "#id2497040">4.1.3. A word of
1.1 grant 188: warning</a></span></dt>
189: </dl>
190: </dd>
191:
1.3 hubertf 192: <dt><span class="sect1"><a href="#id2497051">4.2.
1.1 grant 193: Building packages from source</a></span></dt>
194:
195: <dd>
196: <dl>
197: <dt><span class="sect2"><a href=
1.3 hubertf 198: "#id2497129">4.2.1.
1.1 grant 199: Requirements</a></span></dt>
200:
201: <dt><span class="sect2"><a href=
1.3 hubertf 202: "#id2497149">4.2.2. Fetching
1.1 grant 203: distfiles</a></span></dt>
204:
205: <dt><span class="sect2"><a href=
1.3 hubertf 206: "#id2497202">4.2.3. How to build and
1.1 grant 207: install</a></span></dt>
208:
209: <dt><span class="sect2"><a href=
1.3 hubertf 210: "#id2498133">4.2.4. Selecting the
1.1 grant 211: compiler</a></span></dt>
212: </dl>
213: </dd>
214: </dl>
215: </dd>
216:
217: <dt><span class="chapter"><a href="#binary">5. Creating
218: binary packages</a></span></dt>
219:
220: <dd>
221: <dl>
1.3 hubertf 222: <dt><span class="sect1"><a href="#id2563004">5.1.
1.1 grant 223: Building a single binary package</a></span></dt>
224:
1.3 hubertf 225: <dt><span class="sect1"><a href="#id2563082">5.2.
1.1 grant 226: Settings for creation of binary
227: packages</a></span></dt>
228:
229: <dt><span class="sect1"><a href="#bulkbuild">5.3.
230: Doing a bulk build of all packages</a></span></dt>
231:
232: <dd>
233: <dl>
234: <dt><span class="sect2"><a href=
235: "#binary.configuration">5.3.1.
236: Configuration</a></span></dt>
237:
238: <dt><span class="sect2"><a href=
1.3 hubertf 239: "#id2563222">5.3.2. Other environmental
1.1 grant 240: considerations</a></span></dt>
241:
242: <dt><span class="sect2"><a href=
1.3 hubertf 243: "#id2563262">5.3.3. Operation</a></span></dt>
1.1 grant 244:
245: <dt><span class="sect2"><a href=
1.3 hubertf 246: "#id2563469">5.3.4. What it
1.1 grant 247: does</a></span></dt>
248:
249: <dt><span class="sect2"><a href=
1.3 hubertf 250: "#id2563526">5.3.5. Disk space
1.1 grant 251: requirements</a></span></dt>
252:
253: <dt><span class="sect2"><a href=
1.3 hubertf 254: "#id2563553">5.3.6. Setting up a sandbox for
1.1 grant 255: chroot'ed builds</a></span></dt>
256:
257: <dt><span class="sect2"><a href=
1.3 hubertf 258: "#id2563916">5.3.7. Building a partial set of
1.1 grant 259: packages</a></span></dt>
260: </dl>
261: </dd>
262:
1.3 hubertf 263: <dt><span class="sect1"><a href="#id2564027">5.4.
1.1 grant 264: Creating a multiple CD-ROM packages
265: collection</a></span></dt>
266:
267: <dd>
268: <dl>
269: <dt><span class="sect2"><a href=
1.3 hubertf 270: "#id2564042">5.4.1. Example of
1.1 grant 271: cdpack</a></span></dt>
272: </dl>
273: </dd>
274: </dl>
275: </dd>
276:
277: <dt><span class="chapter"><a href="#faq">6. Frequently
278: Asked Questions</a></span></dt>
279:
280: <dd>
281: <dl>
1.3 hubertf 282: <dt><span class="sect1"><a href="#id2564301">6.1.
1.1 grant 283: Is there a mailing list for pkg-related
284: discussion?</a></span></dt>
285:
1.3 hubertf 286: <dt><span class="sect1"><a href="#id2564331">6.2.
1.1 grant 287: Where's the pkgviews documentation?</a></span></dt>
288:
1.3 hubertf 289: <dt><span class="sect1"><a href="#id2564344">6.3.
1.1 grant 290: Utilities for package management
291: (pkgtools)</a></span></dt>
292:
1.3 hubertf 293: <dt><span class="sect1"><a href="#id2564501">6.4.
1.1 grant 294: How to use pkgsrc as non-root</a></span></dt>
295:
1.3 hubertf 296: <dt><span class="sect1"><a href="#id2564581">6.5.
1.1 grant 297: How can I install/use XFree86 from
298: pkgsrc?</a></span></dt>
299:
1.3 hubertf 300: <dt><span class="sect1"><a href="#id2564609">6.6.
1.1 grant 301: How can I install/use X.org from
302: pkgsrc?</a></span></dt>
303:
1.3 hubertf 304: <dt><span class="sect1"><a href="#id2564636">6.7.
1.1 grant 305: How to fetch files from behind a
306: firewall</a></span></dt>
307:
1.3 hubertf 308: <dt><span class="sect1"><a href="#id2564650">6.8.
1.1 grant 309: How do I tell make fetch to do passive
310: FTP?</a></span></dt>
311:
1.3 hubertf 312: <dt><span class="sect1"><a href="#id2564701">6.9.
1.1 grant 313: How to fetch all distfiles at once</a></span></dt>
314:
1.3 hubertf 315: <dt><span class="sect1"><a href="#id2564978">6.10.
1.1 grant 316: What does Don't know how to make
317: /usr/share/tmac/tmac.andoc mean?</a></span></dt>
318:
1.3 hubertf 319: <dt><span class="sect1"><a href="#id2565016">6.11.
1.1 grant 320: What does Could not find bsd.own.mk
321: mean?</a></span></dt>
322:
1.3 hubertf 323: <dt><span class="sect1"><a href="#id2565074">6.12.
1.1 grant 324: Using 'sudo' with pkgsrc</a></span></dt>
325:
326: <dt><span class="sect1"><a href="#faq.conf">6.13.
327: Configuration files handling and
328: placement</a></span></dt>
329:
330: <dt><span class="sect1"><a href=
331: "#audit-packages">6.14. Automated security
332: checks</a></span></dt>
333: </dl>
334: </dd>
335: </dl>
336: </dd>
337:
1.2 hubertf 338: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 339: pkgsrc developer's guide</a></span></dt>
340:
341: <dd>
342: <dl>
343: <dt><span class="chapter"><a href="#components">7.
344: Package components - files, directories and
345: contents</a></span></dt>
346:
347: <dd>
348: <dl>
349: <dt><span class="sect1"><a href=
350: "#components.Makefile">7.1.
351: Makefile</a></span></dt>
352:
353: <dt><span class="sect1"><a href=
354: "#components.distinfo">7.2.
355: distinfo</a></span></dt>
356:
357: <dt><span class="sect1"><a href=
358: "#components.patches">7.3.
359: patches/*</a></span></dt>
360:
1.3 hubertf 361: <dt><span class="sect1"><a href="#id2566249">7.4.
1.1 grant 362: Other mandatory files</a></span></dt>
363:
364: <dt><span class="sect1"><a href=
365: "#components.optional">7.5. Optional
366: files</a></span></dt>
367:
1.3 hubertf 368: <dt><span class="sect1"><a href="#id2566443">7.6.
1.1 grant 369: work*</a></span></dt>
370:
1.3 hubertf 371: <dt><span class="sect1"><a href="#id2566531">7.7.
1.1 grant 372: files/*</a></span></dt>
373: </dl>
374: </dd>
375:
376: <dt><span class="chapter"><a href="#plist">8. PLIST
377: issues</a></span></dt>
378:
379: <dd>
380: <dl>
1.3 hubertf 381: <dt><span class="sect1"><a href="#id2566585">8.1.
1.1 grant 382: RCS ID</a></span></dt>
383:
1.3 hubertf 384: <dt><span class="sect1"><a href="#id2566600">8.2.
1.1 grant 385: Semi-automatic PLIST generation</a></span></dt>
386:
387: <dt><span class="sect1"><a href="#print-PLIST">8.3.
388: Tweaking output of make print-PLIST</a></span></dt>
389:
390: <dt><span class="sect1"><a href="#plist.misc">8.4.
391: Variable substitution in PLIST</a></span></dt>
392:
1.3 hubertf 393: <dt><span class="sect1"><a href="#id2566921">8.5.
1.1 grant 394: Manpage-compression</a></span></dt>
395:
1.3 hubertf 396: <dt><span class="sect1"><a href="#id2566963">8.6.
1.1 grant 397: Changing PLIST source with
398: PLIST_SRC</a></span></dt>
399:
1.3 hubertf 400: <dt><span class="sect1"><a href="#id2566980">8.7.
1.1 grant 401: Platform specific and differing
402: PLISTs</a></span></dt>
403:
404: <dt><span class="sect1"><a href=
405: "#faq.common-dirs">8.8. Sharing directories between
406: packages</a></span></dt>
407: </dl>
408: </dd>
409:
410: <dt><span class="chapter"><a href="#buildlink">9.
411: Buildlink methodology</a></span></dt>
412:
413: <dd>
414: <dl>
1.3 hubertf 415: <dt><span class="sect1"><a href="#id2567252">9.1.
1.1 grant 416: Converting packages to use
417: buildlink3</a></span></dt>
418:
1.3 hubertf 419: <dt><span class="sect1"><a href="#id2567579">9.2.
1.1 grant 420: Writing buildlink3.mk files</a></span></dt>
421:
422: <dd>
423: <dl>
424: <dt><span class="sect2"><a href=
1.3 hubertf 425: "#id2567717">9.2.1. Anatomy of a buildlink3.mk
1.1 grant 426: file</a></span></dt>
427:
428: <dt><span class="sect2"><a href=
1.3 hubertf 429: "#id2568157">9.2.2. Updating
1.1 grant 430: BUILDLINK_DEPENDS.pkg in buildlink3.mk
431: files</a></span></dt>
432: </dl>
433: </dd>
434:
1.3 hubertf 435: <dt><span class="sect1"><a href="#id2568236">9.3.
1.1 grant 436: Writing builtin.mk files</a></span></dt>
437:
438: <dd>
439: <dl>
440: <dt><span class="sect2"><a href=
1.3 hubertf 441: "#id2568386">9.3.1. Anatomy of a builtin.mk
1.1 grant 442: file</a></span></dt>
443:
444: <dt><span class="sect2"><a href=
1.3 hubertf 445: "#id2568613">9.3.2. Global preferences for
1.1 grant 446: native or pkgsrc software</a></span></dt>
447: </dl>
448: </dd>
449: </dl>
450: </dd>
451:
452: <dt><span class="chapter"><a href="#options">10.
453: Options handling</a></span></dt>
454:
455: <dd>
456: <dl>
1.3 hubertf 457: <dt><span class="sect1"><a href="#id2568685">10.1.
1.1 grant 458: Global default options</a></span></dt>
459:
1.3 hubertf 460: <dt><span class="sect1"><a href="#id2568700">10.2.
1.1 grant 461: Converting packages to use
462: bsd.options.mk</a></span></dt>
463: </dl>
464: </dd>
465:
466: <dt><span class="chapter"><a href="#build">11. The
467: build process</a></span></dt>
468:
469: <dd>
470: <dl>
471: <dt><span class="sect1"><a href=
472: "#build.prefix">11.1. Program
473: location</a></span></dt>
474:
1.3 hubertf 475: <dt><span class="sect1"><a href="#id2569445">11.2.
1.1 grant 476: Main targets</a></span></dt>
477:
478: <dt><span class="sect1"><a href=
479: "#build.helpful-targets">11.3. Other helpful
480: targets</a></span></dt>
481: </dl>
482: </dd>
483:
484: <dt><span class="chapter"><a href="#fixes">12. Notes on
485: fixes for packages</a></span></dt>
486:
487: <dd>
488: <dl>
1.3 hubertf 489: <dt><span class="sect1"><a href="#id2570842">12.1.
1.1 grant 490: General operation</a></span></dt>
491:
492: <dd>
493: <dl>
494: <dt><span class="sect2"><a href=
1.3 hubertf 495: "#id2570845">12.1.1. How to pull in variables
1.1 grant 496: from /etc/mk.conf</a></span></dt>
497:
498: <dt><span class="sect2"><a href=
1.3 hubertf 499: "#id2570929">12.1.2. Restricted
1.1 grant 500: packages</a></span></dt>
501:
502: <dt><span class="sect2"><a href=
503: "#dependencies">12.1.3. Handling
504: dependencies</a></span></dt>
505:
506: <dt><span class="sect2"><a href=
1.3 hubertf 507: "#id2571444">12.1.4. Handling conflicts with
1.1 grant 508: other packages</a></span></dt>
509:
510: <dt><span class="sect2"><a href=
1.3 hubertf 511: "#id2571494">12.1.5. Packages that cannot or
1.1 grant 512: should not be built</a></span></dt>
513:
514: <dt><span class="sect2"><a href=
1.3 hubertf 515: "#id2571520">12.1.6. Packages which should not
1.1 grant 516: be deleted, once installed</a></span></dt>
517:
518: <dt><span class="sect2"><a href=
519: "#security-handling">12.1.7. Handling packages
520: with security problems</a></span></dt>
521:
522: <dt><span class="sect2"><a href=
1.3 hubertf 523: "#id2571611">12.1.8. How to handle compiler
1.1 grant 524: bugs</a></span></dt>
525:
526: <dt><span class="sect2"><a href=
1.3 hubertf 527: "#id2571634">12.1.9. How to handle incrementing
1.1 grant 528: versions when fixing an existing
529: package</a></span></dt>
530:
531: <dt><span class="sect2"><a href=
1.3 hubertf 532: "#id2571751">12.1.10. Portability of
1.1 grant 533: packages</a></span></dt>
534: </dl>
535: </dd>
536:
1.3 hubertf 537: <dt><span class="sect1"><a href="#id2571776">12.2.
1.1 grant 538: Possible downloading issues</a></span></dt>
539:
540: <dd>
541: <dl>
542: <dt><span class="sect2"><a href=
1.3 hubertf 543: "#id2571779">12.2.1. Packages whose distfiles
1.1 grant 544: aren't available for plain
545: downloading</a></span></dt>
546:
547: <dt><span class="sect2"><a href=
1.3 hubertf 548: "#id2571978">12.2.2. How to handle modified
1.1 grant 549: distfiles with the 'old' name</a></span></dt>
550: </dl>
551: </dd>
552:
1.3 hubertf 553: <dt><span class="sect1"><a href="#id2571990">12.3.
1.1 grant 554: Configuration gotchas</a></span></dt>
555:
556: <dd>
557: <dl>
558: <dt><span class="sect2"><a href=
559: "#fixes.libtool">12.3.1. Shared libraries -
560: libtool</a></span></dt>
561:
562: <dt><span class="sect2"><a href=
1.3 hubertf 563: "#id2572397">12.3.2. Using libtool on GNU
1.1 grant 564: packages that already support
565: libtool</a></span></dt>
566:
567: <dt><span class="sect2"><a href=
1.3 hubertf 568: "#id2572482">12.3.3. GNU
1.1 grant 569: Autoconf/Automake</a></span></dt>
570: </dl>
571: </dd>
572:
1.3 hubertf 573: <dt><span class="sect1"><a href="#id2572526">12.4.
1.1 grant 574: Building considerations</a></span></dt>
575:
576: <dd>
577: <dl>
578: <dt><span class="sect2"><a href=
1.3 hubertf 579: "#id2572530">12.4.1. CPP
1.1 grant 580: defines</a></span></dt>
581: </dl>
582: </dd>
583:
1.3 hubertf 584: <dt><span class="sect1"><a href="#id2572560">12.5.
1.1 grant 585: Package specific actions</a></span></dt>
586:
587: <dd>
588: <dl>
589: <dt><span class="sect2"><a href=
1.3 hubertf 590: "#id2572563">12.5.1. Package configuration
1.1 grant 591: files</a></span></dt>
592:
593: <dt><span class="sect2"><a href=
1.3 hubertf 594: "#id2572733">12.5.2. User
1.2 hubertf 595: interaction</a></span></dt>
1.1 grant 596:
597: <dt><span class="sect2"><a href=
1.3 hubertf 598: "#id2572778">12.5.3. Handling
1.1 grant 599: licenses</a></span></dt>
600:
601: <dt><span class="sect2"><a href=
1.3 hubertf 602: "#id2572861">12.5.4. Creating an account from a
1.1 grant 603: package</a></span></dt>
604:
605: <dt><span class="sect2"><a href=
1.3 hubertf 606: "#id2572992">12.5.5. Installing score
1.1 grant 607: files</a></span></dt>
608:
609: <dt><span class="sect2"><a href=
1.3 hubertf 610: "#id2573035">12.5.6. Packages providing login
1.1 grant 611: shells</a></span></dt>
612:
613: <dt><span class="sect2"><a href=
1.3 hubertf 614: "#id2573161">12.5.7. Packages containing perl
1.1 grant 615: scripts</a></span></dt>
616:
617: <dt><span class="sect2"><a href=
1.3 hubertf 618: "#id2573248">12.5.8. Packages with hardcoded
1.1 grant 619: paths to other interpreters</a></span></dt>
620:
621: <dt><span class="sect2"><a href=
1.3 hubertf 622: "#id2573269">12.5.9. Packages installing perl
1.1 grant 623: modules</a></span></dt>
624:
625: <dt><span class="sect2"><a href=
626: "#faq.info-files">12.5.10. Packages installing
627: info files</a></span></dt>
628:
629: <dt><span class="sect2"><a href=
1.3 hubertf 630: "#id2573557">12.5.11. Packages installing
1.1 grant 631: GConf2 data files</a></span></dt>
632:
633: <dt><span class="sect2"><a href=
1.3 hubertf 634: "#id2573657">12.5.12. Packages installing
1.1 grant 635: scrollkeeper data files</a></span></dt>
636:
637: <dt><span class="sect2"><a href=
1.3 hubertf 638: "#id2573708">12.5.13. Packages installing X11
1.1 grant 639: fonts</a></span></dt>
640:
641: <dt><span class="sect2"><a href=
1.3 hubertf 642: "#id2573824">12.5.14. Packages installing GTK2
1.1 grant 643: modules</a></span></dt>
644:
645: <dt><span class="sect2"><a href=
1.3 hubertf 646: "#id2573893">12.5.15. Packages installing SGML
1.1 grant 647: or XML data</a></span></dt>
648:
649: <dt><span class="sect2"><a href=
1.3 hubertf 650: "#id2573945">12.5.16. Packages installing
1.1 grant 651: extensions to the MIME database</a></span></dt>
652:
653: <dt><span class="sect2"><a href=
1.3 hubertf 654: "#id2574016">12.5.17. Packages using
1.1 grant 655: intltool</a></span></dt>
656: </dl>
657: </dd>
658:
1.3 hubertf 659: <dt><span class="sect1"><a href="#id2574029">12.6.
1.1 grant 660: Feedback to the author</a></span></dt>
661: </dl>
662: </dd>
663:
664: <dt><span class="chapter"><a href="#debug">13.
665: Debugging</a></span></dt>
666:
667: <dt><span class="chapter"><a href="#submit">14.
668: Submitting and Committing</a></span></dt>
669:
670: <dd>
671: <dl>
1.3 hubertf 672: <dt><span class="sect1"><a href="#id2574491">14.1.
1.1 grant 673: Submitting your packages</a></span></dt>
674:
1.3 hubertf 675: <dt><span class="sect1"><a href="#id2574538">14.2.
1.1 grant 676: Committing: Importing a package into
677: CVS</a></span></dt>
678:
1.3 hubertf 679: <dt><span class="sect1"><a href="#id2574738">14.3.
1.2 hubertf 680: Updating a package to a newer
681: version</a></span></dt>
1.1 grant 682:
1.3 hubertf 683: <dt><span class="sect1"><a href="#id2574825">14.4.
1.2 hubertf 684: Moving a package in pkgsrc</a></span></dt>
1.1 grant 685: </dl>
686: </dd>
687: </dl>
688: </dd>
689:
690: <dt><span class="appendix"><a href="#examples">A. A simple
691: example package: bison</a></span></dt>
692:
693: <dd>
694: <dl>
1.3 hubertf 695: <dt><span class="sect1"><a href="#id2575051">A.1.
1.1 grant 696: files</a></span></dt>
697:
698: <dd>
699: <dl>
1.3 hubertf 700: <dt><span class="sect2"><a href="#id2575054">A.1.1.
1.1 grant 701: Makefile</a></span></dt>
702:
1.3 hubertf 703: <dt><span class="sect2"><a href="#id2575062">A.1.2.
1.1 grant 704: DESCR</a></span></dt>
705:
1.3 hubertf 706: <dt><span class="sect2"><a href="#id2575077">A.1.3.
1.1 grant 707: PLIST</a></span></dt>
708:
1.3 hubertf 709: <dt><span class="sect2"><a href="#id2575084">A.1.4.
1.1 grant 710: Checking a package with pkglint</a></span></dt>
711: </dl>
712: </dd>
713:
1.3 hubertf 714: <dt><span class="sect1"><a href="#id2575193">A.2. Steps
1.1 grant 715: for building, installing, packaging</a></span></dt>
716: </dl>
717: </dd>
718:
719: <dt><span class="appendix"><a href="#logs">B. Build
720: logs</a></span></dt>
721:
722: <dd>
723: <dl>
724: <dt><span class="sect1"><a href="#logs.building">B.1.
725: Building figlet</a></span></dt>
726:
727: <dt><span class="sect1"><a href="#logs.package">B.2.
728: Packaging figlet</a></span></dt>
729: </dl>
730: </dd>
731:
732: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
733: of the FTP server's package archive</a></span></dt>
1.2 hubertf 734:
735: <dt><span class="appendix"><a href="#editing">D. Editing
736: guidelines for the pkgsrc guide</a></span></dt>
737:
738: <dd>
739: <dl>
1.3 hubertf 740: <dt><span class="sect1"><a href="#id2575976">D.1.
1.2 hubertf 741: Targets</a></span></dt>
742:
1.3 hubertf 743: <dt><span class="sect1"><a href="#id2576025">D.2.
1.2 hubertf 744: Procedure</a></span></dt>
745: </dl>
746: </dd>
1.1 grant 747: </dl>
748: </div>
749:
750: <div class="chapter" lang="en" xml:lang="en">
751: <div class="titlepage">
752: <div>
753: <div>
754: <h2 class="title"><a name="introduction" id=
755: "introduction"></a>Chapter 1. Introduction</h2>
756: </div>
757: </div>
758: </div>
759:
760: <div class="toc">
761: <p><b>Table of Contents</b></p>
762:
763: <dl>
1.2 hubertf 764: <dt><span class="sect1"><a href="#id2494406">1.1.
1.1 grant 765: Introduction</a></span></dt>
766:
767: <dt><span class="sect1"><a href="#overview">1.2.
768: Overview</a></span></dt>
769:
770: <dt><span class="sect1"><a href="#terminology">1.3.
771: Terminology</a></span></dt>
772:
773: <dt><span class="sect1"><a href="#typography">1.4.
774: Typography</a></span></dt>
775: </dl>
776: </div>
777:
778: <div class="sect1" lang="en" xml:lang="en">
779: <div class="titlepage">
780: <div>
781: <div>
782: <h2 class="title" style="clear: both"><a name=
1.2 hubertf 783: "id2494406" id=
784: "id2494406"></a>1.1. Introduction</h2>
1.1 grant 785: </div>
786: </div>
787: </div>
788:
789: <p>There is a lot of software freely available for Unix
790: based systems, which usually runs on NetBSD and other
791: Unix-flavoured systems, too, sometimes with some
792: modifications. The NetBSD Packages Collection (pkgsrc)
793: incorporates any such changes necessary to make that
794: software run, and makes the installation (and
795: de-installation) of the software package easy by means of a
796: single command.</p>
797:
798: <p>Once the software has been built, it is manipulated with
799: the <span><b class="command">pkg_*</b></span> tools so that
800: installation and de-installation, printing of an inventory
801: of all installed packages and retrieval of one-line
802: comments or more verbose descriptions are all simple.</p>
803:
804: <p>pkgsrc currently contains several thousand packages,
805: including:</p>
806:
807: <div class="itemizedlist">
808: <ul type="disc">
809: <li>
810: <p><a xmlns=
811: "http://www.w3.org/TR/xhtml1/transitional" href=
812: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.2 hubertf 813: class="pkgname">www/apache</a> - The Apache web
814: server</p>
1.1 grant 815: </li>
816:
817: <li>
818: <p><a xmlns=
819: "http://www.w3.org/TR/xhtml1/transitional" href=
820: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.2 hubertf 821: class="pkgname">www/mozilla</a> - The Mozilla web
822: browser</p>
1.1 grant 823: </li>
824:
825: <li>
826: <p><a xmlns=
827: "http://www.w3.org/TR/xhtml1/transitional" href=
828: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.2 hubertf 829: class="pkgname">meta-pkgs/gnome</a> - The GNOME
830: Desktop Environment</p>
1.1 grant 831: </li>
832:
833: <li>
834: <p><a xmlns=
835: "http://www.w3.org/TR/xhtml1/transitional" href=
836: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.2 hubertf 837: class="pkgname">meta-pkgs/kde3</a> - The K Desktop
838: Environment</p>
1.1 grant 839: </li>
840: </ul>
841: </div>
842:
843: <p>...just to name a few.</p>
844:
845: <p>pkgsrc has built-in support for handling varying
846: dependencies, such as pthreads and X11, and extended
847: features such as IPv6 support on a range of platforms.</p>
848:
849: <p>pkgsrc was derived from FreeBSD's ports system, and
850: initially developed for NetBSD only. Since then, pkgsrc has
851: grown a lot, and now supports the following platforms:</p>
852:
853: <div class="itemizedlist">
854: <ul type="disc">
855: <li>
856: <p><a href="http://developer.apple.com/darwin/"
857: target="_top">Darwin</a> (<a href=
858: "http://www.apple.com/macosx/" target="_top">Mac OS
859: X</a>)</p>
860: </li>
861:
862: <li>
1.3 hubertf 863: <p><a href="http://www.DragonFlyBSD.org/" target=
864: "_top">DragonFlyBSD</a></p>
865: </li>
866:
867: <li>
1.1 grant 868: <p><a href="http://www.FreeBSD.org/" target=
869: "_top">FreeBSD</a></p>
870: </li>
871:
872: <li>
1.3 hubertf 873: <p>Microsoft Windows, via <a href=
874: "http://www.microsoft.com/windows/sfu/" target=
875: "_top">Interix</a></p>
1.1 grant 876: </li>
877:
878: <li>
879: <p><a href="http://www.sgi.com/software/irix6.5/"
880: target="_top">IRIX</a></p>
881: </li>
882:
883: <li>
884: <p><a href="http://www.linux.org/" target=
885: "_top">Linux</a></p>
886: </li>
887:
888: <li>
889: <p><a href="http://www.NetBSD.org/" target=
890: "_top">NetBSD</a> (of course)</p>
891: </li>
892:
893: <li>
894: <p><a href="http://www.openbsd.org/" target=
895: "_top">OpenBSD</a></p>
896: </li>
897:
898: <li>
899: <p><a href="http://www.sun.com/solaris/" target=
900: "_top">Solaris</a></p>
901: </li>
902: </ul>
903: </div>
904: </div>
905:
906: <div class="sect1" lang="en" xml:lang="en">
907: <div class="titlepage">
908: <div>
909: <div>
910: <h2 class="title" style="clear: both"><a name=
911: "overview" id="overview"></a>1.2. Overview</h2>
912: </div>
913: </div>
914: </div>
915:
916: <p>This document is divided into two parts. The first,
917: <a href="#users-guide" title=
1.2 hubertf 918: "Part I. The pkgsrc user's guide">The pkgsrc
919: user's guide</a>, describes how one can use one of the
920: packages in the Package Collection, either by installing a
921: precompiled binary package, or by building one's own copy
922: using the NetBSD package system. The second part, <a href=
1.1 grant 923: "#developers-guide" title=
1.2 hubertf 924: "Part II. The pkgsrc developer's guide">The
925: pkgsrc developer's guide</a>, explains how to prepare a
926: package so it can be easily built by other NetBSD users
927: without knowing about the package's building details.</p>
1.1 grant 928:
929: <p>This document is available in various formats:</p>
930:
931: <div class="itemizedlist">
932: <ul type="disc">
933: <li>
934: <p><a href="index.html" target="_top">HTML</a></p>
935: </li>
936:
937: <li>
938: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
939: </li>
940:
941: <li>
942: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
943: </li>
944:
945: <li>
946: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
947: </li>
948: </ul>
949: </div>
950: </div>
951:
952: <div class="sect1" lang="en" xml:lang="en">
953: <div class="titlepage">
954: <div>
955: <div>
956: <h2 class="title" style="clear: both"><a name=
957: "terminology" id=
958: "terminology"></a>1.3. Terminology</h2>
959: </div>
960: </div>
961: </div>
962:
963: <p>There has been a lot of talk about “<span class=
964: "quote">ports</span>”, “<span class=
965: "quote">packages</span>”, etc. so far. Here is a
966: description of all the terminology used within this
967: document.</p>
968:
969: <div class="variablelist">
970: <dl>
971: <dt><span class="term">Package</span></dt>
972:
973: <dd>
974: <p>A set of files and building instructions that
975: describe what's necessary to build a certain piece of
976: software using pkgsrc. Packages are traditionally
977: stored under <tt class=
978: "filename">/usr/pkgsrc</tt>.</p>
979: </dd>
980:
981: <dt><span class="term">The NetBSD package
982: system</span></dt>
983:
984: <dd>
985: <p>This is the former name of “<span class=
986: "quote">pkgsrc</span>”. It is part of the
987: NetBSD operating system and can be bootstrap to run
988: on non-NetBSD operating systems as well. It handles
989: building (compiling), installing, and removing of
990: packages.</p>
991: </dd>
992:
993: <dt><span class="term">Distfile</span></dt>
994:
995: <dd>
996: <p>This term describes the file or files that are
997: provided by the author of the piece of software to
998: distribute his work. All the changes necessary to
999: build on NetBSD are reflected in the corresponding
1000: package. Usually the distfile is in the form of a
1001: compressed tar-archive, but other types are possible,
1002: too. Distfiles are usually stored below <tt class=
1003: "filename">/usr/pkgsrc/distfiles</tt>.</p>
1004: </dd>
1005:
1006: <dt><span class="term">Port</span></dt>
1007:
1008: <dd>
1009: <p>This is the term used by FreeBSD and OpenBSD
1010: people for what we call a package. In NetBSD
1011: terminology, “<span class=
1012: "quote">port</span>” refers to a different
1013: architecture.</p>
1014: </dd>
1015:
1016: <dt><span class="term">Precompiled/binary
1017: package</span></dt>
1018:
1019: <dd>
1020: <p>A set of binaries built with pkgsrc from a
1021: distfile and stuffed together in a single <tt class=
1022: "filename">.tgz</tt> file so it can be installed on
1023: machines of the same machine architecture without the
1024: need to recompile. Packages are usually generated in
1025: <tt class="filename">/usr/pkgsrc/packages</tt>; there
1026: is also an archive on <a href=
1027: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1028: "_top">ftp.NetBSD.org</a>.</p>
1029:
1030: <p>Sometimes, this is referred to by the term
1031: “<span class="quote">package</span>” too,
1032: especially in the context of precompiled
1033: packages.</p>
1034: </dd>
1035:
1036: <dt><span class="term">Program</span></dt>
1037:
1038: <dd>
1039: <p>The piece of software to be installed which will
1040: be constructed from all the files in the Distfile by
1041: the actions defined in the corresponding package.</p>
1042: </dd>
1043: </dl>
1044: </div>
1045: </div>
1046:
1047: <div class="sect1" lang="en" xml:lang="en">
1048: <div class="titlepage">
1049: <div>
1050: <div>
1051: <h2 class="title" style="clear: both"><a name=
1052: "typography" id=
1053: "typography"></a>1.4. Typography</h2>
1054: </div>
1055: </div>
1056: </div>
1057:
1058: <p>When giving examples for commands, shell prompts are
1059: used to show if the command should/can be issued as root,
1060: or if “<span class="quote">normal</span>” user
1061: privileges are sufficient. We use a <tt class=
1062: "prompt">#</tt> for root's shell prompt, and a <tt class=
1063: "prompt">$</tt> for users' shell prompt, assuming they use
1064: the C-shell or tcsh.</p>
1065: </div>
1066: </div>
1067:
1068: <div class="part" lang="en" xml:lang="en">
1069: <div class="titlepage">
1070: <div>
1071: <div>
1072: <h1 class="title"><a name="users-guide" id=
1.2 hubertf 1073: "users-guide"></a>The pkgsrc user's guide</h1>
1.1 grant 1074: </div>
1075: </div>
1076: </div>
1077:
1078: <div class="toc">
1079: <p><b>Table of Contents</b></p>
1080:
1081: <dl>
1082: <dt><span class="chapter"><a href="#getting">2. Where to
1083: get pkgsrc</a></span></dt>
1084:
1085: <dd>
1086: <dl>
1.3 hubertf 1087: <dt><span class="sect1"><a href="#id2495052">2.1. As
1.1 grant 1088: tar file</a></span></dt>
1089:
1.3 hubertf 1090: <dt><span class="sect1"><a href="#id2495069">2.2. Via
1.1 grant 1091: SUP</a></span></dt>
1092:
1.3 hubertf 1093: <dt><span class="sect1"><a href="#id2495101">2.3. Via
1.1 grant 1094: CVS</a></span></dt>
1095: </dl>
1096: </dd>
1097:
1098: <dt><span class="chapter"><a href="#platforms">3. Using
1099: pkgsrc on systems other than NetBSD</a></span></dt>
1100:
1101: <dd>
1102: <dl>
1.3 hubertf 1103: <dt><span class="sect1"><a href="#id2495211">3.1.
1.1 grant 1104: Bootstrapping pkgsrc</a></span></dt>
1105:
1.3 hubertf 1106: <dt><span class="sect1"><a href="#id2495318">3.2.
1.1 grant 1107: Platform specific notes</a></span></dt>
1108:
1109: <dd>
1110: <dl>
1111: <dt><span class="sect2"><a href=
1.3 hubertf 1112: "#id2495324">3.2.1. Darwin (Mac OS
1.1 grant 1113: X)</a></span></dt>
1114:
1115: <dt><span class="sect2"><a href=
1.3 hubertf 1116: "#id2495623">3.2.2. FreeBSD</a></span></dt>
1.1 grant 1117:
1118: <dt><span class="sect2"><a href=
1.3 hubertf 1119: "#id2496272">3.2.3. Interix</a></span></dt>
1.1 grant 1120:
1121: <dt><span class="sect2"><a href=
1.3 hubertf 1122: "#id2496362">3.2.4. IRIX</a></span></dt>
1.1 grant 1123:
1124: <dt><span class="sect2"><a href=
1.3 hubertf 1125: "#id2496480">3.2.5. OpenBSD</a></span></dt>
1.1 grant 1126:
1127: <dt><span class="sect2"><a href=
1.3 hubertf 1128: "#id2496660">3.2.6. Solaris</a></span></dt>
1.1 grant 1129: </dl>
1130: </dd>
1131: </dl>
1132: </dd>
1133:
1134: <dt><span class="chapter"><a href="#using">4. Using
1135: pkgsrc</a></span></dt>
1136:
1137: <dd>
1138: <dl>
1139: <dt><span class="sect1"><a href=
1140: "#getting-started">4.1. Working with binary
1141: packages</a></span></dt>
1142:
1143: <dd>
1144: <dl>
1145: <dt><span class="sect2"><a href=
1.3 hubertf 1146: "#id2496865">4.1.1. Where to get binary
1.1 grant 1147: packages</a></span></dt>
1148:
1149: <dt><span class="sect2"><a href=
1.3 hubertf 1150: "#id2496905">4.1.2. How to use binary
1.1 grant 1151: packages</a></span></dt>
1152:
1153: <dt><span class="sect2"><a href=
1.3 hubertf 1154: "#id2497040">4.1.3. A word of
1.1 grant 1155: warning</a></span></dt>
1156: </dl>
1157: </dd>
1158:
1.3 hubertf 1159: <dt><span class="sect1"><a href="#id2497051">4.2.
1.1 grant 1160: Building packages from source</a></span></dt>
1161:
1162: <dd>
1163: <dl>
1164: <dt><span class="sect2"><a href=
1.3 hubertf 1165: "#id2497129">4.2.1. Requirements</a></span></dt>
1.1 grant 1166:
1167: <dt><span class="sect2"><a href=
1.3 hubertf 1168: "#id2497149">4.2.2. Fetching
1.1 grant 1169: distfiles</a></span></dt>
1170:
1171: <dt><span class="sect2"><a href=
1.3 hubertf 1172: "#id2497202">4.2.3. How to build and
1.1 grant 1173: install</a></span></dt>
1174:
1175: <dt><span class="sect2"><a href=
1.3 hubertf 1176: "#id2498133">4.2.4. Selecting the
1.1 grant 1177: compiler</a></span></dt>
1178: </dl>
1179: </dd>
1180: </dl>
1181: </dd>
1182:
1183: <dt><span class="chapter"><a href="#binary">5. Creating
1184: binary packages</a></span></dt>
1185:
1186: <dd>
1187: <dl>
1.3 hubertf 1188: <dt><span class="sect1"><a href="#id2563004">5.1.
1.1 grant 1189: Building a single binary package</a></span></dt>
1190:
1.3 hubertf 1191: <dt><span class="sect1"><a href="#id2563082">5.2.
1.1 grant 1192: Settings for creation of binary
1193: packages</a></span></dt>
1194:
1195: <dt><span class="sect1"><a href="#bulkbuild">5.3.
1196: Doing a bulk build of all packages</a></span></dt>
1197:
1198: <dd>
1199: <dl>
1200: <dt><span class="sect2"><a href=
1201: "#binary.configuration">5.3.1.
1202: Configuration</a></span></dt>
1203:
1204: <dt><span class="sect2"><a href=
1.3 hubertf 1205: "#id2563222">5.3.2. Other environmental
1.1 grant 1206: considerations</a></span></dt>
1207:
1208: <dt><span class="sect2"><a href=
1.3 hubertf 1209: "#id2563262">5.3.3. Operation</a></span></dt>
1.1 grant 1210:
1211: <dt><span class="sect2"><a href=
1.3 hubertf 1212: "#id2563469">5.3.4. What it does</a></span></dt>
1.1 grant 1213:
1214: <dt><span class="sect2"><a href=
1.3 hubertf 1215: "#id2563526">5.3.5. Disk space
1.1 grant 1216: requirements</a></span></dt>
1217:
1218: <dt><span class="sect2"><a href=
1.3 hubertf 1219: "#id2563553">5.3.6. Setting up a sandbox for
1.1 grant 1220: chroot'ed builds</a></span></dt>
1221:
1222: <dt><span class="sect2"><a href=
1.3 hubertf 1223: "#id2563916">5.3.7. Building a partial set of
1.1 grant 1224: packages</a></span></dt>
1225: </dl>
1226: </dd>
1227:
1.3 hubertf 1228: <dt><span class="sect1"><a href="#id2564027">5.4.
1.1 grant 1229: Creating a multiple CD-ROM packages
1230: collection</a></span></dt>
1231:
1232: <dd>
1233: <dl>
1234: <dt><span class="sect2"><a href=
1.3 hubertf 1235: "#id2564042">5.4.1. Example of
1.1 grant 1236: cdpack</a></span></dt>
1237: </dl>
1238: </dd>
1239: </dl>
1240: </dd>
1241:
1242: <dt><span class="chapter"><a href="#faq">6. Frequently
1243: Asked Questions</a></span></dt>
1244:
1245: <dd>
1246: <dl>
1.3 hubertf 1247: <dt><span class="sect1"><a href="#id2564301">6.1. Is
1.1 grant 1248: there a mailing list for pkg-related
1249: discussion?</a></span></dt>
1250:
1.3 hubertf 1251: <dt><span class="sect1"><a href="#id2564331">6.2.
1.1 grant 1252: Where's the pkgviews documentation?</a></span></dt>
1253:
1.3 hubertf 1254: <dt><span class="sect1"><a href="#id2564344">6.3.
1.1 grant 1255: Utilities for package management
1256: (pkgtools)</a></span></dt>
1257:
1.3 hubertf 1258: <dt><span class="sect1"><a href="#id2564501">6.4. How
1.1 grant 1259: to use pkgsrc as non-root</a></span></dt>
1260:
1.3 hubertf 1261: <dt><span class="sect1"><a href="#id2564581">6.5. How
1.1 grant 1262: can I install/use XFree86 from
1263: pkgsrc?</a></span></dt>
1264:
1.3 hubertf 1265: <dt><span class="sect1"><a href="#id2564609">6.6. How
1.1 grant 1266: can I install/use X.org from pkgsrc?</a></span></dt>
1267:
1.3 hubertf 1268: <dt><span class="sect1"><a href="#id2564636">6.7. How
1.1 grant 1269: to fetch files from behind a firewall</a></span></dt>
1270:
1.3 hubertf 1271: <dt><span class="sect1"><a href="#id2564650">6.8. How
1.1 grant 1272: do I tell make fetch to do passive
1273: FTP?</a></span></dt>
1274:
1.3 hubertf 1275: <dt><span class="sect1"><a href="#id2564701">6.9. How
1.1 grant 1276: to fetch all distfiles at once</a></span></dt>
1277:
1.3 hubertf 1278: <dt><span class="sect1"><a href="#id2564978">6.10.
1.1 grant 1279: What does Don't know how to make
1280: /usr/share/tmac/tmac.andoc mean?</a></span></dt>
1281:
1.3 hubertf 1282: <dt><span class="sect1"><a href="#id2565016">6.11.
1.1 grant 1283: What does Could not find bsd.own.mk
1284: mean?</a></span></dt>
1285:
1.3 hubertf 1286: <dt><span class="sect1"><a href="#id2565074">6.12.
1.1 grant 1287: Using 'sudo' with pkgsrc</a></span></dt>
1288:
1289: <dt><span class="sect1"><a href="#faq.conf">6.13.
1290: Configuration files handling and
1291: placement</a></span></dt>
1292:
1293: <dt><span class="sect1"><a href=
1294: "#audit-packages">6.14. Automated security
1295: checks</a></span></dt>
1296: </dl>
1297: </dd>
1298: </dl>
1299: </div>
1300:
1301: <div class="chapter" lang="en" xml:lang="en">
1302: <div class="titlepage">
1303: <div>
1304: <div>
1305: <h2 class="title"><a name="getting" id=
1306: "getting"></a>Chapter 2. Where to get
1307: pkgsrc</h2>
1308: </div>
1309: </div>
1310: </div>
1311:
1312: <div class="toc">
1313: <p><b>Table of Contents</b></p>
1314:
1315: <dl>
1.3 hubertf 1316: <dt><span class="sect1"><a href="#id2495052">2.1. As
1.1 grant 1317: tar file</a></span></dt>
1318:
1.3 hubertf 1319: <dt><span class="sect1"><a href="#id2495069">2.2. Via
1.1 grant 1320: SUP</a></span></dt>
1321:
1.3 hubertf 1322: <dt><span class="sect1"><a href="#id2495101">2.3. Via
1.1 grant 1323: CVS</a></span></dt>
1324: </dl>
1325: </div>
1326:
1327: <p>There are three ways to get pkgsrc. Either as a tar
1328: file, via SUP, or via CVS. All three ways are described
1329: here.</p>
1330:
1331: <div class="sect1" lang="en" xml:lang="en">
1332: <div class="titlepage">
1333: <div>
1334: <div>
1335: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 1336: "id2495052" id="id2495052"></a>2.1. As tar
1.1 grant 1337: file</h2>
1338: </div>
1339: </div>
1340: </div>
1341:
1342: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1343: file from <a href=
1344: "ftp://ftp.NetBSD.org/pub/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.2 hubertf 1345: target="_top">ftp.NetBSD.org</a> and unpack it into
1346: <tt class="filename">/usr/pkgsrc</tt>.</p>
1.1 grant 1347: </div>
1348:
1349: <div class="sect1" lang="en" xml:lang="en">
1350: <div class="titlepage">
1351: <div>
1352: <div>
1353: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 1354: "id2495069" id="id2495069"></a>2.2. Via
1.1 grant 1355: SUP</h2>
1356: </div>
1357: </div>
1358: </div>
1359:
1360: <p>As an alternative to the tar file, you can get pkgsrc
1361: via the Software Update Protocol, SUP. To do so, make
1362: sure your supfile has a line</p>
1363: <pre class="programlisting">
1364: release=pkgsrc
1365: </pre>
1366:
1367: <p>in it, see the examples in <tt class=
1368: "filename">/usr/share/examples/supfiles</tt>, and that
1369: the <tt class="filename">/usr/pkgsrc</tt> directory
1370: exists. Then, simply run <span><b class="command">sup -v
1371: <i class=
1372: "replaceable"><tt>/path/to/your/supfile</tt></i></b></span>.</p>
1373: </div>
1374:
1375: <div class="sect1" lang="en" xml:lang="en">
1376: <div class="titlepage">
1377: <div>
1378: <div>
1379: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 1380: "id2495101" id="id2495101"></a>2.3. Via
1.1 grant 1381: CVS</h2>
1382: </div>
1383: </div>
1384: </div>
1385:
1386: <p>To get pkgsrc via CVS, make sure you have
1387: “<span class="quote">cvs</span>” installed.
1388: If not present on your system, it can be found as
1389: precompiled binary on ftp.NetBSD.org. To do an initial
1390: (full) checkout of pkgsrc, do the following steps:</p>
1391: <pre class="screen">
1392: <tt class="prompt">%</tt> <b class=
1393: "userinput"><tt>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</tt></b>
1394: <tt class="prompt">%</tt> <b class=
1395: "userinput"><tt>setenv CVS_RSH ssh</tt></b>
1396: <tt class="prompt">%</tt> <b class="userinput"><tt>cd /usr</tt></b>
1397: <tt class="prompt">%</tt> <b class=
1398: "userinput"><tt>cvs checkout -P pkgsrc</tt></b>
1399: </pre>
1400:
1401: <p>This will create the <tt class="filename">pkgsrc</tt>
1402: directory in your <tt class="filename">/usr</tt>, and all
1403: the package source will be stored under <tt class=
1404: "filename">/usr/pkgsrc</tt>. To update pkgsrc after the
1405: initial checkout, make sure you have <tt class=
1406: "varname">CVS_RSH</tt> set as above, then do:</p>
1407: <pre class="screen">
1408: <tt class="prompt">%</tt> <b class=
1409: "userinput"><tt>cd /usr/pkgsrc</tt></b>
1410: <tt class="prompt">%</tt> <b class=
1411: "userinput"><tt>cvs -q update -dP</tt></b>
1412: </pre>
1413:
1414: <p>Please also note that it is possible to have multiple
1415: copies of the pkgsrc hierarchy in use at any one time -
1416: all work is done relatively within the pkgsrc tree.</p>
1417: </div>
1418: </div>
1419:
1420: <div class="chapter" lang="en" xml:lang="en">
1421: <div class="titlepage">
1422: <div>
1423: <div>
1424: <h2 class="title"><a name="platforms" id=
1425: "platforms"></a>Chapter 3. Using pkgsrc on
1426: systems other than NetBSD</h2>
1427: </div>
1428: </div>
1429: </div>
1430:
1431: <div class="toc">
1432: <p><b>Table of Contents</b></p>
1433:
1434: <dl>
1.3 hubertf 1435: <dt><span class="sect1"><a href="#id2495211">3.1.
1.1 grant 1436: Bootstrapping pkgsrc</a></span></dt>
1437:
1.3 hubertf 1438: <dt><span class="sect1"><a href="#id2495318">3.2.
1.1 grant 1439: Platform specific notes</a></span></dt>
1440:
1441: <dd>
1442: <dl>
1.3 hubertf 1443: <dt><span class="sect2"><a href="#id2495324">3.2.1.
1.1 grant 1444: Darwin (Mac OS X)</a></span></dt>
1445:
1.3 hubertf 1446: <dt><span class="sect2"><a href="#id2495623">3.2.2.
1.1 grant 1447: FreeBSD</a></span></dt>
1448:
1.3 hubertf 1449: <dt><span class="sect2"><a href="#id2496272">3.2.3.
1.1 grant 1450: Interix</a></span></dt>
1451:
1.3 hubertf 1452: <dt><span class="sect2"><a href="#id2496362">3.2.4.
1.1 grant 1453: IRIX</a></span></dt>
1454:
1.3 hubertf 1455: <dt><span class="sect2"><a href="#id2496480">3.2.5.
1.1 grant 1456: OpenBSD</a></span></dt>
1457:
1.3 hubertf 1458: <dt><span class="sect2"><a href="#id2496660">3.2.6.
1.1 grant 1459: Solaris</a></span></dt>
1460: </dl>
1461: </dd>
1462: </dl>
1463: </div>
1464:
1465: <div class="sect1" lang="en" xml:lang="en">
1466: <div class="titlepage">
1467: <div>
1468: <div>
1469: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 1470: "id2495211" id=
1471: "id2495211"></a>3.1. Bootstrapping pkgsrc</h2>
1.1 grant 1472: </div>
1473: </div>
1474: </div>
1475:
1476: <p>For Operating Systems other than NetBSD, we provide a
1477: bootstrap kit to build the required tools to use pkgsrc
1478: on your platform. Besides support for native NetBSD,
1479: pkgsrc and the bootstrap kit have support for the
1480: following operating systems:</p>
1481:
1482: <div class="itemizedlist">
1483: <ul type="disc">
1484: <li>
1485: <p>Darwin (Mac OS X)</p>
1486: </li>
1487:
1488: <li>
1489: <p>FreeBSD</p>
1490: </li>
1491:
1492: <li>
1493: <p>Interix (Windows 2000, XP, 2003)</p>
1494: </li>
1495:
1496: <li>
1497: <p>IRIX</p>
1498: </li>
1499:
1500: <li>
1501: <p>Linux</p>
1502: </li>
1503:
1504: <li>
1505: <p>OpenBSD</p>
1506: </li>
1507:
1508: <li>
1509: <p>Solaris</p>
1510: </li>
1511: </ul>
1512: </div>
1513:
1514: <p>Support for other platforms is under development.</p>
1515:
1516: <p>Installing the bootstrap kit should be as simple
1517: as:</p>
1518: <pre class="screen">
1519: <tt class="prompt">#</tt> <b class=
1520: "userinput"><tt>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</tt></b>
1521: <tt class="prompt">#</tt> <b class=
1522: "userinput"><tt>cd pkgsrc/bootstrap</tt></b>
1523: <tt class="prompt">#</tt> <b class=
1524: "userinput"><tt>./bootstrap</tt></b>
1525: </pre>
1526:
1527: <p>See <a href="#getting" title=
1528: "Chapter 2. Where to get pkgsrc">Chapter 2,
1529: <i>Where to get pkgsrc</i></a> for other ways to get
1530: pkgsrc before bootstrapping. The given <span><b class=
1531: "command">bootstrap</b></span> command will use the
1532: defaults of <tt class="filename">/usr/pkg</tt> for the
1533: <span class="emphasis"><em>prefix</em></span> where
1534: programs will be installed in, and <tt class=
1535: "filename">/var/db/pkg</tt> for the package database
1536: directory where pkgsrc will do it's internal bookkeeping.
1537: However, these can also be set using command-line
1538: parameters.</p>
1539:
1540: <p>Binary packages for the pkgsrc tools and an initial
1541: set of packages is available for supported platforms. An
1542: up-to-date list of these can be found on <a href=
1543: "http://www.pkgsrc.org/" target=
1544: "_top">www.pkgsrc.org</a>.</p>
1545: </div>
1546:
1547: <div class="sect1" lang="en" xml:lang="en">
1548: <div class="titlepage">
1549: <div>
1550: <div>
1551: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 1552: "id2495318" id="id2495318"></a>3.2. Platform
1.1 grant 1553: specific notes</h2>
1554: </div>
1555: </div>
1556: </div>
1557:
1558: <p>Here are some platform-specific notes you should be
1559: aware of.</p>
1560:
1561: <div class="sect2" lang="en" xml:lang="en">
1562: <div class="titlepage">
1563: <div>
1564: <div>
1.3 hubertf 1565: <h3 class="title"><a name="id2495324" id=
1566: "id2495324"></a>3.2.1. Darwin (Mac OS
1.1 grant 1567: X)</h3>
1568: </div>
1569: </div>
1570: </div>
1571:
1572: <p>Darwin 5.x and 6.x are supported. There are two
1573: methods of using pkgsrc on Mac OS X, by using a
1574: <a href="#platform.osx-image" title=
1575: "3.2.1.1. Using a disk image">disk image</a>, or a
1576: <a href="#platform.osx-ufs" title=
1577: "3.2.1.2. Using a UFS partition">UFS
1578: partition</a>.</p>
1579:
1580: <p>Before you start, you will need to download and
1581: install the Mac OS X Developer Tools from Apple's
1582: Developer Connection. See <a href=
1583: "http://developer.apple.com/macosx/" target=
1584: "_top">http://developer.apple.com/macosx/</a> for
1585: details. Also, make sure you install X11 for Mac OS X
1586: and the X11 SDK from <a href=
1587: "http://www.apple.com/macosx/x11/download/" target=
1588: "_top">http://www.apple.com/macosx/x11/download/</a> if
1589: you intend to build packages that use the X11 Window
1590: System.</p>
1591:
1592: <p>If you already have a UFS partition, or have a spare
1593: partition that you can format as UFS, it is recommended
1594: to use that instead of the disk image. It'll be
1595: somewhat faster and will mount automatically at boot
1596: time, where you must manually mount a disk image.</p>
1597:
1598: <div class="note" style=
1599: "margin-left: 0.5in; margin-right: 0.5in;">
1600: <h3 class="title">Note</h3>
1601:
1602: <p>You cannot use a HFS+ file system for pkgsrc,
1603: because pkgsrc currently requires the filesystem to
1604: be case-sensitive, and HFS+ is not.</p>
1605: </div>
1606:
1607: <div class="sect3" lang="en" xml:lang="en">
1608: <div class="titlepage">
1609: <div>
1610: <div>
1611: <h4 class="title"><a name="platform.osx-image"
1612: id="platform.osx-image"></a>3.2.1.1. Using
1613: a disk image</h4>
1614: </div>
1615: </div>
1616: </div>
1617:
1618: <p>Create the disk image:</p>
1619: <pre class="screen">
1620: <tt class="prompt">#</tt> <b class=
1621: "userinput"><tt>cd pkgsrc/bootstrap</tt></b>
1622: <tt class="prompt">#</tt> <b class=
1623: "userinput"><tt>./ufsdiskimage create ~/Documents/NetBSD 512</tt></b> # megabytes - season to taste
1624: <tt class="prompt">#</tt> <b class=
1625: "userinput"><tt>./ufsdiskimage mount ~/Documents/NetBSD</tt></b>
1626: <tt class="prompt">#</tt> <b class=
1627: "userinput"><tt>sudo chown `id -u`:`id -g` /Volumes/NetBSD</tt></b>
1628: </pre>
1629:
1630: <p>That's it!</p>
1631: </div>
1632:
1633: <div class="sect3" lang="en" xml:lang="en">
1634: <div class="titlepage">
1635: <div>
1636: <div>
1637: <h4 class="title"><a name="platform.osx-ufs"
1638: id="platform.osx-ufs"></a>3.2.1.2. Using a
1639: UFS partition</h4>
1640: </div>
1641: </div>
1642: </div>
1643:
1644: <p>By default, <tt class="filename">/usr</tt> will be
1645: on your root file system, normally HFS+. It is
1646: possible to use the default <span class=
1647: "emphasis"><em>prefix</em></span> of <tt class=
1648: "filename">/usr/pkg</tt> by symlinking <tt class=
1649: "filename">/usr/pkg</tt> to a directory on a UFS file
1650: system. Obviously, another symlink is required if you
1651: want to place the package database directory outside
1652: the <span class="emphasis"><em>prefix</em></span>.
1653: e.g.</p>
1654: <pre class="screen">
1655: <tt class="prompt">#</tt> <b class=
1656: "userinput"><tt>./bootstrap --pkgdbdir=/usr/pkg/pkgdb --pkgsrcdir=/Volumes/ufs/pkgsrc</tt></b>
1657: </pre>
1658:
1659: <p>If you created your partitions at the time of
1660: installing Mac OS X and formatted the target
1661: partition as UFS, it should automatically mount on
1662: <tt class="filename">/Volumes/<volume
1663: name></tt> when the machine boots. If you are
1664: (re)formatting a partition as UFS, you need to ensure
1665: that the partition map correctly reflects
1666: “<span class="quote">Apple_UFS</span>”
1667: and not “<span class=
1668: "quote">Apple_HFS</span>”.</p>
1669:
1670: <p>The problem is that none of the disk tools will
1671: let you touch a disk that is booted from. You can
1672: unmount the partition, but even if you newfs it, the
1673: partition type will be incorrect and the automounter
1674: won't mount it. It can be mounted manually, but it
1675: won't appear in Finder.</p>
1676:
1677: <p>You'll need to boot off of the OS X Installation
1678: (User) CD. When the Installation program starts, go
1679: up to the menu and select Disk Utility. Now, you will
1680: be able to select the partition you want to be UFS,
1681: and Format it Apple UFS. Quit the Disk Utility, quit
1682: the installer which will reboot your machine. The new
1683: UFS file system will appear in Finder.</p>
1684:
1685: <p>Be aware that the permissions on the new file
1686: system will be writable by root only.</p>
1687:
1688: <p>This note is as of 10.2 (Jaguar) and applies to
1689: earlier versions. Hopefully Apple will fix Disk
1690: Utility in 10.3 (Panther).</p>
1691: </div>
1692: </div>
1693:
1694: <div class="sect2" lang="en" xml:lang="en">
1695: <div class="titlepage">
1696: <div>
1697: <div>
1.3 hubertf 1698: <h3 class="title"><a name="id2495623" id=
1699: "id2495623"></a>3.2.2. FreeBSD</h3>
1.1 grant 1700: </div>
1701: </div>
1702: </div>
1703:
1704: <p>FreeBSD 4.7 and 5.0 have been tested and are
1705: supported, other versions may work.</p>
1706:
1707: <p>Care should be taken so that the tools that this kit
1708: installs do not conflict with the FreeBSD userland
1709: tools. There are several steps:</p>
1710:
1711: <div class="orderedlist">
1712: <ol type="1">
1713: <li>
1714: <p>FreeBSD stores its ports pkg database in
1715: <tt class="filename">/var/db/pkg</tt>. It is
1716: therefore recommended that you choose a different
1717: location (e.g. <tt class=
1718: "filename">/usr/pkgdb</tt>) by using the
1719: --pkgdbdir option to the bootstrap script.</p>
1720: </li>
1721:
1722: <li>
1723: <p>If you do not intend to use the FreeBSD ports
1724: tools, it's probably a good idea to move them out
1725: of the way to avoid confusion, e.g.</p>
1726: <pre class="screen">
1727: <tt class="prompt">#</tt> <b class=
1728: "userinput"><tt>cd /usr/sbin</tt></b>
1729: <tt class="prompt">#</tt> <b class=
1730: "userinput"><tt>mv pkg_add pkg_add.orig</tt></b>
1731: <tt class="prompt">#</tt> <b class=
1732: "userinput"><tt>mv pkg_create pkg_create.orig</tt></b>
1733: <tt class="prompt">#</tt> <b class=
1734: "userinput"><tt>mv pkg_delete pkg_delete.orig</tt></b>
1735: <tt class="prompt">#</tt> <b class=
1736: "userinput"><tt>mv pkg_info pkg_info.orig</tt></b>
1737: </pre>
1738: </li>
1739:
1740: <li>
1741: <p>An example <tt class=
1742: "filename">/etc/mk.conf</tt> file will be placed
1743: in <tt class="filename">/etc/mk.conf.example</tt>
1744: file when you use the bootstrap script.</p>
1745: </li>
1746: </ol>
1747: </div>
1748: </div>
1749:
1750: <div class="sect2" lang="en" xml:lang="en">
1751: <div class="titlepage">
1752: <div>
1753: <div>
1.3 hubertf 1754: <h3 class="title"><a name="id2496272" id=
1755: "id2496272"></a>3.2.3. Interix</h3>
1.1 grant 1756: </div>
1757: </div>
1758: </div>
1759:
1760: <p>Interix is a POSIX compatible subsystem for the
1761: Windows NT kernel, providing a Unix-like environment
1762: with a tighter kernel integration than available with
1763: Cygwin. It is part of the Windows Services for Unix
1764: package, available for free for any licensed copy of
1765: Windows 2000, XP, or 2003. SFU can be downloaded from
1766: <a href="http://www.microsoft.com/windows/sfu/" target=
1767: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
1768:
1769: <p>Services for Unix 3.5, current as of this writing,
1770: has been tested. 3.0 or 3.1 may work, but are not
1771: officially supported. (The main difference in 3.0/3.1
1772: is lack of pthreads.)</p>
1773:
1774: <div class="sect3" lang="en" xml:lang="en">
1775: <div class="titlepage">
1776: <div>
1777: <div>
1778: <h4 class="title"><a name=
1779: "platform.interix-sfu-install" id=
1780: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 1781: installing Interix/SFU</h4>
1.1 grant 1782: </div>
1783: </div>
1784: </div>
1785:
1786: <p>At an absolute minimum, the following packages
1787: must be installed from the Windows Services for Unix
1788: 3.5 distribution in order to use pkgsrc:</p>
1789:
1790: <div class="itemizedlist">
1791: <ul type="disc">
1792: <li>
1793: <p>Utilities -> Base Utilities</p>
1794: </li>
1795:
1796: <li>
1797: <p>Interix GNU Components -> (all)</p>
1798: </li>
1799:
1800: <li>
1801: <p>Remote Connectivity</p>
1802: </li>
1803:
1804: <li>
1805: <p>Interix SDK</p>
1806: </li>
1807: </ul>
1808: </div>
1809:
1810: <p>When using pkgsrc on Interix, DO NOT install the
1811: Utilities subcomponent "UNIX Perl". That is Perl 5.6
1812: without shared module support, installed to
1813: /usr/local, and will only cause confusion. Instead,
1814: install Perl 5.8 from pkgsrc (or from a binary
1815: package).</p>
1816:
1817: <p>The Remote Connectivity subcomponent "Windows
1818: Remote Shell Service" does not need to be installed,
1819: but Remote Connectivity itself should be installed in
1820: order to have a working inetd.</p>
1821:
1822: <p>Finally, during installation you may be asked
1823: whether to enable setuid behavior for Interix
1824: programs, and whether to make pathnames default to
1825: case-sensitive. Setuid should be enabled, and
1826: case-sensitivity MUST be enabled. (Without
1827: case-sensitivity, a large number of packages
1828: including perl will not build.)</p>
1829: </div>
1830:
1831: <div class="sect3" lang="en" xml:lang="en">
1832: <div class="titlepage">
1833: <div>
1834: <div>
1835: <h4 class="title"><a name=
1836: "platform.interix-sfu-postinstall" id=
1837: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
1838: to do if Interix/SFU is already installed</h4>
1839: </div>
1840: </div>
1841: </div>
1842:
1843: <p>If SFU is already installed and you wish to alter
1844: these settings to work with pkgsrc, note the
1845: following things.</p>
1846:
1847: <div class="itemizedlist">
1848: <ul type="disc">
1849: <li>
1850: <p>To uninstall UNIX Perl, use Add/Remove
1851: Programs, select Microsoft Windows Services for
1852: UNIX, then click Change. In the installer,
1853: choose Add or Remove, then uncheck
1854: Utilities->UNIX Perl.</p>
1855: </li>
1856:
1857: <li>
1858: <p>To enable case-sensitivity for the
1859: filesystem, run REGEDIT.EXE, and change the
1860: following registry key:</p>
1861:
1862: <p>
1863: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
1864: Manager\kernel</p>
1865:
1866: <p>Set the DWORD value "obcaseinsensitive" to
1867: 0; then reboot.</p>
1868: </li>
1869:
1870: <li>
1871: <p>To enable setuid binaries (optional), run
1872: REGEDIT.EXE, and change the following registry
1873: key:</p>
1874:
1875: <p>
1876: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
1877: for UNIX</p>
1878:
1879: <p>Set the DWORD value "EnableSetuidBinaries"
1880: to 1; then reboot.</p>
1881: </li>
1882: </ul>
1883: </div>
1884: </div>
1885:
1886: <div class="sect3" lang="en" xml:lang="en">
1887: <div class="titlepage">
1888: <div>
1889: <div>
1890: <h4 class="title"><a name=
1891: "platform.interix-notes" id=
1892: "platform.interix-notes"></a>3.2.3.3. Important
1893: notes for using pkgsrc</h4>
1894: </div>
1895: </div>
1896: </div>
1897:
1898: <p>The package imanager (either the pkgsrc "su" user,
1899: or the user running "pkg_add") must be a member of
1900: the local Administrators group. Such a user must also
1901: be used to run the bootstrap. This is slightly
1902: relaxed from the normal pkgsrc requirement of
1903: "root".</p>
1904:
1905: <p>The package manager should use a umask of 002.
1906: "make install" will automatically complain if this is
1907: not the case. This ensures that directories written
1908: in /var/db/pkg are Administrators-group
1909: writeable.</p>
1910:
1911: <p>The popular Interix binary packages from
1912: http://www.interopsystems.com/ use an older version
1913: of pkgsrc's pkg_* tools. Ideally, these should NOT be
1914: used in conjunction with pkgsrc. If you choose to use
1915: them at the same time as the pkgsrc packages, ensure
1916: that you use the proper pkg_* tools for each type of
1917: binary package.</p>
1918: </div>
1919: </div>
1920:
1921: <div class="sect2" lang="en" xml:lang="en">
1922: <div class="titlepage">
1923: <div>
1924: <div>
1.3 hubertf 1925: <h3 class="title"><a name="id2496362" id=
1926: "id2496362"></a>3.2.4. IRIX</h3>
1.1 grant 1927: </div>
1928: </div>
1929: </div>
1930:
1931: <p>You will need a working C compiler, either gcc or
1932: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1933: the <tt class="varname">CC</tt> environment variable
1934: according to your preference. If you do not have a
1935: license for the MIPSpro compiler suite, you can
1936: download a gcc tardist file from <a href=
1937: "http://freeware.sgi.com/" target=
1938: "_top">http://freeware.sgi.com/</a>.</p>
1939:
1940: <p>Please note that you will need IRIX 6.5.17 or
1941: higher, as this is the earliest version of IRIX
1942: providing support for if_indextoname(3),
1943: if_nametoindex(3), etc.</p>
1944:
1945: <p>At this point in time, pkgsrc only supports one ABI.
1946: That is, you can not switch between the old 32-bit ABI,
1947: the new 32-bit ABI and the 64-bit ABI. If you start out
1948: using "abi=n32", that's what all your packages will be
1949: built with.</p>
1950:
1951: <p>Therefore, please make sure that you have no
1952: conflicting <tt class="varname">CFLAGS</tt> in your
1953: environment or the <tt class=
1954: "filename">/etc/mk.conf</tt>. Particularly, make sure
1955: that you do not try to link n32 object files with lib64
1956: or vice versa. Check your <tt class=
1957: "filename">/etc/compiler.defaults</tt>!</p>
1958:
1959: <p>If you have the actual pkgsrc tree mounted via NFS
1960: from a different host, please make sure to set
1961: <tt class="varname">WRKOBJDIR</tt> to a local
1962: directory, as it appears that IRIX linker occasionally
1963: runs into issues when trying to link over a network
1964: mounted filesystem.</p>
1965:
1966: <p>The bootstrapping process should set all the right
1967: options for programs such as imake(1), but you may want
1968: to set some options depending on your local setup.
1969: Please see <tt class=
1970: "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt> and, of
1971: course, your compilers man pages for details.</p>
1972: </div>
1973:
1974: <div class="sect2" lang="en" xml:lang="en">
1975: <div class="titlepage">
1976: <div>
1977: <div>
1.3 hubertf 1978: <h3 class="title"><a name="id2496480" id=
1979: "id2496480"></a>3.2.5. OpenBSD</h3>
1.1 grant 1980: </div>
1981: </div>
1982: </div>
1983:
1984: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
1985:
1986: <p>Care should be taken so that the tools that this kit
1987: installs do not conflict with the OpenBSD userland
1988: tools. There are several steps:</p>
1989:
1990: <div class="orderedlist">
1991: <ol type="1">
1992: <li>
1993: <p>OpenBSD stores its ports pkg database in
1994: <tt class="filename">/var/db/pkg</tt>. It is
1995: therefore recommended that you choose a different
1996: location (e.g. <tt class=
1997: "filename">/usr/pkgdb</tt>) by using the
1998: --pkgdbdir option to the bootstrap script.</p>
1999: </li>
2000:
2001: <li>
2002: <p>If you do not intend to use the OpenBSD ports
2003: tools, it's probably a good idea to move them out
2004: of the way to avoid confusion, e.g.</p>
2005: <pre class="screen">
2006: <tt class="prompt">#</tt> <b class=
2007: "userinput"><tt>cd /usr/sbin</tt></b>
2008: <tt class="prompt">#</tt> <b class=
2009: "userinput"><tt>mv pkg_add pkg_add.orig</tt></b>
2010: <tt class="prompt">#</tt> <b class=
2011: "userinput"><tt>mv pkg_create pkg_create.orig</tt></b>
2012: <tt class="prompt">#</tt> <b class=
2013: "userinput"><tt>mv pkg_delete pkg_delete.orig</tt></b>
2014: <tt class="prompt">#</tt> <b class=
2015: "userinput"><tt>mv pkg_info pkg_info.orig</tt></b>
2016: </pre>
2017: </li>
2018:
2019: <li>
2020: <p>An example <tt class=
2021: "filename">/etc/mk.conf</tt> file will be placed
2022: in <tt class="filename">/etc/mk.conf.example</tt>
2023: file when you use the bootstrap script. OpenBSD's
2024: make program uses <tt class=
2025: "filename">/etc/mk.conf</tt> as well. You can
2026: work around this by enclosing all the pkgsrc
2027: specific parts of the file with:</p>
2028: <pre class="programlisting">
2029: .ifdef BSD_PKG_MK
2030: # pkgsrc stuff, e.g. insert bsd.pkg.defaults.mk or similar here
2031: .else
2032: # OpenBSD stuff
2033: .endif
2034: </pre>
2035: </li>
2036: </ol>
2037: </div>
2038: </div>
2039:
2040: <div class="sect2" lang="en" xml:lang="en">
2041: <div class="titlepage">
2042: <div>
2043: <div>
1.3 hubertf 2044: <h3 class="title"><a name="id2496660" id=
2045: "id2496660"></a>3.2.6. Solaris</h3>
1.1 grant 2046: </div>
2047: </div>
2048: </div>
2049:
2050: <p>Solaris 2.6 through 9 are supported on both x86 and
2051: sparc. You will need a working C compiler. Both gcc
2052: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2053:
2054: <p>The following packages are required on Solaris 8 for
2055: the bootstrap process and to build packages.</p>
2056:
2057: <div class="itemizedlist">
2058: <ul type="disc">
2059: <li>
2060: <p>SUNWsprot</p>
2061: </li>
2062:
2063: <li>
2064: <p>SUNWarc</p>
2065: </li>
2066:
2067: <li>
2068: <p>SUNWbtool</p>
2069: </li>
2070:
2071: <li>
2072: <p>SUNWtoo</p>
2073: </li>
2074:
2075: <li>
2076: <p>SUNWlibm</p>
2077: </li>
2078: </ul>
2079: </div>
2080:
2081: <p>Please note the use of GNU binutils on Solaris is
2082: <span class="emphasis"><em>not</em></span>
2083: supported.</p>
2084:
2085: <div class="sect3" lang="en" xml:lang="en">
2086: <div class="titlepage">
2087: <div>
2088: <div>
1.3 hubertf 2089: <h4 class="title"><a name="id2496691" id=
2090: "id2496691"></a>3.2.6.1. If you are using
1.1 grant 2091: gcc</h4>
2092: </div>
2093: </div>
2094: </div>
2095:
2096: <p>It makes life much simpler if you only use the
2097: same gcc consistently for building all packages.</p>
2098:
2099: <p>It is recommended that an external gcc be used
2100: only for bootstrapping, then either build gcc from
2101: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2102: href=
2103: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.2 hubertf 2104: class="pkgname">lang/gcc</a> or install a binary
2105: gcc package, then remove gcc used during
2106: bootstrapping.</p>
1.1 grant 2107:
2108: <p>Binary packages of gcc can be found through
2109: <a href=
2110: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.2 hubertf 2111: target=
2112: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2113: </div>
2114:
2115: <div class="sect3" lang="en" xml:lang="en">
2116: <div class="titlepage">
2117: <div>
2118: <div>
1.3 hubertf 2119: <h4 class="title"><a name="id2496712" id=
2120: "id2496712"></a>3.2.6.2. If you are using
1.1 grant 2121: Sun WorkShop</h4>
2122: </div>
2123: </div>
2124: </div>
2125:
2126: <p>You will need at least the following packages
2127: installed (from WorkShop 5.0)</p>
2128:
2129: <div class="itemizedlist">
2130: <ul type="disc">
2131: <li>
2132: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2133: </li>
2134:
2135: <li>
2136: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2137: </li>
2138:
2139: <li>
2140: <p>SPROild - Sun WorkShop Incremental
2141: Linker</p>
2142: </li>
2143:
2144: <li>
2145: <p>SPROlang - Sun WorkShop Compilers common
2146: components</p>
2147: </li>
2148: </ul>
2149: </div>
2150:
2151: <p>You should set <tt class="varname">CC</tt>,
2152: <tt class="varname">CXX</tt> and optionally,
2153: <tt class="varname">CPP</tt> in <tt class=
2154: "filename">/etc/mk.conf</tt>, eg.</p>
2155: <pre class="programlisting">
2156: CC= cc
2157: CXX= CC
2158: CPP= /usr/ccs/lib/cpp
2159: </pre>
2160:
2161: <p>You may also want to build 64-bit binaries,
2162: eg.</p>
2163: <pre class="programlisting">
2164: CFLAGS= -xtarget=ultra -xarch=v9
2165: </pre>
2166:
2167: <p>Whichever compiler you use, please ensure the
2168: compiler tools and your $prefix are in your
2169: <tt class="varname">PATH</tt>. This includes
2170: <tt class="filename">/usr/ccs/{bin,lib}</tt> and eg.
2171: <tt class="filename">/usr/pkg/{bin,sbin}</tt>.</p>
2172: </div>
2173: </div>
2174: </div>
2175: </div>
2176:
2177: <div class="chapter" lang="en" xml:lang="en">
2178: <div class="titlepage">
2179: <div>
2180: <div>
2181: <h2 class="title"><a name="using" id=
2182: "using"></a>Chapter 4. Using pkgsrc</h2>
2183: </div>
2184: </div>
2185: </div>
2186:
2187: <div class="toc">
2188: <p><b>Table of Contents</b></p>
2189:
2190: <dl>
2191: <dt><span class="sect1"><a href="#getting-started">4.1.
2192: Working with binary packages</a></span></dt>
2193:
2194: <dd>
2195: <dl>
1.3 hubertf 2196: <dt><span class="sect2"><a href="#id2496865">4.1.1.
1.1 grant 2197: Where to get binary packages</a></span></dt>
2198:
1.3 hubertf 2199: <dt><span class="sect2"><a href="#id2496905">4.1.2.
1.1 grant 2200: How to use binary packages</a></span></dt>
2201:
1.3 hubertf 2202: <dt><span class="sect2"><a href="#id2497040">4.1.3.
1.1 grant 2203: A word of warning</a></span></dt>
2204: </dl>
2205: </dd>
2206:
1.3 hubertf 2207: <dt><span class="sect1"><a href="#id2497051">4.2.
1.1 grant 2208: Building packages from source</a></span></dt>
2209:
2210: <dd>
2211: <dl>
1.3 hubertf 2212: <dt><span class="sect2"><a href="#id2497129">4.2.1.
1.1 grant 2213: Requirements</a></span></dt>
2214:
1.3 hubertf 2215: <dt><span class="sect2"><a href="#id2497149">4.2.2.
1.1 grant 2216: Fetching distfiles</a></span></dt>
2217:
1.3 hubertf 2218: <dt><span class="sect2"><a href="#id2497202">4.2.3.
1.1 grant 2219: How to build and install</a></span></dt>
2220:
1.3 hubertf 2221: <dt><span class="sect2"><a href="#id2498133">4.2.4.
1.1 grant 2222: Selecting the compiler</a></span></dt>
2223: </dl>
2224: </dd>
2225: </dl>
2226: </div>
2227:
2228: <div class="sect1" lang="en" xml:lang="en">
2229: <div class="titlepage">
2230: <div>
2231: <div>
2232: <h2 class="title" style="clear: both"><a name=
2233: "getting-started" id=
2234: "getting-started"></a>4.1. Working with binary
2235: packages</h2>
2236: </div>
2237: </div>
2238: </div>
2239:
2240: <p>This section describes how to find, retrieve and
2241: install a precompiled binary package that someone else
2242: already prepared for your type of machine.</p>
2243:
2244: <div class="sect2" lang="en" xml:lang="en">
2245: <div class="titlepage">
2246: <div>
2247: <div>
1.3 hubertf 2248: <h3 class="title"><a name="id2496865" id=
2249: "id2496865"></a>4.1.1. Where to get binary
1.1 grant 2250: packages</h3>
2251: </div>
2252: </div>
2253: </div>
2254:
2255: <p>Precompiled packages are stored on ftp.NetBSD.org
2256: and its mirrors in the directory <tt class=
2257: "filename">/pub/NetBSD/packages</tt> for anonymous FTP
2258: access. Please pick the right subdirectory there as
2259: indicated by <span><b class="command">uname
2260: -p</b></span>. In that directory, there is a
2261: subdirectory for each category plus a subdirectory
2262: <tt class="filename">All</tt> which includes the actual
2263: binaries in <tt class="filename">.tgz</tt> files. The
2264: category subdirectories use symbolic links to those
2265: files (this is the same directory layout as in
2266: <tt class="filename">/usr/pkgsrc/packages</tt>).</p>
2267:
2268: <p>This same directory layout applies for CDROM
2269: distributions, only that the directory may be rooted
2270: somewhere else, probably somewhere below <tt class=
2271: "filename">/cdrom</tt>. Please consult your CDROMs
2272: documentation for the exact location.</p>
2273: </div>
2274:
2275: <div class="sect2" lang="en" xml:lang="en">
2276: <div class="titlepage">
2277: <div>
2278: <div>
1.3 hubertf 2279: <h3 class="title"><a name="id2496905" id=
2280: "id2496905"></a>4.1.2. How to use binary
1.1 grant 2281: packages</h3>
2282: </div>
2283: </div>
2284: </div>
2285:
2286: <p>If you have the files on a CDROM or downloaded them
2287: to your hard disk, youcan install them with the
2288: following command (be sure to<span><b class=
2289: "command">su</b></span> to root first):</p>
2290: <pre class="screen">
2291: <tt class="prompt">#</tt> <b class=
2292: "userinput"><tt>pkg_add /path/to/package.tgz</tt></b>
2293: </pre>
2294:
2295: <p>If you have FTP access and you don't want to
2296: download the packages via FTP prior to installation,
2297: you can do this automatically by giving <span><b class=
2298: "command">pkg_add</b></span> an FTP URL:</p>
2299: <pre class="screen">
2300: <tt class="prompt">#</tt> <b class=
2301: "userinput"><tt>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSvers>/<arch>/All/package.tgz</tt></b>
2302: </pre>
2303:
2304: <p>If there is any doubt, the uname utility can be used
2305: to determine the <OSvers>, and <arch> by
2306: running <span><b class="command">uname
2307: -rp</b></span>.</p>
2308:
2309: <p>Also note that any prerequisite packages needed to
2310: run the package in question will be installed, too,
2311: assuming they are present where you install from.</p>
2312:
2313: <p>After you've installed packages, be sure to have
2314: <tt class="filename">/usr/pkg/bin</tt> in your
2315: <tt class="varname">PATH</tt> so you can actually start
2316: the just installed program.</p>
2317: </div>
2318:
2319: <div class="sect2" lang="en" xml:lang="en">
2320: <div class="titlepage">
2321: <div>
2322: <div>
1.3 hubertf 2323: <h3 class="title"><a name="id2497040" id=
2324: "id2497040"></a>4.1.3. A word of
1.1 grant 2325: warning</h3>
2326: </div>
2327: </div>
2328: </div>
2329:
2330: <p>Please pay very careful attention to the warnings
2331: expressed in the <a href=
2332: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2333: <span class="citerefentry"><span class=
2334: "refentrytitle">pkg_add</span>(1)</span></a> manual
2335: page about the inherent dangers of installing binary
2336: packages which you did not create yourself, and the
2337: security holes that can be introduced onto your system
2338: by indiscriminate adding of such files.</p>
2339: </div>
2340: </div>
2341:
2342: <div class="sect1" lang="en" xml:lang="en">
2343: <div class="titlepage">
2344: <div>
2345: <div>
2346: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 2347: "id2497051" id="id2497051"></a>4.2. Building
1.1 grant 2348: packages from source</h2>
2349: </div>
2350: </div>
2351: </div>
2352:
2353: <p>This assumes that the package is already in pkgsrc. If
2354: it is not, see <a href="#developers-guide" title=
1.2 hubertf 2355: "Part II. The pkgsrc developer's guide">Part II,
2356: “The pkgsrc developer's guide”</a>.</p>
1.1 grant 2357:
2358: <div class="sect2" lang="en" xml:lang="en">
2359: <div class="titlepage">
2360: <div>
2361: <div>
1.3 hubertf 2362: <h3 class="title"><a name="id2497129" id=
2363: "id2497129"></a>4.2.1. Requirements</h3>
1.1 grant 2364: </div>
2365: </div>
2366: </div>
2367:
2368: <p>To build packages from source on a NetBSD system the
2369: “<span class="quote">comp</span>” and the
2370: “<span class="quote">text</span>”
2371: distribution sets must be installed. If you want to
2372: build X11 related packages the “<span class=
2373: "quote">xbase</span>” and “<span class=
2374: "quote">xcomp</span>” distribution sets are
2375: required, too.</p>
2376: </div>
2377:
2378: <div class="sect2" lang="en" xml:lang="en">
2379: <div class="titlepage">
2380: <div>
2381: <div>
1.3 hubertf 2382: <h3 class="title"><a name="id2497149" id=
2383: "id2497149"></a>4.2.2. Fetching
1.1 grant 2384: distfiles</h3>
2385: </div>
2386: </div>
2387: </div>
2388:
2389: <p>The distfile (i.e. the unmodified source) must exist
2390: on your system for the packages system to be able to
2391: build it. If it does not exist, pkgsrc will use
2392: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
2393: <span class="citerefentry"><span class=
2394: "refentrytitle">ftp</span>(1)</span></a> to fetch it
2395: automatically.</p>
2396:
2397: <p>You can overwrite some of the major distribution
2398: sites to fit to sites that are close to your own. Have
2399: a look at <tt class=
2400: "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt> to find
2401: some examples - in particular, look for the <tt class=
2402: "varname">MASTER_SORT</tt>, <tt class=
2403: "varname">MASTER_SORT_REGEX</tt> and <tt class=
2404: "varname">INET_COUNTRY</tt> definitions. This may save
2405: some of your bandwidth and time.</p>
2406:
2407: <p>You can change these settings either in your shell's
2408: environment, or, if you want to keep the settings, by
2409: editing the <tt class="filename">/etc/mk.conf</tt>
2410: file, and adding the definitions there.</p>
2411:
2412: <p>If you don't have a permanent Internet connection
2413: and you want to know which files to download,
2414: <span><b class="command">make fetch-list</b></span>
2415: will tell you what you'll need. Put these distfiles
2416: into <tt class=
2417: "filename">/usr/pkgsrc/distfiles</tt>.</p>
2418: </div>
2419:
2420: <div class="sect2" lang="en" xml:lang="en">
2421: <div class="titlepage">
2422: <div>
2423: <div>
1.3 hubertf 2424: <h3 class="title"><a name="id2497202" id=
2425: "id2497202"></a>4.2.3. How to build and
1.1 grant 2426: install</h3>
2427: </div>
2428: </div>
2429: </div>
2430:
2431: <p>Assuming that the distfile has been fetched (see
2432: previous section), become root and change into the
2433: relevant directory and running <span><b class=
2434: "command">make</b></span>. For example, type</p>
2435: <pre class="screen">
2436: <tt class="prompt">%</tt> <b class=
2437: "userinput"><tt>cd misc/figlet</tt></b>
2438: <tt class="prompt">%</tt> <b class="userinput"><tt>make</tt></b>
2439: </pre>
2440:
2441: <p>at the shell prompt to build the various components
2442: of the package, and</p>
2443: <pre class="screen">
2444: <tt class="prompt">#</tt> <b class=
2445: "userinput"><tt>make install</tt></b>
2446: </pre>
2447:
2448: <p>to install the various components into the correct
2449: places on your system. Installing the package on your
2450: system requires you to be root. However, pkgsrc has a
2451: <span class="emphasis"><em>just-in-time-su</em></span>
2452: feature, which allows you to only become root for the
2453: actual installation step</p>
2454:
2455: <p>Taking the figlet utility as an example, we can
2456: install it on our system by building as shown in
2457: <a href="#logs" title=
2458: "Appendix B. Build logs">Appendix B, <i>Build
2459: logs</i></a>.</p>
2460:
2461: <p>The program is installed under the default root of
2462: the packages tree - <tt class="filename">/usr/pkg</tt>.
2463: Should this not conform to your tastes, set the
2464: <tt class="varname">LOCALBASE</tt> variable in your
2465: environment, and it will use that value as the root of
2466: your packages tree. So, to use <tt class=
2467: "filename">/usr/local</tt>, set <tt class=
2468: "varname">LOCALBASE=/usr/local</tt> in your
2469: environment. Please note that you should use a
2470: directory which is dedicated to packages and not shared
2471: with other programs (ie, do not try and use <tt class=
2472: "varname">LOCALBASE=/usr</tt>). Also, you should not
2473: try to add any of your own files or directories (such
2474: as <tt class="filename">src/</tt>, <tt class=
2475: "filename">obj/</tt>, or <tt class=
2476: "filename">pkgsrc/</tt>) below the <tt class=
2477: "varname">LOCALBASE</tt> tree. This is to prevent
2478: possible conflicts between programs and other files
2479: installed by the package system and whatever else may
2480: have been installed there.</p>
2481:
2482: <p>Some packages look in <tt class=
2483: "filename">/etc/mk.conf</tt> to alter some
2484: configuration options at build time. Have a look at
2485: <tt class="filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt>
2486: to get an overview of what will be set there by
2487: default. Environment variables such as <tt class=
2488: "varname">LOCALBASE</tt> can be set in <tt class=
2489: "filename">/etc/mk.conf</tt> to save having to remember
2490: to set them each time you want to use pkgsrc.</p>
2491:
2492: <p>Occasionally, people want to “<span class=
2493: "quote">look under the covers</span>” to see what
2494: is going on when a package is building or being
2495: installed. This may be for debugging purposes, or out
2496: of simple curiosity. A number of utility values have
2497: been added to help with this.</p>
2498:
2499: <div class="orderedlist">
2500: <ol type="1">
2501: <li>
2502: <p>If you invoke the <a href=
2503: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2504: <span class="citerefentry"><span class=
2505: "refentrytitle">make</span>(1)</span></a> command
2506: with <tt class="varname">PKG_DEBUG_LEVEL=2</tt>,
2507: then a huge amount of information will be
2508: displayed. For example,</p>
2509: <pre class="screen">
2510: <b class="userinput"><tt>make patch PKG_DEBUG_LEVEL=2</tt></b>
2511: </pre>
2512:
2513: <p>will show all the commands that are invoked,
2514: up to and including the “<span class=
2515: "quote">patch</span>” stage.</p>
2516: </li>
2517:
2518: <li>
2519: <p>If you want to know the value of a certain
2520: make(1) definition, then the <tt class=
2521: "varname">VARNAME</tt> definition should be used,
2522: in conjunction with the show-var target. e.g. to
2523: show the expansion of the <a href=
2524: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2525: <span class="citerefentry"><span class=
2526: "refentrytitle">make</span>(1)</span></a>
2527: variable <tt class="varname">DISTFILES</tt>:</p>
2528: <pre class="screen">
2529: <tt class="prompt">%</tt> <b class=
2530: "userinput"><tt>make show-var VARNAME=LOCALBASE</tt></b>
2531: /usr/pkg
2532: <tt class="prompt">%</tt>
2533:
2534: </pre>
2535: </li>
2536: </ol>
2537: </div>
2538:
2539: <p>If you want to install a binary package that you've
2540: either created yourself (see next section), that you
2541: put into pkgsrc/packages manually or that is located on
2542: a remote FTP server, you can use the the "bin-install"
2543: target. This target will install a binary package - if
2544: available - via <a href=
2545: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2546: <span class="citerefentry"><span class=
2547: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
2548: <span><b class="command">make package</b></span>. The
2549: list of remote FTP sites searched is kept in the
2550: variable <tt class="varname">BINPKG_SITE</tt>, which
2551: defaults to ftp.NetBSD.org. Any flags that should be
2552: added to <a href=
2553: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2554: <span class="citerefentry"><span class=
2555: "refentrytitle">pkg_add</span>(1)</span></a> can be put
2556: into <tt class="varname">BIN_INSTALL_FLAGS</tt>. See
2557: <tt class="filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt>
2558: for more details.</p>
2559:
2560: <p>A final word of warning: If you setup a system that
2561: has a non-standard setting for <tt class=
2562: "varname">LOCALBASE</tt>, be sure to set that before
2563: any packages are installed, as you can not use several
2564: directories for the same purpose. Doing so will result
2565: in pkgsrc not being able to properly detect your
2566: installed packages, and fail miserably. Note also that
2567: precompiled binary packages are usually built with the
2568: default <tt class="varname">LOCALBASE</tt> of
2569: <tt class="filename">/usr/pkg</tt>, and that you should
2570: <span class="emphasis"><em>not</em></span> install any
2571: if you use a non-standard <tt class=
2572: "varname">LOCALBASE</tt>.</p>
2573: </div>
2574:
2575: <div class="sect2" lang="en" xml:lang="en">
2576: <div class="titlepage">
2577: <div>
2578: <div>
1.3 hubertf 2579: <h3 class="title"><a name="id2498133" id=
2580: "id2498133"></a>4.2.4. Selecting the
1.1 grant 2581: compiler</h3>
2582: </div>
2583: </div>
2584: </div>
2585:
2586: <p>By default, pkgsrc will use GCC to build packages.
2587: This may be overridden by setting the following
2588: variables in /etc/mk.conf:</p>
2589:
2590: <div class="variablelist">
2591: <dl>
2592: <dt><span class="term"><tt class=
2593: "varname">PKGSRC_COMPILER</tt>:</span></dt>
2594:
2595: <dd>
2596: <p>This is a list of values specifying the chain
2597: of compilers to invoke when building packages.
2598: Valid values are:</p>
2599:
2600: <div class="itemizedlist">
2601: <ul type="disc">
2602: <li>
2603: <p><tt class="varname">distcc</tt>:
2604: distributed C/C++ (chainable)</p>
2605: </li>
2606:
2607: <li>
2608: <p><tt class="varname">ccache</tt>:
2609: compiler cache (chainable)</p>
2610: </li>
2611:
2612: <li>
2613: <p><tt class="varname">gcc</tt>: GNU C/C++
2614: Compiler</p>
2615: </li>
2616:
2617: <li>
2618: <p><tt class="varname">mipspro</tt>:
2619: Silicon Graphics, Inc. MIPSpro
2620: (n32/n64)</p>
2621: </li>
2622:
2623: <li>
2624: <p><tt class="varname">mipspro</tt>:
2625: Silicon Graphics, Inc. MIPSpro (o32)</p>
2626: </li>
2627:
2628: <li>
2629: <p><tt class="varname">sunpro</tt>:
2630: Microsystems, Inc. WorkShip/Forte/Sun ONE
2631: Studio</p>
2632: </li>
2633: </ul>
2634: </div>
2635:
2636: <p>The default is “<span class=
2637: "quote"><tt class=
2638: "varname">gcc</tt></span>”. You can use
2639: <tt class="varname">ccache</tt> and/or <tt class=
2640: "varname">distcc</tt> with an appropriate
2641: <tt class="varname">PKGSRC_COMPILER</tt> setting,
2642: e.g. “<span class="quote"><tt class=
2643: "varname">ccache gcc</tt></span>”. This
2644: variable should always be terminated with a value
2645: for a real compiler.</p>
2646: </dd>
2647:
2648: <dt><span class="term"><tt class=
2649: "varname">GCC_REQD</tt>:</span></dt>
2650:
2651: <dd>
2652: <p>This specifies the minimum version of GCC to
2653: use when building packages. If the system GCC
2654: doesn't satisfy this requirement, then pkgsrc
2655: will build and install one of the GCC packages to
2656: use instead.</p>
2657: </dd>
2658: </dl>
2659: </div>
2660: </div>
2661: </div>
2662: </div>
2663:
2664: <div class="chapter" lang="en" xml:lang="en">
2665: <div class="titlepage">
2666: <div>
2667: <div>
2668: <h2 class="title"><a name="binary" id=
2669: "binary"></a>Chapter 5. Creating binary
2670: packages</h2>
2671: </div>
2672: </div>
2673: </div>
2674:
2675: <div class="toc">
2676: <p><b>Table of Contents</b></p>
2677:
2678: <dl>
1.3 hubertf 2679: <dt><span class="sect1"><a href="#id2563004">5.1.
1.1 grant 2680: Building a single binary package</a></span></dt>
2681:
1.3 hubertf 2682: <dt><span class="sect1"><a href="#id2563082">5.2.
1.1 grant 2683: Settings for creation of binary
2684: packages</a></span></dt>
2685:
2686: <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
2687: a bulk build of all packages</a></span></dt>
2688:
2689: <dd>
2690: <dl>
2691: <dt><span class="sect2"><a href=
2692: "#binary.configuration">5.3.1.
2693: Configuration</a></span></dt>
2694:
1.3 hubertf 2695: <dt><span class="sect2"><a href="#id2563222">5.3.2.
1.1 grant 2696: Other environmental considerations</a></span></dt>
2697:
1.3 hubertf 2698: <dt><span class="sect2"><a href="#id2563262">5.3.3.
1.1 grant 2699: Operation</a></span></dt>
2700:
1.3 hubertf 2701: <dt><span class="sect2"><a href="#id2563469">5.3.4.
1.1 grant 2702: What it does</a></span></dt>
2703:
1.3 hubertf 2704: <dt><span class="sect2"><a href="#id2563526">5.3.5.
1.1 grant 2705: Disk space requirements</a></span></dt>
2706:
1.3 hubertf 2707: <dt><span class="sect2"><a href="#id2563553">5.3.6.
1.1 grant 2708: Setting up a sandbox for chroot'ed
2709: builds</a></span></dt>
2710:
1.3 hubertf 2711: <dt><span class="sect2"><a href="#id2563916">5.3.7.
1.1 grant 2712: Building a partial set of packages</a></span></dt>
2713: </dl>
2714: </dd>
2715:
1.3 hubertf 2716: <dt><span class="sect1"><a href="#id2564027">5.4.
1.1 grant 2717: Creating a multiple CD-ROM packages
2718: collection</a></span></dt>
2719:
2720: <dd>
2721: <dl>
1.3 hubertf 2722: <dt><span class="sect2"><a href="#id2564042">5.4.1.
1.1 grant 2723: Example of cdpack</a></span></dt>
2724: </dl>
2725: </dd>
2726: </dl>
2727: </div>
2728:
2729: <div class="sect1" lang="en" xml:lang="en">
2730: <div class="titlepage">
2731: <div>
2732: <div>
2733: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 2734: "id2563004" id="id2563004"></a>5.1. Building a
1.1 grant 2735: single binary package</h2>
2736: </div>
2737: </div>
2738: </div>
2739:
2740: <p>Once you have built and installed a package, you can
2741: create a <span class="emphasis"><em>binary
2742: package</em></span> which can be installed on another
2743: system with <a href=
2744: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2745: <span class="citerefentry"><span class=
2746: "refentrytitle">pkg_add</span>(1)</span></a> This saves
2747: having to build the same package on a group of hosts and
2748: wasting CPU time. It also provides a simple means for
2749: others to install your package, should you distribute
2750: it.</p>
2751:
2752: <p>To create a binary package, change into the
2753: appropriate directory in pkgsrc, and run <span><b class=
2754: "command">make package</b></span>:</p>
2755: <pre class="screen">
2756: <tt class="prompt">#</tt> <b class=
2757: "userinput"><tt>cd misc/figlet</tt></b>
2758: <tt class="prompt">#</tt> <b class=
2759: "userinput"><tt>make package</tt></b>
2760: </pre>
2761:
2762: <p>This will build and install your package (if not
2763: already done), and then build a binary package from what
2764: was installed. You can then use the <span><b class=
2765: "command">pkg_*</b></span> tools to manipulate it. Binary
2766: packages are created by default in <tt class=
2767: "filename">/usr/pkgsrc/packages</tt>, in the form of a
2768: gzipped tar file. See <a href="#logs.package" title=
2769: "B.2. Packaging figlet">Section B.2,
2770: “Packaging figlet”</a> for a continuation of
2771: the above <a xmlns=
2772: "http://www.w3.org/TR/xhtml1/transitional" href=
2773: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.2 hubertf 2774: class="pkgname">misc/figlet</a> example.</p>
1.1 grant 2775:
2776: <p>See <a href="#submit" title=
2777: "Chapter 14. Submitting and Committing">Chapter
2778: 14, <i>Submitting and Committing</i></a> for information
2779: on how to submit such a binary package.</p>
2780: </div>
2781:
2782: <div class="sect1" lang="en" xml:lang="en">
2783: <div class="titlepage">
2784: <div>
2785: <div>
2786: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 2787: "id2563082" id="id2563082"></a>5.2. Settings
1.1 grant 2788: for creation of binary packages</h2>
2789: </div>
2790: </div>
2791: </div>
2792:
2793: <p>See <a href="#build.helpful-targets" title=
2794: "11.3. Other helpful targets">Section 11.3,
2795: “Other helpful targets”</a>.</p>
2796: </div>
2797:
2798: <div class="sect1" lang="en" xml:lang="en">
2799: <div class="titlepage">
2800: <div>
2801: <div>
2802: <h2 class="title" style="clear: both"><a name=
2803: "bulkbuild" id="bulkbuild"></a>5.3. Doing a
2804: bulk build of all packages</h2>
2805: </div>
2806: </div>
2807: </div>
2808:
2809: <p>If you want to get a full set of precompiled binary
2810: packages, this section describes how to get them. Beware
2811: that the bulk build will remove all currently installed
2812: packages from your system! Having a FTP server configured
2813: either on the machine doing the bulk builds or on a
2814: nearby NFS server can help to make the packages available
2815: to everyone. See <a href=
2816: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
2817: <span class="citerefentry"><span class=
2818: "refentrytitle">ftpd</span>(8)</span></a> for more
2819: information. If you use a remote NFS server's storage, be
2820: sure to not actually compile on NFS storage, as this
2821: slows things down a lot.</p>
2822:
2823: <div class="sect2" lang="en" xml:lang="en">
2824: <div class="titlepage">
2825: <div>
2826: <div>
2827: <h3 class="title"><a name="binary.configuration"
2828: id=
2829: "binary.configuration"></a>5.3.1. Configuration</h3>
2830: </div>
2831: </div>
2832: </div>
2833:
2834: <div class="sect3" lang="en" xml:lang="en">
2835: <div class="titlepage">
2836: <div>
2837: <div>
2838: <h4 class="title"><a name="binary.mk.conf" id=
2839: "binary.mk.conf"></a>5.3.1.1. /etc/mk.conf</h4>
2840: </div>
2841: </div>
2842: </div>
2843:
2844: <p>You may want to set things in <tt class=
2845: "filename">/etc/mk.conf</tt>. Look at <tt class=
2846: "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt> for
2847: details of the default settings. You will want to
2848: ensure that <tt class=
2849: "varname">ACCEPTABLE_LICENSES</tt> meet your local
2850: policy. As used in this example, <tt class=
2851: "varname">_ACCEPTABLE=yes</tt> accepts <span class=
2852: "emphasis"><em>all</em></span> licenses.</p>
2853: <pre class="programlisting">
2854: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
2855: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
2856: BSDSRCDIR= /usr/src
2857: BSDXSRCDIR= /usr/xsrc # for x11/xservers
2858: OBJHOSTNAME?= yes # use work.`hostname`
2859: FAILOVER_FETCH= yes # insist on the correct checksum
2860: PKG_DEVELOPER?= yes
2861: _ACCEPTABLE= yes
2862: </pre>
2863: </div>
2864:
2865: <div class="sect3" lang="en" xml:lang="en">
2866: <div class="titlepage">
2867: <div>
2868: <div>
1.3 hubertf 2869: <h4 class="title"><a name="id2563146" id=
2870: "id2563146"></a>5.3.1.2. <tt class=
1.1 grant 2871: "filename">build.conf</tt></h4>
2872: </div>
2873: </div>
2874: </div>
2875:
2876: <p>In <tt class="filename">pkgsrc/mk/bulk</tt>, copy
2877: <tt class="filename">build.conf-example</tt> to
2878: <tt class="filename">build.conf</tt> and edit it,
2879: following the comments in that file. This is the
2880: config file that determines where log files are
2881: generated after the build, where to mail the build
2882: report to, where your pkgsrc tree is located and
2883: which user to <a href=
2884: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
2885: <span class="citerefentry"><span class=
2886: "refentrytitle">su</span>(8)</span></a> to to do a
2887: <span><b class="command">cvs update</b></span>.</p>
2888: </div>
2889:
2890: <div class="sect3" lang="en" xml:lang="en">
2891: <div class="titlepage">
2892: <div>
2893: <div>
1.3 hubertf 2894: <h4 class="title"><a name="id2563182" id=
2895: "id2563182"></a>5.3.1.3. <tt class=
1.1 grant 2896: "filename">pre-build.local</tt></h4>
2897: </div>
2898: </div>
2899: </div>
2900:
2901: <p>It is possible to configure the bulk build to
2902: perform certain site specific tasks at the end of the
2903: pre-build stage. If the file <tt class=
2904: "filename">pre-build.local</tt> exists in <tt class=
2905: "filename">/usr/pkgsrc/mk/bulk</tt> it will be
2906: executed (as a sh(1) script) at the end of the usual
2907: pre-build stage. An example use of <tt class=
2908: "filename">pre-build.local</tt> is to have the
2909: line:</p>
2910: <pre class="screen">
2911: <tt class="prompt">#</tt> <b class=
2912: "userinput"><tt>echo "I do not have enough disk space to build this pig." \
2913: > pkgsrc/games/crafty-book-enormous/$BROKENF</tt></b>
2914: </pre>
2915:
2916: <p>to prevent the system from trying to build a
2917: particular package which requires nearly 3 GB of disk
2918: space.</p>
2919: </div>
2920: </div>
2921:
2922: <div class="sect2" lang="en" xml:lang="en">
2923: <div class="titlepage">
2924: <div>
2925: <div>
1.3 hubertf 2926: <h3 class="title"><a name="id2563222" id=
2927: "id2563222"></a>5.3.2. Other environmental
1.1 grant 2928: considerations</h3>
2929: </div>
2930: </div>
2931: </div>
2932:
2933: <p>As <tt class="filename">/usr/pkg</tt> will be
2934: completely deleted at the start of bulk builds, make
2935: sure your login shell is placed somewhere else. Either
2936: drop it into <tt class="filename">/usr/local/bin</tt>
2937: (and adjust your login shell in the passwd file), or
2938: (re-)install it via <a href=
2939: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2940: <span class="citerefentry"><span class=
2941: "refentrytitle">pkg_add</span>(1)</span></a> from
2942: <tt class="filename">/etc/rc.local</tt>, so you can
2943: login after a reboot (remember that your current
2944: process won't die if the package is removed, you just
2945: can't start any new instances of the shell any more).
2946: Also, if you use NetBSD earlier than 1.5, or you still
2947: want to use the pkgsrc version of ssh for some reason,
2948: be sure to install ssh before starting it from
2949: <tt class="filename">rc.local</tt>:</p>
2950: <pre class="programlisting">
2951: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
2952: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
2953: /usr/pkg/etc/rc.d/sshd
2954: fi
2955: </pre>
2956:
2957: <p>Not doing so will result in you being not able to
2958: log in via ssh after the bulk build is finished or if
2959: the machine gets rebooted or crashes. You have been
2960: warned! :)</p>
2961: </div>
2962:
2963: <div class="sect2" lang="en" xml:lang="en">
2964: <div class="titlepage">
2965: <div>
2966: <div>
1.3 hubertf 2967: <h3 class="title"><a name="id2563262" id=
2968: "id2563262"></a>5.3.3. Operation</h3>
1.1 grant 2969: </div>
2970: </div>
2971: </div>
2972:
2973: <p>Make sure you don't need any of the packages still
2974: installed.</p>
2975:
2976: <div class="warning" style=
2977: "margin-left: 0.5in; margin-right: 0.5in;">
2978: <h3 class="title">Warning</h3>
2979:
2980: <p>During the bulk build, <span class=
2981: "emphasis"><em>all packages will be
2982: removed!</em></span></p>
2983: </div>
2984:
2985: <p>Be sure to remove all other things that might
2986: interfere with builds, like some libs installed in
2987: <tt class="filename">/usr/local</tt>, etc. then become
2988: root and type:</p>
2989: <pre class="screen">
2990: <tt class="prompt">#</tt> <b class=
2991: "userinput"><tt>cd /usr/pkgsrc</tt></b>
2992: <tt class="prompt">#</tt> <b class=
2993: "userinput"><tt>sh mk/bulk/build</tt></b>
2994: </pre>
2995:
2996: <p>If for some reason your last build didn't complete
2997: (power failure, system panic, ...), you can continue it
2998: by running:</p>
2999: <pre class="screen">
3000: <tt class="prompt">#</tt> <b class=
3001: "userinput"><tt>sh mk/bulk/build restart</tt></b>
3002: </pre>
3003:
3004: <p>At the end of the bulk build, you will get a summary
3005: via mail, and find build logs in the directory
3006: specified by <tt class="varname">FTP</tt> in the
3007: <tt class="filename">build.conf</tt> file.</p>
3008: </div>
3009:
3010: <div class="sect2" lang="en" xml:lang="en">
3011: <div class="titlepage">
3012: <div>
3013: <div>
1.3 hubertf 3014: <h3 class="title"><a name="id2563469" id=
3015: "id2563469"></a>5.3.4. What it does</h3>
1.1 grant 3016: </div>
3017: </div>
3018: </div>
3019:
3020: <p>The bulk builds consist of three steps:</p>
3021:
3022: <div class="variablelist">
3023: <dl>
3024: <dt><span class="term">1. pre-build</span></dt>
3025:
3026: <dd>
3027: <p>The script updates your pkgsrc tree via
3028: (anon)cvs, then cleans out any broken distfiles,
3029: and removes all packages installed.</p>
3030: </dd>
3031:
3032: <dt><span class="term">2. the bulk
3033: build</span></dt>
3034:
3035: <dd>
3036: <p>This is basically “<span class=
3037: "quote">make bulk-package</span>” with an
3038: optimised order in which packages will be built.
3039: Packages that don't require other packages will
3040: be built first, and packages with many
3041: dependencies will be built later.</p>
3042: </dd>
3043:
3044: <dt><span class="term">3. post-build</span></dt>
3045:
3046: <dd>
3047: <p>Generates a report that's placed in the
3048: directory specified in the <tt class=
3049: "filename">build.conf</tt> file named <tt class=
3050: "filename">broken.html</tt>, a short version of
3051: that report will also be mailed to the build's
3052: admin.</p>
3053: </dd>
3054: </dl>
3055: </div>
3056:
3057: <p>During the build, a list of broken packages will be
3058: compiled in <tt class=
3059: "filename">/usr/pkgsrc/.broken</tt> (or <tt class=
3060: "filename">.../.broken.${MACHINE}</tt> if <tt class=
3061: "varname">OBJMACHINE</tt> is set), individual build
3062: logs of broken builds can be found in the package's
3063: directory. These files are used by the bulk-targets to
3064: mark broken builds to not waste time trying to rebuild
3065: them, and they can be used to debug these broken
3066: package builds later.</p>
3067: </div>
3068:
3069: <div class="sect2" lang="en" xml:lang="en">
3070: <div class="titlepage">
3071: <div>
3072: <div>
1.3 hubertf 3073: <h3 class="title"><a name="id2563526" id=
3074: "id2563526"></a>5.3.5. Disk space
1.1 grant 3075: requirements</h3>
3076: </div>
3077: </div>
3078: </div>
3079:
3080: <p>Currently, roughly the following requirements are
3081: valid for NetBSD 2.0/i386:</p>
3082:
3083: <div class="itemizedlist">
3084: <ul type="disc">
3085: <li>
3086: <p>10 GB - distfiles (NFS ok)</p>
3087: </li>
3088:
3089: <li>
3090: <p>8 GB - full set of all binaries (NFS ok)</p>
3091: </li>
3092:
3093: <li>
3094: <p>5 GB - temp space for compiling (local disk
3095: recommended)</p>
3096: </li>
3097: </ul>
3098: </div>
3099:
3100: <p>Note that all pkgs will be de-installed as soon as
3101: they are turned into a binary package, and that sources
3102: are removed, so there is no excessively huge demand to
3103: disk space. Afterwards, if the package is needed again,
3104: it will be installed via <a href=
3105: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3106: <span class="citerefentry"><span class=
3107: "refentrytitle">pkg_add</span>(1)</span></a> instead of
3108: building again, so there are no cycles wasted by
3109: recompiling.</p>
3110: </div>
3111:
3112: <div class="sect2" lang="en" xml:lang="en">
3113: <div class="titlepage">
3114: <div>
3115: <div>
1.3 hubertf 3116: <h3 class="title"><a name="id2563553" id=
3117: "id2563553"></a>5.3.6. Setting up a sandbox
1.1 grant 3118: for chroot'ed builds</h3>
3119: </div>
3120: </div>
3121: </div>
3122:
3123: <p>If you don't want all the pkgs nuked from a machine
3124: (rendering it useless for anything but pkg compiling),
3125: there is the possibility of doing the pkg bulk build
3126: inside a chroot environment.</p>
3127:
3128: <p>The first step to do so is setting up a chroot
3129: sandbox, e.g. <tt class="filename">/usr/sandbox</tt>.
3130: After extracting all the sets from a NetBSD
3131: installation or doing a <span><b class="command">make
3132: distribution DESTDIR=/usr/sandbox</b></span> in
3133: <tt class="filename">/usr/src/etc</tt>, be sure the
3134: following items are present and properly
3135: configured:</p>
3136:
3137: <div class="procedure">
3138: <ol type="1">
3139: <li>
3140: <p>Kernel</p>
3141: <pre class="screen">
3142: <tt class="prompt">#</tt> <b class=
3143: "userinput"><tt>cp /netbsd /usr/sandbox</tt></b>
3144: </pre>
3145: </li>
3146:
3147: <li>
3148: <p><tt class="filename">/dev/*</tt></p>
3149: <pre class="screen">
3150: <tt class="prompt">#</tt> <b class=
3151: "userinput"><tt>cd /usr/sandbox/dev ; sh MAKEDEV all</tt></b>
3152: </pre>
3153: </li>
3154:
3155: <li>
3156: <p><tt class="filename">/etc/resolv.conf</tt>
3157: (for <a xmlns=
3158: "http://www.w3.org/TR/xhtml1/transitional" href=
3159: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.2 hubertf 3160: class="pkgname">security/smtpd</a> and
3161: mail):</p>
1.1 grant 3162: <pre class="screen">
3163: <tt class="prompt">#</tt> <b class=
3164: "userinput"><tt>cp /etc/resolv.conf /usr/sandbox/etc</tt></b>
3165: </pre>
3166: </li>
3167:
3168: <li>
3169: <p>Working(!) mail config (hostname,
3170: sendmail.cf):</p>
3171: <pre class="screen">
3172: <tt class="prompt">#</tt> <b class=
3173: "userinput"><tt>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</tt></b>
3174: </pre>
3175: </li>
3176:
3177: <li>
3178: <p><tt class="filename">/etc/localtime</tt> (for
3179: <a xmlns=
3180: "http://www.w3.org/TR/xhtml1/transitional" href=
3181: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.2 hubertf 3182: class="pkgname">security/smtpd</a>):</p>
1.1 grant 3183: <pre class="screen">
3184: <tt class="prompt">#</tt> <b class=
3185: "userinput"><tt>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</tt></b>
3186: </pre>
3187: </li>
3188:
3189: <li>
3190: <p><tt class="filename">/usr/src</tt> (system
3191: sources, for <a xmlns=
3192: "http://www.w3.org/TR/xhtml1/transitional" href=
3193: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.2 hubertf 3194: class="pkgname">sysutils/aperture</a>,
3195: <a xmlns=
3196: "http://www.w3.org/TR/xhtml1/transitional"
3197: href=
3198: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
3199: class="pkgname">net/ppp-mppe</a>):</p>
1.1 grant 3200: <pre class="screen">
3201: <tt class="prompt">#</tt> <b class=
3202: "userinput"><tt>ln -s ../disk1/cvs .</tt></b>
3203: <tt class="prompt">#</tt> <b class=
3204: "userinput"><tt>ln -s cvs/src-1.6 src</tt></b>
3205: </pre>
3206: </li>
3207:
3208: <li>
3209: <p>Create <tt class="filename">/var/db/pkg</tt>
3210: (not part of default install):</p>
3211: <pre class="screen">
3212: <tt class="prompt">#</tt> <b class=
3213: "userinput"><tt>mkdir /usr/sandbox/var/db/pkg</tt></b>
3214: </pre>
3215: </li>
3216:
3217: <li>
3218: <p>Create <tt class="filename">/usr/pkg</tt> (not
3219: part of default install):</p>
3220: <pre class="screen">
3221: <tt class="prompt">#</tt> <b class=
3222: "userinput"><tt>mkdir /usr/sandbox/usr/pkg</tt></b>
3223: </pre>
3224: </li>
3225:
3226: <li>
3227: <p>Checkout pkgsrc via cvs into <tt class=
3228: "filename">/usr/sandbox/usr/pkgsrc</tt>:</p>
3229: <pre class="screen">
3230: <tt class="prompt">#</tt> <b class=
3231: "userinput"><tt>cd /usr/sandbox/usr</tt></b>
3232: <tt class="prompt">#</tt> <b class=
3233: "userinput"><tt>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</tt></b>
3234: </pre>
3235:
3236: <p>Do not mount/link this to the copy of your
3237: pkgsrc tree you do development in, as this will
3238: likely cause problems!</p>
3239: </li>
3240:
3241: <li>
3242: <p>Make <tt class=
3243: "filename">/usr/sandbox/usr/pkgsrc/packages</tt>
3244: and <tt class="filename">.../distfiles</tt> point
3245: somewhere appropriate. NFS- and/or nullfs-mounts
3246: may come in handy!</p>
3247: </li>
3248:
3249: <li>
3250: <p>Edit <tt class="filename">/etc/mk.conf</tt>,
3251: see <a href="#binary.mk.conf" title=
3252: "5.3.1.1. /etc/mk.conf">Section 5.3.1.1,
3253: “/etc/mk.conf”</a>.</p>
3254: </li>
3255:
3256: <li>
3257: <p>Adjust <tt class=
3258: "filename">mk/bulk/build.conf</tt> to suit your
3259: needs.</p>
3260: </li>
3261:
3262: <li>
3263: <p>If you have set <tt class=
3264: "varname">CVS_USER</tt> in <tt class=
3265: "filename">build.conf</tt>, make sure that
3266: account exists and can do a <span><b class=
3267: "command">cvs ${CVS_FLAGS} update</b></span>
3268: properly!</p>
3269: </li>
3270: </ol>
3271: </div>
3272:
3273: <p>When the chroot sandbox is setup, you can start the
3274: build with the following steps:</p>
3275: <pre class="screen">
3276: <tt class="prompt">#</tt> <b class=
3277: "userinput"><tt>cd /usr/sandbox/usr/pkgsrc</tt></b>
3278: <tt class="prompt">#</tt> <b class=
3279: "userinput"><tt>sh mk/bulk/do-sandbox-build</tt></b>
3280: </pre>
3281:
3282: <p>This will just jump inside the sandbox and start
3283: building. At the end of the build, mail will be sent
3284: with the results of the build. Created binary pkgs will
3285: be in <tt class=
3286: "filename">/usr/sandbox/usr/pkgsrc/packages</tt>
3287: (wherever that points/mounts to/from).</p>
3288: </div>
3289:
3290: <div class="sect2" lang="en" xml:lang="en">
3291: <div class="titlepage">
3292: <div>
3293: <div>
1.3 hubertf 3294: <h3 class="title"><a name="id2563916" id=
3295: "id2563916"></a>5.3.7. Building a partial
1.1 grant 3296: set of packages</h3>
3297: </div>
3298: </div>
3299: </div>
3300:
3301: <p>In addition to building a complete set of all
3302: packages in pkgsrc, the <tt class=
3303: "filename">pkgsrc/mk/bulk/build</tt> script may be used
3304: to build a subset of the packages contained in pkgsrc.
3305: By setting defining <tt class=
3306: "varname">SPECIFIC_PKGS</tt> in <tt class=
3307: "filename">/etc/mk.conf</tt>, the variables</p>
3308:
3309: <div class="itemizedlist">
3310: <ul type="disc">
3311: <li>
3312: <p>SITE_SPECIFIC_PKGS</p>
3313: </li>
3314:
3315: <li>
3316: <p>HOST_SPECIFIC_PKGS</p>
3317: </li>
3318:
3319: <li>
3320: <p>GROUP_SPECIFIC_PKGS</p>
3321: </li>
3322:
3323: <li>
3324: <p>USER_SPECIFIC_PKGS</p>
3325: </li>
3326: </ul>
3327: </div>
3328:
3329: <p>will define the set of packages which should be
3330: built. The bulk build code will also include any
3331: packages which are needed as dependencies for the
3332: explicitly listed packages.</p>
3333:
3334: <p>One use of this is to do a bulk build with
3335: <tt class="varname">SPECIFIC_PKGS</tt> in a chroot
3336: sandbox periodically to have a complete set of the
3337: binary packages needed for your site available without
3338: the overhead of building extra packages that are not
3339: needed.</p>
3340: </div>
3341: </div>
3342:
3343: <div class="sect1" lang="en" xml:lang="en">
3344: <div class="titlepage">
3345: <div>
3346: <div>
3347: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 3348: "id2564027" id="id2564027"></a>5.4. Creating a
1.1 grant 3349: multiple CD-ROM packages collection</h2>
3350: </div>
3351: </div>
3352: </div>
3353:
3354: <p>After your pkgsrc bulk-build has completed, you may
3355: wish to create a CD-ROM set of the resulting binary
3356: packages to assist in installing packages on other
3357: machines. The <a xmlns=
3358: "http://www.w3.org/TR/xhtml1/transitional" href=
3359: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.2 hubertf 3360: class="pkgname">pkgtools/cdpack</a> package provides a
3361: simple tool for creating the ISO 9660 images.
3362: <span><b class="command">cdpack</b></span> arranges
3363: the packages on the CD-ROMs in a way that keeps all
3364: the dependencies for given package on the same CD as
3365: that package.</p>
1.1 grant 3366:
3367: <div class="sect2" lang="en" xml:lang="en">
3368: <div class="titlepage">
3369: <div>
3370: <div>
1.3 hubertf 3371: <h3 class="title"><a name="id2564042" id=
3372: "id2564042"></a>5.4.1. Example of
1.1 grant 3373: cdpack</h3>
3374: </div>
3375: </div>
3376: </div>
3377:
3378: <p>Complete documentation for cdpack is found in the
3379: cdpack(1) manpage. The following short example assumes
3380: that the binary packages are left in <tt class=
3381: "filename">/usr/pkgsrc/packages/All</tt> and that
3382: sufficient disk space exists in <tt class=
3383: "filename">/u2</tt> to hold the ISO 9660 images.</p>
3384: <pre class="screen">
3385: <tt class="prompt">#</tt> <b class=
3386: "userinput"><tt>mkdir /u2/images</tt></b>
3387: <tt class="prompt">#</tt> <b class=
3388: "userinput"><tt>pkg_add /usr/pkgsrc/packages/All/cdpack</tt></b>
3389: <tt class="prompt">#</tt> <b class=
3390: "userinput"><tt>cdpack /usr/pkgsrc/packages/All /u2/images</tt></b>
3391: </pre>
3392:
3393: <p>If you wish to include a common set of files
3394: (<tt class="filename">COPYRIGHT</tt>, <tt class=
3395: "filename">README</tt>, etc.) on each CD in the
3396: collection, then you need to create a directory which
3397: contains these files. e.g.</p>
3398: <pre class="screen">
3399: <tt class="prompt">#</tt> <b class=
3400: "userinput"><tt>mkdir /tmp/common</tt></b>
3401: <tt class="prompt">#</tt> <b class=
3402: "userinput"><tt>echo "This is a README" > /tmp/common/README</tt></b>
3403: <tt class="prompt">#</tt> <b class=
3404: "userinput"><tt>echo "Another file" > /tmp/common/COPYING</tt></b>
3405: <tt class="prompt">#</tt> <b class=
3406: "userinput"><tt>mkdir /tmp/common/bin</tt></b>
3407: <tt class="prompt">#</tt> <b class=
3408: "userinput"><tt>echo "#!/bin/sh" > /tmp/common/bin/myscript</tt></b>
3409: <tt class="prompt">#</tt> <b class=
3410: "userinput"><tt>echo "echo Hello world" >> /tmp/common/bin/myscript</tt></b>
3411: <tt class="prompt">#</tt> <b class=
3412: "userinput"><tt>chmod 755 /tmp/common/bin/myscript</tt></b>
3413: </pre>
3414:
3415: <p>Now create the images:</p>
3416: <pre class="screen">
3417: <tt class="prompt">#</tt> <b class=
3418: "userinput"><tt>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</tt></b>
3419: </pre>
3420:
3421: <p>Each image will contain <tt class=
3422: "filename">README</tt>, <tt class=
3423: "filename">COPYING</tt>, and <tt class=
3424: "filename">bin/myscript</tt> in their root
3425: directories.</p>
3426: </div>
3427: </div>
3428: </div>
3429:
3430: <div class="chapter" lang="en" xml:lang="en">
3431: <div class="titlepage">
3432: <div>
3433: <div>
3434: <h2 class="title"><a name="faq" id=
3435: "faq"></a>Chapter 6. Frequently Asked
3436: Questions</h2>
3437: </div>
3438: </div>
3439: </div>
3440:
3441: <div class="toc">
3442: <p><b>Table of Contents</b></p>
3443:
3444: <dl>
1.3 hubertf 3445: <dt><span class="sect1"><a href="#id2564301">6.1. Is
1.1 grant 3446: there a mailing list for pkg-related
3447: discussion?</a></span></dt>
3448:
1.3 hubertf 3449: <dt><span class="sect1"><a href="#id2564331">6.2.
1.1 grant 3450: Where's the pkgviews documentation?</a></span></dt>
3451:
1.3 hubertf 3452: <dt><span class="sect1"><a href="#id2564344">6.3.
1.1 grant 3453: Utilities for package management
3454: (pkgtools)</a></span></dt>
3455:
1.3 hubertf 3456: <dt><span class="sect1"><a href="#id2564501">6.4. How
1.1 grant 3457: to use pkgsrc as non-root</a></span></dt>
3458:
1.3 hubertf 3459: <dt><span class="sect1"><a href="#id2564581">6.5. How
1.1 grant 3460: can I install/use XFree86 from pkgsrc?</a></span></dt>
3461:
1.3 hubertf 3462: <dt><span class="sect1"><a href="#id2564609">6.6. How
1.1 grant 3463: can I install/use X.org from pkgsrc?</a></span></dt>
3464:
1.3 hubertf 3465: <dt><span class="sect1"><a href="#id2564636">6.7. How
1.1 grant 3466: to fetch files from behind a firewall</a></span></dt>
3467:
1.3 hubertf 3468: <dt><span class="sect1"><a href="#id2564650">6.8. How
1.1 grant 3469: do I tell make fetch to do passive FTP?</a></span></dt>
3470:
1.3 hubertf 3471: <dt><span class="sect1"><a href="#id2564701">6.9. How
1.1 grant 3472: to fetch all distfiles at once</a></span></dt>
3473:
1.3 hubertf 3474: <dt><span class="sect1"><a href="#id2564978">6.10. What
1.1 grant 3475: does Don't know how to make /usr/share/tmac/tmac.andoc
3476: mean?</a></span></dt>
3477:
1.3 hubertf 3478: <dt><span class="sect1"><a href="#id2565016">6.11. What
1.1 grant 3479: does Could not find bsd.own.mk mean?</a></span></dt>
3480:
1.3 hubertf 3481: <dt><span class="sect1"><a href="#id2565074">6.12.
1.1 grant 3482: Using 'sudo' with pkgsrc</a></span></dt>
3483:
3484: <dt><span class="sect1"><a href="#faq.conf">6.13.
3485: Configuration files handling and
3486: placement</a></span></dt>
3487:
3488: <dt><span class="sect1"><a href="#audit-packages">6.14.
3489: Automated security checks</a></span></dt>
3490: </dl>
3491: </div>
3492:
3493: <p>This section contains hints, tips & tricks on
3494: special things in pkgsrc that we didn't find a better place
3495: for in the previous chapters, and it contains items for
3496: both pkgsrc users and developers.</p>
3497:
3498: <div class="sect1" lang="en" xml:lang="en">
3499: <div class="titlepage">
3500: <div>
3501: <div>
3502: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 3503: "id2564301" id="id2564301"></a>6.1. Is there a
1.1 grant 3504: mailing list for pkg-related discussion?</h2>
3505: </div>
3506: </div>
3507: </div>
3508:
3509: <p>Yes, <tt class="email"><<a href=
3510: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></tt>
3511: is the list for discussing package related issues. To
3512: subscribe do:</p>
3513: <pre class="programlisting">
3514: <tt class=
3515: "prompt">%</tt> echo subscribe tech-pkg | mail majordomo@NetBSD.org
3516: </pre>
3517:
3518: <p>An archive of the list is available at <a href=
3519: "http://mail-index.NetBSD.org/tech-pkg/" target=
3520: "_top">http://mail-index.NetBSD.org/tech-pkg/</a>.</p>
3521: </div>
3522:
3523: <div class="sect1" lang="en" xml:lang="en">
3524: <div class="titlepage">
3525: <div>
3526: <div>
3527: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 3528: "id2564331" id="id2564331"></a>6.2. Where's
1.1 grant 3529: the pkgviews documentation?</h2>
3530: </div>
3531: </div>
3532: </div>
3533:
3534: <p>Pkgviews is tightly integrated with buildlink. You can
3535: find a pkgviews User's guide in <tt class=
3536: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</tt>.</p>
3537: </div>
3538:
3539: <div class="sect1" lang="en" xml:lang="en">
3540: <div class="titlepage">
3541: <div>
3542: <div>
3543: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 3544: "id2564344" id="id2564344"></a>6.3. Utilities
1.1 grant 3545: for package management (pkgtools)</h2>
3546: </div>
3547: </div>
3548: </div>
3549:
3550: <p>The <tt class="filename">pkgsrc/pkgtools</tt>
3551: directory pkgtools contains a number of useful utilities
3552: for both users and developers of pkgsrc. This section
3553: attempts only to make the reader aware of the utilities
3554: and when they might be useful, and not to duplicate the
3555: documentation that comes with each package.</p>
3556:
3557: <p>Utilities used by pkgsrc (automatically installed when
3558: needed):</p>
3559:
3560: <div class="itemizedlist">
3561: <ul type="disc">
3562: <li>
3563: <p><a xmlns=
3564: "http://www.w3.org/TR/xhtml1/transitional" href=
3565: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.2 hubertf 3566: class="pkgname">pkgtools/x11-links</a>: symlinks
3567: for use by buildlink</p>
1.1 grant 3568: </li>
3569: </ul>
3570: </div>
3571:
3572: <p>OS tool augmentation (automatically installed when
3573: needed):</p>
3574:
3575: <div class="itemizedlist">
3576: <ul type="disc">
3577: <li>
3578: <p><a xmlns=
3579: "http://www.w3.org/TR/xhtml1/transitional" href=
3580: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.2 hubertf 3581: class="pkgname">pkgtools/digest</a>: calculates
3582: SHA1 checksums (and other kinds)</p>
1.1 grant 3583: </li>
3584:
3585: <li>
3586: <p><a xmlns=
3587: "http://www.w3.org/TR/xhtml1/transitional" href=
3588: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.2 hubertf 3589: class="pkgname">pkgtools/libnbcompat</a>: compat
3590: library for pkg tools</p>
1.1 grant 3591: </li>
3592:
3593: <li>
3594: <p><a xmlns=
3595: "http://www.w3.org/TR/xhtml1/transitional" href=
3596: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.2 hubertf 3597: class="pkgname">pkgtools/mtree</a>: installed on
3598: non-BSD systems due to lack of native mtree</p>
1.1 grant 3599: </li>
3600:
3601: <li>
3602: <p><a xmlns=
3603: "http://www.w3.org/TR/xhtml1/transitional" href=
3604: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.2 hubertf 3605: class="pkgname">pkgtools/pkg_install</a>:
3606: up-to-date replacement for
3607: /usr/sbin/pkg_install, or for use on operating
3608: systems where pkg_install is not present</p>
1.1 grant 3609: </li>
3610: </ul>
3611: </div>
3612:
3613: <p>Utilities used by pkgsrc (not automatically
3614: installed):</p>
3615:
3616: <div class="itemizedlist">
3617: <ul type="disc">
3618: <li>
3619: <p><a xmlns=
3620: "http://www.w3.org/TR/xhtml1/transitional" href=
3621: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.2 hubertf 3622: class="pkgname">pkgtools/pkg_tarup</a>: create a
3623: binary package from an already-installed
3624: package. used by 'make replace' to save the old
3625: package</p>
1.1 grant 3626: </li>
3627:
3628: <li>
3629: <p><a xmlns=
3630: "http://www.w3.org/TR/xhtml1/transitional" href=
3631: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.2 hubertf 3632: class="pkgname">pkgtools/xpkgwedge</a>: put X11
3633: packages someplace else (enabled by default)</p>
1.1 grant 3634: </li>
3635: </ul>
3636: </div>
3637:
3638: <p>Utilities for keeping track of installed packages,
3639: being up to date, etc:</p>
3640:
3641: <div class="itemizedlist">
3642: <ul type="disc">
3643: <li>
3644: <p><a xmlns=
3645: "http://www.w3.org/TR/xhtml1/transitional" href=
3646: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.2 hubertf 3647: class="pkgname">pkgtools/pkg_chk</a>: installs
3648: pkg_chk, which reports on packages whose
3649: installed versions do not match the latest
3650: pkgsrc entries</p>
1.1 grant 3651: </li>
3652:
3653: <li>
3654: <p><a xmlns=
3655: "http://www.w3.org/TR/xhtml1/transitional" href=
3656: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.2 hubertf 3657: class="pkgname">pkgtools/pkgdep</a>: makes
3658: dependency graphs of packages, to aid in
3659: choosing a strategy for updating</p>
1.1 grant 3660: </li>
3661:
3662: <li>
3663: <p><a xmlns=
3664: "http://www.w3.org/TR/xhtml1/transitional" href=
3665: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.2 hubertf 3666: class="pkgname">pkgtools/pkgdepgraph</a>: make
3667: graph from above (uses graphviz)</p>
1.1 grant 3668: </li>
3669:
3670: <li>
3671: <p><a xmlns=
3672: "http://www.w3.org/TR/xhtml1/transitional" href=
3673: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.2 hubertf 3674: class="pkgname">pkgtools/pkglint</a>: This
3675: provides two distinct abilities: check a pkgsrc
3676: entry for correctness (pkglint) check for and
3677: remove out-of-date distfiles and binary packages
3678: (lintpkgsrc)</p>
1.1 grant 3679: </li>
3680:
3681: <li>
3682: <p><a xmlns=
3683: "http://www.w3.org/TR/xhtml1/transitional" href=
3684: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.2 hubertf 3685: class="pkgname">pkgtools/pkgsurvey</a>: report
3686: what packages you have installed</p>
1.1 grant 3687: </li>
3688: </ul>
3689: </div>
3690:
3691: <p>Utilities for people maintaining or creating
3692: individual packages:</p>
3693:
3694: <div class="itemizedlist">
3695: <ul type="disc">
3696: <li>
3697: <p><a xmlns=
3698: "http://www.w3.org/TR/xhtml1/transitional" href=
3699: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.2 hubertf 3700: class="pkgname">pkgtools/pkgdiff</a>: automate
3701: making and maintaining patches for a package
3702: (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1 grant 3703: </li>
3704:
3705: <li>
3706: <p><a xmlns=
3707: "http://www.w3.org/TR/xhtml1/transitional" href=
3708: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.2 hubertf 3709: class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
3710: "http://www.w3.org/TR/xhtml1/transitional" href=
3711: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
3712: class="pkgname">pkgtools/url2pkg</a>: aids in
3713: converting to pkgsrc</p>
1.1 grant 3714: </li>
3715:
3716: <li>
3717: <p><a xmlns=
3718: "http://www.w3.org/TR/xhtml1/transitional" href=
3719: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.2 hubertf 3720: class="pkgname">pkgtools/gensolpkg</a>: convert
3721: pkgsrc to a Solaris package</p>
1.1 grant 3722: </li>
3723: </ul>
3724: </div>
3725:
3726: <p>Utilities for people maintaining pkgsrc (or more
3727: obscure pkg utilities)</p>
3728:
3729: <div class="itemizedlist">
3730: <ul type="disc">
3731: <li>
3732: <p><a xmlns=
3733: "http://www.w3.org/TR/xhtml1/transitional" href=
3734: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.2 hubertf 3735: class="pkgname">pkgtools/pkgconflict</a>: find
3736: packages that conflict but aren't marked as
3737: such</p>
1.1 grant 3738: </li>
3739:
3740: <li>
3741: <p><a xmlns=
3742: "http://www.w3.org/TR/xhtml1/transitional" href=
3743: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.2 hubertf 3744: class="pkgname">pkgtools/pkg_comp</a>: build
3745: packages in a chrooted area</p>
1.1 grant 3746: </li>
3747:
3748: <li>
3749: <p><a xmlns=
3750: "http://www.w3.org/TR/xhtml1/transitional" href=
3751: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.2 hubertf 3752: class="pkgname">pkgtools/libkver</a>: spoof
3753: kernel version for chrooted cross builds</p>
1.1 grant 3754: </li>
3755: </ul>
3756: </div>
3757: </div>
3758:
3759: <div class="sect1" lang="en" xml:lang="en">
3760: <div class="titlepage">
3761: <div>
3762: <div>
3763: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 3764: "id2564501" id="id2564501"></a>6.4. How to use
1.1 grant 3765: pkgsrc as non-root</h2>
3766: </div>
3767: </div>
3768: </div>
3769:
3770: <p>If you want to use pkgsrc as non-root user, you can
3771: set some variables to make pkgsrc work under these
3772: conditions. Please see <a href=
3773: "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.2 hubertf 3774: target="_top">this message</a> for more details.</p>
1.1 grant 3775: </div>
3776:
3777: <div class="sect1" lang="en" xml:lang="en">
3778: <div class="titlepage">
3779: <div>
3780: <div>
3781: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 3782: "id2564581" id="id2564581"></a>6.5. How can I
1.1 grant 3783: install/use XFree86 from pkgsrc?</h2>
3784: </div>
3785: </div>
3786: </div>
3787:
3788: <p>If you want to use XFree86 from pkgsrc instead of your
3789: system's own X11 (<tt class="filename">/usr/X11R6</tt>,
3790: <tt class="filename">/usr/openwin</tt>, ...), you will
3791: have to add the following lines into <tt class=
3792: "filename">mk.conf</tt>:</p>
3793: <pre class="programlisting">
3794: X11_TYPE=XFree86
3795:
3796: </pre>
3797: </div>
3798:
3799: <div class="sect1" lang="en" xml:lang="en">
3800: <div class="titlepage">
3801: <div>
3802: <div>
3803: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 3804: "id2564609" id="id2564609"></a>6.6. How can I
1.1 grant 3805: install/use X.org from pkgsrc?</h2>
3806: </div>
3807: </div>
3808: </div>
3809:
3810: <p>If you want to use X.org from pkgsrc instead of your
3811: system's own X11 (<tt class="filename">/usr/X11R6</tt>,
3812: <tt class="filename">/usr/openwin</tt>, ...) you will
3813: have to add the following lines into <tt class=
3814: "filename">mk.conf</tt>:</p>
3815: <pre class="programlisting">
3816: X11_TYPE=xorg
3817:
3818: </pre>
3819: </div>
3820:
3821: <div class="sect1" lang="en" xml:lang="en">
3822: <div class="titlepage">
3823: <div>
3824: <div>
3825: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 3826: "id2564636" id="id2564636"></a>6.7. How to
1.1 grant 3827: fetch files from behind a firewall</h2>
3828: </div>
3829: </div>
3830: </div>
3831:
3832: <p>If you are sitting behind a firewall which does not
3833: allow direct connections to Internet hosts (i.e.
3834: non-NAT), you may specify the relevant proxy hosts. This
3835: is done using an environment variable in the form of a
3836: URL e.g. in Amdahl, the machine “<span class=
3837: "quote">orpheus.amdahl.com</span>” is one of the
3838: firewalls, and it uses port 80 as the proxy port number.
3839: So the proxy environment variables are:</p>
3840: <pre class="programlisting">
3841: ftp_proxy=ftp://orpheus.amdahl.com:80/
3842: http_proxy=http://orpheus.amdahl.com:80/
3843: </pre>
3844: </div>
3845:
3846: <div class="sect1" lang="en" xml:lang="en">
3847: <div class="titlepage">
3848: <div>
3849: <div>
3850: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 3851: "id2564650" id="id2564650"></a>6.8. How do I
1.1 grant 3852: tell <span><b class="command">make fetch</b></span>
3853: to do passive FTP?</h2>
3854: </div>
3855: </div>
3856: </div>
3857:
3858: <p>This depends on which utility is used to retrieve
3859: distfiles. From <tt class="filename">bsd.pkg.mk</tt>,
3860: <tt class="varname">FETCH_CMD</tt> is assigned the first
3861: available command from the following list:</p>
3862: <pre class="programlisting">
3863: ${LOCALBASE}/bin/ftp
3864: /usr/bin/ftp
3865: </pre>
3866:
3867: <p>On a default NetBSD installation, this will be
3868: <tt class="filename">/usr/bin/ftp</tt>, which
3869: automatically tries passive connections first, and falls
3870: back to active connections if the server refuses to do
3871: passive. For the other tools, add the following to your
3872: <tt class="filename">/etc/mk.conf</tt> file: <tt class=
3873: "varname">PASSIVE_FETCH=1</tt>.</p>
3874:
3875: <p>Having that option present will prevent <tt class=
3876: "filename">/usr/bin/ftp</tt> from falling back to active
3877: transfers.</p>
3878: </div>
3879:
3880: <div class="sect1" lang="en" xml:lang="en">
3881: <div class="titlepage">
3882: <div>
3883: <div>
3884: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 3885: "id2564701" id="id2564701"></a>6.9. How to
1.1 grant 3886: fetch all distfiles at once</h2>
3887: </div>
3888: </div>
3889: </div>
3890:
3891: <p>You would like to download all the distfiles in a
3892: single batch from work or university, where you can't run
3893: a <span><b class="command">make fetch</b></span>. There
3894: is an archive of distfiles on <a href=
3895: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
3896: target="_top">ftp.NetBSD.org</a>, but downloading the
3897: entire directory may not be appropriate.</p>
3898:
3899: <p>The answer here is to do a <span><b class=
3900: "command">make fetch-list</b></span> in <tt class=
3901: "filename">/usr/pkgsrc</tt> or one of it's
3902: subdirectories, carry the resulting list to your machine
3903: at work/school and use it there If you don't have a
3904: NetBSD-compatible ftp(1) (like lukemftp) at work, don't
3905: forget to set <tt class="varname">FETCH_CMD</tt> to
3906: something that fetches a URL:</p>
3907:
3908: <p>At home:</p>
3909: <pre class="screen">
3910: <tt class="prompt">%</tt> <b class=
3911: "userinput"><tt>cd /usr/pkgsrc</tt></b>
3912: <tt class="prompt">%</tt> <b class=
3913: "userinput"><tt>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</tt></b>
3914: <tt class="prompt">%</tt> <b class=
3915: "userinput"><tt>scp /tmp/fetch.sh work:/tmp</tt></b>
3916: </pre>
3917:
3918: <p>At work:</p>
3919: <pre class="screen">
3920: <tt class="prompt">%</tt> <b class=
3921: "userinput"><tt>sh /tmp/fetch.sh</tt></b>
3922: </pre>
3923:
3924: <p>then tar up <tt class="filename">/tmp/distfiles</tt>
3925: and take it home.</p>
3926:
3927: <p>If you have a machine running NetBSD, and you want to
3928: get <span class="emphasis"><em>all</em></span> distfiles
3929: (even ones that aren't for your machine architecture),
3930: you can do so by using the above-mentioned
3931: <span><b class="command">make fetch-list</b></span>
3932: approach, or fetch the distfiles directly by running:</p>
3933: <pre class="screen">
3934: <tt class="prompt">%</tt> <b class=
3935: "userinput"><tt>make mirror-distfiles</tt></b>
3936: </pre>
3937:
3938: <p>If you even decide to ignore <tt class=
3939: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</tt>, then you can
3940: get everything by running:</p>
3941: <pre class="screen">
3942: <tt class="prompt">%</tt> <b class=
3943: "userinput"><tt>make fetch NO_SKIP=yes</tt></b>
3944: </pre>
3945: </div>
3946:
3947: <div class="sect1" lang="en" xml:lang="en">
3948: <div class="titlepage">
3949: <div>
3950: <div>
3951: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 3952: "id2564978" id="id2564978"></a>6.10. What does
1.1 grant 3953: “<span class="quote">Don't know how to make
3954: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
3955: </div>
3956: </div>
3957: </div>
3958:
3959: <p>When compiling the <a xmlns=
3960: "http://www.w3.org/TR/xhtml1/transitional" href=
3961: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.2 hubertf 3962: class="pkgname">pkgtools/pkg_install</a> package, you
3963: get the error from make that it doesn't know how to
3964: make <tt class=
3965: "filename">/usr/share/tmac/tmac.andoc</tt>? This
3966: indicates that you don't have installed the
3967: “<span class="quote">text</span>” set on
3968: your machine (nroff, ...). It is recommended to do
3969: that to format manpages.</p>
1.1 grant 3970:
3971: <p>In the case of the <a xmlns=
3972: "http://www.w3.org/TR/xhtml1/transitional" href=
3973: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.2 hubertf 3974: class="pkgname">pkgtools/pkg_install</a> package, you
3975: can get away with setting <tt class=
3976: "varname">NOMAN=YES</tt> either in the environment or
3977: in <tt class="filename">/etc/mk.conf</tt>.</p>
1.1 grant 3978: </div>
3979:
3980: <div class="sect1" lang="en" xml:lang="en">
3981: <div class="titlepage">
3982: <div>
3983: <div>
3984: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 3985: "id2565016" id="id2565016"></a>6.11. What does
1.1 grant 3986: “<span class="quote">Could not find
3987: bsd.own.mk</span>” mean?</h2>
3988: </div>
3989: </div>
3990: </div>
3991:
3992: <p>You didn't install the compiler set, <tt class=
3993: "filename">comp.tgz</tt>, when you installed your NetBSD
3994: machine. Please get it and install it, by extracting it
3995: in <tt class="filename">/</tt>:</p>
3996: <pre class="screen">
3997: <tt class="prompt">#</tt> <b class="userinput"><tt>cd /</tt></b>
3998: <tt class="prompt">#</tt> <b class=
3999: "userinput"><tt>tar --unlink -zxvpf .../comp.tgz</tt></b>
4000: </pre>
4001:
4002: <p><tt class="filename">comp.tgz</tt> is part of every
4003: NetBSD release. Get the one that corresponds to your
4004: release (determine via <span><b class="command">uname
4005: -r</b></span>).</p>
4006: </div>
4007:
4008: <div class="sect1" lang="en" xml:lang="en">
4009: <div class="titlepage">
4010: <div>
4011: <div>
4012: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 4013: "id2565074" id="id2565074"></a>6.12. Using
1.1 grant 4014: 'sudo' with pkgsrc</h2>
4015: </div>
4016: </div>
4017: </div>
4018:
4019: <p>When installing packages as non-root user and using
4020: the just-in-time su(1) feature of pkgsrc, it can become
4021: annoying to type in the root password for each required
4022: package installed. To avoid this, the sudo package can be
4023: used, which does password caching over a limited time. To
4024: use it, install sudo (either as binary package or from
4025: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
4026: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.2 hubertf 4027: class="pkgname">security/sudo</a>) and then put the
4028: following into your <tt class=
4029: "filename">/etc/mk.conf</tt>:</p>
1.1 grant 4030: <pre class="programlisting">
4031: .if exists(/usr/pkg/bin/sudo)
4032: SU_CMD=/usr/pkg/bin/sudo /bin/sh -c
4033: .endif
4034:
4035: </pre>
4036: </div>
4037:
4038: <div class="sect1" lang="en" xml:lang="en">
4039: <div class="titlepage">
4040: <div>
4041: <div>
4042: <h2 class="title" style="clear: both"><a name=
4043: "faq.conf" id=
4044: "faq.conf"></a>6.13. Configuration files
4045: handling and placement</h2>
4046: </div>
4047: </div>
4048: </div>
4049:
4050: <p>The global variable <tt class=
4051: "varname">PKG_SYSCONFBASE</tt> (and some others) can be
4052: set by the system administrator in <tt class=
4053: "filename">/etc/mk.conf</tt> to define the place where
4054: configuration files get installed. Therefore, packages
4055: must be adapted to support this feature. Keep in mind
4056: that you should only install files that are strictly
4057: necessary in the configuration directory, files that can
4058: go to <tt class="filename">$PREFIX/share</tt> should go
4059: there.</p>
4060:
4061: <p>We will take a look at available variables first
4062: (<tt class="filename">bsd.pkg.mk</tt> contains more
4063: information). <tt class="varname">PKG_SYSCONFDIR</tt> is
4064: where the configuration files for a package may be found
4065: (that is, the full path, e.g. <tt class=
4066: "filename">/etc</tt> or <tt class=
4067: "filename">/usr/pkg/etc</tt>). This value may be
4068: customized in various ways:</p>
4069:
4070: <div class="orderedlist">
4071: <ol type="1">
4072: <li>
4073: <p><tt class="varname">PKG_SYSCONFBASE</tt> is the
4074: main config directory under which all package
4075: configuration files are to be found. Users will
4076: typically want to set it to <tt class=
4077: "filename">/etc</tt>, or accept the default
4078: location of <tt class=
4079: "filename">$PREFIX/etc</tt>.</p>
4080: </li>
4081:
4082: <li>
4083: <p><tt class="varname">PKG_SYSCONFSUBDIR</tt> is
4084: the subdirectory of <tt class=
4085: "varname">PKG_SYSCONFBASE</tt> under which the
4086: configuration files for a particular package may be
4087: found. Defaults to <tt class=
4088: "varname">${SYSCONFBASE}</tt>.</p>
4089: </li>
4090:
4091: <li>
4092: <p><tt class="varname">PKG_SYSCONFVAR</tt> is the
4093: special suffix used to distinguish any overriding
4094: values for a particular package (see next item). It
4095: defaults to <tt class="varname">${PKGBASE}</tt>,
4096: but for a collection of related packages that
4097: should all have the same <tt class=
4098: "varname">PKG_SYSCONFDIR</tt> value, it can be set
4099: in each of the package Makefiles to a common
4100: value.</p>
4101: </li>
4102:
4103: <li>
4104: <p><tt class=
4105: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</tt>
4106: overrides the value of <tt class=
4107: "varname">${PKG_SYSCONFDIR}</tt> for packages with
4108: the same value for <tt class=
4109: "varname">PKG_SYSCONFVAR</tt>.</p>
4110:
4111: <p>As an example, all the various KDE packages may
4112: want to set <tt class="varname">PKG_SYSCONFVAR</tt>
4113: to “<span class="quote">kde</span>” so
4114: admins can set <tt class=
4115: "varname">PKG_SYSCONFDIR.kde</tt> in <tt class=
4116: "filename">/etc/mk.conf</tt> to define where to
4117: install KDE config files.</p>
4118: </li>
4119: </ol>
4120: </div>
4121:
4122: <p>Programs' configuration directory should be defined
4123: during the configure stage. Packages that use GNU
4124: autoconf can usually do this by using the
4125: “<span class="quote">--sysconfdir</span>”
4126: parameter, but this brings some problems as we will see
4127: now. When you change this pathname in packages, you
4128: should not allow them to install files in that directory
4129: directly. Instead they need to install those files under
4130: <tt class="filename">share/examples/${PKGNAME}</tt> so
4131: <tt class="filename">PLIST</tt> can register them.</p>
4132:
4133: <p>Once you have the required configuration files in
4134: place (under the <tt class="filename">share/examples</tt>
4135: directory) the variable <tt class=
4136: "varname">CONF_FILES</tt> should be set to copy them into
4137: <tt class="varname">PKG_SYSCONFDIR</tt>. The contents of
4138: this variable is formed by pairs of filenames; the first
4139: element of the pair specifies the file inside the
4140: examples directory (registered by <tt class=
4141: "filename">PLIST</tt>) and the second element specifies
4142: the target file. This is done this way to allow binary
4143: packages to place files in the right directory using
4144: <tt class="filename">INSTALL</tt>/<tt class=
4145: "filename">DEINSTALL</tt> scripts which are created
4146: automatically. The package <tt class=
4147: "filename">Makefile</tt> must also set <tt class=
4148: "varname">USE_PKGINSTALL=YES</tt> to use these
4149: automatically generated scripts. The automatic copying of
4150: config files can be toggled by setting the environment
4151: variable <tt class="varname">PKG_CONFIG</tt> prior to
4152: package installation.</p>
4153:
4154: <p>Here is an example, taken from mail/mutt/Makefile:</p>
4155: <pre class="programlisting">
4156: EGDIR= ${PREFIX}/share/doc/mutt/samples
4157: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
4158: </pre>
4159:
4160: <p>As you can see, this package installs configuration
4161: files inside <tt class="varname">EGDIR</tt>, which are
4162: registered by <tt class="filename">PLIST</tt>. After
4163: that, the variable <tt class="varname">CONF_FILES</tt>
4164: lists the installed file first and then the target file.
4165: Users will also get an automatic message when files are
4166: installed using this method.</p>
4167: </div>
4168:
4169: <div class="sect1" lang="en" xml:lang="en">
4170: <div class="titlepage">
4171: <div>
4172: <div>
4173: <h2 class="title" style="clear: both"><a name=
4174: "audit-packages" id=
4175: "audit-packages"></a>6.14. Automated security
4176: checks</h2>
4177: </div>
4178: </div>
4179: </div>
4180:
4181: <p>Please be aware that there can often be bugs in
4182: third-party software, and some of these bugs can leave a
4183: machine vulnerable to exploitation by attackers. In an
4184: effort to lessen the exposure, the NetBSD packages team
4185: maintains a database of known-exploits to packages which
4186: have at one time been included in pkgsrc. The database
4187: can be downloaded automatically, and a security audit of
4188: all packages installed on a system can take place. To do
4189: this, install the <a xmlns=
4190: "http://www.w3.org/TR/xhtml1/transitional" href=
4191: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.2 hubertf 4192: class="pkgname">security/audit-packages</a> package.
4193: It has two components:</p>
1.1 grant 4194:
4195: <div class="orderedlist">
4196: <ol type="1">
4197: <li>
4198: <p>“<span class=
4199: "quote">download-vulnerability-list</span>”,
4200: an easy way to download a list of the security
4201: vulnerabilities information. This list is kept up
4202: to date by the NetBSD security officer and the
4203: NetBSD packages team, and is distributed from the
4204: NetBSD ftp server:</p>
4205:
4206: <p><a href=
4207: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.2 hubertf 4208: target=
4209: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 4210: </li>
4211:
4212: <li>
4213: <p>“<span class=
4214: "quote">audit-packages</span>”, an easy way
4215: to audit the current machine, checking each
4216: vulnerability which is known. If a vulnerable
4217: package is installed, it will be shown by output to
4218: stdout, including a description of the type of
4219: vulnerability, and a URL containing more
4220: information.</p>
4221: </li>
4222: </ol>
4223: </div>
4224:
4225: <p>Use of the audit-packages package is strongly
4226: recommended!</p>
4227:
4228: <p>The following message is displayed as part of the
4229: audit-packages installation procedure:</p>
4230: <pre class="screen">
4231: ===========================================================================
4232: $NetBSD: faq.xml,v 1.1.1.1 2004/10/21 14:27:43 grant Exp $
4233:
4234: You may wish to have the vulnerabilities file downloaded daily so that
4235: it remains current. This may be done by adding an appropriate entry
4236: to the root users crontab(5) entry. For example the entry
4237:
4238: # download vulnerabilities file
4239: 0 3 * * * ${PREFIX}/sbin/download-vulnerability-list >/dev/null 2>&1
4240:
4241: will update the vulnerability list every day at 3AM. You may wish to do
4242: this more often than once a day.
4243:
4244: In addition, you may wish to run the package audit from the daily
4245: security script. This may be accomplished by adding the following
4246: lines to /etc/security.local
4247:
4248: if [ -x ${PREFIX}/sbin/audit-packages ]; then
4249: ${PREFIX}/sbin/audit-packages
4250: fi
4251:
4252: ===========================================================================
4253:
4254: </pre>
4255: </div>
4256: </div>
4257: </div>
4258:
4259: <div class="part" lang="en" xml:lang="en">
4260: <div class="titlepage">
4261: <div>
4262: <div>
4263: <h1 class="title"><a name="developers-guide" id=
1.2 hubertf 4264: "developers-guide"></a>The pkgsrc developer's
4265: guide</h1>
1.1 grant 4266: </div>
4267: </div>
4268: </div>
4269:
4270: <div class="toc">
4271: <p><b>Table of Contents</b></p>
4272:
4273: <dl>
4274: <dt><span class="chapter"><a href="#components">7.
4275: Package components - files, directories and
4276: contents</a></span></dt>
4277:
4278: <dd>
4279: <dl>
4280: <dt><span class="sect1"><a href=
4281: "#components.Makefile">7.1. Makefile</a></span></dt>
4282:
4283: <dt><span class="sect1"><a href=
4284: "#components.distinfo">7.2. distinfo</a></span></dt>
4285:
4286: <dt><span class="sect1"><a href=
4287: "#components.patches">7.3. patches/*</a></span></dt>
4288:
1.3 hubertf 4289: <dt><span class="sect1"><a href="#id2566249">7.4.
1.1 grant 4290: Other mandatory files</a></span></dt>
4291:
4292: <dt><span class="sect1"><a href=
4293: "#components.optional">7.5. Optional
4294: files</a></span></dt>
4295:
1.3 hubertf 4296: <dt><span class="sect1"><a href="#id2566443">7.6.
1.1 grant 4297: work*</a></span></dt>
4298:
1.3 hubertf 4299: <dt><span class="sect1"><a href="#id2566531">7.7.
1.1 grant 4300: files/*</a></span></dt>
4301: </dl>
4302: </dd>
4303:
4304: <dt><span class="chapter"><a href="#plist">8. PLIST
4305: issues</a></span></dt>
4306:
4307: <dd>
4308: <dl>
1.3 hubertf 4309: <dt><span class="sect1"><a href="#id2566585">8.1. RCS
1.1 grant 4310: ID</a></span></dt>
4311:
1.3 hubertf 4312: <dt><span class="sect1"><a href="#id2566600">8.2.
1.1 grant 4313: Semi-automatic PLIST generation</a></span></dt>
4314:
4315: <dt><span class="sect1"><a href="#print-PLIST">8.3.
4316: Tweaking output of make print-PLIST</a></span></dt>
4317:
4318: <dt><span class="sect1"><a href="#plist.misc">8.4.
4319: Variable substitution in PLIST</a></span></dt>
4320:
1.3 hubertf 4321: <dt><span class="sect1"><a href="#id2566921">8.5.
1.1 grant 4322: Manpage-compression</a></span></dt>
4323:
1.3 hubertf 4324: <dt><span class="sect1"><a href="#id2566963">8.6.
1.1 grant 4325: Changing PLIST source with PLIST_SRC</a></span></dt>
4326:
1.3 hubertf 4327: <dt><span class="sect1"><a href="#id2566980">8.7.
1.1 grant 4328: Platform specific and differing
4329: PLISTs</a></span></dt>
4330:
4331: <dt><span class="sect1"><a href=
4332: "#faq.common-dirs">8.8. Sharing directories between
4333: packages</a></span></dt>
4334: </dl>
4335: </dd>
4336:
4337: <dt><span class="chapter"><a href="#buildlink">9.
4338: Buildlink methodology</a></span></dt>
4339:
4340: <dd>
4341: <dl>
1.3 hubertf 4342: <dt><span class="sect1"><a href="#id2567252">9.1.
1.1 grant 4343: Converting packages to use buildlink3</a></span></dt>
4344:
1.3 hubertf 4345: <dt><span class="sect1"><a href="#id2567579">9.2.
1.1 grant 4346: Writing buildlink3.mk files</a></span></dt>
4347:
4348: <dd>
4349: <dl>
4350: <dt><span class="sect2"><a href=
1.3 hubertf 4351: "#id2567717">9.2.1. Anatomy of a buildlink3.mk
1.1 grant 4352: file</a></span></dt>
4353:
4354: <dt><span class="sect2"><a href=
1.3 hubertf 4355: "#id2568157">9.2.2. Updating
1.1 grant 4356: BUILDLINK_DEPENDS.pkg in buildlink3.mk
4357: files</a></span></dt>
4358: </dl>
4359: </dd>
4360:
1.3 hubertf 4361: <dt><span class="sect1"><a href="#id2568236">9.3.
1.1 grant 4362: Writing builtin.mk files</a></span></dt>
4363:
4364: <dd>
4365: <dl>
4366: <dt><span class="sect2"><a href=
1.3 hubertf 4367: "#id2568386">9.3.1. Anatomy of a builtin.mk
1.1 grant 4368: file</a></span></dt>
4369:
4370: <dt><span class="sect2"><a href=
1.3 hubertf 4371: "#id2568613">9.3.2. Global preferences for native
1.1 grant 4372: or pkgsrc software</a></span></dt>
4373: </dl>
4374: </dd>
4375: </dl>
4376: </dd>
4377:
4378: <dt><span class="chapter"><a href="#options">10. Options
4379: handling</a></span></dt>
4380:
4381: <dd>
4382: <dl>
1.3 hubertf 4383: <dt><span class="sect1"><a href="#id2568685">10.1.
1.1 grant 4384: Global default options</a></span></dt>
4385:
1.3 hubertf 4386: <dt><span class="sect1"><a href="#id2568700">10.2.
1.1 grant 4387: Converting packages to use
4388: bsd.options.mk</a></span></dt>
4389: </dl>
4390: </dd>
4391:
4392: <dt><span class="chapter"><a href="#build">11. The build
4393: process</a></span></dt>
4394:
4395: <dd>
4396: <dl>
4397: <dt><span class="sect1"><a href="#build.prefix">11.1.
4398: Program location</a></span></dt>
4399:
1.3 hubertf 4400: <dt><span class="sect1"><a href="#id2569445">11.2.
1.1 grant 4401: Main targets</a></span></dt>
4402:
4403: <dt><span class="sect1"><a href=
4404: "#build.helpful-targets">11.3. Other helpful
4405: targets</a></span></dt>
4406: </dl>
4407: </dd>
4408:
4409: <dt><span class="chapter"><a href="#fixes">12. Notes on
4410: fixes for packages</a></span></dt>
4411:
4412: <dd>
4413: <dl>
1.3 hubertf 4414: <dt><span class="sect1"><a href="#id2570842">12.1.
1.1 grant 4415: General operation</a></span></dt>
4416:
4417: <dd>
4418: <dl>
4419: <dt><span class="sect2"><a href=
1.3 hubertf 4420: "#id2570845">12.1.1. How to pull in variables
1.1 grant 4421: from /etc/mk.conf</a></span></dt>
4422:
4423: <dt><span class="sect2"><a href=
1.3 hubertf 4424: "#id2570929">12.1.2. Restricted
1.1 grant 4425: packages</a></span></dt>
4426:
4427: <dt><span class="sect2"><a href=
4428: "#dependencies">12.1.3. Handling
4429: dependencies</a></span></dt>
4430:
4431: <dt><span class="sect2"><a href=
1.3 hubertf 4432: "#id2571444">12.1.4. Handling conflicts with
1.1 grant 4433: other packages</a></span></dt>
4434:
4435: <dt><span class="sect2"><a href=
1.3 hubertf 4436: "#id2571494">12.1.5. Packages that cannot or
1.1 grant 4437: should not be built</a></span></dt>
4438:
4439: <dt><span class="sect2"><a href=
1.3 hubertf 4440: "#id2571520">12.1.6. Packages which should not be
1.1 grant 4441: deleted, once installed</a></span></dt>
4442:
4443: <dt><span class="sect2"><a href=
4444: "#security-handling">12.1.7. Handling packages
4445: with security problems</a></span></dt>
4446:
4447: <dt><span class="sect2"><a href=
1.3 hubertf 4448: "#id2571611">12.1.8. How to handle compiler
1.1 grant 4449: bugs</a></span></dt>
4450:
4451: <dt><span class="sect2"><a href=
1.3 hubertf 4452: "#id2571634">12.1.9. How to handle incrementing
1.1 grant 4453: versions when fixing an existing
4454: package</a></span></dt>
4455:
4456: <dt><span class="sect2"><a href=
1.3 hubertf 4457: "#id2571751">12.1.10. Portability of
1.1 grant 4458: packages</a></span></dt>
4459: </dl>
4460: </dd>
4461:
1.3 hubertf 4462: <dt><span class="sect1"><a href="#id2571776">12.2.
1.1 grant 4463: Possible downloading issues</a></span></dt>
4464:
4465: <dd>
4466: <dl>
4467: <dt><span class="sect2"><a href=
1.3 hubertf 4468: "#id2571779">12.2.1. Packages whose distfiles
1.1 grant 4469: aren't available for plain
4470: downloading</a></span></dt>
4471:
4472: <dt><span class="sect2"><a href=
1.3 hubertf 4473: "#id2571978">12.2.2. How to handle modified
1.1 grant 4474: distfiles with the 'old' name</a></span></dt>
4475: </dl>
4476: </dd>
4477:
1.3 hubertf 4478: <dt><span class="sect1"><a href="#id2571990">12.3.
1.1 grant 4479: Configuration gotchas</a></span></dt>
4480:
4481: <dd>
4482: <dl>
4483: <dt><span class="sect2"><a href=
4484: "#fixes.libtool">12.3.1. Shared libraries -
4485: libtool</a></span></dt>
4486:
4487: <dt><span class="sect2"><a href=
1.3 hubertf 4488: "#id2572397">12.3.2. Using libtool on GNU
1.1 grant 4489: packages that already support
4490: libtool</a></span></dt>
4491:
4492: <dt><span class="sect2"><a href=
1.3 hubertf 4493: "#id2572482">12.3.3. GNU
1.1 grant 4494: Autoconf/Automake</a></span></dt>
4495: </dl>
4496: </dd>
4497:
1.3 hubertf 4498: <dt><span class="sect1"><a href="#id2572526">12.4.
1.1 grant 4499: Building considerations</a></span></dt>
4500:
4501: <dd>
4502: <dl>
4503: <dt><span class="sect2"><a href=
1.3 hubertf 4504: "#id2572530">12.4.1. CPP defines</a></span></dt>
1.1 grant 4505: </dl>
4506: </dd>
4507:
1.3 hubertf 4508: <dt><span class="sect1"><a href="#id2572560">12.5.
1.1 grant 4509: Package specific actions</a></span></dt>
4510:
4511: <dd>
4512: <dl>
4513: <dt><span class="sect2"><a href=
1.3 hubertf 4514: "#id2572563">12.5.1. Package configuration
1.1 grant 4515: files</a></span></dt>
4516:
4517: <dt><span class="sect2"><a href=
1.3 hubertf 4518: "#id2572733">12.5.2. User
1.2 hubertf 4519: interaction</a></span></dt>
1.1 grant 4520:
4521: <dt><span class="sect2"><a href=
1.3 hubertf 4522: "#id2572778">12.5.3. Handling
1.1 grant 4523: licenses</a></span></dt>
4524:
4525: <dt><span class="sect2"><a href=
1.3 hubertf 4526: "#id2572861">12.5.4. Creating an account from a
1.1 grant 4527: package</a></span></dt>
4528:
4529: <dt><span class="sect2"><a href=
1.3 hubertf 4530: "#id2572992">12.5.5. Installing score
1.1 grant 4531: files</a></span></dt>
4532:
4533: <dt><span class="sect2"><a href=
1.3 hubertf 4534: "#id2573035">12.5.6. Packages providing login
1.1 grant 4535: shells</a></span></dt>
4536:
4537: <dt><span class="sect2"><a href=
1.3 hubertf 4538: "#id2573161">12.5.7. Packages containing perl
1.1 grant 4539: scripts</a></span></dt>
4540:
4541: <dt><span class="sect2"><a href=
1.3 hubertf 4542: "#id2573248">12.5.8. Packages with hardcoded
1.1 grant 4543: paths to other interpreters</a></span></dt>
4544:
4545: <dt><span class="sect2"><a href=
1.3 hubertf 4546: "#id2573269">12.5.9. Packages installing perl
1.1 grant 4547: modules</a></span></dt>
4548:
4549: <dt><span class="sect2"><a href=
4550: "#faq.info-files">12.5.10. Packages installing
4551: info files</a></span></dt>
4552:
4553: <dt><span class="sect2"><a href=
1.3 hubertf 4554: "#id2573557">12.5.11. Packages installing GConf2
1.1 grant 4555: data files</a></span></dt>
4556:
4557: <dt><span class="sect2"><a href=
1.3 hubertf 4558: "#id2573657">12.5.12. Packages installing
1.1 grant 4559: scrollkeeper data files</a></span></dt>
4560:
4561: <dt><span class="sect2"><a href=
1.3 hubertf 4562: "#id2573708">12.5.13. Packages installing X11
1.1 grant 4563: fonts</a></span></dt>
4564:
4565: <dt><span class="sect2"><a href=
1.3 hubertf 4566: "#id2573824">12.5.14. Packages installing GTK2
1.1 grant 4567: modules</a></span></dt>
4568:
4569: <dt><span class="sect2"><a href=
1.3 hubertf 4570: "#id2573893">12.5.15. Packages installing SGML or
1.1 grant 4571: XML data</a></span></dt>
4572:
4573: <dt><span class="sect2"><a href=
1.3 hubertf 4574: "#id2573945">12.5.16. Packages installing
1.1 grant 4575: extensions to the MIME database</a></span></dt>
4576:
4577: <dt><span class="sect2"><a href=
1.3 hubertf 4578: "#id2574016">12.5.17. Packages using
1.1 grant 4579: intltool</a></span></dt>
4580: </dl>
4581: </dd>
4582:
1.3 hubertf 4583: <dt><span class="sect1"><a href="#id2574029">12.6.
1.1 grant 4584: Feedback to the author</a></span></dt>
4585: </dl>
4586: </dd>
4587:
4588: <dt><span class="chapter"><a href="#debug">13.
4589: Debugging</a></span></dt>
4590:
4591: <dt><span class="chapter"><a href="#submit">14.
4592: Submitting and Committing</a></span></dt>
4593:
4594: <dd>
4595: <dl>
1.3 hubertf 4596: <dt><span class="sect1"><a href="#id2574491">14.1.
1.1 grant 4597: Submitting your packages</a></span></dt>
4598:
1.3 hubertf 4599: <dt><span class="sect1"><a href="#id2574538">14.2.
1.1 grant 4600: Committing: Importing a package into
4601: CVS</a></span></dt>
4602:
1.3 hubertf 4603: <dt><span class="sect1"><a href="#id2574738">14.3.
1.2 hubertf 4604: Updating a package to a newer version</a></span></dt>
1.1 grant 4605:
1.3 hubertf 4606: <dt><span class="sect1"><a href="#id2574825">14.4.
1.2 hubertf 4607: Moving a package in pkgsrc</a></span></dt>
1.1 grant 4608: </dl>
4609: </dd>
4610: </dl>
4611: </div>
4612:
4613: <div class="chapter" lang="en" xml:lang="en">
4614: <div class="titlepage">
4615: <div>
4616: <div>
4617: <h2 class="title"><a name="components" id=
4618: "components"></a>Chapter 7. Package
4619: components - files, directories and contents</h2>
4620: </div>
4621: </div>
4622: </div>
4623:
4624: <div class="toc">
4625: <p><b>Table of Contents</b></p>
4626:
4627: <dl>
4628: <dt><span class="sect1"><a href=
4629: "#components.Makefile">7.1. Makefile</a></span></dt>
4630:
4631: <dt><span class="sect1"><a href=
4632: "#components.distinfo">7.2. distinfo</a></span></dt>
4633:
4634: <dt><span class="sect1"><a href=
4635: "#components.patches">7.3. patches/*</a></span></dt>
4636:
1.3 hubertf 4637: <dt><span class="sect1"><a href="#id2566249">7.4. Other
1.1 grant 4638: mandatory files</a></span></dt>
4639:
4640: <dt><span class="sect1"><a href=
4641: "#components.optional">7.5. Optional
4642: files</a></span></dt>
4643:
1.3 hubertf 4644: <dt><span class="sect1"><a href="#id2566443">7.6.
1.1 grant 4645: work*</a></span></dt>
4646:
1.3 hubertf 4647: <dt><span class="sect1"><a href="#id2566531">7.7.
1.1 grant 4648: files/*</a></span></dt>
4649: </dl>
4650: </div>
4651:
4652: <p>Whenever you're preparing a package, there are a number
4653: of files involved which are described in the following
4654: sections.</p>
4655:
4656: <div class="sect1" lang="en" xml:lang="en">
4657: <div class="titlepage">
4658: <div>
4659: <div>
4660: <h2 class="title" style="clear: both"><a name=
4661: "components.Makefile" id=
4662: "components.Makefile"></a>7.1. <tt class=
4663: "filename">Makefile</tt></h2>
4664: </div>
4665: </div>
4666: </div>
4667:
4668: <p>Building, installation and creation of a binary
4669: package are all controlled by the package's <tt class=
4670: "filename">Makefile</tt>.</p>
4671:
4672: <p>There is a <tt class="filename">Makefile</tt> for each
4673: package. This file includes the standard <tt class=
4674: "filename">bsd.pkg.mk</tt> file (referenced as <tt class=
4675: "filename">../../mk/bsd.pkg.mk</tt>), which sets all the
4676: definitions and actions necessary for the package to
4677: compile and install itself. The mandatory variables are
4678: the <tt class="varname">DISTNAME</tt> which specifies the
4679: base name of the distribution file to be downloaded from
4680: the site on the Internet, <tt class=
4681: "varname">MASTER_SITES</tt> which specifies that site,
4682: <tt class="varname">CATEGORIES</tt> which denotes the
4683: categories into which the package falls, <tt class=
4684: "varname">PKGNAME</tt> which is the name of the package,
4685: the <tt class="varname">MAINTAINER</tt>'s name, and the
4686: <tt class="varname">COMMENT</tt> variable, which should
4687: contain a one-line description of the package (the
4688: package name should not appear, it will be added
4689: automatically). The maintainer variable is there so that
4690: anyone who quibbles with the (always completely correct)
4691: decisions taken by the guy who maintains the package can
4692: complain vigorously, or send chocolate as a sign of
4693: appreciation.</p>
4694:
4695: <p>The <tt class="varname">MASTER_SITES</tt> may be set
4696: to one of the predefined sites:</p>
4697: <pre class="programlisting">
4698: ${MASTER_SITE_APACHE}
4699: ${MASTER_SITE_DEBIAN}
4700: ${MASTER_SITE_GNOME}
4701: ${MASTER_SITE_GNU}
4702: ${MASTER_SITE_GNUSTEP}
4703: ${MASTER_SITE_MOZILLA}
4704: ${MASTER_SITE_PERL_CPAN}
4705: ${MASTER_SITE_SOURCEFORGE}
4706: ${MASTER_SITE_SUNSITE}
4707: ${MASTER_SITE_R_CRAN}
4708: ${MASTER_SITE_SUSE}
4709: ${MASTER_SITE_TEX_CTAN}
4710: ${MASTER_SITE_XCONTRIB}
4711: ${MASTER_SITE_XEMACS}
4712: </pre>
4713:
4714: <p>If one of these predefined sites is chosen, you may
4715: require the ability to specify a subdirectory of that
4716: site. Since these macros may expand to more than one
4717: actual site, you <span class=
4718: "emphasis"><em>must</em></span> use the following
4719: construct to specify a subdirectory:</p>
4720: <pre class="programlisting">
4721: ${MASTER_SITE_GNU:=subdirectory/name/}
4722: ${MASTER_SITE_SOURCEFORGE:=project_name/}
4723: </pre>
4724:
4725: <p>Note the trailing slash after the subdirectory
4726: name.</p>
4727:
4728: <div class="note" style=
4729: "margin-left: 0.5in; margin-right: 0.5in;">
4730: <h3 class="title">Note</h3>
4731:
4732: <p><tt class="varname">MASTER_SITE_SUBDIR</tt> has been
4733: deprecated and <span class="emphasis"><em>should no
4734: longer be used</em></span>.</p>
4735: </div>
4736:
4737: <p>If the package has multiple <tt class=
4738: "varname">DISTFILES</tt> or multiple <tt class=
4739: "varname">PATCHFILES</tt> from different sites, set
4740: <tt class="varname">SITES_foo</tt> to a list of URI's
4741: where file “<span class="quote">foo</span>”
4742: may be found. “<span class=
4743: "quote">foo</span>” includes the suffix, e.g.</p>
4744: <pre class="programlisting">
4745: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
4746: DISTFILES+= foo-file.tar.gz
4747: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
4748: http://www.somewhereelse.com/mirror/somehow/
4749: </pre>
4750:
4751: <p>Note that the normal default setting of <tt class=
4752: "varname">DISTFILES</tt> must be made explicit if you
4753: want to add to it (rather than replace it), as you
4754: usually would.</p>
4755:
4756: <p>Currently the following values are available for
4757: <tt class="varname">CATEGORIES</tt>. If more than one is
4758: used, they need to be separated by spaces:</p>
4759: <pre class="programlisting">
4760: archivers cross geography meta-pkgs security
4761: audio databases graphics misc shells
4762: benchmarks devel ham multimedia sysutils
4763: biology editors inputmethod net textproc
4764: cad emulators lang news time
4765: chat finance mail parallel wm
4766: comms fonts math pkgtools www
4767: converters games mbone print x11
4768: </pre>
4769:
4770: <p>Please pay attention to the following gotchas:</p>
4771:
4772: <div class="itemizedlist">
4773: <ul type="disc">
4774: <li>
4775: <p>Add <tt class="varname">MANCOMPRESSED</tt> if
4776: manpages are installed in compressed form by the
4777: package; see comment in <tt class=
4778: "filename">bsd.pkg.mk</tt>.</p>
4779: </li>
4780:
4781: <li>
4782: <p>Replace <tt class="filename">/usr/local</tt>
4783: with “<span class=
4784: "quote">${PREFIX}</span>” in all files (see
4785: patches, below).</p>
4786: </li>
4787:
4788: <li>
4789: <p>If the package installs any info files, see
4790: <a href="#faq.info-files" title=
4791: "12.5.10. Packages installing info files">Section
4792: 12.5.10, “Packages installing info
4793: files”</a>.</p>
4794: </li>
4795:
4796: <li>
4797: <p>Set <tt class="varname">MAINTAINER</tt> to be
4798: yourself. If you really can't maintain the package
4799: for future updates, set it to <tt class=
4800: "email"><<a href=
4801: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></tt>.</p>
4802: </li>
4803:
4804: <li>
4805: <p>If a home page for the software in question
4806: exists, add the variable <tt class=
4807: "varname">HOMEPAGE</tt> right after <tt class=
4808: "varname">MAINTAINER</tt>. The value of this
4809: variable should be the URL for the home page.</p>
4810: </li>
4811:
4812: <li>
4813: <p>Be sure to set the <tt class=
4814: "varname">COMMENT</tt> variable to a short
4815: description of the package, not containing the
4816: pkg's name.</p>
4817: </li>
4818: </ul>
4819: </div>
4820: </div>
4821:
4822: <div class="sect1" lang="en" xml:lang="en">
4823: <div class="titlepage">
4824: <div>
4825: <div>
4826: <h2 class="title" style="clear: both"><a name=
4827: "components.distinfo" id=
4828: "components.distinfo"></a>7.2. <tt class=
4829: "filename">distinfo</tt></h2>
4830: </div>
4831: </div>
4832: </div>
4833:
4834: <p>Most important, the mandatory message digest, or
4835: checksum, of all the distfiles needed for the package to
4836: compile, confirming they match the original file
4837: distributed by the author. This ensures that the distfile
4838: retrieved from the Internet has not been corrupted during
4839: transfer or altered by a malign force to introduce a
4840: security hole. It is generated using the <span><b class=
4841: "command">make makesum</b></span> command. The digest
4842: algorithm used was, at one stage, md5, but that was felt
4843: lacking compared to sha1, and so sha1 is now the default
4844: algorithm. The distfile size is also generated and stored
4845: in new distinfo files. The <a xmlns=
4846: "http://www.w3.org/TR/xhtml1/transitional" href=
4847: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.2 hubertf 4848: class="pkgname">pkgtools/digest</a> utility calculates
4849: all of the digests in the distinfo file, and it
4850: provides various different algorithms. At the current
4851: time, the algorithms provided are: <span class=
4852: "emphasis"><em>md5</em></span>, <span class=
4853: "emphasis"><em>rmd160</em></span>, <span class=
4854: "emphasis"><em>sha1</em></span>, <span class=
4855: "emphasis"><em>sha256</em></span>, <span class=
4856: "emphasis"><em>sha384</em></span> and <span class=
4857: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 4858:
4859: <p>Some packages have different sets of distfiles on a
4860: per architecture basis, for example <a xmlns=
4861: "http://www.w3.org/TR/xhtml1/transitional" href=
4862: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.2 hubertf 4863: class="pkgname">www/navigator</a>). These are kept in
4864: the same distinfo file and care should be taken when
4865: upgrading such a package to ensure distfile
4866: information is not lost.</p>
1.1 grant 4867:
4868: <p>The message digest/checksum for all the official
4869: patches found in the <tt class="filename">patches/</tt>
4870: directory (see <a href="#components.patches" title=
4871: "7.3. patches/*">Section 7.3,
4872: “patches/*”</a>) for the package is also
4873: stored in the <tt class="filename">distinfo</tt> file.
4874: This is a message digest/checksum of all lines in the
4875: patch file except the NetBSD RCS Id. This file is
4876: generated by invoking <span><b class="command">make
4877: makepatchsum</b></span> (or <span><b class="command">make
4878: mps</b></span> if you're in a hurry).</p>
4879: </div>
4880:
4881: <div class="sect1" lang="en" xml:lang="en">
4882: <div class="titlepage">
4883: <div>
4884: <div>
4885: <h2 class="title" style="clear: both"><a name=
4886: "components.patches" id=
4887: "components.patches"></a>7.3. patches/*</h2>
4888: </div>
4889: </div>
4890: </div>
4891:
4892: <p>This directory contains files that are used by the
4893: <a href=
4894: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
4895: <span class="citerefentry"><span class=
4896: "refentrytitle">patch</span>(1)</span></a> command to
4897: modify the sources as distributed in the distribution
4898: file into a form that will compile and run perfectly on
4899: NetBSD. The files are applied successively in alphabetic
4900: order (as returned by a shell “<span class=
4901: "quote">patches/patch-*</span>” glob expansion), so
4902: <tt class="filename">patch-aa</tt> is applied before
4903: <tt class="filename">patch-ab</tt>, etc.</p>
4904:
4905: <p>Patch files which are optional and will depend on
4906: local site configuration can be included with names
4907: matching the pattern <tt class=
4908: "filename">patches/patch-optional-*</tt>. Their suffixes
4909: should match the configuration options. The selected
4910: optional patch file names should be assigned to the
4911: variable <tt class="varname">OPTIONAL_PATCHFILES</tt>.
4912: They will not be applied by default.</p>
4913:
4914: <p>For example if a package data file needs patching to
4915: indicate the default local printer paper size as
4916: specified in the <tt class="varname">$PAPERSIZE</tt> file
4917: you can include patches for all the possible paper sizes
4918: other than the one the package comes configured for by
4919: default. In this case you might have a patch called
4920: "<tt class=
4921: "filename">patch-optional-Letter-papersize</tt>" and/or
4922: another patch called "<tt class=
4923: "filename">patch-optional-A4-papersize</tt>". In your
4924: <tt class="filename">Makefile</tt> you would select
4925: between them with the following construct:</p>
4926: <pre class="programlisting">
4927:
4928: PATCHDIR= ${.CURDIR}/patches
4929: .if exists(${PATCHDIR}/patch-optional-${PAPERSIZE}-papersize)
4930: OPTIONAL_PATCHFILES+= ${PATCHDIR}/patch-optional-${PAPERSIZE}-papersize
4931: .endif
4932: </pre>
4933:
4934: <p>Note that you have to define the value of <tt class=
4935: "varname">PATCHDIR</tt> in order to use it in a
4936: “<span class="quote"><span><b class=
4937: "command">.if</b></span></span>” statement like
4938: this as otherwise it's not defined until too late during
4939: the processing of the Makefile. You should use a
4940: “<span class="quote"><span><b class=
4941: "command">.if</b></span></span>” statement in order
4942: to avoid problems should the configuration item
4943: (<tt class="varname">$PAPERSIZE</tt> in this example) be
4944: set to an unexpected value.</p>
4945:
4946: <p>The <tt class="filename">patch-*</tt> files should be
4947: in <span><b class="command">diff -bu</b></span> format,
4948: and apply without a fuzz to avoid problems. (To force
4949: patches to apply with fuzz you can set <tt class=
4950: "varname">PATCH_FUZZ_FACTOR=-F2</tt>). Furthermore, do
4951: not put changes for more than one file into a single
4952: patch-file, as this will make future modifications more
4953: difficult.</p>
4954:
4955: <p>Similar, a file should be patched at most once, not
4956: several times by several different patches. If a file
4957: needs several patches, they should be combined into one
4958: file.</p>
4959:
4960: <p>One important thing to mention is to pay attention
4961: that no RCS IDs get stored in the patch files, as these
4962: will cause problems when later checked into the NetBSD
4963: CVS tree. Use the <span><b class=
4964: "command">pkgdiff</b></span> from the <a xmlns=
4965: "http://www.w3.org/TR/xhtml1/transitional" href=
4966: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.2 hubertf 4967: class="pkgname">pkgtools/pkgdiff</a> package to avoid
4968: these problems.</p>
1.1 grant 4969:
4970: <p>For even more automation, we recommend using
4971: <span><b class="command">mkpatches</b></span> from the
4972: same package to make a whole set of patches. You just
4973: have to backup files before you edit them to <tt class=
4974: "filename">filename.orig</tt>, e.g. with <span><b class=
4975: "command">cp -p filename filename.orig</b></span> or,
4976: easier, by using <span><b class=
4977: "command">pkgvi</b></span> again from the same package.
4978: If you upgrade a package this way, you can easily compare
4979: the new set of patches with the previously existing one
4980: with <span><b class="command">patchdiff</b></span>.</p>
4981:
4982: <p>When you have finished a package, remember to generate
4983: the checksums for the patch files by using the
4984: <span><b class="command">make makepatchsum</b></span>
4985: command, see <a href="#components.distinfo" title=
4986: "7.2. distinfo">Section 7.2,
4987: “distinfo”</a>.</p>
4988:
4989: <p>Patch files that are distributed by the author or
4990: other maintainers can be listed in <tt class=
4991: "varname">$PATCHFILES</tt>.</p>
4992:
4993: <p>If it is desired to store any patches that should not
4994: be committed into pkgsrc, they can be kept outside the
4995: pkgsrc tree in the <tt class=
4996: "filename">$LOCALPATCHES</tt> directory. The directory
4997: tree there is expected to have the same
4998: “<span class="quote">category/package</span>”
4999: structure as pkgsrc, and patches are expected to be
5000: stored inside these dirs (also known as <tt class=
5001: "filename">$LOCALPATCHES/$PKGPATH</tt>). For example if
5002: you want to keep a private patch for <tt class=
5003: "filename">pkgsrc/graphics/png</tt>, keep it in
5004: <tt class="filename">$LOCALPATCHES/graphics/png/mypatch</tt>.
5005: All files in the named directory are expected to be patch
5006: files, and <span class="emphasis"><em>they are applied
5007: after pkgsrc patches are applied</em></span>.</p>
5008: </div>
5009:
5010: <div class="sect1" lang="en" xml:lang="en">
5011: <div class="titlepage">
5012: <div>
5013: <div>
5014: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 5015: "id2566249" id="id2566249"></a>7.4. Other
1.1 grant 5016: mandatory files</h2>
5017: </div>
5018: </div>
5019: </div>
5020:
5021: <div class="variablelist">
5022: <dl>
5023: <dt><span class="term"><tt class=
5024: "filename">DESCR</tt></span></dt>
5025:
5026: <dd>
5027: <p>A multi-line description of the piece of
5028: software. This should include any credits where
5029: they are due. Please bear in mind that others do
5030: not share your sense of humour (or spelling
5031: idiosyncrasies), and that others will read
5032: everything that you write here.</p>
5033: </dd>
5034:
5035: <dt><span class="term"><tt class=
5036: "filename">PLIST</tt></span></dt>
5037:
5038: <dd>
5039: <p>This file governs the files that are installed
5040: on your system: all the binaries, manual pages,
5041: etc. There are other directives which may be
5042: entered in this file, to control the creation and
5043: deletion of directories, and the location of
5044: inserted files. See <a href="#plist" title=
5045: "Chapter 8. PLIST issues">Chapter 8,
5046: <i>PLIST issues</i></a> for more information.</p>
5047: </dd>
5048: </dl>
5049: </div>
5050: </div>
5051:
5052: <div class="sect1" lang="en" xml:lang="en">
5053: <div class="titlepage">
5054: <div>
5055: <div>
5056: <h2 class="title" style="clear: both"><a name=
5057: "components.optional" id=
5058: "components.optional"></a>7.5. Optional
5059: files</h2>
5060: </div>
5061: </div>
5062: </div>
5063:
5064: <div class="variablelist">
5065: <dl>
5066: <dt><span class="term"><tt class=
5067: "filename">INSTALL</tt></span></dt>
5068:
5069: <dd>
5070: <p>This shell script is invoked twice by <a href=
5071: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5072: <span class="citerefentry"><span class=
5073: "refentrytitle">pkg_add</span>(1)</span></a>. First
5074: time after package extraction and before files are
5075: moved in place, the second time after the files to
5076: install are moved in place. This can be used to do
5077: any custom procedures not possible with @exec
5078: commands in <tt class="filename">PLIST</tt>. See
5079: <a href=
5080: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5081: <span class="citerefentry"><span class=
5082: "refentrytitle">pkg_add</span>(1)</span></a> and
5083: <a href=
5084: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5085: <span class="citerefentry"><span class=
5086: "refentrytitle">pkg_create</span>(1)</span></a> for
5087: more information.</p>
5088: </dd>
5089:
5090: <dt><span class="term"><tt class=
5091: "filename">DEINSTALL</tt></span></dt>
5092:
5093: <dd>
5094: <p>This script is executed before and after any
5095: files are removed. It is this script's
5096: responsibility to clean up any additional messy
5097: details around the package's installation, since
5098: all pkg_delete knows is how to delete the files
5099: created in the original distribution. See <a href=
5100: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
5101: <span class="citerefentry"><span class=
5102: "refentrytitle">pkg_delete</span>(1)</span></a> and
5103: <a href=
5104: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5105: <span class="citerefentry"><span class=
5106: "refentrytitle">pkg_create</span>(1)</span></a> for
5107: more information.</p>
5108: </dd>
5109:
5110: <dt><span class="term"><tt class=
5111: "filename">MESSAGE</tt></span></dt>
5112:
5113: <dd>
5114: <p>Display this file after installation of the
5115: package. Useful for things like legal notices on
5116: almost-free software and hints for updating config
5117: files after installing modules for apache, PHP etc.
5118: Please note that you can modify variables in it
5119: easily by using <tt class=
5120: "varname">MESSAGE_SUBST</tt> in the package's
5121: <tt class="filename">Makefile</tt>:</p>
5122: <pre class="programlisting">
5123: MESSAGE_SUBST+= SOMEVAR="somevalue"
5124: </pre>
5125:
5126: <p>replaces "${SOMEVAR}" with “<span class=
5127: "quote">somevalue</span>” in <tt class=
5128: "filename">MESSAGE</tt>.</p>
5129: </dd>
5130: </dl>
5131: </div>
5132: </div>
5133:
5134: <div class="sect1" lang="en" xml:lang="en">
5135: <div class="titlepage">
5136: <div>
5137: <div>
5138: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 5139: "id2566443" id="id2566443"></a>7.6. <tt class=
1.1 grant 5140: "filename">work*</tt></h2>
5141: </div>
5142: </div>
5143: </div>
5144:
5145: <p>When you type <span><b class="command">make</b></span>
5146: the distribution files are unpacked into this directory.
5147: It can be removed by running <span><b class=
5148: "command">make clean</b></span>. Besides the sources,
5149: this directory is also used to keep various timestamp
5150: files.</p>
5151:
5152: <p>If a package doesn't create a subdirectory for itself
5153: (like GNU software does, for instance), but extracts
5154: itself in the current directory, you should set
5155: <tt class="varname">WRKSRC</tt> accordingly, e.g.
5156: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
5157: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.2 hubertf 5158: class="pkgname">editors/sam</a> again, but the quick
5159: answer is:</p>
1.1 grant 5160: <pre class="programlisting">
5161: WRKSRC= ${WRKDIR}
5162: </pre>
5163:
5164: <p>Please note that the old <tt class=
5165: "varname">NO_WRKSUBDIR</tt> has been deprecated and
5166: should not be used. Also, if your package doesn't create
5167: a subdir with the name of <tt class=
5168: "varname">DISTNAME</tt> but some different name, set
5169: <tt class="varname">WRKSRC</tt> to point to the proper
5170: name in <tt class="filename">${WRKDIR}</tt>. See
5171: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
5172: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.2 hubertf 5173: class="pkgname">lang/tcl</a> and <a xmlns=
5174: "http://www.w3.org/TR/xhtml1/transitional" href=
5175: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
5176: class="pkgname">x11/tk</a> for examples, and here is
5177: another one:</p>
1.1 grant 5178: <pre class="programlisting">
5179: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
5180: </pre>
5181:
5182: <p>The name of the working directory created by pkgsrc is
5183: <tt class="filename">work</tt> by default. If the same
5184: pkgsrc tree should be used on several different
5185: platforms, the variable <tt class=
5186: "varname">OBJMACHINE</tt> can be set in /etc/mk.conf to
5187: attach the platform to the directory name, e.g.
5188: <tt class="filename">work.i386</tt> or <tt class=
5189: "filename">work.sparc</tt>.</p>
5190: </div>
5191:
5192: <div class="sect1" lang="en" xml:lang="en">
5193: <div class="titlepage">
5194: <div>
5195: <div>
5196: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 5197: "id2566531" id="id2566531"></a>7.7. <tt class=
1.1 grant 5198: "filename">files/*</tt></h2>
5199: </div>
5200: </div>
5201: </div>
5202:
5203: <p>If you have any files that you wish to be placed in
5204: the package prior to configuration or building, you could
5205: place these files here and use a “<span class=
5206: "quote">${CP}</span>” command in the
5207: “<span class="quote">pre-configure</span>”
5208: target to achieve this. Alternatively, you could simply
5209: diff the file against <tt class="filename">/dev/null</tt>
5210: and use the patch mechanism to manage the creation of
5211: this file.</p>
5212: </div>
5213: </div>
5214:
5215: <div class="chapter" lang="en" xml:lang="en">
5216: <div class="titlepage">
5217: <div>
5218: <div>
5219: <h2 class="title"><a name="plist" id=
5220: "plist"></a>Chapter 8. PLIST issues</h2>
5221: </div>
5222: </div>
5223: </div>
5224:
5225: <div class="toc">
5226: <p><b>Table of Contents</b></p>
5227:
5228: <dl>
1.3 hubertf 5229: <dt><span class="sect1"><a href="#id2566585">8.1. RCS
1.1 grant 5230: ID</a></span></dt>
5231:
1.3 hubertf 5232: <dt><span class="sect1"><a href="#id2566600">8.2.
1.1 grant 5233: Semi-automatic PLIST generation</a></span></dt>
5234:
5235: <dt><span class="sect1"><a href="#print-PLIST">8.3.
5236: Tweaking output of make print-PLIST</a></span></dt>
5237:
5238: <dt><span class="sect1"><a href="#plist.misc">8.4.
5239: Variable substitution in PLIST</a></span></dt>
5240:
1.3 hubertf 5241: <dt><span class="sect1"><a href="#id2566921">8.5.
1.1 grant 5242: Manpage-compression</a></span></dt>
5243:
1.3 hubertf 5244: <dt><span class="sect1"><a href="#id2566963">8.6.
1.1 grant 5245: Changing PLIST source with PLIST_SRC</a></span></dt>
5246:
1.3 hubertf 5247: <dt><span class="sect1"><a href="#id2566980">8.7.
1.1 grant 5248: Platform specific and differing PLISTs</a></span></dt>
5249:
5250: <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
5251: Sharing directories between packages</a></span></dt>
5252: </dl>
5253: </div>
5254:
5255: <p>The <tt class="filename">PLIST</tt> file contains a
5256: package's “<span class="quote">packing
5257: list</span>”, i.e. a list of files that belong to the
5258: package (relative to the <tt class=
5259: "filename">${PREFIX}</tt> directory it's been installed in)
5260: plus some additional statements - see the <a href=
5261: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5262: <span class="citerefentry"><span class=
5263: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
5264: a full list. This chapter addresses some issues that need
5265: attention when dealing with the <tt class=
5266: "filename">PLIST</tt> file (or files, see below!).</p>
5267:
5268: <div class="sect1" lang="en" xml:lang="en">
5269: <div class="titlepage">
5270: <div>
5271: <div>
5272: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 5273: "id2566585" id="id2566585"></a>8.1. RCS
1.1 grant 5274: ID</h2>
5275: </div>
5276: </div>
5277: </div>
5278:
5279: <p>Be sure to add a RCS ID line as the first thing in any
5280: <tt class="filename">PLIST</tt> file you write:</p>
5281: <pre class="programlisting">
5282: @comment $NetBSD$
5283: </pre>
5284: </div>
5285:
5286: <div class="sect1" lang="en" xml:lang="en">
5287: <div class="titlepage">
5288: <div>
5289: <div>
5290: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 5291: "id2566600" id=
5292: "id2566600"></a>8.2. Semi-automatic <tt class=
1.1 grant 5293: "filename">PLIST</tt> generation</h2>
5294: </div>
5295: </div>
5296: </div>
5297:
5298: <p>You can use the <span><b class="command">make
5299: print-PLIST</b></span> command to output a PLIST that
5300: matches any new files since the package was extracted.
5301: See <a href="#build.helpful-targets" title=
5302: "11.3. Other helpful targets">Section 11.3,
5303: “Other helpful targets”</a> for more
5304: information on this target.</p>
5305: </div>
5306:
5307: <div class="sect1" lang="en" xml:lang="en">
5308: <div class="titlepage">
5309: <div>
5310: <div>
5311: <h2 class="title" style="clear: both"><a name=
5312: "print-PLIST" id=
5313: "print-PLIST"></a>8.3. Tweaking output of
5314: <span><b class="command">make
5315: print-PLIST</b></span></h2>
5316: </div>
5317: </div>
5318: </div>
5319:
5320: <p>If you have used any of the *-dirs packages, as
5321: explained in <a href="#faq.common-dirs" title=
5322: "8.8. Sharing directories between packages">Section 8.8,
5323: “Sharing directories between packages”</a>,
5324: you may have noticed that <span><b class="command">make
5325: print-PLIST</b></span> outputs a set of <tt class=
5326: "varname">@comment</tt>s instead of real <tt class=
5327: "varname">@dirrm</tt> lines. You can also do this for
5328: specific directories and files, so that the results of
5329: that command are very close to reality. This helps
5330: <span class="emphasis"><em>a lot</em></span> during the
5331: update of packages.</p>
5332:
5333: <p>The <tt class="varname">PRINT_PLIST_AWK</tt> variable
5334: takes a set of AWK patterns and actions that are used to
5335: filter the output of print-PLIST. You can <span class=
5336: "emphasis"><em>append</em></span> any chunk of AWK
5337: scripting you like to it, but be careful with
5338: quoting.</p>
5339:
5340: <p>For example, to get all files inside the <tt class=
5341: "filename">libdata/foo</tt> directory removed from the
5342: resulting PLIST:</p>
5343: <pre class="programlisting">
5344: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
5345:
5346: </pre>
5347:
5348: <p>And to get all the <tt class="varname">@dirrm</tt>
5349: lines referring to a specific (shared) directory
5350: converted to <tt class="varname">@comment</tt>s:</p>
5351: <pre class="programlisting">
5352: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
5353:
5354: </pre>
5355: </div>
5356:
5357: <div class="sect1" lang="en" xml:lang="en">
5358: <div class="titlepage">
5359: <div>
5360: <div>
5361: <h2 class="title" style="clear: both"><a name=
5362: "plist.misc" id="plist.misc"></a>8.4. Variable
5363: substitution in PLIST</h2>
5364: </div>
5365: </div>
5366: </div>
5367:
5368: <p>A number of variables are substituted automatically in
5369: PLISTs when a package is installed on a system. This
5370: includes the following variables:</p>
5371:
5372: <div class="variablelist">
5373: <dl>
5374: <dt><span class="term"><tt class=
5375: "varname">${MACHINE_ARCH}</tt>, <tt class=
5376: "varname">${MACHINE_GNU_ARCH}</tt></span></dt>
5377:
5378: <dd>
5379: <p>Some packages like emacs and perl embed
5380: information about which architecture they were
5381: built on into the pathnames where they install
5382: their file. To handle this case, PLIST will be
5383: preprocessed before actually used, and the symbol
5384: “<span class="quote"><tt class=
5385: "varname">${MACHINE_ARCH}</tt></span>” will
5386: be replaced by what <span><b class="command">uname
5387: -p</b></span> gives. The same is done if the string
5388: <tt class="varname">${MACHINE_GNU_ARCH}</tt> is
5389: embedded in PLIST somewhere - use this on packages
5390: that have GNU autoconf created configure
5391: scripts.</p>
5392:
5393: <div class="note" style=
5394: "margin-left: 0.5in; margin-right: 0.5in;">
5395: <h3 class="title">Legacy note</h3>
5396:
5397: <p>There used to be a symbol “<span class=
5398: "quote"><tt class=
5399: "varname">$ARCH</tt></span>” that was
5400: replaced by the output of <span><b class=
5401: "command">uname -m</b></span>, but that's no
5402: longer supported and has been removed.</p>
5403: </div>
5404: </dd>
5405:
5406: <dt><span class="term"><tt class=
5407: "varname">${OPSYS}</tt>, <tt class=
5408: "varname">${LOWER_OPSYS}</tt>, <tt class=
5409: "varname">${OS_VERSION}</tt></span></dt>
5410:
5411: <dd>
5412: <p>Some packages want to embed the OS name and
5413: version into some paths. To do this, use these
5414: variables in the <tt class=
5415: "filename">PLIST</tt>:</p>
5416:
5417: <div class="itemizedlist">
5418: <ul type="disc">
5419: <li>
5420: <p><tt class="varname">${OPSYS}</tt> - output
5421: of “<span class="quote"><span><b class=
5422: "command">uname
5423: -s</b></span></span>”</p>
5424: </li>
5425:
5426: <li>
5427: <p><tt class="varname">${LOWER_OPSYS}</tt> -
5428: lowercase common name (eg.
5429: “<span class="quote">solaris</span>”)</p>
5430: </li>
5431:
5432: <li>
5433: <p><tt class="varname">${OS_VERSION}</tt> -
5434: “<span class="quote"><span><b class=
5435: "command">uname
5436: -r</b></span></span>”</p>
5437: </li>
5438: </ul>
5439: </div>
5440: </dd>
5441:
5442: <dt><span class="term"><tt class=
5443: "varname">${PKGLOCALEDIR}</tt></span></dt>
5444:
5445: <dd>
5446: <p>Packages that install locale files should list
5447: them in the PLIST as “<span class=
5448: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
5449: instead of “<span class=
5450: "quote">share/locale/de/LC_MESSAGES/...</span>”.
5451: This properly handles the fact that different
5452: operating systems expect locale files to be either
5453: in <tt class="filename">share</tt> or <tt class=
5454: "filename">lib</tt> by default.</p>
5455: </dd>
5456: </dl>
5457: </div>
5458:
5459: <p>For a complete list of values which are replaced by
5460: default, please look in <tt class=
5461: "filename">bsd.pkg.mk</tt> (and search for <span class=
5462: "emphasis"><em>PLIST_SUBST</em></span>).</p>
5463:
5464: <p>If you want to change other variables not listed
5465: above, you can add variables and their expansions to this
5466: variable in the following way, similar to <tt class=
5467: "varname">MESSAGE_SUBST</tt> (see <a href=
5468: "#components.optional" title=
5469: "7.5. Optional files">Section 7.5,
5470: “Optional files”</a>):</p>
5471: <pre class="programlisting">
5472: PLIST_SUBST+= SOMEVAR="somevalue"
5473: </pre>
5474:
5475: <p>This replaces all occurrences of “<span class=
5476: "quote">${SOMEVAR}</span>” in the PLIST with
5477: “<span class="quote">somevalue</span>”.</p>
5478: </div>
5479:
5480: <div class="sect1" lang="en" xml:lang="en">
5481: <div class="titlepage">
5482: <div>
5483: <div>
5484: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 5485: "id2566921" id=
5486: "id2566921"></a>8.5. Manpage-compression</h2>
1.1 grant 5487: </div>
5488: </div>
5489: </div>
5490:
5491: <p>Manpages should be installed in compressed form if
5492: <tt class="varname">MANZ</tt> is set (in <tt class=
5493: "filename">bsd.own.mk</tt>), and uncompressed otherwise.
5494: To handle this in the <tt class="filename">PLIST</tt>
5495: file, the suffix “<span class=
5496: "quote">.gz</span>” is appended/removed
5497: automatically for manpages according to <tt class=
5498: "varname">MANZ</tt> and <tt class=
5499: "varname">MANCOMPRESSED</tt> being set or not, see above
5500: for details. This modification of the <tt class=
5501: "filename">PLIST</tt> file is done on a copy of it, not
5502: <tt class="filename">PLIST</tt> itself.</p>
5503: </div>
5504:
5505: <div class="sect1" lang="en" xml:lang="en">
5506: <div class="titlepage">
5507: <div>
5508: <div>
5509: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 5510: "id2566963" id="id2566963"></a>8.6. Changing
1.1 grant 5511: PLIST source with <tt class=
5512: "varname">PLIST_SRC</tt></h2>
5513: </div>
5514: </div>
5515: </div>
5516:
5517: <p>To use one or more files as source for the <tt class=
5518: "filename">PLIST</tt> used in generating the binary
5519: package, set the variable <tt class=
5520: "varname">PLIST_SRC</tt> to the names of that file(s).
5521: The files are later concatenated using cat(1), and order
5522: of things is important.</p>
5523: </div>
5524:
5525: <div class="sect1" lang="en" xml:lang="en">
5526: <div class="titlepage">
5527: <div>
5528: <div>
5529: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 5530: "id2566980" id="id2566980"></a>8.7. Platform
1.1 grant 5531: specific and differing PLISTs</h2>
5532: </div>
5533: </div>
5534: </div>
5535:
5536: <p>Some packages decide to install a different set of
5537: files based on the operating system being used. These
5538: differences can be automatically handled by using the
5539: following files:</p>
5540:
5541: <div class="itemizedlist">
5542: <ul type="disc">
5543: <li>
5544: <p><tt class="filename">PLIST.common</tt></p>
5545: </li>
5546:
5547: <li>
5548: <p><tt class="filename">PLIST.${OPSYS}</tt></p>
5549: </li>
5550:
5551: <li>
5552: <p><tt class="filename">PLIST.common_end</tt></p>
5553: </li>
5554: </ul>
5555: </div>
5556:
5557: <p>If <tt class="filename">PLIST.${OPSYS}</tt> exists,
5558: these files are used instead of <tt class=
5559: "filename">PLIST</tt>. This allows packages which behave
5560: in this way to be handled gracefully. Manually overriding
5561: <tt class="varname">PLIST_SRC</tt> for other more exotic
5562: uses is also possible.</p>
5563: </div>
5564:
5565: <div class="sect1" lang="en" xml:lang="en">
5566: <div class="titlepage">
5567: <div>
5568: <div>
5569: <h2 class="title" style="clear: both"><a name=
5570: "faq.common-dirs" id=
5571: "faq.common-dirs"></a>8.8. Sharing directories
5572: between packages</h2>
5573: </div>
5574: </div>
5575: </div>
5576:
5577: <p>A “<span class="quote">shared
5578: directory</span>” is a directory where multiple
5579: (and unrelated) packages install files. These directories
5580: are problematic because you have to add special tricks in
5581: the PLIST to conditionally remove them, or have some
5582: centralized package handle them.</p>
5583:
5584: <p>Within pkgsrc, you'll find both approaches. If a
5585: directory is shared by a few unrelated packages, it's
5586: often not worth to add an extra package to remove it.
5587: Therefore, one simply does:</p>
5588: <pre class="programlisting">
5589: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
5590:
5591: </pre>
5592:
5593: <p>in the PLISTs of all affected packages, instead of the
5594: regular "@dirrm" line.</p>
5595:
5596: <p>However, if the directory is shared across many
5597: packages, two different solutions are available:</p>
5598:
5599: <div class="orderedlist">
5600: <ol type="1">
5601: <li>
5602: <p>If the packages have a common dependency, the
5603: directory can be removed in that. For example, see
5604: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5605: href=
5606: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.2 hubertf 5607: class="pkgname">textproc/scrollkeeper</a>, which
5608: removes the shared directory <tt class=
5609: "filename">share/omf</tt>.</p>
1.1 grant 5610: </li>
5611:
5612: <li>
5613: <p>If the packages using the directory are not
5614: related at all (they have no common dependencies),
5615: a *-dirs package is used.</p>
5616: </li>
5617: </ol>
5618: </div>
5619:
5620: <p>From now on, we'll discuss the second solution. To get
5621: an idea of the *-dirs packages available, issue:</p>
5622: <pre class="programlisting">
5623: <tt class="prompt">%</tt> cd .../pkgsrc
5624: <tt class="prompt">%</tt> ls -d */*-dirs
5625:
5626: </pre>
5627:
5628: <p>Their use from other packages is very simple. The
5629: <tt class="varname">USE_DIRS</tt> variable takes a list
5630: of package names (without the “<span class=
5631: "quote">-dirs</span>” part) together with the
5632: required version number (always pick the latest one when
5633: writting new packages).</p>
5634:
5635: <p>For example, if a package installs files under
5636: <tt class="filename">share/applications</tt>, it should
5637: have the following line in it:</p>
5638: <pre class="programlisting">
5639: USE_DIRS+= xdg-1.1
5640:
5641: </pre>
5642:
5643: <p>After regenerating the PLIST using <span><b class=
5644: "command">make print-PLIST</b></span>, you should get the
5645: right (commented out) lines.</p>
5646:
5647: <p>Note that, even if your package is using <tt class=
5648: "filename">$X11BASE</tt>, it must not depend on the
5649: *-x11-dirs packages. Just specify the name without that
5650: part and pkgsrc (in particular, <tt class=
5651: "filename">mk/dirs.mk</tt>) will take care of it.</p>
5652: </div>
5653: </div>
5654:
5655: <div class="chapter" lang="en" xml:lang="en">
5656: <div class="titlepage">
5657: <div>
5658: <div>
5659: <h2 class="title"><a name="buildlink" id=
5660: "buildlink"></a>Chapter 9. Buildlink
5661: methodology</h2>
5662: </div>
5663: </div>
5664: </div>
5665:
5666: <div class="toc">
5667: <p><b>Table of Contents</b></p>
5668:
5669: <dl>
1.3 hubertf 5670: <dt><span class="sect1"><a href="#id2567252">9.1.
1.1 grant 5671: Converting packages to use buildlink3</a></span></dt>
5672:
1.3 hubertf 5673: <dt><span class="sect1"><a href="#id2567579">9.2.
1.1 grant 5674: Writing buildlink3.mk files</a></span></dt>
5675:
5676: <dd>
5677: <dl>
1.3 hubertf 5678: <dt><span class="sect2"><a href="#id2567717">9.2.1.
1.1 grant 5679: Anatomy of a buildlink3.mk file</a></span></dt>
5680:
1.3 hubertf 5681: <dt><span class="sect2"><a href="#id2568157">9.2.2.
1.1 grant 5682: Updating BUILDLINK_DEPENDS.pkg in buildlink3.mk
5683: files</a></span></dt>
5684: </dl>
5685: </dd>
5686:
1.3 hubertf 5687: <dt><span class="sect1"><a href="#id2568236">9.3.
1.1 grant 5688: Writing builtin.mk files</a></span></dt>
5689:
5690: <dd>
5691: <dl>
1.3 hubertf 5692: <dt><span class="sect2"><a href="#id2568386">9.3.1.
1.1 grant 5693: Anatomy of a builtin.mk file</a></span></dt>
5694:
1.3 hubertf 5695: <dt><span class="sect2"><a href="#id2568613">9.3.2.
1.1 grant 5696: Global preferences for native or pkgsrc
5697: software</a></span></dt>
5698: </dl>
5699: </dd>
5700: </dl>
5701: </div>
5702:
5703: <p>Buildlink is a framework in pkgsrc that controls what
5704: headers and libraries are seen by a package's configure and
5705: build processes. This is implemented in a two step
5706: process:</p>
5707:
5708: <div class="orderedlist">
5709: <ol type="1">
5710: <li>
5711: <p>Symlink headers and libraries for dependencies
5712: into <tt class="varname">BUILDLINK_DIR</tt>, which by
5713: default is a subdirectory of <tt class=
5714: "varname">WRKDIR</tt>.</p>
5715: </li>
5716:
5717: <li>
5718: <p>Create wrapper scripts that are used in place of
5719: the normal compiler tools that translate <tt class=
5720: "option">-I${LOCALBASE}/include</tt> and <tt class=
5721: "option">-L${LOCALBASE}/lib</tt> into references to
5722: <tt class="varname">BUILDLINK_DIR</tt>. The wrapper
5723: scripts also make native compiler on some operating
5724: systems look like GCC, so that packages that expect
5725: GCC won't require modifications to build with those
5726: native compilers.</p>
5727: </li>
5728: </ol>
5729: </div>
5730:
5731: <p>This normalizes the environment in which a package is
5732: built so that the package may be built consistently despite
5733: what other software may be installed. Please note that the
5734: normal system header and library paths, e.g. <tt class=
5735: "filename">/usr/include</tt>, <tt class=
5736: "filename">/usr/lib</tt>, etc., are always searched --
5737: buildlink3 is designed to insulate the package build from
5738: non-system-supplied software.</p>
5739:
5740: <div class="sect1" lang="en" xml:lang="en">
5741: <div class="titlepage">
5742: <div>
5743: <div>
5744: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 5745: "id2567252" id="id2567252"></a>9.1. Converting
1.1 grant 5746: packages to use buildlink3</h2>
5747: </div>
5748: </div>
5749: </div>
5750:
5751: <p>The process of converting packages to use the
5752: buildlink3 framework (“<span class=
5753: "quote">bl3ifying</span>”) is fairly
5754: straightforward. The things to keep in mind are:</p>
5755:
5756: <div class="orderedlist">
5757: <ol type="1">
5758: <li>
5759: <p>Set <tt class="varname">USE_BUILDLINK3</tt> to
5760: “<span class="quote">yes</span>”.</p>
5761: </li>
5762:
5763: <li>
5764: <p>Ensure that the build always calls the wrapper
5765: scripts instead of the actual toolchain. Some
5766: packages are tricky, and the only way to know for
5767: sure is the check <tt class=
5768: "filename">${WRKDIR}/.work.log</tt> to see if the
5769: wrappers are being invoked.</p>
5770: </li>
5771:
5772: <li>
5773: <p>Don't override <tt class="varname">PREFIX</tt>
5774: from within the package Makefile, e.g. Java VMs,
5775: standalone shells, etc., because the code to
5776: symlink files into <tt class=
5777: "filename">${BUILDLINK_DIR}</tt> looks for files
5778: relative to “<span class="quote">pkg_info -qp
5779: <i class=
5780: "replaceable"><tt>pkgname</tt></i></span>”.</p>
5781: </li>
5782:
5783: <li>
5784: <p>Remember that <span class=
5785: "emphasis"><em>only</em></span> the <tt class=
5786: "filename">buildlink3.mk</tt> files that you list
5787: in a package's Makefile are added as dependencies
5788: for that package.</p>
5789: </li>
5790: </ol>
5791: </div>
5792:
5793: <p>If a dependency on a particular package is required
5794: for its libraries and headers, then we replace:</p>
5795: <pre class="programlisting">
5796: DEPENDS+= foo>=1.1.0:../../category/foo
5797: </pre>
5798:
5799: <p>with</p>
5800: <pre class="programlisting">
5801: .include "../../category/foo/buildlink3.mk"
5802: </pre>
5803:
5804: <p>There are several <tt class=
5805: "filename">buildlink3.mk</tt> files in <tt class=
5806: "filename">pkgsrc/mk</tt> that handle special package
5807: issues:</p>
5808:
5809: <div class="itemizedlist">
5810: <ul type="disc">
5811: <li>
5812: <p><tt class="filename">bdb.buildlink3.mk</tt>
5813: chooses either the native or a pkgsrc Berkeley DB
5814: implementation based on the values of <tt class=
5815: "varname">BDB_ACCEPTED</tt> and <tt class=
5816: "varname">BDB_DEFAULT</tt>.</p>
5817: </li>
5818:
5819: <li>
5820: <p><tt class="filename">curses.buildlink3.mk</tt>
5821: If the system comes with neither Curses nor
5822: NCurses, this will take care to install the
5823: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5824: href=
5825: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.2 hubertf 5826: class="pkgname">devel/ncurses</a> package.</p>
1.1 grant 5827: </li>
5828:
5829: <li>
5830: <p><tt class="filename">krb5.buildlink3.mk</tt>
5831: uses the value of <tt class=
5832: "varname">KRB5_ACCEPTED</tt> to choose between
5833: adding a dependency on Heimdal or MIT-krb5 for
5834: packages that require a Kerberos 5
5835: implementation.</p>
5836: </li>
5837:
5838: <li>
5839: <p><tt class="filename">motif.buildlink3.mk</tt>
5840: checks for a system-provided Motif installation or
5841: adds a dependency on <a xmlns=
5842: "http://www.w3.org/TR/xhtml1/transitional" href=
5843: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.2 hubertf 5844: class="pkgname">x11/lesstif</a> or <a xmlns=
5845: "http://www.w3.org/TR/xhtml1/transitional" href=
5846: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
5847: class="pkgname">x11/openmotif</a>;</p>
1.1 grant 5848: </li>
5849:
5850: <li>
5851: <p><tt class="filename">ossaudio.buildlink3.mk</tt>
5852: defines several variables that may be used by
5853: packages that use the Open Sound System (OSS)
5854: API;</p>
5855: </li>
5856:
5857: <li>
5858: <p><tt class="filename">pgsql.buildlink3.mk</tt>
5859: will accept either Postgres 7.3 or 7.4, whichever
5860: is found installed. See the file for more
5861: information.</p>
5862: </li>
5863:
5864: <li>
5865: <p><tt class="filename">pthread.buildlink3.mk</tt>
5866: uses the value of <tt class=
5867: "varname">PTHREAD_OPTS</tt> and checks for native
5868: pthreads or adds a dependency on <a xmlns=
5869: "http://www.w3.org/TR/xhtml1/transitional" href=
5870: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.2 hubertf 5871: class="pkgname">devel/pth</a> as needed;</p>
1.1 grant 5872: </li>
5873:
5874: <li>
5875: <p><tt class="filename">xaw.buildlink3.mk</tt> uses
5876: the value of <tt class="varname">XAW_TYPE</tt> to
5877: choose a particular Athena widgets library.</p>
5878: </li>
5879: </ul>
5880: </div>
5881:
5882: <p>The comments in those <tt class=
5883: "filename">buildlink3.mk</tt> files provide a more
5884: complete description of how to use them properly.</p>
5885: </div>
5886:
5887: <div class="sect1" lang="en" xml:lang="en">
5888: <div class="titlepage">
5889: <div>
5890: <div>
5891: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 5892: "id2567579" id="id2567579"></a>9.2. Writing
1.1 grant 5893: <tt class="filename">buildlink3.mk</tt> files</h2>
5894: </div>
5895: </div>
5896: </div>
5897:
5898: <p>A package's <tt class="filename">buildlink3.mk</tt>
5899: file is included by Makefiles to indicate the need to
5900: compile and link against header files and libraries
5901: provided by the package. A <tt class=
5902: "filename">buildlink3.mk</tt> file should always provide
5903: enough information to add the correct type of dependency
5904: relationship and include any other <tt class=
5905: "filename">buildlink3.mk</tt> files that it needs to find
5906: headers and libraries that it needs in turn.</p>
5907:
5908: <p>To generate an initial <tt class=
5909: "filename">buildlink3.mk</tt> file for further editing,
5910: Rene Hexel's <a xmlns=
5911: "http://www.w3.org/TR/xhtml1/transitional" href=
5912: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.2 hubertf 5913: class="pkgname">pkgtools/createbuildlink</a> package
5914: is highly recommended. For most packages, the
5915: following command will generate a good starting point
5916: for <tt class="filename">buildlink3.mk</tt> files:</p>
1.1 grant 5917: <pre class="screen">
5918: <tt class="prompt">%</tt> <b class=
5919: "userinput"><tt>cd pkgsrc/<i class=
5920: "replaceable"><tt>category</tt></i>/<i class=
5921: "replaceable"><tt>pkgdir</tt></i>
5922: <tt class=
5923: "prompt">%</tt> createbuildlink -3 >buildlink3.mk</tt></b>
5924: </pre>
5925:
5926: <div class="sect2" lang="en" xml:lang="en">
5927: <div class="titlepage">
5928: <div>
5929: <div>
1.3 hubertf 5930: <h3 class="title"><a name="id2567717" id=
5931: "id2567717"></a>9.2.1. Anatomy of a buildlink3.mk
1.1 grant 5932: file</h3>
5933: </div>
5934: </div>
5935: </div>
5936:
5937: <p>The following real-life example <tt class=
5938: "filename">buildlink3.mk</tt> is taken from <tt class=
5939: "filename">pkgsrc/graphics/tiff</tt>:</p>
5940: <pre class="programlisting">
5941: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
5942:
5943: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
5944: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
5945:
5946: .if !empty(BUILDLINK_DEPTH:M+)
5947: BUILDLINK_DEPENDS+= tiff
5948: .endif
5949:
5950: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
5951: BUILDLINK_PACKAGES+= tiff
5952:
5953: .if !empty(TIFF_BUILDLINK3_MK:M+)
5954: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
5955: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
5956: .endif # TIFF_BUILDLINK3_MK
5957:
5958: .include "../../devel/zlib/buildlink3.mk"
5959: .include "../../graphics/jpeg/buildlink3.mk"
5960:
5961: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
5962: </pre>
5963:
5964: <p>The header and footer manipulate <tt class=
5965: "varname">BUILDLINK_DEPTH</tt>, which is common across
5966: all <tt class="filename">buildlink3.mk</tt> files and
5967: is used to track at what depth we are including
5968: <tt class="filename">buildlink3.mk</tt> files.</p>
5969:
5970: <p>The first section controls if the dependency on
5971: <i class="replaceable"><tt>pkg</tt></i> is added.
5972: <tt class="varname">BUILDLINK_DEPENDS</tt> is the
5973: global list of packages for which dependencies are
5974: added by buildlink3.</p>
5975:
5976: <p>The second section advises pkgsrc that the
5977: <tt class="filename">buildlink3.mk</tt> file for
5978: <i class="replaceable"><tt>pkg</tt></i> has been
5979: included at some point. <tt class=
5980: "varname">BUILDLINK_PACKAGES</tt> is the global list of
5981: packages for which <tt class=
5982: "filename">buildlink3.mk</tt> files have been included.
5983: It must <span class="emphasis"><em>always</em></span>
5984: be appended to within a <tt class=
5985: "filename">buildlink3.mk</tt> file.</p>
5986:
5987: <p>The third section is protected from multiple
5988: inclusion and controls how the dependency on <i class=
5989: "replaceable"><tt>pkg</tt></i> is added. Several
5990: important variables are set in the section:</p>
5991:
5992: <div class="itemizedlist">
5993: <ul type="disc">
5994: <li>
5995: <p><tt class=
5996: "varname">BUILDLINK_DEPENDS.<i class="replaceable">
5997: <tt>pkg</tt></i></tt> is the actual dependency
5998: recorded in the installed package; this should
5999: always be set using <span><b class=
6000: "command">+=</b></span> to ensure that we're
6001: appending to any pre-existing list of values.
6002: This variable should be set to the first version
6003: of the package that had the last change in the
6004: major number of a shared library or that had a
6005: major API change.</p>
6006: </li>
6007:
6008: <li>
6009: <p><tt class=
6010: "varname">BUILDLINK_PKGSRCDIR.<i class=
6011: "replaceable"><tt>pkg</tt></i></tt> is the
6012: location of the <i class=
6013: "replaceable"><tt>pkg</tt></i> pkgsrc
6014: directory;</p>
6015: </li>
6016:
6017: <li>
6018: <p><tt class=
6019: "varname">BUILDLINK_DEPMETHOD.<i class=
6020: "replaceable"><tt>pkg</tt></i></tt> (not shown
6021: above) controls whether we use <tt class=
6022: "varname">BUILD_DEPENDS</tt> or <tt class=
6023: "varname">DEPENDS</tt> to add the dependency on
6024: <i class="replaceable"><tt>pkg</tt></i>. The
6025: build dependency is selected by setting
6026: <tt class="varname">BUILDLINK_DEPMETHOD.<i class=
6027: "replaceable"><tt>pkg</tt></i></tt> to
6028: “<span class="quote">build</span>”.
6029: By default, the full dependency is used.</p>
6030: </li>
6031:
6032: <li>
6033: <p><tt class=
6034: "varname">BUILDLINK_INCDIRS.<i class="replaceable">
6035: <tt>pkg</tt></i></tt> and <tt class=
6036: "varname">BUILDLINK_LIBDIRS.<i class=
6037: "replaceable"><tt>pkg</tt></i></tt> (not shown
6038: above) are lists of subdirectories of <tt class=
6039: "filename">${BUILDLINK_PREFIX.<i class=
6040: "replaceable"><tt>pkg</tt></i>}</tt> to add to
6041: the header and library search paths. These
6042: default to “<span class=
6043: "quote">include</span>” and
6044: “<span class="quote">lib</span>”
6045: respectively.</p>
6046: </li>
6047:
6048: <li>
6049: <p><tt class=
6050: "varname">BUILDLINK_CPPFLAGS.<i class=
6051: "replaceable"><tt>pkg</tt></i></tt> (not shown
6052: above) is the list of preprocessor flags to add
6053: to <tt class="varname">CPPFLAGS</tt>, which are
6054: passed on to the configure and build phases. The
6055: “<span class="quote">-I</span>”
6056: option should be avoided and instead be handled
6057: using <tt class=
6058: "varname">BUILDLINK_INCDIRS.<i class=
6059: "replaceable"><tt>pkg</tt></i></tt> as above.</p>
6060: </li>
6061: </ul>
6062: </div>
6063:
6064: <p>The following variables are all optionally defined
6065: within this second section (protected against multiple
6066: inclusion) and control which package files are
6067: symlinked into <tt class=
6068: "filename">${BUILDLINK_DIR}</tt> and how their names
6069: are transformed during the symlinking:</p>
6070:
6071: <div class="itemizedlist">
6072: <ul type="disc">
6073: <li>
6074: <p><tt class="varname">BUILDLINK_FILES.<i class=
6075: "replaceable"><tt>pkg</tt></i></tt> (not shown
6076: above) is a shell glob pattern relative to
6077: <tt class="filename">${BUILDLINK_PREFIX.<i class=
6078: "replaceable"><tt>pkg</tt></i>}</tt> to be
6079: symlinked into <tt class=
6080: "filename">${BUILDLINK_DIR}</tt>, e.g. <tt class=
6081: "filename">include/*.h</tt>.</p>
6082: </li>
6083:
6084: <li>
6085: <p><tt class=
6086: "varname">BUILDLINK_FILES_CMD.<i class=
6087: "replaceable"><tt>pkg</tt></i></tt> (not shown
6088: above) is a shell pipeline that outputs to stdout
6089: a list of files relative to <tt class=
6090: "filename">${BUILDLINK_PREFIX.<i class=
6091: "replaceable"><tt>pkg</tt></i>}</tt>. The
6092: resulting files are to be symlinked into
6093: <tt class="filename">${BUILDLINK_DIR}</tt>. By
6094: default, this takes the <tt class=
6095: "filename">+CONTENTS</tt> of a <i class=
6096: "replaceable"><tt>pkg</tt></i> and filters it
6097: through <tt class=
6098: "varname">${BUILDLINK_CONTENTS_FILTER.<i class=
6099: "replaceable"><tt>pkg</tt></i>}</tt>.</p>
6100: </li>
6101:
6102: <li>
6103: <p><tt class=
6104: "varname">BUILDLINK_CONTENTS_FILTER.<i class=
6105: "replaceable"><tt>pkg</tt></i></tt> (not shown
6106: above) is a filter command that filters
6107: <tt class="filename">+CONTENTS</tt> input into a
6108: list of files relative to <tt class=
6109: "filename">${BUILDLINK_PREFIX.<i class=
6110: "replaceable"><tt>pkg</tt></i>}</tt> on stdout.
6111: By default for overwrite packages, <tt class=
6112: "varname">BUILDLINK_CONTENTS_FILTER.<i class=
6113: "replaceable"><tt>pkg</tt></i></tt> outputs the
6114: contents of the <tt class="filename">include</tt>
6115: and <tt class="filename">lib</tt> directories in
6116: the package <tt class="filename">+CONTENTS</tt>,
6117: and for pkgviews packages, it outputs any libtool
6118: archives in <tt class="filename">lib</tt>
6119: directories.</p>
6120: </li>
6121:
6122: <li>
6123: <p><tt class=
6124: "varname">BUILDLINK_TRANSFORM.<i class=
6125: "replaceable"><tt>pkg</tt></i></tt> (not shown
6126: above) is a list of sed arguments used to
6127: transform the name of the source filename into a
6128: destination filename, e.g. <span><b class=
6129: "command">-e
6130: "s|/curses.h|/ncurses.h|g"</b></span>.</p>
6131: </li>
6132: </ul>
6133: </div>
6134:
6135: <p>The last section includes any <tt class=
6136: "filename">buildlink3.mk</tt> needed for <i class=
6137: "replaceable"><tt>pkg</tt></i>'s library dependencies.
6138: Including these <tt class="filename">buildlink3.mk</tt>
6139: files means that the headers and libraries for these
6140: dependencies are also symlinked into <tt class=
6141: "filename">${BUILDLINK_DIR}</tt> whenever the <i class=
6142: "replaceable"><tt>pkg</tt></i> <tt class=
6143: "filename">buildlink3.mk</tt> file is included.</p>
6144: </div>
6145:
6146: <div class="sect2" lang="en" xml:lang="en">
6147: <div class="titlepage">
6148: <div>
6149: <div>
1.3 hubertf 6150: <h3 class="title"><a name="id2568157" id=
6151: "id2568157"></a>9.2.2. Updating <tt class=
1.1 grant 6152: "varname">BUILDLINK_DEPENDS.<i class=
6153: "replaceable"><tt>pkg</tt></i></tt> in <tt class=
6154: "filename">buildlink3.mk</tt> files</h3>
6155: </div>
6156: </div>
6157: </div>
6158:
6159: <p>There are two situations that require increasing the
6160: dependency listed in <tt class=
6161: "varname">BUILDLINK_DEPENDS.<i class=
6162: "replaceable"><tt>pkg</tt></i></tt> after a package
6163: update:</p>
6164:
6165: <div class="orderedlist">
6166: <ol type="1">
6167: <li>
6168: <p>if the sonames (major number of the library
6169: version) of any installed shared libraries
6170: change;</p>
6171: </li>
6172:
6173: <li>
6174: <p>if the API or interface to the header files
6175: change.</p>
6176: </li>
6177: </ol>
6178: </div>
6179:
6180: <p>In these cases, <tt class=
6181: "varname">BUILDLINK_DEPENDS.<i class=
6182: "replaceable"><tt>pkg</tt></i></tt> should be adjusted
6183: to require at least the new package version. In some
6184: cases, the packages that depend on this new version may
6185: need their <tt class="varname">PKGREVISION</tt>s
6186: increased and, if they have <tt class=
6187: "filename">buildlink3.mk</tt> files, their <tt class=
6188: "varname">BUILDLINK_DEPENDS.<i class=
6189: "replaceable"><tt>pkg</tt></i></tt> adjusted, too. This
6190: is needed so that binary packages made using it will
6191: require the correct package dependency and not settle
6192: for an older one which will not contain the necessary
6193: shared libraries.</p>
6194:
6195: <p>Please take careful consideration before adjusting
6196: <tt class="varname">BUILDLINK_DEPENDS.<i class=
6197: "replaceable"><tt>pkg</tt></i></tt> as we don't want to
6198: cause unneeded package deletions and rebuilds. In many
6199: cases, new versions of packages work just fine with
6200: older dependencies. See <a href="#dependencies" title=
6201: "12.1.3. Handling dependencies">Section 12.1.3,
6202: “Handling dependencies”</a> and <a href=
6203: "#buildlink" title=
6204: "Chapter 9. Buildlink methodology">Chapter 9,
6205: <i>Buildlink methodology</i></a> for more information
6206: about dependencies on other packages, including the
6207: <tt class="varname">BUILDLINK_RECOMMENDED</tt> and
6208: <tt class="varname">RECOMMENDED</tt> definitions.</p>
6209: </div>
6210: </div>
6211:
6212: <div class="sect1" lang="en" xml:lang="en">
6213: <div class="titlepage">
6214: <div>
6215: <div>
6216: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 6217: "id2568236" id="id2568236"></a>9.3. Writing
1.1 grant 6218: <tt class="filename">builtin.mk</tt> files</h2>
6219: </div>
6220: </div>
6221: </div>
6222:
6223: <p>Some packages in pkgsrc install headers and libraries
6224: that coincide with headers and libraries present in the
6225: base system. Aside from a <tt class=
6226: "filename">buildlink3.mk</tt> file, these packages should
6227: also include a <tt class="filename">builtin.mk</tt> file
6228: that includes the necessary checks to decide whether
6229: using the built-in software or the pkgsrc software is
6230: appropriate.</p>
6231:
6232: <p>The only requirements of a builtin.mk file for
6233: <i class="replaceable"><tt>pkg</tt></i> are:</p>
6234:
6235: <div class="orderedlist">
6236: <ol type="1">
6237: <li>
6238: <p>It should set <tt class=
6239: "varname">USE_BUILTIN.<i class=
6240: "replaceable"><tt>pkg</tt></i></tt> to either
6241: “<span class="quote">yes</span>” or
6242: “<span class="quote">no</span>” after
6243: it is included.</p>
6244: </li>
6245:
6246: <li>
6247: <p>It should <span class=
6248: "emphasis"><em>not</em></span> override any
6249: <tt class="varname">USE_BUILTIN.<i class=
6250: "replaceable"><tt>pkg</tt></i></tt> which is
6251: already set before the <tt class=
6252: "filename">builtin.mk</tt> file is included.</p>
6253: </li>
6254:
6255: <li>
6256: <p>It should be written to allow multiple
6257: inclusion. This is <span class=
6258: "emphasis"><em>very</em></span> important and takes
6259: careful attention to <tt class=
6260: "filename">Makefile</tt> coding.</p>
6261: </li>
6262: </ol>
6263: </div>
6264:
6265: <div class="sect2" lang="en" xml:lang="en">
6266: <div class="titlepage">
6267: <div>
6268: <div>
1.3 hubertf 6269: <h3 class="title"><a name="id2568386" id=
6270: "id2568386"></a>9.3.1. Anatomy of a
1.1 grant 6271: <tt class="filename">builtin.mk</tt> file</h3>
6272: </div>
6273: </div>
6274: </div>
6275:
6276: <p>The following is the recommended template for
6277: builtin.mk files:</p>
6278: <pre class="programlisting">
6279: .if !defined(IS_BUILTIN.foo)
6280: #
6281: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
6282: # genuinely exists in the system or not.
6283: #
6284: IS_BUILTIN.foo?= no
6285:
6286: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
6287: # version can be determined.
6288: #
6289: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
6290: BUILTIN_PKG.foo?= foo-1.0
6291: . endif
6292: .endif # IS_BUILTIN.foo
6293:
6294: .if !defined(USE_BUILTIN.foo)
6295: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
6296: . if defined(BUILTIN_PKG.foo)
6297: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
6298: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
6299: USE_BUILTIN.foo!= \
6300: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
6301: ${ECHO} "yes"; \
6302: else \
6303: ${ECHO} "no"; \
6304: fi
6305: . endif
6306: . endfor
6307: . endif
6308: .endif # USE_BUILTIN.foo
6309:
6310: CHECK_BUILTIN.foo?= no
6311: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
6312: #
6313: # Here we place code that depends on whether USE_BUILTIN.foo is set to
6314: # "yes" or "no".
6315: #
6316: .endif # CHECK_BUILTIN.foo
6317:
6318: </pre>
6319:
6320: <p>The first section sets <tt class=
6321: "varname">IS_BUILTIN.<i class=
6322: "replaceable"><tt>pkg</tt></i></tt> depending on if
6323: <i class="replaceable"><tt>pkg</tt></i> really exists
6324: in the base system. This should not be a base system
6325: software with similar functionality to <i class=
6326: "replaceable"><tt>pkg</tt></i>; it should only be
6327: “<span class="quote">yes</span>” if the
6328: actual package is included as part of the base system.
6329: This variable is only used internally within the
6330: <tt class="filename">builtin.mk</tt> file.</p>
6331:
6332: <p>The second section sets <tt class=
6333: "varname">BUILTIN_PKG.<i class=
6334: "replaceable"><tt>pkg</tt></i></tt> to the version of
6335: <i class="replaceable"><tt>pkg</tt></i> in the base
6336: system if it exists (if <tt class=
6337: "varname">IS_BUILTIN.<i class=
6338: "replaceable"><tt>pkg</tt></i></tt> is
6339: “<span class="quote">yes</span>”). This
6340: variable is only used internally within the <tt class=
6341: "filename">builtin.mk</tt> file.</p>
6342:
6343: <p>The third section sets <tt class=
6344: "varname">USE_BUILTIN.<i class=
6345: "replaceable"><tt>pkg</tt></i></tt> and is <span class=
6346: "emphasis"><em>required</em></span> in all <tt class=
6347: "filename">builtin.mk</tt> files. The code in this
6348: section must make the determination whether the
6349: built-in software is adequate to satisfy the
6350: dependencies listed in <tt class=
6351: "varname">BUILDLINK_DEPENDS.<i class=
6352: "replaceable"><tt>pkg</tt></i></tt>. This is typically
6353: done by comparing <tt class=
6354: "varname">BUILTIN_PKG.<i class=
6355: "replaceable"><tt>pkg</tt></i></tt> against each of the
6356: dependencies in <tt class=
6357: "varname">BUILDLINK_DEPENDS.<i class=
6358: "replaceable"><tt>pkg</tt></i></tt>. <tt class=
6359: "varname">USE_BUILTIN.<i class=
6360: "replaceable"><tt>pkg</tt></i></tt> <span class=
6361: "emphasis"><em>must</em></span> be set to the correct
6362: value by the end of the <tt class=
6363: "filename">builtin.mk</tt> file. Note that <tt class=
6364: "varname">USE_BUILTIN.<i class=
6365: "replaceable"><tt>pkg</tt></i></tt> may be
6366: “<span class="quote">yes</span>” even if
6367: <tt class="varname">IS_BUILTIN.<i class=
6368: "replaceable"><tt>pkg</tt></i></tt> is
6369: “<span class="quote">no</span>” because we
6370: may make the determination that the built-in version of
6371: the software is similar enough to be used as a
6372: replacement.</p>
6373:
6374: <p>The last section is guarded by <tt class=
6375: "varname">CHECK_BUILTIN.<i class=
6376: "replaceable"><tt>pkg</tt></i></tt>, and includes code
6377: that uses the value of <tt class=
6378: "varname">USE_BUILTIN.<i class=
6379: "replaceable"><tt>pkg</tt></i></tt> set in the previous
6380: section. This typically includes, e.g., adding
6381: additional dependency restrictions and listing
6382: additional files to symlink into <tt class=
6383: "filename">${BUILDLINK_DIR}</tt> (via <tt class=
6384: "varname">BUILDLINK_FILES.<i class=
6385: "replaceable"><tt>pkg</tt></i></tt>).</p>
6386: </div>
6387:
6388: <div class="sect2" lang="en" xml:lang="en">
6389: <div class="titlepage">
6390: <div>
6391: <div>
1.3 hubertf 6392: <h3 class="title"><a name="id2568613" id=
6393: "id2568613"></a>9.3.2. Global preferences
1.1 grant 6394: for native or pkgsrc software</h3>
6395: </div>
6396: </div>
6397: </div>
6398:
6399: <p>When building packages, it's possible to choose
6400: whether to set a global preference for using either the
6401: built-in (native) version or the pkgsrc version of
6402: software to satisfy a dependency. This is controlled by
6403: setting <tt class="varname">PREFER_PKGSRC</tt> and
6404: <tt class="varname">PREFER_NATIVE</tt>. These variables
6405: take values of either “<span class=
6406: "quote">yes</span>”, “<span class=
6407: "quote">no</span>”, or a list of packages.
6408: <tt class="varname">PREFER_PKGSRC</tt> tells pkgsrc to
6409: use the pkgsrc versions of software, while <tt class=
6410: "varname">PREFER_NATIVE</tt> tells pkgsrc to use the
6411: built-in versions. Preferences are determined by the
6412: most specific instance of the package in either
6413: <tt class="varname">PREFER_PKGSRC</tt> or <tt class=
6414: "varname">PREFER_NATIVE</tt>. If a package is specified
6415: in neither or in both variables, then <tt class=
6416: "varname">PREFER_PKGSRC</tt> has precedence over
6417: <tt class="varname">PREFER_NATIVE</tt>. For example, to
6418: require using pkgsrc versions of software for all but
6419: the most basic bits on a NetBSD system, you can
6420: set:</p>
6421: <pre class="programlisting">
6422: PREFER_PKGSRC= yes
6423: PREFER_NATIVE= getopt skey tcp_wrappers
6424:
6425: </pre>
6426:
6427: <p>A package <span class=
6428: "emphasis"><em>must</em></span> have a <tt class=
6429: "filename">builtin.mk</tt> file to be listed in
6430: <tt class="varname">PREFER_NATIVE</tt>, otherwise it is
6431: simply ignored in that list.</p>
6432: </div>
6433: </div>
6434: </div>
6435:
6436: <div class="chapter" lang="en" xml:lang="en">
6437: <div class="titlepage">
6438: <div>
6439: <div>
6440: <h2 class="title"><a name="options" id=
6441: "options"></a>Chapter 10. Options
6442: handling</h2>
6443: </div>
6444: </div>
6445: </div>
6446:
6447: <div class="toc">
6448: <p><b>Table of Contents</b></p>
6449:
6450: <dl>
1.3 hubertf 6451: <dt><span class="sect1"><a href="#id2568685">10.1.
1.1 grant 6452: Global default options</a></span></dt>
6453:
1.3 hubertf 6454: <dt><span class="sect1"><a href="#id2568700">10.2.
1.1 grant 6455: Converting packages to use
6456: bsd.options.mk</a></span></dt>
6457: </dl>
6458: </div>
6459:
6460: <p>Many packages have the ability to be built to support
6461: different sets of features. <tt class=
6462: "filename">bsd.options.mk</tt> is a framework in pkgsrc
6463: that provides generic handling of those options that
6464: determine different ways in which the packages can be
6465: built. It's possible for the user to specify exactly which
6466: sets of options will be built into a package or to allow a
6467: set of global default options apply.</p>
6468:
6469: <div class="sect1" lang="en" xml:lang="en">
6470: <div class="titlepage">
6471: <div>
6472: <div>
6473: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 6474: "id2568685" id="id2568685"></a>10.1. Global
1.1 grant 6475: default options</h2>
6476: </div>
6477: </div>
6478: </div>
6479:
6480: <p>Global default options are listed in <tt class=
6481: "varname">PKG_DEFAULT_OPTIONS</tt>, which is a list of
6482: the options that should be built into every package if
6483: that option is supported. This variable should be set in
6484: <tt class="filename">/etc/mk.conf</tt>.</p>
6485: </div>
6486:
6487: <div class="sect1" lang="en" xml:lang="en">
6488: <div class="titlepage">
6489: <div>
6490: <div>
6491: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 6492: "id2568700" id=
6493: "id2568700"></a>10.2. Converting packages to
1.1 grant 6494: use <tt class="filename">bsd.options.mk</tt></h2>
6495: </div>
6496: </div>
6497: </div>
6498:
6499: <p>The following example shows how <tt class=
6500: "filename">bsd.options.mk</tt> should be use in a package
6501: <tt class="filename">Makefile</tt>, or in a file, e.g.
6502: <tt class="filename">options.mk</tt>, that is included by
6503: the main package <tt class="filename">Makefile</tt>.</p>
6504: <pre class="programlisting">
6505: # Global and legacy options
6506: .if defined(WIBBLE_USE_OPENLDAP) && !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
6507: PKG_DEFAULT_OPTIONS+= ldap
6508: .endif
6509: .if defined(USE_SASL2) && !empty(USE_SASL2:M[yY][eE][sS])
6510: PKG_DEFAULT_OPTIONS+= sasl
6511: .endif
6512:
6513: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
6514: PKG_SUPPORTED_OPTIONS= ldap sasl
6515: #
6516: # Default options for "wibble" package.
6517: #
6518: .if !defined(PKG_OPTIONS.wibble)
6519: PKG_DEFAULT_OPTIONS+= sasl
6520: endif
6521: .include "../../mk/bsd.options.mk"
6522:
6523: # Package-specific option-handling
6524:
6525: ###
6526: ### LDAP support
6527: ###
6528: .if !empty(PKG_OPTIONS:Mldap)
6529: . include "../../databases/openldap/buildlink3.mk"
6530: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
6531: .endif
6532:
6533: ###
6534: ### SASL authentication
6535: ###
6536: .if !empty(PKG_OPTIONS:Msasl)
6537: . include "../../security/cyrus-sasl2/buildlink3.mk"
6538: CONFIGURE_ARGS+= --enable-sasl=${BUILDLINK_PREFIX.sasl}
6539: .endif
6540:
6541: </pre>
6542:
6543: <p>The first section only exists if you are converting a
6544: package that had its own ad-hoc options handling to use
6545: <tt class="filename">bsd.options.mk</tt>. It converts
6546: global or legacy options variables into an equivalent
6547: <tt class="varname">PKG_OPTIONS.<i class=
6548: "replaceable"><tt>pkg</tt></i></tt> value. These sections
6549: will be removed over time as the old options are in turn
6550: deprecated and removed.</p>
6551:
6552: <p>The second section contains the information about
6553: which build options are supported by the package, and any
6554: default options settings if needed.</p>
6555:
6556: <div class="orderedlist">
6557: <ol type="1">
6558: <li>
6559: <p><tt class="varname">PKG_OPTIONS_VAR</tt> is a
6560: list of the name of the <a href=
6561: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6562: <span class="citerefentry"><span class=
6563: "refentrytitle">make</span>(1)</span></a> variables
6564: that contain the options the user wishes to select.
6565: The recommended value is “<span class=
6566: "quote">PKG_OPTIONS.<i class=
6567: "replaceable"><tt>pkg</tt></i></span>” but
6568: any package-specific value may be used. This
6569: variable should be set in a package Makefile.</p>
6570: </li>
6571:
6572: <li>
6573: <p><tt class="varname">PKG_SUPPORTED_OPTIONS</tt>
6574: is a list of build options supported by the
6575: package. This variable should be set in a package
6576: Makefile.</p>
6577: </li>
6578:
6579: <li>
6580: <p><tt class="varname">${PKG_OPTIONS_VAR}</tt> (the
6581: variables named in <tt class=
6582: "varname">PKG_OPTIONS_VAR</tt>) are variables that
6583: list the selected build options and override any
6584: default options given in <tt class=
6585: "varname">PKG_DEFAULT_OPTIONS</tt>. If any of the
6586: options begin with a “<span class=
6587: "quote">-</span>”, then that option is always
6588: removed from the selected build options, e.g.</p>
6589: <pre class="programlisting">
6590: PKG_DEFAULT_OPTIONS= kerberos ldap sasl
6591: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
6592: WIBBLE_OPTIONS= ${PKG_DEFAULT_OPTIONS} -sasl
6593: # implies PKG_OPTIONS == "kerberos ldap"
6594:
6595: </pre>
6596:
6597: <p>or</p>
6598: <pre class="programlisting">
6599: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
6600: WIBBLE_OPTIONS= kerberos -ldap ldap
6601: # implies PKG_OPTIONS == "kerberos"
6602:
6603: </pre>
6604:
6605: <p>This variable should be set in <tt class=
6606: "filename">/etc/mk.conf</tt>.</p>
6607: </li>
6608: </ol>
6609: </div>
6610:
6611: <p>After the inclusion of bsd.options.mk, the following
6612: variables are set:</p>
6613:
6614: <div class="itemizedlist">
6615: <ul type="disc">
6616: <li>
6617: <p><tt class="varname">PKG_OPTIONS</tt> contains
6618: the list of the selected build options, properly
6619: filtered to remove unsupported and duplicate
6620: options.</p>
6621: </li>
6622: </ul>
6623: </div>
6624:
6625: <p>The remaining sections contain the logic that is
6626: specific to each option. There should be a check for
6627: every option listed in <tt class=
6628: "varname">PKG_SUPPORTED_OPTIONS</tt>, and there should be
6629: clear documentation on what turning on the option will do
6630: in the comments preceding each section. The correct way
6631: to check for an option is to check whether it is listed
6632: in <tt class="varname">PKG_OPTIONS</tt>.</p>
6633: </div>
6634: </div>
6635:
6636: <div class="chapter" lang="en" xml:lang="en">
6637: <div class="titlepage">
6638: <div>
6639: <div>
6640: <h2 class="title"><a name="build" id=
6641: "build"></a>Chapter 11. The build
6642: process</h2>
6643: </div>
6644: </div>
6645: </div>
6646:
6647: <div class="toc">
6648: <p><b>Table of Contents</b></p>
6649:
6650: <dl>
6651: <dt><span class="sect1"><a href="#build.prefix">11.1.
6652: Program location</a></span></dt>
6653:
1.3 hubertf 6654: <dt><span class="sect1"><a href="#id2569445">11.2. Main
1.1 grant 6655: targets</a></span></dt>
6656:
6657: <dt><span class="sect1"><a href=
6658: "#build.helpful-targets">11.3. Other helpful
6659: targets</a></span></dt>
6660: </dl>
6661: </div>
6662:
6663: <p>The basic steps for building a program are always the
6664: same. First the program's source (<span class=
6665: "emphasis"><em>distfile</em></span>) must be brought to the
6666: local system and then extracted. After any patches to
6667: compile properly on NetBSD are applied, the software can be
6668: configured, then built (usually by compiling), and finally
6669: the generated binaries, etc. can be put into place on the
6670: system. These are exactly the steps performed by the NetBSD
6671: package system, which is implemented as a series of targets
6672: in a central Makefile, <tt class=
6673: "filename">pkgsrc/mk/bsd.pkg.mk</tt>.</p>
6674:
6675: <div class="sect1" lang="en" xml:lang="en">
6676: <div class="titlepage">
6677: <div>
6678: <div>
6679: <h2 class="title" style="clear: both"><a name=
6680: "build.prefix" id=
6681: "build.prefix"></a>11.1. Program location</h2>
6682: </div>
6683: </div>
6684: </div>
6685:
6686: <p>Before outlining the process performed by the NetBSD
6687: package system in the next section, here's a brief
6688: discussion on where programs are installed, and which
6689: variables influence this.</p>
6690:
6691: <p>The automatic variable <tt class="varname">PREFIX</tt>
6692: indicates where all files of the final program shall be
6693: installed. It is usually set to <tt class=
6694: "varname">LOCALBASE</tt> (<tt class=
6695: "filename">/usr/pkg</tt>), or <tt class=
6696: "varname">CROSSBASE</tt> for pkgs in the
6697: “<span class="quote">cross</span>” category.
6698: The value of <tt class="varname">PREFIX</tt> needs to be
6699: put into the various places in the program's source where
6700: paths to these files are encoded. See <a href=
6701: "#components.patches" title=
6702: "7.3. patches/*">Section 7.3,
6703: “patches/*”</a> and <a href="#fixes.libtool"
6704: title=
6705: "12.3.1. Shared libraries - libtool">Section 12.3.1,
6706: “Shared libraries - libtool”</a> for more
6707: details.</p>
6708:
6709: <p>When choosing which of these variables to use, follow
6710: the following rules:</p>
6711:
6712: <div class="itemizedlist">
6713: <ul type="disc">
6714: <li>
6715: <p><tt class="varname">PREFIX</tt> always points to
6716: the location where the current pkg will be
6717: installed. When referring to a pkg's own
6718: installation path, use “<span class=
6719: "quote">${PREFIX}</span>”.</p>
6720: </li>
6721:
6722: <li>
6723: <p><tt class="varname">LOCALBASE</tt> is where all
6724: non-X11 pkgs are installed. If you need to
6725: construct a -I or -L argument to the compiler to
6726: find includes and libraries installed by another
6727: non-X11 pkg, use “<span class=
6728: "quote">${LOCALBASE}</span>”.</p>
6729: </li>
6730:
6731: <li>
6732: <p><tt class="varname">X11BASE</tt> is where the
6733: actual X11 distribution (from xsrc, etc.) is
6734: installed. When looking for <span class=
6735: "emphasis"><em>standard</em></span> X11 includes
6736: (not those installed by a pkg), use
6737: “<span class=
6738: "quote">${X11BASE}</span>”.</p>
6739: </li>
6740:
6741: <li>
6742: <p>X11 based are special in that they may be
6743: installed in either <tt class=
6744: "varname">X11BASE</tt> or <tt class=
6745: "varname">LOCALBASE</tt>.</p>
6746:
6747: <p>Usually, X11 packages should be installed under
6748: <tt class="varname">LOCALBASE</tt> whenever
6749: possible. Note that you will need to set <tt class=
6750: "varname">USE_X11</tt> in them to request the
6751: presence of X11 and to get the right compilation
6752: flags.</p>
6753:
6754: <p>Even though, there are some packages that cannot
6755: be installed under <tt class=
6756: "varname">LOCALBASE</tt>: those that come with
6757: app-defaults files. These packages are special and
6758: they must be placed under <tt class=
6759: "varname">X11BASE</tt>. To accomplish this, set
6760: either <tt class="varname">USE_X11BASE</tt> or
6761: <tt class="varname">USE_IMAKE</tt> in your
6762: package.</p>
6763:
6764: <p>Some notes: <tt class="varname">USE_X11</tt> and
6765: <tt class="varname">USE_X11BASE</tt> are mutually
6766: exclusive. If you need to find includes or
6767: libraries installed by a pkg that has <tt class=
6768: "varname">USE_IMAKE</tt> or <tt class=
6769: "varname">USE_X11BASE</tt> in its pkg <tt class=
6770: "filename">Makefile</tt>, you need to use
6771: <span class="emphasis"><em>both</em></span>
6772: <tt class="filename">${X11BASE}</tt> and <tt class=
6773: "filename">${LOCALBASE}</tt>. To force installation
6774: of all X11 packages in <tt class=
6775: "varname">LOCALBASE</tt>, the <a xmlns=
6776: "http://www.w3.org/TR/xhtml1/transitional" href=
6777: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.2 hubertf 6778: class="pkgname">pkgtools/xpkgwedge</a> is
6779: enabled by default.</p>
1.1 grant 6780: </li>
6781:
6782: <li>
6783: <p><tt class="varname">X11PREFIX</tt> should be
6784: used to refer to the installed location of an X11
6785: package. <tt class="varname">X11PREFIX</tt> will be
6786: set to <tt class="varname">X11BASE</tt> if
6787: xpkgwedge is not installed, and to <tt class=
6788: "varname">LOCALBASE</tt> if xpkgwedge is
6789: installed.</p>
6790: </li>
6791:
6792: <li>
6793: <p>If xpkgwedge is installed, it is possible to
6794: have some packages installed in <tt class=
6795: "varname">X11BASE</tt> and some in <tt class=
6796: "varname">LOCALBASE</tt>. To determine the prefix
6797: of an installed package, the <tt class=
6798: "varname">EVAL_PREFIX</tt> definition can be used.
6799: It takes pairs in the format “<span class=
6800: "quote">DIRNAME=<package></span>”, and
6801: the make(1) variable <tt class=
6802: "varname">DIRNAME</tt> will be set to the prefix of
6803: the installed package <package>, or
6804: “<span class=
6805: "quote">${X11PREFIX}</span>” if the package
6806: is not installed.</p>
6807:
6808: <p>This is best illustrated by example.</p>
6809:
6810: <p>The following lines are taken from <tt class=
6811: "filename">pkgsrc/wm/scwm/Makefile</tt>:</p>
6812: <pre class="programlisting">
6813: EVAL_PREFIX+= GTKDIR=gtk+
6814: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
6815: --with-gtk-prefix="${GTKDIR}" \
6816: --enable-multibyte
6817: </pre>
6818:
6819: <p>Specific defaults can be defined for the
6820: packages evaluated using <tt class=
6821: "varname">EVAL_PREFIX</tt>, by using a definition
6822: of the form:</p>
6823: <pre class="programlisting">
6824: GTKDIR_DEFAULT= ${LOCALBASE}
6825: </pre>
6826:
6827: <p>where <tt class="varname">GTKDIR</tt>
6828: corresponds to the first definition in the
6829: <tt class="varname">EVAL_PREFIX</tt> pair.</p>
6830: </li>
6831:
6832: <li>
6833: <p>Within <tt class="filename">${PREFIX}</tt>,
6834: packages should install files according to hier(7),
6835: with the exception that manual pages go into
6836: <tt class="filename">${PREFIX}/man</tt>, not
6837: <tt class="filename">${PREFIX}/share/man</tt>.</p>
6838: </li>
6839: </ul>
6840: </div>
6841: </div>
6842:
6843: <div class="sect1" lang="en" xml:lang="en">
6844: <div class="titlepage">
6845: <div>
6846: <div>
6847: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 6848: "id2569445" id="id2569445"></a>11.2. Main
1.1 grant 6849: targets</h2>
6850: </div>
6851: </div>
6852: </div>
6853:
6854: <p>The main targets used during the build process defined
6855: in <tt class="filename">bsd.pkg.mk</tt> are:</p>
6856:
6857: <div class="variablelist">
6858: <dl>
6859: <dt><span class="term">fetch</span></dt>
6860:
6861: <dd>
6862: <p>This will check if the file(s) given in the
6863: variables <tt class="varname">DISTFILES</tt> and
6864: <tt class="varname">PATCHFILES</tt> (as defined in
6865: the package's Makefile) are present on the local
6866: system in <tt class=
6867: "filename">/usr/pkgsrc/distfiles</tt>. If they are
6868: not present, an attempt will be made to fetch them
6869: using commands of the form:</p>
6870: <pre class="programlisting">
6871: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
6872: </pre>
6873:
6874: <p>where ${site} varies through several
6875: possibilities in turn: first, <tt class=
6876: "varname">MASTER_SITE_OVERRIDE</tt> is tried, then
6877: the sites specified in either <tt class=
6878: "varname">SITES_file</tt> if defined, else
6879: <tt class="varname">MASTER_SITES</tt> or <tt class=
6880: "varname">PATCH_SITES</tt>, as applies, then
6881: finally the value of <tt class=
6882: "varname">MASTER_SITE_BACKUP</tt>. The order of all
6883: except the first can be optionally sorted by the
6884: user, via setting either <tt class=
6885: "varname">MASTER_SORT_AWK</tt> or <tt class=
6886: "varname">MASTER_SORT_REGEX</tt>.</p>
6887: </dd>
6888:
6889: <dt><span class="term">checksum</span></dt>
6890:
6891: <dd>
6892: <p>After the distfile(s) are fetched, their
6893: checksum is generated and compared with the
6894: checksums stored in the distinfo file. If the
6895: checksums don't match, the build is aborted. This
6896: is to ensure the same distfile is used for
6897: building, and that the distfile wasn't changed,
6898: e.g. by some malign force, deliberately changed
6899: distfiles on the master distribution site or
6900: network lossage.</p>
6901: </dd>
6902:
6903: <dt><span class="term">extract</span></dt>
6904:
6905: <dd>
6906: <p>When the distfiles are present on the local
6907: system, they need to be extracted, as they are
6908: usually in the form of some compressed archive
6909: format, most commonly <tt class=
6910: "filename">.tar.gz</tt>.</p>
6911:
6912: <p>If only some of the distfiles need to be
6913: uncompressed, the files to be uncompressed should
6914: be put into <tt class=
6915: "varname">EXTRACT_ONLY</tt>.</p>
6916:
6917: <p>If the distfiles are not in <tt class=
6918: "filename">.tar.gz</tt> format, they can be
6919: extracted by setting either <tt class=
6920: "varname">EXTRACT_SUFX</tt>, or <tt class=
6921: "varname">EXTRACT_CMD</tt>, <tt class=
6922: "varname">EXTRACT_BEFORE_ARGS</tt> and <tt class=
6923: "varname">EXTRACT_AFTER_ARGS</tt>. In the former
6924: case, pkgsrc knows how to extract a number of
6925: suffixes (<tt class="filename">.tar.gz</tt>,
6926: <tt class="filename">.tgz</tt>, <tt class=
6927: "filename">.tar.gz2</tt>, <tt class=
6928: "filename">.tbz</tt>, <tt class=
6929: "filename">.tar.Z</tt>, <tt class=
6930: "filename">.tar</tt>, <tt class=
6931: "filename">.shar.gz</tt>, <tt class=
6932: "filename">.shar.bz2</tt>, <tt class=
6933: "filename">.shar.Z</tt>, <tt class=
6934: "filename">.shar</tt>, <tt class=
6935: "filename">.Z</tt>, <tt class="filename">.bz2</tt>
6936: and <tt class="filename">.gz</tt>; see the
6937: definition of the various <tt class=
6938: "varname">DECOMPRESS_CMD</tt> variables <tt class=
6939: "filename">bsd.pkg.mk</tt> for a complete list).
6940: Here's an example on how to use the other variables
6941: for a program that comes with a compressed shell
6942: archive whose name ends in <tt class=
6943: "filename">.msg.gz</tt>:</p>
6944: <pre class="programlisting">
6945: EXTRACT_SUFX= .msg.gz
6946: EXTRACT_CMD= zcat
6947: EXTRACT_BEFORE_ARGS=
6948: EXTRACT_AFTER_ARGS= |sh
6949: </pre>
6950: </dd>
6951:
6952: <dt><span class="term">patch</span></dt>
6953:
6954: <dd>
6955: <p>After extraction, all the patches named by the
6956: <tt class="varname">PATCHFILES</tt>, those present
6957: in the patches subdirectory of the package as well
6958: as in $LOCALPATCHES/$PKGPATH (e.g. <tt class=
6959: "filename">/usr/local/patches/graphics/png</tt>)
6960: are applied. Patchfiles ending in <tt class=
6961: "filename">.Z</tt> or <tt class="filename">.gz</tt>
6962: are uncompressed before they are applied, files
6963: ending in <tt class="filename">.orig</tt> or
6964: <tt class="filename">.rej</tt> are ignored. Any
6965: special options to patch(1) can be handed in
6966: <tt class="varname">PATCH_DIST_ARGS</tt>. See
6967: <a href="#components.patches" title=
6968: "7.3. patches/*">Section 7.3,
6969: “patches/*”</a> for more details.</p>
6970:
6971: <p>By default patch(1) is given special args to
6972: make it fail if the patches apply with some lines
6973: of fuzz. Please fix (regen) the patches so that
6974: they apply cleanly. The rationale behind this is
6975: that patches that don't apply cleanly may end up
6976: being applied in the wrong place, and cause severe
6977: harm there.</p>
6978: </dd>
6979:
6980: <dt><span class="term">configure</span></dt>
6981:
6982: <dd>
6983: <p>Most pieces of software need information on the
6984: header files, system calls, and library routines
6985: which are available in NetBSD. This is the process
6986: known as configuration, and is usually automated.
6987: In most cases, a script is supplied with the
6988: source, and its invocation results in generation of
6989: header files, Makefiles, etc.</p>
6990:
6991: <p>If the program's distfile contains its own
6992: configure script, this can be invoked by setting
6993: <tt class="varname">HAS_CONFIGURE</tt>. If the
6994: configure script is a GNU autoconf script,
6995: <tt class="varname">GNU_CONFIGURE</tt> should be
6996: specified instead. In either case, any arguments to
6997: the configure script can be specified in the
6998: <tt class="varname">CONFIGURE_ARGS</tt> variable,
6999: and the configure script's name can be set in
7000: <tt class="varname">CONFIGURE_SCRIPT</tt> if it
7001: differs from the default “<span class=
7002: "quote">configure</span>”. Here's an example
7003: from the <a xmlns=
7004: "http://www.w3.org/TR/xhtml1/transitional" href=
7005: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.2 hubertf 7006: class="pkgname">sysutils/top</a> package:</p>
1.1 grant 7007: <pre class="programlisting">
7008: HAS_CONFIGURE= yes
7009: CONFIGURE_SCRIPT= Configure
7010: CONFIGURE_ARGS+= netbsd13
7011: </pre>
7012:
7013: <p>If the program uses an Imakefile for
7014: configuration, the appropriate steps can be invoked
7015: by setting <tt class="varname">USE_IMAKE</tt> to
7016: “<span class="quote">YES</span>”. (If
7017: you only want the package installed in <tt class=
7018: "varname">$X11PREFIX</tt> but xmkmf not being run,
7019: set <tt class="varname">USE_X11BASE</tt>
7020: instead!)</p>
7021: </dd>
7022:
7023: <dt><span class="term">build</span></dt>
7024:
7025: <dd>
7026: <p>Once configuration has taken place, the software
7027: will be built by invoking <tt class=
7028: "varname">$MAKE_PROGRAM</tt> on <tt class=
7029: "varname">$MAKEFILE</tt> with <tt class=
7030: "varname">$ALL_TARGET</tt> as the target to build.
7031: The default <tt class="varname">MAKE_PROGRAM</tt>
7032: is “<span class="quote">gmake</span>”
7033: if <tt class="varname">USE_GMAKE</tt> is set,
7034: “<span class="quote">make</span>”
7035: otherwise. <tt class="varname">MAKEFILE</tt> is set
7036: to “<span class=
7037: "quote">Makefile</span>” by default, and
7038: <tt class="varname">ALL_TARGET</tt> defaults to
7039: “<span class="quote">all</span>”. Any
7040: of these variables can be set in the package's
7041: Makefile to change the default build process.</p>
7042: </dd>
7043:
7044: <dt><span class="term">install</span></dt>
7045:
7046: <dd>
7047: <p>Once the build stage has completed, the final
7048: step is to install the software in public
7049: directories, so users can access the programs and
7050: files. As in the build-target, <tt class=
7051: "varname">$MAKE_PROGRAM</tt> is invoked on
7052: <tt class="varname">$MAKEFILE</tt> here, but with
7053: the <tt class="varname">$INSTALL_TARGET</tt>
7054: instead, the latter defaulting to
7055: “<span class="quote">install</span>”
7056: (plus “<span class=
7057: "quote">install.man</span>”, if <tt class=
7058: "varname">USE_IMAKE</tt> is set).</p>
7059: </dd>
7060: </dl>
7061: </div>
7062:
7063: <p>If no target is specified, the default is
7064: “<span class="quote">build</span>”. If a
7065: subsequent stage is requested, all prior stages are made:
7066: e.g. <span><b class="command">make build</b></span> will
7067: also perform the equivalent of:</p>
7068: <pre class="programlisting">
7069: make fetch
7070: make checksum
7071: make extract
7072: make patch
7073: make configure
7074: make build
7075: </pre>
7076: </div>
7077:
7078: <div class="sect1" lang="en" xml:lang="en">
7079: <div class="titlepage">
7080: <div>
7081: <div>
7082: <h2 class="title" style="clear: both"><a name=
7083: "build.helpful-targets" id=
7084: "build.helpful-targets"></a>11.3. Other
7085: helpful targets</h2>
7086: </div>
7087: </div>
7088: </div>
7089:
7090: <div class="variablelist">
7091: <dl>
7092: <dt><span class="term">pre/post-*</span></dt>
7093:
7094: <dd>
7095: <p>For any of the main targets described in the
7096: previous section, two auxiliary targets exist with
7097: “<span class="quote">pre-</span>” and
7098: “<span class="quote">post-</span>” used
7099: as a prefix for the main target's name. These
7100: targets are invoked before and after the main
7101: target is called, allowing extra configuration or
7102: installation steps be performed from a package's
7103: Makefile, for example, which a program's configure
7104: script or install target omitted.</p>
7105: </dd>
7106:
7107: <dt><span class="term">do-*</span></dt>
7108:
7109: <dd>
7110: <p>Should one of the main targets do the wrong
7111: thing, and should there be no variable to fix this,
7112: you can redefine it with the do-* target. (Note
7113: that redefining the target itself instead of the
7114: do-* target is a bad idea, as the pre-* and post-*
7115: targets won't be called anymore, etc.) You will not
7116: usually need to do this.</p>
7117: </dd>
7118:
7119: <dt><span class="term">reinstall</span></dt>
7120:
7121: <dd>
7122: <p>If you did a <span><b class="command">make
7123: install</b></span> and you noticed some file was
7124: not installed properly, you can repeat the
7125: installation with this target, which will ignore
7126: the “<span class="quote">already
7127: installed</span>” flag.</p>
7128: </dd>
7129:
7130: <dt><span class="term">deinstall</span></dt>
7131:
7132: <dd>
7133: <p>This target does a pkg_delete(1) in the current
7134: directory, effectively de-installing the package.
7135: The following variables can be used to tune the
7136: behaviour:</p>
7137:
7138: <div class="variablelist">
7139: <dl>
7140: <dt><span class="term"><tt class=
7141: "varname">PKG_VERBOSE</tt></span></dt>
7142:
7143: <dd>
7144: <p>Add a "-v" to the <a href=
7145: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7146: <span class="citerefentry"><span class=
7147: "refentrytitle">pkg_delete</span>(1)</span></a>
7148: command.</p>
7149: </dd>
7150:
7151: <dt><span class="term"><tt class=
7152: "varname">DEINSTALLDEPENDS</tt></span></dt>
7153:
7154: <dd>
7155: <p>Remove all packages that require (depend
7156: on) the given package. This can be used to
7157: remove any packages that may have been pulled
7158: in by a given package, e.g. if
7159: <span><b class="command">make deinstall
7160: DEINSTALLDEPENDS=1</b></span> is done in
7161: <tt class="filename">pkgsrc/x11/kde</tt>,
7162: this is likely to remove whole KDE. Works by
7163: adding “<span class=
7164: "quote">-R</span>” to the <a href=
7165: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7166: <span class="citerefentry"><span class=
7167: "refentrytitle">pkg_delete</span>(1)</span></a>
7168: command line.</p>
7169: </dd>
7170: </dl>
7171: </div>
7172: </dd>
7173:
7174: <dt><span class="term">update</span></dt>
7175:
7176: <dd>
7177: <p>This target causes the current package to be
7178: updated to the latest version. The package and all
7179: depending packages first get de-installed, then
7180: current versions of the corresponding packages get
7181: compiled and installed. This is similar to manually
7182: noting which packages are currently installed, then
7183: performing a series of <span><b class=
7184: "command">make deinstall</b></span> and
7185: <span><b class="command">make install</b></span>
7186: (or whatever <tt class="varname">UPDATE_TARGET</tt>
7187: is set to) for these packages.</p>
7188:
7189: <p>You can use the “<span class=
7190: "quote">update</span>” target to resume
7191: package updating in case a previous <span><b class=
7192: "command">make update</b></span> was interrupted
7193: for some reason. However, in this case, make sure
7194: you don't call <span><b class="command">make
7195: clean</b></span> or otherwise remove the list of
7196: dependent packages in <tt class=
7197: "varname">WRKDIR</tt>. Otherwise you lose the
7198: ability to automatically update the current package
7199: along with the dependent packages you have
7200: installed.</p>
7201:
7202: <p>Resuming an interrupted <span><b class=
7203: "command">make update</b></span> will only work as
7204: long as the package tree remains unchanged. If the
7205: source code for one of the packages to be updated
7206: has been changed, resuming <span><b class=
7207: "command">make update</b></span> will most
7208: certainly fail!</p>
7209:
7210: <p>The following variables can be used either on
7211: the command line or in <tt class=
7212: "filename">/etc/mk.conf</tt> to alter the behaviour
7213: of <span><b class="command">make
7214: update</b></span>:</p>
7215:
7216: <div class="variablelist">
7217: <dl>
7218: <dt><span class="term"><tt class=
7219: "varname">UPDATE_TARGET</tt></span></dt>
7220:
7221: <dd>
7222: <p>Install target to recursively use for the
7223: updated package and the dependent packages.
7224: Defaults to <tt class=
7225: "varname">DEPENDS_TARGET</tt> if set,
7226: “<span class=
7227: "quote">install</span>” otherwise for
7228: <span><b class="command">make
7229: update</b></span>. e.g. <span><b class=
7230: "command">make update
7231: UPDATE_TARGET=package</b></span></p>
7232: </dd>
7233:
7234: <dt><span class="term"><tt class=
7235: "varname">NOCLEAN</tt></span></dt>
7236:
7237: <dd>
7238: <p>Don't clean up after updating. Useful if
7239: you want to leave the work sources of the
7240: updated packages around for inspection or
7241: other purposes. Be sure you eventually clean
7242: up the source tree (see the
7243: “<span class=
7244: "quote">clean-update</span>” target
7245: below) or you may run into troubles with old
7246: source code still lying around on your next
7247: <span><b class="command">make</b></span> or
7248: <span><b class="command">make
7249: update</b></span>.</p>
7250: </dd>
7251:
7252: <dt><span class="term"><tt class=
7253: "varname">REINSTALL</tt></span></dt>
7254:
7255: <dd>
7256: <p>Deinstall each package before installing
7257: (making <tt class=
7258: "varname">DEPENDS_TARGET</tt>). This may be
7259: necessary if the “<span class=
7260: "quote">clean-update</span>” target
7261: (see below) was called after interrupting a
7262: running <span><b class="command">make
7263: update</b></span>.</p>
7264: </dd>
7265:
7266: <dt><span class="term"><tt class=
7267: "varname">DEPENDS_TARGET</tt></span></dt>
7268:
7269: <dd>
7270: <p>Allows you to disable recursion and
7271: hardcode the target for packages. The default
7272: is “<span class=
7273: "quote">update</span>” for the update
7274: target, facilitating a recursive update of
7275: prerequisite packages. Only set <tt class=
7276: "varname">DEPENDS_TARGET</tt> if you want to
7277: disable recursive updates. Use <tt class=
7278: "varname">UPDATE_TARGET</tt> instead to just
7279: set a specific target for each package to be
7280: installed during <span><b class=
7281: "command">make update</b></span> (see
7282: above).</p>
7283: </dd>
7284: </dl>
7285: </div>
7286: </dd>
7287:
7288: <dt><span class="term">clean-update</span></dt>
7289:
7290: <dd>
7291: <p>Clean the source tree for all packages that
7292: would get updated if <span><b class="command">make
7293: update</b></span> was called from the current
7294: directory. This target should not be used if the
7295: current package (or any of its depending packages)
7296: have already been de-installed (e.g., after calling
7297: <span><b class="command">make update</b></span>) or
7298: you may lose some packages you intended to update.
7299: As a rule of thumb: only use this target
7300: <span class="emphasis"><em>before</em></span> the
7301: first time you run <span><b class="command">make
7302: update</b></span> and only if you have a dirty
7303: package tree (e.g., if you used <tt class=
7304: "varname">NOCLEAN</tt>).</p>
7305:
7306: <p>If you unsure about whether your tree is clean
7307: you can either perform a <span><b class=
7308: "command">make clean</b></span> at the top of the
7309: tree, or use the following sequence of commands
7310: from the directory of the package you want to
7311: update (<span class=
7312: "emphasis"><em>before</em></span> running
7313: <span><b class="command">make update</b></span> for
7314: the first time, otherwise you lose all the packages
7315: you wanted to update!):</p>
7316: <pre class="screen">
7317: <tt class="prompt">#</tt> <b class=
7318: "userinput"><tt>make clean-update</tt></b>
7319: <tt class="prompt">#</tt> <b class=
7320: "userinput"><tt>make clean CLEANDEPENDS=YES</tt></b>
7321: <tt class="prompt">#</tt> <b class=
7322: "userinput"><tt>make update</tt></b>
7323: </pre>
7324:
7325: <p>The following variables can be used either on
7326: the command line or in <tt class=
7327: "filename">/etc/mk.conf</tt> to alter the behaviour
7328: of <span><b class="command">make
7329: clean-update</b></span>:</p>
7330:
7331: <div class="variablelist">
7332: <dl>
7333: <dt><span class="term"><tt class=
7334: "varname">CLEAR_DIRLIST</tt></span></dt>
7335:
7336: <dd>
7337: <p>After <span><b class="command">make
7338: clean</b></span>, do not reconstruct the list
7339: of directories to update for this package.
7340: Only use this if <span><b class=
7341: "command">make update</b></span> successfully
7342: installed all packages you wanted to update.
7343: Normally, this is done automatically on
7344: <span><b class="command">make
7345: update</b></span>, but may have been
7346: suppressed by the <tt class=
7347: "varname">NOCLEAN</tt> variable (see
7348: above).</p>
7349: </dd>
7350: </dl>
7351: </div>
7352: </dd>
7353:
7354: <dt><span class="term">info</span></dt>
7355:
7356: <dd>
7357: <p>This target invokes <a href=
7358: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
7359: <span class="citerefentry"><span class=
7360: "refentrytitle">pkg_info</span>(1)</span></a> for
7361: the current package. You can use this to check
7362: which version of a package is installed.</p>
7363: </dd>
7364:
7365: <dt><span class="term">readme</span></dt>
7366:
7367: <dd>
7368: <p>This target generates a <tt class=
7369: "filename">README.html</tt> file, which can be
7370: viewed using a browser such as <a xmlns=
7371: "http://www.w3.org/TR/xhtml1/transitional" href=
7372: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.2 hubertf 7373: class="pkgname">www/mozilla</a> or <a xmlns=
7374: "http://www.w3.org/TR/xhtml1/transitional" href=
7375: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
7376: class="pkgname">www/links</a>. The generated
7377: files contain references to any packages which
7378: are in the <tt class="varname">PACKAGES</tt>
7379: directory on the local host. The generated files
7380: can be made to refer to URLs based on <tt class=
7381: "varname">FTP_PKG_URL_HOST</tt> and <tt class=
7382: "varname">FTP_PKG_URL_DIR</tt>. For example, if
7383: I wanted to generate <tt class=
7384: "filename">README.html</tt> files which pointed
7385: to binary packages on the local machine, in the
7386: directory <tt class=
7387: "filename">/usr/packages</tt>, set <tt class=
7388: "varname">FTP_PKG_URL_HOST=file://localhost</tt>
7389: and <tt class=
7390: "varname">FTP_PKG_URL_DIR=/usr/packages</tt>.
7391: The <tt class="varname">${PACKAGES}</tt>
7392: directory and its subdirectories will be
7393: searched for all the binary packages.</p>
1.1 grant 7394: </dd>
7395:
7396: <dt><span class="term">readme-all</span></dt>
7397:
7398: <dd>
7399: <p>Use this target to create a file <tt class=
7400: "filename">README-all.html</tt> which contains a
7401: list of all packages currently available in the
7402: NetBSD Packages Collection, together with the
7403: category they belong to and a short description.
7404: This file is compiled from the <tt class=
7405: "filename">pkgsrc/*/README.html</tt> files, so be
7406: sure to run this <span class=
7407: "emphasis"><em>after</em></span> a <span><b class=
7408: "command">make readme</b></span>.</p>
7409: </dd>
7410:
7411: <dt><span class="term">cdrom-readme</span></dt>
7412:
7413: <dd>
7414: <p>This is very much the same as the
7415: “<span class="quote">readme</span>”
7416: target (see above), but is to be used when
7417: generating a pkgsrc tree to be written to a CD-ROM.
7418: This target also produces <tt class=
7419: "filename">README.html</tt> files, and can be made
7420: to refer to URLs based on <tt class=
7421: "varname">CDROM_PKG_URL_HOST</tt> and <tt class=
7422: "varname">CDROM_PKG_URL_DIR</tt>.</p>
7423: </dd>
7424:
7425: <dt><span class="term">show-distfiles</span></dt>
7426:
7427: <dd>
7428: <p>This target shows which distfiles and patchfiles
7429: are needed to build the package. (<tt class=
7430: "varname">DISTFILES</tt> and <tt class=
7431: "varname">PATCHFILES</tt>, but not <tt class=
7432: "filename">patches/*</tt>)</p>
7433: </dd>
7434:
7435: <dt><span class="term">show-downlevel</span></dt>
7436:
7437: <dd>
7438: <p>This target shows nothing if the package is not
7439: installed. If a version of this package is
7440: installed, but is not the version provided in this
7441: version of pkgsrc, then a warning message is
7442: displayed. This target can be used to show which of
7443: your installed packages are downlevel, and so the
7444: old versions can be deleted, and the current ones
7445: added.</p>
7446: </dd>
7447:
7448: <dt><span class="term">show-pkgsrc-dir</span></dt>
7449:
7450: <dd>
7451: <p>This target shows the directory in the pkgsrc
7452: hierarchy from which the package can be built and
7453: installed. This may not be the same directory as
7454: the one from which the package was installed. This
7455: target is intended to be used by people who may
7456: wish to upgrade many packages on a single host, and
7457: can be invoked from the top-level pkgsrc Makefile
7458: by using the “<span class=
7459: "quote">show-host-specific-pkgs</span>”
7460: target.</p>
7461: </dd>
7462:
7463: <dt><span class=
7464: "term">show-installed-depends</span></dt>
7465:
7466: <dd>
7467: <p>This target shows which installed packages match
7468: the current package's <tt class=
7469: "varname">DEPENDS</tt>. Useful if out of date
7470: dependencies are causing build problems.</p>
7471: </dd>
7472:
7473: <dt><span class="term">check-shlibs</span></dt>
7474:
7475: <dd>
7476: <p>After a package is installed, check all its
7477: binaries and (on ELF platforms) shared libraries to
7478: see if they find the shared libs they need. Run by
7479: default if <tt class="varname">PKG_DEVELOPER</tt>
7480: is set in <tt class=
7481: "filename">/etc/mk.conf</tt>.</p>
7482: </dd>
7483:
7484: <dt><span class="term">print-PLIST</span></dt>
7485:
7486: <dd>
7487: <p>After a “<span class="quote">make
7488: install</span>” from a new or upgraded pkg,
7489: this prints out an attempt to generate a new
7490: <tt class="filename">PLIST</tt> from a
7491: <span><b class="command">find -newer
7492: work/.extract_done</b></span>. An attempt is made
7493: to care for shared libs etc., but it is
7494: <span class="emphasis"><em>strongly</em></span>
7495: recommended to review the result before putting it
7496: into <tt class="filename">PLIST</tt>. On upgrades,
7497: it's useful to diff the output of this command
7498: against an already existing <tt class=
7499: "filename">PLIST</tt> file.</p>
7500:
7501: <p>If the package installs files via tar(1) or
7502: other methods that don't update file access times,
7503: be sure to add these files manually to your
7504: <tt class="filename">PLIST</tt>, as the
7505: “<span class="quote">find
7506: -newer</span>” command used by this target
7507: won't catch them!</p>
7508:
7509: <p>See <a href="#print-PLIST" title=
7510: "8.3. Tweaking output of make print-PLIST">Section 8.3,
7511: “Tweaking output of make
7512: print-PLIST”</a> for more information on this
7513: target.</p>
7514: </dd>
7515:
7516: <dt><span class="term">bulk-package</span></dt>
7517:
7518: <dd>
7519: <p>Used to do bulk builds. If an appropriate binary
7520: package already exists, no action is taken. If not,
7521: this target will compile, install and package it
7522: (and it's depends, if <tt class=
7523: "varname">PKG_DEPENDS</tt> is set properly. See
7524: <a href="#binary.configuration" title=
7525: "5.3.1. Configuration">Section 5.3.1,
7526: “Configuration”</a>. After creating the
7527: binary package, the sources, the just-installed
7528: package and it's required packages are removed,
7529: preserving free disk space.</p>
7530:
7531: <p><span class="emphasis"><em>Beware that this
7532: target may deinstall all packages installed on a
7533: system!</em></span></p>
7534: </dd>
7535:
7536: <dt><span class="term">bulk-install</span></dt>
7537:
7538: <dd>
7539: <p>Used during bulk-installs to install required
7540: packages. If an upto-date binary package is
7541: available, it will be installed via <a href=
7542: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7543: <span class="citerefentry"><span class=
7544: "refentrytitle">pkg_add</span>(1)</span></a>. If
7545: not, <span><b class="command">make
7546: bulk-package</b></span> will be executed, but the
7547: installed binary not be removed.</p>
7548:
7549: <p>A binary package is considered
7550: “<span class="quote">upto-date</span>”
7551: to be installed via <a href=
7552: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7553: <span class="citerefentry"><span class=
7554: "refentrytitle">pkg_add</span>(1)</span></a>
7555: if:</p>
7556:
7557: <div class="itemizedlist">
7558: <ul type="disc">
7559: <li>
7560: <p>None of the package's files (<tt class=
7561: "filename">Makefile</tt>, ...) were modified
7562: since it was built.</p>
7563: </li>
7564:
7565: <li>
7566: <p>None of the package's required (binary)
7567: packages were modified since it was
7568: built.</p>
7569: </li>
7570: </ul>
7571: </div>
7572:
7573: <p><span class="emphasis"><em>Beware that this
7574: target may deinstall all packages installed on a
7575: system!</em></span></p>
7576: </dd>
7577: </dl>
7578: </div>
7579: </div>
7580: </div>
7581:
7582: <div class="chapter" lang="en" xml:lang="en">
7583: <div class="titlepage">
7584: <div>
7585: <div>
7586: <h2 class="title"><a name="fixes" id=
7587: "fixes"></a>Chapter 12. Notes on fixes for
7588: packages</h2>
7589: </div>
7590: </div>
7591: </div>
7592:
7593: <div class="toc">
7594: <p><b>Table of Contents</b></p>
7595:
7596: <dl>
1.3 hubertf 7597: <dt><span class="sect1"><a href="#id2570842">12.1.
1.1 grant 7598: General operation</a></span></dt>
7599:
7600: <dd>
7601: <dl>
7602: <dt><span class="sect2"><a href=
1.3 hubertf 7603: "#id2570845">12.1.1. How to pull in variables from
1.1 grant 7604: /etc/mk.conf</a></span></dt>
7605:
7606: <dt><span class="sect2"><a href=
1.3 hubertf 7607: "#id2570929">12.1.2. Restricted
1.1 grant 7608: packages</a></span></dt>
7609:
7610: <dt><span class="sect2"><a href=
7611: "#dependencies">12.1.3. Handling
7612: dependencies</a></span></dt>
7613:
7614: <dt><span class="sect2"><a href=
1.3 hubertf 7615: "#id2571444">12.1.4. Handling conflicts with other
1.1 grant 7616: packages</a></span></dt>
7617:
7618: <dt><span class="sect2"><a href=
1.3 hubertf 7619: "#id2571494">12.1.5. Packages that cannot or should
1.1 grant 7620: not be built</a></span></dt>
7621:
7622: <dt><span class="sect2"><a href=
1.3 hubertf 7623: "#id2571520">12.1.6. Packages which should not be
1.1 grant 7624: deleted, once installed</a></span></dt>
7625:
7626: <dt><span class="sect2"><a href=
7627: "#security-handling">12.1.7. Handling packages with
7628: security problems</a></span></dt>
7629:
7630: <dt><span class="sect2"><a href=
1.3 hubertf 7631: "#id2571611">12.1.8. How to handle compiler
1.1 grant 7632: bugs</a></span></dt>
7633:
7634: <dt><span class="sect2"><a href=
1.3 hubertf 7635: "#id2571634">12.1.9. How to handle incrementing
1.1 grant 7636: versions when fixing an existing
7637: package</a></span></dt>
7638:
7639: <dt><span class="sect2"><a href=
1.3 hubertf 7640: "#id2571751">12.1.10. Portability of
1.1 grant 7641: packages</a></span></dt>
7642: </dl>
7643: </dd>
7644:
1.3 hubertf 7645: <dt><span class="sect1"><a href="#id2571776">12.2.
1.1 grant 7646: Possible downloading issues</a></span></dt>
7647:
7648: <dd>
7649: <dl>
7650: <dt><span class="sect2"><a href=
1.3 hubertf 7651: "#id2571779">12.2.1. Packages whose distfiles
1.1 grant 7652: aren't available for plain
7653: downloading</a></span></dt>
7654:
7655: <dt><span class="sect2"><a href=
1.3 hubertf 7656: "#id2571978">12.2.2. How to handle modified
1.1 grant 7657: distfiles with the 'old' name</a></span></dt>
7658: </dl>
7659: </dd>
7660:
1.3 hubertf 7661: <dt><span class="sect1"><a href="#id2571990">12.3.
1.1 grant 7662: Configuration gotchas</a></span></dt>
7663:
7664: <dd>
7665: <dl>
7666: <dt><span class="sect2"><a href=
7667: "#fixes.libtool">12.3.1. Shared libraries -
7668: libtool</a></span></dt>
7669:
7670: <dt><span class="sect2"><a href=
1.3 hubertf 7671: "#id2572397">12.3.2. Using libtool on GNU packages
1.1 grant 7672: that already support libtool</a></span></dt>
7673:
7674: <dt><span class="sect2"><a href=
1.3 hubertf 7675: "#id2572482">12.3.3. GNU
1.1 grant 7676: Autoconf/Automake</a></span></dt>
7677: </dl>
7678: </dd>
7679:
1.3 hubertf 7680: <dt><span class="sect1"><a href="#id2572526">12.4.
1.1 grant 7681: Building considerations</a></span></dt>
7682:
7683: <dd>
7684: <dl>
7685: <dt><span class="sect2"><a href=
1.3 hubertf 7686: "#id2572530">12.4.1. CPP defines</a></span></dt>
1.1 grant 7687: </dl>
7688: </dd>
7689:
1.3 hubertf 7690: <dt><span class="sect1"><a href="#id2572560">12.5.
1.1 grant 7691: Package specific actions</a></span></dt>
7692:
7693: <dd>
7694: <dl>
7695: <dt><span class="sect2"><a href=
1.3 hubertf 7696: "#id2572563">12.5.1. Package configuration
1.1 grant 7697: files</a></span></dt>
7698:
7699: <dt><span class="sect2"><a href=
1.3 hubertf 7700: "#id2572733">12.5.2. User
1.2 hubertf 7701: interaction</a></span></dt>
1.1 grant 7702:
7703: <dt><span class="sect2"><a href=
1.3 hubertf 7704: "#id2572778">12.5.3. Handling
1.1 grant 7705: licenses</a></span></dt>
7706:
7707: <dt><span class="sect2"><a href=
1.3 hubertf 7708: "#id2572861">12.5.4. Creating an account from a
1.1 grant 7709: package</a></span></dt>
7710:
7711: <dt><span class="sect2"><a href=
1.3 hubertf 7712: "#id2572992">12.5.5. Installing score
1.1 grant 7713: files</a></span></dt>
7714:
7715: <dt><span class="sect2"><a href=
1.3 hubertf 7716: "#id2573035">12.5.6. Packages providing login
1.1 grant 7717: shells</a></span></dt>
7718:
7719: <dt><span class="sect2"><a href=
1.3 hubertf 7720: "#id2573161">12.5.7. Packages containing perl
1.1 grant 7721: scripts</a></span></dt>
7722:
7723: <dt><span class="sect2"><a href=
1.3 hubertf 7724: "#id2573248">12.5.8. Packages with hardcoded paths
1.1 grant 7725: to other interpreters</a></span></dt>
7726:
7727: <dt><span class="sect2"><a href=
1.3 hubertf 7728: "#id2573269">12.5.9. Packages installing perl
1.1 grant 7729: modules</a></span></dt>
7730:
7731: <dt><span class="sect2"><a href=
7732: "#faq.info-files">12.5.10. Packages installing info
7733: files</a></span></dt>
7734:
7735: <dt><span class="sect2"><a href=
1.3 hubertf 7736: "#id2573557">12.5.11. Packages installing GConf2
1.1 grant 7737: data files</a></span></dt>
7738:
7739: <dt><span class="sect2"><a href=
1.3 hubertf 7740: "#id2573657">12.5.12. Packages installing
1.1 grant 7741: scrollkeeper data files</a></span></dt>
7742:
7743: <dt><span class="sect2"><a href=
1.3 hubertf 7744: "#id2573708">12.5.13. Packages installing X11
1.1 grant 7745: fonts</a></span></dt>
7746:
7747: <dt><span class="sect2"><a href=
1.3 hubertf 7748: "#id2573824">12.5.14. Packages installing GTK2
1.1 grant 7749: modules</a></span></dt>
7750:
7751: <dt><span class="sect2"><a href=
1.3 hubertf 7752: "#id2573893">12.5.15. Packages installing SGML or
1.1 grant 7753: XML data</a></span></dt>
7754:
7755: <dt><span class="sect2"><a href=
1.3 hubertf 7756: "#id2573945">12.5.16. Packages installing
1.1 grant 7757: extensions to the MIME database</a></span></dt>
7758:
7759: <dt><span class="sect2"><a href=
1.3 hubertf 7760: "#id2574016">12.5.17. Packages using
1.1 grant 7761: intltool</a></span></dt>
7762: </dl>
7763: </dd>
7764:
1.3 hubertf 7765: <dt><span class="sect1"><a href="#id2574029">12.6.
1.1 grant 7766: Feedback to the author</a></span></dt>
7767: </dl>
7768: </div>
7769:
7770: <div class="sect1" lang="en" xml:lang="en">
7771: <div class="titlepage">
7772: <div>
7773: <div>
7774: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 7775: "id2570842" id="id2570842"></a>12.1. General
1.1 grant 7776: operation</h2>
7777: </div>
7778: </div>
7779: </div>
7780:
7781: <div class="sect2" lang="en" xml:lang="en">
7782: <div class="titlepage">
7783: <div>
7784: <div>
1.3 hubertf 7785: <h3 class="title"><a name="id2570845" id=
7786: "id2570845"></a>12.1.1. How to pull in
1.1 grant 7787: variables from /etc/mk.conf</h3>
7788: </div>
7789: </div>
7790: </div>
7791:
7792: <p>The problem with package-defined variables that can
7793: be overridden via <tt class="varname">MAKECONF</tt> or
7794: <tt class="filename">/etc/mk.conf</tt> is that <a href=
7795: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7796: <span class="citerefentry"><span class=
7797: "refentrytitle">make</span>(1)</span></a> expands a
7798: variable as it is used, but evaluates preprocessor like
7799: statements (.if, .ifdef and .ifndef) as they are read.
7800: So, to use any variable (which may be set in <tt class=
7801: "filename">/etc/mk.conf</tt>) in one of the .if*
7802: statements, the file <tt class=
7803: "filename">/etc/mk.conf</tt> must be included before
7804: that .if* statement.</p>
7805:
7806: <p>Rather than have a number of ad-hoc ways of
7807: including <tt class="filename">/etc/mk.conf</tt>,
7808: should it exist, or <tt class="varname">MAKECONF</tt>,
7809: should it exist, include the <tt class=
7810: "filename">pkgsrc/mk/bsd.prefs.mk</tt> file in the
7811: package Makefile before any preprocessor-like .if,
7812: .ifdef, or .ifndef statements:</p>
7813: <pre class="programlisting">
7814: .include "../../mk/bsd.prefs.mk"
7815:
7816: .if defined(USE_MENUS)
7817: ...
7818: .endif
7819: </pre>
7820:
7821: <p>If you wish to set the <tt class=
7822: "varname">CFLAGS</tt> variable in <tt class=
7823: "filename">/etc/mk.conf</tt> please make sure to
7824: use:</p>
7825: <pre class="programlisting">
7826: CFLAGS+= -your -flags
7827: </pre>
7828:
7829: <p>Using <tt class="varname">CFLAGS=</tt> (i.e. without
7830: the “<span class="quote">+</span>”) may
7831: lead to problems with packages that need to add their
7832: own flags. Also, you may want to take a look at the
7833: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
7834: href=
7835: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.2 hubertf 7836: class="pkgname">devel/cpuflags</a> package if you're
7837: interested in optimization for the current CPU.</p>
1.1 grant 7838: </div>
7839:
7840: <div class="sect2" lang="en" xml:lang="en">
7841: <div class="titlepage">
7842: <div>
7843: <div>
1.3 hubertf 7844: <h3 class="title"><a name="id2570929" id=
7845: "id2570929"></a>12.1.2. Restricted
1.1 grant 7846: packages</h3>
7847: </div>
7848: </div>
7849: </div>
7850:
7851: <p>Some licenses restrict how software may be
7852: re-distributed. In order to satisfy these restrictions,
7853: the package system defines five make variables that can
7854: be set to note these restrictions:</p>
7855:
7856: <div class="itemizedlist">
7857: <ul type="disc">
7858: <li>
7859: <p><tt class="varname">RESTRICTED</tt></p>
7860:
7861: <p>This variable should be set whenever a
7862: restriction exists (regardless of its kind). Set
7863: this variable to a string containing the reason
7864: for the restriction.</p>
7865: </li>
7866:
7867: <li>
7868: <p><tt class="varname">NO_BIN_ON_CDROM</tt></p>
7869:
7870: <p>Binaries may not be placed on CD-ROM. Set this
7871: variable to <tt class=
7872: "varname">${RESTRICTED}</tt> whenever a binary
7873: package may not be included on a CD-ROM.</p>
7874: </li>
7875:
7876: <li>
7877: <p><tt class="varname">NO_BIN_ON_FTP</tt></p>
7878:
7879: <p>Binaries may not be placed on an FTP server.
7880: Set this variable to <tt class=
7881: "varname">${RESTRICTED}</tt> whenever a binary
7882: package may not not be made available on the
7883: Internet.</p>
7884: </li>
7885:
7886: <li>
7887: <p><tt class="varname">NO_SRC_ON_CDROM</tt></p>
7888:
7889: <p>Distfiles may not be placed on CD-ROM. Set
7890: this variable to <tt class=
7891: "varname">${RESTRICTED}</tt> if re-distribution
7892: of the source code or other distfile(s) is not
7893: allowed on CD-ROMs.</p>
7894: </li>
7895:
7896: <li>
7897: <p><tt class="varname">NO_SRC_ON_FTP</tt></p>
7898:
7899: <p>Distfiles may not be placed on FTP. Set this
7900: variable to <tt class=
7901: "varname">${RESTRICTED}</tt> if re-distribution
7902: of the source code or other distfile(s) via the
7903: Internet is not allowed.</p>
7904: </li>
7905: </ul>
7906: </div>
7907:
7908: <p>Please note that the use of <tt class=
7909: "varname">NO_PACKAGE</tt>, <tt class=
7910: "varname">IGNORE</tt>, <tt class=
7911: "varname">NO_CDROM</tt>, or other generic make
7912: variables to denote restrictions is deprecated, because
7913: they unconditionally prevent users from generating
7914: binary packages!</p>
7915: </div>
7916:
7917: <div class="sect2" lang="en" xml:lang="en">
7918: <div class="titlepage">
7919: <div>
7920: <div>
7921: <h3 class="title"><a name="dependencies" id=
7922: "dependencies"></a>12.1.3. Handling
7923: dependencies</h3>
7924: </div>
7925: </div>
7926: </div>
7927:
7928: <p>Your package may depend on some other package being
7929: present - and there are various ways of expressing this
7930: dependency. pkgsrc supports the <tt class=
7931: "varname">BUILD_DEPENDS</tt> and <tt class=
7932: "varname">DEPENDS</tt> definitions, as well as
7933: dependencies via <tt class=
7934: "filename">buildlink3.mk</tt>, which is the preferred
7935: way to handle dependencies, and which uses the
7936: variables named above. See <a href="#buildlink" title=
7937: "Chapter 9. Buildlink methodology">Chapter 9,
7938: <i>Buildlink methodology</i></a> for more
7939: information.</p>
7940:
7941: <p>The basic difference between the two variables is as
7942: follows: The <tt class="varname">DEPENDS</tt>
7943: definition registers that pre-requisite in the binary
7944: package so it will be pulled in when the binary package
7945: is later installed, whilst the <tt class=
7946: "varname">BUILD_DEPENDS</tt> definition does not,
7947: marking a dependency that is only needed for building
7948: the package.</p>
7949:
7950: <p>This means that if you only need a package present
7951: whilst you are building, it should be noted as a
7952: <tt class="varname">BUILD_DEPENDS</tt>.</p>
7953:
7954: <p>The format for a <tt class=
7955: "varname">BUILD_DEPENDS</tt> and a <tt class=
7956: "varname">DEPENDS</tt> definition is:</p>
7957: <pre class="programlisting">
7958: <pre-req-package-name>:../../<category>/<pre-req-package>
7959: </pre>
7960:
7961: <p>Please note that the “<span class=
7962: "quote">pre-req-package-name</span>” may include
7963: any of the wildcard version numbers recognised by
7964: <a href=
7965: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
7966: <span class="citerefentry"><span class=
7967: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
7968:
7969: <div class="orderedlist">
7970: <ol type="1">
7971: <li>
7972: <p>If your package needs another package's
7973: binaries or libraries to build or run, and if
7974: that package has a <tt class=
7975: "filename">buildlink3.mk</tt> file available, use
7976: it:</p>
7977: <pre class="programlisting">
7978: .include "../../graphics/jpeg/buildlink3.mk"
7979:
7980: </pre>
7981: </li>
7982:
7983: <li>
7984: <p>If your package needs to use another package
7985: to build itself and there is no <tt class=
7986: "filename">buildlink3.mk</tt> file available, use
7987: the <tt class="varname">BUILD_DEPENDS</tt>
7988: definition:</p>
7989: <pre class="programlisting">
7990: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
7991: </pre>
7992: </li>
7993:
7994: <li>
7995: <p>If your package needs a library with which to
7996: link and again there is no <tt class=
7997: "filename">buildlink3.mk</tt> file available,
7998: this is specified using the <tt class=
7999: "varname">DEPENDS</tt> definition. An example of
8000: this is the <a xmlns=
8001: "http://www.w3.org/TR/xhtml1/transitional" href=
8002: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.2 hubertf 8003: class="pkgname">print/lyx</a> package, which
8004: uses the xpm library, version 3.4j to
8005: build:</p>
1.1 grant 8006: <pre class="programlisting">
8007: DEPENDS+= xpm-3.4j:../../graphics/xpm
8008: </pre>
8009:
8010: <p>You can also use wildcards in package
8011: dependences:</p>
8012: <pre class="programlisting">
8013: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
8014: </pre>
8015:
8016: <p>Note that such wildcard dependencies are
8017: retained when creating binary packages. The
8018: dependency is checked when installing the binary
8019: package and any package which matches the pattern
8020: will be used. Wildcard dependencies should be
8021: used with care.</p>
8022:
8023: <p>The “<span class=
8024: "quote">-[0-9]*</span>” should be used
8025: instead of “<span class=
8026: "quote">-*</span>” to avoid potentially
8027: ambiguous matches such as “<span class=
8028: "quote">tk-postgresql</span>” matching a
8029: “<span class="quote">tk-*</span>”
8030: <tt class="varname">DEPENDS</tt>.</p>
8031:
8032: <p>Wildcards can also be used to specify that a
8033: package will only build against a certain minimum
8034: version of a pre-requisite:</p>
8035: <pre class="programlisting">
8036: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
8037: </pre>
8038:
8039: <p>This means that the package will build against
8040: version 3.5.4 of the tiff library or newer. Such
8041: a dependency may be warranted if, for example,
8042: the API of the library has changed with version
8043: 3.5.4 and a package would not compile against an
8044: earlier version of tiff.</p>
8045:
8046: <p>Please note that such dependencies should only
8047: be updated if a package requires a newer
8048: pre-requisite, but not to denote recommendations
8049: such as security updates or ABI changes that do
8050: not prevent a package from building correctly.
8051: Such recommendations can be expressed using
8052: <tt class="varname">RECOMMENDED</tt>:</p>
8053: <pre class="programlisting">
8054: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
8055: </pre>
8056:
8057: <p>In addition to the above <tt class=
8058: "varname">DEPENDS</tt> line, this denotes that
8059: while a package will build against
8060: tiff>=3.5.4, at least version 3.6.1 is
8061: recommended. <tt class="varname">RECOMMENDED</tt>
8062: entries will be turned into dependencies unless
8063: explicitly ignored (in which case a warning will
8064: be printed). Packages that are built with
8065: recommendations ignored may not be uploaded to
8066: ftp.NetBSD.org by developers and should not be
8067: used across different systems that may have
8068: different versions of binary packages
8069: installed.</p>
8070:
8071: <p>For security fixes, please update the package
8072: vulnerabilities file as well as setting
8073: <tt class="varname">RECOMMENDED</tt>, see
8074: <a href="#security-handling" title=
8075: "12.1.7. Handling packages with security problems">
8076: Section 12.1.7, “Handling packages with
8077: security problems”</a> for more
8078: information.</p>
8079: </li>
8080:
8081: <li>
8082: <p>If your package needs some executable to be
8083: able to run correctly and if there's agail no
8084: <tt class="filename">buildlink3.mk</tt> file,
8085: this is specified using the <tt class=
8086: "varname">DEPENDS</tt> variable. The <a xmlns=
8087: "http://www.w3.org/TR/xhtml1/transitional" href=
8088: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.2 hubertf 8089: class="pkgname">print/lyx</a> package needs to
8090: be able to execute the latex binary from the
8091: teTeX package when it runs, and that is
8092: specified:</p>
1.1 grant 8093: <pre class="programlisting">
8094: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
8095: </pre>
8096:
8097: <p>The comment about wildcard dependencies from
8098: previous paragraph applies here, too.</p>
8099: </li>
8100: </ol>
8101: </div>
8102:
8103: <p>If your package needs files from another package to
8104: build, see the first part of the “<span class=
8105: "quote">do-configure</span>” target <a xmlns=
8106: "http://www.w3.org/TR/xhtml1/transitional" href=
8107: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.2 hubertf 8108: class="pkgname">print/ghostscript5</a> package (it
8109: relies on the jpeg sources being present in source
8110: form during the build):</p>
1.1 grant 8111: <pre class="programlisting">
8112: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
8113: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
8114: fi
8115: </pre>
8116:
8117: <p>If you build any other packages that way, please
8118: make sure the working files are deleted too when this
8119: package's working files are cleaned up. The easiest way
8120: to do so is by adding a pre-clean target:</p>
8121: <pre class="programlisting">
8122: pre-clean:
8123: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
8124: </pre>
8125:
8126: <p>Please also note the <tt class=
8127: "varname">BUILD_USES_MSGFMT</tt> and <tt class=
8128: "varname">BUILD_USES_GETTEXT_M4</tt> definitions, which
8129: are provided as convenience definitions. The former
8130: works out whether msgfmt(1) is part of the base system,
8131: and, if it isn't, installs the <a xmlns=
8132: "http://www.w3.org/TR/xhtml1/transitional" href=
8133: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.2 hubertf 8134: class="pkgname">devel/gettext</a> package. The
8135: latter adds a build dependency on either an
8136: installed version of an older gettext package, or if
8137: it isn't, installs the <a xmlns=
8138: "http://www.w3.org/TR/xhtml1/transitional" href=
8139: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
8140: class="pkgname">devel/gettext-m4</a> package.</p>
1.1 grant 8141: </div>
8142:
8143: <div class="sect2" lang="en" xml:lang="en">
8144: <div class="titlepage">
8145: <div>
8146: <div>
1.3 hubertf 8147: <h3 class="title"><a name="id2571444" id=
8148: "id2571444"></a>12.1.4. Handling conflicts
1.1 grant 8149: with other packages</h3>
8150: </div>
8151: </div>
8152: </div>
8153:
8154: <p>Your package may conflict with other packages a user
8155: might already have installed on his system, e.g. if
8156: your package installs the same set of files like
8157: another package in our pkgsrc tree.</p>
8158:
8159: <p>In this case you can set <tt class=
8160: "varname">CONFLICTS</tt> to a space separated list of
8161: packages (including version string) your package
8162: conflicts with.</p>
8163:
8164: <p>For example <a xmlns=
8165: "http://www.w3.org/TR/xhtml1/transitional" href=
8166: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.2 hubertf 8167: class="pkgname">x11/Xaw3d</a> and <a xmlns=
8168: "http://www.w3.org/TR/xhtml1/transitional" href=
8169: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
8170: class="pkgname">x11/Xaw-Xpm</a> install provide the
8171: same shared library, thus you set in <tt class=
8172: "filename">pkgsrc/x11/Xaw3d/Makefile</tt>:</p>
1.1 grant 8173: <pre class="programlisting">
8174: CONFLICTS= Xaw-Xpm-[0-9]*
8175: </pre>
8176:
8177: <p>and in <tt class=
8178: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</tt>:</p>
8179: <pre class="programlisting">
8180: CONFLICTS= Xaw3d-[0-9]*
8181: </pre>
8182:
8183: <p>Packages will automatically conflict with other
8184: packages with the name prefix and a different version
8185: string. “<span class=
8186: "quote">Xaw3d-1.5</span>” e.g. will automatically
8187: conflict with the older version “<span class=
8188: "quote">Xaw3d-1.3</span>”.</p>
8189: </div>
8190:
8191: <div class="sect2" lang="en" xml:lang="en">
8192: <div class="titlepage">
8193: <div>
8194: <div>
1.3 hubertf 8195: <h3 class="title"><a name="id2571494" id=
8196: "id2571494"></a>12.1.5. Packages that cannot
1.1 grant 8197: or should not be built</h3>
8198: </div>
8199: </div>
8200: </div>
8201:
8202: <p>There are several reasons why a package might be
8203: instructed to not build under certain circumstances. If
8204: the package builds and runs on most platforms, the
8205: exceptions should be noted with <tt class=
8206: "varname">NOT_FOR_PLATFORM</tt>. If the package builds
8207: and runs on a small handful of platforms, set
8208: <tt class="varname">ONLY_FOR_PLATFORM</tt> instead. If
8209: the package should be skipped (for example, because it
8210: provides functionality already provided by the system),
8211: set <tt class="varname">PKG_SKIP_REASON</tt> to a
8212: descriptive message. If the package should fail because
8213: some preconditions are not met, set <tt class=
8214: "varname">PKG_FAIL_REASON</tt> to a descriptive
8215: message.</p>
8216:
8217: <p><tt class="varname">IGNORE</tt> is deprecated
8218: because it didn't provide enough information to
8219: determine whether the build should fail.</p>
8220: </div>
8221:
8222: <div class="sect2" lang="en" xml:lang="en">
8223: <div class="titlepage">
8224: <div>
8225: <div>
1.3 hubertf 8226: <h3 class="title"><a name="id2571520" id=
8227: "id2571520"></a>12.1.6. Packages which
1.1 grant 8228: should not be deleted, once installed</h3>
8229: </div>
8230: </div>
8231: </div>
8232:
8233: <p>To ensure that a package may not be deleted, once it
8234: has been installed, the <tt class=
8235: "varname">PKG_PRESERVE</tt> definition should be set in
8236: the package Makefile. This will be carried into any
8237: binary package that is made from this pkgsrc entry. A
8238: “<span class="quote">preserved</span>”
8239: package will not be deleted using <a href=
8240: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8241: <span class="citerefentry"><span class=
8242: "refentrytitle">pkg_delete</span>(1)</span></a> unless
8243: the “<span class="quote">-f</span>” option
8244: is used.</p>
8245: </div>
8246:
8247: <div class="sect2" lang="en" xml:lang="en">
8248: <div class="titlepage">
8249: <div>
8250: <div>
8251: <h3 class="title"><a name="security-handling" id=
8252: "security-handling"></a>12.1.7. Handling
8253: packages with security problems</h3>
8254: </div>
8255: </div>
8256: </div>
8257:
8258: <p>When a vulnerability is found, this should be noted
8259: in <tt class=
8260: "filename">localsrc/security/advisories/pkg-vulnerabilities</tt>,
8261: and after the commit of that file, it should be copied
8262: to both <tt class=
8263: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</tt>
8264: and <tt class=
8265: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</tt>
8266: on ftp.NetBSD.org using <tt class=
8267: "filename">localsrc/security/advisories/Makefile</tt>.
8268: In addition, if a <tt class=
8269: "filename">buildlink3.mk</tt> file exists for an
8270: affected package, bumping <tt class=
8271: "varname">PKGREVISION</tt> and creating a corresponding
8272: <tt class="varname">BUILDLINK_RECOMMENDED.<i class=
8273: "replaceable"><tt>pkg</tt></i></tt> entry should be
8274: considered. See <a href="#buildlink" title=
8275: "Chapter 9. Buildlink methodology">Chapter 9,
8276: <i>Buildlink methodology</i></a> for more information
8277: about writing <tt class="filename">buildlink3.mk</tt>
8278: files and <tt class="varname">BUILDLINK_*</tt>
8279: definitions.</p>
8280:
8281: <p>Also, if the fix should be applied to the stable
8282: pkgsrc branch, be sure to submit a pullup request!</p>
8283: </div>
8284:
8285: <div class="sect2" lang="en" xml:lang="en">
8286: <div class="titlepage">
8287: <div>
8288: <div>
1.3 hubertf 8289: <h3 class="title"><a name="id2571611" id=
8290: "id2571611"></a>12.1.8. How to handle
1.1 grant 8291: compiler bugs</h3>
8292: </div>
8293: </div>
8294: </div>
8295:
8296: <p>Some source files trigger bugs in the compiler,
8297: based on combinations of compiler version and
8298: architecture and almost always relation to optimisation
8299: being enabled. Common symptoms are gcc internal errors
8300: or never finishing compiling a file.</p>
8301:
8302: <p>Typically a workaround involves testing the
8303: <tt class="varname">MACHINE_ARCH</tt> and compiler
8304: version, disabling optimisation for that
8305: file/<tt class="varname">MACHINE_ARCH</tt>/compiler
8306: combination, and documenting it in <tt class=
8307: "filename">pkgsrc/doc/HACKS</tt>. See that file for a
8308: number of examples!</p>
8309: </div>
8310:
8311: <div class="sect2" lang="en" xml:lang="en">
8312: <div class="titlepage">
8313: <div>
8314: <div>
1.3 hubertf 8315: <h3 class="title"><a name="id2571634" id=
8316: "id2571634"></a>12.1.9. How to handle
1.1 grant 8317: incrementing versions when fixing an existing
8318: package</h3>
8319: </div>
8320: </div>
8321: </div>
8322:
8323: <p>When making fixes to an existing package it can be
8324: useful to change the version number in <tt class=
8325: "varname">PKGNAME</tt>. To avoid conflicting with
8326: future versions by the original author, a
8327: “<span class="quote">nb1</span>”,
8328: “<span class="quote">nb2</span>”, ...
8329: suffix can be used on package versions by setting
8330: <tt class="varname">PKGREVISION=1</tt> (2, ...). The
8331: “<span class="quote">nb</span>” is treated
8332: like a “<span class="quote">.</span>” by
8333: the pkg tools. e.g.</p>
8334: <pre class="programlisting">
8335: DISTNAME= foo-17.42
8336: PKGREVISION= 9
8337: </pre>
8338:
8339: <p>will result in a <tt class="varname">PKGNAME</tt> of
8340: “<span class=
8341: "quote">foo-17.42nb9</span>”.</p>
8342:
8343: <p>When a new release of the package is released, the
8344: <tt class="varname">PKGREVISION</tt> should be removed.
8345: e.g. on a new minor release of the above package,
8346: things should be like:</p>
8347: <pre class="programlisting">
8348: DISTNAME= foo-17.43
8349: </pre>
8350: </div>
8351:
8352: <div class="sect2" lang="en" xml:lang="en">
8353: <div class="titlepage">
8354: <div>
8355: <div>
1.3 hubertf 8356: <h3 class="title"><a name="id2571751" id=
8357: "id2571751"></a>12.1.10. Portability of
1.1 grant 8358: packages</h3>
8359: </div>
8360: </div>
8361: </div>
8362:
8363: <p>One appealing feature of pkgsrc is that it runs on
8364: many different platforms. As a result, it is important
8365: to ensure, where possible, that packages in pkgsrc are
8366: portable. There are some particular details you should
8367: pay attention to while working on pkgsrc.</p>
8368:
8369: <div class="sect3" lang="en" xml:lang="en">
8370: <div class="titlepage">
8371: <div>
8372: <div>
1.3 hubertf 8373: <h4 class="title"><a name="id2571756" id=
8374: "id2571756"></a>12.1.10.1. ${INSTALL},
1.1 grant 8375: ${INSTALL_DATA_DIR}, ...</h4>
8376: </div>
8377: </div>
8378: </div>
8379:
8380: <p>The BSD-compatible <span><b class=
8381: "command">install</b></span> supplied with some
8382: operating systems will not perform more than one
8383: operation at a time. As such, you should call
8384: “<span class="quote">${INSTALL}</span>”,
8385: etc. like this:</p>
8386: <pre class="programlisting">
8387: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
8388: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
8389: </pre>
8390: </div>
8391: </div>
8392: </div>
8393:
8394: <div class="sect1" lang="en" xml:lang="en">
8395: <div class="titlepage">
8396: <div>
8397: <div>
8398: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 8399: "id2571776" id="id2571776"></a>12.2. Possible
1.1 grant 8400: downloading issues</h2>
8401: </div>
8402: </div>
8403: </div>
8404:
8405: <div class="sect2" lang="en" xml:lang="en">
8406: <div class="titlepage">
8407: <div>
8408: <div>
1.3 hubertf 8409: <h3 class="title"><a name="id2571779" id=
8410: "id2571779"></a>12.2.1. Packages whose
1.1 grant 8411: distfiles aren't available for plain
8412: downloading</h3>
8413: </div>
8414: </div>
8415: </div>
8416:
8417: <p>If you need to download from a dynamic URL you can
8418: set <tt class="varname">DYNAMIC_MASTER_SITES</tt> and a
8419: <span><b class="command">make fetch</b></span> will
8420: call <tt class="filename">files/getsite.sh</tt> with
8421: the name of each file to download as an argument,
8422: expecting it to output the URL of the directory from
8423: which to download it. <a xmlns=
8424: "http://www.w3.org/TR/xhtml1/transitional" href=
8425: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.2 hubertf 8426: class="pkgname">graphics/ns-cult3d</a> is an example
8427: of this usage.</p>
1.1 grant 8428:
8429: <p>If the download can't be automated, because the user
8430: must submit personal information to apply for a
8431: password, or must pay for the source, or whatever, you
8432: can set <tt class="varname">_FETCH_MESSAGE</tt> to a
8433: macro which displays a message explaining the
8434: situation. <tt class="varname">_FETCH_MESSAGE</tt> must
8435: be executable shell commands, not just a message.
8436: (Generally, it executes <tt class=
8437: "varname">${ECHO}</tt>). As of this writing, the
8438: following packages use this: <a xmlns=
8439: "http://www.w3.org/TR/xhtml1/transitional" href=
8440: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.2 hubertf 8441: class="pkgname">audio/realplayer</a>, <a xmlns=
8442: "http://www.w3.org/TR/xhtml1/transitional" href=
8443: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
8444: class="pkgname">cad/simian</a>, <a xmlns=
8445: "http://www.w3.org/TR/xhtml1/transitional" href=
8446: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
8447: class="pkgname">devel/ipv6socket</a>, <a xmlns=
8448: "http://www.w3.org/TR/xhtml1/transitional" href=
8449: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
8450: class="pkgname">emulators/vmware-module</a>,
8451: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8452: href=
8453: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
8454: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
8455: "http://www.w3.org/TR/xhtml1/transitional" href=
8456: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
8457: class="pkgname">sysutils/storage-manager</a>,
8458: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8459: href=
8460: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
8461: class="pkgname">www/ap-aolserver</a>, <a xmlns=
8462: "http://www.w3.org/TR/xhtml1/transitional" href=
8463: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
8464: class="pkgname">www/openacs</a>. Try to be
8465: consistent with them.</p>
1.1 grant 8466: </div>
8467:
8468: <div class="sect2" lang="en" xml:lang="en">
8469: <div class="titlepage">
8470: <div>
8471: <div>
1.3 hubertf 8472: <h3 class="title"><a name="id2571978" id=
8473: "id2571978"></a>12.2.2. How to handle
1.1 grant 8474: modified distfiles with the 'old' name</h3>
8475: </div>
8476: </div>
8477: </div>
8478:
8479: <p>Sometimes authors of a software package make some
8480: modifications after the software was released, and they
8481: put up a new distfile without changing the package's
8482: version number. If a package is already in pkgsrc at
8483: that time, the md5 checksum will no longer match. The
8484: correct way to work around this is to update the
8485: package's md5 checksum to match the package on the
8486: master site (beware, any mirrors may not be up to date
8487: yet!), and to remove the old distfile from
8488: ftp.NetBSD.org's <tt class=
8489: "filename">/pub/NetBSD/packages/distfiles</tt>
8490: directory. Furthermore, a mail to the package's author
8491: seems appropriate making sure the distfile was really
8492: updated on purpose, and that no trojan horse or so
8493: crept in.</p>
8494: </div>
8495: </div>
8496:
8497: <div class="sect1" lang="en" xml:lang="en">
8498: <div class="titlepage">
8499: <div>
8500: <div>
8501: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 8502: "id2571990" id=
8503: "id2571990"></a>12.3. Configuration
1.1 grant 8504: gotchas</h2>
8505: </div>
8506: </div>
8507: </div>
8508:
8509: <div class="sect2" lang="en" xml:lang="en">
8510: <div class="titlepage">
8511: <div>
8512: <div>
8513: <h3 class="title"><a name="fixes.libtool" id=
8514: "fixes.libtool"></a>12.3.1. Shared libraries
8515: - libtool</h3>
8516: </div>
8517: </div>
8518: </div>
8519:
8520: <p>pkgsrc supports many different machines, with
8521: different object formats like a.out and ELF, and
8522: varying abilities to do shared library and dynamic
8523: loading at all. To accompany this, varying commands and
8524: options have to be passed to the compiler, linker, etc.
8525: to get the Right Thing, which can be pretty annoying
8526: especially if you don't have all the machines at your
8527: hand to test things. The <a xmlns=
8528: "http://www.w3.org/TR/xhtml1/transitional" href=
8529: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.2 hubertf 8530: class="pkgname">devel/libtool</a> pkg can help here,
8531: as it just “<span class=
8532: "quote">knows</span>” how to build both static
8533: and dynamic libraries from a set of source files,
8534: thus being platform independent.</p>
1.1 grant 8535:
8536: <p>Here's how to use libtool in a pkg in seven simple
8537: steps:</p>
8538:
8539: <div class="orderedlist">
8540: <ol type="1">
8541: <li>
8542: <p>Add <tt class="varname">USE_LIBTOOL=yes</tt>
8543: to the package Makefile.</p>
8544: </li>
8545:
8546: <li>
8547: <p>For library objects, use “<span class=
8548: "quote">${LIBTOOL} --mode=compile
8549: ${CC}</span>” in place of
8550: “<span class="quote">${CC}</span>”.
8551: You could even add it to the definition of
8552: <tt class="varname">CC</tt>, if only libraries
8553: are being built in a given Makefile. This one
8554: command will build both PIC and non-PIC library
8555: objects, so you need not have separate shared and
8556: non-shared library rules.</p>
8557: </li>
8558:
8559: <li>
8560: <p>For the linking of the library, remove any
8561: “<span class="quote">ar</span>”,
8562: “<span class="quote">ranlib</span>”,
8563: and “<span class="quote">ld
8564: -Bshareable</span>” commands, and instead
8565: use:</p>
8566: <pre class="programlisting">
8567: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
8568: </pre>
8569:
8570: <p>Note that the library is changed to have a
8571: <tt class="filename">.la</tt> extension, and the
8572: objects are changed to have a <tt class=
8573: "filename">.lo</tt> extension. Change <tt class=
8574: "varname">OBJS</tt> as necessary. This
8575: automatically creates all of the <tt class=
8576: "filename">.a</tt>, <tt class=
8577: "filename">.so.major.minor</tt>, and ELF symlinks
8578: (if necessary) in the build directory. Be sure to
8579: include “<span class=
8580: "quote">-version-info</span>”, especially
8581: when major and minor are zero, as libtool will
8582: otherwise strip off the shared library
8583: version.</p>
8584:
8585: <p>From the libtool manual:</p>
8586: <pre class="programlisting">
8587: So, libtool library versions are described by three integers:
8588:
8589: CURRENT
8590: The most recent interface number that this library implements.
8591:
8592: REVISION
8593: The implementation number of the CURRENT interface.
8594:
8595: AGE
8596: The difference between the newest and oldest interfaces that this
8597: library implements. In other words, the library implements all the
8598: interface numbers in the range from number `CURRENT - AGE' to
8599: `CURRENT'.
8600:
8601: If two libraries have identical CURRENT and AGE numbers, then the
8602: dynamic linker chooses the library with the greater REVISION number.
8603: </pre>
8604:
8605: <p>The “<span class=
8606: "quote">-release</span>” option will
8607: produce different results for a.out and ELF
8608: (excluding symlinks) in only one case. An ELF
8609: library of the form “<span class=
8610: "quote">libfoo-release.so.<span class=
8611: "emphasis"><em>x</em></span>.<span class=
8612: "emphasis"><em>y</em></span></span>” will
8613: have a symlink of “<span class=
8614: "quote">libfoo.so.<span class=
8615: "emphasis"><em>x</em></span>.<span class=
8616: "emphasis"><em>y</em></span></span>” on an
8617: a.out platform. This is handled
8618: automatically.</p>
8619:
8620: <p>The “<span class="quote">-rpath
8621: argument</span>” is the install directory
8622: of the library being built.</p>
8623:
8624: <p>In the <tt class="filename">PLIST</tt>,
8625: include all of the <tt class="filename">.a</tt>,
8626: <tt class="filename">.la</tt>, and <tt class=
8627: "filename">.so</tt>, <tt class=
8628: "filename">.so.<i class=
8629: "replaceable"><tt>major</tt></i></tt> and
8630: <tt class="filename">.so.<i class=
8631: "replaceable"><tt>major</tt></i>.<i class=
8632: "replaceable"><tt>minor</tt></i></tt> files.</p>
8633: </li>
8634:
8635: <li>
8636: <p>When linking shared object (<tt class=
8637: "filename">.so</tt>) files, i.e. files that are
8638: loaded via dlopen(3), NOT shared libraries, use
8639: “<span class="quote">-module
8640: -avoid-version</span>” to prevent them
8641: getting version tacked on.</p>
8642:
8643: <p>The <tt class="filename">PLIST</tt> file gets
8644: the <tt class="filename">foo.so</tt> entry.</p>
8645: </li>
8646:
8647: <li>
8648: <p>When linking programs that depend on these
8649: libraries <span class=
8650: "emphasis"><em>before</em></span> they are
8651: installed, preface the <a href=
8652: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
8653: <span class="citerefentry"><span class=
8654: "refentrytitle">cc</span>(1)</span></a> or
8655: <a href=
8656: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
8657: <span class="citerefentry"><span class=
8658: "refentrytitle">ld</span>(1)</span></a> line with
8659: “<span class="quote">${LIBTOOL}
8660: --mode=link</span>”, and it will find the
8661: correct libraries (static or shared), but please
8662: be aware that libtool will not allow you to
8663: specify a relative path in -L (such as
8664: “<span class=
8665: "quote">-L../somelib</span>”), because it
8666: expects you to change that argument to be the
8667: <tt class="filename">.la</tt> file. e.g.</p>
8668: <pre class="programlisting">
8669: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
8670: </pre>
8671:
8672: <p>should be changed to:</p>
8673: <pre class="programlisting">
8674: ${LIBTOOL} --mode=link ${CC} -o <i class=
8675: "replaceable"><tt>someprog</tt></i> <i class=
8676: "replaceable"><tt>../somelib/somelib.la</tt></i>
8677: </pre>
8678:
8679: <p>and it will do the right thing with the
8680: libraries.</p>
8681: </li>
8682:
8683: <li>
8684: <p>When installing libraries, preface the
8685: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
8686: <span class="citerefentry"><span class=
8687: "refentrytitle">install</span>(1)</span></a> or
8688: <a href=
8689: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
8690: <span class="citerefentry"><span class=
8691: "refentrytitle">cp</span>(1)</span></a> command
8692: with “<span class="quote">${LIBTOOL}
8693: --mode=install</span>”, and change the
8694: library name to <tt class="filename">.la</tt>.
8695: e.g.</p>
8696: <pre class="programlisting">
8697: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
8698: </pre>
8699:
8700: <p>This will install the static <tt class=
8701: "filename">.a</tt>, shared library, any needed
8702: symlinks, and run <a href=
8703: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
8704: <span class="citerefentry"><span class=
8705: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
8706: </li>
8707:
8708: <li>
8709: <p>In your <tt class="filename">PLIST</tt>,
8710: include all of the <tt class="filename">.a</tt>,
8711: <tt class="filename">.la</tt>, and <tt class=
8712: "filename">.so</tt>, <tt class=
8713: "filename">.so.CURRENT</tt> and <tt class=
8714: "filename">.so.CURRENT.REVISION</tt> files (this
8715: is a change from the previous behaviour).</p>
8716: </li>
8717: </ol>
8718: </div>
8719: </div>
8720:
8721: <div class="sect2" lang="en" xml:lang="en">
8722: <div class="titlepage">
8723: <div>
8724: <div>
1.3 hubertf 8725: <h3 class="title"><a name="id2572397" id=
8726: "id2572397"></a>12.3.2. Using libtool on GNU
1.1 grant 8727: packages that already support libtool</h3>
8728: </div>
8729: </div>
8730: </div>
8731:
8732: <p>Add <tt class="varname">USE_LIBTOOL=yes</tt> to the
8733: package Makefile. This will override the package's own
8734: libtool in most cases. For older libtool using
8735: packages, libtool is made by ltconfig script during the
8736: do-configure step; you can check the libtool script
8737: location by doing <span><b class="command">make
8738: configure; find work*/ -name libtool</b></span>.</p>
8739:
8740: <p><tt class="varname">LIBTOOL_OVERRIDE</tt> specifies
8741: which libtool scripts, relative to <tt class=
8742: "varname">WRKSRC</tt>, to override. By default, it is
8743: set to “<span class="quote">libtool */libtool
8744: */*/libtool</span>”. If this does not match the
8745: location of the package's libtool script(s), set it as
8746: appropriate.</p>
8747:
8748: <p>If you do not need <tt class="filename">*.a</tt>
8749: static libraries built and installed, then use
8750: <tt class="varname">SHLIBTOOL_OVERRIDE</tt>
8751: instead.</p>
8752:
8753: <p>If your package makes use of the platform
8754: independent library for loading dynamic shared objects,
8755: that comes with libtool (libltdl), you should include
8756: the libtool buildlink3.mk (and set <tt class=
8757: "varname">USE_BUILDLINK3=YES</tt>).</p>
8758:
8759: <p>Some packages use libtool incorrectly so that the
8760: package may not work or build in some circumstances.
8761: Some of the more common errors are:</p>
8762:
8763: <div class="itemizedlist">
8764: <ul type="disc">
8765: <li>
8766: <p>The inclusion of a shared object (-module) as
8767: a dependent library in an executable or library.
8768: This in itself isn't a problem if one of two
8769: things has been done:</p>
8770:
8771: <div class="orderedlist">
8772: <ol type="1">
8773: <li>
8774: <p>The shared object is named correctly,
8775: i.e. <tt class="filename">libfoo.la</tt>,
8776: not <tt class="filename">foo.la</tt></p>
8777: </li>
8778:
8779: <li>
8780: <p>The -dlopen option is used when linking
8781: an executable.</p>
8782: </li>
8783: </ol>
8784: </div>
8785: </li>
8786:
8787: <li>
8788: <p>The use of libltdl without the correct calls
8789: to initialisation routines. The function
8790: lt_dlinit() should be called and the macro
8791: <tt class=
8792: "varname">LTDL_SET_PRELOADED_SYMBOLS</tt>
8793: included in executables.</p>
8794: </li>
8795: </ul>
8796: </div>
8797: </div>
8798:
8799: <div class="sect2" lang="en" xml:lang="en">
8800: <div class="titlepage">
8801: <div>
8802: <div>
1.3 hubertf 8803: <h3 class="title"><a name="id2572482" id=
8804: "id2572482"></a>12.3.3. GNU
1.1 grant 8805: Autoconf/Automake</h3>
8806: </div>
8807: </div>
8808: </div>
8809:
8810: <p>If a package needs GNU autoconf or automake to be
8811: executed to regenerate the configure script and
8812: Makefile.in makefile templates, then they should be
8813: executed in a pre-configure target. Two Makefile
8814: fragments are provided in <tt class=
8815: "filename">pkgsrc/mk/autoconf.mk</tt> and <tt class=
8816: "filename">pkgsrc/mk/automake.mk</tt> to help dealing
8817: with these tools. See comments in these files for
8818: details.</p>
8819:
8820: <p>For packages that need only autoconf:</p>
8821: <pre class="programlisting">
8822: AUTOCONF_REQD= 2.50 # if default version is not good enough
8823: ...
8824:
8825: pre-configure:
8826: cd ${WRKSRC}; ${AUTOCONF}
8827:
8828: ...
8829: .include "../../mk/autoconf.mk"
8830: </pre>
8831:
8832: <p>and for packages that need automake and
8833: autoconf:</p>
8834: <pre class="programlisting">
8835: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
8836: ...
8837:
8838: pre-configure:
8839: cd ${WRKSRC}; \
8840: ${ACLOCAL}; \
8841: ${AUTOHEADER}; \
8842: ${AUTOMAKE} -a --foreign -i; \
8843: ${AUTOCONF}
8844:
8845: ...
8846: .include "../mk/automake.mk"
8847: </pre>
8848:
8849: <p>Packages which use GNU Automake will almost
8850: certainly require GNU Make, but that's automatically
8851: provided for you in <tt class=
8852: "filename">mk/automake.mk</tt>.</p>
8853:
8854: <p>There are times when the configure process makes
8855: additional changes to the generated files, which then
8856: causes the build process to try to re-execute the
8857: automake sequence. This is prevented by touching
8858: various files in the configure stage. If this causes
8859: problems with your package you can set <tt class=
8860: "varname">AUTOMAKE_OVERRIDE=NO</tt> in the package
8861: Makefile.</p>
8862: </div>
8863: </div>
8864:
8865: <div class="sect1" lang="en" xml:lang="en">
8866: <div class="titlepage">
8867: <div>
8868: <div>
8869: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 8870: "id2572526" id="id2572526"></a>12.4. Building
1.1 grant 8871: considerations</h2>
8872: </div>
8873: </div>
8874: </div>
8875:
8876: <div class="sect2" lang="en" xml:lang="en">
8877: <div class="titlepage">
8878: <div>
8879: <div>
1.3 hubertf 8880: <h3 class="title"><a name="id2572530" id=
8881: "id2572530"></a>12.4.1. CPP defines</h3>
1.1 grant 8882: </div>
8883: </div>
8884: </div>
8885:
8886: <p>To port an application to NetBSD, it's usually
8887: necessary for the compiler to be able to judge the
8888: system on which it's compiling, and we use definitions
8889: so that the C pre-processor can do this.</p>
8890:
8891: <p>To test whether you are working on a 4.4 BSD-derived
8892: system, you should use the BSD definition, which is
8893: defined in <tt class=
8894: "filename"><sys/param.h></tt> on said
8895: systems.</p>
8896: <pre class="programlisting">
8897: #include <sys/param.h>
8898: </pre>
8899:
8900: <p>and then you can surround the BSD-specific parts of
8901: your package's C/C++ code using this conditional:</p>
8902: <pre class="programlisting">
8903: #if (defined(BSD) && BSD >= 199306)
8904: ...
8905: #endif
8906: </pre>
8907:
8908: <p>Please use the “<span class=
8909: "quote">__NetBSD__</span>” definition sparingly -
8910: it should only apply to features of NetBSD that are not
8911: present in other 4.4-lite derived BSDs.</p>
8912: </div>
8913: </div>
8914:
8915: <div class="sect1" lang="en" xml:lang="en">
8916: <div class="titlepage">
8917: <div>
8918: <div>
8919: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 8920: "id2572560" id="id2572560"></a>12.5. Package
1.1 grant 8921: specific actions</h2>
8922: </div>
8923: </div>
8924: </div>
8925:
8926: <div class="sect2" lang="en" xml:lang="en">
8927: <div class="titlepage">
8928: <div>
8929: <div>
1.3 hubertf 8930: <h3 class="title"><a name="id2572563" id=
8931: "id2572563"></a>12.5.1. Package
1.1 grant 8932: configuration files</h3>
8933: </div>
8934: </div>
8935: </div>
8936:
8937: <p>Packages should be taught to look for their
8938: configuration files in <tt class=
8939: "varname">${PKG_SYSCONFDIR}</tt>, which is passed
8940: through to the configure and build processes.
8941: <tt class="varname">PKG_SYSCONFDIR</tt> may be
8942: customized in various ways by setting other make
8943: variables:</p>
8944:
8945: <div class="itemizedlist">
8946: <ul type="disc">
8947: <li>
8948: <p><tt class="varname">PKG_SYSCONFBASE</tt> is
8949: the main config directory under which all package
8950: configuration files are to be found. This
8951: defaults to <tt class=
8952: "filename">${PREFIX}/etc</tt>, but may be
8953: overridden in <tt class=
8954: "filename">/etc/mk.conf</tt>.</p>
8955: </li>
8956:
8957: <li>
8958: <p><tt class="varname">PKG_SYSCONFSUBDIR</tt> is
8959: the subdirectory of <tt class=
8960: "varname">PKG_SYSCONFBASE</tt> under which the
8961: configuration files for a particular package may
8962: be found, e.g. the Apache configuration files may
8963: all be found under the <tt class=
8964: "filename">httpd/</tt> subdirectory of <tt class=
8965: "varname">${PKG_SYSCONFBASE}</tt>. This should be
8966: set in the package Makefile.</p>
8967: </li>
8968:
8969: <li>
8970: <p>By default, <tt class=
8971: "varname">PKG_SYSCONFDIR</tt> is set to
8972: <tt class="varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</tt>,
8973: but this may be overridden by setting <tt class=
8974: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</tt>
8975: for a particular package, where <tt class=
8976: "varname">PKG_SYSCONFVAR</tt> defaults to
8977: <tt class="varname">${PKGBASE}</tt>. This is not
8978: meant to be set by a package Makefile, but is
8979: reserved for users who wish to override the
8980: <tt class="varname">PKG_SYSCONFDIR</tt> setting
8981: for a particular package with a special
8982: location.</p>
8983: </li>
8984: </ul>
8985: </div>
8986:
8987: <p>The only variables that users should customize are
8988: <tt class="varname">PKG_SYSCONFBASE</tt> and <tt class=
8989: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</tt>. Users
8990: will typically want to set <tt class=
8991: "varname">PKG_SYSCONFBASE</tt> to <tt class=
8992: "filename">/etc</tt>, or to accept the default location
8993: of <tt class="filename">${PREFIX}/etc</tt>.</p>
8994: </div>
8995:
8996: <div class="sect2" lang="en" xml:lang="en">
8997: <div class="titlepage">
8998: <div>
8999: <div>
1.3 hubertf 9000: <h3 class="title"><a name="id2572733" id=
9001: "id2572733"></a>12.5.2. User
1.2 hubertf 9002: interaction</h3>
1.1 grant 9003: </div>
9004: </div>
9005: </div>
9006:
9007: <p>Occasionally, packages require interaction from the
9008: user, and this can be in a number of ways:</p>
9009:
9010: <div class="itemizedlist">
9011: <ul type="disc">
9012: <li>
9013: <p>help in fetching the distfiles</p>
9014: </li>
9015:
9016: <li>
9017: <p>help to configure the package before it is
9018: built</p>
9019: </li>
9020:
9021: <li>
9022: <p>help during the build process</p>
9023: </li>
9024:
9025: <li>
9026: <p>help during the installation of a package</p>
9027: </li>
9028: </ul>
9029: </div>
9030:
9031: <p>The <tt class="varname">INTERACTIVE_STAGE</tt>
9032: definition is provided to notify the pkgsrc mechanism
9033: of an interactive stage which will be needed, and this
9034: should be set in the package's <tt class=
9035: "filename">Makefile</tt>. e.g.</p>
9036: <pre class="programlisting">
9037: INTERACTIVE_STAGE= build
9038: </pre>
9039:
9040: <p>Multiple interactive stages can be specified:</p>
9041: <pre class="programlisting">
9042: INTERACTIVE_STAGE= configure install
9043: </pre>
9044: </div>
9045:
9046: <div class="sect2" lang="en" xml:lang="en">
9047: <div class="titlepage">
9048: <div>
9049: <div>
1.3 hubertf 9050: <h3 class="title"><a name="id2572778" id=
9051: "id2572778"></a>12.5.3. Handling
1.1 grant 9052: licenses</h3>
9053: </div>
9054: </div>
9055: </div>
9056:
9057: <p>A package may underly a license which the user has
9058: or has not agreed to accept. Usually, packages that
9059: underly well-known Open Source licenses (e.g. the GNU
9060: Public License, GPL) won't have any special license
9061: tags added in pkgsrc which require special action by
9062: the user of such packages, but there are quite a number
9063: of other licenses out there that pkgsrc users may not
9064: be able to follow, for whatever reasons. For these
9065: cases, pkgsrc contains a mechanism to note that a
9066: package underlies a certain license, and the user has
9067: to accept the license before the package can be
9068: installed.</p>
9069:
9070: <p>Placing a certain package under a certain license
9071: works by setting the <tt class="varname">LICENSE</tt>
9072: variable to a string identifying the license, e.g. in
9073: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9074: href=
9075: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.2 hubertf 9076: class="pkgname">graphics/graphviz</a>:</p>
1.1 grant 9077: <pre class="programlisting">
9078: LICENSE= graphviz-license
9079: </pre>
9080:
9081: <p>When trying to build, the user will get a notice
9082: that the package underlies a license which he hasn't
9083: accepted (yet):</p>
9084: <pre class="programlisting">
9085: <tt class="prompt">%</tt> <b class="userinput"><tt>make</tt></b>
9086: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
9087: ===> To build this package, add this line to your /etc/mk.conf:
9088: ===> ACCEPTABLE_LICENSES+=graphviz-license
9089: ===> To view the license, enter "/usr/bin/make show-license".
9090: *** Error code 1
9091: </pre>
9092:
9093: <p>The license can be viewed with <span><b class=
9094: "command">make show-license</b></span>, and if it is
9095: considered appropriate, the line printed above can be
9096: added to <tt class="filename">/etc/mk.conf</tt> to
9097: indicate acceptance of the particular license:</p>
9098: <pre class="programlisting">
9099: ACCEPTABLE_LICENSES+=graphviz-license
9100: </pre>
9101:
9102: <p>When adding a package with a new license, the
9103: license text should be added to <tt class=
9104: "filename">pkgsrc/licenses</tt> for displaying. A list
9105: of known licenses can be seen in this directory as well
9106: as by looking at the list of (commented out) <tt class=
9107: "varname">ACCEPTABLE_LICENSES</tt> variable settings in
9108: <tt class=
9109: "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt>.</p>
9110:
9111: <p>Is there is a <span class=
9112: "emphasis"><em>really</em></span> pressing need to
9113: accept all licenses at once, like when trying to
9114: download or mirror all distfiles or doing a bulk build
9115: to test if all packages in pkgsrc build, this can be
9116: done by setting <tt class=
9117: "varname">_ACCEPTABLE=yes</tt>.</p>
9118: </div>
9119:
9120: <div class="sect2" lang="en" xml:lang="en">
9121: <div class="titlepage">
9122: <div>
9123: <div>
1.3 hubertf 9124: <h3 class="title"><a name="id2572861" id=
9125: "id2572861"></a>12.5.4. Creating an account
1.1 grant 9126: from a package</h3>
9127: </div>
9128: </div>
9129: </div>
9130:
9131: <p>There are two make variables used to control the
9132: creation of package-specific groups and users at
9133: pre-install time. The first is <tt class=
9134: "varname">PKG_GROUPS</tt>, which is a list of
9135: group[:groupid] elements, where the groupid is
9136: optional. The second is <tt class=
9137: "varname">PKG_USERS</tt>, which is a list of elements
9138: of the form:</p>
9139: <pre class="programlisting">
9140: user:group[:[userid][:[description][:[home][:shell]]]]
9141: </pre>
9142:
9143: <p>where only the user and group are required, the rest
9144: being optional. A simple example is:</p>
9145: <pre class="programlisting">
9146: PKG_GROUPS= foogroup
9147: PKG_USERS= foouser:foogroup
9148: </pre>
9149:
9150: <p>A more complex example is that creates two groups
9151: and two users is:</p>
9152: <pre class="programlisting">
9153: PKG_GROUPS= group1 group2:1005
9154: PKG_USERS= first:group1::First\\ User \
9155: second:group2::Second\\ User:/home/second:${SH}
9156: </pre>
9157:
9158: <p>By default, a new user will have home directory
9159: <tt class="filename">/nonexistent</tt>, and login shell
9160: <tt class="filename">/sbin/nologin</tt> unless they are
9161: specified as part of the user element.</p>
9162:
9163: <p>The package <tt class="filename">Makefile</tt> must
9164: also set <tt class="varname">USE_PKGINSTALL=YES</tt>.
9165: This will cause the users and groups to be created at
9166: pre-install time, and the admin will be prompted to
9167: remove them at post-deinstall time. Automatic creation
9168: of the users and groups can be toggled on and off by
9169: setting the <tt class=
9170: "varname">PKG_CREATE_USERGROUP</tt> variable prior to
9171: package installation.</p>
9172: </div>
9173:
9174: <div class="sect2" lang="en" xml:lang="en">
9175: <div class="titlepage">
9176: <div>
9177: <div>
1.3 hubertf 9178: <h3 class="title"><a name="id2572992" id=
9179: "id2572992"></a>12.5.5. Installing score
1.1 grant 9180: files</h3>
9181: </div>
9182: </div>
9183: </div>
9184:
9185: <p>Certain packages, most of them in the games
9186: category, install a score file that allows all users on
9187: the system to record their highscores. In order for
9188: this to work, the binaries need to be installed setgid
9189: and the score files owned by the appropriate group
9190: and/or owner (traditionally the "games" user/group).
9191: The following variables, documented in more detail in
9192: <tt class="filename">mk/bsd.pkg.defaults.mk</tt>,
9193: control this behaviour: <tt class=
9194: "varname">SETGIDGAME</tt>, <tt class=
9195: "varname">GAMEDATAMODE</tt>, <tt class=
9196: "varname">GAMEGRP</tt>, <tt class=
9197: "varname">GAMEMODE</tt>, <tt class=
9198: "varname">GAMEOWN</tt>.</p>
9199:
9200: <p>Note that per default, setgid installation of games
9201: is disabled; setting <tt class=
9202: "varname">SETGIDGAME=YES</tt> will set all the other
9203: variables accordingly.</p>
9204:
9205: <p>A package should therefor never hard code file
9206: ownership or access permissions but rely on <tt class=
9207: "varname">INSTALL_GAME</tt> and <tt class=
9208: "varname">INSTALL_GAME_DATA</tt> to set these
9209: correctly.</p>
9210: </div>
9211:
9212: <div class="sect2" lang="en" xml:lang="en">
9213: <div class="titlepage">
9214: <div>
9215: <div>
1.3 hubertf 9216: <h3 class="title"><a name="id2573035" id=
9217: "id2573035"></a>12.5.6. Packages providing
1.1 grant 9218: login shells</h3>
9219: </div>
9220: </div>
9221: </div>
9222:
9223: <p>If the purpose of the package is to provide a login
9224: shell, the variable <tt class="varname">PKG_SHELL</tt>
9225: should contain the full pathname of the shell
9226: executable installed by this package. The package
9227: <tt class="filename">Makefile</tt> must also set
9228: <tt class="varname">USE_PKGINSTALL=YES</tt> to use the
9229: automatically generated <tt class=
9230: "filename">INSTALL</tt>/<tt class=
9231: "filename">DEINSTALL</tt> scripts.</p>
9232:
9233: <p>An example taken from shells/zsh:</p>
9234: <pre class="programlisting">
9235: USE_PKGINSTALL= YES
9236: PKG_SHELL= ${PREFIX}/bin/zsh
9237: </pre>
9238:
9239: <p>The shell is registered into <tt class=
9240: "filename">/etc/shells</tt> file automatically in the
9241: post-install target by the generated <tt class=
9242: "filename">INSTALL</tt> script and removed in the
9243: deinstall target by the <tt class=
9244: "filename">DEINSTALL</tt> script.</p>
9245: </div>
9246:
9247: <div class="sect2" lang="en" xml:lang="en">
9248: <div class="titlepage">
9249: <div>
9250: <div>
1.3 hubertf 9251: <h3 class="title"><a name="id2573161" id=
9252: "id2573161"></a>12.5.7. Packages containing
1.1 grant 9253: perl scripts</h3>
9254: </div>
9255: </div>
9256: </div>
9257:
9258: <p>If your package contains interpreted perl scripts,
9259: set <tt class="varname">REPLACE_PERL</tt> to ensure
9260: that the proper interpreter path is set. <tt class=
9261: "varname">REPLACE_PERL</tt> should contain a list of
9262: scripts, relative to <tt class="varname">WRKSRC</tt>,
9263: that you want adjusted.</p>
9264: </div>
9265:
9266: <div class="sect2" lang="en" xml:lang="en">
9267: <div class="titlepage">
9268: <div>
9269: <div>
1.3 hubertf 9270: <h3 class="title"><a name="id2573248" id=
9271: "id2573248"></a>12.5.8. Packages with
1.1 grant 9272: hardcoded paths to other interpreters</h3>
9273: </div>
9274: </div>
9275: </div>
9276:
9277: <p>Your package may also contain scripts with hardcoded
9278: paths to other interpreters besides (or as well as)
9279: perl. To correct the full pathname to the script
9280: interpreter, you need to set the following definitions
9281: in your <tt class="filename">Makefile</tt> (we shall
9282: use <span><b class="command">tclsh</b></span> in this
9283: example):</p>
9284: <pre class="programlisting">
9285: REPLACE_INTERPRETER+= tcl
9286: _REPLACE.tcl.old= .*/bin/tclsh
9287: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
9288: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
9289: relative to ${WRKSRC}, just as in REPLACE_PERL
9290: </pre>
9291: </div>
9292:
9293: <div class="sect2" lang="en" xml:lang="en">
9294: <div class="titlepage">
9295: <div>
9296: <div>
1.3 hubertf 9297: <h3 class="title"><a name="id2573269" id=
9298: "id2573269"></a>12.5.9. Packages installing
1.1 grant 9299: perl modules</h3>
9300: </div>
9301: </div>
9302: </div>
9303:
9304: <p>Makefiles of packages providing perl5 modules should
9305: include the Makefile fragment <tt class=
9306: "filename">../../lang/perl5/module.mk</tt>. It provides
9307: a <span><b class="command">do-configure</b></span>
9308: target for the standard perl configuration for such
9309: modules as well as various hooks to tune this
9310: configuration. See comments in this file for
9311: details.</p>
9312:
9313: <p>Perl5 modules will install into different places
9314: depending on the version of perl used during the build
9315: process. To address this, pkgsrc will append lines to
9316: the <tt class="filename">PLIST</tt> corresponding to
9317: the files listed in the installed <tt class=
9318: "filename">.packlist</tt> file generated by most perl5
9319: modules. This is invoked by defining <tt class=
9320: "varname">PERL5_PACKLIST</tt> to a space-separated list
9321: of paths to packlist files, e.g.:</p>
9322: <pre class="programlisting">
9323: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
9324: </pre>
9325:
9326: <p>The variables <tt class=
9327: "varname">PERL5_SITELIB</tt>, <tt class=
9328: "varname">PERL5_SITEARCH</tt>, and <tt class=
9329: "varname">PERL5_ARCHLIB</tt> represent the three
9330: locations in which perl5 modules may be installed, and
9331: may be used by perl5 packages that don't have a
9332: packlist. These three variables are also substituted
9333: for in the <tt class="filename">PLIST</tt>.</p>
9334: </div>
9335:
9336: <div class="sect2" lang="en" xml:lang="en">
9337: <div class="titlepage">
9338: <div>
9339: <div>
9340: <h3 class="title"><a name="faq.info-files" id=
9341: "faq.info-files"></a>12.5.10. Packages
9342: installing info files</h3>
9343: </div>
9344: </div>
9345: </div>
9346:
9347: <p>Some packages install info files or use the
9348: “<span class="quote">makeinfo</span>” or
9349: “<span class="quote">install-info</span>”
9350: commands. Each of the info files:</p>
9351:
9352: <div class="itemizedlist">
9353: <ul type="disc">
9354: <li>
9355: <p>is considered to be installed in the directory
9356: <tt class=
9357: "filename">${PREFIX}/${INFO_DIR}</tt>,</p>
9358: </li>
9359:
9360: <li>
9361: <p>is registered in the Info directory file
9362: <tt class=
9363: "filename">${PREFIX}/${INFO_DIR}/dir</tt>,</p>
9364: </li>
9365:
9366: <li>
9367: <p>and must be listed as a filename in the
9368: <tt class="varname">INFO_FILES</tt> variable in
9369: the package Makefile.</p>
9370: </li>
9371: </ul>
9372: </div>
9373:
9374: <p><tt class="varname">INFO_DIR</tt> defaults to
9375: “<span class="quote">info</span>” and can
9376: be overridden in the package Makefile. <tt class=
9377: "filename">INSTALL</tt> and <tt class=
9378: "filename">DEINSTALL</tt> scripts will be generated to
9379: handle registration of the info files in the Info
9380: directory file. The “<span class=
9381: "quote">install-info</span>” command used for the
9382: info files registration is either provided by the
9383: system, or by a special purpose package automatically
9384: added as dependency if needed.</p>
9385:
9386: <p>A package which needs the “<span class=
9387: "quote">makeinfo</span>” command at build time
9388: must define the variable <tt class=
9389: "varname">USE_MAKEINFO</tt> in its Makefile. If a
9390: minimum version of the “<span class=
9391: "quote">makeinfo</span>” command is needed it
9392: should be noted with the <tt class=
9393: "varname">TEXINFO_REQD</tt> variable in the package
9394: <tt class="filename">Makefile</tt>. By default, a
9395: minimum version of 3.12 is required. If the system does
9396: not provide a <span><b class=
9397: "command">makeinfo</b></span> command or if it does not
9398: match the required minimum, a build dependency on the
9399: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9400: href=
9401: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.2 hubertf 9402: class="pkgname">devel/gtexinfo</a> package will be
9403: added automatically.</p>
1.1 grant 9404:
9405: <p>The build and installation process of the software
9406: provided by the package should not use the
9407: <span><b class="command">install-info</b></span>
9408: command as the registration of info files is the task
9409: of the package <tt class="filename">INSTALL</tt>
9410: script, and it must use the appropriate <span><b class=
9411: "command">makeinfo</b></span> command.</p>
9412:
9413: <p>To achieve this goal the pkgsrc infrastructure
9414: creates overriding scripts for the <span><b class=
9415: "command">install-info</b></span> and <span><b class=
9416: "command">makeinfo</b></span> commands in a directory
9417: listed early in <tt class="varname">PATH</tt>.</p>
9418:
9419: <p>The script overriding <span><b class=
9420: "command">install-info</b></span> has no effect except
9421: the logging of a message. The script overriding
9422: <span><b class="command">makeinfo</b></span> logs a
9423: message and according to the value of <tt class=
9424: "varname">USE_MAKEINFO</tt> and <tt class=
9425: "varname">TEXINFO_REQD</tt> either run the appropriate
9426: <span><b class="command">makeinfo</b></span> command or
9427: exit on error.</p>
9428: </div>
9429:
9430: <div class="sect2" lang="en" xml:lang="en">
9431: <div class="titlepage">
9432: <div>
9433: <div>
1.3 hubertf 9434: <h3 class="title"><a name="id2573557" id=
9435: "id2573557"></a>12.5.11. Packages installing
1.1 grant 9436: GConf2 data files</h3>
9437: </div>
9438: </div>
9439: </div>
9440:
9441: <p>If a package installs <tt class=
9442: "filename">.schemas</tt> or <tt class=
9443: "filename">.entries</tt> files, used by GConf2, you
9444: need to take some extra steps to make sure they get
9445: registered in the database:</p>
9446:
9447: <div class="orderedlist">
9448: <ol type="1">
9449: <li>
9450: <p>Include <tt class=
9451: "filename">../../devel/GConf2/schemas.mk</tt>
9452: instead of its <tt class=
9453: "filename">buildlink3.mk</tt> file. This takes
9454: care of rebuilding the GConf2 database at
9455: installation and deinstallation time, and tells
9456: the package where to install GConf2 data files
9457: using some standard configure arguments. It also
9458: disallows any access to the database directly
9459: from the package.</p>
9460: </li>
9461:
9462: <li>
9463: <p>Ensure that the package installs its
9464: <tt class="filename">.schemas</tt> files under
9465: <tt class=
9466: "filename">${PREFIX}/share/gconf/schemas</tt>. If
9467: they get installed under <tt class=
9468: "filename">${PREFIX}/etc</tt>, you will need to
9469: manually patch the package.</p>
9470: </li>
9471:
9472: <li>
9473: <p>Check the PLIST and remove any entries under
9474: the etc/gconf directory, as they will be handled
9475: automatically. See <a href="#faq.conf" title=
9476: "6.13. Configuration files handling and placement">
9477: Section 6.13, “Configuration files
9478: handling and placement”</a> for more
9479: information.</p>
9480: </li>
9481:
9482: <li>
9483: <p>Define the <tt class=
9484: "varname">GCONF2_SCHEMAS</tt> variable in your
9485: <tt class="filename">Makefile</tt> with a list of
9486: all <tt class="filename">.schemas</tt> files
9487: installed by the package, if any. Names must not
9488: contain any directories in them.</p>
9489: </li>
9490:
9491: <li>
9492: <p>Define the <tt class=
9493: "varname">GCONF2_ENTRIES</tt> variable in your
9494: <tt class="filename">Makefile</tt> with a list of
9495: all <tt class="filename">.entries</tt> files
9496: installed by the package, if any. Names must not
9497: contain any directories in them.</p>
9498: </li>
9499: </ol>
9500: </div>
9501: </div>
9502:
9503: <div class="sect2" lang="en" xml:lang="en">
9504: <div class="titlepage">
9505: <div>
9506: <div>
1.3 hubertf 9507: <h3 class="title"><a name="id2573657" id=
9508: "id2573657"></a>12.5.12. Packages installing
1.1 grant 9509: scrollkeeper data files</h3>
9510: </div>
9511: </div>
9512: </div>
9513:
9514: <p>If a package installs <tt class="filename">.omf</tt>
9515: files, used by scrollkeeper, you need to take some
9516: extra steps to make sure they get registered in the
9517: database:</p>
9518:
9519: <div class="orderedlist">
9520: <ol type="1">
9521: <li>
9522: <p>Include <tt class=
9523: "filename">../../textproc/scrollkeeper/omf.mk</tt>
9524: instead of its <tt class=
9525: "filename">buildlink3.mk</tt> file. This takes
9526: care of rebuilding the scrollkeeper database at
9527: installation and deinstallation time, and
9528: disallows any access to it directly from the
9529: package.</p>
9530: </li>
9531:
9532: <li>
9533: <p>Check the PLIST and remove any entries under
9534: the <tt class=
9535: "filename">libdata/scrollkeeper</tt> directory,
9536: as they will be handled automatically.</p>
9537: </li>
9538:
9539: <li>
9540: <p>Remove the <tt class="filename">share/omf</tt>
9541: directory from the PLIST. It will be handled by
9542: scrollkeeper.</p>
9543: </li>
9544: </ol>
9545: </div>
9546: </div>
9547:
9548: <div class="sect2" lang="en" xml:lang="en">
9549: <div class="titlepage">
9550: <div>
9551: <div>
1.3 hubertf 9552: <h3 class="title"><a name="id2573708" id=
9553: "id2573708"></a>12.5.13. Packages installing
1.1 grant 9554: X11 fonts</h3>
9555: </div>
9556: </div>
9557: </div>
9558:
9559: <p>If a package installs font files, you will need to
9560: rebuild the fonts database in the directory where they
9561: get installed at installation and deinstallation time.
9562: This can be automatically done by using <tt class=
9563: "filename">mk/fonts.mk</tt>, which you need to include
9564: in your <tt class="filename">Makefile</tt>.</p>
9565:
9566: <p>When the file is included, you can list the
9567: directories where fonts are installed in the <tt class=
9568: "varname">FONTS_<i class=
9569: "replaceable"><tt>type</tt></i>_DIRS</tt> variables,
9570: where <i class="replaceable"><tt>type</tt></i> can be
9571: one of “<span class="quote">TTF</span>”,
9572: “<span class="quote">TYPE1</span>” or
9573: “<span class="quote">X11</span>”. Also make
9574: sure that the database file <tt class=
9575: "filename">fonts.dir</tt> is not listed in the
9576: PLIST.</p>
9577:
9578: <p>Note that you should not create new directories for
9579: fonts; instead use the standard ones to avoid that the
9580: user needs to manually configure his X server to find
9581: them.</p>
9582: </div>
9583:
9584: <div class="sect2" lang="en" xml:lang="en">
9585: <div class="titlepage">
9586: <div>
9587: <div>
1.3 hubertf 9588: <h3 class="title"><a name="id2573824" id=
9589: "id2573824"></a>12.5.14. Packages installing
1.1 grant 9590: GTK2 modules</h3>
9591: </div>
9592: </div>
9593: </div>
9594:
9595: <p>If a package installs gtk2 immodules or loaders, you
9596: need to take some extra steps to get them registered in
9597: the GTK2 database properly:</p>
9598:
9599: <div class="orderedlist">
9600: <ol type="1">
9601: <li>
9602: <p>Include <tt class=
9603: "filename">../../x11/gtk2/modules.mk</tt> instead
9604: of its <tt class="filename">buildlink3.mk</tt>
9605: file. This takes care of rebuilding the database
9606: at installation and deinstallation time.</p>
9607: </li>
9608:
9609: <li>
9610: <p>Set <tt class=
9611: "varname">GTK2_IMMODULES=YES</tt> if your package
9612: installs GTK2 immodules.</p>
9613: </li>
9614:
9615: <li>
9616: <p>Set <tt class="varname">GTK2_LOADERS=YES</tt>
9617: if your package installs GTK2 loaders.</p>
9618: </li>
9619:
9620: <li>
9621: <p>Patch the package to not touch any of the gtk2
9622: databases directly. These are:</p>
9623:
9624: <div class="itemizedlist">
9625: <ul type="disc">
9626: <li>
9627: <p><tt class=
9628: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</tt></p>
9629: </li>
9630:
9631: <li>
9632: <p><tt class=
9633: "filename">libdata/gtk-2.0/gtk.immodules</tt></p>
9634: </li>
9635: </ul>
9636: </div>
9637: </li>
9638:
9639: <li>
9640: <p>Check the PLIST and remove any entries under
9641: the <tt class="filename">libdata/gtk-2.0</tt>
9642: directory, as they will be handled
9643: automatically.</p>
9644: </li>
9645: </ol>
9646: </div>
9647: </div>
9648:
9649: <div class="sect2" lang="en" xml:lang="en">
9650: <div class="titlepage">
9651: <div>
9652: <div>
1.3 hubertf 9653: <h3 class="title"><a name="id2573893" id=
9654: "id2573893"></a>12.5.15. Packages installing
1.1 grant 9655: SGML or XML data</h3>
9656: </div>
9657: </div>
9658: </div>
9659:
9660: <p>If a package installs SGML or XML data files that
9661: need to be registered in system-wide catalogs (like
9662: DTDs, sub-catalogs, etc.), you need to take some extra
9663: steps:</p>
9664:
9665: <div class="orderedlist">
9666: <ol type="1">
9667: <li>
9668: <p>Include <tt class=
9669: "filename">../../textproc/xmlcatmgr/catalogs.mk</tt>
9670: in your <tt class="filename">Makefile</tt>, which
9671: takes care of registering those files in
9672: system-wide catalogs at installation and
9673: deinstallation time.</p>
9674: </li>
9675:
9676: <li>
9677: <p>Set <tt class="varname">SGML_CATALOGS</tt> to
9678: the full path of any SGML catalogs installed by
9679: the package.</p>
9680: </li>
9681:
9682: <li>
9683: <p>Set <tt class="varname">XML_CATALOGS</tt> to
9684: the full path of any XML catalogs installed by
9685: the package.</p>
9686: </li>
9687:
9688: <li>
9689: <p>Set <tt class="varname">SGML_ENTRIES</tt> to
9690: individual entries to be added to the SGML
9691: catalog. These come in groups of three strings;
9692: see xmlcatmgr(1) for more information
9693: (specifically, arguments recognized by the 'add'
9694: action). Note that you will normally not use this
9695: variable.</p>
9696: </li>
9697:
9698: <li>
9699: <p>Set <tt class="varname">XML_ENTRIES</tt> to
9700: individual entries to be added to the XML
9701: catalog. These come in groups of three strings;
9702: see xmlcatmgr(1) for more information
9703: (specifically, arguments recognized by the 'add'
9704: action). Note that you will normally not use this
9705: variable.</p>
9706: </li>
9707: </ol>
9708: </div>
9709: </div>
9710:
9711: <div class="sect2" lang="en" xml:lang="en">
9712: <div class="titlepage">
9713: <div>
9714: <div>
1.3 hubertf 9715: <h3 class="title"><a name="id2573945" id=
9716: "id2573945"></a>12.5.16. Packages installing
1.1 grant 9717: extensions to the MIME database</h3>
9718: </div>
9719: </div>
9720: </div>
9721:
9722: <p>If a package provides extensions to the MIME
9723: database by installing <tt class="filename">.xml</tt>
9724: files inside <tt class=
9725: "filename">${PREFIX}/share/mime/packages</tt>, you need
9726: to take some extra steps to ensure that the database is
9727: kept consistent with respect to these new files:</p>
9728:
9729: <div class="orderedlist">
9730: <ol type="1">
9731: <li>
9732: <p>Include <tt class=
9733: "filename">../../databases/shared-mime-info/mimedb.mk</tt>
9734: (avoid using the <tt class=
9735: "filename">buildlink3.mk</tt> file from this same
9736: directory, which is reserved for inclusion from
9737: other <tt class="filename">buildlink3.mk</tt>
9738: files). It takes care of rebuilding the MIME
9739: database at installation and deinstallation time,
9740: and disallows any access to it directly from the
9741: package.</p>
9742: </li>
9743:
9744: <li>
9745: <p>Check the PLIST and remove any entries under
9746: the <tt class="filename">share/mime</tt>
9747: directory, <span class=
9748: "emphasis"><em>except</em></span> for files saved
9749: under <tt class=
9750: "filename">share/mime/packages</tt>. The former
9751: are handled automatically by the
9752: update-mime-database program, but the later are
9753: package-dependent and must be removed by the
9754: package that installed them in the first
9755: place.</p>
9756: </li>
9757:
9758: <li>
9759: <p>Remove any <tt class=
9760: "filename">share/mime/*</tt> directories from the
9761: PLIST. They will be handled by the
9762: shared-mime-info package.</p>
9763: </li>
9764: </ol>
9765: </div>
9766: </div>
9767:
9768: <div class="sect2" lang="en" xml:lang="en">
9769: <div class="titlepage">
9770: <div>
9771: <div>
1.3 hubertf 9772: <h3 class="title"><a name="id2574016" id=
9773: "id2574016"></a>12.5.17. Packages using
1.1 grant 9774: intltool</h3>
9775: </div>
9776: </div>
9777: </div>
9778:
9779: <p>If a package uses intltool during its build, include
9780: the <tt class=
9781: "filename">../../textproc/intltool/buildlink3.mk</tt>
9782: file, which forces it to use the intltool package
9783: provided by pkgsrc, instead of the one bundled with the
9784: distribution file.</p>
9785:
9786: <p>This tracks intltool's build-time dependencies and
9787: uses the latest available version; this way, the
9788: package benefits of any bug fixes that may have
9789: appeared since it was released.</p>
9790: </div>
9791: </div>
9792:
9793: <div class="sect1" lang="en" xml:lang="en">
9794: <div class="titlepage">
9795: <div>
9796: <div>
9797: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 9798: "id2574029" id="id2574029"></a>12.6. Feedback
1.1 grant 9799: to the author</h2>
9800: </div>
9801: </div>
9802: </div>
9803:
9804: <p>If you have found any bugs in the package you make
9805: available, if you had to do special steps to make it run
9806: under NetBSD or if you enhanced the software in various
9807: other ways, be sure to report these changes back to the
9808: original author of the program! With that kind of
9809: support, the next release of the program can incorporate
9810: these fixes, and people not using the NetBSD packages
9811: system can win from your efforts.</p>
9812:
9813: <p>Support the idea of free software!</p>
9814: </div>
9815: </div>
9816:
9817: <div class="chapter" lang="en" xml:lang="en">
9818: <div class="titlepage">
9819: <div>
9820: <div>
9821: <h2 class="title"><a name="debug" id=
9822: "debug"></a>Chapter 13. Debugging</h2>
9823: </div>
9824: </div>
9825: </div>
9826:
9827: <p>To check out all the gotchas when building a package,
9828: here are the steps that I do in order to get a package
9829: working. Please note this is basically the same as what was
9830: explained in the previous sections, only with some
9831: debugging aids.</p>
9832:
9833: <div class="itemizedlist">
9834: <ul type="disc">
9835: <li>
9836: <p>Be sure to set <tt class=
9837: "varname">PKG_DEVELOPER=1</tt> in <tt class=
9838: "filename">/etc/mk.conf</tt></p>
9839: </li>
9840:
9841: <li>
9842: <p>Install <a xmlns=
9843: "http://www.w3.org/TR/xhtml1/transitional" href=
9844: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.2 hubertf 9845: class="pkgname">pkgtools/url2pkg</a>, create a
9846: directory for a new package, change into it, then
9847: run <span><b class=
9848: "command">url2pkg</b></span>:</p>
1.1 grant 9849: <pre class="screen">
9850: <tt class="prompt">%</tt> <b class=
9851: "userinput"><tt>mkdir /usr/pkgsrc/<i class=
9852: "replaceable"><tt>category</tt></i>/<i class=
9853: "replaceable"><tt>examplepkg</tt></i></tt></b>
9854: <tt class="prompt">%</tt> <b class=
9855: "userinput"><tt>cd /usr/pkgsrc/<i class=
9856: "replaceable"><tt>category</tt></i>/<i class=
9857: "replaceable"><tt>examplepkg</tt></i></tt></b>
9858: <tt class="prompt">%</tt> <b class=
9859: "userinput"><tt>url2pkg http://www.example.com/path/to/distfile.tar.gz</tt></b>
9860: </pre>
9861: </li>
9862:
9863: <li>
9864: <p>Edit the <tt class="filename">Makefile</tt> as
9865: requested.</p>
9866: </li>
9867:
9868: <li>
9869: <p>Fill in the <tt class="filename">DESCR</tt>
9870: file</p>
9871: </li>
9872:
9873: <li>
9874: <p>Run <span><b class="command">make
9875: configure</b></span></p>
9876: </li>
9877:
9878: <li>
9879: <p>Add any dependencies glimpsed from documentation
9880: and the configure step to the package's <tt class=
9881: "filename">Makefile</tt>.</p>
9882: </li>
9883:
9884: <li>
9885: <p>Make the package compile, doing multiple rounds
9886: of</p>
9887: <pre class="screen">
9888: <tt class="prompt">%</tt> <b class="userinput"><tt>make</tt></b>
9889: <tt class="prompt">%</tt> <b class=
9890: "userinput"><tt>pkgvi ${WRKSRC}/some/file/that/does/not/compile</tt></b>
9891: <tt class="prompt">%</tt> <b class=
9892: "userinput"><tt>mkpatches</tt></b>
9893: <tt class="prompt">%</tt> <b class=
9894: "userinput"><tt>patchdiff</tt></b>
9895: <tt class="prompt">%</tt> <b class=
9896: "userinput"><tt>mv ${WRKDIR}/.newpatches/* patches</tt></b>
9897: <tt class="prompt">%</tt> <b class=
9898: "userinput"><tt>make mps</tt></b>
9899: <tt class="prompt">%</tt> <b class=
9900: "userinput"><tt>make clean</tt></b>
9901: </pre>
9902:
9903: <p>Doing as non-root user will ensure that no files
9904: are modified that shouldn't be, especially during the
9905: build phase. <span><b class=
9906: "command">mkpatches</b></span>, <span><b class=
9907: "command">patchdiff</b></span> and <span><b class=
9908: "command">pkgvi</b></span> are from the <a xmlns=
9909: "http://www.w3.org/TR/xhtml1/transitional" href=
9910: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.2 hubertf 9911: class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1 grant 9912: </li>
9913:
9914: <li>
9915: <p>Look at the <tt class="filename">Makefile</tt>,
9916: fix if necessary; see <a href="#components.Makefile"
9917: title="7.1. Makefile">Section 7.1,
9918: “Makefile”</a>.</p>
9919: </li>
9920:
9921: <li>
9922: <p>Generate a <tt class="filename">PLIST</tt>:</p>
9923: <pre class="screen">
9924: <tt class="prompt">#</tt> <b class=
9925: "userinput"><tt>make install</tt></b>
9926: <tt class="prompt">#</tt> <b class=
9927: "userinput"><tt>make print-PLIST >PLIST</tt></b>
9928: <tt class="prompt">#</tt> <b class=
9929: "userinput"><tt>make deinstall</tt></b>
9930: <tt class="prompt">#</tt> <b class=
9931: "userinput"><tt>make install</tt></b>
9932: <tt class="prompt">#</tt> <b class=
9933: "userinput"><tt>make deinstall</tt></b>
9934: </pre>
9935:
9936: <p>You usually need to be <tt class=
9937: "username">root</tt> to do this. Look if there are
9938: any files left:</p>
9939: <pre class="screen">
9940: <tt class="prompt">#</tt> <b class=
9941: "userinput"><tt>make print-PLIST</tt></b>
9942: </pre>
9943:
9944: <p>If this reveals any files that are missing in
9945: <tt class="filename">PLIST</tt>, add them.</p>
9946: </li>
9947:
9948: <li>
9949: <p>Now that the <tt class="filename">PLIST</tt> is
9950: OK, install the package again and make a binary
9951: package:</p>
9952: <pre class="screen">
9953: <tt class="prompt">#</tt> <b class=
9954: "userinput"><tt>make reinstall</tt></b>
9955: <tt class="prompt">#</tt> <b class=
9956: "userinput"><tt>make package</tt></b>
9957: </pre>
9958: </li>
9959:
9960: <li>
9961: <p>Delete the installed package:</p>
9962: <pre class="screen">
9963: <tt class="prompt">#</tt> <b class=
9964: "userinput"><tt>pkg_delete blub</tt></b>
9965: </pre>
9966: </li>
9967:
9968: <li>
9969: <p>Repeat the above <span><b class="command">make
9970: print-PLIST</b></span> command, which shouldn't find
9971: anything now:</p>
9972: <pre class="screen">
9973: <tt class="prompt">#</tt> <b class=
9974: "userinput"><tt>make print-PLIST</tt></b>
9975: </pre>
9976: </li>
9977:
9978: <li>
9979: <p>Reinstall the binary package:</p>
9980: <pre class="screen">
9981: <tt class="prompt">#</tt> <b class=
9982: "userinput"><tt>pkgadd .../blub.tgz</tt></b>
9983: </pre>
9984: </li>
9985:
9986: <li>
9987: <p>Play with it. Make sure everything works.</p>
9988: </li>
9989:
9990: <li>
9991: <p>Run <span><b class="command">pkglint</b></span>
9992: from <a xmlns=
9993: "http://www.w3.org/TR/xhtml1/transitional" href=
9994: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.2 hubertf 9995: class="pkgname">pkgtools/pkglint</a>, and fix the
9996: problems it reports:</p>
1.1 grant 9997: <pre class="screen">
9998: <tt class="prompt">#</tt> <b class="userinput"><tt>pkglint</tt></b>
9999: </pre>
10000: </li>
10001:
10002: <li>
10003: <p>Submit (or commit, if you have cvs access); see
10004: <a href="#submit" title=
10005: "Chapter 14. Submitting and Committing">Chapter 14,
10006: <i>Submitting and Committing</i></a>.</p>
10007: </li>
10008: </ul>
10009: </div>
10010: </div>
10011:
10012: <div class="chapter" lang="en" xml:lang="en">
10013: <div class="titlepage">
10014: <div>
10015: <div>
10016: <h2 class="title"><a name="submit" id=
10017: "submit"></a>Chapter 14. Submitting and
10018: Committing</h2>
10019: </div>
10020: </div>
10021: </div>
10022:
10023: <div class="toc">
10024: <p><b>Table of Contents</b></p>
10025:
10026: <dl>
1.3 hubertf 10027: <dt><span class="sect1"><a href="#id2574491">14.1.
1.1 grant 10028: Submitting your packages</a></span></dt>
10029:
1.3 hubertf 10030: <dt><span class="sect1"><a href="#id2574538">14.2.
1.1 grant 10031: Committing: Importing a package into
10032: CVS</a></span></dt>
10033:
1.3 hubertf 10034: <dt><span class="sect1"><a href="#id2574738">14.3.
1.2 hubertf 10035: Updating a package to a newer version</a></span></dt>
1.1 grant 10036:
1.3 hubertf 10037: <dt><span class="sect1"><a href="#id2574825">14.4.
1.2 hubertf 10038: Moving a package in pkgsrc</a></span></dt>
1.1 grant 10039: </dl>
10040: </div>
10041:
10042: <div class="sect1" lang="en" xml:lang="en">
10043: <div class="titlepage">
10044: <div>
10045: <div>
10046: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 10047: "id2574491" id=
10048: "id2574491"></a>14.1. Submitting your
1.1 grant 10049: packages</h2>
10050: </div>
10051: </div>
10052: </div>
10053:
10054: <p>You have to separate between binary and
10055: “<span class="quote">normal</span>” (source)
10056: packages here:</p>
10057:
10058: <div class="itemizedlist">
10059: <ul type="disc">
10060: <li>
10061: <p>precompiled binary packages</p>
10062:
10063: <p>Our policy is that we accept binaries only from
10064: pkgsrc developers to guarantee that the packages
10065: don't contain any trojan horses etc. This is not to
10066: piss anyone off but rather to protect our users!
10067: You're still free to put up your home-made binary
10068: packages and tell the world where to get them.</p>
10069: </li>
10070:
10071: <li>
10072: <p>packages</p>
10073:
10074: <p>First, check that your package is complete,
10075: compiles and runs well; see <a href="#debug" title=
10076: "Chapter 13. Debugging">Chapter 13,
10077: <i>Debugging</i></a> and the rest of this document.
10078: Next, generate an uuencoded gzipped tar(1) archive,
10079: preferably with all files in a single directory.
10080: Finally, <span><b class=
10081: "command">send-pr</b></span> with category
10082: “<span class="quote">pkg</span>”, a
10083: synopsis which includes the package name and
10084: version number, a short description of your package
10085: (contents of the COMMENT variable or DESCR file are
10086: OK) and attach the archive to your PR.</p>
10087:
10088: <p>If you want to submit several packages, please
10089: send a separate PR for each one, it's easier for us
10090: to track things that way.</p>
10091:
10092: <p>Alternatively, you can also import new packages
10093: into pkgsrc-wip (“<span class="quote">pkgsrc
10094: work-in-progress</span>”); see the homepage
10095: at <a href="http://pkgsrc-wip.sourceforge.net/"
10096: target=
10097: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
10098: details.</p>
10099: </li>
10100: </ul>
10101: </div>
10102: </div>
10103:
10104: <div class="sect1" lang="en" xml:lang="en">
10105: <div class="titlepage">
10106: <div>
10107: <div>
10108: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 10109: "id2574538" id=
10110: "id2574538"></a>14.2. Committing: Importing a
1.1 grant 10111: package into CVS</h2>
10112: </div>
10113: </div>
10114: </div>
10115:
10116: <p>This section is only of interest for pkgsrc developers
10117: with write access to the pkgsrc repository. Please
10118: remember that cvs imports files relative to the current
10119: working directory, and that the pathname that you give
10120: the <span><b class="command">cvs import</b></span>
10121: command is so that it knows where to place the files in
10122: the repository. Newly created packages should be imported
10123: with a vendor tag of “<span class=
10124: "quote">TNF</span>” and a release tag of
10125: “<span class="quote">pkgsrc-base</span>”,
10126: e.g:</p>
10127: <pre class="programlisting">
10128: % cd .../pkgsrc/category/pkgname
10129: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
10130: </pre>
10131:
10132: <p>Remember to move the directory from which you imported
10133: out of the way, or cvs will complain the next time you
10134: “<span class="quote">cvs update</span>” your
10135: source tree. Also don't forget to add the new package to
10136: the category's <tt class="filename">Makefile</tt>.</p>
10137:
10138: <p>The commit message of the initial import should
10139: include part of the <tt class="filename">DESCR</tt> file,
10140: so people reading the mailing lists know what the package
10141: is/does.</p>
10142:
10143: <p>Please note all package updates/additions in
10144: <tt class="filename">pkgsrc/doc/CHANGES</tt>. It's very
10145: important to keep this file up to date and conforming to
10146: the existing format, because it will be used by scripts
10147: to automatically update pages on <a href=
10148: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
10149: and other sites. Additionally, check the pkgsrc/doc/TODO
10150: file and remove the entry for the package you updated, in
10151: case it was mentioned there.</p>
10152:
10153: <p>For new packages, “<span class="quote">cvs
10154: import</span>” is preferred to “<span class=
10155: "quote">cvs add</span>” because the former gets
10156: everything with a single command, and provides a
10157: consistent tag.</p>
10158: </div>
10159:
10160: <div class="sect1" lang="en" xml:lang="en">
10161: <div class="titlepage">
10162: <div>
10163: <div>
10164: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 10165: "id2574738" id="id2574738"></a>14.3. Updating
1.2 hubertf 10166: a package to a newer version</h2>
1.1 grant 10167: </div>
10168: </div>
10169: </div>
10170:
10171: <p>Please always put a concise, appropriate and relevant
10172: summary of the changes between old and new versions into
10173: the commit log when updating a package. There are various
10174: reasons for this:</p>
10175:
10176: <div class="itemizedlist">
10177: <ul type="disc">
10178: <li>
10179: <p>A URL is volatile, and can change over time. It
10180: may go away completely or its information may be
10181: overwritten by newer information.</p>
10182: </li>
10183:
10184: <li>
10185: <p>Having the change information between old and
10186: new versions in our CVS repository is very useful
10187: for people who use either cvs or anoncvs.</p>
10188: </li>
10189:
10190: <li>
10191: <p>Having the change information between old and
10192: new versions in our CVS repository is very useful
10193: for people who read the pkgsrc-changes mailing
10194: list, so that they can make tactical decisions
10195: about when to upgrade the package.</p>
10196: </li>
10197: </ul>
10198: </div>
10199:
10200: <p>Please also recognise that, just because a new version
10201: of a package has been released, it should not
10202: automatically be upgraded in the CVS repository. We
10203: prefer to be conservative in the packages that are
10204: included in pkgsrc - development or beta packages are not
10205: really the best thing for most places in which pkgsrc is
10206: used. Please use your judgement about what should go into
10207: pkgsrc, and bear in mind that stability is to be
10208: preferred above new and possibly untested features.</p>
10209: </div>
10210:
10211: <div class="sect1" lang="en" xml:lang="en">
10212: <div class="titlepage">
10213: <div>
10214: <div>
10215: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 10216: "id2574825" id="id2574825"></a>14.4. Moving a
1.2 hubertf 10217: package in pkgsrc</h2>
1.1 grant 10218: </div>
10219: </div>
10220: </div>
10221:
10222: <div class="orderedlist">
10223: <ol type="1">
10224: <li>
10225: <p>Make a copy of the directory somewhere else.</p>
10226: </li>
10227:
10228: <li>
10229: <p>Remove all CVS dirs.</p>
10230:
10231: <p>Alternatively to the first two steps you can
10232: also do:</p>
10233: <pre class="screen">
10234: <tt class="prompt">%</tt> <b class=
10235: "userinput"><tt>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</tt></b>
10236: </pre>
10237:
10238: <p>and use that for further work.</p>
10239: </li>
10240:
10241: <li>
10242: <p>Fix <tt class="varname">CATEGORIES</tt> and any
10243: <tt class="varname">DEPENDS</tt> paths that just
10244: did “<span class=
10245: "quote">../package</span>” instead of
10246: “<span class=
10247: "quote">../../category/package</span>”.</p>
10248: </li>
10249:
10250: <li>
10251: <p><span><b class="command">cvs import</b></span>
10252: the modified package in the new place.</p>
10253: </li>
10254:
10255: <li>
10256: <p>Check if any package depends on it:</p>
10257: <pre class="screen">
10258: <tt class="prompt">%</tt> <b class=
10259: "userinput"><tt>cd /usr/pkgsrc</tt></b>
10260: <tt class="prompt">%</tt> <b class=
10261: "userinput"><tt>grep /package */*/Makefile* */*/buildlink*</tt></b>
10262: </pre>
10263: </li>
10264:
10265: <li>
10266: <p>Fix paths in packages from step 5 to point to
10267: new location.</p>
10268: </li>
10269:
10270: <li>
10271: <p><span><b class="command">cvs rm (-f)</b></span>
10272: the package at the old location.</p>
10273: </li>
10274:
10275: <li>
10276: <p>Remove from <tt class=
10277: "filename">oldcategory/Makefile</tt>.</p>
10278: </li>
10279:
10280: <li>
10281: <p>Add to <tt class=
10282: "filename">newcategory/Makefile</tt>.</p>
10283: </li>
10284:
10285: <li>
10286: <p>Commit the changed and removed files:</p>
10287: <pre class="screen">
10288: <tt class="prompt">%</tt> <b class=
10289: "userinput"><tt>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</tt></b>
10290: </pre>
10291:
10292: <p>(and any packages from step 5, of course).</p>
10293: </li>
10294: </ol>
10295: </div>
10296: </div>
10297: </div>
10298: </div>
10299:
10300: <div class="appendix" lang="en" xml:lang="en">
10301: <div class="titlepage">
10302: <div>
10303: <div>
10304: <h2 class="title"><a name="examples" id=
10305: "examples"></a>Appendix A. A simple example
10306: package: bison</h2>
10307: </div>
10308: </div>
10309: </div>
10310:
10311: <div class="toc">
10312: <p><b>Table of Contents</b></p>
10313:
10314: <dl>
1.3 hubertf 10315: <dt><span class="sect1"><a href="#id2575051">A.1.
1.1 grant 10316: files</a></span></dt>
10317:
10318: <dd>
10319: <dl>
1.3 hubertf 10320: <dt><span class="sect2"><a href="#id2575054">A.1.1.
1.1 grant 10321: Makefile</a></span></dt>
10322:
1.3 hubertf 10323: <dt><span class="sect2"><a href="#id2575062">A.1.2.
1.1 grant 10324: DESCR</a></span></dt>
10325:
1.3 hubertf 10326: <dt><span class="sect2"><a href="#id2575077">A.1.3.
1.1 grant 10327: PLIST</a></span></dt>
10328:
1.3 hubertf 10329: <dt><span class="sect2"><a href="#id2575084">A.1.4.
1.1 grant 10330: Checking a package with pkglint</a></span></dt>
10331: </dl>
10332: </dd>
10333:
1.3 hubertf 10334: <dt><span class="sect1"><a href="#id2575193">A.2. Steps
1.1 grant 10335: for building, installing, packaging</a></span></dt>
10336: </dl>
10337: </div>
10338:
10339: <p>We checked to find a piece of software that wasn't in the
10340: packages collection, and picked GNU bison. Quite why someone
10341: would want to have <span><b class="command">bison</b></span>
10342: when Berkeley <span><b class="command">yacc</b></span> is
10343: already present in the tree is beyond us, but it's useful for
10344: the purposes of this exercise.</p>
10345:
10346: <div class="sect1" lang="en" xml:lang="en">
10347: <div class="titlepage">
10348: <div>
10349: <div>
10350: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 10351: "id2575051" id="id2575051"></a>A.1. files</h2>
1.1 grant 10352: </div>
10353: </div>
10354: </div>
10355:
10356: <div class="sect2" lang="en" xml:lang="en">
10357: <div class="titlepage">
10358: <div>
10359: <div>
1.3 hubertf 10360: <h3 class="title"><a name="id2575054" id=
10361: "id2575054"></a>A.1.1. Makefile</h3>
1.1 grant 10362: </div>
10363: </div>
10364: </div>
10365: <pre class="programlisting">
10366: # $NetBSD$
10367: #
10368:
10369: DISTNAME= bison-1.25
10370: CATEGORIES= devel
10371: MASTER_SITES= ${MASTER_SITE_GNU}
10372:
10373: MAINTAINER= thorpej@NetBSD.org
10374: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
10375: COMMENT= GNU yacc clone
10376:
10377: GNU_CONFIGURE= yes
10378: INFO_FILES= bison.info
10379:
10380: .include "../../mk/bsd.pkg.mk"
10381: </pre>
10382: </div>
10383:
10384: <div class="sect2" lang="en" xml:lang="en">
10385: <div class="titlepage">
10386: <div>
10387: <div>
1.3 hubertf 10388: <h3 class="title"><a name="id2575062" id=
10389: "id2575062"></a>A.1.2. DESCR</h3>
1.1 grant 10390: </div>
10391: </div>
10392: </div>
10393: <pre class="programlisting">
10394: GNU version of yacc. Can make re-entrant parsers, and numerous other
10395: improvements. Why you would want this when Berkeley <a href=
10396: "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
10397: of the NetBSD source tree is beyond me.
10398: </pre>
10399: </div>
10400:
10401: <div class="sect2" lang="en" xml:lang="en">
10402: <div class="titlepage">
10403: <div>
10404: <div>
1.3 hubertf 10405: <h3 class="title"><a name="id2575077" id=
10406: "id2575077"></a>A.1.3. PLIST</h3>
1.1 grant 10407: </div>
10408: </div>
10409: </div>
10410: <pre class="programlisting">
10411: @comment $NetBSD$
10412: bin/bison
10413: man/man1/bison.1.gz
10414: info/bison.info
10415: info/bison.info-1
10416: info/bison.info-2
10417: info/bison.info-3
10418: info/bison.info-4
10419: info/bison.info-5
10420: share/bison.simple
10421: share/bison.hairy
10422: </pre>
10423: </div>
10424:
10425: <div class="sect2" lang="en" xml:lang="en">
10426: <div class="titlepage">
10427: <div>
10428: <div>
1.3 hubertf 10429: <h3 class="title"><a name="id2575084" id=
10430: "id2575084"></a>A.1.4. Checking a package with
1.1 grant 10431: <span><b class="command">pkglint</b></span></h3>
10432: </div>
10433: </div>
10434: </div>
10435:
10436: <p>The NetBSD package system comes with <a xmlns=
10437: "http://www.w3.org/TR/xhtml1/transitional" href=
10438: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.2 hubertf 10439: class="pkgname">pkgtools/pkglint</a> which helps to
10440: check the contents of these files. After installation
10441: it is quite easy to use, just change to the directory
10442: of the package you wish to examine and execute
10443: <span><b class="command">pkglint</b></span>:</p>
1.1 grant 10444: <pre class="screen">
10445: <tt class="prompt">$</tt> <b class="userinput"><tt>pkglint</tt></b>
10446: OK: checking ./DESCR.
10447: OK: checking Makefile.
10448: OK: checking distinfo.
10449: OK: checking patches/patch-aa.
10450: looks fine.
10451: </pre>
10452:
10453: <p>Depending on the supplied command line arguments (see
10454: pkglint(1)) more verbose checks will be performed. Use
10455: e.g. <span><b class="command">pkglint -v</b></span> for a
10456: very verbose check.</p>
10457: </div>
10458: </div>
10459:
10460: <div class="sect1" lang="en" xml:lang="en">
10461: <div class="titlepage">
10462: <div>
10463: <div>
10464: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 10465: "id2575193" id="id2575193"></a>A.2. Steps for
1.1 grant 10466: building, installing, packaging</h2>
10467: </div>
10468: </div>
10469: </div>
10470:
10471: <p>Create the directory where the package lives, plus any
10472: auxiliary directories:</p>
10473: <pre class="screen">
10474: <tt class="prompt">#</tt> <b class=
10475: "userinput"><tt>cd /usr/pkgsrc/lang</tt></b>
10476: <tt class="prompt">#</tt> <b class=
10477: "userinput"><tt>mkdir bison</tt></b>
10478: <tt class="prompt">#</tt> <b class=
10479: "userinput"><tt>cd bison</tt></b>
10480: <tt class="prompt">#</tt> <b class=
10481: "userinput"><tt>mkdir patches</tt></b>
10482: </pre>
10483:
10484: <p>Create <tt class="filename">Makefile</tt>, <tt class=
10485: "filename">DESCR</tt> and <tt class="filename">PLIST</tt>
10486: (see <a href="#components" title=
10487: "Chapter 7. Package components - files, directories and contents">
10488: Chapter 7, <i>Package components - files, directories and
10489: contents</i></a>) then continue with fetching the
10490: distfile:</p>
10491: <pre class="screen">
10492: <tt class="prompt">#</tt> <b class=
10493: "userinput"><tt>make fetch</tt></b>
10494: >> bison-1.25.tar.gz doesn't seem to exist on this system.
10495: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
10496: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10497: ftp: Error retrieving file: 500 Internal error
10498:
10499: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
10500: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10501: ftp: Error retrieving file: 500 Internal error
10502:
10503: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
10504: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10505: Successfully retrieved file.
10506: </pre>
10507:
10508: <p>Generate the checksum of the distfile into <tt class=
10509: "filename">distinfo</tt>:</p>
10510: <pre class="screen">
10511: <tt class="prompt">#</tt> <b class=
10512: "userinput"><tt>make makesum</tt></b>
10513: </pre>
10514:
10515: <p>Now compile:</p>
10516: <pre class="screen">
10517: <tt class="prompt">#</tt> <b class="userinput"><tt>make</tt></b>
10518: >> Checksum OK for bison-1.25.tar.gz.
10519: ===> Extracting for bison-1.25
10520: ===> Patching for bison-1.25
10521: ===> Ignoring empty patch directory
10522: ===> Configuring for bison-1.25
10523: creating cache ./config.cache
10524: checking for gcc... cc
10525: checking whether we are using GNU C... yes
10526: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
10527: checking how to run the C preprocessor... cc -E
10528: checking for minix/config.h... no
10529: checking for POSIXized ISC... no
10530: checking whether cross-compiling... no
10531: checking for ANSI C header files... yes
10532: checking for string.h... yes
10533: checking for stdlib.h... yes
10534: checking for memory.h... yes
10535: checking for working const... yes
10536: checking for working alloca.h... no
10537: checking for alloca... yes
10538: checking for strerror... yes
10539: updating cache ./config.cache
10540: creating ./config.status
10541: creating Makefile
10542: ===> Building for bison-1.25
10543: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g LR0.c
10544: 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
10545: 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
10546: 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
10547: 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
10548: 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
10549: 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
10550: 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
10551: 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
10552: 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
10553: 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
10554: 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
10555: 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
10556: 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
10557: 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
10558: 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
10559: 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
10560: 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
10561: 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
10562: 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
10563: 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
10564: 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
10565: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
10566: rm -f bison.s1
10567: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
10568: </pre>
10569:
10570: <p>Everything seems OK, so install the files:</p>
10571: <pre class="screen">
10572: <tt class="prompt">#</tt> <b class=
10573: "userinput"><tt>make install</tt></b>
10574: >> Checksum OK for bison-1.25.tar.gz.
10575: ===> Installing for bison-1.25
10576: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
10577: rm -f /usr/pkg/bin/bison
10578: cd /usr/pkg/share; rm -f bison.simple bison.hairy
10579: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
10580: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
10581: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
10582: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
10583: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
10584: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
10585: ===> Registering installation for bison-1.25
10586: </pre>
10587:
10588: <p>You can now use bison, and also - if you decide so -
10589: remove it with <span><b class="command">pkg_delete
10590: bison</b></span>. Should you decide that you want a binary
10591: package, do this now:</p>
10592: <pre class="screen">
10593: <tt class="prompt">#</tt> <b class=
10594: "userinput"><tt>make package</tt></b>
10595: >> Checksum OK for bison-1.25.tar.gz.
10596: ===> Building package for bison-1.25
10597: Creating package bison-1.25.tgz
10598: Registering depends:.
10599: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
10600: </pre>
10601:
10602: <p>Now that you don't need the source and object files any
10603: more, clean up:</p>
10604: <pre class="screen">
10605: <tt class="prompt">#</tt> <b class=
10606: "userinput"><tt>make clean</tt></b>
10607: ===> Cleaning for bison-1.25
10608: </pre>
10609: </div>
10610: </div>
10611:
10612: <div class="appendix" lang="en" xml:lang="en">
10613: <div class="titlepage">
10614: <div>
10615: <div>
10616: <h2 class="title"><a name="logs" id=
10617: "logs"></a>Appendix B. Build logs</h2>
10618: </div>
10619: </div>
10620: </div>
10621:
10622: <div class="toc">
10623: <p><b>Table of Contents</b></p>
10624:
10625: <dl>
10626: <dt><span class="sect1"><a href="#logs.building">B.1.
10627: Building figlet</a></span></dt>
10628:
10629: <dt><span class="sect1"><a href="#logs.package">B.2.
10630: Packaging figlet</a></span></dt>
10631: </dl>
10632: </div>
10633:
10634: <div class="sect1" lang="en" xml:lang="en">
10635: <div class="titlepage">
10636: <div>
10637: <div>
10638: <h2 class="title" style="clear: both"><a name=
10639: "logs.building" id=
10640: "logs.building"></a>B.1. Building figlet</h2>
10641: </div>
10642: </div>
10643: </div>
10644: <pre class="screen">
10645: <tt class="prompt">#</tt> <b class="userinput"><tt>make</tt></b>
10646: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10647: => figlet221.tar.gz doesn't seem to exist on this system.
10648: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
10649: => [172219 bytes]
10650: Connected to ftp.plig.net.
10651: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
10652: 331 Guest login ok, send your complete e-mail address as password.
10653: 230-You are user #5 of 500 simultaneous users allowed.
10654: 230-
10655: 230- ___ _ _ _
10656: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
10657: 230- | _| _| . |_| . | | | . |_| . | _| . |
10658: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
10659: 230- |_| |_| |___| |___|
10660: 230-
10661: 230-** Welcome to ftp.plig.org **
10662: 230-
10663: 230-Please note that all transfers from this FTP site are logged. If you
10664: 230-do not like this, please disconnect now.
10665: 230-
10666: 230-This arhive is available via
10667: 230-
10668: 230-HTTP: http://ftp.plig.org/
10669: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
10670: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
10671: 230-
10672: 230-Please email comments, bug reports and requests for packages to be
10673: 230-mirrored to ftp-admin@plig.org.
10674: 230-
10675: 230-
10676: 230 Logged in anonymously.
10677: Remote system type is UNIX.
10678: Using binary mode to transfer files.
10679: 200 Type okay.
10680: 250 "/pub" is new cwd.
10681: 250-"/pub/figlet" is new cwd.
10682: 250-
10683: 250-Welcome to the figlet archive at ftp.figlet.org
10684: 250-
10685: 250- ftp://ftp.figlet.org/pub/figlet/
10686: 250-
10687: 250-The official FIGlet web page is:
10688: 250- http://www.figlet.org/
10689: 250-
10690: 250-If you have questions, please mailto:info@figlet.org. If you want to
10691: 250-contribute a font or something else, you can email us.
10692: 250
10693: 250 "/pub/figlet/program" is new cwd.
10694: 250 "/pub/figlet/program/unix" is new cwd.
10695: local: figlet221.tar.gz remote: figlet221.tar.gz
10696: 502 Unimplemented command.
10697: 227 Entering Passive Mode (195,40,6,41,246,104)
10698: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
10699: 38% |************** | 65800 64.16 KB/s 00:01 ETA
10700: 226 Transfer completed.
10701: 172219 bytes received in 00:02 (75.99 KB/s)
10702: 221 Goodbye.
10703: => Checksum OK for figlet221.tar.gz.
10704: ===> Extracting for figlet-2.2.1nb2
10705: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
10706: ===> Patching for figlet-2.2.1nb2
10707: ===> Applying pkgsrc patches for figlet-2.2.1nb2
10708: ===> Overriding tools for figlet-2.2.1nb2
10709: ===> Creating toolchain wrappers for figlet-2.2.1nb2
10710: ===> Configuring for figlet-2.2.1nb2
10711: ===> Building for figlet-2.2.1nb2
10712: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
10713: chmod a+x figlet
10714: gcc -O2 -o chkfont chkfont.c
10715: => Unwrapping files-to-be-installed.
10716: <tt class="prompt">#</tt>
10717: <tt class="prompt">#</tt> <b class=
10718: "userinput"><tt>make install</tt></b>
10719: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10720: ===> Installing for figlet-2.2.1nb2
10721: install -d -o root -g wheel -m 755 /usr/pkg/bin
10722: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
10723: mkdir -p /usr/pkg/share/figlet
10724: cp figlet /usr/pkg/bin
10725: cp chkfont /usr/pkg/bin
10726: chmod 555 figlist showfigfonts
10727: cp figlist /usr/pkg/bin
10728: cp showfigfonts /usr/pkg/bin
10729: cp fonts/*.flf /usr/pkg/share/figlet
10730: cp fonts/*.flc /usr/pkg/share/figlet
10731: cp figlet.6 /usr/pkg/man/man6
10732: ===> Registering installation for figlet-2.2.1nb2
10733: <tt class="prompt">#</tt>
10734: </pre>
10735: </div>
10736:
10737: <div class="sect1" lang="en" xml:lang="en">
10738: <div class="titlepage">
10739: <div>
10740: <div>
10741: <h2 class="title" style="clear: both"><a name=
10742: "logs.package" id=
10743: "logs.package"></a>B.2. Packaging figlet</h2>
10744: </div>
10745: </div>
10746: </div>
10747: <pre class="screen">
10748: <tt class="prompt">#</tt> <b class=
10749: "userinput"><tt>make package</tt></b>
10750: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10751: ===> Packaging figlet-2.2.1nb2
10752: ===> Building binary package for figlet-2.2.1nb2
10753: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
10754: Using SrcDir value of /usr/pkg
10755: Registering depends:.
10756: <tt class="prompt">#</tt>
10757: </pre>
10758: </div>
10759: </div>
10760:
10761: <div class="appendix" lang="en" xml:lang="en">
10762: <div class="titlepage">
10763: <div>
10764: <div>
10765: <h2 class="title"><a name="ftp-layout" id=
10766: "ftp-layout"></a>Appendix C. Layout of the
10767: FTP server's package archive</h2>
10768: </div>
10769: </div>
10770: </div>
10771:
10772: <p>Layout for precompiled binary packages on
10773: ftp.NetBSD.org:</p>
10774: <pre class="programlisting">
10775: /pub/NetBSD/packages/
10776: distfiles/
10777:
10778: # Unpacked pkgsrc trees
10779: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
10780: pkgsrc-2003Q4 -> N/A
10781: pkgsrc-2004Q1/pkgsrc
10782:
10783: # pkgsrc archives
10784: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
10785: pkgsrc-2003Q4.tar.gz -> N/A
10786: pkgsrc-2004Q1.tar.gz -> N/A
10787:
10788: # Per pkgsrc-release/OS-release/arch package archives
10789: pkgsrc-2003Q4/
10790: NetBSD-1.6.2/
10791: i386/
10792: All/
10793: archivers/
10794: foo -> ../All/foo
10795: ...
10796: pkgsrc-2004Q1/
10797: NetBSD-1.6.2/
10798: i386/
10799: All/
10800: ...
10801: NetBSD-2.0/
10802: i386/
10803: All/
10804: ...
10805: SunOS-5.9/
10806: sparc/
10807: All/
10808: ...
10809: x86/
10810: All/
10811: ...
10812:
10813: # Per os-release package archive convenience links
10814: NetBSD-1.6.2 -> 1.6.2
10815: 1.6.2/
10816: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
10817: m68k/
10818: All/
10819: archivers/
10820: foo -> ../All/foo
10821: ...
10822: amiga -> m68k
10823: atari -> m68k
10824: ...
10825:
10826: 2.0 -> NetBSD-2.0 # backward compat, historic
10827: NetBSD-2.0/
10828: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
10829: SunOS-5.9/
10830: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
10831: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
10832:
10833: </pre>
10834:
10835: <p>To create:</p>
10836:
10837: <div class="orderedlist">
10838: <ol type="1">
10839: <li>
10840: <p>Run bulk build, see <a href="#bulkbuild" title=
10841: "5.3. Doing a bulk build of all packages">Section
10842: 5.3, “Doing a bulk build of all
10843: packages”</a></p>
10844: </li>
10845:
10846: <li>
10847: <p>Upload /usr/pkgsrc/packages to</p>
10848: <pre class="programlisting">
10849: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
10850: pkgsrc-2004Q3/\ # pkgsrc-branch
10851: `uname -s`-`uname -r`/ # OS & version
10852: `uname -p` # architecture
10853:
10854: </pre>
10855: </li>
10856:
10857: <li>
10858: <p>If necessary, create a symlink <span><b class=
10859: "command">ln -s `uname -m` `uname -p`</b></span> (amiga
10860: -> m68k, ...)</p>
10861: </li>
10862: </ol>
10863: </div>
10864: </div>
1.2 hubertf 10865:
10866: <div class="appendix" lang="en" xml:lang="en">
10867: <div class="titlepage">
10868: <div>
10869: <div>
10870: <h2 class="title"><a name="editing" id=
10871: "editing"></a>Appendix D. Editing guidelines
10872: for the pkgsrc guide</h2>
10873: </div>
10874: </div>
10875: </div>
10876:
10877: <div class="toc">
10878: <p><b>Table of Contents</b></p>
10879:
10880: <dl>
1.3 hubertf 10881: <dt><span class="sect1"><a href="#id2575976">D.1.
1.2 hubertf 10882: Targets</a></span></dt>
10883:
1.3 hubertf 10884: <dt><span class="sect1"><a href="#id2576025">D.2.
1.2 hubertf 10885: Procedure</a></span></dt>
10886: </dl>
10887: </div>
10888:
10889: <p>This section contains information on editing the pkgsrc
10890: guide itself.</p>
10891:
10892: <div class="sect1" lang="en" xml:lang="en">
10893: <div class="titlepage">
10894: <div>
10895: <div>
10896: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 10897: "id2575976" id="id2575976"></a>D.1. Targets</h2>
1.2 hubertf 10898: </div>
10899: </div>
10900: </div>
10901:
10902: <p>The pkgsrc guide's source code is stored in <tt class=
10903: "filename">pkgsrc/doc/guide/files</tt>, and several files
10904: are created from it:</p>
10905:
10906: <div class="itemizedlist">
10907: <ul type="disc">
10908: <li>
10909: <p><tt class="filename">pkgsrc/doc/pkgsrc.txt</tt>,
10910: which replaces <tt class=
10911: "filename">pkgsrc/Packages.txt</tt></p>
10912: </li>
10913:
10914: <li>
10915: <p><tt class=
10916: "filename">pkgsrc/doc/pkgsrc.html</tt></p>
10917: </li>
10918:
10919: <li>
10920: <p><tt class=
10921: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</tt>:
10922: the documentation on the NetBSD website will be built
10923: from pkgsrc and kept up to date on the web server
10924: itself. This means you <span class=
10925: "emphasis"><em>must</em></span> make sure that your
10926: changes haven't broken the build!</p>
10927: </li>
10928: </ul>
10929: </div>
10930: </div>
10931:
10932: <div class="sect1" lang="en" xml:lang="en">
10933: <div class="titlepage">
10934: <div>
10935: <div>
10936: <h2 class="title" style="clear: both"><a name=
1.3 hubertf 10937: "id2576025" id=
10938: "id2576025"></a>D.2. Procedure</h2>
1.2 hubertf 10939: </div>
10940: </div>
10941: </div>
10942:
10943: <p>The procedure to edit the pkgsrc guide is:</p>
10944:
10945: <div class="itemizedlist">
10946: <ul type="disc">
10947: <li>
10948: <p>Edit the XML file(s) in <tt class=
10949: "filename">pkgsrc/doc/guide/files</tt></p>
10950: </li>
10951:
10952: <li>
1.4 ! hubertf 10953: <p>Run <span><b class="command">make
! 10954: do-lint</b></span> in <tt class=
! 10955: "filename">pkgsrc/doc/guide</tt> to check the XML
! 10956: syntax, and fix it if needed</p>
! 10957: </li>
! 10958:
! 10959: <li>
1.2 hubertf 10960: <p>Run <span><b class="command">make</b></span> in
10961: <tt class="filename">pkgsrc/doc/guide</tt> to build
10962: the HTML and ASCII version</p>
10963: </li>
10964:
10965: <li>
10966: <p>Run <span><b class="command">make
10967: OUTPUT=pdf</b></span> in <tt class=
10968: "filename">pkgsrc/doc/guide</tt> to build the PDF
1.4 ! hubertf 10969: version.</p>
1.2 hubertf 10970: </li>
10971:
10972: <li>
10973: <p>If all is well, run <span><b class="command">make
10974: install-doc</b></span> to put the generated files
1.4 ! hubertf 10975: into <tt class="filename">pkgsrc/doc</tt>.</p>
1.2 hubertf 10976: </li>
10977:
10978: <li>
10979: <p><span><b class="command">cvs commit
10980: pkgsrc/doc/guide/files</b></span></p>
10981: </li>
10982:
10983: <li>
10984: <p><span><b class="command">cvs commit
10985: pkgsrc/doc/pkgsrc.{html,txt}</b></span></p>
10986: </li>
1.4 ! hubertf 10987:
! 10988: <li>
! 10989: <p>Until the webserver on www.NetBSD.org is really
! 10990: updated automatically to pick up changes to the
! 10991: pkgsrc guide automatically, also run <span><b class=
! 10992: "command">make install-htdoc
! 10993: HTDOCSDIR=../../../htdocs</b></span> (or similar,
! 10994: adjust <tt class="varname">HTDOCSDIR</tt>!)</p>
! 10995: </li>
! 10996:
! 10997: <li>
! 10998: <p><span><b class="command">cvs commit
! 10999: htdocs/Documentation/pkgsrc</b></span></p>
! 11000: </li>
1.2 hubertf 11001: </ul>
11002: </div>
11003: </div>
11004: </div>
1.1 grant 11005: </div>
11006: </body>
11007: </html>
CVSweb <webmaster@jp.NetBSD.org>