Annotation of pkgsrc/doc/pkgsrc.html, revision 1.26
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.20 ben 4: "HTML Tidy for NetBSD (vers 1st August 2004), see www.w3.org" />
1.1 grant 5: <meta http-equiv="Content-Type" content=
6: "text/html; charset=us-ascii" />
7:
8: <title>The pkgsrc guide</title>
9: <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
10: <meta name="generator" content=
1.23 wiz 11: "DocBook XSL Stylesheets VX.X.X" />
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.26 ! wiz 22: <h1 class="title"><a name="id2510574" id=
! 23: "id2510574"></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:
1.23 wiz 68: <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.25 rillig 69: <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.5
70: 2005/05/10 00:27:43 rillig 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.26 ! wiz 96: <dt><span class="sect1"><a href="#id2623537">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.26 ! wiz 120: <dt><span class="sect1"><a href="#id2569236">2.1.
1.1 grant 121: As tar file</a></span></dt>
122:
1.26 ! wiz 123: <dt><span class="sect1"><a href="#id2569252">2.2.
1.1 grant 124: Via SUP</a></span></dt>
125:
1.26 ! wiz 126: <dt><span class="sect1"><a href="#id2569420">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.26 ! wiz 136: <dt><span class="sect1"><a href="#id2569530">3.1.
1.1 grant 137: Bootstrapping pkgsrc</a></span></dt>
138:
1.26 ! wiz 139: <dt><span class="sect1"><a href="#id2569712">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.26 ! wiz 145: "#id2569718">3.2.1. Darwin (Mac OS
1.1 grant 146: X)</a></span></dt>
147:
148: <dt><span class="sect2"><a href=
1.26 ! wiz 149: "#id2569880">3.2.2. FreeBSD</a></span></dt>
1.1 grant 150:
151: <dt><span class="sect2"><a href=
1.26 ! wiz 152: "#id2570324">3.2.3. Interix</a></span></dt>
1.1 grant 153:
154: <dt><span class="sect2"><a href=
1.26 ! wiz 155: "#id2570557">3.2.4. IRIX</a></span></dt>
1.1 grant 156:
157: <dt><span class="sect2"><a href=
1.26 ! wiz 158: "#id2570654">3.2.5. Linux</a></span></dt>
1.1 grant 159:
160: <dt><span class="sect2"><a href=
1.26 ! wiz 161: "#id2570723">3.2.6. OpenBSD</a></span></dt>
1.22 tv 162:
163: <dt><span class="sect2"><a href=
1.26 ! wiz 164: "#id2570835">3.2.7. Solaris</a></span></dt>
1.1 grant 165: </dl>
166: </dd>
167: </dl>
168: </dd>
169:
170: <dt><span class="chapter"><a href="#using">4. Using
171: pkgsrc</a></span></dt>
172:
173: <dd>
174: <dl>
175: <dt><span class="sect1"><a href=
176: "#getting-started">4.1. Working with binary
177: packages</a></span></dt>
178:
179: <dd>
180: <dl>
181: <dt><span class="sect2"><a href=
1.26 ! wiz 182: "#id2571040">4.1.1. Where to get binary
1.1 grant 183: packages</a></span></dt>
184:
185: <dt><span class="sect2"><a href=
1.26 ! wiz 186: "#id2571080">4.1.2. How to use binary
1.1 grant 187: packages</a></span></dt>
188:
189: <dt><span class="sect2"><a href=
1.26 ! wiz 190: "#id2571256">4.1.3. A word of
1.1 grant 191: warning</a></span></dt>
192: </dl>
193: </dd>
194:
1.26 ! wiz 195: <dt><span class="sect1"><a href="#id2571336">4.2.
1.1 grant 196: Building packages from source</a></span></dt>
197:
198: <dd>
199: <dl>
200: <dt><span class="sect2"><a href=
1.26 ! wiz 201: "#id2571346">4.2.1.
1.1 grant 202: Requirements</a></span></dt>
203:
204: <dt><span class="sect2"><a href=
1.26 ! wiz 205: "#id2571366">4.2.2. Fetching
1.1 grant 206: distfiles</a></span></dt>
207:
208: <dt><span class="sect2"><a href=
1.26 ! wiz 209: "#id2571828">4.2.3. How to build and
1.1 grant 210: install</a></span></dt>
211:
212: <dt><span class="sect2"><a href=
1.26 ! wiz 213: "#id2623831">4.2.4. Selecting the
1.1 grant 214: compiler</a></span></dt>
215: </dl>
216: </dd>
217: </dl>
218: </dd>
219:
220: <dt><span class="chapter"><a href="#binary">5. Creating
221: binary packages</a></span></dt>
222:
223: <dd>
224: <dl>
1.26 ! wiz 225: <dt><span class="sect1"><a href="#id2623917">5.1.
1.1 grant 226: Building a single binary package</a></span></dt>
227:
1.26 ! wiz 228: <dt><span class="sect1"><a href="#id2623995">5.2.
1.1 grant 229: Settings for creation of binary
230: packages</a></span></dt>
231:
232: <dt><span class="sect1"><a href="#bulkbuild">5.3.
233: Doing a bulk build of all packages</a></span></dt>
234:
235: <dd>
236: <dl>
237: <dt><span class="sect2"><a href=
238: "#binary.configuration">5.3.1.
239: Configuration</a></span></dt>
240:
241: <dt><span class="sect2"><a href=
1.26 ! wiz 242: "#id2624142">5.3.2. Other environmental
1.1 grant 243: considerations</a></span></dt>
244:
245: <dt><span class="sect2"><a href=
1.26 ! wiz 246: "#id2624183">5.3.3. Operation</a></span></dt>
1.1 grant 247:
248: <dt><span class="sect2"><a href=
1.26 ! wiz 249: "#id2624252">5.3.4. What it
1.1 grant 250: does</a></span></dt>
251:
252: <dt><span class="sect2"><a href=
1.26 ! wiz 253: "#id2624309">5.3.5. Disk space
1.1 grant 254: requirements</a></span></dt>
255:
256: <dt><span class="sect2"><a href=
1.26 ! wiz 257: "#id2624336">5.3.6. Setting up a sandbox for
1.1 grant 258: chroot'ed builds</a></span></dt>
259:
260: <dt><span class="sect2"><a href=
1.26 ! wiz 261: "#id2624865">5.3.7. Building a partial set of
1.1 grant 262: packages</a></span></dt>
1.13 hubertf 263:
264: <dt><span class="sect2"><a href=
265: "#bulk-upload">5.3.8. Uploading results of a
266: bulk build</a></span></dt>
1.1 grant 267: </dl>
268: </dd>
269:
1.26 ! wiz 270: <dt><span class="sect1"><a href="#id2625321">5.4.
1.1 grant 271: Creating a multiple CD-ROM packages
272: collection</a></span></dt>
273:
274: <dd>
275: <dl>
276: <dt><span class="sect2"><a href=
1.26 ! wiz 277: "#id2625336">5.4.1. Example of
1.1 grant 278: cdpack</a></span></dt>
279: </dl>
280: </dd>
281: </dl>
282: </dd>
283:
284: <dt><span class="chapter"><a href="#faq">6. Frequently
285: Asked Questions</a></span></dt>
286:
287: <dd>
288: <dl>
1.26 ! wiz 289: <dt><span class="sect1"><a href="#id2625528">6.1.
1.18 xtraeme 290: Are there any mailing lists for pkg-related
1.1 grant 291: discussion?</a></span></dt>
292:
1.26 ! wiz 293: <dt><span class="sect1"><a href="#id2625662">6.2.
1.1 grant 294: Where's the pkgviews documentation?</a></span></dt>
295:
1.5 hubertf 296: <dt><span class="sect1"><a href=
297: "#faq-pkgtools">6.3. Utilities for package
298: management (pkgtools)</a></span></dt>
1.1 grant 299:
1.26 ! wiz 300: <dt><span class="sect1"><a href="#id2625984">6.4.
1.1 grant 301: How to use pkgsrc as non-root</a></span></dt>
302:
1.26 ! wiz 303: <dt><span class="sect1"><a href="#id2625995">6.5.
1.15 xtraeme 304: How to resume transfers when fetching
305: distfiles?</a></span></dt>
1.14 xtraeme 306:
1.26 ! wiz 307: <dt><span class="sect1"><a href="#id2626045">6.6.
1.1 grant 308: How can I install/use XFree86 from
309: pkgsrc?</a></span></dt>
310:
1.26 ! wiz 311: <dt><span class="sect1"><a href="#id2626073">6.7.
1.1 grant 312: How can I install/use X.org from
313: pkgsrc?</a></span></dt>
314:
1.26 ! wiz 315: <dt><span class="sect1"><a href="#id2626101">6.8.
1.1 grant 316: How to fetch files from behind a
317: firewall</a></span></dt>
318:
1.26 ! wiz 319: <dt><span class="sect1"><a href="#id2626115">6.9.
1.14 xtraeme 320: How do I tell <span><strong class="command">make
321: fetch</strong></span> to do passive
1.1 grant 322: FTP?</a></span></dt>
323:
1.26 ! wiz 324: <dt><span class="sect1"><a href="#id2626166">6.10.
1.1 grant 325: How to fetch all distfiles at once</a></span></dt>
326:
1.26 ! wiz 327: <dt><span class="sect1"><a href="#id2626313">6.11.
1.14 xtraeme 328: What does “<span class="quote">Don't know how
329: to make /usr/share/tmac/tmac.andoc</span>”
330: mean?</a></span></dt>
1.13 hubertf 331:
1.26 ! wiz 332: <dt><span class="sect1"><a href="#id2626352">6.12.
1.14 xtraeme 333: What does “<span class="quote">Could not find
334: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 335:
1.26 ! wiz 336: <dt><span class="sect1"><a href="#id2626409">6.13.
1.1 grant 337: Using 'sudo' with pkgsrc</a></span></dt>
338:
1.14 xtraeme 339: <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1 grant 340: Configuration files handling and
341: placement</a></span></dt>
342:
343: <dt><span class="sect1"><a href=
1.14 xtraeme 344: "#audit-packages">6.15. Automated security
1.1 grant 345: checks</a></span></dt>
346: </dl>
347: </dd>
348: </dl>
349: </dd>
350:
1.2 hubertf 351: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 352: pkgsrc developer's guide</a></span></dt>
353:
354: <dd>
355: <dl>
1.25 rillig 356: <dt><span class="chapter"><a href="#makefile">7.
357: Programming in <code class=
358: "filename">Makefile</code>s</a></span></dt>
359:
360: <dd>
361: <dl>
362: <dt><span class="sect1"><a href=
363: "#makefile.variables">7.1. <code class=
364: "filename">Makefile</code>
365: variables</a></span></dt>
366:
367: <dt><span class="sect1"><a href=
368: "#makefile.code">7.2. Code snippets</a></span></dt>
369:
370: <dd>
371: <dl>
372: <dt><span class="sect2"><a href=
1.26 ! wiz 373: "#id2627035">7.2.1. Adding things to a
1.25 rillig 374: list</a></span></dt>
375:
376: <dt><span class="sect2"><a href=
1.26 ! wiz 377: "#id2627113">7.2.2. Converting an internal list
1.25 rillig 378: into an external list</a></span></dt>
379:
380: <dt><span class="sect2"><a href=
1.26 ! wiz 381: "#id2627131">7.2.3. Passing variables to a
1.25 rillig 382: shell command</a></span></dt>
383: </dl>
384: </dd>
385: </dl>
386: </dd>
387:
388: <dt><span class="chapter"><a href="#components">8.
1.1 grant 389: Package components - files, directories and
390: contents</a></span></dt>
391:
392: <dd>
393: <dl>
394: <dt><span class="sect1"><a href=
1.25 rillig 395: "#components.Makefile">8.1. <code class=
1.14 xtraeme 396: "filename">Makefile</code></a></span></dt>
1.1 grant 397:
398: <dt><span class="sect1"><a href=
1.25 rillig 399: "#components.distinfo">8.2. <code class=
1.14 xtraeme 400: "filename">distinfo</code></a></span></dt>
1.1 grant 401:
402: <dt><span class="sect1"><a href=
1.25 rillig 403: "#components.patches">8.3.
1.1 grant 404: patches/*</a></span></dt>
405:
1.26 ! wiz 406: <dt><span class="sect1"><a href="#id2627827">8.4.
1.1 grant 407: Other mandatory files</a></span></dt>
408:
409: <dt><span class="sect1"><a href=
1.25 rillig 410: "#components.optional">8.5. Optional
1.1 grant 411: files</a></span></dt>
412:
1.26 ! wiz 413: <dt><span class="sect1"><a href="#id2628089">8.6.
1.14 xtraeme 414: <code class="filename">work*</code></a></span></dt>
1.1 grant 415:
1.26 ! wiz 416: <dt><span class="sect1"><a href="#id2628177">8.7.
1.14 xtraeme 417: <code class=
418: "filename">files/*</code></a></span></dt>
1.1 grant 419: </dl>
420: </dd>
421:
1.25 rillig 422: <dt><span class="chapter"><a href="#plist">9. PLIST
1.1 grant 423: issues</a></span></dt>
424:
425: <dd>
426: <dl>
1.26 ! wiz 427: <dt><span class="sect1"><a href="#id2628231">9.1.
1.1 grant 428: RCS ID</a></span></dt>
429:
1.26 ! wiz 430: <dt><span class="sect1"><a href="#id2628246">9.2.
1.14 xtraeme 431: Semi-automatic <code class="filename">PLIST</code>
432: generation</a></span></dt>
1.1 grant 433:
1.25 rillig 434: <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14 xtraeme 435: Tweaking output of <span><strong class=
436: "command">make
437: print-PLIST</strong></span></a></span></dt>
1.1 grant 438:
1.25 rillig 439: <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1 grant 440: Variable substitution in PLIST</a></span></dt>
441:
1.26 ! wiz 442: <dt><span class="sect1"><a href="#id2628499">9.5.
1.1 grant 443: Manpage-compression</a></span></dt>
444:
1.26 ! wiz 445: <dt><span class="sect1"><a href="#id2628609">9.6.
1.14 xtraeme 446: Changing PLIST source with <code class=
447: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 448:
1.26 ! wiz 449: <dt><span class="sect1"><a href="#id2628633">9.7.
1.1 grant 450: Platform specific and differing
451: PLISTs</a></span></dt>
452:
453: <dt><span class="sect1"><a href=
1.25 rillig 454: "#faq.common-dirs">9.8. Sharing directories between
1.1 grant 455: packages</a></span></dt>
456: </dl>
457: </dd>
458:
1.25 rillig 459: <dt><span class="chapter"><a href="#buildlink">10.
1.1 grant 460: Buildlink methodology</a></span></dt>
461:
462: <dd>
463: <dl>
1.26 ! wiz 464: <dt><span class="sect1"><a href="#id2628968">10.1.
1.1 grant 465: Converting packages to use
466: buildlink3</a></span></dt>
467:
1.26 ! wiz 468: <dt><span class="sect1"><a href="#id2629149">10.2.
1.14 xtraeme 469: Writing <code class="filename">buildlink3.mk</code>
470: files</a></span></dt>
1.1 grant 471:
472: <dd>
473: <dl>
474: <dt><span class="sect2"><a href=
1.26 ! wiz 475: "#id2629219">10.2.1. Anatomy of a buildlink3.mk
1.1 grant 476: file</a></span></dt>
477:
478: <dt><span class="sect2"><a href=
1.26 ! wiz 479: "#id2629796">10.2.2. Updating <code class=
1.14 xtraeme 480: "varname">BUILDLINK_DEPENDS.<em class=
481: "replaceable"><code>pkg</code></em></code> in
482: <code class="filename">buildlink3.mk</code>
1.1 grant 483: files</a></span></dt>
484: </dl>
485: </dd>
486:
1.26 ! wiz 487: <dt><span class="sect1"><a href="#id2629943">10.3.
1.14 xtraeme 488: Writing <code class="filename">builtin.mk</code>
489: files</a></span></dt>
1.1 grant 490:
491: <dd>
492: <dl>
493: <dt><span class="sect2"><a href=
1.26 ! wiz 494: "#id2630024">10.3.1. Anatomy of a <code class=
1.14 xtraeme 495: "filename">builtin.mk</code>
1.1 grant 496: file</a></span></dt>
497:
498: <dt><span class="sect2"><a href=
1.26 ! wiz 499: "#id2630183">10.3.2. Global preferences for
1.1 grant 500: native or pkgsrc software</a></span></dt>
501: </dl>
502: </dd>
503: </dl>
504: </dd>
505:
1.25 rillig 506: <dt><span class="chapter"><a href="#options">11.
1.1 grant 507: Options handling</a></span></dt>
508:
509: <dd>
510: <dl>
1.26 ! wiz 511: <dt><span class="sect1"><a href="#id2630256">11.1.
1.1 grant 512: Global default options</a></span></dt>
513:
1.26 ! wiz 514: <dt><span class="sect1"><a href="#id2630270">11.2.
1.14 xtraeme 515: Converting packages to use <code class=
516: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 517: </dl>
518: </dd>
519:
1.25 rillig 520: <dt><span class="chapter"><a href="#build">12. The
1.1 grant 521: build process</a></span></dt>
522:
523: <dd>
524: <dl>
525: <dt><span class="sect1"><a href=
1.25 rillig 526: "#build.prefix">12.1. Program
1.1 grant 527: location</a></span></dt>
528:
1.26 ! wiz 529: <dt><span class="sect1"><a href="#id2631098">12.2.
1.1 grant 530: Main targets</a></span></dt>
531:
532: <dt><span class="sect1"><a href=
1.25 rillig 533: "#build.helpful-targets">12.3. Other helpful
1.1 grant 534: targets</a></span></dt>
535: </dl>
536: </dd>
537:
1.25 rillig 538: <dt><span class="chapter"><a href="#fixes">13. Notes on
1.1 grant 539: fixes for packages</a></span></dt>
540:
541: <dd>
542: <dl>
1.26 ! wiz 543: <dt><span class="sect1"><a href="#id2632458">13.1.
1.1 grant 544: General operation</a></span></dt>
545:
546: <dd>
547: <dl>
548: <dt><span class="sect2"><a href=
1.26 ! wiz 549: "#id2632461">13.1.1. How to pull in variables
1.1 grant 550: from /etc/mk.conf</a></span></dt>
551:
552: <dt><span class="sect2"><a href=
1.26 ! wiz 553: "#id2632545">13.1.2. Restricted
1.1 grant 554: packages</a></span></dt>
555:
556: <dt><span class="sect2"><a href=
1.25 rillig 557: "#dependencies">13.1.3. Handling
1.1 grant 558: dependencies</a></span></dt>
559:
560: <dt><span class="sect2"><a href=
1.26 ! wiz 561: "#id2633066">13.1.4. Handling conflicts with
1.1 grant 562: other packages</a></span></dt>
563:
564: <dt><span class="sect2"><a href=
1.26 ! wiz 565: "#id2633116">13.1.5. Packages that cannot or
1.1 grant 566: should not be built</a></span></dt>
567:
568: <dt><span class="sect2"><a href=
1.26 ! wiz 569: "#id2633142">13.1.6. Packages which should not
1.1 grant 570: be deleted, once installed</a></span></dt>
571:
572: <dt><span class="sect2"><a href=
1.25 rillig 573: "#security-handling">13.1.7. Handling packages
1.1 grant 574: with security problems</a></span></dt>
575:
576: <dt><span class="sect2"><a href=
1.26 ! wiz 577: "#id2633234">13.1.8. How to handle compiler
1.1 grant 578: bugs</a></span></dt>
579:
580: <dt><span class="sect2"><a href=
1.26 ! wiz 581: "#id2633324">13.1.9. How to handle incrementing
1.1 grant 582: versions when fixing an existing
583: package</a></span></dt>
584:
585: <dt><span class="sect2"><a href=
1.26 ! wiz 586: "#id2633373">13.1.10. Portability of
1.1 grant 587: packages</a></span></dt>
588: </dl>
589: </dd>
590:
1.26 ! wiz 591: <dt><span class="sect1"><a href="#id2633398">13.2.
1.1 grant 592: Possible downloading issues</a></span></dt>
593:
594: <dd>
595: <dl>
596: <dt><span class="sect2"><a href=
1.26 ! wiz 597: "#id2633401">13.2.1. Packages whose distfiles
1.1 grant 598: aren't available for plain
599: downloading</a></span></dt>
600:
601: <dt><span class="sect2"><a href=
1.26 ! wiz 602: "#id2633601">13.2.2. How to handle modified
1.1 grant 603: distfiles with the 'old' name</a></span></dt>
604: </dl>
605: </dd>
606:
1.26 ! wiz 607: <dt><span class="sect1"><a href="#id2633612">13.3.
1.1 grant 608: Configuration gotchas</a></span></dt>
609:
610: <dd>
611: <dl>
612: <dt><span class="sect2"><a href=
1.25 rillig 613: "#fixes.libtool">13.3.1. Shared libraries -
1.1 grant 614: libtool</a></span></dt>
615:
616: <dt><span class="sect2"><a href=
1.26 ! wiz 617: "#id2633978">13.3.2. Using libtool on GNU
1.1 grant 618: packages that already support
619: libtool</a></span></dt>
620:
621: <dt><span class="sect2"><a href=
1.26 ! wiz 622: "#id2634059">13.3.3. GNU
1.1 grant 623: Autoconf/Automake</a></span></dt>
624: </dl>
625: </dd>
626:
1.26 ! wiz 627: <dt><span class="sect1"><a href="#id2634104">13.4.
1.1 grant 628: Building considerations</a></span></dt>
629:
630: <dd>
631: <dl>
632: <dt><span class="sect2"><a href=
1.26 ! wiz 633: "#id2634107">13.4.1. CPP
1.1 grant 634: defines</a></span></dt>
635: </dl>
636: </dd>
637:
1.26 ! wiz 638: <dt><span class="sect1"><a href="#id2634137">13.5.
1.1 grant 639: Package specific actions</a></span></dt>
640:
641: <dd>
642: <dl>
643: <dt><span class="sect2"><a href=
1.26 ! wiz 644: "#id2634140">13.5.1. Package configuration
1.1 grant 645: files</a></span></dt>
646:
647: <dt><span class="sect2"><a href=
1.26 ! wiz 648: "#id2634311">13.5.2. User
1.2 hubertf 649: interaction</a></span></dt>
1.1 grant 650:
651: <dt><span class="sect2"><a href=
1.26 ! wiz 652: "#id2634492">13.5.3. Handling
1.1 grant 653: licenses</a></span></dt>
654:
655: <dt><span class="sect2"><a href=
1.26 ! wiz 656: "#id2634644">13.5.4. Creating an account from a
1.1 grant 657: package</a></span></dt>
658:
659: <dt><span class="sect2"><a href=
1.26 ! wiz 660: "#id2634706">13.5.5. Installing score
1.1 grant 661: files</a></span></dt>
662:
663: <dt><span class="sect2"><a href=
1.26 ! wiz 664: "#id2634749">13.5.6. Packages providing login
1.1 grant 665: shells</a></span></dt>
666:
667: <dt><span class="sect2"><a href=
1.26 ! wiz 668: "#id2634807">13.5.7. Packages containing perl
1.1 grant 669: scripts</a></span></dt>
670:
671: <dt><span class="sect2"><a href=
1.26 ! wiz 672: "#id2634825">13.5.8. Packages with hardcoded
1.1 grant 673: paths to other interpreters</a></span></dt>
674:
675: <dt><span class="sect2"><a href=
1.26 ! wiz 676: "#id2634846">13.5.9. Packages installing perl
1.1 grant 677: modules</a></span></dt>
678:
679: <dt><span class="sect2"><a href=
1.25 rillig 680: "#faq.info-files">13.5.10. Packages installing
1.1 grant 681: info files</a></span></dt>
682:
683: <dt><span class="sect2"><a href=
1.26 ! wiz 684: "#id2635134">13.5.11. Packages installing
1.1 grant 685: GConf2 data files</a></span></dt>
686:
687: <dt><span class="sect2"><a href=
1.26 ! wiz 688: "#id2635303">13.5.12. Packages installing
1.1 grant 689: scrollkeeper data files</a></span></dt>
690:
691: <dt><span class="sect2"><a href=
1.26 ! wiz 692: "#id2635354">13.5.13. Packages installing X11
1.1 grant 693: fonts</a></span></dt>
694:
695: <dt><span class="sect2"><a href=
1.26 ! wiz 696: "#id2635469">13.5.14. Packages installing GTK2
1.1 grant 697: modules</a></span></dt>
698:
699: <dt><span class="sect2"><a href=
1.26 ! wiz 700: "#id2635539">13.5.15. Packages installing SGML
1.1 grant 701: or XML data</a></span></dt>
702:
703: <dt><span class="sect2"><a href=
1.26 ! wiz 704: "#id2635659">13.5.16. Packages installing
1.1 grant 705: extensions to the MIME database</a></span></dt>
706:
707: <dt><span class="sect2"><a href=
1.26 ! wiz 708: "#id2635730">13.5.17. Packages using
1.1 grant 709: intltool</a></span></dt>
1.18 xtraeme 710:
711: <dt><span class="sect2"><a href=
1.26 ! wiz 712: "#id2635744">13.5.18. Packages installing
1.18 xtraeme 713: startup scripts</a></span></dt>
1.1 grant 714: </dl>
715: </dd>
716:
1.26 ! wiz 717: <dt><span class="sect1"><a href="#id2635765">13.6.
1.1 grant 718: Feedback to the author</a></span></dt>
719: </dl>
720: </dd>
721:
1.25 rillig 722: <dt><span class="chapter"><a href="#debug">14.
1.1 grant 723: Debugging</a></span></dt>
724:
1.25 rillig 725: <dt><span class="chapter"><a href="#submit">15.
1.1 grant 726: Submitting and Committing</a></span></dt>
727:
728: <dd>
729: <dl>
1.26 ! wiz 730: <dt><span class="sect1"><a href="#id2636227">15.1.
1.1 grant 731: Submitting your packages</a></span></dt>
732:
1.26 ! wiz 733: <dt><span class="sect1"><a href="#id2636284">15.2.
1.1 grant 734: Committing: Importing a package into
735: CVS</a></span></dt>
736:
1.26 ! wiz 737: <dt><span class="sect1"><a href="#id2636484">15.3.
1.2 hubertf 738: Updating a package to a newer
739: version</a></span></dt>
1.1 grant 740:
1.26 ! wiz 741: <dt><span class="sect1"><a href="#id2636503">15.4.
1.2 hubertf 742: Moving a package in pkgsrc</a></span></dt>
1.1 grant 743: </dl>
744: </dd>
745: </dl>
746: </dd>
747:
748: <dt><span class="appendix"><a href="#examples">A. A simple
749: example package: bison</a></span></dt>
750:
751: <dd>
752: <dl>
1.26 ! wiz 753: <dt><span class="sect1"><a href="#id2636729">A.1.
1.1 grant 754: files</a></span></dt>
755:
756: <dd>
757: <dl>
1.26 ! wiz 758: <dt><span class="sect2"><a href="#id2636732">A.1.1.
1.1 grant 759: Makefile</a></span></dt>
760:
1.26 ! wiz 761: <dt><span class="sect2"><a href="#id2636740">A.1.2.
1.1 grant 762: DESCR</a></span></dt>
763:
1.26 ! wiz 764: <dt><span class="sect2"><a href="#id2636755">A.1.3.
1.1 grant 765: PLIST</a></span></dt>
766:
1.26 ! wiz 767: <dt><span class="sect2"><a href="#id2636762">A.1.4.
1.14 xtraeme 768: Checking a package with <span><strong class=
769: "command">pkglint</strong></span></a></span></dt>
1.1 grant 770: </dl>
771: </dd>
772:
1.26 ! wiz 773: <dt><span class="sect1"><a href="#id2636803">A.2. Steps
1.1 grant 774: for building, installing, packaging</a></span></dt>
775: </dl>
776: </dd>
777:
778: <dt><span class="appendix"><a href="#logs">B. Build
779: logs</a></span></dt>
780:
781: <dd>
782: <dl>
783: <dt><span class="sect1"><a href="#logs.building">B.1.
784: Building figlet</a></span></dt>
785:
786: <dt><span class="sect1"><a href="#logs.package">B.2.
787: Packaging figlet</a></span></dt>
788: </dl>
789: </dd>
790:
791: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
792: of the FTP server's package archive</a></span></dt>
1.2 hubertf 793:
794: <dt><span class="appendix"><a href="#editing">D. Editing
795: guidelines for the pkgsrc guide</a></span></dt>
796:
797: <dd>
798: <dl>
1.26 ! wiz 799: <dt><span class="sect1"><a href="#id2637654">D.1.
1.2 hubertf 800: Targets</a></span></dt>
801:
1.26 ! wiz 802: <dt><span class="sect1"><a href="#id2637856">D.2.
1.2 hubertf 803: Procedure</a></span></dt>
804: </dl>
805: </dd>
1.1 grant 806: </dl>
807: </div>
808:
809: <div class="chapter" lang="en" xml:lang="en">
810: <div class="titlepage">
811: <div>
812: <div>
813: <h2 class="title"><a name="introduction" id=
814: "introduction"></a>Chapter 1. Introduction</h2>
815: </div>
816: </div>
817: </div>
818:
819: <div class="toc">
820: <p><b>Table of Contents</b></p>
821:
822: <dl>
1.26 ! wiz 823: <dt><span class="sect1"><a href="#id2623537">1.1.
1.1 grant 824: Introduction</a></span></dt>
825:
826: <dt><span class="sect1"><a href="#overview">1.2.
827: Overview</a></span></dt>
828:
829: <dt><span class="sect1"><a href="#terminology">1.3.
830: Terminology</a></span></dt>
831:
832: <dt><span class="sect1"><a href="#typography">1.4.
833: Typography</a></span></dt>
834: </dl>
835: </div>
836:
837: <div class="sect1" lang="en" xml:lang="en">
838: <div class="titlepage">
839: <div>
840: <div>
841: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 842: "id2623537" id=
! 843: "id2623537"></a>1.1. Introduction</h2>
1.1 grant 844: </div>
845: </div>
846: </div>
847:
848: <p>There is a lot of software freely available for Unix
849: based systems, which usually runs on NetBSD and other
850: Unix-flavoured systems, too, sometimes with some
851: modifications. The NetBSD Packages Collection (pkgsrc)
852: incorporates any such changes necessary to make that
853: software run, and makes the installation (and
854: de-installation) of the software package easy by means of a
855: single command.</p>
856:
857: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 858: the <span><strong class="command">pkg_*</strong></span>
859: tools so that installation and de-installation, printing of
860: an inventory of all installed packages and retrieval of
861: one-line comments or more verbose descriptions are all
862: simple.</p>
1.1 grant 863:
864: <p>pkgsrc currently contains several thousand packages,
865: including:</p>
866:
867: <div class="itemizedlist">
868: <ul type="disc">
869: <li>
870: <p><a xmlns=
871: "http://www.w3.org/TR/xhtml1/transitional" href=
872: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.20 ben 873: class="pkgname">www/apache</a> - The Apache web
874: server</p>
1.1 grant 875: </li>
876:
877: <li>
878: <p><a xmlns=
879: "http://www.w3.org/TR/xhtml1/transitional" href=
880: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 881: class="pkgname">www/mozilla</a> - The Mozilla web
882: browser</p>
1.1 grant 883: </li>
884:
885: <li>
886: <p><a xmlns=
887: "http://www.w3.org/TR/xhtml1/transitional" href=
888: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.20 ben 889: class="pkgname">meta-pkgs/gnome</a> - The GNOME
890: Desktop Environment</p>
1.1 grant 891: </li>
892:
893: <li>
894: <p><a xmlns=
895: "http://www.w3.org/TR/xhtml1/transitional" href=
896: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.20 ben 897: class="pkgname">meta-pkgs/kde3</a> - The K Desktop
898: Environment</p>
1.1 grant 899: </li>
900: </ul>
901: </div>
902:
903: <p>...just to name a few.</p>
904:
905: <p>pkgsrc has built-in support for handling varying
906: dependencies, such as pthreads and X11, and extended
907: features such as IPv6 support on a range of platforms.</p>
908:
909: <p>pkgsrc was derived from FreeBSD's ports system, and
910: initially developed for NetBSD only. Since then, pkgsrc has
911: grown a lot, and now supports the following platforms:</p>
912:
913: <div class="itemizedlist">
914: <ul type="disc">
915: <li>
916: <p><a href="http://developer.apple.com/darwin/"
917: target="_top">Darwin</a> (<a href=
918: "http://www.apple.com/macosx/" target="_top">Mac OS
919: X</a>)</p>
920: </li>
921:
922: <li>
1.3 hubertf 923: <p><a href="http://www.DragonFlyBSD.org/" target=
924: "_top">DragonFlyBSD</a></p>
925: </li>
926:
927: <li>
1.1 grant 928: <p><a href="http://www.FreeBSD.org/" target=
929: "_top">FreeBSD</a></p>
930: </li>
931:
932: <li>
1.3 hubertf 933: <p>Microsoft Windows, via <a href=
934: "http://www.microsoft.com/windows/sfu/" target=
935: "_top">Interix</a></p>
1.1 grant 936: </li>
937:
938: <li>
939: <p><a href="http://www.sgi.com/software/irix6.5/"
940: target="_top">IRIX</a></p>
941: </li>
942:
943: <li>
944: <p><a href="http://www.linux.org/" target=
945: "_top">Linux</a></p>
946: </li>
947:
948: <li>
949: <p><a href="http://www.NetBSD.org/" target=
950: "_top">NetBSD</a> (of course)</p>
951: </li>
952:
953: <li>
1.17 sketch 954: <p><a href="http://h30097.www3.hp.com/" target=
955: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
956: </li>
957:
958: <li>
1.1 grant 959: <p><a href="http://www.openbsd.org/" target=
960: "_top">OpenBSD</a></p>
961: </li>
962:
963: <li>
964: <p><a href="http://www.sun.com/solaris/" target=
965: "_top">Solaris</a></p>
966: </li>
967: </ul>
968: </div>
969: </div>
970:
971: <div class="sect1" lang="en" xml:lang="en">
972: <div class="titlepage">
973: <div>
974: <div>
975: <h2 class="title" style="clear: both"><a name=
976: "overview" id="overview"></a>1.2. Overview</h2>
977: </div>
978: </div>
979: </div>
980:
981: <p>This document is divided into two parts. The first,
982: <a href="#users-guide" title=
1.2 hubertf 983: "Part I. The pkgsrc user's guide">The pkgsrc
984: user's guide</a>, describes how one can use one of the
985: packages in the Package Collection, either by installing a
986: precompiled binary package, or by building one's own copy
987: using the NetBSD package system. The second part, <a href=
1.1 grant 988: "#developers-guide" title=
1.2 hubertf 989: "Part II. The pkgsrc developer's guide">The
990: pkgsrc developer's guide</a>, explains how to prepare a
991: package so it can be easily built by other NetBSD users
992: without knowing about the package's building details.</p>
1.1 grant 993:
994: <p>This document is available in various formats:</p>
995:
996: <div class="itemizedlist">
997: <ul type="disc">
998: <li>
999: <p><a href="index.html" target="_top">HTML</a></p>
1000: </li>
1001:
1002: <li>
1003: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1004: </li>
1005:
1006: <li>
1007: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1008: </li>
1009:
1010: <li>
1011: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1012: </li>
1013: </ul>
1014: </div>
1015: </div>
1016:
1017: <div class="sect1" lang="en" xml:lang="en">
1018: <div class="titlepage">
1019: <div>
1020: <div>
1021: <h2 class="title" style="clear: both"><a name=
1022: "terminology" id=
1023: "terminology"></a>1.3. Terminology</h2>
1024: </div>
1025: </div>
1026: </div>
1027:
1028: <p>There has been a lot of talk about “<span class=
1029: "quote">ports</span>”, “<span class=
1030: "quote">packages</span>”, etc. so far. Here is a
1031: description of all the terminology used within this
1032: document.</p>
1033:
1034: <div class="variablelist">
1035: <dl>
1036: <dt><span class="term">Package</span></dt>
1037:
1038: <dd>
1039: <p>A set of files and building instructions that
1040: describe what's necessary to build a certain piece of
1041: software using pkgsrc. Packages are traditionally
1.14 xtraeme 1042: stored under <code class=
1043: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1044: </dd>
1045:
1046: <dt><span class="term">The NetBSD package
1047: system</span></dt>
1048:
1049: <dd>
1050: <p>This is the former name of “<span class=
1051: "quote">pkgsrc</span>”. It is part of the
1052: NetBSD operating system and can be bootstrap to run
1053: on non-NetBSD operating systems as well. It handles
1054: building (compiling), installing, and removing of
1055: packages.</p>
1056: </dd>
1057:
1058: <dt><span class="term">Distfile</span></dt>
1059:
1060: <dd>
1061: <p>This term describes the file or files that are
1062: provided by the author of the piece of software to
1063: distribute his work. All the changes necessary to
1064: build on NetBSD are reflected in the corresponding
1065: package. Usually the distfile is in the form of a
1066: compressed tar-archive, but other types are possible,
1.14 xtraeme 1067: too. Distfiles are usually stored below <code class=
1068: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1069: </dd>
1070:
1071: <dt><span class="term">Port</span></dt>
1072:
1073: <dd>
1074: <p>This is the term used by FreeBSD and OpenBSD
1075: people for what we call a package. In NetBSD
1076: terminology, “<span class=
1077: "quote">port</span>” refers to a different
1078: architecture.</p>
1079: </dd>
1080:
1081: <dt><span class="term">Precompiled/binary
1082: package</span></dt>
1083:
1084: <dd>
1085: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1086: distfile and stuffed together in a single
1087: <code class="filename">.tgz</code> file so it can be
1088: installed on machines of the same machine
1089: architecture without the need to recompile. Packages
1090: are usually generated in <code class=
1091: "filename">/usr/pkgsrc/packages</code>; there is also
1092: an archive on <a href=
1.1 grant 1093: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1094: "_top">ftp.NetBSD.org</a>.</p>
1095:
1096: <p>Sometimes, this is referred to by the term
1097: “<span class="quote">package</span>” too,
1098: especially in the context of precompiled
1099: packages.</p>
1100: </dd>
1101:
1102: <dt><span class="term">Program</span></dt>
1103:
1104: <dd>
1105: <p>The piece of software to be installed which will
1106: be constructed from all the files in the Distfile by
1107: the actions defined in the corresponding package.</p>
1108: </dd>
1109: </dl>
1110: </div>
1111: </div>
1112:
1113: <div class="sect1" lang="en" xml:lang="en">
1114: <div class="titlepage">
1115: <div>
1116: <div>
1117: <h2 class="title" style="clear: both"><a name=
1118: "typography" id=
1119: "typography"></a>1.4. Typography</h2>
1120: </div>
1121: </div>
1122: </div>
1123:
1124: <p>When giving examples for commands, shell prompts are
1125: used to show if the command should/can be issued as root,
1126: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1127: privileges are sufficient. We use a <code class=
1128: "prompt">#</code> for root's shell prompt, and a
1129: <code class="prompt">$</code> for users' shell prompt,
1130: assuming they use the C-shell or tcsh.</p>
1.1 grant 1131: </div>
1132: </div>
1133:
1134: <div class="part" lang="en" xml:lang="en">
1135: <div class="titlepage">
1136: <div>
1137: <div>
1138: <h1 class="title"><a name="users-guide" id=
1.2 hubertf 1139: "users-guide"></a>The pkgsrc user's guide</h1>
1.1 grant 1140: </div>
1141: </div>
1142: </div>
1143:
1144: <div class="toc">
1145: <p><b>Table of Contents</b></p>
1146:
1147: <dl>
1148: <dt><span class="chapter"><a href="#getting">2. Where to
1149: get pkgsrc</a></span></dt>
1150:
1151: <dd>
1152: <dl>
1.26 ! wiz 1153: <dt><span class="sect1"><a href="#id2569236">2.1. As
1.1 grant 1154: tar file</a></span></dt>
1155:
1.26 ! wiz 1156: <dt><span class="sect1"><a href="#id2569252">2.2. Via
1.1 grant 1157: SUP</a></span></dt>
1158:
1.26 ! wiz 1159: <dt><span class="sect1"><a href="#id2569420">2.3. Via
1.1 grant 1160: CVS</a></span></dt>
1161: </dl>
1162: </dd>
1163:
1164: <dt><span class="chapter"><a href="#platforms">3. Using
1165: pkgsrc on systems other than NetBSD</a></span></dt>
1166:
1167: <dd>
1168: <dl>
1.26 ! wiz 1169: <dt><span class="sect1"><a href="#id2569530">3.1.
1.1 grant 1170: Bootstrapping pkgsrc</a></span></dt>
1171:
1.26 ! wiz 1172: <dt><span class="sect1"><a href="#id2569712">3.2.
1.1 grant 1173: Platform specific notes</a></span></dt>
1174:
1175: <dd>
1176: <dl>
1177: <dt><span class="sect2"><a href=
1.26 ! wiz 1178: "#id2569718">3.2.1. Darwin (Mac OS
1.1 grant 1179: X)</a></span></dt>
1180:
1181: <dt><span class="sect2"><a href=
1.26 ! wiz 1182: "#id2569880">3.2.2. FreeBSD</a></span></dt>
1.22 tv 1183:
1184: <dt><span class="sect2"><a href=
1.26 ! wiz 1185: "#id2570324">3.2.3. Interix</a></span></dt>
1.1 grant 1186:
1187: <dt><span class="sect2"><a href=
1.26 ! wiz 1188: "#id2570557">3.2.4. IRIX</a></span></dt>
1.1 grant 1189:
1190: <dt><span class="sect2"><a href=
1.26 ! wiz 1191: "#id2570654">3.2.5. Linux</a></span></dt>
1.1 grant 1192:
1193: <dt><span class="sect2"><a href=
1.26 ! wiz 1194: "#id2570723">3.2.6. OpenBSD</a></span></dt>
1.1 grant 1195:
1196: <dt><span class="sect2"><a href=
1.26 ! wiz 1197: "#id2570835">3.2.7. Solaris</a></span></dt>
1.1 grant 1198: </dl>
1199: </dd>
1200: </dl>
1201: </dd>
1202:
1203: <dt><span class="chapter"><a href="#using">4. Using
1204: pkgsrc</a></span></dt>
1205:
1206: <dd>
1207: <dl>
1208: <dt><span class="sect1"><a href=
1209: "#getting-started">4.1. Working with binary
1210: packages</a></span></dt>
1211:
1212: <dd>
1213: <dl>
1214: <dt><span class="sect2"><a href=
1.26 ! wiz 1215: "#id2571040">4.1.1. Where to get binary
1.1 grant 1216: packages</a></span></dt>
1217:
1218: <dt><span class="sect2"><a href=
1.26 ! wiz 1219: "#id2571080">4.1.2. How to use binary
1.1 grant 1220: packages</a></span></dt>
1221:
1222: <dt><span class="sect2"><a href=
1.26 ! wiz 1223: "#id2571256">4.1.3. A word of
1.1 grant 1224: warning</a></span></dt>
1225: </dl>
1226: </dd>
1227:
1.26 ! wiz 1228: <dt><span class="sect1"><a href="#id2571336">4.2.
1.1 grant 1229: Building packages from source</a></span></dt>
1230:
1231: <dd>
1232: <dl>
1233: <dt><span class="sect2"><a href=
1.26 ! wiz 1234: "#id2571346">4.2.1. Requirements</a></span></dt>
1.1 grant 1235:
1236: <dt><span class="sect2"><a href=
1.26 ! wiz 1237: "#id2571366">4.2.2. Fetching
1.1 grant 1238: distfiles</a></span></dt>
1239:
1240: <dt><span class="sect2"><a href=
1.26 ! wiz 1241: "#id2571828">4.2.3. How to build and
1.1 grant 1242: install</a></span></dt>
1243:
1244: <dt><span class="sect2"><a href=
1.26 ! wiz 1245: "#id2623831">4.2.4. Selecting the
1.1 grant 1246: compiler</a></span></dt>
1247: </dl>
1248: </dd>
1249: </dl>
1250: </dd>
1251:
1252: <dt><span class="chapter"><a href="#binary">5. Creating
1253: binary packages</a></span></dt>
1254:
1255: <dd>
1256: <dl>
1.26 ! wiz 1257: <dt><span class="sect1"><a href="#id2623917">5.1.
1.1 grant 1258: Building a single binary package</a></span></dt>
1259:
1.26 ! wiz 1260: <dt><span class="sect1"><a href="#id2623995">5.2.
1.1 grant 1261: Settings for creation of binary
1262: packages</a></span></dt>
1263:
1264: <dt><span class="sect1"><a href="#bulkbuild">5.3.
1265: Doing a bulk build of all packages</a></span></dt>
1266:
1267: <dd>
1268: <dl>
1269: <dt><span class="sect2"><a href=
1270: "#binary.configuration">5.3.1.
1271: Configuration</a></span></dt>
1272:
1273: <dt><span class="sect2"><a href=
1.26 ! wiz 1274: "#id2624142">5.3.2. Other environmental
1.1 grant 1275: considerations</a></span></dt>
1276:
1277: <dt><span class="sect2"><a href=
1.26 ! wiz 1278: "#id2624183">5.3.3. Operation</a></span></dt>
1.1 grant 1279:
1280: <dt><span class="sect2"><a href=
1.26 ! wiz 1281: "#id2624252">5.3.4. What it does</a></span></dt>
1.1 grant 1282:
1283: <dt><span class="sect2"><a href=
1.26 ! wiz 1284: "#id2624309">5.3.5. Disk space
1.1 grant 1285: requirements</a></span></dt>
1286:
1287: <dt><span class="sect2"><a href=
1.26 ! wiz 1288: "#id2624336">5.3.6. Setting up a sandbox for
1.1 grant 1289: chroot'ed builds</a></span></dt>
1290:
1291: <dt><span class="sect2"><a href=
1.26 ! wiz 1292: "#id2624865">5.3.7. Building a partial set of
1.1 grant 1293: packages</a></span></dt>
1.13 hubertf 1294:
1295: <dt><span class="sect2"><a href=
1296: "#bulk-upload">5.3.8. Uploading results of a bulk
1297: build</a></span></dt>
1.1 grant 1298: </dl>
1299: </dd>
1300:
1.26 ! wiz 1301: <dt><span class="sect1"><a href="#id2625321">5.4.
1.1 grant 1302: Creating a multiple CD-ROM packages
1303: collection</a></span></dt>
1304:
1305: <dd>
1306: <dl>
1307: <dt><span class="sect2"><a href=
1.26 ! wiz 1308: "#id2625336">5.4.1. Example of
1.1 grant 1309: cdpack</a></span></dt>
1310: </dl>
1311: </dd>
1312: </dl>
1313: </dd>
1314:
1315: <dt><span class="chapter"><a href="#faq">6. Frequently
1316: Asked Questions</a></span></dt>
1317:
1318: <dd>
1319: <dl>
1.26 ! wiz 1320: <dt><span class="sect1"><a href="#id2625528">6.1. Are
1.18 xtraeme 1321: there any mailing lists for pkg-related
1.1 grant 1322: discussion?</a></span></dt>
1323:
1.26 ! wiz 1324: <dt><span class="sect1"><a href="#id2625662">6.2.
1.1 grant 1325: Where's the pkgviews documentation?</a></span></dt>
1326:
1.5 hubertf 1327: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 1328: Utilities for package management
1329: (pkgtools)</a></span></dt>
1330:
1.26 ! wiz 1331: <dt><span class="sect1"><a href="#id2625984">6.4. How
1.1 grant 1332: to use pkgsrc as non-root</a></span></dt>
1333:
1.26 ! wiz 1334: <dt><span class="sect1"><a href="#id2625995">6.5. How
1.15 xtraeme 1335: to resume transfers when fetching
1336: distfiles?</a></span></dt>
1.14 xtraeme 1337:
1.26 ! wiz 1338: <dt><span class="sect1"><a href="#id2626045">6.6. How
1.1 grant 1339: can I install/use XFree86 from
1340: pkgsrc?</a></span></dt>
1341:
1.26 ! wiz 1342: <dt><span class="sect1"><a href="#id2626073">6.7. How
1.1 grant 1343: can I install/use X.org from pkgsrc?</a></span></dt>
1344:
1.26 ! wiz 1345: <dt><span class="sect1"><a href="#id2626101">6.8. How
1.1 grant 1346: to fetch files from behind a firewall</a></span></dt>
1347:
1.26 ! wiz 1348: <dt><span class="sect1"><a href="#id2626115">6.9. How
1.14 xtraeme 1349: do I tell <span><strong class="command">make
1350: fetch</strong></span> to do passive
1.1 grant 1351: FTP?</a></span></dt>
1352:
1.26 ! wiz 1353: <dt><span class="sect1"><a href="#id2626166">6.10.
1.14 xtraeme 1354: How to fetch all distfiles at once</a></span></dt>
1.1 grant 1355:
1.26 ! wiz 1356: <dt><span class="sect1"><a href="#id2626313">6.11.
1.14 xtraeme 1357: What does “<span class="quote">Don't know how
1358: to make /usr/share/tmac/tmac.andoc</span>”
1359: mean?</a></span></dt>
1.13 hubertf 1360:
1.26 ! wiz 1361: <dt><span class="sect1"><a href="#id2626352">6.12.
1.14 xtraeme 1362: What does “<span class="quote">Could not find
1363: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1364:
1.26 ! wiz 1365: <dt><span class="sect1"><a href="#id2626409">6.13.
1.1 grant 1366: Using 'sudo' with pkgsrc</a></span></dt>
1367:
1.14 xtraeme 1368: <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1 grant 1369: Configuration files handling and
1370: placement</a></span></dt>
1371:
1372: <dt><span class="sect1"><a href=
1.14 xtraeme 1373: "#audit-packages">6.15. Automated security
1.1 grant 1374: checks</a></span></dt>
1375: </dl>
1376: </dd>
1377: </dl>
1378: </div>
1379:
1380: <div class="chapter" lang="en" xml:lang="en">
1381: <div class="titlepage">
1382: <div>
1383: <div>
1384: <h2 class="title"><a name="getting" id=
1385: "getting"></a>Chapter 2. Where to get
1386: pkgsrc</h2>
1387: </div>
1388: </div>
1389: </div>
1390:
1391: <div class="toc">
1392: <p><b>Table of Contents</b></p>
1393:
1394: <dl>
1.26 ! wiz 1395: <dt><span class="sect1"><a href="#id2569236">2.1. As
1.1 grant 1396: tar file</a></span></dt>
1397:
1.26 ! wiz 1398: <dt><span class="sect1"><a href="#id2569252">2.2. Via
1.1 grant 1399: SUP</a></span></dt>
1400:
1.26 ! wiz 1401: <dt><span class="sect1"><a href="#id2569420">2.3. Via
1.1 grant 1402: CVS</a></span></dt>
1403: </dl>
1404: </div>
1405:
1406: <p>There are three ways to get pkgsrc. Either as a tar
1407: file, via SUP, or via CVS. All three ways are described
1408: here.</p>
1409:
1410: <div class="sect1" lang="en" xml:lang="en">
1411: <div class="titlepage">
1412: <div>
1413: <div>
1414: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 1415: "id2569236" id="id2569236"></a>2.1. As tar
1.1 grant 1416: file</h2>
1417: </div>
1418: </div>
1419: </div>
1420:
1421: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1422: file from <a href=
1.11 ben 1423: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1424: target="_top">ftp.NetBSD.org</a> and unpack it into
1425: <code class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1426: </div>
1427:
1428: <div class="sect1" lang="en" xml:lang="en">
1429: <div class="titlepage">
1430: <div>
1431: <div>
1432: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 1433: "id2569252" id="id2569252"></a>2.2. Via
1.1 grant 1434: SUP</h2>
1435: </div>
1436: </div>
1437: </div>
1438:
1439: <p>As an alternative to the tar file, you can get pkgsrc
1440: via the Software Update Protocol, SUP. To do so, make
1441: sure your supfile has a line</p>
1442: <pre class="programlisting">
1443: release=pkgsrc
1444: </pre>
1445:
1.14 xtraeme 1446: <p>in it, see the examples in <code class=
1447: "filename">/usr/share/examples/supfiles</code>, and that
1448: the <code class="filename">/usr/pkgsrc</code> directory
1449: exists. Then, simply run <span><strong class=
1450: "command">sup -v <em class=
1451: "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1452: </div>
1453:
1454: <div class="sect1" lang="en" xml:lang="en">
1455: <div class="titlepage">
1456: <div>
1457: <div>
1458: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 1459: "id2569420" id="id2569420"></a>2.3. Via
1.1 grant 1460: CVS</h2>
1461: </div>
1462: </div>
1463: </div>
1464:
1465: <p>To get pkgsrc via CVS, make sure you have
1466: “<span class="quote">cvs</span>” installed.
1467: If not present on your system, it can be found as
1468: precompiled binary on ftp.NetBSD.org. To do an initial
1469: (full) checkout of pkgsrc, do the following steps:</p>
1470: <pre class="screen">
1.14 xtraeme 1471: <code class="prompt">%</code> <strong class=
1472: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1473: <code class="prompt">%</code> <strong class=
1474: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1475: <code class="prompt">%</code> <strong class=
1476: "userinput"><code>cd /usr</code></strong>
1477: <code class="prompt">%</code> <strong class=
1478: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1479: </pre>
1480:
1481: <p>This will create the <code class=
1482: "filename">pkgsrc</code> directory in your <code class=
1483: "filename">/usr</code>, and all the package source will
1484: be stored under <code class=
1485: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1486: initial checkout, make sure you have <code class=
1487: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1488: <pre class="screen">
1.14 xtraeme 1489: <code class="prompt">%</code> <strong class=
1490: "userinput"><code>cd /usr/pkgsrc</code></strong>
1491: <code class="prompt">%</code> <strong class=
1492: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1493: </pre>
1494:
1495: <p>Please also note that it is possible to have multiple
1496: copies of the pkgsrc hierarchy in use at any one time -
1497: all work is done relatively within the pkgsrc tree.</p>
1498: </div>
1499: </div>
1500:
1501: <div class="chapter" lang="en" xml:lang="en">
1502: <div class="titlepage">
1503: <div>
1504: <div>
1505: <h2 class="title"><a name="platforms" id=
1506: "platforms"></a>Chapter 3. Using pkgsrc on
1507: systems other than NetBSD</h2>
1508: </div>
1509: </div>
1510: </div>
1511:
1512: <div class="toc">
1513: <p><b>Table of Contents</b></p>
1514:
1515: <dl>
1.26 ! wiz 1516: <dt><span class="sect1"><a href="#id2569530">3.1.
1.1 grant 1517: Bootstrapping pkgsrc</a></span></dt>
1518:
1.26 ! wiz 1519: <dt><span class="sect1"><a href="#id2569712">3.2.
1.1 grant 1520: Platform specific notes</a></span></dt>
1521:
1522: <dd>
1523: <dl>
1.26 ! wiz 1524: <dt><span class="sect2"><a href="#id2569718">3.2.1.
1.1 grant 1525: Darwin (Mac OS X)</a></span></dt>
1526:
1.26 ! wiz 1527: <dt><span class="sect2"><a href="#id2569880">3.2.2.
1.1 grant 1528: FreeBSD</a></span></dt>
1529:
1.26 ! wiz 1530: <dt><span class="sect2"><a href="#id2570324">3.2.3.
1.1 grant 1531: Interix</a></span></dt>
1532:
1.26 ! wiz 1533: <dt><span class="sect2"><a href="#id2570557">3.2.4.
1.1 grant 1534: IRIX</a></span></dt>
1535:
1.26 ! wiz 1536: <dt><span class="sect2"><a href="#id2570654">3.2.5.
1.22 tv 1537: Linux</a></span></dt>
1538:
1.26 ! wiz 1539: <dt><span class="sect2"><a href="#id2570723">3.2.6.
1.1 grant 1540: OpenBSD</a></span></dt>
1541:
1.26 ! wiz 1542: <dt><span class="sect2"><a href="#id2570835">3.2.7.
1.1 grant 1543: Solaris</a></span></dt>
1544: </dl>
1545: </dd>
1546: </dl>
1547: </div>
1548:
1549: <div class="sect1" lang="en" xml:lang="en">
1550: <div class="titlepage">
1551: <div>
1552: <div>
1553: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 1554: "id2569530" id=
! 1555: "id2569530"></a>3.1. Bootstrapping pkgsrc</h2>
1.1 grant 1556: </div>
1557: </div>
1558: </div>
1559:
1560: <p>For Operating Systems other than NetBSD, we provide a
1561: bootstrap kit to build the required tools to use pkgsrc
1562: on your platform. Besides support for native NetBSD,
1563: pkgsrc and the bootstrap kit have support for the
1564: following operating systems:</p>
1565:
1566: <div class="itemizedlist">
1567: <ul type="disc">
1568: <li>
1569: <p>Darwin (Mac OS X)</p>
1570: </li>
1571:
1572: <li>
1.16 grant 1573: <p>DragonFlyBSD</p>
1574: </li>
1575:
1576: <li>
1.1 grant 1577: <p>FreeBSD</p>
1578: </li>
1579:
1580: <li>
1581: <p>Interix (Windows 2000, XP, 2003)</p>
1582: </li>
1583:
1584: <li>
1585: <p>IRIX</p>
1586: </li>
1587:
1588: <li>
1589: <p>Linux</p>
1590: </li>
1591:
1592: <li>
1593: <p>OpenBSD</p>
1594: </li>
1595:
1596: <li>
1597: <p>Solaris</p>
1598: </li>
1.16 grant 1599:
1600: <li>
1601: <p>Tru64 (Digital UNIX/OSF1)</p>
1602: </li>
1.1 grant 1603: </ul>
1604: </div>
1605:
1606: <p>Support for other platforms is under development.</p>
1607:
1608: <p>Installing the bootstrap kit should be as simple
1609: as:</p>
1610: <pre class="screen">
1.14 xtraeme 1611: <code class="prompt">#</code> <strong class=
1612: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1613: <code class="prompt">#</code> <strong class=
1614: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1615: <code class="prompt">#</code> <strong class=
1616: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1617: </pre>
1618:
1619: <p>See <a href="#getting" title=
1620: "Chapter 2. Where to get pkgsrc">Chapter 2,
1621: <i>Where to get pkgsrc</i></a> for other ways to get
1.14 xtraeme 1622: pkgsrc before bootstrapping. The given
1623: <span><strong class="command">bootstrap</strong></span>
1624: command will use the defaults of <code class=
1625: "filename">/usr/pkg</code> for the <span class=
1626: "emphasis"><em>prefix</em></span> where programs will be
1627: installed in, and <code class=
1628: "filename">/var/db/pkg</code> for the package database
1.1 grant 1629: directory where pkgsrc will do it's internal bookkeeping.
1630: However, these can also be set using command-line
1631: parameters.</p>
1632:
1633: <p>Binary packages for the pkgsrc tools and an initial
1634: set of packages is available for supported platforms. An
1635: up-to-date list of these can be found on <a href=
1636: "http://www.pkgsrc.org/" target=
1637: "_top">www.pkgsrc.org</a>.</p>
1638: </div>
1639:
1640: <div class="sect1" lang="en" xml:lang="en">
1641: <div class="titlepage">
1642: <div>
1643: <div>
1644: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 1645: "id2569712" id="id2569712"></a>3.2. Platform
1.1 grant 1646: specific notes</h2>
1647: </div>
1648: </div>
1649: </div>
1650:
1651: <p>Here are some platform-specific notes you should be
1652: aware of.</p>
1653:
1654: <div class="sect2" lang="en" xml:lang="en">
1655: <div class="titlepage">
1656: <div>
1657: <div>
1.26 ! wiz 1658: <h3 class="title"><a name="id2569718" id=
! 1659: "id2569718"></a>3.2.1. Darwin (Mac OS
1.1 grant 1660: X)</h3>
1661: </div>
1662: </div>
1663: </div>
1664:
1665: <p>Darwin 5.x and 6.x are supported. There are two
1666: methods of using pkgsrc on Mac OS X, by using a
1667: <a href="#platform.osx-image" title=
1668: "3.2.1.1. Using a disk image">disk image</a>, or a
1669: <a href="#platform.osx-ufs" title=
1670: "3.2.1.2. Using a UFS partition">UFS
1671: partition</a>.</p>
1672:
1673: <p>Before you start, you will need to download and
1674: install the Mac OS X Developer Tools from Apple's
1675: Developer Connection. See <a href=
1676: "http://developer.apple.com/macosx/" target=
1677: "_top">http://developer.apple.com/macosx/</a> for
1678: details. Also, make sure you install X11 for Mac OS X
1679: and the X11 SDK from <a href=
1680: "http://www.apple.com/macosx/x11/download/" target=
1681: "_top">http://www.apple.com/macosx/x11/download/</a> if
1682: you intend to build packages that use the X11 Window
1683: System.</p>
1684:
1685: <p>If you already have a UFS partition, or have a spare
1686: partition that you can format as UFS, it is recommended
1687: to use that instead of the disk image. It'll be
1688: somewhat faster and will mount automatically at boot
1689: time, where you must manually mount a disk image.</p>
1690:
1691: <div class="note" style=
1692: "margin-left: 0.5in; margin-right: 0.5in;">
1693: <h3 class="title">Note</h3>
1694:
1695: <p>You cannot use a HFS+ file system for pkgsrc,
1696: because pkgsrc currently requires the filesystem to
1697: be case-sensitive, and HFS+ is not.</p>
1698: </div>
1699:
1700: <div class="sect3" lang="en" xml:lang="en">
1701: <div class="titlepage">
1702: <div>
1703: <div>
1704: <h4 class="title"><a name="platform.osx-image"
1705: id="platform.osx-image"></a>3.2.1.1. Using
1706: a disk image</h4>
1707: </div>
1708: </div>
1709: </div>
1710:
1711: <p>Create the disk image:</p>
1712: <pre class="screen">
1.14 xtraeme 1713: <code class="prompt">#</code> <strong class=
1714: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1715: <code class="prompt">#</code> <strong class=
1716: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
1717: <code class="prompt">#</code> <strong class=
1718: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
1719: <code class="prompt">#</code> <strong class=
1720: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 1721: </pre>
1722:
1723: <p>That's it!</p>
1724: </div>
1725:
1726: <div class="sect3" lang="en" xml:lang="en">
1727: <div class="titlepage">
1728: <div>
1729: <div>
1730: <h4 class="title"><a name="platform.osx-ufs"
1731: id="platform.osx-ufs"></a>3.2.1.2. Using a
1732: UFS partition</h4>
1733: </div>
1734: </div>
1735: </div>
1736:
1.14 xtraeme 1737: <p>By default, <code class="filename">/usr</code>
1738: will be on your root file system, normally HFS+. It
1739: is possible to use the default <span class=
1740: "emphasis"><em>prefix</em></span> of <code class=
1741: "filename">/usr/pkg</code> by symlinking <code class=
1742: "filename">/usr/pkg</code> to a directory on a UFS
1743: file system. Obviously, another symlink is required
1744: if you want to place the package database directory
1745: outside the <span class=
1746: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 1747: <pre class="screen">
1.14 xtraeme 1748: <code class="prompt">#</code> <strong class=
1.22 tv 1749: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1 grant 1750: </pre>
1751:
1752: <p>If you created your partitions at the time of
1753: installing Mac OS X and formatted the target
1754: partition as UFS, it should automatically mount on
1.14 xtraeme 1755: <code class="filename">/Volumes/<volume
1756: name></code> when the machine boots. If you are
1.1 grant 1757: (re)formatting a partition as UFS, you need to ensure
1758: that the partition map correctly reflects
1759: “<span class="quote">Apple_UFS</span>”
1760: and not “<span class=
1761: "quote">Apple_HFS</span>”.</p>
1762:
1763: <p>The problem is that none of the disk tools will
1764: let you touch a disk that is booted from. You can
1765: unmount the partition, but even if you newfs it, the
1766: partition type will be incorrect and the automounter
1767: won't mount it. It can be mounted manually, but it
1768: won't appear in Finder.</p>
1769:
1770: <p>You'll need to boot off of the OS X Installation
1771: (User) CD. When the Installation program starts, go
1772: up to the menu and select Disk Utility. Now, you will
1773: be able to select the partition you want to be UFS,
1774: and Format it Apple UFS. Quit the Disk Utility, quit
1775: the installer which will reboot your machine. The new
1776: UFS file system will appear in Finder.</p>
1777:
1778: <p>Be aware that the permissions on the new file
1779: system will be writable by root only.</p>
1780:
1781: <p>This note is as of 10.2 (Jaguar) and applies to
1782: earlier versions. Hopefully Apple will fix Disk
1783: Utility in 10.3 (Panther).</p>
1784: </div>
1785: </div>
1786:
1787: <div class="sect2" lang="en" xml:lang="en">
1788: <div class="titlepage">
1789: <div>
1790: <div>
1.26 ! wiz 1791: <h3 class="title"><a name="id2569880" id=
! 1792: "id2569880"></a>3.2.2. FreeBSD</h3>
1.1 grant 1793: </div>
1794: </div>
1795: </div>
1796:
1797: <p>FreeBSD 4.7 and 5.0 have been tested and are
1798: supported, other versions may work.</p>
1799:
1800: <p>Care should be taken so that the tools that this kit
1801: installs do not conflict with the FreeBSD userland
1802: tools. There are several steps:</p>
1803:
1804: <div class="orderedlist">
1805: <ol type="1">
1806: <li>
1807: <p>FreeBSD stores its ports pkg database in
1.14 xtraeme 1808: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 1809: therefore recommended that you choose a different
1.14 xtraeme 1810: location (e.g. <code class=
1811: "filename">/usr/pkgdb</code>) by using the
1.1 grant 1812: --pkgdbdir option to the bootstrap script.</p>
1813: </li>
1814:
1815: <li>
1816: <p>If you do not intend to use the FreeBSD ports
1817: tools, it's probably a good idea to move them out
1818: of the way to avoid confusion, e.g.</p>
1819: <pre class="screen">
1.14 xtraeme 1820: <code class="prompt">#</code> <strong class=
1821: "userinput"><code>cd /usr/sbin</code></strong>
1822: <code class="prompt">#</code> <strong class=
1823: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
1824: <code class="prompt">#</code> <strong class=
1825: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
1826: <code class="prompt">#</code> <strong class=
1827: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
1828: <code class="prompt">#</code> <strong class=
1829: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 1830: </pre>
1831: </li>
1832:
1833: <li>
1.14 xtraeme 1834: <p>An example <code class=
1835: "filename">/etc/mk.conf</code> file will be
1836: placed in <code class=
1837: "filename">/etc/mk.conf.example</code> file when
1838: you use the bootstrap script.</p>
1.1 grant 1839: </li>
1840: </ol>
1841: </div>
1842: </div>
1843:
1844: <div class="sect2" lang="en" xml:lang="en">
1845: <div class="titlepage">
1846: <div>
1847: <div>
1.26 ! wiz 1848: <h3 class="title"><a name="id2570324" id=
! 1849: "id2570324"></a>3.2.3. Interix</h3>
1.1 grant 1850: </div>
1851: </div>
1852: </div>
1853:
1854: <p>Interix is a POSIX compatible subsystem for the
1855: Windows NT kernel, providing a Unix-like environment
1856: with a tighter kernel integration than available with
1857: Cygwin. It is part of the Windows Services for Unix
1858: package, available for free for any licensed copy of
1.22 tv 1859: Windows 2000, XP (not including XP Home), or 2003. SFU
1860: can be downloaded from <a href=
1861: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 1862: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
1863:
1864: <p>Services for Unix 3.5, current as of this writing,
1865: has been tested. 3.0 or 3.1 may work, but are not
1866: officially supported. (The main difference in 3.0/3.1
1867: is lack of pthreads.)</p>
1868:
1869: <div class="sect3" lang="en" xml:lang="en">
1870: <div class="titlepage">
1871: <div>
1872: <div>
1873: <h4 class="title"><a name=
1874: "platform.interix-sfu-install" id=
1875: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 1876: installing Interix/SFU</h4>
1.1 grant 1877: </div>
1878: </div>
1879: </div>
1880:
1881: <p>At an absolute minimum, the following packages
1882: must be installed from the Windows Services for Unix
1883: 3.5 distribution in order to use pkgsrc:</p>
1884:
1885: <div class="itemizedlist">
1886: <ul type="disc">
1887: <li>
1888: <p>Utilities -> Base Utilities</p>
1889: </li>
1890:
1891: <li>
1892: <p>Interix GNU Components -> (all)</p>
1893: </li>
1894:
1895: <li>
1896: <p>Remote Connectivity</p>
1897: </li>
1898:
1899: <li>
1900: <p>Interix SDK</p>
1901: </li>
1902: </ul>
1903: </div>
1904:
1905: <p>When using pkgsrc on Interix, DO NOT install the
1906: Utilities subcomponent "UNIX Perl". That is Perl 5.6
1907: without shared module support, installed to
1908: /usr/local, and will only cause confusion. Instead,
1909: install Perl 5.8 from pkgsrc (or from a binary
1910: package).</p>
1911:
1912: <p>The Remote Connectivity subcomponent "Windows
1913: Remote Shell Service" does not need to be installed,
1914: but Remote Connectivity itself should be installed in
1915: order to have a working inetd.</p>
1916:
1917: <p>Finally, during installation you may be asked
1918: whether to enable setuid behavior for Interix
1919: programs, and whether to make pathnames default to
1920: case-sensitive. Setuid should be enabled, and
1921: case-sensitivity MUST be enabled. (Without
1922: case-sensitivity, a large number of packages
1923: including perl will not build.)</p>
1924: </div>
1925:
1926: <div class="sect3" lang="en" xml:lang="en">
1927: <div class="titlepage">
1928: <div>
1929: <div>
1930: <h4 class="title"><a name=
1931: "platform.interix-sfu-postinstall" id=
1932: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
1933: to do if Interix/SFU is already installed</h4>
1934: </div>
1935: </div>
1936: </div>
1937:
1938: <p>If SFU is already installed and you wish to alter
1939: these settings to work with pkgsrc, note the
1940: following things.</p>
1941:
1942: <div class="itemizedlist">
1943: <ul type="disc">
1944: <li>
1945: <p>To uninstall UNIX Perl, use Add/Remove
1946: Programs, select Microsoft Windows Services for
1947: UNIX, then click Change. In the installer,
1948: choose Add or Remove, then uncheck
1949: Utilities->UNIX Perl.</p>
1950: </li>
1951:
1952: <li>
1953: <p>To enable case-sensitivity for the
1954: filesystem, run REGEDIT.EXE, and change the
1955: following registry key:</p>
1956:
1957: <p>
1958: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
1959: Manager\kernel</p>
1960:
1961: <p>Set the DWORD value "obcaseinsensitive" to
1962: 0; then reboot.</p>
1963: </li>
1964:
1965: <li>
1966: <p>To enable setuid binaries (optional), run
1967: REGEDIT.EXE, and change the following registry
1968: key:</p>
1969:
1970: <p>
1971: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
1972: for UNIX</p>
1973:
1974: <p>Set the DWORD value "EnableSetuidBinaries"
1975: to 1; then reboot.</p>
1976: </li>
1977: </ul>
1978: </div>
1979: </div>
1980:
1981: <div class="sect3" lang="en" xml:lang="en">
1982: <div class="titlepage">
1983: <div>
1984: <div>
1985: <h4 class="title"><a name=
1986: "platform.interix-notes" id=
1987: "platform.interix-notes"></a>3.2.3.3. Important
1988: notes for using pkgsrc</h4>
1989: </div>
1990: </div>
1991: </div>
1992:
1993: <p>The package imanager (either the pkgsrc "su" user,
1994: or the user running "pkg_add") must be a member of
1995: the local Administrators group. Such a user must also
1996: be used to run the bootstrap. This is slightly
1997: relaxed from the normal pkgsrc requirement of
1998: "root".</p>
1999:
2000: <p>The package manager should use a umask of 002.
2001: "make install" will automatically complain if this is
2002: not the case. This ensures that directories written
2003: in /var/db/pkg are Administrators-group
2004: writeable.</p>
2005:
2006: <p>The popular Interix binary packages from
2007: http://www.interopsystems.com/ use an older version
2008: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2009: used in conjunction with pkgsrc. If you choose to use
2010: them at the same time as the pkgsrc packages, ensure
2011: that you use the proper pkg_* tools for each type of
2012: binary package.</p>
1.22 tv 2013:
2014: <p>The TERM setting used for DOS-type console windows
2015: (including those invoked by the csh and ksh startup
2016: shortcuts) is "interix". Most systems don't have a
2017: termcap/terminfo entry for it, but the following
2018: .termcap entry provides adequate emulation in most
2019: cases:</p>
2020: <pre class="programlisting">
2021: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
2022: </pre>
1.1 grant 2023: </div>
2024: </div>
2025:
2026: <div class="sect2" lang="en" xml:lang="en">
2027: <div class="titlepage">
2028: <div>
2029: <div>
1.26 ! wiz 2030: <h3 class="title"><a name="id2570557" id=
! 2031: "id2570557"></a>3.2.4. IRIX</h3>
1.1 grant 2032: </div>
2033: </div>
2034: </div>
2035:
2036: <p>You will need a working C compiler, either gcc or
2037: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2038: the <code class="varname">CC</code> environment
2039: variable according to your preference. If you do not
2040: have a license for the MIPSpro compiler suite, you can
1.1 grant 2041: download a gcc tardist file from <a href=
2042: "http://freeware.sgi.com/" target=
2043: "_top">http://freeware.sgi.com/</a>.</p>
2044:
2045: <p>Please note that you will need IRIX 6.5.17 or
2046: higher, as this is the earliest version of IRIX
1.24 wiz 2047: providing support for <a href=
2048: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2049: <span class="citerefentry"><span class=
2050: "refentrytitle">if_indextoname</span>(3)</span></a>,
2051: <a href=
2052: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2053: <span class="citerefentry"><span class=
2054: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2055: etc.</p>
1.1 grant 2056:
2057: <p>At this point in time, pkgsrc only supports one ABI.
2058: That is, you can not switch between the old 32-bit ABI,
2059: the new 32-bit ABI and the 64-bit ABI. If you start out
2060: using "abi=n32", that's what all your packages will be
2061: built with.</p>
2062:
2063: <p>Therefore, please make sure that you have no
1.14 xtraeme 2064: conflicting <code class="varname">CFLAGS</code> in your
2065: environment or the <code class=
2066: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2067: that you do not try to link n32 object files with lib64
1.14 xtraeme 2068: or vice versa. Check your <code class=
2069: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2070:
2071: <p>If you have the actual pkgsrc tree mounted via NFS
2072: from a different host, please make sure to set
1.14 xtraeme 2073: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2074: directory, as it appears that IRIX linker occasionally
2075: runs into issues when trying to link over a network
2076: mounted filesystem.</p>
2077:
2078: <p>The bootstrapping process should set all the right
2079: options for programs such as imake(1), but you may want
2080: to set some options depending on your local setup.
1.14 xtraeme 2081: Please see <code class=
2082: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.1 grant 2083: course, your compilers man pages for details.</p>
1.22 tv 2084:
2085: <p>If you are using SGI's MIPSPro compiler, please
2086: set</p>
2087: <pre class="programlisting">
2088: PKGSRC_COMPILER=mipspro
2089: </pre>
2090:
2091: <p>in <code class="filename">/etc/mk.conf</code>.
2092: Otherwise, pkgsrc will assume you are using gcc and may
2093: end up passing invalid flags to the compiler. Note that
2094: bootstrap should create an appropriate <code class=
2095: "filename">mk.conf.example</code> by default.</p>
2096:
2097: <p>If you have both the MIPSPro compiler chain
2098: installed as well as gcc, but want to make sure that
2099: MIPRPro is used, please set your <code class=
2100: "varname">PATH</code> to <span class=
2101: "emphasis"><em>not</em></span> include the location of
2102: gcc (often <code class=
2103: "filename">/usr/freeware/bin</code>), and (important)
2104: pass the '--preserve-path' flag.</p>
1.1 grant 2105: </div>
2106:
2107: <div class="sect2" lang="en" xml:lang="en">
2108: <div class="titlepage">
2109: <div>
2110: <div>
1.26 ! wiz 2111: <h3 class="title"><a name="id2570654" id=
! 2112: "id2570654"></a>3.2.5. Linux</h3>
1.22 tv 2113: </div>
2114: </div>
2115: </div>
2116:
2117: <p>Some versions of Linux (for example Debian
2118: GNU/Linux) need either libtermcap or libcurses
2119: (libncurses). Installing the distributions
2120: libncurses-dev package (or equivalent) should fix the
2121: problem.</p>
2122:
2123: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2124: and icc (Intel C++ Compiler). gcc is the default. icc
2125: 8.0 and 8.1 on i386 have been tested.</p>
2126:
2127: <p>To bootstrap using icc, assuming the default icc
2128: installation directory:</p>
2129: <pre class="programlisting">
2130: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2131: ac_cv___attribute__=yes ./bootstrap
2132: </pre>
2133:
2134: <div class="note" style=
2135: "margin-left: 0.5in; margin-right: 0.5in;">
2136: <h3 class="title">Note</h3>
2137:
2138: <p>icc 8.1 needs the `-i-static' argument instead of
2139: -static-libcxa.</p>
2140: </div>
2141:
2142: <p>icc supports __attribute__, but the GNU configure
2143: test uses a nested function, which icc does not
2144: support. #undef'ing __attribute__ has the unfortunate
2145: side-effect of breaking many of the Linux header files,
2146: which cannot be compiled properly without
2147: __attribute__. The test must be overridden so that
2148: __attribute__ is assumed supported by the compiler.</p>
2149:
2150: <p>After bootstrapping, you should set <code class=
2151: "varname">PKGSRC_COMPILER</code> in <code class=
2152: "filename">/etc/mk.conf</code>:</p>
2153: <pre class="programlisting">
2154: PKGSRC_COMPILER=icc
2155: </pre>
2156:
2157: <p>The default installation directory for icc is
2158: <code class="filename">/opt/intel_cc_80</code>, which
2159: is also the pkgsrc default. If you have installed it
2160: into a different directory, set <code class=
2161: "varname">ICCBASE</code> in <code class=
2162: "filename">/etc/mk.conf</code>:</p>
2163: <pre class="programlisting">
2164: ICCBASE=/opt/icc
2165: </pre>
2166:
2167: <p>pkgsrc uses the static linking method of the runtime
2168: libraries provided by icc, so binaries can be run on
2169: other systems which do not have the shared libraries
2170: installed.</p>
2171:
2172: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2173: the <a href=
2174: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2175: <span class="citerefentry"><span class=
2176: "refentrytitle">ld</span>(1)</span></a> command run
2177: when linking a C++ shared library and records it,
2178: throwing away the -Bstatic and -Bdynamic options
2179: interspersed between the libraries. This means that
2180: libtool-linked C++ shared libraries will have a runtime
2181: dependency on the icc libraries until this is fixed in
2182: libtool.</p>
1.22 tv 2183: </div>
2184:
2185: <div class="sect2" lang="en" xml:lang="en">
2186: <div class="titlepage">
2187: <div>
2188: <div>
1.26 ! wiz 2189: <h3 class="title"><a name="id2570723" id=
! 2190: "id2570723"></a>3.2.6. OpenBSD</h3>
1.1 grant 2191: </div>
2192: </div>
2193: </div>
2194:
2195: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2196:
2197: <p>Care should be taken so that the tools that this kit
2198: installs do not conflict with the OpenBSD userland
2199: tools. There are several steps:</p>
2200:
2201: <div class="orderedlist">
2202: <ol type="1">
2203: <li>
2204: <p>OpenBSD stores its ports pkg database in
1.14 xtraeme 2205: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 2206: therefore recommended that you choose a different
1.14 xtraeme 2207: location (e.g. <code class=
2208: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2209: --pkgdbdir option to the bootstrap script.</p>
2210: </li>
2211:
2212: <li>
2213: <p>If you do not intend to use the OpenBSD ports
2214: tools, it's probably a good idea to move them out
2215: of the way to avoid confusion, e.g.</p>
2216: <pre class="screen">
1.14 xtraeme 2217: <code class="prompt">#</code> <strong class=
2218: "userinput"><code>cd /usr/sbin</code></strong>
2219: <code class="prompt">#</code> <strong class=
2220: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2221: <code class="prompt">#</code> <strong class=
2222: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2223: <code class="prompt">#</code> <strong class=
2224: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2225: <code class="prompt">#</code> <strong class=
2226: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2227: </pre>
2228: </li>
2229:
2230: <li>
1.14 xtraeme 2231: <p>An example <code class=
2232: "filename">/etc/mk.conf</code> file will be
2233: placed in <code class=
2234: "filename">/etc/mk.conf.example</code> file when
2235: you use the bootstrap script. OpenBSD's make
2236: program uses <code class=
2237: "filename">/etc/mk.conf</code> as well. You can
1.1 grant 2238: work around this by enclosing all the pkgsrc
2239: specific parts of the file with:</p>
2240: <pre class="programlisting">
2241: .ifdef BSD_PKG_MK
1.11 ben 2242: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1 grant 2243: .else
2244: # OpenBSD stuff
2245: .endif
2246: </pre>
2247: </li>
2248: </ol>
2249: </div>
2250: </div>
2251:
2252: <div class="sect2" lang="en" xml:lang="en">
2253: <div class="titlepage">
2254: <div>
2255: <div>
1.26 ! wiz 2256: <h3 class="title"><a name="id2570835" id=
! 2257: "id2570835"></a>3.2.7. Solaris</h3>
1.1 grant 2258: </div>
2259: </div>
2260: </div>
2261:
2262: <p>Solaris 2.6 through 9 are supported on both x86 and
2263: sparc. You will need a working C compiler. Both gcc
2264: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2265:
2266: <p>The following packages are required on Solaris 8 for
2267: the bootstrap process and to build packages.</p>
2268:
2269: <div class="itemizedlist">
2270: <ul type="disc">
2271: <li>
2272: <p>SUNWsprot</p>
2273: </li>
2274:
2275: <li>
2276: <p>SUNWarc</p>
2277: </li>
2278:
2279: <li>
2280: <p>SUNWbtool</p>
2281: </li>
2282:
2283: <li>
2284: <p>SUNWtoo</p>
2285: </li>
2286:
2287: <li>
2288: <p>SUNWlibm</p>
2289: </li>
2290: </ul>
2291: </div>
2292:
2293: <p>Please note the use of GNU binutils on Solaris is
2294: <span class="emphasis"><em>not</em></span>
2295: supported.</p>
2296:
2297: <div class="sect3" lang="en" xml:lang="en">
2298: <div class="titlepage">
2299: <div>
2300: <div>
1.26 ! wiz 2301: <h4 class="title"><a name="id2570934" id=
! 2302: "id2570934"></a>3.2.7.1. If you are using
1.1 grant 2303: gcc</h4>
2304: </div>
2305: </div>
2306: </div>
2307:
2308: <p>It makes life much simpler if you only use the
2309: same gcc consistently for building all packages.</p>
2310:
2311: <p>It is recommended that an external gcc be used
2312: only for bootstrapping, then either build gcc from
2313: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2314: href=
2315: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.20 ben 2316: class="pkgname">lang/gcc</a> or install a binary gcc
2317: package, then remove gcc used during
2318: bootstrapping.</p>
1.1 grant 2319:
2320: <p>Binary packages of gcc can be found through
2321: <a href=
2322: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2323: target=
2324: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2325: </div>
2326:
2327: <div class="sect3" lang="en" xml:lang="en">
2328: <div class="titlepage">
2329: <div>
2330: <div>
1.26 ! wiz 2331: <h4 class="title"><a name="id2570955" id=
! 2332: "id2570955"></a>3.2.7.2. If you are using
1.1 grant 2333: Sun WorkShop</h4>
2334: </div>
2335: </div>
2336: </div>
2337:
2338: <p>You will need at least the following packages
2339: installed (from WorkShop 5.0)</p>
2340:
2341: <div class="itemizedlist">
2342: <ul type="disc">
2343: <li>
2344: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2345: </li>
2346:
2347: <li>
2348: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2349: </li>
2350:
2351: <li>
2352: <p>SPROild - Sun WorkShop Incremental
2353: Linker</p>
2354: </li>
2355:
2356: <li>
2357: <p>SPROlang - Sun WorkShop Compilers common
2358: components</p>
2359: </li>
2360: </ul>
2361: </div>
2362:
1.14 xtraeme 2363: <p>You should set <code class="varname">CC</code>,
2364: <code class="varname">CXX</code> and optionally,
2365: <code class="varname">CPP</code> in <code class=
2366: "filename">/etc/mk.conf</code>, eg.</p>
1.1 grant 2367: <pre class="programlisting">
2368: CC= cc
2369: CXX= CC
2370: CPP= /usr/ccs/lib/cpp
2371: </pre>
2372:
2373: <p>You may also want to build 64-bit binaries,
2374: eg.</p>
2375: <pre class="programlisting">
2376: CFLAGS= -xtarget=ultra -xarch=v9
2377: </pre>
2378:
2379: <p>Whichever compiler you use, please ensure the
2380: compiler tools and your $prefix are in your
1.14 xtraeme 2381: <code class="varname">PATH</code>. This includes
2382: <code class="filename">/usr/ccs/{bin,lib}</code> and
2383: eg. <code class=
2384: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2385: </div>
2386: </div>
2387: </div>
2388: </div>
2389:
2390: <div class="chapter" lang="en" xml:lang="en">
2391: <div class="titlepage">
2392: <div>
2393: <div>
2394: <h2 class="title"><a name="using" id=
2395: "using"></a>Chapter 4. Using pkgsrc</h2>
2396: </div>
2397: </div>
2398: </div>
2399:
2400: <div class="toc">
2401: <p><b>Table of Contents</b></p>
2402:
2403: <dl>
2404: <dt><span class="sect1"><a href="#getting-started">4.1.
2405: Working with binary packages</a></span></dt>
2406:
2407: <dd>
2408: <dl>
1.26 ! wiz 2409: <dt><span class="sect2"><a href="#id2571040">4.1.1.
1.1 grant 2410: Where to get binary packages</a></span></dt>
2411:
1.26 ! wiz 2412: <dt><span class="sect2"><a href="#id2571080">4.1.2.
1.1 grant 2413: How to use binary packages</a></span></dt>
2414:
1.26 ! wiz 2415: <dt><span class="sect2"><a href="#id2571256">4.1.3.
1.1 grant 2416: A word of warning</a></span></dt>
2417: </dl>
2418: </dd>
2419:
1.26 ! wiz 2420: <dt><span class="sect1"><a href="#id2571336">4.2.
1.1 grant 2421: Building packages from source</a></span></dt>
2422:
2423: <dd>
2424: <dl>
1.26 ! wiz 2425: <dt><span class="sect2"><a href="#id2571346">4.2.1.
1.1 grant 2426: Requirements</a></span></dt>
2427:
1.26 ! wiz 2428: <dt><span class="sect2"><a href="#id2571366">4.2.2.
1.1 grant 2429: Fetching distfiles</a></span></dt>
2430:
1.26 ! wiz 2431: <dt><span class="sect2"><a href="#id2571828">4.2.3.
1.1 grant 2432: How to build and install</a></span></dt>
2433:
1.26 ! wiz 2434: <dt><span class="sect2"><a href="#id2623831">4.2.4.
1.1 grant 2435: Selecting the compiler</a></span></dt>
2436: </dl>
2437: </dd>
2438: </dl>
2439: </div>
2440:
2441: <div class="sect1" lang="en" xml:lang="en">
2442: <div class="titlepage">
2443: <div>
2444: <div>
2445: <h2 class="title" style="clear: both"><a name=
2446: "getting-started" id=
2447: "getting-started"></a>4.1. Working with binary
2448: packages</h2>
2449: </div>
2450: </div>
2451: </div>
2452:
2453: <p>This section describes how to find, retrieve and
2454: install a precompiled binary package that someone else
2455: already prepared for your type of machine.</p>
2456:
2457: <div class="sect2" lang="en" xml:lang="en">
2458: <div class="titlepage">
2459: <div>
2460: <div>
1.26 ! wiz 2461: <h3 class="title"><a name="id2571040" id=
! 2462: "id2571040"></a>4.1.1. Where to get binary
1.1 grant 2463: packages</h3>
2464: </div>
2465: </div>
2466: </div>
2467:
2468: <p>Precompiled packages are stored on ftp.NetBSD.org
1.14 xtraeme 2469: and its mirrors in the directory <code class=
2470: "filename">/pub/NetBSD/packages</code> for anonymous
2471: FTP access. Please pick the right subdirectory there as
2472: indicated by <span><strong class="command">uname
2473: -p</strong></span>. In that directory, there is a
1.1 grant 2474: subdirectory for each category plus a subdirectory
1.14 xtraeme 2475: <code class="filename">All</code> which includes the
2476: actual binaries in <code class="filename">.tgz</code>
2477: files. The category subdirectories use symbolic links
2478: to those files (this is the same directory layout as in
2479: <code class=
2480: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2481:
2482: <p>This same directory layout applies for CDROM
2483: distributions, only that the directory may be rooted
1.14 xtraeme 2484: somewhere else, probably somewhere below <code class=
2485: "filename">/cdrom</code>. Please consult your CDROMs
1.1 grant 2486: documentation for the exact location.</p>
2487: </div>
2488:
2489: <div class="sect2" lang="en" xml:lang="en">
2490: <div class="titlepage">
2491: <div>
2492: <div>
1.26 ! wiz 2493: <h3 class="title"><a name="id2571080" id=
! 2494: "id2571080"></a>4.1.2. How to use binary
1.1 grant 2495: packages</h3>
2496: </div>
2497: </div>
2498: </div>
2499:
2500: <p>If you have the files on a CDROM or downloaded them
1.23 wiz 2501: to your hard disk, you can install them with the
1.14 xtraeme 2502: following command (be sure to<span><strong class=
2503: "command">su</strong></span> to root first):</p>
1.1 grant 2504: <pre class="screen">
1.14 xtraeme 2505: <code class="prompt">#</code> <strong class=
2506: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 2507: </pre>
2508:
2509: <p>If you have FTP access and you don't want to
2510: download the packages via FTP prior to installation,
1.14 xtraeme 2511: you can do this automatically by giving
2512: <span><strong class="command">pkg_add</strong></span>
2513: an FTP URL:</p>
1.1 grant 2514: <pre class="screen">
1.14 xtraeme 2515: <code class="prompt">#</code> <strong class=
2516: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSvers>/<arch>/All/package.tgz</code></strong>
1.1 grant 2517: </pre>
2518:
2519: <p>If there is any doubt, the uname utility can be used
2520: to determine the <OSvers>, and <arch> by
1.14 xtraeme 2521: running <span><strong class="command">uname
2522: -rp</strong></span>.</p>
1.1 grant 2523:
2524: <p>Also note that any prerequisite packages needed to
2525: run the package in question will be installed, too,
2526: assuming they are present where you install from.</p>
2527:
1.23 wiz 2528: <p>To save some typing, you can set the <code class=
2529: "varname">PKG_PATH</code> environment variable to a
2530: semicolon separated list of paths (including remote
2531: URLs); trailing slashes are not allowed.</p>
2532:
2533: <p>Additionally to the <code class=
2534: "filename">All</code> directory there exists a
2535: <code class="filename">vulnerable</code> directory to
2536: which binary packages with known vulnerabilities are
2537: moved, since removing them could cause missing
2538: dependencies. To use these packages, add the
2539: <code class="filename">vulnerable</code> directory to
2540: your <code class="varname">PKG_PATH</code>. However,
2541: you should run <a xmlns=
2542: "http://www.w3.org/TR/xhtml1/transitional" href=
2543: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
2544: class="pkgname">security/audit-packages</a> regularly,
2545: and especially after installing new packages, and
2546: verify that the vulnerabilities are acceptable for your
2547: configuration. An example <code class=
2548: "varname">PKG_PATH</code> would be: <code class=
2549: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSvers>/<arch>/All;ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSvers>/<arch>/vulnerable</code>
2550: Please note that semicolon (';') is a shell
2551: meta-character, so you'll probably have to quote
2552: it.</p>
2553:
1.1 grant 2554: <p>After you've installed packages, be sure to have
1.14 xtraeme 2555: <code class="filename">/usr/pkg/bin</code> in your
2556: <code class="varname">PATH</code> so you can actually
2557: start the just installed program.</p>
1.1 grant 2558: </div>
2559:
2560: <div class="sect2" lang="en" xml:lang="en">
2561: <div class="titlepage">
2562: <div>
2563: <div>
1.26 ! wiz 2564: <h3 class="title"><a name="id2571256" id=
! 2565: "id2571256"></a>4.1.3. A word of
1.1 grant 2566: warning</h3>
2567: </div>
2568: </div>
2569: </div>
2570:
2571: <p>Please pay very careful attention to the warnings
2572: expressed in the <a href=
2573: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2574: <span class="citerefentry"><span class=
2575: "refentrytitle">pkg_add</span>(1)</span></a> manual
2576: page about the inherent dangers of installing binary
2577: packages which you did not create yourself, and the
2578: security holes that can be introduced onto your system
2579: by indiscriminate adding of such files.</p>
2580: </div>
2581: </div>
2582:
2583: <div class="sect1" lang="en" xml:lang="en">
2584: <div class="titlepage">
2585: <div>
2586: <div>
2587: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 2588: "id2571336" id="id2571336"></a>4.2. Building
1.1 grant 2589: packages from source</h2>
2590: </div>
2591: </div>
2592: </div>
2593:
2594: <p>This assumes that the package is already in pkgsrc. If
2595: it is not, see <a href="#developers-guide" title=
1.2 hubertf 2596: "Part II. The pkgsrc developer's guide">Part II,
2597: “The pkgsrc developer's guide”</a>.</p>
1.1 grant 2598:
2599: <div class="sect2" lang="en" xml:lang="en">
2600: <div class="titlepage">
2601: <div>
2602: <div>
1.26 ! wiz 2603: <h3 class="title"><a name="id2571346" id=
! 2604: "id2571346"></a>4.2.1. Requirements</h3>
1.1 grant 2605: </div>
2606: </div>
2607: </div>
2608:
2609: <p>To build packages from source on a NetBSD system the
2610: “<span class="quote">comp</span>” and the
2611: “<span class="quote">text</span>”
2612: distribution sets must be installed. If you want to
2613: build X11 related packages the “<span class=
2614: "quote">xbase</span>” and “<span class=
2615: "quote">xcomp</span>” distribution sets are
2616: required, too.</p>
2617: </div>
2618:
2619: <div class="sect2" lang="en" xml:lang="en">
2620: <div class="titlepage">
2621: <div>
2622: <div>
1.26 ! wiz 2623: <h3 class="title"><a name="id2571366" id=
! 2624: "id2571366"></a>4.2.2. Fetching
1.1 grant 2625: distfiles</h3>
2626: </div>
2627: </div>
2628: </div>
2629:
2630: <p>The distfile (i.e. the unmodified source) must exist
2631: on your system for the packages system to be able to
2632: build it. If it does not exist, pkgsrc will use
2633: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
2634: <span class="citerefentry"><span class=
2635: "refentrytitle">ftp</span>(1)</span></a> to fetch it
2636: automatically.</p>
2637:
2638: <p>You can overwrite some of the major distribution
2639: sites to fit to sites that are close to your own. Have
1.14 xtraeme 2640: a look at <code class=
2641: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
2642: some examples - in particular, look for the
2643: <code class="varname">MASTER_SORT</code>, <code class=
2644: "varname">MASTER_SORT_REGEX</code> and <code class=
2645: "varname">INET_COUNTRY</code> definitions. This may
2646: save some of your bandwidth and time.</p>
1.1 grant 2647:
2648: <p>You can change these settings either in your shell's
2649: environment, or, if you want to keep the settings, by
1.14 xtraeme 2650: editing the <code class="filename">/etc/mk.conf</code>
1.1 grant 2651: file, and adding the definitions there.</p>
2652:
2653: <p>If you don't have a permanent Internet connection
2654: and you want to know which files to download,
1.14 xtraeme 2655: <span><strong class="command">make
2656: fetch-list</strong></span> will tell you what you'll
2657: need. Put these distfiles into <code class=
2658: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 2659: </div>
2660:
2661: <div class="sect2" lang="en" xml:lang="en">
2662: <div class="titlepage">
2663: <div>
2664: <div>
1.26 ! wiz 2665: <h3 class="title"><a name="id2571828" id=
! 2666: "id2571828"></a>4.2.3. How to build and
1.1 grant 2667: install</h3>
2668: </div>
2669: </div>
2670: </div>
2671:
2672: <p>Assuming that the distfile has been fetched (see
2673: previous section), become root and change into the
1.14 xtraeme 2674: relevant directory and running <span><strong class=
2675: "command">make</strong></span>. For example, type</p>
1.1 grant 2676: <pre class="screen">
1.14 xtraeme 2677: <code class="prompt">%</code> <strong class=
2678: "userinput"><code>cd misc/figlet</code></strong>
2679: <code class="prompt">%</code> <strong class=
2680: "userinput"><code>make</code></strong>
1.1 grant 2681: </pre>
2682:
2683: <p>at the shell prompt to build the various components
2684: of the package, and</p>
2685: <pre class="screen">
1.14 xtraeme 2686: <code class="prompt">#</code> <strong class=
2687: "userinput"><code>make install</code></strong>
1.1 grant 2688: </pre>
2689:
2690: <p>to install the various components into the correct
2691: places on your system. Installing the package on your
2692: system requires you to be root. However, pkgsrc has a
2693: <span class="emphasis"><em>just-in-time-su</em></span>
2694: feature, which allows you to only become root for the
2695: actual installation step</p>
2696:
2697: <p>Taking the figlet utility as an example, we can
2698: install it on our system by building as shown in
2699: <a href="#logs" title=
2700: "Appendix B. Build logs">Appendix B, <i>Build
2701: logs</i></a>.</p>
2702:
2703: <p>The program is installed under the default root of
1.14 xtraeme 2704: the packages tree - <code class=
2705: "filename">/usr/pkg</code>. Should this not conform to
2706: your tastes, set the <code class=
2707: "varname">LOCALBASE</code> variable in your
1.1 grant 2708: environment, and it will use that value as the root of
1.14 xtraeme 2709: your packages tree. So, to use <code class=
2710: "filename">/usr/local</code>, set <code class=
2711: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 2712: environment. Please note that you should use a
2713: directory which is dedicated to packages and not shared
1.14 xtraeme 2714: with other programs (ie, do not try and use
2715: <code class="varname">LOCALBASE=/usr</code>). Also, you
2716: should not try to add any of your own files or
2717: directories (such as <code class=
2718: "filename">src/</code>, <code class=
2719: "filename">obj/</code>, or <code class=
2720: "filename">pkgsrc/</code>) below the <code class=
2721: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 2722: possible conflicts between programs and other files
2723: installed by the package system and whatever else may
2724: have been installed there.</p>
2725:
1.14 xtraeme 2726: <p>Some packages look in <code class=
2727: "filename">/etc/mk.conf</code> to alter some
1.1 grant 2728: configuration options at build time. Have a look at
1.14 xtraeme 2729: <code class=
2730: "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
2731: overview of what will be set there by default.
2732: Environment variables such as <code class=
2733: "varname">LOCALBASE</code> can be set in <code class=
2734: "filename">/etc/mk.conf</code> to save having to
2735: remember to set them each time you want to use
2736: pkgsrc.</p>
1.1 grant 2737:
2738: <p>Occasionally, people want to “<span class=
2739: "quote">look under the covers</span>” to see what
2740: is going on when a package is building or being
2741: installed. This may be for debugging purposes, or out
2742: of simple curiosity. A number of utility values have
2743: been added to help with this.</p>
2744:
2745: <div class="orderedlist">
2746: <ol type="1">
2747: <li>
2748: <p>If you invoke the <a href=
2749: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2750: <span class="citerefentry"><span class=
2751: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 2752: with <code class=
2753: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
2754: amount of information will be displayed. For
2755: example,</p>
1.1 grant 2756: <pre class="screen">
1.14 xtraeme 2757: <strong class=
2758: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 2759: </pre>
2760:
2761: <p>will show all the commands that are invoked,
2762: up to and including the “<span class=
2763: "quote">patch</span>” stage.</p>
2764: </li>
2765:
2766: <li>
2767: <p>If you want to know the value of a certain
1.22 tv 2768: <a href=
2769: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2770: <span class="citerefentry"><span class=
2771: "refentrytitle">make</span>(1)</span></a>
2772: definition, then the <code class=
1.14 xtraeme 2773: "varname">VARNAME</code> definition should be
2774: used, in conjunction with the show-var target.
2775: e.g. to show the expansion of the <a href=
1.1 grant 2776: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2777: <span class="citerefentry"><span class=
2778: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 2779: variable <code class=
1.22 tv 2780: "varname">LOCALBASE</code>:</p>
1.1 grant 2781: <pre class="screen">
1.14 xtraeme 2782: <code class="prompt">%</code> <strong class=
2783: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 2784: /usr/pkg
1.14 xtraeme 2785: <code class="prompt">%</code>
1.1 grant 2786:
2787: </pre>
2788: </li>
2789: </ol>
2790: </div>
2791:
2792: <p>If you want to install a binary package that you've
2793: either created yourself (see next section), that you
2794: put into pkgsrc/packages manually or that is located on
1.8 wiz 2795: a remote FTP server, you can use the "bin-install"
1.1 grant 2796: target. This target will install a binary package - if
2797: available - via <a href=
2798: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2799: <span class="citerefentry"><span class=
2800: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 2801: <span><strong class="command">make
2802: package</strong></span>. The list of remote FTP sites
2803: searched is kept in the variable <code class=
2804: "varname">BINPKG_SITES</code>, which defaults to
2805: ftp.NetBSD.org. Any flags that should be added to
2806: <a href=
1.1 grant 2807: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2808: <span class="citerefentry"><span class=
2809: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 2810: into <code class="varname">BIN_INSTALL_FLAGS</code>.
2811: See <code class=
2812: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
2813: details.</p>
1.1 grant 2814:
2815: <p>A final word of warning: If you setup a system that
1.14 xtraeme 2816: has a non-standard setting for <code class=
2817: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 2818: any packages are installed, as you can not use several
2819: directories for the same purpose. Doing so will result
2820: in pkgsrc not being able to properly detect your
2821: installed packages, and fail miserably. Note also that
2822: precompiled binary packages are usually built with the
1.14 xtraeme 2823: default <code class="varname">LOCALBASE</code> of
2824: <code class="filename">/usr/pkg</code>, and that you
2825: should <span class="emphasis"><em>not</em></span>
2826: install any if you use a non-standard <code class=
2827: "varname">LOCALBASE</code>.</p>
1.1 grant 2828: </div>
2829:
2830: <div class="sect2" lang="en" xml:lang="en">
2831: <div class="titlepage">
2832: <div>
2833: <div>
1.26 ! wiz 2834: <h3 class="title"><a name="id2623831" id=
! 2835: "id2623831"></a>4.2.4. Selecting the
1.1 grant 2836: compiler</h3>
2837: </div>
2838: </div>
2839: </div>
2840:
2841: <p>By default, pkgsrc will use GCC to build packages.
2842: This may be overridden by setting the following
2843: variables in /etc/mk.conf:</p>
2844:
2845: <div class="variablelist">
2846: <dl>
1.14 xtraeme 2847: <dt><span class="term"><code class=
2848: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 2849:
2850: <dd>
2851: <p>This is a list of values specifying the chain
2852: of compilers to invoke when building packages.
2853: Valid values are:</p>
2854:
2855: <div class="itemizedlist">
2856: <ul type="disc">
2857: <li>
1.14 xtraeme 2858: <p><code class="varname">distcc</code>:
1.1 grant 2859: distributed C/C++ (chainable)</p>
2860: </li>
2861:
2862: <li>
1.14 xtraeme 2863: <p><code class="varname">ccache</code>:
1.1 grant 2864: compiler cache (chainable)</p>
2865: </li>
2866:
2867: <li>
1.14 xtraeme 2868: <p><code class="varname">gcc</code>: GNU
2869: C/C++ Compiler</p>
1.1 grant 2870: </li>
2871:
2872: <li>
1.14 xtraeme 2873: <p><code class="varname">mipspro</code>:
1.1 grant 2874: Silicon Graphics, Inc. MIPSpro
2875: (n32/n64)</p>
2876: </li>
2877:
2878: <li>
1.14 xtraeme 2879: <p><code class="varname">mipspro</code>:
1.1 grant 2880: Silicon Graphics, Inc. MIPSpro (o32)</p>
2881: </li>
2882:
2883: <li>
1.14 xtraeme 2884: <p><code class="varname">sunpro</code>:
1.1 grant 2885: Microsystems, Inc. WorkShip/Forte/Sun ONE
2886: Studio</p>
2887: </li>
2888: </ul>
2889: </div>
2890:
2891: <p>The default is “<span class=
1.14 xtraeme 2892: "quote"><code class=
2893: "varname">gcc</code></span>”. You can use
2894: <code class="varname">ccache</code> and/or
2895: <code class="varname">distcc</code> with an
2896: appropriate <code class=
2897: "varname">PKGSRC_COMPILER</code> setting, e.g.
2898: “<span class="quote"><code class=
2899: "varname">ccache gcc</code></span>”. This
1.1 grant 2900: variable should always be terminated with a value
2901: for a real compiler.</p>
2902: </dd>
2903:
1.14 xtraeme 2904: <dt><span class="term"><code class=
2905: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 2906:
2907: <dd>
2908: <p>This specifies the minimum version of GCC to
2909: use when building packages. If the system GCC
2910: doesn't satisfy this requirement, then pkgsrc
2911: will build and install one of the GCC packages to
2912: use instead.</p>
2913: </dd>
2914: </dl>
2915: </div>
2916: </div>
2917: </div>
2918: </div>
2919:
2920: <div class="chapter" lang="en" xml:lang="en">
2921: <div class="titlepage">
2922: <div>
2923: <div>
2924: <h2 class="title"><a name="binary" id=
2925: "binary"></a>Chapter 5. Creating binary
2926: packages</h2>
2927: </div>
2928: </div>
2929: </div>
2930:
2931: <div class="toc">
2932: <p><b>Table of Contents</b></p>
2933:
2934: <dl>
1.26 ! wiz 2935: <dt><span class="sect1"><a href="#id2623917">5.1.
1.1 grant 2936: Building a single binary package</a></span></dt>
2937:
1.26 ! wiz 2938: <dt><span class="sect1"><a href="#id2623995">5.2.
1.1 grant 2939: Settings for creation of binary
2940: packages</a></span></dt>
2941:
2942: <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
2943: a bulk build of all packages</a></span></dt>
2944:
2945: <dd>
2946: <dl>
2947: <dt><span class="sect2"><a href=
2948: "#binary.configuration">5.3.1.
2949: Configuration</a></span></dt>
2950:
1.26 ! wiz 2951: <dt><span class="sect2"><a href="#id2624142">5.3.2.
1.1 grant 2952: Other environmental considerations</a></span></dt>
2953:
1.26 ! wiz 2954: <dt><span class="sect2"><a href="#id2624183">5.3.3.
1.1 grant 2955: Operation</a></span></dt>
2956:
1.26 ! wiz 2957: <dt><span class="sect2"><a href="#id2624252">5.3.4.
1.1 grant 2958: What it does</a></span></dt>
2959:
1.26 ! wiz 2960: <dt><span class="sect2"><a href="#id2624309">5.3.5.
1.1 grant 2961: Disk space requirements</a></span></dt>
2962:
1.26 ! wiz 2963: <dt><span class="sect2"><a href="#id2624336">5.3.6.
1.1 grant 2964: Setting up a sandbox for chroot'ed
2965: builds</a></span></dt>
2966:
1.26 ! wiz 2967: <dt><span class="sect2"><a href="#id2624865">5.3.7.
1.1 grant 2968: Building a partial set of packages</a></span></dt>
1.13 hubertf 2969:
2970: <dt><span class="sect2"><a href=
2971: "#bulk-upload">5.3.8. Uploading results of a bulk
2972: build</a></span></dt>
1.1 grant 2973: </dl>
2974: </dd>
2975:
1.26 ! wiz 2976: <dt><span class="sect1"><a href="#id2625321">5.4.
1.1 grant 2977: Creating a multiple CD-ROM packages
2978: collection</a></span></dt>
2979:
2980: <dd>
2981: <dl>
1.26 ! wiz 2982: <dt><span class="sect2"><a href="#id2625336">5.4.1.
1.1 grant 2983: Example of cdpack</a></span></dt>
2984: </dl>
2985: </dd>
2986: </dl>
2987: </div>
2988:
2989: <div class="sect1" lang="en" xml:lang="en">
2990: <div class="titlepage">
2991: <div>
2992: <div>
2993: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 2994: "id2623917" id="id2623917"></a>5.1. Building a
1.1 grant 2995: single binary package</h2>
2996: </div>
2997: </div>
2998: </div>
2999:
3000: <p>Once you have built and installed a package, you can
3001: create a <span class="emphasis"><em>binary
3002: package</em></span> which can be installed on another
3003: system with <a href=
3004: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3005: <span class="citerefentry"><span class=
3006: "refentrytitle">pkg_add</span>(1)</span></a> This saves
3007: having to build the same package on a group of hosts and
3008: wasting CPU time. It also provides a simple means for
3009: others to install your package, should you distribute
3010: it.</p>
3011:
3012: <p>To create a binary package, change into the
1.14 xtraeme 3013: appropriate directory in pkgsrc, and run
3014: <span><strong class="command">make
3015: package</strong></span>:</p>
1.1 grant 3016: <pre class="screen">
1.14 xtraeme 3017: <code class="prompt">#</code> <strong class=
3018: "userinput"><code>cd misc/figlet</code></strong>
3019: <code class="prompt">#</code> <strong class=
3020: "userinput"><code>make package</code></strong>
1.1 grant 3021: </pre>
3022:
3023: <p>This will build and install your package (if not
3024: already done), and then build a binary package from what
1.14 xtraeme 3025: was installed. You can then use the <span><strong class=
3026: "command">pkg_*</strong></span> tools to manipulate it.
3027: Binary packages are created by default in <code class=
3028: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 3029: gzipped tar file. See <a href="#logs.package" title=
3030: "B.2. Packaging figlet">Section B.2,
3031: “Packaging figlet”</a> for a continuation of
3032: the above <a xmlns=
3033: "http://www.w3.org/TR/xhtml1/transitional" href=
3034: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.20 ben 3035: class="pkgname">misc/figlet</a> example.</p>
1.1 grant 3036:
3037: <p>See <a href="#submit" title=
1.25 rillig 3038: "Chapter 15. Submitting and Committing">Chapter
3039: 15, <i>Submitting and Committing</i></a> for information
1.1 grant 3040: on how to submit such a binary package.</p>
3041: </div>
3042:
3043: <div class="sect1" lang="en" xml:lang="en">
3044: <div class="titlepage">
3045: <div>
3046: <div>
3047: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 3048: "id2623995" id="id2623995"></a>5.2. Settings
1.1 grant 3049: for creation of binary packages</h2>
3050: </div>
3051: </div>
3052: </div>
3053:
3054: <p>See <a href="#build.helpful-targets" title=
1.25 rillig 3055: "12.3. Other helpful targets">Section 12.3,
1.1 grant 3056: “Other helpful targets”</a>.</p>
3057: </div>
3058:
3059: <div class="sect1" lang="en" xml:lang="en">
3060: <div class="titlepage">
3061: <div>
3062: <div>
3063: <h2 class="title" style="clear: both"><a name=
3064: "bulkbuild" id="bulkbuild"></a>5.3. Doing a
3065: bulk build of all packages</h2>
3066: </div>
3067: </div>
3068: </div>
3069:
3070: <p>If you want to get a full set of precompiled binary
3071: packages, this section describes how to get them. Beware
3072: that the bulk build will remove all currently installed
1.23 wiz 3073: packages from your system! Having an FTP server
3074: configured either on the machine doing the bulk builds or
3075: on a nearby NFS server can help to make the packages
3076: available to everyone. See <a href=
1.1 grant 3077: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
3078: <span class="citerefentry"><span class=
3079: "refentrytitle">ftpd</span>(8)</span></a> for more
3080: information. If you use a remote NFS server's storage, be
3081: sure to not actually compile on NFS storage, as this
3082: slows things down a lot.</p>
3083:
3084: <div class="sect2" lang="en" xml:lang="en">
3085: <div class="titlepage">
3086: <div>
3087: <div>
3088: <h3 class="title"><a name="binary.configuration"
3089: id=
3090: "binary.configuration"></a>5.3.1. Configuration</h3>
3091: </div>
3092: </div>
3093: </div>
3094:
3095: <div class="sect3" lang="en" xml:lang="en">
3096: <div class="titlepage">
3097: <div>
3098: <div>
3099: <h4 class="title"><a name="binary.mk.conf" id=
3100: "binary.mk.conf"></a>5.3.1.1. /etc/mk.conf</h4>
3101: </div>
3102: </div>
3103: </div>
3104:
1.23 wiz 3105: <p>You may want to set variables in <code class=
1.14 xtraeme 3106: "filename">/etc/mk.conf</code>. Look at <code class=
3107: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 3108: details of the default settings. You will want to
1.14 xtraeme 3109: ensure that <code class=
3110: "varname">ACCEPTABLE_LICENSES</code> meet your local
3111: policy. As used in this example, <code class=
3112: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 3113: "emphasis"><em>all</em></span> licenses.</p>
3114: <pre class="programlisting">
3115: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
3116: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
3117: BSDSRCDIR= /usr/src
3118: BSDXSRCDIR= /usr/xsrc # for x11/xservers
3119: OBJHOSTNAME?= yes # use work.`hostname`
3120: FAILOVER_FETCH= yes # insist on the correct checksum
3121: PKG_DEVELOPER?= yes
3122: _ACCEPTABLE= yes
3123: </pre>
3124: </div>
3125:
3126: <div class="sect3" lang="en" xml:lang="en">
3127: <div class="titlepage">
3128: <div>
3129: <div>
1.26 ! wiz 3130: <h4 class="title"><a name="id2624060" id=
! 3131: "id2624060"></a>5.3.1.2. <code class=
1.14 xtraeme 3132: "filename">build.conf</code></h4>
1.1 grant 3133: </div>
3134: </div>
3135: </div>
3136:
1.14 xtraeme 3137: <p>In <code class="filename">pkgsrc/mk/bulk</code>,
3138: copy <code class="filename">build.conf-example</code>
3139: to <code class="filename">build.conf</code> and edit
3140: it, following the comments in that file. This is the
1.1 grant 3141: config file that determines where log files are
3142: generated after the build, where to mail the build
1.23 wiz 3143: report to, where your pkgsrc tree is located and the
3144: user to which user to <a href=
1.1 grant 3145: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
3146: <span class="citerefentry"><span class=
1.23 wiz 3147: "refentrytitle">su</span>(8)</span></a> to do a
1.14 xtraeme 3148: <span><strong class="command">cvs
3149: update</strong></span>.</p>
1.1 grant 3150: </div>
3151:
3152: <div class="sect3" lang="en" xml:lang="en">
3153: <div class="titlepage">
3154: <div>
3155: <div>
1.26 ! wiz 3156: <h4 class="title"><a name="id2624097" id=
! 3157: "id2624097"></a>5.3.1.3. <code class=
1.14 xtraeme 3158: "filename">pre-build.local</code></h4>
1.1 grant 3159: </div>
3160: </div>
3161: </div>
3162:
3163: <p>It is possible to configure the bulk build to
3164: perform certain site specific tasks at the end of the
1.14 xtraeme 3165: pre-build stage. If the file <code class=
3166: "filename">pre-build.local</code> exists in
1.23 wiz 3167: <code class="filename">/usr/pkgsrc/mk/bulk</code>, it
1.24 wiz 3168: will be executed (as a <a href=
3169: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
3170: <span class="citerefentry"><span class=
3171: "refentrytitle">sh</span>(1)</span></a> script) at
3172: the end of the usual pre-build stage. An example use
3173: of <code class="filename">pre-build.local</code> is
3174: to have the line:</p>
1.1 grant 3175: <pre class="screen">
1.14 xtraeme 3176: <code class="prompt">#</code> <strong class=
3177: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 3178: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 3179: </pre>
3180:
3181: <p>to prevent the system from trying to build a
3182: particular package which requires nearly 3 GB of disk
3183: space.</p>
3184: </div>
3185: </div>
3186:
3187: <div class="sect2" lang="en" xml:lang="en">
3188: <div class="titlepage">
3189: <div>
3190: <div>
1.26 ! wiz 3191: <h3 class="title"><a name="id2624142" id=
! 3192: "id2624142"></a>5.3.2. Other environmental
1.1 grant 3193: considerations</h3>
3194: </div>
3195: </div>
3196: </div>
3197:
1.14 xtraeme 3198: <p>As <code class="filename">/usr/pkg</code> will be
1.1 grant 3199: completely deleted at the start of bulk builds, make
3200: sure your login shell is placed somewhere else. Either
1.14 xtraeme 3201: drop it into <code class=
3202: "filename">/usr/local/bin</code> (and adjust your login
3203: shell in the passwd file), or (re-)install it via
3204: <a href=
1.1 grant 3205: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3206: <span class="citerefentry"><span class=
3207: "refentrytitle">pkg_add</span>(1)</span></a> from
1.14 xtraeme 3208: <code class="filename">/etc/rc.local</code>, so you can
1.1 grant 3209: login after a reboot (remember that your current
3210: process won't die if the package is removed, you just
3211: can't start any new instances of the shell any more).
3212: Also, if you use NetBSD earlier than 1.5, or you still
3213: want to use the pkgsrc version of ssh for some reason,
3214: be sure to install ssh before starting it from
1.14 xtraeme 3215: <code class="filename">rc.local</code>:</p>
1.1 grant 3216: <pre class="programlisting">
3217: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
3218: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
3219: /usr/pkg/etc/rc.d/sshd
3220: fi
3221: </pre>
3222:
3223: <p>Not doing so will result in you being not able to
3224: log in via ssh after the bulk build is finished or if
3225: the machine gets rebooted or crashes. You have been
3226: warned! :)</p>
3227: </div>
3228:
3229: <div class="sect2" lang="en" xml:lang="en">
3230: <div class="titlepage">
3231: <div>
3232: <div>
1.26 ! wiz 3233: <h3 class="title"><a name="id2624183" id=
! 3234: "id2624183"></a>5.3.3. Operation</h3>
1.1 grant 3235: </div>
3236: </div>
3237: </div>
3238:
3239: <p>Make sure you don't need any of the packages still
3240: installed.</p>
3241:
3242: <div class="warning" style=
3243: "margin-left: 0.5in; margin-right: 0.5in;">
3244: <h3 class="title">Warning</h3>
3245:
3246: <p>During the bulk build, <span class=
3247: "emphasis"><em>all packages will be
3248: removed!</em></span></p>
3249: </div>
3250:
3251: <p>Be sure to remove all other things that might
3252: interfere with builds, like some libs installed in
1.14 xtraeme 3253: <code class="filename">/usr/local</code>, etc. then
3254: become root and type:</p>
1.1 grant 3255: <pre class="screen">
1.14 xtraeme 3256: <code class="prompt">#</code> <strong class=
3257: "userinput"><code>cd /usr/pkgsrc</code></strong>
3258: <code class="prompt">#</code> <strong class=
3259: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 3260: </pre>
3261:
3262: <p>If for some reason your last build didn't complete
3263: (power failure, system panic, ...), you can continue it
3264: by running:</p>
3265: <pre class="screen">
1.14 xtraeme 3266: <code class="prompt">#</code> <strong class=
3267: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 3268: </pre>
3269:
3270: <p>At the end of the bulk build, you will get a summary
3271: via mail, and find build logs in the directory
1.14 xtraeme 3272: specified by <code class="varname">FTP</code> in the
3273: <code class="filename">build.conf</code> file.</p>
1.1 grant 3274: </div>
3275:
3276: <div class="sect2" lang="en" xml:lang="en">
3277: <div class="titlepage">
3278: <div>
3279: <div>
1.26 ! wiz 3280: <h3 class="title"><a name="id2624252" id=
! 3281: "id2624252"></a>5.3.4. What it does</h3>
1.1 grant 3282: </div>
3283: </div>
3284: </div>
3285:
3286: <p>The bulk builds consist of three steps:</p>
3287:
3288: <div class="variablelist">
3289: <dl>
3290: <dt><span class="term">1. pre-build</span></dt>
3291:
3292: <dd>
3293: <p>The script updates your pkgsrc tree via
3294: (anon)cvs, then cleans out any broken distfiles,
3295: and removes all packages installed.</p>
3296: </dd>
3297:
3298: <dt><span class="term">2. the bulk
3299: build</span></dt>
3300:
3301: <dd>
3302: <p>This is basically “<span class=
3303: "quote">make bulk-package</span>” with an
3304: optimised order in which packages will be built.
3305: Packages that don't require other packages will
3306: be built first, and packages with many
3307: dependencies will be built later.</p>
3308: </dd>
3309:
3310: <dt><span class="term">3. post-build</span></dt>
3311:
3312: <dd>
3313: <p>Generates a report that's placed in the
1.14 xtraeme 3314: directory specified in the <code class=
3315: "filename">build.conf</code> file named
3316: <code class="filename">broken.html</code>, a
3317: short version of that report will also be mailed
3318: to the build's admin.</p>
1.1 grant 3319: </dd>
3320: </dl>
3321: </div>
3322:
3323: <p>During the build, a list of broken packages will be
1.14 xtraeme 3324: compiled in <code class=
3325: "filename">/usr/pkgsrc/.broken</code> (or <code class=
3326: "filename">.../.broken.${MACHINE}</code> if
3327: <code class="varname">OBJMACHINE</code> is set),
3328: individual build logs of broken builds can be found in
3329: the package's directory. These files are used by the
3330: bulk-targets to mark broken builds to not waste time
3331: trying to rebuild them, and they can be used to debug
3332: these broken package builds later.</p>
1.1 grant 3333: </div>
3334:
3335: <div class="sect2" lang="en" xml:lang="en">
3336: <div class="titlepage">
3337: <div>
3338: <div>
1.26 ! wiz 3339: <h3 class="title"><a name="id2624309" id=
! 3340: "id2624309"></a>5.3.5. Disk space
1.1 grant 3341: requirements</h3>
3342: </div>
3343: </div>
3344: </div>
3345:
3346: <p>Currently, roughly the following requirements are
3347: valid for NetBSD 2.0/i386:</p>
3348:
3349: <div class="itemizedlist">
3350: <ul type="disc">
3351: <li>
3352: <p>10 GB - distfiles (NFS ok)</p>
3353: </li>
3354:
3355: <li>
3356: <p>8 GB - full set of all binaries (NFS ok)</p>
3357: </li>
3358:
3359: <li>
3360: <p>5 GB - temp space for compiling (local disk
3361: recommended)</p>
3362: </li>
3363: </ul>
3364: </div>
3365:
3366: <p>Note that all pkgs will be de-installed as soon as
3367: they are turned into a binary package, and that sources
3368: are removed, so there is no excessively huge demand to
3369: disk space. Afterwards, if the package is needed again,
3370: it will be installed via <a href=
3371: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3372: <span class="citerefentry"><span class=
3373: "refentrytitle">pkg_add</span>(1)</span></a> instead of
3374: building again, so there are no cycles wasted by
3375: recompiling.</p>
3376: </div>
3377:
3378: <div class="sect2" lang="en" xml:lang="en">
3379: <div class="titlepage">
3380: <div>
3381: <div>
1.26 ! wiz 3382: <h3 class="title"><a name="id2624336" id=
! 3383: "id2624336"></a>5.3.6. Setting up a sandbox
1.1 grant 3384: for chroot'ed builds</h3>
3385: </div>
3386: </div>
3387: </div>
3388:
1.12 agc 3389: <p>If you don't want all the packages nuked from a
3390: machine (rendering it useless for anything but pkg
1.23 wiz 3391: compiling), there is the possibility of doing the
3392: package bulk build inside a chroot environment.</p>
1.12 agc 3393:
3394: <p>The first step is to set up a chroot sandbox, e.g.
1.14 xtraeme 3395: <code class="filename">/usr/sandbox</code>. This can be
1.12 agc 3396: done by using null mounts, or manually.</p>
3397:
1.14 xtraeme 3398: <p>There is a shell script called <code class=
3399: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
3400: set up the sandbox environment using null mounts. It
3401: will also create a script called <code class=
3402: "filename">sandbox</code> in the root of the sandbox
1.12 agc 3403: environment, which will allow the null mounts to be
1.14 xtraeme 3404: activated using the <span><strong class=
3405: "command">sandbox mount</strong></span> command and
3406: deactivated using the <span><strong class=
3407: "command">sandbox umount</strong></span> command.</p>
1.12 agc 3408:
3409: <p>To set up a sandbox environment by hand, after
3410: extracting all the sets from a NetBSD installation or
1.14 xtraeme 3411: doing a <span><strong class="command">make distribution
3412: DESTDIR=/usr/sandbox</strong></span> in <code class=
3413: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 3414: items are present and properly configured:</p>
1.1 grant 3415:
3416: <div class="procedure">
3417: <ol type="1">
3418: <li>
3419: <p>Kernel</p>
3420: <pre class="screen">
1.14 xtraeme 3421: <code class="prompt">#</code> <strong class=
3422: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 3423: </pre>
3424: </li>
3425:
3426: <li>
1.14 xtraeme 3427: <p><code class="filename">/dev/*</code></p>
1.1 grant 3428: <pre class="screen">
1.14 xtraeme 3429: <code class="prompt">#</code> <strong class=
3430: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 3431: </pre>
3432: </li>
3433:
3434: <li>
1.14 xtraeme 3435: <p><code class="filename">/etc/resolv.conf</code>
1.1 grant 3436: (for <a xmlns=
3437: "http://www.w3.org/TR/xhtml1/transitional" href=
3438: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20 ben 3439: class="pkgname">security/smtpd</a> and mail):</p>
1.1 grant 3440: <pre class="screen">
1.14 xtraeme 3441: <code class="prompt">#</code> <strong class=
3442: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 3443: </pre>
3444: </li>
3445:
3446: <li>
3447: <p>Working(!) mail config (hostname,
3448: sendmail.cf):</p>
3449: <pre class="screen">
1.14 xtraeme 3450: <code class="prompt">#</code> <strong class=
3451: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 3452: </pre>
3453: </li>
3454:
3455: <li>
1.14 xtraeme 3456: <p><code class="filename">/etc/localtime</code>
3457: (for <a xmlns=
1.1 grant 3458: "http://www.w3.org/TR/xhtml1/transitional" href=
3459: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20 ben 3460: class="pkgname">security/smtpd</a>):</p>
1.1 grant 3461: <pre class="screen">
1.14 xtraeme 3462: <code class="prompt">#</code> <strong class=
3463: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 3464: </pre>
3465: </li>
3466:
3467: <li>
1.14 xtraeme 3468: <p><code class="filename">/usr/src</code> (system
1.1 grant 3469: sources, for <a xmlns=
3470: "http://www.w3.org/TR/xhtml1/transitional" href=
3471: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.20 ben 3472: class="pkgname">sysutils/aperture</a>, <a xmlns=
3473: "http://www.w3.org/TR/xhtml1/transitional" href=
3474: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
3475: class="pkgname">net/ppp-mppe</a>):</p>
1.1 grant 3476: <pre class="screen">
1.14 xtraeme 3477: <code class="prompt">#</code> <strong class=
3478: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
3479: <code class="prompt">#</code> <strong class=
1.23 wiz 3480: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 3481: </pre>
3482: </li>
3483:
3484: <li>
1.14 xtraeme 3485: <p>Create <code class=
3486: "filename">/var/db/pkg</code> (not part of
3487: default install):</p>
1.1 grant 3488: <pre class="screen">
1.14 xtraeme 3489: <code class="prompt">#</code> <strong class=
3490: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 3491: </pre>
3492: </li>
3493:
3494: <li>
1.14 xtraeme 3495: <p>Create <code class="filename">/usr/pkg</code>
3496: (not part of default install):</p>
1.1 grant 3497: <pre class="screen">
1.14 xtraeme 3498: <code class="prompt">#</code> <strong class=
3499: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 3500: </pre>
3501: </li>
3502:
3503: <li>
1.14 xtraeme 3504: <p>Checkout pkgsrc via cvs into <code class=
3505: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 3506: <pre class="screen">
1.14 xtraeme 3507: <code class="prompt">#</code> <strong class=
3508: "userinput"><code>cd /usr/sandbox/usr</code></strong>
3509: <code class="prompt">#</code> <strong class=
3510: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 3511: </pre>
3512:
3513: <p>Do not mount/link this to the copy of your
3514: pkgsrc tree you do development in, as this will
3515: likely cause problems!</p>
3516: </li>
3517:
3518: <li>
1.14 xtraeme 3519: <p>Make <code class=
3520: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
3521: and <code class="filename">.../distfiles</code>
3522: point somewhere appropriate. NFS- and/or
3523: nullfs-mounts may come in handy!</p>
1.1 grant 3524: </li>
3525:
3526: <li>
1.14 xtraeme 3527: <p>Edit <code class=
3528: "filename">/etc/mk.conf</code>, see <a href=
3529: "#binary.mk.conf" title=
1.1 grant 3530: "5.3.1.1. /etc/mk.conf">Section 5.3.1.1,
3531: “/etc/mk.conf”</a>.</p>
3532: </li>
3533:
3534: <li>
1.14 xtraeme 3535: <p>Adjust <code class=
3536: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 3537: needs.</p>
3538: </li>
3539:
3540: <li>
1.14 xtraeme 3541: <p>If you have set <code class=
3542: "varname">CVS_USER</code> in <code class=
3543: "filename">build.conf</code>, make sure that
3544: account exists and can do a <span><strong class=
3545: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 3546: properly!</p>
3547: </li>
3548: </ol>
3549: </div>
3550:
3551: <p>When the chroot sandbox is setup, you can start the
3552: build with the following steps:</p>
3553: <pre class="screen">
1.14 xtraeme 3554: <code class="prompt">#</code> <strong class=
3555: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
3556: <code class="prompt">#</code> <strong class=
3557: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 3558: </pre>
3559:
3560: <p>This will just jump inside the sandbox and start
3561: building. At the end of the build, mail will be sent
3562: with the results of the build. Created binary pkgs will
1.14 xtraeme 3563: be in <code class=
3564: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 3565: (wherever that points/mounts to/from).</p>
3566: </div>
3567:
3568: <div class="sect2" lang="en" xml:lang="en">
3569: <div class="titlepage">
3570: <div>
3571: <div>
1.26 ! wiz 3572: <h3 class="title"><a name="id2624865" id=
! 3573: "id2624865"></a>5.3.7. Building a partial
1.1 grant 3574: set of packages</h3>
3575: </div>
3576: </div>
3577: </div>
3578:
3579: <p>In addition to building a complete set of all
1.14 xtraeme 3580: packages in pkgsrc, the <code class=
3581: "filename">pkgsrc/mk/bulk/build</code> script may be
3582: used to build a subset of the packages contained in
3583: pkgsrc. By setting defining <code class=
3584: "varname">SPECIFIC_PKGS</code> in <code class=
3585: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 3586:
3587: <div class="itemizedlist">
3588: <ul type="disc">
3589: <li>
3590: <p>SITE_SPECIFIC_PKGS</p>
3591: </li>
3592:
3593: <li>
3594: <p>HOST_SPECIFIC_PKGS</p>
3595: </li>
3596:
3597: <li>
3598: <p>GROUP_SPECIFIC_PKGS</p>
3599: </li>
3600:
3601: <li>
3602: <p>USER_SPECIFIC_PKGS</p>
3603: </li>
3604: </ul>
3605: </div>
3606:
3607: <p>will define the set of packages which should be
3608: built. The bulk build code will also include any
3609: packages which are needed as dependencies for the
3610: explicitly listed packages.</p>
3611:
3612: <p>One use of this is to do a bulk build with
1.14 xtraeme 3613: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 3614: sandbox periodically to have a complete set of the
3615: binary packages needed for your site available without
3616: the overhead of building extra packages that are not
3617: needed.</p>
3618: </div>
1.13 hubertf 3619:
3620: <div class="sect2" lang="en" xml:lang="en">
3621: <div class="titlepage">
3622: <div>
3623: <div>
3624: <h3 class="title"><a name="bulk-upload" id=
3625: "bulk-upload"></a>5.3.8. Uploading results
3626: of a bulk build</h3>
3627: </div>
3628: </div>
3629: </div>
3630:
3631: <p>This section describes how pkgsrc developers can
3632: upload binary pkgs built by bulk builds to
3633: ftp.NetBSD.org.</p>
3634:
1.17 sketch 3635: <p>If you would like to automatically create checksum
3636: files for the binary packages you intend to upload,
3637: remember to set <code class="varname">MKSUMS=yes</code>
3638: in your <code class=
3639: "filename">mk/bulk/build.conf</code>.</p>
3640:
3641: <p>If you would like to PGP sign the checksum files
3642: (highly recommended!), remember to set <code class=
3643: "varname">SIGN_AS=username@NetBSD.org</code> in your
3644: <code class="filename">mk/bulk/build.conf</code>. This
1.23 wiz 3645: will prompt you for your GPG password to sign the files
1.17 sketch 3646: before uploading everything.</p>
3647:
3648: <p>Then, make sure that you have <code class=
1.14 xtraeme 3649: "varname">RSYNC_DST</code> set properly in your
3650: <code class="filename">mk/bulk/build.conf</code> file,
3651: i.e. adjust it to something like one of the
3652: following:</p>
1.13 hubertf 3653: <pre class="screen">
3654: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3655: </pre>
3656:
1.23 wiz 3657: <p>Please use appropviate values for "pkgsrc-200xQy",
1.13 hubertf 3658: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 3659: ftp.NetBSD.org is different from <code class=
3660: "varname">CVS_USER</code>, write your login directly
3661: into the variable, e.g. my local account is "feyrer",
3662: but for my login "hubertf", I use:</p>
1.13 hubertf 3663: <pre class="screen">
3664: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3665: </pre>
3666:
1.14 xtraeme 3667: <p>A separate <code class="filename">upload</code>
1.13 hubertf 3668: directory is used here to allow "closing" the directory
3669: during upload. To do so, run the following command on
3670: ftp.NetBSD.org next:</p>
3671: <pre class="screen">
1.14 xtraeme 3672: nbftp% <strong class=
3673: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 3674: </pre>
3675:
1.14 xtraeme 3676: <p>Please note that <code class=
3677: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 3678: appropriate for packages for the NetBSD operating
3679: system. Binary packages for other operating systems
1.14 xtraeme 3680: should go into <code class=
3681: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 3682:
3683: <p>Before uploading the binary pkgs, ssh authentication
1.23 wiz 3684: needs to be set up. This example shows how to setup
1.13 hubertf 3685: temporary keys for the root account <span class=
3686: "emphasis"><em>inside the sandbox</em></span> (assuming
3687: that no keys should be present there usually):</p>
3688: <pre class="screen">
1.14 xtraeme 3689: <code class="prompt">#</code> <strong class=
3690: "userinput"><code>chroot /usr/sandbox</code></strong>
3691: chroot-<code class="prompt">#</code> <strong class=
3692: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
3693: chroot-<code class="prompt">#</code> <strong class=
3694: "userinput"><code>ssh-keygen -t dsa</code></strong>
3695: chroot-<code class="prompt">#</code> <strong class=
3696: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 3697: </pre>
3698:
1.14 xtraeme 3699: <p>Now take the output of <code class=
3700: "filename">id-dsa.pub</code> and append it to your
3701: <code class="filename">~/.ssh/authorized_keys</code>
1.17 sketch 3702: file on ftp.NetBSD.org. You can remove the key after
1.14 xtraeme 3703: the upload is done!</p>
1.13 hubertf 3704:
3705: <p>Next, test if your ssh connection really works:</p>
3706: <pre class="screen">
1.14 xtraeme 3707: chroot-<code class="prompt">#</code> <strong class=
3708: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 3709: </pre>
3710:
3711: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
3712:
3713: <p>Now after all this works, you can exit the sandbox
3714: and start the upload:</p>
3715: <pre class="screen">
1.14 xtraeme 3716: chroot-<code class="prompt">#</code> <strong class=
3717: "userinput"><code>exit</code></strong>
3718: <code class="prompt">#</code> <strong class=
3719: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
3720: <code class="prompt">#</code> <strong class=
3721: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 3722: </pre>
3723:
3724: <p>The upload process may take quite some time. Use
1.24 wiz 3725: <a href=
3726: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
3727: <span class="citerefentry"><span class=
3728: "refentrytitle">ls</span>(1)</span></a> or <a href=
3729: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
3730: <span class="citerefentry"><span class=
3731: "refentrytitle">du</span>(1)</span></a> on the FTP
3732: server to monitor progress of the upload. The upload
3733: script will take care of not uploading restricted
3734: packages and putting vulnerable packages into the
3735: <code class="filename">vulnerable</code>
3736: subdirectory.</p>
1.13 hubertf 3737:
3738: <p>After the upload has ended, first thing is to revoke
3739: ssh access:</p>
3740: <pre class="screen">
1.14 xtraeme 3741: nbftp% <strong class=
3742: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 3743: Gdd:x!
3744: </pre>
3745:
3746: <p>Use whatever is needed to remove the key you've
3747: entered before! Last, move the uploaded packages out of
1.14 xtraeme 3748: the <code class="filename">upload</code> directory to
3749: have them accessible to everyone:</p>
1.13 hubertf 3750: <pre class="screen">
1.14 xtraeme 3751: nbftp% <strong class=
3752: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
3753: nbftp% <strong class=
3754: "userinput"><code>mv upload/* .</code></strong>
3755: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
3756: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 3757: </pre>
3758: </div>
1.1 grant 3759: </div>
3760:
3761: <div class="sect1" lang="en" xml:lang="en">
3762: <div class="titlepage">
3763: <div>
3764: <div>
3765: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 3766: "id2625321" id="id2625321"></a>5.4. Creating a
1.1 grant 3767: multiple CD-ROM packages collection</h2>
3768: </div>
3769: </div>
3770: </div>
3771:
3772: <p>After your pkgsrc bulk-build has completed, you may
3773: wish to create a CD-ROM set of the resulting binary
3774: packages to assist in installing packages on other
3775: machines. The <a xmlns=
3776: "http://www.w3.org/TR/xhtml1/transitional" href=
3777: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.20 ben 3778: class="pkgname">pkgtools/cdpack</a> package provides a
3779: simple tool for creating the ISO 9660 images.
3780: <span><strong class="command">cdpack</strong></span>
3781: arranges the packages on the CD-ROMs in a way that keeps
3782: all the dependencies for given package on the same CD as
3783: that package.</p>
1.1 grant 3784:
3785: <div class="sect2" lang="en" xml:lang="en">
3786: <div class="titlepage">
3787: <div>
3788: <div>
1.26 ! wiz 3789: <h3 class="title"><a name="id2625336" id=
! 3790: "id2625336"></a>5.4.1. Example of
1.1 grant 3791: cdpack</h3>
3792: </div>
3793: </div>
3794: </div>
3795:
3796: <p>Complete documentation for cdpack is found in the
3797: cdpack(1) manpage. The following short example assumes
1.14 xtraeme 3798: that the binary packages are left in <code class=
3799: "filename">/usr/pkgsrc/packages/All</code> and that
3800: sufficient disk space exists in <code class=
3801: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 3802: <pre class="screen">
1.14 xtraeme 3803: <code class="prompt">#</code> <strong class=
3804: "userinput"><code>mkdir /u2/images</code></strong>
3805: <code class="prompt">#</code> <strong class=
3806: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
3807: <code class="prompt">#</code> <strong class=
3808: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 3809: </pre>
3810:
3811: <p>If you wish to include a common set of files
1.14 xtraeme 3812: (<code class="filename">COPYRIGHT</code>, <code class=
3813: "filename">README</code>, etc.) on each CD in the
1.1 grant 3814: collection, then you need to create a directory which
3815: contains these files. e.g.</p>
3816: <pre class="screen">
1.14 xtraeme 3817: <code class="prompt">#</code> <strong class=
3818: "userinput"><code>mkdir /tmp/common</code></strong>
3819: <code class="prompt">#</code> <strong class=
3820: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
3821: <code class="prompt">#</code> <strong class=
3822: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
3823: <code class="prompt">#</code> <strong class=
3824: "userinput"><code>mkdir /tmp/common/bin</code></strong>
3825: <code class="prompt">#</code> <strong class=
3826: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
3827: <code class="prompt">#</code> <strong class=
3828: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
3829: <code class="prompt">#</code> <strong class=
3830: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 3831: </pre>
3832:
3833: <p>Now create the images:</p>
3834: <pre class="screen">
1.14 xtraeme 3835: <code class="prompt">#</code> <strong class=
3836: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 3837: </pre>
3838:
1.14 xtraeme 3839: <p>Each image will contain <code class=
3840: "filename">README</code>, <code class=
3841: "filename">COPYING</code>, and <code class=
3842: "filename">bin/myscript</code> in their root
1.1 grant 3843: directories.</p>
3844: </div>
3845: </div>
3846: </div>
3847:
3848: <div class="chapter" lang="en" xml:lang="en">
3849: <div class="titlepage">
3850: <div>
3851: <div>
3852: <h2 class="title"><a name="faq" id=
3853: "faq"></a>Chapter 6. Frequently Asked
3854: Questions</h2>
3855: </div>
3856: </div>
3857: </div>
3858:
3859: <div class="toc">
3860: <p><b>Table of Contents</b></p>
3861:
3862: <dl>
1.26 ! wiz 3863: <dt><span class="sect1"><a href="#id2625528">6.1. Are
1.18 xtraeme 3864: there any mailing lists for pkg-related
1.1 grant 3865: discussion?</a></span></dt>
3866:
1.26 ! wiz 3867: <dt><span class="sect1"><a href="#id2625662">6.2.
1.1 grant 3868: Where's the pkgviews documentation?</a></span></dt>
3869:
1.5 hubertf 3870: <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1 grant 3871: Utilities for package management
3872: (pkgtools)</a></span></dt>
3873:
1.26 ! wiz 3874: <dt><span class="sect1"><a href="#id2625984">6.4. How
1.1 grant 3875: to use pkgsrc as non-root</a></span></dt>
3876:
1.26 ! wiz 3877: <dt><span class="sect1"><a href="#id2625995">6.5. How
1.15 xtraeme 3878: to resume transfers when fetching
3879: distfiles?</a></span></dt>
1.14 xtraeme 3880:
1.26 ! wiz 3881: <dt><span class="sect1"><a href="#id2626045">6.6. How
1.1 grant 3882: can I install/use XFree86 from pkgsrc?</a></span></dt>
3883:
1.26 ! wiz 3884: <dt><span class="sect1"><a href="#id2626073">6.7. How
1.1 grant 3885: can I install/use X.org from pkgsrc?</a></span></dt>
3886:
1.26 ! wiz 3887: <dt><span class="sect1"><a href="#id2626101">6.8. How
1.1 grant 3888: to fetch files from behind a firewall</a></span></dt>
3889:
1.26 ! wiz 3890: <dt><span class="sect1"><a href="#id2626115">6.9. How
1.14 xtraeme 3891: do I tell <span><strong class="command">make
3892: fetch</strong></span> to do passive
3893: FTP?</a></span></dt>
1.1 grant 3894:
1.26 ! wiz 3895: <dt><span class="sect1"><a href="#id2626166">6.10. How
1.1 grant 3896: to fetch all distfiles at once</a></span></dt>
3897:
1.26 ! wiz 3898: <dt><span class="sect1"><a href="#id2626313">6.11. What
1.14 xtraeme 3899: does “<span class="quote">Don't know how to make
3900: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 3901: mean?</a></span></dt>
3902:
1.26 ! wiz 3903: <dt><span class="sect1"><a href="#id2626352">6.12. What
1.14 xtraeme 3904: does “<span class="quote">Could not find
3905: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 3906:
1.26 ! wiz 3907: <dt><span class="sect1"><a href="#id2626409">6.13.
1.1 grant 3908: Using 'sudo' with pkgsrc</a></span></dt>
3909:
1.14 xtraeme 3910: <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1 grant 3911: Configuration files handling and
3912: placement</a></span></dt>
3913:
1.14 xtraeme 3914: <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1 grant 3915: Automated security checks</a></span></dt>
3916: </dl>
3917: </div>
3918:
3919: <p>This section contains hints, tips & tricks on
3920: special things in pkgsrc that we didn't find a better place
3921: for in the previous chapters, and it contains items for
3922: both pkgsrc users and developers.</p>
3923:
3924: <div class="sect1" lang="en" xml:lang="en">
3925: <div class="titlepage">
3926: <div>
3927: <div>
3928: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 3929: "id2625528" id="id2625528"></a>6.1. Are there
1.18 xtraeme 3930: any mailing lists for pkg-related discussion?</h2>
1.1 grant 3931: </div>
3932: </div>
3933: </div>
3934:
1.18 xtraeme 3935: <p>The following mailing lists may be of interest to
3936: pkgsrc users:</p>
3937:
3938: <div class="itemizedlist">
3939: <ul type="disc">
3940: <li>
3941: <p><a href=
3942: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.20 ben 3943: target="_top">pkgsrc-bugs</a> -- a list where
3944: problem reports related to pkgsrc are sent and
3945: discussed</p>
1.18 xtraeme 3946: </li>
3947:
3948: <li>
3949: <p><a href=
3950: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.20 ben 3951: target="_top">pkgsrc-bulk</a> -- a list where the
3952: results of pkgsrc bulk builds are sent and
3953: discussed</p>
1.18 xtraeme 3954: </li>
3955:
3956: <li>
3957: <p><a href=
3958: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.20 ben 3959: target="_top">pkgsrc-changes</a> -- a list where
3960: all commit messages to pkgsrc are sent</p>
1.18 xtraeme 3961: </li>
3962:
3963: <li>
3964: <p><a href=
3965: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.20 ben 3966: target="_top">tech-pkg</a> -- a general discussion
3967: list for all things related to pkgsrc</p>
1.18 xtraeme 3968: </li>
3969: </ul>
3970: </div>
3971:
3972: <p>To subscribe, do:</p>
1.1 grant 3973: <pre class="programlisting">
1.18 xtraeme 3974: <code class="prompt">%</code> echo subscribe <em class=
3975: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 3976: </pre>
3977:
1.18 xtraeme 3978: <p>Archives for all these mailing lists are available
3979: from <a href="http://mail-index.NetBSD.org/" target=
3980: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 3981: </div>
3982:
3983: <div class="sect1" lang="en" xml:lang="en">
3984: <div class="titlepage">
3985: <div>
3986: <div>
3987: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 3988: "id2625662" id="id2625662"></a>6.2. Where's
1.1 grant 3989: the pkgviews documentation?</h2>
3990: </div>
3991: </div>
3992: </div>
3993:
3994: <p>Pkgviews is tightly integrated with buildlink. You can
1.14 xtraeme 3995: find a pkgviews User's guide in <code class=
3996: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 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.5 hubertf 4004: "faq-pkgtools" id=
4005: "faq-pkgtools"></a>6.3. Utilities for package
4006: management (pkgtools)</h2>
1.1 grant 4007: </div>
4008: </div>
4009: </div>
4010:
1.14 xtraeme 4011: <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1 grant 4012: directory pkgtools contains a number of useful utilities
4013: for both users and developers of pkgsrc. This section
4014: attempts only to make the reader aware of the utilities
4015: and when they might be useful, and not to duplicate the
4016: documentation that comes with each package.</p>
4017:
4018: <p>Utilities used by pkgsrc (automatically installed when
4019: needed):</p>
4020:
4021: <div class="itemizedlist">
4022: <ul type="disc">
4023: <li>
4024: <p><a xmlns=
4025: "http://www.w3.org/TR/xhtml1/transitional" href=
4026: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.20 ben 4027: class="pkgname">pkgtools/x11-links</a>: symlinks
4028: for use by buildlink</p>
1.1 grant 4029: </li>
4030: </ul>
4031: </div>
4032:
4033: <p>OS tool augmentation (automatically installed when
4034: needed):</p>
4035:
4036: <div class="itemizedlist">
4037: <ul type="disc">
4038: <li>
4039: <p><a xmlns=
4040: "http://www.w3.org/TR/xhtml1/transitional" href=
4041: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20 ben 4042: class="pkgname">pkgtools/digest</a>: calculates
4043: SHA1 checksums (and other kinds)</p>
1.1 grant 4044: </li>
4045:
4046: <li>
4047: <p><a xmlns=
4048: "http://www.w3.org/TR/xhtml1/transitional" href=
4049: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.20 ben 4050: class="pkgname">pkgtools/libnbcompat</a>: compat
4051: library for pkg tools</p>
1.1 grant 4052: </li>
4053:
4054: <li>
4055: <p><a xmlns=
4056: "http://www.w3.org/TR/xhtml1/transitional" href=
4057: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.20 ben 4058: class="pkgname">pkgtools/mtree</a>: installed on
4059: non-BSD systems due to lack of native mtree</p>
1.1 grant 4060: </li>
4061:
4062: <li>
4063: <p><a xmlns=
4064: "http://www.w3.org/TR/xhtml1/transitional" href=
4065: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4066: class="pkgname">pkgtools/pkg_install</a>:
4067: up-to-date replacement for /usr/sbin/pkg_install,
4068: or for use on operating systems where pkg_install
4069: is not present</p>
1.1 grant 4070: </li>
4071: </ul>
4072: </div>
4073:
4074: <p>Utilities used by pkgsrc (not automatically
4075: installed):</p>
4076:
4077: <div class="itemizedlist">
4078: <ul type="disc">
4079: <li>
4080: <p><a xmlns=
4081: "http://www.w3.org/TR/xhtml1/transitional" href=
4082: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.20 ben 4083: class="pkgname">pkgtools/pkg_tarup</a>: create a
4084: binary package from an already-installed package.
4085: used by 'make replace' to save the old package</p>
1.1 grant 4086: </li>
4087:
4088: <li>
4089: <p><a xmlns=
4090: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 4091: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.20 ben 4092: class="pkgname">pkgtools/dfdisk</a>: adds extra
4093: functionality to pkgsrc, allowing it to fetch
4094: distfiles from multiple locations. It currently
4095: supports the following methods: multiple CD-ROMs
4096: and network FTP/HTTP connections.</p>
1.5 hubertf 4097: </li>
4098:
4099: <li>
4100: <p><a xmlns=
4101: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4102: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20 ben 4103: class="pkgname">pkgtools/xpkgwedge</a>: put X11
4104: packages someplace else (enabled by default)</p>
1.1 grant 4105: </li>
1.5 hubertf 4106:
4107: <li>
4108: <p><a xmlns=
4109: "http://www.w3.org/TR/xhtml1/transitional" href=
4110: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20 ben 4111: class="pkgname">devel/cpuflags</a>: will determine
4112: the best compiler flags to optimise code for your
4113: current CPU and compiler.</p>
1.5 hubertf 4114: </li>
1.1 grant 4115: </ul>
4116: </div>
4117:
4118: <p>Utilities for keeping track of installed packages,
4119: being up to date, etc:</p>
4120:
4121: <div class="itemizedlist">
4122: <ul type="disc">
4123: <li>
4124: <p><a xmlns=
4125: "http://www.w3.org/TR/xhtml1/transitional" href=
4126: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.20 ben 4127: class="pkgname">pkgtools/pkg_chk</a>: installs
4128: pkg_chk, which reports on packages whose installed
4129: versions do not match the latest pkgsrc entries</p>
1.1 grant 4130: </li>
4131:
4132: <li>
4133: <p><a xmlns=
4134: "http://www.w3.org/TR/xhtml1/transitional" href=
4135: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.20 ben 4136: class="pkgname">pkgtools/pkgdep</a>: makes
4137: dependency graphs of packages, to aid in choosing a
4138: strategy for updating</p>
1.1 grant 4139: </li>
4140:
4141: <li>
4142: <p><a xmlns=
4143: "http://www.w3.org/TR/xhtml1/transitional" href=
4144: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.20 ben 4145: class="pkgname">pkgtools/pkgdepgraph</a>: make
4146: graph from above (uses graphviz)</p>
1.1 grant 4147: </li>
4148:
4149: <li>
4150: <p><a xmlns=
4151: "http://www.w3.org/TR/xhtml1/transitional" href=
4152: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 4153: class="pkgname">pkgtools/pkglint</a>: This provides
4154: two distinct abilities: check a pkgsrc entry for
4155: correctness (pkglint) check for and remove
4156: out-of-date distfiles and binary packages
4157: (lintpkgsrc)</p>
1.1 grant 4158: </li>
4159:
4160: <li>
4161: <p><a xmlns=
4162: "http://www.w3.org/TR/xhtml1/transitional" href=
4163: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.20 ben 4164: class="pkgname">pkgtools/pkgsurvey</a>: report what
4165: packages you have installed</p>
1.1 grant 4166: </li>
4167: </ul>
4168: </div>
4169:
4170: <p>Utilities for people maintaining or creating
4171: individual packages:</p>
4172:
4173: <div class="itemizedlist">
4174: <ul type="disc">
4175: <li>
4176: <p><a xmlns=
4177: "http://www.w3.org/TR/xhtml1/transitional" href=
4178: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 4179: class="pkgname">pkgtools/pkgdiff</a>: automate
4180: making and maintaining patches for a package
4181: (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1 grant 4182: </li>
4183:
4184: <li>
4185: <p><a xmlns=
4186: "http://www.w3.org/TR/xhtml1/transitional" href=
4187: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.20 ben 4188: class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
4189: "http://www.w3.org/TR/xhtml1/transitional" href=
4190: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
4191: class="pkgname">pkgtools/url2pkg</a>: aids in
4192: converting to pkgsrc</p>
1.1 grant 4193: </li>
4194:
4195: <li>
4196: <p><a xmlns=
4197: "http://www.w3.org/TR/xhtml1/transitional" href=
4198: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.20 ben 4199: class="pkgname">pkgtools/gensolpkg</a>: convert
4200: pkgsrc to a Solaris package</p>
1.1 grant 4201: </li>
4202: </ul>
4203: </div>
4204:
4205: <p>Utilities for people maintaining pkgsrc (or more
4206: obscure pkg utilities)</p>
4207:
4208: <div class="itemizedlist">
4209: <ul type="disc">
4210: <li>
4211: <p><a xmlns=
4212: "http://www.w3.org/TR/xhtml1/transitional" href=
4213: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.20 ben 4214: class="pkgname">pkgtools/pkgconflict</a>: find
4215: packages that conflict but aren't marked as
4216: such</p>
1.1 grant 4217: </li>
4218:
4219: <li>
4220: <p><a xmlns=
4221: "http://www.w3.org/TR/xhtml1/transitional" href=
4222: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.20 ben 4223: class="pkgname">pkgtools/pkg_comp</a>: build
4224: packages in a chrooted area</p>
1.1 grant 4225: </li>
4226:
4227: <li>
4228: <p><a xmlns=
4229: "http://www.w3.org/TR/xhtml1/transitional" href=
4230: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.20 ben 4231: class="pkgname">pkgtools/libkver</a>: spoof kernel
4232: version for chrooted cross builds</p>
1.1 grant 4233: </li>
4234: </ul>
4235: </div>
4236: </div>
4237:
4238: <div class="sect1" lang="en" xml:lang="en">
4239: <div class="titlepage">
4240: <div>
4241: <div>
4242: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 4243: "id2625984" id="id2625984"></a>6.4. How to use
1.1 grant 4244: pkgsrc as non-root</h2>
4245: </div>
4246: </div>
4247: </div>
4248:
4249: <p>If you want to use pkgsrc as non-root user, you can
4250: set some variables to make pkgsrc work under these
4251: conditions. Please see <a href=
4252: "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.20 ben 4253: target="_top">this message</a> for more details.</p>
1.14 xtraeme 4254: </div>
4255:
4256: <div class="sect1" lang="en" xml:lang="en">
4257: <div class="titlepage">
4258: <div>
4259: <div>
4260: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 4261: "id2625995" id="id2625995"></a>6.5. How to
1.15 xtraeme 4262: resume transfers when fetching distfiles?</h2>
1.14 xtraeme 4263: </div>
4264: </div>
4265: </div>
4266:
1.15 xtraeme 4267: <p>By default resuming transfers in pkgsrc is disabled,
4268: but you can enable this feature by adding the option
4269: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
4270: into <code class="filename">/etc/mk.conf</code>. If,
4271: during a fetch step, an incomplete distfile is found,
4272: pkgsrc will try to resume it.</p>
4273:
4274: <p>You can also use a different program than the default
1.24 wiz 4275: <a href=
4276: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
4277: <span class="citerefentry"><span class=
4278: "refentrytitle">ftp</span>(1)</span></a> by changing the
4279: <code class="varname">FETCH_CMD</code> variable. Don't
4280: forget to set <code class=
4281: "varname">FETCH_RESUME_ARGS</code> and <code class=
4282: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
4283: default values.</p>
1.14 xtraeme 4284:
4285: <p>For example, if you want to use <code class=
4286: "filename">wget</code> to resume downloads, you'll have
4287: to use something like:</p>
4288: <pre class="programlisting">
4289: FETCH_CMD=wget
4290: .if defined(FETCH_CMD) && ${FETCH_CMD} == "wget"
4291: FETCH_BEFORE_ARGS=--passive-ftp
4292: FETCH_RESUME_ARGS=-c
4293: FETCH_OUTPUT_ARGS=-O
4294: .endif
4295:
4296: </pre>
1.1 grant 4297: </div>
4298:
4299: <div class="sect1" lang="en" xml:lang="en">
4300: <div class="titlepage">
4301: <div>
4302: <div>
4303: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 4304: "id2626045" id="id2626045"></a>6.6. How can I
1.1 grant 4305: install/use XFree86 from pkgsrc?</h2>
4306: </div>
4307: </div>
4308: </div>
4309:
4310: <p>If you want to use XFree86 from pkgsrc instead of your
1.14 xtraeme 4311: system's own X11 (<code class=
4312: "filename">/usr/X11R6</code>, <code class=
4313: "filename">/usr/openwin</code>, ...), you will have to
4314: add the following line into <code class=
1.15 xtraeme 4315: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4316: <pre class="programlisting">
4317: X11_TYPE=XFree86
4318:
4319: </pre>
4320: </div>
4321:
4322: <div class="sect1" lang="en" xml:lang="en">
4323: <div class="titlepage">
4324: <div>
4325: <div>
4326: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 4327: "id2626073" id="id2626073"></a>6.7. How can I
1.1 grant 4328: install/use X.org from pkgsrc?</h2>
4329: </div>
4330: </div>
4331: </div>
4332:
4333: <p>If you want to use X.org from pkgsrc instead of your
1.14 xtraeme 4334: system's own X11 (<code class=
4335: "filename">/usr/X11R6</code>, <code class=
4336: "filename">/usr/openwin</code>, ...) you will have to add
4337: the following line into <code class=
1.15 xtraeme 4338: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4339: <pre class="programlisting">
4340: X11_TYPE=xorg
4341:
4342: </pre>
4343: </div>
4344:
4345: <div class="sect1" lang="en" xml:lang="en">
4346: <div class="titlepage">
4347: <div>
4348: <div>
4349: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 4350: "id2626101" id="id2626101"></a>6.8. How to
1.1 grant 4351: fetch files from behind a firewall</h2>
4352: </div>
4353: </div>
4354: </div>
4355:
4356: <p>If you are sitting behind a firewall which does not
4357: allow direct connections to Internet hosts (i.e.
4358: non-NAT), you may specify the relevant proxy hosts. This
4359: is done using an environment variable in the form of a
4360: URL e.g. in Amdahl, the machine “<span class=
4361: "quote">orpheus.amdahl.com</span>” is one of the
4362: firewalls, and it uses port 80 as the proxy port number.
4363: So the proxy environment variables are:</p>
4364: <pre class="programlisting">
4365: ftp_proxy=ftp://orpheus.amdahl.com:80/
4366: http_proxy=http://orpheus.amdahl.com:80/
4367: </pre>
4368: </div>
4369:
4370: <div class="sect1" lang="en" xml:lang="en">
4371: <div class="titlepage">
4372: <div>
4373: <div>
4374: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 4375: "id2626115" id="id2626115"></a>6.9. How do I
1.14 xtraeme 4376: tell <span><strong class="command">make
4377: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 4378: </div>
4379: </div>
4380: </div>
4381:
4382: <p>This depends on which utility is used to retrieve
1.14 xtraeme 4383: distfiles. From <code class="filename">bsd.pkg.mk</code>,
4384: <code class="varname">FETCH_CMD</code> is assigned the
4385: first available command from the following list:</p>
1.1 grant 4386: <pre class="programlisting">
4387: ${LOCALBASE}/bin/ftp
4388: /usr/bin/ftp
4389: </pre>
4390:
4391: <p>On a default NetBSD installation, this will be
1.14 xtraeme 4392: <code class="filename">/usr/bin/ftp</code>, which
1.1 grant 4393: automatically tries passive connections first, and falls
4394: back to active connections if the server refuses to do
4395: passive. For the other tools, add the following to your
1.14 xtraeme 4396: <code class="filename">/etc/mk.conf</code> file:
4397: <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 4398:
1.14 xtraeme 4399: <p>Having that option present will prevent <code class=
4400: "filename">/usr/bin/ftp</code> from falling back to
4401: active transfers.</p>
1.1 grant 4402: </div>
4403:
4404: <div class="sect1" lang="en" xml:lang="en">
4405: <div class="titlepage">
4406: <div>
4407: <div>
4408: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 4409: "id2626166" id="id2626166"></a>6.10. How to
1.1 grant 4410: fetch all distfiles at once</h2>
4411: </div>
4412: </div>
4413: </div>
4414:
4415: <p>You would like to download all the distfiles in a
4416: single batch from work or university, where you can't run
1.14 xtraeme 4417: a <span><strong class="command">make
4418: fetch</strong></span>. There is an archive of distfiles
4419: on <a href=
1.1 grant 4420: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
4421: target="_top">ftp.NetBSD.org</a>, but downloading the
4422: entire directory may not be appropriate.</p>
4423:
1.14 xtraeme 4424: <p>The answer here is to do a <span><strong class=
4425: "command">make fetch-list</strong></span> in <code class=
4426: "filename">/usr/pkgsrc</code> or one of it's
1.1 grant 4427: subdirectories, carry the resulting list to your machine
1.23 wiz 4428: at work/school and use it there. If you don't have a
1.24 wiz 4429: NetBSD-compatible <a href=
4430: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
4431: <span class="citerefentry"><span class=
4432: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
4433: at work, don't forget to set <code class=
4434: "varname">FETCH_CMD</code> to something that fetches a
4435: URL:</p>
1.1 grant 4436:
4437: <p>At home:</p>
4438: <pre class="screen">
1.14 xtraeme 4439: <code class="prompt">%</code> <strong class=
4440: "userinput"><code>cd /usr/pkgsrc</code></strong>
4441: <code class="prompt">%</code> <strong class=
4442: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
4443: <code class="prompt">%</code> <strong class=
4444: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 4445: </pre>
4446:
4447: <p>At work:</p>
4448: <pre class="screen">
1.14 xtraeme 4449: <code class="prompt">%</code> <strong class=
4450: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 4451: </pre>
4452:
1.14 xtraeme 4453: <p>then tar up <code class=
4454: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 4455:
4456: <p>If you have a machine running NetBSD, and you want to
4457: get <span class="emphasis"><em>all</em></span> distfiles
4458: (even ones that aren't for your machine architecture),
4459: you can do so by using the above-mentioned
1.14 xtraeme 4460: <span><strong class="command">make
4461: fetch-list</strong></span> approach, or fetch the
4462: distfiles directly by running:</p>
1.1 grant 4463: <pre class="screen">
1.14 xtraeme 4464: <code class="prompt">%</code> <strong class=
4465: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 4466: </pre>
4467:
1.14 xtraeme 4468: <p>If you even decide to ignore <code class=
4469: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
4470: can get everything by running:</p>
1.1 grant 4471: <pre class="screen">
1.14 xtraeme 4472: <code class="prompt">%</code> <strong class=
4473: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 4474: </pre>
4475: </div>
4476:
4477: <div class="sect1" lang="en" xml:lang="en">
4478: <div class="titlepage">
4479: <div>
4480: <div>
4481: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 4482: "id2626313" id="id2626313"></a>6.11. What does
1.1 grant 4483: “<span class="quote">Don't know how to make
4484: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
4485: </div>
4486: </div>
4487: </div>
4488:
4489: <p>When compiling the <a xmlns=
4490: "http://www.w3.org/TR/xhtml1/transitional" href=
4491: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4492: class="pkgname">pkgtools/pkg_install</a> package, you get
4493: the error from make that it doesn't know how to make
4494: <code class="filename">/usr/share/tmac/tmac.andoc</code>?
4495: This indicates that you don't have installed the
1.23 wiz 4496: “<span class="quote">text</span>” set (nroff,
4497: ...) from the NetBSD base distribution on your machine.
4498: It is recommended to do that to format manpages.</p>
1.1 grant 4499:
4500: <p>In the case of the <a xmlns=
4501: "http://www.w3.org/TR/xhtml1/transitional" href=
4502: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4503: class="pkgname">pkgtools/pkg_install</a> package, you can
4504: get away with setting <code class=
4505: "varname">NOMAN=YES</code> either in the environment or
4506: in <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 4507: </div>
4508:
4509: <div class="sect1" lang="en" xml:lang="en">
4510: <div class="titlepage">
4511: <div>
4512: <div>
4513: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 4514: "id2626352" id="id2626352"></a>6.12. What does
1.1 grant 4515: “<span class="quote">Could not find
4516: bsd.own.mk</span>” mean?</h2>
4517: </div>
4518: </div>
4519: </div>
4520:
1.14 xtraeme 4521: <p>You didn't install the compiler set, <code class=
4522: "filename">comp.tgz</code>, when you installed your
4523: NetBSD machine. Please get it and install it, by
4524: extracting it in <code class="filename">/</code>:</p>
1.1 grant 4525: <pre class="screen">
1.14 xtraeme 4526: <code class="prompt">#</code> <strong class=
4527: "userinput"><code>cd /</code></strong>
4528: <code class="prompt">#</code> <strong class=
4529: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 4530: </pre>
4531:
1.14 xtraeme 4532: <p><code class="filename">comp.tgz</code> is part of
4533: every NetBSD release. Get the one that corresponds to
4534: your release (determine via <span><strong class=
4535: "command">uname -r</strong></span>).</p>
1.1 grant 4536: </div>
4537:
4538: <div class="sect1" lang="en" xml:lang="en">
4539: <div class="titlepage">
4540: <div>
4541: <div>
4542: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 4543: "id2626409" id="id2626409"></a>6.13. Using
1.1 grant 4544: 'sudo' with pkgsrc</h2>
4545: </div>
4546: </div>
4547: </div>
4548:
4549: <p>When installing packages as non-root user and using
1.24 wiz 4550: the just-in-time <a href=
4551: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
4552: <span class="citerefentry"><span class=
4553: "refentrytitle">su</span>(1)</span></a> feature of
4554: pkgsrc, it can become annoying to type in the root
4555: password for each required package installed. To avoid
4556: this, the sudo package can be used, which does password
4557: caching over a limited time. To use it, install sudo
4558: (either as binary package or from <a xmlns=
4559: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4560: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.20 ben 4561: class="pkgname">security/sudo</a>) and then put the
4562: following into your <code class=
4563: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4564: <pre class="programlisting">
1.23 wiz 4565: .if exists(${LOCALBASE}/bin/sudo)
4566: SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
1.1 grant 4567: .endif
4568:
4569: </pre>
4570: </div>
4571:
4572: <div class="sect1" lang="en" xml:lang="en">
4573: <div class="titlepage">
4574: <div>
4575: <div>
4576: <h2 class="title" style="clear: both"><a name=
4577: "faq.conf" id=
1.14 xtraeme 4578: "faq.conf"></a>6.14. Configuration files
1.1 grant 4579: handling and placement</h2>
4580: </div>
4581: </div>
4582: </div>
4583:
1.14 xtraeme 4584: <p>The global variable <code class=
4585: "varname">PKG_SYSCONFBASE</code> (and some others) can be
4586: set by the system administrator in <code class=
4587: "filename">/etc/mk.conf</code> to define the place where
1.1 grant 4588: configuration files get installed. Therefore, packages
4589: must be adapted to support this feature. Keep in mind
4590: that you should only install files that are strictly
4591: necessary in the configuration directory, files that can
1.14 xtraeme 4592: go to <code class="filename">$PREFIX/share</code> should
4593: go there.</p>
1.1 grant 4594:
4595: <p>We will take a look at available variables first
1.14 xtraeme 4596: (<code class="filename">bsd.pkg.mk</code> contains more
4597: information). <code class="varname">PKG_SYSCONFDIR</code>
4598: is where the configuration files for a package may be
4599: found (that is, the full path, e.g. <code class=
4600: "filename">/etc</code> or <code class=
4601: "filename">/usr/pkg/etc</code>). This value may be
1.1 grant 4602: customized in various ways:</p>
4603:
4604: <div class="orderedlist">
4605: <ol type="1">
4606: <li>
1.14 xtraeme 4607: <p><code class="varname">PKG_SYSCONFBASE</code> is
4608: the main config directory under which all package
1.1 grant 4609: configuration files are to be found. Users will
1.14 xtraeme 4610: typically want to set it to <code class=
4611: "filename">/etc</code>, or accept the default
4612: location of <code class=
4613: "filename">$PREFIX/etc</code>.</p>
1.1 grant 4614: </li>
4615:
4616: <li>
1.14 xtraeme 4617: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
4618: is the subdirectory of <code class=
4619: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 4620: configuration files for a particular package may be
1.14 xtraeme 4621: found. Defaults to <code class=
4622: "varname">${SYSCONFBASE}</code>.</p>
1.1 grant 4623: </li>
4624:
4625: <li>
1.14 xtraeme 4626: <p><code class="varname">PKG_SYSCONFVAR</code> is
4627: the special suffix used to distinguish any
4628: overriding values for a particular package (see
4629: next item). It defaults to <code class=
4630: "varname">${PKGBASE}</code>, but for a collection
4631: of related packages that should all have the same
4632: <code class="varname">PKG_SYSCONFDIR</code> value,
4633: it can be set in each of the package Makefiles to a
4634: common value.</p>
1.1 grant 4635: </li>
4636:
4637: <li>
1.14 xtraeme 4638: <p><code class=
4639: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
4640: overrides the value of <code class=
4641: "varname">${PKG_SYSCONFDIR}</code> for packages
4642: with the same value for <code class=
4643: "varname">PKG_SYSCONFVAR</code>.</p>
1.1 grant 4644:
4645: <p>As an example, all the various KDE packages may
1.14 xtraeme 4646: want to set <code class=
4647: "varname">PKG_SYSCONFVAR</code> to
4648: “<span class="quote">kde</span>” so
4649: admins can set <code class=
4650: "varname">PKG_SYSCONFDIR.kde</code> in <code class=
4651: "filename">/etc/mk.conf</code> to define where to
1.1 grant 4652: install KDE config files.</p>
4653: </li>
4654: </ol>
4655: </div>
4656:
4657: <p>Programs' configuration directory should be defined
4658: during the configure stage. Packages that use GNU
4659: autoconf can usually do this by using the
4660: “<span class="quote">--sysconfdir</span>”
4661: parameter, but this brings some problems as we will see
4662: now. When you change this pathname in packages, you
4663: should not allow them to install files in that directory
4664: directly. Instead they need to install those files under
1.14 xtraeme 4665: <code class="filename">share/examples/${PKGNAME}</code>
4666: so <code class="filename">PLIST</code> can register
4667: them.</p>
1.1 grant 4668:
4669: <p>Once you have the required configuration files in
1.14 xtraeme 4670: place (under the <code class=
4671: "filename">share/examples</code> directory) the variable
4672: <code class="varname">CONF_FILES</code> should be set to
4673: copy them into <code class=
4674: "varname">PKG_SYSCONFDIR</code>. The contents of this
4675: variable is formed by pairs of filenames; the first
1.1 grant 4676: element of the pair specifies the file inside the
1.14 xtraeme 4677: examples directory (registered by <code class=
4678: "filename">PLIST</code>) and the second element specifies
1.1 grant 4679: the target file. This is done this way to allow binary
4680: packages to place files in the right directory using
1.14 xtraeme 4681: <code class="filename">INSTALL</code>/<code class=
4682: "filename">DEINSTALL</code> scripts which are created
4683: automatically. The package <code class=
4684: "filename">Makefile</code> must also set <code class=
4685: "varname">USE_PKGINSTALL=YES</code> to use these
1.1 grant 4686: automatically generated scripts. The automatic copying of
4687: config files can be toggled by setting the environment
1.14 xtraeme 4688: variable <code class="varname">PKG_CONFIG</code> prior to
1.1 grant 4689: package installation.</p>
4690:
4691: <p>Here is an example, taken from mail/mutt/Makefile:</p>
4692: <pre class="programlisting">
4693: EGDIR= ${PREFIX}/share/doc/mutt/samples
4694: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
4695: </pre>
4696:
4697: <p>As you can see, this package installs configuration
1.14 xtraeme 4698: files inside <code class="varname">EGDIR</code>, which
4699: are registered by <code class="filename">PLIST</code>.
4700: After that, the variable <code class=
4701: "varname">CONF_FILES</code> lists the installed file
4702: first and then the target file. Users will also get an
4703: automatic message when files are installed using this
4704: method.</p>
1.1 grant 4705: </div>
4706:
4707: <div class="sect1" lang="en" xml:lang="en">
4708: <div class="titlepage">
4709: <div>
4710: <div>
4711: <h2 class="title" style="clear: both"><a name=
4712: "audit-packages" id=
1.14 xtraeme 4713: "audit-packages"></a>6.15. Automated security
1.1 grant 4714: checks</h2>
4715: </div>
4716: </div>
4717: </div>
4718:
4719: <p>Please be aware that there can often be bugs in
4720: third-party software, and some of these bugs can leave a
4721: machine vulnerable to exploitation by attackers. In an
4722: effort to lessen the exposure, the NetBSD packages team
4723: maintains a database of known-exploits to packages which
4724: have at one time been included in pkgsrc. The database
4725: can be downloaded automatically, and a security audit of
4726: all packages installed on a system can take place. To do
4727: this, install the <a xmlns=
4728: "http://www.w3.org/TR/xhtml1/transitional" href=
4729: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.20 ben 4730: class="pkgname">security/audit-packages</a> package. It
4731: has two components:</p>
1.1 grant 4732:
4733: <div class="orderedlist">
4734: <ol type="1">
4735: <li>
4736: <p>“<span class=
4737: "quote">download-vulnerability-list</span>”,
4738: an easy way to download a list of the security
4739: vulnerabilities information. This list is kept up
4740: to date by the NetBSD security officer and the
4741: NetBSD packages team, and is distributed from the
4742: NetBSD ftp server:</p>
4743:
4744: <p><a href=
4745: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 4746: target=
4747: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 4748: </li>
4749:
4750: <li>
4751: <p>“<span class=
4752: "quote">audit-packages</span>”, an easy way
4753: to audit the current machine, checking each
4754: vulnerability which is known. If a vulnerable
4755: package is installed, it will be shown by output to
4756: stdout, including a description of the type of
4757: vulnerability, and a URL containing more
4758: information.</p>
4759: </li>
4760: </ol>
4761: </div>
4762:
1.23 wiz 4763: <p>Use of the <a xmlns=
4764: "http://www.w3.org/TR/xhtml1/transitional" href=
4765: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
4766: class="pkgname">security/audit-packages</a> package is
4767: strongly recommended! After “<span class=
4768: "quote">audit-packages</span>” is installed, please
4769: read the package's message, which you can get by running
4770: <strong class="userinput"><code>pkg_info -D
4771: audit-package</code></strong>.</p>
1.1 grant 4772: </div>
4773: </div>
4774: </div>
4775:
4776: <div class="part" lang="en" xml:lang="en">
4777: <div class="titlepage">
4778: <div>
4779: <div>
4780: <h1 class="title"><a name="developers-guide" id=
1.2 hubertf 4781: "developers-guide"></a>The pkgsrc developer's
4782: guide</h1>
1.1 grant 4783: </div>
4784: </div>
4785: </div>
4786:
4787: <div class="toc">
4788: <p><b>Table of Contents</b></p>
4789:
4790: <dl>
1.25 rillig 4791: <dt><span class="chapter"><a href="#makefile">7.
4792: Programming in <code class=
4793: "filename">Makefile</code>s</a></span></dt>
4794:
4795: <dd>
4796: <dl>
4797: <dt><span class="sect1"><a href=
4798: "#makefile.variables">7.1. <code class=
4799: "filename">Makefile</code> variables</a></span></dt>
4800:
4801: <dt><span class="sect1"><a href="#makefile.code">7.2.
4802: Code snippets</a></span></dt>
4803:
4804: <dd>
4805: <dl>
4806: <dt><span class="sect2"><a href=
1.26 ! wiz 4807: "#id2627035">7.2.1. Adding things to a
1.25 rillig 4808: list</a></span></dt>
4809:
4810: <dt><span class="sect2"><a href=
1.26 ! wiz 4811: "#id2627113">7.2.2. Converting an internal list
1.25 rillig 4812: into an external list</a></span></dt>
4813:
4814: <dt><span class="sect2"><a href=
1.26 ! wiz 4815: "#id2627131">7.2.3. Passing variables to a shell
1.25 rillig 4816: command</a></span></dt>
4817: </dl>
4818: </dd>
4819: </dl>
4820: </dd>
4821:
4822: <dt><span class="chapter"><a href="#components">8.
1.1 grant 4823: Package components - files, directories and
4824: contents</a></span></dt>
4825:
4826: <dd>
4827: <dl>
4828: <dt><span class="sect1"><a href=
1.25 rillig 4829: "#components.Makefile">8.1. <code class=
1.14 xtraeme 4830: "filename">Makefile</code></a></span></dt>
1.1 grant 4831:
4832: <dt><span class="sect1"><a href=
1.25 rillig 4833: "#components.distinfo">8.2. <code class=
1.14 xtraeme 4834: "filename">distinfo</code></a></span></dt>
1.1 grant 4835:
4836: <dt><span class="sect1"><a href=
1.25 rillig 4837: "#components.patches">8.3. patches/*</a></span></dt>
1.1 grant 4838:
1.26 ! wiz 4839: <dt><span class="sect1"><a href="#id2627827">8.4.
1.1 grant 4840: Other mandatory files</a></span></dt>
4841:
4842: <dt><span class="sect1"><a href=
1.25 rillig 4843: "#components.optional">8.5. Optional
1.1 grant 4844: files</a></span></dt>
4845:
1.26 ! wiz 4846: <dt><span class="sect1"><a href="#id2628089">8.6.
1.14 xtraeme 4847: <code class="filename">work*</code></a></span></dt>
1.1 grant 4848:
1.26 ! wiz 4849: <dt><span class="sect1"><a href="#id2628177">8.7.
1.14 xtraeme 4850: <code class="filename">files/*</code></a></span></dt>
1.1 grant 4851: </dl>
4852: </dd>
4853:
1.25 rillig 4854: <dt><span class="chapter"><a href="#plist">9. PLIST
1.1 grant 4855: issues</a></span></dt>
4856:
4857: <dd>
4858: <dl>
1.26 ! wiz 4859: <dt><span class="sect1"><a href="#id2628231">9.1. RCS
1.1 grant 4860: ID</a></span></dt>
4861:
1.26 ! wiz 4862: <dt><span class="sect1"><a href="#id2628246">9.2.
1.14 xtraeme 4863: Semi-automatic <code class="filename">PLIST</code>
4864: generation</a></span></dt>
1.1 grant 4865:
1.25 rillig 4866: <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14 xtraeme 4867: Tweaking output of <span><strong class="command">make
4868: print-PLIST</strong></span></a></span></dt>
1.1 grant 4869:
1.25 rillig 4870: <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1 grant 4871: Variable substitution in PLIST</a></span></dt>
4872:
1.26 ! wiz 4873: <dt><span class="sect1"><a href="#id2628499">9.5.
1.1 grant 4874: Manpage-compression</a></span></dt>
4875:
1.26 ! wiz 4876: <dt><span class="sect1"><a href="#id2628609">9.6.
1.14 xtraeme 4877: Changing PLIST source with <code class=
4878: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 4879:
1.26 ! wiz 4880: <dt><span class="sect1"><a href="#id2628633">9.7.
1.1 grant 4881: Platform specific and differing
4882: PLISTs</a></span></dt>
4883:
4884: <dt><span class="sect1"><a href=
1.25 rillig 4885: "#faq.common-dirs">9.8. Sharing directories between
1.1 grant 4886: packages</a></span></dt>
4887: </dl>
4888: </dd>
4889:
1.25 rillig 4890: <dt><span class="chapter"><a href="#buildlink">10.
1.1 grant 4891: Buildlink methodology</a></span></dt>
4892:
4893: <dd>
4894: <dl>
1.26 ! wiz 4895: <dt><span class="sect1"><a href="#id2628968">10.1.
1.1 grant 4896: Converting packages to use buildlink3</a></span></dt>
4897:
1.26 ! wiz 4898: <dt><span class="sect1"><a href="#id2629149">10.2.
1.14 xtraeme 4899: Writing <code class="filename">buildlink3.mk</code>
4900: files</a></span></dt>
1.1 grant 4901:
4902: <dd>
4903: <dl>
4904: <dt><span class="sect2"><a href=
1.26 ! wiz 4905: "#id2629219">10.2.1. Anatomy of a buildlink3.mk
1.1 grant 4906: file</a></span></dt>
4907:
4908: <dt><span class="sect2"><a href=
1.26 ! wiz 4909: "#id2629796">10.2.2. Updating <code class=
1.14 xtraeme 4910: "varname">BUILDLINK_DEPENDS.<em class=
4911: "replaceable"><code>pkg</code></em></code> in
4912: <code class="filename">buildlink3.mk</code>
1.1 grant 4913: files</a></span></dt>
4914: </dl>
4915: </dd>
4916:
1.26 ! wiz 4917: <dt><span class="sect1"><a href="#id2629943">10.3.
1.14 xtraeme 4918: Writing <code class="filename">builtin.mk</code>
4919: files</a></span></dt>
1.1 grant 4920:
4921: <dd>
4922: <dl>
4923: <dt><span class="sect2"><a href=
1.26 ! wiz 4924: "#id2630024">10.3.1. Anatomy of a <code class=
1.14 xtraeme 4925: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 4926:
4927: <dt><span class="sect2"><a href=
1.26 ! wiz 4928: "#id2630183">10.3.2. Global preferences for
1.25 rillig 4929: native or pkgsrc software</a></span></dt>
1.1 grant 4930: </dl>
4931: </dd>
4932: </dl>
4933: </dd>
4934:
1.25 rillig 4935: <dt><span class="chapter"><a href="#options">11. Options
1.1 grant 4936: handling</a></span></dt>
4937:
4938: <dd>
4939: <dl>
1.26 ! wiz 4940: <dt><span class="sect1"><a href="#id2630256">11.1.
1.1 grant 4941: Global default options</a></span></dt>
4942:
1.26 ! wiz 4943: <dt><span class="sect1"><a href="#id2630270">11.2.
1.14 xtraeme 4944: Converting packages to use <code class=
4945: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 4946: </dl>
4947: </dd>
4948:
1.25 rillig 4949: <dt><span class="chapter"><a href="#build">12. The build
1.1 grant 4950: process</a></span></dt>
4951:
4952: <dd>
4953: <dl>
1.25 rillig 4954: <dt><span class="sect1"><a href="#build.prefix">12.1.
1.1 grant 4955: Program location</a></span></dt>
4956:
1.26 ! wiz 4957: <dt><span class="sect1"><a href="#id2631098">12.2.
1.1 grant 4958: Main targets</a></span></dt>
4959:
4960: <dt><span class="sect1"><a href=
1.25 rillig 4961: "#build.helpful-targets">12.3. Other helpful
1.1 grant 4962: targets</a></span></dt>
4963: </dl>
4964: </dd>
4965:
1.25 rillig 4966: <dt><span class="chapter"><a href="#fixes">13. Notes on
1.1 grant 4967: fixes for packages</a></span></dt>
4968:
4969: <dd>
4970: <dl>
1.26 ! wiz 4971: <dt><span class="sect1"><a href="#id2632458">13.1.
1.1 grant 4972: General operation</a></span></dt>
4973:
4974: <dd>
4975: <dl>
4976: <dt><span class="sect2"><a href=
1.26 ! wiz 4977: "#id2632461">13.1.1. How to pull in variables
1.1 grant 4978: from /etc/mk.conf</a></span></dt>
4979:
4980: <dt><span class="sect2"><a href=
1.26 ! wiz 4981: "#id2632545">13.1.2. Restricted
1.1 grant 4982: packages</a></span></dt>
4983:
4984: <dt><span class="sect2"><a href=
1.25 rillig 4985: "#dependencies">13.1.3. Handling
1.1 grant 4986: dependencies</a></span></dt>
4987:
4988: <dt><span class="sect2"><a href=
1.26 ! wiz 4989: "#id2633066">13.1.4. Handling conflicts with
1.1 grant 4990: other packages</a></span></dt>
4991:
4992: <dt><span class="sect2"><a href=
1.26 ! wiz 4993: "#id2633116">13.1.5. Packages that cannot or
1.1 grant 4994: should not be built</a></span></dt>
4995:
4996: <dt><span class="sect2"><a href=
1.26 ! wiz 4997: "#id2633142">13.1.6. Packages which should not be
1.1 grant 4998: deleted, once installed</a></span></dt>
4999:
5000: <dt><span class="sect2"><a href=
1.25 rillig 5001: "#security-handling">13.1.7. Handling packages
1.1 grant 5002: with security problems</a></span></dt>
5003:
5004: <dt><span class="sect2"><a href=
1.26 ! wiz 5005: "#id2633234">13.1.8. How to handle compiler
1.1 grant 5006: bugs</a></span></dt>
5007:
5008: <dt><span class="sect2"><a href=
1.26 ! wiz 5009: "#id2633324">13.1.9. How to handle incrementing
1.1 grant 5010: versions when fixing an existing
5011: package</a></span></dt>
5012:
5013: <dt><span class="sect2"><a href=
1.26 ! wiz 5014: "#id2633373">13.1.10. Portability of
1.1 grant 5015: packages</a></span></dt>
5016: </dl>
5017: </dd>
5018:
1.26 ! wiz 5019: <dt><span class="sect1"><a href="#id2633398">13.2.
1.1 grant 5020: Possible downloading issues</a></span></dt>
5021:
5022: <dd>
5023: <dl>
5024: <dt><span class="sect2"><a href=
1.26 ! wiz 5025: "#id2633401">13.2.1. Packages whose distfiles
1.1 grant 5026: aren't available for plain
5027: downloading</a></span></dt>
5028:
5029: <dt><span class="sect2"><a href=
1.26 ! wiz 5030: "#id2633601">13.2.2. How to handle modified
1.1 grant 5031: distfiles with the 'old' name</a></span></dt>
5032: </dl>
5033: </dd>
5034:
1.26 ! wiz 5035: <dt><span class="sect1"><a href="#id2633612">13.3.
1.1 grant 5036: Configuration gotchas</a></span></dt>
5037:
5038: <dd>
5039: <dl>
5040: <dt><span class="sect2"><a href=
1.25 rillig 5041: "#fixes.libtool">13.3.1. Shared libraries -
1.1 grant 5042: libtool</a></span></dt>
5043:
5044: <dt><span class="sect2"><a href=
1.26 ! wiz 5045: "#id2633978">13.3.2. Using libtool on GNU
1.1 grant 5046: packages that already support
5047: libtool</a></span></dt>
5048:
5049: <dt><span class="sect2"><a href=
1.26 ! wiz 5050: "#id2634059">13.3.3. GNU
1.1 grant 5051: Autoconf/Automake</a></span></dt>
5052: </dl>
5053: </dd>
5054:
1.26 ! wiz 5055: <dt><span class="sect1"><a href="#id2634104">13.4.
1.1 grant 5056: Building considerations</a></span></dt>
5057:
5058: <dd>
5059: <dl>
5060: <dt><span class="sect2"><a href=
1.26 ! wiz 5061: "#id2634107">13.4.1. CPP defines</a></span></dt>
1.1 grant 5062: </dl>
5063: </dd>
5064:
1.26 ! wiz 5065: <dt><span class="sect1"><a href="#id2634137">13.5.
1.1 grant 5066: Package specific actions</a></span></dt>
5067:
5068: <dd>
5069: <dl>
5070: <dt><span class="sect2"><a href=
1.26 ! wiz 5071: "#id2634140">13.5.1. Package configuration
1.1 grant 5072: files</a></span></dt>
5073:
5074: <dt><span class="sect2"><a href=
1.26 ! wiz 5075: "#id2634311">13.5.2. User
1.2 hubertf 5076: interaction</a></span></dt>
1.1 grant 5077:
5078: <dt><span class="sect2"><a href=
1.26 ! wiz 5079: "#id2634492">13.5.3. Handling
1.1 grant 5080: licenses</a></span></dt>
5081:
5082: <dt><span class="sect2"><a href=
1.26 ! wiz 5083: "#id2634644">13.5.4. Creating an account from a
1.1 grant 5084: package</a></span></dt>
5085:
5086: <dt><span class="sect2"><a href=
1.26 ! wiz 5087: "#id2634706">13.5.5. Installing score
1.1 grant 5088: files</a></span></dt>
5089:
5090: <dt><span class="sect2"><a href=
1.26 ! wiz 5091: "#id2634749">13.5.6. Packages providing login
1.1 grant 5092: shells</a></span></dt>
5093:
5094: <dt><span class="sect2"><a href=
1.26 ! wiz 5095: "#id2634807">13.5.7. Packages containing perl
1.1 grant 5096: scripts</a></span></dt>
5097:
5098: <dt><span class="sect2"><a href=
1.26 ! wiz 5099: "#id2634825">13.5.8. Packages with hardcoded
1.1 grant 5100: paths to other interpreters</a></span></dt>
5101:
5102: <dt><span class="sect2"><a href=
1.26 ! wiz 5103: "#id2634846">13.5.9. Packages installing perl
1.1 grant 5104: modules</a></span></dt>
5105:
5106: <dt><span class="sect2"><a href=
1.25 rillig 5107: "#faq.info-files">13.5.10. Packages installing
1.1 grant 5108: info files</a></span></dt>
5109:
5110: <dt><span class="sect2"><a href=
1.26 ! wiz 5111: "#id2635134">13.5.11. Packages installing GConf2
1.1 grant 5112: data files</a></span></dt>
5113:
5114: <dt><span class="sect2"><a href=
1.26 ! wiz 5115: "#id2635303">13.5.12. Packages installing
1.1 grant 5116: scrollkeeper data files</a></span></dt>
5117:
5118: <dt><span class="sect2"><a href=
1.26 ! wiz 5119: "#id2635354">13.5.13. Packages installing X11
1.1 grant 5120: fonts</a></span></dt>
5121:
5122: <dt><span class="sect2"><a href=
1.26 ! wiz 5123: "#id2635469">13.5.14. Packages installing GTK2
1.1 grant 5124: modules</a></span></dt>
5125:
5126: <dt><span class="sect2"><a href=
1.26 ! wiz 5127: "#id2635539">13.5.15. Packages installing SGML or
1.1 grant 5128: XML data</a></span></dt>
5129:
5130: <dt><span class="sect2"><a href=
1.26 ! wiz 5131: "#id2635659">13.5.16. Packages installing
1.1 grant 5132: extensions to the MIME database</a></span></dt>
5133:
5134: <dt><span class="sect2"><a href=
1.26 ! wiz 5135: "#id2635730">13.5.17. Packages using
1.1 grant 5136: intltool</a></span></dt>
1.18 xtraeme 5137:
5138: <dt><span class="sect2"><a href=
1.26 ! wiz 5139: "#id2635744">13.5.18. Packages installing startup
1.18 xtraeme 5140: scripts</a></span></dt>
1.1 grant 5141: </dl>
5142: </dd>
5143:
1.26 ! wiz 5144: <dt><span class="sect1"><a href="#id2635765">13.6.
1.1 grant 5145: Feedback to the author</a></span></dt>
5146: </dl>
5147: </dd>
5148:
1.25 rillig 5149: <dt><span class="chapter"><a href="#debug">14.
1.1 grant 5150: Debugging</a></span></dt>
5151:
1.25 rillig 5152: <dt><span class="chapter"><a href="#submit">15.
1.1 grant 5153: Submitting and Committing</a></span></dt>
5154:
5155: <dd>
5156: <dl>
1.26 ! wiz 5157: <dt><span class="sect1"><a href="#id2636227">15.1.
1.1 grant 5158: Submitting your packages</a></span></dt>
5159:
1.26 ! wiz 5160: <dt><span class="sect1"><a href="#id2636284">15.2.
1.1 grant 5161: Committing: Importing a package into
5162: CVS</a></span></dt>
5163:
1.26 ! wiz 5164: <dt><span class="sect1"><a href="#id2636484">15.3.
1.2 hubertf 5165: Updating a package to a newer version</a></span></dt>
1.1 grant 5166:
1.26 ! wiz 5167: <dt><span class="sect1"><a href="#id2636503">15.4.
1.2 hubertf 5168: Moving a package in pkgsrc</a></span></dt>
1.1 grant 5169: </dl>
5170: </dd>
5171: </dl>
5172: </div>
5173:
5174: <div class="chapter" lang="en" xml:lang="en">
5175: <div class="titlepage">
5176: <div>
5177: <div>
1.25 rillig 5178: <h2 class="title"><a name="makefile" id=
5179: "makefile"></a>Chapter 7. Programming in
5180: <code class="filename">Makefile</code>s</h2>
5181: </div>
5182: </div>
5183: </div>
5184:
5185: <div class="toc">
5186: <p><b>Table of Contents</b></p>
5187:
5188: <dl>
5189: <dt><span class="sect1"><a href=
5190: "#makefile.variables">7.1. <code class=
5191: "filename">Makefile</code> variables</a></span></dt>
5192:
5193: <dt><span class="sect1"><a href="#makefile.code">7.2.
5194: Code snippets</a></span></dt>
5195:
5196: <dd>
5197: <dl>
1.26 ! wiz 5198: <dt><span class="sect2"><a href="#id2627035">7.2.1.
1.25 rillig 5199: Adding things to a list</a></span></dt>
5200:
1.26 ! wiz 5201: <dt><span class="sect2"><a href="#id2627113">7.2.2.
1.25 rillig 5202: Converting an internal list into an external
5203: list</a></span></dt>
5204:
1.26 ! wiz 5205: <dt><span class="sect2"><a href="#id2627131">7.2.3.
1.25 rillig 5206: Passing variables to a shell
5207: command</a></span></dt>
5208: </dl>
5209: </dd>
5210: </dl>
5211: </div>
5212:
5213: <p>WARNING: The <a href=
5214: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
5215: <span class="citerefentry"><span class=
5216: "refentrytitle">make</span>(1)</span></a> man page is
5217: wrong. After the man page has been corrected, this chapter
5218: will be updated. Until that, don't take it too serious.</p>
5219:
5220: <p>Pkgsrc consists of many <code class=
5221: "filename">Makefile</code> fragments, each of which forms a
5222: well-defined part of the pkgsrc system. Using the <a href=
5223: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
5224: <span class="citerefentry"><span class=
5225: "refentrytitle">make</span>(1)</span></a> system as a
5226: programming language for a big system like pkgsrc requires
5227: some discipline to keep the code correct and
5228: understandable.</p>
5229:
5230: <p>The basic ingredients for <code class=
5231: "filename">Makefile</code> programming are variables (which
5232: are actually macros) and shell commands. Among these shell
5233: commands may even be more complex ones like <a href=
5234: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
5235: <span class="citerefentry"><span class=
5236: "refentrytitle">awk</span>(1)</span></a> programs. To make
5237: sure that every shell command runs as intended it is
5238: necessary to quote all variables correctly when they are
5239: used.</p>
5240:
5241: <p>This chapter describes some patterns, that appear quite
5242: often in <code class="filename">Makefile</code>s, including
5243: the pitfalls that come along with them.</p>
5244:
5245: <div class="sect1" lang="en" xml:lang="en">
5246: <div class="titlepage">
5247: <div>
5248: <div>
5249: <h2 class="title" style="clear: both"><a name=
5250: "makefile.variables" id=
5251: "makefile.variables"></a>7.1. <code class=
5252: "filename">Makefile</code> variables</h2>
5253: </div>
5254: </div>
5255: </div>
5256:
5257: <p>A restriction common to all types of variables is that
5258: they can neither contain a newline character nor the '\0'
5259: character nor the '#' character. The effects of the
1.26 ! wiz 5260: backslash character are not documented, so you should not
1.25 rillig 5261: use it at the moment. As the $ is used to get values of a
5262: <code class="filename">Makefile</code> variable, it must
5263: be quoted as $$.</p>
5264:
5265: <p>There are several types of variables that must be
5266: handled differently.</p>
5267:
5268: <div class="itemizedlist">
5269: <ul type="disc">
5270: <li>
5271: <p><span class="emphasis"><em>Simple
5272: values</em></span> (which I will call atoms) can
5273: contain any string, which does not have to be
5274: quoted in any way. All other types are somewhat
5275: restricted in their possible values.</p>
5276: </li>
5277:
5278: <li>
5279: <p><span class="emphasis"><em>Internal
5280: lists</em></span> are lists that are never exported
5281: to any shell command. Their elements are separated
5282: by whitespace. Therefore the elements themselves
5283: cannot have embedded whitespace. Any other
5284: characters are allowed. Internal lists can be used
5285: in <code class="varname">.for</code> loops.
5286: Examples are <code class="varname">DEPENDS</code>,
5287: <code class="varname">BUILD_DEPENDS</code>.</p>
5288: </li>
5289:
5290: <li>
5291: <p><span class="emphasis"><em>External
5292: lists</em></span> are lists that may be exported to
5293: a shell command. Their elements can contain any
5294: characters, including whitespace. That's why they
5295: cannot be used in <code class="varname">.for</code>
5296: loops. Examples are <code class=
1.26 ! wiz 5297: "varname">DISTFILES</code> and <code class=
1.25 rillig 5298: "varname">MASTER_SITES</code>.</p>
5299: </li>
5300: </ul>
5301: </div>
5302: </div>
5303:
5304: <div class="sect1" lang="en" xml:lang="en">
5305: <div class="titlepage">
5306: <div>
5307: <div>
5308: <h2 class="title" style="clear: both"><a name=
5309: "makefile.code" id=
5310: "makefile.code"></a>7.2. Code snippets</h2>
5311: </div>
5312: </div>
5313: </div>
5314:
5315: <p>This section presents you with some code snippets you
5316: should use in your own code. If you don't find anything
5317: appropriate here, you should test your code and add it
5318: here.</p>
5319:
5320: <div class="sect2" lang="en" xml:lang="en">
5321: <div class="titlepage">
5322: <div>
5323: <div>
1.26 ! wiz 5324: <h3 class="title"><a name="id2627035" id=
! 5325: "id2627035"></a>7.2.1. Adding things to a
1.25 rillig 5326: list</h3>
5327: </div>
5328: </div>
5329: </div>
5330: <pre class="programlisting">
5331: ATOM= foo * bar `date`
5332: INT_LIST= # empty
5333: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
5334: EXT_LIST= # empty
5335: ANOTHER_EXT_LIST= a=b c=d
5336:
5337: INT_LIST+= ${ATOM} # 1
5338: INT_LIST+= ${ANOTHER_INT_LIST} # 2
5339: EXT_LIST+= ${ATOM:Q} # 3
5340: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
5341:
5342: </pre>
5343:
5344: <p>When you add an atom to an external list (example
5345: 3), it must be quoted. In all other cases, you must not
5346: add a quoting level. You must not merge internal and
5347: external lists, unless you are sure that all entries
5348: are correctly interpreted in both lists.</p>
5349: </div>
5350:
5351: <div class="sect2" lang="en" xml:lang="en">
5352: <div class="titlepage">
5353: <div>
5354: <div>
1.26 ! wiz 5355: <h3 class="title"><a name="id2627113" id=
! 5356: "id2627113"></a>7.2.2. Converting an
1.25 rillig 5357: internal list into an external list</h3>
5358: </div>
5359: </div>
5360: </div>
5361: <pre class="programlisting">
5362: EXT_LIST= # empty
5363: .for i in ${INT_LIST}
5364: EXT_LIST+= ${i:Q}
5365: .endfor
5366:
5367: </pre>
5368:
5369: <p>This code converts the internal list <code class=
5370: "varname">INT_LIST</code> into the external list
5371: <code class="varname">EXT_LIST</code>. As the elements
5372: of an internal list are unquoted they must be quoted
5373: here.</p>
5374: </div>
5375:
5376: <div class="sect2" lang="en" xml:lang="en">
5377: <div class="titlepage">
5378: <div>
5379: <div>
1.26 ! wiz 5380: <h3 class="title"><a name="id2627131" id=
! 5381: "id2627131"></a>7.2.3. Passing variables to
1.25 rillig 5382: a shell command</h3>
5383: </div>
5384: </div>
5385: </div>
5386: <pre class="programlisting">
5387: ATOM= foo bar < > * `date` $$HOME ' "
5388: EXT_LIST= atom=${ATOM:Q} x=second\ item
5389:
5390: all:
5391: echo ${ATOM} # 1
5392: echo "${ATOM}" # 2
5393: echo "${ATOM:Q}" # 3
5394: echo ${ATOM:Q} # 4
5395: echo x${ATOM:Q} | sed 1s,.,, # 5
5396: env ${EXT_LIST} /bin/sh -c 'echo "$$atom"; echo "$$x"'
5397:
5398: </pre>
5399:
5400: <p>Example 1 leads to a syntax error in the shell, as
5401: the characters are just copied.</p>
5402:
1.26 ! wiz 5403: <p>Example 2 leads to a syntax error too, and if you
1.25 rillig 5404: leave out the last " character from <code class=
1.26 ! wiz 5405: "varname">${ATOM}</code>, <a href=
1.25 rillig 5406: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
5407: <span class="citerefentry"><span class=
5408: "refentrytitle">date</span>(1)</span></a> would be
5409: executed. The <code class="varname">$HOME</code> shell
5410: variable would be evaluated, too.</p>
5411:
1.26 ! wiz 5412: <p>Example 3 would output each space character preceded
! 5413: by a backslash (or not), depending on the
1.25 rillig 5414: implementation of the <a href=
5415: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
5416: <span class="citerefentry"><span class=
5417: "refentrytitle">echo</span>(1)</span></a> command.</p>
5418:
5419: <p>Example 4 handles correctly every string that does
5420: not start with a dash. In that case, the result depends
5421: on the implementation of the <a href=
5422: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
5423: <span class="citerefentry"><span class=
5424: "refentrytitle">echo</span>(1)</span></a> command. As
5425: long as you can guarantee that your input does not
5426: start with a dash this form is appropriate.</p>
5427:
5428: <p>Example 5 handles even the case of a leading dash
5429: correctly.</p>
5430:
5431: <p>The <code class="varname">EXT_LIST</code> does not
5432: need to be quoted because the quoting has already be
5433: done when adding elements to the list.</p>
5434:
5435: <p>As internal lists shall not be passed to the shell,
5436: there is no example for it.</p>
5437: </div>
5438: </div>
5439: </div>
5440:
5441: <div class="chapter" lang="en" xml:lang="en">
5442: <div class="titlepage">
5443: <div>
5444: <div>
1.1 grant 5445: <h2 class="title"><a name="components" id=
1.25 rillig 5446: "components"></a>Chapter 8. Package
1.1 grant 5447: components - files, directories and contents</h2>
5448: </div>
5449: </div>
5450: </div>
5451:
5452: <div class="toc">
5453: <p><b>Table of Contents</b></p>
5454:
5455: <dl>
5456: <dt><span class="sect1"><a href=
1.25 rillig 5457: "#components.Makefile">8.1. <code class=
1.14 xtraeme 5458: "filename">Makefile</code></a></span></dt>
1.1 grant 5459:
5460: <dt><span class="sect1"><a href=
1.25 rillig 5461: "#components.distinfo">8.2. <code class=
1.14 xtraeme 5462: "filename">distinfo</code></a></span></dt>
1.1 grant 5463:
5464: <dt><span class="sect1"><a href=
1.25 rillig 5465: "#components.patches">8.3. patches/*</a></span></dt>
1.1 grant 5466:
1.26 ! wiz 5467: <dt><span class="sect1"><a href="#id2627827">8.4. Other
1.1 grant 5468: mandatory files</a></span></dt>
5469:
5470: <dt><span class="sect1"><a href=
1.25 rillig 5471: "#components.optional">8.5. Optional
1.1 grant 5472: files</a></span></dt>
5473:
1.26 ! wiz 5474: <dt><span class="sect1"><a href="#id2628089">8.6.
1.14 xtraeme 5475: <code class="filename">work*</code></a></span></dt>
1.1 grant 5476:
1.26 ! wiz 5477: <dt><span class="sect1"><a href="#id2628177">8.7.
1.14 xtraeme 5478: <code class="filename">files/*</code></a></span></dt>
1.1 grant 5479: </dl>
5480: </div>
5481:
5482: <p>Whenever you're preparing a package, there are a number
5483: of files involved which are described in the following
5484: sections.</p>
5485:
5486: <div class="sect1" lang="en" xml:lang="en">
5487: <div class="titlepage">
5488: <div>
5489: <div>
5490: <h2 class="title" style="clear: both"><a name=
5491: "components.Makefile" id=
1.25 rillig 5492: "components.Makefile"></a>8.1. <code class=
1.14 xtraeme 5493: "filename">Makefile</code></h2>
1.1 grant 5494: </div>
5495: </div>
5496: </div>
5497:
5498: <p>Building, installation and creation of a binary
1.14 xtraeme 5499: package are all controlled by the package's <code class=
1.23 wiz 5500: "filename">Makefile</code>. The <code class=
5501: "filename">Makefile</code> describes various things about
5502: a package, for example from where to get it, how to
5503: configure, build, and install it.</p>
5504:
5505: <p>A package <code class="filename">Makefile</code>
5506: contains several sections that describe the package.</p>
5507:
5508: <p>In the first section there are the following
5509: variables, which should appear exactly in the order given
5510: here.</p>
5511:
5512: <div class="itemizedlist">
5513: <ul type="disc">
5514: <li>
5515: <p><code class="varname">DISTNAME</code> is the
5516: basename of the distribution file to be downloaded
5517: from the package's website.</p>
5518: </li>
5519:
5520: <li>
5521: <p><code class="varname">PKGNAME</code> is the name
5522: of the package, as used by pkgsrc. You only need to
5523: provide it if it differs from DISTNAME. Usually it
5524: is the directory name together with the version
5525: number.</p>
5526: </li>
5527:
5528: <li>
5529: <p><code class="varname">CATEGORIES</code> is a
5530: list of categories which the package fits in. You
5531: can choose any of the top-level directories of
5532: pkgsrc for it.</p>
5533: </li>
5534:
5535: <li>
5536: <p><code class="varname">MASTER_SITES</code> is a
5537: list of URLs where the distribution files can be
5538: downloaded. Each URL must end with a slash.</p>
5539: </li>
5540: </ul>
5541: </div>
5542:
5543: <p>The second section contains the following
5544: variables.</p>
5545:
5546: <div class="itemizedlist">
5547: <ul type="disc">
5548: <li>
5549: <p><code class="varname">MAINTAINER</code> is the
5550: mail address of the package's maintainer, which is
5551: the person you can contact when the package does
5552: not work.</p>
5553: </li>
5554:
5555: <li>
5556: <p><code class="varname">HOMEPAGE</code> is a URL
5557: where users can find more information about the
5558: package.</p>
5559: </li>
1.1 grant 5560:
1.23 wiz 5561: <li>
5562: <p><code class="varname">COMMENT</code> is a
5563: one-line comment about the purpose of the
5564: package.</p>
5565: </li>
5566: </ul>
5567: </div>
1.1 grant 5568:
1.14 xtraeme 5569: <p>The <code class="varname">MASTER_SITES</code> may be
5570: set to one of the predefined sites:</p>
1.1 grant 5571: <pre class="programlisting">
5572: ${MASTER_SITE_APACHE}
5573: ${MASTER_SITE_DEBIAN}
5574: ${MASTER_SITE_GNOME}
5575: ${MASTER_SITE_GNU}
5576: ${MASTER_SITE_GNUSTEP}
1.9 dillo 5577: ${MASTER_SITE_IFARCHIVE}
1.1 grant 5578: ${MASTER_SITE_MOZILLA}
5579: ${MASTER_SITE_PERL_CPAN}
5580: ${MASTER_SITE_SOURCEFORGE}
5581: ${MASTER_SITE_SUNSITE}
5582: ${MASTER_SITE_R_CRAN}
5583: ${MASTER_SITE_SUSE}
5584: ${MASTER_SITE_TEX_CTAN}
5585: ${MASTER_SITE_XCONTRIB}
5586: ${MASTER_SITE_XEMACS}
5587: </pre>
5588:
5589: <p>If one of these predefined sites is chosen, you may
5590: require the ability to specify a subdirectory of that
5591: site. Since these macros may expand to more than one
5592: actual site, you <span class=
5593: "emphasis"><em>must</em></span> use the following
5594: construct to specify a subdirectory:</p>
5595: <pre class="programlisting">
5596: ${MASTER_SITE_GNU:=subdirectory/name/}
5597: ${MASTER_SITE_SOURCEFORGE:=project_name/}
5598: </pre>
5599:
5600: <p>Note the trailing slash after the subdirectory
5601: name.</p>
5602:
5603: <div class="note" style=
5604: "margin-left: 0.5in; margin-right: 0.5in;">
5605: <h3 class="title">Note</h3>
5606:
1.14 xtraeme 5607: <p><code class="varname">MASTER_SITE_SUBDIR</code> has
5608: been deprecated and <span class="emphasis"><em>should
5609: no longer be used</em></span>.</p>
1.1 grant 5610: </div>
5611:
1.14 xtraeme 5612: <p>If the package has multiple <code class=
5613: "varname">DISTFILES</code> or multiple <code class=
5614: "varname">PATCHFILES</code> from different sites, set
5615: <code class="varname">SITES_foo</code> to a list of URI's
1.1 grant 5616: where file “<span class="quote">foo</span>”
5617: may be found. “<span class=
5618: "quote">foo</span>” includes the suffix, e.g.</p>
5619: <pre class="programlisting">
5620: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
5621: DISTFILES+= foo-file.tar.gz
5622: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
5623: http://www.somewhereelse.com/mirror/somehow/
5624: </pre>
5625:
1.14 xtraeme 5626: <p>Note that the normal default setting of <code class=
5627: "varname">DISTFILES</code> must be made explicit if you
1.1 grant 5628: want to add to it (rather than replace it), as you
5629: usually would.</p>
5630:
5631: <p>Currently the following values are available for
1.14 xtraeme 5632: <code class="varname">CATEGORIES</code>. If more than one
5633: is used, they need to be separated by spaces:</p>
1.1 grant 5634: <pre class="programlisting">
5635: archivers cross geography meta-pkgs security
5636: audio databases graphics misc shells
5637: benchmarks devel ham multimedia sysutils
5638: biology editors inputmethod net textproc
5639: cad emulators lang news time
5640: chat finance mail parallel wm
5641: comms fonts math pkgtools www
5642: converters games mbone print x11
5643: </pre>
5644:
5645: <p>Please pay attention to the following gotchas:</p>
5646:
5647: <div class="itemizedlist">
5648: <ul type="disc">
5649: <li>
1.14 xtraeme 5650: <p>Add <code class="varname">MANCOMPRESSED</code>
5651: if manpages are installed in compressed form by the
5652: package; see comment in <code class=
5653: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 5654: </li>
5655:
5656: <li>
1.14 xtraeme 5657: <p>Replace <code class="filename">/usr/local</code>
1.1 grant 5658: with “<span class=
5659: "quote">${PREFIX}</span>” in all files (see
5660: patches, below).</p>
5661: </li>
5662:
5663: <li>
5664: <p>If the package installs any info files, see
5665: <a href="#faq.info-files" title=
1.25 rillig 5666: "13.5.10. Packages installing info files">Section
5667: 13.5.10, “Packages installing info
1.1 grant 5668: files”</a>.</p>
5669: </li>
5670:
5671: <li>
1.14 xtraeme 5672: <p>Set <code class="varname">MAINTAINER</code> to
5673: be yourself. If you really can't maintain the
5674: package for future updates, set it to <code class=
1.1 grant 5675: "email"><<a href=
1.14 xtraeme 5676: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.1 grant 5677: </li>
5678:
5679: <li>
5680: <p>If a home page for the software in question
1.14 xtraeme 5681: exists, add the variable <code class=
5682: "varname">HOMEPAGE</code> right after <code class=
5683: "varname">MAINTAINER</code>. The value of this
1.1 grant 5684: variable should be the URL for the home page.</p>
5685: </li>
5686:
5687: <li>
1.14 xtraeme 5688: <p>Be sure to set the <code class=
5689: "varname">COMMENT</code> variable to a short
1.1 grant 5690: description of the package, not containing the
5691: pkg's name.</p>
5692: </li>
5693: </ul>
5694: </div>
5695: </div>
5696:
5697: <div class="sect1" lang="en" xml:lang="en">
5698: <div class="titlepage">
5699: <div>
5700: <div>
5701: <h2 class="title" style="clear: both"><a name=
5702: "components.distinfo" id=
1.25 rillig 5703: "components.distinfo"></a>8.2. <code class=
1.14 xtraeme 5704: "filename">distinfo</code></h2>
1.1 grant 5705: </div>
5706: </div>
5707: </div>
5708:
5709: <p>Most important, the mandatory message digest, or
5710: checksum, of all the distfiles needed for the package to
5711: compile, confirming they match the original file
5712: distributed by the author. This ensures that the distfile
5713: retrieved from the Internet has not been corrupted during
5714: transfer or altered by a malign force to introduce a
1.14 xtraeme 5715: security hole. It is generated using the
5716: <span><strong class="command">make
5717: makesum</strong></span> command. The digest algorithm
5718: used was, at one stage, md5, but that was felt lacking
5719: compared to sha1, and so sha1 is now the default
1.1 grant 5720: algorithm. The distfile size is also generated and stored
5721: in new distinfo files. The <a xmlns=
5722: "http://www.w3.org/TR/xhtml1/transitional" href=
5723: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20 ben 5724: class="pkgname">pkgtools/digest</a> utility calculates
5725: all of the digests in the distinfo file, and it provides
5726: various different algorithms. At the current time, the
5727: algorithms provided are: <span class=
5728: "emphasis"><em>md5</em></span>, <span class=
5729: "emphasis"><em>rmd160</em></span>, <span class=
5730: "emphasis"><em>sha1</em></span>, <span class=
5731: "emphasis"><em>sha256</em></span>, <span class=
5732: "emphasis"><em>sha384</em></span> and <span class=
5733: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 5734:
5735: <p>Some packages have different sets of distfiles on a
5736: per architecture basis, for example <a xmlns=
5737: "http://www.w3.org/TR/xhtml1/transitional" href=
5738: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.20 ben 5739: class="pkgname">www/navigator</a>). These are kept in the
5740: same distinfo file and care should be taken when
5741: upgrading such a package to ensure distfile information
5742: is not lost.</p>
1.1 grant 5743:
5744: <p>The message digest/checksum for all the official
1.14 xtraeme 5745: patches found in the <code class=
5746: "filename">patches/</code> directory (see <a href=
5747: "#components.patches" title=
1.25 rillig 5748: "8.3. patches/*">Section 8.3,
1.1 grant 5749: “patches/*”</a>) for the package is also
1.14 xtraeme 5750: stored in the <code class="filename">distinfo</code>
5751: file. This is a message digest/checksum of all lines in
5752: the patch file except the NetBSD RCS Id. This file is
5753: generated by invoking <span><strong class="command">make
5754: makepatchsum</strong></span> (or <span><strong class=
5755: "command">make mps</strong></span> if you're in a
5756: hurry).</p>
1.1 grant 5757: </div>
5758:
5759: <div class="sect1" lang="en" xml:lang="en">
5760: <div class="titlepage">
5761: <div>
5762: <div>
5763: <h2 class="title" style="clear: both"><a name=
5764: "components.patches" id=
1.25 rillig 5765: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 5766: </div>
5767: </div>
5768: </div>
5769:
5770: <p>This directory contains files that are used by the
5771: <a href=
5772: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
5773: <span class="citerefentry"><span class=
5774: "refentrytitle">patch</span>(1)</span></a> command to
5775: modify the sources as distributed in the distribution
5776: file into a form that will compile and run perfectly on
5777: NetBSD. The files are applied successively in alphabetic
5778: order (as returned by a shell “<span class=
5779: "quote">patches/patch-*</span>” glob expansion), so
1.14 xtraeme 5780: <code class="filename">patch-aa</code> is applied before
5781: <code class="filename">patch-ab</code>, etc.</p>
1.1 grant 5782:
1.14 xtraeme 5783: <p>The <code class="filename">patch-*</code> files should
5784: be in <span><strong class="command">diff
5785: -bu</strong></span> format, and apply without a fuzz to
5786: avoid problems. (To force patches to apply with fuzz you
5787: can set <code class=
5788: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 5789: not put changes for more than one file into a single
5790: patch-file, as this will make future modifications more
5791: difficult.</p>
5792:
5793: <p>Similar, a file should be patched at most once, not
5794: several times by several different patches. If a file
5795: needs several patches, they should be combined into one
5796: file.</p>
5797:
5798: <p>One important thing to mention is to pay attention
5799: that no RCS IDs get stored in the patch files, as these
5800: will cause problems when later checked into the NetBSD
1.14 xtraeme 5801: CVS tree. Use the <span><strong class=
5802: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 5803: "http://www.w3.org/TR/xhtml1/transitional" href=
5804: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 5805: class="pkgname">pkgtools/pkgdiff</a> package to avoid
5806: these problems.</p>
1.1 grant 5807:
5808: <p>For even more automation, we recommend using
1.14 xtraeme 5809: <span><strong class="command">mkpatches</strong></span>
5810: from the same package to make a whole set of patches. You
5811: just have to backup files before you edit them to
5812: <code class="filename">filename.orig</code>, e.g. with
5813: <span><strong class="command">cp -p filename
5814: filename.orig</strong></span> or, easier, by using
5815: <span><strong class="command">pkgvi</strong></span> again
5816: from the same package. If you upgrade a package this way,
5817: you can easily compare the new set of patches with the
5818: previously existing one with <span><strong class=
5819: "command">patchdiff</strong></span>.</p>
1.1 grant 5820:
5821: <p>When you have finished a package, remember to generate
5822: the checksums for the patch files by using the
1.14 xtraeme 5823: <span><strong class="command">make
5824: makepatchsum</strong></span> command, see <a href=
5825: "#components.distinfo" title=
1.25 rillig 5826: "8.2. distinfo">Section 8.2,
1.14 xtraeme 5827: “<code class="filename">distinfo</code>”</a>.</p>
1.1 grant 5828:
5829: <p>Patch files that are distributed by the author or
1.14 xtraeme 5830: other maintainers can be listed in <code class=
5831: "varname">$PATCHFILES</code>.</p>
1.1 grant 5832:
5833: <p>If it is desired to store any patches that should not
5834: be committed into pkgsrc, they can be kept outside the
1.14 xtraeme 5835: pkgsrc tree in the <code class=
5836: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 5837: tree there is expected to have the same
5838: “<span class="quote">category/package</span>”
5839: structure as pkgsrc, and patches are expected to be
1.14 xtraeme 5840: stored inside these dirs (also known as <code class=
5841: "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
5842: you want to keep a private patch for <code class=
5843: "filename">pkgsrc/graphics/png</code>, keep it in
5844: <code class=
5845: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
5846: files in the named directory are expected to be patch
1.1 grant 5847: files, and <span class="emphasis"><em>they are applied
5848: after pkgsrc patches are applied</em></span>.</p>
5849: </div>
5850:
5851: <div class="sect1" lang="en" xml:lang="en">
5852: <div class="titlepage">
5853: <div>
5854: <div>
5855: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 5856: "id2627827" id="id2627827"></a>8.4. Other
1.1 grant 5857: mandatory files</h2>
5858: </div>
5859: </div>
5860: </div>
5861:
5862: <div class="variablelist">
5863: <dl>
1.14 xtraeme 5864: <dt><span class="term"><code class=
5865: "filename">DESCR</code></span></dt>
1.1 grant 5866:
5867: <dd>
5868: <p>A multi-line description of the piece of
5869: software. This should include any credits where
5870: they are due. Please bear in mind that others do
5871: not share your sense of humour (or spelling
5872: idiosyncrasies), and that others will read
5873: everything that you write here.</p>
5874: </dd>
5875:
1.14 xtraeme 5876: <dt><span class="term"><code class=
5877: "filename">PLIST</code></span></dt>
1.1 grant 5878:
5879: <dd>
5880: <p>This file governs the files that are installed
5881: on your system: all the binaries, manual pages,
5882: etc. There are other directives which may be
5883: entered in this file, to control the creation and
5884: deletion of directories, and the location of
5885: inserted files. See <a href="#plist" title=
1.25 rillig 5886: "Chapter 9. PLIST issues">Chapter 9,
1.1 grant 5887: <i>PLIST issues</i></a> for more information.</p>
5888: </dd>
5889: </dl>
5890: </div>
5891: </div>
5892:
5893: <div class="sect1" lang="en" xml:lang="en">
5894: <div class="titlepage">
5895: <div>
5896: <div>
5897: <h2 class="title" style="clear: both"><a name=
5898: "components.optional" id=
1.25 rillig 5899: "components.optional"></a>8.5. Optional
1.1 grant 5900: files</h2>
5901: </div>
5902: </div>
5903: </div>
5904:
5905: <div class="variablelist">
5906: <dl>
1.14 xtraeme 5907: <dt><span class="term"><code class=
5908: "filename">INSTALL</code></span></dt>
1.1 grant 5909:
5910: <dd>
5911: <p>This shell script is invoked twice by <a href=
5912: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5913: <span class="citerefentry"><span class=
5914: "refentrytitle">pkg_add</span>(1)</span></a>. First
5915: time after package extraction and before files are
5916: moved in place, the second time after the files to
5917: install are moved in place. This can be used to do
5918: any custom procedures not possible with @exec
1.14 xtraeme 5919: commands in <code class="filename">PLIST</code>.
5920: See <a href=
1.1 grant 5921: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
5922: <span class="citerefentry"><span class=
5923: "refentrytitle">pkg_add</span>(1)</span></a> and
5924: <a href=
5925: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5926: <span class="citerefentry"><span class=
5927: "refentrytitle">pkg_create</span>(1)</span></a> for
5928: more information.</p>
5929: </dd>
5930:
1.14 xtraeme 5931: <dt><span class="term"><code class=
5932: "filename">DEINSTALL</code></span></dt>
1.1 grant 5933:
5934: <dd>
5935: <p>This script is executed before and after any
5936: files are removed. It is this script's
5937: responsibility to clean up any additional messy
5938: details around the package's installation, since
5939: all pkg_delete knows is how to delete the files
5940: created in the original distribution. See <a href=
5941: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
5942: <span class="citerefentry"><span class=
5943: "refentrytitle">pkg_delete</span>(1)</span></a> and
5944: <a href=
5945: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
5946: <span class="citerefentry"><span class=
5947: "refentrytitle">pkg_create</span>(1)</span></a> for
5948: more information.</p>
5949: </dd>
5950:
1.14 xtraeme 5951: <dt><span class="term"><code class=
5952: "filename">MESSAGE</code></span></dt>
1.1 grant 5953:
5954: <dd>
5955: <p>Display this file after installation of the
5956: package. Useful for things like legal notices on
5957: almost-free software and hints for updating config
5958: files after installing modules for apache, PHP etc.
5959: Please note that you can modify variables in it
1.14 xtraeme 5960: easily by using <code class=
5961: "varname">MESSAGE_SUBST</code> in the package's
5962: <code class="filename">Makefile</code>:</p>
1.1 grant 5963: <pre class="programlisting">
5964: MESSAGE_SUBST+= SOMEVAR="somevalue"
5965: </pre>
5966:
5967: <p>replaces "${SOMEVAR}" with “<span class=
1.14 xtraeme 5968: "quote">somevalue</span>” in <code class=
5969: "filename">MESSAGE</code>.</p>
1.1 grant 5970: </dd>
5971: </dl>
5972: </div>
5973: </div>
5974:
5975: <div class="sect1" lang="en" xml:lang="en">
5976: <div class="titlepage">
5977: <div>
5978: <div>
5979: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 5980: "id2628089" id=
! 5981: "id2628089"></a>8.6. <code class=
1.14 xtraeme 5982: "filename">work*</code></h2>
1.1 grant 5983: </div>
5984: </div>
5985: </div>
5986:
1.14 xtraeme 5987: <p>When you type <span><strong class=
5988: "command">make</strong></span> the distribution files are
5989: unpacked into this directory. It can be removed by
5990: running <span><strong class="command">make
5991: clean</strong></span>. Besides the sources, this
5992: directory is also used to keep various timestamp
1.1 grant 5993: files.</p>
5994:
5995: <p>If a package doesn't create a subdirectory for itself
5996: (like GNU software does, for instance), but extracts
5997: itself in the current directory, you should set
1.14 xtraeme 5998: <code class="varname">WRKSRC</code> accordingly, e.g.
1.1 grant 5999: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
6000: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.20 ben 6001: class="pkgname">editors/sam</a> again, but the quick
6002: answer is:</p>
1.1 grant 6003: <pre class="programlisting">
6004: WRKSRC= ${WRKDIR}
6005: </pre>
6006:
1.14 xtraeme 6007: <p>Please note that the old <code class=
6008: "varname">NO_WRKSUBDIR</code> has been deprecated and
1.1 grant 6009: should not be used. Also, if your package doesn't create
1.14 xtraeme 6010: a subdir with the name of <code class=
6011: "varname">DISTNAME</code> but some different name, set
6012: <code class="varname">WRKSRC</code> to point to the
6013: proper name in <code class="filename">${WRKDIR}</code>.
6014: See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
6015: href=
1.1 grant 6016: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.20 ben 6017: class="pkgname">lang/tcl</a> and <a xmlns=
6018: "http://www.w3.org/TR/xhtml1/transitional" href=
6019: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
6020: class="pkgname">x11/tk</a> for examples, and here is
6021: another one:</p>
1.1 grant 6022: <pre class="programlisting">
6023: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
6024: </pre>
6025:
6026: <p>The name of the working directory created by pkgsrc is
1.14 xtraeme 6027: <code class="filename">work</code> by default. If the
6028: same pkgsrc tree should be used on several different
6029: platforms, the variable <code class=
6030: "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
1.1 grant 6031: attach the platform to the directory name, e.g.
1.14 xtraeme 6032: <code class="filename">work.i386</code> or <code class=
6033: "filename">work.sparc</code>.</p>
1.1 grant 6034: </div>
6035:
6036: <div class="sect1" lang="en" xml:lang="en">
6037: <div class="titlepage">
6038: <div>
6039: <div>
6040: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 6041: "id2628177" id=
! 6042: "id2628177"></a>8.7. <code class=
1.14 xtraeme 6043: "filename">files/*</code></h2>
1.1 grant 6044: </div>
6045: </div>
6046: </div>
6047:
6048: <p>If you have any files that you wish to be placed in
6049: the package prior to configuration or building, you could
6050: place these files here and use a “<span class=
6051: "quote">${CP}</span>” command in the
6052: “<span class="quote">pre-configure</span>”
6053: target to achieve this. Alternatively, you could simply
1.14 xtraeme 6054: diff the file against <code class=
6055: "filename">/dev/null</code> and use the patch mechanism
6056: to manage the creation of this file.</p>
1.1 grant 6057: </div>
6058: </div>
6059:
6060: <div class="chapter" lang="en" xml:lang="en">
6061: <div class="titlepage">
6062: <div>
6063: <div>
6064: <h2 class="title"><a name="plist" id=
1.25 rillig 6065: "plist"></a>Chapter 9. PLIST issues</h2>
1.1 grant 6066: </div>
6067: </div>
6068: </div>
6069:
6070: <div class="toc">
6071: <p><b>Table of Contents</b></p>
6072:
6073: <dl>
1.26 ! wiz 6074: <dt><span class="sect1"><a href="#id2628231">9.1. RCS
1.1 grant 6075: ID</a></span></dt>
6076:
1.26 ! wiz 6077: <dt><span class="sect1"><a href="#id2628246">9.2.
1.14 xtraeme 6078: Semi-automatic <code class="filename">PLIST</code>
6079: generation</a></span></dt>
1.1 grant 6080:
1.25 rillig 6081: <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14 xtraeme 6082: Tweaking output of <span><strong class="command">make
6083: print-PLIST</strong></span></a></span></dt>
1.1 grant 6084:
1.25 rillig 6085: <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1 grant 6086: Variable substitution in PLIST</a></span></dt>
6087:
1.26 ! wiz 6088: <dt><span class="sect1"><a href="#id2628499">9.5.
1.1 grant 6089: Manpage-compression</a></span></dt>
6090:
1.26 ! wiz 6091: <dt><span class="sect1"><a href="#id2628609">9.6.
1.14 xtraeme 6092: Changing PLIST source with <code class=
6093: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 6094:
1.26 ! wiz 6095: <dt><span class="sect1"><a href="#id2628633">9.7.
1.1 grant 6096: Platform specific and differing PLISTs</a></span></dt>
6097:
1.25 rillig 6098: <dt><span class="sect1"><a href="#faq.common-dirs">9.8.
1.1 grant 6099: Sharing directories between packages</a></span></dt>
6100: </dl>
6101: </div>
6102:
1.14 xtraeme 6103: <p>The <code class="filename">PLIST</code> file contains a
1.1 grant 6104: package's “<span class="quote">packing
6105: list</span>”, i.e. a list of files that belong to the
1.14 xtraeme 6106: package (relative to the <code class=
6107: "filename">${PREFIX}</code> directory it's been installed
6108: in) plus some additional statements - see the <a href=
1.1 grant 6109: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6110: <span class="citerefentry"><span class=
6111: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
6112: a full list. This chapter addresses some issues that need
1.14 xtraeme 6113: attention when dealing with the <code class=
6114: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 6115:
6116: <div class="sect1" lang="en" xml:lang="en">
6117: <div class="titlepage">
6118: <div>
6119: <div>
6120: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 6121: "id2628231" id="id2628231"></a>9.1. RCS
1.1 grant 6122: ID</h2>
6123: </div>
6124: </div>
6125: </div>
6126:
6127: <p>Be sure to add a RCS ID line as the first thing in any
1.14 xtraeme 6128: <code class="filename">PLIST</code> file you write:</p>
1.1 grant 6129: <pre class="programlisting">
1.17 sketch 6130: @comment $NetBSD$
1.1 grant 6131: </pre>
6132: </div>
6133:
6134: <div class="sect1" lang="en" xml:lang="en">
6135: <div class="titlepage">
6136: <div>
6137: <div>
6138: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 6139: "id2628246" id=
! 6140: "id2628246"></a>9.2. Semi-automatic
1.14 xtraeme 6141: <code class="filename">PLIST</code> generation</h2>
1.1 grant 6142: </div>
6143: </div>
6144: </div>
6145:
1.14 xtraeme 6146: <p>You can use the <span><strong class="command">make
6147: print-PLIST</strong></span> command to output a PLIST
6148: that matches any new files since the package was
6149: extracted. See <a href="#build.helpful-targets" title=
1.25 rillig 6150: "12.3. Other helpful targets">Section 12.3,
1.1 grant 6151: “Other helpful targets”</a> for more
6152: information on this target.</p>
6153: </div>
6154:
6155: <div class="sect1" lang="en" xml:lang="en">
6156: <div class="titlepage">
6157: <div>
6158: <div>
6159: <h2 class="title" style="clear: both"><a name=
6160: "print-PLIST" id=
1.25 rillig 6161: "print-PLIST"></a>9.3. Tweaking output of
1.14 xtraeme 6162: <span><strong class="command">make
6163: print-PLIST</strong></span></h2>
1.1 grant 6164: </div>
6165: </div>
6166: </div>
6167:
6168: <p>If you have used any of the *-dirs packages, as
6169: explained in <a href="#faq.common-dirs" title=
1.25 rillig 6170: "9.8. Sharing directories between packages">Section 9.8,
1.1 grant 6171: “Sharing directories between packages”</a>,
1.14 xtraeme 6172: you may have noticed that <span><strong class=
6173: "command">make print-PLIST</strong></span> outputs a set
6174: of <code class="varname">@comment</code>s instead of real
6175: <code class="varname">@dirrm</code> lines. You can also
6176: do this for specific directories and files, so that the
6177: results of that command are very close to reality. This
6178: helps <span class="emphasis"><em>a lot</em></span> during
6179: the update of packages.</p>
6180:
6181: <p>The <code class="varname">PRINT_PLIST_AWK</code>
6182: variable takes a set of AWK patterns and actions that are
6183: used to filter the output of print-PLIST. You can
6184: <span class="emphasis"><em>append</em></span> any chunk
6185: of AWK scripting you like to it, but be careful with
1.1 grant 6186: quoting.</p>
6187:
1.14 xtraeme 6188: <p>For example, to get all files inside the <code class=
6189: "filename">libdata/foo</code> directory removed from the
1.1 grant 6190: resulting PLIST:</p>
6191: <pre class="programlisting">
6192: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
6193:
6194: </pre>
6195:
1.14 xtraeme 6196: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 6197: lines referring to a specific (shared) directory
1.14 xtraeme 6198: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 6199: <pre class="programlisting">
6200: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
6201:
6202: </pre>
6203: </div>
6204:
6205: <div class="sect1" lang="en" xml:lang="en">
6206: <div class="titlepage">
6207: <div>
6208: <div>
6209: <h2 class="title" style="clear: both"><a name=
1.25 rillig 6210: "plist.misc" id="plist.misc"></a>9.4. Variable
1.1 grant 6211: substitution in PLIST</h2>
6212: </div>
6213: </div>
6214: </div>
6215:
6216: <p>A number of variables are substituted automatically in
6217: PLISTs when a package is installed on a system. This
6218: includes the following variables:</p>
6219:
6220: <div class="variablelist">
6221: <dl>
1.14 xtraeme 6222: <dt><span class="term"><code class=
6223: "varname">${MACHINE_ARCH}</code>, <code class=
6224: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 6225:
6226: <dd>
6227: <p>Some packages like emacs and perl embed
6228: information about which architecture they were
6229: built on into the pathnames where they install
6230: their file. To handle this case, PLIST will be
6231: preprocessed before actually used, and the symbol
1.14 xtraeme 6232: “<span class="quote"><code class=
6233: "varname">${MACHINE_ARCH}</code></span>” will
6234: be replaced by what <span><strong class=
6235: "command">uname -p</strong></span> gives. The same
6236: is done if the string <code class=
6237: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
6238: PLIST somewhere - use this on packages that have
6239: GNU autoconf created configure scripts.</p>
1.1 grant 6240:
6241: <div class="note" style=
6242: "margin-left: 0.5in; margin-right: 0.5in;">
6243: <h3 class="title">Legacy note</h3>
6244:
6245: <p>There used to be a symbol “<span class=
1.14 xtraeme 6246: "quote"><code class=
6247: "varname">$ARCH</code></span>” that was
6248: replaced by the output of <span><strong class=
6249: "command">uname -m</strong></span>, but that's no
1.1 grant 6250: longer supported and has been removed.</p>
6251: </div>
6252: </dd>
6253:
1.14 xtraeme 6254: <dt><span class="term"><code class=
6255: "varname">${OPSYS}</code>, <code class=
6256: "varname">${LOWER_OPSYS}</code>, <code class=
6257: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 6258:
6259: <dd>
6260: <p>Some packages want to embed the OS name and
6261: version into some paths. To do this, use these
1.14 xtraeme 6262: variables in the <code class=
6263: "filename">PLIST</code>:</p>
1.1 grant 6264:
6265: <div class="itemizedlist">
6266: <ul type="disc">
6267: <li>
1.14 xtraeme 6268: <p><code class="varname">${OPSYS}</code> -
6269: output of “<span class=
6270: "quote"><span><strong class="command">uname
6271: -s</strong></span></span>”</p>
1.1 grant 6272: </li>
6273:
6274: <li>
1.14 xtraeme 6275: <p><code class=
6276: "varname">${LOWER_OPSYS}</code> - lowercase
6277: common name (eg. “<span class=
6278: "quote">solaris</span>”)</p>
1.1 grant 6279: </li>
6280:
6281: <li>
1.14 xtraeme 6282: <p><code class="varname">${OS_VERSION}</code>
6283: - “<span class=
6284: "quote"><span><strong class="command">uname
6285: -r</strong></span></span>”</p>
1.1 grant 6286: </li>
6287: </ul>
6288: </div>
6289: </dd>
6290:
1.14 xtraeme 6291: <dt><span class="term"><code class=
6292: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 6293:
6294: <dd>
6295: <p>Packages that install locale files should list
6296: them in the PLIST as “<span class=
6297: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
6298: instead of “<span class=
6299: "quote">share/locale/de/LC_MESSAGES/...</span>”.
6300: This properly handles the fact that different
6301: operating systems expect locale files to be either
1.14 xtraeme 6302: in <code class="filename">share</code> or
6303: <code class="filename">lib</code> by default.</p>
1.1 grant 6304: </dd>
6305: </dl>
6306: </div>
6307:
6308: <p>For a complete list of values which are replaced by
1.14 xtraeme 6309: default, please look in <code class=
6310: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 6311: "emphasis"><em>PLIST_SUBST</em></span>).</p>
6312:
6313: <p>If you want to change other variables not listed
6314: above, you can add variables and their expansions to this
1.14 xtraeme 6315: variable in the following way, similar to <code class=
6316: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 6317: "#components.optional" title=
1.25 rillig 6318: "8.5. Optional files">Section 8.5,
1.1 grant 6319: “Optional files”</a>):</p>
6320: <pre class="programlisting">
6321: PLIST_SUBST+= SOMEVAR="somevalue"
6322: </pre>
6323:
6324: <p>This replaces all occurrences of “<span class=
6325: "quote">${SOMEVAR}</span>” in the PLIST with
6326: “<span class="quote">somevalue</span>”.</p>
6327: </div>
6328:
6329: <div class="sect1" lang="en" xml:lang="en">
6330: <div class="titlepage">
6331: <div>
6332: <div>
6333: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 6334: "id2628499" id=
! 6335: "id2628499"></a>9.5. Manpage-compression</h2>
1.1 grant 6336: </div>
6337: </div>
6338: </div>
6339:
6340: <p>Manpages should be installed in compressed form if
1.14 xtraeme 6341: <code class="varname">MANZ</code> is set (in <code class=
6342: "filename">bsd.own.mk</code>), and uncompressed
6343: otherwise. To handle this in the <code class=
6344: "filename">PLIST</code> file, the suffix
6345: “<span class="quote">.gz</span>” is
6346: appended/removed automatically for manpages according to
6347: <code class="varname">MANZ</code> and <code class=
6348: "varname">MANCOMPRESSED</code> being set or not, see
6349: above for details. This modification of the <code class=
6350: "filename">PLIST</code> file is done on a copy of it, not
6351: <code class="filename">PLIST</code> itself.</p>
1.1 grant 6352: </div>
6353:
6354: <div class="sect1" lang="en" xml:lang="en">
6355: <div class="titlepage">
6356: <div>
6357: <div>
6358: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 6359: "id2628609" id="id2628609"></a>9.6. Changing
1.14 xtraeme 6360: PLIST source with <code class=
6361: "varname">PLIST_SRC</code></h2>
1.1 grant 6362: </div>
6363: </div>
6364: </div>
6365:
1.14 xtraeme 6366: <p>To use one or more files as source for the
6367: <code class="filename">PLIST</code> used in generating
6368: the binary package, set the variable <code class=
6369: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 6370: The files are later concatenated using <a href=
6371: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
6372: <span class="citerefentry"><span class=
6373: "refentrytitle">cat</span>(1)</span></a>, and order of
6374: things is important.</p>
1.1 grant 6375: </div>
6376:
6377: <div class="sect1" lang="en" xml:lang="en">
6378: <div class="titlepage">
6379: <div>
6380: <div>
6381: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 6382: "id2628633" id="id2628633"></a>9.7. Platform
1.1 grant 6383: specific and differing PLISTs</h2>
6384: </div>
6385: </div>
6386: </div>
6387:
6388: <p>Some packages decide to install a different set of
6389: files based on the operating system being used. These
6390: differences can be automatically handled by using the
6391: following files:</p>
6392:
6393: <div class="itemizedlist">
6394: <ul type="disc">
6395: <li>
1.14 xtraeme 6396: <p><code class="filename">PLIST.common</code></p>
1.1 grant 6397: </li>
6398:
6399: <li>
1.14 xtraeme 6400: <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1 grant 6401: </li>
6402:
6403: <li>
1.14 xtraeme 6404: <p><code class=
1.21 ben 6405: "filename">PLIST.${MACHINE_ARCH}</code></p>
6406: </li>
6407:
6408: <li>
6409: <p><code class=
6410: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
6411: </li>
6412:
6413: <li>
6414: <p><code class=
1.14 xtraeme 6415: "filename">PLIST.common_end</code></p>
1.1 grant 6416: </li>
6417: </ul>
6418: </div>
6419: </div>
6420:
6421: <div class="sect1" lang="en" xml:lang="en">
6422: <div class="titlepage">
6423: <div>
6424: <div>
6425: <h2 class="title" style="clear: both"><a name=
6426: "faq.common-dirs" id=
1.25 rillig 6427: "faq.common-dirs"></a>9.8. Sharing directories
1.1 grant 6428: between packages</h2>
6429: </div>
6430: </div>
6431: </div>
6432:
6433: <p>A “<span class="quote">shared
6434: directory</span>” is a directory where multiple
6435: (and unrelated) packages install files. These directories
6436: are problematic because you have to add special tricks in
6437: the PLIST to conditionally remove them, or have some
6438: centralized package handle them.</p>
6439:
6440: <p>Within pkgsrc, you'll find both approaches. If a
6441: directory is shared by a few unrelated packages, it's
6442: often not worth to add an extra package to remove it.
6443: Therefore, one simply does:</p>
6444: <pre class="programlisting">
6445: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
6446:
6447: </pre>
6448:
6449: <p>in the PLISTs of all affected packages, instead of the
6450: regular "@dirrm" line.</p>
6451:
6452: <p>However, if the directory is shared across many
6453: packages, two different solutions are available:</p>
6454:
6455: <div class="orderedlist">
6456: <ol type="1">
6457: <li>
6458: <p>If the packages have a common dependency, the
6459: directory can be removed in that. For example, see
6460: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
6461: href=
6462: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20 ben 6463: class="pkgname">textproc/scrollkeeper</a>, which
6464: removes the shared directory <code class=
6465: "filename">share/omf</code>.</p>
1.1 grant 6466: </li>
6467:
6468: <li>
6469: <p>If the packages using the directory are not
6470: related at all (they have no common dependencies),
6471: a *-dirs package is used.</p>
6472: </li>
6473: </ol>
6474: </div>
6475:
6476: <p>From now on, we'll discuss the second solution. To get
6477: an idea of the *-dirs packages available, issue:</p>
6478: <pre class="programlisting">
1.14 xtraeme 6479: <code class="prompt">%</code> cd .../pkgsrc
6480: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 6481:
6482: </pre>
6483:
6484: <p>Their use from other packages is very simple. The
1.14 xtraeme 6485: <code class="varname">USE_DIRS</code> variable takes a
6486: list of package names (without the “<span class=
1.1 grant 6487: "quote">-dirs</span>” part) together with the
6488: required version number (always pick the latest one when
6489: writting new packages).</p>
6490:
6491: <p>For example, if a package installs files under
1.14 xtraeme 6492: <code class="filename">share/applications</code>, it
6493: should have the following line in it:</p>
1.1 grant 6494: <pre class="programlisting">
6495: USE_DIRS+= xdg-1.1
6496:
6497: </pre>
6498:
1.14 xtraeme 6499: <p>After regenerating the PLIST using
6500: <span><strong class="command">make
6501: print-PLIST</strong></span>, you should get the right
6502: (commented out) lines.</p>
1.1 grant 6503:
1.14 xtraeme 6504: <p>Note that, even if your package is using <code class=
6505: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 6506: *-x11-dirs packages. Just specify the name without that
1.14 xtraeme 6507: part and pkgsrc (in particular, <code class=
6508: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 6509: </div>
6510: </div>
6511:
6512: <div class="chapter" lang="en" xml:lang="en">
6513: <div class="titlepage">
6514: <div>
6515: <div>
6516: <h2 class="title"><a name="buildlink" id=
1.25 rillig 6517: "buildlink"></a>Chapter 10. Buildlink
1.1 grant 6518: methodology</h2>
6519: </div>
6520: </div>
6521: </div>
6522:
6523: <div class="toc">
6524: <p><b>Table of Contents</b></p>
6525:
6526: <dl>
1.26 ! wiz 6527: <dt><span class="sect1"><a href="#id2628968">10.1.
1.1 grant 6528: Converting packages to use buildlink3</a></span></dt>
6529:
1.26 ! wiz 6530: <dt><span class="sect1"><a href="#id2629149">10.2.
1.14 xtraeme 6531: Writing <code class="filename">buildlink3.mk</code>
6532: files</a></span></dt>
1.1 grant 6533:
6534: <dd>
6535: <dl>
1.25 rillig 6536: <dt><span class="sect2"><a href=
1.26 ! wiz 6537: "#id2629219">10.2.1. Anatomy of a buildlink3.mk
1.25 rillig 6538: file</a></span></dt>
1.1 grant 6539:
1.25 rillig 6540: <dt><span class="sect2"><a href=
1.26 ! wiz 6541: "#id2629796">10.2.2. Updating <code class=
1.14 xtraeme 6542: "varname">BUILDLINK_DEPENDS.<em class=
6543: "replaceable"><code>pkg</code></em></code> in
6544: <code class="filename">buildlink3.mk</code>
1.1 grant 6545: files</a></span></dt>
6546: </dl>
6547: </dd>
6548:
1.26 ! wiz 6549: <dt><span class="sect1"><a href="#id2629943">10.3.
1.14 xtraeme 6550: Writing <code class="filename">builtin.mk</code>
6551: files</a></span></dt>
1.1 grant 6552:
6553: <dd>
6554: <dl>
1.25 rillig 6555: <dt><span class="sect2"><a href=
1.26 ! wiz 6556: "#id2630024">10.3.1. Anatomy of a <code class=
1.14 xtraeme 6557: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 6558:
1.25 rillig 6559: <dt><span class="sect2"><a href=
1.26 ! wiz 6560: "#id2630183">10.3.2. Global preferences for native
1.25 rillig 6561: or pkgsrc software</a></span></dt>
1.1 grant 6562: </dl>
6563: </dd>
6564: </dl>
6565: </div>
6566:
6567: <p>Buildlink is a framework in pkgsrc that controls what
6568: headers and libraries are seen by a package's configure and
6569: build processes. This is implemented in a two step
6570: process:</p>
6571:
6572: <div class="orderedlist">
6573: <ol type="1">
6574: <li>
6575: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 6576: into <code class="varname">BUILDLINK_DIR</code>,
6577: which by default is a subdirectory of <code class=
6578: "varname">WRKDIR</code>.</p>
1.1 grant 6579: </li>
6580:
6581: <li>
6582: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 6583: the normal compiler tools that translate <code class=
6584: "option">-I${LOCALBASE}/include</code> and
6585: <code class="option">-L${LOCALBASE}/lib</code> into
6586: references to <code class=
6587: "varname">BUILDLINK_DIR</code>. The wrapper scripts
6588: also make native compiler on some operating systems
6589: look like GCC, so that packages that expect GCC won't
6590: require modifications to build with those native
6591: compilers.</p>
1.1 grant 6592: </li>
6593: </ol>
6594: </div>
6595:
6596: <p>This normalizes the environment in which a package is
6597: built so that the package may be built consistently despite
6598: what other software may be installed. Please note that the
1.14 xtraeme 6599: normal system header and library paths, e.g. <code class=
6600: "filename">/usr/include</code>, <code class=
6601: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 6602: buildlink3 is designed to insulate the package build from
6603: non-system-supplied software.</p>
6604:
6605: <div class="sect1" lang="en" xml:lang="en">
6606: <div class="titlepage">
6607: <div>
6608: <div>
6609: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 6610: "id2628968" id=
! 6611: "id2628968"></a>10.1. Converting packages to
1.25 rillig 6612: use buildlink3</h2>
1.1 grant 6613: </div>
6614: </div>
6615: </div>
6616:
6617: <p>The process of converting packages to use the
6618: buildlink3 framework (“<span class=
6619: "quote">bl3ifying</span>”) is fairly
6620: straightforward. The things to keep in mind are:</p>
6621:
6622: <div class="orderedlist">
6623: <ol type="1">
6624: <li>
6625: <p>Ensure that the build always calls the wrapper
6626: scripts instead of the actual toolchain. Some
6627: packages are tricky, and the only way to know for
1.14 xtraeme 6628: sure is the check <code class=
6629: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 6630: wrappers are being invoked.</p>
6631: </li>
6632:
6633: <li>
1.14 xtraeme 6634: <p>Don't override <code class=
6635: "varname">PREFIX</code> from within the package
6636: Makefile, e.g. Java VMs, standalone shells, etc.,
6637: because the code to symlink files into <code class=
6638: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 6639: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 6640: <em class=
6641: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 6642: </li>
6643:
6644: <li>
6645: <p>Remember that <span class=
1.14 xtraeme 6646: "emphasis"><em>only</em></span> the <code class=
6647: "filename">buildlink3.mk</code> files that you list
1.1 grant 6648: in a package's Makefile are added as dependencies
6649: for that package.</p>
6650: </li>
6651: </ol>
6652: </div>
6653:
6654: <p>If a dependency on a particular package is required
6655: for its libraries and headers, then we replace:</p>
6656: <pre class="programlisting">
6657: DEPENDS+= foo>=1.1.0:../../category/foo
6658: </pre>
6659:
6660: <p>with</p>
6661: <pre class="programlisting">
6662: .include "../../category/foo/buildlink3.mk"
6663: </pre>
6664:
1.14 xtraeme 6665: <p>There are several <code class=
6666: "filename">buildlink3.mk</code> files in <code class=
6667: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 6668: issues:</p>
6669:
6670: <div class="itemizedlist">
6671: <ul type="disc">
6672: <li>
1.14 xtraeme 6673: <p><code class="filename">bdb.buildlink3.mk</code>
1.1 grant 6674: chooses either the native or a pkgsrc Berkeley DB
1.14 xtraeme 6675: implementation based on the values of <code class=
6676: "varname">BDB_ACCEPTED</code> and <code class=
6677: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 6678: </li>
6679:
6680: <li>
1.14 xtraeme 6681: <p><code class=
6682: "filename">curses.buildlink3.mk</code> If the
6683: system comes with neither Curses nor NCurses, this
6684: will take care to install the <a xmlns=
6685: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 6686: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20 ben 6687: class="pkgname">devel/ncurses</a> package.</p>
1.1 grant 6688: </li>
6689:
6690: <li>
1.14 xtraeme 6691: <p><code class="filename">krb5.buildlink3.mk</code>
6692: uses the value of <code class=
6693: "varname">KRB5_ACCEPTED</code> to choose between
1.1 grant 6694: adding a dependency on Heimdal or MIT-krb5 for
6695: packages that require a Kerberos 5
6696: implementation.</p>
6697: </li>
6698:
6699: <li>
1.14 xtraeme 6700: <p><code class=
6701: "filename">motif.buildlink3.mk</code> checks for a
6702: system-provided Motif installation or adds a
6703: dependency on <a xmlns=
1.1 grant 6704: "http://www.w3.org/TR/xhtml1/transitional" href=
6705: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20 ben 6706: class="pkgname">x11/lesstif</a> or <a xmlns=
6707: "http://www.w3.org/TR/xhtml1/transitional" href=
6708: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
6709: class="pkgname">x11/openmotif</a>;</p>
1.1 grant 6710: </li>
6711:
6712: <li>
1.14 xtraeme 6713: <p><code class=
6714: "filename">ossaudio.buildlink3.mk</code> defines
6715: several variables that may be used by packages that
6716: use the Open Sound System (OSS) API;</p>
1.1 grant 6717: </li>
6718:
6719: <li>
1.14 xtraeme 6720: <p><code class=
6721: "filename">pgsql.buildlink3.mk</code> will accept
6722: either Postgres 7.3 or 7.4, whichever is found
6723: installed. See the file for more information.</p>
1.1 grant 6724: </li>
6725:
6726: <li>
1.14 xtraeme 6727: <p><code class=
6728: "filename">pthread.buildlink3.mk</code> uses the
6729: value of <code class="varname">PTHREAD_OPTS</code>
6730: and checks for native pthreads or adds a dependency
6731: on <a xmlns=
1.1 grant 6732: "http://www.w3.org/TR/xhtml1/transitional" href=
6733: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20 ben 6734: class="pkgname">devel/pth</a> as needed;</p>
1.1 grant 6735: </li>
6736:
6737: <li>
1.14 xtraeme 6738: <p><code class="filename">xaw.buildlink3.mk</code>
6739: uses the value of <code class=
6740: "varname">XAW_TYPE</code> to choose a particular
6741: Athena widgets library.</p>
1.1 grant 6742: </li>
6743: </ul>
6744: </div>
6745:
1.14 xtraeme 6746: <p>The comments in those <code class=
6747: "filename">buildlink3.mk</code> files provide a more
1.1 grant 6748: complete description of how to use them properly.</p>
6749: </div>
6750:
6751: <div class="sect1" lang="en" xml:lang="en">
6752: <div class="titlepage">
6753: <div>
6754: <div>
6755: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 6756: "id2629149" id="id2629149"></a>10.2. Writing
1.14 xtraeme 6757: <code class="filename">buildlink3.mk</code>
6758: files</h2>
1.1 grant 6759: </div>
6760: </div>
6761: </div>
6762:
1.14 xtraeme 6763: <p>A package's <code class=
6764: "filename">buildlink3.mk</code> file is included by
6765: Makefiles to indicate the need to compile and link
6766: against header files and libraries provided by the
6767: package. A <code class="filename">buildlink3.mk</code>
6768: file should always provide enough information to add the
6769: correct type of dependency relationship and include any
6770: other <code class="filename">buildlink3.mk</code> files
6771: that it needs to find headers and libraries that it needs
6772: in turn.</p>
1.1 grant 6773:
1.14 xtraeme 6774: <p>To generate an initial <code class=
6775: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 6776: Rene Hexel's <a xmlns=
6777: "http://www.w3.org/TR/xhtml1/transitional" href=
6778: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20 ben 6779: class="pkgname">pkgtools/createbuildlink</a> package is
6780: highly recommended. For most packages, the following
6781: command will generate a good starting point for
6782: <code class="filename">buildlink3.mk</code> files:</p>
1.1 grant 6783: <pre class="screen">
1.14 xtraeme 6784: <code class="prompt">%</code> <strong class=
6785: "userinput"><code>cd pkgsrc/<em class=
6786: "replaceable"><code>category</code></em>/<em class=
6787: "replaceable"><code>pkgdir</code></em>
6788: <code class=
6789: "prompt">%</code> createbuildlink -3 >buildlink3.mk</code></strong>
1.1 grant 6790: </pre>
6791:
6792: <div class="sect2" lang="en" xml:lang="en">
6793: <div class="titlepage">
6794: <div>
6795: <div>
1.26 ! wiz 6796: <h3 class="title"><a name="id2629219" id=
! 6797: "id2629219"></a>10.2.1. Anatomy of a
1.25 rillig 6798: buildlink3.mk file</h3>
1.1 grant 6799: </div>
6800: </div>
6801: </div>
6802:
1.14 xtraeme 6803: <p>The following real-life example <code class=
6804: "filename">buildlink3.mk</code> is taken from
6805: <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 6806: <pre class="programlisting">
1.17 sketch 6807: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 6808:
6809: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
6810: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
6811:
6812: .if !empty(BUILDLINK_DEPTH:M+)
6813: BUILDLINK_DEPENDS+= tiff
6814: .endif
6815:
6816: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
6817: BUILDLINK_PACKAGES+= tiff
6818:
6819: .if !empty(TIFF_BUILDLINK3_MK:M+)
6820: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
6821: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
6822: .endif # TIFF_BUILDLINK3_MK
6823:
6824: .include "../../devel/zlib/buildlink3.mk"
6825: .include "../../graphics/jpeg/buildlink3.mk"
6826:
6827: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
6828: </pre>
6829:
1.14 xtraeme 6830: <p>The header and footer manipulate <code class=
6831: "varname">BUILDLINK_DEPTH</code>, which is common
6832: across all <code class="filename">buildlink3.mk</code>
6833: files and is used to track at what depth we are
6834: including <code class="filename">buildlink3.mk</code>
6835: files.</p>
1.1 grant 6836:
6837: <p>The first section controls if the dependency on
1.14 xtraeme 6838: <em class="replaceable"><code>pkg</code></em> is added.
6839: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 6840: global list of packages for which dependencies are
6841: added by buildlink3.</p>
6842:
6843: <p>The second section advises pkgsrc that the
1.14 xtraeme 6844: <code class="filename">buildlink3.mk</code> file for
6845: <em class="replaceable"><code>pkg</code></em> has been
6846: included at some point. <code class=
6847: "varname">BUILDLINK_PACKAGES</code> is the global list
6848: of packages for which <code class=
6849: "filename">buildlink3.mk</code> files have been
6850: included. It must <span class=
6851: "emphasis"><em>always</em></span> be appended to within
6852: a <code class="filename">buildlink3.mk</code> file.</p>
1.1 grant 6853:
6854: <p>The third section is protected from multiple
1.14 xtraeme 6855: inclusion and controls how the dependency on <em class=
6856: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 6857: important variables are set in the section:</p>
6858:
6859: <div class="itemizedlist">
6860: <ul type="disc">
6861: <li>
1.14 xtraeme 6862: <p><code class=
6863: "varname">BUILDLINK_DEPENDS.<em class=
6864: "replaceable"><code>pkg</code></em></code> is the
6865: actual dependency recorded in the installed
6866: package; this should always be set using
6867: <span><strong class="command">+=</strong></span>
6868: to ensure that we're appending to any
6869: pre-existing list of values. This variable should
6870: be set to the first version of the package that
6871: had the last change in the major number of a
6872: shared library or that had a major API
6873: change.</p>
1.1 grant 6874: </li>
6875:
6876: <li>
1.14 xtraeme 6877: <p><code class=
6878: "varname">BUILDLINK_PKGSRCDIR.<em class=
6879: "replaceable"><code>pkg</code></em></code> is the
6880: location of the <em class=
6881: "replaceable"><code>pkg</code></em> pkgsrc
1.1 grant 6882: directory;</p>
6883: </li>
6884:
6885: <li>
1.14 xtraeme 6886: <p><code class=
6887: "varname">BUILDLINK_DEPMETHOD.<em class=
6888: "replaceable"><code>pkg</code></em></code> (not
6889: shown above) controls whether we use <code class=
6890: "varname">BUILD_DEPENDS</code> or <code class=
6891: "varname">DEPENDS</code> to add the dependency on
6892: <em class="replaceable"><code>pkg</code></em>.
6893: The build dependency is selected by setting
6894: <code class=
6895: "varname">BUILDLINK_DEPMETHOD.<em class=
6896: "replaceable"><code>pkg</code></em></code> to
1.1 grant 6897: “<span class="quote">build</span>”.
6898: By default, the full dependency is used.</p>
6899: </li>
6900:
6901: <li>
1.14 xtraeme 6902: <p><code class=
6903: "varname">BUILDLINK_INCDIRS.<em class=
6904: "replaceable"><code>pkg</code></em></code> and
6905: <code class=
6906: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
6907: <code>pkg</code></em></code> (not shown above)
6908: are lists of subdirectories of <code class=
6909: "filename">${BUILDLINK_PREFIX.<em class=
6910: "replaceable"><code>pkg</code></em>}</code> to
6911: add to the header and library search paths. These
1.1 grant 6912: default to “<span class=
6913: "quote">include</span>” and
6914: “<span class="quote">lib</span>”
6915: respectively.</p>
6916: </li>
6917:
6918: <li>
1.14 xtraeme 6919: <p><code class=
6920: "varname">BUILDLINK_CPPFLAGS.<em class=
6921: "replaceable"><code>pkg</code></em></code> (not
6922: shown above) is the list of preprocessor flags to
6923: add to <code class="varname">CPPFLAGS</code>,
6924: which are passed on to the configure and build
6925: phases. The “<span class=
6926: "quote">-I</span>” option should be avoided
6927: and instead be handled using <code class=
6928: "varname">BUILDLINK_INCDIRS.<em class=
6929: "replaceable"><code>pkg</code></em></code> as
6930: above.</p>
1.1 grant 6931: </li>
6932: </ul>
6933: </div>
6934:
6935: <p>The following variables are all optionally defined
6936: within this second section (protected against multiple
6937: inclusion) and control which package files are
1.14 xtraeme 6938: symlinked into <code class=
6939: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 6940: are transformed during the symlinking:</p>
6941:
6942: <div class="itemizedlist">
6943: <ul type="disc">
6944: <li>
1.14 xtraeme 6945: <p><code class=
6946: "varname">BUILDLINK_FILES.<em class=
6947: "replaceable"><code>pkg</code></em></code> (not
6948: shown above) is a shell glob pattern relative to
6949: <code class=
6950: "filename">${BUILDLINK_PREFIX.<em class=
6951: "replaceable"><code>pkg</code></em>}</code> to be
6952: symlinked into <code class=
6953: "filename">${BUILDLINK_DIR}</code>, e.g.
6954: <code class="filename">include/*.h</code>.</p>
1.1 grant 6955: </li>
6956:
6957: <li>
1.14 xtraeme 6958: <p><code class=
6959: "varname">BUILDLINK_FILES_CMD.<em class=
6960: "replaceable"><code>pkg</code></em></code> (not
6961: shown above) is a shell pipeline that outputs to
6962: stdout a list of files relative to <code class=
6963: "filename">${BUILDLINK_PREFIX.<em class=
6964: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 6965: resulting files are to be symlinked into
1.14 xtraeme 6966: <code class="filename">${BUILDLINK_DIR}</code>.
6967: By default, this takes the <code class=
6968: "filename">+CONTENTS</code> of a <em class=
6969: "replaceable"><code>pkg</code></em> and filters
6970: it through <code class=
6971: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
6972: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 6973: </li>
6974:
6975: <li>
1.14 xtraeme 6976: <p><code class=
6977: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
6978: "replaceable"><code>pkg</code></em></code> (not
6979: shown above) is a filter command that filters
6980: <code class="filename">+CONTENTS</code> input
6981: into a list of files relative to <code class=
6982: "filename">${BUILDLINK_PREFIX.<em class=
6983: "replaceable"><code>pkg</code></em>}</code> on
6984: stdout. By default for overwrite packages,
6985: <code class=
6986: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
6987: "replaceable"><code>pkg</code></em></code>
6988: outputs the contents of the <code class=
6989: "filename">include</code> and <code class=
6990: "filename">lib</code> directories in the package
6991: <code class="filename">+CONTENTS</code>, and for
6992: pkgviews packages, it outputs any libtool
6993: archives in <code class="filename">lib</code>
1.1 grant 6994: directories.</p>
6995: </li>
6996:
6997: <li>
1.14 xtraeme 6998: <p><code class=
6999: "varname">BUILDLINK_TRANSFORM.<em class=
7000: "replaceable"><code>pkg</code></em></code> (not
7001: shown above) is a list of sed arguments used to
1.1 grant 7002: transform the name of the source filename into a
1.14 xtraeme 7003: destination filename, e.g. <span><strong class=
1.1 grant 7004: "command">-e
1.14 xtraeme 7005: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 7006: </li>
7007: </ul>
7008: </div>
7009:
1.14 xtraeme 7010: <p>The last section includes any <code class=
7011: "filename">buildlink3.mk</code> needed for <em class=
7012: "replaceable"><code>pkg</code></em>'s library
7013: dependencies. Including these <code class=
7014: "filename">buildlink3.mk</code> files means that the
7015: headers and libraries for these dependencies are also
7016: symlinked into <code class=
7017: "filename">${BUILDLINK_DIR}</code> whenever the
7018: <em class="replaceable"><code>pkg</code></em>
7019: <code class="filename">buildlink3.mk</code> file is
7020: included.</p>
1.1 grant 7021: </div>
7022:
7023: <div class="sect2" lang="en" xml:lang="en">
7024: <div class="titlepage">
7025: <div>
7026: <div>
1.26 ! wiz 7027: <h3 class="title"><a name="id2629796" id=
! 7028: "id2629796"></a>10.2.2. Updating <code class=
1.14 xtraeme 7029: "varname">BUILDLINK_DEPENDS.<em class=
7030: "replaceable"><code>pkg</code></em></code> in
7031: <code class="filename">buildlink3.mk</code>
7032: files</h3>
1.1 grant 7033: </div>
7034: </div>
7035: </div>
7036:
7037: <p>There are two situations that require increasing the
1.14 xtraeme 7038: dependency listed in <code class=
7039: "varname">BUILDLINK_DEPENDS.<em class=
7040: "replaceable"><code>pkg</code></em></code> after a
7041: package update:</p>
1.1 grant 7042:
7043: <div class="orderedlist">
7044: <ol type="1">
7045: <li>
7046: <p>if the sonames (major number of the library
7047: version) of any installed shared libraries
7048: change;</p>
7049: </li>
7050:
7051: <li>
7052: <p>if the API or interface to the header files
7053: change.</p>
7054: </li>
7055: </ol>
7056: </div>
7057:
1.14 xtraeme 7058: <p>In these cases, <code class=
7059: "varname">BUILDLINK_DEPENDS.<em class=
7060: "replaceable"><code>pkg</code></em></code> should be
7061: adjusted to require at least the new package version.
7062: In some cases, the packages that depend on this new
7063: version may need their <code class=
7064: "varname">PKGREVISION</code>s increased and, if they
7065: have <code class="filename">buildlink3.mk</code> files,
7066: their <code class=
7067: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
7068: pkg</code></em></code> adjusted, too. This is needed so
7069: that binary packages made using it will require the
7070: correct package dependency and not settle for an older
7071: one which will not contain the necessary shared
7072: libraries.</p>
1.1 grant 7073:
7074: <p>Please take careful consideration before adjusting
1.14 xtraeme 7075: <code class="varname">BUILDLINK_DEPENDS.<em class=
7076: "replaceable"><code>pkg</code></em></code> as we don't
7077: want to cause unneeded package deletions and rebuilds.
7078: In many cases, new versions of packages work just fine
7079: with older dependencies. See <a href="#dependencies"
1.25 rillig 7080: title="13.1.3. Handling dependencies">Section
7081: 13.1.3, “Handling dependencies”</a> and
1.14 xtraeme 7082: <a href="#buildlink" title=
1.25 rillig 7083: "Chapter 10. Buildlink methodology">Chapter
7084: 10, <i>Buildlink methodology</i></a> for more
7085: information about dependencies on other packages,
7086: including the <code class=
7087: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
7088: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 7089: </div>
7090: </div>
7091:
7092: <div class="sect1" lang="en" xml:lang="en">
7093: <div class="titlepage">
7094: <div>
7095: <div>
7096: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 7097: "id2629943" id="id2629943"></a>10.3. Writing
1.14 xtraeme 7098: <code class="filename">builtin.mk</code> files</h2>
1.1 grant 7099: </div>
7100: </div>
7101: </div>
7102:
7103: <p>Some packages in pkgsrc install headers and libraries
7104: that coincide with headers and libraries present in the
1.14 xtraeme 7105: base system. Aside from a <code class=
7106: "filename">buildlink3.mk</code> file, these packages
7107: should also include a <code class=
7108: "filename">builtin.mk</code> file that includes the
7109: necessary checks to decide whether using the built-in
7110: software or the pkgsrc software is appropriate.</p>
1.1 grant 7111:
7112: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 7113: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 7114:
7115: <div class="orderedlist">
7116: <ol type="1">
7117: <li>
1.14 xtraeme 7118: <p>It should set <code class=
7119: "varname">USE_BUILTIN.<em class=
7120: "replaceable"><code>pkg</code></em></code> to
7121: either “<span class="quote">yes</span>”
7122: or “<span class="quote">no</span>”
7123: after it is included.</p>
1.1 grant 7124: </li>
7125:
7126: <li>
7127: <p>It should <span class=
7128: "emphasis"><em>not</em></span> override any
1.14 xtraeme 7129: <code class="varname">USE_BUILTIN.<em class=
7130: "replaceable"><code>pkg</code></em></code> which is
7131: already set before the <code class=
7132: "filename">builtin.mk</code> file is included.</p>
1.1 grant 7133: </li>
7134:
7135: <li>
7136: <p>It should be written to allow multiple
7137: inclusion. This is <span class=
7138: "emphasis"><em>very</em></span> important and takes
1.14 xtraeme 7139: careful attention to <code class=
7140: "filename">Makefile</code> coding.</p>
1.1 grant 7141: </li>
7142: </ol>
7143: </div>
7144:
7145: <div class="sect2" lang="en" xml:lang="en">
7146: <div class="titlepage">
7147: <div>
7148: <div>
1.26 ! wiz 7149: <h3 class="title"><a name="id2630024" id=
! 7150: "id2630024"></a>10.3.1. Anatomy of a
1.14 xtraeme 7151: <code class="filename">builtin.mk</code>
7152: file</h3>
1.1 grant 7153: </div>
7154: </div>
7155: </div>
7156:
7157: <p>The following is the recommended template for
7158: builtin.mk files:</p>
7159: <pre class="programlisting">
7160: .if !defined(IS_BUILTIN.foo)
7161: #
7162: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
7163: # genuinely exists in the system or not.
7164: #
7165: IS_BUILTIN.foo?= no
7166:
7167: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
7168: # version can be determined.
7169: #
7170: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
7171: BUILTIN_PKG.foo?= foo-1.0
7172: . endif
7173: .endif # IS_BUILTIN.foo
7174:
7175: .if !defined(USE_BUILTIN.foo)
7176: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
7177: . if defined(BUILTIN_PKG.foo)
7178: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
7179: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
7180: USE_BUILTIN.foo!= \
7181: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
7182: ${ECHO} "yes"; \
7183: else \
7184: ${ECHO} "no"; \
7185: fi
7186: . endif
7187: . endfor
7188: . endif
7189: .endif # USE_BUILTIN.foo
7190:
7191: CHECK_BUILTIN.foo?= no
7192: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
7193: #
7194: # Here we place code that depends on whether USE_BUILTIN.foo is set to
7195: # "yes" or "no".
7196: #
7197: .endif # CHECK_BUILTIN.foo
7198:
7199: </pre>
7200:
1.14 xtraeme 7201: <p>The first section sets <code class=
7202: "varname">IS_BUILTIN.<em class=
7203: "replaceable"><code>pkg</code></em></code> depending on
7204: if <em class="replaceable"><code>pkg</code></em> really
7205: exists in the base system. This should not be a base
7206: system software with similar functionality to
7207: <em class="replaceable"><code>pkg</code></em>; it
7208: should only be “<span class=
7209: "quote">yes</span>” if the actual package is
7210: included as part of the base system. This variable is
7211: only used internally within the <code class=
7212: "filename">builtin.mk</code> file.</p>
7213:
7214: <p>The second section sets <code class=
7215: "varname">BUILTIN_PKG.<em class=
7216: "replaceable"><code>pkg</code></em></code> to the
7217: version of <em class=
7218: "replaceable"><code>pkg</code></em> in the base system
7219: if it exists (if <code class=
7220: "varname">IS_BUILTIN.<em class=
7221: "replaceable"><code>pkg</code></em></code> is
1.1 grant 7222: “<span class="quote">yes</span>”). This
1.14 xtraeme 7223: variable is only used internally within the
7224: <code class="filename">builtin.mk</code> file.</p>
1.1 grant 7225:
1.14 xtraeme 7226: <p>The third section sets <code class=
7227: "varname">USE_BUILTIN.<em class=
7228: "replaceable"><code>pkg</code></em></code> and is
7229: <span class="emphasis"><em>required</em></span> in all
7230: <code class="filename">builtin.mk</code> files. The
7231: code in this section must make the determination
7232: whether the built-in software is adequate to satisfy
7233: the dependencies listed in <code class=
7234: "varname">BUILDLINK_DEPENDS.<em class=
7235: "replaceable"><code>pkg</code></em></code>. This is
7236: typically done by comparing <code class=
7237: "varname">BUILTIN_PKG.<em class=
7238: "replaceable"><code>pkg</code></em></code> against each
7239: of the dependencies in <code class=
7240: "varname">BUILDLINK_DEPENDS.<em class=
7241: "replaceable"><code>pkg</code></em></code>.
7242: <code class="varname">USE_BUILTIN.<em class=
7243: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 7244: "emphasis"><em>must</em></span> be set to the correct
1.14 xtraeme 7245: value by the end of the <code class=
7246: "filename">builtin.mk</code> file. Note that
7247: <code class="varname">USE_BUILTIN.<em class=
7248: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 7249: “<span class="quote">yes</span>” even if
1.14 xtraeme 7250: <code class="varname">IS_BUILTIN.<em class=
7251: "replaceable"><code>pkg</code></em></code> is
1.1 grant 7252: “<span class="quote">no</span>” because we
7253: may make the determination that the built-in version of
7254: the software is similar enough to be used as a
7255: replacement.</p>
7256:
1.14 xtraeme 7257: <p>The last section is guarded by <code class=
7258: "varname">CHECK_BUILTIN.<em class=
7259: "replaceable"><code>pkg</code></em></code>, and
7260: includes code that uses the value of <code class=
7261: "varname">USE_BUILTIN.<em class=
7262: "replaceable"><code>pkg</code></em></code> set in the
7263: previous section. This typically includes, e.g., adding
1.1 grant 7264: additional dependency restrictions and listing
1.14 xtraeme 7265: additional files to symlink into <code class=
7266: "filename">${BUILDLINK_DIR}</code> (via <code class=
7267: "varname">BUILDLINK_FILES.<em class=
7268: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 7269: </div>
7270:
7271: <div class="sect2" lang="en" xml:lang="en">
7272: <div class="titlepage">
7273: <div>
7274: <div>
1.26 ! wiz 7275: <h3 class="title"><a name="id2630183" id=
! 7276: "id2630183"></a>10.3.2. Global preferences
1.1 grant 7277: for native or pkgsrc software</h3>
7278: </div>
7279: </div>
7280: </div>
7281:
7282: <p>When building packages, it's possible to choose
7283: whether to set a global preference for using either the
7284: built-in (native) version or the pkgsrc version of
7285: software to satisfy a dependency. This is controlled by
1.14 xtraeme 7286: setting <code class="varname">PREFER_PKGSRC</code> and
7287: <code class="varname">PREFER_NATIVE</code>. These
7288: variables take values of either “<span class=
1.1 grant 7289: "quote">yes</span>”, “<span class=
7290: "quote">no</span>”, or a list of packages.
1.14 xtraeme 7291: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
7292: to use the pkgsrc versions of software, while
7293: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
7294: to use the built-in versions. Preferences are
7295: determined by the most specific instance of the package
7296: in either <code class="varname">PREFER_PKGSRC</code> or
7297: <code class="varname">PREFER_NATIVE</code>. If a
7298: package is specified in neither or in both variables,
7299: then <code class="varname">PREFER_PKGSRC</code> has
7300: precedence over <code class=
7301: "varname">PREFER_NATIVE</code>. For example, to require
7302: using pkgsrc versions of software for all but the most
7303: basic bits on a NetBSD system, you can set:</p>
1.1 grant 7304: <pre class="programlisting">
7305: PREFER_PKGSRC= yes
7306: PREFER_NATIVE= getopt skey tcp_wrappers
7307:
7308: </pre>
7309:
7310: <p>A package <span class=
1.14 xtraeme 7311: "emphasis"><em>must</em></span> have a <code class=
7312: "filename">builtin.mk</code> file to be listed in
7313: <code class="varname">PREFER_NATIVE</code>, otherwise
7314: it is simply ignored in that list.</p>
1.1 grant 7315: </div>
7316: </div>
7317: </div>
7318:
7319: <div class="chapter" lang="en" xml:lang="en">
7320: <div class="titlepage">
7321: <div>
7322: <div>
7323: <h2 class="title"><a name="options" id=
1.25 rillig 7324: "options"></a>Chapter 11. Options
1.1 grant 7325: handling</h2>
7326: </div>
7327: </div>
7328: </div>
7329:
7330: <div class="toc">
7331: <p><b>Table of Contents</b></p>
7332:
7333: <dl>
1.26 ! wiz 7334: <dt><span class="sect1"><a href="#id2630256">11.1.
1.1 grant 7335: Global default options</a></span></dt>
7336:
1.26 ! wiz 7337: <dt><span class="sect1"><a href="#id2630270">11.2.
1.14 xtraeme 7338: Converting packages to use <code class=
7339: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 7340: </dl>
7341: </div>
7342:
7343: <p>Many packages have the ability to be built to support
1.14 xtraeme 7344: different sets of features. <code class=
7345: "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1 grant 7346: that provides generic handling of those options that
7347: determine different ways in which the packages can be
7348: built. It's possible for the user to specify exactly which
7349: sets of options will be built into a package or to allow a
7350: set of global default options apply.</p>
7351:
7352: <div class="sect1" lang="en" xml:lang="en">
7353: <div class="titlepage">
7354: <div>
7355: <div>
7356: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 7357: "id2630256" id="id2630256"></a>11.1. Global
1.1 grant 7358: default options</h2>
7359: </div>
7360: </div>
7361: </div>
7362:
1.14 xtraeme 7363: <p>Global default options are listed in <code class=
7364: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1 grant 7365: the options that should be built into every package if
7366: that option is supported. This variable should be set in
1.14 xtraeme 7367: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 7368: </div>
7369:
7370: <div class="sect1" lang="en" xml:lang="en">
7371: <div class="titlepage">
7372: <div>
7373: <div>
7374: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 7375: "id2630270" id=
! 7376: "id2630270"></a>11.2. Converting packages to
1.14 xtraeme 7377: use <code class=
7378: "filename">bsd.options.mk</code></h2>
1.1 grant 7379: </div>
7380: </div>
7381: </div>
7382:
1.14 xtraeme 7383: <p>The following example shows how <code class=
1.23 wiz 7384: "filename">bsd.options.mk</code> should be used in a
1.14 xtraeme 7385: package <code class="filename">Makefile</code>, or in a
7386: file, e.g. <code class="filename">options.mk</code>, that
7387: is included by the main package <code class=
7388: "filename">Makefile</code>.</p>
1.1 grant 7389: <pre class="programlisting">
7390: # Global and legacy options
7391: .if defined(WIBBLE_USE_OPENLDAP) && !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
7392: PKG_DEFAULT_OPTIONS+= ldap
7393: .endif
7394: .if defined(USE_SASL2) && !empty(USE_SASL2:M[yY][eE][sS])
7395: PKG_DEFAULT_OPTIONS+= sasl
7396: .endif
7397:
7398: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
7399: PKG_SUPPORTED_OPTIONS= ldap sasl
7400: #
7401: # Default options for "wibble" package.
7402: #
7403: .if !defined(PKG_OPTIONS.wibble)
7404: PKG_DEFAULT_OPTIONS+= sasl
7405: endif
7406: .include "../../mk/bsd.options.mk"
7407:
7408: # Package-specific option-handling
7409:
7410: ###
7411: ### LDAP support
7412: ###
7413: .if !empty(PKG_OPTIONS:Mldap)
7414: . include "../../databases/openldap/buildlink3.mk"
7415: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
7416: .endif
7417:
7418: ###
7419: ### SASL authentication
7420: ###
7421: .if !empty(PKG_OPTIONS:Msasl)
7422: . include "../../security/cyrus-sasl2/buildlink3.mk"
7423: CONFIGURE_ARGS+= --enable-sasl=${BUILDLINK_PREFIX.sasl}
7424: .endif
7425:
7426: </pre>
7427:
7428: <p>The first section only exists if you are converting a
7429: package that had its own ad-hoc options handling to use
1.14 xtraeme 7430: <code class="filename">bsd.options.mk</code>. It converts
1.1 grant 7431: global or legacy options variables into an equivalent
1.14 xtraeme 7432: <code class="varname">PKG_OPTIONS.<em class=
7433: "replaceable"><code>pkg</code></em></code> value. These
7434: sections will be removed over time as the old options are
7435: in turn deprecated and removed.</p>
1.1 grant 7436:
7437: <p>The second section contains the information about
7438: which build options are supported by the package, and any
7439: default options settings if needed.</p>
7440:
7441: <div class="orderedlist">
7442: <ol type="1">
7443: <li>
1.14 xtraeme 7444: <p><code class="varname">PKG_OPTIONS_VAR</code> is
7445: a list of the name of the <a href=
1.1 grant 7446: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7447: <span class="citerefentry"><span class=
7448: "refentrytitle">make</span>(1)</span></a> variables
7449: that contain the options the user wishes to select.
7450: The recommended value is “<span class=
1.14 xtraeme 7451: "quote">PKG_OPTIONS.<em class=
7452: "replaceable"><code>pkg</code></em></span>”
7453: but any package-specific value may be used. This
1.1 grant 7454: variable should be set in a package Makefile.</p>
7455: </li>
7456:
7457: <li>
1.14 xtraeme 7458: <p><code class=
7459: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
7460: build options supported by the package. This
7461: variable should be set in a package Makefile.</p>
1.1 grant 7462: </li>
7463:
7464: <li>
1.14 xtraeme 7465: <p><code class="varname">${PKG_OPTIONS_VAR}</code>
7466: (the variables named in <code class=
7467: "varname">PKG_OPTIONS_VAR</code>) are variables
7468: that list the selected build options and override
7469: any default options given in <code class=
7470: "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1 grant 7471: options begin with a “<span class=
7472: "quote">-</span>”, then that option is always
7473: removed from the selected build options, e.g.</p>
7474: <pre class="programlisting">
7475: PKG_DEFAULT_OPTIONS= kerberos ldap sasl
7476: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
7477: WIBBLE_OPTIONS= ${PKG_DEFAULT_OPTIONS} -sasl
7478: # implies PKG_OPTIONS == "kerberos ldap"
7479:
7480: </pre>
7481:
7482: <p>or</p>
7483: <pre class="programlisting">
7484: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
7485: WIBBLE_OPTIONS= kerberos -ldap ldap
7486: # implies PKG_OPTIONS == "kerberos"
7487:
7488: </pre>
7489:
1.14 xtraeme 7490: <p>This variable should be set in <code class=
7491: "filename">/etc/mk.conf</code>.</p>
1.1 grant 7492: </li>
7493: </ol>
7494: </div>
7495:
7496: <p>After the inclusion of bsd.options.mk, the following
7497: variables are set:</p>
7498:
7499: <div class="itemizedlist">
7500: <ul type="disc">
7501: <li>
1.14 xtraeme 7502: <p><code class="varname">PKG_OPTIONS</code>
7503: contains the list of the selected build options,
7504: properly filtered to remove unsupported and
7505: duplicate options.</p>
1.1 grant 7506: </li>
7507: </ul>
7508: </div>
7509:
7510: <p>The remaining sections contain the logic that is
7511: specific to each option. There should be a check for
1.14 xtraeme 7512: every option listed in <code class=
7513: "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
7514: be clear documentation on what turning on the option will
7515: do in the comments preceding each section. The correct
7516: way to check for an option is to check whether it is
7517: listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1 grant 7518: </div>
7519: </div>
7520:
7521: <div class="chapter" lang="en" xml:lang="en">
7522: <div class="titlepage">
7523: <div>
7524: <div>
7525: <h2 class="title"><a name="build" id=
1.25 rillig 7526: "build"></a>Chapter 12. The build
1.1 grant 7527: process</h2>
7528: </div>
7529: </div>
7530: </div>
7531:
7532: <div class="toc">
7533: <p><b>Table of Contents</b></p>
7534:
7535: <dl>
1.25 rillig 7536: <dt><span class="sect1"><a href="#build.prefix">12.1.
1.1 grant 7537: Program location</a></span></dt>
7538:
1.26 ! wiz 7539: <dt><span class="sect1"><a href="#id2631098">12.2. Main
1.1 grant 7540: targets</a></span></dt>
7541:
7542: <dt><span class="sect1"><a href=
1.25 rillig 7543: "#build.helpful-targets">12.3. Other helpful
1.1 grant 7544: targets</a></span></dt>
7545: </dl>
7546: </div>
7547:
7548: <p>The basic steps for building a program are always the
7549: same. First the program's source (<span class=
7550: "emphasis"><em>distfile</em></span>) must be brought to the
7551: local system and then extracted. After any patches to
7552: compile properly on NetBSD are applied, the software can be
7553: configured, then built (usually by compiling), and finally
7554: the generated binaries, etc. can be put into place on the
7555: system. These are exactly the steps performed by the NetBSD
7556: package system, which is implemented as a series of targets
1.14 xtraeme 7557: in a central Makefile, <code class=
7558: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 7559:
7560: <div class="sect1" lang="en" xml:lang="en">
7561: <div class="titlepage">
7562: <div>
7563: <div>
7564: <h2 class="title" style="clear: both"><a name=
7565: "build.prefix" id=
1.25 rillig 7566: "build.prefix"></a>12.1. Program location</h2>
1.1 grant 7567: </div>
7568: </div>
7569: </div>
7570:
7571: <p>Before outlining the process performed by the NetBSD
7572: package system in the next section, here's a brief
7573: discussion on where programs are installed, and which
7574: variables influence this.</p>
7575:
1.14 xtraeme 7576: <p>The automatic variable <code class=
7577: "varname">PREFIX</code> indicates where all files of the
7578: final program shall be installed. It is usually set to
7579: <code class="varname">LOCALBASE</code> (<code class=
7580: "filename">/usr/pkg</code>), or <code class=
7581: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 7582: “<span class="quote">cross</span>” category.
1.14 xtraeme 7583: The value of <code class="varname">PREFIX</code> needs to
7584: be put into the various places in the program's source
7585: where paths to these files are encoded. See <a href=
1.1 grant 7586: "#components.patches" title=
1.25 rillig 7587: "8.3. patches/*">Section 8.3,
1.1 grant 7588: “patches/*”</a> and <a href="#fixes.libtool"
7589: title=
1.25 rillig 7590: "13.3.1. Shared libraries - libtool">Section 13.3.1,
1.1 grant 7591: “Shared libraries - libtool”</a> for more
7592: details.</p>
7593:
7594: <p>When choosing which of these variables to use, follow
7595: the following rules:</p>
7596:
7597: <div class="itemizedlist">
7598: <ul type="disc">
7599: <li>
1.14 xtraeme 7600: <p><code class="varname">PREFIX</code> always
7601: points to the location where the current pkg will
7602: be installed. When referring to a pkg's own
1.1 grant 7603: installation path, use “<span class=
7604: "quote">${PREFIX}</span>”.</p>
7605: </li>
7606:
7607: <li>
1.14 xtraeme 7608: <p><code class="varname">LOCALBASE</code> is where
7609: all non-X11 pkgs are installed. If you need to
1.1 grant 7610: construct a -I or -L argument to the compiler to
7611: find includes and libraries installed by another
7612: non-X11 pkg, use “<span class=
7613: "quote">${LOCALBASE}</span>”.</p>
7614: </li>
7615:
7616: <li>
1.14 xtraeme 7617: <p><code class="varname">X11BASE</code> is where
7618: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 7619: installed. When looking for <span class=
7620: "emphasis"><em>standard</em></span> X11 includes
7621: (not those installed by a pkg), use
7622: “<span class=
7623: "quote">${X11BASE}</span>”.</p>
7624: </li>
7625:
7626: <li>
7627: <p>X11 based are special in that they may be
1.14 xtraeme 7628: installed in either <code class=
7629: "varname">X11BASE</code> or <code class=
7630: "varname">LOCALBASE</code>.</p>
1.1 grant 7631:
7632: <p>Usually, X11 packages should be installed under
1.14 xtraeme 7633: <code class="varname">LOCALBASE</code> whenever
7634: possible. Note that you will need to set
7635: <code class="varname">USE_X11</code> in them to
7636: request the presence of X11 and to get the right
7637: compilation flags.</p>
1.1 grant 7638:
7639: <p>Even though, there are some packages that cannot
1.14 xtraeme 7640: be installed under <code class=
7641: "varname">LOCALBASE</code>: those that come with
1.1 grant 7642: app-defaults files. These packages are special and
1.14 xtraeme 7643: they must be placed under <code class=
7644: "varname">X11BASE</code>. To accomplish this, set
7645: either <code class="varname">USE_X11BASE</code> or
7646: <code class="varname">USE_IMAKE</code> in your
1.1 grant 7647: package.</p>
7648:
1.14 xtraeme 7649: <p>Some notes: <code class="varname">USE_X11</code>
7650: and <code class="varname">USE_X11BASE</code> are
7651: mutually exclusive. If you need to find includes or
7652: libraries installed by a pkg that has <code class=
7653: "varname">USE_IMAKE</code> or <code class=
7654: "varname">USE_X11BASE</code> in its pkg
7655: <code class="filename">Makefile</code>, you need to
7656: use <span class="emphasis"><em>both</em></span>
7657: <code class="filename">${X11BASE}</code> and
7658: <code class="filename">${LOCALBASE}</code>. To
7659: force installation of all X11 packages in
7660: <code class="varname">LOCALBASE</code>, the
7661: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
7662: href=
1.1 grant 7663: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20 ben 7664: class="pkgname">pkgtools/xpkgwedge</a> is enabled
7665: by default.</p>
1.1 grant 7666: </li>
7667:
7668: <li>
1.14 xtraeme 7669: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 7670: used to refer to the installed location of an X11
1.14 xtraeme 7671: package. <code class="varname">X11PREFIX</code>
7672: will be set to <code class="varname">X11BASE</code>
7673: if xpkgwedge is not installed, and to <code class=
7674: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 7675: installed.</p>
7676: </li>
7677:
7678: <li>
7679: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 7680: have some packages installed in <code class=
7681: "varname">X11BASE</code> and some in <code class=
7682: "varname">LOCALBASE</code>. To determine the prefix
7683: of an installed package, the <code class=
7684: "varname">EVAL_PREFIX</code> definition can be
7685: used. It takes pairs in the format
7686: “<span class=
1.1 grant 7687: "quote">DIRNAME=<package></span>”, and
1.24 wiz 7688: the <a href=
7689: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7690: <span class="citerefentry"><span class=
7691: "refentrytitle">make</span>(1)</span></a> variable
7692: <code class="varname">DIRNAME</code> will be set to
7693: the prefix of the installed package
7694: <package>, or “<span class=
1.1 grant 7695: "quote">${X11PREFIX}</span>” if the package
7696: is not installed.</p>
7697:
7698: <p>This is best illustrated by example.</p>
7699:
1.14 xtraeme 7700: <p>The following lines are taken from <code class=
7701: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 7702: <pre class="programlisting">
1.14 xtraeme 7703: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 7704: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
7705: --with-gtk-prefix="${GTKDIR}" \
7706: --enable-multibyte
7707: </pre>
7708:
7709: <p>Specific defaults can be defined for the
1.14 xtraeme 7710: packages evaluated using <code class=
7711: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 7712: of the form:</p>
7713: <pre class="programlisting">
7714: GTKDIR_DEFAULT= ${LOCALBASE}
7715: </pre>
7716:
1.14 xtraeme 7717: <p>where <code class="varname">GTKDIR</code>
1.1 grant 7718: corresponds to the first definition in the
1.14 xtraeme 7719: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 7720: </li>
7721:
7722: <li>
1.14 xtraeme 7723: <p>Within <code class="filename">${PREFIX}</code>,
1.24 wiz 7724: packages should install files according to <a href=
7725: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
7726: <span class="citerefentry"><span class=
7727: "refentrytitle">hier</span>(7)</span></a>, with the
7728: exception that manual pages go into <code class=
7729: "filename">${PREFIX}/man</code>, not <code class=
1.14 xtraeme 7730: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 7731: </li>
7732: </ul>
7733: </div>
7734: </div>
7735:
7736: <div class="sect1" lang="en" xml:lang="en">
7737: <div class="titlepage">
7738: <div>
7739: <div>
7740: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 7741: "id2631098" id="id2631098"></a>12.2. Main
1.1 grant 7742: targets</h2>
7743: </div>
7744: </div>
7745: </div>
7746:
7747: <p>The main targets used during the build process defined
1.14 xtraeme 7748: in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 7749:
7750: <div class="variablelist">
7751: <dl>
7752: <dt><span class="term">fetch</span></dt>
7753:
7754: <dd>
7755: <p>This will check if the file(s) given in the
1.14 xtraeme 7756: variables <code class="varname">DISTFILES</code>
7757: and <code class="varname">PATCHFILES</code> (as
7758: defined in the package's Makefile) are present on
7759: the local system in <code class=
7760: "filename">/usr/pkgsrc/distfiles</code>. If they
7761: are not present, an attempt will be made to fetch
7762: them using commands of the form:</p>
1.1 grant 7763: <pre class="programlisting">
7764: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
7765: </pre>
7766:
7767: <p>where ${site} varies through several
1.14 xtraeme 7768: possibilities in turn: first, <code class=
7769: "varname">MASTER_SITE_OVERRIDE</code> is tried,
7770: then the sites specified in either <code class=
7771: "varname">SITES_file</code> if defined, else
7772: <code class="varname">MASTER_SITES</code> or
7773: <code class="varname">PATCH_SITES</code>, as
7774: applies, then finally the value of <code class=
7775: "varname">MASTER_SITE_BACKUP</code>. The order of
7776: all except the first can be optionally sorted by
7777: the user, via setting either <code class=
7778: "varname">MASTER_SORT_AWK</code> or <code class=
7779: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 7780: </dd>
7781:
7782: <dt><span class="term">checksum</span></dt>
7783:
7784: <dd>
7785: <p>After the distfile(s) are fetched, their
7786: checksum is generated and compared with the
7787: checksums stored in the distinfo file. If the
7788: checksums don't match, the build is aborted. This
7789: is to ensure the same distfile is used for
7790: building, and that the distfile wasn't changed,
7791: e.g. by some malign force, deliberately changed
7792: distfiles on the master distribution site or
7793: network lossage.</p>
7794: </dd>
7795:
7796: <dt><span class="term">extract</span></dt>
7797:
7798: <dd>
7799: <p>When the distfiles are present on the local
7800: system, they need to be extracted, as they are
7801: usually in the form of some compressed archive
1.14 xtraeme 7802: format, most commonly <code class=
7803: "filename">.tar.gz</code>.</p>
1.1 grant 7804:
7805: <p>If only some of the distfiles need to be
7806: uncompressed, the files to be uncompressed should
1.14 xtraeme 7807: be put into <code class=
7808: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 7809:
1.14 xtraeme 7810: <p>If the distfiles are not in <code class=
7811: "filename">.tar.gz</code> format, they can be
7812: extracted by setting either <code class=
7813: "varname">EXTRACT_SUFX</code>, or <code class=
7814: "varname">EXTRACT_CMD</code>, <code class=
7815: "varname">EXTRACT_BEFORE_ARGS</code> and
7816: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
7817: the former case, pkgsrc knows how to extract a
7818: number of suffixes (<code class=
7819: "filename">.tar.gz</code>, <code class=
7820: "filename">.tgz</code>, <code class=
7821: "filename">.tar.gz2</code>, <code class=
7822: "filename">.tbz</code>, <code class=
7823: "filename">.tar.Z</code>, <code class=
7824: "filename">.tar</code>, <code class=
7825: "filename">.shar.gz</code>, <code class=
7826: "filename">.shar.bz2</code>, <code class=
7827: "filename">.shar.Z</code>, <code class=
7828: "filename">.shar</code>, <code class=
7829: "filename">.Z</code>, <code class=
7830: "filename">.bz2</code> and <code class=
7831: "filename">.gz</code>; see the definition of the
7832: various <code class="varname">DECOMPRESS_CMD</code>
7833: variables <code class="filename">bsd.pkg.mk</code>
7834: for a complete list). Here's an example on how to
7835: use the other variables for a program that comes
7836: with a compressed shell archive whose name ends in
7837: <code class="filename">.msg.gz</code>:</p>
1.1 grant 7838: <pre class="programlisting">
7839: EXTRACT_SUFX= .msg.gz
7840: EXTRACT_CMD= zcat
7841: EXTRACT_BEFORE_ARGS=
7842: EXTRACT_AFTER_ARGS= |sh
7843: </pre>
7844: </dd>
7845:
7846: <dt><span class="term">patch</span></dt>
7847:
7848: <dd>
7849: <p>After extraction, all the patches named by the
1.14 xtraeme 7850: <code class="varname">PATCHFILES</code>, those
7851: present in the patches subdirectory of the package
7852: as well as in $LOCALPATCHES/$PKGPATH (e.g.
7853: <code class=
7854: "filename">/usr/local/patches/graphics/png</code>)
7855: are applied. Patchfiles ending in <code class=
7856: "filename">.Z</code> or <code class=
7857: "filename">.gz</code> are uncompressed before they
7858: are applied, files ending in <code class=
7859: "filename">.orig</code> or <code class=
7860: "filename">.rej</code> are ignored. Any special
1.24 wiz 7861: options to <a href=
7862: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
7863: <span class="citerefentry"><span class=
7864: "refentrytitle">patch</span>(1)</span></a> can be
7865: handed in <code class=
1.14 xtraeme 7866: "varname">PATCH_DIST_ARGS</code>. See <a href=
7867: "#components.patches" title=
1.25 rillig 7868: "8.3. patches/*">Section 8.3,
1.1 grant 7869: “patches/*”</a> for more details.</p>
7870:
1.24 wiz 7871: <p>By default <a href=
7872: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
7873: <span class="citerefentry"><span class=
7874: "refentrytitle">patch</span>(1)</span></a> is given
7875: special args to make it fail if the patches apply
7876: with some lines of fuzz. Please fix (regen) the
7877: patches so that they apply cleanly. The rationale
7878: behind this is that patches that don't apply
7879: cleanly may end up being applied in the wrong
7880: place, and cause severe harm there.</p>
1.1 grant 7881: </dd>
7882:
7883: <dt><span class="term">configure</span></dt>
7884:
7885: <dd>
7886: <p>Most pieces of software need information on the
7887: header files, system calls, and library routines
7888: which are available in NetBSD. This is the process
7889: known as configuration, and is usually automated.
7890: In most cases, a script is supplied with the
7891: source, and its invocation results in generation of
7892: header files, Makefiles, etc.</p>
7893:
7894: <p>If the program's distfile contains its own
7895: configure script, this can be invoked by setting
1.14 xtraeme 7896: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 7897: configure script is a GNU autoconf script,
1.14 xtraeme 7898: <code class="varname">GNU_CONFIGURE</code> should
7899: be specified instead. In either case, any arguments
7900: to the configure script can be specified in the
7901: <code class="varname">CONFIGURE_ARGS</code>
7902: variable, and the configure script's name can be
7903: set in <code class=
7904: "varname">CONFIGURE_SCRIPT</code> if it differs
7905: from the default “<span class=
1.1 grant 7906: "quote">configure</span>”. Here's an example
7907: from the <a xmlns=
7908: "http://www.w3.org/TR/xhtml1/transitional" href=
7909: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20 ben 7910: class="pkgname">sysutils/top</a> package:</p>
1.1 grant 7911: <pre class="programlisting">
7912: HAS_CONFIGURE= yes
7913: CONFIGURE_SCRIPT= Configure
7914: CONFIGURE_ARGS+= netbsd13
7915: </pre>
7916:
7917: <p>If the program uses an Imakefile for
7918: configuration, the appropriate steps can be invoked
1.14 xtraeme 7919: by setting <code class="varname">USE_IMAKE</code>
7920: to “<span class="quote">YES</span>”.
7921: (If you only want the package installed in
7922: <code class="varname">$X11PREFIX</code> but xmkmf
7923: not being run, set <code class=
7924: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 7925: </dd>
7926:
7927: <dt><span class="term">build</span></dt>
7928:
7929: <dd>
7930: <p>Once configuration has taken place, the software
1.14 xtraeme 7931: will be built by invoking <code class=
7932: "varname">$MAKE_PROGRAM</code> on <code class=
7933: "varname">$MAKEFILE</code> with <code class=
7934: "varname">$BUILD_TARGET</code> as the target to
7935: build. The default <code class=
7936: "varname">MAKE_PROGRAM</code> is
7937: “<span class="quote">gmake</span>” if
7938: <code class="varname">USE_GNU_TOOLS</code> contains
1.7 wiz 7939: “<span class="quote">make</span>”,
1.1 grant 7940: “<span class="quote">make</span>”
1.14 xtraeme 7941: otherwise. <code class="varname">MAKEFILE</code> is
7942: set to “<span class=
1.1 grant 7943: "quote">Makefile</span>” by default, and
1.14 xtraeme 7944: <code class="varname">BUILD_TARGET</code> defaults
7945: to “<span class="quote">all</span>”.
7946: Any of these variables can be set in the package's
1.1 grant 7947: Makefile to change the default build process.</p>
7948: </dd>
7949:
7950: <dt><span class="term">install</span></dt>
7951:
7952: <dd>
7953: <p>Once the build stage has completed, the final
7954: step is to install the software in public
7955: directories, so users can access the programs and
1.14 xtraeme 7956: files. As in the build-target, <code class=
7957: "varname">$MAKE_PROGRAM</code> is invoked on
7958: <code class="varname">$MAKEFILE</code> here, but
7959: with the <code class=
7960: "varname">$INSTALL_TARGET</code> instead, the
7961: latter defaulting to “<span class=
7962: "quote">install</span>” (plus
7963: “<span class=
7964: "quote">install.man</span>”, if <code class=
7965: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 7966: </dd>
7967: </dl>
7968: </div>
7969:
7970: <p>If no target is specified, the default is
7971: “<span class="quote">build</span>”. If a
7972: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 7973: e.g. <span><strong class="command">make
7974: build</strong></span> will also perform the equivalent
7975: of:</p>
1.1 grant 7976: <pre class="programlisting">
7977: make fetch
7978: make checksum
7979: make extract
7980: make patch
7981: make configure
7982: make build
7983: </pre>
7984: </div>
7985:
7986: <div class="sect1" lang="en" xml:lang="en">
7987: <div class="titlepage">
7988: <div>
7989: <div>
7990: <h2 class="title" style="clear: both"><a name=
7991: "build.helpful-targets" id=
1.25 rillig 7992: "build.helpful-targets"></a>12.3. Other
1.1 grant 7993: helpful targets</h2>
7994: </div>
7995: </div>
7996: </div>
7997:
7998: <div class="variablelist">
7999: <dl>
8000: <dt><span class="term">pre/post-*</span></dt>
8001:
8002: <dd>
8003: <p>For any of the main targets described in the
8004: previous section, two auxiliary targets exist with
8005: “<span class="quote">pre-</span>” and
8006: “<span class="quote">post-</span>” used
8007: as a prefix for the main target's name. These
8008: targets are invoked before and after the main
8009: target is called, allowing extra configuration or
8010: installation steps be performed from a package's
8011: Makefile, for example, which a program's configure
8012: script or install target omitted.</p>
8013: </dd>
8014:
8015: <dt><span class="term">do-*</span></dt>
8016:
8017: <dd>
8018: <p>Should one of the main targets do the wrong
8019: thing, and should there be no variable to fix this,
8020: you can redefine it with the do-* target. (Note
8021: that redefining the target itself instead of the
8022: do-* target is a bad idea, as the pre-* and post-*
8023: targets won't be called anymore, etc.) You will not
8024: usually need to do this.</p>
8025: </dd>
8026:
8027: <dt><span class="term">reinstall</span></dt>
8028:
8029: <dd>
1.14 xtraeme 8030: <p>If you did a <span><strong class="command">make
8031: install</strong></span> and you noticed some file
8032: was not installed properly, you can repeat the
1.1 grant 8033: installation with this target, which will ignore
8034: the “<span class="quote">already
8035: installed</span>” flag.</p>
8036: </dd>
8037:
8038: <dt><span class="term">deinstall</span></dt>
8039:
8040: <dd>
1.24 wiz 8041: <p>This target does a <a href=
8042: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8043: <span class="citerefentry"><span class=
8044: "refentrytitle">pkg_delete</span>(1)</span></a> in
8045: the current directory, effectively de-installing
8046: the package. The following variables can be used to
8047: tune the behaviour:</p>
1.1 grant 8048:
8049: <div class="variablelist">
8050: <dl>
1.14 xtraeme 8051: <dt><span class="term"><code class=
8052: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 8053:
8054: <dd>
8055: <p>Add a "-v" to the <a href=
8056: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8057: <span class="citerefentry"><span class=
8058: "refentrytitle">pkg_delete</span>(1)</span></a>
8059: command.</p>
8060: </dd>
8061:
1.14 xtraeme 8062: <dt><span class="term"><code class=
8063: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 8064:
8065: <dd>
8066: <p>Remove all packages that require (depend
8067: on) the given package. This can be used to
8068: remove any packages that may have been pulled
8069: in by a given package, e.g. if
1.14 xtraeme 8070: <span><strong class="command">make deinstall
8071: DEINSTALLDEPENDS=1</strong></span> is done in
8072: <code class="filename">pkgsrc/x11/kde</code>,
1.1 grant 8073: this is likely to remove whole KDE. Works by
8074: adding “<span class=
8075: "quote">-R</span>” to the <a href=
8076: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
8077: <span class="citerefentry"><span class=
8078: "refentrytitle">pkg_delete</span>(1)</span></a>
8079: command line.</p>
8080: </dd>
8081: </dl>
8082: </div>
8083: </dd>
8084:
8085: <dt><span class="term">update</span></dt>
8086:
8087: <dd>
8088: <p>This target causes the current package to be
8089: updated to the latest version. The package and all
8090: depending packages first get de-installed, then
8091: current versions of the corresponding packages get
8092: compiled and installed. This is similar to manually
8093: noting which packages are currently installed, then
1.14 xtraeme 8094: performing a series of <span><strong class=
8095: "command">make deinstall</strong></span> and
8096: <span><strong class="command">make
8097: install</strong></span> (or whatever <code class=
8098: "varname">UPDATE_TARGET</code> is set to) for these
8099: packages.</p>
1.1 grant 8100:
8101: <p>You can use the “<span class=
8102: "quote">update</span>” target to resume
1.14 xtraeme 8103: package updating in case a previous
8104: <span><strong class="command">make
8105: update</strong></span> was interrupted for some
8106: reason. However, in this case, make sure you don't
8107: call <span><strong class="command">make
8108: clean</strong></span> or otherwise remove the list
8109: of dependent packages in <code class=
8110: "varname">WRKDIR</code>. Otherwise you lose the
1.1 grant 8111: ability to automatically update the current package
8112: along with the dependent packages you have
8113: installed.</p>
8114:
1.14 xtraeme 8115: <p>Resuming an interrupted <span><strong class=
8116: "command">make update</strong></span> will only
8117: work as long as the package tree remains unchanged.
8118: If the source code for one of the packages to be
8119: updated has been changed, resuming
8120: <span><strong class="command">make
8121: update</strong></span> will most certainly
8122: fail!</p>
1.1 grant 8123:
8124: <p>The following variables can be used either on
1.14 xtraeme 8125: the command line or in <code class=
8126: "filename">/etc/mk.conf</code> to alter the
8127: behaviour of <span><strong class="command">make
8128: update</strong></span>:</p>
1.1 grant 8129:
8130: <div class="variablelist">
8131: <dl>
1.14 xtraeme 8132: <dt><span class="term"><code class=
8133: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 8134:
8135: <dd>
8136: <p>Install target to recursively use for the
8137: updated package and the dependent packages.
1.14 xtraeme 8138: Defaults to <code class=
8139: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 8140: “<span class=
8141: "quote">install</span>” otherwise for
1.14 xtraeme 8142: <span><strong class="command">make
8143: update</strong></span>. e.g.
8144: <span><strong class="command">make update
8145: UPDATE_TARGET=package</strong></span></p>
1.1 grant 8146: </dd>
8147:
1.14 xtraeme 8148: <dt><span class="term"><code class=
8149: "varname">NOCLEAN</code></span></dt>
1.1 grant 8150:
8151: <dd>
8152: <p>Don't clean up after updating. Useful if
8153: you want to leave the work sources of the
8154: updated packages around for inspection or
8155: other purposes. Be sure you eventually clean
8156: up the source tree (see the
8157: “<span class=
8158: "quote">clean-update</span>” target
8159: below) or you may run into troubles with old
8160: source code still lying around on your next
1.14 xtraeme 8161: <span><strong class=
8162: "command">make</strong></span> or
8163: <span><strong class="command">make
8164: update</strong></span>.</p>
1.1 grant 8165: </dd>
8166:
1.14 xtraeme 8167: <dt><span class="term"><code class=
8168: "varname">REINSTALL</code></span></dt>
1.1 grant 8169:
8170: <dd>
8171: <p>Deinstall each package before installing
1.14 xtraeme 8172: (making <code class=
8173: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 8174: necessary if the “<span class=
8175: "quote">clean-update</span>” target
8176: (see below) was called after interrupting a
1.14 xtraeme 8177: running <span><strong class="command">make
8178: update</strong></span>.</p>
1.1 grant 8179: </dd>
8180:
1.14 xtraeme 8181: <dt><span class="term"><code class=
8182: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 8183:
8184: <dd>
8185: <p>Allows you to disable recursion and
8186: hardcode the target for packages. The default
8187: is “<span class=
8188: "quote">update</span>” for the update
8189: target, facilitating a recursive update of
1.14 xtraeme 8190: prerequisite packages. Only set <code class=
8191: "varname">DEPENDS_TARGET</code> if you want
8192: to disable recursive updates. Use
8193: <code class="varname">UPDATE_TARGET</code>
8194: instead to just set a specific target for
8195: each package to be installed during
8196: <span><strong class="command">make
8197: update</strong></span> (see above).</p>
1.1 grant 8198: </dd>
8199: </dl>
8200: </div>
8201: </dd>
8202:
8203: <dt><span class="term">clean-update</span></dt>
8204:
8205: <dd>
8206: <p>Clean the source tree for all packages that
1.14 xtraeme 8207: would get updated if <span><strong class=
8208: "command">make update</strong></span> was called
8209: from the current directory. This target should not
8210: be used if the current package (or any of its
8211: depending packages) have already been de-installed
8212: (e.g., after calling <span><strong class=
8213: "command">make update</strong></span>) or you may
8214: lose some packages you intended to update. As a
8215: rule of thumb: only use this target <span class=
8216: "emphasis"><em>before</em></span> the first time
8217: you run <span><strong class="command">make
8218: update</strong></span> and only if you have a dirty
8219: package tree (e.g., if you used <code class=
8220: "varname">NOCLEAN</code>).</p>
1.1 grant 8221:
8222: <p>If you unsure about whether your tree is clean
1.14 xtraeme 8223: you can either perform a <span><strong class=
8224: "command">make clean</strong></span> at the top of
8225: the tree, or use the following sequence of commands
1.1 grant 8226: from the directory of the package you want to
8227: update (<span class=
8228: "emphasis"><em>before</em></span> running
1.14 xtraeme 8229: <span><strong class="command">make
8230: update</strong></span> for the first time,
8231: otherwise you lose all the packages you wanted to
8232: update!):</p>
1.1 grant 8233: <pre class="screen">
1.14 xtraeme 8234: <code class="prompt">#</code> <strong class=
8235: "userinput"><code>make clean-update</code></strong>
8236: <code class="prompt">#</code> <strong class=
8237: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
8238: <code class="prompt">#</code> <strong class=
8239: "userinput"><code>make update</code></strong>
1.1 grant 8240: </pre>
8241:
8242: <p>The following variables can be used either on
1.14 xtraeme 8243: the command line or in <code class=
8244: "filename">/etc/mk.conf</code> to alter the
8245: behaviour of <span><strong class="command">make
8246: clean-update</strong></span>:</p>
1.1 grant 8247:
8248: <div class="variablelist">
8249: <dl>
1.14 xtraeme 8250: <dt><span class="term"><code class=
8251: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 8252:
8253: <dd>
1.14 xtraeme 8254: <p>After <span><strong class="command">make
8255: clean</strong></span>, do not reconstruct the
8256: list of directories to update for this
8257: package. Only use this if
8258: <span><strong class="command">make
8259: update</strong></span> successfully installed
8260: all packages you wanted to update. Normally,
8261: this is done automatically on
8262: <span><strong class="command">make
8263: update</strong></span>, but may have been
8264: suppressed by the <code class=
8265: "varname">NOCLEAN</code> variable (see
1.1 grant 8266: above).</p>
8267: </dd>
8268: </dl>
8269: </div>
8270: </dd>
8271:
8272: <dt><span class="term">info</span></dt>
8273:
8274: <dd>
8275: <p>This target invokes <a href=
8276: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
8277: <span class="citerefentry"><span class=
8278: "refentrytitle">pkg_info</span>(1)</span></a> for
8279: the current package. You can use this to check
8280: which version of a package is installed.</p>
8281: </dd>
8282:
8283: <dt><span class="term">readme</span></dt>
8284:
8285: <dd>
1.14 xtraeme 8286: <p>This target generates a <code class=
8287: "filename">README.html</code> file, which can be
1.1 grant 8288: viewed using a browser such as <a xmlns=
8289: "http://www.w3.org/TR/xhtml1/transitional" href=
8290: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 8291: class="pkgname">www/mozilla</a> or <a xmlns=
8292: "http://www.w3.org/TR/xhtml1/transitional" href=
8293: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
8294: class="pkgname">www/links</a>. The generated files
8295: contain references to any packages which are in the
8296: <code class="varname">PACKAGES</code> directory on
8297: the local host. The generated files can be made to
8298: refer to URLs based on <code class=
8299: "varname">FTP_PKG_URL_HOST</code> and <code class=
8300: "varname">FTP_PKG_URL_DIR</code>. For example, if I
8301: wanted to generate <code class=
8302: "filename">README.html</code> files which pointed
8303: to binary packages on the local machine, in the
8304: directory <code class=
8305: "filename">/usr/packages</code>, set <code class=
8306: "varname">FTP_PKG_URL_HOST=file://localhost</code>
8307: and <code class=
8308: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
8309: <code class="varname">${PACKAGES}</code> directory
8310: and its subdirectories will be searched for all the
8311: binary packages.</p>
1.1 grant 8312: </dd>
8313:
8314: <dt><span class="term">readme-all</span></dt>
8315:
8316: <dd>
1.14 xtraeme 8317: <p>Use this target to create a file <code class=
8318: "filename">README-all.html</code> which contains a
1.1 grant 8319: list of all packages currently available in the
8320: NetBSD Packages Collection, together with the
8321: category they belong to and a short description.
1.14 xtraeme 8322: This file is compiled from the <code class=
8323: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 8324: sure to run this <span class=
1.14 xtraeme 8325: "emphasis"><em>after</em></span> a
8326: <span><strong class="command">make
8327: readme</strong></span>.</p>
1.1 grant 8328: </dd>
8329:
8330: <dt><span class="term">cdrom-readme</span></dt>
8331:
8332: <dd>
8333: <p>This is very much the same as the
8334: “<span class="quote">readme</span>”
8335: target (see above), but is to be used when
8336: generating a pkgsrc tree to be written to a CD-ROM.
1.14 xtraeme 8337: This target also produces <code class=
8338: "filename">README.html</code> files, and can be
8339: made to refer to URLs based on <code class=
8340: "varname">CDROM_PKG_URL_HOST</code> and
8341: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 8342: </dd>
8343:
8344: <dt><span class="term">show-distfiles</span></dt>
8345:
8346: <dd>
8347: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 8348: are needed to build the package. (<code class=
8349: "varname">DISTFILES</code> and <code class=
8350: "varname">PATCHFILES</code>, but not <code class=
8351: "filename">patches/*</code>)</p>
1.1 grant 8352: </dd>
8353:
8354: <dt><span class="term">show-downlevel</span></dt>
8355:
8356: <dd>
8357: <p>This target shows nothing if the package is not
8358: installed. If a version of this package is
8359: installed, but is not the version provided in this
8360: version of pkgsrc, then a warning message is
8361: displayed. This target can be used to show which of
8362: your installed packages are downlevel, and so the
8363: old versions can be deleted, and the current ones
8364: added.</p>
8365: </dd>
8366:
8367: <dt><span class="term">show-pkgsrc-dir</span></dt>
8368:
8369: <dd>
8370: <p>This target shows the directory in the pkgsrc
8371: hierarchy from which the package can be built and
8372: installed. This may not be the same directory as
8373: the one from which the package was installed. This
8374: target is intended to be used by people who may
8375: wish to upgrade many packages on a single host, and
8376: can be invoked from the top-level pkgsrc Makefile
8377: by using the “<span class=
8378: "quote">show-host-specific-pkgs</span>”
8379: target.</p>
8380: </dd>
8381:
8382: <dt><span class=
8383: "term">show-installed-depends</span></dt>
8384:
8385: <dd>
8386: <p>This target shows which installed packages match
1.14 xtraeme 8387: the current package's <code class=
8388: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 8389: dependencies are causing build problems.</p>
8390: </dd>
8391:
8392: <dt><span class="term">check-shlibs</span></dt>
8393:
8394: <dd>
8395: <p>After a package is installed, check all its
8396: binaries and (on ELF platforms) shared libraries to
8397: see if they find the shared libs they need. Run by
1.14 xtraeme 8398: default if <code class=
8399: "varname">PKG_DEVELOPER</code> is set in
8400: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 8401: </dd>
8402:
8403: <dt><span class="term">print-PLIST</span></dt>
8404:
8405: <dd>
8406: <p>After a “<span class="quote">make
8407: install</span>” from a new or upgraded pkg,
8408: this prints out an attempt to generate a new
1.14 xtraeme 8409: <code class="filename">PLIST</code> from a
8410: <span><strong class="command">find -newer
8411: work/.extract_done</strong></span>. An attempt is
8412: made to care for shared libs etc., but it is
1.1 grant 8413: <span class="emphasis"><em>strongly</em></span>
8414: recommended to review the result before putting it
1.14 xtraeme 8415: into <code class="filename">PLIST</code>. On
8416: upgrades, it's useful to diff the output of this
8417: command against an already existing <code class=
8418: "filename">PLIST</code> file.</p>
1.1 grant 8419:
1.24 wiz 8420: <p>If the package installs files via <a href=
8421: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
8422: <span class="citerefentry"><span class=
8423: "refentrytitle">tar</span>(1)</span></a> or other
8424: methods that don't update file access times, be
8425: sure to add these files manually to your
1.14 xtraeme 8426: <code class="filename">PLIST</code>, as the
1.1 grant 8427: “<span class="quote">find
8428: -newer</span>” command used by this target
8429: won't catch them!</p>
8430:
8431: <p>See <a href="#print-PLIST" title=
1.25 rillig 8432: "9.3. Tweaking output of make print-PLIST">Section 9.3,
1.14 xtraeme 8433: “Tweaking output of <span><strong class=
8434: "command">make
8435: print-PLIST</strong></span>”</a> for more
8436: information on this target.</p>
1.1 grant 8437: </dd>
8438:
8439: <dt><span class="term">bulk-package</span></dt>
8440:
8441: <dd>
8442: <p>Used to do bulk builds. If an appropriate binary
8443: package already exists, no action is taken. If not,
8444: this target will compile, install and package it
1.14 xtraeme 8445: (and it's depends, if <code class=
8446: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 8447: <a href="#binary.configuration" title=
8448: "5.3.1. Configuration">Section 5.3.1,
8449: “Configuration”</a>. After creating the
8450: binary package, the sources, the just-installed
8451: package and it's required packages are removed,
8452: preserving free disk space.</p>
8453:
8454: <p><span class="emphasis"><em>Beware that this
8455: target may deinstall all packages installed on a
8456: system!</em></span></p>
8457: </dd>
8458:
8459: <dt><span class="term">bulk-install</span></dt>
8460:
8461: <dd>
8462: <p>Used during bulk-installs to install required
8463: packages. If an upto-date binary package is
8464: available, it will be installed via <a href=
8465: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
8466: <span class="citerefentry"><span class=
8467: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 8468: not, <span><strong class="command">make
8469: bulk-package</strong></span> will be executed, but
8470: the installed binary not be removed.</p>
1.1 grant 8471:
8472: <p>A binary package is considered
8473: “<span class="quote">upto-date</span>”
8474: to be installed via <a href=
8475: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
8476: <span class="citerefentry"><span class=
8477: "refentrytitle">pkg_add</span>(1)</span></a>
8478: if:</p>
8479:
8480: <div class="itemizedlist">
8481: <ul type="disc">
8482: <li>
1.14 xtraeme 8483: <p>None of the package's files (<code class=
8484: "filename">Makefile</code>, ...) were
8485: modified since it was built.</p>
1.1 grant 8486: </li>
8487:
8488: <li>
8489: <p>None of the package's required (binary)
8490: packages were modified since it was
8491: built.</p>
8492: </li>
8493: </ul>
8494: </div>
8495:
8496: <p><span class="emphasis"><em>Beware that this
8497: target may deinstall all packages installed on a
8498: system!</em></span></p>
8499: </dd>
8500: </dl>
8501: </div>
8502: </div>
8503: </div>
8504:
8505: <div class="chapter" lang="en" xml:lang="en">
8506: <div class="titlepage">
8507: <div>
8508: <div>
8509: <h2 class="title"><a name="fixes" id=
1.25 rillig 8510: "fixes"></a>Chapter 13. Notes on fixes for
1.1 grant 8511: packages</h2>
8512: </div>
8513: </div>
8514: </div>
8515:
8516: <div class="toc">
8517: <p><b>Table of Contents</b></p>
8518:
8519: <dl>
1.26 ! wiz 8520: <dt><span class="sect1"><a href="#id2632458">13.1.
1.1 grant 8521: General operation</a></span></dt>
8522:
8523: <dd>
8524: <dl>
8525: <dt><span class="sect2"><a href=
1.26 ! wiz 8526: "#id2632461">13.1.1. How to pull in variables from
1.1 grant 8527: /etc/mk.conf</a></span></dt>
8528:
8529: <dt><span class="sect2"><a href=
1.26 ! wiz 8530: "#id2632545">13.1.2. Restricted
1.1 grant 8531: packages</a></span></dt>
8532:
8533: <dt><span class="sect2"><a href=
1.25 rillig 8534: "#dependencies">13.1.3. Handling
1.1 grant 8535: dependencies</a></span></dt>
8536:
8537: <dt><span class="sect2"><a href=
1.26 ! wiz 8538: "#id2633066">13.1.4. Handling conflicts with other
1.1 grant 8539: packages</a></span></dt>
8540:
8541: <dt><span class="sect2"><a href=
1.26 ! wiz 8542: "#id2633116">13.1.5. Packages that cannot or should
1.1 grant 8543: not be built</a></span></dt>
8544:
8545: <dt><span class="sect2"><a href=
1.26 ! wiz 8546: "#id2633142">13.1.6. Packages which should not be
1.1 grant 8547: deleted, once installed</a></span></dt>
8548:
8549: <dt><span class="sect2"><a href=
1.25 rillig 8550: "#security-handling">13.1.7. Handling packages with
1.1 grant 8551: security problems</a></span></dt>
8552:
8553: <dt><span class="sect2"><a href=
1.26 ! wiz 8554: "#id2633234">13.1.8. How to handle compiler
1.1 grant 8555: bugs</a></span></dt>
8556:
8557: <dt><span class="sect2"><a href=
1.26 ! wiz 8558: "#id2633324">13.1.9. How to handle incrementing
1.1 grant 8559: versions when fixing an existing
8560: package</a></span></dt>
8561:
8562: <dt><span class="sect2"><a href=
1.26 ! wiz 8563: "#id2633373">13.1.10. Portability of
1.1 grant 8564: packages</a></span></dt>
8565: </dl>
8566: </dd>
8567:
1.26 ! wiz 8568: <dt><span class="sect1"><a href="#id2633398">13.2.
1.1 grant 8569: Possible downloading issues</a></span></dt>
8570:
8571: <dd>
8572: <dl>
8573: <dt><span class="sect2"><a href=
1.26 ! wiz 8574: "#id2633401">13.2.1. Packages whose distfiles
1.1 grant 8575: aren't available for plain
8576: downloading</a></span></dt>
8577:
8578: <dt><span class="sect2"><a href=
1.26 ! wiz 8579: "#id2633601">13.2.2. How to handle modified
1.1 grant 8580: distfiles with the 'old' name</a></span></dt>
8581: </dl>
8582: </dd>
8583:
1.26 ! wiz 8584: <dt><span class="sect1"><a href="#id2633612">13.3.
1.1 grant 8585: Configuration gotchas</a></span></dt>
8586:
8587: <dd>
8588: <dl>
8589: <dt><span class="sect2"><a href=
1.25 rillig 8590: "#fixes.libtool">13.3.1. Shared libraries -
1.1 grant 8591: libtool</a></span></dt>
8592:
8593: <dt><span class="sect2"><a href=
1.26 ! wiz 8594: "#id2633978">13.3.2. Using libtool on GNU packages
1.1 grant 8595: that already support libtool</a></span></dt>
8596:
8597: <dt><span class="sect2"><a href=
1.26 ! wiz 8598: "#id2634059">13.3.3. GNU
1.1 grant 8599: Autoconf/Automake</a></span></dt>
8600: </dl>
8601: </dd>
8602:
1.26 ! wiz 8603: <dt><span class="sect1"><a href="#id2634104">13.4.
1.1 grant 8604: Building considerations</a></span></dt>
8605:
8606: <dd>
8607: <dl>
8608: <dt><span class="sect2"><a href=
1.26 ! wiz 8609: "#id2634107">13.4.1. CPP defines</a></span></dt>
1.1 grant 8610: </dl>
8611: </dd>
8612:
1.26 ! wiz 8613: <dt><span class="sect1"><a href="#id2634137">13.5.
1.1 grant 8614: Package specific actions</a></span></dt>
8615:
8616: <dd>
8617: <dl>
8618: <dt><span class="sect2"><a href=
1.26 ! wiz 8619: "#id2634140">13.5.1. Package configuration
1.1 grant 8620: files</a></span></dt>
8621:
8622: <dt><span class="sect2"><a href=
1.26 ! wiz 8623: "#id2634311">13.5.2. User
1.2 hubertf 8624: interaction</a></span></dt>
1.1 grant 8625:
8626: <dt><span class="sect2"><a href=
1.26 ! wiz 8627: "#id2634492">13.5.3. Handling
1.1 grant 8628: licenses</a></span></dt>
8629:
8630: <dt><span class="sect2"><a href=
1.26 ! wiz 8631: "#id2634644">13.5.4. Creating an account from a
1.1 grant 8632: package</a></span></dt>
8633:
8634: <dt><span class="sect2"><a href=
1.26 ! wiz 8635: "#id2634706">13.5.5. Installing score
1.1 grant 8636: files</a></span></dt>
8637:
8638: <dt><span class="sect2"><a href=
1.26 ! wiz 8639: "#id2634749">13.5.6. Packages providing login
1.1 grant 8640: shells</a></span></dt>
8641:
8642: <dt><span class="sect2"><a href=
1.26 ! wiz 8643: "#id2634807">13.5.7. Packages containing perl
1.1 grant 8644: scripts</a></span></dt>
8645:
8646: <dt><span class="sect2"><a href=
1.26 ! wiz 8647: "#id2634825">13.5.8. Packages with hardcoded paths
1.1 grant 8648: to other interpreters</a></span></dt>
8649:
8650: <dt><span class="sect2"><a href=
1.26 ! wiz 8651: "#id2634846">13.5.9. Packages installing perl
1.1 grant 8652: modules</a></span></dt>
8653:
8654: <dt><span class="sect2"><a href=
1.25 rillig 8655: "#faq.info-files">13.5.10. Packages installing info
1.1 grant 8656: files</a></span></dt>
8657:
8658: <dt><span class="sect2"><a href=
1.26 ! wiz 8659: "#id2635134">13.5.11. Packages installing GConf2
1.1 grant 8660: data files</a></span></dt>
8661:
8662: <dt><span class="sect2"><a href=
1.26 ! wiz 8663: "#id2635303">13.5.12. Packages installing
1.1 grant 8664: scrollkeeper data files</a></span></dt>
8665:
8666: <dt><span class="sect2"><a href=
1.26 ! wiz 8667: "#id2635354">13.5.13. Packages installing X11
1.1 grant 8668: fonts</a></span></dt>
8669:
8670: <dt><span class="sect2"><a href=
1.26 ! wiz 8671: "#id2635469">13.5.14. Packages installing GTK2
1.1 grant 8672: modules</a></span></dt>
8673:
8674: <dt><span class="sect2"><a href=
1.26 ! wiz 8675: "#id2635539">13.5.15. Packages installing SGML or
1.1 grant 8676: XML data</a></span></dt>
8677:
8678: <dt><span class="sect2"><a href=
1.26 ! wiz 8679: "#id2635659">13.5.16. Packages installing
1.1 grant 8680: extensions to the MIME database</a></span></dt>
8681:
8682: <dt><span class="sect2"><a href=
1.26 ! wiz 8683: "#id2635730">13.5.17. Packages using
1.1 grant 8684: intltool</a></span></dt>
1.18 xtraeme 8685:
8686: <dt><span class="sect2"><a href=
1.26 ! wiz 8687: "#id2635744">13.5.18. Packages installing startup
1.18 xtraeme 8688: scripts</a></span></dt>
1.1 grant 8689: </dl>
8690: </dd>
8691:
1.26 ! wiz 8692: <dt><span class="sect1"><a href="#id2635765">13.6.
1.1 grant 8693: Feedback to the author</a></span></dt>
8694: </dl>
8695: </div>
8696:
8697: <div class="sect1" lang="en" xml:lang="en">
8698: <div class="titlepage">
8699: <div>
8700: <div>
8701: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 8702: "id2632458" id="id2632458"></a>13.1. General
1.1 grant 8703: operation</h2>
8704: </div>
8705: </div>
8706: </div>
8707:
8708: <div class="sect2" lang="en" xml:lang="en">
8709: <div class="titlepage">
8710: <div>
8711: <div>
1.26 ! wiz 8712: <h3 class="title"><a name="id2632461" id=
! 8713: "id2632461"></a>13.1.1. How to pull in
1.1 grant 8714: variables from /etc/mk.conf</h3>
8715: </div>
8716: </div>
8717: </div>
8718:
8719: <p>The problem with package-defined variables that can
1.14 xtraeme 8720: be overridden via <code class="varname">MAKECONF</code>
8721: or <code class="filename">/etc/mk.conf</code> is that
8722: <a href=
1.1 grant 8723: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8724: <span class="citerefentry"><span class=
8725: "refentrytitle">make</span>(1)</span></a> expands a
8726: variable as it is used, but evaluates preprocessor like
8727: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 8728: So, to use any variable (which may be set in
8729: <code class="filename">/etc/mk.conf</code>) in one of
8730: the .if* statements, the file <code class=
8731: "filename">/etc/mk.conf</code> must be included before
1.1 grant 8732: that .if* statement.</p>
8733:
8734: <p>Rather than have a number of ad-hoc ways of
1.14 xtraeme 8735: including <code class="filename">/etc/mk.conf</code>,
8736: should it exist, or <code class=
8737: "varname">MAKECONF</code>, should it exist, include the
8738: <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
8739: file in the package Makefile before any
8740: preprocessor-like .if, .ifdef, or .ifndef
8741: statements:</p>
1.1 grant 8742: <pre class="programlisting">
8743: .include "../../mk/bsd.prefs.mk"
8744:
8745: .if defined(USE_MENUS)
8746: ...
8747: .endif
8748: </pre>
8749:
1.14 xtraeme 8750: <p>If you wish to set the <code class=
8751: "varname">CFLAGS</code> variable in <code class=
8752: "filename">/etc/mk.conf</code> please make sure to
1.1 grant 8753: use:</p>
8754: <pre class="programlisting">
8755: CFLAGS+= -your -flags
8756: </pre>
8757:
1.14 xtraeme 8758: <p>Using <code class="varname">CFLAGS=</code> (i.e.
8759: without the “<span class="quote">+</span>”)
8760: may lead to problems with packages that need to add
8761: their own flags. Also, you may want to take a look at
8762: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 8763: href=
8764: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20 ben 8765: class="pkgname">devel/cpuflags</a> package if you're
8766: interested in optimization for the current CPU.</p>
1.1 grant 8767: </div>
8768:
8769: <div class="sect2" lang="en" xml:lang="en">
8770: <div class="titlepage">
8771: <div>
8772: <div>
1.26 ! wiz 8773: <h3 class="title"><a name="id2632545" id=
! 8774: "id2632545"></a>13.1.2. Restricted
1.1 grant 8775: packages</h3>
8776: </div>
8777: </div>
8778: </div>
8779:
8780: <p>Some licenses restrict how software may be
8781: re-distributed. In order to satisfy these restrictions,
8782: the package system defines five make variables that can
8783: be set to note these restrictions:</p>
8784:
8785: <div class="itemizedlist">
8786: <ul type="disc">
8787: <li>
1.14 xtraeme 8788: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 8789:
8790: <p>This variable should be set whenever a
8791: restriction exists (regardless of its kind). Set
8792: this variable to a string containing the reason
8793: for the restriction.</p>
8794: </li>
8795:
8796: <li>
1.14 xtraeme 8797: <p><code class=
8798: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 8799:
8800: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 8801: variable to <code class=
8802: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 8803: package may not be included on a CD-ROM.</p>
8804: </li>
8805:
8806: <li>
1.14 xtraeme 8807: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 8808:
8809: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 8810: Set this variable to <code class=
8811: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 8812: package may not not be made available on the
8813: Internet.</p>
8814: </li>
8815:
8816: <li>
1.14 xtraeme 8817: <p><code class=
8818: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 8819:
8820: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 8821: this variable to <code class=
8822: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 8823: of the source code or other distfile(s) is not
8824: allowed on CD-ROMs.</p>
8825: </li>
8826:
8827: <li>
1.14 xtraeme 8828: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 8829:
8830: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 8831: variable to <code class=
8832: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 8833: of the source code or other distfile(s) via the
8834: Internet is not allowed.</p>
8835: </li>
8836: </ul>
8837: </div>
8838:
1.14 xtraeme 8839: <p>Please note that the use of <code class=
8840: "varname">NO_PACKAGE</code>, <code class=
8841: "varname">IGNORE</code>, <code class=
8842: "varname">NO_CDROM</code>, or other generic make
1.1 grant 8843: variables to denote restrictions is deprecated, because
8844: they unconditionally prevent users from generating
8845: binary packages!</p>
8846: </div>
8847:
8848: <div class="sect2" lang="en" xml:lang="en">
8849: <div class="titlepage">
8850: <div>
8851: <div>
8852: <h3 class="title"><a name="dependencies" id=
1.25 rillig 8853: "dependencies"></a>13.1.3. Handling
1.1 grant 8854: dependencies</h3>
8855: </div>
8856: </div>
8857: </div>
8858:
8859: <p>Your package may depend on some other package being
8860: present - and there are various ways of expressing this
1.14 xtraeme 8861: dependency. pkgsrc supports the <code class=
8862: "varname">BUILD_DEPENDS</code> and <code class=
8863: "varname">DEPENDS</code> definitions, as well as
8864: dependencies via <code class=
8865: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 8866: way to handle dependencies, and which uses the
8867: variables named above. See <a href="#buildlink" title=
1.25 rillig 8868: "Chapter 10. Buildlink methodology">Chapter 10,
1.1 grant 8869: <i>Buildlink methodology</i></a> for more
8870: information.</p>
8871:
8872: <p>The basic difference between the two variables is as
1.14 xtraeme 8873: follows: The <code class="varname">DEPENDS</code>
1.1 grant 8874: definition registers that pre-requisite in the binary
8875: package so it will be pulled in when the binary package
1.14 xtraeme 8876: is later installed, whilst the <code class=
8877: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 8878: marking a dependency that is only needed for building
8879: the package.</p>
8880:
8881: <p>This means that if you only need a package present
8882: whilst you are building, it should be noted as a
1.14 xtraeme 8883: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 8884:
1.14 xtraeme 8885: <p>The format for a <code class=
8886: "varname">BUILD_DEPENDS</code> and a <code class=
8887: "varname">DEPENDS</code> definition is:</p>
1.1 grant 8888: <pre class="programlisting">
8889: <pre-req-package-name>:../../<category>/<pre-req-package>
8890: </pre>
8891:
8892: <p>Please note that the “<span class=
8893: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 8894: any of the wildcard version numbers recognized by
1.1 grant 8895: <a href=
8896: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
8897: <span class="citerefentry"><span class=
8898: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
8899:
8900: <div class="orderedlist">
8901: <ol type="1">
8902: <li>
8903: <p>If your package needs another package's
8904: binaries or libraries to build or run, and if
1.14 xtraeme 8905: that package has a <code class=
8906: "filename">buildlink3.mk</code> file available,
8907: use it:</p>
1.1 grant 8908: <pre class="programlisting">
8909: .include "../../graphics/jpeg/buildlink3.mk"
8910:
8911: </pre>
8912: </li>
8913:
8914: <li>
8915: <p>If your package needs to use another package
1.14 xtraeme 8916: to build itself and there is no <code class=
8917: "filename">buildlink3.mk</code> file available,
8918: use the <code class=
8919: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 8920: <pre class="programlisting">
8921: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
8922: </pre>
8923: </li>
8924:
8925: <li>
8926: <p>If your package needs a library with which to
1.14 xtraeme 8927: link and again there is no <code class=
8928: "filename">buildlink3.mk</code> file available,
8929: this is specified using the <code class=
8930: "varname">DEPENDS</code> definition. An example
8931: of this is the <a xmlns=
1.1 grant 8932: "http://www.w3.org/TR/xhtml1/transitional" href=
8933: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 8934: class="pkgname">print/lyx</a> package, which uses
8935: the xpm library, version 3.4j to build:</p>
1.1 grant 8936: <pre class="programlisting">
8937: DEPENDS+= xpm-3.4j:../../graphics/xpm
8938: </pre>
8939:
8940: <p>You can also use wildcards in package
8941: dependences:</p>
8942: <pre class="programlisting">
8943: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
8944: </pre>
8945:
8946: <p>Note that such wildcard dependencies are
8947: retained when creating binary packages. The
8948: dependency is checked when installing the binary
8949: package and any package which matches the pattern
8950: will be used. Wildcard dependencies should be
8951: used with care.</p>
8952:
8953: <p>The “<span class=
8954: "quote">-[0-9]*</span>” should be used
8955: instead of “<span class=
8956: "quote">-*</span>” to avoid potentially
8957: ambiguous matches such as “<span class=
8958: "quote">tk-postgresql</span>” matching a
8959: “<span class="quote">tk-*</span>”
1.14 xtraeme 8960: <code class="varname">DEPENDS</code>.</p>
1.1 grant 8961:
8962: <p>Wildcards can also be used to specify that a
8963: package will only build against a certain minimum
8964: version of a pre-requisite:</p>
8965: <pre class="programlisting">
8966: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
8967: </pre>
8968:
8969: <p>This means that the package will build against
8970: version 3.5.4 of the tiff library or newer. Such
8971: a dependency may be warranted if, for example,
8972: the API of the library has changed with version
8973: 3.5.4 and a package would not compile against an
8974: earlier version of tiff.</p>
8975:
8976: <p>Please note that such dependencies should only
8977: be updated if a package requires a newer
8978: pre-requisite, but not to denote recommendations
8979: such as security updates or ABI changes that do
8980: not prevent a package from building correctly.
8981: Such recommendations can be expressed using
1.14 xtraeme 8982: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 8983: <pre class="programlisting">
8984: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
8985: </pre>
8986:
1.14 xtraeme 8987: <p>In addition to the above <code class=
8988: "varname">DEPENDS</code> line, this denotes that
1.1 grant 8989: while a package will build against
8990: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 8991: recommended. <code class=
8992: "varname">RECOMMENDED</code> entries will be
8993: turned into dependencies unless explicitly
8994: ignored (in which case a warning will be
8995: printed). Packages that are built with
1.1 grant 8996: recommendations ignored may not be uploaded to
8997: ftp.NetBSD.org by developers and should not be
8998: used across different systems that may have
8999: different versions of binary packages
9000: installed.</p>
9001:
9002: <p>For security fixes, please update the package
9003: vulnerabilities file as well as setting
1.14 xtraeme 9004: <code class="varname">RECOMMENDED</code>, see
1.1 grant 9005: <a href="#security-handling" title=
1.25 rillig 9006: "13.1.7. Handling packages with security problems">
9007: Section 13.1.7, “Handling packages with
1.1 grant 9008: security problems”</a> for more
9009: information.</p>
9010: </li>
9011:
9012: <li>
9013: <p>If your package needs some executable to be
1.17 sketch 9014: able to run correctly and if there's no
1.14 xtraeme 9015: <code class="filename">buildlink3.mk</code> file,
9016: this is specified using the <code class=
9017: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 9018: "http://www.w3.org/TR/xhtml1/transitional" href=
9019: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 9020: class="pkgname">print/lyx</a> package needs to be
9021: able to execute the latex binary from the teTeX
9022: package when it runs, and that is specified:</p>
1.1 grant 9023: <pre class="programlisting">
9024: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
9025: </pre>
9026:
9027: <p>The comment about wildcard dependencies from
9028: previous paragraph applies here, too.</p>
9029: </li>
9030: </ol>
9031: </div>
9032:
9033: <p>If your package needs files from another package to
9034: build, see the first part of the “<span class=
9035: "quote">do-configure</span>” target <a xmlns=
9036: "http://www.w3.org/TR/xhtml1/transitional" href=
9037: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20 ben 9038: class="pkgname">print/ghostscript5</a> package (it
9039: relies on the jpeg sources being present in source form
9040: during the build):</p>
1.1 grant 9041: <pre class="programlisting">
9042: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
9043: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
9044: fi
9045: </pre>
9046:
9047: <p>If you build any other packages that way, please
9048: make sure the working files are deleted too when this
9049: package's working files are cleaned up. The easiest way
9050: to do so is by adding a pre-clean target:</p>
9051: <pre class="programlisting">
9052: pre-clean:
9053: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
9054: </pre>
9055:
1.14 xtraeme 9056: <p>Please also note the <code class=
9057: "varname">BUILD_USES_MSGFMT</code> and <code class=
9058: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
9059: which are provided as convenience definitions. The
1.24 wiz 9060: former works out whether <a href=
9061: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
9062: <span class="citerefentry"><span class=
9063: "refentrytitle">msgfmt</span>(1)</span></a> is part of
9064: the base system, and, if it isn't, installs the
9065: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9066: href=
1.1 grant 9067: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20 ben 9068: class="pkgname">devel/gettext</a> package. The latter
9069: adds a build dependency on either an installed version
9070: of an older gettext package, or if it isn't, installs
9071: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9072: href=
9073: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
9074: class="pkgname">devel/gettext-m4</a> package.</p>
1.1 grant 9075: </div>
9076:
9077: <div class="sect2" lang="en" xml:lang="en">
9078: <div class="titlepage">
9079: <div>
9080: <div>
1.26 ! wiz 9081: <h3 class="title"><a name="id2633066" id=
! 9082: "id2633066"></a>13.1.4. Handling conflicts
1.1 grant 9083: with other packages</h3>
9084: </div>
9085: </div>
9086: </div>
9087:
9088: <p>Your package may conflict with other packages a user
9089: might already have installed on his system, e.g. if
9090: your package installs the same set of files like
9091: another package in our pkgsrc tree.</p>
9092:
1.14 xtraeme 9093: <p>In this case you can set <code class=
9094: "varname">CONFLICTS</code> to a space separated list of
1.1 grant 9095: packages (including version string) your package
9096: conflicts with.</p>
9097:
9098: <p>For example <a xmlns=
9099: "http://www.w3.org/TR/xhtml1/transitional" href=
9100: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20 ben 9101: class="pkgname">x11/Xaw3d</a> and <a xmlns=
9102: "http://www.w3.org/TR/xhtml1/transitional" href=
9103: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
9104: class="pkgname">x11/Xaw-Xpm</a> install provide the
9105: same shared library, thus you set in <code class=
9106: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 9107: <pre class="programlisting">
9108: CONFLICTS= Xaw-Xpm-[0-9]*
9109: </pre>
9110:
1.14 xtraeme 9111: <p>and in <code class=
9112: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 9113: <pre class="programlisting">
9114: CONFLICTS= Xaw3d-[0-9]*
9115: </pre>
9116:
9117: <p>Packages will automatically conflict with other
9118: packages with the name prefix and a different version
9119: string. “<span class=
9120: "quote">Xaw3d-1.5</span>” e.g. will automatically
9121: conflict with the older version “<span class=
9122: "quote">Xaw3d-1.3</span>”.</p>
9123: </div>
9124:
9125: <div class="sect2" lang="en" xml:lang="en">
9126: <div class="titlepage">
9127: <div>
9128: <div>
1.26 ! wiz 9129: <h3 class="title"><a name="id2633116" id=
! 9130: "id2633116"></a>13.1.5. Packages that cannot
1.1 grant 9131: or should not be built</h3>
9132: </div>
9133: </div>
9134: </div>
9135:
9136: <p>There are several reasons why a package might be
9137: instructed to not build under certain circumstances. If
9138: the package builds and runs on most platforms, the
1.14 xtraeme 9139: exceptions should be noted with <code class=
9140: "varname">NOT_FOR_PLATFORM</code>. If the package
9141: builds and runs on a small handful of platforms, set
9142: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
9143: If the package should be skipped (for example, because
9144: it provides functionality already provided by the
9145: system), set <code class=
9146: "varname">PKG_SKIP_REASON</code> to a descriptive
9147: message. If the package should fail because some
9148: preconditions are not met, set <code class=
9149: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 9150: message.</p>
9151:
1.14 xtraeme 9152: <p><code class="varname">IGNORE</code> is deprecated
1.1 grant 9153: because it didn't provide enough information to
9154: determine whether the build should fail.</p>
9155: </div>
9156:
9157: <div class="sect2" lang="en" xml:lang="en">
9158: <div class="titlepage">
9159: <div>
9160: <div>
1.26 ! wiz 9161: <h3 class="title"><a name="id2633142" id=
! 9162: "id2633142"></a>13.1.6. Packages which
1.1 grant 9163: should not be deleted, once installed</h3>
9164: </div>
9165: </div>
9166: </div>
9167:
9168: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 9169: has been installed, the <code class=
9170: "varname">PKG_PRESERVE</code> definition should be set
9171: in the package Makefile. This will be carried into any
1.1 grant 9172: binary package that is made from this pkgsrc entry. A
9173: “<span class="quote">preserved</span>”
9174: package will not be deleted using <a href=
9175: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
9176: <span class="citerefentry"><span class=
9177: "refentrytitle">pkg_delete</span>(1)</span></a> unless
9178: the “<span class="quote">-f</span>” option
9179: is used.</p>
9180: </div>
9181:
9182: <div class="sect2" lang="en" xml:lang="en">
9183: <div class="titlepage">
9184: <div>
9185: <div>
9186: <h3 class="title"><a name="security-handling" id=
1.25 rillig 9187: "security-handling"></a>13.1.7. Handling
1.1 grant 9188: packages with security problems</h3>
9189: </div>
9190: </div>
9191: </div>
9192:
9193: <p>When a vulnerability is found, this should be noted
1.14 xtraeme 9194: in <code class=
9195: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1 grant 9196: and after the commit of that file, it should be copied
1.14 xtraeme 9197: to both <code class=
9198: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
9199: and <code class=
9200: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
9201: on ftp.NetBSD.org using <code class=
9202: "filename">localsrc/security/advisories/Makefile</code>.
9203: In addition, if a <code class=
9204: "filename">buildlink3.mk</code> file exists for an
9205: affected package, bumping <code class=
9206: "varname">PKGREVISION</code> and creating a
9207: corresponding <code class=
9208: "varname">BUILDLINK_RECOMMENDED.<em class=
9209: "replaceable"><code>pkg</code></em></code> entry should
9210: be considered. See <a href="#buildlink" title=
1.25 rillig 9211: "Chapter 10. Buildlink methodology">Chapter 10,
1.1 grant 9212: <i>Buildlink methodology</i></a> for more information
1.14 xtraeme 9213: about writing <code class=
9214: "filename">buildlink3.mk</code> files and <code class=
9215: "varname">BUILDLINK_*</code> definitions.</p>
1.1 grant 9216:
9217: <p>Also, if the fix should be applied to the stable
9218: pkgsrc branch, be sure to submit a pullup request!</p>
9219: </div>
9220:
9221: <div class="sect2" lang="en" xml:lang="en">
9222: <div class="titlepage">
9223: <div>
9224: <div>
1.26 ! wiz 9225: <h3 class="title"><a name="id2633234" id=
! 9226: "id2633234"></a>13.1.8. How to handle
1.1 grant 9227: compiler bugs</h3>
9228: </div>
9229: </div>
9230: </div>
9231:
9232: <p>Some source files trigger bugs in the compiler,
9233: based on combinations of compiler version and
9234: architecture and almost always relation to optimisation
9235: being enabled. Common symptoms are gcc internal errors
9236: or never finishing compiling a file.</p>
9237:
9238: <p>Typically a workaround involves testing the
1.14 xtraeme 9239: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 9240: version, disabling optimisation for that
1.14 xtraeme 9241: file/<code class="varname">MACHINE_ARCH</code>/compiler
9242: combination, and documenting it in <code class=
9243: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 9244: number of examples!</p>
9245: </div>
9246:
9247: <div class="sect2" lang="en" xml:lang="en">
9248: <div class="titlepage">
9249: <div>
9250: <div>
1.26 ! wiz 9251: <h3 class="title"><a name="id2633324" id=
! 9252: "id2633324"></a>13.1.9. How to handle
1.1 grant 9253: incrementing versions when fixing an existing
9254: package</h3>
9255: </div>
9256: </div>
9257: </div>
9258:
9259: <p>When making fixes to an existing package it can be
1.14 xtraeme 9260: useful to change the version number in <code class=
9261: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 9262: future versions by the original author, a
9263: “<span class="quote">nb1</span>”,
9264: “<span class="quote">nb2</span>”, ...
9265: suffix can be used on package versions by setting
1.14 xtraeme 9266: <code class="varname">PKGREVISION=1</code> (2, ...).
9267: The “<span class="quote">nb</span>” is
9268: treated like a “<span class=
9269: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 9270: <pre class="programlisting">
9271: DISTNAME= foo-17.42
9272: PKGREVISION= 9
9273: </pre>
9274:
1.14 xtraeme 9275: <p>will result in a <code class=
9276: "varname">PKGNAME</code> of “<span class=
1.1 grant 9277: "quote">foo-17.42nb9</span>”.</p>
9278:
9279: <p>When a new release of the package is released, the
1.14 xtraeme 9280: <code class="varname">PKGREVISION</code> should be
9281: removed. e.g. on a new minor release of the above
9282: package, things should be like:</p>
1.1 grant 9283: <pre class="programlisting">
9284: DISTNAME= foo-17.43
9285: </pre>
9286: </div>
9287:
9288: <div class="sect2" lang="en" xml:lang="en">
9289: <div class="titlepage">
9290: <div>
9291: <div>
1.26 ! wiz 9292: <h3 class="title"><a name="id2633373" id=
! 9293: "id2633373"></a>13.1.10. Portability of
1.1 grant 9294: packages</h3>
9295: </div>
9296: </div>
9297: </div>
9298:
9299: <p>One appealing feature of pkgsrc is that it runs on
9300: many different platforms. As a result, it is important
9301: to ensure, where possible, that packages in pkgsrc are
9302: portable. There are some particular details you should
9303: pay attention to while working on pkgsrc.</p>
9304:
9305: <div class="sect3" lang="en" xml:lang="en">
9306: <div class="titlepage">
9307: <div>
9308: <div>
1.26 ! wiz 9309: <h4 class="title"><a name="id2633379" id=
! 9310: "id2633379"></a>13.1.10.1. ${INSTALL},
1.1 grant 9311: ${INSTALL_DATA_DIR}, ...</h4>
9312: </div>
9313: </div>
9314: </div>
9315:
1.14 xtraeme 9316: <p>The BSD-compatible <span><strong class=
9317: "command">install</strong></span> supplied with some
1.1 grant 9318: operating systems will not perform more than one
9319: operation at a time. As such, you should call
9320: “<span class="quote">${INSTALL}</span>”,
9321: etc. like this:</p>
9322: <pre class="programlisting">
9323: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
9324: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
9325: </pre>
9326: </div>
9327: </div>
9328: </div>
9329:
9330: <div class="sect1" lang="en" xml:lang="en">
9331: <div class="titlepage">
9332: <div>
9333: <div>
9334: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 9335: "id2633398" id="id2633398"></a>13.2. Possible
1.1 grant 9336: downloading issues</h2>
9337: </div>
9338: </div>
9339: </div>
9340:
9341: <div class="sect2" lang="en" xml:lang="en">
9342: <div class="titlepage">
9343: <div>
9344: <div>
1.26 ! wiz 9345: <h3 class="title"><a name="id2633401" id=
! 9346: "id2633401"></a>13.2.1. Packages whose
1.1 grant 9347: distfiles aren't available for plain
9348: downloading</h3>
9349: </div>
9350: </div>
9351: </div>
9352:
9353: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 9354: set <code class="varname">DYNAMIC_MASTER_SITES</code>
9355: and a <span><strong class="command">make
9356: fetch</strong></span> will call <code class=
9357: "filename">files/getsite.sh</code> with the name of
9358: each file to download as an argument, expecting it to
9359: output the URL of the directory from which to download
9360: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9361: href=
1.1 grant 9362: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20 ben 9363: class="pkgname">graphics/ns-cult3d</a> is an example of
9364: this usage.</p>
1.1 grant 9365:
9366: <p>If the download can't be automated, because the user
9367: must submit personal information to apply for a
9368: password, or must pay for the source, or whatever, you
1.14 xtraeme 9369: can set <code class="varname">_FETCH_MESSAGE</code> to
9370: a macro which displays a message explaining the
9371: situation. <code class="varname">_FETCH_MESSAGE</code>
9372: must be executable shell commands, not just a message.
9373: (Generally, it executes <code class=
9374: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 9375: following packages use this: <a xmlns=
9376: "http://www.w3.org/TR/xhtml1/transitional" href=
9377: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20 ben 9378: class="pkgname">audio/realplayer</a>, <a xmlns=
9379: "http://www.w3.org/TR/xhtml1/transitional" href=
9380: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
9381: class="pkgname">cad/simian</a>, <a xmlns=
9382: "http://www.w3.org/TR/xhtml1/transitional" href=
9383: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
9384: class="pkgname">devel/ipv6socket</a>, <a xmlns=
9385: "http://www.w3.org/TR/xhtml1/transitional" href=
9386: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
9387: class="pkgname">emulators/vmware-module</a>, <a xmlns=
9388: "http://www.w3.org/TR/xhtml1/transitional" href=
9389: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
9390: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
9391: "http://www.w3.org/TR/xhtml1/transitional" href=
9392: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
9393: class="pkgname">sysutils/storage-manager</a>, <a xmlns=
9394: "http://www.w3.org/TR/xhtml1/transitional" href=
9395: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
9396: class="pkgname">www/ap-aolserver</a>, <a xmlns=
9397: "http://www.w3.org/TR/xhtml1/transitional" href=
9398: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
9399: class="pkgname">www/openacs</a>. Try to be consistent
9400: with them.</p>
1.1 grant 9401: </div>
9402:
9403: <div class="sect2" lang="en" xml:lang="en">
9404: <div class="titlepage">
9405: <div>
9406: <div>
1.26 ! wiz 9407: <h3 class="title"><a name="id2633601" id=
! 9408: "id2633601"></a>13.2.2. How to handle
1.1 grant 9409: modified distfiles with the 'old' name</h3>
9410: </div>
9411: </div>
9412: </div>
9413:
9414: <p>Sometimes authors of a software package make some
9415: modifications after the software was released, and they
9416: put up a new distfile without changing the package's
9417: version number. If a package is already in pkgsrc at
9418: that time, the md5 checksum will no longer match. The
9419: correct way to work around this is to update the
9420: package's md5 checksum to match the package on the
9421: master site (beware, any mirrors may not be up to date
9422: yet!), and to remove the old distfile from
1.14 xtraeme 9423: ftp.NetBSD.org's <code class=
9424: "filename">/pub/NetBSD/packages/distfiles</code>
1.1 grant 9425: directory. Furthermore, a mail to the package's author
9426: seems appropriate making sure the distfile was really
9427: updated on purpose, and that no trojan horse or so
9428: crept in.</p>
9429: </div>
9430: </div>
9431:
9432: <div class="sect1" lang="en" xml:lang="en">
9433: <div class="titlepage">
9434: <div>
9435: <div>
9436: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 9437: "id2633612" id=
! 9438: "id2633612"></a>13.3. Configuration
1.1 grant 9439: gotchas</h2>
9440: </div>
9441: </div>
9442: </div>
9443:
9444: <div class="sect2" lang="en" xml:lang="en">
9445: <div class="titlepage">
9446: <div>
9447: <div>
9448: <h3 class="title"><a name="fixes.libtool" id=
1.25 rillig 9449: "fixes.libtool"></a>13.3.1. Shared libraries
1.1 grant 9450: - libtool</h3>
9451: </div>
9452: </div>
9453: </div>
9454:
9455: <p>pkgsrc supports many different machines, with
9456: different object formats like a.out and ELF, and
9457: varying abilities to do shared library and dynamic
9458: loading at all. To accompany this, varying commands and
9459: options have to be passed to the compiler, linker, etc.
9460: to get the Right Thing, which can be pretty annoying
9461: especially if you don't have all the machines at your
9462: hand to test things. The <a xmlns=
9463: "http://www.w3.org/TR/xhtml1/transitional" href=
9464: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20 ben 9465: class="pkgname">devel/libtool</a> pkg can help here, as
9466: it just “<span class="quote">knows</span>”
9467: how to build both static and dynamic libraries from a
9468: set of source files, thus being platform
9469: independent.</p>
1.1 grant 9470:
9471: <p>Here's how to use libtool in a pkg in seven simple
9472: steps:</p>
9473:
9474: <div class="orderedlist">
9475: <ol type="1">
9476: <li>
1.14 xtraeme 9477: <p>Add <code class=
9478: "varname">USE_LIBTOOL=yes</code> to the package
9479: Makefile.</p>
1.1 grant 9480: </li>
9481:
9482: <li>
9483: <p>For library objects, use “<span class=
9484: "quote">${LIBTOOL} --mode=compile
9485: ${CC}</span>” in place of
9486: “<span class="quote">${CC}</span>”.
9487: You could even add it to the definition of
1.14 xtraeme 9488: <code class="varname">CC</code>, if only
9489: libraries are being built in a given Makefile.
9490: This one command will build both PIC and non-PIC
9491: library objects, so you need not have separate
9492: shared and non-shared library rules.</p>
1.1 grant 9493: </li>
9494:
9495: <li>
9496: <p>For the linking of the library, remove any
9497: “<span class="quote">ar</span>”,
9498: “<span class="quote">ranlib</span>”,
9499: and “<span class="quote">ld
9500: -Bshareable</span>” commands, and instead
9501: use:</p>
9502: <pre class="programlisting">
9503: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
9504: </pre>
9505:
9506: <p>Note that the library is changed to have a
1.14 xtraeme 9507: <code class="filename">.la</code> extension, and
9508: the objects are changed to have a <code class=
9509: "filename">.lo</code> extension. Change
9510: <code class="varname">OBJS</code> as necessary.
9511: This automatically creates all of the
9512: <code class="filename">.a</code>, <code class=
9513: "filename">.so.major.minor</code>, and ELF
9514: symlinks (if necessary) in the build directory.
9515: Be sure to include “<span class=
1.1 grant 9516: "quote">-version-info</span>”, especially
9517: when major and minor are zero, as libtool will
9518: otherwise strip off the shared library
9519: version.</p>
9520:
9521: <p>From the libtool manual:</p>
9522: <pre class="programlisting">
9523: So, libtool library versions are described by three integers:
9524:
9525: CURRENT
9526: The most recent interface number that this library implements.
9527:
9528: REVISION
9529: The implementation number of the CURRENT interface.
9530:
9531: AGE
9532: The difference between the newest and oldest interfaces that this
9533: library implements. In other words, the library implements all the
9534: interface numbers in the range from number `CURRENT - AGE' to
9535: `CURRENT'.
9536:
9537: If two libraries have identical CURRENT and AGE numbers, then the
9538: dynamic linker chooses the library with the greater REVISION number.
9539: </pre>
9540:
9541: <p>The “<span class=
9542: "quote">-release</span>” option will
9543: produce different results for a.out and ELF
9544: (excluding symlinks) in only one case. An ELF
9545: library of the form “<span class=
9546: "quote">libfoo-release.so.<span class=
9547: "emphasis"><em>x</em></span>.<span class=
9548: "emphasis"><em>y</em></span></span>” will
9549: have a symlink of “<span class=
9550: "quote">libfoo.so.<span class=
9551: "emphasis"><em>x</em></span>.<span class=
9552: "emphasis"><em>y</em></span></span>” on an
9553: a.out platform. This is handled
9554: automatically.</p>
9555:
9556: <p>The “<span class="quote">-rpath
9557: argument</span>” is the install directory
9558: of the library being built.</p>
9559:
1.14 xtraeme 9560: <p>In the <code class="filename">PLIST</code>,
1.19 hubertf 9561: include only the <code class=
9562: "filename">.la</code> file, the other files will
9563: be added automatically.</p>
1.1 grant 9564: </li>
9565:
9566: <li>
1.14 xtraeme 9567: <p>When linking shared object (<code class=
9568: "filename">.so</code>) files, i.e. files that are
1.24 wiz 9569: loaded via <a href=
9570: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
9571: <span class="citerefentry"><span class=
9572: "refentrytitle">dlopen</span>(3)</span></a>, NOT
9573: shared libraries, use “<span class=
9574: "quote">-module -avoid-version</span>” to
9575: prevent them getting version tacked on.</p>
1.1 grant 9576:
1.14 xtraeme 9577: <p>The <code class="filename">PLIST</code> file
9578: gets the <code class="filename">foo.so</code>
9579: entry.</p>
1.1 grant 9580: </li>
9581:
9582: <li>
9583: <p>When linking programs that depend on these
9584: libraries <span class=
9585: "emphasis"><em>before</em></span> they are
9586: installed, preface the <a href=
9587: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
9588: <span class="citerefentry"><span class=
9589: "refentrytitle">cc</span>(1)</span></a> or
9590: <a href=
9591: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
9592: <span class="citerefentry"><span class=
9593: "refentrytitle">ld</span>(1)</span></a> line with
9594: “<span class="quote">${LIBTOOL}
9595: --mode=link</span>”, and it will find the
9596: correct libraries (static or shared), but please
9597: be aware that libtool will not allow you to
9598: specify a relative path in -L (such as
9599: “<span class=
9600: "quote">-L../somelib</span>”), because it
9601: expects you to change that argument to be the
1.14 xtraeme 9602: <code class="filename">.la</code> file. e.g.</p>
1.1 grant 9603: <pre class="programlisting">
9604: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
9605: </pre>
9606:
9607: <p>should be changed to:</p>
9608: <pre class="programlisting">
1.14 xtraeme 9609: ${LIBTOOL} --mode=link ${CC} -o <em class=
9610: "replaceable"><code>someprog</code></em> <em class=
9611: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 9612: </pre>
9613:
9614: <p>and it will do the right thing with the
9615: libraries.</p>
9616: </li>
9617:
9618: <li>
9619: <p>When installing libraries, preface the
9620: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
9621: <span class="citerefentry"><span class=
9622: "refentrytitle">install</span>(1)</span></a> or
9623: <a href=
9624: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
9625: <span class="citerefentry"><span class=
9626: "refentrytitle">cp</span>(1)</span></a> command
9627: with “<span class="quote">${LIBTOOL}
9628: --mode=install</span>”, and change the
1.14 xtraeme 9629: library name to <code class=
9630: "filename">.la</code>. e.g.</p>
1.1 grant 9631: <pre class="programlisting">
9632: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
9633: </pre>
9634:
1.14 xtraeme 9635: <p>This will install the static <code class=
9636: "filename">.a</code>, shared library, any needed
1.1 grant 9637: symlinks, and run <a href=
9638: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
9639: <span class="citerefentry"><span class=
9640: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
9641: </li>
9642:
9643: <li>
1.14 xtraeme 9644: <p>In your <code class="filename">PLIST</code>,
1.23 wiz 9645: include only the <code class=
9646: "filename">.la</code> file (this is a change from
9647: previous behaviour).</p>
1.1 grant 9648: </li>
9649: </ol>
9650: </div>
9651: </div>
9652:
9653: <div class="sect2" lang="en" xml:lang="en">
9654: <div class="titlepage">
9655: <div>
9656: <div>
1.26 ! wiz 9657: <h3 class="title"><a name="id2633978" id=
! 9658: "id2633978"></a>13.3.2. Using libtool on GNU
1.1 grant 9659: packages that already support libtool</h3>
9660: </div>
9661: </div>
9662: </div>
9663:
1.14 xtraeme 9664: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
9665: the package Makefile. This will override the package's
9666: own libtool in most cases. For older libtool using
1.1 grant 9667: packages, libtool is made by ltconfig script during the
9668: do-configure step; you can check the libtool script
1.14 xtraeme 9669: location by doing <span><strong class="command">make
9670: configure; find work*/ -name
9671: libtool</strong></span>.</p>
9672:
9673: <p><code class="varname">LIBTOOL_OVERRIDE</code>
9674: specifies which libtool scripts, relative to
9675: <code class="varname">WRKSRC</code>, to override. By
9676: default, it is set to “<span class=
9677: "quote">libtool */libtool */*/libtool</span>”. If
9678: this does not match the location of the package's
9679: libtool script(s), set it as appropriate.</p>
1.13 hubertf 9680:
1.14 xtraeme 9681: <p>If you do not need <code class="filename">*.a</code>
1.1 grant 9682: static libraries built and installed, then use
1.14 xtraeme 9683: <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1 grant 9684: instead.</p>
9685:
9686: <p>If your package makes use of the platform
9687: independent library for loading dynamic shared objects,
9688: that comes with libtool (libltdl), you should include
1.22 tv 9689: devel/libltdl/buildlink3.mk.</p>
1.1 grant 9690:
9691: <p>Some packages use libtool incorrectly so that the
9692: package may not work or build in some circumstances.
9693: Some of the more common errors are:</p>
9694:
9695: <div class="itemizedlist">
9696: <ul type="disc">
9697: <li>
9698: <p>The inclusion of a shared object (-module) as
9699: a dependent library in an executable or library.
9700: This in itself isn't a problem if one of two
9701: things has been done:</p>
9702:
9703: <div class="orderedlist">
9704: <ol type="1">
9705: <li>
9706: <p>The shared object is named correctly,
1.14 xtraeme 9707: i.e. <code class=
9708: "filename">libfoo.la</code>, not
9709: <code class="filename">foo.la</code></p>
1.1 grant 9710: </li>
9711:
9712: <li>
9713: <p>The -dlopen option is used when linking
9714: an executable.</p>
9715: </li>
9716: </ol>
9717: </div>
9718: </li>
9719:
9720: <li>
9721: <p>The use of libltdl without the correct calls
9722: to initialisation routines. The function
9723: lt_dlinit() should be called and the macro
1.14 xtraeme 9724: <code class=
9725: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 9726: included in executables.</p>
9727: </li>
9728: </ul>
9729: </div>
9730: </div>
9731:
9732: <div class="sect2" lang="en" xml:lang="en">
9733: <div class="titlepage">
9734: <div>
9735: <div>
1.26 ! wiz 9736: <h3 class="title"><a name="id2634059" id=
! 9737: "id2634059"></a>13.3.3. GNU
1.1 grant 9738: Autoconf/Automake</h3>
9739: </div>
9740: </div>
9741: </div>
9742:
9743: <p>If a package needs GNU autoconf or automake to be
9744: executed to regenerate the configure script and
9745: Makefile.in makefile templates, then they should be
9746: executed in a pre-configure target. Two Makefile
1.14 xtraeme 9747: fragments are provided in <code class=
9748: "filename">pkgsrc/mk/autoconf.mk</code> and
9749: <code class="filename">pkgsrc/mk/automake.mk</code> to
9750: help dealing with these tools. See comments in these
9751: files for details.</p>
1.1 grant 9752:
9753: <p>For packages that need only autoconf:</p>
9754: <pre class="programlisting">
9755: AUTOCONF_REQD= 2.50 # if default version is not good enough
9756: ...
9757:
9758: pre-configure:
9759: cd ${WRKSRC}; ${AUTOCONF}
9760:
9761: ...
9762: .include "../../mk/autoconf.mk"
9763: </pre>
9764:
9765: <p>and for packages that need automake and
9766: autoconf:</p>
9767: <pre class="programlisting">
9768: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
9769: ...
9770:
9771: pre-configure:
9772: cd ${WRKSRC}; \
9773: ${ACLOCAL}; \
9774: ${AUTOHEADER}; \
9775: ${AUTOMAKE} -a --foreign -i; \
9776: ${AUTOCONF}
9777:
9778: ...
9779: .include "../mk/automake.mk"
9780: </pre>
9781:
9782: <p>Packages which use GNU Automake will almost
9783: certainly require GNU Make, but that's automatically
1.14 xtraeme 9784: provided for you in <code class=
9785: "filename">mk/automake.mk</code>.</p>
1.1 grant 9786:
9787: <p>There are times when the configure process makes
9788: additional changes to the generated files, which then
9789: causes the build process to try to re-execute the
9790: automake sequence. This is prevented by touching
9791: various files in the configure stage. If this causes
1.14 xtraeme 9792: problems with your package you can set <code class=
9793: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 9794: Makefile.</p>
9795: </div>
9796: </div>
9797:
9798: <div class="sect1" lang="en" xml:lang="en">
9799: <div class="titlepage">
9800: <div>
9801: <div>
9802: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 9803: "id2634104" id="id2634104"></a>13.4. Building
1.1 grant 9804: considerations</h2>
9805: </div>
9806: </div>
9807: </div>
9808:
9809: <div class="sect2" lang="en" xml:lang="en">
9810: <div class="titlepage">
9811: <div>
9812: <div>
1.26 ! wiz 9813: <h3 class="title"><a name="id2634107" id=
! 9814: "id2634107"></a>13.4.1. CPP defines</h3>
1.1 grant 9815: </div>
9816: </div>
9817: </div>
9818:
9819: <p>To port an application to NetBSD, it's usually
9820: necessary for the compiler to be able to judge the
9821: system on which it's compiling, and we use definitions
9822: so that the C pre-processor can do this.</p>
9823:
9824: <p>To test whether you are working on a 4.4 BSD-derived
9825: system, you should use the BSD definition, which is
1.14 xtraeme 9826: defined in <code class=
9827: "filename"><sys/param.h></code> on said
1.1 grant 9828: systems.</p>
9829: <pre class="programlisting">
9830: #include <sys/param.h>
9831: </pre>
9832:
9833: <p>and then you can surround the BSD-specific parts of
9834: your package's C/C++ code using this conditional:</p>
9835: <pre class="programlisting">
9836: #if (defined(BSD) && BSD >= 199306)
9837: ...
9838: #endif
9839: </pre>
9840:
9841: <p>Please use the “<span class=
9842: "quote">__NetBSD__</span>” definition sparingly -
9843: it should only apply to features of NetBSD that are not
9844: present in other 4.4-lite derived BSDs.</p>
9845: </div>
9846: </div>
9847:
9848: <div class="sect1" lang="en" xml:lang="en">
9849: <div class="titlepage">
9850: <div>
9851: <div>
9852: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 9853: "id2634137" id="id2634137"></a>13.5. Package
1.1 grant 9854: specific actions</h2>
9855: </div>
9856: </div>
9857: </div>
9858:
9859: <div class="sect2" lang="en" xml:lang="en">
9860: <div class="titlepage">
9861: <div>
9862: <div>
1.26 ! wiz 9863: <h3 class="title"><a name="id2634140" id=
! 9864: "id2634140"></a>13.5.1. Package
1.1 grant 9865: configuration files</h3>
9866: </div>
9867: </div>
9868: </div>
9869:
9870: <p>Packages should be taught to look for their
1.14 xtraeme 9871: configuration files in <code class=
9872: "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1 grant 9873: through to the configure and build processes.
1.14 xtraeme 9874: <code class="varname">PKG_SYSCONFDIR</code> may be
1.1 grant 9875: customized in various ways by setting other make
9876: variables:</p>
9877:
9878: <div class="itemizedlist">
9879: <ul type="disc">
9880: <li>
1.14 xtraeme 9881: <p><code class="varname">PKG_SYSCONFBASE</code>
9882: is the main config directory under which all
9883: package configuration files are to be found. This
9884: defaults to <code class=
9885: "filename">${PREFIX}/etc</code>, but may be
9886: overridden in <code class=
9887: "filename">/etc/mk.conf</code>.</p>
1.1 grant 9888: </li>
9889:
9890: <li>
1.14 xtraeme 9891: <p><code class="varname">PKG_SYSCONFSUBDIR</code>
9892: is the subdirectory of <code class=
9893: "varname">PKG_SYSCONFBASE</code> under which the
1.1 grant 9894: configuration files for a particular package may
9895: be found, e.g. the Apache configuration files may
1.14 xtraeme 9896: all be found under the <code class=
9897: "filename">httpd/</code> subdirectory of
9898: <code class="varname">${PKG_SYSCONFBASE}</code>.
9899: This should be set in the package Makefile.</p>
1.1 grant 9900: </li>
9901:
9902: <li>
1.14 xtraeme 9903: <p>By default, <code class=
9904: "varname">PKG_SYSCONFDIR</code> is set to
9905: <code class=
9906: "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
9907: but this may be overridden by setting
9908: <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9909: for a particular package, where <code class=
9910: "varname">PKG_SYSCONFVAR</code> defaults to
9911: <code class="varname">${PKGBASE}</code>. This is
9912: not meant to be set by a package Makefile, but is
1.1 grant 9913: reserved for users who wish to override the
1.14 xtraeme 9914: <code class="varname">PKG_SYSCONFDIR</code>
9915: setting for a particular package with a special
1.1 grant 9916: location.</p>
9917: </li>
9918: </ul>
9919: </div>
9920:
9921: <p>The only variables that users should customize are
1.14 xtraeme 9922: <code class="varname">PKG_SYSCONFBASE</code> and
9923: <code class=
9924: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
9925: Users will typically want to set <code class=
9926: "varname">PKG_SYSCONFBASE</code> to <code class=
9927: "filename">/etc</code>, or to accept the default
9928: location of <code class=
9929: "filename">${PREFIX}/etc</code>.</p>
1.1 grant 9930: </div>
9931:
9932: <div class="sect2" lang="en" xml:lang="en">
9933: <div class="titlepage">
9934: <div>
9935: <div>
1.26 ! wiz 9936: <h3 class="title"><a name="id2634311" id=
! 9937: "id2634311"></a>13.5.2. User
1.2 hubertf 9938: interaction</h3>
1.1 grant 9939: </div>
9940: </div>
9941: </div>
9942:
9943: <p>Occasionally, packages require interaction from the
9944: user, and this can be in a number of ways:</p>
9945:
9946: <div class="itemizedlist">
9947: <ul type="disc">
9948: <li>
9949: <p>help in fetching the distfiles</p>
9950: </li>
9951:
9952: <li>
9953: <p>help to configure the package before it is
9954: built</p>
9955: </li>
9956:
9957: <li>
9958: <p>help during the build process</p>
9959: </li>
9960:
9961: <li>
9962: <p>help during the installation of a package</p>
9963: </li>
9964: </ul>
9965: </div>
9966:
1.14 xtraeme 9967: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 9968: definition is provided to notify the pkgsrc mechanism
9969: of an interactive stage which will be needed, and this
1.14 xtraeme 9970: should be set in the package's <code class=
9971: "filename">Makefile</code>. e.g.</p>
1.1 grant 9972: <pre class="programlisting">
9973: INTERACTIVE_STAGE= build
9974: </pre>
9975:
9976: <p>Multiple interactive stages can be specified:</p>
9977: <pre class="programlisting">
9978: INTERACTIVE_STAGE= configure install
9979: </pre>
9980: </div>
9981:
9982: <div class="sect2" lang="en" xml:lang="en">
9983: <div class="titlepage">
9984: <div>
9985: <div>
1.26 ! wiz 9986: <h3 class="title"><a name="id2634492" id=
! 9987: "id2634492"></a>13.5.3. Handling
1.1 grant 9988: licenses</h3>
9989: </div>
9990: </div>
9991: </div>
9992:
9993: <p>A package may underly a license which the user has
9994: or has not agreed to accept. Usually, packages that
9995: underly well-known Open Source licenses (e.g. the GNU
9996: Public License, GPL) won't have any special license
9997: tags added in pkgsrc which require special action by
9998: the user of such packages, but there are quite a number
9999: of other licenses out there that pkgsrc users may not
10000: be able to follow, for whatever reasons. For these
10001: cases, pkgsrc contains a mechanism to note that a
10002: package underlies a certain license, and the user has
10003: to accept the license before the package can be
10004: installed.</p>
10005:
10006: <p>Placing a certain package under a certain license
1.14 xtraeme 10007: works by setting the <code class=
10008: "varname">LICENSE</code> variable to a string
10009: identifying the license, e.g. in <a xmlns=
10010: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10011: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20 ben 10012: class="pkgname">graphics/graphviz</a>:</p>
1.1 grant 10013: <pre class="programlisting">
10014: LICENSE= graphviz-license
10015: </pre>
10016:
10017: <p>When trying to build, the user will get a notice
10018: that the package underlies a license which he hasn't
10019: accepted (yet):</p>
10020: <pre class="programlisting">
1.14 xtraeme 10021: <code class="prompt">%</code> <strong class=
10022: "userinput"><code>make</code></strong>
1.1 grant 10023: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
10024: ===> To build this package, add this line to your /etc/mk.conf:
10025: ===> ACCEPTABLE_LICENSES+=graphviz-license
10026: ===> To view the license, enter "/usr/bin/make show-license".
10027: *** Error code 1
10028: </pre>
10029:
1.14 xtraeme 10030: <p>The license can be viewed with <span><strong class=
10031: "command">make show-license</strong></span>, and if it
10032: is considered appropriate, the line printed above can
10033: be added to <code class="filename">/etc/mk.conf</code>
10034: to indicate acceptance of the particular license:</p>
1.1 grant 10035: <pre class="programlisting">
10036: ACCEPTABLE_LICENSES+=graphviz-license
10037: </pre>
10038:
10039: <p>When adding a package with a new license, the
1.14 xtraeme 10040: license text should be added to <code class=
10041: "filename">pkgsrc/licenses</code> for displaying. A
10042: list of known licenses can be seen in this directory as
10043: well as by looking at the list of (commented out)
10044: <code class="varname">ACCEPTABLE_LICENSES</code>
10045: variable settings in <code class=
10046: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 10047:
1.17 sketch 10048: <p>If there is a <span class=
1.1 grant 10049: "emphasis"><em>really</em></span> pressing need to
10050: accept all licenses at once, like when trying to
10051: download or mirror all distfiles or doing a bulk build
10052: to test if all packages in pkgsrc build, this can be
1.14 xtraeme 10053: done by setting <code class=
10054: "varname">_ACCEPTABLE=yes</code>.</p>
1.1 grant 10055: </div>
10056:
10057: <div class="sect2" lang="en" xml:lang="en">
10058: <div class="titlepage">
10059: <div>
10060: <div>
1.26 ! wiz 10061: <h3 class="title"><a name="id2634644" id=
! 10062: "id2634644"></a>13.5.4. Creating an account
1.1 grant 10063: from a package</h3>
10064: </div>
10065: </div>
10066: </div>
10067:
10068: <p>There are two make variables used to control the
10069: creation of package-specific groups and users at
1.14 xtraeme 10070: pre-install time. The first is <code class=
10071: "varname">PKG_GROUPS</code>, which is a list of
1.1 grant 10072: group[:groupid] elements, where the groupid is
1.14 xtraeme 10073: optional. The second is <code class=
10074: "varname">PKG_USERS</code>, which is a list of elements
1.1 grant 10075: of the form:</p>
10076: <pre class="programlisting">
10077: user:group[:[userid][:[description][:[home][:shell]]]]
10078: </pre>
10079:
10080: <p>where only the user and group are required, the rest
10081: being optional. A simple example is:</p>
10082: <pre class="programlisting">
10083: PKG_GROUPS= foogroup
10084: PKG_USERS= foouser:foogroup
10085: </pre>
10086:
10087: <p>A more complex example is that creates two groups
10088: and two users is:</p>
10089: <pre class="programlisting">
10090: PKG_GROUPS= group1 group2:1005
10091: PKG_USERS= first:group1::First\\ User \
10092: second:group2::Second\\ User:/home/second:${SH}
10093: </pre>
10094:
10095: <p>By default, a new user will have home directory
1.14 xtraeme 10096: <code class="filename">/nonexistent</code>, and login
10097: shell <code class="filename">/sbin/nologin</code>
10098: unless they are specified as part of the user
10099: element.</p>
1.1 grant 10100:
1.14 xtraeme 10101: <p>The package <code class="filename">Makefile</code>
10102: must also set <code class=
10103: "varname">USE_PKGINSTALL=YES</code>. This will cause
10104: the users and groups to be created at pre-install time,
10105: and the admin will be prompted to remove them at
10106: post-deinstall time. Automatic creation of the users
10107: and groups can be toggled on and off by setting the
10108: <code class="varname">PKG_CREATE_USERGROUP</code>
10109: variable prior to package installation.</p>
1.1 grant 10110: </div>
10111:
10112: <div class="sect2" lang="en" xml:lang="en">
10113: <div class="titlepage">
10114: <div>
10115: <div>
1.26 ! wiz 10116: <h3 class="title"><a name="id2634706" id=
! 10117: "id2634706"></a>13.5.5. Installing score
1.1 grant 10118: files</h3>
10119: </div>
10120: </div>
10121: </div>
10122:
10123: <p>Certain packages, most of them in the games
10124: category, install a score file that allows all users on
10125: the system to record their highscores. In order for
10126: this to work, the binaries need to be installed setgid
10127: and the score files owned by the appropriate group
10128: and/or owner (traditionally the "games" user/group).
10129: The following variables, documented in more detail in
1.14 xtraeme 10130: <code class="filename">mk/defaults/mk.conf</code>,
10131: control this behaviour: <code class=
10132: "varname">SETGIDGAME</code>, <code class=
10133: "varname">GAMEDATAMODE</code>, <code class=
10134: "varname">GAMEGRP</code>, <code class=
10135: "varname">GAMEMODE</code>, <code class=
10136: "varname">GAMEOWN</code>.</p>
1.1 grant 10137:
10138: <p>Note that per default, setgid installation of games
1.14 xtraeme 10139: is disabled; setting <code class=
10140: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 10141: variables accordingly.</p>
10142:
10143: <p>A package should therefor never hard code file
1.14 xtraeme 10144: ownership or access permissions but rely on
10145: <code class="varname">INSTALL_GAME</code> and
10146: <code class="varname">INSTALL_GAME_DATA</code> to set
10147: these correctly.</p>
1.1 grant 10148: </div>
10149:
10150: <div class="sect2" lang="en" xml:lang="en">
10151: <div class="titlepage">
10152: <div>
10153: <div>
1.26 ! wiz 10154: <h3 class="title"><a name="id2634749" id=
! 10155: "id2634749"></a>13.5.6. Packages providing
1.1 grant 10156: login shells</h3>
10157: </div>
10158: </div>
10159: </div>
10160:
10161: <p>If the purpose of the package is to provide a login
1.14 xtraeme 10162: shell, the variable <code class=
10163: "varname">PKG_SHELL</code> should contain the full
10164: pathname of the shell executable installed by this
10165: package. The package <code class=
10166: "filename">Makefile</code> must also set <code class=
10167: "varname">USE_PKGINSTALL=YES</code> to use the
10168: automatically generated <code class=
10169: "filename">INSTALL</code>/<code class=
10170: "filename">DEINSTALL</code> scripts.</p>
1.1 grant 10171:
10172: <p>An example taken from shells/zsh:</p>
10173: <pre class="programlisting">
10174: USE_PKGINSTALL= YES
10175: PKG_SHELL= ${PREFIX}/bin/zsh
10176: </pre>
10177:
1.14 xtraeme 10178: <p>The shell is registered into <code class=
10179: "filename">/etc/shells</code> file automatically in the
10180: post-install target by the generated <code class=
10181: "filename">INSTALL</code> script and removed in the
10182: deinstall target by the <code class=
10183: "filename">DEINSTALL</code> script.</p>
1.1 grant 10184: </div>
10185:
10186: <div class="sect2" lang="en" xml:lang="en">
10187: <div class="titlepage">
10188: <div>
10189: <div>
1.26 ! wiz 10190: <h3 class="title"><a name="id2634807" id=
! 10191: "id2634807"></a>13.5.7. Packages containing
1.1 grant 10192: perl scripts</h3>
10193: </div>
10194: </div>
10195: </div>
10196:
10197: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 10198: set <code class="varname">REPLACE_PERL</code> to ensure
10199: that the proper interpreter path is set. <code class=
10200: "varname">REPLACE_PERL</code> should contain a list of
10201: scripts, relative to <code class=
10202: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 10203: </div>
10204:
10205: <div class="sect2" lang="en" xml:lang="en">
10206: <div class="titlepage">
10207: <div>
10208: <div>
1.26 ! wiz 10209: <h3 class="title"><a name="id2634825" id=
! 10210: "id2634825"></a>13.5.8. Packages with
1.1 grant 10211: hardcoded paths to other interpreters</h3>
10212: </div>
10213: </div>
10214: </div>
10215:
10216: <p>Your package may also contain scripts with hardcoded
10217: paths to other interpreters besides (or as well as)
10218: perl. To correct the full pathname to the script
10219: interpreter, you need to set the following definitions
1.14 xtraeme 10220: in your <code class="filename">Makefile</code> (we
10221: shall use <span><strong class=
10222: "command">tclsh</strong></span> in this example):</p>
1.1 grant 10223: <pre class="programlisting">
10224: REPLACE_INTERPRETER+= tcl
10225: _REPLACE.tcl.old= .*/bin/tclsh
10226: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
10227: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
10228: relative to ${WRKSRC}, just as in REPLACE_PERL
10229: </pre>
10230: </div>
10231:
10232: <div class="sect2" lang="en" xml:lang="en">
10233: <div class="titlepage">
10234: <div>
10235: <div>
1.26 ! wiz 10236: <h3 class="title"><a name="id2634846" id=
! 10237: "id2634846"></a>13.5.9. Packages installing
1.1 grant 10238: perl modules</h3>
10239: </div>
10240: </div>
10241: </div>
10242:
10243: <p>Makefiles of packages providing perl5 modules should
1.14 xtraeme 10244: include the Makefile fragment <code class=
10245: "filename">../../lang/perl5/module.mk</code>. It
10246: provides a <span><strong class=
10247: "command">do-configure</strong></span> target for the
10248: standard perl configuration for such modules as well as
10249: various hooks to tune this configuration. See comments
10250: in this file for details.</p>
1.1 grant 10251:
10252: <p>Perl5 modules will install into different places
10253: depending on the version of perl used during the build
10254: process. To address this, pkgsrc will append lines to
1.14 xtraeme 10255: the <code class="filename">PLIST</code> corresponding
10256: to the files listed in the installed <code class=
10257: "filename">.packlist</code> file generated by most
10258: perl5 modules. This is invoked by defining <code class=
10259: "varname">PERL5_PACKLIST</code> to a space-separated
10260: list of paths to packlist files, e.g.:</p>
1.1 grant 10261: <pre class="programlisting">
10262: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
10263: </pre>
10264:
1.14 xtraeme 10265: <p>The variables <code class=
10266: "varname">PERL5_SITELIB</code>, <code class=
10267: "varname">PERL5_SITEARCH</code>, and <code class=
10268: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 10269: locations in which perl5 modules may be installed, and
10270: may be used by perl5 packages that don't have a
10271: packlist. These three variables are also substituted
1.14 xtraeme 10272: for in the <code class="filename">PLIST</code>.</p>
1.1 grant 10273: </div>
10274:
10275: <div class="sect2" lang="en" xml:lang="en">
10276: <div class="titlepage">
10277: <div>
10278: <div>
10279: <h3 class="title"><a name="faq.info-files" id=
1.25 rillig 10280: "faq.info-files"></a>13.5.10. Packages
1.1 grant 10281: installing info files</h3>
10282: </div>
10283: </div>
10284: </div>
10285:
10286: <p>Some packages install info files or use the
10287: “<span class="quote">makeinfo</span>” or
10288: “<span class="quote">install-info</span>”
10289: commands. Each of the info files:</p>
10290:
10291: <div class="itemizedlist">
10292: <ul type="disc">
10293: <li>
10294: <p>is considered to be installed in the directory
1.14 xtraeme 10295: <code class=
10296: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 10297: </li>
10298:
10299: <li>
10300: <p>is registered in the Info directory file
1.14 xtraeme 10301: <code class=
10302: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 10303: </li>
10304:
10305: <li>
10306: <p>and must be listed as a filename in the
1.14 xtraeme 10307: <code class="varname">INFO_FILES</code> variable
10308: in the package Makefile.</p>
1.1 grant 10309: </li>
10310: </ul>
10311: </div>
10312:
1.14 xtraeme 10313: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 10314: “<span class="quote">info</span>” and can
1.14 xtraeme 10315: be overridden in the package Makefile. <code class=
10316: "filename">INSTALL</code> and <code class=
10317: "filename">DEINSTALL</code> scripts will be generated
10318: to handle registration of the info files in the Info
1.1 grant 10319: directory file. The “<span class=
10320: "quote">install-info</span>” command used for the
10321: info files registration is either provided by the
10322: system, or by a special purpose package automatically
10323: added as dependency if needed.</p>
10324:
10325: <p>A package which needs the “<span class=
10326: "quote">makeinfo</span>” command at build time
1.14 xtraeme 10327: must define the variable <code class=
10328: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 10329: minimum version of the “<span class=
10330: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 10331: should be noted with the <code class=
10332: "varname">TEXINFO_REQD</code> variable in the package
10333: <code class="filename">Makefile</code>. By default, a
1.1 grant 10334: minimum version of 3.12 is required. If the system does
1.14 xtraeme 10335: not provide a <span><strong class=
10336: "command">makeinfo</strong></span> command or if it
10337: does not match the required minimum, a build dependency
10338: on the <a xmlns=
10339: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10340: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20 ben 10341: class="pkgname">devel/gtexinfo</a> package will be
10342: added automatically.</p>
1.1 grant 10343:
10344: <p>The build and installation process of the software
10345: provided by the package should not use the
1.14 xtraeme 10346: <span><strong class=
10347: "command">install-info</strong></span> command as the
10348: registration of info files is the task of the package
10349: <code class="filename">INSTALL</code> script, and it
10350: must use the appropriate <span><strong class=
10351: "command">makeinfo</strong></span> command.</p>
1.1 grant 10352:
10353: <p>To achieve this goal the pkgsrc infrastructure
1.14 xtraeme 10354: creates overriding scripts for the <span><strong class=
10355: "command">install-info</strong></span> and
10356: <span><strong class="command">makeinfo</strong></span>
10357: commands in a directory listed early in <code class=
10358: "varname">PATH</code>.</p>
1.1 grant 10359:
1.14 xtraeme 10360: <p>The script overriding <span><strong class=
10361: "command">install-info</strong></span> has no effect
10362: except the logging of a message. The script overriding
10363: <span><strong class="command">makeinfo</strong></span>
10364: logs a message and according to the value of
10365: <code class="varname">USE_MAKEINFO</code> and
10366: <code class="varname">TEXINFO_REQD</code> either run
10367: the appropriate <span><strong class=
10368: "command">makeinfo</strong></span> command or exit on
10369: error.</p>
1.1 grant 10370: </div>
10371:
10372: <div class="sect2" lang="en" xml:lang="en">
10373: <div class="titlepage">
10374: <div>
10375: <div>
1.26 ! wiz 10376: <h3 class="title"><a name="id2635134" id=
! 10377: "id2635134"></a>13.5.11. Packages installing
1.1 grant 10378: GConf2 data files</h3>
10379: </div>
10380: </div>
10381: </div>
10382:
1.14 xtraeme 10383: <p>If a package installs <code class=
10384: "filename">.schemas</code> or <code class=
10385: "filename">.entries</code> files, used by GConf2, you
1.1 grant 10386: need to take some extra steps to make sure they get
10387: registered in the database:</p>
10388:
10389: <div class="orderedlist">
10390: <ol type="1">
10391: <li>
1.14 xtraeme 10392: <p>Include <code class=
10393: "filename">../../devel/GConf2/schemas.mk</code>
10394: instead of its <code class=
10395: "filename">buildlink3.mk</code> file. This takes
1.1 grant 10396: care of rebuilding the GConf2 database at
10397: installation and deinstallation time, and tells
10398: the package where to install GConf2 data files
10399: using some standard configure arguments. It also
10400: disallows any access to the database directly
10401: from the package.</p>
10402: </li>
10403:
10404: <li>
10405: <p>Ensure that the package installs its
1.14 xtraeme 10406: <code class="filename">.schemas</code> files
10407: under <code class=
10408: "filename">${PREFIX}/share/gconf/schemas</code>.
10409: If they get installed under <code class=
10410: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 10411: manually patch the package.</p>
10412: </li>
10413:
10414: <li>
10415: <p>Check the PLIST and remove any entries under
10416: the etc/gconf directory, as they will be handled
10417: automatically. See <a href="#faq.conf" title=
1.14 xtraeme 10418: "6.14. Configuration files handling and placement">
10419: Section 6.14, “Configuration files
1.1 grant 10420: handling and placement”</a> for more
10421: information.</p>
10422: </li>
10423:
10424: <li>
1.14 xtraeme 10425: <p>Define the <code class=
10426: "varname">GCONF2_SCHEMAS</code> variable in your
10427: <code class="filename">Makefile</code> with a
10428: list of all <code class=
10429: "filename">.schemas</code> files installed by the
10430: package, if any. Names must not contain any
10431: directories in them.</p>
1.1 grant 10432: </li>
10433:
10434: <li>
1.14 xtraeme 10435: <p>Define the <code class=
10436: "varname">GCONF2_ENTRIES</code> variable in your
10437: <code class="filename">Makefile</code> with a
10438: list of all <code class=
10439: "filename">.entries</code> files installed by the
10440: package, if any. Names must not contain any
10441: directories in them.</p>
1.1 grant 10442: </li>
10443: </ol>
10444: </div>
10445: </div>
10446:
10447: <div class="sect2" lang="en" xml:lang="en">
10448: <div class="titlepage">
10449: <div>
10450: <div>
1.26 ! wiz 10451: <h3 class="title"><a name="id2635303" id=
! 10452: "id2635303"></a>13.5.12. Packages installing
1.1 grant 10453: scrollkeeper data files</h3>
10454: </div>
10455: </div>
10456: </div>
10457:
1.14 xtraeme 10458: <p>If a package installs <code class=
10459: "filename">.omf</code> files, used by scrollkeeper, you
10460: need to take some extra steps to make sure they get
10461: registered in the database:</p>
1.1 grant 10462:
10463: <div class="orderedlist">
10464: <ol type="1">
10465: <li>
1.14 xtraeme 10466: <p>Include <code class=
10467: "filename">../../textproc/scrollkeeper/omf.mk</code>
10468: instead of its <code class=
10469: "filename">buildlink3.mk</code> file. This takes
1.1 grant 10470: care of rebuilding the scrollkeeper database at
10471: installation and deinstallation time, and
10472: disallows any access to it directly from the
10473: package.</p>
10474: </li>
10475:
10476: <li>
10477: <p>Check the PLIST and remove any entries under
1.14 xtraeme 10478: the <code class=
10479: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 10480: as they will be handled automatically.</p>
10481: </li>
10482:
10483: <li>
1.14 xtraeme 10484: <p>Remove the <code class=
10485: "filename">share/omf</code> directory from the
10486: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 10487: </li>
10488: </ol>
10489: </div>
10490: </div>
10491:
10492: <div class="sect2" lang="en" xml:lang="en">
10493: <div class="titlepage">
10494: <div>
10495: <div>
1.26 ! wiz 10496: <h3 class="title"><a name="id2635354" id=
! 10497: "id2635354"></a>13.5.13. Packages installing
1.1 grant 10498: X11 fonts</h3>
10499: </div>
10500: </div>
10501: </div>
10502:
10503: <p>If a package installs font files, you will need to
10504: rebuild the fonts database in the directory where they
10505: get installed at installation and deinstallation time.
1.14 xtraeme 10506: This can be automatically done by using <code class=
10507: "filename">mk/fonts.mk</code>, which you need to
10508: include in your <code class=
10509: "filename">Makefile</code>.</p>
1.1 grant 10510:
10511: <p>When the file is included, you can list the
1.14 xtraeme 10512: directories where fonts are installed in the
10513: <code class="varname">FONTS_<em class=
10514: "replaceable"><code>type</code></em>_DIRS</code>
10515: variables, where <em class=
10516: "replaceable"><code>type</code></em> can be one of
10517: “<span class="quote">TTF</span>”,
1.1 grant 10518: “<span class="quote">TYPE1</span>” or
10519: “<span class="quote">X11</span>”. Also make
1.14 xtraeme 10520: sure that the database file <code class=
10521: "filename">fonts.dir</code> is not listed in the
1.1 grant 10522: PLIST.</p>
10523:
10524: <p>Note that you should not create new directories for
10525: fonts; instead use the standard ones to avoid that the
10526: user needs to manually configure his X server to find
10527: them.</p>
10528: </div>
10529:
10530: <div class="sect2" lang="en" xml:lang="en">
10531: <div class="titlepage">
10532: <div>
10533: <div>
1.26 ! wiz 10534: <h3 class="title"><a name="id2635469" id=
! 10535: "id2635469"></a>13.5.14. Packages installing
1.1 grant 10536: GTK2 modules</h3>
10537: </div>
10538: </div>
10539: </div>
10540:
10541: <p>If a package installs gtk2 immodules or loaders, you
10542: need to take some extra steps to get them registered in
10543: the GTK2 database properly:</p>
10544:
10545: <div class="orderedlist">
10546: <ol type="1">
10547: <li>
1.14 xtraeme 10548: <p>Include <code class=
10549: "filename">../../x11/gtk2/modules.mk</code>
10550: instead of its <code class=
10551: "filename">buildlink3.mk</code> file. This takes
10552: care of rebuilding the database at installation
10553: and deinstallation time.</p>
1.1 grant 10554: </li>
10555:
10556: <li>
1.14 xtraeme 10557: <p>Set <code class=
10558: "varname">GTK2_IMMODULES=YES</code> if your
10559: package installs GTK2 immodules.</p>
1.1 grant 10560: </li>
10561:
10562: <li>
1.14 xtraeme 10563: <p>Set <code class=
10564: "varname">GTK2_LOADERS=YES</code> if your package
10565: installs GTK2 loaders.</p>
1.1 grant 10566: </li>
10567:
10568: <li>
10569: <p>Patch the package to not touch any of the gtk2
10570: databases directly. These are:</p>
10571:
10572: <div class="itemizedlist">
10573: <ul type="disc">
10574: <li>
1.14 xtraeme 10575: <p><code class=
10576: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 10577: </li>
10578:
10579: <li>
1.14 xtraeme 10580: <p><code class=
10581: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 10582: </li>
10583: </ul>
10584: </div>
10585: </li>
10586:
10587: <li>
10588: <p>Check the PLIST and remove any entries under
1.14 xtraeme 10589: the <code class="filename">libdata/gtk-2.0</code>
1.1 grant 10590: directory, as they will be handled
10591: automatically.</p>
10592: </li>
10593: </ol>
10594: </div>
10595: </div>
10596:
10597: <div class="sect2" lang="en" xml:lang="en">
10598: <div class="titlepage">
10599: <div>
10600: <div>
1.26 ! wiz 10601: <h3 class="title"><a name="id2635539" id=
! 10602: "id2635539"></a>13.5.15. Packages installing
1.1 grant 10603: SGML or XML data</h3>
10604: </div>
10605: </div>
10606: </div>
10607:
10608: <p>If a package installs SGML or XML data files that
10609: need to be registered in system-wide catalogs (like
10610: DTDs, sub-catalogs, etc.), you need to take some extra
10611: steps:</p>
10612:
10613: <div class="orderedlist">
10614: <ol type="1">
10615: <li>
1.14 xtraeme 10616: <p>Include <code class=
10617: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
10618: in your <code class="filename">Makefile</code>,
10619: which takes care of registering those files in
1.1 grant 10620: system-wide catalogs at installation and
10621: deinstallation time.</p>
10622: </li>
10623:
10624: <li>
1.14 xtraeme 10625: <p>Set <code class="varname">SGML_CATALOGS</code>
10626: to the full path of any SGML catalogs installed
10627: by the package.</p>
1.1 grant 10628: </li>
10629:
10630: <li>
1.14 xtraeme 10631: <p>Set <code class="varname">XML_CATALOGS</code>
10632: to the full path of any XML catalogs installed by
1.1 grant 10633: the package.</p>
10634: </li>
10635:
10636: <li>
1.14 xtraeme 10637: <p>Set <code class="varname">SGML_ENTRIES</code>
10638: to individual entries to be added to the SGML
1.1 grant 10639: catalog. These come in groups of three strings;
10640: see xmlcatmgr(1) for more information
10641: (specifically, arguments recognized by the 'add'
10642: action). Note that you will normally not use this
10643: variable.</p>
10644: </li>
10645:
10646: <li>
1.14 xtraeme 10647: <p>Set <code class="varname">XML_ENTRIES</code>
10648: to individual entries to be added to the XML
1.1 grant 10649: catalog. These come in groups of three strings;
10650: see xmlcatmgr(1) for more information
10651: (specifically, arguments recognized by the 'add'
10652: action). Note that you will normally not use this
10653: variable.</p>
10654: </li>
10655: </ol>
10656: </div>
10657: </div>
10658:
10659: <div class="sect2" lang="en" xml:lang="en">
10660: <div class="titlepage">
10661: <div>
10662: <div>
1.26 ! wiz 10663: <h3 class="title"><a name="id2635659" id=
! 10664: "id2635659"></a>13.5.16. Packages installing
1.1 grant 10665: extensions to the MIME database</h3>
10666: </div>
10667: </div>
10668: </div>
10669:
10670: <p>If a package provides extensions to the MIME
1.14 xtraeme 10671: database by installing <code class=
10672: "filename">.xml</code> files inside <code class=
10673: "filename">${PREFIX}/share/mime/packages</code>, you
10674: need to take some extra steps to ensure that the
10675: database is kept consistent with respect to these new
10676: files:</p>
1.1 grant 10677:
10678: <div class="orderedlist">
10679: <ol type="1">
10680: <li>
1.14 xtraeme 10681: <p>Include <code class=
10682: "filename">../../databases/shared-mime-info/mimedb.mk</code>
10683: (avoid using the <code class=
10684: "filename">buildlink3.mk</code> file from this
10685: same directory, which is reserved for inclusion
10686: from other <code class=
10687: "filename">buildlink3.mk</code> files). It takes
10688: care of rebuilding the MIME database at
10689: installation and deinstallation time, and
10690: disallows any access to it directly from the
1.1 grant 10691: package.</p>
10692: </li>
10693:
10694: <li>
10695: <p>Check the PLIST and remove any entries under
1.14 xtraeme 10696: the <code class="filename">share/mime</code>
1.1 grant 10697: directory, <span class=
10698: "emphasis"><em>except</em></span> for files saved
1.14 xtraeme 10699: under <code class=
10700: "filename">share/mime/packages</code>. The former
1.1 grant 10701: are handled automatically by the
10702: update-mime-database program, but the later are
10703: package-dependent and must be removed by the
10704: package that installed them in the first
10705: place.</p>
10706: </li>
10707:
10708: <li>
1.14 xtraeme 10709: <p>Remove any <code class=
10710: "filename">share/mime/*</code> directories from
10711: the PLIST. They will be handled by the
1.1 grant 10712: shared-mime-info package.</p>
10713: </li>
10714: </ol>
10715: </div>
10716: </div>
10717:
10718: <div class="sect2" lang="en" xml:lang="en">
10719: <div class="titlepage">
10720: <div>
10721: <div>
1.26 ! wiz 10722: <h3 class="title"><a name="id2635730" id=
! 10723: "id2635730"></a>13.5.17. Packages using
1.1 grant 10724: intltool</h3>
10725: </div>
10726: </div>
10727: </div>
10728:
10729: <p>If a package uses intltool during its build, include
1.14 xtraeme 10730: the <code class=
10731: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 10732: file, which forces it to use the intltool package
10733: provided by pkgsrc, instead of the one bundled with the
10734: distribution file.</p>
10735:
10736: <p>This tracks intltool's build-time dependencies and
10737: uses the latest available version; this way, the
10738: package benefits of any bug fixes that may have
10739: appeared since it was released.</p>
10740: </div>
1.18 xtraeme 10741:
10742: <div class="sect2" lang="en" xml:lang="en">
10743: <div class="titlepage">
10744: <div>
10745: <div>
1.26 ! wiz 10746: <h3 class="title"><a name="id2635744" id=
! 10747: "id2635744"></a>13.5.18. Packages installing
1.18 xtraeme 10748: startup scripts</h3>
10749: </div>
10750: </div>
10751: </div>
10752:
10753: <p>If a package contains a rc.d script, it won't be
10754: copied into the startup directory by default, but you
10755: can enable it, by adding the option <code class=
10756: "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
10757: "filename">/etc/mk.conf</code>. This option will copy
10758: the scripts into <code class=
10759: "filename">/etc/rc.d</code> when a package is
10760: installed, and it will automatically remove the scripts
10761: when the package is deinstalled.</p>
10762: </div>
1.1 grant 10763: </div>
10764:
10765: <div class="sect1" lang="en" xml:lang="en">
10766: <div class="titlepage">
10767: <div>
10768: <div>
10769: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 10770: "id2635765" id="id2635765"></a>13.6. Feedback
1.1 grant 10771: to the author</h2>
10772: </div>
10773: </div>
10774: </div>
10775:
10776: <p>If you have found any bugs in the package you make
10777: available, if you had to do special steps to make it run
10778: under NetBSD or if you enhanced the software in various
10779: other ways, be sure to report these changes back to the
10780: original author of the program! With that kind of
10781: support, the next release of the program can incorporate
10782: these fixes, and people not using the NetBSD packages
10783: system can win from your efforts.</p>
10784:
10785: <p>Support the idea of free software!</p>
10786: </div>
10787: </div>
10788:
10789: <div class="chapter" lang="en" xml:lang="en">
10790: <div class="titlepage">
10791: <div>
10792: <div>
10793: <h2 class="title"><a name="debug" id=
1.25 rillig 10794: "debug"></a>Chapter 14. Debugging</h2>
1.1 grant 10795: </div>
10796: </div>
10797: </div>
10798:
10799: <p>To check out all the gotchas when building a package,
10800: here are the steps that I do in order to get a package
10801: working. Please note this is basically the same as what was
10802: explained in the previous sections, only with some
10803: debugging aids.</p>
10804:
10805: <div class="itemizedlist">
10806: <ul type="disc">
10807: <li>
1.14 xtraeme 10808: <p>Be sure to set <code class=
10809: "varname">PKG_DEVELOPER=1</code> in <code class=
10810: "filename">/etc/mk.conf</code></p>
1.1 grant 10811: </li>
10812:
10813: <li>
10814: <p>Install <a xmlns=
10815: "http://www.w3.org/TR/xhtml1/transitional" href=
10816: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20 ben 10817: class="pkgname">pkgtools/url2pkg</a>, create a
10818: directory for a new package, change into it, then run
10819: <span><strong class=
10820: "command">url2pkg</strong></span>:</p>
1.1 grant 10821: <pre class="screen">
1.14 xtraeme 10822: <code class="prompt">%</code> <strong class=
10823: "userinput"><code>mkdir /usr/pkgsrc/<em class=
10824: "replaceable"><code>category</code></em>/<em class=
10825: "replaceable"><code>examplepkg</code></em></code></strong>
10826: <code class="prompt">%</code> <strong class=
10827: "userinput"><code>cd /usr/pkgsrc/<em class=
10828: "replaceable"><code>category</code></em>/<em class=
10829: "replaceable"><code>examplepkg</code></em></code></strong>
10830: <code class="prompt">%</code> <strong class=
10831: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 10832: </pre>
10833: </li>
10834:
10835: <li>
1.14 xtraeme 10836: <p>Edit the <code class="filename">Makefile</code> as
1.1 grant 10837: requested.</p>
10838: </li>
10839:
10840: <li>
1.14 xtraeme 10841: <p>Fill in the <code class="filename">DESCR</code>
1.1 grant 10842: file</p>
10843: </li>
10844:
10845: <li>
1.14 xtraeme 10846: <p>Run <span><strong class="command">make
10847: configure</strong></span></p>
1.1 grant 10848: </li>
10849:
10850: <li>
10851: <p>Add any dependencies glimpsed from documentation
1.14 xtraeme 10852: and the configure step to the package's <code class=
10853: "filename">Makefile</code>.</p>
1.1 grant 10854: </li>
10855:
10856: <li>
10857: <p>Make the package compile, doing multiple rounds
10858: of</p>
10859: <pre class="screen">
1.14 xtraeme 10860: <code class="prompt">%</code> <strong class=
10861: "userinput"><code>make</code></strong>
10862: <code class="prompt">%</code> <strong class=
10863: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
10864: <code class="prompt">%</code> <strong class=
10865: "userinput"><code>mkpatches</code></strong>
10866: <code class="prompt">%</code> <strong class=
10867: "userinput"><code>patchdiff</code></strong>
10868: <code class="prompt">%</code> <strong class=
10869: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
10870: <code class="prompt">%</code> <strong class=
10871: "userinput"><code>make mps</code></strong>
10872: <code class="prompt">%</code> <strong class=
10873: "userinput"><code>make clean</code></strong>
1.1 grant 10874: </pre>
10875:
10876: <p>Doing as non-root user will ensure that no files
10877: are modified that shouldn't be, especially during the
1.14 xtraeme 10878: build phase. <span><strong class=
10879: "command">mkpatches</strong></span>,
10880: <span><strong class=
10881: "command">patchdiff</strong></span> and
10882: <span><strong class="command">pkgvi</strong></span>
10883: are from the <a xmlns=
1.1 grant 10884: "http://www.w3.org/TR/xhtml1/transitional" href=
10885: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 10886: class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1 grant 10887: </li>
10888:
10889: <li>
1.14 xtraeme 10890: <p>Look at the <code class=
10891: "filename">Makefile</code>, fix if necessary; see
10892: <a href="#components.Makefile" title=
1.25 rillig 10893: "8.1. Makefile">Section 8.1,
1.14 xtraeme 10894: “<code class=
10895: "filename">Makefile</code>”</a>.</p>
1.1 grant 10896: </li>
10897:
10898: <li>
1.14 xtraeme 10899: <p>Generate a <code class=
10900: "filename">PLIST</code>:</p>
1.1 grant 10901: <pre class="screen">
1.14 xtraeme 10902: <code class="prompt">#</code> <strong class=
10903: "userinput"><code>make install</code></strong>
10904: <code class="prompt">#</code> <strong class=
10905: "userinput"><code>make print-PLIST >PLIST</code></strong>
10906: <code class="prompt">#</code> <strong class=
10907: "userinput"><code>make deinstall</code></strong>
10908: <code class="prompt">#</code> <strong class=
10909: "userinput"><code>make install</code></strong>
10910: <code class="prompt">#</code> <strong class=
10911: "userinput"><code>make deinstall</code></strong>
1.1 grant 10912: </pre>
10913:
1.14 xtraeme 10914: <p>You usually need to be <code class=
10915: "username">root</code> to do this. Look if there are
1.1 grant 10916: any files left:</p>
10917: <pre class="screen">
1.14 xtraeme 10918: <code class="prompt">#</code> <strong class=
10919: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 10920: </pre>
10921:
10922: <p>If this reveals any files that are missing in
1.14 xtraeme 10923: <code class="filename">PLIST</code>, add them.</p>
1.1 grant 10924: </li>
10925:
10926: <li>
1.14 xtraeme 10927: <p>Now that the <code class="filename">PLIST</code>
10928: is OK, install the package again and make a binary
1.1 grant 10929: package:</p>
10930: <pre class="screen">
1.14 xtraeme 10931: <code class="prompt">#</code> <strong class=
10932: "userinput"><code>make reinstall</code></strong>
10933: <code class="prompt">#</code> <strong class=
10934: "userinput"><code>make package</code></strong>
1.1 grant 10935: </pre>
10936: </li>
10937:
10938: <li>
10939: <p>Delete the installed package:</p>
10940: <pre class="screen">
1.14 xtraeme 10941: <code class="prompt">#</code> <strong class=
10942: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 10943: </pre>
10944: </li>
10945:
10946: <li>
1.14 xtraeme 10947: <p>Repeat the above <span><strong class=
10948: "command">make print-PLIST</strong></span> command,
10949: which shouldn't find anything now:</p>
1.1 grant 10950: <pre class="screen">
1.14 xtraeme 10951: <code class="prompt">#</code> <strong class=
10952: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 10953: </pre>
10954: </li>
10955:
10956: <li>
10957: <p>Reinstall the binary package:</p>
10958: <pre class="screen">
1.14 xtraeme 10959: <code class="prompt">#</code> <strong class=
10960: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 10961: </pre>
10962: </li>
10963:
10964: <li>
10965: <p>Play with it. Make sure everything works.</p>
10966: </li>
10967:
10968: <li>
1.14 xtraeme 10969: <p>Run <span><strong class=
10970: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 10971: "http://www.w3.org/TR/xhtml1/transitional" href=
10972: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 10973: class="pkgname">pkgtools/pkglint</a>, and fix the
10974: problems it reports:</p>
1.1 grant 10975: <pre class="screen">
1.14 xtraeme 10976: <code class="prompt">#</code> <strong class=
10977: "userinput"><code>pkglint</code></strong>
1.1 grant 10978: </pre>
10979: </li>
10980:
10981: <li>
10982: <p>Submit (or commit, if you have cvs access); see
10983: <a href="#submit" title=
1.25 rillig 10984: "Chapter 15. Submitting and Committing">Chapter 15,
1.1 grant 10985: <i>Submitting and Committing</i></a>.</p>
10986: </li>
10987: </ul>
10988: </div>
10989: </div>
10990:
10991: <div class="chapter" lang="en" xml:lang="en">
10992: <div class="titlepage">
10993: <div>
10994: <div>
10995: <h2 class="title"><a name="submit" id=
1.25 rillig 10996: "submit"></a>Chapter 15. Submitting and
1.1 grant 10997: Committing</h2>
10998: </div>
10999: </div>
11000: </div>
11001:
11002: <div class="toc">
11003: <p><b>Table of Contents</b></p>
11004:
11005: <dl>
1.26 ! wiz 11006: <dt><span class="sect1"><a href="#id2636227">15.1.
1.1 grant 11007: Submitting your packages</a></span></dt>
11008:
1.26 ! wiz 11009: <dt><span class="sect1"><a href="#id2636284">15.2.
1.1 grant 11010: Committing: Importing a package into
11011: CVS</a></span></dt>
11012:
1.26 ! wiz 11013: <dt><span class="sect1"><a href="#id2636484">15.3.
1.2 hubertf 11014: Updating a package to a newer version</a></span></dt>
1.1 grant 11015:
1.26 ! wiz 11016: <dt><span class="sect1"><a href="#id2636503">15.4.
1.2 hubertf 11017: Moving a package in pkgsrc</a></span></dt>
1.1 grant 11018: </dl>
11019: </div>
11020:
11021: <div class="sect1" lang="en" xml:lang="en">
11022: <div class="titlepage">
11023: <div>
11024: <div>
11025: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 11026: "id2636227" id=
! 11027: "id2636227"></a>15.1. Submitting your
1.1 grant 11028: packages</h2>
11029: </div>
11030: </div>
11031: </div>
11032:
11033: <p>You have to separate between binary and
11034: “<span class="quote">normal</span>” (source)
11035: packages here:</p>
11036:
11037: <div class="itemizedlist">
11038: <ul type="disc">
11039: <li>
11040: <p>precompiled binary packages</p>
11041:
11042: <p>Our policy is that we accept binaries only from
11043: pkgsrc developers to guarantee that the packages
11044: don't contain any trojan horses etc. This is not to
1.13 hubertf 11045: annoy anyone but rather to protect our users!
1.1 grant 11046: You're still free to put up your home-made binary
1.13 hubertf 11047: packages and tell the world where to get them.
11048: NetBSD developers doing bulk builds and wanting to
11049: upload them please see <a href="#bulk-upload"
11050: title="5.3.8. Uploading results of a bulk build">
11051: Section 5.3.8, “Uploading results of a
11052: bulk build”</a>.</p>
1.1 grant 11053: </li>
11054:
11055: <li>
11056: <p>packages</p>
11057:
11058: <p>First, check that your package is complete,
11059: compiles and runs well; see <a href="#debug" title=
1.25 rillig 11060: "Chapter 14. Debugging">Chapter 14,
1.1 grant 11061: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 11062: Next, generate an uuencoded gzipped <a href=
11063: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
11064: <span class="citerefentry"><span class=
11065: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 11066: preferably with all files in a single directory.
1.14 xtraeme 11067: Finally, <span><strong class=
11068: "command">send-pr</strong></span> with category
1.1 grant 11069: “<span class="quote">pkg</span>”, a
11070: synopsis which includes the package name and
11071: version number, a short description of your package
11072: (contents of the COMMENT variable or DESCR file are
11073: OK) and attach the archive to your PR.</p>
11074:
11075: <p>If you want to submit several packages, please
11076: send a separate PR for each one, it's easier for us
11077: to track things that way.</p>
11078:
11079: <p>Alternatively, you can also import new packages
11080: into pkgsrc-wip (“<span class="quote">pkgsrc
11081: work-in-progress</span>”); see the homepage
11082: at <a href="http://pkgsrc-wip.sourceforge.net/"
11083: target=
11084: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
11085: details.</p>
11086: </li>
11087: </ul>
11088: </div>
11089: </div>
11090:
11091: <div class="sect1" lang="en" xml:lang="en">
11092: <div class="titlepage">
11093: <div>
11094: <div>
11095: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 11096: "id2636284" id=
! 11097: "id2636284"></a>15.2. Committing: Importing a
1.1 grant 11098: package into CVS</h2>
11099: </div>
11100: </div>
11101: </div>
11102:
11103: <p>This section is only of interest for pkgsrc developers
11104: with write access to the pkgsrc repository. Please
11105: remember that cvs imports files relative to the current
11106: working directory, and that the pathname that you give
1.14 xtraeme 11107: the <span><strong class="command">cvs
11108: import</strong></span> command is so that it knows where
11109: to place the files in the repository. Newly created
11110: packages should be imported with a vendor tag of
11111: “<span class="quote">TNF</span>” and a
11112: release tag of “<span class=
11113: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 11114: <pre class="programlisting">
11115: % cd .../pkgsrc/category/pkgname
11116: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
11117: </pre>
11118:
11119: <p>Remember to move the directory from which you imported
11120: out of the way, or cvs will complain the next time you
11121: “<span class="quote">cvs update</span>” your
11122: source tree. Also don't forget to add the new package to
1.14 xtraeme 11123: the category's <code class=
11124: "filename">Makefile</code>.</p>
1.1 grant 11125:
11126: <p>The commit message of the initial import should
1.14 xtraeme 11127: include part of the <code class="filename">DESCR</code>
11128: file, so people reading the mailing lists know what the
11129: package is/does.</p>
1.1 grant 11130:
11131: <p>Please note all package updates/additions in
1.14 xtraeme 11132: <code class="filename">pkgsrc/doc/CHANGES</code>. It's
11133: very important to keep this file up to date and
11134: conforming to the existing format, because it will be
11135: used by scripts to automatically update pages on <a href=
1.1 grant 11136: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
11137: and other sites. Additionally, check the pkgsrc/doc/TODO
11138: file and remove the entry for the package you updated, in
11139: case it was mentioned there.</p>
11140:
11141: <p>For new packages, “<span class="quote">cvs
11142: import</span>” is preferred to “<span class=
11143: "quote">cvs add</span>” because the former gets
11144: everything with a single command, and provides a
11145: consistent tag.</p>
11146: </div>
11147:
11148: <div class="sect1" lang="en" xml:lang="en">
11149: <div class="titlepage">
11150: <div>
11151: <div>
11152: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 11153: "id2636484" id="id2636484"></a>15.3. Updating
1.2 hubertf 11154: a package to a newer version</h2>
1.1 grant 11155: </div>
11156: </div>
11157: </div>
11158:
11159: <p>Please always put a concise, appropriate and relevant
11160: summary of the changes between old and new versions into
11161: the commit log when updating a package. There are various
11162: reasons for this:</p>
11163:
11164: <div class="itemizedlist">
11165: <ul type="disc">
11166: <li>
11167: <p>A URL is volatile, and can change over time. It
11168: may go away completely or its information may be
11169: overwritten by newer information.</p>
11170: </li>
11171:
11172: <li>
11173: <p>Having the change information between old and
11174: new versions in our CVS repository is very useful
11175: for people who use either cvs or anoncvs.</p>
11176: </li>
11177:
11178: <li>
11179: <p>Having the change information between old and
11180: new versions in our CVS repository is very useful
11181: for people who read the pkgsrc-changes mailing
11182: list, so that they can make tactical decisions
11183: about when to upgrade the package.</p>
11184: </li>
11185: </ul>
11186: </div>
11187:
1.18 xtraeme 11188: <p>Please also recognize that, just because a new version
1.1 grant 11189: of a package has been released, it should not
11190: automatically be upgraded in the CVS repository. We
11191: prefer to be conservative in the packages that are
11192: included in pkgsrc - development or beta packages are not
11193: really the best thing for most places in which pkgsrc is
11194: used. Please use your judgement about what should go into
11195: pkgsrc, and bear in mind that stability is to be
11196: preferred above new and possibly untested features.</p>
11197: </div>
11198:
11199: <div class="sect1" lang="en" xml:lang="en">
11200: <div class="titlepage">
11201: <div>
11202: <div>
11203: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 11204: "id2636503" id="id2636503"></a>15.4. Moving a
1.2 hubertf 11205: package in pkgsrc</h2>
1.1 grant 11206: </div>
11207: </div>
11208: </div>
11209:
11210: <div class="orderedlist">
11211: <ol type="1">
11212: <li>
11213: <p>Make a copy of the directory somewhere else.</p>
11214: </li>
11215:
11216: <li>
11217: <p>Remove all CVS dirs.</p>
11218:
11219: <p>Alternatively to the first two steps you can
11220: also do:</p>
11221: <pre class="screen">
1.14 xtraeme 11222: <code class="prompt">%</code> <strong class=
11223: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 11224: </pre>
11225:
11226: <p>and use that for further work.</p>
11227: </li>
11228:
11229: <li>
1.14 xtraeme 11230: <p>Fix <code class="varname">CATEGORIES</code> and
11231: any <code class="varname">DEPENDS</code> paths that
11232: just did “<span class=
1.1 grant 11233: "quote">../package</span>” instead of
11234: “<span class=
11235: "quote">../../category/package</span>”.</p>
11236: </li>
11237:
11238: <li>
1.14 xtraeme 11239: <p><span><strong class="command">cvs
11240: import</strong></span> the modified package in the
11241: new place.</p>
1.1 grant 11242: </li>
11243:
11244: <li>
11245: <p>Check if any package depends on it:</p>
11246: <pre class="screen">
1.14 xtraeme 11247: <code class="prompt">%</code> <strong class=
11248: "userinput"><code>cd /usr/pkgsrc</code></strong>
11249: <code class="prompt">%</code> <strong class=
11250: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 11251: </pre>
11252: </li>
11253:
11254: <li>
11255: <p>Fix paths in packages from step 5 to point to
11256: new location.</p>
11257: </li>
11258:
11259: <li>
1.14 xtraeme 11260: <p><span><strong class="command">cvs rm
11261: (-f)</strong></span> the package at the old
11262: location.</p>
1.1 grant 11263: </li>
11264:
11265: <li>
1.14 xtraeme 11266: <p>Remove from <code class=
11267: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 11268: </li>
11269:
11270: <li>
1.14 xtraeme 11271: <p>Add to <code class=
11272: "filename">newcategory/Makefile</code>.</p>
1.1 grant 11273: </li>
11274:
11275: <li>
11276: <p>Commit the changed and removed files:</p>
11277: <pre class="screen">
1.14 xtraeme 11278: <code class="prompt">%</code> <strong class=
11279: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 11280: </pre>
11281:
11282: <p>(and any packages from step 5, of course).</p>
11283: </li>
11284: </ol>
11285: </div>
11286: </div>
11287: </div>
11288: </div>
11289:
11290: <div class="appendix" lang="en" xml:lang="en">
11291: <div class="titlepage">
11292: <div>
11293: <div>
11294: <h2 class="title"><a name="examples" id=
11295: "examples"></a>Appendix A. A simple example
11296: package: bison</h2>
11297: </div>
11298: </div>
11299: </div>
11300:
11301: <div class="toc">
11302: <p><b>Table of Contents</b></p>
11303:
11304: <dl>
1.26 ! wiz 11305: <dt><span class="sect1"><a href="#id2636729">A.1.
1.1 grant 11306: files</a></span></dt>
11307:
11308: <dd>
11309: <dl>
1.26 ! wiz 11310: <dt><span class="sect2"><a href="#id2636732">A.1.1.
1.1 grant 11311: Makefile</a></span></dt>
11312:
1.26 ! wiz 11313: <dt><span class="sect2"><a href="#id2636740">A.1.2.
1.1 grant 11314: DESCR</a></span></dt>
11315:
1.26 ! wiz 11316: <dt><span class="sect2"><a href="#id2636755">A.1.3.
1.1 grant 11317: PLIST</a></span></dt>
11318:
1.26 ! wiz 11319: <dt><span class="sect2"><a href="#id2636762">A.1.4.
1.14 xtraeme 11320: Checking a package with <span><strong class=
11321: "command">pkglint</strong></span></a></span></dt>
1.1 grant 11322: </dl>
11323: </dd>
11324:
1.26 ! wiz 11325: <dt><span class="sect1"><a href="#id2636803">A.2. Steps
1.1 grant 11326: for building, installing, packaging</a></span></dt>
11327: </dl>
11328: </div>
11329:
11330: <p>We checked to find a piece of software that wasn't in the
11331: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 11332: would want to have <span><strong class=
11333: "command">bison</strong></span> when Berkeley
11334: <span><strong class="command">yacc</strong></span> is already
11335: present in the tree is beyond us, but it's useful for the
11336: purposes of this exercise.</p>
1.1 grant 11337:
11338: <div class="sect1" lang="en" xml:lang="en">
11339: <div class="titlepage">
11340: <div>
11341: <div>
11342: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 11343: "id2636729" id="id2636729"></a>A.1. files</h2>
1.1 grant 11344: </div>
11345: </div>
11346: </div>
11347:
11348: <div class="sect2" lang="en" xml:lang="en">
11349: <div class="titlepage">
11350: <div>
11351: <div>
1.26 ! wiz 11352: <h3 class="title"><a name="id2636732" id=
! 11353: "id2636732"></a>A.1.1. Makefile</h3>
1.1 grant 11354: </div>
11355: </div>
11356: </div>
11357: <pre class="programlisting">
1.17 sketch 11358: # $NetBSD$
1.1 grant 11359: #
11360:
11361: DISTNAME= bison-1.25
11362: CATEGORIES= devel
11363: MASTER_SITES= ${MASTER_SITE_GNU}
11364:
11365: MAINTAINER= thorpej@NetBSD.org
11366: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
11367: COMMENT= GNU yacc clone
11368:
11369: GNU_CONFIGURE= yes
11370: INFO_FILES= bison.info
11371:
11372: .include "../../mk/bsd.pkg.mk"
11373: </pre>
11374: </div>
11375:
11376: <div class="sect2" lang="en" xml:lang="en">
11377: <div class="titlepage">
11378: <div>
11379: <div>
1.26 ! wiz 11380: <h3 class="title"><a name="id2636740" id=
! 11381: "id2636740"></a>A.1.2. DESCR</h3>
1.1 grant 11382: </div>
11383: </div>
11384: </div>
11385: <pre class="programlisting">
11386: GNU version of yacc. Can make re-entrant parsers, and numerous other
11387: improvements. Why you would want this when Berkeley <a href=
11388: "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
11389: of the NetBSD source tree is beyond me.
11390: </pre>
11391: </div>
11392:
11393: <div class="sect2" lang="en" xml:lang="en">
11394: <div class="titlepage">
11395: <div>
11396: <div>
1.26 ! wiz 11397: <h3 class="title"><a name="id2636755" id=
! 11398: "id2636755"></a>A.1.3. PLIST</h3>
1.1 grant 11399: </div>
11400: </div>
11401: </div>
11402: <pre class="programlisting">
1.17 sketch 11403: @comment $NetBSD$
1.1 grant 11404: bin/bison
11405: man/man1/bison.1.gz
11406: share/bison.simple
11407: share/bison.hairy
11408: </pre>
11409: </div>
11410:
11411: <div class="sect2" lang="en" xml:lang="en">
11412: <div class="titlepage">
11413: <div>
11414: <div>
1.26 ! wiz 11415: <h3 class="title"><a name="id2636762" id=
! 11416: "id2636762"></a>A.1.4. Checking a package with
1.14 xtraeme 11417: <span><strong class=
11418: "command">pkglint</strong></span></h3>
1.1 grant 11419: </div>
11420: </div>
11421: </div>
11422:
11423: <p>The NetBSD package system comes with <a xmlns=
11424: "http://www.w3.org/TR/xhtml1/transitional" href=
11425: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 11426: class="pkgname">pkgtools/pkglint</a> which helps to check
11427: the contents of these files. After installation it is
11428: quite easy to use, just change to the directory of the
11429: package you wish to examine and execute
11430: <span><strong class=
11431: "command">pkglint</strong></span>:</p>
1.1 grant 11432: <pre class="screen">
1.14 xtraeme 11433: <code class="prompt">$</code> <strong class=
11434: "userinput"><code>pkglint</code></strong>
1.1 grant 11435: looks fine.
11436: </pre>
11437:
11438: <p>Depending on the supplied command line arguments (see
11439: pkglint(1)) more verbose checks will be performed. Use
1.14 xtraeme 11440: e.g. <span><strong class="command">pkglint
11441: -v</strong></span> for a very verbose check.</p>
1.1 grant 11442: </div>
11443: </div>
11444:
11445: <div class="sect1" lang="en" xml:lang="en">
11446: <div class="titlepage">
11447: <div>
11448: <div>
11449: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 11450: "id2636803" id="id2636803"></a>A.2. Steps for
1.1 grant 11451: building, installing, packaging</h2>
11452: </div>
11453: </div>
11454: </div>
11455:
11456: <p>Create the directory where the package lives, plus any
11457: auxiliary directories:</p>
11458: <pre class="screen">
1.14 xtraeme 11459: <code class="prompt">#</code> <strong class=
11460: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
11461: <code class="prompt">#</code> <strong class=
11462: "userinput"><code>mkdir bison</code></strong>
11463: <code class="prompt">#</code> <strong class=
11464: "userinput"><code>cd bison</code></strong>
11465: <code class="prompt">#</code> <strong class=
11466: "userinput"><code>mkdir patches</code></strong>
1.1 grant 11467: </pre>
11468:
1.14 xtraeme 11469: <p>Create <code class="filename">Makefile</code>,
11470: <code class="filename">DESCR</code> and <code class=
11471: "filename">PLIST</code> (see <a href="#components" title=
1.25 rillig 11472: "Chapter 8. Package components - files, directories and contents">
11473: Chapter 8, <i>Package components - files, directories and
1.1 grant 11474: contents</i></a>) then continue with fetching the
11475: distfile:</p>
11476: <pre class="screen">
1.14 xtraeme 11477: <code class="prompt">#</code> <strong class=
11478: "userinput"><code>make fetch</code></strong>
1.1 grant 11479: >> bison-1.25.tar.gz doesn't seem to exist on this system.
11480: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
11481: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
11482: ftp: Error retrieving file: 500 Internal error
11483:
11484: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
11485: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
11486: ftp: Error retrieving file: 500 Internal error
11487:
11488: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
11489: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
11490: Successfully retrieved file.
11491: </pre>
11492:
1.14 xtraeme 11493: <p>Generate the checksum of the distfile into <code class=
11494: "filename">distinfo</code>:</p>
1.1 grant 11495: <pre class="screen">
1.14 xtraeme 11496: <code class="prompt">#</code> <strong class=
11497: "userinput"><code>make makesum</code></strong>
1.1 grant 11498: </pre>
11499:
11500: <p>Now compile:</p>
11501: <pre class="screen">
1.14 xtraeme 11502: <code class="prompt">#</code> <strong class=
11503: "userinput"><code>make</code></strong>
1.1 grant 11504: >> Checksum OK for bison-1.25.tar.gz.
11505: ===> Extracting for bison-1.25
11506: ===> Patching for bison-1.25
11507: ===> Ignoring empty patch directory
11508: ===> Configuring for bison-1.25
11509: creating cache ./config.cache
11510: checking for gcc... cc
11511: checking whether we are using GNU C... yes
11512: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
11513: checking how to run the C preprocessor... cc -E
11514: checking for minix/config.h... no
11515: checking for POSIXized ISC... no
11516: checking whether cross-compiling... no
11517: checking for ANSI C header files... yes
11518: checking for string.h... yes
11519: checking for stdlib.h... yes
11520: checking for memory.h... yes
11521: checking for working const... yes
11522: checking for working alloca.h... no
11523: checking for alloca... yes
11524: checking for strerror... yes
11525: updating cache ./config.cache
11526: creating ./config.status
11527: creating Makefile
11528: ===> Building for bison-1.25
11529: 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
11530: 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
11531: 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
11532: 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
11533: 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
11534: 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
11535: 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
11536: 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
11537: 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
11538: 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
11539: 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
11540: 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
11541: 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
11542: 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
11543: 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
11544: 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
11545: 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
11546: 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
11547: 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
11548: 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
11549: 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
11550: 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
11551: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
11552: rm -f bison.s1
11553: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
11554: </pre>
11555:
11556: <p>Everything seems OK, so install the files:</p>
11557: <pre class="screen">
1.14 xtraeme 11558: <code class="prompt">#</code> <strong class=
11559: "userinput"><code>make install</code></strong>
1.1 grant 11560: >> Checksum OK for bison-1.25.tar.gz.
11561: ===> Installing for bison-1.25
11562: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
11563: rm -f /usr/pkg/bin/bison
11564: cd /usr/pkg/share; rm -f bison.simple bison.hairy
11565: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
11566: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
11567: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
11568: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
11569: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
11570: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
11571: ===> Registering installation for bison-1.25
11572: </pre>
11573:
11574: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 11575: remove it with <span><strong class="command">pkg_delete
11576: bison</strong></span>. Should you decide that you want a
11577: binary package, do this now:</p>
1.1 grant 11578: <pre class="screen">
1.14 xtraeme 11579: <code class="prompt">#</code> <strong class=
11580: "userinput"><code>make package</code></strong>
1.1 grant 11581: >> Checksum OK for bison-1.25.tar.gz.
11582: ===> Building package for bison-1.25
11583: Creating package bison-1.25.tgz
11584: Registering depends:.
11585: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
11586: </pre>
11587:
11588: <p>Now that you don't need the source and object files any
11589: more, clean up:</p>
11590: <pre class="screen">
1.14 xtraeme 11591: <code class="prompt">#</code> <strong class=
11592: "userinput"><code>make clean</code></strong>
1.1 grant 11593: ===> Cleaning for bison-1.25
11594: </pre>
11595: </div>
11596: </div>
11597:
11598: <div class="appendix" lang="en" xml:lang="en">
11599: <div class="titlepage">
11600: <div>
11601: <div>
11602: <h2 class="title"><a name="logs" id=
11603: "logs"></a>Appendix B. Build logs</h2>
11604: </div>
11605: </div>
11606: </div>
11607:
11608: <div class="toc">
11609: <p><b>Table of Contents</b></p>
11610:
11611: <dl>
11612: <dt><span class="sect1"><a href="#logs.building">B.1.
11613: Building figlet</a></span></dt>
11614:
11615: <dt><span class="sect1"><a href="#logs.package">B.2.
11616: Packaging figlet</a></span></dt>
11617: </dl>
11618: </div>
11619:
11620: <div class="sect1" lang="en" xml:lang="en">
11621: <div class="titlepage">
11622: <div>
11623: <div>
11624: <h2 class="title" style="clear: both"><a name=
11625: "logs.building" id=
11626: "logs.building"></a>B.1. Building figlet</h2>
11627: </div>
11628: </div>
11629: </div>
11630: <pre class="screen">
1.14 xtraeme 11631: <code class="prompt">#</code> <strong class=
11632: "userinput"><code>make</code></strong>
1.1 grant 11633: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11634: => figlet221.tar.gz doesn't seem to exist on this system.
11635: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
11636: => [172219 bytes]
11637: Connected to ftp.plig.net.
11638: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
11639: 331 Guest login ok, send your complete e-mail address as password.
11640: 230-You are user #5 of 500 simultaneous users allowed.
11641: 230-
11642: 230- ___ _ _ _
11643: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
11644: 230- | _| _| . |_| . | | | . |_| . | _| . |
11645: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
11646: 230- |_| |_| |___| |___|
11647: 230-
11648: 230-** Welcome to ftp.plig.org **
11649: 230-
11650: 230-Please note that all transfers from this FTP site are logged. If you
11651: 230-do not like this, please disconnect now.
11652: 230-
11653: 230-This arhive is available via
11654: 230-
11655: 230-HTTP: http://ftp.plig.org/
11656: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
11657: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
11658: 230-
11659: 230-Please email comments, bug reports and requests for packages to be
11660: 230-mirrored to ftp-admin@plig.org.
11661: 230-
11662: 230-
11663: 230 Logged in anonymously.
11664: Remote system type is UNIX.
11665: Using binary mode to transfer files.
11666: 200 Type okay.
11667: 250 "/pub" is new cwd.
11668: 250-"/pub/figlet" is new cwd.
11669: 250-
11670: 250-Welcome to the figlet archive at ftp.figlet.org
11671: 250-
11672: 250- ftp://ftp.figlet.org/pub/figlet/
11673: 250-
11674: 250-The official FIGlet web page is:
11675: 250- http://www.figlet.org/
11676: 250-
11677: 250-If you have questions, please mailto:info@figlet.org. If you want to
11678: 250-contribute a font or something else, you can email us.
11679: 250
11680: 250 "/pub/figlet/program" is new cwd.
11681: 250 "/pub/figlet/program/unix" is new cwd.
11682: local: figlet221.tar.gz remote: figlet221.tar.gz
11683: 502 Unimplemented command.
11684: 227 Entering Passive Mode (195,40,6,41,246,104)
11685: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
11686: 38% |************** | 65800 64.16 KB/s 00:01 ETA
11687: 226 Transfer completed.
11688: 172219 bytes received in 00:02 (75.99 KB/s)
11689: 221 Goodbye.
11690: => Checksum OK for figlet221.tar.gz.
11691: ===> Extracting for figlet-2.2.1nb2
11692: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
11693: ===> Patching for figlet-2.2.1nb2
11694: ===> Applying pkgsrc patches for figlet-2.2.1nb2
11695: ===> Overriding tools for figlet-2.2.1nb2
11696: ===> Creating toolchain wrappers for figlet-2.2.1nb2
11697: ===> Configuring for figlet-2.2.1nb2
11698: ===> Building for figlet-2.2.1nb2
11699: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
11700: chmod a+x figlet
11701: gcc -O2 -o chkfont chkfont.c
11702: => Unwrapping files-to-be-installed.
1.14 xtraeme 11703: <code class="prompt">#</code>
11704: <code class="prompt">#</code> <strong class=
11705: "userinput"><code>make install</code></strong>
1.1 grant 11706: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11707: ===> Installing for figlet-2.2.1nb2
11708: install -d -o root -g wheel -m 755 /usr/pkg/bin
11709: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
11710: mkdir -p /usr/pkg/share/figlet
11711: cp figlet /usr/pkg/bin
11712: cp chkfont /usr/pkg/bin
11713: chmod 555 figlist showfigfonts
11714: cp figlist /usr/pkg/bin
11715: cp showfigfonts /usr/pkg/bin
11716: cp fonts/*.flf /usr/pkg/share/figlet
11717: cp fonts/*.flc /usr/pkg/share/figlet
11718: cp figlet.6 /usr/pkg/man/man6
11719: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 11720: <code class="prompt">#</code>
1.1 grant 11721: </pre>
11722: </div>
11723:
11724: <div class="sect1" lang="en" xml:lang="en">
11725: <div class="titlepage">
11726: <div>
11727: <div>
11728: <h2 class="title" style="clear: both"><a name=
11729: "logs.package" id=
11730: "logs.package"></a>B.2. Packaging figlet</h2>
11731: </div>
11732: </div>
11733: </div>
11734: <pre class="screen">
1.14 xtraeme 11735: <code class="prompt">#</code> <strong class=
11736: "userinput"><code>make package</code></strong>
1.1 grant 11737: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11738: ===> Packaging figlet-2.2.1nb2
11739: ===> Building binary package for figlet-2.2.1nb2
11740: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
11741: Using SrcDir value of /usr/pkg
11742: Registering depends:.
1.14 xtraeme 11743: <code class="prompt">#</code>
1.1 grant 11744: </pre>
11745: </div>
11746: </div>
11747:
11748: <div class="appendix" lang="en" xml:lang="en">
11749: <div class="titlepage">
11750: <div>
11751: <div>
11752: <h2 class="title"><a name="ftp-layout" id=
11753: "ftp-layout"></a>Appendix C. Layout of the
11754: FTP server's package archive</h2>
11755: </div>
11756: </div>
11757: </div>
11758:
11759: <p>Layout for precompiled binary packages on
11760: ftp.NetBSD.org:</p>
11761: <pre class="programlisting">
11762: /pub/NetBSD/packages/
11763: distfiles/
11764:
11765: # Unpacked pkgsrc trees
11766: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
11767: pkgsrc-2003Q4 -> N/A
11768: pkgsrc-2004Q1/pkgsrc
11769:
11770: # pkgsrc archives
11771: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
11772: pkgsrc-2003Q4.tar.gz -> N/A
11773: pkgsrc-2004Q1.tar.gz -> N/A
11774:
11775: # Per pkgsrc-release/OS-release/arch package archives
11776: pkgsrc-2003Q4/
11777: NetBSD-1.6.2/
11778: i386/
11779: All/
11780: archivers/
11781: foo -> ../All/foo
11782: ...
11783: pkgsrc-2004Q1/
11784: NetBSD-1.6.2/
11785: i386/
11786: All/
11787: ...
11788: NetBSD-2.0/
11789: i386/
11790: All/
11791: ...
11792: SunOS-5.9/
11793: sparc/
11794: All/
11795: ...
11796: x86/
11797: All/
11798: ...
11799:
11800: # Per os-release package archive convenience links
11801: NetBSD-1.6.2 -> 1.6.2
11802: 1.6.2/
11803: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
11804: m68k/
11805: All/
11806: archivers/
11807: foo -> ../All/foo
11808: ...
11809: amiga -> m68k
11810: atari -> m68k
11811: ...
11812:
11813: 2.0 -> NetBSD-2.0 # backward compat, historic
11814: NetBSD-2.0/
11815: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
11816: SunOS-5.9/
11817: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
11818: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
11819:
11820: </pre>
11821:
11822: <p>To create:</p>
11823:
11824: <div class="orderedlist">
11825: <ol type="1">
11826: <li>
11827: <p>Run bulk build, see <a href="#bulkbuild" title=
11828: "5.3. Doing a bulk build of all packages">Section
11829: 5.3, “Doing a bulk build of all
11830: packages”</a></p>
11831: </li>
11832:
11833: <li>
11834: <p>Upload /usr/pkgsrc/packages to</p>
11835: <pre class="programlisting">
11836: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13 hubertf 11837: pkgsrc-2004Q4/\ # pkgsrc-branch
1.1 grant 11838: `uname -s`-`uname -r`/ # OS & version
11839: `uname -p` # architecture
11840:
11841: </pre>
11842: </li>
11843:
11844: <li>
1.14 xtraeme 11845: <p>If necessary, create a symlink <span><strong class=
11846: "command">ln -s `uname -m` `uname -p`</strong></span>
11847: (amiga -> m68k, ...)</p>
1.1 grant 11848: </li>
11849: </ol>
11850: </div>
11851: </div>
1.2 hubertf 11852:
11853: <div class="appendix" lang="en" xml:lang="en">
11854: <div class="titlepage">
11855: <div>
11856: <div>
11857: <h2 class="title"><a name="editing" id=
11858: "editing"></a>Appendix D. Editing guidelines
11859: for the pkgsrc guide</h2>
11860: </div>
11861: </div>
11862: </div>
11863:
11864: <div class="toc">
11865: <p><b>Table of Contents</b></p>
11866:
11867: <dl>
1.26 ! wiz 11868: <dt><span class="sect1"><a href="#id2637654">D.1.
1.2 hubertf 11869: Targets</a></span></dt>
11870:
1.26 ! wiz 11871: <dt><span class="sect1"><a href="#id2637856">D.2.
1.2 hubertf 11872: Procedure</a></span></dt>
11873: </dl>
11874: </div>
11875:
11876: <p>This section contains information on editing the pkgsrc
11877: guide itself.</p>
11878:
11879: <div class="sect1" lang="en" xml:lang="en">
11880: <div class="titlepage">
11881: <div>
11882: <div>
11883: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 11884: "id2637654" id="id2637654"></a>D.1. Targets</h2>
1.2 hubertf 11885: </div>
11886: </div>
11887: </div>
11888:
1.14 xtraeme 11889: <p>The pkgsrc guide's source code is stored in <code class=
11890: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 11891: are created from it:</p>
11892:
11893: <div class="itemizedlist">
11894: <ul type="disc">
11895: <li>
1.14 xtraeme 11896: <p><code class=
1.23 wiz 11897: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 11898: </li>
11899:
11900: <li>
1.14 xtraeme 11901: <p><code class=
11902: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 11903: </li>
11904:
11905: <li>
1.14 xtraeme 11906: <p><code class=
11907: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 11908: the documentation on the NetBSD website will be built
11909: from pkgsrc and kept up to date on the web server
11910: itself. This means you <span class=
11911: "emphasis"><em>must</em></span> make sure that your
11912: changes haven't broken the build!</p>
11913: </li>
1.6 hubertf 11914:
11915: <li>
1.14 xtraeme 11916: <p><code class=
11917: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 11918: PDF version of the pkgsrc guide.</p>
11919: </li>
11920:
11921: <li>
1.14 xtraeme 11922: <p><code class=
11923: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 11924: PostScript version of the pkgsrc guide.</p>
11925: </li>
1.2 hubertf 11926: </ul>
11927: </div>
11928: </div>
11929:
11930: <div class="sect1" lang="en" xml:lang="en">
11931: <div class="titlepage">
11932: <div>
11933: <div>
11934: <h2 class="title" style="clear: both"><a name=
1.26 ! wiz 11935: "id2637856" id=
! 11936: "id2637856"></a>D.2. Procedure</h2>
1.2 hubertf 11937: </div>
11938: </div>
11939: </div>
11940:
11941: <p>The procedure to edit the pkgsrc guide is:</p>
11942:
11943: <div class="itemizedlist">
11944: <ul type="disc">
11945: <li>
1.6 hubertf 11946: <p>Make sure you have the packages needed to
11947: re-generate the pkgsrc guide (and other XML-based
11948: NetBSD documentation) installed. These are
1.11 ben 11949: “<span class="quote">netbsd-doc</span>”
1.6 hubertf 11950: for creating the ASCII- and HTML-version, and
11951: “<span class=
1.11 ben 11952: "quote">netbsd-doc-print</span>”for the
1.6 hubertf 11953: PostScript- and PDF version. You will need both
11954: packages installed, to make sure documentation is
11955: consistent across all formats. The packages can be
1.14 xtraeme 11956: found in <code class=
11957: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
11958: <code class=
11959: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 11960: </li>
11961:
11962: <li>
1.14 xtraeme 11963: <p>Edit the XML file(s) in <code class=
11964: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 11965: </li>
11966:
11967: <li>
1.14 xtraeme 11968: <p>Run <span><strong class="command">make extract
11969: && make do-lint</strong></span> in
11970: <code class="filename">pkgsrc/doc/guide</code> to
11971: check the XML syntax, and fix it if needed.</p>
1.4 hubertf 11972: </li>
11973:
11974: <li>
1.14 xtraeme 11975: <p>Run <span><strong class=
11976: "command">make</strong></span> in <code class=
11977: "filename">pkgsrc/doc/guide</code> to build the HTML
11978: and ASCII version.</p>
1.2 hubertf 11979: </li>
11980:
11981: <li>
1.14 xtraeme 11982: <p>If all is well, run <span><strong class=
11983: "command">make install-doc</strong></span> to put the
11984: generated files into <code class=
11985: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 11986: </li>
11987:
11988: <li>
1.14 xtraeme 11989: <p><span><strong class="command">cvs commit
11990: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 11991: </li>
11992:
11993: <li>
1.14 xtraeme 11994: <p><span><strong class="command">cvs commit -m
11995: re-generate
11996: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 11997: </li>
1.4 hubertf 11998:
11999: <li>
12000: <p>Until the webserver on www.NetBSD.org is really
12001: updated automatically to pick up changes to the
1.14 xtraeme 12002: pkgsrc guide automatically, also run
1.18 xtraeme 12003: <span><strong class="command">make install-htdocs
1.14 xtraeme 12004: HTDOCSDIR=../../../htdocs</strong></span> (or
12005: similar, adjust <code class=
12006: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 12007: </li>
12008:
12009: <li>
1.14 xtraeme 12010: <p><span><strong class="command">cvs commit
12011: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 12012: </li>
1.2 hubertf 12013: </ul>
12014: </div>
12015: </div>
12016: </div>
1.1 grant 12017: </div>
12018: </body>
12019: </html>
CVSweb <webmaster@jp.NetBSD.org>