Annotation of pkgsrc/doc/pkgsrc.html, revision 1.17
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.14 xtraeme 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.14 xtraeme 11: "DocBook XSL Stylesheets V1.67.0" />
1.1 grant 12: <meta name="description" content=
13: "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
14: </head>
15:
16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
17: alink="#0000FF">
18: <div class="book" lang="en" xml:lang="en">
19: <div class="titlepage">
20: <div>
21: <div>
1.17 ! sketch 22: <h1 class="title"><a name="id2458244" id=
! 23: "id2458244"></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.17 ! sketch 96: <dt><span class="sect1"><a href="#id2514134">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.17 ! sketch 120: <dt><span class="sect1"><a href="#id2514720">2.1.
1.1 grant 121: As tar file</a></span></dt>
122:
1.17 ! sketch 123: <dt><span class="sect1"><a href="#id2514736">2.2.
1.1 grant 124: Via SUP</a></span></dt>
125:
1.17 ! sketch 126: <dt><span class="sect1"><a href="#id2514836">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.17 ! sketch 136: <dt><span class="sect1"><a href="#id2515014">3.1.
1.1 grant 137: Bootstrapping pkgsrc</a></span></dt>
138:
1.17 ! sketch 139: <dt><span class="sect1"><a href="#id2515127">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.17 ! sketch 145: "#id2515133">3.2.1. Darwin (Mac OS
1.1 grant 146: X)</a></span></dt>
147:
148: <dt><span class="sect2"><a href=
1.17 ! sketch 149: "#id2515432">3.2.2. FreeBSD</a></span></dt>
1.1 grant 150:
151: <dt><span class="sect2"><a href=
1.17 ! sketch 152: "#id2515876">3.2.3. Interix</a></span></dt>
1.1 grant 153:
154: <dt><span class="sect2"><a href=
1.17 ! sketch 155: "#id2515966">3.2.4. IRIX</a></span></dt>
1.1 grant 156:
157: <dt><span class="sect2"><a href=
1.17 ! sketch 158: "#id2516084">3.2.5. OpenBSD</a></span></dt>
1.1 grant 159:
160: <dt><span class="sect2"><a href=
1.17 ! sketch 161: "#id2516264">3.2.6. Solaris</a></span></dt>
1.1 grant 162: </dl>
163: </dd>
164: </dl>
165: </dd>
166:
167: <dt><span class="chapter"><a href="#using">4. Using
168: pkgsrc</a></span></dt>
169:
170: <dd>
171: <dl>
172: <dt><span class="sect1"><a href=
173: "#getting-started">4.1. Working with binary
174: packages</a></span></dt>
175:
176: <dd>
177: <dl>
178: <dt><span class="sect2"><a href=
1.17 ! sketch 179: "#id2516401">4.1.1. Where to get binary
1.1 grant 180: packages</a></span></dt>
181:
182: <dt><span class="sect2"><a href=
1.17 ! sketch 183: "#id2516441">4.1.2. How to use binary
1.1 grant 184: packages</a></span></dt>
185:
186: <dt><span class="sect2"><a href=
1.17 ! sketch 187: "#id2516576">4.1.3. A word of
1.1 grant 188: warning</a></span></dt>
189: </dl>
190: </dd>
191:
1.17 ! sketch 192: <dt><span class="sect1"><a href="#id2516587">4.2.
1.1 grant 193: Building packages from source</a></span></dt>
194:
195: <dd>
196: <dl>
197: <dt><span class="sect2"><a href=
1.17 ! sketch 198: "#id2516597">4.2.1.
1.1 grant 199: Requirements</a></span></dt>
200:
201: <dt><span class="sect2"><a href=
1.17 ! sketch 202: "#id2516617">4.2.2. Fetching
1.1 grant 203: distfiles</a></span></dt>
204:
205: <dt><span class="sect2"><a href=
1.17 ! sketch 206: "#id2516806">4.2.3. How to build and
1.1 grant 207: install</a></span></dt>
208:
209: <dt><span class="sect2"><a href=
1.17 ! sketch 210: "#id2517464">4.2.4. Selecting the
1.1 grant 211: compiler</a></span></dt>
212: </dl>
213: </dd>
214: </dl>
215: </dd>
216:
217: <dt><span class="chapter"><a href="#binary">5. Creating
218: binary packages</a></span></dt>
219:
220: <dd>
221: <dl>
1.17 ! sketch 222: <dt><span class="sect1"><a href="#id2582745">5.1.
1.1 grant 223: Building a single binary package</a></span></dt>
224:
1.17 ! sketch 225: <dt><span class="sect1"><a href="#id2582823">5.2.
1.1 grant 226: Settings for creation of binary
227: packages</a></span></dt>
228:
229: <dt><span class="sect1"><a href="#bulkbuild">5.3.
230: Doing a bulk build of all packages</a></span></dt>
231:
232: <dd>
233: <dl>
234: <dt><span class="sect2"><a href=
235: "#binary.configuration">5.3.1.
236: Configuration</a></span></dt>
237:
238: <dt><span class="sect2"><a href=
1.17 ! sketch 239: "#id2582963">5.3.2. Other environmental
1.1 grant 240: considerations</a></span></dt>
241:
242: <dt><span class="sect2"><a href=
1.17 ! sketch 243: "#id2583003">5.3.3. Operation</a></span></dt>
1.1 grant 244:
245: <dt><span class="sect2"><a href=
1.17 ! sketch 246: "#id2583141">5.3.4. What it
1.1 grant 247: does</a></span></dt>
248:
249: <dt><span class="sect2"><a href=
1.17 ! sketch 250: "#id2583266">5.3.5. Disk space
1.1 grant 251: requirements</a></span></dt>
252:
253: <dt><span class="sect2"><a href=
1.17 ! sketch 254: "#id2583292">5.3.6. Setting up a sandbox for
1.1 grant 255: chroot'ed builds</a></span></dt>
256:
257: <dt><span class="sect2"><a href=
1.17 ! sketch 258: "#id2583685">5.3.7. Building a partial set of
1.1 grant 259: packages</a></span></dt>
1.13 hubertf 260:
261: <dt><span class="sect2"><a href=
262: "#bulk-upload">5.3.8. Uploading results of a
263: bulk build</a></span></dt>
1.1 grant 264: </dl>
265: </dd>
266:
1.17 ! sketch 267: <dt><span class="sect1"><a href="#id2584190">5.4.
1.1 grant 268: Creating a multiple CD-ROM packages
269: collection</a></span></dt>
270:
271: <dd>
272: <dl>
273: <dt><span class="sect2"><a href=
1.17 ! sketch 274: "#id2584205">5.4.1. Example of
1.1 grant 275: cdpack</a></span></dt>
276: </dl>
277: </dd>
278: </dl>
279: </dd>
280:
281: <dt><span class="chapter"><a href="#faq">6. Frequently
282: Asked Questions</a></span></dt>
283:
284: <dd>
285: <dl>
1.17 ! sketch 286: <dt><span class="sect1"><a href="#id2584466">6.1.
1.1 grant 287: Is there a mailing list for pkg-related
288: discussion?</a></span></dt>
289:
1.17 ! sketch 290: <dt><span class="sect1"><a href="#id2584496">6.2.
1.1 grant 291: Where's the pkgviews documentation?</a></span></dt>
292:
1.5 hubertf 293: <dt><span class="sect1"><a href=
294: "#faq-pkgtools">6.3. Utilities for package
295: management (pkgtools)</a></span></dt>
1.1 grant 296:
1.17 ! sketch 297: <dt><span class="sect1"><a href="#id2584748">6.4.
1.1 grant 298: How to use pkgsrc as non-root</a></span></dt>
299:
1.17 ! sketch 300: <dt><span class="sect1"><a href="#id2584760">6.5.
1.15 xtraeme 301: How to resume transfers when fetching
302: distfiles?</a></span></dt>
1.14 xtraeme 303:
1.17 ! sketch 304: <dt><span class="sect1"><a href="#id2584803">6.6.
1.1 grant 305: How can I install/use XFree86 from
306: pkgsrc?</a></span></dt>
307:
1.17 ! sketch 308: <dt><span class="sect1"><a href="#id2584830">6.7.
1.1 grant 309: How can I install/use X.org from
310: pkgsrc?</a></span></dt>
311:
1.17 ! sketch 312: <dt><span class="sect1"><a href="#id2584858">6.8.
1.1 grant 313: How to fetch files from behind a
314: firewall</a></span></dt>
315:
1.17 ! sketch 316: <dt><span class="sect1"><a href="#id2584872">6.9.
1.14 xtraeme 317: How do I tell <span><strong class="command">make
318: fetch</strong></span> to do passive
1.1 grant 319: FTP?</a></span></dt>
320:
1.17 ! sketch 321: <dt><span class="sect1"><a href="#id2584923">6.10.
1.1 grant 322: How to fetch all distfiles at once</a></span></dt>
323:
1.17 ! sketch 324: <dt><span class="sect1"><a href="#id2585063">6.11.
1.14 xtraeme 325: What does “<span class="quote">Don't know how
326: to make /usr/share/tmac/tmac.andoc</span>”
327: mean?</a></span></dt>
1.13 hubertf 328:
1.17 ! sketch 329: <dt><span class="sect1"><a href="#id2585101">6.12.
1.14 xtraeme 330: What does “<span class="quote">Could not find
331: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 332:
1.17 ! sketch 333: <dt><span class="sect1"><a href="#id2585227">6.13.
1.1 grant 334: Using 'sudo' with pkgsrc</a></span></dt>
335:
1.14 xtraeme 336: <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1 grant 337: Configuration files handling and
338: placement</a></span></dt>
339:
340: <dt><span class="sect1"><a href=
1.14 xtraeme 341: "#audit-packages">6.15. Automated security
1.1 grant 342: checks</a></span></dt>
343: </dl>
344: </dd>
345: </dl>
346: </dd>
347:
1.2 hubertf 348: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 349: pkgsrc developer's guide</a></span></dt>
350:
351: <dd>
352: <dl>
353: <dt><span class="chapter"><a href="#components">7.
354: Package components - files, directories and
355: contents</a></span></dt>
356:
357: <dd>
358: <dl>
359: <dt><span class="sect1"><a href=
1.14 xtraeme 360: "#components.Makefile">7.1. <code class=
361: "filename">Makefile</code></a></span></dt>
1.1 grant 362:
363: <dt><span class="sect1"><a href=
1.14 xtraeme 364: "#components.distinfo">7.2. <code class=
365: "filename">distinfo</code></a></span></dt>
1.1 grant 366:
367: <dt><span class="sect1"><a href=
368: "#components.patches">7.3.
369: patches/*</a></span></dt>
370:
1.17 ! sketch 371: <dt><span class="sect1"><a href="#id2586341">7.4.
1.1 grant 372: Other mandatory files</a></span></dt>
373:
374: <dt><span class="sect1"><a href=
375: "#components.optional">7.5. Optional
376: files</a></span></dt>
377:
1.17 ! sketch 378: <dt><span class="sect1"><a href="#id2586535">7.6.
1.14 xtraeme 379: <code class="filename">work*</code></a></span></dt>
1.1 grant 380:
1.17 ! sketch 381: <dt><span class="sect1"><a href="#id2586622">7.7.
1.14 xtraeme 382: <code class=
383: "filename">files/*</code></a></span></dt>
1.1 grant 384: </dl>
385: </dd>
386:
387: <dt><span class="chapter"><a href="#plist">8. PLIST
388: issues</a></span></dt>
389:
390: <dd>
391: <dl>
1.17 ! sketch 392: <dt><span class="sect1"><a href="#id2586677">8.1.
1.1 grant 393: RCS ID</a></span></dt>
394:
1.17 ! sketch 395: <dt><span class="sect1"><a href="#id2586692">8.2.
1.14 xtraeme 396: Semi-automatic <code class="filename">PLIST</code>
397: generation</a></span></dt>
1.1 grant 398:
399: <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14 xtraeme 400: Tweaking output of <span><strong class=
401: "command">make
402: print-PLIST</strong></span></a></span></dt>
1.1 grant 403:
404: <dt><span class="sect1"><a href="#plist.misc">8.4.
405: Variable substitution in PLIST</a></span></dt>
406:
1.17 ! sketch 407: <dt><span class="sect1"><a href="#id2587081">8.5.
1.1 grant 408: Manpage-compression</a></span></dt>
409:
1.17 ! sketch 410: <dt><span class="sect1"><a href="#id2587123">8.6.
1.14 xtraeme 411: Changing PLIST source with <code class=
412: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 413:
1.17 ! sketch 414: <dt><span class="sect1"><a href="#id2587140">8.7.
1.1 grant 415: Platform specific and differing
416: PLISTs</a></span></dt>
417:
418: <dt><span class="sect1"><a href=
419: "#faq.common-dirs">8.8. Sharing directories between
420: packages</a></span></dt>
421: </dl>
422: </dd>
423:
424: <dt><span class="chapter"><a href="#buildlink">9.
425: Buildlink methodology</a></span></dt>
426:
427: <dd>
428: <dl>
1.17 ! sketch 429: <dt><span class="sect1"><a href="#id2587480">9.1.
1.1 grant 430: Converting packages to use
431: buildlink3</a></span></dt>
432:
1.17 ! sketch 433: <dt><span class="sect1"><a href="#id2587739">9.2.
1.14 xtraeme 434: Writing <code class="filename">buildlink3.mk</code>
435: files</a></span></dt>
1.1 grant 436:
437: <dd>
438: <dl>
439: <dt><span class="sect2"><a href=
1.17 ! sketch 440: "#id2587809">9.2.1. Anatomy of a buildlink3.mk
1.1 grant 441: file</a></span></dt>
442:
443: <dt><span class="sect2"><a href=
1.17 ! sketch 444: "#id2588249">9.2.2. Updating <code class=
1.14 xtraeme 445: "varname">BUILDLINK_DEPENDS.<em class=
446: "replaceable"><code>pkg</code></em></code> in
447: <code class="filename">buildlink3.mk</code>
1.1 grant 448: files</a></span></dt>
449: </dl>
450: </dd>
451:
1.17 ! sketch 452: <dt><span class="sect1"><a href="#id2588465">9.3.
1.14 xtraeme 453: Writing <code class="filename">builtin.mk</code>
454: files</a></span></dt>
1.1 grant 455:
456: <dd>
457: <dl>
458: <dt><span class="sect2"><a href=
1.17 ! sketch 459: "#id2588546">9.3.1. Anatomy of a <code class=
1.14 xtraeme 460: "filename">builtin.mk</code>
1.1 grant 461: file</a></span></dt>
462:
463: <dt><span class="sect2"><a href=
1.17 ! sketch 464: "#id2588773">9.3.2. Global preferences for
1.1 grant 465: native or pkgsrc software</a></span></dt>
466: </dl>
467: </dd>
468: </dl>
469: </dd>
470:
471: <dt><span class="chapter"><a href="#options">10.
472: Options handling</a></span></dt>
473:
474: <dd>
475: <dl>
1.17 ! sketch 476: <dt><span class="sect1"><a href="#id2588845">10.1.
1.1 grant 477: Global default options</a></span></dt>
478:
1.17 ! sketch 479: <dt><span class="sect1"><a href="#id2588860">10.2.
1.14 xtraeme 480: Converting packages to use <code class=
481: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 482: </dl>
483: </dd>
484:
485: <dt><span class="chapter"><a href="#build">11. The
486: build process</a></span></dt>
487:
488: <dd>
489: <dl>
490: <dt><span class="sect1"><a href=
491: "#build.prefix">11.1. Program
492: location</a></span></dt>
493:
1.17 ! sketch 494: <dt><span class="sect1"><a href="#id2589468">11.2.
1.1 grant 495: Main targets</a></span></dt>
496:
497: <dt><span class="sect1"><a href=
498: "#build.helpful-targets">11.3. Other helpful
499: targets</a></span></dt>
500: </dl>
501: </dd>
502:
503: <dt><span class="chapter"><a href="#fixes">12. Notes on
504: fixes for packages</a></span></dt>
505:
506: <dd>
507: <dl>
1.17 ! sketch 508: <dt><span class="sect1"><a href="#id2590937">12.1.
1.1 grant 509: General operation</a></span></dt>
510:
511: <dd>
512: <dl>
513: <dt><span class="sect2"><a href=
1.17 ! sketch 514: "#id2590940">12.1.1. How to pull in variables
1.1 grant 515: from /etc/mk.conf</a></span></dt>
516:
517: <dt><span class="sect2"><a href=
1.17 ! sketch 518: "#id2591092">12.1.2. Restricted
1.1 grant 519: packages</a></span></dt>
520:
521: <dt><span class="sect2"><a href=
522: "#dependencies">12.1.3. Handling
523: dependencies</a></span></dt>
524:
525: <dt><span class="sect2"><a href=
1.17 ! sketch 526: "#id2591607">12.1.4. Handling conflicts with
1.1 grant 527: other packages</a></span></dt>
528:
529: <dt><span class="sect2"><a href=
1.17 ! sketch 530: "#id2591657">12.1.5. Packages that cannot or
1.1 grant 531: should not be built</a></span></dt>
532:
533: <dt><span class="sect2"><a href=
1.17 ! sketch 534: "#id2591683">12.1.6. Packages which should not
1.1 grant 535: be deleted, once installed</a></span></dt>
536:
537: <dt><span class="sect2"><a href=
538: "#security-handling">12.1.7. Handling packages
539: with security problems</a></span></dt>
540:
541: <dt><span class="sect2"><a href=
1.17 ! sketch 542: "#id2591774">12.1.8. How to handle compiler
1.1 grant 543: bugs</a></span></dt>
544:
545: <dt><span class="sect2"><a href=
1.17 ! sketch 546: "#id2591797">12.1.9. How to handle incrementing
1.1 grant 547: versions when fixing an existing
548: package</a></span></dt>
549:
550: <dt><span class="sect2"><a href=
1.17 ! sketch 551: "#id2591914">12.1.10. Portability of
1.1 grant 552: packages</a></span></dt>
553: </dl>
554: </dd>
555:
1.17 ! sketch 556: <dt><span class="sect1"><a href="#id2591939">12.2.
1.1 grant 557: Possible downloading issues</a></span></dt>
558:
559: <dd>
560: <dl>
561: <dt><span class="sect2"><a href=
1.17 ! sketch 562: "#id2591942">12.2.1. Packages whose distfiles
1.1 grant 563: aren't available for plain
564: downloading</a></span></dt>
565:
566: <dt><span class="sect2"><a href=
1.17 ! sketch 567: "#id2592005">12.2.2. How to handle modified
1.1 grant 568: distfiles with the 'old' name</a></span></dt>
569: </dl>
570: </dd>
571:
1.17 ! sketch 572: <dt><span class="sect1"><a href="#id2592017">12.3.
1.1 grant 573: Configuration gotchas</a></span></dt>
574:
575: <dd>
576: <dl>
577: <dt><span class="sect2"><a href=
578: "#fixes.libtool">12.3.1. Shared libraries -
579: libtool</a></span></dt>
580:
581: <dt><span class="sect2"><a href=
1.17 ! sketch 582: "#id2592424">12.3.2. Using libtool on GNU
1.1 grant 583: packages that already support
584: libtool</a></span></dt>
585:
586: <dt><span class="sect2"><a href=
1.17 ! sketch 587: "#id2592577">12.3.3. GNU
1.1 grant 588: Autoconf/Automake</a></span></dt>
589: </dl>
590: </dd>
591:
1.17 ! sketch 592: <dt><span class="sect1"><a href="#id2592621">12.4.
1.1 grant 593: Building considerations</a></span></dt>
594:
595: <dd>
596: <dl>
597: <dt><span class="sect2"><a href=
1.17 ! sketch 598: "#id2592625">12.4.1. CPP
1.1 grant 599: defines</a></span></dt>
600: </dl>
601: </dd>
602:
1.17 ! sketch 603: <dt><span class="sect1"><a href="#id2592791">12.5.
1.1 grant 604: Package specific actions</a></span></dt>
605:
606: <dd>
607: <dl>
608: <dt><span class="sect2"><a href=
1.17 ! sketch 609: "#id2592794">12.5.1. Package configuration
1.1 grant 610: files</a></span></dt>
611:
612: <dt><span class="sect2"><a href=
1.17 ! sketch 613: "#id2592897">12.5.2. User
1.2 hubertf 614: interaction</a></span></dt>
1.1 grant 615:
616: <dt><span class="sect2"><a href=
1.17 ! sketch 617: "#id2593010">12.5.3. Handling
1.1 grant 618: licenses</a></span></dt>
619:
620: <dt><span class="sect2"><a href=
1.17 ! sketch 621: "#id2593093">12.5.4. Creating an account from a
1.1 grant 622: package</a></span></dt>
623:
624: <dt><span class="sect2"><a href=
1.17 ! sketch 625: "#id2593223">12.5.5. Installing score
1.1 grant 626: files</a></span></dt>
627:
628: <dt><span class="sect2"><a href=
1.17 ! sketch 629: "#id2593335">12.5.6. Packages providing login
1.1 grant 630: shells</a></span></dt>
631:
632: <dt><span class="sect2"><a href=
1.17 ! sketch 633: "#id2593393">12.5.7. Packages containing perl
1.1 grant 634: scripts</a></span></dt>
635:
636: <dt><span class="sect2"><a href=
1.17 ! sketch 637: "#id2593411">12.5.8. Packages with hardcoded
1.1 grant 638: paths to other interpreters</a></span></dt>
639:
640: <dt><span class="sect2"><a href=
1.17 ! sketch 641: "#id2593432">12.5.9. Packages installing perl
1.1 grant 642: modules</a></span></dt>
643:
644: <dt><span class="sect2"><a href=
645: "#faq.info-files">12.5.10. Packages installing
646: info files</a></span></dt>
647:
648: <dt><span class="sect2"><a href=
1.17 ! sketch 649: "#id2593652">12.5.11. Packages installing
1.1 grant 650: GConf2 data files</a></span></dt>
651:
652: <dt><span class="sect2"><a href=
1.17 ! sketch 653: "#id2593752">12.5.12. Packages installing
1.1 grant 654: scrollkeeper data files</a></span></dt>
655:
656: <dt><span class="sect2"><a href=
1.17 ! sketch 657: "#id2593803">12.5.13. Packages installing X11
1.1 grant 658: fonts</a></span></dt>
659:
660: <dt><span class="sect2"><a href=
1.17 ! sketch 661: "#id2593850">12.5.14. Packages installing GTK2
1.1 grant 662: modules</a></span></dt>
663:
664: <dt><span class="sect2"><a href=
1.17 ! sketch 665: "#id2593988">12.5.15. Packages installing SGML
1.1 grant 666: or XML data</a></span></dt>
667:
668: <dt><span class="sect2"><a href=
1.17 ! sketch 669: "#id2594108">12.5.16. Packages installing
1.1 grant 670: extensions to the MIME database</a></span></dt>
671:
672: <dt><span class="sect2"><a href=
1.17 ! sketch 673: "#id2594247">12.5.17. Packages using
1.1 grant 674: intltool</a></span></dt>
675: </dl>
676: </dd>
677:
1.17 ! sketch 678: <dt><span class="sect1"><a href="#id2594261">12.6.
1.1 grant 679: Feedback to the author</a></span></dt>
680: </dl>
681: </dd>
682:
683: <dt><span class="chapter"><a href="#debug">13.
684: Debugging</a></span></dt>
685:
686: <dt><span class="chapter"><a href="#submit">14.
687: Submitting and Committing</a></span></dt>
688:
689: <dd>
690: <dl>
1.17 ! sketch 691: <dt><span class="sect1"><a href="#id2594723">14.1.
1.1 grant 692: Submitting your packages</a></span></dt>
693:
1.17 ! sketch 694: <dt><span class="sect1"><a href="#id2594842">14.2.
1.1 grant 695: Committing: Importing a package into
696: CVS</a></span></dt>
697:
1.17 ! sketch 698: <dt><span class="sect1"><a href="#id2594905">14.3.
1.2 hubertf 699: Updating a package to a newer
700: version</a></span></dt>
1.1 grant 701:
1.17 ! sketch 702: <dt><span class="sect1"><a href="#id2594924">14.4.
1.2 hubertf 703: Moving a package in pkgsrc</a></span></dt>
1.1 grant 704: </dl>
705: </dd>
706: </dl>
707: </dd>
708:
709: <dt><span class="appendix"><a href="#examples">A. A simple
710: example package: bison</a></span></dt>
711:
712: <dd>
713: <dl>
1.17 ! sketch 714: <dt><span class="sect1"><a href="#id2595219">A.1.
1.1 grant 715: files</a></span></dt>
716:
717: <dd>
718: <dl>
1.17 ! sketch 719: <dt><span class="sect2"><a href="#id2595222">A.1.1.
1.1 grant 720: Makefile</a></span></dt>
721:
1.17 ! sketch 722: <dt><span class="sect2"><a href="#id2595229">A.1.2.
1.1 grant 723: DESCR</a></span></dt>
724:
1.17 ! sketch 725: <dt><span class="sect2"><a href="#id2595244">A.1.3.
1.1 grant 726: PLIST</a></span></dt>
727:
1.17 ! sketch 728: <dt><span class="sect2"><a href="#id2595252">A.1.4.
1.14 xtraeme 729: Checking a package with <span><strong class=
730: "command">pkglint</strong></span></a></span></dt>
1.1 grant 731: </dl>
732: </dd>
733:
1.17 ! sketch 734: <dt><span class="sect1"><a href="#id2595292">A.2. Steps
1.1 grant 735: for building, installing, packaging</a></span></dt>
736: </dl>
737: </dd>
738:
739: <dt><span class="appendix"><a href="#logs">B. Build
740: logs</a></span></dt>
741:
742: <dd>
743: <dl>
744: <dt><span class="sect1"><a href="#logs.building">B.1.
745: Building figlet</a></span></dt>
746:
747: <dt><span class="sect1"><a href="#logs.package">B.2.
748: Packaging figlet</a></span></dt>
749: </dl>
750: </dd>
751:
752: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
753: of the FTP server's package archive</a></span></dt>
1.2 hubertf 754:
755: <dt><span class="appendix"><a href="#editing">D. Editing
756: guidelines for the pkgsrc guide</a></span></dt>
757:
758: <dd>
759: <dl>
1.17 ! sketch 760: <dt><span class="sect1"><a href="#id2596075">D.1.
1.2 hubertf 761: Targets</a></span></dt>
762:
1.17 ! sketch 763: <dt><span class="sect1"><a href="#id2596282">D.2.
1.2 hubertf 764: Procedure</a></span></dt>
765: </dl>
766: </dd>
1.1 grant 767: </dl>
768: </div>
769:
770: <div class="chapter" lang="en" xml:lang="en">
771: <div class="titlepage">
772: <div>
773: <div>
774: <h2 class="title"><a name="introduction" id=
775: "introduction"></a>Chapter 1. Introduction</h2>
776: </div>
777: </div>
778: </div>
779:
780: <div class="toc">
781: <p><b>Table of Contents</b></p>
782:
783: <dl>
1.17 ! sketch 784: <dt><span class="sect1"><a href="#id2514134">1.1.
1.1 grant 785: Introduction</a></span></dt>
786:
787: <dt><span class="sect1"><a href="#overview">1.2.
788: Overview</a></span></dt>
789:
790: <dt><span class="sect1"><a href="#terminology">1.3.
791: Terminology</a></span></dt>
792:
793: <dt><span class="sect1"><a href="#typography">1.4.
794: Typography</a></span></dt>
795: </dl>
796: </div>
797:
798: <div class="sect1" lang="en" xml:lang="en">
799: <div class="titlepage">
800: <div>
801: <div>
802: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 803: "id2514134" id=
! 804: "id2514134"></a>1.1. Introduction</h2>
1.1 grant 805: </div>
806: </div>
807: </div>
808:
809: <p>There is a lot of software freely available for Unix
810: based systems, which usually runs on NetBSD and other
811: Unix-flavoured systems, too, sometimes with some
812: modifications. The NetBSD Packages Collection (pkgsrc)
813: incorporates any such changes necessary to make that
814: software run, and makes the installation (and
815: de-installation) of the software package easy by means of a
816: single command.</p>
817:
818: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 819: the <span><strong class="command">pkg_*</strong></span>
820: tools so that installation and de-installation, printing of
821: an inventory of all installed packages and retrieval of
822: one-line comments or more verbose descriptions are all
823: simple.</p>
1.1 grant 824:
825: <p>pkgsrc currently contains several thousand packages,
826: including:</p>
827:
828: <div class="itemizedlist">
829: <ul type="disc">
830: <li>
831: <p><a xmlns=
832: "http://www.w3.org/TR/xhtml1/transitional" href=
833: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.14 xtraeme 834: class="pkgname">www/apache</a> - The Apache web
835: server</p>
1.1 grant 836: </li>
837:
838: <li>
839: <p><a xmlns=
840: "http://www.w3.org/TR/xhtml1/transitional" href=
841: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.14 xtraeme 842: class="pkgname">www/mozilla</a> - The Mozilla web
843: browser</p>
1.1 grant 844: </li>
845:
846: <li>
847: <p><a xmlns=
848: "http://www.w3.org/TR/xhtml1/transitional" href=
849: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.14 xtraeme 850: class="pkgname">meta-pkgs/gnome</a> - The GNOME
851: Desktop Environment</p>
1.1 grant 852: </li>
853:
854: <li>
855: <p><a xmlns=
856: "http://www.w3.org/TR/xhtml1/transitional" href=
857: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.14 xtraeme 858: class="pkgname">meta-pkgs/kde3</a> - The K Desktop
859: Environment</p>
1.1 grant 860: </li>
861: </ul>
862: </div>
863:
864: <p>...just to name a few.</p>
865:
866: <p>pkgsrc has built-in support for handling varying
867: dependencies, such as pthreads and X11, and extended
868: features such as IPv6 support on a range of platforms.</p>
869:
870: <p>pkgsrc was derived from FreeBSD's ports system, and
871: initially developed for NetBSD only. Since then, pkgsrc has
872: grown a lot, and now supports the following platforms:</p>
873:
874: <div class="itemizedlist">
875: <ul type="disc">
876: <li>
877: <p><a href="http://developer.apple.com/darwin/"
878: target="_top">Darwin</a> (<a href=
879: "http://www.apple.com/macosx/" target="_top">Mac OS
880: X</a>)</p>
881: </li>
882:
883: <li>
1.3 hubertf 884: <p><a href="http://www.DragonFlyBSD.org/" target=
885: "_top">DragonFlyBSD</a></p>
886: </li>
887:
888: <li>
1.1 grant 889: <p><a href="http://www.FreeBSD.org/" target=
890: "_top">FreeBSD</a></p>
891: </li>
892:
893: <li>
1.3 hubertf 894: <p>Microsoft Windows, via <a href=
895: "http://www.microsoft.com/windows/sfu/" target=
896: "_top">Interix</a></p>
1.1 grant 897: </li>
898:
899: <li>
900: <p><a href="http://www.sgi.com/software/irix6.5/"
901: target="_top">IRIX</a></p>
902: </li>
903:
904: <li>
905: <p><a href="http://www.linux.org/" target=
906: "_top">Linux</a></p>
907: </li>
908:
909: <li>
910: <p><a href="http://www.NetBSD.org/" target=
911: "_top">NetBSD</a> (of course)</p>
912: </li>
913:
914: <li>
1.17 ! sketch 915: <p><a href="http://h30097.www3.hp.com/" target=
! 916: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
! 917: </li>
! 918:
! 919: <li>
1.1 grant 920: <p><a href="http://www.openbsd.org/" target=
921: "_top">OpenBSD</a></p>
922: </li>
923:
924: <li>
925: <p><a href="http://www.sun.com/solaris/" target=
926: "_top">Solaris</a></p>
927: </li>
928: </ul>
929: </div>
930: </div>
931:
932: <div class="sect1" lang="en" xml:lang="en">
933: <div class="titlepage">
934: <div>
935: <div>
936: <h2 class="title" style="clear: both"><a name=
937: "overview" id="overview"></a>1.2. Overview</h2>
938: </div>
939: </div>
940: </div>
941:
942: <p>This document is divided into two parts. The first,
943: <a href="#users-guide" title=
1.2 hubertf 944: "Part I. The pkgsrc user's guide">The pkgsrc
945: user's guide</a>, describes how one can use one of the
946: packages in the Package Collection, either by installing a
947: precompiled binary package, or by building one's own copy
948: using the NetBSD package system. The second part, <a href=
1.1 grant 949: "#developers-guide" title=
1.2 hubertf 950: "Part II. The pkgsrc developer's guide">The
951: pkgsrc developer's guide</a>, explains how to prepare a
952: package so it can be easily built by other NetBSD users
953: without knowing about the package's building details.</p>
1.1 grant 954:
955: <p>This document is available in various formats:</p>
956:
957: <div class="itemizedlist">
958: <ul type="disc">
959: <li>
960: <p><a href="index.html" target="_top">HTML</a></p>
961: </li>
962:
963: <li>
964: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
965: </li>
966:
967: <li>
968: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
969: </li>
970:
971: <li>
972: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
973: </li>
974: </ul>
975: </div>
976: </div>
977:
978: <div class="sect1" lang="en" xml:lang="en">
979: <div class="titlepage">
980: <div>
981: <div>
982: <h2 class="title" style="clear: both"><a name=
983: "terminology" id=
984: "terminology"></a>1.3. Terminology</h2>
985: </div>
986: </div>
987: </div>
988:
989: <p>There has been a lot of talk about “<span class=
990: "quote">ports</span>”, “<span class=
991: "quote">packages</span>”, etc. so far. Here is a
992: description of all the terminology used within this
993: document.</p>
994:
995: <div class="variablelist">
996: <dl>
997: <dt><span class="term">Package</span></dt>
998:
999: <dd>
1000: <p>A set of files and building instructions that
1001: describe what's necessary to build a certain piece of
1002: software using pkgsrc. Packages are traditionally
1.14 xtraeme 1003: stored under <code class=
1004: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1005: </dd>
1006:
1007: <dt><span class="term">The NetBSD package
1008: system</span></dt>
1009:
1010: <dd>
1011: <p>This is the former name of “<span class=
1012: "quote">pkgsrc</span>”. It is part of the
1013: NetBSD operating system and can be bootstrap to run
1014: on non-NetBSD operating systems as well. It handles
1015: building (compiling), installing, and removing of
1016: packages.</p>
1017: </dd>
1018:
1019: <dt><span class="term">Distfile</span></dt>
1020:
1021: <dd>
1022: <p>This term describes the file or files that are
1023: provided by the author of the piece of software to
1024: distribute his work. All the changes necessary to
1025: build on NetBSD are reflected in the corresponding
1026: package. Usually the distfile is in the form of a
1027: compressed tar-archive, but other types are possible,
1.14 xtraeme 1028: too. Distfiles are usually stored below <code class=
1029: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1030: </dd>
1031:
1032: <dt><span class="term">Port</span></dt>
1033:
1034: <dd>
1035: <p>This is the term used by FreeBSD and OpenBSD
1036: people for what we call a package. In NetBSD
1037: terminology, “<span class=
1038: "quote">port</span>” refers to a different
1039: architecture.</p>
1040: </dd>
1041:
1042: <dt><span class="term">Precompiled/binary
1043: package</span></dt>
1044:
1045: <dd>
1046: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1047: distfile and stuffed together in a single
1048: <code class="filename">.tgz</code> file so it can be
1049: installed on machines of the same machine
1050: architecture without the need to recompile. Packages
1051: are usually generated in <code class=
1052: "filename">/usr/pkgsrc/packages</code>; there is also
1053: an archive on <a href=
1.1 grant 1054: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1055: "_top">ftp.NetBSD.org</a>.</p>
1056:
1057: <p>Sometimes, this is referred to by the term
1058: “<span class="quote">package</span>” too,
1059: especially in the context of precompiled
1060: packages.</p>
1061: </dd>
1062:
1063: <dt><span class="term">Program</span></dt>
1064:
1065: <dd>
1066: <p>The piece of software to be installed which will
1067: be constructed from all the files in the Distfile by
1068: the actions defined in the corresponding package.</p>
1069: </dd>
1070: </dl>
1071: </div>
1072: </div>
1073:
1074: <div class="sect1" lang="en" xml:lang="en">
1075: <div class="titlepage">
1076: <div>
1077: <div>
1078: <h2 class="title" style="clear: both"><a name=
1079: "typography" id=
1080: "typography"></a>1.4. Typography</h2>
1081: </div>
1082: </div>
1083: </div>
1084:
1085: <p>When giving examples for commands, shell prompts are
1086: used to show if the command should/can be issued as root,
1087: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1088: privileges are sufficient. We use a <code class=
1089: "prompt">#</code> for root's shell prompt, and a
1090: <code class="prompt">$</code> for users' shell prompt,
1091: assuming they use the C-shell or tcsh.</p>
1.1 grant 1092: </div>
1093: </div>
1094:
1095: <div class="part" lang="en" xml:lang="en">
1096: <div class="titlepage">
1097: <div>
1098: <div>
1099: <h1 class="title"><a name="users-guide" id=
1.2 hubertf 1100: "users-guide"></a>The pkgsrc user's guide</h1>
1.1 grant 1101: </div>
1102: </div>
1103: </div>
1104:
1105: <div class="toc">
1106: <p><b>Table of Contents</b></p>
1107:
1108: <dl>
1109: <dt><span class="chapter"><a href="#getting">2. Where to
1110: get pkgsrc</a></span></dt>
1111:
1112: <dd>
1113: <dl>
1.17 ! sketch 1114: <dt><span class="sect1"><a href="#id2514720">2.1. As
1.1 grant 1115: tar file</a></span></dt>
1116:
1.17 ! sketch 1117: <dt><span class="sect1"><a href="#id2514736">2.2. Via
1.1 grant 1118: SUP</a></span></dt>
1119:
1.17 ! sketch 1120: <dt><span class="sect1"><a href="#id2514836">2.3. Via
1.1 grant 1121: CVS</a></span></dt>
1122: </dl>
1123: </dd>
1124:
1125: <dt><span class="chapter"><a href="#platforms">3. Using
1126: pkgsrc on systems other than NetBSD</a></span></dt>
1127:
1128: <dd>
1129: <dl>
1.17 ! sketch 1130: <dt><span class="sect1"><a href="#id2515014">3.1.
1.1 grant 1131: Bootstrapping pkgsrc</a></span></dt>
1132:
1.17 ! sketch 1133: <dt><span class="sect1"><a href="#id2515127">3.2.
1.1 grant 1134: Platform specific notes</a></span></dt>
1135:
1136: <dd>
1137: <dl>
1138: <dt><span class="sect2"><a href=
1.17 ! sketch 1139: "#id2515133">3.2.1. Darwin (Mac OS
1.1 grant 1140: X)</a></span></dt>
1141:
1142: <dt><span class="sect2"><a href=
1.17 ! sketch 1143: "#id2515432">3.2.2. FreeBSD</a></span></dt>
1.1 grant 1144:
1145: <dt><span class="sect2"><a href=
1.17 ! sketch 1146: "#id2515876">3.2.3. Interix</a></span></dt>
1.1 grant 1147:
1148: <dt><span class="sect2"><a href=
1.17 ! sketch 1149: "#id2515966">3.2.4. IRIX</a></span></dt>
1.1 grant 1150:
1151: <dt><span class="sect2"><a href=
1.17 ! sketch 1152: "#id2516084">3.2.5. OpenBSD</a></span></dt>
1.1 grant 1153:
1154: <dt><span class="sect2"><a href=
1.17 ! sketch 1155: "#id2516264">3.2.6. Solaris</a></span></dt>
1.1 grant 1156: </dl>
1157: </dd>
1158: </dl>
1159: </dd>
1160:
1161: <dt><span class="chapter"><a href="#using">4. Using
1162: pkgsrc</a></span></dt>
1163:
1164: <dd>
1165: <dl>
1166: <dt><span class="sect1"><a href=
1167: "#getting-started">4.1. Working with binary
1168: packages</a></span></dt>
1169:
1170: <dd>
1171: <dl>
1172: <dt><span class="sect2"><a href=
1.17 ! sketch 1173: "#id2516401">4.1.1. Where to get binary
1.1 grant 1174: packages</a></span></dt>
1175:
1176: <dt><span class="sect2"><a href=
1.17 ! sketch 1177: "#id2516441">4.1.2. How to use binary
1.1 grant 1178: packages</a></span></dt>
1179:
1180: <dt><span class="sect2"><a href=
1.17 ! sketch 1181: "#id2516576">4.1.3. A word of
1.1 grant 1182: warning</a></span></dt>
1183: </dl>
1184: </dd>
1185:
1.17 ! sketch 1186: <dt><span class="sect1"><a href="#id2516587">4.2.
1.1 grant 1187: Building packages from source</a></span></dt>
1188:
1189: <dd>
1190: <dl>
1191: <dt><span class="sect2"><a href=
1.17 ! sketch 1192: "#id2516597">4.2.1. Requirements</a></span></dt>
1.1 grant 1193:
1194: <dt><span class="sect2"><a href=
1.17 ! sketch 1195: "#id2516617">4.2.2. Fetching
1.1 grant 1196: distfiles</a></span></dt>
1197:
1198: <dt><span class="sect2"><a href=
1.17 ! sketch 1199: "#id2516806">4.2.3. How to build and
1.1 grant 1200: install</a></span></dt>
1201:
1202: <dt><span class="sect2"><a href=
1.17 ! sketch 1203: "#id2517464">4.2.4. Selecting the
1.1 grant 1204: compiler</a></span></dt>
1205: </dl>
1206: </dd>
1207: </dl>
1208: </dd>
1209:
1210: <dt><span class="chapter"><a href="#binary">5. Creating
1211: binary packages</a></span></dt>
1212:
1213: <dd>
1214: <dl>
1.17 ! sketch 1215: <dt><span class="sect1"><a href="#id2582745">5.1.
1.1 grant 1216: Building a single binary package</a></span></dt>
1217:
1.17 ! sketch 1218: <dt><span class="sect1"><a href="#id2582823">5.2.
1.1 grant 1219: Settings for creation of binary
1220: packages</a></span></dt>
1221:
1222: <dt><span class="sect1"><a href="#bulkbuild">5.3.
1223: Doing a bulk build of all packages</a></span></dt>
1224:
1225: <dd>
1226: <dl>
1227: <dt><span class="sect2"><a href=
1228: "#binary.configuration">5.3.1.
1229: Configuration</a></span></dt>
1230:
1231: <dt><span class="sect2"><a href=
1.17 ! sketch 1232: "#id2582963">5.3.2. Other environmental
1.1 grant 1233: considerations</a></span></dt>
1234:
1235: <dt><span class="sect2"><a href=
1.17 ! sketch 1236: "#id2583003">5.3.3. Operation</a></span></dt>
1.1 grant 1237:
1238: <dt><span class="sect2"><a href=
1.17 ! sketch 1239: "#id2583141">5.3.4. What it does</a></span></dt>
1.1 grant 1240:
1241: <dt><span class="sect2"><a href=
1.17 ! sketch 1242: "#id2583266">5.3.5. Disk space
1.1 grant 1243: requirements</a></span></dt>
1244:
1245: <dt><span class="sect2"><a href=
1.17 ! sketch 1246: "#id2583292">5.3.6. Setting up a sandbox for
1.1 grant 1247: chroot'ed builds</a></span></dt>
1248:
1249: <dt><span class="sect2"><a href=
1.17 ! sketch 1250: "#id2583685">5.3.7. Building a partial set of
1.1 grant 1251: packages</a></span></dt>
1.13 hubertf 1252:
1253: <dt><span class="sect2"><a href=
1254: "#bulk-upload">5.3.8. Uploading results of a bulk
1255: build</a></span></dt>
1.1 grant 1256: </dl>
1257: </dd>
1258:
1.17 ! sketch 1259: <dt><span class="sect1"><a href="#id2584190">5.4.
1.1 grant 1260: Creating a multiple CD-ROM packages
1261: collection</a></span></dt>
1262:
1263: <dd>
1264: <dl>
1265: <dt><span class="sect2"><a href=
1.17 ! sketch 1266: "#id2584205">5.4.1. Example of
1.1 grant 1267: cdpack</a></span></dt>
1268: </dl>
1269: </dd>
1270: </dl>
1271: </dd>
1272:
1273: <dt><span class="chapter"><a href="#faq">6. Frequently
1274: Asked Questions</a></span></dt>
1275:
1276: <dd>
1277: <dl>
1.17 ! sketch 1278: <dt><span class="sect1"><a href="#id2584466">6.1. Is
1.1 grant 1279: there a mailing list for pkg-related
1280: discussion?</a></span></dt>
1281:
1.17 ! sketch 1282: <dt><span class="sect1"><a href="#id2584496">6.2.
1.1 grant 1283: Where's the pkgviews documentation?</a></span></dt>
1284:
1.5 hubertf 1285: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 1286: Utilities for package management
1287: (pkgtools)</a></span></dt>
1288:
1.17 ! sketch 1289: <dt><span class="sect1"><a href="#id2584748">6.4. How
1.1 grant 1290: to use pkgsrc as non-root</a></span></dt>
1291:
1.17 ! sketch 1292: <dt><span class="sect1"><a href="#id2584760">6.5. How
1.15 xtraeme 1293: to resume transfers when fetching
1294: distfiles?</a></span></dt>
1.14 xtraeme 1295:
1.17 ! sketch 1296: <dt><span class="sect1"><a href="#id2584803">6.6. How
1.1 grant 1297: can I install/use XFree86 from
1298: pkgsrc?</a></span></dt>
1299:
1.17 ! sketch 1300: <dt><span class="sect1"><a href="#id2584830">6.7. How
1.1 grant 1301: can I install/use X.org from pkgsrc?</a></span></dt>
1302:
1.17 ! sketch 1303: <dt><span class="sect1"><a href="#id2584858">6.8. How
1.1 grant 1304: to fetch files from behind a firewall</a></span></dt>
1305:
1.17 ! sketch 1306: <dt><span class="sect1"><a href="#id2584872">6.9. How
1.14 xtraeme 1307: do I tell <span><strong class="command">make
1308: fetch</strong></span> to do passive
1.1 grant 1309: FTP?</a></span></dt>
1310:
1.17 ! sketch 1311: <dt><span class="sect1"><a href="#id2584923">6.10.
1.14 xtraeme 1312: How to fetch all distfiles at once</a></span></dt>
1.1 grant 1313:
1.17 ! sketch 1314: <dt><span class="sect1"><a href="#id2585063">6.11.
1.14 xtraeme 1315: What does “<span class="quote">Don't know how
1316: to make /usr/share/tmac/tmac.andoc</span>”
1317: mean?</a></span></dt>
1.13 hubertf 1318:
1.17 ! sketch 1319: <dt><span class="sect1"><a href="#id2585101">6.12.
1.14 xtraeme 1320: What does “<span class="quote">Could not find
1321: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1322:
1.17 ! sketch 1323: <dt><span class="sect1"><a href="#id2585227">6.13.
1.1 grant 1324: Using 'sudo' with pkgsrc</a></span></dt>
1325:
1.14 xtraeme 1326: <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1 grant 1327: Configuration files handling and
1328: placement</a></span></dt>
1329:
1330: <dt><span class="sect1"><a href=
1.14 xtraeme 1331: "#audit-packages">6.15. Automated security
1.1 grant 1332: checks</a></span></dt>
1333: </dl>
1334: </dd>
1335: </dl>
1336: </div>
1337:
1338: <div class="chapter" lang="en" xml:lang="en">
1339: <div class="titlepage">
1340: <div>
1341: <div>
1342: <h2 class="title"><a name="getting" id=
1343: "getting"></a>Chapter 2. Where to get
1344: pkgsrc</h2>
1345: </div>
1346: </div>
1347: </div>
1348:
1349: <div class="toc">
1350: <p><b>Table of Contents</b></p>
1351:
1352: <dl>
1.17 ! sketch 1353: <dt><span class="sect1"><a href="#id2514720">2.1. As
1.1 grant 1354: tar file</a></span></dt>
1355:
1.17 ! sketch 1356: <dt><span class="sect1"><a href="#id2514736">2.2. Via
1.1 grant 1357: SUP</a></span></dt>
1358:
1.17 ! sketch 1359: <dt><span class="sect1"><a href="#id2514836">2.3. Via
1.1 grant 1360: CVS</a></span></dt>
1361: </dl>
1362: </div>
1363:
1364: <p>There are three ways to get pkgsrc. Either as a tar
1365: file, via SUP, or via CVS. All three ways are described
1366: here.</p>
1367:
1368: <div class="sect1" lang="en" xml:lang="en">
1369: <div class="titlepage">
1370: <div>
1371: <div>
1372: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 1373: "id2514720" id="id2514720"></a>2.1. As tar
1.1 grant 1374: file</h2>
1375: </div>
1376: </div>
1377: </div>
1378:
1379: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1380: file from <a href=
1.11 ben 1381: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.14 xtraeme 1382: target="_top">ftp.NetBSD.org</a> and unpack it into
1383: <code class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1384: </div>
1385:
1386: <div class="sect1" lang="en" xml:lang="en">
1387: <div class="titlepage">
1388: <div>
1389: <div>
1390: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 1391: "id2514736" id="id2514736"></a>2.2. Via
1.1 grant 1392: SUP</h2>
1393: </div>
1394: </div>
1395: </div>
1396:
1397: <p>As an alternative to the tar file, you can get pkgsrc
1398: via the Software Update Protocol, SUP. To do so, make
1399: sure your supfile has a line</p>
1400: <pre class="programlisting">
1401: release=pkgsrc
1402: </pre>
1403:
1.14 xtraeme 1404: <p>in it, see the examples in <code class=
1405: "filename">/usr/share/examples/supfiles</code>, and that
1406: the <code class="filename">/usr/pkgsrc</code> directory
1407: exists. Then, simply run <span><strong class=
1408: "command">sup -v <em class=
1409: "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1410: </div>
1411:
1412: <div class="sect1" lang="en" xml:lang="en">
1413: <div class="titlepage">
1414: <div>
1415: <div>
1416: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 1417: "id2514836" id="id2514836"></a>2.3. Via
1.1 grant 1418: CVS</h2>
1419: </div>
1420: </div>
1421: </div>
1422:
1423: <p>To get pkgsrc via CVS, make sure you have
1424: “<span class="quote">cvs</span>” installed.
1425: If not present on your system, it can be found as
1426: precompiled binary on ftp.NetBSD.org. To do an initial
1427: (full) checkout of pkgsrc, do the following steps:</p>
1428: <pre class="screen">
1.14 xtraeme 1429: <code class="prompt">%</code> <strong class=
1430: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1431: <code class="prompt">%</code> <strong class=
1432: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1433: <code class="prompt">%</code> <strong class=
1434: "userinput"><code>cd /usr</code></strong>
1435: <code class="prompt">%</code> <strong class=
1436: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1437: </pre>
1438:
1439: <p>This will create the <code class=
1440: "filename">pkgsrc</code> directory in your <code class=
1441: "filename">/usr</code>, and all the package source will
1442: be stored under <code class=
1443: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1444: initial checkout, make sure you have <code class=
1445: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1446: <pre class="screen">
1.14 xtraeme 1447: <code class="prompt">%</code> <strong class=
1448: "userinput"><code>cd /usr/pkgsrc</code></strong>
1449: <code class="prompt">%</code> <strong class=
1450: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1451: </pre>
1452:
1453: <p>Please also note that it is possible to have multiple
1454: copies of the pkgsrc hierarchy in use at any one time -
1455: all work is done relatively within the pkgsrc tree.</p>
1456: </div>
1457: </div>
1458:
1459: <div class="chapter" lang="en" xml:lang="en">
1460: <div class="titlepage">
1461: <div>
1462: <div>
1463: <h2 class="title"><a name="platforms" id=
1464: "platforms"></a>Chapter 3. Using pkgsrc on
1465: systems other than NetBSD</h2>
1466: </div>
1467: </div>
1468: </div>
1469:
1470: <div class="toc">
1471: <p><b>Table of Contents</b></p>
1472:
1473: <dl>
1.17 ! sketch 1474: <dt><span class="sect1"><a href="#id2515014">3.1.
1.1 grant 1475: Bootstrapping pkgsrc</a></span></dt>
1476:
1.17 ! sketch 1477: <dt><span class="sect1"><a href="#id2515127">3.2.
1.1 grant 1478: Platform specific notes</a></span></dt>
1479:
1480: <dd>
1481: <dl>
1.17 ! sketch 1482: <dt><span class="sect2"><a href="#id2515133">3.2.1.
1.1 grant 1483: Darwin (Mac OS X)</a></span></dt>
1484:
1.17 ! sketch 1485: <dt><span class="sect2"><a href="#id2515432">3.2.2.
1.1 grant 1486: FreeBSD</a></span></dt>
1487:
1.17 ! sketch 1488: <dt><span class="sect2"><a href="#id2515876">3.2.3.
1.1 grant 1489: Interix</a></span></dt>
1490:
1.17 ! sketch 1491: <dt><span class="sect2"><a href="#id2515966">3.2.4.
1.1 grant 1492: IRIX</a></span></dt>
1493:
1.17 ! sketch 1494: <dt><span class="sect2"><a href="#id2516084">3.2.5.
1.1 grant 1495: OpenBSD</a></span></dt>
1496:
1.17 ! sketch 1497: <dt><span class="sect2"><a href="#id2516264">3.2.6.
1.1 grant 1498: Solaris</a></span></dt>
1499: </dl>
1500: </dd>
1501: </dl>
1502: </div>
1503:
1504: <div class="sect1" lang="en" xml:lang="en">
1505: <div class="titlepage">
1506: <div>
1507: <div>
1508: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 1509: "id2515014" id=
! 1510: "id2515014"></a>3.1. Bootstrapping pkgsrc</h2>
1.1 grant 1511: </div>
1512: </div>
1513: </div>
1514:
1515: <p>For Operating Systems other than NetBSD, we provide a
1516: bootstrap kit to build the required tools to use pkgsrc
1517: on your platform. Besides support for native NetBSD,
1518: pkgsrc and the bootstrap kit have support for the
1519: following operating systems:</p>
1520:
1521: <div class="itemizedlist">
1522: <ul type="disc">
1523: <li>
1524: <p>Darwin (Mac OS X)</p>
1525: </li>
1526:
1527: <li>
1.16 grant 1528: <p>DragonFlyBSD</p>
1529: </li>
1530:
1531: <li>
1.1 grant 1532: <p>FreeBSD</p>
1533: </li>
1534:
1535: <li>
1536: <p>Interix (Windows 2000, XP, 2003)</p>
1537: </li>
1538:
1539: <li>
1540: <p>IRIX</p>
1541: </li>
1542:
1543: <li>
1544: <p>Linux</p>
1545: </li>
1546:
1547: <li>
1548: <p>OpenBSD</p>
1549: </li>
1550:
1551: <li>
1552: <p>Solaris</p>
1553: </li>
1.16 grant 1554:
1555: <li>
1556: <p>Tru64 (Digital UNIX/OSF1)</p>
1557: </li>
1.1 grant 1558: </ul>
1559: </div>
1560:
1561: <p>Support for other platforms is under development.</p>
1562:
1563: <p>Installing the bootstrap kit should be as simple
1564: as:</p>
1565: <pre class="screen">
1.14 xtraeme 1566: <code class="prompt">#</code> <strong class=
1567: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1568: <code class="prompt">#</code> <strong class=
1569: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1570: <code class="prompt">#</code> <strong class=
1571: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1572: </pre>
1573:
1574: <p>See <a href="#getting" title=
1575: "Chapter 2. Where to get pkgsrc">Chapter 2,
1576: <i>Where to get pkgsrc</i></a> for other ways to get
1.14 xtraeme 1577: pkgsrc before bootstrapping. The given
1578: <span><strong class="command">bootstrap</strong></span>
1579: command will use the defaults of <code class=
1580: "filename">/usr/pkg</code> for the <span class=
1581: "emphasis"><em>prefix</em></span> where programs will be
1582: installed in, and <code class=
1583: "filename">/var/db/pkg</code> for the package database
1.1 grant 1584: directory where pkgsrc will do it's internal bookkeeping.
1585: However, these can also be set using command-line
1586: parameters.</p>
1587:
1588: <p>Binary packages for the pkgsrc tools and an initial
1589: set of packages is available for supported platforms. An
1590: up-to-date list of these can be found on <a href=
1591: "http://www.pkgsrc.org/" target=
1592: "_top">www.pkgsrc.org</a>.</p>
1593: </div>
1594:
1595: <div class="sect1" lang="en" xml:lang="en">
1596: <div class="titlepage">
1597: <div>
1598: <div>
1599: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 1600: "id2515127" id="id2515127"></a>3.2. Platform
1.1 grant 1601: specific notes</h2>
1602: </div>
1603: </div>
1604: </div>
1605:
1606: <p>Here are some platform-specific notes you should be
1607: aware of.</p>
1608:
1609: <div class="sect2" lang="en" xml:lang="en">
1610: <div class="titlepage">
1611: <div>
1612: <div>
1.17 ! sketch 1613: <h3 class="title"><a name="id2515133" id=
! 1614: "id2515133"></a>3.2.1. Darwin (Mac OS
1.1 grant 1615: X)</h3>
1616: </div>
1617: </div>
1618: </div>
1619:
1620: <p>Darwin 5.x and 6.x are supported. There are two
1621: methods of using pkgsrc on Mac OS X, by using a
1622: <a href="#platform.osx-image" title=
1623: "3.2.1.1. Using a disk image">disk image</a>, or a
1624: <a href="#platform.osx-ufs" title=
1625: "3.2.1.2. Using a UFS partition">UFS
1626: partition</a>.</p>
1627:
1628: <p>Before you start, you will need to download and
1629: install the Mac OS X Developer Tools from Apple's
1630: Developer Connection. See <a href=
1631: "http://developer.apple.com/macosx/" target=
1632: "_top">http://developer.apple.com/macosx/</a> for
1633: details. Also, make sure you install X11 for Mac OS X
1634: and the X11 SDK from <a href=
1635: "http://www.apple.com/macosx/x11/download/" target=
1636: "_top">http://www.apple.com/macosx/x11/download/</a> if
1637: you intend to build packages that use the X11 Window
1638: System.</p>
1639:
1640: <p>If you already have a UFS partition, or have a spare
1641: partition that you can format as UFS, it is recommended
1642: to use that instead of the disk image. It'll be
1643: somewhat faster and will mount automatically at boot
1644: time, where you must manually mount a disk image.</p>
1645:
1646: <div class="note" style=
1647: "margin-left: 0.5in; margin-right: 0.5in;">
1648: <h3 class="title">Note</h3>
1649:
1650: <p>You cannot use a HFS+ file system for pkgsrc,
1651: because pkgsrc currently requires the filesystem to
1652: be case-sensitive, and HFS+ is not.</p>
1653: </div>
1654:
1655: <div class="sect3" lang="en" xml:lang="en">
1656: <div class="titlepage">
1657: <div>
1658: <div>
1659: <h4 class="title"><a name="platform.osx-image"
1660: id="platform.osx-image"></a>3.2.1.1. Using
1661: a disk image</h4>
1662: </div>
1663: </div>
1664: </div>
1665:
1666: <p>Create the disk image:</p>
1667: <pre class="screen">
1.14 xtraeme 1668: <code class="prompt">#</code> <strong class=
1669: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1670: <code class="prompt">#</code> <strong class=
1671: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
1672: <code class="prompt">#</code> <strong class=
1673: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
1674: <code class="prompt">#</code> <strong class=
1675: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 1676: </pre>
1677:
1678: <p>That's it!</p>
1679: </div>
1680:
1681: <div class="sect3" lang="en" xml:lang="en">
1682: <div class="titlepage">
1683: <div>
1684: <div>
1685: <h4 class="title"><a name="platform.osx-ufs"
1686: id="platform.osx-ufs"></a>3.2.1.2. Using a
1687: UFS partition</h4>
1688: </div>
1689: </div>
1690: </div>
1691:
1.14 xtraeme 1692: <p>By default, <code class="filename">/usr</code>
1693: will be on your root file system, normally HFS+. It
1694: is possible to use the default <span class=
1695: "emphasis"><em>prefix</em></span> of <code class=
1696: "filename">/usr/pkg</code> by symlinking <code class=
1697: "filename">/usr/pkg</code> to a directory on a UFS
1698: file system. Obviously, another symlink is required
1699: if you want to place the package database directory
1700: outside the <span class=
1701: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 1702: <pre class="screen">
1.14 xtraeme 1703: <code class="prompt">#</code> <strong class=
1704: "userinput"><code>./bootstrap --pkgdbdir=/usr/pkg/pkgdb --pkgsrcdir=/Volumes/ufs/pkgsrc</code></strong>
1.1 grant 1705: </pre>
1706:
1707: <p>If you created your partitions at the time of
1708: installing Mac OS X and formatted the target
1709: partition as UFS, it should automatically mount on
1.14 xtraeme 1710: <code class="filename">/Volumes/<volume
1711: name></code> when the machine boots. If you are
1.1 grant 1712: (re)formatting a partition as UFS, you need to ensure
1713: that the partition map correctly reflects
1714: “<span class="quote">Apple_UFS</span>”
1715: and not “<span class=
1716: "quote">Apple_HFS</span>”.</p>
1717:
1718: <p>The problem is that none of the disk tools will
1719: let you touch a disk that is booted from. You can
1720: unmount the partition, but even if you newfs it, the
1721: partition type will be incorrect and the automounter
1722: won't mount it. It can be mounted manually, but it
1723: won't appear in Finder.</p>
1724:
1725: <p>You'll need to boot off of the OS X Installation
1726: (User) CD. When the Installation program starts, go
1727: up to the menu and select Disk Utility. Now, you will
1728: be able to select the partition you want to be UFS,
1729: and Format it Apple UFS. Quit the Disk Utility, quit
1730: the installer which will reboot your machine. The new
1731: UFS file system will appear in Finder.</p>
1732:
1733: <p>Be aware that the permissions on the new file
1734: system will be writable by root only.</p>
1735:
1736: <p>This note is as of 10.2 (Jaguar) and applies to
1737: earlier versions. Hopefully Apple will fix Disk
1738: Utility in 10.3 (Panther).</p>
1739: </div>
1740: </div>
1741:
1742: <div class="sect2" lang="en" xml:lang="en">
1743: <div class="titlepage">
1744: <div>
1745: <div>
1.17 ! sketch 1746: <h3 class="title"><a name="id2515432" id=
! 1747: "id2515432"></a>3.2.2. FreeBSD</h3>
1.1 grant 1748: </div>
1749: </div>
1750: </div>
1751:
1752: <p>FreeBSD 4.7 and 5.0 have been tested and are
1753: supported, other versions may work.</p>
1754:
1755: <p>Care should be taken so that the tools that this kit
1756: installs do not conflict with the FreeBSD userland
1757: tools. There are several steps:</p>
1758:
1759: <div class="orderedlist">
1760: <ol type="1">
1761: <li>
1762: <p>FreeBSD stores its ports pkg database in
1.14 xtraeme 1763: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 1764: therefore recommended that you choose a different
1.14 xtraeme 1765: location (e.g. <code class=
1766: "filename">/usr/pkgdb</code>) by using the
1.1 grant 1767: --pkgdbdir option to the bootstrap script.</p>
1768: </li>
1769:
1770: <li>
1771: <p>If you do not intend to use the FreeBSD ports
1772: tools, it's probably a good idea to move them out
1773: of the way to avoid confusion, e.g.</p>
1774: <pre class="screen">
1.14 xtraeme 1775: <code class="prompt">#</code> <strong class=
1776: "userinput"><code>cd /usr/sbin</code></strong>
1777: <code class="prompt">#</code> <strong class=
1778: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
1779: <code class="prompt">#</code> <strong class=
1780: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
1781: <code class="prompt">#</code> <strong class=
1782: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
1783: <code class="prompt">#</code> <strong class=
1784: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 1785: </pre>
1786: </li>
1787:
1788: <li>
1.14 xtraeme 1789: <p>An example <code class=
1790: "filename">/etc/mk.conf</code> file will be
1791: placed in <code class=
1792: "filename">/etc/mk.conf.example</code> file when
1793: you use the bootstrap script.</p>
1.1 grant 1794: </li>
1795: </ol>
1796: </div>
1797: </div>
1798:
1799: <div class="sect2" lang="en" xml:lang="en">
1800: <div class="titlepage">
1801: <div>
1802: <div>
1.17 ! sketch 1803: <h3 class="title"><a name="id2515876" id=
! 1804: "id2515876"></a>3.2.3. Interix</h3>
1.1 grant 1805: </div>
1806: </div>
1807: </div>
1808:
1809: <p>Interix is a POSIX compatible subsystem for the
1810: Windows NT kernel, providing a Unix-like environment
1811: with a tighter kernel integration than available with
1812: Cygwin. It is part of the Windows Services for Unix
1813: package, available for free for any licensed copy of
1814: Windows 2000, XP, or 2003. SFU can be downloaded from
1815: <a href="http://www.microsoft.com/windows/sfu/" target=
1816: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
1817:
1818: <p>Services for Unix 3.5, current as of this writing,
1819: has been tested. 3.0 or 3.1 may work, but are not
1820: officially supported. (The main difference in 3.0/3.1
1821: is lack of pthreads.)</p>
1822:
1823: <div class="sect3" lang="en" xml:lang="en">
1824: <div class="titlepage">
1825: <div>
1826: <div>
1827: <h4 class="title"><a name=
1828: "platform.interix-sfu-install" id=
1829: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 1830: installing Interix/SFU</h4>
1.1 grant 1831: </div>
1832: </div>
1833: </div>
1834:
1835: <p>At an absolute minimum, the following packages
1836: must be installed from the Windows Services for Unix
1837: 3.5 distribution in order to use pkgsrc:</p>
1838:
1839: <div class="itemizedlist">
1840: <ul type="disc">
1841: <li>
1842: <p>Utilities -> Base Utilities</p>
1843: </li>
1844:
1845: <li>
1846: <p>Interix GNU Components -> (all)</p>
1847: </li>
1848:
1849: <li>
1850: <p>Remote Connectivity</p>
1851: </li>
1852:
1853: <li>
1854: <p>Interix SDK</p>
1855: </li>
1856: </ul>
1857: </div>
1858:
1859: <p>When using pkgsrc on Interix, DO NOT install the
1860: Utilities subcomponent "UNIX Perl". That is Perl 5.6
1861: without shared module support, installed to
1862: /usr/local, and will only cause confusion. Instead,
1863: install Perl 5.8 from pkgsrc (or from a binary
1864: package).</p>
1865:
1866: <p>The Remote Connectivity subcomponent "Windows
1867: Remote Shell Service" does not need to be installed,
1868: but Remote Connectivity itself should be installed in
1869: order to have a working inetd.</p>
1870:
1871: <p>Finally, during installation you may be asked
1872: whether to enable setuid behavior for Interix
1873: programs, and whether to make pathnames default to
1874: case-sensitive. Setuid should be enabled, and
1875: case-sensitivity MUST be enabled. (Without
1876: case-sensitivity, a large number of packages
1877: including perl will not build.)</p>
1878: </div>
1879:
1880: <div class="sect3" lang="en" xml:lang="en">
1881: <div class="titlepage">
1882: <div>
1883: <div>
1884: <h4 class="title"><a name=
1885: "platform.interix-sfu-postinstall" id=
1886: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
1887: to do if Interix/SFU is already installed</h4>
1888: </div>
1889: </div>
1890: </div>
1891:
1892: <p>If SFU is already installed and you wish to alter
1893: these settings to work with pkgsrc, note the
1894: following things.</p>
1895:
1896: <div class="itemizedlist">
1897: <ul type="disc">
1898: <li>
1899: <p>To uninstall UNIX Perl, use Add/Remove
1900: Programs, select Microsoft Windows Services for
1901: UNIX, then click Change. In the installer,
1902: choose Add or Remove, then uncheck
1903: Utilities->UNIX Perl.</p>
1904: </li>
1905:
1906: <li>
1907: <p>To enable case-sensitivity for the
1908: filesystem, run REGEDIT.EXE, and change the
1909: following registry key:</p>
1910:
1911: <p>
1912: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
1913: Manager\kernel</p>
1914:
1915: <p>Set the DWORD value "obcaseinsensitive" to
1916: 0; then reboot.</p>
1917: </li>
1918:
1919: <li>
1920: <p>To enable setuid binaries (optional), run
1921: REGEDIT.EXE, and change the following registry
1922: key:</p>
1923:
1924: <p>
1925: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
1926: for UNIX</p>
1927:
1928: <p>Set the DWORD value "EnableSetuidBinaries"
1929: to 1; then reboot.</p>
1930: </li>
1931: </ul>
1932: </div>
1933: </div>
1934:
1935: <div class="sect3" lang="en" xml:lang="en">
1936: <div class="titlepage">
1937: <div>
1938: <div>
1939: <h4 class="title"><a name=
1940: "platform.interix-notes" id=
1941: "platform.interix-notes"></a>3.2.3.3. Important
1942: notes for using pkgsrc</h4>
1943: </div>
1944: </div>
1945: </div>
1946:
1947: <p>The package imanager (either the pkgsrc "su" user,
1948: or the user running "pkg_add") must be a member of
1949: the local Administrators group. Such a user must also
1950: be used to run the bootstrap. This is slightly
1951: relaxed from the normal pkgsrc requirement of
1952: "root".</p>
1953:
1954: <p>The package manager should use a umask of 002.
1955: "make install" will automatically complain if this is
1956: not the case. This ensures that directories written
1957: in /var/db/pkg are Administrators-group
1958: writeable.</p>
1959:
1960: <p>The popular Interix binary packages from
1961: http://www.interopsystems.com/ use an older version
1962: of pkgsrc's pkg_* tools. Ideally, these should NOT be
1963: used in conjunction with pkgsrc. If you choose to use
1964: them at the same time as the pkgsrc packages, ensure
1965: that you use the proper pkg_* tools for each type of
1966: binary package.</p>
1967: </div>
1968: </div>
1969:
1970: <div class="sect2" lang="en" xml:lang="en">
1971: <div class="titlepage">
1972: <div>
1973: <div>
1.17 ! sketch 1974: <h3 class="title"><a name="id2515966" id=
! 1975: "id2515966"></a>3.2.4. IRIX</h3>
1.1 grant 1976: </div>
1977: </div>
1978: </div>
1979:
1980: <p>You will need a working C compiler, either gcc or
1981: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 1982: the <code class="varname">CC</code> environment
1983: variable according to your preference. If you do not
1984: have a license for the MIPSpro compiler suite, you can
1.1 grant 1985: download a gcc tardist file from <a href=
1986: "http://freeware.sgi.com/" target=
1987: "_top">http://freeware.sgi.com/</a>.</p>
1988:
1989: <p>Please note that you will need IRIX 6.5.17 or
1990: higher, as this is the earliest version of IRIX
1991: providing support for if_indextoname(3),
1992: if_nametoindex(3), etc.</p>
1993:
1994: <p>At this point in time, pkgsrc only supports one ABI.
1995: That is, you can not switch between the old 32-bit ABI,
1996: the new 32-bit ABI and the 64-bit ABI. If you start out
1997: using "abi=n32", that's what all your packages will be
1998: built with.</p>
1999:
2000: <p>Therefore, please make sure that you have no
1.14 xtraeme 2001: conflicting <code class="varname">CFLAGS</code> in your
2002: environment or the <code class=
2003: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2004: that you do not try to link n32 object files with lib64
1.14 xtraeme 2005: or vice versa. Check your <code class=
2006: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2007:
2008: <p>If you have the actual pkgsrc tree mounted via NFS
2009: from a different host, please make sure to set
1.14 xtraeme 2010: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2011: directory, as it appears that IRIX linker occasionally
2012: runs into issues when trying to link over a network
2013: mounted filesystem.</p>
2014:
2015: <p>The bootstrapping process should set all the right
2016: options for programs such as imake(1), but you may want
2017: to set some options depending on your local setup.
1.14 xtraeme 2018: Please see <code class=
2019: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.1 grant 2020: course, your compilers man pages for details.</p>
2021: </div>
2022:
2023: <div class="sect2" lang="en" xml:lang="en">
2024: <div class="titlepage">
2025: <div>
2026: <div>
1.17 ! sketch 2027: <h3 class="title"><a name="id2516084" id=
! 2028: "id2516084"></a>3.2.5. OpenBSD</h3>
1.1 grant 2029: </div>
2030: </div>
2031: </div>
2032:
2033: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2034:
2035: <p>Care should be taken so that the tools that this kit
2036: installs do not conflict with the OpenBSD userland
2037: tools. There are several steps:</p>
2038:
2039: <div class="orderedlist">
2040: <ol type="1">
2041: <li>
2042: <p>OpenBSD stores its ports pkg database in
1.14 xtraeme 2043: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 2044: therefore recommended that you choose a different
1.14 xtraeme 2045: location (e.g. <code class=
2046: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2047: --pkgdbdir option to the bootstrap script.</p>
2048: </li>
2049:
2050: <li>
2051: <p>If you do not intend to use the OpenBSD ports
2052: tools, it's probably a good idea to move them out
2053: of the way to avoid confusion, e.g.</p>
2054: <pre class="screen">
1.14 xtraeme 2055: <code class="prompt">#</code> <strong class=
2056: "userinput"><code>cd /usr/sbin</code></strong>
2057: <code class="prompt">#</code> <strong class=
2058: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2059: <code class="prompt">#</code> <strong class=
2060: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2061: <code class="prompt">#</code> <strong class=
2062: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2063: <code class="prompt">#</code> <strong class=
2064: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2065: </pre>
2066: </li>
2067:
2068: <li>
1.14 xtraeme 2069: <p>An example <code class=
2070: "filename">/etc/mk.conf</code> file will be
2071: placed in <code class=
2072: "filename">/etc/mk.conf.example</code> file when
2073: you use the bootstrap script. OpenBSD's make
2074: program uses <code class=
2075: "filename">/etc/mk.conf</code> as well. You can
1.1 grant 2076: work around this by enclosing all the pkgsrc
2077: specific parts of the file with:</p>
2078: <pre class="programlisting">
2079: .ifdef BSD_PKG_MK
1.11 ben 2080: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1 grant 2081: .else
2082: # OpenBSD stuff
2083: .endif
2084: </pre>
2085: </li>
2086: </ol>
2087: </div>
2088: </div>
2089:
2090: <div class="sect2" lang="en" xml:lang="en">
2091: <div class="titlepage">
2092: <div>
2093: <div>
1.17 ! sketch 2094: <h3 class="title"><a name="id2516264" id=
! 2095: "id2516264"></a>3.2.6. Solaris</h3>
1.1 grant 2096: </div>
2097: </div>
2098: </div>
2099:
2100: <p>Solaris 2.6 through 9 are supported on both x86 and
2101: sparc. You will need a working C compiler. Both gcc
2102: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2103:
2104: <p>The following packages are required on Solaris 8 for
2105: the bootstrap process and to build packages.</p>
2106:
2107: <div class="itemizedlist">
2108: <ul type="disc">
2109: <li>
2110: <p>SUNWsprot</p>
2111: </li>
2112:
2113: <li>
2114: <p>SUNWarc</p>
2115: </li>
2116:
2117: <li>
2118: <p>SUNWbtool</p>
2119: </li>
2120:
2121: <li>
2122: <p>SUNWtoo</p>
2123: </li>
2124:
2125: <li>
2126: <p>SUNWlibm</p>
2127: </li>
2128: </ul>
2129: </div>
2130:
2131: <p>Please note the use of GNU binutils on Solaris is
2132: <span class="emphasis"><em>not</em></span>
2133: supported.</p>
2134:
2135: <div class="sect3" lang="en" xml:lang="en">
2136: <div class="titlepage">
2137: <div>
2138: <div>
1.17 ! sketch 2139: <h4 class="title"><a name="id2516295" id=
! 2140: "id2516295"></a>3.2.6.1. If you are using
1.1 grant 2141: gcc</h4>
2142: </div>
2143: </div>
2144: </div>
2145:
2146: <p>It makes life much simpler if you only use the
2147: same gcc consistently for building all packages.</p>
2148:
2149: <p>It is recommended that an external gcc be used
2150: only for bootstrapping, then either build gcc from
2151: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2152: href=
2153: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.14 xtraeme 2154: class="pkgname">lang/gcc</a> or install a binary gcc
2155: package, then remove gcc used during
2156: bootstrapping.</p>
1.1 grant 2157:
2158: <p>Binary packages of gcc can be found through
2159: <a href=
2160: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.14 xtraeme 2161: target=
2162: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2163: </div>
2164:
2165: <div class="sect3" lang="en" xml:lang="en">
2166: <div class="titlepage">
2167: <div>
2168: <div>
1.17 ! sketch 2169: <h4 class="title"><a name="id2516316" id=
! 2170: "id2516316"></a>3.2.6.2. If you are using
1.1 grant 2171: Sun WorkShop</h4>
2172: </div>
2173: </div>
2174: </div>
2175:
2176: <p>You will need at least the following packages
2177: installed (from WorkShop 5.0)</p>
2178:
2179: <div class="itemizedlist">
2180: <ul type="disc">
2181: <li>
2182: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2183: </li>
2184:
2185: <li>
2186: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2187: </li>
2188:
2189: <li>
2190: <p>SPROild - Sun WorkShop Incremental
2191: Linker</p>
2192: </li>
2193:
2194: <li>
2195: <p>SPROlang - Sun WorkShop Compilers common
2196: components</p>
2197: </li>
2198: </ul>
2199: </div>
2200:
1.14 xtraeme 2201: <p>You should set <code class="varname">CC</code>,
2202: <code class="varname">CXX</code> and optionally,
2203: <code class="varname">CPP</code> in <code class=
2204: "filename">/etc/mk.conf</code>, eg.</p>
1.1 grant 2205: <pre class="programlisting">
2206: CC= cc
2207: CXX= CC
2208: CPP= /usr/ccs/lib/cpp
2209: </pre>
2210:
2211: <p>You may also want to build 64-bit binaries,
2212: eg.</p>
2213: <pre class="programlisting">
2214: CFLAGS= -xtarget=ultra -xarch=v9
2215: </pre>
2216:
2217: <p>Whichever compiler you use, please ensure the
2218: compiler tools and your $prefix are in your
1.14 xtraeme 2219: <code class="varname">PATH</code>. This includes
2220: <code class="filename">/usr/ccs/{bin,lib}</code> and
2221: eg. <code class=
2222: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2223: </div>
2224: </div>
2225: </div>
2226: </div>
2227:
2228: <div class="chapter" lang="en" xml:lang="en">
2229: <div class="titlepage">
2230: <div>
2231: <div>
2232: <h2 class="title"><a name="using" id=
2233: "using"></a>Chapter 4. Using pkgsrc</h2>
2234: </div>
2235: </div>
2236: </div>
2237:
2238: <div class="toc">
2239: <p><b>Table of Contents</b></p>
2240:
2241: <dl>
2242: <dt><span class="sect1"><a href="#getting-started">4.1.
2243: Working with binary packages</a></span></dt>
2244:
2245: <dd>
2246: <dl>
1.17 ! sketch 2247: <dt><span class="sect2"><a href="#id2516401">4.1.1.
1.1 grant 2248: Where to get binary packages</a></span></dt>
2249:
1.17 ! sketch 2250: <dt><span class="sect2"><a href="#id2516441">4.1.2.
1.1 grant 2251: How to use binary packages</a></span></dt>
2252:
1.17 ! sketch 2253: <dt><span class="sect2"><a href="#id2516576">4.1.3.
1.1 grant 2254: A word of warning</a></span></dt>
2255: </dl>
2256: </dd>
2257:
1.17 ! sketch 2258: <dt><span class="sect1"><a href="#id2516587">4.2.
1.1 grant 2259: Building packages from source</a></span></dt>
2260:
2261: <dd>
2262: <dl>
1.17 ! sketch 2263: <dt><span class="sect2"><a href="#id2516597">4.2.1.
1.1 grant 2264: Requirements</a></span></dt>
2265:
1.17 ! sketch 2266: <dt><span class="sect2"><a href="#id2516617">4.2.2.
1.1 grant 2267: Fetching distfiles</a></span></dt>
2268:
1.17 ! sketch 2269: <dt><span class="sect2"><a href="#id2516806">4.2.3.
1.1 grant 2270: How to build and install</a></span></dt>
2271:
1.17 ! sketch 2272: <dt><span class="sect2"><a href="#id2517464">4.2.4.
1.1 grant 2273: Selecting the compiler</a></span></dt>
2274: </dl>
2275: </dd>
2276: </dl>
2277: </div>
2278:
2279: <div class="sect1" lang="en" xml:lang="en">
2280: <div class="titlepage">
2281: <div>
2282: <div>
2283: <h2 class="title" style="clear: both"><a name=
2284: "getting-started" id=
2285: "getting-started"></a>4.1. Working with binary
2286: packages</h2>
2287: </div>
2288: </div>
2289: </div>
2290:
2291: <p>This section describes how to find, retrieve and
2292: install a precompiled binary package that someone else
2293: already prepared for your type of machine.</p>
2294:
2295: <div class="sect2" lang="en" xml:lang="en">
2296: <div class="titlepage">
2297: <div>
2298: <div>
1.17 ! sketch 2299: <h3 class="title"><a name="id2516401" id=
! 2300: "id2516401"></a>4.1.1. Where to get binary
1.1 grant 2301: packages</h3>
2302: </div>
2303: </div>
2304: </div>
2305:
2306: <p>Precompiled packages are stored on ftp.NetBSD.org
1.14 xtraeme 2307: and its mirrors in the directory <code class=
2308: "filename">/pub/NetBSD/packages</code> for anonymous
2309: FTP access. Please pick the right subdirectory there as
2310: indicated by <span><strong class="command">uname
2311: -p</strong></span>. In that directory, there is a
1.1 grant 2312: subdirectory for each category plus a subdirectory
1.14 xtraeme 2313: <code class="filename">All</code> which includes the
2314: actual binaries in <code class="filename">.tgz</code>
2315: files. The category subdirectories use symbolic links
2316: to those files (this is the same directory layout as in
2317: <code class=
2318: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2319:
2320: <p>This same directory layout applies for CDROM
2321: distributions, only that the directory may be rooted
1.14 xtraeme 2322: somewhere else, probably somewhere below <code class=
2323: "filename">/cdrom</code>. Please consult your CDROMs
1.1 grant 2324: documentation for the exact location.</p>
2325: </div>
2326:
2327: <div class="sect2" lang="en" xml:lang="en">
2328: <div class="titlepage">
2329: <div>
2330: <div>
1.17 ! sketch 2331: <h3 class="title"><a name="id2516441" id=
! 2332: "id2516441"></a>4.1.2. How to use binary
1.1 grant 2333: packages</h3>
2334: </div>
2335: </div>
2336: </div>
2337:
2338: <p>If you have the files on a CDROM or downloaded them
2339: to your hard disk, youcan install them with the
1.14 xtraeme 2340: following command (be sure to<span><strong class=
2341: "command">su</strong></span> to root first):</p>
1.1 grant 2342: <pre class="screen">
1.14 xtraeme 2343: <code class="prompt">#</code> <strong class=
2344: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 2345: </pre>
2346:
2347: <p>If you have FTP access and you don't want to
2348: download the packages via FTP prior to installation,
1.14 xtraeme 2349: you can do this automatically by giving
2350: <span><strong class="command">pkg_add</strong></span>
2351: an FTP URL:</p>
1.1 grant 2352: <pre class="screen">
1.14 xtraeme 2353: <code class="prompt">#</code> <strong class=
2354: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSvers>/<arch>/All/package.tgz</code></strong>
1.1 grant 2355: </pre>
2356:
2357: <p>If there is any doubt, the uname utility can be used
2358: to determine the <OSvers>, and <arch> by
1.14 xtraeme 2359: running <span><strong class="command">uname
2360: -rp</strong></span>.</p>
1.1 grant 2361:
2362: <p>Also note that any prerequisite packages needed to
2363: run the package in question will be installed, too,
2364: assuming they are present where you install from.</p>
2365:
2366: <p>After you've installed packages, be sure to have
1.14 xtraeme 2367: <code class="filename">/usr/pkg/bin</code> in your
2368: <code class="varname">PATH</code> so you can actually
2369: start the just installed program.</p>
1.1 grant 2370: </div>
2371:
2372: <div class="sect2" lang="en" xml:lang="en">
2373: <div class="titlepage">
2374: <div>
2375: <div>
1.17 ! sketch 2376: <h3 class="title"><a name="id2516576" id=
! 2377: "id2516576"></a>4.1.3. A word of
1.1 grant 2378: warning</h3>
2379: </div>
2380: </div>
2381: </div>
2382:
2383: <p>Please pay very careful attention to the warnings
2384: expressed in the <a href=
2385: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2386: <span class="citerefentry"><span class=
2387: "refentrytitle">pkg_add</span>(1)</span></a> manual
2388: page about the inherent dangers of installing binary
2389: packages which you did not create yourself, and the
2390: security holes that can be introduced onto your system
2391: by indiscriminate adding of such files.</p>
2392: </div>
2393: </div>
2394:
2395: <div class="sect1" lang="en" xml:lang="en">
2396: <div class="titlepage">
2397: <div>
2398: <div>
2399: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 2400: "id2516587" id="id2516587"></a>4.2. Building
1.1 grant 2401: packages from source</h2>
2402: </div>
2403: </div>
2404: </div>
2405:
2406: <p>This assumes that the package is already in pkgsrc. If
2407: it is not, see <a href="#developers-guide" title=
1.2 hubertf 2408: "Part II. The pkgsrc developer's guide">Part II,
2409: “The pkgsrc developer's guide”</a>.</p>
1.1 grant 2410:
2411: <div class="sect2" lang="en" xml:lang="en">
2412: <div class="titlepage">
2413: <div>
2414: <div>
1.17 ! sketch 2415: <h3 class="title"><a name="id2516597" id=
! 2416: "id2516597"></a>4.2.1. Requirements</h3>
1.1 grant 2417: </div>
2418: </div>
2419: </div>
2420:
2421: <p>To build packages from source on a NetBSD system the
2422: “<span class="quote">comp</span>” and the
2423: “<span class="quote">text</span>”
2424: distribution sets must be installed. If you want to
2425: build X11 related packages the “<span class=
2426: "quote">xbase</span>” and “<span class=
2427: "quote">xcomp</span>” distribution sets are
2428: required, too.</p>
2429: </div>
2430:
2431: <div class="sect2" lang="en" xml:lang="en">
2432: <div class="titlepage">
2433: <div>
2434: <div>
1.17 ! sketch 2435: <h3 class="title"><a name="id2516617" id=
! 2436: "id2516617"></a>4.2.2. Fetching
1.1 grant 2437: distfiles</h3>
2438: </div>
2439: </div>
2440: </div>
2441:
2442: <p>The distfile (i.e. the unmodified source) must exist
2443: on your system for the packages system to be able to
2444: build it. If it does not exist, pkgsrc will use
2445: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
2446: <span class="citerefentry"><span class=
2447: "refentrytitle">ftp</span>(1)</span></a> to fetch it
2448: automatically.</p>
2449:
2450: <p>You can overwrite some of the major distribution
2451: sites to fit to sites that are close to your own. Have
1.14 xtraeme 2452: a look at <code class=
2453: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
2454: some examples - in particular, look for the
2455: <code class="varname">MASTER_SORT</code>, <code class=
2456: "varname">MASTER_SORT_REGEX</code> and <code class=
2457: "varname">INET_COUNTRY</code> definitions. This may
2458: save some of your bandwidth and time.</p>
1.1 grant 2459:
2460: <p>You can change these settings either in your shell's
2461: environment, or, if you want to keep the settings, by
1.14 xtraeme 2462: editing the <code class="filename">/etc/mk.conf</code>
1.1 grant 2463: file, and adding the definitions there.</p>
2464:
2465: <p>If you don't have a permanent Internet connection
2466: and you want to know which files to download,
1.14 xtraeme 2467: <span><strong class="command">make
2468: fetch-list</strong></span> will tell you what you'll
2469: need. Put these distfiles into <code class=
2470: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 2471: </div>
2472:
2473: <div class="sect2" lang="en" xml:lang="en">
2474: <div class="titlepage">
2475: <div>
2476: <div>
1.17 ! sketch 2477: <h3 class="title"><a name="id2516806" id=
! 2478: "id2516806"></a>4.2.3. How to build and
1.1 grant 2479: install</h3>
2480: </div>
2481: </div>
2482: </div>
2483:
2484: <p>Assuming that the distfile has been fetched (see
2485: previous section), become root and change into the
1.14 xtraeme 2486: relevant directory and running <span><strong class=
2487: "command">make</strong></span>. For example, type</p>
1.1 grant 2488: <pre class="screen">
1.14 xtraeme 2489: <code class="prompt">%</code> <strong class=
2490: "userinput"><code>cd misc/figlet</code></strong>
2491: <code class="prompt">%</code> <strong class=
2492: "userinput"><code>make</code></strong>
1.1 grant 2493: </pre>
2494:
2495: <p>at the shell prompt to build the various components
2496: of the package, and</p>
2497: <pre class="screen">
1.14 xtraeme 2498: <code class="prompt">#</code> <strong class=
2499: "userinput"><code>make install</code></strong>
1.1 grant 2500: </pre>
2501:
2502: <p>to install the various components into the correct
2503: places on your system. Installing the package on your
2504: system requires you to be root. However, pkgsrc has a
2505: <span class="emphasis"><em>just-in-time-su</em></span>
2506: feature, which allows you to only become root for the
2507: actual installation step</p>
2508:
2509: <p>Taking the figlet utility as an example, we can
2510: install it on our system by building as shown in
2511: <a href="#logs" title=
2512: "Appendix B. Build logs">Appendix B, <i>Build
2513: logs</i></a>.</p>
2514:
2515: <p>The program is installed under the default root of
1.14 xtraeme 2516: the packages tree - <code class=
2517: "filename">/usr/pkg</code>. Should this not conform to
2518: your tastes, set the <code class=
2519: "varname">LOCALBASE</code> variable in your
1.1 grant 2520: environment, and it will use that value as the root of
1.14 xtraeme 2521: your packages tree. So, to use <code class=
2522: "filename">/usr/local</code>, set <code class=
2523: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 2524: environment. Please note that you should use a
2525: directory which is dedicated to packages and not shared
1.14 xtraeme 2526: with other programs (ie, do not try and use
2527: <code class="varname">LOCALBASE=/usr</code>). Also, you
2528: should not try to add any of your own files or
2529: directories (such as <code class=
2530: "filename">src/</code>, <code class=
2531: "filename">obj/</code>, or <code class=
2532: "filename">pkgsrc/</code>) below the <code class=
2533: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 2534: possible conflicts between programs and other files
2535: installed by the package system and whatever else may
2536: have been installed there.</p>
2537:
1.14 xtraeme 2538: <p>Some packages look in <code class=
2539: "filename">/etc/mk.conf</code> to alter some
1.1 grant 2540: configuration options at build time. Have a look at
1.14 xtraeme 2541: <code class=
2542: "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
2543: overview of what will be set there by default.
2544: Environment variables such as <code class=
2545: "varname">LOCALBASE</code> can be set in <code class=
2546: "filename">/etc/mk.conf</code> to save having to
2547: remember to set them each time you want to use
2548: pkgsrc.</p>
1.1 grant 2549:
2550: <p>Occasionally, people want to “<span class=
2551: "quote">look under the covers</span>” to see what
2552: is going on when a package is building or being
2553: installed. This may be for debugging purposes, or out
2554: of simple curiosity. A number of utility values have
2555: been added to help with this.</p>
2556:
2557: <div class="orderedlist">
2558: <ol type="1">
2559: <li>
2560: <p>If you invoke the <a href=
2561: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2562: <span class="citerefentry"><span class=
2563: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 2564: with <code class=
2565: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
2566: amount of information will be displayed. For
2567: example,</p>
1.1 grant 2568: <pre class="screen">
1.14 xtraeme 2569: <strong class=
2570: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 2571: </pre>
2572:
2573: <p>will show all the commands that are invoked,
2574: up to and including the “<span class=
2575: "quote">patch</span>” stage.</p>
2576: </li>
2577:
2578: <li>
2579: <p>If you want to know the value of a certain
1.14 xtraeme 2580: make(1) definition, then the <code class=
2581: "varname">VARNAME</code> definition should be
2582: used, in conjunction with the show-var target.
2583: e.g. to show the expansion of the <a href=
1.1 grant 2584: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2585: <span class="citerefentry"><span class=
2586: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 2587: variable <code class=
2588: "varname">DISTFILES</code>:</p>
1.1 grant 2589: <pre class="screen">
1.14 xtraeme 2590: <code class="prompt">%</code> <strong class=
2591: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 2592: /usr/pkg
1.14 xtraeme 2593: <code class="prompt">%</code>
1.1 grant 2594:
2595: </pre>
2596: </li>
2597: </ol>
2598: </div>
2599:
2600: <p>If you want to install a binary package that you've
2601: either created yourself (see next section), that you
2602: put into pkgsrc/packages manually or that is located on
1.8 wiz 2603: a remote FTP server, you can use the "bin-install"
1.1 grant 2604: target. This target will install a binary package - if
2605: available - via <a href=
2606: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2607: <span class="citerefentry"><span class=
2608: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 2609: <span><strong class="command">make
2610: package</strong></span>. The list of remote FTP sites
2611: searched is kept in the variable <code class=
2612: "varname">BINPKG_SITES</code>, which defaults to
2613: ftp.NetBSD.org. Any flags that should be added to
2614: <a href=
1.1 grant 2615: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2616: <span class="citerefentry"><span class=
2617: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 2618: into <code class="varname">BIN_INSTALL_FLAGS</code>.
2619: See <code class=
2620: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
2621: details.</p>
1.1 grant 2622:
2623: <p>A final word of warning: If you setup a system that
1.14 xtraeme 2624: has a non-standard setting for <code class=
2625: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 2626: any packages are installed, as you can not use several
2627: directories for the same purpose. Doing so will result
2628: in pkgsrc not being able to properly detect your
2629: installed packages, and fail miserably. Note also that
2630: precompiled binary packages are usually built with the
1.14 xtraeme 2631: default <code class="varname">LOCALBASE</code> of
2632: <code class="filename">/usr/pkg</code>, and that you
2633: should <span class="emphasis"><em>not</em></span>
2634: install any if you use a non-standard <code class=
2635: "varname">LOCALBASE</code>.</p>
1.1 grant 2636: </div>
2637:
2638: <div class="sect2" lang="en" xml:lang="en">
2639: <div class="titlepage">
2640: <div>
2641: <div>
1.17 ! sketch 2642: <h3 class="title"><a name="id2517464" id=
! 2643: "id2517464"></a>4.2.4. Selecting the
1.1 grant 2644: compiler</h3>
2645: </div>
2646: </div>
2647: </div>
2648:
2649: <p>By default, pkgsrc will use GCC to build packages.
2650: This may be overridden by setting the following
2651: variables in /etc/mk.conf:</p>
2652:
2653: <div class="variablelist">
2654: <dl>
1.14 xtraeme 2655: <dt><span class="term"><code class=
2656: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 2657:
2658: <dd>
2659: <p>This is a list of values specifying the chain
2660: of compilers to invoke when building packages.
2661: Valid values are:</p>
2662:
2663: <div class="itemizedlist">
2664: <ul type="disc">
2665: <li>
1.14 xtraeme 2666: <p><code class="varname">distcc</code>:
1.1 grant 2667: distributed C/C++ (chainable)</p>
2668: </li>
2669:
2670: <li>
1.14 xtraeme 2671: <p><code class="varname">ccache</code>:
1.1 grant 2672: compiler cache (chainable)</p>
2673: </li>
2674:
2675: <li>
1.14 xtraeme 2676: <p><code class="varname">gcc</code>: GNU
2677: C/C++ Compiler</p>
1.1 grant 2678: </li>
2679:
2680: <li>
1.14 xtraeme 2681: <p><code class="varname">mipspro</code>:
1.1 grant 2682: Silicon Graphics, Inc. MIPSpro
2683: (n32/n64)</p>
2684: </li>
2685:
2686: <li>
1.14 xtraeme 2687: <p><code class="varname">mipspro</code>:
1.1 grant 2688: Silicon Graphics, Inc. MIPSpro (o32)</p>
2689: </li>
2690:
2691: <li>
1.14 xtraeme 2692: <p><code class="varname">sunpro</code>:
1.1 grant 2693: Microsystems, Inc. WorkShip/Forte/Sun ONE
2694: Studio</p>
2695: </li>
2696: </ul>
2697: </div>
2698:
2699: <p>The default is “<span class=
1.14 xtraeme 2700: "quote"><code class=
2701: "varname">gcc</code></span>”. You can use
2702: <code class="varname">ccache</code> and/or
2703: <code class="varname">distcc</code> with an
2704: appropriate <code class=
2705: "varname">PKGSRC_COMPILER</code> setting, e.g.
2706: “<span class="quote"><code class=
2707: "varname">ccache gcc</code></span>”. This
1.1 grant 2708: variable should always be terminated with a value
2709: for a real compiler.</p>
2710: </dd>
2711:
1.14 xtraeme 2712: <dt><span class="term"><code class=
2713: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 2714:
2715: <dd>
2716: <p>This specifies the minimum version of GCC to
2717: use when building packages. If the system GCC
2718: doesn't satisfy this requirement, then pkgsrc
2719: will build and install one of the GCC packages to
2720: use instead.</p>
2721: </dd>
2722: </dl>
2723: </div>
2724: </div>
2725: </div>
2726: </div>
2727:
2728: <div class="chapter" lang="en" xml:lang="en">
2729: <div class="titlepage">
2730: <div>
2731: <div>
2732: <h2 class="title"><a name="binary" id=
2733: "binary"></a>Chapter 5. Creating binary
2734: packages</h2>
2735: </div>
2736: </div>
2737: </div>
2738:
2739: <div class="toc">
2740: <p><b>Table of Contents</b></p>
2741:
2742: <dl>
1.17 ! sketch 2743: <dt><span class="sect1"><a href="#id2582745">5.1.
1.1 grant 2744: Building a single binary package</a></span></dt>
2745:
1.17 ! sketch 2746: <dt><span class="sect1"><a href="#id2582823">5.2.
1.1 grant 2747: Settings for creation of binary
2748: packages</a></span></dt>
2749:
2750: <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
2751: a bulk build of all packages</a></span></dt>
2752:
2753: <dd>
2754: <dl>
2755: <dt><span class="sect2"><a href=
2756: "#binary.configuration">5.3.1.
2757: Configuration</a></span></dt>
2758:
1.17 ! sketch 2759: <dt><span class="sect2"><a href="#id2582963">5.3.2.
1.1 grant 2760: Other environmental considerations</a></span></dt>
2761:
1.17 ! sketch 2762: <dt><span class="sect2"><a href="#id2583003">5.3.3.
1.1 grant 2763: Operation</a></span></dt>
2764:
1.17 ! sketch 2765: <dt><span class="sect2"><a href="#id2583141">5.3.4.
1.1 grant 2766: What it does</a></span></dt>
2767:
1.17 ! sketch 2768: <dt><span class="sect2"><a href="#id2583266">5.3.5.
1.1 grant 2769: Disk space requirements</a></span></dt>
2770:
1.17 ! sketch 2771: <dt><span class="sect2"><a href="#id2583292">5.3.6.
1.1 grant 2772: Setting up a sandbox for chroot'ed
2773: builds</a></span></dt>
2774:
1.17 ! sketch 2775: <dt><span class="sect2"><a href="#id2583685">5.3.7.
1.1 grant 2776: Building a partial set of packages</a></span></dt>
1.13 hubertf 2777:
2778: <dt><span class="sect2"><a href=
2779: "#bulk-upload">5.3.8. Uploading results of a bulk
2780: build</a></span></dt>
1.1 grant 2781: </dl>
2782: </dd>
2783:
1.17 ! sketch 2784: <dt><span class="sect1"><a href="#id2584190">5.4.
1.1 grant 2785: Creating a multiple CD-ROM packages
2786: collection</a></span></dt>
2787:
2788: <dd>
2789: <dl>
1.17 ! sketch 2790: <dt><span class="sect2"><a href="#id2584205">5.4.1.
1.1 grant 2791: Example of cdpack</a></span></dt>
2792: </dl>
2793: </dd>
2794: </dl>
2795: </div>
2796:
2797: <div class="sect1" lang="en" xml:lang="en">
2798: <div class="titlepage">
2799: <div>
2800: <div>
2801: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 2802: "id2582745" id="id2582745"></a>5.1. Building a
1.1 grant 2803: single binary package</h2>
2804: </div>
2805: </div>
2806: </div>
2807:
2808: <p>Once you have built and installed a package, you can
2809: create a <span class="emphasis"><em>binary
2810: package</em></span> which can be installed on another
2811: system with <a href=
2812: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2813: <span class="citerefentry"><span class=
2814: "refentrytitle">pkg_add</span>(1)</span></a> This saves
2815: having to build the same package on a group of hosts and
2816: wasting CPU time. It also provides a simple means for
2817: others to install your package, should you distribute
2818: it.</p>
2819:
2820: <p>To create a binary package, change into the
1.14 xtraeme 2821: appropriate directory in pkgsrc, and run
2822: <span><strong class="command">make
2823: package</strong></span>:</p>
1.1 grant 2824: <pre class="screen">
1.14 xtraeme 2825: <code class="prompt">#</code> <strong class=
2826: "userinput"><code>cd misc/figlet</code></strong>
2827: <code class="prompt">#</code> <strong class=
2828: "userinput"><code>make package</code></strong>
1.1 grant 2829: </pre>
2830:
2831: <p>This will build and install your package (if not
2832: already done), and then build a binary package from what
1.14 xtraeme 2833: was installed. You can then use the <span><strong class=
2834: "command">pkg_*</strong></span> tools to manipulate it.
2835: Binary packages are created by default in <code class=
2836: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 2837: gzipped tar file. See <a href="#logs.package" title=
2838: "B.2. Packaging figlet">Section B.2,
2839: “Packaging figlet”</a> for a continuation of
2840: the above <a xmlns=
2841: "http://www.w3.org/TR/xhtml1/transitional" href=
2842: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.14 xtraeme 2843: class="pkgname">misc/figlet</a> example.</p>
1.1 grant 2844:
2845: <p>See <a href="#submit" title=
2846: "Chapter 14. Submitting and Committing">Chapter
2847: 14, <i>Submitting and Committing</i></a> for information
2848: on how to submit such a binary package.</p>
2849: </div>
2850:
2851: <div class="sect1" lang="en" xml:lang="en">
2852: <div class="titlepage">
2853: <div>
2854: <div>
2855: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 2856: "id2582823" id="id2582823"></a>5.2. Settings
1.1 grant 2857: for creation of binary packages</h2>
2858: </div>
2859: </div>
2860: </div>
2861:
2862: <p>See <a href="#build.helpful-targets" title=
2863: "11.3. Other helpful targets">Section 11.3,
2864: “Other helpful targets”</a>.</p>
2865: </div>
2866:
2867: <div class="sect1" lang="en" xml:lang="en">
2868: <div class="titlepage">
2869: <div>
2870: <div>
2871: <h2 class="title" style="clear: both"><a name=
2872: "bulkbuild" id="bulkbuild"></a>5.3. Doing a
2873: bulk build of all packages</h2>
2874: </div>
2875: </div>
2876: </div>
2877:
2878: <p>If you want to get a full set of precompiled binary
2879: packages, this section describes how to get them. Beware
2880: that the bulk build will remove all currently installed
2881: packages from your system! Having a FTP server configured
2882: either on the machine doing the bulk builds or on a
2883: nearby NFS server can help to make the packages available
2884: to everyone. See <a href=
2885: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
2886: <span class="citerefentry"><span class=
2887: "refentrytitle">ftpd</span>(8)</span></a> for more
2888: information. If you use a remote NFS server's storage, be
2889: sure to not actually compile on NFS storage, as this
2890: slows things down a lot.</p>
2891:
2892: <div class="sect2" lang="en" xml:lang="en">
2893: <div class="titlepage">
2894: <div>
2895: <div>
2896: <h3 class="title"><a name="binary.configuration"
2897: id=
2898: "binary.configuration"></a>5.3.1. Configuration</h3>
2899: </div>
2900: </div>
2901: </div>
2902:
2903: <div class="sect3" lang="en" xml:lang="en">
2904: <div class="titlepage">
2905: <div>
2906: <div>
2907: <h4 class="title"><a name="binary.mk.conf" id=
2908: "binary.mk.conf"></a>5.3.1.1. /etc/mk.conf</h4>
2909: </div>
2910: </div>
2911: </div>
2912:
1.14 xtraeme 2913: <p>You may want to set things in <code class=
2914: "filename">/etc/mk.conf</code>. Look at <code class=
2915: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 2916: details of the default settings. You will want to
1.14 xtraeme 2917: ensure that <code class=
2918: "varname">ACCEPTABLE_LICENSES</code> meet your local
2919: policy. As used in this example, <code class=
2920: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 2921: "emphasis"><em>all</em></span> licenses.</p>
2922: <pre class="programlisting">
2923: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
2924: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
2925: BSDSRCDIR= /usr/src
2926: BSDXSRCDIR= /usr/xsrc # for x11/xservers
2927: OBJHOSTNAME?= yes # use work.`hostname`
2928: FAILOVER_FETCH= yes # insist on the correct checksum
2929: PKG_DEVELOPER?= yes
2930: _ACCEPTABLE= yes
2931: </pre>
2932: </div>
2933:
2934: <div class="sect3" lang="en" xml:lang="en">
2935: <div class="titlepage">
2936: <div>
2937: <div>
1.17 ! sketch 2938: <h4 class="title"><a name="id2582887" id=
! 2939: "id2582887"></a>5.3.1.2. <code class=
1.14 xtraeme 2940: "filename">build.conf</code></h4>
1.1 grant 2941: </div>
2942: </div>
2943: </div>
2944:
1.14 xtraeme 2945: <p>In <code class="filename">pkgsrc/mk/bulk</code>,
2946: copy <code class="filename">build.conf-example</code>
2947: to <code class="filename">build.conf</code> and edit
2948: it, following the comments in that file. This is the
1.1 grant 2949: config file that determines where log files are
2950: generated after the build, where to mail the build
2951: report to, where your pkgsrc tree is located and
2952: which user to <a href=
2953: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
2954: <span class="citerefentry"><span class=
2955: "refentrytitle">su</span>(8)</span></a> to to do a
1.14 xtraeme 2956: <span><strong class="command">cvs
2957: update</strong></span>.</p>
1.1 grant 2958: </div>
2959:
2960: <div class="sect3" lang="en" xml:lang="en">
2961: <div class="titlepage">
2962: <div>
2963: <div>
1.17 ! sketch 2964: <h4 class="title"><a name="id2582923" id=
! 2965: "id2582923"></a>5.3.1.3. <code class=
1.14 xtraeme 2966: "filename">pre-build.local</code></h4>
1.1 grant 2967: </div>
2968: </div>
2969: </div>
2970:
2971: <p>It is possible to configure the bulk build to
2972: perform certain site specific tasks at the end of the
1.14 xtraeme 2973: pre-build stage. If the file <code class=
2974: "filename">pre-build.local</code> exists in
2975: <code class="filename">/usr/pkgsrc/mk/bulk</code> it
2976: will be executed (as a sh(1) script) at the end of
2977: the usual pre-build stage. An example use of
2978: <code class="filename">pre-build.local</code> is to
2979: have the line:</p>
1.1 grant 2980: <pre class="screen">
1.14 xtraeme 2981: <code class="prompt">#</code> <strong class=
2982: "userinput"><code>echo "I do not have enough disk space to build this pig." \
2983: > pkgsrc/games/crafty-book-enormous/$BROKENF</code></strong>
1.1 grant 2984: </pre>
2985:
2986: <p>to prevent the system from trying to build a
2987: particular package which requires nearly 3 GB of disk
2988: space.</p>
2989: </div>
2990: </div>
2991:
2992: <div class="sect2" lang="en" xml:lang="en">
2993: <div class="titlepage">
2994: <div>
2995: <div>
1.17 ! sketch 2996: <h3 class="title"><a name="id2582963" id=
! 2997: "id2582963"></a>5.3.2. Other environmental
1.1 grant 2998: considerations</h3>
2999: </div>
3000: </div>
3001: </div>
3002:
1.14 xtraeme 3003: <p>As <code class="filename">/usr/pkg</code> will be
1.1 grant 3004: completely deleted at the start of bulk builds, make
3005: sure your login shell is placed somewhere else. Either
1.14 xtraeme 3006: drop it into <code class=
3007: "filename">/usr/local/bin</code> (and adjust your login
3008: shell in the passwd file), or (re-)install it via
3009: <a href=
1.1 grant 3010: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3011: <span class="citerefentry"><span class=
3012: "refentrytitle">pkg_add</span>(1)</span></a> from
1.14 xtraeme 3013: <code class="filename">/etc/rc.local</code>, so you can
1.1 grant 3014: login after a reboot (remember that your current
3015: process won't die if the package is removed, you just
3016: can't start any new instances of the shell any more).
3017: Also, if you use NetBSD earlier than 1.5, or you still
3018: want to use the pkgsrc version of ssh for some reason,
3019: be sure to install ssh before starting it from
1.14 xtraeme 3020: <code class="filename">rc.local</code>:</p>
1.1 grant 3021: <pre class="programlisting">
3022: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
3023: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
3024: /usr/pkg/etc/rc.d/sshd
3025: fi
3026: </pre>
3027:
3028: <p>Not doing so will result in you being not able to
3029: log in via ssh after the bulk build is finished or if
3030: the machine gets rebooted or crashes. You have been
3031: warned! :)</p>
3032: </div>
3033:
3034: <div class="sect2" lang="en" xml:lang="en">
3035: <div class="titlepage">
3036: <div>
3037: <div>
1.17 ! sketch 3038: <h3 class="title"><a name="id2583003" id=
! 3039: "id2583003"></a>5.3.3. Operation</h3>
1.1 grant 3040: </div>
3041: </div>
3042: </div>
3043:
3044: <p>Make sure you don't need any of the packages still
3045: installed.</p>
3046:
3047: <div class="warning" style=
3048: "margin-left: 0.5in; margin-right: 0.5in;">
3049: <h3 class="title">Warning</h3>
3050:
3051: <p>During the bulk build, <span class=
3052: "emphasis"><em>all packages will be
3053: removed!</em></span></p>
3054: </div>
3055:
3056: <p>Be sure to remove all other things that might
3057: interfere with builds, like some libs installed in
1.14 xtraeme 3058: <code class="filename">/usr/local</code>, etc. then
3059: become root and type:</p>
1.1 grant 3060: <pre class="screen">
1.14 xtraeme 3061: <code class="prompt">#</code> <strong class=
3062: "userinput"><code>cd /usr/pkgsrc</code></strong>
3063: <code class="prompt">#</code> <strong class=
3064: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 3065: </pre>
3066:
3067: <p>If for some reason your last build didn't complete
3068: (power failure, system panic, ...), you can continue it
3069: by running:</p>
3070: <pre class="screen">
1.14 xtraeme 3071: <code class="prompt">#</code> <strong class=
3072: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 3073: </pre>
3074:
3075: <p>At the end of the bulk build, you will get a summary
3076: via mail, and find build logs in the directory
1.14 xtraeme 3077: specified by <code class="varname">FTP</code> in the
3078: <code class="filename">build.conf</code> file.</p>
1.1 grant 3079: </div>
3080:
3081: <div class="sect2" lang="en" xml:lang="en">
3082: <div class="titlepage">
3083: <div>
3084: <div>
1.17 ! sketch 3085: <h3 class="title"><a name="id2583141" id=
! 3086: "id2583141"></a>5.3.4. What it does</h3>
1.1 grant 3087: </div>
3088: </div>
3089: </div>
3090:
3091: <p>The bulk builds consist of three steps:</p>
3092:
3093: <div class="variablelist">
3094: <dl>
3095: <dt><span class="term">1. pre-build</span></dt>
3096:
3097: <dd>
3098: <p>The script updates your pkgsrc tree via
3099: (anon)cvs, then cleans out any broken distfiles,
3100: and removes all packages installed.</p>
3101: </dd>
3102:
3103: <dt><span class="term">2. the bulk
3104: build</span></dt>
3105:
3106: <dd>
3107: <p>This is basically “<span class=
3108: "quote">make bulk-package</span>” with an
3109: optimised order in which packages will be built.
3110: Packages that don't require other packages will
3111: be built first, and packages with many
3112: dependencies will be built later.</p>
3113: </dd>
3114:
3115: <dt><span class="term">3. post-build</span></dt>
3116:
3117: <dd>
3118: <p>Generates a report that's placed in the
1.14 xtraeme 3119: directory specified in the <code class=
3120: "filename">build.conf</code> file named
3121: <code class="filename">broken.html</code>, a
3122: short version of that report will also be mailed
3123: to the build's admin.</p>
1.1 grant 3124: </dd>
3125: </dl>
3126: </div>
3127:
3128: <p>During the build, a list of broken packages will be
1.14 xtraeme 3129: compiled in <code class=
3130: "filename">/usr/pkgsrc/.broken</code> (or <code class=
3131: "filename">.../.broken.${MACHINE}</code> if
3132: <code class="varname">OBJMACHINE</code> is set),
3133: individual build logs of broken builds can be found in
3134: the package's directory. These files are used by the
3135: bulk-targets to mark broken builds to not waste time
3136: trying to rebuild them, and they can be used to debug
3137: these broken package builds later.</p>
1.1 grant 3138: </div>
3139:
3140: <div class="sect2" lang="en" xml:lang="en">
3141: <div class="titlepage">
3142: <div>
3143: <div>
1.17 ! sketch 3144: <h3 class="title"><a name="id2583266" id=
! 3145: "id2583266"></a>5.3.5. Disk space
1.1 grant 3146: requirements</h3>
3147: </div>
3148: </div>
3149: </div>
3150:
3151: <p>Currently, roughly the following requirements are
3152: valid for NetBSD 2.0/i386:</p>
3153:
3154: <div class="itemizedlist">
3155: <ul type="disc">
3156: <li>
3157: <p>10 GB - distfiles (NFS ok)</p>
3158: </li>
3159:
3160: <li>
3161: <p>8 GB - full set of all binaries (NFS ok)</p>
3162: </li>
3163:
3164: <li>
3165: <p>5 GB - temp space for compiling (local disk
3166: recommended)</p>
3167: </li>
3168: </ul>
3169: </div>
3170:
3171: <p>Note that all pkgs will be de-installed as soon as
3172: they are turned into a binary package, and that sources
3173: are removed, so there is no excessively huge demand to
3174: disk space. Afterwards, if the package is needed again,
3175: it will be installed via <a href=
3176: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3177: <span class="citerefentry"><span class=
3178: "refentrytitle">pkg_add</span>(1)</span></a> instead of
3179: building again, so there are no cycles wasted by
3180: recompiling.</p>
3181: </div>
3182:
3183: <div class="sect2" lang="en" xml:lang="en">
3184: <div class="titlepage">
3185: <div>
3186: <div>
1.17 ! sketch 3187: <h3 class="title"><a name="id2583292" id=
! 3188: "id2583292"></a>5.3.6. Setting up a sandbox
1.1 grant 3189: for chroot'ed builds</h3>
3190: </div>
3191: </div>
3192: </div>
3193:
1.12 agc 3194: <p>If you don't want all the packages nuked from a
3195: machine (rendering it useless for anything but pkg
3196: compiling), there is the possibility of doing the pkg
3197: bulk build inside a chroot environment.</p>
3198:
3199: <p>The first step is to set up a chroot sandbox, e.g.
1.14 xtraeme 3200: <code class="filename">/usr/sandbox</code>. This can be
1.12 agc 3201: done by using null mounts, or manually.</p>
3202:
1.14 xtraeme 3203: <p>There is a shell script called <code class=
3204: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
3205: set up the sandbox environment using null mounts. It
3206: will also create a script called <code class=
3207: "filename">sandbox</code> in the root of the sandbox
1.12 agc 3208: environment, which will allow the null mounts to be
1.14 xtraeme 3209: activated using the <span><strong class=
3210: "command">sandbox mount</strong></span> command and
3211: deactivated using the <span><strong class=
3212: "command">sandbox umount</strong></span> command.</p>
1.12 agc 3213:
3214: <p>To set up a sandbox environment by hand, after
3215: extracting all the sets from a NetBSD installation or
1.14 xtraeme 3216: doing a <span><strong class="command">make distribution
3217: DESTDIR=/usr/sandbox</strong></span> in <code class=
3218: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 3219: items are present and properly configured:</p>
1.1 grant 3220:
3221: <div class="procedure">
3222: <ol type="1">
3223: <li>
3224: <p>Kernel</p>
3225: <pre class="screen">
1.14 xtraeme 3226: <code class="prompt">#</code> <strong class=
3227: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 3228: </pre>
3229: </li>
3230:
3231: <li>
1.14 xtraeme 3232: <p><code class="filename">/dev/*</code></p>
1.1 grant 3233: <pre class="screen">
1.14 xtraeme 3234: <code class="prompt">#</code> <strong class=
3235: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 3236: </pre>
3237: </li>
3238:
3239: <li>
1.14 xtraeme 3240: <p><code class="filename">/etc/resolv.conf</code>
1.1 grant 3241: (for <a xmlns=
3242: "http://www.w3.org/TR/xhtml1/transitional" href=
3243: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.14 xtraeme 3244: class="pkgname">security/smtpd</a> and mail):</p>
1.1 grant 3245: <pre class="screen">
1.14 xtraeme 3246: <code class="prompt">#</code> <strong class=
3247: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 3248: </pre>
3249: </li>
3250:
3251: <li>
3252: <p>Working(!) mail config (hostname,
3253: sendmail.cf):</p>
3254: <pre class="screen">
1.14 xtraeme 3255: <code class="prompt">#</code> <strong class=
3256: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 3257: </pre>
3258: </li>
3259:
3260: <li>
1.14 xtraeme 3261: <p><code class="filename">/etc/localtime</code>
3262: (for <a xmlns=
1.1 grant 3263: "http://www.w3.org/TR/xhtml1/transitional" href=
3264: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.14 xtraeme 3265: class="pkgname">security/smtpd</a>):</p>
1.1 grant 3266: <pre class="screen">
1.14 xtraeme 3267: <code class="prompt">#</code> <strong class=
3268: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 3269: </pre>
3270: </li>
3271:
3272: <li>
1.14 xtraeme 3273: <p><code class="filename">/usr/src</code> (system
1.1 grant 3274: sources, for <a xmlns=
3275: "http://www.w3.org/TR/xhtml1/transitional" href=
3276: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.14 xtraeme 3277: class="pkgname">sysutils/aperture</a>, <a xmlns=
3278: "http://www.w3.org/TR/xhtml1/transitional" href=
3279: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
3280: class="pkgname">net/ppp-mppe</a>):</p>
1.1 grant 3281: <pre class="screen">
1.14 xtraeme 3282: <code class="prompt">#</code> <strong class=
3283: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
3284: <code class="prompt">#</code> <strong class=
3285: "userinput"><code>ln -s cvs/src-1.6 src</code></strong>
1.1 grant 3286: </pre>
3287: </li>
3288:
3289: <li>
1.14 xtraeme 3290: <p>Create <code class=
3291: "filename">/var/db/pkg</code> (not part of
3292: default install):</p>
1.1 grant 3293: <pre class="screen">
1.14 xtraeme 3294: <code class="prompt">#</code> <strong class=
3295: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 3296: </pre>
3297: </li>
3298:
3299: <li>
1.14 xtraeme 3300: <p>Create <code class="filename">/usr/pkg</code>
3301: (not part of default install):</p>
1.1 grant 3302: <pre class="screen">
1.14 xtraeme 3303: <code class="prompt">#</code> <strong class=
3304: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 3305: </pre>
3306: </li>
3307:
3308: <li>
1.14 xtraeme 3309: <p>Checkout pkgsrc via cvs into <code class=
3310: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 3311: <pre class="screen">
1.14 xtraeme 3312: <code class="prompt">#</code> <strong class=
3313: "userinput"><code>cd /usr/sandbox/usr</code></strong>
3314: <code class="prompt">#</code> <strong class=
3315: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 3316: </pre>
3317:
3318: <p>Do not mount/link this to the copy of your
3319: pkgsrc tree you do development in, as this will
3320: likely cause problems!</p>
3321: </li>
3322:
3323: <li>
1.14 xtraeme 3324: <p>Make <code class=
3325: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
3326: and <code class="filename">.../distfiles</code>
3327: point somewhere appropriate. NFS- and/or
3328: nullfs-mounts may come in handy!</p>
1.1 grant 3329: </li>
3330:
3331: <li>
1.14 xtraeme 3332: <p>Edit <code class=
3333: "filename">/etc/mk.conf</code>, see <a href=
3334: "#binary.mk.conf" title=
1.1 grant 3335: "5.3.1.1. /etc/mk.conf">Section 5.3.1.1,
3336: “/etc/mk.conf”</a>.</p>
3337: </li>
3338:
3339: <li>
1.14 xtraeme 3340: <p>Adjust <code class=
3341: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 3342: needs.</p>
3343: </li>
3344:
3345: <li>
1.14 xtraeme 3346: <p>If you have set <code class=
3347: "varname">CVS_USER</code> in <code class=
3348: "filename">build.conf</code>, make sure that
3349: account exists and can do a <span><strong class=
3350: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 3351: properly!</p>
3352: </li>
3353: </ol>
3354: </div>
3355:
3356: <p>When the chroot sandbox is setup, you can start the
3357: build with the following steps:</p>
3358: <pre class="screen">
1.14 xtraeme 3359: <code class="prompt">#</code> <strong class=
3360: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
3361: <code class="prompt">#</code> <strong class=
3362: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 3363: </pre>
3364:
3365: <p>This will just jump inside the sandbox and start
3366: building. At the end of the build, mail will be sent
3367: with the results of the build. Created binary pkgs will
1.14 xtraeme 3368: be in <code class=
3369: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 3370: (wherever that points/mounts to/from).</p>
3371: </div>
3372:
3373: <div class="sect2" lang="en" xml:lang="en">
3374: <div class="titlepage">
3375: <div>
3376: <div>
1.17 ! sketch 3377: <h3 class="title"><a name="id2583685" id=
! 3378: "id2583685"></a>5.3.7. Building a partial
1.1 grant 3379: set of packages</h3>
3380: </div>
3381: </div>
3382: </div>
3383:
3384: <p>In addition to building a complete set of all
1.14 xtraeme 3385: packages in pkgsrc, the <code class=
3386: "filename">pkgsrc/mk/bulk/build</code> script may be
3387: used to build a subset of the packages contained in
3388: pkgsrc. By setting defining <code class=
3389: "varname">SPECIFIC_PKGS</code> in <code class=
3390: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 3391:
3392: <div class="itemizedlist">
3393: <ul type="disc">
3394: <li>
3395: <p>SITE_SPECIFIC_PKGS</p>
3396: </li>
3397:
3398: <li>
3399: <p>HOST_SPECIFIC_PKGS</p>
3400: </li>
3401:
3402: <li>
3403: <p>GROUP_SPECIFIC_PKGS</p>
3404: </li>
3405:
3406: <li>
3407: <p>USER_SPECIFIC_PKGS</p>
3408: </li>
3409: </ul>
3410: </div>
3411:
3412: <p>will define the set of packages which should be
3413: built. The bulk build code will also include any
3414: packages which are needed as dependencies for the
3415: explicitly listed packages.</p>
3416:
3417: <p>One use of this is to do a bulk build with
1.14 xtraeme 3418: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 3419: sandbox periodically to have a complete set of the
3420: binary packages needed for your site available without
3421: the overhead of building extra packages that are not
3422: needed.</p>
3423: </div>
1.13 hubertf 3424:
3425: <div class="sect2" lang="en" xml:lang="en">
3426: <div class="titlepage">
3427: <div>
3428: <div>
3429: <h3 class="title"><a name="bulk-upload" id=
3430: "bulk-upload"></a>5.3.8. Uploading results
3431: of a bulk build</h3>
3432: </div>
3433: </div>
3434: </div>
3435:
3436: <p>This section describes how pkgsrc developers can
3437: upload binary pkgs built by bulk builds to
3438: ftp.NetBSD.org.</p>
3439:
1.17 ! sketch 3440: <p>If you would like to automatically create checksum
! 3441: files for the binary packages you intend to upload,
! 3442: remember to set <code class="varname">MKSUMS=yes</code>
! 3443: in your <code class=
! 3444: "filename">mk/bulk/build.conf</code>.</p>
! 3445:
! 3446: <p>If you would like to PGP sign the checksum files
! 3447: (highly recommended!), remember to set <code class=
! 3448: "varname">SIGN_AS=username@NetBSD.org</code> in your
! 3449: <code class="filename">mk/bulk/build.conf</code>. This
! 3450: will prompt you for your gpg password to sign the files
! 3451: before uploading everything.</p>
! 3452:
! 3453: <p>Then, make sure that you have <code class=
1.14 xtraeme 3454: "varname">RSYNC_DST</code> set properly in your
3455: <code class="filename">mk/bulk/build.conf</code> file,
3456: i.e. adjust it to something like one of the
3457: following:</p>
1.13 hubertf 3458: <pre class="screen">
3459: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3460: </pre>
3461:
3462: <p>Please use appropviate values for "pkgsrc-200xQ4",
3463: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 3464: ftp.NetBSD.org is different from <code class=
3465: "varname">CVS_USER</code>, write your login directly
3466: into the variable, e.g. my local account is "feyrer",
3467: but for my login "hubertf", I use:</p>
1.13 hubertf 3468: <pre class="screen">
3469: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3470: </pre>
3471:
1.14 xtraeme 3472: <p>A separate <code class="filename">upload</code>
1.13 hubertf 3473: directory is used here to allow "closing" the directory
3474: during upload. To do so, run the following command on
3475: ftp.NetBSD.org next:</p>
3476: <pre class="screen">
1.14 xtraeme 3477: nbftp% <strong class=
3478: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 3479: </pre>
3480:
1.14 xtraeme 3481: <p>Please note that <code class=
3482: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 3483: appropriate for packages for the NetBSD operating
3484: system. Binary packages for other operating systems
1.14 xtraeme 3485: should go into <code class=
3486: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 3487:
3488: <p>Before uploading the binary pkgs, ssh authentication
3489: needs to be setup next. This example shows how to setup
3490: temporary keys for the root account <span class=
3491: "emphasis"><em>inside the sandbox</em></span> (assuming
3492: that no keys should be present there usually):</p>
3493: <pre class="screen">
1.14 xtraeme 3494: <code class="prompt">#</code> <strong class=
3495: "userinput"><code>chroot /usr/sandbox</code></strong>
3496: chroot-<code class="prompt">#</code> <strong class=
3497: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
3498: chroot-<code class="prompt">#</code> <strong class=
3499: "userinput"><code>ssh-keygen -t dsa</code></strong>
3500: chroot-<code class="prompt">#</code> <strong class=
3501: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 3502: </pre>
3503:
1.14 xtraeme 3504: <p>Now take the output of <code class=
3505: "filename">id-dsa.pub</code> and append it to your
3506: <code class="filename">~/.ssh/authorized_keys</code>
1.17 ! sketch 3507: file on ftp.NetBSD.org. You can remove the key after
1.14 xtraeme 3508: the upload is done!</p>
1.13 hubertf 3509:
3510: <p>Next, test if your ssh connection really works:</p>
3511: <pre class="screen">
1.14 xtraeme 3512: chroot-<code class="prompt">#</code> <strong class=
3513: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 3514: </pre>
3515:
3516: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
3517:
3518: <p>Now after all this works, you can exit the sandbox
3519: and start the upload:</p>
3520: <pre class="screen">
1.14 xtraeme 3521: chroot-<code class="prompt">#</code> <strong class=
3522: "userinput"><code>exit</code></strong>
3523: <code class="prompt">#</code> <strong class=
3524: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
3525: <code class="prompt">#</code> <strong class=
3526: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 3527: </pre>
3528:
3529: <p>The upload process may take quite some time. Use
3530: "ls" or "du" on the FTP server to monitor progress of
3531: the upload.</p>
3532:
3533: <p>After the upload has ended, first thing is to revoke
3534: ssh access:</p>
3535: <pre class="screen">
1.14 xtraeme 3536: nbftp% <strong class=
3537: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 3538: Gdd:x!
3539: </pre>
3540:
3541: <p>Use whatever is needed to remove the key you've
3542: entered before! Last, move the uploaded packages out of
1.14 xtraeme 3543: the <code class="filename">upload</code> directory to
3544: have them accessible to everyone:</p>
1.13 hubertf 3545: <pre class="screen">
1.14 xtraeme 3546: nbftp% <strong class=
3547: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
3548: nbftp% <strong class=
3549: "userinput"><code>mv upload/* .</code></strong>
3550: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
3551: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 3552: </pre>
3553: </div>
1.1 grant 3554: </div>
3555:
3556: <div class="sect1" lang="en" xml:lang="en">
3557: <div class="titlepage">
3558: <div>
3559: <div>
3560: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 3561: "id2584190" id="id2584190"></a>5.4. Creating a
1.1 grant 3562: multiple CD-ROM packages collection</h2>
3563: </div>
3564: </div>
3565: </div>
3566:
3567: <p>After your pkgsrc bulk-build has completed, you may
3568: wish to create a CD-ROM set of the resulting binary
3569: packages to assist in installing packages on other
3570: machines. The <a xmlns=
3571: "http://www.w3.org/TR/xhtml1/transitional" href=
3572: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.14 xtraeme 3573: class="pkgname">pkgtools/cdpack</a> package provides a
3574: simple tool for creating the ISO 9660 images.
3575: <span><strong class="command">cdpack</strong></span>
3576: arranges the packages on the CD-ROMs in a way that keeps
3577: all the dependencies for given package on the same CD as
3578: that package.</p>
1.1 grant 3579:
3580: <div class="sect2" lang="en" xml:lang="en">
3581: <div class="titlepage">
3582: <div>
3583: <div>
1.17 ! sketch 3584: <h3 class="title"><a name="id2584205" id=
! 3585: "id2584205"></a>5.4.1. Example of
1.1 grant 3586: cdpack</h3>
3587: </div>
3588: </div>
3589: </div>
3590:
3591: <p>Complete documentation for cdpack is found in the
3592: cdpack(1) manpage. The following short example assumes
1.14 xtraeme 3593: that the binary packages are left in <code class=
3594: "filename">/usr/pkgsrc/packages/All</code> and that
3595: sufficient disk space exists in <code class=
3596: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 3597: <pre class="screen">
1.14 xtraeme 3598: <code class="prompt">#</code> <strong class=
3599: "userinput"><code>mkdir /u2/images</code></strong>
3600: <code class="prompt">#</code> <strong class=
3601: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
3602: <code class="prompt">#</code> <strong class=
3603: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 3604: </pre>
3605:
3606: <p>If you wish to include a common set of files
1.14 xtraeme 3607: (<code class="filename">COPYRIGHT</code>, <code class=
3608: "filename">README</code>, etc.) on each CD in the
1.1 grant 3609: collection, then you need to create a directory which
3610: contains these files. e.g.</p>
3611: <pre class="screen">
1.14 xtraeme 3612: <code class="prompt">#</code> <strong class=
3613: "userinput"><code>mkdir /tmp/common</code></strong>
3614: <code class="prompt">#</code> <strong class=
3615: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
3616: <code class="prompt">#</code> <strong class=
3617: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
3618: <code class="prompt">#</code> <strong class=
3619: "userinput"><code>mkdir /tmp/common/bin</code></strong>
3620: <code class="prompt">#</code> <strong class=
3621: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
3622: <code class="prompt">#</code> <strong class=
3623: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
3624: <code class="prompt">#</code> <strong class=
3625: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 3626: </pre>
3627:
3628: <p>Now create the images:</p>
3629: <pre class="screen">
1.14 xtraeme 3630: <code class="prompt">#</code> <strong class=
3631: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 3632: </pre>
3633:
1.14 xtraeme 3634: <p>Each image will contain <code class=
3635: "filename">README</code>, <code class=
3636: "filename">COPYING</code>, and <code class=
3637: "filename">bin/myscript</code> in their root
1.1 grant 3638: directories.</p>
3639: </div>
3640: </div>
3641: </div>
3642:
3643: <div class="chapter" lang="en" xml:lang="en">
3644: <div class="titlepage">
3645: <div>
3646: <div>
3647: <h2 class="title"><a name="faq" id=
3648: "faq"></a>Chapter 6. Frequently Asked
3649: Questions</h2>
3650: </div>
3651: </div>
3652: </div>
3653:
3654: <div class="toc">
3655: <p><b>Table of Contents</b></p>
3656:
3657: <dl>
1.17 ! sketch 3658: <dt><span class="sect1"><a href="#id2584466">6.1. Is
1.1 grant 3659: there a mailing list for pkg-related
3660: discussion?</a></span></dt>
3661:
1.17 ! sketch 3662: <dt><span class="sect1"><a href="#id2584496">6.2.
1.1 grant 3663: Where's the pkgviews documentation?</a></span></dt>
3664:
1.5 hubertf 3665: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 3666: Utilities for package management
3667: (pkgtools)</a></span></dt>
3668:
1.17 ! sketch 3669: <dt><span class="sect1"><a href="#id2584748">6.4. How
1.1 grant 3670: to use pkgsrc as non-root</a></span></dt>
3671:
1.17 ! sketch 3672: <dt><span class="sect1"><a href="#id2584760">6.5. How
1.15 xtraeme 3673: to resume transfers when fetching
3674: distfiles?</a></span></dt>
1.14 xtraeme 3675:
1.17 ! sketch 3676: <dt><span class="sect1"><a href="#id2584803">6.6. How
1.1 grant 3677: can I install/use XFree86 from pkgsrc?</a></span></dt>
3678:
1.17 ! sketch 3679: <dt><span class="sect1"><a href="#id2584830">6.7. How
1.1 grant 3680: can I install/use X.org from pkgsrc?</a></span></dt>
3681:
1.17 ! sketch 3682: <dt><span class="sect1"><a href="#id2584858">6.8. How
1.1 grant 3683: to fetch files from behind a firewall</a></span></dt>
3684:
1.17 ! sketch 3685: <dt><span class="sect1"><a href="#id2584872">6.9. How
1.14 xtraeme 3686: do I tell <span><strong class="command">make
3687: fetch</strong></span> to do passive
3688: FTP?</a></span></dt>
1.1 grant 3689:
1.17 ! sketch 3690: <dt><span class="sect1"><a href="#id2584923">6.10. How
1.1 grant 3691: to fetch all distfiles at once</a></span></dt>
3692:
1.17 ! sketch 3693: <dt><span class="sect1"><a href="#id2585063">6.11. What
1.14 xtraeme 3694: does “<span class="quote">Don't know how to make
3695: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 3696: mean?</a></span></dt>
3697:
1.17 ! sketch 3698: <dt><span class="sect1"><a href="#id2585101">6.12. What
1.14 xtraeme 3699: does “<span class="quote">Could not find
3700: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 3701:
1.17 ! sketch 3702: <dt><span class="sect1"><a href="#id2585227">6.13.
1.1 grant 3703: Using 'sudo' with pkgsrc</a></span></dt>
3704:
1.14 xtraeme 3705: <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1 grant 3706: Configuration files handling and
3707: placement</a></span></dt>
3708:
1.14 xtraeme 3709: <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1 grant 3710: Automated security checks</a></span></dt>
3711: </dl>
3712: </div>
3713:
3714: <p>This section contains hints, tips & tricks on
3715: special things in pkgsrc that we didn't find a better place
3716: for in the previous chapters, and it contains items for
3717: both pkgsrc users and developers.</p>
3718:
3719: <div class="sect1" lang="en" xml:lang="en">
3720: <div class="titlepage">
3721: <div>
3722: <div>
3723: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 3724: "id2584466" id="id2584466"></a>6.1. Is there a
1.1 grant 3725: mailing list for pkg-related discussion?</h2>
3726: </div>
3727: </div>
3728: </div>
3729:
1.14 xtraeme 3730: <p>Yes, <code class="email"><<a href=
3731: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>
1.1 grant 3732: is the list for discussing package related issues. To
3733: subscribe do:</p>
3734: <pre class="programlisting">
1.14 xtraeme 3735: <code class=
3736: "prompt">%</code> echo subscribe tech-pkg | mail majordomo@NetBSD.org
1.1 grant 3737: </pre>
3738:
3739: <p>An archive of the list is available at <a href=
3740: "http://mail-index.NetBSD.org/tech-pkg/" target=
3741: "_top">http://mail-index.NetBSD.org/tech-pkg/</a>.</p>
3742: </div>
3743:
3744: <div class="sect1" lang="en" xml:lang="en">
3745: <div class="titlepage">
3746: <div>
3747: <div>
3748: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 3749: "id2584496" id="id2584496"></a>6.2. Where's
1.1 grant 3750: the pkgviews documentation?</h2>
3751: </div>
3752: </div>
3753: </div>
3754:
3755: <p>Pkgviews is tightly integrated with buildlink. You can
1.14 xtraeme 3756: find a pkgviews User's guide in <code class=
3757: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 3758: </div>
3759:
3760: <div class="sect1" lang="en" xml:lang="en">
3761: <div class="titlepage">
3762: <div>
3763: <div>
3764: <h2 class="title" style="clear: both"><a name=
1.5 hubertf 3765: "faq-pkgtools" id=
3766: "faq-pkgtools"></a>6.3. Utilities for package
3767: management (pkgtools)</h2>
1.1 grant 3768: </div>
3769: </div>
3770: </div>
3771:
1.14 xtraeme 3772: <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1 grant 3773: directory pkgtools contains a number of useful utilities
3774: for both users and developers of pkgsrc. This section
3775: attempts only to make the reader aware of the utilities
3776: and when they might be useful, and not to duplicate the
3777: documentation that comes with each package.</p>
3778:
3779: <p>Utilities used by pkgsrc (automatically installed when
3780: needed):</p>
3781:
3782: <div class="itemizedlist">
3783: <ul type="disc">
3784: <li>
3785: <p><a xmlns=
3786: "http://www.w3.org/TR/xhtml1/transitional" href=
3787: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.14 xtraeme 3788: class="pkgname">pkgtools/x11-links</a>: symlinks
3789: for use by buildlink</p>
1.1 grant 3790: </li>
3791: </ul>
3792: </div>
3793:
3794: <p>OS tool augmentation (automatically installed when
3795: needed):</p>
3796:
3797: <div class="itemizedlist">
3798: <ul type="disc">
3799: <li>
3800: <p><a xmlns=
3801: "http://www.w3.org/TR/xhtml1/transitional" href=
3802: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.14 xtraeme 3803: class="pkgname">pkgtools/digest</a>: calculates
3804: SHA1 checksums (and other kinds)</p>
1.1 grant 3805: </li>
3806:
3807: <li>
3808: <p><a xmlns=
3809: "http://www.w3.org/TR/xhtml1/transitional" href=
3810: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.14 xtraeme 3811: class="pkgname">pkgtools/libnbcompat</a>: compat
3812: library for pkg tools</p>
1.1 grant 3813: </li>
3814:
3815: <li>
3816: <p><a xmlns=
3817: "http://www.w3.org/TR/xhtml1/transitional" href=
3818: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.14 xtraeme 3819: class="pkgname">pkgtools/mtree</a>: installed on
3820: non-BSD systems due to lack of native mtree</p>
1.1 grant 3821: </li>
3822:
3823: <li>
3824: <p><a xmlns=
3825: "http://www.w3.org/TR/xhtml1/transitional" href=
3826: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.14 xtraeme 3827: class="pkgname">pkgtools/pkg_install</a>:
3828: up-to-date replacement for /usr/sbin/pkg_install,
3829: or for use on operating systems where pkg_install
3830: is not present</p>
1.1 grant 3831: </li>
3832: </ul>
3833: </div>
3834:
3835: <p>Utilities used by pkgsrc (not automatically
3836: installed):</p>
3837:
3838: <div class="itemizedlist">
3839: <ul type="disc">
3840: <li>
3841: <p><a xmlns=
3842: "http://www.w3.org/TR/xhtml1/transitional" href=
3843: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.14 xtraeme 3844: class="pkgname">pkgtools/pkg_tarup</a>: create a
3845: binary package from an already-installed package.
3846: used by 'make replace' to save the old package</p>
1.1 grant 3847: </li>
3848:
3849: <li>
3850: <p><a xmlns=
3851: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 3852: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.14 xtraeme 3853: class="pkgname">pkgtools/dfdisk</a>: adds extra
3854: functionality to pkgsrc, allowing it to fetch
3855: distfiles from multiple locations. It currently
3856: supports the following methods: multiple CD-ROMs
3857: and network FTP/HTTP connections.</p>
1.5 hubertf 3858: </li>
3859:
3860: <li>
3861: <p><a xmlns=
3862: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 3863: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.14 xtraeme 3864: class="pkgname">pkgtools/xpkgwedge</a>: put X11
3865: packages someplace else (enabled by default)</p>
1.1 grant 3866: </li>
1.5 hubertf 3867:
3868: <li>
3869: <p><a xmlns=
3870: "http://www.w3.org/TR/xhtml1/transitional" href=
3871: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.14 xtraeme 3872: class="pkgname">devel/cpuflags</a>: will determine
3873: the best compiler flags to optimise code for your
3874: current CPU and compiler.</p>
1.5 hubertf 3875: </li>
1.1 grant 3876: </ul>
3877: </div>
3878:
3879: <p>Utilities for keeping track of installed packages,
3880: being up to date, etc:</p>
3881:
3882: <div class="itemizedlist">
3883: <ul type="disc">
3884: <li>
3885: <p><a xmlns=
3886: "http://www.w3.org/TR/xhtml1/transitional" href=
3887: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.14 xtraeme 3888: class="pkgname">pkgtools/pkg_chk</a>: installs
3889: pkg_chk, which reports on packages whose installed
3890: versions do not match the latest pkgsrc entries</p>
1.1 grant 3891: </li>
3892:
3893: <li>
3894: <p><a xmlns=
3895: "http://www.w3.org/TR/xhtml1/transitional" href=
3896: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.14 xtraeme 3897: class="pkgname">pkgtools/pkgdep</a>: makes
3898: dependency graphs of packages, to aid in choosing a
3899: strategy for updating</p>
1.1 grant 3900: </li>
3901:
3902: <li>
3903: <p><a xmlns=
3904: "http://www.w3.org/TR/xhtml1/transitional" href=
3905: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.14 xtraeme 3906: class="pkgname">pkgtools/pkgdepgraph</a>: make
3907: graph from above (uses graphviz)</p>
1.1 grant 3908: </li>
3909:
3910: <li>
3911: <p><a xmlns=
3912: "http://www.w3.org/TR/xhtml1/transitional" href=
3913: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.14 xtraeme 3914: class="pkgname">pkgtools/pkglint</a>: This provides
3915: two distinct abilities: check a pkgsrc entry for
3916: correctness (pkglint) check for and remove
3917: out-of-date distfiles and binary packages
3918: (lintpkgsrc)</p>
1.1 grant 3919: </li>
3920:
3921: <li>
3922: <p><a xmlns=
3923: "http://www.w3.org/TR/xhtml1/transitional" href=
3924: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.14 xtraeme 3925: class="pkgname">pkgtools/pkgsurvey</a>: report what
3926: packages you have installed</p>
1.1 grant 3927: </li>
3928: </ul>
3929: </div>
3930:
3931: <p>Utilities for people maintaining or creating
3932: individual packages:</p>
3933:
3934: <div class="itemizedlist">
3935: <ul type="disc">
3936: <li>
3937: <p><a xmlns=
3938: "http://www.w3.org/TR/xhtml1/transitional" href=
3939: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.14 xtraeme 3940: class="pkgname">pkgtools/pkgdiff</a>: automate
3941: making and maintaining patches for a package
3942: (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1 grant 3943: </li>
3944:
3945: <li>
3946: <p><a xmlns=
3947: "http://www.w3.org/TR/xhtml1/transitional" href=
3948: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.14 xtraeme 3949: class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
3950: "http://www.w3.org/TR/xhtml1/transitional" href=
3951: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
3952: class="pkgname">pkgtools/url2pkg</a>: aids in
3953: converting to pkgsrc</p>
1.1 grant 3954: </li>
3955:
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/gensolpkg/README.html"
1.14 xtraeme 3960: class="pkgname">pkgtools/gensolpkg</a>: convert
3961: pkgsrc to a Solaris package</p>
1.1 grant 3962: </li>
3963: </ul>
3964: </div>
3965:
3966: <p>Utilities for people maintaining pkgsrc (or more
3967: obscure pkg utilities)</p>
3968:
3969: <div class="itemizedlist">
3970: <ul type="disc">
3971: <li>
3972: <p><a xmlns=
3973: "http://www.w3.org/TR/xhtml1/transitional" href=
3974: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.14 xtraeme 3975: class="pkgname">pkgtools/pkgconflict</a>: find
3976: packages that conflict but aren't marked as
3977: such</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_comp/README.html"
1.14 xtraeme 3984: class="pkgname">pkgtools/pkg_comp</a>: build
3985: packages in a chrooted area</p>
1.1 grant 3986: </li>
3987:
3988: <li>
3989: <p><a xmlns=
3990: "http://www.w3.org/TR/xhtml1/transitional" href=
3991: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.14 xtraeme 3992: class="pkgname">pkgtools/libkver</a>: spoof kernel
3993: version for chrooted cross builds</p>
1.1 grant 3994: </li>
3995: </ul>
3996: </div>
3997: </div>
3998:
3999: <div class="sect1" lang="en" xml:lang="en">
4000: <div class="titlepage">
4001: <div>
4002: <div>
4003: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 4004: "id2584748" id="id2584748"></a>6.4. How to use
1.1 grant 4005: pkgsrc as non-root</h2>
4006: </div>
4007: </div>
4008: </div>
4009:
4010: <p>If you want to use pkgsrc as non-root user, you can
4011: set some variables to make pkgsrc work under these
4012: conditions. Please see <a href=
4013: "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.14 xtraeme 4014: target="_top">this message</a> for more details.</p>
4015: </div>
4016:
4017: <div class="sect1" lang="en" xml:lang="en">
4018: <div class="titlepage">
4019: <div>
4020: <div>
4021: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 4022: "id2584760" id="id2584760"></a>6.5. How to
1.15 xtraeme 4023: resume transfers when fetching distfiles?</h2>
1.14 xtraeme 4024: </div>
4025: </div>
4026: </div>
4027:
1.15 xtraeme 4028: <p>By default resuming transfers in pkgsrc is disabled,
4029: but you can enable this feature by adding the option
4030: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
4031: into <code class="filename">/etc/mk.conf</code>. If,
4032: during a fetch step, an incomplete distfile is found,
4033: pkgsrc will try to resume it.</p>
4034:
4035: <p>You can also use a different program than the default
4036: ftp(1) by changing the <code class=
4037: "varname">FETCH_CMD</code> variable. Don't forget to set
4038: <code class="varname">FETCH_RESUME_ARGS</code> and
4039: <code class="varname">FETCH_OUTPUT_ARGS</code> if you are
4040: not using default values.</p>
1.14 xtraeme 4041:
4042: <p>For example, if you want to use <code class=
4043: "filename">wget</code> to resume downloads, you'll have
4044: to use something like:</p>
4045: <pre class="programlisting">
4046: FETCH_CMD=wget
4047: .if defined(FETCH_CMD) && ${FETCH_CMD} == "wget"
4048: FETCH_BEFORE_ARGS=--passive-ftp
4049: FETCH_RESUME_ARGS=-c
4050: FETCH_OUTPUT_ARGS=-O
4051: .endif
4052:
4053: </pre>
1.1 grant 4054: </div>
4055:
4056: <div class="sect1" lang="en" xml:lang="en">
4057: <div class="titlepage">
4058: <div>
4059: <div>
4060: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 4061: "id2584803" id="id2584803"></a>6.6. How can I
1.1 grant 4062: install/use XFree86 from pkgsrc?</h2>
4063: </div>
4064: </div>
4065: </div>
4066:
4067: <p>If you want to use XFree86 from pkgsrc instead of your
1.14 xtraeme 4068: system's own X11 (<code class=
4069: "filename">/usr/X11R6</code>, <code class=
4070: "filename">/usr/openwin</code>, ...), you will have to
4071: add the following line into <code class=
1.15 xtraeme 4072: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4073: <pre class="programlisting">
4074: X11_TYPE=XFree86
4075:
4076: </pre>
4077: </div>
4078:
4079: <div class="sect1" lang="en" xml:lang="en">
4080: <div class="titlepage">
4081: <div>
4082: <div>
4083: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 4084: "id2584830" id="id2584830"></a>6.7. How can I
1.1 grant 4085: install/use X.org from pkgsrc?</h2>
4086: </div>
4087: </div>
4088: </div>
4089:
4090: <p>If you want to use X.org from pkgsrc instead of your
1.14 xtraeme 4091: system's own X11 (<code class=
4092: "filename">/usr/X11R6</code>, <code class=
4093: "filename">/usr/openwin</code>, ...) you will have to add
4094: the following line into <code class=
1.15 xtraeme 4095: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4096: <pre class="programlisting">
4097: X11_TYPE=xorg
4098:
4099: </pre>
4100: </div>
4101:
4102: <div class="sect1" lang="en" xml:lang="en">
4103: <div class="titlepage">
4104: <div>
4105: <div>
4106: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 4107: "id2584858" id="id2584858"></a>6.8. How to
1.1 grant 4108: fetch files from behind a firewall</h2>
4109: </div>
4110: </div>
4111: </div>
4112:
4113: <p>If you are sitting behind a firewall which does not
4114: allow direct connections to Internet hosts (i.e.
4115: non-NAT), you may specify the relevant proxy hosts. This
4116: is done using an environment variable in the form of a
4117: URL e.g. in Amdahl, the machine “<span class=
4118: "quote">orpheus.amdahl.com</span>” is one of the
4119: firewalls, and it uses port 80 as the proxy port number.
4120: So the proxy environment variables are:</p>
4121: <pre class="programlisting">
4122: ftp_proxy=ftp://orpheus.amdahl.com:80/
4123: http_proxy=http://orpheus.amdahl.com:80/
4124: </pre>
4125: </div>
4126:
4127: <div class="sect1" lang="en" xml:lang="en">
4128: <div class="titlepage">
4129: <div>
4130: <div>
4131: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 4132: "id2584872" id="id2584872"></a>6.9. How do I
1.14 xtraeme 4133: tell <span><strong class="command">make
4134: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 4135: </div>
4136: </div>
4137: </div>
4138:
4139: <p>This depends on which utility is used to retrieve
1.14 xtraeme 4140: distfiles. From <code class="filename">bsd.pkg.mk</code>,
4141: <code class="varname">FETCH_CMD</code> is assigned the
4142: first available command from the following list:</p>
1.1 grant 4143: <pre class="programlisting">
4144: ${LOCALBASE}/bin/ftp
4145: /usr/bin/ftp
4146: </pre>
4147:
4148: <p>On a default NetBSD installation, this will be
1.14 xtraeme 4149: <code class="filename">/usr/bin/ftp</code>, which
1.1 grant 4150: automatically tries passive connections first, and falls
4151: back to active connections if the server refuses to do
4152: passive. For the other tools, add the following to your
1.14 xtraeme 4153: <code class="filename">/etc/mk.conf</code> file:
4154: <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 4155:
1.14 xtraeme 4156: <p>Having that option present will prevent <code class=
4157: "filename">/usr/bin/ftp</code> from falling back to
4158: active transfers.</p>
1.1 grant 4159: </div>
4160:
4161: <div class="sect1" lang="en" xml:lang="en">
4162: <div class="titlepage">
4163: <div>
4164: <div>
4165: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 4166: "id2584923" id="id2584923"></a>6.10. How to
1.1 grant 4167: fetch all distfiles at once</h2>
4168: </div>
4169: </div>
4170: </div>
4171:
4172: <p>You would like to download all the distfiles in a
4173: single batch from work or university, where you can't run
1.14 xtraeme 4174: a <span><strong class="command">make
4175: fetch</strong></span>. There is an archive of distfiles
4176: on <a href=
1.1 grant 4177: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
4178: target="_top">ftp.NetBSD.org</a>, but downloading the
4179: entire directory may not be appropriate.</p>
4180:
1.14 xtraeme 4181: <p>The answer here is to do a <span><strong class=
4182: "command">make fetch-list</strong></span> in <code class=
4183: "filename">/usr/pkgsrc</code> or one of it's
1.1 grant 4184: subdirectories, carry the resulting list to your machine
4185: at work/school and use it there If you don't have a
4186: NetBSD-compatible ftp(1) (like lukemftp) at work, don't
1.14 xtraeme 4187: forget to set <code class="varname">FETCH_CMD</code> to
1.1 grant 4188: something that fetches a URL:</p>
4189:
4190: <p>At home:</p>
4191: <pre class="screen">
1.14 xtraeme 4192: <code class="prompt">%</code> <strong class=
4193: "userinput"><code>cd /usr/pkgsrc</code></strong>
4194: <code class="prompt">%</code> <strong class=
4195: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
4196: <code class="prompt">%</code> <strong class=
4197: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 4198: </pre>
4199:
4200: <p>At work:</p>
4201: <pre class="screen">
1.14 xtraeme 4202: <code class="prompt">%</code> <strong class=
4203: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 4204: </pre>
4205:
1.14 xtraeme 4206: <p>then tar up <code class=
4207: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 4208:
4209: <p>If you have a machine running NetBSD, and you want to
4210: get <span class="emphasis"><em>all</em></span> distfiles
4211: (even ones that aren't for your machine architecture),
4212: you can do so by using the above-mentioned
1.14 xtraeme 4213: <span><strong class="command">make
4214: fetch-list</strong></span> approach, or fetch the
4215: distfiles directly by running:</p>
1.1 grant 4216: <pre class="screen">
1.14 xtraeme 4217: <code class="prompt">%</code> <strong class=
4218: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 4219: </pre>
4220:
1.14 xtraeme 4221: <p>If you even decide to ignore <code class=
4222: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
4223: can get everything by running:</p>
1.1 grant 4224: <pre class="screen">
1.14 xtraeme 4225: <code class="prompt">%</code> <strong class=
4226: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 4227: </pre>
4228: </div>
4229:
4230: <div class="sect1" lang="en" xml:lang="en">
4231: <div class="titlepage">
4232: <div>
4233: <div>
4234: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 4235: "id2585063" id="id2585063"></a>6.11. What does
1.1 grant 4236: “<span class="quote">Don't know how to make
4237: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
4238: </div>
4239: </div>
4240: </div>
4241:
4242: <p>When compiling the <a xmlns=
4243: "http://www.w3.org/TR/xhtml1/transitional" href=
4244: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.14 xtraeme 4245: class="pkgname">pkgtools/pkg_install</a> package, you get
4246: the error from make that it doesn't know how to make
4247: <code class="filename">/usr/share/tmac/tmac.andoc</code>?
4248: This indicates that you don't have installed the
4249: “<span class="quote">text</span>” set on your
4250: machine (nroff, ...). It is recommended to do that to
4251: format manpages.</p>
1.1 grant 4252:
4253: <p>In the case of the <a xmlns=
4254: "http://www.w3.org/TR/xhtml1/transitional" href=
4255: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.14 xtraeme 4256: class="pkgname">pkgtools/pkg_install</a> package, you can
4257: get away with setting <code class=
4258: "varname">NOMAN=YES</code> either in the environment or
4259: in <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 4260: </div>
4261:
4262: <div class="sect1" lang="en" xml:lang="en">
4263: <div class="titlepage">
4264: <div>
4265: <div>
4266: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 4267: "id2585101" id="id2585101"></a>6.12. What does
1.1 grant 4268: “<span class="quote">Could not find
4269: bsd.own.mk</span>” mean?</h2>
4270: </div>
4271: </div>
4272: </div>
4273:
1.14 xtraeme 4274: <p>You didn't install the compiler set, <code class=
4275: "filename">comp.tgz</code>, when you installed your
4276: NetBSD machine. Please get it and install it, by
4277: extracting it in <code class="filename">/</code>:</p>
1.1 grant 4278: <pre class="screen">
1.14 xtraeme 4279: <code class="prompt">#</code> <strong class=
4280: "userinput"><code>cd /</code></strong>
4281: <code class="prompt">#</code> <strong class=
4282: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 4283: </pre>
4284:
1.14 xtraeme 4285: <p><code class="filename">comp.tgz</code> is part of
4286: every NetBSD release. Get the one that corresponds to
4287: your release (determine via <span><strong class=
4288: "command">uname -r</strong></span>).</p>
1.1 grant 4289: </div>
4290:
4291: <div class="sect1" lang="en" xml:lang="en">
4292: <div class="titlepage">
4293: <div>
4294: <div>
4295: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 4296: "id2585227" id="id2585227"></a>6.13. Using
1.1 grant 4297: 'sudo' with pkgsrc</h2>
4298: </div>
4299: </div>
4300: </div>
4301:
4302: <p>When installing packages as non-root user and using
4303: the just-in-time su(1) feature of pkgsrc, it can become
4304: annoying to type in the root password for each required
4305: package installed. To avoid this, the sudo package can be
4306: used, which does password caching over a limited time. To
4307: use it, install sudo (either as binary package or from
4308: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
4309: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.14 xtraeme 4310: class="pkgname">security/sudo</a>) and then put the
4311: following into your <code class=
4312: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4313: <pre class="programlisting">
4314: .if exists(/usr/pkg/bin/sudo)
4315: SU_CMD=/usr/pkg/bin/sudo /bin/sh -c
4316: .endif
4317:
4318: </pre>
4319: </div>
4320:
4321: <div class="sect1" lang="en" xml:lang="en">
4322: <div class="titlepage">
4323: <div>
4324: <div>
4325: <h2 class="title" style="clear: both"><a name=
4326: "faq.conf" id=
1.14 xtraeme 4327: "faq.conf"></a>6.14. Configuration files
1.1 grant 4328: handling and placement</h2>
4329: </div>
4330: </div>
4331: </div>
4332:
1.14 xtraeme 4333: <p>The global variable <code class=
4334: "varname">PKG_SYSCONFBASE</code> (and some others) can be
4335: set by the system administrator in <code class=
4336: "filename">/etc/mk.conf</code> to define the place where
1.1 grant 4337: configuration files get installed. Therefore, packages
4338: must be adapted to support this feature. Keep in mind
4339: that you should only install files that are strictly
4340: necessary in the configuration directory, files that can
1.14 xtraeme 4341: go to <code class="filename">$PREFIX/share</code> should
4342: go there.</p>
1.1 grant 4343:
4344: <p>We will take a look at available variables first
1.14 xtraeme 4345: (<code class="filename">bsd.pkg.mk</code> contains more
4346: information). <code class="varname">PKG_SYSCONFDIR</code>
4347: is where the configuration files for a package may be
4348: found (that is, the full path, e.g. <code class=
4349: "filename">/etc</code> or <code class=
4350: "filename">/usr/pkg/etc</code>). This value may be
1.1 grant 4351: customized in various ways:</p>
4352:
4353: <div class="orderedlist">
4354: <ol type="1">
4355: <li>
1.14 xtraeme 4356: <p><code class="varname">PKG_SYSCONFBASE</code> is
4357: the main config directory under which all package
1.1 grant 4358: configuration files are to be found. Users will
1.14 xtraeme 4359: typically want to set it to <code class=
4360: "filename">/etc</code>, or accept the default
4361: location of <code class=
4362: "filename">$PREFIX/etc</code>.</p>
1.1 grant 4363: </li>
4364:
4365: <li>
1.14 xtraeme 4366: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
4367: is the subdirectory of <code class=
4368: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 4369: configuration files for a particular package may be
1.14 xtraeme 4370: found. Defaults to <code class=
4371: "varname">${SYSCONFBASE}</code>.</p>
1.1 grant 4372: </li>
4373:
4374: <li>
1.14 xtraeme 4375: <p><code class="varname">PKG_SYSCONFVAR</code> is
4376: the special suffix used to distinguish any
4377: overriding values for a particular package (see
4378: next item). It defaults to <code class=
4379: "varname">${PKGBASE}</code>, but for a collection
4380: of related packages that should all have the same
4381: <code class="varname">PKG_SYSCONFDIR</code> value,
4382: it can be set in each of the package Makefiles to a
4383: common value.</p>
1.1 grant 4384: </li>
4385:
4386: <li>
1.14 xtraeme 4387: <p><code class=
4388: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
4389: overrides the value of <code class=
4390: "varname">${PKG_SYSCONFDIR}</code> for packages
4391: with the same value for <code class=
4392: "varname">PKG_SYSCONFVAR</code>.</p>
1.1 grant 4393:
4394: <p>As an example, all the various KDE packages may
1.14 xtraeme 4395: want to set <code class=
4396: "varname">PKG_SYSCONFVAR</code> to
4397: “<span class="quote">kde</span>” so
4398: admins can set <code class=
4399: "varname">PKG_SYSCONFDIR.kde</code> in <code class=
4400: "filename">/etc/mk.conf</code> to define where to
1.1 grant 4401: install KDE config files.</p>
4402: </li>
4403: </ol>
4404: </div>
4405:
4406: <p>Programs' configuration directory should be defined
4407: during the configure stage. Packages that use GNU
4408: autoconf can usually do this by using the
4409: “<span class="quote">--sysconfdir</span>”
4410: parameter, but this brings some problems as we will see
4411: now. When you change this pathname in packages, you
4412: should not allow them to install files in that directory
4413: directly. Instead they need to install those files under
1.14 xtraeme 4414: <code class="filename">share/examples/${PKGNAME}</code>
4415: so <code class="filename">PLIST</code> can register
4416: them.</p>
1.1 grant 4417:
4418: <p>Once you have the required configuration files in
1.14 xtraeme 4419: place (under the <code class=
4420: "filename">share/examples</code> directory) the variable
4421: <code class="varname">CONF_FILES</code> should be set to
4422: copy them into <code class=
4423: "varname">PKG_SYSCONFDIR</code>. The contents of this
4424: variable is formed by pairs of filenames; the first
1.1 grant 4425: element of the pair specifies the file inside the
1.14 xtraeme 4426: examples directory (registered by <code class=
4427: "filename">PLIST</code>) and the second element specifies
1.1 grant 4428: the target file. This is done this way to allow binary
4429: packages to place files in the right directory using
1.14 xtraeme 4430: <code class="filename">INSTALL</code>/<code class=
4431: "filename">DEINSTALL</code> scripts which are created
4432: automatically. The package <code class=
4433: "filename">Makefile</code> must also set <code class=
4434: "varname">USE_PKGINSTALL=YES</code> to use these
1.1 grant 4435: automatically generated scripts. The automatic copying of
4436: config files can be toggled by setting the environment
1.14 xtraeme 4437: variable <code class="varname">PKG_CONFIG</code> prior to
1.1 grant 4438: package installation.</p>
4439:
4440: <p>Here is an example, taken from mail/mutt/Makefile:</p>
4441: <pre class="programlisting">
4442: EGDIR= ${PREFIX}/share/doc/mutt/samples
4443: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
4444: </pre>
4445:
4446: <p>As you can see, this package installs configuration
1.14 xtraeme 4447: files inside <code class="varname">EGDIR</code>, which
4448: are registered by <code class="filename">PLIST</code>.
4449: After that, the variable <code class=
4450: "varname">CONF_FILES</code> lists the installed file
4451: first and then the target file. Users will also get an
4452: automatic message when files are installed using this
4453: method.</p>
1.1 grant 4454: </div>
4455:
4456: <div class="sect1" lang="en" xml:lang="en">
4457: <div class="titlepage">
4458: <div>
4459: <div>
4460: <h2 class="title" style="clear: both"><a name=
4461: "audit-packages" id=
1.14 xtraeme 4462: "audit-packages"></a>6.15. Automated security
1.1 grant 4463: checks</h2>
4464: </div>
4465: </div>
4466: </div>
4467:
4468: <p>Please be aware that there can often be bugs in
4469: third-party software, and some of these bugs can leave a
4470: machine vulnerable to exploitation by attackers. In an
4471: effort to lessen the exposure, the NetBSD packages team
4472: maintains a database of known-exploits to packages which
4473: have at one time been included in pkgsrc. The database
4474: can be downloaded automatically, and a security audit of
4475: all packages installed on a system can take place. To do
4476: this, install the <a xmlns=
4477: "http://www.w3.org/TR/xhtml1/transitional" href=
4478: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.14 xtraeme 4479: class="pkgname">security/audit-packages</a> package. It
4480: has two components:</p>
1.1 grant 4481:
4482: <div class="orderedlist">
4483: <ol type="1">
4484: <li>
4485: <p>“<span class=
4486: "quote">download-vulnerability-list</span>”,
4487: an easy way to download a list of the security
4488: vulnerabilities information. This list is kept up
4489: to date by the NetBSD security officer and the
4490: NetBSD packages team, and is distributed from the
4491: NetBSD ftp server:</p>
4492:
4493: <p><a href=
4494: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.14 xtraeme 4495: target=
4496: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 4497: </li>
4498:
4499: <li>
4500: <p>“<span class=
4501: "quote">audit-packages</span>”, an easy way
4502: to audit the current machine, checking each
4503: vulnerability which is known. If a vulnerable
4504: package is installed, it will be shown by output to
4505: stdout, including a description of the type of
4506: vulnerability, and a URL containing more
4507: information.</p>
4508: </li>
4509: </ol>
4510: </div>
4511:
4512: <p>Use of the audit-packages package is strongly
4513: recommended!</p>
4514:
4515: <p>The following message is displayed as part of the
4516: audit-packages installation procedure:</p>
4517: <pre class="screen">
4518: ===========================================================================
1.17 ! sketch 4519: $NetBSD: faq.xml,v 1.4 2005/01/11 16:05:20 wiz Exp $
1.1 grant 4520:
4521: You may wish to have the vulnerabilities file downloaded daily so that
4522: it remains current. This may be done by adding an appropriate entry
4523: to the root users crontab(5) entry. For example the entry
4524:
4525: # download vulnerabilities file
4526: 0 3 * * * ${PREFIX}/sbin/download-vulnerability-list >/dev/null 2>&1
4527:
4528: will update the vulnerability list every day at 3AM. You may wish to do
4529: this more often than once a day.
4530:
4531: In addition, you may wish to run the package audit from the daily
4532: security script. This may be accomplished by adding the following
4533: lines to /etc/security.local
4534:
4535: if [ -x ${PREFIX}/sbin/audit-packages ]; then
4536: ${PREFIX}/sbin/audit-packages
4537: fi
4538:
4539: ===========================================================================
4540:
4541: </pre>
4542: </div>
4543: </div>
4544: </div>
4545:
4546: <div class="part" lang="en" xml:lang="en">
4547: <div class="titlepage">
4548: <div>
4549: <div>
4550: <h1 class="title"><a name="developers-guide" id=
1.2 hubertf 4551: "developers-guide"></a>The pkgsrc developer's
4552: guide</h1>
1.1 grant 4553: </div>
4554: </div>
4555: </div>
4556:
4557: <div class="toc">
4558: <p><b>Table of Contents</b></p>
4559:
4560: <dl>
4561: <dt><span class="chapter"><a href="#components">7.
4562: Package components - files, directories and
4563: contents</a></span></dt>
4564:
4565: <dd>
4566: <dl>
4567: <dt><span class="sect1"><a href=
1.14 xtraeme 4568: "#components.Makefile">7.1. <code class=
4569: "filename">Makefile</code></a></span></dt>
1.1 grant 4570:
4571: <dt><span class="sect1"><a href=
1.14 xtraeme 4572: "#components.distinfo">7.2. <code class=
4573: "filename">distinfo</code></a></span></dt>
1.1 grant 4574:
4575: <dt><span class="sect1"><a href=
4576: "#components.patches">7.3. patches/*</a></span></dt>
4577:
1.17 ! sketch 4578: <dt><span class="sect1"><a href="#id2586341">7.4.
1.1 grant 4579: Other mandatory files</a></span></dt>
4580:
4581: <dt><span class="sect1"><a href=
4582: "#components.optional">7.5. Optional
4583: files</a></span></dt>
4584:
1.17 ! sketch 4585: <dt><span class="sect1"><a href="#id2586535">7.6.
1.14 xtraeme 4586: <code class="filename">work*</code></a></span></dt>
1.1 grant 4587:
1.17 ! sketch 4588: <dt><span class="sect1"><a href="#id2586622">7.7.
1.14 xtraeme 4589: <code class="filename">files/*</code></a></span></dt>
1.1 grant 4590: </dl>
4591: </dd>
4592:
4593: <dt><span class="chapter"><a href="#plist">8. PLIST
4594: issues</a></span></dt>
4595:
4596: <dd>
4597: <dl>
1.17 ! sketch 4598: <dt><span class="sect1"><a href="#id2586677">8.1. RCS
1.1 grant 4599: ID</a></span></dt>
4600:
1.17 ! sketch 4601: <dt><span class="sect1"><a href="#id2586692">8.2.
1.14 xtraeme 4602: Semi-automatic <code class="filename">PLIST</code>
4603: generation</a></span></dt>
1.1 grant 4604:
4605: <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14 xtraeme 4606: Tweaking output of <span><strong class="command">make
4607: print-PLIST</strong></span></a></span></dt>
1.1 grant 4608:
4609: <dt><span class="sect1"><a href="#plist.misc">8.4.
4610: Variable substitution in PLIST</a></span></dt>
4611:
1.17 ! sketch 4612: <dt><span class="sect1"><a href="#id2587081">8.5.
1.1 grant 4613: Manpage-compression</a></span></dt>
4614:
1.17 ! sketch 4615: <dt><span class="sect1"><a href="#id2587123">8.6.
1.14 xtraeme 4616: Changing PLIST source with <code class=
4617: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 4618:
1.17 ! sketch 4619: <dt><span class="sect1"><a href="#id2587140">8.7.
1.1 grant 4620: Platform specific and differing
4621: PLISTs</a></span></dt>
4622:
4623: <dt><span class="sect1"><a href=
4624: "#faq.common-dirs">8.8. Sharing directories between
4625: packages</a></span></dt>
4626: </dl>
4627: </dd>
4628:
4629: <dt><span class="chapter"><a href="#buildlink">9.
4630: Buildlink methodology</a></span></dt>
4631:
4632: <dd>
4633: <dl>
1.17 ! sketch 4634: <dt><span class="sect1"><a href="#id2587480">9.1.
1.1 grant 4635: Converting packages to use buildlink3</a></span></dt>
4636:
1.17 ! sketch 4637: <dt><span class="sect1"><a href="#id2587739">9.2.
1.14 xtraeme 4638: Writing <code class="filename">buildlink3.mk</code>
4639: files</a></span></dt>
1.1 grant 4640:
4641: <dd>
4642: <dl>
4643: <dt><span class="sect2"><a href=
1.17 ! sketch 4644: "#id2587809">9.2.1. Anatomy of a buildlink3.mk
1.1 grant 4645: file</a></span></dt>
4646:
4647: <dt><span class="sect2"><a href=
1.17 ! sketch 4648: "#id2588249">9.2.2. Updating <code class=
1.14 xtraeme 4649: "varname">BUILDLINK_DEPENDS.<em class=
4650: "replaceable"><code>pkg</code></em></code> in
4651: <code class="filename">buildlink3.mk</code>
1.1 grant 4652: files</a></span></dt>
4653: </dl>
4654: </dd>
4655:
1.17 ! sketch 4656: <dt><span class="sect1"><a href="#id2588465">9.3.
1.14 xtraeme 4657: Writing <code class="filename">builtin.mk</code>
4658: files</a></span></dt>
1.1 grant 4659:
4660: <dd>
4661: <dl>
4662: <dt><span class="sect2"><a href=
1.17 ! sketch 4663: "#id2588546">9.3.1. Anatomy of a <code class=
1.14 xtraeme 4664: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 4665:
4666: <dt><span class="sect2"><a href=
1.17 ! sketch 4667: "#id2588773">9.3.2. Global preferences for native
1.1 grant 4668: or pkgsrc software</a></span></dt>
4669: </dl>
4670: </dd>
4671: </dl>
4672: </dd>
4673:
4674: <dt><span class="chapter"><a href="#options">10. Options
4675: handling</a></span></dt>
4676:
4677: <dd>
4678: <dl>
1.17 ! sketch 4679: <dt><span class="sect1"><a href="#id2588845">10.1.
1.1 grant 4680: Global default options</a></span></dt>
4681:
1.17 ! sketch 4682: <dt><span class="sect1"><a href="#id2588860">10.2.
1.14 xtraeme 4683: Converting packages to use <code class=
4684: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 4685: </dl>
4686: </dd>
4687:
4688: <dt><span class="chapter"><a href="#build">11. The build
4689: process</a></span></dt>
4690:
4691: <dd>
4692: <dl>
4693: <dt><span class="sect1"><a href="#build.prefix">11.1.
4694: Program location</a></span></dt>
4695:
1.17 ! sketch 4696: <dt><span class="sect1"><a href="#id2589468">11.2.
1.1 grant 4697: Main targets</a></span></dt>
4698:
4699: <dt><span class="sect1"><a href=
4700: "#build.helpful-targets">11.3. Other helpful
4701: targets</a></span></dt>
4702: </dl>
4703: </dd>
4704:
4705: <dt><span class="chapter"><a href="#fixes">12. Notes on
4706: fixes for packages</a></span></dt>
4707:
4708: <dd>
4709: <dl>
1.17 ! sketch 4710: <dt><span class="sect1"><a href="#id2590937">12.1.
1.1 grant 4711: General operation</a></span></dt>
4712:
4713: <dd>
4714: <dl>
4715: <dt><span class="sect2"><a href=
1.17 ! sketch 4716: "#id2590940">12.1.1. How to pull in variables
1.1 grant 4717: from /etc/mk.conf</a></span></dt>
4718:
4719: <dt><span class="sect2"><a href=
1.17 ! sketch 4720: "#id2591092">12.1.2. Restricted
1.1 grant 4721: packages</a></span></dt>
4722:
4723: <dt><span class="sect2"><a href=
4724: "#dependencies">12.1.3. Handling
4725: dependencies</a></span></dt>
4726:
4727: <dt><span class="sect2"><a href=
1.17 ! sketch 4728: "#id2591607">12.1.4. Handling conflicts with
1.1 grant 4729: other packages</a></span></dt>
4730:
4731: <dt><span class="sect2"><a href=
1.17 ! sketch 4732: "#id2591657">12.1.5. Packages that cannot or
1.1 grant 4733: should not be built</a></span></dt>
4734:
4735: <dt><span class="sect2"><a href=
1.17 ! sketch 4736: "#id2591683">12.1.6. Packages which should not be
1.1 grant 4737: deleted, once installed</a></span></dt>
4738:
4739: <dt><span class="sect2"><a href=
4740: "#security-handling">12.1.7. Handling packages
4741: with security problems</a></span></dt>
4742:
4743: <dt><span class="sect2"><a href=
1.17 ! sketch 4744: "#id2591774">12.1.8. How to handle compiler
1.1 grant 4745: bugs</a></span></dt>
4746:
4747: <dt><span class="sect2"><a href=
1.17 ! sketch 4748: "#id2591797">12.1.9. How to handle incrementing
1.1 grant 4749: versions when fixing an existing
4750: package</a></span></dt>
4751:
4752: <dt><span class="sect2"><a href=
1.17 ! sketch 4753: "#id2591914">12.1.10. Portability of
1.1 grant 4754: packages</a></span></dt>
4755: </dl>
4756: </dd>
4757:
1.17 ! sketch 4758: <dt><span class="sect1"><a href="#id2591939">12.2.
1.1 grant 4759: Possible downloading issues</a></span></dt>
4760:
4761: <dd>
4762: <dl>
4763: <dt><span class="sect2"><a href=
1.17 ! sketch 4764: "#id2591942">12.2.1. Packages whose distfiles
1.1 grant 4765: aren't available for plain
4766: downloading</a></span></dt>
4767:
4768: <dt><span class="sect2"><a href=
1.17 ! sketch 4769: "#id2592005">12.2.2. How to handle modified
1.1 grant 4770: distfiles with the 'old' name</a></span></dt>
4771: </dl>
4772: </dd>
4773:
1.17 ! sketch 4774: <dt><span class="sect1"><a href="#id2592017">12.3.
1.1 grant 4775: Configuration gotchas</a></span></dt>
4776:
4777: <dd>
4778: <dl>
4779: <dt><span class="sect2"><a href=
4780: "#fixes.libtool">12.3.1. Shared libraries -
4781: libtool</a></span></dt>
4782:
4783: <dt><span class="sect2"><a href=
1.17 ! sketch 4784: "#id2592424">12.3.2. Using libtool on GNU
1.1 grant 4785: packages that already support
4786: libtool</a></span></dt>
4787:
4788: <dt><span class="sect2"><a href=
1.17 ! sketch 4789: "#id2592577">12.3.3. GNU
1.1 grant 4790: Autoconf/Automake</a></span></dt>
4791: </dl>
4792: </dd>
4793:
1.17 ! sketch 4794: <dt><span class="sect1"><a href="#id2592621">12.4.
1.1 grant 4795: Building considerations</a></span></dt>
4796:
4797: <dd>
4798: <dl>
4799: <dt><span class="sect2"><a href=
1.17 ! sketch 4800: "#id2592625">12.4.1. CPP defines</a></span></dt>
1.1 grant 4801: </dl>
4802: </dd>
4803:
1.17 ! sketch 4804: <dt><span class="sect1"><a href="#id2592791">12.5.
1.1 grant 4805: Package specific actions</a></span></dt>
4806:
4807: <dd>
4808: <dl>
4809: <dt><span class="sect2"><a href=
1.17 ! sketch 4810: "#id2592794">12.5.1. Package configuration
1.1 grant 4811: files</a></span></dt>
4812:
4813: <dt><span class="sect2"><a href=
1.17 ! sketch 4814: "#id2592897">12.5.2. User
1.2 hubertf 4815: interaction</a></span></dt>
1.1 grant 4816:
4817: <dt><span class="sect2"><a href=
1.17 ! sketch 4818: "#id2593010">12.5.3. Handling
1.1 grant 4819: licenses</a></span></dt>
4820:
4821: <dt><span class="sect2"><a href=
1.17 ! sketch 4822: "#id2593093">12.5.4. Creating an account from a
1.1 grant 4823: package</a></span></dt>
4824:
4825: <dt><span class="sect2"><a href=
1.17 ! sketch 4826: "#id2593223">12.5.5. Installing score
1.1 grant 4827: files</a></span></dt>
4828:
4829: <dt><span class="sect2"><a href=
1.17 ! sketch 4830: "#id2593335">12.5.6. Packages providing login
1.1 grant 4831: shells</a></span></dt>
4832:
4833: <dt><span class="sect2"><a href=
1.17 ! sketch 4834: "#id2593393">12.5.7. Packages containing perl
1.1 grant 4835: scripts</a></span></dt>
4836:
4837: <dt><span class="sect2"><a href=
1.17 ! sketch 4838: "#id2593411">12.5.8. Packages with hardcoded
1.1 grant 4839: paths to other interpreters</a></span></dt>
4840:
4841: <dt><span class="sect2"><a href=
1.17 ! sketch 4842: "#id2593432">12.5.9. Packages installing perl
1.1 grant 4843: modules</a></span></dt>
4844:
4845: <dt><span class="sect2"><a href=
4846: "#faq.info-files">12.5.10. Packages installing
4847: info files</a></span></dt>
4848:
4849: <dt><span class="sect2"><a href=
1.17 ! sketch 4850: "#id2593652">12.5.11. Packages installing GConf2
1.1 grant 4851: data files</a></span></dt>
4852:
4853: <dt><span class="sect2"><a href=
1.17 ! sketch 4854: "#id2593752">12.5.12. Packages installing
1.1 grant 4855: scrollkeeper data files</a></span></dt>
4856:
4857: <dt><span class="sect2"><a href=
1.17 ! sketch 4858: "#id2593803">12.5.13. Packages installing X11
1.1 grant 4859: fonts</a></span></dt>
4860:
4861: <dt><span class="sect2"><a href=
1.17 ! sketch 4862: "#id2593850">12.5.14. Packages installing GTK2
1.1 grant 4863: modules</a></span></dt>
4864:
4865: <dt><span class="sect2"><a href=
1.17 ! sketch 4866: "#id2593988">12.5.15. Packages installing SGML or
1.1 grant 4867: XML data</a></span></dt>
4868:
4869: <dt><span class="sect2"><a href=
1.17 ! sketch 4870: "#id2594108">12.5.16. Packages installing
1.1 grant 4871: extensions to the MIME database</a></span></dt>
4872:
4873: <dt><span class="sect2"><a href=
1.17 ! sketch 4874: "#id2594247">12.5.17. Packages using
1.1 grant 4875: intltool</a></span></dt>
4876: </dl>
4877: </dd>
4878:
1.17 ! sketch 4879: <dt><span class="sect1"><a href="#id2594261">12.6.
1.1 grant 4880: Feedback to the author</a></span></dt>
4881: </dl>
4882: </dd>
4883:
4884: <dt><span class="chapter"><a href="#debug">13.
4885: Debugging</a></span></dt>
4886:
4887: <dt><span class="chapter"><a href="#submit">14.
4888: Submitting and Committing</a></span></dt>
4889:
4890: <dd>
4891: <dl>
1.17 ! sketch 4892: <dt><span class="sect1"><a href="#id2594723">14.1.
1.1 grant 4893: Submitting your packages</a></span></dt>
4894:
1.17 ! sketch 4895: <dt><span class="sect1"><a href="#id2594842">14.2.
1.1 grant 4896: Committing: Importing a package into
4897: CVS</a></span></dt>
4898:
1.17 ! sketch 4899: <dt><span class="sect1"><a href="#id2594905">14.3.
1.2 hubertf 4900: Updating a package to a newer version</a></span></dt>
1.1 grant 4901:
1.17 ! sketch 4902: <dt><span class="sect1"><a href="#id2594924">14.4.
1.2 hubertf 4903: Moving a package in pkgsrc</a></span></dt>
1.1 grant 4904: </dl>
4905: </dd>
4906: </dl>
4907: </div>
4908:
4909: <div class="chapter" lang="en" xml:lang="en">
4910: <div class="titlepage">
4911: <div>
4912: <div>
4913: <h2 class="title"><a name="components" id=
4914: "components"></a>Chapter 7. Package
4915: components - files, directories and contents</h2>
4916: </div>
4917: </div>
4918: </div>
4919:
4920: <div class="toc">
4921: <p><b>Table of Contents</b></p>
4922:
4923: <dl>
4924: <dt><span class="sect1"><a href=
1.14 xtraeme 4925: "#components.Makefile">7.1. <code class=
4926: "filename">Makefile</code></a></span></dt>
1.1 grant 4927:
4928: <dt><span class="sect1"><a href=
1.14 xtraeme 4929: "#components.distinfo">7.2. <code class=
4930: "filename">distinfo</code></a></span></dt>
1.1 grant 4931:
4932: <dt><span class="sect1"><a href=
4933: "#components.patches">7.3. patches/*</a></span></dt>
4934:
1.17 ! sketch 4935: <dt><span class="sect1"><a href="#id2586341">7.4. Other
1.1 grant 4936: mandatory files</a></span></dt>
4937:
4938: <dt><span class="sect1"><a href=
4939: "#components.optional">7.5. Optional
4940: files</a></span></dt>
4941:
1.17 ! sketch 4942: <dt><span class="sect1"><a href="#id2586535">7.6.
1.14 xtraeme 4943: <code class="filename">work*</code></a></span></dt>
1.1 grant 4944:
1.17 ! sketch 4945: <dt><span class="sect1"><a href="#id2586622">7.7.
1.14 xtraeme 4946: <code class="filename">files/*</code></a></span></dt>
1.1 grant 4947: </dl>
4948: </div>
4949:
4950: <p>Whenever you're preparing a package, there are a number
4951: of files involved which are described in the following
4952: sections.</p>
4953:
4954: <div class="sect1" lang="en" xml:lang="en">
4955: <div class="titlepage">
4956: <div>
4957: <div>
4958: <h2 class="title" style="clear: both"><a name=
4959: "components.Makefile" id=
1.14 xtraeme 4960: "components.Makefile"></a>7.1. <code class=
4961: "filename">Makefile</code></h2>
1.1 grant 4962: </div>
4963: </div>
4964: </div>
4965:
4966: <p>Building, installation and creation of a binary
1.14 xtraeme 4967: package are all controlled by the package's <code class=
4968: "filename">Makefile</code>.</p>
1.1 grant 4969:
1.14 xtraeme 4970: <p>There is a <code class="filename">Makefile</code> for
4971: each package. This file includes the standard
4972: <code class="filename">bsd.pkg.mk</code> file (referenced
4973: as <code class="filename">../../mk/bsd.pkg.mk</code>),
4974: which sets all the definitions and actions necessary for
4975: the package to compile and install itself. The mandatory
4976: variables are the <code class="varname">DISTNAME</code>
4977: which specifies the base name of the distribution file to
4978: be downloaded from the site on the Internet, <code class=
4979: "varname">MASTER_SITES</code> which specifies that site,
4980: <code class="varname">CATEGORIES</code> which denotes the
4981: categories into which the package falls, <code class=
4982: "varname">PKGNAME</code> which is the name of the
4983: package, the <code class="varname">MAINTAINER</code>'s
4984: name, and the <code class="varname">COMMENT</code>
4985: variable, which should contain a one-line description of
4986: the package (the package name should not appear, it will
4987: be added automatically). The maintainer variable is there
4988: so that anyone who quibbles with the (always completely
4989: correct) decisions taken by the guy who maintains the
4990: package can complain vigorously, or send chocolate as a
4991: sign of appreciation.</p>
1.1 grant 4992:
1.14 xtraeme 4993: <p>The <code class="varname">MASTER_SITES</code> may be
4994: set to one of the predefined sites:</p>
1.1 grant 4995: <pre class="programlisting">
4996: ${MASTER_SITE_APACHE}
4997: ${MASTER_SITE_DEBIAN}
4998: ${MASTER_SITE_GNOME}
4999: ${MASTER_SITE_GNU}
5000: ${MASTER_SITE_GNUSTEP}
1.9 dillo 5001: ${MASTER_SITE_IFARCHIVE}
1.1 grant 5002: ${MASTER_SITE_MOZILLA}
5003: ${MASTER_SITE_PERL_CPAN}
5004: ${MASTER_SITE_SOURCEFORGE}
5005: ${MASTER_SITE_SUNSITE}
5006: ${MASTER_SITE_R_CRAN}
5007: ${MASTER_SITE_SUSE}
5008: ${MASTER_SITE_TEX_CTAN}
5009: ${MASTER_SITE_XCONTRIB}
5010: ${MASTER_SITE_XEMACS}
5011: </pre>
5012:
5013: <p>If one of these predefined sites is chosen, you may
5014: require the ability to specify a subdirectory of that
5015: site. Since these macros may expand to more than one
5016: actual site, you <span class=
5017: "emphasis"><em>must</em></span> use the following
5018: construct to specify a subdirectory:</p>
5019: <pre class="programlisting">
5020: ${MASTER_SITE_GNU:=subdirectory/name/}
5021: ${MASTER_SITE_SOURCEFORGE:=project_name/}
5022: </pre>
5023:
5024: <p>Note the trailing slash after the subdirectory
5025: name.</p>
5026:
5027: <div class="note" style=
5028: "margin-left: 0.5in; margin-right: 0.5in;">
5029: <h3 class="title">Note</h3>
5030:
1.14 xtraeme 5031: <p><code class="varname">MASTER_SITE_SUBDIR</code> has
5032: been deprecated and <span class="emphasis"><em>should
5033: no longer be used</em></span>.</p>
1.1 grant 5034: </div>
5035:
1.14 xtraeme 5036: <p>If the package has multiple <code class=
5037: "varname">DISTFILES</code> or multiple <code class=
5038: "varname">PATCHFILES</code> from different sites, set
5039: <code class="varname">SITES_foo</code> to a list of URI's
1.1 grant 5040: where file “<span class="quote">foo</span>”
5041: may be found. “<span class=
5042: "quote">foo</span>” includes the suffix, e.g.</p>
5043: <pre class="programlisting">
5044: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
5045: DISTFILES+= foo-file.tar.gz
5046: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
5047: http://www.somewhereelse.com/mirror/somehow/
5048: </pre>
5049:
1.14 xtraeme 5050: <p>Note that the normal default setting of <code class=
5051: "varname">DISTFILES</code> must be made explicit if you
1.1 grant 5052: want to add to it (rather than replace it), as you
5053: usually would.</p>
5054:
5055: <p>Currently the following values are available for
1.14 xtraeme 5056: <code class="varname">CATEGORIES</code>. If more than one
5057: is used, they need to be separated by spaces:</p>
1.1 grant 5058: <pre class="programlisting">
5059: archivers cross geography meta-pkgs security
5060: audio databases graphics misc shells
5061: benchmarks devel ham multimedia sysutils
5062: biology editors inputmethod net textproc
5063: cad emulators lang news time
5064: chat finance mail parallel wm
5065: comms fonts math pkgtools www
5066: converters games mbone print x11
5067: </pre>
5068:
5069: <p>Please pay attention to the following gotchas:</p>
5070:
5071: <div class="itemizedlist">
5072: <ul type="disc">
5073: <li>
1.14 xtraeme 5074: <p>Add <code class="varname">MANCOMPRESSED</code>
5075: if manpages are installed in compressed form by the
5076: package; see comment in <code class=
5077: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 5078: </li>
5079:
5080: <li>
1.14 xtraeme 5081: <p>Replace <code class="filename">/usr/local</code>
1.1 grant 5082: with “<span class=
5083: "quote">${PREFIX}</span>” in all files (see
5084: patches, below).</p>
5085: </li>
5086:
5087: <li>
5088: <p>If the package installs any info files, see
5089: <a href="#faq.info-files" title=
5090: "12.5.10. Packages installing info files">Section
5091: 12.5.10, “Packages installing info
5092: files”</a>.</p>
5093: </li>
5094:
5095: <li>
1.14 xtraeme 5096: <p>Set <code class="varname">MAINTAINER</code> to
5097: be yourself. If you really can't maintain the
5098: package for future updates, set it to <code class=
1.1 grant 5099: "email"><<a href=
1.14 xtraeme 5100: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.1 grant 5101: </li>
5102:
5103: <li>
5104: <p>If a home page for the software in question
1.14 xtraeme 5105: exists, add the variable <code class=
5106: "varname">HOMEPAGE</code> right after <code class=
5107: "varname">MAINTAINER</code>. The value of this
1.1 grant 5108: variable should be the URL for the home page.</p>
5109: </li>
5110:
5111: <li>
1.14 xtraeme 5112: <p>Be sure to set the <code class=
5113: "varname">COMMENT</code> variable to a short
1.1 grant 5114: description of the package, not containing the
5115: pkg's name.</p>
5116: </li>
5117: </ul>
5118: </div>
5119: </div>
5120:
5121: <div class="sect1" lang="en" xml:lang="en">
5122: <div class="titlepage">
5123: <div>
5124: <div>
5125: <h2 class="title" style="clear: both"><a name=
5126: "components.distinfo" id=
1.14 xtraeme 5127: "components.distinfo"></a>7.2. <code class=
5128: "filename">distinfo</code></h2>
1.1 grant 5129: </div>
5130: </div>
5131: </div>
5132:
5133: <p>Most important, the mandatory message digest, or
5134: checksum, of all the distfiles needed for the package to
5135: compile, confirming they match the original file
5136: distributed by the author. This ensures that the distfile
5137: retrieved from the Internet has not been corrupted during
5138: transfer or altered by a malign force to introduce a
1.14 xtraeme 5139: security hole. It is generated using the
5140: <span><strong class="command">make
5141: makesum</strong></span> command. The digest algorithm
5142: used was, at one stage, md5, but that was felt lacking
5143: compared to sha1, and so sha1 is now the default
1.1 grant 5144: algorithm. The distfile size is also generated and stored
5145: in new distinfo files. The <a xmlns=
5146: "http://www.w3.org/TR/xhtml1/transitional" href=
5147: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.14 xtraeme 5148: class="pkgname">pkgtools/digest</a> utility calculates
5149: all of the digests in the distinfo file, and it provides
5150: various different algorithms. At the current time, the
5151: algorithms provided are: <span class=
5152: "emphasis"><em>md5</em></span>, <span class=
5153: "emphasis"><em>rmd160</em></span>, <span class=
5154: "emphasis"><em>sha1</em></span>, <span class=
5155: "emphasis"><em>sha256</em></span>, <span class=
5156: "emphasis"><em>sha384</em></span> and <span class=
5157: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 5158:
5159: <p>Some packages have different sets of distfiles on a
5160: per architecture basis, for example <a xmlns=
5161: "http://www.w3.org/TR/xhtml1/transitional" href=
5162: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.14 xtraeme 5163: class="pkgname">www/navigator</a>). These are kept in the
5164: same distinfo file and care should be taken when
5165: upgrading such a package to ensure distfile information
5166: is not lost.</p>
1.1 grant 5167:
5168: <p>The message digest/checksum for all the official
1.14 xtraeme 5169: patches found in the <code class=
5170: "filename">patches/</code> directory (see <a href=
5171: "#components.patches" title=
1.1 grant 5172: "7.3. patches/*">Section 7.3,
5173: “patches/*”</a>) for the package is also
1.14 xtraeme 5174: stored in the <code class="filename">distinfo</code>
5175: file. This is a message digest/checksum of all lines in
5176: the patch file except the NetBSD RCS Id. This file is
5177: generated by invoking <span><strong class="command">make
5178: makepatchsum</strong></span> (or <span><strong class=
5179: "command">make mps</strong></span> if you're in a
5180: hurry).</p>
1.1 grant 5181: </div>
5182:
5183: <div class="sect1" lang="en" xml:lang="en">
5184: <div class="titlepage">
5185: <div>
5186: <div>
5187: <h2 class="title" style="clear: both"><a name=
5188: "components.patches" id=
5189: "components.patches"></a>7.3. patches/*</h2>
5190: </div>
5191: </div>
5192: </div>
5193:
5194: <p>This directory contains files that are used by the
5195: <a href=
5196: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
5197: <span class="citerefentry"><span class=
5198: "refentrytitle">patch</span>(1)</span></a> command to
5199: modify the sources as distributed in the distribution
5200: file into a form that will compile and run perfectly on
5201: NetBSD. The files are applied successively in alphabetic
5202: order (as returned by a shell “<span class=
5203: "quote">patches/patch-*</span>” glob expansion), so
1.14 xtraeme 5204: <code class="filename">patch-aa</code> is applied before
5205: <code class="filename">patch-ab</code>, etc.</p>
1.1 grant 5206:
1.14 xtraeme 5207: <p>The <code class="filename">patch-*</code> files should
5208: be in <span><strong class="command">diff
5209: -bu</strong></span> format, and apply without a fuzz to
5210: avoid problems. (To force patches to apply with fuzz you
5211: can set <code class=
5212: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 5213: not put changes for more than one file into a single
5214: patch-file, as this will make future modifications more
5215: difficult.</p>
5216:
5217: <p>Similar, a file should be patched at most once, not
5218: several times by several different patches. If a file
5219: needs several patches, they should be combined into one
5220: file.</p>
5221:
5222: <p>One important thing to mention is to pay attention
5223: that no RCS IDs get stored in the patch files, as these
5224: will cause problems when later checked into the NetBSD
1.14 xtraeme 5225: CVS tree. Use the <span><strong class=
5226: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 5227: "http://www.w3.org/TR/xhtml1/transitional" href=
5228: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.14 xtraeme 5229: class="pkgname">pkgtools/pkgdiff</a> package to avoid
5230: these problems.</p>
1.1 grant 5231:
5232: <p>For even more automation, we recommend using
1.14 xtraeme 5233: <span><strong class="command">mkpatches</strong></span>
5234: from the same package to make a whole set of patches. You
5235: just have to backup files before you edit them to
5236: <code class="filename">filename.orig</code>, e.g. with
5237: <span><strong class="command">cp -p filename
5238: filename.orig</strong></span> or, easier, by using
5239: <span><strong class="command">pkgvi</strong></span> again
5240: from the same package. If you upgrade a package this way,
5241: you can easily compare the new set of patches with the
5242: previously existing one with <span><strong class=
5243: "command">patchdiff</strong></span>.</p>
1.1 grant 5244:
5245: <p>When you have finished a package, remember to generate
5246: the checksums for the patch files by using the
1.14 xtraeme 5247: <span><strong class="command">make
5248: makepatchsum</strong></span> command, see <a href=
5249: "#components.distinfo" title=
1.5 hubertf 5250: "7.2. distinfo">Section 7.2,
1.14 xtraeme 5251: “<code class="filename">distinfo</code>”</a>.</p>
1.1 grant 5252:
5253: <p>Patch files that are distributed by the author or
1.14 xtraeme 5254: other maintainers can be listed in <code class=
5255: "varname">$PATCHFILES</code>.</p>
1.1 grant 5256:
5257: <p>If it is desired to store any patches that should not
5258: be committed into pkgsrc, they can be kept outside the
1.14 xtraeme 5259: pkgsrc tree in the <code class=
5260: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 5261: tree there is expected to have the same
5262: “<span class="quote">category/package</span>”
5263: structure as pkgsrc, and patches are expected to be
1.14 xtraeme 5264: stored inside these dirs (also known as <code class=
5265: "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
5266: you want to keep a private patch for <code class=
5267: "filename">pkgsrc/graphics/png</code>, keep it in
5268: <code class=
5269: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
5270: files in the named directory are expected to be patch
1.1 grant 5271: files, and <span class="emphasis"><em>they are applied
5272: after pkgsrc patches are applied</em></span>.</p>
5273: </div>
5274:
5275: <div class="sect1" lang="en" xml:lang="en">
5276: <div class="titlepage">
5277: <div>
5278: <div>
5279: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 5280: "id2586341" id="id2586341"></a>7.4. Other
1.1 grant 5281: mandatory files</h2>
5282: </div>
5283: </div>
5284: </div>
5285:
5286: <div class="variablelist">
5287: <dl>
1.14 xtraeme 5288: <dt><span class="term"><code class=
5289: "filename">DESCR</code></span></dt>
1.1 grant 5290:
5291: <dd>
5292: <p>A multi-line description of the piece of
5293: software. This should include any credits where
5294: they are due. Please bear in mind that others do
5295: not share your sense of humour (or spelling
5296: idiosyncrasies), and that others will read
5297: everything that you write here.</p>
5298: </dd>
5299:
1.14 xtraeme 5300: <dt><span class="term"><code class=
5301: "filename">PLIST</code></span></dt>
1.1 grant 5302:
5303: <dd>
5304: <p>This file governs the files that are installed
5305: on your system: all the binaries, manual pages,
5306: etc. There are other directives which may be
5307: entered in this file, to control the creation and
5308: deletion of directories, and the location of
5309: inserted files. See <a href="#plist" title=
5310: "Chapter 8. PLIST issues">Chapter 8,
5311: <i>PLIST issues</i></a> for more information.</p>
5312: </dd>
5313: </dl>
5314: </div>
5315: </div>
5316:
5317: <div class="sect1" lang="en" xml:lang="en">
5318: <div class="titlepage">
5319: <div>
5320: <div>
5321: <h2 class="title" style="clear: both"><a name=
5322: "components.optional" id=
5323: "components.optional"></a>7.5. Optional
5324: files</h2>
5325: </div>
5326: </div>
5327: </div>
5328:
5329: <div class="variablelist">
5330: <dl>
1.14 xtraeme 5331: <dt><span class="term"><code class=
5332: "filename">INSTALL</code></span></dt>
1.1 grant 5333:
5334: <dd>
5335: <p>This shell script is invoked twice by <a href=
5336: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5337: <span class="citerefentry"><span class=
5338: "refentrytitle">pkg_add</span>(1)</span></a>. First
5339: time after package extraction and before files are
5340: moved in place, the second time after the files to
5341: install are moved in place. This can be used to do
5342: any custom procedures not possible with @exec
1.14 xtraeme 5343: commands in <code class="filename">PLIST</code>.
5344: See <a href=
1.1 grant 5345: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5346: <span class="citerefentry"><span class=
5347: "refentrytitle">pkg_add</span>(1)</span></a> and
5348: <a href=
5349: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5350: <span class="citerefentry"><span class=
5351: "refentrytitle">pkg_create</span>(1)</span></a> for
5352: more information.</p>
5353: </dd>
5354:
1.14 xtraeme 5355: <dt><span class="term"><code class=
5356: "filename">DEINSTALL</code></span></dt>
1.1 grant 5357:
5358: <dd>
5359: <p>This script is executed before and after any
5360: files are removed. It is this script's
5361: responsibility to clean up any additional messy
5362: details around the package's installation, since
5363: all pkg_delete knows is how to delete the files
5364: created in the original distribution. See <a href=
5365: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
5366: <span class="citerefentry"><span class=
5367: "refentrytitle">pkg_delete</span>(1)</span></a> and
5368: <a href=
5369: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5370: <span class="citerefentry"><span class=
5371: "refentrytitle">pkg_create</span>(1)</span></a> for
5372: more information.</p>
5373: </dd>
5374:
1.14 xtraeme 5375: <dt><span class="term"><code class=
5376: "filename">MESSAGE</code></span></dt>
1.1 grant 5377:
5378: <dd>
5379: <p>Display this file after installation of the
5380: package. Useful for things like legal notices on
5381: almost-free software and hints for updating config
5382: files after installing modules for apache, PHP etc.
5383: Please note that you can modify variables in it
1.14 xtraeme 5384: easily by using <code class=
5385: "varname">MESSAGE_SUBST</code> in the package's
5386: <code class="filename">Makefile</code>:</p>
1.1 grant 5387: <pre class="programlisting">
5388: MESSAGE_SUBST+= SOMEVAR="somevalue"
5389: </pre>
5390:
5391: <p>replaces "${SOMEVAR}" with “<span class=
1.14 xtraeme 5392: "quote">somevalue</span>” in <code class=
5393: "filename">MESSAGE</code>.</p>
1.1 grant 5394: </dd>
5395: </dl>
5396: </div>
5397: </div>
5398:
5399: <div class="sect1" lang="en" xml:lang="en">
5400: <div class="titlepage">
5401: <div>
5402: <div>
5403: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 5404: "id2586535" id=
! 5405: "id2586535"></a>7.6. <code class=
1.14 xtraeme 5406: "filename">work*</code></h2>
1.1 grant 5407: </div>
5408: </div>
5409: </div>
5410:
1.14 xtraeme 5411: <p>When you type <span><strong class=
5412: "command">make</strong></span> the distribution files are
5413: unpacked into this directory. It can be removed by
5414: running <span><strong class="command">make
5415: clean</strong></span>. Besides the sources, this
5416: directory is also used to keep various timestamp
1.1 grant 5417: files.</p>
5418:
5419: <p>If a package doesn't create a subdirectory for itself
5420: (like GNU software does, for instance), but extracts
5421: itself in the current directory, you should set
1.14 xtraeme 5422: <code class="varname">WRKSRC</code> accordingly, e.g.
1.1 grant 5423: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
5424: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.14 xtraeme 5425: class="pkgname">editors/sam</a> again, but the quick
5426: answer is:</p>
1.1 grant 5427: <pre class="programlisting">
5428: WRKSRC= ${WRKDIR}
5429: </pre>
5430:
1.14 xtraeme 5431: <p>Please note that the old <code class=
5432: "varname">NO_WRKSUBDIR</code> has been deprecated and
1.1 grant 5433: should not be used. Also, if your package doesn't create
1.14 xtraeme 5434: a subdir with the name of <code class=
5435: "varname">DISTNAME</code> but some different name, set
5436: <code class="varname">WRKSRC</code> to point to the
5437: proper name in <code class="filename">${WRKDIR}</code>.
5438: See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5439: href=
1.1 grant 5440: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.14 xtraeme 5441: class="pkgname">lang/tcl</a> and <a xmlns=
5442: "http://www.w3.org/TR/xhtml1/transitional" href=
5443: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
5444: class="pkgname">x11/tk</a> for examples, and here is
5445: another one:</p>
1.1 grant 5446: <pre class="programlisting">
5447: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
5448: </pre>
5449:
5450: <p>The name of the working directory created by pkgsrc is
1.14 xtraeme 5451: <code class="filename">work</code> by default. If the
5452: same pkgsrc tree should be used on several different
5453: platforms, the variable <code class=
5454: "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
1.1 grant 5455: attach the platform to the directory name, e.g.
1.14 xtraeme 5456: <code class="filename">work.i386</code> or <code class=
5457: "filename">work.sparc</code>.</p>
1.1 grant 5458: </div>
5459:
5460: <div class="sect1" lang="en" xml:lang="en">
5461: <div class="titlepage">
5462: <div>
5463: <div>
5464: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 5465: "id2586622" id=
! 5466: "id2586622"></a>7.7. <code class=
1.14 xtraeme 5467: "filename">files/*</code></h2>
1.1 grant 5468: </div>
5469: </div>
5470: </div>
5471:
5472: <p>If you have any files that you wish to be placed in
5473: the package prior to configuration or building, you could
5474: place these files here and use a “<span class=
5475: "quote">${CP}</span>” command in the
5476: “<span class="quote">pre-configure</span>”
5477: target to achieve this. Alternatively, you could simply
1.14 xtraeme 5478: diff the file against <code class=
5479: "filename">/dev/null</code> and use the patch mechanism
5480: to manage the creation of this file.</p>
1.1 grant 5481: </div>
5482: </div>
5483:
5484: <div class="chapter" lang="en" xml:lang="en">
5485: <div class="titlepage">
5486: <div>
5487: <div>
5488: <h2 class="title"><a name="plist" id=
5489: "plist"></a>Chapter 8. PLIST issues</h2>
5490: </div>
5491: </div>
5492: </div>
5493:
5494: <div class="toc">
5495: <p><b>Table of Contents</b></p>
5496:
5497: <dl>
1.17 ! sketch 5498: <dt><span class="sect1"><a href="#id2586677">8.1. RCS
1.1 grant 5499: ID</a></span></dt>
5500:
1.17 ! sketch 5501: <dt><span class="sect1"><a href="#id2586692">8.2.
1.14 xtraeme 5502: Semi-automatic <code class="filename">PLIST</code>
5503: generation</a></span></dt>
1.1 grant 5504:
5505: <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14 xtraeme 5506: Tweaking output of <span><strong class="command">make
5507: print-PLIST</strong></span></a></span></dt>
1.1 grant 5508:
5509: <dt><span class="sect1"><a href="#plist.misc">8.4.
5510: Variable substitution in PLIST</a></span></dt>
5511:
1.17 ! sketch 5512: <dt><span class="sect1"><a href="#id2587081">8.5.
1.1 grant 5513: Manpage-compression</a></span></dt>
5514:
1.17 ! sketch 5515: <dt><span class="sect1"><a href="#id2587123">8.6.
1.14 xtraeme 5516: Changing PLIST source with <code class=
5517: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5518:
1.17 ! sketch 5519: <dt><span class="sect1"><a href="#id2587140">8.7.
1.1 grant 5520: Platform specific and differing PLISTs</a></span></dt>
5521:
5522: <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
5523: Sharing directories between packages</a></span></dt>
5524: </dl>
5525: </div>
5526:
1.14 xtraeme 5527: <p>The <code class="filename">PLIST</code> file contains a
1.1 grant 5528: package's “<span class="quote">packing
5529: list</span>”, i.e. a list of files that belong to the
1.14 xtraeme 5530: package (relative to the <code class=
5531: "filename">${PREFIX}</code> directory it's been installed
5532: in) plus some additional statements - see the <a href=
1.1 grant 5533: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5534: <span class="citerefentry"><span class=
5535: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
5536: a full list. This chapter addresses some issues that need
1.14 xtraeme 5537: attention when dealing with the <code class=
5538: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 5539:
5540: <div class="sect1" lang="en" xml:lang="en">
5541: <div class="titlepage">
5542: <div>
5543: <div>
5544: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 5545: "id2586677" id="id2586677"></a>8.1. RCS
1.1 grant 5546: ID</h2>
5547: </div>
5548: </div>
5549: </div>
5550:
5551: <p>Be sure to add a RCS ID line as the first thing in any
1.14 xtraeme 5552: <code class="filename">PLIST</code> file you write:</p>
1.1 grant 5553: <pre class="programlisting">
1.17 ! sketch 5554: @comment $NetBSD$
1.1 grant 5555: </pre>
5556: </div>
5557:
5558: <div class="sect1" lang="en" xml:lang="en">
5559: <div class="titlepage">
5560: <div>
5561: <div>
5562: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 5563: "id2586692" id=
! 5564: "id2586692"></a>8.2. Semi-automatic
1.14 xtraeme 5565: <code class="filename">PLIST</code> generation</h2>
1.1 grant 5566: </div>
5567: </div>
5568: </div>
5569:
1.14 xtraeme 5570: <p>You can use the <span><strong class="command">make
5571: print-PLIST</strong></span> command to output a PLIST
5572: that matches any new files since the package was
5573: extracted. See <a href="#build.helpful-targets" title=
1.1 grant 5574: "11.3. Other helpful targets">Section 11.3,
5575: “Other helpful targets”</a> for more
5576: information on this target.</p>
5577: </div>
5578:
5579: <div class="sect1" lang="en" xml:lang="en">
5580: <div class="titlepage">
5581: <div>
5582: <div>
5583: <h2 class="title" style="clear: both"><a name=
5584: "print-PLIST" id=
5585: "print-PLIST"></a>8.3. Tweaking output of
1.14 xtraeme 5586: <span><strong class="command">make
5587: print-PLIST</strong></span></h2>
1.1 grant 5588: </div>
5589: </div>
5590: </div>
5591:
5592: <p>If you have used any of the *-dirs packages, as
5593: explained in <a href="#faq.common-dirs" title=
5594: "8.8. Sharing directories between packages">Section 8.8,
5595: “Sharing directories between packages”</a>,
1.14 xtraeme 5596: you may have noticed that <span><strong class=
5597: "command">make print-PLIST</strong></span> outputs a set
5598: of <code class="varname">@comment</code>s instead of real
5599: <code class="varname">@dirrm</code> lines. You can also
5600: do this for specific directories and files, so that the
5601: results of that command are very close to reality. This
5602: helps <span class="emphasis"><em>a lot</em></span> during
5603: the update of packages.</p>
5604:
5605: <p>The <code class="varname">PRINT_PLIST_AWK</code>
5606: variable takes a set of AWK patterns and actions that are
5607: used to filter the output of print-PLIST. You can
5608: <span class="emphasis"><em>append</em></span> any chunk
5609: of AWK scripting you like to it, but be careful with
1.1 grant 5610: quoting.</p>
5611:
1.14 xtraeme 5612: <p>For example, to get all files inside the <code class=
5613: "filename">libdata/foo</code> directory removed from the
1.1 grant 5614: resulting PLIST:</p>
5615: <pre class="programlisting">
5616: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
5617:
5618: </pre>
5619:
1.14 xtraeme 5620: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 5621: lines referring to a specific (shared) directory
1.14 xtraeme 5622: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 5623: <pre class="programlisting">
5624: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
5625:
5626: </pre>
5627: </div>
5628:
5629: <div class="sect1" lang="en" xml:lang="en">
5630: <div class="titlepage">
5631: <div>
5632: <div>
5633: <h2 class="title" style="clear: both"><a name=
5634: "plist.misc" id="plist.misc"></a>8.4. Variable
5635: substitution in PLIST</h2>
5636: </div>
5637: </div>
5638: </div>
5639:
5640: <p>A number of variables are substituted automatically in
5641: PLISTs when a package is installed on a system. This
5642: includes the following variables:</p>
5643:
5644: <div class="variablelist">
5645: <dl>
1.14 xtraeme 5646: <dt><span class="term"><code class=
5647: "varname">${MACHINE_ARCH}</code>, <code class=
5648: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 5649:
5650: <dd>
5651: <p>Some packages like emacs and perl embed
5652: information about which architecture they were
5653: built on into the pathnames where they install
5654: their file. To handle this case, PLIST will be
5655: preprocessed before actually used, and the symbol
1.14 xtraeme 5656: “<span class="quote"><code class=
5657: "varname">${MACHINE_ARCH}</code></span>” will
5658: be replaced by what <span><strong class=
5659: "command">uname -p</strong></span> gives. The same
5660: is done if the string <code class=
5661: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
5662: PLIST somewhere - use this on packages that have
5663: GNU autoconf created configure scripts.</p>
1.1 grant 5664:
5665: <div class="note" style=
5666: "margin-left: 0.5in; margin-right: 0.5in;">
5667: <h3 class="title">Legacy note</h3>
5668:
5669: <p>There used to be a symbol “<span class=
1.14 xtraeme 5670: "quote"><code class=
5671: "varname">$ARCH</code></span>” that was
5672: replaced by the output of <span><strong class=
5673: "command">uname -m</strong></span>, but that's no
1.1 grant 5674: longer supported and has been removed.</p>
5675: </div>
5676: </dd>
5677:
1.14 xtraeme 5678: <dt><span class="term"><code class=
5679: "varname">${OPSYS}</code>, <code class=
5680: "varname">${LOWER_OPSYS}</code>, <code class=
5681: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 5682:
5683: <dd>
5684: <p>Some packages want to embed the OS name and
5685: version into some paths. To do this, use these
1.14 xtraeme 5686: variables in the <code class=
5687: "filename">PLIST</code>:</p>
1.1 grant 5688:
5689: <div class="itemizedlist">
5690: <ul type="disc">
5691: <li>
1.14 xtraeme 5692: <p><code class="varname">${OPSYS}</code> -
5693: output of “<span class=
5694: "quote"><span><strong class="command">uname
5695: -s</strong></span></span>”</p>
1.1 grant 5696: </li>
5697:
5698: <li>
1.14 xtraeme 5699: <p><code class=
5700: "varname">${LOWER_OPSYS}</code> - lowercase
5701: common name (eg. “<span class=
5702: "quote">solaris</span>”)</p>
1.1 grant 5703: </li>
5704:
5705: <li>
1.14 xtraeme 5706: <p><code class="varname">${OS_VERSION}</code>
5707: - “<span class=
5708: "quote"><span><strong class="command">uname
5709: -r</strong></span></span>”</p>
1.1 grant 5710: </li>
5711: </ul>
5712: </div>
5713: </dd>
5714:
1.14 xtraeme 5715: <dt><span class="term"><code class=
5716: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 5717:
5718: <dd>
5719: <p>Packages that install locale files should list
5720: them in the PLIST as “<span class=
5721: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
5722: instead of “<span class=
5723: "quote">share/locale/de/LC_MESSAGES/...</span>”.
5724: This properly handles the fact that different
5725: operating systems expect locale files to be either
1.14 xtraeme 5726: in <code class="filename">share</code> or
5727: <code class="filename">lib</code> by default.</p>
1.1 grant 5728: </dd>
5729: </dl>
5730: </div>
5731:
5732: <p>For a complete list of values which are replaced by
1.14 xtraeme 5733: default, please look in <code class=
5734: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 5735: "emphasis"><em>PLIST_SUBST</em></span>).</p>
5736:
5737: <p>If you want to change other variables not listed
5738: above, you can add variables and their expansions to this
1.14 xtraeme 5739: variable in the following way, similar to <code class=
5740: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 5741: "#components.optional" title=
5742: "7.5. Optional files">Section 7.5,
5743: “Optional files”</a>):</p>
5744: <pre class="programlisting">
5745: PLIST_SUBST+= SOMEVAR="somevalue"
5746: </pre>
5747:
5748: <p>This replaces all occurrences of “<span class=
5749: "quote">${SOMEVAR}</span>” in the PLIST with
5750: “<span class="quote">somevalue</span>”.</p>
5751: </div>
5752:
5753: <div class="sect1" lang="en" xml:lang="en">
5754: <div class="titlepage">
5755: <div>
5756: <div>
5757: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 5758: "id2587081" id=
! 5759: "id2587081"></a>8.5. Manpage-compression</h2>
1.1 grant 5760: </div>
5761: </div>
5762: </div>
5763:
5764: <p>Manpages should be installed in compressed form if
1.14 xtraeme 5765: <code class="varname">MANZ</code> is set (in <code class=
5766: "filename">bsd.own.mk</code>), and uncompressed
5767: otherwise. To handle this in the <code class=
5768: "filename">PLIST</code> file, the suffix
5769: “<span class="quote">.gz</span>” is
5770: appended/removed automatically for manpages according to
5771: <code class="varname">MANZ</code> and <code class=
5772: "varname">MANCOMPRESSED</code> being set or not, see
5773: above for details. This modification of the <code class=
5774: "filename">PLIST</code> file is done on a copy of it, not
5775: <code class="filename">PLIST</code> itself.</p>
1.1 grant 5776: </div>
5777:
5778: <div class="sect1" lang="en" xml:lang="en">
5779: <div class="titlepage">
5780: <div>
5781: <div>
5782: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 5783: "id2587123" id="id2587123"></a>8.6. Changing
1.14 xtraeme 5784: PLIST source with <code class=
5785: "varname">PLIST_SRC</code></h2>
1.1 grant 5786: </div>
5787: </div>
5788: </div>
5789:
1.14 xtraeme 5790: <p>To use one or more files as source for the
5791: <code class="filename">PLIST</code> used in generating
5792: the binary package, set the variable <code class=
5793: "varname">PLIST_SRC</code> to the names of that file(s).
1.1 grant 5794: The files are later concatenated using cat(1), and order
5795: of things is important.</p>
5796: </div>
5797:
5798: <div class="sect1" lang="en" xml:lang="en">
5799: <div class="titlepage">
5800: <div>
5801: <div>
5802: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 5803: "id2587140" id="id2587140"></a>8.7. Platform
1.1 grant 5804: specific and differing PLISTs</h2>
5805: </div>
5806: </div>
5807: </div>
5808:
5809: <p>Some packages decide to install a different set of
5810: files based on the operating system being used. These
5811: differences can be automatically handled by using the
5812: following files:</p>
5813:
5814: <div class="itemizedlist">
5815: <ul type="disc">
5816: <li>
1.14 xtraeme 5817: <p><code class="filename">PLIST.common</code></p>
1.1 grant 5818: </li>
5819:
5820: <li>
1.14 xtraeme 5821: <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1 grant 5822: </li>
5823:
5824: <li>
1.14 xtraeme 5825: <p><code class=
5826: "filename">PLIST.common_end</code></p>
1.1 grant 5827: </li>
5828: </ul>
5829: </div>
5830:
1.14 xtraeme 5831: <p>If <code class="filename">PLIST.${OPSYS}</code>
5832: exists, these files are used instead of <code class=
5833: "filename">PLIST</code>. This allows packages which
5834: behave in this way to be handled gracefully. Manually
5835: overriding <code class="varname">PLIST_SRC</code> for
5836: other more exotic uses is also possible.</p>
1.1 grant 5837: </div>
5838:
5839: <div class="sect1" lang="en" xml:lang="en">
5840: <div class="titlepage">
5841: <div>
5842: <div>
5843: <h2 class="title" style="clear: both"><a name=
5844: "faq.common-dirs" id=
5845: "faq.common-dirs"></a>8.8. Sharing directories
5846: between packages</h2>
5847: </div>
5848: </div>
5849: </div>
5850:
5851: <p>A “<span class="quote">shared
5852: directory</span>” is a directory where multiple
5853: (and unrelated) packages install files. These directories
5854: are problematic because you have to add special tricks in
5855: the PLIST to conditionally remove them, or have some
5856: centralized package handle them.</p>
5857:
5858: <p>Within pkgsrc, you'll find both approaches. If a
5859: directory is shared by a few unrelated packages, it's
5860: often not worth to add an extra package to remove it.
5861: Therefore, one simply does:</p>
5862: <pre class="programlisting">
5863: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
5864:
5865: </pre>
5866:
5867: <p>in the PLISTs of all affected packages, instead of the
5868: regular "@dirrm" line.</p>
5869:
5870: <p>However, if the directory is shared across many
5871: packages, two different solutions are available:</p>
5872:
5873: <div class="orderedlist">
5874: <ol type="1">
5875: <li>
5876: <p>If the packages have a common dependency, the
5877: directory can be removed in that. For example, see
5878: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
5879: href=
5880: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.14 xtraeme 5881: class="pkgname">textproc/scrollkeeper</a>, which
5882: removes the shared directory <code class=
5883: "filename">share/omf</code>.</p>
1.1 grant 5884: </li>
5885:
5886: <li>
5887: <p>If the packages using the directory are not
5888: related at all (they have no common dependencies),
5889: a *-dirs package is used.</p>
5890: </li>
5891: </ol>
5892: </div>
5893:
5894: <p>From now on, we'll discuss the second solution. To get
5895: an idea of the *-dirs packages available, issue:</p>
5896: <pre class="programlisting">
1.14 xtraeme 5897: <code class="prompt">%</code> cd .../pkgsrc
5898: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 5899:
5900: </pre>
5901:
5902: <p>Their use from other packages is very simple. The
1.14 xtraeme 5903: <code class="varname">USE_DIRS</code> variable takes a
5904: list of package names (without the “<span class=
1.1 grant 5905: "quote">-dirs</span>” part) together with the
5906: required version number (always pick the latest one when
5907: writting new packages).</p>
5908:
5909: <p>For example, if a package installs files under
1.14 xtraeme 5910: <code class="filename">share/applications</code>, it
5911: should have the following line in it:</p>
1.1 grant 5912: <pre class="programlisting">
5913: USE_DIRS+= xdg-1.1
5914:
5915: </pre>
5916:
1.14 xtraeme 5917: <p>After regenerating the PLIST using
5918: <span><strong class="command">make
5919: print-PLIST</strong></span>, you should get the right
5920: (commented out) lines.</p>
1.1 grant 5921:
1.14 xtraeme 5922: <p>Note that, even if your package is using <code class=
5923: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 5924: *-x11-dirs packages. Just specify the name without that
1.14 xtraeme 5925: part and pkgsrc (in particular, <code class=
5926: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 5927: </div>
5928: </div>
5929:
5930: <div class="chapter" lang="en" xml:lang="en">
5931: <div class="titlepage">
5932: <div>
5933: <div>
5934: <h2 class="title"><a name="buildlink" id=
5935: "buildlink"></a>Chapter 9. Buildlink
5936: methodology</h2>
5937: </div>
5938: </div>
5939: </div>
5940:
5941: <div class="toc">
5942: <p><b>Table of Contents</b></p>
5943:
5944: <dl>
1.17 ! sketch 5945: <dt><span class="sect1"><a href="#id2587480">9.1.
1.1 grant 5946: Converting packages to use buildlink3</a></span></dt>
5947:
1.17 ! sketch 5948: <dt><span class="sect1"><a href="#id2587739">9.2.
1.14 xtraeme 5949: Writing <code class="filename">buildlink3.mk</code>
5950: files</a></span></dt>
1.1 grant 5951:
5952: <dd>
5953: <dl>
1.17 ! sketch 5954: <dt><span class="sect2"><a href="#id2587809">9.2.1.
1.1 grant 5955: Anatomy of a buildlink3.mk file</a></span></dt>
5956:
1.17 ! sketch 5957: <dt><span class="sect2"><a href="#id2588249">9.2.2.
1.14 xtraeme 5958: Updating <code class=
5959: "varname">BUILDLINK_DEPENDS.<em class=
5960: "replaceable"><code>pkg</code></em></code> in
5961: <code class="filename">buildlink3.mk</code>
1.1 grant 5962: files</a></span></dt>
5963: </dl>
5964: </dd>
5965:
1.17 ! sketch 5966: <dt><span class="sect1"><a href="#id2588465">9.3.
1.14 xtraeme 5967: Writing <code class="filename">builtin.mk</code>
5968: files</a></span></dt>
1.1 grant 5969:
5970: <dd>
5971: <dl>
1.17 ! sketch 5972: <dt><span class="sect2"><a href="#id2588546">9.3.1.
1.14 xtraeme 5973: Anatomy of a <code class=
5974: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 5975:
1.17 ! sketch 5976: <dt><span class="sect2"><a href="#id2588773">9.3.2.
1.1 grant 5977: Global preferences for native or pkgsrc
5978: software</a></span></dt>
5979: </dl>
5980: </dd>
5981: </dl>
5982: </div>
5983:
5984: <p>Buildlink is a framework in pkgsrc that controls what
5985: headers and libraries are seen by a package's configure and
5986: build processes. This is implemented in a two step
5987: process:</p>
5988:
5989: <div class="orderedlist">
5990: <ol type="1">
5991: <li>
5992: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 5993: into <code class="varname">BUILDLINK_DIR</code>,
5994: which by default is a subdirectory of <code class=
5995: "varname">WRKDIR</code>.</p>
1.1 grant 5996: </li>
5997:
5998: <li>
5999: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 6000: the normal compiler tools that translate <code class=
6001: "option">-I${LOCALBASE}/include</code> and
6002: <code class="option">-L${LOCALBASE}/lib</code> into
6003: references to <code class=
6004: "varname">BUILDLINK_DIR</code>. The wrapper scripts
6005: also make native compiler on some operating systems
6006: look like GCC, so that packages that expect GCC won't
6007: require modifications to build with those native
6008: compilers.</p>
1.1 grant 6009: </li>
6010: </ol>
6011: </div>
6012:
6013: <p>This normalizes the environment in which a package is
6014: built so that the package may be built consistently despite
6015: what other software may be installed. Please note that the
1.14 xtraeme 6016: normal system header and library paths, e.g. <code class=
6017: "filename">/usr/include</code>, <code class=
6018: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 6019: buildlink3 is designed to insulate the package build from
6020: non-system-supplied software.</p>
6021:
6022: <div class="sect1" lang="en" xml:lang="en">
6023: <div class="titlepage">
6024: <div>
6025: <div>
6026: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 6027: "id2587480" id="id2587480"></a>9.1. Converting
1.1 grant 6028: packages to use buildlink3</h2>
6029: </div>
6030: </div>
6031: </div>
6032:
6033: <p>The process of converting packages to use the
6034: buildlink3 framework (“<span class=
6035: "quote">bl3ifying</span>”) is fairly
6036: straightforward. The things to keep in mind are:</p>
6037:
6038: <div class="orderedlist">
6039: <ol type="1">
6040: <li>
1.14 xtraeme 6041: <p>Set <code class="varname">USE_BUILDLINK3</code>
6042: to “<span class=
6043: "quote">yes</span>”.</p>
1.1 grant 6044: </li>
6045:
6046: <li>
6047: <p>Ensure that the build always calls the wrapper
6048: scripts instead of the actual toolchain. Some
6049: packages are tricky, and the only way to know for
1.14 xtraeme 6050: sure is the check <code class=
6051: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 6052: wrappers are being invoked.</p>
6053: </li>
6054:
6055: <li>
1.14 xtraeme 6056: <p>Don't override <code class=
6057: "varname">PREFIX</code> from within the package
6058: Makefile, e.g. Java VMs, standalone shells, etc.,
6059: because the code to symlink files into <code class=
6060: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 6061: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 6062: <em class=
6063: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 6064: </li>
6065:
6066: <li>
6067: <p>Remember that <span class=
1.14 xtraeme 6068: "emphasis"><em>only</em></span> the <code class=
6069: "filename">buildlink3.mk</code> files that you list
1.1 grant 6070: in a package's Makefile are added as dependencies
6071: for that package.</p>
6072: </li>
6073: </ol>
6074: </div>
6075:
6076: <p>If a dependency on a particular package is required
6077: for its libraries and headers, then we replace:</p>
6078: <pre class="programlisting">
6079: DEPENDS+= foo>=1.1.0:../../category/foo
6080: </pre>
6081:
6082: <p>with</p>
6083: <pre class="programlisting">
6084: .include "../../category/foo/buildlink3.mk"
6085: </pre>
6086:
1.14 xtraeme 6087: <p>There are several <code class=
6088: "filename">buildlink3.mk</code> files in <code class=
6089: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 6090: issues:</p>
6091:
6092: <div class="itemizedlist">
6093: <ul type="disc">
6094: <li>
1.14 xtraeme 6095: <p><code class="filename">bdb.buildlink3.mk</code>
1.1 grant 6096: chooses either the native or a pkgsrc Berkeley DB
1.14 xtraeme 6097: implementation based on the values of <code class=
6098: "varname">BDB_ACCEPTED</code> and <code class=
6099: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 6100: </li>
6101:
6102: <li>
1.14 xtraeme 6103: <p><code class=
6104: "filename">curses.buildlink3.mk</code> If the
6105: system comes with neither Curses nor NCurses, this
6106: will take care to install the <a xmlns=
6107: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 6108: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.14 xtraeme 6109: class="pkgname">devel/ncurses</a> package.</p>
1.1 grant 6110: </li>
6111:
6112: <li>
1.14 xtraeme 6113: <p><code class="filename">krb5.buildlink3.mk</code>
6114: uses the value of <code class=
6115: "varname">KRB5_ACCEPTED</code> to choose between
1.1 grant 6116: adding a dependency on Heimdal or MIT-krb5 for
6117: packages that require a Kerberos 5
6118: implementation.</p>
6119: </li>
6120:
6121: <li>
1.14 xtraeme 6122: <p><code class=
6123: "filename">motif.buildlink3.mk</code> checks for a
6124: system-provided Motif installation or adds a
6125: dependency on <a xmlns=
1.1 grant 6126: "http://www.w3.org/TR/xhtml1/transitional" href=
6127: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.14 xtraeme 6128: class="pkgname">x11/lesstif</a> or <a xmlns=
6129: "http://www.w3.org/TR/xhtml1/transitional" href=
6130: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
6131: class="pkgname">x11/openmotif</a>;</p>
1.1 grant 6132: </li>
6133:
6134: <li>
1.14 xtraeme 6135: <p><code class=
6136: "filename">ossaudio.buildlink3.mk</code> defines
6137: several variables that may be used by packages that
6138: use the Open Sound System (OSS) API;</p>
1.1 grant 6139: </li>
6140:
6141: <li>
1.14 xtraeme 6142: <p><code class=
6143: "filename">pgsql.buildlink3.mk</code> will accept
6144: either Postgres 7.3 or 7.4, whichever is found
6145: installed. See the file for more information.</p>
1.1 grant 6146: </li>
6147:
6148: <li>
1.14 xtraeme 6149: <p><code class=
6150: "filename">pthread.buildlink3.mk</code> uses the
6151: value of <code class="varname">PTHREAD_OPTS</code>
6152: and checks for native pthreads or adds a dependency
6153: on <a xmlns=
1.1 grant 6154: "http://www.w3.org/TR/xhtml1/transitional" href=
6155: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.14 xtraeme 6156: class="pkgname">devel/pth</a> as needed;</p>
1.1 grant 6157: </li>
6158:
6159: <li>
1.14 xtraeme 6160: <p><code class="filename">xaw.buildlink3.mk</code>
6161: uses the value of <code class=
6162: "varname">XAW_TYPE</code> to choose a particular
6163: Athena widgets library.</p>
1.1 grant 6164: </li>
6165: </ul>
6166: </div>
6167:
1.14 xtraeme 6168: <p>The comments in those <code class=
6169: "filename">buildlink3.mk</code> files provide a more
1.1 grant 6170: complete description of how to use them properly.</p>
6171: </div>
6172:
6173: <div class="sect1" lang="en" xml:lang="en">
6174: <div class="titlepage">
6175: <div>
6176: <div>
6177: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 6178: "id2587739" id="id2587739"></a>9.2. Writing
1.14 xtraeme 6179: <code class="filename">buildlink3.mk</code>
6180: files</h2>
1.1 grant 6181: </div>
6182: </div>
6183: </div>
6184:
1.14 xtraeme 6185: <p>A package's <code class=
6186: "filename">buildlink3.mk</code> file is included by
6187: Makefiles to indicate the need to compile and link
6188: against header files and libraries provided by the
6189: package. A <code class="filename">buildlink3.mk</code>
6190: file should always provide enough information to add the
6191: correct type of dependency relationship and include any
6192: other <code class="filename">buildlink3.mk</code> files
6193: that it needs to find headers and libraries that it needs
6194: in turn.</p>
1.1 grant 6195:
1.14 xtraeme 6196: <p>To generate an initial <code class=
6197: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 6198: Rene Hexel's <a xmlns=
6199: "http://www.w3.org/TR/xhtml1/transitional" href=
6200: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.14 xtraeme 6201: class="pkgname">pkgtools/createbuildlink</a> package is
6202: highly recommended. For most packages, the following
6203: command will generate a good starting point for
6204: <code class="filename">buildlink3.mk</code> files:</p>
1.1 grant 6205: <pre class="screen">
1.14 xtraeme 6206: <code class="prompt">%</code> <strong class=
6207: "userinput"><code>cd pkgsrc/<em class=
6208: "replaceable"><code>category</code></em>/<em class=
6209: "replaceable"><code>pkgdir</code></em>
6210: <code class=
6211: "prompt">%</code> createbuildlink -3 >buildlink3.mk</code></strong>
1.1 grant 6212: </pre>
6213:
6214: <div class="sect2" lang="en" xml:lang="en">
6215: <div class="titlepage">
6216: <div>
6217: <div>
1.17 ! sketch 6218: <h3 class="title"><a name="id2587809" id=
! 6219: "id2587809"></a>9.2.1. Anatomy of a buildlink3.mk
1.1 grant 6220: file</h3>
6221: </div>
6222: </div>
6223: </div>
6224:
1.14 xtraeme 6225: <p>The following real-life example <code class=
6226: "filename">buildlink3.mk</code> is taken from
6227: <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 6228: <pre class="programlisting">
1.17 ! sketch 6229: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 6230:
6231: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
6232: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
6233:
6234: .if !empty(BUILDLINK_DEPTH:M+)
6235: BUILDLINK_DEPENDS+= tiff
6236: .endif
6237:
6238: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
6239: BUILDLINK_PACKAGES+= tiff
6240:
6241: .if !empty(TIFF_BUILDLINK3_MK:M+)
6242: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
6243: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
6244: .endif # TIFF_BUILDLINK3_MK
6245:
6246: .include "../../devel/zlib/buildlink3.mk"
6247: .include "../../graphics/jpeg/buildlink3.mk"
6248:
6249: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
6250: </pre>
6251:
1.14 xtraeme 6252: <p>The header and footer manipulate <code class=
6253: "varname">BUILDLINK_DEPTH</code>, which is common
6254: across all <code class="filename">buildlink3.mk</code>
6255: files and is used to track at what depth we are
6256: including <code class="filename">buildlink3.mk</code>
6257: files.</p>
1.1 grant 6258:
6259: <p>The first section controls if the dependency on
1.14 xtraeme 6260: <em class="replaceable"><code>pkg</code></em> is added.
6261: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 6262: global list of packages for which dependencies are
6263: added by buildlink3.</p>
6264:
6265: <p>The second section advises pkgsrc that the
1.14 xtraeme 6266: <code class="filename">buildlink3.mk</code> file for
6267: <em class="replaceable"><code>pkg</code></em> has been
6268: included at some point. <code class=
6269: "varname">BUILDLINK_PACKAGES</code> is the global list
6270: of packages for which <code class=
6271: "filename">buildlink3.mk</code> files have been
6272: included. It must <span class=
6273: "emphasis"><em>always</em></span> be appended to within
6274: a <code class="filename">buildlink3.mk</code> file.</p>
1.1 grant 6275:
6276: <p>The third section is protected from multiple
1.14 xtraeme 6277: inclusion and controls how the dependency on <em class=
6278: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 6279: important variables are set in the section:</p>
6280:
6281: <div class="itemizedlist">
6282: <ul type="disc">
6283: <li>
1.14 xtraeme 6284: <p><code class=
6285: "varname">BUILDLINK_DEPENDS.<em class=
6286: "replaceable"><code>pkg</code></em></code> is the
6287: actual dependency recorded in the installed
6288: package; this should always be set using
6289: <span><strong class="command">+=</strong></span>
6290: to ensure that we're appending to any
6291: pre-existing list of values. This variable should
6292: be set to the first version of the package that
6293: had the last change in the major number of a
6294: shared library or that had a major API
6295: change.</p>
1.1 grant 6296: </li>
6297:
6298: <li>
1.14 xtraeme 6299: <p><code class=
6300: "varname">BUILDLINK_PKGSRCDIR.<em class=
6301: "replaceable"><code>pkg</code></em></code> is the
6302: location of the <em class=
6303: "replaceable"><code>pkg</code></em> pkgsrc
1.1 grant 6304: directory;</p>
6305: </li>
6306:
6307: <li>
1.14 xtraeme 6308: <p><code class=
6309: "varname">BUILDLINK_DEPMETHOD.<em class=
6310: "replaceable"><code>pkg</code></em></code> (not
6311: shown above) controls whether we use <code class=
6312: "varname">BUILD_DEPENDS</code> or <code class=
6313: "varname">DEPENDS</code> to add the dependency on
6314: <em class="replaceable"><code>pkg</code></em>.
6315: The build dependency is selected by setting
6316: <code class=
6317: "varname">BUILDLINK_DEPMETHOD.<em class=
6318: "replaceable"><code>pkg</code></em></code> to
1.1 grant 6319: “<span class="quote">build</span>”.
6320: By default, the full dependency is used.</p>
6321: </li>
6322:
6323: <li>
1.14 xtraeme 6324: <p><code class=
6325: "varname">BUILDLINK_INCDIRS.<em class=
6326: "replaceable"><code>pkg</code></em></code> and
6327: <code class=
6328: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
6329: <code>pkg</code></em></code> (not shown above)
6330: are lists of subdirectories of <code class=
6331: "filename">${BUILDLINK_PREFIX.<em class=
6332: "replaceable"><code>pkg</code></em>}</code> to
6333: add to the header and library search paths. These
1.1 grant 6334: default to “<span class=
6335: "quote">include</span>” and
6336: “<span class="quote">lib</span>”
6337: respectively.</p>
6338: </li>
6339:
6340: <li>
1.14 xtraeme 6341: <p><code class=
6342: "varname">BUILDLINK_CPPFLAGS.<em class=
6343: "replaceable"><code>pkg</code></em></code> (not
6344: shown above) is the list of preprocessor flags to
6345: add to <code class="varname">CPPFLAGS</code>,
6346: which are passed on to the configure and build
6347: phases. The “<span class=
6348: "quote">-I</span>” option should be avoided
6349: and instead be handled using <code class=
6350: "varname">BUILDLINK_INCDIRS.<em class=
6351: "replaceable"><code>pkg</code></em></code> as
6352: above.</p>
1.1 grant 6353: </li>
6354: </ul>
6355: </div>
6356:
6357: <p>The following variables are all optionally defined
6358: within this second section (protected against multiple
6359: inclusion) and control which package files are
1.14 xtraeme 6360: symlinked into <code class=
6361: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 6362: are transformed during the symlinking:</p>
6363:
6364: <div class="itemizedlist">
6365: <ul type="disc">
6366: <li>
1.14 xtraeme 6367: <p><code class=
6368: "varname">BUILDLINK_FILES.<em class=
6369: "replaceable"><code>pkg</code></em></code> (not
6370: shown above) is a shell glob pattern relative to
6371: <code class=
6372: "filename">${BUILDLINK_PREFIX.<em class=
6373: "replaceable"><code>pkg</code></em>}</code> to be
6374: symlinked into <code class=
6375: "filename">${BUILDLINK_DIR}</code>, e.g.
6376: <code class="filename">include/*.h</code>.</p>
1.1 grant 6377: </li>
6378:
6379: <li>
1.14 xtraeme 6380: <p><code class=
6381: "varname">BUILDLINK_FILES_CMD.<em class=
6382: "replaceable"><code>pkg</code></em></code> (not
6383: shown above) is a shell pipeline that outputs to
6384: stdout a list of files relative to <code class=
6385: "filename">${BUILDLINK_PREFIX.<em class=
6386: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 6387: resulting files are to be symlinked into
1.14 xtraeme 6388: <code class="filename">${BUILDLINK_DIR}</code>.
6389: By default, this takes the <code class=
6390: "filename">+CONTENTS</code> of a <em class=
6391: "replaceable"><code>pkg</code></em> and filters
6392: it through <code class=
6393: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
6394: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 6395: </li>
6396:
6397: <li>
1.14 xtraeme 6398: <p><code class=
6399: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
6400: "replaceable"><code>pkg</code></em></code> (not
6401: shown above) is a filter command that filters
6402: <code class="filename">+CONTENTS</code> input
6403: into a list of files relative to <code class=
6404: "filename">${BUILDLINK_PREFIX.<em class=
6405: "replaceable"><code>pkg</code></em>}</code> on
6406: stdout. By default for overwrite packages,
6407: <code class=
6408: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
6409: "replaceable"><code>pkg</code></em></code>
6410: outputs the contents of the <code class=
6411: "filename">include</code> and <code class=
6412: "filename">lib</code> directories in the package
6413: <code class="filename">+CONTENTS</code>, and for
6414: pkgviews packages, it outputs any libtool
6415: archives in <code class="filename">lib</code>
1.1 grant 6416: directories.</p>
6417: </li>
6418:
6419: <li>
1.14 xtraeme 6420: <p><code class=
6421: "varname">BUILDLINK_TRANSFORM.<em class=
6422: "replaceable"><code>pkg</code></em></code> (not
6423: shown above) is a list of sed arguments used to
1.1 grant 6424: transform the name of the source filename into a
1.14 xtraeme 6425: destination filename, e.g. <span><strong class=
1.1 grant 6426: "command">-e
1.14 xtraeme 6427: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 6428: </li>
6429: </ul>
6430: </div>
6431:
1.14 xtraeme 6432: <p>The last section includes any <code class=
6433: "filename">buildlink3.mk</code> needed for <em class=
6434: "replaceable"><code>pkg</code></em>'s library
6435: dependencies. Including these <code class=
6436: "filename">buildlink3.mk</code> files means that the
6437: headers and libraries for these dependencies are also
6438: symlinked into <code class=
6439: "filename">${BUILDLINK_DIR}</code> whenever the
6440: <em class="replaceable"><code>pkg</code></em>
6441: <code class="filename">buildlink3.mk</code> file is
6442: included.</p>
1.1 grant 6443: </div>
6444:
6445: <div class="sect2" lang="en" xml:lang="en">
6446: <div class="titlepage">
6447: <div>
6448: <div>
1.17 ! sketch 6449: <h3 class="title"><a name="id2588249" id=
! 6450: "id2588249"></a>9.2.2. Updating <code class=
1.14 xtraeme 6451: "varname">BUILDLINK_DEPENDS.<em class=
6452: "replaceable"><code>pkg</code></em></code> in
6453: <code class="filename">buildlink3.mk</code>
6454: files</h3>
1.1 grant 6455: </div>
6456: </div>
6457: </div>
6458:
6459: <p>There are two situations that require increasing the
1.14 xtraeme 6460: dependency listed in <code class=
6461: "varname">BUILDLINK_DEPENDS.<em class=
6462: "replaceable"><code>pkg</code></em></code> after a
6463: package update:</p>
1.1 grant 6464:
6465: <div class="orderedlist">
6466: <ol type="1">
6467: <li>
6468: <p>if the sonames (major number of the library
6469: version) of any installed shared libraries
6470: change;</p>
6471: </li>
6472:
6473: <li>
6474: <p>if the API or interface to the header files
6475: change.</p>
6476: </li>
6477: </ol>
6478: </div>
6479:
1.14 xtraeme 6480: <p>In these cases, <code class=
6481: "varname">BUILDLINK_DEPENDS.<em class=
6482: "replaceable"><code>pkg</code></em></code> should be
6483: adjusted to require at least the new package version.
6484: In some cases, the packages that depend on this new
6485: version may need their <code class=
6486: "varname">PKGREVISION</code>s increased and, if they
6487: have <code class="filename">buildlink3.mk</code> files,
6488: their <code class=
6489: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
6490: pkg</code></em></code> adjusted, too. This is needed so
6491: that binary packages made using it will require the
6492: correct package dependency and not settle for an older
6493: one which will not contain the necessary shared
6494: libraries.</p>
1.1 grant 6495:
6496: <p>Please take careful consideration before adjusting
1.14 xtraeme 6497: <code class="varname">BUILDLINK_DEPENDS.<em class=
6498: "replaceable"><code>pkg</code></em></code> as we don't
6499: want to cause unneeded package deletions and rebuilds.
6500: In many cases, new versions of packages work just fine
6501: with older dependencies. See <a href="#dependencies"
6502: title="12.1.3. Handling dependencies">Section
6503: 12.1.3, “Handling dependencies”</a> and
6504: <a href="#buildlink" title=
1.1 grant 6505: "Chapter 9. Buildlink methodology">Chapter 9,
6506: <i>Buildlink methodology</i></a> for more information
6507: about dependencies on other packages, including the
1.14 xtraeme 6508: <code class="varname">BUILDLINK_RECOMMENDED</code> and
6509: <code class="varname">RECOMMENDED</code>
6510: definitions.</p>
1.1 grant 6511: </div>
6512: </div>
6513:
6514: <div class="sect1" lang="en" xml:lang="en">
6515: <div class="titlepage">
6516: <div>
6517: <div>
6518: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 6519: "id2588465" id="id2588465"></a>9.3. Writing
1.14 xtraeme 6520: <code class="filename">builtin.mk</code> files</h2>
1.1 grant 6521: </div>
6522: </div>
6523: </div>
6524:
6525: <p>Some packages in pkgsrc install headers and libraries
6526: that coincide with headers and libraries present in the
1.14 xtraeme 6527: base system. Aside from a <code class=
6528: "filename">buildlink3.mk</code> file, these packages
6529: should also include a <code class=
6530: "filename">builtin.mk</code> file that includes the
6531: necessary checks to decide whether using the built-in
6532: software or the pkgsrc software is appropriate.</p>
1.1 grant 6533:
6534: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 6535: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 6536:
6537: <div class="orderedlist">
6538: <ol type="1">
6539: <li>
1.14 xtraeme 6540: <p>It should set <code class=
6541: "varname">USE_BUILTIN.<em class=
6542: "replaceable"><code>pkg</code></em></code> to
6543: either “<span class="quote">yes</span>”
6544: or “<span class="quote">no</span>”
6545: after it is included.</p>
1.1 grant 6546: </li>
6547:
6548: <li>
6549: <p>It should <span class=
6550: "emphasis"><em>not</em></span> override any
1.14 xtraeme 6551: <code class="varname">USE_BUILTIN.<em class=
6552: "replaceable"><code>pkg</code></em></code> which is
6553: already set before the <code class=
6554: "filename">builtin.mk</code> file is included.</p>
1.1 grant 6555: </li>
6556:
6557: <li>
6558: <p>It should be written to allow multiple
6559: inclusion. This is <span class=
6560: "emphasis"><em>very</em></span> important and takes
1.14 xtraeme 6561: careful attention to <code class=
6562: "filename">Makefile</code> coding.</p>
1.1 grant 6563: </li>
6564: </ol>
6565: </div>
6566:
6567: <div class="sect2" lang="en" xml:lang="en">
6568: <div class="titlepage">
6569: <div>
6570: <div>
1.17 ! sketch 6571: <h3 class="title"><a name="id2588546" id=
! 6572: "id2588546"></a>9.3.1. Anatomy of a
1.14 xtraeme 6573: <code class="filename">builtin.mk</code>
6574: file</h3>
1.1 grant 6575: </div>
6576: </div>
6577: </div>
6578:
6579: <p>The following is the recommended template for
6580: builtin.mk files:</p>
6581: <pre class="programlisting">
6582: .if !defined(IS_BUILTIN.foo)
6583: #
6584: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
6585: # genuinely exists in the system or not.
6586: #
6587: IS_BUILTIN.foo?= no
6588:
6589: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
6590: # version can be determined.
6591: #
6592: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
6593: BUILTIN_PKG.foo?= foo-1.0
6594: . endif
6595: .endif # IS_BUILTIN.foo
6596:
6597: .if !defined(USE_BUILTIN.foo)
6598: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
6599: . if defined(BUILTIN_PKG.foo)
6600: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
6601: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
6602: USE_BUILTIN.foo!= \
6603: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
6604: ${ECHO} "yes"; \
6605: else \
6606: ${ECHO} "no"; \
6607: fi
6608: . endif
6609: . endfor
6610: . endif
6611: .endif # USE_BUILTIN.foo
6612:
6613: CHECK_BUILTIN.foo?= no
6614: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
6615: #
6616: # Here we place code that depends on whether USE_BUILTIN.foo is set to
6617: # "yes" or "no".
6618: #
6619: .endif # CHECK_BUILTIN.foo
6620:
6621: </pre>
6622:
1.14 xtraeme 6623: <p>The first section sets <code class=
6624: "varname">IS_BUILTIN.<em class=
6625: "replaceable"><code>pkg</code></em></code> depending on
6626: if <em class="replaceable"><code>pkg</code></em> really
6627: exists in the base system. This should not be a base
6628: system software with similar functionality to
6629: <em class="replaceable"><code>pkg</code></em>; it
6630: should only be “<span class=
6631: "quote">yes</span>” if the actual package is
6632: included as part of the base system. This variable is
6633: only used internally within the <code class=
6634: "filename">builtin.mk</code> file.</p>
6635:
6636: <p>The second section sets <code class=
6637: "varname">BUILTIN_PKG.<em class=
6638: "replaceable"><code>pkg</code></em></code> to the
6639: version of <em class=
6640: "replaceable"><code>pkg</code></em> in the base system
6641: if it exists (if <code class=
6642: "varname">IS_BUILTIN.<em class=
6643: "replaceable"><code>pkg</code></em></code> is
1.1 grant 6644: “<span class="quote">yes</span>”). This
1.14 xtraeme 6645: variable is only used internally within the
6646: <code class="filename">builtin.mk</code> file.</p>
1.1 grant 6647:
1.14 xtraeme 6648: <p>The third section sets <code class=
6649: "varname">USE_BUILTIN.<em class=
6650: "replaceable"><code>pkg</code></em></code> and is
6651: <span class="emphasis"><em>required</em></span> in all
6652: <code class="filename">builtin.mk</code> files. The
6653: code in this section must make the determination
6654: whether the built-in software is adequate to satisfy
6655: the dependencies listed in <code class=
6656: "varname">BUILDLINK_DEPENDS.<em class=
6657: "replaceable"><code>pkg</code></em></code>. This is
6658: typically done by comparing <code class=
6659: "varname">BUILTIN_PKG.<em class=
6660: "replaceable"><code>pkg</code></em></code> against each
6661: of the dependencies in <code class=
6662: "varname">BUILDLINK_DEPENDS.<em class=
6663: "replaceable"><code>pkg</code></em></code>.
6664: <code class="varname">USE_BUILTIN.<em class=
6665: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 6666: "emphasis"><em>must</em></span> be set to the correct
1.14 xtraeme 6667: value by the end of the <code class=
6668: "filename">builtin.mk</code> file. Note that
6669: <code class="varname">USE_BUILTIN.<em class=
6670: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 6671: “<span class="quote">yes</span>” even if
1.14 xtraeme 6672: <code class="varname">IS_BUILTIN.<em class=
6673: "replaceable"><code>pkg</code></em></code> is
1.1 grant 6674: “<span class="quote">no</span>” because we
6675: may make the determination that the built-in version of
6676: the software is similar enough to be used as a
6677: replacement.</p>
6678:
1.14 xtraeme 6679: <p>The last section is guarded by <code class=
6680: "varname">CHECK_BUILTIN.<em class=
6681: "replaceable"><code>pkg</code></em></code>, and
6682: includes code that uses the value of <code class=
6683: "varname">USE_BUILTIN.<em class=
6684: "replaceable"><code>pkg</code></em></code> set in the
6685: previous section. This typically includes, e.g., adding
1.1 grant 6686: additional dependency restrictions and listing
1.14 xtraeme 6687: additional files to symlink into <code class=
6688: "filename">${BUILDLINK_DIR}</code> (via <code class=
6689: "varname">BUILDLINK_FILES.<em class=
6690: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 6691: </div>
6692:
6693: <div class="sect2" lang="en" xml:lang="en">
6694: <div class="titlepage">
6695: <div>
6696: <div>
1.17 ! sketch 6697: <h3 class="title"><a name="id2588773" id=
! 6698: "id2588773"></a>9.3.2. Global preferences
1.1 grant 6699: for native or pkgsrc software</h3>
6700: </div>
6701: </div>
6702: </div>
6703:
6704: <p>When building packages, it's possible to choose
6705: whether to set a global preference for using either the
6706: built-in (native) version or the pkgsrc version of
6707: software to satisfy a dependency. This is controlled by
1.14 xtraeme 6708: setting <code class="varname">PREFER_PKGSRC</code> and
6709: <code class="varname">PREFER_NATIVE</code>. These
6710: variables take values of either “<span class=
1.1 grant 6711: "quote">yes</span>”, “<span class=
6712: "quote">no</span>”, or a list of packages.
1.14 xtraeme 6713: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
6714: to use the pkgsrc versions of software, while
6715: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
6716: to use the built-in versions. Preferences are
6717: determined by the most specific instance of the package
6718: in either <code class="varname">PREFER_PKGSRC</code> or
6719: <code class="varname">PREFER_NATIVE</code>. If a
6720: package is specified in neither or in both variables,
6721: then <code class="varname">PREFER_PKGSRC</code> has
6722: precedence over <code class=
6723: "varname">PREFER_NATIVE</code>. For example, to require
6724: using pkgsrc versions of software for all but the most
6725: basic bits on a NetBSD system, you can set:</p>
1.1 grant 6726: <pre class="programlisting">
6727: PREFER_PKGSRC= yes
6728: PREFER_NATIVE= getopt skey tcp_wrappers
6729:
6730: </pre>
6731:
6732: <p>A package <span class=
1.14 xtraeme 6733: "emphasis"><em>must</em></span> have a <code class=
6734: "filename">builtin.mk</code> file to be listed in
6735: <code class="varname">PREFER_NATIVE</code>, otherwise
6736: it is simply ignored in that list.</p>
1.1 grant 6737: </div>
6738: </div>
6739: </div>
6740:
6741: <div class="chapter" lang="en" xml:lang="en">
6742: <div class="titlepage">
6743: <div>
6744: <div>
6745: <h2 class="title"><a name="options" id=
6746: "options"></a>Chapter 10. Options
6747: handling</h2>
6748: </div>
6749: </div>
6750: </div>
6751:
6752: <div class="toc">
6753: <p><b>Table of Contents</b></p>
6754:
6755: <dl>
1.17 ! sketch 6756: <dt><span class="sect1"><a href="#id2588845">10.1.
1.1 grant 6757: Global default options</a></span></dt>
6758:
1.17 ! sketch 6759: <dt><span class="sect1"><a href="#id2588860">10.2.
1.14 xtraeme 6760: Converting packages to use <code class=
6761: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 6762: </dl>
6763: </div>
6764:
6765: <p>Many packages have the ability to be built to support
1.14 xtraeme 6766: different sets of features. <code class=
6767: "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1 grant 6768: that provides generic handling of those options that
6769: determine different ways in which the packages can be
6770: built. It's possible for the user to specify exactly which
6771: sets of options will be built into a package or to allow a
6772: set of global default options apply.</p>
6773:
6774: <div class="sect1" lang="en" xml:lang="en">
6775: <div class="titlepage">
6776: <div>
6777: <div>
6778: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 6779: "id2588845" id="id2588845"></a>10.1. Global
1.1 grant 6780: default options</h2>
6781: </div>
6782: </div>
6783: </div>
6784:
1.14 xtraeme 6785: <p>Global default options are listed in <code class=
6786: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1 grant 6787: the options that should be built into every package if
6788: that option is supported. This variable should be set in
1.14 xtraeme 6789: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 6790: </div>
6791:
6792: <div class="sect1" lang="en" xml:lang="en">
6793: <div class="titlepage">
6794: <div>
6795: <div>
6796: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 6797: "id2588860" id=
! 6798: "id2588860"></a>10.2. Converting packages to
1.14 xtraeme 6799: use <code class=
6800: "filename">bsd.options.mk</code></h2>
1.1 grant 6801: </div>
6802: </div>
6803: </div>
6804:
1.14 xtraeme 6805: <p>The following example shows how <code class=
6806: "filename">bsd.options.mk</code> should be use in a
6807: package <code class="filename">Makefile</code>, or in a
6808: file, e.g. <code class="filename">options.mk</code>, that
6809: is included by the main package <code class=
6810: "filename">Makefile</code>.</p>
1.1 grant 6811: <pre class="programlisting">
6812: # Global and legacy options
6813: .if defined(WIBBLE_USE_OPENLDAP) && !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
6814: PKG_DEFAULT_OPTIONS+= ldap
6815: .endif
6816: .if defined(USE_SASL2) && !empty(USE_SASL2:M[yY][eE][sS])
6817: PKG_DEFAULT_OPTIONS+= sasl
6818: .endif
6819:
6820: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
6821: PKG_SUPPORTED_OPTIONS= ldap sasl
6822: #
6823: # Default options for "wibble" package.
6824: #
6825: .if !defined(PKG_OPTIONS.wibble)
6826: PKG_DEFAULT_OPTIONS+= sasl
6827: endif
6828: .include "../../mk/bsd.options.mk"
6829:
6830: # Package-specific option-handling
6831:
6832: ###
6833: ### LDAP support
6834: ###
6835: .if !empty(PKG_OPTIONS:Mldap)
6836: . include "../../databases/openldap/buildlink3.mk"
6837: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
6838: .endif
6839:
6840: ###
6841: ### SASL authentication
6842: ###
6843: .if !empty(PKG_OPTIONS:Msasl)
6844: . include "../../security/cyrus-sasl2/buildlink3.mk"
6845: CONFIGURE_ARGS+= --enable-sasl=${BUILDLINK_PREFIX.sasl}
6846: .endif
6847:
6848: </pre>
6849:
6850: <p>The first section only exists if you are converting a
6851: package that had its own ad-hoc options handling to use
1.14 xtraeme 6852: <code class="filename">bsd.options.mk</code>. It converts
1.1 grant 6853: global or legacy options variables into an equivalent
1.14 xtraeme 6854: <code class="varname">PKG_OPTIONS.<em class=
6855: "replaceable"><code>pkg</code></em></code> value. These
6856: sections will be removed over time as the old options are
6857: in turn deprecated and removed.</p>
1.1 grant 6858:
6859: <p>The second section contains the information about
6860: which build options are supported by the package, and any
6861: default options settings if needed.</p>
6862:
6863: <div class="orderedlist">
6864: <ol type="1">
6865: <li>
1.14 xtraeme 6866: <p><code class="varname">PKG_OPTIONS_VAR</code> is
6867: a list of the name of the <a href=
1.1 grant 6868: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6869: <span class="citerefentry"><span class=
6870: "refentrytitle">make</span>(1)</span></a> variables
6871: that contain the options the user wishes to select.
6872: The recommended value is “<span class=
1.14 xtraeme 6873: "quote">PKG_OPTIONS.<em class=
6874: "replaceable"><code>pkg</code></em></span>”
6875: but any package-specific value may be used. This
1.1 grant 6876: variable should be set in a package Makefile.</p>
6877: </li>
6878:
6879: <li>
1.14 xtraeme 6880: <p><code class=
6881: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
6882: build options supported by the package. This
6883: variable should be set in a package Makefile.</p>
1.1 grant 6884: </li>
6885:
6886: <li>
1.14 xtraeme 6887: <p><code class="varname">${PKG_OPTIONS_VAR}</code>
6888: (the variables named in <code class=
6889: "varname">PKG_OPTIONS_VAR</code>) are variables
6890: that list the selected build options and override
6891: any default options given in <code class=
6892: "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1 grant 6893: options begin with a “<span class=
6894: "quote">-</span>”, then that option is always
6895: removed from the selected build options, e.g.</p>
6896: <pre class="programlisting">
6897: PKG_DEFAULT_OPTIONS= kerberos ldap sasl
6898: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
6899: WIBBLE_OPTIONS= ${PKG_DEFAULT_OPTIONS} -sasl
6900: # implies PKG_OPTIONS == "kerberos ldap"
6901:
6902: </pre>
6903:
6904: <p>or</p>
6905: <pre class="programlisting">
6906: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
6907: WIBBLE_OPTIONS= kerberos -ldap ldap
6908: # implies PKG_OPTIONS == "kerberos"
6909:
6910: </pre>
6911:
1.14 xtraeme 6912: <p>This variable should be set in <code class=
6913: "filename">/etc/mk.conf</code>.</p>
1.1 grant 6914: </li>
6915: </ol>
6916: </div>
6917:
6918: <p>After the inclusion of bsd.options.mk, the following
6919: variables are set:</p>
6920:
6921: <div class="itemizedlist">
6922: <ul type="disc">
6923: <li>
1.14 xtraeme 6924: <p><code class="varname">PKG_OPTIONS</code>
6925: contains the list of the selected build options,
6926: properly filtered to remove unsupported and
6927: duplicate options.</p>
1.1 grant 6928: </li>
6929: </ul>
6930: </div>
6931:
6932: <p>The remaining sections contain the logic that is
6933: specific to each option. There should be a check for
1.14 xtraeme 6934: every option listed in <code class=
6935: "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
6936: be clear documentation on what turning on the option will
6937: do in the comments preceding each section. The correct
6938: way to check for an option is to check whether it is
6939: listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1 grant 6940: </div>
6941: </div>
6942:
6943: <div class="chapter" lang="en" xml:lang="en">
6944: <div class="titlepage">
6945: <div>
6946: <div>
6947: <h2 class="title"><a name="build" id=
6948: "build"></a>Chapter 11. The build
6949: process</h2>
6950: </div>
6951: </div>
6952: </div>
6953:
6954: <div class="toc">
6955: <p><b>Table of Contents</b></p>
6956:
6957: <dl>
6958: <dt><span class="sect1"><a href="#build.prefix">11.1.
6959: Program location</a></span></dt>
6960:
1.17 ! sketch 6961: <dt><span class="sect1"><a href="#id2589468">11.2. Main
1.1 grant 6962: targets</a></span></dt>
6963:
6964: <dt><span class="sect1"><a href=
6965: "#build.helpful-targets">11.3. Other helpful
6966: targets</a></span></dt>
6967: </dl>
6968: </div>
6969:
6970: <p>The basic steps for building a program are always the
6971: same. First the program's source (<span class=
6972: "emphasis"><em>distfile</em></span>) must be brought to the
6973: local system and then extracted. After any patches to
6974: compile properly on NetBSD are applied, the software can be
6975: configured, then built (usually by compiling), and finally
6976: the generated binaries, etc. can be put into place on the
6977: system. These are exactly the steps performed by the NetBSD
6978: package system, which is implemented as a series of targets
1.14 xtraeme 6979: in a central Makefile, <code class=
6980: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 6981:
6982: <div class="sect1" lang="en" xml:lang="en">
6983: <div class="titlepage">
6984: <div>
6985: <div>
6986: <h2 class="title" style="clear: both"><a name=
6987: "build.prefix" id=
6988: "build.prefix"></a>11.1. Program location</h2>
6989: </div>
6990: </div>
6991: </div>
6992:
6993: <p>Before outlining the process performed by the NetBSD
6994: package system in the next section, here's a brief
6995: discussion on where programs are installed, and which
6996: variables influence this.</p>
6997:
1.14 xtraeme 6998: <p>The automatic variable <code class=
6999: "varname">PREFIX</code> indicates where all files of the
7000: final program shall be installed. It is usually set to
7001: <code class="varname">LOCALBASE</code> (<code class=
7002: "filename">/usr/pkg</code>), or <code class=
7003: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 7004: “<span class="quote">cross</span>” category.
1.14 xtraeme 7005: The value of <code class="varname">PREFIX</code> needs to
7006: be put into the various places in the program's source
7007: where paths to these files are encoded. See <a href=
1.1 grant 7008: "#components.patches" title=
7009: "7.3. patches/*">Section 7.3,
7010: “patches/*”</a> and <a href="#fixes.libtool"
7011: title=
7012: "12.3.1. Shared libraries - libtool">Section 12.3.1,
7013: “Shared libraries - libtool”</a> for more
7014: details.</p>
7015:
7016: <p>When choosing which of these variables to use, follow
7017: the following rules:</p>
7018:
7019: <div class="itemizedlist">
7020: <ul type="disc">
7021: <li>
1.14 xtraeme 7022: <p><code class="varname">PREFIX</code> always
7023: points to the location where the current pkg will
7024: be installed. When referring to a pkg's own
1.1 grant 7025: installation path, use “<span class=
7026: "quote">${PREFIX}</span>”.</p>
7027: </li>
7028:
7029: <li>
1.14 xtraeme 7030: <p><code class="varname">LOCALBASE</code> is where
7031: all non-X11 pkgs are installed. If you need to
1.1 grant 7032: construct a -I or -L argument to the compiler to
7033: find includes and libraries installed by another
7034: non-X11 pkg, use “<span class=
7035: "quote">${LOCALBASE}</span>”.</p>
7036: </li>
7037:
7038: <li>
1.14 xtraeme 7039: <p><code class="varname">X11BASE</code> is where
7040: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 7041: installed. When looking for <span class=
7042: "emphasis"><em>standard</em></span> X11 includes
7043: (not those installed by a pkg), use
7044: “<span class=
7045: "quote">${X11BASE}</span>”.</p>
7046: </li>
7047:
7048: <li>
7049: <p>X11 based are special in that they may be
1.14 xtraeme 7050: installed in either <code class=
7051: "varname">X11BASE</code> or <code class=
7052: "varname">LOCALBASE</code>.</p>
1.1 grant 7053:
7054: <p>Usually, X11 packages should be installed under
1.14 xtraeme 7055: <code class="varname">LOCALBASE</code> whenever
7056: possible. Note that you will need to set
7057: <code class="varname">USE_X11</code> in them to
7058: request the presence of X11 and to get the right
7059: compilation flags.</p>
1.1 grant 7060:
7061: <p>Even though, there are some packages that cannot
1.14 xtraeme 7062: be installed under <code class=
7063: "varname">LOCALBASE</code>: those that come with
1.1 grant 7064: app-defaults files. These packages are special and
1.14 xtraeme 7065: they must be placed under <code class=
7066: "varname">X11BASE</code>. To accomplish this, set
7067: either <code class="varname">USE_X11BASE</code> or
7068: <code class="varname">USE_IMAKE</code> in your
1.1 grant 7069: package.</p>
7070:
1.14 xtraeme 7071: <p>Some notes: <code class="varname">USE_X11</code>
7072: and <code class="varname">USE_X11BASE</code> are
7073: mutually exclusive. If you need to find includes or
7074: libraries installed by a pkg that has <code class=
7075: "varname">USE_IMAKE</code> or <code class=
7076: "varname">USE_X11BASE</code> in its pkg
7077: <code class="filename">Makefile</code>, you need to
7078: use <span class="emphasis"><em>both</em></span>
7079: <code class="filename">${X11BASE}</code> and
7080: <code class="filename">${LOCALBASE}</code>. To
7081: force installation of all X11 packages in
7082: <code class="varname">LOCALBASE</code>, the
7083: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
7084: href=
1.1 grant 7085: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.14 xtraeme 7086: class="pkgname">pkgtools/xpkgwedge</a> is enabled
7087: by default.</p>
1.1 grant 7088: </li>
7089:
7090: <li>
1.14 xtraeme 7091: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 7092: used to refer to the installed location of an X11
1.14 xtraeme 7093: package. <code class="varname">X11PREFIX</code>
7094: will be set to <code class="varname">X11BASE</code>
7095: if xpkgwedge is not installed, and to <code class=
7096: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 7097: installed.</p>
7098: </li>
7099:
7100: <li>
7101: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 7102: have some packages installed in <code class=
7103: "varname">X11BASE</code> and some in <code class=
7104: "varname">LOCALBASE</code>. To determine the prefix
7105: of an installed package, the <code class=
7106: "varname">EVAL_PREFIX</code> definition can be
7107: used. It takes pairs in the format
7108: “<span class=
1.1 grant 7109: "quote">DIRNAME=<package></span>”, and
1.14 xtraeme 7110: the make(1) variable <code class=
7111: "varname">DIRNAME</code> will be set to the prefix
7112: of the installed package <package>, or
1.1 grant 7113: “<span class=
7114: "quote">${X11PREFIX}</span>” if the package
7115: is not installed.</p>
7116:
7117: <p>This is best illustrated by example.</p>
7118:
1.14 xtraeme 7119: <p>The following lines are taken from <code class=
7120: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 7121: <pre class="programlisting">
1.14 xtraeme 7122: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 7123: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
7124: --with-gtk-prefix="${GTKDIR}" \
7125: --enable-multibyte
7126: </pre>
7127:
7128: <p>Specific defaults can be defined for the
1.14 xtraeme 7129: packages evaluated using <code class=
7130: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 7131: of the form:</p>
7132: <pre class="programlisting">
7133: GTKDIR_DEFAULT= ${LOCALBASE}
7134: </pre>
7135:
1.14 xtraeme 7136: <p>where <code class="varname">GTKDIR</code>
1.1 grant 7137: corresponds to the first definition in the
1.14 xtraeme 7138: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 7139: </li>
7140:
7141: <li>
1.14 xtraeme 7142: <p>Within <code class="filename">${PREFIX}</code>,
1.1 grant 7143: packages should install files according to hier(7),
7144: with the exception that manual pages go into
1.14 xtraeme 7145: <code class="filename">${PREFIX}/man</code>, not
7146: <code class=
7147: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 7148: </li>
7149: </ul>
7150: </div>
7151: </div>
7152:
7153: <div class="sect1" lang="en" xml:lang="en">
7154: <div class="titlepage">
7155: <div>
7156: <div>
7157: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 7158: "id2589468" id="id2589468"></a>11.2. Main
1.1 grant 7159: targets</h2>
7160: </div>
7161: </div>
7162: </div>
7163:
7164: <p>The main targets used during the build process defined
1.14 xtraeme 7165: in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 7166:
7167: <div class="variablelist">
7168: <dl>
7169: <dt><span class="term">fetch</span></dt>
7170:
7171: <dd>
7172: <p>This will check if the file(s) given in the
1.14 xtraeme 7173: variables <code class="varname">DISTFILES</code>
7174: and <code class="varname">PATCHFILES</code> (as
7175: defined in the package's Makefile) are present on
7176: the local system in <code class=
7177: "filename">/usr/pkgsrc/distfiles</code>. If they
7178: are not present, an attempt will be made to fetch
7179: them using commands of the form:</p>
1.1 grant 7180: <pre class="programlisting">
7181: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
7182: </pre>
7183:
7184: <p>where ${site} varies through several
1.14 xtraeme 7185: possibilities in turn: first, <code class=
7186: "varname">MASTER_SITE_OVERRIDE</code> is tried,
7187: then the sites specified in either <code class=
7188: "varname">SITES_file</code> if defined, else
7189: <code class="varname">MASTER_SITES</code> or
7190: <code class="varname">PATCH_SITES</code>, as
7191: applies, then finally the value of <code class=
7192: "varname">MASTER_SITE_BACKUP</code>. The order of
7193: all except the first can be optionally sorted by
7194: the user, via setting either <code class=
7195: "varname">MASTER_SORT_AWK</code> or <code class=
7196: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 7197: </dd>
7198:
7199: <dt><span class="term">checksum</span></dt>
7200:
7201: <dd>
7202: <p>After the distfile(s) are fetched, their
7203: checksum is generated and compared with the
7204: checksums stored in the distinfo file. If the
7205: checksums don't match, the build is aborted. This
7206: is to ensure the same distfile is used for
7207: building, and that the distfile wasn't changed,
7208: e.g. by some malign force, deliberately changed
7209: distfiles on the master distribution site or
7210: network lossage.</p>
7211: </dd>
7212:
7213: <dt><span class="term">extract</span></dt>
7214:
7215: <dd>
7216: <p>When the distfiles are present on the local
7217: system, they need to be extracted, as they are
7218: usually in the form of some compressed archive
1.14 xtraeme 7219: format, most commonly <code class=
7220: "filename">.tar.gz</code>.</p>
1.1 grant 7221:
7222: <p>If only some of the distfiles need to be
7223: uncompressed, the files to be uncompressed should
1.14 xtraeme 7224: be put into <code class=
7225: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 7226:
1.14 xtraeme 7227: <p>If the distfiles are not in <code class=
7228: "filename">.tar.gz</code> format, they can be
7229: extracted by setting either <code class=
7230: "varname">EXTRACT_SUFX</code>, or <code class=
7231: "varname">EXTRACT_CMD</code>, <code class=
7232: "varname">EXTRACT_BEFORE_ARGS</code> and
7233: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
7234: the former case, pkgsrc knows how to extract a
7235: number of suffixes (<code class=
7236: "filename">.tar.gz</code>, <code class=
7237: "filename">.tgz</code>, <code class=
7238: "filename">.tar.gz2</code>, <code class=
7239: "filename">.tbz</code>, <code class=
7240: "filename">.tar.Z</code>, <code class=
7241: "filename">.tar</code>, <code class=
7242: "filename">.shar.gz</code>, <code class=
7243: "filename">.shar.bz2</code>, <code class=
7244: "filename">.shar.Z</code>, <code class=
7245: "filename">.shar</code>, <code class=
7246: "filename">.Z</code>, <code class=
7247: "filename">.bz2</code> and <code class=
7248: "filename">.gz</code>; see the definition of the
7249: various <code class="varname">DECOMPRESS_CMD</code>
7250: variables <code class="filename">bsd.pkg.mk</code>
7251: for a complete list). Here's an example on how to
7252: use the other variables for a program that comes
7253: with a compressed shell archive whose name ends in
7254: <code class="filename">.msg.gz</code>:</p>
1.1 grant 7255: <pre class="programlisting">
7256: EXTRACT_SUFX= .msg.gz
7257: EXTRACT_CMD= zcat
7258: EXTRACT_BEFORE_ARGS=
7259: EXTRACT_AFTER_ARGS= |sh
7260: </pre>
7261: </dd>
7262:
7263: <dt><span class="term">patch</span></dt>
7264:
7265: <dd>
7266: <p>After extraction, all the patches named by the
1.14 xtraeme 7267: <code class="varname">PATCHFILES</code>, those
7268: present in the patches subdirectory of the package
7269: as well as in $LOCALPATCHES/$PKGPATH (e.g.
7270: <code class=
7271: "filename">/usr/local/patches/graphics/png</code>)
7272: are applied. Patchfiles ending in <code class=
7273: "filename">.Z</code> or <code class=
7274: "filename">.gz</code> are uncompressed before they
7275: are applied, files ending in <code class=
7276: "filename">.orig</code> or <code class=
7277: "filename">.rej</code> are ignored. Any special
7278: options to patch(1) can be handed in <code class=
7279: "varname">PATCH_DIST_ARGS</code>. See <a href=
7280: "#components.patches" title=
1.1 grant 7281: "7.3. patches/*">Section 7.3,
7282: “patches/*”</a> for more details.</p>
7283:
7284: <p>By default patch(1) is given special args to
7285: make it fail if the patches apply with some lines
7286: of fuzz. Please fix (regen) the patches so that
7287: they apply cleanly. The rationale behind this is
7288: that patches that don't apply cleanly may end up
7289: being applied in the wrong place, and cause severe
7290: harm there.</p>
7291: </dd>
7292:
7293: <dt><span class="term">configure</span></dt>
7294:
7295: <dd>
7296: <p>Most pieces of software need information on the
7297: header files, system calls, and library routines
7298: which are available in NetBSD. This is the process
7299: known as configuration, and is usually automated.
7300: In most cases, a script is supplied with the
7301: source, and its invocation results in generation of
7302: header files, Makefiles, etc.</p>
7303:
7304: <p>If the program's distfile contains its own
7305: configure script, this can be invoked by setting
1.14 xtraeme 7306: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 7307: configure script is a GNU autoconf script,
1.14 xtraeme 7308: <code class="varname">GNU_CONFIGURE</code> should
7309: be specified instead. In either case, any arguments
7310: to the configure script can be specified in the
7311: <code class="varname">CONFIGURE_ARGS</code>
7312: variable, and the configure script's name can be
7313: set in <code class=
7314: "varname">CONFIGURE_SCRIPT</code> if it differs
7315: from the default “<span class=
1.1 grant 7316: "quote">configure</span>”. Here's an example
7317: from the <a xmlns=
7318: "http://www.w3.org/TR/xhtml1/transitional" href=
7319: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.14 xtraeme 7320: class="pkgname">sysutils/top</a> package:</p>
1.1 grant 7321: <pre class="programlisting">
7322: HAS_CONFIGURE= yes
7323: CONFIGURE_SCRIPT= Configure
7324: CONFIGURE_ARGS+= netbsd13
7325: </pre>
7326:
7327: <p>If the program uses an Imakefile for
7328: configuration, the appropriate steps can be invoked
1.14 xtraeme 7329: by setting <code class="varname">USE_IMAKE</code>
7330: to “<span class="quote">YES</span>”.
7331: (If you only want the package installed in
7332: <code class="varname">$X11PREFIX</code> but xmkmf
7333: not being run, set <code class=
7334: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 7335: </dd>
7336:
7337: <dt><span class="term">build</span></dt>
7338:
7339: <dd>
7340: <p>Once configuration has taken place, the software
1.14 xtraeme 7341: will be built by invoking <code class=
7342: "varname">$MAKE_PROGRAM</code> on <code class=
7343: "varname">$MAKEFILE</code> with <code class=
7344: "varname">$BUILD_TARGET</code> as the target to
7345: build. The default <code class=
7346: "varname">MAKE_PROGRAM</code> is
7347: “<span class="quote">gmake</span>” if
7348: <code class="varname">USE_GNU_TOOLS</code> contains
1.7 wiz 7349: “<span class="quote">make</span>”,
1.1 grant 7350: “<span class="quote">make</span>”
1.14 xtraeme 7351: otherwise. <code class="varname">MAKEFILE</code> is
7352: set to “<span class=
1.1 grant 7353: "quote">Makefile</span>” by default, and
1.14 xtraeme 7354: <code class="varname">BUILD_TARGET</code> defaults
7355: to “<span class="quote">all</span>”.
7356: Any of these variables can be set in the package's
1.1 grant 7357: Makefile to change the default build process.</p>
7358: </dd>
7359:
7360: <dt><span class="term">install</span></dt>
7361:
7362: <dd>
7363: <p>Once the build stage has completed, the final
7364: step is to install the software in public
7365: directories, so users can access the programs and
1.14 xtraeme 7366: files. As in the build-target, <code class=
7367: "varname">$MAKE_PROGRAM</code> is invoked on
7368: <code class="varname">$MAKEFILE</code> here, but
7369: with the <code class=
7370: "varname">$INSTALL_TARGET</code> instead, the
7371: latter defaulting to “<span class=
7372: "quote">install</span>” (plus
7373: “<span class=
7374: "quote">install.man</span>”, if <code class=
7375: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 7376: </dd>
7377: </dl>
7378: </div>
7379:
7380: <p>If no target is specified, the default is
7381: “<span class="quote">build</span>”. If a
7382: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 7383: e.g. <span><strong class="command">make
7384: build</strong></span> will also perform the equivalent
7385: of:</p>
1.1 grant 7386: <pre class="programlisting">
7387: make fetch
7388: make checksum
7389: make extract
7390: make patch
7391: make configure
7392: make build
7393: </pre>
7394: </div>
7395:
7396: <div class="sect1" lang="en" xml:lang="en">
7397: <div class="titlepage">
7398: <div>
7399: <div>
7400: <h2 class="title" style="clear: both"><a name=
7401: "build.helpful-targets" id=
7402: "build.helpful-targets"></a>11.3. Other
7403: helpful targets</h2>
7404: </div>
7405: </div>
7406: </div>
7407:
7408: <div class="variablelist">
7409: <dl>
7410: <dt><span class="term">pre/post-*</span></dt>
7411:
7412: <dd>
7413: <p>For any of the main targets described in the
7414: previous section, two auxiliary targets exist with
7415: “<span class="quote">pre-</span>” and
7416: “<span class="quote">post-</span>” used
7417: as a prefix for the main target's name. These
7418: targets are invoked before and after the main
7419: target is called, allowing extra configuration or
7420: installation steps be performed from a package's
7421: Makefile, for example, which a program's configure
7422: script or install target omitted.</p>
7423: </dd>
7424:
7425: <dt><span class="term">do-*</span></dt>
7426:
7427: <dd>
7428: <p>Should one of the main targets do the wrong
7429: thing, and should there be no variable to fix this,
7430: you can redefine it with the do-* target. (Note
7431: that redefining the target itself instead of the
7432: do-* target is a bad idea, as the pre-* and post-*
7433: targets won't be called anymore, etc.) You will not
7434: usually need to do this.</p>
7435: </dd>
7436:
7437: <dt><span class="term">reinstall</span></dt>
7438:
7439: <dd>
1.14 xtraeme 7440: <p>If you did a <span><strong class="command">make
7441: install</strong></span> and you noticed some file
7442: was not installed properly, you can repeat the
1.1 grant 7443: installation with this target, which will ignore
7444: the “<span class="quote">already
7445: installed</span>” flag.</p>
7446: </dd>
7447:
7448: <dt><span class="term">deinstall</span></dt>
7449:
7450: <dd>
7451: <p>This target does a pkg_delete(1) in the current
7452: directory, effectively de-installing the package.
7453: The following variables can be used to tune the
7454: behaviour:</p>
7455:
7456: <div class="variablelist">
7457: <dl>
1.14 xtraeme 7458: <dt><span class="term"><code class=
7459: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 7460:
7461: <dd>
7462: <p>Add a "-v" to the <a href=
7463: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7464: <span class="citerefentry"><span class=
7465: "refentrytitle">pkg_delete</span>(1)</span></a>
7466: command.</p>
7467: </dd>
7468:
1.14 xtraeme 7469: <dt><span class="term"><code class=
7470: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 7471:
7472: <dd>
7473: <p>Remove all packages that require (depend
7474: on) the given package. This can be used to
7475: remove any packages that may have been pulled
7476: in by a given package, e.g. if
1.14 xtraeme 7477: <span><strong class="command">make deinstall
7478: DEINSTALLDEPENDS=1</strong></span> is done in
7479: <code class="filename">pkgsrc/x11/kde</code>,
1.1 grant 7480: this is likely to remove whole KDE. Works by
7481: adding “<span class=
7482: "quote">-R</span>” to the <a href=
7483: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7484: <span class="citerefentry"><span class=
7485: "refentrytitle">pkg_delete</span>(1)</span></a>
7486: command line.</p>
7487: </dd>
7488: </dl>
7489: </div>
7490: </dd>
7491:
7492: <dt><span class="term">update</span></dt>
7493:
7494: <dd>
7495: <p>This target causes the current package to be
7496: updated to the latest version. The package and all
7497: depending packages first get de-installed, then
7498: current versions of the corresponding packages get
7499: compiled and installed. This is similar to manually
7500: noting which packages are currently installed, then
1.14 xtraeme 7501: performing a series of <span><strong class=
7502: "command">make deinstall</strong></span> and
7503: <span><strong class="command">make
7504: install</strong></span> (or whatever <code class=
7505: "varname">UPDATE_TARGET</code> is set to) for these
7506: packages.</p>
1.1 grant 7507:
7508: <p>You can use the “<span class=
7509: "quote">update</span>” target to resume
1.14 xtraeme 7510: package updating in case a previous
7511: <span><strong class="command">make
7512: update</strong></span> was interrupted for some
7513: reason. However, in this case, make sure you don't
7514: call <span><strong class="command">make
7515: clean</strong></span> or otherwise remove the list
7516: of dependent packages in <code class=
7517: "varname">WRKDIR</code>. Otherwise you lose the
1.1 grant 7518: ability to automatically update the current package
7519: along with the dependent packages you have
7520: installed.</p>
7521:
1.14 xtraeme 7522: <p>Resuming an interrupted <span><strong class=
7523: "command">make update</strong></span> will only
7524: work as long as the package tree remains unchanged.
7525: If the source code for one of the packages to be
7526: updated has been changed, resuming
7527: <span><strong class="command">make
7528: update</strong></span> will most certainly
7529: fail!</p>
1.1 grant 7530:
7531: <p>The following variables can be used either on
1.14 xtraeme 7532: the command line or in <code class=
7533: "filename">/etc/mk.conf</code> to alter the
7534: behaviour of <span><strong class="command">make
7535: update</strong></span>:</p>
1.1 grant 7536:
7537: <div class="variablelist">
7538: <dl>
1.14 xtraeme 7539: <dt><span class="term"><code class=
7540: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 7541:
7542: <dd>
7543: <p>Install target to recursively use for the
7544: updated package and the dependent packages.
1.14 xtraeme 7545: Defaults to <code class=
7546: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 7547: “<span class=
7548: "quote">install</span>” otherwise for
1.14 xtraeme 7549: <span><strong class="command">make
7550: update</strong></span>. e.g.
7551: <span><strong class="command">make update
7552: UPDATE_TARGET=package</strong></span></p>
1.1 grant 7553: </dd>
7554:
1.14 xtraeme 7555: <dt><span class="term"><code class=
7556: "varname">NOCLEAN</code></span></dt>
1.1 grant 7557:
7558: <dd>
7559: <p>Don't clean up after updating. Useful if
7560: you want to leave the work sources of the
7561: updated packages around for inspection or
7562: other purposes. Be sure you eventually clean
7563: up the source tree (see the
7564: “<span class=
7565: "quote">clean-update</span>” target
7566: below) or you may run into troubles with old
7567: source code still lying around on your next
1.14 xtraeme 7568: <span><strong class=
7569: "command">make</strong></span> or
7570: <span><strong class="command">make
7571: update</strong></span>.</p>
1.1 grant 7572: </dd>
7573:
1.14 xtraeme 7574: <dt><span class="term"><code class=
7575: "varname">REINSTALL</code></span></dt>
1.1 grant 7576:
7577: <dd>
7578: <p>Deinstall each package before installing
1.14 xtraeme 7579: (making <code class=
7580: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 7581: necessary if the “<span class=
7582: "quote">clean-update</span>” target
7583: (see below) was called after interrupting a
1.14 xtraeme 7584: running <span><strong class="command">make
7585: update</strong></span>.</p>
1.1 grant 7586: </dd>
7587:
1.14 xtraeme 7588: <dt><span class="term"><code class=
7589: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 7590:
7591: <dd>
7592: <p>Allows you to disable recursion and
7593: hardcode the target for packages. The default
7594: is “<span class=
7595: "quote">update</span>” for the update
7596: target, facilitating a recursive update of
1.14 xtraeme 7597: prerequisite packages. Only set <code class=
7598: "varname">DEPENDS_TARGET</code> if you want
7599: to disable recursive updates. Use
7600: <code class="varname">UPDATE_TARGET</code>
7601: instead to just set a specific target for
7602: each package to be installed during
7603: <span><strong class="command">make
7604: update</strong></span> (see above).</p>
1.1 grant 7605: </dd>
7606: </dl>
7607: </div>
7608: </dd>
7609:
7610: <dt><span class="term">clean-update</span></dt>
7611:
7612: <dd>
7613: <p>Clean the source tree for all packages that
1.14 xtraeme 7614: would get updated if <span><strong class=
7615: "command">make update</strong></span> was called
7616: from the current directory. This target should not
7617: be used if the current package (or any of its
7618: depending packages) have already been de-installed
7619: (e.g., after calling <span><strong class=
7620: "command">make update</strong></span>) or you may
7621: lose some packages you intended to update. As a
7622: rule of thumb: only use this target <span class=
7623: "emphasis"><em>before</em></span> the first time
7624: you run <span><strong class="command">make
7625: update</strong></span> and only if you have a dirty
7626: package tree (e.g., if you used <code class=
7627: "varname">NOCLEAN</code>).</p>
1.1 grant 7628:
7629: <p>If you unsure about whether your tree is clean
1.14 xtraeme 7630: you can either perform a <span><strong class=
7631: "command">make clean</strong></span> at the top of
7632: the tree, or use the following sequence of commands
1.1 grant 7633: from the directory of the package you want to
7634: update (<span class=
7635: "emphasis"><em>before</em></span> running
1.14 xtraeme 7636: <span><strong class="command">make
7637: update</strong></span> for the first time,
7638: otherwise you lose all the packages you wanted to
7639: update!):</p>
1.1 grant 7640: <pre class="screen">
1.14 xtraeme 7641: <code class="prompt">#</code> <strong class=
7642: "userinput"><code>make clean-update</code></strong>
7643: <code class="prompt">#</code> <strong class=
7644: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
7645: <code class="prompt">#</code> <strong class=
7646: "userinput"><code>make update</code></strong>
1.1 grant 7647: </pre>
7648:
7649: <p>The following variables can be used either on
1.14 xtraeme 7650: the command line or in <code class=
7651: "filename">/etc/mk.conf</code> to alter the
7652: behaviour of <span><strong class="command">make
7653: clean-update</strong></span>:</p>
1.1 grant 7654:
7655: <div class="variablelist">
7656: <dl>
1.14 xtraeme 7657: <dt><span class="term"><code class=
7658: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 7659:
7660: <dd>
1.14 xtraeme 7661: <p>After <span><strong class="command">make
7662: clean</strong></span>, do not reconstruct the
7663: list of directories to update for this
7664: package. Only use this if
7665: <span><strong class="command">make
7666: update</strong></span> successfully installed
7667: all packages you wanted to update. Normally,
7668: this is done automatically on
7669: <span><strong class="command">make
7670: update</strong></span>, but may have been
7671: suppressed by the <code class=
7672: "varname">NOCLEAN</code> variable (see
1.1 grant 7673: above).</p>
7674: </dd>
7675: </dl>
7676: </div>
7677: </dd>
7678:
7679: <dt><span class="term">info</span></dt>
7680:
7681: <dd>
7682: <p>This target invokes <a href=
7683: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
7684: <span class="citerefentry"><span class=
7685: "refentrytitle">pkg_info</span>(1)</span></a> for
7686: the current package. You can use this to check
7687: which version of a package is installed.</p>
7688: </dd>
7689:
7690: <dt><span class="term">readme</span></dt>
7691:
7692: <dd>
1.14 xtraeme 7693: <p>This target generates a <code class=
7694: "filename">README.html</code> file, which can be
1.1 grant 7695: viewed using a browser such as <a xmlns=
7696: "http://www.w3.org/TR/xhtml1/transitional" href=
7697: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.14 xtraeme 7698: class="pkgname">www/mozilla</a> or <a xmlns=
7699: "http://www.w3.org/TR/xhtml1/transitional" href=
7700: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
7701: class="pkgname">www/links</a>. The generated files
7702: contain references to any packages which are in the
7703: <code class="varname">PACKAGES</code> directory on
7704: the local host. The generated files can be made to
7705: refer to URLs based on <code class=
7706: "varname">FTP_PKG_URL_HOST</code> and <code class=
7707: "varname">FTP_PKG_URL_DIR</code>. For example, if I
7708: wanted to generate <code class=
7709: "filename">README.html</code> files which pointed
7710: to binary packages on the local machine, in the
7711: directory <code class=
7712: "filename">/usr/packages</code>, set <code class=
7713: "varname">FTP_PKG_URL_HOST=file://localhost</code>
7714: and <code class=
7715: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
7716: <code class="varname">${PACKAGES}</code> directory
7717: and its subdirectories will be searched for all the
7718: binary packages.</p>
1.1 grant 7719: </dd>
7720:
7721: <dt><span class="term">readme-all</span></dt>
7722:
7723: <dd>
1.14 xtraeme 7724: <p>Use this target to create a file <code class=
7725: "filename">README-all.html</code> which contains a
1.1 grant 7726: list of all packages currently available in the
7727: NetBSD Packages Collection, together with the
7728: category they belong to and a short description.
1.14 xtraeme 7729: This file is compiled from the <code class=
7730: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 7731: sure to run this <span class=
1.14 xtraeme 7732: "emphasis"><em>after</em></span> a
7733: <span><strong class="command">make
7734: readme</strong></span>.</p>
1.1 grant 7735: </dd>
7736:
7737: <dt><span class="term">cdrom-readme</span></dt>
7738:
7739: <dd>
7740: <p>This is very much the same as the
7741: “<span class="quote">readme</span>”
7742: target (see above), but is to be used when
7743: generating a pkgsrc tree to be written to a CD-ROM.
1.14 xtraeme 7744: This target also produces <code class=
7745: "filename">README.html</code> files, and can be
7746: made to refer to URLs based on <code class=
7747: "varname">CDROM_PKG_URL_HOST</code> and
7748: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 7749: </dd>
7750:
7751: <dt><span class="term">show-distfiles</span></dt>
7752:
7753: <dd>
7754: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 7755: are needed to build the package. (<code class=
7756: "varname">DISTFILES</code> and <code class=
7757: "varname">PATCHFILES</code>, but not <code class=
7758: "filename">patches/*</code>)</p>
1.1 grant 7759: </dd>
7760:
7761: <dt><span class="term">show-downlevel</span></dt>
7762:
7763: <dd>
7764: <p>This target shows nothing if the package is not
7765: installed. If a version of this package is
7766: installed, but is not the version provided in this
7767: version of pkgsrc, then a warning message is
7768: displayed. This target can be used to show which of
7769: your installed packages are downlevel, and so the
7770: old versions can be deleted, and the current ones
7771: added.</p>
7772: </dd>
7773:
7774: <dt><span class="term">show-pkgsrc-dir</span></dt>
7775:
7776: <dd>
7777: <p>This target shows the directory in the pkgsrc
7778: hierarchy from which the package can be built and
7779: installed. This may not be the same directory as
7780: the one from which the package was installed. This
7781: target is intended to be used by people who may
7782: wish to upgrade many packages on a single host, and
7783: can be invoked from the top-level pkgsrc Makefile
7784: by using the “<span class=
7785: "quote">show-host-specific-pkgs</span>”
7786: target.</p>
7787: </dd>
7788:
7789: <dt><span class=
7790: "term">show-installed-depends</span></dt>
7791:
7792: <dd>
7793: <p>This target shows which installed packages match
1.14 xtraeme 7794: the current package's <code class=
7795: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 7796: dependencies are causing build problems.</p>
7797: </dd>
7798:
7799: <dt><span class="term">check-shlibs</span></dt>
7800:
7801: <dd>
7802: <p>After a package is installed, check all its
7803: binaries and (on ELF platforms) shared libraries to
7804: see if they find the shared libs they need. Run by
1.14 xtraeme 7805: default if <code class=
7806: "varname">PKG_DEVELOPER</code> is set in
7807: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 7808: </dd>
7809:
7810: <dt><span class="term">print-PLIST</span></dt>
7811:
7812: <dd>
7813: <p>After a “<span class="quote">make
7814: install</span>” from a new or upgraded pkg,
7815: this prints out an attempt to generate a new
1.14 xtraeme 7816: <code class="filename">PLIST</code> from a
7817: <span><strong class="command">find -newer
7818: work/.extract_done</strong></span>. An attempt is
7819: made to care for shared libs etc., but it is
1.1 grant 7820: <span class="emphasis"><em>strongly</em></span>
7821: recommended to review the result before putting it
1.14 xtraeme 7822: into <code class="filename">PLIST</code>. On
7823: upgrades, it's useful to diff the output of this
7824: command against an already existing <code class=
7825: "filename">PLIST</code> file.</p>
1.1 grant 7826:
7827: <p>If the package installs files via tar(1) or
7828: other methods that don't update file access times,
7829: be sure to add these files manually to your
1.14 xtraeme 7830: <code class="filename">PLIST</code>, as the
1.1 grant 7831: “<span class="quote">find
7832: -newer</span>” command used by this target
7833: won't catch them!</p>
7834:
7835: <p>See <a href="#print-PLIST" title=
7836: "8.3. Tweaking output of make print-PLIST">Section 8.3,
1.14 xtraeme 7837: “Tweaking output of <span><strong class=
7838: "command">make
7839: print-PLIST</strong></span>”</a> for more
7840: information on this target.</p>
1.1 grant 7841: </dd>
7842:
7843: <dt><span class="term">bulk-package</span></dt>
7844:
7845: <dd>
7846: <p>Used to do bulk builds. If an appropriate binary
7847: package already exists, no action is taken. If not,
7848: this target will compile, install and package it
1.14 xtraeme 7849: (and it's depends, if <code class=
7850: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 7851: <a href="#binary.configuration" title=
7852: "5.3.1. Configuration">Section 5.3.1,
7853: “Configuration”</a>. After creating the
7854: binary package, the sources, the just-installed
7855: package and it's required packages are removed,
7856: preserving free disk space.</p>
7857:
7858: <p><span class="emphasis"><em>Beware that this
7859: target may deinstall all packages installed on a
7860: system!</em></span></p>
7861: </dd>
7862:
7863: <dt><span class="term">bulk-install</span></dt>
7864:
7865: <dd>
7866: <p>Used during bulk-installs to install required
7867: packages. If an upto-date binary package is
7868: available, it will be installed via <a href=
7869: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7870: <span class="citerefentry"><span class=
7871: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 7872: not, <span><strong class="command">make
7873: bulk-package</strong></span> will be executed, but
7874: the installed binary not be removed.</p>
1.1 grant 7875:
7876: <p>A binary package is considered
7877: “<span class="quote">upto-date</span>”
7878: to be installed via <a href=
7879: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7880: <span class="citerefentry"><span class=
7881: "refentrytitle">pkg_add</span>(1)</span></a>
7882: if:</p>
7883:
7884: <div class="itemizedlist">
7885: <ul type="disc">
7886: <li>
1.14 xtraeme 7887: <p>None of the package's files (<code class=
7888: "filename">Makefile</code>, ...) were
7889: modified since it was built.</p>
1.1 grant 7890: </li>
7891:
7892: <li>
7893: <p>None of the package's required (binary)
7894: packages were modified since it was
7895: built.</p>
7896: </li>
7897: </ul>
7898: </div>
7899:
7900: <p><span class="emphasis"><em>Beware that this
7901: target may deinstall all packages installed on a
7902: system!</em></span></p>
7903: </dd>
7904: </dl>
7905: </div>
7906: </div>
7907: </div>
7908:
7909: <div class="chapter" lang="en" xml:lang="en">
7910: <div class="titlepage">
7911: <div>
7912: <div>
7913: <h2 class="title"><a name="fixes" id=
7914: "fixes"></a>Chapter 12. Notes on fixes for
7915: packages</h2>
7916: </div>
7917: </div>
7918: </div>
7919:
7920: <div class="toc">
7921: <p><b>Table of Contents</b></p>
7922:
7923: <dl>
1.17 ! sketch 7924: <dt><span class="sect1"><a href="#id2590937">12.1.
1.1 grant 7925: General operation</a></span></dt>
7926:
7927: <dd>
7928: <dl>
7929: <dt><span class="sect2"><a href=
1.17 ! sketch 7930: "#id2590940">12.1.1. How to pull in variables from
1.1 grant 7931: /etc/mk.conf</a></span></dt>
7932:
7933: <dt><span class="sect2"><a href=
1.17 ! sketch 7934: "#id2591092">12.1.2. Restricted
1.1 grant 7935: packages</a></span></dt>
7936:
7937: <dt><span class="sect2"><a href=
7938: "#dependencies">12.1.3. Handling
7939: dependencies</a></span></dt>
7940:
7941: <dt><span class="sect2"><a href=
1.17 ! sketch 7942: "#id2591607">12.1.4. Handling conflicts with other
1.1 grant 7943: packages</a></span></dt>
7944:
7945: <dt><span class="sect2"><a href=
1.17 ! sketch 7946: "#id2591657">12.1.5. Packages that cannot or should
1.1 grant 7947: not be built</a></span></dt>
7948:
7949: <dt><span class="sect2"><a href=
1.17 ! sketch 7950: "#id2591683">12.1.6. Packages which should not be
1.1 grant 7951: deleted, once installed</a></span></dt>
7952:
7953: <dt><span class="sect2"><a href=
7954: "#security-handling">12.1.7. Handling packages with
7955: security problems</a></span></dt>
7956:
7957: <dt><span class="sect2"><a href=
1.17 ! sketch 7958: "#id2591774">12.1.8. How to handle compiler
1.1 grant 7959: bugs</a></span></dt>
7960:
7961: <dt><span class="sect2"><a href=
1.17 ! sketch 7962: "#id2591797">12.1.9. How to handle incrementing
1.1 grant 7963: versions when fixing an existing
7964: package</a></span></dt>
7965:
7966: <dt><span class="sect2"><a href=
1.17 ! sketch 7967: "#id2591914">12.1.10. Portability of
1.1 grant 7968: packages</a></span></dt>
7969: </dl>
7970: </dd>
7971:
1.17 ! sketch 7972: <dt><span class="sect1"><a href="#id2591939">12.2.
1.1 grant 7973: Possible downloading issues</a></span></dt>
7974:
7975: <dd>
7976: <dl>
7977: <dt><span class="sect2"><a href=
1.17 ! sketch 7978: "#id2591942">12.2.1. Packages whose distfiles
1.1 grant 7979: aren't available for plain
7980: downloading</a></span></dt>
7981:
7982: <dt><span class="sect2"><a href=
1.17 ! sketch 7983: "#id2592005">12.2.2. How to handle modified
1.1 grant 7984: distfiles with the 'old' name</a></span></dt>
7985: </dl>
7986: </dd>
7987:
1.17 ! sketch 7988: <dt><span class="sect1"><a href="#id2592017">12.3.
1.1 grant 7989: Configuration gotchas</a></span></dt>
7990:
7991: <dd>
7992: <dl>
7993: <dt><span class="sect2"><a href=
7994: "#fixes.libtool">12.3.1. Shared libraries -
7995: libtool</a></span></dt>
7996:
7997: <dt><span class="sect2"><a href=
1.17 ! sketch 7998: "#id2592424">12.3.2. Using libtool on GNU packages
1.1 grant 7999: that already support libtool</a></span></dt>
8000:
8001: <dt><span class="sect2"><a href=
1.17 ! sketch 8002: "#id2592577">12.3.3. GNU
1.1 grant 8003: Autoconf/Automake</a></span></dt>
8004: </dl>
8005: </dd>
8006:
1.17 ! sketch 8007: <dt><span class="sect1"><a href="#id2592621">12.4.
1.1 grant 8008: Building considerations</a></span></dt>
8009:
8010: <dd>
8011: <dl>
8012: <dt><span class="sect2"><a href=
1.17 ! sketch 8013: "#id2592625">12.4.1. CPP defines</a></span></dt>
1.1 grant 8014: </dl>
8015: </dd>
8016:
1.17 ! sketch 8017: <dt><span class="sect1"><a href="#id2592791">12.5.
1.1 grant 8018: Package specific actions</a></span></dt>
8019:
8020: <dd>
8021: <dl>
8022: <dt><span class="sect2"><a href=
1.17 ! sketch 8023: "#id2592794">12.5.1. Package configuration
1.1 grant 8024: files</a></span></dt>
8025:
8026: <dt><span class="sect2"><a href=
1.17 ! sketch 8027: "#id2592897">12.5.2. User
1.2 hubertf 8028: interaction</a></span></dt>
1.1 grant 8029:
8030: <dt><span class="sect2"><a href=
1.17 ! sketch 8031: "#id2593010">12.5.3. Handling
1.1 grant 8032: licenses</a></span></dt>
8033:
8034: <dt><span class="sect2"><a href=
1.17 ! sketch 8035: "#id2593093">12.5.4. Creating an account from a
1.1 grant 8036: package</a></span></dt>
8037:
8038: <dt><span class="sect2"><a href=
1.17 ! sketch 8039: "#id2593223">12.5.5. Installing score
1.1 grant 8040: files</a></span></dt>
8041:
8042: <dt><span class="sect2"><a href=
1.17 ! sketch 8043: "#id2593335">12.5.6. Packages providing login
1.1 grant 8044: shells</a></span></dt>
8045:
8046: <dt><span class="sect2"><a href=
1.17 ! sketch 8047: "#id2593393">12.5.7. Packages containing perl
1.1 grant 8048: scripts</a></span></dt>
8049:
8050: <dt><span class="sect2"><a href=
1.17 ! sketch 8051: "#id2593411">12.5.8. Packages with hardcoded paths
1.1 grant 8052: to other interpreters</a></span></dt>
8053:
8054: <dt><span class="sect2"><a href=
1.17 ! sketch 8055: "#id2593432">12.5.9. Packages installing perl
1.1 grant 8056: modules</a></span></dt>
8057:
8058: <dt><span class="sect2"><a href=
8059: "#faq.info-files">12.5.10. Packages installing info
8060: files</a></span></dt>
8061:
8062: <dt><span class="sect2"><a href=
1.17 ! sketch 8063: "#id2593652">12.5.11. Packages installing GConf2
1.1 grant 8064: data files</a></span></dt>
8065:
8066: <dt><span class="sect2"><a href=
1.17 ! sketch 8067: "#id2593752">12.5.12. Packages installing
1.1 grant 8068: scrollkeeper data files</a></span></dt>
8069:
8070: <dt><span class="sect2"><a href=
1.17 ! sketch 8071: "#id2593803">12.5.13. Packages installing X11
1.1 grant 8072: fonts</a></span></dt>
8073:
8074: <dt><span class="sect2"><a href=
1.17 ! sketch 8075: "#id2593850">12.5.14. Packages installing GTK2
1.1 grant 8076: modules</a></span></dt>
8077:
8078: <dt><span class="sect2"><a href=
1.17 ! sketch 8079: "#id2593988">12.5.15. Packages installing SGML or
1.1 grant 8080: XML data</a></span></dt>
8081:
8082: <dt><span class="sect2"><a href=
1.17 ! sketch 8083: "#id2594108">12.5.16. Packages installing
1.1 grant 8084: extensions to the MIME database</a></span></dt>
8085:
8086: <dt><span class="sect2"><a href=
1.17 ! sketch 8087: "#id2594247">12.5.17. Packages using
1.1 grant 8088: intltool</a></span></dt>
8089: </dl>
8090: </dd>
8091:
1.17 ! sketch 8092: <dt><span class="sect1"><a href="#id2594261">12.6.
1.1 grant 8093: Feedback to the author</a></span></dt>
8094: </dl>
8095: </div>
8096:
8097: <div class="sect1" lang="en" xml:lang="en">
8098: <div class="titlepage">
8099: <div>
8100: <div>
8101: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 8102: "id2590937" id="id2590937"></a>12.1. General
1.1 grant 8103: operation</h2>
8104: </div>
8105: </div>
8106: </div>
8107:
8108: <div class="sect2" lang="en" xml:lang="en">
8109: <div class="titlepage">
8110: <div>
8111: <div>
1.17 ! sketch 8112: <h3 class="title"><a name="id2590940" id=
! 8113: "id2590940"></a>12.1.1. How to pull in
1.1 grant 8114: variables from /etc/mk.conf</h3>
8115: </div>
8116: </div>
8117: </div>
8118:
8119: <p>The problem with package-defined variables that can
1.14 xtraeme 8120: be overridden via <code class="varname">MAKECONF</code>
8121: or <code class="filename">/etc/mk.conf</code> is that
8122: <a href=
1.1 grant 8123: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8124: <span class="citerefentry"><span class=
8125: "refentrytitle">make</span>(1)</span></a> expands a
8126: variable as it is used, but evaluates preprocessor like
8127: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 8128: So, to use any variable (which may be set in
8129: <code class="filename">/etc/mk.conf</code>) in one of
8130: the .if* statements, the file <code class=
8131: "filename">/etc/mk.conf</code> must be included before
1.1 grant 8132: that .if* statement.</p>
8133:
8134: <p>Rather than have a number of ad-hoc ways of
1.14 xtraeme 8135: including <code class="filename">/etc/mk.conf</code>,
8136: should it exist, or <code class=
8137: "varname">MAKECONF</code>, should it exist, include the
8138: <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
8139: file in the package Makefile before any
8140: preprocessor-like .if, .ifdef, or .ifndef
8141: statements:</p>
1.1 grant 8142: <pre class="programlisting">
8143: .include "../../mk/bsd.prefs.mk"
8144:
8145: .if defined(USE_MENUS)
8146: ...
8147: .endif
8148: </pre>
8149:
1.14 xtraeme 8150: <p>If you wish to set the <code class=
8151: "varname">CFLAGS</code> variable in <code class=
8152: "filename">/etc/mk.conf</code> please make sure to
1.1 grant 8153: use:</p>
8154: <pre class="programlisting">
8155: CFLAGS+= -your -flags
8156: </pre>
8157:
1.14 xtraeme 8158: <p>Using <code class="varname">CFLAGS=</code> (i.e.
8159: without the “<span class="quote">+</span>”)
8160: may lead to problems with packages that need to add
8161: their own flags. Also, you may want to take a look at
8162: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 8163: href=
8164: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.14 xtraeme 8165: class="pkgname">devel/cpuflags</a> package if you're
8166: interested in optimization for the current CPU.</p>
1.1 grant 8167: </div>
8168:
8169: <div class="sect2" lang="en" xml:lang="en">
8170: <div class="titlepage">
8171: <div>
8172: <div>
1.17 ! sketch 8173: <h3 class="title"><a name="id2591092" id=
! 8174: "id2591092"></a>12.1.2. Restricted
1.1 grant 8175: packages</h3>
8176: </div>
8177: </div>
8178: </div>
8179:
8180: <p>Some licenses restrict how software may be
8181: re-distributed. In order to satisfy these restrictions,
8182: the package system defines five make variables that can
8183: be set to note these restrictions:</p>
8184:
8185: <div class="itemizedlist">
8186: <ul type="disc">
8187: <li>
1.14 xtraeme 8188: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 8189:
8190: <p>This variable should be set whenever a
8191: restriction exists (regardless of its kind). Set
8192: this variable to a string containing the reason
8193: for the restriction.</p>
8194: </li>
8195:
8196: <li>
1.14 xtraeme 8197: <p><code class=
8198: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 8199:
8200: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 8201: variable to <code class=
8202: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 8203: package may not be included on a CD-ROM.</p>
8204: </li>
8205:
8206: <li>
1.14 xtraeme 8207: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 8208:
8209: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 8210: Set this variable to <code class=
8211: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 8212: package may not not be made available on the
8213: Internet.</p>
8214: </li>
8215:
8216: <li>
1.14 xtraeme 8217: <p><code class=
8218: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 8219:
8220: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 8221: this variable to <code class=
8222: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 8223: of the source code or other distfile(s) is not
8224: allowed on CD-ROMs.</p>
8225: </li>
8226:
8227: <li>
1.14 xtraeme 8228: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 8229:
8230: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 8231: variable to <code class=
8232: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 8233: of the source code or other distfile(s) via the
8234: Internet is not allowed.</p>
8235: </li>
8236: </ul>
8237: </div>
8238:
1.14 xtraeme 8239: <p>Please note that the use of <code class=
8240: "varname">NO_PACKAGE</code>, <code class=
8241: "varname">IGNORE</code>, <code class=
8242: "varname">NO_CDROM</code>, or other generic make
1.1 grant 8243: variables to denote restrictions is deprecated, because
8244: they unconditionally prevent users from generating
8245: binary packages!</p>
8246: </div>
8247:
8248: <div class="sect2" lang="en" xml:lang="en">
8249: <div class="titlepage">
8250: <div>
8251: <div>
8252: <h3 class="title"><a name="dependencies" id=
8253: "dependencies"></a>12.1.3. Handling
8254: dependencies</h3>
8255: </div>
8256: </div>
8257: </div>
8258:
8259: <p>Your package may depend on some other package being
8260: present - and there are various ways of expressing this
1.14 xtraeme 8261: dependency. pkgsrc supports the <code class=
8262: "varname">BUILD_DEPENDS</code> and <code class=
8263: "varname">DEPENDS</code> definitions, as well as
8264: dependencies via <code class=
8265: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 8266: way to handle dependencies, and which uses the
8267: variables named above. See <a href="#buildlink" title=
8268: "Chapter 9. Buildlink methodology">Chapter 9,
8269: <i>Buildlink methodology</i></a> for more
8270: information.</p>
8271:
8272: <p>The basic difference between the two variables is as
1.14 xtraeme 8273: follows: The <code class="varname">DEPENDS</code>
1.1 grant 8274: definition registers that pre-requisite in the binary
8275: package so it will be pulled in when the binary package
1.14 xtraeme 8276: is later installed, whilst the <code class=
8277: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 8278: marking a dependency that is only needed for building
8279: the package.</p>
8280:
8281: <p>This means that if you only need a package present
8282: whilst you are building, it should be noted as a
1.14 xtraeme 8283: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 8284:
1.14 xtraeme 8285: <p>The format for a <code class=
8286: "varname">BUILD_DEPENDS</code> and a <code class=
8287: "varname">DEPENDS</code> definition is:</p>
1.1 grant 8288: <pre class="programlisting">
8289: <pre-req-package-name>:../../<category>/<pre-req-package>
8290: </pre>
8291:
8292: <p>Please note that the “<span class=
8293: "quote">pre-req-package-name</span>” may include
8294: any of the wildcard version numbers recognised by
8295: <a href=
8296: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
8297: <span class="citerefentry"><span class=
8298: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
8299:
8300: <div class="orderedlist">
8301: <ol type="1">
8302: <li>
8303: <p>If your package needs another package's
8304: binaries or libraries to build or run, and if
1.14 xtraeme 8305: that package has a <code class=
8306: "filename">buildlink3.mk</code> file available,
8307: use it:</p>
1.1 grant 8308: <pre class="programlisting">
8309: .include "../../graphics/jpeg/buildlink3.mk"
8310:
8311: </pre>
8312: </li>
8313:
8314: <li>
8315: <p>If your package needs to use another package
1.14 xtraeme 8316: to build itself and there is no <code class=
8317: "filename">buildlink3.mk</code> file available,
8318: use the <code class=
8319: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 8320: <pre class="programlisting">
8321: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
8322: </pre>
8323: </li>
8324:
8325: <li>
8326: <p>If your package needs a library with which to
1.14 xtraeme 8327: link and again there is no <code class=
8328: "filename">buildlink3.mk</code> file available,
8329: this is specified using the <code class=
8330: "varname">DEPENDS</code> definition. An example
8331: of this is the <a xmlns=
1.1 grant 8332: "http://www.w3.org/TR/xhtml1/transitional" href=
8333: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.14 xtraeme 8334: class="pkgname">print/lyx</a> package, which uses
8335: the xpm library, version 3.4j to build:</p>
1.1 grant 8336: <pre class="programlisting">
8337: DEPENDS+= xpm-3.4j:../../graphics/xpm
8338: </pre>
8339:
8340: <p>You can also use wildcards in package
8341: dependences:</p>
8342: <pre class="programlisting">
8343: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
8344: </pre>
8345:
8346: <p>Note that such wildcard dependencies are
8347: retained when creating binary packages. The
8348: dependency is checked when installing the binary
8349: package and any package which matches the pattern
8350: will be used. Wildcard dependencies should be
8351: used with care.</p>
8352:
8353: <p>The “<span class=
8354: "quote">-[0-9]*</span>” should be used
8355: instead of “<span class=
8356: "quote">-*</span>” to avoid potentially
8357: ambiguous matches such as “<span class=
8358: "quote">tk-postgresql</span>” matching a
8359: “<span class="quote">tk-*</span>”
1.14 xtraeme 8360: <code class="varname">DEPENDS</code>.</p>
1.1 grant 8361:
8362: <p>Wildcards can also be used to specify that a
8363: package will only build against a certain minimum
8364: version of a pre-requisite:</p>
8365: <pre class="programlisting">
8366: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
8367: </pre>
8368:
8369: <p>This means that the package will build against
8370: version 3.5.4 of the tiff library or newer. Such
8371: a dependency may be warranted if, for example,
8372: the API of the library has changed with version
8373: 3.5.4 and a package would not compile against an
8374: earlier version of tiff.</p>
8375:
8376: <p>Please note that such dependencies should only
8377: be updated if a package requires a newer
8378: pre-requisite, but not to denote recommendations
8379: such as security updates or ABI changes that do
8380: not prevent a package from building correctly.
8381: Such recommendations can be expressed using
1.14 xtraeme 8382: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 8383: <pre class="programlisting">
8384: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
8385: </pre>
8386:
1.14 xtraeme 8387: <p>In addition to the above <code class=
8388: "varname">DEPENDS</code> line, this denotes that
1.1 grant 8389: while a package will build against
8390: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 8391: recommended. <code class=
8392: "varname">RECOMMENDED</code> entries will be
8393: turned into dependencies unless explicitly
8394: ignored (in which case a warning will be
8395: printed). Packages that are built with
1.1 grant 8396: recommendations ignored may not be uploaded to
8397: ftp.NetBSD.org by developers and should not be
8398: used across different systems that may have
8399: different versions of binary packages
8400: installed.</p>
8401:
8402: <p>For security fixes, please update the package
8403: vulnerabilities file as well as setting
1.14 xtraeme 8404: <code class="varname">RECOMMENDED</code>, see
1.1 grant 8405: <a href="#security-handling" title=
8406: "12.1.7. Handling packages with security problems">
8407: Section 12.1.7, “Handling packages with
8408: security problems”</a> for more
8409: information.</p>
8410: </li>
8411:
8412: <li>
8413: <p>If your package needs some executable to be
1.17 ! sketch 8414: able to run correctly and if there's no
1.14 xtraeme 8415: <code class="filename">buildlink3.mk</code> file,
8416: this is specified using the <code class=
8417: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 8418: "http://www.w3.org/TR/xhtml1/transitional" href=
8419: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.14 xtraeme 8420: class="pkgname">print/lyx</a> package needs to be
8421: able to execute the latex binary from the teTeX
8422: package when it runs, and that is specified:</p>
1.1 grant 8423: <pre class="programlisting">
8424: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
8425: </pre>
8426:
8427: <p>The comment about wildcard dependencies from
8428: previous paragraph applies here, too.</p>
8429: </li>
8430: </ol>
8431: </div>
8432:
8433: <p>If your package needs files from another package to
8434: build, see the first part of the “<span class=
8435: "quote">do-configure</span>” target <a xmlns=
8436: "http://www.w3.org/TR/xhtml1/transitional" href=
8437: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.14 xtraeme 8438: class="pkgname">print/ghostscript5</a> package (it
8439: relies on the jpeg sources being present in source form
8440: during the build):</p>
1.1 grant 8441: <pre class="programlisting">
8442: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
8443: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
8444: fi
8445: </pre>
8446:
8447: <p>If you build any other packages that way, please
8448: make sure the working files are deleted too when this
8449: package's working files are cleaned up. The easiest way
8450: to do so is by adding a pre-clean target:</p>
8451: <pre class="programlisting">
8452: pre-clean:
8453: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
8454: </pre>
8455:
1.14 xtraeme 8456: <p>Please also note the <code class=
8457: "varname">BUILD_USES_MSGFMT</code> and <code class=
8458: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
8459: which are provided as convenience definitions. The
8460: former works out whether msgfmt(1) is part of the base
8461: system, and, if it isn't, installs the <a xmlns=
1.1 grant 8462: "http://www.w3.org/TR/xhtml1/transitional" href=
8463: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.14 xtraeme 8464: class="pkgname">devel/gettext</a> package. The latter
8465: adds a build dependency on either an installed version
8466: of an older gettext package, or if it isn't, installs
8467: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8468: href=
8469: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
8470: class="pkgname">devel/gettext-m4</a> package.</p>
1.1 grant 8471: </div>
8472:
8473: <div class="sect2" lang="en" xml:lang="en">
8474: <div class="titlepage">
8475: <div>
8476: <div>
1.17 ! sketch 8477: <h3 class="title"><a name="id2591607" id=
! 8478: "id2591607"></a>12.1.4. Handling conflicts
1.1 grant 8479: with other packages</h3>
8480: </div>
8481: </div>
8482: </div>
8483:
8484: <p>Your package may conflict with other packages a user
8485: might already have installed on his system, e.g. if
8486: your package installs the same set of files like
8487: another package in our pkgsrc tree.</p>
8488:
1.14 xtraeme 8489: <p>In this case you can set <code class=
8490: "varname">CONFLICTS</code> to a space separated list of
1.1 grant 8491: packages (including version string) your package
8492: conflicts with.</p>
8493:
8494: <p>For example <a xmlns=
8495: "http://www.w3.org/TR/xhtml1/transitional" href=
8496: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.14 xtraeme 8497: class="pkgname">x11/Xaw3d</a> and <a xmlns=
8498: "http://www.w3.org/TR/xhtml1/transitional" href=
8499: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
8500: class="pkgname">x11/Xaw-Xpm</a> install provide the
8501: same shared library, thus you set in <code class=
8502: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 8503: <pre class="programlisting">
8504: CONFLICTS= Xaw-Xpm-[0-9]*
8505: </pre>
8506:
1.14 xtraeme 8507: <p>and in <code class=
8508: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 8509: <pre class="programlisting">
8510: CONFLICTS= Xaw3d-[0-9]*
8511: </pre>
8512:
8513: <p>Packages will automatically conflict with other
8514: packages with the name prefix and a different version
8515: string. “<span class=
8516: "quote">Xaw3d-1.5</span>” e.g. will automatically
8517: conflict with the older version “<span class=
8518: "quote">Xaw3d-1.3</span>”.</p>
8519: </div>
8520:
8521: <div class="sect2" lang="en" xml:lang="en">
8522: <div class="titlepage">
8523: <div>
8524: <div>
1.17 ! sketch 8525: <h3 class="title"><a name="id2591657" id=
! 8526: "id2591657"></a>12.1.5. Packages that cannot
1.1 grant 8527: or should not be built</h3>
8528: </div>
8529: </div>
8530: </div>
8531:
8532: <p>There are several reasons why a package might be
8533: instructed to not build under certain circumstances. If
8534: the package builds and runs on most platforms, the
1.14 xtraeme 8535: exceptions should be noted with <code class=
8536: "varname">NOT_FOR_PLATFORM</code>. If the package
8537: builds and runs on a small handful of platforms, set
8538: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
8539: If the package should be skipped (for example, because
8540: it provides functionality already provided by the
8541: system), set <code class=
8542: "varname">PKG_SKIP_REASON</code> to a descriptive
8543: message. If the package should fail because some
8544: preconditions are not met, set <code class=
8545: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 8546: message.</p>
8547:
1.14 xtraeme 8548: <p><code class="varname">IGNORE</code> is deprecated
1.1 grant 8549: because it didn't provide enough information to
8550: determine whether the build should fail.</p>
8551: </div>
8552:
8553: <div class="sect2" lang="en" xml:lang="en">
8554: <div class="titlepage">
8555: <div>
8556: <div>
1.17 ! sketch 8557: <h3 class="title"><a name="id2591683" id=
! 8558: "id2591683"></a>12.1.6. Packages which
1.1 grant 8559: should not be deleted, once installed</h3>
8560: </div>
8561: </div>
8562: </div>
8563:
8564: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 8565: has been installed, the <code class=
8566: "varname">PKG_PRESERVE</code> definition should be set
8567: in the package Makefile. This will be carried into any
1.1 grant 8568: binary package that is made from this pkgsrc entry. A
8569: “<span class="quote">preserved</span>”
8570: package will not be deleted using <a href=
8571: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8572: <span class="citerefentry"><span class=
8573: "refentrytitle">pkg_delete</span>(1)</span></a> unless
8574: the “<span class="quote">-f</span>” option
8575: is used.</p>
8576: </div>
8577:
8578: <div class="sect2" lang="en" xml:lang="en">
8579: <div class="titlepage">
8580: <div>
8581: <div>
8582: <h3 class="title"><a name="security-handling" id=
8583: "security-handling"></a>12.1.7. Handling
8584: packages with security problems</h3>
8585: </div>
8586: </div>
8587: </div>
8588:
8589: <p>When a vulnerability is found, this should be noted
1.14 xtraeme 8590: in <code class=
8591: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1 grant 8592: and after the commit of that file, it should be copied
1.14 xtraeme 8593: to both <code class=
8594: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
8595: and <code class=
8596: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
8597: on ftp.NetBSD.org using <code class=
8598: "filename">localsrc/security/advisories/Makefile</code>.
8599: In addition, if a <code class=
8600: "filename">buildlink3.mk</code> file exists for an
8601: affected package, bumping <code class=
8602: "varname">PKGREVISION</code> and creating a
8603: corresponding <code class=
8604: "varname">BUILDLINK_RECOMMENDED.<em class=
8605: "replaceable"><code>pkg</code></em></code> entry should
8606: be considered. See <a href="#buildlink" title=
1.1 grant 8607: "Chapter 9. Buildlink methodology">Chapter 9,
8608: <i>Buildlink methodology</i></a> for more information
1.14 xtraeme 8609: about writing <code class=
8610: "filename">buildlink3.mk</code> files and <code class=
8611: "varname">BUILDLINK_*</code> definitions.</p>
1.1 grant 8612:
8613: <p>Also, if the fix should be applied to the stable
8614: pkgsrc branch, be sure to submit a pullup request!</p>
8615: </div>
8616:
8617: <div class="sect2" lang="en" xml:lang="en">
8618: <div class="titlepage">
8619: <div>
8620: <div>
1.17 ! sketch 8621: <h3 class="title"><a name="id2591774" id=
! 8622: "id2591774"></a>12.1.8. How to handle
1.1 grant 8623: compiler bugs</h3>
8624: </div>
8625: </div>
8626: </div>
8627:
8628: <p>Some source files trigger bugs in the compiler,
8629: based on combinations of compiler version and
8630: architecture and almost always relation to optimisation
8631: being enabled. Common symptoms are gcc internal errors
8632: or never finishing compiling a file.</p>
8633:
8634: <p>Typically a workaround involves testing the
1.14 xtraeme 8635: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 8636: version, disabling optimisation for that
1.14 xtraeme 8637: file/<code class="varname">MACHINE_ARCH</code>/compiler
8638: combination, and documenting it in <code class=
8639: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 8640: number of examples!</p>
8641: </div>
8642:
8643: <div class="sect2" lang="en" xml:lang="en">
8644: <div class="titlepage">
8645: <div>
8646: <div>
1.17 ! sketch 8647: <h3 class="title"><a name="id2591797" id=
! 8648: "id2591797"></a>12.1.9. How to handle
1.1 grant 8649: incrementing versions when fixing an existing
8650: package</h3>
8651: </div>
8652: </div>
8653: </div>
8654:
8655: <p>When making fixes to an existing package it can be
1.14 xtraeme 8656: useful to change the version number in <code class=
8657: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 8658: future versions by the original author, a
8659: “<span class="quote">nb1</span>”,
8660: “<span class="quote">nb2</span>”, ...
8661: suffix can be used on package versions by setting
1.14 xtraeme 8662: <code class="varname">PKGREVISION=1</code> (2, ...).
8663: The “<span class="quote">nb</span>” is
8664: treated like a “<span class=
8665: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 8666: <pre class="programlisting">
8667: DISTNAME= foo-17.42
8668: PKGREVISION= 9
8669: </pre>
8670:
1.14 xtraeme 8671: <p>will result in a <code class=
8672: "varname">PKGNAME</code> of “<span class=
1.1 grant 8673: "quote">foo-17.42nb9</span>”.</p>
8674:
8675: <p>When a new release of the package is released, the
1.14 xtraeme 8676: <code class="varname">PKGREVISION</code> should be
8677: removed. e.g. on a new minor release of the above
8678: package, things should be like:</p>
1.1 grant 8679: <pre class="programlisting">
8680: DISTNAME= foo-17.43
8681: </pre>
8682: </div>
8683:
8684: <div class="sect2" lang="en" xml:lang="en">
8685: <div class="titlepage">
8686: <div>
8687: <div>
1.17 ! sketch 8688: <h3 class="title"><a name="id2591914" id=
! 8689: "id2591914"></a>12.1.10. Portability of
1.1 grant 8690: packages</h3>
8691: </div>
8692: </div>
8693: </div>
8694:
8695: <p>One appealing feature of pkgsrc is that it runs on
8696: many different platforms. As a result, it is important
8697: to ensure, where possible, that packages in pkgsrc are
8698: portable. There are some particular details you should
8699: pay attention to while working on pkgsrc.</p>
8700:
8701: <div class="sect3" lang="en" xml:lang="en">
8702: <div class="titlepage">
8703: <div>
8704: <div>
1.17 ! sketch 8705: <h4 class="title"><a name="id2591920" id=
! 8706: "id2591920"></a>12.1.10.1. ${INSTALL},
1.1 grant 8707: ${INSTALL_DATA_DIR}, ...</h4>
8708: </div>
8709: </div>
8710: </div>
8711:
1.14 xtraeme 8712: <p>The BSD-compatible <span><strong class=
8713: "command">install</strong></span> supplied with some
1.1 grant 8714: operating systems will not perform more than one
8715: operation at a time. As such, you should call
8716: “<span class="quote">${INSTALL}</span>”,
8717: etc. like this:</p>
8718: <pre class="programlisting">
8719: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
8720: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
8721: </pre>
8722: </div>
8723: </div>
8724: </div>
8725:
8726: <div class="sect1" lang="en" xml:lang="en">
8727: <div class="titlepage">
8728: <div>
8729: <div>
8730: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 8731: "id2591939" id="id2591939"></a>12.2. Possible
1.1 grant 8732: downloading issues</h2>
8733: </div>
8734: </div>
8735: </div>
8736:
8737: <div class="sect2" lang="en" xml:lang="en">
8738: <div class="titlepage">
8739: <div>
8740: <div>
1.17 ! sketch 8741: <h3 class="title"><a name="id2591942" id=
! 8742: "id2591942"></a>12.2.1. Packages whose
1.1 grant 8743: distfiles aren't available for plain
8744: downloading</h3>
8745: </div>
8746: </div>
8747: </div>
8748:
8749: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 8750: set <code class="varname">DYNAMIC_MASTER_SITES</code>
8751: and a <span><strong class="command">make
8752: fetch</strong></span> will call <code class=
8753: "filename">files/getsite.sh</code> with the name of
8754: each file to download as an argument, expecting it to
8755: output the URL of the directory from which to download
8756: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8757: href=
1.1 grant 8758: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.14 xtraeme 8759: class="pkgname">graphics/ns-cult3d</a> is an example of
8760: this usage.</p>
1.1 grant 8761:
8762: <p>If the download can't be automated, because the user
8763: must submit personal information to apply for a
8764: password, or must pay for the source, or whatever, you
1.14 xtraeme 8765: can set <code class="varname">_FETCH_MESSAGE</code> to
8766: a macro which displays a message explaining the
8767: situation. <code class="varname">_FETCH_MESSAGE</code>
8768: must be executable shell commands, not just a message.
8769: (Generally, it executes <code class=
8770: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 8771: following packages use this: <a xmlns=
8772: "http://www.w3.org/TR/xhtml1/transitional" href=
8773: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.14 xtraeme 8774: class="pkgname">audio/realplayer</a>, <a xmlns=
8775: "http://www.w3.org/TR/xhtml1/transitional" href=
8776: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
8777: class="pkgname">cad/simian</a>, <a xmlns=
8778: "http://www.w3.org/TR/xhtml1/transitional" href=
8779: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
8780: class="pkgname">devel/ipv6socket</a>, <a xmlns=
8781: "http://www.w3.org/TR/xhtml1/transitional" href=
8782: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
8783: class="pkgname">emulators/vmware-module</a>, <a xmlns=
8784: "http://www.w3.org/TR/xhtml1/transitional" href=
8785: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
8786: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
8787: "http://www.w3.org/TR/xhtml1/transitional" href=
8788: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
8789: class="pkgname">sysutils/storage-manager</a>, <a xmlns=
8790: "http://www.w3.org/TR/xhtml1/transitional" href=
8791: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
8792: class="pkgname">www/ap-aolserver</a>, <a xmlns=
8793: "http://www.w3.org/TR/xhtml1/transitional" href=
8794: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
8795: class="pkgname">www/openacs</a>. Try to be consistent
8796: with them.</p>
1.1 grant 8797: </div>
8798:
8799: <div class="sect2" lang="en" xml:lang="en">
8800: <div class="titlepage">
8801: <div>
8802: <div>
1.17 ! sketch 8803: <h3 class="title"><a name="id2592005" id=
! 8804: "id2592005"></a>12.2.2. How to handle
1.1 grant 8805: modified distfiles with the 'old' name</h3>
8806: </div>
8807: </div>
8808: </div>
8809:
8810: <p>Sometimes authors of a software package make some
8811: modifications after the software was released, and they
8812: put up a new distfile without changing the package's
8813: version number. If a package is already in pkgsrc at
8814: that time, the md5 checksum will no longer match. The
8815: correct way to work around this is to update the
8816: package's md5 checksum to match the package on the
8817: master site (beware, any mirrors may not be up to date
8818: yet!), and to remove the old distfile from
1.14 xtraeme 8819: ftp.NetBSD.org's <code class=
8820: "filename">/pub/NetBSD/packages/distfiles</code>
1.1 grant 8821: directory. Furthermore, a mail to the package's author
8822: seems appropriate making sure the distfile was really
8823: updated on purpose, and that no trojan horse or so
8824: crept in.</p>
8825: </div>
8826: </div>
8827:
8828: <div class="sect1" lang="en" xml:lang="en">
8829: <div class="titlepage">
8830: <div>
8831: <div>
8832: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 8833: "id2592017" id=
! 8834: "id2592017"></a>12.3. Configuration
1.1 grant 8835: gotchas</h2>
8836: </div>
8837: </div>
8838: </div>
8839:
8840: <div class="sect2" lang="en" xml:lang="en">
8841: <div class="titlepage">
8842: <div>
8843: <div>
8844: <h3 class="title"><a name="fixes.libtool" id=
8845: "fixes.libtool"></a>12.3.1. Shared libraries
8846: - libtool</h3>
8847: </div>
8848: </div>
8849: </div>
8850:
8851: <p>pkgsrc supports many different machines, with
8852: different object formats like a.out and ELF, and
8853: varying abilities to do shared library and dynamic
8854: loading at all. To accompany this, varying commands and
8855: options have to be passed to the compiler, linker, etc.
8856: to get the Right Thing, which can be pretty annoying
8857: especially if you don't have all the machines at your
8858: hand to test things. The <a xmlns=
8859: "http://www.w3.org/TR/xhtml1/transitional" href=
8860: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.14 xtraeme 8861: class="pkgname">devel/libtool</a> pkg can help here, as
8862: it just “<span class="quote">knows</span>”
8863: how to build both static and dynamic libraries from a
8864: set of source files, thus being platform
8865: independent.</p>
1.1 grant 8866:
8867: <p>Here's how to use libtool in a pkg in seven simple
8868: steps:</p>
8869:
8870: <div class="orderedlist">
8871: <ol type="1">
8872: <li>
1.14 xtraeme 8873: <p>Add <code class=
8874: "varname">USE_LIBTOOL=yes</code> to the package
8875: Makefile.</p>
1.1 grant 8876: </li>
8877:
8878: <li>
8879: <p>For library objects, use “<span class=
8880: "quote">${LIBTOOL} --mode=compile
8881: ${CC}</span>” in place of
8882: “<span class="quote">${CC}</span>”.
8883: You could even add it to the definition of
1.14 xtraeme 8884: <code class="varname">CC</code>, if only
8885: libraries are being built in a given Makefile.
8886: This one command will build both PIC and non-PIC
8887: library objects, so you need not have separate
8888: shared and non-shared library rules.</p>
1.1 grant 8889: </li>
8890:
8891: <li>
8892: <p>For the linking of the library, remove any
8893: “<span class="quote">ar</span>”,
8894: “<span class="quote">ranlib</span>”,
8895: and “<span class="quote">ld
8896: -Bshareable</span>” commands, and instead
8897: use:</p>
8898: <pre class="programlisting">
8899: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
8900: </pre>
8901:
8902: <p>Note that the library is changed to have a
1.14 xtraeme 8903: <code class="filename">.la</code> extension, and
8904: the objects are changed to have a <code class=
8905: "filename">.lo</code> extension. Change
8906: <code class="varname">OBJS</code> as necessary.
8907: This automatically creates all of the
8908: <code class="filename">.a</code>, <code class=
8909: "filename">.so.major.minor</code>, and ELF
8910: symlinks (if necessary) in the build directory.
8911: Be sure to include “<span class=
1.1 grant 8912: "quote">-version-info</span>”, especially
8913: when major and minor are zero, as libtool will
8914: otherwise strip off the shared library
8915: version.</p>
8916:
8917: <p>From the libtool manual:</p>
8918: <pre class="programlisting">
8919: So, libtool library versions are described by three integers:
8920:
8921: CURRENT
8922: The most recent interface number that this library implements.
8923:
8924: REVISION
8925: The implementation number of the CURRENT interface.
8926:
8927: AGE
8928: The difference between the newest and oldest interfaces that this
8929: library implements. In other words, the library implements all the
8930: interface numbers in the range from number `CURRENT - AGE' to
8931: `CURRENT'.
8932:
8933: If two libraries have identical CURRENT and AGE numbers, then the
8934: dynamic linker chooses the library with the greater REVISION number.
8935: </pre>
8936:
8937: <p>The “<span class=
8938: "quote">-release</span>” option will
8939: produce different results for a.out and ELF
8940: (excluding symlinks) in only one case. An ELF
8941: library of the form “<span class=
8942: "quote">libfoo-release.so.<span class=
8943: "emphasis"><em>x</em></span>.<span class=
8944: "emphasis"><em>y</em></span></span>” will
8945: have a symlink of “<span class=
8946: "quote">libfoo.so.<span class=
8947: "emphasis"><em>x</em></span>.<span class=
8948: "emphasis"><em>y</em></span></span>” on an
8949: a.out platform. This is handled
8950: automatically.</p>
8951:
8952: <p>The “<span class="quote">-rpath
8953: argument</span>” is the install directory
8954: of the library being built.</p>
8955:
1.14 xtraeme 8956: <p>In the <code class="filename">PLIST</code>,
8957: include all of the <code class=
8958: "filename">.a</code>, <code class=
8959: "filename">.la</code>, and <code class=
8960: "filename">.so</code>, <code class=
8961: "filename">.so.<em class=
8962: "replaceable"><code>major</code></em></code> and
8963: <code class="filename">.so.<em class=
8964: "replaceable"><code>major</code></em>.<em class=
8965: "replaceable"><code>minor</code></em></code>
8966: files.</p>
1.1 grant 8967: </li>
8968:
8969: <li>
1.14 xtraeme 8970: <p>When linking shared object (<code class=
8971: "filename">.so</code>) files, i.e. files that are
1.1 grant 8972: loaded via dlopen(3), NOT shared libraries, use
8973: “<span class="quote">-module
8974: -avoid-version</span>” to prevent them
8975: getting version tacked on.</p>
8976:
1.14 xtraeme 8977: <p>The <code class="filename">PLIST</code> file
8978: gets the <code class="filename">foo.so</code>
8979: entry.</p>
1.1 grant 8980: </li>
8981:
8982: <li>
8983: <p>When linking programs that depend on these
8984: libraries <span class=
8985: "emphasis"><em>before</em></span> they are
8986: installed, preface the <a href=
8987: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
8988: <span class="citerefentry"><span class=
8989: "refentrytitle">cc</span>(1)</span></a> or
8990: <a href=
8991: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
8992: <span class="citerefentry"><span class=
8993: "refentrytitle">ld</span>(1)</span></a> line with
8994: “<span class="quote">${LIBTOOL}
8995: --mode=link</span>”, and it will find the
8996: correct libraries (static or shared), but please
8997: be aware that libtool will not allow you to
8998: specify a relative path in -L (such as
8999: “<span class=
9000: "quote">-L../somelib</span>”), because it
9001: expects you to change that argument to be the
1.14 xtraeme 9002: <code class="filename">.la</code> file. e.g.</p>
1.1 grant 9003: <pre class="programlisting">
9004: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
9005: </pre>
9006:
9007: <p>should be changed to:</p>
9008: <pre class="programlisting">
1.14 xtraeme 9009: ${LIBTOOL} --mode=link ${CC} -o <em class=
9010: "replaceable"><code>someprog</code></em> <em class=
9011: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 9012: </pre>
9013:
9014: <p>and it will do the right thing with the
9015: libraries.</p>
9016: </li>
9017:
9018: <li>
9019: <p>When installing libraries, preface the
9020: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
9021: <span class="citerefentry"><span class=
9022: "refentrytitle">install</span>(1)</span></a> or
9023: <a href=
9024: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
9025: <span class="citerefentry"><span class=
9026: "refentrytitle">cp</span>(1)</span></a> command
9027: with “<span class="quote">${LIBTOOL}
9028: --mode=install</span>”, and change the
1.14 xtraeme 9029: library name to <code class=
9030: "filename">.la</code>. e.g.</p>
1.1 grant 9031: <pre class="programlisting">
9032: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
9033: </pre>
9034:
1.14 xtraeme 9035: <p>This will install the static <code class=
9036: "filename">.a</code>, shared library, any needed
1.1 grant 9037: symlinks, and run <a href=
9038: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
9039: <span class="citerefentry"><span class=
9040: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
9041: </li>
9042:
9043: <li>
1.14 xtraeme 9044: <p>In your <code class="filename">PLIST</code>,
9045: include all of the <code class=
9046: "filename">.a</code>, <code class=
9047: "filename">.la</code>, and <code class=
9048: "filename">.so</code>, <code class=
9049: "filename">.so.CURRENT</code> and <code class=
9050: "filename">.so.CURRENT.REVISION</code> files
9051: (this is a change from the previous
9052: behaviour).</p>
1.1 grant 9053: </li>
9054: </ol>
9055: </div>
9056: </div>
9057:
9058: <div class="sect2" lang="en" xml:lang="en">
9059: <div class="titlepage">
9060: <div>
9061: <div>
1.17 ! sketch 9062: <h3 class="title"><a name="id2592424" id=
! 9063: "id2592424"></a>12.3.2. Using libtool on GNU
1.1 grant 9064: packages that already support libtool</h3>
9065: </div>
9066: </div>
9067: </div>
9068:
1.14 xtraeme 9069: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
9070: the package Makefile. This will override the package's
9071: own libtool in most cases. For older libtool using
1.1 grant 9072: packages, libtool is made by ltconfig script during the
9073: do-configure step; you can check the libtool script
1.14 xtraeme 9074: location by doing <span><strong class="command">make
9075: configure; find work*/ -name
9076: libtool</strong></span>.</p>
9077:
9078: <p><code class="varname">LIBTOOL_OVERRIDE</code>
9079: specifies which libtool scripts, relative to
9080: <code class="varname">WRKSRC</code>, to override. By
9081: default, it is set to “<span class=
9082: "quote">libtool */libtool */*/libtool</span>”. If
9083: this does not match the location of the package's
9084: libtool script(s), set it as appropriate.</p>
1.13 hubertf 9085:
1.14 xtraeme 9086: <p>If you do not need <code class="filename">*.a</code>
1.1 grant 9087: static libraries built and installed, then use
1.14 xtraeme 9088: <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1 grant 9089: instead.</p>
9090:
9091: <p>If your package makes use of the platform
9092: independent library for loading dynamic shared objects,
9093: that comes with libtool (libltdl), you should include
1.14 xtraeme 9094: the libtool buildlink3.mk (and set <code class=
9095: "varname">USE_BUILDLINK3=YES</code>).</p>
1.1 grant 9096:
9097: <p>Some packages use libtool incorrectly so that the
9098: package may not work or build in some circumstances.
9099: Some of the more common errors are:</p>
9100:
9101: <div class="itemizedlist">
9102: <ul type="disc">
9103: <li>
9104: <p>The inclusion of a shared object (-module) as
9105: a dependent library in an executable or library.
9106: This in itself isn't a problem if one of two
9107: things has been done:</p>
9108:
9109: <div class="orderedlist">
9110: <ol type="1">
9111: <li>
9112: <p>The shared object is named correctly,
1.14 xtraeme 9113: i.e. <code class=
9114: "filename">libfoo.la</code>, not
9115: <code class="filename">foo.la</code></p>
1.1 grant 9116: </li>
9117:
9118: <li>
9119: <p>The -dlopen option is used when linking
9120: an executable.</p>
9121: </li>
9122: </ol>
9123: </div>
9124: </li>
9125:
9126: <li>
9127: <p>The use of libltdl without the correct calls
9128: to initialisation routines. The function
9129: lt_dlinit() should be called and the macro
1.14 xtraeme 9130: <code class=
9131: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 9132: included in executables.</p>
9133: </li>
9134: </ul>
9135: </div>
9136: </div>
9137:
9138: <div class="sect2" lang="en" xml:lang="en">
9139: <div class="titlepage">
9140: <div>
9141: <div>
1.17 ! sketch 9142: <h3 class="title"><a name="id2592577" id=
! 9143: "id2592577"></a>12.3.3. GNU
1.1 grant 9144: Autoconf/Automake</h3>
9145: </div>
9146: </div>
9147: </div>
9148:
9149: <p>If a package needs GNU autoconf or automake to be
9150: executed to regenerate the configure script and
9151: Makefile.in makefile templates, then they should be
9152: executed in a pre-configure target. Two Makefile
1.14 xtraeme 9153: fragments are provided in <code class=
9154: "filename">pkgsrc/mk/autoconf.mk</code> and
9155: <code class="filename">pkgsrc/mk/automake.mk</code> to
9156: help dealing with these tools. See comments in these
9157: files for details.</p>
1.1 grant 9158:
9159: <p>For packages that need only autoconf:</p>
9160: <pre class="programlisting">
9161: AUTOCONF_REQD= 2.50 # if default version is not good enough
9162: ...
9163:
9164: pre-configure:
9165: cd ${WRKSRC}; ${AUTOCONF}
9166:
9167: ...
9168: .include "../../mk/autoconf.mk"
9169: </pre>
9170:
9171: <p>and for packages that need automake and
9172: autoconf:</p>
9173: <pre class="programlisting">
9174: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
9175: ...
9176:
9177: pre-configure:
9178: cd ${WRKSRC}; \
9179: ${ACLOCAL}; \
9180: ${AUTOHEADER}; \
9181: ${AUTOMAKE} -a --foreign -i; \
9182: ${AUTOCONF}
9183:
9184: ...
9185: .include "../mk/automake.mk"
9186: </pre>
9187:
9188: <p>Packages which use GNU Automake will almost
9189: certainly require GNU Make, but that's automatically
1.14 xtraeme 9190: provided for you in <code class=
9191: "filename">mk/automake.mk</code>.</p>
1.1 grant 9192:
9193: <p>There are times when the configure process makes
9194: additional changes to the generated files, which then
9195: causes the build process to try to re-execute the
9196: automake sequence. This is prevented by touching
9197: various files in the configure stage. If this causes
1.14 xtraeme 9198: problems with your package you can set <code class=
9199: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 9200: Makefile.</p>
9201: </div>
9202: </div>
9203:
9204: <div class="sect1" lang="en" xml:lang="en">
9205: <div class="titlepage">
9206: <div>
9207: <div>
9208: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 9209: "id2592621" id="id2592621"></a>12.4. Building
1.1 grant 9210: considerations</h2>
9211: </div>
9212: </div>
9213: </div>
9214:
9215: <div class="sect2" lang="en" xml:lang="en">
9216: <div class="titlepage">
9217: <div>
9218: <div>
1.17 ! sketch 9219: <h3 class="title"><a name="id2592625" id=
! 9220: "id2592625"></a>12.4.1. CPP defines</h3>
1.1 grant 9221: </div>
9222: </div>
9223: </div>
9224:
9225: <p>To port an application to NetBSD, it's usually
9226: necessary for the compiler to be able to judge the
9227: system on which it's compiling, and we use definitions
9228: so that the C pre-processor can do this.</p>
9229:
9230: <p>To test whether you are working on a 4.4 BSD-derived
9231: system, you should use the BSD definition, which is
1.14 xtraeme 9232: defined in <code class=
9233: "filename"><sys/param.h></code> on said
1.1 grant 9234: systems.</p>
9235: <pre class="programlisting">
9236: #include <sys/param.h>
9237: </pre>
9238:
9239: <p>and then you can surround the BSD-specific parts of
9240: your package's C/C++ code using this conditional:</p>
9241: <pre class="programlisting">
9242: #if (defined(BSD) && BSD >= 199306)
9243: ...
9244: #endif
9245: </pre>
9246:
9247: <p>Please use the “<span class=
9248: "quote">__NetBSD__</span>” definition sparingly -
9249: it should only apply to features of NetBSD that are not
9250: present in other 4.4-lite derived BSDs.</p>
9251: </div>
9252: </div>
9253:
9254: <div class="sect1" lang="en" xml:lang="en">
9255: <div class="titlepage">
9256: <div>
9257: <div>
9258: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 9259: "id2592791" id="id2592791"></a>12.5. Package
1.1 grant 9260: specific actions</h2>
9261: </div>
9262: </div>
9263: </div>
9264:
9265: <div class="sect2" lang="en" xml:lang="en">
9266: <div class="titlepage">
9267: <div>
9268: <div>
1.17 ! sketch 9269: <h3 class="title"><a name="id2592794" id=
! 9270: "id2592794"></a>12.5.1. Package
1.1 grant 9271: configuration files</h3>
9272: </div>
9273: </div>
9274: </div>
9275:
9276: <p>Packages should be taught to look for their
1.14 xtraeme 9277: configuration files in <code class=
9278: "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1 grant 9279: through to the configure and build processes.
1.14 xtraeme 9280: <code class="varname">PKG_SYSCONFDIR</code> may be
1.1 grant 9281: customized in various ways by setting other make
9282: variables:</p>
9283:
9284: <div class="itemizedlist">
9285: <ul type="disc">
9286: <li>
1.14 xtraeme 9287: <p><code class="varname">PKG_SYSCONFBASE</code>
9288: is the main config directory under which all
9289: package configuration files are to be found. This
9290: defaults to <code class=
9291: "filename">${PREFIX}/etc</code>, but may be
9292: overridden in <code class=
9293: "filename">/etc/mk.conf</code>.</p>
1.1 grant 9294: </li>
9295:
9296: <li>
1.14 xtraeme 9297: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
9298: is the subdirectory of <code class=
9299: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 9300: configuration files for a particular package may
9301: be found, e.g. the Apache configuration files may
1.14 xtraeme 9302: all be found under the <code class=
9303: "filename">httpd/</code> subdirectory of
9304: <code class="varname">${PKG_SYSCONFBASE}</code>.
9305: This should be set in the package Makefile.</p>
1.1 grant 9306: </li>
9307:
9308: <li>
1.14 xtraeme 9309: <p>By default, <code class=
9310: "varname">PKG_SYSCONFDIR</code> is set to
9311: <code class=
9312: "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
9313: but this may be overridden by setting
9314: <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9315: for a particular package, where <code class=
9316: "varname">PKG_SYSCONFVAR</code> defaults to
9317: <code class="varname">${PKGBASE}</code>. This is
9318: not meant to be set by a package Makefile, but is
1.1 grant 9319: reserved for users who wish to override the
1.14 xtraeme 9320: <code class="varname">PKG_SYSCONFDIR</code>
9321: setting for a particular package with a special
1.1 grant 9322: location.</p>
9323: </li>
9324: </ul>
9325: </div>
9326:
9327: <p>The only variables that users should customize are
1.14 xtraeme 9328: <code class="varname">PKG_SYSCONFBASE</code> and
9329: <code class=
9330: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
9331: Users will typically want to set <code class=
9332: "varname">PKG_SYSCONFBASE</code> to <code class=
9333: "filename">/etc</code>, or to accept the default
9334: location of <code class=
9335: "filename">${PREFIX}/etc</code>.</p>
1.1 grant 9336: </div>
9337:
9338: <div class="sect2" lang="en" xml:lang="en">
9339: <div class="titlepage">
9340: <div>
9341: <div>
1.17 ! sketch 9342: <h3 class="title"><a name="id2592897" id=
! 9343: "id2592897"></a>12.5.2. User
1.2 hubertf 9344: interaction</h3>
1.1 grant 9345: </div>
9346: </div>
9347: </div>
9348:
9349: <p>Occasionally, packages require interaction from the
9350: user, and this can be in a number of ways:</p>
9351:
9352: <div class="itemizedlist">
9353: <ul type="disc">
9354: <li>
9355: <p>help in fetching the distfiles</p>
9356: </li>
9357:
9358: <li>
9359: <p>help to configure the package before it is
9360: built</p>
9361: </li>
9362:
9363: <li>
9364: <p>help during the build process</p>
9365: </li>
9366:
9367: <li>
9368: <p>help during the installation of a package</p>
9369: </li>
9370: </ul>
9371: </div>
9372:
1.14 xtraeme 9373: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 9374: definition is provided to notify the pkgsrc mechanism
9375: of an interactive stage which will be needed, and this
1.14 xtraeme 9376: should be set in the package's <code class=
9377: "filename">Makefile</code>. e.g.</p>
1.1 grant 9378: <pre class="programlisting">
9379: INTERACTIVE_STAGE= build
9380: </pre>
9381:
9382: <p>Multiple interactive stages can be specified:</p>
9383: <pre class="programlisting">
9384: INTERACTIVE_STAGE= configure install
9385: </pre>
9386: </div>
9387:
9388: <div class="sect2" lang="en" xml:lang="en">
9389: <div class="titlepage">
9390: <div>
9391: <div>
1.17 ! sketch 9392: <h3 class="title"><a name="id2593010" id=
! 9393: "id2593010"></a>12.5.3. Handling
1.1 grant 9394: licenses</h3>
9395: </div>
9396: </div>
9397: </div>
9398:
9399: <p>A package may underly a license which the user has
9400: or has not agreed to accept. Usually, packages that
9401: underly well-known Open Source licenses (e.g. the GNU
9402: Public License, GPL) won't have any special license
9403: tags added in pkgsrc which require special action by
9404: the user of such packages, but there are quite a number
9405: of other licenses out there that pkgsrc users may not
9406: be able to follow, for whatever reasons. For these
9407: cases, pkgsrc contains a mechanism to note that a
9408: package underlies a certain license, and the user has
9409: to accept the license before the package can be
9410: installed.</p>
9411:
9412: <p>Placing a certain package under a certain license
1.14 xtraeme 9413: works by setting the <code class=
9414: "varname">LICENSE</code> variable to a string
9415: identifying the license, e.g. in <a xmlns=
9416: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 9417: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.14 xtraeme 9418: class="pkgname">graphics/graphviz</a>:</p>
1.1 grant 9419: <pre class="programlisting">
9420: LICENSE= graphviz-license
9421: </pre>
9422:
9423: <p>When trying to build, the user will get a notice
9424: that the package underlies a license which he hasn't
9425: accepted (yet):</p>
9426: <pre class="programlisting">
1.14 xtraeme 9427: <code class="prompt">%</code> <strong class=
9428: "userinput"><code>make</code></strong>
1.1 grant 9429: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
9430: ===> To build this package, add this line to your /etc/mk.conf:
9431: ===> ACCEPTABLE_LICENSES+=graphviz-license
9432: ===> To view the license, enter "/usr/bin/make show-license".
9433: *** Error code 1
9434: </pre>
9435:
1.14 xtraeme 9436: <p>The license can be viewed with <span><strong class=
9437: "command">make show-license</strong></span>, and if it
9438: is considered appropriate, the line printed above can
9439: be added to <code class="filename">/etc/mk.conf</code>
9440: to indicate acceptance of the particular license:</p>
1.1 grant 9441: <pre class="programlisting">
9442: ACCEPTABLE_LICENSES+=graphviz-license
9443: </pre>
9444:
9445: <p>When adding a package with a new license, the
1.14 xtraeme 9446: license text should be added to <code class=
9447: "filename">pkgsrc/licenses</code> for displaying. A
9448: list of known licenses can be seen in this directory as
9449: well as by looking at the list of (commented out)
9450: <code class="varname">ACCEPTABLE_LICENSES</code>
9451: variable settings in <code class=
9452: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 9453:
1.17 ! sketch 9454: <p>If there is a <span class=
1.1 grant 9455: "emphasis"><em>really</em></span> pressing need to
9456: accept all licenses at once, like when trying to
9457: download or mirror all distfiles or doing a bulk build
9458: to test if all packages in pkgsrc build, this can be
1.14 xtraeme 9459: done by setting <code class=
9460: "varname">_ACCEPTABLE=yes</code>.</p>
1.1 grant 9461: </div>
9462:
9463: <div class="sect2" lang="en" xml:lang="en">
9464: <div class="titlepage">
9465: <div>
9466: <div>
1.17 ! sketch 9467: <h3 class="title"><a name="id2593093" id=
! 9468: "id2593093"></a>12.5.4. Creating an account
1.1 grant 9469: from a package</h3>
9470: </div>
9471: </div>
9472: </div>
9473:
9474: <p>There are two make variables used to control the
9475: creation of package-specific groups and users at
1.14 xtraeme 9476: pre-install time. The first is <code class=
9477: "varname">PKG_GROUPS</code>, which is a list of
1.1 grant 9478: group[:groupid] elements, where the groupid is
1.14 xtraeme 9479: optional. The second is <code class=
9480: "varname">PKG_USERS</code>, which is a list of elements
1.1 grant 9481: of the form:</p>
9482: <pre class="programlisting">
9483: user:group[:[userid][:[description][:[home][:shell]]]]
9484: </pre>
9485:
9486: <p>where only the user and group are required, the rest
9487: being optional. A simple example is:</p>
9488: <pre class="programlisting">
9489: PKG_GROUPS= foogroup
9490: PKG_USERS= foouser:foogroup
9491: </pre>
9492:
9493: <p>A more complex example is that creates two groups
9494: and two users is:</p>
9495: <pre class="programlisting">
9496: PKG_GROUPS= group1 group2:1005
9497: PKG_USERS= first:group1::First\\ User \
9498: second:group2::Second\\ User:/home/second:${SH}
9499: </pre>
9500:
9501: <p>By default, a new user will have home directory
1.14 xtraeme 9502: <code class="filename">/nonexistent</code>, and login
9503: shell <code class="filename">/sbin/nologin</code>
9504: unless they are specified as part of the user
9505: element.</p>
1.1 grant 9506:
1.14 xtraeme 9507: <p>The package <code class="filename">Makefile</code>
9508: must also set <code class=
9509: "varname">USE_PKGINSTALL=YES</code>. This will cause
9510: the users and groups to be created at pre-install time,
9511: and the admin will be prompted to remove them at
9512: post-deinstall time. Automatic creation of the users
9513: and groups can be toggled on and off by setting the
9514: <code class="varname">PKG_CREATE_USERGROUP</code>
9515: variable prior to package installation.</p>
1.1 grant 9516: </div>
9517:
9518: <div class="sect2" lang="en" xml:lang="en">
9519: <div class="titlepage">
9520: <div>
9521: <div>
1.17 ! sketch 9522: <h3 class="title"><a name="id2593223" id=
! 9523: "id2593223"></a>12.5.5. Installing score
1.1 grant 9524: files</h3>
9525: </div>
9526: </div>
9527: </div>
9528:
9529: <p>Certain packages, most of them in the games
9530: category, install a score file that allows all users on
9531: the system to record their highscores. In order for
9532: this to work, the binaries need to be installed setgid
9533: and the score files owned by the appropriate group
9534: and/or owner (traditionally the "games" user/group).
9535: The following variables, documented in more detail in
1.14 xtraeme 9536: <code class="filename">mk/defaults/mk.conf</code>,
9537: control this behaviour: <code class=
9538: "varname">SETGIDGAME</code>, <code class=
9539: "varname">GAMEDATAMODE</code>, <code class=
9540: "varname">GAMEGRP</code>, <code class=
9541: "varname">GAMEMODE</code>, <code class=
9542: "varname">GAMEOWN</code>.</p>
1.1 grant 9543:
9544: <p>Note that per default, setgid installation of games
1.14 xtraeme 9545: is disabled; setting <code class=
9546: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 9547: variables accordingly.</p>
9548:
9549: <p>A package should therefor never hard code file
1.14 xtraeme 9550: ownership or access permissions but rely on
9551: <code class="varname">INSTALL_GAME</code> and
9552: <code class="varname">INSTALL_GAME_DATA</code> to set
9553: these correctly.</p>
1.1 grant 9554: </div>
9555:
9556: <div class="sect2" lang="en" xml:lang="en">
9557: <div class="titlepage">
9558: <div>
9559: <div>
1.17 ! sketch 9560: <h3 class="title"><a name="id2593335" id=
! 9561: "id2593335"></a>12.5.6. Packages providing
1.1 grant 9562: login shells</h3>
9563: </div>
9564: </div>
9565: </div>
9566:
9567: <p>If the purpose of the package is to provide a login
1.14 xtraeme 9568: shell, the variable <code class=
9569: "varname">PKG_SHELL</code> should contain the full
9570: pathname of the shell executable installed by this
9571: package. The package <code class=
9572: "filename">Makefile</code> must also set <code class=
9573: "varname">USE_PKGINSTALL=YES</code> to use the
9574: automatically generated <code class=
9575: "filename">INSTALL</code>/<code class=
9576: "filename">DEINSTALL</code> scripts.</p>
1.1 grant 9577:
9578: <p>An example taken from shells/zsh:</p>
9579: <pre class="programlisting">
9580: USE_PKGINSTALL= YES
9581: PKG_SHELL= ${PREFIX}/bin/zsh
9582: </pre>
9583:
1.14 xtraeme 9584: <p>The shell is registered into <code class=
9585: "filename">/etc/shells</code> file automatically in the
9586: post-install target by the generated <code class=
9587: "filename">INSTALL</code> script and removed in the
9588: deinstall target by the <code class=
9589: "filename">DEINSTALL</code> script.</p>
1.1 grant 9590: </div>
9591:
9592: <div class="sect2" lang="en" xml:lang="en">
9593: <div class="titlepage">
9594: <div>
9595: <div>
1.17 ! sketch 9596: <h3 class="title"><a name="id2593393" id=
! 9597: "id2593393"></a>12.5.7. Packages containing
1.1 grant 9598: perl scripts</h3>
9599: </div>
9600: </div>
9601: </div>
9602:
9603: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 9604: set <code class="varname">REPLACE_PERL</code> to ensure
9605: that the proper interpreter path is set. <code class=
9606: "varname">REPLACE_PERL</code> should contain a list of
9607: scripts, relative to <code class=
9608: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 9609: </div>
9610:
9611: <div class="sect2" lang="en" xml:lang="en">
9612: <div class="titlepage">
9613: <div>
9614: <div>
1.17 ! sketch 9615: <h3 class="title"><a name="id2593411" id=
! 9616: "id2593411"></a>12.5.8. Packages with
1.1 grant 9617: hardcoded paths to other interpreters</h3>
9618: </div>
9619: </div>
9620: </div>
9621:
9622: <p>Your package may also contain scripts with hardcoded
9623: paths to other interpreters besides (or as well as)
9624: perl. To correct the full pathname to the script
9625: interpreter, you need to set the following definitions
1.14 xtraeme 9626: in your <code class="filename">Makefile</code> (we
9627: shall use <span><strong class=
9628: "command">tclsh</strong></span> in this example):</p>
1.1 grant 9629: <pre class="programlisting">
9630: REPLACE_INTERPRETER+= tcl
9631: _REPLACE.tcl.old= .*/bin/tclsh
9632: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
9633: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
9634: relative to ${WRKSRC}, just as in REPLACE_PERL
9635: </pre>
9636: </div>
9637:
9638: <div class="sect2" lang="en" xml:lang="en">
9639: <div class="titlepage">
9640: <div>
9641: <div>
1.17 ! sketch 9642: <h3 class="title"><a name="id2593432" id=
! 9643: "id2593432"></a>12.5.9. Packages installing
1.1 grant 9644: perl modules</h3>
9645: </div>
9646: </div>
9647: </div>
9648:
9649: <p>Makefiles of packages providing perl5 modules should
1.14 xtraeme 9650: include the Makefile fragment <code class=
9651: "filename">../../lang/perl5/module.mk</code>. It
9652: provides a <span><strong class=
9653: "command">do-configure</strong></span> target for the
9654: standard perl configuration for such modules as well as
9655: various hooks to tune this configuration. See comments
9656: in this file for details.</p>
1.1 grant 9657:
9658: <p>Perl5 modules will install into different places
9659: depending on the version of perl used during the build
9660: process. To address this, pkgsrc will append lines to
1.14 xtraeme 9661: the <code class="filename">PLIST</code> corresponding
9662: to the files listed in the installed <code class=
9663: "filename">.packlist</code> file generated by most
9664: perl5 modules. This is invoked by defining <code class=
9665: "varname">PERL5_PACKLIST</code> to a space-separated
9666: list of paths to packlist files, e.g.:</p>
1.1 grant 9667: <pre class="programlisting">
9668: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
9669: </pre>
9670:
1.14 xtraeme 9671: <p>The variables <code class=
9672: "varname">PERL5_SITELIB</code>, <code class=
9673: "varname">PERL5_SITEARCH</code>, and <code class=
9674: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 9675: locations in which perl5 modules may be installed, and
9676: may be used by perl5 packages that don't have a
9677: packlist. These three variables are also substituted
1.14 xtraeme 9678: for in the <code class="filename">PLIST</code>.</p>
1.1 grant 9679: </div>
9680:
9681: <div class="sect2" lang="en" xml:lang="en">
9682: <div class="titlepage">
9683: <div>
9684: <div>
9685: <h3 class="title"><a name="faq.info-files" id=
9686: "faq.info-files"></a>12.5.10. Packages
9687: installing info files</h3>
9688: </div>
9689: </div>
9690: </div>
9691:
9692: <p>Some packages install info files or use the
9693: “<span class="quote">makeinfo</span>” or
9694: “<span class="quote">install-info</span>”
9695: commands. Each of the info files:</p>
9696:
9697: <div class="itemizedlist">
9698: <ul type="disc">
9699: <li>
9700: <p>is considered to be installed in the directory
1.14 xtraeme 9701: <code class=
9702: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 9703: </li>
9704:
9705: <li>
9706: <p>is registered in the Info directory file
1.14 xtraeme 9707: <code class=
9708: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 9709: </li>
9710:
9711: <li>
9712: <p>and must be listed as a filename in the
1.14 xtraeme 9713: <code class="varname">INFO_FILES</code> variable
9714: in the package Makefile.</p>
1.1 grant 9715: </li>
9716: </ul>
9717: </div>
9718:
1.14 xtraeme 9719: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 9720: “<span class="quote">info</span>” and can
1.14 xtraeme 9721: be overridden in the package Makefile. <code class=
9722: "filename">INSTALL</code> and <code class=
9723: "filename">DEINSTALL</code> scripts will be generated
9724: to handle registration of the info files in the Info
1.1 grant 9725: directory file. The “<span class=
9726: "quote">install-info</span>” command used for the
9727: info files registration is either provided by the
9728: system, or by a special purpose package automatically
9729: added as dependency if needed.</p>
9730:
9731: <p>A package which needs the “<span class=
9732: "quote">makeinfo</span>” command at build time
1.14 xtraeme 9733: must define the variable <code class=
9734: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 9735: minimum version of the “<span class=
9736: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 9737: should be noted with the <code class=
9738: "varname">TEXINFO_REQD</code> variable in the package
9739: <code class="filename">Makefile</code>. By default, a
1.1 grant 9740: minimum version of 3.12 is required. If the system does
1.14 xtraeme 9741: not provide a <span><strong class=
9742: "command">makeinfo</strong></span> command or if it
9743: does not match the required minimum, a build dependency
9744: on the <a xmlns=
9745: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 9746: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.14 xtraeme 9747: class="pkgname">devel/gtexinfo</a> package will be
9748: added automatically.</p>
1.1 grant 9749:
9750: <p>The build and installation process of the software
9751: provided by the package should not use the
1.14 xtraeme 9752: <span><strong class=
9753: "command">install-info</strong></span> command as the
9754: registration of info files is the task of the package
9755: <code class="filename">INSTALL</code> script, and it
9756: must use the appropriate <span><strong class=
9757: "command">makeinfo</strong></span> command.</p>
1.1 grant 9758:
9759: <p>To achieve this goal the pkgsrc infrastructure
1.14 xtraeme 9760: creates overriding scripts for the <span><strong class=
9761: "command">install-info</strong></span> and
9762: <span><strong class="command">makeinfo</strong></span>
9763: commands in a directory listed early in <code class=
9764: "varname">PATH</code>.</p>
1.1 grant 9765:
1.14 xtraeme 9766: <p>The script overriding <span><strong class=
9767: "command">install-info</strong></span> has no effect
9768: except the logging of a message. The script overriding
9769: <span><strong class="command">makeinfo</strong></span>
9770: logs a message and according to the value of
9771: <code class="varname">USE_MAKEINFO</code> and
9772: <code class="varname">TEXINFO_REQD</code> either run
9773: the appropriate <span><strong class=
9774: "command">makeinfo</strong></span> command or exit on
9775: error.</p>
1.1 grant 9776: </div>
9777:
9778: <div class="sect2" lang="en" xml:lang="en">
9779: <div class="titlepage">
9780: <div>
9781: <div>
1.17 ! sketch 9782: <h3 class="title"><a name="id2593652" id=
! 9783: "id2593652"></a>12.5.11. Packages installing
1.1 grant 9784: GConf2 data files</h3>
9785: </div>
9786: </div>
9787: </div>
9788:
1.14 xtraeme 9789: <p>If a package installs <code class=
9790: "filename">.schemas</code> or <code class=
9791: "filename">.entries</code> files, used by GConf2, you
1.1 grant 9792: need to take some extra steps to make sure they get
9793: registered in the database:</p>
9794:
9795: <div class="orderedlist">
9796: <ol type="1">
9797: <li>
1.14 xtraeme 9798: <p>Include <code class=
9799: "filename">../../devel/GConf2/schemas.mk</code>
9800: instead of its <code class=
9801: "filename">buildlink3.mk</code> file. This takes
1.1 grant 9802: care of rebuilding the GConf2 database at
9803: installation and deinstallation time, and tells
9804: the package where to install GConf2 data files
9805: using some standard configure arguments. It also
9806: disallows any access to the database directly
9807: from the package.</p>
9808: </li>
9809:
9810: <li>
9811: <p>Ensure that the package installs its
1.14 xtraeme 9812: <code class="filename">.schemas</code> files
9813: under <code class=
9814: "filename">${PREFIX}/share/gconf/schemas</code>.
9815: If they get installed under <code class=
9816: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 9817: manually patch the package.</p>
9818: </li>
9819:
9820: <li>
9821: <p>Check the PLIST and remove any entries under
9822: the etc/gconf directory, as they will be handled
9823: automatically. See <a href="#faq.conf" title=
1.14 xtraeme 9824: "6.14. Configuration files handling and placement">
9825: Section 6.14, “Configuration files
1.1 grant 9826: handling and placement”</a> for more
9827: information.</p>
9828: </li>
9829:
9830: <li>
1.14 xtraeme 9831: <p>Define the <code class=
9832: "varname">GCONF2_SCHEMAS</code> variable in your
9833: <code class="filename">Makefile</code> with a
9834: list of all <code class=
9835: "filename">.schemas</code> files installed by the
9836: package, if any. Names must not contain any
9837: directories in them.</p>
1.1 grant 9838: </li>
9839:
9840: <li>
1.14 xtraeme 9841: <p>Define the <code class=
9842: "varname">GCONF2_ENTRIES</code> variable in your
9843: <code class="filename">Makefile</code> with a
9844: list of all <code class=
9845: "filename">.entries</code> files installed by the
9846: package, if any. Names must not contain any
9847: directories in them.</p>
1.1 grant 9848: </li>
9849: </ol>
9850: </div>
9851: </div>
9852:
9853: <div class="sect2" lang="en" xml:lang="en">
9854: <div class="titlepage">
9855: <div>
9856: <div>
1.17 ! sketch 9857: <h3 class="title"><a name="id2593752" id=
! 9858: "id2593752"></a>12.5.12. Packages installing
1.1 grant 9859: scrollkeeper data files</h3>
9860: </div>
9861: </div>
9862: </div>
9863:
1.14 xtraeme 9864: <p>If a package installs <code class=
9865: "filename">.omf</code> files, used by scrollkeeper, you
9866: need to take some extra steps to make sure they get
9867: registered in the database:</p>
1.1 grant 9868:
9869: <div class="orderedlist">
9870: <ol type="1">
9871: <li>
1.14 xtraeme 9872: <p>Include <code class=
9873: "filename">../../textproc/scrollkeeper/omf.mk</code>
9874: instead of its <code class=
9875: "filename">buildlink3.mk</code> file. This takes
1.1 grant 9876: care of rebuilding the scrollkeeper database at
9877: installation and deinstallation time, and
9878: disallows any access to it directly from the
9879: package.</p>
9880: </li>
9881:
9882: <li>
9883: <p>Check the PLIST and remove any entries under
1.14 xtraeme 9884: the <code class=
9885: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 9886: as they will be handled automatically.</p>
9887: </li>
9888:
9889: <li>
1.14 xtraeme 9890: <p>Remove the <code class=
9891: "filename">share/omf</code> directory from the
9892: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 9893: </li>
9894: </ol>
9895: </div>
9896: </div>
9897:
9898: <div class="sect2" lang="en" xml:lang="en">
9899: <div class="titlepage">
9900: <div>
9901: <div>
1.17 ! sketch 9902: <h3 class="title"><a name="id2593803" id=
! 9903: "id2593803"></a>12.5.13. Packages installing
1.1 grant 9904: X11 fonts</h3>
9905: </div>
9906: </div>
9907: </div>
9908:
9909: <p>If a package installs font files, you will need to
9910: rebuild the fonts database in the directory where they
9911: get installed at installation and deinstallation time.
1.14 xtraeme 9912: This can be automatically done by using <code class=
9913: "filename">mk/fonts.mk</code>, which you need to
9914: include in your <code class=
9915: "filename">Makefile</code>.</p>
1.1 grant 9916:
9917: <p>When the file is included, you can list the
1.14 xtraeme 9918: directories where fonts are installed in the
9919: <code class="varname">FONTS_<em class=
9920: "replaceable"><code>type</code></em>_DIRS</code>
9921: variables, where <em class=
9922: "replaceable"><code>type</code></em> can be one of
9923: “<span class="quote">TTF</span>”,
1.1 grant 9924: “<span class="quote">TYPE1</span>” or
9925: “<span class="quote">X11</span>”. Also make
1.14 xtraeme 9926: sure that the database file <code class=
9927: "filename">fonts.dir</code> is not listed in the
1.1 grant 9928: PLIST.</p>
9929:
9930: <p>Note that you should not create new directories for
9931: fonts; instead use the standard ones to avoid that the
9932: user needs to manually configure his X server to find
9933: them.</p>
9934: </div>
9935:
9936: <div class="sect2" lang="en" xml:lang="en">
9937: <div class="titlepage">
9938: <div>
9939: <div>
1.17 ! sketch 9940: <h3 class="title"><a name="id2593850" id=
! 9941: "id2593850"></a>12.5.14. Packages installing
1.1 grant 9942: GTK2 modules</h3>
9943: </div>
9944: </div>
9945: </div>
9946:
9947: <p>If a package installs gtk2 immodules or loaders, you
9948: need to take some extra steps to get them registered in
9949: the GTK2 database properly:</p>
9950:
9951: <div class="orderedlist">
9952: <ol type="1">
9953: <li>
1.14 xtraeme 9954: <p>Include <code class=
9955: "filename">../../x11/gtk2/modules.mk</code>
9956: instead of its <code class=
9957: "filename">buildlink3.mk</code> file. This takes
9958: care of rebuilding the database at installation
9959: and deinstallation time.</p>
1.1 grant 9960: </li>
9961:
9962: <li>
1.14 xtraeme 9963: <p>Set <code class=
9964: "varname">GTK2_IMMODULES=YES</code> if your
9965: package installs GTK2 immodules.</p>
1.1 grant 9966: </li>
9967:
9968: <li>
1.14 xtraeme 9969: <p>Set <code class=
9970: "varname">GTK2_LOADERS=YES</code> if your package
9971: installs GTK2 loaders.</p>
1.1 grant 9972: </li>
9973:
9974: <li>
9975: <p>Patch the package to not touch any of the gtk2
9976: databases directly. These are:</p>
9977:
9978: <div class="itemizedlist">
9979: <ul type="disc">
9980: <li>
1.14 xtraeme 9981: <p><code class=
9982: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 9983: </li>
9984:
9985: <li>
1.14 xtraeme 9986: <p><code class=
9987: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 9988: </li>
9989: </ul>
9990: </div>
9991: </li>
9992:
9993: <li>
9994: <p>Check the PLIST and remove any entries under
1.14 xtraeme 9995: the <code class="filename">libdata/gtk-2.0</code>
1.1 grant 9996: directory, as they will be handled
9997: automatically.</p>
9998: </li>
9999: </ol>
10000: </div>
10001: </div>
10002:
10003: <div class="sect2" lang="en" xml:lang="en">
10004: <div class="titlepage">
10005: <div>
10006: <div>
1.17 ! sketch 10007: <h3 class="title"><a name="id2593988" id=
! 10008: "id2593988"></a>12.5.15. Packages installing
1.1 grant 10009: SGML or XML data</h3>
10010: </div>
10011: </div>
10012: </div>
10013:
10014: <p>If a package installs SGML or XML data files that
10015: need to be registered in system-wide catalogs (like
10016: DTDs, sub-catalogs, etc.), you need to take some extra
10017: steps:</p>
10018:
10019: <div class="orderedlist">
10020: <ol type="1">
10021: <li>
1.14 xtraeme 10022: <p>Include <code class=
10023: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
10024: in your <code class="filename">Makefile</code>,
10025: which takes care of registering those files in
1.1 grant 10026: system-wide catalogs at installation and
10027: deinstallation time.</p>
10028: </li>
10029:
10030: <li>
1.14 xtraeme 10031: <p>Set <code class="varname">SGML_CATALOGS</code>
10032: to the full path of any SGML catalogs installed
10033: by the package.</p>
1.1 grant 10034: </li>
10035:
10036: <li>
1.14 xtraeme 10037: <p>Set <code class="varname">XML_CATALOGS</code>
10038: to the full path of any XML catalogs installed by
1.1 grant 10039: the package.</p>
10040: </li>
10041:
10042: <li>
1.14 xtraeme 10043: <p>Set <code class="varname">SGML_ENTRIES</code>
10044: to individual entries to be added to the SGML
1.1 grant 10045: catalog. These come in groups of three strings;
10046: see xmlcatmgr(1) for more information
10047: (specifically, arguments recognized by the 'add'
10048: action). Note that you will normally not use this
10049: variable.</p>
10050: </li>
10051:
10052: <li>
1.14 xtraeme 10053: <p>Set <code class="varname">XML_ENTRIES</code>
10054: to individual entries to be added to the XML
1.1 grant 10055: catalog. These come in groups of three strings;
10056: see xmlcatmgr(1) for more information
10057: (specifically, arguments recognized by the 'add'
10058: action). Note that you will normally not use this
10059: variable.</p>
10060: </li>
10061: </ol>
10062: </div>
10063: </div>
10064:
10065: <div class="sect2" lang="en" xml:lang="en">
10066: <div class="titlepage">
10067: <div>
10068: <div>
1.17 ! sketch 10069: <h3 class="title"><a name="id2594108" id=
! 10070: "id2594108"></a>12.5.16. Packages installing
1.1 grant 10071: extensions to the MIME database</h3>
10072: </div>
10073: </div>
10074: </div>
10075:
10076: <p>If a package provides extensions to the MIME
1.14 xtraeme 10077: database by installing <code class=
10078: "filename">.xml</code> files inside <code class=
10079: "filename">${PREFIX}/share/mime/packages</code>, you
10080: need to take some extra steps to ensure that the
10081: database is kept consistent with respect to these new
10082: files:</p>
1.1 grant 10083:
10084: <div class="orderedlist">
10085: <ol type="1">
10086: <li>
1.14 xtraeme 10087: <p>Include <code class=
10088: "filename">../../databases/shared-mime-info/mimedb.mk</code>
10089: (avoid using the <code class=
10090: "filename">buildlink3.mk</code> file from this
10091: same directory, which is reserved for inclusion
10092: from other <code class=
10093: "filename">buildlink3.mk</code> files). It takes
10094: care of rebuilding the MIME database at
10095: installation and deinstallation time, and
10096: disallows any access to it directly from the
1.1 grant 10097: package.</p>
10098: </li>
10099:
10100: <li>
10101: <p>Check the PLIST and remove any entries under
1.14 xtraeme 10102: the <code class="filename">share/mime</code>
1.1 grant 10103: directory, <span class=
10104: "emphasis"><em>except</em></span> for files saved
1.14 xtraeme 10105: under <code class=
10106: "filename">share/mime/packages</code>. The former
1.1 grant 10107: are handled automatically by the
10108: update-mime-database program, but the later are
10109: package-dependent and must be removed by the
10110: package that installed them in the first
10111: place.</p>
10112: </li>
10113:
10114: <li>
1.14 xtraeme 10115: <p>Remove any <code class=
10116: "filename">share/mime/*</code> directories from
10117: the PLIST. They will be handled by the
1.1 grant 10118: shared-mime-info package.</p>
10119: </li>
10120: </ol>
10121: </div>
10122: </div>
10123:
10124: <div class="sect2" lang="en" xml:lang="en">
10125: <div class="titlepage">
10126: <div>
10127: <div>
1.17 ! sketch 10128: <h3 class="title"><a name="id2594247" id=
! 10129: "id2594247"></a>12.5.17. Packages using
1.1 grant 10130: intltool</h3>
10131: </div>
10132: </div>
10133: </div>
10134:
10135: <p>If a package uses intltool during its build, include
1.14 xtraeme 10136: the <code class=
10137: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 10138: file, which forces it to use the intltool package
10139: provided by pkgsrc, instead of the one bundled with the
10140: distribution file.</p>
10141:
10142: <p>This tracks intltool's build-time dependencies and
10143: uses the latest available version; this way, the
10144: package benefits of any bug fixes that may have
10145: appeared since it was released.</p>
10146: </div>
10147: </div>
10148:
10149: <div class="sect1" lang="en" xml:lang="en">
10150: <div class="titlepage">
10151: <div>
10152: <div>
10153: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 10154: "id2594261" id="id2594261"></a>12.6. Feedback
1.1 grant 10155: to the author</h2>
10156: </div>
10157: </div>
10158: </div>
10159:
10160: <p>If you have found any bugs in the package you make
10161: available, if you had to do special steps to make it run
10162: under NetBSD or if you enhanced the software in various
10163: other ways, be sure to report these changes back to the
10164: original author of the program! With that kind of
10165: support, the next release of the program can incorporate
10166: these fixes, and people not using the NetBSD packages
10167: system can win from your efforts.</p>
10168:
10169: <p>Support the idea of free software!</p>
10170: </div>
10171: </div>
10172:
10173: <div class="chapter" lang="en" xml:lang="en">
10174: <div class="titlepage">
10175: <div>
10176: <div>
10177: <h2 class="title"><a name="debug" id=
10178: "debug"></a>Chapter 13. Debugging</h2>
10179: </div>
10180: </div>
10181: </div>
10182:
10183: <p>To check out all the gotchas when building a package,
10184: here are the steps that I do in order to get a package
10185: working. Please note this is basically the same as what was
10186: explained in the previous sections, only with some
10187: debugging aids.</p>
10188:
10189: <div class="itemizedlist">
10190: <ul type="disc">
10191: <li>
1.14 xtraeme 10192: <p>Be sure to set <code class=
10193: "varname">PKG_DEVELOPER=1</code> in <code class=
10194: "filename">/etc/mk.conf</code></p>
1.1 grant 10195: </li>
10196:
10197: <li>
10198: <p>Install <a xmlns=
10199: "http://www.w3.org/TR/xhtml1/transitional" href=
10200: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.14 xtraeme 10201: class="pkgname">pkgtools/url2pkg</a>, create a
10202: directory for a new package, change into it, then run
10203: <span><strong class=
10204: "command">url2pkg</strong></span>:</p>
1.1 grant 10205: <pre class="screen">
1.14 xtraeme 10206: <code class="prompt">%</code> <strong class=
10207: "userinput"><code>mkdir /usr/pkgsrc/<em class=
10208: "replaceable"><code>category</code></em>/<em class=
10209: "replaceable"><code>examplepkg</code></em></code></strong>
10210: <code class="prompt">%</code> <strong class=
10211: "userinput"><code>cd /usr/pkgsrc/<em class=
10212: "replaceable"><code>category</code></em>/<em class=
10213: "replaceable"><code>examplepkg</code></em></code></strong>
10214: <code class="prompt">%</code> <strong class=
10215: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 10216: </pre>
10217: </li>
10218:
10219: <li>
1.14 xtraeme 10220: <p>Edit the <code class="filename">Makefile</code> as
1.1 grant 10221: requested.</p>
10222: </li>
10223:
10224: <li>
1.14 xtraeme 10225: <p>Fill in the <code class="filename">DESCR</code>
1.1 grant 10226: file</p>
10227: </li>
10228:
10229: <li>
1.14 xtraeme 10230: <p>Run <span><strong class="command">make
10231: configure</strong></span></p>
1.1 grant 10232: </li>
10233:
10234: <li>
10235: <p>Add any dependencies glimpsed from documentation
1.14 xtraeme 10236: and the configure step to the package's <code class=
10237: "filename">Makefile</code>.</p>
1.1 grant 10238: </li>
10239:
10240: <li>
10241: <p>Make the package compile, doing multiple rounds
10242: of</p>
10243: <pre class="screen">
1.14 xtraeme 10244: <code class="prompt">%</code> <strong class=
10245: "userinput"><code>make</code></strong>
10246: <code class="prompt">%</code> <strong class=
10247: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
10248: <code class="prompt">%</code> <strong class=
10249: "userinput"><code>mkpatches</code></strong>
10250: <code class="prompt">%</code> <strong class=
10251: "userinput"><code>patchdiff</code></strong>
10252: <code class="prompt">%</code> <strong class=
10253: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
10254: <code class="prompt">%</code> <strong class=
10255: "userinput"><code>make mps</code></strong>
10256: <code class="prompt">%</code> <strong class=
10257: "userinput"><code>make clean</code></strong>
1.1 grant 10258: </pre>
10259:
10260: <p>Doing as non-root user will ensure that no files
10261: are modified that shouldn't be, especially during the
1.14 xtraeme 10262: build phase. <span><strong class=
10263: "command">mkpatches</strong></span>,
10264: <span><strong class=
10265: "command">patchdiff</strong></span> and
10266: <span><strong class="command">pkgvi</strong></span>
10267: are from the <a xmlns=
1.1 grant 10268: "http://www.w3.org/TR/xhtml1/transitional" href=
10269: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.14 xtraeme 10270: class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1 grant 10271: </li>
10272:
10273: <li>
1.14 xtraeme 10274: <p>Look at the <code class=
10275: "filename">Makefile</code>, fix if necessary; see
10276: <a href="#components.Makefile" title=
10277: "7.1. Makefile">Section 7.1,
10278: “<code class=
10279: "filename">Makefile</code>”</a>.</p>
1.1 grant 10280: </li>
10281:
10282: <li>
1.14 xtraeme 10283: <p>Generate a <code class=
10284: "filename">PLIST</code>:</p>
1.1 grant 10285: <pre class="screen">
1.14 xtraeme 10286: <code class="prompt">#</code> <strong class=
10287: "userinput"><code>make install</code></strong>
10288: <code class="prompt">#</code> <strong class=
10289: "userinput"><code>make print-PLIST >PLIST</code></strong>
10290: <code class="prompt">#</code> <strong class=
10291: "userinput"><code>make deinstall</code></strong>
10292: <code class="prompt">#</code> <strong class=
10293: "userinput"><code>make install</code></strong>
10294: <code class="prompt">#</code> <strong class=
10295: "userinput"><code>make deinstall</code></strong>
1.1 grant 10296: </pre>
10297:
1.14 xtraeme 10298: <p>You usually need to be <code class=
10299: "username">root</code> to do this. Look if there are
1.1 grant 10300: any files left:</p>
10301: <pre class="screen">
1.14 xtraeme 10302: <code class="prompt">#</code> <strong class=
10303: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 10304: </pre>
10305:
10306: <p>If this reveals any files that are missing in
1.14 xtraeme 10307: <code class="filename">PLIST</code>, add them.</p>
1.1 grant 10308: </li>
10309:
10310: <li>
1.14 xtraeme 10311: <p>Now that the <code class="filename">PLIST</code>
10312: is OK, install the package again and make a binary
1.1 grant 10313: package:</p>
10314: <pre class="screen">
1.14 xtraeme 10315: <code class="prompt">#</code> <strong class=
10316: "userinput"><code>make reinstall</code></strong>
10317: <code class="prompt">#</code> <strong class=
10318: "userinput"><code>make package</code></strong>
1.1 grant 10319: </pre>
10320: </li>
10321:
10322: <li>
10323: <p>Delete the installed package:</p>
10324: <pre class="screen">
1.14 xtraeme 10325: <code class="prompt">#</code> <strong class=
10326: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 10327: </pre>
10328: </li>
10329:
10330: <li>
1.14 xtraeme 10331: <p>Repeat the above <span><strong class=
10332: "command">make print-PLIST</strong></span> command,
10333: which shouldn't find anything now:</p>
1.1 grant 10334: <pre class="screen">
1.14 xtraeme 10335: <code class="prompt">#</code> <strong class=
10336: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 10337: </pre>
10338: </li>
10339:
10340: <li>
10341: <p>Reinstall the binary package:</p>
10342: <pre class="screen">
1.14 xtraeme 10343: <code class="prompt">#</code> <strong class=
10344: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 10345: </pre>
10346: </li>
10347:
10348: <li>
10349: <p>Play with it. Make sure everything works.</p>
10350: </li>
10351:
10352: <li>
1.14 xtraeme 10353: <p>Run <span><strong class=
10354: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 10355: "http://www.w3.org/TR/xhtml1/transitional" href=
10356: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.14 xtraeme 10357: class="pkgname">pkgtools/pkglint</a>, and fix the
10358: problems it reports:</p>
1.1 grant 10359: <pre class="screen">
1.14 xtraeme 10360: <code class="prompt">#</code> <strong class=
10361: "userinput"><code>pkglint</code></strong>
1.1 grant 10362: </pre>
10363: </li>
10364:
10365: <li>
10366: <p>Submit (or commit, if you have cvs access); see
10367: <a href="#submit" title=
10368: "Chapter 14. Submitting and Committing">Chapter 14,
10369: <i>Submitting and Committing</i></a>.</p>
10370: </li>
10371: </ul>
10372: </div>
10373: </div>
10374:
10375: <div class="chapter" lang="en" xml:lang="en">
10376: <div class="titlepage">
10377: <div>
10378: <div>
10379: <h2 class="title"><a name="submit" id=
10380: "submit"></a>Chapter 14. Submitting and
10381: Committing</h2>
10382: </div>
10383: </div>
10384: </div>
10385:
10386: <div class="toc">
10387: <p><b>Table of Contents</b></p>
10388:
10389: <dl>
1.17 ! sketch 10390: <dt><span class="sect1"><a href="#id2594723">14.1.
1.1 grant 10391: Submitting your packages</a></span></dt>
10392:
1.17 ! sketch 10393: <dt><span class="sect1"><a href="#id2594842">14.2.
1.1 grant 10394: Committing: Importing a package into
10395: CVS</a></span></dt>
10396:
1.17 ! sketch 10397: <dt><span class="sect1"><a href="#id2594905">14.3.
1.2 hubertf 10398: Updating a package to a newer version</a></span></dt>
1.1 grant 10399:
1.17 ! sketch 10400: <dt><span class="sect1"><a href="#id2594924">14.4.
1.2 hubertf 10401: Moving a package in pkgsrc</a></span></dt>
1.1 grant 10402: </dl>
10403: </div>
10404:
10405: <div class="sect1" lang="en" xml:lang="en">
10406: <div class="titlepage">
10407: <div>
10408: <div>
10409: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 10410: "id2594723" id=
! 10411: "id2594723"></a>14.1. Submitting your
1.1 grant 10412: packages</h2>
10413: </div>
10414: </div>
10415: </div>
10416:
10417: <p>You have to separate between binary and
10418: “<span class="quote">normal</span>” (source)
10419: packages here:</p>
10420:
10421: <div class="itemizedlist">
10422: <ul type="disc">
10423: <li>
10424: <p>precompiled binary packages</p>
10425:
10426: <p>Our policy is that we accept binaries only from
10427: pkgsrc developers to guarantee that the packages
10428: don't contain any trojan horses etc. This is not to
1.13 hubertf 10429: annoy anyone but rather to protect our users!
1.1 grant 10430: You're still free to put up your home-made binary
1.13 hubertf 10431: packages and tell the world where to get them.
10432: NetBSD developers doing bulk builds and wanting to
10433: upload them please see <a href="#bulk-upload"
10434: title="5.3.8. Uploading results of a bulk build">
10435: Section 5.3.8, “Uploading results of a
10436: bulk build”</a>.</p>
1.1 grant 10437: </li>
10438:
10439: <li>
10440: <p>packages</p>
10441:
10442: <p>First, check that your package is complete,
10443: compiles and runs well; see <a href="#debug" title=
10444: "Chapter 13. Debugging">Chapter 13,
10445: <i>Debugging</i></a> and the rest of this document.
10446: Next, generate an uuencoded gzipped tar(1) archive,
10447: preferably with all files in a single directory.
1.14 xtraeme 10448: Finally, <span><strong class=
10449: "command">send-pr</strong></span> with category
1.1 grant 10450: “<span class="quote">pkg</span>”, a
10451: synopsis which includes the package name and
10452: version number, a short description of your package
10453: (contents of the COMMENT variable or DESCR file are
10454: OK) and attach the archive to your PR.</p>
10455:
10456: <p>If you want to submit several packages, please
10457: send a separate PR for each one, it's easier for us
10458: to track things that way.</p>
10459:
10460: <p>Alternatively, you can also import new packages
10461: into pkgsrc-wip (“<span class="quote">pkgsrc
10462: work-in-progress</span>”); see the homepage
10463: at <a href="http://pkgsrc-wip.sourceforge.net/"
10464: target=
10465: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
10466: details.</p>
10467: </li>
10468: </ul>
10469: </div>
10470: </div>
10471:
10472: <div class="sect1" lang="en" xml:lang="en">
10473: <div class="titlepage">
10474: <div>
10475: <div>
10476: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 10477: "id2594842" id=
! 10478: "id2594842"></a>14.2. Committing: Importing a
1.1 grant 10479: package into CVS</h2>
10480: </div>
10481: </div>
10482: </div>
10483:
10484: <p>This section is only of interest for pkgsrc developers
10485: with write access to the pkgsrc repository. Please
10486: remember that cvs imports files relative to the current
10487: working directory, and that the pathname that you give
1.14 xtraeme 10488: the <span><strong class="command">cvs
10489: import</strong></span> command is so that it knows where
10490: to place the files in the repository. Newly created
10491: packages should be imported with a vendor tag of
10492: “<span class="quote">TNF</span>” and a
10493: release tag of “<span class=
10494: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 10495: <pre class="programlisting">
10496: % cd .../pkgsrc/category/pkgname
10497: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
10498: </pre>
10499:
10500: <p>Remember to move the directory from which you imported
10501: out of the way, or cvs will complain the next time you
10502: “<span class="quote">cvs update</span>” your
10503: source tree. Also don't forget to add the new package to
1.14 xtraeme 10504: the category's <code class=
10505: "filename">Makefile</code>.</p>
1.1 grant 10506:
10507: <p>The commit message of the initial import should
1.14 xtraeme 10508: include part of the <code class="filename">DESCR</code>
10509: file, so people reading the mailing lists know what the
10510: package is/does.</p>
1.1 grant 10511:
10512: <p>Please note all package updates/additions in
1.14 xtraeme 10513: <code class="filename">pkgsrc/doc/CHANGES</code>. It's
10514: very important to keep this file up to date and
10515: conforming to the existing format, because it will be
10516: used by scripts to automatically update pages on <a href=
1.1 grant 10517: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
10518: and other sites. Additionally, check the pkgsrc/doc/TODO
10519: file and remove the entry for the package you updated, in
10520: case it was mentioned there.</p>
10521:
10522: <p>For new packages, “<span class="quote">cvs
10523: import</span>” is preferred to “<span class=
10524: "quote">cvs add</span>” because the former gets
10525: everything with a single command, and provides a
10526: consistent tag.</p>
10527: </div>
10528:
10529: <div class="sect1" lang="en" xml:lang="en">
10530: <div class="titlepage">
10531: <div>
10532: <div>
10533: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 10534: "id2594905" id="id2594905"></a>14.3. Updating
1.2 hubertf 10535: a package to a newer version</h2>
1.1 grant 10536: </div>
10537: </div>
10538: </div>
10539:
10540: <p>Please always put a concise, appropriate and relevant
10541: summary of the changes between old and new versions into
10542: the commit log when updating a package. There are various
10543: reasons for this:</p>
10544:
10545: <div class="itemizedlist">
10546: <ul type="disc">
10547: <li>
10548: <p>A URL is volatile, and can change over time. It
10549: may go away completely or its information may be
10550: overwritten by newer information.</p>
10551: </li>
10552:
10553: <li>
10554: <p>Having the change information between old and
10555: new versions in our CVS repository is very useful
10556: for people who use either cvs or anoncvs.</p>
10557: </li>
10558:
10559: <li>
10560: <p>Having the change information between old and
10561: new versions in our CVS repository is very useful
10562: for people who read the pkgsrc-changes mailing
10563: list, so that they can make tactical decisions
10564: about when to upgrade the package.</p>
10565: </li>
10566: </ul>
10567: </div>
10568:
10569: <p>Please also recognise that, just because a new version
10570: of a package has been released, it should not
10571: automatically be upgraded in the CVS repository. We
10572: prefer to be conservative in the packages that are
10573: included in pkgsrc - development or beta packages are not
10574: really the best thing for most places in which pkgsrc is
10575: used. Please use your judgement about what should go into
10576: pkgsrc, and bear in mind that stability is to be
10577: preferred above new and possibly untested features.</p>
10578: </div>
10579:
10580: <div class="sect1" lang="en" xml:lang="en">
10581: <div class="titlepage">
10582: <div>
10583: <div>
10584: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 10585: "id2594924" id="id2594924"></a>14.4. Moving a
1.2 hubertf 10586: package in pkgsrc</h2>
1.1 grant 10587: </div>
10588: </div>
10589: </div>
10590:
10591: <div class="orderedlist">
10592: <ol type="1">
10593: <li>
10594: <p>Make a copy of the directory somewhere else.</p>
10595: </li>
10596:
10597: <li>
10598: <p>Remove all CVS dirs.</p>
10599:
10600: <p>Alternatively to the first two steps you can
10601: also do:</p>
10602: <pre class="screen">
1.14 xtraeme 10603: <code class="prompt">%</code> <strong class=
10604: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 10605: </pre>
10606:
10607: <p>and use that for further work.</p>
10608: </li>
10609:
10610: <li>
1.14 xtraeme 10611: <p>Fix <code class="varname">CATEGORIES</code> and
10612: any <code class="varname">DEPENDS</code> paths that
10613: just did “<span class=
1.1 grant 10614: "quote">../package</span>” instead of
10615: “<span class=
10616: "quote">../../category/package</span>”.</p>
10617: </li>
10618:
10619: <li>
1.14 xtraeme 10620: <p><span><strong class="command">cvs
10621: import</strong></span> the modified package in the
10622: new place.</p>
1.1 grant 10623: </li>
10624:
10625: <li>
10626: <p>Check if any package depends on it:</p>
10627: <pre class="screen">
1.14 xtraeme 10628: <code class="prompt">%</code> <strong class=
10629: "userinput"><code>cd /usr/pkgsrc</code></strong>
10630: <code class="prompt">%</code> <strong class=
10631: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 10632: </pre>
10633: </li>
10634:
10635: <li>
10636: <p>Fix paths in packages from step 5 to point to
10637: new location.</p>
10638: </li>
10639:
10640: <li>
1.14 xtraeme 10641: <p><span><strong class="command">cvs rm
10642: (-f)</strong></span> the package at the old
10643: location.</p>
1.1 grant 10644: </li>
10645:
10646: <li>
1.14 xtraeme 10647: <p>Remove from <code class=
10648: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 10649: </li>
10650:
10651: <li>
1.14 xtraeme 10652: <p>Add to <code class=
10653: "filename">newcategory/Makefile</code>.</p>
1.1 grant 10654: </li>
10655:
10656: <li>
10657: <p>Commit the changed and removed files:</p>
10658: <pre class="screen">
1.14 xtraeme 10659: <code class="prompt">%</code> <strong class=
10660: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 10661: </pre>
10662:
10663: <p>(and any packages from step 5, of course).</p>
10664: </li>
10665: </ol>
10666: </div>
10667: </div>
10668: </div>
10669: </div>
10670:
10671: <div class="appendix" lang="en" xml:lang="en">
10672: <div class="titlepage">
10673: <div>
10674: <div>
10675: <h2 class="title"><a name="examples" id=
10676: "examples"></a>Appendix A. A simple example
10677: package: bison</h2>
10678: </div>
10679: </div>
10680: </div>
10681:
10682: <div class="toc">
10683: <p><b>Table of Contents</b></p>
10684:
10685: <dl>
1.17 ! sketch 10686: <dt><span class="sect1"><a href="#id2595219">A.1.
1.1 grant 10687: files</a></span></dt>
10688:
10689: <dd>
10690: <dl>
1.17 ! sketch 10691: <dt><span class="sect2"><a href="#id2595222">A.1.1.
1.1 grant 10692: Makefile</a></span></dt>
10693:
1.17 ! sketch 10694: <dt><span class="sect2"><a href="#id2595229">A.1.2.
1.1 grant 10695: DESCR</a></span></dt>
10696:
1.17 ! sketch 10697: <dt><span class="sect2"><a href="#id2595244">A.1.3.
1.1 grant 10698: PLIST</a></span></dt>
10699:
1.17 ! sketch 10700: <dt><span class="sect2"><a href="#id2595252">A.1.4.
1.14 xtraeme 10701: Checking a package with <span><strong class=
10702: "command">pkglint</strong></span></a></span></dt>
1.1 grant 10703: </dl>
10704: </dd>
10705:
1.17 ! sketch 10706: <dt><span class="sect1"><a href="#id2595292">A.2. Steps
1.1 grant 10707: for building, installing, packaging</a></span></dt>
10708: </dl>
10709: </div>
10710:
10711: <p>We checked to find a piece of software that wasn't in the
10712: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 10713: would want to have <span><strong class=
10714: "command">bison</strong></span> when Berkeley
10715: <span><strong class="command">yacc</strong></span> is already
10716: present in the tree is beyond us, but it's useful for the
10717: purposes of this exercise.</p>
1.1 grant 10718:
10719: <div class="sect1" lang="en" xml:lang="en">
10720: <div class="titlepage">
10721: <div>
10722: <div>
10723: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 10724: "id2595219" id="id2595219"></a>A.1. files</h2>
1.1 grant 10725: </div>
10726: </div>
10727: </div>
10728:
10729: <div class="sect2" lang="en" xml:lang="en">
10730: <div class="titlepage">
10731: <div>
10732: <div>
1.17 ! sketch 10733: <h3 class="title"><a name="id2595222" id=
! 10734: "id2595222"></a>A.1.1. Makefile</h3>
1.1 grant 10735: </div>
10736: </div>
10737: </div>
10738: <pre class="programlisting">
1.17 ! sketch 10739: # $NetBSD$
1.1 grant 10740: #
10741:
10742: DISTNAME= bison-1.25
10743: CATEGORIES= devel
10744: MASTER_SITES= ${MASTER_SITE_GNU}
10745:
10746: MAINTAINER= thorpej@NetBSD.org
10747: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
10748: COMMENT= GNU yacc clone
10749:
10750: GNU_CONFIGURE= yes
10751: INFO_FILES= bison.info
10752:
10753: .include "../../mk/bsd.pkg.mk"
10754: </pre>
10755: </div>
10756:
10757: <div class="sect2" lang="en" xml:lang="en">
10758: <div class="titlepage">
10759: <div>
10760: <div>
1.17 ! sketch 10761: <h3 class="title"><a name="id2595229" id=
! 10762: "id2595229"></a>A.1.2. DESCR</h3>
1.1 grant 10763: </div>
10764: </div>
10765: </div>
10766: <pre class="programlisting">
10767: GNU version of yacc. Can make re-entrant parsers, and numerous other
10768: improvements. Why you would want this when Berkeley <a href=
10769: "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
10770: of the NetBSD source tree is beyond me.
10771: </pre>
10772: </div>
10773:
10774: <div class="sect2" lang="en" xml:lang="en">
10775: <div class="titlepage">
10776: <div>
10777: <div>
1.17 ! sketch 10778: <h3 class="title"><a name="id2595244" id=
! 10779: "id2595244"></a>A.1.3. PLIST</h3>
1.1 grant 10780: </div>
10781: </div>
10782: </div>
10783: <pre class="programlisting">
1.17 ! sketch 10784: @comment $NetBSD$
1.1 grant 10785: bin/bison
10786: man/man1/bison.1.gz
10787: share/bison.simple
10788: share/bison.hairy
10789: </pre>
10790: </div>
10791:
10792: <div class="sect2" lang="en" xml:lang="en">
10793: <div class="titlepage">
10794: <div>
10795: <div>
1.17 ! sketch 10796: <h3 class="title"><a name="id2595252" id=
! 10797: "id2595252"></a>A.1.4. Checking a package with
1.14 xtraeme 10798: <span><strong class=
10799: "command">pkglint</strong></span></h3>
1.1 grant 10800: </div>
10801: </div>
10802: </div>
10803:
10804: <p>The NetBSD package system comes with <a xmlns=
10805: "http://www.w3.org/TR/xhtml1/transitional" href=
10806: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.14 xtraeme 10807: class="pkgname">pkgtools/pkglint</a> which helps to check
10808: the contents of these files. After installation it is
10809: quite easy to use, just change to the directory of the
10810: package you wish to examine and execute
10811: <span><strong class=
10812: "command">pkglint</strong></span>:</p>
1.1 grant 10813: <pre class="screen">
1.14 xtraeme 10814: <code class="prompt">$</code> <strong class=
10815: "userinput"><code>pkglint</code></strong>
1.1 grant 10816: OK: checking ./DESCR.
10817: OK: checking Makefile.
10818: OK: checking distinfo.
10819: OK: checking patches/patch-aa.
10820: looks fine.
10821: </pre>
10822:
10823: <p>Depending on the supplied command line arguments (see
10824: pkglint(1)) more verbose checks will be performed. Use
1.14 xtraeme 10825: e.g. <span><strong class="command">pkglint
10826: -v</strong></span> for a very verbose check.</p>
1.1 grant 10827: </div>
10828: </div>
10829:
10830: <div class="sect1" lang="en" xml:lang="en">
10831: <div class="titlepage">
10832: <div>
10833: <div>
10834: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 10835: "id2595292" id="id2595292"></a>A.2. Steps for
1.1 grant 10836: building, installing, packaging</h2>
10837: </div>
10838: </div>
10839: </div>
10840:
10841: <p>Create the directory where the package lives, plus any
10842: auxiliary directories:</p>
10843: <pre class="screen">
1.14 xtraeme 10844: <code class="prompt">#</code> <strong class=
10845: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
10846: <code class="prompt">#</code> <strong class=
10847: "userinput"><code>mkdir bison</code></strong>
10848: <code class="prompt">#</code> <strong class=
10849: "userinput"><code>cd bison</code></strong>
10850: <code class="prompt">#</code> <strong class=
10851: "userinput"><code>mkdir patches</code></strong>
1.1 grant 10852: </pre>
10853:
1.14 xtraeme 10854: <p>Create <code class="filename">Makefile</code>,
10855: <code class="filename">DESCR</code> and <code class=
10856: "filename">PLIST</code> (see <a href="#components" title=
1.1 grant 10857: "Chapter 7. Package components - files, directories and contents">
10858: Chapter 7, <i>Package components - files, directories and
10859: contents</i></a>) then continue with fetching the
10860: distfile:</p>
10861: <pre class="screen">
1.14 xtraeme 10862: <code class="prompt">#</code> <strong class=
10863: "userinput"><code>make fetch</code></strong>
1.1 grant 10864: >> bison-1.25.tar.gz doesn't seem to exist on this system.
10865: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
10866: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10867: ftp: Error retrieving file: 500 Internal error
10868:
10869: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
10870: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10871: ftp: Error retrieving file: 500 Internal error
10872:
10873: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
10874: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10875: Successfully retrieved file.
10876: </pre>
10877:
1.14 xtraeme 10878: <p>Generate the checksum of the distfile into <code class=
10879: "filename">distinfo</code>:</p>
1.1 grant 10880: <pre class="screen">
1.14 xtraeme 10881: <code class="prompt">#</code> <strong class=
10882: "userinput"><code>make makesum</code></strong>
1.1 grant 10883: </pre>
10884:
10885: <p>Now compile:</p>
10886: <pre class="screen">
1.14 xtraeme 10887: <code class="prompt">#</code> <strong class=
10888: "userinput"><code>make</code></strong>
1.1 grant 10889: >> Checksum OK for bison-1.25.tar.gz.
10890: ===> Extracting for bison-1.25
10891: ===> Patching for bison-1.25
10892: ===> Ignoring empty patch directory
10893: ===> Configuring for bison-1.25
10894: creating cache ./config.cache
10895: checking for gcc... cc
10896: checking whether we are using GNU C... yes
10897: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
10898: checking how to run the C preprocessor... cc -E
10899: checking for minix/config.h... no
10900: checking for POSIXized ISC... no
10901: checking whether cross-compiling... no
10902: checking for ANSI C header files... yes
10903: checking for string.h... yes
10904: checking for stdlib.h... yes
10905: checking for memory.h... yes
10906: checking for working const... yes
10907: checking for working alloca.h... no
10908: checking for alloca... yes
10909: checking for strerror... yes
10910: updating cache ./config.cache
10911: creating ./config.status
10912: creating Makefile
10913: ===> Building for bison-1.25
10914: 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
10915: 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
10916: 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
10917: 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
10918: 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
10919: 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
10920: 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
10921: 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
10922: 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
10923: 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
10924: 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
10925: 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
10926: 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
10927: 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
10928: 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
10929: 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
10930: 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
10931: 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
10932: 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
10933: 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
10934: 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
10935: 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
10936: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
10937: rm -f bison.s1
10938: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
10939: </pre>
10940:
10941: <p>Everything seems OK, so install the files:</p>
10942: <pre class="screen">
1.14 xtraeme 10943: <code class="prompt">#</code> <strong class=
10944: "userinput"><code>make install</code></strong>
1.1 grant 10945: >> Checksum OK for bison-1.25.tar.gz.
10946: ===> Installing for bison-1.25
10947: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
10948: rm -f /usr/pkg/bin/bison
10949: cd /usr/pkg/share; rm -f bison.simple bison.hairy
10950: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
10951: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
10952: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
10953: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
10954: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
10955: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
10956: ===> Registering installation for bison-1.25
10957: </pre>
10958:
10959: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 10960: remove it with <span><strong class="command">pkg_delete
10961: bison</strong></span>. Should you decide that you want a
10962: binary package, do this now:</p>
1.1 grant 10963: <pre class="screen">
1.14 xtraeme 10964: <code class="prompt">#</code> <strong class=
10965: "userinput"><code>make package</code></strong>
1.1 grant 10966: >> Checksum OK for bison-1.25.tar.gz.
10967: ===> Building package for bison-1.25
10968: Creating package bison-1.25.tgz
10969: Registering depends:.
10970: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
10971: </pre>
10972:
10973: <p>Now that you don't need the source and object files any
10974: more, clean up:</p>
10975: <pre class="screen">
1.14 xtraeme 10976: <code class="prompt">#</code> <strong class=
10977: "userinput"><code>make clean</code></strong>
1.1 grant 10978: ===> Cleaning for bison-1.25
10979: </pre>
10980: </div>
10981: </div>
10982:
10983: <div class="appendix" lang="en" xml:lang="en">
10984: <div class="titlepage">
10985: <div>
10986: <div>
10987: <h2 class="title"><a name="logs" id=
10988: "logs"></a>Appendix B. Build logs</h2>
10989: </div>
10990: </div>
10991: </div>
10992:
10993: <div class="toc">
10994: <p><b>Table of Contents</b></p>
10995:
10996: <dl>
10997: <dt><span class="sect1"><a href="#logs.building">B.1.
10998: Building figlet</a></span></dt>
10999:
11000: <dt><span class="sect1"><a href="#logs.package">B.2.
11001: Packaging figlet</a></span></dt>
11002: </dl>
11003: </div>
11004:
11005: <div class="sect1" lang="en" xml:lang="en">
11006: <div class="titlepage">
11007: <div>
11008: <div>
11009: <h2 class="title" style="clear: both"><a name=
11010: "logs.building" id=
11011: "logs.building"></a>B.1. Building figlet</h2>
11012: </div>
11013: </div>
11014: </div>
11015: <pre class="screen">
1.14 xtraeme 11016: <code class="prompt">#</code> <strong class=
11017: "userinput"><code>make</code></strong>
1.1 grant 11018: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11019: => figlet221.tar.gz doesn't seem to exist on this system.
11020: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
11021: => [172219 bytes]
11022: Connected to ftp.plig.net.
11023: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
11024: 331 Guest login ok, send your complete e-mail address as password.
11025: 230-You are user #5 of 500 simultaneous users allowed.
11026: 230-
11027: 230- ___ _ _ _
11028: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
11029: 230- | _| _| . |_| . | | | . |_| . | _| . |
11030: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
11031: 230- |_| |_| |___| |___|
11032: 230-
11033: 230-** Welcome to ftp.plig.org **
11034: 230-
11035: 230-Please note that all transfers from this FTP site are logged. If you
11036: 230-do not like this, please disconnect now.
11037: 230-
11038: 230-This arhive is available via
11039: 230-
11040: 230-HTTP: http://ftp.plig.org/
11041: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
11042: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
11043: 230-
11044: 230-Please email comments, bug reports and requests for packages to be
11045: 230-mirrored to ftp-admin@plig.org.
11046: 230-
11047: 230-
11048: 230 Logged in anonymously.
11049: Remote system type is UNIX.
11050: Using binary mode to transfer files.
11051: 200 Type okay.
11052: 250 "/pub" is new cwd.
11053: 250-"/pub/figlet" is new cwd.
11054: 250-
11055: 250-Welcome to the figlet archive at ftp.figlet.org
11056: 250-
11057: 250- ftp://ftp.figlet.org/pub/figlet/
11058: 250-
11059: 250-The official FIGlet web page is:
11060: 250- http://www.figlet.org/
11061: 250-
11062: 250-If you have questions, please mailto:info@figlet.org. If you want to
11063: 250-contribute a font or something else, you can email us.
11064: 250
11065: 250 "/pub/figlet/program" is new cwd.
11066: 250 "/pub/figlet/program/unix" is new cwd.
11067: local: figlet221.tar.gz remote: figlet221.tar.gz
11068: 502 Unimplemented command.
11069: 227 Entering Passive Mode (195,40,6,41,246,104)
11070: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
11071: 38% |************** | 65800 64.16 KB/s 00:01 ETA
11072: 226 Transfer completed.
11073: 172219 bytes received in 00:02 (75.99 KB/s)
11074: 221 Goodbye.
11075: => Checksum OK for figlet221.tar.gz.
11076: ===> Extracting for figlet-2.2.1nb2
11077: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
11078: ===> Patching for figlet-2.2.1nb2
11079: ===> Applying pkgsrc patches for figlet-2.2.1nb2
11080: ===> Overriding tools for figlet-2.2.1nb2
11081: ===> Creating toolchain wrappers for figlet-2.2.1nb2
11082: ===> Configuring for figlet-2.2.1nb2
11083: ===> Building for figlet-2.2.1nb2
11084: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
11085: chmod a+x figlet
11086: gcc -O2 -o chkfont chkfont.c
11087: => Unwrapping files-to-be-installed.
1.14 xtraeme 11088: <code class="prompt">#</code>
11089: <code class="prompt">#</code> <strong class=
11090: "userinput"><code>make install</code></strong>
1.1 grant 11091: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11092: ===> Installing for figlet-2.2.1nb2
11093: install -d -o root -g wheel -m 755 /usr/pkg/bin
11094: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
11095: mkdir -p /usr/pkg/share/figlet
11096: cp figlet /usr/pkg/bin
11097: cp chkfont /usr/pkg/bin
11098: chmod 555 figlist showfigfonts
11099: cp figlist /usr/pkg/bin
11100: cp showfigfonts /usr/pkg/bin
11101: cp fonts/*.flf /usr/pkg/share/figlet
11102: cp fonts/*.flc /usr/pkg/share/figlet
11103: cp figlet.6 /usr/pkg/man/man6
11104: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 11105: <code class="prompt">#</code>
1.1 grant 11106: </pre>
11107: </div>
11108:
11109: <div class="sect1" lang="en" xml:lang="en">
11110: <div class="titlepage">
11111: <div>
11112: <div>
11113: <h2 class="title" style="clear: both"><a name=
11114: "logs.package" id=
11115: "logs.package"></a>B.2. Packaging figlet</h2>
11116: </div>
11117: </div>
11118: </div>
11119: <pre class="screen">
1.14 xtraeme 11120: <code class="prompt">#</code> <strong class=
11121: "userinput"><code>make package</code></strong>
1.1 grant 11122: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11123: ===> Packaging figlet-2.2.1nb2
11124: ===> Building binary package for figlet-2.2.1nb2
11125: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
11126: Using SrcDir value of /usr/pkg
11127: Registering depends:.
1.14 xtraeme 11128: <code class="prompt">#</code>
1.1 grant 11129: </pre>
11130: </div>
11131: </div>
11132:
11133: <div class="appendix" lang="en" xml:lang="en">
11134: <div class="titlepage">
11135: <div>
11136: <div>
11137: <h2 class="title"><a name="ftp-layout" id=
11138: "ftp-layout"></a>Appendix C. Layout of the
11139: FTP server's package archive</h2>
11140: </div>
11141: </div>
11142: </div>
11143:
11144: <p>Layout for precompiled binary packages on
11145: ftp.NetBSD.org:</p>
11146: <pre class="programlisting">
11147: /pub/NetBSD/packages/
11148: distfiles/
11149:
11150: # Unpacked pkgsrc trees
11151: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
11152: pkgsrc-2003Q4 -> N/A
11153: pkgsrc-2004Q1/pkgsrc
11154:
11155: # pkgsrc archives
11156: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
11157: pkgsrc-2003Q4.tar.gz -> N/A
11158: pkgsrc-2004Q1.tar.gz -> N/A
11159:
11160: # Per pkgsrc-release/OS-release/arch package archives
11161: pkgsrc-2003Q4/
11162: NetBSD-1.6.2/
11163: i386/
11164: All/
11165: archivers/
11166: foo -> ../All/foo
11167: ...
11168: pkgsrc-2004Q1/
11169: NetBSD-1.6.2/
11170: i386/
11171: All/
11172: ...
11173: NetBSD-2.0/
11174: i386/
11175: All/
11176: ...
11177: SunOS-5.9/
11178: sparc/
11179: All/
11180: ...
11181: x86/
11182: All/
11183: ...
11184:
11185: # Per os-release package archive convenience links
11186: NetBSD-1.6.2 -> 1.6.2
11187: 1.6.2/
11188: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
11189: m68k/
11190: All/
11191: archivers/
11192: foo -> ../All/foo
11193: ...
11194: amiga -> m68k
11195: atari -> m68k
11196: ...
11197:
11198: 2.0 -> NetBSD-2.0 # backward compat, historic
11199: NetBSD-2.0/
11200: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
11201: SunOS-5.9/
11202: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
11203: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
11204:
11205: </pre>
11206:
11207: <p>To create:</p>
11208:
11209: <div class="orderedlist">
11210: <ol type="1">
11211: <li>
11212: <p>Run bulk build, see <a href="#bulkbuild" title=
11213: "5.3. Doing a bulk build of all packages">Section
11214: 5.3, “Doing a bulk build of all
11215: packages”</a></p>
11216: </li>
11217:
11218: <li>
11219: <p>Upload /usr/pkgsrc/packages to</p>
11220: <pre class="programlisting">
11221: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13 hubertf 11222: pkgsrc-2004Q4/\ # pkgsrc-branch
1.1 grant 11223: `uname -s`-`uname -r`/ # OS & version
11224: `uname -p` # architecture
11225:
11226: </pre>
11227: </li>
11228:
11229: <li>
1.14 xtraeme 11230: <p>If necessary, create a symlink <span><strong class=
11231: "command">ln -s `uname -m` `uname -p`</strong></span>
11232: (amiga -> m68k, ...)</p>
1.1 grant 11233: </li>
11234: </ol>
11235: </div>
11236: </div>
1.2 hubertf 11237:
11238: <div class="appendix" lang="en" xml:lang="en">
11239: <div class="titlepage">
11240: <div>
11241: <div>
11242: <h2 class="title"><a name="editing" id=
11243: "editing"></a>Appendix D. Editing guidelines
11244: for the pkgsrc guide</h2>
11245: </div>
11246: </div>
11247: </div>
11248:
11249: <div class="toc">
11250: <p><b>Table of Contents</b></p>
11251:
11252: <dl>
1.17 ! sketch 11253: <dt><span class="sect1"><a href="#id2596075">D.1.
1.2 hubertf 11254: Targets</a></span></dt>
11255:
1.17 ! sketch 11256: <dt><span class="sect1"><a href="#id2596282">D.2.
1.2 hubertf 11257: Procedure</a></span></dt>
11258: </dl>
11259: </div>
11260:
11261: <p>This section contains information on editing the pkgsrc
11262: guide itself.</p>
11263:
11264: <div class="sect1" lang="en" xml:lang="en">
11265: <div class="titlepage">
11266: <div>
11267: <div>
11268: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 11269: "id2596075" id="id2596075"></a>D.1. Targets</h2>
1.2 hubertf 11270: </div>
11271: </div>
11272: </div>
11273:
1.14 xtraeme 11274: <p>The pkgsrc guide's source code is stored in <code class=
11275: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 11276: are created from it:</p>
11277:
11278: <div class="itemizedlist">
11279: <ul type="disc">
11280: <li>
1.14 xtraeme 11281: <p><code class=
11282: "filename">pkgsrc/doc/pkgsrc.txt</code>, which
11283: replaces <code class=
11284: "filename">pkgsrc/Packages.txt</code></p>
1.2 hubertf 11285: </li>
11286:
11287: <li>
1.14 xtraeme 11288: <p><code class=
11289: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 11290: </li>
11291:
11292: <li>
1.14 xtraeme 11293: <p><code class=
11294: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 11295: the documentation on the NetBSD website will be built
11296: from pkgsrc and kept up to date on the web server
11297: itself. This means you <span class=
11298: "emphasis"><em>must</em></span> make sure that your
11299: changes haven't broken the build!</p>
11300: </li>
1.6 hubertf 11301:
11302: <li>
1.14 xtraeme 11303: <p><code class=
11304: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 11305: PDF version of the pkgsrc guide.</p>
11306: </li>
11307:
11308: <li>
1.14 xtraeme 11309: <p><code class=
11310: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 11311: PostScript version of the pkgsrc guide.</p>
11312: </li>
1.2 hubertf 11313: </ul>
11314: </div>
11315: </div>
11316:
11317: <div class="sect1" lang="en" xml:lang="en">
11318: <div class="titlepage">
11319: <div>
11320: <div>
11321: <h2 class="title" style="clear: both"><a name=
1.17 ! sketch 11322: "id2596282" id=
! 11323: "id2596282"></a>D.2. Procedure</h2>
1.2 hubertf 11324: </div>
11325: </div>
11326: </div>
11327:
11328: <p>The procedure to edit the pkgsrc guide is:</p>
11329:
11330: <div class="itemizedlist">
11331: <ul type="disc">
11332: <li>
1.6 hubertf 11333: <p>Make sure you have the packages needed to
11334: re-generate the pkgsrc guide (and other XML-based
11335: NetBSD documentation) installed. These are
1.11 ben 11336: “<span class="quote">netbsd-doc</span>”
1.6 hubertf 11337: for creating the ASCII- and HTML-version, and
11338: “<span class=
1.11 ben 11339: "quote">netbsd-doc-print</span>”for the
1.6 hubertf 11340: PostScript- and PDF version. You will need both
11341: packages installed, to make sure documentation is
11342: consistent across all formats. The packages can be
1.14 xtraeme 11343: found in <code class=
11344: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
11345: <code class=
11346: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 11347: </li>
11348:
11349: <li>
1.14 xtraeme 11350: <p>Edit the XML file(s) in <code class=
11351: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 11352: </li>
11353:
11354: <li>
1.14 xtraeme 11355: <p>Run <span><strong class="command">make extract
11356: && make do-lint</strong></span> in
11357: <code class="filename">pkgsrc/doc/guide</code> to
11358: check the XML syntax, and fix it if needed.</p>
1.4 hubertf 11359: </li>
11360:
11361: <li>
1.14 xtraeme 11362: <p>Run <span><strong class=
11363: "command">make</strong></span> in <code class=
11364: "filename">pkgsrc/doc/guide</code> to build the HTML
11365: and ASCII version.</p>
1.2 hubertf 11366: </li>
11367:
11368: <li>
1.14 xtraeme 11369: <p>If all is well, run <span><strong class=
11370: "command">make install-doc</strong></span> to put the
11371: generated files into <code class=
11372: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 11373: </li>
11374:
11375: <li>
1.14 xtraeme 11376: <p><span><strong class="command">cvs commit
11377: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 11378: </li>
11379:
11380: <li>
1.14 xtraeme 11381: <p><span><strong class="command">cvs commit -m
11382: re-generate
11383: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 11384: </li>
1.4 hubertf 11385:
11386: <li>
11387: <p>Until the webserver on www.NetBSD.org is really
11388: updated automatically to pick up changes to the
1.14 xtraeme 11389: pkgsrc guide automatically, also run
11390: <span><strong class="command">make install-htdoc
11391: HTDOCSDIR=../../../htdocs</strong></span> (or
11392: similar, adjust <code class=
11393: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 11394: </li>
11395:
11396: <li>
1.14 xtraeme 11397: <p><span><strong class="command">cvs commit
11398: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 11399: </li>
1.2 hubertf 11400: </ul>
11401: </div>
11402: </div>
11403: </div>
1.1 grant 11404: </div>
11405: </body>
11406: </html>
CVSweb <webmaster@jp.NetBSD.org>