Annotation of pkgsrc/doc/pkgsrc.html, revision 1.68
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.67 hubertf 4: "HTML Tidy for NetBSD (vers 1 September 2005), 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">
1.67 hubertf 18: <div class="book" lang="en">
1.1 grant 19: <div class="titlepage">
20: <div>
21: <div>
1.67 hubertf 22: <h1 class="title"><a name="the-pkgsrc-guide"></a>The
23: 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>
1.48 dillo 64: <p class="copyright">Copyright © 1994-2005 The
1.1 grant 65: NetBSD Foundation, Inc</p>
66: </div>
67:
1.23 wiz 68: <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.68 ! rillig 69: <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.11
! 70: 2006/01/13 17:42:33 reed 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>
1.51 rillig 91: <dt><span class="chapter"><a href="#introduction">1. What
92: is pkgsrc?</a></span></dt>
1.1 grant 93:
94: <dd>
95: <dl>
1.30 wiz 96: <dt><span class="sect1"><a href=
97: "#introduction-section">1.1.
1.1 grant 98: Introduction</a></span></dt>
99:
100: <dt><span class="sect1"><a href="#overview">1.2.
101: Overview</a></span></dt>
102:
103: <dt><span class="sect1"><a href="#terminology">1.3.
104: Terminology</a></span></dt>
105:
106: <dt><span class="sect1"><a href="#typography">1.4.
107: Typography</a></span></dt>
108: </dl>
109: </dd>
110:
1.46 gdt 111: <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1 grant 112: user's guide</a></span></dt>
113:
114: <dd>
115: <dl>
116: <dt><span class="chapter"><a href="#getting">2. Where
1.59 rillig 117: to get pkgsrc and how to keep it
118: up-to-date</a></span></dt>
1.1 grant 119:
120: <dd>
121: <dl>
1.30 wiz 122: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1 grant 123: As tar file</a></span></dt>
124:
1.30 wiz 125: <dt><span class="sect1"><a href="#via-sup">2.2. Via
126: SUP</a></span></dt>
1.1 grant 127:
1.30 wiz 128: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
129: CVS</a></span></dt>
1.59 rillig 130:
131: <dt><span class="sect1"><a href=
132: "#uptodate-cvs">2.4. Keeping pkgsrc up-to-date via
133: CVS</a></span></dt>
1.1 grant 134: </dl>
135: </dd>
136:
137: <dt><span class="chapter"><a href="#platforms">3. Using
138: pkgsrc on systems other than NetBSD</a></span></dt>
139:
140: <dd>
141: <dl>
1.30 wiz 142: <dt><span class="sect1"><a href=
143: "#bootstrapping-pkgsrc">3.1. Bootstrapping
144: pkgsrc</a></span></dt>
1.1 grant 145:
1.30 wiz 146: <dt><span class="sect1"><a href=
1.47 reed 147: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 148: notes</a></span></dt>
1.1 grant 149:
150: <dd>
151: <dl>
152: <dt><span class="sect2"><a href=
1.30 wiz 153: "#darwin">3.2.1. Darwin (Mac OS
1.1 grant 154: X)</a></span></dt>
155:
156: <dt><span class="sect2"><a href=
1.30 wiz 157: "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1 grant 158:
159: <dt><span class="sect2"><a href=
1.30 wiz 160: "#interix">3.2.3. Interix</a></span></dt>
1.1 grant 161:
1.30 wiz 162: <dt><span class="sect2"><a href="#irix">3.2.4.
163: IRIX</a></span></dt>
1.1 grant 164:
1.30 wiz 165: <dt><span class="sect2"><a href="#linux">3.2.5.
166: Linux</a></span></dt>
1.1 grant 167:
168: <dt><span class="sect2"><a href=
1.30 wiz 169: "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22 tv 170:
171: <dt><span class="sect2"><a href=
1.30 wiz 172: "#solaris">3.2.7. Solaris</a></span></dt>
1.1 grant 173: </dl>
174: </dd>
175: </dl>
176: </dd>
177:
178: <dt><span class="chapter"><a href="#using">4. Using
179: pkgsrc</a></span></dt>
180:
181: <dd>
182: <dl>
183: <dt><span class="sect1"><a href=
184: "#getting-started">4.1. Working with binary
185: packages</a></span></dt>
186:
187: <dd>
188: <dl>
189: <dt><span class="sect2"><a href=
1.30 wiz 190: "#where-to-get-binary-packages">4.1.1. Where to
191: get binary packages</a></span></dt>
1.1 grant 192:
193: <dt><span class="sect2"><a href=
1.30 wiz 194: "#how-to-use-binary-packages">4.1.2. How to use
195: binary packages</a></span></dt>
1.1 grant 196:
197: <dt><span class="sect2"><a href=
1.30 wiz 198: "#a-word-of-warning">4.1.3. A word of
1.1 grant 199: warning</a></span></dt>
200: </dl>
201: </dd>
202:
1.30 wiz 203: <dt><span class="sect1"><a href=
204: "#building-packages-from-source">4.2. Building
205: packages from source</a></span></dt>
1.1 grant 206:
207: <dd>
208: <dl>
209: <dt><span class="sect2"><a href=
1.30 wiz 210: "#requirements">4.2.1.
1.1 grant 211: Requirements</a></span></dt>
212:
213: <dt><span class="sect2"><a href=
1.30 wiz 214: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 215: distfiles</a></span></dt>
216:
217: <dt><span class="sect2"><a href=
1.30 wiz 218: "#how-to-build-and-install">4.2.3. How to build
219: and install</a></span></dt>
1.1 grant 220:
221: <dt><span class="sect2"><a href=
1.30 wiz 222: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 223: compiler</a></span></dt>
224: </dl>
225: </dd>
226: </dl>
227: </dd>
228:
1.38 dillo 229: <dt><span class="chapter"><a href="#configuring">5.
230: Configuring pkgsrc</a></span></dt>
231:
232: <dd>
233: <dl>
234: <dt><span class="sect1"><a href=
1.45 wiz 235: "#general-configuration">5.1. General
236: configuration</a></span></dt>
237:
238: <dt><span class="sect1"><a href=
239: "#variables-affecting-build">5.2. Variables
240: affecting the build process</a></span></dt>
241:
242: <dt><span class="sect1"><a href=
243: "#developer-advanced-settings">5.3.
244: Developer/advanced settings</a></span></dt>
245:
246: <dt><span class="sect1"><a href=
247: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 248: Options</a></span></dt>
1.38 dillo 249: </dl>
250: </dd>
251:
252: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 253: binary packages</a></span></dt>
254:
255: <dd>
256: <dl>
1.30 wiz 257: <dt><span class="sect1"><a href=
1.38 dillo 258: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 259: single binary package</a></span></dt>
1.1 grant 260:
1.30 wiz 261: <dt><span class="sect1"><a href=
1.38 dillo 262: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 263: Settings for creation of binary
264: packages</a></span></dt>
265:
1.38 dillo 266: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 267: Doing a bulk build of all packages</a></span></dt>
268:
269: <dd>
270: <dl>
271: <dt><span class="sect2"><a href=
1.38 dillo 272: "#binary.configuration">6.3.1.
1.1 grant 273: Configuration</a></span></dt>
274:
275: <dt><span class="sect2"><a href=
1.38 dillo 276: "#other-environmental-considerations">6.3.2.
1.30 wiz 277: Other environmental
1.1 grant 278: considerations</a></span></dt>
279:
280: <dt><span class="sect2"><a href=
1.38 dillo 281: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 282:
283: <dt><span class="sect2"><a href=
1.38 dillo 284: "#what-it-does">6.3.4. What it
1.1 grant 285: does</a></span></dt>
286:
287: <dt><span class="sect2"><a href=
1.38 dillo 288: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 289: requirements</a></span></dt>
290:
291: <dt><span class="sect2"><a href=
1.38 dillo 292: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 293: sandbox for chrooted builds</a></span></dt>
1.1 grant 294:
295: <dt><span class="sect2"><a href=
1.38 dillo 296: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 297: partial set of packages</a></span></dt>
1.13 hubertf 298:
299: <dt><span class="sect2"><a href=
1.38 dillo 300: "#bulk-upload">6.3.8. Uploading results of a
1.13 hubertf 301: bulk build</a></span></dt>
1.1 grant 302: </dl>
303: </dd>
304:
1.30 wiz 305: <dt><span class="sect1"><a href=
1.38 dillo 306: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 307: packages collection</a></span></dt>
1.1 grant 308:
309: <dd>
310: <dl>
311: <dt><span class="sect2"><a href=
1.38 dillo 312: "#cdpack-example">6.4.1. Example of
1.1 grant 313: cdpack</a></span></dt>
314: </dl>
315: </dd>
316: </dl>
317: </dd>
318:
1.38 dillo 319: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 320: Asked Questions</a></span></dt>
321:
322: <dd>
323: <dl>
1.30 wiz 324: <dt><span class="sect1"><a href=
1.38 dillo 325: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 326: lists for pkg-related discussion?</a></span></dt>
1.1 grant 327:
1.30 wiz 328: <dt><span class="sect1"><a href=
1.38 dillo 329: "#pkgviews-docs">7.2. Where's the pkgviews
1.30 wiz 330: documentation?</a></span></dt>
1.1 grant 331:
1.5 hubertf 332: <dt><span class="sect1"><a href=
1.38 dillo 333: "#faq-pkgtools">7.3. Utilities for package
1.5 hubertf 334: management (pkgtools)</a></span></dt>
1.1 grant 335:
1.30 wiz 336: <dt><span class="sect1"><a href=
1.38 dillo 337: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 338: non-root</a></span></dt>
339:
340: <dt><span class="sect1"><a href=
1.38 dillo 341: "#resume-transfers">7.5. How to resume transfers
1.30 wiz 342: when fetching distfiles?</a></span></dt>
343:
344: <dt><span class="sect1"><a href=
1.38 dillo 345: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 346: XFree86 from pkgsrc?</a></span></dt>
347:
348: <dt><span class="sect1"><a href=
1.38 dillo 349: "#x.org-from-pkgsrc">7.7. How can I install/use
1.30 wiz 350: X.org from pkgsrc?</a></span></dt>
1.1 grant 351:
1.30 wiz 352: <dt><span class="sect1"><a href=
1.38 dillo 353: "#fetch-behind-firewall">7.8. How to fetch files
1.30 wiz 354: from behind a firewall</a></span></dt>
1.1 grant 355:
1.38 dillo 356: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.14 xtraeme 357: How do I tell <span><strong class="command">make
358: fetch</strong></span> to do passive
1.1 grant 359: FTP?</a></span></dt>
360:
1.30 wiz 361: <dt><span class="sect1"><a href=
1.38 dillo 362: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 363: distfiles at once</a></span></dt>
1.1 grant 364:
1.30 wiz 365: <dt><span class="sect1"><a href=
1.38 dillo 366: "#tmac.andoc-missing">7.11. What does
1.30 wiz 367: “<span class="quote">Don't know how to make
368: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 369: mean?</a></span></dt>
1.13 hubertf 370:
1.30 wiz 371: <dt><span class="sect1"><a href=
1.38 dillo 372: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 373: “<span class="quote">Could not find
1.14 xtraeme 374: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 375:
1.30 wiz 376: <dt><span class="sect1"><a href=
1.38 dillo 377: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 378: pkgsrc</a></span></dt>
1.1 grant 379:
1.38 dillo 380: <dt><span class="sect1"><a href="#faq.conf">7.14.
1.35 jmmv 381: How do I change the location of configuration
382: files?</a></span></dt>
1.1 grant 383:
384: <dt><span class="sect1"><a href=
1.38 dillo 385: "#audit-packages">7.15. Automated security
1.1 grant 386: checks</a></span></dt>
387: </dl>
388: </dd>
389: </dl>
390: </dd>
391:
1.46 gdt 392: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 393: pkgsrc developer's guide</a></span></dt>
394:
395: <dd>
396: <dl>
1.38 dillo 397: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 398: Package components - files, directories and
399: contents</a></span></dt>
400:
401: <dd>
402: <dl>
403: <dt><span class="sect1"><a href=
1.45 wiz 404: "#components.Makefile">8.1. <code xmlns=
405: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 406: "filename">Makefile</code></a></span></dt>
407:
408: <dt><span class="sect1"><a href=
1.45 wiz 409: "#components.distinfo">8.2. <code xmlns=
410: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 411: "filename">distinfo</code></a></span></dt>
412:
413: <dt><span class="sect1"><a href=
1.38 dillo 414: "#components.patches">8.3.
1.27 rillig 415: patches/*</a></span></dt>
416:
1.30 wiz 417: <dt><span class="sect1"><a href=
1.38 dillo 418: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 419: files</a></span></dt>
1.27 rillig 420:
421: <dt><span class="sect1"><a href=
1.38 dillo 422: "#components.optional">8.5. Optional
1.27 rillig 423: files</a></span></dt>
424:
1.38 dillo 425: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 426: <code xmlns=
427: "http://www.w3.org/TR/xhtml1/transitional" class=
428: "filename">work*</code></a></span></dt>
1.27 rillig 429:
1.38 dillo 430: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 431: <code xmlns=
432: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 433: "filename">files/*</code></a></span></dt>
434: </dl>
435: </dd>
436:
1.38 dillo 437: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 438: Programming in <code xmlns=
439: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 440: "filename">Makefile</code>s</a></span></dt>
441:
442: <dd>
443: <dl>
444: <dt><span class="sect1"><a href=
1.45 wiz 445: "#makefile.variables">9.1. <code xmlns=
446: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 447: "filename">Makefile</code>
448: variables</a></span></dt>
449:
1.27 rillig 450: <dd>
451: <dl>
452: <dt><span class="sect2"><a href=
1.38 dillo 453: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 454: conventions</a></span></dt>
455: </dl>
456: </dd>
457:
1.25 rillig 458: <dt><span class="sect1"><a href=
1.38 dillo 459: "#makefile.code">9.2. Code snippets</a></span></dt>
1.25 rillig 460:
461: <dd>
462: <dl>
463: <dt><span class="sect2"><a href=
1.38 dillo 464: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 465: list</a></span></dt>
466:
467: <dt><span class="sect2"><a href=
1.38 dillo 468: "#converting-internal-to-external">9.2.2.
1.30 wiz 469: Converting an internal list into an external
470: list</a></span></dt>
1.25 rillig 471:
472: <dt><span class="sect2"><a href=
1.38 dillo 473: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 474: variables to a shell command</a></span></dt>
1.27 rillig 475:
476: <dt><span class="sect2"><a href=
1.38 dillo 477: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 478: guideline</a></span></dt>
479:
480: <dt><span class="sect2"><a href=
1.38 dillo 481: "#bsd-make-bug-workaround">9.2.5. Workaround
1.30 wiz 482: for a bug in BSD Make</a></span></dt>
1.25 rillig 483: </dl>
484: </dd>
485: </dl>
486: </dd>
487:
1.38 dillo 488: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 489: issues</a></span></dt>
490:
491: <dd>
492: <dl>
1.38 dillo 493: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.30 wiz 494: ID</a></span></dt>
1.1 grant 495:
1.30 wiz 496: <dt><span class="sect1"><a href=
1.38 dillo 497: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 498: <code xmlns=
499: "http://www.w3.org/TR/xhtml1/transitional" class=
500: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 501:
1.38 dillo 502: <dt><span class="sect1"><a href=
503: "#print-PLIST">10.3. Tweaking output of
504: <span><strong class="command">make
1.14 xtraeme 505: print-PLIST</strong></span></a></span></dt>
1.1 grant 506:
1.38 dillo 507: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 508: Variable substitution in PLIST</a></span></dt>
509:
1.30 wiz 510: <dt><span class="sect1"><a href=
1.48 dillo 511: "#manpage-compression">10.5. Man page
512: compression</a></span></dt>
1.1 grant 513:
1.30 wiz 514: <dt><span class="sect1"><a href=
1.38 dillo 515: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 516: <code class=
1.14 xtraeme 517: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 518:
1.30 wiz 519: <dt><span class="sect1"><a href=
1.47 reed 520: "#platform-specific-plist">10.7. Platform-specific
1.30 wiz 521: and differing PLISTs</a></span></dt>
1.1 grant 522:
523: <dt><span class="sect1"><a href=
1.38 dillo 524: "#faq.common-dirs">10.8. Sharing directories
525: between packages</a></span></dt>
1.1 grant 526: </dl>
527: </dd>
528:
1.38 dillo 529: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 530: Buildlink methodology</a></span></dt>
531:
532: <dd>
533: <dl>
1.30 wiz 534: <dt><span class="sect1"><a href=
1.38 dillo 535: "#converting-to-buildlink3">11.1. Converting
1.30 wiz 536: packages to use buildlink3</a></span></dt>
1.1 grant 537:
1.30 wiz 538: <dt><span class="sect1"><a href=
1.38 dillo 539: "#creating-buildlink3.mk">11.2. Writing
1.45 wiz 540: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
541: class="filename">buildlink3.mk</code>
1.14 xtraeme 542: files</a></span></dt>
1.1 grant 543:
544: <dd>
545: <dl>
546: <dt><span class="sect2"><a href=
1.38 dillo 547: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 548: buildlink3.mk file</a></span></dt>
1.1 grant 549:
550: <dt><span class="sect2"><a href=
1.38 dillo 551: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 552: <code class=
1.14 xtraeme 553: "varname">BUILDLINK_DEPENDS.<em class=
554: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 555: <code xmlns=
556: "http://www.w3.org/TR/xhtml1/transitional"
557: class="filename">buildlink3.mk</code>
1.1 grant 558: files</a></span></dt>
559: </dl>
560: </dd>
561:
1.30 wiz 562: <dt><span class="sect1"><a href=
1.45 wiz 563: "#writing-builtin.mk">11.3. Writing <code xmlns=
564: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 565: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 566:
567: <dd>
568: <dl>
569: <dt><span class="sect2"><a href=
1.38 dillo 570: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 571: <code xmlns=
572: "http://www.w3.org/TR/xhtml1/transitional"
573: class="filename">builtin.mk</code>
1.1 grant 574: file</a></span></dt>
575:
576: <dt><span class="sect2"><a href=
1.38 dillo 577: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 578: preferences for native or pkgsrc
579: software</a></span></dt>
1.1 grant 580: </dl>
581: </dd>
582: </dl>
583: </dd>
584:
1.38 dillo 585: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 586: pkginstall framework</a></span></dt>
587:
588: <dd>
589: <dl>
590: <dt><span class="sect1"><a href=
1.38 dillo 591: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 592: directories outside the installation
593: prefix</a></span></dt>
594:
595: <dd>
596: <dl>
597: <dt><span class="sect2"><a href=
1.38 dillo 598: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 599: manipulation</a></span></dt>
600:
601: <dt><span class="sect2"><a href=
1.38 dillo 602: "#files-outside-prefix">12.1.2. File
1.35 jmmv 603: manipulation</a></span></dt>
604: </dl>
605: </dd>
606:
1.38 dillo 607: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 608: Configuration files</a></span></dt>
609:
610: <dd>
611: <dl>
612: <dt><span class="sect2"><a href=
1.38 dillo 613: "#conf-files-sysconfdir">12.2.1. How
1.35 jmmv 614: <code class="varname">PKG_SYSCONFDIR</code> is
615: set</a></span></dt>
616:
617: <dt><span class="sect2"><a href=
1.38 dillo 618: "#conf-files-configure">12.2.2. Telling the
1.47 reed 619: software where configuration files
1.35 jmmv 620: are</a></span></dt>
621:
622: <dt><span class="sect2"><a href=
1.38 dillo 623: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 624: installations</a></span></dt>
625:
626: <dt><span class="sect2"><a href=
1.38 dillo 627: "#conf-files-disable">12.2.4. Disabling
1.35 jmmv 628: handling of configuration files</a></span></dt>
629: </dl>
630: </dd>
631:
632: <dt><span class="sect1"><a href=
1.38 dillo 633: "#rcd-scripts">12.3. System startup
1.35 jmmv 634: scripts</a></span></dt>
635:
636: <dd>
637: <dl>
638: <dt><span class="sect2"><a href=
1.38 dillo 639: "#rcd-scripts-disable">12.3.1. Disabling
1.35 jmmv 640: handling of system startup
641: scripts</a></span></dt>
642: </dl>
643: </dd>
644:
645: <dt><span class="sect1"><a href=
1.38 dillo 646: "#users-and-groups">12.4. System users and
1.35 jmmv 647: groups</a></span></dt>
648:
1.38 dillo 649: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 650: System shells</a></span></dt>
651:
652: <dd>
653: <dl>
654: <dt><span class="sect2"><a href=
1.65 hubertf 655: "#shells-disable">12.5.1. Disabling shell
656: registration</a></span></dt>
657: </dl>
658: </dd>
659:
660: <dt><span class="sect1"><a href="#fonts">12.6.
661: Fonts</a></span></dt>
662:
663: <dd>
664: <dl>
665: <dt><span class="sect2"><a href=
666: "#fonts-disable">12.6.1. Disabling automatic
667: update of the fonts databases</a></span></dt>
1.35 jmmv 668: </dl>
669: </dd>
670: </dl>
671: </dd>
672:
1.38 dillo 673: <dt><span class="chapter"><a href="#options">13.
1.1 grant 674: Options handling</a></span></dt>
675:
676: <dd>
677: <dl>
1.30 wiz 678: <dt><span class="sect1"><a href=
1.38 dillo 679: "#global-default-options">13.1. Global default
1.30 wiz 680: options</a></span></dt>
1.1 grant 681:
1.30 wiz 682: <dt><span class="sect1"><a href=
1.38 dillo 683: "#converting-to-options">13.2. Converting packages
1.45 wiz 684: to use <code xmlns=
685: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 686: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 687:
688: <dt><span class="sect1"><a href=
689: "#option-names">13.3. Option Names</a></span></dt>
1.1 grant 690: </dl>
691: </dd>
692:
1.38 dillo 693: <dt><span class="chapter"><a href="#build">14. The
1.1 grant 694: build process</a></span></dt>
695:
696: <dd>
697: <dl>
698: <dt><span class="sect1"><a href=
1.56 rillig 699: "#build.intro">14.1. Introduction</a></span></dt>
700:
701: <dt><span class="sect1"><a href=
702: "#build.prefix">14.2. Program
1.1 grant 703: location</a></span></dt>
704:
1.30 wiz 705: <dt><span class="sect1"><a href=
1.56 rillig 706: "#build.builddirs">14.3. Directories used during
707: the build process</a></span></dt>
708:
709: <dt><span class="sect1"><a href=
710: "#build.running">14.4. Running a
711: phase</a></span></dt>
712:
713: <dt><span class="sect1"><a href=
714: "#build.fetch">14.5. The <span class=
715: "emphasis"><em>fetch</em></span>
716: phase</a></span></dt>
717:
718: <dt><span class="sect1"><a href=
719: "#build.checksum">14.6. The <span class=
720: "emphasis"><em>checksum</em></span>
721: phase</a></span></dt>
722:
723: <dt><span class="sect1"><a href=
724: "#build.extract">14.7. The <span class=
725: "emphasis"><em>extract</em></span>
726: phase</a></span></dt>
727:
728: <dt><span class="sect1"><a href=
729: "#build.patch">14.8. The <span class=
730: "emphasis"><em>patch</em></span>
731: phase</a></span></dt>
732:
733: <dt><span class="sect1"><a href=
734: "#build.tools">14.9. The <span class=
735: "emphasis"><em>tools</em></span>
736: phase</a></span></dt>
737:
738: <dt><span class="sect1"><a href=
739: "#build.wrapper">14.10. The <span class=
740: "emphasis"><em>wrapper</em></span>
741: phase</a></span></dt>
742:
743: <dt><span class="sect1"><a href=
744: "#build.configure">14.11. The <span class=
745: "emphasis"><em>configure</em></span>
746: phase</a></span></dt>
747:
748: <dt><span class="sect1"><a href=
749: "#build.build">14.12. The <span class=
750: "emphasis"><em>build</em></span>
751: phase</a></span></dt>
752:
753: <dt><span class="sect1"><a href=
754: "#build.test">14.13. The <span class=
755: "emphasis"><em>test</em></span>
756: phase</a></span></dt>
757:
758: <dt><span class="sect1"><a href=
759: "#build.install">14.14. The <span class=
760: "emphasis"><em>install</em></span>
761: phase</a></span></dt>
1.1 grant 762:
763: <dt><span class="sect1"><a href=
1.56 rillig 764: "#build.package">14.15. The <span class=
765: "emphasis"><em>package</em></span>
766: phase</a></span></dt>
767:
768: <dt><span class="sect1"><a href=
769: "#build.helpful-targets">14.16. Other helpful
1.1 grant 770: targets</a></span></dt>
771: </dl>
772: </dd>
773:
1.68 ! rillig 774: <dt><span class="chapter"><a href="#tools">15. Tools
! 775: needed for building or running</a></span></dt>
! 776:
! 777: <dd>
! 778: <dl>
! 779: <dt><span class="sect1"><a href=
! 780: "#pkgsrc-tools">15.1. Tools for pkgsrc
! 781: builds</a></span></dt>
! 782:
! 783: <dt><span class="sect1"><a href=
! 784: "#package-tools">15.2. Tools needed by
! 785: packages</a></span></dt>
! 786:
! 787: <dt><span class="sect1"><a href=
! 788: "#platform-tools">15.3. Tools provided by
! 789: platforms</a></span></dt>
! 790: </dl>
! 791: </dd>
! 792:
! 793: <dt><span class="chapter"><a href="#fixes">16. Making
1.55 rillig 794: your package work</a></span></dt>
1.1 grant 795:
796: <dd>
797: <dl>
1.30 wiz 798: <dt><span class="sect1"><a href=
1.68 ! rillig 799: "#general-operation">16.1. General
1.30 wiz 800: operation</a></span></dt>
1.1 grant 801:
802: <dd>
803: <dl>
804: <dt><span class="sect2"><a href=
1.68 ! rillig 805: "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30 wiz 806: pull in variables from
807: /etc/mk.conf</a></span></dt>
1.1 grant 808:
809: <dt><span class="sect2"><a href=
1.68 ! rillig 810: "#where-to-install-documentation">16.1.2. Where
1.31 wiz 811: to install documentation</a></span></dt>
812:
813: <dt><span class="sect2"><a href=
1.68 ! rillig 814: "#restricted-packages">16.1.3. Restricted
1.1 grant 815: packages</a></span></dt>
816:
817: <dt><span class="sect2"><a href=
1.68 ! rillig 818: "#dependencies">16.1.4. Handling
1.1 grant 819: dependencies</a></span></dt>
820:
821: <dt><span class="sect2"><a href=
1.68 ! rillig 822: "#conflicts">16.1.5. Handling conflicts with
1.1 grant 823: other packages</a></span></dt>
824:
825: <dt><span class="sect2"><a href=
1.68 ! rillig 826: "#not-building-packages">16.1.6. Packages that
1.30 wiz 827: cannot or should not be built</a></span></dt>
1.1 grant 828:
829: <dt><span class="sect2"><a href=
1.68 ! rillig 830: "#undeletable-packages">16.1.7. Packages which
1.30 wiz 831: should not be deleted, once
832: installed</a></span></dt>
1.1 grant 833:
834: <dt><span class="sect2"><a href=
1.68 ! rillig 835: "#security-handling">16.1.8. Handling packages
1.1 grant 836: with security problems</a></span></dt>
837:
838: <dt><span class="sect2"><a href=
1.68 ! rillig 839: "#compiler-bugs">16.1.9. How to handle compiler
1.1 grant 840: bugs</a></span></dt>
841:
842: <dt><span class="sect2"><a href=
1.68 ! rillig 843: "#bumping-pkgrevision">16.1.10. How to handle
1.30 wiz 844: incrementing versions when fixing an existing
1.1 grant 845: package</a></span></dt>
846:
847: <dt><span class="sect2"><a href=
1.68 ! rillig 848: "#portability-of-packages">16.1.11. Portability
1.30 wiz 849: of packages</a></span></dt>
1.1 grant 850: </dl>
851: </dd>
852:
1.30 wiz 853: <dt><span class="sect1"><a href=
1.68 ! rillig 854: "#downloading-issues">16.2. Possible downloading
1.30 wiz 855: issues</a></span></dt>
1.1 grant 856:
857: <dd>
858: <dl>
859: <dt><span class="sect2"><a href=
1.68 ! rillig 860: "#no-plain-download">16.2.1. Packages whose
1.30 wiz 861: distfiles aren't available for plain
1.1 grant 862: downloading</a></span></dt>
863:
864: <dt><span class="sect2"><a href=
1.68 ! rillig 865: "#modified-distfiles-same-name">16.2.2. How to
1.30 wiz 866: handle modified distfiles with the 'old'
867: name</a></span></dt>
1.1 grant 868: </dl>
869: </dd>
870:
1.30 wiz 871: <dt><span class="sect1"><a href=
1.68 ! rillig 872: "#configuration-gotchas">16.3. Configuration
1.30 wiz 873: gotchas</a></span></dt>
1.1 grant 874:
875: <dd>
876: <dl>
877: <dt><span class="sect2"><a href=
1.68 ! rillig 878: "#fixes.libtool">16.3.1. Shared libraries -
1.1 grant 879: libtool</a></span></dt>
880:
881: <dt><span class="sect2"><a href=
1.68 ! rillig 882: "#using-libtool">16.3.2. Using libtool on GNU
1.1 grant 883: packages that already support
884: libtool</a></span></dt>
885:
886: <dt><span class="sect2"><a href=
1.68 ! rillig 887: "#autoconf-automake">16.3.3. GNU
1.1 grant 888: Autoconf/Automake</a></span></dt>
889: </dl>
890: </dd>
891:
1.30 wiz 892: <dt><span class="sect1"><a href=
1.68 ! rillig 893: "#fixes-build">16.4. Building the
1.55 rillig 894: package</a></span></dt>
1.1 grant 895:
896: <dd>
897: <dl>
898: <dt><span class="sect2"><a href=
1.68 ! rillig 899: "#cpp-defines">16.4.1. CPP
1.1 grant 900: defines</a></span></dt>
1.51 rillig 901:
902: <dt><span class="sect2"><a href=
1.68 ! rillig 903: "#cpp-list-examples">16.4.2. Examples of CPP
1.60 rillig 904: defines for some platforms</a></span></dt>
905:
906: <dt><span class="sect2"><a href=
1.68 ! rillig 907: "#cpp-list">16.4.3. Getting a list of CPP
1.51 rillig 908: defines</a></span></dt>
1.1 grant 909: </dl>
910: </dd>
911:
1.30 wiz 912: <dt><span class="sect1"><a href=
1.68 ! rillig 913: "#package-specific-actions">16.5. Package specific
1.30 wiz 914: actions</a></span></dt>
1.1 grant 915:
916: <dd>
917: <dl>
918: <dt><span class="sect2"><a href=
1.68 ! rillig 919: "#user-interaction">16.5.1. User
1.2 hubertf 920: interaction</a></span></dt>
1.1 grant 921:
922: <dt><span class="sect2"><a href=
1.68 ! rillig 923: "#handling-licenses">16.5.2. Handling
1.1 grant 924: licenses</a></span></dt>
925:
926: <dt><span class="sect2"><a href=
1.68 ! rillig 927: "#installing-score-files">16.5.3. Installing
1.30 wiz 928: score files</a></span></dt>
1.1 grant 929:
930: <dt><span class="sect2"><a href=
1.68 ! rillig 931: "#perl-scripts">16.5.4. Packages containing
1.30 wiz 932: perl scripts</a></span></dt>
1.1 grant 933:
934: <dt><span class="sect2"><a href=
1.68 ! rillig 935: "#hardcoded-paths">16.5.5. Packages with
1.30 wiz 936: hardcoded paths to other
937: interpreters</a></span></dt>
1.1 grant 938:
939: <dt><span class="sect2"><a href=
1.68 ! rillig 940: "#perl-modules">16.5.6. Packages installing
1.30 wiz 941: perl modules</a></span></dt>
1.1 grant 942:
943: <dt><span class="sect2"><a href=
1.68 ! rillig 944: "#faq.info-files">16.5.7. Packages installing
1.1 grant 945: info files</a></span></dt>
946:
947: <dt><span class="sect2"><a href=
1.68 ! rillig 948: "#manpages">16.5.8. Packages installing man
1.57 minskim 949: pages</a></span></dt>
950:
951: <dt><span class="sect2"><a href=
1.68 ! rillig 952: "#gconf2-data-files">16.5.9. Packages
1.30 wiz 953: installing GConf2 data files</a></span></dt>
1.1 grant 954:
955: <dt><span class="sect2"><a href=
1.68 ! rillig 956: "#scrollkeeper-data-files">16.5.10. Packages
1.30 wiz 957: installing scrollkeeper data
958: files</a></span></dt>
1.1 grant 959:
960: <dt><span class="sect2"><a href=
1.68 ! rillig 961: "#x11-fonts">16.5.11. Packages installing X11
1.1 grant 962: fonts</a></span></dt>
963:
964: <dt><span class="sect2"><a href=
1.68 ! rillig 965: "#gtk2-modules">16.5.12. Packages installing
1.30 wiz 966: GTK2 modules</a></span></dt>
1.1 grant 967:
968: <dt><span class="sect2"><a href=
1.68 ! rillig 969: "#sgml-xml-data">16.5.13. Packages installing
1.30 wiz 970: SGML or XML data</a></span></dt>
1.1 grant 971:
972: <dt><span class="sect2"><a href=
1.68 ! rillig 973: "#mime-database">16.5.14. Packages installing
1.1 grant 974: extensions to the MIME database</a></span></dt>
975:
976: <dt><span class="sect2"><a href=
1.68 ! rillig 977: "#intltool">16.5.15. Packages using
1.1 grant 978: intltool</a></span></dt>
1.18 xtraeme 979:
980: <dt><span class="sect2"><a href=
1.68 ! rillig 981: "#startup-scripts">16.5.16. Packages installing
1.18 xtraeme 982: startup scripts</a></span></dt>
1.57 minskim 983:
984: <dt><span class="sect2"><a href=
1.68 ! rillig 985: "#tex-packages">16.5.17. Packages installing
1.57 minskim 986: TeX modules</a></span></dt>
1.1 grant 987: </dl>
988: </dd>
989:
1.30 wiz 990: <dt><span class="sect1"><a href=
1.68 ! rillig 991: "#feedback-to-author">16.6. Feedback to the
1.30 wiz 992: author</a></span></dt>
1.1 grant 993: </dl>
994: </dd>
995:
1.68 ! rillig 996: <dt><span class="chapter"><a href="#debug">17.
1.1 grant 997: Debugging</a></span></dt>
998:
1.68 ! rillig 999: <dt><span class="chapter"><a href="#submit">18.
1.1 grant 1000: Submitting and Committing</a></span></dt>
1001:
1002: <dd>
1003: <dl>
1.30 wiz 1004: <dt><span class="sect1"><a href=
1.68 ! rillig 1005: "#submitting-your-package">18.1. Submitting your
1.30 wiz 1006: packages</a></span></dt>
1.1 grant 1007:
1.30 wiz 1008: <dt><span class="sect1"><a href=
1.68 ! rillig 1009: "#general-notes-for-changes">18.2. General notes
1.41 wiz 1010: when adding, updating, or removing
1011: packages</a></span></dt>
1012:
1013: <dt><span class="sect1"><a href=
1.68 ! rillig 1014: "#committing-importing">18.3. Committing: Importing
1.30 wiz 1015: a package into CVS</a></span></dt>
1.1 grant 1016:
1.30 wiz 1017: <dt><span class="sect1"><a href=
1.68 ! rillig 1018: "#updating-package">18.4. Updating a package to a
1.30 wiz 1019: newer version</a></span></dt>
1.1 grant 1020:
1.30 wiz 1021: <dt><span class="sect1"><a href=
1.68 ! rillig 1022: "#moving-package">18.5. Moving a package in
1.30 wiz 1023: pkgsrc</a></span></dt>
1.1 grant 1024: </dl>
1025: </dd>
1026: </dl>
1027: </dd>
1028:
1.46 gdt 1029: <dt><span class="appendix"><a href="#examples">A. A simple
1.1 grant 1030: example package: bison</a></span></dt>
1031:
1032: <dd>
1033: <dl>
1.46 gdt 1034: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 1035: files</a></span></dt>
1036:
1037: <dd>
1038: <dl>
1.30 wiz 1039: <dt><span class="sect2"><a href=
1.46 gdt 1040: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 1041:
1.30 wiz 1042: <dt><span class="sect2"><a href=
1.46 gdt 1043: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 1044:
1.30 wiz 1045: <dt><span class="sect2"><a href=
1.46 gdt 1046: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 1047:
1.30 wiz 1048: <dt><span class="sect2"><a href=
1.46 gdt 1049: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 1050: package with <span><strong class=
1.14 xtraeme 1051: "command">pkglint</strong></span></a></span></dt>
1.1 grant 1052: </dl>
1053: </dd>
1054:
1.46 gdt 1055: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 1056: Steps for building, installing,
1057: packaging</a></span></dt>
1.1 grant 1058: </dl>
1059: </dd>
1060:
1.46 gdt 1061: <dt><span class="appendix"><a href="#logs">B. Build
1.1 grant 1062: logs</a></span></dt>
1063:
1064: <dd>
1065: <dl>
1.46 gdt 1066: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 1067: Building figlet</a></span></dt>
1068:
1.46 gdt 1069: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 1070: Packaging figlet</a></span></dt>
1071: </dl>
1072: </dd>
1073:
1.46 gdt 1074: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1 grant 1075: of the FTP server's package archive</a></span></dt>
1.2 hubertf 1076:
1.46 gdt 1077: <dt><span class="appendix"><a href="#editing">D. Editing
1.2 hubertf 1078: guidelines for the pkgsrc guide</a></span></dt>
1079:
1080: <dd>
1081: <dl>
1.46 gdt 1082: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 1083: Targets</a></span></dt>
1084:
1.46 gdt 1085: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 1086: Procedure</a></span></dt>
1087: </dl>
1088: </dd>
1.1 grant 1089: </dl>
1090: </div>
1091:
1.67 hubertf 1092: <div class="chapter" lang="en">
1.1 grant 1093: <div class="titlepage">
1094: <div>
1095: <div>
1.67 hubertf 1096: <h2 class="title"><a name=
1.51 rillig 1097: "introduction"></a>Chapter 1. What is
1098: pkgsrc?</h2>
1.1 grant 1099: </div>
1100: </div>
1101: </div>
1102:
1103: <div class="toc">
1104: <p><b>Table of Contents</b></p>
1105:
1106: <dl>
1.30 wiz 1107: <dt><span class="sect1"><a href=
1108: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 1109:
1110: <dt><span class="sect1"><a href="#overview">1.2.
1111: Overview</a></span></dt>
1112:
1113: <dt><span class="sect1"><a href="#terminology">1.3.
1114: Terminology</a></span></dt>
1115:
1116: <dt><span class="sect1"><a href="#typography">1.4.
1117: Typography</a></span></dt>
1118: </dl>
1119: </div>
1120:
1.67 hubertf 1121: <div class="sect1" lang="en">
1.1 grant 1122: <div class="titlepage">
1123: <div>
1124: <div>
1125: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1126: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 1127: </div>
1128: </div>
1129: </div>
1130:
1.47 reed 1131: <p>There is a lot of software freely available for
1132: Unix-based systems, which usually runs on NetBSD and other
1.1 grant 1133: Unix-flavoured systems, too, sometimes with some
1134: modifications. The NetBSD Packages Collection (pkgsrc)
1135: incorporates any such changes necessary to make that
1136: software run, and makes the installation (and
1137: de-installation) of the software package easy by means of a
1138: single command.</p>
1139:
1140: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 1141: the <span><strong class="command">pkg_*</strong></span>
1142: tools so that installation and de-installation, printing of
1143: an inventory of all installed packages and retrieval of
1144: one-line comments or more verbose descriptions are all
1145: simple.</p>
1.1 grant 1146:
1147: <p>pkgsrc currently contains several thousand packages,
1148: including:</p>
1149:
1150: <div class="itemizedlist">
1151: <ul type="disc">
1152: <li>
1153: <p><a xmlns=
1154: "http://www.w3.org/TR/xhtml1/transitional" href=
1155: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45 wiz 1156: target="_top"><code xmlns="" class=
1157: "filename">www/apache</code></a> - The Apache web
1.20 ben 1158: server</p>
1.1 grant 1159: </li>
1160:
1161: <li>
1162: <p><a xmlns=
1163: "http://www.w3.org/TR/xhtml1/transitional" href=
1164: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 1165: target="_top"><code xmlns="" class=
1166: "filename">www/mozilla</code></a> - The Mozilla web
1.20 ben 1167: browser</p>
1.1 grant 1168: </li>
1169:
1170: <li>
1171: <p><a xmlns=
1172: "http://www.w3.org/TR/xhtml1/transitional" href=
1173: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45 wiz 1174: target="_top"><code xmlns="" class=
1175: "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20 ben 1176: Desktop Environment</p>
1.1 grant 1177: </li>
1178:
1179: <li>
1180: <p><a xmlns=
1181: "http://www.w3.org/TR/xhtml1/transitional" href=
1182: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45 wiz 1183: target="_top"><code xmlns="" class=
1184: "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20 ben 1185: Environment</p>
1.1 grant 1186: </li>
1187: </ul>
1188: </div>
1189:
1190: <p>...just to name a few.</p>
1191:
1192: <p>pkgsrc has built-in support for handling varying
1193: dependencies, such as pthreads and X11, and extended
1194: features such as IPv6 support on a range of platforms.</p>
1195:
1196: <p>pkgsrc was derived from FreeBSD's ports system, and
1197: initially developed for NetBSD only. Since then, pkgsrc has
1198: grown a lot, and now supports the following platforms:</p>
1199:
1200: <div class="itemizedlist">
1201: <ul type="disc">
1202: <li>
1203: <p><a href="http://developer.apple.com/darwin/"
1204: target="_top">Darwin</a> (<a href=
1205: "http://www.apple.com/macosx/" target="_top">Mac OS
1206: X</a>)</p>
1207: </li>
1208:
1209: <li>
1.3 hubertf 1210: <p><a href="http://www.DragonFlyBSD.org/" target=
1211: "_top">DragonFlyBSD</a></p>
1212: </li>
1213:
1214: <li>
1.1 grant 1215: <p><a href="http://www.FreeBSD.org/" target=
1216: "_top">FreeBSD</a></p>
1217: </li>
1218:
1219: <li>
1.3 hubertf 1220: <p>Microsoft Windows, via <a href=
1221: "http://www.microsoft.com/windows/sfu/" target=
1222: "_top">Interix</a></p>
1.1 grant 1223: </li>
1224:
1225: <li>
1226: <p><a href="http://www.sgi.com/software/irix6.5/"
1227: target="_top">IRIX</a></p>
1228: </li>
1229:
1230: <li>
1231: <p><a href="http://www.linux.org/" target=
1232: "_top">Linux</a></p>
1233: </li>
1234:
1235: <li>
1236: <p><a href="http://www.NetBSD.org/" target=
1237: "_top">NetBSD</a> (of course)</p>
1238: </li>
1239:
1240: <li>
1.17 sketch 1241: <p><a href="http://h30097.www3.hp.com/" target=
1242: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1243: </li>
1244:
1245: <li>
1.1 grant 1246: <p><a href="http://www.openbsd.org/" target=
1247: "_top">OpenBSD</a></p>
1248: </li>
1249:
1250: <li>
1251: <p><a href="http://www.sun.com/solaris/" target=
1252: "_top">Solaris</a></p>
1253: </li>
1254: </ul>
1255: </div>
1256: </div>
1257:
1.67 hubertf 1258: <div class="sect1" lang="en">
1.1 grant 1259: <div class="titlepage">
1260: <div>
1261: <div>
1262: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1263: "overview"></a>1.2. Overview</h2>
1.1 grant 1264: </div>
1265: </div>
1266: </div>
1267:
1268: <p>This document is divided into two parts. The first,
1269: <a href="#users-guide" title=
1.46 gdt 1270: "Part I. The pkgsrc user's guide">The pkgsrc
1.2 hubertf 1271: user's guide</a>, describes how one can use one of the
1272: packages in the Package Collection, either by installing a
1273: precompiled binary package, or by building one's own copy
1274: using the NetBSD package system. The second part, <a href=
1.1 grant 1275: "#developers-guide" title=
1.46 gdt 1276: "Part II. The pkgsrc developer's guide">The
1277: pkgsrc developer's guide</a>, explains how to prepare a
1278: package so it can be easily built by other NetBSD users
1279: without knowing about the package's building details.</p>
1.1 grant 1280:
1281: <p>This document is available in various formats:</p>
1282:
1283: <div class="itemizedlist">
1284: <ul type="disc">
1285: <li>
1286: <p><a href="index.html" target="_top">HTML</a></p>
1287: </li>
1288:
1289: <li>
1290: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1291: </li>
1292:
1293: <li>
1294: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1295: </li>
1296:
1297: <li>
1298: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1299: </li>
1300: </ul>
1301: </div>
1302: </div>
1303:
1.67 hubertf 1304: <div class="sect1" lang="en">
1.1 grant 1305: <div class="titlepage">
1306: <div>
1307: <div>
1308: <h2 class="title" style="clear: both"><a name=
1309: "terminology"></a>1.3. Terminology</h2>
1310: </div>
1311: </div>
1312: </div>
1313:
1314: <p>There has been a lot of talk about “<span class=
1315: "quote">ports</span>”, “<span class=
1316: "quote">packages</span>”, etc. so far. Here is a
1317: description of all the terminology used within this
1318: document.</p>
1319:
1320: <div class="variablelist">
1321: <dl>
1322: <dt><span class="term">Package</span></dt>
1323:
1324: <dd>
1325: <p>A set of files and building instructions that
1326: describe what's necessary to build a certain piece of
1327: software using pkgsrc. Packages are traditionally
1.45 wiz 1328: stored under <code xmlns=
1329: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1330: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1331: </dd>
1332:
1333: <dt><span class="term">The NetBSD package
1334: system</span></dt>
1335:
1336: <dd>
1337: <p>This is the former name of “<span class=
1338: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1339: NetBSD operating system and can be bootstrapped to
1340: run on non-NetBSD operating systems as well. It
1341: handles building (compiling), installing, and
1342: removing of packages.</p>
1.1 grant 1343: </dd>
1344:
1345: <dt><span class="term">Distfile</span></dt>
1346:
1347: <dd>
1348: <p>This term describes the file or files that are
1349: provided by the author of the piece of software to
1350: distribute his work. All the changes necessary to
1351: build on NetBSD are reflected in the corresponding
1352: package. Usually the distfile is in the form of a
1353: compressed tar-archive, but other types are possible,
1.45 wiz 1354: too. Distfiles are usually stored below <code xmlns=
1355: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1356: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1357: </dd>
1358:
1359: <dt><span class="term">Port</span></dt>
1360:
1361: <dd>
1362: <p>This is the term used by FreeBSD and OpenBSD
1363: people for what we call a package. In NetBSD
1364: terminology, “<span class=
1365: "quote">port</span>” refers to a different
1366: architecture.</p>
1367: </dd>
1368:
1369: <dt><span class="term">Precompiled/binary
1370: package</span></dt>
1371:
1372: <dd>
1373: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1374: distfile and stuffed together in a single
1.45 wiz 1375: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1376: class="filename">.tgz</code> file so it can be
1.14 xtraeme 1377: installed on machines of the same machine
1378: architecture without the need to recompile. Packages
1.45 wiz 1379: are usually generated in <code xmlns=
1380: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1381: "filename">/usr/pkgsrc/packages</code>; there is also
1382: an archive on <a href=
1.1 grant 1383: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1384: "_top">ftp.NetBSD.org</a>.</p>
1385:
1386: <p>Sometimes, this is referred to by the term
1387: “<span class="quote">package</span>” too,
1388: especially in the context of precompiled
1389: packages.</p>
1390: </dd>
1391:
1392: <dt><span class="term">Program</span></dt>
1393:
1394: <dd>
1395: <p>The piece of software to be installed which will
1.47 reed 1396: be constructed from all the files in the distfile by
1.1 grant 1397: the actions defined in the corresponding package.</p>
1398: </dd>
1399: </dl>
1400: </div>
1401: </div>
1402:
1.67 hubertf 1403: <div class="sect1" lang="en">
1.1 grant 1404: <div class="titlepage">
1405: <div>
1406: <div>
1407: <h2 class="title" style="clear: both"><a name=
1408: "typography"></a>1.4. Typography</h2>
1409: </div>
1410: </div>
1411: </div>
1412:
1413: <p>When giving examples for commands, shell prompts are
1414: used to show if the command should/can be issued as root,
1415: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1416: privileges are sufficient. We use a <code class=
1417: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1418: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1419: assuming they use the C-shell or tcsh.</p>
1.1 grant 1420: </div>
1421: </div>
1422:
1.67 hubertf 1423: <div class="part" lang="en">
1.1 grant 1424: <div class="titlepage">
1425: <div>
1426: <div>
1.67 hubertf 1427: <h1 class="title"><a name=
1.48 dillo 1428: "users-guide"></a>Part I. The pkgsrc user's
1429: guide</h1>
1.1 grant 1430: </div>
1431: </div>
1432: </div>
1433:
1434: <div class="toc">
1435: <p><b>Table of Contents</b></p>
1436:
1437: <dl>
1438: <dt><span class="chapter"><a href="#getting">2. Where to
1.59 rillig 1439: get pkgsrc and how to keep it up-to-date</a></span></dt>
1.1 grant 1440:
1441: <dd>
1442: <dl>
1.30 wiz 1443: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1444: As tar file</a></span></dt>
1.1 grant 1445:
1.30 wiz 1446: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1447: SUP</a></span></dt>
1448:
1.30 wiz 1449: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1450: CVS</a></span></dt>
1.59 rillig 1451:
1452: <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
1453: Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1 grant 1454: </dl>
1455: </dd>
1456:
1457: <dt><span class="chapter"><a href="#platforms">3. Using
1458: pkgsrc on systems other than NetBSD</a></span></dt>
1459:
1460: <dd>
1461: <dl>
1.30 wiz 1462: <dt><span class="sect1"><a href=
1463: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1464: pkgsrc</a></span></dt>
1.1 grant 1465:
1.30 wiz 1466: <dt><span class="sect1"><a href=
1.47 reed 1467: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1468: notes</a></span></dt>
1.1 grant 1469:
1470: <dd>
1471: <dl>
1.30 wiz 1472: <dt><span class="sect2"><a href="#darwin">3.2.1.
1473: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1474:
1.30 wiz 1475: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1476: FreeBSD</a></span></dt>
1.22 tv 1477:
1.30 wiz 1478: <dt><span class="sect2"><a href="#interix">3.2.3.
1479: Interix</a></span></dt>
1.1 grant 1480:
1.30 wiz 1481: <dt><span class="sect2"><a href="#irix">3.2.4.
1482: IRIX</a></span></dt>
1.1 grant 1483:
1.30 wiz 1484: <dt><span class="sect2"><a href="#linux">3.2.5.
1485: Linux</a></span></dt>
1.1 grant 1486:
1.30 wiz 1487: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1488: OpenBSD</a></span></dt>
1.1 grant 1489:
1.30 wiz 1490: <dt><span class="sect2"><a href="#solaris">3.2.7.
1491: Solaris</a></span></dt>
1.1 grant 1492: </dl>
1493: </dd>
1494: </dl>
1495: </dd>
1496:
1497: <dt><span class="chapter"><a href="#using">4. Using
1498: pkgsrc</a></span></dt>
1499:
1500: <dd>
1501: <dl>
1502: <dt><span class="sect1"><a href=
1503: "#getting-started">4.1. Working with binary
1504: packages</a></span></dt>
1505:
1506: <dd>
1507: <dl>
1508: <dt><span class="sect2"><a href=
1.30 wiz 1509: "#where-to-get-binary-packages">4.1.1. Where to
1510: get binary packages</a></span></dt>
1.1 grant 1511:
1512: <dt><span class="sect2"><a href=
1.30 wiz 1513: "#how-to-use-binary-packages">4.1.2. How to use
1514: binary packages</a></span></dt>
1.1 grant 1515:
1516: <dt><span class="sect2"><a href=
1.30 wiz 1517: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1518: warning</a></span></dt>
1519: </dl>
1520: </dd>
1521:
1.30 wiz 1522: <dt><span class="sect1"><a href=
1523: "#building-packages-from-source">4.2. Building
1524: packages from source</a></span></dt>
1.1 grant 1525:
1526: <dd>
1527: <dl>
1528: <dt><span class="sect2"><a href=
1.30 wiz 1529: "#requirements">4.2.1.
1530: Requirements</a></span></dt>
1.1 grant 1531:
1532: <dt><span class="sect2"><a href=
1.30 wiz 1533: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1534: distfiles</a></span></dt>
1535:
1536: <dt><span class="sect2"><a href=
1.30 wiz 1537: "#how-to-build-and-install">4.2.3. How to build
1538: and install</a></span></dt>
1.1 grant 1539:
1540: <dt><span class="sect2"><a href=
1.30 wiz 1541: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1542: compiler</a></span></dt>
1543: </dl>
1544: </dd>
1545: </dl>
1546: </dd>
1547:
1.38 dillo 1548: <dt><span class="chapter"><a href="#configuring">5.
1549: Configuring pkgsrc</a></span></dt>
1550:
1551: <dd>
1552: <dl>
1553: <dt><span class="sect1"><a href=
1.45 wiz 1554: "#general-configuration">5.1. General
1555: configuration</a></span></dt>
1556:
1557: <dt><span class="sect1"><a href=
1558: "#variables-affecting-build">5.2. Variables affecting
1559: the build process</a></span></dt>
1560:
1561: <dt><span class="sect1"><a href=
1562: "#developer-advanced-settings">5.3.
1563: Developer/advanced settings</a></span></dt>
1564:
1565: <dt><span class="sect1"><a href=
1566: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 1567: Options</a></span></dt>
1.38 dillo 1568: </dl>
1569: </dd>
1570:
1571: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 1572: binary packages</a></span></dt>
1573:
1574: <dd>
1575: <dl>
1.30 wiz 1576: <dt><span class="sect1"><a href=
1.38 dillo 1577: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 1578: single binary package</a></span></dt>
1.1 grant 1579:
1.30 wiz 1580: <dt><span class="sect1"><a href=
1.38 dillo 1581: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 1582: Settings for creation of binary
1583: packages</a></span></dt>
1584:
1.38 dillo 1585: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 1586: Doing a bulk build of all packages</a></span></dt>
1587:
1588: <dd>
1589: <dl>
1590: <dt><span class="sect2"><a href=
1.38 dillo 1591: "#binary.configuration">6.3.1.
1.1 grant 1592: Configuration</a></span></dt>
1593:
1594: <dt><span class="sect2"><a href=
1.38 dillo 1595: "#other-environmental-considerations">6.3.2.
1.30 wiz 1596: Other environmental
1.1 grant 1597: considerations</a></span></dt>
1598:
1599: <dt><span class="sect2"><a href=
1.38 dillo 1600: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 1601:
1602: <dt><span class="sect2"><a href=
1.38 dillo 1603: "#what-it-does">6.3.4. What it
1.30 wiz 1604: does</a></span></dt>
1.1 grant 1605:
1606: <dt><span class="sect2"><a href=
1.38 dillo 1607: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 1608: requirements</a></span></dt>
1609:
1610: <dt><span class="sect2"><a href=
1.38 dillo 1611: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 1612: sandbox for chrooted builds</a></span></dt>
1.1 grant 1613:
1614: <dt><span class="sect2"><a href=
1.38 dillo 1615: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 1616: partial set of packages</a></span></dt>
1.13 hubertf 1617:
1618: <dt><span class="sect2"><a href=
1.38 dillo 1619: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 1620: build</a></span></dt>
1.1 grant 1621: </dl>
1622: </dd>
1623:
1.30 wiz 1624: <dt><span class="sect1"><a href=
1.38 dillo 1625: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 1626: packages collection</a></span></dt>
1.1 grant 1627:
1628: <dd>
1629: <dl>
1630: <dt><span class="sect2"><a href=
1.38 dillo 1631: "#cdpack-example">6.4.1. Example of
1.1 grant 1632: cdpack</a></span></dt>
1633: </dl>
1634: </dd>
1635: </dl>
1636: </dd>
1637:
1.38 dillo 1638: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 1639: Asked Questions</a></span></dt>
1640:
1641: <dd>
1642: <dl>
1.30 wiz 1643: <dt><span class="sect1"><a href=
1.38 dillo 1644: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 1645: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1646:
1.38 dillo 1647: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 1648: Where's the pkgviews documentation?</a></span></dt>
1649:
1.38 dillo 1650: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 1651: Utilities for package management
1652: (pkgtools)</a></span></dt>
1653:
1.30 wiz 1654: <dt><span class="sect1"><a href=
1.38 dillo 1655: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 1656: non-root</a></span></dt>
1.1 grant 1657:
1.30 wiz 1658: <dt><span class="sect1"><a href=
1.38 dillo 1659: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 1660: fetching distfiles?</a></span></dt>
1.14 xtraeme 1661:
1.30 wiz 1662: <dt><span class="sect1"><a href=
1.38 dillo 1663: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 1664: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1665:
1.30 wiz 1666: <dt><span class="sect1"><a href=
1.38 dillo 1667: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 1668: from pkgsrc?</a></span></dt>
1.1 grant 1669:
1.30 wiz 1670: <dt><span class="sect1"><a href=
1.38 dillo 1671: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 1672: behind a firewall</a></span></dt>
1.1 grant 1673:
1.38 dillo 1674: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30 wiz 1675: How do I tell <span><strong class="command">make
1.14 xtraeme 1676: fetch</strong></span> to do passive
1.1 grant 1677: FTP?</a></span></dt>
1678:
1.30 wiz 1679: <dt><span class="sect1"><a href=
1.38 dillo 1680: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 1681: distfiles at once</a></span></dt>
1.1 grant 1682:
1.30 wiz 1683: <dt><span class="sect1"><a href=
1.38 dillo 1684: "#tmac.andoc-missing">7.11. What does
1.30 wiz 1685: “<span class="quote">Don't know how to make
1686: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1687: mean?</a></span></dt>
1.13 hubertf 1688:
1.30 wiz 1689: <dt><span class="sect1"><a href=
1.38 dillo 1690: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 1691: “<span class="quote">Could not find
1.14 xtraeme 1692: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1693:
1.30 wiz 1694: <dt><span class="sect1"><a href=
1.38 dillo 1695: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 1696: pkgsrc</a></span></dt>
1.1 grant 1697:
1.38 dillo 1698: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 1699: do I change the location of configuration
1700: files?</a></span></dt>
1.1 grant 1701:
1702: <dt><span class="sect1"><a href=
1.38 dillo 1703: "#audit-packages">7.15. Automated security
1.1 grant 1704: checks</a></span></dt>
1705: </dl>
1706: </dd>
1707: </dl>
1708: </div>
1709:
1.67 hubertf 1710: <div class="chapter" lang="en">
1.1 grant 1711: <div class="titlepage">
1712: <div>
1713: <div>
1.67 hubertf 1714: <h2 class="title"><a name=
1.1 grant 1715: "getting"></a>Chapter 2. Where to get
1.59 rillig 1716: pkgsrc and how to keep it up-to-date</h2>
1.1 grant 1717: </div>
1718: </div>
1719: </div>
1720:
1721: <div class="toc">
1722: <p><b>Table of Contents</b></p>
1723:
1724: <dl>
1.30 wiz 1725: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1726: tar file</a></span></dt>
1727:
1.30 wiz 1728: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1729: SUP</a></span></dt>
1730:
1.30 wiz 1731: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1732: CVS</a></span></dt>
1.59 rillig 1733:
1734: <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
1735: Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1 grant 1736: </dl>
1737: </div>
1738:
1739: <p>There are three ways to get pkgsrc. Either as a tar
1740: file, via SUP, or via CVS. All three ways are described
1741: here.</p>
1742:
1.67 hubertf 1743: <div class="sect1" lang="en">
1.1 grant 1744: <div class="titlepage">
1745: <div>
1746: <div>
1747: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1748: "as-tar-file"></a>2.1. As tar file</h2>
1.1 grant 1749: </div>
1750: </div>
1751: </div>
1752:
1753: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1754: file from <a href=
1.11 ben 1755: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1756: target="_top">ftp.NetBSD.org</a> and unpack it into
1.45 wiz 1757: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1758: class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1759: </div>
1760:
1.67 hubertf 1761: <div class="sect1" lang="en">
1.1 grant 1762: <div class="titlepage">
1763: <div>
1764: <div>
1765: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1766: "via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1767: </div>
1768: </div>
1769: </div>
1770:
1771: <p>As an alternative to the tar file, you can get pkgsrc
1772: via the Software Update Protocol, SUP. To do so, make
1773: sure your supfile has a line</p>
1774: <pre class="programlisting">
1.51 rillig 1775: release=pkgsrc
1.1 grant 1776: </pre>
1777:
1.45 wiz 1778: <p>in it, see the examples in <code xmlns=
1779: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1780: "filename">/usr/share/examples/supfiles</code>, and that
1.45 wiz 1781: the <code xmlns=
1782: "http://www.w3.org/TR/xhtml1/transitional" class=
1783: "filename">/usr/pkgsrc</code> directory exists. Then,
1784: simply run <span><strong class="command">sup -v
1785: <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1786: </div>
1787:
1.67 hubertf 1788: <div class="sect1" lang="en">
1.1 grant 1789: <div class="titlepage">
1790: <div>
1791: <div>
1792: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1793: "via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1794: </div>
1795: </div>
1796: </div>
1797:
1798: <p>To get pkgsrc via CVS, make sure you have
1799: “<span class="quote">cvs</span>” installed.
1.27 rillig 1800: To do an initial (full) checkout of pkgsrc, do the
1801: following steps:</p>
1.1 grant 1802: <pre class="screen">
1.14 xtraeme 1803: <code class="prompt">%</code> <strong class=
1804: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1805: <code class="prompt">%</code> <strong class=
1806: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1807: <code class="prompt">%</code> <strong class=
1808: "userinput"><code>cd /usr</code></strong>
1809: <code class="prompt">%</code> <strong class=
1810: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1811: </pre>
1812:
1.45 wiz 1813: <p>This will create the <code xmlns=
1814: "http://www.w3.org/TR/xhtml1/transitional" class=
1815: "filename">pkgsrc</code> directory in your <code xmlns=
1816: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1817: "filename">/usr</code>, and all the package source will
1.45 wiz 1818: be stored under <code xmlns=
1819: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1820: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1821: initial checkout, make sure you have <code class=
1822: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1823: <pre class="screen">
1.14 xtraeme 1824: <code class="prompt">%</code> <strong class=
1825: "userinput"><code>cd /usr/pkgsrc</code></strong>
1826: <code class="prompt">%</code> <strong class=
1827: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1828: </pre>
1829:
1830: <p>Please also note that it is possible to have multiple
1831: copies of the pkgsrc hierarchy in use at any one time -
1832: all work is done relatively within the pkgsrc tree.</p>
1833: </div>
1.59 rillig 1834:
1.67 hubertf 1835: <div class="sect1" lang="en">
1.59 rillig 1836: <div class="titlepage">
1837: <div>
1838: <div>
1839: <h2 class="title" style="clear: both"><a name=
1840: "uptodate-cvs"></a>2.4. Keeping pkgsrc
1841: up-to-date via CVS</h2>
1842: </div>
1843: </div>
1844: </div>
1845:
1846: <p>If your copy of pkgsrc contains a lot of <code xmlns=
1847: "http://www.w3.org/TR/xhtml1/transitional" class=
1848: "filename">CVS</code> directories, you can update it
1849: using the <a href=
1850: "http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current">
1851: <span class="citerefentry"><span class=
1852: "refentrytitle">cvs</span>(1)</span></a> program. First,
1853: <span><strong class="command">cd</strong></span> to the
1854: top level directory of pkgsrc. Then run
1855: <span><strong class="command">cvs -q update
1856: -dP</strong></span>, and you're done.</p>
1857:
1858: <p>If that doesn't work and the file <code xmlns=
1859: "http://www.w3.org/TR/xhtml1/transitional" class=
1860: "filename">CVS/Root</code> contains the string
1861: “<span class="quote">:pserver:</span>”, you
1862: have to run <span><strong class="command">cvs
1863: login</strong></span> once to get known to the NetBSD CVS
1864: server. The <span><strong class=
1865: "command">cvs</strong></span> utility will then ask you
1866: for a password. Just enter “<span class=
1867: "quote">anoncvs</span>”. Then try again to
1868: update.</p>
1869: </div>
1.1 grant 1870: </div>
1871:
1.67 hubertf 1872: <div class="chapter" lang="en">
1.1 grant 1873: <div class="titlepage">
1874: <div>
1875: <div>
1.67 hubertf 1876: <h2 class="title"><a name=
1.1 grant 1877: "platforms"></a>Chapter 3. Using pkgsrc on
1878: systems other than NetBSD</h2>
1879: </div>
1880: </div>
1881: </div>
1882:
1883: <div class="toc">
1884: <p><b>Table of Contents</b></p>
1885:
1886: <dl>
1.30 wiz 1887: <dt><span class="sect1"><a href=
1888: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1889: pkgsrc</a></span></dt>
1.1 grant 1890:
1.30 wiz 1891: <dt><span class="sect1"><a href=
1.47 reed 1892: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1893: notes</a></span></dt>
1.1 grant 1894:
1895: <dd>
1896: <dl>
1.30 wiz 1897: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1898: Darwin (Mac OS X)</a></span></dt>
1899:
1.30 wiz 1900: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1901: FreeBSD</a></span></dt>
1902:
1.30 wiz 1903: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1904: Interix</a></span></dt>
1905:
1.30 wiz 1906: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1907: IRIX</a></span></dt>
1908:
1.30 wiz 1909: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1910: Linux</a></span></dt>
1911:
1.30 wiz 1912: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1913: OpenBSD</a></span></dt>
1914:
1.30 wiz 1915: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1916: Solaris</a></span></dt>
1917: </dl>
1918: </dd>
1919: </dl>
1920: </div>
1921:
1.67 hubertf 1922: <div class="sect1" lang="en">
1.1 grant 1923: <div class="titlepage">
1924: <div>
1925: <div>
1926: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1927: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
1928: pkgsrc</h2>
1.1 grant 1929: </div>
1930: </div>
1931: </div>
1932:
1.27 rillig 1933: <p>For operating systems other than NetBSD, we provide a
1.1 grant 1934: bootstrap kit to build the required tools to use pkgsrc
1935: on your platform. Besides support for native NetBSD,
1936: pkgsrc and the bootstrap kit have support for the
1937: following operating systems:</p>
1938:
1939: <div class="itemizedlist">
1940: <ul type="disc">
1941: <li>
1942: <p>Darwin (Mac OS X)</p>
1943: </li>
1944:
1945: <li>
1.16 grant 1946: <p>DragonFlyBSD</p>
1947: </li>
1948:
1949: <li>
1.1 grant 1950: <p>FreeBSD</p>
1951: </li>
1952:
1953: <li>
1954: <p>Interix (Windows 2000, XP, 2003)</p>
1955: </li>
1956:
1957: <li>
1958: <p>IRIX</p>
1959: </li>
1960:
1961: <li>
1962: <p>Linux</p>
1963: </li>
1964:
1965: <li>
1966: <p>OpenBSD</p>
1967: </li>
1968:
1969: <li>
1970: <p>Solaris</p>
1971: </li>
1.16 grant 1972:
1973: <li>
1974: <p>Tru64 (Digital UNIX/OSF1)</p>
1975: </li>
1.1 grant 1976: </ul>
1977: </div>
1978:
1979: <p>Support for other platforms is under development.</p>
1980:
1981: <p>Installing the bootstrap kit should be as simple
1982: as:</p>
1983: <pre class="screen">
1.14 xtraeme 1984: <code class="prompt">#</code> <strong class=
1985: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1986: <code class="prompt">#</code> <strong class=
1987: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1988: <code class="prompt">#</code> <strong class=
1989: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1990: </pre>
1991:
1992: <p>See <a href="#getting" title=
1.59 rillig 1993: "Chapter 2. Where to get pkgsrc and how to keep it up-to-date">
1.67 hubertf 1994: Chapter 2, <i>Where to get pkgsrc and how to keep it
1.59 rillig 1995: up-to-date</i></a> for other ways to get pkgsrc before
1996: bootstrapping. The given <span><strong class=
1997: "command">bootstrap</strong></span> command will use the
1998: defaults of <code xmlns=
1.45 wiz 1999: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2000: "filename">/usr/pkg</code> for the <span class=
2001: "emphasis"><em>prefix</em></span> where programs will be
1.45 wiz 2002: installed in, and <code xmlns=
2003: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2004: "filename">/var/db/pkg</code> for the package database
1.27 rillig 2005: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 2006: However, these can also be set using command-line
1.27 rillig 2007: arguments.</p>
1.1 grant 2008:
2009: <p>Binary packages for the pkgsrc tools and an initial
2010: set of packages is available for supported platforms. An
2011: up-to-date list of these can be found on <a href=
2012: "http://www.pkgsrc.org/" target=
1.63 dillo 2013: "_top">www.pkgsrc.org</a>. Note that this only works for
2014: privileged builds that install into <code xmlns=
2015: "http://www.w3.org/TR/xhtml1/transitional" class=
2016: "filename">/usr/pkg</code>.</p>
1.47 reed 2017:
2018: <div class="note" style=
2019: "margin-left: 0.5in; margin-right: 0.5in;">
2020: <h3 class="title">Note</h3>
2021:
2022: <p>The bootstrap installs a <span><strong class=
2023: "command">bmake</strong></span> tool. Use this
2024: <span><strong class="command">bmake</strong></span>
2025: when building via pkgsrc. For examples in this guide,
2026: use <span><strong class="command">bmake</strong></span>
2027: instead of “<span class=
2028: "quote">make</span>”.</p>
2029: </div>
1.1 grant 2030: </div>
2031:
1.67 hubertf 2032: <div class="sect1" lang="en">
1.1 grant 2033: <div class="titlepage">
2034: <div>
2035: <div>
2036: <h2 class="title" style="clear: both"><a name=
1.47 reed 2037: "platform-specific-notes"></a>3.2. Platform-specific
2038: notes</h2>
1.1 grant 2039: </div>
2040: </div>
2041: </div>
2042:
2043: <p>Here are some platform-specific notes you should be
2044: aware of.</p>
2045:
1.67 hubertf 2046: <div class="sect2" lang="en">
1.1 grant 2047: <div class="titlepage">
2048: <div>
2049: <div>
1.67 hubertf 2050: <h3 class="title"><a name=
1.30 wiz 2051: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 2052: </div>
2053: </div>
2054: </div>
2055:
2056: <p>Darwin 5.x and 6.x are supported. There are two
2057: methods of using pkgsrc on Mac OS X, by using a
2058: <a href="#platform.osx-image" title=
2059: "3.2.1.1. Using a disk image">disk image</a>, or a
2060: <a href="#platform.osx-ufs" title=
2061: "3.2.1.2. Using a UFS partition">UFS
2062: partition</a>.</p>
2063:
2064: <p>Before you start, you will need to download and
2065: install the Mac OS X Developer Tools from Apple's
2066: Developer Connection. See <a href=
2067: "http://developer.apple.com/macosx/" target=
2068: "_top">http://developer.apple.com/macosx/</a> for
2069: details. Also, make sure you install X11 for Mac OS X
2070: and the X11 SDK from <a href=
2071: "http://www.apple.com/macosx/x11/download/" target=
2072: "_top">http://www.apple.com/macosx/x11/download/</a> if
2073: you intend to build packages that use the X11 Window
2074: System.</p>
2075:
2076: <p>If you already have a UFS partition, or have a spare
2077: partition that you can format as UFS, it is recommended
2078: to use that instead of the disk image. It'll be
2079: somewhat faster and will mount automatically at boot
2080: time, where you must manually mount a disk image.</p>
2081:
2082: <div class="note" style=
2083: "margin-left: 0.5in; margin-right: 0.5in;">
2084: <h3 class="title">Note</h3>
2085:
2086: <p>You cannot use a HFS+ file system for pkgsrc,
1.47 reed 2087: because pkgsrc currently requires the file system to
1.1 grant 2088: be case-sensitive, and HFS+ is not.</p>
2089: </div>
2090:
1.67 hubertf 2091: <div class="sect3" lang="en">
1.1 grant 2092: <div class="titlepage">
2093: <div>
2094: <div>
1.67 hubertf 2095: <h4 class="title"><a name=
2096: "platform.osx-image"></a>3.2.1.1. Using a
2097: disk image</h4>
1.1 grant 2098: </div>
2099: </div>
2100: </div>
2101:
2102: <p>Create the disk image:</p>
2103: <pre class="screen">
1.14 xtraeme 2104: <code class="prompt">#</code> <strong class=
2105: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
2106: <code class="prompt">#</code> <strong class=
2107: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
2108: <code class="prompt">#</code> <strong class=
2109: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
2110: <code class="prompt">#</code> <strong class=
2111: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 2112: </pre>
2113:
2114: <p>That's it!</p>
2115: </div>
2116:
1.67 hubertf 2117: <div class="sect3" lang="en">
1.1 grant 2118: <div class="titlepage">
2119: <div>
2120: <div>
1.67 hubertf 2121: <h4 class="title"><a name=
2122: "platform.osx-ufs"></a>3.2.1.2. Using a
1.1 grant 2123: UFS partition</h4>
2124: </div>
2125: </div>
2126: </div>
2127:
1.45 wiz 2128: <p>By default, <code xmlns=
2129: "http://www.w3.org/TR/xhtml1/transitional" class=
2130: "filename">/usr</code> will be on your root file
2131: system, normally HFS+. It is possible to use the
2132: default <span class="emphasis"><em>prefix</em></span>
2133: of <code xmlns=
2134: "http://www.w3.org/TR/xhtml1/transitional" class=
2135: "filename">/usr/pkg</code> by symlinking <code xmlns=
2136: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2137: "filename">/usr/pkg</code> to a directory on a UFS
2138: file system. Obviously, another symlink is required
2139: if you want to place the package database directory
2140: outside the <span class=
2141: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 2142: <pre class="screen">
1.14 xtraeme 2143: <code class="prompt">#</code> <strong class=
1.59 rillig 2144: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb</code></strong>
1.1 grant 2145: </pre>
2146:
2147: <p>If you created your partitions at the time of
2148: installing Mac OS X and formatted the target
2149: partition as UFS, it should automatically mount on
1.45 wiz 2150: <code xmlns=
2151: "http://www.w3.org/TR/xhtml1/transitional" class=
2152: "filename">/Volumes/<volume name></code> when
2153: the machine boots. If you are (re)formatting a
2154: partition as UFS, you need to ensure that the
2155: partition map correctly reflects “<span class=
2156: "quote">Apple_UFS</span>” and not
2157: “<span class=
1.1 grant 2158: "quote">Apple_HFS</span>”.</p>
2159:
2160: <p>The problem is that none of the disk tools will
2161: let you touch a disk that is booted from. You can
2162: unmount the partition, but even if you newfs it, the
2163: partition type will be incorrect and the automounter
2164: won't mount it. It can be mounted manually, but it
2165: won't appear in Finder.</p>
2166:
2167: <p>You'll need to boot off of the OS X Installation
2168: (User) CD. When the Installation program starts, go
2169: up to the menu and select Disk Utility. Now, you will
2170: be able to select the partition you want to be UFS,
2171: and Format it Apple UFS. Quit the Disk Utility, quit
2172: the installer which will reboot your machine. The new
2173: UFS file system will appear in Finder.</p>
2174:
2175: <p>Be aware that the permissions on the new file
2176: system will be writable by root only.</p>
2177:
2178: <p>This note is as of 10.2 (Jaguar) and applies to
2179: earlier versions. Hopefully Apple will fix Disk
2180: Utility in 10.3 (Panther).</p>
2181: </div>
2182: </div>
2183:
1.67 hubertf 2184: <div class="sect2" lang="en">
1.1 grant 2185: <div class="titlepage">
2186: <div>
2187: <div>
1.67 hubertf 2188: <h3 class="title"><a name=
1.30 wiz 2189: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 2190: </div>
2191: </div>
2192: </div>
2193:
2194: <p>FreeBSD 4.7 and 5.0 have been tested and are
2195: supported, other versions may work.</p>
2196:
2197: <p>Care should be taken so that the tools that this kit
2198: installs do not conflict with the FreeBSD userland
2199: tools. There are several steps:</p>
2200:
2201: <div class="orderedlist">
2202: <ol type="1">
2203: <li>
2204: <p>FreeBSD stores its ports pkg database in
1.45 wiz 2205: <code xmlns=
2206: "http://www.w3.org/TR/xhtml1/transitional" class=
2207: "filename">/var/db/pkg</code>. It is therefore
2208: recommended that you choose a different location
2209: (e.g. <code xmlns=
2210: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2211: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2212: --pkgdbdir option to the bootstrap script.</p>
2213: </li>
2214:
2215: <li>
2216: <p>If you do not intend to use the FreeBSD ports
2217: tools, it's probably a good idea to move them out
2218: of the way to avoid confusion, e.g.</p>
2219: <pre class="screen">
1.14 xtraeme 2220: <code class="prompt">#</code> <strong class=
2221: "userinput"><code>cd /usr/sbin</code></strong>
2222: <code class="prompt">#</code> <strong class=
2223: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2224: <code class="prompt">#</code> <strong class=
2225: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2226: <code class="prompt">#</code> <strong class=
2227: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2228: <code class="prompt">#</code> <strong class=
2229: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2230: </pre>
2231: </li>
2232:
2233: <li>
1.45 wiz 2234: <p>An example <code xmlns=
2235: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2236: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2237: placed in <code xmlns=
2238: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2239: "filename">/etc/mk.conf.example</code> file when
2240: you use the bootstrap script.</p>
1.1 grant 2241: </li>
2242: </ol>
2243: </div>
2244: </div>
2245:
1.67 hubertf 2246: <div class="sect2" lang="en">
1.1 grant 2247: <div class="titlepage">
2248: <div>
2249: <div>
1.67 hubertf 2250: <h3 class="title"><a name=
1.30 wiz 2251: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2252: </div>
2253: </div>
2254: </div>
2255:
1.47 reed 2256: <p>Interix is a POSIX-compatible subsystem for the
1.1 grant 2257: Windows NT kernel, providing a Unix-like environment
2258: with a tighter kernel integration than available with
2259: Cygwin. It is part of the Windows Services for Unix
2260: package, available for free for any licensed copy of
1.22 tv 2261: Windows 2000, XP (not including XP Home), or 2003. SFU
2262: can be downloaded from <a href=
2263: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2264: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2265:
2266: <p>Services for Unix 3.5, current as of this writing,
2267: has been tested. 3.0 or 3.1 may work, but are not
2268: officially supported. (The main difference in 3.0/3.1
2269: is lack of pthreads.)</p>
2270:
1.67 hubertf 2271: <div class="sect3" lang="en">
1.1 grant 2272: <div class="titlepage">
2273: <div>
2274: <div>
2275: <h4 class="title"><a name=
2276: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2277: installing Interix/SFU</h4>
1.1 grant 2278: </div>
2279: </div>
2280: </div>
2281:
2282: <p>At an absolute minimum, the following packages
2283: must be installed from the Windows Services for Unix
2284: 3.5 distribution in order to use pkgsrc:</p>
2285:
2286: <div class="itemizedlist">
2287: <ul type="disc">
2288: <li>
2289: <p>Utilities -> Base Utilities</p>
2290: </li>
2291:
2292: <li>
2293: <p>Interix GNU Components -> (all)</p>
2294: </li>
2295:
2296: <li>
2297: <p>Remote Connectivity</p>
2298: </li>
2299:
2300: <li>
2301: <p>Interix SDK</p>
2302: </li>
2303: </ul>
2304: </div>
2305:
2306: <p>When using pkgsrc on Interix, DO NOT install the
2307: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2308: without shared module support, installed to
2309: /usr/local, and will only cause confusion. Instead,
2310: install Perl 5.8 from pkgsrc (or from a binary
2311: package).</p>
2312:
2313: <p>The Remote Connectivity subcomponent "Windows
2314: Remote Shell Service" does not need to be installed,
2315: but Remote Connectivity itself should be installed in
2316: order to have a working inetd.</p>
2317:
1.52 tv 2318: <p>During installation you may be asked whether to
2319: enable setuid behavior for Interix programs, and
2320: whether to make pathnames default to case-sensitive.
2321: Setuid should be enabled, and case-sensitivity MUST
2322: be enabled. (Without case-sensitivity, a large number
2323: of packages including perl will not build.)</p>
2324:
2325: <p>NOTE: Newer Windows service packs change the way
2326: binary execution works (via the Data Execution
2327: Prevention feature). In order to use pkgsrc and other
2328: gcc-compiled binaries reliably, a hotfix containing
2329: POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
2330: (899522 or newer) must be installed. Hotfixes are
2331: available from Microsoft through a support contract;
2332: however, a NetBSD developer has made most Interix
2333: hotfixes available for personal use from <a href=
2334: "http://www.duh.org/interix/hotfixes.php" target=
2335: "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1 grant 2336: </div>
2337:
1.67 hubertf 2338: <div class="sect3" lang="en">
1.1 grant 2339: <div class="titlepage">
2340: <div>
2341: <div>
2342: <h4 class="title"><a name=
2343: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2344: to do if Interix/SFU is already installed</h4>
2345: </div>
2346: </div>
2347: </div>
2348:
2349: <p>If SFU is already installed and you wish to alter
2350: these settings to work with pkgsrc, note the
2351: following things.</p>
2352:
2353: <div class="itemizedlist">
2354: <ul type="disc">
2355: <li>
2356: <p>To uninstall UNIX Perl, use Add/Remove
2357: Programs, select Microsoft Windows Services for
2358: UNIX, then click Change. In the installer,
2359: choose Add or Remove, then uncheck
2360: Utilities->UNIX Perl.</p>
2361: </li>
2362:
2363: <li>
1.47 reed 2364: <p>To enable case-sensitivity for the file
2365: system, run REGEDIT.EXE, and change the
1.1 grant 2366: following registry key:</p>
2367:
2368: <p>
2369: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2370: Manager\kernel</p>
2371:
2372: <p>Set the DWORD value "obcaseinsensitive" to
2373: 0; then reboot.</p>
2374: </li>
2375:
2376: <li>
2377: <p>To enable setuid binaries (optional), run
2378: REGEDIT.EXE, and change the following registry
2379: key:</p>
2380:
2381: <p>
2382: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2383: for UNIX</p>
2384:
2385: <p>Set the DWORD value "EnableSetuidBinaries"
2386: to 1; then reboot.</p>
2387: </li>
2388: </ul>
2389: </div>
2390: </div>
2391:
1.67 hubertf 2392: <div class="sect3" lang="en">
1.1 grant 2393: <div class="titlepage">
2394: <div>
2395: <div>
2396: <h4 class="title"><a name=
2397: "platform.interix-notes"></a>3.2.3.3. Important
2398: notes for using pkgsrc</h4>
2399: </div>
2400: </div>
2401: </div>
2402:
1.52 tv 2403: <p>The package manager (either the pkgsrc "su" user,
1.1 grant 2404: or the user running "pkg_add") must be a member of
2405: the local Administrators group. Such a user must also
2406: be used to run the bootstrap. This is slightly
2407: relaxed from the normal pkgsrc requirement of
2408: "root".</p>
2409:
2410: <p>The package manager should use a umask of 002.
2411: "make install" will automatically complain if this is
2412: not the case. This ensures that directories written
2413: in /var/db/pkg are Administrators-group
2414: writeable.</p>
2415:
2416: <p>The popular Interix binary packages from
2417: http://www.interopsystems.com/ use an older version
2418: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2419: used in conjunction with pkgsrc. If you choose to use
2420: them at the same time as the pkgsrc packages, ensure
2421: that you use the proper pkg_* tools for each type of
2422: binary package.</p>
1.22 tv 2423:
2424: <p>The TERM setting used for DOS-type console windows
2425: (including those invoked by the csh and ksh startup
2426: shortcuts) is "interix". Most systems don't have a
2427: termcap/terminfo entry for it, but the following
2428: .termcap entry provides adequate emulation in most
2429: cases:</p>
2430: <pre class="programlisting">
1.51 rillig 2431: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22 tv 2432: </pre>
1.1 grant 2433: </div>
1.52 tv 2434:
1.67 hubertf 2435: <div class="sect3" lang="en">
1.52 tv 2436: <div class="titlepage">
2437: <div>
2438: <div>
2439: <h4 class="title"><a name=
2440: "platform.interix-limits"></a>3.2.3.4. Limitations
2441: of the Interix platform</h4>
2442: </div>
2443: </div>
2444: </div>
2445:
2446: <p>Though Interix suffices as a familiar and flexible
2447: substitute for a full Unix-like platform, it has some
2448: drawbacks that should be noted for those desiring to
2449: make the most of Interix.</p>
2450:
2451: <div class="itemizedlist">
2452: <ul type="disc">
2453: <li>
1.54 tv 2454: <p><span class=
1.57 minskim 2455: "strong"><strong>X11:</strong></span></p>
1.52 tv 2456:
2457: <p>Interix comes with the standard set of X11R6
1.57 minskim 2458: client libraries, and can run X11 based
1.52 tv 2459: applications, but it does <span class=
2460: "emphasis"><em>not</em></span> come with an X
2461: server. Some options are <a href=
2462: "http://www.starnet.com/products/xwin32/"
2463: target="_top">StarNet X-Win32</a>, <a href=
2464: "http://connectivity.hummingbird.com/products/nc/exceed/"
1.57 minskim 2465: target="_top">Hummingbird Exceed</a> (available
2466: in a trimmed version for Interix from Interop
2467: Systems as the <a href=
2468: "http://www.interopsystems.com/InteropXserver.htm"
2469: target="_top">Interop X Server</a>), and the
2470: free X11 server included with <a href=
1.52 tv 2471: "http://x.cygwin.com/" target=
2472: "_top">Cygwin</a>.</p>
2473:
2474: <p>Also, StarNet Communications has graciously
2475: provided a free version of their X-Win32
2476: product that accepts connections only from
2477: localhost: <a href=
2478: "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
2479: target="_top">X-Win32 LX</a>, recommended by
2480: the maintainer of Interix pkgsrc support.</p>
2481: </li>
2482:
2483: <li>
1.57 minskim 2484: <p><span class="strong"><strong>X11
1.54 tv 2485: acceleration:</strong></span></p>
1.52 tv 2486:
2487: <p>Because Interix runs in a completely
2488: different NT subsystem from Win32 applications,
2489: it does not currently support various X11
2490: protocol extensions for acceleration (such as
2491: MIT-SHM or DGA). Most interactive applications
2492: to a local X server will run reasonably fast,
2493: but full motion video and other graphics
2494: intensive applications may require a
2495: faster-than-expected CPU.</p>
2496: </li>
2497:
2498: <li>
1.54 tv 2499: <p><span class=
2500: "strong"><strong>Audio:</strong></span></p>
1.52 tv 2501:
2502: <p>Interix has no native support for audio
1.53 tv 2503: output. For audio support, pkgsrc uses the
2504: <span><strong class=
1.52 tv 2505: "command">esound</strong></span> client/server
2506: audio system on Interix. Unlike on most
2507: platforms, the <a xmlns=
2508: "http://www.w3.org/TR/xhtml1/transitional"
2509: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
2510: target="_top"><code xmlns="" class=
2511: "filename">audio/esound</code></a> package does
2512: <span class="emphasis"><em>not</em></span>
2513: contain the <span><strong class=
1.53 tv 2514: "command">esd</strong></span> server component.
2515: To output audio via an Interix host, the
2516: <a xmlns=
1.52 tv 2517: "http://www.w3.org/TR/xhtml1/transitional"
2518: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
2519: target="_top"><code xmlns="" class=
2520: "filename">emulators/cygwin_esound</code></a>
2521: package must also be installed.</p>
2522: </li>
2523:
2524: <li>
1.54 tv 2525: <p><span class="strong"><strong>CD/DVDs, USB,
2526: and SCSI:</strong></span></p>
1.52 tv 2527:
2528: <p>Direct device access is not currently
2529: supported in Interix, so it is not currently
2530: possible to access CD/DVD drives, USB devices,
2531: or SCSI devices through non-filesystem means.
2532: Among other things, this makes it impossible to
2533: use Interix directly for CD/DVD burning.</p>
2534: </li>
2535:
2536: <li>
1.54 tv 2537: <p><span class="strong"><strong>Tape
2538: drives:</strong></span></p>
1.52 tv 2539:
2540: <p>Due to the same limitations as for CD-ROMs
2541: and SCSI devices, tape drives are also not
2542: directly accessible in Interix. However,
2543: support is in work to make tape drive access
2544: possible by using Cygwin as a bridge (similarly
2545: to audio bridged via Cygwin's esound
2546: server).</p>
2547: </li>
2548: </ul>
2549: </div>
2550: </div>
2551:
1.67 hubertf 2552: <div class="sect3" lang="en">
1.52 tv 2553: <div class="titlepage">
2554: <div>
2555: <div>
2556: <h4 class="title"><a name=
2557: "platform.interix-knownissues"></a>3.2.3.5. Known
2558: issues for pkgsrc on Interix</h4>
2559: </div>
2560: </div>
2561: </div>
2562:
2563: <p>It is not necessary, in general, to have a "root"
2564: user on the Windows system; any member of the local
2565: Administrators group will suffice. However, some
2566: packages currently assume that the user named "root"
2567: is the privileged user. To accommodate these, you may
2568: create such a user; make sure it is in the local
2569: group Administrators (or your language
2570: equivalent).</p>
2571:
2572: <p>"pkg_add" creates directories of mode 0755, not
2573: 0775, in $PKG_DBDIR. For the time being, install
2574: packages as the local Administrator (or your language
2575: equivalent), or run the following command after
2576: installing a package to work around the issue:</p>
2577: <pre class="screen">
2578: <code class="prompt">#</code> <strong class=
2579: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
2580: </pre>
2581: </div>
1.1 grant 2582: </div>
2583:
1.67 hubertf 2584: <div class="sect2" lang="en">
1.1 grant 2585: <div class="titlepage">
2586: <div>
2587: <div>
1.67 hubertf 2588: <h3 class="title"><a name=
1.30 wiz 2589: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2590: </div>
2591: </div>
2592: </div>
2593:
2594: <p>You will need a working C compiler, either gcc or
2595: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2596: the <code class="varname">CC</code> environment
2597: variable according to your preference. If you do not
2598: have a license for the MIPSpro compiler suite, you can
1.1 grant 2599: download a gcc tardist file from <a href=
2600: "http://freeware.sgi.com/" target=
2601: "_top">http://freeware.sgi.com/</a>.</p>
2602:
2603: <p>Please note that you will need IRIX 6.5.17 or
2604: higher, as this is the earliest version of IRIX
1.24 wiz 2605: providing support for <a href=
2606: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2607: <span class="citerefentry"><span class=
2608: "refentrytitle">if_indextoname</span>(3)</span></a>,
2609: <a href=
2610: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2611: <span class="citerefentry"><span class=
2612: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2613: etc.</p>
1.1 grant 2614:
1.27 rillig 2615: <p>At this point in time, pkgsrc only supports one ABI
2616: at a time. That is, you can not switch between the old
2617: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2618: you start out using "abi=n32", that's what all your
2619: packages will be built with.</p>
1.1 grant 2620:
2621: <p>Therefore, please make sure that you have no
1.14 xtraeme 2622: conflicting <code class="varname">CFLAGS</code> in your
1.45 wiz 2623: environment or the <code xmlns=
2624: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2625: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2626: that you do not try to link n32 object files with lib64
1.45 wiz 2627: or vice versa. Check your <code xmlns=
2628: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2629: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2630:
2631: <p>If you have the actual pkgsrc tree mounted via NFS
2632: from a different host, please make sure to set
1.14 xtraeme 2633: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2634: directory, as it appears that IRIX linker occasionally
1.47 reed 2635: runs into issues when trying to link over a
2636: network-mounted file system.</p>
1.1 grant 2637:
2638: <p>The bootstrapping process should set all the right
2639: options for programs such as imake(1), but you may want
2640: to set some options depending on your local setup.
1.45 wiz 2641: Please see <code xmlns=
2642: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2643: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2644: course, your compiler's man pages for details.</p>
1.22 tv 2645:
2646: <p>If you are using SGI's MIPSPro compiler, please
2647: set</p>
2648: <pre class="programlisting">
1.51 rillig 2649: PKGSRC_COMPILER= mipspro
1.22 tv 2650: </pre>
2651:
1.45 wiz 2652: <p>in <code xmlns=
2653: "http://www.w3.org/TR/xhtml1/transitional" class=
2654: "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
2655: assume you are using gcc and may end up passing invalid
2656: flags to the compiler. Note that bootstrap should
2657: create an appropriate <code xmlns=
2658: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2659: "filename">mk.conf.example</code> by default.</p>
2660:
2661: <p>If you have both the MIPSPro compiler chain
2662: installed as well as gcc, but want to make sure that
2663: MIPRPro is used, please set your <code class=
2664: "varname">PATH</code> to <span class=
2665: "emphasis"><em>not</em></span> include the location of
1.45 wiz 2666: gcc (often <code xmlns=
2667: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2668: "filename">/usr/freeware/bin</code>), and (important)
2669: pass the '--preserve-path' flag.</p>
1.1 grant 2670: </div>
2671:
1.67 hubertf 2672: <div class="sect2" lang="en">
1.1 grant 2673: <div class="titlepage">
2674: <div>
2675: <div>
1.67 hubertf 2676: <h3 class="title"><a name=
1.30 wiz 2677: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2678: </div>
2679: </div>
2680: </div>
2681:
2682: <p>Some versions of Linux (for example Debian
2683: GNU/Linux) need either libtermcap or libcurses
2684: (libncurses). Installing the distributions
2685: libncurses-dev package (or equivalent) should fix the
2686: problem.</p>
2687:
2688: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2689: and icc (Intel C++ Compiler). gcc is the default. icc
2690: 8.0 and 8.1 on i386 have been tested.</p>
2691:
2692: <p>To bootstrap using icc, assuming the default icc
2693: installation directory:</p>
2694: <pre class="programlisting">
1.51 rillig 2695: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2696: ac_cv___attribute__=yes ./bootstrap
1.22 tv 2697: </pre>
2698:
2699: <div class="note" style=
2700: "margin-left: 0.5in; margin-right: 0.5in;">
2701: <h3 class="title">Note</h3>
2702:
2703: <p>icc 8.1 needs the `-i-static' argument instead of
2704: -static-libcxa.</p>
2705: </div>
2706:
2707: <p>icc supports __attribute__, but the GNU configure
2708: test uses a nested function, which icc does not
2709: support. #undef'ing __attribute__ has the unfortunate
2710: side-effect of breaking many of the Linux header files,
2711: which cannot be compiled properly without
2712: __attribute__. The test must be overridden so that
2713: __attribute__ is assumed supported by the compiler.</p>
2714:
2715: <p>After bootstrapping, you should set <code class=
1.45 wiz 2716: "varname">PKGSRC_COMPILER</code> in <code xmlns=
2717: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2718: "filename">/etc/mk.conf</code>:</p>
2719: <pre class="programlisting">
1.51 rillig 2720: PKGSRC_COMPILER= icc
1.22 tv 2721: </pre>
2722:
2723: <p>The default installation directory for icc is
1.45 wiz 2724: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2725: class="filename">/opt/intel_cc_80</code>, which is also
2726: the pkgsrc default. If you have installed it into a
2727: different directory, set <code class=
2728: "varname">ICCBASE</code> in <code xmlns=
2729: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2730: "filename">/etc/mk.conf</code>:</p>
2731: <pre class="programlisting">
1.51 rillig 2732: ICCBASE= /opt/icc
1.22 tv 2733: </pre>
2734:
2735: <p>pkgsrc uses the static linking method of the runtime
2736: libraries provided by icc, so binaries can be run on
2737: other systems which do not have the shared libraries
2738: installed.</p>
2739:
2740: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2741: the <a href=
2742: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2743: <span class="citerefentry"><span class=
2744: "refentrytitle">ld</span>(1)</span></a> command run
2745: when linking a C++ shared library and records it,
2746: throwing away the -Bstatic and -Bdynamic options
2747: interspersed between the libraries. This means that
2748: libtool-linked C++ shared libraries will have a runtime
2749: dependency on the icc libraries until this is fixed in
2750: libtool.</p>
1.22 tv 2751: </div>
2752:
1.67 hubertf 2753: <div class="sect2" lang="en">
1.22 tv 2754: <div class="titlepage">
2755: <div>
2756: <div>
1.67 hubertf 2757: <h3 class="title"><a name=
1.30 wiz 2758: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2759: </div>
2760: </div>
2761: </div>
2762:
2763: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2764:
2765: <p>Care should be taken so that the tools that this kit
2766: installs do not conflict with the OpenBSD userland
2767: tools. There are several steps:</p>
2768:
2769: <div class="orderedlist">
2770: <ol type="1">
2771: <li>
2772: <p>OpenBSD stores its ports pkg database in
1.45 wiz 2773: <code xmlns=
2774: "http://www.w3.org/TR/xhtml1/transitional" class=
2775: "filename">/var/db/pkg</code>. It is therefore
2776: recommended that you choose a different location
2777: (e.g. <code xmlns=
2778: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2779: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2780: --pkgdbdir option to the bootstrap script.</p>
2781: </li>
2782:
2783: <li>
2784: <p>If you do not intend to use the OpenBSD ports
2785: tools, it's probably a good idea to move them out
2786: of the way to avoid confusion, e.g.</p>
2787: <pre class="screen">
1.14 xtraeme 2788: <code class="prompt">#</code> <strong class=
2789: "userinput"><code>cd /usr/sbin</code></strong>
2790: <code class="prompt">#</code> <strong class=
2791: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2792: <code class="prompt">#</code> <strong class=
2793: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2794: <code class="prompt">#</code> <strong class=
2795: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2796: <code class="prompt">#</code> <strong class=
2797: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2798: </pre>
2799: </li>
2800:
2801: <li>
1.45 wiz 2802: <p>An example <code xmlns=
2803: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2804: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2805: placed in <code xmlns=
2806: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2807: "filename">/etc/mk.conf.example</code> file when
2808: you use the bootstrap script. OpenBSD's make
1.45 wiz 2809: program uses <code xmlns=
2810: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2811: "filename">/etc/mk.conf</code> as well. You can
1.47 reed 2812: work around this by enclosing all the
2813: pkgsrc-specific parts of the file with:</p>
1.1 grant 2814: <pre class="programlisting">
1.51 rillig 2815: .ifdef BSD_PKG_MK
2816: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
2817: .else
2818: # OpenBSD stuff
2819: .endif
1.1 grant 2820: </pre>
2821: </li>
2822: </ol>
2823: </div>
2824: </div>
2825:
1.67 hubertf 2826: <div class="sect2" lang="en">
1.1 grant 2827: <div class="titlepage">
2828: <div>
2829: <div>
1.67 hubertf 2830: <h3 class="title"><a name=
1.30 wiz 2831: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2832: </div>
2833: </div>
2834: </div>
2835:
2836: <p>Solaris 2.6 through 9 are supported on both x86 and
2837: sparc. You will need a working C compiler. Both gcc
2838: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2839:
2840: <p>The following packages are required on Solaris 8 for
2841: the bootstrap process and to build packages.</p>
2842:
2843: <div class="itemizedlist">
2844: <ul type="disc">
2845: <li>
2846: <p>SUNWsprot</p>
2847: </li>
2848:
2849: <li>
2850: <p>SUNWarc</p>
2851: </li>
2852:
2853: <li>
2854: <p>SUNWbtool</p>
2855: </li>
2856:
2857: <li>
2858: <p>SUNWtoo</p>
2859: </li>
2860:
2861: <li>
2862: <p>SUNWlibm</p>
2863: </li>
2864: </ul>
2865: </div>
2866:
2867: <p>Please note the use of GNU binutils on Solaris is
2868: <span class="emphasis"><em>not</em></span>
2869: supported.</p>
2870:
1.67 hubertf 2871: <div class="sect3" lang="en">
1.1 grant 2872: <div class="titlepage">
2873: <div>
2874: <div>
1.67 hubertf 2875: <h4 class="title"><a name=
2876: "solaris-gcc-note"></a>3.2.7.1. If you are
2877: using gcc</h4>
1.1 grant 2878: </div>
2879: </div>
2880: </div>
2881:
2882: <p>It makes life much simpler if you only use the
2883: same gcc consistently for building all packages.</p>
2884:
2885: <p>It is recommended that an external gcc be used
2886: only for bootstrapping, then either build gcc from
2887: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2888: href=
2889: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45 wiz 2890: target="_top"><code xmlns="" class=
2891: "filename">lang/gcc</code></a> or install a binary
2892: gcc package, then remove gcc used during
1.20 ben 2893: bootstrapping.</p>
1.1 grant 2894:
2895: <p>Binary packages of gcc can be found through
2896: <a href=
2897: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2898: target=
2899: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2900: </div>
2901:
1.67 hubertf 2902: <div class="sect3" lang="en">
1.1 grant 2903: <div class="titlepage">
2904: <div>
2905: <div>
1.30 wiz 2906: <h4 class="title"><a name=
2907: "solaris-sun-workshop-note"></a>3.2.7.2. If
2908: you are using Sun WorkShop</h4>
1.1 grant 2909: </div>
2910: </div>
2911: </div>
2912:
2913: <p>You will need at least the following packages
2914: installed (from WorkShop 5.0)</p>
2915:
2916: <div class="itemizedlist">
2917: <ul type="disc">
2918: <li>
2919: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2920: </li>
2921:
2922: <li>
2923: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2924: </li>
2925:
2926: <li>
2927: <p>SPROild - Sun WorkShop Incremental
2928: Linker</p>
2929: </li>
2930:
2931: <li>
2932: <p>SPROlang - Sun WorkShop Compilers common
2933: components</p>
2934: </li>
2935: </ul>
2936: </div>
2937:
1.14 xtraeme 2938: <p>You should set <code class="varname">CC</code>,
2939: <code class="varname">CXX</code> and optionally,
1.45 wiz 2940: <code class="varname">CPP</code> in <code xmlns=
2941: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2942: "filename">/etc/mk.conf</code>, e.g.:</p>
1.1 grant 2943: <pre class="programlisting">
1.51 rillig 2944: CC= cc
2945: CXX= CC
2946: CPP= /usr/ccs/lib/cpp
1.1 grant 2947: </pre>
2948:
2949: <p>You may also want to build 64-bit binaries,
1.47 reed 2950: e.g.:</p>
1.1 grant 2951: <pre class="programlisting">
1.51 rillig 2952: CFLAGS= -xtarget=ultra -xarch=v9
1.1 grant 2953: </pre>
2954:
2955: <p>Whichever compiler you use, please ensure the
2956: compiler tools and your $prefix are in your
1.14 xtraeme 2957: <code class="varname">PATH</code>. This includes
1.45 wiz 2958: <code xmlns=
2959: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2960: "filename">/usr/ccs/{bin,lib}</code> and e.g.
1.45 wiz 2961: <code xmlns=
2962: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2963: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2964: </div>
1.68 ! rillig 2965:
! 2966: <div class="sect3" lang="en">
! 2967: <div class="titlepage">
! 2968: <div>
! 2969: <div>
! 2970: <h4 class="title"><a name=
! 2971: "plat.sunos.problems"></a>3.2.7.3. Common
! 2972: problems</h4>
! 2973: </div>
! 2974: </div>
! 2975: </div>
! 2976:
! 2977: <p>Sometimes, when using <span><strong class=
! 2978: "command">libtool</strong></span>, <code xmlns=
! 2979: "http://www.w3.org/TR/xhtml1/transitional" class=
! 2980: "filename">/bin/ksh</code> crashes with a
! 2981: segmentation fault. The workaround is to use another
! 2982: shell for the configure scripts, for example by
! 2983: installing <a xmlns=
! 2984: "http://www.w3.org/TR/xhtml1/transitional" href=
! 2985: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/bash/README.html"
! 2986: target="_top"><code xmlns="" class=
! 2987: "filename">shells/bash</code></a> and adding the
! 2988: following line to your <code xmlns=
! 2989: "http://www.w3.org/TR/xhtml1/transitional" class=
! 2990: "filename">mk.conf</code>:</p>
! 2991: <pre class="programlisting">
! 2992: CONFIG_SHELL= ${LOCALBASE}/bin/bash
! 2993: </pre>
! 2994: </div>
1.1 grant 2995: </div>
2996: </div>
2997: </div>
2998:
1.67 hubertf 2999: <div class="chapter" lang="en">
1.1 grant 3000: <div class="titlepage">
3001: <div>
3002: <div>
1.67 hubertf 3003: <h2 class="title"><a name=
1.1 grant 3004: "using"></a>Chapter 4. Using pkgsrc</h2>
3005: </div>
3006: </div>
3007: </div>
3008:
3009: <div class="toc">
3010: <p><b>Table of Contents</b></p>
3011:
3012: <dl>
3013: <dt><span class="sect1"><a href="#getting-started">4.1.
3014: Working with binary packages</a></span></dt>
3015:
3016: <dd>
3017: <dl>
1.30 wiz 3018: <dt><span class="sect2"><a href=
3019: "#where-to-get-binary-packages">4.1.1. Where to get
3020: binary packages</a></span></dt>
1.1 grant 3021:
1.30 wiz 3022: <dt><span class="sect2"><a href=
3023: "#how-to-use-binary-packages">4.1.2. How to use
3024: binary packages</a></span></dt>
1.1 grant 3025:
1.30 wiz 3026: <dt><span class="sect2"><a href=
3027: "#a-word-of-warning">4.1.3. A word of
3028: warning</a></span></dt>
1.1 grant 3029: </dl>
3030: </dd>
3031:
1.30 wiz 3032: <dt><span class="sect1"><a href=
3033: "#building-packages-from-source">4.2. Building packages
3034: from source</a></span></dt>
1.1 grant 3035:
3036: <dd>
3037: <dl>
1.30 wiz 3038: <dt><span class="sect2"><a href=
3039: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 3040:
1.30 wiz 3041: <dt><span class="sect2"><a href=
3042: "#fetching-distfiles">4.2.2. Fetching
3043: distfiles</a></span></dt>
1.1 grant 3044:
1.30 wiz 3045: <dt><span class="sect2"><a href=
3046: "#how-to-build-and-install">4.2.3. How to build and
3047: install</a></span></dt>
1.1 grant 3048:
1.30 wiz 3049: <dt><span class="sect2"><a href=
3050: "#selecting-the-compiler">4.2.4. Selecting the
3051: compiler</a></span></dt>
1.1 grant 3052: </dl>
3053: </dd>
3054: </dl>
3055: </div>
3056:
1.67 hubertf 3057: <div class="sect1" lang="en">
1.1 grant 3058: <div class="titlepage">
3059: <div>
3060: <div>
3061: <h2 class="title" style="clear: both"><a name=
3062: "getting-started"></a>4.1. Working with binary
3063: packages</h2>
3064: </div>
3065: </div>
3066: </div>
3067:
3068: <p>This section describes how to find, retrieve and
3069: install a precompiled binary package that someone else
3070: already prepared for your type of machine.</p>
3071:
1.67 hubertf 3072: <div class="sect2" lang="en">
1.1 grant 3073: <div class="titlepage">
3074: <div>
3075: <div>
1.30 wiz 3076: <h3 class="title"><a name=
3077: "where-to-get-binary-packages"></a>4.1.1. Where
3078: to get binary packages</h3>
1.1 grant 3079: </div>
3080: </div>
3081: </div>
3082:
3083: <p>Precompiled packages are stored on ftp.NetBSD.org
1.45 wiz 3084: and its mirrors in the directory <code xmlns=
3085: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 3086: "filename">/pub/NetBSD/packages/<OSVERSION>/<ARCH>/</code>
3087: for anonymous FTP access. <code class=
3088: "varname">OSVERSION</code> is the NetBSD version
3089: (<span><strong class="command">uname
3090: -r</strong></span>), <code class="varname">ARCH</code>
3091: is the architecture (<span><strong class=
3092: "command">uname -p</strong></span>). In that directory,
3093: there is a subdirectory for each category plus a
1.45 wiz 3094: subdirectory <code xmlns=
3095: "http://www.w3.org/TR/xhtml1/transitional" class=
3096: "filename">All</code> which includes the actual
3097: binaries in <code xmlns=
3098: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 3099: "filename">.tgz</code> files. The category
3100: subdirectories use symbolic links to those files (this
1.45 wiz 3101: is the same directory layout as in <code xmlns=
3102: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3103: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 3104:
1.47 reed 3105: <p>This same directory layout applies for CD-ROM
1.1 grant 3106: distributions, only that the directory may be rooted
1.45 wiz 3107: somewhere else, probably somewhere below <code xmlns=
3108: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 3109: "filename">/cdrom</code>. Please consult your CD-ROMs
1.1 grant 3110: documentation for the exact location.</p>
3111: </div>
3112:
1.67 hubertf 3113: <div class="sect2" lang="en">
1.1 grant 3114: <div class="titlepage">
3115: <div>
3116: <div>
1.30 wiz 3117: <h3 class="title"><a name=
3118: "how-to-use-binary-packages"></a>4.1.2. How
3119: to use binary packages</h3>
1.1 grant 3120: </div>
3121: </div>
3122: </div>
3123:
1.47 reed 3124: <p>If you have the files on a CD-ROM or downloaded them
1.23 wiz 3125: to your hard disk, you can install them with the
1.27 rillig 3126: following command (be sure to <span><strong class=
1.14 xtraeme 3127: "command">su</strong></span> to root first):</p>
1.1 grant 3128: <pre class="screen">
1.14 xtraeme 3129: <code class="prompt">#</code> <strong class=
3130: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 3131: </pre>
3132:
3133: <p>If you have FTP access and you don't want to
3134: download the packages via FTP prior to installation,
1.14 xtraeme 3135: you can do this automatically by giving
3136: <span><strong class="command">pkg_add</strong></span>
3137: an FTP URL:</p>
1.1 grant 3138: <pre class="screen">
1.14 xtraeme 3139: <code class="prompt">#</code> <strong class=
1.27 rillig 3140: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 3141: </pre>
3142:
1.27 rillig 3143: <p>Note that any prerequisite packages needed to run
3144: the package in question will be installed, too,
1.1 grant 3145: assuming they are present where you install from.</p>
3146:
1.23 wiz 3147: <p>To save some typing, you can set the <code class=
3148: "varname">PKG_PATH</code> environment variable to a
1.47 reed 3149: semicolon-separated list of paths (including remote
1.23 wiz 3150: URLs); trailing slashes are not allowed.</p>
3151:
1.45 wiz 3152: <p>Additionally to the <code xmlns=
3153: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 3154: "filename">All</code> directory there exists a
1.45 wiz 3155: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3156: class="filename">vulnerable</code> directory to which
3157: binary packages with known vulnerabilities are moved,
3158: since removing them could cause missing dependencies.
3159: To use these packages, add the <code xmlns=
3160: "http://www.w3.org/TR/xhtml1/transitional" class=
3161: "filename">vulnerable</code> directory to your
3162: <code class="varname">PKG_PATH</code>. However, you
3163: should run <a xmlns=
1.23 wiz 3164: "http://www.w3.org/TR/xhtml1/transitional" href=
3165: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 3166: target="_top"><code xmlns="" class=
3167: "filename">security/audit-packages</code></a>
1.47 reed 3168: regularly, especially after installing new packages,
3169: and verify that the vulnerabilities are acceptable for
3170: your configuration. An example <code class=
3171: "varname">PKG_PATH</code> would be: <code xmlns=
3172: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 3173: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All;ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/vulnerable</code>
1.23 wiz 3174: Please note that semicolon (';') is a shell
3175: meta-character, so you'll probably have to quote
3176: it.</p>
3177:
1.1 grant 3178: <p>After you've installed packages, be sure to have
1.45 wiz 3179: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3180: class="filename">/usr/pkg/bin</code> and <code xmlns=
3181: "http://www.w3.org/TR/xhtml1/transitional" class=
3182: "filename">/usr/pkg/sbin</code> in your <code class=
3183: "varname">PATH</code> so you can actually start the
3184: just installed program.</p>
1.1 grant 3185: </div>
3186:
1.67 hubertf 3187: <div class="sect2" lang="en">
1.1 grant 3188: <div class="titlepage">
3189: <div>
3190: <div>
1.67 hubertf 3191: <h3 class="title"><a name=
1.30 wiz 3192: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 3193: warning</h3>
3194: </div>
3195: </div>
3196: </div>
3197:
3198: <p>Please pay very careful attention to the warnings
3199: expressed in the <a href=
3200: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3201: <span class="citerefentry"><span class=
3202: "refentrytitle">pkg_add</span>(1)</span></a> manual
3203: page about the inherent dangers of installing binary
3204: packages which you did not create yourself, and the
3205: security holes that can be introduced onto your system
3206: by indiscriminate adding of such files.</p>
1.66 rillig 3207:
3208: <p>The same warning of course applies to every package
3209: you install from source when you haven't completely
3210: read and understood the source code of the package, the
3211: compiler that is used to build the package and all the
3212: other tools that are involved.</p>
1.1 grant 3213: </div>
3214: </div>
3215:
1.67 hubertf 3216: <div class="sect1" lang="en">
1.1 grant 3217: <div class="titlepage">
3218: <div>
3219: <div>
3220: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3221: "building-packages-from-source"></a>4.2. Building
1.1 grant 3222: packages from source</h2>
3223: </div>
3224: </div>
3225: </div>
3226:
3227: <p>This assumes that the package is already in pkgsrc. If
3228: it is not, see <a href="#developers-guide" title=
1.46 gdt 3229: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 3230: “The pkgsrc developer's guide”</a> for
3231: instructions how to create your own packages.</p>
1.1 grant 3232:
1.67 hubertf 3233: <div class="sect2" lang="en">
1.1 grant 3234: <div class="titlepage">
3235: <div>
3236: <div>
1.67 hubertf 3237: <h3 class="title"><a name=
1.30 wiz 3238: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 3239: </div>
3240: </div>
3241: </div>
3242:
3243: <p>To build packages from source on a NetBSD system the
3244: “<span class="quote">comp</span>” and the
3245: “<span class="quote">text</span>”
3246: distribution sets must be installed. If you want to
1.47 reed 3247: build X11-related packages the “<span class=
1.1 grant 3248: "quote">xbase</span>” and “<span class=
3249: "quote">xcomp</span>” distribution sets are
3250: required, too.</p>
3251: </div>
3252:
1.67 hubertf 3253: <div class="sect2" lang="en">
1.1 grant 3254: <div class="titlepage">
3255: <div>
3256: <div>
1.67 hubertf 3257: <h3 class="title"><a name=
3258: "fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 3259: distfiles</h3>
3260: </div>
3261: </div>
3262: </div>
3263:
1.27 rillig 3264: <p>The first step for building a package is downloading
3265: the distfiles (i.e. the unmodified source). If they
3266: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 3267: automatically.</p>
3268:
3269: <p>You can overwrite some of the major distribution
3270: sites to fit to sites that are close to your own. Have
1.45 wiz 3271: a look at <code xmlns=
3272: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3273: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 3274: some examples — in particular, look for the
1.14 xtraeme 3275: <code class="varname">MASTER_SORT</code>, <code class=
3276: "varname">MASTER_SORT_REGEX</code> and <code class=
3277: "varname">INET_COUNTRY</code> definitions. This may
3278: save some of your bandwidth and time.</p>
1.1 grant 3279:
3280: <p>You can change these settings either in your shell's
3281: environment, or, if you want to keep the settings, by
1.45 wiz 3282: editing the <code xmlns=
3283: "http://www.w3.org/TR/xhtml1/transitional" class=
3284: "filename">/etc/mk.conf</code> file, and adding the
3285: definitions there.</p>
1.1 grant 3286:
3287: <p>If you don't have a permanent Internet connection
3288: and you want to know which files to download,
1.14 xtraeme 3289: <span><strong class="command">make
3290: fetch-list</strong></span> will tell you what you'll
1.45 wiz 3291: need. Put these distfiles into <code xmlns=
3292: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3293: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 3294: </div>
3295:
1.67 hubertf 3296: <div class="sect2" lang="en">
1.1 grant 3297: <div class="titlepage">
3298: <div>
3299: <div>
1.30 wiz 3300: <h3 class="title"><a name=
3301: "how-to-build-and-install"></a>4.2.3. How to
3302: build and install</h3>
1.1 grant 3303: </div>
3304: </div>
3305: </div>
3306:
3307: <p>Assuming that the distfile has been fetched (see
3308: previous section), become root and change into the
1.47 reed 3309: relevant directory and run <span><strong class=
3310: "command">make</strong></span>.</p>
3311:
3312: <div class="note" style=
3313: "margin-left: 0.5in; margin-right: 0.5in;">
3314: <h3 class="title">Note</h3>
3315:
3316: <p>If using bootstrap or pkgsrc on a non-NetBSD
3317: system, use the pkgsrc <span><strong class=
3318: "command">bmake</strong></span> command instead of
3319: “<span class="quote">make</span>” in the
3320: examples in this guide.</p>
3321: </div>
3322:
3323: <p>For example, type</p>
1.1 grant 3324: <pre class="screen">
1.14 xtraeme 3325: <code class="prompt">%</code> <strong class=
3326: "userinput"><code>cd misc/figlet</code></strong>
3327: <code class="prompt">%</code> <strong class=
3328: "userinput"><code>make</code></strong>
1.1 grant 3329: </pre>
3330:
3331: <p>at the shell prompt to build the various components
3332: of the package, and</p>
3333: <pre class="screen">
1.14 xtraeme 3334: <code class="prompt">#</code> <strong class=
3335: "userinput"><code>make install</code></strong>
1.1 grant 3336: </pre>
3337:
3338: <p>to install the various components into the correct
3339: places on your system. Installing the package on your
3340: system requires you to be root. However, pkgsrc has a
3341: <span class="emphasis"><em>just-in-time-su</em></span>
3342: feature, which allows you to only become root for the
3343: actual installation step</p>
3344:
3345: <p>Taking the figlet utility as an example, we can
3346: install it on our system by building as shown in
3347: <a href="#logs" title=
1.67 hubertf 3348: "Appendix B. Build logs">Appendix B,
3349: <i>Build logs</i></a>.</p>
1.1 grant 3350:
3351: <p>The program is installed under the default root of
1.45 wiz 3352: the packages tree - <code xmlns=
3353: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3354: "filename">/usr/pkg</code>. Should this not conform to
3355: your tastes, set the <code class=
3356: "varname">LOCALBASE</code> variable in your
1.1 grant 3357: environment, and it will use that value as the root of
1.45 wiz 3358: your packages tree. So, to use <code xmlns=
3359: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3360: "filename">/usr/local</code>, set <code class=
3361: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 3362: environment. Please note that you should use a
3363: directory which is dedicated to packages and not shared
1.47 reed 3364: with other programs (i.e., do not try and use
1.14 xtraeme 3365: <code class="varname">LOCALBASE=/usr</code>). Also, you
3366: should not try to add any of your own files or
1.45 wiz 3367: directories (such as <code xmlns=
3368: "http://www.w3.org/TR/xhtml1/transitional" class=
3369: "filename">src/</code>, <code xmlns=
3370: "http://www.w3.org/TR/xhtml1/transitional" class=
3371: "filename">obj/</code>, or <code xmlns=
3372: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3373: "filename">pkgsrc/</code>) below the <code class=
3374: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 3375: possible conflicts between programs and other files
3376: installed by the package system and whatever else may
3377: have been installed there.</p>
3378:
1.45 wiz 3379: <p>Some packages look in <code xmlns=
3380: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3381: "filename">/etc/mk.conf</code> to alter some
1.1 grant 3382: configuration options at build time. Have a look at
1.45 wiz 3383: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3384: class="filename">pkgsrc/mk/defaults/mk.conf</code> to
3385: get an overview of what will be set there by default.
1.14 xtraeme 3386: Environment variables such as <code class=
1.45 wiz 3387: "varname">LOCALBASE</code> can be set in <code xmlns=
3388: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3389: "filename">/etc/mk.conf</code> to save having to
3390: remember to set them each time you want to use
3391: pkgsrc.</p>
1.1 grant 3392:
3393: <p>Occasionally, people want to “<span class=
3394: "quote">look under the covers</span>” to see what
3395: is going on when a package is building or being
3396: installed. This may be for debugging purposes, or out
3397: of simple curiosity. A number of utility values have
3398: been added to help with this.</p>
3399:
3400: <div class="orderedlist">
3401: <ol type="1">
3402: <li>
3403: <p>If you invoke the <a href=
3404: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3405: <span class="citerefentry"><span class=
3406: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 3407: with <code class=
3408: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
3409: amount of information will be displayed. For
3410: example,</p>
1.1 grant 3411: <pre class="screen">
1.14 xtraeme 3412: <strong class=
3413: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 3414: </pre>
3415:
3416: <p>will show all the commands that are invoked,
3417: up to and including the “<span class=
3418: "quote">patch</span>” stage.</p>
3419: </li>
3420:
3421: <li>
3422: <p>If you want to know the value of a certain
1.22 tv 3423: <a href=
3424: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3425: <span class="citerefentry"><span class=
3426: "refentrytitle">make</span>(1)</span></a>
3427: definition, then the <code class=
1.14 xtraeme 3428: "varname">VARNAME</code> definition should be
3429: used, in conjunction with the show-var target.
3430: e.g. to show the expansion of the <a href=
1.1 grant 3431: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3432: <span class="citerefentry"><span class=
3433: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 3434: variable <code class=
1.22 tv 3435: "varname">LOCALBASE</code>:</p>
1.1 grant 3436: <pre class="screen">
1.14 xtraeme 3437: <code class="prompt">%</code> <strong class=
3438: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 3439: /usr/pkg
1.14 xtraeme 3440: <code class="prompt">%</code>
1.1 grant 3441:
3442: </pre>
3443: </li>
3444: </ol>
3445: </div>
3446:
3447: <p>If you want to install a binary package that you've
3448: either created yourself (see next section), that you
3449: put into pkgsrc/packages manually or that is located on
1.8 wiz 3450: a remote FTP server, you can use the "bin-install"
1.1 grant 3451: target. This target will install a binary package - if
3452: available - via <a href=
3453: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3454: <span class="citerefentry"><span class=
3455: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 3456: <span><strong class="command">make
3457: package</strong></span>. The list of remote FTP sites
3458: searched is kept in the variable <code class=
3459: "varname">BINPKG_SITES</code>, which defaults to
3460: ftp.NetBSD.org. Any flags that should be added to
3461: <a href=
1.1 grant 3462: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3463: <span class="citerefentry"><span class=
3464: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 3465: into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45 wiz 3466: See <code xmlns=
3467: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3468: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
3469: details.</p>
1.1 grant 3470:
1.47 reed 3471: <p>A final word of warning: If you set up a system that
1.14 xtraeme 3472: has a non-standard setting for <code class=
3473: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 3474: any packages are installed, as you can not use several
3475: directories for the same purpose. Doing so will result
3476: in pkgsrc not being able to properly detect your
3477: installed packages, and fail miserably. Note also that
3478: precompiled binary packages are usually built with the
1.14 xtraeme 3479: default <code class="varname">LOCALBASE</code> of
1.45 wiz 3480: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3481: class="filename">/usr/pkg</code>, and that you should
3482: <span class="emphasis"><em>not</em></span> install any
3483: if you use a non-standard <code class=
1.14 xtraeme 3484: "varname">LOCALBASE</code>.</p>
1.1 grant 3485: </div>
3486:
1.67 hubertf 3487: <div class="sect2" lang="en">
1.1 grant 3488: <div class="titlepage">
3489: <div>
3490: <div>
1.30 wiz 3491: <h3 class="title"><a name=
3492: "selecting-the-compiler"></a>4.2.4. Selecting
3493: the compiler</h3>
1.1 grant 3494: </div>
3495: </div>
3496: </div>
3497:
3498: <p>By default, pkgsrc will use GCC to build packages.
3499: This may be overridden by setting the following
3500: variables in /etc/mk.conf:</p>
3501:
3502: <div class="variablelist">
3503: <dl>
1.14 xtraeme 3504: <dt><span class="term"><code class=
3505: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3506:
3507: <dd>
3508: <p>This is a list of values specifying the chain
3509: of compilers to invoke when building packages.
3510: Valid values are:</p>
3511:
3512: <div class="itemizedlist">
3513: <ul type="disc">
3514: <li>
1.14 xtraeme 3515: <p><code class="varname">distcc</code>:
1.1 grant 3516: distributed C/C++ (chainable)</p>
3517: </li>
3518:
3519: <li>
1.14 xtraeme 3520: <p><code class="varname">ccache</code>:
1.1 grant 3521: compiler cache (chainable)</p>
3522: </li>
3523:
3524: <li>
1.14 xtraeme 3525: <p><code class="varname">gcc</code>: GNU
3526: C/C++ Compiler</p>
1.1 grant 3527: </li>
3528:
3529: <li>
1.14 xtraeme 3530: <p><code class="varname">mipspro</code>:
1.1 grant 3531: Silicon Graphics, Inc. MIPSpro
3532: (n32/n64)</p>
3533: </li>
3534:
3535: <li>
1.14 xtraeme 3536: <p><code class="varname">mipspro</code>:
1.1 grant 3537: Silicon Graphics, Inc. MIPSpro (o32)</p>
3538: </li>
3539:
3540: <li>
1.64 kim 3541: <p><code class="varname">sunpro</code>: Sun
1.1 grant 3542: Microsystems, Inc. WorkShip/Forte/Sun ONE
3543: Studio</p>
3544: </li>
3545: </ul>
3546: </div>
3547:
3548: <p>The default is “<span class=
1.14 xtraeme 3549: "quote"><code class=
3550: "varname">gcc</code></span>”. You can use
3551: <code class="varname">ccache</code> and/or
3552: <code class="varname">distcc</code> with an
3553: appropriate <code class=
3554: "varname">PKGSRC_COMPILER</code> setting, e.g.
3555: “<span class="quote"><code class=
3556: "varname">ccache gcc</code></span>”. This
1.1 grant 3557: variable should always be terminated with a value
3558: for a real compiler.</p>
3559: </dd>
3560:
1.14 xtraeme 3561: <dt><span class="term"><code class=
3562: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3563:
3564: <dd>
3565: <p>This specifies the minimum version of GCC to
3566: use when building packages. If the system GCC
3567: doesn't satisfy this requirement, then pkgsrc
3568: will build and install one of the GCC packages to
3569: use instead.</p>
3570: </dd>
3571: </dl>
3572: </div>
3573: </div>
3574: </div>
3575: </div>
3576:
1.67 hubertf 3577: <div class="chapter" lang="en">
1.1 grant 3578: <div class="titlepage">
3579: <div>
3580: <div>
1.67 hubertf 3581: <h2 class="title"><a name=
1.38 dillo 3582: "configuring"></a>Chapter 5. Configuring
3583: pkgsrc</h2>
3584: </div>
3585: </div>
3586: </div>
3587:
3588: <div class="toc">
3589: <p><b>Table of Contents</b></p>
3590:
3591: <dl>
3592: <dt><span class="sect1"><a href=
1.45 wiz 3593: "#general-configuration">5.1. General
3594: configuration</a></span></dt>
3595:
3596: <dt><span class="sect1"><a href=
3597: "#variables-affecting-build">5.2. Variables affecting
3598: the build process</a></span></dt>
3599:
3600: <dt><span class="sect1"><a href=
3601: "#developer-advanced-settings">5.3. Developer/advanced
3602: settings</a></span></dt>
3603:
3604: <dt><span class="sect1"><a href=
3605: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 3606: Options</a></span></dt>
1.38 dillo 3607: </dl>
3608: </div>
3609:
1.67 hubertf 3610: <div class="sect1" lang="en">
1.38 dillo 3611: <div class="titlepage">
3612: <div>
3613: <div>
3614: <h2 class="title" style="clear: both"><a name=
1.45 wiz 3615: "general-configuration"></a>5.1. General
3616: configuration</h2>
3617: </div>
3618: </div>
3619: </div>
3620:
1.47 reed 3621: <p>In this section, you can find some variables that
3622: apply to all pkgsrc packages. The preferred method of
3623: setting these variables is by setting them in
3624: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3625: class="filename">/etc/mk.conf</code>.</p>
1.45 wiz 3626:
3627: <div class="itemizedlist">
3628: <ul type="disc">
3629: <li>
3630: <p><code class="varname">LOCALBASE</code>: Where
3631: packages will be installed. The default is
3632: <code xmlns=
3633: "http://www.w3.org/TR/xhtml1/transitional" class=
3634: "filename">/usr/pkg</code>. Do not mix binary
3635: packages with different <code class=
3636: "varname">LOCALBASE</code>s!</p>
3637: </li>
3638:
3639: <li>
3640: <p><code class="varname">CROSSBASE</code>: Where
3641: “<span class="quote">cross</span>”
3642: category packages will be installed. The default is
3643: <code xmlns=
3644: "http://www.w3.org/TR/xhtml1/transitional" class=
3645: "filename">${LOCALBASE}/cross</code>.</p>
3646: </li>
3647:
3648: <li>
3649: <p><code class="varname">X11BASE</code>: Where X11
3650: is installed on the system. The default is
3651: <code xmlns=
3652: "http://www.w3.org/TR/xhtml1/transitional" class=
3653: "filename">/usr/X11R6</code>.</p>
3654: </li>
3655:
3656: <li>
3657: <p><code class="varname">DISTDIR</code>: Where to
3658: store the downloaded copies of the original source
3659: distributions used for building pkgsrc packages.
3660: The default is <code xmlns=
3661: "http://www.w3.org/TR/xhtml1/transitional" class=
3662: "filename">${PKGSRCDIR}/distfiles</code>.</p>
3663: </li>
3664:
3665: <li>
3666: <p><code class=
3667: "varname">MASTER_SITE_OVERRIDE</code>: If set,
3668: override the packages' <code class=
3669: "varname">MASTER_SITES</code> with this value.</p>
3670: </li>
3671:
3672: <li>
3673: <p><code class="varname">MASTER_SITE_BACKUP</code>:
3674: Backup location(s) for distribution files and patch
3675: files if not found locally or in <code xmlns=
3676: "http://www.w3.org/TR/xhtml1/transitional" class=
3677: "filename">${MASTER_SITES}</code> or <code xmlns=
3678: "http://www.w3.org/TR/xhtml1/transitional" class=
3679: "filename">${PATCH_SITES}</code> respectively. The
3680: defaults are <code xmlns=
3681: "http://www.w3.org/TR/xhtml1/transitional" class=
3682: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
3683: and <code xmlns=
3684: "http://www.w3.org/TR/xhtml1/transitional" class=
3685: "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
3686: </li>
3687:
3688: <li>
3689: <p><code class="varname">BINPKG_SITES</code>: List
3690: of sites carrying binary pkgs.</p>
3691: </li>
3692: </ul>
3693: </div>
3694: </div>
3695:
1.67 hubertf 3696: <div class="sect1" lang="en">
1.45 wiz 3697: <div class="titlepage">
3698: <div>
3699: <div>
3700: <h2 class="title" style="clear: both"><a name=
3701: "variables-affecting-build"></a>5.2. Variables
3702: affecting the build process</h2>
3703: </div>
3704: </div>
3705: </div>
3706:
3707: <p>XXX</p>
3708:
3709: <div class="itemizedlist">
3710: <ul type="disc">
3711: <li>
3712: <p><code class="varname">PACKAGES</code>: The top
3713: level directory for the binary packages. The
3714: default is <code xmlns=
3715: "http://www.w3.org/TR/xhtml1/transitional" class=
3716: "filename">${PKGSRCDIR}/packages</code>.</p>
3717: </li>
3718:
3719: <li>
3720: <p><code class="varname">WRKOBJDIR</code>: The top
3721: level directory where, if defined, the separate
3722: working directories will get created, and
3723: symbolically linked to from <code xmlns=
3724: "http://www.w3.org/TR/xhtml1/transitional" class=
3725: "filename">${WRKDIR}</code> (see below). This is
3726: useful for building packages on several
3727: architectures, then <code xmlns=
3728: "http://www.w3.org/TR/xhtml1/transitional" class=
3729: "filename">${PKGSRCDIR}</code> can be NFS-mounted
3730: while <code xmlns=
3731: "http://www.w3.org/TR/xhtml1/transitional" class=
3732: "filename">${WRKOBJDIR}</code> is local to every
3733: architecture. (It should be noted that <code class=
3734: "varname">PKGSRCDIR</code> should not be set by the
3735: user — it is an internal definition which
3736: refers to the root of the pkgsrc tree. It is
3737: possible to have many pkgsrc tree instances.)</p>
3738: </li>
3739:
3740: <li>
3741: <p><code class="varname">LOCALPATCHES</code>:
3742: Directory for local patches that aren't part of
3743: pkgsrc. See <a href="#components.patches" title=
3744: "8.3. patches/*">Section 8.3,
3745: “patches/*”</a> for more information.
3746: <em class="replaceable"><code>rel</code></em> and
3747: <em class="replaceable"><code>arch</code></em> are
3748: replaced with OS release (“<span class=
3749: "quote">2.0</span>”, etc.) and architecture
3750: (“<span class="quote">mipsel</span>”,
3751: etc.).</p>
3752: </li>
3753:
3754: <li>
3755: <p><code class="varname">PKGMAKECONF</code>:
3756: Location of the <code xmlns=
3757: "http://www.w3.org/TR/xhtml1/transitional" class=
3758: "filename">mk.conf</code> file used by a package's
3759: BSD-style Makefile. If this is not set,
3760: <code class="varname">MAKECONF</code> is set to
3761: <code xmlns=
3762: "http://www.w3.org/TR/xhtml1/transitional" class=
3763: "filename">/dev/null</code> to avoid picking up
3764: settings used by builds in <code xmlns=
3765: "http://www.w3.org/TR/xhtml1/transitional" class=
3766: "filename">/usr/src</code>.</p>
3767: </li>
3768: </ul>
3769: </div>
3770: </div>
3771:
1.67 hubertf 3772: <div class="sect1" lang="en">
1.45 wiz 3773: <div class="titlepage">
3774: <div>
3775: <div>
3776: <h2 class="title" style="clear: both"><a name=
3777: "developer-advanced-settings"></a>5.3. Developer/advanced
3778: settings</h2>
3779: </div>
3780: </div>
3781: </div>
3782:
3783: <p>XXX</p>
3784:
3785: <div class="itemizedlist">
3786: <ul type="disc">
3787: <li>
3788: <p><code class="varname">PKG_DEVELOPER</code>: Run
3789: some sanity checks that package developers
3790: want:</p>
3791:
3792: <div class="itemizedlist">
3793: <ul type="circle">
3794: <li>
3795: <p>make sure patches apply with zero fuzz</p>
3796: </li>
3797:
3798: <li>
3799: <p>run check-shlibs to see that all binaries
3800: will find their shared libs.</p>
3801: </li>
3802: </ul>
3803: </div>
3804: </li>
3805:
3806: <li>
3807: <p><code class="varname">PKG_DEBUG_LEVEL</code>:
3808: The level of debugging output which is displayed
3809: whilst making and installing the package. The
3810: default value for this is 0, which will not display
3811: the commands as they are executed (normal, default,
3812: quiet operation); the value 1 will display all
3813: shell commands before their invocation, and the
3814: value 2 will display both the shell commands before
3815: their invocation, and their actual execution
3816: progress with <span><strong class="command">set
3817: -x</strong></span> will be displayed.</p>
3818: </li>
1.58 erh 3819:
3820: <li>
3821: <p><code class=
3822: "varname">ALLOW_VULNERABILITIES.<em class=
3823: "replaceable"><code>pkgbase</code></em></code>: A
3824: space separated list of vulnerability IDs that may
3825: be ignored when performing the automated security
3826: checks. These IDs are listed in the
3827: pkg-vulnerabilities file and are displayed by
3828: <span><strong class=
3829: "command">audit-packages</strong></span> when it
3830: finds a vulnerable package.</p>
3831: </li>
3832:
3833: <li>
3834: <p><code class=
3835: "varname">SKIP_AUDIT_PACKAGES</code>: If this is
3836: set to “<span class=
3837: "quote">yes</span>”, the automated security
3838: checks (which use the <a xmlns=
3839: "http://www.w3.org/TR/xhtml1/transitional" href=
3840: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
3841: target="_top"><code xmlns="" class=
3842: "filename">security/audit-packages</code></a>
3843: package) will be <span class=
3844: "strong"><strong>entirely</strong></span> skipped
3845: for <span class=
3846: "strong"><strong>all</strong></span> packages
3847: built. Normally you'll want to use
3848: ALLOW_VULNERABILITIES instead of this.</p>
3849: </li>
1.45 wiz 3850: </ul>
3851: </div>
3852: </div>
3853:
1.67 hubertf 3854: <div class="sect1" lang="en">
1.45 wiz 3855: <div class="titlepage">
3856: <div>
3857: <div>
3858: <h2 class="title" style="clear: both"><a name=
3859: "selecting-build-options"></a>5.4. Selecting
3860: Build Options</h2>
1.38 dillo 3861: </div>
3862: </div>
3863: </div>
3864:
3865: <p>Some packages have build time options, usually to
3866: select between different dependencies, enable optional
3867: support for big dependencies or enable experimental
3868: features.</p>
3869:
3870: <p>To see which options, if any, a package supports, and
3871: which options are mutually exclusive, run
3872: <span><strong class="command">make
3873: show-options</strong></span>, for example:</p>
3874: <pre class="programlisting">
1.51 rillig 3875: The following options are supported by this package:
3876: ssl Enable SSL support.
3877: Exactly one of the following gecko options is required:
3878: firefox Use firefox as gecko rendering engine.
3879: mozilla Use mozilla as gecko rendering engine.
3880: At most one of the following database options may be selected:
3881: mysql Enable support for MySQL database.
3882: pgsql Enable support for PostgreSQL database.
3883:
3884: These options are enabled by default: firefox
3885: These options are currently enabled: mozilla ssl
1.38 dillo 3886: </pre>
3887:
1.45 wiz 3888: <p>The following variables can be defined in <code xmlns=
3889: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3890: "filename">/etc/mk.conf</code> to select which options to
3891: enable for a package: <code class=
3892: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
3893: to select or disable options for all packages that
3894: support them, and <code class=
3895: "varname">PKG_OPTIONS.<em class=
3896: "replaceable"><code>pkgbase</code></em></code>, which can
3897: be used to select or disable options specifically for
3898: package <em class=
3899: "replaceable"><code>pkgbase</code></em>. Options listed
3900: in these variables are selected, options preceded by
1.67 hubertf 3901: “<span class="quote">-</span>” are disabled.
3902: A few examples:</p>
3903: <pre class="screen">
3904: <code class="prompt">$</code> <span><strong class=
3905: "command">grep "PKG.*OPTION" /etc/mk.conf</strong></span>
1.68 ! rillig 3906: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1.67 hubertf 3907: PKG_OPTIONS.kdebase= debug -sasl
3908: PKG_OPTIONS.apache= suexec
3909: </pre>
1.38 dillo 3910:
1.39 dillo 3911: <p>The following settings are consulted in the order
3912: given, and the last setting that selects or disables an
3913: option is used:</p>
1.38 dillo 3914:
3915: <div class="orderedlist">
3916: <ol type="1">
3917: <li>
3918: <p>the default options as suggested by the package
3919: maintainer</p>
3920: </li>
3921:
3922: <li>
3923: <p>the options implied by the settings of legacy
3924: variables (see below)</p>
3925: </li>
3926:
3927: <li>
3928: <p><code class=
3929: "varname">PKG_DEFAULT_OPTIONS</code></p>
3930: </li>
3931:
3932: <li>
3933: <p><code class="varname">PKG_OPTIONS.<em class=
3934: "replaceable"><code>pkgbase</code></em></code></p>
3935: </li>
3936: </ol>
3937: </div>
3938:
3939: <p>For groups of mutually exclusive options, the last
3940: option selected is used, all others are automatically
3941: disabled. If an option of the group is explicitly
3942: disabled, the previously selected option, if any, is
3943: used. It is an error if no option from a required group
3944: of options is selected, and building the package will
3945: fail.</p>
3946:
3947: <p>Before the options framework was introduced, build
1.65 hubertf 3948: options were selected by setting a variable (often named
3949: <code class="varname">USE_<em class=
3950: "replaceable"><code>FOO</code></em></code>) in
1.45 wiz 3951: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3952: class="filename">/etc/mk.conf</code> for each option. To
3953: ease transition to the options framework for the user,
3954: these legacy variables are converted to the appropriate
1.65 hubertf 3955: options setting (<code class=
3956: "varname">PKG_OPTIONS.<em class=
3957: "replaceable"><code>pkgbase</code></em></code>)
3958: automatically. A warning is issued to prompt the user to
3959: update <code xmlns=
1.45 wiz 3960: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3961: "filename">/etc/mk.conf</code> to use the options
1.65 hubertf 3962: framework directly. Support for the legacy variables will
3963: be removed eventually.</p>
1.38 dillo 3964: </div>
3965: </div>
3966:
1.67 hubertf 3967: <div class="chapter" lang="en">
1.38 dillo 3968: <div class="titlepage">
3969: <div>
3970: <div>
1.67 hubertf 3971: <h2 class="title"><a name=
1.38 dillo 3972: "binary"></a>Chapter 6. Creating binary
1.1 grant 3973: packages</h2>
3974: </div>
3975: </div>
3976: </div>
3977:
3978: <div class="toc">
3979: <p><b>Table of Contents</b></p>
3980:
3981: <dl>
1.30 wiz 3982: <dt><span class="sect1"><a href=
1.38 dillo 3983: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 3984: single binary package</a></span></dt>
1.1 grant 3985:
1.30 wiz 3986: <dt><span class="sect1"><a href=
1.38 dillo 3987: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 3988: Settings for creation of binary
3989: packages</a></span></dt>
3990:
1.38 dillo 3991: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 3992: a bulk build of all packages</a></span></dt>
3993:
3994: <dd>
3995: <dl>
3996: <dt><span class="sect2"><a href=
1.38 dillo 3997: "#binary.configuration">6.3.1.
1.1 grant 3998: Configuration</a></span></dt>
3999:
1.30 wiz 4000: <dt><span class="sect2"><a href=
1.38 dillo 4001: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 4002: environmental considerations</a></span></dt>
1.1 grant 4003:
1.38 dillo 4004: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 4005: Operation</a></span></dt>
4006:
1.30 wiz 4007: <dt><span class="sect2"><a href=
1.38 dillo 4008: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 4009:
1.30 wiz 4010: <dt><span class="sect2"><a href=
1.38 dillo 4011: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 4012: requirements</a></span></dt>
1.1 grant 4013:
1.30 wiz 4014: <dt><span class="sect2"><a href=
1.38 dillo 4015: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47 reed 4016: for chrooted builds</a></span></dt>
1.1 grant 4017:
1.30 wiz 4018: <dt><span class="sect2"><a href=
1.38 dillo 4019: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 4020: set of packages</a></span></dt>
1.13 hubertf 4021:
4022: <dt><span class="sect2"><a href=
1.38 dillo 4023: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 4024: build</a></span></dt>
1.1 grant 4025: </dl>
4026: </dd>
4027:
1.38 dillo 4028: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 4029: Creating a multiple CD-ROM packages
4030: collection</a></span></dt>
4031:
4032: <dd>
4033: <dl>
1.30 wiz 4034: <dt><span class="sect2"><a href=
1.38 dillo 4035: "#cdpack-example">6.4.1. Example of
1.30 wiz 4036: cdpack</a></span></dt>
1.1 grant 4037: </dl>
4038: </dd>
4039: </dl>
4040: </div>
4041:
1.67 hubertf 4042: <div class="sect1" lang="en">
1.1 grant 4043: <div class="titlepage">
4044: <div>
4045: <div>
4046: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4047: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 4048: a single binary package</h2>
1.1 grant 4049: </div>
4050: </div>
4051: </div>
4052:
4053: <p>Once you have built and installed a package, you can
4054: create a <span class="emphasis"><em>binary
4055: package</em></span> which can be installed on another
4056: system with <a href=
4057: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4058: <span class="citerefentry"><span class=
1.47 reed 4059: "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1 grant 4060: having to build the same package on a group of hosts and
4061: wasting CPU time. It also provides a simple means for
4062: others to install your package, should you distribute
4063: it.</p>
4064:
4065: <p>To create a binary package, change into the
1.14 xtraeme 4066: appropriate directory in pkgsrc, and run
4067: <span><strong class="command">make
4068: package</strong></span>:</p>
1.1 grant 4069: <pre class="screen">
1.14 xtraeme 4070: <code class="prompt">#</code> <strong class=
4071: "userinput"><code>cd misc/figlet</code></strong>
4072: <code class="prompt">#</code> <strong class=
4073: "userinput"><code>make package</code></strong>
1.1 grant 4074: </pre>
4075:
4076: <p>This will build and install your package (if not
4077: already done), and then build a binary package from what
1.14 xtraeme 4078: was installed. You can then use the <span><strong class=
4079: "command">pkg_*</strong></span> tools to manipulate it.
1.45 wiz 4080: Binary packages are created by default in <code xmlns=
4081: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4082: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 4083: gzipped tar file. See <a href="#logs.package" title=
1.67 hubertf 4084: "B.2. Packaging figlet">Section B.2,
1.1 grant 4085: “Packaging figlet”</a> for a continuation of
4086: the above <a xmlns=
4087: "http://www.w3.org/TR/xhtml1/transitional" href=
4088: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45 wiz 4089: target="_top"><code xmlns="" class=
4090: "filename">misc/figlet</code></a> example.</p>
1.1 grant 4091:
4092: <p>See <a href="#submit" title=
1.68 ! rillig 4093: "Chapter 18. Submitting and Committing">Chapter 18,
1.67 hubertf 4094: <i>Submitting and Committing</i></a> for information on
4095: how to submit such a binary package.</p>
1.1 grant 4096: </div>
4097:
1.67 hubertf 4098: <div class="sect1" lang="en">
1.1 grant 4099: <div class="titlepage">
4100: <div>
4101: <div>
4102: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4103: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 4104: for creation of binary packages</h2>
4105: </div>
4106: </div>
4107: </div>
4108:
4109: <p>See <a href="#build.helpful-targets" title=
1.56 rillig 4110: "14.16. Other helpful targets">Section 14.16,
1.1 grant 4111: “Other helpful targets”</a>.</p>
4112: </div>
4113:
1.67 hubertf 4114: <div class="sect1" lang="en">
1.1 grant 4115: <div class="titlepage">
4116: <div>
4117: <div>
4118: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 4119: "bulkbuild"></a>6.3. Doing a bulk build of all
4120: packages</h2>
1.1 grant 4121: </div>
4122: </div>
4123: </div>
4124:
4125: <p>If you want to get a full set of precompiled binary
4126: packages, this section describes how to get them. Beware
4127: that the bulk build will remove all currently installed
1.63 dillo 4128: packages from your system!</p>
4129:
4130: <p>Having an FTP server configured either on the machine
4131: doing the bulk builds or on a nearby NFS server can help
4132: to make the packages available to other machines that can
4133: then save time by installing only the binary packages.
4134: See <a href=
1.1 grant 4135: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
4136: <span class="citerefentry"><span class=
4137: "refentrytitle">ftpd</span>(8)</span></a> for more
4138: information. If you use a remote NFS server's storage, be
4139: sure to not actually compile on NFS storage, as this
4140: slows things down a lot.</p>
4141:
1.67 hubertf 4142: <div class="sect2" lang="en">
1.1 grant 4143: <div class="titlepage">
4144: <div>
4145: <div>
1.67 hubertf 4146: <h3 class="title"><a name=
1.38 dillo 4147: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 4148: </div>
4149: </div>
4150: </div>
4151:
1.67 hubertf 4152: <div class="sect3" lang="en">
1.1 grant 4153: <div class="titlepage">
4154: <div>
4155: <div>
1.63 dillo 4156: <h4 class="title"><a name=
4157: "binary.bulk.build.conf"></a>6.3.1.1. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4158: class="filename">build.conf</code></h4>
4159: </div>
4160: </div>
4161: </div>
4162:
4163: <p>The <code xmlns=
4164: "http://www.w3.org/TR/xhtml1/transitional" class=
4165: "filename">build.conf</code> file is the main
4166: configuration file for bulk builds. You can configure
4167: how your copy of pkgsrc is kept up to date, how the
4168: distfiles are downloaded, how the packages are built
4169: and how the report is generated. You can find an
4170: annotated example file in <code xmlns=
4171: "http://www.w3.org/TR/xhtml1/transitional" class=
4172: "filename">pkgsrc/mk/bulk/build.conf-example</code>.
4173: To use it, copy <code xmlns=
4174: "http://www.w3.org/TR/xhtml1/transitional" class=
4175: "filename">build.conf-example</code> to <code xmlns=
4176: "http://www.w3.org/TR/xhtml1/transitional" class=
4177: "filename">build.conf</code> and edit it, following
4178: the comments in that file.</p>
4179: </div>
4180:
1.67 hubertf 4181: <div class="sect3" lang="en">
1.63 dillo 4182: <div class="titlepage">
4183: <div>
4184: <div>
1.67 hubertf 4185: <h4 class="title"><a name=
1.63 dillo 4186: "binary.mk.conf"></a>6.3.1.2. /etc/mk.conf</h4>
1.1 grant 4187: </div>
4188: </div>
4189: </div>
4190:
1.45 wiz 4191: <p>You may want to set variables in <code xmlns=
4192: "http://www.w3.org/TR/xhtml1/transitional" class=
4193: "filename">/etc/mk.conf</code>. Look at <code xmlns=
4194: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4195: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 4196: details of the default settings. You will want to
1.14 xtraeme 4197: ensure that <code class=
4198: "varname">ACCEPTABLE_LICENSES</code> meet your local
4199: policy. As used in this example, <code class=
4200: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 4201: "emphasis"><em>all</em></span> licenses.</p>
4202: <pre class="programlisting">
1.51 rillig 4203: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
4204: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
4205: BSDSRCDIR= /usr/src
4206: BSDXSRCDIR= /usr/xsrc # for x11/xservers
4207: OBJHOSTNAME?= yes # use work.`hostname`
4208: FAILOVER_FETCH= yes # insist on the correct checksum
4209: PKG_DEVELOPER?= yes
4210: _ACCEPTABLE= yes
1.1 grant 4211: </pre>
4212:
1.63 dillo 4213: <p>Some options that are especially useful for bulk
4214: builds can be found at the top lines of the file
4215: <code xmlns=
4216: "http://www.w3.org/TR/xhtml1/transitional" class=
4217: "filename">mk/bulk/bsd.bulk-pkg.mk</code>. The most
4218: useful options of these are briefly described
4219: here.</p>
4220:
4221: <div class="itemizedlist">
4222: <ul type="disc">
4223: <li>
4224: <p>If you are on a slow machine, you may want
4225: to set <code class=
4226: "varname">USE_BULK_BROKEN_CHECK</code> to
4227: “<span class=
4228: "quote">no</span>”.</p>
4229: </li>
4230:
4231: <li>
4232: <p>If you are doing bulk builds from a
4233: read-only copy of pkgsrc, you have to set
4234: <code class="varname">BULKFILESDIR</code> to
4235: the directory where all log files are created.
4236: Otherwise the log files are created in the
4237: pkgsrc directory.</p>
4238: </li>
4239:
4240: <li>
4241: <p>Another important variable is <code class=
4242: "varname">BULK_PREREQ</code>, which is a list
4243: of packages that should be always available
4244: while building other packages.</p>
4245: </li>
4246: </ul>
1.1 grant 4247: </div>
1.68 ! rillig 4248:
! 4249: <p>Some other options are scattered in the pkgsrc
! 4250: infrastructure:</p>
! 4251:
! 4252: <div class="itemizedlist">
! 4253: <ul type="disc">
! 4254: <li>
! 4255: <p><code class="varname">CHECK_FILES</code>
! 4256: (<code xmlns=
! 4257: "http://www.w3.org/TR/xhtml1/transitional"
! 4258: class=
! 4259: "filename">pkgsrc/mk/bsd.pkg.check.mk</code>)
! 4260: can be set to “<span class=
! 4261: "quote">yes</span>” to check that the
! 4262: installed set of files matches the <code xmlns=
! 4263: "http://www.w3.org/TR/xhtml1/transitional"
! 4264: class="filename">PLIST</code>.</p>
! 4265: </li>
! 4266:
! 4267: <li>
! 4268: <p><code class=
! 4269: "varname">CHECK_INTERPRETER</code>
! 4270: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 4271: class=
! 4272: "filename">pkgsrc/mk/bsd.pkg.check.mk</code>)
! 4273: can be set to “<span class=
! 4274: "quote">yes</span>” to check that the
! 4275: installed “<span class=
! 4276: "quote">#!</span>”-scripts will find
! 4277: their interpreter.</p>
! 4278: </li>
! 4279: </ul>
! 4280: </div>
1.1 grant 4281: </div>
4282:
1.67 hubertf 4283: <div class="sect3" lang="en">
1.1 grant 4284: <div class="titlepage">
4285: <div>
4286: <div>
1.67 hubertf 4287: <h4 class="title"><a name=
1.45 wiz 4288: "pre-build.local"></a>6.3.1.3. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4289: class="filename">pre-build.local</code></h4>
1.1 grant 4290: </div>
4291: </div>
4292: </div>
4293:
4294: <p>It is possible to configure the bulk build to
1.47 reed 4295: perform certain site-specific tasks at the end of the
1.45 wiz 4296: pre-build stage. If the file <code xmlns=
4297: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4298: "filename">pre-build.local</code> exists in
1.45 wiz 4299: <code xmlns=
4300: "http://www.w3.org/TR/xhtml1/transitional" class=
4301: "filename">/usr/pkgsrc/mk/bulk</code>, it will be
4302: executed (as a <a href=
1.24 wiz 4303: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
4304: <span class="citerefentry"><span class=
4305: "refentrytitle">sh</span>(1)</span></a> script) at
4306: the end of the usual pre-build stage. An example use
1.45 wiz 4307: of <code xmlns=
4308: "http://www.w3.org/TR/xhtml1/transitional" class=
4309: "filename">pre-build.local</code> is to have the
4310: line:</p>
1.1 grant 4311: <pre class="screen">
1.14 xtraeme 4312: <code class="prompt">#</code> <strong class=
4313: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 4314: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 4315: </pre>
4316:
4317: <p>to prevent the system from trying to build a
4318: particular package which requires nearly 3 GB of disk
4319: space.</p>
4320: </div>
4321: </div>
4322:
1.67 hubertf 4323: <div class="sect2" lang="en">
1.1 grant 4324: <div class="titlepage">
4325: <div>
4326: <div>
1.30 wiz 4327: <h3 class="title"><a name=
1.38 dillo 4328: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 4329: environmental considerations</h3>
1.1 grant 4330: </div>
4331: </div>
4332: </div>
4333:
1.45 wiz 4334: <p>As <code xmlns=
4335: "http://www.w3.org/TR/xhtml1/transitional" class=
4336: "filename">/usr/pkg</code> will be completely deleted
4337: at the start of bulk builds, make sure your login shell
4338: is placed somewhere else. Either drop it into
4339: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4340: class="filename">/usr/local/bin</code> (and adjust your
4341: login shell in the passwd file), or (re-)install it via
1.14 xtraeme 4342: <a href=
1.1 grant 4343: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4344: <span class="citerefentry"><span class=
4345: "refentrytitle">pkg_add</span>(1)</span></a> from
1.45 wiz 4346: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4347: class="filename">/etc/rc.local</code>, so you can login
4348: after a reboot (remember that your current process
4349: won't die if the package is removed, you just can't
4350: start any new instances of the shell any more). Also,
4351: if you use NetBSD earlier than 1.5, or you still want
4352: to use the pkgsrc version of ssh for some reason, be
4353: sure to install ssh before starting it from
4354: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4355: class="filename">rc.local</code>:</p>
1.1 grant 4356: <pre class="programlisting">
1.51 rillig 4357: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
4358: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
4359: /usr/pkg/etc/rc.d/sshd
4360: fi
1.1 grant 4361: </pre>
4362:
4363: <p>Not doing so will result in you being not able to
4364: log in via ssh after the bulk build is finished or if
4365: the machine gets rebooted or crashes. You have been
4366: warned! :)</p>
4367: </div>
4368:
1.67 hubertf 4369: <div class="sect2" lang="en">
1.1 grant 4370: <div class="titlepage">
4371: <div>
4372: <div>
1.67 hubertf 4373: <h3 class="title"><a name=
1.38 dillo 4374: "operation"></a>6.3.3. Operation</h3>
1.1 grant 4375: </div>
4376: </div>
4377: </div>
4378:
4379: <p>Make sure you don't need any of the packages still
4380: installed.</p>
4381:
4382: <div class="warning" style=
4383: "margin-left: 0.5in; margin-right: 0.5in;">
4384: <h3 class="title">Warning</h3>
4385:
4386: <p>During the bulk build, <span class=
4387: "emphasis"><em>all packages will be
4388: removed!</em></span></p>
4389: </div>
4390:
4391: <p>Be sure to remove all other things that might
4392: interfere with builds, like some libs installed in
1.45 wiz 4393: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4394: class="filename">/usr/local</code>, etc. then become
4395: root and type:</p>
1.1 grant 4396: <pre class="screen">
1.14 xtraeme 4397: <code class="prompt">#</code> <strong class=
4398: "userinput"><code>cd /usr/pkgsrc</code></strong>
4399: <code class="prompt">#</code> <strong class=
4400: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 4401: </pre>
4402:
4403: <p>If for some reason your last build didn't complete
4404: (power failure, system panic, ...), you can continue it
4405: by running:</p>
4406: <pre class="screen">
1.14 xtraeme 4407: <code class="prompt">#</code> <strong class=
4408: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 4409: </pre>
4410:
4411: <p>At the end of the bulk build, you will get a summary
4412: via mail, and find build logs in the directory
1.14 xtraeme 4413: specified by <code class="varname">FTP</code> in the
1.45 wiz 4414: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4415: class="filename">build.conf</code> file.</p>
1.1 grant 4416: </div>
4417:
1.67 hubertf 4418: <div class="sect2" lang="en">
1.1 grant 4419: <div class="titlepage">
4420: <div>
4421: <div>
1.67 hubertf 4422: <h3 class="title"><a name=
1.38 dillo 4423: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 4424: </div>
4425: </div>
4426: </div>
4427:
4428: <p>The bulk builds consist of three steps:</p>
4429:
4430: <div class="variablelist">
4431: <dl>
4432: <dt><span class="term">1. pre-build</span></dt>
4433:
4434: <dd>
4435: <p>The script updates your pkgsrc tree via
4436: (anon)cvs, then cleans out any broken distfiles,
4437: and removes all packages installed.</p>
4438: </dd>
4439:
4440: <dt><span class="term">2. the bulk
4441: build</span></dt>
4442:
4443: <dd>
4444: <p>This is basically “<span class=
4445: "quote">make bulk-package</span>” with an
4446: optimised order in which packages will be built.
4447: Packages that don't require other packages will
4448: be built first, and packages with many
4449: dependencies will be built later.</p>
4450: </dd>
4451:
4452: <dt><span class="term">3. post-build</span></dt>
4453:
4454: <dd>
4455: <p>Generates a report that's placed in the
1.45 wiz 4456: directory specified in the <code xmlns=
4457: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4458: "filename">build.conf</code> file named
1.45 wiz 4459: <code xmlns=
4460: "http://www.w3.org/TR/xhtml1/transitional" class=
4461: "filename">broken.html</code>, a short version of
4462: that report will also be mailed to the build's
4463: admin.</p>
1.1 grant 4464: </dd>
4465: </dl>
4466: </div>
4467:
4468: <p>During the build, a list of broken packages will be
1.45 wiz 4469: compiled in <code xmlns=
4470: "http://www.w3.org/TR/xhtml1/transitional" class=
4471: "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
4472: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4473: "filename">.../.broken.${MACHINE}</code> if
4474: <code class="varname">OBJMACHINE</code> is set),
4475: individual build logs of broken builds can be found in
4476: the package's directory. These files are used by the
4477: bulk-targets to mark broken builds to not waste time
4478: trying to rebuild them, and they can be used to debug
4479: these broken package builds later.</p>
1.1 grant 4480: </div>
4481:
1.67 hubertf 4482: <div class="sect2" lang="en">
1.1 grant 4483: <div class="titlepage">
4484: <div>
4485: <div>
1.30 wiz 4486: <h3 class="title"><a name=
1.38 dillo 4487: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 4488: space requirements</h3>
1.1 grant 4489: </div>
4490: </div>
4491: </div>
4492:
4493: <p>Currently, roughly the following requirements are
4494: valid for NetBSD 2.0/i386:</p>
4495:
4496: <div class="itemizedlist">
4497: <ul type="disc">
4498: <li>
4499: <p>10 GB - distfiles (NFS ok)</p>
4500: </li>
4501:
4502: <li>
4503: <p>8 GB - full set of all binaries (NFS ok)</p>
4504: </li>
4505:
4506: <li>
4507: <p>5 GB - temp space for compiling (local disk
4508: recommended)</p>
4509: </li>
4510: </ul>
4511: </div>
4512:
4513: <p>Note that all pkgs will be de-installed as soon as
4514: they are turned into a binary package, and that sources
4515: are removed, so there is no excessively huge demand to
4516: disk space. Afterwards, if the package is needed again,
4517: it will be installed via <a href=
4518: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4519: <span class="citerefentry"><span class=
4520: "refentrytitle">pkg_add</span>(1)</span></a> instead of
4521: building again, so there are no cycles wasted by
4522: recompiling.</p>
4523: </div>
4524:
1.67 hubertf 4525: <div class="sect2" lang="en">
1.1 grant 4526: <div class="titlepage">
4527: <div>
4528: <div>
1.67 hubertf 4529: <h3 class="title"><a name=
4530: "setting-up-a-sandbox"></a>6.3.6. Setting up
4531: a sandbox for chrooted builds</h3>
1.1 grant 4532: </div>
4533: </div>
4534: </div>
4535:
1.12 agc 4536: <p>If you don't want all the packages nuked from a
4537: machine (rendering it useless for anything but pkg
1.23 wiz 4538: compiling), there is the possibility of doing the
4539: package bulk build inside a chroot environment.</p>
1.12 agc 4540:
4541: <p>The first step is to set up a chroot sandbox, e.g.
1.45 wiz 4542: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4543: class="filename">/usr/sandbox</code>. This can be done
4544: by using null mounts, or manually.</p>
1.12 agc 4545:
1.45 wiz 4546: <p>There is a shell script called <code xmlns=
4547: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4548: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
4549: set up the sandbox environment using null mounts. It
1.45 wiz 4550: will also create a script called <code xmlns=
4551: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4552: "filename">sandbox</code> in the root of the sandbox
1.12 agc 4553: environment, which will allow the null mounts to be
1.14 xtraeme 4554: activated using the <span><strong class=
4555: "command">sandbox mount</strong></span> command and
4556: deactivated using the <span><strong class=
4557: "command">sandbox umount</strong></span> command.</p>
1.12 agc 4558:
4559: <p>To set up a sandbox environment by hand, after
4560: extracting all the sets from a NetBSD installation or
1.14 xtraeme 4561: doing a <span><strong class="command">make distribution
1.45 wiz 4562: DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
4563: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4564: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 4565: items are present and properly configured:</p>
1.1 grant 4566:
4567: <div class="procedure">
4568: <ol type="1">
4569: <li>
4570: <p>Kernel</p>
4571: <pre class="screen">
1.14 xtraeme 4572: <code class="prompt">#</code> <strong class=
4573: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 4574: </pre>
4575: </li>
4576:
4577: <li>
1.45 wiz 4578: <p><code xmlns=
4579: "http://www.w3.org/TR/xhtml1/transitional" class=
4580: "filename">/dev/*</code></p>
1.1 grant 4581: <pre class="screen">
1.14 xtraeme 4582: <code class="prompt">#</code> <strong class=
4583: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 4584: </pre>
4585: </li>
4586:
4587: <li>
1.45 wiz 4588: <p><code xmlns=
4589: "http://www.w3.org/TR/xhtml1/transitional" class=
4590: "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1 grant 4591: "http://www.w3.org/TR/xhtml1/transitional" href=
4592: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4593: target="_top"><code xmlns="" class=
4594: "filename">security/smtpd</code></a> and
4595: mail):</p>
1.1 grant 4596: <pre class="screen">
1.14 xtraeme 4597: <code class="prompt">#</code> <strong class=
4598: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 4599: </pre>
4600: </li>
4601:
4602: <li>
4603: <p>Working(!) mail config (hostname,
4604: sendmail.cf):</p>
4605: <pre class="screen">
1.14 xtraeme 4606: <code class="prompt">#</code> <strong class=
4607: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 4608: </pre>
4609: </li>
4610:
4611: <li>
1.45 wiz 4612: <p><code xmlns=
4613: "http://www.w3.org/TR/xhtml1/transitional" class=
4614: "filename">/etc/localtime</code> (for <a xmlns=
1.1 grant 4615: "http://www.w3.org/TR/xhtml1/transitional" href=
4616: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4617: target="_top"><code xmlns="" class=
4618: "filename">security/smtpd</code></a>):</p>
1.1 grant 4619: <pre class="screen">
1.14 xtraeme 4620: <code class="prompt">#</code> <strong class=
4621: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 4622: </pre>
4623: </li>
4624:
4625: <li>
1.45 wiz 4626: <p><code xmlns=
4627: "http://www.w3.org/TR/xhtml1/transitional" class=
4628: "filename">/usr/src</code> (system sources, for
4629: <a xmlns=
1.1 grant 4630: "http://www.w3.org/TR/xhtml1/transitional" href=
4631: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45 wiz 4632: target="_top"><code xmlns="" class=
4633: "filename">sysutils/aperture</code></a>,
4634: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
4635: href=
1.20 ben 4636: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45 wiz 4637: target="_top"><code xmlns="" class=
4638: "filename">net/ppp-mppe</code></a>):</p>
1.1 grant 4639: <pre class="screen">
1.14 xtraeme 4640: <code class="prompt">#</code> <strong class=
4641: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
4642: <code class="prompt">#</code> <strong class=
1.23 wiz 4643: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 4644: </pre>
4645: </li>
4646:
4647: <li>
1.45 wiz 4648: <p>Create <code xmlns=
4649: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4650: "filename">/var/db/pkg</code> (not part of
4651: default install):</p>
1.1 grant 4652: <pre class="screen">
1.14 xtraeme 4653: <code class="prompt">#</code> <strong class=
4654: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 4655: </pre>
4656: </li>
4657:
4658: <li>
1.45 wiz 4659: <p>Create <code xmlns=
4660: "http://www.w3.org/TR/xhtml1/transitional" class=
4661: "filename">/usr/pkg</code> (not part of default
4662: install):</p>
1.1 grant 4663: <pre class="screen">
1.14 xtraeme 4664: <code class="prompt">#</code> <strong class=
4665: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 4666: </pre>
4667: </li>
4668:
4669: <li>
1.45 wiz 4670: <p>Checkout pkgsrc via cvs into <code xmlns=
4671: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4672: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 4673: <pre class="screen">
1.14 xtraeme 4674: <code class="prompt">#</code> <strong class=
4675: "userinput"><code>cd /usr/sandbox/usr</code></strong>
4676: <code class="prompt">#</code> <strong class=
4677: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 4678: </pre>
4679:
4680: <p>Do not mount/link this to the copy of your
4681: pkgsrc tree you do development in, as this will
4682: likely cause problems!</p>
4683: </li>
4684:
4685: <li>
1.45 wiz 4686: <p>Make <code xmlns=
4687: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4688: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45 wiz 4689: and <code xmlns=
4690: "http://www.w3.org/TR/xhtml1/transitional" class=
4691: "filename">.../distfiles</code> point somewhere
4692: appropriate. NFS- and/or nullfs-mounts may come
4693: in handy!</p>
1.1 grant 4694: </li>
4695:
4696: <li>
1.45 wiz 4697: <p>Edit <code xmlns=
4698: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4699: "filename">/etc/mk.conf</code>, see <a href=
4700: "#binary.mk.conf" title=
1.63 dillo 4701: "6.3.1.2. /etc/mk.conf">Section 6.3.1.2,
1.1 grant 4702: “/etc/mk.conf”</a>.</p>
4703: </li>
4704:
4705: <li>
1.45 wiz 4706: <p>Adjust <code xmlns=
4707: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4708: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 4709: needs.</p>
4710: </li>
4711: </ol>
4712: </div>
4713:
1.47 reed 4714: <p>When the chroot sandbox is set up, you can start the
1.1 grant 4715: build with the following steps:</p>
4716: <pre class="screen">
1.14 xtraeme 4717: <code class="prompt">#</code> <strong class=
4718: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4719: <code class="prompt">#</code> <strong class=
4720: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 4721: </pre>
4722:
4723: <p>This will just jump inside the sandbox and start
4724: building. At the end of the build, mail will be sent
4725: with the results of the build. Created binary pkgs will
1.45 wiz 4726: be in <code xmlns=
4727: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4728: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 4729: (wherever that points/mounts to/from).</p>
4730: </div>
4731:
1.67 hubertf 4732: <div class="sect2" lang="en">
1.1 grant 4733: <div class="titlepage">
4734: <div>
4735: <div>
1.30 wiz 4736: <h3 class="title"><a name=
1.38 dillo 4737: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 4738: a partial set of packages</h3>
1.1 grant 4739: </div>
4740: </div>
4741: </div>
4742:
4743: <p>In addition to building a complete set of all
1.45 wiz 4744: packages in pkgsrc, the <code xmlns=
4745: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4746: "filename">pkgsrc/mk/bulk/build</code> script may be
4747: used to build a subset of the packages contained in
1.47 reed 4748: pkgsrc. By setting <code class=
1.45 wiz 4749: "varname">SPECIFIC_PKGS</code> in <code xmlns=
4750: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4751: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 4752:
4753: <div class="itemizedlist">
4754: <ul type="disc">
4755: <li>
4756: <p>SITE_SPECIFIC_PKGS</p>
4757: </li>
4758:
4759: <li>
4760: <p>HOST_SPECIFIC_PKGS</p>
4761: </li>
4762:
4763: <li>
4764: <p>GROUP_SPECIFIC_PKGS</p>
4765: </li>
4766:
4767: <li>
4768: <p>USER_SPECIFIC_PKGS</p>
4769: </li>
4770: </ul>
4771: </div>
4772:
4773: <p>will define the set of packages which should be
4774: built. The bulk build code will also include any
4775: packages which are needed as dependencies for the
4776: explicitly listed packages.</p>
4777:
4778: <p>One use of this is to do a bulk build with
1.14 xtraeme 4779: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 4780: sandbox periodically to have a complete set of the
4781: binary packages needed for your site available without
4782: the overhead of building extra packages that are not
4783: needed.</p>
4784: </div>
1.13 hubertf 4785:
1.67 hubertf 4786: <div class="sect2" lang="en">
1.13 hubertf 4787: <div class="titlepage">
4788: <div>
4789: <div>
1.67 hubertf 4790: <h3 class="title"><a name=
1.38 dillo 4791: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 4792: of a bulk build</h3>
4793: </div>
4794: </div>
4795: </div>
4796:
4797: <p>This section describes how pkgsrc developers can
4798: upload binary pkgs built by bulk builds to
4799: ftp.NetBSD.org.</p>
4800:
1.17 sketch 4801: <p>If you would like to automatically create checksum
4802: files for the binary packages you intend to upload,
4803: remember to set <code class="varname">MKSUMS=yes</code>
1.45 wiz 4804: in your <code xmlns=
4805: "http://www.w3.org/TR/xhtml1/transitional" class=
1.17 sketch 4806: "filename">mk/bulk/build.conf</code>.</p>
4807:
4808: <p>If you would like to PGP sign the checksum files
4809: (highly recommended!), remember to set <code class=
4810: "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45 wiz 4811: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4812: class="filename">mk/bulk/build.conf</code>. This will
4813: prompt you for your GPG password to sign the files
1.17 sketch 4814: before uploading everything.</p>
4815:
4816: <p>Then, make sure that you have <code class=
1.14 xtraeme 4817: "varname">RSYNC_DST</code> set properly in your
1.45 wiz 4818: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4819: class="filename">mk/bulk/build.conf</code> file, i.e.
4820: adjust it to something like one of the following:</p>
1.13 hubertf 4821: <pre class="screen">
1.68 ! rillig 4822: RSYNC_DST=ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
1.13 hubertf 4823: </pre>
4824:
1.47 reed 4825: <p>Please use appropriate values for "pkgsrc-200xQy",
1.13 hubertf 4826: "NetBSD-a.b.c" and "arch" here. If your login on
1.68 ! rillig 4827: ftp.NetBSD.org is different from your local login,
! 4828: write your login directly into the variable, e.g. my
! 4829: local account is "feyrer", but for my login "hubertf",
! 4830: I use:</p>
1.13 hubertf 4831: <pre class="screen">
4832: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4833: </pre>
4834:
1.45 wiz 4835: <p>A separate <code xmlns=
4836: "http://www.w3.org/TR/xhtml1/transitional" class=
4837: "filename">upload</code> directory is used here to
4838: allow "closing" the directory during upload. To do so,
4839: run the following command on ftp.NetBSD.org next:</p>
1.13 hubertf 4840: <pre class="screen">
1.14 xtraeme 4841: nbftp% <strong class=
4842: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 4843: </pre>
4844:
1.45 wiz 4845: <p>Please note that <code xmlns=
4846: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4847: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 4848: appropriate for packages for the NetBSD operating
4849: system. Binary packages for other operating systems
1.45 wiz 4850: should go into <code xmlns=
4851: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4852: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 4853:
4854: <p>Before uploading the binary pkgs, ssh authentication
1.47 reed 4855: needs to be set up. This example shows how to set up
1.13 hubertf 4856: temporary keys for the root account <span class=
4857: "emphasis"><em>inside the sandbox</em></span> (assuming
4858: that no keys should be present there usually):</p>
4859: <pre class="screen">
1.14 xtraeme 4860: <code class="prompt">#</code> <strong class=
1.68 ! rillig 4861: "userinput"><code>chroot /usr/sandbox</code></strong>
1.14 xtraeme 4862: chroot-<code class="prompt">#</code> <strong class=
1.68 ! rillig 4863: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
1.14 xtraeme 4864: chroot-<code class="prompt">#</code> <strong class=
1.68 ! rillig 4865: "userinput"><code>ssh-keygen -t dsa</code></strong>
1.14 xtraeme 4866: chroot-<code class="prompt">#</code> <strong class=
4867: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 4868: </pre>
4869:
1.45 wiz 4870: <p>Now take the output of <code xmlns=
4871: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4872: "filename">id-dsa.pub</code> and append it to your
1.45 wiz 4873: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4874: class="filename">~/.ssh/authorized_keys</code> file on
4875: ftp.NetBSD.org. You can remove the key after the upload
4876: is done!</p>
1.13 hubertf 4877:
4878: <p>Next, test if your ssh connection really works:</p>
4879: <pre class="screen">
1.14 xtraeme 4880: chroot-<code class="prompt">#</code> <strong class=
4881: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 4882: </pre>
4883:
4884: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
4885:
4886: <p>Now after all this works, you can exit the sandbox
4887: and start the upload:</p>
4888: <pre class="screen">
1.14 xtraeme 4889: chroot-<code class="prompt">#</code> <strong class=
1.68 ! rillig 4890: "userinput"><code>exit</code></strong>
1.14 xtraeme 4891: <code class="prompt">#</code> <strong class=
1.68 ! rillig 4892: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
1.14 xtraeme 4893: <code class="prompt">#</code> <strong class=
4894: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 4895: </pre>
4896:
4897: <p>The upload process may take quite some time. Use
1.24 wiz 4898: <a href=
4899: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
4900: <span class="citerefentry"><span class=
4901: "refentrytitle">ls</span>(1)</span></a> or <a href=
4902: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
4903: <span class="citerefentry"><span class=
4904: "refentrytitle">du</span>(1)</span></a> on the FTP
4905: server to monitor progress of the upload. The upload
4906: script will take care of not uploading restricted
4907: packages and putting vulnerable packages into the
1.45 wiz 4908: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4909: class="filename">vulnerable</code> subdirectory.</p>
1.13 hubertf 4910:
4911: <p>After the upload has ended, first thing is to revoke
4912: ssh access:</p>
4913: <pre class="screen">
1.14 xtraeme 4914: nbftp% <strong class=
4915: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 4916: Gdd:x!
4917: </pre>
4918:
4919: <p>Use whatever is needed to remove the key you've
4920: entered before! Last, move the uploaded packages out of
1.45 wiz 4921: the <code xmlns=
4922: "http://www.w3.org/TR/xhtml1/transitional" class=
4923: "filename">upload</code> directory to have them
4924: accessible to everyone:</p>
1.13 hubertf 4925: <pre class="screen">
1.14 xtraeme 4926: nbftp% <strong class=
4927: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
4928: nbftp% <strong class=
4929: "userinput"><code>mv upload/* .</code></strong>
4930: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
4931: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 4932: </pre>
4933: </div>
1.1 grant 4934: </div>
4935:
1.67 hubertf 4936: <div class="sect1" lang="en">
1.1 grant 4937: <div class="titlepage">
4938: <div>
4939: <div>
4940: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4941: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 4942: CD-ROM packages collection</h2>
1.1 grant 4943: </div>
4944: </div>
4945: </div>
4946:
4947: <p>After your pkgsrc bulk-build has completed, you may
4948: wish to create a CD-ROM set of the resulting binary
4949: packages to assist in installing packages on other
4950: machines. The <a xmlns=
4951: "http://www.w3.org/TR/xhtml1/transitional" href=
4952: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45 wiz 4953: target="_top"><code xmlns="" class=
4954: "filename">pkgtools/cdpack</code></a> package provides a
1.20 ben 4955: simple tool for creating the ISO 9660 images.
4956: <span><strong class="command">cdpack</strong></span>
4957: arranges the packages on the CD-ROMs in a way that keeps
1.47 reed 4958: all the dependencies for a given package on the same CD
4959: as that package.</p>
1.1 grant 4960:
1.67 hubertf 4961: <div class="sect2" lang="en">
1.1 grant 4962: <div class="titlepage">
4963: <div>
4964: <div>
1.67 hubertf 4965: <h3 class="title"><a name=
1.38 dillo 4966: "cdpack-example"></a>6.4.1. Example of
1.1 grant 4967: cdpack</h3>
4968: </div>
4969: </div>
4970: </div>
4971:
4972: <p>Complete documentation for cdpack is found in the
1.47 reed 4973: cdpack(1) man page. The following short example assumes
1.45 wiz 4974: that the binary packages are left in <code xmlns=
4975: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4976: "filename">/usr/pkgsrc/packages/All</code> and that
1.45 wiz 4977: sufficient disk space exists in <code xmlns=
4978: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4979: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 4980: <pre class="screen">
1.14 xtraeme 4981: <code class="prompt">#</code> <strong class=
4982: "userinput"><code>mkdir /u2/images</code></strong>
4983: <code class="prompt">#</code> <strong class=
4984: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
4985: <code class="prompt">#</code> <strong class=
4986: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4987: </pre>
4988:
4989: <p>If you wish to include a common set of files
1.45 wiz 4990: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4991: class="filename">COPYRIGHT</code>, <code xmlns=
4992: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4993: "filename">README</code>, etc.) on each CD in the
1.1 grant 4994: collection, then you need to create a directory which
4995: contains these files. e.g.</p>
4996: <pre class="screen">
1.14 xtraeme 4997: <code class="prompt">#</code> <strong class=
4998: "userinput"><code>mkdir /tmp/common</code></strong>
4999: <code class="prompt">#</code> <strong class=
5000: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
5001: <code class="prompt">#</code> <strong class=
5002: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
5003: <code class="prompt">#</code> <strong class=
5004: "userinput"><code>mkdir /tmp/common/bin</code></strong>
5005: <code class="prompt">#</code> <strong class=
5006: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
5007: <code class="prompt">#</code> <strong class=
5008: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
5009: <code class="prompt">#</code> <strong class=
5010: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 5011: </pre>
5012:
5013: <p>Now create the images:</p>
5014: <pre class="screen">
1.14 xtraeme 5015: <code class="prompt">#</code> <strong class=
5016: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 5017: </pre>
5018:
1.45 wiz 5019: <p>Each image will contain <code xmlns=
5020: "http://www.w3.org/TR/xhtml1/transitional" class=
5021: "filename">README</code>, <code xmlns=
5022: "http://www.w3.org/TR/xhtml1/transitional" class=
5023: "filename">COPYING</code>, and <code xmlns=
5024: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5025: "filename">bin/myscript</code> in their root
1.1 grant 5026: directories.</p>
5027: </div>
5028: </div>
5029: </div>
5030:
1.67 hubertf 5031: <div class="chapter" lang="en">
1.1 grant 5032: <div class="titlepage">
5033: <div>
5034: <div>
1.67 hubertf 5035: <h2 class="title"><a name=
1.38 dillo 5036: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 5037: Questions</h2>
5038: </div>
5039: </div>
5040: </div>
5041:
5042: <div class="toc">
5043: <p><b>Table of Contents</b></p>
5044:
5045: <dl>
1.30 wiz 5046: <dt><span class="sect1"><a href=
1.38 dillo 5047: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 5048: lists for pkg-related discussion?</a></span></dt>
1.1 grant 5049:
1.38 dillo 5050: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 5051: Where's the pkgviews documentation?</a></span></dt>
5052:
1.38 dillo 5053: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 5054: Utilities for package management
5055: (pkgtools)</a></span></dt>
5056:
1.38 dillo 5057: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 5058: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 5059:
1.30 wiz 5060: <dt><span class="sect1"><a href=
1.38 dillo 5061: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 5062: fetching distfiles?</a></span></dt>
1.14 xtraeme 5063:
1.30 wiz 5064: <dt><span class="sect1"><a href=
1.38 dillo 5065: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 5066: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 5067:
1.30 wiz 5068: <dt><span class="sect1"><a href=
1.38 dillo 5069: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 5070: from pkgsrc?</a></span></dt>
1.1 grant 5071:
1.30 wiz 5072: <dt><span class="sect1"><a href=
1.38 dillo 5073: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 5074: behind a firewall</a></span></dt>
1.1 grant 5075:
1.38 dillo 5076: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 5077: do I tell <span><strong class="command">make
5078: fetch</strong></span> to do passive
5079: FTP?</a></span></dt>
1.1 grant 5080:
1.30 wiz 5081: <dt><span class="sect1"><a href=
1.38 dillo 5082: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 5083: distfiles at once</a></span></dt>
1.1 grant 5084:
1.30 wiz 5085: <dt><span class="sect1"><a href=
1.38 dillo 5086: "#tmac.andoc-missing">7.11. What does
1.30 wiz 5087: “<span class="quote">Don't know how to make
1.14 xtraeme 5088: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 5089: mean?</a></span></dt>
5090:
1.30 wiz 5091: <dt><span class="sect1"><a href=
1.38 dillo 5092: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 5093: “<span class="quote">Could not find
1.14 xtraeme 5094: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 5095:
1.30 wiz 5096: <dt><span class="sect1"><a href=
1.38 dillo 5097: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 5098: pkgsrc</a></span></dt>
1.1 grant 5099:
1.38 dillo 5100: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 5101: do I change the location of configuration
5102: files?</a></span></dt>
1.1 grant 5103:
1.38 dillo 5104: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 5105: Automated security checks</a></span></dt>
5106: </dl>
5107: </div>
5108:
5109: <p>This section contains hints, tips & tricks on
5110: special things in pkgsrc that we didn't find a better place
5111: for in the previous chapters, and it contains items for
5112: both pkgsrc users and developers.</p>
5113:
1.67 hubertf 5114: <div class="sect1" lang="en">
1.1 grant 5115: <div class="titlepage">
5116: <div>
5117: <div>
5118: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5119: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 5120: mailing lists for pkg-related discussion?</h2>
1.1 grant 5121: </div>
5122: </div>
5123: </div>
5124:
1.18 xtraeme 5125: <p>The following mailing lists may be of interest to
5126: pkgsrc users:</p>
5127:
5128: <div class="itemizedlist">
5129: <ul type="disc">
5130: <li>
5131: <p><a href=
5132: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34 wiz 5133: target="_top">pkgsrc-bugs</a>: A list where problem
5134: reports related to pkgsrc are sent and
5135: discussed.</p>
1.18 xtraeme 5136: </li>
5137:
5138: <li>
5139: <p><a href=
5140: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 5141: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 5142: results of pkgsrc bulk builds are sent and
1.34 wiz 5143: discussed.</p>
1.18 xtraeme 5144: </li>
5145:
5146: <li>
5147: <p><a href=
5148: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34 wiz 5149: target="_top">pkgsrc-changes</a>: A list where all
5150: commit messages to pkgsrc are sent.</p>
1.18 xtraeme 5151: </li>
5152:
5153: <li>
5154: <p><a href=
5155: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34 wiz 5156: target="_top">tech-pkg</a>: A general discussion
5157: list for all things related to pkgsrc.</p>
1.18 xtraeme 5158: </li>
5159: </ul>
5160: </div>
5161:
5162: <p>To subscribe, do:</p>
1.1 grant 5163: <pre class="programlisting">
1.51 rillig 5164: <code class="prompt">%</code> echo subscribe <em class=
1.18 xtraeme 5165: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 5166: </pre>
5167:
1.18 xtraeme 5168: <p>Archives for all these mailing lists are available
5169: from <a href="http://mail-index.NetBSD.org/" target=
5170: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 5171: </div>
5172:
1.67 hubertf 5173: <div class="sect1" lang="en">
1.1 grant 5174: <div class="titlepage">
5175: <div>
5176: <div>
5177: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5178: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 5179: documentation?</h2>
1.1 grant 5180: </div>
5181: </div>
5182: </div>
5183:
5184: <p>Pkgviews is tightly integrated with buildlink. You can
1.45 wiz 5185: find a pkgviews User's guide in <code xmlns=
5186: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5187: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 5188: </div>
5189:
1.67 hubertf 5190: <div class="sect1" lang="en">
1.1 grant 5191: <div class="titlepage">
5192: <div>
5193: <div>
5194: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5195: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 5196: management (pkgtools)</h2>
1.1 grant 5197: </div>
5198: </div>
5199: </div>
5200:
1.45 wiz 5201: <p>The <code xmlns=
5202: "http://www.w3.org/TR/xhtml1/transitional" class=
5203: "filename">pkgsrc/pkgtools</code> directory pkgtools
5204: contains a number of useful utilities for both users and
5205: developers of pkgsrc. This section attempts only to make
5206: the reader aware of the utilities and when they might be
5207: useful, and not to duplicate the documentation that comes
5208: with each package.</p>
1.1 grant 5209:
5210: <p>Utilities used by pkgsrc (automatically installed when
5211: needed):</p>
5212:
5213: <div class="itemizedlist">
5214: <ul type="disc">
5215: <li>
5216: <p><a xmlns=
5217: "http://www.w3.org/TR/xhtml1/transitional" href=
5218: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45 wiz 5219: target="_top"><code xmlns="" class=
5220: "filename">pkgtools/x11-links</code></a>: Symlinks
1.34 wiz 5221: for use by buildlink.</p>
1.1 grant 5222: </li>
5223: </ul>
5224: </div>
5225:
5226: <p>OS tool augmentation (automatically installed when
5227: needed):</p>
5228:
5229: <div class="itemizedlist">
5230: <ul type="disc">
5231: <li>
5232: <p><a xmlns=
5233: "http://www.w3.org/TR/xhtml1/transitional" href=
5234: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 wiz 5235: target="_top"><code xmlns="" class=
5236: "filename">pkgtools/digest</code></a>: Calculates
1.34 wiz 5237: various kinds of checksums (including SHA1).</p>
1.1 grant 5238: </li>
5239:
5240: <li>
5241: <p><a xmlns=
5242: "http://www.w3.org/TR/xhtml1/transitional" href=
5243: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45 wiz 5244: target="_top"><code xmlns="" class=
5245: "filename">pkgtools/libnbcompat</code></a>:
1.34 wiz 5246: Compatibility library for pkgsrc tools.</p>
1.1 grant 5247: </li>
5248:
5249: <li>
5250: <p><a xmlns=
5251: "http://www.w3.org/TR/xhtml1/transitional" href=
5252: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45 wiz 5253: target="_top"><code xmlns="" class=
5254: "filename">pkgtools/mtree</code></a>: Installed on
1.34 wiz 5255: non-BSD systems due to lack of native mtree.</p>
1.1 grant 5256: </li>
5257:
5258: <li>
5259: <p><a xmlns=
5260: "http://www.w3.org/TR/xhtml1/transitional" href=
5261: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5262: target="_top"><code xmlns="" class=
5263: "filename">pkgtools/pkg_install</code></a>:
5264: Up-to-date replacement for <code xmlns=
5265: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5266: "filename">/usr/sbin/pkg_install</code>, or for use
5267: on operating systems where pkg_install is not
5268: present.</p>
1.1 grant 5269: </li>
5270: </ul>
5271: </div>
5272:
5273: <p>Utilities used by pkgsrc (not automatically
5274: installed):</p>
5275:
5276: <div class="itemizedlist">
5277: <ul type="disc">
5278: <li>
5279: <p><a xmlns=
5280: "http://www.w3.org/TR/xhtml1/transitional" href=
5281: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45 wiz 5282: target="_top"><code xmlns="" class=
5283: "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20 ben 5284: binary package from an already-installed package.
1.34 wiz 5285: Used by <span><strong class="command">make
5286: replace</strong></span> to save the old
5287: package.</p>
1.1 grant 5288: </li>
5289:
5290: <li>
5291: <p><a xmlns=
5292: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 5293: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45 wiz 5294: target="_top"><code xmlns="" class=
5295: "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20 ben 5296: functionality to pkgsrc, allowing it to fetch
5297: distfiles from multiple locations. It currently
5298: supports the following methods: multiple CD-ROMs
5299: and network FTP/HTTP connections.</p>
1.5 hubertf 5300: </li>
5301:
5302: <li>
5303: <p><a xmlns=
5304: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5305: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 5306: target="_top"><code xmlns="" class=
5307: "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34 wiz 5308: packages someplace else (enabled by default).</p>
1.1 grant 5309: </li>
1.5 hubertf 5310:
5311: <li>
5312: <p><a xmlns=
5313: "http://www.w3.org/TR/xhtml1/transitional" href=
5314: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 5315: target="_top"><code xmlns="" class=
5316: "filename">devel/cpuflags</code></a>: Determine the
1.34 wiz 5317: best compiler flags to optimise code for your
1.20 ben 5318: current CPU and compiler.</p>
1.5 hubertf 5319: </li>
1.1 grant 5320: </ul>
5321: </div>
5322:
5323: <p>Utilities for keeping track of installed packages,
5324: being up to date, etc:</p>
5325:
5326: <div class="itemizedlist">
5327: <ul type="disc">
5328: <li>
5329: <p><a xmlns=
5330: "http://www.w3.org/TR/xhtml1/transitional" href=
5331: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45 wiz 5332: target="_top"><code xmlns="" class=
5333: "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27 rillig 5334: packages whose installed versions do not match the
1.34 wiz 5335: latest pkgsrc entries.</p>
1.1 grant 5336: </li>
5337:
5338: <li>
5339: <p><a xmlns=
5340: "http://www.w3.org/TR/xhtml1/transitional" href=
5341: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5342: target="_top"><code xmlns="" class=
5343: "filename">pkgtools/pkgdep</code></a>: Makes
1.20 ben 5344: dependency graphs of packages, to aid in choosing a
1.34 wiz 5345: strategy for updating.</p>
1.1 grant 5346: </li>
5347:
5348: <li>
5349: <p><a xmlns=
5350: "http://www.w3.org/TR/xhtml1/transitional" href=
5351: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45 wiz 5352: target="_top"><code xmlns="" class=
5353: "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27 rillig 5354: graphs from the output of <a xmlns=
5355: "http://www.w3.org/TR/xhtml1/transitional" href=
5356: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5357: target="_top"><code xmlns="" class=
5358: "filename">pkgtools/pkgdep</code></a> (uses
1.34 wiz 5359: graphviz).</p>
1.1 grant 5360: </li>
5361:
5362: <li>
5363: <p><a xmlns=
5364: "http://www.w3.org/TR/xhtml1/transitional" href=
5365: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 5366: target="_top"><code xmlns="" class=
5367: "filename">pkgtools/pkglint</code></a>: The
1.27 rillig 5368: pkglint(1) program checks a pkgsrc entry for
5369: errors, lintpkgsrc(1) does various checks on the
5370: complete pkgsrc system.</p>
1.1 grant 5371: </li>
5372:
5373: <li>
5374: <p><a xmlns=
5375: "http://www.w3.org/TR/xhtml1/transitional" href=
5376: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45 wiz 5377: target="_top"><code xmlns="" class=
5378: "filename">pkgtools/pkgsurvey</code></a>: Report
5379: what packages you have installed.</p>
1.1 grant 5380: </li>
5381: </ul>
5382: </div>
5383:
5384: <p>Utilities for people maintaining or creating
5385: individual packages:</p>
5386:
5387: <div class="itemizedlist">
5388: <ul type="disc">
5389: <li>
5390: <p><a xmlns=
5391: "http://www.w3.org/TR/xhtml1/transitional" href=
5392: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 5393: target="_top"><code xmlns="" class=
5394: "filename">pkgtools/pkgdiff</code></a>: Automate
1.20 ben 5395: making and maintaining patches for a package
1.34 wiz 5396: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 5397: </li>
5398:
5399: <li>
5400: <p><a xmlns=
5401: "http://www.w3.org/TR/xhtml1/transitional" href=
5402: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45 wiz 5403: target="_top"><code xmlns="" class=
5404: "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20 ben 5405: "http://www.w3.org/TR/xhtml1/transitional" href=
5406: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 5407: target="_top"><code xmlns="" class=
5408: "filename">pkgtools/url2pkg</code></a>: Aids in
1.34 wiz 5409: converting to pkgsrc.</p>
1.1 grant 5410: </li>
5411:
5412: <li>
5413: <p><a xmlns=
5414: "http://www.w3.org/TR/xhtml1/transitional" href=
5415: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45 wiz 5416: target="_top"><code xmlns="" class=
5417: "filename">pkgtools/gensolpkg</code></a>: Convert
1.34 wiz 5418: pkgsrc to a Solaris package.</p>
1.1 grant 5419: </li>
5420: </ul>
5421: </div>
5422:
1.47 reed 5423: <p>Utilities for people maintaining pkgsrc (or: more
1.1 grant 5424: obscure pkg utilities)</p>
5425:
5426: <div class="itemizedlist">
5427: <ul type="disc">
5428: <li>
5429: <p><a xmlns=
5430: "http://www.w3.org/TR/xhtml1/transitional" href=
5431: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45 wiz 5432: target="_top"><code xmlns="" class=
5433: "filename">pkgtools/pkg_comp</code></a>: Build
1.34 wiz 5434: packages in a chrooted area.</p>
1.1 grant 5435: </li>
5436:
5437: <li>
5438: <p><a xmlns=
5439: "http://www.w3.org/TR/xhtml1/transitional" href=
5440: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45 wiz 5441: target="_top"><code xmlns="" class=
5442: "filename">pkgtools/libkver</code></a>: Spoof
5443: kernel version for chrooted cross builds.</p>
1.1 grant 5444: </li>
5445: </ul>
5446: </div>
5447: </div>
5448:
1.67 hubertf 5449: <div class="sect1" lang="en">
1.1 grant 5450: <div class="titlepage">
5451: <div>
5452: <div>
5453: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5454: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 5455: as non-root</h2>
1.1 grant 5456: </div>
5457: </div>
5458: </div>
5459:
5460: <p>If you want to use pkgsrc as non-root user, you can
5461: set some variables to make pkgsrc work under these
1.33 jmmv 5462: conditions. At the very least, you need to set
5463: <code class="varname">UNPRIVILEGED</code> to
5464: “<span class="quote">yes</span>”; this will
5465: turn on unprivileged mode and set multiple related
5466: variables to allow installation of packages as
5467: non-root.</p>
5468:
5469: <p>In case the defaults are not enough, you may want to
5470: tune some other variables used. For example, if the
5471: automatic user/group detection leads to incorrect values
5472: (or not the ones you would like to use), you can change
5473: them by setting <code class=
5474: "varname">UNPRIVILEGED_USER</code> and <code class=
5475: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
5476:
5477: <p>As regards bootstrapping, please note that the
5478: <span><strong class="command">bootstrap</strong></span>
5479: script will ease non-root configuration when given the
5480: “<span class=
5481: "quote">--ignore-user-check</span>” flag, as it
5482: will choose and use multiple default directories under
1.45 wiz 5483: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5484: class="filename">~/pkg</code> as the installation
1.33 jmmv 5485: targets. These directories can be overriden by the
5486: “<span class="quote">--prefix</span>” flag
5487: provided by the script, as well as some others that allow
5488: finer tuning of the tree layout.</p>
1.14 xtraeme 5489: </div>
5490:
1.67 hubertf 5491: <div class="sect1" lang="en">
1.14 xtraeme 5492: <div class="titlepage">
5493: <div>
5494: <div>
5495: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5496: "resume-transfers"></a>7.5. How to resume
1.30 wiz 5497: transfers when fetching distfiles?</h2>
1.14 xtraeme 5498: </div>
5499: </div>
5500: </div>
5501:
1.47 reed 5502: <p>By default, resuming transfers in pkgsrc is disabled,
1.15 xtraeme 5503: but you can enable this feature by adding the option
5504: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45 wiz 5505: into <code xmlns=
5506: "http://www.w3.org/TR/xhtml1/transitional" class=
5507: "filename">/etc/mk.conf</code>. If, during a fetch step,
5508: an incomplete distfile is found, pkgsrc will try to
5509: resume it.</p>
1.15 xtraeme 5510:
5511: <p>You can also use a different program than the default
1.24 wiz 5512: <a href=
5513: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5514: <span class="citerefentry"><span class=
5515: "refentrytitle">ftp</span>(1)</span></a> by changing the
5516: <code class="varname">FETCH_CMD</code> variable. Don't
5517: forget to set <code class=
5518: "varname">FETCH_RESUME_ARGS</code> and <code class=
5519: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
5520: default values.</p>
1.14 xtraeme 5521:
1.45 wiz 5522: <p>For example, if you want to use <code xmlns=
5523: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5524: "filename">wget</code> to resume downloads, you'll have
5525: to use something like:</p>
5526: <pre class="programlisting">
1.51 rillig 5527: FETCH_CMD= wget
5528: FETCH_BEFORE_ARGS= --passive-ftp
5529: FETCH_RESUME_ARGS= -c
5530: FETCH_OUTPUT_ARGS= -O
1.14 xtraeme 5531: </pre>
1.1 grant 5532: </div>
5533:
1.67 hubertf 5534: <div class="sect1" lang="en">
1.1 grant 5535: <div class="titlepage">
5536: <div>
5537: <div>
5538: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5539: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 5540: install/use XFree86 from pkgsrc?</h2>
5541: </div>
5542: </div>
5543: </div>
5544:
5545: <p>If you want to use XFree86 from pkgsrc instead of your
1.45 wiz 5546: system's own X11 (<code xmlns=
5547: "http://www.w3.org/TR/xhtml1/transitional" class=
5548: "filename">/usr/X11R6</code>, <code xmlns=
5549: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5550: "filename">/usr/openwin</code>, ...), you will have to
1.45 wiz 5551: add the following line into <code xmlns=
5552: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5553: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5554: <pre class="programlisting">
1.51 rillig 5555: X11_TYPE=XFree86
1.1 grant 5556: </pre>
5557: </div>
5558:
1.67 hubertf 5559: <div class="sect1" lang="en">
1.1 grant 5560: <div class="titlepage">
5561: <div>
5562: <div>
5563: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5564: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 5565: install/use X.org from pkgsrc?</h2>
5566: </div>
5567: </div>
5568: </div>
5569:
5570: <p>If you want to use X.org from pkgsrc instead of your
1.45 wiz 5571: system's own X11 (<code xmlns=
5572: "http://www.w3.org/TR/xhtml1/transitional" class=
5573: "filename">/usr/X11R6</code>, <code xmlns=
5574: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5575: "filename">/usr/openwin</code>, ...) you will have to add
1.45 wiz 5576: the following line into <code xmlns=
5577: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5578: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5579: <pre class="programlisting">
1.51 rillig 5580: X11_TYPE=xorg
1.1 grant 5581: </pre>
5582: </div>
5583:
1.67 hubertf 5584: <div class="sect1" lang="en">
1.1 grant 5585: <div class="titlepage">
5586: <div>
5587: <div>
5588: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5589: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 5590: files from behind a firewall</h2>
1.1 grant 5591: </div>
5592: </div>
5593: </div>
5594:
5595: <p>If you are sitting behind a firewall which does not
5596: allow direct connections to Internet hosts (i.e.
5597: non-NAT), you may specify the relevant proxy hosts. This
5598: is done using an environment variable in the form of a
1.47 reed 5599: URL, e.g. in Amdahl, the machine “<span class=
1.1 grant 5600: "quote">orpheus.amdahl.com</span>” is one of the
5601: firewalls, and it uses port 80 as the proxy port number.
5602: So the proxy environment variables are:</p>
5603: <pre class="programlisting">
1.51 rillig 5604: ftp_proxy=ftp://orpheus.amdahl.com:80/
5605: http_proxy=http://orpheus.amdahl.com:80/
1.1 grant 5606: </pre>
5607: </div>
5608:
1.67 hubertf 5609: <div class="sect1" lang="en">
1.1 grant 5610: <div class="titlepage">
5611: <div>
5612: <div>
5613: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 5614: "passive-ftp"></a>7.9. How do I tell
5615: <span><strong class="command">make
1.14 xtraeme 5616: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 5617: </div>
5618: </div>
5619: </div>
5620:
5621: <p>This depends on which utility is used to retrieve
1.45 wiz 5622: distfiles. From <code xmlns=
5623: "http://www.w3.org/TR/xhtml1/transitional" class=
5624: "filename">bsd.pkg.mk</code>, <code class=
5625: "varname">FETCH_CMD</code> is assigned the first
5626: available command from the following list:</p>
1.34 wiz 5627:
5628: <div class="itemizedlist">
5629: <ul type="disc">
5630: <li>
1.45 wiz 5631: <p><code xmlns=
5632: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5633: "filename">${LOCALBASE}/bin/ftp</code></p>
5634: </li>
5635:
5636: <li>
1.45 wiz 5637: <p><code xmlns=
5638: "http://www.w3.org/TR/xhtml1/transitional" class=
5639: "filename">/usr/bin/ftp</code></p>
1.34 wiz 5640: </li>
5641: </ul>
5642: </div>
1.1 grant 5643:
5644: <p>On a default NetBSD installation, this will be
1.45 wiz 5645: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5646: class="filename">/usr/bin/ftp</code>, which automatically
5647: tries passive connections first, and falls back to active
5648: connections if the server refuses to do passive. For the
5649: other tools, add the following to your <code xmlns=
5650: "http://www.w3.org/TR/xhtml1/transitional" class=
5651: "filename">/etc/mk.conf</code> file: <code class=
5652: "varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 5653:
1.45 wiz 5654: <p>Having that option present will prevent <code xmlns=
5655: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5656: "filename">/usr/bin/ftp</code> from falling back to
5657: active transfers.</p>
1.1 grant 5658: </div>
5659:
1.67 hubertf 5660: <div class="sect1" lang="en">
1.1 grant 5661: <div class="titlepage">
5662: <div>
5663: <div>
5664: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5665: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 5666: fetch all distfiles at once</h2>
5667: </div>
5668: </div>
5669: </div>
5670:
5671: <p>You would like to download all the distfiles in a
5672: single batch from work or university, where you can't run
1.14 xtraeme 5673: a <span><strong class="command">make
5674: fetch</strong></span>. There is an archive of distfiles
5675: on <a href=
1.1 grant 5676: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
5677: target="_top">ftp.NetBSD.org</a>, but downloading the
5678: entire directory may not be appropriate.</p>
5679:
1.14 xtraeme 5680: <p>The answer here is to do a <span><strong class=
1.45 wiz 5681: "command">make fetch-list</strong></span> in <code xmlns=
5682: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 5683: "filename">/usr/pkgsrc</code> or one of its
1.1 grant 5684: subdirectories, carry the resulting list to your machine
1.23 wiz 5685: at work/school and use it there. If you don't have a
1.24 wiz 5686: NetBSD-compatible <a href=
5687: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5688: <span class="citerefentry"><span class=
5689: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
5690: at work, don't forget to set <code class=
5691: "varname">FETCH_CMD</code> to something that fetches a
5692: URL:</p>
1.1 grant 5693:
5694: <p>At home:</p>
5695: <pre class="screen">
1.14 xtraeme 5696: <code class="prompt">%</code> <strong class=
5697: "userinput"><code>cd /usr/pkgsrc</code></strong>
5698: <code class="prompt">%</code> <strong class=
5699: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
5700: <code class="prompt">%</code> <strong class=
5701: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 5702: </pre>
5703:
5704: <p>At work:</p>
5705: <pre class="screen">
1.14 xtraeme 5706: <code class="prompt">%</code> <strong class=
5707: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 5708: </pre>
5709:
1.45 wiz 5710: <p>then tar up <code xmlns=
5711: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5712: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 5713:
5714: <p>If you have a machine running NetBSD, and you want to
5715: get <span class="emphasis"><em>all</em></span> distfiles
5716: (even ones that aren't for your machine architecture),
5717: you can do so by using the above-mentioned
1.14 xtraeme 5718: <span><strong class="command">make
5719: fetch-list</strong></span> approach, or fetch the
5720: distfiles directly by running:</p>
1.1 grant 5721: <pre class="screen">
1.14 xtraeme 5722: <code class="prompt">%</code> <strong class=
5723: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 5724: </pre>
5725:
1.14 xtraeme 5726: <p>If you even decide to ignore <code class=
5727: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
5728: can get everything by running:</p>
1.1 grant 5729: <pre class="screen">
1.14 xtraeme 5730: <code class="prompt">%</code> <strong class=
5731: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 5732: </pre>
5733: </div>
5734:
1.67 hubertf 5735: <div class="sect1" lang="en">
1.1 grant 5736: <div class="titlepage">
5737: <div>
5738: <div>
5739: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5740: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 5741: “<span class="quote">Don't know how to make
5742: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
5743: </div>
5744: </div>
5745: </div>
5746:
5747: <p>When compiling the <a xmlns=
5748: "http://www.w3.org/TR/xhtml1/transitional" href=
5749: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5750: target="_top"><code xmlns="" class=
5751: "filename">pkgtools/pkg_install</code></a> package, you
5752: get the error from make that it doesn't know how to make
5753: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5754: class="filename">/usr/share/tmac/tmac.andoc</code>? This
5755: indicates that you don't have installed the
1.23 wiz 5756: “<span class="quote">text</span>” set (nroff,
5757: ...) from the NetBSD base distribution on your machine.
1.47 reed 5758: It is recommended to do that to format man pages.</p>
1.1 grant 5759:
5760: <p>In the case of the <a xmlns=
5761: "http://www.w3.org/TR/xhtml1/transitional" href=
5762: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5763: target="_top"><code xmlns="" class=
5764: "filename">pkgtools/pkg_install</code></a> package, you
5765: can get away with setting <code class=
1.20 ben 5766: "varname">NOMAN=YES</code> either in the environment or
1.45 wiz 5767: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5768: class="filename">/etc/mk.conf</code>.</p>
1.1 grant 5769: </div>
5770:
1.67 hubertf 5771: <div class="sect1" lang="en">
1.1 grant 5772: <div class="titlepage">
5773: <div>
5774: <div>
5775: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5776: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 5777: “<span class="quote">Could not find
5778: bsd.own.mk</span>” mean?</h2>
5779: </div>
5780: </div>
5781: </div>
5782:
1.45 wiz 5783: <p>You didn't install the compiler set, <code xmlns=
5784: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5785: "filename">comp.tgz</code>, when you installed your
1.47 reed 5786: NetBSD machine. Please get and install it, by extracting
5787: it in <code xmlns=
1.45 wiz 5788: "http://www.w3.org/TR/xhtml1/transitional" class=
5789: "filename">/</code>:</p>
1.1 grant 5790: <pre class="screen">
1.14 xtraeme 5791: <code class="prompt">#</code> <strong class=
5792: "userinput"><code>cd /</code></strong>
5793: <code class="prompt">#</code> <strong class=
5794: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 5795: </pre>
5796:
1.45 wiz 5797: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5798: class="filename">comp.tgz</code> is part of every NetBSD
5799: release. Get the one that corresponds to your release
5800: (determine via <span><strong class="command">uname
5801: -r</strong></span>).</p>
1.1 grant 5802: </div>
5803:
1.67 hubertf 5804: <div class="sect1" lang="en">
1.1 grant 5805: <div class="titlepage">
5806: <div>
5807: <div>
5808: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5809: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 5810: 'sudo' with pkgsrc</h2>
5811: </div>
5812: </div>
5813: </div>
5814:
5815: <p>When installing packages as non-root user and using
1.24 wiz 5816: the just-in-time <a href=
5817: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
5818: <span class="citerefentry"><span class=
5819: "refentrytitle">su</span>(1)</span></a> feature of
5820: pkgsrc, it can become annoying to type in the root
5821: password for each required package installed. To avoid
5822: this, the sudo package can be used, which does password
5823: caching over a limited time. To use it, install sudo
5824: (either as binary package or from <a xmlns=
5825: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5826: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45 wiz 5827: target="_top"><code xmlns="" class=
5828: "filename">security/sudo</code></a>) and then put the
5829: following into your <code xmlns=
5830: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 5831: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5832: <pre class="programlisting">
1.51 rillig 5833: .if exists(${LOCALBASE}/bin/sudo)
5834: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
5835: .endif
1.1 grant 5836: </pre>
5837: </div>
5838:
1.67 hubertf 5839: <div class="sect1" lang="en">
1.1 grant 5840: <div class="titlepage">
5841: <div>
5842: <div>
5843: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 5844: "faq.conf"></a>7.14. How do I change the
5845: location of configuration files?</h2>
1.1 grant 5846: </div>
5847: </div>
5848: </div>
5849:
1.35 jmmv 5850: <p>As the system administrator, you can choose where
5851: configuration files are installed. The default settings
1.45 wiz 5852: make all these files go into <code xmlns=
5853: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 5854: "filename">${PREFIX}/etc</code> or some of its
5855: subdirectories; this may be suboptimal depending on your
5856: expectations (e.g., a read-only, NFS-exported
5857: <code class="varname">PREFIX</code> with a need of
5858: per-machine configuration of the provided packages).</p>
5859:
5860: <p>In order to change the defaults, you can modify the
5861: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45 wiz 5862: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5863: class="filename">/etc/mk.conf</code>) to point to your
5864: preferred configuration directory; some common examples
5865: include <code xmlns=
5866: "http://www.w3.org/TR/xhtml1/transitional" class=
5867: "filename">/etc</code> or <code xmlns=
5868: "http://www.w3.org/TR/xhtml1/transitional" class=
5869: "filename">/etc/pkg</code>.</p>
1.35 jmmv 5870:
5871: <p>Furthermore, you can change this value on a
5872: per-package basis by setting the <code class=
5873: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
5874: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
5875: value usually matches the name of the package you would
5876: like to modify, that is, the contents of <code class=
5877: "varname">PKGBASE</code>.</p>
1.1 grant 5878:
1.47 reed 5879: <p>Note that after changing these settings, you must
1.35 jmmv 5880: rebuild and reinstall any affected packages.</p>
1.1 grant 5881: </div>
5882:
1.67 hubertf 5883: <div class="sect1" lang="en">
1.1 grant 5884: <div class="titlepage">
5885: <div>
5886: <div>
5887: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5888: "audit-packages"></a>7.15. Automated security
1.1 grant 5889: checks</h2>
5890: </div>
5891: </div>
5892: </div>
5893:
5894: <p>Please be aware that there can often be bugs in
5895: third-party software, and some of these bugs can leave a
5896: machine vulnerable to exploitation by attackers. In an
5897: effort to lessen the exposure, the NetBSD packages team
5898: maintains a database of known-exploits to packages which
5899: have at one time been included in pkgsrc. The database
5900: can be downloaded automatically, and a security audit of
5901: all packages installed on a system can take place. To do
5902: this, install the <a xmlns=
5903: "http://www.w3.org/TR/xhtml1/transitional" href=
5904: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5905: target="_top"><code xmlns="" class=
5906: "filename">security/audit-packages</code></a> package. It
1.20 ben 5907: has two components:</p>
1.1 grant 5908:
5909: <div class="orderedlist">
5910: <ol type="1">
5911: <li>
1.34 wiz 5912: <p><span><strong class=
5913: "command">download-vulnerability-list</strong></span>,
1.1 grant 5914: an easy way to download a list of the security
5915: vulnerabilities information. This list is kept up
5916: to date by the NetBSD security officer and the
5917: NetBSD packages team, and is distributed from the
5918: NetBSD ftp server:</p>
5919:
5920: <p><a href=
5921: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 5922: target=
5923: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 5924: </li>
5925:
5926: <li>
1.34 wiz 5927: <p><span><strong class=
5928: "command">audit-packages</strong></span>, an easy
5929: way to audit the current machine, checking each
1.1 grant 5930: vulnerability which is known. If a vulnerable
5931: package is installed, it will be shown by output to
5932: stdout, including a description of the type of
5933: vulnerability, and a URL containing more
5934: information.</p>
5935: </li>
5936: </ol>
5937: </div>
5938:
1.23 wiz 5939: <p>Use of the <a xmlns=
5940: "http://www.w3.org/TR/xhtml1/transitional" href=
5941: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5942: target="_top"><code xmlns="" class=
5943: "filename">security/audit-packages</code></a> package is
1.23 wiz 5944: strongly recommended! After “<span class=
5945: "quote">audit-packages</span>” is installed, please
5946: read the package's message, which you can get by running
5947: <strong class="userinput"><code>pkg_info -D
1.65 hubertf 5948: audit-packages</code></strong>.</p>
1.58 erh 5949:
5950: <p>If this package is installed, pkgsrc builds will use
5951: it to perform a security check before building any
5952: package. See <a href="#variables-affecting-build" title=
5953: "5.2. Variables affecting the build process">Section 5.2,
5954: “Variables affecting the build process”</a>
1.59 rillig 5955: for ways to control this check.</p>
1.1 grant 5956: </div>
5957: </div>
5958: </div>
5959:
1.67 hubertf 5960: <div class="part" lang="en">
1.1 grant 5961: <div class="titlepage">
5962: <div>
5963: <div>
1.67 hubertf 5964: <h1 class="title"><a name=
1.48 dillo 5965: "developers-guide"></a>Part II. The pkgsrc
5966: developer's guide</h1>
1.1 grant 5967: </div>
5968: </div>
5969: </div>
5970:
5971: <div class="toc">
5972: <p><b>Table of Contents</b></p>
5973:
5974: <dl>
1.38 dillo 5975: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 5976: Package components - files, directories and
5977: contents</a></span></dt>
5978:
5979: <dd>
5980: <dl>
5981: <dt><span class="sect1"><a href=
1.45 wiz 5982: "#components.Makefile">8.1. <code xmlns=
5983: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5984: "filename">Makefile</code></a></span></dt>
5985:
5986: <dt><span class="sect1"><a href=
1.45 wiz 5987: "#components.distinfo">8.2. <code xmlns=
5988: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5989: "filename">distinfo</code></a></span></dt>
5990:
5991: <dt><span class="sect1"><a href=
1.38 dillo 5992: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 5993:
1.30 wiz 5994: <dt><span class="sect1"><a href=
1.38 dillo 5995: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 5996: files</a></span></dt>
1.27 rillig 5997:
5998: <dt><span class="sect1"><a href=
1.38 dillo 5999: "#components.optional">8.5. Optional
1.27 rillig 6000: files</a></span></dt>
6001:
1.38 dillo 6002: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6003: <code xmlns=
6004: "http://www.w3.org/TR/xhtml1/transitional" class=
6005: "filename">work*</code></a></span></dt>
1.27 rillig 6006:
1.38 dillo 6007: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6008: <code xmlns=
6009: "http://www.w3.org/TR/xhtml1/transitional" class=
6010: "filename">files/*</code></a></span></dt>
1.27 rillig 6011: </dl>
6012: </dd>
6013:
1.38 dillo 6014: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 6015: Programming in <code xmlns=
6016: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 6017: "filename">Makefile</code>s</a></span></dt>
6018:
6019: <dd>
6020: <dl>
6021: <dt><span class="sect1"><a href=
1.45 wiz 6022: "#makefile.variables">9.1. <code xmlns=
6023: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 6024: "filename">Makefile</code> variables</a></span></dt>
6025:
1.27 rillig 6026: <dd>
6027: <dl>
6028: <dt><span class="sect2"><a href=
1.38 dillo 6029: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 6030: conventions</a></span></dt>
6031: </dl>
6032: </dd>
6033:
1.38 dillo 6034: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 6035: Code snippets</a></span></dt>
6036:
6037: <dd>
6038: <dl>
6039: <dt><span class="sect2"><a href=
1.38 dillo 6040: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 6041: list</a></span></dt>
6042:
6043: <dt><span class="sect2"><a href=
1.38 dillo 6044: "#converting-internal-to-external">9.2.2.
1.30 wiz 6045: Converting an internal list into an external
6046: list</a></span></dt>
1.25 rillig 6047:
6048: <dt><span class="sect2"><a href=
1.38 dillo 6049: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 6050: variables to a shell command</a></span></dt>
1.27 rillig 6051:
6052: <dt><span class="sect2"><a href=
1.38 dillo 6053: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 6054: guideline</a></span></dt>
6055:
6056: <dt><span class="sect2"><a href=
1.38 dillo 6057: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 6058: a bug in BSD Make</a></span></dt>
1.25 rillig 6059: </dl>
6060: </dd>
6061: </dl>
6062: </dd>
6063:
1.38 dillo 6064: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 6065: issues</a></span></dt>
6066:
6067: <dd>
6068: <dl>
1.38 dillo 6069: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 6070: ID</a></span></dt>
6071:
1.30 wiz 6072: <dt><span class="sect1"><a href=
1.38 dillo 6073: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 6074: <code xmlns=
6075: "http://www.w3.org/TR/xhtml1/transitional" class=
6076: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 6077:
1.38 dillo 6078: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 6079: Tweaking output of <span><strong class="command">make
6080: print-PLIST</strong></span></a></span></dt>
1.1 grant 6081:
1.38 dillo 6082: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 6083: Variable substitution in PLIST</a></span></dt>
6084:
1.30 wiz 6085: <dt><span class="sect1"><a href=
1.48 dillo 6086: "#manpage-compression">10.5. Man page
6087: compression</a></span></dt>
1.1 grant 6088:
1.30 wiz 6089: <dt><span class="sect1"><a href=
1.38 dillo 6090: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 6091: <code class=
1.14 xtraeme 6092: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 6093:
1.30 wiz 6094: <dt><span class="sect1"><a href=
1.47 reed 6095: "#platform-specific-plist">10.7. Platform-specific
1.38 dillo 6096: and differing PLISTs</a></span></dt>
1.1 grant 6097:
6098: <dt><span class="sect1"><a href=
1.38 dillo 6099: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 6100: packages</a></span></dt>
6101: </dl>
6102: </dd>
6103:
1.38 dillo 6104: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 6105: Buildlink methodology</a></span></dt>
6106:
6107: <dd>
6108: <dl>
1.30 wiz 6109: <dt><span class="sect1"><a href=
1.38 dillo 6110: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 6111: to use buildlink3</a></span></dt>
1.1 grant 6112:
1.30 wiz 6113: <dt><span class="sect1"><a href=
1.45 wiz 6114: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
6115: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6116: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 6117:
6118: <dd>
6119: <dl>
6120: <dt><span class="sect2"><a href=
1.38 dillo 6121: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 6122: buildlink3.mk file</a></span></dt>
1.1 grant 6123:
6124: <dt><span class="sect2"><a href=
1.38 dillo 6125: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 6126: <code class=
1.67 hubertf 6127: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
6128: in <code xmlns=
1.45 wiz 6129: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6130: "filename">buildlink3.mk</code>
1.1 grant 6131: files</a></span></dt>
6132: </dl>
6133: </dd>
6134:
1.30 wiz 6135: <dt><span class="sect1"><a href=
1.45 wiz 6136: "#writing-builtin.mk">11.3. Writing <code xmlns=
6137: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6138: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 6139:
6140: <dd>
6141: <dl>
6142: <dt><span class="sect2"><a href=
1.38 dillo 6143: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 6144: <code xmlns=
6145: "http://www.w3.org/TR/xhtml1/transitional" class=
6146: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 6147:
6148: <dt><span class="sect2"><a href=
1.38 dillo 6149: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 6150: preferences for native or pkgsrc
6151: software</a></span></dt>
1.1 grant 6152: </dl>
6153: </dd>
6154: </dl>
6155: </dd>
6156:
1.38 dillo 6157: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 6158: pkginstall framework</a></span></dt>
6159:
6160: <dd>
6161: <dl>
6162: <dt><span class="sect1"><a href=
1.38 dillo 6163: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 6164: directories outside the installation
6165: prefix</a></span></dt>
6166:
6167: <dd>
6168: <dl>
6169: <dt><span class="sect2"><a href=
1.38 dillo 6170: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 6171: manipulation</a></span></dt>
6172:
6173: <dt><span class="sect2"><a href=
1.38 dillo 6174: "#files-outside-prefix">12.1.2. File
1.35 jmmv 6175: manipulation</a></span></dt>
6176: </dl>
6177: </dd>
6178:
1.38 dillo 6179: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 6180: Configuration files</a></span></dt>
6181:
6182: <dd>
6183: <dl>
6184: <dt><span class="sect2"><a href=
1.38 dillo 6185: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 6186: "varname">PKG_SYSCONFDIR</code> is
6187: set</a></span></dt>
6188:
6189: <dt><span class="sect2"><a href=
1.38 dillo 6190: "#conf-files-configure">12.2.2. Telling the
1.47 reed 6191: software where configuration files
1.35 jmmv 6192: are</a></span></dt>
6193:
6194: <dt><span class="sect2"><a href=
1.38 dillo 6195: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 6196: installations</a></span></dt>
6197:
6198: <dt><span class="sect2"><a href=
1.38 dillo 6199: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 6200: of configuration files</a></span></dt>
6201: </dl>
6202: </dd>
6203:
1.38 dillo 6204: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 6205: System startup scripts</a></span></dt>
6206:
6207: <dd>
6208: <dl>
6209: <dt><span class="sect2"><a href=
1.38 dillo 6210: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 6211: of system startup scripts</a></span></dt>
6212: </dl>
6213: </dd>
6214:
6215: <dt><span class="sect1"><a href=
1.38 dillo 6216: "#users-and-groups">12.4. System users and
1.35 jmmv 6217: groups</a></span></dt>
6218:
1.38 dillo 6219: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 6220: System shells</a></span></dt>
6221:
6222: <dd>
6223: <dl>
6224: <dt><span class="sect2"><a href=
1.65 hubertf 6225: "#shells-disable">12.5.1. Disabling shell
6226: registration</a></span></dt>
6227: </dl>
6228: </dd>
6229:
6230: <dt><span class="sect1"><a href="#fonts">12.6.
6231: Fonts</a></span></dt>
6232:
6233: <dd>
6234: <dl>
6235: <dt><span class="sect2"><a href=
6236: "#fonts-disable">12.6.1. Disabling automatic
6237: update of the fonts databases</a></span></dt>
1.35 jmmv 6238: </dl>
6239: </dd>
6240: </dl>
6241: </dd>
6242:
1.38 dillo 6243: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 6244: handling</a></span></dt>
6245:
6246: <dd>
6247: <dl>
1.30 wiz 6248: <dt><span class="sect1"><a href=
1.38 dillo 6249: "#global-default-options">13.1. Global default
1.30 wiz 6250: options</a></span></dt>
1.1 grant 6251:
1.30 wiz 6252: <dt><span class="sect1"><a href=
1.38 dillo 6253: "#converting-to-options">13.2. Converting packages to
1.45 wiz 6254: use <code xmlns=
6255: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6256: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 6257:
6258: <dt><span class="sect1"><a href="#option-names">13.3.
6259: Option Names</a></span></dt>
1.1 grant 6260: </dl>
6261: </dd>
6262:
1.38 dillo 6263: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 6264: process</a></span></dt>
6265:
6266: <dd>
6267: <dl>
1.56 rillig 6268: <dt><span class="sect1"><a href="#build.intro">14.1.
6269: Introduction</a></span></dt>
6270:
6271: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 6272: Program location</a></span></dt>
6273:
1.56 rillig 6274: <dt><span class="sect1"><a href=
6275: "#build.builddirs">14.3. Directories used during the
6276: build process</a></span></dt>
1.1 grant 6277:
6278: <dt><span class="sect1"><a href=
1.56 rillig 6279: "#build.running">14.4. Running a
6280: phase</a></span></dt>
6281:
6282: <dt><span class="sect1"><a href="#build.fetch">14.5.
6283: The <span class="emphasis"><em>fetch</em></span>
6284: phase</a></span></dt>
6285:
6286: <dt><span class="sect1"><a href=
6287: "#build.checksum">14.6. The <span class=
6288: "emphasis"><em>checksum</em></span>
6289: phase</a></span></dt>
6290:
6291: <dt><span class="sect1"><a href=
6292: "#build.extract">14.7. The <span class=
6293: "emphasis"><em>extract</em></span>
6294: phase</a></span></dt>
6295:
6296: <dt><span class="sect1"><a href="#build.patch">14.8.
6297: The <span class="emphasis"><em>patch</em></span>
6298: phase</a></span></dt>
6299:
6300: <dt><span class="sect1"><a href="#build.tools">14.9.
6301: The <span class="emphasis"><em>tools</em></span>
6302: phase</a></span></dt>
6303:
6304: <dt><span class="sect1"><a href=
6305: "#build.wrapper">14.10. The <span class=
6306: "emphasis"><em>wrapper</em></span>
6307: phase</a></span></dt>
6308:
6309: <dt><span class="sect1"><a href=
6310: "#build.configure">14.11. The <span class=
6311: "emphasis"><em>configure</em></span>
6312: phase</a></span></dt>
6313:
6314: <dt><span class="sect1"><a href="#build.build">14.12.
6315: The <span class="emphasis"><em>build</em></span>
6316: phase</a></span></dt>
6317:
6318: <dt><span class="sect1"><a href="#build.test">14.13.
6319: The <span class="emphasis"><em>test</em></span>
6320: phase</a></span></dt>
6321:
6322: <dt><span class="sect1"><a href=
6323: "#build.install">14.14. The <span class=
6324: "emphasis"><em>install</em></span>
6325: phase</a></span></dt>
6326:
6327: <dt><span class="sect1"><a href=
6328: "#build.package">14.15. The <span class=
6329: "emphasis"><em>package</em></span>
6330: phase</a></span></dt>
6331:
6332: <dt><span class="sect1"><a href=
6333: "#build.helpful-targets">14.16. Other helpful
1.1 grant 6334: targets</a></span></dt>
6335: </dl>
6336: </dd>
6337:
1.68 ! rillig 6338: <dt><span class="chapter"><a href="#tools">15. Tools
! 6339: needed for building or running</a></span></dt>
! 6340:
! 6341: <dd>
! 6342: <dl>
! 6343: <dt><span class="sect1"><a href="#pkgsrc-tools">15.1.
! 6344: Tools for pkgsrc builds</a></span></dt>
! 6345:
! 6346: <dt><span class="sect1"><a href=
! 6347: "#package-tools">15.2. Tools needed by
! 6348: packages</a></span></dt>
! 6349:
! 6350: <dt><span class="sect1"><a href=
! 6351: "#platform-tools">15.3. Tools provided by
! 6352: platforms</a></span></dt>
! 6353: </dl>
! 6354: </dd>
! 6355:
! 6356: <dt><span class="chapter"><a href="#fixes">16. Making
1.55 rillig 6357: your package work</a></span></dt>
1.1 grant 6358:
6359: <dd>
6360: <dl>
1.30 wiz 6361: <dt><span class="sect1"><a href=
1.68 ! rillig 6362: "#general-operation">16.1. General
1.30 wiz 6363: operation</a></span></dt>
1.1 grant 6364:
6365: <dd>
6366: <dl>
6367: <dt><span class="sect2"><a href=
1.68 ! rillig 6368: "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30 wiz 6369: pull in variables from
6370: /etc/mk.conf</a></span></dt>
1.1 grant 6371:
6372: <dt><span class="sect2"><a href=
1.68 ! rillig 6373: "#where-to-install-documentation">16.1.2. Where
1.31 wiz 6374: to install documentation</a></span></dt>
6375:
6376: <dt><span class="sect2"><a href=
1.68 ! rillig 6377: "#restricted-packages">16.1.3. Restricted
1.1 grant 6378: packages</a></span></dt>
6379:
6380: <dt><span class="sect2"><a href=
1.68 ! rillig 6381: "#dependencies">16.1.4. Handling
1.1 grant 6382: dependencies</a></span></dt>
6383:
6384: <dt><span class="sect2"><a href=
1.68 ! rillig 6385: "#conflicts">16.1.5. Handling conflicts with
1.1 grant 6386: other packages</a></span></dt>
6387:
6388: <dt><span class="sect2"><a href=
1.68 ! rillig 6389: "#not-building-packages">16.1.6. Packages that
1.30 wiz 6390: cannot or should not be built</a></span></dt>
1.1 grant 6391:
6392: <dt><span class="sect2"><a href=
1.68 ! rillig 6393: "#undeletable-packages">16.1.7. Packages which
1.30 wiz 6394: should not be deleted, once
6395: installed</a></span></dt>
1.1 grant 6396:
6397: <dt><span class="sect2"><a href=
1.68 ! rillig 6398: "#security-handling">16.1.8. Handling packages
1.1 grant 6399: with security problems</a></span></dt>
6400:
6401: <dt><span class="sect2"><a href=
1.68 ! rillig 6402: "#compiler-bugs">16.1.9. How to handle compiler
1.1 grant 6403: bugs</a></span></dt>
6404:
6405: <dt><span class="sect2"><a href=
1.68 ! rillig 6406: "#bumping-pkgrevision">16.1.10. How to handle
1.30 wiz 6407: incrementing versions when fixing an existing
1.1 grant 6408: package</a></span></dt>
6409:
6410: <dt><span class="sect2"><a href=
1.68 ! rillig 6411: "#portability-of-packages">16.1.11. Portability
1.30 wiz 6412: of packages</a></span></dt>
1.1 grant 6413: </dl>
6414: </dd>
6415:
1.30 wiz 6416: <dt><span class="sect1"><a href=
1.68 ! rillig 6417: "#downloading-issues">16.2. Possible downloading
1.30 wiz 6418: issues</a></span></dt>
1.1 grant 6419:
6420: <dd>
6421: <dl>
6422: <dt><span class="sect2"><a href=
1.68 ! rillig 6423: "#no-plain-download">16.2.1. Packages whose
1.30 wiz 6424: distfiles aren't available for plain
1.1 grant 6425: downloading</a></span></dt>
6426:
6427: <dt><span class="sect2"><a href=
1.68 ! rillig 6428: "#modified-distfiles-same-name">16.2.2. How to
1.30 wiz 6429: handle modified distfiles with the 'old'
6430: name</a></span></dt>
1.1 grant 6431: </dl>
6432: </dd>
6433:
1.30 wiz 6434: <dt><span class="sect1"><a href=
1.68 ! rillig 6435: "#configuration-gotchas">16.3. Configuration
1.30 wiz 6436: gotchas</a></span></dt>
1.1 grant 6437:
6438: <dd>
6439: <dl>
6440: <dt><span class="sect2"><a href=
1.68 ! rillig 6441: "#fixes.libtool">16.3.1. Shared libraries -
1.1 grant 6442: libtool</a></span></dt>
6443:
6444: <dt><span class="sect2"><a href=
1.68 ! rillig 6445: "#using-libtool">16.3.2. Using libtool on GNU
1.1 grant 6446: packages that already support
6447: libtool</a></span></dt>
6448:
6449: <dt><span class="sect2"><a href=
1.68 ! rillig 6450: "#autoconf-automake">16.3.3. GNU
1.1 grant 6451: Autoconf/Automake</a></span></dt>
6452: </dl>
6453: </dd>
6454:
1.68 ! rillig 6455: <dt><span class="sect1"><a href="#fixes-build">16.4.
1.55 rillig 6456: Building the package</a></span></dt>
1.1 grant 6457:
6458: <dd>
6459: <dl>
6460: <dt><span class="sect2"><a href=
1.68 ! rillig 6461: "#cpp-defines">16.4.1. CPP
1.30 wiz 6462: defines</a></span></dt>
1.51 rillig 6463:
6464: <dt><span class="sect2"><a href=
1.68 ! rillig 6465: "#cpp-list-examples">16.4.2. Examples of CPP
1.60 rillig 6466: defines for some platforms</a></span></dt>
6467:
6468: <dt><span class="sect2"><a href=
1.68 ! rillig 6469: "#cpp-list">16.4.3. Getting a list of CPP
1.51 rillig 6470: defines</a></span></dt>
1.1 grant 6471: </dl>
6472: </dd>
6473:
1.30 wiz 6474: <dt><span class="sect1"><a href=
1.68 ! rillig 6475: "#package-specific-actions">16.5. Package specific
1.30 wiz 6476: actions</a></span></dt>
1.1 grant 6477:
6478: <dd>
6479: <dl>
6480: <dt><span class="sect2"><a href=
1.68 ! rillig 6481: "#user-interaction">16.5.1. User
1.2 hubertf 6482: interaction</a></span></dt>
1.1 grant 6483:
6484: <dt><span class="sect2"><a href=
1.68 ! rillig 6485: "#handling-licenses">16.5.2. Handling
1.1 grant 6486: licenses</a></span></dt>
6487:
6488: <dt><span class="sect2"><a href=
1.68 ! rillig 6489: "#installing-score-files">16.5.3. Installing
1.30 wiz 6490: score files</a></span></dt>
1.1 grant 6491:
6492: <dt><span class="sect2"><a href=
1.68 ! rillig 6493: "#perl-scripts">16.5.4. Packages containing perl
1.1 grant 6494: scripts</a></span></dt>
6495:
6496: <dt><span class="sect2"><a href=
1.68 ! rillig 6497: "#hardcoded-paths">16.5.5. Packages with
1.30 wiz 6498: hardcoded paths to other
6499: interpreters</a></span></dt>
1.1 grant 6500:
6501: <dt><span class="sect2"><a href=
1.68 ! rillig 6502: "#perl-modules">16.5.6. Packages installing perl
1.1 grant 6503: modules</a></span></dt>
6504:
6505: <dt><span class="sect2"><a href=
1.68 ! rillig 6506: "#faq.info-files">16.5.7. Packages installing
1.1 grant 6507: info files</a></span></dt>
6508:
6509: <dt><span class="sect2"><a href=
1.68 ! rillig 6510: "#manpages">16.5.8. Packages installing man
1.57 minskim 6511: pages</a></span></dt>
6512:
6513: <dt><span class="sect2"><a href=
1.68 ! rillig 6514: "#gconf2-data-files">16.5.9. Packages installing
1.30 wiz 6515: GConf2 data files</a></span></dt>
1.1 grant 6516:
6517: <dt><span class="sect2"><a href=
1.68 ! rillig 6518: "#scrollkeeper-data-files">16.5.10. Packages
1.30 wiz 6519: installing scrollkeeper data
6520: files</a></span></dt>
1.1 grant 6521:
6522: <dt><span class="sect2"><a href=
1.68 ! rillig 6523: "#x11-fonts">16.5.11. Packages installing X11
1.1 grant 6524: fonts</a></span></dt>
6525:
6526: <dt><span class="sect2"><a href=
1.68 ! rillig 6527: "#gtk2-modules">16.5.12. Packages installing GTK2
1.1 grant 6528: modules</a></span></dt>
6529:
6530: <dt><span class="sect2"><a href=
1.68 ! rillig 6531: "#sgml-xml-data">16.5.13. Packages installing
1.30 wiz 6532: SGML or XML data</a></span></dt>
1.1 grant 6533:
6534: <dt><span class="sect2"><a href=
1.68 ! rillig 6535: "#mime-database">16.5.14. Packages installing
1.1 grant 6536: extensions to the MIME database</a></span></dt>
6537:
6538: <dt><span class="sect2"><a href=
1.68 ! rillig 6539: "#intltool">16.5.15. Packages using
1.1 grant 6540: intltool</a></span></dt>
1.18 xtraeme 6541:
6542: <dt><span class="sect2"><a href=
1.68 ! rillig 6543: "#startup-scripts">16.5.16. Packages installing
1.30 wiz 6544: startup scripts</a></span></dt>
1.57 minskim 6545:
6546: <dt><span class="sect2"><a href=
1.68 ! rillig 6547: "#tex-packages">16.5.17. Packages installing TeX
1.57 minskim 6548: modules</a></span></dt>
1.1 grant 6549: </dl>
6550: </dd>
6551:
1.30 wiz 6552: <dt><span class="sect1"><a href=
1.68 ! rillig 6553: "#feedback-to-author">16.6. Feedback to the
1.30 wiz 6554: author</a></span></dt>
1.1 grant 6555: </dl>
6556: </dd>
6557:
1.68 ! rillig 6558: <dt><span class="chapter"><a href="#debug">17.
1.1 grant 6559: Debugging</a></span></dt>
6560:
1.68 ! rillig 6561: <dt><span class="chapter"><a href="#submit">18.
1.1 grant 6562: Submitting and Committing</a></span></dt>
6563:
6564: <dd>
6565: <dl>
1.30 wiz 6566: <dt><span class="sect1"><a href=
1.68 ! rillig 6567: "#submitting-your-package">18.1. Submitting your
1.30 wiz 6568: packages</a></span></dt>
1.1 grant 6569:
1.30 wiz 6570: <dt><span class="sect1"><a href=
1.68 ! rillig 6571: "#general-notes-for-changes">18.2. General notes when
1.41 wiz 6572: adding, updating, or removing
6573: packages</a></span></dt>
6574:
6575: <dt><span class="sect1"><a href=
1.68 ! rillig 6576: "#committing-importing">18.3. Committing: Importing a
1.30 wiz 6577: package into CVS</a></span></dt>
1.1 grant 6578:
1.30 wiz 6579: <dt><span class="sect1"><a href=
1.68 ! rillig 6580: "#updating-package">18.4. Updating a package to a
1.30 wiz 6581: newer version</a></span></dt>
1.1 grant 6582:
1.30 wiz 6583: <dt><span class="sect1"><a href=
1.68 ! rillig 6584: "#moving-package">18.5. Moving a package in
1.30 wiz 6585: pkgsrc</a></span></dt>
1.1 grant 6586: </dl>
6587: </dd>
6588: </dl>
6589: </div>
6590:
1.67 hubertf 6591: <div class="chapter" lang="en">
1.1 grant 6592: <div class="titlepage">
6593: <div>
6594: <div>
1.67 hubertf 6595: <h2 class="title"><a name=
1.38 dillo 6596: "components"></a>Chapter 8. Package
1.27 rillig 6597: components - files, directories and contents</h2>
1.25 rillig 6598: </div>
6599: </div>
6600: </div>
6601:
6602: <div class="toc">
6603: <p><b>Table of Contents</b></p>
6604:
6605: <dl>
6606: <dt><span class="sect1"><a href=
1.45 wiz 6607: "#components.Makefile">8.1. <code xmlns=
6608: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6609: "filename">Makefile</code></a></span></dt>
6610:
6611: <dt><span class="sect1"><a href=
1.45 wiz 6612: "#components.distinfo">8.2. <code xmlns=
6613: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6614: "filename">distinfo</code></a></span></dt>
6615:
6616: <dt><span class="sect1"><a href=
1.38 dillo 6617: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 6618:
1.30 wiz 6619: <dt><span class="sect1"><a href=
1.38 dillo 6620: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6621: files</a></span></dt>
1.25 rillig 6622:
1.27 rillig 6623: <dt><span class="sect1"><a href=
1.38 dillo 6624: "#components.optional">8.5. Optional
1.27 rillig 6625: files</a></span></dt>
1.25 rillig 6626:
1.38 dillo 6627: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6628: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6629: class="filename">work*</code></a></span></dt>
1.25 rillig 6630:
1.38 dillo 6631: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6632: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6633: class="filename">files/*</code></a></span></dt>
1.25 rillig 6634: </dl>
6635: </div>
6636:
1.27 rillig 6637: <p>Whenever you're preparing a package, there are a number
6638: of files involved which are described in the following
6639: sections.</p>
1.25 rillig 6640:
1.67 hubertf 6641: <div class="sect1" lang="en">
1.25 rillig 6642: <div class="titlepage">
6643: <div>
6644: <div>
6645: <h2 class="title" style="clear: both"><a name=
1.45 wiz 6646: "components.Makefile"></a>8.1. <code xmlns=
6647: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6648: "filename">Makefile</code></h2>
1.25 rillig 6649: </div>
6650: </div>
6651: </div>
6652:
1.27 rillig 6653: <p>Building, installation and creation of a binary
1.45 wiz 6654: package are all controlled by the package's <code xmlns=
6655: "http://www.w3.org/TR/xhtml1/transitional" class=
6656: "filename">Makefile</code>. The <code xmlns=
6657: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6658: "filename">Makefile</code> describes various things about
6659: a package, for example from where to get it, how to
6660: configure, build, and install it.</p>
6661:
1.45 wiz 6662: <p>A package <code xmlns=
6663: "http://www.w3.org/TR/xhtml1/transitional" class=
6664: "filename">Makefile</code> contains several sections that
6665: describe the package.</p>
1.25 rillig 6666:
1.27 rillig 6667: <p>In the first section there are the following
6668: variables, which should appear exactly in the order given
6669: here.</p>
1.25 rillig 6670:
6671: <div class="itemizedlist">
6672: <ul type="disc">
6673: <li>
1.27 rillig 6674: <p><code class="varname">DISTNAME</code> is the
6675: basename of the distribution file to be downloaded
6676: from the package's website.</p>
6677: </li>
6678:
6679: <li>
6680: <p><code class="varname">PKGNAME</code> is the name
6681: of the package, as used by pkgsrc. You only need to
1.50 rillig 6682: provide it if it differs from <code class=
6683: "varname">DISTNAME</code>. Usually it is the
6684: directory name together with the version number. It
6685: must match the regular expression <code class=
1.27 rillig 6686: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
6687: that is, it starts with a letter or digit, and
6688: contains only letters, digits, dashes, underscores,
6689: dots and plus signs.</p>
1.25 rillig 6690: </li>
6691:
6692: <li>
1.27 rillig 6693: <p><code class="varname">CATEGORIES</code> is a
6694: list of categories which the package fits in. You
6695: can choose any of the top-level directories of
6696: pkgsrc for it.</p>
1.45 wiz 6697:
6698: <p>Currently the following values are available for
6699: <code class="varname">CATEGORIES</code>. If more
6700: than one is used, they need to be separated by
6701: spaces:</p>
6702: <pre class="programlisting">
1.51 rillig 6703: archivers cross geography meta-pkgs security
6704: audio databases graphics misc shells
6705: benchmarks devel ham multimedia sysutils
6706: biology editors inputmethod net textproc
6707: cad emulators lang news time
6708: chat finance mail parallel wm
6709: comms fonts math pkgtools www
6710: converters games mbone print x11
1.45 wiz 6711: </pre>
1.25 rillig 6712: </li>
6713:
6714: <li>
1.27 rillig 6715: <p><code class="varname">MASTER_SITES</code> is a
6716: list of URLs where the distribution files can be
6717: downloaded. Each URL must end with a slash.</p>
1.45 wiz 6718:
6719: <p>The <code class="varname">MASTER_SITES</code>
6720: may make use of the following predefined sites:</p>
6721: <pre class="programlisting">
1.51 rillig 6722: ${MASTER_SITE_APACHE}
6723: ${MASTER_SITE_BACKUP}
6724: ${MASTER_SITE_CYGWIN}
6725: ${MASTER_SITE_DEBIAN}
6726: ${MASTER_SITE_FREEBSD}
6727: ${MASTER_SITE_FREEBSD_LOCAL}
6728: ${MASTER_SITE_GNOME}
6729: ${MASTER_SITE_GNU}
6730: ${MASTER_SITE_GNUSTEP}
6731: ${MASTER_SITE_IFARCHIVE}
6732: ${MASTER_SITE_MOZILLA}
6733: ${MASTER_SITE_OPENOFFICE}
6734: ${MASTER_SITE_PERL_CPAN}
6735: ${MASTER_SITE_R_CRAN}
6736: ${MASTER_SITE_SOURCEFORGE}
6737: ${MASTER_SITE_SUNSITE}
6738: ${MASTER_SITE_SUSE}
6739: ${MASTER_SITE_TEX_CTAN}
6740: ${MASTER_SITE_XCONTRIB}
6741: ${MASTER_SITE_XEMACS}
1.45 wiz 6742: </pre>
6743:
6744: <p>If one of these predefined sites is chosen, you
6745: may want to specify a subdirectory of that site.
6746: Since these macros may expand to more than one
6747: actual site, you <span class=
6748: "emphasis"><em>must</em></span> use the following
6749: construct to specify a subdirectory:</p>
6750: <pre class="programlisting">
1.51 rillig 6751: ${MASTER_SITE_GNU:=subdirectory/name/}
6752: ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45 wiz 6753: </pre>
6754:
6755: <p>Note the trailing slash after the subdirectory
6756: name.</p>
6757:
6758: <p>If the package has multiple <code class=
6759: "varname">DISTFILES</code> or multiple <code class=
6760: "varname">PATCHFILES</code> from different sites,
6761: set <code class="varname">SITES_foo</code> to a
1.47 reed 6762: list of URIs where file “<span class=
1.45 wiz 6763: "quote">foo</span>” may be found.
6764: “<span class="quote">foo</span>”
1.47 reed 6765: includes the suffix, e.g.:</p>
1.45 wiz 6766: <pre class="programlisting">
1.51 rillig 6767: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
6768: DISTFILES+= foo-file.tar.gz
6769: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
6770: http://www.somewhereelse.com/mirror/somehow/
1.45 wiz 6771: </pre>
6772: </li>
6773:
6774: <li>
6775: <p><code class="varname">DISTFILES</code>: Name(s)
6776: of archive file(s) containing distribution. The
6777: default is <code xmlns=
6778: "http://www.w3.org/TR/xhtml1/transitional" class=
6779: "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
6780: Should only be set if you have more than one
6781: distfile.</p>
6782:
6783: <p>Note that the normal default setting of
6784: <code class="varname">DISTFILES</code> must be made
6785: explicit if you want to add to it (rather than
6786: replace it), as you usually would.</p>
6787: </li>
6788:
6789: <li>
6790: <p><code class="varname">EXTRACT_SUFX</code>:
6791: Suffix of the distribution file, will be appended
6792: to <code class="varname">DISTNAME</code>. Defaults
6793: to <code xmlns=
6794: "http://www.w3.org/TR/xhtml1/transitional" class=
6795: "filename">.tar.gz</code>.</p>
6796: </li>
6797: </ul>
6798: </div>
6799:
6800: <p>The second section contains information about
6801: separately downloaded patches, if any.</p>
6802:
6803: <div class="itemizedlist">
6804: <ul type="disc">
6805: <li>
1.47 reed 6806: <p><code class="varname">PATCHFILES:</code> Name(s)
1.45 wiz 6807: of additional files that contain distribution
6808: patches. There is no default. pkgsrc will look for
6809: them at <code class="varname">PATCH_SITES</code>.
6810: They will automatically be uncompressed before
6811: patching if the names end with <code xmlns=
6812: "http://www.w3.org/TR/xhtml1/transitional" class=
6813: "filename">.gz</code> or <code xmlns=
6814: "http://www.w3.org/TR/xhtml1/transitional" class=
6815: "filename">.Z</code>.</p>
6816: </li>
6817:
6818: <li>
6819: <p><code class="varname">PATCH_SITES</code>:
6820: Primary location(s) for distribution patch files
6821: (see <code class="varname">PATCHFILES</code> below)
6822: if not found locally.</p>
1.25 rillig 6823: </li>
6824: </ul>
6825: </div>
6826:
1.45 wiz 6827: <p>The third section contains the following
1.27 rillig 6828: variables.</p>
1.25 rillig 6829:
1.27 rillig 6830: <div class="itemizedlist">
6831: <ul type="disc">
6832: <li>
6833: <p><code class="varname">MAINTAINER</code> is the
1.50 rillig 6834: email address of the person who feels responsible
6835: for this package, and who is most likely to look at
6836: problems or questions regarding this package which
6837: have been reported with <a href=
1.45 wiz 6838: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
6839: <span class="citerefentry"><span class=
1.50 rillig 6840: "refentrytitle">send-pr</span>(1)</span></a>. Other
6841: developers should contact the <code class=
6842: "varname">MAINTAINER</code> before making major
6843: changes to the package. When packaging a new
6844: program, set <code class=
6845: "varname">MAINTAINER</code> to yourself. If you
6846: really can't maintain the package for future
6847: updates, set it to <code class="email"><<a href=
1.45 wiz 6848: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.27 rillig 6849: </li>
1.25 rillig 6850:
1.27 rillig 6851: <li>
6852: <p><code class="varname">HOMEPAGE</code> is a URL
6853: where users can find more information about the
1.23 wiz 6854: package.</p>
6855: </li>
1.1 grant 6856:
1.23 wiz 6857: <li>
6858: <p><code class="varname">COMMENT</code> is a
1.45 wiz 6859: one-line description of the package (should not
6860: include the package name).</p>
1.23 wiz 6861: </li>
6862: </ul>
6863: </div>
1.1 grant 6864:
1.45 wiz 6865: <p>Other variables that affect the build:</p>
1.1 grant 6866:
1.45 wiz 6867: <div class="itemizedlist">
6868: <ul type="disc">
6869: <li>
6870: <p><code class="varname">WRKSRC</code>: The
1.50 rillig 6871: directory where the interesting distribution files
6872: of the package are found. The default is
6873: <code xmlns=
6874: "http://www.w3.org/TR/xhtml1/transitional" class=
6875: "filename">${WRKDIR}/${DISTNAME}</code>, which
6876: works for most packages.</p>
6877:
6878: <p>If a package doesn't create a subdirectory for
6879: itself (most GNU software does, for instance), but
6880: extracts itself in the current directory, you
6881: should set <code class="varname">WRKSRC=
6882: ${WRKDIR}</code>.</p>
6883:
6884: <p>If a package doesn't create a subdirectory with
6885: the name of <code class="varname">DISTNAME</code>
6886: but some different name, set <code class=
6887: "varname">WRKSRC</code> to point to the proper name
6888: in <code xmlns=
6889: "http://www.w3.org/TR/xhtml1/transitional" class=
6890: "filename">${WRKDIR}</code>, for example
6891: <code class="varname">WRKSRC=
6892: ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
6893: "http://www.w3.org/TR/xhtml1/transitional" href=
6894: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
6895: target="_top"><code xmlns="" class=
6896: "filename">lang/tcl</code></a> and <a xmlns=
6897: "http://www.w3.org/TR/xhtml1/transitional" href=
6898: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
6899: target="_top"><code xmlns="" class=
6900: "filename">x11/tk</code></a> for other
6901: examples.</p>
6902:
6903: <p>The name of the working directory created by
6904: pkgsrc is taken from the <code class=
6905: "varname">WRKDIR_BASENAME</code> variable. By
6906: default, its value is <code xmlns=
6907: "http://www.w3.org/TR/xhtml1/transitional" class=
6908: "filename">work</code>. If you want to use the same
6909: pkgsrc tree for building different kinds of binary
6910: packages, you can change the variable according to
6911: your needs. Two other variables handle common cases
6912: of setting <code class=
6913: "varname">WRKDIR_BASENAME</code> individually. If
6914: <code class="varname">OBJHOSTNAME</code> is defined
6915: in <code xmlns=
1.45 wiz 6916: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6917: "filename">/etc/mk.conf</code>, the first component
6918: of the host's name is attached to the directory
6919: name. If <code class="varname">OBJMACHINE</code> is
6920: defined, the platform name is attached, which might
6921: look like <code xmlns=
6922: "http://www.w3.org/TR/xhtml1/transitional" class=
6923: "filename">work.i386</code> or <code xmlns=
1.45 wiz 6924: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6925: "filename">work.sparc</code>.</p>
1.45 wiz 6926: </li>
6927: </ul>
1.1 grant 6928: </div>
6929:
6930: <p>Please pay attention to the following gotchas:</p>
6931:
6932: <div class="itemizedlist">
6933: <ul type="disc">
6934: <li>
1.14 xtraeme 6935: <p>Add <code class="varname">MANCOMPRESSED</code>
1.47 reed 6936: if man pages are installed in compressed form by
6937: the package; see comment in <code xmlns=
1.45 wiz 6938: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6939: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 6940: </li>
6941:
6942: <li>
1.45 wiz 6943: <p>Replace <code xmlns=
6944: "http://www.w3.org/TR/xhtml1/transitional" class=
6945: "filename">/usr/local</code> with
6946: “<span class="quote">${PREFIX}</span>”
6947: in all files (see patches, below).</p>
1.1 grant 6948: </li>
6949:
6950: <li>
6951: <p>If the package installs any info files, see
6952: <a href="#faq.info-files" title=
1.68 ! rillig 6953: "16.5.7. Packages installing info files">Section 16.5.7,
1.45 wiz 6954: “Packages installing info
1.1 grant 6955: files”</a>.</p>
6956: </li>
6957: </ul>
6958: </div>
6959: </div>
6960:
1.67 hubertf 6961: <div class="sect1" lang="en">
1.1 grant 6962: <div class="titlepage">
6963: <div>
6964: <div>
6965: <h2 class="title" style="clear: both"><a name=
1.45 wiz 6966: "components.distinfo"></a>8.2. <code xmlns=
6967: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6968: "filename">distinfo</code></h2>
1.1 grant 6969: </div>
6970: </div>
6971: </div>
6972:
1.50 rillig 6973: <p>The <code xmlns=
6974: "http://www.w3.org/TR/xhtml1/transitional" class=
6975: "filename">distinfo</code> file contains the message
6976: digest, or checksum, of each distfile needed for the
6977: package. This ensures that the distfiles retrieved from
6978: the Internet have not been corrupted during transfer or
6979: altered by a malign force to introduce a security hole.
6980: Due to recent rumor about weaknesses of digest
6981: algorithms, all distfiles are protected using both SHA1
6982: and RMD160 message digests, as well as the file size.</p>
6983:
6984: <p>The <code xmlns=
6985: "http://www.w3.org/TR/xhtml1/transitional" class=
6986: "filename">distinfo</code> file also contains the
6987: checksums for all the patches found in the <code xmlns=
6988: "http://www.w3.org/TR/xhtml1/transitional" class=
6989: "filename">patches</code> directory (see <a href=
6990: "#components.patches" title=
6991: "8.3. patches/*">Section 8.3,
6992: “patches/*”</a>).</p>
6993:
6994: <p>To regenerate the <code xmlns=
6995: "http://www.w3.org/TR/xhtml1/transitional" class=
6996: "filename">distinfo</code> file, use the
1.14 xtraeme 6997: <span><strong class="command">make
1.50 rillig 6998: makedistinfo</strong></span> or <span><strong class=
6999: "command">make mdi</strong></span> command.</p>
1.1 grant 7000:
1.50 rillig 7001: <p>Some packages have different sets of distfiles
7002: depending on the platform, for example <a xmlns=
1.1 grant 7003: "http://www.w3.org/TR/xhtml1/transitional" href=
7004: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45 wiz 7005: target="_top"><code xmlns="" class=
7006: "filename">www/navigator</code></a>). These are kept in
1.50 rillig 7007: the same <code xmlns=
1.45 wiz 7008: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 7009: "filename">distinfo</code> file and care should be taken
7010: when upgrading such a package to ensure distfile
7011: information is not lost.</p>
1.1 grant 7012: </div>
7013:
1.67 hubertf 7014: <div class="sect1" lang="en">
1.1 grant 7015: <div class="titlepage">
7016: <div>
7017: <div>
7018: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7019: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 7020: </div>
7021: </div>
7022: </div>
7023:
7024: <p>This directory contains files that are used by the
7025: <a href=
7026: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
7027: <span class="citerefentry"><span class=
7028: "refentrytitle">patch</span>(1)</span></a> command to
7029: modify the sources as distributed in the distribution
7030: file into a form that will compile and run perfectly on
7031: NetBSD. The files are applied successively in alphabetic
7032: order (as returned by a shell “<span class=
7033: "quote">patches/patch-*</span>” glob expansion), so
1.45 wiz 7034: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7035: class="filename">patch-aa</code> is applied before
7036: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7037: class="filename">patch-ab</code>, etc.</p>
7038:
7039: <p>The <code xmlns=
7040: "http://www.w3.org/TR/xhtml1/transitional" class=
7041: "filename">patch-*</code> files should be in
7042: <span><strong class="command">diff -bu</strong></span>
7043: format, and apply without a fuzz to avoid problems. (To
7044: force patches to apply with fuzz you can set <code class=
1.14 xtraeme 7045: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 7046: not put changes for more than one file into a single
1.47 reed 7047: patch file, as this will make future modifications more
1.1 grant 7048: difficult.</p>
7049:
7050: <p>Similar, a file should be patched at most once, not
7051: several times by several different patches. If a file
7052: needs several patches, they should be combined into one
7053: file.</p>
7054:
7055: <p>One important thing to mention is to pay attention
7056: that no RCS IDs get stored in the patch files, as these
7057: will cause problems when later checked into the NetBSD
1.14 xtraeme 7058: CVS tree. Use the <span><strong class=
7059: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 7060: "http://www.w3.org/TR/xhtml1/transitional" href=
7061: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 7062: target="_top"><code xmlns="" class=
7063: "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20 ben 7064: these problems.</p>
1.1 grant 7065:
7066: <p>For even more automation, we recommend using
1.14 xtraeme 7067: <span><strong class="command">mkpatches</strong></span>
7068: from the same package to make a whole set of patches. You
7069: just have to backup files before you edit them to
1.45 wiz 7070: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7071: class="filename">filename.orig</code>, e.g. with
1.14 xtraeme 7072: <span><strong class="command">cp -p filename
7073: filename.orig</strong></span> or, easier, by using
7074: <span><strong class="command">pkgvi</strong></span> again
7075: from the same package. If you upgrade a package this way,
7076: you can easily compare the new set of patches with the
7077: previously existing one with <span><strong class=
7078: "command">patchdiff</strong></span>.</p>
1.1 grant 7079:
7080: <p>When you have finished a package, remember to generate
7081: the checksums for the patch files by using the
1.14 xtraeme 7082: <span><strong class="command">make
7083: makepatchsum</strong></span> command, see <a href=
7084: "#components.distinfo" title=
1.38 dillo 7085: "8.2. distinfo">Section 8.2,
1.45 wiz 7086: “<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7087: class="filename">distinfo</code>”</a>.</p>
1.1 grant 7088:
1.46 gdt 7089: <p>When adding a patch that corrects a problem in the
7090: distfile (rather than e.g. enforcing pkgsrc's view of
7091: where man pages should go), send the patch as a bug
7092: report to the maintainer. This benefits non-pkgsrc users
7093: of the package, and usually enables removing the patch in
7094: future version.</p>
7095:
1.1 grant 7096: <p>Patch files that are distributed by the author or
1.14 xtraeme 7097: other maintainers can be listed in <code class=
7098: "varname">$PATCHFILES</code>.</p>
1.1 grant 7099:
7100: <p>If it is desired to store any patches that should not
7101: be committed into pkgsrc, they can be kept outside the
1.45 wiz 7102: pkgsrc tree in the <code xmlns=
7103: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7104: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 7105: tree there is expected to have the same
7106: “<span class="quote">category/package</span>”
7107: structure as pkgsrc, and patches are expected to be
1.45 wiz 7108: stored inside these dirs (also known as <code xmlns=
7109: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 7110: "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
7111: if you want to keep a private patch for <code xmlns=
1.45 wiz 7112: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7113: "filename">pkgsrc/graphics/png</code>, keep it in
1.45 wiz 7114: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7115: class=
1.14 xtraeme 7116: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
7117: files in the named directory are expected to be patch
1.1 grant 7118: files, and <span class="emphasis"><em>they are applied
7119: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 7120: </div>
7121:
1.67 hubertf 7122: <div class="sect1" lang="en">
1.27 rillig 7123: <div class="titlepage">
7124: <div>
7125: <div>
7126: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7127: "other-mandatory-files"></a>8.4. Other
1.27 rillig 7128: mandatory files</h2>
7129: </div>
7130: </div>
7131: </div>
7132:
7133: <div class="variablelist">
7134: <dl>
1.45 wiz 7135: <dt><span class="term"><code xmlns=
7136: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7137: "filename">DESCR</code></span></dt>
7138:
7139: <dd>
7140: <p>A multi-line description of the piece of
7141: software. This should include any credits where
7142: they are due. Please bear in mind that others do
7143: not share your sense of humour (or spelling
7144: idiosyncrasies), and that others will read
7145: everything that you write here.</p>
7146: </dd>
7147:
1.45 wiz 7148: <dt><span class="term"><code xmlns=
7149: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7150: "filename">PLIST</code></span></dt>
7151:
7152: <dd>
7153: <p>This file governs the files that are installed
7154: on your system: all the binaries, manual pages,
7155: etc. There are other directives which may be
7156: entered in this file, to control the creation and
7157: deletion of directories, and the location of
7158: inserted files. See <a href="#plist" title=
1.38 dillo 7159: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 7160: <i>PLIST issues</i></a> for more information.</p>
7161: </dd>
7162: </dl>
7163: </div>
7164: </div>
7165:
1.67 hubertf 7166: <div class="sect1" lang="en">
1.27 rillig 7167: <div class="titlepage">
7168: <div>
7169: <div>
7170: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7171: "components.optional"></a>8.5. Optional
1.27 rillig 7172: files</h2>
7173: </div>
7174: </div>
7175: </div>
7176:
7177: <div class="variablelist">
7178: <dl>
1.45 wiz 7179: <dt><span class="term"><code xmlns=
7180: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7181: "filename">INSTALL</code></span></dt>
7182:
7183: <dd>
7184: <p>This shell script is invoked twice by <a href=
7185: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7186: <span class="citerefentry"><span class=
7187: "refentrytitle">pkg_add</span>(1)</span></a>. First
7188: time after package extraction and before files are
7189: moved in place, the second time after the files to
7190: install are moved in place. This can be used to do
7191: any custom procedures not possible with @exec
1.45 wiz 7192: commands in <code xmlns=
7193: "http://www.w3.org/TR/xhtml1/transitional" class=
7194: "filename">PLIST</code>. See <a href=
1.27 rillig 7195: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7196: <span class="citerefentry"><span class=
7197: "refentrytitle">pkg_add</span>(1)</span></a> and
7198: <a href=
7199: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7200: <span class="citerefentry"><span class=
7201: "refentrytitle">pkg_create</span>(1)</span></a> for
7202: more information.</p>
7203: </dd>
7204:
1.45 wiz 7205: <dt><span class="term"><code xmlns=
7206: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7207: "filename">DEINSTALL</code></span></dt>
7208:
7209: <dd>
7210: <p>This script is executed before and after any
7211: files are removed. It is this script's
7212: responsibility to clean up any additional messy
7213: details around the package's installation, since
7214: all pkg_delete knows is how to delete the files
7215: created in the original distribution. See <a href=
7216: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7217: <span class="citerefentry"><span class=
7218: "refentrytitle">pkg_delete</span>(1)</span></a> and
7219: <a href=
7220: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7221: <span class="citerefentry"><span class=
7222: "refentrytitle">pkg_create</span>(1)</span></a> for
7223: more information.</p>
7224: </dd>
7225:
1.45 wiz 7226: <dt><span class="term"><code xmlns=
7227: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7228: "filename">MESSAGE</code></span></dt>
7229:
7230: <dd>
1.50 rillig 7231: <p>This file is displayed after installation of the
1.27 rillig 7232: package. Useful for things like legal notices on
7233: almost-free software and hints for updating config
7234: files after installing modules for apache, PHP etc.
7235: Please note that you can modify variables in it
7236: easily by using <code class=
7237: "varname">MESSAGE_SUBST</code> in the package's
1.45 wiz 7238: <code xmlns=
7239: "http://www.w3.org/TR/xhtml1/transitional" class=
7240: "filename">Makefile</code>:</p>
1.27 rillig 7241: <pre class="programlisting">
1.51 rillig 7242: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.27 rillig 7243: </pre>
7244:
7245: <p>replaces "${SOMEVAR}" with “<span class=
1.45 wiz 7246: "quote">somevalue</span>” in <code xmlns=
7247: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7248: "filename">MESSAGE</code>.</p>
7249: </dd>
7250: </dl>
7251: </div>
7252: </div>
7253:
1.67 hubertf 7254: <div class="sect1" lang="en">
1.27 rillig 7255: <div class="titlepage">
7256: <div>
7257: <div>
7258: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 7259: "work-dir"></a>8.6. <code xmlns=
1.45 wiz 7260: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7261: "filename">work*</code></h2>
7262: </div>
7263: </div>
7264: </div>
7265:
7266: <p>When you type <span><strong class=
1.47 reed 7267: "command">make</strong></span>, the distribution files
7268: are unpacked into the directory denoted by <code class=
1.45 wiz 7269: "varname">WRKDIR</code>. It can be removed by running
7270: <span><strong class="command">make clean</strong></span>.
7271: Besides the sources, this directory is also used to keep
7272: various timestamp files. The directory gets <span class=
7273: "emphasis"><em>removed completely</em></span> on clean.
7274: The default is <code xmlns=
7275: "http://www.w3.org/TR/xhtml1/transitional" class=
7276: "filename">${.CURDIR}/work</code> or <code xmlns=
7277: "http://www.w3.org/TR/xhtml1/transitional" class=
7278: "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
7279: <code class="varname">OBJMACHINE</code> is set.</p>
1.27 rillig 7280: </div>
7281:
1.67 hubertf 7282: <div class="sect1" lang="en">
1.27 rillig 7283: <div class="titlepage">
7284: <div>
7285: <div>
7286: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7287: "files-dir"></a>8.7. <code xmlns=
7288: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7289: "filename">files/*</code></h2>
7290: </div>
7291: </div>
7292: </div>
7293:
7294: <p>If you have any files that you wish to be placed in
7295: the package prior to configuration or building, you could
7296: place these files here and use a “<span class=
7297: "quote">${CP}</span>” command in the
7298: “<span class="quote">pre-configure</span>”
7299: target to achieve this. Alternatively, you could simply
1.45 wiz 7300: diff the file against <code xmlns=
7301: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7302: "filename">/dev/null</code> and use the patch mechanism
7303: to manage the creation of this file.</p>
7304: </div>
7305: </div>
7306:
1.67 hubertf 7307: <div class="chapter" lang="en">
1.27 rillig 7308: <div class="titlepage">
7309: <div>
7310: <div>
1.67 hubertf 7311: <h2 class="title"><a name=
1.38 dillo 7312: "makefile"></a>Chapter 9. Programming in
1.45 wiz 7313: <code xmlns=
7314: "http://www.w3.org/TR/xhtml1/transitional" class=
7315: "filename">Makefile</code>s</h2>
1.27 rillig 7316: </div>
7317: </div>
7318: </div>
7319:
7320: <div class="toc">
7321: <p><b>Table of Contents</b></p>
7322:
7323: <dl>
7324: <dt><span class="sect1"><a href=
1.45 wiz 7325: "#makefile.variables">9.1. <code xmlns=
7326: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7327: "filename">Makefile</code> variables</a></span></dt>
7328:
7329: <dd>
7330: <dl>
7331: <dt><span class="sect2"><a href=
1.38 dillo 7332: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 7333: conventions</a></span></dt>
7334: </dl>
7335: </dd>
7336:
1.38 dillo 7337: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 7338: Code snippets</a></span></dt>
7339:
7340: <dd>
7341: <dl>
1.30 wiz 7342: <dt><span class="sect2"><a href=
1.38 dillo 7343: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 7344: list</a></span></dt>
1.27 rillig 7345:
1.30 wiz 7346: <dt><span class="sect2"><a href=
1.38 dillo 7347: "#converting-internal-to-external">9.2.2.
1.27 rillig 7348: Converting an internal list into an external
7349: list</a></span></dt>
7350:
1.30 wiz 7351: <dt><span class="sect2"><a href=
1.38 dillo 7352: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 7353: variables to a shell command</a></span></dt>
1.27 rillig 7354:
1.30 wiz 7355: <dt><span class="sect2"><a href=
1.38 dillo 7356: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 7357: guideline</a></span></dt>
1.27 rillig 7358:
1.30 wiz 7359: <dt><span class="sect2"><a href=
1.38 dillo 7360: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 7361: bug in BSD Make</a></span></dt>
1.27 rillig 7362: </dl>
7363: </dd>
7364: </dl>
7365: </div>
7366:
1.45 wiz 7367: <p>Pkgsrc consists of many <code xmlns=
7368: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7369: "filename">Makefile</code> fragments, each of which forms a
7370: well-defined part of the pkgsrc system. Using the <a href=
7371: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7372: <span class="citerefentry"><span class=
7373: "refentrytitle">make</span>(1)</span></a> system as a
7374: programming language for a big system like pkgsrc requires
7375: some discipline to keep the code correct and
7376: understandable.</p>
7377:
1.45 wiz 7378: <p>The basic ingredients for <code xmlns=
7379: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7380: "filename">Makefile</code> programming are variables (which
7381: are actually macros) and shell commands. Among these shell
7382: commands may even be more complex ones like <a href=
7383: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
7384: <span class="citerefentry"><span class=
7385: "refentrytitle">awk</span>(1)</span></a> programs. To make
7386: sure that every shell command runs as intended it is
7387: necessary to quote all variables correctly when they are
7388: used.</p>
7389:
7390: <p>This chapter describes some patterns, that appear quite
1.45 wiz 7391: often in <code xmlns=
7392: "http://www.w3.org/TR/xhtml1/transitional" class=
7393: "filename">Makefile</code>s, including the pitfalls that
7394: come along with them.</p>
1.27 rillig 7395:
1.67 hubertf 7396: <div class="sect1" lang="en">
1.27 rillig 7397: <div class="titlepage">
7398: <div>
7399: <div>
7400: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7401: "makefile.variables"></a>9.1. <code xmlns=
7402: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7403: "filename">Makefile</code> variables</h2>
7404: </div>
7405: </div>
7406: </div>
7407:
1.45 wiz 7408: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7409: class="filename">Makefile</code> variables contain
7410: strings that can be processed using the five operators
7411: ``='', ``+='', ``?='', ``:='', and ``!='', which are
7412: described in the <a href=
1.27 rillig 7413: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7414: <span class="citerefentry"><span class=
7415: "refentrytitle">make</span>(1)</span></a> man page.</p>
7416:
1.45 wiz 7417: <p>When a variable's value is parsed from a <code xmlns=
7418: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7419: "filename">Makefile</code>, the hash character ``#'' and
7420: the backslash character ``\'' are handled specially. If a
7421: backslash is followed by a newline, any whitespace
7422: immediately in front of the backslash, the backslash, the
7423: newline, and any whitespace immediately behind the
7424: newline are replaced with a single space. A backspace
7425: character and an immediately following hash character are
1.47 reed 7426: replaced with a single hash character. Otherwise, the
1.27 rillig 7427: backslash is passed as is. In a variable assignment, any
7428: hash character that is not preceded by a backslash starts
7429: a comment that continues upto the end of the logical
7430: line.</p>
7431:
7432: <p><span class="emphasis"><em>Note:</em></span> Because
7433: of this parsing algorithm the only way to create a
7434: variable consisting of a single backslash is using the
7435: ``!='' operator, for example: <code class=
7436: "varname">BACKSLASH!=echo "\\"</code>.</p>
7437:
7438: <p>So far for defining variables. The other thing you can
7439: do with variables is evaluating them. A variable is
7440: evaluated when it is part of the right side of the ``:=''
7441: or the ``!='' operator, or directly before executing a
7442: shell command which the variable is part of. In all other
1.47 reed 7443: cases, <a href=
1.27 rillig 7444: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7445: <span class="citerefentry"><span class=
7446: "refentrytitle">make</span>(1)</span></a> performs lazy
7447: evaluation, that is, variables are not evaluated until
7448: there's no other way. The ``modifiers'' mentioned in the
7449: man page also evaluate the variable.</p>
7450:
7451: <p>Some of the modifiers split the string into words and
7452: then operate on the words, others operate on the string
1.47 reed 7453: as a whole. When a string is split into words, it is
7454: split as you would expect it from <a href=
1.27 rillig 7455: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
7456: <span class="citerefentry"><span class=
7457: "refentrytitle">sh</span>(1)</span></a>.</p>
7458:
7459: <p>No rule without exception—the
7460: <span><strong class="command">.for</strong></span> loop
7461: does not follow the shell quoting rules but splits at
7462: sequences of whitespace.</p>
7463:
7464: <p>There are several types of variables that should be
7465: handled differently. Strings and two types of lists.</p>
7466:
7467: <div class="itemizedlist">
7468: <ul type="disc">
7469: <li>
7470: <p><span class="emphasis"><em>Strings</em></span>
1.47 reed 7471: can contain arbitrary characters. Nevertheless, you
1.27 rillig 7472: should restrict yourself to only using printable
7473: characters. Examples are <code class=
7474: "varname">PREFIX</code> and <code class=
7475: "varname">COMMENT</code>.</p>
7476: </li>
7477:
7478: <li>
7479: <p><span class="emphasis"><em>Internal
7480: lists</em></span> are lists that are never exported
7481: to any shell command. Their elements are separated
1.47 reed 7482: by whitespace. Therefore, the elements themselves
1.27 rillig 7483: cannot have embedded whitespace. Any other
7484: characters are allowed. Internal lists can be used
7485: in <span><strong class=
7486: "command">.for</strong></span> loops. Examples are
7487: <code class="varname">DEPENDS</code> and
7488: <code class="varname">BUILD_DEPENDS</code>.</p>
7489: </li>
7490:
7491: <li>
7492: <p><span class="emphasis"><em>External
7493: lists</em></span> are lists that may be exported to
7494: a shell command. Their elements can contain any
7495: characters, including whitespace. That's why they
7496: cannot be used in <span><strong class=
7497: "command">.for</strong></span> loops. Examples are
7498: <code class="varname">DISTFILES</code> and
7499: <code class="varname">MASTER_SITES</code>.</p>
7500: </li>
7501: </ul>
7502: </div>
7503:
1.67 hubertf 7504: <div class="sect2" lang="en">
1.27 rillig 7505: <div class="titlepage">
7506: <div>
7507: <div>
7508: <h3 class="title"><a name=
1.38 dillo 7509: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 7510: conventions</h3>
7511: </div>
7512: </div>
7513: </div>
7514:
7515: <div class="itemizedlist">
7516: <ul type="disc">
7517: <li>
7518: <p>All variable names starting with an underscore
7519: are reserved for use by the pkgsrc
7520: infrastructure. They shall not be used by package
1.45 wiz 7521: <code xmlns=
7522: "http://www.w3.org/TR/xhtml1/transitional" class=
7523: "filename">Makefile</code>s.</p>
1.27 rillig 7524: </li>
7525:
7526: <li>
7527: <p>In <span><strong class=
7528: "command">.for</strong></span> loops you should
7529: use lowercase variable names for the iteration
7530: variables.</p>
7531: </li>
7532:
7533: <li>
7534: <p>All list variables should have a ``plural''
7535: name, e.g. <code class=
7536: "varname">PKG_OPTIONS</code> or <code class=
7537: "varname">DISTFILES</code>.</p>
7538: </li>
7539: </ul>
7540: </div>
7541: </div>
7542: </div>
7543:
1.67 hubertf 7544: <div class="sect1" lang="en">
1.27 rillig 7545: <div class="titlepage">
7546: <div>
7547: <div>
7548: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7549: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 7550: </div>
7551: </div>
7552: </div>
7553:
7554: <p>This section presents you with some code snippets you
7555: should use in your own code. If you don't find anything
7556: appropriate here, you should test your code and add it
7557: here.</p>
7558:
1.67 hubertf 7559: <div class="sect2" lang="en">
1.27 rillig 7560: <div class="titlepage">
7561: <div>
7562: <div>
1.67 hubertf 7563: <h3 class="title"><a name=
1.38 dillo 7564: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 7565: a list</h3>
1.27 rillig 7566: </div>
7567: </div>
7568: </div>
7569: <pre class="programlisting">
1.51 rillig 7570: STRING= foo * bar `date`
7571: INT_LIST= # empty
7572: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
7573: EXT_LIST= # empty
7574: ANOTHER_EXT_LIST= a=b c=d
7575:
7576: INT_LIST+= ${STRING} # 1
7577: INT_LIST+= ${ANOTHER_INT_LIST} # 2
7578: EXT_LIST+= ${STRING:Q} # 3
7579: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
1.27 rillig 7580: </pre>
7581:
7582: <p>When you add a string to an external list (example
7583: 3), it must be quoted. In all other cases, you must not
7584: add a quoting level. You must not merge internal and
7585: external lists, unless you are sure that all entries
7586: are correctly interpreted in both lists.</p>
7587: </div>
7588:
1.67 hubertf 7589: <div class="sect2" lang="en">
1.27 rillig 7590: <div class="titlepage">
7591: <div>
7592: <div>
1.30 wiz 7593: <h3 class="title"><a name=
1.38 dillo 7594: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 7595: an internal list into an external list</h3>
1.27 rillig 7596: </div>
7597: </div>
7598: </div>
7599: <pre class="programlisting">
1.51 rillig 7600: EXT_LIST= # empty
7601: .for i in ${INT_LIST}
7602: EXT_LIST+= ${i:Q}""
7603: .endfor
1.27 rillig 7604: </pre>
7605:
7606: <p>This code converts the internal list <code class=
7607: "varname">INT_LIST</code> into the external list
7608: <code class="varname">EXT_LIST</code>. As the elements
7609: of an internal list are unquoted they must be quoted
7610: here. The reason for appending <code class=
7611: "varname">""</code> is explained below.</p>
7612: </div>
1.1 grant 7613:
1.67 hubertf 7614: <div class="sect2" lang="en">
1.27 rillig 7615: <div class="titlepage">
1.1 grant 7616: <div>
1.27 rillig 7617: <div>
1.30 wiz 7618: <h3 class="title"><a name=
1.38 dillo 7619: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 7620: variables to a shell command</h3>
1.27 rillig 7621: </div>
1.1 grant 7622: </div>
7623: </div>
1.27 rillig 7624: <pre class="programlisting">
1.51 rillig 7625: STRING= foo bar < > * `date` $$HOME ' "
7626: EXT_LIST= string=${STRING:Q} x=second\ item
1.27 rillig 7627:
1.51 rillig 7628: all:
7629: echo ${STRING} # 1
7630: echo "${STRING}" # 2
7631: echo "${STRING:Q}" # 3
7632: echo ${STRING:Q} # 4
7633: echo x${STRING:Q} | sed 1s,.,, # 5
7634: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27 rillig 7635: </pre>
7636:
7637: <p>Example 1 leads to a syntax error in the shell, as
7638: the characters are just copied.</p>
7639:
7640: <p>Example 2 leads to a syntax error too, and if you
7641: leave out the last " character from <code class=
7642: "varname">${STRING}</code>, <a href=
7643: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
7644: <span class="citerefentry"><span class=
7645: "refentrytitle">date</span>(1)</span></a> will be
7646: executed. The <code class="varname">$HOME</code> shell
7647: variable would be evaluated, too.</p>
7648:
7649: <p>Example 3 outputs each space character preceded by a
7650: backslash (or not), depending on the implementation of
7651: the <a href=
7652: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7653: <span class="citerefentry"><span class=
7654: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 7655:
1.27 rillig 7656: <p>Example 4 handles correctly every string that does
7657: not start with a dash. In that case, the result depends
7658: on the implementation of the <a href=
7659: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7660: <span class="citerefentry"><span class=
7661: "refentrytitle">echo</span>(1)</span></a> command. As
7662: long as you can guarantee that your input does not
1.47 reed 7663: start with a dash, this form is appropriate.</p>
1.1 grant 7664:
1.27 rillig 7665: <p>Example 5 handles even the case of a leading dash
7666: correctly.</p>
1.1 grant 7667:
1.27 rillig 7668: <p>The <code class="varname">EXT_LIST</code> does not
1.47 reed 7669: need to be quoted because the quoting has already been
1.27 rillig 7670: done when adding elements to the list.</p>
1.1 grant 7671:
1.27 rillig 7672: <p>As internal lists shall not be passed to the shell,
7673: there is no example for it.</p>
1.1 grant 7674: </div>
7675:
1.67 hubertf 7676: <div class="sect2" lang="en">
1.27 rillig 7677: <div class="titlepage">
1.1 grant 7678: <div>
1.27 rillig 7679: <div>
1.67 hubertf 7680: <h3 class="title"><a name=
1.38 dillo 7681: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 7682: guideline</h3>
7683: </div>
1.1 grant 7684: </div>
7685: </div>
7686:
1.27 rillig 7687: <p>There are many possible sources of wrongly quoted
7688: variables. This section lists some of the commonly
7689: known ones.</p>
1.1 grant 7690:
1.27 rillig 7691: <div class="itemizedlist">
7692: <ul type="disc">
7693: <li>
7694: <p>Whenever you use the value of a list, think
7695: about what happens to leading or trailing
7696: whitespace. If the list is a well-formed shell
1.47 reed 7697: expression, you can apply the <code class=
1.27 rillig 7698: "varname">:M*</code> modifier to strip leading
7699: and trailing whitespace from each word. The
7700: <code class="varname">:M</code> operator first
7701: splits its argument according to the rules of the
7702: shell, and then creates a new list consisting of
7703: all words that match the shell glob expression
7704: <code class="varname">*</code>, that is: all. One
7705: class of situations where this is needed is when
7706: adding a variable like <code class=
7707: "varname">CPPFLAGS</code> to <code class=
7708: "varname">CONFIGURE_ARGS</code>. If the configure
1.47 reed 7709: script invokes other configure scripts, it strips
1.27 rillig 7710: the leading and trailing whitespace from the
7711: variable and then passes it to the other
7712: configure scripts. But these configure scripts
7713: expect the (child) <code class=
7714: "varname">CPPFLAGS</code> variable to be the same
7715: as the parent <code class=
7716: "varname">CPPFLAGS</code>. That's why we better
7717: pass the <code class="varname">CPPFLAGS</code>
7718: value properly trimmed. And here is how we do
7719: it:</p>
7720: <pre class="programlisting">
1.51 rillig 7721: CPPFLAGS= # empty
7722: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
7723: CPPFLAGS+= ${MY_CPPFLAGS}
7724:
7725: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
7726:
7727: all:
7728: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
7729: echo x${CONFIGURE_ARGS}x # properly trimmed
1.27 rillig 7730: </pre>
7731: </li>
1.1 grant 7732:
1.27 rillig 7733: <li>
7734: <p>The example above contains one bug: The
7735: <code class="varname">${PREFIX}</code> is a
7736: properly quoted shell expression, but there is
7737: the C compiler after it, which also expects a
7738: properly quoted string (this time in C syntax).
7739: The version above is therefore only correct if
7740: <code class="varname">${PREFIX}</code> does not
7741: have embedded backslashes or double quotes. If
7742: you want to allow these, you have to add another
7743: layer of quoting to each variable that is used as
7744: a C string literal. You cannot use the
7745: <code class="varname">:Q</code> operator for it,
7746: as this operator only works for the shell.</p>
7747: </li>
1.1 grant 7748:
1.27 rillig 7749: <li>
1.47 reed 7750: <p>Whenever a variable can be empty, the
1.27 rillig 7751: <code class="varname">:Q</code> operator can have
7752: surprising results. Here are two completely
7753: different cases which can be solved with the same
7754: trick.</p>
7755: <pre class="programlisting">
1.51 rillig 7756: EMPTY= # empty
7757: empty_test:
7758: for i in a ${EMPTY:Q} c; do \
7759: echo "$$i"; \
7760: done
7761:
7762: for_test:
7763: .for i in a:\ a:\test.txt
7764: echo ${i:Q}
7765: echo "foo"
7766: .endfor
1.1 grant 7767: </pre>
7768:
1.27 rillig 7769: <p>The first example will only print two of the
7770: three lines we might have expected. This is
7771: because <code class="varname">${EMPTY:Q}</code>
7772: expands to the empty string, which the shell
7773: cannot see. The workaround is to write
7774: <code class="varname">${EMPTY:Q}""</code>. This
7775: pattern can be often found as <code class=
7776: "varname">${TEST} -z ${VAR:Q}</code> or as
7777: <code class="varname">${TEST} -f
7778: ${FNAME:Q}</code> (both of these are wrong).</p>
7779:
7780: <p>The second example will only print three lines
7781: instead of four. The first line looks like
7782: <code class="varname">a:\ echo foo</code>. This
7783: is because the backslash of the value
7784: <code class="varname">a:\</code> is interpreted
7785: as a line-continuation by <a href=
7786: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7787: <span class="citerefentry"><span class=
7788: "refentrytitle">make</span>(1)</span></a>, which
7789: makes the second line the arguments of the
7790: <a href=
7791: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7792: <span class="citerefentry"><span class=
7793: "refentrytitle">echo</span>(1)</span></a> command
7794: from the first line. To avoid this, write
7795: <code class="varname">${i:Q}""</code>.</p>
7796: </li>
7797: </ul>
7798: </div>
1.1 grant 7799: </div>
7800:
1.67 hubertf 7801: <div class="sect2" lang="en">
1.27 rillig 7802: <div class="titlepage">
1.1 grant 7803: <div>
1.27 rillig 7804: <div>
1.30 wiz 7805: <h3 class="title"><a name=
1.38 dillo 7806: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 7807: for a bug in BSD Make</h3>
1.27 rillig 7808: </div>
1.1 grant 7809: </div>
7810: </div>
7811:
1.27 rillig 7812: <p>The pkgsrc bmake program does not handle the
7813: following assignment correctly. In case <code class=
7814: "varname">_othervar_</code> contains a ``-'' character,
7815: one of the closing braces is included in <code class=
7816: "varname">${VAR}</code> after this code executes.</p>
7817: <pre class="programlisting">
1.51 rillig 7818: VAR:= ${VAR:N${_othervar_:C/-//}}
1.1 grant 7819: </pre>
7820:
1.27 rillig 7821: <p>For a more complex code snippet and a workaround,
7822: see the package <a xmlns=
7823: "http://www.w3.org/TR/xhtml1/transitional" href=
7824: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45 wiz 7825: target="_top"><code xmlns="" class=
7826: "filename">regress/make-quoting</code></a>, testcase
1.27 rillig 7827: <code class="varname">bug1</code>.</p>
1.1 grant 7828: </div>
7829: </div>
7830: </div>
7831:
1.67 hubertf 7832: <div class="chapter" lang="en">
1.1 grant 7833: <div class="titlepage">
7834: <div>
7835: <div>
1.67 hubertf 7836: <h2 class="title"><a name=
1.38 dillo 7837: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 7838: </div>
7839: </div>
7840: </div>
7841:
7842: <div class="toc">
7843: <p><b>Table of Contents</b></p>
7844:
7845: <dl>
1.38 dillo 7846: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 7847: ID</a></span></dt>
7848:
1.30 wiz 7849: <dt><span class="sect1"><a href=
1.38 dillo 7850: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 7851: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7852: class="filename">PLIST</code>
1.14 xtraeme 7853: generation</a></span></dt>
1.1 grant 7854:
1.38 dillo 7855: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 7856: Tweaking output of <span><strong class="command">make
7857: print-PLIST</strong></span></a></span></dt>
1.1 grant 7858:
1.38 dillo 7859: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 7860: Variable substitution in PLIST</a></span></dt>
7861:
1.30 wiz 7862: <dt><span class="sect1"><a href=
1.48 dillo 7863: "#manpage-compression">10.5. Man page
7864: compression</a></span></dt>
1.1 grant 7865:
1.38 dillo 7866: <dt><span class="sect1"><a href=
7867: "#using-PLIST_SRC">10.6. Changing PLIST source with
7868: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 7869:
1.30 wiz 7870: <dt><span class="sect1"><a href=
1.47 reed 7871: "#platform-specific-plist">10.7. Platform-specific and
1.30 wiz 7872: differing PLISTs</a></span></dt>
1.1 grant 7873:
1.38 dillo 7874: <dt><span class="sect1"><a href=
7875: "#faq.common-dirs">10.8. Sharing directories between
7876: packages</a></span></dt>
1.1 grant 7877: </dl>
7878: </div>
7879:
1.45 wiz 7880: <p>The <code xmlns=
7881: "http://www.w3.org/TR/xhtml1/transitional" class=
7882: "filename">PLIST</code> file contains a package's
7883: “<span class="quote">packing list</span>”, i.e.
7884: a list of files that belong to the package (relative to the
7885: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7886: class="filename">${PREFIX}</code> directory it's been
7887: installed in) plus some additional statements - see the
7888: <a href=
1.1 grant 7889: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7890: <span class="citerefentry"><span class=
1.47 reed 7891: "refentrytitle">pkg_create</span>(1)</span></a> man page
7892: for a full list. This chapter addresses some issues that
7893: need attention when dealing with the <code xmlns=
1.45 wiz 7894: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7895: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 7896:
1.67 hubertf 7897: <div class="sect1" lang="en">
1.1 grant 7898: <div class="titlepage">
7899: <div>
7900: <div>
7901: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 7902: "rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 7903: </div>
7904: </div>
7905: </div>
7906:
7907: <p>Be sure to add a RCS ID line as the first thing in any
1.45 wiz 7908: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7909: class="filename">PLIST</code> file you write:</p>
1.1 grant 7910: <pre class="programlisting">
1.51 rillig 7911: @comment $NetBSD$
1.1 grant 7912: </pre>
7913: </div>
7914:
1.67 hubertf 7915: <div class="sect1" lang="en">
1.1 grant 7916: <div class="titlepage">
7917: <div>
7918: <div>
7919: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7920: "automatic-plist-generation"></a>10.2. Semi-automatic
1.45 wiz 7921: <code xmlns=
7922: "http://www.w3.org/TR/xhtml1/transitional" class=
7923: "filename">PLIST</code> generation</h2>
1.1 grant 7924: </div>
7925: </div>
7926: </div>
7927:
1.14 xtraeme 7928: <p>You can use the <span><strong class="command">make
7929: print-PLIST</strong></span> command to output a PLIST
7930: that matches any new files since the package was
7931: extracted. See <a href="#build.helpful-targets" title=
1.56 rillig 7932: "14.16. Other helpful targets">Section 14.16,
1.1 grant 7933: “Other helpful targets”</a> for more
7934: information on this target.</p>
7935: </div>
7936:
1.67 hubertf 7937: <div class="sect1" lang="en">
1.1 grant 7938: <div class="titlepage">
7939: <div>
7940: <div>
7941: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7942: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 7943: <span><strong class="command">make
7944: print-PLIST</strong></span></h2>
1.1 grant 7945: </div>
7946: </div>
7947: </div>
7948:
7949: <p>If you have used any of the *-dirs packages, as
7950: explained in <a href="#faq.common-dirs" title=
1.38 dillo 7951: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 7952: “Sharing directories between packages”</a>,
1.14 xtraeme 7953: you may have noticed that <span><strong class=
7954: "command">make print-PLIST</strong></span> outputs a set
7955: of <code class="varname">@comment</code>s instead of real
7956: <code class="varname">@dirrm</code> lines. You can also
7957: do this for specific directories and files, so that the
7958: results of that command are very close to reality. This
7959: helps <span class="emphasis"><em>a lot</em></span> during
7960: the update of packages.</p>
7961:
7962: <p>The <code class="varname">PRINT_PLIST_AWK</code>
7963: variable takes a set of AWK patterns and actions that are
7964: used to filter the output of print-PLIST. You can
7965: <span class="emphasis"><em>append</em></span> any chunk
7966: of AWK scripting you like to it, but be careful with
1.1 grant 7967: quoting.</p>
7968:
1.45 wiz 7969: <p>For example, to get all files inside the <code xmlns=
7970: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7971: "filename">libdata/foo</code> directory removed from the
1.1 grant 7972: resulting PLIST:</p>
7973: <pre class="programlisting">
1.51 rillig 7974: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 grant 7975: </pre>
7976:
1.14 xtraeme 7977: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 7978: lines referring to a specific (shared) directory
1.14 xtraeme 7979: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 7980: <pre class="programlisting">
1.51 rillig 7981: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1 grant 7982: </pre>
7983: </div>
7984:
1.67 hubertf 7985: <div class="sect1" lang="en">
1.1 grant 7986: <div class="titlepage">
7987: <div>
7988: <div>
7989: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7990: "plist.misc"></a>10.4. Variable substitution
7991: in PLIST</h2>
1.1 grant 7992: </div>
7993: </div>
7994: </div>
7995:
7996: <p>A number of variables are substituted automatically in
7997: PLISTs when a package is installed on a system. This
7998: includes the following variables:</p>
7999:
8000: <div class="variablelist">
8001: <dl>
1.14 xtraeme 8002: <dt><span class="term"><code class=
8003: "varname">${MACHINE_ARCH}</code>, <code class=
8004: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 8005:
8006: <dd>
8007: <p>Some packages like emacs and perl embed
8008: information about which architecture they were
8009: built on into the pathnames where they install
1.47 reed 8010: their files. To handle this case, PLIST will be
1.1 grant 8011: preprocessed before actually used, and the symbol
1.14 xtraeme 8012: “<span class="quote"><code class=
8013: "varname">${MACHINE_ARCH}</code></span>” will
8014: be replaced by what <span><strong class=
8015: "command">uname -p</strong></span> gives. The same
8016: is done if the string <code class=
8017: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
8018: PLIST somewhere - use this on packages that have
1.47 reed 8019: GNU autoconf-created configure scripts.</p>
1.1 grant 8020:
8021: <div class="note" style=
8022: "margin-left: 0.5in; margin-right: 0.5in;">
8023: <h3 class="title">Legacy note</h3>
8024:
8025: <p>There used to be a symbol “<span class=
1.14 xtraeme 8026: "quote"><code class=
8027: "varname">$ARCH</code></span>” that was
8028: replaced by the output of <span><strong class=
8029: "command">uname -m</strong></span>, but that's no
1.1 grant 8030: longer supported and has been removed.</p>
8031: </div>
8032: </dd>
8033:
1.14 xtraeme 8034: <dt><span class="term"><code class=
8035: "varname">${OPSYS}</code>, <code class=
8036: "varname">${LOWER_OPSYS}</code>, <code class=
8037: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 8038:
8039: <dd>
8040: <p>Some packages want to embed the OS name and
8041: version into some paths. To do this, use these
1.45 wiz 8042: variables in the <code xmlns=
8043: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8044: "filename">PLIST</code>:</p>
1.1 grant 8045:
8046: <div class="itemizedlist">
8047: <ul type="disc">
8048: <li>
1.14 xtraeme 8049: <p><code class="varname">${OPSYS}</code> -
8050: output of “<span class=
8051: "quote"><span><strong class="command">uname
8052: -s</strong></span></span>”</p>
1.1 grant 8053: </li>
8054:
8055: <li>
1.14 xtraeme 8056: <p><code class=
8057: "varname">${LOWER_OPSYS}</code> - lowercase
8058: common name (eg. “<span class=
8059: "quote">solaris</span>”)</p>
1.1 grant 8060: </li>
8061:
8062: <li>
1.14 xtraeme 8063: <p><code class="varname">${OS_VERSION}</code>
8064: - “<span class=
8065: "quote"><span><strong class="command">uname
8066: -r</strong></span></span>”</p>
1.1 grant 8067: </li>
8068: </ul>
8069: </div>
8070: </dd>
8071:
1.14 xtraeme 8072: <dt><span class="term"><code class=
8073: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 8074:
8075: <dd>
8076: <p>Packages that install locale files should list
8077: them in the PLIST as “<span class=
8078: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
8079: instead of “<span class=
8080: "quote">share/locale/de/LC_MESSAGES/...</span>”.
8081: This properly handles the fact that different
8082: operating systems expect locale files to be either
1.45 wiz 8083: in <code xmlns=
8084: "http://www.w3.org/TR/xhtml1/transitional" class=
8085: "filename">share</code> or <code xmlns=
8086: "http://www.w3.org/TR/xhtml1/transitional" class=
8087: "filename">lib</code> by default.</p>
1.1 grant 8088: </dd>
8089: </dl>
8090: </div>
8091:
8092: <p>For a complete list of values which are replaced by
1.45 wiz 8093: default, please look in <code xmlns=
8094: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8095: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 8096: "emphasis"><em>PLIST_SUBST</em></span>).</p>
8097:
8098: <p>If you want to change other variables not listed
8099: above, you can add variables and their expansions to this
1.14 xtraeme 8100: variable in the following way, similar to <code class=
8101: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 8102: "#components.optional" title=
1.38 dillo 8103: "8.5. Optional files">Section 8.5,
1.1 grant 8104: “Optional files”</a>):</p>
8105: <pre class="programlisting">
1.51 rillig 8106: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 grant 8107: </pre>
8108:
8109: <p>This replaces all occurrences of “<span class=
8110: "quote">${SOMEVAR}</span>” in the PLIST with
8111: “<span class="quote">somevalue</span>”.</p>
8112: </div>
8113:
1.67 hubertf 8114: <div class="sect1" lang="en">
1.1 grant 8115: <div class="titlepage">
8116: <div>
8117: <div>
8118: <h2 class="title" style="clear: both"><a name=
1.48 dillo 8119: "manpage-compression"></a>10.5. Man page
8120: compression</h2>
1.1 grant 8121: </div>
8122: </div>
8123: </div>
8124:
1.47 reed 8125: <p>Man pages should be installed in compressed form if
1.45 wiz 8126: <code class="varname">MANZ</code> is set (in <code xmlns=
8127: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8128: "filename">bsd.own.mk</code>), and uncompressed
1.45 wiz 8129: otherwise. To handle this in the <code xmlns=
8130: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8131: "filename">PLIST</code> file, the suffix
8132: “<span class="quote">.gz</span>” is
1.47 reed 8133: appended/removed automatically for man pages according to
1.14 xtraeme 8134: <code class="varname">MANZ</code> and <code class=
8135: "varname">MANCOMPRESSED</code> being set or not, see
1.45 wiz 8136: above for details. This modification of the <code xmlns=
8137: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8138: "filename">PLIST</code> file is done on a copy of it, not
1.45 wiz 8139: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8140: class="filename">PLIST</code> itself.</p>
1.1 grant 8141: </div>
8142:
1.67 hubertf 8143: <div class="sect1" lang="en">
1.1 grant 8144: <div class="titlepage">
8145: <div>
8146: <div>
8147: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8148: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 8149: source with <code class=
1.14 xtraeme 8150: "varname">PLIST_SRC</code></h2>
1.1 grant 8151: </div>
8152: </div>
8153: </div>
8154:
1.14 xtraeme 8155: <p>To use one or more files as source for the
1.45 wiz 8156: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8157: class="filename">PLIST</code> used in generating the
8158: binary package, set the variable <code class=
1.14 xtraeme 8159: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 8160: The files are later concatenated using <a href=
8161: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
8162: <span class="citerefentry"><span class=
8163: "refentrytitle">cat</span>(1)</span></a>, and order of
8164: things is important.</p>
1.1 grant 8165: </div>
8166:
1.67 hubertf 8167: <div class="sect1" lang="en">
1.1 grant 8168: <div class="titlepage">
8169: <div>
8170: <div>
8171: <h2 class="title" style="clear: both"><a name=
1.47 reed 8172: "platform-specific-plist"></a>10.7. Platform-specific
8173: and differing PLISTs</h2>
1.1 grant 8174: </div>
8175: </div>
8176: </div>
8177:
8178: <p>Some packages decide to install a different set of
8179: files based on the operating system being used. These
8180: differences can be automatically handled by using the
8181: following files:</p>
8182:
8183: <div class="itemizedlist">
8184: <ul type="disc">
8185: <li>
1.45 wiz 8186: <p><code xmlns=
8187: "http://www.w3.org/TR/xhtml1/transitional" class=
8188: "filename">PLIST.common</code></p>
1.1 grant 8189: </li>
8190:
8191: <li>
1.45 wiz 8192: <p><code xmlns=
8193: "http://www.w3.org/TR/xhtml1/transitional" class=
8194: "filename">PLIST.${OPSYS}</code></p>
1.1 grant 8195: </li>
8196:
8197: <li>
1.45 wiz 8198: <p><code xmlns=
8199: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 8200: "filename">PLIST.${MACHINE_ARCH}</code></p>
8201: </li>
8202:
8203: <li>
1.45 wiz 8204: <p><code xmlns=
8205: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 8206: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
8207: </li>
8208:
8209: <li>
1.45 wiz 8210: <p><code xmlns=
8211: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8212: "filename">PLIST.common_end</code></p>
1.1 grant 8213: </li>
8214: </ul>
8215: </div>
8216: </div>
8217:
1.67 hubertf 8218: <div class="sect1" lang="en">
1.1 grant 8219: <div class="titlepage">
8220: <div>
8221: <div>
8222: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8223: "faq.common-dirs"></a>10.8. Sharing
8224: directories between packages</h2>
1.1 grant 8225: </div>
8226: </div>
8227: </div>
8228:
8229: <p>A “<span class="quote">shared
8230: directory</span>” is a directory where multiple
8231: (and unrelated) packages install files. These directories
8232: are problematic because you have to add special tricks in
8233: the PLIST to conditionally remove them, or have some
8234: centralized package handle them.</p>
8235:
8236: <p>Within pkgsrc, you'll find both approaches. If a
8237: directory is shared by a few unrelated packages, it's
8238: often not worth to add an extra package to remove it.
8239: Therefore, one simply does:</p>
8240: <pre class="programlisting">
1.51 rillig 8241: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
1.1 grant 8242: </pre>
8243:
8244: <p>in the PLISTs of all affected packages, instead of the
8245: regular "@dirrm" line.</p>
8246:
8247: <p>However, if the directory is shared across many
8248: packages, two different solutions are available:</p>
8249:
8250: <div class="orderedlist">
8251: <ol type="1">
8252: <li>
8253: <p>If the packages have a common dependency, the
8254: directory can be removed in that. For example, see
8255: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8256: href=
8257: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45 wiz 8258: target="_top"><code xmlns="" class=
8259: "filename">textproc/scrollkeeper</code></a>, which
8260: removes the shared directory <code xmlns=
8261: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 8262: "filename">share/omf</code>.</p>
1.1 grant 8263: </li>
8264:
8265: <li>
8266: <p>If the packages using the directory are not
8267: related at all (they have no common dependencies),
8268: a *-dirs package is used.</p>
8269: </li>
8270: </ol>
8271: </div>
8272:
8273: <p>From now on, we'll discuss the second solution. To get
8274: an idea of the *-dirs packages available, issue:</p>
8275: <pre class="programlisting">
1.51 rillig 8276: <code class="prompt">%</code> cd .../pkgsrc
8277: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 8278: </pre>
8279:
8280: <p>Their use from other packages is very simple. The
1.14 xtraeme 8281: <code class="varname">USE_DIRS</code> variable takes a
8282: list of package names (without the “<span class=
1.1 grant 8283: "quote">-dirs</span>” part) together with the
8284: required version number (always pick the latest one when
1.34 wiz 8285: writing new packages).</p>
1.1 grant 8286:
8287: <p>For example, if a package installs files under
1.45 wiz 8288: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8289: class="filename">share/applications</code>, it should
8290: have the following line in it:</p>
1.1 grant 8291: <pre class="programlisting">
1.51 rillig 8292: USE_DIRS+= xdg-1.1
1.1 grant 8293: </pre>
8294:
1.14 xtraeme 8295: <p>After regenerating the PLIST using
8296: <span><strong class="command">make
8297: print-PLIST</strong></span>, you should get the right
8298: (commented out) lines.</p>
1.1 grant 8299:
1.47 reed 8300: <p>Note that even if your package is using <code xmlns=
1.45 wiz 8301: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8302: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 8303: *-x11-dirs packages. Just specify the name without that
1.45 wiz 8304: part and pkgsrc (in particular, <code xmlns=
8305: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8306: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 8307: </div>
8308: </div>
8309:
1.67 hubertf 8310: <div class="chapter" lang="en">
1.1 grant 8311: <div class="titlepage">
8312: <div>
8313: <div>
1.67 hubertf 8314: <h2 class="title"><a name=
1.38 dillo 8315: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 8316: methodology</h2>
8317: </div>
8318: </div>
8319: </div>
8320:
8321: <div class="toc">
8322: <p><b>Table of Contents</b></p>
8323:
8324: <dl>
1.30 wiz 8325: <dt><span class="sect1"><a href=
1.38 dillo 8326: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 8327: to use buildlink3</a></span></dt>
1.1 grant 8328:
1.30 wiz 8329: <dt><span class="sect1"><a href=
1.45 wiz 8330: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
8331: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8332: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 8333:
8334: <dd>
8335: <dl>
1.25 rillig 8336: <dt><span class="sect2"><a href=
1.38 dillo 8337: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 8338: buildlink3.mk file</a></span></dt>
1.1 grant 8339:
1.25 rillig 8340: <dt><span class="sect2"><a href=
1.38 dillo 8341: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 8342: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 8343: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 8344: <code xmlns=
8345: "http://www.w3.org/TR/xhtml1/transitional" class=
8346: "filename">buildlink3.mk</code>
1.1 grant 8347: files</a></span></dt>
8348: </dl>
8349: </dd>
8350:
1.30 wiz 8351: <dt><span class="sect1"><a href=
1.45 wiz 8352: "#writing-builtin.mk">11.3. Writing <code xmlns=
8353: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8354: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 8355:
8356: <dd>
8357: <dl>
1.25 rillig 8358: <dt><span class="sect2"><a href=
1.38 dillo 8359: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 8360: <code xmlns=
8361: "http://www.w3.org/TR/xhtml1/transitional" class=
8362: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 8363:
1.25 rillig 8364: <dt><span class="sect2"><a href=
1.38 dillo 8365: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 8366: preferences for native or pkgsrc
8367: software</a></span></dt>
1.1 grant 8368: </dl>
8369: </dd>
8370: </dl>
8371: </div>
8372:
8373: <p>Buildlink is a framework in pkgsrc that controls what
8374: headers and libraries are seen by a package's configure and
8375: build processes. This is implemented in a two step
8376: process:</p>
8377:
8378: <div class="orderedlist">
8379: <ol type="1">
8380: <li>
8381: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 8382: into <code class="varname">BUILDLINK_DIR</code>,
8383: which by default is a subdirectory of <code class=
8384: "varname">WRKDIR</code>.</p>
1.1 grant 8385: </li>
8386:
8387: <li>
8388: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 8389: the normal compiler tools that translate <code class=
8390: "option">-I${LOCALBASE}/include</code> and
8391: <code class="option">-L${LOCALBASE}/lib</code> into
8392: references to <code class=
8393: "varname">BUILDLINK_DIR</code>. The wrapper scripts
8394: also make native compiler on some operating systems
8395: look like GCC, so that packages that expect GCC won't
8396: require modifications to build with those native
8397: compilers.</p>
1.1 grant 8398: </li>
8399: </ol>
8400: </div>
8401:
8402: <p>This normalizes the environment in which a package is
8403: built so that the package may be built consistently despite
8404: what other software may be installed. Please note that the
1.45 wiz 8405: normal system header and library paths, e.g. <code xmlns=
8406: "http://www.w3.org/TR/xhtml1/transitional" class=
8407: "filename">/usr/include</code>, <code xmlns=
8408: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8409: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 8410: buildlink3 is designed to insulate the package build from
8411: non-system-supplied software.</p>
8412:
1.67 hubertf 8413: <div class="sect1" lang="en">
1.1 grant 8414: <div class="titlepage">
8415: <div>
8416: <div>
8417: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8418: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 8419: packages to use buildlink3</h2>
1.1 grant 8420: </div>
8421: </div>
8422: </div>
8423:
8424: <p>The process of converting packages to use the
8425: buildlink3 framework (“<span class=
8426: "quote">bl3ifying</span>”) is fairly
8427: straightforward. The things to keep in mind are:</p>
8428:
8429: <div class="orderedlist">
8430: <ol type="1">
8431: <li>
8432: <p>Ensure that the build always calls the wrapper
8433: scripts instead of the actual toolchain. Some
8434: packages are tricky, and the only way to know for
1.45 wiz 8435: sure is the check <code xmlns=
8436: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8437: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 8438: wrappers are being invoked.</p>
8439: </li>
8440:
8441: <li>
1.14 xtraeme 8442: <p>Don't override <code class=
8443: "varname">PREFIX</code> from within the package
8444: Makefile, e.g. Java VMs, standalone shells, etc.,
1.45 wiz 8445: because the code to symlink files into <code xmlns=
8446: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8447: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 8448: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 8449: <em class=
8450: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 8451: </li>
8452:
8453: <li>
8454: <p>Remember that <span class=
1.45 wiz 8455: "emphasis"><em>only</em></span> the <code xmlns=
8456: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8457: "filename">buildlink3.mk</code> files that you list
1.1 grant 8458: in a package's Makefile are added as dependencies
8459: for that package.</p>
8460: </li>
8461: </ol>
8462: </div>
8463:
8464: <p>If a dependency on a particular package is required
8465: for its libraries and headers, then we replace:</p>
8466: <pre class="programlisting">
1.51 rillig 8467: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 8468: </pre>
8469:
8470: <p>with</p>
8471: <pre class="programlisting">
1.51 rillig 8472: .include "../../category/foo/buildlink3.mk"
1.1 grant 8473: </pre>
8474:
1.47 reed 8475: <p>The buildlink3.mk files usually define the required
8476: dependencies. If you need a newer version of the
8477: dependency when using buildlink3.mk files, then you can
8478: define it in your Makefile; for example:</p>
8479: <pre class="programlisting">
1.51 rillig 8480: BUILDLINK_DEPENDS.foo+= foo>=1.1.0
8481: .include "../../category/foo/buildlink3.mk"
1.47 reed 8482: </pre>
8483:
1.45 wiz 8484: <p>There are several <code xmlns=
8485: "http://www.w3.org/TR/xhtml1/transitional" class=
8486: "filename">buildlink3.mk</code> files in <code xmlns=
8487: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8488: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 8489: issues:</p>
8490:
8491: <div class="itemizedlist">
8492: <ul type="disc">
8493: <li>
1.45 wiz 8494: <p><code xmlns=
8495: "http://www.w3.org/TR/xhtml1/transitional" class=
8496: "filename">bdb.buildlink3.mk</code> chooses either
8497: the native or a pkgsrc Berkeley DB implementation
8498: based on the values of <code class=
1.14 xtraeme 8499: "varname">BDB_ACCEPTED</code> and <code class=
8500: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 8501: </li>
8502:
8503: <li>
1.45 wiz 8504: <p><code xmlns=
8505: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 8506: "filename">curses.buildlink3.mk</code>: If the
1.14 xtraeme 8507: system comes with neither Curses nor NCurses, this
8508: will take care to install the <a xmlns=
8509: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 8510: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45 wiz 8511: target="_top"><code xmlns="" class=
8512: "filename">devel/ncurses</code></a> package.</p>
1.1 grant 8513: </li>
8514:
8515: <li>
1.45 wiz 8516: <p><code xmlns=
8517: "http://www.w3.org/TR/xhtml1/transitional" class=
8518: "filename">krb5.buildlink3.mk</code> uses the value
8519: of <code class="varname">KRB5_ACCEPTED</code> to
8520: choose between adding a dependency on Heimdal or
8521: MIT-krb5 for packages that require a Kerberos 5
1.1 grant 8522: implementation.</p>
8523: </li>
8524:
8525: <li>
1.45 wiz 8526: <p><code xmlns=
8527: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8528: "filename">motif.buildlink3.mk</code> checks for a
8529: system-provided Motif installation or adds a
8530: dependency on <a xmlns=
1.1 grant 8531: "http://www.w3.org/TR/xhtml1/transitional" href=
8532: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45 wiz 8533: target="_top"><code xmlns="" class=
8534: "filename">x11/lesstif</code></a> or <a xmlns=
1.20 ben 8535: "http://www.w3.org/TR/xhtml1/transitional" href=
8536: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45 wiz 8537: target="_top"><code xmlns="" class=
1.47 reed 8538: "filename">x11/openmotif</code></a>.</p>
1.1 grant 8539: </li>
8540:
8541: <li>
1.45 wiz 8542: <p><code xmlns=
8543: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8544: "filename">ossaudio.buildlink3.mk</code> defines
8545: several variables that may be used by packages that
1.47 reed 8546: use the Open Sound System (OSS) API.</p>
1.1 grant 8547: </li>
8548:
8549: <li>
1.45 wiz 8550: <p><code xmlns=
8551: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8552: "filename">pgsql.buildlink3.mk</code> will accept
8553: either Postgres 7.3 or 7.4, whichever is found
8554: installed. See the file for more information.</p>
1.1 grant 8555: </li>
8556:
8557: <li>
1.45 wiz 8558: <p><code xmlns=
8559: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8560: "filename">pthread.buildlink3.mk</code> uses the
8561: value of <code class="varname">PTHREAD_OPTS</code>
8562: and checks for native pthreads or adds a dependency
8563: on <a xmlns=
1.1 grant 8564: "http://www.w3.org/TR/xhtml1/transitional" href=
8565: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45 wiz 8566: target="_top"><code xmlns="" class=
1.47 reed 8567: "filename">devel/pth</code></a> as needed.</p>
1.1 grant 8568: </li>
8569:
8570: <li>
1.45 wiz 8571: <p><code xmlns=
8572: "http://www.w3.org/TR/xhtml1/transitional" class=
8573: "filename">xaw.buildlink3.mk</code> uses the value
8574: of <code class="varname">XAW_TYPE</code> to choose
8575: a particular Athena widgets library.</p>
1.1 grant 8576: </li>
8577: </ul>
8578: </div>
8579:
1.45 wiz 8580: <p>The comments in those <code xmlns=
8581: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8582: "filename">buildlink3.mk</code> files provide a more
1.1 grant 8583: complete description of how to use them properly.</p>
8584: </div>
8585:
1.67 hubertf 8586: <div class="sect1" lang="en">
1.1 grant 8587: <div class="titlepage">
8588: <div>
8589: <div>
8590: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8591: "creating-buildlink3.mk"></a>11.2. Writing
1.45 wiz 8592: <code xmlns=
8593: "http://www.w3.org/TR/xhtml1/transitional" class=
8594: "filename">buildlink3.mk</code> files</h2>
1.1 grant 8595: </div>
8596: </div>
8597: </div>
8598:
1.45 wiz 8599: <p>A package's <code xmlns=
8600: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8601: "filename">buildlink3.mk</code> file is included by
8602: Makefiles to indicate the need to compile and link
8603: against header files and libraries provided by the
1.45 wiz 8604: package. A <code xmlns=
8605: "http://www.w3.org/TR/xhtml1/transitional" class=
8606: "filename">buildlink3.mk</code> file should always
8607: provide enough information to add the correct type of
8608: dependency relationship and include any other
8609: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8610: class="filename">buildlink3.mk</code> files that it needs
8611: to find headers and libraries that it needs in turn.</p>
1.1 grant 8612:
1.45 wiz 8613: <p>To generate an initial <code xmlns=
8614: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8615: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 8616: Rene Hexel's <a xmlns=
8617: "http://www.w3.org/TR/xhtml1/transitional" href=
8618: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45 wiz 8619: target="_top"><code xmlns="" class=
8620: "filename">pkgtools/createbuildlink</code></a> package is
1.20 ben 8621: highly recommended. For most packages, the following
8622: command will generate a good starting point for
1.45 wiz 8623: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8624: class="filename">buildlink3.mk</code> files:</p>
1.1 grant 8625: <pre class="screen">
1.14 xtraeme 8626: <code class="prompt">%</code> <strong class=
8627: "userinput"><code>cd pkgsrc/<em class=
8628: "replaceable"><code>category</code></em>/<em class=
8629: "replaceable"><code>pkgdir</code></em>
8630: <code class=
1.49 rillig 8631: "prompt">%</code> createbuildlink >buildlink3.mk</code></strong>
1.1 grant 8632: </pre>
8633:
1.67 hubertf 8634: <div class="sect2" lang="en">
1.1 grant 8635: <div class="titlepage">
8636: <div>
8637: <div>
1.67 hubertf 8638: <h3 class="title"><a name=
8639: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 8640: buildlink3.mk file</h3>
1.1 grant 8641: </div>
8642: </div>
8643: </div>
8644:
1.45 wiz 8645: <p>The following real-life example <code xmlns=
8646: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8647: "filename">buildlink3.mk</code> is taken from
1.45 wiz 8648: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8649: class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 8650: <pre class="programlisting">
1.51 rillig 8651: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 8652:
1.51 rillig 8653: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
8654: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
1.1 grant 8655:
1.51 rillig 8656: .if !empty(BUILDLINK_DEPTH:M+)
8657: BUILDLINK_DEPENDS+= tiff
8658: .endif
1.1 grant 8659:
1.51 rillig 8660: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
8661: BUILDLINK_PACKAGES+= tiff
1.1 grant 8662:
1.51 rillig 8663: .if !empty(TIFF_BUILDLINK3_MK:M+)
8664: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
8665: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
8666: .endif # TIFF_BUILDLINK3_MK
1.1 grant 8667:
1.51 rillig 8668: .include "../../devel/zlib/buildlink3.mk"
8669: .include "../../graphics/jpeg/buildlink3.mk"
1.1 grant 8670:
1.51 rillig 8671: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
1.1 grant 8672: </pre>
8673:
1.14 xtraeme 8674: <p>The header and footer manipulate <code class=
8675: "varname">BUILDLINK_DEPTH</code>, which is common
1.45 wiz 8676: across all <code xmlns=
8677: "http://www.w3.org/TR/xhtml1/transitional" class=
8678: "filename">buildlink3.mk</code> files and is used to
8679: track at what depth we are including <code xmlns=
8680: "http://www.w3.org/TR/xhtml1/transitional" class=
8681: "filename">buildlink3.mk</code> files.</p>
1.1 grant 8682:
8683: <p>The first section controls if the dependency on
1.14 xtraeme 8684: <em class="replaceable"><code>pkg</code></em> is added.
8685: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 8686: global list of packages for which dependencies are
8687: added by buildlink3.</p>
8688:
8689: <p>The second section advises pkgsrc that the
1.45 wiz 8690: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8691: class="filename">buildlink3.mk</code> file for
1.14 xtraeme 8692: <em class="replaceable"><code>pkg</code></em> has been
8693: included at some point. <code class=
8694: "varname">BUILDLINK_PACKAGES</code> is the global list
1.45 wiz 8695: of packages for which <code xmlns=
8696: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8697: "filename">buildlink3.mk</code> files have been
8698: included. It must <span class=
8699: "emphasis"><em>always</em></span> be appended to within
1.45 wiz 8700: a <code xmlns=
8701: "http://www.w3.org/TR/xhtml1/transitional" class=
8702: "filename">buildlink3.mk</code> file.</p>
1.1 grant 8703:
8704: <p>The third section is protected from multiple
1.14 xtraeme 8705: inclusion and controls how the dependency on <em class=
8706: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 8707: important variables are set in the section:</p>
8708:
8709: <div class="itemizedlist">
8710: <ul type="disc">
8711: <li>
1.14 xtraeme 8712: <p><code class=
8713: "varname">BUILDLINK_DEPENDS.<em class=
8714: "replaceable"><code>pkg</code></em></code> is the
8715: actual dependency recorded in the installed
8716: package; this should always be set using
8717: <span><strong class="command">+=</strong></span>
8718: to ensure that we're appending to any
8719: pre-existing list of values. This variable should
8720: be set to the first version of the package that
8721: had the last change in the major number of a
8722: shared library or that had a major API
8723: change.</p>
1.1 grant 8724: </li>
8725:
8726: <li>
1.14 xtraeme 8727: <p><code class=
8728: "varname">BUILDLINK_PKGSRCDIR.<em class=
8729: "replaceable"><code>pkg</code></em></code> is the
8730: location of the <em class=
8731: "replaceable"><code>pkg</code></em> pkgsrc
1.47 reed 8732: directory.</p>
1.1 grant 8733: </li>
8734:
8735: <li>
1.14 xtraeme 8736: <p><code class=
8737: "varname">BUILDLINK_DEPMETHOD.<em class=
8738: "replaceable"><code>pkg</code></em></code> (not
8739: shown above) controls whether we use <code class=
8740: "varname">BUILD_DEPENDS</code> or <code class=
8741: "varname">DEPENDS</code> to add the dependency on
8742: <em class="replaceable"><code>pkg</code></em>.
8743: The build dependency is selected by setting
8744: <code class=
8745: "varname">BUILDLINK_DEPMETHOD.<em class=
8746: "replaceable"><code>pkg</code></em></code> to
1.1 grant 8747: “<span class="quote">build</span>”.
8748: By default, the full dependency is used.</p>
8749: </li>
8750:
8751: <li>
1.14 xtraeme 8752: <p><code class=
8753: "varname">BUILDLINK_INCDIRS.<em class=
8754: "replaceable"><code>pkg</code></em></code> and
8755: <code class=
1.67 hubertf 8756: "varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
8757: (not shown above) are lists of subdirectories of
8758: <code xmlns=
1.45 wiz 8759: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8760: "filename">${BUILDLINK_PREFIX.<em class=
8761: "replaceable"><code>pkg</code></em>}</code> to
8762: add to the header and library search paths. These
1.1 grant 8763: default to “<span class=
8764: "quote">include</span>” and
8765: “<span class="quote">lib</span>”
8766: respectively.</p>
8767: </li>
8768:
8769: <li>
1.14 xtraeme 8770: <p><code class=
8771: "varname">BUILDLINK_CPPFLAGS.<em class=
8772: "replaceable"><code>pkg</code></em></code> (not
8773: shown above) is the list of preprocessor flags to
8774: add to <code class="varname">CPPFLAGS</code>,
8775: which are passed on to the configure and build
8776: phases. The “<span class=
8777: "quote">-I</span>” option should be avoided
8778: and instead be handled using <code class=
8779: "varname">BUILDLINK_INCDIRS.<em class=
8780: "replaceable"><code>pkg</code></em></code> as
8781: above.</p>
1.1 grant 8782: </li>
8783: </ul>
8784: </div>
8785:
8786: <p>The following variables are all optionally defined
8787: within this second section (protected against multiple
8788: inclusion) and control which package files are
1.45 wiz 8789: symlinked into <code xmlns=
8790: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8791: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 8792: are transformed during the symlinking:</p>
8793:
8794: <div class="itemizedlist">
8795: <ul type="disc">
8796: <li>
1.14 xtraeme 8797: <p><code class=
8798: "varname">BUILDLINK_FILES.<em class=
8799: "replaceable"><code>pkg</code></em></code> (not
8800: shown above) is a shell glob pattern relative to
1.45 wiz 8801: <code xmlns=
8802: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8803: "filename">${BUILDLINK_PREFIX.<em class=
8804: "replaceable"><code>pkg</code></em>}</code> to be
1.45 wiz 8805: symlinked into <code xmlns=
8806: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8807: "filename">${BUILDLINK_DIR}</code>, e.g.
1.45 wiz 8808: <code xmlns=
8809: "http://www.w3.org/TR/xhtml1/transitional" class=
8810: "filename">include/*.h</code>.</p>
1.1 grant 8811: </li>
8812:
8813: <li>
1.14 xtraeme 8814: <p><code class=
8815: "varname">BUILDLINK_FILES_CMD.<em class=
8816: "replaceable"><code>pkg</code></em></code> (not
8817: shown above) is a shell pipeline that outputs to
1.45 wiz 8818: stdout a list of files relative to <code xmlns=
8819: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8820: "filename">${BUILDLINK_PREFIX.<em class=
8821: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 8822: resulting files are to be symlinked into
1.45 wiz 8823: <code xmlns=
8824: "http://www.w3.org/TR/xhtml1/transitional" class=
8825: "filename">${BUILDLINK_DIR}</code>. By default,
8826: this takes the <code xmlns=
8827: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8828: "filename">+CONTENTS</code> of a <em class=
8829: "replaceable"><code>pkg</code></em> and filters
8830: it through <code class=
8831: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
8832: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 8833: </li>
8834:
8835: <li>
1.14 xtraeme 8836: <p><code class=
8837: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8838: "replaceable"><code>pkg</code></em></code> (not
8839: shown above) is a filter command that filters
1.45 wiz 8840: <code xmlns=
8841: "http://www.w3.org/TR/xhtml1/transitional" class=
8842: "filename">+CONTENTS</code> input into a list of
8843: files relative to <code xmlns=
8844: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8845: "filename">${BUILDLINK_PREFIX.<em class=
8846: "replaceable"><code>pkg</code></em>}</code> on
8847: stdout. By default for overwrite packages,
8848: <code class=
8849: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8850: "replaceable"><code>pkg</code></em></code>
1.45 wiz 8851: outputs the contents of the <code xmlns=
8852: "http://www.w3.org/TR/xhtml1/transitional" class=
8853: "filename">include</code> and <code xmlns=
8854: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8855: "filename">lib</code> directories in the package
1.45 wiz 8856: <code xmlns=
8857: "http://www.w3.org/TR/xhtml1/transitional" class=
8858: "filename">+CONTENTS</code>, and for pkgviews
8859: packages, it outputs any libtool archives in
8860: <code xmlns=
8861: "http://www.w3.org/TR/xhtml1/transitional" class=
8862: "filename">lib</code> directories.</p>
1.1 grant 8863: </li>
8864:
8865: <li>
1.14 xtraeme 8866: <p><code class=
8867: "varname">BUILDLINK_TRANSFORM.<em class=
8868: "replaceable"><code>pkg</code></em></code> (not
8869: shown above) is a list of sed arguments used to
1.1 grant 8870: transform the name of the source filename into a
1.14 xtraeme 8871: destination filename, e.g. <span><strong class=
1.1 grant 8872: "command">-e
1.14 xtraeme 8873: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 8874: </li>
8875: </ul>
8876: </div>
8877:
1.45 wiz 8878: <p>The last section includes any <code xmlns=
8879: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8880: "filename">buildlink3.mk</code> needed for <em class=
8881: "replaceable"><code>pkg</code></em>'s library
1.45 wiz 8882: dependencies. Including these <code xmlns=
8883: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8884: "filename">buildlink3.mk</code> files means that the
8885: headers and libraries for these dependencies are also
1.45 wiz 8886: symlinked into <code xmlns=
8887: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8888: "filename">${BUILDLINK_DIR}</code> whenever the
8889: <em class="replaceable"><code>pkg</code></em>
1.45 wiz 8890: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8891: class="filename">buildlink3.mk</code> file is
1.14 xtraeme 8892: included.</p>
1.1 grant 8893: </div>
8894:
1.67 hubertf 8895: <div class="sect2" lang="en">
1.1 grant 8896: <div class="titlepage">
8897: <div>
8898: <div>
1.30 wiz 8899: <h3 class="title"><a name=
1.67 hubertf 8900: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 8901: <code class=
1.67 hubertf 8902: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
8903: in <code xmlns=
1.45 wiz 8904: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8905: "filename">buildlink3.mk</code> files</h3>
1.1 grant 8906: </div>
8907: </div>
8908: </div>
8909:
8910: <p>There are two situations that require increasing the
1.14 xtraeme 8911: dependency listed in <code class=
8912: "varname">BUILDLINK_DEPENDS.<em class=
8913: "replaceable"><code>pkg</code></em></code> after a
8914: package update:</p>
1.1 grant 8915:
8916: <div class="orderedlist">
8917: <ol type="1">
8918: <li>
8919: <p>if the sonames (major number of the library
8920: version) of any installed shared libraries
1.47 reed 8921: change.</p>
1.1 grant 8922: </li>
8923:
8924: <li>
8925: <p>if the API or interface to the header files
8926: change.</p>
8927: </li>
8928: </ol>
8929: </div>
8930:
1.14 xtraeme 8931: <p>In these cases, <code class=
8932: "varname">BUILDLINK_DEPENDS.<em class=
8933: "replaceable"><code>pkg</code></em></code> should be
8934: adjusted to require at least the new package version.
8935: In some cases, the packages that depend on this new
8936: version may need their <code class=
8937: "varname">PKGREVISION</code>s increased and, if they
1.45 wiz 8938: have <code xmlns=
8939: "http://www.w3.org/TR/xhtml1/transitional" class=
8940: "filename">buildlink3.mk</code> files, their
8941: <code class="varname">BUILDLINK_DEPENDS.<em class=
8942: "replaceable"><code>pkg</code></em></code> adjusted,
8943: too. This is needed so that binary packages made using
8944: it will require the correct package dependency and not
8945: settle for an older one which will not contain the
8946: necessary shared libraries.</p>
1.1 grant 8947:
8948: <p>Please take careful consideration before adjusting
1.14 xtraeme 8949: <code class="varname">BUILDLINK_DEPENDS.<em class=
8950: "replaceable"><code>pkg</code></em></code> as we don't
8951: want to cause unneeded package deletions and rebuilds.
8952: In many cases, new versions of packages work just fine
8953: with older dependencies. See <a href="#dependencies"
1.67 hubertf 8954: title=
1.68 ! rillig 8955: "16.1.4. Handling dependencies">Section 16.1.4,
1.67 hubertf 8956: “Handling dependencies”</a> for more
8957: information about dependencies on other packages,
1.25 rillig 8958: including the <code class=
8959: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
8960: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 8961: </div>
8962: </div>
8963:
1.67 hubertf 8964: <div class="sect1" lang="en">
1.1 grant 8965: <div class="titlepage">
8966: <div>
8967: <div>
8968: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8969: "writing-builtin.mk"></a>11.3. Writing
1.45 wiz 8970: <code xmlns=
8971: "http://www.w3.org/TR/xhtml1/transitional" class=
8972: "filename">builtin.mk</code> files</h2>
1.1 grant 8973: </div>
8974: </div>
8975: </div>
8976:
8977: <p>Some packages in pkgsrc install headers and libraries
8978: that coincide with headers and libraries present in the
1.45 wiz 8979: base system. Aside from a <code xmlns=
8980: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8981: "filename">buildlink3.mk</code> file, these packages
1.45 wiz 8982: should also include a <code xmlns=
8983: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8984: "filename">builtin.mk</code> file that includes the
8985: necessary checks to decide whether using the built-in
8986: software or the pkgsrc software is appropriate.</p>
1.1 grant 8987:
8988: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 8989: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 8990:
8991: <div class="orderedlist">
8992: <ol type="1">
8993: <li>
1.14 xtraeme 8994: <p>It should set <code class=
8995: "varname">USE_BUILTIN.<em class=
8996: "replaceable"><code>pkg</code></em></code> to
8997: either “<span class="quote">yes</span>”
8998: or “<span class="quote">no</span>”
8999: after it is included.</p>
1.1 grant 9000: </li>
9001:
9002: <li>
9003: <p>It should <span class=
9004: "emphasis"><em>not</em></span> override any
1.14 xtraeme 9005: <code class="varname">USE_BUILTIN.<em class=
9006: "replaceable"><code>pkg</code></em></code> which is
1.45 wiz 9007: already set before the <code xmlns=
9008: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9009: "filename">builtin.mk</code> file is included.</p>
1.1 grant 9010: </li>
9011:
9012: <li>
9013: <p>It should be written to allow multiple
9014: inclusion. This is <span class=
9015: "emphasis"><em>very</em></span> important and takes
1.45 wiz 9016: careful attention to <code xmlns=
9017: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9018: "filename">Makefile</code> coding.</p>
1.1 grant 9019: </li>
9020: </ol>
9021: </div>
9022:
1.67 hubertf 9023: <div class="sect2" lang="en">
1.1 grant 9024: <div class="titlepage">
9025: <div>
9026: <div>
1.67 hubertf 9027: <h3 class="title"><a name=
1.38 dillo 9028: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.45 wiz 9029: of a <code xmlns=
9030: "http://www.w3.org/TR/xhtml1/transitional" class=
9031: "filename">builtin.mk</code> file</h3>
1.1 grant 9032: </div>
9033: </div>
9034: </div>
9035:
9036: <p>The following is the recommended template for
9037: builtin.mk files:</p>
9038: <pre class="programlisting">
1.51 rillig 9039: .if !defined(IS_BUILTIN.foo)
9040: #
9041: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
9042: # genuinely exists in the system or not.
9043: #
9044: IS_BUILTIN.foo?= no
9045:
9046: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
9047: # version can be determined.
9048: #
9049: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
9050: BUILTIN_PKG.foo?= foo-1.0
9051: . endif
9052: .endif # IS_BUILTIN.foo
9053:
9054: .if !defined(USE_BUILTIN.foo)
9055: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
9056: . if defined(BUILTIN_PKG.foo)
9057: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
9058: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
9059: USE_BUILTIN.foo!= \
9060: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
9061: ${ECHO} "yes"; \
9062: else \
9063: ${ECHO} "no"; \
9064: fi
9065: . endif
9066: . endfor
9067: . endif
9068: .endif # USE_BUILTIN.foo
9069:
9070: CHECK_BUILTIN.foo?= no
9071: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
9072: #
9073: # Here we place code that depends on whether USE_BUILTIN.foo is set to
9074: # "yes" or "no".
9075: #
9076: .endif # CHECK_BUILTIN.foo
1.1 grant 9077: </pre>
9078:
1.14 xtraeme 9079: <p>The first section sets <code class=
9080: "varname">IS_BUILTIN.<em class=
9081: "replaceable"><code>pkg</code></em></code> depending on
9082: if <em class="replaceable"><code>pkg</code></em> really
9083: exists in the base system. This should not be a base
9084: system software with similar functionality to
9085: <em class="replaceable"><code>pkg</code></em>; it
9086: should only be “<span class=
9087: "quote">yes</span>” if the actual package is
9088: included as part of the base system. This variable is
1.45 wiz 9089: only used internally within the <code xmlns=
9090: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9091: "filename">builtin.mk</code> file.</p>
9092:
9093: <p>The second section sets <code class=
9094: "varname">BUILTIN_PKG.<em class=
9095: "replaceable"><code>pkg</code></em></code> to the
9096: version of <em class=
9097: "replaceable"><code>pkg</code></em> in the base system
9098: if it exists (if <code class=
9099: "varname">IS_BUILTIN.<em class=
9100: "replaceable"><code>pkg</code></em></code> is
1.1 grant 9101: “<span class="quote">yes</span>”). This
1.14 xtraeme 9102: variable is only used internally within the
1.45 wiz 9103: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9104: class="filename">builtin.mk</code> file.</p>
1.1 grant 9105:
1.14 xtraeme 9106: <p>The third section sets <code class=
9107: "varname">USE_BUILTIN.<em class=
9108: "replaceable"><code>pkg</code></em></code> and is
9109: <span class="emphasis"><em>required</em></span> in all
1.45 wiz 9110: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9111: class="filename">builtin.mk</code> files. The code in
9112: this section must make the determination whether the
9113: built-in software is adequate to satisfy the
9114: dependencies listed in <code class=
1.14 xtraeme 9115: "varname">BUILDLINK_DEPENDS.<em class=
9116: "replaceable"><code>pkg</code></em></code>. This is
9117: typically done by comparing <code class=
9118: "varname">BUILTIN_PKG.<em class=
9119: "replaceable"><code>pkg</code></em></code> against each
9120: of the dependencies in <code class=
9121: "varname">BUILDLINK_DEPENDS.<em class=
9122: "replaceable"><code>pkg</code></em></code>.
9123: <code class="varname">USE_BUILTIN.<em class=
9124: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 9125: "emphasis"><em>must</em></span> be set to the correct
1.45 wiz 9126: value by the end of the <code xmlns=
9127: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9128: "filename">builtin.mk</code> file. Note that
9129: <code class="varname">USE_BUILTIN.<em class=
9130: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 9131: “<span class="quote">yes</span>” even if
1.14 xtraeme 9132: <code class="varname">IS_BUILTIN.<em class=
9133: "replaceable"><code>pkg</code></em></code> is
1.1 grant 9134: “<span class="quote">no</span>” because we
9135: may make the determination that the built-in version of
9136: the software is similar enough to be used as a
9137: replacement.</p>
9138:
1.14 xtraeme 9139: <p>The last section is guarded by <code class=
9140: "varname">CHECK_BUILTIN.<em class=
9141: "replaceable"><code>pkg</code></em></code>, and
9142: includes code that uses the value of <code class=
9143: "varname">USE_BUILTIN.<em class=
9144: "replaceable"><code>pkg</code></em></code> set in the
9145: previous section. This typically includes, e.g., adding
1.1 grant 9146: additional dependency restrictions and listing
1.45 wiz 9147: additional files to symlink into <code xmlns=
9148: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9149: "filename">${BUILDLINK_DIR}</code> (via <code class=
9150: "varname">BUILDLINK_FILES.<em class=
9151: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 9152: </div>
9153:
1.67 hubertf 9154: <div class="sect2" lang="en">
1.1 grant 9155: <div class="titlepage">
9156: <div>
9157: <div>
1.30 wiz 9158: <h3 class="title"><a name=
1.38 dillo 9159: "native-or-pkgsrc-preference"></a>11.3.2. Global
1.30 wiz 9160: preferences for native or pkgsrc software</h3>
1.1 grant 9161: </div>
9162: </div>
9163: </div>
9164:
9165: <p>When building packages, it's possible to choose
9166: whether to set a global preference for using either the
9167: built-in (native) version or the pkgsrc version of
9168: software to satisfy a dependency. This is controlled by
1.14 xtraeme 9169: setting <code class="varname">PREFER_PKGSRC</code> and
9170: <code class="varname">PREFER_NATIVE</code>. These
9171: variables take values of either “<span class=
1.1 grant 9172: "quote">yes</span>”, “<span class=
9173: "quote">no</span>”, or a list of packages.
1.14 xtraeme 9174: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
9175: to use the pkgsrc versions of software, while
9176: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
9177: to use the built-in versions. Preferences are
9178: determined by the most specific instance of the package
9179: in either <code class="varname">PREFER_PKGSRC</code> or
9180: <code class="varname">PREFER_NATIVE</code>. If a
9181: package is specified in neither or in both variables,
9182: then <code class="varname">PREFER_PKGSRC</code> has
9183: precedence over <code class=
9184: "varname">PREFER_NATIVE</code>. For example, to require
9185: using pkgsrc versions of software for all but the most
9186: basic bits on a NetBSD system, you can set:</p>
1.1 grant 9187: <pre class="programlisting">
1.51 rillig 9188: PREFER_PKGSRC= yes
9189: PREFER_NATIVE= getopt skey tcp_wrappers
1.1 grant 9190: </pre>
9191:
9192: <p>A package <span class=
1.45 wiz 9193: "emphasis"><em>must</em></span> have a <code xmlns=
9194: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9195: "filename">builtin.mk</code> file to be listed in
9196: <code class="varname">PREFER_NATIVE</code>, otherwise
9197: it is simply ignored in that list.</p>
1.1 grant 9198: </div>
9199: </div>
9200: </div>
9201:
1.67 hubertf 9202: <div class="chapter" lang="en">
1.1 grant 9203: <div class="titlepage">
9204: <div>
9205: <div>
1.67 hubertf 9206: <h2 class="title"><a name=
1.38 dillo 9207: "pkginstall"></a>Chapter 12. The pkginstall
1.35 jmmv 9208: framework</h2>
1.1 grant 9209: </div>
9210: </div>
9211: </div>
9212:
9213: <div class="toc">
9214: <p><b>Table of Contents</b></p>
9215:
9216: <dl>
1.30 wiz 9217: <dt><span class="sect1"><a href=
1.38 dillo 9218: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 9219: directories outside the installation
9220: prefix</a></span></dt>
9221:
9222: <dd>
9223: <dl>
9224: <dt><span class="sect2"><a href=
1.38 dillo 9225: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 9226: manipulation</a></span></dt>
9227:
9228: <dt><span class="sect2"><a href=
1.38 dillo 9229: "#files-outside-prefix">12.1.2. File
1.35 jmmv 9230: manipulation</a></span></dt>
9231: </dl>
9232: </dd>
9233:
1.38 dillo 9234: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 9235: Configuration files</a></span></dt>
9236:
9237: <dd>
9238: <dl>
9239: <dt><span class="sect2"><a href=
1.38 dillo 9240: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 9241: "varname">PKG_SYSCONFDIR</code> is
9242: set</a></span></dt>
9243:
9244: <dt><span class="sect2"><a href=
1.38 dillo 9245: "#conf-files-configure">12.2.2. Telling the
1.47 reed 9246: software where configuration files
1.35 jmmv 9247: are</a></span></dt>
9248:
9249: <dt><span class="sect2"><a href=
1.38 dillo 9250: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 9251: installations</a></span></dt>
9252:
9253: <dt><span class="sect2"><a href=
1.38 dillo 9254: "#conf-files-disable">12.2.4. Disabling handling of
1.35 jmmv 9255: configuration files</a></span></dt>
9256: </dl>
9257: </dd>
9258:
1.38 dillo 9259: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 9260: System startup scripts</a></span></dt>
9261:
9262: <dd>
9263: <dl>
9264: <dt><span class="sect2"><a href=
1.38 dillo 9265: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 9266: of system startup scripts</a></span></dt>
9267: </dl>
9268: </dd>
1.1 grant 9269:
1.30 wiz 9270: <dt><span class="sect1"><a href=
1.38 dillo 9271: "#users-and-groups">12.4. System users and
1.35 jmmv 9272: groups</a></span></dt>
9273:
1.38 dillo 9274: <dt><span class="sect1"><a href="#shells">12.5. System
1.35 jmmv 9275: shells</a></span></dt>
9276:
9277: <dd>
9278: <dl>
9279: <dt><span class="sect2"><a href=
1.65 hubertf 9280: "#shells-disable">12.5.1. Disabling shell
9281: registration</a></span></dt>
9282: </dl>
9283: </dd>
9284:
9285: <dt><span class="sect1"><a href="#fonts">12.6.
9286: Fonts</a></span></dt>
9287:
9288: <dd>
9289: <dl>
9290: <dt><span class="sect2"><a href=
9291: "#fonts-disable">12.6.1. Disabling automatic update
9292: of the fonts databases</a></span></dt>
1.35 jmmv 9293: </dl>
9294: </dd>
1.1 grant 9295: </dl>
9296: </div>
9297:
1.35 jmmv 9298: <p>This chapter describes the framework known as
9299: <code class="literal">pkginstall</code>, whose key features
9300: are:</p>
9301:
9302: <div class="itemizedlist">
9303: <ul type="disc">
9304: <li>
9305: <p>Generic installation and manipulation of
9306: directories and files outside the pkgsrc-handled
9307: tree, <code class="varname">LOCALBASE</code>.</p>
9308: </li>
9309:
9310: <li>
9311: <p>Automatic handling of configuration files during
9312: installation, provided that packages are correctly
9313: designed.</p>
9314: </li>
9315:
9316: <li>
9317: <p>Generation and installation of system startup
9318: scripts.</p>
9319: </li>
9320:
9321: <li>
9322: <p>Registration of system users and groups.</p>
9323: </li>
9324:
9325: <li>
9326: <p>Registration of system shells.</p>
9327: </li>
1.65 hubertf 9328:
9329: <li>
9330: <p>Automatic updating of fonts databases.</p>
9331: </li>
1.35 jmmv 9332: </ul>
9333: </div>
9334:
9335: <p>The following sections inspect each of the above points
1.65 hubertf 9336: in detail.</p>
1.35 jmmv 9337:
9338: <p>You may be thinking that many of the things described
9339: here could be easily done with simple code in the package's
9340: post-installation target (<code class=
9341: "literal">post-install</code>). <span class=
9342: "emphasis"><em>This is incorrect</em></span>, as the code
9343: in them is only executed when building from source.
9344: Machines using binary packages could not benefit from it at
9345: all (as the code itself could be unavailable). Therefore,
9346: the only way to achieve any of the items described above is
9347: by means of the installation scripts, which are
9348: automatically generated by pkginstall.</p>
1.1 grant 9349:
1.67 hubertf 9350: <div class="sect1" lang="en">
1.1 grant 9351: <div class="titlepage">
9352: <div>
9353: <div>
9354: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9355: "files-and-dirs-outside-prefix"></a>12.1. Files
9356: and directories outside the installation
9357: prefix</h2>
1.1 grant 9358: </div>
9359: </div>
9360: </div>
9361:
1.45 wiz 9362: <p>As you already know, the <code xmlns=
9363: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9364: "filename">PLIST</code> file holds a list of files and
9365: directories that belong to a package. The names used in
1.45 wiz 9366: it are relative to the installation prefix (<code xmlns=
9367: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9368: "filename">${PREFIX}</code>), which means that it cannot
9369: register files outside this directory (absolute path
9370: names are not allowed). Despite this restriction, some
9371: packages need to install files outside this location;
1.45 wiz 9372: e.g., under <code xmlns=
9373: "http://www.w3.org/TR/xhtml1/transitional" class=
9374: "filename">${VARBASE}</code> or <code xmlns=
9375: "http://www.w3.org/TR/xhtml1/transitional" class=
9376: "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35 jmmv 9377:
9378: <p>The only way to achieve this is to create such files
9379: during installation time by using the installation
9380: scripts. These scripts can run arbitrary commands, so
9381: they have the potential to create and manage files
1.47 reed 9382: anywhere in the file system. Here is where pkginstall
1.35 jmmv 9383: comes into play: it provides generic scripts to abstract
9384: the manipulation of such files and directories based on
1.45 wiz 9385: variables set in the package's <code xmlns=
9386: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9387: "filename">Makefile</code>. The rest of this section
1.47 reed 9388: describes these variables.</p>
1.1 grant 9389:
1.67 hubertf 9390: <div class="sect2" lang="en">
1.35 jmmv 9391: <div class="titlepage">
1.1 grant 9392: <div>
1.35 jmmv 9393: <div>
1.67 hubertf 9394: <h3 class="title"><a name=
1.63 dillo 9395: "dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 9396: manipulation</h3>
9397: </div>
1.1 grant 9398: </div>
9399: </div>
9400:
1.35 jmmv 9401: <p>The following variables can be set to request the
1.47 reed 9402: creation of directories anywhere in the file
9403: system:</p>
1.27 rillig 9404:
1.35 jmmv 9405: <div class="itemizedlist">
9406: <ul type="disc">
9407: <li>
9408: <p><code class="varname">MAKE_DIRS</code> and
9409: <code class="varname">OWN_DIRS</code> contain a
9410: list of directories that should be created and
9411: should attempt to be destroyed by the
9412: installation scripts. The difference between the
9413: two is that the latter prompts the administrator
9414: to remove any directories that may be left after
9415: deinstallation (because they were not empty),
9416: while the former does not.</p>
9417: </li>
1.1 grant 9418:
1.35 jmmv 9419: <li>
9420: <p><code class="varname">MAKE_DIRS_PERMS</code>
9421: and <code class="varname">OWN_DIRS_PERMS</code>
9422: contain a list of tuples describing which
9423: directories should be created and should attempt
9424: to be destroyed by the installation scripts. Each
9425: tuple holds the following values, separated by
9426: spaces: the directory name, its owner, its group
9427: and its numerical mode. For example:</p>
9428: <pre class="programlisting">
1.51 rillig 9429: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9430: </pre>
1.1 grant 9431:
1.35 jmmv 9432: <p>The difference between the two is exactly the
9433: same as their non-<code class=
9434: "varname">PERMS</code> counterparts.</p>
9435: </li>
9436: </ul>
9437: </div>
9438: </div>
9439:
1.67 hubertf 9440: <div class="sect2" lang="en">
1.35 jmmv 9441: <div class="titlepage">
9442: <div>
9443: <div>
1.67 hubertf 9444: <h3 class="title"><a name=
9445: "files-outside-prefix"></a>12.1.2. File
1.35 jmmv 9446: manipulation</h3>
9447: </div>
9448: </div>
9449: </div>
9450:
9451: <p>Creating non-empty files outside the installation
1.45 wiz 9452: prefix is tricky because the <code xmlns=
9453: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9454: "filename">PLIST</code> forces all files to be inside
9455: it. To overcome this problem, the only solution is to
9456: extract the file in the known place (i.e., inside the
9457: installation prefix) and copy it to the appropriate
9458: location during installation (done by the installation
9459: scripts generated by pkginstall). We will call the
9460: former the <span class="emphasis"><em>master
9461: file</em></span> in the following paragraphs, which
9462: describe the variables that can be used to
9463: automatically and consistently handle files outside the
9464: installation prefix:</p>
9465:
9466: <div class="itemizedlist">
9467: <ul type="disc">
9468: <li>
9469: <p><code class="varname">CONF_FILES</code> and
9470: <code class="varname">SUPPORT_FILES</code> are
9471: pairs of master and target files. During
9472: installation time, the master file is copied to
9473: the target one if and only if the latter does not
9474: exist. Upon deinstallation, the target file is
9475: removed provided that it was not modified by the
9476: installation.</p>
9477:
9478: <p>The difference between the two is that the
9479: latter prompts the administrator to remove any
9480: files that may be left after deinstallation
9481: (because they were not empty), while the former
9482: does not.</p>
9483: </li>
9484:
9485: <li>
9486: <p><code class="varname">CONF_FILES_PERMS</code>
9487: and <code class=
9488: "varname">SUPPORT_FILES_PERMS</code> contain
9489: tuples describing master files as well as their
9490: target locations. For each of them, it also
9491: specifies their owner, their group and their
9492: numeric permissions, in this order. For
9493: example:</p>
9494: <pre class="programlisting">
1.51 rillig 9495: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9496: </pre>
9497:
9498: <p>The difference between the two is exactly the
9499: same as their non-<code class=
9500: "varname">PERMS</code> counterparts.</p>
9501: </li>
9502: </ul>
9503: </div>
9504: </div>
9505: </div>
9506:
1.67 hubertf 9507: <div class="sect1" lang="en">
1.35 jmmv 9508: <div class="titlepage">
9509: <div>
9510: <div>
9511: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9512: "conf-files"></a>12.2. Configuration
9513: files</h2>
1.35 jmmv 9514: </div>
9515: </div>
9516: </div>
9517:
9518: <p>Configuration files are special in the sense that they
9519: are installed in their own specific directory,
9520: <code class="varname">PKG_SYSCONFDIR</code>, and need
9521: special treatment during installation (most of which is
9522: automated by pkginstall). The main concept you must bear
1.36 wiz 9523: in mind is that files marked as configuration files are
1.35 jmmv 9524: automatically copied to the right place (somewhere inside
9525: <code class="varname">PKG_SYSCONFDIR</code>) during
9526: installation <span class="emphasis"><em>if and only
9527: if</em></span> they didn't exist before. Similarly, they
9528: will not be removed if they have local modifications.
1.36 wiz 9529: This ensures that administrators never lose any custom
1.35 jmmv 9530: changes they may have made.</p>
9531:
1.67 hubertf 9532: <div class="sect2" lang="en">
1.35 jmmv 9533: <div class="titlepage">
9534: <div>
9535: <div>
1.67 hubertf 9536: <h3 class="title"><a name=
9537: "conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 9538: <code class="varname">PKG_SYSCONFDIR</code> is
9539: set</h3>
9540: </div>
9541: </div>
9542: </div>
9543:
9544: <p>As said before, the <code class=
9545: "varname">PKG_SYSCONFDIR</code> variable specifies
9546: where configuration files shall be installed. Its
9547: contents are set based upon the following
9548: variables:</p>
9549:
9550: <div class="itemizedlist">
9551: <ul type="disc">
9552: <li>
9553: <p><code class="varname">PKG_SYSCONFBASE</code>:
9554: The configuration's root directory. Defaults to
1.45 wiz 9555: <code xmlns=
9556: "http://www.w3.org/TR/xhtml1/transitional" class=
9557: "filename">${PREFIX}/etc</code> although it may
9558: be overridden by the user to point to his
9559: preferred location (e.g., <code xmlns=
9560: "http://www.w3.org/TR/xhtml1/transitional" class=
9561: "filename">/etc</code>, <code xmlns=
9562: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9563: "filename">/etc/pkg</code>, etc.). Packages must
9564: not use it directly.</p>
9565: </li>
9566:
9567: <li>
9568: <p><code class=
9569: "varname">PKG_SYSCONFSUBDIR</code>: A
9570: subdirectory of <code class=
9571: "varname">PKG_SYSCONFBASE</code> under which the
9572: configuration files for the package being built
9573: shall be installed. The definition of this
9574: variable only makes sense in the package's
1.45 wiz 9575: <code xmlns=
9576: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 9577: "filename">Makefile</code> (i.e., it is not
9578: user-customizable).</p>
1.35 jmmv 9579:
9580: <p>As an example, consider the Apache package,
9581: <a xmlns=
9582: "http://www.w3.org/TR/xhtml1/transitional" href=
9583: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45 wiz 9584: target="_top"><code xmlns="" class=
9585: "filename">www/apache2</code></a>, which places
9586: its configuration files under the <code xmlns=
9587: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9588: "filename">httpd/</code> subdirectory of
9589: <code class="varname">PKG_SYSCONFBASE</code>.
9590: This should be set in the package Makefile.</p>
9591: </li>
9592:
9593: <li>
9594: <p><code class="varname">PKG_SYSCONFVAR</code>:
9595: Specifies the name of the variable that holds
9596: this package's configuration directory (if
9597: different from <code class=
9598: "varname">PKG_SYSCONFBASE</code>). It defaults to
9599: <code class="varname">PKGBASE</code>'s value, and
9600: is always prefixed with <code class=
9601: "literal">PKG_SYSCONFDIR</code>.</p>
9602: </li>
9603:
9604: <li>
9605: <p><code class=
9606: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
9607: Holds the directory where the configuration files
9608: for the package identified by <code class=
9609: "varname">PKG_SYSCONFVAR</code>'s shall be
9610: placed.</p>
9611: </li>
9612: </ul>
9613: </div>
9614:
9615: <p>Based on the above variables, pkginstall determines
9616: the value of <code class=
9617: "varname">PKG_SYSCONFDIR</code>, which is the
9618: <span class="emphasis"><em>only</em></span> variable
9619: that can be used within a package to refer to its
9620: configuration directory. The algorithm used to set its
9621: value is basically the following:</p>
9622:
9623: <div class="orderedlist">
9624: <ol type="1">
9625: <li>
9626: <p>If <code class=
9627: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9628: is set, its value is used.</p>
9629: </li>
9630:
9631: <li>
9632: <p>If the previous variable is not defined but
9633: <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45 wiz 9634: set in the package's <code xmlns=
9635: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9636: "filename">Makefile</code>, the resulting value
1.45 wiz 9637: is <code xmlns=
9638: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9639: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
9640: </li>
9641:
9642: <li>
1.45 wiz 9643: <p>Otherwise, it is set to <code xmlns=
9644: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9645: "filename">${PKG_SYSCONFBASE}</code>.</p>
9646: </li>
9647: </ol>
9648: </div>
9649:
1.45 wiz 9650: <p>It is worth mentioning that <code xmlns=
9651: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9652: "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45 wiz 9653: added to <code xmlns=
9654: "http://www.w3.org/TR/xhtml1/transitional" class=
9655: "filename">OWN_DIRS</code>. See <a href=
9656: "#dirs-outside-prefix" title=
1.63 dillo 9657: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 9658: “Directory manipulation”</a> what this
9659: means.</p>
9660: </div>
9661:
1.67 hubertf 9662: <div class="sect2" lang="en">
1.35 jmmv 9663: <div class="titlepage">
9664: <div>
9665: <div>
1.67 hubertf 9666: <h3 class="title"><a name=
1.63 dillo 9667: "conf-files-configure"></a>12.2.2. Telling
9668: the software where configuration files are</h3>
1.35 jmmv 9669: </div>
9670: </div>
9671: </div>
9672:
9673: <p>Given that pkgsrc (and users!) expect configuration
9674: files to be in a known place, you need to teach each
1.36 wiz 9675: package where it shall install its files. In some cases
1.35 jmmv 9676: you will have to patch the package Makefiles to achieve
9677: it. If you are lucky, though, it may be as easy as
9678: passing an extra flag to the configuration script; this
1.47 reed 9679: is the case of GNU Autoconf- generated files:</p>
1.35 jmmv 9680: <pre class="programlisting">
1.51 rillig 9681: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35 jmmv 9682: </pre>
9683:
9684: <p>Note that this specifies where the package has to
9685: <span class="emphasis"><em>look for</em></span> its
9686: configuration files, not where they will be originally
9687: installed (although the difference is never explicit,
9688: unfortunately).</p>
9689: </div>
9690:
1.67 hubertf 9691: <div class="sect2" lang="en">
1.35 jmmv 9692: <div class="titlepage">
9693: <div>
9694: <div>
1.67 hubertf 9695: <h3 class="title"><a name=
1.63 dillo 9696: "conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 9697: installations</h3>
9698: </div>
9699: </div>
9700: </div>
9701:
9702: <p>As said before, pkginstall automatically handles
9703: configuration files. This means that <span class=
9704: "strong"><strong>the packages themselves must not touch
1.45 wiz 9705: the contents of <code xmlns=
9706: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9707: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 9708: directly</strong></span>. Bad news is that many
9709: software installation scripts will, out of the box,
9710: mess with the contents of that directory. So what is
9711: the correct procedure to fix this issue?</p>
1.35 jmmv 9712:
9713: <p>You must teach the package (usually by manually
9714: patching it) to install any configuration files under
1.45 wiz 9715: the examples hierarchy, <code xmlns=
9716: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9717: "filename">share/examples/${PKGBASE}/</code>. This way,
1.45 wiz 9718: the <code xmlns=
9719: "http://www.w3.org/TR/xhtml1/transitional" class=
9720: "filename">PLIST</code> registers them and the
9721: administrator always has the original copies
1.35 jmmv 9722: available.</p>
9723:
9724: <p>Once the required configuration files are in place
9725: (i.e., under the examples hierarchy), the pkginstall
9726: framework can use them as master copies during the
1.45 wiz 9727: package installation to update what is in <code xmlns=
9728: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9729: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
9730: the variables <code class="varname">CONF_FILES</code>
9731: and <code class="varname">CONF_FILES_PERMS</code> are
9732: used. Check out <a href="#files-outside-prefix" title=
1.63 dillo 9733: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 9734: “File manipulation”</a> for information
9735: about their syntax and their purpose. Here is an
9736: example, taken from the <a xmlns=
9737: "http://www.w3.org/TR/xhtml1/transitional" href=
9738: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45 wiz 9739: target="_top"><code xmlns="" class=
9740: "filename">mail/mutt</code></a> package:</p>
1.35 jmmv 9741: <pre class="programlisting">
1.51 rillig 9742: EGDIR= ${PREFIX}/share/doc/mutt/samples
9743: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35 jmmv 9744: </pre>
9745:
9746: <p>Note that the <code class="varname">EGDIR</code>
9747: variable is specific to that package and has no meaning
9748: outside it.</p>
9749: </div>
9750:
1.67 hubertf 9751: <div class="sect2" lang="en">
1.35 jmmv 9752: <div class="titlepage">
9753: <div>
9754: <div>
1.67 hubertf 9755: <h3 class="title"><a name=
9756: "conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 9757: handling of configuration files</h3>
9758: </div>
9759: </div>
9760: </div>
9761:
9762: <p>The automatic copying of config files can be toggled
9763: by setting the environment variable <code class=
9764: "varname">PKG_CONFIG</code> prior to package
9765: installation.</p>
9766: </div>
9767: </div>
9768:
1.67 hubertf 9769: <div class="sect1" lang="en">
1.35 jmmv 9770: <div class="titlepage">
9771: <div>
9772: <div>
9773: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9774: "rcd-scripts"></a>12.3. System startup
9775: scripts</h2>
1.35 jmmv 9776: </div>
9777: </div>
9778: </div>
9779:
9780: <p>System startup scripts are special files because they
9781: must be installed in a place known by the underlying OS,
9782: usually outside the installation prefix. Therefore, the
9783: same rules described in <a href=
9784: "#files-and-dirs-outside-prefix" title=
1.38 dillo 9785: "12.1. Files and directories outside the installation prefix">
1.63 dillo 9786: Section 12.1, “Files and directories outside
9787: the installation prefix”</a> apply, and the same
1.35 jmmv 9788: solutions can be used. However, pkginstall provides a
1.36 wiz 9789: special mechanism to handle these files.</p>
1.35 jmmv 9790:
9791: <p>In order to provide system startup scripts, the
9792: package has to:</p>
9793:
9794: <div class="orderedlist">
9795: <ol type="1">
9796: <li>
1.45 wiz 9797: <p>Store the script inside <code xmlns=
9798: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9799: "filename">${FILESDIR}</code>, with the
9800: <code class="literal">.sh</code> suffix appended.
9801: Considering the <a xmlns=
9802: "http://www.w3.org/TR/xhtml1/transitional" href=
9803: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45 wiz 9804: target="_top"><code xmlns="" class=
9805: "filename">print/cups</code></a> package as an
9806: example, it has a <code xmlns=
9807: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9808: "filename">cupsd.sh</code> in its files
9809: directory.</p>
9810: </li>
9811:
9812: <li>
9813: <p>Tell pkginstall to handle it, appending the name
9814: of the script, without its extension, to the
9815: <code class="varname">RCD_SCRIPTS</code> variable.
9816: Continuing the previous example:</p>
9817: <pre class="programlisting">
1.51 rillig 9818: RCD_SCRIPTS+= cupsd
1.35 jmmv 9819: </pre>
9820: </li>
9821: </ol>
9822: </div>
9823:
9824: <p>Once this is done, pkginstall will do the following
9825: steps for each script in an automated fashion:</p>
9826:
9827: <div class="orderedlist">
9828: <ol type="1">
9829: <li>
9830: <p>Process the file found in the files directory
9831: applying all the substitutions described in the
1.45 wiz 9832: <code xmlns=
9833: "http://www.w3.org/TR/xhtml1/transitional" class=
9834: "filename">FILES_SUBST</code> variable.</p>
1.35 jmmv 9835: </li>
9836:
9837: <li>
9838: <p>Copy the script from the files directory to the
1.45 wiz 9839: examples hierarchy, <code xmlns=
9840: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9841: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 9842: Note that this master file must be explicitly
1.45 wiz 9843: registered in the <code xmlns=
9844: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9845: "filename">PLIST</code>.</p>
9846: </li>
9847:
9848: <li>
9849: <p>Add code to the installation scripts to copy the
9850: startup script from the examples hierarchy into the
9851: system-wide startup scripts directory.</p>
9852: </li>
9853: </ol>
9854: </div>
9855:
1.67 hubertf 9856: <div class="sect2" lang="en">
1.35 jmmv 9857: <div class="titlepage">
9858: <div>
9859: <div>
1.67 hubertf 9860: <h3 class="title"><a name=
1.63 dillo 9861: "rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 9862: handling of system startup scripts</h3>
9863: </div>
9864: </div>
9865: </div>
9866:
9867: <p>The automatic copying of config files can be toggled
9868: by setting the environment variable <code class=
9869: "varname">PKG_RCD_SCRIPTS</code> prior to package
9870: installation. Note that the scripts will be always
1.45 wiz 9871: copied inside the examples hierarchy, <code xmlns=
9872: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9873: "filename">${PREFIX}/share/examples/rc.d/</code>, no
9874: matter what the value of this variable is.</p>
9875: </div>
9876: </div>
9877:
1.67 hubertf 9878: <div class="sect1" lang="en">
1.35 jmmv 9879: <div class="titlepage">
9880: <div>
9881: <div>
9882: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9883: "users-and-groups"></a>12.4. System users and
9884: groups</h2>
1.35 jmmv 9885: </div>
9886: </div>
9887: </div>
9888:
9889: <p>If a package needs to create special users and/or
9890: groups during installation, it can do so by using the
9891: pkginstall framework.</p>
9892:
9893: <p>Users can be created by adding entries to the
9894: <code class="varname">PKG_USERS</code> variable. Each
1.45 wiz 9895: entry has the following syntax, which mimics <code xmlns=
9896: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9897: "filename">/etc/passwd</code>:</p>
9898: <pre class="programlisting">
1.51 rillig 9899: user:group[:[userid][:[descr][:[home][:shell]]]]
1.35 jmmv 9900: </pre>
9901:
9902: <p>Only the user and group are required; everything else
9903: is optional, but the colons must be in the right places
9904: when specifying optional bits. By default, a new user
1.45 wiz 9905: will have home directory <code xmlns=
9906: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9907: "filename">/nonexistent</code>, and login shell
1.45 wiz 9908: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9909: class="filename">/sbin/nologin</code> unless they are
9910: specified as part of the user element. Note that if the
1.51 rillig 9911: description contains spaces, then spaces should be
1.45 wiz 9912: backslash-escaped, as in:</p>
1.35 jmmv 9913: <pre class="programlisting">
1.51 rillig 9914: foo:foogrp::The\ Foomister
1.35 jmmv 9915: </pre>
9916:
9917: <p>Similarly, groups can be created using the
9918: <code class="varname">PKG_GROUPS</code> variable, whose
9919: syntax is:</p>
9920: <pre class="programlisting">
1.51 rillig 9921: group[:groupid]
1.35 jmmv 9922: </pre>
9923:
9924: <p>As before, only the group name is required; the
9925: numeric identifier is optional.</p>
9926: </div>
9927:
1.67 hubertf 9928: <div class="sect1" lang="en">
1.35 jmmv 9929: <div class="titlepage">
9930: <div>
9931: <div>
9932: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 9933: "shells"></a>12.5. System shells</h2>
1.35 jmmv 9934: </div>
9935: </div>
9936: </div>
9937:
9938: <p>Packages that install system shells should register
1.45 wiz 9939: them in the shell database, <code xmlns=
9940: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9941: "filename">/etc/shells</code>, to make things easier to
9942: the administrator. This must be done from the
9943: installation scripts to keep binary packages working on
9944: any system. pkginstall provides an easy way to accomplish
9945: this task.</p>
9946:
9947: <p>When a package provides a shell interpreter, it has to
9948: set the <code class="varname">PKG_SHELL</code> variable
9949: to its absolute file name. This will add some hooks to
9950: the installation scripts to handle it. Consider the
9951: following example, taken from <a xmlns=
9952: "http://www.w3.org/TR/xhtml1/transitional" href=
9953: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45 wiz 9954: target="_top"><code xmlns="" class=
9955: "filename">shells/zsh</code></a>:</p>
1.35 jmmv 9956: <pre class="programlisting">
1.51 rillig 9957: PKG_SHELL= ${PREFIX}/bin/zsh
1.35 jmmv 9958: </pre>
9959:
1.67 hubertf 9960: <div class="sect2" lang="en">
1.35 jmmv 9961: <div class="titlepage">
9962: <div>
9963: <div>
1.67 hubertf 9964: <h3 class="title"><a name=
9965: "shells-disable"></a>12.5.1. Disabling shell
1.65 hubertf 9966: registration</h3>
1.35 jmmv 9967: </div>
9968: </div>
9969: </div>
9970:
9971: <p>The automatic registration of shell interpreters can
9972: be disabled by the administrator by setting the
1.45 wiz 9973: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9974: class="filename">PKG_REGISTER_SHELLS</code> environment
9975: variable to <code class="literal">NO</code>.</p>
1.35 jmmv 9976: </div>
9977: </div>
1.65 hubertf 9978:
1.67 hubertf 9979: <div class="sect1" lang="en">
1.65 hubertf 9980: <div class="titlepage">
9981: <div>
9982: <div>
9983: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 9984: "fonts"></a>12.6. Fonts</h2>
1.65 hubertf 9985: </div>
9986: </div>
9987: </div>
9988:
9989: <p>Packages that install X11 fonts should update the
9990: database files that index the fonts within each fonts
9991: directory. This can easily be accomplished within the
9992: pkginstall framework.</p>
9993:
9994: <p>When a package installs X11 fonts, it must list the
9995: directories in which fonts are installed in the
9996: <code class="varname">FONTS_DIRS.<em class=
9997: "replaceable"><code>type</code></em></code> variables,
9998: where <em class="replaceable"><code>type</code></em> can
9999: be one of “<span class="quote">ttf</span>”,
10000: “<span class="quote">type1</span>” or
10001: “<span class="quote">x11</span>”. This will
10002: add hooks to the installation scripts to run the
10003: appropriate commands to update the fonts database files
10004: within each of those directories. For convenience, if the
10005: directory path is relative, it is taken to be relative to
10006: the package's installation prefix. Consider the following
10007: example, taken from <a xmlns=
10008: "http://www.w3.org/TR/xhtml1/transitional" href=
10009: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/dbz-ttf/README.html"
10010: target="_top"><code xmlns="" class=
10011: "filename">fonts/dbz-ttf</code></a>:</p>
10012: <pre class="programlisting">
10013: FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF
10014: </pre>
10015:
1.67 hubertf 10016: <div class="sect2" lang="en">
1.65 hubertf 10017: <div class="titlepage">
10018: <div>
10019: <div>
1.67 hubertf 10020: <h3 class="title"><a name=
10021: "fonts-disable"></a>12.6.1. Disabling
10022: automatic update of the fonts databases</h3>
1.65 hubertf 10023: </div>
10024: </div>
10025: </div>
10026:
10027: <p>The automatic update of fonts databases can be
10028: disabled by the administrator by setting the
10029: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10030: class="filename">PKG_UPDATE_FONTS_DB</code> environment
10031: variable to <code class="literal">NO</code>.</p>
10032: </div>
10033: </div>
1.35 jmmv 10034: </div>
10035:
1.67 hubertf 10036: <div class="chapter" lang="en">
1.35 jmmv 10037: <div class="titlepage">
10038: <div>
10039: <div>
1.67 hubertf 10040: <h2 class="title"><a name=
1.38 dillo 10041: "options"></a>Chapter 13. Options
1.35 jmmv 10042: handling</h2>
10043: </div>
10044: </div>
10045: </div>
10046:
10047: <div class="toc">
10048: <p><b>Table of Contents</b></p>
10049:
10050: <dl>
10051: <dt><span class="sect1"><a href=
1.38 dillo 10052: "#global-default-options">13.1. Global default
1.35 jmmv 10053: options</a></span></dt>
10054:
10055: <dt><span class="sect1"><a href=
1.38 dillo 10056: "#converting-to-options">13.2. Converting packages to
1.45 wiz 10057: use <code xmlns=
10058: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10059: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 10060:
10061: <dt><span class="sect1"><a href="#option-names">13.3.
10062: Option Names</a></span></dt>
1.35 jmmv 10063: </dl>
10064: </div>
10065:
10066: <p>Many packages have the ability to be built to support
1.45 wiz 10067: different sets of features. <code xmlns=
10068: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10069: "filename">bsd.options.mk</code> is a framework in pkgsrc
10070: that provides generic handling of those options that
10071: determine different ways in which the packages can be
10072: built. It's possible for the user to specify exactly which
10073: sets of options will be built into a package or to allow a
10074: set of global default options apply.</p>
10075:
1.67 hubertf 10076: <div class="sect1" lang="en">
1.35 jmmv 10077: <div class="titlepage">
10078: <div>
10079: <div>
10080: <h2 class="title" style="clear: both"><a name=
1.38 dillo 10081: "global-default-options"></a>13.1. Global
1.35 jmmv 10082: default options</h2>
10083: </div>
10084: </div>
10085: </div>
10086:
10087: <p>Global default options are listed in <code class=
10088: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
10089: the options that should be built into every package if
10090: that option is supported. This variable should be set in
1.45 wiz 10091: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10092: class="filename">/etc/mk.conf</code>.</p>
1.35 jmmv 10093: </div>
10094:
1.67 hubertf 10095: <div class="sect1" lang="en">
1.35 jmmv 10096: <div class="titlepage">
10097: <div>
10098: <div>
10099: <h2 class="title" style="clear: both"><a name=
1.38 dillo 10100: "converting-to-options"></a>13.2. Converting
1.45 wiz 10101: packages to use <code xmlns=
10102: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10103: "filename">bsd.options.mk</code></h2>
10104: </div>
10105: </div>
10106: </div>
10107:
1.45 wiz 10108: <p>The following example shows how <code xmlns=
10109: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10110: "filename">bsd.options.mk</code> should be used by the
10111: hypothetical ``wibble'' package, either in the package
1.45 wiz 10112: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10113: class="filename">Makefile</code>, or in a file, e.g.
10114: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10115: class="filename">options.mk</code>, that is included by
10116: the main package <code xmlns=
10117: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10118: "filename">Makefile</code>.</p>
10119: <pre class="programlisting">
1.51 rillig 10120: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
10121: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
10122: PKG_OPTIONS_OPTIONAL_GROUPS= database
10123: PKG_OPTIONS_GROUP.database= mysql pgsql
10124: PKG_SUGGESTED_OPTIONS= wibble-foo
10125: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
10126: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
10127:
10128: .include "../../mk/bsd.prefs.mk"
10129:
10130: # this package was previously named wibble2
10131: .if defined(PKG_OPTIONS.wibble2)
10132: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
10133: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
10134: "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
10135: .endif
10136:
10137: .include "../../mk/bsd.options.mk"
10138:
10139: # Package-specific option-handling
10140:
10141: ###
10142: ### FOO support
10143: ###
10144: .if !empty(PKG_OPTIONS:Mwibble-foo)
10145: CONFIGURE_ARGS+= --enable-foo
10146: .endif
10147:
10148: ###
10149: ### LDAP support
10150: ###
10151: .if !empty(PKG_OPTIONS:Mldap)
10152: . include "../../databases/openldap/buildlink3.mk"
10153: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
10154: .endif
10155:
10156: ###
10157: ### database support
10158: ###
10159: .if !empty(PKG_OPTIONS:Mmysql)
10160: . include "../../mk/mysql.buildlink3.mk"
10161: .endif
10162: .if !empty(PKG_OPTIONS:Mpgsql)
10163: . include "../../mk/pgsql.buildlink3.mk"
10164: .endif
1.1 grant 10165: </pre>
10166:
1.28 rillig 10167: <p>The first section contains the information about which
10168: build options are supported by the package, and any
1.1 grant 10169: default options settings if needed.</p>
10170:
10171: <div class="orderedlist">
10172: <ol type="1">
10173: <li>
1.14 xtraeme 10174: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 10175: the name of the <a href=
1.1 grant 10176: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10177: <span class="citerefentry"><span class=
1.27 rillig 10178: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 10179: that the user can set to override the default
1.57 minskim 10180: options. It should be set to PKG_OPTIONS.<em class=
1.63 dillo 10181: "replaceable"><code>pkgbase</code></em>. Do not set
10182: it to PKG_OPTIONS.${PKGBASE}, since <code class=
10183: "varname">PKGBASE</code> is set after <code class=
10184: "varname">PKG_OPTIONS_VAR</code> is used.</p>
1.1 grant 10185: </li>
10186:
10187: <li>
1.14 xtraeme 10188: <p><code class=
10189: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 10190: build options supported by the package.</p>
10191: </li>
10192:
10193: <li>
10194: <p><code class=
10195: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
10196: list of names of groups of mutually exclusive
10197: options. The options in each group are listed in
10198: <code class="varname">PKG_OPTIONS_GROUP.<em class=
10199: "replaceable"><code>groupname</code></em></code>.
10200: The most specific setting of any option from the
10201: group takes precedence over all other options in
10202: the group. Options from the groups will be
10203: automatically added to <code class=
10204: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
10205: </li>
10206:
10207: <li>
10208: <p><code class=
10209: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
10210: like <code class=
10211: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
10212: building the packages will fail if no option from
10213: the group is selected.</p>
1.1 grant 10214: </li>
10215:
10216: <li>
1.27 rillig 10217: <p><code class=
1.44 gdt 10218: "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
10219: list of names of sets of options. At least one
10220: option from each set must be selected. The options
10221: in each set are listed in <code class=
10222: "varname">PKG_OPTIONS_SET.<em class=
10223: "replaceable"><code>setname</code></em></code>.
10224: Options from the sets will be automatically added
10225: to <code class=
10226: "varname">PKG_SUPPORTED_OPTIONS</code>. Building
10227: the package will fail if no option from the set is
10228: selected.</p>
10229: </li>
10230:
10231: <li>
10232: <p><code class=
1.27 rillig 10233: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
10234: build options which are enabled by default.</p>
10235: </li>
10236:
10237: <li>
1.37 dillo 10238: <p><code class=
10239: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
10240: of “<span class="quote"><em class=
1.67 hubertf 10241: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>”
10242: pairs that map legacy <code xmlns=
1.45 wiz 10243: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 10244: "filename">/etc/mk.conf</code> variables to their
10245: option counterparts. Pairs should be added with
10246: “<span class="quote">+=</span>” to keep
10247: the listing of global legacy variables. A warning
10248: will be issued if the user uses a legacy
10249: variable.</p>
10250: </li>
1.1 grant 10251:
1.37 dillo 10252: <li>
10253: <p><code class=
10254: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
10255: of “<span class="quote"><em class=
1.67 hubertf 10256: "replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>”
10257: pairs that map options that have been renamed to
10258: their new counterparts. Pairs should be added with
1.37 dillo 10259: “<span class="quote">+=</span>” to keep
10260: the listing of global legacy options. A warning
10261: will be issued if the user uses a legacy
10262: option.</p>
10263: </li>
1.1 grant 10264:
1.37 dillo 10265: <li>
10266: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
10267: is a list of options implied by deprecated
10268: variables used. This can be used for cases that
10269: neither <code class=
10270: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
10271: <code class=
10272: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
10273: handle, e. g. when <code class=
10274: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 10275: </li>
10276:
10277: <li>
1.37 dillo 10278: <p><code class=
10279: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
10280: a list of warnings about deprecated variables or
10281: options used, and what to use instead.</p>
1.1 grant 10282: </li>
1.28 rillig 10283: </ol>
1.1 grant 10284: </div>
10285:
1.37 dillo 10286: <p>A package should never modify <code class=
10287: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
10288: named in <code class="varname">PKG_OPTIONS_VAR</code>.
10289: These are strictly user-settable. To suggest a default
10290: set of options, use <code class=
10291: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
10292:
1.42 dillo 10293: <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45 wiz 10294: defined before including <code xmlns=
10295: "http://www.w3.org/TR/xhtml1/transitional" class=
1.42 dillo 10296: "filename">bsd.options.mk</code>. If none of <code class=
1.37 dillo 10297: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
10298: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
10299: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47 reed 10300: are defined (as can happen with platform-specific options
1.42 dillo 10301: if none of them is supported on the current platform),
10302: <code class="varname">PKG_OPTIONS</code> is set to the
10303: empty list and the package is otherwise treated as not
10304: using the options framework.</p>
1.37 dillo 10305:
1.45 wiz 10306: <p>After the inclusion of <code xmlns=
10307: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 10308: "filename">bsd.options.mk</code>, the variable
1.28 rillig 10309: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 10310: list of selected build options, properly filtered to
1.28 rillig 10311: remove unsupported and duplicate options.</p>
10312:
1.1 grant 10313: <p>The remaining sections contain the logic that is
1.37 dillo 10314: specific to each option. The correct way to check for an
10315: option is to check whether it is listed in <code class=
10316: "varname">PKG_OPTIONS</code>:</p>
10317: <pre class="programlisting">
1.51 rillig 10318: .if !empty(PKG_OPTIONS:M<em class=
1.37 dillo 10319: "replaceable"><code>option</code></em>)
10320: </pre>
1.48 dillo 10321: </div>
1.37 dillo 10322:
1.67 hubertf 10323: <div class="sect1" lang="en">
1.48 dillo 10324: <div class="titlepage">
10325: <div>
10326: <div>
10327: <h2 class="title" style="clear: both"><a name=
10328: "option-names"></a>13.3. Option Names</h2>
10329: </div>
10330: </div>
10331: </div>
10332:
10333: <p>Options that enable similar features in different
10334: packages (like optional support for a library) should use
10335: a common name in all packages that support it (like the
10336: name of the library). If another package already has an
10337: option with the same meaning, use the same name.</p>
10338:
10339: <p>Options that enable features specific to one package,
10340: where it's unlikely that another (unrelated) package has
10341: the same (or a similar) optional feature, should use a
10342: name prefixed with <code class="varname"><em class=
10343: "replaceable"><code>pkgname</code></em>-</code>.</p>
10344:
10345: <p>If a group of related packages share an optional
10346: feature specific to that group, prefix it with the name
10347: of the “<span class="quote">main</span>”
10348: package (e. g. <code class=
10349: "varname">djbware-errno-hack</code>).</p>
10350:
10351: <p>For new options, add a line to <code xmlns=
10352: "http://www.w3.org/TR/xhtml1/transitional" class=
10353: "filename">mk/defaults/options.description</code>. Lines
10354: have two fields, separated by tab. The first field is the
10355: option name, the second its description. The description
10356: should be a whole sentence (starting with an uppercase
10357: letter and ending with a period) that describes what
10358: enabling the option does. E. g. “<span class=
10359: "quote">Enable ispell support.</span>” The file is
10360: sorted by option names.</p>
1.1 grant 10361: </div>
10362: </div>
10363:
1.67 hubertf 10364: <div class="chapter" lang="en">
1.1 grant 10365: <div class="titlepage">
10366: <div>
10367: <div>
1.67 hubertf 10368: <h2 class="title"><a name=
1.38 dillo 10369: "build"></a>Chapter 14. The build
1.1 grant 10370: process</h2>
10371: </div>
10372: </div>
10373: </div>
10374:
10375: <div class="toc">
10376: <p><b>Table of Contents</b></p>
10377:
10378: <dl>
1.56 rillig 10379: <dt><span class="sect1"><a href="#build.intro">14.1.
10380: Introduction</a></span></dt>
10381:
10382: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 10383: Program location</a></span></dt>
10384:
1.56 rillig 10385: <dt><span class="sect1"><a href=
10386: "#build.builddirs">14.3. Directories used during the
10387: build process</a></span></dt>
10388:
10389: <dt><span class="sect1"><a href="#build.running">14.4.
10390: Running a phase</a></span></dt>
10391:
10392: <dt><span class="sect1"><a href="#build.fetch">14.5.
10393: The <span class="emphasis"><em>fetch</em></span>
10394: phase</a></span></dt>
10395:
10396: <dt><span class="sect1"><a href="#build.checksum">14.6.
10397: The <span class="emphasis"><em>checksum</em></span>
10398: phase</a></span></dt>
10399:
10400: <dt><span class="sect1"><a href="#build.extract">14.7.
10401: The <span class="emphasis"><em>extract</em></span>
10402: phase</a></span></dt>
10403:
10404: <dt><span class="sect1"><a href="#build.patch">14.8.
10405: The <span class="emphasis"><em>patch</em></span>
10406: phase</a></span></dt>
10407:
10408: <dt><span class="sect1"><a href="#build.tools">14.9.
10409: The <span class="emphasis"><em>tools</em></span>
10410: phase</a></span></dt>
10411:
10412: <dt><span class="sect1"><a href="#build.wrapper">14.10.
10413: The <span class="emphasis"><em>wrapper</em></span>
10414: phase</a></span></dt>
1.1 grant 10415:
10416: <dt><span class="sect1"><a href=
1.56 rillig 10417: "#build.configure">14.11. The <span class=
10418: "emphasis"><em>configure</em></span>
10419: phase</a></span></dt>
10420:
10421: <dt><span class="sect1"><a href="#build.build">14.12.
10422: The <span class="emphasis"><em>build</em></span>
10423: phase</a></span></dt>
10424:
10425: <dt><span class="sect1"><a href="#build.test">14.13.
10426: The <span class="emphasis"><em>test</em></span>
10427: phase</a></span></dt>
10428:
10429: <dt><span class="sect1"><a href="#build.install">14.14.
10430: The <span class="emphasis"><em>install</em></span>
10431: phase</a></span></dt>
10432:
10433: <dt><span class="sect1"><a href="#build.package">14.15.
10434: The <span class="emphasis"><em>package</em></span>
10435: phase</a></span></dt>
10436:
10437: <dt><span class="sect1"><a href=
10438: "#build.helpful-targets">14.16. Other helpful
1.1 grant 10439: targets</a></span></dt>
10440: </dl>
10441: </div>
10442:
1.67 hubertf 10443: <div class="sect1" lang="en">
1.56 rillig 10444: <div class="titlepage">
10445: <div>
10446: <div>
10447: <h2 class="title" style="clear: both"><a name=
10448: "build.intro"></a>14.1. Introduction</h2>
10449: </div>
10450: </div>
10451: </div>
10452:
10453: <p>This chapter gives a detailed description on how a
10454: package is built. Building a package is separated into
10455: different <span class="emphasis"><em>phases</em></span>
10456: (for example <code class="varname">fetch</code>,
10457: <code class="varname">build</code>, <code class=
10458: "varname">install</code>), all of which are described in
10459: the following sections. Each phase is splitted into
10460: so-called <span class="emphasis"><em>stages</em></span>,
1.66 rillig 10461: which take the name of the containing phase, prefixed by
1.56 rillig 10462: one of <code class="varname">pre-</code>, <code class=
10463: "varname">do-</code> or <code class=
10464: "varname">post-</code>. (Examples are <code class=
10465: "varname">pre-configure</code>, <code class=
10466: "varname">post-build</code>.) Most of the actual work is
10467: done in the <code class="varname">do-*</code> stages.</p>
10468:
10469: <p>The basic steps for building a program are always the
10470: same. First the program's source (<span class=
10471: "emphasis"><em>distfile</em></span>) must be brought to
1.66 rillig 10472: the local system and then extracted. After any
10473: pkgsrc-specific patches to compile properly are applied,
10474: the software can be configured, then built (usually by
10475: compiling), and finally the generated binaries, etc. can
10476: be put into place on the system.</p>
1.56 rillig 10477: </div>
1.1 grant 10478:
1.67 hubertf 10479: <div class="sect1" lang="en">
1.1 grant 10480: <div class="titlepage">
10481: <div>
10482: <div>
10483: <h2 class="title" style="clear: both"><a name=
1.56 rillig 10484: "build.prefix"></a>14.2. Program location</h2>
1.1 grant 10485: </div>
10486: </div>
10487: </div>
10488:
10489: <p>Before outlining the process performed by the NetBSD
10490: package system in the next section, here's a brief
10491: discussion on where programs are installed, and which
10492: variables influence this.</p>
10493:
1.14 xtraeme 10494: <p>The automatic variable <code class=
10495: "varname">PREFIX</code> indicates where all files of the
10496: final program shall be installed. It is usually set to
1.45 wiz 10497: <code class="varname">LOCALBASE</code> (<code xmlns=
10498: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10499: "filename">/usr/pkg</code>), or <code class=
10500: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 10501: “<span class="quote">cross</span>” category.
1.14 xtraeme 10502: The value of <code class="varname">PREFIX</code> needs to
10503: be put into the various places in the program's source
10504: where paths to these files are encoded. See <a href=
1.1 grant 10505: "#components.patches" title=
1.38 dillo 10506: "8.3. patches/*">Section 8.3,
1.1 grant 10507: “patches/*”</a> and <a href="#fixes.libtool"
10508: title=
1.68 ! rillig 10509: "16.3.1. Shared libraries - libtool">Section 16.3.1,
1.1 grant 10510: “Shared libraries - libtool”</a> for more
10511: details.</p>
10512:
10513: <p>When choosing which of these variables to use, follow
10514: the following rules:</p>
10515:
10516: <div class="itemizedlist">
10517: <ul type="disc">
10518: <li>
1.14 xtraeme 10519: <p><code class="varname">PREFIX</code> always
10520: points to the location where the current pkg will
10521: be installed. When referring to a pkg's own
1.1 grant 10522: installation path, use “<span class=
10523: "quote">${PREFIX}</span>”.</p>
10524: </li>
10525:
10526: <li>
1.14 xtraeme 10527: <p><code class="varname">LOCALBASE</code> is where
10528: all non-X11 pkgs are installed. If you need to
1.1 grant 10529: construct a -I or -L argument to the compiler to
10530: find includes and libraries installed by another
10531: non-X11 pkg, use “<span class=
10532: "quote">${LOCALBASE}</span>”.</p>
10533: </li>
10534:
10535: <li>
1.14 xtraeme 10536: <p><code class="varname">X11BASE</code> is where
10537: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 10538: installed. When looking for <span class=
10539: "emphasis"><em>standard</em></span> X11 includes
10540: (not those installed by a pkg), use
10541: “<span class=
10542: "quote">${X11BASE}</span>”.</p>
10543: </li>
10544:
10545: <li>
1.47 reed 10546: <p>X11-based packages are special in that they may
10547: be installed in either <code class=
1.14 xtraeme 10548: "varname">X11BASE</code> or <code class=
10549: "varname">LOCALBASE</code>.</p>
1.1 grant 10550:
10551: <p>Usually, X11 packages should be installed under
1.14 xtraeme 10552: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 10553: possible. Note that you will need to include
1.45 wiz 10554: <code xmlns=
10555: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 10556: "filename">../../mk/x11.buildlink3.mk</code> in
10557: them to request the presence of X11 and to get the
10558: right compilation flags.</p>
1.1 grant 10559:
10560: <p>Even though, there are some packages that cannot
1.14 xtraeme 10561: be installed under <code class=
10562: "varname">LOCALBASE</code>: those that come with
1.1 grant 10563: app-defaults files. These packages are special and
1.14 xtraeme 10564: they must be placed under <code class=
10565: "varname">X11BASE</code>. To accomplish this, set
10566: either <code class="varname">USE_X11BASE</code> or
10567: <code class="varname">USE_IMAKE</code> in your
1.1 grant 10568: package.</p>
10569:
1.34 wiz 10570: <p>Some notes: If you need to find includes or
1.14 xtraeme 10571: libraries installed by a pkg that has <code class=
10572: "varname">USE_IMAKE</code> or <code class=
10573: "varname">USE_X11BASE</code> in its pkg
1.45 wiz 10574: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10575: class="filename">Makefile</code>, you need to look
10576: in <span class="emphasis"><em>both</em></span>
10577: <code xmlns=
10578: "http://www.w3.org/TR/xhtml1/transitional" class=
10579: "filename">${X11BASE}</code> and <code xmlns=
10580: "http://www.w3.org/TR/xhtml1/transitional" class=
10581: "filename">${LOCALBASE}</code>. To force
10582: installation of all X11 packages in <code class=
10583: "varname">LOCALBASE</code>, the <a xmlns=
10584: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10585: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 10586: target="_top"><code xmlns="" class=
10587: "filename">pkgtools/xpkgwedge</code></a> package is
1.34 wiz 10588: enabled by default.</p>
1.1 grant 10589: </li>
10590:
10591: <li>
1.14 xtraeme 10592: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 10593: used to refer to the installed location of an X11
1.14 xtraeme 10594: package. <code class="varname">X11PREFIX</code>
10595: will be set to <code class="varname">X11BASE</code>
10596: if xpkgwedge is not installed, and to <code class=
10597: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 10598: installed.</p>
10599: </li>
10600:
10601: <li>
10602: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 10603: have some packages installed in <code class=
10604: "varname">X11BASE</code> and some in <code class=
10605: "varname">LOCALBASE</code>. To determine the prefix
10606: of an installed package, the <code class=
10607: "varname">EVAL_PREFIX</code> definition can be
10608: used. It takes pairs in the format
10609: “<span class=
1.1 grant 10610: "quote">DIRNAME=<package></span>”, and
1.24 wiz 10611: the <a href=
10612: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10613: <span class="citerefentry"><span class=
10614: "refentrytitle">make</span>(1)</span></a> variable
10615: <code class="varname">DIRNAME</code> will be set to
10616: the prefix of the installed package
10617: <package>, or “<span class=
1.1 grant 10618: "quote">${X11PREFIX}</span>” if the package
10619: is not installed.</p>
10620:
10621: <p>This is best illustrated by example.</p>
10622:
1.45 wiz 10623: <p>The following lines are taken from <code xmlns=
10624: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10625: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 10626: <pre class="programlisting">
1.51 rillig 10627: EVAL_PREFIX+= GTKDIR=gtk+
10628: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
10629: --with-gtk-prefix="${GTKDIR}" \
10630: --enable-multibyte
1.1 grant 10631: </pre>
10632:
10633: <p>Specific defaults can be defined for the
1.14 xtraeme 10634: packages evaluated using <code class=
10635: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 10636: of the form:</p>
10637: <pre class="programlisting">
1.51 rillig 10638: GTKDIR_DEFAULT= ${LOCALBASE}
1.1 grant 10639: </pre>
10640:
1.14 xtraeme 10641: <p>where <code class="varname">GTKDIR</code>
1.1 grant 10642: corresponds to the first definition in the
1.14 xtraeme 10643: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 10644: </li>
10645:
10646: <li>
1.45 wiz 10647: <p>Within <code xmlns=
10648: "http://www.w3.org/TR/xhtml1/transitional" class=
10649: "filename">${PREFIX}</code>, packages should
10650: install files according to <a href=
1.24 wiz 10651: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
10652: <span class="citerefentry"><span class=
10653: "refentrytitle">hier</span>(7)</span></a>, with the
1.45 wiz 10654: exception that manual pages go into <code xmlns=
10655: "http://www.w3.org/TR/xhtml1/transitional" class=
10656: "filename">${PREFIX}/man</code>, not <code xmlns=
10657: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10658: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 10659: </li>
10660: </ul>
10661: </div>
10662: </div>
10663:
1.67 hubertf 10664: <div class="sect1" lang="en">
1.1 grant 10665: <div class="titlepage">
10666: <div>
10667: <div>
10668: <h2 class="title" style="clear: both"><a name=
1.56 rillig 10669: "build.builddirs"></a>14.3. Directories used
10670: during the build process</h2>
1.1 grant 10671: </div>
10672: </div>
10673: </div>
10674:
1.56 rillig 10675: <p>When building a package, a number of directories is
10676: used to store source files, temporary files,
10677: pkgsrc-internal files, and so on. These directories are
10678: explained here.</p>
10679:
10680: <p>Some of the directory variables contain relative
10681: pathnames. There are two common base directories for
10682: these relative directories: <code class=
10683: "varname">PKGSRCDIR/PKGPATH</code> is used for
10684: directories that are pkgsrc-specific. <code class=
10685: "varname">WRKSRC</code> is used for directories inside
1.66 rillig 10686: the package itself.</p>
1.1 grant 10687:
10688: <div class="variablelist">
10689: <dl>
1.56 rillig 10690: <dt><span class="term"><code class=
1.66 rillig 10691: "varname">PKGSRCDIR</code></span></dt>
1.56 rillig 10692:
10693: <dd>
10694: <p>This is an absolute pathname that points to the
10695: pkgsrc root directory. Generally, you don't need
10696: it.</p>
10697: </dd>
10698:
10699: <dt><span class="term"><code class=
1.66 rillig 10700: "varname">PKGPATH</code></span></dt>
1.1 grant 10701:
10702: <dd>
1.56 rillig 10703: <p>This is a pathname relative to <code class=
10704: "varname">PKGSRCDIR</code> that points to the
10705: current package.</p>
10706: </dd>
10707:
10708: <dt><span class="term"><code class=
1.66 rillig 10709: "varname">WRKDIR</code></span></dt>
1.56 rillig 10710:
10711: <dd>
10712: <p>This is an absolute pathname pointing to the
1.57 minskim 10713: directory where all work takes place. The distfiles
10714: are extraced to this directory. It also contains
10715: temporary directories and log files used by the
10716: various pkgsrc frameworks, like <span class=
10717: "emphasis"><em>buildlink</em></span> or the
10718: <span class=
1.56 rillig 10719: "emphasis"><em>wrappers</em></span>.</p>
10720: </dd>
10721:
10722: <dt><span class="term"><code class=
1.66 rillig 10723: "varname">WRKSRC</code></span></dt>
1.56 rillig 10724:
10725: <dd>
10726: <p>This is an absolute pathname pointing to the
10727: directory where the distfiles are extracted. It is
10728: usually a direct subdirectory of <code class=
10729: "varname">WRKDIR</code>, and often it's the only
1.66 rillig 10730: directory entry that isn't hidden. This variable
10731: may be changed by a package <code xmlns=
10732: "http://www.w3.org/TR/xhtml1/transitional" class=
10733: "filename">Makefile</code>.</p>
1.56 rillig 10734: </dd>
10735: </dl>
10736: </div>
10737: </div>
10738:
1.67 hubertf 10739: <div class="sect1" lang="en">
1.56 rillig 10740: <div class="titlepage">
10741: <div>
10742: <div>
10743: <h2 class="title" style="clear: both"><a name=
10744: "build.running"></a>14.4. Running a phase</h2>
10745: </div>
10746: </div>
10747: </div>
10748:
10749: <p>You can run a particular phase by typing
10750: <span><strong class="command">make phase</strong></span>,
10751: where <span class="emphasis"><em>phase</em></span> is the
10752: name of the phase. This will automatically run all phases
10753: that are required for this phase. The default phase is
10754: <code class="varname">build</code>, that is, when you run
10755: <span><strong class="command">make</strong></span>
10756: without parameters in a package directory, the package
10757: will be built, but not installed.</p>
10758: </div>
10759:
1.67 hubertf 10760: <div class="sect1" lang="en">
1.56 rillig 10761: <div class="titlepage">
10762: <div>
10763: <div>
10764: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 10765: "build.fetch"></a>14.5. The <span class=
10766: "emphasis"><em>fetch</em></span> phase</h2>
1.56 rillig 10767: </div>
10768: </div>
10769: </div>
10770:
10771: <p>This will check if the file(s) given in the variables
10772: <code class="varname">DISTFILES</code> and <code class=
10773: "varname">PATCHFILES</code> (as defined in the package's
10774: Makefile) are present on the local system in <code xmlns=
10775: "http://www.w3.org/TR/xhtml1/transitional" class=
10776: "filename">/usr/pkgsrc/distfiles</code>. If they are not
10777: present, an attempt will be made to fetch them using
10778: commands of the form:</p>
10779: <pre class="programlisting">
1.51 rillig 10780: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 grant 10781: </pre>
10782:
1.56 rillig 10783: <p>where ${site} varies through several possibilities in
10784: turn: first, <code class=
10785: "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
10786: sites specified in either <code class=
10787: "varname">SITES_file</code> if defined, else <code class=
10788: "varname">MASTER_SITES</code> or <code class=
10789: "varname">PATCH_SITES</code>, as applies, then finally
10790: the value of <code class=
10791: "varname">MASTER_SITE_BACKUP</code>. The order of all
10792: except the first can be optionally sorted by the user,
10793: via setting either <code class=
10794: "varname">MASTER_SORT_AWK</code> or <code class=
10795: "varname">MASTER_SORT_REGEX</code>.</p>
10796: </div>
10797:
1.67 hubertf 10798: <div class="sect1" lang="en">
1.56 rillig 10799: <div class="titlepage">
10800: <div>
10801: <div>
10802: <h2 class="title" style="clear: both"><a name=
10803: "build.checksum"></a>14.6. The <span class=
10804: "emphasis"><em>checksum</em></span> phase</h2>
10805: </div>
10806: </div>
10807: </div>
10808:
10809: <p>After the distfile(s) are fetched, their checksum is
10810: generated and compared with the checksums stored in the
10811: distinfo file. If the checksums don't match, the build is
10812: aborted. This is to ensure the same distfile is used for
10813: building, and that the distfile wasn't changed, e.g. by
10814: some malign force, deliberately changed distfiles on the
10815: master distribution site or network lossage.</p>
10816: </div>
10817:
1.67 hubertf 10818: <div class="sect1" lang="en">
1.56 rillig 10819: <div class="titlepage">
10820: <div>
10821: <div>
10822: <h2 class="title" style="clear: both"><a name=
10823: "build.extract"></a>14.7. The <span class=
10824: "emphasis"><em>extract</em></span> phase</h2>
10825: </div>
10826: </div>
10827: </div>
10828:
10829: <p>When the distfiles are present on the local system,
10830: they need to be extracted, as they are usually in the
10831: form of some compressed archive format, most commonly
10832: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10833: class="filename">.tar.gz</code>.</p>
1.1 grant 10834:
1.56 rillig 10835: <p>If only some of the distfiles need to be uncompressed,
10836: the files to be uncompressed should be put into
10837: <code class="varname">EXTRACT_ONLY</code>.</p>
1.1 grant 10838:
1.56 rillig 10839: <p>If the distfiles are not in <code xmlns=
10840: "http://www.w3.org/TR/xhtml1/transitional" class=
10841: "filename">.tar.gz</code> format, they can be extracted
10842: by setting either <code class=
10843: "varname">EXTRACT_SUFX</code>, or <code class=
10844: "varname">EXTRACT_CMD</code>, <code class=
10845: "varname">EXTRACT_BEFORE_ARGS</code> and <code class=
10846: "varname">EXTRACT_AFTER_ARGS</code>. In the former case,
10847: pkgsrc knows how to extract a number of suffixes
10848: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10849: class="filename">.tar.gz</code>, <code xmlns=
10850: "http://www.w3.org/TR/xhtml1/transitional" class=
10851: "filename">.tgz</code>, <code xmlns=
10852: "http://www.w3.org/TR/xhtml1/transitional" class=
10853: "filename">.tar.gz2</code>, <code xmlns=
10854: "http://www.w3.org/TR/xhtml1/transitional" class=
10855: "filename">.tbz</code>, <code xmlns=
10856: "http://www.w3.org/TR/xhtml1/transitional" class=
10857: "filename">.tar.Z</code>, <code xmlns=
10858: "http://www.w3.org/TR/xhtml1/transitional" class=
10859: "filename">.tar</code>, <code xmlns=
10860: "http://www.w3.org/TR/xhtml1/transitional" class=
10861: "filename">.shar.gz</code>, <code xmlns=
10862: "http://www.w3.org/TR/xhtml1/transitional" class=
10863: "filename">.shar.bz2</code>, <code xmlns=
10864: "http://www.w3.org/TR/xhtml1/transitional" class=
10865: "filename">.shar.Z</code>, <code xmlns=
10866: "http://www.w3.org/TR/xhtml1/transitional" class=
10867: "filename">.shar</code>, <code xmlns=
10868: "http://www.w3.org/TR/xhtml1/transitional" class=
10869: "filename">.Z</code>, <code xmlns=
10870: "http://www.w3.org/TR/xhtml1/transitional" class=
10871: "filename">.bz2</code> and <code xmlns=
10872: "http://www.w3.org/TR/xhtml1/transitional" class=
10873: "filename">.gz</code>; see the definition of the various
10874: <code class="varname">DECOMPRESS_CMD</code> variables in
10875: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10876: class="filename">bsd.pkg.extract.mk</code> for a complete
10877: list). Here's an example on how to use the other
10878: variables for a program that comes with a compressed
10879: shell archive whose name ends in <code xmlns=
10880: "http://www.w3.org/TR/xhtml1/transitional" class=
10881: "filename">.msg.gz</code>:</p>
10882: <pre class="programlisting">
1.51 rillig 10883: EXTRACT_SUFX= .msg.gz
10884: EXTRACT_CMD= zcat
10885: EXTRACT_BEFORE_ARGS=
10886: EXTRACT_AFTER_ARGS= |sh
1.1 grant 10887: </pre>
1.56 rillig 10888: </div>
10889:
1.67 hubertf 10890: <div class="sect1" lang="en">
1.56 rillig 10891: <div class="titlepage">
10892: <div>
10893: <div>
10894: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 10895: "build.patch"></a>14.8. The <span class=
10896: "emphasis"><em>patch</em></span> phase</h2>
1.56 rillig 10897: </div>
10898: </div>
10899: </div>
10900:
10901: <p>After extraction, all the patches named by the
10902: <code class="varname">PATCHFILES</code>, those present in
10903: the patches subdirectory of the package as well as in
10904: $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
10905: "http://www.w3.org/TR/xhtml1/transitional" class=
10906: "filename">/usr/local/patches/graphics/png</code>) are
10907: applied. Patchfiles ending in <code xmlns=
10908: "http://www.w3.org/TR/xhtml1/transitional" class=
10909: "filename">.Z</code> or <code xmlns=
10910: "http://www.w3.org/TR/xhtml1/transitional" class=
10911: "filename">.gz</code> are uncompressed before they are
10912: applied, files ending in <code xmlns=
10913: "http://www.w3.org/TR/xhtml1/transitional" class=
10914: "filename">.orig</code> or <code xmlns=
10915: "http://www.w3.org/TR/xhtml1/transitional" class=
10916: "filename">.rej</code> are ignored. Any special options
10917: to <a href=
10918: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10919: <span class="citerefentry"><span class=
10920: "refentrytitle">patch</span>(1)</span></a> can be handed
10921: in <code class="varname">PATCH_DIST_ARGS</code>. See
10922: <a href="#components.patches" title=
10923: "8.3. patches/*">Section 8.3,
10924: “patches/*”</a> for more details.</p>
10925:
10926: <p>By default <a href=
10927: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10928: <span class="citerefentry"><span class=
10929: "refentrytitle">patch</span>(1)</span></a> is given
10930: special args to make it fail if the patches apply with
10931: some lines of fuzz. Please fix (regen) the patches so
10932: that they apply cleanly. The rationale behind this is
10933: that patches that don't apply cleanly may end up being
10934: applied in the wrong place, and cause severe harm
10935: there.</p>
10936: </div>
10937:
1.67 hubertf 10938: <div class="sect1" lang="en">
1.56 rillig 10939: <div class="titlepage">
10940: <div>
10941: <div>
10942: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 10943: "build.tools"></a>14.9. The <span class=
10944: "emphasis"><em>tools</em></span> phase</h2>
1.56 rillig 10945: </div>
10946: </div>
10947: </div>
10948:
1.68 ! rillig 10949: <p>This is covered in <a href="#tools" title=
! 10950: "Chapter 15. Tools needed for building or running">
! 10951: Chapter 15, <i>Tools needed for building or
! 10952: running</i></a>.</p>
1.56 rillig 10953: </div>
10954:
1.67 hubertf 10955: <div class="sect1" lang="en">
1.56 rillig 10956: <div class="titlepage">
10957: <div>
10958: <div>
10959: <h2 class="title" style="clear: both"><a name=
10960: "build.wrapper"></a>14.10. The <span class=
10961: "emphasis"><em>wrapper</em></span> phase</h2>
10962: </div>
10963: </div>
10964: </div>
10965:
10966: <p>[TODO]</p>
10967: </div>
10968:
1.67 hubertf 10969: <div class="sect1" lang="en">
1.56 rillig 10970: <div class="titlepage">
10971: <div>
10972: <div>
10973: <h2 class="title" style="clear: both"><a name=
10974: "build.configure"></a>14.11. The <span class=
10975: "emphasis"><em>configure</em></span> phase</h2>
10976: </div>
10977: </div>
10978: </div>
10979:
10980: <p>Most pieces of software need information on the header
10981: files, system calls, and library routines which are
10982: available on the platform they run on. The process of
10983: determining this information is known as configuration,
10984: and is usually automated. In most cases, a script is
10985: supplied with the distfiles, and its invocation results
10986: in generation of header files, Makefiles, etc.</p>
10987:
10988: <p>If the package contains a configure script, this can
10989: be invoked by setting <code class=
10990: "varname">HAS_CONFIGURE</code> to “<span class=
10991: "quote">yes</span>”. If the configure script is a
10992: GNU autoconf script, you should set <code class=
10993: "varname">GNU_CONFIGURE</code> to “<span class=
10994: "quote">yes</span>” instead. What happens in the
10995: <span class="emphasis"><em>configure</em></span> phase is
10996: roughly:</p>
10997: <pre class="programlisting">
10998: .for d in ${CONFIGURE_DIRS}
10999: cd ${WRKSRC} && cd ${d} && env ${CONFIGURE_ENV} \
11000: ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
11001: .endfor
11002: </pre>
1.1 grant 11003:
1.56 rillig 11004: <p><code class="varname">CONFIGURE_DIRS</code> (default:
11005: “<span class="quote">.</span>”) is a list of
11006: pathnames relative to <code class=
11007: "varname">WRKSRC</code>. In each of these directories,
11008: the configure script is run with the environment
11009: <code class="varname">CONFIGURE_ENV</code> and arguments
11010: <code class="varname">CONFIGURE_ARGS</code>. The
11011: variables <code class="varname">CONFIGURE_ENV</code>,
11012: <code class="varname">CONFIGURE_SCRIPT</code> (default:
11013: “<span class="quote">./configure</span>”) and
11014: <code class="varname">CONFIGURE_ARGS</code> may all be
11015: changed by the package.</p>
1.1 grant 11016:
1.56 rillig 11017: <p>If the program uses an <code xmlns=
11018: "http://www.w3.org/TR/xhtml1/transitional" class=
11019: "filename">Imakefile</code> for configuration, the
11020: appropriate steps can be invoked by setting <code class=
11021: "varname">USE_IMAKE</code> to “<span class=
11022: "quote">yes</span>”. (If you only want the package
11023: installed in <code class="varname">${X11PREFIX}</code>
11024: but xmkmf not being run, set <code class=
11025: "varname">USE_X11BASE</code> instead.)</p>
11026: </div>
1.1 grant 11027:
1.67 hubertf 11028: <div class="sect1" lang="en">
1.56 rillig 11029: <div class="titlepage">
11030: <div>
11031: <div>
11032: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11033: "build.build"></a>14.12. The <span class=
11034: "emphasis"><em>build</em></span> phase</h2>
1.56 rillig 11035: </div>
11036: </div>
1.1 grant 11037: </div>
11038:
1.56 rillig 11039: <p>For building a package, a rough equivalent of the
11040: following code is executed.</p>
1.1 grant 11041: <pre class="programlisting">
1.56 rillig 11042: .for d in ${BUILD_DIRS}
11043: cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \
11044: ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
11045: -f ${MAKEFILE} ${BUILD_TARGET}
11046: .endfor
1.1 grant 11047: </pre>
1.56 rillig 11048:
11049: <p><code class="varname">BUILD_DIRS</code> (default:
11050: “<span class="quote">.</span>”) is a list of
11051: pathnames relative to <code class=
11052: "varname">WRKSRC</code>. In each of these directories,
11053: <code class="varname">MAKE_PROGRAM</code> is run with the
11054: environment <code class="varname">MAKE_ENV</code> and
11055: arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
11056: The variables <code class="varname">MAKE_ENV</code>,
11057: <code class="varname">BUILD_MAKE_FLAGS</code>,
11058: <code class="varname">MAKEFILE</code> and <code class=
11059: "varname">BUILD_TARGET</code> may all be changed by the
11060: package.</p>
11061:
11062: <p>The default value of <code class=
11063: "varname">MAKE_PROGRAM</code> is “<span class=
11064: "quote">gmake</span>” if <code class=
11065: "varname">USE_TOOLS</code> contains “<span class=
11066: "quote">gmake</span>”, “<span class=
11067: "quote">make</span>” otherwise. The default value
11068: of <code class="varname">MAKEFILE</code> is
11069: “<span class="quote">Makefile</span>”, and
11070: <code class="varname">BUILD_TARGET</code> defaults to
11071: “<span class="quote">all</span>”.</p>
11072: </div>
11073:
1.67 hubertf 11074: <div class="sect1" lang="en">
1.56 rillig 11075: <div class="titlepage">
11076: <div>
11077: <div>
11078: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11079: "build.test"></a>14.13. The <span class=
11080: "emphasis"><em>test</em></span> phase</h2>
1.56 rillig 11081: </div>
11082: </div>
11083: </div>
11084:
11085: <p>[TODO]</p>
11086: </div>
11087:
1.67 hubertf 11088: <div class="sect1" lang="en">
1.56 rillig 11089: <div class="titlepage">
11090: <div>
11091: <div>
11092: <h2 class="title" style="clear: both"><a name=
11093: "build.install"></a>14.14. The <span class=
11094: "emphasis"><em>install</em></span> phase</h2>
11095: </div>
11096: </div>
11097: </div>
11098:
11099: <p>Once the build stage has completed, the final step is
11100: to install the software in public directories, so users
1.68 ! rillig 11101: can access the programs and files.</p>
! 11102:
! 11103: <p>In the <span class="emphasis"><em>install</em></span>
! 11104: phase, a rough equivalent of the following code is
! 11105: executed. Additionally, before and after this code, much
! 11106: magic is performed to do consistency checks, registering
! 11107: the package, and so on.</p>
! 11108: <pre class="programlisting">
! 11109: .for d in ${INSTALL_DIRS}
! 11110: cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \
! 11111: ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \
! 11112: -f ${MAKEFILE} ${BUILD_TARGET}
! 11113: .endfor
! 11114: </pre>
! 11115:
! 11116: <p>The variable's meanings are analogous to the ones in
! 11117: the <span class="emphasis"><em>build</em></span> phase.
! 11118: <code class="varname">INSTALL_DIRS</code> defaults to
! 11119: <code class="varname">BUILD_DIRS</code>. <code class=
! 11120: "varname">INSTALL_TARGET</code> is “<span class=
! 11121: "quote">install</span>” by default, plus
! 11122: “<span class="quote">install.man</span>” if
! 11123: <code class="varname">USE_IMAKE</code> is defined.</p>
! 11124:
! 11125: <p>In the <span class="emphasis"><em>install</em></span>
! 11126: phase, the following variables are useful. They are all
! 11127: variations of the <a href=
! 11128: "http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
! 11129: <span class="citerefentry"><span class=
! 11130: "refentrytitle">install</span>(1)</span></a> command that
! 11131: have the owner, group and permissions preset.
! 11132: <code class="varname">INSTALL</code> is the plain install
! 11133: command. The specialized variants, together with their
! 11134: intended use, are:</p>
! 11135:
! 11136: <div class="variablelist">
! 11137: <dl>
! 11138: <dt><span class="term"><code class=
! 11139: "varname">INSTALL_PROGRAM_DIR</code></span></dt>
! 11140:
! 11141: <dd>
! 11142: <p>directories that contain binaries</p>
! 11143: </dd>
! 11144:
! 11145: <dt><span class="term"><code class=
! 11146: "varname">INSTALL_SCRIPT_DIR</code></span></dt>
! 11147:
! 11148: <dd>
! 11149: <p>directories that contain scripts</p>
! 11150: </dd>
! 11151:
! 11152: <dt><span class="term"><code class=
! 11153: "varname">INSTALL_LIB_DIR</code></span></dt>
! 11154:
! 11155: <dd>
! 11156: <p>directories that contain shared and static
! 11157: libraries</p>
! 11158: </dd>
! 11159:
! 11160: <dt><span class="term"><code class=
! 11161: "varname">INSTALL_DATA_DIR</code></span></dt>
! 11162:
! 11163: <dd>
! 11164: <p>directories that contain data files</p>
! 11165: </dd>
! 11166:
! 11167: <dt><span class="term"><code class=
! 11168: "varname">INSTALL_MAN_DIR</code></span></dt>
! 11169:
! 11170: <dd>
! 11171: <p>directories that contain man pages</p>
! 11172: </dd>
! 11173:
! 11174: <dt><span class="term"><code class=
! 11175: "varname">INSTALL_PROGRAM</code></span></dt>
! 11176:
! 11177: <dd>
! 11178: <p>binaries that can be stripped from debugging
! 11179: symbols</p>
! 11180: </dd>
! 11181:
! 11182: <dt><span class="term"><code class=
! 11183: "varname">INSTALL_SCRIPT</code></span></dt>
! 11184:
! 11185: <dd>
! 11186: <p>binaries that cannot be stripped</p>
! 11187: </dd>
! 11188:
! 11189: <dt><span class="term"><code class=
! 11190: "varname">INSTALL_GAME</code></span></dt>
! 11191:
! 11192: <dd>
! 11193: <p>game binaries</p>
! 11194: </dd>
! 11195:
! 11196: <dt><span class="term"><code class=
! 11197: "varname">INSTALL_LIB</code></span></dt>
! 11198:
! 11199: <dd>
! 11200: <p>shared and static libraries</p>
! 11201: </dd>
! 11202:
! 11203: <dt><span class="term"><code class=
! 11204: "varname">INSTALL_DATA</code></span></dt>
! 11205:
! 11206: <dd>
! 11207: <p>data files</p>
! 11208: </dd>
! 11209:
! 11210: <dt><span class="term"><code class=
! 11211: "varname">INSTALL_GAME_DATA</code></span></dt>
! 11212:
! 11213: <dd>
! 11214: <p>data files for games</p>
! 11215: </dd>
! 11216:
! 11217: <dt><span class="term"><code class=
! 11218: "varname">INSTALL_MAN</code></span></dt>
! 11219:
! 11220: <dd>
! 11221: <p>man pages</p>
! 11222: </dd>
! 11223: </dl>
! 11224: </div>
! 11225:
! 11226: <p>Some other variables are:</p>
! 11227:
! 11228: <div class="variablelist">
! 11229: <dl>
! 11230: <dt><span class="term"><code class=
! 11231: "varname">INSTALLATION_DIRS</code></span></dt>
! 11232:
! 11233: <dd>
! 11234: <p>A list of directories relative to <code class=
! 11235: "varname">PREFIX</code> that are created by pkgsrc
! 11236: at the beginning of the <span class=
! 11237: "emphasis"><em>install</em></span> phase. If this
! 11238: variable is set, <code class=
! 11239: "varname">NO_MTREE</code>=“<span class=
! 11240: "quote">yes</span>” is assumed, which means
! 11241: that the package claims to create all needed
! 11242: directories itself before installing files to it.
! 11243: Therefore this variable should only be set in
! 11244: <code xmlns=
! 11245: "http://www.w3.org/TR/xhtml1/transitional" class=
! 11246: "filename">Makefile</code>s that are under control
! 11247: of the package's author.</p>
! 11248: </dd>
! 11249: </dl>
! 11250: </div>
1.56 rillig 11251: </div>
11252:
1.67 hubertf 11253: <div class="sect1" lang="en">
1.56 rillig 11254: <div class="titlepage">
11255: <div>
11256: <div>
11257: <h2 class="title" style="clear: both"><a name=
11258: "build.package"></a>14.15. The <span class=
11259: "emphasis"><em>package</em></span> phase</h2>
11260: </div>
11261: </div>
11262: </div>
11263:
11264: <p>[TODO]</p>
1.1 grant 11265: </div>
11266:
1.67 hubertf 11267: <div class="sect1" lang="en">
1.1 grant 11268: <div class="titlepage">
11269: <div>
11270: <div>
11271: <h2 class="title" style="clear: both"><a name=
1.56 rillig 11272: "build.helpful-targets"></a>14.16. Other
1.1 grant 11273: helpful targets</h2>
11274: </div>
11275: </div>
11276: </div>
11277:
11278: <div class="variablelist">
11279: <dl>
11280: <dt><span class="term">pre/post-*</span></dt>
11281:
11282: <dd>
11283: <p>For any of the main targets described in the
11284: previous section, two auxiliary targets exist with
11285: “<span class="quote">pre-</span>” and
11286: “<span class="quote">post-</span>” used
11287: as a prefix for the main target's name. These
11288: targets are invoked before and after the main
11289: target is called, allowing extra configuration or
11290: installation steps be performed from a package's
11291: Makefile, for example, which a program's configure
11292: script or install target omitted.</p>
11293: </dd>
11294:
11295: <dt><span class="term">do-*</span></dt>
11296:
11297: <dd>
11298: <p>Should one of the main targets do the wrong
11299: thing, and should there be no variable to fix this,
11300: you can redefine it with the do-* target. (Note
11301: that redefining the target itself instead of the
11302: do-* target is a bad idea, as the pre-* and post-*
11303: targets won't be called anymore, etc.) You will not
11304: usually need to do this.</p>
11305: </dd>
11306:
11307: <dt><span class="term">reinstall</span></dt>
11308:
11309: <dd>
1.14 xtraeme 11310: <p>If you did a <span><strong class="command">make
11311: install</strong></span> and you noticed some file
11312: was not installed properly, you can repeat the
1.1 grant 11313: installation with this target, which will ignore
11314: the “<span class="quote">already
11315: installed</span>” flag.</p>
11316: </dd>
11317:
11318: <dt><span class="term">deinstall</span></dt>
11319:
11320: <dd>
1.24 wiz 11321: <p>This target does a <a href=
11322: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11323: <span class="citerefentry"><span class=
11324: "refentrytitle">pkg_delete</span>(1)</span></a> in
11325: the current directory, effectively de-installing
11326: the package. The following variables can be used to
11327: tune the behaviour:</p>
1.1 grant 11328:
11329: <div class="variablelist">
11330: <dl>
1.14 xtraeme 11331: <dt><span class="term"><code class=
11332: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 11333:
11334: <dd>
11335: <p>Add a "-v" to the <a href=
11336: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11337: <span class="citerefentry"><span class=
11338: "refentrytitle">pkg_delete</span>(1)</span></a>
11339: command.</p>
11340: </dd>
11341:
1.14 xtraeme 11342: <dt><span class="term"><code class=
11343: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 11344:
11345: <dd>
11346: <p>Remove all packages that require (depend
11347: on) the given package. This can be used to
11348: remove any packages that may have been pulled
11349: in by a given package, e.g. if
1.14 xtraeme 11350: <span><strong class="command">make deinstall
11351: DEINSTALLDEPENDS=1</strong></span> is done in
1.45 wiz 11352: <code xmlns=
11353: "http://www.w3.org/TR/xhtml1/transitional"
11354: class="filename">pkgsrc/x11/kde</code>, this
11355: is likely to remove whole KDE. Works by
1.1 grant 11356: adding “<span class=
11357: "quote">-R</span>” to the <a href=
11358: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11359: <span class="citerefentry"><span class=
11360: "refentrytitle">pkg_delete</span>(1)</span></a>
11361: command line.</p>
11362: </dd>
11363: </dl>
11364: </div>
11365: </dd>
11366:
11367: <dt><span class="term">update</span></dt>
11368:
11369: <dd>
11370: <p>This target causes the current package to be
11371: updated to the latest version. The package and all
11372: depending packages first get de-installed, then
11373: current versions of the corresponding packages get
11374: compiled and installed. This is similar to manually
11375: noting which packages are currently installed, then
1.14 xtraeme 11376: performing a series of <span><strong class=
11377: "command">make deinstall</strong></span> and
11378: <span><strong class="command">make
11379: install</strong></span> (or whatever <code class=
11380: "varname">UPDATE_TARGET</code> is set to) for these
11381: packages.</p>
1.1 grant 11382:
11383: <p>You can use the “<span class=
11384: "quote">update</span>” target to resume
1.14 xtraeme 11385: package updating in case a previous
11386: <span><strong class="command">make
11387: update</strong></span> was interrupted for some
11388: reason. However, in this case, make sure you don't
11389: call <span><strong class="command">make
11390: clean</strong></span> or otherwise remove the list
11391: of dependent packages in <code class=
1.47 reed 11392: "varname">WRKDIR</code>. Otherwise, you lose the
1.1 grant 11393: ability to automatically update the current package
11394: along with the dependent packages you have
11395: installed.</p>
11396:
1.14 xtraeme 11397: <p>Resuming an interrupted <span><strong class=
11398: "command">make update</strong></span> will only
11399: work as long as the package tree remains unchanged.
11400: If the source code for one of the packages to be
11401: updated has been changed, resuming
11402: <span><strong class="command">make
11403: update</strong></span> will most certainly
11404: fail!</p>
1.1 grant 11405:
11406: <p>The following variables can be used either on
1.45 wiz 11407: the command line or in <code xmlns=
11408: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11409: "filename">/etc/mk.conf</code> to alter the
11410: behaviour of <span><strong class="command">make
11411: update</strong></span>:</p>
1.1 grant 11412:
11413: <div class="variablelist">
11414: <dl>
1.14 xtraeme 11415: <dt><span class="term"><code class=
11416: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 11417:
11418: <dd>
11419: <p>Install target to recursively use for the
11420: updated package and the dependent packages.
1.14 xtraeme 11421: Defaults to <code class=
11422: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 11423: “<span class=
11424: "quote">install</span>” otherwise for
1.14 xtraeme 11425: <span><strong class="command">make
11426: update</strong></span>. e.g.
11427: <span><strong class="command">make update
11428: UPDATE_TARGET=package</strong></span></p>
1.1 grant 11429: </dd>
11430:
1.14 xtraeme 11431: <dt><span class="term"><code class=
11432: "varname">NOCLEAN</code></span></dt>
1.1 grant 11433:
11434: <dd>
11435: <p>Don't clean up after updating. Useful if
11436: you want to leave the work sources of the
11437: updated packages around for inspection or
11438: other purposes. Be sure you eventually clean
11439: up the source tree (see the
11440: “<span class=
11441: "quote">clean-update</span>” target
11442: below) or you may run into troubles with old
11443: source code still lying around on your next
1.14 xtraeme 11444: <span><strong class=
11445: "command">make</strong></span> or
11446: <span><strong class="command">make
11447: update</strong></span>.</p>
1.1 grant 11448: </dd>
11449:
1.14 xtraeme 11450: <dt><span class="term"><code class=
11451: "varname">REINSTALL</code></span></dt>
1.1 grant 11452:
11453: <dd>
11454: <p>Deinstall each package before installing
1.14 xtraeme 11455: (making <code class=
11456: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 11457: necessary if the “<span class=
11458: "quote">clean-update</span>” target
11459: (see below) was called after interrupting a
1.14 xtraeme 11460: running <span><strong class="command">make
11461: update</strong></span>.</p>
1.1 grant 11462: </dd>
11463:
1.14 xtraeme 11464: <dt><span class="term"><code class=
11465: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 11466:
11467: <dd>
11468: <p>Allows you to disable recursion and
11469: hardcode the target for packages. The default
11470: is “<span class=
11471: "quote">update</span>” for the update
11472: target, facilitating a recursive update of
1.14 xtraeme 11473: prerequisite packages. Only set <code class=
11474: "varname">DEPENDS_TARGET</code> if you want
11475: to disable recursive updates. Use
11476: <code class="varname">UPDATE_TARGET</code>
11477: instead to just set a specific target for
11478: each package to be installed during
11479: <span><strong class="command">make
11480: update</strong></span> (see above).</p>
1.1 grant 11481: </dd>
11482: </dl>
11483: </div>
11484: </dd>
11485:
11486: <dt><span class="term">clean-update</span></dt>
11487:
11488: <dd>
11489: <p>Clean the source tree for all packages that
1.14 xtraeme 11490: would get updated if <span><strong class=
11491: "command">make update</strong></span> was called
11492: from the current directory. This target should not
11493: be used if the current package (or any of its
11494: depending packages) have already been de-installed
11495: (e.g., after calling <span><strong class=
11496: "command">make update</strong></span>) or you may
11497: lose some packages you intended to update. As a
11498: rule of thumb: only use this target <span class=
11499: "emphasis"><em>before</em></span> the first time
11500: you run <span><strong class="command">make
11501: update</strong></span> and only if you have a dirty
11502: package tree (e.g., if you used <code class=
11503: "varname">NOCLEAN</code>).</p>
1.1 grant 11504:
1.47 reed 11505: <p>If you are unsure about whether your tree is
11506: clean, you can either perform a
1.14 xtraeme 11507: <span><strong class="command">make
1.47 reed 11508: clean</strong></span> at the top of the tree, or
11509: use the following sequence of commands from the
11510: directory of the package you want to update
11511: (<span class="emphasis"><em>before</em></span>
11512: running <span><strong class="command">make
1.14 xtraeme 11513: update</strong></span> for the first time,
11514: otherwise you lose all the packages you wanted to
11515: update!):</p>
1.1 grant 11516: <pre class="screen">
1.14 xtraeme 11517: <code class="prompt">#</code> <strong class=
11518: "userinput"><code>make clean-update</code></strong>
11519: <code class="prompt">#</code> <strong class=
11520: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
11521: <code class="prompt">#</code> <strong class=
11522: "userinput"><code>make update</code></strong>
1.1 grant 11523: </pre>
11524:
11525: <p>The following variables can be used either on
1.45 wiz 11526: the command line or in <code xmlns=
11527: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11528: "filename">/etc/mk.conf</code> to alter the
11529: behaviour of <span><strong class="command">make
11530: clean-update</strong></span>:</p>
1.1 grant 11531:
11532: <div class="variablelist">
11533: <dl>
1.14 xtraeme 11534: <dt><span class="term"><code class=
11535: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 11536:
11537: <dd>
1.14 xtraeme 11538: <p>After <span><strong class="command">make
11539: clean</strong></span>, do not reconstruct the
11540: list of directories to update for this
11541: package. Only use this if
11542: <span><strong class="command">make
11543: update</strong></span> successfully installed
11544: all packages you wanted to update. Normally,
11545: this is done automatically on
11546: <span><strong class="command">make
11547: update</strong></span>, but may have been
11548: suppressed by the <code class=
11549: "varname">NOCLEAN</code> variable (see
1.1 grant 11550: above).</p>
11551: </dd>
11552: </dl>
11553: </div>
11554: </dd>
11555:
11556: <dt><span class="term">info</span></dt>
11557:
11558: <dd>
11559: <p>This target invokes <a href=
11560: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11561: <span class="citerefentry"><span class=
11562: "refentrytitle">pkg_info</span>(1)</span></a> for
11563: the current package. You can use this to check
11564: which version of a package is installed.</p>
11565: </dd>
11566:
11567: <dt><span class="term">readme</span></dt>
11568:
11569: <dd>
1.45 wiz 11570: <p>This target generates a <code xmlns=
11571: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11572: "filename">README.html</code> file, which can be
1.1 grant 11573: viewed using a browser such as <a xmlns=
11574: "http://www.w3.org/TR/xhtml1/transitional" href=
11575: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 11576: target="_top"><code xmlns="" class=
11577: "filename">www/mozilla</code></a> or <a xmlns=
1.20 ben 11578: "http://www.w3.org/TR/xhtml1/transitional" href=
11579: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45 wiz 11580: target="_top"><code xmlns="" class=
11581: "filename">www/links</code></a>. The generated
11582: files contain references to any packages which are
11583: in the <code class="varname">PACKAGES</code>
11584: directory on the local host. The generated files
11585: can be made to refer to URLs based on <code class=
1.20 ben 11586: "varname">FTP_PKG_URL_HOST</code> and <code class=
11587: "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45 wiz 11588: wanted to generate <code xmlns=
11589: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11590: "filename">README.html</code> files which pointed
11591: to binary packages on the local machine, in the
1.45 wiz 11592: directory <code xmlns=
11593: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11594: "filename">/usr/packages</code>, set <code class=
11595: "varname">FTP_PKG_URL_HOST=file://localhost</code>
11596: and <code class=
11597: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
11598: <code class="varname">${PACKAGES}</code> directory
11599: and its subdirectories will be searched for all the
11600: binary packages.</p>
1.1 grant 11601: </dd>
11602:
11603: <dt><span class="term">readme-all</span></dt>
11604:
11605: <dd>
1.45 wiz 11606: <p>Use this target to create a file <code xmlns=
11607: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11608: "filename">README-all.html</code> which contains a
1.1 grant 11609: list of all packages currently available in the
11610: NetBSD Packages Collection, together with the
11611: category they belong to and a short description.
1.45 wiz 11612: This file is compiled from the <code xmlns=
11613: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11614: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 11615: sure to run this <span class=
1.14 xtraeme 11616: "emphasis"><em>after</em></span> a
11617: <span><strong class="command">make
11618: readme</strong></span>.</p>
1.1 grant 11619: </dd>
11620:
11621: <dt><span class="term">cdrom-readme</span></dt>
11622:
11623: <dd>
11624: <p>This is very much the same as the
11625: “<span class="quote">readme</span>”
11626: target (see above), but is to be used when
11627: generating a pkgsrc tree to be written to a CD-ROM.
1.45 wiz 11628: This target also produces <code xmlns=
11629: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11630: "filename">README.html</code> files, and can be
11631: made to refer to URLs based on <code class=
11632: "varname">CDROM_PKG_URL_HOST</code> and
11633: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 11634: </dd>
11635:
11636: <dt><span class="term">show-distfiles</span></dt>
11637:
11638: <dd>
11639: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 11640: are needed to build the package. (<code class=
11641: "varname">DISTFILES</code> and <code class=
1.45 wiz 11642: "varname">PATCHFILES</code>, but not <code xmlns=
11643: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11644: "filename">patches/*</code>)</p>
1.1 grant 11645: </dd>
11646:
11647: <dt><span class="term">show-downlevel</span></dt>
11648:
11649: <dd>
11650: <p>This target shows nothing if the package is not
11651: installed. If a version of this package is
11652: installed, but is not the version provided in this
11653: version of pkgsrc, then a warning message is
11654: displayed. This target can be used to show which of
11655: your installed packages are downlevel, and so the
11656: old versions can be deleted, and the current ones
11657: added.</p>
11658: </dd>
11659:
11660: <dt><span class="term">show-pkgsrc-dir</span></dt>
11661:
11662: <dd>
11663: <p>This target shows the directory in the pkgsrc
11664: hierarchy from which the package can be built and
11665: installed. This may not be the same directory as
11666: the one from which the package was installed. This
11667: target is intended to be used by people who may
11668: wish to upgrade many packages on a single host, and
11669: can be invoked from the top-level pkgsrc Makefile
11670: by using the “<span class=
11671: "quote">show-host-specific-pkgs</span>”
11672: target.</p>
11673: </dd>
11674:
11675: <dt><span class=
11676: "term">show-installed-depends</span></dt>
11677:
11678: <dd>
11679: <p>This target shows which installed packages match
1.14 xtraeme 11680: the current package's <code class=
11681: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 11682: dependencies are causing build problems.</p>
11683: </dd>
11684:
11685: <dt><span class="term">check-shlibs</span></dt>
11686:
11687: <dd>
11688: <p>After a package is installed, check all its
11689: binaries and (on ELF platforms) shared libraries to
11690: see if they find the shared libs they need. Run by
1.14 xtraeme 11691: default if <code class=
11692: "varname">PKG_DEVELOPER</code> is set in
1.45 wiz 11693: <code xmlns=
11694: "http://www.w3.org/TR/xhtml1/transitional" class=
11695: "filename">/etc/mk.conf</code>.</p>
1.1 grant 11696: </dd>
11697:
11698: <dt><span class="term">print-PLIST</span></dt>
11699:
11700: <dd>
11701: <p>After a “<span class="quote">make
11702: install</span>” from a new or upgraded pkg,
11703: this prints out an attempt to generate a new
1.45 wiz 11704: <code xmlns=
11705: "http://www.w3.org/TR/xhtml1/transitional" class=
11706: "filename">PLIST</code> from a <span><strong class=
11707: "command">find -newer
1.14 xtraeme 11708: work/.extract_done</strong></span>. An attempt is
11709: made to care for shared libs etc., but it is
1.1 grant 11710: <span class="emphasis"><em>strongly</em></span>
11711: recommended to review the result before putting it
1.45 wiz 11712: into <code xmlns=
11713: "http://www.w3.org/TR/xhtml1/transitional" class=
11714: "filename">PLIST</code>. On upgrades, it's useful
11715: to diff the output of this command against an
11716: already existing <code xmlns=
11717: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11718: "filename">PLIST</code> file.</p>
1.1 grant 11719:
1.24 wiz 11720: <p>If the package installs files via <a href=
11721: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
11722: <span class="citerefentry"><span class=
11723: "refentrytitle">tar</span>(1)</span></a> or other
11724: methods that don't update file access times, be
11725: sure to add these files manually to your
1.45 wiz 11726: <code xmlns=
11727: "http://www.w3.org/TR/xhtml1/transitional" class=
11728: "filename">PLIST</code>, as the “<span class=
11729: "quote">find -newer</span>” command used by
11730: this target won't catch them!</p>
1.1 grant 11731:
11732: <p>See <a href="#print-PLIST" title=
1.38 dillo 11733: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 11734: “Tweaking output of <span><strong class=
11735: "command">make
11736: print-PLIST</strong></span>”</a> for more
11737: information on this target.</p>
1.1 grant 11738: </dd>
11739:
11740: <dt><span class="term">bulk-package</span></dt>
11741:
11742: <dd>
11743: <p>Used to do bulk builds. If an appropriate binary
11744: package already exists, no action is taken. If not,
11745: this target will compile, install and package it
1.47 reed 11746: (and its depends, if <code class=
1.14 xtraeme 11747: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 11748: <a href="#binary.configuration" title=
1.38 dillo 11749: "6.3.1. Configuration">Section 6.3.1,
1.47 reed 11750: “Configuration”</a>). After creating
11751: the binary package, the sources, the just-installed
11752: package and its required packages are removed,
1.1 grant 11753: preserving free disk space.</p>
11754:
11755: <p><span class="emphasis"><em>Beware that this
11756: target may deinstall all packages installed on a
11757: system!</em></span></p>
11758: </dd>
11759:
11760: <dt><span class="term">bulk-install</span></dt>
11761:
11762: <dd>
11763: <p>Used during bulk-installs to install required
1.47 reed 11764: packages. If an up-to-date binary package is
1.1 grant 11765: available, it will be installed via <a href=
11766: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
11767: <span class="citerefentry"><span class=
11768: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 11769: not, <span><strong class="command">make
11770: bulk-package</strong></span> will be executed, but
1.47 reed 11771: the installed binary won't be removed.</p>
1.1 grant 11772:
11773: <p>A binary package is considered
1.47 reed 11774: “<span class="quote">up-to-date</span>”
1.1 grant 11775: to be installed via <a href=
11776: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
11777: <span class="citerefentry"><span class=
11778: "refentrytitle">pkg_add</span>(1)</span></a>
11779: if:</p>
11780:
11781: <div class="itemizedlist">
11782: <ul type="disc">
11783: <li>
1.45 wiz 11784: <p>None of the package's files (<code xmlns=
11785: "http://www.w3.org/TR/xhtml1/transitional"
11786: class="filename">Makefile</code>, ...) were
1.14 xtraeme 11787: modified since it was built.</p>
1.1 grant 11788: </li>
11789:
11790: <li>
11791: <p>None of the package's required (binary)
11792: packages were modified since it was
11793: built.</p>
11794: </li>
11795: </ul>
11796: </div>
11797:
11798: <p><span class="emphasis"><em>Beware that this
11799: target may deinstall all packages installed on a
11800: system!</em></span></p>
11801: </dd>
11802: </dl>
11803: </div>
11804: </div>
11805: </div>
11806:
1.67 hubertf 11807: <div class="chapter" lang="en">
1.1 grant 11808: <div class="titlepage">
11809: <div>
11810: <div>
1.67 hubertf 11811: <h2 class="title"><a name=
1.68 ! rillig 11812: "tools"></a>Chapter 15. Tools needed for
! 11813: building or running</h2>
! 11814: </div>
! 11815: </div>
! 11816: </div>
! 11817:
! 11818: <div class="toc">
! 11819: <p><b>Table of Contents</b></p>
! 11820:
! 11821: <dl>
! 11822: <dt><span class="sect1"><a href="#pkgsrc-tools">15.1.
! 11823: Tools for pkgsrc builds</a></span></dt>
! 11824:
! 11825: <dt><span class="sect1"><a href="#package-tools">15.2.
! 11826: Tools needed by packages</a></span></dt>
! 11827:
! 11828: <dt><span class="sect1"><a href="#platform-tools">15.3.
! 11829: Tools provided by platforms</a></span></dt>
! 11830: </dl>
! 11831: </div>
! 11832:
! 11833: <p>The <code class="varname">USE_TOOLS</code> definition is
! 11834: used both internally by pkgsrc and also for individual
! 11835: packages to define what commands are needed for building a
! 11836: package (like <code class="varname">BUILD_DEPENDS</code>)
! 11837: or for later run-time of an installed packaged (such as
! 11838: <code class="varname">DEPENDS</code>). If the native system
! 11839: provides an adequate tool, then in many cases, a pkgsrc
! 11840: package will not be used.</p>
! 11841:
! 11842: <p>When building a package, the replacement tools are made
! 11843: available in a directory (as symlinks or wrapper scripts)
! 11844: that is early in the executable search path. Just like the
! 11845: buildlink system, this helps with consistent builds.</p>
! 11846:
! 11847: <p>A tool may be needed to help build a specific package.
! 11848: For example, perl, GNU make (gmake) or yacc may be
! 11849: needed.</p>
! 11850:
! 11851: <p>Also a tool may be needed, for example, because the
! 11852: native system's supplied tool may be inefficient for
! 11853: building a package with pkgsrc. For example, a package may
! 11854: need GNU awk, bison (instead of yacc) or a better sed.</p>
! 11855:
! 11856: <p>The tools used by a package can be listed by running
! 11857: <span><strong class="command">make
! 11858: show-tools</strong></span>.</p>
! 11859:
! 11860: <div class="sect1" lang="en">
! 11861: <div class="titlepage">
! 11862: <div>
! 11863: <div>
! 11864: <h2 class="title" style="clear: both"><a name=
! 11865: "pkgsrc-tools"></a>15.1. Tools for pkgsrc
! 11866: builds</h2>
! 11867: </div>
! 11868: </div>
! 11869: </div>
! 11870:
! 11871: <p>The default set of tools used by pkgsrc is defined in
! 11872: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 11873: class="filename">bsd.pkg.mk</code>. This includes
! 11874: standard Unix tools, such as: <span><strong class=
! 11875: "command">cat</strong></span>, <span><strong class=
! 11876: "command">awk</strong></span>, <span><strong class=
! 11877: "command">chmod</strong></span>, <span><strong class=
! 11878: "command">test</strong></span>, and so on. These can be
! 11879: seen by running: <span><strong class="command">make
! 11880: show-var VARNAME=USE_TOOLS</strong></span>.</p>
! 11881:
! 11882: <p>If a package needs a specific program to build then
! 11883: the <code class="varname">USE_TOOLS</code> variable can
! 11884: be used to define the tools needed.</p>
! 11885: </div>
! 11886:
! 11887: <div class="sect1" lang="en">
! 11888: <div class="titlepage">
! 11889: <div>
! 11890: <div>
! 11891: <h2 class="title" style="clear: both"><a name=
! 11892: "package-tools"></a>15.2. Tools needed by
! 11893: packages</h2>
! 11894: </div>
! 11895: </div>
! 11896: </div>
! 11897:
! 11898: <p>In the following examples, the :pkgsrc means to use
! 11899: the pkgsrc version and not the native version for a build
! 11900: dependency. And the :run means that it is used for a
! 11901: run-time dependencies also (and becomes a DEPENDS). The
! 11902: default is a build dependency which can be set with
! 11903: :build. (So in this example, it is the same as
! 11904: gmake:build and pkg-config:build.)</p>
! 11905: <pre class="programlisting">
! 11906: USE_TOOLS+= mktemp:pkgsrc
! 11907: USE_TOOLS+= gmake perl:run pkg-config
! 11908: </pre>
! 11909:
! 11910: <p>When using the tools framework, a <code class=
! 11911: "varname">TOOLS_PATH.foo</code> variable is defined which
! 11912: contains the full path to the appropriate tool. For
! 11913: example, <code class="varname">TOOLS_PATH.bash</code>
! 11914: could be “<span class=
! 11915: "quote">/bin/bash</span>” on Linux systems.</p>
! 11916:
! 11917: <p>If you always need a pkgsrc version of the tool at
! 11918: run-time, then just use <code class=
! 11919: "varname">DEPENDS</code> instead.</p>
! 11920: </div>
! 11921:
! 11922: <div class="sect1" lang="en">
! 11923: <div class="titlepage">
! 11924: <div>
! 11925: <div>
! 11926: <h2 class="title" style="clear: both"><a name=
! 11927: "platform-tools"></a>15.3. Tools provided by
! 11928: platforms</h2>
! 11929: </div>
! 11930: </div>
! 11931: </div>
! 11932:
! 11933: <p>When improving or porting pkgsrc to a new platform,
! 11934: have a look at (or create) the corresponding platform
! 11935: specific make file fragment under <code xmlns=
! 11936: "http://www.w3.org/TR/xhtml1/transitional" class=
! 11937: "filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which
! 11938: defines the name of the common tools. For example:</p>
! 11939: <pre class="programlisting">
! 11940: .if exists(/usr/bin/bzcat)
! 11941: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
! 11942: .elif exists(/usr/bin/bzip2)
! 11943: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
! 11944: .endif
! 11945:
! 11946: TOOLS_PLATFORM.true?= true # shell builtin
! 11947: </pre>
! 11948: </div>
! 11949: </div>
! 11950:
! 11951: <div class="chapter" lang="en">
! 11952: <div class="titlepage">
! 11953: <div>
! 11954: <div>
! 11955: <h2 class="title"><a name=
! 11956: "fixes"></a>Chapter 16. Making your package
1.55 rillig 11957: work</h2>
1.1 grant 11958: </div>
11959: </div>
11960: </div>
11961:
11962: <div class="toc">
11963: <p><b>Table of Contents</b></p>
11964:
11965: <dl>
1.30 wiz 11966: <dt><span class="sect1"><a href=
1.68 ! rillig 11967: "#general-operation">16.1. General
1.30 wiz 11968: operation</a></span></dt>
1.1 grant 11969:
11970: <dd>
11971: <dl>
11972: <dt><span class="sect2"><a href=
1.68 ! rillig 11973: "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30 wiz 11974: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 11975:
11976: <dt><span class="sect2"><a href=
1.68 ! rillig 11977: "#where-to-install-documentation">16.1.2. Where to
1.31 wiz 11978: install documentation</a></span></dt>
11979:
11980: <dt><span class="sect2"><a href=
1.68 ! rillig 11981: "#restricted-packages">16.1.3. Restricted
1.1 grant 11982: packages</a></span></dt>
11983:
11984: <dt><span class="sect2"><a href=
1.68 ! rillig 11985: "#dependencies">16.1.4. Handling
1.1 grant 11986: dependencies</a></span></dt>
11987:
11988: <dt><span class="sect2"><a href=
1.68 ! rillig 11989: "#conflicts">16.1.5. Handling conflicts with other
1.1 grant 11990: packages</a></span></dt>
11991:
11992: <dt><span class="sect2"><a href=
1.68 ! rillig 11993: "#not-building-packages">16.1.6. Packages that
1.30 wiz 11994: cannot or should not be built</a></span></dt>
1.1 grant 11995:
11996: <dt><span class="sect2"><a href=
1.68 ! rillig 11997: "#undeletable-packages">16.1.7. Packages which
1.30 wiz 11998: should not be deleted, once
11999: installed</a></span></dt>
1.1 grant 12000:
12001: <dt><span class="sect2"><a href=
1.68 ! rillig 12002: "#security-handling">16.1.8. Handling packages with
1.1 grant 12003: security problems</a></span></dt>
12004:
12005: <dt><span class="sect2"><a href=
1.68 ! rillig 12006: "#compiler-bugs">16.1.9. How to handle compiler
1.1 grant 12007: bugs</a></span></dt>
12008:
12009: <dt><span class="sect2"><a href=
1.68 ! rillig 12010: "#bumping-pkgrevision">16.1.10. How to handle
1.30 wiz 12011: incrementing versions when fixing an existing
1.1 grant 12012: package</a></span></dt>
12013:
12014: <dt><span class="sect2"><a href=
1.68 ! rillig 12015: "#portability-of-packages">16.1.11. Portability of
1.1 grant 12016: packages</a></span></dt>
12017: </dl>
12018: </dd>
12019:
1.30 wiz 12020: <dt><span class="sect1"><a href=
1.68 ! rillig 12021: "#downloading-issues">16.2. Possible downloading
1.30 wiz 12022: issues</a></span></dt>
1.1 grant 12023:
12024: <dd>
12025: <dl>
12026: <dt><span class="sect2"><a href=
1.68 ! rillig 12027: "#no-plain-download">16.2.1. Packages whose
1.30 wiz 12028: distfiles aren't available for plain
1.1 grant 12029: downloading</a></span></dt>
12030:
12031: <dt><span class="sect2"><a href=
1.68 ! rillig 12032: "#modified-distfiles-same-name">16.2.2. How to
1.30 wiz 12033: handle modified distfiles with the 'old'
12034: name</a></span></dt>
1.1 grant 12035: </dl>
12036: </dd>
12037:
1.30 wiz 12038: <dt><span class="sect1"><a href=
1.68 ! rillig 12039: "#configuration-gotchas">16.3. Configuration
1.30 wiz 12040: gotchas</a></span></dt>
1.1 grant 12041:
12042: <dd>
12043: <dl>
12044: <dt><span class="sect2"><a href=
1.68 ! rillig 12045: "#fixes.libtool">16.3.1. Shared libraries -
1.1 grant 12046: libtool</a></span></dt>
12047:
12048: <dt><span class="sect2"><a href=
1.68 ! rillig 12049: "#using-libtool">16.3.2. Using libtool on GNU
1.30 wiz 12050: packages that already support
12051: libtool</a></span></dt>
1.1 grant 12052:
12053: <dt><span class="sect2"><a href=
1.68 ! rillig 12054: "#autoconf-automake">16.3.3. GNU
1.1 grant 12055: Autoconf/Automake</a></span></dt>
12056: </dl>
12057: </dd>
12058:
1.68 ! rillig 12059: <dt><span class="sect1"><a href="#fixes-build">16.4.
1.55 rillig 12060: Building the package</a></span></dt>
1.1 grant 12061:
12062: <dd>
12063: <dl>
12064: <dt><span class="sect2"><a href=
1.68 ! rillig 12065: "#cpp-defines">16.4.1. CPP defines</a></span></dt>
1.51 rillig 12066:
1.60 rillig 12067: <dt><span class="sect2"><a href=
1.68 ! rillig 12068: "#cpp-list-examples">16.4.2. Examples of CPP
1.60 rillig 12069: defines for some platforms</a></span></dt>
12070:
1.68 ! rillig 12071: <dt><span class="sect2"><a href="#cpp-list">16.4.3.
1.51 rillig 12072: Getting a list of CPP defines</a></span></dt>
1.1 grant 12073: </dl>
12074: </dd>
12075:
1.30 wiz 12076: <dt><span class="sect1"><a href=
1.68 ! rillig 12077: "#package-specific-actions">16.5. Package specific
1.30 wiz 12078: actions</a></span></dt>
1.1 grant 12079:
12080: <dd>
12081: <dl>
12082: <dt><span class="sect2"><a href=
1.68 ! rillig 12083: "#user-interaction">16.5.1. User
1.2 hubertf 12084: interaction</a></span></dt>
1.1 grant 12085:
12086: <dt><span class="sect2"><a href=
1.68 ! rillig 12087: "#handling-licenses">16.5.2. Handling
1.1 grant 12088: licenses</a></span></dt>
12089:
12090: <dt><span class="sect2"><a href=
1.68 ! rillig 12091: "#installing-score-files">16.5.3. Installing score
1.1 grant 12092: files</a></span></dt>
12093:
12094: <dt><span class="sect2"><a href=
1.68 ! rillig 12095: "#perl-scripts">16.5.4. Packages containing perl
1.1 grant 12096: scripts</a></span></dt>
12097:
12098: <dt><span class="sect2"><a href=
1.68 ! rillig 12099: "#hardcoded-paths">16.5.5. Packages with hardcoded
1.30 wiz 12100: paths to other interpreters</a></span></dt>
1.1 grant 12101:
12102: <dt><span class="sect2"><a href=
1.68 ! rillig 12103: "#perl-modules">16.5.6. Packages installing perl
1.1 grant 12104: modules</a></span></dt>
12105:
12106: <dt><span class="sect2"><a href=
1.68 ! rillig 12107: "#faq.info-files">16.5.7. Packages installing info
1.1 grant 12108: files</a></span></dt>
12109:
1.68 ! rillig 12110: <dt><span class="sect2"><a href="#manpages">16.5.8.
1.57 minskim 12111: Packages installing man pages</a></span></dt>
12112:
1.1 grant 12113: <dt><span class="sect2"><a href=
1.68 ! rillig 12114: "#gconf2-data-files">16.5.9. Packages installing
1.30 wiz 12115: GConf2 data files</a></span></dt>
1.1 grant 12116:
12117: <dt><span class="sect2"><a href=
1.68 ! rillig 12118: "#scrollkeeper-data-files">16.5.10. Packages
1.30 wiz 12119: installing scrollkeeper data files</a></span></dt>
1.1 grant 12120:
12121: <dt><span class="sect2"><a href=
1.68 ! rillig 12122: "#x11-fonts">16.5.11. Packages installing X11
1.1 grant 12123: fonts</a></span></dt>
12124:
12125: <dt><span class="sect2"><a href=
1.68 ! rillig 12126: "#gtk2-modules">16.5.12. Packages installing GTK2
1.1 grant 12127: modules</a></span></dt>
12128:
12129: <dt><span class="sect2"><a href=
1.68 ! rillig 12130: "#sgml-xml-data">16.5.13. Packages installing SGML
1.30 wiz 12131: or XML data</a></span></dt>
1.1 grant 12132:
12133: <dt><span class="sect2"><a href=
1.68 ! rillig 12134: "#mime-database">16.5.14. Packages installing
1.1 grant 12135: extensions to the MIME database</a></span></dt>
12136:
12137: <dt><span class="sect2"><a href=
1.68 ! rillig 12138: "#intltool">16.5.15. Packages using
1.1 grant 12139: intltool</a></span></dt>
1.18 xtraeme 12140:
12141: <dt><span class="sect2"><a href=
1.68 ! rillig 12142: "#startup-scripts">16.5.16. Packages installing
1.30 wiz 12143: startup scripts</a></span></dt>
1.57 minskim 12144:
12145: <dt><span class="sect2"><a href=
1.68 ! rillig 12146: "#tex-packages">16.5.17. Packages installing TeX
1.57 minskim 12147: modules</a></span></dt>
1.1 grant 12148: </dl>
12149: </dd>
12150:
1.30 wiz 12151: <dt><span class="sect1"><a href=
1.68 ! rillig 12152: "#feedback-to-author">16.6. Feedback to the
1.30 wiz 12153: author</a></span></dt>
1.1 grant 12154: </dl>
12155: </div>
12156:
1.67 hubertf 12157: <div class="sect1" lang="en">
1.1 grant 12158: <div class="titlepage">
12159: <div>
12160: <div>
12161: <h2 class="title" style="clear: both"><a name=
1.68 ! rillig 12162: "general-operation"></a>16.1. General
1.1 grant 12163: operation</h2>
12164: </div>
12165: </div>
12166: </div>
12167:
1.67 hubertf 12168: <div class="sect2" lang="en">
1.1 grant 12169: <div class="titlepage">
12170: <div>
12171: <div>
1.30 wiz 12172: <h3 class="title"><a name=
1.68 ! rillig 12173: "pulling-vars-from-etc-mk.conf"></a>16.1.1. How
1.30 wiz 12174: to pull in variables from /etc/mk.conf</h3>
1.1 grant 12175: </div>
12176: </div>
12177: </div>
12178:
12179: <p>The problem with package-defined variables that can
1.14 xtraeme 12180: be overridden via <code class="varname">MAKECONF</code>
1.45 wiz 12181: or <code xmlns=
12182: "http://www.w3.org/TR/xhtml1/transitional" class=
12183: "filename">/etc/mk.conf</code> is that <a href=
1.1 grant 12184: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
12185: <span class="citerefentry"><span class=
12186: "refentrytitle">make</span>(1)</span></a> expands a
1.47 reed 12187: variable as it is used, but evaluates preprocessor-like
1.1 grant 12188: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 12189: So, to use any variable (which may be set in
1.45 wiz 12190: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12191: class="filename">/etc/mk.conf</code>) in one of the
12192: .if* statements, the file <code xmlns=
12193: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12194: "filename">/etc/mk.conf</code> must be included before
1.1 grant 12195: that .if* statement.</p>
12196:
1.47 reed 12197: <p>Rather than having a number of ad-hoc ways of
1.45 wiz 12198: including <code xmlns=
12199: "http://www.w3.org/TR/xhtml1/transitional" class=
12200: "filename">/etc/mk.conf</code>, should it exist, or
12201: <code class="varname">MAKECONF</code>, should it exist,
12202: include the <code xmlns=
12203: "http://www.w3.org/TR/xhtml1/transitional" class=
12204: "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
12205: package Makefile before any preprocessor-like .if,
12206: .ifdef, or .ifndef statements:</p>
1.1 grant 12207: <pre class="programlisting">
1.51 rillig 12208: .include "../../mk/bsd.prefs.mk"
12209:
1.1 grant 12210: .if defined(USE_MENUS)
1.51 rillig 12211: # ...
1.1 grant 12212: .endif
12213: </pre>
12214:
1.14 xtraeme 12215: <p>If you wish to set the <code class=
1.45 wiz 12216: "varname">CFLAGS</code> variable in <code xmlns=
12217: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 12218: "filename">/etc/mk.conf</code>, please make sure to
1.1 grant 12219: use:</p>
12220: <pre class="programlisting">
1.51 rillig 12221: CFLAGS+= -your -flags
1.1 grant 12222: </pre>
12223:
1.14 xtraeme 12224: <p>Using <code class="varname">CFLAGS=</code> (i.e.
12225: without the “<span class="quote">+</span>”)
12226: may lead to problems with packages that need to add
12227: their own flags. Also, you may want to take a look at
12228: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 12229: href=
12230: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 12231: target="_top"><code xmlns="" class=
12232: "filename">devel/cpuflags</code></a> package if you're
1.20 ben 12233: interested in optimization for the current CPU.</p>
1.1 grant 12234: </div>
12235:
1.67 hubertf 12236: <div class="sect2" lang="en">
1.1 grant 12237: <div class="titlepage">
12238: <div>
12239: <div>
1.31 wiz 12240: <h3 class="title"><a name=
1.68 ! rillig 12241: "where-to-install-documentation"></a>16.1.2. Where
1.31 wiz 12242: to install documentation</h3>
12243: </div>
12244: </div>
12245: </div>
12246:
1.45 wiz 12247: <p>Documentation should be installed into <code xmlns=
12248: "http://www.w3.org/TR/xhtml1/transitional" class=
1.31 wiz 12249: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45 wiz 12250: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12251: class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
12252: (the latter includes the version number of the
12253: package).</p>
1.31 wiz 12254: </div>
12255:
1.67 hubertf 12256: <div class="sect2" lang="en">
1.31 wiz 12257: <div class="titlepage">
12258: <div>
12259: <div>
1.67 hubertf 12260: <h3 class="title"><a name=
1.68 ! rillig 12261: "restricted-packages"></a>16.1.3. Restricted
1.1 grant 12262: packages</h3>
12263: </div>
12264: </div>
12265: </div>
12266:
12267: <p>Some licenses restrict how software may be
12268: re-distributed. In order to satisfy these restrictions,
12269: the package system defines five make variables that can
12270: be set to note these restrictions:</p>
12271:
12272: <div class="itemizedlist">
12273: <ul type="disc">
12274: <li>
1.14 xtraeme 12275: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 12276:
12277: <p>This variable should be set whenever a
12278: restriction exists (regardless of its kind). Set
12279: this variable to a string containing the reason
12280: for the restriction.</p>
12281: </li>
12282:
12283: <li>
1.14 xtraeme 12284: <p><code class=
12285: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 12286:
12287: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 12288: variable to <code class=
12289: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 12290: package may not be included on a CD-ROM.</p>
12291: </li>
12292:
12293: <li>
1.14 xtraeme 12294: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 12295:
12296: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 12297: Set this variable to <code class=
12298: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 12299: package may not not be made available on the
12300: Internet.</p>
12301: </li>
12302:
12303: <li>
1.14 xtraeme 12304: <p><code class=
12305: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 12306:
12307: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 12308: this variable to <code class=
12309: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 12310: of the source code or other distfile(s) is not
12311: allowed on CD-ROMs.</p>
12312: </li>
12313:
12314: <li>
1.14 xtraeme 12315: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 12316:
12317: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 12318: variable to <code class=
12319: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 12320: of the source code or other distfile(s) via the
12321: Internet is not allowed.</p>
12322: </li>
12323: </ul>
12324: </div>
12325:
1.14 xtraeme 12326: <p>Please note that the use of <code class=
12327: "varname">NO_PACKAGE</code>, <code class=
12328: "varname">IGNORE</code>, <code class=
12329: "varname">NO_CDROM</code>, or other generic make
1.1 grant 12330: variables to denote restrictions is deprecated, because
12331: they unconditionally prevent users from generating
12332: binary packages!</p>
12333: </div>
12334:
1.67 hubertf 12335: <div class="sect2" lang="en">
1.1 grant 12336: <div class="titlepage">
12337: <div>
12338: <div>
1.67 hubertf 12339: <h3 class="title"><a name=
1.68 ! rillig 12340: "dependencies"></a>16.1.4. Handling
1.1 grant 12341: dependencies</h3>
12342: </div>
12343: </div>
12344: </div>
12345:
12346: <p>Your package may depend on some other package being
12347: present - and there are various ways of expressing this
1.14 xtraeme 12348: dependency. pkgsrc supports the <code class=
12349: "varname">BUILD_DEPENDS</code> and <code class=
1.47 reed 12350: "varname">DEPENDS</code> definitions, the <code class=
12351: "varname">USE_TOOLS</code> definition, as well as
1.45 wiz 12352: dependencies via <code xmlns=
12353: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12354: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 12355: way to handle dependencies, and which uses the
12356: variables named above. See <a href="#buildlink" title=
1.38 dillo 12357: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 12358: <i>Buildlink methodology</i></a> for more
12359: information.</p>
12360:
12361: <p>The basic difference between the two variables is as
1.14 xtraeme 12362: follows: The <code class="varname">DEPENDS</code>
1.1 grant 12363: definition registers that pre-requisite in the binary
12364: package so it will be pulled in when the binary package
1.14 xtraeme 12365: is later installed, whilst the <code class=
12366: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 12367: marking a dependency that is only needed for building
12368: the package.</p>
12369:
12370: <p>This means that if you only need a package present
12371: whilst you are building, it should be noted as a
1.14 xtraeme 12372: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 12373:
1.14 xtraeme 12374: <p>The format for a <code class=
12375: "varname">BUILD_DEPENDS</code> and a <code class=
12376: "varname">DEPENDS</code> definition is:</p>
1.1 grant 12377: <pre class="programlisting">
1.51 rillig 12378: <pre-req-package-name>:../../<category>/<pre-req-package>
1.1 grant 12379: </pre>
12380:
12381: <p>Please note that the “<span class=
12382: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 12383: any of the wildcard version numbers recognized by
1.1 grant 12384: <a href=
12385: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
12386: <span class="citerefentry"><span class=
12387: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
12388:
12389: <div class="orderedlist">
12390: <ol type="1">
12391: <li>
12392: <p>If your package needs another package's
12393: binaries or libraries to build or run, and if
1.45 wiz 12394: that package has a <code xmlns=
12395: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12396: "filename">buildlink3.mk</code> file available,
12397: use it:</p>
1.1 grant 12398: <pre class="programlisting">
12399: .include "../../graphics/jpeg/buildlink3.mk"
12400: </pre>
12401: </li>
12402:
12403: <li>
12404: <p>If your package needs to use another package
1.45 wiz 12405: to build itself and there is no <code xmlns=
12406: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12407: "filename">buildlink3.mk</code> file available,
12408: use the <code class=
12409: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 12410: <pre class="programlisting">
1.51 rillig 12411: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1 grant 12412: </pre>
12413: </li>
12414:
12415: <li>
12416: <p>If your package needs a library with which to
1.45 wiz 12417: link and again there is no <code xmlns=
12418: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12419: "filename">buildlink3.mk</code> file available,
12420: this is specified using the <code class=
12421: "varname">DEPENDS</code> definition. An example
12422: of this is the <a xmlns=
1.1 grant 12423: "http://www.w3.org/TR/xhtml1/transitional" href=
12424: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 12425: target="_top"><code xmlns="" class=
12426: "filename">print/lyx</code></a> package, which
12427: uses the xpm library, version 3.4j to build:</p>
1.1 grant 12428: <pre class="programlisting">
1.51 rillig 12429: DEPENDS+= xpm-3.4j:../../graphics/xpm
1.1 grant 12430: </pre>
12431:
12432: <p>You can also use wildcards in package
12433: dependences:</p>
12434: <pre class="programlisting">
1.51 rillig 12435: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
1.1 grant 12436: </pre>
12437:
12438: <p>Note that such wildcard dependencies are
12439: retained when creating binary packages. The
12440: dependency is checked when installing the binary
12441: package and any package which matches the pattern
12442: will be used. Wildcard dependencies should be
12443: used with care.</p>
12444:
12445: <p>The “<span class=
12446: "quote">-[0-9]*</span>” should be used
12447: instead of “<span class=
12448: "quote">-*</span>” to avoid potentially
12449: ambiguous matches such as “<span class=
12450: "quote">tk-postgresql</span>” matching a
12451: “<span class="quote">tk-*</span>”
1.14 xtraeme 12452: <code class="varname">DEPENDS</code>.</p>
1.1 grant 12453:
12454: <p>Wildcards can also be used to specify that a
12455: package will only build against a certain minimum
12456: version of a pre-requisite:</p>
12457: <pre class="programlisting">
1.51 rillig 12458: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
1.1 grant 12459: </pre>
12460:
12461: <p>This means that the package will build against
12462: version 3.5.4 of the tiff library or newer. Such
12463: a dependency may be warranted if, for example,
12464: the API of the library has changed with version
12465: 3.5.4 and a package would not compile against an
12466: earlier version of tiff.</p>
12467:
12468: <p>Please note that such dependencies should only
12469: be updated if a package requires a newer
12470: pre-requisite, but not to denote recommendations
12471: such as security updates or ABI changes that do
12472: not prevent a package from building correctly.
12473: Such recommendations can be expressed using
1.14 xtraeme 12474: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 12475: <pre class="programlisting">
1.51 rillig 12476: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
1.1 grant 12477: </pre>
12478:
1.14 xtraeme 12479: <p>In addition to the above <code class=
12480: "varname">DEPENDS</code> line, this denotes that
1.1 grant 12481: while a package will build against
12482: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 12483: recommended. <code class=
12484: "varname">RECOMMENDED</code> entries will be
12485: turned into dependencies unless explicitly
12486: ignored (in which case a warning will be
1.36 wiz 12487: printed).</p>
12488:
12489: <p>To ignore these dependency recommendations and
12490: just use the required <code class=
12491: "varname">DEPENDS</code>, set <code class=
12492: "varname">IGNORE_RECOMMENDED=YES</code>. This may
12493: make it easier and faster to update packages
12494: built using pkgsrc, since older compatible
12495: dependencies can continue to be used. This is
12496: useful for people who watch their rebuilds very
12497: carefully; it is not very good as a
12498: general-purpose hammer. If you use it, you need
12499: to be mindful of possible ABI changes, including
12500: those from the underlying OS.</p>
12501:
12502: <p>Packages that are built with recommendations
12503: ignored may not be uploaded to ftp.NetBSD.org by
12504: developers and should not be used across
12505: different systems that may have different
12506: versions of binary packages installed.</p>
1.1 grant 12507:
12508: <p>For security fixes, please update the package
12509: vulnerabilities file as well as setting
1.14 xtraeme 12510: <code class="varname">RECOMMENDED</code>, see
1.1 grant 12511: <a href="#security-handling" title=
1.68 ! rillig 12512: "16.1.8. Handling packages with security problems">
! 12513: Section 16.1.8, “Handling packages
1.67 hubertf 12514: with security problems”</a> for more
1.1 grant 12515: information.</p>
12516: </li>
12517:
12518: <li>
12519: <p>If your package needs some executable to be
1.17 sketch 12520: able to run correctly and if there's no
1.45 wiz 12521: <code xmlns=
12522: "http://www.w3.org/TR/xhtml1/transitional" class=
12523: "filename">buildlink3.mk</code> file, this is
12524: specified using the <code class=
1.14 xtraeme 12525: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 12526: "http://www.w3.org/TR/xhtml1/transitional" href=
12527: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 12528: target="_top"><code xmlns="" class=
12529: "filename">print/lyx</code></a> package needs to
12530: be able to execute the latex binary from the
12531: teTeX package when it runs, and that is
12532: specified:</p>
1.1 grant 12533: <pre class="programlisting">
1.51 rillig 12534: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
1.1 grant 12535: </pre>
12536:
12537: <p>The comment about wildcard dependencies from
12538: previous paragraph applies here, too.</p>
12539: </li>
12540: </ol>
12541: </div>
12542:
12543: <p>If your package needs files from another package to
12544: build, see the first part of the “<span class=
12545: "quote">do-configure</span>” target <a xmlns=
12546: "http://www.w3.org/TR/xhtml1/transitional" href=
12547: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45 wiz 12548: target="_top"><code xmlns="" class=
12549: "filename">print/ghostscript5</code></a> package (it
1.20 ben 12550: relies on the jpeg sources being present in source form
12551: during the build):</p>
1.1 grant 12552: <pre class="programlisting">
1.51 rillig 12553: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
12554: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
1.1 grant 12555: fi
12556: </pre>
12557:
12558: <p>If you build any other packages that way, please
12559: make sure the working files are deleted too when this
12560: package's working files are cleaned up. The easiest way
12561: to do so is by adding a pre-clean target:</p>
12562: <pre class="programlisting">
1.51 rillig 12563: pre-clean:
12564: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
1.1 grant 12565: </pre>
12566:
1.14 xtraeme 12567: <p>Please also note the <code class=
12568: "varname">BUILD_USES_MSGFMT</code> and <code class=
12569: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
12570: which are provided as convenience definitions. The
1.24 wiz 12571: former works out whether <a href=
12572: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
12573: <span class="citerefentry"><span class=
12574: "refentrytitle">msgfmt</span>(1)</span></a> is part of
12575: the base system, and, if it isn't, installs the
12576: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12577: href=
1.1 grant 12578: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45 wiz 12579: target="_top"><code xmlns="" class=
12580: "filename">devel/gettext</code></a> package. The latter
1.20 ben 12581: adds a build dependency on either an installed version
12582: of an older gettext package, or if it isn't, installs
12583: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12584: href=
12585: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45 wiz 12586: target="_top"><code xmlns="" class=
12587: "filename">devel/gettext-m4</code></a> package.</p>
1.1 grant 12588: </div>
12589:
1.67 hubertf 12590: <div class="sect2" lang="en">
1.1 grant 12591: <div class="titlepage">
12592: <div>
12593: <div>
1.67 hubertf 12594: <h3 class="title"><a name=
1.68 ! rillig 12595: "conflicts"></a>16.1.5. Handling conflicts
1.1 grant 12596: with other packages</h3>
12597: </div>
12598: </div>
12599: </div>
12600:
12601: <p>Your package may conflict with other packages a user
12602: might already have installed on his system, e.g. if
12603: your package installs the same set of files like
12604: another package in our pkgsrc tree.</p>
12605:
1.14 xtraeme 12606: <p>In this case you can set <code class=
1.47 reed 12607: "varname">CONFLICTS</code> to a space-separated list of
1.1 grant 12608: packages (including version string) your package
12609: conflicts with.</p>
12610:
1.47 reed 12611: <p>For example, <a xmlns=
1.1 grant 12612: "http://www.w3.org/TR/xhtml1/transitional" href=
12613: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45 wiz 12614: target="_top"><code xmlns="" class=
12615: "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20 ben 12616: "http://www.w3.org/TR/xhtml1/transitional" href=
12617: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45 wiz 12618: target="_top"><code xmlns="" class=
1.47 reed 12619: "filename">x11/Xaw-Xpm</code></a> install the same
12620: shared library, thus you set in <code xmlns=
1.45 wiz 12621: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 12622: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 12623: <pre class="programlisting">
1.51 rillig 12624: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 grant 12625: </pre>
12626:
1.45 wiz 12627: <p>and in <code xmlns=
12628: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12629: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 12630: <pre class="programlisting">
1.51 rillig 12631: CONFLICTS= Xaw3d-[0-9]*
1.1 grant 12632: </pre>
12633:
12634: <p>Packages will automatically conflict with other
12635: packages with the name prefix and a different version
12636: string. “<span class=
12637: "quote">Xaw3d-1.5</span>” e.g. will automatically
12638: conflict with the older version “<span class=
12639: "quote">Xaw3d-1.3</span>”.</p>
12640: </div>
12641:
1.67 hubertf 12642: <div class="sect2" lang="en">
1.1 grant 12643: <div class="titlepage">
12644: <div>
12645: <div>
1.67 hubertf 12646: <h3 class="title"><a name=
1.68 ! rillig 12647: "not-building-packages"></a>16.1.6. Packages
1.30 wiz 12648: that cannot or should not be built</h3>
1.1 grant 12649: </div>
12650: </div>
12651: </div>
12652:
12653: <p>There are several reasons why a package might be
12654: instructed to not build under certain circumstances. If
12655: the package builds and runs on most platforms, the
1.14 xtraeme 12656: exceptions should be noted with <code class=
12657: "varname">NOT_FOR_PLATFORM</code>. If the package
12658: builds and runs on a small handful of platforms, set
12659: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45 wiz 12660: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
12661: <code class="varname">NOT_FOR_PLATFORM</code> are OS
12662: triples (OS-version-platform) that can use glob-style
12663: wildcards.</p>
12664:
12665: <p>If the package should be skipped (for example,
12666: because it provides functionality already provided by
12667: the system), set <code class=
1.14 xtraeme 12668: "varname">PKG_SKIP_REASON</code> to a descriptive
12669: message. If the package should fail because some
12670: preconditions are not met, set <code class=
12671: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 12672: message.</p>
12673: </div>
12674:
1.67 hubertf 12675: <div class="sect2" lang="en">
1.1 grant 12676: <div class="titlepage">
12677: <div>
12678: <div>
1.67 hubertf 12679: <h3 class="title"><a name=
1.68 ! rillig 12680: "undeletable-packages"></a>16.1.7. Packages
1.30 wiz 12681: which should not be deleted, once installed</h3>
1.1 grant 12682: </div>
12683: </div>
12684: </div>
12685:
12686: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 12687: has been installed, the <code class=
12688: "varname">PKG_PRESERVE</code> definition should be set
12689: in the package Makefile. This will be carried into any
1.1 grant 12690: binary package that is made from this pkgsrc entry. A
12691: “<span class="quote">preserved</span>”
12692: package will not be deleted using <a href=
12693: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
12694: <span class="citerefentry"><span class=
12695: "refentrytitle">pkg_delete</span>(1)</span></a> unless
12696: the “<span class="quote">-f</span>” option
12697: is used.</p>
12698: </div>
12699:
1.67 hubertf 12700: <div class="sect2" lang="en">
1.1 grant 12701: <div class="titlepage">
12702: <div>
12703: <div>
1.67 hubertf 12704: <h3 class="title"><a name=
1.68 ! rillig 12705: "security-handling"></a>16.1.8. Handling
1.1 grant 12706: packages with security problems</h3>
12707: </div>
12708: </div>
12709: </div>
12710:
12711: <p>When a vulnerability is found, this should be noted
1.45 wiz 12712: in <code xmlns=
12713: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12714: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43 wiz 12715: and after committing that file, use
12716: <span><strong class="command">make
12717: upload</strong></span> in the same directory to update
12718: the file on ftp.NetBSD.org.</p>
12719:
12720: <p>After fixing the vulnerability by a patch, its
12721: <code class="varname">PKGREVISION</code> should be
12722: increased (this is of course not necessary if the
12723: problem is fixed by using a newer release of the
1.45 wiz 12724: software). In addition, if a <code xmlns=
12725: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12726: "filename">buildlink3.mk</code> file exists for an
1.43 wiz 12727: affected package, a corresponding <code class=
1.14 xtraeme 12728: "varname">BUILDLINK_RECOMMENDED.<em class=
12729: "replaceable"><code>pkg</code></em></code> entry should
1.43 wiz 12730: be added or updated in it.</p>
1.1 grant 12731:
12732: <p>Also, if the fix should be applied to the stable
12733: pkgsrc branch, be sure to submit a pullup request!</p>
1.43 wiz 12734:
12735: <p>Binary packages already on ftp.NetBSD.org will be
12736: handled semi-automatically by a weekly cron job.</p>
1.1 grant 12737: </div>
12738:
1.67 hubertf 12739: <div class="sect2" lang="en">
1.1 grant 12740: <div class="titlepage">
12741: <div>
12742: <div>
1.67 hubertf 12743: <h3 class="title"><a name=
1.68 ! rillig 12744: "compiler-bugs"></a>16.1.9. How to handle
1.1 grant 12745: compiler bugs</h3>
12746: </div>
12747: </div>
12748: </div>
12749:
12750: <p>Some source files trigger bugs in the compiler,
12751: based on combinations of compiler version and
12752: architecture and almost always relation to optimisation
12753: being enabled. Common symptoms are gcc internal errors
12754: or never finishing compiling a file.</p>
12755:
1.47 reed 12756: <p>Typically, a workaround involves testing the
1.14 xtraeme 12757: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 12758: version, disabling optimisation for that
1.14 xtraeme 12759: file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45 wiz 12760: combination, and documenting it in <code xmlns=
12761: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12762: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 12763: number of examples!</p>
12764: </div>
12765:
1.67 hubertf 12766: <div class="sect2" lang="en">
1.1 grant 12767: <div class="titlepage">
12768: <div>
12769: <div>
1.67 hubertf 12770: <h3 class="title"><a name=
1.68 ! rillig 12771: "bumping-pkgrevision"></a>16.1.10. How to
1.30 wiz 12772: handle incrementing versions when fixing an
12773: existing package</h3>
1.1 grant 12774: </div>
12775: </div>
12776: </div>
12777:
12778: <p>When making fixes to an existing package it can be
1.14 xtraeme 12779: useful to change the version number in <code class=
12780: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 12781: future versions by the original author, a
12782: “<span class="quote">nb1</span>”,
12783: “<span class="quote">nb2</span>”, ...
12784: suffix can be used on package versions by setting
1.14 xtraeme 12785: <code class="varname">PKGREVISION=1</code> (2, ...).
12786: The “<span class="quote">nb</span>” is
12787: treated like a “<span class=
12788: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 12789: <pre class="programlisting">
1.51 rillig 12790: DISTNAME= foo-17.42
12791: PKGREVISION= 9
1.1 grant 12792: </pre>
12793:
1.14 xtraeme 12794: <p>will result in a <code class=
12795: "varname">PKGNAME</code> of “<span class=
1.1 grant 12796: "quote">foo-17.42nb9</span>”.</p>
12797:
12798: <p>When a new release of the package is released, the
1.14 xtraeme 12799: <code class="varname">PKGREVISION</code> should be
1.47 reed 12800: removed, e.g. on a new minor release of the above
1.14 xtraeme 12801: package, things should be like:</p>
1.1 grant 12802: <pre class="programlisting">
1.51 rillig 12803: DISTNAME= foo-17.43
1.1 grant 12804: </pre>
12805: </div>
12806:
1.67 hubertf 12807: <div class="sect2" lang="en">
1.1 grant 12808: <div class="titlepage">
12809: <div>
12810: <div>
1.30 wiz 12811: <h3 class="title"><a name=
1.68 ! rillig 12812: "portability-of-packages"></a>16.1.11. Portability
1.30 wiz 12813: of packages</h3>
1.1 grant 12814: </div>
12815: </div>
12816: </div>
12817:
12818: <p>One appealing feature of pkgsrc is that it runs on
12819: many different platforms. As a result, it is important
12820: to ensure, where possible, that packages in pkgsrc are
12821: portable. There are some particular details you should
12822: pay attention to while working on pkgsrc.</p>
12823:
1.67 hubertf 12824: <div class="sect3" lang="en">
1.1 grant 12825: <div class="titlepage">
12826: <div>
12827: <div>
1.67 hubertf 12828: <h4 class="title"><a name=
1.68 ! rillig 12829: "install-scripts"></a>16.1.11.1. ${INSTALL},
1.1 grant 12830: ${INSTALL_DATA_DIR}, ...</h4>
12831: </div>
12832: </div>
12833: </div>
12834:
1.14 xtraeme 12835: <p>The BSD-compatible <span><strong class=
12836: "command">install</strong></span> supplied with some
1.1 grant 12837: operating systems will not perform more than one
12838: operation at a time. As such, you should call
12839: “<span class="quote">${INSTALL}</span>”,
12840: etc. like this:</p>
12841: <pre class="programlisting">
1.51 rillig 12842: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
12843: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1 grant 12844: </pre>
12845: </div>
12846: </div>
12847: </div>
12848:
1.67 hubertf 12849: <div class="sect1" lang="en">
1.1 grant 12850: <div class="titlepage">
12851: <div>
12852: <div>
12853: <h2 class="title" style="clear: both"><a name=
1.68 ! rillig 12854: "downloading-issues"></a>16.2. Possible
1.1 grant 12855: downloading issues</h2>
12856: </div>
12857: </div>
12858: </div>
12859:
1.67 hubertf 12860: <div class="sect2" lang="en">
1.1 grant 12861: <div class="titlepage">
12862: <div>
12863: <div>
1.67 hubertf 12864: <h3 class="title"><a name=
1.68 ! rillig 12865: "no-plain-download"></a>16.2.1. Packages
1.30 wiz 12866: whose distfiles aren't available for plain
1.1 grant 12867: downloading</h3>
12868: </div>
12869: </div>
12870: </div>
12871:
12872: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 12873: set <code class="varname">DYNAMIC_MASTER_SITES</code>
12874: and a <span><strong class="command">make
1.45 wiz 12875: fetch</strong></span> will call <code xmlns=
12876: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12877: "filename">files/getsite.sh</code> with the name of
12878: each file to download as an argument, expecting it to
12879: output the URL of the directory from which to download
12880: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12881: href=
1.1 grant 12882: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45 wiz 12883: target="_top"><code xmlns="" class=
12884: "filename">graphics/ns-cult3d</code></a> is an example
12885: of this usage.</p>
1.1 grant 12886:
12887: <p>If the download can't be automated, because the user
12888: must submit personal information to apply for a
12889: password, or must pay for the source, or whatever, you
1.14 xtraeme 12890: can set <code class="varname">_FETCH_MESSAGE</code> to
12891: a macro which displays a message explaining the
12892: situation. <code class="varname">_FETCH_MESSAGE</code>
12893: must be executable shell commands, not just a message.
12894: (Generally, it executes <code class=
12895: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 12896: following packages use this: <a xmlns=
12897: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 12898: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45 wiz 12899: target="_top"><code xmlns="" class=
12900: "filename">cad/simian</code></a>, <a xmlns=
1.20 ben 12901: "http://www.w3.org/TR/xhtml1/transitional" href=
12902: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45 wiz 12903: target="_top"><code xmlns="" class=
12904: "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20 ben 12905: "http://www.w3.org/TR/xhtml1/transitional" href=
12906: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45 wiz 12907: target="_top"><code xmlns="" class=
12908: "filename">emulators/vmware-module</code></a>,
12909: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12910: href=
1.20 ben 12911: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45 wiz 12912: target="_top"><code xmlns="" class=
12913: "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20 ben 12914: "http://www.w3.org/TR/xhtml1/transitional" href=
1.43 wiz 12915: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45 wiz 12916: target="_top"><code xmlns="" class=
12917: "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43 wiz 12918: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 12919: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45 wiz 12920: target="_top"><code xmlns="" class=
12921: "filename">sysutils/storage-manager</code></a>,
12922: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12923: href=
1.20 ben 12924: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45 wiz 12925: target="_top"><code xmlns="" class=
12926: "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20 ben 12927: "http://www.w3.org/TR/xhtml1/transitional" href=
12928: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45 wiz 12929: target="_top"><code xmlns="" class=
12930: "filename">www/openacs</code></a>. Try to be consistent
1.20 ben 12931: with them.</p>
1.1 grant 12932: </div>
12933:
1.67 hubertf 12934: <div class="sect2" lang="en">
1.1 grant 12935: <div class="titlepage">
12936: <div>
12937: <div>
1.30 wiz 12938: <h3 class="title"><a name=
1.68 ! rillig 12939: "modified-distfiles-same-name"></a>16.2.2. How
1.30 wiz 12940: to handle modified distfiles with the 'old'
12941: name</h3>
1.1 grant 12942: </div>
12943: </div>
12944: </div>
12945:
12946: <p>Sometimes authors of a software package make some
12947: modifications after the software was released, and they
12948: put up a new distfile without changing the package's
12949: version number. If a package is already in pkgsrc at
1.32 wiz 12950: that time, the checksum will no longer match. The
12951: contents of the new distfile should be compared against
12952: the old one before changing anything, to make sure the
12953: distfile was really updated on purpose, and that no
12954: trojan horse or so crept in. Then, the correct way to
12955: work around this is to set <code class=
12956: "varname">DIST_SUBDIR</code> to a unique directory
12957: name, usually based on <code class=
12958: "varname">PKGNAME_NOREV</code>. In case this happens
12959: more often, <code class="varname">PKGNAME</code> can be
1.45 wiz 12960: used (thus including the <code xmlns=
12961: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 12962: "filename">nbX</code> suffix) or a date stamp can be
12963: appended, like <code class=
12964: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45 wiz 12965: forget regenerating the <code xmlns=
12966: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 12967: "filename">distinfo</code> file after that, since it
12968: contains the <code class="varname">DIST_SUBDIR</code>
12969: path in the filenames. Furthermore, a mail to the
12970: package's authors seems appropriate telling them that
12971: changing distfiles after releases without changing the
12972: file names is not good practice.</p>
1.1 grant 12973: </div>
12974: </div>
12975:
1.67 hubertf 12976: <div class="sect1" lang="en">
1.1 grant 12977: <div class="titlepage">
12978: <div>
12979: <div>
12980: <h2 class="title" style="clear: both"><a name=
1.68 ! rillig 12981: "configuration-gotchas"></a>16.3. Configuration
1.1 grant 12982: gotchas</h2>
12983: </div>
12984: </div>
12985: </div>
12986:
1.67 hubertf 12987: <div class="sect2" lang="en">
1.1 grant 12988: <div class="titlepage">
12989: <div>
12990: <div>
1.67 hubertf 12991: <h3 class="title"><a name=
1.68 ! rillig 12992: "fixes.libtool"></a>16.3.1. Shared libraries
1.1 grant 12993: - libtool</h3>
12994: </div>
12995: </div>
12996: </div>
12997:
12998: <p>pkgsrc supports many different machines, with
12999: different object formats like a.out and ELF, and
13000: varying abilities to do shared library and dynamic
13001: loading at all. To accompany this, varying commands and
13002: options have to be passed to the compiler, linker, etc.
13003: to get the Right Thing, which can be pretty annoying
13004: especially if you don't have all the machines at your
13005: hand to test things. The <a xmlns=
13006: "http://www.w3.org/TR/xhtml1/transitional" href=
13007: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45 wiz 13008: target="_top"><code xmlns="" class=
13009: "filename">devel/libtool</code></a> pkg can help here,
13010: as it just “<span class=
13011: "quote">knows</span>” how to build both static
13012: and dynamic libraries from a set of source files, thus
1.47 reed 13013: being platform-independent.</p>
1.1 grant 13014:
13015: <p>Here's how to use libtool in a pkg in seven simple
13016: steps:</p>
13017:
13018: <div class="orderedlist">
13019: <ol type="1">
13020: <li>
1.14 xtraeme 13021: <p>Add <code class=
13022: "varname">USE_LIBTOOL=yes</code> to the package
13023: Makefile.</p>
1.1 grant 13024: </li>
13025:
13026: <li>
13027: <p>For library objects, use “<span class=
13028: "quote">${LIBTOOL} --mode=compile
13029: ${CC}</span>” in place of
13030: “<span class="quote">${CC}</span>”.
13031: You could even add it to the definition of
1.14 xtraeme 13032: <code class="varname">CC</code>, if only
13033: libraries are being built in a given Makefile.
13034: This one command will build both PIC and non-PIC
13035: library objects, so you need not have separate
13036: shared and non-shared library rules.</p>
1.1 grant 13037: </li>
13038:
13039: <li>
13040: <p>For the linking of the library, remove any
13041: “<span class="quote">ar</span>”,
13042: “<span class="quote">ranlib</span>”,
13043: and “<span class="quote">ld
13044: -Bshareable</span>” commands, and instead
13045: use:</p>
13046: <pre class="programlisting">
1.51 rillig 13047: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
13048: -rpath ${PREFIX}/lib -version-info major:minor
1.1 grant 13049: </pre>
13050:
13051: <p>Note that the library is changed to have a
1.45 wiz 13052: <code xmlns=
13053: "http://www.w3.org/TR/xhtml1/transitional" class=
13054: "filename">.la</code> extension, and the objects
13055: are changed to have a <code xmlns=
13056: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13057: "filename">.lo</code> extension. Change
13058: <code class="varname">OBJS</code> as necessary.
13059: This automatically creates all of the
1.45 wiz 13060: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13061: class="filename">.a</code>, <code xmlns=
13062: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13063: "filename">.so.major.minor</code>, and ELF
13064: symlinks (if necessary) in the build directory.
13065: Be sure to include “<span class=
1.1 grant 13066: "quote">-version-info</span>”, especially
13067: when major and minor are zero, as libtool will
13068: otherwise strip off the shared library
13069: version.</p>
13070:
13071: <p>From the libtool manual:</p>
13072: <pre class="programlisting">
1.51 rillig 13073: So, libtool library versions are described by three integers:
1.1 grant 13074:
1.51 rillig 13075: CURRENT
13076: The most recent interface number that this library implements.
1.1 grant 13077:
1.51 rillig 13078: REVISION
13079: The implementation number of the CURRENT interface.
1.1 grant 13080:
1.51 rillig 13081: AGE
13082: The difference between the newest and oldest interfaces that
13083: this library implements. In other words, the library implements
13084: all the interface numbers in the range from number `CURRENT -
13085: AGE' to `CURRENT'.
1.68 ! rillig 13086:
1.51 rillig 13087: If two libraries have identical CURRENT and AGE numbers, then the
13088: dynamic linker chooses the library with the greater REVISION number.
1.1 grant 13089: </pre>
13090:
13091: <p>The “<span class=
13092: "quote">-release</span>” option will
13093: produce different results for a.out and ELF
13094: (excluding symlinks) in only one case. An ELF
13095: library of the form “<span class=
13096: "quote">libfoo-release.so.<span class=
13097: "emphasis"><em>x</em></span>.<span class=
13098: "emphasis"><em>y</em></span></span>” will
13099: have a symlink of “<span class=
13100: "quote">libfoo.so.<span class=
13101: "emphasis"><em>x</em></span>.<span class=
13102: "emphasis"><em>y</em></span></span>” on an
13103: a.out platform. This is handled
13104: automatically.</p>
13105:
13106: <p>The “<span class="quote">-rpath
13107: argument</span>” is the install directory
13108: of the library being built.</p>
13109:
1.45 wiz 13110: <p>In the <code xmlns=
13111: "http://www.w3.org/TR/xhtml1/transitional" class=
13112: "filename">PLIST</code>, include only the
13113: <code xmlns=
13114: "http://www.w3.org/TR/xhtml1/transitional" class=
1.19 hubertf 13115: "filename">.la</code> file, the other files will
13116: be added automatically.</p>
1.1 grant 13117: </li>
13118:
13119: <li>
1.45 wiz 13120: <p>When linking shared object (<code xmlns=
13121: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13122: "filename">.so</code>) files, i.e. files that are
1.24 wiz 13123: loaded via <a href=
13124: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
13125: <span class="citerefentry"><span class=
13126: "refentrytitle">dlopen</span>(3)</span></a>, NOT
13127: shared libraries, use “<span class=
13128: "quote">-module -avoid-version</span>” to
13129: prevent them getting version tacked on.</p>
1.1 grant 13130:
1.45 wiz 13131: <p>The <code xmlns=
13132: "http://www.w3.org/TR/xhtml1/transitional" class=
13133: "filename">PLIST</code> file gets the
13134: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13135: class="filename">foo.so</code> entry.</p>
1.1 grant 13136: </li>
13137:
13138: <li>
13139: <p>When linking programs that depend on these
13140: libraries <span class=
13141: "emphasis"><em>before</em></span> they are
13142: installed, preface the <a href=
13143: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
13144: <span class="citerefentry"><span class=
13145: "refentrytitle">cc</span>(1)</span></a> or
13146: <a href=
13147: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
13148: <span class="citerefentry"><span class=
13149: "refentrytitle">ld</span>(1)</span></a> line with
13150: “<span class="quote">${LIBTOOL}
13151: --mode=link</span>”, and it will find the
13152: correct libraries (static or shared), but please
13153: be aware that libtool will not allow you to
13154: specify a relative path in -L (such as
13155: “<span class=
13156: "quote">-L../somelib</span>”), because it
13157: expects you to change that argument to be the
1.45 wiz 13158: <code xmlns=
13159: "http://www.w3.org/TR/xhtml1/transitional" class=
13160: "filename">.la</code> file. e.g.</p>
1.1 grant 13161: <pre class="programlisting">
1.51 rillig 13162: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1 grant 13163: </pre>
13164:
13165: <p>should be changed to:</p>
13166: <pre class="programlisting">
1.51 rillig 13167: ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14 xtraeme 13168: "replaceable"><code>someprog</code></em> <em class=
13169: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 13170: </pre>
13171:
13172: <p>and it will do the right thing with the
13173: libraries.</p>
13174: </li>
13175:
13176: <li>
13177: <p>When installing libraries, preface the
13178: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
13179: <span class="citerefentry"><span class=
13180: "refentrytitle">install</span>(1)</span></a> or
13181: <a href=
13182: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
13183: <span class="citerefentry"><span class=
13184: "refentrytitle">cp</span>(1)</span></a> command
13185: with “<span class="quote">${LIBTOOL}
13186: --mode=install</span>”, and change the
1.45 wiz 13187: library name to <code xmlns=
13188: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13189: "filename">.la</code>. e.g.</p>
1.1 grant 13190: <pre class="programlisting">
1.51 rillig 13191: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 grant 13192: </pre>
13193:
1.45 wiz 13194: <p>This will install the static <code xmlns=
13195: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13196: "filename">.a</code>, shared library, any needed
1.1 grant 13197: symlinks, and run <a href=
13198: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
13199: <span class="citerefentry"><span class=
13200: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
13201: </li>
13202:
13203: <li>
1.45 wiz 13204: <p>In your <code xmlns=
13205: "http://www.w3.org/TR/xhtml1/transitional" class=
13206: "filename">PLIST</code>, include only the
13207: <code xmlns=
13208: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 13209: "filename">.la</code> file (this is a change from
13210: previous behaviour).</p>
1.1 grant 13211: </li>
13212: </ol>
13213: </div>
13214: </div>
13215:
1.67 hubertf 13216: <div class="sect2" lang="en">
1.1 grant 13217: <div class="titlepage">
13218: <div>
13219: <div>
1.67 hubertf 13220: <h3 class="title"><a name=
1.68 ! rillig 13221: "using-libtool"></a>16.3.2. Using libtool on
1.30 wiz 13222: GNU packages that already support libtool</h3>
1.1 grant 13223: </div>
13224: </div>
13225: </div>
13226:
1.14 xtraeme 13227: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
13228: the package Makefile. This will override the package's
13229: own libtool in most cases. For older libtool using
1.1 grant 13230: packages, libtool is made by ltconfig script during the
13231: do-configure step; you can check the libtool script
1.14 xtraeme 13232: location by doing <span><strong class="command">make
13233: configure; find work*/ -name
13234: libtool</strong></span>.</p>
13235:
13236: <p><code class="varname">LIBTOOL_OVERRIDE</code>
13237: specifies which libtool scripts, relative to
13238: <code class="varname">WRKSRC</code>, to override. By
13239: default, it is set to “<span class=
13240: "quote">libtool */libtool */*/libtool</span>”. If
13241: this does not match the location of the package's
13242: libtool script(s), set it as appropriate.</p>
1.13 hubertf 13243:
1.45 wiz 13244: <p>If you do not need <code xmlns=
13245: "http://www.w3.org/TR/xhtml1/transitional" class=
13246: "filename">*.a</code> static libraries built and
13247: installed, then use <code class=
13248: "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1 grant 13249:
1.47 reed 13250: <p>If your package makes use of the
13251: platform-independent library for loading dynamic shared
13252: objects, that comes with libtool (libltdl), you should
13253: include devel/libltdl/buildlink3.mk.</p>
1.1 grant 13254:
13255: <p>Some packages use libtool incorrectly so that the
13256: package may not work or build in some circumstances.
13257: Some of the more common errors are:</p>
13258:
13259: <div class="itemizedlist">
13260: <ul type="disc">
13261: <li>
13262: <p>The inclusion of a shared object (-module) as
13263: a dependent library in an executable or library.
13264: This in itself isn't a problem if one of two
13265: things has been done:</p>
13266:
13267: <div class="orderedlist">
13268: <ol type="1">
13269: <li>
13270: <p>The shared object is named correctly,
1.45 wiz 13271: i.e. <code xmlns=
13272: "http://www.w3.org/TR/xhtml1/transitional"
13273: class="filename">libfoo.la</code>, not
13274: <code xmlns=
13275: "http://www.w3.org/TR/xhtml1/transitional"
13276: class="filename">foo.la</code></p>
1.1 grant 13277: </li>
13278:
13279: <li>
13280: <p>The -dlopen option is used when linking
13281: an executable.</p>
13282: </li>
13283: </ol>
13284: </div>
13285: </li>
13286:
13287: <li>
13288: <p>The use of libltdl without the correct calls
13289: to initialisation routines. The function
13290: lt_dlinit() should be called and the macro
1.14 xtraeme 13291: <code class=
13292: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 13293: included in executables.</p>
13294: </li>
13295: </ul>
13296: </div>
13297: </div>
13298:
1.67 hubertf 13299: <div class="sect2" lang="en">
1.1 grant 13300: <div class="titlepage">
13301: <div>
13302: <div>
1.67 hubertf 13303: <h3 class="title"><a name=
1.68 ! rillig 13304: "autoconf-automake"></a>16.3.3. GNU
1.1 grant 13305: Autoconf/Automake</h3>
13306: </div>
13307: </div>
13308: </div>
13309:
13310: <p>If a package needs GNU autoconf or automake to be
13311: executed to regenerate the configure script and
13312: Makefile.in makefile templates, then they should be
1.35 jmmv 13313: executed in a pre-configure target.</p>
1.1 grant 13314:
13315: <p>For packages that need only autoconf:</p>
13316: <pre class="programlisting">
1.51 rillig 13317: AUTOCONF_REQD= 2.50 # if default version is not good enough
13318: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
13319: ...
1.1 grant 13320:
1.51 rillig 13321: pre-configure:
13322: cd ${WRKSRC}; autoconf
1.1 grant 13323:
1.51 rillig 13324: ...
1.1 grant 13325: </pre>
13326:
13327: <p>and for packages that need automake and
13328: autoconf:</p>
13329: <pre class="programlisting">
1.51 rillig 13330: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
13331: USE_TOOLS+= automake # use "automake14" for automake-1.4
13332: ...
1.1 grant 13333:
1.51 rillig 13334: pre-configure:
13335: cd ${WRKSRC}; \
13336: aclocal; autoheader; \
13337: automake -a --foreign -i; autoconf
13338:
13339: ...
1.1 grant 13340: </pre>
13341:
13342: <p>Packages which use GNU Automake will almost
1.35 jmmv 13343: certainly require GNU Make.</p>
1.1 grant 13344:
13345: <p>There are times when the configure process makes
13346: additional changes to the generated files, which then
13347: causes the build process to try to re-execute the
13348: automake sequence. This is prevented by touching
13349: various files in the configure stage. If this causes
1.14 xtraeme 13350: problems with your package you can set <code class=
13351: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 13352: Makefile.</p>
13353: </div>
13354: </div>
13355:
1.67 hubertf 13356: <div class="sect1" lang="en">
1.1 grant 13357: <div class="titlepage">
13358: <div>
13359: <div>
13360: <h2 class="title" style="clear: both"><a name=
1.68 ! rillig 13361: "fixes-build"></a>16.4. Building the
1.55 rillig 13362: package</h2>
1.1 grant 13363: </div>
13364: </div>
13365: </div>
13366:
1.67 hubertf 13367: <div class="sect2" lang="en">
1.1 grant 13368: <div class="titlepage">
13369: <div>
13370: <div>
1.67 hubertf 13371: <h3 class="title"><a name=
1.68 ! rillig 13372: "cpp-defines"></a>16.4.1. CPP defines</h3>
1.1 grant 13373: </div>
13374: </div>
13375: </div>
13376:
1.55 rillig 13377: <p>Sometimes you need to compile different code
13378: depending on the target platform. The C preprocessor
13379: has a set of predefined macros that can be queried by
13380: using <code class="varname">#ifdef FOO</code> or
13381: <code class="varname">#if defined(FOO)</code>. Among
13382: these macros are usually ones that describe the target
13383: CPU and operating system. Depending of which of the
13384: macros are defined, you can write code that uses
1.61 rillig 13385: features unique to a specific platform. Generally you
13386: should rather use the GNU autotools (automake,
13387: autoconf, etc.) to check for specific features (like
13388: the existence of a header file, a function or a
13389: library), but sometimes this is not possible or
13390: desired.</p>
13391:
13392: <p>In that case you can use the predefined macros below
13393: to configure your code to the platform it runs on.
13394: Almost every operating system, hardware architecture
13395: and compiler has its own macro. For example, if the
13396: macros <code class="varname">__GNUC__</code>,
13397: <code class="varname">__i386__</code> and <code class=
1.55 rillig 13398: "varname">__NetBSD__</code> are all defined, you know
1.61 rillig 13399: that you are using NetBSD on an i386 compatible CPU,
13400: and your compiler is GCC.</p>
1.55 rillig 13401:
1.67 hubertf 13402: <div class="sect3" lang="en">
1.55 rillig 13403: <div class="titlepage">
13404: <div>
13405: <div>
13406: <h4 class="title"><a name=
1.68 ! rillig 13407: "fixes-build-cpp-opsys"></a>16.4.1.1. CPP
1.55 rillig 13408: defines for operating systems</h4>
13409: </div>
13410: </div>
13411: </div>
13412:
13413: <p>To distinguish between 4.4 BSD-derived systems and
13414: the rest of the world, you should use the following
13415: code.</p>
13416: <pre class="programlisting">
1.51 rillig 13417: #include <sys/param.h>
1.55 rillig 13418: #if (defined(BSD) && BSD >= 199306)
1.60 rillig 13419: /* BSD-specific code goes here */
1.55 rillig 13420: #else
1.60 rillig 13421: /* non-BSD-specific code goes here */
1.55 rillig 13422: #endif
1.1 grant 13423: </pre>
13424:
1.55 rillig 13425: <p>If this distinction is not fine enough, you can
13426: also use the following defines.</p>
13427: <pre class="programlisting">
13428: FreeBSD __FreeBSD__
1.56 rillig 13429: DragonFly __DragonFly__
1.57 minskim 13430: Interix __INTERIX
1.55 rillig 13431: Linux linux, __linux, __linux__
13432: NetBSD __NetBSD__
13433: OpenBSD __OpenBSD__
1.60 rillig 13434: Solaris sun, __sun
1.1 grant 13435: </pre>
1.55 rillig 13436: </div>
1.1 grant 13437:
1.67 hubertf 13438: <div class="sect3" lang="en">
1.55 rillig 13439: <div class="titlepage">
13440: <div>
13441: <div>
1.67 hubertf 13442: <h4 class="title"><a name=
1.68 ! rillig 13443: "fixes-build-cpp-cpu"></a>16.4.1.2. CPP
1.55 rillig 13444: defines for CPUs</h4>
13445: </div>
13446: </div>
13447: </div>
13448: <pre class="programlisting">
13449: i386 i386, __i386, __i386__
13450: MIPS __mips
13451: SPARC sparc, __sparc
13452: </pre>
13453: </div>
13454:
1.67 hubertf 13455: <div class="sect3" lang="en">
1.55 rillig 13456: <div class="titlepage">
13457: <div>
13458: <div>
13459: <h4 class="title"><a name=
1.68 ! rillig 13460: "fixes-build-cpp-compiler"></a>16.4.1.3. CPP
1.55 rillig 13461: defines for compilers</h4>
13462: </div>
13463: </div>
13464: </div>
13465: <pre class="programlisting">
13466: GCC __GNUC__ (major version), __GNUC_MINOR__
1.60 rillig 13467: SunPro __SUNPRO_C (0x570 for version 5.7)
1.55 rillig 13468: </pre>
13469: </div>
1.1 grant 13470: </div>
1.51 rillig 13471:
1.67 hubertf 13472: <div class="sect2" lang="en">
1.51 rillig 13473: <div class="titlepage">
13474: <div>
13475: <div>
1.67 hubertf 13476: <h3 class="title"><a name=
1.68 ! rillig 13477: "cpp-list-examples"></a>16.4.2. Examples of
1.60 rillig 13478: CPP defines for some platforms</h3>
13479: </div>
13480: </div>
13481: </div>
13482:
13483: <p>The list of the CPP identification macros for
13484: hardware and operating system may depend on the
13485: compiler that is used. The following list contains some
13486: examples that may help you to choose the right ones.
13487: For example, if you want to conditionally compile code
13488: on Solaris, don't use <code class=
13489: "varname">__sun__</code>, as the SunPro compiler does
13490: not define it. Use <code class="varname">__sun</code>
13491: instead.</p>
13492:
13493: <div class="variablelist">
13494: <dl>
1.61 rillig 13495: <dt><span class="term">GCC 3.3.3 + SuSE Linux 9.1 +
13496: i386</span></dt>
13497:
13498: <dd>
1.62 rillig 13499: <p>__ELF__, __gnu_linux__, __i386, __i386__,
1.61 rillig 13500: __linux, __linux__, __unix, __unix__, i386,
13501: linux, unix.</p>
13502: </dd>
13503:
13504: <dt><span class="term">GCC 2.95 + NetBSD 1.6.2 +
13505: i386</span></dt>
13506:
13507: <dd>
1.62 rillig 13508: <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61 rillig 13509: i386.</p>
13510: </dd>
13511:
13512: <dt><span class="term">GCC 3.3.3 + NetBSD 2.0 +
13513: i386</span></dt>
1.60 rillig 13514:
13515: <dd>
1.62 rillig 13516: <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61 rillig 13517: i386.</p>
1.60 rillig 13518: </dd>
13519:
13520: <dt><span class="term">GCC 4 + Solaris 8 +
13521: SPARC</span></dt>
13522:
13523: <dd>
13524: <p>__ELF__, __sparc, __sparc__, __sun, __sun__,
13525: __SVR4, __svr4__, __unix, __unix__, sparc, sun,
13526: unix.</p>
13527: </dd>
1.61 rillig 13528:
13529: <dt><span class="term">SunPro 5.7 + Solaris 8 +
13530: SPARC</span></dt>
13531:
13532: <dd>
13533: <p>__SVR4, __sparc, __sun, __unix, sparc, sun,
13534: unix.</p>
13535: </dd>
1.60 rillig 13536: </dl>
13537: </div>
13538: </div>
13539:
1.67 hubertf 13540: <div class="sect2" lang="en">
1.60 rillig 13541: <div class="titlepage">
13542: <div>
13543: <div>
1.67 hubertf 13544: <h3 class="title"><a name=
1.68 ! rillig 13545: "cpp-list"></a>16.4.3. Getting a list of CPP
1.51 rillig 13546: defines</h3>
13547: </div>
13548: </div>
13549: </div>
13550:
1.60 rillig 13551: <p>If your system uses the GNU C Compiler, you can get
13552: a list of symbols that are defined by default, e.g. to
13553: identify the platform, with the following command:</p>
1.51 rillig 13554: <pre class="programlisting">
13555: gcc -E -dM - < /dev/null
13556: </pre>
1.60 rillig 13557:
13558: <p>On other systems you may get the list by using the
13559: system's syscall trace utility (ktrace, truss, strace)
13560: to have a look which arguments are passed to the actual
13561: compiler.</p>
1.51 rillig 13562: </div>
1.1 grant 13563: </div>
13564:
1.67 hubertf 13565: <div class="sect1" lang="en">
1.1 grant 13566: <div class="titlepage">
13567: <div>
13568: <div>
13569: <h2 class="title" style="clear: both"><a name=
1.68 ! rillig 13570: "package-specific-actions"></a>16.5. Package
1.1 grant 13571: specific actions</h2>
13572: </div>
13573: </div>
13574: </div>
13575:
1.67 hubertf 13576: <div class="sect2" lang="en">
1.1 grant 13577: <div class="titlepage">
13578: <div>
13579: <div>
1.67 hubertf 13580: <h3 class="title"><a name=
1.68 ! rillig 13581: "user-interaction"></a>16.5.1. User
1.2 hubertf 13582: interaction</h3>
1.1 grant 13583: </div>
13584: </div>
13585: </div>
13586:
13587: <p>Occasionally, packages require interaction from the
13588: user, and this can be in a number of ways:</p>
13589:
13590: <div class="itemizedlist">
13591: <ul type="disc">
13592: <li>
13593: <p>help in fetching the distfiles</p>
13594: </li>
13595:
13596: <li>
13597: <p>help to configure the package before it is
13598: built</p>
13599: </li>
13600:
13601: <li>
13602: <p>help during the build process</p>
13603: </li>
13604:
13605: <li>
13606: <p>help during the installation of a package</p>
13607: </li>
13608: </ul>
13609: </div>
13610:
1.14 xtraeme 13611: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 13612: definition is provided to notify the pkgsrc mechanism
13613: of an interactive stage which will be needed, and this
1.45 wiz 13614: should be set in the package's <code xmlns=
13615: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 13616: "filename">Makefile</code>, e.g.:</p>
1.1 grant 13617: <pre class="programlisting">
1.51 rillig 13618: INTERACTIVE_STAGE= build
1.1 grant 13619: </pre>
13620:
13621: <p>Multiple interactive stages can be specified:</p>
13622: <pre class="programlisting">
1.51 rillig 13623: INTERACTIVE_STAGE= configure install
1.1 grant 13624: </pre>
13625: </div>
13626:
1.67 hubertf 13627: <div class="sect2" lang="en">
1.1 grant 13628: <div class="titlepage">
13629: <div>
13630: <div>
1.67 hubertf 13631: <h3 class="title"><a name=
1.68 ! rillig 13632: "handling-licenses"></a>16.5.2. Handling
1.1 grant 13633: licenses</h3>
13634: </div>
13635: </div>
13636: </div>
13637:
1.44 gdt 13638: <p>A package may be covered by a license which the user
13639: has or has not agreed to accept. For these cases,
13640: pkgsrc contains a mechanism to note that a package is
13641: covered by a particular license, and the package cannot
13642: be built unless the user has accepted the license.
13643: (Installation of binary packages are not currently
13644: subject to this mechanism.) Packages with licenses that
13645: are either Open Source according to the Open Source
13646: Initiative or Free according to the Free Software
13647: Foundation will not be marked with a license tag.
13648: Packages with licenses that have not been determined to
13649: meet either definition will be marked with a license
13650: tag referring to the license. This will prevent
13651: building unless pkgsrc is informed that the license is
13652: acceptable, and enables displaying the license.</p>
13653:
13654: <p>The license tag mechanism is intended to address
13655: copyright-related issues surrounding building,
13656: installing and using a package, and not to address
13657: redistribution issues (see <code class=
13658: "varname">RESTRICTED</code> and <code class=
13659: "varname">NO_SRC_ON_FTP</code>, etc.). However, the
13660: above definition of licenses for which tags are not
13661: needed implies that packages with redistribution
13662: restrictions should have tags.</p>
13663:
13664: <p>Denoting that a package is covered by a particular
1.45 wiz 13665: license is done by placing the license in <code xmlns=
13666: "http://www.w3.org/TR/xhtml1/transitional" class=
1.44 gdt 13667: "filename">pkgsrc/licenses</code> and setting the
13668: <code class="varname">LICENSE</code> variable to a
13669: string identifying the license, e.g. in <a xmlns=
1.14 xtraeme 13670: "http://www.w3.org/TR/xhtml1/transitional" href=
1.44 gdt 13671: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45 wiz 13672: target="_top"><code xmlns="" class=
13673: "filename">graphics/xv</code></a>:</p>
1.1 grant 13674: <pre class="programlisting">
1.51 rillig 13675: LICENSE= xv-license
1.1 grant 13676: </pre>
13677:
13678: <p>When trying to build, the user will get a notice
1.44 gdt 13679: that the package is covered by a license which has not
13680: been accepted:</p>
1.1 grant 13681: <pre class="programlisting">
1.51 rillig 13682: <code class="prompt">%</code> <strong class=
1.14 xtraeme 13683: "userinput"><code>make</code></strong>
1.51 rillig 13684: ===> xv-3.10anb9 has an unacceptable license: xv-license.
13685: ===> To view the license, enter "/usr/bin/make show-license".
13686: ===> To indicate acceptance, add this line to your /etc/mk.conf:
13687: ===> ACCEPTABLE_LICENSES+=xv-license
13688: *** Error code 1
1.1 grant 13689: </pre>
13690:
1.14 xtraeme 13691: <p>The license can be viewed with <span><strong class=
13692: "command">make show-license</strong></span>, and if it
13693: is considered appropriate, the line printed above can
1.45 wiz 13694: be added to <code xmlns=
13695: "http://www.w3.org/TR/xhtml1/transitional" class=
13696: "filename">/etc/mk.conf</code> to indicate acceptance
13697: of the particular license:</p>
1.1 grant 13698: <pre class="programlisting">
1.51 rillig 13699: ACCEPTABLE_LICENSES+=xv-license
1.1 grant 13700: </pre>
13701:
13702: <p>When adding a package with a new license, the
1.45 wiz 13703: license text should be added to <code xmlns=
13704: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13705: "filename">pkgsrc/licenses</code> for displaying. A
13706: list of known licenses can be seen in this directory as
13707: well as by looking at the list of (commented out)
13708: <code class="varname">ACCEPTABLE_LICENSES</code>
1.45 wiz 13709: variable settings in <code xmlns=
13710: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13711: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 13712:
1.44 gdt 13713: <p>The use of <code class=
13714: "varname">LICENSE=shareware</code>, <code class=
13715: "varname">LICENSE=no-commercial-use</code>, and similar
13716: language is deprecated because it does not crisply
13717: refer to a particular license text. Another problem
13718: with such usage is that it does not enable a user to
13719: denote acceptance of the license for a single package
13720: without accepting the same license text for another
13721: package. In particular, this can be inappropriate when
13722: e.g. one accepts a particular license to indicate to
13723: pkgsrc that a fee has been paid.</p>
1.1 grant 13724: </div>
13725:
1.67 hubertf 13726: <div class="sect2" lang="en">
1.1 grant 13727: <div class="titlepage">
13728: <div>
13729: <div>
1.30 wiz 13730: <h3 class="title"><a name=
1.68 ! rillig 13731: "installing-score-files"></a>16.5.3. Installing
1.30 wiz 13732: score files</h3>
1.1 grant 13733: </div>
13734: </div>
13735: </div>
13736:
13737: <p>Certain packages, most of them in the games
13738: category, install a score file that allows all users on
13739: the system to record their highscores. In order for
13740: this to work, the binaries need to be installed setgid
13741: and the score files owned by the appropriate group
13742: and/or owner (traditionally the "games" user/group).
13743: The following variables, documented in more detail in
1.45 wiz 13744: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13745: class="filename">mk/defaults/mk.conf</code>, control
13746: this behaviour: <code class=
1.14 xtraeme 13747: "varname">SETGIDGAME</code>, <code class=
13748: "varname">GAMEDATAMODE</code>, <code class=
13749: "varname">GAMEGRP</code>, <code class=
13750: "varname">GAMEMODE</code>, <code class=
13751: "varname">GAMEOWN</code>.</p>
1.1 grant 13752:
13753: <p>Note that per default, setgid installation of games
1.14 xtraeme 13754: is disabled; setting <code class=
13755: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 13756: variables accordingly.</p>
13757:
13758: <p>A package should therefor never hard code file
1.14 xtraeme 13759: ownership or access permissions but rely on
13760: <code class="varname">INSTALL_GAME</code> and
13761: <code class="varname">INSTALL_GAME_DATA</code> to set
13762: these correctly.</p>
1.1 grant 13763: </div>
13764:
1.67 hubertf 13765: <div class="sect2" lang="en">
1.1 grant 13766: <div class="titlepage">
13767: <div>
13768: <div>
1.67 hubertf 13769: <h3 class="title"><a name=
1.68 ! rillig 13770: "perl-scripts"></a>16.5.4. Packages
1.30 wiz 13771: containing perl scripts</h3>
1.1 grant 13772: </div>
13773: </div>
13774: </div>
13775:
13776: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 13777: set <code class="varname">REPLACE_PERL</code> to ensure
13778: that the proper interpreter path is set. <code class=
13779: "varname">REPLACE_PERL</code> should contain a list of
13780: scripts, relative to <code class=
13781: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 13782: </div>
13783:
1.67 hubertf 13784: <div class="sect2" lang="en">
1.1 grant 13785: <div class="titlepage">
13786: <div>
13787: <div>
1.67 hubertf 13788: <h3 class="title"><a name=
1.68 ! rillig 13789: "hardcoded-paths"></a>16.5.5. Packages with
1.1 grant 13790: hardcoded paths to other interpreters</h3>
13791: </div>
13792: </div>
13793: </div>
13794:
13795: <p>Your package may also contain scripts with hardcoded
13796: paths to other interpreters besides (or as well as)
13797: perl. To correct the full pathname to the script
13798: interpreter, you need to set the following definitions
1.45 wiz 13799: in your <code xmlns=
13800: "http://www.w3.org/TR/xhtml1/transitional" class=
13801: "filename">Makefile</code> (we shall use
13802: <span><strong class="command">tclsh</strong></span> in
13803: this example):</p>
1.1 grant 13804: <pre class="programlisting">
1.51 rillig 13805: REPLACE_INTERPRETER+= tcl
13806: _REPLACE.tcl.old= .*/bin/tclsh
13807: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
13808: _REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
13809: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1 grant 13810: </pre>
13811: </div>
13812:
1.67 hubertf 13813: <div class="sect2" lang="en">
1.1 grant 13814: <div class="titlepage">
13815: <div>
13816: <div>
1.67 hubertf 13817: <h3 class="title"><a name=
1.68 ! rillig 13818: "perl-modules"></a>16.5.6. Packages
1.30 wiz 13819: installing perl modules</h3>
1.1 grant 13820: </div>
13821: </div>
13822: </div>
13823:
13824: <p>Makefiles of packages providing perl5 modules should
1.45 wiz 13825: include the Makefile fragment <code xmlns=
13826: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13827: "filename">../../lang/perl5/module.mk</code>. It
13828: provides a <span><strong class=
13829: "command">do-configure</strong></span> target for the
13830: standard perl configuration for such modules as well as
13831: various hooks to tune this configuration. See comments
13832: in this file for details.</p>
1.1 grant 13833:
13834: <p>Perl5 modules will install into different places
13835: depending on the version of perl used during the build
13836: process. To address this, pkgsrc will append lines to
1.45 wiz 13837: the <code xmlns=
13838: "http://www.w3.org/TR/xhtml1/transitional" class=
13839: "filename">PLIST</code> corresponding to the files
13840: listed in the installed <code xmlns=
13841: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13842: "filename">.packlist</code> file generated by most
13843: perl5 modules. This is invoked by defining <code class=
13844: "varname">PERL5_PACKLIST</code> to a space-separated
13845: list of paths to packlist files, e.g.:</p>
1.1 grant 13846: <pre class="programlisting">
1.51 rillig 13847: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1 grant 13848: </pre>
13849:
1.14 xtraeme 13850: <p>The variables <code class=
13851: "varname">PERL5_SITELIB</code>, <code class=
13852: "varname">PERL5_SITEARCH</code>, and <code class=
13853: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 13854: locations in which perl5 modules may be installed, and
13855: may be used by perl5 packages that don't have a
13856: packlist. These three variables are also substituted
1.45 wiz 13857: for in the <code xmlns=
13858: "http://www.w3.org/TR/xhtml1/transitional" class=
13859: "filename">PLIST</code>.</p>
1.1 grant 13860: </div>
13861:
1.67 hubertf 13862: <div class="sect2" lang="en">
1.1 grant 13863: <div class="titlepage">
13864: <div>
13865: <div>
1.67 hubertf 13866: <h3 class="title"><a name=
1.68 ! rillig 13867: "faq.info-files"></a>16.5.7. Packages
1.1 grant 13868: installing info files</h3>
13869: </div>
13870: </div>
13871: </div>
13872:
13873: <p>Some packages install info files or use the
13874: “<span class="quote">makeinfo</span>” or
13875: “<span class="quote">install-info</span>”
13876: commands. Each of the info files:</p>
13877:
13878: <div class="itemizedlist">
13879: <ul type="disc">
13880: <li>
13881: <p>is considered to be installed in the directory
1.45 wiz 13882: <code xmlns=
13883: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13884: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 13885: </li>
13886:
13887: <li>
13888: <p>is registered in the Info directory file
1.45 wiz 13889: <code xmlns=
13890: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13891: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 13892: </li>
13893:
13894: <li>
13895: <p>and must be listed as a filename in the
1.14 xtraeme 13896: <code class="varname">INFO_FILES</code> variable
13897: in the package Makefile.</p>
1.1 grant 13898: </li>
13899: </ul>
13900: </div>
13901:
1.14 xtraeme 13902: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 13903: “<span class="quote">info</span>” and can
1.45 wiz 13904: be overridden in the package Makefile. <code xmlns=
13905: "http://www.w3.org/TR/xhtml1/transitional" class=
13906: "filename">INSTALL</code> and <code xmlns=
13907: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13908: "filename">DEINSTALL</code> scripts will be generated
13909: to handle registration of the info files in the Info
1.1 grant 13910: directory file. The “<span class=
13911: "quote">install-info</span>” command used for the
13912: info files registration is either provided by the
13913: system, or by a special purpose package automatically
13914: added as dependency if needed.</p>
13915:
13916: <p>A package which needs the “<span class=
13917: "quote">makeinfo</span>” command at build time
1.14 xtraeme 13918: must define the variable <code class=
13919: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 13920: minimum version of the “<span class=
13921: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 13922: should be noted with the <code class=
13923: "varname">TEXINFO_REQD</code> variable in the package
1.45 wiz 13924: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13925: class="filename">Makefile</code>. By default, a minimum
13926: version of 3.12 is required. If the system does not
13927: provide a <span><strong class=
1.14 xtraeme 13928: "command">makeinfo</strong></span> command or if it
13929: does not match the required minimum, a build dependency
13930: on the <a xmlns=
13931: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 13932: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45 wiz 13933: target="_top"><code xmlns="" class=
13934: "filename">devel/gtexinfo</code></a> package will be
1.20 ben 13935: added automatically.</p>
1.1 grant 13936:
13937: <p>The build and installation process of the software
13938: provided by the package should not use the
1.14 xtraeme 13939: <span><strong class=
13940: "command">install-info</strong></span> command as the
13941: registration of info files is the task of the package
1.45 wiz 13942: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13943: class="filename">INSTALL</code> script, and it must use
13944: the appropriate <span><strong class=
1.14 xtraeme 13945: "command">makeinfo</strong></span> command.</p>
1.1 grant 13946:
1.47 reed 13947: <p>To achieve this goal, the pkgsrc infrastructure
1.14 xtraeme 13948: creates overriding scripts for the <span><strong class=
13949: "command">install-info</strong></span> and
13950: <span><strong class="command">makeinfo</strong></span>
13951: commands in a directory listed early in <code class=
13952: "varname">PATH</code>.</p>
1.1 grant 13953:
1.14 xtraeme 13954: <p>The script overriding <span><strong class=
13955: "command">install-info</strong></span> has no effect
13956: except the logging of a message. The script overriding
13957: <span><strong class="command">makeinfo</strong></span>
13958: logs a message and according to the value of
13959: <code class="varname">USE_MAKEINFO</code> and
13960: <code class="varname">TEXINFO_REQD</code> either run
13961: the appropriate <span><strong class=
13962: "command">makeinfo</strong></span> command or exit on
13963: error.</p>
1.1 grant 13964: </div>
13965:
1.67 hubertf 13966: <div class="sect2" lang="en">
1.57 minskim 13967: <div class="titlepage">
13968: <div>
13969: <div>
1.67 hubertf 13970: <h3 class="title"><a name=
1.68 ! rillig 13971: "manpages"></a>16.5.8. Packages installing
1.57 minskim 13972: man pages</h3>
13973: </div>
13974: </div>
13975: </div>
13976:
13977: <p>Many packages install manual pages. The man pages
13978: are installed under <code class=
13979: "varname">${PREFIX}/${PKGMANDIR}</code> which is
13980: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13981: class="filename">/usr/pkg/man</code> by default.
13982: <code class="varname">PKGMANDIR</code> defaults to
13983: “<span class="quote">man</span>”. For
13984: example, you can set <code class=
13985: "varname">PKGMANDIR</code> to “<span class=
13986: "quote">share/man</span>” to have man pages
13987: install under <code xmlns=
13988: "http://www.w3.org/TR/xhtml1/transitional" class=
13989: "filename">/usr/pkg/share/man/</code> by default.</p>
13990:
13991: <div class="note" style=
13992: "margin-left: 0.5in; margin-right: 0.5in;">
13993: <h3 class="title">Note</h3>
13994:
13995: <p>The support for a custom <code class=
13996: "varname">PKGMANDIR</code> is not complete.</p>
13997: </div>
13998:
13999: <p>The <code xmlns=
14000: "http://www.w3.org/TR/xhtml1/transitional" class=
14001: "filename">PLIST</code> files can just use <code xmlns=
14002: "http://www.w3.org/TR/xhtml1/transitional" class=
14003: "filename">man/</code> as the top level directory for
14004: the man page file entries and the pkgsrc framework will
14005: convert as needed.</p>
14006:
14007: <p>Packages that are configured with <code class=
14008: "varname">GNU_CONFIGURE</code> set as
14009: “<span class="quote">yes</span>”, by
14010: default will use the <code xmlns=
14011: "http://www.w3.org/TR/xhtml1/transitional" class=
14012: "filename">./configure</code> --mandir switch to set
14013: where the man pages should be installed. The path is
14014: <code class="varname">GNU_CONFIGURE_MANDIR</code> which
14015: defaults to <code class=
14016: "varname">${PREFIX}/${PKGMANDIR}</code>.</p>
14017:
14018: <p>Packages that use <code class=
14019: "varname">GNU_CONFIGURE</code> but do not use --mandir,
14020: can set <code class=
14021: "varname">CONFIGURE_HAS_MANDIR</code> to
14022: “<span class="quote">no</span>”. Or if the
14023: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14024: class="filename">./configure</code> script uses a
14025: non-standard use of --mandir, you can set <code class=
14026: "varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
14027:
14028: <p>See <a href="#manpage-compression" title=
14029: "10.5. Man page compression">Section 10.5,
14030: “Man page compression”</a> for information
14031: on installation of compressed manual pages.</p>
14032: </div>
14033:
1.67 hubertf 14034: <div class="sect2" lang="en">
1.1 grant 14035: <div class="titlepage">
14036: <div>
14037: <div>
1.67 hubertf 14038: <h3 class="title"><a name=
1.68 ! rillig 14039: "gconf2-data-files"></a>16.5.9. Packages
1.30 wiz 14040: installing GConf2 data files</h3>
1.1 grant 14041: </div>
14042: </div>
14043: </div>
14044:
1.45 wiz 14045: <p>If a package installs <code xmlns=
14046: "http://www.w3.org/TR/xhtml1/transitional" class=
14047: "filename">.schemas</code> or <code xmlns=
14048: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14049: "filename">.entries</code> files, used by GConf2, you
1.1 grant 14050: need to take some extra steps to make sure they get
14051: registered in the database:</p>
14052:
14053: <div class="orderedlist">
14054: <ol type="1">
14055: <li>
1.45 wiz 14056: <p>Include <code xmlns=
14057: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14058: "filename">../../devel/GConf2/schemas.mk</code>
1.45 wiz 14059: instead of its <code xmlns=
14060: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14061: "filename">buildlink3.mk</code> file. This takes
1.1 grant 14062: care of rebuilding the GConf2 database at
14063: installation and deinstallation time, and tells
14064: the package where to install GConf2 data files
14065: using some standard configure arguments. It also
14066: disallows any access to the database directly
14067: from the package.</p>
14068: </li>
14069:
14070: <li>
14071: <p>Ensure that the package installs its
1.45 wiz 14072: <code xmlns=
14073: "http://www.w3.org/TR/xhtml1/transitional" class=
14074: "filename">.schemas</code> files under
14075: <code xmlns=
14076: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14077: "filename">${PREFIX}/share/gconf/schemas</code>.
1.45 wiz 14078: If they get installed under <code xmlns=
14079: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14080: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 14081: manually patch the package.</p>
14082: </li>
14083:
14084: <li>
14085: <p>Check the PLIST and remove any entries under
14086: the etc/gconf directory, as they will be handled
14087: automatically. See <a href="#faq.conf" title=
1.38 dillo 14088: "7.14. How do I change the location of configuration files?">
14089: Section 7.14, “How do I change the
1.35 jmmv 14090: location of configuration files?”</a> for
14091: more information.</p>
1.1 grant 14092: </li>
14093:
14094: <li>
1.14 xtraeme 14095: <p>Define the <code class=
14096: "varname">GCONF2_SCHEMAS</code> variable in your
1.45 wiz 14097: <code xmlns=
14098: "http://www.w3.org/TR/xhtml1/transitional" class=
14099: "filename">Makefile</code> with a list of all
14100: <code xmlns=
14101: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14102: "filename">.schemas</code> files installed by the
14103: package, if any. Names must not contain any
14104: directories in them.</p>
1.1 grant 14105: </li>
14106:
14107: <li>
1.14 xtraeme 14108: <p>Define the <code class=
14109: "varname">GCONF2_ENTRIES</code> variable in your
1.45 wiz 14110: <code xmlns=
14111: "http://www.w3.org/TR/xhtml1/transitional" class=
14112: "filename">Makefile</code> with a list of all
14113: <code xmlns=
14114: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14115: "filename">.entries</code> files installed by the
14116: package, if any. Names must not contain any
14117: directories in them.</p>
1.1 grant 14118: </li>
14119: </ol>
14120: </div>
14121: </div>
14122:
1.67 hubertf 14123: <div class="sect2" lang="en">
1.1 grant 14124: <div class="titlepage">
14125: <div>
14126: <div>
1.30 wiz 14127: <h3 class="title"><a name=
1.68 ! rillig 14128: "scrollkeeper-data-files"></a>16.5.10. Packages
1.30 wiz 14129: installing scrollkeeper data files</h3>
1.1 grant 14130: </div>
14131: </div>
14132: </div>
14133:
1.45 wiz 14134: <p>If a package installs <code xmlns=
14135: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14136: "filename">.omf</code> files, used by scrollkeeper, you
14137: need to take some extra steps to make sure they get
14138: registered in the database:</p>
1.1 grant 14139:
14140: <div class="orderedlist">
14141: <ol type="1">
14142: <li>
1.45 wiz 14143: <p>Include <code xmlns=
14144: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14145: "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45 wiz 14146: instead of its <code xmlns=
14147: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14148: "filename">buildlink3.mk</code> file. This takes
1.1 grant 14149: care of rebuilding the scrollkeeper database at
14150: installation and deinstallation time, and
14151: disallows any access to it directly from the
14152: package.</p>
14153: </li>
14154:
14155: <li>
14156: <p>Check the PLIST and remove any entries under
1.45 wiz 14157: the <code xmlns=
14158: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14159: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 14160: as they will be handled automatically.</p>
14161: </li>
14162:
14163: <li>
1.45 wiz 14164: <p>Remove the <code xmlns=
14165: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14166: "filename">share/omf</code> directory from the
14167: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 14168: </li>
14169: </ol>
14170: </div>
14171: </div>
14172:
1.67 hubertf 14173: <div class="sect2" lang="en">
1.1 grant 14174: <div class="titlepage">
14175: <div>
14176: <div>
1.67 hubertf 14177: <h3 class="title"><a name=
1.68 ! rillig 14178: "x11-fonts"></a>16.5.11. Packages installing
1.1 grant 14179: X11 fonts</h3>
14180: </div>
14181: </div>
14182: </div>
14183:
14184: <p>If a package installs font files, you will need to
14185: rebuild the fonts database in the directory where they
14186: get installed at installation and deinstallation time.
1.65 hubertf 14187: This can be automatically done by using the pkginstall
14188: framework.</p>
1.1 grant 14189:
1.65 hubertf 14190: <p>You can list the directories where fonts are
14191: installed in the <code class=
14192: "varname">FONTS_DIRS.<em class=
14193: "replaceable"><code>type</code></em></code> variables,
14194: where <em class="replaceable"><code>type</code></em>
14195: can be one of “<span class=
14196: "quote">ttf</span>”, “<span class=
14197: "quote">type1</span>” or “<span class=
14198: "quote">x11</span>”. Also make sure that the
14199: database file <code xmlns=
1.45 wiz 14200: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14201: "filename">fonts.dir</code> is not listed in the
1.1 grant 14202: PLIST.</p>
14203:
14204: <p>Note that you should not create new directories for
14205: fonts; instead use the standard ones to avoid that the
14206: user needs to manually configure his X server to find
14207: them.</p>
14208: </div>
14209:
1.67 hubertf 14210: <div class="sect2" lang="en">
1.1 grant 14211: <div class="titlepage">
14212: <div>
14213: <div>
1.67 hubertf 14214: <h3 class="title"><a name=
1.68 ! rillig 14215: "gtk2-modules"></a>16.5.12. Packages
1.30 wiz 14216: installing GTK2 modules</h3>
1.1 grant 14217: </div>
14218: </div>
14219: </div>
14220:
1.47 reed 14221: <p>If a package installs GTK2 immodules or loaders, you
1.1 grant 14222: need to take some extra steps to get them registered in
14223: the GTK2 database properly:</p>
14224:
14225: <div class="orderedlist">
14226: <ol type="1">
14227: <li>
1.45 wiz 14228: <p>Include <code xmlns=
14229: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14230: "filename">../../x11/gtk2/modules.mk</code>
1.45 wiz 14231: instead of its <code xmlns=
14232: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14233: "filename">buildlink3.mk</code> file. This takes
14234: care of rebuilding the database at installation
14235: and deinstallation time.</p>
1.1 grant 14236: </li>
14237:
14238: <li>
1.14 xtraeme 14239: <p>Set <code class=
14240: "varname">GTK2_IMMODULES=YES</code> if your
14241: package installs GTK2 immodules.</p>
1.1 grant 14242: </li>
14243:
14244: <li>
1.14 xtraeme 14245: <p>Set <code class=
14246: "varname">GTK2_LOADERS=YES</code> if your package
14247: installs GTK2 loaders.</p>
1.1 grant 14248: </li>
14249:
14250: <li>
1.47 reed 14251: <p>Patch the package to not touch any of the GTK2
1.1 grant 14252: databases directly. These are:</p>
14253:
14254: <div class="itemizedlist">
14255: <ul type="disc">
14256: <li>
1.45 wiz 14257: <p><code xmlns=
14258: "http://www.w3.org/TR/xhtml1/transitional"
14259: class=
1.14 xtraeme 14260: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 14261: </li>
14262:
14263: <li>
1.45 wiz 14264: <p><code xmlns=
14265: "http://www.w3.org/TR/xhtml1/transitional"
14266: class=
1.14 xtraeme 14267: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 14268: </li>
14269: </ul>
14270: </div>
14271: </li>
14272:
14273: <li>
14274: <p>Check the PLIST and remove any entries under
1.45 wiz 14275: the <code xmlns=
14276: "http://www.w3.org/TR/xhtml1/transitional" class=
14277: "filename">libdata/gtk-2.0</code> directory, as
14278: they will be handled automatically.</p>
1.1 grant 14279: </li>
14280: </ol>
14281: </div>
14282: </div>
14283:
1.67 hubertf 14284: <div class="sect2" lang="en">
1.1 grant 14285: <div class="titlepage">
14286: <div>
14287: <div>
1.67 hubertf 14288: <h3 class="title"><a name=
1.68 ! rillig 14289: "sgml-xml-data"></a>16.5.13. Packages
1.30 wiz 14290: installing SGML or XML data</h3>
1.1 grant 14291: </div>
14292: </div>
14293: </div>
14294:
14295: <p>If a package installs SGML or XML data files that
14296: need to be registered in system-wide catalogs (like
14297: DTDs, sub-catalogs, etc.), you need to take some extra
14298: steps:</p>
14299:
14300: <div class="orderedlist">
14301: <ol type="1">
14302: <li>
1.45 wiz 14303: <p>Include <code xmlns=
14304: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14305: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45 wiz 14306: in your <code xmlns=
14307: "http://www.w3.org/TR/xhtml1/transitional" class=
14308: "filename">Makefile</code>, which takes care of
14309: registering those files in system-wide catalogs
14310: at installation and deinstallation time.</p>
1.1 grant 14311: </li>
14312:
14313: <li>
1.14 xtraeme 14314: <p>Set <code class="varname">SGML_CATALOGS</code>
14315: to the full path of any SGML catalogs installed
14316: by the package.</p>
1.1 grant 14317: </li>
14318:
14319: <li>
1.14 xtraeme 14320: <p>Set <code class="varname">XML_CATALOGS</code>
14321: to the full path of any XML catalogs installed by
1.1 grant 14322: the package.</p>
14323: </li>
14324:
14325: <li>
1.14 xtraeme 14326: <p>Set <code class="varname">SGML_ENTRIES</code>
14327: to individual entries to be added to the SGML
1.1 grant 14328: catalog. These come in groups of three strings;
14329: see xmlcatmgr(1) for more information
14330: (specifically, arguments recognized by the 'add'
14331: action). Note that you will normally not use this
14332: variable.</p>
14333: </li>
14334:
14335: <li>
1.14 xtraeme 14336: <p>Set <code class="varname">XML_ENTRIES</code>
14337: to individual entries to be added to the XML
1.1 grant 14338: catalog. These come in groups of three strings;
14339: see xmlcatmgr(1) for more information
14340: (specifically, arguments recognized by the 'add'
14341: action). Note that you will normally not use this
14342: variable.</p>
14343: </li>
14344: </ol>
14345: </div>
14346: </div>
14347:
1.67 hubertf 14348: <div class="sect2" lang="en">
1.1 grant 14349: <div class="titlepage">
14350: <div>
14351: <div>
1.67 hubertf 14352: <h3 class="title"><a name=
1.68 ! rillig 14353: "mime-database"></a>16.5.14. Packages
1.30 wiz 14354: installing extensions to the MIME database</h3>
1.1 grant 14355: </div>
14356: </div>
14357: </div>
14358:
14359: <p>If a package provides extensions to the MIME
1.45 wiz 14360: database by installing <code xmlns=
14361: "http://www.w3.org/TR/xhtml1/transitional" class=
14362: "filename">.xml</code> files inside <code xmlns=
14363: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14364: "filename">${PREFIX}/share/mime/packages</code>, you
14365: need to take some extra steps to ensure that the
14366: database is kept consistent with respect to these new
14367: files:</p>
1.1 grant 14368:
14369: <div class="orderedlist">
14370: <ol type="1">
14371: <li>
1.45 wiz 14372: <p>Include <code xmlns=
14373: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14374: "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45 wiz 14375: (avoid using the <code xmlns=
14376: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14377: "filename">buildlink3.mk</code> file from this
14378: same directory, which is reserved for inclusion
1.45 wiz 14379: from other <code xmlns=
14380: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14381: "filename">buildlink3.mk</code> files). It takes
14382: care of rebuilding the MIME database at
14383: installation and deinstallation time, and
14384: disallows any access to it directly from the
1.1 grant 14385: package.</p>
14386: </li>
14387:
14388: <li>
14389: <p>Check the PLIST and remove any entries under
1.45 wiz 14390: the <code xmlns=
14391: "http://www.w3.org/TR/xhtml1/transitional" class=
14392: "filename">share/mime</code> directory,
14393: <span class="emphasis"><em>except</em></span> for
14394: files saved under <code xmlns=
14395: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14396: "filename">share/mime/packages</code>. The former
1.1 grant 14397: are handled automatically by the
1.47 reed 14398: update-mime-database program, but the latter are
1.1 grant 14399: package-dependent and must be removed by the
14400: package that installed them in the first
14401: place.</p>
14402: </li>
14403:
14404: <li>
1.45 wiz 14405: <p>Remove any <code xmlns=
14406: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14407: "filename">share/mime/*</code> directories from
14408: the PLIST. They will be handled by the
1.1 grant 14409: shared-mime-info package.</p>
14410: </li>
14411: </ol>
14412: </div>
14413: </div>
14414:
1.67 hubertf 14415: <div class="sect2" lang="en">
1.1 grant 14416: <div class="titlepage">
14417: <div>
14418: <div>
1.67 hubertf 14419: <h3 class="title"><a name=
1.68 ! rillig 14420: "intltool"></a>16.5.15. Packages using
1.1 grant 14421: intltool</h3>
14422: </div>
14423: </div>
14424: </div>
14425:
14426: <p>If a package uses intltool during its build, include
1.45 wiz 14427: the <code xmlns=
14428: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14429: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 14430: file, which forces it to use the intltool package
14431: provided by pkgsrc, instead of the one bundled with the
14432: distribution file.</p>
14433:
14434: <p>This tracks intltool's build-time dependencies and
14435: uses the latest available version; this way, the
14436: package benefits of any bug fixes that may have
14437: appeared since it was released.</p>
14438: </div>
1.18 xtraeme 14439:
1.67 hubertf 14440: <div class="sect2" lang="en">
1.18 xtraeme 14441: <div class="titlepage">
14442: <div>
14443: <div>
1.67 hubertf 14444: <h3 class="title"><a name=
1.68 ! rillig 14445: "startup-scripts"></a>16.5.16. Packages
1.30 wiz 14446: installing startup scripts</h3>
1.18 xtraeme 14447: </div>
14448: </div>
14449: </div>
14450:
14451: <p>If a package contains a rc.d script, it won't be
14452: copied into the startup directory by default, but you
14453: can enable it, by adding the option <code class=
1.45 wiz 14454: "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
14455: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 14456: "filename">/etc/mk.conf</code>. This option will copy
1.45 wiz 14457: the scripts into <code xmlns=
14458: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 14459: "filename">/etc/rc.d</code> when a package is
14460: installed, and it will automatically remove the scripts
14461: when the package is deinstalled.</p>
14462: </div>
1.57 minskim 14463:
1.67 hubertf 14464: <div class="sect2" lang="en">
1.57 minskim 14465: <div class="titlepage">
14466: <div>
14467: <div>
1.67 hubertf 14468: <h3 class="title"><a name=
1.68 ! rillig 14469: "tex-packages"></a>16.5.17. Packages
1.57 minskim 14470: installing TeX modules</h3>
14471: </div>
14472: </div>
14473: </div>
14474:
14475: <p>If a package installs TeX packages into the texmf
14476: tree, the <code xmlns=
14477: "http://www.w3.org/TR/xhtml1/transitional" class=
14478: "filename">ls-R</code> database of the tree needs to be
14479: updated.</p>
14480:
14481: <div class="note" style=
14482: "margin-left: 0.5in; margin-right: 0.5in;">
14483: <h3 class="title">Note</h3>
14484:
14485: <p>Except the main TeX packages such as teTeX-texmf,
14486: packages should install files into <code class=
14487: "varname">PKG_LOCALTEXMFPREFIX</code>, not
14488: <code class="varname">PKG_TEXMFPREFIX</code>.</p>
14489: </div>
14490:
14491: <div class="orderedlist">
14492: <ol type="1">
14493: <li>
14494: <p>Include <code xmlns=
14495: "http://www.w3.org/TR/xhtml1/transitional" class=
14496: "filename">../../print/teTeX/module.mk</code>
14497: instead of <code xmlns=
14498: "http://www.w3.org/TR/xhtml1/transitional" class=
14499: "filename">../../mk/tex.buildlink3.mk</code>.
14500: This takes care of rebuilding the <code xmlns=
14501: "http://www.w3.org/TR/xhtml1/transitional" class=
14502: "filename">ls-R</code> database at installation
14503: and deinstallation time.</p>
14504: </li>
14505:
14506: <li>
14507: <p>If your package installs files into a texmf
14508: tree other than the one at <code class=
14509: "varname">PKG_LOCALTEXMFPREFIX</code>, set
14510: <code class="varname">TEXMFDIRS</code> to the
14511: list of all texmf trees that need database
14512: update.</p>
1.64 kim 14513:
14514: <p>If your package also installs font map files
14515: that need to be registered using
14516: <span><strong class=
14517: "command">updmap</strong></span>, set
14518: <code class="varname">TEX_FONTMAPS</code> to the
14519: list of all such font map files. Then
14520: <span><strong class=
14521: "command">updmap</strong></span> will be run
14522: automatically at installation/deinstallation to
14523: enable/disable font map files for TeX output
14524: drivers.</p>
1.57 minskim 14525: </li>
14526:
14527: <li>
14528: <p>Make sure that none of <code xmlns=
14529: "http://www.w3.org/TR/xhtml1/transitional" class=
14530: "filename">ls-R</code> databases are included in
14531: <code xmlns=
14532: "http://www.w3.org/TR/xhtml1/transitional" class=
14533: "filename">PLIST</code>, as they will be removed
14534: only by the teTeX-bin package.</p>
14535: </li>
14536: </ol>
14537: </div>
14538: </div>
1.1 grant 14539: </div>
14540:
1.67 hubertf 14541: <div class="sect1" lang="en">
1.1 grant 14542: <div class="titlepage">
14543: <div>
14544: <div>
14545: <h2 class="title" style="clear: both"><a name=
1.68 ! rillig 14546: "feedback-to-author"></a>16.6. Feedback to the
1.30 wiz 14547: author</h2>
1.1 grant 14548: </div>
14549: </div>
14550: </div>
14551:
14552: <p>If you have found any bugs in the package you make
14553: available, if you had to do special steps to make it run
14554: under NetBSD or if you enhanced the software in various
14555: other ways, be sure to report these changes back to the
14556: original author of the program! With that kind of
14557: support, the next release of the program can incorporate
14558: these fixes, and people not using the NetBSD packages
14559: system can win from your efforts.</p>
14560:
14561: <p>Support the idea of free software!</p>
14562: </div>
14563: </div>
14564:
1.67 hubertf 14565: <div class="chapter" lang="en">
1.1 grant 14566: <div class="titlepage">
14567: <div>
14568: <div>
1.67 hubertf 14569: <h2 class="title"><a name=
1.68 ! rillig 14570: "debug"></a>Chapter 17. Debugging</h2>
1.1 grant 14571: </div>
14572: </div>
14573: </div>
14574:
14575: <p>To check out all the gotchas when building a package,
14576: here are the steps that I do in order to get a package
14577: working. Please note this is basically the same as what was
14578: explained in the previous sections, only with some
14579: debugging aids.</p>
14580:
14581: <div class="itemizedlist">
14582: <ul type="disc">
14583: <li>
1.14 xtraeme 14584: <p>Be sure to set <code class=
1.45 wiz 14585: "varname">PKG_DEVELOPER=1</code> in <code xmlns=
14586: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14587: "filename">/etc/mk.conf</code></p>
1.1 grant 14588: </li>
14589:
14590: <li>
14591: <p>Install <a xmlns=
14592: "http://www.w3.org/TR/xhtml1/transitional" href=
14593: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 14594: target="_top"><code xmlns="" class=
14595: "filename">pkgtools/url2pkg</code></a>, create a
1.20 ben 14596: directory for a new package, change into it, then run
14597: <span><strong class=
14598: "command">url2pkg</strong></span>:</p>
1.1 grant 14599: <pre class="screen">
1.14 xtraeme 14600: <code class="prompt">%</code> <strong class=
14601: "userinput"><code>mkdir /usr/pkgsrc/<em class=
14602: "replaceable"><code>category</code></em>/<em class=
14603: "replaceable"><code>examplepkg</code></em></code></strong>
14604: <code class="prompt">%</code> <strong class=
14605: "userinput"><code>cd /usr/pkgsrc/<em class=
14606: "replaceable"><code>category</code></em>/<em class=
14607: "replaceable"><code>examplepkg</code></em></code></strong>
14608: <code class="prompt">%</code> <strong class=
14609: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 14610: </pre>
14611: </li>
14612:
14613: <li>
1.45 wiz 14614: <p>Edit the <code xmlns=
14615: "http://www.w3.org/TR/xhtml1/transitional" class=
14616: "filename">Makefile</code> as requested.</p>
1.1 grant 14617: </li>
14618:
14619: <li>
1.45 wiz 14620: <p>Fill in the <code xmlns=
14621: "http://www.w3.org/TR/xhtml1/transitional" class=
14622: "filename">DESCR</code> file</p>
1.1 grant 14623: </li>
14624:
14625: <li>
1.14 xtraeme 14626: <p>Run <span><strong class="command">make
14627: configure</strong></span></p>
1.1 grant 14628: </li>
14629:
14630: <li>
14631: <p>Add any dependencies glimpsed from documentation
1.45 wiz 14632: and the configure step to the package's <code xmlns=
14633: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14634: "filename">Makefile</code>.</p>
1.1 grant 14635: </li>
14636:
14637: <li>
14638: <p>Make the package compile, doing multiple rounds
14639: of</p>
14640: <pre class="screen">
1.14 xtraeme 14641: <code class="prompt">%</code> <strong class=
14642: "userinput"><code>make</code></strong>
14643: <code class="prompt">%</code> <strong class=
14644: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
14645: <code class="prompt">%</code> <strong class=
14646: "userinput"><code>mkpatches</code></strong>
14647: <code class="prompt">%</code> <strong class=
14648: "userinput"><code>patchdiff</code></strong>
14649: <code class="prompt">%</code> <strong class=
14650: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
14651: <code class="prompt">%</code> <strong class=
14652: "userinput"><code>make mps</code></strong>
14653: <code class="prompt">%</code> <strong class=
14654: "userinput"><code>make clean</code></strong>
1.1 grant 14655: </pre>
14656:
14657: <p>Doing as non-root user will ensure that no files
14658: are modified that shouldn't be, especially during the
1.14 xtraeme 14659: build phase. <span><strong class=
14660: "command">mkpatches</strong></span>,
14661: <span><strong class=
14662: "command">patchdiff</strong></span> and
14663: <span><strong class="command">pkgvi</strong></span>
14664: are from the <a xmlns=
1.1 grant 14665: "http://www.w3.org/TR/xhtml1/transitional" href=
14666: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 14667: target="_top"><code xmlns="" class=
14668: "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1 grant 14669: </li>
14670:
14671: <li>
1.45 wiz 14672: <p>Look at the <code xmlns=
14673: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14674: "filename">Makefile</code>, fix if necessary; see
14675: <a href="#components.Makefile" title=
1.38 dillo 14676: "8.1. Makefile">Section 8.1,
1.45 wiz 14677: “<code xmlns=
14678: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14679: "filename">Makefile</code>”</a>.</p>
1.1 grant 14680: </li>
14681:
14682: <li>
1.45 wiz 14683: <p>Generate a <code xmlns=
14684: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14685: "filename">PLIST</code>:</p>
1.1 grant 14686: <pre class="screen">
1.14 xtraeme 14687: <code class="prompt">#</code> <strong class=
14688: "userinput"><code>make install</code></strong>
14689: <code class="prompt">#</code> <strong class=
14690: "userinput"><code>make print-PLIST >PLIST</code></strong>
14691: <code class="prompt">#</code> <strong class=
14692: "userinput"><code>make deinstall</code></strong>
14693: <code class="prompt">#</code> <strong class=
14694: "userinput"><code>make install</code></strong>
14695: <code class="prompt">#</code> <strong class=
14696: "userinput"><code>make deinstall</code></strong>
1.1 grant 14697: </pre>
14698:
1.45 wiz 14699: <p>You usually need to be <code xmlns=
14700: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14701: "username">root</code> to do this. Look if there are
1.1 grant 14702: any files left:</p>
14703: <pre class="screen">
1.14 xtraeme 14704: <code class="prompt">#</code> <strong class=
14705: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 14706: </pre>
14707:
14708: <p>If this reveals any files that are missing in
1.45 wiz 14709: <code xmlns=
14710: "http://www.w3.org/TR/xhtml1/transitional" class=
14711: "filename">PLIST</code>, add them.</p>
1.1 grant 14712: </li>
14713:
14714: <li>
1.45 wiz 14715: <p>Now that the <code xmlns=
14716: "http://www.w3.org/TR/xhtml1/transitional" class=
14717: "filename">PLIST</code> is OK, install the package
14718: again and make a binary package:</p>
1.1 grant 14719: <pre class="screen">
1.14 xtraeme 14720: <code class="prompt">#</code> <strong class=
14721: "userinput"><code>make reinstall</code></strong>
14722: <code class="prompt">#</code> <strong class=
14723: "userinput"><code>make package</code></strong>
1.1 grant 14724: </pre>
14725: </li>
14726:
14727: <li>
14728: <p>Delete the installed package:</p>
14729: <pre class="screen">
1.14 xtraeme 14730: <code class="prompt">#</code> <strong class=
14731: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 14732: </pre>
14733: </li>
14734:
14735: <li>
1.14 xtraeme 14736: <p>Repeat the above <span><strong class=
14737: "command">make print-PLIST</strong></span> command,
14738: which shouldn't find anything now:</p>
1.1 grant 14739: <pre class="screen">
1.14 xtraeme 14740: <code class="prompt">#</code> <strong class=
14741: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 14742: </pre>
14743: </li>
14744:
14745: <li>
14746: <p>Reinstall the binary package:</p>
14747: <pre class="screen">
1.14 xtraeme 14748: <code class="prompt">#</code> <strong class=
14749: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 14750: </pre>
14751: </li>
14752:
14753: <li>
14754: <p>Play with it. Make sure everything works.</p>
14755: </li>
14756:
14757: <li>
1.14 xtraeme 14758: <p>Run <span><strong class=
14759: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 14760: "http://www.w3.org/TR/xhtml1/transitional" href=
14761: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 14762: target="_top"><code xmlns="" class=
14763: "filename">pkgtools/pkglint</code></a>, and fix the
1.20 ben 14764: problems it reports:</p>
1.1 grant 14765: <pre class="screen">
1.14 xtraeme 14766: <code class="prompt">#</code> <strong class=
14767: "userinput"><code>pkglint</code></strong>
1.1 grant 14768: </pre>
14769: </li>
14770:
14771: <li>
14772: <p>Submit (or commit, if you have cvs access); see
14773: <a href="#submit" title=
1.68 ! rillig 14774: "Chapter 18. Submitting and Committing">Chapter 18,
1.1 grant 14775: <i>Submitting and Committing</i></a>.</p>
14776: </li>
14777: </ul>
14778: </div>
14779: </div>
14780:
1.67 hubertf 14781: <div class="chapter" lang="en">
1.1 grant 14782: <div class="titlepage">
14783: <div>
14784: <div>
1.67 hubertf 14785: <h2 class="title"><a name=
1.68 ! rillig 14786: "submit"></a>Chapter 18. Submitting and
1.1 grant 14787: Committing</h2>
14788: </div>
14789: </div>
14790: </div>
14791:
14792: <div class="toc">
14793: <p><b>Table of Contents</b></p>
14794:
14795: <dl>
1.30 wiz 14796: <dt><span class="sect1"><a href=
1.68 ! rillig 14797: "#submitting-your-package">18.1. Submitting your
1.30 wiz 14798: packages</a></span></dt>
1.1 grant 14799:
1.30 wiz 14800: <dt><span class="sect1"><a href=
1.68 ! rillig 14801: "#general-notes-for-changes">18.2. General notes when
1.41 wiz 14802: adding, updating, or removing packages</a></span></dt>
14803:
14804: <dt><span class="sect1"><a href=
1.68 ! rillig 14805: "#committing-importing">18.3. Committing: Importing a
1.30 wiz 14806: package into CVS</a></span></dt>
1.1 grant 14807:
1.30 wiz 14808: <dt><span class="sect1"><a href=
1.68 ! rillig 14809: "#updating-package">18.4. Updating a package to a newer
1.30 wiz 14810: version</a></span></dt>
1.1 grant 14811:
1.68 ! rillig 14812: <dt><span class="sect1"><a href="#moving-package">18.5.
1.2 hubertf 14813: Moving a package in pkgsrc</a></span></dt>
1.1 grant 14814: </dl>
14815: </div>
14816:
1.67 hubertf 14817: <div class="sect1" lang="en">
1.1 grant 14818: <div class="titlepage">
14819: <div>
14820: <div>
14821: <h2 class="title" style="clear: both"><a name=
1.68 ! rillig 14822: "submitting-your-package"></a>18.1. Submitting
1.30 wiz 14823: your packages</h2>
1.1 grant 14824: </div>
14825: </div>
14826: </div>
14827:
14828: <p>You have to separate between binary and
14829: “<span class="quote">normal</span>” (source)
14830: packages here:</p>
14831:
14832: <div class="itemizedlist">
14833: <ul type="disc">
14834: <li>
14835: <p>precompiled binary packages</p>
14836:
14837: <p>Our policy is that we accept binaries only from
14838: pkgsrc developers to guarantee that the packages
14839: don't contain any trojan horses etc. This is not to
1.13 hubertf 14840: annoy anyone but rather to protect our users!
1.1 grant 14841: You're still free to put up your home-made binary
1.13 hubertf 14842: packages and tell the world where to get them.
14843: NetBSD developers doing bulk builds and wanting to
14844: upload them please see <a href="#bulk-upload"
1.38 dillo 14845: title="6.3.8. Uploading results of a bulk build">
14846: Section 6.3.8, “Uploading results of a
1.13 hubertf 14847: bulk build”</a>.</p>
1.1 grant 14848: </li>
14849:
14850: <li>
14851: <p>packages</p>
14852:
14853: <p>First, check that your package is complete,
14854: compiles and runs well; see <a href="#debug" title=
1.68 ! rillig 14855: "Chapter 17. Debugging">Chapter 17,
1.1 grant 14856: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 14857: Next, generate an uuencoded gzipped <a href=
14858: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
14859: <span class="citerefentry"><span class=
14860: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 14861: preferably with all files in a single directory.
1.14 xtraeme 14862: Finally, <span><strong class=
14863: "command">send-pr</strong></span> with category
1.1 grant 14864: “<span class="quote">pkg</span>”, a
14865: synopsis which includes the package name and
14866: version number, a short description of your package
14867: (contents of the COMMENT variable or DESCR file are
14868: OK) and attach the archive to your PR.</p>
14869:
14870: <p>If you want to submit several packages, please
14871: send a separate PR for each one, it's easier for us
14872: to track things that way.</p>
14873:
14874: <p>Alternatively, you can also import new packages
14875: into pkgsrc-wip (“<span class="quote">pkgsrc
14876: work-in-progress</span>”); see the homepage
14877: at <a href="http://pkgsrc-wip.sourceforge.net/"
14878: target=
14879: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
14880: details.</p>
14881: </li>
14882: </ul>
14883: </div>
14884: </div>
14885:
1.67 hubertf 14886: <div class="sect1" lang="en">
1.1 grant 14887: <div class="titlepage">
14888: <div>
14889: <div>
14890: <h2 class="title" style="clear: both"><a name=
1.68 ! rillig 14891: "general-notes-for-changes"></a>18.2. General
1.41 wiz 14892: notes when adding, updating, or removing
14893: packages</h2>
14894: </div>
14895: </div>
14896: </div>
14897:
14898: <p>Please note all package additions, updates, moves, and
1.45 wiz 14899: removals in <code xmlns=
14900: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14901: "filename">pkgsrc/doc/CHANGES</code>. It's very important
14902: to keep this file up to date and conforming to the
14903: existing format, because it will be used by scripts to
14904: automatically update pages on <a href=
14905: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45 wiz 14906: and other sites. Additionally, check the <code xmlns=
14907: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14908: "filename">pkgsrc/doc/TODO</code> file and remove the
14909: entry for the package you updated or removed, in case it
14910: was mentioned there.</p>
14911:
14912: <p>There is a make target that helps in creating proper
1.45 wiz 14913: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14914: class="filename">CHANGES</code> entries:
1.41 wiz 14915: <span><strong class="command">make
14916: changes-entry</strong></span>. It uses the optional
14917: <code class="varname">CTYPE</code> and <code class=
14918: "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45 wiz 14919: usage is to first make sure that your <code xmlns=
14920: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14921: "filename">CHANGES</code> file is up-to-date (to avoid
14922: having to resolve conflicts later-on) and then to
14923: <span><strong class="command">cd</strong></span> to the
14924: package directory. For package updates,
14925: <span><strong class="command">make
14926: changes-entry</strong></span> is enough. For new
14927: packages, or package moves or removals, set the
14928: <code class="varname">CTYPE</code> variable on the
14929: command line to "Added", "Moved", or "Removed". You can
14930: set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45 wiz 14931: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14932: class="filename">/etc/mk.conf</code> if your local login
14933: name is not the same as your NetBSD login name. Don't
14934: forget to commit the changes to <code xmlns=
14935: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14936: "filename">pkgsrc/doc/CHANGES</code>!</p>
14937: </div>
14938:
1.67 hubertf 14939: <div class="sect1" lang="en">
1.41 wiz 14940: <div class="titlepage">
14941: <div>
14942: <div>
14943: <h2 class="title" style="clear: both"><a name=
1.68 ! rillig 14944: "committing-importing"></a>18.3. Committing:
1.30 wiz 14945: Importing a package into CVS</h2>
1.1 grant 14946: </div>
14947: </div>
14948: </div>
14949:
14950: <p>This section is only of interest for pkgsrc developers
14951: with write access to the pkgsrc repository. Please
14952: remember that cvs imports files relative to the current
14953: working directory, and that the pathname that you give
1.14 xtraeme 14954: the <span><strong class="command">cvs
14955: import</strong></span> command is so that it knows where
14956: to place the files in the repository. Newly created
14957: packages should be imported with a vendor tag of
14958: “<span class="quote">TNF</span>” and a
14959: release tag of “<span class=
14960: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 14961: <pre class="programlisting">
1.51 rillig 14962: <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
14963: <code class=
14964: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1 grant 14965: </pre>
14966:
14967: <p>Remember to move the directory from which you imported
14968: out of the way, or cvs will complain the next time you
14969: “<span class="quote">cvs update</span>” your
14970: source tree. Also don't forget to add the new package to
1.45 wiz 14971: the category's <code xmlns=
14972: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14973: "filename">Makefile</code>.</p>
1.1 grant 14974:
14975: <p>The commit message of the initial import should
1.45 wiz 14976: include part of the <code xmlns=
14977: "http://www.w3.org/TR/xhtml1/transitional" class=
14978: "filename">DESCR</code> file, so people reading the
14979: mailing lists know what the package is/does.</p>
1.1 grant 14980:
14981: <p>For new packages, “<span class="quote">cvs
14982: import</span>” is preferred to “<span class=
14983: "quote">cvs add</span>” because the former gets
14984: everything with a single command, and provides a
14985: consistent tag.</p>
14986: </div>
14987:
1.67 hubertf 14988: <div class="sect1" lang="en">
1.1 grant 14989: <div class="titlepage">
14990: <div>
14991: <div>
14992: <h2 class="title" style="clear: both"><a name=
1.68 ! rillig 14993: "updating-package"></a>18.4. Updating a
1.30 wiz 14994: package to a newer version</h2>
1.1 grant 14995: </div>
14996: </div>
14997: </div>
14998:
14999: <p>Please always put a concise, appropriate and relevant
15000: summary of the changes between old and new versions into
15001: the commit log when updating a package. There are various
15002: reasons for this:</p>
15003:
15004: <div class="itemizedlist">
15005: <ul type="disc">
15006: <li>
15007: <p>A URL is volatile, and can change over time. It
15008: may go away completely or its information may be
15009: overwritten by newer information.</p>
15010: </li>
15011:
15012: <li>
15013: <p>Having the change information between old and
15014: new versions in our CVS repository is very useful
15015: for people who use either cvs or anoncvs.</p>
15016: </li>
15017:
15018: <li>
15019: <p>Having the change information between old and
15020: new versions in our CVS repository is very useful
15021: for people who read the pkgsrc-changes mailing
15022: list, so that they can make tactical decisions
15023: about when to upgrade the package.</p>
15024: </li>
15025: </ul>
15026: </div>
15027:
1.18 xtraeme 15028: <p>Please also recognize that, just because a new version
1.1 grant 15029: of a package has been released, it should not
15030: automatically be upgraded in the CVS repository. We
15031: prefer to be conservative in the packages that are
15032: included in pkgsrc - development or beta packages are not
15033: really the best thing for most places in which pkgsrc is
15034: used. Please use your judgement about what should go into
15035: pkgsrc, and bear in mind that stability is to be
15036: preferred above new and possibly untested features.</p>
15037: </div>
15038:
1.67 hubertf 15039: <div class="sect1" lang="en">
1.1 grant 15040: <div class="titlepage">
15041: <div>
15042: <div>
15043: <h2 class="title" style="clear: both"><a name=
1.68 ! rillig 15044: "moving-package"></a>18.5. Moving a package in
1.30 wiz 15045: pkgsrc</h2>
1.1 grant 15046: </div>
15047: </div>
15048: </div>
15049:
15050: <div class="orderedlist">
15051: <ol type="1">
15052: <li>
15053: <p>Make a copy of the directory somewhere else.</p>
15054: </li>
15055:
15056: <li>
15057: <p>Remove all CVS dirs.</p>
15058:
15059: <p>Alternatively to the first two steps you can
15060: also do:</p>
15061: <pre class="screen">
1.14 xtraeme 15062: <code class="prompt">%</code> <strong class=
15063: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 15064: </pre>
15065:
15066: <p>and use that for further work.</p>
15067: </li>
15068:
15069: <li>
1.14 xtraeme 15070: <p>Fix <code class="varname">CATEGORIES</code> and
15071: any <code class="varname">DEPENDS</code> paths that
15072: just did “<span class=
1.1 grant 15073: "quote">../package</span>” instead of
15074: “<span class=
15075: "quote">../../category/package</span>”.</p>
15076: </li>
15077:
15078: <li>
1.14 xtraeme 15079: <p><span><strong class="command">cvs
15080: import</strong></span> the modified package in the
15081: new place.</p>
1.1 grant 15082: </li>
15083:
15084: <li>
15085: <p>Check if any package depends on it:</p>
15086: <pre class="screen">
1.14 xtraeme 15087: <code class="prompt">%</code> <strong class=
15088: "userinput"><code>cd /usr/pkgsrc</code></strong>
15089: <code class="prompt">%</code> <strong class=
15090: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 15091: </pre>
15092: </li>
15093:
15094: <li>
15095: <p>Fix paths in packages from step 5 to point to
15096: new location.</p>
15097: </li>
15098:
15099: <li>
1.14 xtraeme 15100: <p><span><strong class="command">cvs rm
15101: (-f)</strong></span> the package at the old
15102: location.</p>
1.1 grant 15103: </li>
15104:
15105: <li>
1.45 wiz 15106: <p>Remove from <code xmlns=
15107: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15108: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 15109: </li>
15110:
15111: <li>
1.45 wiz 15112: <p>Add to <code xmlns=
15113: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15114: "filename">newcategory/Makefile</code>.</p>
1.1 grant 15115: </li>
15116:
15117: <li>
15118: <p>Commit the changed and removed files:</p>
15119: <pre class="screen">
1.14 xtraeme 15120: <code class="prompt">%</code> <strong class=
15121: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 15122: </pre>
15123:
15124: <p>(and any packages from step 5, of course).</p>
15125: </li>
15126: </ol>
15127: </div>
15128: </div>
15129: </div>
15130: </div>
15131:
1.67 hubertf 15132: <div class="appendix" lang="en">
1.1 grant 15133: <div class="titlepage">
15134: <div>
15135: <div>
1.67 hubertf 15136: <h2 class="title"><a name=
1.46 gdt 15137: "examples"></a>Appendix A. A simple example
1.1 grant 15138: package: bison</h2>
15139: </div>
15140: </div>
15141: </div>
15142:
15143: <div class="toc">
15144: <p><b>Table of Contents</b></p>
15145:
15146: <dl>
1.46 gdt 15147: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 15148: files</a></span></dt>
15149:
15150: <dd>
15151: <dl>
1.30 wiz 15152: <dt><span class="sect2"><a href=
1.46 gdt 15153: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 15154:
1.30 wiz 15155: <dt><span class="sect2"><a href=
1.46 gdt 15156: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 15157:
1.30 wiz 15158: <dt><span class="sect2"><a href=
1.46 gdt 15159: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 15160:
1.30 wiz 15161: <dt><span class="sect2"><a href=
1.46 gdt 15162: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 15163: package with <span><strong class=
1.14 xtraeme 15164: "command">pkglint</strong></span></a></span></dt>
1.1 grant 15165: </dl>
15166: </dd>
15167:
1.46 gdt 15168: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 15169: Steps for building, installing, packaging</a></span></dt>
1.1 grant 15170: </dl>
15171: </div>
15172:
15173: <p>We checked to find a piece of software that wasn't in the
15174: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 15175: would want to have <span><strong class=
15176: "command">bison</strong></span> when Berkeley
15177: <span><strong class="command">yacc</strong></span> is already
15178: present in the tree is beyond us, but it's useful for the
15179: purposes of this exercise.</p>
1.1 grant 15180:
1.67 hubertf 15181: <div class="sect1" lang="en">
1.1 grant 15182: <div class="titlepage">
15183: <div>
15184: <div>
15185: <h2 class="title" style="clear: both"><a name=
1.46 gdt 15186: "example-files"></a>A.1. files</h2>
1.1 grant 15187: </div>
15188: </div>
15189: </div>
15190:
1.67 hubertf 15191: <div class="sect2" lang="en">
1.1 grant 15192: <div class="titlepage">
15193: <div>
15194: <div>
1.67 hubertf 15195: <h3 class="title"><a name=
1.46 gdt 15196: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 15197: </div>
15198: </div>
15199: </div>
15200: <pre class="programlisting">
1.51 rillig 15201: # $NetBSD$
15202: #
1.1 grant 15203:
1.51 rillig 15204: DISTNAME= bison-1.25
15205: CATEGORIES= devel
15206: MASTER_SITES= ${MASTER_SITE_GNU}
1.1 grant 15207:
1.51 rillig 15208: MAINTAINER= thorpej@NetBSD.org
15209: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
15210: COMMENT= GNU yacc clone
1.1 grant 15211:
1.51 rillig 15212: GNU_CONFIGURE= yes
15213: INFO_FILES= bison.info
1.1 grant 15214:
1.51 rillig 15215: .include "../../mk/bsd.pkg.mk"
1.1 grant 15216: </pre>
15217: </div>
15218:
1.67 hubertf 15219: <div class="sect2" lang="en">
1.1 grant 15220: <div class="titlepage">
15221: <div>
15222: <div>
1.67 hubertf 15223: <h3 class="title"><a name=
1.46 gdt 15224: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 15225: </div>
15226: </div>
15227: </div>
15228: <pre class="programlisting">
1.51 rillig 15229: GNU version of yacc. Can make re-entrant parsers, and numerous other
15230: improvements. Why you would want this when Berkeley <a href=
1.1 grant 15231: "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
1.51 rillig 15232: of the NetBSD source tree is beyond me.
1.1 grant 15233: </pre>
15234: </div>
15235:
1.67 hubertf 15236: <div class="sect2" lang="en">
1.1 grant 15237: <div class="titlepage">
15238: <div>
15239: <div>
1.67 hubertf 15240: <h3 class="title"><a name=
1.46 gdt 15241: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 15242: </div>
15243: </div>
15244: </div>
15245: <pre class="programlisting">
1.51 rillig 15246: @comment $NetBSD$
15247: bin/bison
15248: man/man1/bison.1.gz
15249: share/bison.simple
15250: share/bison.hairy
1.1 grant 15251: </pre>
15252: </div>
15253:
1.67 hubertf 15254: <div class="sect2" lang="en">
1.1 grant 15255: <div class="titlepage">
15256: <div>
15257: <div>
1.30 wiz 15258: <h3 class="title"><a name=
1.46 gdt 15259: "checking-package-with-pkglint"></a>A.1.4. Checking
1.30 wiz 15260: a package with <span><strong class=
1.14 xtraeme 15261: "command">pkglint</strong></span></h3>
1.1 grant 15262: </div>
15263: </div>
15264: </div>
15265:
15266: <p>The NetBSD package system comes with <a xmlns=
15267: "http://www.w3.org/TR/xhtml1/transitional" href=
15268: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 15269: target="_top"><code xmlns="" class=
15270: "filename">pkgtools/pkglint</code></a> which helps to
15271: check the contents of these files. After installation it
15272: is quite easy to use, just change to the directory of the
1.20 ben 15273: package you wish to examine and execute
15274: <span><strong class=
15275: "command">pkglint</strong></span>:</p>
1.1 grant 15276: <pre class="screen">
1.14 xtraeme 15277: <code class="prompt">$</code> <strong class=
15278: "userinput"><code>pkglint</code></strong>
1.1 grant 15279: looks fine.
15280: </pre>
15281:
15282: <p>Depending on the supplied command line arguments (see
1.60 rillig 15283: pkglint(1)), more checks will be performed. Use e.g.
15284: <span><strong class="command">pkglint -Call
15285: -Wall</strong></span> for a very thorough check.</p>
1.1 grant 15286: </div>
15287: </div>
15288:
1.67 hubertf 15289: <div class="sect1" lang="en">
1.1 grant 15290: <div class="titlepage">
15291: <div>
15292: <div>
15293: <h2 class="title" style="clear: both"><a name=
1.46 gdt 15294: "steps-for-b-i-p"></a>A.2. Steps for building,
1.30 wiz 15295: installing, packaging</h2>
1.1 grant 15296: </div>
15297: </div>
15298: </div>
15299:
15300: <p>Create the directory where the package lives, plus any
15301: auxiliary directories:</p>
15302: <pre class="screen">
1.14 xtraeme 15303: <code class="prompt">#</code> <strong class=
15304: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
15305: <code class="prompt">#</code> <strong class=
15306: "userinput"><code>mkdir bison</code></strong>
15307: <code class="prompt">#</code> <strong class=
15308: "userinput"><code>cd bison</code></strong>
15309: <code class="prompt">#</code> <strong class=
15310: "userinput"><code>mkdir patches</code></strong>
1.1 grant 15311: </pre>
15312:
1.45 wiz 15313: <p>Create <code xmlns=
15314: "http://www.w3.org/TR/xhtml1/transitional" class=
15315: "filename">Makefile</code>, <code xmlns=
15316: "http://www.w3.org/TR/xhtml1/transitional" class=
15317: "filename">DESCR</code> and <code xmlns=
15318: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15319: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 15320: "Chapter 8. Package components - files, directories and contents">
1.67 hubertf 15321: Chapter 8, <i>Package components - files, directories
15322: and contents</i></a>) then continue with fetching the
1.1 grant 15323: distfile:</p>
15324: <pre class="screen">
1.14 xtraeme 15325: <code class="prompt">#</code> <strong class=
15326: "userinput"><code>make fetch</code></strong>
1.1 grant 15327: >> bison-1.25.tar.gz doesn't seem to exist on this system.
15328: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
15329: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
15330: ftp: Error retrieving file: 500 Internal error
15331:
15332: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
15333: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
15334: ftp: Error retrieving file: 500 Internal error
15335:
15336: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
15337: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
15338: Successfully retrieved file.
15339: </pre>
15340:
1.45 wiz 15341: <p>Generate the checksum of the distfile into <code xmlns=
15342: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15343: "filename">distinfo</code>:</p>
1.1 grant 15344: <pre class="screen">
1.14 xtraeme 15345: <code class="prompt">#</code> <strong class=
15346: "userinput"><code>make makesum</code></strong>
1.1 grant 15347: </pre>
15348:
15349: <p>Now compile:</p>
15350: <pre class="screen">
1.14 xtraeme 15351: <code class="prompt">#</code> <strong class=
15352: "userinput"><code>make</code></strong>
1.1 grant 15353: >> Checksum OK for bison-1.25.tar.gz.
15354: ===> Extracting for bison-1.25
15355: ===> Patching for bison-1.25
15356: ===> Ignoring empty patch directory
15357: ===> Configuring for bison-1.25
15358: creating cache ./config.cache
15359: checking for gcc... cc
15360: checking whether we are using GNU C... yes
15361: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
15362: checking how to run the C preprocessor... cc -E
15363: checking for minix/config.h... no
15364: checking for POSIXized ISC... no
15365: checking whether cross-compiling... no
15366: checking for ANSI C header files... yes
15367: checking for string.h... yes
15368: checking for stdlib.h... yes
15369: checking for memory.h... yes
15370: checking for working const... yes
15371: checking for working alloca.h... no
15372: checking for alloca... yes
15373: checking for strerror... yes
15374: updating cache ./config.cache
15375: creating ./config.status
15376: creating Makefile
15377: ===> Building for bison-1.25
15378: 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
15379: 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
15380: 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
15381: 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
15382: 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
1.68 ! rillig 15383: 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
1.1 grant 15384: 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
15385: 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
15386: 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
15387: 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
15388: 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
15389: 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
15390: 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
15391: 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
15392: 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
15393: 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
15394: 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
15395: 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
15396: 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
15397: 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
15398: 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
15399: 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
15400: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
15401: rm -f bison.s1
15402: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
15403: </pre>
15404:
15405: <p>Everything seems OK, so install the files:</p>
15406: <pre class="screen">
1.14 xtraeme 15407: <code class="prompt">#</code> <strong class=
15408: "userinput"><code>make install</code></strong>
1.1 grant 15409: >> Checksum OK for bison-1.25.tar.gz.
15410: ===> Installing for bison-1.25
15411: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
15412: rm -f /usr/pkg/bin/bison
15413: cd /usr/pkg/share; rm -f bison.simple bison.hairy
15414: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
15415: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
15416: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
15417: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
15418: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
15419: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
15420: ===> Registering installation for bison-1.25
15421: </pre>
15422:
15423: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 15424: remove it with <span><strong class="command">pkg_delete
15425: bison</strong></span>. Should you decide that you want a
15426: binary package, do this now:</p>
1.1 grant 15427: <pre class="screen">
1.14 xtraeme 15428: <code class="prompt">#</code> <strong class=
15429: "userinput"><code>make package</code></strong>
1.1 grant 15430: >> Checksum OK for bison-1.25.tar.gz.
15431: ===> Building package for bison-1.25
15432: Creating package bison-1.25.tgz
15433: Registering depends:.
15434: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
15435: </pre>
15436:
15437: <p>Now that you don't need the source and object files any
15438: more, clean up:</p>
15439: <pre class="screen">
1.14 xtraeme 15440: <code class="prompt">#</code> <strong class=
15441: "userinput"><code>make clean</code></strong>
1.1 grant 15442: ===> Cleaning for bison-1.25
15443: </pre>
15444: </div>
15445: </div>
15446:
1.67 hubertf 15447: <div class="appendix" lang="en">
1.1 grant 15448: <div class="titlepage">
15449: <div>
15450: <div>
1.67 hubertf 15451: <h2 class="title"><a name=
1.46 gdt 15452: "logs"></a>Appendix B. Build logs</h2>
1.1 grant 15453: </div>
15454: </div>
15455: </div>
15456:
15457: <div class="toc">
15458: <p><b>Table of Contents</b></p>
15459:
15460: <dl>
1.46 gdt 15461: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 15462: Building figlet</a></span></dt>
15463:
1.46 gdt 15464: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 15465: Packaging figlet</a></span></dt>
15466: </dl>
15467: </div>
15468:
1.67 hubertf 15469: <div class="sect1" lang="en">
1.1 grant 15470: <div class="titlepage">
15471: <div>
15472: <div>
15473: <h2 class="title" style="clear: both"><a name=
1.46 gdt 15474: "logs.building"></a>B.1. Building figlet</h2>
1.1 grant 15475: </div>
15476: </div>
15477: </div>
15478: <pre class="screen">
1.14 xtraeme 15479: <code class="prompt">#</code> <strong class=
15480: "userinput"><code>make</code></strong>
1.1 grant 15481: ===> Checking for vulnerabilities in figlet-2.2.1nb2
15482: => figlet221.tar.gz doesn't seem to exist on this system.
15483: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
15484: => [172219 bytes]
15485: Connected to ftp.plig.net.
15486: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
15487: 331 Guest login ok, send your complete e-mail address as password.
15488: 230-You are user #5 of 500 simultaneous users allowed.
15489: 230-
1.68 ! rillig 15490: 230- ___ _ _ _
! 15491: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
1.1 grant 15492: 230- | _| _| . |_| . | | | . |_| . | _| . |
15493: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
15494: 230- |_| |_| |___| |___|
15495: 230-
15496: 230-** Welcome to ftp.plig.org **
15497: 230-
15498: 230-Please note that all transfers from this FTP site are logged. If you
15499: 230-do not like this, please disconnect now.
15500: 230-
15501: 230-This arhive is available via
15502: 230-
15503: 230-HTTP: http://ftp.plig.org/
15504: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
15505: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
15506: 230-
15507: 230-Please email comments, bug reports and requests for packages to be
1.68 ! rillig 15508: 230-mirrored to ftp-admin@plig.org.
1.1 grant 15509: 230-
15510: 230-
15511: 230 Logged in anonymously.
15512: Remote system type is UNIX.
15513: Using binary mode to transfer files.
15514: 200 Type okay.
15515: 250 "/pub" is new cwd.
15516: 250-"/pub/figlet" is new cwd.
15517: 250-
15518: 250-Welcome to the figlet archive at ftp.figlet.org
1.68 ! rillig 15519: 250-
1.1 grant 15520: 250- ftp://ftp.figlet.org/pub/figlet/
15521: 250-
15522: 250-The official FIGlet web page is:
15523: 250- http://www.figlet.org/
15524: 250-
15525: 250-If you have questions, please mailto:info@figlet.org. If you want to
15526: 250-contribute a font or something else, you can email us.
1.68 ! rillig 15527: 250
1.1 grant 15528: 250 "/pub/figlet/program" is new cwd.
15529: 250 "/pub/figlet/program/unix" is new cwd.
15530: local: figlet221.tar.gz remote: figlet221.tar.gz
15531: 502 Unimplemented command.
15532: 227 Entering Passive Mode (195,40,6,41,246,104)
15533: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
15534: 38% |************** | 65800 64.16 KB/s 00:01 ETA
15535: 226 Transfer completed.
15536: 172219 bytes received in 00:02 (75.99 KB/s)
15537: 221 Goodbye.
15538: => Checksum OK for figlet221.tar.gz.
15539: ===> Extracting for figlet-2.2.1nb2
15540: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
15541: ===> Patching for figlet-2.2.1nb2
15542: ===> Applying pkgsrc patches for figlet-2.2.1nb2
15543: ===> Overriding tools for figlet-2.2.1nb2
15544: ===> Creating toolchain wrappers for figlet-2.2.1nb2
15545: ===> Configuring for figlet-2.2.1nb2
15546: ===> Building for figlet-2.2.1nb2
15547: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
15548: chmod a+x figlet
15549: gcc -O2 -o chkfont chkfont.c
15550: => Unwrapping files-to-be-installed.
1.14 xtraeme 15551: <code class="prompt">#</code>
15552: <code class="prompt">#</code> <strong class=
15553: "userinput"><code>make install</code></strong>
1.1 grant 15554: ===> Checking for vulnerabilities in figlet-2.2.1nb2
15555: ===> Installing for figlet-2.2.1nb2
15556: install -d -o root -g wheel -m 755 /usr/pkg/bin
15557: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
15558: mkdir -p /usr/pkg/share/figlet
15559: cp figlet /usr/pkg/bin
15560: cp chkfont /usr/pkg/bin
15561: chmod 555 figlist showfigfonts
15562: cp figlist /usr/pkg/bin
15563: cp showfigfonts /usr/pkg/bin
15564: cp fonts/*.flf /usr/pkg/share/figlet
15565: cp fonts/*.flc /usr/pkg/share/figlet
15566: cp figlet.6 /usr/pkg/man/man6
15567: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 15568: <code class="prompt">#</code>
1.1 grant 15569: </pre>
15570: </div>
15571:
1.67 hubertf 15572: <div class="sect1" lang="en">
1.1 grant 15573: <div class="titlepage">
15574: <div>
15575: <div>
15576: <h2 class="title" style="clear: both"><a name=
1.46 gdt 15577: "logs.package"></a>B.2. Packaging figlet</h2>
1.1 grant 15578: </div>
15579: </div>
15580: </div>
15581: <pre class="screen">
1.14 xtraeme 15582: <code class="prompt">#</code> <strong class=
15583: "userinput"><code>make package</code></strong>
1.1 grant 15584: ===> Checking for vulnerabilities in figlet-2.2.1nb2
15585: ===> Packaging figlet-2.2.1nb2
15586: ===> Building binary package for figlet-2.2.1nb2
15587: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
15588: Using SrcDir value of /usr/pkg
1.68 ! rillig 15589: Registering depends:.
1.14 xtraeme 15590: <code class="prompt">#</code>
1.1 grant 15591: </pre>
15592: </div>
15593: </div>
15594:
1.67 hubertf 15595: <div class="appendix" lang="en">
1.1 grant 15596: <div class="titlepage">
15597: <div>
15598: <div>
1.67 hubertf 15599: <h2 class="title"><a name=
1.46 gdt 15600: "ftp-layout"></a>Appendix C. Layout of the
1.1 grant 15601: FTP server's package archive</h2>
15602: </div>
15603: </div>
15604: </div>
15605:
15606: <p>Layout for precompiled binary packages on
15607: ftp.NetBSD.org:</p>
15608: <pre class="programlisting">
1.51 rillig 15609: /pub/NetBSD/packages/
15610: distfiles/
1.1 grant 15611:
1.51 rillig 15612: # Unpacked pkgsrc trees
15613: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
15614: pkgsrc-2003Q4 -> N/A
15615: pkgsrc-2004Q1/pkgsrc
15616:
15617: # pkgsrc archives
15618: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
15619: pkgsrc-2003Q4.tar.gz -> N/A
15620: pkgsrc-2004Q1.tar.gz -> N/A
15621:
15622: # Per pkgsrc-release/OS-release/arch package archives
15623: pkgsrc-2003Q4/
15624: NetBSD-1.6.2/
15625: i386/
15626: All/
15627: archivers/
15628: foo -> ../All/foo
15629: ...
15630: pkgsrc-2004Q1/
15631: NetBSD-1.6.2/
15632: i386/
15633: All/
15634: ...
15635: NetBSD-2.0/
15636: i386/
15637: All/
15638: ...
15639: SunOS-5.9/
15640: sparc/
15641: All/
15642: ...
15643: x86/
15644: All/
15645: ...
15646:
15647: # Per os-release package archive convenience links
15648: NetBSD-1.6.2 -> 1.6.2
15649: 1.6.2/
15650: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
15651: m68k/
15652: All/
15653: archivers/
15654: foo -> ../All/foo
15655: ...
15656: amiga -> m68k
15657: atari -> m68k
15658: ...
15659:
15660: 2.0 -> NetBSD-2.0 # backward compat, historic
15661: NetBSD-2.0/
15662: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
15663: SunOS-5.9/
15664: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
15665: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1 grant 15666: </pre>
15667:
15668: <p>To create:</p>
15669:
15670: <div class="orderedlist">
15671: <ol type="1">
15672: <li>
15673: <p>Run bulk build, see <a href="#bulkbuild" title=
1.67 hubertf 15674: "6.3. Doing a bulk build of all packages">Section 6.3,
15675: “Doing a bulk build of all
1.1 grant 15676: packages”</a></p>
15677: </li>
15678:
15679: <li>
15680: <p>Upload /usr/pkgsrc/packages to</p>
15681: <pre class="programlisting">
15682: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51 rillig 15683: pkgsrc-2004Q4/\ # pkgsrc-branch
15684: `uname -s`-`uname -r`/\ # OS & version
15685: `uname -p` # architecture
1.1 grant 15686: </pre>
15687: </li>
15688:
15689: <li>
1.14 xtraeme 15690: <p>If necessary, create a symlink <span><strong class=
15691: "command">ln -s `uname -m` `uname -p`</strong></span>
15692: (amiga -> m68k, ...)</p>
1.1 grant 15693: </li>
15694: </ol>
15695: </div>
15696: </div>
1.2 hubertf 15697:
1.67 hubertf 15698: <div class="appendix" lang="en">
1.2 hubertf 15699: <div class="titlepage">
15700: <div>
15701: <div>
1.67 hubertf 15702: <h2 class="title"><a name=
1.46 gdt 15703: "editing"></a>Appendix D. Editing guidelines
1.2 hubertf 15704: for the pkgsrc guide</h2>
15705: </div>
15706: </div>
15707: </div>
15708:
15709: <div class="toc">
15710: <p><b>Table of Contents</b></p>
15711:
15712: <dl>
1.46 gdt 15713: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 15714: Targets</a></span></dt>
15715:
1.46 gdt 15716: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 15717: Procedure</a></span></dt>
15718: </dl>
15719: </div>
15720:
15721: <p>This section contains information on editing the pkgsrc
15722: guide itself.</p>
15723:
1.67 hubertf 15724: <div class="sect1" lang="en">
1.2 hubertf 15725: <div class="titlepage">
15726: <div>
15727: <div>
15728: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 15729: "targets"></a>D.1. Targets</h2>
1.2 hubertf 15730: </div>
15731: </div>
15732: </div>
15733:
1.45 wiz 15734: <p>The pkgsrc guide's source code is stored in <code xmlns=
15735: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15736: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 15737: are created from it:</p>
15738:
15739: <div class="itemizedlist">
15740: <ul type="disc">
15741: <li>
1.45 wiz 15742: <p><code xmlns=
15743: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 15744: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 15745: </li>
15746:
15747: <li>
1.45 wiz 15748: <p><code xmlns=
15749: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15750: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 15751: </li>
15752:
15753: <li>
1.45 wiz 15754: <p><code xmlns=
15755: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15756: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 15757: the documentation on the NetBSD website will be built
15758: from pkgsrc and kept up to date on the web server
15759: itself. This means you <span class=
15760: "emphasis"><em>must</em></span> make sure that your
15761: changes haven't broken the build!</p>
15762: </li>
1.6 hubertf 15763:
15764: <li>
1.45 wiz 15765: <p><code xmlns=
15766: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15767: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 15768: PDF version of the pkgsrc guide.</p>
15769: </li>
15770:
15771: <li>
1.45 wiz 15772: <p><code xmlns=
15773: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15774: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 15775: PostScript version of the pkgsrc guide.</p>
15776: </li>
1.2 hubertf 15777: </ul>
15778: </div>
15779: </div>
15780:
1.67 hubertf 15781: <div class="sect1" lang="en">
1.2 hubertf 15782: <div class="titlepage">
15783: <div>
15784: <div>
15785: <h2 class="title" style="clear: both"><a name=
1.46 gdt 15786: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 15787: </div>
15788: </div>
15789: </div>
15790:
15791: <p>The procedure to edit the pkgsrc guide is:</p>
15792:
15793: <div class="itemizedlist">
15794: <ul type="disc">
15795: <li>
1.6 hubertf 15796: <p>Make sure you have the packages needed to
15797: re-generate the pkgsrc guide (and other XML-based
15798: NetBSD documentation) installed. These are
1.11 ben 15799: “<span class="quote">netbsd-doc</span>”
1.47 reed 15800: for creating the ASCII and HTML versions, and
1.6 hubertf 15801: “<span class=
1.47 reed 15802: "quote">netbsd-doc-print</span>” for the
15803: PostScript and PDF versions. You will need both
1.6 hubertf 15804: packages installed, to make sure documentation is
15805: consistent across all formats. The packages can be
1.45 wiz 15806: found in <code xmlns=
15807: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15808: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45 wiz 15809: <code xmlns=
15810: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15811: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 15812: </li>
15813:
15814: <li>
1.45 wiz 15815: <p>Edit the XML file(s) in <code xmlns=
15816: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15817: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 15818: </li>
15819:
15820: <li>
1.14 xtraeme 15821: <p>Run <span><strong class="command">make extract
15822: && make do-lint</strong></span> in
1.45 wiz 15823: <code xmlns=
15824: "http://www.w3.org/TR/xhtml1/transitional" class=
15825: "filename">pkgsrc/doc/guide</code> to check the XML
15826: syntax, and fix it if needed.</p>
1.4 hubertf 15827: </li>
15828:
15829: <li>
1.14 xtraeme 15830: <p>Run <span><strong class=
1.45 wiz 15831: "command">make</strong></span> in <code xmlns=
15832: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15833: "filename">pkgsrc/doc/guide</code> to build the HTML
15834: and ASCII version.</p>
1.2 hubertf 15835: </li>
15836:
15837: <li>
1.14 xtraeme 15838: <p>If all is well, run <span><strong class=
15839: "command">make install-doc</strong></span> to put the
1.45 wiz 15840: generated files into <code xmlns=
15841: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15842: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 15843: </li>
15844:
15845: <li>
1.14 xtraeme 15846: <p><span><strong class="command">cvs commit
15847: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 15848: </li>
15849:
15850: <li>
1.14 xtraeme 15851: <p><span><strong class="command">cvs commit -m
15852: re-generate
15853: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 15854: </li>
1.4 hubertf 15855:
15856: <li>
15857: <p>Until the webserver on www.NetBSD.org is really
15858: updated automatically to pick up changes to the
1.14 xtraeme 15859: pkgsrc guide automatically, also run
1.18 xtraeme 15860: <span><strong class="command">make install-htdocs
1.14 xtraeme 15861: HTDOCSDIR=../../../htdocs</strong></span> (or
15862: similar, adjust <code class=
15863: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 15864: </li>
15865:
15866: <li>
1.14 xtraeme 15867: <p><span><strong class="command">cvs commit
15868: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 15869: </li>
1.2 hubertf 15870: </ul>
15871: </div>
15872: </div>
15873: </div>
1.1 grant 15874: </div>
15875: </body>
15876: </html>
CVSweb <webmaster@jp.NetBSD.org>