Annotation of pkgsrc/doc/pkgsrc.html, revision 1.22
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.20 ben 4: "HTML Tidy for NetBSD (vers 1st August 2004), see www.w3.org" />
1.1 grant 5: <meta http-equiv="Content-Type" content=
6: "text/html; charset=us-ascii" />
7:
8: <title>The pkgsrc guide</title>
9: <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
10: <meta name="generator" content=
1.20 ben 11: "DocBook XSL Stylesheets V1.68.1" />
1.1 grant 12: <meta name="description" content=
13: "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
14: </head>
15:
16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
17: alink="#0000FF">
18: <div class="book" lang="en" xml:lang="en">
19: <div class="titlepage">
20: <div>
21: <div>
1.22 ! tv 22: <h1 class="title"><a name="id2540860" id=
! 23: "id2540860"></a>The pkgsrc guide</h1>
1.1 grant 24: </div>
25:
26: <div>
1.2 hubertf 27: <h2 class="subtitle">Documentation on the NetBSD packages
1.1 grant 28: system</h2>
29: </div>
30:
31: <div>
32: <div class="authorgroup">
33: <div class="author">
34: <h3 class="author"><span class=
35: "firstname">Alistair</span> <span class=
36: "surname">Crooks</span></h3>
37:
38: <div class="affiliation">
39: <div class="address">
1.14 xtraeme 40: <p><code class="email"><<a href=
41: "mailto:agc@NetBSD.org">agc@NetBSD.org</a>></code></p>
1.1 grant 42: </div>
43: </div>
44: </div>
45:
46: <div class="author">
47: <h3 class="author"><span class=
48: "firstname">Hubert</span> <span class=
49: "surname">Feyrer</span></h3>
50:
51: <div class="affiliation">
52: <div class="address">
1.14 xtraeme 53: <p><code class="email"><<a href=
54: "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>></code></p>
1.1 grant 55: </div>
56: </div>
57: </div>
1.2 hubertf 58:
1.3 hubertf 59: <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1 grant 60: </div>
61: </div>
62:
63: <div>
64: <p class="copyright">Copyright © 1994-2004 The
65: NetBSD Foundation, Inc</p>
66: </div>
67:
68: <div>
1.3 hubertf 69: <p class="pubdate">$NetBSD: pkgsrc.xml,v 1.3 2004/10/22
70: 00:24:48 hubertf Exp $</p>
1.1 grant 71: </div>
72:
73: <div>
74: <div class="abstract">
75: <p class="title"><b>Abstract</b></p>
76:
77: <p>Information about using the NetBSD package system
78: (pkgsrc) from both a user view for installing packages
79: as well as from a pkgsrc developers' view for creating
80: new packages.</p>
81: </div>
82: </div>
83: </div>
84: <hr />
85: </div>
86:
87: <div class="toc">
88: <p><b>Table of Contents</b></p>
89:
90: <dl>
91: <dt><span class="chapter"><a href="#introduction">1.
92: Introduction</a></span></dt>
93:
94: <dd>
95: <dl>
1.22 ! tv 96: <dt><span class="sect1"><a href="#id2507990">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.22 ! tv 120: <dt><span class="sect1"><a href="#id2508576">2.1.
1.1 grant 121: As tar file</a></span></dt>
122:
1.22 ! tv 123: <dt><span class="sect1"><a href="#id2508592">2.2.
1.1 grant 124: Via SUP</a></span></dt>
125:
1.22 ! tv 126: <dt><span class="sect1"><a href="#id2508692">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.22 ! tv 136: <dt><span class="sect1"><a href="#id2508802">3.1.
1.1 grant 137: Bootstrapping pkgsrc</a></span></dt>
138:
1.22 ! tv 139: <dt><span class="sect1"><a href="#id2508915">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.22 ! tv 145: "#id2508921">3.2.1. Darwin (Mac OS
1.1 grant 146: X)</a></span></dt>
147:
148: <dt><span class="sect2"><a href=
1.22 ! tv 149: "#id2509220">3.2.2. FreeBSD</a></span></dt>
1.1 grant 150:
151: <dt><span class="sect2"><a href=
1.22 ! tv 152: "#id2509390">3.2.3. Interix</a></span></dt>
1.1 grant 153:
154: <dt><span class="sect2"><a href=
1.22 ! tv 155: "#id2509966">3.2.4. IRIX</a></span></dt>
1.1 grant 156:
157: <dt><span class="sect2"><a href=
1.22 ! tv 158: "#id2510187">3.2.5. Linux</a></span></dt>
1.1 grant 159:
160: <dt><span class="sect2"><a href=
1.22 ! tv 161: "#id2510248">3.2.6. OpenBSD</a></span></dt>
! 162:
! 163: <dt><span class="sect2"><a href=
! 164: "#id2510360">3.2.7. Solaris</a></span></dt>
1.1 grant 165: </dl>
166: </dd>
167: </dl>
168: </dd>
169:
170: <dt><span class="chapter"><a href="#using">4. Using
171: pkgsrc</a></span></dt>
172:
173: <dd>
174: <dl>
175: <dt><span class="sect1"><a href=
176: "#getting-started">4.1. Working with binary
177: packages</a></span></dt>
178:
179: <dd>
180: <dl>
181: <dt><span class="sect2"><a href=
1.22 ! tv 182: "#id2510565">4.1.1. Where to get binary
1.1 grant 183: packages</a></span></dt>
184:
185: <dt><span class="sect2"><a href=
1.22 ! tv 186: "#id2510605">4.1.2. How to use binary
1.1 grant 187: packages</a></span></dt>
188:
189: <dt><span class="sect2"><a href=
1.22 ! tv 190: "#id2510672">4.1.3. A word of
1.1 grant 191: warning</a></span></dt>
192: </dl>
193: </dd>
194:
1.22 ! tv 195: <dt><span class="sect1"><a href="#id2510683">4.2.
1.1 grant 196: Building packages from source</a></span></dt>
197:
198: <dd>
199: <dl>
200: <dt><span class="sect2"><a href=
1.22 ! tv 201: "#id2510693">4.2.1.
1.1 grant 202: Requirements</a></span></dt>
203:
204: <dt><span class="sect2"><a href=
1.22 ! tv 205: "#id2510781">4.2.2. Fetching
1.1 grant 206: distfiles</a></span></dt>
207:
208: <dt><span class="sect2"><a href=
1.22 ! tv 209: "#id2510834">4.2.3. How to build and
1.1 grant 210: install</a></span></dt>
211:
212: <dt><span class="sect2"><a href=
1.22 ! tv 213: "#id2511091">4.2.4. Selecting the
1.1 grant 214: compiler</a></span></dt>
215: </dl>
216: </dd>
217: </dl>
218: </dd>
219:
220: <dt><span class="chapter"><a href="#binary">5. Creating
221: binary packages</a></span></dt>
222:
223: <dd>
224: <dl>
1.22 ! tv 225: <dt><span class="sect1"><a href="#id2512065">5.1.
1.1 grant 226: Building a single binary package</a></span></dt>
227:
1.22 ! tv 228: <dt><span class="sect1"><a href="#id2512142">5.2.
1.1 grant 229: Settings for creation of binary
230: packages</a></span></dt>
231:
232: <dt><span class="sect1"><a href="#bulkbuild">5.3.
233: Doing a bulk build of all packages</a></span></dt>
234:
235: <dd>
236: <dl>
237: <dt><span class="sect2"><a href=
238: "#binary.configuration">5.3.1.
239: Configuration</a></span></dt>
240:
241: <dt><span class="sect2"><a href=
1.22 ! tv 242: "#id2577136">5.3.2. Other environmental
1.1 grant 243: considerations</a></span></dt>
244:
245: <dt><span class="sect2"><a href=
1.22 ! tv 246: "#id2577176">5.3.3. Operation</a></span></dt>
1.1 grant 247:
248: <dt><span class="sect2"><a href=
1.22 ! tv 249: "#id2577245">5.3.4. What it
1.1 grant 250: does</a></span></dt>
251:
252: <dt><span class="sect2"><a href=
1.22 ! tv 253: "#id2577302">5.3.5. Disk space
1.1 grant 254: requirements</a></span></dt>
255:
256: <dt><span class="sect2"><a href=
1.22 ! tv 257: "#id2577329">5.3.6. Setting up a sandbox for
1.1 grant 258: chroot'ed builds</a></span></dt>
259:
260: <dt><span class="sect2"><a href=
1.22 ! tv 261: "#id2577858">5.3.7. Building a partial set of
1.1 grant 262: packages</a></span></dt>
1.13 hubertf 263:
264: <dt><span class="sect2"><a href=
265: "#bulk-upload">5.3.8. Uploading results of a
266: bulk build</a></span></dt>
1.1 grant 267: </dl>
268: </dd>
269:
1.22 ! tv 270: <dt><span class="sect1"><a href="#id2578363">5.4.
1.1 grant 271: Creating a multiple CD-ROM packages
272: collection</a></span></dt>
273:
274: <dd>
275: <dl>
276: <dt><span class="sect2"><a href=
1.22 ! tv 277: "#id2578378">5.4.1. Example of
1.1 grant 278: cdpack</a></span></dt>
279: </dl>
280: </dd>
281: </dl>
282: </dd>
283:
284: <dt><span class="chapter"><a href="#faq">6. Frequently
285: Asked Questions</a></span></dt>
286:
287: <dd>
288: <dl>
1.22 ! tv 289: <dt><span class="sect1"><a href="#id2578570">6.1.
1.18 xtraeme 290: Are there any mailing lists for pkg-related
1.1 grant 291: discussion?</a></span></dt>
292:
1.22 ! tv 293: <dt><span class="sect1"><a href="#id2578636">6.2.
1.1 grant 294: Where's the pkgviews documentation?</a></span></dt>
295:
1.5 hubertf 296: <dt><span class="sect1"><a href=
297: "#faq-pkgtools">6.3. Utilities for package
298: management (pkgtools)</a></span></dt>
1.1 grant 299:
1.22 ! tv 300: <dt><span class="sect1"><a href="#id2578821">6.4.
1.1 grant 301: How to use pkgsrc as non-root</a></span></dt>
302:
1.22 ! tv 303: <dt><span class="sect1"><a href="#id2578833">6.5.
1.15 xtraeme 304: How to resume transfers when fetching
305: distfiles?</a></span></dt>
1.14 xtraeme 306:
1.22 ! tv 307: <dt><span class="sect1"><a href="#id2578944">6.6.
1.1 grant 308: How can I install/use XFree86 from
309: pkgsrc?</a></span></dt>
310:
1.22 ! tv 311: <dt><span class="sect1"><a href="#id2578971">6.7.
1.1 grant 312: How can I install/use X.org from
313: pkgsrc?</a></span></dt>
314:
1.22 ! tv 315: <dt><span class="sect1"><a href="#id2578999">6.8.
1.1 grant 316: How to fetch files from behind a
317: firewall</a></span></dt>
318:
1.22 ! tv 319: <dt><span class="sect1"><a href="#id2579013">6.9.
1.14 xtraeme 320: How do I tell <span><strong class="command">make
321: fetch</strong></span> to do passive
1.1 grant 322: FTP?</a></span></dt>
323:
1.22 ! tv 324: <dt><span class="sect1"><a href="#id2579064">6.10.
1.1 grant 325: How to fetch all distfiles at once</a></span></dt>
326:
1.22 ! tv 327: <dt><span class="sect1"><a href="#id2579204">6.11.
1.14 xtraeme 328: What does “<span class="quote">Don't know how
329: to make /usr/share/tmac/tmac.andoc</span>”
330: mean?</a></span></dt>
1.13 hubertf 331:
1.22 ! tv 332: <dt><span class="sect1"><a href="#id2579242">6.12.
1.14 xtraeme 333: What does “<span class="quote">Could not find
334: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 335:
1.22 ! tv 336: <dt><span class="sect1"><a href="#id2579300">6.13.
1.1 grant 337: Using 'sudo' with pkgsrc</a></span></dt>
338:
1.14 xtraeme 339: <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1 grant 340: Configuration files handling and
341: placement</a></span></dt>
342:
343: <dt><span class="sect1"><a href=
1.14 xtraeme 344: "#audit-packages">6.15. Automated security
1.1 grant 345: checks</a></span></dt>
346: </dl>
347: </dd>
348: </dl>
349: </dd>
350:
1.2 hubertf 351: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 352: pkgsrc developer's guide</a></span></dt>
353:
354: <dd>
355: <dl>
356: <dt><span class="chapter"><a href="#components">7.
357: Package components - files, directories and
358: contents</a></span></dt>
359:
360: <dd>
361: <dl>
362: <dt><span class="sect1"><a href=
1.14 xtraeme 363: "#components.Makefile">7.1. <code class=
364: "filename">Makefile</code></a></span></dt>
1.1 grant 365:
366: <dt><span class="sect1"><a href=
1.14 xtraeme 367: "#components.distinfo">7.2. <code class=
368: "filename">distinfo</code></a></span></dt>
1.1 grant 369:
370: <dt><span class="sect1"><a href=
371: "#components.patches">7.3.
372: patches/*</a></span></dt>
373:
1.22 ! tv 374: <dt><span class="sect1"><a href="#id2580482">7.4.
1.1 grant 375: Other mandatory files</a></span></dt>
376:
377: <dt><span class="sect1"><a href=
378: "#components.optional">7.5. Optional
379: files</a></span></dt>
380:
1.22 ! tv 381: <dt><span class="sect1"><a href="#id2580608">7.6.
1.14 xtraeme 382: <code class="filename">work*</code></a></span></dt>
1.1 grant 383:
1.22 ! tv 384: <dt><span class="sect1"><a href="#id2580763">7.7.
1.14 xtraeme 385: <code class=
386: "filename">files/*</code></a></span></dt>
1.1 grant 387: </dl>
388: </dd>
389:
390: <dt><span class="chapter"><a href="#plist">8. PLIST
391: issues</a></span></dt>
392:
393: <dd>
394: <dl>
1.22 ! tv 395: <dt><span class="sect1"><a href="#id2580818">8.1.
1.1 grant 396: RCS ID</a></span></dt>
397:
1.22 ! tv 398: <dt><span class="sect1"><a href="#id2580901">8.2.
1.14 xtraeme 399: Semi-automatic <code class="filename">PLIST</code>
400: generation</a></span></dt>
1.1 grant 401:
402: <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14 xtraeme 403: Tweaking output of <span><strong class=
404: "command">make
405: print-PLIST</strong></span></a></span></dt>
1.1 grant 406:
407: <dt><span class="sect1"><a href="#plist.misc">8.4.
408: Variable substitution in PLIST</a></span></dt>
409:
1.22 ! tv 410: <dt><span class="sect1"><a href="#id2581290">8.5.
1.1 grant 411: Manpage-compression</a></span></dt>
412:
1.22 ! tv 413: <dt><span class="sect1"><a href="#id2581332">8.6.
1.14 xtraeme 414: Changing PLIST source with <code class=
415: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 416:
1.22 ! tv 417: <dt><span class="sect1"><a href="#id2581349">8.7.
1.1 grant 418: Platform specific and differing
419: PLISTs</a></span></dt>
420:
421: <dt><span class="sect1"><a href=
422: "#faq.common-dirs">8.8. Sharing directories between
423: packages</a></span></dt>
424: </dl>
425: </dd>
426:
427: <dt><span class="chapter"><a href="#buildlink">9.
428: Buildlink methodology</a></span></dt>
429:
430: <dd>
431: <dl>
1.22 ! tv 432: <dt><span class="sect1"><a href="#id2581547">9.1.
1.1 grant 433: Converting packages to use
434: buildlink3</a></span></dt>
435:
1.22 ! tv 436: <dt><span class="sect1"><a href="#id2581865">9.2.
1.14 xtraeme 437: Writing <code class="filename">buildlink3.mk</code>
438: files</a></span></dt>
1.1 grant 439:
440: <dd>
441: <dl>
442: <dt><span class="sect2"><a href=
1.22 ! tv 443: "#id2581934">9.2.1. Anatomy of a buildlink3.mk
1.1 grant 444: file</a></span></dt>
445:
446: <dt><span class="sect2"><a href=
1.22 ! tv 447: "#id2582307">9.2.2. Updating <code class=
1.14 xtraeme 448: "varname">BUILDLINK_DEPENDS.<em class=
449: "replaceable"><code>pkg</code></em></code> in
450: <code class="filename">buildlink3.mk</code>
1.1 grant 451: files</a></span></dt>
452: </dl>
453: </dd>
454:
1.22 ! tv 455: <dt><span class="sect1"><a href="#id2582386">9.3.
1.14 xtraeme 456: Writing <code class="filename">builtin.mk</code>
457: files</a></span></dt>
1.1 grant 458:
459: <dd>
460: <dl>
461: <dt><span class="sect2"><a href=
1.22 ! tv 462: "#id2582603">9.3.1. Anatomy of a <code class=
1.14 xtraeme 463: "filename">builtin.mk</code>
1.1 grant 464: file</a></span></dt>
465:
466: <dt><span class="sect2"><a href=
1.22 ! tv 467: "#id2582830">9.3.2. Global preferences for
1.1 grant 468: native or pkgsrc software</a></span></dt>
469: </dl>
470: </dd>
471: </dl>
472: </dd>
473:
474: <dt><span class="chapter"><a href="#options">10.
475: Options handling</a></span></dt>
476:
477: <dd>
478: <dl>
1.22 ! tv 479: <dt><span class="sect1"><a href="#id2582903">10.1.
1.1 grant 480: Global default options</a></span></dt>
481:
1.22 ! tv 482: <dt><span class="sect1"><a href="#id2582918">10.2.
1.14 xtraeme 483: Converting packages to use <code class=
484: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 485: </dl>
486: </dd>
487:
488: <dt><span class="chapter"><a href="#build">11. The
489: build process</a></span></dt>
490:
491: <dd>
492: <dl>
493: <dt><span class="sect1"><a href=
494: "#build.prefix">11.1. Program
495: location</a></span></dt>
496:
1.22 ! tv 497: <dt><span class="sect1"><a href="#id2583526">11.2.
1.1 grant 498: Main targets</a></span></dt>
499:
500: <dt><span class="sect1"><a href=
501: "#build.helpful-targets">11.3. Other helpful
502: targets</a></span></dt>
503: </dl>
504: </dd>
505:
506: <dt><span class="chapter"><a href="#fixes">12. Notes on
507: fixes for packages</a></span></dt>
508:
509: <dd>
510: <dl>
1.22 ! tv 511: <dt><span class="sect1"><a href="#id2585063">12.1.
1.1 grant 512: General operation</a></span></dt>
513:
514: <dd>
515: <dl>
516: <dt><span class="sect2"><a href=
1.22 ! tv 517: "#id2585066">12.1.1. How to pull in variables
1.1 grant 518: from /etc/mk.conf</a></span></dt>
519:
520: <dt><span class="sect2"><a href=
1.22 ! tv 521: "#id2585149">12.1.2. Restricted
1.1 grant 522: packages</a></span></dt>
523:
524: <dt><span class="sect2"><a href=
525: "#dependencies">12.1.3. Handling
526: dependencies</a></span></dt>
527:
528: <dt><span class="sect2"><a href=
1.22 ! tv 529: "#id2585596">12.1.4. Handling conflicts with
1.1 grant 530: other packages</a></span></dt>
531:
532: <dt><span class="sect2"><a href=
1.22 ! tv 533: "#id2585715">12.1.5. Packages that cannot or
1.1 grant 534: should not be built</a></span></dt>
535:
536: <dt><span class="sect2"><a href=
1.22 ! tv 537: "#id2585740">12.1.6. Packages which should not
1.1 grant 538: be deleted, once installed</a></span></dt>
539:
540: <dt><span class="sect2"><a href=
541: "#security-handling">12.1.7. Handling packages
542: with security problems</a></span></dt>
543:
544: <dt><span class="sect2"><a href=
1.22 ! tv 545: "#id2585832">12.1.8. How to handle compiler
1.1 grant 546: bugs</a></span></dt>
547:
548: <dt><span class="sect2"><a href=
1.22 ! tv 549: "#id2585854">12.1.9. How to handle incrementing
1.1 grant 550: versions when fixing an existing
551: package</a></span></dt>
552:
553: <dt><span class="sect2"><a href=
1.22 ! tv 554: "#id2585904">12.1.10. Portability of
1.1 grant 555: packages</a></span></dt>
556: </dl>
557: </dd>
558:
1.22 ! tv 559: <dt><span class="sect1"><a href="#id2585928">12.2.
1.1 grant 560: Possible downloading issues</a></span></dt>
561:
562: <dd>
563: <dl>
564: <dt><span class="sect2"><a href=
1.22 ! tv 565: "#id2585931">12.2.1. Packages whose distfiles
1.1 grant 566: aren't available for plain
567: downloading</a></span></dt>
568:
569: <dt><span class="sect2"><a href=
1.22 ! tv 570: "#id2585994">12.2.2. How to handle modified
1.1 grant 571: distfiles with the 'old' name</a></span></dt>
572: </dl>
573: </dd>
574:
1.22 ! tv 575: <dt><span class="sect1"><a href="#id2586006">12.3.
1.1 grant 576: Configuration gotchas</a></span></dt>
577:
578: <dd>
579: <dl>
580: <dt><span class="sect2"><a href=
581: "#fixes.libtool">12.3.1. Shared libraries -
582: libtool</a></span></dt>
583:
584: <dt><span class="sect2"><a href=
1.22 ! tv 585: "#id2586589">12.3.2. Using libtool on GNU
1.1 grant 586: packages that already support
587: libtool</a></span></dt>
588:
589: <dt><span class="sect2"><a href=
1.22 ! tv 590: "#id2586670">12.3.3. GNU
1.1 grant 591: Autoconf/Automake</a></span></dt>
592: </dl>
593: </dd>
594:
1.22 ! tv 595: <dt><span class="sect1"><a href="#id2586784">12.4.
1.1 grant 596: Building considerations</a></span></dt>
597:
598: <dd>
599: <dl>
600: <dt><span class="sect2"><a href=
1.22 ! tv 601: "#id2586787">12.4.1. CPP
1.1 grant 602: defines</a></span></dt>
603: </dl>
604: </dd>
605:
1.22 ! tv 606: <dt><span class="sect1"><a href="#id2586817">12.5.
1.1 grant 607: Package specific actions</a></span></dt>
608:
609: <dd>
610: <dl>
611: <dt><span class="sect2"><a href=
1.22 ! tv 612: "#id2586820">12.5.1. Package configuration
1.1 grant 613: files</a></span></dt>
614:
615: <dt><span class="sect2"><a href=
1.22 ! tv 616: "#id2586990">12.5.2. User
1.2 hubertf 617: interaction</a></span></dt>
1.1 grant 618:
619: <dt><span class="sect2"><a href=
1.22 ! tv 620: "#id2587035">12.5.3. Handling
1.1 grant 621: licenses</a></span></dt>
622:
623: <dt><span class="sect2"><a href=
1.22 ! tv 624: "#id2587187">12.5.4. Creating an account from a
1.1 grant 625: package</a></span></dt>
626:
627: <dt><span class="sect2"><a href=
1.22 ! tv 628: "#id2587249">12.5.5. Installing score
1.1 grant 629: files</a></span></dt>
630:
631: <dt><span class="sect2"><a href=
1.22 ! tv 632: "#id2587292">12.5.6. Packages providing login
1.1 grant 633: shells</a></span></dt>
634:
635: <dt><span class="sect2"><a href=
1.22 ! tv 636: "#id2587350">12.5.7. Packages containing perl
1.1 grant 637: scripts</a></span></dt>
638:
639: <dt><span class="sect2"><a href=
1.22 ! tv 640: "#id2587368">12.5.8. Packages with hardcoded
1.1 grant 641: paths to other interpreters</a></span></dt>
642:
643: <dt><span class="sect2"><a href=
1.22 ! tv 644: "#id2587458">12.5.9. Packages installing perl
1.1 grant 645: modules</a></span></dt>
646:
647: <dt><span class="sect2"><a href=
648: "#faq.info-files">12.5.10. Packages installing
649: info files</a></span></dt>
650:
651: <dt><span class="sect2"><a href=
1.22 ! tv 652: "#id2587677">12.5.11. Packages installing
1.1 grant 653: GConf2 data files</a></span></dt>
654:
655: <dt><span class="sect2"><a href=
1.22 ! tv 656: "#id2587778">12.5.12. Packages installing
1.1 grant 657: scrollkeeper data files</a></span></dt>
658:
659: <dt><span class="sect2"><a href=
1.22 ! tv 660: "#id2587829">12.5.13. Packages installing X11
1.1 grant 661: fonts</a></span></dt>
662:
663: <dt><span class="sect2"><a href=
1.22 ! tv 664: "#id2587876">12.5.14. Packages installing GTK2
1.1 grant 665: modules</a></span></dt>
666:
667: <dt><span class="sect2"><a href=
1.22 ! tv 668: "#id2587945">12.5.15. Packages installing SGML
1.1 grant 669: or XML data</a></span></dt>
670:
671: <dt><span class="sect2"><a href=
1.22 ! tv 672: "#id2588066">12.5.16. Packages installing
1.1 grant 673: extensions to the MIME database</a></span></dt>
674:
675: <dt><span class="sect2"><a href=
1.22 ! tv 676: "#id2588273">12.5.17. Packages using
1.1 grant 677: intltool</a></span></dt>
1.18 xtraeme 678:
679: <dt><span class="sect2"><a href=
1.22 ! tv 680: "#id2588286">12.5.18. Packages installing
1.18 xtraeme 681: startup scripts</a></span></dt>
1.1 grant 682: </dl>
683: </dd>
684:
1.22 ! tv 685: <dt><span class="sect1"><a href="#id2588308">12.6.
1.1 grant 686: Feedback to the author</a></span></dt>
687: </dl>
688: </dd>
689:
690: <dt><span class="chapter"><a href="#debug">13.
691: Debugging</a></span></dt>
692:
693: <dt><span class="chapter"><a href="#submit">14.
694: Submitting and Committing</a></span></dt>
695:
696: <dd>
697: <dl>
1.22 ! tv 698: <dt><span class="sect1"><a href="#id2588838">14.1.
1.1 grant 699: Submitting your packages</a></span></dt>
700:
1.22 ! tv 701: <dt><span class="sect1"><a href="#id2588889">14.2.
1.1 grant 702: Committing: Importing a package into
703: CVS</a></span></dt>
704:
1.22 ! tv 705: <dt><span class="sect1"><a href="#id2589020">14.3.
1.2 hubertf 706: Updating a package to a newer
707: version</a></span></dt>
1.1 grant 708:
1.22 ! tv 709: <dt><span class="sect1"><a href="#id2589040">14.4.
1.2 hubertf 710: Moving a package in pkgsrc</a></span></dt>
1.1 grant 711: </dl>
712: </dd>
713: </dl>
714: </dd>
715:
716: <dt><span class="appendix"><a href="#examples">A. A simple
717: example package: bison</a></span></dt>
718:
719: <dd>
720: <dl>
1.22 ! tv 721: <dt><span class="sect1"><a href="#id2589266">A.1.
1.1 grant 722: files</a></span></dt>
723:
724: <dd>
725: <dl>
1.22 ! tv 726: <dt><span class="sect2"><a href="#id2589269">A.1.1.
1.1 grant 727: Makefile</a></span></dt>
728:
1.22 ! tv 729: <dt><span class="sect2"><a href="#id2589276">A.1.2.
1.1 grant 730: DESCR</a></span></dt>
731:
1.22 ! tv 732: <dt><span class="sect2"><a href="#id2589291">A.1.3.
1.1 grant 733: PLIST</a></span></dt>
734:
1.22 ! tv 735: <dt><span class="sect2"><a href="#id2589299">A.1.4.
1.14 xtraeme 736: Checking a package with <span><strong class=
737: "command">pkglint</strong></span></a></span></dt>
1.1 grant 738: </dl>
739: </dd>
740:
1.22 ! tv 741: <dt><span class="sect1"><a href="#id2589339">A.2. Steps
1.1 grant 742: for building, installing, packaging</a></span></dt>
743: </dl>
744: </dd>
745:
746: <dt><span class="appendix"><a href="#logs">B. Build
747: logs</a></span></dt>
748:
749: <dd>
750: <dl>
751: <dt><span class="sect1"><a href="#logs.building">B.1.
752: Building figlet</a></span></dt>
753:
754: <dt><span class="sect1"><a href="#logs.package">B.2.
755: Packaging figlet</a></span></dt>
756: </dl>
757: </dd>
758:
759: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
760: of the FTP server's package archive</a></span></dt>
1.2 hubertf 761:
762: <dt><span class="appendix"><a href="#editing">D. Editing
763: guidelines for the pkgsrc guide</a></span></dt>
764:
765: <dd>
766: <dl>
1.22 ! tv 767: <dt><span class="sect1"><a href="#id2590054">D.1.
1.2 hubertf 768: Targets</a></span></dt>
769:
1.22 ! tv 770: <dt><span class="sect1"><a href="#id2590124">D.2.
1.2 hubertf 771: Procedure</a></span></dt>
772: </dl>
773: </dd>
1.1 grant 774: </dl>
775: </div>
776:
777: <div class="chapter" lang="en" xml:lang="en">
778: <div class="titlepage">
779: <div>
780: <div>
781: <h2 class="title"><a name="introduction" id=
782: "introduction"></a>Chapter 1. Introduction</h2>
783: </div>
784: </div>
785: </div>
786:
787: <div class="toc">
788: <p><b>Table of Contents</b></p>
789:
790: <dl>
1.22 ! tv 791: <dt><span class="sect1"><a href="#id2507990">1.1.
1.1 grant 792: Introduction</a></span></dt>
793:
794: <dt><span class="sect1"><a href="#overview">1.2.
795: Overview</a></span></dt>
796:
797: <dt><span class="sect1"><a href="#terminology">1.3.
798: Terminology</a></span></dt>
799:
800: <dt><span class="sect1"><a href="#typography">1.4.
801: Typography</a></span></dt>
802: </dl>
803: </div>
804:
805: <div class="sect1" lang="en" xml:lang="en">
806: <div class="titlepage">
807: <div>
808: <div>
809: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 810: "id2507990" id=
! 811: "id2507990"></a>1.1. Introduction</h2>
1.1 grant 812: </div>
813: </div>
814: </div>
815:
816: <p>There is a lot of software freely available for Unix
817: based systems, which usually runs on NetBSD and other
818: Unix-flavoured systems, too, sometimes with some
819: modifications. The NetBSD Packages Collection (pkgsrc)
820: incorporates any such changes necessary to make that
821: software run, and makes the installation (and
822: de-installation) of the software package easy by means of a
823: single command.</p>
824:
825: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 826: the <span><strong class="command">pkg_*</strong></span>
827: tools so that installation and de-installation, printing of
828: an inventory of all installed packages and retrieval of
829: one-line comments or more verbose descriptions are all
830: simple.</p>
1.1 grant 831:
832: <p>pkgsrc currently contains several thousand packages,
833: including:</p>
834:
835: <div class="itemizedlist">
836: <ul type="disc">
837: <li>
838: <p><a xmlns=
839: "http://www.w3.org/TR/xhtml1/transitional" href=
840: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.20 ben 841: class="pkgname">www/apache</a> - The Apache web
842: server</p>
1.1 grant 843: </li>
844:
845: <li>
846: <p><a xmlns=
847: "http://www.w3.org/TR/xhtml1/transitional" href=
848: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 849: class="pkgname">www/mozilla</a> - The Mozilla web
850: browser</p>
1.1 grant 851: </li>
852:
853: <li>
854: <p><a xmlns=
855: "http://www.w3.org/TR/xhtml1/transitional" href=
856: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.20 ben 857: class="pkgname">meta-pkgs/gnome</a> - The GNOME
858: Desktop Environment</p>
1.1 grant 859: </li>
860:
861: <li>
862: <p><a xmlns=
863: "http://www.w3.org/TR/xhtml1/transitional" href=
864: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.20 ben 865: class="pkgname">meta-pkgs/kde3</a> - The K Desktop
866: Environment</p>
1.1 grant 867: </li>
868: </ul>
869: </div>
870:
871: <p>...just to name a few.</p>
872:
873: <p>pkgsrc has built-in support for handling varying
874: dependencies, such as pthreads and X11, and extended
875: features such as IPv6 support on a range of platforms.</p>
876:
877: <p>pkgsrc was derived from FreeBSD's ports system, and
878: initially developed for NetBSD only. Since then, pkgsrc has
879: grown a lot, and now supports the following platforms:</p>
880:
881: <div class="itemizedlist">
882: <ul type="disc">
883: <li>
884: <p><a href="http://developer.apple.com/darwin/"
885: target="_top">Darwin</a> (<a href=
886: "http://www.apple.com/macosx/" target="_top">Mac OS
887: X</a>)</p>
888: </li>
889:
890: <li>
1.3 hubertf 891: <p><a href="http://www.DragonFlyBSD.org/" target=
892: "_top">DragonFlyBSD</a></p>
893: </li>
894:
895: <li>
1.1 grant 896: <p><a href="http://www.FreeBSD.org/" target=
897: "_top">FreeBSD</a></p>
898: </li>
899:
900: <li>
1.3 hubertf 901: <p>Microsoft Windows, via <a href=
902: "http://www.microsoft.com/windows/sfu/" target=
903: "_top">Interix</a></p>
1.1 grant 904: </li>
905:
906: <li>
907: <p><a href="http://www.sgi.com/software/irix6.5/"
908: target="_top">IRIX</a></p>
909: </li>
910:
911: <li>
912: <p><a href="http://www.linux.org/" target=
913: "_top">Linux</a></p>
914: </li>
915:
916: <li>
917: <p><a href="http://www.NetBSD.org/" target=
918: "_top">NetBSD</a> (of course)</p>
919: </li>
920:
921: <li>
1.17 sketch 922: <p><a href="http://h30097.www3.hp.com/" target=
923: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
924: </li>
925:
926: <li>
1.1 grant 927: <p><a href="http://www.openbsd.org/" target=
928: "_top">OpenBSD</a></p>
929: </li>
930:
931: <li>
932: <p><a href="http://www.sun.com/solaris/" target=
933: "_top">Solaris</a></p>
934: </li>
935: </ul>
936: </div>
937: </div>
938:
939: <div class="sect1" lang="en" xml:lang="en">
940: <div class="titlepage">
941: <div>
942: <div>
943: <h2 class="title" style="clear: both"><a name=
944: "overview" id="overview"></a>1.2. Overview</h2>
945: </div>
946: </div>
947: </div>
948:
949: <p>This document is divided into two parts. The first,
950: <a href="#users-guide" title=
1.2 hubertf 951: "Part I. The pkgsrc user's guide">The pkgsrc
952: user's guide</a>, describes how one can use one of the
953: packages in the Package Collection, either by installing a
954: precompiled binary package, or by building one's own copy
955: using the NetBSD package system. The second part, <a href=
1.1 grant 956: "#developers-guide" title=
1.2 hubertf 957: "Part II. The pkgsrc developer's guide">The
958: pkgsrc developer's guide</a>, explains how to prepare a
959: package so it can be easily built by other NetBSD users
960: without knowing about the package's building details.</p>
1.1 grant 961:
962: <p>This document is available in various formats:</p>
963:
964: <div class="itemizedlist">
965: <ul type="disc">
966: <li>
967: <p><a href="index.html" target="_top">HTML</a></p>
968: </li>
969:
970: <li>
971: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
972: </li>
973:
974: <li>
975: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
976: </li>
977:
978: <li>
979: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
980: </li>
981: </ul>
982: </div>
983: </div>
984:
985: <div class="sect1" lang="en" xml:lang="en">
986: <div class="titlepage">
987: <div>
988: <div>
989: <h2 class="title" style="clear: both"><a name=
990: "terminology" id=
991: "terminology"></a>1.3. Terminology</h2>
992: </div>
993: </div>
994: </div>
995:
996: <p>There has been a lot of talk about “<span class=
997: "quote">ports</span>”, “<span class=
998: "quote">packages</span>”, etc. so far. Here is a
999: description of all the terminology used within this
1000: document.</p>
1001:
1002: <div class="variablelist">
1003: <dl>
1004: <dt><span class="term">Package</span></dt>
1005:
1006: <dd>
1007: <p>A set of files and building instructions that
1008: describe what's necessary to build a certain piece of
1009: software using pkgsrc. Packages are traditionally
1.14 xtraeme 1010: stored under <code class=
1011: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1012: </dd>
1013:
1014: <dt><span class="term">The NetBSD package
1015: system</span></dt>
1016:
1017: <dd>
1018: <p>This is the former name of “<span class=
1019: "quote">pkgsrc</span>”. It is part of the
1020: NetBSD operating system and can be bootstrap to run
1021: on non-NetBSD operating systems as well. It handles
1022: building (compiling), installing, and removing of
1023: packages.</p>
1024: </dd>
1025:
1026: <dt><span class="term">Distfile</span></dt>
1027:
1028: <dd>
1029: <p>This term describes the file or files that are
1030: provided by the author of the piece of software to
1031: distribute his work. All the changes necessary to
1032: build on NetBSD are reflected in the corresponding
1033: package. Usually the distfile is in the form of a
1034: compressed tar-archive, but other types are possible,
1.14 xtraeme 1035: too. Distfiles are usually stored below <code class=
1036: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1037: </dd>
1038:
1039: <dt><span class="term">Port</span></dt>
1040:
1041: <dd>
1042: <p>This is the term used by FreeBSD and OpenBSD
1043: people for what we call a package. In NetBSD
1044: terminology, “<span class=
1045: "quote">port</span>” refers to a different
1046: architecture.</p>
1047: </dd>
1048:
1049: <dt><span class="term">Precompiled/binary
1050: package</span></dt>
1051:
1052: <dd>
1053: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1054: distfile and stuffed together in a single
1055: <code class="filename">.tgz</code> file so it can be
1056: installed on machines of the same machine
1057: architecture without the need to recompile. Packages
1058: are usually generated in <code class=
1059: "filename">/usr/pkgsrc/packages</code>; there is also
1060: an archive on <a href=
1.1 grant 1061: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1062: "_top">ftp.NetBSD.org</a>.</p>
1063:
1064: <p>Sometimes, this is referred to by the term
1065: “<span class="quote">package</span>” too,
1066: especially in the context of precompiled
1067: packages.</p>
1068: </dd>
1069:
1070: <dt><span class="term">Program</span></dt>
1071:
1072: <dd>
1073: <p>The piece of software to be installed which will
1074: be constructed from all the files in the Distfile by
1075: the actions defined in the corresponding package.</p>
1076: </dd>
1077: </dl>
1078: </div>
1079: </div>
1080:
1081: <div class="sect1" lang="en" xml:lang="en">
1082: <div class="titlepage">
1083: <div>
1084: <div>
1085: <h2 class="title" style="clear: both"><a name=
1086: "typography" id=
1087: "typography"></a>1.4. Typography</h2>
1088: </div>
1089: </div>
1090: </div>
1091:
1092: <p>When giving examples for commands, shell prompts are
1093: used to show if the command should/can be issued as root,
1094: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1095: privileges are sufficient. We use a <code class=
1096: "prompt">#</code> for root's shell prompt, and a
1097: <code class="prompt">$</code> for users' shell prompt,
1098: assuming they use the C-shell or tcsh.</p>
1.1 grant 1099: </div>
1100: </div>
1101:
1102: <div class="part" lang="en" xml:lang="en">
1103: <div class="titlepage">
1104: <div>
1105: <div>
1106: <h1 class="title"><a name="users-guide" id=
1.2 hubertf 1107: "users-guide"></a>The pkgsrc user's guide</h1>
1.1 grant 1108: </div>
1109: </div>
1110: </div>
1111:
1112: <div class="toc">
1113: <p><b>Table of Contents</b></p>
1114:
1115: <dl>
1116: <dt><span class="chapter"><a href="#getting">2. Where to
1117: get pkgsrc</a></span></dt>
1118:
1119: <dd>
1120: <dl>
1.22 ! tv 1121: <dt><span class="sect1"><a href="#id2508576">2.1. As
1.1 grant 1122: tar file</a></span></dt>
1123:
1.22 ! tv 1124: <dt><span class="sect1"><a href="#id2508592">2.2. Via
1.1 grant 1125: SUP</a></span></dt>
1126:
1.22 ! tv 1127: <dt><span class="sect1"><a href="#id2508692">2.3. Via
1.1 grant 1128: CVS</a></span></dt>
1129: </dl>
1130: </dd>
1131:
1132: <dt><span class="chapter"><a href="#platforms">3. Using
1133: pkgsrc on systems other than NetBSD</a></span></dt>
1134:
1135: <dd>
1136: <dl>
1.22 ! tv 1137: <dt><span class="sect1"><a href="#id2508802">3.1.
1.1 grant 1138: Bootstrapping pkgsrc</a></span></dt>
1139:
1.22 ! tv 1140: <dt><span class="sect1"><a href="#id2508915">3.2.
1.1 grant 1141: Platform specific notes</a></span></dt>
1142:
1143: <dd>
1144: <dl>
1145: <dt><span class="sect2"><a href=
1.22 ! tv 1146: "#id2508921">3.2.1. Darwin (Mac OS
1.1 grant 1147: X)</a></span></dt>
1148:
1149: <dt><span class="sect2"><a href=
1.22 ! tv 1150: "#id2509220">3.2.2. FreeBSD</a></span></dt>
! 1151:
! 1152: <dt><span class="sect2"><a href=
! 1153: "#id2509390">3.2.3. Interix</a></span></dt>
1.1 grant 1154:
1155: <dt><span class="sect2"><a href=
1.22 ! tv 1156: "#id2509966">3.2.4. IRIX</a></span></dt>
1.1 grant 1157:
1158: <dt><span class="sect2"><a href=
1.22 ! tv 1159: "#id2510187">3.2.5. Linux</a></span></dt>
1.1 grant 1160:
1161: <dt><span class="sect2"><a href=
1.22 ! tv 1162: "#id2510248">3.2.6. OpenBSD</a></span></dt>
1.1 grant 1163:
1164: <dt><span class="sect2"><a href=
1.22 ! tv 1165: "#id2510360">3.2.7. Solaris</a></span></dt>
1.1 grant 1166: </dl>
1167: </dd>
1168: </dl>
1169: </dd>
1170:
1171: <dt><span class="chapter"><a href="#using">4. Using
1172: pkgsrc</a></span></dt>
1173:
1174: <dd>
1175: <dl>
1176: <dt><span class="sect1"><a href=
1177: "#getting-started">4.1. Working with binary
1178: packages</a></span></dt>
1179:
1180: <dd>
1181: <dl>
1182: <dt><span class="sect2"><a href=
1.22 ! tv 1183: "#id2510565">4.1.1. Where to get binary
1.1 grant 1184: packages</a></span></dt>
1185:
1186: <dt><span class="sect2"><a href=
1.22 ! tv 1187: "#id2510605">4.1.2. How to use binary
1.1 grant 1188: packages</a></span></dt>
1189:
1190: <dt><span class="sect2"><a href=
1.22 ! tv 1191: "#id2510672">4.1.3. A word of
1.1 grant 1192: warning</a></span></dt>
1193: </dl>
1194: </dd>
1195:
1.22 ! tv 1196: <dt><span class="sect1"><a href="#id2510683">4.2.
1.1 grant 1197: Building packages from source</a></span></dt>
1198:
1199: <dd>
1200: <dl>
1201: <dt><span class="sect2"><a href=
1.22 ! tv 1202: "#id2510693">4.2.1. Requirements</a></span></dt>
1.1 grant 1203:
1204: <dt><span class="sect2"><a href=
1.22 ! tv 1205: "#id2510781">4.2.2. Fetching
1.1 grant 1206: distfiles</a></span></dt>
1207:
1208: <dt><span class="sect2"><a href=
1.22 ! tv 1209: "#id2510834">4.2.3. How to build and
1.1 grant 1210: install</a></span></dt>
1211:
1212: <dt><span class="sect2"><a href=
1.22 ! tv 1213: "#id2511091">4.2.4. Selecting the
1.1 grant 1214: compiler</a></span></dt>
1215: </dl>
1216: </dd>
1217: </dl>
1218: </dd>
1219:
1220: <dt><span class="chapter"><a href="#binary">5. Creating
1221: binary packages</a></span></dt>
1222:
1223: <dd>
1224: <dl>
1.22 ! tv 1225: <dt><span class="sect1"><a href="#id2512065">5.1.
1.1 grant 1226: Building a single binary package</a></span></dt>
1227:
1.22 ! tv 1228: <dt><span class="sect1"><a href="#id2512142">5.2.
1.1 grant 1229: Settings for creation of binary
1230: packages</a></span></dt>
1231:
1232: <dt><span class="sect1"><a href="#bulkbuild">5.3.
1233: Doing a bulk build of all packages</a></span></dt>
1234:
1235: <dd>
1236: <dl>
1237: <dt><span class="sect2"><a href=
1238: "#binary.configuration">5.3.1.
1239: Configuration</a></span></dt>
1240:
1241: <dt><span class="sect2"><a href=
1.22 ! tv 1242: "#id2577136">5.3.2. Other environmental
1.1 grant 1243: considerations</a></span></dt>
1244:
1245: <dt><span class="sect2"><a href=
1.22 ! tv 1246: "#id2577176">5.3.3. Operation</a></span></dt>
1.1 grant 1247:
1248: <dt><span class="sect2"><a href=
1.22 ! tv 1249: "#id2577245">5.3.4. What it does</a></span></dt>
1.1 grant 1250:
1251: <dt><span class="sect2"><a href=
1.22 ! tv 1252: "#id2577302">5.3.5. Disk space
1.1 grant 1253: requirements</a></span></dt>
1254:
1255: <dt><span class="sect2"><a href=
1.22 ! tv 1256: "#id2577329">5.3.6. Setting up a sandbox for
1.1 grant 1257: chroot'ed builds</a></span></dt>
1258:
1259: <dt><span class="sect2"><a href=
1.22 ! tv 1260: "#id2577858">5.3.7. Building a partial set of
1.1 grant 1261: packages</a></span></dt>
1.13 hubertf 1262:
1263: <dt><span class="sect2"><a href=
1264: "#bulk-upload">5.3.8. Uploading results of a bulk
1265: build</a></span></dt>
1.1 grant 1266: </dl>
1267: </dd>
1268:
1.22 ! tv 1269: <dt><span class="sect1"><a href="#id2578363">5.4.
1.1 grant 1270: Creating a multiple CD-ROM packages
1271: collection</a></span></dt>
1272:
1273: <dd>
1274: <dl>
1275: <dt><span class="sect2"><a href=
1.22 ! tv 1276: "#id2578378">5.4.1. Example of
1.1 grant 1277: cdpack</a></span></dt>
1278: </dl>
1279: </dd>
1280: </dl>
1281: </dd>
1282:
1283: <dt><span class="chapter"><a href="#faq">6. Frequently
1284: Asked Questions</a></span></dt>
1285:
1286: <dd>
1287: <dl>
1.22 ! tv 1288: <dt><span class="sect1"><a href="#id2578570">6.1. Are
1.18 xtraeme 1289: there any mailing lists for pkg-related
1.1 grant 1290: discussion?</a></span></dt>
1291:
1.22 ! tv 1292: <dt><span class="sect1"><a href="#id2578636">6.2.
1.1 grant 1293: Where's the pkgviews documentation?</a></span></dt>
1294:
1.5 hubertf 1295: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 1296: Utilities for package management
1297: (pkgtools)</a></span></dt>
1298:
1.22 ! tv 1299: <dt><span class="sect1"><a href="#id2578821">6.4. How
1.1 grant 1300: to use pkgsrc as non-root</a></span></dt>
1301:
1.22 ! tv 1302: <dt><span class="sect1"><a href="#id2578833">6.5. How
1.15 xtraeme 1303: to resume transfers when fetching
1304: distfiles?</a></span></dt>
1.14 xtraeme 1305:
1.22 ! tv 1306: <dt><span class="sect1"><a href="#id2578944">6.6. How
1.1 grant 1307: can I install/use XFree86 from
1308: pkgsrc?</a></span></dt>
1309:
1.22 ! tv 1310: <dt><span class="sect1"><a href="#id2578971">6.7. How
1.1 grant 1311: can I install/use X.org from pkgsrc?</a></span></dt>
1312:
1.22 ! tv 1313: <dt><span class="sect1"><a href="#id2578999">6.8. How
1.1 grant 1314: to fetch files from behind a firewall</a></span></dt>
1315:
1.22 ! tv 1316: <dt><span class="sect1"><a href="#id2579013">6.9. How
1.14 xtraeme 1317: do I tell <span><strong class="command">make
1318: fetch</strong></span> to do passive
1.1 grant 1319: FTP?</a></span></dt>
1320:
1.22 ! tv 1321: <dt><span class="sect1"><a href="#id2579064">6.10.
1.14 xtraeme 1322: How to fetch all distfiles at once</a></span></dt>
1.1 grant 1323:
1.22 ! tv 1324: <dt><span class="sect1"><a href="#id2579204">6.11.
1.14 xtraeme 1325: What does “<span class="quote">Don't know how
1326: to make /usr/share/tmac/tmac.andoc</span>”
1327: mean?</a></span></dt>
1.13 hubertf 1328:
1.22 ! tv 1329: <dt><span class="sect1"><a href="#id2579242">6.12.
1.14 xtraeme 1330: What does “<span class="quote">Could not find
1331: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1332:
1.22 ! tv 1333: <dt><span class="sect1"><a href="#id2579300">6.13.
1.1 grant 1334: Using 'sudo' with pkgsrc</a></span></dt>
1335:
1.14 xtraeme 1336: <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1 grant 1337: Configuration files handling and
1338: placement</a></span></dt>
1339:
1340: <dt><span class="sect1"><a href=
1.14 xtraeme 1341: "#audit-packages">6.15. Automated security
1.1 grant 1342: checks</a></span></dt>
1343: </dl>
1344: </dd>
1345: </dl>
1346: </div>
1347:
1348: <div class="chapter" lang="en" xml:lang="en">
1349: <div class="titlepage">
1350: <div>
1351: <div>
1352: <h2 class="title"><a name="getting" id=
1353: "getting"></a>Chapter 2. Where to get
1354: pkgsrc</h2>
1355: </div>
1356: </div>
1357: </div>
1358:
1359: <div class="toc">
1360: <p><b>Table of Contents</b></p>
1361:
1362: <dl>
1.22 ! tv 1363: <dt><span class="sect1"><a href="#id2508576">2.1. As
1.1 grant 1364: tar file</a></span></dt>
1365:
1.22 ! tv 1366: <dt><span class="sect1"><a href="#id2508592">2.2. Via
1.1 grant 1367: SUP</a></span></dt>
1368:
1.22 ! tv 1369: <dt><span class="sect1"><a href="#id2508692">2.3. Via
1.1 grant 1370: CVS</a></span></dt>
1371: </dl>
1372: </div>
1373:
1374: <p>There are three ways to get pkgsrc. Either as a tar
1375: file, via SUP, or via CVS. All three ways are described
1376: here.</p>
1377:
1378: <div class="sect1" lang="en" xml:lang="en">
1379: <div class="titlepage">
1380: <div>
1381: <div>
1382: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 1383: "id2508576" id="id2508576"></a>2.1. As tar
1.1 grant 1384: file</h2>
1385: </div>
1386: </div>
1387: </div>
1388:
1389: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1390: file from <a href=
1.11 ben 1391: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1392: target="_top">ftp.NetBSD.org</a> and unpack it into
1393: <code class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1394: </div>
1395:
1396: <div class="sect1" lang="en" xml:lang="en">
1397: <div class="titlepage">
1398: <div>
1399: <div>
1400: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 1401: "id2508592" id="id2508592"></a>2.2. Via
1.1 grant 1402: SUP</h2>
1403: </div>
1404: </div>
1405: </div>
1406:
1407: <p>As an alternative to the tar file, you can get pkgsrc
1408: via the Software Update Protocol, SUP. To do so, make
1409: sure your supfile has a line</p>
1410: <pre class="programlisting">
1411: release=pkgsrc
1412: </pre>
1413:
1.14 xtraeme 1414: <p>in it, see the examples in <code class=
1415: "filename">/usr/share/examples/supfiles</code>, and that
1416: the <code class="filename">/usr/pkgsrc</code> directory
1417: exists. Then, simply run <span><strong class=
1418: "command">sup -v <em class=
1419: "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1420: </div>
1421:
1422: <div class="sect1" lang="en" xml:lang="en">
1423: <div class="titlepage">
1424: <div>
1425: <div>
1426: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 1427: "id2508692" id="id2508692"></a>2.3. Via
1.1 grant 1428: CVS</h2>
1429: </div>
1430: </div>
1431: </div>
1432:
1433: <p>To get pkgsrc via CVS, make sure you have
1434: “<span class="quote">cvs</span>” installed.
1435: If not present on your system, it can be found as
1436: precompiled binary on ftp.NetBSD.org. To do an initial
1437: (full) checkout of pkgsrc, do the following steps:</p>
1438: <pre class="screen">
1.14 xtraeme 1439: <code class="prompt">%</code> <strong class=
1440: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1441: <code class="prompt">%</code> <strong class=
1442: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1443: <code class="prompt">%</code> <strong class=
1444: "userinput"><code>cd /usr</code></strong>
1445: <code class="prompt">%</code> <strong class=
1446: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1447: </pre>
1448:
1449: <p>This will create the <code class=
1450: "filename">pkgsrc</code> directory in your <code class=
1451: "filename">/usr</code>, and all the package source will
1452: be stored under <code class=
1453: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1454: initial checkout, make sure you have <code class=
1455: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1456: <pre class="screen">
1.14 xtraeme 1457: <code class="prompt">%</code> <strong class=
1458: "userinput"><code>cd /usr/pkgsrc</code></strong>
1459: <code class="prompt">%</code> <strong class=
1460: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1461: </pre>
1462:
1463: <p>Please also note that it is possible to have multiple
1464: copies of the pkgsrc hierarchy in use at any one time -
1465: all work is done relatively within the pkgsrc tree.</p>
1466: </div>
1467: </div>
1468:
1469: <div class="chapter" lang="en" xml:lang="en">
1470: <div class="titlepage">
1471: <div>
1472: <div>
1473: <h2 class="title"><a name="platforms" id=
1474: "platforms"></a>Chapter 3. Using pkgsrc on
1475: systems other than NetBSD</h2>
1476: </div>
1477: </div>
1478: </div>
1479:
1480: <div class="toc">
1481: <p><b>Table of Contents</b></p>
1482:
1483: <dl>
1.22 ! tv 1484: <dt><span class="sect1"><a href="#id2508802">3.1.
1.1 grant 1485: Bootstrapping pkgsrc</a></span></dt>
1486:
1.22 ! tv 1487: <dt><span class="sect1"><a href="#id2508915">3.2.
1.1 grant 1488: Platform specific notes</a></span></dt>
1489:
1490: <dd>
1491: <dl>
1.22 ! tv 1492: <dt><span class="sect2"><a href="#id2508921">3.2.1.
1.1 grant 1493: Darwin (Mac OS X)</a></span></dt>
1494:
1.22 ! tv 1495: <dt><span class="sect2"><a href="#id2509220">3.2.2.
1.1 grant 1496: FreeBSD</a></span></dt>
1497:
1.22 ! tv 1498: <dt><span class="sect2"><a href="#id2509390">3.2.3.
1.1 grant 1499: Interix</a></span></dt>
1500:
1.22 ! tv 1501: <dt><span class="sect2"><a href="#id2509966">3.2.4.
1.1 grant 1502: IRIX</a></span></dt>
1503:
1.22 ! tv 1504: <dt><span class="sect2"><a href="#id2510187">3.2.5.
! 1505: Linux</a></span></dt>
! 1506:
! 1507: <dt><span class="sect2"><a href="#id2510248">3.2.6.
1.1 grant 1508: OpenBSD</a></span></dt>
1509:
1.22 ! tv 1510: <dt><span class="sect2"><a href="#id2510360">3.2.7.
1.1 grant 1511: Solaris</a></span></dt>
1512: </dl>
1513: </dd>
1514: </dl>
1515: </div>
1516:
1517: <div class="sect1" lang="en" xml:lang="en">
1518: <div class="titlepage">
1519: <div>
1520: <div>
1521: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 1522: "id2508802" id=
! 1523: "id2508802"></a>3.1. Bootstrapping pkgsrc</h2>
1.1 grant 1524: </div>
1525: </div>
1526: </div>
1527:
1528: <p>For Operating Systems other than NetBSD, we provide a
1529: bootstrap kit to build the required tools to use pkgsrc
1530: on your platform. Besides support for native NetBSD,
1531: pkgsrc and the bootstrap kit have support for the
1532: following operating systems:</p>
1533:
1534: <div class="itemizedlist">
1535: <ul type="disc">
1536: <li>
1537: <p>Darwin (Mac OS X)</p>
1538: </li>
1539:
1540: <li>
1.16 grant 1541: <p>DragonFlyBSD</p>
1542: </li>
1543:
1544: <li>
1.1 grant 1545: <p>FreeBSD</p>
1546: </li>
1547:
1548: <li>
1549: <p>Interix (Windows 2000, XP, 2003)</p>
1550: </li>
1551:
1552: <li>
1553: <p>IRIX</p>
1554: </li>
1555:
1556: <li>
1557: <p>Linux</p>
1558: </li>
1559:
1560: <li>
1561: <p>OpenBSD</p>
1562: </li>
1563:
1564: <li>
1565: <p>Solaris</p>
1566: </li>
1.16 grant 1567:
1568: <li>
1569: <p>Tru64 (Digital UNIX/OSF1)</p>
1570: </li>
1.1 grant 1571: </ul>
1572: </div>
1573:
1574: <p>Support for other platforms is under development.</p>
1575:
1576: <p>Installing the bootstrap kit should be as simple
1577: as:</p>
1578: <pre class="screen">
1.14 xtraeme 1579: <code class="prompt">#</code> <strong class=
1580: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1581: <code class="prompt">#</code> <strong class=
1582: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1583: <code class="prompt">#</code> <strong class=
1584: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1585: </pre>
1586:
1587: <p>See <a href="#getting" title=
1588: "Chapter 2. Where to get pkgsrc">Chapter 2,
1589: <i>Where to get pkgsrc</i></a> for other ways to get
1.14 xtraeme 1590: pkgsrc before bootstrapping. The given
1591: <span><strong class="command">bootstrap</strong></span>
1592: command will use the defaults of <code class=
1593: "filename">/usr/pkg</code> for the <span class=
1594: "emphasis"><em>prefix</em></span> where programs will be
1595: installed in, and <code class=
1596: "filename">/var/db/pkg</code> for the package database
1.1 grant 1597: directory where pkgsrc will do it's internal bookkeeping.
1598: However, these can also be set using command-line
1599: parameters.</p>
1600:
1601: <p>Binary packages for the pkgsrc tools and an initial
1602: set of packages is available for supported platforms. An
1603: up-to-date list of these can be found on <a href=
1604: "http://www.pkgsrc.org/" target=
1605: "_top">www.pkgsrc.org</a>.</p>
1606: </div>
1607:
1608: <div class="sect1" lang="en" xml:lang="en">
1609: <div class="titlepage">
1610: <div>
1611: <div>
1612: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 1613: "id2508915" id="id2508915"></a>3.2. Platform
1.1 grant 1614: specific notes</h2>
1615: </div>
1616: </div>
1617: </div>
1618:
1619: <p>Here are some platform-specific notes you should be
1620: aware of.</p>
1621:
1622: <div class="sect2" lang="en" xml:lang="en">
1623: <div class="titlepage">
1624: <div>
1625: <div>
1.22 ! tv 1626: <h3 class="title"><a name="id2508921" id=
! 1627: "id2508921"></a>3.2.1. Darwin (Mac OS
1.1 grant 1628: X)</h3>
1629: </div>
1630: </div>
1631: </div>
1632:
1633: <p>Darwin 5.x and 6.x are supported. There are two
1634: methods of using pkgsrc on Mac OS X, by using a
1635: <a href="#platform.osx-image" title=
1636: "3.2.1.1. Using a disk image">disk image</a>, or a
1637: <a href="#platform.osx-ufs" title=
1638: "3.2.1.2. Using a UFS partition">UFS
1639: partition</a>.</p>
1640:
1641: <p>Before you start, you will need to download and
1642: install the Mac OS X Developer Tools from Apple's
1643: Developer Connection. See <a href=
1644: "http://developer.apple.com/macosx/" target=
1645: "_top">http://developer.apple.com/macosx/</a> for
1646: details. Also, make sure you install X11 for Mac OS X
1647: and the X11 SDK from <a href=
1648: "http://www.apple.com/macosx/x11/download/" target=
1649: "_top">http://www.apple.com/macosx/x11/download/</a> if
1650: you intend to build packages that use the X11 Window
1651: System.</p>
1652:
1653: <p>If you already have a UFS partition, or have a spare
1654: partition that you can format as UFS, it is recommended
1655: to use that instead of the disk image. It'll be
1656: somewhat faster and will mount automatically at boot
1657: time, where you must manually mount a disk image.</p>
1658:
1659: <div class="note" style=
1660: "margin-left: 0.5in; margin-right: 0.5in;">
1661: <h3 class="title">Note</h3>
1662:
1663: <p>You cannot use a HFS+ file system for pkgsrc,
1664: because pkgsrc currently requires the filesystem to
1665: be case-sensitive, and HFS+ is not.</p>
1666: </div>
1667:
1668: <div class="sect3" lang="en" xml:lang="en">
1669: <div class="titlepage">
1670: <div>
1671: <div>
1672: <h4 class="title"><a name="platform.osx-image"
1673: id="platform.osx-image"></a>3.2.1.1. Using
1674: a disk image</h4>
1675: </div>
1676: </div>
1677: </div>
1678:
1679: <p>Create the disk image:</p>
1680: <pre class="screen">
1.14 xtraeme 1681: <code class="prompt">#</code> <strong class=
1682: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1683: <code class="prompt">#</code> <strong class=
1684: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
1685: <code class="prompt">#</code> <strong class=
1686: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
1687: <code class="prompt">#</code> <strong class=
1688: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 1689: </pre>
1690:
1691: <p>That's it!</p>
1692: </div>
1693:
1694: <div class="sect3" lang="en" xml:lang="en">
1695: <div class="titlepage">
1696: <div>
1697: <div>
1698: <h4 class="title"><a name="platform.osx-ufs"
1699: id="platform.osx-ufs"></a>3.2.1.2. Using a
1700: UFS partition</h4>
1701: </div>
1702: </div>
1703: </div>
1704:
1.14 xtraeme 1705: <p>By default, <code class="filename">/usr</code>
1706: will be on your root file system, normally HFS+. It
1707: is possible to use the default <span class=
1708: "emphasis"><em>prefix</em></span> of <code class=
1709: "filename">/usr/pkg</code> by symlinking <code class=
1710: "filename">/usr/pkg</code> to a directory on a UFS
1711: file system. Obviously, another symlink is required
1712: if you want to place the package database directory
1713: outside the <span class=
1714: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 1715: <pre class="screen">
1.14 xtraeme 1716: <code class="prompt">#</code> <strong class=
1.22 ! tv 1717: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1 grant 1718: </pre>
1719:
1720: <p>If you created your partitions at the time of
1721: installing Mac OS X and formatted the target
1722: partition as UFS, it should automatically mount on
1.14 xtraeme 1723: <code class="filename">/Volumes/<volume
1724: name></code> when the machine boots. If you are
1.1 grant 1725: (re)formatting a partition as UFS, you need to ensure
1726: that the partition map correctly reflects
1727: “<span class="quote">Apple_UFS</span>”
1728: and not “<span class=
1729: "quote">Apple_HFS</span>”.</p>
1730:
1731: <p>The problem is that none of the disk tools will
1732: let you touch a disk that is booted from. You can
1733: unmount the partition, but even if you newfs it, the
1734: partition type will be incorrect and the automounter
1735: won't mount it. It can be mounted manually, but it
1736: won't appear in Finder.</p>
1737:
1738: <p>You'll need to boot off of the OS X Installation
1739: (User) CD. When the Installation program starts, go
1740: up to the menu and select Disk Utility. Now, you will
1741: be able to select the partition you want to be UFS,
1742: and Format it Apple UFS. Quit the Disk Utility, quit
1743: the installer which will reboot your machine. The new
1744: UFS file system will appear in Finder.</p>
1745:
1746: <p>Be aware that the permissions on the new file
1747: system will be writable by root only.</p>
1748:
1749: <p>This note is as of 10.2 (Jaguar) and applies to
1750: earlier versions. Hopefully Apple will fix Disk
1751: Utility in 10.3 (Panther).</p>
1752: </div>
1753: </div>
1754:
1755: <div class="sect2" lang="en" xml:lang="en">
1756: <div class="titlepage">
1757: <div>
1758: <div>
1.22 ! tv 1759: <h3 class="title"><a name="id2509220" id=
! 1760: "id2509220"></a>3.2.2. FreeBSD</h3>
1.1 grant 1761: </div>
1762: </div>
1763: </div>
1764:
1765: <p>FreeBSD 4.7 and 5.0 have been tested and are
1766: supported, other versions may work.</p>
1767:
1768: <p>Care should be taken so that the tools that this kit
1769: installs do not conflict with the FreeBSD userland
1770: tools. There are several steps:</p>
1771:
1772: <div class="orderedlist">
1773: <ol type="1">
1774: <li>
1775: <p>FreeBSD stores its ports pkg database in
1.14 xtraeme 1776: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 1777: therefore recommended that you choose a different
1.14 xtraeme 1778: location (e.g. <code class=
1779: "filename">/usr/pkgdb</code>) by using the
1.1 grant 1780: --pkgdbdir option to the bootstrap script.</p>
1781: </li>
1782:
1783: <li>
1784: <p>If you do not intend to use the FreeBSD ports
1785: tools, it's probably a good idea to move them out
1786: of the way to avoid confusion, e.g.</p>
1787: <pre class="screen">
1.14 xtraeme 1788: <code class="prompt">#</code> <strong class=
1789: "userinput"><code>cd /usr/sbin</code></strong>
1790: <code class="prompt">#</code> <strong class=
1791: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
1792: <code class="prompt">#</code> <strong class=
1793: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
1794: <code class="prompt">#</code> <strong class=
1795: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
1796: <code class="prompt">#</code> <strong class=
1797: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 1798: </pre>
1799: </li>
1800:
1801: <li>
1.14 xtraeme 1802: <p>An example <code class=
1803: "filename">/etc/mk.conf</code> file will be
1804: placed in <code class=
1805: "filename">/etc/mk.conf.example</code> file when
1806: you use the bootstrap script.</p>
1.1 grant 1807: </li>
1808: </ol>
1809: </div>
1810: </div>
1811:
1812: <div class="sect2" lang="en" xml:lang="en">
1813: <div class="titlepage">
1814: <div>
1815: <div>
1.22 ! tv 1816: <h3 class="title"><a name="id2509390" id=
! 1817: "id2509390"></a>3.2.3. Interix</h3>
1.1 grant 1818: </div>
1819: </div>
1820: </div>
1821:
1822: <p>Interix is a POSIX compatible subsystem for the
1823: Windows NT kernel, providing a Unix-like environment
1824: with a tighter kernel integration than available with
1825: Cygwin. It is part of the Windows Services for Unix
1826: package, available for free for any licensed copy of
1.22 ! tv 1827: Windows 2000, XP (not including XP Home), or 2003. SFU
! 1828: can be downloaded from <a href=
! 1829: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 1830: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
1831:
1832: <p>Services for Unix 3.5, current as of this writing,
1833: has been tested. 3.0 or 3.1 may work, but are not
1834: officially supported. (The main difference in 3.0/3.1
1835: is lack of pthreads.)</p>
1836:
1837: <div class="sect3" lang="en" xml:lang="en">
1838: <div class="titlepage">
1839: <div>
1840: <div>
1841: <h4 class="title"><a name=
1842: "platform.interix-sfu-install" id=
1843: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 1844: installing Interix/SFU</h4>
1.1 grant 1845: </div>
1846: </div>
1847: </div>
1848:
1849: <p>At an absolute minimum, the following packages
1850: must be installed from the Windows Services for Unix
1851: 3.5 distribution in order to use pkgsrc:</p>
1852:
1853: <div class="itemizedlist">
1854: <ul type="disc">
1855: <li>
1856: <p>Utilities -> Base Utilities</p>
1857: </li>
1858:
1859: <li>
1860: <p>Interix GNU Components -> (all)</p>
1861: </li>
1862:
1863: <li>
1864: <p>Remote Connectivity</p>
1865: </li>
1866:
1867: <li>
1868: <p>Interix SDK</p>
1869: </li>
1870: </ul>
1871: </div>
1872:
1873: <p>When using pkgsrc on Interix, DO NOT install the
1874: Utilities subcomponent "UNIX Perl". That is Perl 5.6
1875: without shared module support, installed to
1876: /usr/local, and will only cause confusion. Instead,
1877: install Perl 5.8 from pkgsrc (or from a binary
1878: package).</p>
1879:
1880: <p>The Remote Connectivity subcomponent "Windows
1881: Remote Shell Service" does not need to be installed,
1882: but Remote Connectivity itself should be installed in
1883: order to have a working inetd.</p>
1884:
1885: <p>Finally, during installation you may be asked
1886: whether to enable setuid behavior for Interix
1887: programs, and whether to make pathnames default to
1888: case-sensitive. Setuid should be enabled, and
1889: case-sensitivity MUST be enabled. (Without
1890: case-sensitivity, a large number of packages
1891: including perl will not build.)</p>
1892: </div>
1893:
1894: <div class="sect3" lang="en" xml:lang="en">
1895: <div class="titlepage">
1896: <div>
1897: <div>
1898: <h4 class="title"><a name=
1899: "platform.interix-sfu-postinstall" id=
1900: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
1901: to do if Interix/SFU is already installed</h4>
1902: </div>
1903: </div>
1904: </div>
1905:
1906: <p>If SFU is already installed and you wish to alter
1907: these settings to work with pkgsrc, note the
1908: following things.</p>
1909:
1910: <div class="itemizedlist">
1911: <ul type="disc">
1912: <li>
1913: <p>To uninstall UNIX Perl, use Add/Remove
1914: Programs, select Microsoft Windows Services for
1915: UNIX, then click Change. In the installer,
1916: choose Add or Remove, then uncheck
1917: Utilities->UNIX Perl.</p>
1918: </li>
1919:
1920: <li>
1921: <p>To enable case-sensitivity for the
1922: filesystem, run REGEDIT.EXE, and change the
1923: following registry key:</p>
1924:
1925: <p>
1926: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
1927: Manager\kernel</p>
1928:
1929: <p>Set the DWORD value "obcaseinsensitive" to
1930: 0; then reboot.</p>
1931: </li>
1932:
1933: <li>
1934: <p>To enable setuid binaries (optional), run
1935: REGEDIT.EXE, and change the following registry
1936: key:</p>
1937:
1938: <p>
1939: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
1940: for UNIX</p>
1941:
1942: <p>Set the DWORD value "EnableSetuidBinaries"
1943: to 1; then reboot.</p>
1944: </li>
1945: </ul>
1946: </div>
1947: </div>
1948:
1949: <div class="sect3" lang="en" xml:lang="en">
1950: <div class="titlepage">
1951: <div>
1952: <div>
1953: <h4 class="title"><a name=
1954: "platform.interix-notes" id=
1955: "platform.interix-notes"></a>3.2.3.3. Important
1956: notes for using pkgsrc</h4>
1957: </div>
1958: </div>
1959: </div>
1960:
1961: <p>The package imanager (either the pkgsrc "su" user,
1962: or the user running "pkg_add") must be a member of
1963: the local Administrators group. Such a user must also
1964: be used to run the bootstrap. This is slightly
1965: relaxed from the normal pkgsrc requirement of
1966: "root".</p>
1967:
1968: <p>The package manager should use a umask of 002.
1969: "make install" will automatically complain if this is
1970: not the case. This ensures that directories written
1971: in /var/db/pkg are Administrators-group
1972: writeable.</p>
1973:
1974: <p>The popular Interix binary packages from
1975: http://www.interopsystems.com/ use an older version
1976: of pkgsrc's pkg_* tools. Ideally, these should NOT be
1977: used in conjunction with pkgsrc. If you choose to use
1978: them at the same time as the pkgsrc packages, ensure
1979: that you use the proper pkg_* tools for each type of
1980: binary package.</p>
1.22 ! tv 1981:
! 1982: <p>The TERM setting used for DOS-type console windows
! 1983: (including those invoked by the csh and ksh startup
! 1984: shortcuts) is "interix". Most systems don't have a
! 1985: termcap/terminfo entry for it, but the following
! 1986: .termcap entry provides adequate emulation in most
! 1987: cases:</p>
! 1988: <pre class="programlisting">
! 1989: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
! 1990: </pre>
1.1 grant 1991: </div>
1992: </div>
1993:
1994: <div class="sect2" lang="en" xml:lang="en">
1995: <div class="titlepage">
1996: <div>
1997: <div>
1.22 ! tv 1998: <h3 class="title"><a name="id2509966" id=
! 1999: "id2509966"></a>3.2.4. IRIX</h3>
1.1 grant 2000: </div>
2001: </div>
2002: </div>
2003:
2004: <p>You will need a working C compiler, either gcc or
2005: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2006: the <code class="varname">CC</code> environment
2007: variable according to your preference. If you do not
2008: have a license for the MIPSpro compiler suite, you can
1.1 grant 2009: download a gcc tardist file from <a href=
2010: "http://freeware.sgi.com/" target=
2011: "_top">http://freeware.sgi.com/</a>.</p>
2012:
2013: <p>Please note that you will need IRIX 6.5.17 or
2014: higher, as this is the earliest version of IRIX
2015: providing support for if_indextoname(3),
2016: if_nametoindex(3), etc.</p>
2017:
2018: <p>At this point in time, pkgsrc only supports one ABI.
2019: That is, you can not switch between the old 32-bit ABI,
2020: the new 32-bit ABI and the 64-bit ABI. If you start out
2021: using "abi=n32", that's what all your packages will be
2022: built with.</p>
2023:
2024: <p>Therefore, please make sure that you have no
1.14 xtraeme 2025: conflicting <code class="varname">CFLAGS</code> in your
2026: environment or the <code class=
2027: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2028: that you do not try to link n32 object files with lib64
1.14 xtraeme 2029: or vice versa. Check your <code class=
2030: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2031:
2032: <p>If you have the actual pkgsrc tree mounted via NFS
2033: from a different host, please make sure to set
1.14 xtraeme 2034: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2035: directory, as it appears that IRIX linker occasionally
2036: runs into issues when trying to link over a network
2037: mounted filesystem.</p>
2038:
2039: <p>The bootstrapping process should set all the right
2040: options for programs such as imake(1), but you may want
2041: to set some options depending on your local setup.
1.14 xtraeme 2042: Please see <code class=
2043: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.1 grant 2044: course, your compilers man pages for details.</p>
1.22 ! tv 2045:
! 2046: <p>If you are using SGI's MIPSPro compiler, please
! 2047: set</p>
! 2048: <pre class="programlisting">
! 2049: PKGSRC_COMPILER=mipspro
! 2050: </pre>
! 2051:
! 2052: <p>in <code class="filename">/etc/mk.conf</code>.
! 2053: Otherwise, pkgsrc will assume you are using gcc and may
! 2054: end up passing invalid flags to the compiler. Note that
! 2055: bootstrap should create an appropriate <code class=
! 2056: "filename">mk.conf.example</code> by default.</p>
! 2057:
! 2058: <p>If you have both the MIPSPro compiler chain
! 2059: installed as well as gcc, but want to make sure that
! 2060: MIPRPro is used, please set your <code class=
! 2061: "varname">PATH</code> to <span class=
! 2062: "emphasis"><em>not</em></span> include the location of
! 2063: gcc (often <code class=
! 2064: "filename">/usr/freeware/bin</code>), and (important)
! 2065: pass the '--preserve-path' flag.</p>
1.1 grant 2066: </div>
2067:
2068: <div class="sect2" lang="en" xml:lang="en">
2069: <div class="titlepage">
2070: <div>
2071: <div>
1.22 ! tv 2072: <h3 class="title"><a name="id2510187" id=
! 2073: "id2510187"></a>3.2.5. Linux</h3>
! 2074: </div>
! 2075: </div>
! 2076: </div>
! 2077:
! 2078: <p>Some versions of Linux (for example Debian
! 2079: GNU/Linux) need either libtermcap or libcurses
! 2080: (libncurses). Installing the distributions
! 2081: libncurses-dev package (or equivalent) should fix the
! 2082: problem.</p>
! 2083:
! 2084: <p>pkgsrc supports both gcc (GNU Compiler Collection)
! 2085: and icc (Intel C++ Compiler). gcc is the default. icc
! 2086: 8.0 and 8.1 on i386 have been tested.</p>
! 2087:
! 2088: <p>To bootstrap using icc, assuming the default icc
! 2089: installation directory:</p>
! 2090: <pre class="programlisting">
! 2091: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
! 2092: ac_cv___attribute__=yes ./bootstrap
! 2093: </pre>
! 2094:
! 2095: <div class="note" style=
! 2096: "margin-left: 0.5in; margin-right: 0.5in;">
! 2097: <h3 class="title">Note</h3>
! 2098:
! 2099: <p>icc 8.1 needs the `-i-static' argument instead of
! 2100: -static-libcxa.</p>
! 2101: </div>
! 2102:
! 2103: <p>icc supports __attribute__, but the GNU configure
! 2104: test uses a nested function, which icc does not
! 2105: support. #undef'ing __attribute__ has the unfortunate
! 2106: side-effect of breaking many of the Linux header files,
! 2107: which cannot be compiled properly without
! 2108: __attribute__. The test must be overridden so that
! 2109: __attribute__ is assumed supported by the compiler.</p>
! 2110:
! 2111: <p>After bootstrapping, you should set <code class=
! 2112: "varname">PKGSRC_COMPILER</code> in <code class=
! 2113: "filename">/etc/mk.conf</code>:</p>
! 2114: <pre class="programlisting">
! 2115: PKGSRC_COMPILER=icc
! 2116: </pre>
! 2117:
! 2118: <p>The default installation directory for icc is
! 2119: <code class="filename">/opt/intel_cc_80</code>, which
! 2120: is also the pkgsrc default. If you have installed it
! 2121: into a different directory, set <code class=
! 2122: "varname">ICCBASE</code> in <code class=
! 2123: "filename">/etc/mk.conf</code>:</p>
! 2124: <pre class="programlisting">
! 2125: ICCBASE=/opt/icc
! 2126: </pre>
! 2127:
! 2128: <p>pkgsrc uses the static linking method of the runtime
! 2129: libraries provided by icc, so binaries can be run on
! 2130: other systems which do not have the shared libraries
! 2131: installed.</p>
! 2132:
! 2133: <p>Libtool, however, extracts a list of libraries from
! 2134: the ld(1) command run when linking a C++ shared library
! 2135: and records it, throwing away the -Bstatic and
! 2136: -Bdynamic options interspersed between the libraries.
! 2137: This means that libtool-linked C++ shared libraries
! 2138: will have a runtime dependency on the icc libraries
! 2139: until this is fixed in libtool.</p>
! 2140: </div>
! 2141:
! 2142: <div class="sect2" lang="en" xml:lang="en">
! 2143: <div class="titlepage">
! 2144: <div>
! 2145: <div>
! 2146: <h3 class="title"><a name="id2510248" id=
! 2147: "id2510248"></a>3.2.6. OpenBSD</h3>
1.1 grant 2148: </div>
2149: </div>
2150: </div>
2151:
2152: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2153:
2154: <p>Care should be taken so that the tools that this kit
2155: installs do not conflict with the OpenBSD userland
2156: tools. There are several steps:</p>
2157:
2158: <div class="orderedlist">
2159: <ol type="1">
2160: <li>
2161: <p>OpenBSD stores its ports pkg database in
1.14 xtraeme 2162: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 2163: therefore recommended that you choose a different
1.14 xtraeme 2164: location (e.g. <code class=
2165: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2166: --pkgdbdir option to the bootstrap script.</p>
2167: </li>
2168:
2169: <li>
2170: <p>If you do not intend to use the OpenBSD ports
2171: tools, it's probably a good idea to move them out
2172: of the way to avoid confusion, e.g.</p>
2173: <pre class="screen">
1.14 xtraeme 2174: <code class="prompt">#</code> <strong class=
2175: "userinput"><code>cd /usr/sbin</code></strong>
2176: <code class="prompt">#</code> <strong class=
2177: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2178: <code class="prompt">#</code> <strong class=
2179: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2180: <code class="prompt">#</code> <strong class=
2181: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2182: <code class="prompt">#</code> <strong class=
2183: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2184: </pre>
2185: </li>
2186:
2187: <li>
1.14 xtraeme 2188: <p>An example <code class=
2189: "filename">/etc/mk.conf</code> file will be
2190: placed in <code class=
2191: "filename">/etc/mk.conf.example</code> file when
2192: you use the bootstrap script. OpenBSD's make
2193: program uses <code class=
2194: "filename">/etc/mk.conf</code> as well. You can
1.1 grant 2195: work around this by enclosing all the pkgsrc
2196: specific parts of the file with:</p>
2197: <pre class="programlisting">
2198: .ifdef BSD_PKG_MK
1.11 ben 2199: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1 grant 2200: .else
2201: # OpenBSD stuff
2202: .endif
2203: </pre>
2204: </li>
2205: </ol>
2206: </div>
2207: </div>
2208:
2209: <div class="sect2" lang="en" xml:lang="en">
2210: <div class="titlepage">
2211: <div>
2212: <div>
1.22 ! tv 2213: <h3 class="title"><a name="id2510360" id=
! 2214: "id2510360"></a>3.2.7. Solaris</h3>
1.1 grant 2215: </div>
2216: </div>
2217: </div>
2218:
2219: <p>Solaris 2.6 through 9 are supported on both x86 and
2220: sparc. You will need a working C compiler. Both gcc
2221: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2222:
2223: <p>The following packages are required on Solaris 8 for
2224: the bootstrap process and to build packages.</p>
2225:
2226: <div class="itemizedlist">
2227: <ul type="disc">
2228: <li>
2229: <p>SUNWsprot</p>
2230: </li>
2231:
2232: <li>
2233: <p>SUNWarc</p>
2234: </li>
2235:
2236: <li>
2237: <p>SUNWbtool</p>
2238: </li>
2239:
2240: <li>
2241: <p>SUNWtoo</p>
2242: </li>
2243:
2244: <li>
2245: <p>SUNWlibm</p>
2246: </li>
2247: </ul>
2248: </div>
2249:
2250: <p>Please note the use of GNU binutils on Solaris is
2251: <span class="emphasis"><em>not</em></span>
2252: supported.</p>
2253:
2254: <div class="sect3" lang="en" xml:lang="en">
2255: <div class="titlepage">
2256: <div>
2257: <div>
1.22 ! tv 2258: <h4 class="title"><a name="id2510391" id=
! 2259: "id2510391"></a>3.2.7.1. If you are using
1.1 grant 2260: gcc</h4>
2261: </div>
2262: </div>
2263: </div>
2264:
2265: <p>It makes life much simpler if you only use the
2266: same gcc consistently for building all packages.</p>
2267:
2268: <p>It is recommended that an external gcc be used
2269: only for bootstrapping, then either build gcc from
2270: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2271: href=
2272: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.20 ben 2273: class="pkgname">lang/gcc</a> or install a binary gcc
2274: package, then remove gcc used during
2275: bootstrapping.</p>
1.1 grant 2276:
2277: <p>Binary packages of gcc can be found through
2278: <a href=
2279: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2280: target=
2281: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2282: </div>
2283:
2284: <div class="sect3" lang="en" xml:lang="en">
2285: <div class="titlepage">
2286: <div>
2287: <div>
1.22 ! tv 2288: <h4 class="title"><a name="id2510412" id=
! 2289: "id2510412"></a>3.2.7.2. If you are using
1.1 grant 2290: Sun WorkShop</h4>
2291: </div>
2292: </div>
2293: </div>
2294:
2295: <p>You will need at least the following packages
2296: installed (from WorkShop 5.0)</p>
2297:
2298: <div class="itemizedlist">
2299: <ul type="disc">
2300: <li>
2301: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2302: </li>
2303:
2304: <li>
2305: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2306: </li>
2307:
2308: <li>
2309: <p>SPROild - Sun WorkShop Incremental
2310: Linker</p>
2311: </li>
2312:
2313: <li>
2314: <p>SPROlang - Sun WorkShop Compilers common
2315: components</p>
2316: </li>
2317: </ul>
2318: </div>
2319:
1.14 xtraeme 2320: <p>You should set <code class="varname">CC</code>,
2321: <code class="varname">CXX</code> and optionally,
2322: <code class="varname">CPP</code> in <code class=
2323: "filename">/etc/mk.conf</code>, eg.</p>
1.1 grant 2324: <pre class="programlisting">
2325: CC= cc
2326: CXX= CC
2327: CPP= /usr/ccs/lib/cpp
2328: </pre>
2329:
2330: <p>You may also want to build 64-bit binaries,
2331: eg.</p>
2332: <pre class="programlisting">
2333: CFLAGS= -xtarget=ultra -xarch=v9
2334: </pre>
2335:
2336: <p>Whichever compiler you use, please ensure the
2337: compiler tools and your $prefix are in your
1.14 xtraeme 2338: <code class="varname">PATH</code>. This includes
2339: <code class="filename">/usr/ccs/{bin,lib}</code> and
2340: eg. <code class=
2341: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2342: </div>
2343: </div>
2344: </div>
2345: </div>
2346:
2347: <div class="chapter" lang="en" xml:lang="en">
2348: <div class="titlepage">
2349: <div>
2350: <div>
2351: <h2 class="title"><a name="using" id=
2352: "using"></a>Chapter 4. Using pkgsrc</h2>
2353: </div>
2354: </div>
2355: </div>
2356:
2357: <div class="toc">
2358: <p><b>Table of Contents</b></p>
2359:
2360: <dl>
2361: <dt><span class="sect1"><a href="#getting-started">4.1.
2362: Working with binary packages</a></span></dt>
2363:
2364: <dd>
2365: <dl>
1.22 ! tv 2366: <dt><span class="sect2"><a href="#id2510565">4.1.1.
1.1 grant 2367: Where to get binary packages</a></span></dt>
2368:
1.22 ! tv 2369: <dt><span class="sect2"><a href="#id2510605">4.1.2.
1.1 grant 2370: How to use binary packages</a></span></dt>
2371:
1.22 ! tv 2372: <dt><span class="sect2"><a href="#id2510672">4.1.3.
1.1 grant 2373: A word of warning</a></span></dt>
2374: </dl>
2375: </dd>
2376:
1.22 ! tv 2377: <dt><span class="sect1"><a href="#id2510683">4.2.
1.1 grant 2378: Building packages from source</a></span></dt>
2379:
2380: <dd>
2381: <dl>
1.22 ! tv 2382: <dt><span class="sect2"><a href="#id2510693">4.2.1.
1.1 grant 2383: Requirements</a></span></dt>
2384:
1.22 ! tv 2385: <dt><span class="sect2"><a href="#id2510781">4.2.2.
1.1 grant 2386: Fetching distfiles</a></span></dt>
2387:
1.22 ! tv 2388: <dt><span class="sect2"><a href="#id2510834">4.2.3.
1.1 grant 2389: How to build and install</a></span></dt>
2390:
1.22 ! tv 2391: <dt><span class="sect2"><a href="#id2511091">4.2.4.
1.1 grant 2392: Selecting the compiler</a></span></dt>
2393: </dl>
2394: </dd>
2395: </dl>
2396: </div>
2397:
2398: <div class="sect1" lang="en" xml:lang="en">
2399: <div class="titlepage">
2400: <div>
2401: <div>
2402: <h2 class="title" style="clear: both"><a name=
2403: "getting-started" id=
2404: "getting-started"></a>4.1. Working with binary
2405: packages</h2>
2406: </div>
2407: </div>
2408: </div>
2409:
2410: <p>This section describes how to find, retrieve and
2411: install a precompiled binary package that someone else
2412: already prepared for your type of machine.</p>
2413:
2414: <div class="sect2" lang="en" xml:lang="en">
2415: <div class="titlepage">
2416: <div>
2417: <div>
1.22 ! tv 2418: <h3 class="title"><a name="id2510565" id=
! 2419: "id2510565"></a>4.1.1. Where to get binary
1.1 grant 2420: packages</h3>
2421: </div>
2422: </div>
2423: </div>
2424:
2425: <p>Precompiled packages are stored on ftp.NetBSD.org
1.14 xtraeme 2426: and its mirrors in the directory <code class=
2427: "filename">/pub/NetBSD/packages</code> for anonymous
2428: FTP access. Please pick the right subdirectory there as
2429: indicated by <span><strong class="command">uname
2430: -p</strong></span>. In that directory, there is a
1.1 grant 2431: subdirectory for each category plus a subdirectory
1.14 xtraeme 2432: <code class="filename">All</code> which includes the
2433: actual binaries in <code class="filename">.tgz</code>
2434: files. The category subdirectories use symbolic links
2435: to those files (this is the same directory layout as in
2436: <code class=
2437: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2438:
2439: <p>This same directory layout applies for CDROM
2440: distributions, only that the directory may be rooted
1.14 xtraeme 2441: somewhere else, probably somewhere below <code class=
2442: "filename">/cdrom</code>. Please consult your CDROMs
1.1 grant 2443: documentation for the exact location.</p>
2444: </div>
2445:
2446: <div class="sect2" lang="en" xml:lang="en">
2447: <div class="titlepage">
2448: <div>
2449: <div>
1.22 ! tv 2450: <h3 class="title"><a name="id2510605" id=
! 2451: "id2510605"></a>4.1.2. How to use binary
1.1 grant 2452: packages</h3>
2453: </div>
2454: </div>
2455: </div>
2456:
2457: <p>If you have the files on a CDROM or downloaded them
2458: to your hard disk, youcan install them with the
1.14 xtraeme 2459: following command (be sure to<span><strong class=
2460: "command">su</strong></span> to root first):</p>
1.1 grant 2461: <pre class="screen">
1.14 xtraeme 2462: <code class="prompt">#</code> <strong class=
2463: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 2464: </pre>
2465:
2466: <p>If you have FTP access and you don't want to
2467: download the packages via FTP prior to installation,
1.14 xtraeme 2468: you can do this automatically by giving
2469: <span><strong class="command">pkg_add</strong></span>
2470: an FTP URL:</p>
1.1 grant 2471: <pre class="screen">
1.14 xtraeme 2472: <code class="prompt">#</code> <strong class=
2473: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSvers>/<arch>/All/package.tgz</code></strong>
1.1 grant 2474: </pre>
2475:
2476: <p>If there is any doubt, the uname utility can be used
2477: to determine the <OSvers>, and <arch> by
1.14 xtraeme 2478: running <span><strong class="command">uname
2479: -rp</strong></span>.</p>
1.1 grant 2480:
2481: <p>Also note that any prerequisite packages needed to
2482: run the package in question will be installed, too,
2483: assuming they are present where you install from.</p>
2484:
2485: <p>After you've installed packages, be sure to have
1.14 xtraeme 2486: <code class="filename">/usr/pkg/bin</code> in your
2487: <code class="varname">PATH</code> so you can actually
2488: start the just installed program.</p>
1.1 grant 2489: </div>
2490:
2491: <div class="sect2" lang="en" xml:lang="en">
2492: <div class="titlepage">
2493: <div>
2494: <div>
1.22 ! tv 2495: <h3 class="title"><a name="id2510672" id=
! 2496: "id2510672"></a>4.1.3. A word of
1.1 grant 2497: warning</h3>
2498: </div>
2499: </div>
2500: </div>
2501:
2502: <p>Please pay very careful attention to the warnings
2503: expressed in the <a href=
2504: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2505: <span class="citerefentry"><span class=
2506: "refentrytitle">pkg_add</span>(1)</span></a> manual
2507: page about the inherent dangers of installing binary
2508: packages which you did not create yourself, and the
2509: security holes that can be introduced onto your system
2510: by indiscriminate adding of such files.</p>
2511: </div>
2512: </div>
2513:
2514: <div class="sect1" lang="en" xml:lang="en">
2515: <div class="titlepage">
2516: <div>
2517: <div>
2518: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 2519: "id2510683" id="id2510683"></a>4.2. Building
1.1 grant 2520: packages from source</h2>
2521: </div>
2522: </div>
2523: </div>
2524:
2525: <p>This assumes that the package is already in pkgsrc. If
2526: it is not, see <a href="#developers-guide" title=
1.2 hubertf 2527: "Part II. The pkgsrc developer's guide">Part II,
2528: “The pkgsrc developer's guide”</a>.</p>
1.1 grant 2529:
2530: <div class="sect2" lang="en" xml:lang="en">
2531: <div class="titlepage">
2532: <div>
2533: <div>
1.22 ! tv 2534: <h3 class="title"><a name="id2510693" id=
! 2535: "id2510693"></a>4.2.1. Requirements</h3>
1.1 grant 2536: </div>
2537: </div>
2538: </div>
2539:
2540: <p>To build packages from source on a NetBSD system the
2541: “<span class="quote">comp</span>” and the
2542: “<span class="quote">text</span>”
2543: distribution sets must be installed. If you want to
2544: build X11 related packages the “<span class=
2545: "quote">xbase</span>” and “<span class=
2546: "quote">xcomp</span>” distribution sets are
2547: required, too.</p>
2548: </div>
2549:
2550: <div class="sect2" lang="en" xml:lang="en">
2551: <div class="titlepage">
2552: <div>
2553: <div>
1.22 ! tv 2554: <h3 class="title"><a name="id2510781" id=
! 2555: "id2510781"></a>4.2.2. Fetching
1.1 grant 2556: distfiles</h3>
2557: </div>
2558: </div>
2559: </div>
2560:
2561: <p>The distfile (i.e. the unmodified source) must exist
2562: on your system for the packages system to be able to
2563: build it. If it does not exist, pkgsrc will use
2564: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
2565: <span class="citerefentry"><span class=
2566: "refentrytitle">ftp</span>(1)</span></a> to fetch it
2567: automatically.</p>
2568:
2569: <p>You can overwrite some of the major distribution
2570: sites to fit to sites that are close to your own. Have
1.14 xtraeme 2571: a look at <code class=
2572: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
2573: some examples - in particular, look for the
2574: <code class="varname">MASTER_SORT</code>, <code class=
2575: "varname">MASTER_SORT_REGEX</code> and <code class=
2576: "varname">INET_COUNTRY</code> definitions. This may
2577: save some of your bandwidth and time.</p>
1.1 grant 2578:
2579: <p>You can change these settings either in your shell's
2580: environment, or, if you want to keep the settings, by
1.14 xtraeme 2581: editing the <code class="filename">/etc/mk.conf</code>
1.1 grant 2582: file, and adding the definitions there.</p>
2583:
2584: <p>If you don't have a permanent Internet connection
2585: and you want to know which files to download,
1.14 xtraeme 2586: <span><strong class="command">make
2587: fetch-list</strong></span> will tell you what you'll
2588: need. Put these distfiles into <code class=
2589: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 2590: </div>
2591:
2592: <div class="sect2" lang="en" xml:lang="en">
2593: <div class="titlepage">
2594: <div>
2595: <div>
1.22 ! tv 2596: <h3 class="title"><a name="id2510834" id=
! 2597: "id2510834"></a>4.2.3. How to build and
1.1 grant 2598: install</h3>
2599: </div>
2600: </div>
2601: </div>
2602:
2603: <p>Assuming that the distfile has been fetched (see
2604: previous section), become root and change into the
1.14 xtraeme 2605: relevant directory and running <span><strong class=
2606: "command">make</strong></span>. For example, type</p>
1.1 grant 2607: <pre class="screen">
1.14 xtraeme 2608: <code class="prompt">%</code> <strong class=
2609: "userinput"><code>cd misc/figlet</code></strong>
2610: <code class="prompt">%</code> <strong class=
2611: "userinput"><code>make</code></strong>
1.1 grant 2612: </pre>
2613:
2614: <p>at the shell prompt to build the various components
2615: of the package, and</p>
2616: <pre class="screen">
1.14 xtraeme 2617: <code class="prompt">#</code> <strong class=
2618: "userinput"><code>make install</code></strong>
1.1 grant 2619: </pre>
2620:
2621: <p>to install the various components into the correct
2622: places on your system. Installing the package on your
2623: system requires you to be root. However, pkgsrc has a
2624: <span class="emphasis"><em>just-in-time-su</em></span>
2625: feature, which allows you to only become root for the
2626: actual installation step</p>
2627:
2628: <p>Taking the figlet utility as an example, we can
2629: install it on our system by building as shown in
2630: <a href="#logs" title=
2631: "Appendix B. Build logs">Appendix B, <i>Build
2632: logs</i></a>.</p>
2633:
2634: <p>The program is installed under the default root of
1.14 xtraeme 2635: the packages tree - <code class=
2636: "filename">/usr/pkg</code>. Should this not conform to
2637: your tastes, set the <code class=
2638: "varname">LOCALBASE</code> variable in your
1.1 grant 2639: environment, and it will use that value as the root of
1.14 xtraeme 2640: your packages tree. So, to use <code class=
2641: "filename">/usr/local</code>, set <code class=
2642: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 2643: environment. Please note that you should use a
2644: directory which is dedicated to packages and not shared
1.14 xtraeme 2645: with other programs (ie, do not try and use
2646: <code class="varname">LOCALBASE=/usr</code>). Also, you
2647: should not try to add any of your own files or
2648: directories (such as <code class=
2649: "filename">src/</code>, <code class=
2650: "filename">obj/</code>, or <code class=
2651: "filename">pkgsrc/</code>) below the <code class=
2652: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 2653: possible conflicts between programs and other files
2654: installed by the package system and whatever else may
2655: have been installed there.</p>
2656:
1.14 xtraeme 2657: <p>Some packages look in <code class=
2658: "filename">/etc/mk.conf</code> to alter some
1.1 grant 2659: configuration options at build time. Have a look at
1.14 xtraeme 2660: <code class=
2661: "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
2662: overview of what will be set there by default.
2663: Environment variables such as <code class=
2664: "varname">LOCALBASE</code> can be set in <code class=
2665: "filename">/etc/mk.conf</code> to save having to
2666: remember to set them each time you want to use
2667: pkgsrc.</p>
1.1 grant 2668:
2669: <p>Occasionally, people want to “<span class=
2670: "quote">look under the covers</span>” to see what
2671: is going on when a package is building or being
2672: installed. This may be for debugging purposes, or out
2673: of simple curiosity. A number of utility values have
2674: been added to help with this.</p>
2675:
2676: <div class="orderedlist">
2677: <ol type="1">
2678: <li>
2679: <p>If you invoke the <a href=
2680: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2681: <span class="citerefentry"><span class=
2682: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 2683: with <code class=
2684: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
2685: amount of information will be displayed. For
2686: example,</p>
1.1 grant 2687: <pre class="screen">
1.14 xtraeme 2688: <strong class=
2689: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 2690: </pre>
2691:
2692: <p>will show all the commands that are invoked,
2693: up to and including the “<span class=
2694: "quote">patch</span>” stage.</p>
2695: </li>
2696:
2697: <li>
2698: <p>If you want to know the value of a certain
1.22 ! tv 2699: <a href=
! 2700: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
! 2701: <span class="citerefentry"><span class=
! 2702: "refentrytitle">make</span>(1)</span></a>
! 2703: definition, then the <code class=
1.14 xtraeme 2704: "varname">VARNAME</code> definition should be
2705: used, in conjunction with the show-var target.
2706: e.g. to show the expansion of the <a href=
1.1 grant 2707: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2708: <span class="citerefentry"><span class=
2709: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 2710: variable <code class=
1.22 ! tv 2711: "varname">LOCALBASE</code>:</p>
1.1 grant 2712: <pre class="screen">
1.14 xtraeme 2713: <code class="prompt">%</code> <strong class=
2714: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 2715: /usr/pkg
1.14 xtraeme 2716: <code class="prompt">%</code>
1.1 grant 2717:
2718: </pre>
2719: </li>
2720: </ol>
2721: </div>
2722:
2723: <p>If you want to install a binary package that you've
2724: either created yourself (see next section), that you
2725: put into pkgsrc/packages manually or that is located on
1.8 wiz 2726: a remote FTP server, you can use the "bin-install"
1.1 grant 2727: target. This target will install a binary package - if
2728: available - via <a href=
2729: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2730: <span class="citerefentry"><span class=
2731: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 2732: <span><strong class="command">make
2733: package</strong></span>. The list of remote FTP sites
2734: searched is kept in the variable <code class=
2735: "varname">BINPKG_SITES</code>, which defaults to
2736: ftp.NetBSD.org. Any flags that should be added to
2737: <a href=
1.1 grant 2738: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2739: <span class="citerefentry"><span class=
2740: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 2741: into <code class="varname">BIN_INSTALL_FLAGS</code>.
2742: See <code class=
2743: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
2744: details.</p>
1.1 grant 2745:
2746: <p>A final word of warning: If you setup a system that
1.14 xtraeme 2747: has a non-standard setting for <code class=
2748: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 2749: any packages are installed, as you can not use several
2750: directories for the same purpose. Doing so will result
2751: in pkgsrc not being able to properly detect your
2752: installed packages, and fail miserably. Note also that
2753: precompiled binary packages are usually built with the
1.14 xtraeme 2754: default <code class="varname">LOCALBASE</code> of
2755: <code class="filename">/usr/pkg</code>, and that you
2756: should <span class="emphasis"><em>not</em></span>
2757: install any if you use a non-standard <code class=
2758: "varname">LOCALBASE</code>.</p>
1.1 grant 2759: </div>
2760:
2761: <div class="sect2" lang="en" xml:lang="en">
2762: <div class="titlepage">
2763: <div>
2764: <div>
1.22 ! tv 2765: <h3 class="title"><a name="id2511091" id=
! 2766: "id2511091"></a>4.2.4. Selecting the
1.1 grant 2767: compiler</h3>
2768: </div>
2769: </div>
2770: </div>
2771:
2772: <p>By default, pkgsrc will use GCC to build packages.
2773: This may be overridden by setting the following
2774: variables in /etc/mk.conf:</p>
2775:
2776: <div class="variablelist">
2777: <dl>
1.14 xtraeme 2778: <dt><span class="term"><code class=
2779: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 2780:
2781: <dd>
2782: <p>This is a list of values specifying the chain
2783: of compilers to invoke when building packages.
2784: Valid values are:</p>
2785:
2786: <div class="itemizedlist">
2787: <ul type="disc">
2788: <li>
1.14 xtraeme 2789: <p><code class="varname">distcc</code>:
1.1 grant 2790: distributed C/C++ (chainable)</p>
2791: </li>
2792:
2793: <li>
1.14 xtraeme 2794: <p><code class="varname">ccache</code>:
1.1 grant 2795: compiler cache (chainable)</p>
2796: </li>
2797:
2798: <li>
1.14 xtraeme 2799: <p><code class="varname">gcc</code>: GNU
2800: C/C++ Compiler</p>
1.1 grant 2801: </li>
2802:
2803: <li>
1.14 xtraeme 2804: <p><code class="varname">mipspro</code>:
1.1 grant 2805: Silicon Graphics, Inc. MIPSpro
2806: (n32/n64)</p>
2807: </li>
2808:
2809: <li>
1.14 xtraeme 2810: <p><code class="varname">mipspro</code>:
1.1 grant 2811: Silicon Graphics, Inc. MIPSpro (o32)</p>
2812: </li>
2813:
2814: <li>
1.14 xtraeme 2815: <p><code class="varname">sunpro</code>:
1.1 grant 2816: Microsystems, Inc. WorkShip/Forte/Sun ONE
2817: Studio</p>
2818: </li>
2819: </ul>
2820: </div>
2821:
2822: <p>The default is “<span class=
1.14 xtraeme 2823: "quote"><code class=
2824: "varname">gcc</code></span>”. You can use
2825: <code class="varname">ccache</code> and/or
2826: <code class="varname">distcc</code> with an
2827: appropriate <code class=
2828: "varname">PKGSRC_COMPILER</code> setting, e.g.
2829: “<span class="quote"><code class=
2830: "varname">ccache gcc</code></span>”. This
1.1 grant 2831: variable should always be terminated with a value
2832: for a real compiler.</p>
2833: </dd>
2834:
1.14 xtraeme 2835: <dt><span class="term"><code class=
2836: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 2837:
2838: <dd>
2839: <p>This specifies the minimum version of GCC to
2840: use when building packages. If the system GCC
2841: doesn't satisfy this requirement, then pkgsrc
2842: will build and install one of the GCC packages to
2843: use instead.</p>
2844: </dd>
2845: </dl>
2846: </div>
2847: </div>
2848: </div>
2849: </div>
2850:
2851: <div class="chapter" lang="en" xml:lang="en">
2852: <div class="titlepage">
2853: <div>
2854: <div>
2855: <h2 class="title"><a name="binary" id=
2856: "binary"></a>Chapter 5. Creating binary
2857: packages</h2>
2858: </div>
2859: </div>
2860: </div>
2861:
2862: <div class="toc">
2863: <p><b>Table of Contents</b></p>
2864:
2865: <dl>
1.22 ! tv 2866: <dt><span class="sect1"><a href="#id2512065">5.1.
1.1 grant 2867: Building a single binary package</a></span></dt>
2868:
1.22 ! tv 2869: <dt><span class="sect1"><a href="#id2512142">5.2.
1.1 grant 2870: Settings for creation of binary
2871: packages</a></span></dt>
2872:
2873: <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
2874: a bulk build of all packages</a></span></dt>
2875:
2876: <dd>
2877: <dl>
2878: <dt><span class="sect2"><a href=
2879: "#binary.configuration">5.3.1.
2880: Configuration</a></span></dt>
2881:
1.22 ! tv 2882: <dt><span class="sect2"><a href="#id2577136">5.3.2.
1.1 grant 2883: Other environmental considerations</a></span></dt>
2884:
1.22 ! tv 2885: <dt><span class="sect2"><a href="#id2577176">5.3.3.
1.1 grant 2886: Operation</a></span></dt>
2887:
1.22 ! tv 2888: <dt><span class="sect2"><a href="#id2577245">5.3.4.
1.1 grant 2889: What it does</a></span></dt>
2890:
1.22 ! tv 2891: <dt><span class="sect2"><a href="#id2577302">5.3.5.
1.1 grant 2892: Disk space requirements</a></span></dt>
2893:
1.22 ! tv 2894: <dt><span class="sect2"><a href="#id2577329">5.3.6.
1.1 grant 2895: Setting up a sandbox for chroot'ed
2896: builds</a></span></dt>
2897:
1.22 ! tv 2898: <dt><span class="sect2"><a href="#id2577858">5.3.7.
1.1 grant 2899: Building a partial set of packages</a></span></dt>
1.13 hubertf 2900:
2901: <dt><span class="sect2"><a href=
2902: "#bulk-upload">5.3.8. Uploading results of a bulk
2903: build</a></span></dt>
1.1 grant 2904: </dl>
2905: </dd>
2906:
1.22 ! tv 2907: <dt><span class="sect1"><a href="#id2578363">5.4.
1.1 grant 2908: Creating a multiple CD-ROM packages
2909: collection</a></span></dt>
2910:
2911: <dd>
2912: <dl>
1.22 ! tv 2913: <dt><span class="sect2"><a href="#id2578378">5.4.1.
1.1 grant 2914: Example of cdpack</a></span></dt>
2915: </dl>
2916: </dd>
2917: </dl>
2918: </div>
2919:
2920: <div class="sect1" lang="en" xml:lang="en">
2921: <div class="titlepage">
2922: <div>
2923: <div>
2924: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 2925: "id2512065" id="id2512065"></a>5.1. Building a
1.1 grant 2926: single binary package</h2>
2927: </div>
2928: </div>
2929: </div>
2930:
2931: <p>Once you have built and installed a package, you can
2932: create a <span class="emphasis"><em>binary
2933: package</em></span> which can be installed on another
2934: system with <a href=
2935: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2936: <span class="citerefentry"><span class=
2937: "refentrytitle">pkg_add</span>(1)</span></a> This saves
2938: having to build the same package on a group of hosts and
2939: wasting CPU time. It also provides a simple means for
2940: others to install your package, should you distribute
2941: it.</p>
2942:
2943: <p>To create a binary package, change into the
1.14 xtraeme 2944: appropriate directory in pkgsrc, and run
2945: <span><strong class="command">make
2946: package</strong></span>:</p>
1.1 grant 2947: <pre class="screen">
1.14 xtraeme 2948: <code class="prompt">#</code> <strong class=
2949: "userinput"><code>cd misc/figlet</code></strong>
2950: <code class="prompt">#</code> <strong class=
2951: "userinput"><code>make package</code></strong>
1.1 grant 2952: </pre>
2953:
2954: <p>This will build and install your package (if not
2955: already done), and then build a binary package from what
1.14 xtraeme 2956: was installed. You can then use the <span><strong class=
2957: "command">pkg_*</strong></span> tools to manipulate it.
2958: Binary packages are created by default in <code class=
2959: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 2960: gzipped tar file. See <a href="#logs.package" title=
2961: "B.2. Packaging figlet">Section B.2,
2962: “Packaging figlet”</a> for a continuation of
2963: the above <a xmlns=
2964: "http://www.w3.org/TR/xhtml1/transitional" href=
2965: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.20 ben 2966: class="pkgname">misc/figlet</a> example.</p>
1.1 grant 2967:
2968: <p>See <a href="#submit" title=
2969: "Chapter 14. Submitting and Committing">Chapter
2970: 14, <i>Submitting and Committing</i></a> for information
2971: on how to submit such a binary package.</p>
2972: </div>
2973:
2974: <div class="sect1" lang="en" xml:lang="en">
2975: <div class="titlepage">
2976: <div>
2977: <div>
2978: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 2979: "id2512142" id="id2512142"></a>5.2. Settings
1.1 grant 2980: for creation of binary packages</h2>
2981: </div>
2982: </div>
2983: </div>
2984:
2985: <p>See <a href="#build.helpful-targets" title=
2986: "11.3. Other helpful targets">Section 11.3,
2987: “Other helpful targets”</a>.</p>
2988: </div>
2989:
2990: <div class="sect1" lang="en" xml:lang="en">
2991: <div class="titlepage">
2992: <div>
2993: <div>
2994: <h2 class="title" style="clear: both"><a name=
2995: "bulkbuild" id="bulkbuild"></a>5.3. Doing a
2996: bulk build of all packages</h2>
2997: </div>
2998: </div>
2999: </div>
3000:
3001: <p>If you want to get a full set of precompiled binary
3002: packages, this section describes how to get them. Beware
3003: that the bulk build will remove all currently installed
3004: packages from your system! Having a FTP server configured
3005: either on the machine doing the bulk builds or on a
3006: nearby NFS server can help to make the packages available
3007: to everyone. See <a href=
3008: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
3009: <span class="citerefentry"><span class=
3010: "refentrytitle">ftpd</span>(8)</span></a> for more
3011: information. If you use a remote NFS server's storage, be
3012: sure to not actually compile on NFS storage, as this
3013: slows things down a lot.</p>
3014:
3015: <div class="sect2" lang="en" xml:lang="en">
3016: <div class="titlepage">
3017: <div>
3018: <div>
3019: <h3 class="title"><a name="binary.configuration"
3020: id=
3021: "binary.configuration"></a>5.3.1. Configuration</h3>
3022: </div>
3023: </div>
3024: </div>
3025:
3026: <div class="sect3" lang="en" xml:lang="en">
3027: <div class="titlepage">
3028: <div>
3029: <div>
3030: <h4 class="title"><a name="binary.mk.conf" id=
3031: "binary.mk.conf"></a>5.3.1.1. /etc/mk.conf</h4>
3032: </div>
3033: </div>
3034: </div>
3035:
1.14 xtraeme 3036: <p>You may want to set things in <code class=
3037: "filename">/etc/mk.conf</code>. Look at <code class=
3038: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 3039: details of the default settings. You will want to
1.14 xtraeme 3040: ensure that <code class=
3041: "varname">ACCEPTABLE_LICENSES</code> meet your local
3042: policy. As used in this example, <code class=
3043: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 3044: "emphasis"><em>all</em></span> licenses.</p>
3045: <pre class="programlisting">
3046: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
3047: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
3048: BSDSRCDIR= /usr/src
3049: BSDXSRCDIR= /usr/xsrc # for x11/xservers
3050: OBJHOSTNAME?= yes # use work.`hostname`
3051: FAILOVER_FETCH= yes # insist on the correct checksum
3052: PKG_DEVELOPER?= yes
3053: _ACCEPTABLE= yes
3054: </pre>
3055: </div>
3056:
3057: <div class="sect3" lang="en" xml:lang="en">
3058: <div class="titlepage">
3059: <div>
3060: <div>
1.22 ! tv 3061: <h4 class="title"><a name="id2512206" id=
! 3062: "id2512206"></a>5.3.1.2. <code class=
1.14 xtraeme 3063: "filename">build.conf</code></h4>
1.1 grant 3064: </div>
3065: </div>
3066: </div>
3067:
1.14 xtraeme 3068: <p>In <code class="filename">pkgsrc/mk/bulk</code>,
3069: copy <code class="filename">build.conf-example</code>
3070: to <code class="filename">build.conf</code> and edit
3071: it, following the comments in that file. This is the
1.1 grant 3072: config file that determines where log files are
3073: generated after the build, where to mail the build
3074: report to, where your pkgsrc tree is located and
3075: which user to <a href=
3076: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
3077: <span class="citerefentry"><span class=
3078: "refentrytitle">su</span>(8)</span></a> to to do a
1.14 xtraeme 3079: <span><strong class="command">cvs
3080: update</strong></span>.</p>
1.1 grant 3081: </div>
3082:
3083: <div class="sect3" lang="en" xml:lang="en">
3084: <div class="titlepage">
3085: <div>
3086: <div>
1.22 ! tv 3087: <h4 class="title"><a name="id2577028" id=
! 3088: "id2577028"></a>5.3.1.3. <code class=
1.14 xtraeme 3089: "filename">pre-build.local</code></h4>
1.1 grant 3090: </div>
3091: </div>
3092: </div>
3093:
3094: <p>It is possible to configure the bulk build to
3095: perform certain site specific tasks at the end of the
1.14 xtraeme 3096: pre-build stage. If the file <code class=
3097: "filename">pre-build.local</code> exists in
3098: <code class="filename">/usr/pkgsrc/mk/bulk</code> it
3099: will be executed (as a sh(1) script) at the end of
3100: the usual pre-build stage. An example use of
3101: <code class="filename">pre-build.local</code> is to
3102: have the line:</p>
1.1 grant 3103: <pre class="screen">
1.14 xtraeme 3104: <code class="prompt">#</code> <strong class=
3105: "userinput"><code>echo "I do not have enough disk space to build this pig." \
3106: > pkgsrc/games/crafty-book-enormous/$BROKENF</code></strong>
1.1 grant 3107: </pre>
3108:
3109: <p>to prevent the system from trying to build a
3110: particular package which requires nearly 3 GB of disk
3111: space.</p>
3112: </div>
3113: </div>
3114:
3115: <div class="sect2" lang="en" xml:lang="en">
3116: <div class="titlepage">
3117: <div>
3118: <div>
1.22 ! tv 3119: <h3 class="title"><a name="id2577136" id=
! 3120: "id2577136"></a>5.3.2. Other environmental
1.1 grant 3121: considerations</h3>
3122: </div>
3123: </div>
3124: </div>
3125:
1.14 xtraeme 3126: <p>As <code class="filename">/usr/pkg</code> will be
1.1 grant 3127: completely deleted at the start of bulk builds, make
3128: sure your login shell is placed somewhere else. Either
1.14 xtraeme 3129: drop it into <code class=
3130: "filename">/usr/local/bin</code> (and adjust your login
3131: shell in the passwd file), or (re-)install it via
3132: <a href=
1.1 grant 3133: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3134: <span class="citerefentry"><span class=
3135: "refentrytitle">pkg_add</span>(1)</span></a> from
1.14 xtraeme 3136: <code class="filename">/etc/rc.local</code>, so you can
1.1 grant 3137: login after a reboot (remember that your current
3138: process won't die if the package is removed, you just
3139: can't start any new instances of the shell any more).
3140: Also, if you use NetBSD earlier than 1.5, or you still
3141: want to use the pkgsrc version of ssh for some reason,
3142: be sure to install ssh before starting it from
1.14 xtraeme 3143: <code class="filename">rc.local</code>:</p>
1.1 grant 3144: <pre class="programlisting">
3145: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
3146: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
3147: /usr/pkg/etc/rc.d/sshd
3148: fi
3149: </pre>
3150:
3151: <p>Not doing so will result in you being not able to
3152: log in via ssh after the bulk build is finished or if
3153: the machine gets rebooted or crashes. You have been
3154: warned! :)</p>
3155: </div>
3156:
3157: <div class="sect2" lang="en" xml:lang="en">
3158: <div class="titlepage">
3159: <div>
3160: <div>
1.22 ! tv 3161: <h3 class="title"><a name="id2577176" id=
! 3162: "id2577176"></a>5.3.3. Operation</h3>
1.1 grant 3163: </div>
3164: </div>
3165: </div>
3166:
3167: <p>Make sure you don't need any of the packages still
3168: installed.</p>
3169:
3170: <div class="warning" style=
3171: "margin-left: 0.5in; margin-right: 0.5in;">
3172: <h3 class="title">Warning</h3>
3173:
3174: <p>During the bulk build, <span class=
3175: "emphasis"><em>all packages will be
3176: removed!</em></span></p>
3177: </div>
3178:
3179: <p>Be sure to remove all other things that might
3180: interfere with builds, like some libs installed in
1.14 xtraeme 3181: <code class="filename">/usr/local</code>, etc. then
3182: become root and type:</p>
1.1 grant 3183: <pre class="screen">
1.14 xtraeme 3184: <code class="prompt">#</code> <strong class=
3185: "userinput"><code>cd /usr/pkgsrc</code></strong>
3186: <code class="prompt">#</code> <strong class=
3187: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 3188: </pre>
3189:
3190: <p>If for some reason your last build didn't complete
3191: (power failure, system panic, ...), you can continue it
3192: by running:</p>
3193: <pre class="screen">
1.14 xtraeme 3194: <code class="prompt">#</code> <strong class=
3195: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 3196: </pre>
3197:
3198: <p>At the end of the bulk build, you will get a summary
3199: via mail, and find build logs in the directory
1.14 xtraeme 3200: specified by <code class="varname">FTP</code> in the
3201: <code class="filename">build.conf</code> file.</p>
1.1 grant 3202: </div>
3203:
3204: <div class="sect2" lang="en" xml:lang="en">
3205: <div class="titlepage">
3206: <div>
3207: <div>
1.22 ! tv 3208: <h3 class="title"><a name="id2577245" id=
! 3209: "id2577245"></a>5.3.4. What it does</h3>
1.1 grant 3210: </div>
3211: </div>
3212: </div>
3213:
3214: <p>The bulk builds consist of three steps:</p>
3215:
3216: <div class="variablelist">
3217: <dl>
3218: <dt><span class="term">1. pre-build</span></dt>
3219:
3220: <dd>
3221: <p>The script updates your pkgsrc tree via
3222: (anon)cvs, then cleans out any broken distfiles,
3223: and removes all packages installed.</p>
3224: </dd>
3225:
3226: <dt><span class="term">2. the bulk
3227: build</span></dt>
3228:
3229: <dd>
3230: <p>This is basically “<span class=
3231: "quote">make bulk-package</span>” with an
3232: optimised order in which packages will be built.
3233: Packages that don't require other packages will
3234: be built first, and packages with many
3235: dependencies will be built later.</p>
3236: </dd>
3237:
3238: <dt><span class="term">3. post-build</span></dt>
3239:
3240: <dd>
3241: <p>Generates a report that's placed in the
1.14 xtraeme 3242: directory specified in the <code class=
3243: "filename">build.conf</code> file named
3244: <code class="filename">broken.html</code>, a
3245: short version of that report will also be mailed
3246: to the build's admin.</p>
1.1 grant 3247: </dd>
3248: </dl>
3249: </div>
3250:
3251: <p>During the build, a list of broken packages will be
1.14 xtraeme 3252: compiled in <code class=
3253: "filename">/usr/pkgsrc/.broken</code> (or <code class=
3254: "filename">.../.broken.${MACHINE}</code> if
3255: <code class="varname">OBJMACHINE</code> is set),
3256: individual build logs of broken builds can be found in
3257: the package's directory. These files are used by the
3258: bulk-targets to mark broken builds to not waste time
3259: trying to rebuild them, and they can be used to debug
3260: these broken package builds later.</p>
1.1 grant 3261: </div>
3262:
3263: <div class="sect2" lang="en" xml:lang="en">
3264: <div class="titlepage">
3265: <div>
3266: <div>
1.22 ! tv 3267: <h3 class="title"><a name="id2577302" id=
! 3268: "id2577302"></a>5.3.5. Disk space
1.1 grant 3269: requirements</h3>
3270: </div>
3271: </div>
3272: </div>
3273:
3274: <p>Currently, roughly the following requirements are
3275: valid for NetBSD 2.0/i386:</p>
3276:
3277: <div class="itemizedlist">
3278: <ul type="disc">
3279: <li>
3280: <p>10 GB - distfiles (NFS ok)</p>
3281: </li>
3282:
3283: <li>
3284: <p>8 GB - full set of all binaries (NFS ok)</p>
3285: </li>
3286:
3287: <li>
3288: <p>5 GB - temp space for compiling (local disk
3289: recommended)</p>
3290: </li>
3291: </ul>
3292: </div>
3293:
3294: <p>Note that all pkgs will be de-installed as soon as
3295: they are turned into a binary package, and that sources
3296: are removed, so there is no excessively huge demand to
3297: disk space. Afterwards, if the package is needed again,
3298: it will be installed via <a href=
3299: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3300: <span class="citerefentry"><span class=
3301: "refentrytitle">pkg_add</span>(1)</span></a> instead of
3302: building again, so there are no cycles wasted by
3303: recompiling.</p>
3304: </div>
3305:
3306: <div class="sect2" lang="en" xml:lang="en">
3307: <div class="titlepage">
3308: <div>
3309: <div>
1.22 ! tv 3310: <h3 class="title"><a name="id2577329" id=
! 3311: "id2577329"></a>5.3.6. Setting up a sandbox
1.1 grant 3312: for chroot'ed builds</h3>
3313: </div>
3314: </div>
3315: </div>
3316:
1.12 agc 3317: <p>If you don't want all the packages nuked from a
3318: machine (rendering it useless for anything but pkg
3319: compiling), there is the possibility of doing the pkg
3320: bulk build inside a chroot environment.</p>
3321:
3322: <p>The first step is to set up a chroot sandbox, e.g.
1.14 xtraeme 3323: <code class="filename">/usr/sandbox</code>. This can be
1.12 agc 3324: done by using null mounts, or manually.</p>
3325:
1.14 xtraeme 3326: <p>There is a shell script called <code class=
3327: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
3328: set up the sandbox environment using null mounts. It
3329: will also create a script called <code class=
3330: "filename">sandbox</code> in the root of the sandbox
1.12 agc 3331: environment, which will allow the null mounts to be
1.14 xtraeme 3332: activated using the <span><strong class=
3333: "command">sandbox mount</strong></span> command and
3334: deactivated using the <span><strong class=
3335: "command">sandbox umount</strong></span> command.</p>
1.12 agc 3336:
3337: <p>To set up a sandbox environment by hand, after
3338: extracting all the sets from a NetBSD installation or
1.14 xtraeme 3339: doing a <span><strong class="command">make distribution
3340: DESTDIR=/usr/sandbox</strong></span> in <code class=
3341: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 3342: items are present and properly configured:</p>
1.1 grant 3343:
3344: <div class="procedure">
3345: <ol type="1">
3346: <li>
3347: <p>Kernel</p>
3348: <pre class="screen">
1.14 xtraeme 3349: <code class="prompt">#</code> <strong class=
3350: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 3351: </pre>
3352: </li>
3353:
3354: <li>
1.14 xtraeme 3355: <p><code class="filename">/dev/*</code></p>
1.1 grant 3356: <pre class="screen">
1.14 xtraeme 3357: <code class="prompt">#</code> <strong class=
3358: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 3359: </pre>
3360: </li>
3361:
3362: <li>
1.14 xtraeme 3363: <p><code class="filename">/etc/resolv.conf</code>
1.1 grant 3364: (for <a xmlns=
3365: "http://www.w3.org/TR/xhtml1/transitional" href=
3366: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20 ben 3367: class="pkgname">security/smtpd</a> and mail):</p>
1.1 grant 3368: <pre class="screen">
1.14 xtraeme 3369: <code class="prompt">#</code> <strong class=
3370: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 3371: </pre>
3372: </li>
3373:
3374: <li>
3375: <p>Working(!) mail config (hostname,
3376: sendmail.cf):</p>
3377: <pre class="screen">
1.14 xtraeme 3378: <code class="prompt">#</code> <strong class=
3379: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 3380: </pre>
3381: </li>
3382:
3383: <li>
1.14 xtraeme 3384: <p><code class="filename">/etc/localtime</code>
3385: (for <a xmlns=
1.1 grant 3386: "http://www.w3.org/TR/xhtml1/transitional" href=
3387: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20 ben 3388: class="pkgname">security/smtpd</a>):</p>
1.1 grant 3389: <pre class="screen">
1.14 xtraeme 3390: <code class="prompt">#</code> <strong class=
3391: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 3392: </pre>
3393: </li>
3394:
3395: <li>
1.14 xtraeme 3396: <p><code class="filename">/usr/src</code> (system
1.1 grant 3397: sources, for <a xmlns=
3398: "http://www.w3.org/TR/xhtml1/transitional" href=
3399: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.20 ben 3400: class="pkgname">sysutils/aperture</a>, <a xmlns=
3401: "http://www.w3.org/TR/xhtml1/transitional" href=
3402: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
3403: class="pkgname">net/ppp-mppe</a>):</p>
1.1 grant 3404: <pre class="screen">
1.14 xtraeme 3405: <code class="prompt">#</code> <strong class=
3406: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
3407: <code class="prompt">#</code> <strong class=
3408: "userinput"><code>ln -s cvs/src-1.6 src</code></strong>
1.1 grant 3409: </pre>
3410: </li>
3411:
3412: <li>
1.14 xtraeme 3413: <p>Create <code class=
3414: "filename">/var/db/pkg</code> (not part of
3415: default install):</p>
1.1 grant 3416: <pre class="screen">
1.14 xtraeme 3417: <code class="prompt">#</code> <strong class=
3418: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 3419: </pre>
3420: </li>
3421:
3422: <li>
1.14 xtraeme 3423: <p>Create <code class="filename">/usr/pkg</code>
3424: (not part of default install):</p>
1.1 grant 3425: <pre class="screen">
1.14 xtraeme 3426: <code class="prompt">#</code> <strong class=
3427: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 3428: </pre>
3429: </li>
3430:
3431: <li>
1.14 xtraeme 3432: <p>Checkout pkgsrc via cvs into <code class=
3433: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 3434: <pre class="screen">
1.14 xtraeme 3435: <code class="prompt">#</code> <strong class=
3436: "userinput"><code>cd /usr/sandbox/usr</code></strong>
3437: <code class="prompt">#</code> <strong class=
3438: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 3439: </pre>
3440:
3441: <p>Do not mount/link this to the copy of your
3442: pkgsrc tree you do development in, as this will
3443: likely cause problems!</p>
3444: </li>
3445:
3446: <li>
1.14 xtraeme 3447: <p>Make <code class=
3448: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
3449: and <code class="filename">.../distfiles</code>
3450: point somewhere appropriate. NFS- and/or
3451: nullfs-mounts may come in handy!</p>
1.1 grant 3452: </li>
3453:
3454: <li>
1.14 xtraeme 3455: <p>Edit <code class=
3456: "filename">/etc/mk.conf</code>, see <a href=
3457: "#binary.mk.conf" title=
1.1 grant 3458: "5.3.1.1. /etc/mk.conf">Section 5.3.1.1,
3459: “/etc/mk.conf”</a>.</p>
3460: </li>
3461:
3462: <li>
1.14 xtraeme 3463: <p>Adjust <code class=
3464: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 3465: needs.</p>
3466: </li>
3467:
3468: <li>
1.14 xtraeme 3469: <p>If you have set <code class=
3470: "varname">CVS_USER</code> in <code class=
3471: "filename">build.conf</code>, make sure that
3472: account exists and can do a <span><strong class=
3473: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 3474: properly!</p>
3475: </li>
3476: </ol>
3477: </div>
3478:
3479: <p>When the chroot sandbox is setup, you can start the
3480: build with the following steps:</p>
3481: <pre class="screen">
1.14 xtraeme 3482: <code class="prompt">#</code> <strong class=
3483: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
3484: <code class="prompt">#</code> <strong class=
3485: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 3486: </pre>
3487:
3488: <p>This will just jump inside the sandbox and start
3489: building. At the end of the build, mail will be sent
3490: with the results of the build. Created binary pkgs will
1.14 xtraeme 3491: be in <code class=
3492: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 3493: (wherever that points/mounts to/from).</p>
3494: </div>
3495:
3496: <div class="sect2" lang="en" xml:lang="en">
3497: <div class="titlepage">
3498: <div>
3499: <div>
1.22 ! tv 3500: <h3 class="title"><a name="id2577858" id=
! 3501: "id2577858"></a>5.3.7. Building a partial
1.1 grant 3502: set of packages</h3>
3503: </div>
3504: </div>
3505: </div>
3506:
3507: <p>In addition to building a complete set of all
1.14 xtraeme 3508: packages in pkgsrc, the <code class=
3509: "filename">pkgsrc/mk/bulk/build</code> script may be
3510: used to build a subset of the packages contained in
3511: pkgsrc. By setting defining <code class=
3512: "varname">SPECIFIC_PKGS</code> in <code class=
3513: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 3514:
3515: <div class="itemizedlist">
3516: <ul type="disc">
3517: <li>
3518: <p>SITE_SPECIFIC_PKGS</p>
3519: </li>
3520:
3521: <li>
3522: <p>HOST_SPECIFIC_PKGS</p>
3523: </li>
3524:
3525: <li>
3526: <p>GROUP_SPECIFIC_PKGS</p>
3527: </li>
3528:
3529: <li>
3530: <p>USER_SPECIFIC_PKGS</p>
3531: </li>
3532: </ul>
3533: </div>
3534:
3535: <p>will define the set of packages which should be
3536: built. The bulk build code will also include any
3537: packages which are needed as dependencies for the
3538: explicitly listed packages.</p>
3539:
3540: <p>One use of this is to do a bulk build with
1.14 xtraeme 3541: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 3542: sandbox periodically to have a complete set of the
3543: binary packages needed for your site available without
3544: the overhead of building extra packages that are not
3545: needed.</p>
3546: </div>
1.13 hubertf 3547:
3548: <div class="sect2" lang="en" xml:lang="en">
3549: <div class="titlepage">
3550: <div>
3551: <div>
3552: <h3 class="title"><a name="bulk-upload" id=
3553: "bulk-upload"></a>5.3.8. Uploading results
3554: of a bulk build</h3>
3555: </div>
3556: </div>
3557: </div>
3558:
3559: <p>This section describes how pkgsrc developers can
3560: upload binary pkgs built by bulk builds to
3561: ftp.NetBSD.org.</p>
3562:
1.17 sketch 3563: <p>If you would like to automatically create checksum
3564: files for the binary packages you intend to upload,
3565: remember to set <code class="varname">MKSUMS=yes</code>
3566: in your <code class=
3567: "filename">mk/bulk/build.conf</code>.</p>
3568:
3569: <p>If you would like to PGP sign the checksum files
3570: (highly recommended!), remember to set <code class=
3571: "varname">SIGN_AS=username@NetBSD.org</code> in your
3572: <code class="filename">mk/bulk/build.conf</code>. This
3573: will prompt you for your gpg password to sign the files
3574: before uploading everything.</p>
3575:
3576: <p>Then, make sure that you have <code class=
1.14 xtraeme 3577: "varname">RSYNC_DST</code> set properly in your
3578: <code class="filename">mk/bulk/build.conf</code> file,
3579: i.e. adjust it to something like one of the
3580: following:</p>
1.13 hubertf 3581: <pre class="screen">
3582: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3583: </pre>
3584:
3585: <p>Please use appropviate values for "pkgsrc-200xQ4",
3586: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 3587: ftp.NetBSD.org is different from <code class=
3588: "varname">CVS_USER</code>, write your login directly
3589: into the variable, e.g. my local account is "feyrer",
3590: but for my login "hubertf", I use:</p>
1.13 hubertf 3591: <pre class="screen">
3592: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3593: </pre>
3594:
1.14 xtraeme 3595: <p>A separate <code class="filename">upload</code>
1.13 hubertf 3596: directory is used here to allow "closing" the directory
3597: during upload. To do so, run the following command on
3598: ftp.NetBSD.org next:</p>
3599: <pre class="screen">
1.14 xtraeme 3600: nbftp% <strong class=
3601: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 3602: </pre>
3603:
1.14 xtraeme 3604: <p>Please note that <code class=
3605: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 3606: appropriate for packages for the NetBSD operating
3607: system. Binary packages for other operating systems
1.14 xtraeme 3608: should go into <code class=
3609: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 3610:
3611: <p>Before uploading the binary pkgs, ssh authentication
3612: needs to be setup next. This example shows how to setup
3613: temporary keys for the root account <span class=
3614: "emphasis"><em>inside the sandbox</em></span> (assuming
3615: that no keys should be present there usually):</p>
3616: <pre class="screen">
1.14 xtraeme 3617: <code class="prompt">#</code> <strong class=
3618: "userinput"><code>chroot /usr/sandbox</code></strong>
3619: chroot-<code class="prompt">#</code> <strong class=
3620: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
3621: chroot-<code class="prompt">#</code> <strong class=
3622: "userinput"><code>ssh-keygen -t dsa</code></strong>
3623: chroot-<code class="prompt">#</code> <strong class=
3624: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 3625: </pre>
3626:
1.14 xtraeme 3627: <p>Now take the output of <code class=
3628: "filename">id-dsa.pub</code> and append it to your
3629: <code class="filename">~/.ssh/authorized_keys</code>
1.17 sketch 3630: file on ftp.NetBSD.org. You can remove the key after
1.14 xtraeme 3631: the upload is done!</p>
1.13 hubertf 3632:
3633: <p>Next, test if your ssh connection really works:</p>
3634: <pre class="screen">
1.14 xtraeme 3635: chroot-<code class="prompt">#</code> <strong class=
3636: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 3637: </pre>
3638:
3639: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
3640:
3641: <p>Now after all this works, you can exit the sandbox
3642: and start the upload:</p>
3643: <pre class="screen">
1.14 xtraeme 3644: chroot-<code class="prompt">#</code> <strong class=
3645: "userinput"><code>exit</code></strong>
3646: <code class="prompt">#</code> <strong class=
3647: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
3648: <code class="prompt">#</code> <strong class=
3649: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 3650: </pre>
3651:
3652: <p>The upload process may take quite some time. Use
3653: "ls" or "du" on the FTP server to monitor progress of
3654: the upload.</p>
3655:
3656: <p>After the upload has ended, first thing is to revoke
3657: ssh access:</p>
3658: <pre class="screen">
1.14 xtraeme 3659: nbftp% <strong class=
3660: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 3661: Gdd:x!
3662: </pre>
3663:
3664: <p>Use whatever is needed to remove the key you've
3665: entered before! Last, move the uploaded packages out of
1.14 xtraeme 3666: the <code class="filename">upload</code> directory to
3667: have them accessible to everyone:</p>
1.13 hubertf 3668: <pre class="screen">
1.14 xtraeme 3669: nbftp% <strong class=
3670: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
3671: nbftp% <strong class=
3672: "userinput"><code>mv upload/* .</code></strong>
3673: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
3674: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 3675: </pre>
3676: </div>
1.1 grant 3677: </div>
3678:
3679: <div class="sect1" lang="en" xml:lang="en">
3680: <div class="titlepage">
3681: <div>
3682: <div>
3683: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 3684: "id2578363" id="id2578363"></a>5.4. Creating a
1.1 grant 3685: multiple CD-ROM packages collection</h2>
3686: </div>
3687: </div>
3688: </div>
3689:
3690: <p>After your pkgsrc bulk-build has completed, you may
3691: wish to create a CD-ROM set of the resulting binary
3692: packages to assist in installing packages on other
3693: machines. The <a xmlns=
3694: "http://www.w3.org/TR/xhtml1/transitional" href=
3695: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.20 ben 3696: class="pkgname">pkgtools/cdpack</a> package provides a
3697: simple tool for creating the ISO 9660 images.
3698: <span><strong class="command">cdpack</strong></span>
3699: arranges the packages on the CD-ROMs in a way that keeps
3700: all the dependencies for given package on the same CD as
3701: that package.</p>
1.1 grant 3702:
3703: <div class="sect2" lang="en" xml:lang="en">
3704: <div class="titlepage">
3705: <div>
3706: <div>
1.22 ! tv 3707: <h3 class="title"><a name="id2578378" id=
! 3708: "id2578378"></a>5.4.1. Example of
1.1 grant 3709: cdpack</h3>
3710: </div>
3711: </div>
3712: </div>
3713:
3714: <p>Complete documentation for cdpack is found in the
3715: cdpack(1) manpage. The following short example assumes
1.14 xtraeme 3716: that the binary packages are left in <code class=
3717: "filename">/usr/pkgsrc/packages/All</code> and that
3718: sufficient disk space exists in <code class=
3719: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 3720: <pre class="screen">
1.14 xtraeme 3721: <code class="prompt">#</code> <strong class=
3722: "userinput"><code>mkdir /u2/images</code></strong>
3723: <code class="prompt">#</code> <strong class=
3724: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
3725: <code class="prompt">#</code> <strong class=
3726: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 3727: </pre>
3728:
3729: <p>If you wish to include a common set of files
1.14 xtraeme 3730: (<code class="filename">COPYRIGHT</code>, <code class=
3731: "filename">README</code>, etc.) on each CD in the
1.1 grant 3732: collection, then you need to create a directory which
3733: contains these files. e.g.</p>
3734: <pre class="screen">
1.14 xtraeme 3735: <code class="prompt">#</code> <strong class=
3736: "userinput"><code>mkdir /tmp/common</code></strong>
3737: <code class="prompt">#</code> <strong class=
3738: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
3739: <code class="prompt">#</code> <strong class=
3740: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
3741: <code class="prompt">#</code> <strong class=
3742: "userinput"><code>mkdir /tmp/common/bin</code></strong>
3743: <code class="prompt">#</code> <strong class=
3744: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
3745: <code class="prompt">#</code> <strong class=
3746: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
3747: <code class="prompt">#</code> <strong class=
3748: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 3749: </pre>
3750:
3751: <p>Now create the images:</p>
3752: <pre class="screen">
1.14 xtraeme 3753: <code class="prompt">#</code> <strong class=
3754: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 3755: </pre>
3756:
1.14 xtraeme 3757: <p>Each image will contain <code class=
3758: "filename">README</code>, <code class=
3759: "filename">COPYING</code>, and <code class=
3760: "filename">bin/myscript</code> in their root
1.1 grant 3761: directories.</p>
3762: </div>
3763: </div>
3764: </div>
3765:
3766: <div class="chapter" lang="en" xml:lang="en">
3767: <div class="titlepage">
3768: <div>
3769: <div>
3770: <h2 class="title"><a name="faq" id=
3771: "faq"></a>Chapter 6. Frequently Asked
3772: Questions</h2>
3773: </div>
3774: </div>
3775: </div>
3776:
3777: <div class="toc">
3778: <p><b>Table of Contents</b></p>
3779:
3780: <dl>
1.22 ! tv 3781: <dt><span class="sect1"><a href="#id2578570">6.1. Are
1.18 xtraeme 3782: there any mailing lists for pkg-related
1.1 grant 3783: discussion?</a></span></dt>
3784:
1.22 ! tv 3785: <dt><span class="sect1"><a href="#id2578636">6.2.
1.1 grant 3786: Where's the pkgviews documentation?</a></span></dt>
3787:
1.5 hubertf 3788: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 3789: Utilities for package management
3790: (pkgtools)</a></span></dt>
3791:
1.22 ! tv 3792: <dt><span class="sect1"><a href="#id2578821">6.4. How
1.1 grant 3793: to use pkgsrc as non-root</a></span></dt>
3794:
1.22 ! tv 3795: <dt><span class="sect1"><a href="#id2578833">6.5. How
1.15 xtraeme 3796: to resume transfers when fetching
3797: distfiles?</a></span></dt>
1.14 xtraeme 3798:
1.22 ! tv 3799: <dt><span class="sect1"><a href="#id2578944">6.6. How
1.1 grant 3800: can I install/use XFree86 from pkgsrc?</a></span></dt>
3801:
1.22 ! tv 3802: <dt><span class="sect1"><a href="#id2578971">6.7. How
1.1 grant 3803: can I install/use X.org from pkgsrc?</a></span></dt>
3804:
1.22 ! tv 3805: <dt><span class="sect1"><a href="#id2578999">6.8. How
1.1 grant 3806: to fetch files from behind a firewall</a></span></dt>
3807:
1.22 ! tv 3808: <dt><span class="sect1"><a href="#id2579013">6.9. How
1.14 xtraeme 3809: do I tell <span><strong class="command">make
3810: fetch</strong></span> to do passive
3811: FTP?</a></span></dt>
1.1 grant 3812:
1.22 ! tv 3813: <dt><span class="sect1"><a href="#id2579064">6.10. How
1.1 grant 3814: to fetch all distfiles at once</a></span></dt>
3815:
1.22 ! tv 3816: <dt><span class="sect1"><a href="#id2579204">6.11. What
1.14 xtraeme 3817: does “<span class="quote">Don't know how to make
3818: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 3819: mean?</a></span></dt>
3820:
1.22 ! tv 3821: <dt><span class="sect1"><a href="#id2579242">6.12. What
1.14 xtraeme 3822: does “<span class="quote">Could not find
3823: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 3824:
1.22 ! tv 3825: <dt><span class="sect1"><a href="#id2579300">6.13.
1.1 grant 3826: Using 'sudo' with pkgsrc</a></span></dt>
3827:
1.14 xtraeme 3828: <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1 grant 3829: Configuration files handling and
3830: placement</a></span></dt>
3831:
1.14 xtraeme 3832: <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1 grant 3833: Automated security checks</a></span></dt>
3834: </dl>
3835: </div>
3836:
3837: <p>This section contains hints, tips & tricks on
3838: special things in pkgsrc that we didn't find a better place
3839: for in the previous chapters, and it contains items for
3840: both pkgsrc users and developers.</p>
3841:
3842: <div class="sect1" lang="en" xml:lang="en">
3843: <div class="titlepage">
3844: <div>
3845: <div>
3846: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 3847: "id2578570" id="id2578570"></a>6.1. Are there
1.18 xtraeme 3848: any mailing lists for pkg-related discussion?</h2>
1.1 grant 3849: </div>
3850: </div>
3851: </div>
3852:
1.18 xtraeme 3853: <p>The following mailing lists may be of interest to
3854: pkgsrc users:</p>
3855:
3856: <div class="itemizedlist">
3857: <ul type="disc">
3858: <li>
3859: <p><a href=
3860: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.20 ben 3861: target="_top">pkgsrc-bugs</a> -- a list where
3862: problem reports related to pkgsrc are sent and
3863: discussed</p>
1.18 xtraeme 3864: </li>
3865:
3866: <li>
3867: <p><a href=
3868: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.20 ben 3869: target="_top">pkgsrc-bulk</a> -- a list where the
3870: results of pkgsrc bulk builds are sent and
3871: discussed</p>
1.18 xtraeme 3872: </li>
3873:
3874: <li>
3875: <p><a href=
3876: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.20 ben 3877: target="_top">pkgsrc-changes</a> -- a list where
3878: all commit messages to pkgsrc are sent</p>
1.18 xtraeme 3879: </li>
3880:
3881: <li>
3882: <p><a href=
3883: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.20 ben 3884: target="_top">tech-pkg</a> -- a general discussion
3885: list for all things related to pkgsrc</p>
1.18 xtraeme 3886: </li>
3887: </ul>
3888: </div>
3889:
3890: <p>To subscribe, do:</p>
1.1 grant 3891: <pre class="programlisting">
1.18 xtraeme 3892: <code class="prompt">%</code> echo subscribe <em class=
3893: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 3894: </pre>
3895:
1.18 xtraeme 3896: <p>Archives for all these mailing lists are available
3897: from <a href="http://mail-index.NetBSD.org/" target=
3898: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 3899: </div>
3900:
3901: <div class="sect1" lang="en" xml:lang="en">
3902: <div class="titlepage">
3903: <div>
3904: <div>
3905: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 3906: "id2578636" id="id2578636"></a>6.2. Where's
1.1 grant 3907: the pkgviews documentation?</h2>
3908: </div>
3909: </div>
3910: </div>
3911:
3912: <p>Pkgviews is tightly integrated with buildlink. You can
1.14 xtraeme 3913: find a pkgviews User's guide in <code class=
3914: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 3915: </div>
3916:
3917: <div class="sect1" lang="en" xml:lang="en">
3918: <div class="titlepage">
3919: <div>
3920: <div>
3921: <h2 class="title" style="clear: both"><a name=
1.5 hubertf 3922: "faq-pkgtools" id=
3923: "faq-pkgtools"></a>6.3. Utilities for package
3924: management (pkgtools)</h2>
1.1 grant 3925: </div>
3926: </div>
3927: </div>
3928:
1.14 xtraeme 3929: <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1 grant 3930: directory pkgtools contains a number of useful utilities
3931: for both users and developers of pkgsrc. This section
3932: attempts only to make the reader aware of the utilities
3933: and when they might be useful, and not to duplicate the
3934: documentation that comes with each package.</p>
3935:
3936: <p>Utilities used by pkgsrc (automatically installed when
3937: needed):</p>
3938:
3939: <div class="itemizedlist">
3940: <ul type="disc">
3941: <li>
3942: <p><a xmlns=
3943: "http://www.w3.org/TR/xhtml1/transitional" href=
3944: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.20 ben 3945: class="pkgname">pkgtools/x11-links</a>: symlinks
3946: for use by buildlink</p>
1.1 grant 3947: </li>
3948: </ul>
3949: </div>
3950:
3951: <p>OS tool augmentation (automatically installed when
3952: needed):</p>
3953:
3954: <div class="itemizedlist">
3955: <ul type="disc">
3956: <li>
3957: <p><a xmlns=
3958: "http://www.w3.org/TR/xhtml1/transitional" href=
3959: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20 ben 3960: class="pkgname">pkgtools/digest</a>: calculates
3961: SHA1 checksums (and other kinds)</p>
1.1 grant 3962: </li>
3963:
3964: <li>
3965: <p><a xmlns=
3966: "http://www.w3.org/TR/xhtml1/transitional" href=
3967: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.20 ben 3968: class="pkgname">pkgtools/libnbcompat</a>: compat
3969: library for pkg tools</p>
1.1 grant 3970: </li>
3971:
3972: <li>
3973: <p><a xmlns=
3974: "http://www.w3.org/TR/xhtml1/transitional" href=
3975: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.20 ben 3976: class="pkgname">pkgtools/mtree</a>: installed on
3977: non-BSD systems due to lack of native mtree</p>
1.1 grant 3978: </li>
3979:
3980: <li>
3981: <p><a xmlns=
3982: "http://www.w3.org/TR/xhtml1/transitional" href=
3983: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 3984: class="pkgname">pkgtools/pkg_install</a>:
3985: up-to-date replacement for /usr/sbin/pkg_install,
3986: or for use on operating systems where pkg_install
3987: is not present</p>
1.1 grant 3988: </li>
3989: </ul>
3990: </div>
3991:
3992: <p>Utilities used by pkgsrc (not automatically
3993: installed):</p>
3994:
3995: <div class="itemizedlist">
3996: <ul type="disc">
3997: <li>
3998: <p><a xmlns=
3999: "http://www.w3.org/TR/xhtml1/transitional" href=
4000: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.20 ben 4001: class="pkgname">pkgtools/pkg_tarup</a>: create a
4002: binary package from an already-installed package.
4003: used by 'make replace' to save the old package</p>
1.1 grant 4004: </li>
4005:
4006: <li>
4007: <p><a xmlns=
4008: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 4009: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.20 ben 4010: class="pkgname">pkgtools/dfdisk</a>: adds extra
4011: functionality to pkgsrc, allowing it to fetch
4012: distfiles from multiple locations. It currently
4013: supports the following methods: multiple CD-ROMs
4014: and network FTP/HTTP connections.</p>
1.5 hubertf 4015: </li>
4016:
4017: <li>
4018: <p><a xmlns=
4019: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4020: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20 ben 4021: class="pkgname">pkgtools/xpkgwedge</a>: put X11
4022: packages someplace else (enabled by default)</p>
1.1 grant 4023: </li>
1.5 hubertf 4024:
4025: <li>
4026: <p><a xmlns=
4027: "http://www.w3.org/TR/xhtml1/transitional" href=
4028: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20 ben 4029: class="pkgname">devel/cpuflags</a>: will determine
4030: the best compiler flags to optimise code for your
4031: current CPU and compiler.</p>
1.5 hubertf 4032: </li>
1.1 grant 4033: </ul>
4034: </div>
4035:
4036: <p>Utilities for keeping track of installed packages,
4037: being up to date, etc:</p>
4038:
4039: <div class="itemizedlist">
4040: <ul type="disc">
4041: <li>
4042: <p><a xmlns=
4043: "http://www.w3.org/TR/xhtml1/transitional" href=
4044: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.20 ben 4045: class="pkgname">pkgtools/pkg_chk</a>: installs
4046: pkg_chk, which reports on packages whose installed
4047: versions do not match the latest pkgsrc entries</p>
1.1 grant 4048: </li>
4049:
4050: <li>
4051: <p><a xmlns=
4052: "http://www.w3.org/TR/xhtml1/transitional" href=
4053: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.20 ben 4054: class="pkgname">pkgtools/pkgdep</a>: makes
4055: dependency graphs of packages, to aid in choosing a
4056: strategy for updating</p>
1.1 grant 4057: </li>
4058:
4059: <li>
4060: <p><a xmlns=
4061: "http://www.w3.org/TR/xhtml1/transitional" href=
4062: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.20 ben 4063: class="pkgname">pkgtools/pkgdepgraph</a>: make
4064: graph from above (uses graphviz)</p>
1.1 grant 4065: </li>
4066:
4067: <li>
4068: <p><a xmlns=
4069: "http://www.w3.org/TR/xhtml1/transitional" href=
4070: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 4071: class="pkgname">pkgtools/pkglint</a>: This provides
4072: two distinct abilities: check a pkgsrc entry for
4073: correctness (pkglint) check for and remove
4074: out-of-date distfiles and binary packages
4075: (lintpkgsrc)</p>
1.1 grant 4076: </li>
4077:
4078: <li>
4079: <p><a xmlns=
4080: "http://www.w3.org/TR/xhtml1/transitional" href=
4081: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.20 ben 4082: class="pkgname">pkgtools/pkgsurvey</a>: report what
4083: packages you have installed</p>
1.1 grant 4084: </li>
4085: </ul>
4086: </div>
4087:
4088: <p>Utilities for people maintaining or creating
4089: individual packages:</p>
4090:
4091: <div class="itemizedlist">
4092: <ul type="disc">
4093: <li>
4094: <p><a xmlns=
4095: "http://www.w3.org/TR/xhtml1/transitional" href=
4096: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 4097: class="pkgname">pkgtools/pkgdiff</a>: automate
4098: making and maintaining patches for a package
4099: (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1 grant 4100: </li>
4101:
4102: <li>
4103: <p><a xmlns=
4104: "http://www.w3.org/TR/xhtml1/transitional" href=
4105: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.20 ben 4106: class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
4107: "http://www.w3.org/TR/xhtml1/transitional" href=
4108: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
4109: class="pkgname">pkgtools/url2pkg</a>: aids in
4110: converting to pkgsrc</p>
1.1 grant 4111: </li>
4112:
4113: <li>
4114: <p><a xmlns=
4115: "http://www.w3.org/TR/xhtml1/transitional" href=
4116: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.20 ben 4117: class="pkgname">pkgtools/gensolpkg</a>: convert
4118: pkgsrc to a Solaris package</p>
1.1 grant 4119: </li>
4120: </ul>
4121: </div>
4122:
4123: <p>Utilities for people maintaining pkgsrc (or more
4124: obscure pkg utilities)</p>
4125:
4126: <div class="itemizedlist">
4127: <ul type="disc">
4128: <li>
4129: <p><a xmlns=
4130: "http://www.w3.org/TR/xhtml1/transitional" href=
4131: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.20 ben 4132: class="pkgname">pkgtools/pkgconflict</a>: find
4133: packages that conflict but aren't marked as
4134: such</p>
1.1 grant 4135: </li>
4136:
4137: <li>
4138: <p><a xmlns=
4139: "http://www.w3.org/TR/xhtml1/transitional" href=
4140: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.20 ben 4141: class="pkgname">pkgtools/pkg_comp</a>: build
4142: packages in a chrooted area</p>
1.1 grant 4143: </li>
4144:
4145: <li>
4146: <p><a xmlns=
4147: "http://www.w3.org/TR/xhtml1/transitional" href=
4148: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.20 ben 4149: class="pkgname">pkgtools/libkver</a>: spoof kernel
4150: version for chrooted cross builds</p>
1.1 grant 4151: </li>
4152: </ul>
4153: </div>
4154: </div>
4155:
4156: <div class="sect1" lang="en" xml:lang="en">
4157: <div class="titlepage">
4158: <div>
4159: <div>
4160: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 4161: "id2578821" id="id2578821"></a>6.4. How to use
1.1 grant 4162: pkgsrc as non-root</h2>
4163: </div>
4164: </div>
4165: </div>
4166:
4167: <p>If you want to use pkgsrc as non-root user, you can
4168: set some variables to make pkgsrc work under these
4169: conditions. Please see <a href=
4170: "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.20 ben 4171: target="_top">this message</a> for more details.</p>
1.14 xtraeme 4172: </div>
4173:
4174: <div class="sect1" lang="en" xml:lang="en">
4175: <div class="titlepage">
4176: <div>
4177: <div>
4178: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 4179: "id2578833" id="id2578833"></a>6.5. How to
1.15 xtraeme 4180: resume transfers when fetching distfiles?</h2>
1.14 xtraeme 4181: </div>
4182: </div>
4183: </div>
4184:
1.15 xtraeme 4185: <p>By default resuming transfers in pkgsrc is disabled,
4186: but you can enable this feature by adding the option
4187: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
4188: into <code class="filename">/etc/mk.conf</code>. If,
4189: during a fetch step, an incomplete distfile is found,
4190: pkgsrc will try to resume it.</p>
4191:
4192: <p>You can also use a different program than the default
4193: ftp(1) by changing the <code class=
4194: "varname">FETCH_CMD</code> variable. Don't forget to set
4195: <code class="varname">FETCH_RESUME_ARGS</code> and
4196: <code class="varname">FETCH_OUTPUT_ARGS</code> if you are
4197: not using default values.</p>
1.14 xtraeme 4198:
4199: <p>For example, if you want to use <code class=
4200: "filename">wget</code> to resume downloads, you'll have
4201: to use something like:</p>
4202: <pre class="programlisting">
4203: FETCH_CMD=wget
4204: .if defined(FETCH_CMD) && ${FETCH_CMD} == "wget"
4205: FETCH_BEFORE_ARGS=--passive-ftp
4206: FETCH_RESUME_ARGS=-c
4207: FETCH_OUTPUT_ARGS=-O
4208: .endif
4209:
4210: </pre>
1.1 grant 4211: </div>
4212:
4213: <div class="sect1" lang="en" xml:lang="en">
4214: <div class="titlepage">
4215: <div>
4216: <div>
4217: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 4218: "id2578944" id="id2578944"></a>6.6. How can I
1.1 grant 4219: install/use XFree86 from pkgsrc?</h2>
4220: </div>
4221: </div>
4222: </div>
4223:
4224: <p>If you want to use XFree86 from pkgsrc instead of your
1.14 xtraeme 4225: system's own X11 (<code class=
4226: "filename">/usr/X11R6</code>, <code class=
4227: "filename">/usr/openwin</code>, ...), you will have to
4228: add the following line into <code class=
1.15 xtraeme 4229: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4230: <pre class="programlisting">
4231: X11_TYPE=XFree86
4232:
4233: </pre>
4234: </div>
4235:
4236: <div class="sect1" lang="en" xml:lang="en">
4237: <div class="titlepage">
4238: <div>
4239: <div>
4240: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 4241: "id2578971" id="id2578971"></a>6.7. How can I
1.1 grant 4242: install/use X.org from pkgsrc?</h2>
4243: </div>
4244: </div>
4245: </div>
4246:
4247: <p>If you want to use X.org from pkgsrc instead of your
1.14 xtraeme 4248: system's own X11 (<code class=
4249: "filename">/usr/X11R6</code>, <code class=
4250: "filename">/usr/openwin</code>, ...) you will have to add
4251: the following line into <code class=
1.15 xtraeme 4252: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4253: <pre class="programlisting">
4254: X11_TYPE=xorg
4255:
4256: </pre>
4257: </div>
4258:
4259: <div class="sect1" lang="en" xml:lang="en">
4260: <div class="titlepage">
4261: <div>
4262: <div>
4263: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 4264: "id2578999" id="id2578999"></a>6.8. How to
1.1 grant 4265: fetch files from behind a firewall</h2>
4266: </div>
4267: </div>
4268: </div>
4269:
4270: <p>If you are sitting behind a firewall which does not
4271: allow direct connections to Internet hosts (i.e.
4272: non-NAT), you may specify the relevant proxy hosts. This
4273: is done using an environment variable in the form of a
4274: URL e.g. in Amdahl, the machine “<span class=
4275: "quote">orpheus.amdahl.com</span>” is one of the
4276: firewalls, and it uses port 80 as the proxy port number.
4277: So the proxy environment variables are:</p>
4278: <pre class="programlisting">
4279: ftp_proxy=ftp://orpheus.amdahl.com:80/
4280: http_proxy=http://orpheus.amdahl.com:80/
4281: </pre>
4282: </div>
4283:
4284: <div class="sect1" lang="en" xml:lang="en">
4285: <div class="titlepage">
4286: <div>
4287: <div>
4288: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 4289: "id2579013" id="id2579013"></a>6.9. How do I
1.14 xtraeme 4290: tell <span><strong class="command">make
4291: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 4292: </div>
4293: </div>
4294: </div>
4295:
4296: <p>This depends on which utility is used to retrieve
1.14 xtraeme 4297: distfiles. From <code class="filename">bsd.pkg.mk</code>,
4298: <code class="varname">FETCH_CMD</code> is assigned the
4299: first available command from the following list:</p>
1.1 grant 4300: <pre class="programlisting">
4301: ${LOCALBASE}/bin/ftp
4302: /usr/bin/ftp
4303: </pre>
4304:
4305: <p>On a default NetBSD installation, this will be
1.14 xtraeme 4306: <code class="filename">/usr/bin/ftp</code>, which
1.1 grant 4307: automatically tries passive connections first, and falls
4308: back to active connections if the server refuses to do
4309: passive. For the other tools, add the following to your
1.14 xtraeme 4310: <code class="filename">/etc/mk.conf</code> file:
4311: <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 4312:
1.14 xtraeme 4313: <p>Having that option present will prevent <code class=
4314: "filename">/usr/bin/ftp</code> from falling back to
4315: active transfers.</p>
1.1 grant 4316: </div>
4317:
4318: <div class="sect1" lang="en" xml:lang="en">
4319: <div class="titlepage">
4320: <div>
4321: <div>
4322: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 4323: "id2579064" id="id2579064"></a>6.10. How to
1.1 grant 4324: fetch all distfiles at once</h2>
4325: </div>
4326: </div>
4327: </div>
4328:
4329: <p>You would like to download all the distfiles in a
4330: single batch from work or university, where you can't run
1.14 xtraeme 4331: a <span><strong class="command">make
4332: fetch</strong></span>. There is an archive of distfiles
4333: on <a href=
1.1 grant 4334: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
4335: target="_top">ftp.NetBSD.org</a>, but downloading the
4336: entire directory may not be appropriate.</p>
4337:
1.14 xtraeme 4338: <p>The answer here is to do a <span><strong class=
4339: "command">make fetch-list</strong></span> in <code class=
4340: "filename">/usr/pkgsrc</code> or one of it's
1.1 grant 4341: subdirectories, carry the resulting list to your machine
4342: at work/school and use it there If you don't have a
4343: NetBSD-compatible ftp(1) (like lukemftp) at work, don't
1.14 xtraeme 4344: forget to set <code class="varname">FETCH_CMD</code> to
1.1 grant 4345: something that fetches a URL:</p>
4346:
4347: <p>At home:</p>
4348: <pre class="screen">
1.14 xtraeme 4349: <code class="prompt">%</code> <strong class=
4350: "userinput"><code>cd /usr/pkgsrc</code></strong>
4351: <code class="prompt">%</code> <strong class=
4352: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
4353: <code class="prompt">%</code> <strong class=
4354: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 4355: </pre>
4356:
4357: <p>At work:</p>
4358: <pre class="screen">
1.14 xtraeme 4359: <code class="prompt">%</code> <strong class=
4360: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 4361: </pre>
4362:
1.14 xtraeme 4363: <p>then tar up <code class=
4364: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 4365:
4366: <p>If you have a machine running NetBSD, and you want to
4367: get <span class="emphasis"><em>all</em></span> distfiles
4368: (even ones that aren't for your machine architecture),
4369: you can do so by using the above-mentioned
1.14 xtraeme 4370: <span><strong class="command">make
4371: fetch-list</strong></span> approach, or fetch the
4372: distfiles directly by running:</p>
1.1 grant 4373: <pre class="screen">
1.14 xtraeme 4374: <code class="prompt">%</code> <strong class=
4375: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 4376: </pre>
4377:
1.14 xtraeme 4378: <p>If you even decide to ignore <code class=
4379: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
4380: can get everything by running:</p>
1.1 grant 4381: <pre class="screen">
1.14 xtraeme 4382: <code class="prompt">%</code> <strong class=
4383: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 4384: </pre>
4385: </div>
4386:
4387: <div class="sect1" lang="en" xml:lang="en">
4388: <div class="titlepage">
4389: <div>
4390: <div>
4391: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 4392: "id2579204" id="id2579204"></a>6.11. What does
1.1 grant 4393: “<span class="quote">Don't know how to make
4394: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
4395: </div>
4396: </div>
4397: </div>
4398:
4399: <p>When compiling the <a xmlns=
4400: "http://www.w3.org/TR/xhtml1/transitional" href=
4401: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4402: class="pkgname">pkgtools/pkg_install</a> package, you get
4403: the error from make that it doesn't know how to make
4404: <code class="filename">/usr/share/tmac/tmac.andoc</code>?
4405: This indicates that you don't have installed the
4406: “<span class="quote">text</span>” set on your
4407: machine (nroff, ...). It is recommended to do that to
4408: format manpages.</p>
1.1 grant 4409:
4410: <p>In the case of the <a xmlns=
4411: "http://www.w3.org/TR/xhtml1/transitional" href=
4412: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4413: class="pkgname">pkgtools/pkg_install</a> package, you can
4414: get away with setting <code class=
4415: "varname">NOMAN=YES</code> either in the environment or
4416: in <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 4417: </div>
4418:
4419: <div class="sect1" lang="en" xml:lang="en">
4420: <div class="titlepage">
4421: <div>
4422: <div>
4423: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 4424: "id2579242" id="id2579242"></a>6.12. What does
1.1 grant 4425: “<span class="quote">Could not find
4426: bsd.own.mk</span>” mean?</h2>
4427: </div>
4428: </div>
4429: </div>
4430:
1.14 xtraeme 4431: <p>You didn't install the compiler set, <code class=
4432: "filename">comp.tgz</code>, when you installed your
4433: NetBSD machine. Please get it and install it, by
4434: extracting it in <code class="filename">/</code>:</p>
1.1 grant 4435: <pre class="screen">
1.14 xtraeme 4436: <code class="prompt">#</code> <strong class=
4437: "userinput"><code>cd /</code></strong>
4438: <code class="prompt">#</code> <strong class=
4439: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 4440: </pre>
4441:
1.14 xtraeme 4442: <p><code class="filename">comp.tgz</code> is part of
4443: every NetBSD release. Get the one that corresponds to
4444: your release (determine via <span><strong class=
4445: "command">uname -r</strong></span>).</p>
1.1 grant 4446: </div>
4447:
4448: <div class="sect1" lang="en" xml:lang="en">
4449: <div class="titlepage">
4450: <div>
4451: <div>
4452: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 4453: "id2579300" id="id2579300"></a>6.13. Using
1.1 grant 4454: 'sudo' with pkgsrc</h2>
4455: </div>
4456: </div>
4457: </div>
4458:
4459: <p>When installing packages as non-root user and using
4460: the just-in-time su(1) feature of pkgsrc, it can become
4461: annoying to type in the root password for each required
4462: package installed. To avoid this, the sudo package can be
4463: used, which does password caching over a limited time. To
4464: use it, install sudo (either as binary package or from
4465: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
4466: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.20 ben 4467: class="pkgname">security/sudo</a>) and then put the
4468: following into your <code class=
4469: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4470: <pre class="programlisting">
4471: .if exists(/usr/pkg/bin/sudo)
4472: SU_CMD=/usr/pkg/bin/sudo /bin/sh -c
4473: .endif
4474:
4475: </pre>
4476: </div>
4477:
4478: <div class="sect1" lang="en" xml:lang="en">
4479: <div class="titlepage">
4480: <div>
4481: <div>
4482: <h2 class="title" style="clear: both"><a name=
4483: "faq.conf" id=
1.14 xtraeme 4484: "faq.conf"></a>6.14. Configuration files
1.1 grant 4485: handling and placement</h2>
4486: </div>
4487: </div>
4488: </div>
4489:
1.14 xtraeme 4490: <p>The global variable <code class=
4491: "varname">PKG_SYSCONFBASE</code> (and some others) can be
4492: set by the system administrator in <code class=
4493: "filename">/etc/mk.conf</code> to define the place where
1.1 grant 4494: configuration files get installed. Therefore, packages
4495: must be adapted to support this feature. Keep in mind
4496: that you should only install files that are strictly
4497: necessary in the configuration directory, files that can
1.14 xtraeme 4498: go to <code class="filename">$PREFIX/share</code> should
4499: go there.</p>
1.1 grant 4500:
4501: <p>We will take a look at available variables first
1.14 xtraeme 4502: (<code class="filename">bsd.pkg.mk</code> contains more
4503: information). <code class="varname">PKG_SYSCONFDIR</code>
4504: is where the configuration files for a package may be
4505: found (that is, the full path, e.g. <code class=
4506: "filename">/etc</code> or <code class=
4507: "filename">/usr/pkg/etc</code>). This value may be
1.1 grant 4508: customized in various ways:</p>
4509:
4510: <div class="orderedlist">
4511: <ol type="1">
4512: <li>
1.14 xtraeme 4513: <p><code class="varname">PKG_SYSCONFBASE</code> is
4514: the main config directory under which all package
1.1 grant 4515: configuration files are to be found. Users will
1.14 xtraeme 4516: typically want to set it to <code class=
4517: "filename">/etc</code>, or accept the default
4518: location of <code class=
4519: "filename">$PREFIX/etc</code>.</p>
1.1 grant 4520: </li>
4521:
4522: <li>
1.14 xtraeme 4523: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
4524: is the subdirectory of <code class=
4525: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 4526: configuration files for a particular package may be
1.14 xtraeme 4527: found. Defaults to <code class=
4528: "varname">${SYSCONFBASE}</code>.</p>
1.1 grant 4529: </li>
4530:
4531: <li>
1.14 xtraeme 4532: <p><code class="varname">PKG_SYSCONFVAR</code> is
4533: the special suffix used to distinguish any
4534: overriding values for a particular package (see
4535: next item). It defaults to <code class=
4536: "varname">${PKGBASE}</code>, but for a collection
4537: of related packages that should all have the same
4538: <code class="varname">PKG_SYSCONFDIR</code> value,
4539: it can be set in each of the package Makefiles to a
4540: common value.</p>
1.1 grant 4541: </li>
4542:
4543: <li>
1.14 xtraeme 4544: <p><code class=
4545: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
4546: overrides the value of <code class=
4547: "varname">${PKG_SYSCONFDIR}</code> for packages
4548: with the same value for <code class=
4549: "varname">PKG_SYSCONFVAR</code>.</p>
1.1 grant 4550:
4551: <p>As an example, all the various KDE packages may
1.14 xtraeme 4552: want to set <code class=
4553: "varname">PKG_SYSCONFVAR</code> to
4554: “<span class="quote">kde</span>” so
4555: admins can set <code class=
4556: "varname">PKG_SYSCONFDIR.kde</code> in <code class=
4557: "filename">/etc/mk.conf</code> to define where to
1.1 grant 4558: install KDE config files.</p>
4559: </li>
4560: </ol>
4561: </div>
4562:
4563: <p>Programs' configuration directory should be defined
4564: during the configure stage. Packages that use GNU
4565: autoconf can usually do this by using the
4566: “<span class="quote">--sysconfdir</span>”
4567: parameter, but this brings some problems as we will see
4568: now. When you change this pathname in packages, you
4569: should not allow them to install files in that directory
4570: directly. Instead they need to install those files under
1.14 xtraeme 4571: <code class="filename">share/examples/${PKGNAME}</code>
4572: so <code class="filename">PLIST</code> can register
4573: them.</p>
1.1 grant 4574:
4575: <p>Once you have the required configuration files in
1.14 xtraeme 4576: place (under the <code class=
4577: "filename">share/examples</code> directory) the variable
4578: <code class="varname">CONF_FILES</code> should be set to
4579: copy them into <code class=
4580: "varname">PKG_SYSCONFDIR</code>. The contents of this
4581: variable is formed by pairs of filenames; the first
1.1 grant 4582: element of the pair specifies the file inside the
1.14 xtraeme 4583: examples directory (registered by <code class=
4584: "filename">PLIST</code>) and the second element specifies
1.1 grant 4585: the target file. This is done this way to allow binary
4586: packages to place files in the right directory using
1.14 xtraeme 4587: <code class="filename">INSTALL</code>/<code class=
4588: "filename">DEINSTALL</code> scripts which are created
4589: automatically. The package <code class=
4590: "filename">Makefile</code> must also set <code class=
4591: "varname">USE_PKGINSTALL=YES</code> to use these
1.1 grant 4592: automatically generated scripts. The automatic copying of
4593: config files can be toggled by setting the environment
1.14 xtraeme 4594: variable <code class="varname">PKG_CONFIG</code> prior to
1.1 grant 4595: package installation.</p>
4596:
4597: <p>Here is an example, taken from mail/mutt/Makefile:</p>
4598: <pre class="programlisting">
4599: EGDIR= ${PREFIX}/share/doc/mutt/samples
4600: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
4601: </pre>
4602:
4603: <p>As you can see, this package installs configuration
1.14 xtraeme 4604: files inside <code class="varname">EGDIR</code>, which
4605: are registered by <code class="filename">PLIST</code>.
4606: After that, the variable <code class=
4607: "varname">CONF_FILES</code> lists the installed file
4608: first and then the target file. Users will also get an
4609: automatic message when files are installed using this
4610: method.</p>
1.1 grant 4611: </div>
4612:
4613: <div class="sect1" lang="en" xml:lang="en">
4614: <div class="titlepage">
4615: <div>
4616: <div>
4617: <h2 class="title" style="clear: both"><a name=
4618: "audit-packages" id=
1.14 xtraeme 4619: "audit-packages"></a>6.15. Automated security
1.1 grant 4620: checks</h2>
4621: </div>
4622: </div>
4623: </div>
4624:
4625: <p>Please be aware that there can often be bugs in
4626: third-party software, and some of these bugs can leave a
4627: machine vulnerable to exploitation by attackers. In an
4628: effort to lessen the exposure, the NetBSD packages team
4629: maintains a database of known-exploits to packages which
4630: have at one time been included in pkgsrc. The database
4631: can be downloaded automatically, and a security audit of
4632: all packages installed on a system can take place. To do
4633: this, install the <a xmlns=
4634: "http://www.w3.org/TR/xhtml1/transitional" href=
4635: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.20 ben 4636: class="pkgname">security/audit-packages</a> package. It
4637: has two components:</p>
1.1 grant 4638:
4639: <div class="orderedlist">
4640: <ol type="1">
4641: <li>
4642: <p>“<span class=
4643: "quote">download-vulnerability-list</span>”,
4644: an easy way to download a list of the security
4645: vulnerabilities information. This list is kept up
4646: to date by the NetBSD security officer and the
4647: NetBSD packages team, and is distributed from the
4648: NetBSD ftp server:</p>
4649:
4650: <p><a href=
4651: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 4652: target=
4653: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 4654: </li>
4655:
4656: <li>
4657: <p>“<span class=
4658: "quote">audit-packages</span>”, an easy way
4659: to audit the current machine, checking each
4660: vulnerability which is known. If a vulnerable
4661: package is installed, it will be shown by output to
4662: stdout, including a description of the type of
4663: vulnerability, and a URL containing more
4664: information.</p>
4665: </li>
4666: </ol>
4667: </div>
4668:
4669: <p>Use of the audit-packages package is strongly
4670: recommended!</p>
4671:
4672: <p>The following message is displayed as part of the
4673: audit-packages installation procedure:</p>
4674: <pre class="screen">
4675: ===========================================================================
1.18 xtraeme 4676: $NetBSD: faq.xml,v 1.5 2005/02/24 14:24:32 jschauma Exp $
1.1 grant 4677:
4678: You may wish to have the vulnerabilities file downloaded daily so that
4679: it remains current. This may be done by adding an appropriate entry
4680: to the root users crontab(5) entry. For example the entry
4681:
4682: # download vulnerabilities file
4683: 0 3 * * * ${PREFIX}/sbin/download-vulnerability-list >/dev/null 2>&1
4684:
4685: will update the vulnerability list every day at 3AM. You may wish to do
4686: this more often than once a day.
4687:
4688: In addition, you may wish to run the package audit from the daily
4689: security script. This may be accomplished by adding the following
4690: lines to /etc/security.local
4691:
4692: if [ -x ${PREFIX}/sbin/audit-packages ]; then
4693: ${PREFIX}/sbin/audit-packages
4694: fi
4695:
4696: ===========================================================================
4697:
4698: </pre>
4699: </div>
4700: </div>
4701: </div>
4702:
4703: <div class="part" lang="en" xml:lang="en">
4704: <div class="titlepage">
4705: <div>
4706: <div>
4707: <h1 class="title"><a name="developers-guide" id=
1.2 hubertf 4708: "developers-guide"></a>The pkgsrc developer's
4709: guide</h1>
1.1 grant 4710: </div>
4711: </div>
4712: </div>
4713:
4714: <div class="toc">
4715: <p><b>Table of Contents</b></p>
4716:
4717: <dl>
4718: <dt><span class="chapter"><a href="#components">7.
4719: Package components - files, directories and
4720: contents</a></span></dt>
4721:
4722: <dd>
4723: <dl>
4724: <dt><span class="sect1"><a href=
1.14 xtraeme 4725: "#components.Makefile">7.1. <code class=
4726: "filename">Makefile</code></a></span></dt>
1.1 grant 4727:
4728: <dt><span class="sect1"><a href=
1.14 xtraeme 4729: "#components.distinfo">7.2. <code class=
4730: "filename">distinfo</code></a></span></dt>
1.1 grant 4731:
4732: <dt><span class="sect1"><a href=
4733: "#components.patches">7.3. patches/*</a></span></dt>
4734:
1.22 ! tv 4735: <dt><span class="sect1"><a href="#id2580482">7.4.
1.1 grant 4736: Other mandatory files</a></span></dt>
4737:
4738: <dt><span class="sect1"><a href=
4739: "#components.optional">7.5. Optional
4740: files</a></span></dt>
4741:
1.22 ! tv 4742: <dt><span class="sect1"><a href="#id2580608">7.6.
1.14 xtraeme 4743: <code class="filename">work*</code></a></span></dt>
1.1 grant 4744:
1.22 ! tv 4745: <dt><span class="sect1"><a href="#id2580763">7.7.
1.14 xtraeme 4746: <code class="filename">files/*</code></a></span></dt>
1.1 grant 4747: </dl>
4748: </dd>
4749:
4750: <dt><span class="chapter"><a href="#plist">8. PLIST
4751: issues</a></span></dt>
4752:
4753: <dd>
4754: <dl>
1.22 ! tv 4755: <dt><span class="sect1"><a href="#id2580818">8.1. RCS
1.1 grant 4756: ID</a></span></dt>
4757:
1.22 ! tv 4758: <dt><span class="sect1"><a href="#id2580901">8.2.
1.14 xtraeme 4759: Semi-automatic <code class="filename">PLIST</code>
4760: generation</a></span></dt>
1.1 grant 4761:
4762: <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14 xtraeme 4763: Tweaking output of <span><strong class="command">make
4764: print-PLIST</strong></span></a></span></dt>
1.1 grant 4765:
4766: <dt><span class="sect1"><a href="#plist.misc">8.4.
4767: Variable substitution in PLIST</a></span></dt>
4768:
1.22 ! tv 4769: <dt><span class="sect1"><a href="#id2581290">8.5.
1.1 grant 4770: Manpage-compression</a></span></dt>
4771:
1.22 ! tv 4772: <dt><span class="sect1"><a href="#id2581332">8.6.
1.14 xtraeme 4773: Changing PLIST source with <code class=
4774: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 4775:
1.22 ! tv 4776: <dt><span class="sect1"><a href="#id2581349">8.7.
1.1 grant 4777: Platform specific and differing
4778: PLISTs</a></span></dt>
4779:
4780: <dt><span class="sect1"><a href=
4781: "#faq.common-dirs">8.8. Sharing directories between
4782: packages</a></span></dt>
4783: </dl>
4784: </dd>
4785:
4786: <dt><span class="chapter"><a href="#buildlink">9.
4787: Buildlink methodology</a></span></dt>
4788:
4789: <dd>
4790: <dl>
1.22 ! tv 4791: <dt><span class="sect1"><a href="#id2581547">9.1.
1.1 grant 4792: Converting packages to use buildlink3</a></span></dt>
4793:
1.22 ! tv 4794: <dt><span class="sect1"><a href="#id2581865">9.2.
1.14 xtraeme 4795: Writing <code class="filename">buildlink3.mk</code>
4796: files</a></span></dt>
1.1 grant 4797:
4798: <dd>
4799: <dl>
4800: <dt><span class="sect2"><a href=
1.22 ! tv 4801: "#id2581934">9.2.1. Anatomy of a buildlink3.mk
1.1 grant 4802: file</a></span></dt>
4803:
4804: <dt><span class="sect2"><a href=
1.22 ! tv 4805: "#id2582307">9.2.2. Updating <code class=
1.14 xtraeme 4806: "varname">BUILDLINK_DEPENDS.<em class=
4807: "replaceable"><code>pkg</code></em></code> in
4808: <code class="filename">buildlink3.mk</code>
1.1 grant 4809: files</a></span></dt>
4810: </dl>
4811: </dd>
4812:
1.22 ! tv 4813: <dt><span class="sect1"><a href="#id2582386">9.3.
1.14 xtraeme 4814: Writing <code class="filename">builtin.mk</code>
4815: files</a></span></dt>
1.1 grant 4816:
4817: <dd>
4818: <dl>
4819: <dt><span class="sect2"><a href=
1.22 ! tv 4820: "#id2582603">9.3.1. Anatomy of a <code class=
1.14 xtraeme 4821: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 4822:
4823: <dt><span class="sect2"><a href=
1.22 ! tv 4824: "#id2582830">9.3.2. Global preferences for native
1.1 grant 4825: or pkgsrc software</a></span></dt>
4826: </dl>
4827: </dd>
4828: </dl>
4829: </dd>
4830:
4831: <dt><span class="chapter"><a href="#options">10. Options
4832: handling</a></span></dt>
4833:
4834: <dd>
4835: <dl>
1.22 ! tv 4836: <dt><span class="sect1"><a href="#id2582903">10.1.
1.1 grant 4837: Global default options</a></span></dt>
4838:
1.22 ! tv 4839: <dt><span class="sect1"><a href="#id2582918">10.2.
1.14 xtraeme 4840: Converting packages to use <code class=
4841: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 4842: </dl>
4843: </dd>
4844:
4845: <dt><span class="chapter"><a href="#build">11. The build
4846: process</a></span></dt>
4847:
4848: <dd>
4849: <dl>
4850: <dt><span class="sect1"><a href="#build.prefix">11.1.
4851: Program location</a></span></dt>
4852:
1.22 ! tv 4853: <dt><span class="sect1"><a href="#id2583526">11.2.
1.1 grant 4854: Main targets</a></span></dt>
4855:
4856: <dt><span class="sect1"><a href=
4857: "#build.helpful-targets">11.3. Other helpful
4858: targets</a></span></dt>
4859: </dl>
4860: </dd>
4861:
4862: <dt><span class="chapter"><a href="#fixes">12. Notes on
4863: fixes for packages</a></span></dt>
4864:
4865: <dd>
4866: <dl>
1.22 ! tv 4867: <dt><span class="sect1"><a href="#id2585063">12.1.
1.1 grant 4868: General operation</a></span></dt>
4869:
4870: <dd>
4871: <dl>
4872: <dt><span class="sect2"><a href=
1.22 ! tv 4873: "#id2585066">12.1.1. How to pull in variables
1.1 grant 4874: from /etc/mk.conf</a></span></dt>
4875:
4876: <dt><span class="sect2"><a href=
1.22 ! tv 4877: "#id2585149">12.1.2. Restricted
1.1 grant 4878: packages</a></span></dt>
4879:
4880: <dt><span class="sect2"><a href=
4881: "#dependencies">12.1.3. Handling
4882: dependencies</a></span></dt>
4883:
4884: <dt><span class="sect2"><a href=
1.22 ! tv 4885: "#id2585596">12.1.4. Handling conflicts with
1.1 grant 4886: other packages</a></span></dt>
4887:
4888: <dt><span class="sect2"><a href=
1.22 ! tv 4889: "#id2585715">12.1.5. Packages that cannot or
1.1 grant 4890: should not be built</a></span></dt>
4891:
4892: <dt><span class="sect2"><a href=
1.22 ! tv 4893: "#id2585740">12.1.6. Packages which should not be
1.1 grant 4894: deleted, once installed</a></span></dt>
4895:
4896: <dt><span class="sect2"><a href=
4897: "#security-handling">12.1.7. Handling packages
4898: with security problems</a></span></dt>
4899:
4900: <dt><span class="sect2"><a href=
1.22 ! tv 4901: "#id2585832">12.1.8. How to handle compiler
1.1 grant 4902: bugs</a></span></dt>
4903:
4904: <dt><span class="sect2"><a href=
1.22 ! tv 4905: "#id2585854">12.1.9. How to handle incrementing
1.1 grant 4906: versions when fixing an existing
4907: package</a></span></dt>
4908:
4909: <dt><span class="sect2"><a href=
1.22 ! tv 4910: "#id2585904">12.1.10. Portability of
1.1 grant 4911: packages</a></span></dt>
4912: </dl>
4913: </dd>
4914:
1.22 ! tv 4915: <dt><span class="sect1"><a href="#id2585928">12.2.
1.1 grant 4916: Possible downloading issues</a></span></dt>
4917:
4918: <dd>
4919: <dl>
4920: <dt><span class="sect2"><a href=
1.22 ! tv 4921: "#id2585931">12.2.1. Packages whose distfiles
1.1 grant 4922: aren't available for plain
4923: downloading</a></span></dt>
4924:
4925: <dt><span class="sect2"><a href=
1.22 ! tv 4926: "#id2585994">12.2.2. How to handle modified
1.1 grant 4927: distfiles with the 'old' name</a></span></dt>
4928: </dl>
4929: </dd>
4930:
1.22 ! tv 4931: <dt><span class="sect1"><a href="#id2586006">12.3.
1.1 grant 4932: Configuration gotchas</a></span></dt>
4933:
4934: <dd>
4935: <dl>
4936: <dt><span class="sect2"><a href=
4937: "#fixes.libtool">12.3.1. Shared libraries -
4938: libtool</a></span></dt>
4939:
4940: <dt><span class="sect2"><a href=
1.22 ! tv 4941: "#id2586589">12.3.2. Using libtool on GNU
1.1 grant 4942: packages that already support
4943: libtool</a></span></dt>
4944:
4945: <dt><span class="sect2"><a href=
1.22 ! tv 4946: "#id2586670">12.3.3. GNU
1.1 grant 4947: Autoconf/Automake</a></span></dt>
4948: </dl>
4949: </dd>
4950:
1.22 ! tv 4951: <dt><span class="sect1"><a href="#id2586784">12.4.
1.1 grant 4952: Building considerations</a></span></dt>
4953:
4954: <dd>
4955: <dl>
4956: <dt><span class="sect2"><a href=
1.22 ! tv 4957: "#id2586787">12.4.1. CPP defines</a></span></dt>
1.1 grant 4958: </dl>
4959: </dd>
4960:
1.22 ! tv 4961: <dt><span class="sect1"><a href="#id2586817">12.5.
1.1 grant 4962: Package specific actions</a></span></dt>
4963:
4964: <dd>
4965: <dl>
4966: <dt><span class="sect2"><a href=
1.22 ! tv 4967: "#id2586820">12.5.1. Package configuration
1.1 grant 4968: files</a></span></dt>
4969:
4970: <dt><span class="sect2"><a href=
1.22 ! tv 4971: "#id2586990">12.5.2. User
1.2 hubertf 4972: interaction</a></span></dt>
1.1 grant 4973:
4974: <dt><span class="sect2"><a href=
1.22 ! tv 4975: "#id2587035">12.5.3. Handling
1.1 grant 4976: licenses</a></span></dt>
4977:
4978: <dt><span class="sect2"><a href=
1.22 ! tv 4979: "#id2587187">12.5.4. Creating an account from a
1.1 grant 4980: package</a></span></dt>
4981:
4982: <dt><span class="sect2"><a href=
1.22 ! tv 4983: "#id2587249">12.5.5. Installing score
1.1 grant 4984: files</a></span></dt>
4985:
4986: <dt><span class="sect2"><a href=
1.22 ! tv 4987: "#id2587292">12.5.6. Packages providing login
1.1 grant 4988: shells</a></span></dt>
4989:
4990: <dt><span class="sect2"><a href=
1.22 ! tv 4991: "#id2587350">12.5.7. Packages containing perl
1.1 grant 4992: scripts</a></span></dt>
4993:
4994: <dt><span class="sect2"><a href=
1.22 ! tv 4995: "#id2587368">12.5.8. Packages with hardcoded
1.1 grant 4996: paths to other interpreters</a></span></dt>
4997:
4998: <dt><span class="sect2"><a href=
1.22 ! tv 4999: "#id2587458">12.5.9. Packages installing perl
1.1 grant 5000: modules</a></span></dt>
5001:
5002: <dt><span class="sect2"><a href=
5003: "#faq.info-files">12.5.10. Packages installing
5004: info files</a></span></dt>
5005:
5006: <dt><span class="sect2"><a href=
1.22 ! tv 5007: "#id2587677">12.5.11. Packages installing GConf2
1.1 grant 5008: data files</a></span></dt>
5009:
5010: <dt><span class="sect2"><a href=
1.22 ! tv 5011: "#id2587778">12.5.12. Packages installing
1.1 grant 5012: scrollkeeper data files</a></span></dt>
5013:
5014: <dt><span class="sect2"><a href=
1.22 ! tv 5015: "#id2587829">12.5.13. Packages installing X11
1.1 grant 5016: fonts</a></span></dt>
5017:
5018: <dt><span class="sect2"><a href=
1.22 ! tv 5019: "#id2587876">12.5.14. Packages installing GTK2
1.1 grant 5020: modules</a></span></dt>
5021:
5022: <dt><span class="sect2"><a href=
1.22 ! tv 5023: "#id2587945">12.5.15. Packages installing SGML or
1.1 grant 5024: XML data</a></span></dt>
5025:
5026: <dt><span class="sect2"><a href=
1.22 ! tv 5027: "#id2588066">12.5.16. Packages installing
1.1 grant 5028: extensions to the MIME database</a></span></dt>
5029:
5030: <dt><span class="sect2"><a href=
1.22 ! tv 5031: "#id2588273">12.5.17. Packages using
1.1 grant 5032: intltool</a></span></dt>
1.18 xtraeme 5033:
5034: <dt><span class="sect2"><a href=
1.22 ! tv 5035: "#id2588286">12.5.18. Packages installing startup
1.18 xtraeme 5036: scripts</a></span></dt>
1.1 grant 5037: </dl>
5038: </dd>
5039:
1.22 ! tv 5040: <dt><span class="sect1"><a href="#id2588308">12.6.
1.1 grant 5041: Feedback to the author</a></span></dt>
5042: </dl>
5043: </dd>
5044:
5045: <dt><span class="chapter"><a href="#debug">13.
5046: Debugging</a></span></dt>
5047:
5048: <dt><span class="chapter"><a href="#submit">14.
5049: Submitting and Committing</a></span></dt>
5050:
5051: <dd>
5052: <dl>
1.22 ! tv 5053: <dt><span class="sect1"><a href="#id2588838">14.1.
1.1 grant 5054: Submitting your packages</a></span></dt>
5055:
1.22 ! tv 5056: <dt><span class="sect1"><a href="#id2588889">14.2.
1.1 grant 5057: Committing: Importing a package into
5058: CVS</a></span></dt>
5059:
1.22 ! tv 5060: <dt><span class="sect1"><a href="#id2589020">14.3.
1.2 hubertf 5061: Updating a package to a newer version</a></span></dt>
1.1 grant 5062:
1.22 ! tv 5063: <dt><span class="sect1"><a href="#id2589040">14.4.
1.2 hubertf 5064: Moving a package in pkgsrc</a></span></dt>
1.1 grant 5065: </dl>
5066: </dd>
5067: </dl>
5068: </div>
5069:
5070: <div class="chapter" lang="en" xml:lang="en">
5071: <div class="titlepage">
5072: <div>
5073: <div>
5074: <h2 class="title"><a name="components" id=
5075: "components"></a>Chapter 7. Package
5076: components - files, directories and contents</h2>
5077: </div>
5078: </div>
5079: </div>
5080:
5081: <div class="toc">
5082: <p><b>Table of Contents</b></p>
5083:
5084: <dl>
5085: <dt><span class="sect1"><a href=
1.14 xtraeme 5086: "#components.Makefile">7.1. <code class=
5087: "filename">Makefile</code></a></span></dt>
1.1 grant 5088:
5089: <dt><span class="sect1"><a href=
1.14 xtraeme 5090: "#components.distinfo">7.2. <code class=
5091: "filename">distinfo</code></a></span></dt>
1.1 grant 5092:
5093: <dt><span class="sect1"><a href=
5094: "#components.patches">7.3. patches/*</a></span></dt>
5095:
1.22 ! tv 5096: <dt><span class="sect1"><a href="#id2580482">7.4. Other
1.1 grant 5097: mandatory files</a></span></dt>
5098:
5099: <dt><span class="sect1"><a href=
5100: "#components.optional">7.5. Optional
5101: files</a></span></dt>
5102:
1.22 ! tv 5103: <dt><span class="sect1"><a href="#id2580608">7.6.
1.14 xtraeme 5104: <code class="filename">work*</code></a></span></dt>
1.1 grant 5105:
1.22 ! tv 5106: <dt><span class="sect1"><a href="#id2580763">7.7.
1.14 xtraeme 5107: <code class="filename">files/*</code></a></span></dt>
1.1 grant 5108: </dl>
5109: </div>
5110:
5111: <p>Whenever you're preparing a package, there are a number
5112: of files involved which are described in the following
5113: sections.</p>
5114:
5115: <div class="sect1" lang="en" xml:lang="en">
5116: <div class="titlepage">
5117: <div>
5118: <div>
5119: <h2 class="title" style="clear: both"><a name=
5120: "components.Makefile" id=
1.14 xtraeme 5121: "components.Makefile"></a>7.1. <code class=
5122: "filename">Makefile</code></h2>
1.1 grant 5123: </div>
5124: </div>
5125: </div>
5126:
5127: <p>Building, installation and creation of a binary
1.14 xtraeme 5128: package are all controlled by the package's <code class=
5129: "filename">Makefile</code>.</p>
1.1 grant 5130:
1.14 xtraeme 5131: <p>There is a <code class="filename">Makefile</code> for
5132: each package. This file includes the standard
5133: <code class="filename">bsd.pkg.mk</code> file (referenced
5134: as <code class="filename">../../mk/bsd.pkg.mk</code>),
5135: which sets all the definitions and actions necessary for
5136: the package to compile and install itself. The mandatory
5137: variables are the <code class="varname">DISTNAME</code>
5138: which specifies the base name of the distribution file to
5139: be downloaded from the site on the Internet, <code class=
5140: "varname">MASTER_SITES</code> which specifies that site,
5141: <code class="varname">CATEGORIES</code> which denotes the
5142: categories into which the package falls, <code class=
5143: "varname">PKGNAME</code> which is the name of the
5144: package, the <code class="varname">MAINTAINER</code>'s
5145: name, and the <code class="varname">COMMENT</code>
5146: variable, which should contain a one-line description of
5147: the package (the package name should not appear, it will
5148: be added automatically). The maintainer variable is there
5149: so that anyone who quibbles with the (always completely
5150: correct) decisions taken by the guy who maintains the
5151: package can complain vigorously, or send chocolate as a
5152: sign of appreciation.</p>
1.1 grant 5153:
1.14 xtraeme 5154: <p>The <code class="varname">MASTER_SITES</code> may be
5155: set to one of the predefined sites:</p>
1.1 grant 5156: <pre class="programlisting">
5157: ${MASTER_SITE_APACHE}
5158: ${MASTER_SITE_DEBIAN}
5159: ${MASTER_SITE_GNOME}
5160: ${MASTER_SITE_GNU}
5161: ${MASTER_SITE_GNUSTEP}
1.9 dillo 5162: ${MASTER_SITE_IFARCHIVE}
1.1 grant 5163: ${MASTER_SITE_MOZILLA}
5164: ${MASTER_SITE_PERL_CPAN}
5165: ${MASTER_SITE_SOURCEFORGE}
5166: ${MASTER_SITE_SUNSITE}
5167: ${MASTER_SITE_R_CRAN}
5168: ${MASTER_SITE_SUSE}
5169: ${MASTER_SITE_TEX_CTAN}
5170: ${MASTER_SITE_XCONTRIB}
5171: ${MASTER_SITE_XEMACS}
5172: </pre>
5173:
5174: <p>If one of these predefined sites is chosen, you may
5175: require the ability to specify a subdirectory of that
5176: site. Since these macros may expand to more than one
5177: actual site, you <span class=
5178: "emphasis"><em>must</em></span> use the following
5179: construct to specify a subdirectory:</p>
5180: <pre class="programlisting">
5181: ${MASTER_SITE_GNU:=subdirectory/name/}
5182: ${MASTER_SITE_SOURCEFORGE:=project_name/}
5183: </pre>
5184:
5185: <p>Note the trailing slash after the subdirectory
5186: name.</p>
5187:
5188: <div class="note" style=
5189: "margin-left: 0.5in; margin-right: 0.5in;">
5190: <h3 class="title">Note</h3>
5191:
1.14 xtraeme 5192: <p><code class="varname">MASTER_SITE_SUBDIR</code> has
5193: been deprecated and <span class="emphasis"><em>should
5194: no longer be used</em></span>.</p>
1.1 grant 5195: </div>
5196:
1.14 xtraeme 5197: <p>If the package has multiple <code class=
5198: "varname">DISTFILES</code> or multiple <code class=
5199: "varname">PATCHFILES</code> from different sites, set
5200: <code class="varname">SITES_foo</code> to a list of URI's
1.1 grant 5201: where file “<span class="quote">foo</span>”
5202: may be found. “<span class=
5203: "quote">foo</span>” includes the suffix, e.g.</p>
5204: <pre class="programlisting">
5205: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
5206: DISTFILES+= foo-file.tar.gz
5207: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
5208: http://www.somewhereelse.com/mirror/somehow/
5209: </pre>
5210:
1.14 xtraeme 5211: <p>Note that the normal default setting of <code class=
5212: "varname">DISTFILES</code> must be made explicit if you
1.1 grant 5213: want to add to it (rather than replace it), as you
5214: usually would.</p>
5215:
5216: <p>Currently the following values are available for
1.14 xtraeme 5217: <code class="varname">CATEGORIES</code>. If more than one
5218: is used, they need to be separated by spaces:</p>
1.1 grant 5219: <pre class="programlisting">
5220: archivers cross geography meta-pkgs security
5221: audio databases graphics misc shells
5222: benchmarks devel ham multimedia sysutils
5223: biology editors inputmethod net textproc
5224: cad emulators lang news time
5225: chat finance mail parallel wm
5226: comms fonts math pkgtools www
5227: converters games mbone print x11
5228: </pre>
5229:
5230: <p>Please pay attention to the following gotchas:</p>
5231:
5232: <div class="itemizedlist">
5233: <ul type="disc">
5234: <li>
1.14 xtraeme 5235: <p>Add <code class="varname">MANCOMPRESSED</code>
5236: if manpages are installed in compressed form by the
5237: package; see comment in <code class=
5238: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 5239: </li>
5240:
5241: <li>
1.14 xtraeme 5242: <p>Replace <code class="filename">/usr/local</code>
1.1 grant 5243: with “<span class=
5244: "quote">${PREFIX}</span>” in all files (see
5245: patches, below).</p>
5246: </li>
5247:
5248: <li>
5249: <p>If the package installs any info files, see
5250: <a href="#faq.info-files" title=
5251: "12.5.10. Packages installing info files">Section
5252: 12.5.10, “Packages installing info
5253: files”</a>.</p>
5254: </li>
5255:
5256: <li>
1.14 xtraeme 5257: <p>Set <code class="varname">MAINTAINER</code> to
5258: be yourself. If you really can't maintain the
5259: package for future updates, set it to <code class=
1.1 grant 5260: "email"><<a href=
1.14 xtraeme 5261: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.1 grant 5262: </li>
5263:
5264: <li>
5265: <p>If a home page for the software in question
1.14 xtraeme 5266: exists, add the variable <code class=
5267: "varname">HOMEPAGE</code> right after <code class=
5268: "varname">MAINTAINER</code>. The value of this
1.1 grant 5269: variable should be the URL for the home page.</p>
5270: </li>
5271:
5272: <li>
1.14 xtraeme 5273: <p>Be sure to set the <code class=
5274: "varname">COMMENT</code> variable to a short
1.1 grant 5275: description of the package, not containing the
5276: pkg's name.</p>
5277: </li>
5278: </ul>
5279: </div>
5280: </div>
5281:
5282: <div class="sect1" lang="en" xml:lang="en">
5283: <div class="titlepage">
5284: <div>
5285: <div>
5286: <h2 class="title" style="clear: both"><a name=
5287: "components.distinfo" id=
1.14 xtraeme 5288: "components.distinfo"></a>7.2. <code class=
5289: "filename">distinfo</code></h2>
1.1 grant 5290: </div>
5291: </div>
5292: </div>
5293:
5294: <p>Most important, the mandatory message digest, or
5295: checksum, of all the distfiles needed for the package to
5296: compile, confirming they match the original file
5297: distributed by the author. This ensures that the distfile
5298: retrieved from the Internet has not been corrupted during
5299: transfer or altered by a malign force to introduce a
1.14 xtraeme 5300: security hole. It is generated using the
5301: <span><strong class="command">make
5302: makesum</strong></span> command. The digest algorithm
5303: used was, at one stage, md5, but that was felt lacking
5304: compared to sha1, and so sha1 is now the default
1.1 grant 5305: algorithm. The distfile size is also generated and stored
5306: in new distinfo files. The <a xmlns=
5307: "http://www.w3.org/TR/xhtml1/transitional" href=
5308: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20 ben 5309: class="pkgname">pkgtools/digest</a> utility calculates
5310: all of the digests in the distinfo file, and it provides
5311: various different algorithms. At the current time, the
5312: algorithms provided are: <span class=
5313: "emphasis"><em>md5</em></span>, <span class=
5314: "emphasis"><em>rmd160</em></span>, <span class=
5315: "emphasis"><em>sha1</em></span>, <span class=
5316: "emphasis"><em>sha256</em></span>, <span class=
5317: "emphasis"><em>sha384</em></span> and <span class=
5318: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 5319:
5320: <p>Some packages have different sets of distfiles on a
5321: per architecture basis, for example <a xmlns=
5322: "http://www.w3.org/TR/xhtml1/transitional" href=
5323: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.20 ben 5324: class="pkgname">www/navigator</a>). These are kept in the
5325: same distinfo file and care should be taken when
5326: upgrading such a package to ensure distfile information
5327: is not lost.</p>
1.1 grant 5328:
5329: <p>The message digest/checksum for all the official
1.14 xtraeme 5330: patches found in the <code class=
5331: "filename">patches/</code> directory (see <a href=
5332: "#components.patches" title=
1.1 grant 5333: "7.3. patches/*">Section 7.3,
5334: “patches/*”</a>) for the package is also
1.14 xtraeme 5335: stored in the <code class="filename">distinfo</code>
5336: file. This is a message digest/checksum of all lines in
5337: the patch file except the NetBSD RCS Id. This file is
5338: generated by invoking <span><strong class="command">make
5339: makepatchsum</strong></span> (or <span><strong class=
5340: "command">make mps</strong></span> if you're in a
5341: hurry).</p>
1.1 grant 5342: </div>
5343:
5344: <div class="sect1" lang="en" xml:lang="en">
5345: <div class="titlepage">
5346: <div>
5347: <div>
5348: <h2 class="title" style="clear: both"><a name=
5349: "components.patches" id=
5350: "components.patches"></a>7.3. patches/*</h2>
5351: </div>
5352: </div>
5353: </div>
5354:
5355: <p>This directory contains files that are used by the
5356: <a href=
5357: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
5358: <span class="citerefentry"><span class=
5359: "refentrytitle">patch</span>(1)</span></a> command to
5360: modify the sources as distributed in the distribution
5361: file into a form that will compile and run perfectly on
5362: NetBSD. The files are applied successively in alphabetic
5363: order (as returned by a shell “<span class=
5364: "quote">patches/patch-*</span>” glob expansion), so
1.14 xtraeme 5365: <code class="filename">patch-aa</code> is applied before
5366: <code class="filename">patch-ab</code>, etc.</p>
1.1 grant 5367:
1.14 xtraeme 5368: <p>The <code class="filename">patch-*</code> files should
5369: be in <span><strong class="command">diff
5370: -bu</strong></span> format, and apply without a fuzz to
5371: avoid problems. (To force patches to apply with fuzz you
5372: can set <code class=
5373: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 5374: not put changes for more than one file into a single
5375: patch-file, as this will make future modifications more
5376: difficult.</p>
5377:
5378: <p>Similar, a file should be patched at most once, not
5379: several times by several different patches. If a file
5380: needs several patches, they should be combined into one
5381: file.</p>
5382:
5383: <p>One important thing to mention is to pay attention
5384: that no RCS IDs get stored in the patch files, as these
5385: will cause problems when later checked into the NetBSD
1.14 xtraeme 5386: CVS tree. Use the <span><strong class=
5387: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 5388: "http://www.w3.org/TR/xhtml1/transitional" href=
5389: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 5390: class="pkgname">pkgtools/pkgdiff</a> package to avoid
5391: these problems.</p>
1.1 grant 5392:
5393: <p>For even more automation, we recommend using
1.14 xtraeme 5394: <span><strong class="command">mkpatches</strong></span>
5395: from the same package to make a whole set of patches. You
5396: just have to backup files before you edit them to
5397: <code class="filename">filename.orig</code>, e.g. with
5398: <span><strong class="command">cp -p filename
5399: filename.orig</strong></span> or, easier, by using
5400: <span><strong class="command">pkgvi</strong></span> again
5401: from the same package. If you upgrade a package this way,
5402: you can easily compare the new set of patches with the
5403: previously existing one with <span><strong class=
5404: "command">patchdiff</strong></span>.</p>
1.1 grant 5405:
5406: <p>When you have finished a package, remember to generate
5407: the checksums for the patch files by using the
1.14 xtraeme 5408: <span><strong class="command">make
5409: makepatchsum</strong></span> command, see <a href=
5410: "#components.distinfo" title=
1.5 hubertf 5411: "7.2. distinfo">Section 7.2,
1.14 xtraeme 5412: “<code class="filename">distinfo</code>”</a>.</p>
1.1 grant 5413:
5414: <p>Patch files that are distributed by the author or
1.14 xtraeme 5415: other maintainers can be listed in <code class=
5416: "varname">$PATCHFILES</code>.</p>
1.1 grant 5417:
5418: <p>If it is desired to store any patches that should not
5419: be committed into pkgsrc, they can be kept outside the
1.14 xtraeme 5420: pkgsrc tree in the <code class=
5421: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 5422: tree there is expected to have the same
5423: “<span class="quote">category/package</span>”
5424: structure as pkgsrc, and patches are expected to be
1.14 xtraeme 5425: stored inside these dirs (also known as <code class=
5426: "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
5427: you want to keep a private patch for <code class=
5428: "filename">pkgsrc/graphics/png</code>, keep it in
5429: <code class=
5430: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
5431: files in the named directory are expected to be patch
1.1 grant 5432: files, and <span class="emphasis"><em>they are applied
5433: after pkgsrc patches are applied</em></span>.</p>
5434: </div>
5435:
5436: <div class="sect1" lang="en" xml:lang="en">
5437: <div class="titlepage">
5438: <div>
5439: <div>
5440: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 5441: "id2580482" id="id2580482"></a>7.4. Other
1.1 grant 5442: mandatory files</h2>
5443: </div>
5444: </div>
5445: </div>
5446:
5447: <div class="variablelist">
5448: <dl>
1.14 xtraeme 5449: <dt><span class="term"><code class=
5450: "filename">DESCR</code></span></dt>
1.1 grant 5451:
5452: <dd>
5453: <p>A multi-line description of the piece of
5454: software. This should include any credits where
5455: they are due. Please bear in mind that others do
5456: not share your sense of humour (or spelling
5457: idiosyncrasies), and that others will read
5458: everything that you write here.</p>
5459: </dd>
5460:
1.14 xtraeme 5461: <dt><span class="term"><code class=
5462: "filename">PLIST</code></span></dt>
1.1 grant 5463:
5464: <dd>
5465: <p>This file governs the files that are installed
5466: on your system: all the binaries, manual pages,
5467: etc. There are other directives which may be
5468: entered in this file, to control the creation and
5469: deletion of directories, and the location of
5470: inserted files. See <a href="#plist" title=
5471: "Chapter 8. PLIST issues">Chapter 8,
5472: <i>PLIST issues</i></a> for more information.</p>
5473: </dd>
5474: </dl>
5475: </div>
5476: </div>
5477:
5478: <div class="sect1" lang="en" xml:lang="en">
5479: <div class="titlepage">
5480: <div>
5481: <div>
5482: <h2 class="title" style="clear: both"><a name=
5483: "components.optional" id=
5484: "components.optional"></a>7.5. Optional
5485: files</h2>
5486: </div>
5487: </div>
5488: </div>
5489:
5490: <div class="variablelist">
5491: <dl>
1.14 xtraeme 5492: <dt><span class="term"><code class=
5493: "filename">INSTALL</code></span></dt>
1.1 grant 5494:
5495: <dd>
5496: <p>This shell script is invoked twice by <a href=
5497: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5498: <span class="citerefentry"><span class=
5499: "refentrytitle">pkg_add</span>(1)</span></a>. First
5500: time after package extraction and before files are
5501: moved in place, the second time after the files to
5502: install are moved in place. This can be used to do
5503: any custom procedures not possible with @exec
1.14 xtraeme 5504: commands in <code class="filename">PLIST</code>.
5505: See <a href=
1.1 grant 5506: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5507: <span class="citerefentry"><span class=
5508: "refentrytitle">pkg_add</span>(1)</span></a> and
5509: <a href=
5510: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5511: <span class="citerefentry"><span class=
5512: "refentrytitle">pkg_create</span>(1)</span></a> for
5513: more information.</p>
5514: </dd>
5515:
1.14 xtraeme 5516: <dt><span class="term"><code class=
5517: "filename">DEINSTALL</code></span></dt>
1.1 grant 5518:
5519: <dd>
5520: <p>This script is executed before and after any
5521: files are removed. It is this script's
5522: responsibility to clean up any additional messy
5523: details around the package's installation, since
5524: all pkg_delete knows is how to delete the files
5525: created in the original distribution. See <a href=
5526: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
5527: <span class="citerefentry"><span class=
5528: "refentrytitle">pkg_delete</span>(1)</span></a> and
5529: <a href=
5530: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5531: <span class="citerefentry"><span class=
5532: "refentrytitle">pkg_create</span>(1)</span></a> for
5533: more information.</p>
5534: </dd>
5535:
1.14 xtraeme 5536: <dt><span class="term"><code class=
5537: "filename">MESSAGE</code></span></dt>
1.1 grant 5538:
5539: <dd>
5540: <p>Display this file after installation of the
5541: package. Useful for things like legal notices on
5542: almost-free software and hints for updating config
5543: files after installing modules for apache, PHP etc.
5544: Please note that you can modify variables in it
1.14 xtraeme 5545: easily by using <code class=
5546: "varname">MESSAGE_SUBST</code> in the package's
5547: <code class="filename">Makefile</code>:</p>
1.1 grant 5548: <pre class="programlisting">
5549: MESSAGE_SUBST+= SOMEVAR="somevalue"
5550: </pre>
5551:
5552: <p>replaces "${SOMEVAR}" with “<span class=
1.14 xtraeme 5553: "quote">somevalue</span>” in <code class=
5554: "filename">MESSAGE</code>.</p>
1.1 grant 5555: </dd>
5556: </dl>
5557: </div>
5558: </div>
5559:
5560: <div class="sect1" lang="en" xml:lang="en">
5561: <div class="titlepage">
5562: <div>
5563: <div>
5564: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 5565: "id2580608" id=
! 5566: "id2580608"></a>7.6. <code class=
1.14 xtraeme 5567: "filename">work*</code></h2>
1.1 grant 5568: </div>
5569: </div>
5570: </div>
5571:
1.14 xtraeme 5572: <p>When you type <span><strong class=
5573: "command">make</strong></span> the distribution files are
5574: unpacked into this directory. It can be removed by
5575: running <span><strong class="command">make
5576: clean</strong></span>. Besides the sources, this
5577: directory is also used to keep various timestamp
1.1 grant 5578: files.</p>
5579:
5580: <p>If a package doesn't create a subdirectory for itself
5581: (like GNU software does, for instance), but extracts
5582: itself in the current directory, you should set
1.14 xtraeme 5583: <code class="varname">WRKSRC</code> accordingly, e.g.
1.1 grant 5584: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
5585: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.20 ben 5586: class="pkgname">editors/sam</a> again, but the quick
5587: answer is:</p>
1.1 grant 5588: <pre class="programlisting">
5589: WRKSRC= ${WRKDIR}
5590: </pre>
5591:
1.14 xtraeme 5592: <p>Please note that the old <code class=
5593: "varname">NO_WRKSUBDIR</code> has been deprecated and
1.1 grant 5594: should not be used. Also, if your package doesn't create
1.14 xtraeme 5595: a subdir with the name of <code class=
5596: "varname">DISTNAME</code> but some different name, set
5597: <code class="varname">WRKSRC</code> to point to the
5598: proper name in <code class="filename">${WRKDIR}</code>.
5599: See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5600: href=
1.1 grant 5601: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.20 ben 5602: class="pkgname">lang/tcl</a> and <a xmlns=
5603: "http://www.w3.org/TR/xhtml1/transitional" href=
5604: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
5605: class="pkgname">x11/tk</a> for examples, and here is
5606: another one:</p>
1.1 grant 5607: <pre class="programlisting">
5608: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
5609: </pre>
5610:
5611: <p>The name of the working directory created by pkgsrc is
1.14 xtraeme 5612: <code class="filename">work</code> by default. If the
5613: same pkgsrc tree should be used on several different
5614: platforms, the variable <code class=
5615: "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
1.1 grant 5616: attach the platform to the directory name, e.g.
1.14 xtraeme 5617: <code class="filename">work.i386</code> or <code class=
5618: "filename">work.sparc</code>.</p>
1.1 grant 5619: </div>
5620:
5621: <div class="sect1" lang="en" xml:lang="en">
5622: <div class="titlepage">
5623: <div>
5624: <div>
5625: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 5626: "id2580763" id=
! 5627: "id2580763"></a>7.7. <code class=
1.14 xtraeme 5628: "filename">files/*</code></h2>
1.1 grant 5629: </div>
5630: </div>
5631: </div>
5632:
5633: <p>If you have any files that you wish to be placed in
5634: the package prior to configuration or building, you could
5635: place these files here and use a “<span class=
5636: "quote">${CP}</span>” command in the
5637: “<span class="quote">pre-configure</span>”
5638: target to achieve this. Alternatively, you could simply
1.14 xtraeme 5639: diff the file against <code class=
5640: "filename">/dev/null</code> and use the patch mechanism
5641: to manage the creation of this file.</p>
1.1 grant 5642: </div>
5643: </div>
5644:
5645: <div class="chapter" lang="en" xml:lang="en">
5646: <div class="titlepage">
5647: <div>
5648: <div>
5649: <h2 class="title"><a name="plist" id=
5650: "plist"></a>Chapter 8. PLIST issues</h2>
5651: </div>
5652: </div>
5653: </div>
5654:
5655: <div class="toc">
5656: <p><b>Table of Contents</b></p>
5657:
5658: <dl>
1.22 ! tv 5659: <dt><span class="sect1"><a href="#id2580818">8.1. RCS
1.1 grant 5660: ID</a></span></dt>
5661:
1.22 ! tv 5662: <dt><span class="sect1"><a href="#id2580901">8.2.
1.14 xtraeme 5663: Semi-automatic <code class="filename">PLIST</code>
5664: generation</a></span></dt>
1.1 grant 5665:
5666: <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14 xtraeme 5667: Tweaking output of <span><strong class="command">make
5668: print-PLIST</strong></span></a></span></dt>
1.1 grant 5669:
5670: <dt><span class="sect1"><a href="#plist.misc">8.4.
5671: Variable substitution in PLIST</a></span></dt>
5672:
1.22 ! tv 5673: <dt><span class="sect1"><a href="#id2581290">8.5.
1.1 grant 5674: Manpage-compression</a></span></dt>
5675:
1.22 ! tv 5676: <dt><span class="sect1"><a href="#id2581332">8.6.
1.14 xtraeme 5677: Changing PLIST source with <code class=
5678: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5679:
1.22 ! tv 5680: <dt><span class="sect1"><a href="#id2581349">8.7.
1.1 grant 5681: Platform specific and differing PLISTs</a></span></dt>
5682:
5683: <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
5684: Sharing directories between packages</a></span></dt>
5685: </dl>
5686: </div>
5687:
1.14 xtraeme 5688: <p>The <code class="filename">PLIST</code> file contains a
1.1 grant 5689: package's “<span class="quote">packing
5690: list</span>”, i.e. a list of files that belong to the
1.14 xtraeme 5691: package (relative to the <code class=
5692: "filename">${PREFIX}</code> directory it's been installed
5693: in) plus some additional statements - see the <a href=
1.1 grant 5694: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5695: <span class="citerefentry"><span class=
5696: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
5697: a full list. This chapter addresses some issues that need
1.14 xtraeme 5698: attention when dealing with the <code class=
5699: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 5700:
5701: <div class="sect1" lang="en" xml:lang="en">
5702: <div class="titlepage">
5703: <div>
5704: <div>
5705: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 5706: "id2580818" id="id2580818"></a>8.1. RCS
1.1 grant 5707: ID</h2>
5708: </div>
5709: </div>
5710: </div>
5711:
5712: <p>Be sure to add a RCS ID line as the first thing in any
1.14 xtraeme 5713: <code class="filename">PLIST</code> file you write:</p>
1.1 grant 5714: <pre class="programlisting">
1.17 sketch 5715: @comment $NetBSD$
1.1 grant 5716: </pre>
5717: </div>
5718:
5719: <div class="sect1" lang="en" xml:lang="en">
5720: <div class="titlepage">
5721: <div>
5722: <div>
5723: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 5724: "id2580901" id=
! 5725: "id2580901"></a>8.2. Semi-automatic
1.14 xtraeme 5726: <code class="filename">PLIST</code> generation</h2>
1.1 grant 5727: </div>
5728: </div>
5729: </div>
5730:
1.14 xtraeme 5731: <p>You can use the <span><strong class="command">make
5732: print-PLIST</strong></span> command to output a PLIST
5733: that matches any new files since the package was
5734: extracted. See <a href="#build.helpful-targets" title=
1.1 grant 5735: "11.3. Other helpful targets">Section 11.3,
5736: “Other helpful targets”</a> for more
5737: information on this target.</p>
5738: </div>
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=
5745: "print-PLIST" id=
5746: "print-PLIST"></a>8.3. Tweaking output of
1.14 xtraeme 5747: <span><strong class="command">make
5748: print-PLIST</strong></span></h2>
1.1 grant 5749: </div>
5750: </div>
5751: </div>
5752:
5753: <p>If you have used any of the *-dirs packages, as
5754: explained in <a href="#faq.common-dirs" title=
5755: "8.8. Sharing directories between packages">Section 8.8,
5756: “Sharing directories between packages”</a>,
1.14 xtraeme 5757: you may have noticed that <span><strong class=
5758: "command">make print-PLIST</strong></span> outputs a set
5759: of <code class="varname">@comment</code>s instead of real
5760: <code class="varname">@dirrm</code> lines. You can also
5761: do this for specific directories and files, so that the
5762: results of that command are very close to reality. This
5763: helps <span class="emphasis"><em>a lot</em></span> during
5764: the update of packages.</p>
5765:
5766: <p>The <code class="varname">PRINT_PLIST_AWK</code>
5767: variable takes a set of AWK patterns and actions that are
5768: used to filter the output of print-PLIST. You can
5769: <span class="emphasis"><em>append</em></span> any chunk
5770: of AWK scripting you like to it, but be careful with
1.1 grant 5771: quoting.</p>
5772:
1.14 xtraeme 5773: <p>For example, to get all files inside the <code class=
5774: "filename">libdata/foo</code> directory removed from the
1.1 grant 5775: resulting PLIST:</p>
5776: <pre class="programlisting">
5777: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
5778:
5779: </pre>
5780:
1.14 xtraeme 5781: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 5782: lines referring to a specific (shared) directory
1.14 xtraeme 5783: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 5784: <pre class="programlisting">
5785: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
5786:
5787: </pre>
5788: </div>
5789:
5790: <div class="sect1" lang="en" xml:lang="en">
5791: <div class="titlepage">
5792: <div>
5793: <div>
5794: <h2 class="title" style="clear: both"><a name=
5795: "plist.misc" id="plist.misc"></a>8.4. Variable
5796: substitution in PLIST</h2>
5797: </div>
5798: </div>
5799: </div>
5800:
5801: <p>A number of variables are substituted automatically in
5802: PLISTs when a package is installed on a system. This
5803: includes the following variables:</p>
5804:
5805: <div class="variablelist">
5806: <dl>
1.14 xtraeme 5807: <dt><span class="term"><code class=
5808: "varname">${MACHINE_ARCH}</code>, <code class=
5809: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 5810:
5811: <dd>
5812: <p>Some packages like emacs and perl embed
5813: information about which architecture they were
5814: built on into the pathnames where they install
5815: their file. To handle this case, PLIST will be
5816: preprocessed before actually used, and the symbol
1.14 xtraeme 5817: “<span class="quote"><code class=
5818: "varname">${MACHINE_ARCH}</code></span>” will
5819: be replaced by what <span><strong class=
5820: "command">uname -p</strong></span> gives. The same
5821: is done if the string <code class=
5822: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
5823: PLIST somewhere - use this on packages that have
5824: GNU autoconf created configure scripts.</p>
1.1 grant 5825:
5826: <div class="note" style=
5827: "margin-left: 0.5in; margin-right: 0.5in;">
5828: <h3 class="title">Legacy note</h3>
5829:
5830: <p>There used to be a symbol “<span class=
1.14 xtraeme 5831: "quote"><code class=
5832: "varname">$ARCH</code></span>” that was
5833: replaced by the output of <span><strong class=
5834: "command">uname -m</strong></span>, but that's no
1.1 grant 5835: longer supported and has been removed.</p>
5836: </div>
5837: </dd>
5838:
1.14 xtraeme 5839: <dt><span class="term"><code class=
5840: "varname">${OPSYS}</code>, <code class=
5841: "varname">${LOWER_OPSYS}</code>, <code class=
5842: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 5843:
5844: <dd>
5845: <p>Some packages want to embed the OS name and
5846: version into some paths. To do this, use these
1.14 xtraeme 5847: variables in the <code class=
5848: "filename">PLIST</code>:</p>
1.1 grant 5849:
5850: <div class="itemizedlist">
5851: <ul type="disc">
5852: <li>
1.14 xtraeme 5853: <p><code class="varname">${OPSYS}</code> -
5854: output of “<span class=
5855: "quote"><span><strong class="command">uname
5856: -s</strong></span></span>”</p>
1.1 grant 5857: </li>
5858:
5859: <li>
1.14 xtraeme 5860: <p><code class=
5861: "varname">${LOWER_OPSYS}</code> - lowercase
5862: common name (eg. “<span class=
5863: "quote">solaris</span>”)</p>
1.1 grant 5864: </li>
5865:
5866: <li>
1.14 xtraeme 5867: <p><code class="varname">${OS_VERSION}</code>
5868: - “<span class=
5869: "quote"><span><strong class="command">uname
5870: -r</strong></span></span>”</p>
1.1 grant 5871: </li>
5872: </ul>
5873: </div>
5874: </dd>
5875:
1.14 xtraeme 5876: <dt><span class="term"><code class=
5877: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 5878:
5879: <dd>
5880: <p>Packages that install locale files should list
5881: them in the PLIST as “<span class=
5882: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
5883: instead of “<span class=
5884: "quote">share/locale/de/LC_MESSAGES/...</span>”.
5885: This properly handles the fact that different
5886: operating systems expect locale files to be either
1.14 xtraeme 5887: in <code class="filename">share</code> or
5888: <code class="filename">lib</code> by default.</p>
1.1 grant 5889: </dd>
5890: </dl>
5891: </div>
5892:
5893: <p>For a complete list of values which are replaced by
1.14 xtraeme 5894: default, please look in <code class=
5895: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 5896: "emphasis"><em>PLIST_SUBST</em></span>).</p>
5897:
5898: <p>If you want to change other variables not listed
5899: above, you can add variables and their expansions to this
1.14 xtraeme 5900: variable in the following way, similar to <code class=
5901: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 5902: "#components.optional" title=
5903: "7.5. Optional files">Section 7.5,
5904: “Optional files”</a>):</p>
5905: <pre class="programlisting">
5906: PLIST_SUBST+= SOMEVAR="somevalue"
5907: </pre>
5908:
5909: <p>This replaces all occurrences of “<span class=
5910: "quote">${SOMEVAR}</span>” in the PLIST with
5911: “<span class="quote">somevalue</span>”.</p>
5912: </div>
5913:
5914: <div class="sect1" lang="en" xml:lang="en">
5915: <div class="titlepage">
5916: <div>
5917: <div>
5918: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 5919: "id2581290" id=
! 5920: "id2581290"></a>8.5. Manpage-compression</h2>
1.1 grant 5921: </div>
5922: </div>
5923: </div>
5924:
5925: <p>Manpages should be installed in compressed form if
1.14 xtraeme 5926: <code class="varname">MANZ</code> is set (in <code class=
5927: "filename">bsd.own.mk</code>), and uncompressed
5928: otherwise. To handle this in the <code class=
5929: "filename">PLIST</code> file, the suffix
5930: “<span class="quote">.gz</span>” is
5931: appended/removed automatically for manpages according to
5932: <code class="varname">MANZ</code> and <code class=
5933: "varname">MANCOMPRESSED</code> being set or not, see
5934: above for details. This modification of the <code class=
5935: "filename">PLIST</code> file is done on a copy of it, not
5936: <code class="filename">PLIST</code> itself.</p>
1.1 grant 5937: </div>
5938:
5939: <div class="sect1" lang="en" xml:lang="en">
5940: <div class="titlepage">
5941: <div>
5942: <div>
5943: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 5944: "id2581332" id="id2581332"></a>8.6. Changing
1.14 xtraeme 5945: PLIST source with <code class=
5946: "varname">PLIST_SRC</code></h2>
1.1 grant 5947: </div>
5948: </div>
5949: </div>
5950:
1.14 xtraeme 5951: <p>To use one or more files as source for the
5952: <code class="filename">PLIST</code> used in generating
5953: the binary package, set the variable <code class=
5954: "varname">PLIST_SRC</code> to the names of that file(s).
1.1 grant 5955: The files are later concatenated using cat(1), and order
5956: of things is important.</p>
5957: </div>
5958:
5959: <div class="sect1" lang="en" xml:lang="en">
5960: <div class="titlepage">
5961: <div>
5962: <div>
5963: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 5964: "id2581349" id="id2581349"></a>8.7. Platform
1.1 grant 5965: specific and differing PLISTs</h2>
5966: </div>
5967: </div>
5968: </div>
5969:
5970: <p>Some packages decide to install a different set of
5971: files based on the operating system being used. These
5972: differences can be automatically handled by using the
5973: following files:</p>
5974:
5975: <div class="itemizedlist">
5976: <ul type="disc">
5977: <li>
1.14 xtraeme 5978: <p><code class="filename">PLIST.common</code></p>
1.1 grant 5979: </li>
5980:
5981: <li>
1.14 xtraeme 5982: <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1 grant 5983: </li>
5984:
5985: <li>
1.14 xtraeme 5986: <p><code class=
1.21 ben 5987: "filename">PLIST.${MACHINE_ARCH}</code></p>
5988: </li>
5989:
5990: <li>
5991: <p><code class=
5992: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
5993: </li>
5994:
5995: <li>
5996: <p><code class=
1.14 xtraeme 5997: "filename">PLIST.common_end</code></p>
1.1 grant 5998: </li>
5999: </ul>
6000: </div>
6001: </div>
6002:
6003: <div class="sect1" lang="en" xml:lang="en">
6004: <div class="titlepage">
6005: <div>
6006: <div>
6007: <h2 class="title" style="clear: both"><a name=
6008: "faq.common-dirs" id=
6009: "faq.common-dirs"></a>8.8. Sharing directories
6010: between packages</h2>
6011: </div>
6012: </div>
6013: </div>
6014:
6015: <p>A “<span class="quote">shared
6016: directory</span>” is a directory where multiple
6017: (and unrelated) packages install files. These directories
6018: are problematic because you have to add special tricks in
6019: the PLIST to conditionally remove them, or have some
6020: centralized package handle them.</p>
6021:
6022: <p>Within pkgsrc, you'll find both approaches. If a
6023: directory is shared by a few unrelated packages, it's
6024: often not worth to add an extra package to remove it.
6025: Therefore, one simply does:</p>
6026: <pre class="programlisting">
6027: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
6028:
6029: </pre>
6030:
6031: <p>in the PLISTs of all affected packages, instead of the
6032: regular "@dirrm" line.</p>
6033:
6034: <p>However, if the directory is shared across many
6035: packages, two different solutions are available:</p>
6036:
6037: <div class="orderedlist">
6038: <ol type="1">
6039: <li>
6040: <p>If the packages have a common dependency, the
6041: directory can be removed in that. For example, see
6042: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
6043: href=
6044: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20 ben 6045: class="pkgname">textproc/scrollkeeper</a>, which
6046: removes the shared directory <code class=
6047: "filename">share/omf</code>.</p>
1.1 grant 6048: </li>
6049:
6050: <li>
6051: <p>If the packages using the directory are not
6052: related at all (they have no common dependencies),
6053: a *-dirs package is used.</p>
6054: </li>
6055: </ol>
6056: </div>
6057:
6058: <p>From now on, we'll discuss the second solution. To get
6059: an idea of the *-dirs packages available, issue:</p>
6060: <pre class="programlisting">
1.14 xtraeme 6061: <code class="prompt">%</code> cd .../pkgsrc
6062: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 6063:
6064: </pre>
6065:
6066: <p>Their use from other packages is very simple. The
1.14 xtraeme 6067: <code class="varname">USE_DIRS</code> variable takes a
6068: list of package names (without the “<span class=
1.1 grant 6069: "quote">-dirs</span>” part) together with the
6070: required version number (always pick the latest one when
6071: writting new packages).</p>
6072:
6073: <p>For example, if a package installs files under
1.14 xtraeme 6074: <code class="filename">share/applications</code>, it
6075: should have the following line in it:</p>
1.1 grant 6076: <pre class="programlisting">
6077: USE_DIRS+= xdg-1.1
6078:
6079: </pre>
6080:
1.14 xtraeme 6081: <p>After regenerating the PLIST using
6082: <span><strong class="command">make
6083: print-PLIST</strong></span>, you should get the right
6084: (commented out) lines.</p>
1.1 grant 6085:
1.14 xtraeme 6086: <p>Note that, even if your package is using <code class=
6087: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 6088: *-x11-dirs packages. Just specify the name without that
1.14 xtraeme 6089: part and pkgsrc (in particular, <code class=
6090: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 6091: </div>
6092: </div>
6093:
6094: <div class="chapter" lang="en" xml:lang="en">
6095: <div class="titlepage">
6096: <div>
6097: <div>
6098: <h2 class="title"><a name="buildlink" id=
6099: "buildlink"></a>Chapter 9. Buildlink
6100: methodology</h2>
6101: </div>
6102: </div>
6103: </div>
6104:
6105: <div class="toc">
6106: <p><b>Table of Contents</b></p>
6107:
6108: <dl>
1.22 ! tv 6109: <dt><span class="sect1"><a href="#id2581547">9.1.
1.1 grant 6110: Converting packages to use buildlink3</a></span></dt>
6111:
1.22 ! tv 6112: <dt><span class="sect1"><a href="#id2581865">9.2.
1.14 xtraeme 6113: Writing <code class="filename">buildlink3.mk</code>
6114: files</a></span></dt>
1.1 grant 6115:
6116: <dd>
6117: <dl>
1.22 ! tv 6118: <dt><span class="sect2"><a href="#id2581934">9.2.1.
1.1 grant 6119: Anatomy of a buildlink3.mk file</a></span></dt>
6120:
1.22 ! tv 6121: <dt><span class="sect2"><a href="#id2582307">9.2.2.
1.14 xtraeme 6122: Updating <code class=
6123: "varname">BUILDLINK_DEPENDS.<em class=
6124: "replaceable"><code>pkg</code></em></code> in
6125: <code class="filename">buildlink3.mk</code>
1.1 grant 6126: files</a></span></dt>
6127: </dl>
6128: </dd>
6129:
1.22 ! tv 6130: <dt><span class="sect1"><a href="#id2582386">9.3.
1.14 xtraeme 6131: Writing <code class="filename">builtin.mk</code>
6132: files</a></span></dt>
1.1 grant 6133:
6134: <dd>
6135: <dl>
1.22 ! tv 6136: <dt><span class="sect2"><a href="#id2582603">9.3.1.
1.14 xtraeme 6137: Anatomy of a <code class=
6138: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 6139:
1.22 ! tv 6140: <dt><span class="sect2"><a href="#id2582830">9.3.2.
1.1 grant 6141: Global preferences for native or pkgsrc
6142: software</a></span></dt>
6143: </dl>
6144: </dd>
6145: </dl>
6146: </div>
6147:
6148: <p>Buildlink is a framework in pkgsrc that controls what
6149: headers and libraries are seen by a package's configure and
6150: build processes. This is implemented in a two step
6151: process:</p>
6152:
6153: <div class="orderedlist">
6154: <ol type="1">
6155: <li>
6156: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 6157: into <code class="varname">BUILDLINK_DIR</code>,
6158: which by default is a subdirectory of <code class=
6159: "varname">WRKDIR</code>.</p>
1.1 grant 6160: </li>
6161:
6162: <li>
6163: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 6164: the normal compiler tools that translate <code class=
6165: "option">-I${LOCALBASE}/include</code> and
6166: <code class="option">-L${LOCALBASE}/lib</code> into
6167: references to <code class=
6168: "varname">BUILDLINK_DIR</code>. The wrapper scripts
6169: also make native compiler on some operating systems
6170: look like GCC, so that packages that expect GCC won't
6171: require modifications to build with those native
6172: compilers.</p>
1.1 grant 6173: </li>
6174: </ol>
6175: </div>
6176:
6177: <p>This normalizes the environment in which a package is
6178: built so that the package may be built consistently despite
6179: what other software may be installed. Please note that the
1.14 xtraeme 6180: normal system header and library paths, e.g. <code class=
6181: "filename">/usr/include</code>, <code class=
6182: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 6183: buildlink3 is designed to insulate the package build from
6184: non-system-supplied software.</p>
6185:
6186: <div class="sect1" lang="en" xml:lang="en">
6187: <div class="titlepage">
6188: <div>
6189: <div>
6190: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 6191: "id2581547" id="id2581547"></a>9.1. Converting
1.1 grant 6192: packages to use buildlink3</h2>
6193: </div>
6194: </div>
6195: </div>
6196:
6197: <p>The process of converting packages to use the
6198: buildlink3 framework (“<span class=
6199: "quote">bl3ifying</span>”) is fairly
6200: straightforward. The things to keep in mind are:</p>
6201:
6202: <div class="orderedlist">
6203: <ol type="1">
6204: <li>
6205: <p>Ensure that the build always calls the wrapper
6206: scripts instead of the actual toolchain. Some
6207: packages are tricky, and the only way to know for
1.14 xtraeme 6208: sure is the check <code class=
6209: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 6210: wrappers are being invoked.</p>
6211: </li>
6212:
6213: <li>
1.14 xtraeme 6214: <p>Don't override <code class=
6215: "varname">PREFIX</code> from within the package
6216: Makefile, e.g. Java VMs, standalone shells, etc.,
6217: because the code to symlink files into <code class=
6218: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 6219: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 6220: <em class=
6221: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 6222: </li>
6223:
6224: <li>
6225: <p>Remember that <span class=
1.14 xtraeme 6226: "emphasis"><em>only</em></span> the <code class=
6227: "filename">buildlink3.mk</code> files that you list
1.1 grant 6228: in a package's Makefile are added as dependencies
6229: for that package.</p>
6230: </li>
6231: </ol>
6232: </div>
6233:
6234: <p>If a dependency on a particular package is required
6235: for its libraries and headers, then we replace:</p>
6236: <pre class="programlisting">
6237: DEPENDS+= foo>=1.1.0:../../category/foo
6238: </pre>
6239:
6240: <p>with</p>
6241: <pre class="programlisting">
6242: .include "../../category/foo/buildlink3.mk"
6243: </pre>
6244:
1.14 xtraeme 6245: <p>There are several <code class=
6246: "filename">buildlink3.mk</code> files in <code class=
6247: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 6248: issues:</p>
6249:
6250: <div class="itemizedlist">
6251: <ul type="disc">
6252: <li>
1.14 xtraeme 6253: <p><code class="filename">bdb.buildlink3.mk</code>
1.1 grant 6254: chooses either the native or a pkgsrc Berkeley DB
1.14 xtraeme 6255: implementation based on the values of <code class=
6256: "varname">BDB_ACCEPTED</code> and <code class=
6257: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 6258: </li>
6259:
6260: <li>
1.14 xtraeme 6261: <p><code class=
6262: "filename">curses.buildlink3.mk</code> If the
6263: system comes with neither Curses nor NCurses, this
6264: will take care to install the <a xmlns=
6265: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 6266: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20 ben 6267: class="pkgname">devel/ncurses</a> package.</p>
1.1 grant 6268: </li>
6269:
6270: <li>
1.14 xtraeme 6271: <p><code class="filename">krb5.buildlink3.mk</code>
6272: uses the value of <code class=
6273: "varname">KRB5_ACCEPTED</code> to choose between
1.1 grant 6274: adding a dependency on Heimdal or MIT-krb5 for
6275: packages that require a Kerberos 5
6276: implementation.</p>
6277: </li>
6278:
6279: <li>
1.14 xtraeme 6280: <p><code class=
6281: "filename">motif.buildlink3.mk</code> checks for a
6282: system-provided Motif installation or adds a
6283: dependency on <a xmlns=
1.1 grant 6284: "http://www.w3.org/TR/xhtml1/transitional" href=
6285: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20 ben 6286: class="pkgname">x11/lesstif</a> or <a xmlns=
6287: "http://www.w3.org/TR/xhtml1/transitional" href=
6288: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
6289: class="pkgname">x11/openmotif</a>;</p>
1.1 grant 6290: </li>
6291:
6292: <li>
1.14 xtraeme 6293: <p><code class=
6294: "filename">ossaudio.buildlink3.mk</code> defines
6295: several variables that may be used by packages that
6296: use the Open Sound System (OSS) API;</p>
1.1 grant 6297: </li>
6298:
6299: <li>
1.14 xtraeme 6300: <p><code class=
6301: "filename">pgsql.buildlink3.mk</code> will accept
6302: either Postgres 7.3 or 7.4, whichever is found
6303: installed. See the file for more information.</p>
1.1 grant 6304: </li>
6305:
6306: <li>
1.14 xtraeme 6307: <p><code class=
6308: "filename">pthread.buildlink3.mk</code> uses the
6309: value of <code class="varname">PTHREAD_OPTS</code>
6310: and checks for native pthreads or adds a dependency
6311: on <a xmlns=
1.1 grant 6312: "http://www.w3.org/TR/xhtml1/transitional" href=
6313: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20 ben 6314: class="pkgname">devel/pth</a> as needed;</p>
1.1 grant 6315: </li>
6316:
6317: <li>
1.14 xtraeme 6318: <p><code class="filename">xaw.buildlink3.mk</code>
6319: uses the value of <code class=
6320: "varname">XAW_TYPE</code> to choose a particular
6321: Athena widgets library.</p>
1.1 grant 6322: </li>
6323: </ul>
6324: </div>
6325:
1.14 xtraeme 6326: <p>The comments in those <code class=
6327: "filename">buildlink3.mk</code> files provide a more
1.1 grant 6328: complete description of how to use them properly.</p>
6329: </div>
6330:
6331: <div class="sect1" lang="en" xml:lang="en">
6332: <div class="titlepage">
6333: <div>
6334: <div>
6335: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 6336: "id2581865" id="id2581865"></a>9.2. Writing
1.14 xtraeme 6337: <code class="filename">buildlink3.mk</code>
6338: files</h2>
1.1 grant 6339: </div>
6340: </div>
6341: </div>
6342:
1.14 xtraeme 6343: <p>A package's <code class=
6344: "filename">buildlink3.mk</code> file is included by
6345: Makefiles to indicate the need to compile and link
6346: against header files and libraries provided by the
6347: package. A <code class="filename">buildlink3.mk</code>
6348: file should always provide enough information to add the
6349: correct type of dependency relationship and include any
6350: other <code class="filename">buildlink3.mk</code> files
6351: that it needs to find headers and libraries that it needs
6352: in turn.</p>
1.1 grant 6353:
1.14 xtraeme 6354: <p>To generate an initial <code class=
6355: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 6356: Rene Hexel's <a xmlns=
6357: "http://www.w3.org/TR/xhtml1/transitional" href=
6358: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20 ben 6359: class="pkgname">pkgtools/createbuildlink</a> package is
6360: highly recommended. For most packages, the following
6361: command will generate a good starting point for
6362: <code class="filename">buildlink3.mk</code> files:</p>
1.1 grant 6363: <pre class="screen">
1.14 xtraeme 6364: <code class="prompt">%</code> <strong class=
6365: "userinput"><code>cd pkgsrc/<em class=
6366: "replaceable"><code>category</code></em>/<em class=
6367: "replaceable"><code>pkgdir</code></em>
6368: <code class=
6369: "prompt">%</code> createbuildlink -3 >buildlink3.mk</code></strong>
1.1 grant 6370: </pre>
6371:
6372: <div class="sect2" lang="en" xml:lang="en">
6373: <div class="titlepage">
6374: <div>
6375: <div>
1.22 ! tv 6376: <h3 class="title"><a name="id2581934" id=
! 6377: "id2581934"></a>9.2.1. Anatomy of a buildlink3.mk
1.1 grant 6378: file</h3>
6379: </div>
6380: </div>
6381: </div>
6382:
1.14 xtraeme 6383: <p>The following real-life example <code class=
6384: "filename">buildlink3.mk</code> is taken from
6385: <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 6386: <pre class="programlisting">
1.17 sketch 6387: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 6388:
6389: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
6390: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
6391:
6392: .if !empty(BUILDLINK_DEPTH:M+)
6393: BUILDLINK_DEPENDS+= tiff
6394: .endif
6395:
6396: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
6397: BUILDLINK_PACKAGES+= tiff
6398:
6399: .if !empty(TIFF_BUILDLINK3_MK:M+)
6400: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
6401: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
6402: .endif # TIFF_BUILDLINK3_MK
6403:
6404: .include "../../devel/zlib/buildlink3.mk"
6405: .include "../../graphics/jpeg/buildlink3.mk"
6406:
6407: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
6408: </pre>
6409:
1.14 xtraeme 6410: <p>The header and footer manipulate <code class=
6411: "varname">BUILDLINK_DEPTH</code>, which is common
6412: across all <code class="filename">buildlink3.mk</code>
6413: files and is used to track at what depth we are
6414: including <code class="filename">buildlink3.mk</code>
6415: files.</p>
1.1 grant 6416:
6417: <p>The first section controls if the dependency on
1.14 xtraeme 6418: <em class="replaceable"><code>pkg</code></em> is added.
6419: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 6420: global list of packages for which dependencies are
6421: added by buildlink3.</p>
6422:
6423: <p>The second section advises pkgsrc that the
1.14 xtraeme 6424: <code class="filename">buildlink3.mk</code> file for
6425: <em class="replaceable"><code>pkg</code></em> has been
6426: included at some point. <code class=
6427: "varname">BUILDLINK_PACKAGES</code> is the global list
6428: of packages for which <code class=
6429: "filename">buildlink3.mk</code> files have been
6430: included. It must <span class=
6431: "emphasis"><em>always</em></span> be appended to within
6432: a <code class="filename">buildlink3.mk</code> file.</p>
1.1 grant 6433:
6434: <p>The third section is protected from multiple
1.14 xtraeme 6435: inclusion and controls how the dependency on <em class=
6436: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 6437: important variables are set in the section:</p>
6438:
6439: <div class="itemizedlist">
6440: <ul type="disc">
6441: <li>
1.14 xtraeme 6442: <p><code class=
6443: "varname">BUILDLINK_DEPENDS.<em class=
6444: "replaceable"><code>pkg</code></em></code> is the
6445: actual dependency recorded in the installed
6446: package; this should always be set using
6447: <span><strong class="command">+=</strong></span>
6448: to ensure that we're appending to any
6449: pre-existing list of values. This variable should
6450: be set to the first version of the package that
6451: had the last change in the major number of a
6452: shared library or that had a major API
6453: change.</p>
1.1 grant 6454: </li>
6455:
6456: <li>
1.14 xtraeme 6457: <p><code class=
6458: "varname">BUILDLINK_PKGSRCDIR.<em class=
6459: "replaceable"><code>pkg</code></em></code> is the
6460: location of the <em class=
6461: "replaceable"><code>pkg</code></em> pkgsrc
1.1 grant 6462: directory;</p>
6463: </li>
6464:
6465: <li>
1.14 xtraeme 6466: <p><code class=
6467: "varname">BUILDLINK_DEPMETHOD.<em class=
6468: "replaceable"><code>pkg</code></em></code> (not
6469: shown above) controls whether we use <code class=
6470: "varname">BUILD_DEPENDS</code> or <code class=
6471: "varname">DEPENDS</code> to add the dependency on
6472: <em class="replaceable"><code>pkg</code></em>.
6473: The build dependency is selected by setting
6474: <code class=
6475: "varname">BUILDLINK_DEPMETHOD.<em class=
6476: "replaceable"><code>pkg</code></em></code> to
1.1 grant 6477: “<span class="quote">build</span>”.
6478: By default, the full dependency is used.</p>
6479: </li>
6480:
6481: <li>
1.14 xtraeme 6482: <p><code class=
6483: "varname">BUILDLINK_INCDIRS.<em class=
6484: "replaceable"><code>pkg</code></em></code> and
6485: <code class=
6486: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
6487: <code>pkg</code></em></code> (not shown above)
6488: are lists of subdirectories of <code class=
6489: "filename">${BUILDLINK_PREFIX.<em class=
6490: "replaceable"><code>pkg</code></em>}</code> to
6491: add to the header and library search paths. These
1.1 grant 6492: default to “<span class=
6493: "quote">include</span>” and
6494: “<span class="quote">lib</span>”
6495: respectively.</p>
6496: </li>
6497:
6498: <li>
1.14 xtraeme 6499: <p><code class=
6500: "varname">BUILDLINK_CPPFLAGS.<em class=
6501: "replaceable"><code>pkg</code></em></code> (not
6502: shown above) is the list of preprocessor flags to
6503: add to <code class="varname">CPPFLAGS</code>,
6504: which are passed on to the configure and build
6505: phases. The “<span class=
6506: "quote">-I</span>” option should be avoided
6507: and instead be handled using <code class=
6508: "varname">BUILDLINK_INCDIRS.<em class=
6509: "replaceable"><code>pkg</code></em></code> as
6510: above.</p>
1.1 grant 6511: </li>
6512: </ul>
6513: </div>
6514:
6515: <p>The following variables are all optionally defined
6516: within this second section (protected against multiple
6517: inclusion) and control which package files are
1.14 xtraeme 6518: symlinked into <code class=
6519: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 6520: are transformed during the symlinking:</p>
6521:
6522: <div class="itemizedlist">
6523: <ul type="disc">
6524: <li>
1.14 xtraeme 6525: <p><code class=
6526: "varname">BUILDLINK_FILES.<em class=
6527: "replaceable"><code>pkg</code></em></code> (not
6528: shown above) is a shell glob pattern relative to
6529: <code class=
6530: "filename">${BUILDLINK_PREFIX.<em class=
6531: "replaceable"><code>pkg</code></em>}</code> to be
6532: symlinked into <code class=
6533: "filename">${BUILDLINK_DIR}</code>, e.g.
6534: <code class="filename">include/*.h</code>.</p>
1.1 grant 6535: </li>
6536:
6537: <li>
1.14 xtraeme 6538: <p><code class=
6539: "varname">BUILDLINK_FILES_CMD.<em class=
6540: "replaceable"><code>pkg</code></em></code> (not
6541: shown above) is a shell pipeline that outputs to
6542: stdout a list of files relative to <code class=
6543: "filename">${BUILDLINK_PREFIX.<em class=
6544: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 6545: resulting files are to be symlinked into
1.14 xtraeme 6546: <code class="filename">${BUILDLINK_DIR}</code>.
6547: By default, this takes the <code class=
6548: "filename">+CONTENTS</code> of a <em class=
6549: "replaceable"><code>pkg</code></em> and filters
6550: it through <code class=
6551: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
6552: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 6553: </li>
6554:
6555: <li>
1.14 xtraeme 6556: <p><code class=
6557: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
6558: "replaceable"><code>pkg</code></em></code> (not
6559: shown above) is a filter command that filters
6560: <code class="filename">+CONTENTS</code> input
6561: into a list of files relative to <code class=
6562: "filename">${BUILDLINK_PREFIX.<em class=
6563: "replaceable"><code>pkg</code></em>}</code> on
6564: stdout. By default for overwrite packages,
6565: <code class=
6566: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
6567: "replaceable"><code>pkg</code></em></code>
6568: outputs the contents of the <code class=
6569: "filename">include</code> and <code class=
6570: "filename">lib</code> directories in the package
6571: <code class="filename">+CONTENTS</code>, and for
6572: pkgviews packages, it outputs any libtool
6573: archives in <code class="filename">lib</code>
1.1 grant 6574: directories.</p>
6575: </li>
6576:
6577: <li>
1.14 xtraeme 6578: <p><code class=
6579: "varname">BUILDLINK_TRANSFORM.<em class=
6580: "replaceable"><code>pkg</code></em></code> (not
6581: shown above) is a list of sed arguments used to
1.1 grant 6582: transform the name of the source filename into a
1.14 xtraeme 6583: destination filename, e.g. <span><strong class=
1.1 grant 6584: "command">-e
1.14 xtraeme 6585: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 6586: </li>
6587: </ul>
6588: </div>
6589:
1.14 xtraeme 6590: <p>The last section includes any <code class=
6591: "filename">buildlink3.mk</code> needed for <em class=
6592: "replaceable"><code>pkg</code></em>'s library
6593: dependencies. Including these <code class=
6594: "filename">buildlink3.mk</code> files means that the
6595: headers and libraries for these dependencies are also
6596: symlinked into <code class=
6597: "filename">${BUILDLINK_DIR}</code> whenever the
6598: <em class="replaceable"><code>pkg</code></em>
6599: <code class="filename">buildlink3.mk</code> file is
6600: included.</p>
1.1 grant 6601: </div>
6602:
6603: <div class="sect2" lang="en" xml:lang="en">
6604: <div class="titlepage">
6605: <div>
6606: <div>
1.22 ! tv 6607: <h3 class="title"><a name="id2582307" id=
! 6608: "id2582307"></a>9.2.2. Updating <code class=
1.14 xtraeme 6609: "varname">BUILDLINK_DEPENDS.<em class=
6610: "replaceable"><code>pkg</code></em></code> in
6611: <code class="filename">buildlink3.mk</code>
6612: files</h3>
1.1 grant 6613: </div>
6614: </div>
6615: </div>
6616:
6617: <p>There are two situations that require increasing the
1.14 xtraeme 6618: dependency listed in <code class=
6619: "varname">BUILDLINK_DEPENDS.<em class=
6620: "replaceable"><code>pkg</code></em></code> after a
6621: package update:</p>
1.1 grant 6622:
6623: <div class="orderedlist">
6624: <ol type="1">
6625: <li>
6626: <p>if the sonames (major number of the library
6627: version) of any installed shared libraries
6628: change;</p>
6629: </li>
6630:
6631: <li>
6632: <p>if the API or interface to the header files
6633: change.</p>
6634: </li>
6635: </ol>
6636: </div>
6637:
1.14 xtraeme 6638: <p>In these cases, <code class=
6639: "varname">BUILDLINK_DEPENDS.<em class=
6640: "replaceable"><code>pkg</code></em></code> should be
6641: adjusted to require at least the new package version.
6642: In some cases, the packages that depend on this new
6643: version may need their <code class=
6644: "varname">PKGREVISION</code>s increased and, if they
6645: have <code class="filename">buildlink3.mk</code> files,
6646: their <code class=
6647: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
6648: pkg</code></em></code> adjusted, too. This is needed so
6649: that binary packages made using it will require the
6650: correct package dependency and not settle for an older
6651: one which will not contain the necessary shared
6652: libraries.</p>
1.1 grant 6653:
6654: <p>Please take careful consideration before adjusting
1.14 xtraeme 6655: <code class="varname">BUILDLINK_DEPENDS.<em class=
6656: "replaceable"><code>pkg</code></em></code> as we don't
6657: want to cause unneeded package deletions and rebuilds.
6658: In many cases, new versions of packages work just fine
6659: with older dependencies. See <a href="#dependencies"
6660: title="12.1.3. Handling dependencies">Section
6661: 12.1.3, “Handling dependencies”</a> and
6662: <a href="#buildlink" title=
1.1 grant 6663: "Chapter 9. Buildlink methodology">Chapter 9,
6664: <i>Buildlink methodology</i></a> for more information
6665: about dependencies on other packages, including the
1.14 xtraeme 6666: <code class="varname">BUILDLINK_RECOMMENDED</code> and
6667: <code class="varname">RECOMMENDED</code>
6668: definitions.</p>
1.1 grant 6669: </div>
6670: </div>
6671:
6672: <div class="sect1" lang="en" xml:lang="en">
6673: <div class="titlepage">
6674: <div>
6675: <div>
6676: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 6677: "id2582386" id="id2582386"></a>9.3. Writing
1.14 xtraeme 6678: <code class="filename">builtin.mk</code> files</h2>
1.1 grant 6679: </div>
6680: </div>
6681: </div>
6682:
6683: <p>Some packages in pkgsrc install headers and libraries
6684: that coincide with headers and libraries present in the
1.14 xtraeme 6685: base system. Aside from a <code class=
6686: "filename">buildlink3.mk</code> file, these packages
6687: should also include a <code class=
6688: "filename">builtin.mk</code> file that includes the
6689: necessary checks to decide whether using the built-in
6690: software or the pkgsrc software is appropriate.</p>
1.1 grant 6691:
6692: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 6693: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 6694:
6695: <div class="orderedlist">
6696: <ol type="1">
6697: <li>
1.14 xtraeme 6698: <p>It should set <code class=
6699: "varname">USE_BUILTIN.<em class=
6700: "replaceable"><code>pkg</code></em></code> to
6701: either “<span class="quote">yes</span>”
6702: or “<span class="quote">no</span>”
6703: after it is included.</p>
1.1 grant 6704: </li>
6705:
6706: <li>
6707: <p>It should <span class=
6708: "emphasis"><em>not</em></span> override any
1.14 xtraeme 6709: <code class="varname">USE_BUILTIN.<em class=
6710: "replaceable"><code>pkg</code></em></code> which is
6711: already set before the <code class=
6712: "filename">builtin.mk</code> file is included.</p>
1.1 grant 6713: </li>
6714:
6715: <li>
6716: <p>It should be written to allow multiple
6717: inclusion. This is <span class=
6718: "emphasis"><em>very</em></span> important and takes
1.14 xtraeme 6719: careful attention to <code class=
6720: "filename">Makefile</code> coding.</p>
1.1 grant 6721: </li>
6722: </ol>
6723: </div>
6724:
6725: <div class="sect2" lang="en" xml:lang="en">
6726: <div class="titlepage">
6727: <div>
6728: <div>
1.22 ! tv 6729: <h3 class="title"><a name="id2582603" id=
! 6730: "id2582603"></a>9.3.1. Anatomy of a
1.14 xtraeme 6731: <code class="filename">builtin.mk</code>
6732: file</h3>
1.1 grant 6733: </div>
6734: </div>
6735: </div>
6736:
6737: <p>The following is the recommended template for
6738: builtin.mk files:</p>
6739: <pre class="programlisting">
6740: .if !defined(IS_BUILTIN.foo)
6741: #
6742: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
6743: # genuinely exists in the system or not.
6744: #
6745: IS_BUILTIN.foo?= no
6746:
6747: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
6748: # version can be determined.
6749: #
6750: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
6751: BUILTIN_PKG.foo?= foo-1.0
6752: . endif
6753: .endif # IS_BUILTIN.foo
6754:
6755: .if !defined(USE_BUILTIN.foo)
6756: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
6757: . if defined(BUILTIN_PKG.foo)
6758: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
6759: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
6760: USE_BUILTIN.foo!= \
6761: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
6762: ${ECHO} "yes"; \
6763: else \
6764: ${ECHO} "no"; \
6765: fi
6766: . endif
6767: . endfor
6768: . endif
6769: .endif # USE_BUILTIN.foo
6770:
6771: CHECK_BUILTIN.foo?= no
6772: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
6773: #
6774: # Here we place code that depends on whether USE_BUILTIN.foo is set to
6775: # "yes" or "no".
6776: #
6777: .endif # CHECK_BUILTIN.foo
6778:
6779: </pre>
6780:
1.14 xtraeme 6781: <p>The first section sets <code class=
6782: "varname">IS_BUILTIN.<em class=
6783: "replaceable"><code>pkg</code></em></code> depending on
6784: if <em class="replaceable"><code>pkg</code></em> really
6785: exists in the base system. This should not be a base
6786: system software with similar functionality to
6787: <em class="replaceable"><code>pkg</code></em>; it
6788: should only be “<span class=
6789: "quote">yes</span>” if the actual package is
6790: included as part of the base system. This variable is
6791: only used internally within the <code class=
6792: "filename">builtin.mk</code> file.</p>
6793:
6794: <p>The second section sets <code class=
6795: "varname">BUILTIN_PKG.<em class=
6796: "replaceable"><code>pkg</code></em></code> to the
6797: version of <em class=
6798: "replaceable"><code>pkg</code></em> in the base system
6799: if it exists (if <code class=
6800: "varname">IS_BUILTIN.<em class=
6801: "replaceable"><code>pkg</code></em></code> is
1.1 grant 6802: “<span class="quote">yes</span>”). This
1.14 xtraeme 6803: variable is only used internally within the
6804: <code class="filename">builtin.mk</code> file.</p>
1.1 grant 6805:
1.14 xtraeme 6806: <p>The third section sets <code class=
6807: "varname">USE_BUILTIN.<em class=
6808: "replaceable"><code>pkg</code></em></code> and is
6809: <span class="emphasis"><em>required</em></span> in all
6810: <code class="filename">builtin.mk</code> files. The
6811: code in this section must make the determination
6812: whether the built-in software is adequate to satisfy
6813: the dependencies listed in <code class=
6814: "varname">BUILDLINK_DEPENDS.<em class=
6815: "replaceable"><code>pkg</code></em></code>. This is
6816: typically done by comparing <code class=
6817: "varname">BUILTIN_PKG.<em class=
6818: "replaceable"><code>pkg</code></em></code> against each
6819: of the dependencies in <code class=
6820: "varname">BUILDLINK_DEPENDS.<em class=
6821: "replaceable"><code>pkg</code></em></code>.
6822: <code class="varname">USE_BUILTIN.<em class=
6823: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 6824: "emphasis"><em>must</em></span> be set to the correct
1.14 xtraeme 6825: value by the end of the <code class=
6826: "filename">builtin.mk</code> file. Note that
6827: <code class="varname">USE_BUILTIN.<em class=
6828: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 6829: “<span class="quote">yes</span>” even if
1.14 xtraeme 6830: <code class="varname">IS_BUILTIN.<em class=
6831: "replaceable"><code>pkg</code></em></code> is
1.1 grant 6832: “<span class="quote">no</span>” because we
6833: may make the determination that the built-in version of
6834: the software is similar enough to be used as a
6835: replacement.</p>
6836:
1.14 xtraeme 6837: <p>The last section is guarded by <code class=
6838: "varname">CHECK_BUILTIN.<em class=
6839: "replaceable"><code>pkg</code></em></code>, and
6840: includes code that uses the value of <code class=
6841: "varname">USE_BUILTIN.<em class=
6842: "replaceable"><code>pkg</code></em></code> set in the
6843: previous section. This typically includes, e.g., adding
1.1 grant 6844: additional dependency restrictions and listing
1.14 xtraeme 6845: additional files to symlink into <code class=
6846: "filename">${BUILDLINK_DIR}</code> (via <code class=
6847: "varname">BUILDLINK_FILES.<em class=
6848: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 6849: </div>
6850:
6851: <div class="sect2" lang="en" xml:lang="en">
6852: <div class="titlepage">
6853: <div>
6854: <div>
1.22 ! tv 6855: <h3 class="title"><a name="id2582830" id=
! 6856: "id2582830"></a>9.3.2. Global preferences
1.1 grant 6857: for native or pkgsrc software</h3>
6858: </div>
6859: </div>
6860: </div>
6861:
6862: <p>When building packages, it's possible to choose
6863: whether to set a global preference for using either the
6864: built-in (native) version or the pkgsrc version of
6865: software to satisfy a dependency. This is controlled by
1.14 xtraeme 6866: setting <code class="varname">PREFER_PKGSRC</code> and
6867: <code class="varname">PREFER_NATIVE</code>. These
6868: variables take values of either “<span class=
1.1 grant 6869: "quote">yes</span>”, “<span class=
6870: "quote">no</span>”, or a list of packages.
1.14 xtraeme 6871: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
6872: to use the pkgsrc versions of software, while
6873: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
6874: to use the built-in versions. Preferences are
6875: determined by the most specific instance of the package
6876: in either <code class="varname">PREFER_PKGSRC</code> or
6877: <code class="varname">PREFER_NATIVE</code>. If a
6878: package is specified in neither or in both variables,
6879: then <code class="varname">PREFER_PKGSRC</code> has
6880: precedence over <code class=
6881: "varname">PREFER_NATIVE</code>. For example, to require
6882: using pkgsrc versions of software for all but the most
6883: basic bits on a NetBSD system, you can set:</p>
1.1 grant 6884: <pre class="programlisting">
6885: PREFER_PKGSRC= yes
6886: PREFER_NATIVE= getopt skey tcp_wrappers
6887:
6888: </pre>
6889:
6890: <p>A package <span class=
1.14 xtraeme 6891: "emphasis"><em>must</em></span> have a <code class=
6892: "filename">builtin.mk</code> file to be listed in
6893: <code class="varname">PREFER_NATIVE</code>, otherwise
6894: it is simply ignored in that list.</p>
1.1 grant 6895: </div>
6896: </div>
6897: </div>
6898:
6899: <div class="chapter" lang="en" xml:lang="en">
6900: <div class="titlepage">
6901: <div>
6902: <div>
6903: <h2 class="title"><a name="options" id=
6904: "options"></a>Chapter 10. Options
6905: handling</h2>
6906: </div>
6907: </div>
6908: </div>
6909:
6910: <div class="toc">
6911: <p><b>Table of Contents</b></p>
6912:
6913: <dl>
1.22 ! tv 6914: <dt><span class="sect1"><a href="#id2582903">10.1.
1.1 grant 6915: Global default options</a></span></dt>
6916:
1.22 ! tv 6917: <dt><span class="sect1"><a href="#id2582918">10.2.
1.14 xtraeme 6918: Converting packages to use <code class=
6919: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 6920: </dl>
6921: </div>
6922:
6923: <p>Many packages have the ability to be built to support
1.14 xtraeme 6924: different sets of features. <code class=
6925: "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1 grant 6926: that provides generic handling of those options that
6927: determine different ways in which the packages can be
6928: built. It's possible for the user to specify exactly which
6929: sets of options will be built into a package or to allow a
6930: set of global default options apply.</p>
6931:
6932: <div class="sect1" lang="en" xml:lang="en">
6933: <div class="titlepage">
6934: <div>
6935: <div>
6936: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 6937: "id2582903" id="id2582903"></a>10.1. Global
1.1 grant 6938: default options</h2>
6939: </div>
6940: </div>
6941: </div>
6942:
1.14 xtraeme 6943: <p>Global default options are listed in <code class=
6944: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1 grant 6945: the options that should be built into every package if
6946: that option is supported. This variable should be set in
1.14 xtraeme 6947: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 6948: </div>
6949:
6950: <div class="sect1" lang="en" xml:lang="en">
6951: <div class="titlepage">
6952: <div>
6953: <div>
6954: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 6955: "id2582918" id=
! 6956: "id2582918"></a>10.2. Converting packages to
1.14 xtraeme 6957: use <code class=
6958: "filename">bsd.options.mk</code></h2>
1.1 grant 6959: </div>
6960: </div>
6961: </div>
6962:
1.14 xtraeme 6963: <p>The following example shows how <code class=
6964: "filename">bsd.options.mk</code> should be use in a
6965: package <code class="filename">Makefile</code>, or in a
6966: file, e.g. <code class="filename">options.mk</code>, that
6967: is included by the main package <code class=
6968: "filename">Makefile</code>.</p>
1.1 grant 6969: <pre class="programlisting">
6970: # Global and legacy options
6971: .if defined(WIBBLE_USE_OPENLDAP) && !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
6972: PKG_DEFAULT_OPTIONS+= ldap
6973: .endif
6974: .if defined(USE_SASL2) && !empty(USE_SASL2:M[yY][eE][sS])
6975: PKG_DEFAULT_OPTIONS+= sasl
6976: .endif
6977:
6978: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
6979: PKG_SUPPORTED_OPTIONS= ldap sasl
6980: #
6981: # Default options for "wibble" package.
6982: #
6983: .if !defined(PKG_OPTIONS.wibble)
6984: PKG_DEFAULT_OPTIONS+= sasl
6985: endif
6986: .include "../../mk/bsd.options.mk"
6987:
6988: # Package-specific option-handling
6989:
6990: ###
6991: ### LDAP support
6992: ###
6993: .if !empty(PKG_OPTIONS:Mldap)
6994: . include "../../databases/openldap/buildlink3.mk"
6995: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
6996: .endif
6997:
6998: ###
6999: ### SASL authentication
7000: ###
7001: .if !empty(PKG_OPTIONS:Msasl)
7002: . include "../../security/cyrus-sasl2/buildlink3.mk"
7003: CONFIGURE_ARGS+= --enable-sasl=${BUILDLINK_PREFIX.sasl}
7004: .endif
7005:
7006: </pre>
7007:
7008: <p>The first section only exists if you are converting a
7009: package that had its own ad-hoc options handling to use
1.14 xtraeme 7010: <code class="filename">bsd.options.mk</code>. It converts
1.1 grant 7011: global or legacy options variables into an equivalent
1.14 xtraeme 7012: <code class="varname">PKG_OPTIONS.<em class=
7013: "replaceable"><code>pkg</code></em></code> value. These
7014: sections will be removed over time as the old options are
7015: in turn deprecated and removed.</p>
1.1 grant 7016:
7017: <p>The second section contains the information about
7018: which build options are supported by the package, and any
7019: default options settings if needed.</p>
7020:
7021: <div class="orderedlist">
7022: <ol type="1">
7023: <li>
1.14 xtraeme 7024: <p><code class="varname">PKG_OPTIONS_VAR</code> is
7025: a list of the name of the <a href=
1.1 grant 7026: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7027: <span class="citerefentry"><span class=
7028: "refentrytitle">make</span>(1)</span></a> variables
7029: that contain the options the user wishes to select.
7030: The recommended value is “<span class=
1.14 xtraeme 7031: "quote">PKG_OPTIONS.<em class=
7032: "replaceable"><code>pkg</code></em></span>”
7033: but any package-specific value may be used. This
1.1 grant 7034: variable should be set in a package Makefile.</p>
7035: </li>
7036:
7037: <li>
1.14 xtraeme 7038: <p><code class=
7039: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
7040: build options supported by the package. This
7041: variable should be set in a package Makefile.</p>
1.1 grant 7042: </li>
7043:
7044: <li>
1.14 xtraeme 7045: <p><code class="varname">${PKG_OPTIONS_VAR}</code>
7046: (the variables named in <code class=
7047: "varname">PKG_OPTIONS_VAR</code>) are variables
7048: that list the selected build options and override
7049: any default options given in <code class=
7050: "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1 grant 7051: options begin with a “<span class=
7052: "quote">-</span>”, then that option is always
7053: removed from the selected build options, e.g.</p>
7054: <pre class="programlisting">
7055: PKG_DEFAULT_OPTIONS= kerberos ldap sasl
7056: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
7057: WIBBLE_OPTIONS= ${PKG_DEFAULT_OPTIONS} -sasl
7058: # implies PKG_OPTIONS == "kerberos ldap"
7059:
7060: </pre>
7061:
7062: <p>or</p>
7063: <pre class="programlisting">
7064: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
7065: WIBBLE_OPTIONS= kerberos -ldap ldap
7066: # implies PKG_OPTIONS == "kerberos"
7067:
7068: </pre>
7069:
1.14 xtraeme 7070: <p>This variable should be set in <code class=
7071: "filename">/etc/mk.conf</code>.</p>
1.1 grant 7072: </li>
7073: </ol>
7074: </div>
7075:
7076: <p>After the inclusion of bsd.options.mk, the following
7077: variables are set:</p>
7078:
7079: <div class="itemizedlist">
7080: <ul type="disc">
7081: <li>
1.14 xtraeme 7082: <p><code class="varname">PKG_OPTIONS</code>
7083: contains the list of the selected build options,
7084: properly filtered to remove unsupported and
7085: duplicate options.</p>
1.1 grant 7086: </li>
7087: </ul>
7088: </div>
7089:
7090: <p>The remaining sections contain the logic that is
7091: specific to each option. There should be a check for
1.14 xtraeme 7092: every option listed in <code class=
7093: "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
7094: be clear documentation on what turning on the option will
7095: do in the comments preceding each section. The correct
7096: way to check for an option is to check whether it is
7097: listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1 grant 7098: </div>
7099: </div>
7100:
7101: <div class="chapter" lang="en" xml:lang="en">
7102: <div class="titlepage">
7103: <div>
7104: <div>
7105: <h2 class="title"><a name="build" id=
7106: "build"></a>Chapter 11. The build
7107: process</h2>
7108: </div>
7109: </div>
7110: </div>
7111:
7112: <div class="toc">
7113: <p><b>Table of Contents</b></p>
7114:
7115: <dl>
7116: <dt><span class="sect1"><a href="#build.prefix">11.1.
7117: Program location</a></span></dt>
7118:
1.22 ! tv 7119: <dt><span class="sect1"><a href="#id2583526">11.2. Main
1.1 grant 7120: targets</a></span></dt>
7121:
7122: <dt><span class="sect1"><a href=
7123: "#build.helpful-targets">11.3. Other helpful
7124: targets</a></span></dt>
7125: </dl>
7126: </div>
7127:
7128: <p>The basic steps for building a program are always the
7129: same. First the program's source (<span class=
7130: "emphasis"><em>distfile</em></span>) must be brought to the
7131: local system and then extracted. After any patches to
7132: compile properly on NetBSD are applied, the software can be
7133: configured, then built (usually by compiling), and finally
7134: the generated binaries, etc. can be put into place on the
7135: system. These are exactly the steps performed by the NetBSD
7136: package system, which is implemented as a series of targets
1.14 xtraeme 7137: in a central Makefile, <code class=
7138: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 7139:
7140: <div class="sect1" lang="en" xml:lang="en">
7141: <div class="titlepage">
7142: <div>
7143: <div>
7144: <h2 class="title" style="clear: both"><a name=
7145: "build.prefix" id=
7146: "build.prefix"></a>11.1. Program location</h2>
7147: </div>
7148: </div>
7149: </div>
7150:
7151: <p>Before outlining the process performed by the NetBSD
7152: package system in the next section, here's a brief
7153: discussion on where programs are installed, and which
7154: variables influence this.</p>
7155:
1.14 xtraeme 7156: <p>The automatic variable <code class=
7157: "varname">PREFIX</code> indicates where all files of the
7158: final program shall be installed. It is usually set to
7159: <code class="varname">LOCALBASE</code> (<code class=
7160: "filename">/usr/pkg</code>), or <code class=
7161: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 7162: “<span class="quote">cross</span>” category.
1.14 xtraeme 7163: The value of <code class="varname">PREFIX</code> needs to
7164: be put into the various places in the program's source
7165: where paths to these files are encoded. See <a href=
1.1 grant 7166: "#components.patches" title=
7167: "7.3. patches/*">Section 7.3,
7168: “patches/*”</a> and <a href="#fixes.libtool"
7169: title=
7170: "12.3.1. Shared libraries - libtool">Section 12.3.1,
7171: “Shared libraries - libtool”</a> for more
7172: details.</p>
7173:
7174: <p>When choosing which of these variables to use, follow
7175: the following rules:</p>
7176:
7177: <div class="itemizedlist">
7178: <ul type="disc">
7179: <li>
1.14 xtraeme 7180: <p><code class="varname">PREFIX</code> always
7181: points to the location where the current pkg will
7182: be installed. When referring to a pkg's own
1.1 grant 7183: installation path, use “<span class=
7184: "quote">${PREFIX}</span>”.</p>
7185: </li>
7186:
7187: <li>
1.14 xtraeme 7188: <p><code class="varname">LOCALBASE</code> is where
7189: all non-X11 pkgs are installed. If you need to
1.1 grant 7190: construct a -I or -L argument to the compiler to
7191: find includes and libraries installed by another
7192: non-X11 pkg, use “<span class=
7193: "quote">${LOCALBASE}</span>”.</p>
7194: </li>
7195:
7196: <li>
1.14 xtraeme 7197: <p><code class="varname">X11BASE</code> is where
7198: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 7199: installed. When looking for <span class=
7200: "emphasis"><em>standard</em></span> X11 includes
7201: (not those installed by a pkg), use
7202: “<span class=
7203: "quote">${X11BASE}</span>”.</p>
7204: </li>
7205:
7206: <li>
7207: <p>X11 based are special in that they may be
1.14 xtraeme 7208: installed in either <code class=
7209: "varname">X11BASE</code> or <code class=
7210: "varname">LOCALBASE</code>.</p>
1.1 grant 7211:
7212: <p>Usually, X11 packages should be installed under
1.14 xtraeme 7213: <code class="varname">LOCALBASE</code> whenever
7214: possible. Note that you will need to set
7215: <code class="varname">USE_X11</code> in them to
7216: request the presence of X11 and to get the right
7217: compilation flags.</p>
1.1 grant 7218:
7219: <p>Even though, there are some packages that cannot
1.14 xtraeme 7220: be installed under <code class=
7221: "varname">LOCALBASE</code>: those that come with
1.1 grant 7222: app-defaults files. These packages are special and
1.14 xtraeme 7223: they must be placed under <code class=
7224: "varname">X11BASE</code>. To accomplish this, set
7225: either <code class="varname">USE_X11BASE</code> or
7226: <code class="varname">USE_IMAKE</code> in your
1.1 grant 7227: package.</p>
7228:
1.14 xtraeme 7229: <p>Some notes: <code class="varname">USE_X11</code>
7230: and <code class="varname">USE_X11BASE</code> are
7231: mutually exclusive. If you need to find includes or
7232: libraries installed by a pkg that has <code class=
7233: "varname">USE_IMAKE</code> or <code class=
7234: "varname">USE_X11BASE</code> in its pkg
7235: <code class="filename">Makefile</code>, you need to
7236: use <span class="emphasis"><em>both</em></span>
7237: <code class="filename">${X11BASE}</code> and
7238: <code class="filename">${LOCALBASE}</code>. To
7239: force installation of all X11 packages in
7240: <code class="varname">LOCALBASE</code>, the
7241: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
7242: href=
1.1 grant 7243: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20 ben 7244: class="pkgname">pkgtools/xpkgwedge</a> is enabled
7245: by default.</p>
1.1 grant 7246: </li>
7247:
7248: <li>
1.14 xtraeme 7249: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 7250: used to refer to the installed location of an X11
1.14 xtraeme 7251: package. <code class="varname">X11PREFIX</code>
7252: will be set to <code class="varname">X11BASE</code>
7253: if xpkgwedge is not installed, and to <code class=
7254: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 7255: installed.</p>
7256: </li>
7257:
7258: <li>
7259: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 7260: have some packages installed in <code class=
7261: "varname">X11BASE</code> and some in <code class=
7262: "varname">LOCALBASE</code>. To determine the prefix
7263: of an installed package, the <code class=
7264: "varname">EVAL_PREFIX</code> definition can be
7265: used. It takes pairs in the format
7266: “<span class=
1.1 grant 7267: "quote">DIRNAME=<package></span>”, and
1.14 xtraeme 7268: the make(1) variable <code class=
7269: "varname">DIRNAME</code> will be set to the prefix
7270: of the installed package <package>, or
1.1 grant 7271: “<span class=
7272: "quote">${X11PREFIX}</span>” if the package
7273: is not installed.</p>
7274:
7275: <p>This is best illustrated by example.</p>
7276:
1.14 xtraeme 7277: <p>The following lines are taken from <code class=
7278: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 7279: <pre class="programlisting">
1.14 xtraeme 7280: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 7281: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
7282: --with-gtk-prefix="${GTKDIR}" \
7283: --enable-multibyte
7284: </pre>
7285:
7286: <p>Specific defaults can be defined for the
1.14 xtraeme 7287: packages evaluated using <code class=
7288: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 7289: of the form:</p>
7290: <pre class="programlisting">
7291: GTKDIR_DEFAULT= ${LOCALBASE}
7292: </pre>
7293:
1.14 xtraeme 7294: <p>where <code class="varname">GTKDIR</code>
1.1 grant 7295: corresponds to the first definition in the
1.14 xtraeme 7296: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 7297: </li>
7298:
7299: <li>
1.14 xtraeme 7300: <p>Within <code class="filename">${PREFIX}</code>,
1.1 grant 7301: packages should install files according to hier(7),
7302: with the exception that manual pages go into
1.14 xtraeme 7303: <code class="filename">${PREFIX}/man</code>, not
7304: <code class=
7305: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 7306: </li>
7307: </ul>
7308: </div>
7309: </div>
7310:
7311: <div class="sect1" lang="en" xml:lang="en">
7312: <div class="titlepage">
7313: <div>
7314: <div>
7315: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 7316: "id2583526" id="id2583526"></a>11.2. Main
1.1 grant 7317: targets</h2>
7318: </div>
7319: </div>
7320: </div>
7321:
7322: <p>The main targets used during the build process defined
1.14 xtraeme 7323: in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 7324:
7325: <div class="variablelist">
7326: <dl>
7327: <dt><span class="term">fetch</span></dt>
7328:
7329: <dd>
7330: <p>This will check if the file(s) given in the
1.14 xtraeme 7331: variables <code class="varname">DISTFILES</code>
7332: and <code class="varname">PATCHFILES</code> (as
7333: defined in the package's Makefile) are present on
7334: the local system in <code class=
7335: "filename">/usr/pkgsrc/distfiles</code>. If they
7336: are not present, an attempt will be made to fetch
7337: them using commands of the form:</p>
1.1 grant 7338: <pre class="programlisting">
7339: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
7340: </pre>
7341:
7342: <p>where ${site} varies through several
1.14 xtraeme 7343: possibilities in turn: first, <code class=
7344: "varname">MASTER_SITE_OVERRIDE</code> is tried,
7345: then the sites specified in either <code class=
7346: "varname">SITES_file</code> if defined, else
7347: <code class="varname">MASTER_SITES</code> or
7348: <code class="varname">PATCH_SITES</code>, as
7349: applies, then finally the value of <code class=
7350: "varname">MASTER_SITE_BACKUP</code>. The order of
7351: all except the first can be optionally sorted by
7352: the user, via setting either <code class=
7353: "varname">MASTER_SORT_AWK</code> or <code class=
7354: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 7355: </dd>
7356:
7357: <dt><span class="term">checksum</span></dt>
7358:
7359: <dd>
7360: <p>After the distfile(s) are fetched, their
7361: checksum is generated and compared with the
7362: checksums stored in the distinfo file. If the
7363: checksums don't match, the build is aborted. This
7364: is to ensure the same distfile is used for
7365: building, and that the distfile wasn't changed,
7366: e.g. by some malign force, deliberately changed
7367: distfiles on the master distribution site or
7368: network lossage.</p>
7369: </dd>
7370:
7371: <dt><span class="term">extract</span></dt>
7372:
7373: <dd>
7374: <p>When the distfiles are present on the local
7375: system, they need to be extracted, as they are
7376: usually in the form of some compressed archive
1.14 xtraeme 7377: format, most commonly <code class=
7378: "filename">.tar.gz</code>.</p>
1.1 grant 7379:
7380: <p>If only some of the distfiles need to be
7381: uncompressed, the files to be uncompressed should
1.14 xtraeme 7382: be put into <code class=
7383: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 7384:
1.14 xtraeme 7385: <p>If the distfiles are not in <code class=
7386: "filename">.tar.gz</code> format, they can be
7387: extracted by setting either <code class=
7388: "varname">EXTRACT_SUFX</code>, or <code class=
7389: "varname">EXTRACT_CMD</code>, <code class=
7390: "varname">EXTRACT_BEFORE_ARGS</code> and
7391: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
7392: the former case, pkgsrc knows how to extract a
7393: number of suffixes (<code class=
7394: "filename">.tar.gz</code>, <code class=
7395: "filename">.tgz</code>, <code class=
7396: "filename">.tar.gz2</code>, <code class=
7397: "filename">.tbz</code>, <code class=
7398: "filename">.tar.Z</code>, <code class=
7399: "filename">.tar</code>, <code class=
7400: "filename">.shar.gz</code>, <code class=
7401: "filename">.shar.bz2</code>, <code class=
7402: "filename">.shar.Z</code>, <code class=
7403: "filename">.shar</code>, <code class=
7404: "filename">.Z</code>, <code class=
7405: "filename">.bz2</code> and <code class=
7406: "filename">.gz</code>; see the definition of the
7407: various <code class="varname">DECOMPRESS_CMD</code>
7408: variables <code class="filename">bsd.pkg.mk</code>
7409: for a complete list). Here's an example on how to
7410: use the other variables for a program that comes
7411: with a compressed shell archive whose name ends in
7412: <code class="filename">.msg.gz</code>:</p>
1.1 grant 7413: <pre class="programlisting">
7414: EXTRACT_SUFX= .msg.gz
7415: EXTRACT_CMD= zcat
7416: EXTRACT_BEFORE_ARGS=
7417: EXTRACT_AFTER_ARGS= |sh
7418: </pre>
7419: </dd>
7420:
7421: <dt><span class="term">patch</span></dt>
7422:
7423: <dd>
7424: <p>After extraction, all the patches named by the
1.14 xtraeme 7425: <code class="varname">PATCHFILES</code>, those
7426: present in the patches subdirectory of the package
7427: as well as in $LOCALPATCHES/$PKGPATH (e.g.
7428: <code class=
7429: "filename">/usr/local/patches/graphics/png</code>)
7430: are applied. Patchfiles ending in <code class=
7431: "filename">.Z</code> or <code class=
7432: "filename">.gz</code> are uncompressed before they
7433: are applied, files ending in <code class=
7434: "filename">.orig</code> or <code class=
7435: "filename">.rej</code> are ignored. Any special
7436: options to patch(1) can be handed in <code class=
7437: "varname">PATCH_DIST_ARGS</code>. See <a href=
7438: "#components.patches" title=
1.1 grant 7439: "7.3. patches/*">Section 7.3,
7440: “patches/*”</a> for more details.</p>
7441:
7442: <p>By default patch(1) is given special args to
7443: make it fail if the patches apply with some lines
7444: of fuzz. Please fix (regen) the patches so that
7445: they apply cleanly. The rationale behind this is
7446: that patches that don't apply cleanly may end up
7447: being applied in the wrong place, and cause severe
7448: harm there.</p>
7449: </dd>
7450:
7451: <dt><span class="term">configure</span></dt>
7452:
7453: <dd>
7454: <p>Most pieces of software need information on the
7455: header files, system calls, and library routines
7456: which are available in NetBSD. This is the process
7457: known as configuration, and is usually automated.
7458: In most cases, a script is supplied with the
7459: source, and its invocation results in generation of
7460: header files, Makefiles, etc.</p>
7461:
7462: <p>If the program's distfile contains its own
7463: configure script, this can be invoked by setting
1.14 xtraeme 7464: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 7465: configure script is a GNU autoconf script,
1.14 xtraeme 7466: <code class="varname">GNU_CONFIGURE</code> should
7467: be specified instead. In either case, any arguments
7468: to the configure script can be specified in the
7469: <code class="varname">CONFIGURE_ARGS</code>
7470: variable, and the configure script's name can be
7471: set in <code class=
7472: "varname">CONFIGURE_SCRIPT</code> if it differs
7473: from the default “<span class=
1.1 grant 7474: "quote">configure</span>”. Here's an example
7475: from the <a xmlns=
7476: "http://www.w3.org/TR/xhtml1/transitional" href=
7477: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20 ben 7478: class="pkgname">sysutils/top</a> package:</p>
1.1 grant 7479: <pre class="programlisting">
7480: HAS_CONFIGURE= yes
7481: CONFIGURE_SCRIPT= Configure
7482: CONFIGURE_ARGS+= netbsd13
7483: </pre>
7484:
7485: <p>If the program uses an Imakefile for
7486: configuration, the appropriate steps can be invoked
1.14 xtraeme 7487: by setting <code class="varname">USE_IMAKE</code>
7488: to “<span class="quote">YES</span>”.
7489: (If you only want the package installed in
7490: <code class="varname">$X11PREFIX</code> but xmkmf
7491: not being run, set <code class=
7492: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 7493: </dd>
7494:
7495: <dt><span class="term">build</span></dt>
7496:
7497: <dd>
7498: <p>Once configuration has taken place, the software
1.14 xtraeme 7499: will be built by invoking <code class=
7500: "varname">$MAKE_PROGRAM</code> on <code class=
7501: "varname">$MAKEFILE</code> with <code class=
7502: "varname">$BUILD_TARGET</code> as the target to
7503: build. The default <code class=
7504: "varname">MAKE_PROGRAM</code> is
7505: “<span class="quote">gmake</span>” if
7506: <code class="varname">USE_GNU_TOOLS</code> contains
1.7 wiz 7507: “<span class="quote">make</span>”,
1.1 grant 7508: “<span class="quote">make</span>”
1.14 xtraeme 7509: otherwise. <code class="varname">MAKEFILE</code> is
7510: set to “<span class=
1.1 grant 7511: "quote">Makefile</span>” by default, and
1.14 xtraeme 7512: <code class="varname">BUILD_TARGET</code> defaults
7513: to “<span class="quote">all</span>”.
7514: Any of these variables can be set in the package's
1.1 grant 7515: Makefile to change the default build process.</p>
7516: </dd>
7517:
7518: <dt><span class="term">install</span></dt>
7519:
7520: <dd>
7521: <p>Once the build stage has completed, the final
7522: step is to install the software in public
7523: directories, so users can access the programs and
1.14 xtraeme 7524: files. As in the build-target, <code class=
7525: "varname">$MAKE_PROGRAM</code> is invoked on
7526: <code class="varname">$MAKEFILE</code> here, but
7527: with the <code class=
7528: "varname">$INSTALL_TARGET</code> instead, the
7529: latter defaulting to “<span class=
7530: "quote">install</span>” (plus
7531: “<span class=
7532: "quote">install.man</span>”, if <code class=
7533: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 7534: </dd>
7535: </dl>
7536: </div>
7537:
7538: <p>If no target is specified, the default is
7539: “<span class="quote">build</span>”. If a
7540: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 7541: e.g. <span><strong class="command">make
7542: build</strong></span> will also perform the equivalent
7543: of:</p>
1.1 grant 7544: <pre class="programlisting">
7545: make fetch
7546: make checksum
7547: make extract
7548: make patch
7549: make configure
7550: make build
7551: </pre>
7552: </div>
7553:
7554: <div class="sect1" lang="en" xml:lang="en">
7555: <div class="titlepage">
7556: <div>
7557: <div>
7558: <h2 class="title" style="clear: both"><a name=
7559: "build.helpful-targets" id=
7560: "build.helpful-targets"></a>11.3. Other
7561: helpful targets</h2>
7562: </div>
7563: </div>
7564: </div>
7565:
7566: <div class="variablelist">
7567: <dl>
7568: <dt><span class="term">pre/post-*</span></dt>
7569:
7570: <dd>
7571: <p>For any of the main targets described in the
7572: previous section, two auxiliary targets exist with
7573: “<span class="quote">pre-</span>” and
7574: “<span class="quote">post-</span>” used
7575: as a prefix for the main target's name. These
7576: targets are invoked before and after the main
7577: target is called, allowing extra configuration or
7578: installation steps be performed from a package's
7579: Makefile, for example, which a program's configure
7580: script or install target omitted.</p>
7581: </dd>
7582:
7583: <dt><span class="term">do-*</span></dt>
7584:
7585: <dd>
7586: <p>Should one of the main targets do the wrong
7587: thing, and should there be no variable to fix this,
7588: you can redefine it with the do-* target. (Note
7589: that redefining the target itself instead of the
7590: do-* target is a bad idea, as the pre-* and post-*
7591: targets won't be called anymore, etc.) You will not
7592: usually need to do this.</p>
7593: </dd>
7594:
7595: <dt><span class="term">reinstall</span></dt>
7596:
7597: <dd>
1.14 xtraeme 7598: <p>If you did a <span><strong class="command">make
7599: install</strong></span> and you noticed some file
7600: was not installed properly, you can repeat the
1.1 grant 7601: installation with this target, which will ignore
7602: the “<span class="quote">already
7603: installed</span>” flag.</p>
7604: </dd>
7605:
7606: <dt><span class="term">deinstall</span></dt>
7607:
7608: <dd>
7609: <p>This target does a pkg_delete(1) in the current
7610: directory, effectively de-installing the package.
7611: The following variables can be used to tune the
7612: behaviour:</p>
7613:
7614: <div class="variablelist">
7615: <dl>
1.14 xtraeme 7616: <dt><span class="term"><code class=
7617: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 7618:
7619: <dd>
7620: <p>Add a "-v" to the <a href=
7621: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7622: <span class="citerefentry"><span class=
7623: "refentrytitle">pkg_delete</span>(1)</span></a>
7624: command.</p>
7625: </dd>
7626:
1.14 xtraeme 7627: <dt><span class="term"><code class=
7628: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 7629:
7630: <dd>
7631: <p>Remove all packages that require (depend
7632: on) the given package. This can be used to
7633: remove any packages that may have been pulled
7634: in by a given package, e.g. if
1.14 xtraeme 7635: <span><strong class="command">make deinstall
7636: DEINSTALLDEPENDS=1</strong></span> is done in
7637: <code class="filename">pkgsrc/x11/kde</code>,
1.1 grant 7638: this is likely to remove whole KDE. Works by
7639: adding “<span class=
7640: "quote">-R</span>” to the <a href=
7641: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7642: <span class="citerefentry"><span class=
7643: "refentrytitle">pkg_delete</span>(1)</span></a>
7644: command line.</p>
7645: </dd>
7646: </dl>
7647: </div>
7648: </dd>
7649:
7650: <dt><span class="term">update</span></dt>
7651:
7652: <dd>
7653: <p>This target causes the current package to be
7654: updated to the latest version. The package and all
7655: depending packages first get de-installed, then
7656: current versions of the corresponding packages get
7657: compiled and installed. This is similar to manually
7658: noting which packages are currently installed, then
1.14 xtraeme 7659: performing a series of <span><strong class=
7660: "command">make deinstall</strong></span> and
7661: <span><strong class="command">make
7662: install</strong></span> (or whatever <code class=
7663: "varname">UPDATE_TARGET</code> is set to) for these
7664: packages.</p>
1.1 grant 7665:
7666: <p>You can use the “<span class=
7667: "quote">update</span>” target to resume
1.14 xtraeme 7668: package updating in case a previous
7669: <span><strong class="command">make
7670: update</strong></span> was interrupted for some
7671: reason. However, in this case, make sure you don't
7672: call <span><strong class="command">make
7673: clean</strong></span> or otherwise remove the list
7674: of dependent packages in <code class=
7675: "varname">WRKDIR</code>. Otherwise you lose the
1.1 grant 7676: ability to automatically update the current package
7677: along with the dependent packages you have
7678: installed.</p>
7679:
1.14 xtraeme 7680: <p>Resuming an interrupted <span><strong class=
7681: "command">make update</strong></span> will only
7682: work as long as the package tree remains unchanged.
7683: If the source code for one of the packages to be
7684: updated has been changed, resuming
7685: <span><strong class="command">make
7686: update</strong></span> will most certainly
7687: fail!</p>
1.1 grant 7688:
7689: <p>The following variables can be used either on
1.14 xtraeme 7690: the command line or in <code class=
7691: "filename">/etc/mk.conf</code> to alter the
7692: behaviour of <span><strong class="command">make
7693: update</strong></span>:</p>
1.1 grant 7694:
7695: <div class="variablelist">
7696: <dl>
1.14 xtraeme 7697: <dt><span class="term"><code class=
7698: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 7699:
7700: <dd>
7701: <p>Install target to recursively use for the
7702: updated package and the dependent packages.
1.14 xtraeme 7703: Defaults to <code class=
7704: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 7705: “<span class=
7706: "quote">install</span>” otherwise for
1.14 xtraeme 7707: <span><strong class="command">make
7708: update</strong></span>. e.g.
7709: <span><strong class="command">make update
7710: UPDATE_TARGET=package</strong></span></p>
1.1 grant 7711: </dd>
7712:
1.14 xtraeme 7713: <dt><span class="term"><code class=
7714: "varname">NOCLEAN</code></span></dt>
1.1 grant 7715:
7716: <dd>
7717: <p>Don't clean up after updating. Useful if
7718: you want to leave the work sources of the
7719: updated packages around for inspection or
7720: other purposes. Be sure you eventually clean
7721: up the source tree (see the
7722: “<span class=
7723: "quote">clean-update</span>” target
7724: below) or you may run into troubles with old
7725: source code still lying around on your next
1.14 xtraeme 7726: <span><strong class=
7727: "command">make</strong></span> or
7728: <span><strong class="command">make
7729: update</strong></span>.</p>
1.1 grant 7730: </dd>
7731:
1.14 xtraeme 7732: <dt><span class="term"><code class=
7733: "varname">REINSTALL</code></span></dt>
1.1 grant 7734:
7735: <dd>
7736: <p>Deinstall each package before installing
1.14 xtraeme 7737: (making <code class=
7738: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 7739: necessary if the “<span class=
7740: "quote">clean-update</span>” target
7741: (see below) was called after interrupting a
1.14 xtraeme 7742: running <span><strong class="command">make
7743: update</strong></span>.</p>
1.1 grant 7744: </dd>
7745:
1.14 xtraeme 7746: <dt><span class="term"><code class=
7747: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 7748:
7749: <dd>
7750: <p>Allows you to disable recursion and
7751: hardcode the target for packages. The default
7752: is “<span class=
7753: "quote">update</span>” for the update
7754: target, facilitating a recursive update of
1.14 xtraeme 7755: prerequisite packages. Only set <code class=
7756: "varname">DEPENDS_TARGET</code> if you want
7757: to disable recursive updates. Use
7758: <code class="varname">UPDATE_TARGET</code>
7759: instead to just set a specific target for
7760: each package to be installed during
7761: <span><strong class="command">make
7762: update</strong></span> (see above).</p>
1.1 grant 7763: </dd>
7764: </dl>
7765: </div>
7766: </dd>
7767:
7768: <dt><span class="term">clean-update</span></dt>
7769:
7770: <dd>
7771: <p>Clean the source tree for all packages that
1.14 xtraeme 7772: would get updated if <span><strong class=
7773: "command">make update</strong></span> was called
7774: from the current directory. This target should not
7775: be used if the current package (or any of its
7776: depending packages) have already been de-installed
7777: (e.g., after calling <span><strong class=
7778: "command">make update</strong></span>) or you may
7779: lose some packages you intended to update. As a
7780: rule of thumb: only use this target <span class=
7781: "emphasis"><em>before</em></span> the first time
7782: you run <span><strong class="command">make
7783: update</strong></span> and only if you have a dirty
7784: package tree (e.g., if you used <code class=
7785: "varname">NOCLEAN</code>).</p>
1.1 grant 7786:
7787: <p>If you unsure about whether your tree is clean
1.14 xtraeme 7788: you can either perform a <span><strong class=
7789: "command">make clean</strong></span> at the top of
7790: the tree, or use the following sequence of commands
1.1 grant 7791: from the directory of the package you want to
7792: update (<span class=
7793: "emphasis"><em>before</em></span> running
1.14 xtraeme 7794: <span><strong class="command">make
7795: update</strong></span> for the first time,
7796: otherwise you lose all the packages you wanted to
7797: update!):</p>
1.1 grant 7798: <pre class="screen">
1.14 xtraeme 7799: <code class="prompt">#</code> <strong class=
7800: "userinput"><code>make clean-update</code></strong>
7801: <code class="prompt">#</code> <strong class=
7802: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
7803: <code class="prompt">#</code> <strong class=
7804: "userinput"><code>make update</code></strong>
1.1 grant 7805: </pre>
7806:
7807: <p>The following variables can be used either on
1.14 xtraeme 7808: the command line or in <code class=
7809: "filename">/etc/mk.conf</code> to alter the
7810: behaviour of <span><strong class="command">make
7811: clean-update</strong></span>:</p>
1.1 grant 7812:
7813: <div class="variablelist">
7814: <dl>
1.14 xtraeme 7815: <dt><span class="term"><code class=
7816: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 7817:
7818: <dd>
1.14 xtraeme 7819: <p>After <span><strong class="command">make
7820: clean</strong></span>, do not reconstruct the
7821: list of directories to update for this
7822: package. Only use this if
7823: <span><strong class="command">make
7824: update</strong></span> successfully installed
7825: all packages you wanted to update. Normally,
7826: this is done automatically on
7827: <span><strong class="command">make
7828: update</strong></span>, but may have been
7829: suppressed by the <code class=
7830: "varname">NOCLEAN</code> variable (see
1.1 grant 7831: above).</p>
7832: </dd>
7833: </dl>
7834: </div>
7835: </dd>
7836:
7837: <dt><span class="term">info</span></dt>
7838:
7839: <dd>
7840: <p>This target invokes <a href=
7841: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
7842: <span class="citerefentry"><span class=
7843: "refentrytitle">pkg_info</span>(1)</span></a> for
7844: the current package. You can use this to check
7845: which version of a package is installed.</p>
7846: </dd>
7847:
7848: <dt><span class="term">readme</span></dt>
7849:
7850: <dd>
1.14 xtraeme 7851: <p>This target generates a <code class=
7852: "filename">README.html</code> file, which can be
1.1 grant 7853: viewed using a browser such as <a xmlns=
7854: "http://www.w3.org/TR/xhtml1/transitional" href=
7855: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 7856: class="pkgname">www/mozilla</a> or <a xmlns=
7857: "http://www.w3.org/TR/xhtml1/transitional" href=
7858: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
7859: class="pkgname">www/links</a>. The generated files
7860: contain references to any packages which are in the
7861: <code class="varname">PACKAGES</code> directory on
7862: the local host. The generated files can be made to
7863: refer to URLs based on <code class=
7864: "varname">FTP_PKG_URL_HOST</code> and <code class=
7865: "varname">FTP_PKG_URL_DIR</code>. For example, if I
7866: wanted to generate <code class=
7867: "filename">README.html</code> files which pointed
7868: to binary packages on the local machine, in the
7869: directory <code class=
7870: "filename">/usr/packages</code>, set <code class=
7871: "varname">FTP_PKG_URL_HOST=file://localhost</code>
7872: and <code class=
7873: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
7874: <code class="varname">${PACKAGES}</code> directory
7875: and its subdirectories will be searched for all the
7876: binary packages.</p>
1.1 grant 7877: </dd>
7878:
7879: <dt><span class="term">readme-all</span></dt>
7880:
7881: <dd>
1.14 xtraeme 7882: <p>Use this target to create a file <code class=
7883: "filename">README-all.html</code> which contains a
1.1 grant 7884: list of all packages currently available in the
7885: NetBSD Packages Collection, together with the
7886: category they belong to and a short description.
1.14 xtraeme 7887: This file is compiled from the <code class=
7888: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 7889: sure to run this <span class=
1.14 xtraeme 7890: "emphasis"><em>after</em></span> a
7891: <span><strong class="command">make
7892: readme</strong></span>.</p>
1.1 grant 7893: </dd>
7894:
7895: <dt><span class="term">cdrom-readme</span></dt>
7896:
7897: <dd>
7898: <p>This is very much the same as the
7899: “<span class="quote">readme</span>”
7900: target (see above), but is to be used when
7901: generating a pkgsrc tree to be written to a CD-ROM.
1.14 xtraeme 7902: This target also produces <code class=
7903: "filename">README.html</code> files, and can be
7904: made to refer to URLs based on <code class=
7905: "varname">CDROM_PKG_URL_HOST</code> and
7906: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 7907: </dd>
7908:
7909: <dt><span class="term">show-distfiles</span></dt>
7910:
7911: <dd>
7912: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 7913: are needed to build the package. (<code class=
7914: "varname">DISTFILES</code> and <code class=
7915: "varname">PATCHFILES</code>, but not <code class=
7916: "filename">patches/*</code>)</p>
1.1 grant 7917: </dd>
7918:
7919: <dt><span class="term">show-downlevel</span></dt>
7920:
7921: <dd>
7922: <p>This target shows nothing if the package is not
7923: installed. If a version of this package is
7924: installed, but is not the version provided in this
7925: version of pkgsrc, then a warning message is
7926: displayed. This target can be used to show which of
7927: your installed packages are downlevel, and so the
7928: old versions can be deleted, and the current ones
7929: added.</p>
7930: </dd>
7931:
7932: <dt><span class="term">show-pkgsrc-dir</span></dt>
7933:
7934: <dd>
7935: <p>This target shows the directory in the pkgsrc
7936: hierarchy from which the package can be built and
7937: installed. This may not be the same directory as
7938: the one from which the package was installed. This
7939: target is intended to be used by people who may
7940: wish to upgrade many packages on a single host, and
7941: can be invoked from the top-level pkgsrc Makefile
7942: by using the “<span class=
7943: "quote">show-host-specific-pkgs</span>”
7944: target.</p>
7945: </dd>
7946:
7947: <dt><span class=
7948: "term">show-installed-depends</span></dt>
7949:
7950: <dd>
7951: <p>This target shows which installed packages match
1.14 xtraeme 7952: the current package's <code class=
7953: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 7954: dependencies are causing build problems.</p>
7955: </dd>
7956:
7957: <dt><span class="term">check-shlibs</span></dt>
7958:
7959: <dd>
7960: <p>After a package is installed, check all its
7961: binaries and (on ELF platforms) shared libraries to
7962: see if they find the shared libs they need. Run by
1.14 xtraeme 7963: default if <code class=
7964: "varname">PKG_DEVELOPER</code> is set in
7965: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 7966: </dd>
7967:
7968: <dt><span class="term">print-PLIST</span></dt>
7969:
7970: <dd>
7971: <p>After a “<span class="quote">make
7972: install</span>” from a new or upgraded pkg,
7973: this prints out an attempt to generate a new
1.14 xtraeme 7974: <code class="filename">PLIST</code> from a
7975: <span><strong class="command">find -newer
7976: work/.extract_done</strong></span>. An attempt is
7977: made to care for shared libs etc., but it is
1.1 grant 7978: <span class="emphasis"><em>strongly</em></span>
7979: recommended to review the result before putting it
1.14 xtraeme 7980: into <code class="filename">PLIST</code>. On
7981: upgrades, it's useful to diff the output of this
7982: command against an already existing <code class=
7983: "filename">PLIST</code> file.</p>
1.1 grant 7984:
7985: <p>If the package installs files via tar(1) or
7986: other methods that don't update file access times,
7987: be sure to add these files manually to your
1.14 xtraeme 7988: <code class="filename">PLIST</code>, as the
1.1 grant 7989: “<span class="quote">find
7990: -newer</span>” command used by this target
7991: won't catch them!</p>
7992:
7993: <p>See <a href="#print-PLIST" title=
7994: "8.3. Tweaking output of make print-PLIST">Section 8.3,
1.14 xtraeme 7995: “Tweaking output of <span><strong class=
7996: "command">make
7997: print-PLIST</strong></span>”</a> for more
7998: information on this target.</p>
1.1 grant 7999: </dd>
8000:
8001: <dt><span class="term">bulk-package</span></dt>
8002:
8003: <dd>
8004: <p>Used to do bulk builds. If an appropriate binary
8005: package already exists, no action is taken. If not,
8006: this target will compile, install and package it
1.14 xtraeme 8007: (and it's depends, if <code class=
8008: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 8009: <a href="#binary.configuration" title=
8010: "5.3.1. Configuration">Section 5.3.1,
8011: “Configuration”</a>. After creating the
8012: binary package, the sources, the just-installed
8013: package and it's required packages are removed,
8014: preserving free disk space.</p>
8015:
8016: <p><span class="emphasis"><em>Beware that this
8017: target may deinstall all packages installed on a
8018: system!</em></span></p>
8019: </dd>
8020:
8021: <dt><span class="term">bulk-install</span></dt>
8022:
8023: <dd>
8024: <p>Used during bulk-installs to install required
8025: packages. If an upto-date binary package is
8026: available, it will be installed via <a href=
8027: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
8028: <span class="citerefentry"><span class=
8029: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 8030: not, <span><strong class="command">make
8031: bulk-package</strong></span> will be executed, but
8032: the installed binary not be removed.</p>
1.1 grant 8033:
8034: <p>A binary package is considered
8035: “<span class="quote">upto-date</span>”
8036: to be installed via <a href=
8037: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
8038: <span class="citerefentry"><span class=
8039: "refentrytitle">pkg_add</span>(1)</span></a>
8040: if:</p>
8041:
8042: <div class="itemizedlist">
8043: <ul type="disc">
8044: <li>
1.14 xtraeme 8045: <p>None of the package's files (<code class=
8046: "filename">Makefile</code>, ...) were
8047: modified since it was built.</p>
1.1 grant 8048: </li>
8049:
8050: <li>
8051: <p>None of the package's required (binary)
8052: packages were modified since it was
8053: built.</p>
8054: </li>
8055: </ul>
8056: </div>
8057:
8058: <p><span class="emphasis"><em>Beware that this
8059: target may deinstall all packages installed on a
8060: system!</em></span></p>
8061: </dd>
8062: </dl>
8063: </div>
8064: </div>
8065: </div>
8066:
8067: <div class="chapter" lang="en" xml:lang="en">
8068: <div class="titlepage">
8069: <div>
8070: <div>
8071: <h2 class="title"><a name="fixes" id=
8072: "fixes"></a>Chapter 12. Notes on fixes for
8073: packages</h2>
8074: </div>
8075: </div>
8076: </div>
8077:
8078: <div class="toc">
8079: <p><b>Table of Contents</b></p>
8080:
8081: <dl>
1.22 ! tv 8082: <dt><span class="sect1"><a href="#id2585063">12.1.
1.1 grant 8083: General operation</a></span></dt>
8084:
8085: <dd>
8086: <dl>
8087: <dt><span class="sect2"><a href=
1.22 ! tv 8088: "#id2585066">12.1.1. How to pull in variables from
1.1 grant 8089: /etc/mk.conf</a></span></dt>
8090:
8091: <dt><span class="sect2"><a href=
1.22 ! tv 8092: "#id2585149">12.1.2. Restricted
1.1 grant 8093: packages</a></span></dt>
8094:
8095: <dt><span class="sect2"><a href=
8096: "#dependencies">12.1.3. Handling
8097: dependencies</a></span></dt>
8098:
8099: <dt><span class="sect2"><a href=
1.22 ! tv 8100: "#id2585596">12.1.4. Handling conflicts with other
1.1 grant 8101: packages</a></span></dt>
8102:
8103: <dt><span class="sect2"><a href=
1.22 ! tv 8104: "#id2585715">12.1.5. Packages that cannot or should
1.1 grant 8105: not be built</a></span></dt>
8106:
8107: <dt><span class="sect2"><a href=
1.22 ! tv 8108: "#id2585740">12.1.6. Packages which should not be
1.1 grant 8109: deleted, once installed</a></span></dt>
8110:
8111: <dt><span class="sect2"><a href=
8112: "#security-handling">12.1.7. Handling packages with
8113: security problems</a></span></dt>
8114:
8115: <dt><span class="sect2"><a href=
1.22 ! tv 8116: "#id2585832">12.1.8. How to handle compiler
1.1 grant 8117: bugs</a></span></dt>
8118:
8119: <dt><span class="sect2"><a href=
1.22 ! tv 8120: "#id2585854">12.1.9. How to handle incrementing
1.1 grant 8121: versions when fixing an existing
8122: package</a></span></dt>
8123:
8124: <dt><span class="sect2"><a href=
1.22 ! tv 8125: "#id2585904">12.1.10. Portability of
1.1 grant 8126: packages</a></span></dt>
8127: </dl>
8128: </dd>
8129:
1.22 ! tv 8130: <dt><span class="sect1"><a href="#id2585928">12.2.
1.1 grant 8131: Possible downloading issues</a></span></dt>
8132:
8133: <dd>
8134: <dl>
8135: <dt><span class="sect2"><a href=
1.22 ! tv 8136: "#id2585931">12.2.1. Packages whose distfiles
1.1 grant 8137: aren't available for plain
8138: downloading</a></span></dt>
8139:
8140: <dt><span class="sect2"><a href=
1.22 ! tv 8141: "#id2585994">12.2.2. How to handle modified
1.1 grant 8142: distfiles with the 'old' name</a></span></dt>
8143: </dl>
8144: </dd>
8145:
1.22 ! tv 8146: <dt><span class="sect1"><a href="#id2586006">12.3.
1.1 grant 8147: Configuration gotchas</a></span></dt>
8148:
8149: <dd>
8150: <dl>
8151: <dt><span class="sect2"><a href=
8152: "#fixes.libtool">12.3.1. Shared libraries -
8153: libtool</a></span></dt>
8154:
8155: <dt><span class="sect2"><a href=
1.22 ! tv 8156: "#id2586589">12.3.2. Using libtool on GNU packages
1.1 grant 8157: that already support libtool</a></span></dt>
8158:
8159: <dt><span class="sect2"><a href=
1.22 ! tv 8160: "#id2586670">12.3.3. GNU
1.1 grant 8161: Autoconf/Automake</a></span></dt>
8162: </dl>
8163: </dd>
8164:
1.22 ! tv 8165: <dt><span class="sect1"><a href="#id2586784">12.4.
1.1 grant 8166: Building considerations</a></span></dt>
8167:
8168: <dd>
8169: <dl>
8170: <dt><span class="sect2"><a href=
1.22 ! tv 8171: "#id2586787">12.4.1. CPP defines</a></span></dt>
1.1 grant 8172: </dl>
8173: </dd>
8174:
1.22 ! tv 8175: <dt><span class="sect1"><a href="#id2586817">12.5.
1.1 grant 8176: Package specific actions</a></span></dt>
8177:
8178: <dd>
8179: <dl>
8180: <dt><span class="sect2"><a href=
1.22 ! tv 8181: "#id2586820">12.5.1. Package configuration
1.1 grant 8182: files</a></span></dt>
8183:
8184: <dt><span class="sect2"><a href=
1.22 ! tv 8185: "#id2586990">12.5.2. User
1.2 hubertf 8186: interaction</a></span></dt>
1.1 grant 8187:
8188: <dt><span class="sect2"><a href=
1.22 ! tv 8189: "#id2587035">12.5.3. Handling
1.1 grant 8190: licenses</a></span></dt>
8191:
8192: <dt><span class="sect2"><a href=
1.22 ! tv 8193: "#id2587187">12.5.4. Creating an account from a
1.1 grant 8194: package</a></span></dt>
8195:
8196: <dt><span class="sect2"><a href=
1.22 ! tv 8197: "#id2587249">12.5.5. Installing score
1.1 grant 8198: files</a></span></dt>
8199:
8200: <dt><span class="sect2"><a href=
1.22 ! tv 8201: "#id2587292">12.5.6. Packages providing login
1.1 grant 8202: shells</a></span></dt>
8203:
8204: <dt><span class="sect2"><a href=
1.22 ! tv 8205: "#id2587350">12.5.7. Packages containing perl
1.1 grant 8206: scripts</a></span></dt>
8207:
8208: <dt><span class="sect2"><a href=
1.22 ! tv 8209: "#id2587368">12.5.8. Packages with hardcoded paths
1.1 grant 8210: to other interpreters</a></span></dt>
8211:
8212: <dt><span class="sect2"><a href=
1.22 ! tv 8213: "#id2587458">12.5.9. Packages installing perl
1.1 grant 8214: modules</a></span></dt>
8215:
8216: <dt><span class="sect2"><a href=
8217: "#faq.info-files">12.5.10. Packages installing info
8218: files</a></span></dt>
8219:
8220: <dt><span class="sect2"><a href=
1.22 ! tv 8221: "#id2587677">12.5.11. Packages installing GConf2
1.1 grant 8222: data files</a></span></dt>
8223:
8224: <dt><span class="sect2"><a href=
1.22 ! tv 8225: "#id2587778">12.5.12. Packages installing
1.1 grant 8226: scrollkeeper data files</a></span></dt>
8227:
8228: <dt><span class="sect2"><a href=
1.22 ! tv 8229: "#id2587829">12.5.13. Packages installing X11
1.1 grant 8230: fonts</a></span></dt>
8231:
8232: <dt><span class="sect2"><a href=
1.22 ! tv 8233: "#id2587876">12.5.14. Packages installing GTK2
1.1 grant 8234: modules</a></span></dt>
8235:
8236: <dt><span class="sect2"><a href=
1.22 ! tv 8237: "#id2587945">12.5.15. Packages installing SGML or
1.1 grant 8238: XML data</a></span></dt>
8239:
8240: <dt><span class="sect2"><a href=
1.22 ! tv 8241: "#id2588066">12.5.16. Packages installing
1.1 grant 8242: extensions to the MIME database</a></span></dt>
8243:
8244: <dt><span class="sect2"><a href=
1.22 ! tv 8245: "#id2588273">12.5.17. Packages using
1.1 grant 8246: intltool</a></span></dt>
1.18 xtraeme 8247:
8248: <dt><span class="sect2"><a href=
1.22 ! tv 8249: "#id2588286">12.5.18. Packages installing startup
1.18 xtraeme 8250: scripts</a></span></dt>
1.1 grant 8251: </dl>
8252: </dd>
8253:
1.22 ! tv 8254: <dt><span class="sect1"><a href="#id2588308">12.6.
1.1 grant 8255: Feedback to the author</a></span></dt>
8256: </dl>
8257: </div>
8258:
8259: <div class="sect1" lang="en" xml:lang="en">
8260: <div class="titlepage">
8261: <div>
8262: <div>
8263: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 8264: "id2585063" id="id2585063"></a>12.1. General
1.1 grant 8265: operation</h2>
8266: </div>
8267: </div>
8268: </div>
8269:
8270: <div class="sect2" lang="en" xml:lang="en">
8271: <div class="titlepage">
8272: <div>
8273: <div>
1.22 ! tv 8274: <h3 class="title"><a name="id2585066" id=
! 8275: "id2585066"></a>12.1.1. How to pull in
1.1 grant 8276: variables from /etc/mk.conf</h3>
8277: </div>
8278: </div>
8279: </div>
8280:
8281: <p>The problem with package-defined variables that can
1.14 xtraeme 8282: be overridden via <code class="varname">MAKECONF</code>
8283: or <code class="filename">/etc/mk.conf</code> is that
8284: <a href=
1.1 grant 8285: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8286: <span class="citerefentry"><span class=
8287: "refentrytitle">make</span>(1)</span></a> expands a
8288: variable as it is used, but evaluates preprocessor like
8289: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 8290: So, to use any variable (which may be set in
8291: <code class="filename">/etc/mk.conf</code>) in one of
8292: the .if* statements, the file <code class=
8293: "filename">/etc/mk.conf</code> must be included before
1.1 grant 8294: that .if* statement.</p>
8295:
8296: <p>Rather than have a number of ad-hoc ways of
1.14 xtraeme 8297: including <code class="filename">/etc/mk.conf</code>,
8298: should it exist, or <code class=
8299: "varname">MAKECONF</code>, should it exist, include the
8300: <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
8301: file in the package Makefile before any
8302: preprocessor-like .if, .ifdef, or .ifndef
8303: statements:</p>
1.1 grant 8304: <pre class="programlisting">
8305: .include "../../mk/bsd.prefs.mk"
8306:
8307: .if defined(USE_MENUS)
8308: ...
8309: .endif
8310: </pre>
8311:
1.14 xtraeme 8312: <p>If you wish to set the <code class=
8313: "varname">CFLAGS</code> variable in <code class=
8314: "filename">/etc/mk.conf</code> please make sure to
1.1 grant 8315: use:</p>
8316: <pre class="programlisting">
8317: CFLAGS+= -your -flags
8318: </pre>
8319:
1.14 xtraeme 8320: <p>Using <code class="varname">CFLAGS=</code> (i.e.
8321: without the “<span class="quote">+</span>”)
8322: may lead to problems with packages that need to add
8323: their own flags. Also, you may want to take a look at
8324: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 8325: href=
8326: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20 ben 8327: class="pkgname">devel/cpuflags</a> package if you're
8328: interested in optimization for the current CPU.</p>
1.1 grant 8329: </div>
8330:
8331: <div class="sect2" lang="en" xml:lang="en">
8332: <div class="titlepage">
8333: <div>
8334: <div>
1.22 ! tv 8335: <h3 class="title"><a name="id2585149" id=
! 8336: "id2585149"></a>12.1.2. Restricted
1.1 grant 8337: packages</h3>
8338: </div>
8339: </div>
8340: </div>
8341:
8342: <p>Some licenses restrict how software may be
8343: re-distributed. In order to satisfy these restrictions,
8344: the package system defines five make variables that can
8345: be set to note these restrictions:</p>
8346:
8347: <div class="itemizedlist">
8348: <ul type="disc">
8349: <li>
1.14 xtraeme 8350: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 8351:
8352: <p>This variable should be set whenever a
8353: restriction exists (regardless of its kind). Set
8354: this variable to a string containing the reason
8355: for the restriction.</p>
8356: </li>
8357:
8358: <li>
1.14 xtraeme 8359: <p><code class=
8360: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 8361:
8362: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 8363: variable to <code class=
8364: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 8365: package may not be included on a CD-ROM.</p>
8366: </li>
8367:
8368: <li>
1.14 xtraeme 8369: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 8370:
8371: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 8372: Set this variable to <code class=
8373: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 8374: package may not not be made available on the
8375: Internet.</p>
8376: </li>
8377:
8378: <li>
1.14 xtraeme 8379: <p><code class=
8380: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 8381:
8382: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 8383: this variable to <code class=
8384: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 8385: of the source code or other distfile(s) is not
8386: allowed on CD-ROMs.</p>
8387: </li>
8388:
8389: <li>
1.14 xtraeme 8390: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 8391:
8392: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 8393: variable to <code class=
8394: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 8395: of the source code or other distfile(s) via the
8396: Internet is not allowed.</p>
8397: </li>
8398: </ul>
8399: </div>
8400:
1.14 xtraeme 8401: <p>Please note that the use of <code class=
8402: "varname">NO_PACKAGE</code>, <code class=
8403: "varname">IGNORE</code>, <code class=
8404: "varname">NO_CDROM</code>, or other generic make
1.1 grant 8405: variables to denote restrictions is deprecated, because
8406: they unconditionally prevent users from generating
8407: binary packages!</p>
8408: </div>
8409:
8410: <div class="sect2" lang="en" xml:lang="en">
8411: <div class="titlepage">
8412: <div>
8413: <div>
8414: <h3 class="title"><a name="dependencies" id=
8415: "dependencies"></a>12.1.3. Handling
8416: dependencies</h3>
8417: </div>
8418: </div>
8419: </div>
8420:
8421: <p>Your package may depend on some other package being
8422: present - and there are various ways of expressing this
1.14 xtraeme 8423: dependency. pkgsrc supports the <code class=
8424: "varname">BUILD_DEPENDS</code> and <code class=
8425: "varname">DEPENDS</code> definitions, as well as
8426: dependencies via <code class=
8427: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 8428: way to handle dependencies, and which uses the
8429: variables named above. See <a href="#buildlink" title=
8430: "Chapter 9. Buildlink methodology">Chapter 9,
8431: <i>Buildlink methodology</i></a> for more
8432: information.</p>
8433:
8434: <p>The basic difference between the two variables is as
1.14 xtraeme 8435: follows: The <code class="varname">DEPENDS</code>
1.1 grant 8436: definition registers that pre-requisite in the binary
8437: package so it will be pulled in when the binary package
1.14 xtraeme 8438: is later installed, whilst the <code class=
8439: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 8440: marking a dependency that is only needed for building
8441: the package.</p>
8442:
8443: <p>This means that if you only need a package present
8444: whilst you are building, it should be noted as a
1.14 xtraeme 8445: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 8446:
1.14 xtraeme 8447: <p>The format for a <code class=
8448: "varname">BUILD_DEPENDS</code> and a <code class=
8449: "varname">DEPENDS</code> definition is:</p>
1.1 grant 8450: <pre class="programlisting">
8451: <pre-req-package-name>:../../<category>/<pre-req-package>
8452: </pre>
8453:
8454: <p>Please note that the “<span class=
8455: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 8456: any of the wildcard version numbers recognized by
1.1 grant 8457: <a href=
8458: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
8459: <span class="citerefentry"><span class=
8460: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
8461:
8462: <div class="orderedlist">
8463: <ol type="1">
8464: <li>
8465: <p>If your package needs another package's
8466: binaries or libraries to build or run, and if
1.14 xtraeme 8467: that package has a <code class=
8468: "filename">buildlink3.mk</code> file available,
8469: use it:</p>
1.1 grant 8470: <pre class="programlisting">
8471: .include "../../graphics/jpeg/buildlink3.mk"
8472:
8473: </pre>
8474: </li>
8475:
8476: <li>
8477: <p>If your package needs to use another package
1.14 xtraeme 8478: to build itself and there is no <code class=
8479: "filename">buildlink3.mk</code> file available,
8480: use the <code class=
8481: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 8482: <pre class="programlisting">
8483: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
8484: </pre>
8485: </li>
8486:
8487: <li>
8488: <p>If your package needs a library with which to
1.14 xtraeme 8489: link and again there is no <code class=
8490: "filename">buildlink3.mk</code> file available,
8491: this is specified using the <code class=
8492: "varname">DEPENDS</code> definition. An example
8493: of this is the <a xmlns=
1.1 grant 8494: "http://www.w3.org/TR/xhtml1/transitional" href=
8495: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 8496: class="pkgname">print/lyx</a> package, which uses
8497: the xpm library, version 3.4j to build:</p>
1.1 grant 8498: <pre class="programlisting">
8499: DEPENDS+= xpm-3.4j:../../graphics/xpm
8500: </pre>
8501:
8502: <p>You can also use wildcards in package
8503: dependences:</p>
8504: <pre class="programlisting">
8505: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
8506: </pre>
8507:
8508: <p>Note that such wildcard dependencies are
8509: retained when creating binary packages. The
8510: dependency is checked when installing the binary
8511: package and any package which matches the pattern
8512: will be used. Wildcard dependencies should be
8513: used with care.</p>
8514:
8515: <p>The “<span class=
8516: "quote">-[0-9]*</span>” should be used
8517: instead of “<span class=
8518: "quote">-*</span>” to avoid potentially
8519: ambiguous matches such as “<span class=
8520: "quote">tk-postgresql</span>” matching a
8521: “<span class="quote">tk-*</span>”
1.14 xtraeme 8522: <code class="varname">DEPENDS</code>.</p>
1.1 grant 8523:
8524: <p>Wildcards can also be used to specify that a
8525: package will only build against a certain minimum
8526: version of a pre-requisite:</p>
8527: <pre class="programlisting">
8528: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
8529: </pre>
8530:
8531: <p>This means that the package will build against
8532: version 3.5.4 of the tiff library or newer. Such
8533: a dependency may be warranted if, for example,
8534: the API of the library has changed with version
8535: 3.5.4 and a package would not compile against an
8536: earlier version of tiff.</p>
8537:
8538: <p>Please note that such dependencies should only
8539: be updated if a package requires a newer
8540: pre-requisite, but not to denote recommendations
8541: such as security updates or ABI changes that do
8542: not prevent a package from building correctly.
8543: Such recommendations can be expressed using
1.14 xtraeme 8544: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 8545: <pre class="programlisting">
8546: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
8547: </pre>
8548:
1.14 xtraeme 8549: <p>In addition to the above <code class=
8550: "varname">DEPENDS</code> line, this denotes that
1.1 grant 8551: while a package will build against
8552: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 8553: recommended. <code class=
8554: "varname">RECOMMENDED</code> entries will be
8555: turned into dependencies unless explicitly
8556: ignored (in which case a warning will be
8557: printed). Packages that are built with
1.1 grant 8558: recommendations ignored may not be uploaded to
8559: ftp.NetBSD.org by developers and should not be
8560: used across different systems that may have
8561: different versions of binary packages
8562: installed.</p>
8563:
8564: <p>For security fixes, please update the package
8565: vulnerabilities file as well as setting
1.14 xtraeme 8566: <code class="varname">RECOMMENDED</code>, see
1.1 grant 8567: <a href="#security-handling" title=
8568: "12.1.7. Handling packages with security problems">
8569: Section 12.1.7, “Handling packages with
8570: security problems”</a> for more
8571: information.</p>
8572: </li>
8573:
8574: <li>
8575: <p>If your package needs some executable to be
1.17 sketch 8576: able to run correctly and if there's no
1.14 xtraeme 8577: <code class="filename">buildlink3.mk</code> file,
8578: this is specified using the <code class=
8579: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 8580: "http://www.w3.org/TR/xhtml1/transitional" href=
8581: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 8582: class="pkgname">print/lyx</a> package needs to be
8583: able to execute the latex binary from the teTeX
8584: package when it runs, and that is specified:</p>
1.1 grant 8585: <pre class="programlisting">
8586: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
8587: </pre>
8588:
8589: <p>The comment about wildcard dependencies from
8590: previous paragraph applies here, too.</p>
8591: </li>
8592: </ol>
8593: </div>
8594:
8595: <p>If your package needs files from another package to
8596: build, see the first part of the “<span class=
8597: "quote">do-configure</span>” target <a xmlns=
8598: "http://www.w3.org/TR/xhtml1/transitional" href=
8599: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20 ben 8600: class="pkgname">print/ghostscript5</a> package (it
8601: relies on the jpeg sources being present in source form
8602: during the build):</p>
1.1 grant 8603: <pre class="programlisting">
8604: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
8605: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
8606: fi
8607: </pre>
8608:
8609: <p>If you build any other packages that way, please
8610: make sure the working files are deleted too when this
8611: package's working files are cleaned up. The easiest way
8612: to do so is by adding a pre-clean target:</p>
8613: <pre class="programlisting">
8614: pre-clean:
8615: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
8616: </pre>
8617:
1.14 xtraeme 8618: <p>Please also note the <code class=
8619: "varname">BUILD_USES_MSGFMT</code> and <code class=
8620: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
8621: which are provided as convenience definitions. The
8622: former works out whether msgfmt(1) is part of the base
8623: system, and, if it isn't, installs the <a xmlns=
1.1 grant 8624: "http://www.w3.org/TR/xhtml1/transitional" href=
8625: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20 ben 8626: class="pkgname">devel/gettext</a> package. The latter
8627: adds a build dependency on either an installed version
8628: of an older gettext package, or if it isn't, installs
8629: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8630: href=
8631: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
8632: class="pkgname">devel/gettext-m4</a> package.</p>
1.1 grant 8633: </div>
8634:
8635: <div class="sect2" lang="en" xml:lang="en">
8636: <div class="titlepage">
8637: <div>
8638: <div>
1.22 ! tv 8639: <h3 class="title"><a name="id2585596" id=
! 8640: "id2585596"></a>12.1.4. Handling conflicts
1.1 grant 8641: with other packages</h3>
8642: </div>
8643: </div>
8644: </div>
8645:
8646: <p>Your package may conflict with other packages a user
8647: might already have installed on his system, e.g. if
8648: your package installs the same set of files like
8649: another package in our pkgsrc tree.</p>
8650:
1.14 xtraeme 8651: <p>In this case you can set <code class=
8652: "varname">CONFLICTS</code> to a space separated list of
1.1 grant 8653: packages (including version string) your package
8654: conflicts with.</p>
8655:
8656: <p>For example <a xmlns=
8657: "http://www.w3.org/TR/xhtml1/transitional" href=
8658: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20 ben 8659: class="pkgname">x11/Xaw3d</a> and <a xmlns=
8660: "http://www.w3.org/TR/xhtml1/transitional" href=
8661: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
8662: class="pkgname">x11/Xaw-Xpm</a> install provide the
8663: same shared library, thus you set in <code class=
8664: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 8665: <pre class="programlisting">
8666: CONFLICTS= Xaw-Xpm-[0-9]*
8667: </pre>
8668:
1.14 xtraeme 8669: <p>and in <code class=
8670: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 8671: <pre class="programlisting">
8672: CONFLICTS= Xaw3d-[0-9]*
8673: </pre>
8674:
8675: <p>Packages will automatically conflict with other
8676: packages with the name prefix and a different version
8677: string. “<span class=
8678: "quote">Xaw3d-1.5</span>” e.g. will automatically
8679: conflict with the older version “<span class=
8680: "quote">Xaw3d-1.3</span>”.</p>
8681: </div>
8682:
8683: <div class="sect2" lang="en" xml:lang="en">
8684: <div class="titlepage">
8685: <div>
8686: <div>
1.22 ! tv 8687: <h3 class="title"><a name="id2585715" id=
! 8688: "id2585715"></a>12.1.5. Packages that cannot
1.1 grant 8689: or should not be built</h3>
8690: </div>
8691: </div>
8692: </div>
8693:
8694: <p>There are several reasons why a package might be
8695: instructed to not build under certain circumstances. If
8696: the package builds and runs on most platforms, the
1.14 xtraeme 8697: exceptions should be noted with <code class=
8698: "varname">NOT_FOR_PLATFORM</code>. If the package
8699: builds and runs on a small handful of platforms, set
8700: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
8701: If the package should be skipped (for example, because
8702: it provides functionality already provided by the
8703: system), set <code class=
8704: "varname">PKG_SKIP_REASON</code> to a descriptive
8705: message. If the package should fail because some
8706: preconditions are not met, set <code class=
8707: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 8708: message.</p>
8709:
1.14 xtraeme 8710: <p><code class="varname">IGNORE</code> is deprecated
1.1 grant 8711: because it didn't provide enough information to
8712: determine whether the build should fail.</p>
8713: </div>
8714:
8715: <div class="sect2" lang="en" xml:lang="en">
8716: <div class="titlepage">
8717: <div>
8718: <div>
1.22 ! tv 8719: <h3 class="title"><a name="id2585740" id=
! 8720: "id2585740"></a>12.1.6. Packages which
1.1 grant 8721: should not be deleted, once installed</h3>
8722: </div>
8723: </div>
8724: </div>
8725:
8726: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 8727: has been installed, the <code class=
8728: "varname">PKG_PRESERVE</code> definition should be set
8729: in the package Makefile. This will be carried into any
1.1 grant 8730: binary package that is made from this pkgsrc entry. A
8731: “<span class="quote">preserved</span>”
8732: package will not be deleted using <a href=
8733: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8734: <span class="citerefentry"><span class=
8735: "refentrytitle">pkg_delete</span>(1)</span></a> unless
8736: the “<span class="quote">-f</span>” option
8737: is used.</p>
8738: </div>
8739:
8740: <div class="sect2" lang="en" xml:lang="en">
8741: <div class="titlepage">
8742: <div>
8743: <div>
8744: <h3 class="title"><a name="security-handling" id=
8745: "security-handling"></a>12.1.7. Handling
8746: packages with security problems</h3>
8747: </div>
8748: </div>
8749: </div>
8750:
8751: <p>When a vulnerability is found, this should be noted
1.14 xtraeme 8752: in <code class=
8753: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1 grant 8754: and after the commit of that file, it should be copied
1.14 xtraeme 8755: to both <code class=
8756: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
8757: and <code class=
8758: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
8759: on ftp.NetBSD.org using <code class=
8760: "filename">localsrc/security/advisories/Makefile</code>.
8761: In addition, if a <code class=
8762: "filename">buildlink3.mk</code> file exists for an
8763: affected package, bumping <code class=
8764: "varname">PKGREVISION</code> and creating a
8765: corresponding <code class=
8766: "varname">BUILDLINK_RECOMMENDED.<em class=
8767: "replaceable"><code>pkg</code></em></code> entry should
8768: be considered. See <a href="#buildlink" title=
1.1 grant 8769: "Chapter 9. Buildlink methodology">Chapter 9,
8770: <i>Buildlink methodology</i></a> for more information
1.14 xtraeme 8771: about writing <code class=
8772: "filename">buildlink3.mk</code> files and <code class=
8773: "varname">BUILDLINK_*</code> definitions.</p>
1.1 grant 8774:
8775: <p>Also, if the fix should be applied to the stable
8776: pkgsrc branch, be sure to submit a pullup request!</p>
8777: </div>
8778:
8779: <div class="sect2" lang="en" xml:lang="en">
8780: <div class="titlepage">
8781: <div>
8782: <div>
1.22 ! tv 8783: <h3 class="title"><a name="id2585832" id=
! 8784: "id2585832"></a>12.1.8. How to handle
1.1 grant 8785: compiler bugs</h3>
8786: </div>
8787: </div>
8788: </div>
8789:
8790: <p>Some source files trigger bugs in the compiler,
8791: based on combinations of compiler version and
8792: architecture and almost always relation to optimisation
8793: being enabled. Common symptoms are gcc internal errors
8794: or never finishing compiling a file.</p>
8795:
8796: <p>Typically a workaround involves testing the
1.14 xtraeme 8797: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 8798: version, disabling optimisation for that
1.14 xtraeme 8799: file/<code class="varname">MACHINE_ARCH</code>/compiler
8800: combination, and documenting it in <code class=
8801: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 8802: number of examples!</p>
8803: </div>
8804:
8805: <div class="sect2" lang="en" xml:lang="en">
8806: <div class="titlepage">
8807: <div>
8808: <div>
1.22 ! tv 8809: <h3 class="title"><a name="id2585854" id=
! 8810: "id2585854"></a>12.1.9. How to handle
1.1 grant 8811: incrementing versions when fixing an existing
8812: package</h3>
8813: </div>
8814: </div>
8815: </div>
8816:
8817: <p>When making fixes to an existing package it can be
1.14 xtraeme 8818: useful to change the version number in <code class=
8819: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 8820: future versions by the original author, a
8821: “<span class="quote">nb1</span>”,
8822: “<span class="quote">nb2</span>”, ...
8823: suffix can be used on package versions by setting
1.14 xtraeme 8824: <code class="varname">PKGREVISION=1</code> (2, ...).
8825: The “<span class="quote">nb</span>” is
8826: treated like a “<span class=
8827: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 8828: <pre class="programlisting">
8829: DISTNAME= foo-17.42
8830: PKGREVISION= 9
8831: </pre>
8832:
1.14 xtraeme 8833: <p>will result in a <code class=
8834: "varname">PKGNAME</code> of “<span class=
1.1 grant 8835: "quote">foo-17.42nb9</span>”.</p>
8836:
8837: <p>When a new release of the package is released, the
1.14 xtraeme 8838: <code class="varname">PKGREVISION</code> should be
8839: removed. e.g. on a new minor release of the above
8840: package, things should be like:</p>
1.1 grant 8841: <pre class="programlisting">
8842: DISTNAME= foo-17.43
8843: </pre>
8844: </div>
8845:
8846: <div class="sect2" lang="en" xml:lang="en">
8847: <div class="titlepage">
8848: <div>
8849: <div>
1.22 ! tv 8850: <h3 class="title"><a name="id2585904" id=
! 8851: "id2585904"></a>12.1.10. Portability of
1.1 grant 8852: packages</h3>
8853: </div>
8854: </div>
8855: </div>
8856:
8857: <p>One appealing feature of pkgsrc is that it runs on
8858: many different platforms. As a result, it is important
8859: to ensure, where possible, that packages in pkgsrc are
8860: portable. There are some particular details you should
8861: pay attention to while working on pkgsrc.</p>
8862:
8863: <div class="sect3" lang="en" xml:lang="en">
8864: <div class="titlepage">
8865: <div>
8866: <div>
1.22 ! tv 8867: <h4 class="title"><a name="id2585909" id=
! 8868: "id2585909"></a>12.1.10.1. ${INSTALL},
1.1 grant 8869: ${INSTALL_DATA_DIR}, ...</h4>
8870: </div>
8871: </div>
8872: </div>
8873:
1.14 xtraeme 8874: <p>The BSD-compatible <span><strong class=
8875: "command">install</strong></span> supplied with some
1.1 grant 8876: operating systems will not perform more than one
8877: operation at a time. As such, you should call
8878: “<span class="quote">${INSTALL}</span>”,
8879: etc. like this:</p>
8880: <pre class="programlisting">
8881: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
8882: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
8883: </pre>
8884: </div>
8885: </div>
8886: </div>
8887:
8888: <div class="sect1" lang="en" xml:lang="en">
8889: <div class="titlepage">
8890: <div>
8891: <div>
8892: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 8893: "id2585928" id="id2585928"></a>12.2. Possible
1.1 grant 8894: downloading issues</h2>
8895: </div>
8896: </div>
8897: </div>
8898:
8899: <div class="sect2" lang="en" xml:lang="en">
8900: <div class="titlepage">
8901: <div>
8902: <div>
1.22 ! tv 8903: <h3 class="title"><a name="id2585931" id=
! 8904: "id2585931"></a>12.2.1. Packages whose
1.1 grant 8905: distfiles aren't available for plain
8906: downloading</h3>
8907: </div>
8908: </div>
8909: </div>
8910:
8911: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 8912: set <code class="varname">DYNAMIC_MASTER_SITES</code>
8913: and a <span><strong class="command">make
8914: fetch</strong></span> will call <code class=
8915: "filename">files/getsite.sh</code> with the name of
8916: each file to download as an argument, expecting it to
8917: output the URL of the directory from which to download
8918: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8919: href=
1.1 grant 8920: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20 ben 8921: class="pkgname">graphics/ns-cult3d</a> is an example of
8922: this usage.</p>
1.1 grant 8923:
8924: <p>If the download can't be automated, because the user
8925: must submit personal information to apply for a
8926: password, or must pay for the source, or whatever, you
1.14 xtraeme 8927: can set <code class="varname">_FETCH_MESSAGE</code> to
8928: a macro which displays a message explaining the
8929: situation. <code class="varname">_FETCH_MESSAGE</code>
8930: must be executable shell commands, not just a message.
8931: (Generally, it executes <code class=
8932: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 8933: following packages use this: <a xmlns=
8934: "http://www.w3.org/TR/xhtml1/transitional" href=
8935: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20 ben 8936: class="pkgname">audio/realplayer</a>, <a xmlns=
8937: "http://www.w3.org/TR/xhtml1/transitional" href=
8938: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
8939: class="pkgname">cad/simian</a>, <a xmlns=
8940: "http://www.w3.org/TR/xhtml1/transitional" href=
8941: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
8942: class="pkgname">devel/ipv6socket</a>, <a xmlns=
8943: "http://www.w3.org/TR/xhtml1/transitional" href=
8944: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
8945: class="pkgname">emulators/vmware-module</a>, <a xmlns=
8946: "http://www.w3.org/TR/xhtml1/transitional" href=
8947: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
8948: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
8949: "http://www.w3.org/TR/xhtml1/transitional" href=
8950: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
8951: class="pkgname">sysutils/storage-manager</a>, <a xmlns=
8952: "http://www.w3.org/TR/xhtml1/transitional" href=
8953: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
8954: class="pkgname">www/ap-aolserver</a>, <a xmlns=
8955: "http://www.w3.org/TR/xhtml1/transitional" href=
8956: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
8957: class="pkgname">www/openacs</a>. Try to be consistent
8958: with them.</p>
1.1 grant 8959: </div>
8960:
8961: <div class="sect2" lang="en" xml:lang="en">
8962: <div class="titlepage">
8963: <div>
8964: <div>
1.22 ! tv 8965: <h3 class="title"><a name="id2585994" id=
! 8966: "id2585994"></a>12.2.2. How to handle
1.1 grant 8967: modified distfiles with the 'old' name</h3>
8968: </div>
8969: </div>
8970: </div>
8971:
8972: <p>Sometimes authors of a software package make some
8973: modifications after the software was released, and they
8974: put up a new distfile without changing the package's
8975: version number. If a package is already in pkgsrc at
8976: that time, the md5 checksum will no longer match. The
8977: correct way to work around this is to update the
8978: package's md5 checksum to match the package on the
8979: master site (beware, any mirrors may not be up to date
8980: yet!), and to remove the old distfile from
1.14 xtraeme 8981: ftp.NetBSD.org's <code class=
8982: "filename">/pub/NetBSD/packages/distfiles</code>
1.1 grant 8983: directory. Furthermore, a mail to the package's author
8984: seems appropriate making sure the distfile was really
8985: updated on purpose, and that no trojan horse or so
8986: crept in.</p>
8987: </div>
8988: </div>
8989:
8990: <div class="sect1" lang="en" xml:lang="en">
8991: <div class="titlepage">
8992: <div>
8993: <div>
8994: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 8995: "id2586006" id=
! 8996: "id2586006"></a>12.3. Configuration
1.1 grant 8997: gotchas</h2>
8998: </div>
8999: </div>
9000: </div>
9001:
9002: <div class="sect2" lang="en" xml:lang="en">
9003: <div class="titlepage">
9004: <div>
9005: <div>
9006: <h3 class="title"><a name="fixes.libtool" id=
9007: "fixes.libtool"></a>12.3.1. Shared libraries
9008: - libtool</h3>
9009: </div>
9010: </div>
9011: </div>
9012:
9013: <p>pkgsrc supports many different machines, with
9014: different object formats like a.out and ELF, and
9015: varying abilities to do shared library and dynamic
9016: loading at all. To accompany this, varying commands and
9017: options have to be passed to the compiler, linker, etc.
9018: to get the Right Thing, which can be pretty annoying
9019: especially if you don't have all the machines at your
9020: hand to test things. The <a xmlns=
9021: "http://www.w3.org/TR/xhtml1/transitional" href=
9022: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20 ben 9023: class="pkgname">devel/libtool</a> pkg can help here, as
9024: it just “<span class="quote">knows</span>”
9025: how to build both static and dynamic libraries from a
9026: set of source files, thus being platform
9027: independent.</p>
1.1 grant 9028:
9029: <p>Here's how to use libtool in a pkg in seven simple
9030: steps:</p>
9031:
9032: <div class="orderedlist">
9033: <ol type="1">
9034: <li>
1.14 xtraeme 9035: <p>Add <code class=
9036: "varname">USE_LIBTOOL=yes</code> to the package
9037: Makefile.</p>
1.1 grant 9038: </li>
9039:
9040: <li>
9041: <p>For library objects, use “<span class=
9042: "quote">${LIBTOOL} --mode=compile
9043: ${CC}</span>” in place of
9044: “<span class="quote">${CC}</span>”.
9045: You could even add it to the definition of
1.14 xtraeme 9046: <code class="varname">CC</code>, if only
9047: libraries are being built in a given Makefile.
9048: This one command will build both PIC and non-PIC
9049: library objects, so you need not have separate
9050: shared and non-shared library rules.</p>
1.1 grant 9051: </li>
9052:
9053: <li>
9054: <p>For the linking of the library, remove any
9055: “<span class="quote">ar</span>”,
9056: “<span class="quote">ranlib</span>”,
9057: and “<span class="quote">ld
9058: -Bshareable</span>” commands, and instead
9059: use:</p>
9060: <pre class="programlisting">
9061: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
9062: </pre>
9063:
9064: <p>Note that the library is changed to have a
1.14 xtraeme 9065: <code class="filename">.la</code> extension, and
9066: the objects are changed to have a <code class=
9067: "filename">.lo</code> extension. Change
9068: <code class="varname">OBJS</code> as necessary.
9069: This automatically creates all of the
9070: <code class="filename">.a</code>, <code class=
9071: "filename">.so.major.minor</code>, and ELF
9072: symlinks (if necessary) in the build directory.
9073: Be sure to include “<span class=
1.1 grant 9074: "quote">-version-info</span>”, especially
9075: when major and minor are zero, as libtool will
9076: otherwise strip off the shared library
9077: version.</p>
9078:
9079: <p>From the libtool manual:</p>
9080: <pre class="programlisting">
9081: So, libtool library versions are described by three integers:
9082:
9083: CURRENT
9084: The most recent interface number that this library implements.
9085:
9086: REVISION
9087: The implementation number of the CURRENT interface.
9088:
9089: AGE
9090: The difference between the newest and oldest interfaces that this
9091: library implements. In other words, the library implements all the
9092: interface numbers in the range from number `CURRENT - AGE' to
9093: `CURRENT'.
9094:
9095: If two libraries have identical CURRENT and AGE numbers, then the
9096: dynamic linker chooses the library with the greater REVISION number.
9097: </pre>
9098:
9099: <p>The “<span class=
9100: "quote">-release</span>” option will
9101: produce different results for a.out and ELF
9102: (excluding symlinks) in only one case. An ELF
9103: library of the form “<span class=
9104: "quote">libfoo-release.so.<span class=
9105: "emphasis"><em>x</em></span>.<span class=
9106: "emphasis"><em>y</em></span></span>” will
9107: have a symlink of “<span class=
9108: "quote">libfoo.so.<span class=
9109: "emphasis"><em>x</em></span>.<span class=
9110: "emphasis"><em>y</em></span></span>” on an
9111: a.out platform. This is handled
9112: automatically.</p>
9113:
9114: <p>The “<span class="quote">-rpath
9115: argument</span>” is the install directory
9116: of the library being built.</p>
9117:
1.14 xtraeme 9118: <p>In the <code class="filename">PLIST</code>,
1.19 hubertf 9119: include only the <code class=
9120: "filename">.la</code> file, the other files will
9121: be added automatically.</p>
1.1 grant 9122: </li>
9123:
9124: <li>
1.14 xtraeme 9125: <p>When linking shared object (<code class=
9126: "filename">.so</code>) files, i.e. files that are
1.1 grant 9127: loaded via dlopen(3), NOT shared libraries, use
9128: “<span class="quote">-module
9129: -avoid-version</span>” to prevent them
9130: getting version tacked on.</p>
9131:
1.14 xtraeme 9132: <p>The <code class="filename">PLIST</code> file
9133: gets the <code class="filename">foo.so</code>
9134: entry.</p>
1.1 grant 9135: </li>
9136:
9137: <li>
9138: <p>When linking programs that depend on these
9139: libraries <span class=
9140: "emphasis"><em>before</em></span> they are
9141: installed, preface the <a href=
9142: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
9143: <span class="citerefentry"><span class=
9144: "refentrytitle">cc</span>(1)</span></a> or
9145: <a href=
9146: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
9147: <span class="citerefentry"><span class=
9148: "refentrytitle">ld</span>(1)</span></a> line with
9149: “<span class="quote">${LIBTOOL}
9150: --mode=link</span>”, and it will find the
9151: correct libraries (static or shared), but please
9152: be aware that libtool will not allow you to
9153: specify a relative path in -L (such as
9154: “<span class=
9155: "quote">-L../somelib</span>”), because it
9156: expects you to change that argument to be the
1.14 xtraeme 9157: <code class="filename">.la</code> file. e.g.</p>
1.1 grant 9158: <pre class="programlisting">
9159: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
9160: </pre>
9161:
9162: <p>should be changed to:</p>
9163: <pre class="programlisting">
1.14 xtraeme 9164: ${LIBTOOL} --mode=link ${CC} -o <em class=
9165: "replaceable"><code>someprog</code></em> <em class=
9166: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 9167: </pre>
9168:
9169: <p>and it will do the right thing with the
9170: libraries.</p>
9171: </li>
9172:
9173: <li>
9174: <p>When installing libraries, preface the
9175: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
9176: <span class="citerefentry"><span class=
9177: "refentrytitle">install</span>(1)</span></a> or
9178: <a href=
9179: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
9180: <span class="citerefentry"><span class=
9181: "refentrytitle">cp</span>(1)</span></a> command
9182: with “<span class="quote">${LIBTOOL}
9183: --mode=install</span>”, and change the
1.14 xtraeme 9184: library name to <code class=
9185: "filename">.la</code>. e.g.</p>
1.1 grant 9186: <pre class="programlisting">
9187: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
9188: </pre>
9189:
1.14 xtraeme 9190: <p>This will install the static <code class=
9191: "filename">.a</code>, shared library, any needed
1.1 grant 9192: symlinks, and run <a href=
9193: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
9194: <span class="citerefentry"><span class=
9195: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
9196: </li>
9197:
9198: <li>
1.14 xtraeme 9199: <p>In your <code class="filename">PLIST</code>,
9200: include all of the <code class=
9201: "filename">.a</code>, <code class=
9202: "filename">.la</code>, and <code class=
9203: "filename">.so</code>, <code class=
9204: "filename">.so.CURRENT</code> and <code class=
9205: "filename">.so.CURRENT.REVISION</code> files
9206: (this is a change from the previous
9207: behaviour).</p>
1.1 grant 9208: </li>
9209: </ol>
9210: </div>
9211: </div>
9212:
9213: <div class="sect2" lang="en" xml:lang="en">
9214: <div class="titlepage">
9215: <div>
9216: <div>
1.22 ! tv 9217: <h3 class="title"><a name="id2586589" id=
! 9218: "id2586589"></a>12.3.2. Using libtool on GNU
1.1 grant 9219: packages that already support libtool</h3>
9220: </div>
9221: </div>
9222: </div>
9223:
1.14 xtraeme 9224: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
9225: the package Makefile. This will override the package's
9226: own libtool in most cases. For older libtool using
1.1 grant 9227: packages, libtool is made by ltconfig script during the
9228: do-configure step; you can check the libtool script
1.14 xtraeme 9229: location by doing <span><strong class="command">make
9230: configure; find work*/ -name
9231: libtool</strong></span>.</p>
9232:
9233: <p><code class="varname">LIBTOOL_OVERRIDE</code>
9234: specifies which libtool scripts, relative to
9235: <code class="varname">WRKSRC</code>, to override. By
9236: default, it is set to “<span class=
9237: "quote">libtool */libtool */*/libtool</span>”. If
9238: this does not match the location of the package's
9239: libtool script(s), set it as appropriate.</p>
1.13 hubertf 9240:
1.14 xtraeme 9241: <p>If you do not need <code class="filename">*.a</code>
1.1 grant 9242: static libraries built and installed, then use
1.14 xtraeme 9243: <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1 grant 9244: instead.</p>
9245:
9246: <p>If your package makes use of the platform
9247: independent library for loading dynamic shared objects,
9248: that comes with libtool (libltdl), you should include
1.22 ! tv 9249: devel/libltdl/buildlink3.mk.</p>
1.1 grant 9250:
9251: <p>Some packages use libtool incorrectly so that the
9252: package may not work or build in some circumstances.
9253: Some of the more common errors are:</p>
9254:
9255: <div class="itemizedlist">
9256: <ul type="disc">
9257: <li>
9258: <p>The inclusion of a shared object (-module) as
9259: a dependent library in an executable or library.
9260: This in itself isn't a problem if one of two
9261: things has been done:</p>
9262:
9263: <div class="orderedlist">
9264: <ol type="1">
9265: <li>
9266: <p>The shared object is named correctly,
1.14 xtraeme 9267: i.e. <code class=
9268: "filename">libfoo.la</code>, not
9269: <code class="filename">foo.la</code></p>
1.1 grant 9270: </li>
9271:
9272: <li>
9273: <p>The -dlopen option is used when linking
9274: an executable.</p>
9275: </li>
9276: </ol>
9277: </div>
9278: </li>
9279:
9280: <li>
9281: <p>The use of libltdl without the correct calls
9282: to initialisation routines. The function
9283: lt_dlinit() should be called and the macro
1.14 xtraeme 9284: <code class=
9285: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 9286: included in executables.</p>
9287: </li>
9288: </ul>
9289: </div>
9290: </div>
9291:
9292: <div class="sect2" lang="en" xml:lang="en">
9293: <div class="titlepage">
9294: <div>
9295: <div>
1.22 ! tv 9296: <h3 class="title"><a name="id2586670" id=
! 9297: "id2586670"></a>12.3.3. GNU
1.1 grant 9298: Autoconf/Automake</h3>
9299: </div>
9300: </div>
9301: </div>
9302:
9303: <p>If a package needs GNU autoconf or automake to be
9304: executed to regenerate the configure script and
9305: Makefile.in makefile templates, then they should be
9306: executed in a pre-configure target. Two Makefile
1.14 xtraeme 9307: fragments are provided in <code class=
9308: "filename">pkgsrc/mk/autoconf.mk</code> and
9309: <code class="filename">pkgsrc/mk/automake.mk</code> to
9310: help dealing with these tools. See comments in these
9311: files for details.</p>
1.1 grant 9312:
9313: <p>For packages that need only autoconf:</p>
9314: <pre class="programlisting">
9315: AUTOCONF_REQD= 2.50 # if default version is not good enough
9316: ...
9317:
9318: pre-configure:
9319: cd ${WRKSRC}; ${AUTOCONF}
9320:
9321: ...
9322: .include "../../mk/autoconf.mk"
9323: </pre>
9324:
9325: <p>and for packages that need automake and
9326: autoconf:</p>
9327: <pre class="programlisting">
9328: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
9329: ...
9330:
9331: pre-configure:
9332: cd ${WRKSRC}; \
9333: ${ACLOCAL}; \
9334: ${AUTOHEADER}; \
9335: ${AUTOMAKE} -a --foreign -i; \
9336: ${AUTOCONF}
9337:
9338: ...
9339: .include "../mk/automake.mk"
9340: </pre>
9341:
9342: <p>Packages which use GNU Automake will almost
9343: certainly require GNU Make, but that's automatically
1.14 xtraeme 9344: provided for you in <code class=
9345: "filename">mk/automake.mk</code>.</p>
1.1 grant 9346:
9347: <p>There are times when the configure process makes
9348: additional changes to the generated files, which then
9349: causes the build process to try to re-execute the
9350: automake sequence. This is prevented by touching
9351: various files in the configure stage. If this causes
1.14 xtraeme 9352: problems with your package you can set <code class=
9353: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 9354: Makefile.</p>
9355: </div>
9356: </div>
9357:
9358: <div class="sect1" lang="en" xml:lang="en">
9359: <div class="titlepage">
9360: <div>
9361: <div>
9362: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 9363: "id2586784" id="id2586784"></a>12.4. Building
1.1 grant 9364: considerations</h2>
9365: </div>
9366: </div>
9367: </div>
9368:
9369: <div class="sect2" lang="en" xml:lang="en">
9370: <div class="titlepage">
9371: <div>
9372: <div>
1.22 ! tv 9373: <h3 class="title"><a name="id2586787" id=
! 9374: "id2586787"></a>12.4.1. CPP defines</h3>
1.1 grant 9375: </div>
9376: </div>
9377: </div>
9378:
9379: <p>To port an application to NetBSD, it's usually
9380: necessary for the compiler to be able to judge the
9381: system on which it's compiling, and we use definitions
9382: so that the C pre-processor can do this.</p>
9383:
9384: <p>To test whether you are working on a 4.4 BSD-derived
9385: system, you should use the BSD definition, which is
1.14 xtraeme 9386: defined in <code class=
9387: "filename"><sys/param.h></code> on said
1.1 grant 9388: systems.</p>
9389: <pre class="programlisting">
9390: #include <sys/param.h>
9391: </pre>
9392:
9393: <p>and then you can surround the BSD-specific parts of
9394: your package's C/C++ code using this conditional:</p>
9395: <pre class="programlisting">
9396: #if (defined(BSD) && BSD >= 199306)
9397: ...
9398: #endif
9399: </pre>
9400:
9401: <p>Please use the “<span class=
9402: "quote">__NetBSD__</span>” definition sparingly -
9403: it should only apply to features of NetBSD that are not
9404: present in other 4.4-lite derived BSDs.</p>
9405: </div>
9406: </div>
9407:
9408: <div class="sect1" lang="en" xml:lang="en">
9409: <div class="titlepage">
9410: <div>
9411: <div>
9412: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 9413: "id2586817" id="id2586817"></a>12.5. Package
1.1 grant 9414: specific actions</h2>
9415: </div>
9416: </div>
9417: </div>
9418:
9419: <div class="sect2" lang="en" xml:lang="en">
9420: <div class="titlepage">
9421: <div>
9422: <div>
1.22 ! tv 9423: <h3 class="title"><a name="id2586820" id=
! 9424: "id2586820"></a>12.5.1. Package
1.1 grant 9425: configuration files</h3>
9426: </div>
9427: </div>
9428: </div>
9429:
9430: <p>Packages should be taught to look for their
1.14 xtraeme 9431: configuration files in <code class=
9432: "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1 grant 9433: through to the configure and build processes.
1.14 xtraeme 9434: <code class="varname">PKG_SYSCONFDIR</code> may be
1.1 grant 9435: customized in various ways by setting other make
9436: variables:</p>
9437:
9438: <div class="itemizedlist">
9439: <ul type="disc">
9440: <li>
1.14 xtraeme 9441: <p><code class="varname">PKG_SYSCONFBASE</code>
9442: is the main config directory under which all
9443: package configuration files are to be found. This
9444: defaults to <code class=
9445: "filename">${PREFIX}/etc</code>, but may be
9446: overridden in <code class=
9447: "filename">/etc/mk.conf</code>.</p>
1.1 grant 9448: </li>
9449:
9450: <li>
1.14 xtraeme 9451: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
9452: is the subdirectory of <code class=
9453: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 9454: configuration files for a particular package may
9455: be found, e.g. the Apache configuration files may
1.14 xtraeme 9456: all be found under the <code class=
9457: "filename">httpd/</code> subdirectory of
9458: <code class="varname">${PKG_SYSCONFBASE}</code>.
9459: This should be set in the package Makefile.</p>
1.1 grant 9460: </li>
9461:
9462: <li>
1.14 xtraeme 9463: <p>By default, <code class=
9464: "varname">PKG_SYSCONFDIR</code> is set to
9465: <code class=
9466: "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
9467: but this may be overridden by setting
9468: <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9469: for a particular package, where <code class=
9470: "varname">PKG_SYSCONFVAR</code> defaults to
9471: <code class="varname">${PKGBASE}</code>. This is
9472: not meant to be set by a package Makefile, but is
1.1 grant 9473: reserved for users who wish to override the
1.14 xtraeme 9474: <code class="varname">PKG_SYSCONFDIR</code>
9475: setting for a particular package with a special
1.1 grant 9476: location.</p>
9477: </li>
9478: </ul>
9479: </div>
9480:
9481: <p>The only variables that users should customize are
1.14 xtraeme 9482: <code class="varname">PKG_SYSCONFBASE</code> and
9483: <code class=
9484: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
9485: Users will typically want to set <code class=
9486: "varname">PKG_SYSCONFBASE</code> to <code class=
9487: "filename">/etc</code>, or to accept the default
9488: location of <code class=
9489: "filename">${PREFIX}/etc</code>.</p>
1.1 grant 9490: </div>
9491:
9492: <div class="sect2" lang="en" xml:lang="en">
9493: <div class="titlepage">
9494: <div>
9495: <div>
1.22 ! tv 9496: <h3 class="title"><a name="id2586990" id=
! 9497: "id2586990"></a>12.5.2. User
1.2 hubertf 9498: interaction</h3>
1.1 grant 9499: </div>
9500: </div>
9501: </div>
9502:
9503: <p>Occasionally, packages require interaction from the
9504: user, and this can be in a number of ways:</p>
9505:
9506: <div class="itemizedlist">
9507: <ul type="disc">
9508: <li>
9509: <p>help in fetching the distfiles</p>
9510: </li>
9511:
9512: <li>
9513: <p>help to configure the package before it is
9514: built</p>
9515: </li>
9516:
9517: <li>
9518: <p>help during the build process</p>
9519: </li>
9520:
9521: <li>
9522: <p>help during the installation of a package</p>
9523: </li>
9524: </ul>
9525: </div>
9526:
1.14 xtraeme 9527: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 9528: definition is provided to notify the pkgsrc mechanism
9529: of an interactive stage which will be needed, and this
1.14 xtraeme 9530: should be set in the package's <code class=
9531: "filename">Makefile</code>. e.g.</p>
1.1 grant 9532: <pre class="programlisting">
9533: INTERACTIVE_STAGE= build
9534: </pre>
9535:
9536: <p>Multiple interactive stages can be specified:</p>
9537: <pre class="programlisting">
9538: INTERACTIVE_STAGE= configure install
9539: </pre>
9540: </div>
9541:
9542: <div class="sect2" lang="en" xml:lang="en">
9543: <div class="titlepage">
9544: <div>
9545: <div>
1.22 ! tv 9546: <h3 class="title"><a name="id2587035" id=
! 9547: "id2587035"></a>12.5.3. Handling
1.1 grant 9548: licenses</h3>
9549: </div>
9550: </div>
9551: </div>
9552:
9553: <p>A package may underly a license which the user has
9554: or has not agreed to accept. Usually, packages that
9555: underly well-known Open Source licenses (e.g. the GNU
9556: Public License, GPL) won't have any special license
9557: tags added in pkgsrc which require special action by
9558: the user of such packages, but there are quite a number
9559: of other licenses out there that pkgsrc users may not
9560: be able to follow, for whatever reasons. For these
9561: cases, pkgsrc contains a mechanism to note that a
9562: package underlies a certain license, and the user has
9563: to accept the license before the package can be
9564: installed.</p>
9565:
9566: <p>Placing a certain package under a certain license
1.14 xtraeme 9567: works by setting the <code class=
9568: "varname">LICENSE</code> variable to a string
9569: identifying the license, e.g. in <a xmlns=
9570: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 9571: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20 ben 9572: class="pkgname">graphics/graphviz</a>:</p>
1.1 grant 9573: <pre class="programlisting">
9574: LICENSE= graphviz-license
9575: </pre>
9576:
9577: <p>When trying to build, the user will get a notice
9578: that the package underlies a license which he hasn't
9579: accepted (yet):</p>
9580: <pre class="programlisting">
1.14 xtraeme 9581: <code class="prompt">%</code> <strong class=
9582: "userinput"><code>make</code></strong>
1.1 grant 9583: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
9584: ===> To build this package, add this line to your /etc/mk.conf:
9585: ===> ACCEPTABLE_LICENSES+=graphviz-license
9586: ===> To view the license, enter "/usr/bin/make show-license".
9587: *** Error code 1
9588: </pre>
9589:
1.14 xtraeme 9590: <p>The license can be viewed with <span><strong class=
9591: "command">make show-license</strong></span>, and if it
9592: is considered appropriate, the line printed above can
9593: be added to <code class="filename">/etc/mk.conf</code>
9594: to indicate acceptance of the particular license:</p>
1.1 grant 9595: <pre class="programlisting">
9596: ACCEPTABLE_LICENSES+=graphviz-license
9597: </pre>
9598:
9599: <p>When adding a package with a new license, the
1.14 xtraeme 9600: license text should be added to <code class=
9601: "filename">pkgsrc/licenses</code> for displaying. A
9602: list of known licenses can be seen in this directory as
9603: well as by looking at the list of (commented out)
9604: <code class="varname">ACCEPTABLE_LICENSES</code>
9605: variable settings in <code class=
9606: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 9607:
1.17 sketch 9608: <p>If there is a <span class=
1.1 grant 9609: "emphasis"><em>really</em></span> pressing need to
9610: accept all licenses at once, like when trying to
9611: download or mirror all distfiles or doing a bulk build
9612: to test if all packages in pkgsrc build, this can be
1.14 xtraeme 9613: done by setting <code class=
9614: "varname">_ACCEPTABLE=yes</code>.</p>
1.1 grant 9615: </div>
9616:
9617: <div class="sect2" lang="en" xml:lang="en">
9618: <div class="titlepage">
9619: <div>
9620: <div>
1.22 ! tv 9621: <h3 class="title"><a name="id2587187" id=
! 9622: "id2587187"></a>12.5.4. Creating an account
1.1 grant 9623: from a package</h3>
9624: </div>
9625: </div>
9626: </div>
9627:
9628: <p>There are two make variables used to control the
9629: creation of package-specific groups and users at
1.14 xtraeme 9630: pre-install time. The first is <code class=
9631: "varname">PKG_GROUPS</code>, which is a list of
1.1 grant 9632: group[:groupid] elements, where the groupid is
1.14 xtraeme 9633: optional. The second is <code class=
9634: "varname">PKG_USERS</code>, which is a list of elements
1.1 grant 9635: of the form:</p>
9636: <pre class="programlisting">
9637: user:group[:[userid][:[description][:[home][:shell]]]]
9638: </pre>
9639:
9640: <p>where only the user and group are required, the rest
9641: being optional. A simple example is:</p>
9642: <pre class="programlisting">
9643: PKG_GROUPS= foogroup
9644: PKG_USERS= foouser:foogroup
9645: </pre>
9646:
9647: <p>A more complex example is that creates two groups
9648: and two users is:</p>
9649: <pre class="programlisting">
9650: PKG_GROUPS= group1 group2:1005
9651: PKG_USERS= first:group1::First\\ User \
9652: second:group2::Second\\ User:/home/second:${SH}
9653: </pre>
9654:
9655: <p>By default, a new user will have home directory
1.14 xtraeme 9656: <code class="filename">/nonexistent</code>, and login
9657: shell <code class="filename">/sbin/nologin</code>
9658: unless they are specified as part of the user
9659: element.</p>
1.1 grant 9660:
1.14 xtraeme 9661: <p>The package <code class="filename">Makefile</code>
9662: must also set <code class=
9663: "varname">USE_PKGINSTALL=YES</code>. This will cause
9664: the users and groups to be created at pre-install time,
9665: and the admin will be prompted to remove them at
9666: post-deinstall time. Automatic creation of the users
9667: and groups can be toggled on and off by setting the
9668: <code class="varname">PKG_CREATE_USERGROUP</code>
9669: variable prior to package installation.</p>
1.1 grant 9670: </div>
9671:
9672: <div class="sect2" lang="en" xml:lang="en">
9673: <div class="titlepage">
9674: <div>
9675: <div>
1.22 ! tv 9676: <h3 class="title"><a name="id2587249" id=
! 9677: "id2587249"></a>12.5.5. Installing score
1.1 grant 9678: files</h3>
9679: </div>
9680: </div>
9681: </div>
9682:
9683: <p>Certain packages, most of them in the games
9684: category, install a score file that allows all users on
9685: the system to record their highscores. In order for
9686: this to work, the binaries need to be installed setgid
9687: and the score files owned by the appropriate group
9688: and/or owner (traditionally the "games" user/group).
9689: The following variables, documented in more detail in
1.14 xtraeme 9690: <code class="filename">mk/defaults/mk.conf</code>,
9691: control this behaviour: <code class=
9692: "varname">SETGIDGAME</code>, <code class=
9693: "varname">GAMEDATAMODE</code>, <code class=
9694: "varname">GAMEGRP</code>, <code class=
9695: "varname">GAMEMODE</code>, <code class=
9696: "varname">GAMEOWN</code>.</p>
1.1 grant 9697:
9698: <p>Note that per default, setgid installation of games
1.14 xtraeme 9699: is disabled; setting <code class=
9700: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 9701: variables accordingly.</p>
9702:
9703: <p>A package should therefor never hard code file
1.14 xtraeme 9704: ownership or access permissions but rely on
9705: <code class="varname">INSTALL_GAME</code> and
9706: <code class="varname">INSTALL_GAME_DATA</code> to set
9707: these correctly.</p>
1.1 grant 9708: </div>
9709:
9710: <div class="sect2" lang="en" xml:lang="en">
9711: <div class="titlepage">
9712: <div>
9713: <div>
1.22 ! tv 9714: <h3 class="title"><a name="id2587292" id=
! 9715: "id2587292"></a>12.5.6. Packages providing
1.1 grant 9716: login shells</h3>
9717: </div>
9718: </div>
9719: </div>
9720:
9721: <p>If the purpose of the package is to provide a login
1.14 xtraeme 9722: shell, the variable <code class=
9723: "varname">PKG_SHELL</code> should contain the full
9724: pathname of the shell executable installed by this
9725: package. The package <code class=
9726: "filename">Makefile</code> must also set <code class=
9727: "varname">USE_PKGINSTALL=YES</code> to use the
9728: automatically generated <code class=
9729: "filename">INSTALL</code>/<code class=
9730: "filename">DEINSTALL</code> scripts.</p>
1.1 grant 9731:
9732: <p>An example taken from shells/zsh:</p>
9733: <pre class="programlisting">
9734: USE_PKGINSTALL= YES
9735: PKG_SHELL= ${PREFIX}/bin/zsh
9736: </pre>
9737:
1.14 xtraeme 9738: <p>The shell is registered into <code class=
9739: "filename">/etc/shells</code> file automatically in the
9740: post-install target by the generated <code class=
9741: "filename">INSTALL</code> script and removed in the
9742: deinstall target by the <code class=
9743: "filename">DEINSTALL</code> script.</p>
1.1 grant 9744: </div>
9745:
9746: <div class="sect2" lang="en" xml:lang="en">
9747: <div class="titlepage">
9748: <div>
9749: <div>
1.22 ! tv 9750: <h3 class="title"><a name="id2587350" id=
! 9751: "id2587350"></a>12.5.7. Packages containing
1.1 grant 9752: perl scripts</h3>
9753: </div>
9754: </div>
9755: </div>
9756:
9757: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 9758: set <code class="varname">REPLACE_PERL</code> to ensure
9759: that the proper interpreter path is set. <code class=
9760: "varname">REPLACE_PERL</code> should contain a list of
9761: scripts, relative to <code class=
9762: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 9763: </div>
9764:
9765: <div class="sect2" lang="en" xml:lang="en">
9766: <div class="titlepage">
9767: <div>
9768: <div>
1.22 ! tv 9769: <h3 class="title"><a name="id2587368" id=
! 9770: "id2587368"></a>12.5.8. Packages with
1.1 grant 9771: hardcoded paths to other interpreters</h3>
9772: </div>
9773: </div>
9774: </div>
9775:
9776: <p>Your package may also contain scripts with hardcoded
9777: paths to other interpreters besides (or as well as)
9778: perl. To correct the full pathname to the script
9779: interpreter, you need to set the following definitions
1.14 xtraeme 9780: in your <code class="filename">Makefile</code> (we
9781: shall use <span><strong class=
9782: "command">tclsh</strong></span> in this example):</p>
1.1 grant 9783: <pre class="programlisting">
9784: REPLACE_INTERPRETER+= tcl
9785: _REPLACE.tcl.old= .*/bin/tclsh
9786: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
9787: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
9788: relative to ${WRKSRC}, just as in REPLACE_PERL
9789: </pre>
9790: </div>
9791:
9792: <div class="sect2" lang="en" xml:lang="en">
9793: <div class="titlepage">
9794: <div>
9795: <div>
1.22 ! tv 9796: <h3 class="title"><a name="id2587458" id=
! 9797: "id2587458"></a>12.5.9. Packages installing
1.1 grant 9798: perl modules</h3>
9799: </div>
9800: </div>
9801: </div>
9802:
9803: <p>Makefiles of packages providing perl5 modules should
1.14 xtraeme 9804: include the Makefile fragment <code class=
9805: "filename">../../lang/perl5/module.mk</code>. It
9806: provides a <span><strong class=
9807: "command">do-configure</strong></span> target for the
9808: standard perl configuration for such modules as well as
9809: various hooks to tune this configuration. See comments
9810: in this file for details.</p>
1.1 grant 9811:
9812: <p>Perl5 modules will install into different places
9813: depending on the version of perl used during the build
9814: process. To address this, pkgsrc will append lines to
1.14 xtraeme 9815: the <code class="filename">PLIST</code> corresponding
9816: to the files listed in the installed <code class=
9817: "filename">.packlist</code> file generated by most
9818: perl5 modules. This is invoked by defining <code class=
9819: "varname">PERL5_PACKLIST</code> to a space-separated
9820: list of paths to packlist files, e.g.:</p>
1.1 grant 9821: <pre class="programlisting">
9822: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
9823: </pre>
9824:
1.14 xtraeme 9825: <p>The variables <code class=
9826: "varname">PERL5_SITELIB</code>, <code class=
9827: "varname">PERL5_SITEARCH</code>, and <code class=
9828: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 9829: locations in which perl5 modules may be installed, and
9830: may be used by perl5 packages that don't have a
9831: packlist. These three variables are also substituted
1.14 xtraeme 9832: for in the <code class="filename">PLIST</code>.</p>
1.1 grant 9833: </div>
9834:
9835: <div class="sect2" lang="en" xml:lang="en">
9836: <div class="titlepage">
9837: <div>
9838: <div>
9839: <h3 class="title"><a name="faq.info-files" id=
9840: "faq.info-files"></a>12.5.10. Packages
9841: installing info files</h3>
9842: </div>
9843: </div>
9844: </div>
9845:
9846: <p>Some packages install info files or use the
9847: “<span class="quote">makeinfo</span>” or
9848: “<span class="quote">install-info</span>”
9849: commands. Each of the info files:</p>
9850:
9851: <div class="itemizedlist">
9852: <ul type="disc">
9853: <li>
9854: <p>is considered to be installed in the directory
1.14 xtraeme 9855: <code class=
9856: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 9857: </li>
9858:
9859: <li>
9860: <p>is registered in the Info directory file
1.14 xtraeme 9861: <code class=
9862: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 9863: </li>
9864:
9865: <li>
9866: <p>and must be listed as a filename in the
1.14 xtraeme 9867: <code class="varname">INFO_FILES</code> variable
9868: in the package Makefile.</p>
1.1 grant 9869: </li>
9870: </ul>
9871: </div>
9872:
1.14 xtraeme 9873: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 9874: “<span class="quote">info</span>” and can
1.14 xtraeme 9875: be overridden in the package Makefile. <code class=
9876: "filename">INSTALL</code> and <code class=
9877: "filename">DEINSTALL</code> scripts will be generated
9878: to handle registration of the info files in the Info
1.1 grant 9879: directory file. The “<span class=
9880: "quote">install-info</span>” command used for the
9881: info files registration is either provided by the
9882: system, or by a special purpose package automatically
9883: added as dependency if needed.</p>
9884:
9885: <p>A package which needs the “<span class=
9886: "quote">makeinfo</span>” command at build time
1.14 xtraeme 9887: must define the variable <code class=
9888: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 9889: minimum version of the “<span class=
9890: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 9891: should be noted with the <code class=
9892: "varname">TEXINFO_REQD</code> variable in the package
9893: <code class="filename">Makefile</code>. By default, a
1.1 grant 9894: minimum version of 3.12 is required. If the system does
1.14 xtraeme 9895: not provide a <span><strong class=
9896: "command">makeinfo</strong></span> command or if it
9897: does not match the required minimum, a build dependency
9898: on the <a xmlns=
9899: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 9900: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20 ben 9901: class="pkgname">devel/gtexinfo</a> package will be
9902: added automatically.</p>
1.1 grant 9903:
9904: <p>The build and installation process of the software
9905: provided by the package should not use the
1.14 xtraeme 9906: <span><strong class=
9907: "command">install-info</strong></span> command as the
9908: registration of info files is the task of the package
9909: <code class="filename">INSTALL</code> script, and it
9910: must use the appropriate <span><strong class=
9911: "command">makeinfo</strong></span> command.</p>
1.1 grant 9912:
9913: <p>To achieve this goal the pkgsrc infrastructure
1.14 xtraeme 9914: creates overriding scripts for the <span><strong class=
9915: "command">install-info</strong></span> and
9916: <span><strong class="command">makeinfo</strong></span>
9917: commands in a directory listed early in <code class=
9918: "varname">PATH</code>.</p>
1.1 grant 9919:
1.14 xtraeme 9920: <p>The script overriding <span><strong class=
9921: "command">install-info</strong></span> has no effect
9922: except the logging of a message. The script overriding
9923: <span><strong class="command">makeinfo</strong></span>
9924: logs a message and according to the value of
9925: <code class="varname">USE_MAKEINFO</code> and
9926: <code class="varname">TEXINFO_REQD</code> either run
9927: the appropriate <span><strong class=
9928: "command">makeinfo</strong></span> command or exit on
9929: error.</p>
1.1 grant 9930: </div>
9931:
9932: <div class="sect2" lang="en" xml:lang="en">
9933: <div class="titlepage">
9934: <div>
9935: <div>
1.22 ! tv 9936: <h3 class="title"><a name="id2587677" id=
! 9937: "id2587677"></a>12.5.11. Packages installing
1.1 grant 9938: GConf2 data files</h3>
9939: </div>
9940: </div>
9941: </div>
9942:
1.14 xtraeme 9943: <p>If a package installs <code class=
9944: "filename">.schemas</code> or <code class=
9945: "filename">.entries</code> files, used by GConf2, you
1.1 grant 9946: need to take some extra steps to make sure they get
9947: registered in the database:</p>
9948:
9949: <div class="orderedlist">
9950: <ol type="1">
9951: <li>
1.14 xtraeme 9952: <p>Include <code class=
9953: "filename">../../devel/GConf2/schemas.mk</code>
9954: instead of its <code class=
9955: "filename">buildlink3.mk</code> file. This takes
1.1 grant 9956: care of rebuilding the GConf2 database at
9957: installation and deinstallation time, and tells
9958: the package where to install GConf2 data files
9959: using some standard configure arguments. It also
9960: disallows any access to the database directly
9961: from the package.</p>
9962: </li>
9963:
9964: <li>
9965: <p>Ensure that the package installs its
1.14 xtraeme 9966: <code class="filename">.schemas</code> files
9967: under <code class=
9968: "filename">${PREFIX}/share/gconf/schemas</code>.
9969: If they get installed under <code class=
9970: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 9971: manually patch the package.</p>
9972: </li>
9973:
9974: <li>
9975: <p>Check the PLIST and remove any entries under
9976: the etc/gconf directory, as they will be handled
9977: automatically. See <a href="#faq.conf" title=
1.14 xtraeme 9978: "6.14. Configuration files handling and placement">
9979: Section 6.14, “Configuration files
1.1 grant 9980: handling and placement”</a> for more
9981: information.</p>
9982: </li>
9983:
9984: <li>
1.14 xtraeme 9985: <p>Define the <code class=
9986: "varname">GCONF2_SCHEMAS</code> variable in your
9987: <code class="filename">Makefile</code> with a
9988: list of all <code class=
9989: "filename">.schemas</code> files installed by the
9990: package, if any. Names must not contain any
9991: directories in them.</p>
1.1 grant 9992: </li>
9993:
9994: <li>
1.14 xtraeme 9995: <p>Define the <code class=
9996: "varname">GCONF2_ENTRIES</code> variable in your
9997: <code class="filename">Makefile</code> with a
9998: list of all <code class=
9999: "filename">.entries</code> files installed by the
10000: package, if any. Names must not contain any
10001: directories in them.</p>
1.1 grant 10002: </li>
10003: </ol>
10004: </div>
10005: </div>
10006:
10007: <div class="sect2" lang="en" xml:lang="en">
10008: <div class="titlepage">
10009: <div>
10010: <div>
1.22 ! tv 10011: <h3 class="title"><a name="id2587778" id=
! 10012: "id2587778"></a>12.5.12. Packages installing
1.1 grant 10013: scrollkeeper data files</h3>
10014: </div>
10015: </div>
10016: </div>
10017:
1.14 xtraeme 10018: <p>If a package installs <code class=
10019: "filename">.omf</code> files, used by scrollkeeper, you
10020: need to take some extra steps to make sure they get
10021: registered in the database:</p>
1.1 grant 10022:
10023: <div class="orderedlist">
10024: <ol type="1">
10025: <li>
1.14 xtraeme 10026: <p>Include <code class=
10027: "filename">../../textproc/scrollkeeper/omf.mk</code>
10028: instead of its <code class=
10029: "filename">buildlink3.mk</code> file. This takes
1.1 grant 10030: care of rebuilding the scrollkeeper database at
10031: installation and deinstallation time, and
10032: disallows any access to it directly from the
10033: package.</p>
10034: </li>
10035:
10036: <li>
10037: <p>Check the PLIST and remove any entries under
1.14 xtraeme 10038: the <code class=
10039: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 10040: as they will be handled automatically.</p>
10041: </li>
10042:
10043: <li>
1.14 xtraeme 10044: <p>Remove the <code class=
10045: "filename">share/omf</code> directory from the
10046: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 10047: </li>
10048: </ol>
10049: </div>
10050: </div>
10051:
10052: <div class="sect2" lang="en" xml:lang="en">
10053: <div class="titlepage">
10054: <div>
10055: <div>
1.22 ! tv 10056: <h3 class="title"><a name="id2587829" id=
! 10057: "id2587829"></a>12.5.13. Packages installing
1.1 grant 10058: X11 fonts</h3>
10059: </div>
10060: </div>
10061: </div>
10062:
10063: <p>If a package installs font files, you will need to
10064: rebuild the fonts database in the directory where they
10065: get installed at installation and deinstallation time.
1.14 xtraeme 10066: This can be automatically done by using <code class=
10067: "filename">mk/fonts.mk</code>, which you need to
10068: include in your <code class=
10069: "filename">Makefile</code>.</p>
1.1 grant 10070:
10071: <p>When the file is included, you can list the
1.14 xtraeme 10072: directories where fonts are installed in the
10073: <code class="varname">FONTS_<em class=
10074: "replaceable"><code>type</code></em>_DIRS</code>
10075: variables, where <em class=
10076: "replaceable"><code>type</code></em> can be one of
10077: “<span class="quote">TTF</span>”,
1.1 grant 10078: “<span class="quote">TYPE1</span>” or
10079: “<span class="quote">X11</span>”. Also make
1.14 xtraeme 10080: sure that the database file <code class=
10081: "filename">fonts.dir</code> is not listed in the
1.1 grant 10082: PLIST.</p>
10083:
10084: <p>Note that you should not create new directories for
10085: fonts; instead use the standard ones to avoid that the
10086: user needs to manually configure his X server to find
10087: them.</p>
10088: </div>
10089:
10090: <div class="sect2" lang="en" xml:lang="en">
10091: <div class="titlepage">
10092: <div>
10093: <div>
1.22 ! tv 10094: <h3 class="title"><a name="id2587876" id=
! 10095: "id2587876"></a>12.5.14. Packages installing
1.1 grant 10096: GTK2 modules</h3>
10097: </div>
10098: </div>
10099: </div>
10100:
10101: <p>If a package installs gtk2 immodules or loaders, you
10102: need to take some extra steps to get them registered in
10103: the GTK2 database properly:</p>
10104:
10105: <div class="orderedlist">
10106: <ol type="1">
10107: <li>
1.14 xtraeme 10108: <p>Include <code class=
10109: "filename">../../x11/gtk2/modules.mk</code>
10110: instead of its <code class=
10111: "filename">buildlink3.mk</code> file. This takes
10112: care of rebuilding the database at installation
10113: and deinstallation time.</p>
1.1 grant 10114: </li>
10115:
10116: <li>
1.14 xtraeme 10117: <p>Set <code class=
10118: "varname">GTK2_IMMODULES=YES</code> if your
10119: package installs GTK2 immodules.</p>
1.1 grant 10120: </li>
10121:
10122: <li>
1.14 xtraeme 10123: <p>Set <code class=
10124: "varname">GTK2_LOADERS=YES</code> if your package
10125: installs GTK2 loaders.</p>
1.1 grant 10126: </li>
10127:
10128: <li>
10129: <p>Patch the package to not touch any of the gtk2
10130: databases directly. These are:</p>
10131:
10132: <div class="itemizedlist">
10133: <ul type="disc">
10134: <li>
1.14 xtraeme 10135: <p><code class=
10136: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 10137: </li>
10138:
10139: <li>
1.14 xtraeme 10140: <p><code class=
10141: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 10142: </li>
10143: </ul>
10144: </div>
10145: </li>
10146:
10147: <li>
10148: <p>Check the PLIST and remove any entries under
1.14 xtraeme 10149: the <code class="filename">libdata/gtk-2.0</code>
1.1 grant 10150: directory, as they will be handled
10151: automatically.</p>
10152: </li>
10153: </ol>
10154: </div>
10155: </div>
10156:
10157: <div class="sect2" lang="en" xml:lang="en">
10158: <div class="titlepage">
10159: <div>
10160: <div>
1.22 ! tv 10161: <h3 class="title"><a name="id2587945" id=
! 10162: "id2587945"></a>12.5.15. Packages installing
1.1 grant 10163: SGML or XML data</h3>
10164: </div>
10165: </div>
10166: </div>
10167:
10168: <p>If a package installs SGML or XML data files that
10169: need to be registered in system-wide catalogs (like
10170: DTDs, sub-catalogs, etc.), you need to take some extra
10171: steps:</p>
10172:
10173: <div class="orderedlist">
10174: <ol type="1">
10175: <li>
1.14 xtraeme 10176: <p>Include <code class=
10177: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
10178: in your <code class="filename">Makefile</code>,
10179: which takes care of registering those files in
1.1 grant 10180: system-wide catalogs at installation and
10181: deinstallation time.</p>
10182: </li>
10183:
10184: <li>
1.14 xtraeme 10185: <p>Set <code class="varname">SGML_CATALOGS</code>
10186: to the full path of any SGML catalogs installed
10187: by the package.</p>
1.1 grant 10188: </li>
10189:
10190: <li>
1.14 xtraeme 10191: <p>Set <code class="varname">XML_CATALOGS</code>
10192: to the full path of any XML catalogs installed by
1.1 grant 10193: the package.</p>
10194: </li>
10195:
10196: <li>
1.14 xtraeme 10197: <p>Set <code class="varname">SGML_ENTRIES</code>
10198: to individual entries to be added to the SGML
1.1 grant 10199: catalog. These come in groups of three strings;
10200: see xmlcatmgr(1) for more information
10201: (specifically, arguments recognized by the 'add'
10202: action). Note that you will normally not use this
10203: variable.</p>
10204: </li>
10205:
10206: <li>
1.14 xtraeme 10207: <p>Set <code class="varname">XML_ENTRIES</code>
10208: to individual entries to be added to the XML
1.1 grant 10209: catalog. These come in groups of three strings;
10210: see xmlcatmgr(1) for more information
10211: (specifically, arguments recognized by the 'add'
10212: action). Note that you will normally not use this
10213: variable.</p>
10214: </li>
10215: </ol>
10216: </div>
10217: </div>
10218:
10219: <div class="sect2" lang="en" xml:lang="en">
10220: <div class="titlepage">
10221: <div>
10222: <div>
1.22 ! tv 10223: <h3 class="title"><a name="id2588066" id=
! 10224: "id2588066"></a>12.5.16. Packages installing
1.1 grant 10225: extensions to the MIME database</h3>
10226: </div>
10227: </div>
10228: </div>
10229:
10230: <p>If a package provides extensions to the MIME
1.14 xtraeme 10231: database by installing <code class=
10232: "filename">.xml</code> files inside <code class=
10233: "filename">${PREFIX}/share/mime/packages</code>, you
10234: need to take some extra steps to ensure that the
10235: database is kept consistent with respect to these new
10236: files:</p>
1.1 grant 10237:
10238: <div class="orderedlist">
10239: <ol type="1">
10240: <li>
1.14 xtraeme 10241: <p>Include <code class=
10242: "filename">../../databases/shared-mime-info/mimedb.mk</code>
10243: (avoid using the <code class=
10244: "filename">buildlink3.mk</code> file from this
10245: same directory, which is reserved for inclusion
10246: from other <code class=
10247: "filename">buildlink3.mk</code> files). It takes
10248: care of rebuilding the MIME database at
10249: installation and deinstallation time, and
10250: disallows any access to it directly from the
1.1 grant 10251: package.</p>
10252: </li>
10253:
10254: <li>
10255: <p>Check the PLIST and remove any entries under
1.14 xtraeme 10256: the <code class="filename">share/mime</code>
1.1 grant 10257: directory, <span class=
10258: "emphasis"><em>except</em></span> for files saved
1.14 xtraeme 10259: under <code class=
10260: "filename">share/mime/packages</code>. The former
1.1 grant 10261: are handled automatically by the
10262: update-mime-database program, but the later are
10263: package-dependent and must be removed by the
10264: package that installed them in the first
10265: place.</p>
10266: </li>
10267:
10268: <li>
1.14 xtraeme 10269: <p>Remove any <code class=
10270: "filename">share/mime/*</code> directories from
10271: the PLIST. They will be handled by the
1.1 grant 10272: shared-mime-info package.</p>
10273: </li>
10274: </ol>
10275: </div>
10276: </div>
10277:
10278: <div class="sect2" lang="en" xml:lang="en">
10279: <div class="titlepage">
10280: <div>
10281: <div>
1.22 ! tv 10282: <h3 class="title"><a name="id2588273" id=
! 10283: "id2588273"></a>12.5.17. Packages using
1.1 grant 10284: intltool</h3>
10285: </div>
10286: </div>
10287: </div>
10288:
10289: <p>If a package uses intltool during its build, include
1.14 xtraeme 10290: the <code class=
10291: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 10292: file, which forces it to use the intltool package
10293: provided by pkgsrc, instead of the one bundled with the
10294: distribution file.</p>
10295:
10296: <p>This tracks intltool's build-time dependencies and
10297: uses the latest available version; this way, the
10298: package benefits of any bug fixes that may have
10299: appeared since it was released.</p>
10300: </div>
1.18 xtraeme 10301:
10302: <div class="sect2" lang="en" xml:lang="en">
10303: <div class="titlepage">
10304: <div>
10305: <div>
1.22 ! tv 10306: <h3 class="title"><a name="id2588286" id=
! 10307: "id2588286"></a>12.5.18. Packages installing
1.18 xtraeme 10308: startup scripts</h3>
10309: </div>
10310: </div>
10311: </div>
10312:
10313: <p>If a package contains a rc.d script, it won't be
10314: copied into the startup directory by default, but you
10315: can enable it, by adding the option <code class=
10316: "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
10317: "filename">/etc/mk.conf</code>. This option will copy
10318: the scripts into <code class=
10319: "filename">/etc/rc.d</code> when a package is
10320: installed, and it will automatically remove the scripts
10321: when the package is deinstalled.</p>
10322: </div>
1.1 grant 10323: </div>
10324:
10325: <div class="sect1" lang="en" xml:lang="en">
10326: <div class="titlepage">
10327: <div>
10328: <div>
10329: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 10330: "id2588308" id="id2588308"></a>12.6. Feedback
1.1 grant 10331: to the author</h2>
10332: </div>
10333: </div>
10334: </div>
10335:
10336: <p>If you have found any bugs in the package you make
10337: available, if you had to do special steps to make it run
10338: under NetBSD or if you enhanced the software in various
10339: other ways, be sure to report these changes back to the
10340: original author of the program! With that kind of
10341: support, the next release of the program can incorporate
10342: these fixes, and people not using the NetBSD packages
10343: system can win from your efforts.</p>
10344:
10345: <p>Support the idea of free software!</p>
10346: </div>
10347: </div>
10348:
10349: <div class="chapter" lang="en" xml:lang="en">
10350: <div class="titlepage">
10351: <div>
10352: <div>
10353: <h2 class="title"><a name="debug" id=
10354: "debug"></a>Chapter 13. Debugging</h2>
10355: </div>
10356: </div>
10357: </div>
10358:
10359: <p>To check out all the gotchas when building a package,
10360: here are the steps that I do in order to get a package
10361: working. Please note this is basically the same as what was
10362: explained in the previous sections, only with some
10363: debugging aids.</p>
10364:
10365: <div class="itemizedlist">
10366: <ul type="disc">
10367: <li>
1.14 xtraeme 10368: <p>Be sure to set <code class=
10369: "varname">PKG_DEVELOPER=1</code> in <code class=
10370: "filename">/etc/mk.conf</code></p>
1.1 grant 10371: </li>
10372:
10373: <li>
10374: <p>Install <a xmlns=
10375: "http://www.w3.org/TR/xhtml1/transitional" href=
10376: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20 ben 10377: class="pkgname">pkgtools/url2pkg</a>, create a
10378: directory for a new package, change into it, then run
10379: <span><strong class=
10380: "command">url2pkg</strong></span>:</p>
1.1 grant 10381: <pre class="screen">
1.14 xtraeme 10382: <code class="prompt">%</code> <strong class=
10383: "userinput"><code>mkdir /usr/pkgsrc/<em class=
10384: "replaceable"><code>category</code></em>/<em class=
10385: "replaceable"><code>examplepkg</code></em></code></strong>
10386: <code class="prompt">%</code> <strong class=
10387: "userinput"><code>cd /usr/pkgsrc/<em class=
10388: "replaceable"><code>category</code></em>/<em class=
10389: "replaceable"><code>examplepkg</code></em></code></strong>
10390: <code class="prompt">%</code> <strong class=
10391: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 10392: </pre>
10393: </li>
10394:
10395: <li>
1.14 xtraeme 10396: <p>Edit the <code class="filename">Makefile</code> as
1.1 grant 10397: requested.</p>
10398: </li>
10399:
10400: <li>
1.14 xtraeme 10401: <p>Fill in the <code class="filename">DESCR</code>
1.1 grant 10402: file</p>
10403: </li>
10404:
10405: <li>
1.14 xtraeme 10406: <p>Run <span><strong class="command">make
10407: configure</strong></span></p>
1.1 grant 10408: </li>
10409:
10410: <li>
10411: <p>Add any dependencies glimpsed from documentation
1.14 xtraeme 10412: and the configure step to the package's <code class=
10413: "filename">Makefile</code>.</p>
1.1 grant 10414: </li>
10415:
10416: <li>
10417: <p>Make the package compile, doing multiple rounds
10418: of</p>
10419: <pre class="screen">
1.14 xtraeme 10420: <code class="prompt">%</code> <strong class=
10421: "userinput"><code>make</code></strong>
10422: <code class="prompt">%</code> <strong class=
10423: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
10424: <code class="prompt">%</code> <strong class=
10425: "userinput"><code>mkpatches</code></strong>
10426: <code class="prompt">%</code> <strong class=
10427: "userinput"><code>patchdiff</code></strong>
10428: <code class="prompt">%</code> <strong class=
10429: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
10430: <code class="prompt">%</code> <strong class=
10431: "userinput"><code>make mps</code></strong>
10432: <code class="prompt">%</code> <strong class=
10433: "userinput"><code>make clean</code></strong>
1.1 grant 10434: </pre>
10435:
10436: <p>Doing as non-root user will ensure that no files
10437: are modified that shouldn't be, especially during the
1.14 xtraeme 10438: build phase. <span><strong class=
10439: "command">mkpatches</strong></span>,
10440: <span><strong class=
10441: "command">patchdiff</strong></span> and
10442: <span><strong class="command">pkgvi</strong></span>
10443: are from the <a xmlns=
1.1 grant 10444: "http://www.w3.org/TR/xhtml1/transitional" href=
10445: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 10446: class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1 grant 10447: </li>
10448:
10449: <li>
1.14 xtraeme 10450: <p>Look at the <code class=
10451: "filename">Makefile</code>, fix if necessary; see
10452: <a href="#components.Makefile" title=
10453: "7.1. Makefile">Section 7.1,
10454: “<code class=
10455: "filename">Makefile</code>”</a>.</p>
1.1 grant 10456: </li>
10457:
10458: <li>
1.14 xtraeme 10459: <p>Generate a <code class=
10460: "filename">PLIST</code>:</p>
1.1 grant 10461: <pre class="screen">
1.14 xtraeme 10462: <code class="prompt">#</code> <strong class=
10463: "userinput"><code>make install</code></strong>
10464: <code class="prompt">#</code> <strong class=
10465: "userinput"><code>make print-PLIST >PLIST</code></strong>
10466: <code class="prompt">#</code> <strong class=
10467: "userinput"><code>make deinstall</code></strong>
10468: <code class="prompt">#</code> <strong class=
10469: "userinput"><code>make install</code></strong>
10470: <code class="prompt">#</code> <strong class=
10471: "userinput"><code>make deinstall</code></strong>
1.1 grant 10472: </pre>
10473:
1.14 xtraeme 10474: <p>You usually need to be <code class=
10475: "username">root</code> to do this. Look if there are
1.1 grant 10476: any files left:</p>
10477: <pre class="screen">
1.14 xtraeme 10478: <code class="prompt">#</code> <strong class=
10479: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 10480: </pre>
10481:
10482: <p>If this reveals any files that are missing in
1.14 xtraeme 10483: <code class="filename">PLIST</code>, add them.</p>
1.1 grant 10484: </li>
10485:
10486: <li>
1.14 xtraeme 10487: <p>Now that the <code class="filename">PLIST</code>
10488: is OK, install the package again and make a binary
1.1 grant 10489: package:</p>
10490: <pre class="screen">
1.14 xtraeme 10491: <code class="prompt">#</code> <strong class=
10492: "userinput"><code>make reinstall</code></strong>
10493: <code class="prompt">#</code> <strong class=
10494: "userinput"><code>make package</code></strong>
1.1 grant 10495: </pre>
10496: </li>
10497:
10498: <li>
10499: <p>Delete the installed package:</p>
10500: <pre class="screen">
1.14 xtraeme 10501: <code class="prompt">#</code> <strong class=
10502: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 10503: </pre>
10504: </li>
10505:
10506: <li>
1.14 xtraeme 10507: <p>Repeat the above <span><strong class=
10508: "command">make print-PLIST</strong></span> command,
10509: which shouldn't find anything now:</p>
1.1 grant 10510: <pre class="screen">
1.14 xtraeme 10511: <code class="prompt">#</code> <strong class=
10512: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 10513: </pre>
10514: </li>
10515:
10516: <li>
10517: <p>Reinstall the binary package:</p>
10518: <pre class="screen">
1.14 xtraeme 10519: <code class="prompt">#</code> <strong class=
10520: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 10521: </pre>
10522: </li>
10523:
10524: <li>
10525: <p>Play with it. Make sure everything works.</p>
10526: </li>
10527:
10528: <li>
1.14 xtraeme 10529: <p>Run <span><strong class=
10530: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 10531: "http://www.w3.org/TR/xhtml1/transitional" href=
10532: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 10533: class="pkgname">pkgtools/pkglint</a>, and fix the
10534: problems it reports:</p>
1.1 grant 10535: <pre class="screen">
1.14 xtraeme 10536: <code class="prompt">#</code> <strong class=
10537: "userinput"><code>pkglint</code></strong>
1.1 grant 10538: </pre>
10539: </li>
10540:
10541: <li>
10542: <p>Submit (or commit, if you have cvs access); see
10543: <a href="#submit" title=
10544: "Chapter 14. Submitting and Committing">Chapter 14,
10545: <i>Submitting and Committing</i></a>.</p>
10546: </li>
10547: </ul>
10548: </div>
10549: </div>
10550:
10551: <div class="chapter" lang="en" xml:lang="en">
10552: <div class="titlepage">
10553: <div>
10554: <div>
10555: <h2 class="title"><a name="submit" id=
10556: "submit"></a>Chapter 14. Submitting and
10557: Committing</h2>
10558: </div>
10559: </div>
10560: </div>
10561:
10562: <div class="toc">
10563: <p><b>Table of Contents</b></p>
10564:
10565: <dl>
1.22 ! tv 10566: <dt><span class="sect1"><a href="#id2588838">14.1.
1.1 grant 10567: Submitting your packages</a></span></dt>
10568:
1.22 ! tv 10569: <dt><span class="sect1"><a href="#id2588889">14.2.
1.1 grant 10570: Committing: Importing a package into
10571: CVS</a></span></dt>
10572:
1.22 ! tv 10573: <dt><span class="sect1"><a href="#id2589020">14.3.
1.2 hubertf 10574: Updating a package to a newer version</a></span></dt>
1.1 grant 10575:
1.22 ! tv 10576: <dt><span class="sect1"><a href="#id2589040">14.4.
1.2 hubertf 10577: Moving a package in pkgsrc</a></span></dt>
1.1 grant 10578: </dl>
10579: </div>
10580:
10581: <div class="sect1" lang="en" xml:lang="en">
10582: <div class="titlepage">
10583: <div>
10584: <div>
10585: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 10586: "id2588838" id=
! 10587: "id2588838"></a>14.1. Submitting your
1.1 grant 10588: packages</h2>
10589: </div>
10590: </div>
10591: </div>
10592:
10593: <p>You have to separate between binary and
10594: “<span class="quote">normal</span>” (source)
10595: packages here:</p>
10596:
10597: <div class="itemizedlist">
10598: <ul type="disc">
10599: <li>
10600: <p>precompiled binary packages</p>
10601:
10602: <p>Our policy is that we accept binaries only from
10603: pkgsrc developers to guarantee that the packages
10604: don't contain any trojan horses etc. This is not to
1.13 hubertf 10605: annoy anyone but rather to protect our users!
1.1 grant 10606: You're still free to put up your home-made binary
1.13 hubertf 10607: packages and tell the world where to get them.
10608: NetBSD developers doing bulk builds and wanting to
10609: upload them please see <a href="#bulk-upload"
10610: title="5.3.8. Uploading results of a bulk build">
10611: Section 5.3.8, “Uploading results of a
10612: bulk build”</a>.</p>
1.1 grant 10613: </li>
10614:
10615: <li>
10616: <p>packages</p>
10617:
10618: <p>First, check that your package is complete,
10619: compiles and runs well; see <a href="#debug" title=
10620: "Chapter 13. Debugging">Chapter 13,
10621: <i>Debugging</i></a> and the rest of this document.
10622: Next, generate an uuencoded gzipped tar(1) archive,
10623: preferably with all files in a single directory.
1.14 xtraeme 10624: Finally, <span><strong class=
10625: "command">send-pr</strong></span> with category
1.1 grant 10626: “<span class="quote">pkg</span>”, a
10627: synopsis which includes the package name and
10628: version number, a short description of your package
10629: (contents of the COMMENT variable or DESCR file are
10630: OK) and attach the archive to your PR.</p>
10631:
10632: <p>If you want to submit several packages, please
10633: send a separate PR for each one, it's easier for us
10634: to track things that way.</p>
10635:
10636: <p>Alternatively, you can also import new packages
10637: into pkgsrc-wip (“<span class="quote">pkgsrc
10638: work-in-progress</span>”); see the homepage
10639: at <a href="http://pkgsrc-wip.sourceforge.net/"
10640: target=
10641: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
10642: details.</p>
10643: </li>
10644: </ul>
10645: </div>
10646: </div>
10647:
10648: <div class="sect1" lang="en" xml:lang="en">
10649: <div class="titlepage">
10650: <div>
10651: <div>
10652: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 10653: "id2588889" id=
! 10654: "id2588889"></a>14.2. Committing: Importing a
1.1 grant 10655: package into CVS</h2>
10656: </div>
10657: </div>
10658: </div>
10659:
10660: <p>This section is only of interest for pkgsrc developers
10661: with write access to the pkgsrc repository. Please
10662: remember that cvs imports files relative to the current
10663: working directory, and that the pathname that you give
1.14 xtraeme 10664: the <span><strong class="command">cvs
10665: import</strong></span> command is so that it knows where
10666: to place the files in the repository. Newly created
10667: packages should be imported with a vendor tag of
10668: “<span class="quote">TNF</span>” and a
10669: release tag of “<span class=
10670: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 10671: <pre class="programlisting">
10672: % cd .../pkgsrc/category/pkgname
10673: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
10674: </pre>
10675:
10676: <p>Remember to move the directory from which you imported
10677: out of the way, or cvs will complain the next time you
10678: “<span class="quote">cvs update</span>” your
10679: source tree. Also don't forget to add the new package to
1.14 xtraeme 10680: the category's <code class=
10681: "filename">Makefile</code>.</p>
1.1 grant 10682:
10683: <p>The commit message of the initial import should
1.14 xtraeme 10684: include part of the <code class="filename">DESCR</code>
10685: file, so people reading the mailing lists know what the
10686: package is/does.</p>
1.1 grant 10687:
10688: <p>Please note all package updates/additions in
1.14 xtraeme 10689: <code class="filename">pkgsrc/doc/CHANGES</code>. It's
10690: very important to keep this file up to date and
10691: conforming to the existing format, because it will be
10692: used by scripts to automatically update pages on <a href=
1.1 grant 10693: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
10694: and other sites. Additionally, check the pkgsrc/doc/TODO
10695: file and remove the entry for the package you updated, in
10696: case it was mentioned there.</p>
10697:
10698: <p>For new packages, “<span class="quote">cvs
10699: import</span>” is preferred to “<span class=
10700: "quote">cvs add</span>” because the former gets
10701: everything with a single command, and provides a
10702: consistent tag.</p>
10703: </div>
10704:
10705: <div class="sect1" lang="en" xml:lang="en">
10706: <div class="titlepage">
10707: <div>
10708: <div>
10709: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 10710: "id2589020" id="id2589020"></a>14.3. Updating
1.2 hubertf 10711: a package to a newer version</h2>
1.1 grant 10712: </div>
10713: </div>
10714: </div>
10715:
10716: <p>Please always put a concise, appropriate and relevant
10717: summary of the changes between old and new versions into
10718: the commit log when updating a package. There are various
10719: reasons for this:</p>
10720:
10721: <div class="itemizedlist">
10722: <ul type="disc">
10723: <li>
10724: <p>A URL is volatile, and can change over time. It
10725: may go away completely or its information may be
10726: overwritten by newer information.</p>
10727: </li>
10728:
10729: <li>
10730: <p>Having the change information between old and
10731: new versions in our CVS repository is very useful
10732: for people who use either cvs or anoncvs.</p>
10733: </li>
10734:
10735: <li>
10736: <p>Having the change information between old and
10737: new versions in our CVS repository is very useful
10738: for people who read the pkgsrc-changes mailing
10739: list, so that they can make tactical decisions
10740: about when to upgrade the package.</p>
10741: </li>
10742: </ul>
10743: </div>
10744:
1.18 xtraeme 10745: <p>Please also recognize that, just because a new version
1.1 grant 10746: of a package has been released, it should not
10747: automatically be upgraded in the CVS repository. We
10748: prefer to be conservative in the packages that are
10749: included in pkgsrc - development or beta packages are not
10750: really the best thing for most places in which pkgsrc is
10751: used. Please use your judgement about what should go into
10752: pkgsrc, and bear in mind that stability is to be
10753: preferred above new and possibly untested features.</p>
10754: </div>
10755:
10756: <div class="sect1" lang="en" xml:lang="en">
10757: <div class="titlepage">
10758: <div>
10759: <div>
10760: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 10761: "id2589040" id="id2589040"></a>14.4. Moving a
1.2 hubertf 10762: package in pkgsrc</h2>
1.1 grant 10763: </div>
10764: </div>
10765: </div>
10766:
10767: <div class="orderedlist">
10768: <ol type="1">
10769: <li>
10770: <p>Make a copy of the directory somewhere else.</p>
10771: </li>
10772:
10773: <li>
10774: <p>Remove all CVS dirs.</p>
10775:
10776: <p>Alternatively to the first two steps you can
10777: also do:</p>
10778: <pre class="screen">
1.14 xtraeme 10779: <code class="prompt">%</code> <strong class=
10780: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 10781: </pre>
10782:
10783: <p>and use that for further work.</p>
10784: </li>
10785:
10786: <li>
1.14 xtraeme 10787: <p>Fix <code class="varname">CATEGORIES</code> and
10788: any <code class="varname">DEPENDS</code> paths that
10789: just did “<span class=
1.1 grant 10790: "quote">../package</span>” instead of
10791: “<span class=
10792: "quote">../../category/package</span>”.</p>
10793: </li>
10794:
10795: <li>
1.14 xtraeme 10796: <p><span><strong class="command">cvs
10797: import</strong></span> the modified package in the
10798: new place.</p>
1.1 grant 10799: </li>
10800:
10801: <li>
10802: <p>Check if any package depends on it:</p>
10803: <pre class="screen">
1.14 xtraeme 10804: <code class="prompt">%</code> <strong class=
10805: "userinput"><code>cd /usr/pkgsrc</code></strong>
10806: <code class="prompt">%</code> <strong class=
10807: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 10808: </pre>
10809: </li>
10810:
10811: <li>
10812: <p>Fix paths in packages from step 5 to point to
10813: new location.</p>
10814: </li>
10815:
10816: <li>
1.14 xtraeme 10817: <p><span><strong class="command">cvs rm
10818: (-f)</strong></span> the package at the old
10819: location.</p>
1.1 grant 10820: </li>
10821:
10822: <li>
1.14 xtraeme 10823: <p>Remove from <code class=
10824: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 10825: </li>
10826:
10827: <li>
1.14 xtraeme 10828: <p>Add to <code class=
10829: "filename">newcategory/Makefile</code>.</p>
1.1 grant 10830: </li>
10831:
10832: <li>
10833: <p>Commit the changed and removed files:</p>
10834: <pre class="screen">
1.14 xtraeme 10835: <code class="prompt">%</code> <strong class=
10836: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 10837: </pre>
10838:
10839: <p>(and any packages from step 5, of course).</p>
10840: </li>
10841: </ol>
10842: </div>
10843: </div>
10844: </div>
10845: </div>
10846:
10847: <div class="appendix" lang="en" xml:lang="en">
10848: <div class="titlepage">
10849: <div>
10850: <div>
10851: <h2 class="title"><a name="examples" id=
10852: "examples"></a>Appendix A. A simple example
10853: package: bison</h2>
10854: </div>
10855: </div>
10856: </div>
10857:
10858: <div class="toc">
10859: <p><b>Table of Contents</b></p>
10860:
10861: <dl>
1.22 ! tv 10862: <dt><span class="sect1"><a href="#id2589266">A.1.
1.1 grant 10863: files</a></span></dt>
10864:
10865: <dd>
10866: <dl>
1.22 ! tv 10867: <dt><span class="sect2"><a href="#id2589269">A.1.1.
1.1 grant 10868: Makefile</a></span></dt>
10869:
1.22 ! tv 10870: <dt><span class="sect2"><a href="#id2589276">A.1.2.
1.1 grant 10871: DESCR</a></span></dt>
10872:
1.22 ! tv 10873: <dt><span class="sect2"><a href="#id2589291">A.1.3.
1.1 grant 10874: PLIST</a></span></dt>
10875:
1.22 ! tv 10876: <dt><span class="sect2"><a href="#id2589299">A.1.4.
1.14 xtraeme 10877: Checking a package with <span><strong class=
10878: "command">pkglint</strong></span></a></span></dt>
1.1 grant 10879: </dl>
10880: </dd>
10881:
1.22 ! tv 10882: <dt><span class="sect1"><a href="#id2589339">A.2. Steps
1.1 grant 10883: for building, installing, packaging</a></span></dt>
10884: </dl>
10885: </div>
10886:
10887: <p>We checked to find a piece of software that wasn't in the
10888: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 10889: would want to have <span><strong class=
10890: "command">bison</strong></span> when Berkeley
10891: <span><strong class="command">yacc</strong></span> is already
10892: present in the tree is beyond us, but it's useful for the
10893: purposes of this exercise.</p>
1.1 grant 10894:
10895: <div class="sect1" lang="en" xml:lang="en">
10896: <div class="titlepage">
10897: <div>
10898: <div>
10899: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 10900: "id2589266" id="id2589266"></a>A.1. files</h2>
1.1 grant 10901: </div>
10902: </div>
10903: </div>
10904:
10905: <div class="sect2" lang="en" xml:lang="en">
10906: <div class="titlepage">
10907: <div>
10908: <div>
1.22 ! tv 10909: <h3 class="title"><a name="id2589269" id=
! 10910: "id2589269"></a>A.1.1. Makefile</h3>
1.1 grant 10911: </div>
10912: </div>
10913: </div>
10914: <pre class="programlisting">
1.17 sketch 10915: # $NetBSD$
1.1 grant 10916: #
10917:
10918: DISTNAME= bison-1.25
10919: CATEGORIES= devel
10920: MASTER_SITES= ${MASTER_SITE_GNU}
10921:
10922: MAINTAINER= thorpej@NetBSD.org
10923: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
10924: COMMENT= GNU yacc clone
10925:
10926: GNU_CONFIGURE= yes
10927: INFO_FILES= bison.info
10928:
10929: .include "../../mk/bsd.pkg.mk"
10930: </pre>
10931: </div>
10932:
10933: <div class="sect2" lang="en" xml:lang="en">
10934: <div class="titlepage">
10935: <div>
10936: <div>
1.22 ! tv 10937: <h3 class="title"><a name="id2589276" id=
! 10938: "id2589276"></a>A.1.2. DESCR</h3>
1.1 grant 10939: </div>
10940: </div>
10941: </div>
10942: <pre class="programlisting">
10943: GNU version of yacc. Can make re-entrant parsers, and numerous other
10944: improvements. Why you would want this when Berkeley <a href=
10945: "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
10946: of the NetBSD source tree is beyond me.
10947: </pre>
10948: </div>
10949:
10950: <div class="sect2" lang="en" xml:lang="en">
10951: <div class="titlepage">
10952: <div>
10953: <div>
1.22 ! tv 10954: <h3 class="title"><a name="id2589291" id=
! 10955: "id2589291"></a>A.1.3. PLIST</h3>
1.1 grant 10956: </div>
10957: </div>
10958: </div>
10959: <pre class="programlisting">
1.17 sketch 10960: @comment $NetBSD$
1.1 grant 10961: bin/bison
10962: man/man1/bison.1.gz
10963: share/bison.simple
10964: share/bison.hairy
10965: </pre>
10966: </div>
10967:
10968: <div class="sect2" lang="en" xml:lang="en">
10969: <div class="titlepage">
10970: <div>
10971: <div>
1.22 ! tv 10972: <h3 class="title"><a name="id2589299" id=
! 10973: "id2589299"></a>A.1.4. Checking a package with
1.14 xtraeme 10974: <span><strong class=
10975: "command">pkglint</strong></span></h3>
1.1 grant 10976: </div>
10977: </div>
10978: </div>
10979:
10980: <p>The NetBSD package system comes with <a xmlns=
10981: "http://www.w3.org/TR/xhtml1/transitional" href=
10982: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 10983: class="pkgname">pkgtools/pkglint</a> which helps to check
10984: the contents of these files. After installation it is
10985: quite easy to use, just change to the directory of the
10986: package you wish to examine and execute
10987: <span><strong class=
10988: "command">pkglint</strong></span>:</p>
1.1 grant 10989: <pre class="screen">
1.14 xtraeme 10990: <code class="prompt">$</code> <strong class=
10991: "userinput"><code>pkglint</code></strong>
1.1 grant 10992: OK: checking ./DESCR.
10993: OK: checking Makefile.
10994: OK: checking distinfo.
10995: OK: checking patches/patch-aa.
10996: looks fine.
10997: </pre>
10998:
10999: <p>Depending on the supplied command line arguments (see
11000: pkglint(1)) more verbose checks will be performed. Use
1.14 xtraeme 11001: e.g. <span><strong class="command">pkglint
11002: -v</strong></span> for a very verbose check.</p>
1.1 grant 11003: </div>
11004: </div>
11005:
11006: <div class="sect1" lang="en" xml:lang="en">
11007: <div class="titlepage">
11008: <div>
11009: <div>
11010: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 11011: "id2589339" id="id2589339"></a>A.2. Steps for
1.1 grant 11012: building, installing, packaging</h2>
11013: </div>
11014: </div>
11015: </div>
11016:
11017: <p>Create the directory where the package lives, plus any
11018: auxiliary directories:</p>
11019: <pre class="screen">
1.14 xtraeme 11020: <code class="prompt">#</code> <strong class=
11021: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
11022: <code class="prompt">#</code> <strong class=
11023: "userinput"><code>mkdir bison</code></strong>
11024: <code class="prompt">#</code> <strong class=
11025: "userinput"><code>cd bison</code></strong>
11026: <code class="prompt">#</code> <strong class=
11027: "userinput"><code>mkdir patches</code></strong>
1.1 grant 11028: </pre>
11029:
1.14 xtraeme 11030: <p>Create <code class="filename">Makefile</code>,
11031: <code class="filename">DESCR</code> and <code class=
11032: "filename">PLIST</code> (see <a href="#components" title=
1.1 grant 11033: "Chapter 7. Package components - files, directories and contents">
11034: Chapter 7, <i>Package components - files, directories and
11035: contents</i></a>) then continue with fetching the
11036: distfile:</p>
11037: <pre class="screen">
1.14 xtraeme 11038: <code class="prompt">#</code> <strong class=
11039: "userinput"><code>make fetch</code></strong>
1.1 grant 11040: >> bison-1.25.tar.gz doesn't seem to exist on this system.
11041: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
11042: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
11043: ftp: Error retrieving file: 500 Internal error
11044:
11045: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
11046: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
11047: ftp: Error retrieving file: 500 Internal error
11048:
11049: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
11050: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
11051: Successfully retrieved file.
11052: </pre>
11053:
1.14 xtraeme 11054: <p>Generate the checksum of the distfile into <code class=
11055: "filename">distinfo</code>:</p>
1.1 grant 11056: <pre class="screen">
1.14 xtraeme 11057: <code class="prompt">#</code> <strong class=
11058: "userinput"><code>make makesum</code></strong>
1.1 grant 11059: </pre>
11060:
11061: <p>Now compile:</p>
11062: <pre class="screen">
1.14 xtraeme 11063: <code class="prompt">#</code> <strong class=
11064: "userinput"><code>make</code></strong>
1.1 grant 11065: >> Checksum OK for bison-1.25.tar.gz.
11066: ===> Extracting for bison-1.25
11067: ===> Patching for bison-1.25
11068: ===> Ignoring empty patch directory
11069: ===> Configuring for bison-1.25
11070: creating cache ./config.cache
11071: checking for gcc... cc
11072: checking whether we are using GNU C... yes
11073: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
11074: checking how to run the C preprocessor... cc -E
11075: checking for minix/config.h... no
11076: checking for POSIXized ISC... no
11077: checking whether cross-compiling... no
11078: checking for ANSI C header files... yes
11079: checking for string.h... yes
11080: checking for stdlib.h... yes
11081: checking for memory.h... yes
11082: checking for working const... yes
11083: checking for working alloca.h... no
11084: checking for alloca... yes
11085: checking for strerror... yes
11086: updating cache ./config.cache
11087: creating ./config.status
11088: creating Makefile
11089: ===> Building for bison-1.25
11090: 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
11091: 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
11092: 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
11093: 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
11094: 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
11095: 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
11096: 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
11097: 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
11098: 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
11099: 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
11100: 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
11101: 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
11102: 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
11103: 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
11104: 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
11105: 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
11106: 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
11107: 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
11108: 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
11109: 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
11110: 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
11111: 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
11112: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
11113: rm -f bison.s1
11114: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
11115: </pre>
11116:
11117: <p>Everything seems OK, so install the files:</p>
11118: <pre class="screen">
1.14 xtraeme 11119: <code class="prompt">#</code> <strong class=
11120: "userinput"><code>make install</code></strong>
1.1 grant 11121: >> Checksum OK for bison-1.25.tar.gz.
11122: ===> Installing for bison-1.25
11123: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
11124: rm -f /usr/pkg/bin/bison
11125: cd /usr/pkg/share; rm -f bison.simple bison.hairy
11126: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
11127: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
11128: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
11129: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
11130: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
11131: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
11132: ===> Registering installation for bison-1.25
11133: </pre>
11134:
11135: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 11136: remove it with <span><strong class="command">pkg_delete
11137: bison</strong></span>. Should you decide that you want a
11138: binary package, do this now:</p>
1.1 grant 11139: <pre class="screen">
1.14 xtraeme 11140: <code class="prompt">#</code> <strong class=
11141: "userinput"><code>make package</code></strong>
1.1 grant 11142: >> Checksum OK for bison-1.25.tar.gz.
11143: ===> Building package for bison-1.25
11144: Creating package bison-1.25.tgz
11145: Registering depends:.
11146: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
11147: </pre>
11148:
11149: <p>Now that you don't need the source and object files any
11150: more, clean up:</p>
11151: <pre class="screen">
1.14 xtraeme 11152: <code class="prompt">#</code> <strong class=
11153: "userinput"><code>make clean</code></strong>
1.1 grant 11154: ===> Cleaning for bison-1.25
11155: </pre>
11156: </div>
11157: </div>
11158:
11159: <div class="appendix" lang="en" xml:lang="en">
11160: <div class="titlepage">
11161: <div>
11162: <div>
11163: <h2 class="title"><a name="logs" id=
11164: "logs"></a>Appendix B. Build logs</h2>
11165: </div>
11166: </div>
11167: </div>
11168:
11169: <div class="toc">
11170: <p><b>Table of Contents</b></p>
11171:
11172: <dl>
11173: <dt><span class="sect1"><a href="#logs.building">B.1.
11174: Building figlet</a></span></dt>
11175:
11176: <dt><span class="sect1"><a href="#logs.package">B.2.
11177: Packaging figlet</a></span></dt>
11178: </dl>
11179: </div>
11180:
11181: <div class="sect1" lang="en" xml:lang="en">
11182: <div class="titlepage">
11183: <div>
11184: <div>
11185: <h2 class="title" style="clear: both"><a name=
11186: "logs.building" id=
11187: "logs.building"></a>B.1. Building figlet</h2>
11188: </div>
11189: </div>
11190: </div>
11191: <pre class="screen">
1.14 xtraeme 11192: <code class="prompt">#</code> <strong class=
11193: "userinput"><code>make</code></strong>
1.1 grant 11194: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11195: => figlet221.tar.gz doesn't seem to exist on this system.
11196: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
11197: => [172219 bytes]
11198: Connected to ftp.plig.net.
11199: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
11200: 331 Guest login ok, send your complete e-mail address as password.
11201: 230-You are user #5 of 500 simultaneous users allowed.
11202: 230-
11203: 230- ___ _ _ _
11204: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
11205: 230- | _| _| . |_| . | | | . |_| . | _| . |
11206: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
11207: 230- |_| |_| |___| |___|
11208: 230-
11209: 230-** Welcome to ftp.plig.org **
11210: 230-
11211: 230-Please note that all transfers from this FTP site are logged. If you
11212: 230-do not like this, please disconnect now.
11213: 230-
11214: 230-This arhive is available via
11215: 230-
11216: 230-HTTP: http://ftp.plig.org/
11217: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
11218: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
11219: 230-
11220: 230-Please email comments, bug reports and requests for packages to be
11221: 230-mirrored to ftp-admin@plig.org.
11222: 230-
11223: 230-
11224: 230 Logged in anonymously.
11225: Remote system type is UNIX.
11226: Using binary mode to transfer files.
11227: 200 Type okay.
11228: 250 "/pub" is new cwd.
11229: 250-"/pub/figlet" is new cwd.
11230: 250-
11231: 250-Welcome to the figlet archive at ftp.figlet.org
11232: 250-
11233: 250- ftp://ftp.figlet.org/pub/figlet/
11234: 250-
11235: 250-The official FIGlet web page is:
11236: 250- http://www.figlet.org/
11237: 250-
11238: 250-If you have questions, please mailto:info@figlet.org. If you want to
11239: 250-contribute a font or something else, you can email us.
11240: 250
11241: 250 "/pub/figlet/program" is new cwd.
11242: 250 "/pub/figlet/program/unix" is new cwd.
11243: local: figlet221.tar.gz remote: figlet221.tar.gz
11244: 502 Unimplemented command.
11245: 227 Entering Passive Mode (195,40,6,41,246,104)
11246: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
11247: 38% |************** | 65800 64.16 KB/s 00:01 ETA
11248: 226 Transfer completed.
11249: 172219 bytes received in 00:02 (75.99 KB/s)
11250: 221 Goodbye.
11251: => Checksum OK for figlet221.tar.gz.
11252: ===> Extracting for figlet-2.2.1nb2
11253: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
11254: ===> Patching for figlet-2.2.1nb2
11255: ===> Applying pkgsrc patches for figlet-2.2.1nb2
11256: ===> Overriding tools for figlet-2.2.1nb2
11257: ===> Creating toolchain wrappers for figlet-2.2.1nb2
11258: ===> Configuring for figlet-2.2.1nb2
11259: ===> Building for figlet-2.2.1nb2
11260: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
11261: chmod a+x figlet
11262: gcc -O2 -o chkfont chkfont.c
11263: => Unwrapping files-to-be-installed.
1.14 xtraeme 11264: <code class="prompt">#</code>
11265: <code class="prompt">#</code> <strong class=
11266: "userinput"><code>make install</code></strong>
1.1 grant 11267: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11268: ===> Installing for figlet-2.2.1nb2
11269: install -d -o root -g wheel -m 755 /usr/pkg/bin
11270: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
11271: mkdir -p /usr/pkg/share/figlet
11272: cp figlet /usr/pkg/bin
11273: cp chkfont /usr/pkg/bin
11274: chmod 555 figlist showfigfonts
11275: cp figlist /usr/pkg/bin
11276: cp showfigfonts /usr/pkg/bin
11277: cp fonts/*.flf /usr/pkg/share/figlet
11278: cp fonts/*.flc /usr/pkg/share/figlet
11279: cp figlet.6 /usr/pkg/man/man6
11280: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 11281: <code class="prompt">#</code>
1.1 grant 11282: </pre>
11283: </div>
11284:
11285: <div class="sect1" lang="en" xml:lang="en">
11286: <div class="titlepage">
11287: <div>
11288: <div>
11289: <h2 class="title" style="clear: both"><a name=
11290: "logs.package" id=
11291: "logs.package"></a>B.2. Packaging figlet</h2>
11292: </div>
11293: </div>
11294: </div>
11295: <pre class="screen">
1.14 xtraeme 11296: <code class="prompt">#</code> <strong class=
11297: "userinput"><code>make package</code></strong>
1.1 grant 11298: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11299: ===> Packaging figlet-2.2.1nb2
11300: ===> Building binary package for figlet-2.2.1nb2
11301: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
11302: Using SrcDir value of /usr/pkg
11303: Registering depends:.
1.14 xtraeme 11304: <code class="prompt">#</code>
1.1 grant 11305: </pre>
11306: </div>
11307: </div>
11308:
11309: <div class="appendix" lang="en" xml:lang="en">
11310: <div class="titlepage">
11311: <div>
11312: <div>
11313: <h2 class="title"><a name="ftp-layout" id=
11314: "ftp-layout"></a>Appendix C. Layout of the
11315: FTP server's package archive</h2>
11316: </div>
11317: </div>
11318: </div>
11319:
11320: <p>Layout for precompiled binary packages on
11321: ftp.NetBSD.org:</p>
11322: <pre class="programlisting">
11323: /pub/NetBSD/packages/
11324: distfiles/
11325:
11326: # Unpacked pkgsrc trees
11327: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
11328: pkgsrc-2003Q4 -> N/A
11329: pkgsrc-2004Q1/pkgsrc
11330:
11331: # pkgsrc archives
11332: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
11333: pkgsrc-2003Q4.tar.gz -> N/A
11334: pkgsrc-2004Q1.tar.gz -> N/A
11335:
11336: # Per pkgsrc-release/OS-release/arch package archives
11337: pkgsrc-2003Q4/
11338: NetBSD-1.6.2/
11339: i386/
11340: All/
11341: archivers/
11342: foo -> ../All/foo
11343: ...
11344: pkgsrc-2004Q1/
11345: NetBSD-1.6.2/
11346: i386/
11347: All/
11348: ...
11349: NetBSD-2.0/
11350: i386/
11351: All/
11352: ...
11353: SunOS-5.9/
11354: sparc/
11355: All/
11356: ...
11357: x86/
11358: All/
11359: ...
11360:
11361: # Per os-release package archive convenience links
11362: NetBSD-1.6.2 -> 1.6.2
11363: 1.6.2/
11364: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
11365: m68k/
11366: All/
11367: archivers/
11368: foo -> ../All/foo
11369: ...
11370: amiga -> m68k
11371: atari -> m68k
11372: ...
11373:
11374: 2.0 -> NetBSD-2.0 # backward compat, historic
11375: NetBSD-2.0/
11376: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
11377: SunOS-5.9/
11378: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
11379: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
11380:
11381: </pre>
11382:
11383: <p>To create:</p>
11384:
11385: <div class="orderedlist">
11386: <ol type="1">
11387: <li>
11388: <p>Run bulk build, see <a href="#bulkbuild" title=
11389: "5.3. Doing a bulk build of all packages">Section
11390: 5.3, “Doing a bulk build of all
11391: packages”</a></p>
11392: </li>
11393:
11394: <li>
11395: <p>Upload /usr/pkgsrc/packages to</p>
11396: <pre class="programlisting">
11397: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13 hubertf 11398: pkgsrc-2004Q4/\ # pkgsrc-branch
1.1 grant 11399: `uname -s`-`uname -r`/ # OS & version
11400: `uname -p` # architecture
11401:
11402: </pre>
11403: </li>
11404:
11405: <li>
1.14 xtraeme 11406: <p>If necessary, create a symlink <span><strong class=
11407: "command">ln -s `uname -m` `uname -p`</strong></span>
11408: (amiga -> m68k, ...)</p>
1.1 grant 11409: </li>
11410: </ol>
11411: </div>
11412: </div>
1.2 hubertf 11413:
11414: <div class="appendix" lang="en" xml:lang="en">
11415: <div class="titlepage">
11416: <div>
11417: <div>
11418: <h2 class="title"><a name="editing" id=
11419: "editing"></a>Appendix D. Editing guidelines
11420: for the pkgsrc guide</h2>
11421: </div>
11422: </div>
11423: </div>
11424:
11425: <div class="toc">
11426: <p><b>Table of Contents</b></p>
11427:
11428: <dl>
1.22 ! tv 11429: <dt><span class="sect1"><a href="#id2590054">D.1.
1.2 hubertf 11430: Targets</a></span></dt>
11431:
1.22 ! tv 11432: <dt><span class="sect1"><a href="#id2590124">D.2.
1.2 hubertf 11433: Procedure</a></span></dt>
11434: </dl>
11435: </div>
11436:
11437: <p>This section contains information on editing the pkgsrc
11438: guide itself.</p>
11439:
11440: <div class="sect1" lang="en" xml:lang="en">
11441: <div class="titlepage">
11442: <div>
11443: <div>
11444: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 11445: "id2590054" id="id2590054"></a>D.1. Targets</h2>
1.2 hubertf 11446: </div>
11447: </div>
11448: </div>
11449:
1.14 xtraeme 11450: <p>The pkgsrc guide's source code is stored in <code class=
11451: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 11452: are created from it:</p>
11453:
11454: <div class="itemizedlist">
11455: <ul type="disc">
11456: <li>
1.14 xtraeme 11457: <p><code class=
11458: "filename">pkgsrc/doc/pkgsrc.txt</code>, which
11459: replaces <code class=
11460: "filename">pkgsrc/Packages.txt</code></p>
1.2 hubertf 11461: </li>
11462:
11463: <li>
1.14 xtraeme 11464: <p><code class=
11465: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 11466: </li>
11467:
11468: <li>
1.14 xtraeme 11469: <p><code class=
11470: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 11471: the documentation on the NetBSD website will be built
11472: from pkgsrc and kept up to date on the web server
11473: itself. This means you <span class=
11474: "emphasis"><em>must</em></span> make sure that your
11475: changes haven't broken the build!</p>
11476: </li>
1.6 hubertf 11477:
11478: <li>
1.14 xtraeme 11479: <p><code class=
11480: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 11481: PDF version of the pkgsrc guide.</p>
11482: </li>
11483:
11484: <li>
1.14 xtraeme 11485: <p><code class=
11486: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 11487: PostScript version of the pkgsrc guide.</p>
11488: </li>
1.2 hubertf 11489: </ul>
11490: </div>
11491: </div>
11492:
11493: <div class="sect1" lang="en" xml:lang="en">
11494: <div class="titlepage">
11495: <div>
11496: <div>
11497: <h2 class="title" style="clear: both"><a name=
1.22 ! tv 11498: "id2590124" id=
! 11499: "id2590124"></a>D.2. Procedure</h2>
1.2 hubertf 11500: </div>
11501: </div>
11502: </div>
11503:
11504: <p>The procedure to edit the pkgsrc guide is:</p>
11505:
11506: <div class="itemizedlist">
11507: <ul type="disc">
11508: <li>
1.6 hubertf 11509: <p>Make sure you have the packages needed to
11510: re-generate the pkgsrc guide (and other XML-based
11511: NetBSD documentation) installed. These are
1.11 ben 11512: “<span class="quote">netbsd-doc</span>”
1.6 hubertf 11513: for creating the ASCII- and HTML-version, and
11514: “<span class=
1.11 ben 11515: "quote">netbsd-doc-print</span>”for the
1.6 hubertf 11516: PostScript- and PDF version. You will need both
11517: packages installed, to make sure documentation is
11518: consistent across all formats. The packages can be
1.14 xtraeme 11519: found in <code class=
11520: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
11521: <code class=
11522: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 11523: </li>
11524:
11525: <li>
1.14 xtraeme 11526: <p>Edit the XML file(s) in <code class=
11527: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 11528: </li>
11529:
11530: <li>
1.14 xtraeme 11531: <p>Run <span><strong class="command">make extract
11532: && make do-lint</strong></span> in
11533: <code class="filename">pkgsrc/doc/guide</code> to
11534: check the XML syntax, and fix it if needed.</p>
1.4 hubertf 11535: </li>
11536:
11537: <li>
1.14 xtraeme 11538: <p>Run <span><strong class=
11539: "command">make</strong></span> in <code class=
11540: "filename">pkgsrc/doc/guide</code> to build the HTML
11541: and ASCII version.</p>
1.2 hubertf 11542: </li>
11543:
11544: <li>
1.14 xtraeme 11545: <p>If all is well, run <span><strong class=
11546: "command">make install-doc</strong></span> to put the
11547: generated files into <code class=
11548: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 11549: </li>
11550:
11551: <li>
1.14 xtraeme 11552: <p><span><strong class="command">cvs commit
11553: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 11554: </li>
11555:
11556: <li>
1.14 xtraeme 11557: <p><span><strong class="command">cvs commit -m
11558: re-generate
11559: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 11560: </li>
1.4 hubertf 11561:
11562: <li>
11563: <p>Until the webserver on www.NetBSD.org is really
11564: updated automatically to pick up changes to the
1.14 xtraeme 11565: pkgsrc guide automatically, also run
1.18 xtraeme 11566: <span><strong class="command">make install-htdocs
1.14 xtraeme 11567: HTDOCSDIR=../../../htdocs</strong></span> (or
11568: similar, adjust <code class=
11569: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 11570: </li>
11571:
11572: <li>
1.14 xtraeme 11573: <p><span><strong class="command">cvs commit
11574: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 11575: </li>
1.2 hubertf 11576: </ul>
11577: </div>
11578: </div>
11579: </div>
1.1 grant 11580: </div>
11581: </body>
11582: </html>
CVSweb <webmaster@jp.NetBSD.org>